By: LeoC
Date: 2009-04-15
Time: 20:40
|
Snippet: Compress source
I´ve found this function and put it as a TBS method
to compress source (with Render false) and put
all output in a single line html.
I hope it can be useful to someone.
function compressBuffer($b)
{
$b = str_replace(array("\r\n", "\r", "\n", "\t"), ' ', $b);
$b = ereg_replace(" {2,}", ' ',$b);
$b = str_replace("> <", "><", $b);
$b = str_replace(" ", " ", $b);
$b = str_replace(" ", " ", $b);
return $b;
}
Cheers.
|