new chache functionality, minify css/js
This commit is contained in:
parent
5e9bb34d0e
commit
432b63edc3
26
cache/cache_filemask.php
vendored
Normal file
26
cache/cache_filemask.php
vendored
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
<?php
|
||||||
|
namespace SYSTEM\CACHE;
|
||||||
|
class cache_css {
|
||||||
|
const CACHE_CSS = 1;
|
||||||
|
public static function put($ident,$data){
|
||||||
|
return \SYSTEM\CACHE\cache::put(self::CACHE_CSS, $ident, 'css',$data);}
|
||||||
|
public static function get($ident,$header = false){
|
||||||
|
return \SYSTEM\CACHE\cache::get(self::CACHE_CSS, $ident,$header);}
|
||||||
|
public static function ident($files){
|
||||||
|
$ident = '';
|
||||||
|
foreach($files as $f){
|
||||||
|
$unique = time() % 60*15;
|
||||||
|
$ident .= $f.';'.$unique.'|';}
|
||||||
|
return sha1($ident);
|
||||||
|
}
|
||||||
|
public static function url($files){
|
||||||
|
$ident = self::ident($files);
|
||||||
|
if(!\SYSTEM\CACHE\cache_css::get($ident)){
|
||||||
|
\LIB\lib_minify::php();
|
||||||
|
$minifier = new \MatthiasMullie\Minify\CSS();
|
||||||
|
foreach($files as $f){
|
||||||
|
$minifier->add($f);}
|
||||||
|
\SYSTEM\CACHE\cache_css::put($ident, $minifier->minify());}
|
||||||
|
return './api.php?call=cache&id='.self::CACHE_CSS.'&ident='.$ident;
|
||||||
|
}
|
||||||
|
}
|
||||||
3
path/autoload.inc
Normal file
3
path/autoload.inc
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
<?php
|
||||||
|
\SYSTEM\autoload::registerFolder(dirname(__FILE__),'SYSTEM');
|
||||||
|
\SYSTEM\autoload::registerFolder(dirname(__FILE__).'/qq','SYSTEM\SQL');
|
||||||
Loading…
x
Reference in New Issue
Block a user