| @@ -12,8 +12,9 @@ | ||
| 12 | 12 | 'af' => __( 'Afrikaans', 'bogo' ), |
| 13 | 13 | 'am' => __( 'Amharic', 'bogo' ), |
| 14 | 14 | 'an' => __( 'Aragonese', 'bogo' ), |
| 15 | 15 | 'ar' => __( 'Arabic', 'bogo' ), |
| 16 | + 'ary' => __( 'Moroccan Arabic', 'bogo' ), | |
| 16 | 17 | 'as' => __( 'Assamese', 'bogo' ), |
| 17 | 18 | 'az' => __( 'Azerbaijani', 'bogo' ), |
| 18 | 19 | 'be_BY' => __( 'Belarusian', 'bogo' ), |
| 19 | 20 | 'bg_BG' => __( 'Bulgarian', 'bogo' ), |
| @@ -35,8 +36,10 @@ | ||
| 35 | 36 | 'en_US' => __( 'English (United States)', 'bogo' ), |
| 36 | 37 | 'en_AU' => __( 'English (Australia)', 'bogo' ), |
| 37 | 38 | 'en_CA' => __( 'English (Canada)', 'bogo' ), |
| 38 | 39 | 'en_GB' => __( 'English (UK)', 'bogo' ), |
| 40 | + 'en_NZ' => __( 'English (New Zealand)', 'bogo' ), | |
| 41 | + 'en_ZA' => __( 'English (South Africa)', 'bogo' ), | |
| 39 | 42 | 'eo' => __( 'Esperanto', 'bogo' ), |
| 40 | 43 | 'es_ES' => __( 'Spanish (Spain)', 'bogo' ), |
| 41 | 44 | 'es_CL' => __( 'Spanish (Chile)', 'bogo' ), |
| 42 | 45 | 'es_CO' => __( 'Spanish (Colombia)', 'bogo' ), |
| @@ -48,8 +51,9 @@ | ||
| 48 | 51 | 'fa_IR' => __( 'Persian', 'bogo' ), |
| 49 | 52 | 'fi' => __( 'Finnish', 'bogo' ), |
| 50 | 53 | 'fo' => __( 'Faroese', 'bogo' ), |
| 51 | 54 | 'fr_FR' => __( 'French (France)', 'bogo' ), |
| 55 | + 'fr_BE' => __( 'French (Belgium)', 'bogo' ), | |
| 52 | 56 | 'fy' => __( 'Frisian', 'bogo' ), |
| 53 | 57 | 'ga' => __( 'Irish', 'bogo' ), |
| 54 | 58 | 'gd' => __( 'Scottish Gaelic', 'bogo' ), |
| 55 | 59 | 'gl_ES' => __( 'Galician', 'bogo' ), |
| @@ -200,8 +204,9 @@ | ||
| 200 | 204 | |
| 201 | 205 | function bogo_available_locales( $args = '' ) { |
| 202 | 206 | $defaults = array( |
| 203 | 207 | 'exclude' => array(), |
| 208 | + 'exclude_enus_if_inactive' => false, | |
| 204 | 209 | 'current_user_can_access' => false ); |
| 205 | 210 | |
| 206 | 211 | $args = wp_parse_args( $args, $defaults ); |
| 207 | 212 | |
| @@ -206,9 +211,16 @@ | ||
| 206 | 211 | $args = wp_parse_args( $args, $defaults ); |
| 207 | 212 | |
| 208 | 213 | $installed_locales = get_available_languages(); |
| 209 | 214 | $installed_locales[] = bogo_get_default_locale(); |
| 210 | - $installed_locales[] = 'en_US'; | |
| 215 | + | |
| 216 | + $exclude_enus = $args['exclude_enus_if_inactive'] | |
| 217 | + && bogo_get_prop( 'enus_deactivated' ); | |
| 218 | + | |
| 219 | + if ( ! $exclude_enus ) { | |
| 220 | + $installed_locales[] = 'en_US'; | |
| 221 | + } | |
| 222 | + | |
| 211 | 223 | $installed_locales = array_unique( $installed_locales ); |
| 212 | 224 | $installed_locales = array_filter( $installed_locales ); |
| 213 | 225 | |
| 214 | 226 | $available_locales = array(); |
| @@ -481,10 +493,11 @@ | ||
| 481 | 493 | |
| 482 | 494 | function bogo_get_prop( $prop ) { |
| 483 | 495 | $option = get_option( 'bogo' ); |
| 484 | 496 | |
| 485 | - if ( ! is_array( $option ) ) | |
| 497 | + if ( ! is_array( $option ) ) { | |
| 486 | 498 | $option = array(); |
| 499 | + } | |
| 487 | 500 | |
| 488 | 501 | return isset( $option[$prop] ) ? $option[$prop] : ''; |
| 489 | 502 | } |
| 490 | 503 | |
| @@ -490,12 +503,27 @@ | ||
| 490 | 503 | |
| 491 | 504 | function bogo_set_prop( $prop, $value ) { |
| 492 | 505 | $option = get_option( 'bogo' ); |
| 493 | 506 | |
| 494 | - if ( ! is_array( $option ) ) | |
| 507 | + if ( ! is_array( $option ) ) { | |
| 495 | 508 | $option = array(); |
| 509 | + } | |
| 496 | 510 | |
| 497 | 511 | $option[$prop] = $value; |
| 512 | + | |
| 513 | + update_option( 'bogo', $option ); | |
| 514 | +} | |
| 515 | + | |
| 516 | +function bogo_delete_prop( $prop ) { | |
| 517 | + $option = get_option( 'bogo' ); | |
| 518 | + | |
| 519 | + if ( ! is_array( $option ) ) { | |
| 520 | + $option = array(); | |
| 521 | + } | |
| 522 | + | |
| 523 | + if ( isset( $option[$prop] ) ) { | |
| 524 | + unset( $option[$prop] ); | |
| 525 | + } | |
| 498 | 526 | |
| 499 | 527 | update_option( 'bogo', $option ); |
| 500 | 528 | } |
| 501 | 529 | |