Project

General

Profile

« Previous | Next » 

Revision 478

Added by Matthias almost 17 years ago

speeded up highlighting on big WYSIWYG pages;
fixed: '>' wasn't shown in highlighting result;
Thanks to thorn

View differences:

frontend.functions.php
75 75
	$search_string = implode("|", $arr_string);
76 76
	$string = entities_to_umlauts($search_string, 'UTF-8');
77 77
	$string = strtr($string, $string_ul_umlauts);
78
	$foo = strtr($foo, array("<"=>"!,,!", ">"=>"!,,,!", "&"=>"!,,,,!", """=>"!,,,,,!", "'"=>"!,,,,,,!"));
79
	$string = strtr($string, array("<"=>"!,,!", ">"=>"!,,,!", "&"=>"!,,,,!", """=>"!,,,,,!", "'"=>"!,,,,,,!"));
78 80
	$foo = preg_replace('/('.$string.')(?=[^>]*<)/iUS', '<span class="highlight">$1</span>',$foo);
79 81
	$pos = strpos($foo, '<');
80 82
	if ($pos === false) { // "===" means identicaly
81 83
		$foo = preg_replace('/('.$string.')/i', '<span class="highlight">$1</span>',$foo);
82 84
	}
83
	$foo = umlauts_to_entities($foo, 'UTF-8', 0);
85
	$foo = strtr($foo, array("!,,!"=>"&lt;", "!,,,!"=>"&gt;", "!,,,,!"=>"&amp;", "!,,,,,!"=>"&quot;", "!,,,,,,!"=>"&#039;"));
86
	if(DEFAULT_CHARSET != 'utf-8') {
87
		$foo = mb_convert_encoding_wrapper($foo, DEFAULT_CHARSET, 'UTF-8');
88
		//$foo = umlauts_to_entities($foo, 'UTF-8');
89
	}
84 90
	return $foo;
85 91
}
86 92

  

Also available in: Unified diff