* the document.
* DEFAULT: false (returns the contents contained inside
* the BODY tag)
+ * 'return_dom' - (boolean) If true, return a DOMDocument object instead of
+ * HTML text (overrides return_document).
+ * DEFAULT: false
* 'strip_styles' - (boolean) Strip style tags?
* DEFAULT: true
* 'strip_style_attributes' - (boolean) Strip style attributes in all tags?
'charset' => 'UTF-8',
'noprefetch' => false,
'return_document' => false,
+ 'return_dom' => false,
'strip_styles' => true,
'strip_style_attributes' => true
);
*
* @param string $text The text after the filtering.
*
- * @return string The modified text.
+ * @return string|DOMDocument The modified text or a DOMDocument object
+ * if the 'return_dom' parameter is set.
*/
public function postProcess($text)
{
}
}
+ if ($this->_params['return_dom']) {
+ return $doc;
+ }
+
$text = '';
if ($this->_params['return_document']) {
$text = $doc->saveHTML();