| Server IP : 194.61.116.167 / Your IP : 216.73.217.84 Web Server : Apache/2 System : Linux nimbus2000.evosiber.com 5.14.0-503.11.1.el9_5.x86_64 #1 SMP PREEMPT_DYNAMIC Tue Nov 12 09:26:13 EST 2024 x86_64 User : evoplastik ( 1130) PHP Version : 8.1.34 Disable Function : exec,system,passthru,shell_exec,proc_close,proc_open,dl,popen,show_source,posix_kill,posix_mkfifo,posix_getpwuid,posix_setpgid,posix_setsid,posix_setuid,posix_setgid,posix_seteuid,posix_setegid,posix_uname MySQL : OFF | cURL : ON | WGET : OFF | Perl : OFF | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : /home/evoplastik/public_html/wp-content/plugins/wp-optimize/vendor/mrclay/minify/static/ |
Upload File : |
<?php
namespace Minify\StaticService;
/**
* Build a URI for the static cache
*
* @param string $static_uri E.g. "/min/static"
* @param string $query E.g. "b=scripts&f=1.js,2.js"
* @param string $type "css" or "js"
* @return string
*/
function build_uri($static_uri, $query, $type)
{
$static_uri = rtrim($static_uri, '/');
$query = ltrim($query, '?');
$ext = ".$type";
if (substr($query, - strlen($ext)) !== $ext) {
$query .= "&z=$ext";
}
$cache_time = get_cache_time();
return "$static_uri/$cache_time/$query";
}
/**
* Get the name of the current cache directory within static/. E.g. "1467089473"
*
* @param bool $auto_create Automatically create the directory if missing?
* @return null|string null if missing or can't create
*/
function get_cache_time($auto_create = true)
{
foreach (scandir(__DIR__) as $entry) {
if (ctype_digit($entry)) {
return $entry;
break;
}
}
if (!$auto_create) {
return null;
}
$time = (string)time();
if (!mkdir(__DIR__ . "/$time")) {
return null;
}
return $time;
}
function flush_cache()
{
$time = get_cache_time(false);
if ($time) {
remove_tree(__DIR__ . "/$time");
}
}
function remove_tree($dir)
{
$files = array_diff(scandir($dir), array('.', '..'));
foreach ($files as $file) {
is_dir("$dir/$file") ? remove_tree("$dir/$file") : unlink("$dir/$file");
}
return rmdir($dir);
}