本文整理汇总了PHP中eZTemplateCompiler::processNodeTransformationChild方法的典型用法代码示例。如果您正苦于以下问题:PHP eZTemplateCompiler::processNodeTransformationChild方法的具体用法?PHP eZTemplateCompiler::processNodeTransformationChild怎么用?PHP eZTemplateCompiler::processNodeTransformationChild使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类eZTemplateCompiler
的用法示例。
在下文中一共展示了eZTemplateCompiler::processNodeTransformationChild方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: processNodeTransformationChild
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 {
//.........这里部分代码省略.........