<script Language=javascript runat=server>
//===============================================
Single Filter
Input parameters:
S_content: The data string to convert
S_filter: A single format to filter out
//===============================================
function Ewebeditor_decodefilter (HTML, filter) {
Switch (Filter.touppercase ()) {
Case "Script"://Remove all client script Javascipt,vbscript,jscript,js,vbs,event,...
html = ewebeditor_execre ("</?script[^>]*>", "", HTML);
html = Ewebeditor_execre ("(javascript|jscript|vbscript|vbs):", "$:", HTML);
html = Ewebeditor_execre ("On" (Mouse|exit|error|click|key), "<I>on$1</I>", HTML);
html = ewebeditor_execre ("&#", "<I>&#</I>", HTML);
Break
Case "TABLE"://Removal form <table><tr><td><th>
html = ewebeditor_execre ("</?table[^>]*>", "", HTML);
html = ewebeditor_execre ("</?tr[^>]*>", "", HTML);
html = ewebeditor_execre ("</?th[^>]*>", "", HTML);
html = ewebeditor_execre ("</?td[^>]*>", "", HTML);
Break
Case "class"://Remove Style class class= ""
html = Ewebeditor_execre ("(<[^>]+) class=[^ |^>]* ([^>]*>)", "$ $", HTML);
Break
Case "style"://Remove style style= ""
html = Ewebeditor_execre ("(<[^>]+) style=\" [^\ "]*\" ([^>]*>), "$ $", HTML);
Break
Case "XML"://Remove xml<?xml>
html = ewebeditor_execre ("<\\?xml[^>]*>", "", HTML);
Break
Case "NAMESPACE"://removal of namespaces <o:p></o:p>
html = ewebeditor_execre ("<\/?[ A-z]+:[^>]*> "," ", HTML);
Break
Case "FONT"://Remove Font <font></font>
html = ewebeditor_execre ("</?font[^>]*>", "", HTML);
Break
Case "MARQUEE"://Remove Subtitles <marquee></marquee>
html = ewebeditor_execre ("</?marquee[^>]*>", "", HTML);
Break
Case "Object"://Remove Object <object><param><embed></object>
html = ewebeditor_execre ("</?object[^>]*>", "", HTML);
html = ewebeditor_execre ("</?param[^>]*>", "", HTML);
html = ewebeditor_execre ("</?embed[^>]*>", "", HTML);
Break
Default
}
return HTML;
}
// ============================================
Perform regular expression substitution
// ============================================
function Ewebeditor_execre (Re, RP, content) {
Oreg = new RegExp (Re, "IG");
R = Content.replace (Oreg, RP);
return R;
}
</Script>