listAllPublic() public method

Return all blog posts
public listAllPublic ( ) : array
return array
Beispiel #1
0
 /**
  * List all of the blog posts
  *
  * @route blog/all
  * @throws EmulatePageNotFound
  */
 public function listAll()
 {
     if (!$this->can('read')) {
         throw new EmulatePageNotFound();
     }
     $blogRoll = $this->blog->listAllPublic();
     $mathJAX = false;
     foreach ($blogRoll as $i => $blog) {
         $blogRoll[$i] = $this->blog->getSnippet($blog);
         if (Binary::safeStrlen($blogRoll[$i]['snippet']) !== Binary::safeStrlen($blog['body'])) {
             $blogRoll[$i]['snippet'] = \rtrim($blogRoll[$i]['snippet'], "\n");
         }
         $mathJAX = $mathJAX || \strpos($blog['body'], '$$') !== false;
     }
     $args = ['pageTitle' => 'All Blog Posts', 'blogroll' => $blogRoll, 'mathjax' => $mathJAX];
     $this->config('blog.cachelists') ? $this->stasis('blog/all', $args) : $this->lens('blog/all', $args);
 }