2009-01-16 13:58:38 +01:00
|
|
|
<?php
|
2009-11-19 10:46:07 +01:00
|
|
|
/**
|
|
|
|
* Disable error reporting
|
|
|
|
*
|
|
|
|
* Set this to error_reporting( E_ALL ) or error_reporting( E_ALL | E_STRICT ) for debugging
|
|
|
|
*/
|
|
|
|
error_reporting(0);
|
2009-01-16 13:58:38 +01:00
|
|
|
|
2009-01-17 15:08:15 +01:00
|
|
|
$basepath = dirname(__FILE__);
|
|
|
|
|
2009-01-16 13:58:38 +01:00
|
|
|
function get_file($path) {
|
|
|
|
|
|
|
|
if ( function_exists('realpath') )
|
|
|
|
$path = realpath($path);
|
|
|
|
|
|
|
|
if ( ! $path || ! @is_file($path) )
|
2009-06-17 03:06:32 +02:00
|
|
|
return false;
|
2009-01-16 13:58:38 +01:00
|
|
|
|
|
|
|
return @file_get_contents($path);
|
|
|
|
}
|
|
|
|
|
2012-09-25 07:26:19 +02:00
|
|
|
$expires_offset = YEAR_IN_SECONDS;
|
2009-01-16 13:58:38 +01:00
|
|
|
|
|
|
|
header('Content-Type: application/x-javascript; charset=UTF-8');
|
|
|
|
header('Vary: Accept-Encoding'); // Handle proxies
|
|
|
|
header('Expires: ' . gmdate( "D, d M Y H:i:s", time() + $expires_offset ) . ' GMT');
|
|
|
|
header("Cache-Control: public, max-age=$expires_offset");
|
|
|
|
|
2009-11-19 10:46:07 +01:00
|
|
|
if ( isset($_GET['c']) && 1 == $_GET['c'] && isset($_SERVER['HTTP_ACCEPT_ENCODING'])
|
2011-04-11 20:55:11 +02:00
|
|
|
&& false !== stripos($_SERVER['HTTP_ACCEPT_ENCODING'], 'gzip') && ( $file = get_file($basepath . '/wp-tinymce.js.gz') ) ) {
|
2009-11-19 10:46:07 +01:00
|
|
|
|
2009-01-16 13:58:38 +01:00
|
|
|
header('Content-Encoding: gzip');
|
2009-06-17 03:06:32 +02:00
|
|
|
echo $file;
|
2009-01-16 13:58:38 +01:00
|
|
|
} else {
|
2010-05-20 23:05:16 +02:00
|
|
|
echo get_file($basepath . '/tiny_mce.js');
|
2009-01-16 13:58:38 +01:00
|
|
|
}
|
|
|
|
exit;
|