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

Macro.php

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


 01  <?php
 02   
 03  /*
 04   * This file is part of Twig.
 05   *
 06   * (c) 2009 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   * Defines a macro.
 14   *
 15   * <pre>
 16   * {% macro input(name, value, type, size) %}
 17   *    <input type="{{ type|default('text') }}" name="{{ name }}" value="{{ value|e }}" size="{{ size|default(20) }}" />
 18   * {% endmacro %}
 19   * </pre>
 20   */
 21  class Twig_TokenParser_Macro extends Twig_TokenParser
 22  {
 23      public function parse(Twig_Token $token)
 24      {
 25          $lineno = $token->getLine();
 26          $stream = $this->parser->getStream();
 27          $name = $stream->expect(Twig_Token::NAME_TYPE)->getValue();
 28   
 29          $arguments = $this->parser->getExpressionParser()->parseArguments(true, true);
 30   
 31          $stream->expect(Twig_Token::BLOCK_END_TYPE);
 32          $this->parser->pushLocalScope();
 33          $body = $this->parser->subparse(array($this, 'decideBlockEnd'), true);
 34          if ($token = $stream->nextIf(Twig_Token::NAME_TYPE)) {
 35              $value = $token->getValue();
 36   
 37              if ($value != $name) {
 38                  throw new Twig_Error_Syntax(sprintf('Expected endmacro for macro "%s" (but "%s" given).', $name, $value), $stream->getCurrent()->getLine(), $stream->getFilename());
 39              }
 40          }
 41          $this->parser->popLocalScope();
 42          $stream->expect(Twig_Token::BLOCK_END_TYPE);
 43   
 44          $this->parser->setMacro($name, new Twig_Node_Macro($name, new Twig_Node_Body(array($body)), $arguments, $lineno, $this->getTag()));
 45      }
 46   
 47      public function decideBlockEnd(Twig_Token $token)
 48      {
 49          return $token->test('endmacro');
 50      }
 51   
 52      public function getTag()
 53      {
 54          return 'macro';
 55      }
 56  }
 57