Changeset 3352

Show
Ignore:
Timestamp:
08/21/2008 04:48:22 AM (3 months ago)
Author:
Geert
Message:

Converting the default end character for the text::limit functions to the actual Unicode character.

Why would this be better than using an HTML entity reference--I hear you ask?

  • HTML entity references only make sense in contexts where HTML markup is used and interpreted (e.g. _not_ in plain text email).*
  • As a bonus, you don't need to worry about double encoding when using html::specialchars() on a string that passed through text::limit().

*Also see: Unicode Explained by Korpela (p.108)

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • trunk/system/helpers/text.php

    r3326 r3352  
    2323        { 
    2424                $limit = (int) $limit; 
    25                 $end_char = ($end_char === NULL) ? '…' : $end_char; 
     25                $end_char = ($end_char === NULL) ? '' : $end_char; 
    2626 
    2727                if (trim($str) === '') 
     
    4949        public static function limit_chars($str, $limit = 100, $end_char = NULL, $preserve_words = FALSE) 
    5050        { 
    51                 $end_char = ($end_char === NULL) ? '…' : $end_char; 
     51                $end_char = ($end_char === NULL) ? '' : $end_char; 
    5252 
    5353                $limit = (int) $limit;