From 7181b05e38252f81b3bb0635e75209a5aa6c0ffe Mon Sep 17 00:00:00 2001 From: Marc Alexander Date: Tue, 9 Jul 2024 21:46:37 +0200 Subject: [PATCH] [ticket/15043] Small code cleanup PHPBB-15043 --- phpBB/includes/functions_content.php | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/phpBB/includes/functions_content.php b/phpBB/includes/functions_content.php index 25144f5af3..530b26ae75 100644 --- a/phpBB/includes/functions_content.php +++ b/phpBB/includes/functions_content.php @@ -326,7 +326,6 @@ function bump_topic_allowed($forum_id, $topic_bumped, $last_post_time, $topic_po */ function get_context(string $text, array $words, int $length = 400) { - $output = ''; $text_length = utf8_strlen($text); // Replace all spaces/invisible characters with single spaces @@ -335,7 +334,7 @@ function get_context(string $text, array $words, int $length = 400) // we need to turn the entities back into their original form, to not cut the message in between them $text = html_entity_decode($text); - // Get first ocurrence of each word + // Get first occurrence of each word $word_indizes = []; foreach ($words as $word) { @@ -374,14 +373,14 @@ function get_context(string $text, array $words, int $length = 400) $fragments[] = $fragment; $start = $indize - ($characters_per_word / 2); - // Start fragment at the begining of a word + // Start fragment at the beginning of a word $end = $start = ($start > 0) ? (utf8_strpos($text, ' ', $start - 1) + 1) : 0; } $end += $characters_per_word; // End fragment at the end of a word - $substring = utf8_substr($text, $start, $end-$start); + $substring = utf8_substr($text, $start, $end - $start); $end = $start + utf8_strrpos($substring, ' '); }