Escape final class
Minn\Support\Escape · public/minn/src/Minn/Support/Escape.php · 128 lines
Text made safe the way WordPress's escapers make it, each ending in the filter plugins hook there, handed the result and the original: for HTML (esc_html, esc_attr) invalid UTF-8 emptied, entities already present normalised rather than encoded again, the specials and both quotes encoded; for a textarea, everything encoded; for an inline script, a single-quoted string's specials; and an address (esc_url) cleaned, its protocol checked against the allowed ones.
Used by 43 (show)
Public
| static | html(mixed $text): string# | Text for an element's content. |
| static | attr(mixed $text): string# | Text for an attribute's value. |
| static | tag(mixed $tagName): mixed# | A tag name (tag_escape): letters, digits, hyphens, underscores and colons, lowercased, as tag_escape leaves it. |
| static | textarea(mixed $text): string# | Text for a textarea (esc_textarea): every special and quote encoded, references included. |
| static | js(mixed $text): string# | Text inside a single-quoted script string (esc_js): specials and double quotes encoded, single quotes and newlines escaped. |
| static | url(mixed $url, mixed $protocols = NULL, mixed $context = 'display'): string# | An address to print ('display') or to store ('db'): a missing scheme is http (https when only https is allowed); for display "&" and "'" become references; brackets are encoded; an address on a protocol not allowed (the site's, unless a list is given) is empty. Then clean_url, handed the address, the original and the context. |
| static | validUtf8(string $text): string# | The text when it is valid UTF-8, else nothing (wp_check_invalid_utf8 without stripping). |
| static | specialchars(string $text, string|int|false $quotes): string# | The specials encoded in the given quote style (_wp_specialchars), references already present normalised the way kses normalises them rather than encoded again. |
| static | xml(string $text): string# | Text for an XML document (esc_xml): named references XML lacks are decoded (or their ampersand escaped), a bare ampersand and the four specials encoded, and CDATA sections left exactly as written (probe media-template-doubts). |
Internals 3
Private and protected methods: how the class does its work. Not a contract; they change whenever the code is tidied.
Nothing matches.