aboutsummaryrefslogtreecommitdiff
path: root/mod/search/start.php
diff options
context:
space:
mode:
authorSilvio Rhatto <rhatto@riseup.net>2013-02-16 11:48:34 -0200
committerSilvio Rhatto <rhatto@riseup.net>2013-02-16 11:48:34 -0200
commitb6ee1b93376d42f8a8fcee0127bc10f84d1e018e (patch)
treecbde5e4d0b745c3bb854c215bccea8b2d6bb367e /mod/search/start.php
parent694306cf537fb8cb45beb7d4fd63c5b56cb5c4da (diff)
parent5aff5b3913fbb6226d8fb3162453c58888fba38d (diff)
downloadelgg-b6ee1b93376d42f8a8fcee0127bc10f84d1e018e.tar.gz
elgg-b6ee1b93376d42f8a8fcee0127bc10f84d1e018e.tar.bz2
Merge branch 'master' into saravea
Diffstat (limited to 'mod/search/start.php')
-rw-r--r--mod/search/start.php6
1 files changed, 4 insertions, 2 deletions
diff --git a/mod/search/start.php b/mod/search/start.php
index d2d7ed3c2..8a112a3a3 100644
--- a/mod/search/start.php
+++ b/mod/search/start.php
@@ -77,7 +77,7 @@ function search_page_handler($page) {
/**
* Return a string with highlighted matched queries and relevant context
- * Determins context based upon occurance and distance of words with each other.
+ * Determines context based upon occurance and distance of words with each other.
*
* @param string $haystack
* @param string $query
@@ -94,6 +94,8 @@ function search_get_highlighted_relevant_substrings($haystack, $query, $min_matc
if (!$tag_match) {
$words = search_remove_ignored_words($query, 'array');
+ } else {
+ $words = array();
}
// if haystack < $max_length return the entire haystack w/formatting immediately
@@ -142,7 +144,7 @@ function search_get_highlighted_relevant_substrings($haystack, $query, $min_matc
$total_length = array_sum($offsets);
$add_length = 0;
- if ($total_length < $max_length) {
+ if ($total_length < $max_length && $offsets) {
$add_length = floor((($max_length - $total_length) / count($offsets)) / 2);
$starts = array();