MyBB Community Forums

Full Version: Force close ALL BBCode?
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2
preg_replace('(\\[b\\].*?(\\[\\/b\\])',"<strong>${1}</strong>",$string);

Might work. maybe not.
(2012-01-05, 02:19 PM)itheme Wrote: [ -> ]Yo,

So I know have all my HTML stripped and things but now I need to force close all tags for instance if the user doesn't close it won't make the whole page below bold is there anyway to do this?
Got it now
$txt = str_replace("[b]", "<b>", $txt."</b>");
$txt = str_replace("
", "</b>", $txt);
should work right?

Also, you should place the code bit in [ php] tags to stop mybb parsing it Smile

EG:
	$txt = str_replace("[b]", "<b>", $txt."</b>");
	$txt = str_replace("[/b]", "</b>", $txt);
Pages: 1 2