| @@ -14,9 +14,11 @@ | ||
| 14 | 14 | |
| 15 | 15 | $wp_admin_bar->add_menu( array( |
| 16 | 16 | 'parent' => 'top-secondary', |
| 17 | 17 | 'id' => 'bogo-user-locale', |
| 18 | - 'title' => '✔ ' . $current_language ) ); | |
| 18 | + 'title' => sprintf( | |
| 19 | + '<span class="ab-icon"></span><span class="ab-label">%s</span>', | |
| 20 | + esc_html( $current_language ) ) ) ); | |
| 19 | 21 | |
| 20 | 22 | $available_languages = bogo_available_languages( array( |
| 21 | 23 | 'exclude' => array( $current_locale ), |
| 22 | 24 | 'exclude_enus_if_inactive' => true, |
| @@ -41,17 +43,21 @@ | ||
| 41 | 43 | |
| 42 | 44 | add_action( 'admin_init', 'bogo_switch_user_locale' ); |
| 43 | 45 | |
| 44 | 46 | function bogo_switch_user_locale() { |
| 45 | - if ( empty( $_REQUEST['action'] ) || 'bogo-switch-locale' != $_REQUEST['action'] ) | |
| 47 | + if ( empty( $_REQUEST['action'] ) | |
| 48 | + || 'bogo-switch-locale' != $_REQUEST['action'] ) { | |
| 46 | 49 | return; |
| 50 | + } | |
| 47 | 51 | |
| 48 | 52 | check_admin_referer( 'bogo-switch-locale' ); |
| 49 | 53 | |
| 50 | 54 | $locale = isset( $_REQUEST['locale'] ) ? $_REQUEST['locale'] : ''; |
| 51 | 55 | |
| 52 | - if ( ! bogo_is_available_locale( $locale ) || $locale == bogo_get_user_locale() ) | |
| 56 | + if ( ! bogo_is_available_locale( $locale ) | |
| 57 | + || $locale == bogo_get_user_locale() ) { | |
| 53 | 58 | return; |
| 59 | + } | |
| 54 | 60 | |
| 55 | 61 | update_user_option( get_current_user_id(), 'locale', $locale, true ); |
| 56 | 62 | |
| 57 | 63 | if ( ! empty( $_REQUEST['redirect_to'] ) ) { |