Use Language::truncate()
authorBrion Vibber <brion@users.mediawiki.org>
Sat, 18 Jun 2005 09:34:25 +0000 (09:34 +0000)
committerBrion Vibber <brion@users.mediawiki.org>
Sat, 18 Jun 2005 09:34:25 +0000 (09:34 +0000)
includes/Article.php

index 9e94b43..25dfbfb 100644 (file)
@@ -1635,15 +1635,15 @@ class Article {
 
                                # comment field=255, let's grep the first 150 to have some user
                                # space left
-                               $text=mb_substr($text,0,150);
+                               global $wgContLang;
+                               $text = $wgContLang->truncate( $text, 150, '...' );
+                               
                                # let's strip out newlines and HTML tags
                                $text=preg_replace('/\"/',"'",$text);
                                $text=preg_replace('/\</','&lt;',$text);
                                $text=preg_replace('/\>/','&gt;',$text);
                                $text=preg_replace("/[\n\r]/",'',$text);
                                
-                               if( $length > 150 ) { $text .= '...'; } # we've only pasted part of the text
-                               
                                if(!$blanked) {
                                        if(!$all_same_user) {
                                                $reason = wfMsg ( 'excontent', $text );