Skip to content

Commit

Permalink
Merge pull request #153 from trk/master
Browse files Browse the repository at this point in the history
Compress HTML Output additions
  • Loading branch information
partikule committed Apr 4, 2014
2 parents 5e301db + 7b779c8 commit a5676ea
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions application/libraries/ftl/parser.php
Expand Up @@ -151,13 +151,17 @@ public function compress($output)
$search = array(
'/\>[^\S ]+/s', //strip whitespaces after tags, except space
'/[^\S ]+\</s', //strip whitespaces before tags, except space
'/(\s)+/s' // shorten multiple whitespace sequences
'/(\s)+/s', // shorten multiple whitespace sequences
'/&lt;!--(.|\s)*?--&gt;/', // strip HTML comments
'#(?://)?<!\[CDATA\[(.*?)(?://)?\]\]>#s' // leave CDATA alone
);

$replace = array(
'>',
'<',
'\\1'
'\\1',
'',
"//&lt;![CDATA[\n".'\1'."\n//]]>"
);

$buffer = preg_replace($search, $replace, $buffer);
Expand Down

0 comments on commit a5676ea

Please sign in to comment.