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


PHP eZTemplateNodeTool::createResourceAcquisitionNode方法代码示例

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


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

示例1: templateNodeTransformation

 function templateNodeTransformation($functionName, &$node, $tpl, &$resourceData, $parameters, $namespaceValue)
 {
     if ($this->Name != 'file') {
         return false;
     }
     $file = $resourceData['template-name'];
     if (!file_exists($file)) {
         return false;
     }
     $newNodes = array();
     $newNodes[] = eZTemplateNodeTool::createResourceAcquisitionNode($resourceData['resource'], $file, $file, eZTemplate::RESOURCE_FETCH, false, $node[4], array(), $namespaceValue);
     return $newNodes;
 }
开发者ID:CG77,项目名称:ezpublish-legacy,代码行数:13,代码来源:eztemplatefileresource.php

示例2: templateNodeTransformation

 function templateNodeTransformation($functionName, &$node, $tpl, &$resourceData, $parameters, $namespaceValue)
 {
     if ($this->Name != 'design' and $this->Name != 'standard') {
         return false;
     }
     $file = $resourceData['template-name'];
     $matchFileArray = eZTemplateDesignResource::overrideArray($this->OverrideSiteAccess);
     $matchList = array();
     foreach ($matchFileArray as $matchFile) {
         if (!isset($matchFile['template'])) {
             continue;
         }
         if ($matchFile['template'] == '/' . $file) {
             $matchList[] = $matchFile;
         }
     }
     $resourceName = $resourceData['resource'];
     $resourceNameText = eZPHPCreator::variableText($resourceName);
     $designKeysName = 'dKeys';
     if ($resourceName == 'standard') {
         $designKeysName = 'rKeys';
     }
     $newNodes = array();
     $newNodes[] = eZTemplateNodeTool::createCodePieceNode("if " . ($resourceData['use-comments'] ? "/*TDR:" . __LINE__ . "*/" : "") . "( !isset( \${$designKeysName} ) )\n" . "{\n" . "    \$resH = \$tpl->resourceHandler( {$resourceNameText} );\n" . "    \${$designKeysName} = \$resH->keys();" . "\n" . "}\n");
     foreach ($matchList as $match) {
         $basedir = $match['base_dir'];
         $template = $match['template'];
         $file = $basedir . $template;
         $spacing = 0;
         $addFileResource = true;
         if (isset($match['custom_match'])) {
             $spacing = 4;
             $customMatchList = $match['custom_match'];
             $matchCount = 0;
             foreach ($customMatchList as $customMatch) {
                 $matchConditionCount = count($customMatch['conditions']);
                 $code = '';
                 if ($matchCount > 0) {
                     $code = "else " . ($resourceData['use-comments'] ? "/*TDR:" . __LINE__ . "*/" : "") . "";
                 }
                 if ($matchConditionCount > 0) {
                     if ($matchCount > 0) {
                         $code .= " ";
                     }
                     $code .= "if " . ($resourceData['use-comments'] ? "/*TDR:" . __LINE__ . "*/" : "") . "( ";
                 }
                 $ifLength = strlen($code);
                 $conditionCount = 0;
                 if (is_array($customMatch['conditions'])) {
                     foreach ($customMatch['conditions'] as $conditionName => $conditionValue) {
                         if ($conditionCount > 0) {
                             $code .= " and\n" . str_repeat(' ', $ifLength);
                         }
                         $conditionNameText = eZPHPCreator::variableText($conditionName, 0);
                         $conditionValueText = eZPHPCreator::variableText($conditionValue, 0);
                         $code .= "isset( \$" . $designKeysName . "[{$conditionNameText}] ) and ";
                         if ($conditionName == 'url_alias') {
                             $code .= "(strpos( \$" . $designKeysName . "[{$conditionNameText}], {$conditionValueText} ) === 0 )";
                         } else {
                             $code .= "( is_array( \$" . $designKeysName . "[{$conditionNameText}] ) ? " . "in_array( {$conditionValueText}, \$" . $designKeysName . "[{$conditionNameText}] ) : " . "\$" . $designKeysName . "[{$conditionNameText}] == {$conditionValueText} )";
                         }
                         ++$conditionCount;
                     }
                 }
                 if ($matchConditionCount > 0) {
                     $code .= " )\n";
                 }
                 if ($matchConditionCount > 0 or $matchCount > 0) {
                     $code .= "{";
                 }
                 $matchFile = $customMatch['match_file'];
                 $newNodes[] = eZTemplateNodeTool::createCodePieceNode($code);
                 $newNodes[] = eZTemplateNodeTool::createResourceAcquisitionNode('', $matchFile, $matchFile, eZTemplate::RESOURCE_FETCH, false, $node[4], array('spacing' => $spacing), $namespaceValue);
                 if ($matchConditionCount > 0 or $matchCount > 0) {
                     $newNodes[] = eZTemplateNodeTool::createCodePieceNode("}");
                 }
                 ++$matchCount;
                 if ($matchConditionCount == 0) {
                     $addFileResource = false;
                     break;
                 }
             }
             if ($addFileResource) {
                 $newNodes[] = eZTemplateNodeTool::createCodePieceNode("else" . ($resourceData['use-comments'] ? "/*TDR:" . __LINE__ . "*/" : "") . "\n{");
             }
         }
         if ($addFileResource) {
             $newNodes[] = eZTemplateNodeTool::createResourceAcquisitionNode('', $file, $file, eZTemplate::RESOURCE_FETCH, false, $node[4], array('spacing' => $spacing), $namespaceValue);
         }
         if (isset($match['custom_match']) and $addFileResource) {
             $newNodes[] = eZTemplateNodeTool::createCodePieceNode("}");
         }
     }
     return $newNodes;
 }
开发者ID:patrickallaert,项目名称:ezpublish-legacy-php7,代码行数:95,代码来源:eztemplatedesignresource.php

示例3: resourceAcquisitionTransformation


//.........这里部分代码省略.........
                                    if ( $conditionCount > 0 )
                                        $code .= " and\n" . str_repeat( ' ', $ifLength );
                                    $conditionNameText = eZPHPCreator::variableText( $conditionName, 0 );
                                    $conditionValueText = eZPHPCreator::variableText( $conditionValue, 0 );

                                    $code .= "isset( \$" . $designKeysName . "[$conditionNameText] ) and ";
                                    if ( $conditionNameText == '"url_alias"' )
                                    {
                                        $code .= "( strpos(\$" . $designKeysName . "[$conditionNameText], $conditionValueText ) === 0 )";
                                    }
                                    else
                                    {
                                        $code .= "( is_array( \$" . $designKeysName . "[$conditionNameText] ) ? " .
                                                 "in_array( $conditionValueText, \$" . $designKeysName . "[$conditionNameText] ) : " .
                                                 "\$" . $designKeysName . "[$conditionNameText] == $conditionValueText )";
                                    }
                                    ++$conditionCount;
                                }
                            }
                            if ( $matchConditionCount > 0 )
                            {
                                $code .= " )\n";
                            }
                            if ( $matchConditionCount > 0 or $matchCount > 0 )
                            {
                                $code .= "{";
                            }
                            $matchFile = $customMatch['match_file'];
                            $tmpAcquisitionNodes[] = eZTemplateNodeTool::createCodePieceNode( $code, array( 'spacing' => $customSpacing ) );
                            $hasAcquisitionNodes = true;
                            // If $matchFile is an array we cannot create a transformation for this entry
                            if ( is_array( $matchFile ) )
                                return false;
                            $tmpAcquisitionNodes[] = eZTemplateNodeTool::createResourceAcquisitionNode( '',
                                                                                                     $matchFile, $matchFile,
                                                                                                     eZTemplate::RESOURCE_FETCH, false,
                                                                                                     $node[4], array( 'spacing' => $customSpacing + 4 ),
                                                                                                     $rule['namespace'] );
                            if ( $matchConditionCount > 0 or $matchCount > 0 )
                            {
                                $tmpAcquisitionNodes[] = eZTemplateNodeTool::createCodePieceNode( "}", array( 'spacing' => $customSpacing ) );
                            }
                            ++$matchCount;
                            if ( $matchConditionCount == 0 )
                            {
                                $addFileResource = false;
                                break;
                            }
                        }
                        if ( $addFileResource )
                            $tmpAcquisitionNodes[] = eZTemplateNodeTool::createCodePieceNode( "else " . ( $resourceData['use-comments'] ? ( "/*OF:" . __LINE__ . "*/" ) : "" ) . " \n{", array( 'spacing' => $customSpacing ) );
                    }
                    else
                    {
                        $matchFile = $matchItem['base_dir'] . $matchItem['template'];
                        $matchLookupArray[$matchPart] = $matchFile;
                        $useArrayLookup = true;
                    }

                    if ( !$useArrayLookup )
                    {
                        if ( $addFileResource )
                        {
                            $matchFile = $matchItem['base_dir'] . $matchItem['template'];
                            $tmpAcquisitionNodes[] = eZTemplateNodeTool::createResourceAcquisitionNode( '',
                                                                                                        $matchFile, $matchFile,
开发者ID:robinmuilwijk,项目名称:ezpublish,代码行数:67,代码来源:ezobjectforwarder.php


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