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

From: Date: Sat, 15 Mar 2003 20:47:30 +0000
Subject: cvs: smarty / NEWS /libs Smarty_Compiler.class.php
Groups: php.smarty.cvs 
Request: Send a blank email to php-smarty-cvs+get-461@lists.php.net to get a copy of this message
mohrt Sat Mar 15 15:47:30 2003 EDT Modified files: /smarty NEWS /smarty/libs Smarty_Compiler.class.php Log: back out "@" logic, apply only to default modifier special case Index: smarty/NEWS diff -u smarty/NEWS:1.310 smarty/NEWS:1.311 --- smarty/NEWS:1.310 Sat Mar 15 14:34:46 2003 +++ smarty/NEWS Sat Mar 15 15:47:29 2003 @@ -1,4 +1,4 @@ - - append "@" to _run_mod_handler and template var echos to + - append "@" to default modifier vars/args supress possible warnings (Monte) - fix problem with escaped double quotes (Monte) - fix html_radios to not return an array (Monte) Index: smarty/libs/Smarty_Compiler.class.php diff -u smarty/libs/Smarty_Compiler.class.php:1.192 smarty/libs/Smarty_Compiler.class.php:1.193 --- smarty/libs/Smarty_Compiler.class.php:1.192 Sat Mar 15 15:03:46 2003 +++ smarty/libs/Smarty_Compiler.class.php Sat Mar 15 15:47:29 2003 @@ -391,10 +391,6 @@ if(isset($_tag_attrs['assign'])) { return "<?php \$this->assign('" . $this->_dequote($_tag_attrs['assign']) . "', $_return ); ?>\n"; } else { - // prepend '@' if eching a variable - if(substr($_return, 0, 1) == '$') { - $_return = '@' . $_return; - } return "<?php echo $_return; ?>\n"; } } @@ -1615,38 +1611,45 @@ */ function _parse_modifiers(&$output, $modifier_string) { - preg_match_all('!\|(@?\w+)((?>:(?:'. $this->_qstr_regexp . '|[^|]+))*)!', '|' . $modifier_string, $match); - list(, $modifiers, $modifier_arg_strings) = $match; + preg_match_all('!\|(@?\w+)((?>:(?:'. $this->_qstr_regexp . '|[^|]+))*)!', '|' . $modifier_string, $_match); + list(, $_modifiers, $modifier_arg_strings) = $_match; - for ($i = 0, $for_max = count($modifiers); $i < $for_max; $i++) { - $modifier_name = $modifiers[$i]; + for ($_i = 0, $_for_max = count($_modifiers); $_i < $_for_max; $_i++) { + $_modifier_name = $_modifiers[$_i]; - if($modifier_name == 'smarty') { + if($_modifier_name == 'smarty') { // skip smarty modifier continue; } - preg_match_all('!:(' . $this->_qstr_regexp . '|[^:]+)!', $modifier_arg_strings[$i], $match); - $modifier_args = $match[1]; + preg_match_all('!:(' . $this->_qstr_regexp . '|[^:]+)!', $modifier_arg_strings[$_i], $_match); + $_modifier_args = $_match[1]; - if ($modifier_name{0} == '@') { - $map_array = 'false'; - $modifier_name = substr($modifier_name, 1); + if ($_modifier_name{0} == '@') { + $_map_array = 'false'; + $_modifier_name = substr($_modifier_name, 1); } else { - $map_array = 'true'; + $_map_array = 'true'; } - $this->_add_plugin('modifier', $modifier_name); - - $this->_parse_vars_props($modifier_args); + $this->_add_plugin('modifier', $_modifier_name); + $this->_parse_vars_props($_modifier_args); - if (count($modifier_args) > 0) - $modifier_args = ', '.implode(', ', $modifier_args); + if($_modifier_name == 'default') { + // supress notifications of default modifier vars and args + if($output{0} == '$') { + $output = '@' . $output; + } + if($_modifier_args[0]{0} == '$') { + $_modifier_args[0] = '@' . $_modifier_args[0]; + } + } + if (count($_modifier_args) > 0) + $_modifier_args = ', '.implode(', ', $_modifier_args); else - $modifier_args = ''; + $_modifier_args = ''; - - $output = "@\$this->_run_mod_handler('$modifier_name', $map_array, $output$modifier_args)"; + $output = "\$this->_run_mod_handler('$_modifier_name', $_map_array, $output$_modifier_args)"; } }

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