diff options
Diffstat (limited to 'include/smarty')
-rw-r--r-- | include/smarty/NEWS | 12 | ||||
-rw-r--r-- | include/smarty/README | 2 | ||||
-rw-r--r-- | include/smarty/libs/Config_File.class.php | 4 | ||||
-rw-r--r-- | include/smarty/libs/Smarty.class.php | 16 | ||||
-rw-r--r-- | include/smarty/libs/Smarty_Compiler.class.php | 13 | ||||
-rw-r--r-- | include/smarty/libs/internals/core.process_compiled_include.php | 2 | ||||
-rw-r--r-- | include/smarty/libs/plugins/modifier.regex_replace.php | 15 | ||||
-rw-r--r-- | include/smarty/libs/plugins/outputfilter.trimwhitespace.php | 14 |
8 files changed, 53 insertions, 25 deletions
diff --git a/include/smarty/NEWS b/include/smarty/NEWS index fa550ff18..1e3b77ecc 100644 --- a/include/smarty/NEWS +++ b/include/smarty/NEWS @@ -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) ------------------------------- diff --git a/include/smarty/README b/include/smarty/README index 6e7c93c56..c11ed0ca7 100644 --- a/include/smarty/README +++ b/include/smarty/README @@ -2,7 +2,7 @@ NAME: Smarty - the PHP compiling template engine -VERSION: 2.6.19 +VERSION: 2.6.20 AUTHORS: diff --git a/include/smarty/libs/Config_File.class.php b/include/smarty/libs/Config_File.class.php index 89ba41c45..a10d30469 100644 --- a/include/smarty/libs/Config_File.class.php +++ b/include/smarty/libs/Config_File.class.php @@ -18,14 +18,14 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * @link http://smarty.php.net/ - * @version 2.6.19 + * @version 2.6.20 * @copyright Copyright: 2001-2005 New Digital Group, Inc. * @author Andrei Zmievski <andrei@php.net> * @access public * @package Smarty */ -/* $Id$ */ +/* $Id: Config_File.class.php 2702 2007-03-08 19:11:22Z mohrt $ */ /** * Config file reading class diff --git a/include/smarty/libs/Smarty.class.php b/include/smarty/libs/Smarty.class.php index 6b893dec8..6ac6a04b2 100644 --- a/include/smarty/libs/Smarty.class.php +++ b/include/smarty/libs/Smarty.class.php @@ -27,10 +27,10 @@ * @author Monte Ohrt <monte at ohrt dot com> * @author Andrei Zmievski <andrei@php.net> * @package Smarty - * @version 2.6.19 + * @version 2.6.20 */ -/* $Id$ */ +/* $Id: Smarty.class.php 2722 2007-06-18 14:29:00Z danilo $ */ /** * DIR_SEP isn't used anymore, but third party apps might @@ -464,7 +464,7 @@ class Smarty * * @var string */ - var $_version = '2.6.19'; + var $_version = '2.6.20'; /** * current template inclusion depth @@ -1057,7 +1057,7 @@ class Smarty } else { // var non-existant, return valid reference $_tmp = null; - return $_tmp; + return $_tmp; } } @@ -1116,7 +1116,7 @@ class Smarty 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); @@ -1940,10 +1940,10 @@ class Smarty { return eval($code); } - + /** * Extracts the filter name from the given callback - * + * * @param callback $function * @return string */ @@ -1958,7 +1958,7 @@ class Smarty return $function; } } - + /**#@-*/ } diff --git a/include/smarty/libs/Smarty_Compiler.class.php b/include/smarty/libs/Smarty_Compiler.class.php index d5f877f7b..f09f8de8d 100644 --- a/include/smarty/libs/Smarty_Compiler.class.php +++ b/include/smarty/libs/Smarty_Compiler.class.php @@ -21,12 +21,12 @@ * @link http://smarty.php.net/ * @author Monte Ohrt <monte at ohrt dot com> * @author Andrei Zmievski <andrei@php.net> - * @version 2.6.19 + * @version 2.6.20 * @copyright 2001-2005 New Digital Group, Inc. * @package Smarty */ -/* $Id$ */ +/* $Id: Smarty_Compiler.class.php 2773 2008-08-12 18:17:51Z Uwe.Tews $ */ /** * Template compiling class @@ -1363,9 +1363,14 @@ class Smarty_Compiler extends Smarty { /* If last token was a ')', we operate on the parenthesized expression. The start of the expression is on the stack. Otherwise, we operate on the last encountered token. */ - if ($tokens[$i-1] == ')') + if ($tokens[$i-1] == ')') { $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; /* Construct the argument for 'is' expression, so it knows what to operate on. */ diff --git a/include/smarty/libs/internals/core.process_compiled_include.php b/include/smarty/libs/internals/core.process_compiled_include.php index d539423bf..904d59745 100644 --- a/include/smarty/libs/internals/core.process_compiled_include.php +++ b/include/smarty/libs/internals/core.process_compiled_include.php @@ -25,7 +25,7 @@ function smarty_core_process_compiled_include($params, &$smarty) $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', array(&$smarty, '_process_compiled_include_callback'), $_return); diff --git a/include/smarty/libs/plugins/modifier.regex_replace.php b/include/smarty/libs/plugins/modifier.regex_replace.php index d1f1545d8..100b58ce4 100644 --- a/include/smarty/libs/plugins/modifier.regex_replace.php +++ b/include/smarty/libs/plugins/modifier.regex_replace.php @@ -22,14 +22,25 @@ */ 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) $search = substr($search,0,$pos); if (preg_match('!([a-zA-Z\s]+)$!s', $search, $match) && (strpos($match[1], 'e') !== false)) { /* remove eval-modifier from $search */ $search = substr($search, 0, -strlen($match[1])) . preg_replace('![e\s]+!', '', $match[1]); } - - return preg_replace($search, $replace, $string); + return $search; } /* vim: set expandtab: */ diff --git a/include/smarty/libs/plugins/outputfilter.trimwhitespace.php b/include/smarty/libs/plugins/outputfilter.trimwhitespace.php index 97b0d21e8..739fa39b0 100644 --- a/include/smarty/libs/plugins/outputfilter.trimwhitespace.php +++ b/include/smarty/libs/plugins/outputfilter.trimwhitespace.php @@ -28,21 +28,21 @@ function smarty_outputfilter_trimwhitespace($source, &$smarty) { // 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]; - $source = preg_replace("!<script[^>]+>.*?</script>!is", + $source = preg_replace("!<script[^>]*?>.*?</script>!is", '@@@SMARTY:TRIM:SCRIPT@@@', $source); // 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]; - $source = preg_replace("!<pre>.*?</pre>!is", + $source = preg_replace("!<pre[^>]*?>.*?</pre>!is", '@@@SMARTY:TRIM:PRE@@@', $source); - + // 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]; - $source = preg_replace("!<textarea[^>]+>.*?</textarea>!is", + $source = preg_replace("!<textarea[^>]*?>.*?</textarea>!is", '@@@SMARTY:TRIM:TEXTAREA@@@', $source); // remove all leading spaces, tabs and carriage returns NOT |