public static function CompressOutput($content, $print = true)
{
// Browser can handle gzip data so send it the gzip version
if (strstr($_SERVER['HTTP_ACCEPT_ENCODING'], 'gzip')) {
$gzip = gzencode($content, 9, FORCE_GZIP);
// output the data to the browser
if ($print) {
header("Content-Encoding: gzip");
header("Content-Length: " . strlen($gzip));
echo $gzip;
} else {
return $gzip;
}
} else {
if ($print == true) {
echo $content;
} else {
return $content;
}
}
}