Пример #1
0
 /**
  * Gets and load the page related action file 
  */
 function get_action()
 {
     $action_name = strtolower(end($this->folders));
     //Make sure this action exists
     $core_action = CORE_DIR . "view/" . $this->page_dir . '/action.php';
     if (file_exists($core_action)) {
         include $core_action;
         $action = $action_name . "_Action";
     } else {
         if (!($action = Core_Framework_View::get_cms_page($this))) {
             Core_Framework_Helper::error404();
         } else {
             $this->page_dir = '../layouts_cms/' . $action->page_dir;
         }
     }
     //See if there is a custom action file
     $account_action = ACCOUNT_DIR . "view/" . $this->page_dir . '/action.php';
     if (file_exists($account_action)) {
         include $account_action;
         $action = $action_name . "_Action";
     }
     if (is_string($action)) {
         $action = new $action();
     }
     $action->pre();
     $action->init();
     $action->post();
 }
Пример #2
0
 public static function cached($file, $vars = false)
 {
     $page = md5($_SERVER['REQUEST_URI']);
     $dir = ACCOUNT_DIR . 'cache/' . $page;
     $cachefile = $dir . '/' . md5($file) . '.html';
     //Cache the file if it dosen't exist
     if (!file_exists($cachefile) || Core_Framework_Singleton::config()->ini['web_shop']['disablecache'] == 'yes') {
         //Make sure the folder exists
         if (!is_dir($dir)) {
             mkdir($dir, 0755);
         }
         //HTML Cache
         ob_start();
         Core_Framework_View::getPartial($file, $vars);
         $output = ob_get_contents();
         ob_end_clean();
         $handle = fopen($cachefile, 'w');
         fwrite($handle, $output);
         fclose($handle);
     }
     include $cachefile;
 }