Make WordPress Core


Ignore:
Timestamp:
11/15/2018 02:36:39 PM (6 years ago)
Author:
herregroen
Message:

I18N: Fix warnings in JavaScript translations.

Fixes an undefined index PHP warning in the load_script_textdomain function and a non-interrupting JS error when registering a domain which has no translations.

Props omarreiss, ocean90, georgestephanis.
Fixes #45256.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/5.0/src/wp-includes/l10n.php

    r43859 r43898  
    924924        $relative = array_slice( $relative, 2 );
    925925        $relative = implode( '/', $relative );
    926     } else if (
    927         ! isset( $site_url['path'] ) &&
    928         ( ! isset( $src_url['host'] ) || $src_url['host'] !== $site_url['host'] )
    929     ) {
    930         $relative = trim( $src_url['path'], '/' );
    931     } else if (
    932         ( strpos( $src_url['path'], $site_url['path'] ) === 0 ) &&
    933         ( ! isset( $src_url['host'] ) || $src_url['host'] !== $site_url['host'] )
    934     ) {
    935         // Make the src relative to the WP root.
    936         $relative = substr( $src, strlen( $site_url['path'] ) );
    937         $relative = trim( $relative, '/' );
     926    } elseif ( ! isset( $src_url['host'] ) || $src_url['host'] !== $site_url['host'] ) {
     927        if ( ! isset( $site_url['path'] ) ) {
     928            $relative = trim( $src_url['path'], '/' );
     929        } elseif ( ( strpos( $src_url['path'], $site_url['path'] ) === 0 ) ) {
     930            // Make the src relative to the WP root.
     931            $relative = substr( $src, strlen( $site_url['path'] ) );
     932            $relative = trim( $relative, '/' );
     933        }
    938934    }
    939935
Note: See TracChangeset for help on using the changeset viewer.