\Pluf_Translation_TemplateExtractor

Class to extract the translation strings from the template.

Based on Pluf_Template_Compiler with code: Copyright (C) 2006 Laurent Jouanneau.

Summary

Methods
Properties
Constants
__construct()
getBlockTrans()
getSimpleTrans()
compile()
loadTemplateFile()
_callback()
_callbackInTransBlock()
_parseVariable()
_parseFunction()
_parseFinal()
$_usedModifiers
$templateFolders
$templateContent
No constants found
No protected methods found
$_literals
$_vartype
$_assignOp
$_op
$_allowedInVar
$_allowedInExpr
$_allowedAssign
$_modifier
$_allowedTags
$_extraTags
$_blockStack
$_transStack
$_transPlural
$_sourceFile
$_currentTag
N/A
No private methods found
No private properties found
N/A

Properties

$_usedModifiers

$_usedModifiers : 

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.

Type

$templateFolders

$templateFolders : 

Template folders.

Type

$templateContent

$templateContent : 

Template content.

It can be set directly from a string.

Type

$_literals

$_literals : 

Store the literal blocks.

Type

$_vartype

$_vartype : 

Variables.

Type

$_assignOp

$_assignOp : 

Assignation operators.

Type

$_op

$_op : 

Operators.

Type

$_allowedInVar

$_allowedInVar : 

Authorized elements in variables.

Type

$_allowedInExpr

$_allowedInExpr : 

Authorized elements in expression.

Type

$_allowedAssign

$_allowedAssign : 

Authorized elements in assignation.

Type

$_modifier

$_modifier : 

Output filters.

Type

$_allowedTags

$_allowedTags : 

Default allowed extra tags/functions.

These default tags are merged with the 'template_tags' defined in the configuration of the application.

Type

$_extraTags

$_extraTags : 

During compilation, all the tags are created once so to query their interface easily.

Type

$_blockStack

$_blockStack : 

The block stack to see if the blocks are correctly closed.

Type

$_transStack

$_transStack : 

Special stack for the translation handling in blocktrans.

Type

$_transPlural

$_transPlural : 

Type

$_sourceFile

$_sourceFile : 

Current template source file.

Type

$_currentTag

$_currentTag : 

Current tag.

Type

Methods

__construct()

__construct(  $template_file,   $folders = array(),   $load = true) 

Construct the compiler.

Parameters

$template_file
$folders
$load

getBlockTrans()

getBlockTrans() 

Get blocktrans.

getSimpleTrans()

getSimpleTrans() 

Get simple trans call.

compile()

compile() : string

Compile the template into a file ready to parse with xgettext.

Returns

string —

PHP code of the compiled template.

loadTemplateFile()

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.

Parameters

$file

_callback()

_callback(  $matches) 

Parameters

$matches

_callbackInTransBlock()

_callbackInTransBlock(  $matches) 

Parameters

$matches

_parseVariable()

_parseVariable(  $expr) 

Parameters

$expr

_parseFunction()

_parseFunction(  $name,   $args) 

Parameters

$name
$args

_parseFinal()

_parseFinal(  $string,   $allowed = array(),   $exceptchar = array(';')) 

Parameters

$string
$allowed
$exceptchar