aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB/includes/functions.php
diff options
context:
space:
mode:
authorDominik Dröscher <dhn2@users.sourceforge.net>2006-11-27 12:45:26 +0000
committerDominik Dröscher <dhn2@users.sourceforge.net>2006-11-27 12:45:26 +0000
commit61e2a3f5c1d43fd64e283e0fe79beee92f605999 (patch)
tree8516afd85f5aa1ca07c3ea35696fe13024680353 /phpBB/includes/functions.php
parent85a5dc01fecf98e36c1f39d9f67e8d8f2ddb534d (diff)
downloadforums-61e2a3f5c1d43fd64e283e0fe79beee92f605999.tar
forums-61e2a3f5c1d43fd64e283e0fe79beee92f605999.tar.gz
forums-61e2a3f5c1d43fd64e283e0fe79beee92f605999.tar.bz2
forums-61e2a3f5c1d43fd64e283e0fe79beee92f605999.tar.xz
forums-61e2a3f5c1d43fd64e283e0fe79beee92f605999.zip
#4892
git-svn-id: file:///svn/phpbb/trunk@6667 89ea8834-ac86-4346-8a33-228a782c2dd0
Diffstat (limited to 'phpBB/includes/functions.php')
-rw-r--r--phpBB/includes/functions.php17
1 files changed, 14 insertions, 3 deletions
diff --git a/phpBB/includes/functions.php b/phpBB/includes/functions.php
index bf1883e96f..59c3d240ce 100644
--- a/phpBB/includes/functions.php
+++ b/phpBB/includes/functions.php
@@ -686,13 +686,17 @@ function tz_select($default = '', $truncate = false)
{
if ($truncate)
{
- $zone = (utf8_strlen($zone) > 70) ? utf8_substr($zone, 0, 70) . '...' : $zone;
+ $zone_trunc = truncate_string($zone, 50, false, "...");
+ }
+ else
+ {
+ $zone_trunc = $zone;
}
if (is_numeric($offset))
{
$selected = ($offset == $default) ? ' selected="selected"' : '';
- $tz_select .= '<option value="' . $offset . '"' . $selected . '>' . $zone . '</option>';
+ $tz_select .= '<option title="'.$zone.'" value="' . $offset . '"' . $selected . '>' . $zone_trunc . '</option>';
}
}
@@ -2737,11 +2741,12 @@ function get_preg_expression($mode)
* Truncates string while retaining special characters if going over the max length
* The default max length is 60 at the moment
*/
-function truncate_string($string, $max_length = 60, $allow_reply = true)
+function truncate_string($string, $max_length = 60, $allow_reply = true, $append = '')
{
$chars = array();
$strip_reply = false;
+ $stripped = false;
if ($allow_reply && strpos($string, 'Re: ') === 0)
{
$strip_reply = true;
@@ -2756,12 +2761,18 @@ function truncate_string($string, $max_length = 60, $allow_reply = true)
{
// Cut off the last elements from the array
$string = implode('', array_slice($chars, 0, $max_length));
+ $stripped = true;
}
if ($strip_reply)
{
$string = 'Re: ' . $string;
}
+
+ if ($append != '' && $stripped)
+ {
+ $string = $string . $append;
+ }
return $string;
}