当前位置: 首页>>代码示例>>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;未经允许,请勿转载。