Changeset 3991 in subversion


Ignore:
Timestamp:
Sep 25, 2010 9:47:51 AM (3 years ago)
Author:
alec
Message:
  • Truncate message subject when setting page title
Location:
trunk/roundcubemail/program
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/roundcubemail/program/include/rcube_shared.inc

    r3989 r3991  
    408408 
    409409/** 
    410  * Replace the middle part of a string with ... 
    411  * if it is longer than the allowed length 
     410 * Truncate string if it is longer than the allowed length 
     411 * Replace the middle or the ending part of a string with a placeholder 
    412412 * 
    413413 * @param string Input string 
    414414 * @param int    Max. length 
    415415 * @param string Replace removed chars with this 
     416 * @param bool   Set to True if string should be truncated from the end 
    416417 * @return string Abbreviated string 
    417418 */ 
    418 function abbreviate_string($str, $maxlength, $place_holder='...') 
     419function abbreviate_string($str, $maxlength, $place_holder='...', $ending=false) 
    419420{ 
    420421  $length = mb_strlen($str); 
     
    422423  if ($length > $maxlength) 
    423424  { 
     425    if ($ending) 
     426      return mb_substr($str, 0, $maxlength) . $place_holder; 
     427 
    424428    $place_holder_length = mb_strlen($place_holder); 
    425429    $first_part_length = floor(($maxlength - $place_holder_length)/2); 
  • trunk/roundcubemail/program/steps/mail/show.inc

    r3989 r3991  
    4242    $IMAP->set_charset($MESSAGE->headers->charset); 
    4343 
    44   $OUTPUT->set_pagetitle($MESSAGE->subject); 
     44  $OUTPUT->set_pagetitle(abbreviate_string($MESSAGE->subject, 128, '...', true)); 
    4545 
    4646  // give message uid to the client 
Note: See TracChangeset for help on using the changeset viewer.