Verzeichnisstruktur phpBB-3.3.15


Veröffentlicht
28.08.2024

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

DefaultFilter.php

Zuletzt modifiziert: 02.04.2025, 15:04 - Dateigröße: 1.84 KiB


01  <?php
02   
03  /*
04   * This file is part of Twig.
05   *
06   * (c) Fabien Potencier
07   *
08   * For the full copyright and license information, please view the LICENSE
09   * file that was distributed with this source code.
10   */
11   
12  namespace Twig\Node\Expression\Filter;
13   
14  use Twig\Compiler;
15  use Twig\Node\Expression\ConditionalExpression;
16  use Twig\Node\Expression\ConstantExpression;
17  use Twig\Node\Expression\FilterExpression;
18  use Twig\Node\Expression\GetAttrExpression;
19  use Twig\Node\Expression\NameExpression;
20  use Twig\Node\Expression\Test\DefinedTest;
21  use Twig\Node\Node;
22   
23  /**
24   * Returns the value or the default value when it is undefined or empty.
25   *
26   *  {{ var.foo|default('foo item on var is not defined') }}
27   *
28   * @author Fabien Potencier <fabien@symfony.com>
29   */
30  class DefaultFilter extends FilterExpression
31  {
32      public function __construct(Node $node, ConstantExpression $filterName, Node $arguments, int $lineno, string $tag = null)
33      {
34          $default = new FilterExpression($node, new ConstantExpression('default', $node->getTemplateLine()), $arguments, $node->getTemplateLine());
35   
36          if ('default' === $filterName->getAttribute('value') && ($node instanceof NameExpression || $node instanceof GetAttrExpression)) {
37              $test = new DefinedTest(clone $node, 'defined', new Node(), $node->getTemplateLine());
38              $false = \count($arguments) ? $arguments->getNode(0) : new ConstantExpression('', $node->getTemplateLine());
39   
40              $node = new ConditionalExpression($test, $default, $false, $node->getTemplateLine());
41          } else {
42              $node = $default;
43          }
44   
45          parent::__construct($node, $filterName, $arguments, $lineno, $tag);
46      }
47   
48      public function compile(Compiler $compiler)
49      {
50          $compiler->subcompile($this->getNode('node'));
51      }
52  }
53   
54  class_alias('Twig\Node\Expression\Filter\DefaultFilter', 'Twig_Node_Expression_Filter_Default');
55