From: <ji...@us...> - 2008-12-23 10:20:56
|
Update of /cvsroot/phpicalendar/phpicalendar/functions In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv24978/functions Modified Files: draw_functions.php Log Message: bug fixes from tracker Index: draw_functions.php =================================================================== RCS file: /cvsroot/phpicalendar/phpicalendar/functions/draw_functions.php,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** draw_functions.php 20 Dec 2008 03:22:54 -0000 1.7 --- draw_functions.php 23 Dec 2008 10:20:50 -0000 1.8 *************** *** 41,46 **** if ($lines > 0) { $len = $length * $lines; ! if ($len < strlen($str)) { ! $str = substr($str,0,$len).'...'; } } --- 41,74 ---- if ($lines > 0) { $len = $length * $lines; ! //if ($len < strlen($str)) { ! // $str = substr($str,0,$len).'...'; ! //} ! $rstr=bite_str($str,0,$len+1); ! } ! return $rstr; ! } ! ! // String intercept By Bleakwind ! // utf-8:$byte=3 | gb2312:$byte=2 | big5:$byte=2 ! function bite_str($string, $start, $len, $byte=3){ ! $str = ""; ! $count = 0; ! $str_len = strlen($string); ! for ($i=0; $i<$str_len; $i++) { ! if (($count+1-$start)>$len) { ! $str .= "..."; ! break; ! } elseif ((ord(substr($string,$i,1)) <= 128) && ($count < $start)){ ! $count++; ! } elseif ((ord(substr($string,$i,1)) > 128) && ($count < $start)){ ! $count = $count+2; ! $i = $i+$byte-1; ! } elseif ((ord(substr($string,$i,1)) <= 128) && ($count >= $start)){ ! $str .= substr($string,$i,1); ! $count++; ! } elseif ((ord(substr($string,$i,1)) > 128) && ($count >= $start)){ ! $str .= substr($string,$i,$byte); ! $count = $count+2; ! $i = $i+$byte-1; } } |