Changeset 8518 for trunk/wp-includes/http.php
- Timestamp:
- 08/01/2008 05:45:13 AM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-includes/http.php
r8516 r8518 5 5 * @package WordPress 6 6 * @subpackage HTTP 7 * @since {@internal Version Unknown}}7 * @since 2.7 8 8 * @author Jacob Santos <wordpress@santosj.name> 9 9 */ … … 17 17 * @package WordPress 18 18 * @subpackage HTTP 19 * @since {@internal Version Unknown}} 20 */ 21 class WP_Http 22 { 19 * @since 2.7 20 */ 21 class WP_Http { 23 22 24 23 /** 25 24 * PHP4 style Constructor - Calls PHP5 Style Constructor 26 25 * 27 * @since {@internal Version Unknown}}26 * @since 2.7 28 27 * @return WP_Http 29 28 */ 30 function WP_Http() 31 { 29 function WP_Http() { 32 30 $this->__construct(); 33 31 } … … 36 34 * PHP5 style Constructor - Setup available transport if not available. 37 35 * 38 * @since {@internal Version Unknown}}36 * @since 2.7 39 37 * @return WP_Http 40 38 */ 41 function __construct() 42 { 39 function __construct() { 43 40 WP_Http::_getTransport(); 44 41 } … … 50 47 * that object to be used later. 51 48 * 52 * @since {@internal Version Unknown}}49 * @since 2.7 53 50 * @access private 54 51 * 55 52 * @return object|null Null if no transports are available, HTTP transport object. 56 53 */ 57 function &_getTransport() 58 { 54 function &_getTransport() { 59 55 static $working_transport; 60 56 61 if ( is_null($working_transport) ) {62 if ( true === WP_Http_Streams::test() )57 if ( is_null($working_transport) ) { 58 if ( true === WP_Http_Streams::test() ) 63 59 $working_transport = new WP_Http_Streams(); 64 else if ( true ===WP_Http_ExtHttp::test() )60 else if ( true === WP_Http_ExtHttp::test() ) 65 61 $working_transport = new WP_Http_ExtHttp(); 66 else if ( true === WP_Http_Fopen::test() )62 else if ( true === WP_Http_Fopen::test() ) 67 63 $working_transport = new WP_Http_Fopen(); 68 else if ( true === WP_Http_Fsockopen::test() )64 else if ( true === WP_Http_Fsockopen::test() ) 69 65 $working_transport = new WP_Http_Fsockopen(); 70 66 } … … 82 78 * is addressed here. 83 79 * 84 * @since {@internal Version Unknown}}80 * @since 2.7 85 81 * @access private 86 82 * 87 83 * @return object|null Null if no transports are available, HTTP transport object. 88 84 */ 89 function &_postTransport() 90 { 85 function &_postTransport() { 91 86 static $working_transport; 92 87 93 if ( is_null($working_transport) ) {94 if ( true === WP_Http_Streams::test() )88 if ( is_null($working_transport) ) { 89 if ( true === WP_Http_Streams::test() ) 95 90 $working_transport = new WP_Http_Streams(); 96 else if ( true ===WP_Http_ExtHttp::test() )91 else if ( true === WP_Http_ExtHttp::test() ) 97 92 $working_transport = new WP_Http_ExtHttp(); 98 else if ( true === WP_Http_Fsockopen::test() )93 else if ( true === WP_Http_Fsockopen::test() ) 99 94 $working_transport = new WP_Http_Fsockopen(); 100 95 } … … 107 102 * 108 103 * @access public 109 * @since {@internal Version Unknown}}104 * @since 2.7 110 105 * 111 106 * @param string $url … … 115 110 * @return boolean 116 111 */ 117 function request($url, $args=array(), $headers=null, $body=null) 118 { 112 function request($url, $args = array(), $headers = null, $body = null) { 119 113 global $wp_version; 120 114 … … 127 121 $r = wp_parse_args( $args, $defaults ); 128 122 129 if ( !is_null($headers) && !is_array($headers) ) {123 if ( ! is_null($headers) && ! is_array($headers) ) { 130 124 $processedHeaders = WP_Http::processHeaders($headers); 131 125 $headers = $processedHeaders['headers']; … … 134 128 } 135 129 136 if ( !isset($headers['user-agent']) || !isset($headers['User-Agent']) )137 $headers['user-agent'] = apply_filters('http_headers_useragent', 'WordPress/' .$wp_version );138 139 if ( is_null($body) )130 if ( ! isset($headers['user-agent']) || ! isset($headers['User-Agent']) ) 131 $headers['user-agent'] = apply_filters('http_headers_useragent', 'WordPress/' . $wp_version ); 132 133 if ( is_null($body) ) 140 134 $transport = WP_Http::_getTransport(); 141 135 else … … 151 145 * 152 146 * @access public 153 * @since {@internal Version Unknown}}147 * @since 2.7 154 148 * 155 149 * @param string $url The location of the site and page to retrieve. … … 158 152 * @return boolean 159 153 */ 160 function post($url, $args=array(), $headers=null, $body=null) 161 { 154 function post($url, $args = array(), $headers = null, $body = null) { 162 155 $defaults = array('method' => 'POST'); 163 156 $r = wp_parse_args( $args, $defaults ); … … 171 164 * 172 165 * @access public 173 * @since {@internal Version Unknown}}166 * @since 2.7 174 167 * 175 168 * @param string|array $headers Optional. Either the header string or array of Header name and value pairs. … … 177 170 * @return boolean 178 171 */ 179 function get($url, $args=array(), $headers=null, $body=null) 180 { 172 function get($url, $args = array(), $headers = null, $body = null) { 181 173 $defaults = array('method' => 'GET'); 182 174 $r = wp_parse_args( $args, $defaults ); … … 190 182 * 191 183 * @access public 192 * @since {@internal Version Unknown}}184 * @since 2.7 193 185 * 194 186 * @param string|array $headers Optional. Either the header string or array of Header name and value pairs. … … 196 188 * @return boolean 197 189 */ 198 function head($url, $args=array(), $headers=null, $body=null) 199 { 190 function head($url, $args = array(), $headers = null, $body = null) { 200 191 $defaults = array('method' => 'HEAD'); 201 192 $r = wp_parse_args( $args, $defaults ); … … 208 199 * @access public 209 200 * @static 210 * @since {@internal Version Unknown}}201 * @since 2.7 211 202 * 212 203 * @param string $strResponse The full response string 213 204 * @return array Array with 'headers' and 'body' keys. 214 205 */ 215 function processResponse($strResponse) 216 { 206 function processResponse($strResponse) { 217 207 list($theHeaders, $theBody) = explode("\r\n\r\n", $strResponse, 2); 218 208 return array('headers' => $theHeaders, 'body' => $theBody); … … 224 214 * @access public 225 215 * @static 226 * @since {@internal Version Unknown}}216 * @since 2.7 227 217 * 228 218 * @param array $response Array with code and message keys 229 219 * @return bool True if 40x Response, false if something else. 230 220 */ 231 function is400Response($response) 232 { 233 if( (int) substr($response, 0, 1) == 4 ) 221 function is400Response($response) { 222 if ( (int) substr($response, 0, 1) == 4 ) 234 223 return true; 235 224 return false; … … 241 230 * @access public 242 231 * @static 243 * @since {@internal Version Unknown}}232 * @since 2.7 244 233 * 245 234 * @param array $headers Array with headers 246 235 * @return bool True if Location header is found. 247 236 */ 248 function isRedirect($headers) 249 { 250 if( isset($headers['location']) ) 237 function isRedirect($headers) { 238 if ( isset($headers['location']) ) 251 239 return true; 252 240 return false; … … 260 248 * @access public 261 249 * @static 262 * @since {@internal Version Unknown}}250 * @since 2.7 263 251 * 264 252 * @param string|array $headers 265 253 * @return array 266 254 */ 267 function processHeaders($headers) 268 { 269 if( is_array($headers) ) 255 function processHeaders($headers) { 256 if ( is_array($headers) ) 270 257 return $headers; 271 258 … … 276 263 $newheaders = array(); 277 264 foreach($headers as $tempheader) { 278 if ( empty($tempheader) )265 if ( empty($tempheader) ) 279 266 continue; 280 267 281 if ( false === strpos($tempheader, ':') ) {282 list( , $iResponseCode, $strResponseMsg) = explode( " ", $tempheader, 3);268 if ( false === strpos($tempheader, ':') ) { 269 list( , $iResponseCode, $strResponseMsg) = explode(' ', $tempheader, 3); 283 270 $response['code'] = $iResponseCode; 284 271 $response['message'] = $strResponseMsg; … … 286 273 } 287 274 288 list($key, $value) = explode( ":", $tempheader, 2);289 290 if ( !empty($value) )275 list($key, $value) = explode(':', $tempheader, 2); 276 277 if ( ! empty($value) ) 291 278 $newheaders[strtolower($key)] = trim($value); 292 279 } … … 303 290 * @package WordPress 304 291 * @subpackage HTTP 305 * @since {@internal Version Unknown}} 306 */ 307 class WP_Http_Fsockopen 308 { 292 * @since 2.7 293 */ 294 class WP_Http_Fsockopen { 309 295 /** 310 296 * Retrieve the location and set the class properties after the site has been retrieved. 311 297 * 312 * @since {@internal Version Unknown}}298 * @since 2.7 313 299 * @access public 314 300 * @param string $url … … 318 304 * @return boolean 319 305 */ 320 function request($url, $args=array(), $headers=null, $body=null) 321 { 306 function request($url, $args = array(), $headers = null, $body = null) { 322 307 $defaults = array( 323 308 'method' => 'GET', 'timeout' => 3, … … 334 319 $secure_transport = false; 335 320 336 if ( !isset($arrURL['port']) ) {337 if ( (($arrURL['scheme'] == 'ssl' || $arrURL['scheme'] == 'https')) && extension_loaded('openssl') ) {338 $arrURL['host'] = 'ssl://' .$arrURL['host'];321 if ( ! isset($arrURL['port']) ) { 322 if ( ($arrURL['scheme'] == 'ssl' || $arrURL['scheme'] == 'https') && extension_loaded('openssl') ) { 323 $arrURL['host'] = 'ssl://' . $arrURL['host']; 339 324 $arrURL['port'] = apply_filters('http_request_default_port', 443); 340 325 $secure_transport = true; … … 346 331 $arrURL['port'] = apply_filters('http_request_port', $arrURL['port']); 347 332 348 if ( true === $secure_transport )333 if ( true === $secure_transport ) 349 334 $error_reporting = error_reporting(0); 350 335 351 336 $handle = fsockopen($arrURL['host'], $arrURL['port'], $iError, $strError, apply_filters('http_request_timeout', absint($r['timeout']) ) ); 352 337 353 if ( false === $handle ) {354 return new WP_Error('http_request_failed', $iError .': '.$strError);338 if ( false === $handle ) { 339 return new WP_Error('http_request_failed', $iError . ': ' . $strError); 355 340 } 356 341 … … 359 344 360 345 $strHeaders = ''; 361 $strHeaders .= strtoupper($r['method']) .' '.$requestPath.' HTTP/'.$r['httpversion']."\r\n";362 $strHeaders .= 'Host: ' .$arrURL['host']."\r\n";363 364 if ( is_array($header) ) {346 $strHeaders .= strtoupper($r['method']) . ' ' . $requestPath . ' HTTP/' . $r['httpversion'] . "\r\n"; 347 $strHeaders .= 'Host: ' . $arrURL['host'] . "\r\n"; 348 349 if ( is_array($header) ) { 365 350 foreach( (array) $this->getHeaders() as $header => $headerValue) 366 $strHeaders .= $header .': '.$headerValue."\r\n";351 $strHeaders .= $header . ': ' . $headerValue . "\r\n"; 367 352 } else 368 353 $strHeaders .= $header; … … 370 355 $strHeaders .= "\r\n"; 371 356 372 if ( !is_null($body) )357 if ( ! is_null($body) ) 373 358 $strHeaders .= $body; 374 359 … … 376 361 377 362 $strResponse = ''; 378 while ( !feof($handle) ) {363 while ( ! feof($handle) ) 379 364 $strResponse .= fread($handle, 4096); 380 } 365 381 366 fclose($handle); 382 367 383 if ( true === $secure_transport )368 if ( true === $secure_transport ) 384 369 error_reporting($error_reporting); 385 370 … … 387 372 $arrHeaders = WP_Http::processHeaders($process['headers']); 388 373 389 if ( WP_Http::is400Response($arrHeaders['response']) )390 return new WP_Error('http_request_failed', $arrHeaders['response']['code'] . ': '. $arrHeaders['response']['message']);391 392 if ( isset($arrHeaders['headers']['location']) ) {393 if ( $r['redirection']-- > 0 ) {374 if ( WP_Http::is400Response($arrHeaders['response']) ) 375 return new WP_Error('http_request_failed', $arrHeaders['response']['code'] . ': ' . $arrHeaders['response']['message']); 376 377 if ( isset($arrHeaders['headers']['location']) ) { 378 if ( $r['redirection']-- > 0 ) 394 379 return $this->request($arrHeaders['headers']['location'], $r, $headers, $body); 395 }else380 else 396 381 return new WP_Error('http_request_failed', __('Too many redirects.')); 397 382 } … … 403 388 * Whether this class can be used for retrieving an URL. 404 389 * 405 * @since {@internal Version Unknown}}390 * @since 2.7 406 391 * @static 407 392 * @return boolean False means this class can not be used, true means it can. 408 393 */ 409 function test() 410 { 411 if( function_exists( 'fsockopen' ) ) 394 function test() { 395 if ( function_exists( 'fsockopen' ) ) 412 396 return true; 413 397 … … 427 411 * @package WordPress 428 412 * @subpackage HTTP 429 * @since {@internal Version Unknown}} 430 */ 431 class WP_Http_Fopen 432 { 413 * @since 2.7 414 */ 415 class WP_Http_Fopen { 433 416 /** 434 417 * Retrieve the location and set the class properties after the site has been retrieved. 435 418 * 436 419 * @access public 437 * @since {@internal Version Unknown}}420 * @since 2.7 438 421 * 439 422 * @param string $url … … 443 426 * @return boolean 444 427 */ 445 function request($url, $args=array(), $headers=null, $body=null) 446 { 428 function request($url, $args = array(), $headers = null, $body = null) { 447 429 global $http_response_header; 448 430 … … 456 438 $arrURL = parse_url($url); 457 439 458 if ( 'http' != $arrURL['scheme'] || 'https' != $arrURL['scheme'] )440 if ( 'http' != $arrURL['scheme'] || 'https' != $arrURL['scheme'] ) 459 441 $url = str_replace($arrURL['scheme'], 'http', $url); 460 442 461 443 $handle = fopen($url, 'rb'); 462 444 463 if (!$handle)464 return new WP_Error('http_request_failed', sprintf(__( "Could not open handle for fopen() to %s"), $url));465 466 if ( function_exists('stream_set_timeout') )445 if (! $handle) 446 return new WP_Error('http_request_failed', sprintf(__('Could not open handle for fopen() to %s'), $url)); 447 448 if ( function_exists('stream_set_timeout') ) 467 449 stream_set_timeout($handle, apply_filters('http_request_timeout', $r['timeout']) ); 468 450 469 451 $strResponse = ''; 470 while (!feof($handle)) {452 while ( ! feof($handle) ) 471 453 $strResponse .= fread($handle, 4096); 472 }473 454 474 455 $theHeaders = ''; 475 if ( function_exists('stream_get_meta_data') ) {456 if ( function_exists('stream_get_meta_data') ) { 476 457 $meta = stream_get_meta_data($handle); 477 458 $theHeaders = $meta['wrapper_data']; … … 491 472 * @return boolean False means this class can not be used, true means it can. 492 473 */ 493 function test() 494 { 495 if( !function_exists('fopen') || (function_exists('ini_get') && true != ini_get('allow_url_fopen')) ) 474 function test() { 475 if ( ! function_exists('fopen') || (function_exists('ini_get') && true != ini_get('allow_url_fopen')) ) 496 476 return false; 497 477 … … 510 490 * @package WordPress 511 491 * @subpackage HTTP 512 * @since {@internal Version Unknown}} 513 */ 514 class WP_Http_Streams 515 { 492 * @since 2.7 493 */ 494 class WP_Http_Streams { 516 495 /** 517 496 * Retrieve the location and set the class properties after the site has been retrieved. 518 497 * 519 498 * @access public 520 * @since {@internal Version Unknown}}499 * @since 2.7 521 500 * 522 501 * @param string $url … … 526 505 * @return boolean 527 506 */ 528 function request($url, $args=array(), $headers=null, $body=null) 529 { 507 function request($url, $args = array(), $headers = null, $body = null) { 530 508 $defaults = array( 531 509 'method' => 'GET', 'timeout' => 3, … … 537 515 $arrURL = parse_url($url); 538 516 539 if ( 'http' != $arrURL['scheme'] || 'https' != $arrURL['scheme'] )517 if ( 'http' != $arrURL['scheme'] || 'https' != $arrURL['scheme'] ) 540 518 $url = str_replace($arrURL['scheme'], 'http', $url); 541 519 … … 550 528 ); 551 529 552 if ( !is_null($body) )530 if ( ! is_null($body) ) 553 531 $arrContext['http']['content'] = $body; 554 532 … … 559 537 stream_set_timeout($handle, apply_filters('http_request_stream_timeout', $this->timeout) ); 560 538 561 if (!$handle)562 return new WP_Error('http_request_failed', sprintf(__( "Could not open handle for fopen() to %s"), $url));539 if (! $handle) 540 return new WP_Error('http_request_failed', sprintf(__('Could not open handle for fopen() to %s'), $url)); 563 541 564 542 $strResponse = stream_get_contents($handle); … … 576 554 * @static 577 555 * @access public 578 * @since {@internal Version Unknown}}556 * @since 2.7 579 557 * 580 558 * @return boolean False means this class can not be used, true means it can. 581 559 */ 582 function test() 583 { 584 if( !function_exists('fopen') || (function_exists('ini_get') && true != ini_get('allow_url_fopen')) ) 560 function test() { 561 if ( ! function_exists('fopen') || (function_exists('ini_get') && true != ini_get('allow_url_fopen')) ) 585 562 return false; 586 563 587 if ( version_compare(PHP_VERSION, '5.0', '<') )564 if ( version_compare(PHP_VERSION, '5.0', '<') ) 588 565 return false; 589 566 … … 601 578 * @package WordPress 602 579 * @subpackage HTTP 603 * @since {@internal Version Unknown}} 604 */ 605 class WP_Http_ExtHTTP 606 { 580 * @since 2.7 581 */ 582 class WP_Http_ExtHTTP { 607 583 /** 608 584 * Retrieve the location and set the class properties after the site has been retrieved. 609 585 * 610 586 * @access public 611 * @since {@internal Version Unknown}}587 * @since 2.7 612 588 * 613 589 * @param string $url … … 617 593 * @return boolean 618 594 */ 619 function request($url, $args=array(), $headers=null, $body=null) 620 { 595 function request($url, $args = array(), $headers = null, $body = null) { 621 596 global $wp_version; 622 597 … … 624 599 'method' => 'GET', 'timeout' => 3, 625 600 'redirection' => 5, 'httpversion' => '1.0', 626 'user_agent' => apply_filters('http_headers_useragent', 'WordPress/' .$wp_version)601 'user_agent' => apply_filters('http_headers_useragent', 'WordPress/' . $wp_version) 627 602 ); 628 603 629 604 $r = wp_parse_args( $args, $defaults ); 630 605 631 if ( isset($headers['User-Agent']) )606 if ( isset($headers['User-Agent']) ) 632 607 unset($headers['User-Agent']); 633 608 634 switch($r['method']) 635 { 609 switch ( $r['method'] ) { 636 610 case 'GET': 637 611 $r['method'] = HTTP_METH_GET; … … 649 623 $arrURL = parse_url($url); 650 624 651 if ( 'http' != $arrURL['scheme'] || 'https' != $arrURL['scheme'] )625 if ( 'http' != $arrURL['scheme'] || 'https' != $arrURL['scheme'] ) 652 626 $url = str_replace($arrURL['scheme'], 'http', $url); 653 627 … … 662 636 $strResponse = http_request($r['method'], $url, $body, $options, $info); 663 637 664 if ( false === $strResponse )665 return new WP_Error('http_request_failed', $info['response_code'] . ': '. $info['error']);638 if ( false === $strResponse ) 639 return new WP_Error('http_request_failed', $info['response_code'] . ': ' . $info['error']); 666 640 667 641 list($theHeaders, $theBody) = explode("\r\n\r\n", $strResponse, 2); … … 679 653 * 680 654 * @static 681 * @since {@internal Version Unknown}}655 * @since 2.7 682 656 * 683 657 * @return boolean False means this class can not be used, true means it can. 684 658 */ 685 function test() 686 { 687 if( function_exists('http_request') ) 659 function test() { 660 if ( function_exists('http_request') ) 688 661 return true; 689 662 … … 695 668 * Returns the initialized WP_Http Object 696 669 * 697 * @since {@internal Version Unknown}}670 * @since 2.7 698 671 * @access private 699 672 * … … 703 676 static $http; 704 677 705 if ( is_null($http) )678 if ( is_null($http) ) 706 679 $http = new WP_Http(); 707 680 … … 734 707 * functions to abstract out the above convoluted setup. 735 708 * 736 * @since {@internal Version Unknown}}709 * @since 2.7 737 710 * 738 711 * @param string $url Site URL to retrieve. … … 742 715 * @return string The body of the response 743 716 */ 744 function wp_remote_request($url, $args =array(), $headers=null, $body=null) {717 function wp_remote_request($url, $args = array(), $headers = null, $body = null) { 745 718 $objFetchSite = _wp_http_get_object(); 746 719 … … 753 726 * @see wp_remote_request() For more information on the response array format. 754 727 * 755 * @since {@internal Version Unknown}}728 * @since 2.7 756 729 * 757 730 * @param string $url Site URL to retrieve. … … 761 734 * @return string The body of the response 762 735 */ 763 function wp_remote_get($url, $args =array(), $headers=null, $body=null) {736 function wp_remote_get($url, $args = array(), $headers = null, $body = null) { 764 737 $objFetchSite = _wp_http_get_object(); 765 738 … … 772 745 * @see wp_remote_request() For more information on the response array format. 773 746 * 774 * @since {@internal Version Unknown}}747 * @since 2.7 775 748 * 776 749 * @param string $url Site URL to retrieve. … … 780 753 * @return string The body of the response 781 754 */ 782 function wp_remote_post($url, $args =array(), $headers=null, $body=null) {755 function wp_remote_post($url, $args = array(), $headers = null, $body = null) { 783 756 $objFetchSite = _wp_http_get_object(); 784 757 … … 791 764 * @see wp_remote_request() For more information on the response array format. 792 765 * 793 * @since {@internal Version Unknown}}766 * @since 2.7 794 767 * 795 768 * @param string $url Site URL to retrieve. … … 799 772 * @return string The body of the response 800 773 */ 801 function wp_remote_head($url, $args =array(), $headers=null, $body=null) {774 function wp_remote_head($url, $args = array(), $headers = null, $body = null) { 802 775 $objFetchSite = _wp_http_get_object(); 803 776 … … 808 781 * Retrieve only the headers from the raw response. 809 782 * 810 * @since {@internal Version Unknown}}783 * @since 2.7 811 784 * 812 785 * @param array $response HTTP response. … … 814 787 */ 815 788 function wp_remote_retrieve_headers(&$response) { 816 if ( !isset($response['headers']) || !is_array($response['headers']))789 if ( ! isset($response['headers']) || ! is_array($response['headers'])) 817 790 return array(); 818 791 … … 823 796 * Retrieve a single header by name from the raw response. 824 797 * 825 * @since {@internal Version Unknown}}798 * @since 2.7 826 799 * 827 800 * @param array $response … … 830 803 */ 831 804 function wp_remote_retrieve_header(&$response, $header) { 832 if ( !isset($response['headers']) || !is_array($response['headers']))805 if ( ! isset($response['headers']) || ! is_array($response['headers'])) 833 806 return ''; 834 807 835 if ( array_key_exists($header, $response['headers']) )808 if ( array_key_exists($header, $response['headers']) ) 836 809 return $response['headers'][$header]; 837 810 … … 844 817 * Will return an empty array if incorrect parameter value is given. 845 818 * 846 * @since {@internal Version Unknown}}819 * @since 2.7 847 820 * 848 821 * @param array $response HTTP response. … … 850 823 */ 851 824 function wp_remote_retrieve_response_code(&$response) { 852 if ( !isset($response['response']) || !is_array($response['response']))825 if ( ! isset($response['response']) || ! is_array($response['response'])) 853 826 return ''; 854 827 … … 861 834 * Will return an empty array if incorrect parameter value is given. 862 835 * 863 * @since {@internal Version Unknown}}836 * @since 2.7 864 837 * 865 838 * @param array $response HTTP response. … … 867 840 */ 868 841 function wp_remote_retrieve_response_message(&$response) { 869 if ( !isset($response['response']) || !is_array($response['response']))842 if ( ! isset($response['response']) || ! is_array($response['response'])) 870 843 return ''; 871 844 … … 876 849 * Retrieve only the body from the raw response. 877 850 * 878 * @since {@internal Version Unknown}}851 * @since 2.7 879 852 * 880 853 * @param array $response HTTP response. … … 882 855 */ 883 856 function wp_remote_retrieve_body(&$response) { 884 if ( !isset($response['body']) )857 if ( ! isset($response['body']) ) 885 858 return ''; 886 859
Note: See TracChangeset
for help on using the changeset viewer.