示例#1
0
 /**
  * Method to grab RSS data as an array of PSU Zend Feed objects
  * @param string $url A string containing the url of the feed source
  */
 public function get_rss_source($url)
 {
     // \PSU\Feed::import can throw many exceptions due to the Zend underpinnings. We don't need to handle them individually, so let's just catch them all
     // Possible exceptions seen so far:
     // Zend_Feed_Exception
     // Zend_Http_Client_Exception
     // Zend_Http_Client_Adapter_Exception
     try {
         // Get the feed data
         $feed_data = \PSU\Feed::import($url);
     } catch (\Exception $e) {
         // For now, lets just grab the exception and put it into the session
         $_SESSION['errors'][] = $e->getMessage();
     }
     return $feed_data;
 }
示例#2
0
    $mycomics = true;
    $my_subscribed_comics = PSU::db('go')->GetOne("SELECT value FROM user_meta WHERE pidm = ? AND name = 'mycomics'", array($_SESSION['pidm']));
    if (!$my_subscribed_comics) {
        $safe = array('blondie', 'dilbert', 'archie', 'calvin', 'beetlebailey', 'dennisthemenace', 'garfield', 'heathcliff', 'mothergooseandgrimm', 'sallyforth', 'ziggy', 'wizardofid', 'hagar');
        $my_subscribed_comics = $safe[array_rand($safe)];
    }
    $comics_rss_url = 'http://darkgate.net/comic/rss2.php?';
    $_GET['url'] = $comics_rss_url . $my_subscribed_comics;
}
$bad_rss = strpos($_GET['url'], 'merlot.org') !== false;
$nytimes = strpos($_GET['url'], 'nytimes.com') !== false;
/**
 * Have Zend go out and pull in the feed that we are looking at.
 */
try {
    $rss = Feed::import($_GET['url']);
} catch (Zend_Feed_Exception $e) {
    echo "Exception caught importing feed: {$e->getMessage()}\n";
    exit;
}
/**
 * Set the $rss object parameters to match the values passed into the channel.
 */
$rss->max = $num;
$rss->open = $open;
$rss->expand = $expand;
$rss->summary = $summary;
switch ($expand) {
    case EXPAND_FORCED:
        $li_class = 'expanded';
        break;