make plaintext urls in article content clickable
This commit is contained in:
parent
0f41fce845
commit
533c0ea6ec
|
@ -3671,6 +3671,8 @@
|
||||||
$res = preg_replace('/<img[^>]+>/is', '', $res);
|
$res = preg_replace('/<img[^>]+>/is', '', $res);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$res = rewrite_urls($res);
|
||||||
|
|
||||||
$charset_hack = '<head>
|
$charset_hack = '<head>
|
||||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
|
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
|
||||||
</head>';
|
</head>';
|
||||||
|
@ -7040,4 +7042,15 @@
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function rewrite_urls($line) {
|
||||||
|
global $url_regex;
|
||||||
|
|
||||||
|
$urls = null;
|
||||||
|
|
||||||
|
$result = preg_replace("/((?<!=.)((http|https|ftp)+):\/\/[^ ,!]+)/i",
|
||||||
|
"<a target=\"_blank\" href=\"\\1\">\\1</a>", $line);
|
||||||
|
|
||||||
|
return $result;
|
||||||
|
}
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
|
Loading…
Reference in New Issue