~canonical-sysadmins/wordpress/4.8.1

« back to all changes in this revision

Viewing changes to wp-includes/http.php

  • Committer: Barry Price
  • Date: 2016-08-17 04:49:28 UTC
  • mto: This revision was merged to the branch mainline in revision 22.
  • Revision ID: barry.price@canonical.com-20160817044928-viijiwb4tl8jwzmp
new upstream release 4.6

Show diffs side-by-side

added added

removed removed

Lines of Context:
213
213
 * @return array The headers of the response. Empty array if incorrect parameter given.
214
214
 */
215
215
function wp_remote_retrieve_headers( $response ) {
216
 
        if ( is_wp_error($response) || ! isset($response['headers']) || ! is_array($response['headers']))
 
216
        if ( is_wp_error( $response ) || ! isset( $response['headers'] ) ) {
217
217
                return array();
 
218
        }
218
219
 
219
220
        return $response['headers'];
220
221
}
229
230
 * @return string The header value. Empty string on if incorrect parameter given, or if the header doesn't exist.
230
231
 */
231
232
function wp_remote_retrieve_header( $response, $header ) {
232
 
        if ( is_wp_error($response) || ! isset($response['headers']) || ! is_array($response['headers']))
 
233
        if ( is_wp_error( $response ) || ! isset( $response['headers'] ) ) {
233
234
                return '';
 
235
        }
234
236
 
235
 
        if ( array_key_exists($header, $response['headers']) )
 
237
        if ( isset( $response['headers'][ $header ] ) ) {
236
238
                return $response['headers'][$header];
 
239
        }
237
240
 
238
241
        return '';
239
242
}
578
581
/**
579
582
 * Whitelists allowed redirect hosts for safe HTTP requests as well.
580
583
 *
581
 
 * Attached to the http_request_host_is_external filter.
 
584
 * Attached to the {@see 'http_request_host_is_external'} filter.
582
585
 *
583
586
 * @since 3.6.0
584
587
 *
595
598
/**
596
599
 * Whitelists any domain in a multisite installation for safe HTTP requests.
597
600
 *
598
 
 * Attached to the http_request_host_is_external filter.
 
601
 * Attached to the {@see 'http_request_host_is_external'} filter.
599
602
 *
600
603
 * @since 3.6.0
601
604
 *