欢迎来到福编程网,本站提供各种互联网专业知识!

jb51用的ubb转换 原创

发布时间:2006-08-22 作者: 来源:原创
ubbcode.asp复制代码代码如下:
ubbcode.asp
复制代码 代码如下:
<%
FunctionUBBCode(strContent)
IfisEmpty(strContent)OrisNull(strContent)Then
ExitFunction
Else
dimregex,strMatch
setregex=newRegExp
regex.IgnoreCase=True
regex.Global=True
regex.Pattern="[html]((rn)?([sS]+?))[/html]"
SetstrMatchs=regex.Execute(strContent)
ForEachstrMatchinstrMatchs
'response.writestrMatch.SubMatches(3)
Randomize
rndID="runcode"&Int(100000*Rnd)
strContent=Replace(strContent,strMatch.Value,"

HTML代码:"&UBBFilter(HTMLDecode(strMatch.SubMatches(2)))&"

[Ctrl+A全部选择提示:你可先修改部分代码,再按运行]")
Next
SetstrMatchs=nothing
'去空行
regex.pattern="n[s]*r"
SetstrMatchs=regex.Execute(strContent)
ForEachstrMatchinstrMatchs
strContent=Replace(strContent,strMatch.Value,"")
Next
'代码块
regex.Pattern="[code]((rn)?([sS]+?))[/code]"
SetstrMatchs=regex.Execute(strContent)
ForEachstrMatchinstrMatchs
Randomize
rndID="code"&Int(100000*Rnd)
strContent=Replace(strContent,strMatch.Value,"

CODE代码:

[复制此代码]

"&strMatch.SubMatches(2)&"

")
Next
SetstrMatchs=nothing
'实现插入影音文件
regex.Pattern="[(swf|wma|wmv|rm|ra|qt)(=d*?|)(,d*?|)]([^<>]*?)[/(swf|wma|wmv|rm|ra|qt)]"
SetstrMatchs=regex.Execute(strContent)
dimstrType,strWidth,strHeight,strSRC,TitleText
ForEachstrMatchinstrMatchs
RAndomize
strType=strMatch.SubMatches(0)
ifstrType="swf"then
TitleText="Flash动画"
elseifstrType="wma"then
TitleText="播放音频文件"
elseifstrType="wmv"then
TitleText="播放视频文件"
elseifstrType="rm"then
TitleText="播放real视频流文件"
elseifstrType="ra"then
TitleText="播放real音频流文件"
elseifstrType="qt"then
TitleText="播放mov视频文件"
endif
strWidth=strMatch.SubMatches(1)
strHeight=strMatch.SubMatches(2)
if(len(strWidth)=0)then
strWidth="400"
else
strWidth=right(strWidth,(len(strWidth)-1))
endif
if(len(strHeight)=0)then
strHeight="300"
else
strHeight=right(strHeight,(len(strHeight)-1))
endif
strSRC=strMatch.SubMatches(3)
rndID="temp"&Int(100000*Rnd)
strContent=Replace(strContent,strMatch.Value,""&TitleText&"
在线播放
")
Next
SetstrMatchs=nothing
regex.Pattern="([mid])(.[^]]*)[/mid]"
strContent=regex.Replace(strContent,"")
regex.pattern="

([s||]*)?

"
strContent=regex.replace(strContent,"

")
strContent=replace(strContent,"&","&")
strContent=replace(strContent,"'","'")
strContent=replace(strContent,"","")'因为以前上传图片

setregex=nothing
endif
UBBCode=strContent
endfunction
%>

基本上来自pjhome

相关推荐