Ubb functions of asp (recommended)

Source: Internet
Author: User

Copy codeThe Code is as follows:
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 = '# 000000'>", 1,-000099)
Ubb = replace (ubb, "[/blue]", "</font>", 1,-1, 1)
Ubb = replace (ubb, "[red]", "<font color = '# 000000'>", 1,-990000)
Ubb = replace (ubb, "[/red]", "</font>", 1,-1, 1)
For I = 1 to 28
Ubb = replace (ubb, "{: em" & I & "}", " </img> ", 1, 6, 1)
Ubb = replace (ubb, "{: em" & I & "}", "", 1,-1, 1)
Next
Ubb = replace (ubb, "[" & chr (176), "[", 1)
Ubb = replace (ubb, chr (176) & "]", "]", 1)
Ubb = replace (ubb, "/" & chr (176), "/", 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)
Codetext = replace (codetext, "]", chr (176) & "]", 1)
'Codetext = replace (codetext, "{: em", "{; em", 1,-1, 1)
Codetext = replace (codetext, "/", "/" & chr (176), 1)
Select case CovT
Case "color"
CText = replace (cText, "[color =" & text & "]", "<font color = '" & text & "'>", 1, 1)
CText = replace (cText, "[/color]", "</font>", 1, 1)
Case "font"
CText = replace (cText, "[font =" & text & "]", "<font face = '" & text & "'>", 1, 1)
CText = replace (cText, "[/font]", "</font>", 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)
CText = replace (cText, "[/size]", "</font>", 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)
Case "email"
CText = replace (cText, "[" & CovT & "=" & text & "]", "<a href = mailto:" & text & ">", 1, 1, 1)
CText = replace (cText, "[/" & CovT & "]", "</a>", 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)
Codetext = replace (codetext, "]", chr (176) & "]", 1)
'Codetext = replace (codetext, "{: em", "{; em", 1,-1, 1)
Codetext = replace (codetext, "/", "/" & chr (176), 1)
Select case CovT
Case "url"
CText = replace (cText, "[" & CovT & "]" & text, "<a href = '" & codetext & "'target = _ blank>" & codetext, 1, 1)
CText = replace (cText, "<a href = '" & codetext & "'target = _ blank>" & codetext & "[/" & CovT & "]", "<a href =" & codetext & "target = _ blank>" & codetext & "</a>", 1, 1)
Case "email"
CText = replace (cText, "[" & CovT & "]", "<a href = mailto:" & text & ">", 1, 1)
CText = replace (cText, "[/" & CovT & "]", "</a>", 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, "the code snippet is as follows: <TEXTAREA id =" & rid & "rows = 15 style = 'width: 100% 'class = 'bk '> "& codetext, 1)
CText = replace (cText, "the code snippet is as follows: <TEXTAREA id =" & rid & "rows = 15 style = 'width: 100% 'class = 'bk '> "& codetext &" {/html} "," the code snippet is as follows: <TEXTAREA id = "& rid &" rows = 15 style = 'width: 100% 'class = 'bk '> "& codetext &" </TEXTAREA> <INPUT onclick = runEx (' "& rid &"') type = button value = run this code section name = Button1 class = 'tips _ Bo'> <INPUT onclick = JM_cc ('"& rid &"') type = button value = copy to my clipboard name = Button2 class = 'tips _ Bo'> ", 1, 1, 1)
Case "img"
CText = replace (cText, "[img]" & text, "<a href =" & chr (34) & "about: "& chr (34) &" target = _ blank> CText = replace (cText, "[/img]", "vspace = 2 hspace = 2 border = 0 alt =: click the picture to open in a new window:> </a> ", 1, 1)
Case "code"
CText = replace (cText, "[code]" & text, "the following content is the program code CText = replace (cText, "the following content is the program code 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> CText = replace (cText, "<blockquote> Case "swf"
CText = replace (cText, "[swf]" & text, "video address: <br>" & text & "<br> <object classid = 'clsid: d27CDB6E-AE6D-11cf-96B8-444553540000 'codebase = 'HTTP: // adjust width = '000000' height = '000000'> <param name = movie value = '"& codetext &"'> <param name = quality value = high> <embed src = '"& codetext &" 'quality = high pluginspage = 'HTTP: // www.macromedia.com/shockwave/downloa D/index. cgi? P1_Prod_Version = ShockwaveFlash 'Type = 'application/x-shockwave-flash' width = '000000' height = '000000'> ", 500, 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 = '000000' height = '000000'> <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 = '000000' height = '000000'> "&" [/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 = '000000' height = '000000'> <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 = '000000' height = '000000'> "&" </embed> </object> ", 500, 1)
End select
Loop
Convert = cText
End function

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.