From 997b8cd73fe1da3f78803241c3cb6c767d5b66e9 Mon Sep 17 00:00:00 2001 From: "Uwe.Tews" Date: Sun, 27 Dec 2009 22:26:06 +0000 Subject: [PATCH] - fixed bug on modifier plugins at nocache output --- change_log.txt | 1 + .../smarty_internal_templatecompilerbase.php | 20 +++++++++++++++++++ 2 files changed, 21 insertions(+) diff --git a/change_log.txt b/change_log.txt index 5e47dab4..e5299804 100644 --- a/change_log.txt +++ b/change_log.txt @@ -10,6 +10,7 @@ - code cleanup for merging compiled templates - couple of runtime optimizations (still not all done) - update of getCachedTimestamp() +- fixed bug on modifier plugins at nocache output 12/19/2009 - bugfix on comment lines in config files diff --git a/libs/sysplugins/smarty_internal_templatecompilerbase.php b/libs/sysplugins/smarty_internal_templatecompilerbase.php index af1352ed..84a75800 100644 --- a/libs/sysplugins/smarty_internal_templatecompilerbase.php +++ b/libs/sysplugins/smarty_internal_templatecompilerbase.php @@ -266,6 +266,13 @@ class Smarty_Internal_TemplateCompilerBase { if (isset($this->template->required_plugins['compiled'][$plugin_name])) { $this->template->required_plugins['cache'][$plugin_name] = $this->template->required_plugins['compiled'][$plugin_name]; } + } else { + if (isset($this->template->required_plugins['cache'][$plugin_name])) { + $this->template->required_plugins['compiled'][$plugin_name] = $this->template->required_plugins['compiled'][$plugin_name]; + } + } + if ($type = 'modifier') { + $this->template->saved_modifer[$plugin_name] = true; } return $this->template->required_plugins_call[$plugin_name][$type]; } @@ -290,6 +297,10 @@ class Smarty_Internal_TemplateCompilerBase { $this->template->required_plugins['compiled'][$plugin_name]['file'] = $file; $this->template->required_plugins['compiled'][$plugin_name]['type'] = $type; } + if ($type = 'modifier') { + $this->template->saved_modifer[$plugin_name] = true; + } + return $plugin; } else { throw new Exception("Plugin {$type} \"{$plugin_name}\" not callable"); @@ -319,6 +330,15 @@ class Smarty_Internal_TemplateCompilerBase { $this->tag_nocache = false; $_output = str_replace("'", "\'", $content); $_output = "\n"; + // make sure we include modifer plugins for nocache code + if (isset($this->template->saved_modifer)) { + foreach ($this->template->saved_modifer as $plugin_name => $dummy) { + if (isset($this->template->required_plugins['compiled'][$plugin_name])) { + $this->template->required_plugins['cache'][$plugin_name] = $this->template->required_plugins['compiled'][$plugin_name]; + } + } + unset($this->template->saved_modifer); + } } else { $_output = $content; }