BBCode URL support
git-svn-id: file:///home/shish/svn/shimmie2/trunk@117 7f39781d-f577-437e-ae19-be835c7a54ca
This commit is contained in:
parent
89b54ad6c7
commit
0c30124dbd
1 changed files with 4 additions and 0 deletions
|
@ -110,6 +110,8 @@ function bbcode_to_html($text) {
|
|||
$text = preg_replace("/\[code\](.*?)\[\/code\]/s", "<pre>\\1</pre>", $text);
|
||||
$text = preg_replace("/>>(\d+)/s",
|
||||
"<a href='".make_link("post/view/\\1")."'>>>\\1</a>", $text);
|
||||
$text = preg_replace("/\[url=((?:https?|ftp|irc):\/\/.*?)\](.*?)\[\/url\]/s", "<a href='\\1'>\\2</a>", $text);
|
||||
$text = preg_replace("/\[url\]((?:https?|ftp|irc):\/\/.*?)\[\/url\]/s", "<a href='\\1'>\\1</a>", $text);
|
||||
$text = preg_replace("/\[\[(.*?)\]\]/s",
|
||||
"<a href='".make_link("wiki/\\1")."'>\\1</a>", $text);
|
||||
$text = str_replace("\n", "\n<br>", $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;
|
||||
}
|
||||
|
|
Reference in a new issue