Changeset 52058
- Timestamp:
- 11/08/2021 10:36:11 PM (3 years ago)
- Location:
- trunk/src
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-admin/css/login.css
r51727 r52058 282 282 #login { 283 283 width: 320px; 284 padding: 8% 0 0;284 padding: 5% 0 0; 285 285 margin: auto; 286 286 } … … 322 322 text-align: center; 323 323 width: 100%; 324 margin: 5em 0 2em;324 margin: 3em 0 2em; 325 325 } 326 326 … … 410 410 } 411 411 412 #language-switcher { 413 padding: 0; 414 overflow: visible; 415 background: none; 416 border: none; 417 box-shadow: none; 418 } 419 420 #language-switcher select { 421 margin-right: 0.25em; 422 } 423 424 .language-switcher { 425 margin: 0 auto; 426 padding: 0 0 24px; 427 text-align: center; 428 } 429 430 .language-switcher label { 431 margin-right: 0.25em; 432 } 433 434 .language-switcher label .dashicons { 435 width: auto; 436 height: auto; 437 } 438 439 .login .language-switcher .button-primary { 440 float: none; 441 margin-bottom: 0; 442 } 443 412 444 @media screen and (max-height: 550px) { 413 445 #login { 414 446 padding: 20px 0; 447 } 448 449 #language-switcher { 450 margin-top: 0; 415 451 } 416 452 } … … 428 464 margin: -0.1875rem 0 0 -0.25rem; 429 465 } 430 } 466 467 #language-switcher label, 468 #language-switcher select { 469 margin-right: 0; 470 } 471 } 472 473 @media screen and (max-width: 400px) { 474 .login .language-switcher .button-primary { 475 display: block; 476 margin: 5px auto 0; 477 } 478 } -
trunk/src/wp-includes/l10n.php
r51837 r52058 145 145 } 146 146 147 if ( ! empty( $_GET['wp_lang'] ) && ! empty( $GLOBALS['pagenow'] ) && 'wp-login.php' === $GLOBALS['pagenow'] ) { 148 $determined_locale = sanitize_text_field( $_GET['wp_lang'] ); 147 $wp_lang = ''; 148 149 if ( ! empty( $_GET['wp_lang'] ) ) { 150 $wp_lang = sanitize_text_field( $_GET['wp_lang'] ); 151 } elseif ( ! empty( $_COOKIE['wp_lang'] ) ) { 152 $wp_lang = sanitize_text_field( $_COOKIE['wp_lang'] ); 153 } 154 155 if ( ! empty( $wp_lang ) && ! empty( $GLOBALS['pagenow'] ) && 'wp-login.php' === $GLOBALS['pagenow'] ) { 156 $determined_locale = $wp_lang; 149 157 } 150 158 … … 1481 1489 * @since 4.7.0 Introduced the `show_option_site_default` argument. 1482 1490 * @since 5.1.0 Introduced the `show_option_en_us` argument. 1491 * @since 5.9.0 Introduced the `explicit_option_en_us` argument. 1483 1492 * 1484 1493 * @see get_available_languages() … … 1500 1509 * @type bool $show_option_site_default Whether to show an option to fall back to the site's locale. Default false. 1501 1510 * @type bool $show_option_en_us Whether to show an option for English (United States). Default true. 1511 * @type bool $explicit_option_en_us Whether the English (United States) option uses an explict value of en_US 1512 * instead of an empty value. Default false. 1502 1513 * } 1503 1514 * @return string HTML dropdown list of languages. … … 1517 1528 'show_option_site_default' => false, 1518 1529 'show_option_en_us' => true, 1530 'explicit_option_en_us' => false, 1519 1531 ) 1520 1532 ); … … 1526 1538 1527 1539 // English (United States) uses an empty string for the value attribute. 1528 if ( 'en_US' === $parsed_args['selected'] ) {1540 if ( 'en_US' === $parsed_args['selected'] && ! $parsed_args['explicit_option_en_us'] ) { 1529 1541 $parsed_args['selected'] = ''; 1530 1542 } … … 1581 1593 1582 1594 if ( $parsed_args['show_option_en_us'] ) { 1595 $value = ( $parsed_args['explicit_option_en_us'] ) ? 'en_US' : ''; 1583 1596 $structure[] = sprintf( 1584 '<option value="" lang="en" data-installed="1"%s>English (United States)</option>', 1597 '<option value="%s" lang="en" data-installed="1"%s>English (United States)</option>', 1598 esc_attr( $value ), 1585 1599 selected( '', $parsed_args['selected'], false ) 1586 1600 ); -
trunk/src/wp-includes/user.php
r51943 r52058 3045 3045 update_user_meta( $user_id, 'default_password_nag', true ); // Set up the password change nag. 3046 3046 3047 if ( ! empty( $_COOKIE['wp_lang'] ) ) { 3048 $wp_lang = sanitize_text_field( $_COOKIE['wp_lang'] ); 3049 if ( in_array( $wp_lang, get_available_languages(), true ) ) { 3050 update_user_meta( $user_id, 'locale', $wp_lang ); // Set user locale if defined on registration. 3051 } 3052 } 3053 3047 3054 /** 3048 3055 * Fires after a new user registration has been recorded. -
trunk/src/wp-login.php
r51955 r52058 313 313 314 314 <?php 315 $languages = get_available_languages(); 316 317 if ( ! empty( $languages ) && ! $interim_login ) { ?> 318 319 <div class="language-switcher"> 320 <form id="language-switcher" action="" method="get"> 321 322 <label for="language-switcher-locales"> 323 <span class="dashicons dashicons-translation" aria-hidden="true"></span> 324 <span class="screen-reader-text"><?php _e( 'Language' ); ?></span> 325 </label> 326 327 <?php 328 $args = array( 329 'id' => 'language-switcher-locales', 330 'name' => 'wp_lang', 331 'selected' => determine_locale(), 332 'show_available_translations' => false, 333 'explicit_option_en_us' => true, 334 'languages' => $languages, 335 ); 336 337 /** 338 * Filters default arguments for the Languages select input on the login screen. 339 * 340 * @since 5.9.0 341 * 342 * @param array $args Arguments for the Languages select input on the login screen. 343 */ 344 wp_dropdown_languages( apply_filters( 'wp_login_language_switcher_args', $args ) ); 345 ?> 346 347 <?php if ( $interim_login ) { ?> 348 <input type="hidden" name="interim-login" value="1" /> 349 <?php } ?> 350 351 <?php if ( isset( $_GET['redirect_to'] ) && '' !== $_GET['redirect_to'] ) { ?> 352 <input type="hidden" name="redirect_to" value="<?php echo esc_url_raw( $_GET['redirect_to'] ); ?>" /> 353 <?php } ?> 354 355 <?php if ( isset( $_GET['action'] ) && '' !== $_GET['action'] ) { ?> 356 <input type="hidden" name="action" value="<?php echo esc_attr( $_GET['action'] ); ?>" /> 357 <?php } ?> 358 359 <input type="submit" class="button button-primary" value="<?php esc_attr_e( 'Change' ); ?>"> 360 361 </form> 362 </div> 363 364 <?php } ?> 365 366 <?php 315 367 316 368 if ( ! empty( $input_id ) ) { … … 418 470 if ( SITECOOKIEPATH !== COOKIEPATH ) { 419 471 setcookie( TEST_COOKIE, 'WP Cookie check', 0, SITECOOKIEPATH, COOKIE_DOMAIN, $secure ); 472 } 473 474 if ( isset( $_GET['wp_lang'] ) ) { 475 setcookie( 'wp_lang', sanitize_text_field( $_GET['wp_lang'] ), 0, COOKIEPATH, COOKIE_DOMAIN, $secure ); 420 476 } 421 477
Note: See TracChangeset
for help on using the changeset viewer.