|
const | TYPE_TAG = 0 |
|
const | TYPE_FUNCTION = 1 |
|
| $forTagExtensions |
|
| $forParserFunctions |
|
const | FH_NO_HASH = 1 |
|
|
| $validator |
|
| $parser |
|
| $frame |
|
| $currentType |
|
| $parserHookOptions |
|
|
static | $registeredHooks = array() |
|
Class for out of the box parser hook functionality integrated with the validation provided by Validator.
- Since
- 0.4
- Deprecated:
- since 1.0 in favour of the ParserHooks library
GNU GPL v2+
- Author
- Jeroen De Dauw < jeroe.nosp@m.nded.nosp@m.auw@g.nosp@m.mail.nosp@m..com >
-
Daniel Werner
◆ __construct()
ParserHook::__construct |
( |
|
$forTagExtensions = true , |
|
|
|
$forParserFunctions = true , |
|
|
|
$flags = 0 |
|
) |
| |
Constructor.
- Since
- 0.4
- Parameters
-
boolean | $forTagExtensions | |
boolean | $forParserFunctions | |
integer | $flag | combination of option flags to manipulare the parser hooks characteristics. The following are available:
|
◆ getDefaultParameters()
ParserHook::getDefaultParameters |
( |
|
$type | ) |
|
|
protected |
Returns the list of default parameters. These parameters can be used as unnamed parameters where it is not necessary to use the name and the '=' as long as there is no '=' within the value. It is possible to define that a parameter should not have a named fallback. Therefore the information has to be returnd as sub-array with the parameter name as first and Validator::PARAM_UNNAMED as second value. Parameter using this option must be set first, before any unnamed parameter in the same order as set here. All parameters defined before the last parameter making use of Validator::PARAM_UNNAMED will automatically be populated with this option.
Override in deriving classes to add default parameters.
- Since
- 0.4
- Parameters
-
integer | $type | Item of the ParserHook::TYPE_ enum |
- Returns
- array
◆ getDescription()
ParserHook::getDescription |
( |
| ) |
|
Returns a description for the parser hook, or false when there is none. Override in deriving classes to add a message.
- Since
- 0.4.3
- Deprecated:
- since 1.0
- Returns
- mixed string or false
◆ getDescriptionData()
ParserHook::getDescriptionData |
( |
|
$type | ) |
|
Returns the data needed to describe the parser hook. This is mainly needed because some of the individual get methods that return the needed data are protected, and cannot be made public without breaking b/c in a rather bad way.
- Since
- 0.4.3
- Parameters
-
integer | $type | Item of the ParserHook::TYPE_ enum |
- Returns
- array
◆ getErrorsToDisplay()
ParserHook::getErrorsToDisplay |
( |
| ) |
|
|
protected |
Returns the ProcessingError objects for the errors and warnings that should be displayed.
- Since
- 0.4
- Returns
- array of array of ProcessingError
◆ getFunctionOptions()
ParserHook::getFunctionOptions |
( |
| ) |
|
|
protected |
Returns the parser function otpions.
- Since
- 0.4
- Returns
- array
◆ getHookClassName()
static ParserHook::getHookClassName |
( |
|
$hookName | ) |
|
|
static |
Returns the name of the ParserHook deriving class that defines a certain parser hook, or false if there is none.
- Since
- 0.4.3
- Parameters
-
- Returns
- mixed string or false
◆ getMessage()
ParserHook::getMessage |
( |
| ) |
|
Returns a description message for the parser hook, or false when there is none. Override in deriving classes to add a message.
- Since
- 0.4.10
- Returns
- mixed string or false
◆ getName()
Gets the name of the parser hook.
- Since
- 0.4
- Returns
- string or array of string
◆ getNames()
Returns an array with the names for the parser hook.
- Since
- 0.4
- Returns
- array
◆ getParameterInfo()
ParserHook::getParameterInfo |
( |
|
$type | ) |
|
|
protected |
Returns an array containing the parameter info. Override in deriving classes to add parameter info.
- Since
- 0.4
- Parameters
-
integer | $type | Item of the ParserHook::TYPE_ enum |
- Returns
- array
◆ getRegisteredParserHooks()
static ParserHook::getRegisteredParserHooks |
( |
| ) |
|
|
static |
Returns an array of registered parser hooks (keys) and their handling ParserHook deriving class names (values).
- Since
- 0.4.3
- Returns
- array
◆ init()
ParserHook::init |
( |
Parser & |
$parser | ) |
|
Function to hook up the coordinate rendering functions to the parser.
- Since
- 0.4
- Parameters
-
- Returns
- true
◆ isFunction()
ParserHook::isFunction |
( |
| ) |
|
|
protected |
Returns if the current render request is coming from a parser function.
- Since
- 0.4.4
- Returns
- boolean
◆ isTag()
Returns if the current render request is coming from a tag extension.
- Since
- 0.4.4
- Returns
- boolean
◆ magic()
ParserHook::magic |
( |
array & |
$magicWords, |
|
|
|
$langCode |
|
) |
| |
Function to add the magic word in pre MW 1.16.
- Since
- 0.4
- Parameters
-
array | $magicWords | |
string | $langCode | |
- Returns
- boolean
◆ parseWikitext()
ParserHook::parseWikitext |
( |
|
$text | ) |
|
|
protected |
Utility function to parse wikitext without having to care about handling a tag extension or parser function.
- Since
- 0.4.4
- Parameters
-
string | $text | The wikitext to be parsed |
- Returns
- string the parsed output
◆ render()
ParserHook::render |
( |
array |
$parameters | ) |
|
|
abstractprotected |
Renders and returns the output.
- Since
- 0.4
- Parameters
-
- Returns
- string
◆ renderFatalError()
ParserHook::renderFatalError |
( |
ProcessingError |
$error | ) |
|
|
protected |
Creates and returns the output when a fatal error prevent regular rendering.
- Since
- 0.4
- Parameters
-
- Returns
- string
◆ renderFunction()
ParserHook::renderFunction |
( |
Parser & |
$parser | ) |
|
Handler for rendering the function hook registered by Parser::setFunctionHook()
- Since
- 0.4
- Parameters
-
Parser | &$parser | ... further arguments ... |
- Returns
- array
: FIXME: Is this really necessary? The same thing is propably going to happen in Parser::braceSubstitution() if 'isHTML' is set! : other options besides 'isHTML' like 'noparse' are ignored here!
◆ renderFunctionObj()
ParserHook::renderFunctionObj |
( |
Parser & |
$parser, |
|
|
PPFrame |
$frame, |
|
|
|
$args |
|
) |
| |
Handler for rendering the function hook registered by Parser::setFunctionHook() together with object style arguments (SFH_OBJECT_ARGS flag).
- Since
- 0.4.13
- Parameters
-
Parser | &$parser | |
PPFrame | $frame | |
type | $args | |
- Returns
- array
◆ renderTag()
ParserHook::renderTag |
( |
|
$input, |
|
|
array |
$args, |
|
|
Parser |
$parser, |
|
|
PPFrame |
$frame = null |
|
) |
| |
Handler for rendering the tag hook registered by Parser::setHook()
- Since
- 0.4
- Parameters
-
mixed | $input | string or null |
array | $args | |
Parser | $parser | |
PPFrame | $frame | Available from 1.16 |
- Returns
- string
◆ validateAndRender()
ParserHook::validateAndRender |
( |
array |
$arguments, |
|
|
|
$type |
|
) |
| |
Takes care of validation and rendering, and returns the output.
- Since
- 0.4
- Parameters
-
array | $arguments | |
integer | $type | Item of the ParserHook::TYPE_ enum |
- Returns
- string
◆ FH_NO_HASH
const ParserHook::FH_NO_HASH = 1 |
Flag for constructor, whether the function hook should be one callable without leading hash, i.e. {{plural:...}} instead of {{#if:...}}
- Since
- 0.4.13
The documentation for this class was generated from the following file: