make($name, $arg)->render(); echo $bld; } public static function tailwind($name = '', $arg = []){ $blade = new Blade(SETUP_PATH.'tailwind', 'cache'); $bld = $blade->make($name, $arg)->render(); echo $bld; } public static function sc($file, $type="script"){ $f = SETUP_PATH."script/".$file; if(file_exists($f)){ $dt = filemtime($f); $j = base64_encode($file)."||".$dt; if($type == 'module'){ return ""; } return ""; }else{ return null; } } public static function ip(){ $ipaddress = ''; if (getenv('HTTP_CLIENT_IP')) $ipaddress = getenv('HTTP_CLIENT_IP'); else if(getenv('HTTP_X_FORWARDED_FOR')) $ipaddress = getenv('HTTP_X_FORWARDED_FOR'); else if(getenv('HTTP_X_FORWARDED')) $ipaddress = getenv('HTTP_X_FORWARDED'); else if(getenv('HTTP_FORWARDED_FOR')) $ipaddress = getenv('HTTP_FORWARDED_FOR'); else if(getenv('HTTP_FORWARDED')) $ipaddress = getenv('HTTP_FORWARDED'); else if(getenv('REMOTE_ADDR')) $ipaddress = getenv('REMOTE_ADDR'); else $ipaddress = 'UNKNOWN'; return $ipaddress; } public function ffiletimes(string $dir): ?string { if (!is_dir($dir)) throw new \ValueError('Expecting a valid directory!'); $latest = null; $latestTime = 0; foreach (scandir($dir) as $path) if (!in_array($path, ['.', '..'], true)) { $filename = $dir . DIRECTORY_SEPARATOR . $path; if (is_dir($filename)) { $directoryLastModifiedFile = $this->ffiletimes($filename); if (null === $directoryLastModifiedFile) { continue; } else { $filename = $directoryLastModifiedFile; } } $lastModified = filemtime($filename); if ($lastModified > $latestTime) { $latestTime = $lastModified; $latest = $filename; } } return $latest; } public static function filetimes(){ $w = filemtime((new self)->ffiletimes(SETUP_PATH . "script")); return $w; } public static function js($path = ""){ $w = filemtime((new self)->ffiletimes(SETUP_PATH . "script")); if($path != ""){ return ""; } return $w; } public static function jsm($path = ""){ $w = filemtime((new self)->ffiletimes(SETUP_PATH . "script")); if($path != ""){ return ""; } return $w; } public static function jsx($path = ""){ $w = filemtime((new self)->ffiletimes(SETUP_PATH . "script")); if($path != ""){ return ""; } return $w; } public static function time(){ $w = filemtime((new self)->ffiletimes(SETUP_PATH . "script")); return $w; } public function single($name = "") { $w = filemtime((new self)->ffiletimes(SETUP_PATH . "script")); $file = SETUP_PATH . "script/". join("/", explode("-", explode("?", $name )[0] ) ) ; if(file_exists($file)){ $x = Files::read($file); $x = str_replace("{time}", $w, $x); $x = str_replace("{js}", PATH."/assets-js/", $x); $x = str_replace("{{PATH}}", PATH, $x); $x = str_replace("{{ PATH }}", PATH, $x); $x = str_replace("{{APPNAME}}",APPNAME, $x); $x = str_replace("{{ APPNAME }}",APPNAME, $x); $x = str_replace("{{ SETUP_PATH }}", SETUP_PATH, $x); $x = str_replace("{{ASSET}}", ASSET, $x); $x = str_replace("{{ ASSET }}", ASSET, $x); return $x; } return ""; } public static function multijs($t = "") { ini_set('memory_limit', '-1'); $j = SETUP_PATH."json/asset.json"; $j = json_decode( Files::read($j) ); $h = ""; $h .= (new self)->single($t); foreach($j->asset as $asset){ $asset = str_replace("/", "-", $asset); $h .= (new self)->single( $asset ); $h .= " \n "; } $h = str_replace("window", "\n window", $h); echo $h; } public static function multijsx() { ini_set('memory_limit', '-1'); $j = SETUP_PATH."json/main.json"; $j = json_decode( Files::read($j) ); $h = ""; foreach($j->asset as $asset){ $asset = str_replace("/", "-", $asset); $h .= (new self)->single( $asset ); $h .= " \n "; } echo $h; } }