diff options
author | jwangen <jwangen> | 2002-12-08 09:45:58 +0000 |
---|---|---|
committer | jwangen <jwangen> | 2002-12-08 09:45:58 +0000 |
commit | e3f3eacc9393d0f3a12321366a9e2083b5d25c7f (patch) | |
tree | 4a5532724a3a7d20766e08166ce759ec98474f8b /functions/draw_functions.php | |
parent | 6847abd72e87f2a18d2fe44c55ac7c5eb567d03d (diff) | |
download | phpicalendar-e3f3eacc9393d0f3a12321366a9e2083b5d25c7f.tar.gz phpicalendar-e3f3eacc9393d0f3a12321366a9e2083b5d25c7f.tar.bz2 phpicalendar-e3f3eacc9393d0f3a12321366a9e2083b5d25c7f.zip |
Fixed various bugs, Currently working on events that span multiple days
Diffstat (limited to 'functions/draw_functions.php')
-rw-r--r-- | functions/draw_functions.php | 17 |
1 files changed, 3 insertions, 14 deletions
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].'<br>'; + $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; } |