private function _load_author() { $Cache = PerchBlog_Cache::fetch(); $cached_authors = $Cache->get('authors'); if (!$cached_authors) { $Authors = new PerchBlog_Authors(); $authors = $Authors->all(); if (PerchUtil::count($authors)) { $cached_authors = array(); foreach ($authors as $Author) { $cached_authors[$Author->id()] = $Author; } $Cache->set('authors', $cached_authors); } } if ($cached_authors) { if (isset($cached_authors[$this->authorID()])) { $this->Author = $cached_authors[$this->authorID()]; return true; } } return false; }
<?php $Authors = new PerchBlog_Authors($API); $HTML = $API->get('HTML'); if (!$CurrentUser->has_priv('perch_blog.authors.manage')) { PerchUtil::redirect($API->app_path()); } $authors = $Authors->all();