Property | Type | Description | |
---|---|---|---|
$root | Contains the root node of this dom tree. |
Property | Type | Description | |
---|---|---|---|
$content | The document string. | ||
$defaultCharset | string | The charset we would like the output to be in. | |
$globalOptions | array | A global options array to be used by all load calls. | |
$options | A persistent option object to be used for all options in the parsing of the file. | ||
$raw | string | The raw version of the document string. | |
$rawSize | integer | The original file size of the document. | |
$selfClosing | array | A list of tags which will always be self closing | |
$size | integer | The size of the document after it is cleaned. |
Method | Description | |
---|---|---|
__get ( string $name ) : mixed | A simple wrapper around the root node. | |
__toString ( ) : string | Returns the inner html of the root node. | |
addSelfClosingTag ( string | array $tag ) | Adds the tag (or tags in an array) to the list of tags that will always be self closing. | |
clearSelfClosingTags ( ) | Sets the list of self closing tags to empty. | |
find ( string $selector, integer $nth = null ) : array | Find elements by css selector on the root node. | |
firstChild ( ) : |
Simple wrapper function that returns the first child. | |
getElementById ( string $id ) : |
Simple wrapper function that returns an element by the id. | |
getElementsByClass ( string $class ) : array | Simple wrapper function that returns all elements by class name. | |
getElementsByTag ( string $name ) : array | Simple wrapper function that returns all elements by tag name. | |
lastChild ( ) : |
Simple wrapper function that returns the last child. | |
load ( string $str, array $options = [] ) | Attempts to load the dom from any resource, string, file, or URL. | |
loadFromFile ( string $file, array $options = [] ) | Loads the dom from a document file/url | |
loadFromUrl ( string $url, array $options = [], phphtmlparser\CurlInterface $curl = null ) | Use a curl interface implementation to attempt to load the content from a url. | |
loadStr ( string $str, array $option ) | Parsers the html of the given string. Used for load(), loadFromFile(), and loadFromUrl(). | |
removeSelfClosingTag ( string | array $tag ) | Removes the tag (or tags in an array) from the list of tags that will always be self closing. | |
setOptions ( array $options ) | Sets a global options array to be used by all load calls. |
Method | Description | |
---|---|---|
clean ( string $str ) : string | Cleans the html of any none-html information. | |
detectCharset ( ) : boolean | Attempts to detect the charset that the html was sent in. | |
isLoaded ( ) | Checks if the load methods have been called. | |
parse ( ) | Attempts to parse the html in content. | |
parseTag ( ) : array | Attempt to parse a tag out of the content. |
public __toString ( ) : string | ||
return | string |
public addSelfClosingTag ( string | array $tag ) | ||
$tag | string | array |
public clearSelfClosingTags ( ) |
protected detectCharset ( ) : boolean | ||
return | boolean |
public firstChild ( ) : |
||
return |
public getElementById ( string $id ) : |
||
$id | string | |
return |
public getElementsByClass ( string $class ) : array | ||
$class | string | |
return | array |
public getElementsByTag ( string $name ) : array | ||
$name | string | |
return | array |
public lastChild ( ) : |
||
return |
public loadFromFile ( string $file, array $options = [] ) | ||
$file | string | |
$options | array |
public loadFromUrl ( string $url, array $options = [], phphtmlparser\CurlInterface $curl = null ) | ||
$url | string | |
$options | array | |
$curl | phphtmlparser\CurlInterface |
public removeSelfClosingTag ( string | array $tag ) | ||
$tag | string | array |
public setOptions ( array $options ) | ||
$options | array |
protected Content,phphtmlparser $content | ||
return |
protected string $defaultCharset | ||
return | string |
protected array $globalOptions | ||
return | array |
protected Options,phphtmlparser $options | ||
return |
protected string $raw | ||
return | string |
protected int $rawSize | ||
return | integer |
public HtmlNode,PHPHtmlParser\Dom $root | ||
return |
protected array $selfClosing | ||
return | array |
protected int $size | ||
return | integer |