X-Git-Url: https://scripts.mit.edu/gitweb/autoinstalls/wordpress.git/blobdiff_plain/41578db67d72562346e4dbb2a14889b23d522813..03f2fa83c13c1b532284205fa7efcab9b8b2c41f:/wp-includes/feed.php
diff --git a/wp-includes/feed.php b/wp-includes/feed.php
index c77abd52..4842c6e1 100644
--- a/wp-includes/feed.php
+++ b/wp-includes/feed.php
@@ -71,7 +71,6 @@ function bloginfo_rss($show = '') {
* 'default_feed' filter.
*
* @since 2.5.0
- * @uses apply_filters() Calls 'default_feed' hook on the default feed string.
*
* @return string Default feed, or for example 'rss2', 'atom', etc.
*/
@@ -92,46 +91,55 @@ function get_default_feed() {
* Retrieve the blog title for the feed title.
*
* @since 2.2.0
+ * @since 4.4.0 The optional `$sep` parameter was deprecated and renamed to `$deprecated`.
*
- * @param string $sep Optional.How to separate the title. See wp_title() for more info.
- * @return string Error message on failure or blog title on success.
+ * @param string $deprecated Unused..
+ * @return string The document title.
*/
-function get_wp_title_rss($sep = '»') {
- $title = wp_title($sep, false);
- if ( is_wp_error( $title ) )
- return $title->get_error_message();
+function get_wp_title_rss( $deprecated = '–' ) {
+ if ( '–' !== $deprecated ) {
+ /* translators: %s: 'document_title_separator' filter name */
+ _deprecated_argument( __FUNCTION__, '4.4.0', sprintf( __( 'Use the %s filter instead.' ), 'document_title_separator
' ) );
+ }
+
/**
* Filter the blog title for use as the feed title.
*
* @since 2.2.0
+ * @since 4.4.0 The `$sep` parameter was deprecated and renamed to `$deprecated`.
*
- * @param string $title The current blog title.
- * @param string $sep Separator used by wp_title().
+ * @param string $title The current blog title.
+ * @param string $deprecated Unused.
*/
- $title = apply_filters( 'get_wp_title_rss', $title, $sep );
- return $title;
+ return apply_filters( 'get_wp_title_rss', wp_get_document_title(), $deprecated );
}
/**
* Display the blog title for display of the feed title.
*
* @since 2.2.0
- * @see wp_title() $sep parameter usage.
+ * @since 4.4.0 The optional `$sep` parameter was deprecated and renamed to `$deprecated`.
*
- * @param string $sep Optional.
+ * @param string $deprecated Unused.
*/
-function wp_title_rss( $sep = '»' ) {
+function wp_title_rss( $deprecated = '–' ) {
+ if ( '–' !== $deprecated ) {
+ /* translators: %s: 'document_title_separator' filter name */
+ _deprecated_argument( __FUNCTION__, '4.4.0', sprintf( __( 'Use the %s filter instead.' ), 'document_title_separator
' ) );
+ }
+
/**
* Filter the blog title for display of the feed title.
*
* @since 2.2.0
+ * @since 4.4.0 The `$sep` parameter was deprecated and renamed to `$deprecated`.
*
* @see get_wp_title_rss()
*
- * @param string $wp_title The current blog title.
- * @param string $sep Separator used by wp_title().
+ * @param string $wp_title_rss The current blog title.
+ * @param string $deprecated Unused.
*/
- echo apply_filters( 'wp_title_rss', get_wp_title_rss( $sep ), $sep );
+ echo apply_filters( 'wp_title_rss', get_wp_title_rss(), $deprecated );
}
/**
@@ -143,6 +151,7 @@ function wp_title_rss( $sep = '»' ) {
*/
function get_the_title_rss() {
$title = get_the_title();
+
/**
* Filter the post title for use in a feed.
*
@@ -158,7 +167,6 @@ function get_the_title_rss() {
* Display the post title in the feed.
*
* @since 0.71
- * @uses get_the_title_rss() Used to retrieve current post title.
*/
function the_title_rss() {
echo get_the_title_rss();
@@ -177,7 +185,7 @@ function get_the_content_feed($feed_type = null) {
if ( !$feed_type )
$feed_type = get_default_feed();
- /** This filter is documented in wp-admin/post-template.php */
+ /** This filter is documented in wp-includes/post-template.php */
$content = apply_filters( 'the_content', get_the_content() );
$content = str_replace(']]>', ']]>', $content);
/**
@@ -196,8 +204,6 @@ function get_the_content_feed($feed_type = null) {
* Display the post content for feeds.
*
* @since 2.9.0
- * @uses apply_filters() Calls 'the_content_feed' on the content before processing.
- * @see get_the_content()
*
* @param string $feed_type The type of feed. rss2 | atom | rss | rdf
*/
@@ -261,7 +267,7 @@ function comments_link_feed() {
*
* @since 2.5.0
*
- * @param int|object $comment_id Optional comment object or id. Defaults to global comment object.
+ * @param int|WP_Comment $comment_id Optional comment object or id. Defaults to global comment object.
*/
function comment_guid($comment_id = null) {
echo esc_url( get_comment_guid($comment_id) );
@@ -272,8 +278,8 @@ function comment_guid($comment_id = null) {
*
* @since 2.5.0
*
- * @param int|object $comment_id Optional comment object or id. Defaults to global comment object.
- * @return bool|string false on failure or guid for comment on success.
+ * @param int|WP_Comment $comment_id Optional comment object or id. Defaults to global comment object.
+ * @return false|string false on failure or guid for comment on success.
*/
function get_comment_guid($comment_id = null) {
$comment = get_comment($comment_id);
@@ -288,8 +294,11 @@ function get_comment_guid($comment_id = null) {
* Display the link to the comments.
*
* @since 1.5.0
+ * @since 4.4.0 Introduced the `$comment` argument.
+ *
+ * @param int|WP_Comment $comment Optional. Comment object or id. Defaults to global comment object.
*/
-function comment_link() {
+function comment_link( $comment = null ) {
/**
* Filter the current comment's permalink.
*
@@ -299,14 +308,13 @@ function comment_link() {
*
* @param string $comment_permalink The current comment permalink.
*/
- echo esc_url( apply_filters( 'comment_link', get_comment_link() ) );
+ echo esc_url( apply_filters( 'comment_link', get_comment_link( $comment ) ) );
}
/**
* Retrieve the current comment author for use in the feeds.
*
* @since 2.0.0
- * @uses get_comment_author()
*
* @return string Comment Author
*/
@@ -336,7 +344,6 @@ function comment_author_rss() {
* Display the current comment content for use in the feeds.
*
* @since 1.0.0
- * @uses get_comment_text()
*/
function comment_text_rss() {
$comment_text = get_comment_text();
@@ -389,8 +396,7 @@ function get_the_category_rss($type = null) {
if ( 'rdf' == $type )
$the_list .= "\t\t\n";
elseif ( 'atom' == $type )
- /** This filter is documented in wp-includes/feed.php */
- $the_list .= sprintf( '', esc_attr( apply_filters( 'get_bloginfo_rss', get_bloginfo( 'url' ) ) ), esc_attr( $cat_name ) );
+ $the_list .= sprintf( '', esc_attr( get_bloginfo_rss( 'url' ) ), esc_attr( $cat_name ) );
else
$the_list .= "\t\t\n";
}
@@ -448,7 +454,6 @@ function html_type_rss() {
* attributes.
*
* @since 1.5.0
- * @uses get_post_custom() To get the current post enclosure metadata.
*/
function rss_enclosure() {
if ( post_password_required() )
@@ -488,7 +493,6 @@ function rss_enclosure() {
* enclosure(s) consist of link HTML tag(s) with a URI and other attributes.
*
* @since 2.2.0
- * @uses get_post_custom() To get the current post enclosure metadata.
*/
function atom_enclosure() {
if ( post_password_required() )
@@ -547,13 +551,51 @@ function prep_atom_text_construct($data) {
}
}
- if (strpos($data, ']]>') == false) {
+ if (strpos($data, ']]>') === false) {
return array('html', "");
} else {
return array('html', htmlspecialchars($data));
}
}
+/**
+ * Displays Site Icon in atom feeds.
+ *
+ * @since 4.3.0
+ *
+ * @see get_site_icon_url()
+ */
+function atom_site_icon() {
+ $url = get_site_icon_url( 32 );
+ if ( $url ) {
+ echo "$url\n";
+ }
+}
+
+/**
+ * Displays Site Icon in RSS2.
+ *
+ * @since 4.3.0
+ */
+function rss2_site_icon() {
+ $rss_title = get_wp_title_rss();
+ if ( empty( $rss_title ) ) {
+ $rss_title = get_bloginfo_rss( 'name' );
+ }
+
+ $url = get_site_icon_url( 32 );
+ if ( $url ) {
+ echo '
+
+ ' . convert_chars( $url ) . '
+ ' . $rss_title . '
+ ' . get_bloginfo_rss( 'url' ) . '
+ 32
+ 32
+ ' . "\n";
+ }
+}
+
/**
* Display the link for the currently displayed feed in a XSS safe way.
*
@@ -644,6 +686,7 @@ function fetch_feed( $url ) {
*/
do_action_ref_array( 'wp_feed_options', array( &$feed, $url ) );
$feed->init();
+ $feed->set_output_encoding( get_option( 'blog_charset' ) );
$feed->handle_content_type();
if ( $feed->error() )