fixed cache, files, HEADER & html seo/analytics

This commit is contained in:
Ulf Gebhardt 2017-04-01 13:39:58 +02:00
parent 97d494dc07
commit 44c20d3cf0
6 changed files with 14 additions and 12 deletions

1
cache/cache.php vendored
View File

@ -35,6 +35,7 @@ class cache {
call_user_func('\SYSTEM\HEADER::'.$result['type']);
}else{
\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']);
}

2
cache/cache_css.php vendored
View File

@ -82,6 +82,6 @@ class cache_css {
foreach($files as $f){
$minifier->add($f->SERVERPATH());}
\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
View File

@ -82,6 +82,6 @@ class cache_js {
foreach($files as $f){
$minifier->add($f->SERVERPATH());}
\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;
}
}

View File

@ -52,11 +52,11 @@ class files {
$ext = pathinfo(self::$folders[$cat].$id);
$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)){
call_user_func('\SYSTEM\HEADER::'.$ext);
}else{
\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
header('Cache-Control: public;');

View File

@ -36,8 +36,8 @@ class html{
* @param string $script script contents
* @return string Returns script tag string.
*/
public static function script($src,$type = 'text/javascript',$rel = 'stylesheet', $language = 'JavaScript', $script = ''){
return '<script src="'.$src.'" language="'.$language.'" type="'.$type.'">'.$script.'</script>';}
public static function script($src,$type = 'text/javascript',$rel = 'stylesheet', $script = ''){
return '<script src="'.$src.'" type="'.$type.'">'.$script.'</script>';}
/**
* Generate <style> tag

View File

@ -57,7 +57,7 @@ class HEADER {
public static function PNG(){
if(self::checkHeader()){
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
*
@ -66,7 +66,7 @@ class HEADER {
public static function JPG(){
if(self::checkHeader()){
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
*
@ -75,7 +75,7 @@ class HEADER {
public static function JPEG(){
if(self::checkHeader()){
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
*
@ -84,7 +84,7 @@ class HEADER {
public static function GIF(){
if(self::checkHeader()){
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
*
@ -93,7 +93,7 @@ class HEADER {
public static function JS(){
if(self::checkHeader()){
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
*
@ -102,7 +102,7 @@ class HEADER {
public static function CSS(){
if(self::checkHeader()){
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
*
@ -110,7 +110,8 @@ class HEADER {
*/
public static function LESS(){
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
*