From 159fbc8377832ff8e931cef0413ee571c494ac84 Mon Sep 17 00:00:00 2001 From: rvelices Date: Tue, 16 Sep 2008 10:17:20 +0000 Subject: - upgrade smarty to latest release 2.6.20 git-svn-id: http://piwigo.org/svn/trunk@2538 68402e56-0260-453c-a942-63ccdbb3a9ee --- include/smarty/libs/plugins/modifier.regex_replace.php | 15 +++++++++++++-- .../smarty/libs/plugins/outputfilter.trimwhitespace.php | 14 +++++++------- 2 files changed, 20 insertions(+), 9 deletions(-) (limited to 'include/smarty/libs/plugins') 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 @@ -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/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("!]+>.*?!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 -- cgit v1.2.3