Project

General

Profile

« Previous | Next » 

Revision 1171

Added by Ruud over 14 years ago

fixed breaking droplets by highlighting search-words in search result pages.

View differences:

branches/2.8.x/CHANGELOG
11 11
! = Update/Change
12 12

  
13 13
------------------------------------- 2.8.1 -------------------------------------
14
<<<<<<< .mine
14
13-Oct-2009 Ruud Eisinga
15
#	fixed breaking droplets by highlighting search-words in search result pages.
15 16
13-Oct-2009 Dietmar Woellbrink
16 17
+	added forgotten jquery-fancybox.js Version 1.0
17
=======
18 18
13-Oct-2009 Dietrich Roland Pehlke (Aldus)
19 19
#	Fixed typo in the finnish language file (ticket #814).
20 20
>>>>>>> .r1169
branches/2.8.x/wb/framework/frontend.functions.php
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('&lt;', '&gt;', '&amp;', '&quot;', '&#039;', '&nbsp;'), 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('&amp;', '&lt;', '&gt;', '&quot;', '&#039;', '&nbsp;'), $match);

Also available in: Unified diff