本文整理汇总了PHP中XmlParser::loadXmlFile方法的典型用法代码示例。如果您正苦于以下问题:PHP XmlParser::loadXmlFile方法的具体用法?PHP XmlParser::loadXmlFile怎么用?PHP XmlParser::loadXmlFile使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类XmlParser
的用法示例。
在下文中一共展示了XmlParser::loadXmlFile方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: init
function init()
{
// forbit access if the user is not an administrator
$oMemberModel =& getModel('member');
$logged_info = $oMemberModel->getLoggedInfo();
if ($logged_info->is_admin != 'Y') {
return $this->stop("msg_is_not_administrator");
}
// change into administration layout
//$this->setTemplatePath('./modules/cympusadmin/tpl');
$this->setLayoutPath('./modules/cympusadmin/tpl');
$this->setLayoutFile(_CYMPUSADMIN_LAYOUT_);
// parse admin menu
$act = Context::get('act');
$oXmlParser = new XmlParser();
$xml_obj = $oXmlParser->loadXmlFile('./modules/cympusadmin/conf/' . _CYMPUSADMIN_MENU_);
$admin_menu = array();
$admin_menu = cympusadmin::getMenu($xml_obj->menu->item);
Context::set('cympusadmin_menu', $admin_menu);
$oModuleModel =& getModel('module');
$module_info = $oModuleModel->getModuleInfoXml('cympusadmin');
Context::set('cympus_modinfo', $module_info);
$news = getNewsFromAgency();
Context::set('news', $news);
Context::set('admin_bar', 'false');
}
示例2: init
function init()
{
// forbit access if the user is not an administrator
if (!$this->grant->manager && !$this->grant->is_admin) {
return $this->stop("msg_is_not_administrator");
}
// change into administration layout
//$this->setTemplatePath('./modules/cympusadmin/tpl');
$this->setLayoutPath('./modules/cympusadmin/tpl');
$this->setLayoutFile(_CYMPUSADMIN_LAYOUT_);
Context::loadLang(_XE_PATH_ . 'modules/cympusadmin/lang/');
if ($this->grant->is_admin) {
// parse admin menu
$oXmlParser = new XmlParser();
$xml_obj = $oXmlParser->loadXmlFile('./modules/cympusadmin/conf/' . _CYMPUSADMIN_MENU_);
$admin_menu = cympusadmin::getMenu($xml_obj->menu->item);
Context::set('cympusadmin_menu', $admin_menu);
} else {
$output = ModuleHandler::triggerCall('cympusadmin.getManagerMenu', 'before', $manager_menu);
if (!$output->toBool()) {
return $output;
}
Context::set('cympusadmin_menu', $manager_menu);
}
$news = getNewsFromAgency();
Context::set('news', $news);
Context::set('admin_bar', 'false');
$oModuleModel =& getModel('module');
$module_info = $oModuleModel->getModuleInfoXml('cympusadmin');
Context::set('cympus_modinfo', $module_info);
return new Object();
}
示例3: init
function init($module = null)
{
// change into administration layout
$config = getModel('cympusadmin')->getConfig();
$args = new stdClass();
$args->module = 'cympusadmin';
$module_list = getModel('module')->getModuleSrlList($args);
if (!empty($module_list)) {
foreach ($module_list as $module_info) {
$cympus_module_info = $module_info;
}
}
$module_path = './modules/cympusadmin/';
$template_path = sprintf("%sskins/%s/", $module_path, $cympus_module_info->skin);
if (!is_dir($template_path) || !$cympus_module_info->skin) {
$config->admin_skins = 'default';
$template_path = sprintf("%sskins/%s/", $module_path, $cympus_module_info->skin);
}
if ($module) {
$module->setLayoutPath($template_path);
$module->setLayoutFile(_CYMPUSADMIN_LAYOUT_);
} else {
$this->setLayoutPath($template_path);
$this->setLayoutFile(_CYMPUSADMIN_LAYOUT_);
}
Context::loadLang(_XE_PATH_ . 'modules/cympusadmin/lang/');
$logged_info = Context::get('logged_info');
if ($logged_info->is_admin == 'Y') {
// parse admin menu
$oXmlParser = new XmlParser();
$xml_obj = $oXmlParser->loadXmlFile('./modules/cympusadmin/conf/' . _CYMPUSADMIN_MENU_);
$admin_menu = cympusadmin::getMenu($xml_obj->menu->item);
Context::set('cympusadmin_menu', $admin_menu);
} else {
$output = ModuleHandler::triggerCall('cympusadmin.getManagerMenu', 'before', $manager_menu);
if (!$output->toBool()) {
return $output;
}
Context::set('cympusadmin_menu', $manager_menu);
}
$news = getNewsFromAgency();
Context::set('news', $news);
Context::set('admin_bar', 'false');
$oModuleModel = getModel('module');
$module_info = $oModuleModel->getModuleInfoXml('cympusadmin');
Context::set('cympus_modinfo', $module_info);
return new Object();
}
示例4: rearranges
//.........这里部分代码省略.........
* ...
* [category] => xxx
* [current_version] => xxx
* [type] => xxx
* [need_update] => xxx
* [avail_remove] => xxx
* [deps] => Array
* (
* [0] => xxx
* ...
* )
* )
* ...
* )
* </pre>
*
* @param object $items Recived data from server
* @param object $packages Local data
* @return object
*/
function rearranges($items, $packages = null)
{
if (!is_array($items)) {
$items = array($items);
}
$item_list = array();
$targets = array('category_srl', 'package_srl', 'item_screenshot_url', 'package_voted', 'package_voter', 'package_description', 'package_downloaded', 'item_regdate', 'title', 'item_version', 'package_star', 'depfrom');
$targetpackages = array();
foreach ($items as $item) {
$targetpackages[$item->package_srl->body] = 0;
}
$oModel =& getModel('autoinstall');
if ($package == null) {
$packages = $oModel->getInstalledPackages(array_keys($targetpackages));
}
$depto = array();
foreach ($items as $item) {
$v = $this->rearrange($item, $targets);
$v->category = $this->categories[$v->category_srl]->title;
if ($packages[$v->package_srl]) {
$v->current_version = $packages[$v->package_srl]->current_version;
$v->need_update = $packages[$v->package_srl]->need_update;
$v->type = $oModel->getTypeFromPath($packages[$v->package_srl]->path);
if ($this->ftp_set && $v->depfrom) {
$depfrom = explode(",", $v->depfrom);
foreach ($depfrom as $package_srl) {
$depto[$package_srl][] = $v->package_srl;
}
}
if ($v->type == "core") {
$v->avail_remove = false;
} else {
if ($v->type == "module") {
$v->avail_remove = $oModel->checkRemovable($packages[$v->package_srl]->path);
} else {
$v->avail_remove = true;
}
}
}
$item_list[$v->package_srl] = $v;
}
if (count($depto) > 0) {
$installed = $oModel->getInstalledPackages(implode(",", array_keys($depto)));
foreach ($installed as $key => $val) {
$path = $val->path;
$type = $oModel->getTypeFromPath($path);
if (!$type || $type == "core") {
continue;
}
$config_file = $oModel->getConfigFilePath($type);
if (!$config_file) {
continue;
}
$xml = new XmlParser();
$xmlDoc = $xml->loadXmlFile(FileHandler::getRealPath($path) . $config_file);
if (!$xmlDoc) {
continue;
}
if ($type == "drcomponent") {
$type = "component";
}
if ($type == "style" || $type == "m.skin") {
$type = "skin";
}
if ($type == "m.layout") {
$type = "layout";
}
$title = $xmlDoc->{$type}->title->body;
$installed[$key]->title = $title;
}
Context::set('installed', $installed);
foreach ($installed as $key => $val) {
foreach ($depto[$key] as $package_srl) {
$item_list[$package_srl]->avail_remove = false;
$item_list[$package_srl]->deps[] = $key;
}
}
}
return $item_list;
}
示例5: load
/**
* Load a xml file
* @param string $xml_path A file name to be loaded
* @return boolean
*/
function load($xml_path)
{
$this->_xml_ruleset = null;
$xml_path = realpath($xml_path);
if (!is_readable($xml_path)) {
return false;
}
$parser = new XmlParser();
$xml = $parser->loadXmlFile($xml_path);
if (!isset($xml->ruleset) || !isset($xml->ruleset->fields) || !isset($xml->ruleset->fields->field)) {
return false;
}
// custom rules
if (isset($xml->ruleset->customrules) && isset($xml->ruleset->customrules->rule)) {
$customrules = $xml->ruleset->customrules->rule;
if (!is_array($customrules)) {
$customrules = array($customrules);
}
$rules = array();
foreach ($customrules as $rule) {
if (!isset($rule->attrs) || !isset($rule->attrs->name)) {
continue;
}
$rule = (array) $rule->attrs;
$name = $rule['name'];
unset($rule['name']);
$rules[$name] = $rule;
}
if (count($rules)) {
$this->addRule($rules);
}
}
// filters
$fields = $xml->ruleset->fields->field;
if (!is_array($fields)) {
$fields = array($fields);
}
$filters = array();
foreach ($fields as $field) {
$name = '';
$filter = array();
if (!isset($field->attrs) || !isset($field->attrs->name)) {
continue;
}
$filter = (array) $field->attrs;
$name = $filter['name'];
unset($filter['name']);
// conditional statement
if (isset($field->if)) {
$if = $field->if;
if (!is_array($if)) {
$if = array($if);
}
foreach ($if as $idx => $cond) {
$if[$idx] = (array) $cond->attrs;
}
$filter['if'] = $if;
}
$filters[$name] = $filter;
}
$this->_xml_ruleset = $xml->ruleset;
$this->_filters = $filters;
$this->_xml_path = $xml_path;
return true;
}
示例6: getPluginInfoXml
/**
* @brief parse xml, retrieve plugin info.
* (this function will be removed in the future)
**/
function getPluginInfoXml($plugin, $vars = array())
{
$plugin_path = _XE_PATH_ . "modules/epay/plugins/" . $plugin;
$xml_file = sprintf(_XE_PATH_ . "modules/epay/plugins/%s/info.xml", $plugin);
if (!file_exists($xml_file)) {
return;
}
$oXmlParser = new XmlParser();
$tmp_xml_obj = $oXmlParser->loadXmlFile($xml_file);
$xml_obj = $tmp_xml_obj->plugin;
$cache_file = sprintf(_XE_PATH_ . "files/cache/epay/%s.%s.%s.php", $plugin, Context::getLangType(), __XE_VERSION__);
if (!$xml_obj) {
return;
}
$plugin_info = new stdClass();
$plugin_info->title = $xml_obj->title->body;
$plugin_info->description = $xml_obj->description->body;
$plugin_info->version = $xml_obj->version->body;
sscanf($xml_obj->date->body, '%d-%d-%d', $date_obj->y, $date_obj->m, $date_obj->d);
$plugin_info->date = sprintf('%04d%02d%02d', $date_obj->y, $date_obj->m, $date_obj->d);
$plugin_info->license = $xml_obj->license->body;
$plugin_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) {
if (!$author_obj) {
$author_obj = new stdClass();
}
$author_obj->name = $author->name->body;
$author_obj->email_address = $author->attrs->email_address;
$author_obj->homepage = $author->attrs->link;
$plugin_info->author[] = $author_obj;
}
$buff = array();
$buff[] = '<?php if(!defined("__XE__")) exit();';
$buff[] = sprintf('$plugin_info->site_srl = "%s";', $site_srl);
// 추가 변수 (템플릿에서 사용할 제작자 정의 변수)
$extra_var_groups = $xml_obj->extra_vars->group;
if (!$extra_var_groups) {
$extra_var_groups = $xml_obj->extra_vars;
}
if (!is_array($extra_var_groups)) {
$extra_var_groups = array($extra_var_groups);
}
$buff[] = '$plugin_info->extra_var = new stdClass();';
foreach ($extra_var_groups as $group) {
$extra_vars = $group->var;
if ($extra_vars) {
if (!is_array($extra_vars)) {
$extra_vars = array($extra_vars);
}
$extra_var_count = count($extra_vars);
$buff[] = sprintf('$plugin_info->extra_var_count = \'%s\';', $extra_var_count);
for ($i = 0; $i < $extra_var_count; $i++) {
unset($var);
unset($options);
$var = $extra_vars[$i];
$name = $var->attrs->name;
$buff[] = sprintf('$plugin_info->extra_var->%s = new stdClass();', $name);
$buff[] = sprintf('$plugin_info->extra_var->%s->group = \'%s\';', $name, $group->title->body);
$buff[] = sprintf('$plugin_info->extra_var->%s->title = \'%s\';', $name, $var->title->body);
$buff[] = sprintf('$plugin_info->extra_var->%s->type = \'%s\';', $name, $var->attrs->type);
$buff[] = sprintf('$plugin_info->extra_var->%s->default = \'%s\';', $name, $var->attrs->default);
if ($var->attrs->type == 'image' && $var->attrs->location) {
$buff[] = sprintf('$plugin_info->extra_var->%s->location = \'%s\';', $name, $var->attrs->location);
}
$buff[] = sprintf('$plugin_info->extra_var->%s->value = $vars->%s;', $name, $name);
$buff[] = sprintf('$plugin_info->extra_var->%s->description = \'%s\';', $name, str_replace('\'', '\'', $var->description->body));
$options = $var->options;
if (!$options) {
continue;
}
if (!is_array($options)) {
$options = array($options);
}
$options_count = count($options);
$thumbnail_exist = false;
for ($j = 0; $j < $options_count; $j++) {
$thumbnail = $options[$j]->attrs->src;
if ($thumbnail) {
$thumbnail = $plugin_path . $thumbnail;
if (file_exists($thumbnail)) {
$buff[] = sprintf('$plugin_info->extra_var->%s->options[\'%s\'] = new stdClass();', $var->attrs->name, $options[$j]->attrs->value);
$buff[] = sprintf('$plugin_info->extra_var->%s->options[\'%s\']->thumbnail = \'%s\';', $var->attrs->name, $options[$j]->attrs->value, $thumbnail);
if (!$thumbnail_exist) {
$buff[] = sprintf('$plugin_info->extra_var->%s->thumbnail_exist = true;', $var->attrs->name);
$thumbnail_exist = true;
}
}
}
$buff[] = sprintf('$plugin_info->extra_var->%s->options[\'%s\'] = new stdClass();', $var->attrs->name, $options[$j]->attrs->value);
$buff[] = sprintf('$plugin_info->extra_var->%s->options[\'%s\']->val = \'%s\';', $var->attrs->name, $options[$j]->attrs->value, $options[$j]->title->body);
}
//.........这里部分代码省略.........
示例7: getLayoutInfo
/**
* Get information by reading conf/info.xml in the module
* It uses caching to reduce time for xml parsing ..
* @param string $layout
* @param object $info
* @param string $layoutType (P : PC, M : Mobile)
* @return object info of layout
*/
function getLayoutInfo($layout, $info = null, $layout_type = "P")
{
if ($info) {
$layout_title = $info->title;
$layout = $info->layout;
$layout_srl = $info->layout_srl;
$site_srl = $info->site_srl;
$vars = unserialize($info->extra_vars);
if ($info->module_srl) {
$layout_path = preg_replace('/([a-zA-Z0-9\\_\\.]+)(\\.html)$/', '', $info->layout_path);
$xml_file = sprintf('%sskin.xml', $layout_path);
}
}
// Get a path of the requested module. Return if not exists.
if (!$layout_path) {
$layout_path = $this->getLayoutPath($layout, $layout_type);
}
if (!is_dir($layout_path)) {
return;
}
// Read the xml file for module skin information
if (!$xml_file) {
$xml_file = sprintf("%sconf/info.xml", $layout_path);
}
if (!file_exists($xml_file)) {
$layout_info = new stdClass();
$layout_info->title = $layout;
$layout_info->layout = $layout;
$layout_info->path = $layout_path;
$layout_info->layout_title = $layout_title;
if (!$layout_info->layout_type) {
$layout_info->layout_type = $layout_type;
}
return $layout_info;
}
// Include the cache file if it is valid and then return $layout_info variable
if (!$layout_srl) {
$cache_file = $this->getLayoutCache($layout, Context::getLangType(), $layout_type);
} else {
$cache_file = $this->getUserLayoutCache($layout_srl, Context::getLangType());
}
if (file_exists($cache_file) && filemtime($cache_file) > filemtime($xml_file)) {
include $cache_file;
if ($layout_info->extra_var && $vars) {
foreach ($vars as $key => $value) {
if (!$layout_info->extra_var->{$key} && !$layout_info->{$key}) {
$layout_info->{$key} = $value;
}
}
}
if (!$layout_info->title) {
$layout_info->title = $layout;
}
return $layout_info;
}
// If no cache file exists, parse the xml and then return the variable.
$oXmlParser = new XmlParser();
$tmp_xml_obj = $oXmlParser->loadXmlFile($xml_file);
if ($tmp_xml_obj->layout) {
$xml_obj = $tmp_xml_obj->layout;
} elseif ($tmp_xml_obj->skin) {
$xml_obj = $tmp_xml_obj->skin;
}
if (!$xml_obj) {
return;
}
$buff = array();
$buff[] = '$layout_info = new stdClass;';
$buff[] = sprintf('$layout_info->site_srl = "%s";', $site_srl);
if ($xml_obj->version && $xml_obj->attrs->version == '0.2') {
// Layout title, version and other information
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->type = "%s";', $xml_obj->attrs->type);
$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->homepage = "%s";', $xml_obj->link->body);
$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->layout_type = "%s";', $layout_type);
// Author information
if (!is_array($xml_obj->author)) {
$author_list[] = $xml_obj->author;
} else {
$author_list = $xml_obj->author;
}
//.........这里部分代码省略.........
示例8: getWidgetStyleInfo
/**
* @brief 모듈의 conf/info.xml 을 읽어서 정보를 구함
* 이것 역시 캐싱을 통해서 xml parsing 시간을 줄인다..
**/
function getWidgetStyleInfo($widgetStyle)
{
$widgetStyle_path = $this->getWidgetStylePath($widgetStyle);
if (!$widgetStyle_path) {
return;
}
$xml_file = sprintf("%sskin.xml", $widgetStyle_path);
if (!file_exists($xml_file)) {
return;
}
// cache 파일을 비교하여 문제 없으면 include하고 $widgetStyle_info 변수를 return
$cache_file = sprintf('./files/cache/widgetstyles/%s.%s.cache.php', $widgetStyle, Context::getLangType());
if (file_exists($cache_file) && filemtime($cache_file) > filemtime($xml_file)) {
@(include $cache_file);
return $widgetStyle_info;
}
// cache 파일이 없으면 xml parsing하고 변수화 한 후에 캐시 파일에 쓰고 변수 바로 return
$oXmlParser = new XmlParser();
$tmp_xml_obj = $oXmlParser->loadXmlFile($xml_file);
$xml_obj = $tmp_xml_obj->widgetstyle;
if (!$xml_obj) {
return;
}
$buff = '';
// 위젯의 제목, 버전
$buff .= sprintf('$widgetStyle_info->widgetStyle = "%s";', $widgetStyle);
$buff .= sprintf('$widgetStyle_info->path = "%s";', $widgetStyle_path);
$buff .= sprintf('$widgetStyle_info->title = "%s";', $xml_obj->title->body);
$buff .= sprintf('$widgetStyle_info->description = "%s";', $xml_obj->description->body);
$buff .= sprintf('$widgetStyle_info->version = "%s";', $xml_obj->version->body);
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('$widgetStyle_info->date = "%s";', $date);
$buff .= sprintf('$widgetStyle_info->homepage = "%s";', $xml_obj->link->body);
$buff .= sprintf('$widgetStyle_info->license = "%s";', $xml_obj->license->body);
$buff .= sprintf('$widgetStyle_info->license_link = "%s";', $xml_obj->license->attrs->link);
// preview
if (!$xml_obj->preview->body) {
$xml_obj->preview->body = 'preview.jpg';
}
$preview_file = sprintf("%s%s", $widgetStyle_path, $xml_obj->preview->body);
if (file_exists($preview_file)) {
$buff .= sprintf('$widgetStyle_info->preview = "%s";', $preview_file);
}
// 작성자 정보
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('$widgetStyle_info->author[' . $i . ']->name = "%s";', $author_list[$i]->name->body);
$buff .= sprintf('$widgetStyle_info->author[' . $i . ']->email_address = "%s";', $author_list[$i]->attrs->email_address);
$buff .= sprintf('$widgetStyle_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('$widgetStyle_info->history[' . $i . ']->description = "%s";', $history_list[$i]->description->body);
$buff .= sprintf('$widgetStyle_info->history[' . $i . ']->version = "%s";', $history_list[$i]->attrs->version);
$buff .= sprintf('$widgetStyle_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('$widgetStyle_info->history[' . $i . ']->author[' . $j . ']->name = "%s";', $obj->author_list[$j]->name->body);
$buff .= sprintf('$widgetStyle_info->history[' . $i . ']->author[' . $j . ']->email_address = "%s";', $obj->author_list[$j]->attrs->email_address);
$buff .= sprintf('$widgetStyle_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('$widgetStyle_info->history[' . $i . ']->logs[' . $j . ']->text = "%s";', $obj->log_list[$j]->body);
$buff .= sprintf('$widgetStyle_info->history[' . $i . ']->logs[' . $j . ']->link = "%s";', $obj->log_list[$j]->attrs->link);
}
}
}
}
// 추가 변수 (템플릿에서 사용할 제작자 정의 변수)
$extra_var_groups = $xml_obj->extra_vars->group;
if (!$extra_var_groups) {
$extra_var_groups = $xml_obj->extra_vars;
}
if (!is_array($extra_var_groups)) {
$extra_var_groups = array($extra_var_groups);
}
foreach ($extra_var_groups as $group) {
$extra_vars = $group->var;
if (!is_array($group->var)) {
//.........这里部分代码省略.........
示例9: importModule
/**
* Import data in module.xml format
* @param int $key
* @param int $cur
* @param string $index_file
* @param int $module_srl
* @return int
*/
function importModule($key, $cur, $index_file, $module_srl)
{
// Pre-create the objects needed
$this->oXmlParser = new XmlParser();
// Get category information of the target module
$oDocumentController = getController('document');
$oDocumentModel = getModel('document');
$category_list = $category_titles = array();
$category_list = $oDocumentModel->getCategoryList($module_srl);
if (count($category_list)) {
foreach ($category_list as $key => $val) {
$category_titles[$val->title] = $val->category_srl;
}
}
// Extract category information
$category_file = preg_replace('/index$/i', 'category.xml', $index_file);
if (file_exists($category_file)) {
$buff = FileHandler::readFile($category_file);
// Create the xmlParser object
$xmlDoc = $this->oXmlParser->loadXmlFile($category_file);
$categories = $xmlDoc->items->category;
if ($categories) {
if (!is_array($categories)) {
$categories = array($categories);
}
$match_sequence = array();
foreach ($categories as $k => $v) {
$category = trim(base64_decode($v->body));
if (!$category || $category_titles[$category]) {
continue;
}
$sequence = $v->attrs->sequence;
$parent = $v->attrs->parent;
$obj = null;
$obj->title = $category;
$obj->module_srl = $module_srl;
if ($parent) {
$obj->parent_srl = $match_sequence[$parent];
}
$output = $oDocumentController->insertCategory($obj);
if ($output->toBool()) {
$match_sequence[$sequence] = $output->get('category_srl');
}
}
$oDocumentController = getController('document');
$oDocumentController->makeCategoryFile($module_srl);
}
FileHandler::removeFile($category_file);
}
$category_list = $category_titles = array();
$category_list = $oDocumentModel->getCategoryList($module_srl);
if (count($category_list)) {
foreach ($category_list as $key => $val) {
$category_titles[$val->title] = $val->category_srl;
}
}
$ek_args->module_srl = $module_srl;
$output = executeQueryArray('document.getDocumentExtraKeys', $ek_args);
if ($output->data) {
foreach ($output->data as $key => $val) {
$extra_keys[$val->eid] = true;
}
}
if (!$cur) {
$cur = 0;
}
// Open an index file
$f = fopen($index_file, "r");
// Pass if already read
for ($i = 0; $i < $cur; $i++) {
fgets($f, 1024);
}
// Read each line until the condition meets
for ($idx = $cur; $idx < $cur + $this->unit_count; $idx++) {
if (feof($f)) {
break;
}
// Find a location
$target_file = trim(fgets($f, 1024));
if (!file_exists($target_file)) {
continue;
}
// Importing data from now on
$fp = fopen($target_file, "r");
if (!$fp) {
continue;
}
$obj = new stdClass();
$obj->module_srl = $module_srl;
$obj->document_srl = getNextSequence();
$files = array();
$extra_vars = array();
//.........这里部分代码省略.........
示例10: importModule
/**
* Import data in module.xml format
* @param int $key
* @param int $cur
* @param string $index_file
* @param int $unit_count
* @param int $module_srl
* @param int $guestbook_module_srl
* @param string $user_id
* @param string $module_name
* @return int
*/
function importModule($key, $cur, $index_file, $unit_count, $module_srl, $guestbook_module_srl, $user_id, $module_name = null)
{
// Pre-create the objects needed
$this->oXmlParser = new XmlParser();
// Get category information of the target module
$oDocumentController = getController('document');
$oDocumentModel = getModel('document');
$category_list = $category_titles = array();
$category_list = $oDocumentModel->getCategoryList($module_srl);
if (count($category_list)) {
foreach ($category_list as $key => $val) {
$category_titles[$val->title] = $val->category_srl;
}
}
// First handle categorty information
$category_file = preg_replace('/index$/i', 'category.xml', $index_file);
if (file_exists($category_file)) {
// Create the xmlParser object
$xmlDoc = $this->oXmlParser->loadXmlFile($category_file);
// List category information
if ($xmlDoc->categories->category) {
$categories = array();
$idx = 0;
$this->arrangeCategory($xmlDoc->categories, $categories, $idx, 0);
$match_sequence = array();
foreach ($categories as $k => $v) {
$category = $v->name;
if (!$category || $category_titles[$category]) {
continue;
}
$obj = null;
$obj->title = $category;
$obj->module_srl = $module_srl;
if ($v->parent) {
$obj->parent_srl = $match_sequence[$v->parent];
}
$output = $oDocumentController->insertCategory($obj);
if ($output->toBool()) {
$match_sequence[$v->sequence] = $category_titles[$category] = $output->get('category_srl');
}
}
$oDocumentController->makeCategoryFile($module_srl);
}
FileHandler::removeFile($category_file);
}
$category_list = $category_titles = array();
$category_list = $oDocumentModel->getCategoryList($module_srl);
if (count($category_list)) {
foreach ($category_list as $key => $val) {
$category_titles[$val->title] = $val->category_srl;
}
}
// Get administrator information
$oMemberModel = getModel('member');
$member_info = $oMemberModel->getMemberInfoByUserID($user_id);
$author_xml_id = 0;
if (!$cur) {
$cur = 0;
}
// Open an index file
$f = fopen($index_file, "r");
// Pass if already read
for ($i = 0; $i < $cur; $i++) {
fgets($f, 1024);
}
// Read each line until the codition meets
for ($idx = $cur; $idx < $cur + $unit_count; $idx++) {
if (feof($f)) {
break;
}
// Find a location
$target_file = trim(fgets($f, 1024));
if (!file_exists($target_file)) {
continue;
}
// Start importing data
$fp = fopen($target_file, "r");
if (!$fp) {
continue;
}
$obj = null;
$obj->module_srl = $module_srl;
$obj->document_srl = getNextSequence();
$obj->uploaded_count = 0;
$files = array();
$started = false;
$buff = null;
// Start importing from the body data
//.........这里部分代码省略.........
示例11: checkInstalled
/**
* Update installed package information
*
* @return void
*/
function checkInstalled()
{
executeQuery("autoinstall.deleteInstalledPackage");
$oModel = getModel('autoinstall');
$packages = $oModel->getPackages();
foreach ($packages as $package) {
$real_path = FileHandler::getRealPath($package->path);
if (!file_exists($real_path)) {
continue;
}
$type = $oModel->getTypeFromPath($package->path);
if ($type == "core") {
$version = __XE_VERSION__;
} else {
$config_file = NULL;
switch ($type) {
case "m.layout":
$type = "layout";
case "module":
case "addon":
case "layout":
case "widget":
$config_file = "/conf/info.xml";
break;
case "component":
$config_file = "/info.xml";
break;
case "style":
case "m.skin":
$type = "skin";
case "skin":
case "widgetstyle":
$config_file = "/skin.xml";
break;
case "drcomponent":
$config_file = "/info.xml";
$type = "component";
break;
case "theme":
$config_file = "/conf/info.xml";
$type = "theme";
break;
}
if (!$config_file) {
continue;
}
$xml = new XmlParser();
$xmlDoc = $xml->loadXmlFile($real_path . $config_file);
if (!$xmlDoc) {
continue;
}
$version = $xmlDoc->{$type}->version->body;
}
$args = new stdClass();
$args->package_srl = $package->package_srl;
$args->version = $package->version;
$args->current_version = $version;
if (version_compare($args->version, $args->current_version, ">")) {
$args->need_update = "Y";
} else {
$args->need_update = "N";
}
$output = executeQuery("autoinstall.insertInstalledPackage", $args);
}
}
示例12: getPluginInfoXml
function getPluginInfoXml($plugin_name, $extra_vals)
{
$plugin_path = $this->module_path . 'plugins/' . $plugin_name;
$xml_file = $plugin_path . '/plugin.xml';
if (!file_exists($xml_file)) {
return new stdClass();
}
$oXmlParser = new XmlParser();
$xml_obj = $oXmlParser->loadXmlFile($xml_file);
if ($xml_obj->plugin) {
$xml_obj = $xml_obj->plugin;
} else {
return new stdClass();
}
if (!is_array($extra_vals)) {
$extra_vals = array($extra_vals);
}
$plugin_info = new stdClass();
$plugin_info->title = $xml_obj->title->body;
if ($xml_obj->version && $xml_obj->attrs->version == '1.0') {
sscanf($xml_obj->date->body, '%d-%d-%d', $date_obj->y, $date_obj->m, $date_obj->d);
$plugin_info->version = $xml_obj->version->body;
$plugin_info->date = sprintf('%04d%02d%02d', $date_obj->y, $date_obj->m, $date_obj->d);
$plugin_info->homepage = $xml_obj->link->body;
$plugin_info->license = $xml_obj->license->body;
$plugin_info->license_link = $xml_obj->license->attrs->link;
$plugin_info->description = $xml_obj->description->body;
if (is_array($xml_obj->author)) {
$author_list = $xml_obj->author;
} else {
$author_list[] = $xml_obj->author;
}
foreach ($author_list as $author) {
$author_obj = new stdClass();
$author_obj->name = $author->name->body;
$author_obj->email_address = $author->attrs->email_address;
$author_obj->homepage = $author->attrs->link;
$plugin_info->author[] = $author_obj;
}
if ($xml_obj->extra_vars) {
$extra_var_groups = $xml_obj->extra_vars->group;
if (!$extra_var_groups) {
$extra_var_groups = $xml_obj->extra_vars;
}
if (!is_array($extra_var_groups)) {
$extra_var_groups = array($extra_var_groups);
}
foreach ($extra_var_groups as $group) {
$extra_vars = $group->var;
if (!$extra_vars) {
continue;
}
if (!is_array($extra_vars)) {
$extra_vars = array($extra_vars);
}
foreach ($extra_vars as $key => $val) {
$obj = new stdClass();
if (!$val->attrs->type) {
$val->attrs->type = 'text';
}
$obj->group = $group->title->body;
$obj->name = $val->attrs->name;
$obj->title = $val->title->body;
$obj->type = $val->attrs->type;
$obj->description = $val->description->body;
$obj->default = $val->attrs->default;
if ($obj->name) {
$obj->value = $extra_vals[$obj->name]->value;
}
if (strpos($obj->value, '|@|') != FALSE) {
$obj->value = explode('|@|', $obj->value);
}
if (is_array($val->options)) {
$options_length = count($val->options);
for ($i = 0; $i < $options_length; $i++) {
$obj->options[$i] = new stdClass();
$obj->options[$i]->title = $val->options[$i]->title->body;
$obj->options[$i]->value = $val->options[$i]->attrs->value;
}
} else {
$obj->options[0] = new stdClass();
$obj->options[0]->title = $val->options->title->body;
$obj->options[0]->value = $val->options->attrs->value;
}
$plugin_info->extra_vars[] = $obj;
}
}
}
}
$colorset = $xml_obj->colorset->color;
if ($colorset) {
if (!is_array($colorset)) {
$colorset = array($colorset);
}
foreach ($colorset as $color) {
$name = $color->attrs->name;
$title = $color->title->body;
$screenshot = $color->attrs->src;
if ($screenshot) {
$screenshot = $plugin_path . '/' . $screenshot;
//.........这里部分代码省略.........
示例13: getComponentXmlInfo
/**
* @brief Read xml information of the component
**/
function getComponentXmlInfo($component)
{
$lang_type = Context::getLangType();
// Get xml file path of the requested components
$component_path = sprintf('%s/components/%s/', $this->module_path, $component);
$xml_file = sprintf('%sinfo.xml', $component_path);
$cache_file = sprintf('./files/cache/editor/%s.%s.php', $component, $lang_type);
// Include and return xml file information if cached file exists
if (file_exists($cache_file) && file_exists($xml_file) && filemtime($cache_file) > filemtime($xml_file)) {
include $cache_file;
return $xml_info;
}
// Parse, cache and then return if the cached file doesn't exist
$oParser = new XmlParser();
$xml_doc = $oParser->loadXmlFile($xml_file);
// Component information listed
if ($xml_doc->component->version && $xml_doc->component->attrs->version == '0.2') {
$component_info->component_name = $component;
$component_info->title = $xml_doc->component->title->body;
$component_info->description = str_replace('\\n', "\n", $xml_doc->component->description->body);
$component_info->version = $xml_doc->component->version->body;
$component_info->date = $xml_doc->component->date->body;
$component_info->homepage = $xml_doc->component->link->body;
$component_info->license = $xml_doc->component->license->body;
$component_info->license_link = $xml_doc->component->license->attrs->link;
$buff = '<?php if(!defined("__ZBXE__")) exit(); ';
$buff .= sprintf('$xml_info->component_name = "%s";', $component_info->component_name);
$buff .= sprintf('$xml_info->title = "%s";', $component_info->title);
$buff .= sprintf('$xml_info->description = "%s";', $component_info->description);
$buff .= sprintf('$xml_info->version = "%s";', $component_info->version);
$buff .= sprintf('$xml_info->date = "%s";', $component_info->date);
$buff .= sprintf('$xml_info->homepage = "%s";', $component_info->homepage);
$buff .= sprintf('$xml_info->license = "%s";', $component_info->license);
$buff .= sprintf('$xml_info->license_link = "%s";', $component_info->license_link);
// Author information
if (!is_array($xml_doc->component->author)) {
$author_list[] = $xml_doc->component->author;
} else {
$author_list = $xml_doc->component->author;
}
for ($i = 0; $i < count($author_list); $i++) {
$buff .= sprintf('$xml_info->author[' . $i . ']->name = "%s";', $author_list[$i]->name->body);
$buff .= sprintf('$xml_info->author[' . $i . ']->email_address = "%s";', $author_list[$i]->attrs->email_address);
$buff .= sprintf('$xml_info->author[' . $i . ']->homepage = "%s";', $author_list[$i]->attrs->link);
}
// history
if ($xml_doc->component->history) {
if (!is_array($xml_doc->component->history)) {
$history_list[] = $xml_doc->component->history;
} else {
$history_list = $xml_doc->component->history;
}
for ($i = 0; $i < count($history_list); $i++) {
unset($obj);
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('$xml_info->history[' . $i . ']->description = "%s";', $history_list[$i]->description->body);
$buff .= sprintf('$xml_info->history[' . $i . ']->version = "%s";', $history_list[$i]->attrs->version);
$buff .= sprintf('$xml_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('$xml_info->history[' . $i . ']->author[' . $j . ']->name = "%s";', $obj->author_list[$j]->name->body);
$buff .= sprintf('$xml_info->history[' . $i . ']->author[' . $j . ']->email_address = "%s";', $obj->author_list[$j]->attrs->email_address);
$buff .= sprintf('$xml_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('$xml_info->history[' . $i . ']->logs[' . $j . ']->text = "%s";', $obj->log_list[$j]->body);
$buff .= sprintf('$xml_info->history[' . $i . ']->logs[' . $j . ']->link = "%s";', $obj->log_list[$j]->attrs->link);
}
}
}
}
} else {
sscanf($xml_doc->component->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);
$xml_info->component_name = $component;
$xml_info->title = $xml_doc->component->title->body;
$xml_info->description = str_replace('\\n', "\n", $xml_doc->component->author->description->body);
$xml_info->version = $xml_doc->component->attrs->version;
$xml_info->date = $date;
$xml_info->author->name = $xml_doc->component->author->name->body;
$xml_info->author->email_address = $xml_doc->component->author->attrs->email_address;
$xml_info->author->homepage = $xml_doc->component->author->attrs->link;
$buff = '<?php if(!defined("__ZBXE__")) exit(); ';
$buff .= sprintf('$xml_info->component_name = "%s";', $xml_info->component_name);
$buff .= sprintf('$xml_info->title = "%s";', $xml_info->title);
$buff .= sprintf('$xml_info->description = "%s";', $xml_info->description);
$buff .= sprintf('$xml_info->version = "%s";', $xml_info->version);
$buff .= sprintf('$xml_info->date = "%s";', $xml_info->date);
$buff .= sprintf('$xml_info->author[0]->name = "%s";', $xml_info->author->name);
$buff .= sprintf('$xml_info->author[0]->email_address = "%s";', $xml_info->author->email_address);
$buff .= sprintf('$xml_info->author[0]->homepage = "%s";', $xml_info->author->homepage);
}
//.........这里部分代码省略.........
示例14: getLayoutInfo
/**
* @brief 모듈의 conf/info.xml 을 읽어서 정보를 구함
* 이것 역시 캐싱을 통해서 xml parsing 시간을 줄인다..
**/
function getLayoutInfo($layout, $info = null)
{
if ($info) {
$layout_title = $info->title;
$layout = $info->layout;
$layout_srl = $info->layout_srl;
$site_srl = $info->site_srl;
$vars = unserialize($info->extra_vars);
if ($info->module_srl) {
$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);
}
if (!is_dir($layout_path)) {
return;
}
// 현재 선택된 모듈의 스킨의 정보 xml 파일을 읽음
if (!$xml_file) {
$xml_file = sprintf("%sconf/info.xml", $layout_path);
}
if (!file_exists($xml_file)) {
$layout_info->layout = $layout;
$layout_info->path = $layout_path;
$layout_info->layout_title = $layout_title;
return $layout_info;
}
// cache 파일을 비교하여 문제 없으면 include하고 $layout_info 변수를 return
if (!$layout_srl) {
$cache_file = $this->getLayoutCache($layout, Context::getLangType());
} else {
$cache_file = $this->getUserLayoutCache($layout_srl, Context::getLangType());
}
if (file_exists($cache_file) && filemtime($cache_file) > filemtime($xml_file)) {
@(include $cache_file);
if ($layout_info->extra_var && $vars) {
foreach ($vars as $key => $value) {
if (!$layout_info->extra_var->{$key} && !$layout_info->{$key}) {
$layout_info->{$key} = $value;
}
}
}
return $layout_info;
}
// cache 파일이 없으면 xml parsing하고 변수화 한 후에 캐시 파일에 쓰고 변수 바로 return
$oXmlParser = new XmlParser();
$tmp_xml_obj = $oXmlParser->loadXmlFile($xml_file);
if ($tmp_xml_obj->layout) {
$xml_obj = $tmp_xml_obj->layout;
} elseif ($tmp_xml_obj->skin) {
$xml_obj = $tmp_xml_obj->skin;
}
if (!$xml_obj) {
return;
}
$buff = '';
$buff .= sprintf('$layout_info->site_srl = "%s";', $site_srl);
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->type = "%s";', $xml_obj->attrs->type);
$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->homepage = "%s";', $xml_obj->link->body);
$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);
// 작성자 정보
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);
}
// 추가 변수 (템플릿에서 사용할 제작자 정의 변수)
$extra_var_groups = $xml_obj->extra_vars->group;
if (!$extra_var_groups) {
$extra_var_groups = $xml_obj->extra_vars;
}
if (!is_array($extra_var_groups)) {
$extra_var_groups = array($extra_var_groups);
}
foreach ($extra_var_groups as $group) {
//.........这里部分代码省略.........
示例15: loadSkinInfo
/**
* @brief Get skin information on a specific location
*/
function loadSkinInfo($path, $skin, $dir = 'skins')
{
// Read xml file having skin information
if (substr($path, -1) != '/') {
$path .= '/';
}
$skin_xml_file = sprintf("%s%s/%s/skin.xml", $path, $dir, $skin);
if (!file_exists($skin_xml_file)) {
return;
}
// Create XmlParser object
$oXmlParser = new XmlParser();
$_xml_obj = $oXmlParser->loadXmlFile($skin_xml_file);
// Return if no skin information is
if (!$_xml_obj->skin) {
return;
}
$xml_obj = $_xml_obj->skin;
// Skin Name
$skin_info = new stdClass();
$skin_info->title = $xml_obj->title->body;
// Author information
if ($xml_obj->version && $xml_obj->attrs->version == '0.2') {
// skin format v0.2
sscanf($xml_obj->date->body, '%d-%d-%d', $date_obj->y, $date_obj->m, $date_obj->d);
$skin_info->version = $xml_obj->version->body;
$skin_info->date = sprintf('%04d%02d%02d', $date_obj->y, $date_obj->m, $date_obj->d);
$skin_info->homepage = $xml_obj->link->body;
$skin_info->license = $xml_obj->license->body;
$skin_info->license_link = $xml_obj->license->attrs->link;
$skin_info->description = $xml_obj->description->body;
if (!is_array($xml_obj->author)) {
$author_list[] = $xml_obj->author;
} else {
$author_list = $xml_obj->author;
}
foreach ($author_list as $author) {
$author_obj = new stdClass();
$author_obj->name = $author->name->body;
$author_obj->email_address = $author->attrs->email_address;
$author_obj->homepage = $author->attrs->link;
$skin_info->author[] = $author_obj;
}
// List extra vars
if ($xml_obj->extra_vars) {
$extra_var_groups = $xml_obj->extra_vars->group;
if (!$extra_var_groups) {
$extra_var_groups = $xml_obj->extra_vars;
}
if (!is_array($extra_var_groups)) {
$extra_var_groups = array($extra_var_groups);
}
foreach ($extra_var_groups as $group) {
$extra_vars = $group->var;
if (!$extra_vars) {
continue;
}
if (!is_array($group->var)) {
$extra_vars = array($group->var);
}
foreach ($extra_vars as $key => $val) {
$obj = new stdClass();
if (!$val->attrs->type) {
$val->attrs->type = 'text';
}
$obj->group = $group->title->body;
$obj->name = $val->attrs->name;
$obj->title = $val->title->body;
$obj->type = $val->attrs->type;
$obj->description = $val->description->body;
$obj->value = $extra_vals->{$obj->name};
$obj->default = $val->attrs->default;
if (strpos($obj->value, '|@|') != false) {
$obj->value = explode('|@|', $obj->value);
}
if ($obj->type == 'mid_list' && !is_array($obj->value)) {
$obj->value = array($obj->value);
}
// Get an option list from 'select'type
if (is_array($val->options)) {
$option_count = count($val->options);
for ($i = 0; $i < $option_count; $i++) {
$obj->options[$i] = new stdClass();
$obj->options[$i]->title = $val->options[$i]->title->body;
$obj->options[$i]->value = $val->options[$i]->attrs->value;
}
} else {
$obj->options[0] = new stdClass();
$obj->options[0]->title = $val->options->title->body;
$obj->options[0]->value = $val->options->attrs->value;
}
$skin_info->extra_vars[] = $obj;
}
}
}
} else {
// skin format v0.1
//.........这里部分代码省略.........