MailPoet\EmailEditor\Integrations\Utils

Dom_Document_Helper::load_html()privateWC 1.0

Loads the given HTML content into the DOMDocument.

Method of the class: Dom_Document_Helper{}

No Hooks.

Return

null. Nothing (null).

Usage

// private - for code of main (parent) class only
$result = $this->load_html( $html_content ): void;
$html_content(string) (required)
The HTML content to load.

Dom_Document_Helper::load_html() code WC 9.8.1

private function load_html( string $html_content ): void {
	libxml_use_internal_errors( true );
	$this->dom = new \DOMDocument();
	if ( ! empty( $html_content ) ) {
		// prefixing the content with the XML declaration to force the input encoding to UTF-8.
		$this->dom->loadHTML( '<?xml encoding="UTF-8">' . $html_content, LIBXML_HTML_NOIMPLIED | LIBXML_HTML_NODEFDTD );
	}
	libxml_clear_errors();
}