Make WordPress Core

Ticket #18952: 18952.5.patch

File 18952.5.patch, 11.0 KB (added by SergeyBiryukov, 13 years ago)
  • wp-admin/admin-header.php

     
    5555                'uid': '<?php if ( ! isset($current_user) ) $current_user = wp_get_current_user(); echo $current_user->ID; ?>',
    5656                'time':'<?php echo time() ?>'
    5757        },
    58         ajaxurl = '<?php echo admin_url('admin-ajax.php'); ?>',
     58        ajaxurl = '<?php echo admin_url( 'admin-ajax.php', 'relative' ); ?>',
    5959        pagenow = '<?php echo $current_screen->id; ?>',
    6060        typenow = '<?php echo $current_screen->post_type; ?>',
    6161        adminpage = '<?php echo $admin_body_class; ?>',
  • wp-admin/includes/image-edit.php

     
    6767        <input type="hidden" id="imgedit-y-<?php echo $post_id; ?>" value="<?php echo $meta['height']; ?>" />
    6868
    6969        <div id="imgedit-crop-<?php echo $post_id; ?>" class="imgedit-crop-wrap">
    70         <img id="image-preview-<?php echo $post_id; ?>" onload="imageEdit.imgLoaded('<?php echo $post_id; ?>')" src="<?php echo admin_url('admin-ajax.php'); ?>?action=imgedit-preview&amp;_ajax_nonce=<?php echo $nonce; ?>&amp;postid=<?php echo $post_id; ?>&amp;rand=<?php echo rand(1, 99999); ?>" />
     70        <img id="image-preview-<?php echo $post_id; ?>" onload="imageEdit.imgLoaded('<?php echo $post_id; ?>')" src="<?php echo admin_url( 'admin-ajax.php', 'relative' ); ?>?action=imgedit-preview&amp;_ajax_nonce=<?php echo $nonce; ?>&amp;postid=<?php echo $post_id; ?>&amp;rand=<?php echo rand(1, 99999); ?>" />
    7171        </div>
    7272
    7373        <div class="imgedit-submit">
  • wp-admin/includes/media.php

     
    334334//<![CDATA[
    335335addLoadEvent = function(func){if(typeof jQuery!="undefined")jQuery(document).ready(func);else if(typeof wpOnload!='function'){wpOnload=func;}else{var oldonload=wpOnload;wpOnload=function(){oldonload();func();}}};
    336336var userSettings = {'url':'<?php echo SITECOOKIEPATH; ?>','uid':'<?php if ( ! isset($current_user) ) $current_user = wp_get_current_user(); echo $current_user->ID; ?>','time':'<?php echo time(); ?>'};
    337 var ajaxurl = '<?php echo admin_url('admin-ajax.php'); ?>', pagenow = 'media-upload-popup', adminpage = 'media-upload-popup',
     337var ajaxurl = '<?php echo admin_url( 'admin-ajax.php', 'relative' ); ?>', pagenow = 'media-upload-popup', adminpage = 'media-upload-popup',
    338338isRtl = <?php echo (int) is_rtl(); ?>;
    339339//]]>
    340340</script>
  • wp-admin/includes/template.php

     
    13941394                'uid': '<?php if ( ! isset($current_user) ) $current_user = wp_get_current_user(); echo $current_user->ID; ?>',
    13951395                'time':'<?php echo time() ?>'
    13961396        },
    1397         ajaxurl = '<?php echo admin_url('admin-ajax.php'); ?>',
     1397        ajaxurl = '<?php echo admin_url( 'admin-ajax.php', 'relative' ); ?>',
    13981398        pagenow = '<?php echo $current_screen->id; ?>',
    13991399        typenow = '<?php echo $current_screen->post_type; ?>',
    14001400        adminpage = '<?php echo $admin_body_class; ?>',
  • wp-admin/press-this.php

     
    304304//<![CDATA[
    305305addLoadEvent = function(func){if(typeof jQuery!="undefined")jQuery(document).ready(func);else if(typeof wpOnload!='function'){wpOnload=func;}else{var oldonload=wpOnload;wpOnload=function(){oldonload();func();}}};
    306306var userSettings = {'url':'<?php echo SITECOOKIEPATH; ?>','uid':'<?php if ( ! isset($current_user) ) $current_user = wp_get_current_user(); echo $current_user->ID; ?>','time':'<?php echo time() ?>'};
    307 var ajaxurl = '<?php echo admin_url('admin-ajax.php'); ?>', pagenow = 'press-this', isRtl = <?php echo (int) is_rtl(); ?>;
     307var ajaxurl = '<?php echo admin_url( 'admin-ajax.php', 'relative' ); ?>', pagenow = 'press-this', isRtl = <?php echo (int) is_rtl(); ?>;
    308308var photostorage = false;
    309309//]]>
    310310</script>
  • wp-includes/class-wp-editor.php

     
    584584                }
    585585
    586586                if ( !is_admin() )
    587                         echo 'var ajaxurl = "' . admin_url('admin-ajax.php') . '";';
     587                        echo 'var ajaxurl = "' . admin_url( 'admin-ajax.php', 'relative' ) . '";';
    588588?>
    589589        </script>
    590590<?php
  • wp-includes/link-template.php

     
    18341834 * @uses get_home_url()
    18351835 *
    18361836 * @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'.
    18381838 * @return string Home url link with optional path appended.
    18391839*/
    18401840function home_url( $path = '', $scheme = null ) {
     
    18531853 *
    18541854 * @param  int $blog_id   (optional) Blog ID. Defaults to current blog.
    18551855 * @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'.
    18571857 * @return string Home url link with optional path appended.
    18581858*/
    18591859function get_home_url( $blog_id = null, $path = '', $scheme = null ) {
    18601860        $orig_scheme = $scheme;
    18611861
    1862         if ( !in_array( $scheme, array( 'http', 'https' ) ) )
     1862        if ( !in_array( $scheme, array( 'http', 'https', 'relative' ) ) )
    18631863                $scheme = is_ssl() && !is_admin() ? 'https' : 'http';
    18641864
    18651865        if ( empty( $blog_id ) || !is_multisite() )
     
    18671867        else
    18681868                $url = get_blog_option( $blog_id, 'home' );
    18691869
    1870         if ( 'http' != $scheme )
     1870        if ( 'relative' == $scheme )
     1871                $url = preg_replace( '#^.+://[^/]*#', '', $url );
     1872        elseif ( 'http' != $scheme )
    18711873                $url = str_replace( 'http://', "$scheme://", $url );
    18721874
    18731875        if ( !empty( $path ) && is_string( $path ) && strpos( $path, '..' ) === false )
     
    18891891 * @uses get_site_url()
    18901892 *
    18911893 * @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'.
    18931895 * @return string Site url link with optional path appended.
    18941896*/
    18951897function site_url( $path = '', $scheme = null ) {
     
    19081910 *
    19091911 * @param int $blog_id (optional) Blog ID. Defaults to current blog.
    19101912 * @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'.
    19121914 * @return string Site url link with optional path appended.
    19131915*/
    19141916function get_site_url( $blog_id = null, $path = '', $scheme = null ) {
    19151917        // should the list of allowed schemes be maintained elsewhere?
    19161918        $orig_scheme = $scheme;
    1917         if ( !in_array( $scheme, array( 'http', 'https' ) ) ) {
     1919        if ( !in_array( $scheme, array( 'http', 'https', 'relative' ) ) ) {
    19181920                if ( ( 'login_post' == $scheme || 'rpc' == $scheme ) && ( force_ssl_login() || force_ssl_admin() ) )
    19191921                        $scheme = 'https';
    19201922                elseif ( ( 'login' == $scheme ) && force_ssl_admin() )
     
    19301932        else
    19311933                $url = get_blog_option( $blog_id, 'siteurl' );
    19321934
    1933         if ( 'http' != $scheme )
     1935        if ( 'relative' == $scheme )
     1936                $url = preg_replace( '#^.+://[^/]*#', '', $url );
     1937        elseif ( 'http' != $scheme )
    19341938                $url = str_replace( 'http://', "{$scheme}://", $url );
    19351939
    19361940        if ( !empty( $path ) && is_string( $path ) && strpos( $path, '..' ) === false )
     
    20612065 * @since 3.0.0
    20622066 *
    20632067 * @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'.
    20652069 * @return string Site url link with optional path appended.
    20662070*/
    20672071function network_site_url( $path = '', $scheme = null ) {
     
    20712075                return site_url($path, $scheme);
    20722076
    20732077        $orig_scheme = $scheme;
    2074         if ( !in_array($scheme, array('http', 'https')) ) {
     2078        if ( !in_array( $scheme, array( 'http', 'https', 'relative' ) ) ) {
    20752079                if ( ( 'login_post' == $scheme || 'rpc' == $scheme ) && ( force_ssl_login() || force_ssl_admin() ) )
    20762080                        $scheme = 'https';
    20772081                elseif ( ('login' == $scheme) && ( force_ssl_admin() ) )
     
    20822086                        $scheme = ( is_ssl() ? 'https' : 'http' );
    20832087        }
    20842088
    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;
    20862093
    20872094        if ( !empty($path) && is_string($path) && strpos($path, '..') === false )
    20882095                $url .= ltrim($path, '/');
     
    21012108 * @since 3.0.0
    21022109 *
    21032110 * @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'.
    21052112 * @return string Home url link with optional path appended.
    21062113*/
    21072114function network_home_url( $path = '', $scheme = null ) {
     
    21122119
    21132120        $orig_scheme = $scheme;
    21142121
    2115         if ( !in_array($scheme, array('http', 'https')) )
     2122        if ( !in_array( $scheme, array( 'http', 'https', 'relative' ) ) )
    21162123                $scheme = is_ssl() && !is_admin() ? 'https' : 'http';
    21172124
    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;
    21192129
    21202130        if ( !empty( $path ) && is_string( $path ) && strpos( $path, '..' ) === false )
    21212131                $url .= ltrim( $path, '/' );
  • wp-includes/media.php

     
    10961096<script type="text/javascript">
    10971097/* <![CDATA[ */
    10981098        jQuery(document).ready(function($){
    1099                 $.get("<?php echo admin_url( 'admin-ajax.php?action=oembed-cache&post=' . $post_ID ); ?>");
     1099                $.get("<?php echo admin_url( 'admin-ajax.php?action=oembed-cache&post=' . $post_ID, 'relative' ); ?>");
    11001100        });
    11011101/* ]]> */
    11021102</script>