diff options
author | Mario Vavti <mario@mariovavti.com> | 2015-12-06 21:09:58 +0100 |
---|---|---|
committer | Mario Vavti <mario@mariovavti.com> | 2015-12-06 21:09:58 +0100 |
commit | 26c465ad0c1d5b6801507ed190430f44ac92c672 (patch) | |
tree | 9e80c34da1235e6dd55942c23bf9511fac31344d /library/Smarty/libs/sysplugins/smarty_internal_compile_private_print_expression.php | |
parent | f2d70831838b0738e6895296f3e8ce02f86fec2f (diff) | |
download | volse-hubzilla-26c465ad0c1d5b6801507ed190430f44ac92c672.tar.gz volse-hubzilla-26c465ad0c1d5b6801507ed190430f44ac92c672.tar.bz2 volse-hubzilla-26c465ad0c1d5b6801507ed190430f44ac92c672.zip |
update smarty to 3.1.28-dev which fixes a bug where changes in a template are only visible on the second pageload which is annoying for developing
Diffstat (limited to 'library/Smarty/libs/sysplugins/smarty_internal_compile_private_print_expression.php')
-rw-r--r-- | library/Smarty/libs/sysplugins/smarty_internal_compile_private_print_expression.php | 53 |
1 files changed, 29 insertions, 24 deletions
diff --git a/library/Smarty/libs/sysplugins/smarty_internal_compile_private_print_expression.php b/library/Smarty/libs/sysplugins/smarty_internal_compile_private_print_expression.php index 188bbe77a..c0c089bff 100644 --- a/library/Smarty/libs/sysplugins/smarty_internal_compile_private_print_expression.php +++ b/library/Smarty/libs/sysplugins/smarty_internal_compile_private_print_expression.php @@ -23,6 +23,7 @@ class Smarty_Internal_Compile_Private_Print_Expression extends Smarty_Internal_C * @see Smarty_Internal_CompileBase */ public $optional_attributes = array('assign'); + /** * Attribute definition: Overwrites base class. * @@ -34,14 +35,14 @@ class Smarty_Internal_Compile_Private_Print_Expression extends Smarty_Internal_C /** * Compiles code for generating output from any expression * - * @param array $args array with attributes from parser - * @param object $compiler compiler object - * @param array $parameter array with compilation parameter + * @param array $args array with attributes from parser + * @param \Smarty_Internal_TemplateCompilerBase $compiler compiler object + * @param array $parameter array with compilation parameter * - * @throws SmartyException - * @return string compiled code + * @return string + * @throws \SmartyException */ - public function compile($args, $compiler, $parameter) + public function compile($args, Smarty_Internal_TemplateCompilerBase $compiler, $parameter) { // check and get attributes $_attr = $this->getAttributes($compiler, $args); @@ -57,7 +58,8 @@ class Smarty_Internal_Compile_Private_Print_Expression extends Smarty_Internal_C $output = $parameter['value']; // tag modifier if (!empty($parameter['modifierlist'])) { - $output = $compiler->compileTag('private_modifier', array(), array('modifierlist' => $parameter['modifierlist'], 'value' => $output)); + $output = $compiler->compileTag('private_modifier', array(), array('modifierlist' => $parameter['modifierlist'], + 'value' => $output)); } if (!$_attr['nofilter']) { // default modifier @@ -74,7 +76,8 @@ class Smarty_Internal_Compile_Private_Print_Expression extends Smarty_Internal_C } $compiler->default_modifier_list = $modifierlist; } - $output = $compiler->compileTag('private_modifier', array(), array('modifierlist' => $compiler->default_modifier_list, 'value' => $output)); + $output = $compiler->compileTag('private_modifier', array(), array('modifierlist' => $compiler->default_modifier_list, + 'value' => $output)); } // autoescape html if ($compiler->template->smarty->escape_html) { @@ -82,7 +85,8 @@ class Smarty_Internal_Compile_Private_Print_Expression extends Smarty_Internal_C } // loop over registered filters if (!empty($compiler->template->smarty->registered_filters[Smarty::FILTER_VARIABLE])) { - foreach ($compiler->template->smarty->registered_filters[Smarty::FILTER_VARIABLE] as $key => $function) { + foreach ($compiler->template->smarty->registered_filters[Smarty::FILTER_VARIABLE] as $key => + $function) { if (!is_array($function)) { $output = "{$function}({$output},\$_smarty_tpl)"; } elseif (is_object($function[0])) { @@ -104,13 +108,14 @@ class Smarty_Internal_Compile_Private_Print_Expression extends Smarty_Internal_C } } } - if (isset($compiler->template->variable_filters)) { - foreach ($compiler->template->variable_filters as $filter) { - if (count($filter) == 1 && ($result = $this->compile_output_filter($compiler, $filter[0], $output)) !== false) { - $output = $result; - } else { - $output = $compiler->compileTag('private_modifier', array(), array('modifierlist' => array($filter), 'value' => $output)); - } + foreach ($compiler->variable_filters as $filter) { + if (count($filter) == 1 && + ($result = $this->compile_output_filter($compiler, $filter[0], $output)) !== false + ) { + $output = $result; + } else { + $output = $compiler->compileTag('private_modifier', array(), array('modifierlist' => array($filter), + 'value' => $output)); } } } @@ -123,23 +128,23 @@ class Smarty_Internal_Compile_Private_Print_Expression extends Smarty_Internal_C } /** - * @param object $compiler compiler object - * @param string $name name of variable filter - * @param string $output embedded output + * @param \Smarty_Internal_TemplateCompilerBase $compiler compiler object + * @param string $name name of variable filter + * @param string $output embedded output * * @return string */ - private function compile_output_filter($compiler, $name, $output) + private function compile_output_filter(Smarty_Internal_TemplateCompilerBase $compiler, $name, $output) { $plugin_name = "smarty_variablefilter_{$name}"; $path = $compiler->smarty->loadPlugin($plugin_name, false); if ($path) { if ($compiler->template->caching) { - $compiler->template->required_plugins['nocache'][$name][Smarty::FILTER_VARIABLE]['file'] = $path; - $compiler->template->required_plugins['nocache'][$name][Smarty::FILTER_VARIABLE]['function'] = $plugin_name; + $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->template->required_plugins['compiled'][$name][Smarty::FILTER_VARIABLE]['file'] = $path; - $compiler->template->required_plugins['compiled'][$name][Smarty::FILTER_VARIABLE]['function'] = $plugin_name; + $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; } } else { // not found |