本文整理汇总了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");
}
}
}
}
//.........这里部分代码省略.........