手机
当前位置:查字典教程网 >编程开发 >ASP教程 >ubbcode函数
ubbcode函数
摘要:复制代码代码如下:

复制代码 代码如下:

<%

PublicFunctionUbbCode(strContent)

Dimre

Setre=NewRegExp

re.IgnoreCase=True

re.Global=True

'过滤危险脚本

re.Pattern="(</script>)"

strContent=re.Replace(strContent,"</script>")

re.Pattern="(script:)"

strContent=re.Replace(strContent,"")

re.Pattern="(script)"

strContent=re.Replace(strContent,"")

re.Pattern="(js:)"

strContent=re.Replace(strContent,"")

re.Pattern="(value)"

strContent=re.Replace(strContent,"")

re.Pattern="(about:)"

strContent=re.Replace(strContent,"about")

re.Pattern="(file:)"

strContent=re.Replace(strContent,"file")

re.Pattern="(document.cookie)"

strContent=re.Replace(strContent,"documents")

re.Pattern="(vbs:)"

strContent=re.Replace(strContent,"")

re.Pattern="(on(mouse|exit|error|click|key))"

strContent=re.Replace(strContent,"")

re.Pattern="<IMG.[^>]*SRC(=|)(.[^>]*)>"

'strContent=re.replace(strContent,"<IMGSRC=$2onclick=""javascript:window.open(this.src);""style=""CURSOR:pointer""border=""0"">")

strContent=re.replace(strContent,"<IMGSRC=$2border=""0"">")

're.Pattern="<img(.[^>]*)>"

'strContent=re.replace(strContent,"<img$1onload=""returnimgzoom(this,550)"">")

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="([fly])(.*)([/fly])"

strContent=re.Replace(strContent,"<marquee>$2</marquee>")

re.Pattern="[size=([1-9])](.[^[]*)[/size]"

strContent=re.Replace(strContent,"<fontsize=$1>$2</font>")

re.Pattern="([center])(.[^[]*)([/center])"

strContent=re.Replace(strContent,"<center>$2</center>")

re.Pattern="[DIR=*([0-9]*),*([0-9]*)](.[^[]*)[/DIR]"

strContent=re.Replace(strContent,"<embedsrc=$3pluginspage=http://www.macromedia.com/shockwave/download/width=$1height=$2></embed>")

re.Pattern="[QT=*([0-9]*),*([0-9]*)](.[^[]*)[/QT]"

strContent=re.Replace(strContent,"<embedsrc=$3width=$1height=$2autoplay=trueloop=falsecontroller=trueplayeveryframe=falsecache=falsescale=TOFITbgcolor=#000000kioskmode=falsetargetcache=falsepluginspage=http://www.apple.com/quicktime/>")

re.Pattern="[MP=*([0-9]*),*([0-9]*)](.[^[]*)[/MP]"

strContent=re.Replace(strContent,"<embedtype=application/x-oleobjectcodebase=http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=5,1,52,701flename=mpsrc=$3width=$1height=$2></embed>")

re.Pattern="[RM=*([0-9]*),*([0-9]*)](.[^[]*)[/RM]"

strContent=re.Replace(strContent,"<OBJECTclassid=clsid:CFCDAA03-8BE4-11cf-B84B-0020AFBBCCFAclass=OBJECTid=RAOCXwidth=$1height=$2><PARAMNAME=SRCVALUE=$3><PARAMNAME=CONSOLEVALUE=Clip1><PARAMNAME=CONTROLSVALUE=imagewindow><PARAMNAME=AUTOSTARTVALUE=true></OBJECT><br><OBJECTclassid=CLSID:CFCDAA03-8BE4-11CF-B84B-0020AFBBCCFAheight=32id=video2width=$1><PARAMNAME=SRCVALUE=$3><PARAMNAME=AUTOSTARTVALUE=-1><PARAMNAME=CONTROLSVALUE=controlpanel><PARAMNAME=CONSOLEVALUE=Clip1></OBJECT>")

re.Pattern="([FLASH])(.[^[]*)([/FLASH])"

'strContent=re.Replace(strContent,"<embedsrc=""$2""quality=highpluginspage='http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash'type='application/x-shockwave-flash'width=500height=400>$2</embed>")

strContent=re.Replace(strContent,"")

re.Pattern="([FLASH=*([0-9]*),*([0-9]*)])(.[^[]*)([/FLASH])"

strContent=re.Replace(strContent,"<embedsrc=""$4""quality=highpluginspage='http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash'type='application/x-shockwave-flash'width=$2height=$3>$4</embed>")

strContent=re.Replace(strContent,"")

re.Pattern="[UPLOAD=(gif|jpg|jpeg|bmp|png)](.[^[]*)(gif|jpg|jpeg|bmp|png)[/UPLOAD]"

strContent=re.Replace(strContent,"<br><AHREF=""$2$1""TARGET=_blank><IMGSRC=""$2$1""border=0alt=按此在新窗口浏览图片onload=""javascript:if(this.width>screen.width-333)this.width=screen.width-333""></A>")

re.Pattern="([UPLOAD=(.[^[]*)])(.[^[]*)([/UPLOAD])"

strContent=re.Replace(strContent,"<br><ahref=""$3"">点击浏览该文件</a>")

re.Pattern="([URL])(.[^[]*)([/URL])"

strContent=re.Replace(strContent,"<AHREF=""$2""TARGET=_blank>$2</A>")

re.Pattern="([URL=(.[^[]*)])(.[^[]*)([/URL])"

strContent=re.Replace(strContent,"<AHREF=""$2""TARGET=_blank>$3</A>")

re.Pattern="([EMAIL])(.[^[]*)([/EMAIL])"

strContent=re.Replace(strContent,"<AHREF=""mailto:$2"">$2</A>")

re.Pattern="([EMAIL=(.[^[]*)])(.[^[]*)([/EMAIL])"

strContent=re.Replace(strContent,"<AHREF=""mailto:$2""TARGET=_blank>$3</A>")

re.Pattern="([HTML])(.[^[]*)([/HTML])"

strContent=re.Replace(strContent,"<tablewidth='100%'border='0'cellspacing='0'cellpadding='6'bgcolor='#F6F6F6'><td><b>以下内容为程序代码:</b><br>$2</td></table>")

re.Pattern="([code])(.[^[]*)([/code])"

strContent=re.Replace(strContent,"<tablewidth='100%'border='0'cellspacing='0'cellpadding='6'bgcolor='#F6F6F6'><td><b>以下内容为程序代码:</b><br>$2</td></table>")

re.Pattern="([color=(.[^[]*)])(.[^[]*)([/color])"

strContent=re.Replace(strContent,"<fontcolor=$2>$3</font>")

re.Pattern="([face=(.[^[]*)])(.[^[]*)([/face])"

strContent=re.Replace(strContent,"<fontface=$2>$3</font>")

re.Pattern="[align=(center|left|right)](.*)[/align]"

strContent=re.Replace(strContent,"<divalign=$1>$2</div>")

re.Pattern="([QUOTE])(.*)([/QUOTE])"

strContent=re.Replace(strContent,"<tablecellpadding=0cellspacing=0border=1WIDTH=94%bordercolor=#000000bgcolor=#F2F8FFalign=center><tr><td><tablewidth=100%cellpadding=5cellspacing=1border=0><TR><TDBGCOLOR='#F6F6F6'>$2</table></table><br>")

re.Pattern="([move])(.*)([/move])"

strContent=re.Replace(strContent,"<MARQUEEscrollamount=3>$2</marquee>")

re.Pattern="[GLOW=*([0-9]*),*(#*[a-z0-9]*),*([0-9]*)](.[^[]*)[/GLOW]"

strContent=re.Replace(strContent,"<tablewidth=$1style=""filter:glow(color=$2,strength=$3)"">$4</table>")

re.Pattern="[SHADOW=*([0-9]*),*(#*[a-z0-9]*),*([0-9]*)](.[^[]*)[/SHADOW]"

strContent=re.Replace(strContent,"<tablewidth=$1style=""filter:shadow(color=$2,strength=$3)"">$4</table>")

Setre=Nothing

strContent=Replace(strContent,"{","")

strContent=Replace(strContent,"}","")

strContent=Replace(strContent,"$","")

UbbCode=strContent

EndFunction

%>

【ubbcode函数】相关文章:

ASP常用函数:ArrayToxml

ASP常用函数:getpy()

asp 常用函数用法

收集asp的常用函数

ASP中FormatDateTime函数用法详解

ASP常用函数:Str4Js()

ASP常用函数:getIMG()

asp中的Rnd 函数

检测函数 asp class

ASP常用函数:LastDay()

精品推荐
分类导航