diff options
| author | donncha <donncha@7be80a69-a1ef-0310-a953-fb0f7c49ff36> | 2007-10-12 16:21:15 +0000 |
|---|---|---|
| committer | donncha <donncha@7be80a69-a1ef-0310-a953-fb0f7c49ff36> | 2007-10-12 16:21:15 +0000 |
| commit | 3a4570b0fc8b3d6339bef71d17d7701554e0bbf7 (patch) | |
| tree | 2a06e5261263c68d8afd95a6328879dc289cb909 /wp-includes/rss.php | |
| parent | b83c34a7010faee0223f6037025c350da12e05e6 (diff) | |
| download | wordpress-mu-3a4570b0fc8b3d6339bef71d17d7701554e0bbf7.tar.gz wordpress-mu-3a4570b0fc8b3d6339bef71d17d7701554e0bbf7.tar.xz wordpress-mu-3a4570b0fc8b3d6339bef71d17d7701554e0bbf7.zip | |
Merge with WP 2.3 - testing use only!
Move pluggable functions out of wpmu-functions and into pluggable.php, fixes #439
git-svn-id: http://svn.automattic.com/wordpress-mu/trunk@1069 7be80a69-a1ef-0310-a953-fb0f7c49ff36
Diffstat (limited to 'wp-includes/rss.php')
| -rw-r--r-- | wp-includes/rss.php | 51 |
1 files changed, 33 insertions, 18 deletions
diff --git a/wp-includes/rss.php b/wp-includes/rss.php index 72b7bb1..8746767 100644 --- a/wp-includes/rss.php +++ b/wp-includes/rss.php @@ -1,4 +1,6 @@ <?php +do_action('load_feed_engine'); + /* * Project: MagpieRSS: a simple RSS integration tool * File: A compiled file for RSS syndication @@ -375,6 +377,7 @@ class MagpieRSS { } require_once( dirname(__FILE__) . '/class-snoopy.php'); +if ( !function_exists('fetch_rss') ) : function fetch_rss ($url) { // initialize constants init(); @@ -501,6 +504,7 @@ function fetch_rss ($url) { } // end if ( !MAGPIE_CACHE_ON ) { } // end fetch_rss() +endif; function _fetch_remote_file ($url, $headers = "" ) { // Snoopy is an HTTP client in PHP @@ -775,6 +779,7 @@ class RSSCache { } } +if ( !function_exists('parse_w3cdtf') ) : function parse_w3cdtf ( $date_str ) { # regex to match wc3dtf @@ -815,27 +820,35 @@ function parse_w3cdtf ( $date_str ) { else { return -1; } - } -function wp_rss ($url, $num_items) { - //ini_set("display_errors", false); uncomment to suppress php errors thrown if the feed is not returned. - $rss = fetch_rss($url); - if ( $rss ) { - echo "<ul>"; - $rss->items = array_slice($rss->items, 0, $num_items); - foreach ($rss->items as $item ) { - echo "<li>\n"; - echo "<a href='$item[link]' title='$item[description]'>"; - echo htmlentities($item['title']); - echo "</a><br />\n"; - echo "</li>\n"; - } - echo "</ul>"; - } - else { - echo "an error has occured the feed is probably down, try again later."; +} +endif; + +if ( !function_exists('wp_rss') ) : +function wp_rss( $url, $num_items = -1 ) { + if ( $rss = fetch_rss( $url ) ) { + echo '<ul>'; + + if ( $num_items !== -1 ) { + $rss->items = array_slice( $rss->items, 0, $num_items ); + } + + foreach ( $rss->items as $item ) { + printf( + '<li><a href="%1$s" title="%2$s">%3$s</a></li>', + clean_url( $item['link'] ), + attribute_escape( strip_tags( $item['description'] ) ), + htmlentities( $item['title'] ) + ); + } + + echo '</ul>'; + } else { + _e( 'An error has occurred, which probably means the feed is down. Try again later.' ); } } +endif; +if ( !function_exists('get_rss') ) : function get_rss ($url, $num_items = 5) { // Like get posts, but for RSS $rss = fetch_rss($url); if ( $rss ) { @@ -851,4 +864,6 @@ function get_rss ($url, $num_items = 5) { // Like get posts, but for RSS return false; } } +endif; + ?> |
