Ticket #20759: 20759.patch
File 20759.patch, 10.0 KB (added by , 12 years ago) |
---|
-
wp-admin/includes/meta-boxes.php
42 42 $preview_button = __( 'Preview Changes' ); 43 43 } else { 44 44 $preview_link = get_permalink( $post->ID ); 45 if ( is_ssl() ) 46 $preview_link = str_replace( 'http://', 'https://', $preview_link ); 45 $preview_link = set_url_scheme( $preview_link ); 47 46 $preview_link = esc_url( apply_filters( 'preview_post_link', add_query_arg( 'preview', 'true', $preview_link ) ) ); 48 47 $preview_button = __( 'Preview' ); 49 48 } -
wp-admin/includes/plugin.php
902 902 903 903 if ( empty($icon_url) ) 904 904 $icon_url = esc_url( admin_url( 'images/generic.png' ) ); 905 elseif ( is_ssl() && 0 === strpos($icon_url, 'http://') )906 $icon_url = 'https://' . substr($icon_url, 7);905 elseif ( 0 === strpos($icon_url, 'http') ) 906 $icon_url = set_url_scheme( $icon_url ); 907 907 908 908 $new_menu = array( $menu_title, $capability, $menu_slug, $page_title, 'menu-top ' . $hookname, $hookname, $icon_url ); 909 909 -
wp-includes/class-wp-editor.php
209 209 210 210 foreach ( $mce_external_plugins as $name => $url ) { 211 211 212 if ( is_ssl() ) $url = str_replace('http://', 'https://', $url);212 $url = set_url_scheme( $url ); 213 213 214 214 $plugins[] = '-' . $name; 215 215 -
wp-includes/functions.php
2649 2649 function url_is_accessable_via_ssl($url) 2650 2650 { 2651 2651 if (in_array('curl', get_loaded_extensions())) { 2652 $ssl = preg_replace( '/^http:\/\//', 'https://', $url);2652 $ssl = set_url_scheme( $url, 'https' ); 2653 2653 2654 2654 $ch = curl_init(); 2655 2655 curl_setopt($ch, CURLOPT_URL, $ssl); -
wp-includes/link-template.php
1838 1838 * @uses get_home_url() 1839 1839 * 1840 1840 * @param string $path (optional) Path relative to the home url. 1841 * @param string $scheme (optional) Scheme to give the home url context. Currently 'http', 'https', or 'relative'.1841 * @param string $scheme (optional) Scheme to give the home url context. See set_url_scheme(). 1842 1842 * @return string Home url link with optional path appended. 1843 1843 */ 1844 1844 function home_url( $path = '', $scheme = null ) { … … 1857 1857 * 1858 1858 * @param int $blog_id (optional) Blog ID. Defaults to current blog. 1859 1859 * @param string $path (optional) Path relative to the home url. 1860 * @param string $scheme (optional) Scheme to give the home url context. Currently 'http', 'https', or 'relative'.1860 * @param string $scheme (optional) Scheme to give the home url context. See set_url_scheme(). 1861 1861 * @return string Home url link with optional path appended. 1862 1862 */ 1863 1863 function get_home_url( $blog_id = null, $path = '', $scheme = null ) { 1864 $orig_scheme = $scheme;1865 1864 1866 if ( !in_array( $scheme, array( 'http', 'https', 'relative' ) ) )1867 $scheme = is_ssl() && !is_admin() ? 'https' : 'http';1868 1869 1865 if ( empty( $blog_id ) || !is_multisite() ) 1870 1866 $url = get_option( 'home' ); 1871 1867 else 1872 1868 $url = get_blog_option( $blog_id, 'home' ); 1873 1869 1874 if ( 'relative' == $scheme ) 1875 $url = preg_replace( '#^.+://[^/]*#', '', $url ); 1876 elseif ( 'http' != $scheme ) 1877 $url = str_replace( 'http://', "$scheme://", $url ); 1870 $url = set_url_scheme( $url, $scheme ); 1878 1871 1879 1872 if ( !empty( $path ) && is_string( $path ) && strpos( $path, '..' ) === false ) 1880 1873 $url .= '/' . ltrim( $path, '/' ); 1881 1874 1882 return apply_filters( 'home_url', $url, $path, $ orig_scheme, $blog_id );1875 return apply_filters( 'home_url', $url, $path, $scheme, $blog_id ); 1883 1876 } 1884 1877 1885 1878 /** … … 1895 1888 * @uses get_site_url() 1896 1889 * 1897 1890 * @param string $path Optional. Path relative to the site url. 1898 * @param string $scheme Optional. Scheme to give the site url context. Currently 'http', 'https', 'login', 'login_post', 'admin', or 'relative'.1891 * @param string $scheme Optional. Scheme to give the site url context. See set_url_scheme(). 1899 1892 * @return string Site url link with optional path appended. 1900 1893 */ 1901 1894 function site_url( $path = '', $scheme = null ) { … … 1914 1907 * 1915 1908 * @param int $blog_id (optional) Blog ID. Defaults to current blog. 1916 1909 * @param string $path Optional. Path relative to the site url. 1917 * @param string $scheme Optional. Scheme to give the site url context. Currently 'http', 'https', 'login', 'login_post', 'admin', or 'relative'.1910 * @param string $scheme Optional. Scheme to give the site url context. See set_url_scheme(). 1918 1911 * @return string Site url link with optional path appended. 1919 1912 */ 1920 1913 function get_site_url( $blog_id = null, $path = '', $scheme = null ) { 1921 // should the list of allowed schemes be maintained elsewhere?1922 $orig_scheme = $scheme;1923 if ( !in_array( $scheme, array( 'http', 'https', 'relative' ) ) ) {1924 if ( ( 'login_post' == $scheme || 'rpc' == $scheme ) && ( force_ssl_login() || force_ssl_admin() ) )1925 $scheme = 'https';1926 elseif ( ( 'login' == $scheme ) && force_ssl_admin() )1927 $scheme = 'https';1928 elseif ( ( 'admin' == $scheme ) && force_ssl_admin() )1929 $scheme = 'https';1930 else1931 $scheme = ( is_ssl() ? 'https' : 'http' );1932 }1933 1914 1934 1915 if ( empty( $blog_id ) || !is_multisite() ) 1935 1916 $url = get_option( 'siteurl' ); 1936 1917 else 1937 1918 $url = get_blog_option( $blog_id, 'siteurl' ); 1938 1919 1939 if ( 'relative' == $scheme ) 1940 $url = preg_replace( '#^.+://[^/]*#', '', $url ); 1941 elseif ( 'http' != $scheme ) 1942 $url = str_replace( 'http://', "{$scheme}://", $url ); 1920 $url = set_url_scheme( $url, $scheme ); 1943 1921 1944 1922 if ( !empty( $path ) && is_string( $path ) && strpos( $path, '..' ) === false ) 1945 1923 $url .= '/' . ltrim( $path, '/' ); 1946 1924 1947 return apply_filters( 'site_url', $url, $path, $ orig_scheme, $blog_id );1925 return apply_filters( 'site_url', $url, $path, $scheme, $blog_id ); 1948 1926 } 1949 1927 1950 1928 /** … … 2010 1988 */ 2011 1989 function content_url($path = '') { 2012 1990 $url = WP_CONTENT_URL; 2013 if ( 0 === strpos($url, 'http') && is_ssl())2014 $url = s tr_replace( 'http://', 'https://',$url );1991 if ( 0 === strpos($url, 'http') ) 1992 $url = set_scheme_url( $url ); 2015 1993 2016 1994 if ( !empty($path) && is_string($path) && strpos($path, '..') === false ) 2017 1995 $url .= '/' . ltrim($path, '/'); … … 2043 2021 else 2044 2022 $url = WP_PLUGIN_URL; 2045 2023 2046 if ( 0 === strpos($url, 'http') && is_ssl())2047 $url = s tr_replace( 'http://', 'https://',$url );2024 if ( 0 === strpos($url, 'http') ) 2025 $url = set_url_scheme( $url ); 2048 2026 2049 2027 if ( !empty($plugin) && is_string($plugin) ) { 2050 2028 $folder = dirname(plugin_basename($plugin)); … … 2069 2047 * @since 3.0.0 2070 2048 * 2071 2049 * @param string $path Optional. Path relative to the site url. 2072 * @param string $scheme Optional. Scheme to give the site url context. Currently 'http', 'https', 'login', 'login_post', 'admin', or 'relative'.2050 * @param string $scheme Optional. Scheme to give the site url context. See set_url_scheme(). 2073 2051 * @return string Site url link with optional path appended. 2074 2052 */ 2075 2053 function network_site_url( $path = '', $scheme = null ) { … … 2078 2056 if ( !is_multisite() ) 2079 2057 return site_url($path, $scheme); 2080 2058 2081 $orig_scheme = $scheme;2082 if ( !in_array( $scheme, array( 'http', 'https', 'relative' ) ) ) {2083 if ( ( 'login_post' == $scheme || 'rpc' == $scheme ) && ( force_ssl_login() || force_ssl_admin() ) )2084 $scheme = 'https';2085 elseif ( ('login' == $scheme) && ( force_ssl_admin() ) )2086 $scheme = 'https';2087 elseif ( ('admin' == $scheme) && force_ssl_admin() )2088 $scheme = 'https';2089 else2090 $scheme = ( is_ssl() ? 'https' : 'http' );2091 }2092 2093 2059 if ( 'relative' == $scheme ) 2094 2060 $url = $current_site->path; 2095 2061 else 2096 $url = $scheme . '://' . $current_site->domain . $current_site->path;2062 $url = set_url_scheme( 'http://' . $current_site->domain . $current_site->path, $scheme ); 2097 2063 2098 2064 if ( !empty($path) && is_string($path) && strpos($path, '..') === false ) 2099 2065 $url .= ltrim($path, '/'); 2100 2066 2101 return apply_filters('network_site_url', $url, $path, $ orig_scheme);2067 return apply_filters('network_site_url', $url, $path, $scheme); 2102 2068 } 2103 2069 2104 2070 /** … … 2112 2078 * @since 3.0.0 2113 2079 * 2114 2080 * @param string $path (optional) Path relative to the home url. 2115 * @param string $scheme (optional) Scheme to give the home url context. Currently 'http', 'https', or 'relative'.2081 * @param string $scheme (optional) Scheme to give the home url context. See set_url_scheme(). 2116 2082 * @return string Home url link with optional path appended. 2117 2083 */ 2118 2084 function network_home_url( $path = '', $scheme = null ) { … … 2121 2087 if ( !is_multisite() ) 2122 2088 return home_url($path, $scheme); 2123 2089 2124 $orig_scheme = $scheme;2125 2126 if ( !in_array( $scheme, array( 'http', 'https', 'relative' ) ) )2127 $scheme = is_ssl() && !is_admin() ? 'https' : 'http';2128 2129 2090 if ( 'relative' == $scheme ) 2130 2091 $url = $current_site->path; 2131 2092 else 2132 $url = $scheme . '://' . $current_site->domain . $current_site->path;2093 $url = set_url_scheme( 'http://' . $current_site->domain . $current_site->path, $scheme ); 2133 2094 2134 2095 if ( !empty( $path ) && is_string( $path ) && strpos( $path, '..' ) === false ) 2135 2096 $url .= ltrim( $path, '/' ); 2136 2097 2137 return apply_filters( 'network_home_url', $url, $path, $ orig_scheme);2098 return apply_filters( 'network_home_url', $url, $path, $scheme); 2138 2099 } 2139 2100 2140 2101 /** -
wp-includes/theme.php
869 869 if ( is_random_header_image() ) 870 870 $url = get_random_header_image(); 871 871 872 if ( is_ssl() ) 873 $url = str_replace( 'http://', 'https://', $url ); 874 else 875 $url = str_replace( 'https://', 'http://', $url ); 872 $url = set_url_scheme( $url ); 876 873 877 874 return esc_url_raw( $url ); 878 875 }