Home Files
Adminer
Execute Command
PHP Eval
Symlink
File Upload
Owner :
www-data
PHP Version
8.1.8
Disk Space
203.89 GB
Server Addr
171.9.3.2
Your IP
171.9.3.1
Edit File
File:
<?php class Transformar { /* string MontarLink (string texto) A função MontarLink() transforma em links as URLs iniciadas por 'http://' ou 'https://' contidas no argumento 'texto'. Se a URL tiver mais que 60 caracteres, serão exibidos os 25 primeiros, seguidos de reticências (...) e os últimos 15. IMPORTANTE: Se o link se iniciar por 'www' e não tiver 'http://' ou 'https://', a função não surtirá efeito. */ function MontarLink($texto) { if (!is_string($texto)) return $texto; $er = "/(http(s)?:\/\/(www|.*?\/)?((\.|\/)?[a-zA-Z0-9&%_?=-]+)+)/i"; preg_match_all($er, $texto, $match); foreach ($match[0] as $link) { $link = strtolower($link); $link_len = strlen($link); //troca "&" por "&", tornando o link válido pela W3C $web_link = str_replace("&", "&", $link); $texto = str_ireplace($link, "<a href=\"" . $web_link . "\" target=\"_blank\" title=\"" . $web_link . "\" rel=\"nofollow\">" . (($link_len > 60) ? substr($web_link, 0, 25) . "..." . substr($web_link, -15) : $web_link) . "</a>", $texto); } return $texto; } } ?>