Public Member Functions | |
| __construct ($template_file, $folders=array(), $load=true) | |
| getBlockTrans () | |
| getSimpleTrans () | |
| compile () | |
| loadTemplateFile ($file) | |
| _callback ($matches) | |
| _callbackInTransBlock ($matches) | |
| _parseVariable ($expr) | |
| _parseFunction ($name, $args) | |
| _parseFinal ($string, $allowed=array(), $exceptchar=array(';')) | |
Public Attributes | |
| $_usedModifiers = array() | |
| $templateFolders = array() | |
| $templateContent = '' | |
Protected Attributes | |
| $_literals | |
| $_vartype | |
| $_assignOp | |
| $_op | |
| $_allowedInVar | |
| $_allowedInExpr | |
| $_allowedAssign | |
| $_modifier | |
| $_allowedTags | |
| $_extraTags = array() | |
| $_blockStack = array() | |
| $_transStack = array() | |
| $_transPlural = false | |
| $_sourceFile | |
| $_currentTag | |
Based on Pluf_Template_Compiler with code: Copyright (C) 2006 Laurent Jouanneau.
| Pluf_Translation_TemplateExtractor::__construct | ( | $ | template_file, | |
| $ | folders = array(), |
|||
| $ | load = true | |||
| ) |
Construct the compiler.
| string | Basename of the template file. | |
| array | Base folders in which the templates files should be found. (array()) | |
| bool | Load directly the template content. (true) |
| Pluf_Translation_TemplateExtractor::getBlockTrans | ( | ) |
Get blocktrans.
| Pluf_Translation_TemplateExtractor::getSimpleTrans | ( | ) |
Get simple trans call.
| Pluf_Translation_TemplateExtractor::compile | ( | ) |
Compile the template into a file ready to parse with xgettext.
| Pluf_Translation_TemplateExtractor::loadTemplateFile | ( | $ | file | ) |
Load a template file.
The path to the file to load is relative and the file is found in one of the $templateFolders array of folders.
| string | Relative path of the file to load. |
| Pluf_Translation_TemplateExtractor::_callback | ( | $ | matches | ) |
| Pluf_Translation_TemplateExtractor::_callbackInTransBlock | ( | $ | matches | ) |
| Pluf_Translation_TemplateExtractor::_parseVariable | ( | $ | expr | ) |
| Pluf_Translation_TemplateExtractor::_parseFunction | ( | $ | name, | |
| $ | args | |||
| ) |
| Pluf_Translation_TemplateExtractor::_parseFinal | ( | $ | string, | |
| $ | allowed = array(), |
|||
| $ | exceptchar = array(';') | |||
| ) |
Pluf_Translation_TemplateExtractor::$_literals [protected] |
Store the literal blocks.
Pluf_Translation_TemplateExtractor::$_vartype [protected] |
Initial value:
array(T_CHARACTER, T_CONSTANT_ENCAPSED_STRING,
T_DNUMBER, T_ENCAPSED_AND_WHITESPACE,
T_LNUMBER, T_OBJECT_OPERATOR, T_STRING,
T_WHITESPACE, T_ARRAY)
Pluf_Translation_TemplateExtractor::$_assignOp [protected] |
Initial value:
array(T_AND_EQUAL, T_DIV_EQUAL, T_MINUS_EQUAL,
T_MOD_EQUAL, T_MUL_EQUAL, T_OR_EQUAL,
T_PLUS_EQUAL, T_PLUS_EQUAL, T_SL_EQUAL,
T_SR_EQUAL, T_XOR_EQUAL)
Pluf_Translation_TemplateExtractor::$_op [protected] |
Initial value:
array(T_BOOLEAN_AND, T_BOOLEAN_OR, T_EMPTY, T_INC,
T_ISSET, T_IS_EQUAL, T_IS_GREATER_OR_EQUAL,
T_IS_IDENTICAL, T_IS_NOT_EQUAL, T_IS_NOT_IDENTICAL,
T_IS_SMALLER_OR_EQUAL, T_LOGICAL_AND, T_LOGICAL_OR,
T_LOGICAL_XOR, T_SR, T_SL, T_DOUBLE_ARROW)
Pluf_Translation_TemplateExtractor::$_allowedInVar [protected] |
Authorized elements in variables.
Pluf_Translation_TemplateExtractor::$_allowedInExpr [protected] |
Authorized elements in expression.
Pluf_Translation_TemplateExtractor::$_allowedAssign [protected] |
Authorized elements in assignation.
Pluf_Translation_TemplateExtractor::$_modifier [protected] |
Initial value:
array('upper' => 'strtoupper', 'lower' => 'strtolower', 'escxml' => 'htmlspecialchars', 'escape' => 'Pluf_Template_htmlspecialchars', 'strip_tags' => 'strip_tags', 'escurl' => 'rawurlencode', 'capitalize' => 'ucwords', // Not var_export because of recursive issues. 'debug' => 'print_r', 'fulldebug' => 'var_export', 'count' => 'count', 'nl2br' => 'nl2br', 'trim' => 'trim', 'unsafe' => 'Pluf_Template_unsafe', 'safe' => 'Pluf_Template_unsafe', 'date' => 'Pluf_Template_dateFormat', 'time' => 'Pluf_Template_timeFormat', )
| Pluf_Translation_TemplateExtractor::$_usedModifiers = array() |
After the compilation is completed, this contains the list of modifiers used in the template. The GetCompiledTemplate method will add a series of Pluf::loadFunction at the top to preload these modifiers.
Pluf_Translation_TemplateExtractor::$_allowedTags [protected] |
Initial value:
array(
'url' => 'Pluf_Template_Tag_Url',
)
These default tags are merged with the 'template_tags' defined in the configuration of the application.
Pluf_Translation_TemplateExtractor::$_extraTags = array() [protected] |
During compilation, all the tags are created once so to query their interface easily.
Pluf_Translation_TemplateExtractor::$_blockStack = array() [protected] |
The block stack to see if the blocks are correctly closed.
Pluf_Translation_TemplateExtractor::$_transStack = array() [protected] |
Special stack for the translation handling in blocktrans.
Pluf_Translation_TemplateExtractor::$_transPlural = false [protected] |
Pluf_Translation_TemplateExtractor::$_sourceFile [protected] |
Current template source file.
Pluf_Translation_TemplateExtractor::$_currentTag [protected] |
Current tag.
| Pluf_Translation_TemplateExtractor::$templateFolders = array() |
Template folders.
| Pluf_Translation_TemplateExtractor::$templateContent = '' |
Template content. It can be set directly from a string.