Beispiel #1
0
Datei: V.php Projekt: hfw/h
 /**
  * Sends headers and content. This method expects an **exit** upon returning.
  */
 public function __invoke()
 {
     if ($cache = $this->getCache()) {
         $cache->__invoke($this);
         // exits
     }
     O::headers();
     $this->render();
 }
Beispiel #2
0
Datei: C.php Projekt: hfw/h
 /**
  * Sends headers and content. This method expects an **exit** upon returning.
  * @param object $subject Given to {@link $content}
  */
 public function __invoke($subject)
 {
     // O::file() isn't used because there is a race between it and the Expires header.
     static::lock(LOCK_SH);
     $this->prepare($subject);
     $file = fopen($this->path, 'rb');
     flock($file, LOCK_SH);
     clearstatcache(true, $this->path);
     O::mtime(filemtime($this->path));
     O::$headers['Content-Length'] = filesize($this->path);
     O::$headers['Cache-Control'] = $this->control . ', max-age=' . $this->ttl;
     O::$headers['Expires'] = gmdate('D, d M Y H:i:s T', filemtime($this->path) + $this->ttl);
     O::headers();
     fpassthru($file);
 }