Class SSHTMLBBCodeParser
Direct known subclasses
Indirect known subclasses
SSHTMLBBCodeParser_Filter_Basic,
SSHTMLBBCodeParser_Filter_EmailLinks,
SSHTMLBBCodeParser_Filter_Extended,
SSHTMLBBCodeParser_Filter_Images,
SSHTMLBBCodeParser_Filter_Links,
SSHTMLBBCodeParser_Filter_Lists
Package: sapphire\misc
Author: Stijn de Reede <sjr@gmx.co.uk> , SilverStripe This is a parser to replace UBB style tags with their html equivalents. It does not simply do some regex calls, but is complete stack based parse engine. This ensures that all tags are properly nested, if not, extra tags are added to maintain the nesting. This parser should only produce xhtml 1.0 compliant code. All tags are validated and so are all their attributes. It should be easy to extend this parser with your own tags, see the _definedTags format description below. Usage: $parser = new SSHTMLBBCodeParser(); $parser->setText('normal [b]bold[/b] and normal again'); $parser->parse(); echo $parser->getParsed(); or: $parser = new SSHTMLBBCodeParser(); echo $parser->qparse('normal [b]bold[/b] and normal again'); or: echo SSHTMLBBCodeParser::staticQparse('normal [b]bold[/b] and normal again'); Setting the options from the ini file: $config = parse_ini_file('BBCodeParser.ini', true); $options = &PEAR::getStaticProperty('SSHTMLBBCodeParser', '_options'); $options = $config['SSHTMLBBCodeParser']; unset($options);
Located at sapphire/parsers/HTML/HTMLBBCodeParser.php
Author: Stijn de Reede <sjr@gmx.co.uk> , SilverStripe This is a parser to replace UBB style tags with their html equivalents. It does not simply do some regex calls, but is complete stack based parse engine. This ensures that all tags are properly nested, if not, extra tags are added to maintain the nesting. This parser should only produce xhtml 1.0 compliant code. All tags are validated and so are all their attributes. It should be easy to extend this parser with your own tags, see the _definedTags format description below. Usage: $parser = new SSHTMLBBCodeParser(); $parser->setText('normal [b]bold[/b] and normal again'); $parser->parse(); echo $parser->getParsed(); or: $parser = new SSHTMLBBCodeParser(); echo $parser->qparse('normal [b]bold[/b] and normal again'); or: echo SSHTMLBBCodeParser::staticQparse('normal [b]bold[/b] and normal again'); Setting the options from the ini file: $config = parse_ini_file('BBCodeParser.ini', true); $options = &PEAR::getStaticProperty('SSHTMLBBCodeParser', '_options'); $options = $config['SSHTMLBBCodeParser']; unset($options);
Located at sapphire/parsers/HTML/HTMLBBCodeParser.php
Methods summary
public
none
|
|
public
&
|
|
public
|
|
public
|
|
public
|
|
public
boolean
|
|
public
none
|
|
public
none
|
|
public
array
|
|
public
none
|
|
public
boolean
|
|
public
boolean
|
|
public
boolean
|
|
public
none
|
|
public
none
|
|
public
string
|
|
public
string
|
|
public
string
|
|
public
none
|
|
public
none
|
|
public
none
|
Magic methods summary
Properties summary
public
array
|
$_definedTags |
#
An array of tags parsed by the engine, should be overwritten by filters |
public
string
|
$_text |
#
A string containing the input |
public
string
|
$_preparsed |
#
A string containing the preparsed input |
public
array
|
$_tagArray |
#
An array tags and texts build from the input text |
public
string
|
$_parsed |
#
A string containing the parsed version of the text |
public
array
|
$_options |
#
An array of options, filled by an ini file or through the contructor |
public
array
|
$_filters |
#
An array of filters used for parsing |