예제 #1
0
파일: Router.php 프로젝트: c15k0/psfs
 /**
  * Method that gather all the routes in the project
  */
 private function generateRouting()
 {
     $base = SOURCE_DIR;
     $modules = realpath(CORE_DIR);
     $this->routing = $this->inspectDir($base, "PSFS", array());
     if (file_exists($modules)) {
         $module = "";
         if (file_exists($modules . DIRECTORY_SEPARATOR . 'module.json')) {
             $mod_cfg = json_decode(file_get_contents($modules . DIRECTORY_SEPARATOR . 'module.json'), true);
             $module = $mod_cfg['module'];
         }
         $this->routing = $this->inspectDir($modules, $module, $this->routing);
     }
     $this->cache->storeData(CONFIG_DIR . DIRECTORY_SEPARATOR . "domains.json", $this->domains, Cache::JSON, TRUE);
 }
예제 #2
0
파일: Template.php 프로젝트: c15k0/psfs
 /**
  * Servicio que devuelve el output
  * @param string $output
  * @param string $contentType
  * @param array $cookies
  * @return string HTML
  */
 public function output($output = '', $contentType = 'text/html', array $cookies = array())
 {
     Logger::log('Start output response');
     ob_start();
     $this->setReponseHeaders($contentType, $cookies);
     header('Content-length: ' . strlen($output));
     $cache = Cache::needCache();
     if (false !== $cache && $this->status_code === Template::STATUS_OK && $this->debug === false) {
         Logger::log('Saving output response into cache');
         $cacheName = $this->cache->getRequestCacheHash();
         $this->cache->storeData("json" . DIRECTORY_SEPARATOR . $cacheName, $output);
         $this->cache->storeData("json" . DIRECTORY_SEPARATOR . $cacheName . ".headers", headers_list(), Cache::JSON);
     }
     echo $output;
     ob_flush();
     ob_end_clean();
     Logger::log('End output response');
     $this->closeRender();
 }