답변 3개
채택된 답변
+20 포인트
6년 전
관리자모드의
/adm/theme_preview.php?theme=테마명
화일 참고하시어 작업하시면 될것 같습니다.
/로 복사하시어 권한 부분만 확인하시면 될것 같습니다.
복사후 화일 상단에
</p>
<p>// 테마
function get_theme_dir()
{
$result_array = array();</p>
<p> $dirname = G5_PATH.'/'.G5_THEME_DIR.'/';
$handle = opendir($dirname);
while ($file = readdir($handle)) {
if($file == '.'||$file == '..') continue;</p>
<p> if (is_dir($dirname.$file)) {
$theme_path = $dirname.$file;
if(is_file($theme_path.'/index.php') && is_file($theme_path.'/head.php') && is_file($theme_path.'/tail.php'))
$result_array[] = $file;
}
}
closedir($handle);
natsort($result_array);</p>
<p> return $result_array;
}</p>
<p>
// 테마정보
function get_theme_info($dir)
{
$info = array();
$path = G5_PATH.'/'.G5_THEME_DIR.'/'.$dir;</p>
<p> if(is_dir($path)) {
$screenshot = $path.'/screenshot.png';
if(is_file($screenshot)) {
$size = @getimagesize($screenshot);</p>
<p> if($size[2] == 3)
$screenshot_url = str_replace(G5_PATH, G5_URL, $screenshot);
}</p>
<p> $info['screenshot'] = $screenshot_url;</p>
<p> $text = $path.'/readme.txt';
if(is_file($text)) {
$content = file($text, false);
$content = array_map('trim', $content);</p>
<p> preg_match('#^Theme Name:(.+)$#i', $content[0], $m0);
preg_match('#^Theme URI:(.+)$#i', $content[1], $m1);
preg_match('#^Maker:(.+)$#i', $content[2], $m2);
preg_match('#^Maker URI:(.+)$#i', $content[3], $m3);
preg_match('#^Version:(.+)$#i', $content[4], $m4);
preg_match('#^Detail:(.+)$#i', $content[5], $m5);
preg_match('#^License:(.+)$#i', $content[6], $m6);
preg_match('#^License URI:(.+)$#i', $content[7], $m7);</p>
<p> $info['theme_name'] = trim($m0[1]);
$info['theme_uri'] = trim($m1[1]);
$info['maker'] = trim($m2[1]);
$info['maker_uri'] = trim($m3[1]);
$info['version'] = trim($m4[1]);
$info['detail'] = trim($m5[1]);
$info['license'] = trim($m6[1]);
$info['license_uri'] = trim($m7[1]);
}</p>
<p> if(!$info['theme_name'])
$info['theme_name'] = $dir;
}</p>
<p> return $info;
}
// 테마설정 정보
function get_theme_config_value($dir, $key='*')
{
$tconfig = array();</p>
<p> $theme_config_file = G5_PATH.'/'.G5_THEME_DIR.'/'.$dir.'/theme.config.php';
if(is_file($theme_config_file)) {
include($theme_config_file);</p>
<p> if($key == '*') {
$tconfig = $theme_config;
} else {
$keys = array_map('trim', explode(',', $key));
foreach($keys as $v) {
$tconfig[$v] = trim($theme_config[$v]);
}
}
}</p>
<p> return $tconfig;
}
추가하시면 되겠습니다.
로그인 후 평가할 수 있습니다
댓글을 작성하려면 로그인이 필요합니다.
댓글을 작성하려면 로그인이 필요합니다.
답변을 작성하려면 로그인이 필요합니다.
로그인