Upgraded Smarty from 2.6.19 to 2.6.20

git-svn-id: http://svn.cleancode.org/svn/pickles@51 4d10bc64-7434-11dc-a737-d2d0f8310089
This commit is contained in:
Josh Sherman 2008-09-19 00:56:45 +00:00
parent 34362102cd
commit 7a7c165b61
101 changed files with 47 additions and 19 deletions

View file

@ -1,3 +1,15 @@
Version 2.6.20 (Aug 15th, 2008)
-------------------------------
- fix cache tag bug when multiple cache tags on a page (mankyd,
mohrt)
- fix /e tag checking when using arrays with regex_replace
(mohrt)
- fix that function results can be used with condition like "is even" in
{if} tags (U.Tews)
- fix handling of non-empty <pre>-tags and empty <textarea>- and
<script>-tags (Spuerhund, messju)
Version 2.6.19 (Feb 11th, 2008) Version 2.6.19 (Feb 11th, 2008)
------------------------------- -------------------------------

View file

@ -2,7 +2,7 @@ NAME:
Smarty - the PHP compiling template engine Smarty - the PHP compiling template engine
VERSION: 2.6.19 VERSION: 2.6.20
AUTHORS: AUTHORS:

View file

@ -18,7 +18,7 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
* *
* @link http://smarty.php.net/ * @link http://smarty.php.net/
* @version 2.6.19 * @version 2.6.20
* @copyright Copyright: 2001-2005 New Digital Group, Inc. * @copyright Copyright: 2001-2005 New Digital Group, Inc.
* @author Andrei Zmievski <andrei@php.net> * @author Andrei Zmievski <andrei@php.net>
* @access public * @access public

View file

@ -27,7 +27,7 @@
* @author Monte Ohrt <monte at ohrt dot com> * @author Monte Ohrt <monte at ohrt dot com>
* @author Andrei Zmievski <andrei@php.net> * @author Andrei Zmievski <andrei@php.net>
* @package Smarty * @package Smarty
* @version 2.6.19 * @version 2.6.20
*/ */
/* $Id: Smarty.class.php 2722 2007-06-18 14:29:00Z danilo $ */ /* $Id: Smarty.class.php 2722 2007-06-18 14:29:00Z danilo $ */
@ -464,7 +464,7 @@ class Smarty
* *
* @var string * @var string
*/ */
var $_version = '2.6.19'; var $_version = '2.6.20';
/** /**
* current template inclusion depth * current template inclusion depth

View file

@ -21,12 +21,12 @@
* @link http://smarty.php.net/ * @link http://smarty.php.net/
* @author Monte Ohrt <monte at ohrt dot com> * @author Monte Ohrt <monte at ohrt dot com>
* @author Andrei Zmievski <andrei@php.net> * @author Andrei Zmievski <andrei@php.net>
* @version 2.6.19 * @version 2.6.20
* @copyright 2001-2005 New Digital Group, Inc. * @copyright 2001-2005 New Digital Group, Inc.
* @package Smarty * @package Smarty
*/ */
/* $Id: Smarty_Compiler.class.php 2736 2007-09-16 14:47:53Z mohrt $ */ /* $Id: Smarty_Compiler.class.php 2773 2008-08-12 18:17:51Z Uwe.Tews $ */
/** /**
* Template compiling class * Template compiling class
@ -1363,9 +1363,14 @@ class Smarty_Compiler extends Smarty {
/* If last token was a ')', we operate on the parenthesized /* If last token was a ')', we operate on the parenthesized
expression. The start of the expression is on the stack. expression. The start of the expression is on the stack.
Otherwise, we operate on the last encountered token. */ Otherwise, we operate on the last encountered token. */
if ($tokens[$i-1] == ')') if ($tokens[$i-1] == ')') {
$is_arg_start = array_pop($is_arg_stack); $is_arg_start = array_pop($is_arg_stack);
else if ($is_arg_start != 0) {
if (preg_match('~^' . $this->_func_regexp . '$~', $tokens[$is_arg_start-1])) {
$is_arg_start--;
}
}
} else
$is_arg_start = $i-1; $is_arg_start = $i-1;
/* Construct the argument for 'is' expression, so it knows /* Construct the argument for 'is' expression, so it knows
what to operate on. */ what to operate on. */

View file

@ -25,7 +25,7 @@ function smarty_core_process_compiled_include($params, &$smarty)
$smarty->_include($_include_file_path, true); $smarty->_include($_include_file_path, true);
} }
foreach ($smarty->_cache_serials as $_include_file_path=>$_cache_serial) { foreach ($smarty->_cache_info['cache_serials'] as $_include_file_path=>$_cache_serial) {
$_return = preg_replace_callback('!(\{nocache\:('.$_cache_serial.')#(\d+)\})!s', $_return = preg_replace_callback('!(\{nocache\:('.$_cache_serial.')#(\d+)\})!s',
array(&$smarty, '_process_compiled_include_callback'), array(&$smarty, '_process_compiled_include_callback'),
$_return); $_return);

View file

@ -21,6 +21,18 @@
* @return string * @return string
*/ */
function smarty_modifier_regex_replace($string, $search, $replace) function smarty_modifier_regex_replace($string, $search, $replace)
{
if(is_array($search)) {
foreach($search as $idx => $s)
$search[$idx] = _smarty_regex_replace_check($s);
} else {
$search = _smarty_regex_replace_check($search);
}
return preg_replace($search, $replace, $string);
}
function _smarty_regex_replace_check($search)
{ {
if (($pos = strpos($search,"\0")) !== false) if (($pos = strpos($search,"\0")) !== false)
$search = substr($search,0,$pos); $search = substr($search,0,$pos);
@ -28,8 +40,7 @@ function smarty_modifier_regex_replace($string, $search, $replace)
/* remove eval-modifier from $search */ /* remove eval-modifier from $search */
$search = substr($search, 0, -strlen($match[1])) . preg_replace('![e\s]+!', '', $match[1]); $search = substr($search, 0, -strlen($match[1])) . preg_replace('![e\s]+!', '', $match[1]);
} }
return $search;
return preg_replace($search, $replace, $string);
} }
/* vim: set expandtab: */ /* vim: set expandtab: */

View file

@ -28,21 +28,21 @@
function smarty_outputfilter_trimwhitespace($source, &$smarty) function smarty_outputfilter_trimwhitespace($source, &$smarty)
{ {
// Pull out the script blocks // Pull out the script blocks
preg_match_all("!<script[^>]+>.*?</script>!is", $source, $match); preg_match_all("!<script[^>]*?>.*?</script>!is", $source, $match);
$_script_blocks = $match[0]; $_script_blocks = $match[0];
$source = preg_replace("!<script[^>]+>.*?</script>!is", $source = preg_replace("!<script[^>]*?>.*?</script>!is",
'@@@SMARTY:TRIM:SCRIPT@@@', $source); '@@@SMARTY:TRIM:SCRIPT@@@', $source);
// Pull out the pre blocks // Pull out the pre blocks
preg_match_all("!<pre>.*?</pre>!is", $source, $match); preg_match_all("!<pre[^>]*?>.*?</pre>!is", $source, $match);
$_pre_blocks = $match[0]; $_pre_blocks = $match[0];
$source = preg_replace("!<pre>.*?</pre>!is", $source = preg_replace("!<pre[^>]*?>.*?</pre>!is",
'@@@SMARTY:TRIM:PRE@@@', $source); '@@@SMARTY:TRIM:PRE@@@', $source);
// Pull out the textarea blocks // Pull out the textarea blocks
preg_match_all("!<textarea[^>]+>.*?</textarea>!is", $source, $match); preg_match_all("!<textarea[^>]*?>.*?</textarea>!is", $source, $match);
$_textarea_blocks = $match[0]; $_textarea_blocks = $match[0];
$source = preg_replace("!<textarea[^>]+>.*?</textarea>!is", $source = preg_replace("!<textarea[^>]*?>.*?</textarea>!is",
'@@@SMARTY:TRIM:TEXTAREA@@@', $source); '@@@SMARTY:TRIM:TEXTAREA@@@', $source);
// remove all leading spaces, tabs and carriage returns NOT // remove all leading spaces, tabs and carriage returns NOT

View file

Before

Width:  |  Height:  |  Size: 1.1 KiB

After

Width:  |  Height:  |  Size: 1.1 KiB

Before After
Before After

Some files were not shown because too many files have changed in this diff Show more