Changeset 10619
- Timestamp:
- 02/21/2009 09:39:06 PM (16 years ago)
- Location:
- trunk/wp-includes
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-includes/classes.php
r10573 r10619 303 303 */ 304 304 function send_headers() { 305 @header('X-Pingback: '. get_bloginfo('pingback_url')); 305 $headers = array('X-Pingback' => get_bloginfo('pingback_url')); 306 $status = null; 306 307 if ( is_user_logged_in() ) 307 nocache_headers();308 $headers = array_merge($headers, wp_get_nocache_headers()); 308 309 if ( !empty($this->query_vars['error']) && '404' == $this->query_vars['error'] ) { 309 status_header( 404 );310 $status = 404; 310 311 if ( !is_user_logged_in() ) 311 nocache_headers();312 @header('Content-Type: ' . get_option('html_type') . '; charset=' . get_option('blog_charset'));312 $headers = array_merge($headers, wp_get_nocache_headers()); 313 $headers['Content-Type'] = get_option('html_type') . '; charset=' . get_option('blog_charset'); 313 314 } else if ( empty($this->query_vars['feed']) ) { 314 @header('Content-Type: ' . get_option('html_type') . '; charset=' . get_option('blog_charset'));315 $headers['Content-Type'] = get_option('html_type') . '; charset=' . get_option('blog_charset'); 315 316 } else { 316 317 // We're showing a feed, so WP is indeed the only thing that last changed … … 330 331 $wp_last_modified = mysql2date('D, d M Y H:i:s', get_lastpostmodified('GMT'), 0).' GMT'; 331 332 $wp_etag = '"' . md5($wp_last_modified) . '"'; 332 @header("Last-Modified: $wp_last_modified");333 @header("ETag: $wp_etag");333 $headers['Last-Modified'] = $wp_last_modified; 334 $headers['ETag'] = $wp_etag; 334 335 335 336 // Support for Conditional GET … … 348 349 (($client_modified_timestamp >= $wp_modified_timestamp) && ($client_etag == $wp_etag)) : 349 350 (($client_modified_timestamp >= $wp_modified_timestamp) || ($client_etag == $wp_etag)) ) { 350 status_header( 304 );351 exit;351 $status = 304; 352 add_action('send_headers', 'exit', 1); 352 353 } 353 354 } 355 356 $headers = apply_filters('wp_headers', $headers, $this); 357 358 if ( ! empty( $status ) ) 359 status_header( $status ); 360 foreach( (array) $headers as $name => $field_value ) 361 @header("{$name}: {$field_value}"); 354 362 355 363 do_action_ref_array('send_headers', array(&$this)); -
trunk/wp-includes/functions.php
r10617 r10619 1461 1461 1462 1462 /** 1463 * Gets the header information to prevent caching. 1464 * 1465 * The several different headers cover the different ways cache prevention is handled 1466 * by different browsers 1467 * 1468 * @since 2.8 1469 * 1470 * @uses apply_filters() 1471 * @return array The associative array of header names and field values. 1472 */ 1473 function wp_get_nocache_headers() { 1474 $headers = array( 1475 'Expires' => 'Wed, 11 Jan 1984 05:00:00 GMT', 1476 'Last-Modified' => gmdate( 'D, d M Y H:i:s' ) . ' GMT', 1477 'Cache-Control' => 'no-cache, must-revalidate, max-age=0', 1478 'Pragma' => 'no-cache', 1479 ); 1480 return apply_filters('nocache_headers', $headers); 1481 } 1482 1483 /** 1463 1484 * Sets the headers to prevent caching for the different browsers. 1464 1485 * … … 1467 1488 * 1468 1489 * @since 2.0.0 1490 * @uses wp_get_nocache_headers() 1469 1491 */ 1470 1492 function nocache_headers() { 1471 // why are these @-silenced when other header calls aren't? 1472 @header( 'Expires: Wed, 11 Jan 1984 05:00:00 GMT' ); 1473 @header( 'Last-Modified: ' . gmdate( 'D, d M Y H:i:s' ) . ' GMT' ); 1474 @header( 'Cache-Control: no-cache, must-revalidate, max-age=0' ); 1475 @header( 'Pragma: no-cache' ); 1493 $headers = wp_get_nocache_headers(); 1494 foreach( (array) $headers as $name => $field_value ) 1495 @header("{$name}: {$field_value}"); 1476 1496 } 1477 1497
Note: See TracChangeset
for help on using the changeset viewer.