Changeset 35369 for trunk/src/wp-includes/class-http.php
- Timestamp:
- 10/23/2015 05:53:05 AM (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/class-http.php
r34585 r35369 689 689 * A wrapper for PHP's parse_url() function that handles edgecases in < PHP 5.4.7 690 690 * 691 * PHP 5.4.7 expanded parse_url()'s ability to handle non-absolute url's, including692 * schemeless and relative url's with :// in the path, this works around those693 * limitations providing a standard output on PHP 5.2~5.4+.694 *695 * Error suppression is used as prior to PHP 5.3.3, an E_WARNING would be generated696 * when URL parsing failed.697 *698 * @since 4.1.0699 *700 * @static701 691 * @access protected 692 * @deprecated 4.4.0 See wp_parse_url() 702 693 * 703 694 * @param string $url The URL to parse. … … 706 697 */ 707 698 protected static function parse_url( $url ) { 708 $parts = @parse_url( $url ); 709 if ( ! $parts ) { 710 // < PHP 5.4.7 compat, trouble with relative paths including a scheme break in the path 711 if ( '/' == $url[0] && false !== strpos( $url, '://' ) ) { 712 // Since we know it's a relative path, prefix with a scheme/host placeholder and try again 713 if ( ! $parts = @parse_url( 'placeholder://placeholder' . $url ) ) { 714 return $parts; 715 } 716 // Remove the placeholder values 717 unset( $parts['scheme'], $parts['host'] ); 718 } else { 719 return $parts; 720 } 721 } 722 723 // < PHP 5.4.7 compat, doesn't detect schemeless URL's host field 724 if ( '//' == substr( $url, 0, 2 ) && ! isset( $parts['host'] ) ) { 725 list( $parts['host'], $slashless_path ) = explode( '/', substr( $parts['path'], 2 ), 2 ); 726 $parts['path'] = "/{$slashless_path}"; 727 } 728 729 return $parts; 699 _deprecated_function( __METHOD__, '4.4.0', 'wp_parse_url()' ); 700 return wp_parse_url( $url ); 730 701 } 731 702 … … 748 719 return $maybe_relative_path; 749 720 750 if ( ! $url_parts = WP_Http::parse_url( $url ) ) {721 if ( ! $url_parts = wp_parse_url( $url ) ) { 751 722 return $maybe_relative_path; 752 723 } 753 724 754 if ( ! $relative_url_parts = WP_Http::parse_url( $maybe_relative_path ) ) {725 if ( ! $relative_url_parts = wp_parse_url( $maybe_relative_path ) ) { 755 726 return $maybe_relative_path; 756 727 }
Note: See TracChangeset
for help on using the changeset viewer.