This contains all of the methods used for managing authors. It's mostly used by the Author landing, although some methods are used in Airship\Cabin\Bridge\Landing\Blog as well.
Inheritance: extends BlueprintGear, use trait Common, use trait Orderable, use trait Slug
Example #1
0
 /**
  * Loads all the necessary information for this author
  *
  * @param int $authorId
  */
 protected function loadAuthorInfo(int $authorId)
 {
     $this->authorId = $authorId;
     $this->authorName = $this->author->getName($authorId);
     $this->authorSlug = $this->author->getSlug($authorId);
     $this->storeLensVar('header', \__('Files for Author "%s"', 'default', Util::noHTML($this->authorName)));
     $this->storeLensVar('title', \__('Files for Author "%s"', 'default', Util::noHTML($this->authorName)));
     $this->root_dir = 'author/' . $this->authorSlug;
     $this->path_middle = 'author/files/' . $authorId;
     $this->storeLensVar('path_middle', $this->path_middle);
     $userId = $this->getActiveUserId();
     $this->attribution = ['author' => $authorId, 'uploaded_by' => $userId];
 }
Example #2
0
 /**
  * View a version of a blog post.
  *
  * @param string $postID
  * @param string $uniqueID
  *
  * @route blog/post/history/{id}/view/{string}
  */
 public function postHistoryView(string $postID = '', string $uniqueID = '')
 {
     $postID = (int) $postID;
     $blog = $this->blog->getBlogPostById($postID);
     if (!$blog || !$this->can('read')) {
         \Airship\redirect($this->airship_cabin_prefix . '/blog/post');
     }
     $blog['tags'] = $this->blog->getTagsForPost($postID);
     $version = $this->blog->getBlogPostVersionByUniqueId($uniqueID);
     if ((int) $version['postid'] !== $postID || empty($version)) {
         \Airship\redirect($this->airship_cabin_prefix . '/blog/post/history/' . $postID);
     }
     if ($this->isSuperUser()) {
         $authors = $this->author->getAll();
     } else {
         $authors = $this->author->getForUser($this->getActiveUserId());
     }
     $categories = $this->blog->getCategoryTree();
     $tags = $this->blog->getTags();
     $this->lens('blog/post_history_view', ['active_link' => 'bridge-link-blog-posts', 'authors' => $authors, 'blogpost' => $blog, 'categories' => $categories, 'tags' => $tags, 'title' => \__('Revision for  Blog Post "%s"', 'default', Util::noHTML($blog['title'])), 'prev_uniqueid' => $this->blog->getPrevVersionUniqueId($postID, (int) $version['versionid']), 'next_uniqueid' => $this->blog->getNextVersionUniqueId($postID, (int) $version['versionid']), 'version' => $version]);
 }