static function processNodeTransformationChild($useComments, $php, $tpl, &$node, &$resourceData) { $nodeType = $node[0]; if ($nodeType == eZTemplate::NODE_FUNCTION) { $nodeCopy = $node; $functionChildren = $node[1]; $functionName = $node[2]; $functionParameters = $node[3]; $functionPlacement = $node[4]; if (!isset($tpl->Functions[$functionName])) { return false; } if (is_array($tpl->Functions[$functionName])) { $tpl->loadAndRegisterFunctions($tpl->Functions[$functionName]); } $functionObject =& $tpl->Functions[$functionName]; if (is_object($functionObject)) { $hasTransformationSupport = false; $transformChildren = true; $transformParameters = false; if (method_exists($functionObject, 'functionTemplateHints')) { $hints = $functionObject->functionTemplateHints(); if (isset($hints[$functionName]) and isset($hints[$functionName]['tree-transformation']) and $hints[$functionName]['tree-transformation']) { $hasTransformationSupport = true; } if (isset($hints[$functionName]) and isset($hints[$functionName]['transform-children'])) { $transformChildren = $hints[$functionName]['transform-children']; } if (isset($hints[$functionName]) and isset($hints[$functionName]['transform-parameters'])) { $transformParameters = $hints[$functionName]['transform-parameters']; } } if ($hasTransformationSupport and method_exists($functionObject, 'templateNodeTransformation')) { if ($transformChildren and $functionChildren) { $newChildren = array(); foreach ($functionChildren as $childNode) { $newChildNode = eZTemplateCompiler::processNodeTransformationChild($useComments, $php, $tpl, $childNode, $resourceData); if (!$newChildNode) { $newChildren[] = $childNode; } else { if (!is_array($newChildNode)) { $newChildren[] = $newChildNode; } else { $newChildren = array_merge($newChildren, $newChildNode); } } } if (count($newChildren) > 0) { $node[1] = $newChildren; } } if ($transformParameters and $functionParameters) { $newParameters = array(); foreach ($functionParameters as $parameterName => $parameterElementList) { $elementTree = $parameterElementList; $elementList = $elementTree; $newParamNode = eZTemplateCompiler::processElementTransformationChild($useComments, $php, $tpl, $node, $elementTree, $elementList, $resourceData); if (!$newParamNode || !is_array($newParamNode)) { $newParameters[$parameterName] = $parameterElementList; } else { $newParameters[$parameterName] = $newParamNode; } } if (count($newParameters) > 0) { $node[3] = $newParameters; $functionParameters = $newParameters; } } $privateData = array('use-comments' => $useComments, 'php-creator' => $php, 'resource-data' => &$resourceData); $newNodes = $functionObject->templateNodeTransformation($functionName, $node, $tpl, $functionParameters, $privateData); unset($privateData); if (!$newNodes) { $node = $nodeCopy; $node[1] = $functionChildren; return false; return $node; } return $newNodes; } } else { if ($resourceData['test-compile']) { $tpl->warning('', "Function '{$functionName}' is not registered.", $functionPlacement); } } return false; } else { if ($nodeType == eZTemplate::NODE_VARIABLE) { $elementTree = $node[2]; $elementList = $elementTree; $newParameterElements = eZTemplateCompiler::processElementTransformationChild($useComments, $php, $tpl, $node, $elementTree, $elementList, $resourceData); if ($newParameterElements) { $newNode = $node; $newNode[2] = $newParameterElements; $newNodes = array($newNode); return $newNodes; } } else { if ($nodeType == eZTemplate::NODE_ROOT) { return eZTemplateCompiler::processNodeTransformationRoot($useComments, $php, $tpl, $node, $resourceData); } else { return false; } } } }