use asse_stamp for get_url

This commit is contained in:
freya 2024-09-25 16:25:50 +00:00
parent 6702a8586c
commit b792dca23b
2 changed files with 7 additions and 7 deletions

View file

@ -25,7 +25,7 @@ abstract class Core {
{
if (ENVIRONMENT == 'devlopment')
return time();
$path = PUBLIC_ROOT . '/' . $path;
$path = PHP_ROOT . '/' . $path;
return @filemtime($path);
}
@ -48,7 +48,7 @@ abstract class Core {
$base = lang('base_path');
$url = "{$scheme}://{$host}{$base}{$path}";
if ($timestamp) {
$time = @filemtime(PHP_ROOT . '/' . $path);
$time = Core::asset_stamp($path);
$url .= "?timestamp={$time}";
}
return $url;
@ -60,8 +60,8 @@ abstract class Core {
*/
public static function link_js(string $path): string
{
$stamp = Core::asset_stamp($path);
$href = Core::get_url("public/{$path}?stamp={$stamp}");
$stamp = Core::asset_stamp("public/$path");
$href = Core::get_url("public/{$path}?timestamp={$stamp}");
return '<script src="'. $href .'"></script>';
}
@ -71,8 +71,8 @@ abstract class Core {
*/
public static function link_css(string $path): string
{
$stamp = Core::asset_stamp($path);
$href = Core::get_url("public/{$path}?stamp={$stamp}");
$stamp = Core::asset_stamp("public/$path");
$href = Core::get_url("public/{$path}?timestamp={$stamp}");
return '<link rel="stylesheet" href="'. $href .'">';
}

View file

@ -18,7 +18,7 @@ define('ENVIRONMENT', 'devlopment');
// FOLDER_ROOT
//
// define folder directiroy paths based on this file
define('PHP_ROOT', dirname(__FILE__) . '/..');
define('PHP_ROOT', realpath(dirname(__FILE__) . '/..'));
define('WEB_ROOT', PHP_ROOT . '/web');
define('ASSET_ROOT', PHP_ROOT . '/assets');
define('PUBLIC_ROOT', PHP_ROOT . '/public');