aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB/includes/functions_content.php
diff options
context:
space:
mode:
authorJoas Schilling <nickvergessen@gmx.de>2014-03-29 20:39:22 +0100
committerJoas Schilling <nickvergessen@gmx.de>2014-03-29 20:39:22 +0100
commitf426fa02951b5131f77ad2c4596a0bd87ef23d84 (patch)
tree454e5130824322b55ccd7688428532b8ca162590 /phpBB/includes/functions_content.php
parent3e281790e3da8342a7c106aa0d181bc556912baa (diff)
parentb893dae105f72b7c34abe855e24f0dec35206208 (diff)
downloadforums-f426fa02951b5131f77ad2c4596a0bd87ef23d84.tar
forums-f426fa02951b5131f77ad2c4596a0bd87ef23d84.tar.gz
forums-f426fa02951b5131f77ad2c4596a0bd87ef23d84.tar.bz2
forums-f426fa02951b5131f77ad2c4596a0bd87ef23d84.tar.xz
forums-f426fa02951b5131f77ad2c4596a0bd87ef23d84.zip
Merge remote-tracking branch 'prototech/ticket/11959' into develop-ascraeus
* prototech/ticket/11959: [ticket/11959] Move phpbb_generate_string_list() to functions_content.php. [ticket/11959] Add unit tests. [ticket/11959] Remove use of plurals and make it possible to use Oxford comma. [ticket/11959] Rename phpbb_gen_string_list() & fix incorrect var name. [ticket/11959] Simplify how the users are trimmed. [ticket/11959] Add function to create a string list. [ticket/11959] Add samples for the untrimmed strings. [ticket/11959] List the last user with "and" instead of a comma. [ticket/11959] Use the plurals system for the untrimmed language strings. [ticket/11959] Fix the NOTIFICATION_QUOTE_TRIMMED text. [ticket/11959] Use plurals for the language strings.
Diffstat (limited to 'phpBB/includes/functions_content.php')
-rw-r--r--phpBB/includes/functions_content.php32
1 files changed, 32 insertions, 0 deletions
diff --git a/phpBB/includes/functions_content.php b/phpBB/includes/functions_content.php
index 8122b87e4b..dd9201165b 100644
--- a/phpBB/includes/functions_content.php
+++ b/phpBB/includes/functions_content.php
@@ -1415,6 +1415,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
*/
class bitfield