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

IncludeNode.php

Zuletzt modifiziert: 01.05.2026, 11:27 - Dateigröße: 3.12 KiB


 001  <?php
 002   
 003  /*
 004   * This file is part of Twig.
 005   *
 006   * (c) Fabien Potencier
 007   * (c) Armin Ronacher
 008   *
 009   * For the full copyright and license information, please view the LICENSE
 010   * file that was distributed with this source code.
 011   */
 012   
 013  namespace Twig\Node;
 014   
 015  use Twig\Compiler;
 016  use Twig\Node\Expression\AbstractExpression;
 017   
 018  /**
 019   * Represents an include node.
 020   *
 021   * @author Fabien Potencier <fabien@symfony.com>
 022   */
 023  class IncludeNode extends Node implements NodeOutputInterface
 024  {
 025      public function __construct(AbstractExpression $expr, ?AbstractExpression $variables, bool $only, bool $ignoreMissing, int $lineno, string $tag = null)
 026      {
 027          $nodes = ['expr' => $expr];
 028          if (null !== $variables) {
 029              $nodes['variables'] = $variables;
 030          }
 031   
 032          parent::__construct($nodes, ['only' => (bool) $only, 'ignore_missing' => (bool) $ignoreMissing], $lineno, $tag);
 033      }
 034   
 035      public function compile(Compiler $compiler)
 036      {
 037          $compiler->addDebugInfo($this);
 038   
 039          if ($this->getAttribute('ignore_missing')) {
 040              $template = $compiler->getVarName();
 041   
 042              $compiler
 043                  ->write(sprintf("$%s = null;\n", $template))
 044                  ->write("try {\n")
 045                  ->indent()
 046                  ->write(sprintf('$%s = ', $template))
 047              ;
 048   
 049              $this->addGetTemplate($compiler);
 050   
 051              $compiler
 052                  ->raw(";\n")
 053                  ->outdent()
 054                  ->write("} catch (LoaderError \$e) {\n")
 055                  ->indent()
 056                  ->write("// ignore missing template\n")
 057                  ->outdent()
 058                  ->write("}\n")
 059                  ->write(sprintf("if ($%s) {\n", $template))
 060                  ->indent()
 061                  ->write(sprintf('$%s->display(', $template))
 062              ;
 063              $this->addTemplateArguments($compiler);
 064              $compiler
 065                  ->raw(");\n")
 066                  ->outdent()
 067                  ->write("}\n")
 068              ;
 069          } else {
 070              $this->addGetTemplate($compiler);
 071              $compiler->raw('->display(');
 072              $this->addTemplateArguments($compiler);
 073              $compiler->raw(");\n");
 074          }
 075      }
 076   
 077      protected function addGetTemplate(Compiler $compiler)
 078      {
 079          $compiler
 080              ->write('$this->loadTemplate(')
 081              ->subcompile($this->getNode('expr'))
 082              ->raw(', ')
 083              ->repr($this->getTemplateName())
 084              ->raw(', ')
 085              ->repr($this->getTemplateLine())
 086              ->raw(')')
 087          ;
 088      }
 089   
 090      protected function addTemplateArguments(Compiler $compiler)
 091      {
 092          if (!$this->hasNode('variables')) {
 093              $compiler->raw(false === $this->getAttribute('only') ? '$context' : '[]');
 094          } elseif (false === $this->getAttribute('only')) {
 095              $compiler
 096                  ->raw('twig_array_merge($context, ')
 097                  ->subcompile($this->getNode('variables'))
 098                  ->raw(')')
 099              ;
 100          } else {
 101              $compiler->raw('twig_to_array(');
 102              $compiler->subcompile($this->getNode('variables'));
 103              $compiler->raw(')');
 104          }
 105      }
 106  }
 107   
 108  class_alias('Twig\Node\IncludeNode', 'Twig_Node_Include');
 109