Changeset 19870
- Timestamp:
- 02/08/2012 04:09:41 PM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-includes/link-template.php
r19712 r19870 1835 1835 * 1836 1836 * @param string $path (optional) Path relative to the home url. 1837 * @param string $scheme (optional) Scheme to give the home url context. Currently 'http', 'https' .1837 * @param string $scheme (optional) Scheme to give the home url context. Currently 'http', 'https', or 'relative'. 1838 1838 * @return string Home url link with optional path appended. 1839 1839 */ … … 1854 1854 * @param int $blog_id (optional) Blog ID. Defaults to current blog. 1855 1855 * @param string $path (optional) Path relative to the home url. 1856 * @param string $scheme (optional) Scheme to give the home url context. Currently 'http', 'https' .1856 * @param string $scheme (optional) Scheme to give the home url context. Currently 'http', 'https', or 'relative'. 1857 1857 * @return string Home url link with optional path appended. 1858 1858 */ … … 1860 1860 $orig_scheme = $scheme; 1861 1861 1862 if ( !in_array( $scheme, array( 'http', 'https' ) ) )1862 if ( !in_array( $scheme, array( 'http', 'https', 'relative' ) ) ) 1863 1863 $scheme = is_ssl() && !is_admin() ? 'https' : 'http'; 1864 1864 … … 1868 1868 $url = get_blog_option( $blog_id, 'home' ); 1869 1869 1870 if ( 'http' != $scheme ) 1870 if ( 'relative' == $scheme ) 1871 $url = preg_replace( '#^.+://[^/]*#', '', $url ); 1872 elseif ( 'http' != $scheme ) 1871 1873 $url = str_replace( 'http://', "$scheme://", $url ); 1872 1874 … … 1890 1892 * 1891 1893 * @param string $path Optional. Path relative to the site url. 1892 * @param string $scheme Optional. Scheme to give the site url context. Currently 'http', 'https', 'login', 'login_post', or 'admin'.1894 * @param string $scheme Optional. Scheme to give the site url context. Currently 'http', 'https', 'login', 'login_post', 'admin', or 'relative'. 1893 1895 * @return string Site url link with optional path appended. 1894 1896 */ … … 1909 1911 * @param int $blog_id (optional) Blog ID. Defaults to current blog. 1910 1912 * @param string $path Optional. Path relative to the site url. 1911 * @param string $scheme Optional. Scheme to give the site url context. Currently 'http', 'https', 'login', 'login_post', or 'admin'.1913 * @param string $scheme Optional. Scheme to give the site url context. Currently 'http', 'https', 'login', 'login_post', 'admin', or 'relative'. 1912 1914 * @return string Site url link with optional path appended. 1913 1915 */ … … 1915 1917 // should the list of allowed schemes be maintained elsewhere? 1916 1918 $orig_scheme = $scheme; 1917 if ( !in_array( $scheme, array( 'http', 'https' ) ) ) {1919 if ( !in_array( $scheme, array( 'http', 'https', 'relative' ) ) ) { 1918 1920 if ( ( 'login_post' == $scheme || 'rpc' == $scheme ) && ( force_ssl_login() || force_ssl_admin() ) ) 1919 1921 $scheme = 'https'; … … 1931 1933 $url = get_blog_option( $blog_id, 'siteurl' ); 1932 1934 1933 if ( 'http' != $scheme ) 1935 if ( 'relative' == $scheme ) 1936 $url = preg_replace( '#^.+://[^/]*#', '', $url ); 1937 elseif ( 'http' != $scheme ) 1934 1938 $url = str_replace( 'http://', "{$scheme}://", $url ); 1935 1939 … … 2062 2066 * 2063 2067 * @param string $path Optional. Path relative to the site url. 2064 * @param string $scheme Optional. Scheme to give the site url context. Currently 'http', 'https', 'login', 'login_post', or 'admin'.2068 * @param string $scheme Optional. Scheme to give the site url context. Currently 'http', 'https', 'login', 'login_post', 'admin', or 'relative'. 2065 2069 * @return string Site url link with optional path appended. 2066 2070 */ … … 2072 2076 2073 2077 $orig_scheme = $scheme; 2074 if ( !in_array( $scheme, array('http', 'https')) ) {2078 if ( !in_array( $scheme, array( 'http', 'https', 'relative' ) ) ) { 2075 2079 if ( ( 'login_post' == $scheme || 'rpc' == $scheme ) && ( force_ssl_login() || force_ssl_admin() ) ) 2076 2080 $scheme = 'https'; … … 2083 2087 } 2084 2088 2085 $url = $scheme . '://' . $current_site->domain . $current_site->path; 2089 if ( 'relative' == $scheme ) 2090 $url = $current_site->path; 2091 else 2092 $url = $scheme . '://' . $current_site->domain . $current_site->path; 2086 2093 2087 2094 if ( !empty($path) && is_string($path) && strpos($path, '..') === false ) … … 2102 2109 * 2103 2110 * @param string $path (optional) Path relative to the home url. 2104 * @param string $scheme (optional) Scheme to give the home url context. Currently 'http', 'https' .2111 * @param string $scheme (optional) Scheme to give the home url context. Currently 'http', 'https', or 'relative'. 2105 2112 * @return string Home url link with optional path appended. 2106 2113 */ … … 2113 2120 $orig_scheme = $scheme; 2114 2121 2115 if ( !in_array( $scheme, array('http', 'https')) )2122 if ( !in_array( $scheme, array( 'http', 'https', 'relative' ) ) ) 2116 2123 $scheme = is_ssl() && !is_admin() ? 'https' : 'http'; 2117 2124 2118 $url = $scheme . '://' . $current_site->domain . $current_site->path; 2125 if ( 'relative' == $scheme ) 2126 $url = $current_site->path; 2127 else 2128 $url = $scheme . '://' . $current_site->domain . $current_site->path; 2119 2129 2120 2130 if ( !empty( $path ) && is_string( $path ) && strpos( $path, '..' ) === false )
Note: See TracChangeset
for help on using the changeset viewer.