Changeset 44310
- Timestamp:
- 12/18/2018 11:09:51 PM (6 years ago)
- Location:
- trunk
- Files:
-
- 2 edited
- 1 copied
Legend:
- Unmodified
- Added
- Removed
-
trunk
- Property svn:mergeinfo changed
/branches/5.0 merged: 44209
- Property svn:mergeinfo changed
-
trunk/src/wp-includes/l10n.php
r44278 r44310 913 913 global $wp_scripts; 914 914 915 if ( ! isset( $wp_scripts->registered[ $handle ] ) ) { 916 return false; 917 } 918 915 919 $path = untrailingslashit( $path ); 916 920 $locale = determine_locale(); … … 925 929 $obj = $wp_scripts->registered[ $handle ]; 926 930 931 $src = $obj->src; 932 if ( ! preg_match( '|^(https?:)?//|', $src ) && ! ( $wp_scripts->content_url && 0 === strpos( $src, $wp_scripts->content_url ) ) ) { 933 $src = $wp_scripts->base_url . $src; 934 } 927 935 /** This filter is documented in wp-includes/class.wp-scripts.php */ 928 $src = esc_url( apply_filters( 'script_loader_src', $ obj->src, $handle ) );936 $src = esc_url( apply_filters( 'script_loader_src', $src, $handle ) ); 929 937 930 938 $relative = false; … … 938 946 if ( 939 947 strpos( $src_url['path'], $content_url['path'] ) === 0 && 940 ( ! isset( $src_url['host'] ) || $src_url['host'] !== $content_url['host'] )948 ( ! isset( $src_url['host'] ) || $src_url['host'] === $content_url['host'] ) 941 949 ) { 942 950 // Make the src relative the specific plugin or theme. 943 $relative = trim( substr( $src , strlen( $content_url['path'] ) ), '/' );951 $relative = trim( substr( $src_url['path'], strlen( $content_url['path'] ) ), '/' ); 944 952 $relative = explode( '/', $relative ); 945 953 … … 948 956 $relative = array_slice( $relative, 2 ); 949 957 $relative = implode( '/', $relative ); 950 } elseif ( ! isset( $src_url['host'] ) || $src_url['host'] !== $site_url['host'] ) {958 } elseif ( ! isset( $src_url['host'] ) || $src_url['host'] === $site_url['host'] ) { 951 959 if ( ! isset( $site_url['path'] ) ) { 952 960 $relative = trim( $src_url['path'], '/' ); 953 } elseif ( ( strpos( $src_url['path'], $site_url['path']) === 0 ) ) {961 } elseif ( ( strpos( $src_url['path'], trailingslashit( $site_url['path'] ) ) === 0 ) ) { 954 962 // Make the src relative to the WP root. 955 $relative = substr( $src , strlen( $site_url['path'] ) );963 $relative = substr( $src_url['path'], strlen( $site_url['path'] ) ); 956 964 $relative = trim( $relative, '/' ); 957 965 } 958 966 } 967 968 /** 969 * Filters the relative path of scripts used for finding translation files. 970 * 971 * @since 5.0.2 972 * 973 * @param string $relative The relative path of the script. False if it could not be determined. 974 * @param string $src The full source url of the script. 975 */ 976 $relative = apply_filters( 'load_script_textdomain_relative_path', $relative, $src ); 959 977 960 978 // If the source is not from WP.
Note: See TracChangeset
for help on using the changeset viewer.