当前位置: 首页>>代码示例>>PHP>>正文


PHP eZTemplateCompiler::processElementTransformationChild方法代码示例

本文整理汇总了PHP中eZTemplateCompiler::processElementTransformationChild方法的典型用法代码示例。如果您正苦于以下问题:PHP eZTemplateCompiler::processElementTransformationChild方法的具体用法?PHP eZTemplateCompiler::processElementTransformationChild怎么用?PHP eZTemplateCompiler::processElementTransformationChild使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在eZTemplateCompiler的用法示例。


在下文中一共展示了eZTemplateCompiler::processElementTransformationChild方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: processElementTransformationChild

 static function processElementTransformationChild($useComments, $php, $tpl, &$node, $elementTree, $elementList, &$resourceData)
 {
     $count = count($elementList);
     $lastElement = null;
     $newElementList = array();
     for ($i = 0; $i < $count; ++$i) {
         $element =& $elementList[$i];
         $elementType = $element[0];
         if ($elementType == eZTemplate::TYPE_OPERATOR) {
             $operatorName = $element[1][0];
             $operatorParameters = array_slice($element[1], 1);
             if (!isset($tpl->Operators[$operatorName])) {
                 return false;
             }
             if (is_array($tpl->Operators[$operatorName])) {
                 $tpl->loadAndRegisterOperators($tpl->Operators[$operatorName]);
             }
             $operatorObject =& $tpl->Operators[$operatorName];
             if (is_object($operatorObject)) {
                 $hasTransformationSupport = false;
                 $transformParameters = false;
                 $inputAsParameter = false;
                 $knownType = 'static';
                 if (method_exists($operatorObject, 'operatorTemplateHints')) {
                     $hints = $operatorObject->operatorTemplateHints();
                     if (isset($hints[$operatorName]) and isset($hints[$operatorName]['element-transformation']) and $hints[$operatorName]['element-transformation']) {
                         $hasTransformationSupport = true;
                     }
                     if ($hasTransformationSupport and isset($hints[$operatorName]['element-transformation-func'])) {
                         $transformationMethod = $hints[$operatorName]['element-transformation-func'];
                     } else {
                         $transformationMethod = 'templateElementTransformation';
                     }
                     if (isset($hints[$operatorName]) and isset($hints[$operatorName]['transform-parameters'])) {
                         $transformParameters = $hints[$operatorName]['transform-parameters'];
                     }
                     if (isset($hints[$operatorName]) and isset($hints[$operatorName]['input-as-parameter'])) {
                         $inputAsParameter = $hints[$operatorName]['input-as-parameter'];
                     }
                     if (isset($hints[$operatorName]['output']) and !$hints[$operatorName]['output']) {
                         $knownType = 'null';
                     } else {
                         if (isset($hints[$operatorName]['output-type'])) {
                             $knownType = $hints[$operatorName]['output-type'];
                         }
                     }
                 }
                 if ($hasTransformationSupport and method_exists($operatorObject, $transformationMethod)) {
                     $resetNewElementList = false;
                     if ($transformParameters) {
                         $newParameters = array();
                         if ($inputAsParameter) {
                             $newParameterElements = eZTemplateCompiler::processElementTransformationChild($useComments, $php, $tpl, $node, $elementTree, $newElementList, $resourceData);
                             if (count($newParameterElements) > 0 or $inputAsParameter === 'always') {
                                 $newParameters[] = $newParameterElements;
                                 $resetNewElementList = true;
                             }
                         }
                         foreach ($operatorParameters as $operatorParameter) {
                             $newParameterElements = eZTemplateCompiler::processElementTransformationChild($useComments, $php, $tpl, $node, $elementTree, $operatorParameter, $resourceData);
                             if (!$newParameterElements) {
                                 $newParameters[] = $operatorParameter;
                             } else {
                                 $newParameters[] = $newParameterElements;
                             }
                         }
                         $operatorParameters = $newParameters;
                     }
                     $newElements = $operatorObject->{$transformationMethod}($operatorName, $node, $tpl, $resourceData, $element, $lastElement, $elementList, $elementTree, $operatorParameters);
                     if (is_array($newElements)) {
                         if ($resetNewElementList) {
                             $newElementList = $newElements;
                         } else {
                             $newElementList = array_merge($newElementList, $newElements);
                         }
                     } else {
                         $newElementList[] = $element;
                     }
                 } else {
                     $newElementList[] = $element;
                 }
             } else {
                 if ($resourceData['test-compile']) {
                     $tpl->warning('', "Operator '{$operatorName}' is not registered.");
                 }
             }
         } else {
             $newElementList[] = $element;
         }
         $lastElement = $element;
     }
     return $newElementList;
 }
开发者ID:runelangseid,项目名称:ezpublish,代码行数:93,代码来源:eztemplatecompiler.php


注:本文中的eZTemplateCompiler::processElementTransformationChild方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。