Merge pull request #6 from falcon4fun/patch-1

HTTPS links highlighting
This commit is contained in:
Fedor A. Fetisov 2013-09-24 04:56:41 -07:00
commit 36f8f68f9f

View File

@ -85,7 +85,7 @@ function post_message($threadid, $kind, $message, $from = null, $agentid = null)
function prepare_html_message($text)
{
$escaped_text = safe_htmlspecialchars($text);
$text_w_links = preg_replace('/(http|ftp):\/\/\S*/', '<a href="$0" target="_blank">$0</a>', $escaped_text);
$text_w_links = preg_replace('/(?i)(http|https|ftp):\/\/\S*/', '<a href="$0" target="_blank">$0</a>', $escaped_text);
$multiline = str_replace("\n", "<br/>", $text_w_links);
return $multiline;
}