aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB/includes/template/twig/extension.php
blob: a607bac1506b5ec7cd57901e94bba742f23cab2c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
<?php
/**
*
* @package phpBB3
* @copyright (c) 2013 phpBB Group
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
*
*/

/**
* @ignore
*/
if (!defined('IN_PHPBB'))
{
	exit;
}

class phpbb_template_twig_extension extends Twig_Extension
{
	public function getName()
	{
		return 'phpbb';
	}

	public function getTokenParsers()
	{
		return array(
			new phpbb_template_twig_tokenparser_if,
			new phpbb_template_twig_tokenparser_include,
			new phpbb_template_twig_tokenparser_event,
			new phpbb_template_twig_tokenparser_begin,
			new phpbb_template_twig_tokenparser_define,
		);
	}

	public function getOperators()
	{
		return array(
			array(),
			array(
				'eq' => array('precedence' => 20, 'class' => 'Twig_Node_Expression_Binary_Equal', 'associativity' => Twig_ExpressionParser::OPERATOR_LEFT),
				//'and' => array('precedence' => 20, 'class' => 'Twig_Node_Expression_Binary_And', 'associativity' => Twig_ExpressionParser::OPERATOR_LEFT),
				'!==' => array('precedence' => 20, 'class' => 'Twig_Node_Expression_Binary_NotEqual', 'associativity' => Twig_ExpressionParser::OPERATOR_LEFT),
			),
		);
	}
}