AMP_DOM_Utils::get_dom_from_content

AMP_DOM_Utils::get_dom_from_content( string $content,  string $encoding = null )

Description #

Return a valid Dom\Document representing arbitrary HTML content passed as a parameter.

See also

  • {@see Reciprocal}: function get_content_from_dom()

Parameters #

$content

(string) (Required) Valid HTML content to be represented by a DomDocument.

$encoding

(string) (Optional) Encoding to use for the content. Defaults to `get_bloginfo( 'charset' )`.

Default value:null


Return #

(AmpProjectDomDocument|false) Returns a DOM document, or false if conversion failed.


Changelog #

Changelog
Version Description
0.2 Introduced.