mirror of
https://github.com/ezyang/htmlpurifier.git
synced 2025-08-04 05:07:55 +02:00
Reorganize configdoc, but it's still broken.
git-svn-id: http://htmlpurifier.org/svnroot/htmlpurifier/trunk@1577 48356398-32a2-884e-a903-53898d9a118a
This commit is contained in:
13
extras/ConfigDoc/DOM/Document.php
Normal file
13
extras/ConfigDoc/DOM/Document.php
Normal file
@@ -0,0 +1,13 @@
|
||||
<?php
|
||||
|
||||
class ConfigDoc_DOM_Document extends DOMDocument
|
||||
{
|
||||
/**
|
||||
* Register our classes
|
||||
*/
|
||||
public function __construct($version = "1.0", $encoding = "UTF-8") {
|
||||
parent::__construct($version, $encoding);
|
||||
parent::registerNodeClass('DOMDocument', 'ConfigDoc_DOM_Document');
|
||||
parent::registerNodeClass('DOMElement', 'ConfigDoc_DOM_Element');
|
||||
}
|
||||
}
|
27
extras/ConfigDoc/DOM/Element.php
Normal file
27
extras/ConfigDoc/DOM/Element.php
Normal file
@@ -0,0 +1,27 @@
|
||||
<?php
|
||||
|
||||
class ConfigDoc_DOM_Element extends DOMElement
|
||||
{
|
||||
|
||||
/**
|
||||
* Appends an HTML div to this node
|
||||
*/
|
||||
public function appendHTMLDiv($html) {
|
||||
$this->appendChild($this->generateHTMLDiv($html));
|
||||
}
|
||||
|
||||
/**
|
||||
* Generates an HTML div that can contain arbitrary markup
|
||||
*/
|
||||
protected function generateHTMLDiv($html) {
|
||||
$purifier = HTMLPurifier::getInstance();
|
||||
$html = $purifier->purify($html);
|
||||
$dom_html = $this->ownerDocument->createDocumentFragment();
|
||||
$dom_html->appendXML($html);
|
||||
$dom_div = $this->ownerDocument->createElement('div');
|
||||
$dom_div->setAttribute('xmlns', 'http://www.w3.org/1999/xhtml');
|
||||
$dom_div->appendChild($dom_html);
|
||||
return $dom_div;
|
||||
}
|
||||
|
||||
}
|
Reference in New Issue
Block a user