Example #1
0
 * Copyright (c) 2009 West Virginia University
 * 
 * Licensed under the MIT License
 * Redistributions of files must retain the above copyright notice.
 * 
 */
// various copy includes
require_once "../../config.gen.inc.php";
require_once "data/data.inc.php";
// records stats
require_once "../page_builder/page_header.php";
// libs
require_once "../../lib/simple-rss/simple-rss.inc.php";
require_once "lib/textformat.lib.php";
$rss_url = $news_srcs[$_REQUEST['src']]['url'];
$feed = new SimpleRss($rss_url, 300);
$items = $feed->GetRssObject();
foreach ($items->aItems as $item) {
    $description = explode("\n", strip_tags($item->sDescription, "<a>"));
    $link = $item->sLink;
    $title = $item->sTitle;
    $date = article_date($item->sDate);
    if (stripslashes($_REQUEST['title']) == $title) {
        break;
    }
}
$paragraphs = array();
foreach ($description as $paragraph) {
    if ($paragraph) {
        $paragraphs[] = str_replace('Read more ...', '', $paragraph);
    }
Example #2
0
// libs - need to require first because data.inc.php uses functions
require_once "../../lib/simple-rss/simple-rss.inc.php";
require_once "lib/textformat.lib.php";

// various copy includes
require_once "../../config.gen.inc.php";
require_once "data/data.inc.php";

// records stats
require_once "../page_builder/page_header.php";

$emergency_message = "Coming Soon: Emergency Updates"; 

if ($show_rss == true) {
	
	$feed = new SimpleRss($emergency_rss_url, 60);
	$emergencies = $feed->GetRssObject();

	if($emergencies === False) {
	  $paragraphs = array('Emergency information is currently not available');
	} else {
	  foreach ($emergencies->aItems as $item) {
        $text = explode("\n", $item->sDescription);
        $paragraphs = array();
		foreach($text as $paragraph) {
	  		if($paragraph) {
	    		$paragraphs[] = htmlentities($paragraph);
	  		}
		}
		
		// going to have to figure out timestamp issues...
Example #3
0
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
	<title>RSS Feeds Example</title>
	<style type="text/css">
	   li a { display: block; }
	   li span { color: #f90; font-size: 85%; }
	</style>
</head>

<body>
   <h1>RSS Feeds Example</h1>
	<?php 
require 'simple-rss.inc.php';
$aFeeds = array('http://feeds.feedburner.com/ejeliot/blog-rss' => 300);
$aRssObjects = array();
foreach ($aFeeds as $sUrl => $vCacheTime) {
    $oRss = new SimpleRss($sUrl, $vCacheTime);
    if ($oRssObject = $oRss->GetRssObject()) {
        echo "<h2>{$oRssObject->oChannel->sTitle}</h2><ul>";
        foreach ($oRssObject->aItems as $oItem) {
            echo "<li><a href=\"{$oItem->sLink}\">{$oItem->sTitle}</a>{$oItem->sAuthor} <span>{$oItem->sDate}</span></li>";
        }
        echo '</ul>';
        if ($oRss->IsCached()) {
            echo '<p>This feed is cached.</p>';
        }
        if ($oRss->IsStaleCache()) {
            echo '<p>Feed could not be retrieved / parsed. Content displayed from stale cache.';
        }
    }
}
?>