예제 #1
0
파일: compress.php 프로젝트: sfhati/lezaz
function compressCSS($dir, $compress = 0, $sort = 0)
{
    global $lezaz;
    $pattern = "*.css";
    $vars_dir_path = $lezaz->lezaz_path($dir) . '/';
    $vars_dir_link = $lezaz->lezaz_path($dir, 1) . '/';
    $glop = glob($vars_dir_path . $pattern);
    if ($sort) {
        arsort($glop);
    } else {
        asort($glop);
    }
    foreach ($glop as $filename) {
        $fn = basename($filename);
        if (strpos('XXX' . $filename, 'Xall.css.')) {
            continue;
        }
        if ($compress == 1 || $compress == 2) {
            $Xfile .= hash_file('md5', $filename);
        } else {
            $return .= " <link rel=\"stylesheet\" type=\"text/css\" href=\"{$vars_dir_link}{$fn}\"/>\n";
        }
    }
    if (file_exists($vars_dir_path . 'all.css.' . md5($Xfile) . $compress . '.css')) {
        return " <link rel=\"stylesheet\" type=\"text/css\" href=\"" . $vars_dir_link . 'all.css.' . md5($Xfile) . $compress . '.css' . "\"/>\n";
    }
    if ($return) {
        return $return;
    }
    array_map('unlink', glob($vars_dir_path . "all.css.*.css"));
    // delete all mini files created by lezaz
    foreach (glob($vars_dir_path . $pattern) as $filename) {
        $fn = basename($filename);
        if ($compress == '1') {
            $cssall .= "\n\n\n/*{$fn}*/\n========================\n" . file_get_contents($filename);
        } else {
            if ($compress == '2') {
                $cssau = compress_css($filename);
                $cssall .= "\n\n\n/*{$fn}*/\n========================\n" . $cssau;
            }
        }
    }
    $lezaz->file->write($vars_dir_path . 'all.css.' . md5($Xfile) . $compress . '.css', get_import($cssall));
    return "<link rel=\"stylesheet\" type=\"text/css\" href=\"" . $vars_dir_link . 'all.css.' . md5($Xfile) . $compress . '.css' . "\"/> \n";
    //    <link rel=\"stylesheet\" type=\"text/css\" href=\"' . $vars_dir_link . '$it\"/>";'));
    asort($files);
    arsort($files);
}
예제 #2
0
include "include/function.php";
?>
<!doctype html>
<html lang="cn">
<head>
    <meta charset="UTF-8">
    <title><?php 
get_title();
?>
</title>
    <link rel="shortcut icon" href="/images/favicon.ico" type="image/x-icon" />
    <link href="http://js.mplant.pw/lib/bootstrap-3.3.5-dist/css/bootstrap.min.css" rel="stylesheet">
    <link href="http://js.mplant.pw/lib/bootstrap-3.3.5-dist/css/font-awesome.min.css" rel="stylesheet">
    <link href="/awesome/css/font-awesome.css" rel="stylesheet"/>
    <link type="text/css" rel="stylesheet" href="<?php 
get_import();
?>
"/>
    <link type="text/css" rel="stylesheet" href="/style/head.css"/>
    <link type="text/css" rel="stylesheet" href="/style/foot.css"/>
    <script src="http://js.mplant.pw/lib/jquery/jquery.min.js"></script>
    <script src="http://js.mplant.pw/lib/bootstrap-3.3.5-dist/js/bootstrap.min.js"></script>
    <script type="text/x-mathjax-config">
        MathJax.Hub.Config({
        extensions: ["tex2jax.js"],
        jax: ["input/TeX", "output/HTML-CSS"],
        tex2jax: {
            inlineMath: [ ['$','$'], ["\\(","\\)"] ],
            displayMath: [ ['$$','$$'], ["\\[","\\]"] ],
            processEscapes: true
        },