mirror of
https://github.com/WordPress/WordPress.git
synced 2025-01-09 18:08:09 +01:00
phpdoc udpates and error checks for http. Props DD32. fixes #8620
git-svn-id: http://svn.automattic.com/wordpress/trunk@11091 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
15588b4080
commit
f2f9eafc26
@ -1898,7 +1898,7 @@ function &_wp_http_get_object() {
|
|||||||
*
|
*
|
||||||
* @param string $url Site URL to retrieve.
|
* @param string $url Site URL to retrieve.
|
||||||
* @param array $args Optional. Override the defaults.
|
* @param array $args Optional. Override the defaults.
|
||||||
* @return WP_Error|string The body of the response or WP_Error on failure.
|
* @return WP_Error|array The response or WP_Error on failure.
|
||||||
*/
|
*/
|
||||||
function wp_remote_request($url, $args = array()) {
|
function wp_remote_request($url, $args = array()) {
|
||||||
$objFetchSite = _wp_http_get_object();
|
$objFetchSite = _wp_http_get_object();
|
||||||
@ -1914,7 +1914,7 @@ function wp_remote_request($url, $args = array()) {
|
|||||||
*
|
*
|
||||||
* @param string $url Site URL to retrieve.
|
* @param string $url Site URL to retrieve.
|
||||||
* @param array $args Optional. Override the defaults.
|
* @param array $args Optional. Override the defaults.
|
||||||
* @return WP_Error|string The body of the response or WP_Error on failure.
|
* @return WP_Error|array The response or WP_Error on failure.
|
||||||
*/
|
*/
|
||||||
function wp_remote_get($url, $args = array()) {
|
function wp_remote_get($url, $args = array()) {
|
||||||
$objFetchSite = _wp_http_get_object();
|
$objFetchSite = _wp_http_get_object();
|
||||||
@ -1930,7 +1930,7 @@ function wp_remote_get($url, $args = array()) {
|
|||||||
*
|
*
|
||||||
* @param string $url Site URL to retrieve.
|
* @param string $url Site URL to retrieve.
|
||||||
* @param array $args Optional. Override the defaults.
|
* @param array $args Optional. Override the defaults.
|
||||||
* @return WP_Error|string The body of the response or WP_Error on failure.
|
* @return WP_Error|array The response or WP_Error on failure.
|
||||||
*/
|
*/
|
||||||
function wp_remote_post($url, $args = array()) {
|
function wp_remote_post($url, $args = array()) {
|
||||||
$objFetchSite = _wp_http_get_object();
|
$objFetchSite = _wp_http_get_object();
|
||||||
@ -1946,7 +1946,7 @@ function wp_remote_post($url, $args = array()) {
|
|||||||
*
|
*
|
||||||
* @param string $url Site URL to retrieve.
|
* @param string $url Site URL to retrieve.
|
||||||
* @param array $args Optional. Override the defaults.
|
* @param array $args Optional. Override the defaults.
|
||||||
* @return WP_Error|string The body of the response or WP_Error on failure.
|
* @return WP_Error|array The response or WP_Error on failure.
|
||||||
*/
|
*/
|
||||||
function wp_remote_head($url, $args = array()) {
|
function wp_remote_head($url, $args = array()) {
|
||||||
$objFetchSite = _wp_http_get_object();
|
$objFetchSite = _wp_http_get_object();
|
||||||
@ -1962,7 +1962,7 @@ function wp_remote_head($url, $args = array()) {
|
|||||||
* @return array The headers of the response. Empty array if incorrect parameter given.
|
* @return array The headers of the response. Empty array if incorrect parameter given.
|
||||||
*/
|
*/
|
||||||
function wp_remote_retrieve_headers(&$response) {
|
function wp_remote_retrieve_headers(&$response) {
|
||||||
if ( ! isset($response['headers']) || ! is_array($response['headers']))
|
if ( is_wp_error($response) || ! isset($response['headers']) || ! is_array($response['headers']))
|
||||||
return array();
|
return array();
|
||||||
|
|
||||||
return $response['headers'];
|
return $response['headers'];
|
||||||
@ -1975,10 +1975,10 @@ function wp_remote_retrieve_headers(&$response) {
|
|||||||
*
|
*
|
||||||
* @param array $response
|
* @param array $response
|
||||||
* @param string $header Header name to retrieve value from.
|
* @param string $header Header name to retrieve value from.
|
||||||
* @return array The header value. Empty string on if incorrect parameter given.
|
* @return string The header value. Empty string on if incorrect parameter given, or if the header doesnt exist.
|
||||||
*/
|
*/
|
||||||
function wp_remote_retrieve_header(&$response, $header) {
|
function wp_remote_retrieve_header(&$response, $header) {
|
||||||
if ( ! isset($response['headers']) || ! is_array($response['headers']))
|
if ( is_wp_error($response) || ! isset($response['headers']) || ! is_array($response['headers']))
|
||||||
return '';
|
return '';
|
||||||
|
|
||||||
if ( array_key_exists($header, $response['headers']) )
|
if ( array_key_exists($header, $response['headers']) )
|
||||||
@ -1995,10 +1995,10 @@ function wp_remote_retrieve_header(&$response, $header) {
|
|||||||
* @since 2.7.0
|
* @since 2.7.0
|
||||||
*
|
*
|
||||||
* @param array $response HTTP response.
|
* @param array $response HTTP response.
|
||||||
* @return array The keys 'code' and 'message' give information on the response.
|
* @return string the response code. Empty string on incorrect parameter given.
|
||||||
*/
|
*/
|
||||||
function wp_remote_retrieve_response_code(&$response) {
|
function wp_remote_retrieve_response_code(&$response) {
|
||||||
if ( ! isset($response['response']) || ! is_array($response['response']))
|
if ( is_wp_error($response) ||! isset($response['response']) || ! is_array($response['response']))
|
||||||
return '';
|
return '';
|
||||||
|
|
||||||
return $response['response']['code'];
|
return $response['response']['code'];
|
||||||
@ -2012,10 +2012,10 @@ function wp_remote_retrieve_response_code(&$response) {
|
|||||||
* @since 2.7.0
|
* @since 2.7.0
|
||||||
*
|
*
|
||||||
* @param array $response HTTP response.
|
* @param array $response HTTP response.
|
||||||
* @return array The keys 'code' and 'message' give information on the response.
|
* @return string The response message. Empty string on incorrect parameter given.
|
||||||
*/
|
*/
|
||||||
function wp_remote_retrieve_response_message(&$response) {
|
function wp_remote_retrieve_response_message(&$response) {
|
||||||
if ( ! isset($response['response']) || ! is_array($response['response']))
|
if ( is_wp_error($response) || ! isset($response['response']) || ! is_array($response['response']))
|
||||||
return '';
|
return '';
|
||||||
|
|
||||||
return $response['response']['message'];
|
return $response['response']['message'];
|
||||||
@ -2030,7 +2030,7 @@ function wp_remote_retrieve_response_message(&$response) {
|
|||||||
* @return string The body of the response. Empty string if no body or incorrect parameter given.
|
* @return string The body of the response. Empty string if no body or incorrect parameter given.
|
||||||
*/
|
*/
|
||||||
function wp_remote_retrieve_body(&$response) {
|
function wp_remote_retrieve_body(&$response) {
|
||||||
if ( ! isset($response['body']) )
|
if ( is_wp_error($response) || ! isset($response['body']) )
|
||||||
return '';
|
return '';
|
||||||
|
|
||||||
return $response['body'];
|
return $response['body'];
|
||||||
|
Loading…
Reference in New Issue
Block a user