Example #1
0
 public function __CONSTRUCT($Path)
 {
     parent::$SHORT_INDEX = 0;
     parent::$SINGLE_COMPRESS = 0;
     $MC = memcache_init();
     $Key = sha1($Path);
     $C = memcache_get($MC, $Key);
     $C = false;
     if ($C) {
         $last_modify = parent::get_last_modify($C[1]);
         if ($last_modify <= $C[0]) {
             parent::$RES = $C[2];
             parent::Header();
             parent::output();
             return;
         }
     }
     parent::init($Path);
     memcache_set($MC, $Key, array(parent::$LAST_MODIFY, parent::$FILE_LIST, parent::$RES));
     parent::output();
 }
Example #2
0
$file_name = array_pop($path);
if (FALSE !== strstr($file_name, '.min.js')) {
    $path[] = str_replace('.min.js', '.js', $file_name);
    $use_compress = TRUE;
} else {
    $path[] = $file_name;
    $use_compress = FALSE;
}
$path = ABSPATH . DS . join($path, DS);
if (strtotime(preg_replace('/;.*$/', '', $_SERVER['HTTP_IF_MODIFIED_SINCE'])) >= filemtime($path)) {
    \headMaster\Comm_Response::status(304);
    exit;
}
switch ($type) {
    case 'package':
        $hand = \headMaster\combine\Ptah::comply($path);
        break;
    case 'amd':
        $hand = \headMaster\combine\Seth::comply($path);
        break;
    default:
        break;
}
if (!empty($hand)) {
    $content = $hand->RES;
    if ($use_compress) {
        $content = \headMaster\compress\JSMin::minify($content);
    }
    header('Content-Length: ' . strlen($content));
    //header('Expires: ' . gmdate('D, d M Y H:i:s \G\M\T', time() + 604800));
    header('Last-Modified: ' . date('D, d M Y H:i:s \\G\\M\\T', $hand->LAST));