? Phpfunctionubbcode ($ str) {$ strstr_replac...
", $ Str); $ str = preg_replace ("/\ [img = * ([0-9] *), * ([0-9] *) \] (http | https | ftp ):\/\/(. [^ \ [] *) \ [\/img \]/I "," 300) this. width = 300 \ ">", $ str); $ str = preg_replace ("/(\ [img \]) images \/face \/em (. *?) \. Gif (\ [\/img \])/I "," ", $ str); // link UBB $ str = preg_replace ("/(\ [url \]) (. [^ \ [] *) (\ [url \])/I "," \$ {1} ", $ str ); $ str = preg_replace ("/\ [url = (. [^ \ [] *) \]/I "," ", $ str); // email UBB $ str = preg_replace ("/(\ [email \]) (. *?) (\ [\/Email \])/I "," \ $ {2} ", $ str); $ str = preg_replace ("/\ [email = (. [^ \ [] *) \]/I "," ", $ str ); // qq number UBB $ str = preg_replace ("/\ [qq = ([0-9] *) \] ([0-9] *) \ [\/qq \]/I "," ", $ str); // color UBB $ str = preg_replace ("/\ [color = (. [^ \ [] *) \]/I "," ", $ str); // text font UBB $ str = preg_replace ("/\ [font = (. [^ \ [] *) \]/I "," ", $ str ); // text size UBB $ str = preg_replace ("/\ [size = ([0-9] *) \]/I", "", $ str ); $ str = preg_replace ("/\ [size = ([0-9] *) pt \]/I", "", $ str ); $ str = preg_replace ("/\ [size = ([0-9] *) px \]/I", "", $ str ); // text alignment UBB $ str = preg_replace ("/\ [align = (center | left | right) \]/I ","", $ Str); // table UBB // $ str = preg_replace ("/\ [table = (. [^ \ [] *) \]/I ","
", $ Str); // table UBB2 // $ str = preg_replace ("/\ [td = ([0-9] *), ([0-9] *), ([0-9] *) \]/I ","
", $ Str); // font skew $ str = preg_replace ("/\ [I \] (. | \ n )*?) \ [\/I \]/I ","\ $ {1}", $ Str); // FLASH animation UBB $ str = preg_replace ("/(\ [flash \]) (http :\/\/. [^ \ [] * (.swf) (\ [\/flash \])/I "," [full screen viewing]
\ $ {2}
", $ Str); $ str = preg_replace ("/(\ [flash = * ([0-9] *), * ([0-9] *) \]) (http :\/\/. [^ \ [] * (.swf) (\ [\/flash \])/I "," [full screen viewing]
\ $ {4}
", $ Str); // media play ubb $ str = preg_replace ("/\ [wmv \] (. [^ \ [] *) \ [\/wmv]/I ","", $ Str); $ str = preg_replace ("/\ [wmv = * ([0-9] *), * ([0-9] *) \] (. [^ \ [] *) \ [\/wmv]/I ","", $ Str); // REALPLAY playback UBB $ str = preg_replace ("/\ [rm \] (. [^ \ [] *) \ [\/rm]/I "," ", $ Str); $ str = preg_replace ("/\ [rm = * ([0-9] *), * ([0-9] *) \] (. [^ \ [] *) \ [\/rm]/I "," ", $ Str); $ str = str_replace (" \ r \ n "," ", $ Str); $ str = preg_replace ("/\ [rm = * ([0-9] *), * ([0-9] *) \] (. [^ \ [] *) \ [\/rm]/I "," ", $ Str);/* re. pattern =" \ [code \] (. | \ n )*?) \ [\/Code \] "Set tempcodes = re. Execute ($ str) For I = 0 To tempcodes. count-1 re. pattern =" "Tempcode = Replace (tempcodes (I )," ", Vbcrlf) $ str = replace ($ str, tempcodes (I), tempcode) next */$ searcharray = array (" [/url] ", "[/email]", "[/color]", "[/size]", "[/font]", "[/align]", "[B]", "[/B]", "[u]", "[/u]", "[list]", "[list = 1]", "[list = a]", "[list = A]", "[*]", "[/list]", "[indent]", "[/indent]", "[DISCUZ_CODE_0]", "[quote]", "[/quote]", "[tr]", "[td]", "[/td]", "[/tr]", "[/table]"); $ replacearray = array ("","","","", "","","","","","","
","
","
",""," Tip: you can modify some code before running ",""," "," |
","
| "," | ","
","
"); For ($ I = 0; $ I <count ($ searcharray); $ I ++) {$ str = str_replace ($ searcharray [$ I], $ replacearray [$ I], $ str);} return $ str;}/*'re. pattern = "\ [UPLOAD = (gif | jpg | jpeg | bmp) \] (. [^ \ [] *) (gif | jpg | jpeg | bmp) \ [\/UPLOAD \] "'$ str = re. replace ($ str ,"
Links to this topic are as follows:
Screen. width-333) this. width = screen. width-333 \ ">") 're. pattern = "\ [UPLOAD = (doc | xls | ppt | htm | swf | rar | zip | exe) \] (. [^ \ [] *) (doc | xls | ppt | htm | swf | rar | zip | exe) \ [\/UPLOAD \] "'$ str = re. replace ($ str ,"
Links to this topic are as follows:
Click to browse the file ") 'automatically identify the URL're. pattern = "^ (http | https | ftp | rtsp | mms) :( \/| \) [A-Za-z0-9 \. /= \? % \-&_~ '@ [\] \': +!] +) "'$ Str = re. replace ($ str, "$1")'re. pattern = "(http | https | ftp | rtsp | mms) :( \// |\\\\) [A-Za-z0-9 \. /= \? % \-&_~ '@ [\] \': +!] +) $ "'$ Str = re. replace ($ str, "$1")'re. pattern = "([^> = \"]) (http | https | ftp | rtsp | mms) :( \\// |\\\) [A-Za-z0-9 \. /= \? % \-&_~ '@ [\] \': +!] +) "'$ Str = re. replace ($ str, "$1 $2") 'automatically identifies URLs starting with www 're. pattern = "([^ (http: // | http: \)]) (www | cn) [.] (\ w) + [.] {1,} (net | com | cn | org | cc) (\/[\ ~] * | \ [\ ~] *) (\ W) +) | [.] (\ w) +) * ([?] (\ W) +) {1} [=] *) * (\ w) +) {1} ([\ &] (\ w) + [\ =] (\ w) +) *) "'$ str = re. replace ($ str, "$2")'re. pattern = "\ [SHADOW = * ([0-9] *), * (# * [a-z0-9] *), * ([0-9] *) \] (. [^ \ [] *) \ [\/SHADOW] "'$ str = re. replace ($ str ,"
$4
")'Re. pattern = "\ [GLOW = * ([0-9] *), * (# * [a-z0-9] *), * ([0-9] *) \] (. [^ \ [] *) \ [\/GLOW] "'$ str = re. replace ($ str ,"
$4
") */?>
Tutorial address:
Reprinted! But please include the article address ^