Frank
Neues Mitglied
Hi Community,
Wie bekomme ich es hin,
das bei der umwandlung des BBCodes zwischen [NOPARSE][NOPARSE][/NOPARSE][/NOPARSE] keine BBCodes umgewandelt werden?
Mein jetziger "BBCode-Interpreter"
Wie bekomme ich es hin,
das bei der umwandlung des BBCodes zwischen [NOPARSE][NOPARSE][/NOPARSE][/NOPARSE] keine BBCodes umgewandelt werden?
Mein jetziger "BBCode-Interpreter"
PHP:
function bbcode($content,$html = 0,$nl2br = 1)
{
if($html == 0)
{
$content = strip_tags($content);
}
$content = stripslashes($content);
$content = preg_replace("#\[url\]http://(.*?)\[img\]http://(.*?)\[/img\]\[/url\]#si", "<a href=\"http://\\1\" target=\"_blank\"><img src=\"http://\\2\" border=\"0\"></a>", $content);
$content = preg_replace("#\[url\]www.(.*?)\[img\]www.(.*?)\[/img\]\[/url\]#si", "<a href=\"http://www.\\1\" target=\"_blank\"><img src=\"http://www.\\2\" border=\"0\"></a>", $content);
$content = preg_replace("#\[url=http://(.*?)\]\[img\]http://(.*?)\[/img\]\[/url\]#si", "<a href=\"http://\\1\" target=\"_blank\"><img src=\"http://\\2\" border=\"0\"></a>", $content);
$content = preg_replace("#\[url=www.(.*?)\]\[img\]www.(.*?)\[/img\]\[/url\]#si", "<a href=\"http://www.\\1\" target=\"_blank\"><img src=\"http://\\2\" border=\"0\"></a>", $content);
$content = preg_replace("#\[url\]http://(.*?)\[/url\]#si", "<a href=\"http://\\1\" target=\"_blank\">\\1</a>", $content);
$content = preg_replace("#\[url\]www.(.*?)\[/url\]#si", "<a href=\"http://\\1\" target=\"_blank\">http://www.\\1</a>", $content);
$content = preg_replace("#\[url=http://(.*?)\](.*?)\[/url\]#si", "<a href=\"http://\\1\" target=\"_blank\">\\2</a>", $content);
$content = preg_replace("#\[url=www.(.*?)\](.*?)\[/url\]#si", "<a href=\"http://www.\\1\" target=\"_blank\">\\2</a>", $content);
$content = preg_replace("#\[url=(.*?)\](.*?)\[/url\]#si", "<a href=\"\\1\">\\2</a>", $content); // relativer link
$content = preg_replace("#\[url\](.*?)\[/url\]#si", "<a href=\"\\1\">\\1</a>", $content); // relativer link
$content = preg_replace("#(^|[^\"=]{1})(http://|https://|ftp://|mailto:|news:)([^\s<>]+)([\s\n<>]|$)#sm","\\1<a href=\"\\2\\3\" target=\"_blank\">\\3</a>\\4",$content);
$content = preg_replace("#\[email\](.*?)\[/email\]#si", "<a href=\"mailto:\\1\">\\1</a>", $content);
$content = preg_replace("#\[email=(.*?)\](.*?)\[/email\]#si", "<a href=\"mailto:\\1\">\\2</a>", $content);
$content = preg_replace("#\[size=(.*?)\](.*?)\[/size\]#si", "<font size=\"\\1px\">\\2</font>", $content);
$content = preg_replace("#\[color=(.*?)\](.*?)\[/color\]#si", "<font color=\"\\1\">\\2</font>", $content);
$content = preg_replace("#\[font=(.*?)\](.*?)\[/font\]#si", "<font face=\"\\1\">\\2</font>", $content);
$content = preg_replace("#\[align=(.*?)\](.*?)\[/align\]#si", "<div align=\"\\1\">\\2</div>", $content);
$content = preg_replace("#\[quote\]#si", "<div style='background-color:#888888;color:#222222;border:1px solid black; padding:2px;'><b>Zitat:</b><br>", $content);
$content = preg_replace("#\[/quote\]#si", "</div>", $content);
$content = preg_replace("#\[b\](.*?)\[/b\]#si", "<b>\\1</b>",$content);
$content = preg_replace("#\[i\](.*?)\[/i\]#si", "<i>\\1</i>",$content);
$content = preg_replace("#\[u\](.*?)\[/u\]#si", "<u>\\1</u>",$content);
$content = preg_replace("#\[s\](.*?)\[/s\]#si", "<s>\\1</s>",$content);
$content = preg_replace("#\[pre\](.*?)\[/pre\]#si","<pre>\\1</pre>", $content);
$content = preg_replace("#\[list\](.*?)\[/list\]#si", "<ul>\\1</ul>", $content);
$content = preg_replace("#\[list=1\](.*?)\[/list=1\]#si", "<ol>\\1</ol>", $content);
$content = preg_replace("#\[list=a\](.*?)\[/list=a\]#si", "<ol type=\"a\">\\1</ol>", $content);
$content = preg_replace("#\[\*\](.*?)\[/\*\]#si", "<li>\\1</li>", $content);
$content = preg_replace("#\[br]#si", "<br>", $content);
$content = preg_replace("#\[hr]#si", "<hr noshade color=\"$border\" size=\"1\">", $content);
$content = preg_replace("#\[center]#si", "<center>", $content);
$content = preg_replace("#\[/center]#si", "</center>", $content);
$content = preg_replace("~:\)~isU", "<img src=\"images/smileys/smile.gif\">", $content);
$content = preg_replace("~:D~isU", "<img src=\"images/smileys/biggrin.gif\">", $content);
$content = preg_replace("~;\)~isU", '<img src="images/smileys/wink.gif">', $content);
$content = preg_replace("~8\)~isU", '<img src="images/smileys/cool.gif">', $content);
$content = preg_replace("~:eek:~isU", '<img src="images/smileys/eek.gif">', $content);
$content = preg_replace("~:upset:~isU","<img src=\"images/smileys/boese.gif\">", $content);
$content = preg_replace("~:sigh:~isU", '<img src="images/smileys/frown.gif">', $content);
$content = preg_replace("~:lampe:~isU", '<img src="images/smileys/lampe.gif">', $content);
$content = preg_replace("~:good:~isU", '<img src="images/smileys/thumb_up.gif">', $content);
$content = preg_replace("~:bad:~isU", '<img src="images/smileys/thumb_down.gif">', $content);
$content = preg_replace("~\[fl:(.{2})\]~isU", '<img src="images/flags/\\1.gif">', $content);
if($nl2br == 1)
{
$content = nl2br($content);
}
return($content);
}