From 0c30124dbdc6f3236b1a723fbc4103e5c79f7322 Mon Sep 17 00:00:00 2001 From: shish Date: Fri, 18 May 2007 00:55:47 +0000 Subject: [PATCH] BBCode URL support git-svn-id: file:///home/shish/svn/shimmie2/trunk@117 7f39781d-f577-437e-ae19-be835c7a54ca --- core/util.inc.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/core/util.inc.php b/core/util.inc.php index 4b747190..aa272703 100644 --- a/core/util.inc.php +++ b/core/util.inc.php @@ -110,6 +110,8 @@ function bbcode_to_html($text) { $text = preg_replace("/\[code\](.*?)\[\/code\]/s", "
\\1
", $text); $text = preg_replace("/>>(\d+)/s", ">>\\1", $text); + $text = preg_replace("/\[url=((?:https?|ftp|irc):\/\/.*?)\](.*?)\[\/url\]/s", "\\2", $text); + $text = preg_replace("/\[url\]((?:https?|ftp|irc):\/\/.*?)\[\/url\]/s", "\\1", $text); $text = preg_replace("/\[\[(.*?)\]\]/s", "\\1", $text); $text = str_replace("\n", "\n
", $text); @@ -123,6 +125,8 @@ function bbcode_to_text($text) { $text = preg_replace("/\[i\](.*?)\[\/i\]/s", "\\1", $text); $text = preg_replace("/\[u\](.*?)\[\/u\]/s", "\\1", $text); $text = preg_replace("/\[code\](.*?)\[\/code\]/s", "\\1", $text); + $text = preg_replace("/\[url=(.*?)\](.*?)\[\/url\]/s", "\\2", $text); + $text = preg_replace("/\[url\](.*?)\[\/url\]/s", "\\1", $text); $text = preg_replace("/\[\[(.*?)\]\]/s", "\\1", $text); return $text; }