Better self links for feeds. Fixes #5238 props andy.
git-svn-id: http://svn.automattic.com/wordpress/trunk@7244 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
a3395b364e
commit
77c0f608c8
|
@ -25,7 +25,7 @@ $more = 1;
|
||||||
|
|
||||||
<link rel="alternate" type="text/html" href="<?php bloginfo_rss('home') ?>" />
|
<link rel="alternate" type="text/html" href="<?php bloginfo_rss('home') ?>" />
|
||||||
<id><?php bloginfo('atom_url'); ?></id>
|
<id><?php bloginfo('atom_url'); ?></id>
|
||||||
<link rel="self" type="application/atom+xml" href="<?php bloginfo('atom_url'); ?>" />
|
<link rel="self" type="application/atom+xml" href="<?php self_link(); ?>" />
|
||||||
|
|
||||||
<?php do_action('atom_head'); ?>
|
<?php do_action('atom_head'); ?>
|
||||||
<?php while (have_posts()) : the_post(); ?>
|
<?php while (have_posts()) : the_post(); ?>
|
||||||
|
|
|
@ -23,7 +23,7 @@ echo '<?xml version="1.0" encoding="'.get_option('blog_charset').'"?'.'>';
|
||||||
else
|
else
|
||||||
printf(__('Comments for %s'), get_bloginfo_rss( 'name' ) . get_wp_title_rss());
|
printf(__('Comments for %s'), get_bloginfo_rss( 'name' ) . get_wp_title_rss());
|
||||||
?></title>
|
?></title>
|
||||||
<atom:link href="<?php bloginfo('comments_rss2_url') ?>" rel="self" type="application/rss+xml" />
|
<atom:link href="<?php self_link(); ?>" rel="self" type="application/rss+xml" />
|
||||||
<link><?php (is_single()) ? the_permalink_rss() : bloginfo_rss("url") ?></link>
|
<link><?php (is_single()) ? the_permalink_rss() : bloginfo_rss("url") ?></link>
|
||||||
<description><?php bloginfo_rss("description") ?></description>
|
<description><?php bloginfo_rss("description") ?></description>
|
||||||
<pubDate><?php echo gmdate('r'); ?></pubDate>
|
<pubDate><?php echo gmdate('r'); ?></pubDate>
|
||||||
|
|
|
@ -21,7 +21,7 @@ $more = 1;
|
||||||
|
|
||||||
<channel>
|
<channel>
|
||||||
<title><?php bloginfo_rss('name'); wp_title_rss(); ?></title>
|
<title><?php bloginfo_rss('name'); wp_title_rss(); ?></title>
|
||||||
<atom:link href="<?php bloginfo('rss2_url') ?>" rel="self" type="application/rss+xml" />
|
<atom:link href="<?php self_link(); ?>" rel="self" type="application/rss+xml" />
|
||||||
<link><?php bloginfo_rss('url') ?></link>
|
<link><?php bloginfo_rss('url') ?></link>
|
||||||
<description><?php bloginfo_rss("description") ?></description>
|
<description><?php bloginfo_rss("description") ?></description>
|
||||||
<pubDate><?php echo mysql2date('D, d M Y H:i:s +0000', get_lastpostmodified('GMT'), false); ?></pubDate>
|
<pubDate><?php echo mysql2date('D, d M Y H:i:s +0000', get_lastpostmodified('GMT'), false); ?></pubDate>
|
||||||
|
|
|
@ -231,4 +231,21 @@ function prep_atom_text_construct($data) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* self_link() - Generate a correct link for the atom:self elemet
|
||||||
|
*
|
||||||
|
* Echo the link for the currently displayed feed in a XSS safe way.
|
||||||
|
*
|
||||||
|
* @package WordPress
|
||||||
|
* @subpackage Feed
|
||||||
|
* @since 2.5
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
function self_link() {
|
||||||
|
echo 'http'
|
||||||
|
. ( $_SERVER['https'] == 'on' ? 's' : '' ) . '://'
|
||||||
|
. $_SERVER['HTTP_HOST']
|
||||||
|
. wp_specialchars(stripslashes($_SERVER['REQUEST_URI']), 1);
|
||||||
|
}
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
|
Loading…
Reference in New Issue