From b7b18a924d6fd2736f35044499252745b3674bf3 Mon Sep 17 00:00:00 2001 From: Robert Date: Thu, 28 May 2026 09:34:23 -0400 Subject: [PATCH] public assets --- src/Framework/Assets.php | 15 ++++++++------- src/Framework/View.php | 5 +++-- 2 files changed, 11 insertions(+), 9 deletions(-) diff --git a/src/Framework/Assets.php b/src/Framework/Assets.php index b8fb6fb..1bf219a 100644 --- a/src/Framework/Assets.php +++ b/src/Framework/Assets.php @@ -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); diff --git a/src/Framework/View.php b/src/Framework/View.php index c512969..9bf5831 100644 --- a/src/Framework/View.php +++ b/src/Framework/View.php @@ -140,8 +140,9 @@ final class View { if (!empty($render_page)) { $render_page = str_replace('.php', '', $render_page); - $templ = "/Templates/{$render_page}"; - if (bootstrap\requires::safer_file_exists(IO_CORNERSTONE_PROJECT . $templ . '.php') !== false) { + $templ = "Templates/{$render_page}"; + + if (Requires::saferFileExists(IO_CORNERSTONE_PROJECT . $templ . '.php') !== false) { $this->template = $templ; return true; }