Copy CodeThe code is as follows:
/*
PHP UBB Code Editor
*/
function Get_ubb ($ubb) {
$ubb =preg_replace ("/([b]) (. *) ([/b])/", "
\2", $ubb);//replace the B bold word
$ubb =preg_replace ("/([I]) (. *) ([/I])/", "
\2", $ubb);
$ubb =preg_replace ("/([u]) (. *) ([/U])/", "
\2", $ubb);
$ubb =preg_replace ("/([LEF]) (. *) ([/lef])/", "\2", $ubb);
$ubb =preg_replace ("/([MID]) (. *) ([/mid])/", "\2", $ubb);
$ubb =preg_replace ("/[RIG]" (. *) ([/rig])/"," \2 ", $ubb);
$ubb =preg_replace ("/([LINK]) (. *) ([/link])/", "\2", $ubb);
$ubb =preg_replace ("/([Email]) (. *) ([/email])/", "\2", $ubb);
$ubb =preg_replace ("/([IMAGE]) (. *) ([/image])/", "", $ubb);
$ubb =preg_replace ("/([FLASH]) (. *) ([/flash])/", " ", $ubb);
$ubb =preg_replace ("/([MUSIC]) (. *) ([/music])/", " ", $ubb);
$ubb =preg_replace ("/([PHOTO name=) ([0-9]*) (])/", "", $ubb);
$ubb =preg_replace ("/([font=) (. { 1,10}) (]) (. *) ([/font])/"," \4 ", $ubb);
$ubb =preg_replace ("/([font-size=) ([0-9]*) (]) (. *) ([/font-size])/", "\4", $ubb);
$ubb =preg_replace ("/([font-color=) (. { 1,10}) (]) (. *) ([/font-color])/"," \4 ", $ubb);
$ubb =preg_replace ("/([]) (. *) ([/])/", "", $ubb);
return $ubb;
}
$str =get_ubb ($_post[' cont ');
$str = "[font= blackbody]asdasdasdasdas[/font]";
echo Get_ubb ($STR);
?>
http://www.bkjia.com/PHPjc/325688.html www.bkjia.com true http://www.bkjia.com/PHPjc/325688.html techarticle Copy the code as follows: PHP/* PHP UBB Code Editor */function Get_ubb ($ubb) {$ubb =preg_replace ("/([b]) (. *) ([/b])/", "b\2/b", $ubb); Replace B bold $ubb =preg_replace ("/([I ...