public function __get($name)
 {
     if ($name == 'tpl') {
         if (!$this->_templateInitialized) {
             $this->initTemplate();
         }
         return $this->_template;
     }
     if ($name == 'router') {
         return Router::getInstance();
     }
     if ($name == 'session') {
         return Session::getInstance();
     }
     if ($name == 'config') {
         return Config::getInstance();
     }
     if ($name == 'log') {
         return Logger::getInstance();
     }
     if ($name == 'language') {
         return Language::getInstance();
     }
     if ($name == 'model') {
         return Model::getInstance();
     }
 }
예제 #2
0
 protected function _read($modelType, $slug)
 {
     $cache = $this->_cache->read($modelType . $slug);
     if (!is_null($cache) && !Application::getDebug()) {
         $data = $cache;
     } else {
         $manager = Model::factoryManager($modelType);
         $data = $manager->read($slug, true);
         //try by slug
         if (is_null($data)) {
             $data = $manager->read($slug);
         }
         //try by id
         if (!is_null($data)) {
             $this->_cache->write($modelType . $slug, $data, true);
         }
     }
     return $data;
 }