linkify bugfix

This commit is contained in:
troy 2021-08-07 09:10:26 +02:00
parent 0a96927e50
commit 051747f114

View File

@ -258,8 +258,8 @@ function onlySimpleHTML($s) {
return $s; return $s;
} }
function linkify($input) { function linkify($input) {
$pattern = '@(http(s)?://)?(([a-zA-Z])([-\w]+\.)+([^\s\.]+[^\s]*)+[^,.\s])@'; $pattern = '@(http(s)?://[a-zA-Z0-9/\.\#\-\_]*)@';
return $output = preg_replace ( $pattern, '<a href="http$2://$3">$0</a>', $input ); return $output = preg_replace ( $pattern, '<a href="$1">$1</a>', $input );
} }
function inStr($needle, $haystack) { function inStr($needle, $haystack) {
if (strpos ( $haystack, $needle ) !== false) { if (strpos ( $haystack, $needle ) !== false) {