本文整理汇总了PHP中classXML::fetchXMLAsArray方法的典型用法代码示例。如果您正苦于以下问题:PHP classXML::fetchXMLAsArray方法的具体用法?PHP classXML::fetchXMLAsArray怎么用?PHP classXML::fetchXMLAsArray使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类classXML
的用法示例。
在下文中一共展示了classXML::fetchXMLAsArray方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: writeDefaults
/**
* Write Default Values
*/
public function writeDefaults()
{
$defaultTemplates = file_get_contents(IPS_ROOT_PATH . 'setup/xml/system_templates.xml');
if (!class_exists('classXML')) {
require_once IPS_KERNEL_PATH . 'classXML.php';
}
$xml = new classXML('utf-8');
$xml->loadXML($defaultTemplates);
$array = $xml->fetchXMLAsArray();
foreach ($array['system_templates']['template'] as $template) {
$params = array();
foreach ($template['params']['param'] as $p) {
$params[] = $p['#alltext'];
}
$this->write($template['key']['#alltext'], $params, $template['content']['#alltext']);
}
}
示例2: applicationsMenuDataRecache
/**
* Recache menu data
*
* @return @e void
*/
public function applicationsMenuDataRecache()
{
$app_menu_cache = array();
$modules_cache = array();
//-----------------------------------------
// Get module data first in one query
//-----------------------------------------
$this->DB->build(array('select' => '*', 'from' => 'core_sys_module', 'where' => 'sys_module_visible=1 AND sys_module_admin=1', 'order' => 'sys_module_position ASC'));
$this->DB->execute();
while ($module = $this->DB->fetch()) {
$modules_cache[$module['sys_module_application']][] = $module['sys_module_key'];
}
//-----------------------------------------
// Now get applications and loop
//-----------------------------------------
$this->DB->build(array('select' => '*', 'from' => 'core_applications', 'order' => 'app_position ASC'));
$outer = $this->DB->execute();
while ($row = $this->DB->fetch($outer)) {
$app_dir = $row['app_directory'];
$main_items = $modules_cache[$app_dir];
//-----------------------------------------
// Continue...
//-----------------------------------------
if (count($main_items)) {
foreach ($main_items as $_current_module) {
$_file = IPSLib::getAppDir($app_dir) . "/modules_admin/" . $_current_module . '/xml/menu.xml';
if (is_file($_file)) {
//-----------------------------------------
// Get xml mah-do-dah
//-----------------------------------------
require_once IPS_KERNEL_PATH . 'classXML.php';
/*noLibHook*/
$xml = new classXML(IPS_DOC_CHAR_SET);
$content = @file_get_contents($_file);
if ($content) {
$xml->loadXML($content);
$menu = $xml->fetchXMLAsArray();
$item = array();
$subItemIndex = 0;
$itemIndex = 0;
/**
* Easiest way I could find to get the data in a proper multi-dimensional array
*/
foreach ($menu as $id => $data) {
foreach ($data as $dataKey => $dataValue) {
if ($dataKey == 'tabitems') {
foreach ($dataValue as $tabitemsKey => $tabItemsValue) {
if ($tabitemsKey == 'item') {
foreach ($tabItemsValue as $itemKey => $itemValue) {
if (is_int($itemKey)) {
foreach ($itemValue as $_itemKey => $_itemValue) {
$subItemIndex = 0;
if ($_itemKey == 'title' or $_itemKey == 'condition') {
$item[$itemIndex][$_itemKey] = $_itemValue['#alltext'];
} else {
if ($_itemKey == 'subitems') {
foreach ($_itemValue as $subitemKey => $subitemValue) {
if ($subitemKey != '#alltext') {
foreach ($subitemValue as $subitemRealKey => $subitemRealValue) {
if (is_int($subitemRealKey)) {
foreach ($subitemRealValue as $_subitemRealKey => $_subitemRealValue) {
if ($_subitemRealKey != '#alltext') {
$item[$itemIndex][$_itemKey][$subitemKey][$subItemIndex][$_subitemRealKey] = $_subitemRealValue['#alltext'];
}
}
} else {
if ($subitemRealKey != '#alltext') {
$item[$itemIndex][$_itemKey][$subitemKey][$subItemIndex][$subitemRealKey] = $subitemRealValue['#alltext'];
}
}
if (is_int($subitemRealKey)) {
$subItemIndex++;
}
}
$subItemIndex++;
}
}
}
}
}
$itemIndex++;
} else {
if ($itemKey == 'title') {
$item[$itemIndex][$itemKey] = $itemValue['#alltext'];
} else {
if ($itemKey == 'subitems') {
foreach ($itemValue as $subitemKey => $subitemValue) {
if ($subitemKey != '#alltext') {
foreach ($subitemValue as $subitemRealKey => $subitemRealValue) {
if (is_int($subitemRealKey)) {
foreach ($subitemRealValue as $_subitemRealKey => $_subitemRealValue) {
if ($_subitemRealKey != '#alltext') {
$item[$itemIndex][$itemKey][$subitemKey][$subItemIndex][$_subitemRealKey] = $_subitemRealValue['#alltext'];
}
}
//.........这里部分代码省略.........