mirror of
https://github.com/openvk/openvk
synced 2024-12-23 00:51:03 +03:00
Further improvements to TRichText
Fix link parsing + remove zalgo completely
This commit is contained in:
parent
56fe715bce
commit
6abdb0d593
1 changed files with 2 additions and 2 deletions
|
@ -36,7 +36,7 @@ trait TRichText
|
||||||
"%(([A-z]++):\/\/(\S*?\.\S*?))([\s)\[\]{},\"\'<]|\.\s|$)%",
|
"%(([A-z]++):\/\/(\S*?\.\S*?))([\s)\[\]{},\"\'<]|\.\s|$)%",
|
||||||
(function (array $matches): string {
|
(function (array $matches): string {
|
||||||
$href = str_replace("#", "#", $matches[1]);
|
$href = str_replace("#", "#", $matches[1]);
|
||||||
$href = rawurlencode(str_replace(";", ";", $matches[1]));
|
$href = rawurlencode(str_replace(";", ";", $href));
|
||||||
$link = str_replace("#", "#", $matches[3]);
|
$link = str_replace("#", "#", $matches[3]);
|
||||||
$link = str_replace(";", ";", $link);
|
$link = str_replace(";", ";", $link);
|
||||||
$rel = $this->isAd() ? "sponsored" : "ugc";
|
$rel = $this->isAd() ? "sponsored" : "ugc";
|
||||||
|
@ -49,7 +49,7 @@ trait TRichText
|
||||||
|
|
||||||
private function removeZalgo(string $text): string
|
private function removeZalgo(string $text): string
|
||||||
{
|
{
|
||||||
return preg_replace("%\p{M}{3,}%Xu", "<EFBFBD>", $text);
|
return preg_replace("%\p{M}{3,}%Xu", "", $text);
|
||||||
}
|
}
|
||||||
|
|
||||||
function resolveMentions(array $skipUsers = []): \Traversable
|
function resolveMentions(array $skipUsers = []): \Traversable
|
||||||
|
|
Loading…
Reference in a new issue