cvs: smarty /libs Smarty_Compiler.class.php
| From: | Monte Ohrt | Date: | Tue, 17 Jun 2003 22:01:28 +0000 |
| Subject: | cvs: smarty /libs Smarty_Compiler.class.php | ||
| Groups: | php.smarty.cvs | ||
| Request: | Send a blank email to php-smarty-cvs+get-658@lists.php.net to get a copy of this message | ||
mohrt Tue Jun 17 18:01:28 2003 EDT
Modified files:
/smarty/libs Smarty_Compiler.class.php
Log:
change varnames to follow coding methods
Index: smarty/libs/Smarty_Compiler.class.php
diff -u smarty/libs/Smarty_Compiler.class.php:1.243 smarty/libs/Smarty_Compiler.class.php:1.244
--- smarty/libs/Smarty_Compiler.class.php:1.243 Tue Jun 17 17:54:55 2003
+++ smarty/libs/Smarty_Compiler.class.php Tue Jun 17 18:01:28 2003
@@ -39,7 +39,7 @@
* @package Smarty
*/
-/* $Id: Smarty_Compiler.class.php,v 1.243 2003/06/17 21:54:55 mohrt Exp $ */
+/* $Id: Smarty_Compiler.class.php,v 1.244 2003/06/17 22:01:28 mohrt Exp $ */
/**
* Template compiling class
* @package Smarty
@@ -114,7 +114,7 @@
// $foo[5].bar[$foobar][4]
$this->_dvar_math_regexp = '[\+\-\*\/\%]';
$this->_dvar_math_var_regexp = '[\$\w\.\+\-\*\/\%\d\|\:\>\[\]]';
- $this->_dvar_num_var_regexp = '\-?\d+(?:\.\d+)?'.$this->_dvar_math_var_regexp;
+ $this->_dvar_num_var_regexp = '\-?\d+(?:\.\d+)?' . $this->_dvar_math_var_regexp;
$this->_dvar_guts_regexp = '\w+(?:' . $this->_var_bracket_regexp
. ')*(?:\.\$?\w+(?:' . $this->_var_bracket_regexp . ')*)*(?:' .
$this->_dvar_math_regexp . '(?:\-?\d+(?:\.\d+)?|' . $this->_dvar_math_var_regexp .
'*))?';
$this->_dvar_regexp = '\$' . $this->_dvar_guts_regexp;
@@ -1509,56 +1509,56 @@
// inform the calling expression the return type (php, static)
$this->_output_type = 'php';
- $math_vars =
preg_split('!('.$this->_dvar_math_regexp.'|\".*?\")!', $var_expr,
-1, PREG_SPLIT_DELIM_CAPTURE);
- if(count($math_vars) > 1)
+ $_math_vars =
preg_split('!('.$this->_dvar_math_regexp.'|\".*?\")!', $var_expr,
-1, PREG_SPLIT_DELIM_CAPTURE);
+ if(count($_math_vars) > 1)
{
- $output = "";
- $complete_var = "";
+ $_output = "";
+ $_complete_var = "";
// simple check if there is any math, to stop recursion (due to modifiers with "xx %
yy" as parameter)
- $hasMath = false;
- foreach($math_vars as $k => $math_var)
+ $_has_math = false;
+ foreach($_math_vars as $_k => $_math_var)
{
- $math_var = $math_vars[$k];
- if(!empty($math_var))
+ $_math_var = $_math_vars[$_k];
+ if(!empty($_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))
{
- $hasMath = true;
- if(!empty($complete_var))
+ $_has_math = true;
+ if(!empty($_complete_var))
{
- $output .= $this->_parse_var($complete_var);
+ $_output .= $this->_parse_var($_complete_var);
}
// just output the math operator to php
- $output .= $math_var;
+ $_output .= $_math_var;
- $complete_var = "";
+ $_complete_var = "";
}
else
{
// fetch multiple -> (like $foo->bar->baz ) which wouldn't get fetched else,
because it would only get $foo->bar and treat the ->baz as "-" ">baz"
then
- for($i = $k + 1; $i <= count($math_vars); $i += 2)
+ for($_i = $_k + 1; $_i <= count($_math_vars); $_i += 2)
{
// fetch -> because it gets splitted at - and move it back together
- if( /* prevent notice */ (isset($math_vars[$i]) && isset($math_vars[$i+1]))
&& ($math_vars[$i] === '-' && $math_vars[$i+1]{0} === '>'))
+ if( /* prevent notice */ (isset($_math_vars[$_i]) && isset($_math_vars[$_i+1]))
&& ($_math_vars[$_i] === '-' && $_math_vars[$_i+1]{0} ===
'>'))
{
- $math_var .= $math_vars[$i].$math_vars[$i+1];
- $math_vars[$i] = $math_vars[$i+1] = "";
+ $_math_var .= $_math_vars[$_i].$_math_vars[$_i+1];
+ $_math_vars[$_i] = $_math_vars[$_i+1] = '';
}
else
break;
}
- $complete_var .= $math_var;
+ $_complete_var .= $_math_var;
}
}
}
- if($hasMath)
+ if($_has_math)
{
- if(!empty($complete_var))
- $output .= $this->_parse_var($complete_var);
+ if(!empty($_complete_var))
+ $_output .= $this->_parse_var($_complete_var);
- return $output;
+ return $_output;
}
}