mirror of
https://github.com/phpbb/phpbb.git
synced 2025-06-11 22:08:54 +00:00
[ticket/14990] Fix event name, email parsing, installer and dispatcher calls
PHPBB3-14990
This commit is contained in:
parent
633bbc9c6d
commit
1ea114ca20
4 changed files with 25 additions and 17 deletions
|
@ -85,6 +85,7 @@ services:
|
||||||
- null
|
- null
|
||||||
- '@template.twig.loader'
|
- '@template.twig.loader'
|
||||||
- []
|
- []
|
||||||
|
- null
|
||||||
calls:
|
calls:
|
||||||
- [setLexer, ['@template.twig.lexer']]
|
- [setLexer, ['@template.twig.lexer']]
|
||||||
|
|
||||||
|
|
|
@ -656,7 +656,7 @@ class messenger
|
||||||
*/
|
*/
|
||||||
protected function setup_template()
|
protected function setup_template()
|
||||||
{
|
{
|
||||||
global $phpbb_container;
|
global $phpbb_container, $phpbb_dispatcher;
|
||||||
|
|
||||||
if ($this->template instanceof \phpbb\template\template)
|
if ($this->template instanceof \phpbb\template\template)
|
||||||
{
|
{
|
||||||
|
@ -671,7 +671,9 @@ class messenger
|
||||||
$phpbb_container->get('ext.manager'),
|
$phpbb_container->get('ext.manager'),
|
||||||
new \phpbb\template\twig\loader(
|
new \phpbb\template\twig\loader(
|
||||||
$phpbb_container->get('filesystem')
|
$phpbb_container->get('filesystem')
|
||||||
)
|
),
|
||||||
|
array(),
|
||||||
|
$phpbb_dispatcher
|
||||||
);
|
);
|
||||||
$template_environment->setLexer($phpbb_container->get('template.twig.lexer'));
|
$template_environment->setLexer($phpbb_container->get('template.twig.lexer'));
|
||||||
|
|
||||||
|
|
|
@ -32,9 +32,7 @@ class environment extends \Twig_Environment
|
||||||
/** @var \phpbb\extension\manager */
|
/** @var \phpbb\extension\manager */
|
||||||
protected $extension_manager;
|
protected $extension_manager;
|
||||||
|
|
||||||
/**
|
/** @var \phpbb\event\dispatcher_interface */
|
||||||
* @var \phpbb\event\dispatcher_interface
|
|
||||||
*/
|
|
||||||
protected $phpbb_dispatcher;
|
protected $phpbb_dispatcher;
|
||||||
|
|
||||||
/** @var string */
|
/** @var string */
|
||||||
|
@ -61,7 +59,7 @@ class environment extends \Twig_Environment
|
||||||
* @param array $options Array of options to pass to Twig
|
* @param array $options Array of options to pass to Twig
|
||||||
* @param \phpbb\event\dispatcher_interface $phpbb_dispatcher Event dispatcher object
|
* @param \phpbb\event\dispatcher_interface $phpbb_dispatcher Event dispatcher object
|
||||||
*/
|
*/
|
||||||
public function __construct(\phpbb\config\config $phpbb_config, \phpbb\filesystem\filesystem $filesystem, \phpbb\path_helper $path_helper, $cache_path, \phpbb\extension\manager $extension_manager = null, \Twig_LoaderInterface $loader = null, $options = array(), \phpbb\event\dispatcher_interface $phpbb_dispatcher = null)
|
public function __construct(\phpbb\config\config $phpbb_config, \phpbb\filesystem\filesystem $filesystem, \phpbb\path_helper $path_helper, $cache_path, \phpbb\extension\manager $extension_manager = null, \Twig_LoaderInterface $loader = null, $options = array(), \phpbb\event\dispatcher_interface $phpbb_dispatcher = null)
|
||||||
{
|
{
|
||||||
$this->phpbb_config = $phpbb_config;
|
$this->phpbb_config = $phpbb_config;
|
||||||
|
|
||||||
|
@ -213,26 +211,32 @@ class environment extends \Twig_Environment
|
||||||
* Allow changing the template output stream before rendering
|
* Allow changing the template output stream before rendering
|
||||||
*
|
*
|
||||||
* @event core.twig_environment_render_template_before
|
* @event core.twig_environment_render_template_before
|
||||||
* @var array $context Array with template variables
|
* @var array context Array with template variables
|
||||||
* @var string $name The template name
|
* @var string name The template name
|
||||||
* @since 3.2.1-RC1
|
* @since 3.2.1-RC1
|
||||||
*/
|
*/
|
||||||
$vars = array('context', 'name');
|
if ($this->phpbb_dispatcher)
|
||||||
extract($this->phpbb_dispatcher->trigger_event('core.twig_environment_render_template_before', compact($vars)));
|
{
|
||||||
|
$vars = array('context', 'name');
|
||||||
|
extract($this->phpbb_dispatcher->trigger_event('core.twig_environment_render_template_before', compact($vars)));
|
||||||
|
}
|
||||||
|
|
||||||
$output = parent::render($name, $context);
|
$output = parent::render($name, $context);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Allow changing the template output stream after rendering
|
* Allow changing the template output stream after rendering
|
||||||
*
|
*
|
||||||
* @event core.twig_environment_render_template_before
|
* @event core.twig_environment_render_template_after
|
||||||
* @var array $context Array with template variables
|
* @var array context Array with template variables
|
||||||
* @var string $name The template name
|
* @var string name The template name
|
||||||
* @var string $output Rendered template output stream
|
* @var string output Rendered template output stream
|
||||||
* @since 3.2.1-RC1
|
* @since 3.2.1-RC1
|
||||||
*/
|
*/
|
||||||
$vars = array('context', 'name', 'output');
|
if ($this->phpbb_dispatcher)
|
||||||
extract($this->phpbb_dispatcher->trigger_event('core.twig_environment_render_template_after', compact($vars)));
|
{
|
||||||
|
$vars = array('context', 'name', 'output');
|
||||||
|
extract($this->phpbb_dispatcher->trigger_event('core.twig_environment_render_template_after', compact($vars)));
|
||||||
|
}
|
||||||
|
|
||||||
return $this->inject_assets($output, $placeholder_salt);
|
return $this->inject_assets($output, $placeholder_salt);
|
||||||
}
|
}
|
||||||
|
|
|
@ -86,7 +86,8 @@ class phpbb_email_parsing_test extends phpbb_test_case
|
||||||
'debug' => false,
|
'debug' => false,
|
||||||
'auto_reload' => true,
|
'auto_reload' => true,
|
||||||
'autoescape' => false,
|
'autoescape' => false,
|
||||||
)
|
),
|
||||||
|
new \phpbb\event\dispatcher($phpbb_container)
|
||||||
);
|
);
|
||||||
$twig->addExtension($twig_extension);
|
$twig->addExtension($twig_extension);
|
||||||
$phpbb_container->set('template.twig.lexer', new \phpbb\template\twig\lexer($twig));
|
$phpbb_container->set('template.twig.lexer', new \phpbb\template\twig\lexer($twig));
|
||||||
|
|
Loading…
Add table
Reference in a new issue