2009-01-16 13:58:38 +01:00
|
|
|
<?php
|
2009-11-19 10:46:07 +01:00
|
|
|
/**
|
|
|
|
* Disable error reporting
|
|
|
|
*
|
2014-07-07 18:42:16 +02:00
|
|
|
* Set this to error_reporting( -1 ) for debugging.
|
2009-11-19 10:46:07 +01:00
|
|
|
*/
|
2017-12-01 00:11:00 +01:00
|
|
|
error_reporting( 0 );
|
2009-01-16 13:58:38 +01:00
|
|
|
|
2017-12-01 00:11:00 +01:00
|
|
|
$basepath = dirname( __FILE__ );
|
2009-01-17 15:08:15 +01:00
|
|
|
|
2017-12-01 00:11:00 +01:00
|
|
|
function get_file( $path ) {
|
2009-01-16 13:58:38 +01:00
|
|
|
|
2017-12-01 00:11:00 +01:00
|
|
|
if ( function_exists( 'realpath' ) ) {
|
|
|
|
$path = realpath( $path );
|
|
|
|
}
|
2009-01-16 13:58:38 +01:00
|
|
|
|
2017-12-01 00:11:00 +01:00
|
|
|
if ( ! $path || ! @is_file( $path ) ) {
|
2009-06-17 03:06:32 +02:00
|
|
|
return false;
|
2017-12-01 00:11:00 +01:00
|
|
|
}
|
2009-01-16 13:58:38 +01:00
|
|
|
|
2017-12-01 00:11:00 +01:00
|
|
|
return @file_get_contents( $path );
|
2009-01-16 13:58:38 +01:00
|
|
|
}
|
|
|
|
|
2012-11-10 19:13:09 +01:00
|
|
|
$expires_offset = 31536000; // 1 year
|
2009-01-16 13:58:38 +01:00
|
|
|
|
2017-12-01 00:11:00 +01: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 13:58:38 +01:00
|
|
|
|
2017-12-01 00:11:00 +01: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 10:46:07 +01:00
|
|
|
|
2017-12-01 00:11:00 +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 {
|
2014-04-12 00:16:14 +02: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 13:58:38 +01:00
|
|
|
}
|
|
|
|
exit;
|