diff --git a/change_log.txt b/change_log.txt index 859384f5..75f2aee0 100644 --- a/change_log.txt +++ b/change_log.txt @@ -1,6 +1,9 @@ ===== SVN trunk ===== +17/12/2010 +- bugfix added missing support of $cache_attrs for registered plugins + 15/12/2010 -- bugfix assigment as condition in {while} did drop an E_NOTICE +- bugfix assignment as condition in {while} did drop an E_NOTICE 14/12/2010 - bugfix when passing an array as default parameter at {function} tag diff --git a/libs/sysplugins/smarty_internal_compile_private_registered_block.php b/libs/sysplugins/smarty_internal_compile_private_registered_block.php index 37e1de73..05403624 100644 --- a/libs/sysplugins/smarty_internal_compile_private_registered_block.php +++ b/libs/sysplugins/smarty_internal_compile_private_registered_block.php @@ -41,6 +41,9 @@ class Smarty_Internal_Compile_Private_Registered_Block extends Smarty_Internal_C foreach ($_attr as $_key => $_value) { if (is_int($_key)) { $_paramsArray[] = "$_key=>$_value"; + } elseif ($this->compiler->template->caching && in_array($_key,$compiler->smarty->registered_plugins[Smarty::PLUGIN_BLOCK][$tag][2])) { + $_value = str_replace("'","^#^",$_value); + $_paramsArray[] = "'$_key'=>^#^.var_export($_value,true).^#^"; } else { $_paramsArray[] = "'$_key'=>$_value"; } diff --git a/libs/sysplugins/smarty_internal_compile_private_registered_function.php b/libs/sysplugins/smarty_internal_compile_private_registered_function.php index ca4e68db..f79edf68 100644 --- a/libs/sysplugins/smarty_internal_compile_private_registered_function.php +++ b/libs/sysplugins/smarty_internal_compile_private_registered_function.php @@ -43,6 +43,9 @@ class Smarty_Internal_Compile_Private_Registered_Function extends Smarty_Interna foreach ($_attr as $_key => $_value) { if (is_int($_key)) { $_paramsArray[] = "$_key=>$_value"; + } elseif ($this->compiler->template->caching && in_array($_key,$compiler->smarty->registered_plugins[Smarty::PLUGIN_FUNCTION][$tag][2])) { + $_value = str_replace("'","^#^",$_value); + $_paramsArray[] = "'$_key'=>^#^.var_export($_value,true).^#^"; } else { $_paramsArray[] = "'$_key'=>$_value"; } diff --git a/libs/sysplugins/smarty_internal_register.php b/libs/sysplugins/smarty_internal_register.php index aee61584..edaa7ff1 100644 --- a/libs/sysplugins/smarty_internal_register.php +++ b/libs/sysplugins/smarty_internal_register.php @@ -35,10 +35,7 @@ class Smarty_Internal_Register { } elseif (!is_callable($callback)) { throw new Exception("Plugin \"{$tag}\" not callable"); } else { - $this->smarty->registered_plugins[$type][$tag] = array($callback, (bool) $cacheable); - if (isset($cache_attr)&&in_array($type, array(Smarty::PLUGIN_BLOCK, Smarty::PLUGIN_FUNCTION))) { - $this->smarty->registered_plugins[$type][$tag][] = (array) $cache_attr; - } + $this->smarty->registered_plugins[$type][$tag] = array($callback, (bool) $cacheable, (array) $cache_attr); } } diff --git a/libs/sysplugins/smarty_internal_templatecompilerbase.php b/libs/sysplugins/smarty_internal_templatecompilerbase.php index 38d612e0..da53a0fa 100644 --- a/libs/sysplugins/smarty_internal_templatecompilerbase.php +++ b/libs/sysplugins/smarty_internal_templatecompilerbase.php @@ -364,6 +364,7 @@ class Smarty_Internal_TemplateCompilerBase { ($this->nocache || $this->tag_nocache || $this->template->forceNocache == 2)) { $this->template->has_nocache_code = true; $_output = str_replace("'", "\'", $content); + $_output = str_replace("^#^", "'", $_output); $_output = "nocache_hash}%%*/" . $_output . "/*/%%SmartyNocache:{$this->nocache_hash}%%*/';?>"; // make sure we include modifer plugins for nocache code if (isset($this->template->saved_modifier)) {