phpBB

Code Changes

File: phpbb/template/twig/extension.php

  Unmodified   Added   Modified   Removed
Line 12Line 12
*/

namespace phpbb\template\twig;

*/

namespace phpbb\template\twig;

 

use Twig\Error\RuntimeError;


class extension extends \Twig\Extension\AbstractExtension
{


class extension extends \Twig\Extension\AbstractExtension
{

Line 77Line 79
			new \Twig\TwigFilter('subset', array($this, 'loop_subset'), array('needs_environment' => true)),
// @deprecated 3.2.0 Uses twig's JS escape method instead of addslashes
new \Twig\TwigFilter('addslashes', 'addslashes'),

			new \Twig\TwigFilter('subset', array($this, 'loop_subset'), array('needs_environment' => true)),
// @deprecated 3.2.0 Uses twig's JS escape method instead of addslashes
new \Twig\TwigFilter('addslashes', 'addslashes'),

 
			new \Twig\TwigFilter('int', 'intval'),
new \Twig\TwigFilter('float', 'floatval'),

		);
}


		);
}


Line 90Line 94
		return array(
new \Twig\TwigFunction('lang', array($this, 'lang')),
new \Twig\TwigFunction('lang_defined', array($this, 'lang_defined')),

		return array(
new \Twig\TwigFunction('lang', array($this, 'lang')),
new \Twig\TwigFunction('lang_defined', array($this, 'lang_defined')),

 
			new \Twig\TwigFunction('lang_js', [$this, 'lang_js']),

			new \Twig\TwigFunction('get_class', 'get_class'),
);
}

			new \Twig\TwigFunction('get_class', 'get_class'),
);
}

Line 197Line 202
	public function lang_defined($key)
{
return call_user_func_array([$this->language, 'is_set'], [$key]);

	public function lang_defined($key)
{
return call_user_func_array([$this->language, 'is_set'], [$key]);

 
	}

/**
* Get output for language variable in JS code
*
* @throws RuntimeError When data passed to twig_escape_filter is not a UTF8 string
*/
public function lang_js(): string
{
$args = func_get_args();

return twig_escape_filter($this->environment, call_user_func_array([$this, 'lang'], $args), 'js');

	}
}


	}
}