Make WordPress Core

Ticket #23794: 23794.diff

File 23794.diff, 3.6 KB (added by swissspidy, 8 years ago)
  • src/wp-includes/deprecated.php

    diff --git src/wp-includes/deprecated.php src/wp-includes/deprecated.php
    index 7bb13bc..8370381 100644
    function _wp_upload_dir_baseurl() { 
    37543754        $upload_dir = wp_get_upload_dir();
    37553755        return $upload_dir['baseurl'];
    37563756}
     3757
     3758/**
     3759 * Load the translated strings for a plugin residing in the mu-plugins directory.
     3760 *
     3761 * @since 3.0.0
     3762 * @since 4.6.0 The function now tries to load the .mo file from the languages directory first.
     3763 * @deprecated 4.6.0 Use load_plugin_textdomain()
     3764 * @see load_plugin_textdomain()
     3765 *
     3766 * @param string $domain             Text domain. Unique identifier for retrieving translated strings.
     3767 * @param string $mu_plugin_rel_path Relative to WPMU_PLUGIN_DIR directory in which the .mo file resides.
     3768 *                                   Default empty string.
     3769 * @return bool True when textdomain is successfully loaded, false otherwise.
     3770 */
     3771function load_muplugin_textdomain( $domain, $mu_plugin_rel_path = '' ) {
     3772        _deprecated_function( __FUNCTION__, '4.5', 'load_plugin_textdomain()' );
     3773
     3774        /** This filter is documented in wp-includes/l10n.php */
     3775        $locale = apply_filters( 'plugin_locale', get_locale(), $domain );
     3776
     3777        $mofile = $domain . '-' . $locale . '.mo';
     3778
     3779        // Try to load from the languages directory first.
     3780        if ( load_textdomain( $domain, WP_LANG_DIR . '/plugins/' . $mofile ) ) {
     3781                return true;
     3782        }
     3783
     3784        $path = trailingslashit( WPMU_PLUGIN_DIR . '/' . ltrim( $mu_plugin_rel_path, '/' ) );
     3785
     3786        return load_textdomain( $domain, $path . '/' . $mofile );
     3787}
  • src/wp-includes/l10n.php

    diff --git src/wp-includes/l10n.php src/wp-includes/l10n.php
    index 7fa6638..e8bbdfd 100644
    function load_default_textdomain( $locale = null ) { 
    656656 *
    657657 * @since 1.5.0
    658658 * @since 4.6.0 The function now tries to load the .mo file from the languages directory first.
     659 * @since 4.6.0 If there is no .mo file in the plugin directory, it falls back to the mu-plugins directory.
    659660 *
    660661 * @param string $domain          Unique identifier for retrieving translated strings
    661662 * @param string $deprecated      Use the $plugin_rel_path parameter instead.
    function load_plugin_textdomain( $domain, $deprecated = false, $plugin_rel_path 
    690691                $path = WP_PLUGIN_DIR;
    691692        }
    692693
    693         return load_textdomain( $domain, $path . '/' . $mofile );
    694 }
    695 
    696 /**
    697  * Load the translated strings for a plugin residing in the mu-plugins directory.
    698  *
    699  * @since 3.0.0
    700  * @since 4.6.0 The function now tries to load the .mo file from the languages directory first.
    701  *
    702  * @param string $domain             Text domain. Unique identifier for retrieving translated strings.
    703  * @param string $mu_plugin_rel_path Relative to WPMU_PLUGIN_DIR directory in which the .mo file resides.
    704  *                                   Default empty string.
    705  * @return bool True when textdomain is successfully loaded, false otherwise.
    706  */
    707 function load_muplugin_textdomain( $domain, $mu_plugin_rel_path = '' ) {
    708         /** This filter is documented in wp-includes/l10n.php */
    709         $locale = apply_filters( 'plugin_locale', get_locale(), $domain );
    710 
    711         $mofile = $domain . '-' . $locale . '.mo';
    712 
    713         // Try to load from the languages directory first.
    714         if ( load_textdomain( $domain, WP_LANG_DIR . '/plugins/' . $mofile ) ) {
     694        if ( load_textdomain( $domain, $path . '/' . $mofile ) ) {
    715695                return true;
    716696        }
    717697
    718         $path = trailingslashit( WPMU_PLUGIN_DIR . '/' . ltrim( $mu_plugin_rel_path, '/' ) );
     698        $path = trailingslashit( WPMU_PLUGIN_DIR . '/' . ltrim( $plugin_rel_path, '/' ) );
    719699
    720700        return load_textdomain( $domain, $path . '/' . $mofile );
    721701}