From cecabd6cd23e4fa2e8c1e69c731f30cb480dc735 Mon Sep 17 00:00:00 2001 From: mohrt Date: Wed, 17 Jul 2002 21:33:12 +0000 Subject: [PATCH] change default modifiers to array instead of string --- NEWS | 1 + Smarty.class.php | 6 +++--- Smarty_Compiler.class.php | 6 +++--- libs/Smarty.class.php | 6 +++--- libs/Smarty_Compiler.class.php | 6 +++--- 5 files changed, 13 insertions(+), 12 deletions(-) diff --git a/NEWS b/NEWS index b886c68f..eb58a63d 100644 --- a/NEWS +++ b/NEWS @@ -1,3 +1,4 @@ + - add default modifier logic (Monte) - updated popup_init to be xhtml compliant (Tom Oram, Monte) - fix filename bug with windows (Gary Loescher, Monte) - add ability to supply expire time in seconds when clearing diff --git a/Smarty.class.php b/Smarty.class.php index 5d876197..dec395fb 100644 --- a/Smarty.class.php +++ b/Smarty.class.php @@ -152,9 +152,9 @@ class Smarty // sub directories are more efficient, but // you can set this to false if your PHP environment // does not allow the creation of them. - var $default_modifiers = ''; - // modifier string to implicitly append to every var - // example: '|escape:"htmlall"' + var $default_modifiers = array(); + // modifiers to implicitly append to every var + // example: array('escape:"htmlall"'); /**************************************************************************/ /* END SMARTY CONFIGURATION SECTION */ diff --git a/Smarty_Compiler.class.php b/Smarty_Compiler.class.php index d65d46bc..2707ae70 100644 --- a/Smarty_Compiler.class.php +++ b/Smarty_Compiler.class.php @@ -1109,9 +1109,9 @@ class Smarty_Compiler extends Smarty { $var_ref = $parts[0]; $modifiers = isset($parts[1]) ? $parts[1] : ''; - - if(!empty($this->default_modifiers) && !strstr($modifiers,'smarty:nodefaults')) { - $modifiers = empty($modifiers) ? $this->default_modifiers : $this->default_modifiers . '|' . $modifiers; + if(!empty($this->default_modifiers) && !strstr('smarty:nodefaults',$modifiers)) { + $_default_mod_string = implode('|',(array)$this->default_modifiers); + $modifiers = empty($modifiers) ? $_default_mod_string : $_default_mod_string . '|' . $modifiers; } $modifiers = str_replace(array('smarty:nodefaults','||'),array('','|'),$modifiers); diff --git a/libs/Smarty.class.php b/libs/Smarty.class.php index 5d876197..dec395fb 100644 --- a/libs/Smarty.class.php +++ b/libs/Smarty.class.php @@ -152,9 +152,9 @@ class Smarty // sub directories are more efficient, but // you can set this to false if your PHP environment // does not allow the creation of them. - var $default_modifiers = ''; - // modifier string to implicitly append to every var - // example: '|escape:"htmlall"' + var $default_modifiers = array(); + // modifiers to implicitly append to every var + // example: array('escape:"htmlall"'); /**************************************************************************/ /* END SMARTY CONFIGURATION SECTION */ diff --git a/libs/Smarty_Compiler.class.php b/libs/Smarty_Compiler.class.php index d65d46bc..2707ae70 100644 --- a/libs/Smarty_Compiler.class.php +++ b/libs/Smarty_Compiler.class.php @@ -1109,9 +1109,9 @@ class Smarty_Compiler extends Smarty { $var_ref = $parts[0]; $modifiers = isset($parts[1]) ? $parts[1] : ''; - - if(!empty($this->default_modifiers) && !strstr($modifiers,'smarty:nodefaults')) { - $modifiers = empty($modifiers) ? $this->default_modifiers : $this->default_modifiers . '|' . $modifiers; + if(!empty($this->default_modifiers) && !strstr('smarty:nodefaults',$modifiers)) { + $_default_mod_string = implode('|',(array)$this->default_modifiers); + $modifiers = empty($modifiers) ? $_default_mod_string : $_default_mod_string . '|' . $modifiers; } $modifiers = str_replace(array('smarty:nodefaults','||'),array('','|'),$modifiers);