wp/wp-includes/js/tinymce/wp-tinymce.php
changeset 9 177826044cd9
parent 5 5e2f62d02dcd
child 16 a86126ab1dd4
equal deleted inserted replaced
8:c7c34916027a 9:177826044cd9
     1 <?php
     1 <?php
       
     2 /**
       
     3  * Not used in core since 5.1.
       
     4  * This is a back-compat for plugins that may be using this method of loading directly.
       
     5  */
       
     6 
     2 /**
     7 /**
     3  * Disable error reporting
     8  * Disable error reporting
     4  *
     9  *
     5  * Set this to error_reporting( -1 ) for debugging.
    10  * Set this to error_reporting( -1 ) for debugging.
     6  */
    11  */
     7 error_reporting(0);
    12 error_reporting( 0 );
     8 
    13 
     9 $basepath = dirname(__FILE__);
    14 $basepath = dirname( __FILE__ );
    10 
    15 
    11 function get_file($path) {
    16 function get_file( $path ) {
    12 
    17 
    13 	if ( function_exists('realpath') )
    18 	if ( function_exists( 'realpath' ) ) {
    14 		$path = realpath($path);
    19 		$path = realpath( $path );
       
    20 	}
    15 
    21 
    16 	if ( ! $path || ! @is_file($path) )
    22 	if ( ! $path || ! @is_file( $path ) ) {
    17 		return false;
    23 		return false;
       
    24 	}
    18 
    25 
    19 	return @file_get_contents($path);
    26 	return @file_get_contents( $path );
    20 }
    27 }
    21 
    28 
    22 $expires_offset = 31536000; // 1 year
    29 $expires_offset = 31536000; // 1 year
    23 
    30 
    24 header('Content-Type: application/javascript; charset=UTF-8');
    31 header( 'Content-Type: application/javascript; charset=UTF-8' );
    25 header('Vary: Accept-Encoding'); // Handle proxies
    32 header( 'Vary: Accept-Encoding' ); // Handle proxies
    26 header('Expires: ' . gmdate( "D, d M Y H:i:s", time() + $expires_offset ) . ' GMT');
    33 header( 'Expires: ' . gmdate( 'D, d M Y H:i:s', time() + $expires_offset ) . ' GMT' );
    27 header("Cache-Control: public, max-age=$expires_offset");
    34 header( "Cache-Control: public, max-age=$expires_offset" );
    28 
    35 
    29 if ( isset($_GET['c']) && 1 == $_GET['c'] && isset($_SERVER['HTTP_ACCEPT_ENCODING'])
    36 if ( isset( $_GET['c'] ) && ( $file = get_file( $basepath . '/wp-tinymce.js' ) ) ) {
    30 	&& false !== stripos($_SERVER['HTTP_ACCEPT_ENCODING'], 'gzip') && ( $file = get_file($basepath . '/wp-tinymce.js.gz') ) ) {
       
    31 
       
    32 	header('Content-Encoding: gzip');
       
    33 	echo $file;
    37 	echo $file;
    34 } else {
    38 } else {
    35 	// Back compat. This file shouldn't be used if this condition can occur (as in, if gzip isn't accepted).
    39 	// Even further back compat.
    36 	echo get_file( $basepath . '/tinymce.min.js' );
    40 	echo get_file( $basepath . '/tinymce.min.js' );
    37 	echo get_file( $basepath . '/plugins/compat3x/plugin.min.js' );
    41 	echo get_file( $basepath . '/plugins/compat3x/plugin.min.js' );
    38 }
    42 }
    39 exit;
    43 exit;