SSHTMLBBCodeParser
class SSHTMLBBCodeParser
Properties
array | $_definedTags | An array of tags parsed by the engine, should be overwritten by filters | |
string | $_text | A string containing the input | |
string | $_preparsed | A string containing the preparsed input | |
array | $_tagArray | An array tags and texts build from the input text | |
string | $_parsed | A string containing the parsed version of the text | |
array | $_options | An array of options, filled by an ini file or through the contructor | |
array | $_filters | An array of filters used for parsing |
Methods
Constructor, initialises the options and filters
No description
Option setter
Add a new filter
Remove an existing filter
Add new filters
Executes statements before the actual array building starts
Builds the tag array from the input string $_text
Builds a tag from the input string
Validates the tag array, regarding the allowed tags
Checks to see if a parent is needed
Checks to see if a child is needed
Checks to see if a tag is allowed inside another tag
Builds a parsed string based on the tag array
Sets text in the object to be parsed
Gets the unparsed text from the object
Gets the preparsed text from the object
Gets the parsed text from the object
Parses the text set in the object
Quick method to do setText(), parse() and getParsed at once
Quick static method to do setText(), parse() and getParsed at once
Details
at line 139
none
__construct(array $options = array())
Constructor, initialises the options and filters
Sets the private variable _options with base options defined with &PEAR::getStaticProperty(), overwriting them with (if present) the argument to this method. Then it sets the extra options to properly escape the tag characters in preg_replace() etc. The set options are then stored back with &PEAR::getStaticProperty(), so that the filter classes can use them. All the filters in the options are initialised and their defined tags are copied into the private variable _definedTags.
at line 180
static
getStaticProperty($class, $var)
at line 199
setOption(string $name, mixed $value)
Option setter
at line 210
addFilter(string $filter)
Add a new filter
at line 239
removeFilter(string $filter)
Remove an existing filter
at line 263
boolean
addFilters(mixed $filters)
Add new filters
at line 301
none
_preparse()
Executes statements before the actual array building starts
This method should be overwritten in a filter if you want to do something before the parsing process starts. This can be useful to allow certain short alternative tags which then can be converted into proper tags with preg_replace() calls. The main class walks through all the filters and and calls this method. The filters should modify their private $_preparsed variable, with input from $_text.
at line 336
none
_buildTagArray()
Builds the tag array from the input string $_text
An array consisting of tag and text elements is contructed from the $_preparsed variable. The method uses _buildTag() to check if a tag is valid and to build the actual tag to be added to the tag array.
at line 414
array
_buildTag(string $str)
Builds a tag from the input string
This method builds a tag array based on the string it got as an
argument. If the tag is invalid,
at line 486
none
_validateTagArray()
Validates the tag array, regarding the allowed tags
While looping through the tag array, two following text tags are joined, and it is checked that the tag is allowed inside the last opened tag. By remembering what tags have been opened it is checked that there is correct (xml compliant) nesting. In the end all still opened tags are closed.
at line 607
boolean
_parentNeeded(array $out, array $in)
Checks to see if a parent is needed
Checks to see if the current $in tag has an appropriate parent. If it does, then it returns false. If a parent is needed, then it returns the first tag in the list to add to the stack.
at line 647
boolean
_childNeeded(array $out, array $in)
Checks to see if a child is needed
Checks to see if the current $out tag has an appropriate child. If it does, then it returns false. If a child is needed, then it returns the first tag in the list to add to the stack.
at line 685
boolean
_isAllowed(array $out, array $in)
Checks to see if a tag is allowed inside another tag
The allowed tags are extracted from the private _definedTags array.
at line 717
none
_buildParsedString()
Builds a parsed string based on the tag array
The correct html and attribute values are extracted from the private _definedTags array.
at line 774
none
setText(string $str)
Sets text in the object to be parsed
at line 788
string
getText()
Gets the unparsed text from the object
at line 802
string
getPreparsed()
Gets the preparsed text from the object
at line 816
string
getParsed()
Gets the parsed text from the object
at line 832
none
parse()
Parses the text set in the object
at line 849
none
qparse($str)
Quick method to do setText(), parse() and getParsed at once
at line 865
none
staticQparse($str)
Quick static method to do setText(), parse() and getParsed at once