BBCodeMonkey
class BBCodeMonkey
Constants
REGEXP |
Expression that matches a regexp such as /foo/i |
Properties
array | $allowedFilters | ||
protected Configurator | $configurator | ||
array | $tokenRegexp | ||
array | $unfilteredTokens |
Methods
Create a BBCode based on its reference usage
Parse a string of attribute definitions and add the attributes/options to the tag/BBCode
Convert a human-readable value to a typed PHP value
Parse and return all the tokens contained in a definition
Generate an attribute based on a token
Append a list of filters to an attribute's filterChain
Test whether a token's name is the name of a filter
Parse the option string into an associative array
Details
at line 94
__construct(Configurator $configurator)
Constructor
at line 107
array
create(string $usage, string|Template $template)
Create a BBCode and its underlying tag and template(s) based on its reference usage
at line 175
protected array
parse(string $usage)
Create a BBCode based on its reference usage
at line 346
protected array
addAttributes(array $definitions, BBCode $bbcode, Tag $tag)
Parse a string of attribute definitions and add the attributes/options to the tag/BBCode
Attributes come in two forms. Most commonly, in the form of a single token, e.g. [a href={URL} title={TEXT}]
Sometimes, however, we need to parse more than one single token. For instance, the phpBB [FLASH] BBCode uses two tokens separated by a comma: [flash={NUMBER},{NUMBER}]{URL}[/flash]
In addition, some custom BBCodes circulating for phpBB use a combination of token and static text such as: [youtube]http://www.youtube.com/watch?v={SIMPLETEXT}[/youtube]
Any attribute that is not a single token is implemented as an attribute preprocessor, with each token generating a matching attribute. Tentatively, those of those attributes are created by taking the attribute preprocessor's name and appending a unique number counting the number of created attributes. In the [FLASH] example above, an attribute preprocessor named "flash" would be created as well as two attributes named "flash0" and "flash1" respectively.
at line 551
protected bool|string
convertValue(string $value)
Convert a human-readable value to a typed PHP value
at line 572
protected array
parseTokens(string $definition)
Parse and return all the tokens contained in a definition
at line 664
protected Attribute
generateAttribute(array $token)
Generate an attribute based on a token
at line 771
protected void
appendFilters(Attribute $attribute, string $filters)
Append a list of filters to an attribute's filterChain
at line 792
protected bool
isFilter(string $tokenId)
Test whether a token's name is the name of a filter
at line 823
protected array
parseOptionString(string $string)
Parse the option string into an associative array