Advertisement
Guest User

Untitled

a guest
May 6th, 2014
247
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.65 KB | None | 0 0
  1. function bbcode($text)
  2. {
  3. $text = stripslashes($text);
  4. $text = htmlspecialchars($text); //HTML sperren
  5. $text = preg_replace("/\[B\](.*)\[\/B\]/isU","<b>$1</b>", $text);
  6. $text = preg_replace("/\[I\](.*)\[\/I\]/isU","<i>$1</i>", $text);
  7. $text = preg_replace("/\[U\](.*)\[\/U\]/isU","<u>$1</u>", $text);
  8. $text = preg_replace("/\[CENTER\](.*?)\[\/CENTER\]/isU","<center>$1</center>", $text);
  9. $text = preg_replace("/\[URL=(.*)\](.*)\[\/URL\]/isU", "<a href=\"$1\" target=\"_blank\">$2</a>", $text);
  10. $text = preg_replace("/\[URL\](.*)\[\/URL\]/isU", "<a href=\"$1\" target=\"_blank\">$1</a>", $text);
  11. $text = preg_replace("/\[EMAIL\](.*)\[\/EMAIL\]/isU", "<a href=\"mailto:$1\">$1</a>", $text);
  12. $text = preg_replace("/\[img\](.*)\[\/img\]/isU", "<img src=\"$1\" />", $text);
  13. $text = preg_replace("/\[code\](.*)\[\/code\]/isU", "<pre>$1</pre>", $text);
  14. $text = preg_replace("/\[COLOR=(.*)\](.*)\[\/COLOR\]/isU", "<font color=\"$1\">$2</font>", $text);
  15. $text = preg_replace("/\[SIZE=(.*)\](.*)\[\/SIZE\]/isU", "<font size=\"$1\">$2</font>", $text);
  16. $text = preg_replace("/\[FONT=(.*)\](.*)\[\/FONT\]/isU", "<font face=\"$1\">$2</font>", $text);
  17. $text = preg_replace("/\[LIST=(.*)\](.*)\[\/LIST\]/isU", "<ol start=\"1\" type=\"$1\">$2</ol>", $text);
  18. $text = preg_replace("/\[*\](.*)\[\/*\]/isU", "<li>$1</li>", $text);
  19. /* Smilies */
  20. $text = str_replace(":)","<img src=\"pics/smilies/smilie.gif\" />",$text);
  21. $text = str_replace(":D","<img src=\"pics/smilies/biggrin.gif\" />",$text);
  22. $text = str_replace(";)","<img src=\"pics/smilies/wink.gif\" />",$text);
  23. $text = str_replace(":o","<img src=\"pics/smilies/redface.gif\" />",$text);
  24. $text = str_replace(":?","<img src=\"pics/smilies/confused.gif\" />",$text);
  25. $text = str_replace(":(","<img src=\"pics/smilies/frown.gif\" />",$text);
  26. $text = str_replace(":P","<img src=\"pics/smilies/tongue.gif\" />",$text);
  27. $text = str_replace(";P","<img src=\"pics/smilies/tongue2.gif\" />",$text);
  28. $text = str_replace(":rolleyes:","<img src=\"pics/smilies/rolleyes.gif\" />",$text);
  29. $text = str_replace(":]","<img src=\"pics/smilies/pleased.gif\" />",$text);
  30. $text = str_replace("x(","<img src=\"pics/smilies/mad.gif\" />",$text);
  31. $text = str_replace(":evil:","<img src=\"pics/smilies/evil.gif\" />",$text);
  32. $text = str_replace("8)","<img src=\"pics/smilies/cool.gif\" />",$text);
  33. $text = str_replace(":baby:","<img src=\"pics/smilies/baby.gif\" />",$text);
  34. $text = str_replace(":happy:","<img src=\"pics/smilies/happy.gif\" />",$text);
  35. $text = nl2br($text);
  36. return $text;
  37. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement