Make WordPress Core

Changeset 22431


Ignore:
Timestamp:
11/07/2012 07:56:10 PM (12 years ago)
Author:
nacin
Message:

Don't return encoded ampersands from get_post_comments_feed_link() to avoid canonical redirect issues. Apply esc_url() when appropriate.

props markjaquith, SergeyBiryukov. fixes #21841.

Location:
trunk/wp-includes
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-includes/deprecated.php

    r22094 r22431  
    12161216function comments_rss() {
    12171217    _deprecated_function( __FUNCTION__, '2.2', 'get_post_comments_feed_link()' );
    1218     return get_post_comments_feed_link();
     1218    return esc_url( get_post_comments_feed_link() );
    12191219}
    12201220
  • trunk/wp-includes/feed-atom-comments.php

    r21332 r22431  
    2929<?php if ( is_singular() ) { ?>
    3030    <link rel="alternate" type="<?php bloginfo_rss('html_type'); ?>" href="<?php comments_link_feed(); ?>" />
    31     <link rel="self" type="application/atom+xml" href="<?php echo get_post_comments_feed_link('', 'atom'); ?>" />
    32     <id><?php echo get_post_comments_feed_link('', 'atom'); ?></id>
     31    <link rel="self" type="application/atom+xml" href="<?php echo esc_url( get_post_comments_feed_link('', 'atom') ); ?>" />
     32    <id><?php echo esc_url( get_post_comments_feed_link('', 'atom') ); ?></id>
    3333<?php } elseif(is_search()) { ?>
    3434    <link rel="alternate" type="<?php bloginfo_rss('html_type'); ?>" href="<?php echo home_url() . '?s=' . get_search_query(); ?>" />
  • trunk/wp-includes/feed-atom.php

    r21289 r22431  
    4949<?php do_action('atom_entry'); ?>
    5050        <link rel="replies" type="<?php bloginfo_rss('html_type'); ?>" href="<?php the_permalink_rss() ?>#comments" thr:count="<?php echo get_comments_number()?>"/>
    51         <link rel="replies" type="application/atom+xml" href="<?php echo get_post_comments_feed_link(0,'atom') ?>" thr:count="<?php echo get_comments_number()?>"/>
     51        <link rel="replies" type="application/atom+xml" href="<?php echo esc_url( get_post_comments_feed_link(0, 'atom') ); ?>" thr:count="<?php echo get_comments_number()?>"/>
    5252        <thr:total><?php echo get_comments_number()?></thr:total>
    5353    </entry>
  • trunk/wp-includes/link-template.php

    r22298 r22431  
    485485        $type = get_post_field('post_type', $post_id);
    486486        if ( 'page' == $type )
    487             $url = home_url("?feed=$feed&amp;page_id=$post_id");
     487            $url = add_query_arg( array( 'feed' => $feed, 'page_id' => $post_id ), home_url( '/' ) );
    488488        else
    489             $url = home_url("?feed=$feed&amp;p=$post_id");
     489            $url = add_query_arg( array( 'feed' => $feed, 'p' => $post_id ), home_url( '/' ) );
    490490    }
    491491
     
    510510*/
    511511function post_comments_feed_link( $link_text = '', $post_id = '', $feed = '' ) {
    512     $url = get_post_comments_feed_link($post_id, $feed);
     512    $url = esc_url( get_post_comments_feed_link( $post_id, $feed ) );
    513513    if ( empty($link_text) )
    514514        $link_text = __('Comments Feed');
  • trunk/wp-includes/theme-compat/comments-popup.php

    r21364 r22431  
    3333<h2 id="comments"><?php _e('Comments'); ?></h2>
    3434
    35 <p><a href="<?php echo get_post_comments_feed_link($post->ID); ?>"><?php _e('<abbr title="Really Simple Syndication">RSS</abbr> feed for comments on this post.'); ?></a></p>
     35<p><a href="<?php echo esc_url( get_post_comments_feed_link($post->ID) ); ?>"><?php _e('<abbr title="Really Simple Syndication">RSS</abbr> feed for comments on this post.'); ?></a></p>
    3636
    3737<?php if ( pings_open() ) { ?>
Note: See TracChangeset for help on using the changeset viewer.