llms_get_dom_document( string $string )

Instantiate an instance of DOMDocument with an HTML string

Description Description

This function suppresses PHP warnings that would be thrown by DOMDocument when loading a partial string or an HTML string with errors.

See also See also

Top ↑

Parameters Parameters


(string) (Required) An HTML string, either a full HTML document or a partial string.

Top ↑

Return Return

(DOMDocument|WP_Error) Returns an instance of DOMDocument with $string loaded into it or an error object when DOMDocument isn't available or an error is encountered during loading.

Top ↑

Source Source

File: includes/llms.functions.core.php

function llms_get_dom_document( $string ) {

	$llms_dom = new LLMS_DOM_Document( $string );
	$load     = $llms_dom->load();

	return is_wp_error( $load ) ? $load : $llms_dom->dom();

Top ↑

Changelog Changelog

Version Description
4.8.0 Remove reliance on mb_convert_encoding().
4.13.0 Introduced.

Top ↑

User Contributed Notes User Contributed Notes

You must log in before being able to contribute a note or feedback.