<%
'Filter various HTML Tag style scripts
'Source: http://jorkin.reallydo.com/article.asp? Id = 521
'Need RegReplace function: http://jorkin.reallydo.com/article.asp? Id = 345
Function HTMLFilter (sHTML, sFilters)
If sHTML & "" = "" Then Exit Function
If sFilters & "" = "" Then sFilters = "SCRIPT, OBJECT"
Dim aFilters
AFilters = Split (UCase (sFilters ),",")
For I = 0 To UBound (aFilters)
Select Case UCase (Trim (aFilters (I )))
Case "JORKIN"
Do While instr (shtml, "& nbsp;")> 0
Shtml = Replace (shtml, "& nbsp;", "& nbsp ;")
Loop
Case "script"
'// Remove the script <scr ept> </scr EPT> and onload.
Shtml = regreplace (shtml, "<SCRIPT [\ s] *? </SCRIPT> ","")
Shtml = regreplace (shtml, "\ s [on]. +? = \ S +? ([\ "" | \ ']) (. *?) \ 1 ","")
Shtml = regreplace (shtml, "(JavaScript | JScript | VBScript | vbs):", "$1 :")
Case "fiximg"
Shtml = regreplace (shtml, "] *). *?> "," ")
Shtml = regreplace (shtml, " "," ")
Case "table"
'// Remove the table <table> <tr> <td> <th>
SHTML = RegReplace (sHTML, "</? TABLE [^>] *> ","")
SHTML = RegReplace (sHTML, "</? TBODY [^>] *> ","")
SHTML = RegReplace (sHTML, "<(/?) TR [^>] *> "," <$1 p> ")
SHTML = RegReplace (sHTML, "</? TH [^>] *> ","")
SHTML = RegReplace (sHTML, "</? TD [^>] *> ","")
Case "CLASS"
'// Remove the Style class = ""
SHTML = RegReplace (sHTML, "(<[^>] +) CLASS = [^ | ^>] + ([^>] *> )", "$1 $2 ")
SHTML = RegReplace (sHTML, "\ sCLASS \ s *? = \ S *? ([\ "" | \ ']) (. *?) \ 1 ","")
Case "STYLE"
'// Remove the style = ""
Shtml = regreplace (shtml, "(<[^>] +) style = [^ | ^>] + ([^>] *> )", "$1 $2 ")
Shtml = regreplace (shtml, "\ sstyle \ s *? = \ S *? ([\ "" | \ ']) (. *?) \ 1 ","")
Case "XML"
'// Remove XML <? XML>
Shtml = regreplace (shtml, "<\\? XML [^>] *> ","")
Case "namespace"
'// Remove the namespace <O: P> </O: P>
Shtml = regreplace (shtml, "<\/? [A-Z] +: [^>] *> ","")
Case "font"
'// Remove the font <font> </font>
Shtml = regreplace (shtml, "</? Font [^>] *> ","")
Case "marquee"
'// Subtitle removal <marquee> </marquee>
SHTML = RegReplace (sHTML, "</? MARQUEE [^>] *> ","")
Case "OBJECT"
'// Remove the object <object> <param> <embed> </object>
SHTML = RegReplace (sHTML, "</? OBJECT [^>] *> ","")
SHTML = RegReplace (sHTML, "</? PARAM [^>] *> ","")
SHTML = RegReplace (sHTML, "</? EMBED [^>] *> ","")
Case "COMMENT"
'// Remove HTML comments. The <script> and <style> comments are processed with caution.
SHTML = RegReplace (sHTML, "<! -- [\ S \ S] *? --> ","")
Case Else
'// Remove other labels
SHTML = RegReplace (sHTML, "</? "& AFilters (I) &" [^>] *?> ","")
End Select
Next
Htmlfilter = shtml
End Function
%>
Source: http://Jorkin.Reallydo.Com/default.asp? Id = 521