61 * @uses apply_filters() Calls 'default_feed' hook on the default feed string. |
61 * @uses apply_filters() Calls 'default_feed' hook on the default feed string. |
62 * |
62 * |
63 * @return string Default feed, or for example 'rss2', 'atom', etc. |
63 * @return string Default feed, or for example 'rss2', 'atom', etc. |
64 */ |
64 */ |
65 function get_default_feed() { |
65 function get_default_feed() { |
66 return apply_filters('default_feed', 'rss2'); |
66 $default_feed = apply_filters('default_feed', 'rss2'); |
|
67 return 'rss' == $default_feed ? 'rss2' : $default_feed; |
67 } |
68 } |
68 |
69 |
69 /** |
70 /** |
70 * Retrieve the blog title for the feed title. |
71 * Retrieve the blog title for the feed title. |
71 * |
72 * |
159 * @see get_the_content() |
160 * @see get_the_content() |
160 * |
161 * |
161 * @param string $feed_type The type of feed. rss2 | atom | rss | rdf |
162 * @param string $feed_type The type of feed. rss2 | atom | rss | rdf |
162 */ |
163 */ |
163 function the_content_feed($feed_type = null) { |
164 function the_content_feed($feed_type = null) { |
164 echo get_the_content_feed(); |
165 echo get_the_content_feed($feed_type); |
165 } |
166 } |
166 |
167 |
167 /** |
168 /** |
168 * Display the post excerpt for the feed. |
169 * Display the post excerpt for the feed. |
169 * |
170 * |
184 * @subpackage Feed |
185 * @subpackage Feed |
185 * @since 2.3.0 |
186 * @since 2.3.0 |
186 * @uses apply_filters() Call 'the_permalink_rss' on the post permalink |
187 * @uses apply_filters() Call 'the_permalink_rss' on the post permalink |
187 */ |
188 */ |
188 function the_permalink_rss() { |
189 function the_permalink_rss() { |
189 echo apply_filters('the_permalink_rss', get_permalink()); |
190 echo esc_url( apply_filters('the_permalink_rss', get_permalink() )); |
|
191 } |
|
192 |
|
193 /** |
|
194 * Outputs the link to the comments for the current post in an xml safe way |
|
195 * |
|
196 * @since 3.0.0 |
|
197 * @return none |
|
198 */ |
|
199 function comments_link_feed() { |
|
200 echo esc_url( get_comments_link() ); |
190 } |
201 } |
191 |
202 |
192 /** |
203 /** |
193 * Display the feed GUID for the current comment. |
204 * Display the feed GUID for the current comment. |
194 * |
205 * |
195 * @package WordPress |
206 * @package WordPress |
196 * @subpackage Feed |
207 * @subpackage Feed |
197 * @since unknown |
208 * @since 2.5.0 |
198 * |
209 * |
199 * @param int|object $comment_id Optional comment object or id. Defaults to global comment object. |
210 * @param int|object $comment_id Optional comment object or id. Defaults to global comment object. |
200 */ |
211 */ |
201 function comment_guid($comment_id = null) { |
212 function comment_guid($comment_id = null) { |
202 echo get_comment_guid($comment_id); |
213 echo esc_url( get_comment_guid($comment_id) ); |
203 } |
214 } |
204 |
215 |
205 /** |
216 /** |
206 * Retrieve the feed GUID for the current comment. |
217 * Retrieve the feed GUID for the current comment. |
207 * |
218 * |
208 * @package WordPress |
219 * @package WordPress |
209 * @subpackage Feed |
220 * @subpackage Feed |
210 * @since unknown |
221 * @since 2.5.0 |
211 * |
222 * |
212 * @param int|object $comment_id Optional comment object or id. Defaults to global comment object. |
223 * @param int|object $comment_id Optional comment object or id. Defaults to global comment object. |
213 * @return bool|string false on failure or guid for comment on success. |
224 * @return bool|string false on failure or guid for comment on success. |
214 */ |
225 */ |
215 function get_comment_guid($comment_id = null) { |
226 function get_comment_guid($comment_id = null) { |
411 return; |
422 return; |
412 |
423 |
413 foreach ( (array) get_post_custom() as $key => $val ) { |
424 foreach ( (array) get_post_custom() as $key => $val ) { |
414 if ($key == 'enclosure') { |
425 if ($key == 'enclosure') { |
415 foreach ( (array) $val as $enc ) { |
426 foreach ( (array) $val as $enc ) { |
416 $enclosure = split("\n", $enc); |
427 $enclosure = explode("\n", $enc); |
417 echo apply_filters('atom_enclosure', '<link href="' . trim(htmlspecialchars($enclosure[0])) . '" rel="enclosure" length="' . trim($enclosure[1]) . '" type="' . trim($enclosure[2]) . '" />' . "\n"); |
428 echo apply_filters('atom_enclosure', '<link href="' . trim(htmlspecialchars($enclosure[0])) . '" rel="enclosure" length="' . trim($enclosure[1]) . '" type="' . trim($enclosure[2]) . '" />' . "\n"); |
418 } |
429 } |
419 } |
430 } |
420 } |
431 } |
421 } |
432 } |
473 * @package WordPress |
484 * @package WordPress |
474 * @subpackage Feed |
485 * @subpackage Feed |
475 * @since 2.5 |
486 * @since 2.5 |
476 */ |
487 */ |
477 function self_link() { |
488 function self_link() { |
478 $host = @parse_url(get_option('home')); |
489 $host = @parse_url(home_url()); |
479 $host = $host['host']; |
490 $host = $host['host']; |
480 echo esc_url( |
491 echo esc_url( |
481 'http' |
492 ( is_ssl() ? 'https' : 'http' ) . '://' |
482 . ( (isset($_SERVER['https']) && $_SERVER['https'] == 'on') ? 's' : '' ) . '://' |
|
483 . $host |
493 . $host |
484 . stripslashes($_SERVER['REQUEST_URI']) |
494 . stripslashes($_SERVER['REQUEST_URI']) |
485 ); |
495 ); |
486 } |
496 } |
487 |
497 |
522 |
532 |
523 $feed = new SimplePie(); |
533 $feed = new SimplePie(); |
524 $feed->set_feed_url($url); |
534 $feed->set_feed_url($url); |
525 $feed->set_cache_class('WP_Feed_Cache'); |
535 $feed->set_cache_class('WP_Feed_Cache'); |
526 $feed->set_file_class('WP_SimplePie_File'); |
536 $feed->set_file_class('WP_SimplePie_File'); |
527 $feed->set_cache_duration(apply_filters('wp_feed_cache_transient_lifetime', 43200)); |
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 ) ); |
528 $feed->init(); |
539 $feed->init(); |
529 $feed->handle_content_type(); |
540 $feed->handle_content_type(); |
530 |
541 |
531 if ( $feed->error() ) |
542 if ( $feed->error() ) |
532 return new WP_Error('simplepie-error', $feed->error()); |
543 return new WP_Error('simplepie-error', $feed->error()); |