2009-01-16 07:58:38 -05:00
|
|
|
<?php
|
2009-11-19 04:46:07 -05: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 07:58:38 -05:00
|
|
|
|
2009-01-17 09:08:15 -05:00
|
|
|
$basepath = dirname(__FILE__);
|
|
|
|
|
2009-01-16 07:58:38 -05:00
|
|
|
function get_file($path) {
|
|
|
|
|
|
|
|
if ( function_exists('realpath') )
|
|
|
|
$path = realpath($path);
|
|
|
|
|
|
|
|
if ( ! $path || ! @is_file($path) )
|
2009-06-16 21:06:32 -04:00
|
|
|
return false;
|
2009-01-16 07:58:38 -05:00
|
|
|
|
|
|
|
return @file_get_contents($path);
|
|
|
|
}
|
|
|
|
|
2012-11-10 13:13:09 -05:00
|
|
|
$expires_offset = 31536000; // 1 year
|
2009-01-16 07:58:38 -05: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 04:46:07 -05:00
|
|
|
if ( isset($_GET['c']) && 1 == $_GET['c'] && isset($_SERVER['HTTP_ACCEPT_ENCODING'])
|
2011-04-11 14:55:11 -04:00
|
|
|
&& false !== stripos($_SERVER['HTTP_ACCEPT_ENCODING'], 'gzip') && ( $file = get_file($basepath . '/wp-tinymce.js.gz') ) ) {
|
2009-11-19 04:46:07 -05:00
|
|
|
|
2009-01-16 07:58:38 -05:00
|
|
|
header('Content-Encoding: gzip');
|
2009-06-16 21:06:32 -04:00
|
|
|
echo $file;
|
2009-01-16 07:58:38 -05:00
|
|
|
} else {
|
2010-05-20 17:05:16 -04:00
|
|
|
echo get_file($basepath . '/tiny_mce.js');
|
2009-01-16 07:58:38 -05:00
|
|
|
}
|
|
|
|
exit;
|