From 7754df6d17603354e0bef0f7999a9dc262cd7e00 Mon Sep 17 00:00:00 2001 From: Michael M Slusarz Date: Wed, 3 Mar 2010 17:51:20 -0700 Subject: [PATCH] Use Horde_String::truncate() --- imp/mailbox.php | 7 ++----- imp/message.php | 5 +---- 2 files changed, 3 insertions(+), 9 deletions(-) diff --git a/imp/mailbox.php b/imp/mailbox.php index 7b292f82a..16f4816e5 100644 --- a/imp/mailbox.php +++ b/imp/mailbox.php @@ -779,7 +779,7 @@ while (list(,$ob) = each($mbox_info['overview'])) { $maxlen = $prefs->getValue('preview_maxlen'); if (Horde_String::length($ptext) > $maxlen) { - $ptext = Horde_String::substr($ptext, 0, $maxlen) . ' ...'; + $ptext = Horde_String::truncate($ptext, $maxlen); } elseif (empty($ob['previewcut'])) { $ptext .= '[[' . _("END") . ']]'; } @@ -814,10 +814,7 @@ while (list(,$ob) = each($mbox_info['overview'])) { /* Add subject flags. */ foreach ($subject_flags as $val) { - $flag_label = $val['label']; - if (Horde_String::length($val['label']) > 12) { - $flag_label = Horde_String::substr($val['label'], 0, 10) . '...'; - } + $flag_label = Horde_String::truncate($val['label'], 12); $msg['subject'] = '' . htmlspecialchars($flag_label) . '' . $msg['subject']; } diff --git a/imp/message.php b/imp/message.php index e1d527287..7b6f74962 100644 --- a/imp/message.php +++ b/imp/message.php @@ -281,10 +281,7 @@ foreach (array('to', 'cc', 'bcc') as $val) { if ($subject = $mime_headers->getValue('subject')) { $display_headers['subject'] = $imp_ui->getDisplaySubject($subject); $title = sprintf(_("%s: %s"), $page_label, $subject); - $shortsub = htmlspecialchars($subject); - if (strlen($shortsub) > 97) { - $shortsub = substr($shortsub, 0, 97) . '...'; - } + $shortsub = htmlspecialchars(Horde_String::truncate($subject, 100)); } else { $display_headers['subject'] = $shortsub = _("[No Subject]"); $title = sprintf(_("%s: %s"), $page_label, $shortsub); -- 2.11.0