Fall back to wp-tinymce.js if wp-tinymce.js.gz doesn't exist

git-svn-id: http://svn.automattic.com/wordpress/trunk@11589 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
azaozz
2009-06-17 01:06:32 +00:00
parent 9d293d9f0e
commit 8502dc0487
3 changed files with 5 additions and 6 deletions

View File

@@ -8,7 +8,7 @@ function get_file($path) {
$path = realpath($path);
if ( ! $path || ! @is_file($path) )
return '';
return false;
return @file_get_contents($path);
}
@@ -20,9 +20,9 @@ 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");
if ( isset($_GET['c']) && 1 == $_GET['c'] && false !== strpos( strtolower($_SERVER['HTTP_ACCEPT_ENCODING']), 'gzip') ) {
if ( isset($_GET['c']) && 1 == $_GET['c'] && false !== strpos( strtolower($_SERVER['HTTP_ACCEPT_ENCODING']), 'gzip') && ( $file = get_file($basepath . '/wp-tinymce.js.gz') ) ) {
header('Content-Encoding: gzip');
echo get_file($basepath . '/wp-tinymce.js.gz');
echo $file;
} else {
echo get_file($basepath . '/wp-tinymce.js');
}