mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-04-28 23:03:25 +09:00
#495 layout모듈 새 XML 포맷 처리 코드 추가
git-svn-id: http://xe-core.googlecode.com/svn/sandbox@4363 201d5d3c-b55e-5fd7-737f-ddc643e51545
This commit is contained in:
parent
ed6b132fe8
commit
5a135acfa6
10 changed files with 159 additions and 25 deletions
|
|
@ -16,7 +16,7 @@
|
|||
|
||||
/**
|
||||
* @brief DB 에 생성된 레이아웃의 목록을 구함
|
||||
* 생성되었다는 것은 DB에 등록이 되었다는 것을 의미
|
||||
* 생성되었다는 것은 DB에 등록이 되었다는 것을 의미
|
||||
**/
|
||||
function getLayoutList() {
|
||||
$output = executeQuery('layout.getLayoutList');
|
||||
|
|
@ -46,7 +46,7 @@
|
|||
**/
|
||||
function getLayoutPath($layout_name) {
|
||||
$class_path = sprintf('./layouts/%s/', $layout_name);
|
||||
if(is_dir($class_path)) return $class_path;
|
||||
if(is_dir($class_path)) return $class_path;
|
||||
|
||||
return "";
|
||||
}
|
||||
|
|
@ -76,7 +76,7 @@
|
|||
|
||||
/**
|
||||
* @brief 모듈의 conf/info.xml 을 읽어서 정보를 구함
|
||||
* 이것 역시 캐싱을 통해서 xml parsing 시간을 줄인다..
|
||||
* 이것 역시 캐싱을 통해서 xml parsing 시간을 줄인다..
|
||||
**/
|
||||
function getLayoutInfo($layout, $info = null) {
|
||||
if($info) {
|
||||
|
|
@ -89,7 +89,7 @@
|
|||
$layout_path = preg_replace('/([a-zA-Z0-9\_\.]+)(\.html)$/','',$info->layout_path);
|
||||
$xml_file = sprintf('%sskin.xml', $layout_path);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 요청된 모듈의 경로를 구한다. 없으면 return
|
||||
if(!$layout_path) $layout_path = $this->getLayoutPath($layout);
|
||||
|
|
@ -131,20 +131,85 @@
|
|||
|
||||
$buff = '';
|
||||
|
||||
// 레이아웃의 제목, 버전
|
||||
$buff .= sprintf('$layout_info->layout = "%s";', $layout);
|
||||
$buff .= sprintf('$layout_info->path = "%s";', $layout_path);
|
||||
$buff .= sprintf('$layout_info->title = "%s";', $xml_obj->title->body);
|
||||
$buff .= sprintf('$layout_info->version = "%s";', $xml_obj->attrs->version);
|
||||
$buff .= sprintf('$layout_info->layout_srl = $layout_srl;');
|
||||
$buff .= sprintf('$layout_info->layout_title = $layout_title;');
|
||||
if($xml_obj->version && $xml_obj->attrs->version == '0.2') {
|
||||
// 레이아웃의 제목, 버전
|
||||
sscanf($xml_obj->date->body, '%d-%d-%d', $date_obj->y, $date_obj->m, $date_obj->d);
|
||||
$date = sprintf('%04d%02d%02d', $date_obj->y, $date_obj->m, $date_obj->d);
|
||||
$buff .= sprintf('$layout_info->layout = "%s";', $layout);
|
||||
$buff .= sprintf('$layout_info->path = "%s";', $layout_path);
|
||||
$buff .= sprintf('$layout_info->title = "%s";', $xml_obj->title->body);
|
||||
$buff .= sprintf('$layout_info->description = "%s";', $xml_obj->description->body);
|
||||
$buff .= sprintf('$layout_info->version = "%s";', $xml_obj->version->body);
|
||||
$buff .= sprintf('$layout_info->date = "%s";', $date);
|
||||
$buff .= sprintf('$layout_info->layout_srl = $layout_srl;');
|
||||
$buff .= sprintf('$layout_info->layout_title = $layout_title;');
|
||||
$buff .= sprintf('$layout_info->license = "%s";', $xml_obj->license->body);
|
||||
$buff .= sprintf('$layout_info->license_link = "%S";', $xml_obj->license->attrs->link);
|
||||
|
||||
// 작성자 정보
|
||||
$buff .= sprintf('$layout_info->author->name = "%s";', $xml_obj->author->name->body);
|
||||
$buff .= sprintf('$layout_info->author->email_address = "%s";', $xml_obj->author->attrs->email_address);
|
||||
$buff .= sprintf('$layout_info->author->homepage = "%s";', $xml_obj->author->attrs->link);
|
||||
$buff .= sprintf('$layout_info->author->date = "%s";', $xml_obj->author->attrs->date);
|
||||
$buff .= sprintf('$layout_info->author->description = "%s";', $xml_obj->author->description->body);
|
||||
// 작성자 정보
|
||||
if(!is_array($xml_obj->author)) $author_list[] = $xml_obj->author;
|
||||
else $author_list = $xml_obj->author;
|
||||
|
||||
for($i=0; $i < count($author_list); $i++) {
|
||||
$buff .= sprintf('$layout_info->author['.$i.']->name = "%s";', $author_list[$i]->name->body);
|
||||
$buff .= sprintf('$layout_info->author['.$i.']->email_address = "%s";', $author_list[$i]->attrs->email_address);
|
||||
$buff .= sprintf('$layout_info->author['.$i.']->homepage = "%s";', $author_list[$i]->attrs->link);
|
||||
}
|
||||
|
||||
// history
|
||||
if($xml_obj->history) {
|
||||
if(!is_array($xml_obj->history)) $history_list[] = $xml_obj->history;
|
||||
else $history_list = $xml_obj->history;
|
||||
|
||||
for($i=0; $i < count($history_list); $i++) {
|
||||
sscanf($history_list[$i]->attrs->date, '%d-%d-%d', $date_obj->y, $date_obj->m, $date_obj->d);
|
||||
$date = sprintf('%04d%02d%02d', $date_obj->y, $date_obj->m, $date_obj->d);
|
||||
$buff .= sprintf('$layout_info->history['.$i.']->description = "%s";', $history_list[$i]->description->body);
|
||||
$buff .= sprintf('$layout_info->history['.$i.']->version = "%s";', $history_list[$i]->attrs->version);
|
||||
$buff .= sprintf('$layout_info->history['.$i.']->date = "%s";', $date);
|
||||
|
||||
if($history_list[$i]->author) {
|
||||
(!is_array($history_list[$i]->author)) ? $obj->author_list[] = $history_list[$i]->author : $obj->author_list = $history_list[$i]->author;
|
||||
|
||||
for($j=0; $j < count($obj->author_list); $j++) {
|
||||
$buff .= sprintf('$layout_info->history['.$i.']->author['.$j.']->name = "%s";', $obj->author_list[$j]->name->body);
|
||||
$buff .= sprintf('$layout_info->history['.$i.']->author['.$j.']->email_address = "%s";', $obj->author_list[$j]->attrs->email_address);
|
||||
$buff .= sprintf('$layout_info->history['.$i.']->author['.$j.']->homepage = "%s";', $obj->author_list[$j]->attrs->link);
|
||||
}
|
||||
}
|
||||
|
||||
if($history_list[$i]->log) {
|
||||
(!is_array($history_list[$i]->log)) ? $obj->log_list[] = $history_list[$i]->log : $obj->log_list = $history_list[$i]->log;
|
||||
|
||||
for($j=0; $j < count($obj->log_list); $j++) {
|
||||
$buff .= sprintf('$layout_info->history['.$i.']->logs['.$j.']->text = "%s";', $obj->log_list[$j]->body);
|
||||
$buff .= sprintf('$layout_info->history['.$i.']->logs['.$j.']->link = "%s";', $obj->log_list[$j]->attrs->link);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
} else {
|
||||
|
||||
// 레이아웃의 제목, 버전
|
||||
sscanf($xml_obj->author->attrs->date, '%d. %d. %d', $date_obj->y, $date_obj->m, $date_obj->d);
|
||||
$date = sprintf('%04d%02d%02d', $date_obj->y, $date_obj->m, $date_obj->d);
|
||||
$buff .= sprintf('$layout_info->layout = "%s";', $layout);
|
||||
$buff .= sprintf('$layout_info->path = "%s";', $layout_path);
|
||||
$buff .= sprintf('$layout_info->title = "%s";', $xml_obj->title->body);
|
||||
$buff .= sprintf('$layout_info->description = "%s";', $xml_obj->author->description->body);
|
||||
$buff .= sprintf('$layout_info->version = "%s";', $xml_obj->attrs->version);
|
||||
$buff .= sprintf('$layout_info->date = "%s";', $date);
|
||||
$buff .= sprintf('$layout_info->layout_srl = $layout_srl;');
|
||||
$buff .= sprintf('$layout_info->layout_title = $layout_title;');
|
||||
|
||||
// 작성자 정보
|
||||
$buff .= sprintf('$layout_info->author[0]->name = "%s";', $xml_obj->author->name->body);
|
||||
$buff .= sprintf('$layout_info->author[0]->email_address = "%s";', $xml_obj->author->attrs->email_address);
|
||||
$buff .= sprintf('$layout_info->author[0]->homepage = "%s";', $xml_obj->author->attrs->link);
|
||||
}
|
||||
|
||||
// 추가 변수 (템플릿에서 사용할 제작자 정의 변수)
|
||||
$extra_var_groups = $xml_obj->extra_vars->group;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue