mirror of
https://github.com/openvk/openvk
synced 2024-11-11 01:19:53 +03:00
parent
217463e554
commit
cfb8b68fc0
1 changed files with 3 additions and 1 deletions
|
@ -32,10 +32,12 @@ trait TRichText
|
|||
private function formatLinks(string &$text): string
|
||||
{
|
||||
return preg_replace_callback(
|
||||
"%(([A-z]++):\/\/(\S*?\.\S*?))([\s)\[\]{},;\"\'<]|\.\s|$)%",
|
||||
"%(([A-z]++):\/\/(\S*?\.\S*?))([\s)\[\]{},\"\'<]|\.\s|$)%",
|
||||
(function (array $matches): string {
|
||||
$href = str_replace("#", "#", $matches[1]);
|
||||
$href = str_replace(";", ";", $matches[1]);
|
||||
$link = str_replace("#", "#", $matches[3]);
|
||||
$link = str_replace(";", ";", $matches[3]);
|
||||
$rel = $this->isAd() ? "sponsored" : "ugc";
|
||||
|
||||
return "<a href='$href' rel='$rel' target='_blank'>$link</a>" . htmlentities($matches[4]);
|
||||
|
|
Loading…
Reference in a new issue