mirror of
https://github.com/lucaspalomodevelop/core.git
synced 2026-03-16 09:34:39 +00:00
sync master
This commit is contained in:
parent
697ad2d1f1
commit
d2fe8718de
@ -253,12 +253,21 @@ class Config extends Singleton
|
||||
public function __toString()
|
||||
{
|
||||
// reformat XML (pretty print)
|
||||
$configxml = dom_import_simplexml($this->simplexml);
|
||||
$dom = new \DOMDocument('1.0');
|
||||
$dom_sxe = $dom->importNode($configxml, true);
|
||||
$dom->appendChild($dom_sxe);
|
||||
|
||||
// make sure our root element is always called "opnsense"
|
||||
$root = $dom->createElement('opnsense');
|
||||
$dom->appendChild($root);
|
||||
|
||||
foreach ($this->simplexml as $node) {
|
||||
$domNode = dom_import_simplexml($node);
|
||||
$domNode = $root->ownerDocument->importNode($domNode, true);
|
||||
$root->appendChild($domNode);
|
||||
}
|
||||
|
||||
$dom->formatOutput = true;
|
||||
$dom->preserveWhiteSpace = false;
|
||||
|
||||
$dom->loadXML($dom->saveXML());
|
||||
|
||||
return $dom->saveXML();
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user