Exemple #1
0
 function show()
 {
     $url = 'https://foodl.org/api/e/feed/uninett-sj3gr86sb3';
     $as = new Data_EventStream($this->fdb);
     $feed = $this->parameters[0];
     $as->prepareFeed($feed);
     // $feed = $this->parameters[0];
     // header('Content-type: text/plain; charset=utf-8');
     // echo "hello world\n" . $feed;
     // print_r($as->getData());
     $feedData = $as->getData();
     $rssfeed = new RSS2FeedWriter();
     $rssfeed->setTitle('UNINETT Foodle');
     $rssfeed->setLink('https://foodl.org');
     $rssfeed->setDescription('Foodle is a simple tool for meeting invitations and polls');
     // $rssfeed->setImage('Testing the RSS writer class','http://www.ajaxray.com/projects/rss','http://www.rightbrainsolution.com/_resources/img/logo.png');
     foreach ($feedData as $feedItem) {
         $rssitem = $rssfeed->createNewItem();
         $rssitem->setTitle($feedItem['foodle']['name']);
         $rssitem->setLink('https://foodl.org/foodle/' . $feedItem['foodle']['id']);
         //The parameter is a timestamp for setDate() function
         $rssitem->setDate($feedItem['foodle']['unix']);
         $rssitem->setDescription($feedItem['foodle']['descr']);
         $rssfeed->addItem($rssitem);
     }
     $rssfeed->generateFeed();
     exit;
 }
Exemple #2
0
    include $settings;
} else {
    die('no settngs');
}
if (is_file($feed_lib) && is_readable($feed_lib)) {
    include $feed_lib;
} else {
    die('no feed lib');
}
if (!idiorm($idiorm_lib)) {
    die('Idiorm error');
}
$feed = new RSS2FeedWriter();
$feed->setTitle(MSettings::$sitename);
$feed->setLink($url);
$feed->setDescription('');
//Image title and link must match with the 'title' and 'link' channel elements for RSS 2.0
//$feed->setImage('Testing the RSS writer class','http://www.ajaxray.com/projects/rss','http://www.rightbrainsolution.com/_resources/img/logo.png');
$feed->setChannelElement('language', 'en-us');
$feed->setChannelElement('pubDate', date(DATE_RSS, time()));
$contents = ORM::for_table('contents')->where('enabled', 1)->find_many();
if (sizeof($contents) > 0) {
    foreach ($contents as $content) {
        $item = $feed->createNewItem();
        $item->setTitle($content->title);
        $item->setLink($content_url . $content->id);
        $item->setDate(strtotime($content->created));
        $item->setDescription(strip_tags($content->text));
        //$item->addElement('author', 'admin@ajaxray.com (Anis uddin Ahmad)');
        $feed->addItem($item);
    }