26 lines
1.0 KiB
PHP
Executable File
26 lines
1.0 KiB
PHP
Executable File
<?php
|
|
$css=$_GET['css'];
|
|
$cache=$_GET['cache'];
|
|
function compress($buffer) {
|
|
/* удалить комментарии */
|
|
$buffer = preg_replace('!/\*[^*]*\*+([^/][^*]*\*+)*/!', '', $buffer);
|
|
/* удалить табуляции, пробелы, символы новой строки и т.д. */
|
|
$buffer = str_replace(array("\r\n", "\r", "\n", "\t", ' ', ' ', ' '), '', $buffer);
|
|
return $buffer;
|
|
}
|
|
header('Content-type: text/css');
|
|
if ($cache=='on'){
|
|
header("Cache-Control: public");
|
|
header("Expires: " . date("r", time() + 86400));
|
|
}else{
|
|
header("Cache-Control: no-store, no-cache, must-revalidate");
|
|
header("Expires: " . date("r"));
|
|
}
|
|
ob_start("compress");
|
|
/* css файлы */
|
|
include($_SERVER['DOCUMENT_ROOT'] . '/bootstrap/css/bootstrap.min.css');
|
|
include($_SERVER['DOCUMENT_ROOT'] . '/../all/font-awesome/font-awesome-4.7.0/css/font-awesome.min.css');
|
|
include($_SERVER['DOCUMENT_ROOT'] . '/templates/css/css.css');
|
|
if (isset($css))include($_SERVER['DOCUMENT_ROOT'] . '/templates/css/' . $css . '.css');
|
|
ob_end_flush();
|
|
?>
|