PHP Class simplehtmldom_1_5\simple_html_dom

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: sunra/php-simple-html-dom-parser

Public Properties

Property Type Description
$_charset Note that this is referenced by a child node, and so it needs to be public for that node to see this information.
$_target_charset
$callback
$default_span_text
$lowercase
$nodes
$original_size Used to keep track of how large the text was when we started.
$root simple_html_dom_node
$size

Protected Properties

Property Type Description
$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, $defaultSpanText = DEFAULT_SPAN_TEXT )
__destruct ( )
__get ( $name )
__toString ( )
childNodes ( $idx ) camel naming conventions
clear ( ) clean up memory due to php5 circular references memory leak.
createElement ( $name, $value = null )
createTextNode ( $value )
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, $defaultSpanText = DEFAULT_SPAN_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
search_noise ( $text ) Sometimes we NEED one of the noise elements.
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 from the 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, $defaultSpanText = DEFAULT_SPAN_TEXT ) prepare HTML data and init everything
read_tag ( ) read tag info
remove_noise ( $pattern, $remove_tag = false ) save the noise in the $this->noise array.
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, $defaultSpanText = DEFAULT_SPAN_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 )

createElement() public method

public createElement ( $name, $value = null )

createTextNode() public method

public createTextNode ( $value )

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, $defaultSpanText = DEFAULT_SPAN_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 from the 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, $defaultSpanText = DEFAULT_SPAN_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

save the noise in the $this->noise array.
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 = '' )

search_noise() public method

Sometimes we NEED one of the noise elements.
public search_noise ( $text )

set_callback() public method

set callback function
public set_callback ( $function_name )

skip() protected method

protected skip ( $chars )

Property Details

$_charset public property

Note that this is referenced by a child node, and so it needs to be public for that node to see this information.
public $_charset

$_target_charset public property

public $_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

$default_span_text public property

public $default_span_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

$original_size public property

Used to keep track of how large the text was when we started.
public $original_size

$parent protected property

protected $parent

$pos protected property

protected $pos

$root public property

public simple_html_dom_node,simplehtmldom_1_5 $root
return simple_html_dom_node

$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