Changeset 17928
- Timestamp:
- 05/14/2011 07:45:07 PM (13 years ago)
- Location:
- trunk
- Files:
-
- 11 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-admin/includes/dashboard.php
r17895 r17928 1209 1209 ); 1210 1210 1211 $r aw_response = wp_remote_post( 'http://api.wordpress.org/core/browse-happy/1.0/', $options );1212 1213 if ( is_wp_error( $r aw_response ) || 200 != $raw_response['response']['code'])1214 return ;1211 $response = wp_remote_post( 'http://api.wordpress.org/core/browse-happy/1.0/', $options ); 1212 1213 if ( is_wp_error( $response ) || 200 != wp_remote_retrieve_response_code( $response ) ) 1214 return false; 1215 1215 1216 1216 /** … … 1225 1225 * 'img_src_ssl' - string - An image (over SSL) representing the browser 1226 1226 */ 1227 $response = unserialize( $raw_response['body']);1227 $response = unserialize( wp_remote_retrieve_body( $response ) ); 1228 1228 1229 1229 if ( ! $response ) -
trunk/wp-admin/includes/file.php
r17749 r17928 491 491 } 492 492 493 if ( $response['response']['code'] != '200'){493 if ( 200 != wp_remote_retrieve_response_code( $response ) ){ 494 494 unlink( $tmpfname ); 495 return new WP_Error( 'http_404', trim( $response['response']['message']) );495 return new WP_Error( 'http_404', trim( wp_remote_retrieve_response_message( $response ) ) ); 496 496 } 497 497 -
trunk/wp-admin/includes/plugin-install.php
r16469 r17928 46 46 $res = new WP_Error('plugins_api_failed', __('An Unexpected HTTP Error occurred during the API request.'), $request->get_error_message() ); 47 47 } else { 48 $res = unserialize( $request['body']);48 $res = unserialize( wp_remote_retrieve_body( $request ) ); 49 49 if ( false === $res ) 50 $res = new WP_Error('plugins_api_failed', __('An unknown error occurred.'), $request['body']);50 $res = new WP_Error('plugins_api_failed', __('An unknown error occurred.'), wp_remote_retrieve_body( $request ) ); 51 51 } 52 52 } elseif ( !is_wp_error($res) ) { … … 368 368 } 369 369 add_action('install_plugins_pre_plugin-information', 'install_plugin_information'); 370 -
trunk/wp-admin/includes/schema.php
r17831 r17928 763 763 if ( is_wp_error( $page ) ) 764 764 $errstr = $page->get_error_message(); 765 elseif ( 200 == $page['response']['code'])765 elseif ( 200 == wp_remote_retrieve_response_code( $page ) ) 766 766 $vhost_ok = true; 767 767 -
trunk/wp-admin/includes/theme.php
r17633 r17928 397 397 $res = new WP_Error('themes_api_failed', __('An Unexpected HTTP Error occurred during the API request.'), $request->get_error_message() ); 398 398 } else { 399 $res = unserialize( $request['body']);399 $res = unserialize( wp_remote_retrieve_body( $request ) ); 400 400 if ( ! $res ) 401 $res = new WP_Error('themes_api_failed', __('An unknown error occurred.'), $request['body']);401 $res = new WP_Error('themes_api_failed', __('An unknown error occurred.'), wp_remote_retrieve_body( $request ) ); 402 402 } 403 403 } -
trunk/wp-includes/class-feed.php
r17771 r17928 81 81 $this->success = false; 82 82 } else { 83 $this->headers = $res['headers'];84 $this->body = $res['body'];85 $this->status_code = $res['response']['code'];83 $this->headers = wp_remote_retrieve_headers( $res ); 84 $this->body = wp_remote_retrieve_body( $res ); 85 $this->status_code = wp_remote_retrieve_response_code( $res ); 86 86 } 87 87 } else { -
trunk/wp-includes/class-wp-http-ixr-client.php
r17811 r17928 65 65 } 66 66 67 if ( $response['response']['code'] != 200) {68 $this->error = new IXR_Error(-32301, "transport error - HTTP status code was not 200 ({$response['response']['code']})");67 if ( 200 != wp_remote_retrieve_response_code( $response ) ) { 68 $this->error = new IXR_Error(-32301, 'transport error - HTTP status code was not 200 (' . wp_remote_retrieve_response_code( $response ) . ')'); 69 69 return false; 70 70 } 71 71 72 72 if ( $this->debug ) 73 echo '<pre class="ixr_response">' . htmlspecialchars( $response['body']) . "\n</pre>\n\n";73 echo '<pre class="ixr_response">' . htmlspecialchars( wp_remote_retrieve_body( $response ) ) . "\n</pre>\n\n"; 74 74 75 75 // Now parse what we've got back 76 $this->message = new IXR_Message( $response['body']);76 $this->message = new IXR_Message( wp_remote_retrieve_body( $response ) ); 77 77 if ( ! $this->message->parse() ) { 78 78 // XML error -
trunk/wp-includes/comment.php
r17795 r17928 1620 1620 return false; 1621 1621 1622 if ( isset( $response['headers']['x-pingback']) )1623 return $response['headers']['x-pingback'];1622 if ( wp_remote_retrieve_header( $response, 'x-pingback' ) ) 1623 return wp_remote_retrieve_header( $response, 'x-pingback' ); 1624 1624 1625 1625 // Not an (x)html, sgml, or xml page, no use going further. 1626 if ( isset( $response['headers']['content-type'] ) && preg_match('#(image|audio|video|model)/#is', $response['headers']['content-type']) )1626 if ( preg_match('#(image|audio|video|model)/#is', wp_remote_retrieve_header( $response, 'content-type' )) ) 1627 1627 return false; 1628 1628 … … 1633 1633 return false; 1634 1634 1635 $contents = $response['body'];1635 $contents = wp_remote_retrieve_body( $response ); 1636 1636 1637 1637 $pingback_link_offset_dquote = strpos($contents, $pingback_str_dquote); -
trunk/wp-includes/functions.php
r17841 r17928 601 601 wp_protect_special_option( $option ); 602 602 603 /* 603 /* 604 604 * FIXME the next two lines of code are not necessary and should be removed. 605 605 * @see http://core.trac.wordpress.org/ticket/13480 … … 1306 1306 1307 1307 $headers = wp_remote_retrieve_headers( $response ); 1308 $headers['response'] = $response['response']['code'];1308 $headers['response'] = wp_remote_retrieve_response_code( $response ); 1309 1309 1310 1310 // WP_HTTP no longer follows redirects for HEAD requests. … … 1321 1321 return $headers; 1322 1322 1323 fwrite( $out_fp, $response['body']);1323 fwrite( $out_fp, wp_remote_retrieve_body( $response ) ); 1324 1324 fclose($out_fp); 1325 1325 clearstatcache(); … … 1557 1557 return false; 1558 1558 1559 return $response['body'];1559 return wp_remote_retrieve_body( $response ); 1560 1560 } 1561 1561 … … 2877 2877 * @param string|array $args Optional arguements to control behaviour. 2878 2878 */ 2879 function _xmlrpc_wp_die_handler( $message, $title = '', $args = array() ) { 2879 function _xmlrpc_wp_die_handler( $message, $title = '', $args = array() ) { 2880 2880 global $wp_xmlrpc_server; 2881 2881 $defaults = array( 'response' => 500 ); … … 2883 2883 $r = wp_parse_args($args, $defaults); 2884 2884 2885 if ( $wp_xmlrpc_server ) { 2886 $error = new IXR_Error( $r['response'] , $message); 2887 $wp_xmlrpc_server->output( $error->getXml() ); 2885 if ( $wp_xmlrpc_server ) { 2886 $error = new IXR_Error( $r['response'] , $message); 2887 $wp_xmlrpc_server->output( $error->getXml() ); 2888 2888 } 2889 2889 die(); … … 2892 2892 /** 2893 2893 * Filter to enable special wp_die handler for xmlrpc requests. 2894 * 2894 * 2895 2895 * @since 3.2.0 2896 2896 * @access private 2897 2897 */ 2898 function _xmlrpc_wp_die_filter() { 2898 function _xmlrpc_wp_die_filter() { 2899 2899 return '_xmlrpc_wp_die_handler'; 2900 2900 } -
trunk/wp-includes/rss.php
r17071 r17928 556 556 // Also note, WP_HTTP lowercases all keys, Snoopy did not. 557 557 $return_headers = array(); 558 foreach ( $resp['headers']as $key => $value ) {558 foreach ( wp_remote_retrieve_headers( $resp ) as $key => $value ) { 559 559 if ( !is_array($value) ) { 560 560 $return_headers[] = "$key: $value"; … … 566 566 567 567 $response = new stdClass; 568 $response->status = $resp['response']['code'];569 $response->response_code = $resp['response']['code'];568 $response->status = wp_remote_retrieve_response_code( $resp ); 569 $response->response_code = wp_remote_retrieve_response_code( $resp ); 570 570 $response->headers = $return_headers; 571 $response->results = $resp['body'];571 $response->results = wp_remote_retrieve_body( $resp ); 572 572 573 573 return $response; -
trunk/wp-includes/update.php
r17619 r17928 72 72 $response = wp_remote_get($url, $options); 73 73 74 if ( is_wp_error( $response ) ) 75 return false; 76 77 if ( 200 != $response['response']['code'] ) 78 return false; 79 80 $body = trim( $response['body'] ); 74 if ( is_wp_error( $response ) || 200 != wp_remote_retrieve_response_code( $response ) ) 75 return false; 76 77 $body = trim( wp_remote_retrieve_body( $response ) ); 81 78 $body = str_replace(array("\r\n", "\r"), "\n", $body); 82 79 $new_options = array(); … … 176 173 $raw_response = wp_remote_post('http://api.wordpress.org/plugins/update-check/1.0/', $options); 177 174 178 if ( is_wp_error( $raw_response ) ) 179 return false; 180 181 if ( 200 != $raw_response['response']['code'] ) 182 return false; 183 184 $response = unserialize( $raw_response['body'] ); 175 if ( is_wp_error( $raw_response ) || 200 != wp_remote_retrieve_response_code( $raw_response ) ) 176 return false; 177 178 $response = unserialize( wp_remote_retrieve_body( $raw_response ) ); 185 179 186 180 if ( false !== $response ) … … 274 268 $raw_response = wp_remote_post( 'http://api.wordpress.org/themes/update-check/1.0/', $options ); 275 269 276 if ( is_wp_error( $raw_response ) ) 277 return false; 278 279 if ( 200 != $raw_response['response']['code'] ) 270 if ( is_wp_error( $raw_response ) || 200 != wp_remote_retrieve_response_code( $raw_response ) ) 280 271 return false; 281 272 … … 284 275 $new_update->checked = $checked; 285 276 286 $response = unserialize( $raw_response['body']);277 $response = unserialize( wp_remote_retrieve_body( $raw_response ) ); 287 278 if ( false !== $response ) 288 279 $new_update->response = $response;
Note: See TracChangeset
for help on using the changeset viewer.