$array = str_replace('array (', 'array(', var_export($sm, 1)); $symlinkOption = "\$min_symlinks = {$array};"; } } require __DIR__ . '/../bootstrap.php'; require __DIR__ . '/../config.php'; if (!$min_enableBuilder) { header('Content-Type: text/plain'); die('This application is not enabled. See https://github.com/mrclay/minify/blob/master/docs/BuilderApp.wiki.md'); } if (isset($min_builderPassword) && is_string($min_builderPassword) && $min_builderPassword !== '') { DooDigestAuth::http_auth('Minify Builder', array('admin' => $min_builderPassword)); } $cachePathCode = ''; if (!isset($min_cachePath) && !function_exists('sys_get_temp_dir')) { $detectedTmp = Minify_Cache_File::tmp(); $cachePathCode = "\$min_cachePath = " . var_export($detectedTmp, 1) . ';'; } ob_start(); ?> <!DOCTYPE html> <title>Minify URI Builder</title> <meta name="ROBOTS" content="NOINDEX, NOFOLLOW"> <link rel="stylesheet" href="//netdna.bootstrapcdn.com/bootstrap/3.1.1/css/bootstrap.min.css"> <style> body {margin:1em 60px;} h1, h2, h3 {margin-left:-25px; position:relative;} h1 {margin-top:0;} #sources {margin:0; padding:0;} #sources li {margin:0 0 0 40px} #sources li input {margin-left:2px}
function isStatic($file) { // FIX: Bail out if this is the root if ($file == WEB_FOLDER) { return false; } // FIX: clean webfolder from path before comparing $file = preg_replace('#^' . addslashes(WEB_FOLDER) . '#', '', $file); $root = rtrim($_SERVER['DOCUMENT_ROOT'], "/") . "/"; // check in the document root if (file_exists($root . $file)) { $target = $root . $file; return $target; } // check in the app public folders if (defined("APP")) { if (file_exists(APP . "public/" . $file)) { $target = APP . "public/" . $file; return $target; } if (is_dir(APP . "plugins/") && ($handle = opendir(APP . "plugins/"))) { while (false !== ($plugin = readdir($handle))) { if ($plugin == '.' || $plugin == '..') { continue; } if (is_dir(APP . "plugins/" . $plugin) && file_exists(APP . "plugins/" . $plugin . "/public/" . $file)) { $target = APP . "plugins/" . $plugin . "/public/" . $file; return $target; } } } } //check the cache (less than an hour old) $cache = new Minify_Cache_File(); //if( $cache->isValid($file, time("now")-3600) ) return $cache->tmp() ."/". $file; if ($cache->isValid("/{$_SERVER['HTTP_HOST']}/{$file}", 0)) { return $cache->tmp() . "/{$_SERVER['HTTP_HOST']}/" . $file; } // check in the base public folders if (defined("BASE")) { if (file_exists(BASE . "public/" . $file)) { $target = BASE . "public/" . $file; return $target; } $target = realpath(BASE . "../public/" . $file); if (file_exists($target)) { return $target; } if (is_dir(BASE . "plugins/") && ($handle = opendir(BASE . "plugins/"))) { while (false !== ($plugin = readdir($handle))) { if ($plugin == '.' || $plugin == '..') { continue; } if (is_dir(BASE . "plugins/" . $plugin) && file_exists(BASE . "plugins/" . $plugin . "/public/" . $file)) { $target = BASE . "plugins/" . $plugin . "/public/" . $file; return $target; } } } } // check in the plugins directory if (defined("PLUGINS")) { $files = glob(PLUGINS . "*/public/{$file}"); if ($files && count($files) > 0) { // arbitrary pick the first file - should have a comparison mechanism in place $target = $files[0]; return $target; } } # 110 looking into web root for plugins if (is_dir(SITE_ROOT . "/plugins")) { $files = glob(SITE_ROOT . "/plugins/*/public/{$file}"); if ($files && count($files) > 0) { // arbitrary pick the first file - should have a comparison mechanism in place $target = $files[0]; return $target; } } // return false if there are no results return false; }