|
eZ Publish
[4.2]
|
Creates compiled PHP code from templates to speed up template usage. More...
Static Public Member Functions | |
| static | alwaysGenerate () |
| static | boundVariableName ($variableID, $parameters) |
| static | calculateVariableNodeStatistics ($tpl, $variableData, $variablePlacement, &$resourceData, $namespace, &$stats) |
| static | calculateVariableStatistics ($tpl, &$node, &$resourceData, &$stats) |
| static | calculateVariableStatisticsChildren ($tpl, &$nodeChildren, &$resourceData, $namespace, &$stats) |
| static | combineStaticNodes ($tpl, &$resourceData, &$lastNode, &$newNode) |
| static | compilationDirectory () |
| static | compilationFilename ($key, $resourceData) |
| static | compileTemplate ($tpl, $key, &$resourceData) |
| static | createCommonCompileTemplate () |
| static | createStaticVariableData ($tpl, $staticData, $variableItemPlacement) |
| static | currentTextName ($parameters) |
| static | decreaseCurrentTextName (&$parameters) |
| static | executeCompilation ($tpl, &$textElements, $key, &$resourceData, $rootNamespace, $currentNamespace) |
| static | executeCompilationHelper ($phpScript, &$text, $tpl, $key, &$resourceData, $rootNamespace, $currentNamespace) |
| static | fetchTemplatePiece ($placementData) |
| static | generateMergeNamespaceCode ($php, $tpl, $namespace, $namespaceScope, $parameters=array(), $skipSimpleAssignment=false) |
| static | generatePHPCode ($useComments, $php, $tpl, &$node, &$resourceData) |
| static | generatePHPCodeChildren ($useComments, $php, $tpl, &$nodeChildren, &$resourceData, &$parameters, $currentParameters) |
| static | generateVariableCode ($php, $tpl, $node, &$knownTypes, $dataInspection, $parameters, &$resourceData) |
| static | generateVariableDataCode ($php, $tpl, $variableData, &$knownTypes, $dataInspection, &$persistence, $parameters, &$resourceData) |
| static | hasCompiledTemplate ($key, $timestamp, &$resourceData) |
| static | increaseCurrentTextName (&$parameters) |
| static | inspectVariableData ($tpl, $variableData, $variablePlacement, &$resourceData) |
| static | isAccumulatorsEnabled () |
| static | isCommentsEnabled () |
| static | isCompilationEnabled () |
| static | isDevelopmentModeEnabled () |
| static | isExecutionEnabled () |
| static | isFallbackResourceCodeEnabled () |
| static | isNodePlacementEnabled () |
| static | isTimingPointsEnabled () |
| static | isTreeEnabled ($treeName) |
| static | operatorHint ($tpl, $operatorName) |
| static | operatorStaticData ($tpl, $operatorName) |
| static | prepareVariableStatistics ($tpl, &$resourceData, &$stats) |
| static | processElementTransformationChild ($useComments, $php, $tpl, &$node, $elementTree, $elementList, &$resourceData) |
| static | processElementTransformationList ($tpl, &$node, $elements, &$privateData) |
| static | processNodeCombining ($useComments, $php, $tpl, &$node, &$resourceData, &$newNode) |
| static | processNodeCombiningChildren ($useComments, $php, $tpl, &$nodeChildren, &$resourceData, &$parentNode) |
| static | processNodeTransformation ($useComments, $php, $tpl, &$node, &$resourceData, &$newNode) |
| static | processNodeTransformationChild ($useComments, $php, $tpl, &$node, &$resourceData) |
| static | processNodeTransformationChildren ($useComments, $php, $tpl, &$node, &$children, &$resourceData) |
| static | processNodeTransformationNodes ($tpl, &$node, &$nodes, &$privateData) |
| static | processNodeTransformationRoot ($useComments, $php, $tpl, &$node, &$resourceData) |
| static | processRemoveNodePlacement (&$node) |
| static | processStaticOptimizations ($useComments, $php, $tpl, &$node, &$resourceData, &$newNode) |
| static | setSettings ($settingsMap) |
| static | setVariableStatistics (&$stats, $namespace, $variableName, $changes) |
| static | staticNodeData ($node) |
| static | TemplatePrefix () |
Public Attributes | |
| const | CODE_DATE = 1074699607 |
Creates compiled PHP code from templates to speed up template usage.
Various optimizations that can be done are:
Data:
Attributes:
Operators:
Functions:
Definition at line 70 of file eztemplatecompiler.php.
| static eZTemplateCompiler::alwaysGenerate | ( | ) | [static] |
Definition at line 272 of file eztemplatecompiler.php.
Referenced by hasCompiledTemplate().
| static eZTemplateCompiler::boundVariableName | ( | $ | variableID, |
| $ | parameters | ||
| ) | [static] |
Definition at line 2042 of file eztemplatecompiler.php.
| static eZTemplateCompiler::calculateVariableNodeStatistics | ( | $ | tpl, |
| $ | variableData, | ||
| $ | variablePlacement, | ||
| &$ | resourceData, | ||
| $ | namespace, | ||
| &$ | stats | ||
| ) | [static] |
Definition at line 731 of file eztemplatecompiler.php.
Referenced by calculateVariableStatisticsChildren(), eZTemplateSetFunction\functionTemplateStatistics(), and eZTemplateSectionFunction\functionTemplateStatistics().
| static eZTemplateCompiler::calculateVariableStatistics | ( | $ | tpl, |
| &$ | node, | ||
| &$ | resourceData, | ||
| &$ | stats | ||
| ) | [static] |
Definition at line 656 of file eztemplatecompiler.php.
| static eZTemplateCompiler::calculateVariableStatisticsChildren | ( | $ | tpl, |
| &$ | nodeChildren, | ||
| &$ | resourceData, | ||
| $ | namespace, | ||
| &$ | stats | ||
| ) | [static] |
Definition at line 672 of file eztemplatecompiler.php.
Referenced by calculateVariableStatistics(), eZTemplateSetFunction\functionTemplateStatistics(), and eZTemplateSectionFunction\functionTemplateStatistics().
| static eZTemplateCompiler::combineStaticNodes | ( | $ | tpl, |
| &$ | resourceData, | ||
| &$ | lastNode, | ||
| &$ | newNode | ||
| ) | [static] |
Tries to combine the node $lastNode and the node $newNode into one new text node. If possible the new node is created in $newNode and $lastNode will be set to false. Combining nodes only works for text nodes and variable nodes without variable lookup, attributes and operators.
Definition at line 1026 of file eztemplatecompiler.php.
Referenced by processNodeCombiningChildren().
| static eZTemplateCompiler::compilationDirectory | ( | ) | [static] |
Definition at line 300 of file eztemplatecompiler.php.
Referenced by compileTemplate(), createCommonCompileTemplate(), executeCompilation(), generatePHPCodeChildren(), and hasCompiledTemplate().
| static eZTemplateCompiler::compilationFilename | ( | $ | key, |
| $ | resourceData | ||
| ) | [static] |
Creates the name for the compiled template and returns it. The name conists of original filename with the md5 of the key and charset appended.
Definition at line 333 of file eztemplatecompiler.php.
Referenced by compileTemplate(), executeCompilation(), generatePHPCodeChildren(), and hasCompiledTemplate().
| static eZTemplateCompiler::compileTemplate | ( | $ | tpl, |
| $ | key, | ||
| &$ | resourceData | ||
| ) | [static] |
Generates the cache which will be used for handling optimized processing using the key $key.
Definition at line 466 of file eztemplatecompiler.php.
| static eZTemplateCompiler::createCommonCompileTemplate | ( | ) | [static] |
Creates the common.php file which has common functions for compiled templates. If the file already exists if will not create it.
Definition at line 1912 of file eztemplatecompiler.php.
Referenced by compileTemplate().
| static eZTemplateCompiler::createStaticVariableData | ( | $ | tpl, |
| $ | staticData, | ||
| $ | variableItemPlacement | ||
| ) | [static] |
Creates a variable data element for the data $staticData and returns it. The type of element depends on the type of the data, strings and booleans are returned as EZ_TEMPLATE_TYPE_TEXT and eZTemplate::TYPE_NUMERIC while other types are turned into text and returned as EZ_TEMPLATE_TYPE_TEXT.
Definition at line 1850 of file eztemplatecompiler.php.
Referenced by inspectVariableData().
| static eZTemplateCompiler::currentTextName | ( | $ | parameters | ) | [static] |
Figures out the current text name to use in compiled template code and return it. The names will be text, text1, text2 etc.
Definition at line 2001 of file eztemplatecompiler.php.
Referenced by compileTemplate(), and generatePHPCodeChildren().
| static eZTemplateCompiler::decreaseCurrentTextName | ( | &$ | parameters | ) | [static] |
Decreases a previosuly increased counter for the current text name.
Definition at line 2029 of file eztemplatecompiler.php.
| static eZTemplateCompiler::executeCompilation | ( | $ | tpl, |
| &$ | textElements, | ||
| $ | key, | ||
| &$ | resourceData, | ||
| $ | rootNamespace, | ||
| $ | currentNamespace | ||
| ) | [static] |
Tries to execute the compiled template and returns true if succsesful. Returns false if caching is disabled or the compiled template could not be executed.
Definition at line 398 of file eztemplatecompiler.php.
Referenced by eZTemplateFileResource\executeCompiledTemplate().
| static eZTemplateCompiler::executeCompilationHelper | ( | $ | phpScript, |
| &$ | text, | ||
| $ | tpl, | ||
| $ | key, | ||
| &$ | resourceData, | ||
| $ | rootNamespace, | ||
| $ | currentNamespace | ||
| ) | [static] |
Helper function for executeCompilation. Will execute the script $phpScript and set the result text in $text. The parameters $tpl, $resourceData, $rootNamespace and $currentNamespace are passed to the executed template compilation script.
Definition at line 436 of file eztemplatecompiler.php.
Referenced by executeCompilation().
| static eZTemplateCompiler::fetchTemplatePiece | ( | $ | placementData | ) | [static] |
Opens the template files specified in $placementData and fetches the text portion defined by the start and end position. The text is returned or null if the text could not be fetched.
Definition at line 1880 of file eztemplatecompiler.php.
Referenced by generatePHPCodeChildren().
| static eZTemplateCompiler::generateMergeNamespaceCode | ( | $ | php, |
| $ | tpl, | ||
| $ | namespace, | ||
| $ | namespaceScope, | ||
| $ | parameters = array(), |
||
| $ | skipSimpleAssignment = false |
||
| ) | [static] |
Generates PHP code which will do namespace merging. The namespace to merge with is specified in $namespace and the scope of the merging is defined by $namespaceScope.
Definition at line 2931 of file eztemplatecompiler.php.
Referenced by generatePHPCodeChildren(), and generateVariableDataCode().
| static eZTemplateCompiler::generatePHPCode | ( | $ | useComments, |
| $ | php, | ||
| $ | tpl, | ||
| &$ | node, | ||
| &$ | resourceData | ||
| ) | [static] |
Generates the PHP code defined in the template node tree $node. The code is generated using the php creator specified in $php.
Definition at line 2054 of file eztemplatecompiler.php.
Referenced by compileTemplate().
| static eZTemplateCompiler::generatePHPCodeChildren | ( | $ | useComments, |
| $ | php, | ||
| $ | tpl, | ||
| &$ | nodeChildren, | ||
| &$ | resourceData, | ||
| &$ | parameters, | ||
| $ | currentParameters | ||
| ) | [static] |
Generates the PHP code for all node children specified in $nodeChildren.
Definition at line 2076 of file eztemplatecompiler.php.
Referenced by generatePHPCode().
| static eZTemplateCompiler::generateVariableCode | ( | $ | php, |
| $ | tpl, | ||
| $ | node, | ||
| &$ | knownTypes, | ||
| $ | dataInspection, | ||
| $ | parameters, | ||
| &$ | resourceData | ||
| ) | [static] |
Generates PHP code for the variable node $node. Use generateVariableDataCode if you want to create code for arbitrary variable data structures.
Definition at line 2986 of file eztemplatecompiler.php.
| static eZTemplateCompiler::generateVariableDataCode | ( | $ | php, |
| $ | tpl, | ||
| $ | variableData, | ||
| &$ | knownTypes, | ||
| $ | dataInspection, | ||
| &$ | persistence, | ||
| $ | parameters, | ||
| &$ | resourceData | ||
| ) | [static] |
Generates PHP code for the variable tree structure in $variableData. The code will contain string, numeric and identifier assignment, variable lookup, attribute lookup and operator execution. Use generateVariableCode if you want to create code for a variable tree node.
Definition at line 2999 of file eztemplatecompiler.php.
| static eZTemplateCompiler::hasCompiledTemplate | ( | $ | key, |
| $ | timestamp, | ||
| &$ | resourceData | ||
| ) | [static] |
Definition at line 375 of file eztemplatecompiler.php.
| static eZTemplateCompiler::increaseCurrentTextName | ( | &$ | parameters | ) | [static] |
Increases the counter for the current text name, this ensure a uniqe name for it.
Definition at line 2016 of file eztemplatecompiler.php.
| static eZTemplateCompiler::inspectVariableData | ( | $ | tpl, |
| $ | variableData, | ||
| $ | variablePlacement, | ||
| &$ | resourceData | ||
| ) | [static] |
Looks over the variable data $variableData and returns an array with information on the structure. The following entries are generated.
Definition at line 1651 of file eztemplatecompiler.php.
Referenced by combineStaticNodes(), eZTemplateSetFunction\functionTemplateStatistics(), eZTemplateSectionFunction\functionTemplateStatistics(), processNodeCombiningChildren(), and processStaticOptimizations().
| static eZTemplateCompiler::isAccumulatorsEnabled | ( | ) | [static] |
Definition at line 187 of file eztemplatecompiler.php.
Referenced by compileTemplate().
| static eZTemplateCompiler::isCommentsEnabled | ( | ) | [static] |
Definition at line 147 of file eztemplatecompiler.php.
Referenced by compileTemplate(), executeCompilation(), generatePHPCodeChildren(), eZTemplateMenuFunction\templateNodeTransformation(), eZTemplateToolbarFunction\templateNodeTransformation(), and eZTemplateIncludeFunction\templateNodeTransformation().
| static eZTemplateCompiler::isCompilationEnabled | ( | ) | [static] |
Definition at line 120 of file eztemplatecompiler.php.
Referenced by eZTemplateFileResource\canCompileTemplate(), compileTemplate(), executeCompilation(), and hasCompiledTemplate().
| static eZTemplateCompiler::isDevelopmentModeEnabled | ( | ) | [static] |
When in development mode the system will perform additional checks, e.g. for modification time of compiled file vs original source file. This mode is quite useful for development since it requires less clear-cache calls but has additional file checks and should be turned off for live sites.
Definition at line 170 of file eztemplatecompiler.php.
Referenced by generatePHPCodeChildren().
| static eZTemplateCompiler::isExecutionEnabled | ( | ) | [static] |
Definition at line 255 of file eztemplatecompiler.php.
Referenced by executeCompilation().
| static eZTemplateCompiler::isFallbackResourceCodeEnabled | ( | ) | [static] |
Definition at line 221 of file eztemplatecompiler.php.
| static eZTemplateCompiler::isNodePlacementEnabled | ( | ) | [static] |
Definition at line 238 of file eztemplatecompiler.php.
Referenced by compileTemplate().
| static eZTemplateCompiler::isTimingPointsEnabled | ( | ) | [static] |
Definition at line 204 of file eztemplatecompiler.php.
Referenced by compileTemplate().
| static eZTemplateCompiler::isTreeEnabled | ( | $ | treeName | ) | [static] |
Definition at line 289 of file eztemplatecompiler.php.
Referenced by compileTemplate().
| static eZTemplateCompiler::operatorHint | ( | $ | tpl, |
| $ | operatorName | ||
| ) | [static] |
false if the operator does not exist or has no hints. Definition at line 1787 of file eztemplatecompiler.php.
Referenced by generateVariableDataCode(), and inspectVariableData().
| static eZTemplateCompiler::operatorStaticData | ( | $ | tpl, |
| $ | operatorName | ||
| ) | [static] |
null if no static data could be extracted. The operator is specified in $operatorName. Definition at line 1821 of file eztemplatecompiler.php.
Referenced by inspectVariableData().
| static eZTemplateCompiler::prepareVariableStatistics | ( | $ | tpl, |
| &$ | resourceData, | ||
| &$ | stats | ||
| ) | [static] |
Definition at line 647 of file eztemplatecompiler.php.
| static eZTemplateCompiler::processElementTransformationChild | ( | $ | useComments, |
| $ | php, | ||
| $ | tpl, | ||
| &$ | node, | ||
| $ | elementTree, | ||
| $ | elementList, | ||
| &$ | resourceData | ||
| ) | [static] |
Iterates over the children of the function node $node and transforms the tree. If the node is not a function it will return false.
Definition at line 1463 of file eztemplatecompiler.php.
Referenced by processElementTransformationList(), and processNodeTransformationChild().
| static eZTemplateCompiler::processElementTransformationList | ( | $ | tpl, |
| &$ | node, | ||
| $ | elements, | ||
| &$ | privateData | ||
| ) | [static] |
Iterates over the element list $elements and transforms them.
Definition at line 1445 of file eztemplatecompiler.php.
Referenced by eZTemplateCompiledLoop\processChildren(), eZTemplateSwitchFunction\templateNodeCaseTransformation(), eZTemplateIfFunction\templateNodeTransformation(), and eZTemplateSectionFunction\templateNodeTransformation().
| static eZTemplateCompiler::processNodeCombining | ( | $ | useComments, |
| $ | php, | ||
| $ | tpl, | ||
| &$ | node, | ||
| &$ | resourceData, | ||
| &$ | newNode | ||
| ) | [static] |
Iterates over the template node tree and tries to combine multiple static siblings into one element. The original tree is specified in $node and the new combined tree will be present in $newNode.
Definition at line 913 of file eztemplatecompiler.php.
Referenced by compileTemplate().
| static eZTemplateCompiler::processNodeCombiningChildren | ( | $ | useComments, |
| $ | php, | ||
| $ | tpl, | ||
| &$ | nodeChildren, | ||
| &$ | resourceData, | ||
| &$ | parentNode | ||
| ) | [static] |
Does node combining on the children $nodeChildren.
Definition at line 934 of file eztemplatecompiler.php.
Referenced by processNodeCombining().
| static eZTemplateCompiler::processNodeTransformation | ( | $ | useComments, |
| $ | php, | ||
| $ | tpl, | ||
| &$ | node, | ||
| &$ | resourceData, | ||
| &$ | newNode | ||
| ) | [static] |
Iterates over the template node tree $node and returns a new transformed tree in $newNode.
Definition at line 1236 of file eztemplatecompiler.php.
Referenced by compileTemplate().
| static eZTemplateCompiler::processNodeTransformationChild | ( | $ | useComments, |
| $ | php, | ||
| $ | tpl, | ||
| &$ | node, | ||
| &$ | resourceData | ||
| ) | [static] |
Iterates over the children of the function node $node and transforms the tree. If the node is not a function it will return false.
Definition at line 1315 of file eztemplatecompiler.php.
Referenced by processNodeTransformationChildren(), and processNodeTransformationRoot().
| static eZTemplateCompiler::processNodeTransformationChildren | ( | $ | useComments, |
| $ | php, | ||
| $ | tpl, | ||
| &$ | node, | ||
| &$ | children, | ||
| &$ | resourceData | ||
| ) | [static] |
Iterates over the children $children and does transformation on them.
Definition at line 1258 of file eztemplatecompiler.php.
Referenced by processNodeTransformationNodes().
| static eZTemplateCompiler::processNodeTransformationNodes | ( | $ | tpl, |
| &$ | node, | ||
| &$ | nodes, | ||
| &$ | privateData | ||
| ) | [static] |
Iterates over the nodes $nodes and does transformation on them.
Definition at line 1246 of file eztemplatecompiler.php.
Referenced by eZTemplateCompiledLoop\processChildren(), eZTemplateSwitchFunction\templateNodeCaseTransformation(), and eZTemplateSectionFunction\templateNodeTransformation().
| static eZTemplateCompiler::processNodeTransformationRoot | ( | $ | useComments, |
| $ | php, | ||
| $ | tpl, | ||
| &$ | node, | ||
| &$ | resourceData | ||
| ) | [static] |
Iterates over the children of the root node $node and does transformation on them.
Definition at line 1281 of file eztemplatecompiler.php.
Referenced by processNodeTransformation(), and processNodeTransformationChild().
| static eZTemplateCompiler::processRemoveNodePlacement | ( | &$ | node | ) | [static] |
Iterates over the node tree and removes all placement information.
Definition at line 1604 of file eztemplatecompiler.php.
Referenced by compileTemplate().
| static eZTemplateCompiler::processStaticOptimizations | ( | $ | useComments, |
| $ | php, | ||
| $ | tpl, | ||
| &$ | node, | ||
| &$ | resourceData, | ||
| &$ | newNode | ||
| ) | [static] |
Iterates over the items in the tree $node and tries to extract static data from operators which supports it.
Definition at line 1136 of file eztemplatecompiler.php.
Referenced by compileTemplate().
| static eZTemplateCompiler::setSettings | ( | $ | settingsMap | ) | [static] |
Sets/unsets various compiler settings. To set a setting add a key in the $settingsMap with the wanted value, to unset it use null as the value.
The following values can be set.
Definition at line 105 of file eztemplatecompiler.php.
| static eZTemplateCompiler::setVariableStatistics | ( | &$ | stats, |
| $ | namespace, | ||
| $ | variableName, | ||
| $ | changes | ||
| ) | [static] |
Definition at line 866 of file eztemplatecompiler.php.
Referenced by calculateVariableNodeStatistics(), eZTemplateSetFunction\functionTemplateStatistics(), and eZTemplateSectionFunction\functionTemplateStatistics().
| static eZTemplateCompiler::staticNodeData | ( | $ | node | ) | [static] |
false if no data could be fetched. Will only return data from text nodes and variables nodes without variable lookup, attribute lookup or operators. Definition at line 1105 of file eztemplatecompiler.php.
Referenced by combineStaticNodes().
| static eZTemplateCompiler::TemplatePrefix | ( | ) | [static] |
Returns the prefix for file names
Definition at line 78 of file eztemplatecompiler.php.
Referenced by compileTemplate(), createCommonCompileTemplate(), executeCompilationHelper(), generatePHPCodeChildren(), and hasCompiledTemplate().
| const eZTemplateCompiler::CODE_DATE = 1074699607 |
Definition at line 72 of file eztemplatecompiler.php.
Referenced by compileTemplate().