mirror of
https://github.com/openvk/openvk
synced 2025-03-20 00:15:19 +03:00
Fix indentation in TRichText
This commit is contained in:
parent
373513cabc
commit
1c34e51750
1 changed files with 17 additions and 16 deletions
|
@ -5,7 +5,8 @@ trait TRichText
|
||||||
{
|
{
|
||||||
private function formatEmojis(string $text): string
|
private function formatEmojis(string $text): string
|
||||||
{
|
{
|
||||||
if(iconv_strlen($this->getRecord()->content) > OPENVK_ROOT_CONF["openvk"]["preferences"]["wall"]["postSizes"]["emojiProcessingLimit"])
|
$contentColumn = property_exists($this, "overrideContentColumn") ? $this->overrideContentColumn : "content";
|
||||||
|
if(iconv_strlen($this->getRecord()->{$contentColumn}) > OPENVK_ROOT_CONF["openvk"]["preferences"]["wall"]["postSizes"]["emojiProcessingLimit"])
|
||||||
return $text;
|
return $text;
|
||||||
|
|
||||||
$emojis = \Emoji\detect_emoji($text);
|
$emojis = \Emoji\detect_emoji($text);
|
||||||
|
@ -27,20 +28,20 @@ trait TRichText
|
||||||
return $text;
|
return $text;
|
||||||
}
|
}
|
||||||
|
|
||||||
private function formatLinks(string &$text): string
|
private function formatLinks(string &$text): string
|
||||||
{
|
{
|
||||||
return preg_replace_callback(
|
return preg_replace_callback(
|
||||||
"%(([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]);
|
||||||
$link = str_replace("#", "#", $matches[3]);
|
$link = str_replace("#", "#", $matches[3]);
|
||||||
$rel = $this->isAd() ? "sponsored" : "ugc";
|
$rel = $this->isAd() ? "sponsored" : "ugc";
|
||||||
|
|
||||||
return "<a href='$href' rel='$rel' target='_blank'>$link</a>" . htmlentities($matches[4]);
|
return "<a href='$href' rel='$rel' target='_blank'>$link</a>" . htmlentities($matches[4]);
|
||||||
}),
|
}),
|
||||||
$text
|
$text
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
private function removeZalgo(string $text): string
|
private function removeZalgo(string $text): string
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue