Verzeichnisstruktur phpBB-3.2.0


Veröffentlicht
06.01.2017

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

Use.php

Zuletzt modifiziert: 09.10.2024, 12:58 - Dateigröße: 1.78 KiB


01  <?php
02   
03  /*
04   * This file is part of Twig.
05   *
06   * (c) 2011 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  /**
13   * Imports blocks defined in another template into the current template.
14   *
15   * <pre>
16   * {% extends "base.html" %}
17   *
18   * {% use "blocks.html" %}
19   *
20   * {% block title %}{% endblock %}
21   * {% block content %}{% endblock %}
22   * </pre>
23   *
24   * @see http://www.twig-project.org/doc/templates.html#horizontal-reuse for details.
25   */
26  class Twig_TokenParser_Use extends Twig_TokenParser
27  {
28      public function parse(Twig_Token $token)
29      {
30          $template = $this->parser->getExpressionParser()->parseExpression();
31          $stream = $this->parser->getStream();
32   
33          if (!$template instanceof Twig_Node_Expression_Constant) {
34              throw new Twig_Error_Syntax('The template references in a "use" statement must be a string.', $stream->getCurrent()->getLine(), $stream->getFilename());
35          }
36   
37          $targets = array();
38          if ($stream->nextIf('with')) {
39              do {
40                  $name = $stream->expect(Twig_Token::NAME_TYPE)->getValue();
41   
42                  $alias = $name;
43                  if ($stream->nextIf('as')) {
44                      $alias = $stream->expect(Twig_Token::NAME_TYPE)->getValue();
45                  }
46   
47                  $targets[$name] = new Twig_Node_Expression_Constant($alias, -1);
48   
49                  if (!$stream->nextIf(Twig_Token::PUNCTUATION_TYPE, ',')) {
50                      break;
51                  }
52              } while (true);
53          }
54   
55          $stream->expect(Twig_Token::BLOCK_END_TYPE);
56   
57          $this->parser->addTrait(new Twig_Node(array('template' => $template, 'targets' => new Twig_Node($targets))));
58      }
59   
60      public function getTag()
61      {
62          return 'use';
63      }
64  }
65