Make WordPress Core

Changeset 11091


Ignore:
Timestamp:
04/26/2009 11:54:59 PM (15 years ago)
Author:
ryan
Message:

phpdoc udpates and error checks for http. Props DD32. fixes #8620

File:
1 edited

Legend:

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

    r10870 r11091  
    18991899 * @param string $url Site URL to retrieve.
    19001900 * @param array $args Optional. Override the defaults.
    1901  * @return WP_Error|string The body of the response or WP_Error on failure.
     1901 * @return WP_Error|array The response or WP_Error on failure.
    19021902 */
    19031903function wp_remote_request($url, $args = array()) {
     
    19151915 * @param string $url Site URL to retrieve.
    19161916 * @param array $args Optional. Override the defaults.
    1917  * @return WP_Error|string The body of the response or WP_Error on failure.
     1917 * @return WP_Error|array The response or WP_Error on failure.
    19181918 */
    19191919function wp_remote_get($url, $args = array()) {
     
    19311931 * @param string $url Site URL to retrieve.
    19321932 * @param array $args Optional. Override the defaults.
    1933  * @return WP_Error|string The body of the response or WP_Error on failure.
     1933 * @return WP_Error|array The response or WP_Error on failure.
    19341934 */
    19351935function wp_remote_post($url, $args = array()) {
     
    19471947 * @param string $url Site URL to retrieve.
    19481948 * @param array $args Optional. Override the defaults.
    1949  * @return WP_Error|string The body of the response or WP_Error on failure.
     1949 * @return WP_Error|array The response or WP_Error on failure.
    19501950 */
    19511951function wp_remote_head($url, $args = array()) {
     
    19631963 */
    19641964function wp_remote_retrieve_headers(&$response) {
    1965     if ( ! isset($response['headers']) || ! is_array($response['headers']))
     1965    if ( is_wp_error($response) || ! isset($response['headers']) || ! is_array($response['headers']))
    19661966        return array();
    19671967
     
    19761976 * @param array $response
    19771977 * @param string $header Header name to retrieve value from.
    1978  * @return array The header value. Empty string on if incorrect parameter given.
     1978 * @return string The header value. Empty string on if incorrect parameter given, or if the header doesnt exist.
    19791979 */
    19801980function wp_remote_retrieve_header(&$response, $header) {
    1981     if ( ! isset($response['headers']) || ! is_array($response['headers']))
     1981    if ( is_wp_error($response) || ! isset($response['headers']) || ! is_array($response['headers']))
    19821982        return '';
    19831983
     
    19961996 *
    19971997 * @param array $response HTTP response.
    1998  * @return array The keys 'code' and 'message' give information on the response.
     1998 * @return string the response code. Empty string on incorrect parameter given.
    19991999 */
    20002000function wp_remote_retrieve_response_code(&$response) {
    2001     if ( ! isset($response['response']) || ! is_array($response['response']))
     2001    if ( is_wp_error($response) ||! isset($response['response']) || ! is_array($response['response']))
    20022002        return '';
    20032003
     
    20132013 *
    20142014 * @param array $response HTTP response.
    2015  * @return array The keys 'code' and 'message' give information on the response.
     2015 * @return string The response message. Empty string on incorrect parameter given.
    20162016 */
    20172017function wp_remote_retrieve_response_message(&$response) {
    2018     if ( ! isset($response['response']) || ! is_array($response['response']))
     2018    if ( is_wp_error($response) || ! isset($response['response']) || ! is_array($response['response']))
    20192019        return '';
    20202020
     
    20312031 */
    20322032function wp_remote_retrieve_body(&$response) {
    2033     if ( ! isset($response['body']) )
     2033    if ( is_wp_error($response) || ! isset($response['body']) )
    20342034        return '';
    20352035
Note: See TracChangeset for help on using the changeset viewer.