Verzeichnisstruktur phpBB-3.1.0
- Veröffentlicht
- 27.10.2014
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 |
defineparser.php
01 <?php
02 /**
03 *
04 * This file is part of the phpBB Forum Software package.
05 *
06 * @copyright (c) phpBB Limited <https://www.phpbb.com>
07 * @copyright Portions (c) 2009 Fabien Potencier, Armin Ronacher
08 * @license GNU General Public License, version 2 (GPL-2.0)
09 *
10 * For full copyright and license information, please see
11 * the docs/CREDITS.txt file.
12 *
13 */
14
15 namespace phpbb\template\twig\tokenparser;
16
17
18 class defineparser extends \Twig_TokenParser
19 {
20 /**
21 * Parses a token and returns a node.
22 *
23 * @param \Twig_Token $token A Twig_Token instance
24 *
25 * @return \Twig_NodeInterface A Twig_NodeInterface instance
26 * @throws \Twig_Error_Syntax
27 * @throws \phpbb\template\twig\node\definenode
28 */
29 public function parse(\Twig_Token $token)
30 {
31 $lineno = $token->getLine();
32 $stream = $this->parser->getStream();
33 $name = $this->parser->getExpressionParser()->parseExpression();
34
35 $capture = false;
36 if ($stream->test(\Twig_Token::OPERATOR_TYPE, '=')) {
37 $stream->next();
38 $value = $this->parser->getExpressionParser()->parseExpression();
39
40 if ($value instanceof \Twig_Node_Expression_Name)
41 {
42 // This would happen if someone improperly formed their DEFINE syntax
43 // e.g. <!-- DEFINE $VAR = foo -->
44 throw new \Twig_Error_Syntax('Invalid DEFINE', $token->getLine(), $this->parser->getFilename());
45 }
46
47 $stream->expect(\Twig_Token::BLOCK_END_TYPE);
48 } else {
49 $capture = true;
50
51 $stream->expect(\Twig_Token::BLOCK_END_TYPE);
52
53 $value = $this->parser->subparse(array($this, 'decideBlockEnd'), true);
54 $stream->expect(\Twig_Token::BLOCK_END_TYPE);
55 }
56
57 return new \phpbb\template\twig\node\definenode($capture, $name, $value, $lineno, $this->getTag());
58 }
59
60 public function decideBlockEnd(\Twig_Token $token)
61 {
62 return $token->test('ENDDEFINE');
63 }
64
65 /**
66 * Gets the tag name associated with this token parser.
67 *
68 * @return string The tag name
69 */
70 public function getTag()
71 {
72 return 'DEFINE';
73 }
74 }
75