Changeset 38036 for trunk/src/wp-includes/general-template.php
- Timestamp:
- 07/12/2016 11:31:58 AM (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/general-template.php
r38029 r38036 2816 2816 */ 2817 2817 $urls = apply_filters( 'wp_resource_hints', $urls, $relation_type ); 2818 $urls = array_unique( $urls ); 2819 2820 foreach ( $urls as $url ) { 2818 2819 foreach ( $urls as $key => $url ) { 2821 2820 $url = esc_url( $url, array( 'http', 'https' ) ); 2821 if ( ! $url ) { 2822 unset( $urls[ $key ] ); 2823 continue; 2824 } 2822 2825 2823 2826 if ( in_array( $relation_type, array( 'preconnect', 'dns-prefetch' ) ) ) { 2824 2827 $parsed = wp_parse_url( $url ); 2825 2828 if ( empty( $parsed['host'] ) ) { 2829 unset( $urls[ $key ] ); 2826 2830 continue; 2827 2831 } 2828 2832 2829 if ( ! empty( $parsed['scheme'] ) ) { 2833 if ( 'dns-prefetch' === $relation_type ) { 2834 $url = '//' . $parsed['host']; 2835 } else if ( ! empty( $parsed['scheme'] ) ) { 2830 2836 $url = $parsed['scheme'] . '://' . $parsed['host']; 2831 2837 } else { … … 2834 2840 } 2835 2841 2836 printf( "<link rel='%s' href='%s'>\r\n", $relation_type, $url ); 2842 $urls[ $key ] = $url; 2843 } 2844 2845 $urls = array_unique( $urls ); 2846 2847 foreach ( $urls as $url ) { 2848 printf( "<link rel='%s' href='%s'>\n", $relation_type, $url ); 2837 2849 } 2838 2850 }
Note: See TracChangeset
for help on using the changeset viewer.