### 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 | $sanitzed = (array) $response; |
| 1966 | if ( isset($sanitzed['headers']) && is_array($sanitzed['headers']) ) |
| 1967 | return $sanitzed['headers']; |
| 1968 | return array(); |
1969 | 1969 | } |
1970 | 1970 | |
1971 | 1971 | /** |
… |
… |
|
1978 | 1978 | * @return string The header value. Empty string on if incorrect parameter given, or if the header doesnt exist. |
1979 | 1979 | */ |
1980 | 1980 | 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 ''; |
| 1981 | $sanitzed = (array) $response; |
| 1982 | return isset($sanitzed['headers'][$header]) ? $sanitzed['headers'][$header] : ''; |
1988 | 1983 | } |
1989 | 1984 | |
1990 | 1985 | /** |
… |
… |
|
1998 | 1993 | * @return string the response code. Empty string on incorrect parameter given. |
1999 | 1994 | */ |
2000 | 1995 | 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']; |
| 1996 | $sanitzed = (array) $response; |
| 1997 | return isset($sanitzed['response']['code']) ? $sanitzed['response']['code'] : ''; |
2005 | 1998 | } |
2006 | 1999 | |
2007 | 2000 | /** |
… |
… |
|
2015 | 2008 | * @return string The response message. Empty string on incorrect parameter given. |
2016 | 2009 | */ |
2017 | 2010 | 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']; |
| 2011 | $sanitzed = (array) $response; |
| 2012 | return isset($sanitzed['response']['message']) ? $sanitzed['response']['message'] : ''; |
2022 | 2013 | } |
2023 | 2014 | |
2024 | 2015 | /** |
… |
… |
|
2030 | 2021 | * @return string The body of the response. Empty string if no body or incorrect parameter given. |
2031 | 2022 | */ |
2032 | 2023 | function wp_remote_retrieve_body(&$response) { |
2033 | | if ( is_wp_error($response) || ! isset($response['body']) ) |
2034 | | return ''; |
2035 | | |
2036 | | return $response['body']; |
| 2024 | $sanitzed = (array) $response; |
| 2025 | return isset($sanitzed['body']) ? $sanitzed['body'] : ''; |
2037 | 2026 | } |
2038 | 2027 | |
2039 | 2028 | ?> |