Forum Moderators: coopster
I have a bunch of self-written libraries that allow me to deploy CMS-ish features (news, blogs, file libraries, user management, etc) on the sites I design. When I need something that functions like the products already out there, I don't want to re-invent the wheel.
And so I need something that parses "bbcode" or whatever it's called that allows forum users to do certain formatting things without allowing them to enter real HTML and thus perhaps mess up the entire site with weird layouts or redirects to child porn sites, etc.
I have seen the occasional bbcode parser library out there on the internet, I wondered if anyone here had experience with them and could tell me which are the best, most supported, and obviously free that I can incorporate into my libraries.
Also, along with this it would be essential to strip HTML out of a user's submissions. Is there a quick, reliable way to do that in PHP or is there a good function already written out there where I can just pass a variable to it and have it return that variable with all the HTML stripped?
TIA
You can approximate BBcode by using a series of preg_replace() expressions, e.g.$text=preg_replace("/\[b\](.*?)\[\/b\]/im","<b>$1</b>",$text);
I know that, in fact I have done that. But for a full set of codes, I would rather not re-invent the wheel if there is a good library out there, as I said above.
I found it again
HERE IT IS [pear.php.net]
further check WorldPress they offer a pluggin for BB code you might be able to tweak it
if not contact your host and ask to crank it on :)
Nowadays PEAR comes with PHP
but on your local machine you very probably need to install it
Do a search for installing PEAR on a local machine there are many good tutorials.
However this is a good topic; as you do I would like to read more feedback about your BBcode question