/** * Serves a file * @param string $file * @return string */ public function serveFile($file) { $type = MimeType::getType($file); if (!headers_sent()) { header('Content-Type: ' . $type); } if (strpos($type, 'text/html') !== false) { $tmpl = new Templator(); $tmpl->setContent($tmpl->getInclude($file)); return $this->serveCache($tmpl->getDisplay()); } else { self::setCacheMtime(filemtime($file)); return $this->serveCache(file_get_contents($file)); } }