Feeds: Introduce the `get_self_link()` function.
Corresponds to the `self_link()` template function. This matches other feed template functions, using one function to get the value, and a different function to echo it. Props jojotjebaby, mobeen-abdullah, donmhico, audrasjb, dshanske. Fixes #44838. git-svn-id: https://develop.svn.wordpress.org/trunk@45772 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
739bc58d13
commit
72529b3deb
|
@ -615,6 +615,18 @@ function rss2_site_icon() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the link for the currently displayed feed.
|
||||||
|
*
|
||||||
|
* @since 5.3.0
|
||||||
|
*
|
||||||
|
* @return string Correct link for the atom:self element.
|
||||||
|
*/
|
||||||
|
function get_self_link() {
|
||||||
|
$host = @parse_url( home_url() );
|
||||||
|
return set_url_scheme( 'http://' . $host['host'] . wp_unslash( $_SERVER['REQUEST_URI'] ) );
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Display the link for the currently displayed feed in a XSS safe way.
|
* Display the link for the currently displayed feed in a XSS safe way.
|
||||||
*
|
*
|
||||||
|
@ -623,7 +635,6 @@ function rss2_site_icon() {
|
||||||
* @since 2.5.0
|
* @since 2.5.0
|
||||||
*/
|
*/
|
||||||
function self_link() {
|
function self_link() {
|
||||||
$host = @parse_url( home_url() );
|
|
||||||
/**
|
/**
|
||||||
* Filters the current feed URL.
|
* Filters the current feed URL.
|
||||||
*
|
*
|
||||||
|
@ -634,7 +645,7 @@ function self_link() {
|
||||||
*
|
*
|
||||||
* @param string $feed_link The link for the feed with set URL scheme.
|
* @param string $feed_link The link for the feed with set URL scheme.
|
||||||
*/
|
*/
|
||||||
echo esc_url( apply_filters( 'self_link', set_url_scheme( 'http://' . $host['host'] . wp_unslash( $_SERVER['REQUEST_URI'] ) ) ) );
|
echo esc_url( apply_filters( 'self_link', get_self_link() ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in New Issue