X-Git-Url: https://scripts.mit.edu/gitweb/autoinstalls/wordpress.git/blobdiff_plain/607b7e02d77e7326161e8ec15639052d2040f745..refs/tags/wordpress-4.7.1:/wp-admin/options.php diff --git a/wp-admin/options.php b/wp-admin/options.php index f319d520..17474890 100644 --- a/wp-admin/options.php +++ b/wp-admin/options.php @@ -47,7 +47,7 @@ if ( empty($option_page) ) { if ( ! current_user_can( $capability ) ) { wp_die( '

' . __( 'Cheatin’ uh?' ) . '

' . - '

' . __( 'Sorry, you are not allowed to manage these items.' ) . '

', + '

' . __( 'Sorry, you are not allowed to manage these options.' ) . '

', 403 ); } @@ -194,6 +194,8 @@ if ( 'update' == $action ) { } if ( $options ) { + $user_language_old = get_user_locale(); + foreach ( $options as $option ) { if ( $unregistered ) { _deprecated_argument( 'options.php', '2.7.0', @@ -209,19 +211,23 @@ if ( 'update' == $action ) { $value = null; if ( isset( $_POST[ $option ] ) ) { $value = $_POST[ $option ]; - if ( ! is_array( $value ) ) + if ( ! is_array( $value ) ) { $value = trim( $value ); + } $value = wp_unslash( $value ); } update_option( $option, $value ); } - // Switch translation in case WPLANG was changed. - $language = get_option( 'WPLANG' ); - if ( $language ) { - load_default_textdomain( $language ); - } else { - unload_textdomain( 'default' ); + /* + * Switch translation in case WPLANG was changed. + * The global $locale is used in get_locale() which is + * used as a fallback in get_user_locale(). + */ + unset( $GLOBALS['locale'] ); + $user_language_new = get_user_locale(); + if ( $user_language_old !== $user_language_new ) { + load_default_textdomain( $user_language_new ); } }