]> scripts.mit.edu Git - autoinstalls/wordpress.git/blobdiff - wp-includes/functions.php
WordPress 3.5.1
[autoinstalls/wordpress.git] / wp-includes / functions.php
index a41d32fe97e193a1e3ff154719be7258641bf7c7..f4b4634b5a3b3b79ceeab3257c7a0932e01db57c 100644 (file)
@@ -902,7 +902,6 @@ function status_header( $header ) {
 function wp_get_nocache_headers() {
        $headers = array(
                'Expires' => 'Wed, 11 Jan 1984 05:00:00 GMT',
-               'Last-Modified' => '',
                'Cache-Control' => 'no-cache, must-revalidate, max-age=0',
                'Pragma' => 'no-cache',
        );
@@ -910,6 +909,7 @@ function wp_get_nocache_headers() {
        if ( function_exists('apply_filters') ) {
                $headers = (array) apply_filters('nocache_headers', $headers);
        }
+       $headers['Last-Modified'] = false;
        return $headers;
 }
 
@@ -924,10 +924,25 @@ function wp_get_nocache_headers() {
  */
 function nocache_headers() {
        $headers = wp_get_nocache_headers();
+
+       unset( $headers['Last-Modified'] );
+
+       // In PHP 5.3+, make sure we are not sending a Last-Modified header.
+       if ( function_exists( 'header_remove' ) ) {
+               @header_remove( 'Last-Modified' );
+       } else {
+               // In PHP 5.2, send an empty Last-Modified header, but only as a
+               // last resort to override a header already sent. #WP23021
+               foreach ( headers_list() as $header ) {
+                       if ( 0 === stripos( $header, 'Last-Modified' ) ) {
+                               $headers['Last-Modified'] = '';
+                               break;
+                       }
+               }
+       }
+
        foreach( $headers as $name => $field_value )
                @header("{$name}: {$field_value}");
-       if ( empty( $headers['Last-Modified'] ) && function_exists( 'header_remove' ) )
-               @header_remove( 'Last-Modified' );
 }
 
 /**