Make WordPress Core

Ticket #28722: 28722.6.diff

File 28722.6.diff, 2.0 KB (added by swissspidy, 9 years ago)
  • src/wp-admin/load-scripts.php

    diff --git src/wp-admin/load-scripts.php src/wp-admin/load-scripts.php
    index 4c7d40e..011ae3c 100644
    $out = ''; 
    3333$wp_scripts = new WP_Scripts();
    3434wp_default_scripts($wp_scripts);
    3535
     36if ( isset( $_SERVER['HTTP_IF_NONE_MATCH'] ) && stripslashes( $_SERVER['HTTP_IF_NONE_MATCH'] ) === $wp_version ) {
     37        $protocol = $_SERVER['SERVER_PROTOCOL'];
     38        if ( ! in_array( $protocol, array( 'HTTP/1.1', 'HTTP/2', 'HTTP/2.0' ) ) ) {
     39                $protocol = 'HTTP/1.0';
     40        }
     41        header( "$protocol 304 Not Modified" );
     42        exit();
     43}
     44
    3645foreach ( $load as $handle ) {
    3746        if ( !array_key_exists($handle, $wp_scripts->registered) )
    3847                continue;
    foreach ( $load as $handle ) { 
    4150        $out .= get_file($path) . "\n";
    4251}
    4352
     53header("Etag: $wp_version");
    4454header('Content-Type: application/javascript; charset=UTF-8');
    4555header('Expires: ' . gmdate( "D, d M Y H:i:s", time() + $expires_offset ) . ' GMT');
    4656header("Cache-Control: public, max-age=$expires_offset");
  • src/wp-admin/load-styles.php

    diff --git src/wp-admin/load-styles.php src/wp-admin/load-styles.php
    index 2563e6f..7d7d404 100644
    $out = ''; 
    3030$wp_styles = new WP_Styles();
    3131wp_default_styles($wp_styles);
    3232
     33if ( isset( $_SERVER['HTTP_IF_NONE_MATCH'] ) && stripslashes( $_SERVER['HTTP_IF_NONE_MATCH'] ) === $wp_version ) {
     34        $protocol = $_SERVER['SERVER_PROTOCOL'];
     35        if ( ! in_array( $protocol, array( 'HTTP/1.1', 'HTTP/2', 'HTTP/2.0' ) ) ) {
     36                $protocol = 'HTTP/1.0';
     37        }
     38        header( "$protocol 304 Not Modified" );
     39        exit();
     40}
     41
    3342foreach ( $load as $handle ) {
    3443        if ( !array_key_exists($handle, $wp_styles->registered) )
    3544                continue;
    foreach ( $load as $handle ) { 
    5463        }
    5564}
    5665
     66header("Etag: $wp_version");
    5767header('Content-Type: text/css; charset=UTF-8');
    5868header('Expires: ' . gmdate( "D, d M Y H:i:s", time() + $expires_offset ) . ' GMT');
    5969header("Cache-Control: public, max-age=$expires_offset");