phpBB

Code Changes

File: phpbb/template/twig/extension.php

  Unmodified   Added   Modified   Removed
Line 18Line 18
	/** @var \phpbb\template\context */
protected $context;


	/** @var \phpbb\template\context */
protected $context;


	/** @var \phpbb\user */
protected $user;

	/** @var \phpbb\language\language */
protected $language;


/**
* Constructor
*
* @param \phpbb\template\context $context


/**
* Constructor
*
* @param \phpbb\template\context $context

	* @param \phpbb\user $user

	* @param \phpbb\language\language $language

	* @return \phpbb\template\twig\extension
*/

	* @return \phpbb\template\twig\extension
*/

	public function __construct(\phpbb\template\context $context, $user)

	public function __construct(\phpbb\template\context $context, $language)

	{
$this->context = $context;

	{
$this->context = $context;

		$this->user = $user;

		$this->language = $language;

	}

/**

	}

/**

Line 71Line 71
	{
return array(
new \Twig_SimpleFilter('subset', array($this, 'loop_subset'), array('needs_environment' => true)),

	{
return array(
new \Twig_SimpleFilter('subset', array($this, 'loop_subset'), array('needs_environment' => true)),

 
			// @deprecated 3.2.0 Uses twig's JS escape method instead of addslashes

			new \Twig_SimpleFilter('addslashes', 'addslashes'),
);
}

			new \Twig_SimpleFilter('addslashes', 'addslashes'),
);
}

Line 169Line 170
		$args = func_get_args();
$key = $args[0];


		$args = func_get_args();
$key = $args[0];


		$context = $this->context->get_data_ref();
$context_vars = $context['.'][0];

		$context_vars = $this->context->get_root_ref();



if (isset($context_vars['L_' . $key]))
{
return $context_vars['L_' . $key];
}



if (isset($context_vars['L_' . $key]))
{
return $context_vars['L_' . $key];
}


		// LA_ is transformed into lang(\'$1\')|addslashes, so we should not

		// LA_ is transformed into lang(\'$1\')|escape('js'), so we should not

		// need to check for it


		// need to check for it


		return call_user_func_array(array($this->user, 'lang'), $args);

		return call_user_func_array(array($this->language, 'lang'), $args);

	}
}


	}
}