aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCesar G <prototech91@gmail.com>2014-02-07 14:55:47 -0800
committerCesar G <prototech91@gmail.com>2014-03-19 03:08:33 -0700
commitf0a85a90cc61859d1821960b8e3c50a8187202a7 (patch)
treefab78f23fb2cdf831420c617aa009641eec6981a
parent7cc1a8d224b8c53530bba89fbb756a0518b04a91 (diff)
downloadforums-f0a85a90cc61859d1821960b8e3c50a8187202a7.tar
forums-f0a85a90cc61859d1821960b8e3c50a8187202a7.tar.gz
forums-f0a85a90cc61859d1821960b8e3c50a8187202a7.tar.bz2
forums-f0a85a90cc61859d1821960b8e3c50a8187202a7.tar.xz
forums-f0a85a90cc61859d1821960b8e3c50a8187202a7.zip
[ticket/11959] Add function to create a string list.
PHPBB3-11959
-rw-r--r--phpBB/includes/functions_display.php22
1 files changed, 22 insertions, 0 deletions
diff --git a/phpBB/includes/functions_display.php b/phpBB/includes/functions_display.php
index cd2c9e5ae6..6bffaeaa44 100644
--- a/phpBB/includes/functions_display.php
+++ b/phpBB/includes/functions_display.php
@@ -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);
+}