fix "if" regex for math tokens

This commit is contained in:
mohrt
2003-02-05 20:36:26 +00:00
parent c0eabe7fbd
commit 396d18f5b5
2 changed files with 22 additions and 22 deletions

View File

@@ -858,17 +858,17 @@ class Smarty_Compiler extends Smarty {
$once_var = ( $attrs['once'] === false ) ? 'false' : 'true'; $once_var = ( $attrs['once'] === false ) ? 'false' : 'true';
foreach($attrs as $arg_name => $arg_value) { foreach($attrs as $arg_name => $arg_value) {
if($arg_name != 'file' AND $arg_name != 'once' AND $arg_name != 'assign') { if($arg_name != 'file' AND $arg_name != 'once' AND $arg_name != 'assign') {
if(is_bool($arg_value)) if(is_bool($arg_value))
$arg_value = $arg_value ? 'true' : 'false'; $arg_value = $arg_value ? 'true' : 'false';
$arg_list[] = "'$arg_name' => $arg_value"; $arg_list[] = "'$arg_name' => $arg_value";
} }
} }
$output = $output =
"<?php \$this->_smarty_include_php($attrs[file], '$assign_var', $once_var, " . "<?php \$this->_smarty_include_php($attrs[file], '$assign_var', $once_var, " .
"array(".implode(',', (array)$arg_list).")); ?>"; "array(".implode(',', (array)$arg_list).")); ?>";
return $output; return $output;
} }
@@ -1084,7 +1084,7 @@ class Smarty_Compiler extends Smarty {
preg_match_all('/(?> preg_match_all('/(?>
' . $this->_obj_call_regexp . '(?:' . $this->_mod_regexp . '*) | # valid object call ' . $this->_obj_call_regexp . '(?:' . $this->_mod_regexp . '*) | # valid object call
' . $this->_var_regexp . '(?:' . $this->_mod_regexp . '*) | # var or quoted string ' . $this->_var_regexp . '(?:' . $this->_mod_regexp . '*) | # var or quoted string
\-?\d+|!==|<=>|==|!=|<=|>=|\&\&|\|\||\(|\)|,|\!|\^|=|<|>|\||\% | # valid non-word token \-?\d+|!==|<=>|==|!=|<=|>=|\&\&|\|\||\(|\)|,|\!|\^|=|<|>|\||\%|\+|\-|\/|\* | # valid non-word token
\b\w+\b | # valid word token \b\w+\b | # valid word token
\S+ # anything else \S+ # anything else
)/x', $tag_args, $match); )/x', $tag_args, $match);

View File

@@ -858,17 +858,17 @@ class Smarty_Compiler extends Smarty {
$once_var = ( $attrs['once'] === false ) ? 'false' : 'true'; $once_var = ( $attrs['once'] === false ) ? 'false' : 'true';
foreach($attrs as $arg_name => $arg_value) { foreach($attrs as $arg_name => $arg_value) {
if($arg_name != 'file' AND $arg_name != 'once' AND $arg_name != 'assign') { if($arg_name != 'file' AND $arg_name != 'once' AND $arg_name != 'assign') {
if(is_bool($arg_value)) if(is_bool($arg_value))
$arg_value = $arg_value ? 'true' : 'false'; $arg_value = $arg_value ? 'true' : 'false';
$arg_list[] = "'$arg_name' => $arg_value"; $arg_list[] = "'$arg_name' => $arg_value";
} }
} }
$output = $output =
"<?php \$this->_smarty_include_php($attrs[file], '$assign_var', $once_var, " . "<?php \$this->_smarty_include_php($attrs[file], '$assign_var', $once_var, " .
"array(".implode(',', (array)$arg_list).")); ?>"; "array(".implode(',', (array)$arg_list).")); ?>";
return $output; return $output;
} }
@@ -1084,7 +1084,7 @@ class Smarty_Compiler extends Smarty {
preg_match_all('/(?> preg_match_all('/(?>
' . $this->_obj_call_regexp . '(?:' . $this->_mod_regexp . '*) | # valid object call ' . $this->_obj_call_regexp . '(?:' . $this->_mod_regexp . '*) | # valid object call
' . $this->_var_regexp . '(?:' . $this->_mod_regexp . '*) | # var or quoted string ' . $this->_var_regexp . '(?:' . $this->_mod_regexp . '*) | # var or quoted string
\-?\d+|!==|<=>|==|!=|<=|>=|\&\&|\|\||\(|\)|,|\!|\^|=|<|>|\||\% | # valid non-word token \-?\d+|!==|<=>|==|!=|<=|>=|\&\&|\|\||\(|\)|,|\!|\^|=|<|>|\||\%|\+|\-|\/|\* | # valid non-word token
\b\w+\b | # valid word token \b\w+\b | # valid word token
\S+ # anything else \S+ # anything else
)/x', $tag_args, $match); )/x', $tag_args, $match);