private function _load_blog()
 {
     $Cache = PerchBlog_Cache::fetch();
     $cached_blogs = $Cache->get('blogs');
     if (!$cached_blogs) {
         $Blogs = new PerchBlog_Blogs();
         $blogs = $Blogs->all();
         if (PerchUtil::count($blogs)) {
             $cached_blogs = array();
             foreach ($blogs as $Blog) {
                 $cached_blogs[$Blog->id()] = $Blog;
             }
             $Cache->set('blogs', $cached_blogs);
         }
     }
     if ($cached_blogs) {
         if (isset($cached_blogs[$this->blogID()])) {
             $this->Blog = $cached_blogs[$this->blogID()];
             return true;
         }
     }
     return false;
 }
示例#2
0
<?php

if (!PERCH_RUNWAY) {
    exit;
}
$Blogs = new PerchBlog_Blogs($API);
$HTML = $API->get('HTML');
if (!$CurrentUser->has_priv('perch_blog.blogs.manage')) {
    PerchUtil::redirect($API->app_path());
}
$blogs = $Blogs->all();