public function getFeed()
 {
     $feed = Feed::make();
     //$feed->clearCache();
     $feed->setCache(180, 'shantavo-feed');
     if (!$feed->isCached()) {
         $pictures = Picture::orderBy('uploaded_at', 'desc')->take(20)->get();
         $feed->title = 'Нещо Шантаво';
         $feed->description = 'Последни снимки';
         $feed->link = 'https://neshto.shantavo.com/';
         $feed->logo = "https://neshto.shantavo.com/favicon.png";
         $feed->icon = "https://neshto.shantavo.com/favicon.png";
         $feed->pubdate = $pictures[0]->uploaded_at;
         $feed->lang = 'bg';
         $feed->setDateFormat('datetime');
         foreach ($pictures as $picture) {
             $feed->add($picture->title, $picture->user->username, secure_url('picture/' . $picture->id), $picture->uploaded_at, $picture->title, $picture->title);
         }
     }
     return $feed->render('atom');
 }
Beispiel #2
0
 public function generateFeed()
 {
     $articles = $this->getArticles();
     $feed = Feed::make();
     // set your feed's title, description, link, pubdate and language
     $feed->title = 'cnBeta1';
     $feed->description = '一个干净、现代、开放的cnBeta';
     $feed->logo = 'http://cnbeta1.com/assets/img/cnbeta1.png';
     $feed->link = URL::to('feed');
     $feed->pubdate = $articles[0]['date'];
     $feed->lang = 'zh-cn';
     foreach ($articles as $article) {
         $articleModel = new Article($article['article_id']);
         try {
             $articleModel->load();
         } catch (Exception $ex) {
             Log::error('feed: fail to fetch article: ' . $article['article_id'] . ', error: ' . $ex->getMessage());
         }
         $content = $article['intro'];
         $content .= $articleModel->data['content'] ? $articleModel->data['content'] : '';
         // set item's title, author, url, pubdate, description and content
         $feed->add($article['title'], 'cnBeta1', URL::to($article['article_id']), $article['date'], $content, $content);
     }
     $this->data = $feed->render('atom', -1);
     $this->saveToCache();
 }
Beispiel #3
0
 /**
  * generate xss/atom from spreadit
  *
  * @param string $section_title
  * @return Roumen\Feed
  */
 protected function generate($section_title)
 {
     $sections = $this->section->getByTitle(Utility::splitByTitle($section_title));
     if (empty($sections)) {
         App::abort(404);
     }
     $section = $this->section->sectionFromSections($sections);
     $posts = $this->post->getHotList(F::map($sections, function ($m) {
         return $m->id;
     }), $this->vote);
     $feed = Feed::make();
     $feed->title = $section_title;
     $feed->description = "read hot posts from {$section_title}";
     $feed->link = URL::to("/s/{$section_title}");
     $feed->lang = 'en';
     $created_at_counter = 0;
     foreach ($posts as $post) {
         $feed->add($post->title, $post->username, URL::to($post->url), date(DATE_ATOM, $post->created_at), $post->markdown);
         if ($post->created_at > $created_at_counter) {
             $created_at_counter = $post->created_at;
         }
     }
     $feed->pubdate = date(DATE_ATOM, $created_at_counter);
     return $feed;
 }
Beispiel #4
0
 public function testPostID()
 {
     $view = Feed::make();
     $entries = $view['entries'];
     $this->assertTrue(isset($entries[0]['id']));
     $this->assertRegExp('/^tag:.*,[\\d]+:.*\\.post-.*$/', $entries[0]['id']);
 }
 /**
  * Gets the news feed for the site
  *
  * @param  string  $type
  * @return void
  */
 public function getFeed($type = 'rss')
 {
     // Create feeder instance
     $feed = Feed::make($type);
     // Only the public pastes are accessible in the feed
     $query = Paste::where('private', '<>', 1);
     // We fetch 100 pastes only
     $pastes = $query->take(100)->orderBy('id', 'desc')->get();
     // We populate the data manually here as there is some
     // per item processing to be done
     $list = array();
     // Get the key for each paste item
     foreach ($pastes as $paste) {
         $list[] = $paste->toArray();
     }
     // Serve the feed output
     return $feed->out(array('pastes' => $list));
 }
Beispiel #6
0
 /**
  *	Method to handle document RSS feeds.
  *
  *	@param string $slug
  *
  * @return view $feed->render()
  */
 public function getFeed($slug)
 {
     $doc = Doc::where('slug', $slug)->with('comments', 'annotations', 'userSponsor', 'groupSponsor')->first();
     $feed = Feed::make();
     $feed->title = $doc->title;
     $feed->description = "Activity feed for '" . $doc->title . "'";
     $feed->link = URL::to('docs/' . $slug);
     $feed->pubdate = $doc->updated_at;
     $feed->lang = 'en';
     $activities = $doc->comments->merge($doc->annotations);
     $activities = $activities->sort(function ($a, $b) {
         return strtotime($a['updated_at']) > strtotime($b['updated_at']) ? -1 : 1;
     });
     foreach ($activities as $activity) {
         $item = $activity->getFeedItem();
         array_push($feed->items, $item);
     }
     return $feed->render('atom');
 }
Beispiel #7
0
 public function action_rss($input_format)
 {
     Log::info($input_format);
     if ($input_format == "rss") {
         $format = "rss20";
         $content_type = "application/rss+xml; charset=ISO-8859-1";
     } elseif ($input_format == "atom") {
         $format = "atom";
         $content_type = "application/atom+xml";
     } else {
         return Response::error('404');
     }
     $feed = Feed::make();
     $feed->author('The RFP-EZ Team')->pubdate(time())->ttl(60)->title('Government Contracting Opportunities on RFP-EZ')->description('Government Contracting Opportunities on RFP-EZ')->permalink(route('project_rss', 'rss20'))->baseurl(URL::home());
     foreach (Project::open_projects()->take(20)->order_by('posted_to_fbo_at', 'desc')->get() as $project) {
         $feed->entry()->published($project->posted_to_fbo_at)->description()->add('html', $project->background)->up()->title($project->title)->permalink(route('project', $project->id));
     }
     Config::set("application.profiler", false);
     return Response::make($feed->send($format), 200, array('Content-type' => $content_type));
 }
 public static function generateRssFeed()
 {
     $config = Config::get('siteConfig');
     // create new feed
     $feed = Feed::make();
     // cache the feed for 10 minutes (second parameter is optional)
     $feed->setCache(10, 'list-rss-feed');
     // check if there is cached feed and build new only if is not
     if (!$feed->isCached()) {
         // creating rss feed with our most recent 20 posts
         $lists = ViralList::orderBy('created_at', 'desc')->take(20)->get();
         // set your feed's title, description, link, pubdate and language
         $feed->title = $config['main']['siteTitle'];
         $feed->description = @$config['main']['siteDescription'];
         $feed->logo = @asset($config['main']['logo']);
         $feed->link = URL::route('rssFeed');
         $feed->setDateFormat('datetime');
         // 'datetime', 'timestamp' or 'carbon'
         $feed->pubdate = $lists->count() ? $lists[0]->created_at : time();
         $feed->lang = $config['languages']['activeLanguage'];
         $feed->setShortening(true);
         // true or false
         $feed->setTextLimit(100);
         // maximum length of description text
         foreach ($lists as $list) {
             // set item's title, author, url, pubdate, description and content
             $listContentHtml = View::make('lists.rssFeedListContent', ['list' => $list]);
             $feed->add($list->title, $list->creator->name, ListHelpers::viewListUrl($list), $list->created_at->toDateTimeString(), $list->description, $listContentHtml);
         }
     }
     // first param is the feed format
     // optional: second param is cache duration (value of 0 turns off caching)
     // optional: you can set custom cache key with 3rd param as string
     return $feed->render('rss');
     // to return your feed as a string set second param to -1
     // $xml = $feed->render('atom', -1);
 }
 public function getFeed()
 {
     // creating rss feed with our most recent 20 posts
     $posts = $this->post->getAll('published', null, 'published_at', 'desc', 20);
     //$paginate = null, $sort_by = 'created_at', $order = 'desc', $limit = null
     $feed = \Feed::make();
     // set your feed's title, description, link, pubdate and language
     $feed->title = \Cache::get('settings')['site_name'];
     $feed->description = \Cache::get('settings')['meta_description'];
     $feed->logo = '';
     $feed->link = link_to('feed');
     $feed->pubdate = $posts[0]->published_at;
     $feed->lang = 'en';
     foreach ($posts as $post) {
         // set item's title, author, url, pubdate, description and content
         $feed->add($post->title, $post->creator->full_name, link_to($post->url), $post->published_at, htmlentities($post->intro), htmlentities($post->content));
     }
     return $feed->render('atom', 60);
 }
 public function rssGenerator($updates = null)
 {
     if ($updates == "updates") {
         $sites = DB::table('archive')->where('action', 'UPDATE')->take(100)->orderBy('archive_date', 'desc')->get();
     } else {
         if ($updates == "all") {
             $sites = DB::table('archive')->take(100)->orderBy('archive_date', 'desc')->get();
         } else {
             $sites = DB::table('archive')->whereNotIn('action', array('UPDATE'))->orderBy('archive_date', 'desc')->take(100)->get();
         }
     }
     foreach ($sites as $site) {
         $site = (array) $site;
         $major = 0;
         $minor = 0;
         if ($site['show_counts'] == 0) {
             $site['patients'] = 0;
             $site['encounters'] = 0;
             $site['observations'] = 0;
         }
         $atlasVersion = json_decode($site['atlas_version']);
         if ($atlasVersion != null) {
             list($major, $minor) = explode(".", $atlasVersion);
         }
         if ($major >= 1 && $minor > 1) {
             unset($site['data']);
             //TODO
             $sitesList[] = $site;
         } else {
             $dataJson = json_decode($site['data'], true);
             $version = $dataJson['version'];
             $site['version'] = $version;
             unset($site['data']);
             $sitesList[] = $site;
         }
     }
     $feed = Feed::make();
     $openmrs = new FeedPerson();
     $openmrs->name('OpenMRS');
     $openmrs->email('*****@*****.**');
     $logo = new FeedImage();
     $logo->title('OpenMRS Atlas Feed');
     $logo->imageUrl(asset('images/openmrs.gif'));
     $logo->linkUrl(route('home'));
     $feed->channel()->BaseURL(route('home'));
     $feed->channel()->Title()->Add('text', 'OpenMRS Atlas Feed');
     $feed->channel()->Author(0, $openmrs);
     $feed->channel()->permalink(route('rss'));
     $feed->channel()->Description()->Add('text', 'Latest updates on OpenMRS Atlas');
     $feed->links()->add(new FeedLink('text', route('home')));
     $feed->logo()->title('OpenMRS Atlas Feed')->imageUrl(asset('images/openmrs.gif'))->linkUrl(route('home'))->up()->pubdate(time())->permalink(route('rss'))->baseurl(route('home'));
     foreach ($sitesList as $site) {
         $title = $site['name'];
         if ($site['action'] === "ADD") {
             $title = $site['name'] . " joined the OpenMRS Atlas";
         }
         if ($site['action'] === "UPDATE") {
             $title = $site['name'] . " updated on OpenMRS Atlas";
         }
         if ($site['action'] === "DELETE") {
             $title = "OpenMRS Atlas bids farewell to " . $site['name'];
         }
         $dateCreated = new DateTime($site['date_created']);
         $notes = $site['notes'] == "" ? "" : "<br><b>Notes:</b> " . $site['notes'];
         $url = $site['url'] == "" && filter_var($site['url'], FILTER_VALIDATE_URL) ? "" : "<br><a href=\"" . $site['url'] . "\">" . $site['url'] . "</a>";
         $observations = preg_match("/^\$|0/", $site['observations']) ? "" : "<br><b>Observation:</b> " . $site['observations'];
         $encounters = preg_match("/^\$|0/", $site['encounters']) ? "" : "<br><b>Encounters:</b> " . $site['encounters'];
         $patients = preg_match("/^\$|0/", $site['patients']) ? "" : "<br><b>Patients:</b> " . $site['patients'];
         $counts = $encounters . $patients . $observations;
         $site['version'] = $site['version'] == "" ? "Unknown" : $site['version'];
         $content = '<b>OpenMRS Version :</b> ' . $site['version'] . $counts . $notes . "<br><b>Date created :</b> " . $dateCreated->format('Y-m-d H:i:s') . $url;
         $date = new DateTime($site['archive_date']);
         $feed->entry()->published($date->getTimeStamp())->author()->name($site['contact'])->email($site['email'])->up()->title($title)->guid($site['id'])->permalink(route('home') . '?site=' . $site['site_uuid'])->category($site['type'])->content()->add('html', $content)->up();
     }
     $response = Response::make($feed->Rss20(), 200);
     $response->header('Content-Type', 'application/rss+xml');
     return $response;
 }
Route::get('/adddummypost', array('as' => 'adddummypost', 'uses' => 'AdminController@adddummypost'));
//PBN LITE
Route::get('/postpbnlite', array('as' => 'postpbnlite', 'uses' => 'ApiController@pbnlite'));
// auto save for draft
Route::post('/auto-save-now', array('as' => 'auto_save_form', 'uses' => 'ApiController@auto_save_form'));
// phonegap api feed
Route::post('/api_hybrid_feed', array('as' => 'api_hybrid_feed', 'uses' => 'ApiController@api_hybrid_feed'));
// Admin panel App's API
Route::get('/postlist', array('as' => 'postList', 'uses' => 'ApiController@postList'));
Route::get('/postDetail', array('as' => 'postDetail', 'uses' => 'ApiController@postDetail'));
Route::post('/ajax_now', array('as' => 'post_api_ajax', 'uses' => 'ApiController@api_ajax_loading'));
Route::post('/addPostProcess', array('as' => 'addApiPostProcess', 'uses' => 'ApiController@addApiPostProcess'));
// point blank feed
Route::get('/rss', function () {
    // create new feed
    $feed = Feed::make();
    // cache the feed for 60 minutes (second parameter is optional)
    $feed->setCache(60, 'laravelFeedKey');
    // check if there is cached feed and build new only if is not
    if (!$feed->isCached()) {
        // creating rss feed with our most recent 20 posts
        $posts = DB::table('posts')->orderBy('created_at', 'desc')->where('is_approved', 1)->take(20)->get();
        // set your feed's title, description, link, pubdate and language
        $feed->title = 'Point Blank News';
        $feed->description = 'Point Blank News is short news CMS.';
        $feed->logo = Setting::get('logo');
        $feed->link = URL::to('/');
        $feed->setDateFormat('datetime');
        // 'datetime', 'timestamp' or 'carbon'
        $feed->pubdate = $posts[0]->created_at;
        $feed->lang = 'en';
Beispiel #12
0
<?php

require_once 'chained.php';
Feed::make()->title()->add('text', 'My Feed')->add('html', 'My <em>Feed</em>')->up()->author()->name('Proger_XP')->email('*****@*****.**')->up()->description()->add('text', 'Just another PHP Feed')->up()->baseurl('http://' . $_SERVER['HTTP_HOST'] . dirname($_SERVER['REQUEST_URI']) . '/')->entry()->title()->add('text', 'My first post')->up()->updated(strtotime('22 Jan 2011'))->author()->name('Proger_XP')->email('*****@*****.**')->up()->content()->add('text', 'Thinking about something to write...')->add('html', 'Thinking about <em>something</em> to write&hellip;')->entry()->title()->add('text', 'Another filler')->up()->updated(strtotime('23 May 2012'))->author()->name('Proger_XP')->email('*****@*****.**')->up()->contributor()->name('Camilo')->url('http://camilomm.deviantart.com')->up()->content()->add('html', 'Why? Because he\'s my friend <img src="smile.png" />')->feed()->atom();
Beispiel #13
0
 function show()
 {
     $puntoFeed = Feed::orWhere(function ($query) {
         $query->where('url', '=', Request::path());
     })->orWhere(function ($query) {
         $query->where('url', '=', '/' . Request::path());
     })->orWhere(function ($query) {
         $query->where('url', '=', Request::url());
     })->get()->first();
     $feed = \Feed::make();
     $feed->setTextLimit(10000);
     $feed->setView('punto-cms::rss');
     // cache the feed for 60 minutes (second parameter is optional)
     if ($this->useCache) {
         $feed->setCache(0, $puntoFeed->name);
     }
     // check if there is cached feed and build new only if is not
     if (!$this->useCache || !$feed->isCached()) {
         // creating rss feed with our most recent 20 posts
         $posts = Post::where('page_id', '=', $puntoFeed->page_id)->where('section_id', '=', $puntoFeed->section_id)->orderBy('created_at', 'desc')->get();
         // set your feed's title, description, link, pubdate and language
         $feed->title = $puntoFeed->name;
         $feed->description = '';
         //            $feed->logo = 'http://yoursite.tld/logo.jpg';
         $feed->link = Request::url();
         $feed->setDateFormat('datetime');
         // 'datetime', 'timestamp' or 'carbon'
         if (isset($posts[0])) {
             $feed->pubdate = $posts[0]->created_at;
         }
         $feed->lang = 'en';
         $feed->setShortening(true);
         // true or false
         //            $feed->setTextLimit(100); // maximum length of description text
         foreach ($posts as $post) {
             // set item's title, author, url, pubdate, description and content
             $desc = null;
             $title = null;
             if ($post->hasContent("Description")) {
                 $desc = $post->findContent("Description")->value;
             } else {
                 if ($post->hasContent("Title")) {
                     $desc = $post->findContent("Title")->value;
                 } else {
                     if ($post->hasContent("Name")) {
                         $desc = $post->findContent("Name")->value;
                     }
                 }
             }
             if ($post->hasContent("Title")) {
                 $title = $post->findContent("Title")->value;
             } else {
                 if ($post->hasContent("Name")) {
                     $title = $post->findContent("Name")->value;
                 } else {
                     if ($post->hasContent("Description")) {
                         $title = $post->findContent("Description")->value;
                     }
                 }
             }
             if ($desc !== null) {
                 $feed->add($title, null, null, $post->created_at, $desc, null);
             }
         }
     } else {
     }
     // first param is the feed format
     // optional: second param is cache duration (value of 0 turns off caching)
     // optional: you can set custom cache key with 3rd param as string
     return $feed->render('rss');
 }