Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
library
uw_lib_refshelf
Commits
a77d3ccd
Commit
a77d3ccd
authored
Jan 10, 2018
by
Ganesharatnam
Browse files
Clean up script
parent
b9dea846
Changes
1
Hide whitespace changes
Inline
Side-by-side
uw_lib_refshelf.module
View file @
a77d3ccd
...
...
@@ -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_style
4
=
"<span style='background-color: #ffea30;'>"
.
$word_uc
.
"</span>"
;
$highlighted
=
str_replace
(
$word_uc
,
$word_style
4
,
$highlighted
);
$word_style
3
=
_styleWord
(
$word_uc
)
;
$highlighted
=
str_replace
(
$word_uc
,
$word_style
3
,
$highlighted
);
//Replacement for a search keyword -- all uppercase
if
(
ctype_upper
(
$word
))
{
//For search results keyword -- lowercase
$word_uc
=
strtolower
(
$word
);
$word_style
3
=
"<span style='background-color: #ffea30;'>"
.
$word_uc
.
"</span>"
;
$highlighted
=
str_replace
(
$word_uc
,
$word_style
3
,
$highlighted
);
$word_style
4
=
_styleWord
(
$word_uc
)
;
$highlighted
=
str_replace
(
$word_uc
,
$word_style
4
,
$highlighted
);
//For search results keyword -- First letter -- uppercase
$word_ucf
=
ucfirst
(
$word_uc
);
$word_style
2
=
"<span style='background-color: #ffea30;'>"
.
$word_ucf
.
"</span>"
;
$highlighted
=
str_replace
(
$word_ucf
,
$word_style
2
,
$highlighted
);
$word_style
5
=
_styleWord
(
$word_ucf
)
;
$highlighted
=
str_replace
(
$word_ucf
,
$word_style
5
,
$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
*/
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment