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_modifier.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_modifier.php')
-rw-r--r-- | library/Smarty/libs/sysplugins/smarty_internal_compile_private_modifier.php | 42 |
1 files changed, 29 insertions, 13 deletions
diff --git a/library/Smarty/libs/sysplugins/smarty_internal_compile_private_modifier.php b/library/Smarty/libs/sysplugins/smarty_internal_compile_private_modifier.php index ba03bfcfa..9594d2ae7 100644 --- a/library/Smarty/libs/sysplugins/smarty_internal_compile_private_modifier.php +++ b/library/Smarty/libs/sysplugins/smarty_internal_compile_private_modifier.php @@ -20,13 +20,14 @@ class Smarty_Internal_Compile_Private_Modifier extends Smarty_Internal_CompileBa /** * Compiles code for modifier execution * - * @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 * * @return string compiled code + * @throws \SmartyCompilerException */ - public function compile($args, $compiler, $parameter) + public function compile($args, Smarty_Internal_TemplateCompilerBase $compiler, $parameter) { // check and get attributes $_attr = $this->getAttributes($compiler, $args); @@ -52,7 +53,8 @@ class Smarty_Internal_Compile_Private_Modifier extends Smarty_Internal_CompileBa $output = "{$function}({$params})"; } else { if (is_object($function[0])) { - $output = '$_smarty_tpl->smarty->registered_plugins[Smarty::PLUGIN_MODIFIER][\'' . $modifier . '\'][0][0]->' . $function[1] . '(' . $params . ')'; + $output = '$_smarty_tpl->smarty->registered_plugins[Smarty::PLUGIN_MODIFIER][\'' . + $modifier . '\'][0][0]->' . $function[1] . '(' . $params . ')'; } else { $output = $function[0] . '::' . $function[1] . '(' . $params . ')'; } @@ -73,7 +75,9 @@ class Smarty_Internal_Compile_Private_Modifier extends Smarty_Internal_CompileBa // modifiercompiler plugin if ($compiler->smarty->loadPlugin('smarty_modifiercompiler_' . $modifier)) { // check if modifier allowed - if (!is_object($compiler->smarty->security_policy) || $compiler->smarty->security_policy->isTrustedModifier($modifier, $compiler)) { + if (!is_object($compiler->smarty->security_policy) || + $compiler->smarty->security_policy->isTrustedModifier($modifier, $compiler) + ) { $plugin = 'smarty_modifiercompiler_' . $modifier; $output = $plugin($single_modifier, $compiler); } @@ -85,7 +89,9 @@ class Smarty_Internal_Compile_Private_Modifier extends Smarty_Internal_CompileBa // modifier plugin if ($function = $compiler->getPlugin($modifier, Smarty::PLUGIN_MODIFIER)) { // check if modifier allowed - if (!is_object($compiler->smarty->security_policy) || $compiler->smarty->security_policy->isTrustedModifier($modifier, $compiler)) { + if (!is_object($compiler->smarty->security_policy) || + $compiler->smarty->security_policy->isTrustedModifier($modifier, $compiler) + ) { $output = "{$function}({$params})"; } $compiler->known_modifier_type[$modifier] = $type; @@ -96,7 +102,9 @@ class Smarty_Internal_Compile_Private_Modifier extends Smarty_Internal_CompileBa // PHP function if (is_callable($modifier)) { // check if modifier allowed - if (!is_object($compiler->smarty->security_policy) || $compiler->smarty->security_policy->isTrustedPhpModifier($modifier, $compiler)) { + if (!is_object($compiler->smarty->security_policy) || + $compiler->smarty->security_policy->isTrustedPhpModifier($modifier, $compiler) + ) { $output = "{$modifier}({$params})"; } $compiler->known_modifier_type[$modifier] = $type; @@ -105,21 +113,29 @@ class Smarty_Internal_Compile_Private_Modifier extends Smarty_Internal_CompileBa break; case 6: // default plugin handler - if (isset($compiler->default_handler_plugins[Smarty::PLUGIN_MODIFIER][$modifier]) || (is_callable($compiler->smarty->default_plugin_handler_func) && $compiler->getPluginFromDefaultHandler($modifier, Smarty::PLUGIN_MODIFIER))) { + if (isset($compiler->default_handler_plugins[Smarty::PLUGIN_MODIFIER][$modifier]) || + (is_callable($compiler->smarty->default_plugin_handler_func) && + $compiler->getPluginFromDefaultHandler($modifier, Smarty::PLUGIN_MODIFIER)) + ) { $function = $compiler->default_handler_plugins[Smarty::PLUGIN_MODIFIER][$modifier][0]; // check if modifier allowed - if (!is_object($compiler->smarty->security_policy) || $compiler->smarty->security_policy->isTrustedModifier($modifier, $compiler)) { + if (!is_object($compiler->smarty->security_policy) || + $compiler->smarty->security_policy->isTrustedModifier($modifier, $compiler) + ) { if (!is_array($function)) { $output = "{$function}({$params})"; } else { if (is_object($function[0])) { - $output = '$_smarty_tpl->smarty->registered_plugins[Smarty::PLUGIN_MODIFIER][\'' . $modifier . '\'][0][0]->' . $function[1] . '(' . $params . ')'; + $output = '$_smarty_tpl->smarty->registered_plugins[Smarty::PLUGIN_MODIFIER][\'' . + $modifier . '\'][0][0]->' . $function[1] . '(' . $params . ')'; } else { $output = $function[0] . '::' . $function[1] . '(' . $params . ')'; } } } - if (isset($compiler->template->required_plugins['nocache'][$modifier][Smarty::PLUGIN_MODIFIER]['file']) || isset($compiler->template->required_plugins['compiled'][$modifier][Smarty::PLUGIN_MODIFIER]['file'])) { + if (isset($compiler->parent_compiler->template->compiled->required_plugins['nocache'][$modifier][Smarty::PLUGIN_MODIFIER]['file']) || + isset($compiler->parent_compiler->template->compiled->required_plugins['compiled'][$modifier][Smarty::PLUGIN_MODIFIER]['file']) + ) { // was a plugin $compiler->known_modifier_type[$modifier] = 4; } else { @@ -130,7 +146,7 @@ class Smarty_Internal_Compile_Private_Modifier extends Smarty_Internal_CompileBa } } if (!isset($compiler->known_modifier_type[$modifier])) { - $compiler->trigger_template_error("unknown modifier \"" . $modifier . "\"", $compiler->lex->taglineno); + $compiler->trigger_template_error("unknown modifier \"" . $modifier . "\"", null, true); } } |