TYPO3 CMS  TYPO3_6-2
TYPO3\CMS\Fluid\Core\Compiler\TemplateCompiler Class Reference
Inheritance diagram for TYPO3\CMS\Fluid\Core\Compiler\TemplateCompiler:
TYPO3\CMS\Core\SingletonInterface Tx_Fluid_Core_Compiler_TemplateCompiler

Public Member Functions

 setTemplateCache (\TYPO3\CMS\Core\Cache\Frontend\PhpFrontend $templateCache)
 
 has ($identifier)
 
 get ($identifier)
 
 store ($identifier, \TYPO3\CMS\Fluid\Core\Parser\ParsingState $parsingState)
 
 convertListOfSubNodes (\TYPO3\CMS\Fluid\Core\Parser\SyntaxTree\AbstractNode $node)
 
 wrapChildNodesInClosure (\TYPO3\CMS\Fluid\Core\Parser\SyntaxTree\AbstractNode $node)
 
 variableName ($prefix)
 

Public Attributes

const SHOULD_GENERATE_VIEWHELPER_INVOCATION = '##should_gen_viewhelper##'
 

Protected Member Functions

 sanitizeIdentifier ($identifier)
 
 generateCodeForSection (array $converted, $expectedFunctionName, $comment)
 
 convert (\TYPO3\CMS\Fluid\Core\Parser\SyntaxTree\AbstractNode $node)
 
 convertTextNode (\TYPO3\CMS\Fluid\Core\Parser\SyntaxTree\TextNode $node)
 
 convertNumericNode (\TYPO3\CMS\Fluid\Core\Parser\SyntaxTree\NumericNode $node)
 
 convertViewHelperNode (\TYPO3\CMS\Fluid\Core\Parser\SyntaxTree\ViewHelperNode $node)
 
 convertObjectAccessorNode (\TYPO3\CMS\Fluid\Core\Parser\SyntaxTree\ObjectAccessorNode $node)
 
 convertArrayNode (\TYPO3\CMS\Fluid\Core\Parser\SyntaxTree\ArrayNode $node)
 
 convertBooleanNode (\TYPO3\CMS\Fluid\Core\Parser\SyntaxTree\BooleanNode $node)
 
 escapeTextForUseInSingleQuotes ($text)
 

Protected Attributes

 $templateCache
 
 $variableCounter = 0
 
 $syntaxTreeInstanceCache = array()
 

Detailed Description

Definition at line 14 of file TemplateCompiler.php.

Member Function Documentation

◆ convert()

TYPO3\CMS\Fluid\Core\Compiler\TemplateCompiler::convert ( \TYPO3\CMS\Fluid\Core\Parser\SyntaxTree\AbstractNode  $node)
protected

Returns an array with two elements:

  • initialization: contains PHP code which is inserted before the actual rendering call. Must be valid, i.e. end with semi-colon.
  • execution: contains a single PHP instruction which needs to return the rendered output of the given element. Should NOT end with semi-colon.
Parameters
\TYPO3\CMS\Fluid\Core\Parser\SyntaxTree\AbstractNode$node
Returns
array two-element array, see above
Exceptions

Definition at line 153 of file TemplateCompiler.php.

Referenced by TYPO3\CMS\Fluid\Core\Compiler\TemplateCompiler\generateCodeForSection(), and TYPO3\CMS\Fluid\Core\Compiler\TemplateCompiler\store().

◆ convertArrayNode()

TYPO3\CMS\Fluid\Core\Compiler\TemplateCompiler::convertArrayNode ( \TYPO3\CMS\Fluid\Core\Parser\SyntaxTree\ArrayNode  $node)
protected
Parameters
\TYPO3\CMS\Fluid\Core\Parser\SyntaxTree\ArrayNode$node
Returns
array
See also
convert()

Definition at line 277 of file TemplateCompiler.php.

Referenced by TYPO3\CMS\Fluid\Core\Compiler\TemplateCompiler\generateCodeForSection().

◆ convertBooleanNode()

TYPO3\CMS\Fluid\Core\Compiler\TemplateCompiler::convertBooleanNode ( \TYPO3\CMS\Fluid\Core\Parser\SyntaxTree\BooleanNode  $node)
protected
Parameters
\TYPO3\CMS\Fluid\Core\Parser\SyntaxTree\BooleanNode$node
Returns
array
See also
convert()

Definition at line 341 of file TemplateCompiler.php.

Referenced by TYPO3\CMS\Fluid\Core\Compiler\TemplateCompiler\generateCodeForSection().

◆ convertListOfSubNodes()

TYPO3\CMS\Fluid\Core\Compiler\TemplateCompiler::convertListOfSubNodes ( \TYPO3\CMS\Fluid\Core\Parser\SyntaxTree\AbstractNode  $node)
Parameters
\TYPO3\CMS\Fluid\Core\Parser\SyntaxTree\AbstractNode$node
Returns
array
See also
convert()

Definition at line 307 of file TemplateCompiler.php.

Referenced by TYPO3\CMS\Fluid\Core\Compiler\TemplateCompiler\generateCodeForSection(), and TYPO3\CMS\Fluid\Core\Compiler\TemplateCompiler\store().

◆ convertNumericNode()

TYPO3\CMS\Fluid\Core\Compiler\TemplateCompiler::convertNumericNode ( \TYPO3\CMS\Fluid\Core\Parser\SyntaxTree\NumericNode  $node)
protected
Parameters
\TYPO3\CMS\Fluid\Core\Parser\SyntaxTree\NumericNode$node
Returns
array
See also
convert()

Definition at line 190 of file TemplateCompiler.php.

Referenced by TYPO3\CMS\Fluid\Core\Compiler\TemplateCompiler\generateCodeForSection().

◆ convertObjectAccessorNode()

TYPO3\CMS\Fluid\Core\Compiler\TemplateCompiler::convertObjectAccessorNode ( \TYPO3\CMS\Fluid\Core\Parser\SyntaxTree\ObjectAccessorNode  $node)
protected
Parameters
\TYPO3\CMS\Fluid\Core\Parser\SyntaxTree\ObjectAccessorNode$node
Returns
array
See also
convert()

Definition at line 265 of file TemplateCompiler.php.

Referenced by TYPO3\CMS\Fluid\Core\Compiler\TemplateCompiler\generateCodeForSection().

◆ convertTextNode()

TYPO3\CMS\Fluid\Core\Compiler\TemplateCompiler::convertTextNode ( \TYPO3\CMS\Fluid\Core\Parser\SyntaxTree\TextNode  $node)
protected
Parameters
\TYPO3\CMS\Fluid\Core\Parser\SyntaxTree\TextNode$node
Returns
array
See also
convert()

Definition at line 178 of file TemplateCompiler.php.

Referenced by TYPO3\CMS\Fluid\Core\Compiler\TemplateCompiler\generateCodeForSection().

◆ convertViewHelperNode()

TYPO3\CMS\Fluid\Core\Compiler\TemplateCompiler::convertViewHelperNode ( \TYPO3\CMS\Fluid\Core\Parser\SyntaxTree\ViewHelperNode  $node)
protected

Convert a single ViewHelperNode into its cached representation. If the ViewHelper implements the "Compilable" facet, the ViewHelper itself is asked for its cached PHP code representation. If not, a ViewHelper is built and then invoked.

Parameters
\TYPO3\CMS\Fluid\Core\Parser\SyntaxTree\ViewHelperNode$node
Returns
array
See also
convert()

Definition at line 205 of file TemplateCompiler.php.

Referenced by TYPO3\CMS\Fluid\Core\Compiler\TemplateCompiler\generateCodeForSection().

◆ escapeTextForUseInSingleQuotes()

TYPO3\CMS\Fluid\Core\Compiler\TemplateCompiler::escapeTextForUseInSingleQuotes (   $text)
protected
Parameters
string$text
Returns
string

Definition at line 365 of file TemplateCompiler.php.

Referenced by TYPO3\CMS\Fluid\Core\Compiler\TemplateCompiler\generateCodeForSection().

◆ generateCodeForSection()

◆ get()

TYPO3\CMS\Fluid\Core\Compiler\TemplateCompiler::get (   $identifier)
Parameters
string$identifier
Returns

Definition at line 54 of file TemplateCompiler.php.

References TYPO3\CMS\Fluid\Core\Compiler\TemplateCompiler\sanitizeIdentifier().

◆ has()

TYPO3\CMS\Fluid\Core\Compiler\TemplateCompiler::has (   $identifier)
Parameters
string$identifier
Returns
boolean

Definition at line 45 of file TemplateCompiler.php.

References TYPO3\CMS\Fluid\Core\Compiler\TemplateCompiler\sanitizeIdentifier().

◆ sanitizeIdentifier()

TYPO3\CMS\Fluid\Core\Compiler\TemplateCompiler::sanitizeIdentifier (   $identifier)
protected

Replaces special characters by underscores

See also
http://www.php.net/manual/en/language.variables.basics.php
Parameters
string$identifier
Returns
string the sanitized identifier

Definition at line 121 of file TemplateCompiler.php.

Referenced by TYPO3\CMS\Fluid\Core\Compiler\TemplateCompiler\get(), TYPO3\CMS\Fluid\Core\Compiler\TemplateCompiler\has(), and TYPO3\CMS\Fluid\Core\Compiler\TemplateCompiler\store().

◆ setTemplateCache()

TYPO3\CMS\Fluid\Core\Compiler\TemplateCompiler::setTemplateCache ( \TYPO3\CMS\Core\Cache\Frontend\PhpFrontend  $templateCache)
Parameters
\TYPO3\CMS\Core\Cache\Frontend\PhpFrontend$templateCache
Returns
void

Definition at line 37 of file TemplateCompiler.php.

References TYPO3\CMS\Fluid\Core\Compiler\TemplateCompiler\$templateCache.

◆ store()

TYPO3\CMS\Fluid\Core\Compiler\TemplateCompiler::store (   $identifier,
\TYPO3\CMS\Fluid\Core\Parser\ParsingState  $parsingState 
)

◆ variableName()

TYPO3\CMS\Fluid\Core\Compiler\TemplateCompiler::variableName (   $prefix)

Returns a unique variable name by appending a global index to the given prefix

Parameters
string$prefix
Returns
string

Definition at line 389 of file TemplateCompiler.php.

Referenced by TYPO3\CMS\Fluid\Core\Compiler\TemplateCompiler\generateCodeForSection().

◆ wrapChildNodesInClosure()

TYPO3\CMS\Fluid\Core\Compiler\TemplateCompiler::wrapChildNodesInClosure ( \TYPO3\CMS\Fluid\Core\Parser\SyntaxTree\AbstractNode  $node)
Parameters
\TYPO3\CMS\Fluid\Core\Parser\SyntaxTree\AbstractNode$node
Returns
string

Definition at line 373 of file TemplateCompiler.php.

Referenced by TYPO3\CMS\Fluid\Core\Compiler\TemplateCompiler\generateCodeForSection().

Member Data Documentation

◆ $syntaxTreeInstanceCache

TYPO3\CMS\Fluid\Core\Compiler\TemplateCompiler::$syntaxTreeInstanceCache = array()
protected

Definition at line 31 of file TemplateCompiler.php.

◆ $templateCache

TYPO3\CMS\Fluid\Core\Compiler\TemplateCompiler::$templateCache
protected

◆ $variableCounter

TYPO3\CMS\Fluid\Core\Compiler\TemplateCompiler::$variableCounter = 0
protected

Definition at line 26 of file TemplateCompiler.php.

◆ SHOULD_GENERATE_VIEWHELPER_INVOCATION

const TYPO3\CMS\Fluid\Core\Compiler\TemplateCompiler::SHOULD_GENERATE_VIEWHELPER_INVOCATION = '##should_gen_viewhelper##'

Definition at line 16 of file TemplateCompiler.php.