Changeset 20828
- Timestamp:
- 05/18/2012 08:04:59 PM (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-includes/link-template.php
r20685 r20828 2199 2199 2200 2200 /** 2201 * Set the scheme for a URL 2202 * 2203 * @since 3.4.0 2204 * 2205 * @param string $url Absolute url that includes a scheme 2206 * @param string $scheme Optional. Scheme to give $url. Currently 'http', 'https', 'login', 'login_post', 'admin', or 'relative'. 2207 * @return string $url URL with chosen scheme. 2208 */ 2209 function set_url_scheme( $url, $scheme = null ) { 2210 $orig_scheme = $scheme; 2211 if ( ! in_array( $scheme, array( 'http', 'https', 'relative' ) ) ) { 2212 if ( ( 'login_post' == $scheme || 'rpc' == $scheme ) && ( force_ssl_login() || force_ssl_admin() ) ) 2213 $scheme = 'https'; 2214 elseif ( ( 'login' == $scheme ) && force_ssl_admin() ) 2215 $scheme = 'https'; 2216 elseif ( ( 'admin' == $scheme ) && force_ssl_admin() ) 2217 $scheme = 'https'; 2218 else 2219 $scheme = ( is_ssl() ? 'https' : 'http' ); 2220 } 2221 2222 if ( 'relative' == $scheme ) 2223 $url = preg_replace( '#^.+://[^/]*#', '', $url ); 2224 else 2225 $url = preg_replace( '#^.+://#', $scheme . '://', $url ); 2226 2227 return apply_filters( 'set_url_scheme', $url, $scheme, $orig_scheme ); 2228 } 2229 2230 /** 2201 2231 * Get the URL to the user's dashboard. 2202 2232 *
Note: See TracChangeset
for help on using the changeset viewer.