From f07ea419e7cb6720164cd5e516ee2cf635b59f38 Mon Sep 17 00:00:00 2001 From: mohrt Date: Wed, 17 Jul 2002 21:56:41 +0000 Subject: [PATCH] fix default modifier to work with config vars --- Smarty_Compiler.class.php | 12 ++++++++---- libs/Smarty_Compiler.class.php | 12 ++++++++---- 2 files changed, 16 insertions(+), 8 deletions(-) diff --git a/Smarty_Compiler.class.php b/Smarty_Compiler.class.php index 151a823f..000bacca 100644 --- a/Smarty_Compiler.class.php +++ b/Smarty_Compiler.class.php @@ -1108,13 +1108,11 @@ class Smarty_Compiler extends Smarty { $parts = explode('|', substr($var_expr, 1), 2); $var_ref = $parts[0]; $modifiers = isset($parts[1]) ? $parts[1] : ''; - + if(!empty($this->default_modifiers) && !strstr($modifiers,'smarty:nodefaults')) { $_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); preg_match_all('!\[(?:\$\w+|\w+(\.\w+)?)\]|(->|\.)\$?\w+|^\w+!', $var_ref, $match); $indexes = $match[0]; @@ -1220,6 +1218,12 @@ class Smarty_Compiler extends Smarty { for ($i = 0, $for_max = count($modifiers); $i < $for_max; $i++) { $modifier_name = $modifiers[$i]; + + if($modifier_name == 'smarty') { + // skip smarty modifier + continue; + } + preg_match_all('!:(' . $qstr_regexp . '|[^:]+)!', $modifier_arg_strings[$i], $match); $modifier_args = $match[1]; @@ -1229,7 +1233,7 @@ class Smarty_Compiler extends Smarty { } else { $map_array = 'true'; } - + $this->_add_plugin('modifier', $modifier_name); $this->_parse_vars_props($modifier_args); diff --git a/libs/Smarty_Compiler.class.php b/libs/Smarty_Compiler.class.php index 151a823f..000bacca 100644 --- a/libs/Smarty_Compiler.class.php +++ b/libs/Smarty_Compiler.class.php @@ -1108,13 +1108,11 @@ class Smarty_Compiler extends Smarty { $parts = explode('|', substr($var_expr, 1), 2); $var_ref = $parts[0]; $modifiers = isset($parts[1]) ? $parts[1] : ''; - + if(!empty($this->default_modifiers) && !strstr($modifiers,'smarty:nodefaults')) { $_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); preg_match_all('!\[(?:\$\w+|\w+(\.\w+)?)\]|(->|\.)\$?\w+|^\w+!', $var_ref, $match); $indexes = $match[0]; @@ -1220,6 +1218,12 @@ class Smarty_Compiler extends Smarty { for ($i = 0, $for_max = count($modifiers); $i < $for_max; $i++) { $modifier_name = $modifiers[$i]; + + if($modifier_name == 'smarty') { + // skip smarty modifier + continue; + } + preg_match_all('!:(' . $qstr_regexp . '|[^:]+)!', $modifier_arg_strings[$i], $match); $modifier_args = $match[1]; @@ -1229,7 +1233,7 @@ class Smarty_Compiler extends Smarty { } else { $map_array = 'true'; } - + $this->_add_plugin('modifier', $modifier_name); $this->_parse_vars_props($modifier_args);