Esempio n. 1
0
 /**
  * Renders requested article and sends it to client.
  *
  * @param array $arguments
  */
 public function __invoke(array $arguments)
 {
     try {
         $slug = $arguments['slug'];
         $article = $this->domain->getArticleBySlug($slug);
         $this->responder->setTitle($article->getMetaTitle());
         $this->responder->setDescription($article->getDescription());
         $this->responder->setFeedUrl($this->feedDomain->getFeedUrlPath());
         $this->responder->setIndex($this->domain->getIndex());
         $this->responder->assign('article', $article);
         $this->responder->assign('navActive', 'blog');
         $this->responder->__invoke();
     } catch (NotFoundException $e) {
         $responder = new NotFoundResponder($this->config);
         $responder->assign('info', $e->getMessage());
         $responder->__invoke();
     }
 }
Esempio n. 2
0
 /**
  * Renders requested article and sends it to client.
  *
  * @param array $arguments
  */
 public function __invoke(array $arguments)
 {
     try {
         $category = $arguments['slug'] ?? '';
         $limit = $this->config['feed']['limit'];
         $articles = $this->domain->getArticles($limit, $category);
         if (!empty($articles)) {
             $pubDate = date(DATE_RSS, strtotime($articles[0]->getDate()));
             $this->responder->setChannelPubDate($pubDate);
         }
         $this->responder->setChannelTitle($this->config['seo']['blog']['title']);
         $this->responder->setChannelDescription($this->config['seo']['blog']['description']);
         $this->responder->setChannelLink($this->domain->getFeedUrlPath($category));
         $this->responder->addArticles($articles);
         $this->responder->__invoke();
     } catch (NotFoundException $e) {
         $this->responder->notFound($e->getMessage());
     }
 }
Esempio n. 3
0
 /**
  * Renders requested article and sends it to client.
  *
  * @param array $arguments
  */
 public function __invoke(array $arguments)
 {
     try {
         $category = $arguments['slug'] ?? '';
         $page = (int) ($arguments['page'] ?? 0);
         $this->responder->setPage($page);
         $this->responder->setTitle($this->domain->getTitle($page, $category));
         $this->responder->setDescription($this->domain->getDescription($page, $category));
         $this->responder->setIndex($this->domain->getIndex($page, $category));
         $this->responder->setFeedUrl($this->feedDomain->getFeedUrlPath($category));
         $this->responder->assign('articles', $this->domain->getArticles($page, $category));
         $this->responder->assign('urlNextPage', $this->domain->getUrlNextPage($page, $category));
         $this->responder->assign('urlPrevPage', $this->domain->getUrlPrevPage($page, $category));
         $this->responder->assign('navActive', 'blog');
         $this->responder->assign('showTitle', $page < 2);
         $this->responder->__invoke();
     } catch (NotFoundException $e) {
         $responder = new NotFoundResponder($this->config);
         $responder->assign('info', $e->getMessage());
         $responder->__invoke();
     }
 }