private function _load_section() { $Cache = PerchBlog_Cache::fetch(); $cached_sections = $Cache->get('sections'); if (!$cached_sections) { $Sections = new PerchBlog_Sections(); $sections = $Sections->all(); if (PerchUtil::count($sections)) { $cached_sections = array(); foreach ($sections as $Section) { $cached_sections[$Section->id()] = $Section; } $Cache->set('sections', $cached_sections); } } if ($cached_sections) { if (isset($cached_sections[$this->sectionID()])) { $this->Section = $cached_sections[$this->sectionID()]; return true; } } return false; }
<?php $HTML = $API->get('HTML'); // Try to update $Settings = $API->get('Settings'); if ($Settings->get('perch_blog_update')->val() != '5.0') { PerchUtil::redirect($API->app_path() . '/update/'); } $Blog = new PerchBlog_Posts($API); $Paging = $API->get('Paging'); $Paging->set_per_page(15); $Categories = new PerchCategories_Categories(); $categories = $Categories->get_for_set('blog'); $Sections = new PerchBlog_Sections($API); $sections = $Sections->all(); $Lang = $API->get('Lang'); $posts = array(); $filter = 'all'; if (isset($_GET['category']) && $_GET['category'] != '') { $filter = 'category'; $category = $_GET['category']; } if (isset($_GET['section']) && $_GET['section'] != '') { $filter = 'section'; $section = $_GET['section']; } if (isset($_GET['status']) && $_GET['status'] != '') { $filter = 'status'; $status = $_GET['status']; } switch ($filter) {