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

SandboxTokenParser.php

Zuletzt modifiziert: 02.04.2025, 15:03 - Dateigröße: 1.79 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\TokenParser;
13   
14  use Twig\Error\SyntaxError;
15  use Twig\Node\IncludeNode;
16  use Twig\Node\SandboxNode;
17  use Twig\Node\TextNode;
18  use Twig\Token;
19   
20  /**
21   * Marks a section of a template as untrusted code that must be evaluated in the sandbox mode.
22   *
23   *    {% sandbox %}
24   *        {% include 'user.html' %}
25   *    {% endsandbox %}
26   *
27   * @see https://twig.symfony.com/doc/api.html#sandbox-extension for details
28   */
29  final class SandboxTokenParser extends AbstractTokenParser
30  {
31      public function parse(Token $token)
32      {
33          $stream = $this->parser->getStream();
34          $stream->expect(/* Token::BLOCK_END_TYPE */ 3);
35          $body = $this->parser->subparse([$this, 'decideBlockEnd'], true);
36          $stream->expect(/* Token::BLOCK_END_TYPE */ 3);
37   
38          // in a sandbox tag, only include tags are allowed
39          if (!$body instanceof IncludeNode) {
40              foreach ($body as $node) {
41                  if ($node instanceof TextNode && ctype_space($node->getAttribute('data'))) {
42                      continue;
43                  }
44   
45                  if (!$node instanceof IncludeNode) {
46                      throw new SyntaxError('Only "include" tags are allowed within a "sandbox" section.', $node->getTemplateLine(), $stream->getSourceContext());
47                  }
48              }
49          }
50   
51          return new SandboxNode($body, $token->getLine(), $this->getTag());
52      }
53   
54      public function decideBlockEnd(Token $token)
55      {
56          return $token->test('endsandbox');
57      }
58   
59      public function getTag()
60      {
61          return 'sandbox';
62      }
63  }
64   
65  class_alias('Twig\TokenParser\SandboxTokenParser', 'Twig_TokenParser_Sandbox');
66