mirror of
https://git.friendi.ca/friendica/friendica.git
synced 2025-06-07 22:17:17 +02:00
Improved link detection
This commit is contained in:
parent
af5fa6ce00
commit
77e1ec6df2
3 changed files with 36 additions and 7 deletions
|
@ -253,10 +253,15 @@ class PageInfo
|
|||
// Fix for Mastodon where the mentions are in a different format
|
||||
$body = preg_replace("~\[url=($URLSearchString)]([#!@])(.*?)\[/url]~is", '$2[url=$1]$3[/url]', $body);
|
||||
|
||||
preg_match("~(?<![!#@])\[url]($URLSearchString)\[/url]$~is", $body, $matches);
|
||||
// Remove all hashtags and mentions
|
||||
$body = preg_replace("/([#@!])\[url\=(.*?)\](.*?)\[\/url\]/ism", '', $body);
|
||||
|
||||
// Search for pure links
|
||||
preg_match("/\[url\](.*?)\[\/url\]/ism", $body, $matches);
|
||||
|
||||
if (!$matches) {
|
||||
preg_match("~(?<![!#@])\[url=($URLSearchString)].*\[/url]$~is", $body, $matches);
|
||||
// Search for links with descriptions
|
||||
preg_match("/\[url\=(.*?)\].*?\[\/url\]/ism", $body, $matches);
|
||||
}
|
||||
|
||||
if (!$matches && $searchNakedUrls) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue