diff --git a/change_log.txt b/change_log.txt index 5d09952e..81e4f70c 100644 --- a/change_log.txt +++ b/change_log.txt @@ -1,4 +1,8 @@ ===== trunk ===== +02.03.2012 +- enhancement the default plugin handler can now also resolve undefined modifier (Smarty::PLUGIN_MODIFIER) + (Issue 85) + ===== Smarty-3.1.8 ===== 19.02.2012 - bugfix {include} could result in a fatal error if used in appended or prepended nested {block} tags diff --git a/libs/sysplugins/smarty_internal_compile_private_modifier.php b/libs/sysplugins/smarty_internal_compile_private_modifier.php index ca4d9077..584c4dd6 100644 --- a/libs/sysplugins/smarty_internal_compile_private_modifier.php +++ b/libs/sysplugins/smarty_internal_compile_private_modifier.php @@ -69,6 +69,12 @@ class Smarty_Internal_Compile_Private_Modifier extends Smarty_Internal_CompileBa if (!is_object($compiler->smarty->security_policy) || $compiler->smarty->security_policy->isTrustedPhpModifier($modifier, $compiler)) { $output = "{$modifier}({$params})"; } + } else if (is_callable($compiler->smarty->default_plugin_handler_func) && $compiler->getPluginFromDefaultHandler($modifier, Smarty::PLUGIN_MODIFIER) && isset($compiler->default_handler_plugins[Smarty::PLUGIN_MODIFIER][$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)) { + $output = "{$function}({$params})"; + } } else { $compiler->trigger_template_error("unknown modifier \"" . $modifier . "\"", $compiler->lex->taglineno); }