Make WordPress Core


Ignore:
Timestamp:
01/26/2009 12:59:10 PM (15 years ago)
Author:
azaozz
Message:

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

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-admin/load-styles.php

    r10372 r10442  
    9898    exit;
    9999
    100 $compress = ( isset($_GET['c']) && 1 == $_GET['c'] );
    101 $rtl = ( isset($_GET['rtl']) && 1 == $_GET['rtl'] );
     100$compress = ( isset($_GET['c']) && $_GET['c'] );
     101$force_gzip = ( $compress && 'gzip' == $_GET['c'] );
     102$rtl = ( isset($_GET['dir']) && 'rtl' == $_GET['dir'] );
    102103$expires_offset = 31536000;
    103104$out = '';
     
    127128header("Cache-Control: public, max-age=$expires_offset");
    128129   
    129 if ( $compress && ! ini_get('zlib.output_compression') && function_exists('gzencode') ) {
     130if ( $compress && ! ini_get('zlib.output_compression') ) {
    130131    header('Vary: Accept-Encoding'); // Handle proxies
    131     if ( false !== strpos( strtolower($_SERVER['HTTP_ACCEPT_ENCODING']), 'gzip') ) {
     132    if ( false !== strpos( strtolower($_SERVER['HTTP_ACCEPT_ENCODING']), 'deflate') && function_exists('gzdeflate') && ! $force_gzip ) {
     133        header('Content-Encoding: deflate');
     134        $out = gzdeflate( $out, 3 );
     135    } elseif ( false !== strpos( strtolower($_SERVER['HTTP_ACCEPT_ENCODING']), 'gzip') && function_exists('gzencode') ) {
    132136        header('Content-Encoding: gzip');
    133137        $out = gzencode( $out, 3 );
Note: See TracChangeset for help on using the changeset viewer.