mirror of
https://github.com/WordPress/WordPress.git
synced 2024-12-22 17:18:32 +01:00
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. git-svn-id: http://core.svn.wordpress.org/trunk@22431 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
dc40f18228
commit
30d048a1e7
@ -1215,7 +1215,7 @@ function get_author_rss_link($echo = false, $author_id = 1) {
|
||||
*/
|
||||
function comments_rss() {
|
||||
_deprecated_function( __FUNCTION__, '2.2', 'get_post_comments_feed_link()' );
|
||||
return get_post_comments_feed_link();
|
||||
return esc_url( get_post_comments_feed_link() );
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -28,8 +28,8 @@ echo '<?xml version="1.0" encoding="' . get_option('blog_charset') . '" ?' . '>'
|
||||
|
||||
<?php if ( is_singular() ) { ?>
|
||||
<link rel="alternate" type="<?php bloginfo_rss('html_type'); ?>" href="<?php comments_link_feed(); ?>" />
|
||||
<link rel="self" type="application/atom+xml" href="<?php echo get_post_comments_feed_link('', 'atom'); ?>" />
|
||||
<id><?php echo get_post_comments_feed_link('', 'atom'); ?></id>
|
||||
<link rel="self" type="application/atom+xml" href="<?php echo esc_url( get_post_comments_feed_link('', 'atom') ); ?>" />
|
||||
<id><?php echo esc_url( get_post_comments_feed_link('', 'atom') ); ?></id>
|
||||
<?php } elseif(is_search()) { ?>
|
||||
<link rel="alternate" type="<?php bloginfo_rss('html_type'); ?>" href="<?php echo home_url() . '?s=' . get_search_query(); ?>" />
|
||||
<link rel="self" type="application/atom+xml" href="<?php echo get_search_comments_feed_link('', 'atom'); ?>" />
|
||||
|
@ -48,7 +48,7 @@ echo '<?xml version="1.0" encoding="'.get_option('blog_charset').'"?'.'>'; ?>
|
||||
<?php atom_enclosure(); ?>
|
||||
<?php do_action('atom_entry'); ?>
|
||||
<link rel="replies" type="<?php bloginfo_rss('html_type'); ?>" href="<?php the_permalink_rss() ?>#comments" thr:count="<?php echo get_comments_number()?>"/>
|
||||
<link rel="replies" type="application/atom+xml" href="<?php echo get_post_comments_feed_link(0,'atom') ?>" thr:count="<?php echo get_comments_number()?>"/>
|
||||
<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()?>"/>
|
||||
<thr:total><?php echo get_comments_number()?></thr:total>
|
||||
</entry>
|
||||
<?php endwhile ; ?>
|
||||
|
@ -484,9 +484,9 @@ function get_post_comments_feed_link($post_id = 0, $feed = '') {
|
||||
} else {
|
||||
$type = get_post_field('post_type', $post_id);
|
||||
if ( 'page' == $type )
|
||||
$url = home_url("?feed=$feed&page_id=$post_id");
|
||||
$url = add_query_arg( array( 'feed' => $feed, 'page_id' => $post_id ), home_url( '/' ) );
|
||||
else
|
||||
$url = home_url("?feed=$feed&p=$post_id");
|
||||
$url = add_query_arg( array( 'feed' => $feed, 'p' => $post_id ), home_url( '/' ) );
|
||||
}
|
||||
|
||||
return apply_filters('post_comments_feed_link', $url);
|
||||
@ -509,7 +509,7 @@ function get_post_comments_feed_link($post_id = 0, $feed = '') {
|
||||
* @return string Link to the comment feed for the current post.
|
||||
*/
|
||||
function post_comments_feed_link( $link_text = '', $post_id = '', $feed = '' ) {
|
||||
$url = get_post_comments_feed_link($post_id, $feed);
|
||||
$url = esc_url( get_post_comments_feed_link( $post_id, $feed ) );
|
||||
if ( empty($link_text) )
|
||||
$link_text = __('Comments Feed');
|
||||
|
||||
|
@ -32,7 +32,7 @@ while( have_posts()) : the_post();
|
||||
?>
|
||||
<h2 id="comments"><?php _e('Comments'); ?></h2>
|
||||
|
||||
<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>
|
||||
<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>
|
||||
|
||||
<?php if ( pings_open() ) { ?>
|
||||
<p><?php printf(__('The <abbr title="Universal Resource Locator">URL</abbr> to TrackBack this entry is: <em>%s</em>'), get_trackback_url()); ?></p>
|
||||
|
Loading…
Reference in New Issue
Block a user