Changeset 44209 for branches/5.0/src/wp-includes/l10n.php
- Timestamp:
- 12/15/2018 12:54:54 PM (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/5.0/src/wp-includes/l10n.php
r43959 r44209 889 889 global $wp_scripts; 890 890 891 if ( ! isset( $wp_scripts->registered[ $handle ] ) ) { 892 return false; 893 } 894 891 895 $path = untrailingslashit( $path ); 892 896 $locale = determine_locale(); … … 901 905 $obj = $wp_scripts->registered[ $handle ]; 902 906 907 $src = $obj->src; 908 if ( ! preg_match( '|^(https?:)?//|', $src ) && ! ( $wp_scripts->content_url && 0 === strpos( $src, $wp_scripts->content_url ) ) ) { 909 $src = $wp_scripts->base_url . $src; 910 } 903 911 /** This filter is documented in wp-includes/class.wp-scripts.php */ 904 $src = esc_url( apply_filters( 'script_loader_src', $ obj->src, $handle ) );912 $src = esc_url( apply_filters( 'script_loader_src', $src, $handle ) ); 905 913 906 914 $relative = false; … … 914 922 if ( 915 923 strpos( $src_url['path'], $content_url['path'] ) === 0 && 916 ( ! isset( $src_url['host'] ) || $src_url['host'] !== $content_url['host'] )924 ( ! isset( $src_url['host'] ) || $src_url['host'] === $content_url['host'] ) 917 925 ) { 918 926 // Make the src relative the specific plugin or theme. 919 $relative = trim( substr( $src , strlen( $content_url['path'] ) ), '/' );927 $relative = trim( substr( $src_url['path'], strlen( $content_url['path'] ) ), '/' ); 920 928 $relative = explode( '/', $relative ); 921 929 … … 924 932 $relative = array_slice( $relative, 2 ); 925 933 $relative = implode( '/', $relative ); 926 } elseif ( ! isset( $src_url['host'] ) || $src_url['host'] !== $site_url['host'] ) {934 } elseif ( ! isset( $src_url['host'] ) || $src_url['host'] === $site_url['host'] ) { 927 935 if ( ! isset( $site_url['path'] ) ) { 928 936 $relative = trim( $src_url['path'], '/' ); 929 } elseif ( ( strpos( $src_url['path'], $site_url['path']) === 0 ) ) {937 } elseif ( ( strpos( $src_url['path'], trailingslashit( $site_url['path'] ) ) === 0 ) ) { 930 938 // Make the src relative to the WP root. 931 $relative = substr( $src , strlen( $site_url['path'] ) );939 $relative = substr( $src_url['path'], strlen( $site_url['path'] ) ); 932 940 $relative = trim( $relative, '/' ); 933 941 } 934 942 } 943 944 /** 945 * Filters the relative path of scripts used for finding translation files. 946 * 947 * @since 5.0.2 948 * 949 * @param string $relative The relative path of the script. False if it could not be determined. 950 * @param string $src The full source url of the script. 951 */ 952 $relative = apply_filters( 'load_script_textdomain_relative_path', $relative, $src ); 935 953 936 954 // If the source is not from WP.
Note: See TracChangeset
for help on using the changeset viewer.