Permalink
Browse files

MDL-20537: Whitespace fixes for shorten_text (bugfixes to follow)

  • Loading branch information...
1 parent 1afd70b commit 46e6e31b52326c4763e7676c996c08e3f0edc846 sam_marshall committed Oct 12, 2009
Showing with 7 additions and 7 deletions.
  1. +7 −7 lib/moodlelib.php
View
@@ -6905,7 +6905,7 @@ function shorten_text($text, $ideal=30, $exact = false) {
// if the words shouldn't be cut in the middle...
if (!$exact) {
// ...search the last occurance of a space...
- for ($k=strlen($truncate);$k>0;$k--) {
+ for ($k=strlen($truncate);$k>0;$k--) {
if (!empty($truncate[$k]) && ($char = $truncate[$k])) {
if ($char == '.' or $char == ' ') {
$breakpos = $k+1;
@@ -6915,23 +6915,23 @@ function shorten_text($text, $ideal=30, $exact = false) {
break; // character boundary.
}
}
- }
+ }
- if (isset($breakpos)) {
+ if (isset($breakpos)) {
// ...and cut the text in this position
$truncate = substr($truncate, 0, $breakpos);
- }
- }
+ }
+ }
// add the defined ending to the text
- $truncate .= $ending;
+ $truncate .= $ending;
// close all unclosed html-tags
foreach ($open_tags as $tag) {
$truncate .= '</' . $tag . '>';
}
- return $truncate;
+ return $truncate;
}

0 comments on commit 46e6e31

Please sign in to comment.