1
0
mirror of https://github.com/phpbb/phpbb.git synced 2025-06-18 16:11:06 +02:00

[ticket/11959] Add function to create a string list.

PHPBB3-11959
This commit is contained in:
Cesar G
2014-02-07 14:55:47 -08:00
parent 7cc1a8d224
commit f0a85a90cc

View File

@ -1499,3 +1499,25 @@ function phpbb_gen_download_links($param_key, $param_val, $phpbb_root_path, $php
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_gen_string_list($items, $user)
{
$count = sizeof($items);
$last_item = '';
if ($count > 1)
{
$last_item = array_pop($items);
}
$list = implode($user->lang['COMMA_SEPARATOR'], $items);
return $user->lang('STRING_LIST', $list, $last_item, $count);
}