diff --git a/change_log.txt b/change_log.txt index 021280d1..564118dc 100644 --- a/change_log.txt +++ b/change_log.txt @@ -6,6 +6,7 @@ - update {include_php} with new realpath handling - move $smarty->loadPlugin() into extension - minor compiler optimizations + - bugfix allow function plugins with name ending with 'close' https://github.com/smarty-php/smarty/issues/52 19.06.2015 - improvement allow closures as callback at $smarty->registerFilter() https://github.com/smarty-php/smarty/issues/59 diff --git a/libs/Smarty.class.php b/libs/Smarty.class.php index 1d4e7113..c8b4f18f 100644 --- a/libs/Smarty.class.php +++ b/libs/Smarty.class.php @@ -111,7 +111,7 @@ class Smarty extends Smarty_Internal_TemplateBase /** * smarty version */ - const SMARTY_VERSION = '3.1.28-dev/9'; + const SMARTY_VERSION = '3.1.28-dev/10'; /** * define variable scopes diff --git a/libs/sysplugins/smarty_internal_templatecompilerbase.php b/libs/sysplugins/smarty_internal_templatecompilerbase.php index b8bffdad..28bcf3f8 100644 --- a/libs/sysplugins/smarty_internal_templatecompilerbase.php +++ b/libs/sysplugins/smarty_internal_templatecompilerbase.php @@ -638,10 +638,20 @@ abstract class Smarty_Internal_TemplateCompilerBase if (isset($this->smarty->registered_plugins[Smarty::PLUGIN_BLOCK][$base_tag]) || isset($this->default_handler_plugins[Smarty::PLUGIN_BLOCK][$base_tag])) { return $this->callTagCompiler('private_registered_block', $args, $parameter, $tag); } + // registered function tag ? + if (isset($this->smarty->registered_plugins[Smarty::PLUGIN_FUNCTION][$tag])) { + return $this->callTagCompiler('private_registered_function', $args, $parameter, $tag); + } // block plugin? if ($function = $this->getPlugin($base_tag, Smarty::PLUGIN_BLOCK)) { return $this->callTagCompiler('private_block_plugin', $args, $parameter, $tag, $function); } + // function plugin? + if ($function = $this->getPlugin($tag, Smarty::PLUGIN_FUNCTION)) { + if (!isset($this->smarty->security_policy) || $this->smarty->security_policy->isTrustedTag($tag, $this)) { + return $this->callTagCompiler('private_function_plugin', $args, $parameter, $tag, $function); + } + } // registered compiler plugin ? if (isset($this->smarty->registered_plugins[Smarty::PLUGIN_COMPILER][$tag])) { // if compiler function plugin call it now