mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-07-01 15:50:09 +00:00
Allow for the HTTP headers returned by WordPress to be filtered by a plugin. Fixes #9205 props filosofo.
git-svn-id: https://develop.svn.wordpress.org/trunk@10619 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
@@ -1459,6 +1459,27 @@ function status_header( $header ) {
|
||||
return @header( $status_header, true, $header );
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the header information to prevent caching.
|
||||
*
|
||||
* The several different headers cover the different ways cache prevention is handled
|
||||
* by different browsers
|
||||
*
|
||||
* @since 2.8
|
||||
*
|
||||
* @uses apply_filters()
|
||||
* @return array The associative array of header names and field values.
|
||||
*/
|
||||
function wp_get_nocache_headers() {
|
||||
$headers = array(
|
||||
'Expires' => 'Wed, 11 Jan 1984 05:00:00 GMT',
|
||||
'Last-Modified' => gmdate( 'D, d M Y H:i:s' ) . ' GMT',
|
||||
'Cache-Control' => 'no-cache, must-revalidate, max-age=0',
|
||||
'Pragma' => 'no-cache',
|
||||
);
|
||||
return apply_filters('nocache_headers', $headers);
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the headers to prevent caching for the different browsers.
|
||||
*
|
||||
@@ -1466,13 +1487,12 @@ function status_header( $header ) {
|
||||
* be sent so that all of them get the point that no caching should occur.
|
||||
*
|
||||
* @since 2.0.0
|
||||
* @uses wp_get_nocache_headers()
|
||||
*/
|
||||
function nocache_headers() {
|
||||
// why are these @-silenced when other header calls aren't?
|
||||
@header( 'Expires: Wed, 11 Jan 1984 05:00:00 GMT' );
|
||||
@header( 'Last-Modified: ' . gmdate( 'D, d M Y H:i:s' ) . ' GMT' );
|
||||
@header( 'Cache-Control: no-cache, must-revalidate, max-age=0' );
|
||||
@header( 'Pragma: no-cache' );
|
||||
$headers = wp_get_nocache_headers();
|
||||
foreach( (array) $headers as $name => $field_value )
|
||||
@header("{$name}: {$field_value}");
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user