101 |
101 |
$string = str_replace($string_ul_umlaut, $string_ul_regex, $search_string);
|
102 |
102 |
// the highlighting
|
103 |
103 |
// match $string, but not inside <style>...</style>, <script>...</script>, <!--...--> or HTML-Tags
|
|
104 |
// Also droplet tags are now excluded from highlighting.
|
104 |
105 |
// split $string into pieces - "cut away" styles, scripts, comments, HTML-tags and eMail-addresses
|
105 |
106 |
// we have to cut <pre> and <code> as well.
|
106 |
107 |
// for HTML-Tags use <(?:[^<]|<.*>)*> which will match strings like <input ... value="<b>value</b>" >
|
107 |
|
$matches = preg_split("~(<style.*</style>|<script.*</script>|<pre.*</pre>|<code.*</code>|<!--.*-->|<(?:[^<]|<.*>)*>|\b[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,8}\b)~iUs",$foo,-1,(PREG_SPLIT_DELIM_CAPTURE|PREG_SPLIT_NO_EMPTY));
|
|
108 |
$matches = preg_split("~(\[\[.*\]\]|<style.*</style>|<script.*</script>|<pre.*</pre>|<code.*</code>|<!--.*-->|<(?:[^<]|<.*>)*>|\b[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,8}\b)~iUs",$foo,-1,(PREG_SPLIT_DELIM_CAPTURE|PREG_SPLIT_NO_EMPTY));
|
108 |
109 |
if(is_array($matches) && $matches != array()) {
|
109 |
110 |
$foo = "";
|
110 |
111 |
foreach($matches as $match) {
|
111 |
|
if($match{0}!="<" && !preg_match('/^[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,8}$/i', $match)) {
|
|
112 |
if($match{0}!="<" && !preg_match('/^[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,8}$/i', $match) && !preg_match('~\[\[.*\]\]~', $match)) {
|
112 |
113 |
$match = str_replace(array('<', '>', '&', '"', ''', ' '), array('<', '>', '&', '"', '\'', "\xC2\xA0"), $match);
|
113 |
114 |
$match = preg_replace('~('.$string.')~ui', '_span class=_highlight__$1_/span_',$match);
|
114 |
115 |
$match = str_replace(array('&', '<', '>', '"', '\'', "\xC2\xA0"), array('&', '<', '>', '"', ''', ' '), $match);
|
fixed breaking droplets by highlighting search-words in search result pages.