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


PHP eZTemplateCompiler::operatorHint方法代碼示例

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


在下文中一共展示了eZTemplateCompiler::operatorHint方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: generateVariableDataCode


//.........這裏部分代碼省略.........
                                                $newParameters['counter'] += 1;
                                                $tmpVariableAssignmentName = $newParameters['variable'];
                                                $tmpVariableAssignmentCounter = $newParameters['counter'];
                                                if ($tmpVariableAssignmentCounter > 0) {
                                                    $tmpVariableAssignmentName .= $tmpVariableAssignmentCounter;
                                                }
                                                if (eZTemplateNodeTool::isStaticElement($variableDataItem[1])) {
                                                    $attributeStaticValue = eZTemplateNodeTool::elementStaticValue($variableDataItem[1]);
                                                    $attributeText = $php->thisVariableText($attributeStaticValue, 0, 0, false);
                                                } else {
                                                    $newParameters['counter'] += 1;
                                                    $tmpKnownTypes = array();
                                                    eZTemplateCompiler::generateVariableDataCode($php, $tpl, $variableDataItem[1], $tmpKnownTypes, $dataInspection, $persistence, $newParameters, $resourceData);
                                                    $newVariableAssignmentName = $newParameters['variable'];
                                                    $newVariableAssignmentCounter = $newParameters['counter'];
                                                    if ($newVariableAssignmentCounter > 0) {
                                                        $newVariableAssignmentName .= $newVariableAssignmentCounter;
                                                    }
                                                    $attributeText = "\${$newVariableAssignmentName}";
                                                }
                                                $php->addCodePiece("\${$tmpVariableAssignmentName} = compiledFetchAttribute( \${$variableAssignmentName}, {$attributeText} );\n" . "unset( \${$variableAssignmentName} );\n" . "\${$variableAssignmentName} = \${$tmpVariableAssignmentName};\n", array('spacing' => $spacing));
                                                // End if optimized node object is null/false. See also eZTemplateOptimizer::optimizeVariable()
                                                if ($optimizeNode && $index == 3) {
                                                    $php->addCodePiece("}\n");
                                                }
                                            } else {
                                                if ($variableDataType == eZTemplate::TYPE_OPERATOR) {
                                                    $knownTypes = array();
                                                    $operatorParameters = $variableDataItem[1];
                                                    $operatorName = $operatorParameters[0];
                                                    $operatorParameters = array_splice($operatorParameters, 1);
                                                    $operatorNameText = $php->thisVariableText($operatorName, 0, 0, false);
                                                    $operatorParametersText = $php->thisVariableText($operatorParameters, 23, 0, false);
                                                    $operatorHint = eZTemplateCompiler::operatorHint($tpl, $operatorName);
                                                    if (isset($operatorHint['output']) and $operatorHint['output']) {
                                                        if (isset($operatorHint['output-type'])) {
                                                            $knownType = $operatorHint['output-type'];
                                                            if (is_array($knownType)) {
                                                                $knownTypes = array_merge($knownTypes, $knownType);
                                                            } else {
                                                                $knownTypes[] = $knownType;
                                                            }
                                                            $knownTypes = array_unique($knownTypes);
                                                        } else {
                                                            $knownTypes[] = 'static';
                                                        }
                                                    }
                                                    $php->addCodePiece("if (! isset( \${$variableAssignmentName} ) ) \${$variableAssignmentName} = NULL;\n", array('spacing' => $spacing));
                                                    $php->addCodePiece("while " . ($resourceData['use-comments'] ? "/*TC:" . __LINE__ . "*/" : "") . "( is_object( \${$variableAssignmentName} ) and method_exists( \${$variableAssignmentName}, 'templateValue' ) )\n" . "    \${$variableAssignmentName} = \${$variableAssignmentName}" . "->templateValue();\n");
                                                    $php->addCodePiece("\$" . $variableAssignmentName . "Data = array( 'value' => \${$variableAssignmentName} );\n\$tpl->processOperator( {$operatorNameText},\n                       {$operatorParametersText},\n                       \$rootNamespace, \$currentNamespace, \$" . $variableAssignmentName . "Data, false, false );\n\${$variableAssignmentName} = \$" . $variableAssignmentName . "Data['value'];\nunset( \$" . $variableAssignmentName . "Data );\n", array('spacing' => $spacing));
                                                } else {
                                                    if ($variableDataType == eZTemplate::TYPE_VOID) {
                                                    } else {
                                                        if ($variableDataType == eZTemplate::TYPE_DYNAMIC_ARRAY) {
                                                            $knownTypes = array_unique(array_merge($knownTypes, array('array')));
                                                            $code = '%output% = array( ';
                                                            $matchMap = array('%input%', '%output%');
                                                            $replaceMap = array('$' . $variableAssignmentName, '$' . $variableAssignmentName);
                                                            $unsetList = array();
                                                            $counter = 1;
                                                            $paramCount = 0;
                                                            $values = $variableDataItem[2];
                                                            $newParameters = $parameters;
                                                            foreach ($values as $key => $value) {
                                                                if ($paramCount != 0) {
                                                                    $code .= ', ';
開發者ID:runelangseid,項目名稱:ezpublish,代碼行數:67,代碼來源:eztemplatecompiler.php


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