Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Index: include/feedcreator.class.php
- ===================================================================
- --- include/feedcreator.class.php (revision 17)
- +++ include/feedcreator.class.php (working copy)
- @@ -521,6 +521,9 @@
- * @return string the truncated string
- */
- function iTrunc($string, $length) {
- + if (extension_loaded('mbstring')) {
- + return FeedCreator::iTrunc_mb($string, $length);
- + }
- if (strlen($string)<=$length) {
- return $string;
- }
- @@ -547,7 +550,33 @@
- }
- + function iTrunc_mb($string, $length) {
- + $encoding = strtoupper($this->encoding);
- + if (@mb_strlen($string,$encoding)<=$length) {
- + return $string;
- + }
- + $pos = mb_strrpos($string,".",$encoding);
- + if ($pos>=$length-4) {
- + $string = mb_substr($string,0,$length-4,$encoding);
- + $pos = mb_strrpos($string,".",$encoding);
- + }
- + if ($pos>=$length*0.4) {
- + return mb_substr($string,0,$pos+1,$encoding)." ...";
- + }
- +
- + $pos = mb_strrpos($string," ",$encoding);
- + if ($pos>=$length-4) {
- + $string = mb_substr($string,0,$length-4,$encoding);
- + $pos = mb_strrpos($string," ",$encoding);
- + }
- + if ($pos>=$length*0.4) {
- + return mb_substr($string,0,$pos,$encoding)." ...";
- + }
- +
- + return mb_substr($string,0,$length-4,$encoding)." ...";
- + }
- +
- /**
- * Creates a comment indicating the generator of this feed.
- * The format of this comment seems to be recognized by
Add Comment
Please, Sign In to add comment