Browse Source

fix link replacement

main
ghost 3 years ago
parent
commit
22fe7b3610
  1. 2
      src/system/helper/format.php

2
src/system/helper/format.php

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

Loading…
Cancel
Save