⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 cl_clsubb.asp

📁 淘客网上商店网站程序 淘客网上商店网站程序 淘客网上商店网站程序
💻 ASP
📖 第 1 页 / 共 2 页
字号:
<%
'=============================================
'UBB处理类
'注明出处:改自动网论坛(Dvbbs7)
'Date:2006.7.27
'By Aspoo.CN
'=============================================
Class Cls_UbbCode
	Public Re,reed,isgetreed,Ubblists,MaxLoopcount,IsOpenHTML

	Private Sub Class_Initialize()
		MaxLoopcount=100  '循环的最多次数,避免死循环
		IsOpenHTML=0 '是否开放HTML支持
		' 1=[/img]	 2=[/upload]	3=[/dir]	4=[/qt]	 5=[/mp]
		' 6=[/rm]	 7=[/sound]		8=[/flash]	9=[/url] 10=[/email]
		'11=http,https,ftp,rtsp,mms	12=[/html]
		'13=[/code]	 14=[/color]	15=[/face]	16=[/align]
		'17=[/quote] 18=[/fly]		19=[/move]	20=[/shadow]
		'21=[/glow]	 22=[/size]		23=[/i]		24=[/b]	 25=[/u]	26=[em,27=www
		Ubblists=",1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27"
		Set re=new RegExp
		re.IgnoreCase =True
		re.Global=True
	End Sub
	Public Property Let OpenHTML(ByVal sValue)
		IsOpenHTML=Cint(sValue)
	End Property
	Private Sub class_terminate()
		Set Re=Nothing
	End Sub

	Public Function FilterJS(s)
		re.Pattern="(<s+cript(.[^>]*)>)"
		s=re.Replace(s,"&lt;&#83cript$2&gt;")
		re.Pattern="(<\/s+cript>)"
		s=re.Replace(s,"&lt;/&#83cript&gt;")
		re.Pattern="(<body(.[^>]*)>)"
		s=re.Replace(s,"<body>")
		re.Pattern="(javascript:)"
		s=re.Replace(s,"#i#javascript#i#:")
		re.Pattern="<(\w+)(&nbsp;)+([^>]*)>"
		s=re.Replace(s,"<$1 $3>")
		re.Pattern="\[(br)\]"
		s=re.Replace(s,"<$1>")
		re.Pattern="(jscript:)"
		s=re.Replace(s,"#i#jscript#i#:")
		re.Pattern="(js:)"
		s=re.Replace(s,"&#106s:")
		re.Pattern="(about:)"
		s=re.Replace(s,"about&#58")
		re.Pattern="(file:)"
		s=re.Replace(s,"file&#58")
		re.Pattern="(document.cookie)"
		s=re.Replace(s,"documents&#46cookie")
		re.Pattern="(vbscript:)"
		s=re.Replace(s,"#i#vbscript#i#:")
		re.Pattern="(vbs:)"
		s=re.Replace(s,"&#118bs:")
		re.Pattern="(on(mouse|exit|error|click|key))"
		s=re.Replace(s,"&#111n$2")
		re.Pattern="<((asp|\!|%))"
		s=re.Replace(s,"&lt;$1")
		re.Pattern="(<\!(.[^>]*)>)"
		s=re.Replace(s,"&lt;$2&gt;")
		re.Pattern="(<\!)"
		s=re.Replace(s,"&lt;!")
		re.Pattern="(-->)"
		s=re.Replace(s,"--&gt;")
		re.Pattern="(&lt;--{$)"
		s=re.Replace(s,"&#123;&#37;")
		re.Pattern="(}--&gt;)"
		s=re.Replace(s,"&#37;&#125;")
		FilterJS=s
	End Function

	Public Function UbbCode(s)
		if Trim(s)="" or IsNull(s) then Exit Function
		s=FilterJS(s)
		If IsOpenHTML=0 Then
		s=Replace(s,VbCrlf,"<br />")
		s=Replace(s,Chr(10),"<br />")
		s=Replace(s,Chr(13),"<br />")
		End if
		'img code
		If InStr(Ubblists,",1,")>0 Then s=Cl_UbbCode_iS2(s,"img","<a href=""$1"" target=""_blank"" ><img src=""$1"" border=""0"" /></a>","")
		'upload code
		'If InStr(Ubblists,",2,")>0 Then '是否开放标签
		'media code
		If InStr(Ubblists,",3,")>0 Then s=Cl_UbbCode_iS2(s,"DIR","<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"" /></object>","=*([0-9]*),*([0-9]*)")
		If InStr(Ubblists,",4,")>0 Then s=Cl_UbbCode_iS2(s,"QT","<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"" />","=*([0-9]*),*([0-9]*)")
		If InStr(Ubblists,",5,")>0 Then
		s=Cl_UbbCode_iS2(s,"MP","<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"" /></object>","=*([0-9]*),*([0-9]*)")
		'MediaPlayer自定义播放模式;
		s=Cl_UbbCode_iS2(s,"MP","<object align=""middle"" classid=""clsid:22d6f312-b0f6-11d0-94ab-0080c74c7e95"" "&_
			"class=""object"" id=""MediaPlayer"" width=""$1"" height=""$2""><param name=""autostart"" value=""$3""  />"&_
			"<param name=""ShowStatusBar"" value=""-1"" /><param name=""Filename"" value=""$4"" />"&_
			"<embed type=""application/x-oleobject"" codebase=""http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=5,1,52,701"" "&_
			"flename=""mp"" src=""$4"" width=""$1"" height=""$2"" /></object>","=*([0-9]*),*([0-9]*),*([0|1|true|false]*)")
		End If
		If InStr(Ubblists,",6,")>0 Then
		s=Cl_UbbCode_iS2(s,"RM","<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"" value=""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 name=""autostart"" value=""-1"" />"&_
			"<param name=""controls"" value=""controlpanel"" /><param name=""console"" value=""clip1"" />"&_
			"</object>","=*([0-9]*),*([0-9]*)")
		'RealPlayer自定义播放模式;
		s=Cl_UbbCode_iS2(s,"RM","<object classid=""clsid:CFCDAA03-8BE4-11cf-B84B-0020AFBBCCFA"" class=""object"" "&_
			"id=""RAOCX"" width=""$1"" height=""$2""><param name=""src"" value=""$4"" />"&_
			"<param name=""console"" value=""$4"" /><param name=""controls"" value=""imagewindow"" />"&_
			"<param name=""autostart"" value=$3 /></object><br />"&_
			"<object classid=""clsid:CFCDAA03-8BE4-11CF-B84B-0020AFBBCCFA"" height=""32"" id=""video"" width=""$1"">"&_
			"<param name=""src"" value=""$4"" /><param name=""autostart"" value=""$3"" /><param name=""controls"" "&_
			"value=""controlpanel"" /><param name=""console"" value=""$4"" /></object>","=*([0-9]*),*([0-9]*),*([0|1|true|false]*)")
		End If
		If InStr(Ubblists,",7,")>0 Then s=Cl_UbbCode_iS2(s,"sound","<a href=""$1"" target=""_blank""><img src="&Cl.WebDir&"Images/Fileicon/mid.gif border=0 alt=""背景音乐"" /></a><bgsound src=""$1"" loop=""-1"">","")
		'flash code
		If InStr(Ubblists,",8,")>0 Then
			s=Cl_UbbCode_iS2(s,"flash",_
			"<a href=""$1"" target=""_blank""><img src="""&Cl.WebDir&"Images/Fileicon/swf.gif"" border=""0"" alt=""点击开新窗口欣赏该FLASH动画!"" height=""16"" width=""16"" />[全屏欣赏]</a><br/>"&_
			"<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=""$1"" /><param name=""quality"" value=""high"" />"&_
			"<embed src=""$1"" quality=""high"" pluginspage=""http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash"" type=""application/x-shockwave-flash"" width=""500"" height=""400"">$1</embed></object>","")
			s=Cl_UbbCode_iS2(s,"flash",_
			"<a href=""$3"" target=""_blank""><img src="""&Cl.WebDir&"Images/Fileicon/swf.gif"" border=""0"" alt=""点击开新窗口欣赏该FLASH动画!"" height=""16"" width=""16"" />[全屏欣赏]</a><br/>"&_
			"<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=""$1"" height=""$2"">"&_
			"<param name=""movie"" value=""$3"" /><param name=""quality"" value=""high"" />"&_
			"<embed src=""$3"" quality=""high"" pluginspage=""http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash"" type=""application/x-shockwave-flash"" width=""$1"" height=""$2"">$3</embed></object>","=*([0-9]*),*([0-9]*)")
		End If
		'=========================================================
		'url code
		If InStr(Ubblists,",9,")>0 Then
			s=Cl_UbbCode_S1(s,"URL","<a href=""$1"" target=""_blank"">$1</a>")
			re.Pattern="(\[URL=(.[^\[]*)\])(.[^\[]*)(\[\/URL\])"
			s= re.Replace(s,"<a href=""$2"" target=""_blank"">$3</a>")
		End If
		'email code
		If InStr(Ubblists,",10,")>0 Then
			s=Cl_UbbCode_S1(s,"EMAIL","<img src="""&Cl.WebDir&"Images/email1.gif"" border=""0"" /><a href=""mailto:$1"">$1</a>")
			re.Pattern="(\[EMAIL=(\S+\@.[^\[]*)\])(.[^\[]*)(\[\/EMAIL\])"
			s= re.Replace(s,"<img src="""&Cl.WebDir&"Images/email1.gif"" border=""0"" /><a href=""mailto:$2"" garget=""_blank"">$3</a>")
		End If

		If InStr(Ubblists,",12,")>0 Then s=Cl_UbbCode_S1(s,"html","<table width=""100%"" border=""0"" cellspacing=""0"" cellpadding=""6""><td><b>以下内容为程序代码:</b><br />$1</td></table>")
		If InStr(Ubblists,",13,")>0 Then s=Cl_UbbCode_S1(s,"code","<div class=""htmlcode""><b>以下内容为程序代码:</b><br />$1</div>")
		If InStr(Ubblists,",14,")>0 Then s=Cl_UbbCode_UF(s,"color","<span style=""color:$1"">$2</span>","1")
		If InStr(Ubblists,",15,")>0 Then s=Cl_UbbCode_UF(s,"face","<span face=""$1"">$2</span>","1")
		If InStr(Ubblists,",16,")>0 Then s=Cl_UbbCode_Align(s)
		If InStr(Lcase(s),"center]")>0 Then s=Cl_UbbCode_S1(s,"center","<center>$1</center>")
		If InStr(Ubblists,",17,")>0 Then s=Cl_UbbCode_Q(s)
		If InStr(Ubblists,",18,")>0 Then
		s=Cl_UbbCode_S1(s,"fly","<marquee width=""90%"" behavior=""alternate"" scrollamount=""3"">$1</marquee>")
		End if
		If InStr(Ubblists,",19,")>0 Then s=Cl_UbbCode_S1(s,"move","<marquee scrollamount=""3"">$1</marquee>")
		If InStr(Ubblists,",20,")>0 Then s=Cl_UbbCode_iS1(s,"SHADOW","<div style=""width:$1px;filter:shadow(color=$2, strength=$3)"">$4</div>","=*([0-9]*),*(#*[a-z0-9]*),*([0-9]*)")
		If InStr(Ubblists,",21,")>0 Then s=Cl_UbbCode_iS1(s,"GLOW","<div style=""width:$1px;filter:glow(color=$2, strength=$3)"">$4</div>","=*([0-9]*),*(#*[a-z0-9]*),*([0-9]*)")
		If InStr(Ubblists,",22,")>0 Then s=Cl_UbbCode_UF(s,"size","<font size=""$1"">$2</font>","1")
		If InStr(Ubblists,",23,")>0 Then s=Cl_UbbCode_S1(s,"i","<i>$1</i>")

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -