C# Class Tp.Web.Extensions.Components.Sanitizer

Clean up HTML code, remove dangerous fragments, such as styles, scripts, event attributes, forms, etc...
IDEA: Use HtmlTextWriter from the .NET framework to write resulting HTML code.
Afficher le fichier Open project: TargetProcess/Tp.HelpDesk Class Usage Examples

Protected Properties

Свойство Type Description
_enabled bool
_tags List

Méthodes publiques

Méthode Description
Sanitize ( string input ) : string

Sanitize input HTML using default settings.

Sanitize ( TextReader input, TextWriter result ) : void
Sanitizer ( ) : System
TextToHtml ( string text ) : string

Méthodes protégées

Méthode Description
After ( TextWriter result ) : void
Before ( TextWriter result ) : void
CaseCData ( HtmlReader htmlReader, TextWriter result ) : void
CaseElement ( HtmlReader htmlReader, TextWriter result ) : void
CaseEndElement ( HtmlReader htmlReader, TextWriter result ) : void
CaseText ( HtmlReader htmlReader, TextWriter result ) : void
CheckStack ( ) : void
FuzzyPopTag ( string item ) : bool

Finds the specified tag somewhere in the stack and removes it from there.

IsValidAttribute ( string key, string value ) : bool
PopTag ( ) : string
Reset ( ) : void

Reset internal state left from previous run.

Sanitize ( HtmlReader htmlReader, TextWriter result ) : void
TopTag ( ) : string
WriteCData ( TextWriter result, string value ) : void
WriteElement ( TextWriter result, string name, StringDictionary attributes, bool empty ) : void
WriteEndElement ( TextWriter result, string name ) : void
WriteString ( TextWriter result, string value ) : void

Private Methods

Méthode Description
PushTag ( string item ) : void

Method Details

After() protected méthode

protected After ( TextWriter result ) : void
result System.IO.TextWriter
Résultat void

Before() protected méthode

protected Before ( TextWriter result ) : void
result System.IO.TextWriter
Résultat void

CaseCData() protected méthode

protected CaseCData ( HtmlReader htmlReader, TextWriter result ) : void
htmlReader HtmlReader
result System.IO.TextWriter
Résultat void

CaseElement() protected méthode

protected CaseElement ( HtmlReader htmlReader, TextWriter result ) : void
htmlReader HtmlReader
result System.IO.TextWriter
Résultat void

CaseEndElement() protected méthode

protected CaseEndElement ( HtmlReader htmlReader, TextWriter result ) : void
htmlReader HtmlReader
result System.IO.TextWriter
Résultat void

CaseText() protected méthode

protected CaseText ( HtmlReader htmlReader, TextWriter result ) : void
htmlReader HtmlReader
result System.IO.TextWriter
Résultat void

CheckStack() protected méthode

protected CheckStack ( ) : void
Résultat void

FuzzyPopTag() protected méthode

Finds the specified tag somewhere in the stack and removes it from there.
protected FuzzyPopTag ( string item ) : bool
item string Item to remove.
Résultat bool

IsValidAttribute() protected méthode

protected IsValidAttribute ( string key, string value ) : bool
key string
value string
Résultat bool

PopTag() protected méthode

protected PopTag ( ) : string
Résultat string

Reset() protected méthode

Reset internal state left from previous run.
protected Reset ( ) : void
Résultat void

Sanitize() public static méthode

Sanitize input HTML using default settings.
public static Sanitize ( string input ) : string
input string Input HTML. May be null.
Résultat string

Sanitize() protected méthode

protected Sanitize ( HtmlReader htmlReader, TextWriter result ) : void
htmlReader HtmlReader
result System.IO.TextWriter
Résultat void

Sanitize() public méthode

public Sanitize ( TextReader input, TextWriter result ) : void
input TextReader
result System.IO.TextWriter
Résultat void

Sanitizer() public méthode

public Sanitizer ( ) : System
Résultat System

TextToHtml() public static méthode

public static TextToHtml ( string text ) : string
text string
Résultat string

TopTag() protected méthode

protected TopTag ( ) : string
Résultat string

WriteCData() protected méthode

protected WriteCData ( TextWriter result, string value ) : void
result System.IO.TextWriter
value string
Résultat void

WriteElement() protected méthode

protected WriteElement ( TextWriter result, string name, StringDictionary attributes, bool empty ) : void
result System.IO.TextWriter
name string
attributes System.Collections.Specialized.StringDictionary
empty bool
Résultat void

WriteEndElement() protected méthode

protected WriteEndElement ( TextWriter result, string name ) : void
result System.IO.TextWriter
name string
Résultat void

WriteString() protected méthode

protected WriteString ( TextWriter result, string value ) : void
result System.IO.TextWriter
value string
Résultat void

Property Details

_enabled protected_oe property

Whether to write elements.
protected bool _enabled
Résultat bool

_tags protected_oe property

Stack with tags.
protected List _tags
Résultat List