Source for file Maniacode.class.php
Documentation is available at Maniacode.class.php
* @copyright 2009-2010 NADEO
require_once( APP_FRAMEWORK_GUI_TOOLKIT_PATH.
'standardManiacode.php' );
* @subpackage ManiacodeToolkit
public static $domDocument;
public static $parentNodes;
* Loads the Maniacode GUI Toolkit. This should be called before doing anything with the toolkit
* @param bool True if you don't want to see a message at the end of the execution of the maniacode
* @param bool Wheter you want to create the root "<maniacode>" element in the XML
final public static function load($noconfirmation =
false, $createManialinkElement =
true)
self::$domDocument =
new DOMDocument;
self::$parentNodes =
array();
if ($createManialinkElement)
$maniacode =
self::$domDocument->createElement('maniacode');
$maniacode->setAttribute('noconfirmation', $noconfirmation);
self::$domDocument->appendChild($maniacode);
self::$parentNodes[] =
$maniacode;
* Renders the Maniacode if no return the script will be stopped
* @param bool Whether you want to return the XML instead of printing it
* @return mixed The XML string if param true, in other case it returns void
final public static function render($return =
false)
return self::$domDocument->saveXML();
header('Content-Type: text/xml; charset=utf-8');
echo
self::$domDocument->saveXML();
* Append some XML code to the document
* @param string $XML The given XML
$doc =
new DOMDocument();
$node =
self::$domDocument->importNode($doc->firstChild, true);
end(self::$parentNodes)->appendChild($node);