예제 #1
0
 function cached($path)
 {
     if (Configure::read('Cache.enable') && Configure::read('Cache.view')) {
         $path = Inflector::slug($path);
         $filename = CACHE . 'views' . DS . $path . '.php';
         if (!file_exists($filename)) {
             $filename = CACHE . 'views' . DS . $path . '_index.php';
         }
         if (file_exists($filename)) {
             if (!class_exists('MyView')) {
                 App::import('Core', 'View', $this->app);
             }
             $view = new MyView($this, false);
             $view->ajaxRequest = $this->ajaxRequest;
             $view->viewSuffix = $this->viewSuffix;
             $view->name = $this->name;
             //                $view->helpers = $this->helpers;
             //                $view->layout = $this->layout;
             return $view->renderCache($filename, S2getMicrotime());
         }
     }
     return false;
 }
예제 #2
0
 /**
  * Outputs cached dispatch view cache
  *
  * @param string $url Requested URL
  * @access public
  */
 function cached($url)
 {
     App::import('Component', 'config', $this->app);
     $controller = new stdClass();
     if (class_exists('ConfigComponent')) {
         $Config = new ConfigComponent();
         $Config->startup($controller);
     }
     $User = cmsFramework::getUser();
     if ($User->id === 0 && !Configure::read('Cache.disable') && Configure::read('Cache.view') && !defined('MVC_FRAMEWORK_ADMIN')) {
         $path = $this->here;
         if ($this->here == '/') {
             $path = 'home';
         }
         $path = Inflector::slug($path);
         $filename = CACHE . 'views' . DS . $path . '.php';
         if (!file_exists($filename)) {
             $filename = CACHE . 'views' . DS . $path . '_index.php';
         }
         if (file_exists($filename)) {
             if (!class_exists('MyView')) {
                 App::import('Core', 'View', $this->app);
             }
             $controller = null;
             $view = new MyView($controller, false);
             // Pass the configuration object to the view and set the theme variable for helpers
             $view->name = $this->controller;
             $view->action = $this->action;
             $view->page = Sanitize::getInt($this->params, 'page');
             $view->limit = Sanitize::getInt($this->params, 'limit');
             $view->Config = $Config;
             $view->viewTheme = $Config->template;
             $view->xajaxRequest = false;
             $view->ajaxRequest = $this->isAjax();
             $out = $view->renderCache($filename, S2getMicrotime());
             return $out;
         }
     }
     return false;
 }