vB_Utility_Template_Tokenizer
in package
uses
vB_Utility_Trait_NoSerialize
A derivative of an HTML/XML tokenizing parser, used to parse special tags.
Parses special tags embedded in an HTML document. This differs from a standard
HTML parser in that the special tags can be embedded within valid HTML tags.
Eg: <a
Uses state based parsing to move through the string, maintaining a pointer to the current position in the string.
Table of Contents
Methods
- __construct() : mixed
- Constructor. Sets up the class and creates the tag search array as an optimization.
- __serialize() : array<string|int, mixed>
- __sleep() : array<string|int, mixed>
- __unserialize() : void
- __wakeup() : void
- fetch_dom_compatible() : array<string|int, mixed>
- Fetchs a DOM-class compatible version of the tokens.
- get_errors() : mixed
- Returns any parse errors.
- get_tokens() : array<string|int, mixed>
- Returns then tokens associated with the parser
- parse() : array<string|int, mixed>
- Parses the data into tokens.
Methods
__construct()
Constructor. Sets up the class and creates the tag search array as an optimization.
public
__construct([mixed $namespace = 'vb' ][, mixed $tag_list = [] ]) : mixed
Parameters
- $namespace : mixed = 'vb'
- $tag_list : mixed = []
__serialize()
public
__serialize() : array<string|int, mixed>
Return values
array<string|int, mixed>__sleep()
public
__sleep() : array<string|int, mixed>
Return values
array<string|int, mixed>__unserialize()
public
__unserialize(mixed $serialized) : void
Parameters
- $serialized : mixed
__wakeup()
public
__wakeup() : void
fetch_dom_compatible()
Fetchs a DOM-class compatible version of the tokens.
public
fetch_dom_compatible() : array<string|int, mixed>
Note that this only works if the token list is valid XML! It will error otherwise!
Return values
array<string|int, mixed> —DOM-compatible output
get_errors()
Returns any parse errors.
public
get_errors() : mixed
get_tokens()
Returns then tokens associated with the parser
public
get_tokens() : array<string|int, mixed>
Return values
array<string|int, mixed>parse()
Parses the data into tokens.
public
parse(mixed $data) : array<string|int, mixed>
Parameters
- $data : mixed
Return values
array<string|int, mixed> —The tokenized data