Update of /cvsroot/php-blog/serendipity/bundled-libs/Smarty/libs
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv18996/libs
Modified Files:
Tag: branch-smarty
Config_File.class.php Smarty.class.php
Smarty_Compiler.class.php
Log Message:
- Update to Smarty 2.6.5 (It's stable, even if their release says -dev)
Index: Smarty_Compiler.class.php
===================================================================
RCS file: /cvsroot/php-blog/serendipity/bundled-libs/Smarty/libs/Attic/Smarty_Compiler.class.php,v
retrieving revision 1.1.2.1
retrieving revision 1.1.2.2
diff -u -d -r1.1.2.1 -r1.1.2.2
--- Smarty_Compiler.class.php 9 Sep 2004 14:55:43 -0000 1.1.2.1
+++ Smarty_Compiler.class.php 23 Sep 2004 19:00:12 -0000 1.1.2.2
@@ -21,7 +21,7 @@
* @link http://smarty.php.net/
* @author Monte Ohrt <mo...@is...>
* @author Andrei Zmievski <an...@ph...>
- * @version 2.6.4
+ * @version 2.6.5-dev
* @copyright 2001-2004 ispi of Lincoln, Inc.
* @package Smarty
*/
@@ -111,7 +111,7 @@
// $foo[$bar]
// $foo[5][blah]
// $foo[5].bar[$foobar][4]
- $this->_dvar_math_regexp = '[\+\*\/\%]|-(?!>)';
+ $this->_dvar_math_regexp = '(?:[\+\*\/\%]|(?:-(?!>)))';
$this->_dvar_math_var_regexp = '[\$\w\.\+\-\*\/\%\d\>\[\]]';
$this->_dvar_guts_regexp = '\w+(?:' . $this->_var_bracket_regexp
. ')*(?:\.\$?\w+(?:' . $this->_var_bracket_regexp . ')*)*(?:' . $this->_dvar_math_regexp . '(?:' . $this->_num_const_regexp . '|' . $this->_dvar_math_var_regexp . ')*)?';
@@ -137,9 +137,9 @@
// #foo#
// "text"
// "text"
- $this->_var_regexp = '(?:' . $this->_avar_regexp . '|' . $this->_qstr_regexp . ')';
+ $this->_var_regexp = '(?:' . $this->_avar_regexp . '|' . $this->_num_const_regexp . '|' . $this->_qstr_regexp . ')';
- // matches valid object call (no objects allowed in parameters):
+ // matches valid object call (one level of object nesting allowed in parameters):
// $foo->bar
// $foo->bar()
// $foo->bar("text")
@@ -147,13 +147,20 @@
// $foo->bar($foo, "foo")
// $foo->bar->foo()
// $foo->bar->foo->bar()
+ // $foo->bar($foo->bar)
+ // $foo->bar($foo->bar())
+ // $foo->bar($foo->bar($blah,$foo,44,"foo",$foo[0].bar))
$this->_obj_ext_regexp = '\->(?:\$?' . $this->_dvar_guts_regexp . ')';
- $this->_obj_params_regexp = '\((?:-?\d|\w+|'
- . $this->_var_regexp . '(?:\s*,\s*(?:(?:\w+|'
- . $this->_var_regexp . ')))*)?\)';
+ $this->_obj_restricted_param_regexp = '(?:'
+ . $this->_var_regexp . '(?:' . $this->_obj_ext_regexp . '(?:\((?:' . $this->_var_regexp
+ . '(?:\s*,\s*' . $this->_var_regexp . ')*)?\))?)*)';
+ $this->_obj_single_param_regexp = '(?:\w+|' . $this->_obj_restricted_param_regexp . '(?:\s*,\s*(?:(?:\w+|'
+ . $this->_var_regexp . $this->_obj_restricted_param_regexp . ')))*)';
+ $this->_obj_params_regexp = '\((?:' . $this->_obj_single_param_regexp
+ . '(?:\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->_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
@@ -399,7 +406,7 @@
/* Matched comment. */
if ($template_tag{0} == '*' && $template_tag{strlen($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
. '|\/?' . $this->_reg_obj_regexp . '|\/?' . $this->_func_regexp . ')(' . $this->_mod_regexp . '*))
@@ -407,7 +414,7 @@
~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;
@@ -1660,46 +1667,42 @@
function _parse_var($var_expr)
{
$_has_math = false;
-
- if(!preg_match('~^' . $this->_obj_call_regexp . '$~', $var_expr)) {
- // not an object call, see if there is math to parse
- $_math_vars = preg_split('~('.$this->_dvar_math_regexp.'|'.$this->_qstr_regexp.')~', $var_expr, -1, PREG_SPLIT_DELIM_CAPTURE);
+ $_math_vars = preg_split('~('.$this->_dvar_math_regexp.'|'.$this->_qstr_regexp.')~', $var_expr, -1, PREG_SPLIT_DELIM_CAPTURE);
- 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) {
- $_math_var = $_math_vars[$_k];
+ 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) {
+ $_math_var = $_math_vars[$_k];
- 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)) {
- $_has_math = true;
- if(!empty($_complete_var) || is_numeric($_complete_var)) {
- $_output .= $this->_parse_var($_complete_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)) {
+ $_has_math = true;
+ if(!empty($_complete_var) || is_numeric($_complete_var)) {
+ $_output .= $this->_parse_var($_complete_var);
+ }
- // just output the math operator to php
- $_output .= $_math_var;
+ // just output the math operator to php
+ $_output .= $_math_var;
- if(empty($_first_var))
- $_first_var = $_complete_var;
+ if(empty($_first_var))
+ $_first_var = $_complete_var;
- $_complete_var = '';
- } else {
- $_complete_var .= $_math_var;
- }
+ $_complete_var = "";
+ } else {
+ $_complete_var .= $_math_var;
}
}
- if($_has_math) {
- if(!empty($_complete_var) || is_numeric($_complete_var))
- $_output .= $this->_parse_var($_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)
- $var_expr = $_complete_var;
- }
+ // get the modifiers working (only the last var from math + modifier is left)
+ $var_expr = $_complete_var;
}
}
@@ -1710,10 +1713,11 @@
$_var_ref = substr($var_expr, 1);
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];
+ // 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);
/* Handle $smarty.* variable references as a special case. */
@@ -2023,6 +2027,11 @@
break;
case 'const':
+ if ($this->security && !$this->security_settings['ALLOW_CONSTANTS']) {
+ $this->_syntax_error("(secure mode) constants not permitted",
+ E_USER_WARNING, __FILE__, __LINE__);
+ return;
+ }
array_shift($indexes);
$_val = $this->_parse_var_props(substr($indexes[0],1));
$compiled_ref = '@constant(' . $_val . ')';
Index: Smarty.class.php
===================================================================
RCS file: /cvsroot/php-blog/serendipity/bundled-libs/Smarty/libs/Attic/Smarty.class.php,v
retrieving revision 1.1.2.1
retrieving revision 1.1.2.2
diff -u -d -r1.1.2.1 -r1.1.2.2
--- Smarty.class.php 9 Sep 2004 14:55:43 -0000 1.1.2.1
+++ Smarty.class.php 23 Sep 2004 19:00:12 -0000 1.1.2.2
@@ -27,7 +27,7 @@
* @author Monte Ohrt <mo...@is...>
* @author Andrei Zmievski <an...@ph...>
* @package Smarty
- * @version 2.6.4
+ * @version 2.6.5-dev
*/
/* $Id$ */
@@ -231,7 +231,8 @@
'true','false'),
'INCLUDE_ANY' => false,
'PHP_TAGS' => false,
- 'MODIFIER_FUNCS' => array('count')
+ 'MODIFIER_FUNCS' => array('count'),
+ 'ALLOW_CONSTANTS' => false
);
/**
@@ -459,7 +460,7 @@
*
* @var string
*/
- var $_version = '2.6.4';
+ var $_version = '2.6.5-dev';
/**
* current template inclusion depth
@@ -1107,7 +1108,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);
Index: Config_File.class.php
===================================================================
RCS file: /cvsroot/php-blog/serendipity/bundled-libs/Smarty/libs/Attic/Config_File.class.php,v
retrieving revision 1.1.2.1
retrieving revision 1.1.2.2
diff -u -d -r1.1.2.1 -r1.1.2.2
--- Config_File.class.php 9 Sep 2004 14:55:43 -0000 1.1.2.1
+++ Config_File.class.php 23 Sep 2004 19:00:12 -0000 1.1.2.2
@@ -18,7 +18,7 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* @link http://smarty.php.net/
- * @version 2.6.4
+ * @version 2.6.5-dev
* @copyright Copyright: 2001-2004 ispi of Lincoln, Inc.
* @author Andrei Zmievski <an...@ph...>
* @access public
|