From cd95b1bb793c55698f970667c12e83101d9ed9fc Mon Sep 17 00:00:00 2001 From: cajus Date: Thu, 9 Oct 2008 08:10:40 +0000 Subject: [PATCH] Updated to smarty 2.6.20 git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@12642 594d385d-05f5-0310-b6e9-bd551577e9d8 --- gosa-core/include/smarty/Config_File.class.php | 2 +- gosa-core/include/smarty/Smarty.class.php | 4 ++-- .../include/smarty/Smarty_Compiler.class.php | 13 +++++++++---- .../internals/core.process_compiled_include.php | 2 +- .../smarty/plugins/modifier.regex_replace.php | 15 +++++++++++++-- .../plugins/outputfilter.trimwhitespace.php | 14 +++++++------- 6 files changed, 33 insertions(+), 17 deletions(-) diff --git a/gosa-core/include/smarty/Config_File.class.php b/gosa-core/include/smarty/Config_File.class.php index e3c3ca25c..a10d30469 100644 --- a/gosa-core/include/smarty/Config_File.class.php +++ b/gosa-core/include/smarty/Config_File.class.php @@ -18,7 +18,7 @@ * 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 * @access public diff --git a/gosa-core/include/smarty/Smarty.class.php b/gosa-core/include/smarty/Smarty.class.php index 5eda787bd..19318e6a1 100644 --- a/gosa-core/include/smarty/Smarty.class.php +++ b/gosa-core/include/smarty/Smarty.class.php @@ -27,7 +27,7 @@ * @author Monte Ohrt * @author Andrei Zmievski * @package Smarty - * @version 2.6.19 + * @version 2.6.20 */ /* $Id: Smarty.class.php 2722 2007-06-18 14:29:00Z danilo $ */ @@ -464,7 +464,7 @@ class Smarty * * @var string */ - var $_version = '2.6.19'; + var $_version = '2.6.20'; /** * current template inclusion depth diff --git a/gosa-core/include/smarty/Smarty_Compiler.class.php b/gosa-core/include/smarty/Smarty_Compiler.class.php index 52466d318..f09f8de8d 100644 --- a/gosa-core/include/smarty/Smarty_Compiler.class.php +++ b/gosa-core/include/smarty/Smarty_Compiler.class.php @@ -21,12 +21,12 @@ * @link http://smarty.php.net/ * @author Monte Ohrt * @author Andrei Zmievski - * @version 2.6.19 + * @version 2.6.20 * @copyright 2001-2005 New Digital Group, Inc. * @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 @@ -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/gosa-core/include/smarty/internals/core.process_compiled_include.php b/gosa-core/include/smarty/internals/core.process_compiled_include.php index d539423bf..904d59745 100644 --- a/gosa-core/include/smarty/internals/core.process_compiled_include.php +++ b/gosa-core/include/smarty/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/gosa-core/include/smarty/plugins/modifier.regex_replace.php b/gosa-core/include/smarty/plugins/modifier.regex_replace.php index d1f1545d8..100b58ce4 100644 --- a/gosa-core/include/smarty/plugins/modifier.regex_replace.php +++ b/gosa-core/include/smarty/plugins/modifier.regex_replace.php @@ -21,6 +21,18 @@ * @return string */ 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); @@ -28,8 +40,7 @@ function smarty_modifier_regex_replace($string, $search, $replace) /* 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/gosa-core/include/smarty/plugins/outputfilter.trimwhitespace.php b/gosa-core/include/smarty/plugins/outputfilter.trimwhitespace.php index 97b0d21e8..739fa39b0 100644 --- a/gosa-core/include/smarty/plugins/outputfilter.trimwhitespace.php +++ b/gosa-core/include/smarty/plugins/outputfilter.trimwhitespace.php @@ -28,21 +28,21 @@ function smarty_outputfilter_trimwhitespace($source, &$smarty) { // Pull out the script blocks - preg_match_all("!]+>.*?!is", $source, $match); + preg_match_all("!]*?>.*?!is", $source, $match); $_script_blocks = $match[0]; - $source = preg_replace("!]+>.*?!is", + $source = preg_replace("!]*?>.*?!is", '@@@SMARTY:TRIM:SCRIPT@@@', $source); // Pull out the pre blocks - preg_match_all("!
.*?
!is", $source, $match); + preg_match_all("!]*?>.*?!is", $source, $match); $_pre_blocks = $match[0]; - $source = preg_replace("!
.*?
!is", + $source = preg_replace("!]*?>.*?!is", '@@@SMARTY:TRIM:PRE@@@', $source); - + // Pull out the textarea blocks - preg_match_all("!]+>.*?!is", $source, $match); + preg_match_all("!]*?>.*?!is", $source, $match); $_textarea_blocks = $match[0]; - $source = preg_replace("!]+>.*?!is", + $source = preg_replace("!]*?>.*?!is", '@@@SMARTY:TRIM:TEXTAREA@@@', $source); // remove all leading spaces, tabs and carriage returns NOT -- 2.30.2