本文整理汇总了PHP中SimpleXMLExtended::asPrettyXML方法的典型用法代码示例。如果您正苦于以下问题:PHP SimpleXMLExtended::asPrettyXML方法的具体用法?PHP SimpleXMLExtended::asPrettyXML怎么用?PHP SimpleXMLExtended::asPrettyXML使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SimpleXMLExtended
的用法示例。
在下文中一共展示了SimpleXMLExtended::asPrettyXML方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: save
public function save()
{
if ($this->lockSystemChanges) {
return;
}
if (!$this->changed) {
return;
}
$xml = new SimpleXMLExtended('<system/>');
$test = $xml->addChild('plugins');
foreach ($this->plugins as $plugin) {
$test->addXMLElement($this->SystemXMLConverter->pluginToXML($plugin));
}
$test = $xml->addChild('elements');
foreach ($this->elements as $element) {
$test->addXMLElement($this->SystemXMLConverter->elementToXML($element));
}
$test = $xml->addChild('aspects');
foreach ($this->aspects as $aspect) {
$test->addXMLElement($this->SystemXMLConverter->aspectToXML($aspect));
}
$test = $xml->addChild('cmsnavitems');
foreach ($this->cmsNavItems as $navItem) {
$test->addXMLElement($this->SystemXMLConverter->cmsNavItemToXML($navItem));
}
$newContents = $xml->asPrettyXML();
$backup = $this->backupPath . '/system.' . $this->DateFactory->newStorageDate()->format('Y_m_d_His') . '.' . microtime(true) . '.xml';
FileSystemUtils::safeCopy($this->systemXMLFile, $backup);
FileSystemUtils::safeFilePutContents($this->systemXMLFile, $newContents);
$this->ApplicationContext->clearContextFiles();
$this->changed = false;
$this->resetParsed();
}