Ticket #45528: 45528.3.patch
File 45528.3.patch, 2.4 KB (added by , 6 years ago) |
---|
-
src/wp-includes/l10n.php
900 900 901 901 $obj = $wp_scripts->registered[ $handle ]; 902 902 903 $src = $obj->src; 904 if ( ! preg_match( '|^(https?:)?//|', $src ) && ! ( $wp_scripts->content_url && 0 === strpos( $src, $wp_scripts->content_url ) ) ) { 905 $src = $wp_scripts->base_url . $src; 906 } 903 907 /** This filter is documented in wp-includes/class.wp-scripts.php */ 904 $src = esc_url( apply_filters( 'script_loader_src', $ obj->src, $handle ) );908 $src = esc_url( apply_filters( 'script_loader_src', $src, $handle ) ); 905 909 906 910 $relative = false; 907 911 $languages_path = WP_LANG_DIR; … … 913 917 // If the host is the same or it's a relative URL. 914 918 if ( 915 919 strpos( $src_url['path'], $content_url['path'] ) === 0 && 916 ( ! isset( $src_url['host'] ) || $src_url['host'] !== $content_url['host'] )920 ( ! isset( $src_url['host'] ) || $src_url['host'] === $content_url['host'] ) 917 921 ) { 918 922 // Make the src relative the specific plugin or theme. 919 $relative = trim( substr( $src , strlen( $content_url['path'] ) ), '/' );923 $relative = trim( substr( $src_url['path'], strlen( $content_url['path'] ) ), '/' ); 920 924 $relative = explode( '/', $relative ); 921 925 922 926 $languages_path = WP_LANG_DIR . '/' . $relative[0]; 923 927 924 928 $relative = array_slice( $relative, 2 ); 925 929 $relative = implode( '/', $relative ); 926 } elseif ( ! isset( $src_url['host'] ) || $src_url['host'] !== $site_url['host'] ) {930 } elseif ( ! isset( $src_url['host'] ) || $src_url['host'] === $site_url['host'] ) { 927 931 if ( ! isset( $site_url['path'] ) ) { 928 932 $relative = trim( $src_url['path'], '/' ); 929 } elseif ( ( strpos( $src_url['path'], $site_url['path']) === 0 ) ) {933 } elseif ( ( strpos( $src_url['path'], trailingslashit( $site_url['path'] ) ) === 0 ) ) { 930 934 // Make the src relative to the WP root. 931 $relative = substr( $src , strlen( $site_url['path'] ) );935 $relative = substr( $src_url['path'], strlen( $site_url['path'] ) ); 932 936 $relative = trim( $relative, '/' ); 933 937 } 938 } elseif ( isset( $src_url['host'] ) && $src_url['host'] !== $site_url['host'] && false !== strpos( $src_url['path'], '/wp-includes/' ) ) { 939 // This handles CDNs that mirror all static assets. 940 $relative = substr( $src_url['path'], 1 + strpos( $src_url['path'], '/wp-includes/' ) ); 934 941 } 935 942 936 943 // If the source is not from WP.