Ubbcode.asp
Copy Code code as follows:
<%
Function Ubbcode (strcontent)
If IsEmpty (strcontent) Or isNull (strcontent) Then
Exit Function
Else
Dim Regex,strmatch
Set Regex=new REGEXP
Regex. IgnoreCase =true
Regex. Global=true
Regex. Pattern= "\[html\] ((\ r \ n)?" ( [\s\s]+?)] \[\/html\] "
Set Strmatchs=regex. Execute (strcontent)
For each strmatch in Strmatchs
' Response.Write strmatch.submatches (3)
Randomize
Rndid= "RunCode" &int (100000 * Rnd)
Strcontent=replace (Strcontent,strmatch.value, "<br/><font color=red>html code: </font><TEXTAREA Style= "" width:96%; height:300px "" "Id=" "&rndID&" "class=" "Htmlarea" ">" &ubbfilter (HtmlDecode (2) ) & "</textarea><br/><input onclick=" "RunEx (' &rndID&") "" type= "button" "value=" " Run this Code "/> <input onclick=" docopy ("&rndID&") "type=" "button" "value=" "Copy this Code"/> <input onclick= "" Dosave ("&rndID&") "type=" "button" "value=" "Save Code"/><br/> [Ctrl + a ALL SELECT hint: You can modify part of the code first, then press run] ")
Next
Set strmatchs=nothing
' Go to the empty line
Regex.pattern= "\n[\s]*\r"
Set Strmatchs=regex. Execute (strcontent)
For each strmatch in Strmatchs
Strcontent=replace (Strcontent,strmatch.value, "")
Next
' Code block
Regex. Pattern= "\[code\] ((\ r \ n)?" ( [\s\s]+?)] \[\/code\] "
Set Strmatchs=regex. Execute (strcontent)
For each strmatch in Strmatchs
Randomize
Rndid= "Code" &int (100000 * Rnd)
Strcontent=replace (Strcontent,strmatch.value, "<br/><div style=" "Float:left" "><font color=green" >code code: </font></div><div style= "" Float:right;text-align:right; "" >[<a href= "javascript:void (null)" "Onclick=" Docopy ("&rndID&") "" > Copy this Code </a>]</div> <br/><div class= "" Codetextarea "" id= "" &rndID& "" ">" &strmatch.submatches (2) & "</div > ")
Next
Set strmatchs=nothing
' Implement Insert AV file
Regex. Pattern= "\[(SWF|WMA|WMV|RM|RA|QT) (=\d*?|) (, \d*?|) \] ([^<>]*?) \[\/(SWF|WMA|WMV|RM|RA|QT) \] "
Set Strmatchs=regex. Execute (strcontent)
Dim strtype,strwidth,strheight,strsrc,titletext
For each strmatch in Strmatchs
RAndomize
Strtype=strmatch.submatches (0)
If strtype= "SWF" then
titletext= "flash animation"
ElseIf strtype= "WMA" then
titletext= " Play audio Files"
ElseIf strtype= "WMV" Then
titletext= " Play Video File "
ElseIf strtype= "rm" Then
titletext= " Play real video streaming files "
ElseIf strtype= "RA" Then
titletext= " Play Real Audio streaming files "
ElseIf strtype= "QT" Then
titletext= " Play mov video files "
End If
Strwidth=strmatch.submatches (1)
Strheight=strmatch.submatches (2)
if (Len (strwidth) =0) Then
Strwidth= "400"
Else
Strwidth=right (Strwidth, (Len (strwidth)-1))
End If
if (Len (strheight) =0) Then
strheight= "300"
Else
Strheight=right (Strheight, (Len (strheight)-1))
End If
Strsrc=strmatch.submatches (3)
Rndid= "Temp" &int (100000 * Rnd)
Strcontent= Replace (Strcontent,strmatch.value, "<div class=" "Ubbpanel" "><div class=" "Ubbtitle" ">" & titletext& "</div><div class=" "Ubbcontent" "><a id=" "+rndid+" _href "" href= "javascript: Mediashow (' +strtype+ "', '" +rndid+ ', ' "+strsrc+" ', ' "+strwidth+" ', ' "+strheight+ '") "><span id=" "" +rndid+ "_text" "> Play </span></a><div id= "" "+rndid+" "></div></div></div>" online
Next
Set strmatchs=nothing
Regex. Pattern= "(\[mid\]) (. [ ^\]]*) \[\/mid\] "
Strcontent= regex. Replace (strcontent, "<embed src=" "$" "height=" "," "Width=" "", "" "" Autostart= "" 0 "" ></embed> ")
Regex.pattern= "<br> ([\s| |] *)?<br> "
Strcontent=regex.replace (strcontent, "<br>")
Strcontent=replace (Strcontent, "&", "&")
Strcontent=replace (strcontent, "'", "" ")
Strcontent=replace (Strcontent, "", "") ' because previously uploaded pictures
Set regex=nothing
End If
Ubbcode=strcontent
End Function
%>
Basically from Pjhome.