API / Minn\Support / Sanitize

Sanitize final class

Minn\Support\Sanitize · public/minn/src/Minn/Support/Sanitize.php · 92 lines

Text made fit to store the way WordPress's sanitizers make it, each ending in the filter plugins hook there, handed the result and what was given: a title (accents gone when saving), a key, a line of plain text, a user name, an email address and the check of one.

Public

statictitle(mixed $title, mixed $fallback = '', mixed $context = 'save'): string#

A title as a slug's source (sanitize_title): accents gone when saving; the fallback when the filter leaves nothing.

statickey(mixed $key): string#

A key (sanitize_key): lower case letters, digits, underscores and dashes only.

statictextField(mixed $text): string#

One line of plain text (sanitize_text_field): tags, line breaks, extra spaces and stray octets gone; anything but text is empty.

staticuser(mixed $username, mixed $strict = false): string#

A user name (sanitize_user): tags, accents, octets and references gone, spaces collapsed; strictly, only letters, digits, spaces and _ . - @.

statichtmlClass(mixed $classname, mixed $fallback = ''): mixed#

A class name for HTML (sanitize_html_class): escaped octets and anything but letters, digits, _ and - taken out; the fallback's when nothing is left; then the filter.

statichexColor(mixed $color): mixed#

A hex colour as given when it is one (#abc or #aabbcc), empty for none, else null (sanitize_hex_color).

statictextareaField(mixed $text): mixed#

Lines of plain text (sanitize_textarea_field): as a text field, line breaks kept; then the filter.

staticemail(mixed $email): string#

An email address with what may not be in one taken out (sanitize_email), and why when nothing is left.

staticisEmail(mixed $email): mixed#

The address when it reads as one, else false (is_email), as the filter leaves it.