コード例 #1
0
 protected function sendHeaders($file)
 {
     if (!is_array($file)) {
         $file = array($file);
     }
     $headers = \Radical\Web\Page\Handler::current()->headers;
     $headers->Add('Content-Type', static::MIME_TYPE);
     $headers->Add('Cache-Control', 'public');
     $headers->setCache(60 * 60 * 24);
     $headers->Add('Pragma', 'cache');
     //$headers['Vary'] = 'Accept-Encoding';
     $times = array_map('filemtime', $file);
     if (!$times) {
         return;
     }
     $filemtime = max($times);
     //die(var_dump($file));
     $headers->setLastModified($filemtime);
 }
コード例 #2
0
 function exception(ErrorException $error)
 {
     if (ob_get_level()) {
         ob_end_clean();
     }
     try {
         \Radical\Web\Page\Handler::init();
         \Radical\Web\Page\Handler::$stack->push(new PageRequest(null));
         //@todo Remove ugly hack
         $page = new Error($error);
         while ($page) {
             $page = $page->GET();
         }
         \Radical\Web\Page\Handler::current(true)->headers->output();
     } catch (\Exception $ex) {
         die('Error: ' . $ex->getMessage());
     }
     exit;
 }