60 ? substr($url, 0, 57) . '...' : $url; return '' . $displayUrl . ''; }, $text); // 3. Converte quebras de linha em
$text = nl2br($text); return $text; } /** * Verifica se o conteúdo parece ser HTML (do Quill editor) * * @param string $text Texto a verificar * @return bool True se parece ser HTML */ private static function isHtmlContent(string $text): bool { // Verifica se contém tags HTML comuns do Quill return preg_match('/<(p|div|br|strong|em|u|a|ul|ol|li|h[1-6]|span|blockquote)[^>]*>/i', $text) === 1; } /** * Purifica HTML mantendo apenas tags seguras * * @param string $html HTML a ser purificado * @return string HTML purificado */ private static function purifyHtml(string $html): string { // Tags permitidas do Quill editor $allowedTags = '