cvs: smarty / NEWS Smarty.class.php Smarty_Compiler.class.php

From: Date: Fri, 05 Apr 2002 17:16:55 +0000
Subject: cvs: smarty / NEWS Smarty.class.php Smarty_Compiler.class.php
Groups: php.smarty.cvs 
Request: Send a blank email to php-smarty-cvs+get-22@lists.php.net to get a copy of this message
andrei Fri Apr 5 12:16:55 2002 EDT Modified files: /smarty NEWS Smarty.class.php Smarty_Compiler.class.php Log: Make it possible to unregister pre/postfilter plugins. Index: smarty/NEWS diff -u smarty/NEWS:1.184 smarty/NEWS:1.185 --- smarty/NEWS:1.184 Thu Apr 4 15:34:43 2002 +++ smarty/NEWS Fri Apr 5 12:16:49 2002 @@ -1,4 +1,6 @@ - - added htmlall attribute to escape (Monte) + - added ability to unregister pre/postfilters plugins at + runtime. (Andrei) + - added 'htmlall' attribute to escape modifier. (Monte) - added template_exists() API function. (Andrei) - fixed a problem with using dynamic values for 'file' attribute of {include_php} tag. (Andrei) Index: smarty/Smarty.class.php diff -u smarty/Smarty.class.php:1.261 smarty/Smarty.class.php:1.262 --- smarty/Smarty.class.php:1.261 Thu Apr 4 15:34:43 2002 +++ smarty/Smarty.class.php Fri Apr 5 12:16:49 2002 @@ -370,7 +370,10 @@ \*======================================================================*/ function unregister_prefilter($function) { - unset($this->_plugins['prefilter'][$function]); + if (isset($this->_plugins['prefilter'][$function])) + unset($this->_plugins['prefilter'][$function]); + else + $this->_plugins['prefilter'][$function] = false; } /*======================================================================*\ @@ -390,7 +393,10 @@ \*======================================================================*/ function unregister_postfilter($function) { - unset($this->_plugins['postfilter'][$function]); + if (isset($this->_plugins['postfilter'][$function])) + unset($this->_plugins['postfilter'][$function]); + else + $this->_plugins['postfilter'][$function] = false; } /*======================================================================*\ Index: smarty/Smarty_Compiler.class.php diff -u smarty/Smarty_Compiler.class.php:1.107 smarty/Smarty_Compiler.class.php:1.108 --- smarty/Smarty_Compiler.class.php:1.107 Wed Apr 3 18:04:36 2002 +++ smarty/Smarty_Compiler.class.php Fri Apr 5 12:16:52 2002 @@ -80,6 +80,7 @@ // run template source through prefilter functions if (count($this->_plugins['prefilter']) > 0) { foreach ($this->_plugins['prefilter'] as $filter_name => $prefilter) { + if ($prefilter === false) continue; if ($prefilter[3] || function_exists($prefilter[0])) { $template_source = $prefilter[0]($template_source, $this); $this->_plugins['prefilter'][$filter_name][3] = true; @@ -176,6 +177,7 @@ // run compiled template through postfilter functions if (count($this->_plugins['postfilter']) > 0) { foreach ($this->_plugins['postfilter'] as $filter_name => $postfilter) { + if ($postfilter === false) continue; if ($postfilter[3] || function_exists($postfilter[0])) { $template_compiled = $postfilter[0]($template_compiled, $this); $this->_plugins['postfilter'][$filter_name][3] = true; @@ -1366,7 +1368,8 @@ $parts[2] != 'php' || ($parts[0] != 'prefilter' && $parts[0] != 'postfilter') || - isset($this->_plugins[$parts[0]][$parts[1]])) + (isset($this->_plugins[$parts[0]][$parts[1]]) && + $this->_plugins[$parts[0]][$parts[1]] === false)) continue; $plugin_file = $plugins_dir . '/' . $entry;

« previous php.smarty.cvs (#22) next »