當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。