Project

General

Profile

« Previous | Next » 

Revision 769

Added by thorn over 16 years ago

search: added search_time_limit in settings (mainly for sites with PHP < 4.3.3 and slow search)

View differences:

search_modext.php
95 95
	// stop-sign: .!?; + DOUBLE EXCLAMATION MARK - INTERROBANG - EXCLAMATION QUESTION MARK - QUESTION EXCLAMATION MARK - DOUBLE QUESTION MARK - HALFWIDTH IDEOGRAPHIC FULL STOP - IDEOGRAPHIC FULL STOP - IDEOGRAPHIC COMMA
96 96
	$str2=".!?;"."\xE2\x80\xBC"."\xE2\x80\xBD"."\xE2\x81\x89"."\xE2\x81\x88"."\xE2\x81\x87"."\xEF\xBD\xA1"."\xE3\x80\x82"."\xE3\x80\x81";
97 97
	$regex='/(?:^|\b|['.$str1.'])([^'.$str1.']{0,200}?'.$word.'[^'.$str2.']{0,200}(?:['.$str2.']|\b|$))/Sisu';
98
	if(version_compare(PHP_VERSION, '4.3.3', '>=') == 1) {
98
	if(version_compare(PHP_VERSION, '4.3.3', '>=')) {
99 99
		// jump from match to match, get excerpt, stop if $max_excerpt_num is reached
100 100
		$last_end = 0; $offset = 0;
101 101
		while(preg_match('/'.$word.'/Sisu', $text, $match_array, PREG_OFFSET_CAPTURE, $last_end)) {
......
232 232
		{ return false; }
233 233
	if($mod_no_highlight) // no highlighting
234 234
		{ $mod_page_link_target = "&amp;nohighlight=1".$mod_page_link_target; }
235

  
236 235
	// clean the text:
237 236
	$mod_text = str_replace(array("\x0D","\x0A"), ' ', $mod_text);
238 237
	$mod_text = preg_replace('#<(!--.*--|style.*</style|script.*</script)>#SiU', ' ', $mod_text);

Also available in: Unified diff