Changeset 13880
- Timestamp:
- 03/29/2010 05:53:03 PM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-includes/link-template.php
r13865 r13880 2021 2021 2022 2022 /** 2023 * Retrieve the site url for the current network. 2024 * 2025 * Returns the site url with the appropriate protocol, 'https' if 2026 * is_ssl() and 'http' otherwise. If $scheme is 'http' or 'https', is_ssl() is 2027 * overridden. 2028 * 2029 * @package WordPress 2030 * @since 3.0.0 2031 * 2032 * @param string $path Optional. Path relative to the site url. 2033 * @param string $scheme Optional. Scheme to give the site url context. Currently 'http','https', 'login', 'login_post', or 'admin'. 2034 * @return string Site url link with optional path appended. 2035 */ 2036 function network_site_url( $path = '', $scheme = null ) { 2037 $orig_scheme = $scheme; 2038 if ( !in_array($scheme, array('http', 'https')) ) { 2039 if ( ( 'login_post' == $scheme || 'rpc' == $scheme ) && ( force_ssl_login() || force_ssl_admin() ) ) 2040 $scheme = 'https'; 2041 elseif ( ('login' == $scheme) && ( force_ssl_admin() ) ) 2042 $scheme = 'https'; 2043 elseif ( ('admin' == $scheme) && force_ssl_admin() ) 2044 $scheme = 'https'; 2045 else 2046 $scheme = ( is_ssl() ? 'https' : 'http' ); 2047 } 2048 2049 $url = 'http://' . $current_site->domain . $current_site->path; 2050 2051 $url = str_replace( 'http://', "{$scheme}://", $url ); 2052 2053 if ( !empty($path) && is_string($path) && strpos($path, '..') === false ) 2054 $url .= '/' . ltrim($path, '/'); 2055 2056 return apply_filters('network_site_url', $url, $path, $orig_scheme); 2057 } 2058 2059 /** 2060 * Retrieve the home url for the current network. 2061 * 2062 * Returns the home url with the appropriate protocol, 'https' if 2063 * is_ssl() and 'http' otherwise. If $scheme is 'http' or 'https', is_ssl() is 2064 * overridden. 2065 * 2066 * @package WordPress 2067 * @since 3.0.0 2068 * 2069 * @param string $path (optional) Path relative to the home url. 2070 * @param string $scheme (optional) Scheme to give the home url context. Currently 'http','https' 2071 * @return string Home url link with optional path appended. 2072 */ 2073 function network_home_url( $path = '', $scheme = null ) { 2074 $orig_scheme = $scheme; 2075 $scheme = is_ssl() && !is_admin() ? 'https' : 'http'; 2076 2077 $url = 'http://' . $current_site->domain . $current_site->path; 2078 2079 $url = str_replace( 'http://', "$scheme://", $home ); 2080 2081 if ( !empty( $path ) && is_string( $path ) && strpos( $path, '..' ) === false ) 2082 $url .= '/' . ltrim( $path, '/' ); 2083 2084 return apply_filters( 'network_home_url', $url, $path, $orig_scheme); 2085 } 2086 2087 /** 2088 * Retrieve the url to the admin area for the network. 2089 * 2090 * @package WordPress 2091 * @since 3.0.0 2092 * 2093 * @param string $path Optional path relative to the admin url 2094 * @param string $scheme The scheme to use. Default is 'admin', which obeys force_ssl_admin() and is_ssl(). 'http' or 'https' can be passed to force those schemes. 2095 * @return string Admin url link with optional path appended 2096 */ 2097 function network_admin_url( $path = '', $scheme = 'admin' ) { 2098 $url = network_site_url($blog_id, 'wp-admin/', $scheme); 2099 2100 if ( !empty($path) && is_string($path) && strpos($path, '..') === false ) 2101 $url .= ltrim($path, '/'); 2102 2103 return apply_filters('network_admin_url', $url, $path); 2104 } 2105 2106 /** 2023 2107 * Output rel=canonical for singular queries 2024 2108 *
Note: See TracChangeset
for help on using the changeset viewer.