aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbrettp <brettp@36083f99-b078-4883-b0ff-0f9b5a30f544>2009-11-10 04:11:33 +0000
committerbrettp <brettp@36083f99-b078-4883-b0ff-0f9b5a30f544>2009-11-10 04:11:33 +0000
commit8d3cb601f6d6c0528ee9c204e7779739055a5f59 (patch)
tree1f7e055863e693b6046f6228b3f8109efbb6cc44
parent267ede71db08d4019ed4d58a5ed2f4816a23ffb1 (diff)
downloadelgg-8d3cb601f6d6c0528ee9c204e7779739055a5f59.tar.gz
elgg-8d3cb601f6d6c0528ee9c204e7779739055a5f59.tar.bz2
Fixed displaying of ...s in search.
git-svn-id: http://code.elgg.org/elgg/trunk@3658 36083f99-b078-4883-b0ff-0f9b5a30f544
-rw-r--r--mod/search/start.php8
1 files changed, 6 insertions, 2 deletions
diff --git a/mod/search/start.php b/mod/search/start.php
index 314aa4710..19de06dd7 100644
--- a/mod/search/start.php
+++ b/mod/search/start.php
@@ -249,8 +249,12 @@ function search_get_highlighted_relevant_substrings($haystack, $needle, $min_mat
}
$string = substr($haystack, $offset, $limit - $offset);
- if ($limit-$offset < strlen($haystack)) {
- $string = "$string...";
+ if ($offset != 0) {
+ $string = "...$string";
+ }
+
+ if ($limit + $offset >= strlen($haystack)) {
+ $string .= '...';
}
$substrings[] = $string;