Public Member Functions | |
| CBTProcessor ($text, $functionObj, $ignorableDeps=array()) | |
| Create a template processor for a given text, callback object and static dependency list. | |
| execute ($compile=false) | |
| Execute the template. | |
| compile () | |
| Shortcut for execute(true). | |
| doText ($start, $end) | |
| Shortcut for doOpenText( $start, $end, false. | |
| templateEscape ($text) | |
| Escape text for a template if we are producing a template. | |
| doOpenText (&$p, $end, $needClosing=true) | |
| Recursive workhorse for text mode. | |
| doOpenFunction (&$p, $end, $needClosing=true) | |
| Recursive workhorse for function mode. | |
| doFunction ($tokens, $p) | |
| Execute a function, caching and returning the result value. | |
| error ($text, $pos=false) | |
| Set a flag indicating that an error has been found. | |
| getLastError () | |
| bi_if ($condition, $trueBlock, $falseBlock=null) | |
| 'if' built-in function | |
| bi_true () | |
| 'true' built-in function | |
| bi_lbrace () | |
| left brace built-in | |
| bi_rbrace () | |
| right brace built-in | |
| bi_escape ($val) | |
| escape built-in. | |
Public Attributes | |
| $mText | |
| $mFunctionObj | |
| $mCompiling = false | |
| $mIgnorableDeps = array() | |
| $mFunctionCache = array() | |
| $mLastError = false | |
| $mErrorPos = 0 | |
| $mBuiltins | |
| Built-in functions. | |
Definition at line 146 of file CBTProcessor.php.
| CBTProcessor::bi_escape | ( | $ | val | ) |
escape built-in.
Escape text for inclusion in an HTML attribute
Definition at line 536 of file CBTProcessor.php.
| CBTProcessor::bi_if | ( | $ | condition, | |
| $ | trueBlock, | |||
| $ | falseBlock = null | |||
| ) |
| CBTProcessor::bi_lbrace | ( | ) |
| CBTProcessor::bi_rbrace | ( | ) |
| CBTProcessor::bi_true | ( | ) |
| CBTProcessor::CBTProcessor | ( | $ | text, | |
| $ | functionObj, | |||
| $ | ignorableDeps = array() | |||
| ) |
Create a template processor for a given text, callback object and static dependency list.
Definition at line 170 of file CBTProcessor.php.
References $text.
| CBTProcessor::compile | ( | ) |
Shortcut for execute(true).
Definition at line 213 of file CBTProcessor.php.
References $fname, $s, execute(), wfProfileIn(), and wfProfileOut().
| CBTProcessor::doFunction | ( | $ | tokens, | |
| $ | p | |||
| ) |
Execute a function, caching and returning the result value.
$tokens is an array of CBTValue objects. $tokens[0] is the function name, the others are arguments. $p is the string position, and is used for error messages only.
Definition at line 400 of file CBTProcessor.php.
References $fname, error(), wfDebug(), wfProfileIn(), and wfProfileOut().
Referenced by doOpenFunction().
| CBTProcessor::doOpenFunction | ( | &$ | p, | |
| $ | end, | |||
| $ | needClosing = true | |||
| ) |
Recursive workhorse for function mode.
Processes function mode starting from offset $p, until either $end is reached or a closing brace is found. If $needClosing is false, a closing brace will flag an error, if $needClosing is true, the lack of a closing brace will flag an error.
The parameter $p is advanced to the position after the closing brace, or after the end. A CBTValue is returned.
Definition at line 320 of file CBTProcessor.php.
References $end, $i, $in, $start, doFunction(), doOpenText(), and error().
Referenced by doOpenText().
| CBTProcessor::doOpenText | ( | &$ | p, | |
| $ | end, | |||
| $ | needClosing = true | |||
| ) |
Recursive workhorse for text mode.
Processes text mode starting from offset $p, until either $end is reached or a closing brace is found. If $needClosing is false, a closing brace will flag an error, if $needClosing is true, the lack of a closing brace will flag an error.
The parameter $p is advanced to the position after the closing brace, or after the end. A CBTValue is returned.
Definition at line 251 of file CBTProcessor.php.
References $end, $fname, $in, $start, doOpenFunction(), error(), wfProfileIn(), and wfProfileOut().
Referenced by doOpenFunction(), and doText().
| CBTProcessor::doText | ( | $ | start, | |
| $ | end | |||
| ) |
Shortcut for doOpenText( $start, $end, false.
Definition at line 222 of file CBTProcessor.php.
References $end, $start, and doOpenText().
Referenced by execute().
| CBTProcessor::error | ( | $ | text, | |
| $ | pos = false | |||
| ) |
Set a flag indicating that an error has been found.
Definition at line 482 of file CBTProcessor.php.
References $text.
Referenced by bi_if(), doFunction(), doOpenFunction(), and doOpenText().
| CBTProcessor::execute | ( | $ | compile = false |
) |
Execute the template.
If $compile is true, produces an optimised template where functions with static dependencies have been replaced by their return values.
Definition at line 181 of file CBTProcessor.php.
References $fname, $text, doText(), wfProfileIn(), and wfProfileOut().
Referenced by compile().
| CBTProcessor::getLastError | ( | ) |
Definition at line 491 of file CBTProcessor.php.
| CBTProcessor::templateEscape | ( | $ | text | ) |
Escape text for a template if we are producing a template.
Do nothing if we are producing plain text.
Definition at line 230 of file CBTProcessor.php.
References $text, and cbt_escape().
| CBTProcessor::$mBuiltins |
Initial value:
array(
'if' => 'bi_if',
'true' => 'bi_true',
'[' => 'bi_lbrace',
'lbrace' => 'bi_lbrace',
']' => 'bi_rbrace',
'rbrace' => 'bi_rbrace',
'escape' => 'bi_escape',
'~' => 'bi_escape',
)
Definition at line 156 of file CBTProcessor.php.
| CBTProcessor::$mCompiling = false |
Definition at line 149 of file CBTProcessor.php.
| CBTProcessor::$mErrorPos = 0 |
Definition at line 153 of file CBTProcessor.php.
| CBTProcessor::$mFunctionCache = array() |
Definition at line 151 of file CBTProcessor.php.
| CBTProcessor::$mFunctionObj |
Definition at line 147 of file CBTProcessor.php.
| CBTProcessor::$mIgnorableDeps = array() |
Definition at line 150 of file CBTProcessor.php.
| CBTProcessor::$mLastError = false |
Definition at line 152 of file CBTProcessor.php.
| CBTProcessor::$mText |
Definition at line 147 of file CBTProcessor.php.
1.5.9