Avoid proxyfying images that are removed or replaced later

This commit is contained in:
Michael 2021-07-05 07:00:35 +00:00
parent a5176cb841
commit 90588ddb8e
5 changed files with 8 additions and 7 deletions

View file

@ -433,6 +433,10 @@ class BBCode
*/
public static function toPlaintext($text, $keep_urls = true)
{
// Remove pictures in advance to avoid unneeded proxy calls
$text = preg_replace("/\[img\=(.*?)\](.*?)\[\/img\]/ism", ' $2 ', $text);
$text = preg_replace("/\[img.*?\[\/img\]/ism", ' ', $text);
$naked_text = HTML::toPlaintext(self::convert($text, false, 0, true), 0, !$keep_urls);
return $naked_text;