138 * @since 2.9.0 |
138 * @since 2.9.0 |
139 * @uses apply_filters() Calls 'the_content_feed' on the content before processing. |
139 * @uses apply_filters() Calls 'the_content_feed' on the content before processing. |
140 * @see get_the_content() |
140 * @see get_the_content() |
141 * |
141 * |
142 * @param string $feed_type The type of feed. rss2 | atom | rss | rdf |
142 * @param string $feed_type The type of feed. rss2 | atom | rss | rdf |
|
143 * @return string The filtered content. |
143 */ |
144 */ |
144 function get_the_content_feed($feed_type = null) { |
145 function get_the_content_feed($feed_type = null) { |
145 if ( !$feed_type ) |
146 if ( !$feed_type ) |
146 $feed_type = get_default_feed(); |
147 $feed_type = get_default_feed(); |
147 |
148 |
485 * @subpackage Feed |
486 * @subpackage Feed |
486 * @since 2.5 |
487 * @since 2.5 |
487 */ |
488 */ |
488 function self_link() { |
489 function self_link() { |
489 $host = @parse_url(home_url()); |
490 $host = @parse_url(home_url()); |
490 $host = $host['host']; |
491 echo esc_url( set_url_scheme( 'http://' . $host['host'] . stripslashes($_SERVER['REQUEST_URI']) ) ); |
491 echo esc_url( |
|
492 ( is_ssl() ? 'https' : 'http' ) . '://' |
|
493 . $host |
|
494 . stripslashes($_SERVER['REQUEST_URI']) |
|
495 ); |
|
496 } |
492 } |
497 |
493 |
498 /** |
494 /** |
499 * Return the content type for specified feed type. |
495 * Return the content type for specified feed type. |
500 * |
496 * |
529 */ |
525 */ |
530 function fetch_feed($url) { |
526 function fetch_feed($url) { |
531 require_once (ABSPATH . WPINC . '/class-feed.php'); |
527 require_once (ABSPATH . WPINC . '/class-feed.php'); |
532 |
528 |
533 $feed = new SimplePie(); |
529 $feed = new SimplePie(); |
|
530 |
|
531 $feed->set_sanitize_class( 'WP_SimplePie_Sanitize_KSES' ); |
|
532 // We must manually overwrite $feed->sanitize because SimplePie's |
|
533 // constructor sets it before we have a chance to set the sanitization class |
|
534 $feed->sanitize = new WP_SimplePie_Sanitize_KSES(); |
|
535 |
|
536 $feed->set_cache_class( 'WP_Feed_Cache' ); |
|
537 $feed->set_file_class( 'WP_SimplePie_File' ); |
|
538 |
534 $feed->set_feed_url($url); |
539 $feed->set_feed_url($url); |
535 $feed->set_cache_class('WP_Feed_Cache'); |
540 $feed->set_cache_duration( apply_filters( 'wp_feed_cache_transient_lifetime', 12 * HOUR_IN_SECONDS, $url ) ); |
536 $feed->set_file_class('WP_SimplePie_File'); |
|
537 $feed->set_cache_duration(apply_filters('wp_feed_cache_transient_lifetime', 43200, $url)); |
|
538 do_action_ref_array( 'wp_feed_options', array( &$feed, $url ) ); |
541 do_action_ref_array( 'wp_feed_options', array( &$feed, $url ) ); |
539 $feed->init(); |
542 $feed->init(); |
540 $feed->handle_content_type(); |
543 $feed->handle_content_type(); |
541 |
544 |
542 if ( $feed->error() ) |
545 if ( $feed->error() ) |