web/wp-includes/js/tinymce/wp-tinymce.php
branchwordpress
changeset 109 03b0d1493584
child 132 4d4862461b8d
equal deleted inserted replaced
-1:000000000000 109:03b0d1493584
       
     1 <?php
       
     2 
       
     3 $basepath = dirname(__FILE__);
       
     4 
       
     5 function get_file($path) {
       
     6 
       
     7 	if ( function_exists('realpath') )
       
     8 		$path = realpath($path);
       
     9 
       
    10 	if ( ! $path || ! @is_file($path) )
       
    11 		return false;
       
    12 
       
    13 	return @file_get_contents($path);
       
    14 }
       
    15 
       
    16 $expires_offset = 31536000;
       
    17 
       
    18 header('Content-Type: application/x-javascript; charset=UTF-8');
       
    19 header('Vary: Accept-Encoding'); // Handle proxies
       
    20 header('Expires: ' . gmdate( "D, d M Y H:i:s", time() + $expires_offset ) . ' GMT');
       
    21 header("Cache-Control: public, max-age=$expires_offset");
       
    22 
       
    23 if ( isset($_GET['c']) && 1 == $_GET['c'] && false !== strpos( strtolower($_SERVER['HTTP_ACCEPT_ENCODING']), 'gzip') && ( $file = get_file($basepath . '/wp-tinymce.js.gz') ) ) {
       
    24 	header('Content-Encoding: gzip');
       
    25 	echo $file;
       
    26 } else {
       
    27 	echo get_file($basepath . '/wp-tinymce.js');
       
    28 }
       
    29 exit;