值得收藏的html过滤代码

动网论坛中的HTML过滤代码,值得收藏!
Function HTMLEncode(fString)
 fString=Trim(fString)
 fString=Replace(fString,CHR(9),"")
 fString=Replace(fString,CHR(13),"")
 fString=Replace(fString,CHR(22),"")
 fString=Replace(fString,CHR(38),"&") '“&”
 fString=Replace(fString,CHR(32)," ") '“ ”
 fString=Replace(fString,CHR(34),""") '“"”
 fString=Replace(fString,CHR(37),"%") '“%”
 fString=Replace(fString,CHR(39),"'") '“'”
 fString=Replace(fString,CHR(42),"*") '“*”
 fString=Replace(fString,CHR(43),"+") '“+”
 fString=Replace(fString,CHR(44),",") '“,”
 fString=Replace(fString,CHR(45)&CHR(45),"--") '“--”
 fString=Replace(fString,CHR(92),"\") '“\”
 'fString=Replace(fString,CHR(95),"_") '“_”
 fString=Replace(fString,CHR(40),"(") '“(”
 fString=Replace(fString,CHR(41),")") '“)”
 fString=Replace(fString,CHR(60),"&#60;") '“<”
 fString=Replace(fString,CHR(62),"&#62;") '“>”
 fString=Replace(fString,CHR(123),"&#123;") '“{”
 fString=Replace(fString,CHR(125),"&#125;") '“}”
 fString=Replace(fString,CHR(59),"&#59;") '“;”
 fString=Replace(fString,CHR(10),"<br>")
 fString=ReplaceText(fString,"([&#])([a-z0-9]*)&#59;","$1$2;")
 if SiteConfig("BannedText")<>"" then fString=ReplaceText(fString,"("&SiteConfig("BannedText")&")",string(len("&$1&"),"*"))
 if IsSqlDataBase=0 then '过滤片假名(日文字符)[\u30A0-\u30FF] by yuzi
  fString=escape(fString)
  fString=ReplaceText(fString,"%u30([A-F][0-F])","&#x30$1;")
  fString=unescape(fString)
 end if
 HTMLEncode=fString
End Function

本文出自 “simeon技术专栏” 博客,转载请与作者联系!

你可能感兴趣的:(html,代码,过滤,收藏,值得)