當前位置: 首頁>>代碼示例>>PHP>>正文


PHP eZTemplateCompiler::operatorStaticData方法代碼示例

本文整理匯總了PHP中eZTemplateCompiler::operatorStaticData方法的典型用法代碼示例。如果您正苦於以下問題:PHP eZTemplateCompiler::operatorStaticData方法的具體用法?PHP eZTemplateCompiler::operatorStaticData怎麽用?PHP eZTemplateCompiler::operatorStaticData使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在eZTemplateCompiler的用法示例。


在下文中一共展示了eZTemplateCompiler::operatorStaticData方法的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::operatorStaticData方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。