本文整理汇总了PHP中classXML::addElementAsRecord方法的典型用法代码示例。如果您正苦于以下问题:PHP classXML::addElementAsRecord方法的具体用法?PHP classXML::addElementAsRecord怎么用?PHP classXML::addElementAsRecord使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类classXML
的用法示例。
在下文中一共展示了classXML::addElementAsRecord方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _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);
}
示例2: _buildXML
/**
* Build XML file from array of data
*
* @param array Entries to add
* @return string XML Document
*/
protected function _buildXML($data = array())
{
//-----------------------------------------
// INIT
//-----------------------------------------
$entry = array();
//-----------------------------------------
// Get XML class
//-----------------------------------------
require_once IPS_KERNEL_PATH . 'classXML.php';
/*noLibHook*/
$xml = new classXML(IPS_DOC_CHAR_SET);
$xml->newXMLDocument();
$xml->addElement('export');
$xml->addElement('group', 'export');
//-----------------------------------------
// Set group
//-----------------------------------------
foreach ($data as $thisentry => $r) {
$r['login_enabled'] = 0;
if ($r['login_folder_name'] == 'internal') {
$r['login_enabled'] = 1;
}
unset($r['login_id']);
$xml->addElementAsRecord('group', 'row', $r);
}
return $xml->fetchDocument();
}
示例3: languageExportToXML
/**
* Export language entries to xml file
*
* @param integer $lang_id Language pack to export
* @param bool $disk Save to disk instead
* @return void
*/
public function languageExportToXML($lang_id, $disk = false)
{
//-----------------------------------------
// Init
//-----------------------------------------
$app_dir = trim($this->request['app_dir']);
$type = trim($this->request['type']);
$_where = '';
$_name = 'language.xml';
$LATESTVERSION = IPSLib::fetchVersionNumber();
$doPack = true;
//-----------------------------------------
// Filter
//-----------------------------------------
if ($app_dir) {
$_where = " AND word_app='" . $app_dir . "'";
$_name = $app_dir . '_language_pack.xml';
$doPack = false;
}
if ($type) {
if ($type == 'admin') {
$_where .= " AND word_pack LIKE 'admin_%'";
$_name = 'admin_' . $_name;
} else {
$_where .= " AND word_pack LIKE 'public_%'";
$_name = 'public_' . $_name;
}
$doPack = false;
}
//-----------------------------------------
// Create the XML library
//-----------------------------------------
require_once IPS_KERNEL_PATH . 'classXML.php';
/*noLibHook*/
$xml = new classXML(IPS_DOC_CHAR_SET);
$xml->newXMLDocument();
$xml->addElement('languageexport');
$xml->addElement('languagegroup', 'languageexport');
//-----------------------------------------
// Get language pack
//-----------------------------------------
$data = $this->DB->buildAndFetch(array('select' => '*', 'from' => 'core_sys_lang', 'where' => "lang_id={$lang_id}"));
//-----------------------------------------
// Add pack if necessary
//-----------------------------------------
if ($doPack) {
$xml->addElementAsRecord('languagegroup', 'langinfo', $data);
}
//-----------------------------------------
// Get the words
//-----------------------------------------
$this->DB->build(array('select' => '*', 'from' => 'core_sys_lang_words', 'where' => "lang_id={$lang_id}" . $_where));
$this->DB->execute();
//-----------------------------------------
// Add words to export
//-----------------------------------------
$word_packs = array();
$_strings = 0;
while ($r = $this->DB->fetch()) {
$content = array();
$_strings++;
if ($disk) {
$content = array('word_app' => $r['word_app'], 'word_pack' => $r['word_pack'], 'word_key' => $r['word_key'], 'word_default' => $r['word_default']);
if ($r['word_js']) {
$content['word_js'] = $r['word_js'];
}
} else {
$content = array('word_app' => $r['word_app'], 'word_pack' => $r['word_pack'], 'word_key' => $r['word_key'], 'word_default' => $r['word_default'], 'word_custom' => $r['word_custom'], 'word_default_version' => $r['word_default_version'] >= 30000 ? $r['word_default_version'] : $LATESTVERSION['long'], 'word_custom_version' => $r['word_custom_version'], 'word_js' => $r['word_js']);
}
$xml->addElementAsRecord('languagegroup', 'lang', $content);
}
//-----------------------------------------
// Got any strings?
//-----------------------------------------
if (!$_strings) {
if ($disk) {
return false;
} else {
$this->registry->output->global_message = $this->lang->words['l_nolangbits'];
$this->languagesList();
return;
}
}
//-----------------------------------------
// Write to disk or output to browser
//-----------------------------------------
if ($disk) {
@unlink(IPSLib::getAppDir($app_dir) . '/xml/' . $_name);
@file_put_contents(IPSLib::getAppDir($app_dir) . '/xml/' . $_name, $xml->fetchDocument());
return true;
} else {
//-----------------------------------------
// Create xml archive
//.........这里部分代码省略.........
示例4: masterXMLExport
/**
* Exports the groups to a master XML file for distribution
*
* @return @e void [Outputs to screen]
*/
public function masterXMLExport()
{
//-----------------------------------------
// INIT
//-----------------------------------------
$entry = array();
$skip = IPSLib::fetchNonDefaultGroupFields();
//-----------------------------------------
// Get xml class
//-----------------------------------------
require_once IPS_KERNEL_PATH . 'classXML.php';
/*noLibHook*/
$xml = new classXML(IPS_DOC_CHAR_SET);
$xml->newXMLDocument();
$xml->addElement('export');
$xml->addElement('group', 'export');
//-----------------------------------------
// Grab our default 6 groups
//-----------------------------------------
$this->DB->build(array('select' => '*', 'from' => 'groups', 'order' => 'g_id ASC', 'limit' => array(0, 6)));
$this->DB->execute();
while ($r = $this->DB->fetch()) {
$content = array();
$r['g_icon'] = '';
if (is_array($skip) and count($skip)) {
foreach ($skip as $_kk) {
unset($r[$_kk]);
}
}
$xml->addElementAsRecord('group', 'row', $r);
}
//-----------------------------------------
// Print to browser
//-----------------------------------------
$this->registry->output->showDownload($xml->fetchDocument(), 'groups.xml', '', 0);
}
示例5: 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();
}
示例6: _exportBlock
/**
* Export skin templates from a plugin block
*
* @access protected
* @return void
*/
protected function _exportBlock()
{
$id = preg_replace("#[^a-zA-Z0-9_\\-]#", "", $this->request['block']);
if (!$id) {
$this->registry->output->showError($this->lang->words['noblock_export']);
}
//-----------------------------------------
// Build default block templates for release
//-----------------------------------------
if ($id == '_all_') {
require_once IPS_KERNEL_PATH . 'classXml.php';
$xml = new classXML(IPS_DOC_CHAR_SET);
$xml->newXMLDocument();
$xml->addElement('blockexport');
$xml->addElement('blocktemplate', 'blockexport');
$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'])) {
$xml->addElementAsRecord('blocktemplate', 'template', $r);
}
}
$this->registry->output->showDownload($xml->fetchDocument(), 'block_templates.xml', '', 0);
exit;
}
//-----------------------------------------
// Allow exporting of single block templates
//-----------------------------------------
require_once IPSLib::getAppDir('ccs') . '/sources/blocks/plugin/pluginInterface.php';
require_once IPSLib::getAppDir('ccs') . '/sources/blocks/plugin/' . $id . '/plugin.php';
$_className = "plugin_" . $id;
$_class = new $_className($this->registry);
$_pluginConfig = $_class->returnPluginInfo();
if (!$_pluginConfig['templateBit']) {
$this->registry->output->showError($this->lang->words['nothingto_export']);
}
$template = $this->DB->buildAndFetch(array('select' => '*', 'from' => 'ccs_template_blocks', 'where' => "tpb_name='{$_pluginConfig['templateBit']}'"));
if (!$template['tpb_id']) {
$this->registry->output->showError($this->lang->words['couldnot_find_export']);
}
require_once IPS_KERNEL_PATH . 'classXml.php';
$xml = new classXML(IPS_DOC_CHAR_SET);
$xml->newXMLDocument();
$xml->addElement('blockexport');
$xml->addElement('blocktemplate', 'blockexport');
$xml->addElementAsRecord('blocktemplate', 'template', $template);
$this->registry->output->showDownload($xml->fetchDocument(), 'block_' . $_pluginConfig['key'] . '.xml', '', 0);
}
示例7: _returnXml
/**
* Sends forum data in xml format
*
* @param array $dataArray
* @return @e void
*/
protected function _returnXml($dataArray)
{
/* XML Parser */
require_once IPS_KERNEL_PATH . 'classXML.php';
/*noLibHook*/
$xml = new classXML('utf-8');
$xml->newXMLDocument();
/* Build Document */
$xml->addElement('forum');
$xml->addElementAsRecord('forum', 'capabilites', array('gallery' => $dataArray['gallery']));
$xml->addElementAsRecord('forum', 'capabilites', array('facebook' => $dataArray['facebook']));
$xml->addElementAsRecord('forum', 'capabilites', array('twitter' => $dataArray['twitter']));
$xml->addElementAsRecord('forum', 'capabilites', array('status' => $dataArray['status']));
$xml->addElementAsRecord('forum', 'capabilites', array('notifications' => $dataArray['notifications']));
$xml->addElement('albums', 'forum');
$xml->addElementAsRecord('forum', 'security', array('form_hash' => $dataArray['form_hash']));
/* Loop through albums */
if (is_array($dataArray['albums']) && count($dataArray['albums'])) {
foreach ($dataArray['albums'] as $r) {
$xml->addElementAsRecord('albums', array('album'), array('id' => $r['id'], 'name' => $r['name']));
}
}
$xml->addElementAsRecord('forum', 'version', array('version_id' => $dataArray['version_id']));
$xml->addElementAsRecord('forum', 'version', array('version_text' => $dataArray['version_text']));
/* Output */
echo $xml->fetchDocument();
exit;
}
示例8: badwordsExport
/**
* Exports badwords to an xml file
*
* @return @e void
*/
public function badwordsExport()
{
//-----------------------------------------
// Get xml class
//-----------------------------------------
require_once IPS_KERNEL_PATH . 'classXML.php';
/*noLibHook*/
$xml = new classXML(IPS_DOC_CHAR_SET);
$xml->newXMLDocument();
$xml->addElement('badwordexport');
$xml->addElement('badwordgroup', 'badwordexport');
/* Query the badwords */
$this->DB->build(array('select' => 'type, swop, m_exact', 'from' => 'badwords', 'order' => 'type'));
$this->DB->execute();
/* Add the bad word entries to the xml file */
while ($r = $this->DB->fetch()) {
$xml->addElementAsRecord('badwordgroup', 'badword', $r);
}
/* Create the xml document and send to the browser */
$xmlData = $xml->fetchDocument();
$this->registry->output->showDownload($xmlData, 'ipb_badwords.xml');
}
示例9: _doExportHook
/**
* Actually export the damn hook already
* Sorry, it has been a long day...
*
* @access private
* @return void
*/
private function _doExportHook()
{
//-----------------------------------------
// Get hook
//-----------------------------------------
$id = intval($this->request['id']);
if (!$id) {
$this->registry->output->showError($this->lang->words['h_noexport'], 1114);
}
$hookData = $this->DB->buildAndFetch(array('select' => '*', 'from' => 'core_hooks', 'where' => 'hook_id=' . $id));
if (!$hookData['hook_id']) {
$this->registry->output->showError($this->lang->words['h_noexport'], 1115);
}
$extra_data = unserialize($hookData['hook_extra_data']);
//-----------------------------------------
// Get hook files
//-----------------------------------------
$files = array();
$index = 1;
$this->DB->build(array('select' => '*', 'from' => 'core_hooks_files', 'where' => 'hook_hook_id=' . $id));
$this->DB->execute();
while ($r = $this->DB->fetch()) {
$files[$index] = $r;
$index++;
}
//-----------------------------------------
// Get XML class
//-----------------------------------------
require_once IPS_KERNEL_PATH . 'classXML.php';
$xml = new classXML(IPS_DOC_CHAR_SET);
$xml->newXMLDocument();
$xml->addElement('hookexport');
//-----------------------------------------
// Put hook data in export
//-----------------------------------------
$xml->addElement('hookdata', 'hookexport');
$content = array();
foreach ($hookData as $k => $v) {
if (in_array($k, array('hook_id', 'hook_enabled', 'hook_installed', 'hook_updated', 'hook_position'))) {
continue;
}
$content[$k] = $v;
}
$xml->addElementAsRecord('hookdata', 'config', $content);
//-----------------------------------------
// Put hook files in export
//-----------------------------------------
$xml->addElement('hookfiles', 'hookexport');
foreach ($files as $index => $r) {
$content = array();
foreach ($r as $k => $v) {
if (in_array($k, array('hook_file_id', 'hook_hook_id', 'hook_file_stored', 'hooks_source'))) {
continue;
}
$content[$k] = $v;
}
$source = file_exists(IPS_HOOKS_PATH . $r['hook_file_stored']) ? file_get_contents(IPS_HOOKS_PATH . $r['hook_file_stored']) : '';
if ($r['hook_type'] == 'commandHooks') {
$source = $this->_cleanSource($source);
}
$content['hooks_source'] = $source;
$xml->addElementAsRecord('hookfiles', 'file', $content);
}
//-----------------------------------------
// Custom install/uninstall script?
//-----------------------------------------
if ($extra_data['custom']) {
$content = array();
$xml->addElement('hookextras_custom', 'hookexport');
$content['filename'] = $extra_data['custom'];
$content['source'] = file_exists(IPS_HOOKS_PATH . 'install_' . $extra_data['custom']) ? file_get_contents(IPS_HOOKS_PATH . 'install_' . $extra_data['custom']) : '';
$xml->addElementAsRecord('hookextras_custom', 'file', $content);
}
//-----------------------------------------
// Settings or setting groups?
//-----------------------------------------
$entry = array();
$_groups = array();
$_settings = array();
$titles = array();
$content = array();
$xml->addElement('hookextras_settings', 'hookexport');
# Store group ids and setting ids for entire setting groups
if (is_array($extra_data['settingGroups']) and count($extra_data['settingGroups'])) {
$_groups = $extra_data['settingGroups'];
$this->DB->build(array('select' => 'conf_id', 'from' => 'core_sys_conf_settings', 'where' => 'conf_group IN(' . implode(',', $_groups) . ')'));
$this->DB->execute();
while ($setting = $this->DB->fetch()) {
$_settings[] = $setting['conf_id'];
}
}
# Store group ids and setting ids for indvidual settings
if (is_array($extra_data['settings']) and count($extra_data['settings'])) {
//.........这里部分代码省略.........
示例10: 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');
}
示例11: helpFilesXMLExport
/**
* Export help files XML
*
* @return @e void
*/
public function helpFilesXMLExport()
{
/* 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('help', 'export');
/* Query tasks */
$this->DB->build(array('select' => '*', 'from' => 'faq', 'where' => "app='{$app}'"));
$this->DB->execute();
/* Loop through and add tasks to XML */
while ($r = $this->DB->fetch()) {
$c++;
unset($r['id']);
$r['text'] = str_replace('%7Bstyle_image_url%7D', '{style_image_url}', $r['text']);
$xml->addElementAsRecord('help', 'row', $r);
}
/* Finish XML */
$doc = $xml->fetchDocument();
@unlink(IPSLib::getAppDir($app) . '/xml/' . $app . '_help.xml');
/* Write */
if ($doc and $c) {
$fh = @fopen(IPSLib::getAppDir($app) . '/xml/' . $app . '_help.xml', 'w');
@fwrite($fh, $doc);
@fclose($fh);
}
/* In dev time stamp? */
if (IN_DEV) {
$cache = $this->caches['indev'];
$cache['import']['help'][$app] = time();
$this->cache->setCache('indev', $cache, array('donow' => 1, 'array' => 1));
}
}
$this->registry->output->global_message = $this->lang->words['h_exported'];
$this->helpFilesList();
}
示例12: _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);
}
示例13: inDevApplicationsExport
/**
* Export information.xml files
* for every application
*
* @return @e void [Returns to the applications list]
*/
protected function inDevApplicationsExport()
{
/* Not IN_DEV? */
if (!IN_DEV) {
$this->applicationsOverview();
return;
}
/* Get our libs! */
require_once IPS_KERNEL_PATH . 'classXML.php';
/*noLibHook*/
require_once IPS_ROOT_PATH . 'setup/sources/base/setup.php';
/*noLibHook*/
/* Do each app */
$this->DB->build(array('select' => '*', 'from' => 'core_applications'));
$outer = $this->DB->execute();
/* Loop */
while ($app = $this->DB->fetch($outer)) {
/* Set some vars */
$oldXml = array();
$newXml = null;
$infoFile = IPSLib::getAppDir($app['app_directory']) . '/xml/information.xml';
/* Got some 'old' template data to retain? */
if (is_file($infoFile)) {
if (!is_writeable($infoFile)) {
$output[] = "Cannot write to {$infoFile}";
continue;
}
$oldXml = IPSSetUp::fetchXmlAppInformation($app['app_directory'], $this->settings['gb_char_set']);
}
$data = array('name' => trim($app['app_title']), 'public_name' => trim($app['app_public_title']), 'hide_tab' => intval($app['app_hide_tab']), 'author' => trim($app['app_author']), 'description' => trim($app['app_description']), 'disabledatinstall' => isset($oldXml['disabledatinstall']) && $oldXml['disabledatinstall'] ? intval($oldXml['disabledatinstall']) : 0, 'ipskey' => '', 'global_caches' => trim($app['app_global_caches']), 'website' => trim($app['app_website']), 'update_check' => trim($app['app_update_check']));
/* Got an IPS key to add? */
if ($app['app_location'] == 'ips') {
$data['ipskey'] = md5('ips_' . $app['app_directory']);
} else {
unset($data['ipskey']);
}
/* Create xml object */
$newXml = new classXML(IPS_DOC_CHAR_SET);
$newXml->newXMLDocument();
/* Create elements */
$newXml->addElement('information');
$newXml->addElementAsRecord('information', 'data', $data);
/* Get data till now */
$xmlData = $newXml->fetchDocument();
/* Got templates? */
if (isset($oldXml['templates']) && count($oldXml['templates'])) {
$XML_TEMPLATES = <<<XML
<templategroups>
XML;
foreach ($oldXml['templates'] as $k => $v) {
$XML_TEMPLATES .= <<<XML
<template match="{$v}">{$k}</template>
XML;
}
$XML_TEMPLATES .= <<<XML
</templategroups>
XML;
} else {
$XML_TEMPLATES = <<<XML
<templategroups/>
XML;
}
/* Add templates into our XML - yeah I know.. a bit hackish.. */
if ($data['update_check']) {
$xmlData = str_replace('</update_check>', "</update_check>\n{$XML_TEMPLATES}", $xmlData);
} else {
$xmlData = str_replace('<update_check/>', "<update_check/>\n{$XML_TEMPLATES}", $xmlData);
}
file_put_contents($infoFile, $xmlData);
$output[] = $app['app_title'] . " information exported in '" . str_replace(DOC_IPS_ROOT_PATH, '', $infoFile) . "'";
}
/* Done, setup message and redirect */
$this->registry->output->setMessage(implode("<br />", $output), 1);
$this->registry->output->silentRedirectWithMessage($this->settings['base_url'] . $this->form_code . '&do=applications_overview');
}
示例14: generateInfoXML
/**
* Generate XML Information data file
*
* @access public
* @param int Set ID
* @return string XML
*/
public function generateInfoXML($setID = 0)
{
//-----------------------------------------
// INIT
//-----------------------------------------
$data = array();
$setData = $this->fetchSkinData($setID);
//-----------------------------------------
// Grab the XML parser
//-----------------------------------------
require_once IPS_KERNEL_PATH . 'classXML.php';
$xml = new classXML(IPS_DOC_CHAR_SET);
//-----------------------------------------
// Loop through...
//-----------------------------------------
$xml->newXMLDocument();
$xml->addElement('info');
$xml->addElementAsRecord('info', 'data', array('set_name' => $setData['set_name'], 'set_author_name' => $setData['set_author_name'], 'set_author_url' => $setData['set_author_url'], 'set_output_format' => $setData['set_output_format'], 'ipb_major_version' => '3'));
return $xml->fetchDocument();
}
示例15: _bbcodeExport
/**
* Export a bbcode XML file
*
* @return @e void [Outputs to screen]
*/
protected function _bbcodeExport()
{
//-----------------------------------------
// Get xml class
//-----------------------------------------
require_once IPS_KERNEL_PATH . 'classXML.php';
/*noLibHook*/
$xml = new classXML(IPS_DOC_CHAR_SET);
$xml->newXMLDocument();
$xml->addElement('bbcodeexport');
$xml->addElement('bbcodegroup', 'bbcodeexport');
//-----------------------------------------
// Get bbcodes
//-----------------------------------------
$select = array('select' => '*', 'from' => 'custom_bbcode');
if ($this->request['id']) {
$select['where'] = 'bbcode_id=' . intval($this->request['id']);
}
$this->DB->build($select);
$this->DB->execute();
while ($r = $this->DB->fetch()) {
$xml->addElementAsRecord('bbcodegroup', 'bbcode', $r);
}
$xmlData = $xml->fetchDocument();
//-----------------------------------------
// Send to browser.
//-----------------------------------------
$this->registry->output->showDownload($xmlData, 'bbcode.xml', '', 0);
}