1
0
mirror of https://github.com/phpbb/phpbb.git synced 2025-07-30 21:40:43 +02:00

[ticket/13762] Moving language related functionality into a separate class

PHPBB3-13762
This commit is contained in:
MateBartus
2015-04-14 02:31:23 +02:00
parent 2f480be02d
commit 179a470022
67 changed files with 1663 additions and 679 deletions

View File

@@ -76,7 +76,7 @@ class acp_extensions
{
$md_manager->get_metadata('all');
}
catch(\phpbb\extension\exception $e)
catch (\phpbb\extension\exception $e)
{
$message = call_user_func_array(array($this->user, 'lang'), array_merge(array($e->getMessage()), $e->get_parameters()));
trigger_error($message, E_USER_WARNING);
@@ -353,7 +353,7 @@ class acp_extensions
$enabled_extension_meta_data[$name]['S_VERSIONCHECK'] = true;
$enabled_extension_meta_data[$name]['U_VERSIONCHECK_FORCE'] = $this->u_action . '&action=details&versioncheck_force=1&ext_name=' . urlencode($md_manager->get_metadata('name'));
}
catch(\phpbb\extension\exception $e)
catch (\phpbb\extension\exception $e)
{
$message = call_user_func_array(array($this->user, 'lang'), array_merge(array($e->getMessage()), $e->get_parameters()));
$this->template->assign_block_vars('disabled', array(
@@ -410,7 +410,7 @@ class acp_extensions
$disabled_extension_meta_data[$name]['S_VERSIONCHECK'] = true;
$disabled_extension_meta_data[$name]['U_VERSIONCHECK_FORCE'] = $this->u_action . '&action=details&versioncheck_force=1&ext_name=' . urlencode($md_manager->get_metadata('name'));
}
catch(\phpbb\extension\exception $e)
catch (\phpbb\extension\exception $e)
{
$message = call_user_func_array(array($this->user, 'lang'), array_merge(array($e->getMessage()), $e->get_parameters()));
$this->template->assign_block_vars('disabled', array(
@@ -470,7 +470,7 @@ class acp_extensions
$available_extension_meta_data[$name]['S_VERSIONCHECK'] = true;
$available_extension_meta_data[$name]['U_VERSIONCHECK_FORCE'] = $this->u_action . '&action=details&versioncheck_force=1&ext_name=' . urlencode($md_manager->get_metadata('name'));
}
catch(\phpbb\extension\exception $e)
catch (\phpbb\extension\exception $e)
{
$message = call_user_func_array(array($this->user, 'lang'), array_merge(array($e->getMessage()), $e->get_parameters()));
$this->template->assign_block_vars('disabled', array(

View File

@@ -31,7 +31,7 @@ class acp_language
function main($id, $mode)
{
global $config, $db, $user, $template, $phpbb_log;
global $config, $db, $user, $template, $phpbb_log, $phpbb_container;
global $phpbb_root_path, $phpEx, $request;
include_once($phpbb_root_path . 'includes/functions_user.' . $phpEx);
@@ -377,37 +377,19 @@ class acp_language
$db->sql_freeresult($result);
$new_ary = $iso = array();
$dp = @opendir("{$phpbb_root_path}language");
if ($dp)
/** @var \phpbb\language\language_file_helper $language_helper */
$language_helper = $phpbb_container->get('language.helper.language_file');
$iso = $language_helper->get_available_languages();
foreach ($iso as $lang_array)
{
while (($file = readdir($dp)) !== false)
{
if ($file[0] == '.' || !is_dir($phpbb_root_path . 'language/' . $file))
{
continue;
}
$lang_iso = $lang_array['iso'];
if (file_exists("{$phpbb_root_path}language/$file/iso.txt"))
{
if (!in_array($file, $installed))
{
if ($iso = file("{$phpbb_root_path}language/$file/iso.txt"))
{
if (sizeof($iso) == 3)
{
$new_ary[$file] = array(
'iso' => $file,
'name' => trim($iso[0]),
'local_name'=> trim($iso[1]),
'author' => trim($iso[2])
);
}
}
}
}
if (!in_array($lang_iso, $installed))
{
$new_ary[$lang_iso] = $lang_array;
}
closedir($dp);
}
unset($installed);