I18N: Avoid PHP notices for relative URLs in `load_script_textdomain()`.

Props hellofromTonya, SeBsZ, archon810, nourma, justinahinon, SergeyBiryukov.
Fixes #49145.
Built from https://develop.svn.wordpress.org/trunk@49639


git-svn-id: http://core.svn.wordpress.org/trunk@49377 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Sergey Biryukov 2020-11-17 20:52:09 +00:00
parent b456e9c9c8
commit 700c9455ab
2 changed files with 4 additions and 4 deletions

View File

@ -1040,7 +1040,7 @@ function load_script_textdomain( $handle, $domain = 'default', $path = null ) {
// If the host is the same or it's a relative URL.
if (
( ! isset( $content_url['path'] ) || strpos( $src_url['path'], $content_url['path'] ) === 0 ) &&
( ! isset( $src_url['host'] ) || $src_url['host'] === $content_url['host'] )
( ! isset( $src_url['host'] ) || ! isset( $content_url['host'] ) || $src_url['host'] === $content_url['host'] )
) {
// Make the src relative the specific plugin or theme.
if ( isset( $content_url['path'] ) ) {
@ -1057,7 +1057,7 @@ function load_script_textdomain( $handle, $domain = 'default', $path = null ) {
$relative = implode( '/', $relative );
} elseif (
( ! isset( $plugins_url['path'] ) || strpos( $src_url['path'], $plugins_url['path'] ) === 0 ) &&
( ! isset( $src_url['host'] ) || $src_url['host'] === $plugins_url['host'] )
( ! isset( $src_url['host'] ) || ! isset( $plugins_url['host'] ) || $src_url['host'] === $plugins_url['host'] )
) {
// Make the src relative the specific plugin.
if ( isset( $plugins_url['path'] ) ) {
@ -1072,7 +1072,7 @@ function load_script_textdomain( $handle, $domain = 'default', $path = null ) {
$relative = array_slice( $relative, 1 ); // Remove <plugin name>.
$relative = implode( '/', $relative );
} elseif ( ! isset( $src_url['host'] ) || $src_url['host'] === $site_url['host'] ) {
} elseif ( ! isset( $src_url['host'] ) || ! isset( $site_url['host'] ) || $src_url['host'] === $site_url['host'] ) {
if ( ! isset( $site_url['path'] ) ) {
$relative = trim( $src_url['path'], '/' );
} elseif ( ( strpos( $src_url['path'], trailingslashit( $site_url['path'] ) ) === 0 ) ) {

View File

@ -13,7 +13,7 @@
*
* @global string $wp_version
*/
$wp_version = '5.6-beta4-49638';
$wp_version = '5.6-beta4-49639';
/**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.