Exemplo n.º 1
0
 if (is_array($bigtree["config"]["css"]["files"][$css_file])) {
     // if we need LESS
     if (strpos(implode(" ", $bigtree["config"]["css"]["files"][$css_file]), "less") > -1) {
         $less_compiler = new lessc();
         $less_compiler->setImportDir(array(SITE_ROOT . "css/"));
     }
     foreach ($bigtree["config"]["css"]["files"][$css_file] as $style_file) {
         $style = file_get_contents(SITE_ROOT . "css/{$style_file}");
         if (strpos($style_file, "less") > -1) {
             // convert LESS
             $style = $less_compiler->compile($style);
         } else {
             // normal CSS
             if ($bigtree["config"]["css"]["prefix"]) {
                 // Replace CSS3 easymode
                 $style = BigTree::formatCSS3($style);
             }
         }
         $data .= $style . "\n";
     }
 }
 // Should only loop once, not with every file
 if (is_array($bigtree["config"]["css"]["vars"])) {
     foreach ($bigtree["config"]["css"]["vars"] as $key => $val) {
         $data = str_replace('$' . $key, $val, $data);
     }
 }
 // Replace roots
 $data = str_replace(array('$www_root', 'www_root/', '$static_root', 'static_root/', '$admin_root/', 'admin_root/'), array(WWW_ROOT, WWW_ROOT, STATIC_ROOT, STATIC_ROOT, ADMIN_ROOT, ADMIN_ROOT), $data);
 if ($bigtree["config"]["css"]["minify"]) {
     $minifier = new CSSMin();
Exemplo n.º 2
0
    }
    $ifile = file_exists("../custom/admin/css/" . $ipath . $bigtree["path"][$x]) ? "../custom/admin/css/" . $ipath . $bigtree["path"][$x] : "../core/admin/css/" . $ipath . $bigtree["path"][$x];
    if (function_exists("apache_request_headers")) {
        $headers = apache_request_headers();
        $ims = isset($headers["If-Modified-Since"]) ? $headers["If-Modified-Since"] : "";
    } else {
        $ims = isset($_SERVER["HTTP_IF_MODIFIED_SINCE"]) ? $_SERVER["HTTP_IF_MODIFIED_SINCE"] : "";
    }
    $last_modified = filemtime($ifile);
    if ($ims && strtotime($ims) == $last_modified) {
        header("Last-Modified: " . gmdate("D, d M Y H:i:s", $last_modified) . ' GMT', true, 304);
        die;
    }
    header("Content-type: text/css");
    header("Last-Modified: " . gmdate("D, d M Y H:i:s", $last_modified) . ' GMT', true, 200);
    echo BigTree::formatCSS3(str_replace("admin_root/", $bigtree["config"]["admin_root"], file_get_contents($ifile)));
    die;
}
// JavaScript
if ($bigtree["path"][1] == "js") {
    $pms = ini_get('post_max_size');
    $mul = substr($pms, -1);
    $mul = $mul == 'M' ? 1048576 : ($mul == 'K' ? 1024 : ($mul == 'G' ? 1073741824 : 1));
    $max_file_size = $mul * (int) $pms;
    $x = 2;
    $ipath = "";
    while ($x < count($bigtree["path"]) - 1) {
        $ipath .= $bigtree["path"][$x] . "/";
        $x++;
    }
    $ifile = file_exists("../custom/admin/js/" . $ipath . $bigtree["path"][$x]) ? "../custom/admin/js/" . $ipath . $bigtree["path"][$x] : "../core/admin/js/" . $ipath . $bigtree["path"][$x];
Exemplo n.º 3
0
        $css_file = file_exists("../custom/admin/css/{$css_path}") ? "../custom/admin/css/{$css_path}" : "../core/admin/css/{$css_path}";
    }
    if (function_exists("apache_request_headers")) {
        $headers = apache_request_headers();
        $ims = isset($headers["If-Modified-Since"]) ? $headers["If-Modified-Since"] : "";
    } else {
        $ims = isset($_SERVER["HTTP_IF_MODIFIED_SINCE"]) ? $_SERVER["HTTP_IF_MODIFIED_SINCE"] : "";
    }
    $last_modified = filemtime($css_file);
    if ($ims && strtotime($ims) == $last_modified) {
        header("Last-Modified: " . gmdate("D, d M Y H:i:s", $last_modified) . ' GMT', true, 304);
        die;
    }
    header("Content-type: text/css");
    header("Last-Modified: " . gmdate("D, d M Y H:i:s", $last_modified) . ' GMT', true, 200);
    die(BigTree::formatCSS3(file_get_contents($css_file)));
}
// JavaScript
if ($bigtree["path"][1] == "js") {
    // Calcuate the maximum post size so we can pass it along to scripts
    $pms = ini_get('post_max_size');
    $mul = substr($pms, -1);
    $mul = $mul == 'M' ? 1048576 : ($mul == 'K' ? 1024 : ($mul == 'G' ? 1073741824 : 1));
    $max_file_size = $mul * (int) $pms;
    $js_path = implode("/", array_slice($bigtree["path"], 2));
    if (defined("EXTENSION_ROOT")) {
        $js_file = EXTENSION_ROOT . "js/{$js_path}";
    } else {
        $js_file = file_exists("../custom/admin/js/{$js_path}") ? "../custom/admin/js/{$js_path}" : "../core/admin/js/{$js_path}";
    }
    // If we're serving php, just include it instead of trying to parse it as JS