FML/ManiaCode.php
public function render($echo = false)
    {
        $domDocument                = new \DOMDocument("1.0", "utf-8");
        $domDocument->xmlStandalone = true;

        $domElement = $domDocument->createElement("maniacode");
        $domDocument->appendChild($domElement);

        if ($this->disableConfirmation) {
            $domElement->setAttribute("noconfirmation", 1);
        }

        foreach ($this->elements as $element) {
            $childDomElement = $element->render($domDocument);
            $domElement->appendChild($childDomElement);
        }

        if ($echo) {
            header("Content-Type: application/xml; charset=utf-8;");
            echo $domDocument->saveXML();
        }

        return $domDocument;
    }
public function render($echo = false)
    {
        $domDocument                = new \DOMDocument("1.0", "utf-8");
        $domDocument->xmlStandalone = true;

        $domElement = $domDocument->createElement("maniacode");
        $domDocument->appendChild($domElement);

        if ($this->disableConfirmation) {
            $domElement->setAttribute("noconfirmation", 1);
        }

        foreach ($this->elements as $element) {
            $childDomElement = $element->render($domDocument);
            $domElement->appendChild($childDomElement);
        }

        if ($echo) {
            header("Content-Type: application/xml; charset=utf-8;");
            echo $domDocument->saveXML();
        }

        return $domDocument;
    }
public function render ( $ echo = false ) { $ domDocument = new \ DOMDocument ( "1.0" , "utf-8" ) ; $ domDocument -> xmlStandalone = true ; $ domElement = $ domDocument -> createElement ( "maniacode" ) ; $ domDocument -> appendChild ( $ domElement ) ; if ( $ this -> disableConfirmation ) { $ domElement -> setAttribute ( "noconfirmation" , 1 ) ; } foreach ( $ this -> elements as $ element ) { $ childDomElement = $ element -> render ( $ domDocument ) ; $ domElement -> appendChild ( $ childDomElement ) ; } if ( $ echo ) { header ( "Content-Type: application/xml; charset=utf-8;" ) ; echo $ domDocument -> saveXML ( ) ; } return $ domDocument ; }
Render the ManiaCode

@api
@param bool $echo (optional) If the XML text should be echoed and the Content-Type header should be set
@return \DOMDocument
Render the ManiaCode