diff --git a/acp/usu.php b/acp/usu.php index 8fe8138..e604cc1 100644 --- a/acp/usu.php +++ b/acp/usu.php @@ -41,6 +41,9 @@ class usu /** @var string */ protected $php_ext; + /** @var \phpbb\language\language */ + protected $language; + var $u_action; var $new_config = array(); var $dyn_select = array(); @@ -54,7 +57,7 @@ class usu function main($id, $mode) { - global $config, $db, $user, $template, $request; + global $config, $db, $user, $template, $request, $language; global $phpbb_root_path, $phpbb_admin_path, $phpEx; global $phpbb_container; @@ -66,6 +69,7 @@ function main($id, $mode) $this->user = $user; $this->phpbb_root_path = $phpbb_root_path; $this->php_ext = $phpEx; + $this->language = $language; $this->user->add_lang_ext('phpbbseo/usu', 'acp_usu'); @@ -137,7 +141,7 @@ function main($id, $mode) case 'settings': $display_vars['title'] = 'ACP_PHPBB_SEO_CLASS'; - $this->user->lang['ACP_PHPBB_SEO_CLASS_EXPLAIN'] = sprintf($this->user->lang['ACP_PHPBB_SEO_CLASS_EXPLAIN'], $this->modrtype_lang['ulink'], $this->modrtype_lang['uforumlink'], '


' . $this->user->lang['ACP_PHPBB_SEO_MODE'] . ' : ' . $this->modrtype_lang['link'] . ' - ( ' . $this->modrtype_lang['forumlink'] . ' )


'); + $this->language['ACP_PHPBB_SEO_CLASS_EXPLAIN'] = sprintf($this->language['ACP_PHPBB_SEO_CLASS_EXPLAIN'], $this->modrtype_lang['ulink'], $this->modrtype_lang['uforumlink'], '


' . $this->language['ACP_PHPBB_SEO_MODE'] . ' : ' . $this->modrtype_lang['link'] . ' - ( ' . $this->modrtype_lang['forumlink'] . ' )


'); $display_vars['vars'] = array(); $i = 2; $display_vars['vars']['legend1'] = 'ACP_PHPBB_SEO_CLASS'; @@ -225,7 +229,7 @@ function main($id, $mode) } $display_vars['title'] = 'ACP_FORUM_URL'; - $this->user->lang['ACP_FORUM_URL_EXPLAIN'] .= '


' . $this->user->lang['ACP_PHPBB_SEO_VERSION'] . ' : ' . $this->modrtype_lang['link'] . ' - ( ' . $this->modrtype_lang['forumlink'] . ' )


'; + $this->language['ACP_FORUM_URL_EXPLAIN'] = $this->user->lang['ACP_FORUM_URL_EXPLAIN'] . '


' . $this->user->lang['ACP_PHPBB_SEO_VERSION'] . ' : ' . $this->modrtype_lang['link'] . ' - ( ' . $this->modrtype_lang['forumlink'] . ' )


'; $display_vars['vars'] = array(); $display_vars['vars']['legend1'] = 'ACP_FORUM_URL'; @@ -320,7 +324,7 @@ function main($id, $mode) case 'server': $display_vars['title'] = 'ACP_REWRITE_CONF'; - $this->user->lang['ACP_REWRITE_CONF_EXPLAIN'] .= '


' . $this->user->lang['ACP_PHPBB_SEO_VERSION'] . ' : ' . $this->modrtype_lang['link'] . ' - ( ' . $this->modrtype_lang['forumlink'] . ' )

'; + $this->language['ACP_REWRITE_CONF_EXPLAIN'] = $this->language['ACP_REWRITE_CONF_EXPLAIN'] . '


' . $this->user->lang['ACP_PHPBB_SEO_VERSION'] . ' : ' . $this->modrtype_lang['link'] . ' - ( ' . $this->modrtype_lang['forumlink'] . ' )

'; $display_vars['vars'] = array(); $display_vars['vars']['legend1'] = 'ACP_REWRITE_CONF'; if ($this->core->seo_path['phpbb_script'] && !$this->core->seo_opt['virtual_root']) @@ -343,7 +347,7 @@ function main($id, $mode) } // Dirty yet simple templating - $this->user->lang['ACP_REWRITE_CONF_EXPLAIN'] .= $this->seo_server_conf(); + $this->language['ACP_REWRITE_CONF_EXPLAIN'] = $this->language['ACP_REWRITE_CONF_EXPLAIN'] . $this->seo_server_conf(); $this->template->assign_vars(array( 'S_SEO_HTACCESS' => 1, @@ -811,7 +815,7 @@ function main($id, $mode) $this->tpl_name = 'acp_board'; $this->page_title = $display_vars['title']; - $l_title_explain = $this->user->lang[$display_vars['title'] . '_EXPLAIN']; + $l_title_explain = $this->language[$display_vars['title'] . '_EXPLAIN']; if ($mode != 'extended') { diff --git a/config/services.yml b/config/services.yml index e0083f7..25c0d53 100644 --- a/config/services.yml +++ b/config/services.yml @@ -27,6 +27,7 @@ services: - @user - @request - @dbal.conn + - @language - %core.root_path% - %core.php_ext% tags: diff --git a/event/listener.php b/event/listener.php index cb52092..6aa355c 100644 --- a/event/listener.php +++ b/event/listener.php @@ -41,6 +41,9 @@ class listener implements EventSubscriberInterface /* @var \phpbb\db\driver\driver_interface */ private $db; + /** @var \phpbb\language\language */ + private $language; + /** * Current $phpbb_root_path * @var string @@ -77,7 +80,7 @@ class listener implements EventSubscriberInterface * @param string $php_ext PHP file extension * */ - public function __construct(\phpbbseo\usu\core $core, \phpbb\config\config $config, \phpbb\auth\auth $auth, \phpbb\template\template $template, \phpbb\user $user, \phpbb\request\request $request, \phpbb\db\driver\driver_interface $db, $phpbb_root_path, $php_ext) + public function __construct(\phpbbseo\usu\core $core, \phpbb\config\config $config, \phpbb\auth\auth $auth, \phpbb\template\template $template, \phpbb\user $user, \phpbb\request\request $request, \phpbb\db\driver\driver_interface $db, \phpbb\language\language $language, $phpbb_root_path, $php_ext) { $this->core = $core; $this->template = $template; @@ -86,6 +89,7 @@ public function __construct(\phpbbseo\usu\core $core, \phpbb\config\config $conf $this->auth = $auth; $this->request = $request; $this->db = $db; + $this->language = $language; $this->phpbb_root_path = $phpbb_root_path; $this->php_ext = $php_ext; } @@ -558,7 +562,7 @@ public function core_page_footer($event) $output = '' . $this->core->seo_opt['copyrights']['txt'] . ''; } - $this->user->lang['TRANSLATION_INFO'] = (!empty($this->user->lang['TRANSLATION_INFO']) ? $this->user->lang['TRANSLATION_INFO'] . '
' : '') . $output; + $this->language->lang('TRANSLATION_INFO', (!empty($this->user->lang['TRANSLATION_INFO']) ? $this->user->lang['TRANSLATION_INFO'] . '
' : '') . $output); $this->template->assign_vars(array( 'U_CANONICAL' => $this->core->get_canonical(),