Class constructor
-
string
$src: Source (variable or file)
-
int
$type: Source type (T_BYFILE or T_BYVAR)
Triggers the parsing of the template
Compiles an "assign" tag
Examples:
<!-- assign var=$variable -->
<!-- assign var=1 -->
<!-- assign var=true -->
<!-- assign var="string" -->
<!-- assign var=$obj->method() -->
strign
_compileAssign
(string $expression)
-
string
$expression: Assignment expression
Compiles a "start block" tag
Example:
<!-- start block : block_name -->
string
_compileBlockStart
(string $blockName, string $parentBlock)
-
string
$blockName: Block name
-
string
$parentBlock: Parent block name
Compiles an "end capture" tag
string
_compileCaptureEnd
()
Compiles a "capture" tag
Examples:
<!-- capture -->
<!-- capture name="my_capture" -->
<!-- capture name="banner_capture" assign="banners" -->
string
_compileCaptureStart
(string $captureProperties, string $controlBlock)
-
string
$captureProperties: Raw capture properties
-
string
$controlBlock: Active dynamic block
void
_compileConfig
( $configProperties)
Compiles a function call ("call" and "function") tags
The "name" attribute is mandatory and should contain a function name, a class::method pair or an object->method expression, where the object must be a template variable.
Examples:
<
!--
function name=
"obj->doThis" p1=
"string" p2=
true --> ... <
!--
end function -->
<!-- call function="obj->doThat" p1=$var p2=1 p3=yes -->
<!-- call function="procFunc" p1=$anotherVar -->
<!-- call function="Class::staticMethod" -->
string
_compileFunctionCall
(string $funcProperties, [bool $isBlockFunction = FALSE], [string $controlBlock = NULL])
-
string
$funcProperties: Raw function arguments
-
bool
$isBlockFunction: Whether is a block function call (FUNCTION, END FUNCTION)
-
string
$controlBlock: Active dynamic block
Compiles an "end function" tag
string
_compileFunctionEnd
(array $funcData)
-
array
$funcData: Function arguments
Compiles "if" and "else if" tags
Examples:
<!-- if $var eq 1 -->
<!-- if ( ($a + $b) lt 20 ) -->
<!-- if $row is odd -->
<!-- if $data is not empty -->
<!-- else if $data !== null -->
<!-- else if ( ( $var eq 1 ) or ( $var eq 2 ) ) -->
string
_compileIf
(string $expression, [bool $elseif = FALSE])
-
string
$expression: Raw expression
-
bool
$elseif: Is this an "else if"?
Compiles an "include block" tag
Examples:
<!-- include block : templates/includes/include.tpl -->
<!-- include block : include_block -->
string
_compileInclude
(string $includeName, $controlBlock)
-
string
$includeName: Include name or file path
-
$controlBlock
Compiles an "includescript block" tag
Examples:
<!-- includescript block : templates/php/run_scripts.php -->
<!-- includescript block : include_block_name -->
string
_compileIncludeScript
(Include $includeName)
-
Include
$includeName: name or file path $includeName
Compiles an internal variable name
string
_compileInternalVariable
(string &$variableName)
-
string
&$variableName: Variable name
Compiles an "is (not) XXX" expression, which can be used inside condition tags (if and else if)
array
_compileIs
(string $expr, array $nextTokens)
-
string
$expr: Raw expression
-
array
$nextTokens: Tokens that preceed the is expression
Compiles a "loop" tag
The var and item attributes are mandatory. "var" must point to the variable that will be used to iterate (arrays, data sets or db record sets). "item" must be the variable to be used to assign each loop record.
Examples:
<!-- loop var=$loop item="row" -->
<
!--
loop var=
$data item=
"line" key=
"key" -->
<!-- loop name="people" var=$people item="person" -->
string
_compileLoopStart
(string $loopProperties)
-
string
$loopProperties: Raw loop properties
Compiles a block of PHP code
string
_compilePHPBlock
(string $block)
-
string
$block: Code block
Compiles a template source into PHP code
string
_compileTemplate
(string $src, array &$controlBlock)
-
string
$src: Template source
-
array
&$controlBlock: Active dynamic block
Compiles a variable reference
The $print argument indicates if we're printing a variable (direct access) or using it as an argument of a tag (IF, LOOP, ASSIGN).
string
_compileVariable
(string $varName, [string $varModifiers = NULL], [bool $print = FALSE])
-
string
$varName: Variable name
-
string
$varModifiers: Variable modifiers
-
bool
$print: Is direct access?
Compiles a variable name
Resolves variables names containing access to array keys, object properties, method calls and dynamic variables resolution.
Matches variable names such as: {$var}, {$array.key}, {$obj->property}, {$array.inner.innerMost}, {$obj->arrayProperty.key}, {$obj->$dynamic}, {$array.$dynamic}, {$p2g.get.request_access}, {$p2g.conf.conf_key}, {$p2g.const.my_constant}, ...
string
_compileVariableName
(string $name)
-
string
$name: Raw variable name
Compiles a "end attribute" tag
string
_compileWidgetAttributeEnd
()
Compiles a "attribute" tag
string
_compileWidgetAttributeStart
(string $attrProperties)
-
string
$attrProperties: Raw attribute properties
Compiles an "end widget" tag
string
_compileWidgetEnd
()
Compiles an "include widget" tag
string
_compileWidgetInclude
(string $widgetProperties, array &$widgets)
-
string
$widgetProperties: Raw widget properties
-
array
&$widgets: Widgets registry
Compiles an "end listener" tag
string
_compileWidgetListenerEnd
()
Compiles a "listener" tag
string
_compileWidgetListenerStart
(string $listenerProperties)
-
string
$listenerProperties: Raw listener properties
Compiles a "widget" tag
string
_compileWidgetStart
(string $widgetProperties, array &$widgets, string $controlBlock)
-
string
$widgetProperties: Raw widget properties
-
array
&$widgets: Widgets registry
-
string
$controlBlock: Active dynamic block
Resolve an I18n query during template compilation
string
_i18nPreFilter
(string $match)
-
string
$match: Language entry
Parses tag properties written in the syntax "prop=val prop2=val2 ..."
array
_parseProperties
(string $properties, [bool $compileToString = TRUE])
-
string
$properties: Raw properties string
-
bool
$compileToString: Whether to compile property values to string
Parses a template file (main file or include block)
void
_parseTemplate
(string $src, int $type, string &$output, array &$widgets, string &$controlBlock)
-
string
$src: Template source (string contents or file path)
-
int
$type: Source type (T_BYFILE or T_BYVAR)
-
string
&$output: Used to return compiled contents
-
array
&$widgets: Widgets registry
-
string
&$controlBlock: Active dynamic block
Parses the attributes of a widget, written in the syntax "prop=var prop2=var2 ..."
array
_parseWidgetProperties
(string $widgetProperties)
-
string
$widgetProperties: Raw properties
Validates a tag declared in the template source
mixed
_validateTag
(string $tag, string $tagArguments, bool $needsArguments, [array $matchTags = array()], string $controlBlock)
-
string
$tag: Tag name
-
string
$tagArguments: Tag arguments
-
bool
$needsArguments: If this tag requires (TRUE), denies (FALSE) or ignore (NULL) arguments
-
array
$matchTags: Matching tags, must be read from the top of the tag stack
-
string
$controlBlock: Active dynamic block
Inherited Methods
Inherited From PHP2Go
PHP2Go::PHP2Go()
PHP2Go::equals()
PHP2Go::generateUniqueId()
PHP2Go::getClassName()
PHP2Go::getConfigVal()
PHP2Go::getLangVal()
PHP2Go::getObjectName()
PHP2Go::getParentName()
PHP2Go::hasDestructor()
PHP2Go::hashCode()
PHP2Go::isA()
PHP2Go::isSubclassOf()
PHP2Go::logError()
PHP2Go::raiseError()
PHP2Go::registerDestructor()
PHP2Go::registerShutdownFunc()
PHP2Go::retrieve()
PHP2Go::store()
PHP2Go::__toString()