Changeset 42343 for trunk/src/wp-admin/load-styles.php
- Timestamp:
- 11/30/2017 11:09:33 PM (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-admin/load-styles.php
r38470 r42343 6 6 * Set this to error_reporting( -1 ) for debugging 7 7 */ 8 error_reporting( 0);8 error_reporting( 0 ); 9 9 10 10 /** Set ABSPATH for execution */ … … 26 26 $load = array_unique( explode( ',', $load ) ); 27 27 28 if ( empty( $load) )28 if ( empty( $load ) ) { 29 29 exit; 30 } 30 31 31 $compress = ( isset($_GET['c']) && $_GET['c'] );32 $force_gzip = ( $compress && 'gzip' == $_GET['c'] );33 $rtl = ( isset($_GET['dir']) && 'rtl' == $_GET['dir'] );32 $compress = ( isset( $_GET['c'] ) && $_GET['c'] ); 33 $force_gzip = ( $compress && 'gzip' == $_GET['c'] ); 34 $rtl = ( isset( $_GET['dir'] ) && 'rtl' == $_GET['dir'] ); 34 35 $expires_offset = 31536000; // 1 year 35 $out = '';36 $out = ''; 36 37 37 38 $wp_styles = new WP_Styles(); 38 wp_default_styles( $wp_styles);39 wp_default_styles( $wp_styles ); 39 40 40 41 if ( isset( $_SERVER['HTTP_IF_NONE_MATCH'] ) && stripslashes( $_SERVER['HTTP_IF_NONE_MATCH'] ) === $wp_version ) { … … 48 49 49 50 foreach ( $load as $handle ) { 50 if ( ! array_key_exists($handle, $wp_styles->registered) )51 if ( ! array_key_exists( $handle, $wp_styles->registered ) ) { 51 52 continue; 53 } 52 54 53 $style = $wp_styles->registered[ $handle];55 $style = $wp_styles->registered[ $handle ]; 54 56 55 57 if ( empty( $style->src ) ) { … … 70 72 $content = str_replace( '../js/tinymce/', '../' . WPINC . '/js/tinymce/', $content ); 71 73 $content = str_replace( '../fonts/', '../' . WPINC . '/fonts/', $content ); 72 $out .= $content;74 $out .= $content; 73 75 } else { 74 76 $out .= str_replace( '../images/', 'images/', $content ); … … 76 78 } 77 79 78 header( "Etag: $wp_version");79 header( 'Content-Type: text/css; charset=UTF-8');80 header( 'Expires: ' . gmdate( "D, d M Y H:i:s", time() + $expires_offset ) . ' GMT');81 header( "Cache-Control: public, max-age=$expires_offset");80 header( "Etag: $wp_version" ); 81 header( 'Content-Type: text/css; charset=UTF-8' ); 82 header( 'Expires: ' . gmdate( 'D, d M Y H:i:s', time() + $expires_offset ) . ' GMT' ); 83 header( "Cache-Control: public, max-age=$expires_offset" ); 82 84 83 if ( $compress && ! ini_get( 'zlib.output_compression') && 'ob_gzhandler' != ini_get('output_handler') && isset($_SERVER['HTTP_ACCEPT_ENCODING']) ) {84 header( 'Vary: Accept-Encoding'); // Handle proxies85 if ( false !== stripos( $_SERVER['HTTP_ACCEPT_ENCODING'], 'deflate') && function_exists('gzdeflate') && ! $force_gzip ) {86 header( 'Content-Encoding: deflate');85 if ( $compress && ! ini_get( 'zlib.output_compression' ) && 'ob_gzhandler' != ini_get( 'output_handler' ) && isset( $_SERVER['HTTP_ACCEPT_ENCODING'] ) ) { 86 header( 'Vary: Accept-Encoding' ); // Handle proxies 87 if ( false !== stripos( $_SERVER['HTTP_ACCEPT_ENCODING'], 'deflate' ) && function_exists( 'gzdeflate' ) && ! $force_gzip ) { 88 header( 'Content-Encoding: deflate' ); 87 89 $out = gzdeflate( $out, 3 ); 88 } elseif ( false !== stripos( $_SERVER['HTTP_ACCEPT_ENCODING'], 'gzip') && function_exists('gzencode') ) {89 header( 'Content-Encoding: gzip');90 } elseif ( false !== stripos( $_SERVER['HTTP_ACCEPT_ENCODING'], 'gzip' ) && function_exists( 'gzencode' ) ) { 91 header( 'Content-Encoding: gzip' ); 90 92 $out = gzencode( $out, 3 ); 91 93 }
Note: See TracChangeset
for help on using the changeset viewer.