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; }
<?php include "libs/FeedTypes.php"; include "libs/simple_html_dom.php"; //Creating an instance of FeedWriter class. $TestFeed = new RSS2FeedWriter(); $TestFeed->setTitle('XOP Fansub'); $TestFeed->setLink('https://xopfansub.wordpress.com/'); $tidy_config = dirname(__FILE__) . "/tidy.conf"; $html_text = file_get_contents("https://xopfansub.wordpress.com/") or exit(1); $tidy = tidy_parse_string($html_text, $tidy_config, 'UTF8'); tidy_clean_repair($tidy); $html = str_get_html(tidy_get_output($tidy)); $go_on = TRUE; $feed_count = 0; while ($go_on) { //parse through the HTML and build up the RSS feed as we go along foreach ($html->find('div.post') as $article) { //Create an empty FeedItem $newItem = $TestFeed->createNewItem(); //Look up and add elements to the feed item $title = $article->find('div.post-header h2 a', 0); if ($title != NULL) { $newItem->setTitle($title->innertext); } else { $newItem->setTitle('(Sense títol)'); } $description = $article->find('div.entry', 0)->innertext; //We replace the sharer with an empty string to remove the share links foreach ($article->find('div.entry div#jp-post-flair') as $sharer) { $description = str_replace($sharer->outertext, '', $description);
/** * rss feed * * @return void */ public function rss() { $this->needsLoggedInOrPublicMode(); $feedWriter = new \RSS2FeedWriter(); $feedWriter->setTitle(\F3::get('rss_title')); $feedWriter->setLink($this->view->base); // get sources $sourceDao = new \daos\Sources(); $lastSourceId = 0; $lastSourceName = ""; // set options $options = array(); if (count($_GET) > 0) { $options = $_GET; } $options['items'] = \F3::get('rss_max_items'); if (\F3::get('PARAMS["tag"]') != null) { $options['tag'] = \F3::get('PARAMS["tag"]'); } if (\F3::get('PARAMS["type"]') != null) { $options['type'] = \F3::get('PARAMS["type"]'); } // get items $newestEntryDate = false; $lastid = -1; $itemDao = new \daos\Items(); foreach ($itemDao->get($options) as $item) { if ($newestEntryDate === false) { $newestEntryDate = $item['datetime']; } $newItem = $feedWriter->createNewItem(); // get Source Name if ($item['source'] != $lastSourceId) { foreach ($sourceDao->get() as $source) { if ($source['id'] == $item['source']) { $lastSourceId = $source['id']; $lastSourceName = $source['title']; break; } } } $newItem->setTitle(str_replace('&', '&', $this->UTF8entities($item['title'] . " (" . $lastSourceName . ")"))); @$newItem->setLink($item['link']); $newItem->setDate($item['datetime']); $newItem->setDescription(str_replace('"', '"', $item['content'])); // add tags in category node $itemsTags = explode(",", $item['tags']); foreach ($itemsTags as $tag) { $tag = trim($tag); if (strlen($tag) > 0) { $newItem->addElement('category', $tag); } } $feedWriter->addItem($newItem); $lastid = $item['id']; // mark as read if (\F3::get('rss_mark_as_read') == 1 && $lastid != -1) { $itemDao->mark($lastid); } } if ($newestEntryDate === false) { $newestEntryDate = date(\DATE_ATOM, time()); } $feedWriter->setChannelElement('updated', $newestEntryDate); $feedWriter->generateFeed(); }
<?php include "libs/FeedTypes.php"; include "libs/simple_html_dom.php"; //Creating an instance of FeedWriter class. $TestFeed = new RSS2FeedWriter(); $TestFeed->setTitle('Seireitei no Fansub'); $TestFeed->setLink('http://seireiteinofansub.blogspot.com.es/'); $tidy_config = dirname(__FILE__) . "/tidy.conf"; $html_text = file_get_contents("http://seireiteinofansub.blogspot.com.es/") or exit(1); $tidy = tidy_parse_string($html_text, $tidy_config, 'UTF8'); tidy_clean_repair($tidy); $html = str_get_html(tidy_get_output($tidy)); $go_on = TRUE; $feed_count = 0; while ($go_on) { //parse through the HTML and build up the RSS feed as we go along foreach ($html->find('div.post') as $article) { //Create an empty FeedItem $newItem = $TestFeed->createNewItem(); //Look up and add elements to the feed item $title = $article->find('h3.post-title a', 0); if ($title != NULL) { $newItem->setTitle($title->innertext); } else { $newItem->setTitle('(Sense títol)'); } $description = $article->find('div.post-body', 0)->innertext; //We remove the password string (seems to always be the same) $description = str_replace("<b>Contrasenya: snf</b>", '', $description); $newItem->setDescription($description);
<?php include "libs/FeedTypes.php"; include "libs/simple_html_dom.php"; //Creating an instance of FeedWriter class. $TestFeed = new RSS2FeedWriter(); $TestFeed->setTitle('Lluna Plena no Fansub'); $TestFeed->setLink('http://llunaplenanofansub.blogspot.com.es/'); $tidy_config = dirname(__FILE__) . "/tidy.conf"; $blog_urls = array("http://llunaplenanofansub.blogspot.com.es/", "http://cuadefada.blogspot.com.es/", "http://unapeca.blogspot.com.es/"); $feed_count = 0; foreach ($blog_urls as $blog_url) { $html_text = file_get_contents($blog_url) or exit(1); $tidy = tidy_parse_string($html_text, $tidy_config, 'UTF8'); tidy_clean_repair($tidy); $html = str_get_html(tidy_get_output($tidy)); $go_on = TRUE; while ($go_on) { //parse through the HTML and build up the RSS feed as we go along foreach ($html->find('div.post') as $article) { //We only show news with tag "Notícies" from the main blog, or we will also show the series pages... if ($blog_url != 'http://llunaplenanofansub.blogspot.com.es/' || $article->find('span.post-labels', 0) && (strpos($article->find('span.post-labels', 0)->innertext, 'Notícies') !== FALSE || strpos($article->find('span.post-labels', 0)->innertext, 'Noticies') !== FALSE)) { //Create an empty FeedItem $newItem = $TestFeed->createNewItem(); //Look up and add elements to the feed item $title = $article->find('h3.post-title a', 0); if ($title != NULL) { $newItem->setTitle($title->innertext); } else { $newItem->setTitle('(Sense títol)'); }
<?php include "libs/FeedTypes.php"; include "libs/simple_html_dom.php"; //Creating an instance of FeedWriter class. $TestFeed = new RSS2FeedWriter(); $TestFeed->setTitle('Ippantekina jimaku'); $TestFeed->setLink('http://ippantekina.blogspot.com/'); $tidy_config = dirname(__FILE__) . "/tidy.conf"; $html_text = file_get_contents("http://ippantekina.blogspot.com/") or exit(1); $tidy = tidy_parse_string($html_text, $tidy_config, 'UTF8'); tidy_clean_repair($tidy); $html = str_get_html(tidy_get_output($tidy)); $go_on = TRUE; $feed_count = 0; while ($go_on) { //parse through the HTML and build up the RSS feed as we go along foreach ($html->find('div.post') as $article) { //Create an empty FeedItem $newItem = $TestFeed->createNewItem(); //Look up and add elements to the feed item $title = $article->find('h3.post-title a', 0); if ($title != NULL) { $newItem->setTitle($title->innertext); } else { $newItem->setTitle('(Sense títol)'); } $newItem->setDescription($article->find('div.post-body', 0)->innertext); if ($title != NULL) { $newItem->setLink($title->href); } else {
$content_url = substr($url, 0, strpos($url, '/feed')) . '/index.php?module=content&object='; if (is_file($settings) && is_readable($settings)) { 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)');
<?php include "libs/FeedTypes.php"; include "libs/simple_html_dom.php"; //Creating an instance of FeedWriter class. $TestFeed = new RSS2FeedWriter(); $TestFeed->setTitle('CatSub'); $TestFeed->setLink('http://www.catsub.net/'); $tidy_config = dirname(__FILE__) . "/tidy.conf"; $html_text = file_get_contents("http://www.catsub.net/") or exit(1); $tidy = tidy_parse_string($html_text, $tidy_config, 'UTF8'); tidy_clean_repair($tidy); $html = str_get_html(tidy_get_output($tidy)); $go_on = TRUE; $feed_count = 0; while ($go_on) { //parse through the HTML and build up the RSS feed as we go along foreach ($html->find('div.cs_news') as $article) { //Create an empty FeedItem $newItem = $TestFeed->createNewItem(); //Look up and add elements to the feed item $newItem->setTitle($article->find('div.cs_newstitle a', 0)->innertext); $description = $article->find('div.cs_newscontent', 0)->innertext; //Remove the download icon, or it will be the first image of the feed $description = preg_replace("/\\<img (.*)dlicon(.*)Descàrregues\" \\/\\>/i", '', $description); //Remove the post-screenshot text if (strpos($description, 'cs_newsimage') !== 0) { $description = preg_replace("/\\<strong\\>(.*)\\<\\/strong\\>\$/i", '', trim($description)); } $newItem->setDescription($description); $newItem->setLink("http://www.catsub.net/" . $article->find('div.cs_newstitle a', 0)->href);