Make WordPress Core

Ticket #45103: 45103.11.diff

File 45103.11.diff, 1.7 KB (added by herregroen, 6 years ago)
  • wp-includes/class.wp-scripts.php

     
    528528                $json_translations = load_script_textdomain( $handle, $domain, $path );
    529529
    530530                if ( ! $json_translations ) {
    531                         return false;
     531                        // Register an empty locale data object to ensure the domain still exists.
     532                        $json_translations = '{ "locale_data": { "messages": { "": {} } } }';
    532533                }
    533534
    534535                $output = '(function( translations ){' .
  • wp-includes/l10n.php

     
    923923
    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
    940936        // If the source is not from WP.