fixed cache, files, HEADER & html seo/analytics
This commit is contained in:
parent
97d494dc07
commit
44c20d3cf0
1
cache/cache.php
vendored
1
cache/cache.php
vendored
@ -35,6 +35,7 @@ class cache {
|
|||||||
call_user_func('\SYSTEM\HEADER::'.$result['type']);
|
call_user_func('\SYSTEM\HEADER::'.$result['type']);
|
||||||
}else{
|
}else{
|
||||||
\SYSTEM\HEADER::FILE($ident);}
|
\SYSTEM\HEADER::FILE($ident);}
|
||||||
|
header("Last-Modified: " . gmdate('D, d M Y H:i:s \G\M\T', filemtime($result['data'])));
|
||||||
}
|
}
|
||||||
return \file_get_contents($result['data']);
|
return \file_get_contents($result['data']);
|
||||||
}
|
}
|
||||||
|
|||||||
2
cache/cache_css.php
vendored
2
cache/cache_css.php
vendored
@ -82,6 +82,6 @@ class cache_css {
|
|||||||
foreach($files as $f){
|
foreach($files as $f){
|
||||||
$minifier->add($f->SERVERPATH());}
|
$minifier->add($f->SERVERPATH());}
|
||||||
\SYSTEM\CACHE\cache_css::put($ident, $minifier->minify());}
|
\SYSTEM\CACHE\cache_css::put($ident, $minifier->minify());}
|
||||||
return './api.php?call=cache&id='.self::CACHE_CSS.'&ident='.$ident;
|
return './cache/'.self::CACHE_CSS.'/'.$ident;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
2
cache/cache_js.php
vendored
2
cache/cache_js.php
vendored
@ -82,6 +82,6 @@ class cache_js {
|
|||||||
foreach($files as $f){
|
foreach($files as $f){
|
||||||
$minifier->add($f->SERVERPATH());}
|
$minifier->add($f->SERVERPATH());}
|
||||||
\SYSTEM\CACHE\cache_js::put($ident, $minifier->minify());}
|
\SYSTEM\CACHE\cache_js::put($ident, $minifier->minify());}
|
||||||
return './api.php?call=cache&id='.self::CACHE_JS.'&ident='.$ident;
|
return './cache/'.self::CACHE_JS.'/'.$ident;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -52,11 +52,11 @@ class files {
|
|||||||
|
|
||||||
$ext = pathinfo(self::$folders[$cat].$id);
|
$ext = pathinfo(self::$folders[$cat].$id);
|
||||||
$ext = strtoupper(array_key_exists('extension', $ext) ? $ext['extension'] : '');
|
$ext = strtoupper(array_key_exists('extension', $ext) ? $ext['extension'] : '');
|
||||||
header("Last-Modified: " . gmdate('D, d M Y H:i:s \G\M\T', filemtime(self::$folders[$cat].$id)));
|
|
||||||
if(\SYSTEM\HEADER::available($ext)){
|
if(\SYSTEM\HEADER::available($ext)){
|
||||||
call_user_func('\SYSTEM\HEADER::'.$ext);
|
call_user_func('\SYSTEM\HEADER::'.$ext);
|
||||||
}else{
|
}else{
|
||||||
\SYSTEM\HEADER::FILE($id);}
|
\SYSTEM\HEADER::FILE($id);}
|
||||||
|
header("Last-Modified: " . gmdate('D, d M Y H:i:s \G\M\T', filemtime(self::$folders[$cat].$id)));
|
||||||
|
|
||||||
//Allow Caching for all files
|
//Allow Caching for all files
|
||||||
header('Cache-Control: public;');
|
header('Cache-Control: public;');
|
||||||
|
|||||||
@ -36,8 +36,8 @@ class html{
|
|||||||
* @param string $script script contents
|
* @param string $script script contents
|
||||||
* @return string Returns script tag string.
|
* @return string Returns script tag string.
|
||||||
*/
|
*/
|
||||||
public static function script($src,$type = 'text/javascript',$rel = 'stylesheet', $language = 'JavaScript', $script = ''){
|
public static function script($src,$type = 'text/javascript',$rel = 'stylesheet', $script = ''){
|
||||||
return '<script src="'.$src.'" language="'.$language.'" type="'.$type.'">'.$script.'</script>';}
|
return '<script src="'.$src.'" type="'.$type.'">'.$script.'</script>';}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Generate <style> tag
|
* Generate <style> tag
|
||||||
|
|||||||
@ -57,7 +57,7 @@ class HEADER {
|
|||||||
public static function PNG(){
|
public static function PNG(){
|
||||||
if(self::checkHeader()){
|
if(self::checkHeader()){
|
||||||
header('Expires: '.gmdate('D, d M Y H:i:s \G\M\T', time() + (60 * 60 * 24 * 7))); // 1 week
|
header('Expires: '.gmdate('D, d M Y H:i:s \G\M\T', time() + (60 * 60 * 24 * 7))); // 1 week
|
||||||
header('content-type:image/png;');}}
|
header('content-type:image/png');}}
|
||||||
/**
|
/**
|
||||||
* Send JPG Headers, if Header was not sent yet
|
* Send JPG Headers, if Header was not sent yet
|
||||||
*
|
*
|
||||||
@ -66,7 +66,7 @@ class HEADER {
|
|||||||
public static function JPG(){
|
public static function JPG(){
|
||||||
if(self::checkHeader()){
|
if(self::checkHeader()){
|
||||||
header('Expires: '.gmdate('D, d M Y H:i:s \G\M\T', time() + (60 * 60 * 24 * 7))); // 1 week
|
header('Expires: '.gmdate('D, d M Y H:i:s \G\M\T', time() + (60 * 60 * 24 * 7))); // 1 week
|
||||||
header('content-type:image/jpeg;');}}
|
header('content-type:image/jpg');}}
|
||||||
/**
|
/**
|
||||||
* Send JPEG Headers, if Header was not sent yet
|
* Send JPEG Headers, if Header was not sent yet
|
||||||
*
|
*
|
||||||
@ -75,7 +75,7 @@ class HEADER {
|
|||||||
public static function JPEG(){
|
public static function JPEG(){
|
||||||
if(self::checkHeader()){
|
if(self::checkHeader()){
|
||||||
header('Expires: '.gmdate('D, d M Y H:i:s \G\M\T', time() + (60 * 60 * 24 * 7))); // 1 week
|
header('Expires: '.gmdate('D, d M Y H:i:s \G\M\T', time() + (60 * 60 * 24 * 7))); // 1 week
|
||||||
header('content-type:image/jpeg;');}}
|
header('content-type:image/jpeg');}}
|
||||||
/**
|
/**
|
||||||
* Send GIF Headers, if Header was not sent yet
|
* Send GIF Headers, if Header was not sent yet
|
||||||
*
|
*
|
||||||
@ -84,7 +84,7 @@ class HEADER {
|
|||||||
public static function GIF(){
|
public static function GIF(){
|
||||||
if(self::checkHeader()){
|
if(self::checkHeader()){
|
||||||
header('Expires: '.gmdate('D, d M Y H:i:s \G\M\T', time() + (60 * 60 * 24 * 7))); // 1 week
|
header('Expires: '.gmdate('D, d M Y H:i:s \G\M\T', time() + (60 * 60 * 24 * 7))); // 1 week
|
||||||
header('content-type:image/gif;');}}
|
header('content-type:image/gif');}}
|
||||||
/**
|
/**
|
||||||
* Send JS Headers, if Header was not sent yet
|
* Send JS Headers, if Header was not sent yet
|
||||||
*
|
*
|
||||||
@ -93,7 +93,7 @@ class HEADER {
|
|||||||
public static function JS(){
|
public static function JS(){
|
||||||
if(self::checkHeader()){
|
if(self::checkHeader()){
|
||||||
header('Expires: '.gmdate('D, d M Y H:i:s \G\M\T', time() + (60 * 60 * 24 * 7))); // 1 week
|
header('Expires: '.gmdate('D, d M Y H:i:s \G\M\T', time() + (60 * 60 * 24 * 7))); // 1 week
|
||||||
header('content-type:application/javascript;');}}
|
header('content-type:application/javascript');}}
|
||||||
/**
|
/**
|
||||||
* Send CSS Headers, if Header was not sent yet
|
* Send CSS Headers, if Header was not sent yet
|
||||||
*
|
*
|
||||||
@ -102,7 +102,7 @@ class HEADER {
|
|||||||
public static function CSS(){
|
public static function CSS(){
|
||||||
if(self::checkHeader()){
|
if(self::checkHeader()){
|
||||||
header('Expires: '.gmdate('D, d M Y H:i:s \G\M\T', time() + (60 * 60 * 24 * 7))); // 1 week
|
header('Expires: '.gmdate('D, d M Y H:i:s \G\M\T', time() + (60 * 60 * 24 * 7))); // 1 week
|
||||||
header('content-type:text/css;');}}
|
header('content-type:text/css');}}
|
||||||
/**
|
/**
|
||||||
* Send LESS Headers, if Header was not sent yet
|
* Send LESS Headers, if Header was not sent yet
|
||||||
*
|
*
|
||||||
@ -110,7 +110,8 @@ class HEADER {
|
|||||||
*/
|
*/
|
||||||
public static function LESS(){
|
public static function LESS(){
|
||||||
if(self::checkHeader()){
|
if(self::checkHeader()){
|
||||||
header('content-type:text/css;');}}
|
header('Expires: '.gmdate('D, d M Y H:i:s \G\M\T', time() + (60 * 60 * 24 * 7))); // 1 week
|
||||||
|
header('content-type:text/css');}}
|
||||||
/**
|
/**
|
||||||
* Send FILE(download) Headers, if Header was not sent yet
|
* Send FILE(download) Headers, if Header was not sent yet
|
||||||
*
|
*
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user