PHP Class simple_html_dom, vanilla

Paperg - change $size from protected to public so we can easily access it Paperg - added ForceTagsClosed in the constructor which tells us whether we trust the html or not. Default is to NOT trust it.
Exibir arquivo Open project: vanilla/vanilla Class Usage Examples

Public Properties

Property Type Description
$callback
$lowercase
$nodes
$root
$size

Protected Properties

Property Type Description
$_charset
$_target_charset
$block_tags
$char
$cursor
$default_br_text
$doc
$noise
$optional_closing_tags B tags that are not closed cause us to return everything to the end of the document.
$parent
$pos
$self_closing_tags ..
$token_attr
$token_blank
$token_equal
$token_slash

Public Methods

Method Description
__construct ( $str = null, $lowercase = true, $forceTagsClosed = true, $target_charset = DEFAULT_TARGET_CHARSET, $stripRN = true, $defaultBRText = DEFAULT_BR_TEXT )
__destruct ( )
__get ( $name )
__toString ( )
childNodes ( $idx ) camel naming conventions
clear ( ) clean up memory due to php5 circular references memory leak.
dump ( $show_attr = true )
find ( $selector, $idx = null, $lowercase = false ) Paperg - allow us to specify that we want case insensitive testing of the value of the selector.
firstChild ( )
getElementById ( $id )
getElementByTagName ( $name )
getElementsById ( $id, $idx = null )
getElementsByTagName ( $name, $idx )
lastChild ( )
load ( $str, $lowercase = true, $stripRN = true, $defaultBRText = DEFAULT_BR_TEXT ) load html from string
loadFile ( )
load_file ( ) load html from file
remove_callback ( ) remove callback function
restore_noise ( $text ) restore noise to html content
save ( $filepath = '' ) save dom as string
set_callback ( $function_name ) set callback function

Protected Methods

Method Description
as_text_node ( $tag ) as a text node
copy_skip ( $chars )
copy_until ( $chars )
copy_until_char ( $char )
copy_until_char_escape ( $char )
link_nodes ( &$node, $is_child ) link node's parent
parse ( ) parse html content
parse_attr ( $node, $name, &$space ) parse attributes
parse_charset ( ) (or the content_type header fromt eh last transfer), we will parse THAT, and if a charset is specified, we will use it over any other mechanism.
prepare ( $str, $lowercase = true, $stripRN = true, $defaultBRText = DEFAULT_BR_TEXT ) prepare HTML data and init everything
read_tag ( ) read tag info
remove_noise ( $pattern, $remove_tag = false ) remove noise from html content
skip ( $chars )

Method Details

__construct() public method

public __construct ( $str = null, $lowercase = true, $forceTagsClosed = true, $target_charset = DEFAULT_TARGET_CHARSET, $stripRN = true, $defaultBRText = DEFAULT_BR_TEXT )

__destruct() public method

public __destruct ( )

__get() public method

public __get ( $name )

__toString() public method

public __toString ( )

as_text_node() protected method

as a text node
protected as_text_node ( $tag )

childNodes() public method

camel naming conventions
public childNodes ( $idx )

clear() public method

..
public clear ( )

copy_skip() protected method

protected copy_skip ( $chars )

copy_until() protected method

protected copy_until ( $chars )

copy_until_char() protected method

protected copy_until_char ( $char )

copy_until_char_escape() protected method

protected copy_until_char_escape ( $char )

dump() public method

public dump ( $show_attr = true )

find() public method

Paperg - allow us to specify that we want case insensitive testing of the value of the selector.
public find ( $selector, $idx = null, $lowercase = false )

firstChild() public method

public firstChild ( )

getElementById() public method

public getElementById ( $id )

getElementByTagName() public method

public getElementByTagName ( $name )

getElementsById() public method

public getElementsById ( $id, $idx = null )

getElementsByTagName() public method

public getElementsByTagName ( $name, $idx )

lastChild() public method

public lastChild ( )

load() public method

load html from string
public load ( $str, $lowercase = true, $stripRN = true, $defaultBRText = DEFAULT_BR_TEXT )

loadFile() public method

public loadFile ( )

load_file() public method

load html from file
public load_file ( )

parse() protected method

parse html content
protected parse ( )

parse_attr() protected method

parse attributes
protected parse_attr ( $node, $name, &$space )

parse_charset() protected method

(or the content_type header fromt eh last transfer), we will parse THAT, and if a charset is specified, we will use it over any other mechanism.
protected parse_charset ( )

prepare() protected method

prepare HTML data and init everything
protected prepare ( $str, $lowercase = true, $stripRN = true, $defaultBRText = DEFAULT_BR_TEXT )

read_tag() protected method

read tag info
protected read_tag ( )

remove_callback() public method

remove callback function
public remove_callback ( )

remove_noise() protected method

remove noise from html content
protected remove_noise ( $pattern, $remove_tag = false )

restore_noise() public method

restore noise to html content
public restore_noise ( $text )

save() public method

save dom as string
public save ( $filepath = '' )

set_callback() public method

set callback function
public set_callback ( $function_name )

skip() protected method

protected skip ( $chars )

Property Details

$_charset protected_oe property

protected $_charset

$_target_charset protected_oe property

protected $_target_charset

$block_tags protected_oe property

protected $block_tags

$callback public_oe property

public $callback

$char protected_oe property

protected $char

$cursor protected_oe property

protected $cursor

$default_br_text protected_oe property

protected $default_br_text

$doc protected_oe property

protected $doc

$lowercase public_oe property

public $lowercase

$nodes public_oe property

public $nodes

$noise protected_oe property

protected $noise

$optional_closing_tags protected_oe property

B tags that are not closed cause us to return everything to the end of the document.
protected $optional_closing_tags

$parent protected_oe property

protected $parent

$pos protected_oe property

protected $pos

$root public_oe property

public $root

$self_closing_tags protected_oe property

..
protected $self_closing_tags

$size public_oe property

public $size

$token_attr protected_oe property

protected $token_attr

$token_blank protected_oe property

protected $token_blank

$token_equal protected_oe property

protected $token_equal

$token_slash protected_oe property

protected $token_slash