PHP Class Habari\HTMLTokenSet

Inheritance: implements Iterator, implements ArrayAccess
Mostrar archivo Open project: habari/system

Public Properties

Property Type Description
$escape

Protected Properties

Property Type Description
$sliceOffsetBegin
$sliceOffsetLength
$tokens

Public Methods

Method Description
__construct ( $escape = true )
__tostring ( )
current ( )
end ( )
get_end_offset ( ) : integer Get the offset of the last token in this HTMLTokenSet
insert ( HTMLTokenset $set, $pos ) : Nothing Insert an HTMLTokenset before the given position
key ( )
next ( )
offsetExists ( $offset ) ArrayAccess implementation
offsetGet ( $offset )
offsetSet ( $offset, $value )
offsetUnset ( $offset )
replace_slice ( HTMLTokenSet $slice ) : nothing Replace a set of tokens in this HTMLTokenSet
rewind ( ) Iterator implemetation:
slice ( mixed $names, array $attr = null ) : array Fetch a section of the tokens, based on passed criteria
token_to_string ( array $token, boolean $escape = true ) : string Convert a token to a string
tokenize_replace ( string $source ) : HTMLTokenSet Replace a full set of tokens with new tokens. The tokens are replaced in place as well as being returned
trim_container ( ) : nothing Remove the first and last tokens from this HTMLTokenSet
valid ( )

Protected Methods

Method Description
find_slice ( integer $offset, string $name, array $attr ) : HTMLTokenSet This is a support function for HTMLTokenSet::slice(). It finds a specific slice

Method Details

__construct() public method

public __construct ( $escape = true )

__tostring() public method

public __tostring ( )

current() public method

public current ( )

end() public method

public end ( )

find_slice() protected method

This is a support function for HTMLTokenSet::slice(). It finds a specific slice
protected find_slice ( integer $offset, string $name, array $attr ) : HTMLTokenSet
$offset integer The offset at which to start looking for relevant tokens
$name string The name of the html tag being searched for
$attr array The attributes of the html tag being searched for
return HTMLTokenSet

get_end_offset() public method

Get the offset of the last token in this HTMLTokenSet
public get_end_offset ( ) : integer
return integer the offset of the last token in this HTMLTokenSet

insert() public method

Insert an HTMLTokenset before the given position
public insert ( HTMLTokenset $set, $pos ) : Nothing
$set HTMLTokenset
return Nothing

key() public method

public key ( )

next() public method

public next ( )

offsetExists() public method

ArrayAccess implementation
public offsetExists ( $offset )

offsetGet() public method

public offsetGet ( $offset )

offsetSet() public method

public offsetSet ( $offset, $value )

offsetUnset() public method

public offsetUnset ( $offset )

replace_slice() public method

Replace a set of tokens in this HTMLTokenSet
public replace_slice ( HTMLTokenSet $slice ) : nothing
$slice HTMLTokenSet The tokens to insert in place of the old tokens
return nothing

rewind() public method

Iterator implemetation:
public rewind ( )

slice() public method

Fetch a section of the tokens, based on passed criteria
public slice ( mixed $names, array $attr = null ) : array
$names mixed The name of an html tag, or an array of names of html tags to get the tokens of
$attr array Any attributes for the token that you want to filter by
return array An array of the HTMLTokenSets that were found

token_to_string() public static method

Convert a token to a string
public static token_to_string ( array $token, boolean $escape = true ) : string
$token array The token to convert
$escape boolean Whether to escape the string that is returned
return string The string representation of the token

tokenize_replace() public method

Replace a full set of tokens with new tokens. The tokens are replaced in place as well as being returned
public tokenize_replace ( string $source ) : HTMLTokenSet
$source string The text to create the new set of tokens from
return HTMLTokenSet The new set of tokens created

trim_container() public method

Remove the first and last tokens from this HTMLTokenSet
public trim_container ( ) : nothing
return nothing

valid() public method

public valid ( )

Property Details

$escape public_oe property

public $escape

$sliceOffsetBegin protected_oe property

protected $sliceOffsetBegin

$sliceOffsetLength protected_oe property

protected $sliceOffsetLength

$tokens protected_oe property

protected $tokens