aboutsummaryrefslogtreecommitdiffstats
path: root/functions/draw_functions.php
diff options
context:
space:
mode:
authorjwangen <jwangen>2002-12-08 09:45:58 +0000
committerjwangen <jwangen>2002-12-08 09:45:58 +0000
commite3f3eacc9393d0f3a12321366a9e2083b5d25c7f (patch)
tree4a5532724a3a7d20766e08166ce759ec98474f8b /functions/draw_functions.php
parent6847abd72e87f2a18d2fe44c55ac7c5eb567d03d (diff)
downloadphpicalendar-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.php17
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;
}

© 2014-2024 Faster IT GmbH | imprint | privacy policy