Make WordPress Core

Ticket #9515: link-template.php-2.7-trailingslashit.patch

File link-template.php-2.7-trailingslashit.patch, 5.0 KB (added by peaceablewhale, 16 years ago)

patch for the 2.7 branch, using trailingslashit

  • link-template.php

     
    151151                $permalink = user_trailingslashit($permalink, 'single');
    152152                return apply_filters('post_link', $permalink, $post, $leavename);
    153153        } else { // if they're not using the fancy permalink option
    154                 $permalink = get_option('home') . '/?p=' . $post->ID;
     154                $permalink = trailingslashit(get_option('home')) . '?p=' . $post->ID;
    155155                return apply_filters('post_link', $permalink, $post, $leavename);
    156156        }
    157157}
     
    220220        if ( '' != $pagestruct && isset($post->post_status) && 'draft' != $post->post_status ) {
    221221                $link = get_page_uri($id);
    222222                $link = ( $leavename ) ? $pagestruct : str_replace('%pagename%', $link, $pagestruct);
    223                 $link = get_option('home') . "/$link";
     223                $link = trailingslashit(get_option('home')) . "$link";
    224224                $link = user_trailingslashit($link, 'page');
    225225        } else {
    226                 $link = get_option('home') . "/?page_id=$id";
     226                $link = trailingslashit(get_option('home')) . "?page_id=$id";
    227227        }
    228228
    229229        return apply_filters( '_get_page_link', $link, $id );
     
    264264        }
    265265
    266266        if (! $link ) {
    267                 $link = get_bloginfo('url') . "/?attachment_id=$id";
     267                $link = trailingslashit(get_bloginfo('url')) . "?attachment_id=$id";
    268268        }
    269269
    270270        return apply_filters('attachment_link', $link, $id);
     
    287287                $yearlink = str_replace('%year%', $year, $yearlink);
    288288                return apply_filters('year_link', get_option('home') . user_trailingslashit($yearlink, 'year'), $year);
    289289        } else {
    290                 return apply_filters('year_link', get_option('home') . '/?m=' . $year, $year);
     290                return apply_filters('year_link', trailingslashit(get_option('home')) . '?m=' . $year, $year);
    291291        }
    292292}
    293293
     
    312312                $monthlink = str_replace('%monthnum%', zeroise(intval($month), 2), $monthlink);
    313313                return apply_filters('month_link', get_option('home') . user_trailingslashit($monthlink, 'month'), $year, $month);
    314314        } else {
    315                 return apply_filters('month_link', get_option('home') . '/?m=' . $year . zeroise($month, 2), $year, $month);
     315                return apply_filters('month_link', trailingslashit(get_option('home')) . '?m=' . $year . zeroise($month, 2), $year, $month);
    316316        }
    317317}
    318318
     
    342342                $daylink = str_replace('%day%', zeroise(intval($day), 2), $daylink);
    343343                return apply_filters('day_link', get_option('home') . user_trailingslashit($daylink, 'day'), $year, $month, $day);
    344344        } else {
    345                 return apply_filters('day_link', get_option('home') . '/?m=' . $year . zeroise($month, 2) . zeroise($day, 2), $year, $month, $day);
     345                return apply_filters('day_link', trailingslashit(get_option('home')) . '?m=' . $year . zeroise($month, 2) . zeroise($day, 2), $year, $month, $day);
    346346        }
    347347}
    348348
     
    377377                if ( false !== strpos($feed, 'comments_') )
    378378                        $feed = str_replace('comments_', 'comments-', $feed);
    379379
    380                 $output = get_option('home') . "/?feed={$feed}";
     380                $output = trailingslashit(get_option('home')) . "?feed={$feed}";
    381381        }
    382382
    383383        return apply_filters('feed_link', $output, $feed);
     
    409409        } else {
    410410                $type = get_post_field('post_type', $post_id);
    411411                if ( 'page' == $type )
    412                         $url = get_option('home') . "/?feed=$feed&page_id=$post_id";
     412                        $url = trailingslashit(get_option('home')) . "?feed=$feed&page_id=$post_id";
    413413                else
    414                         $url = get_option('home') . "/?feed=$feed&p=$post_id";
     414                        $url = trailingslashit(get_option('home')) . "?feed=$feed&p=$post_id";
    415415        }
    416416
    417417        return apply_filters('post_comments_feed_link', $url);
     
    463463                $feed = get_default_feed();
    464464
    465465        if ( '' == $permalink_structure ) {
    466                 $link = get_option('home') . "?feed=$feed&author=" . $author_id;
     466                $link = trailingslashit(get_option('home')) . "?feed=$feed&author=" . $author_id;
    467467        } else {
    468468                $link = get_author_posts_url($author_id);
    469469                if ( $feed == get_default_feed() )
     
    507507        $permalink_structure = get_option('permalink_structure');
    508508
    509509        if ( '' == $permalink_structure ) {
    510                 $link = get_option('home') . "?feed=$feed&cat=" . $cat_id;
     510                $link = trailingslashit(get_option('home')) . "?feed=$feed&cat=" . $cat_id;
    511511        } else {
    512512                $link = get_category_link($cat_id);
    513513                if( $feed == get_default_feed() )
     
    546546                $feed = get_default_feed();
    547547
    548548        if ( '' == $permalink_structure ) {
    549                 $link = get_option('home') . "?feed=$feed&tag=" . $tag->slug;
     549                $link = trailingslashit(get_option('home')) . "?feed=$feed&tag=" . $tag->slug;
    550550        } else {
    551551                $link = get_tag_link($tag->term_id);
    552552                if ( $feed == get_default_feed() )
     
    621621        if ( empty($feed) )
    622622                $feed = get_default_feed();
    623623
    624         $link = get_option('home') . "?s=$search&feed=$feed";
     624        $link = trailingslashit(get_option('home')) . "?s=$search&feed=$feed";
    625625
    626626        $link = apply_filters('search_feed_link', $link);
    627627
     
    646646        if ( empty($feed) )
    647647                $feed = get_default_feed();
    648648
    649         $link = get_option('home') . "?s=$search&feed=comments-$feed";
     649        $link = trailingslashit(get_option('home')) . "?s=$search&feed=comments-$feed";
    650650
    651651        $link = apply_filters('search_feed_link', $link);
    652652