|
|
Die Funktion code2html() wandelt Platzhalter in HTML Code um (Stichwort: Wiki Syntax).
|
|
|
code2html
function code2html($text) { $text=eregi_replace("\[B\]([^\[]+)\[/B\]", "<b>\\1</b>", $text); $text=eregi_replace("\[I\]([^[]+)\[/I\]", "<i>\\1</i>", $text); $text=eregi_replace("\[URL\]www.([^\[]+)\[/URL\]", "<a href=\"http://www.\\1\" target=\"_blank\">www.\\1</a>", $text); $text=eregi_replace("\[URL\]([^[]+)\[/URL\]", "<a href=\"\\1\" target=\"_blank\">\\1</a>", $text); $text=eregi_replace("\[MAIL\]([^[]+)\[/MAIL\]", "<a href=\"mailto:\\1\">\\1</a>", $text); $text=eregi_replace("\[URL=http://([^[]+)\]([^[]+)\[/URL\]", "<a href=\"http://\\1\" target=\"_blank\">\\2</a>", $text); $text=eregi_replace("\[URL=([^[]+)\]([^[]+)\[/URL\]", "<a href=\"http://\\1\" target=\"_blank\">\\2</a>", $text); return $text; }
|
|
|
|