Verzeichnisstruktur phpBB-3.3.16


Veröffentlicht
27.04.2026

So funktioniert es


Auf das letzte Element klicken. Dies geht jeweils ein Schritt zurück

Auf das Icon klicken, dies öffnet das Verzeichnis. Nochmal klicken schließt das Verzeichnis.
Auf den Verzeichnisnamen klicken, dies zeigt nur das Verzeichnis mit Inhalt an

      (Beispiel Datei-Icons)

Auf das Icon klicken um den Quellcode anzuzeigen

BlockReferenceExpression.php

Zuletzt modifiziert: 01.05.2026, 11:28 - Dateigröße: 2.34 KiB


 01  <?php
 02   
 03  /*
 04   * This file is part of Twig.
 05   *
 06   * (c) Fabien Potencier
 07   * (c) Armin Ronacher
 08   *
 09   * For the full copyright and license information, please view the LICENSE
 10   * file that was distributed with this source code.
 11   */
 12   
 13  namespace Twig\Node\Expression;
 14   
 15  use Twig\Compiler;
 16  use Twig\Node\Node;
 17   
 18  /**
 19   * Represents a block call node.
 20   *
 21   * @author Fabien Potencier <fabien@symfony.com>
 22   */
 23  class BlockReferenceExpression extends AbstractExpression
 24  {
 25      public function __construct(Node $name, ?Node $template, int $lineno, string $tag = null)
 26      {
 27          $nodes = ['name' => $name];
 28          if (null !== $template) {
 29              $nodes['template'] = $template;
 30          }
 31   
 32          parent::__construct($nodes, ['is_defined_test' => false, 'output' => false], $lineno, $tag);
 33      }
 34   
 35      public function compile(Compiler $compiler)
 36      {
 37          if ($this->getAttribute('is_defined_test')) {
 38              $this->compileTemplateCall($compiler, 'hasBlock');
 39          } else {
 40              if ($this->getAttribute('output')) {
 41                  $compiler->addDebugInfo($this);
 42   
 43                  $this
 44                      ->compileTemplateCall($compiler, 'displayBlock')
 45                      ->raw(";\n");
 46              } else {
 47                  $this->compileTemplateCall($compiler, 'renderBlock');
 48              }
 49          }
 50      }
 51   
 52      private function compileTemplateCall(Compiler $compiler, string $method): Compiler
 53      {
 54          if (!$this->hasNode('template')) {
 55              $compiler->write('$this');
 56          } else {
 57              $compiler
 58                  ->write('$this->loadTemplate(')
 59                  ->subcompile($this->getNode('template'))
 60                  ->raw(', ')
 61                  ->repr($this->getTemplateName())
 62                  ->raw(', ')
 63                  ->repr($this->getTemplateLine())
 64                  ->raw(')')
 65              ;
 66          }
 67   
 68          $compiler->raw(sprintf('->%s', $method));
 69   
 70          return $this->compileBlockArguments($compiler);
 71      }
 72   
 73      private function compileBlockArguments(Compiler $compiler): Compiler
 74      {
 75          $compiler
 76              ->raw('(')
 77              ->subcompile($this->getNode('name'))
 78              ->raw(', $context');
 79   
 80          if (!$this->hasNode('template')) {
 81              $compiler->raw(', $blocks');
 82          }
 83   
 84          return $compiler->raw(')');
 85      }
 86  }
 87   
 88  class_alias('Twig\Node\Expression\BlockReferenceExpression', 'Twig_Node_Expression_BlockReference');
 89