2009-01-16 07:58:38 -05:00
|
|
|
<?php
|
2009-11-19 04:46:07 -05:00
|
|
|
/**
|
|
|
|
* Disable error reporting
|
|
|
|
*
|
2014-07-07 12:42:16 -04:00
|
|
|
* Set this to error_reporting( -1 ) for debugging.
|
2009-11-19 04:46:07 -05:00
|
|
|
*/
|
2017-11-30 18:11:00 -05:00
|
|
|
error_reporting( 0 );
|
2009-01-16 07:58:38 -05:00
|
|
|
|
2017-11-30 18:11:00 -05:00
|
|
|
$basepath = dirname( __FILE__ );
|
2009-01-17 09:08:15 -05:00
|
|
|
|
2017-11-30 18:11:00 -05:00
|
|
|
function get_file( $path ) {
|
2009-01-16 07:58:38 -05:00
|
|
|
|
2017-11-30 18:11:00 -05:00
|
|
|
if ( function_exists( 'realpath' ) ) {
|
|
|
|
$path = realpath( $path );
|
|
|
|
}
|
2009-01-16 07:58:38 -05:00
|
|
|
|
2017-11-30 18:11:00 -05:00
|
|
|
if ( ! $path || ! @is_file( $path ) ) {
|
2009-06-16 21:06:32 -04:00
|
|
|
return false;
|
2017-11-30 18:11:00 -05:00
|
|
|
}
|
2009-01-16 07:58:38 -05:00
|
|
|
|
2017-11-30 18:11:00 -05:00
|
|
|
return @file_get_contents( $path );
|
2009-01-16 07:58:38 -05:00
|
|
|
}
|
|
|
|
|
2012-11-10 13:13:09 -05:00
|
|
|
$expires_offset = 31536000; // 1 year
|
2009-01-16 07:58:38 -05:00
|
|
|
|
2017-11-30 18:11:00 -05:00
|
|
|
header( 'Content-Type: application/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-01-16 07:58:38 -05:00
|
|
|
|
2017-11-30 18:11:00 -05:00
|
|
|
if ( isset( $_GET['c'] ) && 1 == $_GET['c'] && isset( $_SERVER['HTTP_ACCEPT_ENCODING'] )
|
|
|
|
&& false !== stripos( $_SERVER['HTTP_ACCEPT_ENCODING'], 'gzip' ) && ( $file = get_file( $basepath . '/wp-tinymce.js.gz' ) ) ) {
|
2009-11-19 04:46:07 -05:00
|
|
|
|
2017-11-30 18:11:00 -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 {
|
2014-04-11 18:16:14 -04:00
|
|
|
// Back compat. This file shouldn't be used if this condition can occur (as in, if gzip isn't accepted).
|
|
|
|
echo get_file( $basepath . '/tinymce.min.js' );
|
|
|
|
echo get_file( $basepath . '/plugins/compat3x/plugin.min.js' );
|
2009-01-16 07:58:38 -05:00
|
|
|
}
|
|
|
|
exit;
|