mirror of
https://github.com/friendica/friendica
synced 2024-11-18 15:03:41 +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
|
public static function removeLinks(string $bbcode): string
|
||||||
{
|
{
|
||||||
DI::profiler()->startRecording('rendering');
|
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", ' $1 ', $bbcode);
|
||||||
$bbcode = preg_replace("/\[img.*?\[\/img\]/ism", ' ', $bbcode);
|
$bbcode = preg_replace("/\[img.*?\[\/img\]/ism", ' ', $bbcode);
|
||||||
|
|
||||||
|
|
|
@ -35,6 +35,7 @@ use Friendica\Model\Verb;
|
||||||
use Friendica\Protocol\Activity;
|
use Friendica\Protocol\Activity;
|
||||||
use Friendica\Protocol\Relay;
|
use Friendica\Protocol\Relay;
|
||||||
use Friendica\Util\DateTimeFormat;
|
use Friendica\Util\DateTimeFormat;
|
||||||
|
use Friendica\Util\Strings;
|
||||||
|
|
||||||
// Channel
|
// Channel
|
||||||
|
|
||||||
|
@ -161,6 +162,7 @@ class Engagement
|
||||||
|
|
||||||
$body = Post\Media::addAttachmentsToBody($item['uri-id'], $body, [Post\Media::IMAGE]);
|
$body = Post\Media::addAttachmentsToBody($item['uri-id'], $body, [Post\Media::IMAGE]);
|
||||||
$text = BBCode::toPlaintext($body, false);
|
$text = BBCode::toPlaintext($body, false);
|
||||||
|
$text = preg_replace(Strings::autoLinkRegEx(), '', $text);
|
||||||
|
|
||||||
do {
|
do {
|
||||||
$oldtext = $text;
|
$oldtext = $text;
|
||||||
|
|
Loading…
Reference in a new issue