$options = array();
$options['redirection'] = 5;
+ $options['reject_unsafe_urls'] = true;
if ( false == $file_path )
$options['method'] = 'HEAD';
if ( !empty( $deprecated ) )
_deprecated_argument( __FUNCTION__, '2.7' );
- $response = wp_remote_head( $url );
+ $response = wp_remote_head( $url, array( 'reject_unsafe_urls' => true ) );
if ( is_wp_error( $response ) )
return false;
else
$frag = '';
- if ( 0 === stripos( 'http://', $uri ) ) {
+ if ( 0 === stripos( $uri, 'http://' ) ) {
$protocol = 'http://';
$uri = substr( $uri, 7 );
- } elseif ( 0 === stripos( 'https://', $uri ) ) {
+ } elseif ( 0 === stripos( $uri, 'https://' ) ) {
$protocol = 'https://';
$uri = substr( $uri, 8 );
} else {
$options = array();
$options['timeout'] = 10;
+ $options['reject_unsafe_urls'] = true;
$response = wp_remote_get( $uri, $options );
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',
);
if ( function_exists('apply_filters') ) {
$headers = (array) apply_filters('nocache_headers', $headers);
}
+ $headers['Last-Modified'] = false;
return $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' );
}
/**
// Allow plugin to filter the output error trigger
if ( WP_DEBUG && apply_filters( 'doing_it_wrong_trigger_error', true ) ) {
- $version = is_null( $version ) ? '' : sprintf( __( '(This message was added in version %s.)' ), $version );
- $message .= ' ' . __( 'Please see <a href="http://codex.wordpress.org/Debugging_in_WordPress">Debugging in WordPress</a> for more information.' );
- trigger_error( sprintf( __( '%1$s was called <strong>incorrectly</strong>. %2$s %3$s' ), $function, $message, $version ) );
+ if ( function_exists( '__' ) ) {
+ $version = is_null( $version ) ? '' : sprintf( __( '(This message was added in version %s.)' ), $version );
+ $message .= ' ' . __( 'Please see <a href="http://codex.wordpress.org/Debugging_in_WordPress">Debugging in WordPress</a> for more information.' );
+ trigger_error( sprintf( __( '%1$s was called <strong>incorrectly</strong>. %2$s %3$s' ), $function, $message, $version ) );
+ } else {
+ $version = is_null( $version ) ? '' : sprintf( '(This message was added in version %s.)', $version );
+ $message .= ' Please see <a href="http://codex.wordpress.org/Debugging_in_WordPress">Debugging in WordPress</a> for more information.';
+ trigger_error( sprintf( '%1$s was called <strong>incorrectly</strong>. %2$s %3$s', $function, $message, $version ) );
+ }
}
}