[eluser]Maxximus[/eluser]
Ok here's the problem:
Code:
private function _http_headers($type = '', $gzip_compress = FALSE, $far_future_expire = TRUE) {
if ($type === 'css')
$mime_type = 'css';
else if ($type === 'js')
$mime_type = 'javascript';
else
return FALSE;
$gzip_header = "";
if ($gzip_compress) {
$gzip_header = '<?php
// Gzip encode the contents of the output buffer.
function gzip_compress($output) {
$compressed_out = "\x1f\x8b\x08\x00\x00\x00\x00\x00";
$compressed_out .= substr(gzcompress($output, 2), 0, -4);
if (strlen($output) >= 1000) {
header("Content-Encoding: gzip");
return $compressed_out;
} else {
return $output;
}
}
if (strstr($HTTP_SERVER_VARS["HTTP_ACCEPT_ENCODING"], "gzip"))
ob_start("gzip_compress");
?>';
}
if ($far_future_expire) {
//When will the file expire?
$offset = 6000000 * 60 ;
$ExpStr = "Expires: " .
gmdate("D, d M Y H:i:s",
time() + $offset)." GMT";
$far_future_expire .= '<?php
header("Content-type: text/'.$mime_type .'; charset: UTF-8");
header("Cache-Control: must-revalidate");
header("'.$ExpStr.'");
?>';
}
return $gzip_header;
}
The $far_future_expire will never be used, and should be $gzip_header. Personally I would prefer to have the Content-type header as one of the first, so it's outputted also when there's no far_future_expire.