Changeset 6675
- Timestamp:
- 02/17/2018 11:57:44 AM (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
sites/trunk/wordpress.org/public_html/wp-content/plugins/locale-detection/class-detector.php
r6674 r6675 14 14 15 15 /** 16 * Name of the cookie for the locale. 17 */ 18 const COOKIE_NAME = 'wporg_locale'; 19 20 /** 21 * Name of the GET parameter for the locale. 22 */ 23 const GET_NAME = 'locale'; 24 25 /** 16 26 * Whether the locale was guessed or not. 17 27 * … … 54 64 */ 55 65 private function set_locale() { 56 if ( ! empty( $_GET[ 'locale'] ) ) {57 $get_locale = $this->sanitize_locale( $_GET[ 'locale'] );66 if ( ! empty( $_GET[ self::GET_NAME ] ) ) { 67 $get_locale = $this->sanitize_locale( $_GET[ self::GET_NAME ] ); 58 68 59 69 $this->locale = $this->check_variants( $get_locale ) ?: $this->locale; 60 } elseif ( ! empty( $_COOKIE[ 'wporg_locale'] ) ) {61 $locale = $this->sanitize_locale( $_COOKIE[ 'wporg_locale'] );70 } elseif ( ! empty( $_COOKIE[ self::COOKIE_NAME ] ) ) { 71 $locale = $this->sanitize_locale( $_COOKIE[ self::COOKIE_NAME ] ); 62 72 63 73 if ( in_array( $locale, $this->active_locales, true ) ) { … … 68 78 } 69 79 70 if ( empty( $_COOKIE[ 'wporg_locale'] ) || $this->locale !== $_COOKIE['wporg_locale'] ) {71 setcookie( 'wporg_locale', $this->locale, time() + YEAR_IN_SECONDS, SITECOOKIEPATH, COOKIE_DOMAIN, is_ssl() );80 if ( empty( $_COOKIE[ self::COOKIE_NAME ] ) || $this->locale !== $_COOKIE[ self::COOKIE_NAME ] ) { 81 setcookie( self::COOKIE_NAME, $this->locale, time() + YEAR_IN_SECONDS, SITECOOKIEPATH, COOKIE_DOMAIN, is_ssl() ); 72 82 } 73 83 }
Note: See TracChangeset
for help on using the changeset viewer.