本文整理匯總了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);
}
}