huge fml update

This commit is contained in:
Steffen Schröder
2014-01-19 19:30:21 +01:00
parent 9654b26f2b
commit 771409b8eb
66 changed files with 2303 additions and 134 deletions

View File

@ -16,6 +16,22 @@ class ManiaLinks {
protected $children = array();
protected $customUI = null;
/**
* Create a new ManiaLinks Object
*
* @return \FML\ManiaLinks
*/
public static function create() {
$maniaLinks = new ManiaLinks();
return $maniaLinks;
}
/**
* Construct a new ManiaLinks Object
*/
public function __construct() {
}
/**
* Set XML Encoding
*
@ -61,6 +77,19 @@ class ManiaLinks {
return $this;
}
/**
* Get the current CustomUI
*
* @param bool $createIfEmpty (optional) Whether the CustomUI Object should be created if it's not set yet
* @return \FML\CustomUI
*/
public function getCustomUI($createIfEmpty = true) {
if (!$this->customUI && $createIfEmpty) {
$this->customUI = new CustomUI();
}
return $this->customUI;
}
/**
* Render the XML Document
*
@ -69,6 +98,7 @@ class ManiaLinks {
*/
public function render($echo = false) {
$domDocument = new \DOMDocument('1.0', $this->encoding);
$domDocument->xmlStandalone = true;
$maniaLinks = $domDocument->createElement($this->tagName);
$domDocument->appendChild($maniaLinks);
foreach ($this->children as $child) {
@ -80,7 +110,7 @@ class ManiaLinks {
$maniaLinks->appendChild($customUIXml);
}
if ($echo) {
header('Content-Type: application/xml');
header('Content-Type: application/xml; charset=utf-8;');
echo $domDocument->saveXML();
}
return $domDocument;