Ejemplo n.º 1
0
     $looped .= rmBOM(file_get_contents($dir . $current)) . "\n";
 }
 // Filter the CSS
 if ($type == 'stylesheets') {
     // Apply the CSS logos
     $looped = setLogos($looped, $array);
     // Apply the CSS background
     $looped = setBackground($looped);
     // Set the Get API paths
     $looped = setPath($looped, $hash, HOST_STATIC, $type, '');
 }
 // Optimize the code rendering
 if ($type == 'stylesheets') {
     // Can minify the CSS
     if ($has_compression && !$is_developer) {
         $output = compressCSS($looped);
     } else {
         $output = $looped;
     }
 } else {
     // Can minify the JS (sloooooow!)
     if ($has_compression && !$is_developer) {
         require_once './jsmin.php';
         $output = JSMin::minify($looped);
     } else {
         $output = $looped;
     }
 }
 // Generate the reference cache
 if ($has_compression) {
     $final = gzdeflate($output, 9);
Ejemplo n.º 2
0
     } else {
         ob_start();
     }
     $last_modified_time = filemtime($filename);
     $etag = md5_file($filename);
     header("Last-Modified: " . gmdate("D, d M Y H:i:s", $last_modified_time) . " GMT");
     header("Expires: " . gmdate("D, d M Y H:i:s", time() + 24 * 60 * 60 * 60) . " GMT");
     header("Etag: {$etag}");
     if (array_key_exists('HTTP_IF_MODIFIED_SINCE', $_SERVER) && @strtotime($_SERVER['HTTP_IF_MODIFIED_SINCE']) == $last_modified_time || array_key_exists('HTTP_IF_NONE_MATCH', $_SERVER) && trim($_SERVER['HTTP_IF_NONE_MATCH']) == $etag) {
         header("HTTP/1.1 304 Not Modified");
         exit;
     }
     $contents = file_get_contents($filename);
     if (substr($filename, -4) == ".css") {
         header("Content-Type: text/css; charset=utf-8");
         $contents = compressCSS($contents);
     } else {
         if (substr($filename, -3) == ".js" && strpos($filename, "mootools") === false) {
             header("Content-Type: application/x-javascript; charset=utf-8");
             $contents = compressJS($contents);
         } else {
             if (substr($filename, -3) == ".js") {
                 header("Content-Type: application/x-javascript; charset=utf-8");
             }
         }
     }
     echo $contents;
     ob_end_flush();
 } else {
     echo "File doesn't exist!";
 }