# TinyMCE

Object
TinyMCE_Cleanup

### Class TinyMCE_Cleanup

Constructor Summary
TinyMCE_Cleanup() TinyMCE_Cleanup class.

Method Summary
void | addChildRemoveRuleStr() format: h1/h2/h3/h4/h5/h6[%inline_trans_no_a],table[thead|tbody|tfoot|tr|td],body[%btrans]=>p
void | addRuleStr(<string> s) Adds a cleanup rule string, for example: a[!href|!name|title=title|class=class1?class2?class3].
string | formatHTML(<string> h) Applies source formatting/indentation on the specified HTML string.
void | init(<Array> s) Initializes the cleanup engine with the specified config.
Array | parseRuleStr(<string> s) Parses a cleanup rule string, for example: a[!href|name|title=title|class=class1?class2?class3].
string | serializeNodeAsHTML(<HTMLNode> n, <bool> inn) Serializes the specified node as a XHTML string.
string | serializeNodeAsXML(<HTMLNode> n) Serializes the specified node as a HTML string.
string | split(<RegEx> re, <string> s) Splits the specified string and removed empty chunks.
string | xmlEncode(<string> s) XML Encodes the specified string based on configured entity encoding.

### Constructor Detail

#### TinyMCE_Cleanup

TinyMCE_Cleanup()
TinyMCE_Cleanup class.

### Method Detail

#### addChildRemoveRuleStr

void addChildRemoveRuleStr()
format: h1/h2/h3/h4/h5/h6[%inline_trans_no_a],table[thead|tbody|tfoot|tr|td],body[%btrans]=>p

#### addRuleStr

void addRuleStr(<string> s)
Adds a cleanup rule string, for example: a[!href|!name|title=title|class=class1?class2?class3]. These rules are then used when serializing the DOM tree as a HTML string, it gives the possibility to control the valid elements and attributes and force attribute values or default them.

#### Parameters

s - Rule string to parse and add to the cleanup rules array.

#### formatHTML

string formatHTML(<string> h)
Applies source formatting/indentation on the specified HTML string.

#### Parameters

h - HTML string to apply formatting to.

#### Returns

Formatted HTML string.

#### init

void init(<Array> s)
Initializes the cleanup engine with the specified config.

#### Parameters

s - Name/Value array with config settings.

#### parseRuleStr

Array parseRuleStr(<string> s)
Parses a cleanup rule string, for example: a[!href|name|title=title|class=class1?class2?class3]. These rules are then used when serializing the DOM tree as a HTML string, it gives the possibility to control the valid elements and attributes and force attribute values or default them.

#### Parameters

s - Rule string to parse as a name/value rule array.

#### Returns

Parsed name/value rule array.

#### serializeNodeAsHTML

string serializeNodeAsHTML(<HTMLNode> n, <bool> inn)
Serializes the specified node as a XHTML string. This uses the TinyMCE serializer logic since it gives more control over the output than the build in browser XML serializer.

#### Parameters

n - Node to serialize as a XHTML string.
inn - Optional inner HTML mode. Will only output child nodes and not the parent.

#### Returns

Serialized XHTML string based on specified node.

#### serializeNodeAsXML

string serializeNodeAsXML(<HTMLNode> n)
Serializes the specified node as a HTML string. This uses the XML parser and serializer to generate a XHTML string.

#### Parameters

n - Node to serialize as a XHTML string.

#### Returns

Serialized XHTML string based on specified node.

#### split

string split(<RegEx> re, <string> s)
Splits the specified string and removed empty chunks.

#### Parameters

re - RegEx to split string by.
s - String value to split.

#### Returns

Array with parts from specified string.

#### xmlEncode

string xmlEncode(<string> s)
XML Encodes the specified string based on configured entity encoding. The entity encoding modes are raw, numeric and named. Where raw is the fastest and named is default.

#### Parameters

s - String to convert to XML.

#### Returns

Encoded XML string based on configured entity encoding.