- Timestamp:
- 11/11/2022 05:10:24 AM (4 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
sites/trunk/common/includes/wporg-sso/class-wporg-sso.php
r12238 r12239 12 12 const LOGIN_TOS_COOKIE = 'wporg_tos_login'; 13 13 const TOS_USER_META_KEY = 'tos_revision'; 14 15 /** 16 * The time SSO tokens are valid. These are used for remote login/logout on 17 * non-wordpress.org domains. 18 * 19 * @var int 20 */ 21 const REMOTE_TOKEN_TIMEOUT = 5; 14 22 15 23 const VALID_HOSTS = [ … … 186 194 * Tests if the passed host/domain, or URL, is part of the WordPress.org network. 187 195 * 188 * @param unknown$host A domain, hostname, or URL196 * @param string $host A domain, hostname, or URL 189 197 * @return boolean True is ok, false if not 190 198 */ … … 202 210 } 203 211 212 $host = $this->_get_targetted_host( $host ); 213 214 return in_array( $host, self::VALID_HOSTS, true ); 215 } 216 217 /** 218 * Determine the targetted hostname for a given hostname. 219 * 220 * This returns 'wordpress.org' in the case of 'login.wordpress.org'. 221 * This does NOT validate the hostname is valid for a redirect. 222 * 223 * @param string $host The hostname to process. 224 * @return string The hostname, maybe top-level, maybe not. 225 */ 226 protected function _get_targetted_host( $host ) { 204 227 if ( in_array( $host, self::VALID_HOSTS, true ) ) { 205 return true;228 return $host; 206 229 } 207 230 208 231 // If not a top-level domain, shrink it down and try again. 209 232 $top_level_host = implode( '.', array_slice( explode( '.', $host ), -2 ) ); 210 211 return in_array( $top_level_host, self::VALID_HOSTS, true ); 233 if ( in_array( $top_level_host, self::VALID_HOSTS, true ) ) { 234 $host = $top_level_host; 235 } 236 237 return $host; 212 238 } 213 239
Note:
See TracChangeset
for help on using the changeset viewer.
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)