lib/eztemplate/classes/eztemplate.php

Show: inherited
Table of Contents

File containing the eZTemplate class.

Copyright
Copyright (C) 1999-2011 eZ Systems AS. All rights reserved.  
License
eZ Business Use License Agreement Version 2.0  
Package
lib  
Version
4.6.0  

\eZTemplate

Package: lib

File containing the eZTemplate class.

Copyright
Copyright (C) 1999-2011 eZ Systems AS. All rights reserved.  
License
eZ Business Use License Agreement Version 2.0  
Version
4.6.0  

Constants

Constant  RESOURCE_FETCH = 1
Constant  RESOURCE_QUERY = 2
Constant  ELEMENT_TEXT = 1
Constant  ELEMENT_SINGLE_TAG = 2
Constant  ELEMENT_NORMAL_TAG = 3
Constant  ELEMENT_END_TAG = 4
Constant  ELEMENT_VARIABLE = 5
Constant  ELEMENT_COMMENT = 6
Constant  NODE_ROOT = 1
Constant  NODE_TEXT = 2
Constant  NODE_VARIABLE = 3
Constant  NODE_FUNCTION = 4
Constant  NODE_OPERATOR = 5
Constant  NODE_INTERNAL = 100
Constant  NODE_INTERNAL_CODE_PIECE = 101
Constant  NODE_INTERNAL_VARIABLE_SET = 105
Constant  NODE_INTERNAL_VARIABLE_UNSET = 102
Constant  NODE_INTERNAL_NAMESPACE_CHANGE = 103
Constant  NODE_INTERNAL_NAMESPACE_RESTORE = 104
Constant  NODE_INTERNAL_WARNING = 120
Constant  NODE_INTERNAL_ERROR = 121
Constant  NODE_INTERNAL_RESOURCE_ACQUISITION = 140
Constant  NODE_OPTIMIZED_RESOURCE_ACQUISITION = 141
Constant  NODE_INTERNAL_OUTPUT_ASSIGN = 150
Constant  NODE_INTERNAL_OUTPUT_READ = 151
Constant  NODE_INTERNAL_OUTPUT_INCREASE = 152
Constant  NODE_INTERNAL_OUTPUT_DECREASE = 153
Constant  NODE_INTERNAL_OUTPUT_SPACING_INCREASE = 160
Constant  NODE_INTERNAL_SPACING_DECREASE = 161
Constant  NODE_OPTIMIZED_INIT = 201
Constant  NODE_USER_CUSTOM = 1000
Constant  TYPE_VOID = 0
Constant  TYPE_STRING = 1
Constant  TYPE_NUMERIC = 2
Constant  TYPE_IDENTIFIER = 3
Constant  TYPE_VARIABLE = 4
Constant  TYPE_ATTRIBUTE = 5
Constant  TYPE_OPERATOR = 6
Constant  TYPE_BOOLEAN = 7
Constant  TYPE_ARRAY = 8
Constant  TYPE_DYNAMIC_ARRAY = 9
Constant  TYPE_INTERNAL = 100
Constant  TYPE_INTERNAL_CODE_PIECE = 101
Constant  TYPE_PHP_VARIABLE = 102
Constant  TYPE_OPTIMIZED_NODE = 201
Constant  TYPE_OPTIMIZED_ARRAY_LOOKUP = 202
Constant  TYPE_OPTIMIZED_CONTENT_CALL = 203
Constant  TYPE_OPTIMIZED_ATTRIBUTE_LOOKUP = 204
Constant  TYPE_INTERNAL_STOP = 999
Constant  TYPE_STRING_BIT = 1
Constant  TYPE_NUMERIC_BIT = 2
Constant  TYPE_IDENTIFIER_BIT = 4
Constant  TYPE_VARIABLE_BIT = 8
Constant  TYPE_ATTRIBUTE_BIT = 16
Constant  TYPE_OPERATOR_BIT = 32
Constant  TYPE_NONE = 0
Constant  TYPE_ALL = 63
Constant  TYPE_BASIC = 47
Constant  TYPE_MODIFIER_MASK = 48
Constant  NAMESPACE_SCOPE_GLOBAL = 1
Constant  NAMESPACE_SCOPE_LOCAL = 2
Constant  NAMESPACE_SCOPE_RELATIVE = 3
Constant  DEBUG_INTERNALS = false
Constant  FILE_ERRORS = 1

Properties

Propertypublic  $AutoloadPathList= ''
Details
Type
n/a
Propertypublic  $CurrentLocalVariablesNames= ''
Details
Type
n/a
Propertypublic  $DefaultResource= ''
Details
Type
n/a
Propertypublic  $DoCounter= ''
Details
Type
n/a
Propertypublic  $ElseifCounter= ''
Details
Type
n/a
Propertypublic  $ErrorLog= ''
Details
Type
n/a
Propertypublic  $ForCounter= ''
Details
Type
n/a
Propertypublic  $ForeachCounter= ''
Details
Type
n/a
Propertypublic  $FunctionAttributes= ''
Details
Type
n/a
Propertypublic  $Functions= ''
Details
Type
n/a
Propertypublic  $IncludeOutput= ''
Details
Type
n/a
Propertypublic  $IncludeText= ''
Details
Type
n/a
Propertypublic  $IsCachingAllowed= ''
Details
Type
n/a
Propertypublic  $LDelim= ''
Details
Type
n/a
Propertypublic  $Level= '0'
Default value0Details
Type
n/a
Propertypublic  $Literals= ''
Details
Type
n/a
Propertypublic  $LocalVariablesNamesStack= ''
Details
Type
n/a
Propertypublic  $MaxLevel= '40'
Default value40Details
Type
n/a
Propertypublic  $Operators= ''
Details
Type
n/a
Propertypublic  $RDelim= ''
Details
Type
n/a
Propertypublic  $Resources= ''
Details
Type
n/a
Propertypublic  $ShowDetails= 'false'
Default valuefalseDetails
Type
n/a
Propertypublic  $TemplatesUsageStatistics= ''
Details
Type
n/a
Propertypublic  $TestCompile= ''
Details
Type
n/a
Propertypublic  $Text= ''
Details
Type
n/a
Propertypublic  $TimeStamp= ''
Details
Type
n/a
Propertypublic  $Tree= ''
Details
Type
n/a
Propertypublic  $Variables= ''
Details
Type
n/a
Propertypublic  $WarningLog= ''
Details
Type
n/a
Propertypublic  $WhileCounter= ''
Details
Type
n/a
Propertyprotectedbool  $factory= 'false'
static

Factory flag as used by {@link eZTemplate::factory()} Reset with {@link eZTemplate::resetInstance()}

Default valuefalseDetails
Type
bool
Propertyprotectednull|\eZTemplate  $instance= ''
static

Singelton instance of eZTemplate used by {@link eZTemplate::instance()} Reset with {@link eZTemplate::resetInstance()}

Details
Type
null | \eZTemplate

Methods

methodpublicappendDebugNodes(  $root,  $resourceData ) : void

Parameters
Name Type Description
$root
$resourceData
methodpublicappendElement(  $text,  $item,  $nspace,  $name ) : void

Parameters
Name Type Description
$text
$item
$nspace
$name
methodpublicappendElementText(  $textElements,  $item,  $nspace,  $name ) : void

Parameters
Name Type Description
$textElements
$item
$nspace
$name
methodpublicappendTemplateFetch(  $actualTemplateName ) : void

Parameters
Name Type Description
$actualTemplateName
methodpublicappendTemplateToStatistics(  $templateName,  $templateFileName ) : void

Parameters
Name Type Description
$templateName
$templateFileName
methodpublicappendTemplateToStatisticsIfNeeded(  $templateName,  $templateFileName ) : void

Parameters
Name Type Description
$templateName
$templateFileName
methodpublicattributeValue(  $data,  $nspace ) : void

Parameters
Name Type Description
$data
$nspace
methodpublicautoload( ) : void

methodpublicautoloadPathList( ) : void

methodpubliccanCompileTemplate(  $resourceData,  $extraParameters ) : void

Parameters
Name Type Description
$resourceData
$extraParameters
methodpubliccompileTemplate(  $resourceData,  $extraParameters ) : void

Parameters
Name Type Description
$resourceData
$extraParameters
methodpubliccompileTemplateFile(  $file,  $returnResourceData = false ) : void

Parameters
Name Type Description
$file
$returnResourceData
methodpubliccreateLocalVariablesList( ) : void

methodpublicdestroyLocalVariablesList( ) : void

methodpublicdisplay(  $template = false,  $extraParameters = false ) : void

Parameters
Name Type Description
$template
$extraParameters
methodpublicdoFunction(  $name,  $func_obj,  $nspace,  $current_nspace ) : void

Parameters
Name Type Description
$name
$func_obj
$nspace
$current_nspace
methodpublicdoOperator(  $element,  $namespace,  $current_nspace,  $value,  $operatorName,  $operatorParameters,  $named_params ) : void

Parameters
Name Type Description
$element
$namespace
$current_nspace
$value
$operatorName
$operatorParameters
$named_params
methodpubliceZTemplate( ) : void

methodpublicelementValue(  $dataElements,  $rootNamespace,  $currentNamespace,  $placement = false,  $checkExistance = false,  $checkForProxy = false ) : void

Parameters
Name Type Description
$dataElements
$rootNamespace
$currentNamespace
$placement
$checkExistance
$checkForProxy
methodpublicemptyVariable( ) : void

methodpublicerror(  $name,  $txt,  $placement = false ) : void

Parameters
Name Type Description
$name
$txt
$placement
methodpublicerrorCount( ) : void

methodpublicerrorLog( ) : void

methodpublicexecuteCompiledTemplate(  $resourceData,  $textElements,  $rootNamespace,  $currentNamespace,  $extraParameters ) : void

Parameters
Name Type Description
$resourceData
$textElements
$rootNamespace
$currentNamespace
$extraParameters
methodpublicexpandAttributes(  $attributeList,  $chooseText,  $maxThreshold,  $minThreshold = 1 ) : void

Parameters
Name Type Description
$attributeList
$chooseText
$maxThreshold
$minThreshold
methodpublicextraParameters(  $name,  $count,  $maxCount ) : void

Parameters
Name Type Description
$name
$count
$maxCount
methodpublicfactory( ) : \eZTemplate
static

Returns a shared instance of the eZTemplate class with default settings applied, like: - Autoload operators loaded - Debug mode set - eZTemplateDesignResource::instance registered

Returns
Type Description
\eZTemplate
Details
Since
4.3  
methodpublicfetch(  $template = false,  $extraParameters = false,  $returnResourceData = false ) : void

Parameters
Name Type Description
$template
$extraParameters
$returnResourceData
methodpublicfetchFunctionObject(  $functionName ) : void

Parameters
Name Type Description
$functionName
methodpublichasChildren(  $function,  $functionName ) : void

Parameters
Name Type Description
$function
$functionName
methodpublichasErrors( ) : void

methodpublichasLocalVariable(  $varName,  $rootNamespace ) : void

Parameters
Name Type Description
$varName
$rootNamespace
methodpublichasVariable( string $var, string $namespace = '', array $attrs = null ) : bool

Returns true if the variable $var is set in namespace $namespace, if $attrs is supplied all attributes must exist for the function to return true.

Parameters
Name Type Description
$var string
$namespace string

(optional)

$attrs array

(optional) Deprecated as of 4.4.

Returns
Type Description
bool
methodpublichasWarnings( ) : void

methodpublicini( ) : \eZINI

Returns the eZINI object instance for the template.ini file.

Returns
Type Description
\eZINI
methodpublicinstance( ) : \eZTemplate
static

Returns a shared instance of the eZTemplate class.

Returns
Type Description
\eZTemplate
methodpublicisCachingAllowed( ) : void

methodpublicisDebugEnabled( ) : void
static

methodpublicisMethodDebugEnabled( ) : void
static

methodpublicisTemplatesUsageStatisticsEnabled( ) : void
static

methodpublicisXHTMLCodeIncluded( ) : void
static

methodpublicleftDelimiter( ) : void

methodpublicload(  $uri,  $extraParameters = false,  $returnResourceData = false ) : void

Parameters
Name Type Description
$uri
$extraParameters
$returnResourceData
methodpublicloadAndRegisterFunctions(  $functionDefinition ) : void

Parameters
Name Type Description
$functionDefinition
methodpublicloadAndRegisterOperators(  $operatorDefinition ) : void

Parameters
Name Type Description
$operatorDefinition
methodpublicloadURIData(  $resourceObject,  $uri,  $resourceName,  $template,  $extraParameters,  $displayErrors = true ) : void

Parameters
Name Type Description
$resourceObject
$uri
$resourceName
$template
$extraParameters
$displayErrors
methodpublicloadURIRoot(  $uri,  $displayErrors = true,  $extraParameters ) : void

Parameters
Name Type Description
$uri
$displayErrors
$extraParameters
methodpublicmergeNamespace(  $rootNamespace,  $additionalNamespace ) : void

Parameters
Name Type Description
$rootNamespace
$additionalNamespace
methodpublicmissingParameter(  $name,  $param ) : void

Parameters
Name Type Description
$name
$param
methodpublicoperatorInputSupported(  $operatorName ) : void

Parameters
Name Type Description
$operatorName
methodpublicoperatorParameterList(  $name ) : void

Parameters
Name Type Description
$name
methodpublicparse(  $sourceText,  $rootElement,  $rootNamespace,  $resourceData ) : void

Parameters
Name Type Description
$sourceText
$rootElement
$rootNamespace
$resourceData
methodpublicplacementText(  $placement = false ) : void

Parameters
Name Type Description
$placement
methodpublicprocess(  $root,  $text,  $rootNamespace,  $currentNamespace ) : void

Parameters
Name Type Description
$root
$text
$rootNamespace
$currentNamespace
methodpublicprocessFunction(  $functionName,  $textElements,  $functionChildren,  $functionParameters,  $functionPlacement,  $rootNamespace,  $currentNamespace ) : void

Parameters
Name Type Description
$functionName
$textElements
$functionChildren
$functionParameters
$functionPlacement
$rootNamespace
$currentNamespace
methodpublicprocessNode(  $node,  $textElements,  $rootNamespace,  $currentNamespace ) : void

Parameters
Name Type Description
$node
$textElements
$rootNamespace
$currentNamespace
methodpublicprocessOperator(  $operatorName,  $operatorParameters,  $rootNamespace,  $currentNamespace,  $valueData,  $placement = false,  $checkExistance = false ) : void

Parameters
Name Type Description
$operatorName
$operatorParameters
$rootNamespace
$currentNamespace
$valueData
$placement
$checkExistance
methodpublicprocessURI(  $uri,  $displayErrors = true,  $extraParameters,  $textElements,  $rootNamespace,  $currentNamespace ) : void

Parameters
Name Type Description
$uri
$displayErrors
$extraParameters
$textElements
$rootNamespace
$currentNamespace
methodpublicprocessVariable(  $textElements,  $variableData,  $variablePlacement,  $rootNamespace,  $currentNamespace ) : void

Parameters
Name Type Description
$textElements
$variableData
$variablePlacement
$rootNamespace
$currentNamespace
methodpublicregisterAutoloadFunctions(  $functionDefinition ) : void

Parameters
Name Type Description
$functionDefinition
methodpublicregisterAutoloadOperators(  $operatorDefinition ) : void

Parameters
Name Type Description
$operatorDefinition
methodpublicregisterFilter( ) : void

methodpublicregisterFunction(  $func_name,  $func_obj ) : void

Parameters
Name Type Description
$func_name
$func_obj
methodpublicregisterFunctions(  $functionObject ) : void

Parameters
Name Type Description
$functionObject
methodpublicregisterFunctionsInternal(  $functionObject,  $debug = false ) : void

Parameters
Name Type Description
$functionObject
$debug
methodpublicregisterLiteral(  $func_name ) : void

Parameters
Name Type Description
$func_name
methodpublicregisterOperator(  $op_name,  $op_obj ) : void

Parameters
Name Type Description
$op_name
$op_obj
methodpublicregisterOperators(  $operatorObject ) : void

Parameters
Name Type Description
$operatorObject
methodpublicregisterOperatorsInternal(  $operatorObject,  $debug = false ) : void

Parameters
Name Type Description
$operatorObject
$debug
methodpublicregisterResource(  $res ) : void

Parameters
Name Type Description
$res
methodpublicreset( ) : void

methodpublicresetElements( ) : void

methodpublicresetErrorLog( ) : void

methodpublicresetInstance( ) : void
static

Reset shared instance of the eZTemplate class and factory flag as used by {@link eZTemplate::instance()} and {@link eZTemplate::factory()}

Details
Since
4.3  
methodpublicresetVariables( ) : void

methodpublicresourceData(  $resourceObject,  $uri,  $resourceName,  $templateName ) : void

Parameters
Name Type Description
$resourceObject
$uri
$resourceName
$templateName
methodpublicresourceFor(  $uri,  $res,  $template ) : void

Parameters
Name Type Description
$uri
$res
$template
methodpublicresourceHandler(  $resourceName ) : void

Parameters
Name Type Description
$resourceName
methodpublicrightDelimiter( ) : void

methodpublicsetAutoloadPathList(  $pathList ) : void

Parameters
Name Type Description
$pathList
methodpublicsetCompileTest(  $val ) : void

Parameters
Name Type Description
$val
methodpublicsetIncludeOutput(  $uri,  $output ) : void

Parameters
Name Type Description
$uri
$output
methodpublicsetIncludeText(  $uri,  $text ) : void

Parameters
Name Type Description
$uri
$text
methodpublicsetIsCachingAllowed(  $allowed ) : void

Parameters
Name Type Description
$allowed
methodpublicsetIsDebugEnabled(  $debug ) : void
static

Parameters
Name Type Description
$debug
methodpublicsetIsTemplatesUsageStatisticsEnabled(  $enabled ) : void

Parameters
Name Type Description
$enabled
methodpublicsetLeftDelimiter(  $delim ) : void

Parameters
Name Type Description
$delim
methodpublicsetLocalVariable(  $varName,  $varValue,  $rootNamespace ) : void

Parameters
Name Type Description
$varName
$varValue
$rootNamespace
methodpublicsetRightDelimiter(  $delim ) : void

Parameters
Name Type Description
$delim
methodpublicsetShowDetails(  $show ) : void

Parameters
Name Type Description
$show
methodpublicsetVariable( string $var, string $val, string $namespace = '', bool $scopeSafe = false ) : void

Sets the template variable $var to the value $val.

Parameters
Name Type Description
$var string
$val string
$namespace string

(optional)

$scopeSafe bool

If true, will assure that $var is not overridden for $namespace. False by default

Details
Used_by
\eZTemplate::setVariableRef()  
methodpublicsetVariableRef( string $var, string $val, string $namespace = '' ) : void

Sets the template variable $var to the value $val by ref

Parameters
Name Type Description
$var string
$val string
$namespace string

(optional)

Details
Deprecated
Since 4.4, have not used references since 3.10  
Uses
\eZTemplate::setVariable()  
methodpublictemplateFetchList( ) : void

methodpublictemplatesUsageStatistics( ) : void
static

methodpublictestCompile( ) : void

methodpublicundefinedFunction(  $func_name ) : void

Parameters
Name Type Description
$func_name
methodpublicundefinedVariable(  $name,  $var ) : void

Parameters
Name Type Description
$name
$var
methodpublicunregisterLiteral(  $func_name ) : void

Parameters
Name Type Description
$func_name
methodpublicunregisterOperator(  $op_name ) : void

Parameters
Name Type Description
$op_name
methodpublicunregisterResource(  $res_name ) : void

Parameters
Name Type Description
$res_name
methodpublicunsetLocalVariable(  $varName,  $rootNamespace ) : void

Parameters
Name Type Description
$varName
$rootNamespace
methodpublicunsetLocalVariables( ) : void

methodpublicunsetVariable( string $var, string $namespace = '' ) : void

Unsets the template variable $var.

Parameters
Name Type Description
$var string
$namespace string

(optional)

methodpublicvalidateTemplateFile(  $file,  $returnResourceData = false ) : void

Parameters
Name Type Description
$file
$returnResourceData
methodpublicvariable( string $var, string $namespace = '', array $attrs = null ) : string | array

Returns the content of the variable $var using namespace $namespace, if $attrs is supplied the result of the attributes is returned.

Parameters
Name Type Description
$var string
$namespace string

(optional)

$attrs array

(optional) Deprecated as of 4.4

Returns
Type Description
string | array
methodpublicvariableAttribute(  $var,  $attrs ) : void

Parameters
Name Type Description
$var
$attrs
methodpublicvariableText(  $var,  $namespace = "",  $attrs = array() ) : void

Parameters
Name Type Description
$var
$namespace
$attrs
methodpublicwarning(  $name,  $txt,  $placement = false ) : void

Parameters
Name Type Description
$name
$txt
$placement
methodpublicwarningCount( ) : void

methodpublicwarningLog( ) : void

Documentation was generated by DocBlox 0.18.1.