diff --git a/gosa-core/include/smarty/plugins/outputfilter.trimwhitespace.php b/gosa-core/include/smarty/plugins/outputfilter.trimwhitespace.php
index 01e35e03df93c829d32c127d9a8bf698da9fb2b2..ce5fde985570eac016560fb34a74bdd166dbf827 100644 (file)
/**
* Smarty plugin
* @package Smarty
- * @subpackage plugins
+ * @subpackage PluginsFilter
*/
/**
* @author Monte Ohrt <monte at ohrt dot com>
* @author Contributions from Lars Noschinski <lars@usenet.noschinski.de>
* @version 1.3
- * @param string
- * @param Smarty
+ * @param string $source input string
+ * @param object &$smarty Smarty object
+ * @return string filtered output
*/
-function smarty_outputfilter_trimwhitespace($source, &$smarty)
+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
// preceeded by a php close tag.
$source = trim(preg_replace('/((?<!\?>)\n)[\s]+/m', '\1', $source));
- // replace script blocks
- smarty_outputfilter_trimwhitespace_replace("@@@SMARTY:TRIM:SCRIPT@@@",$_script_blocks, $source);
+ // replace textarea blocks
+ smarty_outputfilter_trimwhitespace_replace("@@@SMARTY:TRIM:TEXTAREA@@@",$_textarea_blocks, $source);
// replace pre blocks
smarty_outputfilter_trimwhitespace_replace("@@@SMARTY:TRIM:PRE@@@",$_pre_blocks, $source);
- // replace textarea blocks
- smarty_outputfilter_trimwhitespace_replace("@@@SMARTY:TRIM:TEXTAREA@@@",$_textarea_blocks, $source);
+ // replace script blocks
+ smarty_outputfilter_trimwhitespace_replace("@@@SMARTY:TRIM:SCRIPT@@@",$_script_blocks, $source);
return $source;
}