当前位置: 首页>>代码示例>>PHP>>正文


PHP eZTemplateCompiler::calculateVariableNodeStatistics方法代码示例

本文整理汇总了PHP中eZTemplateCompiler::calculateVariableNodeStatistics方法的典型用法代码示例。如果您正苦于以下问题:PHP eZTemplateCompiler::calculateVariableNodeStatistics方法的具体用法?PHP eZTemplateCompiler::calculateVariableNodeStatistics怎么用?PHP eZTemplateCompiler::calculateVariableNodeStatistics使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在eZTemplateCompiler的用法示例。


在下文中一共展示了eZTemplateCompiler::calculateVariableNodeStatistics方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: functionTemplateStatistics

 function functionTemplateStatistics($functionName, &$node, $tpl, $resourceData, $namespace, &$stats)
 {
     $newNamespace = $namespace;
     $parameters = eZTemplateNodeTool::extractFunctionNodeParameters($node);
     if ($functionName == $this->SetName or $functionName == $this->LetName or $functionName == $this->DefaultName) {
         if (isset($parameters['-name'])) {
             $nameData = $parameters['-name'];
             $nameDataInspection = eZTemplateCompiler::inspectVariableData($tpl, $nameData, false, $resourceData);
             if ($nameDataInspection['is-constant'] and !$nameDataInspection['has-operators'] and !$nameDataInspection['has-attributes']) {
                 $parameterNamespace = $nameDataInspection['new-data'][0][1];
                 $newNamespace = $tpl->mergeNamespace($namespace, $parameterNamespace);
             }
         }
     }
     if ($functionName == $this->SetName) {
         foreach (array_keys($parameters) as $name) {
             if ($name == '-name') {
                 continue;
             }
             $parameter =& $parameters[$name];
             eZTemplateCompiler::setVariableStatistics($stats, $newNamespace, $name, array('is_modified' => true));
             eZTemplateCompiler::calculateVariableNodeStatistics($tpl, $parameter, false, $resourceData, $namespace, $stats);
         }
     } else {
         if ($functionName == $this->LetName) {
             foreach (array_keys($parameters) as $name) {
                 if ($name == '-name') {
                     continue;
                 }
                 $parameter =& $parameters[$name];
                 eZTemplateCompiler::setVariableStatistics($stats, $newNamespace, $name, array('is_created' => true, 'is_removed' => true));
                 eZTemplateCompiler::calculateVariableNodeStatistics($tpl, $parameter, false, $resourceData, $namespace, $stats);
             }
         } else {
             if ($functionName == $this->DefaultName) {
                 foreach (array_keys($parameters) as $name) {
                     if ($name == '-name') {
                         continue;
                     }
                     $parameter =& $parameters[$name];
                     eZTemplateCompiler::setVariableStatistics($stats, $newNamespace, $name, array());
                     eZTemplateCompiler::calculateVariableNodeStatistics($tpl, $parameter, false, $resourceData, $namespace, $stats);
                 }
             }
         }
     }
     if ($functionName == $this->LetName or $functionName == $this->DefaultName) {
         $functionChildren = eZTemplateNodeTool::extractFunctionNodeChildren($node);
         if (is_array($functionChildren)) {
             eZTemplateCompiler::calculateVariableStatisticsChildren($tpl, $functionChildren, $resourceData, $newNamespace, $stats);
         }
     }
 }
开发者ID:runelangseid,项目名称:ezpublish,代码行数:53,代码来源:eztemplatesetfunction.php

示例2: calculateVariableNodeStatistics

 static function calculateVariableNodeStatistics($tpl, $variableData, $variablePlacement, &$resourceData, $namespace, &$stats)
 {
     if (!is_array($variableData)) {
         return false;
     }
     foreach ($variableData as $variableItem) {
         $variableItemType = $variableItem[0];
         $variableItemData = $variableItem[1];
         $variableItemPlacement = $variableItem[2];
         if ($variableItemType == eZTemplate::TYPE_STRING or $variableItemType == eZTemplate::TYPE_IDENTIFIER) {
         } else {
             if ($variableItemType == eZTemplate::TYPE_NUMERIC) {
             } else {
                 if ($variableItemType == eZTemplate::TYPE_ARRAY) {
                 } else {
                     if ($variableItemType == eZTemplate::TYPE_BOOLEAN) {
                     } else {
                         if ($variableItemType == eZTemplate::TYPE_VARIABLE) {
                             $variableNamespace = $variableItemData[0];
                             $variableNamespaceScope = $variableItemData[1];
                             $variableName = $variableItemData[2];
                             if ($variableNamespaceScope == eZTemplate::NAMESPACE_SCOPE_GLOBAL) {
                                 $newNamespace = $variableNamespace;
                             } else {
                                 if ($variableNamespaceScope == eZTemplate::NAMESPACE_SCOPE_LOCAL) {
                                     $newNamespace = $variableNamespace;
                                 } else {
                                     if ($variableNamespaceScope == eZTemplate::NAMESPACE_SCOPE_RELATIVE) {
                                         $newNamespace = $tpl->mergeNamespace($namespace, $variableNamespace);
                                     } else {
                                         $newNamespace = false;
                                     }
                                 }
                             }
                             eZTemplateCompiler::setVariableStatistics($stats, $newNamespace, $variableName, array('is_accessed' => true));
                         } else {
                             if ($variableItemType == eZTemplate::TYPE_ATTRIBUTE) {
                                 eZTemplateCompiler::calculateVariableNodeStatistics($tpl, $variableItemData, $variableItemPlacement, $resourceData, $namespace, $stats);
                             } else {
                                 if ($variableItemType == eZTemplate::TYPE_OPERATOR) {
                                     $operatorName = $variableItemData[0];
                                     if (!isset($tpl->Operators[$operatorName])) {
                                         continue;
                                     }
                                     if (is_array($tpl->Operators[$operatorName])) {
                                         $tpl->loadAndRegisterOperators($tpl->Operators[$operatorName]);
                                     }
                                     $operator =& $tpl->Operators[$operatorName];
                                     if (is_object($operator)) {
                                         $hasStats = false;
                                         if (method_exists($operator, 'operatorTemplateHints')) {
                                             $hints = $operator->operatorTemplateHints();
                                             if (isset($hints[$operatorName])) {
                                                 $operatorHints = $hints[$operatorName];
                                                 $hasParameters = false;
                                                 if (isset($operatorHints['parameters'])) {
                                                     $hasParameters = $operatorHints['parameters'];
                                                 }
                                                 if ($hasParameters === true) {
                                                     $parameters = $variableItemData;
                                                     $count = count($parameters) - 1;
                                                     for ($i = 0; $i < $count; ++$i) {
                                                         $parameter =& $parameters[$i + 1];
                                                         $parameterData = $parameter[1];
                                                         $parameterPlacement = $parameter[2];
                                                         eZTemplateCompiler::calculateVariableNodeStatistics($tpl, $parameter, $parameterPlacement, $resourceData, $namespace, $stats);
                                                     }
                                                 } else {
                                                     if (is_integer($hasParameters)) {
                                                         $parameters = $variableItemData;
                                                         $count = min(count($parameters) - 1, $hasParameters);
                                                         for ($i = 0; $i < $count; ++$i) {
                                                             $parameter =& $parameters[$i + 1];
                                                             $parameterData = $parameter[1];
                                                             $parameterPlacement = $parameter[2];
                                                             eZTemplateCompiler::calculateVariableNodeStatistics($tpl, $parameter, $parameterPlacement, $resourceData, $namespace, $stats);
                                                         }
                                                     }
                                                 }
                                                 $hasStats = true;
                                             }
                                         }
                                         if (!$hasStats and method_exists($operator, 'operatorTemplateStatistics')) {
                                             $hasStats = $operator->operatorTemplateStatistics($operatorName, $variableItem, $variablePlacement, $tpl, $resourceData, $namespace, $stats);
                                         }
                                         if (!$hasStats and method_exists($operator, 'namedParameterList')) {
                                             $namedParameterList = $operator->namedParameterList();
                                             if (method_exists($operator, 'namedParameterPerOperator') and $operator->namedParameterPerOperator()) {
                                                 $namedParameterList = $namedParameterList[$operatorName];
                                             }
                                             $operatorParameters = array_slice($variableItemData, 1);
                                             $count = 0;
                                             foreach ($namedParameterList as $parameterName => $parameterDefinition) {
                                                 $operatorParameter = $operatorParameters[$count];
                                                 eZTemplateCompiler::calculateVariableNodeStatistics($tpl, $operatorParameter, $variablePlacement, $resourceData, $namespace, $stats);
                                                 ++$count;
                                             }
                                             $hasStats = true;
                                         }
                                     } else {
//.........这里部分代码省略.........
开发者ID:runelangseid,项目名称:ezpublish,代码行数:101,代码来源:eztemplatecompiler.php

示例3: functionTemplateStatistics

 function functionTemplateStatistics($functionName, &$node, $tpl, $resourceData, $namespace, &$stats)
 {
     if ($functionName != $this->Name) {
         return false;
     }
     $newNamespace = $namespace;
     $parameters = eZTemplateNodeTool::extractFunctionNodeParameters($node);
     if (isset($parameters['name'])) {
         $nameData = $parameters['name'];
         $nameDataInspection = eZTemplateCompiler::inspectVariableData($tpl, $nameData, false, $resourceData);
         if ($nameDataInspection['is-constant'] and !$nameDataInspection['has-operators'] and !$nameDataInspection['has-attributes']) {
             $parameterNamespace = $nameDataInspection['new-data'][0][1];
             $newNamespace = $tpl->mergeNamespace($namespace, $parameterNamespace);
         }
     }
     $parameterNames = array('loop', 'show', 'var', 'last-value', 'reverse', 'sequence', 'max', 'offset');
     foreach ($parameterNames as $parameterName) {
         if (isset($parameters[$parameterName])) {
             eZTemplateCompiler::calculateVariableNodeStatistics($tpl, $parameters[$parameterName], false, $resourceData, $namespace, $stats);
         }
     }
     if (!isset($parameters['var'])) {
         if (isset($parameters['loop'])) {
             $newVariables = array('key', 'item', 'index', 'number');
             foreach ($newVariables as $newVariableName) {
                 eZTemplateCompiler::setVariableStatistics($stats, $newNamespace, $newVariableName, array('is_created' => true, 'is_removed' => true));
             }
         }
         if (isset($parameters['sequence'])) {
             $newVariables = array('sequence');
             foreach ($newVariables as $newVariableName) {
                 eZTemplateCompiler::setVariableStatistics($stats, $newNamespace, $newVariableName, array('is_created' => true, 'is_removed' => true));
             }
         }
     } else {
         if (isset($parameters['loop'])) {
             $varDataInspection = eZTemplateCompiler::inspectVariableData($tpl, $parameters['var'], false, $resourceData);
             if ($varDataInspection['is-constant'] and !$varDataInspection['has-operators'] and !$varDataInspection['has-attributes']) {
                 $varName = $varDataInspection['new-data'][0][1];
                 eZTemplateCompiler::setVariableStatistics($stats, $newNamespace, $varName, array('is_created' => true, 'is_removed' => true));
             }
         }
     }
     $functionChildren = eZTemplateNodeTool::extractFunctionNodeChildren($node);
     if (is_array($functionChildren)) {
         eZTemplateCompiler::calculateVariableStatisticsChildren($tpl, $functionChildren, $resourceData, $newNamespace, $stats);
     }
 }
开发者ID:runelangseid,项目名称:ezpublish,代码行数:48,代码来源:eztemplatesectionfunction.php


注:本文中的eZTemplateCompiler::calculateVariableNodeStatistics方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。