diff options
author | Cesar G <prototech91@gmail.com> | 2014-03-29 09:29:47 -0700 |
---|---|---|
committer | Cesar G <prototech91@gmail.com> | 2014-03-29 09:32:04 -0700 |
commit | b893dae105f72b7c34abe855e24f0dec35206208 (patch) | |
tree | d372bda9cdc495bb792e0500834aeb0bcebde884 | |
parent | 2a822931c6d95fe9e6066752ec59ab614189837e (diff) | |
download | forums-b893dae105f72b7c34abe855e24f0dec35206208.tar forums-b893dae105f72b7c34abe855e24f0dec35206208.tar.gz forums-b893dae105f72b7c34abe855e24f0dec35206208.tar.bz2 forums-b893dae105f72b7c34abe855e24f0dec35206208.tar.xz forums-b893dae105f72b7c34abe855e24f0dec35206208.zip |
[ticket/11959] Move phpbb_generate_string_list() to functions_content.php.
PHPBB3-11959
-rw-r--r-- | phpBB/includes/functions_content.php | 32 | ||||
-rw-r--r-- | phpBB/includes/functions_display.php | 32 | ||||
-rw-r--r-- | phpBB/phpbb/notification/type/post.php | 5 | ||||
-rw-r--r-- | tests/functions/generate_string_list.php | 2 |
4 files changed, 33 insertions, 38 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 diff --git a/phpBB/includes/functions_display.php b/phpBB/includes/functions_display.php index d760f09dcd..cd2c9e5ae6 100644 --- a/phpBB/includes/functions_display.php +++ b/phpBB/includes/functions_display.php @@ -1499,35 +1499,3 @@ 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_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); -} diff --git a/phpBB/phpbb/notification/type/post.php b/phpBB/phpbb/notification/type/post.php index d3491a3f5e..140c0ad82a 100644 --- a/phpBB/phpbb/notification/type/post.php +++ b/phpBB/phpbb/notification/type/post.php @@ -211,11 +211,6 @@ class post extends \phpbb\notification\type\base $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( $this->language_key, phpbb_generate_string_list($usernames, $this->user), diff --git a/tests/functions/generate_string_list.php b/tests/functions/generate_string_list.php index 60269b5656..cfc150c1f4 100644 --- a/tests/functions/generate_string_list.php +++ b/tests/functions/generate_string_list.php @@ -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'; class phpbb_generate_string_list_test extends phpbb_test_case |