#492 addon모듈 새 XML 포맷 반영

git-svn-id: http://xe-core.googlecode.com/svn/sandbox@4358 201d5d3c-b55e-5fd7-737f-ddc643e51545
This commit is contained in:
bnu 2008-07-15 04:27:07 +00:00
parent 88ed871193
commit 02dd06a661
12 changed files with 153 additions and 37 deletions

View file

@ -84,30 +84,82 @@
if(!$xml_obj) return;
$info->title = $xml_obj->title->body;
// 작성자 정보
$addon_info->addon_name = $addon;
$addon_info->title = $xml_obj->title->body;
$addon_info->version = $xml_obj->attrs->version;
$addon_info->author->name = $xml_obj->author->name->body;
$addon_info->author->email_address = $xml_obj->author->attrs->email_address;
$addon_info->author->homepage = $xml_obj->author->attrs->link;
$addon_info->author->date = $xml_obj->author->attrs->date;
$addon_info->author->description = trim($xml_obj->author->description->body);
// 애드온 정보
if($xml_obj->version && $xml_obj->attrs->version == '0.2') {
// addon format 0.2
$addon_info->title = $xml_obj->title->body;
$addon_info->description = trim($xml_obj->description->body);
$addon_info->version = $xml_obj->version->body;
$addon_info->homepage = $xml_obj->link->body;
sscanf($xml_obj->date->body, '%d-%d-%d', $date_obj->y, $date_obj->m, $date_obj->d);
$addon_info->date = sprintf('%04d%02d%02d', $date_obj->y, $date_obj->m, $date_obj->d);
$addon_info->license = $xml_obj->license->body;
$addon_info->license_link = $xml_obj->license->attrs->link;
if(!is_array($xml_obj->author)) $author_list[] = $xml_obj->author;
else $author_list = $xml_obj->author;
foreach($author_list as $author) {
unset($author_obj);
$author_obj->name = $author->name->body;
$author_obj->email_address = $author->attrs->email_address;
$author_obj->homepage = $author->attrs->link;
$addon_info->author[] = $author_obj;
}
} else {
// addon format 0.1
$addon_info->addon_name = $addon;
$addon_info->title = $xml_obj->title->body;
$addon_info->description = trim($xml_obj->author->description->body);
$addon_info->version = $xml_obj->attrs->version;
sscanf($xml_obj->author->attrs->date, '%d. %d. %d', $date_obj->y, $date_obj->m, $date_obj->d);
$addon_info->date = sprintf('%04d%02d%02d', $date_obj->y, $date_obj->m, $date_obj->d);
$author_obj->name = $xml_obj->author->name->body;
$author_obj->email_address = $xml_obj->author->attrs->email_address;
$author_obj->homepage = $xml_obj->author->attrs->link;
$addon_info->author[] = $author_obj;
}
// history
if(!is_array($xml_obj->history->author)) $history[] = $xml_obj->history->author;
else $history = $xml_obj->history->author;
if($xml_obj->history) {
if(!is_array($xml_obj->history)) $history[] = $xml_obj->history;
else $history = $xml_obj->history;
foreach($history as $item) {
unset($obj);
$obj->name = $item->name->body;
$obj->email_address = $item->attrs->email_address;
$obj->homepage = $item->attrs->link;
$obj->date = $item->attrs->date;
$obj->description = $item->description->body;
$addon_info->history[] = $obj;
foreach($history as $item) {
unset($obj);
if($item->author) {
(!is_array($item->author)) ? $obj->author_list[] = $item->author : $obj->author_list = $item->author;
foreach($obj->author_list as $author) {
unset($author_obj);
$author_obj->name = $author->name->body;
$author_obj->email_address = $author->attrs->email_address;
$author_obj->homepage = $author->attrs->link;
$obj->author[] = $author_obj;
}
}
$obj->name = $item->name->body;
$obj->email_address = $item->attrs->email_address;
$obj->homepage = $item->attrs->link;
$obj->version = $item->attrs->version;
$obj->date = $item->attrs->date;
$obj->description = $item->description->body;
if($item->log) {
(!is_array($item->log)) ? $obj->log[] = $item->log : $obj->log = $item->log;
foreach($obj->log as $log) {
$obj->logs[] = $log->body;
}
}
$addon_info->history[] = $obj;
}
}
// DB에 설정된 내역을 가져온다