WordPress.org

Plugin Directory

Changeset 171526 for buddypress-links


Ignore:
Timestamp:
11/08/09 18:51:17 (4 years ago)
Author:
MrMaz
Message:

fixed infinite filter loop in bp_links_load_textdomain() and also skip file check on empty locale

File:
1 edited

Legend:

Unmodified
Added
Removed
  • buddypress-links/trunk/bp-links.php

    r171191 r171526  
    137137 
    138138function bp_links_load_textdomain() { 
    139     $locale = apply_filters( 'bp_links_load_textdomain', get_locale() ); 
    140     $mofile = BP_LINKS_PLUGIN_DIR . sprintf( '/languages/%s-%s.mo', BP_LINKS_PLUGIN_NAME, $locale ); 
    141     if ( file_exists( $mofile ) ) 
    142         load_textdomain( BP_LINKS_PLUGIN_NAME, $mofile ); 
     139 
     140    // try to get locale 
     141    $locale = apply_filters( 'bp_links_load_textdomain_get_locale', get_locale() ); 
     142 
     143    // if we found a locale, try to load .mo file 
     144    if ( !empty( $locale ) ) { 
     145        // default .mo file path 
     146        $mofile_default = sprintf( '%s/languages/%s-%s.mo', BP_LINKS_PLUGIN_DIR, BP_LINKS_PLUGIN_NAME, $locale ); 
     147        // final filtered file path 
     148        $mofile = apply_filters( 'bp_links_load_textdomain_mofile', $mofile_default ); 
     149        // make sure file exists, and load it 
     150        if ( file_exists( $mofile ) ) { 
     151            load_textdomain( BP_LINKS_PLUGIN_NAME, $mofile ); 
     152        } 
     153    } 
    143154} 
    144155add_action ( 'plugins_loaded', 'bp_links_load_textdomain', 6 ); 
     
    146157function bp_links_setup_globals() { 
    147158    global $bp, $wpdb; 
    148  
    149     /* Load Language file */ 
    150159 
    151160    /* For internal identification */ 
Note: See TracChangeset for help on using the changeset viewer.