2007-05-28 02:41:01 +00:00
|
|
|
<?php
|
|
|
|
|
2007-05-28 02:55:50 +00:00
|
|
|
/**
|
|
|
|
* The XMLSerializer hierarchy of classes consist of classes that take
|
|
|
|
* objects and serialize them into XML, specifically DOM, form; this
|
|
|
|
* super-class contains convenience functions for those classes.
|
|
|
|
*/
|
2007-05-28 02:41:01 +00:00
|
|
|
class ConfigDoc_XMLSerializer
|
|
|
|
{
|
|
|
|
|
2007-11-25 02:24:39 +00:00
|
|
|
/**
|
|
|
|
* Appends a div containing HTML into a node
|
|
|
|
* @param $document Base document node belongs to
|
|
|
|
* @param $node Node to append to
|
|
|
|
* @param $html HTML to place inside div to append
|
|
|
|
* @todo Place this directly in DOMNode, using registerNodeClass to
|
|
|
|
* override.
|
|
|
|
*/
|
2007-05-28 02:55:50 +00:00
|
|
|
protected function appendHTMLDiv($document, $node, $html) {
|
2007-05-28 03:33:12 +00:00
|
|
|
$purifier = HTMLPurifier::getInstance();
|
2007-05-28 02:55:50 +00:00
|
|
|
$html = $purifier->purify($html);
|
|
|
|
$dom_html = $document->createDocumentFragment();
|
|
|
|
$dom_html->appendXML($html);
|
|
|
|
$dom_div = $document->createElement('div');
|
|
|
|
$dom_div->setAttribute('xmlns', 'http://www.w3.org/1999/xhtml');
|
|
|
|
$dom_div->appendChild($dom_html);
|
|
|
|
$node->appendChild($dom_div);
|
|
|
|
}
|
2007-05-28 02:41:01 +00:00
|
|
|
|
|
|
|
}
|
|
|
|
|