diff --git a/hwe/v_inheritPoint.php b/hwe/v_inheritPoint.php index 2579b99e..ee766461 100644 --- a/hwe/v_inheritPoint.php +++ b/hwe/v_inheritPoint.php @@ -28,11 +28,11 @@ foreach (array_keys(General::INHERITANCE_KEY) as $key) { - - + + $items ]) ?> @@ -40,8 +40,6 @@ foreach (array_keys(General::INHERITANCE_KEY) as $key) {
- - \ No newline at end of file diff --git a/src/sammo/WebUtil.php b/src/sammo/WebUtil.php index 77f299d1..c63ae0eb 100644 --- a/src/sammo/WebUtil.php +++ b/src/sammo/WebUtil.php @@ -105,7 +105,7 @@ class WebUtil return $decoded; } - public static function preloadCSS(string $path){ + public static function preloadAsset(string $path, string $type){ $upath = \phpUri::parse($path); $path = $upath->join(''); if(!$upath->scheme && file_exists($upath->path)){ @@ -120,29 +120,19 @@ class WebUtil else{ $tail = ''; } - return "\n"; + return "\n"; + } + + public static function preloadCSS(string $path){ + return static::preloadAsset($path, 'style'); } public static function preloadJS(string $path){ - $upath = \phpUri::parse($path); - $path = $upath->join(''); - if(!$upath->scheme && file_exists($upath->path)){ - $mtime = filemtime($upath->path); - if($upath->query){ - $tail = '&'.$mtime; - } - else{ - $tail = '?'.$mtime; - } - } - else{ - $tail = ''; - } - return "\n"; + return static::preloadAsset($path, 'script'); } - public static function printJS(string $path){ - //async, defer 옵션 고려 + public static function printJS(string $path, bool $isDefer=false){ + //async 옵션 고려? $upath = \phpUri::parse($path); $path = $upath->join(''); if(!$upath->scheme && file_exists($upath->path)){ @@ -157,7 +147,9 @@ class WebUtil else{ $tail = ''; } - return "\n"; + + $typeText = $isDefer?'defer':''; + return "\n"; } public static function printCSS(string $path){ @@ -188,32 +180,11 @@ class WebUtil $lines[] = "var {$key} = ".Json::encode($value, Json::EMPTY_ARRAY_IS_DICT | ($pretty?Json::PRETTY:0)); } - $lines[] = ""; + $lines[] = "\n"; return join("\n", $lines); } - protected static $jsFilesList = []; - public static function pushJSFile(string $path){ - static::$jsFilesList[] = $path; - } - - protected static $cssFilesList = []; - public static function pushCSSFile(string $path){ - static::$cssFilesList[] = $path; - } - - public static function printResourceFiles(){ - foreach(static::$jsFilesList as $path){ - static::printJS($path); - } - foreach(static::$cssFilesList as $path){ - static::printCSS($path); - } - static::$jsFilesList = []; - static::$cssFilesList = []; - } - public static function htmlPurify(?string $text): string{ if(!$text){ return '';