exit;
}
+
+ $supportsGzip = !empty($_SERVER['HTTP_ACCEPT_ENCODING']) && strpos( $_SERVER['HTTP_ACCEPT_ENCODING'], 'gzip' ) !== false;
+
+
$last_modified_time = filemtime($fn);
header("Pragma: public");
- header('Content-Length: '. filesize($fn));
+
header('Cache-Control: max-age=2592000, public');
header('Expires: '.gmdate('D, d M Y H:i:s \G\M\T', time() + 2592000));
header('Last-Modified: '.gmdate('D, d M Y H:i:s \G\M\T', $last_modified_time));
header('Etag: '. md5($fn));
- $fh = fopen($fn,'r');
- fpassthru($fh);
- fclose($fh);
+ if ( $supportsGzip ) {
+ $content = gzencode( file_get_contents($fn) , 9);
+
+ header('Content-Encoding: gzip');
+ header('Vary: Accept-Encoding');
+ header('Content-Length: '. strlen($content));
+
+ echo $content;
+
+ } else {
+
+
+ $fh = fopen($fn,'r');
+ fpassthru($fh);
+ fclose($fh);
+ $content = $data;
+ }
+
+
+
exit;
}
die('invalid');
}
-
+ static function getCompileDir($type)
+ {
+ $ui = posix_getpwuid(posix_geteuid());
+
+ $ff = HTML_FlexyFramework::get();
+
+ $compile_dir = session_save_path() . "/";
+
+ switch($type) {
+ case 'js':
+ case 'css':
+ $compile_dir .= implode("-", array(
+ $ui['name'],
+ $ff->project,
+ $ff->version,
+ "{$type}compile"
+ ));
+ break;
+ default:
+ return false;
+ }
+
+ return $compile_dir;
+
+ if (file_exists($compile_dir)) {
+ return $compile_dir;
+ }
+
+ if(mkdir($compile_dir, 0700, true)) {
+ return $compile_dir;
+ }
+
+ return false;
+ }
}