MediaWiki
master
|
Public Member Functions | |
__construct ($templateDir=null, $forceRecompile=false) | |
processTemplate ($templateName, $args, array $scopes=[]) | |
Returns HTML for a given template by calling the template function with the given args. More... | |
Protected Member Functions | |
compile ($code) | |
Compile the Mustache code into PHP code using LightnCandy. More... | |
compileForEval ($fileContents, $filename) | |
Wrapper for compile() function that verifies successful compilation and strips out the '<?php' part so that the code is ready for eval() More... | |
getTemplate ($templateName) | |
Returns a given template function if found, otherwise throws an exception. More... | |
getTemplateFilename ($templateName) | |
Constructs the location of the the source Mustache template. More... | |
Protected Attributes | |
bool | $forceRecompile = false |
Always compile template files. More... | |
callable[] | $renderers |
Array of cached rendering functions. More... | |
string | $templateDir |
The path to the Mustache templates. More... | |
Definition at line 23 of file TemplateParser.php.
TemplateParser::__construct | ( | $templateDir = null , |
|
$forceRecompile = false |
|||
) |
string | $templateDir | |
bool | $forceRecompile |
Definition at line 43 of file TemplateParser.php.
References $forceRecompile, and $templateDir.
|
protected |
Compile the Mustache code into PHP code using LightnCandy.
string | $code | Mustache code |
RuntimeException |
Definition at line 167 of file TemplateParser.php.
References $code.
Referenced by compileForEval().
|
protected |
Wrapper for compile() function that verifies successful compilation and strips out the '<?php' part so that the code is ready for eval()
string | $fileContents | Mustache code |
string | $filename | Name of the template |
RuntimeException |
Definition at line 145 of file TemplateParser.php.
References $code, and compile().
Referenced by getTemplate().
|
protected |
Returns a given template function if found, otherwise throws an exception.
string | $templateName | The name of the template (without file suffix) |
RuntimeException |
Definition at line 80 of file TemplateParser.php.
References $cache, $code, CACHE_ANYTHING, compileForEval(), ConfigFactory\getDefaultInstance(), ObjectCache\getLocalServerInstance(), and getTemplateFilename().
Referenced by processTemplate().
|
protected |
Constructs the location of the the source Mustache template.
string | $templateName | The name of the template |
UnexpectedValueException | If $templateName attempts upwards directory traversal |
Definition at line 54 of file TemplateParser.php.
Referenced by getTemplate().
TemplateParser::processTemplate | ( | $templateName, | |
$args, | |||
array | $scopes = [] |
||
) |
Returns HTML for a given template by calling the template function with the given args.
string | $templateName | The name of the template |
mixed | $args | |
array | $scopes |
Definition at line 200 of file TemplateParser.php.
References $args, $template, and getTemplate().
|
protected |
Always compile template files.
Definition at line 37 of file TemplateParser.php.
Referenced by __construct().
|
protected |
Array of cached rendering functions.
Definition at line 32 of file TemplateParser.php.
|
protected |
The path to the Mustache templates.
Definition at line 27 of file TemplateParser.php.
Referenced by __construct().