css, js 파일 로드시 파일명에 따른 sort 코드 추가
This commit is contained in:
@ -1804,6 +1804,7 @@ function get_skin_stylesheet($skin_path, $dir='')
|
|||||||
return "";
|
return "";
|
||||||
|
|
||||||
$str = "";
|
$str = "";
|
||||||
|
$files = array();
|
||||||
|
|
||||||
if($dir)
|
if($dir)
|
||||||
$skin_path .= '/'.$dir;
|
$skin_path .= '/'.$dir;
|
||||||
@ -1820,22 +1821,30 @@ function get_skin_stylesheet($skin_path, $dir='')
|
|||||||
continue;
|
continue;
|
||||||
|
|
||||||
if(preg_match("/\.(css)$/i", $file))
|
if(preg_match("/\.(css)$/i", $file))
|
||||||
$str .= '<link rel="stylesheet" href="'.$skin_url.'/'.$file.'?='.date("md").'">'."\n";
|
$files[] = $file;
|
||||||
}
|
}
|
||||||
closedir($dh);
|
closedir($dh);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(!empty($files)) {
|
||||||
|
sort($files);
|
||||||
|
|
||||||
|
foreach($files as $file) {
|
||||||
|
$str .= '<link rel="stylesheet" href="'.$skin_url.'/'.$file.'?='.date("md").'">'."\n";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return $str;
|
return $str;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
// glob 를 이용한 코드
|
// glob 를 이용한 코드
|
||||||
if (!$skin_path) return '';
|
if (!$skin_path) return '';
|
||||||
$skin_path .= $dir ? '/'.$dir : '';
|
$skin_path .= $dir ? '/'.$dir : '';
|
||||||
|
|
||||||
$str = '';
|
$str = '';
|
||||||
$skin_url = G4_URL.str_replace('\\', '/', str_replace(G4_PATH, '', $skin_path));
|
$skin_url = G4_URL.str_replace('\\', '/', str_replace(G4_PATH, '', $skin_path));
|
||||||
|
|
||||||
foreach (glob($skin_path.'/*.css') as $filepath) {
|
foreach (glob($skin_path.'/*.css') as $filepath) {
|
||||||
$file = str_replace($skin_path, '', $filepath);
|
$file = str_replace($skin_path, '', $filepath);
|
||||||
$str .= '<link rel="stylesheet" href="'.$skin_url.'/'.$file.'?='.date('md').'">'."\n";
|
$str .= '<link rel="stylesheet" href="'.$skin_url.'/'.$file.'?='.date('md').'">'."\n";
|
||||||
@ -1851,6 +1860,7 @@ function get_skin_javascript($skin_path, $dir='')
|
|||||||
return "";
|
return "";
|
||||||
|
|
||||||
$str = "";
|
$str = "";
|
||||||
|
$files = array();
|
||||||
|
|
||||||
if($dir)
|
if($dir)
|
||||||
$skin_path .= '/'.$dir;
|
$skin_path .= '/'.$dir;
|
||||||
@ -1867,12 +1877,20 @@ function get_skin_javascript($skin_path, $dir='')
|
|||||||
continue;
|
continue;
|
||||||
|
|
||||||
if(preg_match("/\.(js)$/i", $file))
|
if(preg_match("/\.(js)$/i", $file))
|
||||||
$str .= '<script src="'.$skin_url.'/'.$file.'"></script>'."\n";
|
$files[] = $file;
|
||||||
}
|
}
|
||||||
closedir($dh);
|
closedir($dh);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(!empty($files)) {
|
||||||
|
sort($files);
|
||||||
|
|
||||||
|
foreach($files as $file) {
|
||||||
|
$str .= '<script src="'.$skin_url.'/'.$file.'"></script>'."\n";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return $str;
|
return $str;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user