diff --git a/wp-includes/functions.php b/wp-includes/functions.php
index 30fac47..6835ddf 100644
|
a
|
b
|
function do_enclose( $content, $post_ID ) { |
| 580 | 580 | function wp_get_http( $url, $file_path = false, $red = 1 ) { |
| 581 | 581 | @set_time_limit( 60 ); |
| 582 | 582 | |
| 583 | | if ( $red > 5 ) |
| 584 | | return false; |
| | 583 | _deprecated_function( 'wp_get_http', '4.4', 'wp_safe_remote_request' ); |
| 585 | 584 | |
| 586 | 585 | $options = array(); |
| 587 | 586 | $options['redirection'] = 5; |
| … |
… |
function wp_get_http( $url, $file_path = false, $red = 1 ) { |
| 591 | 590 | else |
| 592 | 591 | $options['method'] = 'GET'; |
| 593 | 592 | |
| | 593 | // Stream directly to a file |
| | 594 | if ( ! empty( $file_path ) ) { |
| | 595 | $options['stream'] = true; |
| | 596 | $options['filename'] = $file_path; |
| | 597 | } |
| | 598 | |
| 594 | 599 | $response = wp_safe_remote_request( $url, $options ); |
| 595 | 600 | |
| 596 | 601 | if ( is_wp_error( $response ) ) |
| … |
… |
function wp_get_http( $url, $file_path = false, $red = 1 ) { |
| 598 | 603 | |
| 599 | 604 | $headers = wp_remote_retrieve_headers( $response ); |
| 600 | 605 | $headers['response'] = wp_remote_retrieve_response_code( $response ); |
| 601 | | |
| 602 | | // WP_HTTP no longer follows redirects for HEAD requests. |
| 603 | | if ( 'HEAD' == $options['method'] && in_array($headers['response'], array(301, 302)) && isset( $headers['location'] ) ) { |
| 604 | | return wp_get_http( $headers['location'], $file_path, ++$red ); |
| 605 | | } |
| 606 | | |
| 607 | | if ( false == $file_path ) |
| 608 | | return $headers; |
| 609 | | |
| 610 | | // GET request - write it to the supplied filename |
| 611 | | $out_fp = fopen($file_path, 'w'); |
| 612 | | if ( !$out_fp ) |
| 613 | | return $headers; |
| 614 | | |
| 615 | | fwrite( $out_fp, wp_remote_retrieve_body( $response ) ); |
| 616 | | fclose($out_fp); |
| 617 | | clearstatcache(); |
| 618 | | |
| 619 | 606 | return $headers; |
| 620 | 607 | } |
| 621 | 608 | |