C# 클래스 Tp.Utils.Html.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.
파일 보기 프로젝트 열기: TargetProcess/Target-Process-Plugins

보호된 프로퍼티들

프로퍼티 타입 설명
AutoClosedTags HashSet
EmptyTags HashSet
EventAttributes HashSet
ExcludeTags HashSet
IgnoreTags HashSet
IncludeTags HashSet
RewriteTags string>.IDictionary
UntouchableAttributes HashSet
_enabled bool
_tags List

공개 메소드들

메소드 설명
ClearMarkdownTag ( string input ) : string
FormatComment ( string text ) : string
IsMarkdown ( string input ) : bool
Process ( string input ) : string
Sanitize ( string input ) : string

Sanitize input HTML using default settings.

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

Htmlize text, that is replace new line with <br/>, etc.

This method will try to sniff whether the original text is already a html document.

보호된 메소드들

메소드 설명
AfterDocument ( TextWriter result ) : void
BeforeDocument ( 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.

HtmlAttributeEncode ( string value, TextWriter writer ) : void
HtmlEncode ( string value, TextWriter writer ) : void
IsValidAttribute ( string name, string key, string value ) : bool
PopTag ( ) : string
Reset ( ) : void

Reset internal state left from previous run.

RewriteTag ( string tagName ) : string

Checks for rewrite and rewrites tag if necessary

Sanitize ( HtmlReader htmlReader, TextWriter result ) : void
WriteCData ( TextWriter result, string value ) : void
WriteElement ( TextWriter result, string name, string>.Dictionary attributes, bool empty ) : void
WriteEndElement ( TextWriter result, string name ) : void
WriteText ( TextWriter result, string value ) : void

비공개 메소드들

메소드 설명
PushTag ( string item ) : void

메소드 상세

AfterDocument() 보호된 메소드

protected AfterDocument ( TextWriter result ) : void
result System.IO.TextWriter
리턴 void

BeforeDocument() 보호된 메소드

protected BeforeDocument ( TextWriter result ) : void
result System.IO.TextWriter
리턴 void

CaseCData() 보호된 메소드

protected CaseCData ( HtmlReader htmlReader, TextWriter result ) : void
htmlReader HtmlReader
result System.IO.TextWriter
리턴 void

CaseElement() 보호된 메소드

protected CaseElement ( HtmlReader htmlReader, TextWriter result ) : void
htmlReader HtmlReader
result System.IO.TextWriter
리턴 void

CaseEndElement() 보호된 메소드

protected CaseEndElement ( HtmlReader htmlReader, TextWriter result ) : void
htmlReader HtmlReader
result System.IO.TextWriter
리턴 void

CaseText() 보호된 메소드

protected CaseText ( HtmlReader htmlReader, TextWriter result ) : void
htmlReader HtmlReader
result System.IO.TextWriter
리턴 void

CheckStack() 보호된 메소드

protected CheckStack ( ) : void
리턴 void

ClearMarkdownTag() 공개 정적인 메소드

public static ClearMarkdownTag ( string input ) : string
input string
리턴 string

FormatComment() 공개 정적인 메소드

public static FormatComment ( string text ) : string
text string
리턴 string

FuzzyPopTag() 보호된 메소드

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

HtmlAttributeEncode() 보호된 메소드

protected HtmlAttributeEncode ( string value, TextWriter writer ) : void
value string
writer System.IO.TextWriter
리턴 void

HtmlEncode() 보호된 메소드

protected HtmlEncode ( string value, TextWriter writer ) : void
value string
writer System.IO.TextWriter
리턴 void

IsMarkdown() 공개 정적인 메소드

public static IsMarkdown ( string input ) : bool
input string
리턴 bool

IsValidAttribute() 보호된 메소드

protected IsValidAttribute ( string name, string key, string value ) : bool
name string
key string
value string
리턴 bool

PopTag() 보호된 메소드

protected PopTag ( ) : string
리턴 string

Process() 공개 메소드

public Process ( string input ) : string
input string
리턴 string

Reset() 보호된 메소드

Reset internal state left from previous run.
protected Reset ( ) : void
리턴 void

RewriteTag() 보호된 메소드

Checks for rewrite and rewrites tag if necessary
protected RewriteTag ( string tagName ) : string
tagName string
리턴 string

Sanitize() 공개 정적인 메소드

Sanitize input HTML using default settings.
public static Sanitize ( string input ) : string
input string Input HTML. May be null.
리턴 string

Sanitize() 보호된 메소드

protected Sanitize ( HtmlReader htmlReader, TextWriter result ) : void
htmlReader HtmlReader
result System.IO.TextWriter
리턴 void

Sanitize() 공개 메소드

public Sanitize ( TextReader input, TextWriter result ) : void
input System.IO.TextReader
result System.IO.TextWriter
리턴 void

Sanitizer() 공개 메소드

public Sanitizer ( ) : System
리턴 System

TextToHtml() 공개 정적인 메소드

Htmlize text, that is replace new line with <br/>, etc.
This method will try to sniff whether the original text is already a html document.
public static TextToHtml ( string text ) : string
text string Original text, may be null.
리턴 string

WriteCData() 보호된 메소드

protected WriteCData ( TextWriter result, string value ) : void
result System.IO.TextWriter
value string
리턴 void

WriteElement() 보호된 메소드

protected WriteElement ( TextWriter result, string name, string>.Dictionary attributes, bool empty ) : void
result System.IO.TextWriter
name string
attributes string>.Dictionary
empty bool
리턴 void

WriteEndElement() 보호된 메소드

protected WriteEndElement ( TextWriter result, string name ) : void
result System.IO.TextWriter
name string
리턴 void

WriteText() 보호된 메소드

protected WriteText ( TextWriter result, string value ) : void
result System.IO.TextWriter
value string
리턴 void

프로퍼티 상세

AutoClosedTags 보호되어 있는 프로퍼티

These tags may not be explicitly closed, but presense of a new open tag automaticaly closes the previously open but not closed tag.
protected HashSet AutoClosedTags
리턴 HashSet

EmptyTags 보호되어 있는 프로퍼티

These tags need not be closed explicitly.
protected HashSet EmptyTags
리턴 HashSet

EventAttributes 보호되어 있는 프로퍼티

Attributes to be suppressed.
protected HashSet EventAttributes
리턴 HashSet

ExcludeTags 보호되어 있는 프로퍼티

Tags whose outer html to be suppressed. In other words, entire tag with its content will be suppressed.
protected HashSet ExcludeTags
리턴 HashSet

IgnoreTags 보호되어 있는 프로퍼티

Write inner instead of outer html for these tags. In other words, write tag content without tag.
protected HashSet IgnoreTags
리턴 HashSet

IncludeTags 보호되어 있는 프로퍼티

Overrides suppression caused by the tags above, enables outer html.
protected HashSet IncludeTags
리턴 HashSet

RewriteTags 보호되어 있는 프로퍼티

Rewrite some (obsolete, deprecated) tags to another tags.
protected IDictionary RewriteTags
리턴 string>.IDictionary

UntouchableAttributes 보호되어 있는 프로퍼티

Untouchable attributes.
protected HashSet UntouchableAttributes
리턴 HashSet

_enabled 보호되어 있는 프로퍼티

Whether to write elements.
protected bool _enabled
리턴 bool

_tags 보호되어 있는 프로퍼티

Stack with tags.
protected List _tags
리턴 List