mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-08-16 23:00:21 +00:00
Improvements to the script loader: allows plugins to queue scripts for the front end head and footer, adds hooks for server side caching of compressed scripts, adds support for ENFORCE_GZIP constant (deflate is used by default since it's faster), see #8628, fixes #8884
git-svn-id: https://develop.svn.wordpress.org/trunk@10442 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
@@ -97,8 +97,9 @@ $load = explode(',', $load);
|
||||
if ( empty($load) )
|
||||
exit;
|
||||
|
||||
$compress = ( isset($_GET['c']) && 1 == $_GET['c'] );
|
||||
$rtl = ( isset($_GET['rtl']) && 1 == $_GET['rtl'] );
|
||||
$compress = ( isset($_GET['c']) && $_GET['c'] );
|
||||
$force_gzip = ( $compress && 'gzip' == $_GET['c'] );
|
||||
$rtl = ( isset($_GET['dir']) && 'rtl' == $_GET['dir'] );
|
||||
$expires_offset = 31536000;
|
||||
$out = '';
|
||||
|
||||
@@ -126,9 +127,12 @@ header('Content-Type: text/css');
|
||||
header('Expires: ' . gmdate( "D, d M Y H:i:s", time() + $expires_offset ) . ' GMT');
|
||||
header("Cache-Control: public, max-age=$expires_offset");
|
||||
|
||||
if ( $compress && ! ini_get('zlib.output_compression') && function_exists('gzencode') ) {
|
||||
if ( $compress && ! ini_get('zlib.output_compression') ) {
|
||||
header('Vary: Accept-Encoding'); // Handle proxies
|
||||
if ( false !== strpos( strtolower($_SERVER['HTTP_ACCEPT_ENCODING']), 'gzip') ) {
|
||||
if ( false !== strpos( strtolower($_SERVER['HTTP_ACCEPT_ENCODING']), 'deflate') && function_exists('gzdeflate') && ! $force_gzip ) {
|
||||
header('Content-Encoding: deflate');
|
||||
$out = gzdeflate( $out, 3 );
|
||||
} elseif ( false !== strpos( strtolower($_SERVER['HTTP_ACCEPT_ENCODING']), 'gzip') && function_exists('gzencode') ) {
|
||||
header('Content-Encoding: gzip');
|
||||
$out = gzencode( $out, 3 );
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user