Make WordPress Core


Ignore:
Timestamp:
08/01/2008 05:45:13 AM (16 years ago)
Author:
ryan
Message:

Formatting and phpdoc cleanups from DD32. see #4779

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-includes/http.php

    r8516 r8518  
    55 * @package WordPress
    66 * @subpackage HTTP
    7  * @since {@internal Version Unknown}}
     7 * @since 2.7
    88 * @author Jacob Santos <wordpress@santosj.name>
    99 */
     
    1717 * @package WordPress
    1818 * @subpackage HTTP
    19  * @since {@internal Version Unknown}}
    20  */
    21 class WP_Http
    22 {
     19 * @since 2.7
     20 */
     21class WP_Http {
    2322
    2423    /**
    2524     * PHP4 style Constructor - Calls PHP5 Style Constructor
    2625     *
    27      * @since {@internal Version Unknown}}
     26     * @since 2.7
    2827     * @return WP_Http
    2928     */
    30     function WP_Http()
    31     {
     29    function WP_Http() {
    3230        $this->__construct();
    3331    }
     
    3634     * PHP5 style Constructor - Setup available transport if not available.
    3735     *
    38      * @since {@internal Version Unknown}}
     36     * @since 2.7
    3937     * @return WP_Http
    4038     */
    41     function __construct()
    42     {
     39    function __construct() {
    4340        WP_Http::_getTransport();
    4441    }
     
    5047     * that object to be used later.
    5148     *
    52      * @since {@internal Version Unknown}}
     49     * @since 2.7
    5350     * @access private
    5451     *
    5552     * @return object|null Null if no transports are available, HTTP transport object.
    5653     */
    57     function &_getTransport()
    58     {
     54    function &_getTransport() {
    5955        static $working_transport;
    6056
    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() )
    6359                $working_transport = new WP_Http_Streams();
    64             else if( true === WP_Http_ExtHttp::test() )
     60            else if ( true === WP_Http_ExtHttp::test() )
    6561                $working_transport = new WP_Http_ExtHttp();
    66             else if( true === WP_Http_Fopen::test() )
     62            else if ( true === WP_Http_Fopen::test() )
    6763                $working_transport = new WP_Http_Fopen();
    68             else if( true === WP_Http_Fsockopen::test() )
     64            else if ( true === WP_Http_Fsockopen::test() )
    6965                $working_transport = new WP_Http_Fsockopen();
    7066        }
     
    8278     * is addressed here.
    8379     *
    84      * @since {@internal Version Unknown}}
     80     * @since 2.7
    8581     * @access private
    8682     *
    8783     * @return object|null Null if no transports are available, HTTP transport object.
    8884     */
    89     function &_postTransport()
    90     {
     85    function &_postTransport() {
    9186        static $working_transport;
    9287
    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() )
    9590                $working_transport = new WP_Http_Streams();
    96             else if( true === WP_Http_ExtHttp::test() )
     91            else if ( true === WP_Http_ExtHttp::test() )
    9792                $working_transport = new WP_Http_ExtHttp();
    98             else if( true === WP_Http_Fsockopen::test() )
     93            else if ( true === WP_Http_Fsockopen::test() )
    9994                $working_transport = new WP_Http_Fsockopen();
    10095        }
     
    107102     *
    108103     * @access public
    109      * @since {@internal Version Unknown}}
     104     * @since 2.7
    110105     *
    111106     * @param string $url
     
    115110     * @return boolean
    116111     */
    117     function request($url, $args=array(), $headers=null, $body=null)
    118     {
     112    function request($url, $args = array(), $headers = null, $body = null) {
    119113        global $wp_version;
    120114
     
    127121        $r = wp_parse_args( $args, $defaults );
    128122
    129         if( !is_null($headers) && !is_array($headers) ) {
     123        if ( ! is_null($headers) && ! is_array($headers) ) {
    130124            $processedHeaders = WP_Http::processHeaders($headers);
    131125            $headers = $processedHeaders['headers'];
     
    134128        }
    135129
    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) )
    140134            $transport = WP_Http::_getTransport();
    141135        else
     
    151145     *
    152146     * @access public
    153      * @since {@internal Version Unknown}}
     147     * @since 2.7
    154148     *
    155149     * @param string $url The location of the site and page to retrieve.
     
    158152     * @return boolean
    159153     */
    160     function post($url, $args=array(), $headers=null, $body=null)
    161     {
     154    function post($url, $args = array(), $headers = null, $body = null) {
    162155        $defaults = array('method' => 'POST');
    163156        $r = wp_parse_args( $args, $defaults );
     
    171164     *
    172165     * @access public
    173      * @since {@internal Version Unknown}}
     166     * @since 2.7
    174167     *
    175168     * @param string|array $headers Optional. Either the header string or array of Header name and value pairs.
     
    177170     * @return boolean
    178171     */
    179     function get($url, $args=array(), $headers=null, $body=null)
    180     {
     172    function get($url, $args = array(), $headers = null, $body = null) {
    181173        $defaults = array('method' => 'GET');
    182174        $r = wp_parse_args( $args, $defaults );
     
    190182     *
    191183     * @access public
    192      * @since {@internal Version Unknown}}
     184     * @since 2.7
    193185     *
    194186     * @param string|array $headers Optional. Either the header string or array of Header name and value pairs.
     
    196188     * @return boolean
    197189     */
    198     function head($url, $args=array(), $headers=null, $body=null)
    199     {
     190    function head($url, $args = array(), $headers = null, $body = null) {
    200191        $defaults = array('method' => 'HEAD');
    201192        $r = wp_parse_args( $args, $defaults );
     
    208199     * @access public
    209200     * @static
    210      * @since {@internal Version Unknown}}
     201     * @since 2.7
    211202     *
    212203     * @param string $strResponse The full response string
    213204     * @return array Array with 'headers' and 'body' keys.
    214205     */
    215     function processResponse($strResponse)
    216     {
     206    function processResponse($strResponse) {
    217207        list($theHeaders, $theBody) = explode("\r\n\r\n", $strResponse, 2);
    218208        return array('headers' => $theHeaders, 'body' => $theBody);
     
    224214     * @access public
    225215     * @static
    226      * @since {@internal Version Unknown}}
     216     * @since 2.7
    227217     *
    228218     * @param array $response Array with code and message keys
    229219     * @return bool True if 40x Response, false if something else.
    230220     */
    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 )
    234223            return true;
    235224        return false;
     
    241230     * @access public
    242231     * @static
    243      * @since {@internal Version Unknown}}
     232     * @since 2.7
    244233     *
    245234     * @param array $headers Array with headers
    246235     * @return bool True if Location header is found.
    247236     */
    248     function isRedirect($headers)
    249     {
    250         if( isset($headers['location']) )
     237    function isRedirect($headers) {
     238        if ( isset($headers['location']) )
    251239            return true;
    252240        return false;
     
    260248     * @access public
    261249     * @static
    262      * @since {@internal Version Unknown}}
     250     * @since 2.7
    263251     *
    264252     * @param string|array $headers
    265253     * @return array
    266254     */
    267     function processHeaders($headers)
    268     {
    269         if( is_array($headers) )
     255    function processHeaders($headers) {
     256        if ( is_array($headers) )
    270257            return $headers;
    271258
     
    276263        $newheaders = array();
    277264        foreach($headers as $tempheader) {
    278             if( empty($tempheader) )
     265            if ( empty($tempheader) )
    279266                continue;
    280267
    281             if( false === strpos($tempheader, ':') ) {
    282                 list( , $iResponseCode, $strResponseMsg) = explode(" ", $tempheader, 3);
     268            if ( false === strpos($tempheader, ':') ) {
     269                list( , $iResponseCode, $strResponseMsg) = explode(' ', $tempheader, 3);
    283270                $response['code'] = $iResponseCode;
    284271                $response['message'] = $strResponseMsg;
     
    286273            }
    287274
    288             list($key, $value) = explode(":", $tempheader, 2);
    289 
    290             if( !empty($value) )
     275            list($key, $value) = explode(':', $tempheader, 2);
     276
     277            if ( ! empty($value) )
    291278                $newheaders[strtolower($key)] = trim($value);
    292279        }
     
    303290 * @package WordPress
    304291 * @subpackage HTTP
    305  * @since {@internal Version Unknown}}
    306  */
    307 class WP_Http_Fsockopen
    308 {
     292 * @since 2.7
     293 */
     294class WP_Http_Fsockopen {
    309295    /**
    310296     * Retrieve the location and set the class properties after the site has been retrieved.
    311297     *
    312      * @since {@internal Version Unknown}}
     298     * @since 2.7
    313299     * @access public
    314300     * @param string $url
     
    318304     * @return boolean
    319305     */
    320     function request($url, $args=array(), $headers=null, $body=null)
    321     {
     306    function request($url, $args = array(), $headers = null, $body = null) {
    322307        $defaults = array(
    323308            'method' => 'GET', 'timeout' => 3,
     
    334319        $secure_transport = false;
    335320
    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'];
    339324                $arrURL['port'] = apply_filters('http_request_default_port', 443);
    340325                $secure_transport = true;
     
    346331            $arrURL['port'] = apply_filters('http_request_port', $arrURL['port']);
    347332
    348         if( true === $secure_transport )
     333        if ( true === $secure_transport )
    349334            $error_reporting = error_reporting(0);
    350335
    351336        $handle = fsockopen($arrURL['host'], $arrURL['port'], $iError, $strError, apply_filters('http_request_timeout', absint($r['timeout']) ) );
    352337
    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);
    355340        }
    356341
     
    359344
    360345        $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) ) {
    365350            foreach( (array) $this->getHeaders() as $header => $headerValue)
    366                 $strHeaders .= $header.': '.$headerValue."\r\n";
     351                $strHeaders .= $header . ': ' . $headerValue . "\r\n";
    367352        } else
    368353            $strHeaders .= $header;
     
    370355        $strHeaders .= "\r\n";
    371356
    372         if( !is_null($body) )
     357        if ( ! is_null($body) )
    373358            $strHeaders .= $body;
    374359
     
    376361
    377362        $strResponse = '';
    378         while( !feof($handle) ) {
     363        while ( ! feof($handle) )
    379364            $strResponse .= fread($handle, 4096);
    380         }
     365
    381366        fclose($handle);
    382367
    383         if( true === $secure_transport )
     368        if ( true === $secure_transport )
    384369            error_reporting($error_reporting);
    385370
     
    387372        $arrHeaders = WP_Http::processHeaders($process['headers']);
    388373
    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 )
    394379                return $this->request($arrHeaders['headers']['location'], $r, $headers, $body);
    395             } else
     380            else
    396381                return new WP_Error('http_request_failed', __('Too many redirects.'));
    397382        }
     
    403388     * Whether this class can be used for retrieving an URL.
    404389     *
    405      * @since {@internal Version Unknown}}
     390     * @since 2.7
    406391     * @static
    407392     * @return boolean False means this class can not be used, true means it can.
    408393     */
    409     function test()
    410     {
    411         if( function_exists( 'fsockopen' ) )
     394    function test() {
     395        if ( function_exists( 'fsockopen' ) )
    412396            return true;
    413397
     
    427411 * @package WordPress
    428412 * @subpackage HTTP
    429  * @since {@internal Version Unknown}}
    430  */
    431 class WP_Http_Fopen
    432 {
     413 * @since 2.7
     414 */
     415class WP_Http_Fopen {
    433416    /**
    434417     * Retrieve the location and set the class properties after the site has been retrieved.
    435418     *
    436419     * @access public
    437      * @since {@internal Version Unknown}}
     420     * @since 2.7
    438421     *
    439422     * @param string $url
     
    443426     * @return boolean
    444427     */
    445     function request($url, $args=array(), $headers=null, $body=null)
    446     {
     428    function request($url, $args = array(), $headers = null, $body = null) {
    447429        global $http_response_header;
    448430
     
    456438        $arrURL = parse_url($url);
    457439
    458         if( 'http' != $arrURL['scheme'] || 'https' != $arrURL['scheme'] )
     440        if ( 'http' != $arrURL['scheme'] || 'https' != $arrURL['scheme'] )
    459441            $url = str_replace($arrURL['scheme'], 'http', $url);
    460442
    461443        $handle = fopen($url, 'rb');
    462444
    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') )
    467449            stream_set_timeout($handle, apply_filters('http_request_timeout', $r['timeout']) );
    468450
    469451        $strResponse = '';
    470         while(!feof($handle)) {
     452        while ( ! feof($handle) )
    471453            $strResponse .= fread($handle, 4096);
    472         }
    473454
    474455        $theHeaders = '';
    475         if( function_exists('stream_get_meta_data') ) {
     456        if ( function_exists('stream_get_meta_data') ) {
    476457            $meta = stream_get_meta_data($handle);
    477458            $theHeaders = $meta['wrapper_data'];
     
    491472     * @return boolean False means this class can not be used, true means it can.
    492473     */
    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')) )
    496476            return false;
    497477
     
    510490 * @package WordPress
    511491 * @subpackage HTTP
    512  * @since {@internal Version Unknown}}
    513  */
    514 class WP_Http_Streams
    515 {
     492 * @since 2.7
     493 */
     494class WP_Http_Streams {
    516495    /**
    517496     * Retrieve the location and set the class properties after the site has been retrieved.
    518497     *
    519498     * @access public
    520      * @since {@internal Version Unknown}}
     499     * @since 2.7
    521500     *
    522501     * @param string $url
     
    526505     * @return boolean
    527506     */
    528     function request($url, $args=array(), $headers=null, $body=null)
    529     {
     507    function request($url, $args = array(), $headers = null, $body = null) {
    530508        $defaults = array(
    531509            'method' => 'GET', 'timeout' => 3,
     
    537515        $arrURL = parse_url($url);
    538516
    539         if( 'http' != $arrURL['scheme'] || 'https' != $arrURL['scheme'] )
     517        if ( 'http' != $arrURL['scheme'] || 'https' != $arrURL['scheme'] )
    540518            $url = str_replace($arrURL['scheme'], 'http', $url);
    541519
     
    550528        );
    551529
    552         if( !is_null($body) )
     530        if ( ! is_null($body) )
    553531            $arrContext['http']['content'] = $body;
    554532
     
    559537        stream_set_timeout($handle, apply_filters('http_request_stream_timeout', $this->timeout) );
    560538
    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));
    563541
    564542        $strResponse = stream_get_contents($handle);
     
    576554     * @static
    577555     * @access public
    578      * @since {@internal Version Unknown}}
     556     * @since 2.7
    579557     *
    580558     * @return boolean False means this class can not be used, true means it can.
    581559     */
    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')) )
    585562            return false;
    586563
    587         if( version_compare(PHP_VERSION, '5.0', '<') )
     564        if ( version_compare(PHP_VERSION, '5.0', '<') )
    588565            return false;
    589566
     
    601578 * @package WordPress
    602579 * @subpackage HTTP
    603  * @since {@internal Version Unknown}}
    604  */
    605 class WP_Http_ExtHTTP
    606 {
     580 * @since 2.7
     581 */
     582class WP_Http_ExtHTTP {
    607583    /**
    608584     * Retrieve the location and set the class properties after the site has been retrieved.
    609585     *
    610586     * @access public
    611      * @since {@internal Version Unknown}}
     587     * @since 2.7
    612588     *
    613589     * @param string $url
     
    617593     * @return boolean
    618594     */
    619     function request($url, $args=array(), $headers=null, $body=null)
    620     {
     595    function request($url, $args = array(), $headers = null, $body = null) {
    621596        global $wp_version;
    622597
     
    624599            'method' => 'GET', 'timeout' => 3,
    625600            '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)
    627602        );
    628603
    629604        $r = wp_parse_args( $args, $defaults );
    630605
    631         if( isset($headers['User-Agent']) )
     606        if ( isset($headers['User-Agent']) )
    632607            unset($headers['User-Agent']);
    633608
    634         switch($r['method'])
    635         {
     609        switch ( $r['method'] ) {
    636610            case 'GET':
    637611                $r['method'] = HTTP_METH_GET;
     
    649623        $arrURL = parse_url($url);
    650624
    651         if( 'http' != $arrURL['scheme'] || 'https' != $arrURL['scheme'] )
     625        if ( 'http' != $arrURL['scheme'] || 'https' != $arrURL['scheme'] )
    652626            $url = str_replace($arrURL['scheme'], 'http', $url);
    653627
     
    662636        $strResponse = http_request($r['method'], $url, $body, $options, $info);
    663637
    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']);
    666640
    667641        list($theHeaders, $theBody) = explode("\r\n\r\n", $strResponse, 2);
     
    679653     *
    680654     * @static
    681      * @since {@internal Version Unknown}}
     655     * @since 2.7
    682656     *
    683657     * @return boolean False means this class can not be used, true means it can.
    684658     */
    685     function test()
    686     {
    687         if( function_exists('http_request') )
     659    function test() {
     660        if ( function_exists('http_request') )
    688661            return true;
    689662
     
    695668 * Returns the initialized WP_Http Object
    696669 *
    697  * @since {@internal Version Unknown}}
     670 * @since 2.7
    698671 * @access private
    699672 *
     
    703676    static $http;
    704677
    705     if( is_null($http) )
     678    if ( is_null($http) )
    706679        $http = new WP_Http();
    707680
     
    734707 * functions to abstract out the above convoluted setup.
    735708 *
    736  * @since {@internal Version Unknown}}
     709 * @since 2.7
    737710 *
    738711 * @param string $url Site URL to retrieve.
     
    742715 * @return string The body of the response
    743716 */
    744 function wp_remote_request($url, $args=array(), $headers=null, $body=null) {
     717function wp_remote_request($url, $args = array(), $headers = null, $body = null) {
    745718    $objFetchSite = _wp_http_get_object();
    746719
     
    753726 * @see wp_remote_request() For more information on the response array format.
    754727 *
    755  * @since {@internal Version Unknown}}
     728 * @since 2.7
    756729 *
    757730 * @param string $url Site URL to retrieve.
     
    761734 * @return string The body of the response
    762735 */
    763 function wp_remote_get($url, $args=array(), $headers=null, $body=null) {
     736function wp_remote_get($url, $args = array(), $headers = null, $body = null) {
    764737    $objFetchSite = _wp_http_get_object();
    765738
     
    772745 * @see wp_remote_request() For more information on the response array format.
    773746 *
    774  * @since {@internal Version Unknown}}
     747 * @since 2.7
    775748 *
    776749 * @param string $url Site URL to retrieve.
     
    780753 * @return string The body of the response
    781754 */
    782 function wp_remote_post($url, $args=array(), $headers=null, $body=null) {
     755function wp_remote_post($url, $args = array(), $headers = null, $body = null) {
    783756    $objFetchSite = _wp_http_get_object();
    784757
     
    791764 * @see wp_remote_request() For more information on the response array format.
    792765 *
    793  * @since {@internal Version Unknown}}
     766 * @since 2.7
    794767 *
    795768 * @param string $url Site URL to retrieve.
     
    799772 * @return string The body of the response
    800773 */
    801 function wp_remote_head($url, $args=array(), $headers=null, $body=null) {
     774function wp_remote_head($url, $args = array(), $headers = null, $body = null) {
    802775    $objFetchSite = _wp_http_get_object();
    803776
     
    808781 * Retrieve only the headers from the raw response.
    809782 *
    810  * @since {@internal Version Unknown}}
     783 * @since 2.7
    811784 *
    812785 * @param array $response HTTP response.
     
    814787 */
    815788function wp_remote_retrieve_headers(&$response) {
    816     if( !isset($response['headers']) || !is_array($response['headers']))
     789    if ( ! isset($response['headers']) || ! is_array($response['headers']))
    817790        return array();
    818791
     
    823796 * Retrieve a single header by name from the raw response.
    824797 *
    825  * @since {@internal Version Unknown}}
     798 * @since 2.7
    826799 *
    827800 * @param array $response
     
    830803 */
    831804function wp_remote_retrieve_header(&$response, $header) {
    832     if( !isset($response['headers']) || !is_array($response['headers']))
     805    if ( ! isset($response['headers']) || ! is_array($response['headers']))
    833806        return '';
    834807
    835     if( array_key_exists($header, $response['headers']) )
     808    if ( array_key_exists($header, $response['headers']) )
    836809        return $response['headers'][$header];
    837810
     
    844817 * Will return an empty array if incorrect parameter value is given.
    845818 *
    846  * @since {@internal Version Unknown}}
     819 * @since 2.7
    847820 *
    848821 * @param array $response HTTP response.
     
    850823 */
    851824function wp_remote_retrieve_response_code(&$response) {
    852     if( !isset($response['response']) || !is_array($response['response']))
     825    if ( ! isset($response['response']) || ! is_array($response['response']))
    853826        return '';
    854827
     
    861834 * Will return an empty array if incorrect parameter value is given.
    862835 *
    863  * @since {@internal Version Unknown}}
     836 * @since 2.7
    864837 *
    865838 * @param array $response HTTP response.
     
    867840 */
    868841function wp_remote_retrieve_response_message(&$response) {
    869     if( !isset($response['response']) || !is_array($response['response']))
     842    if ( ! isset($response['response']) || ! is_array($response['response']))
    870843        return '';
    871844
     
    876849 * Retrieve only the body from the raw response.
    877850 *
    878  * @since {@internal Version Unknown}}
     851 * @since 2.7
    879852 *
    880853 * @param array $response HTTP response.
     
    882855 */
    883856function wp_remote_retrieve_body(&$response) {
    884     if( !isset($response['body']) )
     857    if ( ! isset($response['body']) )
    885858        return '';
    886859
Note: See TracChangeset for help on using the changeset viewer.