Make WordPress Core

Ticket #9515: link-template.php-trunk-user_trailingslashit.patch

File link-template.php-trunk-user_trailingslashit.patch, 5.1 KB (added by peaceablewhale, 16 years ago)

Updated the patch to fix 9738

  • link-template.php

     
    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 = get_option('home') . '/?p=' . $post->ID;
     157                $permalink = user_trailingslashit(get_option('home')) . '?p=' . $post->ID;
    158158                return apply_filters('post_link', $permalink, $post, $leavename);
    159159        }
    160160}
     
    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 = get_option('home') . "/$link";
     228                $link = trailingslashit(get_option('home')) . "$link";
    229229                $link = user_trailingslashit($link, 'page');
    230230        } else {
    231                 $link = get_option('home') . "/?page_id=$id";
     231                $link = user_trailingslashit(get_option('home')) . "?page_id=$id";
    232232        }
    233233
    234234        return apply_filters( '_get_page_link', $link, $id );
     
    269269        }
    270270
    271271        if (! $link ) {
    272                 $link = get_bloginfo('url') . "/?attachment_id=$id";
     272                $link = user_trailingslashit(get_bloginfo('url')) . "?attachment_id=$id";
    273273        }
    274274
    275275        return apply_filters('attachment_link', $link, $id);
     
    292292                $yearlink = str_replace('%year%', $year, $yearlink);
    293293                return apply_filters('year_link', get_option('home') . user_trailingslashit($yearlink, 'year'), $year);
    294294        } else {
    295                 return apply_filters('year_link', get_option('home') . '/?m=' . $year, $year);
     295                return apply_filters('year_link', user_trailingslashit(get_option('home')) . '?m=' . $year, $year);
    296296        }
    297297}
    298298
     
    317317                $monthlink = str_replace('%monthnum%', zeroise(intval($month), 2), $monthlink);
    318318                return apply_filters('month_link', get_option('home') . user_trailingslashit($monthlink, 'month'), $year, $month);
    319319        } else {
    320                 return apply_filters('month_link', get_option('home') . '/?m=' . $year . zeroise($month, 2), $year, $month);
     320                return apply_filters('month_link', user_trailingslashit(get_option('home')) . '?m=' . $year . zeroise($month, 2), $year, $month);
    321321        }
    322322}
    323323
     
    347347                $daylink = str_replace('%day%', zeroise(intval($day), 2), $daylink);
    348348                return apply_filters('day_link', get_option('home') . user_trailingslashit($daylink, 'day'), $year, $month, $day);
    349349        } else {
    350                 return apply_filters('day_link', get_option('home') . '/?m=' . $year . zeroise($month, 2) . zeroise($day, 2), $year, $month, $day);
     350                return apply_filters('day_link', user_trailingslashit(get_option('home')) . '?m=' . $year . zeroise($month, 2) . zeroise($day, 2), $year, $month, $day);
    351351        }
    352352}
    353353
     
    382382                if ( false !== strpos($feed, 'comments_') )
    383383                        $feed = str_replace('comments_', 'comments-', $feed);
    384384
    385                 $output = get_option('home') . "/?feed={$feed}";
     385                $output = user_trailingslashit(get_option('home')) . "?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 = get_option('home') . "/?feed=$feed&page_id=$post_id";
     417                        $url = user_trailingslashit(get_option('home')) . "?feed=$feed&page_id=$post_id";
    418418                else
    419                         $url = get_option('home') . "/?feed=$feed&p=$post_id";
     419                        $url = user_trailingslashit(get_option('home')) . "?feed=$feed&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 = get_option('home') . "?feed=$feed&author=" . $author_id;
     471                $link = user_trailingslashit(get_option('home')) . "?feed=$feed&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&cat=" . $cat_id;
     515                $link = user_trailingslashit(get_option('home')) . "?feed=$feed&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 = get_option('home') . "?feed=$feed&tag=" . $tag->slug;
     554                $link = user_trailingslashit(get_option('home')) . "?feed=$feed&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 = get_option('home') . "?s=$search&feed=$feed";
     629        $link = user_trailingslashit(get_option('home')) . "?s=$search&feed=$feed";
    630630
    631631        $link = apply_filters('search_feed_link', $link);
    632632
     
    651651        if ( empty($feed) )
    652652                $feed = get_default_feed();
    653653
    654         $link = get_option('home') . "?s=$search&feed=comments-$feed";
     654        $link = user_trailingslashit(get_option('home')) . "?s=$search&feed=comments-$feed";
    655655
    656656        $link = apply_filters('search_feed_link', $link);
    657657