Esempio n. 1
0
 public function latest()
 {
     if ($this->isLoggedIn && $this->request->has('personal') && $this->request->get('personal') == 'true') {
         $isCached = false;
         $bans = $this->repository->getPersonalBans($this->user->settings()->playerIds());
     } else {
         $isCached = Cache::has('bans.latest');
         $bans = $this->repository->getLatestBans();
     }
     if ($this->request->has('type') && $this->request->get('type') == 'rss') {
         $feed = Feed::make();
         $feed->title = sprintf('Latest Battlefield Bans by %s', Config::get('bfacp.site.title'));
         $feed->description = sprintf('Latest Battlefield Bans by %s', Config::get('bfacp.site.title'));
         $feed->setDateFormat('datetime');
         $feed->link = URL::to('api/bans/latest?type=rss');
         $feed->lang = 'en';
         foreach ($bans as $ban) {
             $title = sprintf('%s banned for %s', $ban['player']['SoldierName'], $ban['record']['record_message']);
             $view = View::make('system.rss.ban_entry_content', ['playerId' => $ban['player']['PlayerID'], 'playerName' => $ban['player']['SoldierName'], 'banreason' => $ban['record']['record_message'], 'sourceName' => $ban['record']['source_name'], 'sourceId' => $ban['record']['source_id'], 'banReason' => $ban['record']['record_message']]);
             $feed->add($title, $ban['record']['source_name'], $ban['player']['profile_url'], $ban['ban_startTime'], $title, $view->render());
         }
         return $feed->render('atom');
     }
     return MainHelper::response(['cols' => Lang::get('dashboard.bans.columns'), 'bans' => $bans], null, null, null, $isCached, true);
 }
Esempio n. 2
0
 protected function generate($language)
 {
     $xml = public_path() . "/{$language}/rss.xml";
     $feed = Feed::make();
     $feed->setDateFormat('datetime');
     $feed->setShortening(false);
     $feed->title = trans('meta.blog.title', [], 'messages', $language);
     $feed->description = trans('meta.blog.description', [], 'messages', $language);
     $feed->logo = url('img/cover.png');
     $feed->link = url("{$language}/rss.xml");
     $feed->pubdate = (new DateTime())->format(DateTime::ATOM);
     $feed->lang = $language;
     $loader = new PostLoader($language);
     $posts = $loader->loadList();
     uasort($posts, function ($a, $b) {
         return $a['published'] > $b['published'] ? -1 : 1;
     });
     $posts = array_slice($posts, 0, 10);
     foreach ($posts as $post) {
         $post = $loader->load($post['slug'], $post);
         $feed->addArray(['title' => $post['title'], 'author' => '*****@*****.**', 'link' => route('post', $post['slug']), 'pubdate' => $post['published']->format(DateTime::ATOM), 'description' => $post['intro'], 'content' => $post['content']]);
     }
     file_put_contents($xml, $feed->render('rss', -1));
     $this->info("RSS feed for site language {$language} was generated and saved to {$xml}");
 }
Esempio n. 3
0
 /**
  * Create a new feed controller instance.
  *
  * @return void
  */
 public function __construct()
 {
     $this->feed = Feed::make();
     $this->feed->title = Setting::get('app_name');
     $this->feed->description = trans('cachet.feed');
     $this->feed->link = Str::canonicalize(Setting::get('app_domain'));
     $this->feed->setDateFormat('datetime');
 }
Esempio n. 4
0
 public function __construct(FeedChanel $chanel = null)
 {
     $this->feeder = FeedEngine::make();
     $this->feeder->lang = Config::get('app.locale', 'en');
     $this->feeder->logo = asset('assets/img/logo.png');
     $this->feeder->setDateFormat('carbon');
     $this->feeder->setShortening(false);
     $this->feeder->description = Lang::get('pages.rss.description');
 }
Esempio n. 5
0
 /**
  * Generates an Atom feed of all incidents.
  *
  * @return \Illuminate\Http\Response
  */
 public function feedAction()
 {
     $feed = Feed::make();
     $feed->title = Setting::get('app_name');
     $feed->description = 'Status Feed';
     $feed->link = Setting::get('app_domain');
     $feed->setDateFormat('datetime');
     Incident::get()->map(function ($incident) use($feed) {
         if ($incident->component) {
             $componentName = $incident->component->name;
         } else {
             $componentName = null;
         }
         $feed->add($incident->name, Setting::get('app_name'), Setting::get('app_domain'), $incident->created_at, $componentName === null ? $incident->humanStatus : $componentName . " " . $incident->humanStatus, $incident->message);
     });
     return $feed->render('atom');
 }
Esempio n. 6
0
 public function feed()
 {
     $feed = Feed::make();
     $feed->setCache(5);
     if (!$feed->isCached()) {
         $articles = Article::published()->limit(20)->get();
         $feed->title = 'Quentin.ninja - articles';
         $feed->description = 'Derniers articles de Quentin.ninja';
         $feed->link = URL::to('feed');
         $feed->setDateFormat('datetime');
         $feed->pubdate = $articles[0]->published_at;
         $feed->lang = 'fr';
         $feed->setShortening(false);
         foreach ($articles as $article) {
             $feed->add($article->title, $article->user->name, URL::to(action("ArticleController@show", $article->url)), $article->published_at, $article->excerpt, $article->content);
         }
     }
     return $feed->render('atom')->header('Content-Type', "application/atom+xml");
 }
Esempio n. 7
0
 /**
  * Generates an Atom feed of all incidents.
  *
  * @param \CachetHQ\Cachet\Models\ComponentGroup|null $group
  *
  * @return \Illuminate\Http\Response
  */
 public function feedAction(ComponentGroup $group = null)
 {
     $feed = Feed::make();
     $feed->title = Setting::get('app_name');
     $feed->description = trans('cachet.feed');
     $feed->link = Str::canonicalize(Setting::get('app_domain'));
     $feed->setDateFormat('datetime');
     if ($group->exists) {
         $group->components->map(function ($component) use($feed) {
             $component->incidents()->visible()->orderBy('created_at', 'desc')->get()->map(function ($incident) use($feed) {
                 $this->feedAddItem($feed, $incident);
             });
         });
     } else {
         Incident::visible()->orderBy('created_at', 'desc')->get()->map(function ($incident) use($feed) {
             $this->feedAddItem($feed, $incident);
         });
     }
     return $feed->render('atom');
 }
Esempio n. 8
0
 /**
  * Show the form for creating a new resource.
  *
  * @return Response
  */
 public function news()
 {
     // 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 = Article::where('published', 1)->whereHas('categories', function ($query) {
             $query->where('slug', 'noticias');
         })->orderBy('created_at', 'DESC')->get();
         // set your feed's title, description, link, pubdate and language
         $feed->title = 'RSS Noticias';
         $feed->description = 'Noticias Laravel RSS';
         $feed->logo = 'http://yoursite.tld/logo.jpg';
         $feed->link = URL::to('feed');
         $feed->setDateFormat('datetime');
         // 'datetime', 'timestamp' or 'carbon'
         $feed->pubdate = $posts[0]->created_at;
         $feed->lang = 'es';
         $feed->setShortening(false);
         // 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
             $feed->add($post->title, $post->author, URL::to("noticias/" . $post->slug), $post->created_at, $post->body, $post->intro);
         }
     }
     // 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('atom');
     // to return your feed as a string set second param to -1
     // $xml = $feed->render('atom', -1);
 }
            $sitemap->add($url, $f->updated_at, '1.0', 'daily');
        }
        $payment_processors = DB::table('payment_processors')->orderBy('name', 'asc')->get();
        foreach ($payment_processors as $p) {
            $url = URL::to("/payment_processors/" . $p->slug);
            $sitemap->add($url, $p->updated_at, '1.0', 'daily');
            $rotator = URL::to("/payment_processors/" . $p->slug . '/rotator');
            $sitemap->add($rotator, $p->updated_at, '1.0', 'daily');
        }
    }
    // show your sitemap (options: 'xml' (default), 'html', 'txt', 'ror-rss', 'ror-rdf')
    return $sitemap->render('xml');
});
Route::get('feed', 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
    $faucets = DB::table('faucets')->orderBy('name', 'asc')->get();
    // set your feed's title, description, link, pubdate and language
    $feed->title = 'FreeBTC.Website Bitcoin Faucet Rotator Feed';
    $feed->description = 'The Atom/RSS feed which shows the latest bitcoin faucets.';
    $feed->link = URL::to('feed');
    $feed->setDateFormat('datetime');
    // 'datetime', 'timestamp' or 'carbon'
    $feed->pubdate = $faucets[0]->created_at;
    $feed->lang = 'en';
    $feed->setShortening(true);