mirror of
https://github.com/friendica/friendica
synced 2024-11-18 13:43:42 +00:00
Improved link removal
This commit is contained in:
parent
b2758f2cdd
commit
84b38beb9a
2 changed files with 3 additions and 0 deletions
|
@ -1113,6 +1113,7 @@ class BBCode
|
|||
public static function removeLinks(string $bbcode): string
|
||||
{
|
||||
DI::profiler()->startRecording('rendering');
|
||||
$bbcode = preg_replace("/\[img\=([0-9]*)x([0-9]*)\](.*?)\[\/img\]/ism", ' ', $bbcode);
|
||||
$bbcode = preg_replace("/\[img\=(.*?)\](.*?)\[\/img\]/ism", ' $1 ', $bbcode);
|
||||
$bbcode = preg_replace("/\[img.*?\[\/img\]/ism", ' ', $bbcode);
|
||||
|
||||
|
|
|
@ -35,6 +35,7 @@ use Friendica\Model\Verb;
|
|||
use Friendica\Protocol\Activity;
|
||||
use Friendica\Protocol\Relay;
|
||||
use Friendica\Util\DateTimeFormat;
|
||||
use Friendica\Util\Strings;
|
||||
|
||||
// Channel
|
||||
|
||||
|
@ -161,6 +162,7 @@ class Engagement
|
|||
|
||||
$body = Post\Media::addAttachmentsToBody($item['uri-id'], $body, [Post\Media::IMAGE]);
|
||||
$text = BBCode::toPlaintext($body, false);
|
||||
$text = preg_replace(Strings::autoLinkRegEx(), '', $text);
|
||||
|
||||
do {
|
||||
$oldtext = $text;
|
||||
|
|
Loading…
Reference in a new issue