WordPress.org

Make WordPress Core

Ticket #18952: 18952.4.patch

File 18952.4.patch, 8.2 KB (added by SergeyBiryukov, 6 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

     
    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 )
     
    19081910function get_site_url( $blog_id = null, $path = '', $scheme = null ) {
    19091911        // should the list of allowed schemes be maintained elsewhere?
    19101912        $orig_scheme = $scheme;
    1911         if ( !in_array( $scheme, array( 'http', 'https' ) ) ) {
     1913        if ( !in_array( $scheme, array( 'http', 'https', 'relative' ) ) ) {
    19121914                if ( ( 'login_post' == $scheme || 'rpc' == $scheme ) && ( force_ssl_login() || force_ssl_admin() ) )
    19131915                        $scheme = 'https';
    19141916                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 )
     
    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, '/');
     
    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>