Copy codeThe Code is as follows :/**
+ ----------------------------------------------------------
* UBB Parsing
+ ----------------------------------------------------------
* @ Return string
+ ----------------------------------------------------------
*/
Function ubb ($ Text ){
$ Text = trim ($ Text );
$ Text = ereg_replace ("\ n", "<br>", $ Text );
$ Text = preg_replace ("// \ t/is", "", $ Text );
$ Text = preg_replace ("/\ [hr \]/is", "$ Text = preg_replace ("/\ [separator \]/is", "<br/>", $ Text );
$ Text = preg_replace ("/\ [h1 \] (. + ?) \ [\/H1 \]/is "," $ Text = preg_replace ("/\ [h2 \] (. + ?) \ [\/H2 \]/is "," $ Text = preg_replace ("/\ [h3 \] (. + ?) \ [\/H3 \]/is ","
$ Text = preg_replace ("/\ [h4 \] (. + ?) \ [\/H4 \]/is "," $ Text = preg_replace ("/\ [h5 \] (. + ?) \ [\/H5 \]/is "," $ Text = preg_replace ("/\ [h6 \] (. + ?) \ [\/H6 \]/is "," $ Text = preg_replace ("/\ [center \] (. + ?) \ [\/Center \]/is "," <center> \ 1 </center> ", $ Text );
// $ Text = preg_replace ("/\ [url = ([^ \ [] *) \] (. + ?) \ [\/Url \]/is "," <a href = \ 1 target = '_ blank'> \ 2 </a> ", $ Text );
$ Text = preg_replace ("/\ [url \] (. + ?) \ [\/Url \]/is "," <a href = \ "\ 1 \" target = '_ blank'> \ 1 </a> ", $ Text );
$ Text = preg_replace ("/\ [url = (http: \/. + ?) \] (. + ?) \ [\/Url \]/is "," <a href = '\ 1' target =' _ blank '> \ 2 </a> ", $ Text );
$ Text = preg_replace ("/\ [url = (. + ?) \] (. + ?) \ [\/Url \]/is "," <a href =\\ 1> \ 2 </a> ", $ Text );
$ Text = preg_replace ("/\ [img \] (. + ?) \ [\/Img \]/is "," ", $ Text );
$ Text = preg_replace ("/\ [img \ s (. + ?) \] (. + ?) \ [\/Img \]/is "," ", $ Text );
$ Text = preg_replace ("/\ [color = (. + ?) \] (. + ?) \ [\/Color \]/is "," <font color = \ 1> \ 2 </font> ", $ Text );
$ Text = preg_replace ("/\ [colorTxt \] (. + ?) \ [\/ColorTxt \]/eis "," color_txt ('\ 1') ", $ Text );
$ Text = preg_replace ("/\ [style = (. + ?) \] (. + ?) \ [\/Style \]/is "," <div class = '\ 1'> \ 2 </div> ", $ Text );
$ Text = preg_replace ("/\ [size = (. + ?) \] (. + ?) \ [\/Size \]/is "," <font size = \ 1> \ 2 </font> ", $ Text );
$ Text = preg_replace ("/\ [sup \] (. + ?) \ [\/Sup \]/is "," <sup> \ 1 </sup> ", $ Text );
$ Text = preg_replace ("/\ [sub \] (. + ?) \ [\/Sub \]/is "," <sub> \ 1 </sub> ", $ Text );
$ Text = preg_replace ("/\ [pre \] (. + ?) \ [\/Pre \]/is "," <pre >\\ 1 </pre> ", $ Text );
$ Text = preg_replace ("/\ [emot \] (. + ?) \ [\/Emot \]/eis "," emot ('\ 1') ", $ Text );
$ Text = preg_replace ("/\ [email \] (. + ?) \ [\/Email \]/is "," <a href = 'mailto: \ 1'> \ 1 </a> ", $ Text );
$ Text = preg_replace ("/\ [I \] (. + ?) \ [\/I \]/is "," <I >\\ 1 </I> ", $ Text );
$ Text = preg_replace ("/\ [u \] (. + ?) \ [\/U \]/is "," <u >\\ 1 </u> ", $ Text );
$ Text = preg_replace ("/\ [B \] (. + ?) \ [\/B \]/is "," <B> \ 1 </B> ", $ Text );
$ Text = preg_replace ("/\ [quote \] (. + ?) \ [\/Quote \]/is "," <blockquote> reference: <div style = 'border: 1px solid silver; background: # EFFFDF; color: #393939; padding: 5px '> \ 1 </div> </blockquote> ", $ Text );
$ Text = preg_replace ("/\ [code \] (. + ?) \ [\/Code \]/eis "," highlight_code ('\ 1') ", $ Text );
$ Text = preg_replace ("/\ [php \] (. + ?) \ [\/Php \]/eis "," highlight_code ('\ 1') ", $ Text );
$ Text = preg_replace ("/\ [sig \] (. + ?) \ [\/Sig \]/is "," <div style = 'text-align: left; color: darkgreen; margin-left: 5% '> <br> ------------------------ <br> \ 1 <br> -------------------------- </div> ", $ Text );
Return $ Text;
}