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. |
|
(Beispiel Datei-Icons)
|
Auf das Icon klicken um den Quellcode anzuzeigen |
ApplyTokenParser.php
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\Node\Expression\TempNameExpression;
15 use Twig\Node\Node;
16 use Twig\Node\PrintNode;
17 use Twig\Node\SetNode;
18 use Twig\Token;
19
20 /**
21 * Applies filters on a section of a template.
22 *
23 * {% apply upper %}
24 * This text becomes uppercase
25 * {% endapply %}
26 */
27 final class ApplyTokenParser extends AbstractTokenParser
28 {
29 public function parse(Token $token)
30 {
31 $lineno = $token->getLine();
32 $name = $this->parser->getVarName();
33
34 $ref = new TempNameExpression($name, $lineno);
35 $ref->setAttribute('always_defined', true);
36
37 $filter = $this->parser->getExpressionParser()->parseFilterExpressionRaw($ref, $this->getTag());
38
39 $this->parser->getStream()->expect(Token::BLOCK_END_TYPE);
40 $body = $this->parser->subparse([$this, 'decideApplyEnd'], true);
41 $this->parser->getStream()->expect(Token::BLOCK_END_TYPE);
42
43 return new Node([
44 new SetNode(true, $ref, $body, $lineno, $this->getTag()),
45 new PrintNode($filter, $lineno, $this->getTag()),
46 ]);
47 }
48
49 public function decideApplyEnd(Token $token)
50 {
51 return $token->test('endapply');
52 }
53
54 public function getTag()
55 {
56 return 'apply';
57 }
58 }
59