Use wp_remote_retrieve_* helper functions instead of the raw HTTP response array. props aaroncampbell, fixes #17416.

git-svn-id: https://develop.svn.wordpress.org/trunk@17928 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Andrew Nacin
2011-05-14 19:45:07 +00:00
parent ecf9b19fea
commit 02e8db225f
11 changed files with 44 additions and 54 deletions

View File

@@ -600,7 +600,7 @@ function add_option( $option, $value = '', $deprecated = '', $autoload = 'yes' )
wp_protect_special_option( $option );
/*
/*
* FIXME the next two lines of code are not necessary and should be removed.
* @see http://core.trac.wordpress.org/ticket/13480
*/
@@ -1305,7 +1305,7 @@ function wp_get_http( $url, $file_path = false, $red = 1 ) {
return false;
$headers = wp_remote_retrieve_headers( $response );
$headers['response'] = $response['response']['code'];
$headers['response'] = wp_remote_retrieve_response_code( $response );
// WP_HTTP no longer follows redirects for HEAD requests.
if ( 'HEAD' == $options['method'] && in_array($headers['response'], array(301, 302)) && isset( $headers['location'] ) ) {
@@ -1320,7 +1320,7 @@ function wp_get_http( $url, $file_path = false, $red = 1 ) {
if ( !$out_fp )
return $headers;
fwrite( $out_fp, $response['body']);
fwrite( $out_fp, wp_remote_retrieve_body( $response ) );
fclose($out_fp);
clearstatcache();
@@ -1556,7 +1556,7 @@ function wp_remote_fopen( $uri ) {
if ( is_wp_error( $response ) )
return false;
return $response['body'];
return wp_remote_retrieve_body( $response );
}
/**
@@ -2876,26 +2876,26 @@ if ( 'rtl' == $text_direction ) : ?>
* @param string $title Error title.
* @param string|array $args Optional arguements to control behaviour.
*/
function _xmlrpc_wp_die_handler( $message, $title = '', $args = array() ) {
function _xmlrpc_wp_die_handler( $message, $title = '', $args = array() ) {
global $wp_xmlrpc_server;
$defaults = array( 'response' => 500 );
$r = wp_parse_args($args, $defaults);
if ( $wp_xmlrpc_server ) {
$error = new IXR_Error( $r['response'] , $message);
$wp_xmlrpc_server->output( $error->getXml() );
if ( $wp_xmlrpc_server ) {
$error = new IXR_Error( $r['response'] , $message);
$wp_xmlrpc_server->output( $error->getXml() );
}
die();
}
/**
* Filter to enable special wp_die handler for xmlrpc requests.
*
*
* @since 3.2.0
* @access private
*/
function _xmlrpc_wp_die_filter() {
function _xmlrpc_wp_die_filter() {
return '_xmlrpc_wp_die_handler';
}