WordPress.org

Make WordPress Core

Ticket #18200: no_plugin_overwrite.patch

File no_plugin_overwrite.patch, 1.8 KB (added by dimadin, 5 years ago)
  • wp-includes/l10n.php

     
    425425                $path = WP_PLUGIN_DIR;
    426426        }
    427427
     428        // Load the textdomain from the Plugin provided location, or plugin directory first
    428429        $mofile = $path . '/'. $domain . '-' . $locale . '.mo';
     430        if ( $loaded = load_textdomain( $domain, $mofile ) )
     431                return $loaded;
     432
     433        // Else, load textdomain from the Language directory
     434        $mofile = WP_LANG_DIR . "/plugins/{$domain}-{$locale}.mo";
    429435        return load_textdomain( $domain, $mofile );
    430436}
    431437
     
    441447function load_muplugin_textdomain( $domain, $mu_plugin_rel_path = '' ) {
    442448        $locale = apply_filters( 'plugin_locale', get_locale(), $domain );
    443449        $path = WPMU_PLUGIN_DIR . '/' . ltrim( $mu_plugin_rel_path, '/' );
    444         load_textdomain( $domain, trailingslashit( $path ) . "$domain-$locale.mo" );
     450
     451        // Load the textdomain from the Plugin provided location, or plugin directory first
     452        $mofile = trailingslashit( $path ) . "$domain-$locale.mo";
     453        if ( $loaded = load_textdomain( $domain, $mofile ) )
     454                return $loaded;
     455
     456        // Else, load textdomain from the Language directory
     457        $mofile = WP_LANG_DIR . "/plugins/{$domain}-{$locale}.mo";
     458        return load_textdomain( $domain, $mofile );
    445459}
    446460
    447461/**
     
    464478
    465479        // Load the textdomain from the Theme provided location, or theme directory first
    466480        $mofile = "{$path}/{$locale}.mo";
    467         if ( $loaded = load_textdomain($domain, $mofile) )
     481        if ( $loaded = load_textdomain( $domain, $mofile ) )
    468482                return $loaded;
    469483
    470484        // Else, load textdomain from the Language directory
    471485        $mofile = WP_LANG_DIR . "/themes/{$domain}-{$locale}.mo";
    472         return load_textdomain($domain, $mofile);
     486        return load_textdomain( $domain, $mofile );
    473487}
    474488
    475489/**