mirror of
https://github.com/phpbb/phpbb.git
synced 2025-08-06 08:47:45 +02:00
message
git-svn-id: file:///svn/phpbb/trunk@6569 89ea8834-ac86-4346-8a33-228a782c2dd0
This commit is contained in:
@@ -2085,7 +2085,7 @@ function bump_topic_allowed($forum_id, $topic_bumped, $last_post_time, $topic_po
|
||||
* Generates a text with approx. the specified length which contains the specified words and their context
|
||||
*
|
||||
* @param string $text The full text from which context shall be extracted
|
||||
* @param string $words An array of words which should be contained in the result, * is allowed as a wildcard
|
||||
* @param string $words An array of words which should be contained in the result, has to be a valid part of a PCRE pattern (escape with preg_quote!)
|
||||
* @param int $length The desired length of the resulting text, however the result might be shorter or longer than this value
|
||||
*
|
||||
* @return string Context of the specified words seperated by "..."
|
||||
@@ -2102,7 +2102,7 @@ function get_context($text, $words, $length = 400)
|
||||
// find the starting indizes of all words
|
||||
foreach ($words as $word)
|
||||
{
|
||||
if (preg_match('#(?:[^\w]|^)(' . str_replace('\*', '\w*?', preg_quote($word, '#')) . ')(?:[^\w]|$)#i', $text, $match))
|
||||
if (preg_match('#(?:[^\w]|^)(' . $word . ')(?:[^\w]|$)#i', $text, $match))
|
||||
{
|
||||
$pos = strpos($text, $match[1]);
|
||||
if ($pos !== false)
|
||||
|
Reference in New Issue
Block a user