mirror of
https://github.com/phpbb/phpbb.git
synced 2025-06-28 06:08:52 +00:00
[feature/twig] Remove resource locator dependency from template
PHPBB3-11598
This commit is contained in:
parent
2d9bbe0ef2
commit
bdc05b7dc8
10 changed files with 8 additions and 12 deletions
|
@ -260,7 +260,6 @@ services:
|
||||||
- %core.php_ext%
|
- %core.php_ext%
|
||||||
- @config
|
- @config
|
||||||
- @user
|
- @user
|
||||||
- @style.resource_locator
|
|
||||||
- @template_context
|
- @template_context
|
||||||
- @ext.manager
|
- @ext.manager
|
||||||
|
|
||||||
|
|
|
@ -134,7 +134,7 @@ class bbcode
|
||||||
|
|
||||||
$style_resource_locator = new phpbb_style_resource_locator();
|
$style_resource_locator = new phpbb_style_resource_locator();
|
||||||
$style_path_provider = new phpbb_style_extension_path_provider($phpbb_extension_manager, new phpbb_style_path_provider(), $phpbb_root_path);
|
$style_path_provider = new phpbb_style_extension_path_provider($phpbb_extension_manager, new phpbb_style_path_provider(), $phpbb_root_path);
|
||||||
$template = new phpbb_template_twig($phpbb_root_path, $phpEx, $config, $user, $style_resource_locator, new phpbb_template_context(), $phpbb_extension_manager);
|
$template = new phpbb_template_twig($phpbb_root_path, $phpEx, $config, $user, new phpbb_template_context(), $phpbb_extension_manager);
|
||||||
$style = new phpbb_style($phpbb_root_path, $phpEx, $config, $user, $style_resource_locator, $style_path_provider, $template);
|
$style = new phpbb_style($phpbb_root_path, $phpEx, $config, $user, $style_resource_locator, $style_path_provider, $template);
|
||||||
$style->set_style();
|
$style->set_style();
|
||||||
$template->set_filenames(array('bbcode.html' => 'bbcode.html'));
|
$template->set_filenames(array('bbcode.html' => 'bbcode.html'));
|
||||||
|
|
|
@ -228,7 +228,7 @@ class messenger
|
||||||
{
|
{
|
||||||
$style_resource_locator = new phpbb_style_resource_locator();
|
$style_resource_locator = new phpbb_style_resource_locator();
|
||||||
$style_path_provider = new phpbb_style_extension_path_provider($phpbb_extension_manager, new phpbb_style_path_provider(), $phpbb_root_path);
|
$style_path_provider = new phpbb_style_extension_path_provider($phpbb_extension_manager, new phpbb_style_path_provider(), $phpbb_root_path);
|
||||||
$tpl = new phpbb_template_twig($phpbb_root_path, $phpEx, $config, $user, $style_resource_locator, new phpbb_template_context(), $phpbb_extension_manager);
|
$tpl = new phpbb_template_twig($phpbb_root_path, $phpEx, $config, $user, new phpbb_template_context(), $phpbb_extension_manager);
|
||||||
$style = new phpbb_style($phpbb_root_path, $phpEx, $config, $user, $style_resource_locator, $style_path_provider, $tpl);
|
$style = new phpbb_style($phpbb_root_path, $phpEx, $config, $user, $style_resource_locator, $style_path_provider, $tpl);
|
||||||
|
|
||||||
$this->tpl_msg[$template_lang . $template_file] = $tpl;
|
$this->tpl_msg[$template_lang . $template_file] = $tpl;
|
||||||
|
|
|
@ -96,11 +96,10 @@ class phpbb_template_twig implements phpbb_template
|
||||||
*
|
*
|
||||||
* @param string $phpbb_root_path phpBB root path
|
* @param string $phpbb_root_path phpBB root path
|
||||||
* @param user $user current user
|
* @param user $user current user
|
||||||
* @param phpbb_template_locator $locator template locator
|
|
||||||
* @param phpbb_template_context $context template context
|
* @param phpbb_template_context $context template context
|
||||||
* @param phpbb_extension_manager $extension_manager extension manager, if null then template events will not be invoked
|
* @param phpbb_extension_manager $extension_manager extension manager, if null then template events will not be invoked
|
||||||
*/
|
*/
|
||||||
public function __construct($phpbb_root_path, $php_ext, $config, $user, phpbb_template_locator $locator, phpbb_template_context $context, phpbb_extension_manager $extension_manager = null)
|
public function __construct($phpbb_root_path, $php_ext, $config, $user, phpbb_template_context $context, phpbb_extension_manager $extension_manager = null)
|
||||||
{
|
{
|
||||||
$this->phpbb_root_path = $phpbb_root_path;
|
$this->phpbb_root_path = $phpbb_root_path;
|
||||||
$this->php_ext = $php_ext;
|
$this->php_ext = $php_ext;
|
||||||
|
|
|
@ -214,7 +214,7 @@ $config = new phpbb_config(array(
|
||||||
|
|
||||||
$phpbb_style_resource_locator = new phpbb_style_resource_locator();
|
$phpbb_style_resource_locator = new phpbb_style_resource_locator();
|
||||||
$phpbb_style_path_provider = new phpbb_style_path_provider();
|
$phpbb_style_path_provider = new phpbb_style_path_provider();
|
||||||
$template = new phpbb_template_twig($phpbb_root_path, $phpEx, $config, $user, $phpbb_style_resource_locator, new phpbb_template_context());
|
$template = new phpbb_template_twig($phpbb_root_path, $phpEx, $config, $user, new phpbb_template_context());
|
||||||
$phpbb_style = new phpbb_style($phpbb_root_path, $phpEx, $config, $user, $phpbb_style_resource_locator, $phpbb_style_path_provider, $template);
|
$phpbb_style = new phpbb_style($phpbb_root_path, $phpEx, $config, $user, $phpbb_style_resource_locator, $phpbb_style_path_provider, $template);
|
||||||
$phpbb_style->set_ext_dir_prefix('adm/');
|
$phpbb_style->set_ext_dir_prefix('adm/');
|
||||||
$phpbb_style->set_custom_style('admin', $phpbb_admin_path . 'style', array(), '');
|
$phpbb_style->set_custom_style('admin', $phpbb_admin_path . 'style', array(), '');
|
||||||
|
|
|
@ -50,10 +50,9 @@ class phpbb_controller_helper_url_test extends phpbb_test_case
|
||||||
$phpbb_dispatcher = new phpbb_mock_event_dispatcher;
|
$phpbb_dispatcher = new phpbb_mock_event_dispatcher;
|
||||||
$this->style_resource_locator = new phpbb_style_resource_locator();
|
$this->style_resource_locator = new phpbb_style_resource_locator();
|
||||||
$this->user = $this->getMock('phpbb_user');
|
$this->user = $this->getMock('phpbb_user');
|
||||||
$this->template = new phpbb_template_twig($phpbb_root_path, $phpEx, $config, $this->user, $this->style_resource_locator, new phpbb_template_context());
|
$this->template = new phpbb_template_twig($phpbb_root_path, $phpEx, $config, $this->user, new phpbb_template_context());
|
||||||
|
|
||||||
$helper = new phpbb_controller_helper($this->template, $this->user, '', 'php');
|
$helper = new phpbb_controller_helper($this->template, $this->user, '', 'php');
|
||||||
$this->assertEquals($helper->url($route, $params, $is_amp, $session_id), $expected);
|
$this->assertEquals($helper->url($route, $params, $is_amp, $session_id), $expected);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -47,7 +47,6 @@ class phpbb_extension_metadata_manager_test extends phpbb_database_test_case
|
||||||
$this->phpEx,
|
$this->phpEx,
|
||||||
$this->config,
|
$this->config,
|
||||||
$this->user,
|
$this->user,
|
||||||
new phpbb_style_resource_locator(),
|
|
||||||
new phpbb_template_context()
|
new phpbb_template_context()
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
|
@ -107,7 +107,7 @@ Zeta test event in all',
|
||||||
$this->extension_manager = new phpbb_mock_filesystem_extension_manager(
|
$this->extension_manager = new phpbb_mock_filesystem_extension_manager(
|
||||||
dirname(__FILE__) . "/datasets/$dataset/"
|
dirname(__FILE__) . "/datasets/$dataset/"
|
||||||
);
|
);
|
||||||
$this->template = new phpbb_template_twig($phpbb_root_path, $phpEx, $config, $user, $this->style_resource_locator, new phpbb_template_context, $this->extension_manager);
|
$this->template = new phpbb_template_twig($phpbb_root_path, $phpEx, $config, $user, new phpbb_template_context, $this->extension_manager);
|
||||||
$this->style_provider = new phpbb_style_path_provider();
|
$this->style_provider = new phpbb_style_path_provider();
|
||||||
$this->style = new phpbb_style($phpbb_root_path, $phpEx, $config, $user, $this->style_resource_locator, $this->style_provider, $this->template);
|
$this->style = new phpbb_style($phpbb_root_path, $phpEx, $config, $user, $this->style_resource_locator, $this->style_provider, $this->template);
|
||||||
$this->style->set_custom_style('silver', array($this->template_path), $style_names, '');
|
$this->style->set_custom_style('silver', array($this->template_path), $style_names, '');
|
||||||
|
|
|
@ -69,7 +69,7 @@ class phpbb_template_template_test_case extends phpbb_test_case
|
||||||
$this->template_path = $this->test_path . '/templates';
|
$this->template_path = $this->test_path . '/templates';
|
||||||
$this->style_resource_locator = new phpbb_style_resource_locator();
|
$this->style_resource_locator = new phpbb_style_resource_locator();
|
||||||
$this->style_provider = new phpbb_style_path_provider();
|
$this->style_provider = new phpbb_style_path_provider();
|
||||||
$this->template = new phpbb_template_twig($phpbb_root_path, $phpEx, $config, $this->user, $this->style_resource_locator, new phpbb_template_context());
|
$this->template = new phpbb_template_twig($phpbb_root_path, $phpEx, $config, $this->user, new phpbb_template_context());
|
||||||
$this->style = new phpbb_style($phpbb_root_path, $phpEx, $config, $this->user, $this->style_resource_locator, $this->style_provider, $this->template);
|
$this->style = new phpbb_style($phpbb_root_path, $phpEx, $config, $this->user, $this->style_resource_locator, $this->style_provider, $this->template);
|
||||||
$this->style->set_custom_style('tests', $this->template_path, array(), '');
|
$this->style->set_custom_style('tests', $this->template_path, array(), '');
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,7 +22,7 @@ class phpbb_template_template_test_case_with_tree extends phpbb_template_templat
|
||||||
$this->parent_template_path = $this->test_path . '/parent_templates';
|
$this->parent_template_path = $this->test_path . '/parent_templates';
|
||||||
$this->style_resource_locator = new phpbb_style_resource_locator();
|
$this->style_resource_locator = new phpbb_style_resource_locator();
|
||||||
$this->style_provider = new phpbb_style_path_provider();
|
$this->style_provider = new phpbb_style_path_provider();
|
||||||
$this->template = new phpbb_template_twig($phpbb_root_path, $phpEx, $config, $user, $this->style_resource_locator, new phpbb_template_context());
|
$this->template = new phpbb_template_twig($phpbb_root_path, $phpEx, $config, $user, new phpbb_template_context());
|
||||||
$this->style = new phpbb_style($phpbb_root_path, $phpEx, $config, $user, $this->style_resource_locator, $this->style_provider, $this->template);
|
$this->style = new phpbb_style($phpbb_root_path, $phpEx, $config, $user, $this->style_resource_locator, $this->style_provider, $this->template);
|
||||||
$this->style->set_custom_style('tests', array($this->template_path, $this->parent_template_path), array(), '');
|
$this->style->set_custom_style('tests', array($this->template_path, $this->parent_template_path), array(), '');
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue