本文整理汇总了PHP中eZTemplateCompiler::calculateVariableStatisticsChildren方法的典型用法代码示例。如果您正苦于以下问题:PHP eZTemplateCompiler::calculateVariableStatisticsChildren方法的具体用法?PHP eZTemplateCompiler::calculateVariableStatisticsChildren怎么用?PHP eZTemplateCompiler::calculateVariableStatisticsChildren使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类eZTemplateCompiler
的用法示例。
在下文中一共展示了eZTemplateCompiler::calculateVariableStatisticsChildren方法的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);
}
}
}
示例2: calculateVariableStatisticsChildren
static function calculateVariableStatisticsChildren($tpl, &$nodeChildren, &$resourceData, $namespace, &$stats)
{
foreach ($nodeChildren as $node) {
if (!isset($node[0])) {
continue;
}
$nodeType = $node[0];
if ($nodeType == eZTemplate::NODE_ROOT) {
$children = $node[1];
if ($children) {
eZTemplateCompiler::calculateVariableStatisticsChildren($tpl, $children, $resourceData, $namespace, $stats);
}
} else {
if ($nodeType == eZTemplate::NODE_TEXT) {
$text = $node[2];
$placement = $node[3];
} else {
if ($nodeType == eZTemplate::NODE_VARIABLE) {
$variableData = $node[2];
$variablePlacement = $node[3];
$variableParameters = false;
eZTemplateCompiler::calculateVariableNodeStatistics($tpl, $variableData, $variablePlacement, $resourceData, $namespace, $stats);
} else {
if ($nodeType == eZTemplate::NODE_FUNCTION) {
$functionChildren = $node[1];
$functionName = $node[2];
$functionParameters = $node[3];
$functionPlacement = $node[4];
if (!isset($tpl->Functions[$functionName])) {
continue;
}
if (is_array($tpl->Functions[$functionName])) {
$tpl->loadAndRegisterOperators($tpl->Functions[$functionName]);
}
$functionObject =& $tpl->Functions[$functionName];
if (is_object($functionObject)) {
$hasTransformationSupport = false;
$transformChildren = true;
if (method_exists($functionObject, 'functionTemplateStatistics')) {
$functionObject->functionTemplateStatistics($functionName, $node, $tpl, $resourceData, $namespace, $stats);
}
} else {
if ($resourceData['test-compile']) {
$tpl->warning('', "Operator '{$operatorName}' is not registered.", $functionPlacement);
}
}
}
}
}
}
}
}
示例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);
}
}