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


PHP eZTemplateNodeTool::isPHPVariableElement方法代码示例

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


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

示例1: generatePHPCodeChildren


//.........这里部分代码省略.........
                                $rememberSet = isset($node[7]) ? $node[7] : false;
                                $spacing = $currentParameters['spacing'];
                                if (isset($variableParameters['spacing'])) {
                                    $spacing += $variableParameters['spacing'];
                                }
                                $variableParameters = array_merge(array('variable-name' => 'var', 'text-result' => true), $variableParameters);
                                $dataInspection = eZTemplateCompiler::inspectVariableData($tpl, $variableData, $variablePlacement, $resourceData);
                                $newNode = $node;
                                $newNode[1] = false;
                                $treatVariableDataAsNonObject = isset($variableParameters['treat-value-as-non-object']) && $variableParameters['treat-value-as-non-object'];
                                if ($useComments) {
                                    $php->addComment("Variable data: " . "Is constant: " . ($dataInspection['is-constant'] ? 'Yes' : 'No') . " Is variable: " . ($dataInspection['is-variable'] ? 'Yes' : 'No') . " Has attributes: " . ($dataInspection['has-attributes'] ? 'Yes' : 'No') . " Has operators: " . ($dataInspection['has-operators'] ? 'Yes' : 'No'), true, true, array('spacing' => $spacing));
                                    $originalText = eZTemplateCompiler::fetchTemplatePiece($variablePlacement);
                                    $php->addComment('{' . $originalText . '}', true, true, array('spacing' => $spacing));
                                }
                                $generatedVariableName = $variableParameters['variable-name'];
                                $assignVariable = false;
                                if ($variableAssignmentName !== false) {
                                    if (is_array($variableAssignmentName)) {
                                        $variableParameters['text-result'] = false;
                                        $assignVariable = true;
                                    } else {
                                        $generatedVariableName = $variableAssignmentName;
                                        $variableParameters['text-result'] = false;
                                    }
                                }
                                $isStaticElement = false;
                                $nodeElements = $node[2];
                                $knownTypes = array();
                                if (eZTemplateNodeTool::isStaticElement($nodeElements) and !$variableParameters['text-result']) {
                                    $variableText = $php->thisVariableText(eZTemplateNodeTool::elementStaticValue($nodeElements), 0, 0, false);
                                    $isStaticElement = true;
                                } else {
                                    if (eZTemplateNodeTool::isPHPVariableElement($nodeElements) and !$variableParameters['text-result']) {
                                        $variableText = '$' . eZTemplateNodeTool::elementStaticValue($nodeElements);
                                        $isStaticElement = true;
                                    } else {
                                        $variableText = "\${$generatedVariableName}";
                                        eZTemplateCompiler::generateVariableCode($php, $tpl, $node, $knownTypes, $dataInspection, array('spacing' => $spacing, 'variable' => $generatedVariableName, 'treat-value-as-non-object' => $treatVariableDataAsNonObject, 'counter' => 0), $resourceData);
                                    }
                                }
                                if ($variableParameters['text-result']) {
                                    $textName = eZTemplateCompiler::currentTextName($parameters);
                                    if (count($knownTypes) == 0 or in_array('objectproxy', $knownTypes)) {
                                        $php->addCodePiece("\${$textName} .= ( is_object( \${$generatedVariableName} ) ? compiledFetchText( \$tpl, \$rootNamespace, \$currentNamespace, false, \${$generatedVariableName} ) : \${$generatedVariableName} );" . ($resourceData['use-comments'] ? "/*TC:" . __LINE__ . "*/" : "") . "\n" . "unset( \${$generatedVariableName} );\n", array('spacing' => $spacing));
                                    } else {
                                        $php->addCodePiece("\${$textName} .= \${$generatedVariableName};\n" . "unset( \${$generatedVariableName} );\n", array('spacing' => $spacing));
                                    }
                                } else {
                                    if ($assignVariable) {
                                        $namespace = $variableAssignmentName[0];
                                        $namespaceScope = $variableAssignmentName[1];
                                        $variableName = $variableAssignmentName[2];
                                        $namespaceText = eZTemplateCompiler::generateMergeNamespaceCode($php, $tpl, $namespace, $namespaceScope, array('spacing' => $spacing), true);
                                        if (!is_string($namespaceText)) {
                                            $namespaceText = "\$namespace";
                                        }
                                        $variableNameText = $php->thisVariableText($variableName, 0, 0, false);
                                        $unsetVariableText = false;
                                        if ($variableOnlyExisting) {
                                            if (!$isStaticElement) {
                                                $unsetVariableText = "\n    unset( {$variableText} );";
                                            }
                                            $php->addCodePiece("if " . ($resourceData['use-comments'] ? "/*TC:" . __LINE__ . "*/" : "") . "( array_key_exists( {$namespaceText}, \$vars ) && array_key_exists( {$variableNameText}, \$vars[{$namespaceText}] ) )\n" . "{\n" . "    \$vars[{$namespaceText}][{$variableNameText}] = {$variableText};{$unsetVariableText}\n" . "}", array('spacing' => $spacing));
                                        } else {
                                            if ($variableOverWrite) {
开发者ID:runelangseid,项目名称:ezpublish,代码行数:67,代码来源:eztemplatecompiler.php

示例2: elementStaticValue

 static function elementStaticValue($elements)
 {
     if (eZTemplateNodeTool::isConstantElement($elements) or eZTemplateNodeTool::isPHPVariableElement($elements)) {
         return $elements[0][1];
     }
     return null;
 }
开发者ID:runelangseid,项目名称:ezpublish,代码行数:7,代码来源:eztemplatenodetool.php


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