Add a lot of new fields with improved and more integrated checks for
dependencies and allowed values
This commit is contained in:
@ -157,3 +157,64 @@ function generateHelpTooltip(string $identifier, string $title, string $explica,
|
||||
return [$output, $outputTag];
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Outputs a DOMDocument with correct header and then aborts.
|
||||
* Used mainly for debugging.
|
||||
*
|
||||
* @param DOMDocument $xmlDoc XML object.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
function printDOMDocToXML(DOMDocument $xmlDoc) {
|
||||
|
||||
return '<?xml version="1.0" encoding="UTF-8"?>' . $xmlDoc->saveXML($xmlDoc->documentElement);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Function for creating a DOMElement with a text node inside.
|
||||
*
|
||||
* @param DOMDocument $xmlDoc XML document.
|
||||
* @param string $tag Tag.
|
||||
* @param string $content Text content.
|
||||
*
|
||||
* @return DOMElement
|
||||
*/
|
||||
function createTextDomElement(DOMDocument $xmlDoc, string $tag, string $content):DOMElement {
|
||||
|
||||
$element = $xmlDoc->createElement($tag);
|
||||
$element->appendChild($xmlDoc->createTextNode($content));
|
||||
|
||||
return $element;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Function for creating a DOMDocument record channel.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
function getBlankRecordChannel():array {
|
||||
|
||||
$xmlDoc = new DOMDocument("1.0", "UTF-8");
|
||||
$xmlMainElem = $xmlDoc->createElement("record");
|
||||
$record_node = $xmlDoc->appendChild($xmlMainElem); //add RSS element to XML node
|
||||
|
||||
return [$xmlDoc, $record_node];
|
||||
|
||||
}
|
||||
|
||||
function rrmdir($dir) {
|
||||
if (is_dir($dir)) {
|
||||
$objects = scandir($dir);
|
||||
foreach ($objects as $object) {
|
||||
if ($object != "." && $object != "..") {
|
||||
if (filetype($dir . "/" . $object) == "dir") rrmdir($dir . "/" . $object); else unlink($dir . "/" . $object);
|
||||
}
|
||||
}
|
||||
reset($objects);
|
||||
rmdir($dir);
|
||||
}
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user