WordPress.org

Make WordPress Core

Changeset 8065


Ignore:
Timestamp:
06/09/08 19:39:04 (6 years ago)
Author:
ryan
Message:

Back compat fixes for load_plugin_textdomain() from nbachiyski. see #6938

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-includes/l10n.php

    r8041 r8065  
    277277 * dash followed by a dash, and then the locale exactly. 
    278278 * 
    279  * The plugin may place all of the .mo files in another folder and set 
    280  * the $path based on the relative location from ABSPATH constant. The 
    281  * plugin may use the constant WP_PLUGIN_DIR and/or plugin_basename() to 
    282  * get path of the plugin and then add the folder which holds the .mo 
    283  * files. 
    284  * 
    285279 * @since 1.5.0 
    286280 * 
    287281 * @param string $domain Unique identifier for retrieving translated strings 
    288  * @param string $path Optional. Path of the folder where the .mo files reside. 
    289  */ 
    290 function load_plugin_textdomain($domain, $path = false) { 
     282 * @param string $abs_rel_path Optional. Relative path to ABSPATH of a folder, 
     283 *  where the .mo file resides. Deprecated, but still functional until 2.7 
     284 * @param string $plugin_rel_path Optional. Relative path to WP_PLUGIN_DIR. This is the preferred argument to use. It takes precendence over $abs_rel_path 
     285 */ 
     286function load_plugin_textdomain($domain, $abs_rel_path = false, $plugin_rel_path = false) { 
    291287    $locale = get_locale(); 
    292  
    293     if ( false === $path ) 
    294         $path = ''; 
     288     
     289    if ( false !== $plugin_rel_path ) 
     290        $path = WP_PLUGIN_DIR . '/' . trim( $plugin_rel_path, '/'); 
     291    else if ( false !== $abs_rel_path) 
     292        $path = ABSPATH . trim( $abs_rel_path, '/'); 
    295293    else 
    296         $path = '/' . trim(trim($path), '/'); 
    297  
    298     $mofile = WP_PLUGIN_DIR . $path . '/'. $domain . '-' . $locale . '.mo'; 
     294        $path = WP_PLUGIN_DIR; 
     295 
     296    $mofile = $path . '/'. $domain . '-' . $locale . '.mo'; 
    299297    load_textdomain($domain, $mofile); 
    300298} 
Note: See TracChangeset for help on using the changeset viewer.