src/wcmf/lib/util/DOMUtils.php
public static function processHtml($content, callable $processor) {
    $doc = new \DOMDocument();
    $doc->loadHTML('<html>'.trim(mb_convert_encoding($content, 'HTML-ENTITIES', 'UTF-8')).'</html>', LIBXML_HTML_NOIMPLIED | LIBXML_HTML_NODEFDTD);
    $processor($doc);
    return trim(str_replace(['<html>', '</html>'], '', $doc->saveHTML()));
  }
public static function processHtml($content, callable $processor) {
    $doc = new \DOMDocument();
    $doc->loadHTML('<html>'.trim(mb_convert_encoding($content, 'HTML-ENTITIES', 'UTF-8')).'</html>', LIBXML_HTML_NOIMPLIED | LIBXML_HTML_NODEFDTD);
    $processor($doc);
    return trim(str_replace(['<html>', '</html>'], '', $doc->saveHTML()));
  }
public static function processHtml ( $ content , callable $ processor ) { $ doc = new \ DOMDocument ( ) ; $ doc -> loadHTML ( '<html>' . trim ( mb_convert_encoding ( $ content , 'HTML-ENTITIES' , 'UTF-8' ) ) . '</html>' , LIBXML_HTML_NOIMPLIED | LIBXML_HTML_NODEFDTD ) ; $ processor ( $ doc ) ; return trim ( str_replace ( [ '<html>' , '</html>' ] , '' , $ doc -> saveHTML ( ) ) ) ; }
Process the given html fragment using the given function
@param $content Html string
@param $processor Function that accepts a DOMDocument as only parameter
@return String
Process the given html fragment using the given function