<?php
/*
Plugin Name: WP-RSS-Import
Plugin URI: http://www.bueltge.de/wp-rss-import-plugin/55/
Plugin Version: 2.1
Description: List a RSS-Feed in your WP-Blog, only headlines or with description. (Requirements: Wordpress 1.5 or greater)
Original and Idea: Dave Wolf, http://www.davewolf.net
Modified by (Version 1.1 rev1): Thomas Fischer, http://www.securityfocus.de
Author: Frank Bueltge
Author URI: http://www.bueltge.de
Usage: Use following code with a PHP-Plugin for WordPress:Example: <?php RSSImport(10,"http://www.bueltge.de/feed/%22,true,false); ?>
License: GPL
*/
require_once(ABSPATH.'wp-includes/rss-functions.php');
/* Optional Plugin Config */
/* Do use php < 4.2, then kill the next comment */
//include(MAGPIE_DIR.'array_change_key_case.php');
function RSSImport($display=0,$feedurl,$displaydescriptions=false,$truncatetitle=true) {
if ( $feedurl ) {
$rss = fetch_rss( $feedurl );
echo wptexturize("<ul>");
foreach ($rss->items as $item) {
if ($display == 0) {
break;
}
$href = $item['link'];
$desc = trim($item['description']);
$item['fulltitle']=$item['title'];
if($truncatetitle){
if(strlen($item['title'])>30)
{
$item['title']=substr($item['title'],0,30)."...";
}
}
echo wptexturize("<li><a href=\"$href\" title=\"".$item['fulltitle']."\" target=\"_blank\">".$item['title']."</a></li>");
// Uncomment following line to also display headline description with each headline
if($displaydescriptions && $desc<>"") echo wptexturize($desc."<br><br>");
$display--;
}
echo wptexturize("</ul>");
}
}
?>