]> scripts.mit.edu Git - autoinstalls/wordpress.git/blobdiff - wp-includes/feed.php
WordPress 4.7
[autoinstalls/wordpress.git] / wp-includes / feed.php
index feb690d8dac9c66d9018e71183ceeef0f031b7f5..e6686c040ebef9dbc66a9228110b22b0d6e3095e 100644 (file)
@@ -7,6 +7,7 @@
  *
  * @package WordPress
  * @subpackage Feed
+ * @since 2.1.0
  */
 
 /**
@@ -25,7 +26,7 @@
 function get_bloginfo_rss($show = '') {
        $info = strip_tags(get_bloginfo($show));
        /**
-        * Filter the bloginfo for use in RSS feeds.
+        * Filters the bloginfo for use in RSS feeds.
         *
         * @since 2.2.0
         *
@@ -52,7 +53,7 @@ function get_bloginfo_rss($show = '') {
  */
 function bloginfo_rss($show = '') {
        /**
-        * Filter the bloginfo for display in RSS feeds.
+        * Filters the bloginfo for display in RSS feeds.
         *
         * @since 2.1.0
         *
@@ -68,7 +69,7 @@ function bloginfo_rss($show = '') {
  * Retrieve the default feed.
  *
  * The default feed is 'rss2', unless a plugin changes it through the
- * 'default_feed' filter.
+ * {@see 'default_feed'} filter.
  *
  * @since 2.5.0
  *
@@ -76,7 +77,7 @@ function bloginfo_rss($show = '') {
  */
 function get_default_feed() {
        /**
-        * Filter the default feed type.
+        * Filters the default feed type.
         *
         * @since 2.5.0
         *
@@ -103,7 +104,7 @@ function get_wp_title_rss( $deprecated = '–' ) {
        }
 
        /**
-        * Filter the blog title for use as the feed title.
+        * Filters 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`.
@@ -129,7 +130,7 @@ function wp_title_rss( $deprecated = '–' ) {
        }
 
        /**
-        * Filter the blog title for display of the feed title.
+        * Filters 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`.
@@ -153,7 +154,7 @@ function get_the_title_rss() {
        $title = get_the_title();
 
        /**
-        * Filter the post title for use in a feed.
+        * Filters the post title for use in a feed.
         *
         * @since 1.2.0
         *
@@ -189,7 +190,7 @@ function get_the_content_feed($feed_type = null) {
        $content = apply_filters( 'the_content', get_the_content() );
        $content = str_replace(']]>', ']]>', $content);
        /**
-        * Filter the post content for use in feeds.
+        * Filters the post content for use in feeds.
         *
         * @since 2.9.0
         *
@@ -219,7 +220,7 @@ function the_content_feed($feed_type = null) {
 function the_excerpt_rss() {
        $output = get_the_excerpt();
        /**
-        * Filter the post excerpt for a feed.
+        * Filters the post excerpt for a feed.
         *
         * @since 1.2.0
         *
@@ -235,7 +236,7 @@ function the_excerpt_rss() {
  */
 function the_permalink_rss() {
        /**
-        * Filter the permalink to the post for use in feeds.
+        * Filters the permalink to the post for use in feeds.
         *
         * @since 2.3.0
         *
@@ -252,7 +253,7 @@ function the_permalink_rss() {
  */
 function comments_link_feed() {
        /**
-        * Filter the comments permalink for the current post.
+        * Filters the comments permalink for the current post.
         *
         * @since 3.6.0
         *
@@ -300,7 +301,7 @@ function get_comment_guid($comment_id = null) {
  */
 function comment_link( $comment = null ) {
        /**
-        * Filter the current comment's permalink.
+        * Filters the current comment's permalink.
         *
         * @since 3.6.0
         *
@@ -320,7 +321,7 @@ function comment_link( $comment = null ) {
  */
 function get_comment_author_rss() {
        /**
-        * Filter the current comment author for use in a feed.
+        * Filters the current comment author for use in a feed.
         *
         * @since 1.5.0
         *
@@ -348,7 +349,7 @@ function comment_author_rss() {
 function comment_text_rss() {
        $comment_text = get_comment_text();
        /**
-        * Filter the current comment content for use in a feed.
+        * Filters the current comment content for use in a feed.
         *
         * @since 1.5.0
         *
@@ -402,7 +403,7 @@ function get_the_category_rss($type = null) {
        }
 
        /**
-        * Filter all of the post categories for display in a feed.
+        * Filters all of the post categories for display in a feed.
         *
         * @since 1.2.0
         *
@@ -469,7 +470,7 @@ function rss_enclosure() {
                                $type = $t[0];
 
                                /**
-                                * Filter the RSS enclosure HTML link tag for the current post.
+                                * Filters the RSS enclosure HTML link tag for the current post.
                                 *
                                 * @since 2.2.0
                                 *
@@ -503,7 +504,7 @@ function atom_enclosure() {
                        foreach ( (array) $val as $enc ) {
                                $enclosure = explode("\n", $enc);
                                /**
-                                * Filter the atom enclosure HTML link tag for the current post.
+                                * Filters the atom enclosure HTML link tag for the current post.
                                 *
                                 * @since 2.2.0
                                 *
@@ -537,6 +538,12 @@ function prep_atom_text_construct($data) {
                return array('text', $data);
        }
 
+       if ( ! function_exists( 'xml_parser_create' ) ) {
+               trigger_error( __( "PHP's XML extension is not available. Please contact your hosting provider to enable PHP's XML extension." ) );
+
+               return array( 'html', "<![CDATA[$data]]>" );
+       }
+
        $parser = xml_parser_create();
        xml_parse($parser, '<div>' . $data . '</div>', true);
        $code = xml_get_error_code($parser);
@@ -606,7 +613,7 @@ function rss2_site_icon() {
 function self_link() {
        $host = @parse_url(home_url());
        /**
-        * Filter the current feed URL.
+        * Filters the current feed URL.
         *
         * @since 3.6.0
         *
@@ -630,16 +637,17 @@ function feed_content_type( $type = '' ) {
                $type = get_default_feed();
 
        $types = array(
-               'rss'  => 'application/rss+xml',
-               'rss2' => 'application/rss+xml',
-               'atom' => 'application/atom+xml',
-               'rdf'  => 'application/rdf+xml'
+               'rss'      => 'application/rss+xml',
+               'rss2'     => 'application/rss+xml',
+               'rss-http' => 'text/xml',
+               'atom'     => 'application/atom+xml',
+               'rdf'      => 'application/rdf+xml'
        );
 
        $content_type = ( !empty($types[$type]) ) ? $types[$type] : 'application/octet-stream';
 
        /**
-        * Filter the content type for a specific feed type.
+        * Filters the content type for a specific feed type.
         *
         * @since 2.8.0
         *
@@ -661,7 +669,14 @@ function feed_content_type( $type = '' ) {
  * @return WP_Error|SimplePie WP_Error object on failure or SimplePie object on success
  */
 function fetch_feed( $url ) {
-       require_once( ABSPATH . WPINC . '/class-feed.php' );
+       if ( ! class_exists( 'SimplePie', false ) ) {
+               require_once( ABSPATH . WPINC . '/class-simplepie.php' );
+       }
+
+       require_once( ABSPATH . WPINC . '/class-wp-feed-cache.php' );
+       require_once( ABSPATH . WPINC . '/class-wp-feed-cache-transient.php' );
+       require_once( ABSPATH . WPINC . '/class-wp-simplepie-file.php' );
+       require_once( ABSPATH . WPINC . '/class-wp-simplepie-sanitize-kses.php' );
 
        $feed = new SimplePie();
 
@@ -674,7 +689,7 @@ function fetch_feed( $url ) {
        $feed->set_file_class( 'WP_SimplePie_File' );
 
        $feed->set_feed_url( $url );
-       /** This filter is documented in wp-includes/class-feed.php */
+       /** This filter is documented in wp-includes/class-wp-feed-cache-transient.php */
        $feed->set_cache_duration( apply_filters( 'wp_feed_cache_transient_lifetime', 12 * HOUR_IN_SECONDS, $url ) );
        /**
         * Fires just before processing the SimplePie feed object.