本文整理汇总了PHP中eZTemplateNodeTool::extractFunctionNodeParameters方法的典型用法代码示例。如果您正苦于以下问题:PHP eZTemplateNodeTool::extractFunctionNodeParameters方法的具体用法?PHP eZTemplateNodeTool::extractFunctionNodeParameters怎么用?PHP eZTemplateNodeTool::extractFunctionNodeParameters使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类eZTemplateNodeTool
的用法示例。
在下文中一共展示了eZTemplateNodeTool::extractFunctionNodeParameters方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: templateNodeTransformation
function templateNodeTransformation($functionName, &$node, $tpl, $parameters, $privateData)
{
if ($functionName != $this->BlockName) {
return false;
}
$parameters = eZTemplateNodeTool::extractFunctionNodeParameters($node);
if (!isset($parameters['name'])) {
return false;
}
$namespaceValue = false;
$newNodes = array();
if (isset($parameters["name"])) {
$menuIni = eZINI::instance("menu.ini");
$nameData = $parameters["name"];
if (!eZTemplateNodeTool::isConstantElement($nameData)) {
return false;
}
$menuName = eZTemplateNodeTool::elementConstantValue($nameData);
if ($menuIni->hasVariable('SelectedMenu', $menuName)) {
$menuTemplate = $menuIni->variable("SelectedMenu", $menuName);
if ($menuTemplate != null) {
$uriString = "design:menu/{$menuTemplate}.tpl";
$resourceName = "";
$templateName = "";
$resource = $tpl->resourceFor($uriString, $resourceName, $templateName);
$resourceData = $tpl->resourceData($resource, $uriString, $resourceName, $templateName);
$resourceData['use-comments'] = eZTemplateCompiler::isCommentsEnabled();
$includeNodes = $resource->templateNodeTransformation($functionName, $node, $tpl, $resourceData, $parameters, $namespaceValue);
if ($includeNodes === false) {
return false;
}
$variableList = array();
foreach (array_keys($parameters) as $parameterName) {
if ($parameterName == 'name') {
continue;
}
$parameterData =& $parameters[$parameterName];
$newNodes[] = eZTemplateNodeTool::createVariableNode(false, $parameterData, false, array(), array($namespaceValue, eZTemplate::NAMESPACE_SCOPE_RELATIVE, $parameterName));
$variableList[] = $parameterName;
}
$newNodes = array_merge($newNodes, $includeNodes);
foreach ($variableList as $variableName) {
$newNodes[] = eZTemplateNodeTool::createVariableUnsetNode(array($namespaceValue, eZTemplate::NAMESPACE_SCOPE_RELATIVE, $variableName));
}
} else {
// to do: not use this function to generate empty code.
$newNodes[] = eZTemplateNodeTool::createCodePieceNode("");
}
} else {
// to do: not use this function to generate empty code.
$newNodes[] = eZTemplateNodeTool::createCodePieceNode("");
}
}
return $newNodes;
}
示例2: templateNodeTransformation
function templateNodeTransformation($functionName, &$node, $tpl, $parameters, $privateData)
{
if ($functionName != $this->IncludeName) {
return false;
}
$parameters = eZTemplateNodeTool::extractFunctionNodeParameters($node);
if (!isset($parameters['uri'])) {
return false;
}
$uriData = $parameters['uri'];
if (!eZTemplateNodeTool::isConstantElement($uriData)) {
return false;
}
$namespaceValue = false;
$namespaceName = '$currentNamespace';
if (isset($parameters['name'])) {
$nameData = $parameters['name'];
if (!eZTemplateNodeTool::isConstantElement($nameData)) {
return false;
}
$namespaceValue = eZTemplateNodeTool::elementConstantValue($nameData);
$namespaceName = '$namespace';
}
$uriString = eZTemplateNodeTool::elementConstantValue($uriData);
$resourceName = "";
$templateName = "";
$resource = $tpl->resourceFor($uriString, $resourceName, $templateName);
$resourceData = $tpl->resourceData($resource, $uriString, $resourceName, $templateName);
$resourceData['use-comments'] = eZTemplateCompiler::isCommentsEnabled();
$includeNodes = $resource->templateNodeTransformation($functionName, $node, $tpl, $resourceData, $parameters, $namespaceValue);
if ($includeNodes === false) {
return false;
}
$newNodes = array();
$variableList = array();
$uniqID = md5(uniqid('inc'));
$newNodes[] = eZTemplateNodeTool::createCodePieceNode("\$oldRestoreIncludeArray" . "_{$uniqID} = isset( \$restoreIncludeArray ) ? \$restoreIncludeArray : array();\n" . "\$restoreIncludeArray = array();\n");
foreach (array_keys($parameters) as $parameterName) {
if ($parameterName == 'uri' or $parameterName == 'name') {
continue;
}
$parameterData =& $parameters[$parameterName];
$newNodes[] = eZTemplateNodeTool::createCodePieceNode("if ( isset( {$namespaceName} ) and isset( \$vars[{$namespaceName}]['{$parameterName}'] ) )\n" . " \$restoreIncludeArray[] = array( {$namespaceName}, '{$parameterName}', \$vars[{$namespaceName}]['{$parameterName}'] );\n" . "elseif ( !isset( \$vars[( isset( {$namespaceName} ) ? {$namespaceName} : '' )]['{$parameterName}'] ) ) \n" . " \$restoreIncludeArray[] = array( ( isset( {$namespaceName} ) ? {$namespaceName} : '' ), '{$parameterName}', 'unset' );\n");
$newNodes[] = eZTemplateNodeTool::createVariableNode(false, $parameterData, false, array(), array($namespaceValue, eZTemplate::NAMESPACE_SCOPE_RELATIVE, $parameterName));
$variableList[] = $parameterName;
}
$newNodes = array_merge($newNodes, $includeNodes);
// Restore previous variables, before including
$newNodes[] = eZTemplateNodeTool::createCodePieceNode("foreach ( \$restoreIncludeArray as \$element )\n" . "{\n" . " if ( \$element[2] === 'unset' )\n" . " {\n" . " unset( \$vars[\$element[0]][\$element[1]] );\n" . " continue;\n" . " }\n" . " \$vars[\$element[0]][\$element[1]] = \$element[2];\n" . "}\n" . "\$restoreIncludeArray = \$oldRestoreIncludeArray" . "_{$uniqID};\n");
return $newNodes;
}
示例3: templateNodeTransformation
function templateNodeTransformation( $functionName, &$node,
$tpl, $parameters, $privateData )
{
if ( !isset( $this->Rules[$functionName] ) )
return false;
$rule = $this->Rules[$functionName];
$resourceData = $privateData['resource-data'];
$parameters = eZTemplateNodeTool::extractFunctionNodeParameters( $node );
$inputName = $rule['input_name'];
if ( !isset( $parameters[$inputName] ) )
{
return false;
}
$inputData = $parameters[$inputName];
$outputName = $rule['output_name'];
$newNodes = array();
$viewDir = '';
$renderMode = false;
if ( isset( $rule["render_mode"] ) )
{
$renderMode = $rule["render_mode"];
}
if ( isset( $parameters['render-mode'] ) )
{
$renderData = $parameters['render-mode'];
if ( !eZTemplateNodeTool::isConstantElement( $renderData ) )
{
return false;
}
$renderMode = eZTemplateNodeTool::elementConstantValue( $renderData );
}
if ( $renderMode )
$view_dir .= "/render-$renderMode";
$viewValue = false;
$viewName = false;
if ( $rule['use_views'] )
{
$viewName = $rule['use_views'];
if ( isset( $parameters[$viewName] ) )
{
$viewData = $parameters[$viewName];
if ( !eZTemplateNodeTool::isConstantElement( $viewData ) )
{
return false;
}
$viewValue = eZTemplateNodeTool::elementConstantValue( $viewData );
$viewDir .= '/' . $viewValue;
}
else
{
if ( !( isset( $rule['optional_views'] ) && $rule['optional_views'] ) )
{
return false;
}
}
}
$namespaceValue = false;
if ( isset( $rule['namespace'] ) )
{
$namespaceValue = $rule['namespace'];
}
$variableList = array();
$newNodes[] = eZTemplateNodeTool::createVariableNode( false, $inputData, false, array(),
array( $namespaceValue, eZTemplate::NAMESPACE_SCOPE_RELATIVE, $outputName ) );
$variableList[] = $outputName;
foreach ( array_keys( $parameters ) as $parameterName )
{
if ( $parameterName == $inputName or
$parameterName == $outputName or
$parameterName == $viewName )
continue;
$newNodes[] = eZTemplateNodeTool::createVariableNode( false, $parameters[$parameterName], false, array(),
array( $namespaceValue, eZTemplate::NAMESPACE_SCOPE_RELATIVE, $parameterName ) );
$variableList[] = $parameterName;
}
$templateRoot = $rule["template_root"];
$matchFileArray = eZTemplateDesignResource::overrideArray();
if ( is_string( $templateRoot ) )
{
$resourceNodes = $this->resourceAcquisitionTransformation( $functionName, $node, $rule, $inputData,
$outputName, $namespaceValue,
$templateRoot, $viewDir, $viewValue,
$matchFileArray, 0, $resourceData );
// If the transformation failed we return false to invoke interpreted mode
if ( $resourceNodes === false )
return false;
$newNodes = array_merge( $newNodes, $resourceNodes );
}
else
//.........这里部分代码省略.........
示例4: templateNodeTransformation
function templateNodeTransformation( $functionName, &$node,
$tpl, $parameters, $privateData )
{
switch( $functionName )
{
case $this->SetName:
case $this->DefaultName:
case $this->LetName:
{
$scope = eZTemplate::NAMESPACE_SCOPE_RELATIVE;
if ( isset( $parameters['-scope'] ) )
{
if ( !eZTemplateNodeTool::isConstantElement( $parameters['-scope'] ) )
return false;
$scopeText = eZTemplateNodeTool::elementConstantValue( $parameters['-scope'] );
if ( $scopeText == 'relative' )
$scope = eZTemplate::NAMESPACE_SCOPE_RELATIVE;
else if ( $scopeText == 'root' )
$scope = eZTemplate::NAMESPACE_SCOPE_LOCAL;
else if ( $scopeText == 'global' )
$scope = eZTemplate::NAMESPACE_SCOPE_GLOBAL;
}
$parameters = eZTemplateNodeTool::extractFunctionNodeParameters( $node );
$namespaceValue = false;
if ( isset( $parameters['-name'] ) )
{
if ( !eZTemplateNodeTool::isConstantElement( $parameters['-name'] ) )
{
return false;
}
$namespaceValue = eZTemplateNodeTool::elementConstantValue( $parameters['-name'] );
}
$variableList = array();
$setVarNodes = array();
foreach ( array_keys( $parameters ) as $parameterName )
{
if ( $parameterName == '-name' or $parameterName == '-scope' )
{
continue;
}
$parameterData =& $parameters[$parameterName];
$setVarNodes[] = eZTemplateNodeTool::createVariableNode(
false, $parameterData, eZTemplateNodeTool::extractFunctionNodePlacement( $node ),
array(), array( $namespaceValue, $scope, $parameterName ),
( $functionName == $this->SetName ), ( $functionName != $this->DefaultName ),
false, ( $functionName == $this->DefaultName ) );
if ( $functionName == $this->LetName or $functionName == $this->DefaultName )
{
$variableList[] = $parameterName;
}
}
if ( ( $functionName == $this->LetName or $functionName == $this->DefaultName ) and
$namespaceValue )
{
$setVarNodes[] = eZTemplateNodeTool::createNamespaceChangeNode( $namespaceValue );
}
if ( $functionName == $this->LetName or $functionName == $this->DefaultName )
{
$childNodes = eZTemplateNodeTool::extractFunctionNodeChildren( $node );
if ( !is_array( $childNodes ) )
{
$childNodes = array();
}
}
else
{
$childNodes = array();
}
$unsetVarNodes = array();
if ( ( $functionName == $this->LetName or $functionName == $this->DefaultName ) and
$namespaceValue )
{
$unsetVarNodes[] = eZTemplateNodeTool::createNamespaceRestoreNode();
}
if ( $functionName == $this->LetName or $functionName == $this->DefaultName )
{
foreach( $variableList as $parameterName )
{
$unsetVarNodes[] = eZTemplateNodeTool::createVariableUnsetNode( array( $namespaceValue,
eZTemplate::NAMESPACE_SCOPE_RELATIVE,
$parameterName ),
array( 'remember_set' => $functionName == $this->DefaultName ) );
}
}
return array_merge( $setVarNodes, $childNodes, $unsetVarNodes );
} break;
}
//.........这里部分代码省略.........
示例5: templateNodeTransformation
function templateNodeTransformation($functionName, &$node, $tpl, $parameters, $privateData)
{
if ($functionName != $this->BlockName) {
return false;
}
$parameters = eZTemplateNodeTool::extractFunctionNodeParameters($node);
if (!isset($parameters['name'])) {
return false;
}
// Read ini file
$toolbarIni = eZINI::instance("toolbar.ini");
if (isset($parameters["view"])) {
$viewData = $parameters["view"];
$viewMode = eZTemplateNodeTool::elementConstantValue($viewData);
} else {
$viewMode = "full";
}
$params = $parameters;
$namespaceValue = false;
if (isset($parameters["name"])) {
$nameData = $parameters["name"];
if (!eZTemplateNodeTool::isConstantElement($nameData)) {
return false;
}
$nameValue = eZTemplateNodeTool::elementConstantValue($nameData);
$toolbarPosition = $nameValue;
$toolbarName = "Toolbar_" . $toolbarPosition;
$toolArray = $toolbarIni->variable($toolbarName, 'Tool');
if (!is_array($toolArray)) {
$toolArray = array();
}
$newNodes = array();
foreach (array_keys($toolArray) as $toolKey) {
$tool = $toolArray[$toolKey];
$placement = $toolKey + 1;
$uriString = "design:toolbar/{$viewMode}/{$tool}.tpl";
$placementValue = "";
$firstValue = false;
$lastValue = false;
if ($placement == 1) {
if ($placement == count($toolArray)) {
$firstValue = true;
$lastValue = true;
$placementValue = "last";
} else {
$firstValue = true;
$placementValue = "first";
}
} else {
if ($placement == count($toolArray)) {
$lastValue = true;
$placementValue = "last";
}
}
$resourceName = "";
$templateName = "";
$resource = $tpl->resourceFor($uriString, $resourceName, $templateName);
$resourceData = $tpl->resourceData($resource, $uriString, $resourceName, $templateName);
$resourceData['use-comments'] = eZTemplateCompiler::isCommentsEnabled();
$includeNodes = $resource->templateNodeTransformation($functionName, $node, $tpl, $resourceData, $parameters, $namespaceValue);
if ($includeNodes === false) {
return false;
}
$uniqID = md5(uniqid('inc'));
$newNodes[] = eZTemplateNodeTool::createCodePieceNode("\$oldRestoreIncludeArray" . "_{$uniqID} = isset( \$restoreIncludeArray ) ? \$restoreIncludeArray : array();\n" . "\$restoreIncludeArray = array();\n");
$variableList = array();
foreach (array_keys($parameters) as $parameterName) {
if ($parameterName == 'name' or $parameterName == 'view') {
continue;
}
$parameterData =& $parameters[$parameterName];
$newNodes[] = eZTemplateNodeTool::createCodePieceNode("if ( isset( \$vars['']['{$parameterName}'] ) )\n" . " \$restoreIncludeArray[] = array( '', '{$parameterName}', \$vars['']['{$parameterName}'] );\n" . "elseif ( !isset( \$vars['']['{$parameterName}'] ) ) \n" . " \$restoreIncludeArray[] = array( '', '{$parameterName}', 'unset' );\n");
$newNodes[] = eZTemplateNodeTool::createVariableNode(false, $parameterData, false, array(), array($namespaceValue, eZTemplate::NAMESPACE_SCOPE_RELATIVE, $parameterName));
$variableList[] = $parameterName;
}
$actionParameters = array();
if ($toolbarIni->hasGroup("Tool_" . $tool)) {
$actionParameters = $toolbarIni->group("Tool_" . $tool);
}
if ($toolbarIni->hasGroup("Tool_" . $toolbarPosition . "_" . $tool . "_" . $placement)) {
$actionParameters = array_merge($actionParameters, $toolbarIni->group("Tool_" . $toolbarPosition . "_" . $tool . "_" . $placement));
}
foreach (array_keys($actionParameters) as $key) {
$itemValue = $actionParameters[$key];
$newNodes[] = eZTemplateNodeTool::createVariableNode(false, $itemValue, false, array(), array($namespaceValue, eZTemplate::NAMESPACE_SCOPE_RELATIVE, $key));
$variableList[] = $key;
}
// Add parameter tool_id and offset
$toolIDValue = "Tool_" . $toolbarPosition . "_" . $tool . "_" . $placement;
$newNodes[] = eZTemplateNodeTool::createVariableNode(false, $toolIDValue, false, array(), array($namespaceValue, eZTemplate::NAMESPACE_SCOPE_RELATIVE, "tool_id"));
$variableList[] = "tool_id";
$toolOffset = $placement;
$newNodes[] = eZTemplateNodeTool::createVariableNode(false, $toolOffset, false, array(), array($namespaceValue, eZTemplate::NAMESPACE_SCOPE_RELATIVE, "offset"));
$variableList[] = "offset";
// Add parameter first, last and placement
$newNodes[] = eZTemplateNodeTool::createVariableNode(false, $firstValue, false, array(), array($namespaceValue, eZTemplate::NAMESPACE_SCOPE_RELATIVE, "first"));
$variableList[] = "first";
$newNodes[] = eZTemplateNodeTool::createVariableNode(false, $lastValue, false, array(), array($namespaceValue, eZTemplate::NAMESPACE_SCOPE_RELATIVE, "last"));
$variableList[] = "last";
$newNodes[] = eZTemplateNodeTool::createVariableNode(false, $placementValue, false, array(), array($namespaceValue, eZTemplate::NAMESPACE_SCOPE_RELATIVE, "placement"));
//.........这里部分代码省略.........
示例6: templateNodeTransformation
//.........这里部分代码省略.........
// Iterator check for string
$code .= " else if ( is_string( \$loopItem ) )\n" . " {\n" . " unset( \$item );\n";
if ($reverseLoop) {
$code .= " \$loopKey = \$loopCount - \$index - {$offsetText} + 1;\n";
} else {
$code .= " \$loopKey = \$index + {$offsetText};\n";
}
$code .= " \$item = \$loopItem[\$loopKey];\n" . " }\n";
// Iterator check end
$code .= " unset( \$last );\n" . " \$last = false;\n";
$newNodes[] = eZTemplateNodeTool::createCodePieceNode($code);
$code = '';
if ($useLastValue) {
$code .= " if ( \$currentIndex > 1 )\n" . " {\n" . " \$last = \$lastVariableValue;\n" . " \$variableValue = new eZTemplateSectionIterator();\n" . " }\n";
}
if ($varName) {
$code .= " \$variableValue->setIteratorValues( \$item, \$loopKey, \$currentIndex - 1, \$currentIndex, false, \$last );";
$newNodes[] = eZTemplateNodeTool::createCodePieceNode($code);
$newNodes[] = eZTemplateNodeTool::createVariableNode(false, 'variableValue', eZTemplateNodeTool::extractFunctionNodePlacement($node), array('spacing' => 4), array('', eZTemplate::NAMESPACE_SCOPE_RELATIVE, $varName), false, true, true);
} else {
$newNodes[] = eZTemplateNodeTool::createVariableNode(false, 'loopKey', eZTemplateNodeTool::extractFunctionNodePlacement($node), array('spacing' => 4), array('', eZTemplate::NAMESPACE_SCOPE_RELATIVE, 'key'), false, true, true);
$newNodes[] = eZTemplateNodeTool::createVariableNode(false, 'item', eZTemplateNodeTool::extractFunctionNodePlacement($node), array('spacing' => 4), array('', eZTemplate::NAMESPACE_SCOPE_RELATIVE, 'item'), false, true, true);
$newNodes[] = eZTemplateNodeTool::createCodePieceNode("\$currentIndexInc = \$currentIndex - 1;\n");
$newNodes[] = eZTemplateNodeTool::createVariableNode(false, 'currentIndexInc', eZTemplateNodeTool::extractFunctionNodePlacement($node), array('spacing' => 4), array('', eZTemplate::NAMESPACE_SCOPE_RELATIVE, 'index'), false, true, true);
$newNodes[] = eZTemplateNodeTool::createVariableNode(false, 'currentIndex', eZTemplateNodeTool::extractFunctionNodePlacement($node), array('spacing' => 4), array('', eZTemplate::NAMESPACE_SCOPE_RELATIVE, 'number'), false, true, true);
}
$mainSpacing = 0;
$hasFilter = false;
if (count($filterNodes) > 0) {
$newFilterNodes = array();
$matchValue = true;
$hasDynamicFilter = false;
foreach ($filterNodes as $filterNode) {
$filterParameters = eZTemplateNodeTool::extractFunctionNodeParameters($filterNode);
if (!isset($filterParameters['match'])) {
continue;
}
$hasFilter = true;
$filterParameterMatch = $filterParameters['match'];
$filterParameterMatch = eZTemplateCompiler::processElementTransformationList($tpl, $filterNode, $filterParameterMatch, $privateData);
if (eZTemplateNodeTool::isConstantElement($filterParameterMatch)) {
$matchValue = eZTemplateNodeTool::elementConstantValue($filterParameterMatch);
if (eZTemplateNodeTool::extractFunctionNodeName($filterNode) == 'section-exclude') {
if ($matchValue) {
$matchValue = false;
}
} else {
if ($matchValue) {
$matchValue = true;
}
}
$newFilterNodes = array();
$hasDynamicFilter = false;
} else {
$newFilterNodes[] = eZTemplateNodeTool::createVariableNode(false, $filterParameterMatch, eZTemplateNodeTool::extractFunctionNodePlacement($filterNode), array('spacing' => 4), 'tmpMatchValue');
if (eZTemplateNodeTool::extractFunctionNodeName($filterNode) == 'section-exclude') {
$newFilterNodes[] = eZTemplateNodeTool::createCodePieceNode("if ( \$tmpMatchValue )\n \$matchValue = false;", array('spacing' => 4));
} else {
$newFilterNodes[] = eZTemplateNodeTool::createCodePieceNode("if ( \$tmpMatchValue )\n \$matchValue = true;", array('spacing' => 4));
}
$hasDynamicFilter = true;
}
}
if ($hasFilter) {
$mainSpacing += 4;
$newNodes[] = eZTemplateNodeTool::createVariableNode(false, $matchValue, eZTemplateNodeTool::extractFunctionNodePlacement($filterNode), array('spacing' => 4), 'matchValue');
示例7: processChildren
function processChildren()
{
// process the loop body
$children = eZTemplateNodeTool::extractFunctionNodeChildren( $this->Node );
$transformedChildren = eZTemplateCompiler::processNodeTransformationNodes( $this->Tpl, $this->Node, $children, $this->PrivateData );
$childrenNodes = array();
$delimiter = null;
if ( is_array( $transformedChildren ) )
{
foreach ( $transformedChildren as $child )
{
if ( $child[0] == eZTemplate::NODE_FUNCTION ) // check child type
{
$childFunctionName = $child[2];
if ( $childFunctionName == 'delimiter' )
{
// save delimiter for it to be processed below
$delimiter = $child;
continue;
}
elseif ( $childFunctionName == 'break' )
{
$childrenNodes[] = eZTemplateNodeTool::createCodePieceNode( "break;\n" );
continue;
}
elseif ( $childFunctionName == 'continue' )
{
$childrenNodes[] = eZTemplateNodeTool::createCodePieceNode( "continue;\n" );
continue;
}
elseif ( $childFunctionName == 'skip' )
{
$childrenNodes[] = eZTemplateNodeTool::createCodePieceNode( "\$skipDelimiter = true;\ncontinue;\n" );
continue;
}
}
$childrenNodes[] = $child;
}
}
if ( $delimiter ) // if delimiter is specified
{
$delimiterNodes = eZTemplateNodeTool::extractNodes( $children,
array( 'match' => array( 'type' => 'equal',
'matches' => array( array( 'match-keys' => array( 0 ),
'match-with' => eZTemplate::NODE_FUNCTION ),
array( 'match-keys' => array( 2 ),
'match-with' => 'delimiter' ) ) ) ) );
$delimiterNode = false;
if ( count( $delimiterNodes ) > 0 )
$delimiterNode = $delimiterNodes[0];
$delimiterChildren = eZTemplateNodeTool::extractFunctionNodeChildren( $delimiterNode );
$delimiterParameters = eZTemplateNodeTool::extractFunctionNodeParameters( $delimiterNode );
$checkModulo = array();
$checkModuloEnd = array();
$delemiterModuloValue = array();
if ( isset( $delimiterParameters['modulo'] ) )
{
switch ( $this->Name )
{
case 'foreach':
{
$delimiterModulo = $delimiterParameters['modulo'];
$delimiterModulo = eZTemplateCompiler::processElementTransformationList( $this->Tpl, $delimiterModulo, $delimiterModulo, $this->PrivateData );
// Get unique index
$currentIndex = "\$fe_i_$this->UniqID";
if ( eZTemplateNodeTool::isConstantElement( $delimiterModulo ) )
{
$moduloValue = (int)eZTemplateNodeTool::elementConstantValue( $delimiterModulo );
$matchCode = "( ( $currentIndex ) % $moduloValue ) == 0";
}
else
{
$delemiterModuloValue[] = eZTemplateNodeTool::createVariableNode( false, $delimiterModulo, eZTemplateNodeTool::extractFunctionNodePlacement( $this->Node ),
array( 'spacing' => 0 ), 'moduloValue' );
$matchCode = "( ( $currentIndex ) % \$moduloValue ) == 0";
}
$checkModulo[] = eZTemplateNodeTool::createCodePieceNode( "if ( $matchCode ) // Check modulo\n{" );
$checkModulo[] = eZTemplateNodeTool::createSpacingIncreaseNode( 4 );
$checkModuloEnd[] = eZTemplateNodeTool::createSpacingDecreaseNode( 4 );
$checkModuloEnd[] = eZTemplateNodeTool::createCodePieceNode( "}\n" );
}
}
}
$delimiterNodes = array();
$delimiterNodes[] = eZTemplateNodeTool::createCodePieceNode( "if ( \$skipDelimiter )\n" .
" \$skipDelimiter = false;\n" .
"else\n" .
"{ // delimiter begins" );
$delimiterNodes[] = eZTemplateNodeTool::createSpacingIncreaseNode();
if ( is_array( $delimiter[1] ) ) // if delimiter has children
{
// If modulo is specified
//.........这里部分代码省略.........