Commit a77d3ccd authored by Ganesharatnam's avatar Ganesharatnam
Browse files

Clean up script

parent b9dea846
......@@ -129,7 +129,6 @@ function uw_lib_refshelf_render_data() {
$txt = "<h2>Resources for " . $tit . "</h2><br />";
$links .= _getLinkAndDesc($qparam, "resources");
}
$content .= $txt;
$content .= $links;
}
......@@ -373,34 +372,42 @@ function _highlightSearchWord($word, $str) {
//Search results keyword lowercase
$word_lc = strtolower($word);
$word_style1 = "<span style='background-color: #ffea30;'>" . $word_lc . "</span>";
$word_style1 = _styleWord($word_lc);
$highlighted = str_replace($word_lc, $word_style1, $str);
//Search results keyword -- First letter uppercase
$word_ucf = ucfirst($word);
$word_style2 = "<span style='background-color: #ffea30;'>" . $word_ucf . "</span>";
$word_style2 = _styleWord($word_ucf);
$highlighted = str_replace($word_ucf, $word_style2, $highlighted);
//Search results keyword uppercase
$word_uc = strtoupper($word);
$word_style4 = "<span style='background-color: #ffea30;'>" . $word_uc . "</span>";
$highlighted = str_replace($word_uc, $word_style4, $highlighted);
$word_style3 = _styleWord($word_uc);
$highlighted = str_replace($word_uc, $word_style3, $highlighted);
//Replacement for a search keyword -- all uppercase
if (ctype_upper($word)) {
//For search results keyword -- lowercase
$word_uc = strtolower($word);
$word_style3 = "<span style='background-color: #ffea30;'>" . $word_uc . "</span>";
$highlighted = str_replace($word_uc, $word_style3, $highlighted);
$word_style4 = _styleWord($word_uc);
$highlighted = str_replace($word_uc, $word_style4, $highlighted);
//For search results keyword -- First letter -- uppercase
$word_ucf = ucfirst($word_uc);
$word_style2 = "<span style='background-color: #ffea30;'>" . $word_ucf . "</span>";
$highlighted = str_replace($word_ucf, $word_style2, $highlighted);
$word_style5 = _styleWord($word_ucf);
$highlighted = str_replace($word_ucf, $word_style5, $highlighted);
}
return $highlighted;
}
/**
* Apply the style for search word
*/
function _styleWord($word) {
$word_style = "<span style='background-color: #ffea30;'>" . $word . "</span>";
return $word_style;
}
/**
* To display the search results with pagination
*/
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment