Clean up xml in cnf files
Indentation was not satisfactory. Improves readability and presentation of cnf files created Thanks to @dkgroot for proposing this improvement
This commit is contained in:
parent
8b06495938
commit
acdf777bcc
|
@ -1,7 +1,7 @@
|
|||
<module>
|
||||
<rawname>sccp_manager</rawname>
|
||||
<name>SCCP Manager</name>
|
||||
<version>14.3.0.1</version>
|
||||
<version>14.3.0.0</version>
|
||||
<type>setup</type>
|
||||
<category>SCCP Connectivity</category>
|
||||
<publisher>Steve Lad, Alex GP</publisher>
|
||||
|
|
|
@ -112,7 +112,7 @@ class xmlinterface
|
|||
$node->addAttribute('model', $var['vendor'] . ' ' . $var['model']);
|
||||
}
|
||||
}
|
||||
$xml_work->asXml($xml_name); // Save XMLDefault1.cnf.xml
|
||||
\FreePBX::Sccp_manager()->saveXml($xml_work, $xml_name); // Save XMLDefault1.cnf.xml
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -347,7 +347,7 @@ class xmlinterface
|
|||
}
|
||||
}
|
||||
|
||||
$xml_work->asXml($xml_name); // Save
|
||||
\FreePBX::Sccp_manager()->saveXml($xml_work, $xml_name); // Save
|
||||
|
||||
return time();
|
||||
}
|
||||
|
@ -667,7 +667,7 @@ class xmlinterface
|
|||
}
|
||||
}
|
||||
|
||||
$xml_work->asXml($xml_name); // Save
|
||||
\FreePBX::Sccp_manager()->saveXml($xml_work, $xml_name); // Save
|
||||
} else {
|
||||
die('Error Hardware template :' . $xml_template . ' not found');
|
||||
}
|
||||
|
|
|
@ -213,6 +213,15 @@ trait helperfunctions {
|
|||
return false;
|
||||
}
|
||||
|
||||
// temporary helper function to save xml with proper indentation
|
||||
public function saveXml($xml, $filename) {
|
||||
$dom = new \DOMDocument("1.0");
|
||||
$dom->preserveWhiteSpace = false;
|
||||
$dom->formatOutput = true;
|
||||
$dom->loadXML($xml->asXML());
|
||||
$dom->save($filename);
|
||||
}
|
||||
|
||||
public function initVarfromXml() {
|
||||
if ((array) $this->xml_data) {
|
||||
foreach ($this->xml_data->xpath('//page_group') as $item) {
|
||||
|
|
Loading…
Reference in a new issue