include/phpmailer/extras/htmlfilter.php
Functions
HTMLFilter(
$body, $trans_image_path, $block_external_images
=
false
)
:
void
Name | Type | Description |
---|---|---|
$body | ||
$trans_image_path | ||
$block_external_images |
tln_casenormalize(
\$val $val
)
:
void
A small helper function to use with array_walk. Modifies a by-ref value and makes it lowercase.
Name | Type | Description |
---|---|---|
$val | \$val | a value passed by-ref. |
tln_deent(
\$attvalue $attvalue, \$regex $regex, \$hex $hex
=
false
)
:
True
Translates entities into literal values so they can be checked.
Name | Type | Description |
---|---|---|
$attvalue | \$attvalue | the by-ref value to check. |
$regex | \$regex | the regular expression to check against. |
$hex | \$hex | whether the entites are hexadecimal. |
Type | Description |
---|---|
True | or False depending on whether there were matches. |
tln_defang(
\$attvalue $attvalue
)
:
\Nothing,
This function checks attribute values for entity-encoded values and returns them translated into 8-bit strings so we can run checks on them.
Name | Type | Description |
---|---|---|
$attvalue | \$attvalue | A string to run entity check against. |
Type | Description |
---|---|
\Nothing, | modifies a reference value. |
tln_findnxreg(
\$body $body, \$offset $offset, \$reg $reg
)
:
\Returns
This function takes a PCRE-style regexp and tries to match it within the string.
Name | Type | Description |
---|---|---|
$body | \$body | The string to look for needle in. |
$offset | \$offset | Start looking from here. |
$reg | \$reg | A PCRE-style regex to match. |
Type | Description |
---|---|
\Returns | a false if no matches found, or an array with the following members: - integer with the location of the match within $body - string with whatever content between offset and the match - string with whatever it is we matched |
tln_findnxstr(
\$body $body, \$offset $offset, \$needle $needle
)
:
\location
This function looks for the next character within a string. It's really just a glorified "strpos", except it catches the failures nicely.
Name | Type | Description |
---|---|---|
$body | \$body | The string to look for needle in. |
$offset | \$offset | Start looking from this position. |
$needle | \$needle | The character/string to look for. |
Type | Description |
---|---|
\location | of the next occurance of the needle, or strlen($body) if needle wasn't found. |
tln_fixatts(
\$tagname $tagname, \$attary $attary, \$rm_attnames $rm_attnames, \$bad_attvals $bad_attvals, \$add_attr_to_tag $add_attr_to_tag
)
:
Array
This function runs various checks against the attributes.
Name | Type | Description |
---|---|---|
$tagname | \$tagname | String with the name of the tag. |
$attary | \$attary | Array with all tag attributes. |
$rm_attnames | \$rm_attnames | See description for tln_sanitize |
$bad_attvals | \$bad_attvals | See description for tln_sanitize |
$add_attr_to_tag | \$add_attr_to_tag | See description for tln_sanitize |
Type | Description |
---|---|
Array | with modified attributes. |
tln_getnxtag(
\$body $body, \$offset $offset
)
:
false
This function looks for the next tag.
Name | Type | Description |
---|---|---|
$body | \$body | String where to look for the next tag. |
$offset | \$offset | Start looking from here. |
Type | Description |
---|---|
false | if no more tags exist in the body, or an array with the following members: - string with the name of the tag - array with attributes and their values - integer with tag type (1, 2, or 3) - integer where the tag starts (starting "<") - integer where the tag ends (ending ">") first three members will be false, if the tag is invalid. |
tln_sanitize(
\$body $body, \$tag_list $tag_list, \$rm_tags_with_content $rm_tags_with_content, \$self_closing_tags $self_closing_tags, \$force_tag_closing $force_tag_closing, \$rm_attnames $rm_attnames, \$bad_attvals $bad_attvals, \$add_attr_to_tag $add_attr_to_tag
)
:
\tln_sanitized
Name | Type | Description |
---|---|---|
$body | \$body | the string with HTML you wish to filter |
$tag_list | \$tag_list | see description above |
$rm_tags_with_content | \$rm_tags_with_content | see description above |
$self_closing_tags | \$self_closing_tags | see description above |
$force_tag_closing | \$force_tag_closing | see description above |
$rm_attnames | \$rm_attnames | see description above |
$bad_attvals | \$bad_attvals | see description above |
$add_attr_to_tag | \$add_attr_to_tag | see description above |
Type | Description |
---|---|
\tln_sanitized | html safe to show on your pages. |
tln_skipspace(
\$body $body, \$offset $offset
)
:
\the
This function skips any whitespace from the current position within a string and to the next non-whitespace value.
Name | Type | Description |
---|---|---|
$body | \$body | the string |
$offset | \$offset | the offset within the string where we should start looking for the next non-whitespace character. |
Type | Description |
---|---|
\the | location within the $body where the next non-whitespace char is located. |
tln_tagprint(
\$tagname $tagname, \$attary $attary, \$tagtype $tagtype
)
:
\a
This function returns the final tag out of the tag name, an array of attributes, and the type of the tag. This function is called by tln_sanitize internally.
Name | Type | Description |
---|---|---|
$tagname | \$tagname | the name of the tag. |
$attary | \$attary | the array of attributes and their values |
$tagtype | \$tagtype | The type of the tag (see in comments). |
Type | Description |
---|---|
\a | string with the final tag representation. |
tln_unspace(
\attvalue $attvalue
)
:
\attvalue
Kill any tabs, newlines, or carriage returns. Our friends the makers of the browser with 95% market value decided that it'd be funny to make "java[tab]script" be just as good as "javascript".
Name | Type | Description |
---|---|---|
$attvalue | \attvalue | The attribute value before extraneous spaces removed. |
Type | Description |
---|---|
\attvalue | Nothing, modifies a reference value. |