PhpUbb code editor function code. Copy the code as follows :? Php * phpUbb code editor * functionget_ubb ($ ubb) {$ ubbpreg_replace ([B]) (. *) ([B]), B2B, $ ubb); replace B in bold $ ubbpreg_replace ([I
The code is as follows:
/*
Php Ubb code editor
*/
Function get_ubb ($ ubb ){
$ Ubb = preg_replace ("/([B]) (. *) ([/B])/","\ 2", $ Ubb); // replace B in bold
$ 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 =] asdasd
Asdasdas [/FONT]
";
Echo get_ubb ($ str );
?>
The http://www.bkjia.com/PHPjc/325688.htmlwww.bkjia.comtruehttp://www.bkjia.com/PHPjc/325688.htmlTechArticle code is as follows :? Php/* php Ubb code editor */function get_ubb ($ ubb) {$ ubb = preg_replace ("/([B]) (. *) ([/B])/"," B \ 2/B ", $ ubb ); // replace B in bold $ ubb = preg_replace ("/([I...