### Eclipse Workspace Patch 1.0
#P wordpress
|
|
|
1962 | 1962 | * @return array The headers of the response. Empty array if incorrect parameter given. |
1963 | 1963 | */ |
1964 | 1964 | function wp_remote_retrieve_headers(&$response) { |
1965 | | if ( is_wp_error($response) || ! isset($response['headers']) || ! is_array($response['headers'])) |
1966 | | return array(); |
1967 | | |
1968 | | return $response['headers']; |
| 1965 | return isset($response['headers']) ? ( is_array($response['headers']) ? $response['headers'] : array() ) : array(); |
1969 | 1966 | } |
1970 | 1967 | |
1971 | 1968 | /** |
… |
… |
|
1978 | 1975 | * @return string The header value. Empty string on if incorrect parameter given, or if the header doesnt exist. |
1979 | 1976 | */ |
1980 | 1977 | function wp_remote_retrieve_header(&$response, $header) { |
1981 | | if ( is_wp_error($response) || ! isset($response['headers']) || ! is_array($response['headers'])) |
1982 | | return ''; |
1983 | | |
1984 | | if ( array_key_exists($header, $response['headers']) ) |
1985 | | return $response['headers'][$header]; |
1986 | | |
1987 | | return ''; |
| 1978 | return isset($response['headers'][$header]) ? $response['headers'][$header] : ''; |
1988 | 1979 | } |
1989 | 1980 | |
1990 | 1981 | /** |
… |
… |
|
1997 | 1988 | * @param array $response HTTP response. |
1998 | 1989 | * @return string the response code. Empty string on incorrect parameter given. |
1999 | 1990 | */ |
2000 | | function wp_remote_retrieve_response_code(&$response) { |
2001 | | if ( is_wp_error($response) ||! isset($response['response']) || ! is_array($response['response'])) |
2002 | | return ''; |
2003 | | |
2004 | | return $response['response']['code']; |
| 1991 | function wp_remote_retrieve_response_code(&$response) { |
| 1992 | return isset($response['response']['code']) ? $response['response']['code'] : ''; |
2005 | 1993 | } |
2006 | 1994 | |
2007 | 1995 | /** |
… |
… |
|
2015 | 2003 | * @return string The response message. Empty string on incorrect parameter given. |
2016 | 2004 | */ |
2017 | 2005 | function wp_remote_retrieve_response_message(&$response) { |
2018 | | if ( is_wp_error($response) || ! isset($response['response']) || ! is_array($response['response'])) |
2019 | | return ''; |
2020 | | |
2021 | | return $response['response']['message']; |
| 2006 | return isset($response['response']['message']) ? $response['response']['message'] : ''; |
2022 | 2007 | } |
2023 | 2008 | |
2024 | 2009 | /** |
… |
… |
|
2030 | 2015 | * @return string The body of the response. Empty string if no body or incorrect parameter given. |
2031 | 2016 | */ |
2032 | 2017 | function wp_remote_retrieve_body(&$response) { |
2033 | | if ( is_wp_error($response) || ! isset($response['body']) ) |
2034 | | return ''; |
2035 | | |
2036 | | return $response['body']; |
| 2018 | return isset($response['body']) ? $response['body'] : ''; |
2037 | 2019 | } |
2038 | 2020 | |
2039 | 2021 | ?> |