UBB into HTML
Last Update:2017-01-13
Source: Internet
Author: User
<%
function Encodestr (str)
Str=trim (str)
Str=replace (str, "<", "<")
Str=replace (str, ">", ">")
Str=replace (str, "'", "" "")
Str=replace (Str,vbcrlf&vbcrlf, "</p><p>")
Str=replace (Str,vbcrlf, "<br>")
Encodestr=replace (str, "", "")
End Function
function Ubbcode (strcontent)
Dim re
Set re=new REGEXP
Re. IgnoreCase =true
Re. Global=true
Strcontent=encodestr (strcontent)
Re. Pattern= "([IMG]) (. [ ^[]*) ([/img]) "
Strcontent=re. Replace (strcontent, " screen.width-333) this.width=screen.width-333 ">")
Re. Pattern= "[Dir=* ([0-9]*), * ([0-9]*)] (. [ ^[]*) [/dir] "
Strcontent=re. Replace (strcontent, "<object classid=clsid:166b1bca-3f9c-11cf-8075-444553540000 codebase=http:// download.macromedia.com/pub/shockwave/cabs/director/sw.cab#version=7,0,2,0 width=$1 Height=$2><param name= SRC value=$3><embed src=$3 pluginspage=http://www.macromedia.com/shockwave/download/width=$1 height=$2> </embed></object> ")
Re. Pattern= "[Qt=* ([0-9]*), * ([0-9]*)] (. [ ^[]*) [/QT] "
Strcontent=re. Replace (strcontent, "<embed src=$3 width=$1 height=$2 autoplay=true loop=false controller=true playeveryframe=false Cache=false scale=tofit bgcolor= #000000 kioskmode=false targetcache=false pluginspage=http://www.apple.com/ Quicktime/> ")
Re. Pattern= "[Mp=* ([0-9]*), * ([0-9]*)] (. [ ^[]*) [/MP] "
Strcontent=re. Replace (strcontent, "<object align=middle classid=clsid:22d6f312-b0f6-11d0-94ab-0080c74c7e95 Class=OBJECT id= MediaPlayer width=$1 height=$2 ><param name=showstatusbar value=-1><param name=filename value=$3>< Embed Type=application/x-oleobject codebase=http://activex.microsoft.com/activex/controls/mplayer/en/ nsmp2inf.cab#version=5,1,52,701 flename=mp src=$3 width=$1 height=$2></embed></object> ")
Re. Pattern= "[Rm=* ([0-9]*), * ([0-9]*)] (. [ ^[]*) [/RM] "
Strcontent=re. Replace (strcontent, "<object CLASSID=CLSID:CFCDAA03-8BE4-11CF-B84B-0020AFBBCCFA class=object Id=RAOCX width=$1 Height=$2><param name=src value=$3><param name=console value=clip1><param NAME=CONTROLS Imagewindow><param Name=autostart value=true></object><br><object Classid=CLSID: CFCDAA03-8BE4-11CF-B84B-0020AFBBCCFA height=32 Id=video2 Width=$1><param NAME=SRC VALUE=$3><PARAM AUTOSTART value=-1><param name=controls Value=controlpanel><param name=console VALUE=Clip1></ Object> ")
Re. Pattern= "([FLASH]) (. [ ^[]*) ([/flash]) "
Strcontent= Re. Replace (strcontent, "<object codebase=http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab# version=4,0,2,0 classid=clsid:d27cdb6e-ae6d-11cf-96b8-444553540000 width=500 Height=400><param NAME=movie Value= "" $ "" ><param name=quality value=high><embed src= "" $ "" Quality=high pluginspage= "http:// Www.macromedia.com/shockwave/download/index.cgi? P1_prod_version=shockwaveflash ' type= ' Application/x-shockwave-flash ' width=500 height=400>$2</embed>< /object> ")
Re. Pattern= "([URL]) (. [ ^[]*) ([/url]) "
Strcontent= Re. Replace (strcontent, "<a href=" "$" "target=_blank>$2</a>" )
Re. Pattern= "([Url= (. [ ^[]*)])(. [^[]*) ([/URL]) "
Strcontent= Re. Replace (strcontent, "<a href=" "$" "target=_blank>$3</a>" )
Re. Pattern= "([EMAIL]) (. [ ^[]*) ([/email]) "
Strcontent= Re. Replace (strcontent, "<a href=" "mailto:$2" ">$2</A>")
Re. Pattern= "([Email= (. [ ^[]*)])(. [^[]*) ([/email]) "
Strcontent= Re. Replace (strcontent, "<a href=" "mailto:$2" "TARGET=_blank>$3" </A> ")
Re. Pattern = "^ (http://[a-za-z0-9./=?%-&_~ ' @ ': +!] +)"
Strcontent = Re. Replace (strcontent, "<a target=_blank href=$1>$1</a>")
Re. Pattern = "(http://[a-za-z0-9./=?%-&_~ ' @ ': +!] +)$"
Strcontent = Re. Replace (strcontent, "<a target=_blank href=$1>$1</a>")
Re. Pattern = "([^>=" "]) (http://[a-za-z0-9./=?%-&_~ ' @ ': +!] +)"
Strcontent = Re. Replace (strcontent, "$1<a target=_blank href=$2>$2</a>")
Re. Pattern = "^ (ftp://[a-za-z0-9./=?%-&_~ ' @ ': +!] +)"
Strcontent = Re. Replace (strcontent, "<a target=_blank href=$1>$1</a>")
Re. Pattern = "(ftp://[a-za-z0-9./=?%-&_~ ' @ ': +!] +)$"
Strcontent = Re. Replace (strcontent, "<a target=_blank href=$1>$1</a>")
Re. Pattern = "([^>=" "]) (ftp://[a-za-z0-9./=?%-&_~ ' @ ': +!] +)"
Strcontent = Re. Replace (strcontent, "$1<a target=_blank href=$2>$2</a>")
Re. Pattern = "^ (rtsp://[a-za-z0-9./=?%-&_~ ' @ ': +!] +)"
Strcontent = Re. Replace (strcontent, "<a target=_blank href=$1>$1</a>")
Re. Pattern = "(rtsp://[a-za-z0-9./=?%-&_~ ' @ ': +!] +)$"
Strcontent = Re. Replace (strcontent, "<a target=_blank href=$1>$1</a>")
Re. Pattern = "([^>=" "]) (rtsp://[a-za-z0-9./=?%-&_~ ' @ ': +!] +)"
Strcontent = Re. Replace (strcontent, "$1<a target=_blank href=$2>$2</a>")
Re. Pattern = "^ (mms://[a-za-z0-9./=?%-&_~ ' @ ': +!] +)"
Strcontent = Re. Replace (strcontent, "<a target=_blank href=$1>$1</a>")
Re. Pattern = "(mms://[a-za-z0-9./=?%-&_~ ' @ ': +!] +)$"
Strcontent = Re. Replace (strcontent, "<a target=_blank href=$1>$1</a>")
Re. Pattern = "([^>=" "]) (mms://[a-za-z0-9./=?%-&_~ ' @ ': +!] +)"
Strcontent = Re. Replace (strcontent, "$1<a target=_blank href=$2>$2</a>")
Re. Pattern= "([Color= (. [ ^[]*)])(. [^[]*) ([/color]) "
Strcontent=re. Replace (strcontent, "<font color=$2 >$3</font>")
Re. Pattern= "([Align= (. [ ^[]*)]) (. *) ([/align]) "
Strcontent=re. Replace (strcontent, "<div align=$2>$3</div>")
Re. Pattern= "([QUOTE]) (. *) ([/quote])"
Strcontent=re. Replace (strcontent, "<table cellpadding=0 cellspacing=0 border=0 width=94% bgcolor= #000000 align=center><tr ><td><table width=100% cellpadding=5 cellspacing=1 border=0><tr><td class=table003>$2 </table></table><br> ")
Re. Pattern= "([Fly]) (. *) ([/fly])"
Strcontent=re. Replace (strcontent, "<marquee width=90% behavior=alternate scrollamount=3>$2</marquee>")
Re. Pattern= "([Move]) (. *) ([/move])"
Strcontent=re. Replace (strcontent, "<marquee scrollamount=3>$2</marquee>")
Re. Pattern= "[Glow=* ([0-9]*), * (#*[a-z0-9]*), * ([0-9]*)] (. [ ^[]*) [/glow] "
Strcontent=re. Replace (strcontent, "<table width=$1 style=" "Filter:glow (color=$2, strength=$3)" ">$4</table>")
Re. Pattern= "[Shadow=* ([0-9]*), * (#*[a-z0-9]*), * ([0-9]*)] (. [ ^[]*) [/shadow] "
Strcontent=re. Replace (strcontent, "<table width=$1 style=" "Filter:shadow (color=$2, strength=$3)" ">$4</table>")
Re. Pattern= "([i]) (. [ ^[]*) ([i]) "
Strcontent=re. Replace (strcontent, "<i>$2</i>")
Re. Pattern= "([u]) (. [ ^[]*) ([u]) "
Strcontent=re. Replace (strcontent, "<u>$2</u>")
Re. Pattern= "([b]) (. [ ^[]*) ([/b]) "
Strcontent=re. Replace (strcontent, "<b>$2</b>")
Re. Pattern= "([size=1]) (. [ ^[]*) ([/size]) "
Strcontent=re. Replace (strcontent, "<font size=1>$2</font>")
Re. Pattern= "([size=2]) (. [ ^[]*) ([/size]) "
Strcontent=re. Replace (strcontent, "<font size=2>$2</font>")
Re. Pattern= "([size=3]) (. [ ^[]*) ([/size]) "
Strcontent=re. Replace (strcontent, "<font size=3>$2</font>")
Re. Pattern= "([size=4]) (. [ ^[]*) ([/size]) "
Strcontent=re. Replace (strcontent, "<font size=4>$2</font>")
Re. Pattern= "([center]) (. [ ^[]*) ([/center]) "
Strcontent=re. Replace (strcontent, "<center>$2</center>")
Set re=nothing
Ubbcode=strcontent
End Function
%>