From e3f3eacc9393d0f3a12321366a9e2083b5d25c7f Mon Sep 17 00:00:00 2001 From: jwangen Date: Sun, 8 Dec 2002 09:45:58 +0000 Subject: Fixed various bugs, Currently working on events that span multiple days --- functions/draw_functions.php | 17 +++-------------- 1 file changed, 3 insertions(+), 14 deletions(-) (limited to 'functions/draw_functions.php') diff --git a/functions/draw_functions.php b/functions/draw_functions.php index d54c250..f84b5c2 100644 --- a/functions/draw_functions.php +++ b/functions/draw_functions.php @@ -38,22 +38,11 @@ function drawEventTimes ($start, $end) { // word wrap function that returns specified number of lines // when lines is 0, it returns the entire string as wordwrap() does it function word_wrap($str, $length, $lines=0) { - $str = wordwrap($str, $length); if ($lines > 0) { - $str_arr = explode("\n", $str); - if (count($str_arr) < $lines) $lines = count($str_arr); - $str = ''; - for ($i=0; $i<($lines-1);$i++) { - $str .= $str_arr[$i].'
'; + $len = $length * $lines; + if ($len < strlen($str)) { + $str = substr($str,0,$len).'...'; } - if (count($str_arr) > ($lines)) { - $tmp_str = substr($str_arr[$i], 0, ($length-2)); - $str .= $tmp_str . '...'; - } else { - $str .= $str_arr[$i]; - } - } else { - $str = nl2br(trim($str)); } return $str; } -- cgit v1.2.3