]*>(.*)<\/h[3,4,5,6]>/sU', '
$1
', $content ); return $content; } function filter_dom($content){ $DOMDocument = get_content_DOM($content); $DOMDocument = apply_filters("fbia_content_dom", $DOMDocument); $content = get_content_from_DOM($DOMDocument); return $content; } function get_content_DOM($content){ $libxml_previous_state = libxml_use_internal_errors( true ); $DOMDocument = new DOMDocument( '1.0', get_option( 'blog_charset' ) ); // DOMDocument isn’t handling encodings too well, so let’s help it a little if ( function_exists( 'mb_convert_encoding' ) ) { $content = mb_convert_encoding( $content, 'HTML-ENTITIES', get_option( 'blog_charset' ) ); } $result = $DOMDocument->loadHTML( '' . utf8_decode( $content ) . '' ); libxml_clear_errors(); libxml_use_internal_errors( $libxml_previous_state ); return $DOMDocument; } function get_content_from_DOM($DOMDocument){ $body = $DOMDocument->getElementsByTagName( 'body' )->item( 0 ); $filtered_content = ''; foreach ( $body->childNodes as $node ) { if ( method_exists( $DOMDocument, 'saveHTML' ) && version_compare(phpversion(), '5.3.6', '>=') ) { $filtered_content .= $DOMDocument->saveHTML( $node );// Requires PHP 5.3.6 } else { $temp_content = $DOMDocument->saveXML( $node ); $iframe_pattern = "#