FML Update

This commit is contained in:
Steffen Schröder
2014-01-03 17:18:14 +01:00
parent ad1455bf5a
commit 985feb398e
8 changed files with 1057 additions and 862 deletions

View File

@ -14,12 +14,12 @@ class ManiaLinks {
protected $encoding = 'utf-8';
protected $tagName = 'manialinks';
protected $children = array();
protected $customUI = null;
/**
* Set XML Encoding
*
* @param string $encoding
* XML Encoding
* @param string $encoding XML Encoding
* @return \FML\ManiaLinks
*/
public function setXmlEncoding($encoding) {
@ -30,8 +30,7 @@ class ManiaLinks {
/**
* Add a Child Manialink
*
* @param ManiaLink $child
* Child Manialink
* @param ManiaLink $child Child Manialink
* @return \FML\ManiaLinks
*/
public function add(ManiaLink $child) {
@ -51,11 +50,21 @@ class ManiaLinks {
return $this;
}
/**
* Set the CustomUI
*
* @param CustomUI $customUI The CustomUI Object
* @return \FML\ManiaLinks
*/
public function setCustomUI(CustomUI $customUI) {
$this->customUI = $customUI;
return $this;
}
/**
* Render the XML Document
*
* @param bool $echo
* If the xml should be echoed and the content-type header should be set
* @param bool $echo If the XML should be echoed and the Content-Type Header should be set
* @return \DOMDocument
*/
public function render($echo = false) {
@ -66,6 +75,10 @@ class ManiaLinks {
$childXml = $child->render(false, $domDocument);
$manialinks->appendChild($childXml);
}
if ($this->customUI) {
$customUIXml = $this->customUI->render($domDocument);
$manialinks->appendChild($customUIXml);
}
if ($echo) {
header('Content-Type: application/xml');
echo $domDocument->saveXML();