= 0) $ext = pathinfo(parse_url($file, PHP_URL_PATH), PATHINFO_EXTENSION); else $ext = substr(strrchr($file, '.'), 1); if(!in_array($ext, array('css', 'js'))) exit(); switch($ext){ default: case 'css': $type = 'text/css'; break; case 'js': $type = 'text/javascript'; break; } header('Content-type: '.$type); header('Cache-Control: max-age='.(60*60*6).', must-revalidate'); // white space removal, use it if gzip is not available function compress($buffer){ $buffer = preg_replace('!/\*[^*]*\*+([^/][^*]*\*+)*/!', '', $buffer); $buffer = str_replace(array("\r\n", "\r", "\n", "\t", ' ', ' ', ' '), ' ', $buffer); return $buffer; } if (!file_exists($file)) exit(); ob_start((extension_loaded('zlib') && substr_count($_SERVER['HTTP_ACCEPT_ENCODING'], 'gzip')) ? 'ob_gzhandler' : 'compress'); include_once $file; ?>