LLMS_DOM_Document::load()

Load the HTML string in the DOMDocument


Description Description

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


Top ↑

Return Return

(boolean|WP_Error) Returns true if the source is loaded fine. Or an error object when DOMDocument isn't available or an error is encountered during loading.


Top ↑

Source Source

File: includes/class-llms-dom-document.php

	public function load() {

		if ( is_wp_error( $this->error ) && $this->error->has_errors() ) {
			return $this->error;
		}

		// Don't throw or log warnings.
		$libxml_state = libxml_use_internal_errors( true );

		$this->{$this->load_method}();

		// Clear and restore errors.
		libxml_clear_errors();
		libxml_use_internal_errors( $libxml_state );

		return is_wp_error( $this->error ) && $this->error->has_errors() ? $this->error : true;

	}

Top ↑

Changelog Changelog

Changelog
Version Description
4.13.0 Introduced.

Top ↑

User Contributed Notes User Contributed Notes

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