Force close ALL BBCode?
#11
preg_replace('(\\[b\\].*?(\\[\\/b\\])',"<strong>${1}</strong>",$string);

Might work. maybe not.
Reply
#12
(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);
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)