eZPublishCommunityProject(LegacyStack)  2013.9
eZTemplateNodeTool Class Reference

Various tool functions for working with template nodes. More...

Static Public Member Functions

static createArrayElement ($array, $variablePlacement=false)
 
static createAssignFromOutputVariableNode ($variableName, $parameters=array(), $assignmentType=eZPHPCreator::VARIABLE_ASSIGNMENT)
 
static createAttributeLookupElement ($attributeValues=array(), $variablePlacement=false)
 
static createBooleanElement ($boolean, $variablePlacement=false)
 
static createCodePieceElement ($codePiece, $values=false, $placement=false, $tmpValues=false, $knownTypes=true)
 
static createCodePieceNode ($codePiece, $parameters=array())
 
static createConstantElement ($constant, $variablePlacement=false)
 
static createDynamicArrayElement (&$arrayKeys, &$arrayValues, $variablePlacement=false)
 
static createErrorNode ($text, $label, $placement=false, $parameters=array())
 
static createFunctionNodeHook (&$node, $hookName, $hookParameters=array(), $hookFunction=false)
 
static createIdentifierElement ($identifier, $variablePlacement=false)
 
static createNamespaceChangeNode ($variableData, $parameters=array())
 
static createNamespaceRestoreNode ($parameters=array())
 
static createNumericElement ($number, $variablePlacement=false)
 
static createOperatorElement ($name, $parameters=array(), $variablePlacement=false)
 
static createOutputVariableDecreaseNode ($parameters=array())
 
static createOutputVariableIncreaseNode ($parameters=array())
 
static createPHPVariableElement ($variableName, $variablePlacement=false)
 
static createResourceAcquisitionNode ($resourceName, $templateName, $fileName, $method, $extraParameters, $placement=false, $parameters=array(), $newRootNamespace=false, $resourceVariableName=false)
 
static createSpacingDecreaseNode ($spacing=4, $parameters=array())
 
static createSpacingIncreaseNode ($spacing=4, $parameters=array())
 
static createStringElement ($string, $variablePlacement=false)
 
static createTextNode ($text)
 
static createVariableElement ($variableName, $namespaceName, $namespaceScope=eZTemplate::NAMESPACE_SCOPE_LOCAL, $variablePlacement=false)
 
static createVariableNode ($originalNode=false, $variableData=false, $variablePlacement=false, $parameters=array(), $variableAssignmentName=false, $onlyExisting=false, $overWrite=true, $assignFromVariable=false, $rememberSet=false)
 
static createVariableUnsetNode ($variableName, $parameters=array())
 
static createVoidElement ()
 
static createWarningNode ($text, $label, $placement=false, $parameters=array())
 
static createWriteToOutputVariableNode ($variableName, $parameters=array(), $assignmentType=eZPHPCreator::VARIABLE_APPEND_TEXT)
 
static deflateFunctionNode (&$node, $preHook, $postHook)
 
static elementConstantValue ($elements)
 
static elementDynamicArray ($elements)
 
static elementDynamicArrayKeys ($elements)
 
static extractFunctionNodeChildren (&$node)
 
static extractFunctionNodeName (&$node)
 
static extractFunctionNodeParameterNames (&$node)
 
static extractFunctionNodeParameters (&$node)
 
static extractFunctionNodePlacement (&$node)
 
static extractNodes ($nodeList, $parameters=array())
 
static extractOperatorNodeParameters (&$node)
 
static extractVariableNodeData (&$node)
 
static extractVariableNodePlacement (&$node)
 
static isArrayElement ($elements)
 
static isBooleanElement ($elements)
 
static isConstantElement ($elements)
 
static isDynamicArrayElement ($elements)
 
static isIdentifierElement ($elements)
 
static isInternalCodePiece ($elements)
 
static isNumericElement ($elements)
 
static isPHPVariableElement ($elements)
 
static isStringElement ($elements)
 
static isVariableElement ($elements)
 
static removeFunctionNodeChildren (&$node)
 
static removeFunctionNodeParameters (&$node)
 
static removeFunctionNodePlacement (&$node)
 

Detailed Description

Various tool functions for working with template nodes.

Member Function Documentation

static eZTemplateNodeTool::createArrayElement (   $array,
  $variablePlacement = false 
)
static
static eZTemplateNodeTool::createAssignFromOutputVariableNode (   $variableName,
  $parameters = array(),
  $assignmentType = eZPHPCreator::VARIABLE_ASSIGNMENT 
)
static

Creates a new template node that will assign the content of the current output variable to the variable named $variableName.

The assignment type is by default variable assignment (=) and can be changed using $assignmentType.

Parameters
$parametersAn array with optional parameters, can contain the followin:
  • spacing - The number of spaces to added for each line this expression creates.

Referenced by eZTemplateCacheFunction\templateNodeTransformation(), and eZTemplateBlockFunction\templateNodeTransformation().

static eZTemplateNodeTool::createAttributeLookupElement (   $attributeValues = array(),
  $variablePlacement = false 
)
static

Creates an element which does lookup on an attribute and returns it.

Parameters
$attributeValuesMust be an array with elements that result in scalar value or string.

Referenced by eZObjectForwarder\resourceAcquisitionTransformation(), and eZObjectForwarder\templateNodeTransformation().

static eZTemplateNodeTool::createBooleanElement (   $boolean,
  $variablePlacement = false 
)
static
static eZTemplateNodeTool::createCodePieceElement (   $codePiece,
  $values = false,
  $placement = false,
  $tmpValues = false,
  $knownTypes = true 
)
static

Referenced by eZTemplateArrayOperator\arrayTrans(), eZTemplateArithmeticOperator\basicTransformation(), eZTemplateArithmeticOperator\castTransformation(), eZTemplateLogicOperator\chooseTransformation(), eZTemplateArrayOperator\compareTrans(), eZTemplateTextOperator\concatTransformation(), eZTemplateControlOperator\condTransform(), eZTemplateLocaleOperator\currentDateTransformation(), eZTemplateStringOperator\customMapTransformation(), eZTemplateLocaleOperator\dateTimeTransformation(), eZTemplateArithmeticOperator\decIncTransformation(), eZTemplateArrayOperator\extractTrans(), eZTemplateExecuteOperator\fetchTransform(), eZTemplateLocaleOperator\getTimeTransformation(), eZTemplateDigestOperator\hashTransformation(), eZi18nOperator\i18nTrans(), eZTemplateTextOperator\indentTransformation(), eZURLOperator\iniTrans(), eZTemplateTypeOperator\isTransform(), eZTemplateLocaleOperator\l10nTransformation(), eZTemplateLogicOperator\logicalComparisonTransformation(), eZTemplateLocaleOperator\makeDateTimeTransformation(), eZTemplateArrayOperator\mergeTrans(), eZTemplateArithmeticOperator\minMaxTransformation(), eZTemplateArithmeticOperator\modTransformation(), eZTemplateLogicOperator\negateTransformation(), eZTemplateNl2BrOperator\nl2brTransformation(), eZTemplateUnitOperator\operatorTransform(), eZTemplateStringOperator\phpMapTransformation(), eZTemplatePHPOperator\phpOperatorTransformation(), eZKernelOperator\preferencesTransformation(), eZTemplateArithmeticOperator\randTransformation(), eZTemplateArithmeticOperator\roundTransformation(), eZURLOperator\urlTransformation(), and eZTemplateStringOperator\washTransformation().

static eZTemplateNodeTool::createCodePieceNode (   $codePiece,
  $parameters = array() 
)
static
static eZTemplateNodeTool::createConstantElement (   $constant,
  $variablePlacement = false 
)
static

Creates an element which represents the static value and returns it, the type of the variable determines the type of the element.

Referenced by eZTemplateTextOperator\concatTransformation(), eZTemplateStringOperator\customMapTransformation(), eZTemplateArrayOperator\extractTrans(), and eZTemplateLogicOperator\logicalComparisonTransformation().

static eZTemplateNodeTool::createDynamicArrayElement ( $arrayKeys,
$arrayValues,
  $variablePlacement = false 
)
static

Creates an element which represents an array and returns it.

Parameters
arraykey list, static.
arrayvalues as php code.
values.

Referenced by eZTemplateArrayOperator\arrayTrans().

static eZTemplateNodeTool::createErrorNode (   $text,
  $label,
  $placement = false,
  $parameters = array() 
)
static
static eZTemplateNodeTool::createFunctionNodeHook ( $node,
  $hookName,
  $hookParameters = array(),
  $hookFunction = false 
)
static

Creates a new function node hook with name $hookName and optional parameters $hookParameters and function data $hookFunction and returns it.

Referenced by deflateFunctionNode().

static eZTemplateNodeTool::createIdentifierElement (   $identifier,
  $variablePlacement = false 
)
static

Creates an element which represents an identifier and returns it.

static eZTemplateNodeTool::createNamespaceChangeNode (   $variableData,
  $parameters = array() 
)
static
static eZTemplateNodeTool::createNamespaceRestoreNode (   $parameters = array())
static
static eZTemplateNodeTool::createOperatorElement (   $name,
  $parameters = array(),
  $variablePlacement = false 
)
static

Creates an element which represents an operator and returns it.

Parameters
$nameThe name of the operator to run.
$parametersAn array with parameters, each parameter is an array of variable elements.
static eZTemplateNodeTool::createOutputVariableDecreaseNode (   $parameters = array())
static
static eZTemplateNodeTool::createOutputVariableIncreaseNode (   $parameters = array())
static
static eZTemplateNodeTool::createPHPVariableElement (   $variableName,
  $variablePlacement = false 
)
static

Creates an element which represents an array and returns it.

static eZTemplateNodeTool::createResourceAcquisitionNode (   $resourceName,
  $templateName,
  $fileName,
  $method,
  $extraParameters,
  $placement = false,
  $parameters = array(),
  $newRootNamespace = false,
  $resourceVariableName = false 
)
static
static eZTemplateNodeTool::createStringElement (   $string,
  $variablePlacement = false 
)
static
static eZTemplateNodeTool::createVariableElement (   $variableName,
  $namespaceName,
  $namespaceScope = eZTemplate::NAMESPACE_SCOPE_LOCAL,
  $variablePlacement = false 
)
static

Creates an element which represents an variable lookup and returns it.

Parameters
$namespaceScopeType of variable lookup, can be one of:

Referenced by eZObjectForwarder\resourceAcquisitionTransformation(), eZObjectForwarder\templateNodeTransformation(), and eZTemplateBlockFunction\templateNodeTransformation().

static eZTemplateNodeTool::createVariableNode (   $originalNode = false,
  $variableData = false,
  $variablePlacement = false,
  $parameters = array(),
  $variableAssignmentName = false,
  $onlyExisting = false,
  $overWrite = true,
  $assignFromVariable = false,
  $rememberSet = false 
)
static
static eZTemplateNodeTool::createVoidElement ( )
static

Creates an element which represents nothing (void).

Referenced by createConstantElement().

static eZTemplateNodeTool::createWarningNode (   $text,
  $label,
  $placement = false,
  $parameters = array() 
)
static
static eZTemplateNodeTool::createWriteToOutputVariableNode (   $variableName,
  $parameters = array(),
  $assignmentType = eZPHPCreator::VARIABLE_APPEND_TEXT 
)
static

Creates a new template node that will assign the content of the current output variable to the variable named $variableName.

The assignment type is by default text concat (.) and can be changed using $assignmentType.

Parameters
$parametersAn array with optional parameters, can contain the followin:
  • spacing - The number of spaces to added for each line this expression creates.

Referenced by eZTemplateCacheFunction\templateNodeTransformation().

static eZTemplateNodeTool::deflateFunctionNode ( $node,
  $preHook,
  $postHook 
)
static

Creates a pre and post hook for the function node $node with the children in between the nodes. This means that a nested function node will be deflated to a pre/children/post list.

static eZTemplateNodeTool::elementConstantValue (   $elements)
static
Returns
The value of the constant element or null if the element is not constant.
Note
Make sure the element is checked with isConstantElement() before running this.
Can also be used on PHP variable elements, it will then fetch the variable name.

Referenced by eZURLOperator\applyQuotes(), eZTemplateArrayOperator\arrayTrans(), eZTemplateArithmeticOperator\basicTransformation(), eZTemplateArithmeticOperator\castTransformation(), eZTemplateLogicOperator\chooseTransformation(), eZTemplateArrayOperator\compareTrans(), eZTemplateTextOperator\concatTransformation(), eZTemplateControlOperator\condTransform(), eZTemplateStringOperator\customMapTransformation(), eZTemplateLocaleOperator\dateTimeTransformation(), eZTemplateArithmeticOperator\decIncTransformation(), eZTemplateArrayOperator\extractTrans(), eZTemplateExecuteOperator\fetchTransform(), eZTemplateCompiler\generateVariableDataCode(), eZi18nOperator\i18nTrans(), eZTemplateTextOperator\indentTransformation(), eZURLOperator\iniTrans(), eZTemplateLocaleOperator\l10nTransformation(), eZTemplateLogicOperator\logicalComparisonTransformation(), eZTemplateArrayOperator\mergeTrans(), eZTemplateArithmeticOperator\minMaxTransformation(), eZTemplateArithmeticOperator\modTransformation(), eZTemplateUnitOperator\operatorTransform(), eZTemplateStringOperator\phpMapTransformation(), eZKernelOperator\preferencesTransformation(), eZTemplateCompiledLoop\processChildren(), eZTemplateArithmeticOperator\romanTransformation(), eZTemplateArithmeticOperator\roundTransformation(), eZTemplateSwitchFunction\templateNodeCaseTransformation(), eZObjectForwarder\templateNodeTransformation(), eZTemplateMenuFunction\templateNodeTransformation(), eZTemplateToolbarFunction\templateNodeTransformation(), eZTemplateCacheFunction\templateNodeTransformation(), eZTemplateIncludeFunction\templateNodeTransformation(), eZTemplateSetFunction\templateNodeTransformation(), eZTemplateSequenceFunction\templateNodeTransformation(), eZTemplateBlockFunction\templateNodeTransformation(), eZTemplateSectionFunction\templateNodeTransformation(), eZTemplateDebugFunction\templateNodeTransformation(), eZTemplateSwitchFunction\templateNodeTransformation(), eZURLOperator\urlTransformation(), and eZTemplateStringOperator\washTransformation().

static eZTemplateNodeTool::elementDynamicArray (   $elements)
static
Returns
assosiative array of parameters in Dynamic Array

Referenced by eZTemplateExecuteOperator\fetchTransform().

static eZTemplateNodeTool::elementDynamicArrayKeys (   $elements)
static
Returns
the array keys of the Dynamic array

Referenced by eZTemplateExecuteOperator\fetchTransform().

static eZTemplateNodeTool::extractFunctionNodeName ( $node)
static
Returns
the name of the function for the function node $node.

Referenced by eZTemplateSectionFunction\templateNodeTransformation().

static eZTemplateNodeTool::extractFunctionNodeParameterNames ( $node)
static
Returns
the parameters of the function node $node.
static eZTemplateNodeTool::extractNodes (   $nodeList,
  $parameters = array() 
)
static
static eZTemplateNodeTool::extractOperatorNodeParameters ( $node)
static
Returns
the parameters for the operator node $node.
static eZTemplateNodeTool::extractVariableNodeData ( $node)
static
Returns
the variable data from the variable node $node.
static eZTemplateNodeTool::extractVariableNodePlacement ( $node)
static
Returns
the variable placement from the variable node $node.

Referenced by eZTemplateLogicOperator\chooseTransformation().

static eZTemplateNodeTool::isArrayElement (   $elements)
static
Returns
true if the element list $elements is considered to be an array. It is considered constant if the following is true:
  • The start value is array
  • It has no operators
  • It has no attribute lookup
See Also
isConstantElement
static eZTemplateNodeTool::isBooleanElement (   $elements)
static
Returns
true if the element list $elements is considered to be a boolean. It is considered constant if the following is true:
  • The start value is boolean
  • It has no operators
  • It has no attribute lookup
See Also
isConstantElement
Note
If you don't care about pure booleans use isConstantElement instead and just use the element value as boolean value.
static eZTemplateNodeTool::isConstantElement (   $elements)
static
Returns
true if the element list $elements is considered to have a constant value. It is considered constant if the following is true:
  • The start value is either numeric, text, identifier, array or boolean
  • It has no operators
  • It has no attribute lookup

Referenced by eZTemplateArrayOperator\arrayTrans(), eZTemplateArithmeticOperator\basicTransformation(), eZTemplateArithmeticOperator\castTransformation(), eZTemplateLogicOperator\chooseTransformation(), eZTemplateArrayOperator\compareTrans(), eZTemplateTextOperator\concatTransformation(), eZTemplateControlOperator\condTransform(), eZTemplateStringOperator\customMapTransformation(), eZTemplateLocaleOperator\dateTimeTransformation(), eZTemplateArithmeticOperator\decIncTransformation(), elementConstantValue(), eZTemplateArrayOperator\extractTrans(), eZTemplateExecuteOperator\fetchTransform(), eZTemplateCompiler\generateVariableDataCode(), eZi18nOperator\i18nTrans(), eZTemplateTextOperator\indentTransformation(), eZURLOperator\iniTrans(), eZTemplateLocaleOperator\l10nTransformation(), eZTemplateLogicOperator\logicalComparisonTransformation(), eZTemplateArrayOperator\mergeTrans(), eZTemplateArithmeticOperator\minMaxTransformation(), eZTemplateArithmeticOperator\modTransformation(), eZTemplateUnitOperator\operatorTransform(), eZTemplateStringOperator\phpMapTransformation(), eZKernelOperator\preferencesTransformation(), eZTemplateCompiledLoop\processChildren(), eZTemplateArithmeticOperator\romanTransformation(), eZTemplateArithmeticOperator\roundTransformation(), eZTemplateSwitchFunction\templateNodeCaseTransformation(), eZObjectForwarder\templateNodeTransformation(), eZTemplateMenuFunction\templateNodeTransformation(), eZTemplateToolbarFunction\templateNodeTransformation(), eZTemplateCacheFunction\templateNodeTransformation(), eZTemplateIncludeFunction\templateNodeTransformation(), eZTemplateSetFunction\templateNodeTransformation(), eZTemplateSequenceFunction\templateNodeTransformation(), eZTemplateBlockFunction\templateNodeTransformation(), eZTemplateSectionFunction\templateNodeTransformation(), eZTemplateDebugFunction\templateNodeTransformation(), eZTemplateSwitchFunction\templateNodeTransformation(), eZURLOperator\urlTransformation(), and eZTemplateStringOperator\washTransformation().

static eZTemplateNodeTool::isDynamicArrayElement (   $elements)
static

Check if element id Dynamic Array

Referenced by elementDynamicArray(), elementDynamicArrayKeys(), and eZTemplateExecuteOperator\fetchTransform().

static eZTemplateNodeTool::isIdentifierElement (   $elements)
static
Returns
true if the element list $elements is considered to be an identifier. It is considered constant if the following is true:
  • The start value is identifier
  • It has no operators
  • It has no attribute lookup
See Also
isConstantElement
Note
If you don't care about pure identifiers use isStringElement or isConstantElement instead.
static eZTemplateNodeTool::isInternalCodePiece (   $elements)
static
Returns
true if the element list $elements is considered to be an internal code piece.

Referenced by eZTemplateExecuteOperator\fetchTransform().

static eZTemplateNodeTool::isNumericElement (   $elements)
static
Returns
true if the element list $elements is considered to be numerical. It is considered constant if the following is true:
  • The start value is numeric (integer or float)
  • It has no operators
  • It has no attribute lookup
See Also
isConstantElement
Note
If you don't care about pure integers or floats use isConstantElement instead and just use the element value as numerical value.
static eZTemplateNodeTool::isPHPVariableElement (   $elements)
static
Returns
true if the element list $elements is considered to have a PHP variable element. The following must be true.
  • The start value is PHP variable
  • It has no operators
  • It has no attribute lookup

Referenced by elementConstantValue().

static eZTemplateNodeTool::isStringElement (   $elements)
static
Returns
true if the element list $elements is considered to be a string. It is considered constant if the following is true:
  • The start value is string or identifier
  • It has no operators
  • It has no attribute lookup
See Also
isConstantElement
Note
If you don't care about pure strings use isConstantElement instead and just use the element value as string value.
static eZTemplateNodeTool::isVariableElement (   $elements)
static
Returns
true if the element list $elements is considered to be a variable element.

Referenced by eZTemplateExecuteOperator\fetchTransform().

static eZTemplateNodeTool::removeFunctionNodeChildren ( $node)
static

Removes the children from the function node $node.

Referenced by deflateFunctionNode().

static eZTemplateNodeTool::removeFunctionNodeParameters ( $node)
static

Removes the parameters from the function node $node.

Referenced by deflateFunctionNode().

static eZTemplateNodeTool::removeFunctionNodePlacement ( $node)
static

Removes the placement info from the function node $node.


The documentation for this class was generated from the following file: