From ea785efb30ced6ab399b290df6f202cb97315f80 Mon Sep 17 00:00:00 2001 From: Nathaniel Guse Date: Tue, 25 Jun 2013 14:22:40 -0500 Subject: [feature/twig] PHP token support PHPBB3-11598 --- phpBB/includes/template/twig/tokenparser/php.php | 46 ++++++++++++++++++++++++ 1 file changed, 46 insertions(+) create mode 100644 phpBB/includes/template/twig/tokenparser/php.php (limited to 'phpBB/includes/template/twig/tokenparser/php.php') diff --git a/phpBB/includes/template/twig/tokenparser/php.php b/phpBB/includes/template/twig/tokenparser/php.php new file mode 100644 index 0000000000..7db57081e2 --- /dev/null +++ b/phpBB/includes/template/twig/tokenparser/php.php @@ -0,0 +1,46 @@ +parser->getStream(); + + $stream->expect(Twig_Token::BLOCK_END_TYPE); + + $body = $this->parser->subparse(array($this, 'decideEnd'), true); + + $stream->expect(Twig_Token::BLOCK_END_TYPE); + + return new phpbb_template_twig_node_php($body, $this->parser->getEnvironment(), $token->getLine(), $this->getTag()); + } + + public function decideEnd(Twig_Token $token) + { + return $token->test('ENDPHP'); + } + + /** + * Gets the tag name associated with this token parser. + * + * @return string The tag name + */ + public function getTag() + { + return 'PHP'; + } +} -- cgit v1.2.1