From 77c0f608c8bac03c1dc9f248f4bddd27c978dc2e Mon Sep 17 00:00:00 2001 From: westi Date: Tue, 11 Mar 2008 18:18:22 +0000 Subject: [PATCH] Better self links for feeds. Fixes #5238 props andy. git-svn-id: http://svn.automattic.com/wordpress/trunk@7244 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-includes/feed-atom.php | 2 +- wp-includes/feed-rss2-comments.php | 2 +- wp-includes/feed-rss2.php | 2 +- wp-includes/feed.php | 17 +++++++++++++++++ 4 files changed, 20 insertions(+), 3 deletions(-) diff --git a/wp-includes/feed-atom.php b/wp-includes/feed-atom.php index d725742c1..94a0174d5 100644 --- a/wp-includes/feed-atom.php +++ b/wp-includes/feed-atom.php @@ -25,7 +25,7 @@ $more = 1; - + diff --git a/wp-includes/feed-rss2-comments.php b/wp-includes/feed-rss2-comments.php index f33398493..f75a792c1 100644 --- a/wp-includes/feed-rss2-comments.php +++ b/wp-includes/feed-rss2-comments.php @@ -23,7 +23,7 @@ echo ''; else printf(__('Comments for %s'), get_bloginfo_rss( 'name' ) . get_wp_title_rss()); ?> - + diff --git a/wp-includes/feed-rss2.php b/wp-includes/feed-rss2.php index 421313062..3274583d3 100644 --- a/wp-includes/feed-rss2.php +++ b/wp-includes/feed-rss2.php @@ -21,7 +21,7 @@ $more = 1; <?php bloginfo_rss('name'); wp_title_rss(); ?> - + diff --git a/wp-includes/feed.php b/wp-includes/feed.php index 871fb11e0..4cf5e6765 100644 --- a/wp-includes/feed.php +++ b/wp-includes/feed.php @@ -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); +} + ?>