aboutsummaryrefslogtreecommitdiffstats
path: root/library/Smarty/libs/plugins/outputfilter.trimwhitespace.php
diff options
context:
space:
mode:
Diffstat (limited to 'library/Smarty/libs/plugins/outputfilter.trimwhitespace.php')
-rw-r--r--library/Smarty/libs/plugins/outputfilter.trimwhitespace.php4
1 files changed, 2 insertions, 2 deletions
diff --git a/library/Smarty/libs/plugins/outputfilter.trimwhitespace.php b/library/Smarty/libs/plugins/outputfilter.trimwhitespace.php
index 62ab4e776..ad35d11a2 100644
--- a/library/Smarty/libs/plugins/outputfilter.trimwhitespace.php
+++ b/library/Smarty/libs/plugins/outputfilter.trimwhitespace.php
@@ -45,7 +45,7 @@ function smarty_outputfilter_trimwhitespace($source)
// capture html elements not to be messed with
$_offset = 0;
- if (preg_match_all('#<(script|pre|textarea)[^>]*>.*?</\\1>#is', $source, $matches, PREG_OFFSET_CAPTURE | PREG_SET_ORDER)) {
+ if (preg_match_all('#(<script[^>]*>.*?</script[^>]*>)|(<textarea[^>]*>.*?</textarea[^>]*>)|(<pre[^>]*>.*?</pre[^>]*>)#is', $source, $matches, PREG_OFFSET_CAPTURE | PREG_SET_ORDER)) {
foreach ($matches as $match) {
$store[] = $match[0][0];
$_length = strlen($match[0][0]);
@@ -62,7 +62,7 @@ function smarty_outputfilter_trimwhitespace($source)
// can't remove them entirely, becaue that might break poorly implemented CSS display:inline-block elements
'#(:SMARTY@!@|>)\s+(?=@!@SMARTY:|<)#s' => '\1 \2',
// remove spaces between attributes (but not in attribute values!)
- '#(([a-z0-9]\s*=\s*(["\'])[^\3]*?\3)|<[a-z0-9_]+)\s+([a-z/>])#is' => '\1 \4',
+ '#(([a-z0-9]\s*=\s*("[^"]*?")|(\'[^\']*?\'))|<[a-z0-9_]+)\s+([a-z/>])#is' => '\1 \5',
// note: for some very weird reason trim() seems to remove spaces inside attributes.
// maybe a \0 byte or something is interfering?
'#^\s+<#Ss' => '<',