Ec (2); phpubb to html, html to ubb Code functionhtmlToUBB ($ str) {& nbsp; $ strpreg_replace (& quot; & lt; img [^ & gt;] + src & quot; ([^ & quot;] +) & quot; [^ & gt;] * & gt; I & quot;, & quot; [img] $1 [img] & quot;, $ str); & nbs script ec (2); script
Convert php ubb to html and html to ubb Code
Function htmlToUBB ($ str)
{
$ Str = preg_replace ("/] + src =" ([^ "] +)" [^>] *>/I ", "[img] $1 [/img]", $ str );
$ Str = preg_replace ("/ ] + Src = "([^"] +) "[^>] *>/I "," [video] $1 [/video] ", $ str );
Return $ str;
}
Function UBB ($ str)
{
$ Auto_arr = array (
"/(? <= [^] A-z0-9-= "'\/]) (https? | Ftp | mms | rtsp): // ([a-z0-9/-_ + = .~! % @? # % &;: $ \ │] +)/I ",
"/(? <= [^] A-z0-9 /-_.~? =:.]) ([_ A-z0-9-] + (. [_ a-z0-9-] +) * @ [a-z0-9-] + (. [a-z0-9-] + )*(. [a-z] {2, 4})/I ",
"/[Img] (. + ?) [/Img]/is ",
"/[Video] (. + ?) [/Video]/is"
);
$ Auto_url = array (
'\ 1 \ 3 ',
'\ 0 ',
'',
''
);
$ Str = preg_replace ($ auto_arr, $ auto_url, "". $ str );
$ Str = nl2br ($ str );
Return $ str;
}