|
|
|
|
@ -36,7 +36,8 @@ class Assets |
|
|
|
|
*/ |
|
|
|
|
private static function attemptsRootDir(?string $path): bool { |
|
|
|
|
// up from src and back up to public |
|
|
|
|
$open_base_dir_path = dirname(BaseDir, 1) . '/public/'; |
|
|
|
|
$open_base_dir_path = BaseDir. '/public/'; |
|
|
|
|
|
|
|
|
|
if ($path === null || $path === '') { |
|
|
|
|
return false; |
|
|
|
|
} |
|
|
|
|
@ -107,7 +108,7 @@ class Assets |
|
|
|
|
public static function wrapAsset(string $file, string $scope = 'project') { |
|
|
|
|
$scope = StringFacade::strtolower($scope); |
|
|
|
|
if ($scope === 'cdn') { |
|
|
|
|
$proto = bootstrap\safer_io::get_clean_server_var('SERVER_PROTOCOL'); |
|
|
|
|
$proto = $_SERVER['SERVER_PROTOCOL']; |
|
|
|
|
if ($proto === null) { |
|
|
|
|
$protocol = '://'; |
|
|
|
|
} else { |
|
|
|
|
@ -116,7 +117,7 @@ class Assets |
|
|
|
|
return (str_contains($file, '://') === true) ? $file : $protocol . $file; |
|
|
|
|
} |
|
|
|
|
if ($scope === 'project' || $scope === 'app') { |
|
|
|
|
$path = PROJECT_ASSETS_DIR . "/"; |
|
|
|
|
$path = PROJECT_ASSETS_DIR; |
|
|
|
|
$ism = self::isMinified($path, $file); |
|
|
|
|
return ($ism !== false) ? PROJECT_ASSETS_BASE_REF . "/" . $ism : false; |
|
|
|
|
} |
|
|
|
|
@ -138,14 +139,14 @@ class Assets |
|
|
|
|
if ($scope === 'cdn') { |
|
|
|
|
return ""; |
|
|
|
|
} else if ($scope === 'project' || $scope === 'app') { |
|
|
|
|
$path = PROJECT_ASSETS_DIR . "/"; |
|
|
|
|
$path = PROJECT_ASSETS_DIR; |
|
|
|
|
} else if ($scope === 'assets') { |
|
|
|
|
$path = ASSETS_DIR . "/"; |
|
|
|
|
} else { |
|
|
|
|
return ""; |
|
|
|
|
} |
|
|
|
|
$check = self::is_minified($path, $file); |
|
|
|
|
return ($check !==false) ? self::get_ver($path . $check) : false; |
|
|
|
|
$check = self::isMinified($path, $file); |
|
|
|
|
return ($check !==false) ? self::getVer($path . $check) : false; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
@ -218,7 +219,7 @@ class Assets |
|
|
|
|
} |
|
|
|
|
$safe_path = Security::filterUri($path); |
|
|
|
|
$safe_file = Security::filterUri($file); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (str_contains($safe_file, '.auto.js')) { |
|
|
|
|
$production = (isLive()); |
|
|
|
|
$safe_file = str_replace('.auto.js', '', $safe_file); |
|
|
|
|
|