diff --git src/wp-admin/admin-header.php src/wp-admin/admin-header.php
index 9ec3999..b5bbec0 100644
|
|
|
if ( $current_screen->taxonomy )
|
| 156 | 156 | $admin_body_class .= ' branch-' . str_replace( array( '.', ',' ), '-', floatval( get_bloginfo( 'version' ) ) ); |
| 157 | 157 | $admin_body_class .= ' version-' . str_replace( '.', '-', preg_replace( '/^([.0-9]+).*/', '$1', get_bloginfo( 'version' ) ) ); |
| 158 | 158 | $admin_body_class .= ' admin-color-' . sanitize_html_class( get_user_option( 'admin_color' ), 'fresh' ); |
| 159 | | $admin_body_class .= ' locale-' . sanitize_html_class( strtolower( str_replace( '_', '-', get_locale() ) ) ); |
| | 159 | $admin_body_class .= ' locale-' . sanitize_html_class( strtolower( str_replace( '_', '-', get_user_locale() ) ) ); |
| 160 | 160 | |
| 161 | 161 | if ( wp_is_mobile() ) |
| 162 | 162 | $admin_body_class .= ' mobile'; |
diff --git src/wp-admin/includes/class-wp-plugin-install-list-table.php src/wp-admin/includes/class-wp-plugin-install-list-table.php
index 73df40f..db6c86d 100644
|
|
|
class WP_Plugin_Install_List_Table extends WP_List_Table {
|
| 134 | 134 | 'active_installs' => true |
| 135 | 135 | ), |
| 136 | 136 | // Send the locale and installed plugin slugs to the API so it can provide context-sensitive results. |
| 137 | | 'locale' => get_locale(), |
| | 137 | 'locale' => get_user_locale(), |
| 138 | 138 | 'installed_plugins' => $this->get_installed_plugin_slugs(), |
| 139 | 139 | ); |
| 140 | 140 | |
diff --git src/wp-admin/includes/class-wp-press-this.php src/wp-admin/includes/class-wp-press-this.php
index 3ff242b..e275b16 100644
|
|
|
class WP_Press_This {
|
| 1312 | 1312 | $admin_body_class .= ' branch-' . str_replace( array( '.', ',' ), '-', floatval( $wp_version ) ); |
| 1313 | 1313 | $admin_body_class .= ' version-' . str_replace( '.', '-', preg_replace( '/^([.0-9]+).*/', '$1', $wp_version ) ); |
| 1314 | 1314 | $admin_body_class .= ' admin-color-' . sanitize_html_class( get_user_option( 'admin_color' ), 'fresh' ); |
| 1315 | | $admin_body_class .= ' locale-' . sanitize_html_class( strtolower( str_replace( '_', '-', get_locale() ) ) ); |
| | 1315 | $admin_body_class .= ' locale-' . sanitize_html_class( strtolower( str_replace( '_', '-', get_user_locale() ) ) ); |
| 1316 | 1316 | |
| 1317 | 1317 | /** This filter is documented in wp-admin/admin-header.php */ |
| 1318 | 1318 | $admin_body_classes = apply_filters( 'admin_body_class', '' ); |
diff --git src/wp-admin/includes/credits.php src/wp-admin/includes/credits.php
index 6634724..005858c 100644
|
|
|
|
| 16 | 16 | */ |
| 17 | 17 | function wp_credits() { |
| 18 | 18 | $wp_version = get_bloginfo( 'version' ); |
| 19 | | $locale = get_locale(); |
| | 19 | $locale = get_user_locale(); |
| 20 | 20 | |
| 21 | 21 | $results = get_site_transient( 'wordpress_credits_' . $locale ); |
| 22 | 22 | |
diff --git src/wp-admin/includes/dashboard.php src/wp-admin/includes/dashboard.php
index f3d2f79..98dfc85 100644
|
|
|
function wp_dashboard_browser_nag() {
|
| 1353 | 1353 | $notice .= "<p class='browser-update-nag{$browser_nag_class}'>{$msg}</p>"; |
| 1354 | 1354 | |
| 1355 | 1355 | $browsehappy = 'http://browsehappy.com/'; |
| 1356 | | $locale = get_locale(); |
| | 1356 | $locale = get_user_locale(); |
| 1357 | 1357 | if ( 'en_US' !== $locale ) |
| 1358 | 1358 | $browsehappy = add_query_arg( 'locale', $locale, $browsehappy ); |
| 1359 | 1359 | |
diff --git src/wp-admin/includes/import.php src/wp-admin/includes/import.php
index 4f0b785..0d53442 100644
|
|
|
function wp_import_handle_upload() {
|
| 125 | 125 | function wp_get_popular_importers() { |
| 126 | 126 | include( ABSPATH . WPINC . '/version.php' ); // include an unmodified $wp_version |
| 127 | 127 | |
| 128 | | $locale = get_locale(); |
| | 128 | $locale = get_user_locale(); |
| 129 | 129 | $cache_key = 'popular_importers_' . md5( $locale . $wp_version ); |
| 130 | 130 | $popular_importers = get_site_transient( $cache_key ); |
| 131 | 131 | |
| 132 | 132 | if ( ! $popular_importers ) { |
| 133 | 133 | $url = add_query_arg( array( |
| 134 | | 'locale' => get_locale(), |
| | 134 | 'locale' => get_user_locale(), |
| 135 | 135 | 'version' => $wp_version, |
| 136 | 136 | ), 'http://api.wordpress.org/core/importers/1.1/' ); |
| 137 | 137 | $options = array( 'user-agent' => 'WordPress/' . $wp_version . '; ' . home_url() ); |
diff --git src/wp-admin/includes/plugin-install.php src/wp-admin/includes/plugin-install.php
index a33797e..b0c2e39 100644
|
|
|
function plugins_api( $action, $args = array() ) {
|
| 109 | 109 | } |
| 110 | 110 | |
| 111 | 111 | if ( ! isset( $args->locale ) ) { |
| 112 | | $args->locale = get_locale(); |
| | 112 | $args->locale = get_user_locale(); |
| 113 | 113 | } |
| 114 | 114 | |
| 115 | 115 | /** |
diff --git src/wp-admin/includes/template.php src/wp-admin/includes/template.php
index 4eac951..01cb080 100644
|
|
|
do_action( "admin_head-$hook_suffix" );
|
| 1622 | 1622 | /** This action is documented in wp-admin/admin-header.php */ |
| 1623 | 1623 | do_action( 'admin_head' ); |
| 1624 | 1624 | |
| 1625 | | $admin_body_class .= ' locale-' . sanitize_html_class( strtolower( str_replace( '_', '-', get_locale() ) ) ); |
| | 1625 | $admin_body_class .= ' locale-' . sanitize_html_class( strtolower( str_replace( '_', '-', get_user_locale() ) ) ); |
| 1626 | 1626 | |
| 1627 | 1627 | if ( is_rtl() ) |
| 1628 | 1628 | $admin_body_class .= ' rtl'; |
diff --git src/wp-admin/includes/theme.php src/wp-admin/includes/theme.php
index 9fbd712..edd6cb1 100644
|
|
|
function themes_api( $action, $args = array() ) {
|
| 412 | 412 | } |
| 413 | 413 | |
| 414 | 414 | if ( ! isset( $args->locale ) ) { |
| 415 | | $args->locale = get_locale(); |
| | 415 | $args->locale = get_user_locale(); |
| 416 | 416 | } |
| 417 | 417 | |
| 418 | 418 | /** |
diff --git src/wp-admin/includes/user.php src/wp-admin/includes/user.php
index fc46dd3..4bbb613 100644
|
|
|
function edit_user( $user_id = 0 ) {
|
| 94 | 94 | $user->rich_editing = isset( $_POST['rich_editing'] ) && 'false' == $_POST['rich_editing'] ? 'false' : 'true'; |
| 95 | 95 | $user->admin_color = isset( $_POST['admin_color'] ) ? sanitize_text_field( $_POST['admin_color'] ) : 'fresh'; |
| 96 | 96 | $user->show_admin_bar_front = isset( $_POST['admin_bar_front'] ) ? 'true' : 'false'; |
| | 97 | $user->locale = ''; |
| | 98 | if ( isset( $_POST['locale'] ) ) { |
| | 99 | $user->locale = ( '' === $_POST['locale'] ) ? 'en_US' : $_POST['locale']; // @todo validation |
| | 100 | } |
| 97 | 101 | } |
| 98 | 102 | |
| 99 | 103 | $user->comment_shortcuts = isset( $_POST['comment_shortcuts'] ) && 'true' == $_POST['comment_shortcuts'] ? 'true' : ''; |
diff --git src/wp-admin/plugin-editor.php src/wp-admin/plugin-editor.php
index 9919005..6225c72 100644
|
|
|
foreach ( $plugin_files as $plugin_file ) :
|
| 260 | 260 | <input type="hidden" name="scrollto" id="scrollto" value="<?php echo $scrollto; ?>" /> |
| 261 | 261 | </div> |
| 262 | 262 | <?php if ( !empty( $docs_select ) ) : ?> |
| 263 | | <div id="documentation" class="hide-if-no-js"><label for="docs-list"><?php _e('Documentation:') ?></label> <?php echo $docs_select ?> <input type="button" class="button" value="<?php esc_attr_e( 'Look Up' ) ?> " onclick="if ( '' != jQuery('#docs-list').val() ) { window.open( 'https://api.wordpress.org/core/handbook/1.0/?function=' + escape( jQuery( '#docs-list' ).val() ) + '&locale=<?php echo urlencode( get_locale() ) ?>&version=<?php echo urlencode( get_bloginfo( 'version' ) ) ?>&redirect=true'); }" /></div> |
| | 263 | <div id="documentation" class="hide-if-no-js"><label for="docs-list"><?php _e('Documentation:') ?></label> <?php echo $docs_select ?> <input type="button" class="button" value="<?php esc_attr_e( 'Look Up' ) ?> " onclick="if ( '' != jQuery('#docs-list').val() ) { window.open( 'https://api.wordpress.org/core/handbook/1.0/?function=' + escape( jQuery( '#docs-list' ).val() ) + '&locale=<?php echo urlencode( get_user_locale() ) ?>&version=<?php echo urlencode( get_bloginfo( 'version' ) ) ?>&redirect=true'); }" /></div> |
| 264 | 264 | <?php endif; ?> |
| 265 | 265 | <?php if ( is_writeable($real_file) ) : ?> |
| 266 | 266 | <?php if ( in_array( $file, (array) get_option( 'active_plugins', array() ) ) ) { ?> |
diff --git src/wp-admin/theme-editor.php src/wp-admin/theme-editor.php
index 0b100cf..c4a6207 100644
|
|
|
else : ?>
|
| 263 | 263 | <div id="documentation" class="hide-if-no-js"> |
| 264 | 264 | <label for="docs-list"><?php _e('Documentation:') ?></label> |
| 265 | 265 | <?php echo $docs_select; ?> |
| 266 | | <input type="button" class="button" value="<?php esc_attr_e( 'Look Up' ); ?>" onclick="if ( '' != jQuery('#docs-list').val() ) { window.open( 'https://api.wordpress.org/core/handbook/1.0/?function=' + escape( jQuery( '#docs-list' ).val() ) + '&locale=<?php echo urlencode( get_locale() ) ?>&version=<?php echo urlencode( get_bloginfo( 'version' ) ) ?>&redirect=true'); }" /> |
| | 266 | <input type="button" class="button" value="<?php esc_attr_e( 'Look Up' ); ?>" onclick="if ( '' != jQuery('#docs-list').val() ) { window.open( 'https://api.wordpress.org/core/handbook/1.0/?function=' + escape( jQuery( '#docs-list' ).val() ) + '&locale=<?php echo urlencode( get_user_locale() ) ?>&version=<?php echo urlencode( get_bloginfo( 'version' ) ) ?>&redirect=true'); }" /> |
| 267 | 267 | </div> |
| 268 | 268 | <?php endif; ?> |
| 269 | 269 | |
diff --git src/wp-admin/user-edit.php src/wp-admin/user-edit.php
index bb3c62e..8efd6fa 100644
|
|
|
if ( !( IS_PROFILE_PAGE && !$user_can_edit ) ) : ?>
|
| 269 | 269 | </fieldset> |
| 270 | 270 | </td> |
| 271 | 271 | </tr> |
| | 272 | |
| | 273 | <?php |
| | 274 | $languages = get_available_languages(); |
| | 275 | if ( $languages ) : ?> |
| | 276 | <tr class="user-language-wrap"> |
| | 277 | <th scope="row"> |
| | 278 | <label for="site_language"><?php _e( 'Site Language' ); ?></label> |
| | 279 | </th> |
| | 280 | <td> |
| | 281 | <?php |
| | 282 | $lang = get_user_option( 'locale', $profileuser->ID ); |
| | 283 | if ( 'en_US' === $lang ) { // en_US |
| | 284 | $lang = false; |
| | 285 | } elseif ( ! in_array( $lang, $languages ) ) { |
| | 286 | $lang = get_locale(); |
| | 287 | } |
| | 288 | |
| | 289 | wp_dropdown_languages( array( |
| | 290 | 'name' => 'locale', |
| | 291 | 'id' => 'locale', |
| | 292 | 'selected' => $lang, |
| | 293 | 'languages' => $languages, |
| | 294 | 'show_available_translations' => false |
| | 295 | ) ); |
| | 296 | ?> |
| | 297 | </td> |
| | 298 | </tr> |
| | 299 | <?php |
| | 300 | endif; |
| | 301 | ?> |
| | 302 | |
| 272 | 303 | <?php |
| 273 | 304 | /** |
| 274 | 305 | * Fires at the end of the 'Personal Options' settings table on the user editing screen. |
diff --git src/wp-includes/class-wp-editor.php src/wp-includes/class-wp-editor.php
index 6e6fecc..11075ef 100644
|
|
|
final class _WP_Editors {
|
| 351 | 351 | if ( empty( self::$first_init ) ) { |
| 352 | 352 | self::$baseurl = includes_url( 'js/tinymce' ); |
| 353 | 353 | |
| 354 | | $mce_locale = get_locale(); |
| | 354 | $mce_locale = get_user_locale(); |
| 355 | 355 | self::$mce_locale = $mce_locale = empty( $mce_locale ) ? 'en' : strtolower( substr( $mce_locale, 0, 2 ) ); // ISO 639-1 |
| 356 | 356 | |
| 357 | 357 | /** This filter is documented in wp-admin/includes/media.php */ |
| … |
… |
final class _WP_Editors {
|
| 672 | 672 | } |
| 673 | 673 | } |
| 674 | 674 | |
| 675 | | $body_class .= ' locale-' . sanitize_html_class( strtolower( str_replace( '_', '-', get_locale() ) ) ); |
| | 675 | $body_class .= ' locale-' . sanitize_html_class( strtolower( str_replace( '_', '-', get_user_locale() ) ) ); |
| 676 | 676 | |
| 677 | 677 | if ( !empty($set['tinymce']['body_class']) ) { |
| 678 | 678 | $body_class .= ' ' . $set['tinymce']['body_class']; |
diff --git src/wp-includes/class-wp-theme.php src/wp-includes/class-wp-theme.php
index 40af39d..8136956 100644
|
|
|
final class WP_Theme implements ArrayAccess {
|
| 1395 | 1395 | * @param array $themes Array of themes to sort, passed by reference. |
| 1396 | 1396 | */ |
| 1397 | 1397 | public static function sort_by_name( &$themes ) { |
| 1398 | | if ( 0 === strpos( get_locale(), 'en_' ) ) { |
| | 1398 | if ( 0 === strpos( get_user_locale(), 'en_' ) ) { |
| 1399 | 1399 | uasort( $themes, array( 'WP_Theme', '_name_sort' ) ); |
| 1400 | 1400 | } else { |
| 1401 | 1401 | uasort( $themes, array( 'WP_Theme', '_name_sort_i18n' ) ); |
diff --git src/wp-includes/l10n.php src/wp-includes/l10n.php
index aaa7611..ff013c5 100644
|
|
|
function get_locale() {
|
| 76 | 76 | } |
| 77 | 77 | |
| 78 | 78 | /** |
| | 79 | * Get the locale of the current user. |
| | 80 | * |
| | 81 | * Returns {@see get_locale()} for non-admin requests. |
| | 82 | * |
| | 83 | * If the user has a locale set to a non-empty string then it will be |
| | 84 | * returned. Otherwise it returns the locale of {@see get_locale()}. |
| | 85 | * |
| | 86 | * @return string The locale of the current user. |
| | 87 | */ |
| | 88 | function get_user_locale() { |
| | 89 | if ( ! is_admin() ) { |
| | 90 | return get_locale(); |
| | 91 | } |
| | 92 | |
| | 93 | $user = wp_get_current_user(); |
| | 94 | |
| | 95 | if ( ! $user ) { |
| | 96 | return get_locale(); |
| | 97 | } |
| | 98 | |
| | 99 | $locale = $user->locale; |
| | 100 | return ( '' === $locale ) ? get_locale() : $locale; |
| | 101 | } |
| | 102 | |
| | 103 | /** |
| 79 | 104 | * Retrieve the translation of $text. |
| 80 | 105 | * |
| 81 | 106 | * If there is no translation, or the text domain isn't loaded, the original text is returned. |
| … |
… |
function unload_textdomain( $domain ) {
|
| 633 | 658 | */ |
| 634 | 659 | function load_default_textdomain( $locale = null ) { |
| 635 | 660 | if ( null === $locale ) { |
| 636 | | $locale = get_locale(); |
| | 661 | $locale = get_user_locale(); |
| 637 | 662 | } |
| 638 | 663 | |
| 639 | 664 | // Unload previously loaded strings so we can switch translations. |
diff --git src/wp-includes/user.php src/wp-includes/user.php
index 9ff6455..5641695 100644
|
|
|
function wp_insert_user( $userdata ) {
|
| 1592 | 1592 | |
| 1593 | 1593 | $meta['show_admin_bar_front'] = empty( $userdata['show_admin_bar_front'] ) ? 'true' : $userdata['show_admin_bar_front']; |
| 1594 | 1594 | |
| | 1595 | $meta['locale'] = isset( $userdata['locale'] ) ? $userdata['locale'] : ''; |
| | 1596 | |
| 1595 | 1597 | $user_nicename_check = $wpdb->get_var( $wpdb->prepare("SELECT ID FROM $wpdb->users WHERE user_nicename = %s AND user_login != %s LIMIT 1" , $user_nicename, $user_login)); |
| 1596 | 1598 | |
| 1597 | 1599 | if ( $user_nicename_check ) { |
| … |
… |
function wp_create_user($username, $password, $email = '') {
|
| 1951 | 1953 | * @return array List of user keys to be populated in wp_update_user(). |
| 1952 | 1954 | */ |
| 1953 | 1955 | function _get_additional_user_keys( $user ) { |
| 1954 | | $keys = array( 'first_name', 'last_name', 'nickname', 'description', 'rich_editing', 'comment_shortcuts', 'admin_color', 'use_ssl', 'show_admin_bar_front' ); |
| | 1956 | $keys = array( 'first_name', 'last_name', 'nickname', 'description', 'rich_editing', 'comment_shortcuts', 'admin_color', 'use_ssl', 'show_admin_bar_front', 'locale' ); |
| 1955 | 1957 | return array_merge( $keys, array_keys( wp_get_user_contact_methods( $user ) ) ); |
| 1956 | 1958 | } |
| 1957 | 1959 | |
diff --git src/wp-settings.php src/wp-settings.php
index 80f556c..a67e5c6 100644
|
|
|
wp_templating_constants( );
|
| 371 | 371 | // Load the default text localization domain. |
| 372 | 372 | load_default_textdomain(); |
| 373 | 373 | |
| 374 | | $locale = get_locale(); |
| | 374 | $locale = get_user_locale(); |
| 375 | 375 | $locale_file = WP_LANG_DIR . "/$locale.php"; |
| 376 | 376 | if ( ( 0 === validate_file( $locale ) ) && is_readable( $locale_file ) ) |
| 377 | 377 | require( $locale_file ); |