"; $text = str_replace($emoji["emoji"], $image, $text); } return $text; } private function removeZalgo(string $text): string { return preg_replace("%[\x{0300}-\x{036F}]{3,}%Xu", "�", $text); } function getText(bool $html = true): string { $text = htmlentities($this->getRecord()->content, ENT_DISALLOWED | ENT_XHTML); if($html) { $rel = $this->isAd() ? "sponsored" : "ugc"; $text = preg_replace( "%((https?|ftp):\/\/(\S*?\.\S*?))([\s)\[\]{},;\"\':<]|\.\s|$)%", "$3$4", $text ); $text = preg_replace("%@(id|club)([0-9]++) \(([\p{L} 0-9]+)\)%Xu", "[$1$2|$3]", $text); $text = preg_replace("%@(id|club)([0-9]++)%Xu", "[$1$2|@$1$2]", $text); $text = preg_replace("%\[(id|club)([0-9]++)\|([\p{L} 0-9@]+)\]%Xu", "$3", $text); $text = preg_replace("%(#([\p{L}_-]++[0-9]*[\p{L}_-]*))%Xu", "$1", $text); $text = $this->formatEmojis($text); $text = $this->removeZalgo($text); $text = nl2br($text); } return $text; } }