Ticket #9008: 9008.diff

File 9008.diff, 20.9 KB (added by Denis-de-Bernardy, 4 years ago)
  • wp-includes/post-template.php

     
    822822                $class = ''; 
    823823                if ( is_front_page() && !is_paged() ) 
    824824                        $class = 'class="current_page_item"'; 
    825                 $menu .= '<li ' . $class . '><a href="' . get_option('home') . '">' . $args['link_before'] . $text . $args['link_after'] . '</a></li>'; 
     825                $menu .= '<li ' . $class . '><a href="' . home_url() . '">' . $args['link_before'] . $text . $args['link_after'] . '</a></li>'; 
    826826                // If the front page is a page, add it to the exclude list 
    827827                if (get_option('show_on_front') == 'page') { 
    828828                        if ( !empty( $list_args['exclude'] ) ) { 
  • wp-includes/taxonomy.php

     
    21912191        $slug = $term->slug; 
    21922192 
    21932193        if ( empty($termlink) ) { 
    2194                 $file = get_option('home') . '/'; 
     2194                $file = home_url() . '/'; 
    21952195                $t = get_taxonomy($taxonomy); 
    21962196                if ( $t->query_var ) 
    21972197                        $termlink = "$file?$t->query_var=$slug"; 
     
    21992199                        $termlink = "$file?taxonomy=$taxonomy&term=$slug"; 
    22002200        } else { 
    22012201                $termlink = str_replace("%$taxonomy%", $slug, $termlink); 
    2202                 $termlink = get_option('home') . user_trailingslashit($termlink, 'category'); 
     2202                $termlink = home_url() . user_trailingslashit($termlink, 'category'); 
    22032203        } 
    22042204        return apply_filters('term_link', $termlink, $term, $taxonomy); 
    22052205} 
  • wp-includes/default-widgets.php

     
    447447        var dropdown = document.getElementById("cat"); 
    448448        function onCatChange() { 
    449449                if ( dropdown.options[dropdown.selectedIndex].value > 0 ) { 
    450                         location.href = "<?php echo get_option('home'); ?>/?cat="+dropdown.options[dropdown.selectedIndex].value; 
     450                        location.href = "<?php echo home_url(); ?>/?cat="+dropdown.options[dropdown.selectedIndex].value; 
    451451                } 
    452452        } 
    453453        dropdown.onchange = onCatChange; 
  • wp-includes/comment.php

     
    7878                if ( 'trackback' == $comment_type || 'pingback' == $comment_type ) { // check if domain is in blogroll 
    7979                        $uri = parse_url($url); 
    8080                        $domain = $uri['host']; 
    81                         $uri = parse_url( get_option('home') ); 
     81                        $uri = parse_url( home_url() ); 
    8282                        $home_domain = $uri['host']; 
    8383                        if ( $wpdb->get_var($wpdb->prepare("SELECT link_id FROM $wpdb->links WHERE link_url LIKE (%s) LIMIT 1", '%'.$domain.'%')) || $domain == $home_domain ) 
    8484                                return true; 
     
    15401540 
    15411541        // when set to true, this outputs debug messages by itself 
    15421542        $client->debug = false; 
    1543         $home = trailingslashit( get_option('home') ); 
     1543        $home = trailingslashit( home_url() ); 
    15441544        if ( !$client->query('weblogUpdates.extendedPing', get_option('blogname'), $home, get_bloginfo('rss2_url') ) ) // then try a normal ping 
    15451545                $client->query('weblogUpdates.ping', get_option('blogname'), $home); 
    15461546} 
  • wp-includes/theme.php

     
    921921        if ( 
    922922                ( false !== strpos($matches[3], '/wp-admin/') ) 
    923923        || 
    924                 ( false !== strpos($matches[3], '://') && 0 !== strpos($matches[3], get_option('home')) ) 
     924                ( false !== strpos($matches[3], '://') && 0 !== strpos($matches[3], home_url()) ) 
    925925        || 
    926926                ( false !== strpos($matches[3], '/feed/') ) 
    927927        || 
  • wp-includes/comment-template.php

     
    931931        echo '<a href="'; 
    932932        if ( $wpcommentsjavascript ) { 
    933933                if ( empty( $wpcommentspopupfile ) ) 
    934                         $home = get_option('home'); 
     934                        $home = home_url(); 
    935935                else 
    936936                        $home = get_option('siteurl'); 
    937937                echo $home . '/' . $wpcommentspopupfile . '?comments_popup=' . $id; 
  • wp-includes/feed-atom-comments.php

     
    3232        <link rel="self" type="application/atom+xml" href="<?php echo get_post_comments_feed_link('', 'atom'); ?>" /> 
    3333        <id><?php echo get_post_comments_feed_link('', 'atom'); ?></id> 
    3434<?php } elseif(is_search()) { ?> 
    35         <link rel="alternate" type="<?php bloginfo_rss('html_type'); ?>" href="<?php echo get_option('home') . '?s=' . esc_attr(get_search_query()); ?>" /> 
     35        <link rel="alternate" type="<?php bloginfo_rss('html_type'); ?>" href="<?php echo home_url() . '?s=' . esc_attr(get_search_query()); ?>" /> 
    3636        <link rel="self" type="application/atom+xml" href="<?php echo get_search_comments_feed_link('', 'atom'); ?>" /> 
    3737        <id><?php echo get_search_comments_feed_link('', 'atom'); ?></id> 
    3838<?php } else { ?> 
  • wp-includes/link-template.php

     
    150150                        $author, 
    151151                        $post->post_name, 
    152152                ); 
    153                 $permalink = get_option('home') . str_replace($rewritecode, $rewritereplace, $permalink); 
     153                $permalink = home_url() . str_replace($rewritecode, $rewritereplace, $permalink); 
    154154                $permalink = user_trailingslashit($permalink, 'single'); 
    155155                return apply_filters('post_link', $permalink, $post, $leavename); 
    156156        } else { // if they're not using the fancy permalink option 
    157                 $permalink = trailingslashit(get_option('home')) . '?p=' . $post->ID; 
     157                $permalink = trailingslashit(home_url()) . '?p=' . $post->ID; 
    158158                return apply_filters('post_link', $permalink, $post, $leavename); 
    159159        } 
    160160} 
     
    192192                $id = (int) $post->ID; 
    193193 
    194194        if ( 'page' == get_option('show_on_front') && $id == get_option('page_on_front') ) 
    195                 $link = get_option('home'); 
     195                $link = home_url(); 
    196196        else 
    197197                $link = _get_page_link( $id , $leavename, $sample ); 
    198198 
     
    225225        if ( '' != $pagestruct && ( ( isset($post->post_status) && 'draft' != $post->post_status ) || $sample ) ) { 
    226226                $link = get_page_uri($id); 
    227227                $link = ( $leavename ) ? $pagestruct : str_replace('%pagename%', $link, $pagestruct); 
    228                 $link = trailingslashit(get_option('home')) . "$link"; 
     228                $link = trailingslashit(home_url()) . "$link"; 
    229229                $link = user_trailingslashit($link, 'page'); 
    230230        } else { 
    231                 $link = trailingslashit(get_option('home')) . "?page_id=$id"; 
     231                $link = trailingslashit(home_url()) . "?page_id=$id"; 
    232232        } 
    233233 
    234234        return apply_filters( '_get_page_link', $link, $id ); 
     
    290290        $yearlink = $wp_rewrite->get_year_permastruct(); 
    291291        if ( !empty($yearlink) ) { 
    292292                $yearlink = str_replace('%year%', $year, $yearlink); 
    293                 return apply_filters('year_link', get_option('home') . user_trailingslashit($yearlink, 'year'), $year); 
     293                return apply_filters('year_link', home_url() . user_trailingslashit($yearlink, 'year'), $year); 
    294294        } else { 
    295                 return apply_filters('year_link', trailingslashit(get_option('home')) . '?m=' . $year, $year); 
     295                return apply_filters('year_link', trailingslashit(home_url()) . '?m=' . $year, $year); 
    296296        } 
    297297} 
    298298 
     
    315315        if ( !empty($monthlink) ) { 
    316316                $monthlink = str_replace('%year%', $year, $monthlink); 
    317317                $monthlink = str_replace('%monthnum%', zeroise(intval($month), 2), $monthlink); 
    318                 return apply_filters('month_link', get_option('home') . user_trailingslashit($monthlink, 'month'), $year, $month); 
     318                return apply_filters('month_link', home_url() . user_trailingslashit($monthlink, 'month'), $year, $month); 
    319319        } else { 
    320                 return apply_filters('month_link', trailingslashit(get_option('home')) . '?m=' . $year . zeroise($month, 2), $year, $month); 
     320                return apply_filters('month_link', trailingslashit(home_url()) . '?m=' . $year . zeroise($month, 2), $year, $month); 
    321321        } 
    322322} 
    323323 
     
    345345                $daylink = str_replace('%year%', $year, $daylink); 
    346346                $daylink = str_replace('%monthnum%', zeroise(intval($month), 2), $daylink); 
    347347                $daylink = str_replace('%day%', zeroise(intval($day), 2), $daylink); 
    348                 return apply_filters('day_link', get_option('home') . user_trailingslashit($daylink, 'day'), $year, $month, $day); 
     348                return apply_filters('day_link', home_url() . user_trailingslashit($daylink, 'day'), $year, $month, $day); 
    349349        } else { 
    350                 return apply_filters('day_link', trailingslashit(get_option('home')) . '?m=' . $year . zeroise($month, 2) . zeroise($day, 2), $year, $month, $day); 
     350                return apply_filters('day_link', trailingslashit(home_url()) . '?m=' . $year . zeroise($month, 2) . zeroise($day, 2), $year, $month, $day); 
    351351        } 
    352352} 
    353353 
     
    374374 
    375375                $permalink = str_replace('%feed%', $feed, $permalink); 
    376376                $permalink = preg_replace('#/+#', '/', "/$permalink"); 
    377                 $output =  get_option('home') . user_trailingslashit($permalink, 'feed'); 
     377                $output =  home_url() . user_trailingslashit($permalink, 'feed'); 
    378378        } else { 
    379379                if ( empty($feed) ) 
    380380                        $feed = get_default_feed(); 
     
    382382                if ( false !== strpos($feed, 'comments_') ) 
    383383                        $feed = str_replace('comments_', 'comments-', $feed); 
    384384 
    385                 $output = trailingslashit(get_option('home')) . "?feed={$feed}"; 
     385                $output = trailingslashit(home_url()) . "?feed={$feed}"; 
    386386        } 
    387387 
    388388        return apply_filters('feed_link', $output, $feed); 
     
    414414        } else { 
    415415                $type = get_post_field('post_type', $post_id); 
    416416                if ( 'page' == $type ) 
    417                         $url = trailingslashit(get_option('home')) . "?feed=$feed&amp;page_id=$post_id"; 
     417                        $url = trailingslashit(home_url()) . "?feed=$feed&amp;page_id=$post_id"; 
    418418                else 
    419                         $url = trailingslashit(get_option('home')) . "?feed=$feed&amp;p=$post_id"; 
     419                        $url = trailingslashit(home_url()) . "?feed=$feed&amp;p=$post_id"; 
    420420        } 
    421421 
    422422        return apply_filters('post_comments_feed_link', $url); 
     
    468468                $feed = get_default_feed(); 
    469469 
    470470        if ( '' == $permalink_structure ) { 
    471                 $link = trailingslashit(get_option('home')) . "?feed=$feed&amp;author=" . $author_id; 
     471                $link = trailingslashit(home_url()) . "?feed=$feed&amp;author=" . $author_id; 
    472472        } else { 
    473473                $link = get_author_posts_url($author_id); 
    474474                if ( $feed == get_default_feed() ) 
     
    512512        $permalink_structure = get_option('permalink_structure'); 
    513513 
    514514        if ( '' == $permalink_structure ) { 
    515                 $link = trailingslashit(get_option('home')) . "?feed=$feed&amp;cat=" . $cat_id; 
     515                $link = trailingslashit(home_url()) . "?feed=$feed&amp;cat=" . $cat_id; 
    516516        } else { 
    517517                $link = get_category_link($cat_id); 
    518518                if( $feed == get_default_feed() ) 
     
    551551                $feed = get_default_feed(); 
    552552 
    553553        if ( '' == $permalink_structure ) { 
    554                 $link = trailingslashit(get_option('home')) . "?feed=$feed&amp;tag=" . $tag->slug; 
     554                $link = trailingslashit(home_url()) . "?feed=$feed&amp;tag=" . $tag->slug; 
    555555        } else { 
    556556                $link = get_tag_link($tag->term_id); 
    557557                if ( $feed == get_default_feed() ) 
     
    626626        if ( empty($feed) ) 
    627627                $feed = get_default_feed(); 
    628628 
    629         $link = trailingslashit(get_option('home')) . "?s=$search&amp;feed=$feed"; 
     629        $link = trailingslashit(home_url()) . "?s=$search&amp;feed=$feed"; 
    630630 
    631631        $link = apply_filters('search_feed_link', $link); 
    632632 
     
    651651        if ( empty($feed) ) 
    652652                $feed = get_default_feed(); 
    653653 
    654         $link = trailingslashit(get_option('home')) . "?s=$search&amp;feed=comments-$feed"; 
     654        $link = trailingslashit(home_url()) . "?s=$search&amp;feed=comments-$feed"; 
    655655 
    656656        $link = apply_filters('search_feed_link', $link); 
    657657 
     
    12341234 
    12351235        $request = remove_query_arg( 'paged' ); 
    12361236 
    1237         $home_root = parse_url(get_option('home')); 
     1237        $home_root = parse_url(home_url()); 
    12381238        $home_root = ( isset($home_root['path']) ) ? $home_root['path'] : ''; 
    12391239        $home_root = preg_quote( trailingslashit( $home_root ), '|' ); 
    12401240 
     
    16761676} 
    16771677 
    16781678/** 
     1679 * Retrieve the home url. 
     1680 * 
     1681 * Returns the 'home' option with the appropriate protocol,  'https' if 
     1682 * is_ssl() and 'http' otherwise. If $scheme is 'http' or 'https', is_ssl() is 
     1683 * overridden. 
     1684 * 
     1685 * @package WordPress 
     1686 * @since 2.9.0 
     1687 * 
     1688 * @param string $path Optional. Path relative to the site url. 
     1689 * @param string $scheme Optional. Scheme to give the site url context. Currently 'http','https' 
     1690 * @return string Home url link with optional path appended. 
     1691*/ 
     1692function home_url($path = '', $scheme = null) { 
     1693        $scheme = ( is_ssl() ? 'https' : 'http' ); 
     1694        $url = str_replace( 'http://', "{$scheme}://", home_url() ); 
     1695 
     1696        if ( !empty($path) && is_string($path) && strpos($path, '..') === false ) 
     1697                $url .= '/' . ltrim($path, '/'); 
     1698 
     1699        return apply_filters('home_url', $url, $path, $orig_scheme); 
     1700} 
     1701 
     1702/** 
    16791703 * Retrieve the site url. 
    16801704 * 
    16811705 * Returns the 'site_url' option with the appropriate protocol,  'https' if 
  • wp-includes/author-template.php

     
    199199        $link = $wp_rewrite->get_author_permastruct(); 
    200200 
    201201        if ( empty($link) ) { 
    202                 $file = get_option('home') . '/'; 
     202                $file = home_url() . '/'; 
    203203                $link = $file . '?author=' . $auth_ID; 
    204204        } else { 
    205205                if ( '' == $author_nicename ) { 
     
    208208                                $author_nicename = $user->user_nicename; 
    209209                } 
    210210                $link = str_replace('%author%', $author_nicename, $link); 
    211                 $link = get_option('home') . trailingslashit($link); 
     211                $link = home_url() . trailingslashit($link); 
    212212        } 
    213213 
    214214        $link = apply_filters('author_link', $link, $author_id, $author_nicename); 
  • wp-includes/rewrite.php

     
    256256        $url = $url_split[0]; 
    257257 
    258258        // Add 'www.' if it is absent and should be there 
    259         if ( false !== strpos(get_option('home'), '://www.') && false === strpos($url, '://www.') ) 
     259        if ( false !== strpos(home_url(), '://www.') && false === strpos($url, '://www.') ) 
    260260                $url = str_replace('://', '://www.', $url); 
    261261 
    262262        // Strip 'www.' if it is present and shouldn't be 
    263         if ( false === strpos(get_option('home'), '://www.') ) 
     263        if ( false === strpos(home_url(), '://www.') ) 
    264264                $url = str_replace('://www.', '://', $url); 
    265265 
    266266        // Strip 'index.php/' if we're not using path info permalinks 
    267267        if ( !$wp_rewrite->using_index_permalinks() ) 
    268268                $url = str_replace('index.php/', '', $url); 
    269269 
    270         if ( false !== strpos($url, get_option('home')) ) { 
     270        if ( false !== strpos($url, home_url()) ) { 
    271271                // Chop off http://domain.com 
    272                 $url = str_replace(get_option('home'), '', $url); 
     272                $url = str_replace(home_url(), '', $url); 
    273273        } else { 
    274274                // Chop off /path/to/blog 
    275                 $home_path = parse_url(get_option('home')); 
     275                $home_path = parse_url(home_url()); 
    276276                $home_path = $home_path['path']; 
    277277                $url = str_replace($home_path, '', $url); 
    278278        } 
     
    16411641                        $site_root = trailingslashit($site_root['path']); 
    16421642                } 
    16431643 
    1644                 $home_root = parse_url(get_option('home')); 
     1644                $home_root = parse_url(home_url()); 
    16451645                if ( isset( $home_root['path'] ) ) { 
    16461646                        $home_root = trailingslashit($home_root['path']); 
    16471647                } else { 
  • wp-includes/general-template.php

     
    121121                return; 
    122122        } 
    123123 
    124         $form = '<form role="search" method="get" id="searchform" action="' . get_option('home') . '/" > 
     124        $form = '<form role="search" method="get" id="searchform" action="' . home_url() . '/" > 
    125125        <div><label class="screen-reader-text" for="s">' . __('Search for:') . '</label> 
    126126        <input type="text" value="' . esc_attr(apply_filters('the_search_query', get_search_query())) . '" name="s" id="s" /> 
    127127        <input type="submit" id="searchsubmit" value="'. esc_attr__('Search') .'" /> 
     
    304304                case 'url' : 
    305305                case 'home' : // DEPRECATED 
    306306                case 'siteurl' : // DEPRECATED 
    307                         $output = get_option('home'); 
     307                        $output = home_url(); 
    308308                        break; 
    309309                case 'wpurl' : 
    310310                        $output = get_option('siteurl'); 
     
    888888                                                $arc_week = get_weekstartend($arcresult->yyyymmdd, get_option('start_of_week')); 
    889889                                                $arc_week_start = date_i18n($archive_week_start_date_format, $arc_week['start']); 
    890890                                                $arc_week_end = date_i18n($archive_week_end_date_format, $arc_week['end']); 
    891                                                 $url  = sprintf('%1$s/%2$s%3$sm%4$s%5$s%6$sw%7$s%8$d', get_option('home'), '', '?', '=', $arc_year, '&amp;', '=', $arcresult->week); 
     891                                                $url  = sprintf('%1$s/%2$s%3$sm%4$s%5$s%6$sw%7$s%8$d', home_url(), '', '?', '=', $arc_year, '&amp;', '=', $arcresult->week); 
    892892                                                $text = $arc_week_start . $archive_week_separator . $arc_week_end; 
    893893                                                if ($show_post_count) 
    894894                                                        $after = '&nbsp;('.$arcresult->posts.')'.$afterafter; 
  • wp-includes/canonical.php

     
    192192                $redirect = @parse_url($redirect_url); 
    193193 
    194194        // www.example.com vs example.com 
    195         $user_home = @parse_url(get_option('home')); 
     195        $user_home = @parse_url(home_url()); 
    196196        if ( !empty($user_home['host']) ) 
    197197                $redirect['host'] = $user_home['host']; 
    198198        if ( empty($user_home['path']) ) 
  • wp-includes/classes.php

     
    159159                        $req_uri_array = explode('?', $req_uri); 
    160160                        $req_uri = $req_uri_array[0]; 
    161161                        $self = $_SERVER['PHP_SELF']; 
    162                         $home_path = parse_url(get_option('home')); 
     162                        $home_path = parse_url(home_url()); 
    163163                        if ( isset($home_path['path']) ) 
    164164                                $home_path = $home_path['path']; 
    165165                        else 
  • wp-includes/pluggable.php

     
    926926        $test = ( $cut = strpos($location, '?') ) ? substr( $location, 0, $cut ) : $location; 
    927927 
    928928        $lp  = parse_url($test); 
    929         $wpp = parse_url(get_option('home')); 
     929        $wpp = parse_url(home_url()); 
    930930 
    931931        $allowed_hosts = (array) apply_filters('allowed_redirect_hosts', array($wpp['host']), isset($lp['host']) ? $lp['host'] : ''); 
    932932 
  • wp-includes/feed.php

     
    501501 * @since 2.5 
    502502 */ 
    503503function self_link() { 
    504         $host = @parse_url(get_option('home')); 
     504        $host = @parse_url(home_url()); 
    505505        $host = $host['host']; 
    506506        echo esc_url( 
    507507                'http' 
  • xmlrpc.php

     
    15981598 
    15991599                $struct = array( 
    16001600                        'isAdmin'  => $is_admin, 
    1601                         'url'      => get_option('home') . '/', 
     1601                        'url'      => home_url() . '/', 
    16021602                        'blogid'   => '1', 
    16031603                        'blogName' => get_option('blogname'), 
    16041604                        'xmlrpc'   => site_url( 'xmlrpc.php' ) 
     
    17731773                } 
    17741774 
    17751775                /* warning: here we make the assumption that the blog's URL is on the same server */ 
    1776                 $filename = get_option('home') . '/'; 
     1776                $filename = home_url() . '/'; 
    17771777                $filename = preg_replace('#https?://.+?/#', $_SERVER['DOCUMENT_ROOT'].'/', $filename); 
    17781778 
    17791779                $f = fopen($filename, 'r'); 
     
    18151815                } 
    18161816 
    18171817                /* warning: here we make the assumption that the blog's URL is on the same server */ 
    1818                 $filename = get_option('home') . '/'; 
     1818                $filename = home_url() . '/'; 
    18191819                $filename = preg_replace('#https?://.+?/#', $_SERVER['DOCUMENT_ROOT'].'/', $filename); 
    18201820 
    18211821                if ($f = fopen($filename, 'w+')) { 
     
    32023202                $pagelinkedto = str_replace('&', '&amp;', $pagelinkedto); 
    32033203 
    32043204                // Check if the page linked to is in our site 
    3205                 $pos1 = strpos($pagelinkedto, str_replace(array('http://www.','http://','https://www.','https://'), '', get_option('home'))); 
     3205                $pos1 = strpos($pagelinkedto, str_replace(array('http://www.','http://','https://www.','https://'), '', home_url())); 
    32063206                if( !$pos1 ) 
    32073207                        return new IXR_Error(0, __('Is there no link to us?')); 
    32083208 
  • wp-content/themes/default/header.php

     
    3838 
    3939<div id="header" role="banner"> 
    4040        <div id="headerimg"> 
    41                 <h1><a href="<?php echo get_option('home'); ?>/"><?php bloginfo('name'); ?></a></h1> 
     41                <h1><a href="<?php echo home_url(); ?>/"><?php bloginfo('name'); ?></a></h1> 
    4242                <div class="description"><?php bloginfo('description'); ?></div> 
    4343        </div> 
    4444</div> 
  • wp-settings.php

     
    472472 * @since 1.2.0 
    473473 */ 
    474474if ( !defined('COOKIEPATH') ) 
    475         define('COOKIEPATH', preg_replace('|https?://[^/]+|i', '', get_option('home') . '/' ) ); 
     475        define('COOKIEPATH', preg_replace('|https?://[^/]+|i', '', home_url() . '/' ) ); 
    476476 
    477477/** 
    478478 * It is possible to define this in wp-config.php