make mentions clickable

This commit is contained in:
ghost 2021-12-31 03:23:32 +02:00
parent 5e79a026e7
commit c1c44db931

View File

@ -48,6 +48,7 @@ class Format {
public static function post(string $text) {
$text = preg_replace("|@([a-zA-Z0-9_]+)|i", "<a href=\"follow/$1\">@$1</a>", $text);
$text = preg_replace("|((https?://)?([\d\w\.-]+\.[\w\.]{2,6})[^\s\]\[\<\>]*/?)|i", "<a href=\"$1\" target=\"_blank\">$3</a>", $text);
$text = nl2br($text);