Changes in trunk/wp-includes/link-template.php [19054:20944]
- File:
-
- 1 edited
-
trunk/wp-includes/link-template.php (modified) (24 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-includes/link-template.php
r19054 r20944 508 508 * 509 509 * @param string $link_text Descriptive text. 510 * @param int $post_id Optional post ID. Default to current post.510 * @param int $post_id Optional post ID. Default to current post. 511 511 * @param string $feed Optional. Feed format. 512 512 * @return string Link to the comment feed for the current post. … … 590 590 */ 591 591 function get_term_feed_link( $term_id, $taxonomy = 'category', $feed = '' ) { 592 global $wp_rewrite;593 594 592 $term_id = ( int ) $term_id; 595 593 … … 631 629 $link = apply_filters( 'taxonomy_feed_link', $link, $feed, $taxonomy ); 632 630 633 634 631 return $link; 635 632 } … … 1376 1373 * 1377 1374 * @param int $pagenum Optional. Page ID. 1378 * @return string 1379 */ 1380 function get_pagenum_link($pagenum = 1) { 1375 * @param bool $escape Optional. Whether to escape the URL for display, with esc_url(). Defaults to true. 1376 * Otherwise, prepares the URL with esc_url_raw(). 1377 * @return string 1378 */ 1379 function get_pagenum_link($pagenum = 1, $escape = true ) { 1381 1380 global $wp_rewrite; 1382 1381 … … 1429 1428 $result = apply_filters('get_pagenum_link', $result); 1430 1429 1431 return $result; 1430 if ( $escape ) 1431 return esc_url( $result ); 1432 else 1433 return esc_url_raw( $result ); 1432 1434 } 1433 1435 … … 1567 1569 if ( !is_single() && $paged > 1 ) { 1568 1570 $attr = apply_filters( 'previous_posts_link_attributes', '' ); 1569 return '<a href="' . previous_posts( false ) . "\" $attr>". preg_replace( '/&([^#])(?![a-z]{1,8};)/ ', '&$1', $label ) .'</a>';1571 return '<a href="' . previous_posts( false ) . "\" $attr>". preg_replace( '/&([^#])(?![a-z]{1,8};)/i', '&$1', $label ) .'</a>'; 1570 1572 } 1571 1573 } … … 1794 1796 1795 1797 /** 1796 * Retrieve shortcut link.1798 * Retrieve the Press This bookmarklet link. 1797 1799 * 1798 1800 * Use this in 'a' element 'href' attribute. … … 1803 1805 */ 1804 1806 function get_shortcut_link() { 1807 // In case of breaking changes, version this. #WP20071 1805 1808 $link = "javascript: 1806 1809 var d=document, … … 1836 1839 * 1837 1840 * @param string $path (optional) Path relative to the home url. 1838 * @param string $scheme (optional) Scheme to give the home url context. Currently 'http', 'https' .1841 * @param string $scheme (optional) Scheme to give the home url context. Currently 'http', 'https', or 'relative'. 1839 1842 * @return string Home url link with optional path appended. 1840 1843 */ … … 1855 1858 * @param int $blog_id (optional) Blog ID. Defaults to current blog. 1856 1859 * @param string $path (optional) Path relative to the home url. 1857 * @param string $scheme (optional) Scheme to give the home url context. Currently 'http', 'https' .1860 * @param string $scheme (optional) Scheme to give the home url context. Currently 'http', 'https', or 'relative'. 1858 1861 * @return string Home url link with optional path appended. 1859 1862 */ … … 1861 1864 $orig_scheme = $scheme; 1862 1865 1863 if ( !in_array( $scheme, array( 'http', 'https' ) ) )1866 if ( !in_array( $scheme, array( 'http', 'https', 'relative' ) ) ) 1864 1867 $scheme = is_ssl() && !is_admin() ? 'https' : 'http'; 1865 1868 … … 1869 1872 $url = get_blog_option( $blog_id, 'home' ); 1870 1873 1871 if ( 'http' != $scheme ) 1874 if ( 'relative' == $scheme ) 1875 $url = preg_replace( '#^.+://[^/]*#', '', $url ); 1876 elseif ( 'http' != $scheme ) 1872 1877 $url = str_replace( 'http://', "$scheme://", $url ); 1873 1878 … … 1891 1896 * 1892 1897 * @param string $path Optional. Path relative to the site url. 1893 * @param string $scheme Optional. Scheme to give the site url context. Currently 'http', 'https', 'login', 'login_post', or 'admin'.1898 * @param string $scheme Optional. Scheme to give the site url context. Currently 'http', 'https', 'login', 'login_post', 'admin', or 'relative'. 1894 1899 * @return string Site url link with optional path appended. 1895 1900 */ … … 1910 1915 * @param int $blog_id (optional) Blog ID. Defaults to current blog. 1911 1916 * @param string $path Optional. Path relative to the site url. 1912 * @param string $scheme Optional. Scheme to give the site url context. Currently 'http', 'https', 'login', 'login_post', or 'admin'.1917 * @param string $scheme Optional. Scheme to give the site url context. Currently 'http', 'https', 'login', 'login_post', 'admin', or 'relative'. 1913 1918 * @return string Site url link with optional path appended. 1914 1919 */ … … 1916 1921 // should the list of allowed schemes be maintained elsewhere? 1917 1922 $orig_scheme = $scheme; 1918 if ( !in_array( $scheme, array( 'http', 'https' ) ) ) {1923 if ( !in_array( $scheme, array( 'http', 'https', 'relative' ) ) ) { 1919 1924 if ( ( 'login_post' == $scheme || 'rpc' == $scheme ) && ( force_ssl_login() || force_ssl_admin() ) ) 1920 1925 $scheme = 'https'; … … 1932 1937 $url = get_blog_option( $blog_id, 'siteurl' ); 1933 1938 1934 if ( 'http' != $scheme ) 1939 if ( 'relative' == $scheme ) 1940 $url = preg_replace( '#^.+://[^/]*#', '', $url ); 1941 elseif ( 'http' != $scheme ) 1935 1942 $url = str_replace( 'http://', "{$scheme}://", $url ); 1936 1943 … … 2063 2070 * 2064 2071 * @param string $path Optional. Path relative to the site url. 2065 * @param string $scheme Optional. Scheme to give the site url context. Currently 'http', 'https', 'login', 'login_post', or 'admin'.2072 * @param string $scheme Optional. Scheme to give the site url context. Currently 'http', 'https', 'login', 'login_post', 'admin', or 'relative'. 2066 2073 * @return string Site url link with optional path appended. 2067 2074 */ … … 2073 2080 2074 2081 $orig_scheme = $scheme; 2075 if ( !in_array( $scheme, array('http', 'https')) ) {2082 if ( !in_array( $scheme, array( 'http', 'https', 'relative' ) ) ) { 2076 2083 if ( ( 'login_post' == $scheme || 'rpc' == $scheme ) && ( force_ssl_login() || force_ssl_admin() ) ) 2077 2084 $scheme = 'https'; … … 2084 2091 } 2085 2092 2086 $url = $scheme . '://' . $current_site->domain . $current_site->path; 2093 if ( 'relative' == $scheme ) 2094 $url = $current_site->path; 2095 else 2096 $url = $scheme . '://' . $current_site->domain . $current_site->path; 2087 2097 2088 2098 if ( !empty($path) && is_string($path) && strpos($path, '..') === false ) … … 2103 2113 * 2104 2114 * @param string $path (optional) Path relative to the home url. 2105 * @param string $scheme (optional) Scheme to give the home url context. Currently 'http', 'https' .2115 * @param string $scheme (optional) Scheme to give the home url context. Currently 'http', 'https', or 'relative'. 2106 2116 * @return string Home url link with optional path appended. 2107 2117 */ … … 2114 2124 $orig_scheme = $scheme; 2115 2125 2116 if ( !in_array( $scheme, array('http', 'https')) )2126 if ( !in_array( $scheme, array( 'http', 'https', 'relative' ) ) ) 2117 2127 $scheme = is_ssl() && !is_admin() ? 'https' : 'http'; 2118 2128 2119 $url = $scheme . '://' . $current_site->domain . $current_site->path; 2129 if ( 'relative' == $scheme ) 2130 $url = $current_site->path; 2131 else 2132 $url = $scheme . '://' . $current_site->domain . $current_site->path; 2120 2133 2121 2134 if ( !empty( $path ) && is_string( $path ) && strpos( $path, '..' ) === false ) … … 2186 2199 2187 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 /** 2188 2231 * Get the URL to the user's dashboard. 2189 2232 * 2190 * If a user does not belong to any site, the global user dashboard is used. If the user belongs to the current site,2233 * If a user does not belong to any site, the global user dashboard is used. If the user belongs to the current site, 2191 2234 * the dashboard for the current site is returned. If the user cannot edit the current site, the dashboard to the user's 2192 2235 * primary blog is returned. … … 2365 2408 2366 2409 if ( empty( $title ) ) 2367 $title = the_title_attribute( array( 'echo' => FALSE) );2410 $title = the_title_attribute( array( 'echo' => false ) ); 2368 2411 2369 2412 $shortlink = wp_get_shortlink( $post->ID ); … … 2375 2418 } 2376 2419 } 2377 2378 ?>
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)