Make WordPress Core

Ticket #28722: 28722.3.diff

File 28722.3.diff, 1.7 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..d23fc92 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 && false === strpos( $wp_version, '-' ) ) {
     37        header( 'HTTP/1.1 304 Not Modified' );
     38        exit();
     39}
     40
    3641foreach ( $load as $handle ) {
    3742        if ( !array_key_exists($handle, $wp_scripts->registered) )
    3843                continue;
    foreach ( $load as $handle ) { 
    4146        $out .= get_file($path) . "\n";
    4247}
    4348
     49header("Etag: $wp_version");
    4450header('Content-Type: application/javascript; charset=UTF-8');
    4551header('Expires: ' . gmdate( "D, d M Y H:i:s", time() + $expires_offset ) . ' GMT');
    4652header("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..e33eb46 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 && false === strpos( $wp_version, '-' ) ) {
     34        header( 'HTTP/1.1 304 Not Modified' );
     35        exit();
     36}
     37
    3338foreach ( $load as $handle ) {
    3439        if ( !array_key_exists($handle, $wp_styles->registered) )
    3540                continue;
    foreach ( $load as $handle ) { 
    5459        }
    5560}
    5661
     62header("Etag: $wp_version");
    5763header('Content-Type: text/css; charset=UTF-8');
    5864header('Expires: ' . gmdate( "D, d M Y H:i:s", time() + $expires_offset ) . ' GMT');
    5965header("Cache-Control: public, max-age=$expires_offset");