WordPress.org

Make WordPress Core

Changes between Version 3 and Version 4 of Ticket #17266, comment 1


Ignore:
Timestamp:
04/28/11 12:18:55 (3 years ago)
Author:
anmari
Comment:

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #17266, comment 1

    v3 v4  
    1818 
    1919if (!function_exists('amr_load_custom_text') ) { // for filter 
    20         function amr_load_custom_text($mofile, $domain='default') { 
    21                 $locale = get_locale();  
    22                 $custom_mofile = WP_CONTENT_DIR.'/languages/'. $domain . '-' . $locale . '.mo';   
    23                 if (file_exists($custom_mofile)) return ($custom_mofile);  
    24                 else  return $mofile; 
    25         } 
     20        function amr_load_custom_text( $mofile, $domain='' ) { 
     21        //only do for the plugins/themes you want 
     22        if (!in_array($domain, array('amr-ical-events-list', 'amr-events'))) 
     23        return $mofile; 
     24  
     25    $pathinfo = pathinfo($mofile); 
     26        $custom_mofile = WP_CONTENT_DIR."/languages/" . $pathinfo["basename"]; 
     27        if (file_exists($custom_mofile))                         
     28                        return ($custom_mofile);  
     29        else   
     30                        return $mofile; 
     31    } 
    2632} 
    27 add_filter ('load_textdomain_mofile','amr_load_custom_text' ); 
     33add_filter ('load_textdomain_mofile','amr_load_custom_text',10,2 ); 
    2834}}}