27 $source = preg_replace(
"/\015\012|\015|\012/",
"\n", $source);
30 if (preg_match_all(
'#<!--\[[^\]]+\]>.*?<!\[[^\]]+\]-->#is', $source, $matches, PREG_OFFSET_CAPTURE | PREG_SET_ORDER)) {
31 foreach ($matches as
$match) {
32 $store[] = $match[0][0];
33 $_length = strlen($match[0][0]);
34 $replace =
'@!@SMARTY:' . $_store .
':SMARTY@!@';
35 $source = substr_replace($source, $replace, $match[0][1] - $_offset, $_length);
37 $_offset += $_length - strlen($replace);
44 $source = preg_replace(
'#<!--.*?-->#ms',
'', $source );
48 if (preg_match_all(
'#<(script|pre|textarea)[^>]*>.*?</\\1>#is', $source, $matches, PREG_OFFSET_CAPTURE | PREG_SET_ORDER)) {
49 foreach ($matches as
$match) {
50 $store[] = $match[0][0];
51 $_length = strlen($match[0][0]);
52 $replace =
'@!@SMARTY:' . $_store .
':SMARTY@!@';
53 $source = substr_replace($source, $replace, $match[0][1] - $_offset, $_length);
55 $_offset += $_length - strlen($replace);
63 '#(:SMARTY@!@|>)\s+(?=@!@SMARTY:|<)#s' =>
'\1 \2',
65 '#(([a-z0-9]\s*=\s*(["\'])[^\3]*?\3)|<[a-z0-9_]+)\s+([a-z/>])#is' =>
'\1 \4',
72 $source = preg_replace( array_keys($expressions), array_values($expressions), $source );
79 if (preg_match_all(
'#@!@SMARTY:([0-9]+):SMARTY@!@#is', $source, $matches, PREG_OFFSET_CAPTURE | PREG_SET_ORDER)) {
80 foreach ($matches as
$match) {
81 $store[] = $match[0][0];
82 $_length = strlen($match[0][0]);
83 $replace = array_shift($store);
84 $source = substr_replace($source, $replace, $match[0][1] + $_offset, $_length);
86 $_offset += strlen($replace) - $_length;
smarty_outputfilter_trimwhitespace($source, Smarty_Internal_Template $smarty)
Smarty trimwhitespace outputfilter plugin.