/**
  * Hooks the WP admin_bar_menu action
  *
  * @param object $wp_admin_bar The WP Admin Bar, passed by reference
  * @return void
  **/
 public function admin_bar_menu($wp_admin_bar)
 {
     $links = bbl_get_switcher_links('bbl-admin-bar');
     $current_lang = bbl_get_current_lang();
     // Remove the current language
     unset($links[$current_lang->code]);
     $parent_id = "bbl-admin-bar-{$current_lang->url_prefix}";
     $wp_admin_bar->add_menu(array('children' => array(), 'href' => '#', 'id' => $parent_id, 'meta' => array('class' => "bbl_lang_{$current_lang->code} bbl_lang"), 'title' => $current_lang->display_name, 'parent' => false));
     foreach ($links as &$link) {
         $link['parent'] = $parent_id;
         $wp_admin_bar->add_menu($link);
     }
 }
/**
 * Checks whether either the provided language code,
 * if provided, or the current language code are
 * the default language.
 *
 * i.e. is this language the default language
 *
 * n.b. the current language could have been switched
 * using bbl_switch_to_lang
 *
 * @param string $lang_code The language code to check (optional)
 * @return bool True if the default language
 **/
function bbl_is_default_lang($lang_code = null)
{
    if (is_null($lang_code)) {
        $lang = bbl_get_current_lang();
    } else {
        if (is_string($lang_code)) {
            // In case someone passes a lang object
            $lang = bbl_get_lang($lang_code);
        }
    }
    return bbl_get_default_lang_code() == $lang->code;
}
 /**
  * Hooks the WP body_class filter to add some language specific classes.
  *
  * @param array $classes The body classes 
  * @return array The body classes 
  **/
 public function body_class(array $classes)
 {
     $lang = bbl_get_current_lang();
     $classes[] = 'bbl-' . sanitize_html_class($lang->text_direction);
     # @TODO I don't think this class should be included:
     $classes[] = 'bbl-' . sanitize_html_class($lang->name);
     $classes[] = 'bbl-' . sanitize_html_class($lang->url_prefix);
     $classes[] = 'bbl-' . sanitize_html_class($lang->code);
     # @TODO I don't think this class should be included:
     $classes[] = 'bbl-' . sanitize_html_class($lang->display_name);
     return $classes;
 }