当前位置: 首页>>代码示例>>PHP>>正文


PHP classXML类代码示例

本文整理汇总了PHP中classXML的典型用法代码示例。如果您正苦于以下问题:PHP classXML类的具体用法?PHP classXML怎么用?PHP classXML使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了classXML类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: _importTemplates

 /**
  * Run SQL files
  * 
  * @access	public
  * @param	int
  */
 public function _importTemplates()
 {
     $templates = array();
     $this->DB->build(array('select' => '*', 'from' => 'ccs_template_blocks'));
     $outer = $this->DB->execute();
     while ($r = $this->DB->fetch($outer)) {
         if (!preg_match("/_(\\d+)\$/", $r['tpb_name'])) {
             $templates[$r['tpb_name']] = $r;
         }
     }
     $content = file_get_contents(IPSLib::getAppDir('ccs') . '/xml/block_templates.xml');
     require_once IPS_KERNEL_PATH . 'classXML.php';
     $xml = new classXML(IPS_DOC_CHAR_SET);
     $xml->loadXML($content);
     foreach ($xml->fetchElements('template') as $template) {
         $_template = $xml->fetchElementsFromRecord($template);
         if ($_template['tpb_name']) {
             unset($_template['tpb_id']);
             if (array_key_exists($_template['tpb_name'], $templates)) {
                 $this->DB->update("ccs_template_blocks", $_template, "tpb_id={$templates[$_template['tpb_name']]['tpb_id']}");
             } else {
                 $this->DB->insert("ccs_template_blocks", $_template);
             }
         }
     }
 }
开发者ID:dalandis,项目名称:Visualization-of-Cell-Phone-Locations,代码行数:32,代码来源:version_upgrade.php

示例2: _restoreXmlSkin

 /**
  * Execute selected method
  *
  * @param	object		Registry object
  * @return	@e void
  */
 public function _restoreXmlSkin()
 {
     require_once IPS_KERNEL_PATH . 'classXML.php';
     /*noLibHook*/
     $xml = new classXML(IPSSetUp::charSet);
     /* Skin Set Data */
     $xml->load(IPS_ROOT_PATH . 'setup/xml/skins/setsData.xml');
     foreach ($xml->fetchElements('set') as $xmlelement) {
         $data = $xml->fetchElementsFromRecord($xmlelement);
         if ($data['set_key'] == 'xmlskin') {
             $data['set_order'] = intval($data['set_order']);
             unset($data['set_id']);
             $this->DB->delete('skin_collections', "set_key='xmlskin'");
             $this->DB->insert('skin_collections', $data);
         }
     }
     $this->registry->output->addMessage("XML стиль восстановлен");
     $this->request['workact'] = '';
 }
开发者ID:Advanture,项目名称:Online-RolePlay,代码行数:25,代码来源:version_upgrade.php

示例3: finish

 /**
  * Finish up conversion stuff
  * 
  * @return	@e void
  */
 public function finish()
 {
     $options = IPSSetUp::getSavedData('custom_options');
     $skipPms = $options['core'][30001]['skipPms'];
     $output = array();
     /* Emoticons */
     if (file_exists(DOC_IPS_ROOT_PATH . 'style_emoticons/default')) {
         try {
             foreach (new DirectoryIterator(DOC_IPS_ROOT_PATH . 'style_emoticons/default') as $file) {
                 if (!$file->isDot()) {
                     $_name = $file->getFileName();
                     /* Annoyingly, isDot doesn't match .svn, etc */
                     if (substr($_name, 0, 1) == '.') {
                         continue;
                     }
                     if (@copy(DOC_IPS_ROOT_PATH . 'style_emoticons/default/' . $_name, IPS_PUBLIC_PATH . 'style_emoticons/default/' . $_name)) {
                         $output[] = "Смайлики: скопирован {$_name}...";
                     } else {
                         $output[] = "Не удалось скопировать {$_name} - после обновления перенесите его самостоятельно";
                     }
                 }
             }
         } catch (Exception $e) {
         }
     }
     /* LOG IN METHODS */
     $this->DB->build(array('select' => '*', 'from' => 'login_methods'));
     $this->DB->execute();
     while ($row = $this->DB->fetch()) {
         $loginMethods[$row['login_folder_name']] = $row;
     }
     $count = 6;
     $recount = array('internal' => 1, 'ipconverge' => 2, 'ldap' => 3, 'external' => 4);
     /* Fetch XML */
     require_once IPS_KERNEL_PATH . 'classXML.php';
     /*noLibHook*/
     $xml = new classXML(IPSSetUp::charSet);
     $xml->load(IPS_ROOT_PATH . 'setup/xml/loginauth.xml');
     foreach ($xml->fetchElements('login_methods') as $xmlelement) {
         $data = $xml->fetchElementsFromRecord($xmlelement);
         $data['login_order'] = isset($recount[$data['login_folder_name']]) ? $recount[$data['login_folder_name']] : ++$count;
         unset($data['login_id']);
         if (!$loginMethods[$data['login_folder_name']]) {
             $this->DB->insert('login_methods', $data);
         } else {
             $this->DB->update('login_methods', array('login_order' => $data['login_order']), 'login_folder_name=\'' . $data['login_folder_name'] . '\'');
         }
     }
     /* Reset member languages and skins */
     $this->DB->update('members', array('language' => IPSLib::getDefaultLanguage(), 'skin' => 0));
     /* Empty caches */
     $this->DB->delete('cache_store', "cs_key='forum_cache'");
     $this->DB->delete('cache_store', "cs_key='skin_id_cache'");
     /* Empty other tables */
     $this->DB->delete('skin_cache');
     $this->DB->delete('skin_templates_cache');
     /* Reset admin permissions */
     $this->DB->update('admin_permission_rows', array('row_perm_cache' => ''));
     /* Drop Tables */
     $this->DB->dropTable('contacts');
     $this->DB->dropTable('skin_macro');
     $this->DB->dropTable('skin_template_links');
     $this->DB->dropTable('skin_templates_old');
     $this->DB->dropTable('skin_sets');
     $this->DB->dropTable('languages');
     $this->DB->dropTable('topics_read');
     $this->DB->dropTable('topic_markers');
     $this->DB->dropTable('acp_help');
     $this->DB->dropTable('members_converge');
     $this->DB->dropTable('member_extra');
     $this->DB->dropTable('custom_bbcode_old');
     $this->DB->dropTable('admin_sessions');
     $this->DB->dropTable('components');
     $this->DB->dropTable('admin_permission_keys');
     $this->DB->dropTable('conf_settings');
     $this->DB->dropTable('conf_settings_titles');
     $this->DB->dropTable('reg_antispam');
     if (!$skipPms) {
         $this->DB->dropTable('message_text');
         $this->DB->dropTable('message_topics_old');
     }
     $message = (is_array($output) and count($output)) ? implode("<br />", $output) . '<br />' : '';
     $this->registry->output->addMessage($message . "очистка SQL завершена...");
     /* Last function, so unset workact */
     $this->request['workact'] = '';
 }
开发者ID:Advanture,项目名称:Online-RolePlay,代码行数:91,代码来源:version_upgrade.php

示例4: _mediaTagExport

 /**
  * Export a mediaTag XML file
  *
  * @access	private
  * @return	void		[Outputs to screen]
  */
 private function _mediaTagExport()
 {
     //-----------------------------------------
     // Get xml mah-do-dah
     //-----------------------------------------
     require_once IPS_KERNEL_PATH . 'classXML.php';
     $xml = new classXML(IPS_DOC_CHAR_SET);
     $xml->newXMLDocument();
     $xml->addElement('mediatagexport');
     $xml->addElement('mediataggroup', 'mediatagexport');
     $select = array('select' => '*', 'from' => 'bbcode_mediatag');
     if ($this->request['id']) {
         $select['where'] = 'mediatag_id=' . intval($this->request['id']);
     }
     $this->DB->build($select);
     $this->DB->execute();
     while ($r = $this->DB->fetch()) {
         $xml->addElementAsRecord('mediataggroup', 'mediatag', $r);
     }
     $xmlData = $xml->fetchDocument();
     //-----------------------------------------
     // Send to browser.
     //-----------------------------------------
     $this->registry->output->showDownload($xmlData, 'mediatag.xml', '', 0);
 }
开发者ID:dalandis,项目名称:Visualization-of-Cell-Phone-Locations,代码行数:31,代码来源:media.php

示例5: fetchXmlAppModules

 /**
  * Fetch Apps XML Modules File
  *
  * @access	public
  * @param	string		Application Directory
  * @param	string		Charset (post install)
  * @return	array 		..of data
  */
 public static function fetchXmlAppModules($app, $charset = '')
 {
     //-----------------------------------------
     // No modules?
     //-----------------------------------------
     if (!is_file(IPSLib::getAppDir($app) . '/xml/' . $app . '_modules.xml')) {
         return array();
     }
     /* INIT */
     $modules = array();
     try {
         require_once IPS_KERNEL_PATH . 'classXML.php';
         /*noLibHook*/
         $xml = new classXML($charset ? $charset : IPSSetUp::charSet);
         $xml->load(IPSLib::getAppDir($app) . '/xml/' . $app . '_modules.xml');
         /* Fetch info */
         foreach ($xml->fetchElements('module') as $xmlelement) {
             $data = $xml->fetchElementsFromRecord($xmlelement);
             if ($data['sys_module_id']) {
                 unset($data['sys_module_id']);
             }
             /* Remove fields removed from 3.1.3+ to avoid driver errors */
             unset($data['sys_module_parent']);
             unset($data['sys_module_tables']);
             unset($data['sys_module_hooks']);
             $modules[$data['sys_module_key'] . intval($data['sys_module_admin'])] = $data;
         }
         return $modules;
     } catch (Exception $error) {
         return FALSE;
     }
 }
开发者ID:ConnorChristie,项目名称:GrabViews,代码行数:40,代码来源:setup.php

示例6: tasksExportToXML

 /**
  * Export tasks to XML
  *
  * @return	@e void
  */
 public function tasksExportToXML()
 {
     /* INIT */
     $entry = array();
     require_once IPS_KERNEL_PATH . 'classXML.php';
     /*noLibHook*/
     /* Loop through all the applications */
     foreach ($this->registry->getApplications() as $app => $__data) {
         $_c = 0;
         $xml = new classXML(IPS_DOC_CHAR_SET);
         $xml->newXMLDocument();
         $xml->addElement('export');
         $xml->addElement('group', 'export');
         /* Query tasks */
         $this->DB->build(array('select' => '*', 'from' => 'task_manager', 'where' => "task_application='{$app}'"));
         $this->DB->execute();
         /* Loop through and add tasks to XML */
         while ($r = $this->DB->fetch()) {
             $_c++;
             $xml->addElementAsRecord('group', 'row', $r);
         }
         /* Finish XML */
         $doc = $xml->fetchDocument();
         /* Write */
         if ($doc and $_c) {
             file_put_contents(IPSLib::getAppDir($app) . '/xml/' . $app . '_tasks.xml', $doc);
         }
     }
     $this->registry->output->setMessage($this->lang->words['t_exported'], 1);
     $this->taskManagerOverview();
 }
开发者ID:Advanture,项目名称:Online-RolePlay,代码行数:36,代码来源:taskmanager.php

示例7: 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']);
     }
 }
开发者ID:mover5,项目名称:imobackup,代码行数:20,代码来源:systemTemplates.php

示例8: readGlobalConfig

 /**
  * Read conf_global
  *
  * @access	public
  * @return	bool
  */
 public static function readGlobalConfig()
 {
     /* Fetch core writeable files */
     require_once IPS_KERNEL_PATH . 'classXML.php';
     /*noLibHook*/
     $xml = new classXML(IPSSetUp::charSet);
     try {
         $xml->load(IPS_ROOT_PATH . 'setup/xml/config.xml');
         foreach ($xml->fetchElements('package') as $xmlelement) {
             $data = $xml->fetchElementsFromRecord($xmlelement);
             self::$_config = $data;
         }
         return TRUE;
     } catch (Exception $error) {
         return FALSE;
     }
 }
开发者ID:ConnorChristie,项目名称:GrabViews-Live,代码行数:23,代码来源:ipsRegistry_setup.php

示例9: emoticonsPackExport

 /**
  * Export the specified emoticon directory
  *
  * @return	@e void
  */
 public function emoticonsPackExport()
 {
     /* Setup XML */
     require_once IPS_KERNEL_PATH . 'classXML.php';
     /*noLibHook*/
     $xml = new classXML(IPS_DOC_CHAR_SET);
     require_once IPS_KERNEL_PATH . 'classXMLArchive.php';
     /*noLibHook*/
     $xmlarchive = new classXMLArchive();
     /* Check the emoticon set */
     if (!$this->request['emo_set']) {
         $this->registry->output->global_message = $this->lang->words['emo_specify_exS'];
         $this->emoticonsOverview();
         return;
     }
     /* Get emoticons from the database */
     $emo_db = array();
     $this->DB->build(array('select' => '*', 'from' => 'emoticons', 'where' => "emo_set='{$this->request['emo_set']}'"));
     $this->DB->execute();
     while ($r = $this->DB->fetch()) {
         $emo_db[$r['image']] = $r;
     }
     /* Get Emoticon Folders */
     $emodirs = array();
     $emodd = array();
     $files_to_add = array();
     try {
         foreach (new DirectoryIterator(DOC_IPS_ROOT_PATH . PUBLIC_DIRECTORY . '/style_emoticons/' . $this->request['emo_set']) as $file) {
             if (!$file->isDot()) {
                 if ($emo_db[$file->getFilename()] != "") {
                     $files_to_add[] = DOC_IPS_ROOT_PATH . PUBLIC_DIRECTORY . '/style_emoticons/' . $this->request['emo_set'] . '/' . $file->getFilename();
                 }
             }
         }
     } catch (Exception $e) {
     }
     /* Add each file to the xml archive */
     foreach ($files_to_add as $f) {
         $xmlarchive->add($f);
     }
     $xml->newXMLDocument();
     $xml->addElement('emoticonexport');
     $xml->addElement('emogroup', 'emoticonexport');
     foreach ($emo_db as $r) {
         $content = array();
         $content['typed'] = $r['typed'];
         $content['image'] = $r['image'];
         $content['clickable'] = $r['clickable'];
         $xml->addElementAsRecord('emogroup', 'emoticon', $content);
     }
     /* Create the XML Document */
     $xmlData = $xml->fetchDocument();
     /* Add the xml document to the archive */
     $xmlarchive->add($xmlData, 'emoticon_data.xml');
     /* Send the archive to the browser */
     $imagearchive = $xmlarchive->getArchiveContents();
     $this->registry->output->showDownload($imagearchive, 'ipb_emoticons.xml');
 }
开发者ID:ConnorChristie,项目名称:GrabViews-Live,代码行数:63,代码来源:emoticons.php

示例10: _exportXML

 /**
  * Export all settings to XML (IN_DEV mode)
  *
  * @access	private
  * @param	string		Application directory
  * @return	boolean
  */
 private function _exportXML($app_dir = 'core')
 {
     //-----------------------------------------
     // Get setting groups
     //-----------------------------------------
     $this->_settingsGetGroups(true);
     //-----------------------------------------
     // Get xml class
     //-----------------------------------------
     require_once IPS_KERNEL_PATH . 'classXML.php';
     $xml = new classXML(IPS_DOC_CHAR_SET);
     $xml->newXMLDocument();
     $xml->addElement('settingexport');
     $xml->addElement('settinggroup', 'settingexport');
     foreach ($this->setting_groups as $i => $roar) {
         //-----------------------------------------
         // App check?
         //-----------------------------------------
         if ($app_dir != $roar['conf_title_app']) {
             continue;
         }
         //-----------------------------------------
         // First, add in setting group title
         //-----------------------------------------
         $thisconf = array('conf_is_title' => 1, 'conf_title_keyword' => $roar['conf_title_keyword'], 'conf_title_title' => $roar['conf_title_title'], 'conf_title_desc' => $roar['conf_title_desc'], 'conf_title_tab' => $roar['conf_title_tab'], 'conf_title_app' => $roar['conf_title_app'] ? $roar['conf_title_app'] : $app_dir, 'conf_title_noshow' => $roar['conf_title_noshow']);
         $xml->addElementAsRecord('settinggroup', 'setting', $thisconf);
         //-----------------------------------------
         // Get settings...
         //-----------------------------------------
         $this->DB->build(array('select' => '*', 'from' => 'core_sys_conf_settings', 'where' => "conf_group='{$roar['conf_title_id']}'", 'order' => 'conf_position, conf_title'));
         $this->DB->execute();
         while ($r = $this->DB->fetch()) {
             //-----------------------------------------
             // Clean up...
             //-----------------------------------------
             unset($r['conf_value'], $r['conf_id']);
             $r['conf_title_keyword'] = $roar['conf_title_keyword'];
             $r['conf_is_title'] = 0;
             $xml->addElementAsRecord('settinggroup', 'setting', $r);
         }
     }
     //-----------------------------------------
     // Grab the XML document
     //-----------------------------------------
     $xmlData = $xml->fetchDocument();
     //-----------------------------------------
     // Attempt to write...
     //-----------------------------------------
     $file = IPSLib::getAppDir($app_dir) . '/xml/' . $app_dir . '_settings.xml';
     @unlink($file);
     @file_put_contents($file, $xmlData);
 }
开发者ID:dalandis,项目名称:Visualization-of-Cell-Phone-Locations,代码行数:59,代码来源:settings.php

示例11: install_other

 /**
  * Install Other stuff
  *
  * @return void
  */
 public function install_other()
 {
     //-----------------------------------------
     // INIT
     //-----------------------------------------
     $previous = $_REQUEST['previous'];
     //-----------------------------------------
     // HOOKS: Fetch next 'un
     //-----------------------------------------
     $next = IPSSetUp::fetchNextApplication($previous, 'hooks.xml', $this->settings['gb_char_set']);
     /* Set up DB driver */
     $extra_install = $this->_setUpDBDriver(FALSE);
     //-----------------------------------------
     // Insert tasks
     //-----------------------------------------
     if ($next['key']) {
         $output[] = $next['title'] . ": Добавление модификаций";
         $_PATH = IPSLib::getAppDir($next['key']) . '/xml/';
         if (is_file($_PATH . 'hooks.xml')) {
             //-----------------------------------------
             // Adjust the table?
             //-----------------------------------------
             if ($extra_install and method_exists($extra_install, 'before_inserts_run')) {
                 $q = $extra_install->before_inserts_run('hooks');
             }
             //-----------------------------------------
             // Continue
             //-----------------------------------------
             require_once IPS_ROOT_PATH . 'applications/core/modules_admin/applications/hooks.php';
             /*noLibHook*/
             $hooks = new admin_core_applications_hooks();
             $hooks->makeRegistryShortcuts($this->registry);
             $result = $hooks->installAppHooks($next['key']);
             $output[] = "Модификации " . $next['title'] . ": " . $result['inserted'] . " добавлено";
             //-----------------------------------------
             // Adjust the table?
             //-----------------------------------------
             if ($extra_install and method_exists($extra_install, 'after_inserts_run')) {
                 $q = $extra_install->after_inserts_run('hooks');
             }
         }
         //-----------------------------------------
         // Done.. so get some more!
         //-----------------------------------------
         $this->_finishStep($output, "Установка: Модификации", 'install&do=other&previous=' . $next['key']);
     } else {
         require_once IPS_KERNEL_PATH . 'classXML.php';
         /*noLibHook*/
         //-----------------------------------------
         // ****** LOG IN MODULES
         //-----------------------------------------
         $output[] = "Добавление модулей авторизации";
         $xml = new classXML(IPSSetUp::charSet);
         //-----------------------------------------
         // Adjust the table?
         //-----------------------------------------
         if ($extra_install and method_exists($extra_install, 'before_inserts_run')) {
             $q = $extra_install->before_inserts_run('login');
         }
         //-----------------------------------------
         // Continue
         //-----------------------------------------
         $xml->load(IPS_ROOT_PATH . 'setup/xml/loginauth.xml');
         foreach ($xml->fetchElements('login_methods') as $xmlelement) {
             $data = $xml->fetchElementsFromRecord($xmlelement);
             unset($data['login_id']);
             unset($data['login_date']);
             $this->DB->insert('login_methods', $data);
         }
         //-----------------------------------------
         // Adjust the table?
         //-----------------------------------------
         if ($extra_install and method_exists($extra_install, 'after_inserts_run')) {
             $q = $extra_install->after_inserts_run('login');
         }
         //-----------------------------------------
         // ****** USER AGENTS
         //-----------------------------------------
         $output[] = "Добавление user-agent`ов по-умолчанию";
         $xml = new classXML(IPSSetUp::charSet);
         if ($extra_install and method_exists($extra_install, 'before_inserts_run')) {
             $q = $extra_install->before_inserts_run('useragents');
         }
         require_once IPS_ROOT_PATH . 'sources/classes/useragents/userAgentFunctions.php';
         /*noLibHook*/
         $userAgentFunctions = new userAgentFunctions($this->registry);
         $userAgentFunctions->rebuildMasterUserAgents();
         if ($extra_install and method_exists($extra_install, 'after_inserts_run')) {
             $q = $extra_install->after_inserts_run('useragents');
         }
         //-----------------------------------------
         // ****** ATTACHMENTS
         //-----------------------------------------
         $output[] = "Добавление типов прикрепляемых файлов";
         if ($extra_install and method_exists($extra_install, 'before_inserts_run')) {
//.........这里部分代码省略.........
开发者ID:Advanture,项目名称:Online-RolePlay,代码行数:101,代码来源:install.php

示例12: 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'];
                                                                                 }
                                                                             }
//.........这里部分代码省略.........
开发者ID:ConnorChristie,项目名称:GrabViews-Live,代码行数:101,代码来源:applications.php

示例13: importTemplateAppXML

 /**
  * Import a single app
  *
  * @access	public
  * @param	string		App
  * @param	string		Skin key to import
  * @param	int			Set ID
  * @param	boolean		Set the edited / added flags to 0 (from install, upgrade)
  * @return	mixed		bool, or array of info
  */
 public function importTemplateAppXML($app, $skinKey, $setID = 0, $ignoreAddedEditedFlag = false)
 {
     //-----------------------------------------
     // INIT
     //-----------------------------------------
     $templateGroups = array();
     $templates = array();
     $fileXML = IPSLib::getAppDir($app) . '/xml/' . $app . '_' . $skinKey . '_templates.xml';
     $infoXML = IPSLib::getAppDir($app) . '/xml/information.xml';
     $return = array('updateCount' => 0, 'insertCount' => 0, 'updateBits' => array(), 'insertBits' => array());
     if (!file_exists($fileXML)) {
         return $return;
     }
     if (!$setID and $skinKey != 'root') {
         /* Figure out correct set ID based on key */
         $skinSetData = $this->DB->buildAndFetch(array('select' => '*', 'from' => 'skin_collections', 'where' => "set_key='" . $skinKey . "'"));
         $setID = $skinSetData['set_id'];
     }
     /* Set ignore flag correctly */
     if (!empty($skinKey) and in_array($skinKey, array('root', 'lofi', 'xmlskin'))) {
         $ignoreAddedEditedFlag = true;
     }
     //-----------------------------------------
     // XML
     //-----------------------------------------
     require_once IPS_KERNEL_PATH . 'classXML.php';
     $xml = new classXML(IPS_DOC_CHAR_SET);
     //-----------------------------------------
     // Get information file
     //-----------------------------------------
     $xml->load($infoXML);
     foreach ($xml->fetchElements('template') as $template) {
         $name = $xml->fetchItem($template);
         $match = $xml->fetchAttribute($template, 'match');
         if ($name) {
             $templateGroups[$name] = $match;
         }
     }
     if (!is_array($templateGroups) or !count($templateGroups)) {
         $this->_addMessage("Nothing to export for " . $app);
         return FALSE;
     }
     //-----------------------------------------
     // Fetch templates
     //-----------------------------------------
     $_templates = $this->fetchTemplates($setID, 'allNoContent');
     $_MASTER = $this->fetchTemplates(0, 'allNoContent');
     //-----------------------------------------
     // Loop through...
     //-----------------------------------------
     foreach ($_templates as $group => $data) {
         $_okToGo = FALSE;
         foreach ($templateGroups as $name => $match) {
             if ($match == 'contains') {
                 if (stristr($group, $name)) {
                     $_okToGo = TRUE;
                     break;
                 }
             } else {
                 if ($group == $name) {
                     $_okToGo = TRUE;
                 }
             }
         }
         if ($_okToGo === TRUE) {
             foreach ($data as $name => $templateData) {
                 $templates[$group][$name] = $templateData;
             }
         }
     }
     //-----------------------------------------
     // Wipe the master skins
     //-----------------------------------------
     if ($setID == 0) {
         $this->DB->delete('skin_templates', "template_set_id=0 AND template_group IN ('" . implode("','", array_keys($templates)) . "') AND template_user_added=0 AND template_added_to=0");
         /* Now wipe the array so we enforce creation */
         unset($templates);
     }
     //-----------------------------------------
     // Now grab the actual XML files
     //-----------------------------------------
     $xml->load($fileXML);
     foreach ($xml->fetchElements('template') as $templatexml) {
         $data = $xml->fetchElementsFromRecord($templatexml);
         /* Figure out if this is added by a user or not */
         if ($ignoreAddedEditedFlag === TRUE) {
             $isAdded = 0;
             $isEdited = 0;
         } else {
             $isAdded = (is_array($_MASTER[$data['template_group']][strtolower($data['template_name'])]) and !$_MASTER[$data['template_group']][strtolower($data['template_name'])]['template_user_added']) ? 0 : 1;
//.........这里部分代码省略.........
开发者ID:dalandis,项目名称:Visualization-of-Cell-Phone-Locations,代码行数:101,代码来源:skinImportExport.php

示例14: convert_polls

 /**
  * Convert Polls
  *
  * @access	private
  * @return void
  **/
 private function convert_polls()
 {
     print 'Need data to finish this section';
     exit;
     //---------------------------
     // Set up
     //---------------------------
     $main = array('select' => 'PostID, ThreadID, PostAuthor, UserID, CAST(Subject AS varchar) as Subject, PostDate, IsApproved, CAST(Body AS TEXT) as Body, IPAddress, SectionID', 'from' => 'cs_Posts', 'where' => "PostType = '2'", 'order' => 't.pollid ASC');
     $loop = $this->lib->load('polls', $main, array('voters'));
     //---------------------------
     // Loop
     //---------------------------
     require_once IPS_KERNEL_PATH . 'classXML.php';
     while ($row = ipsRegistry::DB('hb')->fetch($this->lib->queryRes)) {
         $xml = new classXML(IPSSetUp::charSet);
         $xml->loadXML($row['Body']);
         foreach ($xml->fetchElements('VoteOptions') as $option) {
             $data = $this->_xml->fetchElementsFromRecord($_el);
             if ($data['appears'] and intval($data['frequency']) > $this->_minF) {
                 return TRUE;
             }
         }
         //-----------------------------------------
         // Convert votes
         //-----------------------------------------
         $votes = array();
         ipsRegistry::DB('hb')->build(array('select' => '*', 'from' => 'pollvoted', 'where' => "pollid='{$row['pollid']}' AND registered='1'"));
         $voterRes = ipsRegistry::DB('hb')->execute();
         while ($voter = ipsRegistry::DB('hb')->fetch($voterRes)) {
             $vsave = array('vote_date' => time(), 'tid' => $row['threadid'], 'member_id' => $voter['memberid'], 'forum_id' => $row['forumid'], 'member_choices' => serialize(array(1 => $row['optionid'])));
             $this->lib->convertPollVoter($voter['voteid'], $vsave);
         }
         //-----------------------------------------
         // Options are stored in one place...
         //-----------------------------------------
         $choices = array();
         $votes = array();
         $totalVotes = 0;
         ipsRegistry::DB('hb')->build(array('select' => '*', 'from' => 'polloptions', 'where' => "pollid='{$row['pollid']}'"));
         $choiceRes = ipsRegistry::DB('hb')->execute();
         while ($choice = ipsRegistry::DB('hb')->fetch($choiceRes)) {
             $choices[$choice['optionid']] = $choice['description'];
             $votes[$choice['optionid']] = $choice['votes'];
             $totalVotes += $choice['votes'];
         }
         //-----------------------------------------
         // Then we can do the actual poll
         //-----------------------------------------
         $poll_array = array(1 => array('question' => $row['threadsubject'], 'choice' => $choices, 'votes' => $votes));
         $save = array('tid' => $row['threadid'], 'start_date' => strtotime($row['datecreated']), 'choices' => addslashes(serialize($poll_array)), 'starter_id' => $row['memberid'] == '-1' ? 0 : $row['memberid'], 'votes' => $totalVotes, 'forum_id' => $row['forumid'], 'poll_question' => $row['threadsubject']);
         $this->lib->convertPoll($row['pollid'], $save);
     }
     $this->lib->next();
 }
开发者ID:mover5,项目名称:imobackup,代码行数:60,代码来源:cs.php

示例15: rebuildMobileSkinUserAgentsFromSetDataXml

 /**
  * Rebuilds the mobile user agents from the skin set data
  */
 public function rebuildMobileSkinUserAgentsFromSetDataXml()
 {
     /* Init */
     $mobileSkinSet = $this->fetchSkinData($this->fetchSetIdByKey('mobile', true), true);
     $xmlData = array();
     /* Grab xml */
     require_once IPS_KERNEL_PATH . 'classXML.php';
     /*noLibHook*/
     $xml = new classXML('UTF-8');
     /* Skin Set Data */
     $xml->load(IPS_ROOT_PATH . 'setup/xml/skins/setsData.xml');
     foreach ($xml->fetchElements('set') as $xmlelement) {
         $data = $xml->fetchElementsFromRecord($xmlelement);
         if ($data['set_key'] == 'mobile') {
             $xmlData = $data;
             break;
         }
     }
     /* Update */
     if ($xmlData['set_key'] && IPSLib::isSerialized($xmlData['set_locked_uagent']) && IPSLib::isSerialized($mobileSkinSet['set_locked_uagent'])) {
         $new = unserialize($xmlData['set_locked_uagent']);
         $old = unserialize($mobileSkinSet['set_locked_uagent']);
         /* Merge them */
         foreach ($new['groups'] as $group) {
             if (!in_array($group, $old['groups'])) {
                 $old['groups'][] = $group;
             }
         }
         foreach ($new['uagents'] as $agent => $version) {
             if (!in_array($agent, $new['uagents'])) {
                 $old['uagents'][$agent] = $version;
             }
         }
     }
     if (is_array($old) && count($old)) {
         $this->DB->update('skin_collections', array('set_locked_uagent' => serialize($old)), "set_key='mobile'");
     }
 }
开发者ID:ConnorChristie,项目名称:GrabViews,代码行数:41,代码来源:skinFunctions.php


注:本文中的classXML类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。