diff options
Diffstat (limited to 'vendor/smarty/smarty/libs/sysplugins/smarty_internal_compile_private_print_expression.php')
-rw-r--r-- | vendor/smarty/smarty/libs/sysplugins/smarty_internal_compile_private_print_expression.php | 41 |
1 files changed, 13 insertions, 28 deletions
diff --git a/vendor/smarty/smarty/libs/sysplugins/smarty_internal_compile_private_print_expression.php b/vendor/smarty/smarty/libs/sysplugins/smarty_internal_compile_private_print_expression.php index 811996bcc..2dde69488 100644 --- a/vendor/smarty/smarty/libs/sysplugins/smarty_internal_compile_private_print_expression.php +++ b/vendor/smarty/smarty/libs/sysplugins/smarty_internal_compile_private_print_expression.php @@ -67,7 +67,7 @@ class Smarty_Internal_Compile_Private_Print_Expression extends Smarty_Internal_C preg_match_all('/(\'[^\'\\\\]*(?:\\\\.[^\'\\\\]*)*\'|"[^"\\\\]*(?:\\\\.[^"\\\\]*)*"|:|[^:]+)/', $single_default_modifier, $mod_array); for ($i = 0, $count = count($mod_array[ 0 ]); $i < $count; $i ++) { - if ($mod_array[ 0 ][ $i ] != ':') { + if ($mod_array[ 0 ][ $i ] !== ':') { $modifierlist[ $key ][] = $mod_array[ 0 ][ $i ]; } } @@ -100,18 +100,18 @@ class Smarty_Internal_Compile_Private_Print_Expression extends Smarty_Internal_C if (isset($compiler->smarty->autoload_filters[ Smarty::FILTER_VARIABLE ])) { foreach ((array) $compiler->template->smarty->autoload_filters[ Smarty::FILTER_VARIABLE ] as $name) { - $result = $this->compile_output_filter($compiler, $name, $output); + $result = $this->compile_variable_filter($compiler, $name, $output); if ($result !== false) { $output = $result; } else { // not found, throw exception - throw new SmartyException("Unable to load filter '{$name}'"); + throw new SmartyException("Unable to load variable filter '{$name}'"); } } } foreach ($compiler->variable_filters as $filter) { - if (count($filter) == 1 && - ($result = $this->compile_output_filter($compiler, $filter[ 0 ], $output)) !== false + if (count($filter) === 1 && + ($result = $this->compile_variable_filter($compiler, $filter[ 0 ], $output)) !== false ) { $output = $result; } else { @@ -120,9 +120,7 @@ class Smarty_Internal_Compile_Private_Print_Expression extends Smarty_Internal_C } } } - - $compiler->has_output = true; - $output = "<?php echo {$output};?>"; + $output = "<?php echo {$output};?>\n"; } return $output; @@ -134,29 +132,16 @@ class Smarty_Internal_Compile_Private_Print_Expression extends Smarty_Internal_C * @param string $output embedded output * * @return string + * @throws \SmartyException */ - private function compile_output_filter(Smarty_Internal_TemplateCompilerBase $compiler, $name, $output) + private function compile_variable_filter(Smarty_Internal_TemplateCompilerBase $compiler, $name, $output) { - $plugin_name = "smarty_variablefilter_{$name}"; - $path = $compiler->smarty->loadPlugin($plugin_name); - if ($path) { - /** - if ($compiler->template->caching) { - $compiler->parent_compiler->template->compiled->required_plugins[ 'nocache' ][ $name ][ Smarty::FILTER_VARIABLE ][ 'file' ] = - $path; - $compiler->parent_compiler->template->compiled->required_plugins[ 'nocache' ][ $name ][ Smarty::FILTER_VARIABLE ][ 'function' ] = - $plugin_name; - } else { - $compiler->parent_compiler->template->compiled->required_plugins[ 'compiled' ][ $name ][ Smarty::FILTER_VARIABLE ][ 'file' ] = - $path; - $compiler->parent_compiler->template->compiled->required_plugins[ 'compiled' ][ $name ][ Smarty::FILTER_VARIABLE ][ 'function' ] = - $plugin_name; - } - * */ - return "{$plugin_name}({$output},\$_smarty_tpl)"; - } else { + $function= $compiler->getPlugin($name, 'variablefilter'); + if ($function) { + return "{$function}({$output},\$_smarty_tpl)"; + } else { // not found return false; - } + } } } |