Exemplo n.º 1
0
 public function __call($name, $arguments)
 {
     $file = '';
     foreach ($arguments as $key => $argument) {
         if (empty($argument)) {
             unset($arguments[$key]);
             continue;
         }
         if (!is_array($argument)) {
             continue;
         }
         if (isset($argument['folder'])) {
             $file .= $argument['folder'];
             unset($arguments[$key]);
         }
     }
     if (!empty($arguments)) {
         $filename = array(implode('.', $arguments), $name, self::FILE_EXTENSION);
     } else {
         $filename = array($name, self::FILE_EXTENSION);
     }
     $file .= '/' . implode('.', $filename);
     if (file_exists(CONTRIB_PATH . self::FOLDER . $file)) {
         header('Cache-Control: no-store, no-cache, must-revalidate, max-age=0');
         header('Etag: ' . md5(file_get_contents(CONTRIB_PATH . self::FOLDER . $file)));
         header('Vary: *');
         header('Last-Modified: ' . gmdate('D, d M Y H:i:s', filemtime(CONTRIB_PATH . self::FOLDER . $file)) . ' GMT');
         header('Content-type: ' . Utilities::getMimeType(self::FILE_EXTENSION));
         echo file_get_contents(CONTRIB_PATH . self::FOLDER . $file);
         exit;
     } else {
         $this->bye();
     }
 }
Exemplo n.º 2
0
 public function run()
 {
     foreach ($this->_routes as $rule => $conf) {
         if (preg_match($conf[0], Utilities::getMimeType($this->_fileExt), $matches)) {
             require_once CONTRIB_PATH . '/controller/' . $conf[1] . '.php';
             $class = new $conf[1]();
             $method = $this->_fileMode;
             $class->{$method}($this->_fileName, array('folder' => $this->_folderPath));
         }
     }
 }
Exemplo n.º 3
0
 protected function outputContent($content, $lastmodified)
 {
     header('Cache-Control: no-store, no-cache, must-revalidate, max-age=0');
     header('Etag: ' . md5($content));
     header('Vary: *');
     header('Last-Modified: ' . gmdate('D, d M Y H:i:s', $lastmodified) . ' GMT');
     header('Content-type: ' . Utilities::getMimeType($this->getCompressorType()));
     echo $content;
     exit;
 }