Documentation

DOMDocumentBadInit extends DOMDocument
in package

This is the main class which builds on top of PHP's native DOMDocument

Table of Contents

OPTION_EVALUATE_PHP  = "executePHP"
UNDEFINED  = "b0814351-6e51-4134-a77b-8e5fbec4e026"
$constructorCalled  : mixed
__call()  : mixed
Magic method for function calls, this can be used to call any methods supported by DOMElement on the documentElement of this document
__construct()  : mixed
Constructor for the DOMDocument
__get()  : mixed
Magic method for getting properties. Only "html" is supported presently.
convertUTF8ToHTMLEntities()  : string
Converts UTF8 characters to their HTML entity equivalents
create()  : mixed
getDocumentElementSafe()  : DOMElement
Function to safely get the document element. Some PHP builds do not implement documentElement, this function can be used to safely retrieve the document element in absense of this property.
import()  : DOMObject
This function will import the specified content to be used inside this document.
load()  : This
Loads the named file
loadHTML()  : This
Loads the supplied HTML string
save()  : int|false
Saves the entire document as HTML5, into the specified file.
saveHTML()  : string|false
Saves the whole document, or specified element, as a HTML string
saveInnerBody()  : string
This function saves only the inside of the <body> element of this document. This is useful when you want to import a HTML document into another, but you don't want to end up with nested <html> elements. This is equivalent to using the "html" property.
shorthand()  : mixed
onLoaded()  : null
Callback which fires after the HTML has been parsed and loaded, but before loadHTML returns. Useful for controlling the execution order for operations spread across an inheritance chain.
assertNotEmpty()  : mixed

Constants

OPTION_EVALUATE_PHP

public mixed OPTION_EVALUATE_PHP = "executePHP"

UNDEFINED

public mixed UNDEFINED = "b0814351-6e51-4134-a77b-8e5fbec4e026"

Properties

$constructorCalled

private mixed $constructorCalled = false

Methods

__call()

Magic method for function calls, this can be used to call any methods supported by DOMElement on the documentElement of this document

public __call(mixed $name, mixed $arguments) : mixed
Parameters
$name : mixed
$arguments : mixed
Tags
see
DOMElement

for a list of supported methods

Return values
mixed

__construct()

Constructor for the DOMDocument

public __construct() : mixed
Return values
mixed

__get()

Magic method for getting properties. Only "html" is supported presently.

public __get(mixed $name) : mixed
Parameters
$name : mixed
Return values
mixed

convertUTF8ToHTMLEntities()

Converts UTF8 characters to their HTML entity equivalents

public static convertUTF8ToHTMLEntities(string $html) : string
Parameters
$html : string

A HTML string to perform conversion on

Return values
string

The converted HTML string

create()

public create(mixed $html) : mixed
Parameters
$html : mixed
Return values
mixed

getDocumentElementSafe()

Function to safely get the document element. Some PHP builds do not implement documentElement, this function can be used to safely retrieve the document element in absense of this property.

public getDocumentElementSafe() : DOMElement
Return values
DOMElement

The document element for this document

import()

This function will import the specified content to be used inside this document.

public import(mixed $subject) : DOMObject
Parameters
$subject : mixed

The subject, a HTML fragment string, DOMElement from another document, or another DOMDocument.

Return values
DOMObject

The resulting element(s)

load()

Loads the named file

public load(mixed $filename[, array<string|int, mixed> $options = array() ]) : This
Parameters
$filename : mixed
$options : array<string|int, mixed> = array()

An array of options. Presently only DOMDocument::OPTION_EVALUATE_PHP is supported, this defaults to TRUE and will execute inline PHP

Tags
see
https://github.com/Masterminds/html5-php#options

for other options supported by the HTML5 parser

Return values
This

document, for method chaining

loadHTML()

Loads the supplied HTML string

public loadHTML(string $src[, array<string|int, mixed> $options = array() ]) : This
Parameters
$src : string

The HTML string to parse

$options : array<string|int, mixed> = array()

An array of options. Presently only DOMDocument::OPTION_EXECUTE_PHP is supported, this defaults to TRUE and will execute inline PHP

Tags
see
https://github.com/Masterminds/html5-php#options

for other options supported by the HTML5 parser

Return values
This

document, for method chaining

save()

Saves the entire document as HTML5, into the specified file.

public save(string $filename[, array<string|int, mixed> $options = array() ]) : int|false
Parameters
$filename : string

The name of the file to save to

$options : array<string|int, mixed> = array()

An array of options to pass to the HTML5 parser

Tags
see
https://github.com/Masterminds/html5-php#options

for other options supported by the HTML5 parser

Return values
int|false

saveHTML()

Saves the whole document, or specified element, as a HTML string

public saveHTML([mixed $element = null ][, array<string|int, mixed> $options = array() ]) : string|false
Parameters
$element : mixed = null
$options : array<string|int, mixed> = array()

An array of options to pass to the HTML5 parser

Tags
see
https://github.com/Masterminds/html5-php#options

for other options supported by the HTML5 parser

Return values
string|false

saveInnerBody()

This function saves only the inside of the <body> element of this document. This is useful when you want to import a HTML document into another, but you don't want to end up with nested <html> elements. This is equivalent to using the "html" property.

public saveInnerBody() : string
Return values
string

The HTML string

shorthand()

public shorthand() : mixed
Return values
mixed

onLoaded()

Callback which fires after the HTML has been parsed and loaded, but before loadHTML returns. Useful for controlling the execution order for operations spread across an inheritance chain.

protected onLoaded() : null
Return values
null

assertNotEmpty()

private assertNotEmpty() : mixed
Return values
mixed

Search results