mirror of
https://github.com/phpbb/phpbb.git
synced 2025-06-08 04:18:52 +00:00
[ticket/11959] Move phpbb_generate_string_list() to functions_content.php.
PHPBB3-11959
This commit is contained in:
parent
2a822931c6
commit
b893dae105
4 changed files with 33 additions and 38 deletions
|
@ -1414,6 +1414,38 @@ function phpbb_add_quickmod_option($option, $lang_string)
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Concatenate an array into a string list.
|
||||||
|
*
|
||||||
|
* @param array $items Array of items to concatenate
|
||||||
|
* @param object $user The phpBB $user object.
|
||||||
|
*
|
||||||
|
* @return string String list. Examples: "A"; "A and B"; "A, B, and C"
|
||||||
|
*/
|
||||||
|
function phpbb_generate_string_list($items, $user)
|
||||||
|
{
|
||||||
|
if (empty($items))
|
||||||
|
{
|
||||||
|
return '';
|
||||||
|
}
|
||||||
|
|
||||||
|
$count = sizeof($items);
|
||||||
|
$last_item = array_pop($items);
|
||||||
|
$lang_key = 'STRING_LIST_MULTI';
|
||||||
|
|
||||||
|
if ($count == 1)
|
||||||
|
{
|
||||||
|
return $last_item;
|
||||||
|
}
|
||||||
|
else if ($count == 2)
|
||||||
|
{
|
||||||
|
$lang_key = 'STRING_LIST_SIMPLE';
|
||||||
|
}
|
||||||
|
$list = implode($user->lang['COMMA_SEPARATOR'], $items);
|
||||||
|
|
||||||
|
return $user->lang($lang_key, $list, $last_item);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @package phpBB3
|
* @package phpBB3
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -1499,35 +1499,3 @@ function phpbb_gen_download_links($param_key, $param_val, $phpbb_root_path, $php
|
||||||
|
|
||||||
return $links;
|
return $links;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Concatenate an array into a string list.
|
|
||||||
*
|
|
||||||
* @param array $items Array of items to concatenate
|
|
||||||
* @param object $user The phpBB $user object.
|
|
||||||
*
|
|
||||||
* @return string String list. Examples: "A"; "A and B"; "A, B, and C"
|
|
||||||
*/
|
|
||||||
function phpbb_generate_string_list($items, $user)
|
|
||||||
{
|
|
||||||
if (empty($items))
|
|
||||||
{
|
|
||||||
return '';
|
|
||||||
}
|
|
||||||
|
|
||||||
$count = sizeof($items);
|
|
||||||
$last_item = array_pop($items);
|
|
||||||
$lang_key = 'STRING_LIST_MULTI';
|
|
||||||
|
|
||||||
if ($count == 1)
|
|
||||||
{
|
|
||||||
return $last_item;
|
|
||||||
}
|
|
||||||
else if ($count == 2)
|
|
||||||
{
|
|
||||||
$lang_key = 'STRING_LIST_SIMPLE';
|
|
||||||
}
|
|
||||||
$list = implode($user->lang['COMMA_SEPARATOR'], $items);
|
|
||||||
|
|
||||||
return $user->lang($lang_key, $list, $last_item);
|
|
||||||
}
|
|
||||||
|
|
|
@ -211,11 +211,6 @@ class post extends \phpbb\notification\type\base
|
||||||
$usernames[] = $this->user->lang('NOTIFICATION_X_OTHERS', $trimmed_responders_cnt);
|
$usernames[] = $this->user->lang('NOTIFICATION_X_OTHERS', $trimmed_responders_cnt);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!function_exists('phpbb_generate_string_list'))
|
|
||||||
{
|
|
||||||
include($this->phpbb_root_path . 'includes/functions_display.' . $this->php_ext);
|
|
||||||
}
|
|
||||||
|
|
||||||
return $this->user->lang(
|
return $this->user->lang(
|
||||||
$this->language_key,
|
$this->language_key,
|
||||||
phpbb_generate_string_list($usernames, $this->user),
|
phpbb_generate_string_list($usernames, $this->user),
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
require_once dirname(__FILE__) . '/../../phpBB/includes/functions_display.php';
|
require_once dirname(__FILE__) . '/../../phpBB/includes/functions_content.php';
|
||||||
require_once dirname(__FILE__) . '/../../phpBB/includes/functions.php';
|
require_once dirname(__FILE__) . '/../../phpBB/includes/functions.php';
|
||||||
|
|
||||||
class phpbb_generate_string_list_test extends phpbb_test_case
|
class phpbb_generate_string_list_test extends phpbb_test_case
|
||||||
|
|
Loading…
Add table
Reference in a new issue