1
0
mirror of https://github.com/phpbb/phpbb.git synced 2025-08-05 00:07:44 +02:00

lessons are made for those gaining experience from them...

git-svn-id: file:///svn/phpbb/branches/phpBB-2_0_0@4186 89ea8834-ac86-4346-8a33-228a782c2dd0
This commit is contained in:
Meik Sievertsen
2003-06-30 17:18:38 +00:00
parent 305eb6c34a
commit 08da796e8e
6 changed files with 28 additions and 43 deletions

View File

@@ -58,16 +58,7 @@ function clean_words($mode, &$entry, &$stopword_list, &$synonym_list)
$entry = str_replace('*', ' ', $entry);
// 'words' that consist of <3 or >20 characters are removed.
$entry = explode(' ', $entry);
for ($i = 0; $i < sizeof($entry); $i++)
{
$entry[$i] = trim($entry[$i]);
if ((strlen($entry[$i]) < 3) || (strlen($entry[$i]) > 20))
{
$entry[$i] = '';
}
}
$entry = implode(' ', $entry);
$entry = preg_replace('/[ ]([\S]{1,2}|[\S]{21,})[ ]/',' ', $entry);
}
if ( !empty($stopword_list) )
@@ -107,17 +98,8 @@ function split_words(&$entry, $mode = 'post')
return $split_entries[1];
*/
$split_entries = array();
$split = explode(' ', $entry);
for ($i = 0; $i < count($split); $i++)
{
if (trim($split[$i]) != '')
{
$split_entries[] = trim($split[$i]);
}
}
return $split_entries;
// Trim 1+ spaces to one space and split this trimmed string into words.
return explode(' ', trim(preg_replace('#\s+#', ' ', $entry)));
}
function add_search_words($mode, $post_id, $post_text, $post_title = '')