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


PHP eZTemplateCompiler::createStaticVariableData方法代码示例

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


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

示例1: inspectVariableData

 static function inspectVariableData($tpl, $variableData, $variablePlacement, &$resourceData)
 {
     $dataInspection = array('is-constant' => false, 'is-variable' => false, 'has-operators' => false, 'has-attributes' => false);
     if (!is_array($variableData)) {
         return $dataInspection;
     }
     $newVariableData = array();
     // Static optimizations, the following items are done:
     // - Recognize static data
     // - Extract static data, if possible, from operators
     // - Remove parameters and input which not be used.
     foreach ($variableData as $variableItem) {
         $variableItemType = $variableItem[0];
         $variableItemData = $variableItem[1];
         $variableItemPlacement = $variableItem[2];
         if ($variableItemType == eZTemplate::TYPE_STRING or $variableItemType == eZTemplate::TYPE_IDENTIFIER) {
             $dataInspection['is-constant'] = true;
             $dataInspection['is-variable'] = false;
             $newVariableData[] = $variableItem;
         } else {
             if ($variableItemType == eZTemplate::TYPE_NUMERIC) {
                 $dataInspection['is-constant'] = true;
                 $dataInspection['is-variable'] = false;
                 $newVariableData[] = $variableItem;
             } else {
                 if ($variableItemType == eZTemplate::TYPE_BOOLEAN) {
                     $dataInspection['is-constant'] = true;
                     $dataInspection['is-variable'] = false;
                     $newVariableData[] = $variableItem;
                 } else {
                     if ($variableItemType == eZTemplate::TYPE_DYNAMIC_ARRAY) {
                         $dataInspection['is-constant'] = false;
                         $dataInspection['is-variable'] = true;
                         $newVariableData[] = $variableItem;
                     } else {
                         if ($variableItemType == eZTemplate::TYPE_ARRAY) {
                             $dataInspection['is-constant'] = true;
                             $dataInspection['is-variable'] = false;
                             $newVariableData[] = $variableItem;
                         } else {
                             if ($variableItemType == eZTemplate::TYPE_VARIABLE) {
                                 $dataInspection['is-constant'] = false;
                                 $dataInspection['is-variable'] = true;
                                 $newVariableData[] = $variableItem;
                             } else {
                                 if ($variableItemType == eZTemplate::TYPE_ATTRIBUTE) {
                                     $dataInspection['has-attributes'] = true;
                                     $newDataInspection = eZTemplateCompiler::inspectVariableData($tpl, $variableItemData, $variableItemPlacement, $resourceData);
                                     if (isset($newDataInspection['new-data'])) {
                                         $variableItemData = $newDataInspection['new-data'];
                                     }
                                     $variableItem[1] = $variableItemData;
                                     unset($newDataInspection);
                                     $newVariableData[] = $variableItem;
                                 } else {
                                     if ($variableItemType == eZTemplate::TYPE_OPERATOR) {
                                         $dataInspection['has-operators'] = true;
                                         $operatorName = $variableItemData[0];
                                         $operatorHint = eZTemplateCompiler::operatorHint($tpl, $operatorName);
                                         $newVariableItem = $variableItem;
                                         if ($operatorHint and isset($operatorHint['input']) and isset($operatorHint['output']) and isset($operatorHint['parameters'])) {
                                             if (!$operatorHint['input'] and $operatorHint['output']) {
                                                 $newVariableData = array();
                                             }
                                             if (!isset($operatorHint) or !$operatorHint['parameters']) {
                                                 $newVariableItem[1] = array($operatorName);
                                             }
                                             if (isset($operatorHint['static']) and $operatorHint['static']) {
                                                 $operatorStaticData = eZTemplateCompiler::operatorStaticData($tpl, $operatorName);
                                                 $newVariableItem = eZTemplateCompiler::createStaticVariableData($tpl, $operatorStaticData, $variableItemPlacement);
                                                 $dataInspection['is-constant'] = true;
                                                 $dataInspection['is-variable'] = false;
                                                 $dataInspection['has-operators'] = false;
                                             }
                                         }
                                         if ($newVariableItem[0] == eZTemplate::TYPE_OPERATOR) {
                                             $tmpVariableItem = $newVariableItem[1];
                                             $newVariableItem[1] = array($operatorName);
                                             for ($i = 1; $i < count($tmpVariableItem); ++$i) {
                                                 $operatorParameter = $tmpVariableItem[$i];
                                                 $newDataInspection = eZTemplateCompiler::inspectVariableData($tpl, $operatorParameter, false, $resourceData);
                                                 if (isset($newDataInspection['new-data'])) {
                                                     $operatorParameter = $newDataInspection['new-data'];
                                                 }
                                                 $newVariableItem[1][] = $operatorParameter;
                                             }
                                         }
                                         $newVariableData[] = $newVariableItem;
                                     } else {
                                         if ($variableItemType == eZTemplate::TYPE_VOID) {
                                             $tpl->warning('TemplateCompiler', "Void datatype should not be used, ignoring it");
                                         } else {
                                             if ($variableItemType > eZTemplate::TYPE_INTERNAL and $variableItemType < eZTemplate::TYPE_INTERNAL_STOP) {
                                                 $newVariableData[] = $variableItem;
                                             } else {
                                                 $tpl->warning('TemplateCompiler', "Unknown data type {$variableItemType}, ignoring it");
                                             }
                                         }
                                     }
                                 }
//.........这里部分代码省略.........
开发者ID:runelangseid,项目名称:ezpublish,代码行数:101,代码来源:eztemplatecompiler.php


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