protected function _execute(array $params) { \Zver\FileCache::clearAll(); $this->createStructure(); $this->clearPreviewsAndUploads(); $this->insertData(); \Zver\FileCache::clearAll(); }
<?php \Zver\FileCache::clearAll(); header('Last-Modified: ' . gmdate('D, d M Y H:i:s', time()) . ' GMT'); header('Expires: ' . gmdate('D, d M Y H:i:s', time()) . ' GMT'); header("Cache-Control: no-cache, must-revalidate"); header("Pragma: no-cache"); ?> <!doctype html> <html lang="en"> <head> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1"> <?php if (!empty($title)) { ?> <title><?php echo $title; ?> </title> <?php } ?> <link rel="icon" type="image/x-icon" href="/favicon.ico"/> <link rel="shortcut icon" type="image/x-icon" href="/favicon.ico"/> <?php $styles = ['/' . Admin::getConfig('sharedDir') . '/css/style.css'];
<?php defined('SYSPATH') or die('No direct script access.'); require "functions.php"; require SYSPATH . 'classes/Kohana/Core' . EXT; if (is_file(APPPATH . 'classes/Kohana' . EXT)) { require APPPATH . 'classes/Kohana' . EXT; } else { require SYSPATH . 'classes/Kohana' . EXT; } date_default_timezone_set('Europe/Moscow'); setlocale(LC_ALL, 'en_US.utf-8'); spl_autoload_register(['Kohana', 'auto_load']); ini_set('unserialize_callback_func', 'spl_autoload_call'); mb_substitute_character('none'); I18n::lang('en-us'); if (isset($_SERVER['SERVER_PROTOCOL'])) { HTTP::$protocol = $_SERVER['SERVER_PROTOCOL']; } Kohana::$environment = Kohana::PRODUCTION; Kohana::init(['base_url' => '/', 'index_file' => false, 'errors' => true]); $composerAutoload = COMPOSERPATH . 'vendor/autoload.php'; require_once "{$composerAutoload}"; \Zver\FileCache::setDirectory(APPPATH . 'cache' . DIRECTORY_SEPARATOR); Kohana::$log->attach(new Log_File(APPPATH . 'logs')); Kohana::$config->attach(new Config_File()); Kohana::modules(['auth' => MODPATH . 'auth', 'database' => MODPATH . 'database', 'image' => MODPATH . 'image', 'orm' => MODPATH . 'orm', 'admin' => MODPATH . 'admin', 'yandexmap' => MODPATH . 'yandexmap', 'minion' => MODPATH . 'minion', 'captcha' => MODPATH . 'captcha', 'pagination' => MODPATH . 'pagination']); include_once 'routes.php';
public static function getMainItemsTransliterated($activeId = null) { $key = md5($activeId . __METHOD__ . 'mainItems'); $generate = function () use($activeId) { $items = self::getMainItems(); foreach ($items as $key => &$item) { $item = ['active' => !is_null($activeId) && $activeId == $key ? true : false, 'id' => $key, 'name' => $item, 'text' => $item, 'href' => ORM::factory('MainItem', $key)->getHREF(), 'translit' => \Zver\StringHelper::load($item)->slugify()->get()]; } return $items; }; return \Zver\FileCache::retrieve($key, $generate); }
*/ $years = \Zver\FileCache::retrieve('newsYears', function () { return array_values(DB::select([DB::expr('YEAR(_datetime)'), 'year'])->from('news')->distinct(true)->where('visible', '=', 1)->order_by(DB::expr('YEAR(_datetime)'), 'desc')->execute()->as_array('year', 'year')); }); if (!empty($years)) { /** * By default get last year */ if (empty($currentYear) || !in_array($currentYear, $years) || !is_numeric($currentYear)) { $currentYear = $years[0]; } /** * Available months in defined year */ $months = \Zver\FileCache::retrieve('newsMonths' . $currentYear, function () use($currentYear) { return array_values(DB::select([DB::expr('MONTH(_datetime)'), 'month'])->from('news')->distinct(true)->where('visible', '=', 1)->where(DB::expr('YEAR(_datetime)'), '=', $currentYear)->order_by(DB::expr('MONTH(_datetime)'), 'desc')->execute()->as_array('month', 'month')); }); /** * Last month by default */ if (empty($currentMonth) || !in_array($currentMonth, $months) || !is_numeric($currentMonth)) { $currentMonth = $months[0]; } ?> <div class="container"> <?php if (count($years) > 1) { ?> <ul class="nav nav-pills">