asp的ubb函数总结

原创 2004年08月22日 23:10:00

aspubb函数<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

function unHtml(content)

unHtml=content

if content <> "" then

unHtml=replace(unHtml,"&","&")

unHtml=replace(unHtml,"<","<")

unHtml=replace(unHtml,">",">")

unHtml=replace(unHtml,chr(34),""")

unHtml=replace(unHtml,chr(13),"<br>")

unHtml=replace(unHtml,chr(32)," ")

'unHtml=ubb(unHtml)

end if

end function

 

function ubb(content)

Dim nowtime,i

ubb=content

nowtime=now()

UBB=Convert(ubb,"code")

UBB=Convert(ubb,"html")

UBB=Convert(ubb,"url")

UBB=Convert(ubb,"color")

UBB=Convert(ubb,"font")

UBB=Convert(ubb,"size")

UBB=Convert(ubb,"quote")

UBB=Convert(ubb,"email")

UBB=Convert(ubb,"img")

UBB=Convert(ubb,"swf")

 

UBB=AutoURL(ubb)

ubb=replace(ubb,"[b]","<b>",1,-1,1)

ubb=replace(ubb,"[/b]","</b>",1,-1,1)

ubb=replace(ubb,"[i]","<i>",1,-1,1)

ubb=replace(ubb,"[/i]","</i>",1,-1,1)

ubb=replace(ubb,"[u]","<u>",1,-1,1)

ubb=replace(ubb,"[/u]","</u>",1,-1,1)

ubb=replace(ubb,"[blue]","<font color='#000099'>",1,-1,1)

ubb=replace(ubb,"[/blue]","</font>",1,-1,1)

ubb=replace(ubb,"[red]","<font color='#990000'>",1,-1,1)

ubb=replace(ubb,"[/red]","</font>",1,-1,1)

for i=1 to 28

ubb=replace(ubb,"{:em"&i&"}","<IMG SRC=emot/emotface/em"&i&".gif></img>",1,6,1)

ubb=replace(ubb,"{:em"&i&"}","",1,-1,1)

next

ubb=replace(ubb,"["&chr(176),"[",1,-1,1)

ubb=replace(ubb,chr(176)&"]","]",1,-1,1)

ubb=replace(ubb,"/"&chr(176),"/",1,-1,1)

' ubb=replace(ubb,"{;em","{:em",1,-1,1)

end function

 

function Convert(ubb,CovT)

Dim cText,startubb,endubb,Lcovt,text,codetext

cText=ubb

startubb=1

do while Covt="url" or Covt="color" or Covt="font" or Covt="size"

startubb=instr(startubb,cText,"["&CovT&"=",1)

if startubb=0 then exit do

endubb=instr(startubb,cText,"]",1)

if endubb=0 then exit do

Lcovt=Covt

startubb=startubb+len(lCovT)+2

text=mid(cText,startubb,endubb-startubb)

codetext=replace(text,"[","["&chr(176),1,-1,1)

codetext=replace(codetext,"]",chr(176)&"]",1,-1,1)

'codetext=replace(codetext,"{:em","{;em",1,-1,1)

codetext=replace(codetext,"/","/"&chr(176),1,-1,1)

select case CovT

case "color"

cText=replace(cText,"[color="&text&"]","<font color='"&text&"'>",1,1,1)

cText=replace(cText,"[/color]","</font>",1,1,1)

case "font"

cText=replace(cText,"[font="&text&"]","<font face='"&text&"'>",1,1,1)

cText=replace(cText,"[/font]","</font>",1,1,1)

case "size"

if IsNumeric(text) then

if text>6 then text=6

if text<1 then text=1

cText=replace(cText,"[size="&text&"]","<font size='"&text&"'>",1,1,1)

cText=replace(cText,"[/size]","</font>",1,1,1)

end if

case "url"

cText=replace(cText,"[url="&text&"]","<a href='"&codetext&"' target=_blank>",1,1,1)

cText=replace(cText,"[/url]","</a>",1,1,1)

case "email"

cText=replace(cText,"["&CovT&"="&text&"]","<a href=mailto:"&text&">",1,1,1)

cText=replace(cText,"[/"&CovT&"]","</a>",1,1,1)

end select

loop

startubb=1

do

startubb=instr(startubb,cText,"["&CovT&"]",1)

if startubb=0 then exit do

endubb=instr(startubb,cText,"[/"&CovT&"]",1)

if endubb=0 then exit do

Lcovt=Covt

startubb=startubb+len(lCovT)+2

text=mid(cText,startubb,endubb-startubb)

codetext=replace(text,"[","["&chr(176),1,-1,1)

codetext=replace(codetext,"]",chr(176)&"]",1,-1,1)

'codetext=replace(codetext,"{:em","{;em",1,-1,1)

codetext=replace(codetext,"/","/"&chr(176),1,-1,1)

select case CovT

case "url"

cText=replace(cText,"["&CovT&"]"&text,"<a href='"&codetext&"' target=_blank>"&codetext,1,1,1)

cText=replace(cText,"<a href='"&codetext&"' target=_blank>"&codetext&"[/"&CovT&"]","<a href="&codetext&" target=_blank>"&codetext&"</a>",1,1,1)

case "email"

cText=replace(cText,"["&CovT&"]","<a href=mailto:"&text&">",1,1,1)

cText=replace(cText,"[/"&CovT&"]","</a>",1,1,1)

case "html"

codetext=replace(codetext,"<br>",chr(13),1,-1,1)

codetext=replace(codetext," ",chr(32),1,-1,1)

Randomize

rid="temp"&Int(100000 * Rnd)

cText=replace(cText,"[html]"&text,"代码片断如下:<TEXTAREA id="&rid&" rows=15 style='width:100%' class='bk'>"&codetext,1,1,1)

cText=replace(cText,"代码片断如下:<TEXTAREA id="&rid&" rows=15 style='width:100%' class='bk'>"&codetext&"[/html]","代码片断如下:<TEXTAREA id="&rid&" rows=15 style='width:100%' class='bk'>"&codetext&"</TEXTAREA><INPUT onclick=runEx('"&rid&"') type=button value=运行此段代码 name=Button1 class='Tips_bo'> <INPUT onclick=JM_cc('"&rid&"') type=button value=复制到我的剪贴板 name=Button2 class='Tips_bo'>",1,1,1)

case "img"

cText=replace(cText,"[img]"&text,"<a href="&chr(34)&"about:<img src="&codetext&" border=0>"&chr(34)&" target=_blank><img src="&codetext,1,1,1)

cText=replace(cText,"[/img]"," vspace=2 hspace=2 border=0 alt=::点击图片在新窗口中打开::></a>",1,1,1)

case "code"

cText=replace(cText,"[code]"&text,"以下内容为程序代码<hr noshade>"&codetext,1,1,1)

cText=replace(cText,"以下内容为程序代码<hr noshade>"&codetext&"[/code]","以下内容为程序代码<hr noshade>"&codetext&"<hr noshade>",1,1,1)

case "quote"

atext=replace(text,"[img]","",1,-1,1)

atext=replace(atext,"[/img]","",1,-1,1)

atext=replace(atext,"[swf]","",1,-1,1)

atext=replace(atext,"[/swf]","",1,-1,1)

atext=replace(atext,"[html]","",1,-1,1)

atext=replace(atext,"[/html]","",1,-1,1)

' atext=replace(atext,"{:em","{;em",1,-1,1)

atext=SplitWords(atext,350)

atext=replace(atext,chr(32)," ",1,-1,1)

cText=replace(cText,"[quote]"&text,"<blockquote><hr noshade>"&atext,1,1,1)

cText=replace(cText,"<blockquote><hr noshade>"&atext&"[/quote]","<blockquote><hr noshade>"&atext&"<hr noshade></blockquote>",1,1,1)

case "swf"

cText=replace(cText,"[swf]"&text,"影片地址:<br>"&text&"<br><object classid='clsid:D27CDB6E-AE6D-11cf-96B8-444553540000' codebase='http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=5,0,0,0' width='500' height='500'><param name=movie value='"&codetext&"'><param name=quality value=high><embed src='"&codetext&"' quality=high pluginspage='http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash' type='application/x-shockwave-flash' width='500' height='500'>",1,1,1)

cText=replace(cText,"<object classid='clsid:D27CDB6E-AE6D-11cf-96B8-444553540000' codebase='http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=5,0,0,0' width='500' height='500'><param name=movie value='"&codetext&"'><param name=quality value=high><embed src='"&codetext&"' quality=high pluginspage='http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash' type='application/x-shockwave-flash' width='500' height='500'>"&"[/swf]","<object classid='clsid:D27CDB6E-AE6D-11cf-96B8-444553540000' codebase='http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=5,0,0,0' width='500' height='500'><param name=movie value='"&codetext&"'><param name=quality value=high><embed src='"&codetext&"' quality=high pluginspage='http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash' type='application/x-shockwave-flash' width='500' height='500'>"&"</embed></object>",1,1,1)

end select

loop

Convert=cText

end function

ASP版HTML转UBB的函数

function html2ubb(l1)   i
  • MPU
  • MPU
  • 2009-02-23 16:19:00
  • 1235

ASP中过滤UBB和Html标签

我们存储在数据库中的内容是HTML格式的,但是有时候我们需要无格式的显示这内容,这是用正则表达式实现的过滤。function nohtml(str) dim re Set re=new RegExp ...
  • vince6799
  • vince6799
  • 2005-10-28 22:58:00
  • 1654

分享一个非常好用的UBB转html类

分享一个非常好用的UBB转html类。discuz搭建的论坛可以使用。 测试过没有问题的。 测试结果:  import java.util.regex.Matcher; import jav...
  • tianyaxingge
  • tianyaxingge
  • 2011-08-11 19:21:29
  • 1684

UBB编辑器UBBEditor推荐

在做bbs项目时,需要用到ubb编辑器。网上 查了好久,终于找到一款简单轻便的ubb编辑器UBBEditor,并且是开源的。推荐给大家。官网地址:http://www.ubbeditor.com/do...
  • love__coder
  • love__coder
  • 2011-03-03 18:37:00
  • 4676

论坛完整版ubb代码

function ChkBadWords(fString)    bwords = split(BadWords, "|")    for i = 0 to ubound(bwords)       ...
  • xpnh123
  • xpnh123
  • 2008-06-04 08:44:00
  • 813

UBB转换HTML的js代码

  • 2010年04月20日 11:44
  • 13KB
  • 下载

UBB码表情替换方法

今天来个UBB表情替换的功能方法。前几天一直比较头疼应该如何把UBB替换成表情图片,想过用webview,也想过用viewgroup一个一个往上加。但是都不理想,用webview的话服务器端需要另做处...
  • zhou699
  • zhou699
  • 2011-06-21 10:39:00
  • 1145

正则表达式在UBB论坛中的应用

一、读者指引   读者指引帮助你掌握本文的梗概。以免你看了大半才明白这编文章不适合你,给你造成视觉污染。   如果你正在用ASP写程序,或者你正在写一些诸如BBS、留言溥或表单数据检查之类的东东那就...
  • lovelium
  • lovelium
  • 2007-03-07 09:01:00
  • 351

使用Objective-C处理UBB标签

有这么个业务需求,抽象出来如下: 展示一条文案,比如“某某人做了某某事”,这里的“某某人”是一个用户的昵称;用户可以修改昵称,修改过后再看之前的文案,“某某人”这个昵称需要跟着变化;文案数据...
  • jasonblog
  • jasonblog
  • 2014-05-23 10:06:29
  • 3163

ubb编辑器代码

UBB代码列表 具体代码含义如下: [b]文字[/b] 插入粗体字 [i]文字[/i] 插入斜体字 [u]文字[/u] 插入下划线 [s]文字[/s] 插入删除线 [fly]文字[fly] 插入飞行文...
  • lvlingwy
  • lvlingwy
  • 2007-05-30 14:46:00
  • 2051
收藏助手
不良信息举报
您举报文章:asp的ubb函数总结
举报原因:
原因补充:

(最多只允许输入30个字)