示例#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);
 }
示例#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}");
 }
示例#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('gitamin.feed');
     $this->feed->link = Str::canonicalize(Setting::get('app_domain'));
     $this->feed->setDateFormat('datetime');
 }
示例#4
0
文件: Feed.php 项目: ankhzet/Ankh
 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');
 }
示例#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');
 }
示例#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");
 }
示例#7
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);
示例#9
0
 /**
  * Adds an item to the feed.
  *
  * @param \Roumen\Feed\Facades\Feed        $feed
  * @param \CachetHQ\Cachet\Models\Incident $incident
  */
 private function feedAddItem(&$feed, $incident)
 {
     $feed->add($incident->name, Setting::get('app_name'), Str::canonicalize(Setting::get('app_domain')) . '#' . $incident->id, $incident->created_at->toRssString(), $incident->message);
 }
示例#10
0
 /**
  * Adds an item to the feed.
  *
  * @param \Roumen\Feed\Facades\Feed        $feed
  * @param \CachetHQ\Cachet\Models\Incident $incident
  *
  * @return void
  */
 private function feedAddItem(&$feed, $incident)
 {
     $feed->add($incident->name, Setting::get('app_name'), Str::canonicalize(Setting::get('app_domain')) . '#' . $incident->id, $incident->created_at->toAtomString(), Markdown::convertToHtml($incident->message));
 }
示例#11
0
 /**
  * Adds an item to the feed.
  *
  * @param \CachetHQ\Cachet\Models\Incident $incident
  * @param bool                             $isRss
  */
 private function feedAddItem(Incident $incident, $isRss)
 {
     $this->feed->add($incident->name, Setting::get('app_name'), Str::canonicalize(route('incident', ['id' => $incident->id])), $isRss ? $incident->created_at->toRssString() : $incident->created_at->toAtomString(), $isRss ? $incident->message : Markdown::convertToHtml($incident->message));
 }
示例#12
0
 /**
  * Adds an item to the feed.
  *
  * @param \Roumen\Feed\Facades\Feed        $feed
  * @param \CachetHQ\Cachet\Models\Incident $incident
  */
 private function feedAddItem(&$feed, $incident)
 {
     $feed->add($incident->name, Setting::get('app_name'), Str::canonicalize(route('incident', ['id' => $incident->id])), $incident->created_at->toRssString(), $incident->message);
 }
示例#13
0
 /**
  * Adds an item to the feed.
  *
  * @param \Gitamin\Models\Issue $issue
  * @param bool                  $isRss
  */
 private function feedAddItem($issue, $isRss)
 {
     $this->feed->add($issue->name, Setting::get('app_name'), Str::canonicalize($issue->url), $isRss ? $issue->created_at->toRssString() : $issue->created_at->toAtomString(), $isRss ? $issue->message : Markdown::convertToHtml($issue->message));
 }