mirror of
https://github.com/smarty-php/smarty.git
synced 2025-08-04 18:34:27 +02:00
enabled hex-constants (0x...) as function-attributes, inside
if-statements and as modifier-parameters
This commit is contained in:
5
NEWS
5
NEWS
@@ -1,4 +1,7 @@
|
|||||||
- fixed bug with passing $smarty as reference in Smarty.compiler.class (messju)
|
- enabled hex-constants (0x...) as function-attributes, inside if-statements
|
||||||
|
and as modifier-parameters (messju)
|
||||||
|
- fixed bug with passing $smarty as reference in Smarty.compiler.class
|
||||||
|
(messju)
|
||||||
- corrected output with {strip} and PHP tag newlines (Monte)
|
- corrected output with {strip} and PHP tag newlines (Monte)
|
||||||
- added possibility to register function-callbacks as "array(&$obj, 'method)"
|
- added possibility to register function-callbacks as "array(&$obj, 'method)"
|
||||||
this affects register_function(), -block, -compiler_function, -modifier,
|
this affects register_function(), -block, -compiler_function, -modifier,
|
||||||
|
@@ -157,7 +157,7 @@ class Smarty_Compiler extends Smarty {
|
|||||||
// |foo:"bar":$foobar
|
// |foo:"bar":$foobar
|
||||||
// |foo|bar
|
// |foo|bar
|
||||||
// |foo:$foo->bar
|
// |foo:$foo->bar
|
||||||
$this->_mod_regexp = '(?:\|@?\w+(?::(?>\w+|'
|
$this->_mod_regexp = '(?:\|@?\w+(?::(?>-?\w+|'
|
||||||
. $this->_obj_call_regexp . '|' . $this->_avar_regexp . '|' . $this->_qstr_regexp .'))*)';
|
. $this->_obj_call_regexp . '|' . $this->_avar_regexp . '|' . $this->_qstr_regexp .'))*)';
|
||||||
|
|
||||||
// matches valid function name:
|
// matches valid function name:
|
||||||
@@ -1103,7 +1103,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+(?:\.\d+)?|\.\d+|!==|===|==|!=|<>|<<|>>|<=|>=|\&\&|\|\||\(|\)|,|\!|\^|=|\&|\~|<|>|\||\%|\+|\-|\/|\*|\@ | # valid non-word token
|
\-?0[xX][0-9a-fA-F]+|\-?\d+(?:\.\d+)?|\.\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);
|
||||||
@@ -1367,7 +1367,7 @@ class Smarty_Compiler extends Smarty {
|
|||||||
$token = 'false';
|
$token = 'false';
|
||||||
} else if ($token == 'null') {
|
} else if ($token == 'null') {
|
||||||
$token = 'null';
|
$token = 'null';
|
||||||
} else if (preg_match('!^-?[0-9]+$!', $token)) {
|
} else if (preg_match('!^-?([0-9]+|0[xX][0-9a-fA-F]+)$!', $token)) {
|
||||||
/* treat integer literally */
|
/* treat integer literally */
|
||||||
} else if (!preg_match('!^' . $this->_obj_call_regexp . '|' . $this->_var_regexp . '(?:' . $this->_mod_regexp . ')*$!', $token)) {
|
} else if (!preg_match('!^' . $this->_obj_call_regexp . '|' . $this->_var_regexp . '(?:' . $this->_mod_regexp . ')*$!', $token)) {
|
||||||
/* treat as a string, double-quote it escaping quotes */
|
/* treat as a string, double-quote it escaping quotes */
|
||||||
|
Reference in New Issue
Block a user