Changeset 12978 for trunk/wp-includes/link-template.php
- Timestamp:
- 02/05/2010 09:49:19 PM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-includes/link-template.php
r12971 r12978 1733 1733 1734 1734 /** 1735 * Retrieve the home url .1735 * Retrieve the home url for the current site. 1736 1736 * 1737 1737 * Returns the 'home' option with the appropriate protocol, 'https' if … … 1740 1740 * 1741 1741 * @package WordPress 1742 * @since 3.0 1742 * @since 3.0.0 1743 * 1744 * @uses get_home_url() 1743 1745 * 1744 1746 * @param string $path (optional) Path relative to the home url. … … 1747 1749 */ 1748 1750 function home_url( $path = '', $scheme = null ) { 1751 return get_home_url(null, $path, $scheme); 1752 } 1753 1754 /** 1755 * Retrieve the home url for a given site. 1756 * 1757 * Returns the 'home' option with the appropriate protocol, 'https' if 1758 * is_ssl() and 'http' otherwise. If $scheme is 'http' or 'https', is_ssl() is 1759 * overridden. 1760 * 1761 * @package WordPress 1762 * @since 3.0.0 1763 * 1764 * @param int $blog_id (optional) Blog ID. Defaults to current blog. 1765 * @param string $path (optional) Path relative to the home url. 1766 * @param string $scheme (optional) Scheme to give the home url context. Currently 'http','https' 1767 * @return string Home url link with optional path appended. 1768 */ 1769 function get_home_url( $blog_id = null, $path = '', $scheme = null ) { 1749 1770 $orig_scheme = $scheme; 1750 1771 $scheme = is_ssl() && !is_admin() ? 'https' : 'http'; 1751 $url = str_replace( 'http://', "$scheme://", get_option('home') ); 1772 1773 if ( empty($blog_id) || !is_multisite() ) 1774 $home = get_option('home'); 1775 else 1776 $home = untrailingslashit(get_blogaddress_by_id($blog_id)); 1777 1778 $url = str_replace( 'http://', "$scheme://", $home ); 1752 1779 1753 1780 if ( !empty( $path ) && is_string( $path ) && strpos( $path, '..' ) === false ) 1754 1781 $url .= '/' . ltrim( $path, '/' ); 1755 1782 1756 return apply_filters( 'home_url', $url, $path, $orig_scheme );1757 } 1758 1759 /** 1760 * Retrieve the site url .1783 return apply_filters( 'home_url', $url, $path, $orig_scheme, $blog_id ); 1784 } 1785 1786 /** 1787 * Retrieve the site url for the current site. 1761 1788 * 1762 1789 * Returns the 'site_url' option with the appropriate protocol, 'https' if … … 1766 1793 * @package WordPress 1767 1794 * @since 2.6.0 1795 * 1796 * @uses get_site_url() 1768 1797 * 1769 1798 * @param string $path Optional. Path relative to the site url. … … 1771 1800 * @return string Site url link with optional path appended. 1772 1801 */ 1773 function site_url($path = '', $scheme = null) { 1802 function site_url( $path = '', $scheme = null ) { 1803 return get_site_url(null, $path, $scheme); 1804 } 1805 1806 /** 1807 * Retrieve the site url for a given site. 1808 * 1809 * Returns the 'site_url' option with the appropriate protocol, 'https' if 1810 * is_ssl() and 'http' otherwise. If $scheme is 'http' or 'https', is_ssl() is 1811 * overridden. 1812 * 1813 * @package WordPress 1814 * @since 3.0.0 1815 * 1816 * @param int $blog_id (optional) Blog ID. Defaults to current blog. 1817 * @param string $path Optional. Path relative to the site url. 1818 * @param string $scheme Optional. Scheme to give the site url context. Currently 'http','https', 'login', 'login_post', or 'admin'. 1819 * @return string Site url link with optional path appended. 1820 */ 1821 function get_site_url( $blog_id = null, $path = '', $scheme = null ) { 1774 1822 // should the list of allowed schemes be maintained elsewhere? 1775 1823 $orig_scheme = $scheme; … … 1785 1833 } 1786 1834 1787 $url = str_replace( 'http://', "{$scheme}://", get_option('siteurl') ); 1835 if ( empty($blog_id) || !is_multisite() ) 1836 $url = get_option('siteurl'); 1837 else 1838 $url = untrailingslashit(get_blogaddress_by_id($blog_id)); 1839 1840 $url = str_replace( 'http://', "{$scheme}://", $url ); 1788 1841 1789 1842 if ( !empty($path) && is_string($path) && strpos($path, '..') === false ) 1790 1843 $url .= '/' . ltrim($path, '/'); 1791 1844 1792 return apply_filters('site_url', $url, $path, $orig_scheme );1793 } 1794 1795 /** 1796 * Retrieve the url to the admin area .1845 return apply_filters('site_url', $url, $path, $orig_scheme, $blog_id); 1846 } 1847 1848 /** 1849 * Retrieve the url to the admin area for the current site. 1797 1850 * 1798 1851 * @package WordPress … … 1802 1855 * @return string Admin url link with optional path appended 1803 1856 */ 1804 function admin_url($path = '') { 1805 $url = site_url('wp-admin/', 'admin'); 1857 function admin_url( $path = '' ) { 1858 return get_admin_url(null, $path); 1859 } 1860 1861 /** 1862 * Retrieve the url to the admin area for a given site. 1863 * 1864 * @package WordPress 1865 * @since 3.0.0 1866 * 1867 * @param int $blog_id (optional) Blog ID. Defaults to current blog. 1868 * @param string $path Optional path relative to the admin url 1869 * @return string Admin url link with optional path appended 1870 */ 1871 function get_admin_url( $blog_id = null, $path = '' ) { 1872 $url = get_site_url($blog_id, 'wp-admin/', 'admin'); 1806 1873 1807 1874 if ( !empty($path) && is_string($path) && strpos($path, '..') === false ) 1808 1875 $url .= ltrim($path, '/'); 1809 1876 1810 return apply_filters('admin_url', $url, $path );1877 return apply_filters('admin_url', $url, $path, $blog_id); 1811 1878 } 1812 1879
Note: See TracChangeset
for help on using the changeset viewer.