mirror of
https://github.com/smarty-php/smarty.git
synced 2025-08-04 10:24:26 +02:00
Refactor.
This commit is contained in:
@@ -430,8 +430,7 @@ class Smarty_Compiler extends Smarty {
|
|||||||
if ($arg_name == 'file') {
|
if ($arg_name == 'file') {
|
||||||
$include_file = $arg_value;
|
$include_file = $arg_value;
|
||||||
continue;
|
continue;
|
||||||
}
|
} else if ($arg_name == 'assign') {
|
||||||
elseif ($arg_name == 'assign') {
|
|
||||||
$assign_var = $arg_value;
|
$assign_var = $arg_value;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@@ -439,22 +438,26 @@ class Smarty_Compiler extends Smarty {
|
|||||||
$arg_value = $arg_value ? 'true' : 'false';
|
$arg_value = $arg_value ? 'true' : 'false';
|
||||||
$arg_list[] = "'$arg_name' => $arg_value";
|
$arg_list[] = "'$arg_name' => $arg_value";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$output = '<?php ';
|
||||||
|
|
||||||
if (isset($assign_var)) {
|
if (isset($assign_var)) {
|
||||||
$return = "<?php ob_start();\n";
|
$output .= "ob_start();\n";
|
||||||
$return .=
|
}
|
||||||
"\$_smarty_tpl_vars = \$this->_tpl_vars;\n" .
|
|
||||||
"\$this->_smarty_include(".$include_file.", array(".implode(',', (array)$arg_list)."));\n" .
|
$output .=
|
||||||
"\$this->_tpl_vars = \$_smarty_tpl_vars;\n" .
|
"\$_smarty_tpl_vars = \$this->_tpl_vars;\n" .
|
||||||
"unset(\$_smarty_tpl_vars);\n";
|
"\$this->_smarty_include(".$include_file.", array(".implode(',', (array)$arg_list)."));\n" .
|
||||||
$return .= "\$this->assign('".$this->_dequote($assign_var)."',ob_get_contents()); ob_end_clean();\n?>";
|
"\$this->_tpl_vars = \$_smarty_tpl_vars;\n" .
|
||||||
} else {
|
"unset(\$_smarty_tpl_vars);\n";
|
||||||
$return = "<?php " .
|
|
||||||
"\$_smarty_tpl_vars = \$this->_tpl_vars;\n" .
|
if (isset($assign_var)) {
|
||||||
"\$this->_smarty_include(".$include_file.", array(".implode(',', (array)$arg_list)."));\n" .
|
$output .= "\$this->assign(" . $assign_var . ", ob_get_contents()); ob_end_clean();\n";
|
||||||
"\$this->_tpl_vars = \$_smarty_tpl_vars;\n" .
|
}
|
||||||
"unset(\$_smarty_tpl_vars); ?>";
|
|
||||||
}
|
$output .= ' ?>';
|
||||||
return $return;
|
|
||||||
|
return $output;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -484,13 +487,14 @@ class Smarty_Compiler extends Smarty {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!empty($attrs['assign'])) {
|
if (!empty($attrs['assign'])) {
|
||||||
$return = "<?php ob_start();\n";
|
$output = "<?php ob_start();\n";
|
||||||
$return .= "include('".$resource_name."');\n";
|
$output .= "include('" . $resource_name . "');\n";
|
||||||
$return .= "\$this->assign('".$this->_dequote($attrs['assign'])."',ob_get_contents()); ob_end_clean();\n?>";
|
$output .= "\$this->assign(" . $this->_dequote($attrs['assign']).", ob_get_contents()); ob_end_clean();\n?>";
|
||||||
} else {
|
} else {
|
||||||
$return = "<?php include('".$resource_name."'); ?>";
|
$output = "<?php include('" . $resource_name . "'); ?>";
|
||||||
}
|
}
|
||||||
return $return;
|
|
||||||
|
return $output;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@@ -430,8 +430,7 @@ class Smarty_Compiler extends Smarty {
|
|||||||
if ($arg_name == 'file') {
|
if ($arg_name == 'file') {
|
||||||
$include_file = $arg_value;
|
$include_file = $arg_value;
|
||||||
continue;
|
continue;
|
||||||
}
|
} else if ($arg_name == 'assign') {
|
||||||
elseif ($arg_name == 'assign') {
|
|
||||||
$assign_var = $arg_value;
|
$assign_var = $arg_value;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@@ -439,22 +438,26 @@ class Smarty_Compiler extends Smarty {
|
|||||||
$arg_value = $arg_value ? 'true' : 'false';
|
$arg_value = $arg_value ? 'true' : 'false';
|
||||||
$arg_list[] = "'$arg_name' => $arg_value";
|
$arg_list[] = "'$arg_name' => $arg_value";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$output = '<?php ';
|
||||||
|
|
||||||
if (isset($assign_var)) {
|
if (isset($assign_var)) {
|
||||||
$return = "<?php ob_start();\n";
|
$output .= "ob_start();\n";
|
||||||
$return .=
|
}
|
||||||
"\$_smarty_tpl_vars = \$this->_tpl_vars;\n" .
|
|
||||||
"\$this->_smarty_include(".$include_file.", array(".implode(',', (array)$arg_list)."));\n" .
|
$output .=
|
||||||
"\$this->_tpl_vars = \$_smarty_tpl_vars;\n" .
|
"\$_smarty_tpl_vars = \$this->_tpl_vars;\n" .
|
||||||
"unset(\$_smarty_tpl_vars);\n";
|
"\$this->_smarty_include(".$include_file.", array(".implode(',', (array)$arg_list)."));\n" .
|
||||||
$return .= "\$this->assign('".$this->_dequote($assign_var)."',ob_get_contents()); ob_end_clean();\n?>";
|
"\$this->_tpl_vars = \$_smarty_tpl_vars;\n" .
|
||||||
} else {
|
"unset(\$_smarty_tpl_vars);\n";
|
||||||
$return = "<?php " .
|
|
||||||
"\$_smarty_tpl_vars = \$this->_tpl_vars;\n" .
|
if (isset($assign_var)) {
|
||||||
"\$this->_smarty_include(".$include_file.", array(".implode(',', (array)$arg_list)."));\n" .
|
$output .= "\$this->assign(" . $assign_var . ", ob_get_contents()); ob_end_clean();\n";
|
||||||
"\$this->_tpl_vars = \$_smarty_tpl_vars;\n" .
|
}
|
||||||
"unset(\$_smarty_tpl_vars); ?>";
|
|
||||||
}
|
$output .= ' ?>';
|
||||||
return $return;
|
|
||||||
|
return $output;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -484,13 +487,14 @@ class Smarty_Compiler extends Smarty {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!empty($attrs['assign'])) {
|
if (!empty($attrs['assign'])) {
|
||||||
$return = "<?php ob_start();\n";
|
$output = "<?php ob_start();\n";
|
||||||
$return .= "include('".$resource_name."');\n";
|
$output .= "include('" . $resource_name . "');\n";
|
||||||
$return .= "\$this->assign('".$this->_dequote($attrs['assign'])."',ob_get_contents()); ob_end_clean();\n?>";
|
$output .= "\$this->assign(" . $this->_dequote($attrs['assign']).", ob_get_contents()); ob_end_clean();\n?>";
|
||||||
} else {
|
} else {
|
||||||
$return = "<?php include('".$resource_name."'); ?>";
|
$output = "<?php include('" . $resource_name . "'); ?>";
|
||||||
}
|
}
|
||||||
return $return;
|
|
||||||
|
return $output;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user