Skip to main content

Gravity_Forms\Gravity_Forms\Libraries\Dom_Parser

Source: includes/libraries/class-dom-parser.php:5

Details

  • Kind: class
  • Namespace: Gravity_Forms\Gravity_Forms\Libraries

Properties

PropertyTypeDescription
$contentstringThe string representation of the current DOM.
$dom_xml\DOMDocumentA DOMDocument object made by calling loadXML().
$dom_html\DOMDocumentA DOMDocument object made by calling loadHTML().
$has_domdocumentboolWhether the current server has DOMDocument active.
$insert_positionintThe position at which to insert the hooks script.

Methods

MethodDescription
__construct()GF_Dom_Parser constructor.
get_injected_html()Callback to fire when ob_flush() is called. Allows us to ensure that our Hooks JS has been output on the page,
should_inject_hooks_js()There are some contexts in which we do not want to inject our Hooks JS. This determines
is_parseable_request()Determine if the current server request is one which requires us to add our hooks scripts.
is_xml()Determine if the current document is an XML document.
is_full_html_doc()Determine if the current document has the required (<html>, <head>) elements, and thus
is_amp()Determine whether the current document is an AMP document.

Method Reference

__construct()

public function __construct( $content )

GF_Dom_Parser constructor.

Parameters

NameTypeDefaultDescription
$contentstring

Source: includes/libraries/class-dom-parser.php:68

get_injected_html()

public function get_injected_html()

Callback to fire when ob_flush() is called. Allows us to ensure that our Hooks JS has been output on the page,

even in heavily-cached or concatenated environments.

Returns

  • string

Since: 2.5.6

Source: includes/libraries/class-dom-parser.php:102

should_inject_hooks_js()

public function should_inject_hooks_js()

There are some contexts in which we do not want to inject our Hooks JS. This determines

whether we are in one of those contexts.

Returns

  • bool

Since: 2.5.6

Source: includes/libraries/class-dom-parser.php:192

is_parseable_request()

public function is_parseable_request( $check_empty=true )

Determine if the current server request is one which requires us to add our hooks scripts.

Parameters

NameTypeDefaultDescription
$check_emptybooltrueWhether or not to validate that the DOM content isn't empty.

Returns

  • bool

Since:

  • 2.5.6
  • 2.5.13 (- Added $check_empty param)

Source: includes/libraries/class-dom-parser.php:323

is_xml()

public function is_xml()

Determine if the current document is an XML document.

Returns

  • bool

Since: 2.5.6

Source: includes/libraries/class-dom-parser.php:367

is_full_html_doc()

public function is_full_html_doc()

Determine if the current document has the required (<html>, <head>) elements, and thus

should be treated as a full doc.

Returns

  • bool

Since: 2.5.6

Source: includes/libraries/class-dom-parser.php:391

is_amp()

public function is_amp()

Determine whether the current document is an AMP document.

Returns

  • bool

Since: 2.5.6

Source: includes/libraries/class-dom-parser.php:436