PHP5 전용함수인 file_put_contents 를 PHP4 에서 사용하기 위해 추가
This commit is contained in:
@ -1798,16 +1798,13 @@ function delete_editor_thumbnail($contents)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 스킨 style sheet 파일 얻기
|
// 스킨 style sheet 파일 얻기
|
||||||
function get_skin_stylesheet($skin_path, $dir='')
|
function get_skin_stylesheet($skin_path)
|
||||||
{
|
{
|
||||||
if(!$skin_path)
|
if(!$skin_path)
|
||||||
return "";
|
return "";
|
||||||
|
|
||||||
$str = "";
|
$str = "";
|
||||||
|
|
||||||
if($dir)
|
|
||||||
$skin_path .= '/'.$dir;
|
|
||||||
|
|
||||||
$skin_url = G4_URL.str_replace("\\", "/", str_replace(G4_PATH, "", $skin_path));
|
$skin_url = G4_URL.str_replace("\\", "/", str_replace(G4_PATH, "", $skin_path));
|
||||||
|
|
||||||
if(is_dir($skin_path)) {
|
if(is_dir($skin_path)) {
|
||||||
@ -1829,35 +1826,19 @@ function get_skin_stylesheet($skin_path, $dir='')
|
|||||||
return $str;
|
return $str;
|
||||||
}
|
}
|
||||||
|
|
||||||
// 스킨 javascript 파일 얻기
|
|
||||||
function get_skin_javascript($skin_path, $dir='js')
|
|
||||||
{
|
|
||||||
if(!$skin_path)
|
|
||||||
return "";
|
|
||||||
|
|
||||||
$str = "";
|
// file_put_contents 는 PHP5 전용 함수이므로 PHP4 하위버전에서 사용하기 위함
|
||||||
|
// http://www.phpied.com/file_get_contents-for-php4/
|
||||||
if($dir)
|
if (!function_exists('file_put_contents')) {
|
||||||
$skin_path .= '/'.$dir;
|
function file_put_contents($filename, $data) {
|
||||||
|
$f = @fopen($filename, 'w');
|
||||||
$skin_url = G4_URL.str_replace("\\", "/", str_replace(G4_PATH, "", $skin_path));
|
if (!$f) {
|
||||||
|
return false;
|
||||||
if(is_dir($skin_path)) {
|
} else {
|
||||||
if($dh = opendir($skin_path)) {
|
$bytes = fwrite($f, $data);
|
||||||
while(($file = readdir($dh)) !== false) {
|
fclose($f);
|
||||||
if($file == "." || $file == "..")
|
return $bytes;
|
||||||
continue;
|
|
||||||
|
|
||||||
if(is_dir($skin_path.'/'.$file))
|
|
||||||
continue;
|
|
||||||
|
|
||||||
if(preg_match("/\.(js)$/i", $file))
|
|
||||||
$str .= '<script src="'.$skin_url.'/'.$file.'"></script>'."\n";
|
|
||||||
}
|
|
||||||
closedir($dh);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return $str;
|
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
Reference in New Issue
Block a user