Exponential 6.0.13 Exponential Enterprise Open Source CMS - PHP Class Reference

Public Member Functions | Static Public Member Functions | Public Attributes | List of all members
eZTemplateMultiPassParser Class Reference

The class eZTemplateMultiPassParser does. More...

Inheritance diagram for eZTemplateMultiPassParser:

## Public Member Functions
| __construct ()
| parse ( $tpl, $sourceText, &$rootElement, $rootNamespace, &$resourceData)
| gotoEndPosition ( $text, $line, $column, &$endLine, &$endColumn)
| parseIntoTextElements ( $tpl, $sourceText, $sourcePosition, $leftDelimiter, $rightDelimiter, $sourceLength, $relatedTemplateName)
| parseWhitespaceRemoval ( $tpl, &$textElements)
| appendChild (&$root, &$node)
| parseIntoTree ( $tpl, &$textElements, &$treeRoot, $rootNamespace, $relatedResource, $relatedTemplateName)
| parseSequenceParameter ( $parseSequenceKeyword, $funcName, &$args, $tpl, &$text, &$text_len, &$cur_pos, $relatedTemplateName, $startLine, $startColumn, $rootNamespace)
| parseForFunction (&$args, $tpl, &$text, &$text_len, &$cur_pos, $relatedTemplateName, $startLine, $startColumn, $rootNamespace)
| parseForeachFunction (&$args, $tpl, &$text, &$text_len, &$cur_pos, $relatedTemplateName, $startLine, $startColumn, $rootNamespace)
| parseDefFunction ( $funcName, &$args, $tpl, &$text, &$text_len, &$cur_pos, $relatedTemplateName, $startLine, $startColumn, $rootNamespace)
| parseUnnamedCondition ( $funcName, &$args, $tpl, &$text, &$text_len, &$cur_pos, $relatedTemplateName, $startLine, $startColumn, $rootNamespace)
| parseWhileFunction (&$args, $tpl, &$text, &$text_len, &$cur_pos, $relatedTemplateName, $startLine, $startColumn, $rootNamespace)
| parseSetFunction ( $funcName, &$args, $tpl, &$text, &$text_len, &$cur_pos, $relatedTemplateName, $startLine, $startColumn, $rootNamespace)
| parseBlockFunction ( $funcName, &$args, $tpl, &$text, &$text_len, &$cur_pos, $relatedTemplateName, $startLine, $startColumn, $rootNamespace)
| parseSectionFunction ( $funcName, &$args, $tpl, &$text, &$text_len, &$cur_pos, $relatedTemplateName, $startLine, $startColumn, $rootNamespace)
| showParseErrorMessage ( $tpl, &$text, $text_len, &$cur_pos, $tplName, $startLine, $startColumn, $funcName, $message)

## Static Public Member Functions
static | instance ()

## Public Attributes
| $ElementParser

## Detailed Description

The class eZTemplateMultiPassParser does.

Definition at line 17 of file eztemplatemultipassparser.php.

## Constructor & Destructor Documentation

## ◆ __construct()

eZTemplateMultiPassParser::__construct | ( |  | ) |

Definition at line 19 of file eztemplatemultipassparser.php.

References eZTemplateElementParser\instance().

## Member Function Documentation

## ◆ appendChild()

eZTemplateMultiPassParser::appendChild | ( | & | $root,
|  | & | $node
| ) |  |

Definition at line 388 of file eztemplatemultipassparser.php.

Referenced by parseIntoTree().

## ◆ gotoEndPosition()

eZTemplateMultiPassParser::gotoEndPosition | ( |  | $text,
|  |  | $line,
|  |  | $column,
|  | & | $endLine,
|  | & | $endColumn
| ) |  |

Definition at line 57 of file eztemplatemultipassparser.php.

Referenced by parseIntoTextElements(), parseIntoTree(), and showParseErrorMessage().

## ◆ instance()

static eZTemplateMultiPassParser::instance | ( |  | ) |
| static

Returns a shared instance of the eZTemplateMultiPassParser class.

Returns
  eZTemplateMultiPassParser

Definition at line 1379 of file eztemplatemultipassparser.php.

Referenced by eZTemplate\parse().

## ◆ parse()

eZTemplateMultiPassParser::parse | ( |  | $tpl,
|  |  | $sourceText,
|  | & | $rootElement,
|  |  | $rootNamespace,
|  | & | $resourceData
| ) |  |

Parses the template file $sourceText. See the description of this class for more information on the parsing process.

Reimplemented from eZTemplateParser.

Definition at line 30 of file eztemplatemultipassparser.php.

References eZDebug\accumulatorStart(), eZDebug\accumulatorStop(), parseIntoTextElements(), parseIntoTree(), and parseWhitespaceRemoval().

## ◆ parseBlockFunction()

eZTemplateMultiPassParser::parseBlockFunction | ( |  | $funcName,
|  | & | $args,
|  |  | $tpl,
|  | & | $text,
|  | & | $text_len,
|  | & | $cur_pos,
|  |  | $relatedTemplateName,
|  |  | $startLine,
|  |  | $startColumn,
|  |  | $rootNamespace
| ) |  |

Parse arguments for {set-block}/{append-block}. This method has been created to correctly handle the case when ($) is used in variable name, e.g. {set-block variable=$var} Here we strip the dollar sign and pass the variable name as string.

Definition at line 1267 of file eztemplatemultipassparser.php.

References showParseErrorMessage().

Referenced by parseIntoTree().

## ◆ parseDefFunction()

eZTemplateMultiPassParser::parseDefFunction | ( |  | $funcName,
|  | & | $args,
|  |  | $tpl,
|  | & | $text,
|  | & | $text_len,
|  | & | $cur_pos,
|  |  | $relatedTemplateName,
|  |  | $startLine,
|  |  | $startColumn,
|  |  | $rootNamespace
| ) |  |

Parse do..while function Syntax:

{do}
[{delimiter}...{/delimiter}]
[{break}]
[{continue}]
[{skip}]
{/do while <condition> [sequence <array> as $seqVar]}
/
function parseDoFunction( &$args, $tpl, &$text, &$text_len, &$cur_pos,
$relatedTemplateName, $startLine, $startColumn, $rootNamespace )
{
// skip whitespaces
$cur_pos = $this->ElementParser->whitespaceEndPos( $tpl, $text, $cur_pos, $text_len );
// parse while keyword
$wordEndPos = $this->ElementParser->identifierEndPosition( $tpl, $text, $cur_pos, $text_len );
$word = substr( $text, $cur_pos, $wordEndPos-$cur_pos );
if ( $word != 'while' )
{
$this->showParseErrorMessage( $tpl, $text, $text_len, $cur_pos, $relatedTemplateName, $startLine, $startColumn,
'do', "Expected keyword 'while' not found in parameters" );
return;
}
$cur_pos = $wordEndPos;
// skip whitespaces
$cur_pos = $this->ElementParser->whitespaceEndPos( $tpl, $text, $cur_pos, $text_len );
$args['condition'] = $this->ElementParser->parseVariableTag( $tpl, $relatedTemplateName, $text, $cur_pos, $cur_pos, $text_len, $rootNamespace );
// skip whitespaces
$cur_pos = $this->ElementParser->whitespaceEndPos( $tpl, $text, $cur_pos, $text_len );
if ( $cur_pos == $text_len ) // no more arguments
return;
$this->parseSequenceParameter( true, 'do',
$args, $tpl, $text, $text_len, $cur_pos,
$relatedTemplateName, $startLine, $startColumn, $rootNamespace );
}
eZTemplateMultiPassParser\showParseErrorMessage
showParseErrorMessage( $tpl, &$text, $text_len, &$cur_pos, $tplName, $startLine, $startColumn, $funcName, $message)
Definition: eztemplatemultipassparser.php:1365
eZTemplateMultiPassParser\parseSequenceParameter
parseSequenceParameter( $parseSequenceKeyword, $funcName, &$args, $tpl, &$text, &$text_len, &$cur_pos, $relatedTemplateName, $startLine, $startColumn, $rootNamespace)
Definition: eztemplatemultipassparser.php:815

Definition at line 1087 of file eztemplatemultipassparser.php.

References showParseErrorMessage().

Referenced by parseIntoTree().

## ◆ parseForeachFunction()

eZTemplateMultiPassParser::parseForeachFunction | ( | & | $args,
|  |  | $tpl,
|  | & | $text,
|  | & | $text_len,
|  | & | $cur_pos,
|  |  | $relatedTemplateName,
|  |  | $startLine,
|  |  | $startColumn,
|  |  | $rootNamespace
| ) |  |

Parse {foreach} function. Syntax:

{foreach <array> as [$keyVar =>] $itemVar
[sequence <array> as $sequenceVar]
[offset <offset>]
[max <max>]
[reverse]
}

Definition at line 947 of file eztemplatemultipassparser.php.

References parseSequenceParameter(), and showParseErrorMessage().

Referenced by parseIntoTree().

## ◆ parseForFunction()

eZTemplateMultiPassParser::parseForFunction | ( | & | $args,
|  |  | $tpl,
|  | & | $text,
|  | & | $text_len,
|  | & | $cur_pos,
|  |  | $relatedTemplateName,
|  |  | $startLine,
|  |  | $startColumn,
|  |  | $rootNamespace
| ) |  |

Parse {for} function. Syntax:

// for <firstValue> to <lastValue> as <$loopVar> [sequence <array> as <$var>]

Definition at line 877 of file eztemplatemultipassparser.php.

References parseSequenceParameter(), and showParseErrorMessage().

Referenced by parseIntoTree().

## ◆ parseIntoTextElements()

eZTemplateMultiPassParser::parseIntoTextElements | ( |  | $tpl,
|  |  | $sourceText,
|  |  | $sourcePosition,
|  |  | $leftDelimiter,
|  |  | $rightDelimiter,
|  |  | $sourceLength,
|  |  | $relatedTemplateName
| ) |  |

Definition at line 77 of file eztemplatemultipassparser.php.

References eZDebug\addTimingPoint(), eZTemplate\ELEMENT_COMMENT, eZTemplate\ELEMENT_END_TAG, eZTemplate\ELEMENT_NORMAL_TAG, eZTemplate\ELEMENT_SINGLE_TAG, eZTemplate\ELEMENT_TEXT, eZTemplate\ELEMENT_VARIABLE, and gotoEndPosition().

Referenced by parse().

## ◆ parseIntoTree()

eZTemplateMultiPassParser::parseIntoTree | ( |  | $tpl,
|  | & | $textElements,
|  | & | $treeRoot,
|  |  | $rootNamespace,
|  |  | $relatedResource,
|  |  | $relatedTemplateName
| ) |  |

Definition at line 395 of file eztemplatemultipassparser.php.

References eZDebug\addTimingPoint(), appendChild(), eZTemplate\ELEMENT_END_TAG, eZTemplate\ELEMENT_NORMAL_TAG, eZTemplate\ELEMENT_SINGLE_TAG, eZTemplate\ELEMENT_TEXT, eZTemplate\ELEMENT_VARIABLE, gotoEndPosition(), eZTemplate\NODE_FUNCTION, eZTemplate\NODE_TEXT, eZTemplate\NODE_VARIABLE, parseBlockFunction(), parseDefFunction(), parseForeachFunction(), parseForFunction(), parseSectionFunction(), parseSetFunction(), parseUnnamedCondition(), parseWhileFunction(), and eZTemplate\TYPE_NUMERIC.

Referenced by parse().

## ◆ parseSectionFunction()

eZTemplateMultiPassParser::parseSectionFunction | ( |  | $funcName,
|  | & | $args,
|  |  | $tpl,
|  | & | $text,
|  | & | $text_len,
|  | & | $cur_pos,
|  |  | $relatedTemplateName,
|  |  | $startLine,
|  |  | $startColumn,
|  |  | $rootNamespace
| ) |  |

Parse arguments for {section}. This method has been created to correctly handle the case when ($) is used in variable name, e.g. {section var=$item} Here we strip the dollar sign and pass the variable name as string.

Definition at line 1317 of file eztemplatemultipassparser.php.

References showParseErrorMessage(), and eZTemplate\TYPE_NUMERIC.

Referenced by parseIntoTree().

## ◆ parseSequenceParameter()

eZTemplateMultiPassParser::parseSequenceParameter | ( |  | $parseSequenceKeyword,
|  |  | $funcName,
|  | & | $args,
|  |  | $tpl,
|  | & | $text,
|  | & | $text_len,
|  | & | $cur_pos,
|  |  | $relatedTemplateName,
|  |  | $startLine,
|  |  | $startColumn,
|  |  | $rootNamespace
| ) |  |

parse 'sequence' loop parameter: "sequence <array> as <$seqVar>"

Definition at line 815 of file eztemplatemultipassparser.php.

References showParseErrorMessage().

Referenced by parseForeachFunction(), parseForFunction(), and parseWhileFunction().

## ◆ parseSetFunction()

eZTemplateMultiPassParser::parseSetFunction | ( |  | $funcName,
|  | & | $args,
|  |  | $tpl,
|  | & | $text,
|  | & | $text_len,
|  | & | $cur_pos,
|  |  | $relatedTemplateName,
|  |  | $startLine,
|  |  | $startColumn,
|  |  | $rootNamespace
| ) |  |

Parse arguments for {set}/{let}/{default}

Definition at line 1197 of file eztemplatemultipassparser.php.

References showParseErrorMessage(), and eZTemplate\TYPE_NUMERIC.

Referenced by parseIntoTree().

## ◆ parseUnnamedCondition()

eZTemplateMultiPassParser::parseUnnamedCondition | ( |  | $funcName,
|  | & | $args,
|  |  | $tpl,
|  | & | $text,
|  | & | $text_len,
|  | & | $cur_pos,
|  |  | $relatedTemplateName,
|  |  | $startLine,
|  |  | $startColumn,
|  |  | $rootNamespace
| ) |  |

Parse arguments for {if}/{elseif}

Definition at line 1153 of file eztemplatemultipassparser.php.

References showParseErrorMessage().

Referenced by parseIntoTree().

## ◆ parseWhileFunction()

eZTemplateMultiPassParser::parseWhileFunction | ( | & | $args,
|  |  | $tpl,
|  | & | $text,
|  | & | $text_len,
|  | & | $cur_pos,
|  |  | $relatedTemplateName,
|  |  | $startLine,
|  |  | $startColumn,
|  |  | $rootNamespace
| ) |  |

Parse arguments for {while}

Definition at line 1170 of file eztemplatemultipassparser.php.

References parseSequenceParameter(), and showParseErrorMessage().

Referenced by parseIntoTree().

## ◆ parseWhitespaceRemoval()

eZTemplateMultiPassParser::parseWhitespaceRemoval | ( |  | $tpl,
|  | & | $textElements
| ) |  |

Definition at line 306 of file eztemplatemultipassparser.php.

References eZDebug\addTimingPoint(), eZTemplate\ELEMENT_COMMENT, eZTemplate\ELEMENT_END_TAG, eZTemplate\ELEMENT_NORMAL_TAG, eZTemplate\ELEMENT_SINGLE_TAG, eZTemplate\ELEMENT_TEXT, and eZTemplate\ELEMENT_VARIABLE.

Referenced by parse().

## ◆ showParseErrorMessage()

eZTemplateMultiPassParser::showParseErrorMessage | ( |  | $tpl,
|  | & | $text,
|  |  | $text_len,
|  | & | $cur_pos,
|  |  | $tplName,
|  |  | $startLine,
|  |  | $startColumn,
|  |  | $funcName,
|  |  | $message
| ) |  |

Definition at line 1365 of file eztemplatemultipassparser.php.

References gotoEndPosition().

Referenced by parseBlockFunction(), parseDefFunction(), parseForeachFunction(), parseForFunction(), parseSectionFunction(), parseSequenceParameter(), parseSetFunction(), parseUnnamedCondition(), and parseWhileFunction().

## Member Data Documentation

## ◆ $ElementParser

eZTemplateMultiPassParser::$ElementParser

Definition at line 1391 of file eztemplatemultipassparser.php.

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

- eztemplatemultipassparser.php

Copyright © 1998 – 2026 7x. All rights reserved. Licensed under the GNU GPLv2+.