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.
Show file 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 property

protected $_charset

$_target_charset protected property

protected $_target_charset

$block_tags protected property

protected $block_tags

$callback public property

public $callback

$char protected property

protected $char

$cursor protected property

protected $cursor

$default_br_text protected property

protected $default_br_text

$doc protected property

protected $doc

$lowercase public property

public $lowercase

$nodes public property

public $nodes

$noise protected property

protected $noise

$optional_closing_tags protected property

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

$parent protected property

protected $parent

$pos protected property

protected $pos

$root public property

public $root

$self_closing_tags protected property

..
protected $self_closing_tags

$size public property

public $size

$token_attr protected property

protected $token_attr

$token_blank protected property

protected $token_blank

$token_equal protected property

protected $token_equal

$token_slash protected property

protected $token_slash