Changeset 608 for trunk

Show
Ignore:
Timestamp:
09/09/07 23:21:42 (15 months ago)
Author:
michiel
Message:

remove hardcoded 4000 character limit on post.
If you want a 'read more' link on the post overview you now _HAVE TO_ use the ##BREAKPOINT## magic text,
no automatic truncating anymore.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • trunk/common/mvblog.php

    r602 r608  
    261261                                                        $text = $this->strip_invalid_xml(stripslashes($row["body"])); 
    262262                                                        $text = $this->plugman->run_hooks("text_output", $text); 
    263                                                         if ($this->limit_text($text, 4000)) { 
     263                                                        if ($this->limit_text($text)) { 
    264264                                                                echo $text; 
    265265                                                                ?><br /><br /><a href="<?php echo $link; ?>" class="link_readmore"><?php echo gettext("read more"); ?></a><?php 
     
    337337        } 
    338338        /* }}} */ 
    339         /* limit_text($text, $length) {{{ */ 
     339        /* limit_text($text) {{{ */ 
    340340        /** 
    341341         * limit the length of a message 
    342342         * 
    343343         * @param string $text the text to limit in length 
    344          * @param int $length the number of chars to limit to 
    345344         * @return int 1 if truncated, 0 if original string is within limits 
    346345         */ 
    347         public function limit_text(&$text, $length=4000) { 
     346        public function limit_text(&$text) { 
    348347                if (strstr($text, "##BREAKPOINT##")) { 
    349348                        $text = substr($text, 0, strpos($text, "##BREAKPOINT##")); 
    350349                        return 1; 
    351350                } else { 
    352                         if (strlen($text) > $length) { 
    353                                 $tmptxt = substr($text, $length, -1); 
    354                                 $breakpoint = ($length+(strpos($tmptxt, ">")+1)); 
    355                                 $text = substr($text, 0, $breakpoint); 
    356                                 return 1; 
    357                         } else { 
    358                                 return 0; 
    359                         } 
     351                        return 0; 
    360352                } 
    361353        }