Re: [SMARTY-DEV] [patch] code cleanup

From: Date: Tue, 29 May 2007 16:00:59 +0000
Subject: Re: [SMARTY-DEV] [patch] code cleanup
References: 1 2  Groups: php.smarty.dev 
Request: Send a blank email to php-smarty-dev+get-3012@lists.php.net to get a copy of this message
FWIW: I always tried to follow the rule: - whitespace between control-structure-keyword and condition - no whitespace between function/method-name and argument list so "if (..." is right and "if(..." is false. and "foo(..." is right and "foo (..." is false. but I agree that it's not acceptable to mix whitespace-cleanups with changes in one huge patch. and I'm -1 on changing and/or touching {strip} in any way. On Tue, May 29, 2007 at 08:50:17AM -0700, boots wrote: > Hi. > > You didn't mention exactly what your cleanup goals were. If it was consistency, > you may have chose the existing prevalent style, but I suppose you intended to > enforce a new style. FWIW, I'm not against style changes that differentiate > keywords from invocations ie: if ($foo) instead of if($foo) and foo($bar) > instead of foo ($bar). I don't care for putting whitespace around the > assignment in function/method declarations ie: I personally prefer function > foo($bar=0) rather than function foo($bar = 0). I noticed too that you added > some docblocks but also that you modified (extended) the length of some > existing comments. Aside from some trivial whitespacing, I couldn't notice any > other changes in your patch. Did I miss any? > > I should say that it is a pity that you mixed formatting changes with semantic > actual code changes, particularly for a patch this size. You might consider > reposting as separate patches as I don't think it is appropriate otherwise. > > Thanks, > boots > > --- Giovanni Giacobbi <giovanni@giacobbi.net> wrote: > > > > > Attached there is a patch mostly of coding style cleanup. > > > > I had to go through Smarty code for implementing a compiler plugin, so it was > > a good chance to clean up the coding style. You should be more strict about > > that! > > > > The patch should be audited before commit. It contains no semantic changes > > with the following exceptions: > > > > Smarty.class.php, get_template_vars(): > > changed phpdoc return type to "mixed" (you should change it elsewhere as > > well) > > > > Smart_Compiler.class.php, _compile_tag(): > > splitted "strip" and "/strip" handling, i'm not 100% about > > correctness of > > this change. > > > > Smart_Compiler.class.php, _smarty_sort_length(): > > changed @return type > > > > if you want to reproduce this diff, change all "if(" with "if (" and > > "else > > if" with "elseif", trim trailing spaces, and fix indentation where needed. > > > > Regards > > > > -- > > Giovanni Giacobbi > > > ? smarty-cvs-cleanup.patch > > --- Smarty.class.php 8 Mar 2007 19:11:22 -0000 1.529 > > +++ Smarty.class.php 29 May 2007 10:47:10 -0000 > > @@ -35,7 +35,7 @@ > > /** > > * DIR_SEP isn't used anymore, but third party apps might > > */ > > -if(!defined('DIR_SEP')) { > > +if (!defined('DIR_SEP')) { > > define('DIR_SEP', DIRECTORY_SEPARATOR); > > } > > > > @@ -562,6 +562,7 @@ > > var $_cache_including = false; > > > > /**#@-*/ > > + > > /** > > * The class constructor. > > */ > > @@ -615,10 +616,10 @@ > > // $tpl_var is an array, ignore $value > > foreach ($tpl_var as $_key => $_val) { > > if ($_key != '') { > > - if(!@is_array($this->_tpl_vars[$_key])) { > > + if (!@is_array($this->_tpl_vars[$_key])) { > > settype($this->_tpl_vars[$_key],'array'); > > } > > - if($merge && is_array($_val)) { > > + if ($merge && is_array($_val)) { > > foreach($_val as $_mkey => $_mval) { > > $this->_tpl_vars[$_key][$_mkey] = $_mval; > > } > > @@ -629,10 +630,10 @@ > > } > > } else { > > if ($tpl_var != '' && isset($value)) { > > - if(!@is_array($this->_tpl_vars[$tpl_var])) { > > + if (!@is_array($this->_tpl_vars[$tpl_var])) { > > settype($this->_tpl_vars[$tpl_var],'array'); > > } > > - if($merge && is_array($value)) { > > + if ($merge && is_array($value)) { > > foreach($value as $_mkey => $_mval) { > > $this->_tpl_vars[$tpl_var][$_mkey] = $_mval; > > } > > @@ -652,7 +653,7 @@ > > function append_by_ref($tpl_var, &$value, $merge=false) > > { > > if ($tpl_var != '' && isset($value)) { > > - if(!@is_array($this->_tpl_vars[$tpl_var])) { > > + if (!@is_array($this->_tpl_vars[$tpl_var])) { > > settype($this->_tpl_vars[$tpl_var],'array'); > > } > > if ($merge && is_array($value)) { > > @@ -665,7 +666,6 @@ > > } > > } > > > > - > > /** > > * clear the given assigned template variable. > > * > > @@ -680,7 +680,6 @@ > > unset($this->_tpl_vars[$tpl_var]); > > } > > > > - > > /** > > * Registers custom function to be used in templates > > * > > @@ -960,7 +959,6 @@ > > > > } > > > > - > > /** > > * clear the entire contents of cache (all templates) > > * > > @@ -972,7 +970,6 @@ > > return $this->clear_cache(null, null, null, $exp_time); > > } > > > > - > > /** > > * test to see if valid cache exists for this template > > * > > @@ -998,7 +995,6 @@ > > return smarty_core_read_cache_file($_params, $this); > > } > > > > - > > /** > > * clear all the assigned template variables. > > * > > @@ -1049,18 +1045,18 @@ > > * > > * @param string $name > > * @param string $type > > - * @return array > > + * @return mixed > > */ > > - function &get_template_vars($name=null) > > + function &get_template_vars($name = null) > > { > > - if(!isset($name)) { > > + if (!isset($name)) { > > return $this->_tpl_vars; > > - } elseif(isset($this->_tpl_vars[$name])) { > > + } elseif (isset($this->_tpl_vars[$name])) { > > return $this->_tpl_vars[$name]; > > } else { > > // var non-existant, return valid reference > > $_tmp = null; > > - return $_tmp; > > + return $_tmp; > > } > > } > > > > @@ -1071,11 +1067,11 @@ > > * @param string $type > > * @return array > > */ > > - function &get_config_vars($name=null) > > + function &get_config_vars($name = null) > > { > > - if(!isset($name) && is_array($this->_config[0])) { > > + if (!isset($name) && is_array($this->_config[0])) { > > return $this->_config[0]['vars']; > > - } else if(isset($this->_config[0]['vars'][$name])) { > > + } elseif (isset($this->_config[0]['vars'][$name])) { > > return $this->_config[0]['vars'][$name]; > > } else { > > // var non-existant, return valid reference > > @@ -1095,7 +1091,6 @@ > > trigger_error("Smarty error: $error_msg", $error_type); > > } > > > > - > > /** > > * executes & displays the template results > > * > > @@ -1119,7 +1114,7 @@ > > function fetch($resource_name, $cache_id = null, $compile_id = null, > > $display = false) > > { > > static $_cache_info = array(); > > - > > + > > $_smarty_old_error_level = $this->debugging ? error_reporting() : > > error_reporting(isset($this->error_reporting) > > ? $this->error_reporting : error_reporting() & ~E_NOTICE); > > > > @@ -1347,7 +1342,7 @@ > > */ > > function clear_config($var = null) > > { > > - if(!isset($var)) { > > + if (!isset($var)) { > > // clear all values > > $this->_config = array(array('vars' => array(), > > 'files' => array())); > > @@ -1370,7 +1365,7 @@ > > return smarty_core_assemble_plugin_filepath($_params, $this); > > } > > > > - /** > > + /** > > * test if resource needs compiling > > * > > * @param string $resource_name > > @@ -1403,7 +1398,7 @@ > > } > > } > > > > - /** > > + /** > > * compile the template > > * > > * @param string $resource_name > > @@ -1439,7 +1434,7 @@ > > > > } > > > > - /** > > + /** > > * compile the given source > > * > > * @param string $resource_name > > @@ -1529,11 +1524,10 @@ > > * @param boolean $quiet > > * @return boolean > > */ > > - > > function _fetch_resource_info(&$params) > > { > > - if(!isset($params['get_source'])) { $params['get_source'] = > > true; } > > - if(!isset($params['quiet'])) { $params['quiet'] = false; } > > + if (!isset($params['get_source'])) { $params['get_source'] = > > true; } > > + if (!isset($params['quiet'])) { $params['quiet'] = false; } > > > > $_return = false; > > $_params = array('resource_name' => > > $params['resource_name']) ; > > @@ -1590,7 +1584,7 @@ > > if (!$params['quiet']) { > > $this->trigger_error('unable to read resource: "' . > > $params['resource_name'] . '"'); > > } > > - } else if ($_return && $this->security) { > > + } elseif ($_return && $this->security) { > > require_once(SMARTY_CORE_DIR . 'core.is_secure.php'); > > if (!smarty_core_is_secure($_params, $this)) { > > if (!$params['quiet']) > > @@ -1603,7 +1597,6 @@ > > return $_return; > > } > > > > - > > /** > > * parse out the type and name from the resource > > * > > @@ -1613,7 +1606,6 @@ > > * @param string $resource_name > > * @return boolean > > */ > > - > > function _parse_resource_name(&$params) > > { > > > > @@ -1625,7 +1617,7 @@ > > $params['resource_type'] = $this->default_resource_type; > > $params['resource_name'] = $_resource_name_parts[0]; > > } else { > > - if(strlen($_resource_name_parts[0]) == 1) { > > + if (strlen($_resource_name_parts[0]) == 1) { > > // 1 char is not resource type, but part of filepath > > $params['resource_type'] = $this->default_resource_type; > > $params['resource_name'] = $params['resource_name']; > > @@ -1648,7 +1640,7 @@ > > // didn't find the file, try include_path > > $_params = array('file_path' => $_fullpath); > > require_once(SMARTY_CORE_DIR . > > 'core.get_include_path.php'); > > - if(smarty_core_get_include_path($_params, $this)) { > > + if (smarty_core_get_include_path($_params, $this)) { > > $params['resource_name'] = > > $_params['new_file_path']; > > return true; > > } > > @@ -1667,7 +1659,6 @@ > > return true; > > } > > > > - > > /** > > * Handle modifiers > > * > > @@ -1741,14 +1732,14 @@ > > $_compile_dir_sep = $this->use_sub_dirs ? DIRECTORY_SEPARATOR : > > '^'; > > $_return = $auto_base . DIRECTORY_SEPARATOR; > > > > - if(isset($auto_id)) { > > + if (isset($auto_id)) { > > // make auto_id safe for directory names > > $auto_id = > > str_replace('%7C',$_compile_dir_sep,(urlencode($auto_id))); > > // split into separate directories > > $_return .= $auto_id . $_compile_dir_sep; > > } > > > > - if(isset($auto_source)) { > > + if (isset($auto_source)) { > > // make source name safe for filename > > $_filename = urlencode(basename($auto_source)); > > $_crc32 = sprintf('%08X', crc32($auto_source)); > > @@ -1770,8 +1761,8 @@ > > */ > > function _unlink($resource, $exp_time = null) > > { > > - if(isset($exp_time)) { > > - if(time() - @filemtime($resource) >= $exp_time) { > > + if (isset($exp_time)) { > > + if (time() - @filemtime($resource) >= $exp_time) { > > return @unlink($resource); > > } > > } else { > > @@ -1789,7 +1780,7 @@ > > function _get_auto_id($cache_id=null, $compile_id=null) { > > if (isset($cache_id)) > > return (isset($compile_id)) ? $cache_id . '|' . $compile_id : > > $cache_id; > > - elseif(isset($compile_id)) > > + elseif (isset($compile_id)) > > return $compile_id; > > else > > return null; > > @@ -1808,7 +1799,7 @@ > > function _trigger_fatal_error($error_msg, $tpl_file = null, $tpl_line = > > null, > > $file = null, $line = null, $error_type = E_USER_ERROR) > > { > > - if(isset($file) && isset($line)) { > > + if (isset($file) && isset($line)) { > > $info = ' ('.basename($file).", line $line)"; > > } else { > > $info = ''; > > --- Smarty_Compiler.class.php 11 May 2007 13:45:36 -0000 1.397 > > +++ Smarty_Compiler.class.php 29 May 2007 10:47:11 -0000 > > @@ -162,7 +162,7 @@ > > . '(?:\s*,\s*' . $this->_obj_single_param_regexp . > > ')*)?\)'; > > $this->_obj_start_regexp = '(?:' . $this->_dvar_regexp . > > '(?:' . > > $this->_obj_ext_regexp . ')+)'; > > $this->_obj_call_regexp = '(?:' . $this->_obj_start_regexp . > > '(?:' . > > $this->_obj_params_regexp . ')?(?:' . $this->_dvar_math_regexp . > > '(?:' . > > $this->_num_const_regexp . '|' . $this->_dvar_math_var_regexp . > > ')*)?)'; > > - > > + > > // matches valid modifier syntax: > > // |foo > > // |@foo > > @@ -257,7 +257,7 @@ > > /* fetch all special blocks */ > > $search = > > > > "~{$ldq}\*(.*?)\*{$rdq}|{$ldq}\s*literal\s*{$rdq}(.*?){$ldq}\s*/literal\s*{$rdq}|{$ldq}\s*php\s*{$rdq}(.*?){$ldq}\s*/php\s*{$rdq}~s"; > > > > - preg_match_all($search, $source_content, $match, PREG_SET_ORDER); > > + preg_match_all($search, $source_content, $match, PREG_SET_ORDER); > > $this->_folded_blocks = $match; > > reset($this->_folded_blocks); > > > > @@ -290,10 +290,10 @@ > > if ($this->php_handling == SMARTY_PHP_PASSTHRU) { > > /* echo php contents */ > > $text_blocks[$curr_tb] = > > str_replace('%%%SMARTYSP'.$curr_sp.'%%%', '<?php echo > > \''.str_replace("'", > > "\'", $sp_match[1][$curr_sp]).'\'; ?>'."\n", > > $text_blocks[$curr_tb]); > > - } else if ($this->php_handling == SMARTY_PHP_QUOTE) { > > + } elseif ($this->php_handling == SMARTY_PHP_QUOTE) { > > /* quote php tags */ > > $text_blocks[$curr_tb] = > > str_replace('%%%SMARTYSP'.$curr_sp.'%%%', > > htmlspecialchars($sp_match[1][$curr_sp]), $text_blocks[$curr_tb]); > > - } else if ($this->php_handling == SMARTY_PHP_REMOVE) { > > + } elseif ($this->php_handling == SMARTY_PHP_REMOVE) { > > /* remove php tags */ > > $text_blocks[$curr_tb] = > > str_replace('%%%SMARTYSP'.$curr_sp.'%%%', '', > > $text_blocks[$curr_tb]); > > } else { > > @@ -304,7 +304,7 @@ > > } > > } > > } > > - > > + > > /* Compile the template tags into PHP code. */ > > $compiled_tags = array(); > > for ($i = 0, $for_max = count($template_tags); $i < $for_max; $i++) > > { > > @@ -312,7 +312,9 @@ > > $compiled_tags[] = $this->_compile_tag($template_tags[$i]); > > $this->_current_line_no += substr_count($template_tags[$i], > > "\n"); > > } > > - if (count($this->_tag_stack)>0) { > > + > > + /* Stack must now be empty after processing */ > > + if (count($this->_tag_stack) > 0) { > > list($_open_tag, $_line_no) = end($this->_tag_stack); > > $this->_syntax_error("unclosed tag \{$_open_tag} (opened line > > $_line_no).", E_USER_ERROR, __FILE__, __LINE__); > > return; > > @@ -349,9 +351,9 @@ > > } > > } > > $compiled_content = ''; > > - > > + > > $tag_guard = '%%%SMARTYOTG' . md5(uniqid(rand(), true)) . > > '%%%'; > > - > > + > > /* Interleave the compiled contents and text blocks to get the final > > result. */ > > for ($i = 0, $for_max = count($compiled_tags); $i < $for_max; $i++) > > { > > if ($compiled_tags[$i] == '') { > > @@ -361,7 +363,7 @@ > > // replace legit PHP tags with placeholder > > $text_blocks[$i] = str_replace('<?', $tag_guard, > > $text_blocks[$i]); > > $compiled_tags[$i] = str_replace('<?', $tag_guard, > > $compiled_tags[$i]); > > - > > + > > $compiled_content .= $text_blocks[$i] . $compiled_tags[$i]; > > } > > $compiled_content .= str_replace('<?', $tag_guard, > > $text_blocks[$i]); > > @@ -372,7 +374,7 @@ > > > > // recover legit tags > > $compiled_content = str_replace($tag_guard, '<?', > > $compiled_content); > > - > > + > > // remove \n from the end of the file, if any > > if (strlen($compiled_content) && (substr($compiled_content, -1) == > > "\n") ) { > > $compiled_content = substr($compiled_content, 0, -1); > > @@ -437,15 +439,15 @@ > > /* Matched comment. */ > > if (substr($template_tag, 0, 1) == '*' && substr($template_tag, > > -1) > > == '*') > > return ''; > > - > > + > > /* Split tag into two three parts: command, command modifiers and > > the arguments. */ > > - if(! preg_match('~^(?:(' . $this->_num_const_regexp . '|' > > . > > $this->_obj_call_regexp . '|' . $this->_var_regexp > > + if (!preg_match('~^(?:(' . $this->_num_const_regexp . '|' > > . > > $this->_obj_call_regexp . '|' . $this->_var_regexp > > . '|\/?' . $this->_reg_obj_regexp . '|\/?' . > > $this->_func_regexp . ')(' . $this->_mod_regexp . '*)) > > (?:\s+(.*))?$ > > ~xs', $template_tag, $match)) { > > $this->_syntax_error("unrecognized tag: $template_tag", > > E_USER_ERROR, __FILE__, __LINE__); > > } > > - > > + > > $tag_command = $match[1]; > > $tag_modifier = isset($match[2]) ? $match[2] : null; > > $tag_args = isset($match[3]) ? $match[3] : null; > > @@ -511,7 +513,6 @@ > > case 'sectionelse': > > $this->_push_tag('sectionelse'); > > return "<?php endfor; else: ?>"; > > - break; > > > > case '/section': > > $_open_tag = $this->_pop_tag('section'); > > @@ -523,7 +524,6 @@ > > case 'foreach': > > $this->_push_tag('foreach'); > > return $this->_compile_foreach_start($tag_args); > > - break; > > > > case 'foreachelse': > > $this->_push_tag('foreachelse'); > > @@ -535,22 +535,20 @@ > > return "<?php endif; unset(\$_from); ?>"; > > else > > return "<?php endforeach; endif; unset(\$_from); ?>"; > > - break; > > > > case 'strip': > > + $this->_push_tag('strip'); > > + if ($this->_strip_depth++ == 0) { /* outermost opening > > {strip} */ > > + $this->_additional_newline = ""; > > + return '{strip}'; > > + } > > + return ''; > > + > > case '/strip': > > - if (substr($tag_command, 0, 1)=='/') { > > - $this->_pop_tag('strip'); > > - if (--$this->_strip_depth==0) { /* outermost closing > > {/strip} */ > > - $this->_additional_newline = "\n"; > > - return '{' . $tag_command . '}'; > > - } > > - } else { > > - $this->_push_tag('strip'); > > - if ($this->_strip_depth++==0) { /* outermost opening > > {strip} */ > > - $this->_additional_newline = ""; > > - return '{' . $tag_command . '}'; > > - } > > + $this->_pop_tag('strip'); > > + if (--$this->_strip_depth == 0) { /* outermost closing > > {/strip} */ > > + $this->_additional_newline = "\n"; > > + return '{/strip}'; > > } > > return ''; > > > > @@ -582,10 +580,10 @@ > > default: > > if ($this->_compile_compiler_tag($tag_command, $tag_args, > > $output)) { > > return $output; > > - } else if ($this->_compile_block_tag($tag_command, > > $tag_args, $tag_modifier, $output)) { > > + } elseif ($this->_compile_block_tag($tag_command, $tag_args, > > $tag_modifier, $output)) { > > + return $output; > > + } elseif ($this->_compile_custom_tag($tag_command, > > $tag_args, $tag_modifier, $output)) { > > return $output; > > - } else if ($this->_compile_custom_tag($tag_command, > > $tag_args, $tag_modifier, $output)) { > > - return $output; > > } else { > > $this->_syntax_error("unrecognized tag > > '$tag_command'", > > E_USER_ERROR, __FILE__, __LINE__); > > } > > @@ -593,7 +591,6 @@ > > } > > } > > > > - > > /** > > * compile the custom compiler tag > > * > > @@ -624,7 +621,7 @@ > > * Otherwise we need to load plugin file and look for the function > > * inside it. > > */ > > - else if ($plugin_file = $this->_get_plugin_filepath('compiler', > > $tag_command)) { > > + elseif ($plugin_file = $this->_get_plugin_filepath('compiler', > > $tag_command)) { > > $found = true; > > > > include_once $plugin_file; > > @@ -647,10 +644,11 @@ > > if ($found) { > > if ($have_function) { > > $output = call_user_func_array($plugin_func, > > array($tag_args, &$this)); > > - if($output != '') { > > - $output = '<?php ' . > > $this->_push_cacheable_state('compiler', $tag_command) > > - . $output > > - . $this->_pop_cacheable_state('compiler', > > $tag_command) . ' ?>'; > > + if ($output != '') { > > + $output = '<?php ' > > + . $this->_push_cacheable_state('compiler', > > $tag_command) > > + . $output > > + . $this->_pop_cacheable_state('compiler', > > $tag_command) . ' ?>'; > > } > > } else { > > $this->_syntax_error($message, E_USER_WARNING, __FILE__, > > __LINE__); > > @@ -661,7 +659,6 @@ > > } > > } > > > > - > > /** > > * compile block function tag > > * > > @@ -699,7 +696,7 @@ > > * Otherwise we need to load plugin file and look for the function > > * inside it. > > */ > > - else if ($plugin_file = $this->_get_plugin_filepath('block', > > $tag_command)) { > > + elseif ($plugin_file = $this->_get_plugin_filepath('block', > > $tag_command)) { > > $found = true; > > > > include_once $plugin_file; > > @@ -710,13 +707,12 @@ > > $have_function = false; > > } else { > > $this->_plugins['block'][$tag_command] = array($plugin_func, > > null, null, null, true); > > - > > } > > } > > > > if (!$found) { > > return false; > > - } else if (!$have_function) { > > + } elseif (!$have_function) { > > $this->_syntax_error($message, E_USER_WARNING, __FILE__, > > __LINE__); > > return true; > > } > > @@ -739,7 +735,7 @@ > > $_cache_attrs=''; > > $arg_list = $this->_compile_arg_list('block', $tag_command, > > $attrs, $_cache_attrs); > > $output .= "$_cache_attrs\$this->_tag_stack[] = > > array('$tag_command', array(".implode(',', $arg_list).')); > > '; > > - $output .= '$_block_repeat=true;' . > > $this->_compile_plugin_call('block', > > $tag_command).'($this->_tag_stack[count($this->_tag_stack)-1][1], null, > > $this, $_block_repeat);'; > > + $output .= '$_block_repeat=true;' . > > $this->_compile_plugin_call('block', $tag_command) . > > '($this->_tag_stack[count($this->_tag_stack)-1][1], null, $this, > > $_block_repeat);'; > > $output .= 'while ($_block_repeat) { ob_start(); ?>'; > > } else { > > $output = '<?php $_block_content = ob_get_contents(); > > ob_end_clean(); '; > > @@ -754,7 +750,6 @@ > > return true; > > } > > > > - > > /** > > * compile custom function tag > > * > > @@ -784,7 +779,7 @@ > > * Otherwise we need to load plugin file and look for the function > > * inside it. > > */ > > - else if ($plugin_file = $this->_get_plugin_filepath('function', > > $tag_command)) { > > + elseif ($plugin_file = $this->_get_plugin_filepath('function', > > $tag_command)) { > > $found = true; > > > > include_once $plugin_file; > > @@ -801,7 +796,7 @@ > > > > if (!$found) { > > return false; > > - } else if (!$have_function) { > > + } elseif (!$have_function) { > > $this->_syntax_error($message, E_USER_WARNING, __FILE__, > > __LINE__); > > return true; > > } > > @@ -816,11 +811,11 @@ > > $arg_list = $this->_compile_arg_list('function', $tag_command, > > $attrs, $_cache_attrs); > > > > $output = $this->_compile_plugin_call('function', > > $tag_command).'(array('.implode(',', $arg_list)."), > > \$this)"; > > - if($tag_modifier != '') { > > + if ($tag_modifier != '') { > > $this->_parse_modifiers($output, $tag_modifier); > > } > > > > - if($output != '') { > > + if ($output != '') { > > $output = '<?php ' . $_cacheable_state . $_cache_attrs . > > 'echo > > ' . $output . ';' > > . $this->_pop_cacheable_state('function', $tag_command) . > > "?>" . $this->_additional_newline; > > } > > @@ -848,10 +843,10 @@ > > list($object, $obj_comp) = explode('->', $tag_command); > > > > $arg_list = array(); > > - if(count($attrs)) { > > + if (count($attrs)) { > > $_assign_var = false; > > foreach ($attrs as $arg_name => $arg_value) { > > - if($arg_name == 'assign') { > > + if ($arg_name == 'assign') { > > $_assign_var = $arg_value; > > unset($attrs['assign']); > > continue; > > @@ -862,7 +857,7 @@ > > } > > } > > > > - if($this->_reg_objects[$object][2]) { > > + if ($this->_reg_objects[$object][2]) { > > // smarty object argument format > > $args = "array(".implode(',', (array)$arg_list)."), > > \$this"; > > } else { > > @@ -876,13 +871,20 @@ > > $prefix = ''; > > $postfix = ''; > > $newline = ''; > > - if(!is_object($this->_reg_objects[$object][0])) { > > - $this->_trigger_fatal_error("registered '$object' is not an > > object" , $this->_current_file, $this->_current_line_no, __FILE__, __LINE__); > > - } elseif(!empty($this->_reg_objects[$object][1]) && > > !in_array($obj_comp, $this->_reg_objects[$object][1])) { > > - $this->_trigger_fatal_error("'$obj_comp' is not a > > registered > > component of object '$object'", $this->_current_file, > > $this->_current_line_no, __FILE__, __LINE__); > > - } elseif(method_exists($this->_reg_objects[$object][0], $obj_comp)) > > { > > + if (!is_object($this->_reg_objects[$object][0])) { > > + $this->_trigger_fatal_error("registered '$object' is not an > > object", > > + $this->_current_file, > > + $this->_current_line_no, > > + __FILE__, __LINE__); > > + } elseif (!empty($this->_reg_objects[$object][1]) && > > + !in_array($obj_comp, $this->_reg_objects[$object][1])) { > > + $this->_trigger_fatal_error("'$obj_comp' is not a > > registered > > component of object '$object'", > > + $this->_current_file, > > + $this->_current_line_no, > > + __FILE__, __LINE__); > > + } elseif (method_exists($this->_reg_objects[$object][0], $obj_comp)) > > { > > // method > > - if(in_array($obj_comp, $this->_reg_objects[$object][3])) { > > + if (in_array($obj_comp, $this->_reg_objects[$object][3])) { > > // block method > > if ($start_tag) { > > $prefix = "\$this->_tag_stack[] = > > array('$obj_comp', > > $args); "; > > @@ -904,12 +906,12 @@ > > $return = > > "\$this->_reg_objects['$object'][0]->$obj_comp"; > > } > > > > - if($return != null) { > > - if($tag_modifier != '') { > > + if ($return != null) { > > + if ($tag_modifier != '') { > > $this->_parse_modifiers($return, $tag_modifier); > > } > > > > - if(!empty($_assign_var)) { > > + if (!empty($_assign_var)) { > > $output = "\$this->assign('" . > > $this->_dequote($_assign_var) > > ."', $return);"; > > } else { > > $output = 'echo ' . $return . ';'; > > @@ -936,7 +938,7 @@ > > if (empty($name)) { > > return $this->_syntax_error("missing insert name", E_USER_ERROR, > > __FILE__, __LINE__); > > } > > - > > + > > if (!preg_match('~^\w+$~', $name)) { > > return $this->_syntax_error("'insert: 'name' must be > > an insert > > function name", E_USER_ERROR, __FILE__, __LINE__); > > } > > @@ -979,7 +981,7 @@ > > if ($arg_name == 'file') { > > $include_file = $arg_value; > > continue; > > - } else if ($arg_name == 'assign') { > > + } elseif ($arg_name == 'assign') { > > $assign_var = $arg_value; > > continue; > > } > > @@ -1032,8 +1034,8 @@ > > > > $arg_list = array(); > > foreach($attrs as $arg_name => $arg_value) { > > - if($arg_name != 'file' AND $arg_name != 'once' AND > > $arg_name != > > 'assign') { > > - if(is_bool($arg_value)) > > + if ($arg_name != 'file' AND $arg_name != 'once' AND > > $arg_name != > > 'assign') { > > + if (is_bool($arg_value)) > > $arg_value = $arg_value ? 'true' : 'false'; > > $arg_list[] = "'$arg_name' => $arg_value"; > > } > > @@ -1044,7 +1046,6 @@ > > return "<?php require_once(SMARTY_CORE_DIR . > > 'core.smarty_include_php.php');\nsmarty_core_smarty_include_php($_params, > > \$this); ?>" . $this->_additional_newline; > > } > > > > - > > /** > > * Compile {section ...} tag > > * > > @@ -1149,7 +1150,6 @@ > > return $output; > > } > > > > - > > /** > > * Compile {foreach ...} tag. > > * > > @@ -1208,7 +1208,6 @@ > > return $output; > > } > > > > - > > /** > > * Compile {capture} .. {/capture} tags > > * > > @@ -1216,7 +1215,6 @@ > > * @param string $tag_args > > * @return string > > */ > > - > > function _compile_capture_tag($start, $tag_args = '') > > { > > $attrs = $this->_parse_attrs($tag_args); > > @@ -1254,7 +1252,6 @@ > > */ > > function _compile_if_tag($tag_args, $elseif = false) > > { > > - > > /* Tokenize args for 'if' tag. */ > > preg_match_all('~(?> > > ' . $this->_obj_call_regexp . '(?:' . > > $this->_mod_regexp . > > '*)? | # valid object call > > @@ -1266,16 +1263,15 @@ > > > > $tokens = $match[0]; > > > > - if(empty($tokens)) { > > + if (empty($tokens)) { > > $_error_msg = $elseif ? "'elseif'" : > > "'if'"; > > $_error_msg .= ' statement requires arguments'; > > $this->_syntax_error($_error_msg, E_USER_ERROR, __FILE__, > > __LINE__); > > } > > - > > - > > + > > // make sure we have balanced parenthesis > > $token_count = array_count_values($tokens); > > - if(isset($token_count['(']) && $token_count['('] != > > $token_count[')']) { > > + if (isset($token_count['(']) && $token_count['('] != > > $token_count[')']) { > > $this->_syntax_error("unbalanced parenthesis in if statement", > > E_USER_ERROR, __FILE__, __LINE__); > > } > > > > @@ -1389,19 +1385,19 @@ > > break; > > > > default: > > - if(preg_match('~^' . $this->_func_regexp . > > '$~', $token) > > ) { > > + if (preg_match('~^' . $this->_func_regexp . > > '$~', > > $token) ) { > > // function call > > - if($this->security && > > + if ($this->security && > > !in_array($token, > > $this->security_settings['IF_FUNCS'])) { > > $this->_syntax_error("(secure mode) > > '$token' > > not allowed in if statement", E_USER_ERROR, __FILE__, __LINE__); > > } > > - } elseif(preg_match('~^' . $this->_var_regexp . > > '$~', > > $token) && (strpos('+-*/^%&|', substr($token, -1)) === false) > > && > > isset($tokens[$i+1]) && $tokens[$i+1] == '(') { > > + } elseif (preg_match('~^' . $this->_var_regexp . > > '$~', > > $token) && (strpos('+-*/^%&|', substr($token, -1)) === false) > > && > > isset($tokens[$i+1]) && $tokens[$i+1] == '(') { > > // variable function call > > $this->_syntax_error("variable function call > > '$token' not allowed in if statement", E_USER_ERROR, __FILE__, __LINE__); > > > > > > - } elseif(preg_match('~^' . $this->_obj_call_regexp . > > '|' > > . $this->_var_regexp . '(?:' . $this->_mod_regexp . '*)$~', > > $token)) { > > + } elseif (preg_match('~^' . $this->_obj_call_regexp . > > '|' . $this->_var_regexp . '(?:' . $this->_mod_regexp . > > '*)$~', $token)) { > > // object or variable > > $token = $this->_parse_var_props($token); > > - } elseif(is_numeric($token)) { > > + } elseif (is_numeric($token)) { > > // number, skip it > > } else { > > $this->_syntax_error("unidentified token > > '$token'", > > E_USER_ERROR, __FILE__, __LINE__); > > @@ -1416,7 +1412,15 @@ > > return '<?php if ('.implode(' ', $tokens).'): > > ?>'; > > } > > > > - > > + /** > > + * compiles an argument list > > + * > > + * @param string $type > > + * @param string $name > > + * @param string $attrs > > + * @param string $cache_code > > + * @return array > > + */ > > function _compile_arg_list($type, $name, $attrs, &$cache_code) { > > $arg_list = array(); > > > > @@ -1511,7 +1515,6 @@ > > return $tokens; > > } > > > > - > > /** > > * Parse attribute string > > * > > @@ -1526,7 +1529,7 @@ > > )+ | > > [=] > > ~x', $tag_args, $match); > > - $tokens = $match[0]; > > + $tokens = $match[0]; > > > > $attrs = array(); > > /* Parse state: > > @@ -1563,13 +1566,13 @@ > > boolean value. */ > > if (preg_match('~^(on|yes|true)$~', $token)) { > > $token = 'true'; > > - } else if (preg_match('~^(off|no|false)$~', $token)) > > { > > + } elseif (preg_match('~^(off|no|false)$~', $token)) > > { > > $token = 'false'; > > - } else if ($token == 'null') { > > + } elseif ($token == 'null') { > > $token = 'null'; > > - } else if (preg_match('~^' . > > $this->_num_const_regexp . '|0[xX][0-9a-fA-F]+$~', $token)) { > > + } elseif (preg_match('~^' . $this->_num_const_regexp > > . '|0[xX][0-9a-fA-F]+$~', $token)) { > > /* treat integer literally */ > > - } else if (!preg_match('~^' . > > $this->_obj_call_regexp . '|' . $this->_var_regexp . '(?:' . > > $this->_mod_regexp . ')*$~', $token)) { > > + } elseif (!preg_match('~^' . $this->_obj_call_regexp > > . '|' . $this->_var_regexp . '(?:' . $this->_mod_regexp . > > ')*$~', $token)) { > > /* treat as a string, double-quote it escaping > > quotes */ > > $token = > > '"'.addslashes($token).'"'; > > } > > @@ -1583,8 +1586,8 @@ > > $last_token = $token; > > } > > > > - if($state != 0) { > > - if($state == 1) { > > + if ($state != 0) { > > + if ($state == 1) { > > $this->_syntax_error("expecting '=' after attribute > > name > > '$last_token'", E_USER_ERROR, __FILE__, __LINE__); > > } else { > > $this->_syntax_error("missing attribute value", > > E_USER_ERROR, __FILE__, __LINE__); > > @@ -1597,21 +1600,19 @@ > > } > > > > /** > > - * compile multiple variables and section properties tokens into > > - * PHP code > > + * compile multiple variables and section properties tokens into PHP > > code > > * > > * @param array $tokens > > */ > > function _parse_vars_props(&$tokens) > > { > > - foreach($tokens as $key => $val) { > > + foreach ($tokens as $key => $val) { > > $tokens[$key] = $this->_parse_var_props($val); > > } > > } > > > > /** > > - * compile single variable and section properties token into > > - * PHP code > > + * compile single variable and section properties token into PHP code > > * > > * @param string $val > > * @param string $tag_attrs > > @@ -1621,7 +1622,7 @@ > > { > > $val = trim($val); > > > > - if(preg_match('~^(' . $this->_obj_call_regexp . '|' . > > $this->_dvar_regexp . ')(' . $this->_mod_regexp . '*)$~', $val, > > $match)) { > > + if (preg_match('~^(' . $this->_obj_call_regexp . '|' . > > $this->_dvar_regexp . ')(' . $this->_mod_regexp . '*)$~', $val, > > $match)) { > > // $ variable or object > > $return = $this->_parse_var($match[1]); > > $modifiers = $match[2]; > > @@ -1632,39 +1633,34 @@ > > $this->_parse_modifiers($return, $modifiers); > > return $return; > > } elseif (preg_match('~^' . $this->_db_qstr_regexp . '(?:' > > . > > $this->_mod_regexp . '*)$~', $val)) { > > - // double quoted text > > - preg_match('~^(' . $this->_db_qstr_regexp . ')('. > > $this->_mod_regexp . '*)$~', $val, $match); > > - $return = $this->_expand_quoted_text($match[1]); > > - if($match[2] != '') { > > - $this->_parse_modifiers($return, $match[2]); > > - } > > - return $return; > > - } > > - elseif(preg_match('~^' . $this->_num_const_regexp . '(?:' > > . > > $this->_mod_regexp . '*)$~', $val)) { > > - // numerical constant > > - preg_match('~^(' . $this->_num_const_regexp . > > ')('. > > $this->_mod_regexp . '*)$~', $val, $match); > > - if($match[2] != '') { > > - $this->_parse_modifiers($match[1], $match[2]); > > - return $match[1]; > > - } > > - } > > - elseif(preg_match('~^' . $this->_si_qstr_regexp . '(?:' . > > $this->_mod_regexp . '*)$~', $val)) { > > - // single quoted text > > - preg_match('~^(' . $this->_si_qstr_regexp . ')('. > > $this->_mod_regexp . '*)$~', $val, $match); > > - if($match[2] != '') { > > - $this->_parse_modifiers($match[1], $match[2]); > > - return $match[1]; > > - } > > - } > > - elseif(preg_match('~^' . $this->_cvar_regexp . '(?:' . > > $this->_mod_regexp . '*)$~', $val)) { > > - // config var > > - return $this->_parse_conf_var($val); > > - } > > - elseif(preg_match('~^' . $this->_svar_regexp . '(?:' . > > $this->_mod_regexp . '*)$~', $val)) { > > - // section var > > - return $this->_parse_section_prop($val); > > + // double quoted text > > + preg_match('~^(' . $this->_db_qstr_regexp . ')('. > > $this->_mod_regexp . '*)$~', $val, $match); > > + $return = $this->_expand_quoted_text($match[1]); > > + if ($match[2] != '') { > > + $this->_parse_modifiers($return, $match[2]); > > } > > - elseif(!in_array($val, $this->_permitted_tokens) && > > !is_numeric($val)) { > > + return $return; > > + } elseif (preg_match('~^' . $this->_num_const_regexp . > > '(?:' . > > $this->_mod_regexp . '*)$~', $val)) { > > + // numerical constant > > + preg_match('~^(' . $this->_num_const_regexp . ')('. > > $this->_mod_regexp . '*)$~', $val, $match); > > + if ($match[2] != '') { > > + $this->_parse_modifiers($match[1], $match[2]); > > + return $match[1]; > > + } > > + } elseif (preg_match('~^' . $this->_si_qstr_regexp . '(?:' > > . > > $this->_mod_regexp . '*)$~', $val)) { > > + // single quoted text > > + preg_match('~^(' . $this->_si_qstr_regexp . ')('. > > $this->_mod_regexp . '*)$~', $val, $match); > > + if ($match[2] != '') { > > + $this->_parse_modifiers($match[1], $match[2]); > > + return $match[1]; > > + } > > + } elseif (preg_match('~^' . $this->_cvar_regexp . '(?:' . > > $this->_mod_regexp . '*)$~', $val)) { > > + // config var > > + return $this->_parse_conf_var($val); > > + } elseif (preg_match('~^' . $this->_svar_regexp . '(?:' . > > $this->_mod_regexp . '*)$~', $val)) { > > + // section var > > + return $this->_parse_section_prop($val); > > + } elseif (!in_array($val, $this->_permitted_tokens) && > > !is_numeric($val)) { > > // literal string > > return $this->_expand_quoted_text('"' . strtr($val, > > array('\\' > > => '\\\\', '"' => '\\"')) > > .'"'); > > } > > @@ -1680,7 +1676,7 @@ > > function _expand_quoted_text($var_expr) > > { > > // if contains unescaped $, expand it > > - if(preg_match_all('~(?:\`(?<!\\\\)\$' . $this->_dvar_guts_regexp > > . > > '(?:' . $this->_obj_ext_regexp . > > ')*\`)|(?:(?<!\\\\)\$\w+(\[[a-zA-Z0-9]+\])*)~', $var_expr, $_match)) { > > + if (preg_match_all('~(?:\`(?<!\\\\)\$' . $this->_dvar_guts_regexp > > . > > '(?:' . $this->_obj_ext_regexp . > > ')*\`)|(?:(?<!\\\\)\$\w+(\[[a-zA-Z0-9]+\])*)~', $var_expr, $_match)) { > > $_match = $_match[0]; > > $_replace = array(); > > foreach($_match as $_var) { > > @@ -1691,8 +1687,10 @@ > > } else { > > $_return = $var_expr; > > } > > + > > // replace double quoted literal string with single quotes > > $_return = > > preg_replace('~^"([\s\w]+)"$~',"'\\1'",$_return); > > + > > return $_return; > > } > > > > @@ -1708,26 +1706,26 @@ > > $_has_math = false; > > $_math_vars = > > > > preg_split('~('.$this->_dvar_math_regexp.'|'.$this->_qstr_regexp.')~', > > $var_expr, -1, PREG_SPLIT_DELIM_CAPTURE); > > > > - if(count($_math_vars) > 1) { > > + if (count($_math_vars) > 1) { > > $_first_var = ""; > > $_complete_var = ""; > > $_output = ""; > > // simple check if there is any math, to stop recursion (due to > > modifiers with "xx % yy" as parameter) > > - foreach($_math_vars as $_k => $_math_var) { > > + foreach ($_math_vars as $_k => $_math_var) { > > $_math_var = $_math_vars[$_k]; > > > > - if(!empty($_math_var) || is_numeric($_math_var)) { > > + if (!empty($_math_var) || is_numeric($_math_var)) { > > // hit a math operator, so process the stuff which came > > before it > > - if(preg_match('~^' . $this->_dvar_math_regexp . > > '$~', > > $_math_var)) { > > + if (preg_match('~^' . $this->_dvar_math_regexp . > > '$~', > > $_math_var)) { > > $_has_math = true; > > - if(!empty($_complete_var) || > > is_numeric($_complete_var)) { > > + if (!empty($_complete_var) || > > is_numeric($_complete_var)) { > > $_output .= $this->_parse_var($_complete_var); > > } > > > > // just output the math operator to php > > $_output .= $_math_var; > > > > - if(empty($_first_var)) > > + if (empty($_first_var)) > > $_first_var = $_complete_var; > > > > $_complete_var = ""; > > @@ -1736,8 +1734,8 @@ > > } > > } > > } > > - if($_has_math) { > > - if(!empty($_complete_var) || is_numeric($_complete_var)) > > + if ($_has_math) { > > + if (!empty($_complete_var) || is_numeric($_complete_var)) > > $_output .= $this->_parse_var($_complete_var); > > > > // get the modifiers working (only the last var from math + > > modifier is left) > > @@ -1746,16 +1744,16 @@ > > } > > > > // prevent cutting of first digit in the number (we _definitly_ got > > a number if the first char is a digit) > > - if(is_numeric(substr($var_expr, 0, 1))) > > + if (is_numeric(substr($var_expr, 0, 1))) > > $_var_ref = $var_expr; > > else > > $_var_ref = substr($var_expr, 1); > > - > > - if(!$_has_math) { > > - > > + > > + if (!$_has_math) { > > + > > // get [foo] and .foo and ->foo and (...) pieces > > preg_match_all('~(?:^\w+)|' . $this->_obj_params_regexp . > > '|(?:' > > . $this->_var_bracket_regexp . ')|->\$?\w+|\.\$?\w+|\S+~', $_var_ref, > > $match); > > - > > + > > $_indexes = $match[0]; > > $_var_name = array_shift($_indexes); > > > > @@ -1772,10 +1770,9 @@ > > $_var_name = substr(array_shift($_indexes), 1); > > $_output = > > "\$this->_smarty_vars['$_var_name']"; > > } > > - } elseif(is_numeric($_var_name) && is_numeric(substr($var_expr, > > 0, 1))) { > > + } elseif (is_numeric($_var_name) && is_numeric(substr($var_expr, > > 0, 1))) { > > // because . is the operator for accessing arrays thru > > inidizes we need to put it together again for floating point numbers > > - if(count($_indexes) > 0) > > - { > > + if (count($_indexes) > 0) { > > $_var_name .= implode("", $_indexes); > > $_indexes = array(); > > } > > @@ -1801,15 +1798,15 @@ > > $_var_section_prop = isset($_var_parts[1]) ? > > $_var_parts[1] : 'index'; > > $_output .= > > > > "[\$this->_sections['$_var_section']['$_var_section_prop']]"; > > } > > - } else if (substr($_index, 0, 1) == '.') { > > + } elseif (substr($_index, 0, 1) == '.') { > > if (substr($_index, 1, 1) == '$') > > $_output .= "[\$this->_tpl_vars['" . > > substr($_index, > > 2) . "']]"; > > else > > $_output .= "['" . substr($_index, 1) . > > "']"; > > - } else if (substr($_index,0,2) == '->') { > > - if(substr($_index,2,2) == '__') { > > + } elseif (substr($_index,0,2) == '->') { > > + if (substr($_index,2,2) == '__') { > > $this->_syntax_error('call to internal object > > members is not allowed', E_USER_ERROR, __FILE__, __LINE__); > > - } elseif($this->security && substr($_index, 2, 1) == > > '_') { > > + } elseif ($this->security && substr($_index, 2, 1) == > > '_') { > > $this->_syntax_error('(secure) call to private > > object member is not allowed', E_USER_ERROR, __FILE__, __LINE__); > > } elseif (substr($_index, 2, 1) == '$') { > > if ($this->security) { > > @@ -1893,7 +1890,6 @@ > > return $output; > > } > > > > - > > /** > > * parse modifier chain into PHP code > > * > > @@ -1909,7 +1905,7 @@ > > 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; > > } > > @@ -1937,12 +1933,12 @@ > > > > $this->_parse_vars_props($_modifier_args); > > > > - if($_modifier_name == 'default') { > > + if ($_modifier_name == 'default') { > > // supress notifications of default modifier vars and args > > - if(substr($output, 0, 1) == '$') { > > + if (substr($output, 0, 1) == '$') { > > $output = '@' . $output; > > } > > - if(isset($_modifier_args[0]) && substr($_modifier_args[0], > > 0, 1) == '$') { > > + if (isset($_modifier_args[0]) && substr($_modifier_args[0], > > 0, 1) == '$') { > > $_modifier_args[0] = '@' . $_modifier_args[0]; > > } > > } > > @@ -1962,7 +1958,6 @@ > > } > > } > > > > - > > /** > > * add plugin > > * > > @@ -1982,7 +1977,6 @@ > > } > > } > > > > - > > /** > > * Compiles references of type $smarty.foo > > * > > @@ -2015,7 +2009,7 @@ > > array_shift($indexes); > > $compiled_ref = > > "(\$this->_foreach[$_var]['iteration']-1)"; > > break; > > - > > + > > case 'first': > > array_shift($indexes); > > $compiled_ref = > > "(\$this->_foreach[$_var]['iteration'] <= 1)"; > > @@ -2025,12 +2019,12 @@ > > array_shift($indexes); > > $compiled_ref = > > "(\$this->_foreach[$_var]['iteration'] == > > \$this->_foreach[$_var]['total'])"; > > break; > > - > > + > > case 'show': > > array_shift($indexes); > > $compiled_ref = > > "(\$this->_foreach[$_var]['total'] > > > 0)"; > > break; > > - > > + > > default: > > unset($_max_index); > > $compiled_ref = "\$this->_foreach[$_var]"; > > @@ -2121,7 +2115,7 @@ > > case 'rdelim': > > $compiled_ref = "'$this->right_delimiter'"; > > break; > > - > > + > > default: > > $this->_syntax_error('$smarty.' . $_ref . ' is an > > unknown > > reference', E_USER_ERROR, __FILE__, __LINE__); > > break; > > @@ -2218,7 +2212,6 @@ > > $this->_trigger_fatal_error("syntax error: $error_msg", > > $this->_current_file, $this->_current_line_no, $file, $line, $error_type); > > } > > > > - > > /** > > * check if the compilation changes from cacheable to > > * non-cacheable state with the beginning of the current > > @@ -2236,7 +2229,6 @@ > > return $_ret; > > } > > > > - > > /** > > * check if the compilation changes from non-cacheable to > > * cacheable state with the end of the current plugin return > > @@ -2252,7 +2244,6 @@ > > . '}\'; endif;'; > > } > > > > - > > /** > > * push opening tag-name, file-name and line-number on the tag-stack > > * @param string the opening tag's name > > @@ -2299,7 +2290,6 @@ > > $this->_syntax_error("mismatched tag {/$close_tag}.$message", > > E_USER_ERROR, __FILE__, __LINE__); > > } > > - > > } > > > > /** > > @@ -2308,14 +2298,14 @@ > > * @access private > > * @param string $a > > * @param string $b > > - * @return 0|-1|1 > > + * @return int 0|-1|1 > > */ > > function _smarty_sort_length($a, $b) > > { > > - if($a == $b) > > + if ($a == $b) > > return 0; > > > > - if(strlen($a) == strlen($b)) > > + if (strlen($a) == strlen($b)) > > return ($a > $b) ? -1 : 1; > > > > return (strlen($a) > strlen($b)) ? -1 : 1; > > > > > -- > > Smarty Development Mailing List (http://smarty.php.net/) > > To unsubscribe, visit: http://www.php.net/unsub.php > > > > > ____________________________________________________________________________________ > Food fight? Enjoy some healthy debate > in the Yahoo! Answers Food & Drink Q&A. > http://answers.yahoo.com/dir/?link=list&sid=396545367 > > -- > Smarty Development Mailing List (http://smarty.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php

« previous php.smarty.dev (#3012) next »