Beispiel #1
0
 public function routeShutdown(Zend_Controller_Request_Abstract $request)
 {
     if ($this->getRequest()->getModuleName() == 'admin') {
         return;
     }
     $uri = $request->getRequestUri();
     if (!($titles = Z_Cache::getInstance()->load('z_titles'))) {
         $table_titles = new Z_Model_Titles();
         $titles = $table_titles->fetchAll(NULL, 'orderid asc');
         Z_Cache::getInstance()->save($titles, 'z_titles');
     }
     foreach ($titles as $title) {
         if (strpos($uri, $title->uri) === 0) {
             if ($title->title_block) {
                 Z_Seo::addTitle($title->title);
             } else {
                 Z_Seo::setTitle($title->title);
             }
             if ($title->description_block) {
                 Z_Seo::addDescription($title->description);
             } else {
                 Z_Seo::setDescription($title->description);
             }
             if ($title->keywords_block) {
                 Z_Seo::addKeywords($title->keywords);
             } else {
                 Z_Seo::setKeywords($title->keywords);
             }
         }
     }
 }
Beispiel #2
0
 public function indexAction()
 {
     $this->disableRenderView();
     $cache = Z_Cache::getInstance();
     $cache->clean('all');
     Z_FlashMessenger::addMessage('Кэш очищен');
 }
Beispiel #3
0
 public function __construct()
 {
     $cache = Z_Cache::getInstance();
     if (!($this->currency = $cache->load('z_currency_data'))) {
         $this->currency = $this->_getCurrencyArray();
         $cache->save($this->currency, 'z_currency_data', '', 86400);
     }
 }
Beispiel #4
0
 protected function __construct()
 {
     $config = Zend_Registry::get('config')->site;
     $oBackend = Z_Cache::getbackend();
     $oFrontend = new Zend_Cache_Frontend_Output(array('caching' => $config->get('cache_on', false), 'lifetime' => $config->get('cache_life_time', 60), 'cache_id_prefix' => trim(str_replace(DIRECTORY_SEPARATOR, '_', SITE_PATH), '_') . '_', 'write_control' => true, 'automatic_serialization' => true, 'ignore_user_abort' => true));
     $oCache = Zend_Cache::factory($oFrontend, $oBackend);
     self::$_instance = $oCache;
 }
Beispiel #5
0
 public function __construct($sid)
 {
     self::$_model = new Z_Model_Statpage();
     $cache = Z_Cache::getInstance();
     if (!($this->_row = $cache->load('z_spatpage_' . md5($sid)))) {
         $this->_row = $this->_getRow($sid);
         $cache->save($this->_row, 'z_spatpage_' . md5($sid));
     }
 }
Beispiel #6
0
 public function routeShutdown(Zend_Controller_Request_Abstract $request)
 {
     if ($request->getModuleName() == 'admin' || APPLICATION_ENV != 'development') {
         return;
     }
     $frontController = Zend_Controller_Front::getInstance();
     $options = array('plugins' => array('Variables', 'Database' => array('adapter' => Z_Db_Table::getDefaultAdapter()), 'File' => array('basePath' => SITE_PATH), 'Memory', 'Time', 'Registry', 'Cache' => array('backend' => Z_Cache::getbackend()), 'Exception'));
     $debug = new ZFDebug_Controller_Plugin_Debug($options);
     $frontController->registerPlugin($debug);
 }
Beispiel #7
0
 /**
  * @return Z_Acl
  */
 public static function getInstance()
 {
     if (null === self::$_instance) {
         $cache = Z_Cache::getInstance();
         if (!($acl = $cache->load('z_acl'))) {
             $acl = new Z_Acl();
             $cache->save($acl, 'z_acl');
         }
         self::$_instance = $acl;
     }
     return self::$_instance;
 }
Beispiel #8
0
 protected function __construct()
 {
     $config = Zend_Registry::get('config')->site;
     if (extension_loaded('memcache')) {
         $oBackend = new Zend_Cache_Backend_Memcached(array('servers' => array(array('host' => '127.0.0.1', 'port' => '11211')), 'compression' => false));
     } else {
         $oBackend = new Zend_Cache_Backend_File(array('cache_dir' => APPLICATION_PATH . DIRECTORY_SEPARATOR . 'data' . DIRECTORY_SEPARATOR . 'cache' . DIRECTORY_SEPARATOR));
     }
     self::$_backend = $oBackend;
     $oFrontend = new Zend_Cache_Core(array('caching' => $config->get('cache_on', false), 'lifetime' => $config->get('cache_life_time', 60), 'cache_id_prefix' => trim(str_replace(array(DIRECTORY_SEPARATOR, '.', '-', ':', '/', '\\'), '_', SITE_PATH), '_') . '_', 'write_control' => true, 'automatic_serialization' => true, 'ignore_user_abort' => true));
     $oCache = Zend_Cache::factory($oFrontend, $oBackend);
     self::$_instance = $oCache;
 }
Beispiel #9
0
 /**
  * @return Zend_Db_Table_Row
  */
 protected function _getRow($sid)
 {
     $cache = Z_Cache::getInstance();
     if (!($this->_data = $cache->load('kap_config'))) {
         $this->_data = $this->_model->fetchPairs(array('sid', 'value'));
         $cache->save($this->_data, 'kap_config');
     }
     if (isset($this->_data[$sid])) {
         return $this->_data[$sid];
     } else {
         return false;
     }
 }