Location: PHPKode > projects > PluggedOut Projects > blog199j/includes/show-rss.php
<?
// RSS block for PluggedOut Blog
// by Robert Cooper for NoIdea.US
// Released 11 Oct 2006
// Use it as you will, but please retain this header

// Uses MagpieRSS for feed processing
// http://magpierss.sourceforge.net/

// change the function name to identify the individual feed
// so that the template [include:function] will show the
// correct entries.
function rss_uscert() {
// URL for new feed
$feed_url = "http://www.us-cert.gov/channels/techalerts.rdf";
// how many entries to list
$rss_count = 5;

// cache directory for MagpieRSS
define('MAGPIE_CACHE_DIR','/tmp/.magpiecache');

// absolute or relative path to magpierss includes
require_once('/home/noidea-us/html/html/blog/plugins/magpierss/rss_fetch.inc');

$rss = fetch_rss($feed_url);
$items = array_slice($rss->items, 0, $rss_count);
$count=0;
foreach ($items as $item) {
$count++;
// Fix for title having href *grrr*
$title=strip_tags($item['title']); 
// Converts html codes into displayable codes
$title = htmlentities($title);
// and fixes the ampersands that should be displayed...
$title = ereg_replace('&amp;', '&', $title);
// remove any stray linefeeds/carriage returns from title
$title = ereg_replace("\r?\n", "", $title);
// Strips the "customize this feed" from NewsIsFree feeds
// and marked advertisements
$adtext = "ADV:";
if (strpos($title, $adtext) !== FALSE) continue;
$customtxt = "Customize this feed";
if ($title == $customtxt) continue;
$customtxt2 = "NewsIsFree:";
if (strpos($title, $customtxt2) !== false) continue;  

// Work around for some sites not always having a "link" element
if (isset($item['link'])) {$linkurl = $item['link'];}
else {$linkurl = $item['guid'];}
$linkurl = trim($linkurl);


$html .=  "<a href=\"$linkurl\">$title</a><p>\n";
}

return $html;
}
Return current item: PluggedOut Projects