This project is read-only.

Looking for a BBCode parser (php)

May 4, 2011 at 4:52 PM

First of all - thank you for this great script. So far I was using a TinyMCE on my website but the problem was html tags. Many users are like children and make their profile texts like Christmas trees and usualy they copy formated texts somewhere. It leads the situation that some texts contains 90% of useless html tags like:


(the same as in this forum if you look at formatted text.)



WYSIWYG BBCode Editor is great - it allows to format texts in much cleaner way.


What I need is help to parse the BBCode. This is the function what I use:



function bbcode ($message) {
$search = array(
$replace = array(
'<span style=\"color:rgb\\1\">\\2</span>',
'<span class=\"quote">\\1</span>',
return preg_replace($search , $replace, $message);

It works but not always. For example, from this:



I get:



  • asasasas
  • asasas [li]asasa[/li ]




There are also problems to parse BBCode like this:


[b][color=rgb(102, 0, 102)]te[color=rgb(102, 153, 51)]s[/color]t[/color][/b]


where the result is:


te[color=rgb(102, 153, 51)]st[/color]


Where can I get a good BBCode parser? Can somebody help? I will pay some money if it's  necessary.