Minn\Support
Escaping, serialized readers, small helpers. 37 classes, 151 public methods and 49 internals. This page is the public surface; each class name opens the whole class.
Accents final class
public/minn/src/Minn/Support/Accents.php · 35 lines · Open the class →
Accented and special characters to their plain spelling, from the reference's own table (data/accents.json, captured with tests/tools/accents-capture.php): text is put in composed form first, a locale with spellings of its own (German, Danish, Catalan, Serbian, Bosnian) has them, and a string that is not UTF-8 is read as Latin-1. Anything the table does not name stays as it is.
| static | strip(string $text, string $locale = ''): string | The text with its accented characters spelled plainly, as the locale spells them. |
| inside | data() |
Backtrace final class
public/minn/src/Minn/Support/Backtrace.php · 32 lines · Open the class →
A call stack named as wp_debug_backtrace_summary names it (probe placeholders-a): Class->method, Class::method and function names; a hook's function with the hook named; an included file by its path with the given prefixes taken off, in order. Innermost first.
| static | summary(array $frames, ?string $ignoreClass, int $skip, array $truncate): array | The frames' names, after the first $skip. @param list<array<string, mixed>> $frames debug_backtrace()'s frames, innermost first@param list<string> $truncate path prefixes taken off an included file@return list<string> |
ByteSize final class
public/minn/src/Minn/Support/ByteSize.php · 18 lines · Open the class →
A count of bytes as a person reads it (size_format): in the largest unit it reaches, from bytes to exabytes in steps of 1024, the number written for the site's locale.
| static | format(mixed $bytes, mixed $decimals = 0): mixed | The size with the decimals asked for; false for less than a byte. |
DirectoryListing final class
public/minn/src/Minn/Support/DirectoryListing.php · 34 lines · Open the class →
Walks a directory the way the filesystem API lists it: named entries, dot entries skipped, hidden ones optional, recursion optional.
| static | read(string $path, bool $includeHidden, bool $recursive, ?string $onlyName, callable $describe): array|false | A directory's entries described one by one, or false when unreadable. @param callable(string): array<string, mixed> $describe the entry's own fields for an absolute path@return array<string, array<string, mixed>>|false false when the path is not a readable directory |
Email final class
public/minn/src/Minn/Support/Email.php · 69 lines · Open the class →
The address rules the reference applies: a local part from a fixed character class, a dotted domain of hyphen-trimmed labels. `check` names the first rule an address breaks; `sanitize` strips what it can and names why it gave up.
| static | check(string $email): ?string | Why an address is invalid, or null when it passes the reference's checks. |
| static | sanitize(string $raw): array | An address with the characters the reference strips removed, and what was removed. @return array{0: string, 1: string|null} the cleaned address (empty when refused) and the reason |
Entities final class
public/minn/src/Minn/Support/Entities.php · 89 lines · Open the class →
HTML special-character encoding with the reference's quote styles and its "do not double encode" rule: an ampersand that already starts a known named or numeric entity stays as it is.
| static | specialchars(string $text, string|int|false $quoteStyle, bool $doubleEncode, callable $knownEntity): string | The reference's special-characters escaping, with its quote styles and double-encoding rule. @param callable(string): bool $knownEntity whether a named entity is in the allowed table |
| static | decode(string $text, string|int $quoteStyle): string | The reverse of specialchars: the five characters back, with the quote pairs the style asks for. |
| static | convertInvalid(string $text): string | Windows-1252 numeric references rewritten as the Unicode references they meant. |
| static | numericAsBytes(string $content): string | Numeric character references as the bytes they name, modulo 256 (wp_kses_decode_entities). |
| inside | encodeStrayAmpersands(), windows1252() |
Escape final class
public/minn/src/Minn/Support/Escape.php · 128 lines · Open the class →
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.
| 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). |
| inside | xmlText(), xmlCharacter(), encoded() |
FileHeaders final class
public/minn/src/Minn/Support/FileHeaders.php · 27 lines · Open the class →
Header values from a plugin or theme file. The labels (Plugin Name, Theme Name, Version) are the published file-header contract; the reader is a line scan of the first 8 KB, never PHP execution.
| static | values(string $file, array $labels): array | The header values of a plugin or theme file, by label. @param list<string> $labels@return array<string, string> |
FileTree final class
public/minn/src/Minn/Support/FileTree.php · 146 lines · Open the class →
Whole-directory reads and copies. The engine's own installer, the update unpacker and the plugins that reach for WordPress's copy_dir all want the same two operations: list a tree, and duplicate one.
| static | files(string $dir, int $depth = 0, array $skip = array ( )): array|false | Every file under a directory, as list_files gives them: names starting with a dot left out, the names in $skip left out at the top level only, an empty folder named with a trailing slash. Depth 0 means no limit; at the depth given a folder is named with its slash instead of entered. @param list<string> $skip@return list<string>|false false when the directory cannot be read |
| static | filesWithHidden(string $dir, int $depth = 0, array $skip = array ( )): array|false | As files(), dot files and folders included. @param list<string> $skip@return list<string>|false |
| static | copy(string $from, string $to, array $skip = array ( )): bool | Copies a directory's contents into another, creating it if it is not there. Names in $skip are left behind at the top level only, which is how the update unpacker keeps a directory it means to preserve. @param list<string> $skip |
| static | copyThrough(object $fs, string $from, string $to, array $skip, int $fileMode, int $dirMode): ?array | A directory copied through a WordPress filesystem object, as copy_dir copies it: the source listed, the destination made when it is missing, each file copied (once more after a chmod when the first copy fails), each missing folder made and copied in turn. A name in $skip is left out at its own level, "folder/name" one level down. Null when it all copied, else the refusal's code and data. @param list<string> $skip@return array{0: string, 1: string}|null |
| static | listedFiles(mixed $listing, string $dir): array | The files of a recursive filesystem listing (dirlist), each as a path under $dir, in listing order, folders' files where the folder stands. @return list<string> |
| inside | walk() |
Files final class
public/minn/src/Minn/Support/Files.php · 66 lines · Open the class →
Recursive filesystem work behind WP_Filesystem_Direct: best-effort tree delete and chmod (suppressed errors, keep-going semantics, the AND of every step as the result), and the symbolic-to-octal permission string conversion. The facade class keeps the reference's argument handling and maps each operation here.
| static | octalFromSymbolic(string $mode): string | drwxr-xr-x (or any rwx string) to its octal digits, the reference's tallying shape. |
| static | deleteTree(string $path): bool | Delete a directory tree, files first, best effort; true only when everything went. A symlinked directory is unlinked, never followed: the dev sites symlink plugin folders into the tree, and a delete that reached through one would empty the real source. |
| static | chmodTree(string $path, int $mode): bool | Apply a mode to every FILE under a directory (the directories themselves keep theirs); always reports true. |
Flag final class
public/minn/src/Minn/Support/Flag.php · 11 lines · Open the class →
A yes or no as WordPress reads one from loose input (wp_validate_boolean).
| static | of(mixed $value): bool | The string "false" in any case is no; anything else is PHP's truth. |
Hierarchy final class
public/minn/src/Minn/Support/Hierarchy.php · 52 lines · Open the class →
Loops in a parent chain, found with two walkers: a slow one that takes one step at a time and a fast one that takes two (probe functions-utils, the hierarchy-loop finders). They meet only when the chain loops; it ends when a parent is empty. Each walker reads parents through the closure it is given, so a caller can override any node's parent.
| static | meeting(Closure $parentOf, mixed $start): mixed | The node where the slow walker meets the fast one, or null when the chain ends. @param Closure(mixed): mixed $parentOf a node's parent |
| static | walked(Closure $parentOf, mixed $start): ?array | Every node either walker stepped on before they met, in the order first reached (the slow walker's node, then the fast one's two steps), or null when the chain ends without a loop. @param Closure(mixed): mixed $parentOf a node's parent@return array<int|string, true>|null |
| inside | walk() |
Ip final class
public/minn/src/Minn/Support/Ip.php · 22 lines · Open the class →
Addresses with their identifying tail removed, for logs and analytics that must not keep a visitor's exact address. An IPv4 address loses its last octet, an IPv6 address its last four groups. Anything that is not an address at all reads as the unspecified IPv4 address rather than as itself, so a malformed value can never leak through unchanged.
| static | anonymize(string $address): string | An address with its last octet, or its tail, zeroed. |
Kses final class
public/minn/src/Minn/Support/Kses.php · 579 lines · Open the class →
The HTML a user without unfiltered_html may store. Tags outside the allowlist are removed and their text kept; attributes outside the tag's list are dropped; URL attributes lose unsafe schemes; style attributes keep only listed properties and no code. Comments keep their text, and block delimiters are written back with their attribute values filtered.
| const | COMMENT = array ( 'a' => array ( 0 => 'href', 1 => 'title', 2 => 'rel', ), 'abbr' => array ( 0 => 'title', ), 'acronym' => array ( 0 => 'title', ), 'b' => array ( ), 'blockquote' => array ( 0 => 'cite', ), 'cite' => array ( ), 'code' => array ( ), 'del' => array ( 0 => 'datetime', ), 'em' => array ( ), 'i' => array ( ), 'q' => array ( 0 => 'cite', ), 's' => array ( ), 'strike' => array ( ), 'strong' => array ( ), ) | |
| const | URI_ATTRIBUTES = array ( 0 => 'action', 1 => 'archive', 2 => 'background', 3 => 'cite', 4 => 'classid', 5 => 'codebase', 6 => 'data', 7 => 'formaction', 8 => 'href', 9 => 'icon', 10 => 'longdesc', 11 => 'manifest', 12 => 'poster', 13 => 'profile', 14 => 'src', 15 => 'usemap', 16 => 'xmlns', ) | Every attribute the reference treats as holding a URI, so its scheme is judged wherever the attribute is allowed. |
| const | SCHEMES = array ( 0 => 'http', 1 => 'https', 2 => 'ftp', 3 => 'ftps', 4 => 'mailto', 5 => 'news', 6 => 'irc', 7 => 'gopher', 8 => 'nntp', 9 => 'feed', 10 => 'telnet', 11 => 'mms', 12 => 'rtsp', 13 => 'sms', 14 => 'svn', 15 => 'tel', 16 => 'fax', 17 => 'xmpp', 18 => 'webcal', 19 => 'urn', ) | The URI schemes allowed by default. |
| static | post(string $html): string | Post content as an author without unfiltered_html may store it. |
| static | comment(string $html): string | A comment, profile or term description as anyone without unfiltered_html may store it: listed attributes only. |
| static | sanitize(string $html, Minn\Support\KsesPolicy $policy): string | The whole pass wp_kses makes with its default hooks: control characters out, references normalized, a "<" that opens no tag escaped, block attribute values filtered the same way, then the tags. |
| static | withoutControls(string $html): string | The control characters kses removes (tab, newline and carriage return stay). |
| static | withoutNulls(string $content): string | The control characters and backslashed zeros taken out (wp_kses_no_null). |
| static | normalizeEntities(string $html): string | Every "&" made a reference, in one pass: a known name or a code point kses accepts stays one (decimal padded to three digits, hex with a lower-case x), anything else becomes "&". |
| static | lessThan(string $html, ?Closure $escape = NULL): string | A "<" that reaches the next "<" or the end without a ">" is text: the run is escaped the way esc_html escapes it (quotes included). @param (Closure(string): string)|null $escape |
| static | escapeHtml(string $text): string | Text escaped for HTML with references kept: invalid UTF-8 gives nothing, quotes become " and '. |
| static | blockAttributes(string $html, Closure $clean, ?Closure $entry = NULL): string | Block markup with every attribute key and string value passed through the same filter, and the delimiters written back in their canonical form ("--->" read as "-->"). Markup without a comment is left alone. |
| static | blockAttributesParsed(string $html, Closure $clean, ?Closure $entry = NULL): string | As blockAttributes, the blocks read by the parser block_parser_class names (probe kses-allowed-asks), written back as it read them; $entry sees each cleaned entry with its block's name and key and returns its value (a template part's tag names, probe sweep-1020b). @param Closure(string): string $clean@param ?Closure(?string, int|string, mixed): mixed $entry |
| static | allowing(string $content, array|string $allowedHtml, mixed $protocols, ?Closure $tagsFor = NULL): string | Content kept to an allowlist as wp_kses keeps it: control characters dropped (a slashed zero kept), references normalized, then pre_kses (handed the allowlist and protocols as given), then only the markup the allowlist allows, with links on the given protocols. A named allowlist (a context such as "post") is resolved by $tagsFor after pre_kses. The URI attributes are asked for only when the content opens an element the allowlist allows. @param array<string, mixed>|string $allowedHtml@param Closure(string): array<string, mixed>|null $tagsFor |
| static | uriAttributes(): mixed | The attributes judged as URIs, through wp_kses_uri_attributes (its answer as given). |
| static | filter(string $html, Minn\Support\KsesPolicy $policy): string | The tag pass: each run from "<" to the next ">" (or the end) is a comment, an inert bogus comment ("</" before a non-letter, "<!" before a lower-case letter), or an element judged by the policy; anything else in angle brackets goes. Text between keeps its references, with stray ones escaped. Run alone (wp_kses_split), a last "<" with no ">" still reads as a tag; inside sanitize() the less-than pass has already escaped it. |
| static | tag(string $run, Minn\Support\KsesPolicy $policy): string | One run of the tag pass on its own (wp_kses_split2): a comment, a tag, or, for anything not starting with "<", a lone ">". |
| static | element(string $element, string $attributes, Minn\Support\KsesPolicy $policy): string | An element rebuilt with the attributes the policy allows it (wp_kses_attr), its name as written and an XHTML slash kept; an element the policy does not know keeps none. |
| static | attributeList(string $raw): ?array | The attributes written inside a tag, read the way kses reads them: a name, then "=" and a quoted or bare value, or no value at all; junk between (stray quotes, "=", "/") is skipped; the first of two same-named attributes wins. Null when a quoted value never closes, which costs the tag every attribute. @return array<string, array{name: string, value: ?string, whole: string}>|null |
| static | text(string $value): string | Plain text: tags gone, whitespace collapsed, control characters dropped. |
| static | url(string $url): string | A URL for a stored field: empty when its scheme is not one the reference allows. The scheme is judged as a browser reads it, without the tabs, line breaks and other control characters it drops (java, a tab, then script: is javascript:). |
| static | attributeUrl(string $url, array $schemes = self::SCHEMES): string | A URL inside markup: whatever stands before the first colon, once every character reference and percent escape is decoded as deep as it goes and the invisible characters are dropped, must be an allowed scheme, or it is cut off and the rest is judged again. The reference cuts "?q=a:b" to "b" and "javascript:alert(1)//http://" to "//" the same way. A value with a good scheme is returned as given. @param list<string> $schemes |
| static | validCodePoint(int $code): bool | Whether a code point is one a reference may name (valid_unicode): tab, line feed, carriage return, and the rest of Unicode from space up, except the surrogates and U+FFFE and U+FFFF. |
| static | pdfObject(string $url, string $uploadsUrl): bool | Whether a URL may be an object's data in post content: an http or https URL on the uploads host and port, no credentials, query or fragment, whose path ends in ".pdf". |
| inside | cleaned(), cleanValue(), tagsAsked(), run(), htmlComment(), deepDecode(), visible(), normalizeText(), normalizeAttribute(), named(), codePoint(), attributes(), rendered(), srcset() |
KsesAttributes final class
public/minn/src/Minn/Support/KsesAttributes.php · 76 lines · Open the class →
Kses one attribute at a time, for the shortcode pass that runs inside HTML tags: an opening tag cut into its attributes, and one attribute judged as kses judges it on its element. Probe shortcode-run.
| static | elementParts(string $element): ?array | An opening tag cut as wp_kses_attr_parse cuts it: the start ("<a "), each attribute with the whitespace after it (a shortcode standing as a name counts as one), and the end (">" or "/>"). Null for a closing tag, a comment, CDATA, or anything between the brackets that is not attributes. @return list<string>|null |
| static | parse(string $attributes): ?array | An attribute string cut into its attributes, each with the whitespace after it (wp_kses_hair_parse): a name (or a shortcode standing as one), then "=" and a quoted or bare value, or nothing. Null when anything in it is not an attribute: leading whitespace, a stray quote, a quoted value that never closes. @return list<string>|null |
| static | oneAttribute(string $attr, string $element, Minn\Support\KsesPolicy $policy): string | One attribute as written, judged as kses judges it on the element (wp_kses_one_attr): the value escaped for an attribute and kept in its own quotes (a bare one gains double quotes), a URL's bad scheme cut away, style kept to the allowed properties; nothing when the element may not carry it or a quoted value never closes. The whitespace around it stays. |
KsesCss final class
public/minn/src/Minn/Support/KsesCss.php · 138 lines · Open the class →
The style attribute as kses keeps it (safecss_filter_attr): each declaration whose property is on the list stays, a value's url() only on the properties that may hold one and only with a safe scheme, the gradients and CSS functions the reference allows, and nothing that could end the declaration. Plugins widen the list and the verdict through the hooks the facade wires in (safe_style_css, safecss_filter_attr_allow_css).
| static | style(string $style): string | A style attribute's value with only the listed properties kept. |
| static | styleHooks(Closure $properties, Closure $allow): void | The runtime's say over style attributes: the property list (safe_style_css) and each declaration (safecss_filter_attr_allow_css). The facade sets these as it loads. @param Closure(list<string>): list<string> $properties@param Closure(bool, string): bool $allow |
| inside | css(), cssTestString() |
KsesEntities final class
public/minn/src/Minn/Support/KsesEntities.php · 30 lines · Open the class →
The named references kses keeps as written: the list captured from the reference (data/kses.json) plus the five XML ones. Any other name is stored as "&name;".
| static | known(string $name): bool | Whether "&name;" is a reference kses leaves alone. |
| static | allowlist(string $context): array | An allowlist the reference ships, by context ("post" or "data"). @return array<string, array<string, mixed>> |
| inside | table() |
KsesPolicy final readonly class
public/minn/src/Minn/Support/KsesPolicy.php · 115 lines · Open the class →
What one kses pass allows: the tags, each tag's attributes (allowed plainly or with value rules), whether a tag takes data- attributes, which attributes hold URIs, and the schemes those URIs may use.
| prop | readonly array $schemes | |
| static | post(): self | Post content from an author without unfiltered_html: the reference's post allowlist as captured. |
| static | comment(): self | Comments, profiles and term descriptions: only the attributes each tag lists, nothing global. |
| static | fromAllowlist(array $allowedHtml, array $schemes, array $uriAttributes): self | A caller's own allowlist taken literally: a listed attribute is allowed whatever it maps to (false included, as the reference only asks whether the name is there), an array carries value rules, and "data-*" lets the tag take any data- name. Nothing else is implied. @param array<array-key, mixed> $allowedHtml@param list<string> $schemes@param list<string> $uriAttributes |
| method | allowsTag(string $tag): bool | Whether the tag may appear at all. |
| method | rules(string $tag, string $name): ?array | The rules an attribute carries on a tag: an empty list when it is allowed plainly, null when it is not allowed. @return array<array-key, mixed>|null |
| method | required(string $tag): array | The attributes a tag must keep: lose one and the tag keeps none. @return list<string> |
| method | holdsUri(string $name): bool | Whether the attribute holds a URI whose scheme must be judged. |
KsesProtocols final class
public/minn/src/Minn/Support/KsesProtocols.php · 67 lines · Open the class →
The protocols an address may use, as kses judges them: the site's list (kses_allowed_protocols), and an address with a protocol not on the list taken off it, encoded colons and entity-spelled protocols seen through.
| static | allowed(): array | The protocols addresses may use (wp_allowed_protocols): the table's list through kses_allowed_protocols, asked again on every call until wp_loaded has run, then kept. @return list<string> |
| static | strip(string $content, array|string $protocols): string | An address with a protocol the list does not allow taken off (wp_kses_bad_protocol): null bytes gone; an http or https address left as written when that protocol is allowed; otherwise the protocol checked again until nothing changes (up to six times), and empty if it never settles. @param array<array-key, mixed>|string $protocols |
| static | stripOnce(string $content, array|string $protocols): string | One pass of the protocol check (wp_kses_bad_protocol_once): encoded colons decoded; when what comes before the first colon (and holds no "/?") is an allowed protocol it is lower-cased and kept, otherwise taken off; either way what follows is trimmed. @param array<array-key, mixed>|string $protocols |
KsesValues final class
public/minn/src/Minn/Support/KsesValues.php · 38 lines · Open the class →
The value rules an allowlist attribute may carry, as the reference judges them: lengths count bytes, bounds need a whole number (up to six digits, up to six spaces either side), "valueless" compares the attribute's form, "values" compares without case, and a callback decides for itself. A rule the reference does not know passes. Where the reference fatals (a values rule that is not a list, a callback that does not exist) the value fails.
| static | satisfies(string $value, string $valueless, array $rules): bool | Whether a value meets every rule its attribute carries; "required" is the tag's concern, so it is skipped here. @param array<array-key, mixed> $rules |
| static | check(string $value, string $valueless, string $rule, mixed $expected): bool | One rule against one value; $valueless is "y" for a bare attribute and "n" for one with a value. |
| inside | wholeNumber() |
Lists final class
public/minn/src/Minn/Support/Lists.php · 201 lines · Open the class →
List shaping behind the facade's array utilities: arguments over their defaults (wp_parse_args), plucking and filtering (WP_List_Util), the multi-field sort wp_list_sort() promises (loose comparison per field, first difference wins) and the row-shape conversions wpdb hands back for its OBJECT_K / ARRAY_A / ARRAY_N output formats.
| static | filterParsed(?Closure $filter): void | Hands over the filter a parsed query string goes through (wp_parse_str), or takes it back with null. |
| static | args(mixed $args, mixed $defaults = array ( )): array | Arguments as WordPress takes them (wp_parse_args): an object's properties, an array, or a query string, over the defaults. @param array<array-key, mixed> $defaults@return array<array-key, mixed> |
| static | pluck(array $items, string|int $field, string|int|null $indexKey = NULL): array | One field of each item (wp_list_pluck), keyed as the list was, or by another field when one is named (items without it are appended); anything not an array or an object is passed over. @param array<array-key, mixed> $items@return array<array-key, mixed> |
| static | filter(array $items, array $fields, string $operator): array | The items matching all the fields given (AND), any of them (OR), or none (NOT), compared loosely, keys kept; nothing for another operator. @param array<array-key, mixed> $items @param array<array-key, mixed> $fields@return array<array-key, mixed> |
| static | items(mixed $input): array | A list as arguments give one (wp_parse_list): an array's entries trimmed, the empty ones dropped (keys kept); a string split on commas and whitespace. @return array<int|string, string> |
| static | ids(mixed $input): array | Ids as arguments give them (wp_parse_id_list): each a whole number made positive, each once, in first-seen order. @return list<int> |
| static | sort(array $items, array $orderby, bool $preserveKeys): array | Items sorted by several fields, each ascending or descending. @param array<int|string, mixed> $items@param array<string, string> $orderby field => ASC|DESC@return array<int|string, mixed> |
| static | shapeRows(array $rows, string $output): array | Rows of stdClass shaped for a wpdb output format: keyed by their first column (first row wins a duplicate key), associative, or numeric. @param list<object> $rows@return array<int|string, mixed> |
| static | descendants(array $items, int $rootId, callable $id, callable $parent, array $visited = array ( )): array | Every descendant of one root in a flat parent-linked list, preorder (a child ahead of its own children), the shape _get_term_children and get_page_children walk. Visited ids guard against a parent cycle. @param list<mixed> $items@param callable(mixed): int $id@param callable(mixed): int $parent@param list<int> $visited@return list<mixed> |
| inside | keyedByFirstColumn() |
Locale final class
public/minn/src/Minn/Support/Locale.php · 31 lines · Open the class →
The locale's calendar and number vocabulary as data: the names a site prints for weekdays, months and meridiems, and how it separates thousands and decimals.
The names are English here because the engine carries no core translations yet; the facade runs each one through the translation filters on the way out, so a catalogue can answer for them later without this class changing.
| const | WEEKDAYS = array ( 0 => 'Sunday', 1 => 'Monday', 2 => 'Tuesday', 3 => 'Wednesday', 4 => 'Thursday', 5 => 'Friday', 6 => 'Saturday', ) | |
| const | MONTHS = array ( 0 => 'January', 1 => 'February', 2 => 'March', 3 => 'April', 4 => 'May', 5 => 'June', 6 => 'July', 7 => 'August', 8 => 'September', 9 => 'October', 10 => 'November', 11 => 'December', ) | |
| const | MERIDIEM = array ( 'am' => 'am', 'pm' => 'pm', 'AM' => 'AM', 'PM' => 'PM', ) | |
| const | NUMBER_FORMAT = array ( 'thousands_sep' => ',', 'decimal_point' => '.', ) | |
| const | LIST_ITEM_SEPARATOR = ', ' | |
| const | WORD_COUNT_TYPE = 'words' | |
| const | TEXT_DIRECTION = 'ltr' | |
| static | weekdayInitial(string $day): string | A weekday's one-letter form. |
| static | abbreviation(string $name): string | A weekday's or month's three-letter form; May is already three letters. |
| static | monthKey(string|int $month): string | Months are keyed by their zero-padded number, both ways round. |
Markers final class
public/minn/src/Minn/Support/Markers.php · 59 lines · Open the class →
The BEGIN/END marker blocks insert_with_markers() maintains in files like .htaccess: the captured shape keeps everything outside the markers, replaces the block inside them, and writes the reference's four-line do-not-edit preamble ahead of the inserted lines.
| static | write(string $file, string $marker, array $lines): bool | Replaces the lines between a marker's begin and end comments in a file. @param list<string> $lines |
| static | read(string $file, string $marker): array | The lines between a marker's begin and end comments, every block of it in order. A line opens or closes a block when it contains the comment anywhere (case-sensitive); lines that start with "#" are left out, so the preamble and any nested markers are, while indented comments stay. Lines split on "\n" only, and a block left open at the end of the file keeps the empty line after its final newline. @return list<string> |
Paths final class
public/minn/src/Minn/Support/Paths.php · 95 lines · Open the class →
File-system path and permission spellings, and whether a path is safe to use.
| static | validate(mixed $file, mixed $allowed = array ( )): int | Whether a path is safe to use (validate_file): 0 when it is; 1 when it climbs out (a bare "../", more than one, or one not at the end); 2 for a drive letter; 3 when a list is given and the path is not on it. |
| static | translationDir(string $domain, string $locale, string $langDir, ?string $customPath, ?Closure $listed = NULL): string|false | The trailing-slashed directory holding a text domain's {domain}-{locale}.mo: a custom path first, then the language dir's plugins and themes folders, then the dir itself for the default domain; false when none has the file. $listed, when given, lists a folder's files (the textdomain registry's own lister, which plugins may answer for) and is read instead of the disk. @param (\Closure(string): array<int, string>)|null $listed |
| static | normalize(string $path): string | Forward slashes only, runs collapsed, a stream wrapper kept, a Windows drive letter upper-cased. |
| static | symbolicMode(int $mode): string | The `ls -l` spelling of a mode: type letter, then rwx for owner, group and world with the setuid, setgid and sticky bits folded in. |
Sanitize final class
public/minn/src/Minn/Support/Sanitize.php · 92 lines · Open the class →
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.
| static | title(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. |
| static | key(mixed $key): string | A key (sanitize_key): lower case letters, digits, underscores and dashes only. |
| static | textField(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. |
| static | user(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 _ . - @. |
| static | htmlClass(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. |
| static | hexColor(mixed $color): mixed | A hex colour as given when it is one (#abc or #aabbcc), empty for none, else null (sanitize_hex_color). |
| static | textareaField(mixed $text): mixed | Lines of plain text (sanitize_textarea_field): as a text field, line breaks kept; then the filter. |
| static | email(mixed $email): string | An email address with what may not be in one taken out (sanitize_email), and why when nothing is left. |
| static | isEmail(mixed $email): mixed | The address when it reads as one, else false (is_email), as the filter leaves it. |
ScriptTag final class
public/minn/src/Minn/Support/ScriptTag.php · 69 lines · Open the class →
Script elements as the reference builds them (probe script-tags): the attributes sorted by name, a src or href through esc_url and every other value escaped (true or null printed bare, false left out); inline code between newlines, with any "<script" or "</script" that would end or open an element written with its "s" as a \u escape. Only JavaScript and JSON can carry that escape: a script of another type whose code holds such a sequence is not printed at all.
| static | element(array $attributes): string | The empty element for a script file. @param array<string, mixed> $attributes |
| static | inline(string $code, array $attributes): string | The element for inline code (already between its newlines), or '' when its type cannot hold the code safely. @param array<string, mixed> $attributes |
| inside | attributes() |
SearchReplace final class
public/minn/src/Minn/Support/SearchReplace.php · 38 lines · Open the class →
String replace that walks serialized-PHP arrays of scalars without unserialize, so a domain change in an option blob keeps its lengths.
| static | in(string $value, string $old, string $new): array | A value with one string replaced, and how many times. @return array{0: string, 1: int} replacement and how many times $old occurred |
| inside | walk() |
Serialized final class
public/minn/src/Minn/Support/Serialized.php · 403 lines · Open the class →
Tolerant readers for the serialized-PHP blobs WordPress stores. Nothing here executes the blob; each reader scans for the one shape it needs.
| const | INVALID = '' . "\0" . 'minn:invalid' . "\0" . '' | Returned by decode() when the blob is not a serialized value the reader accepts. |
| static | stringList(?string $blob): array | The string values of a serialized string list. |
| static | serializeStringList(array $values): string | A flat string list in the stored form. |
| static | field(?string $blob, string $field): ?string | The first "field";value pair inside a blob: string, int, or float value as a string. |
| static | decode(string $blob, ?Closure $revive = NULL): mixed | A serialized scalar or array as PHP data, parsed by this reader: strings, integers, floats, booleans, null, and arrays of those. An object record becomes a stdClass of its properties, or whatever the reviver makes of the class name and those properties; nothing here instantiates anything itself. A blob with trailing bytes or a malformed shape is INVALID. @param ?\Closure(string, \stdClass, list<array{0: int|string, 1: mixed}>): object $revive handed the class, the properties, and the stored names with their values |
| static | storedClass(object $object): ?string | The class an object was stored as, when it came back as a stdClass of its properties. |
| static | looksSerialized(string $data): bool | Whether a string has the shape of serialized data, as is_serialized() judges it by default: its last byte closes the record (what maybe_unserialize() decodes). Measured over sixty strings (probe sweep-1020b). |
| static | mayBeSerialized(string $data): bool | Whether a string may be serialized data, as is_serialized($data, false) judges it: a close anywhere will do. What maybe_serialize() stores serialized again so it reads back as the string it was. |
| static | maybeEncode(mixed $data): mixed | A value as maybe_serialize() stores it: an array or object serialized, and a string that already looks serialized serialized again, so it reads back as the string it was; anything else as given. |
| static | encode(mixed $value): string | PHP's serialize() for the values decode() accepts: null, bool, int, float, string, arrays of those, and objects written as their class. |
| static | intList(?string $blob): array | The integer values of a serialized list such as sticky_posts. |
| inside | read(), readValue(), readObject(), encodeRecord(), encodeWrapper(), expect(), size(), opens(), opensRecord(), until(), encodeValue(), encodeObject() |
Signatures final class
public/minn/src/Minn/Support/Signatures.php · 34 lines · Open the class →
A file checked against detached Ed25519 signatures of its SHA-384 hash, as verify_file_signature checks it: a signature that does not decode to the signature length is skipped, and for each one that does, every key that does not decode to the key length is skipped too; the counts and the hash are what the caller reports when nothing verifies.
| static | check(string $file, array $signatures, array $keys): array | Whether any signature verifies with any key, the file's hash in hex, and how many keys and signatures were skipped. @param list<mixed> $signatures@param list<mixed> $keys base64 public keys@return array{verified: bool, hash: string, skipped_key: int, skipped_sig: int} |
Slashes final class
public/minn/src/Minn/Support/Slashes.php · 32 lines · Open the class →
Magic-quote slashes the way WordPress keeps them (wp_slash, wp_unslash): added to or stripped from every string inside a value, arrays and objects walked all the way down, anything else left as it is.
| static | add(mixed $value): mixed | Every string in a value with its quotes and backslashes slashed. |
| static | strip(mixed $value): mixed | Every string in a value with one level of slashes taken off. |
| inside | deep() |
Sprintf final class
public/minn/src/Minn/Support/Sprintf.php · 46 lines · Open the class →
A pattern filled one fragment at a time, as wp_sprintf fills it: "%%" is a percent sign, each other fragment (a directive and the text up to the next one) takes the next argument or the one its position names, and $filter may write a fragment itself (the wp_sprintf filter: the list directive %l lives there); otherwise PHP's sprintf fills it, an array as nothing, and a fragment it cannot fill stays as written.
| static | format(string $pattern, array $args, Closure $filter): string | The pattern with its arguments filled in. @param list<mixed> $args@param Closure(string, mixed): mixed $filter the fragment and its argument in, the fragment as written out |
SqlTable final class
public/minn/src/Minn/Support/SqlTable.php · 63 lines · Open the class →
The table a SQL statement is about, as wpdb::get_table_from_query reports it, and a database host string read into its parts (probe wpdb). A name is letters, digits, $ _ . - and backticks (dropped), plus two-byte UTF-8.
| static | of(string $query): ?string | The table a statement names (backticks dropped), or null when it names none the reference recognises. |
| static | host(string $host): ?array | A DB_HOST read as host, port, socket and whether the host is IPv6: a socket after ":/", an IPv6 address in brackets (more than one colon), a port only when it is digits. Null when nothing parses. @return array{0: string, 1: ?int, 2: ?string, 3: bool}|null |
Text final class
public/minn/src/Minn/Support/Text.php · 69 lines · Open the class →
Plain text shaped the way WordPress's formatting helpers shape it: cut to a number of words or characters, named references written as numeric ones, stray ampersands encoded, whitespace normalized, a path's last part, and a callback run over every value of a nested structure.
| static | trimWords(mixed $text, mixed $count = 55, mixed $more = NULL): string | The text's first words, tags gone, with $more after them when some were cut (wp_trim_words), as the filter leaves it. |
| static | htmlExcerpt(mixed $text, mixed $count, mixed $more = NULL): string | The text's first characters, tags and line breaks gone, with $more after them when some were cut (wp_html_excerpt). |
| static | numericReferences(mixed $text): mixed | Named character references written as numeric ones (ent2ncr), unless pre_ent2ncr answers first. |
| static | encodeAmpersands(mixed $content): string | Ampersands that begin no reference written as & (convert_chars). |
| static | normalizeWhitespace(mixed $text): string | Line breaks as single newlines and runs of spaces and tabs as one space, ends trimmed (normalize_whitespace). |
| static | basename(mixed $path, string $suffix = ''): string | A path's last part, multibyte names intact, without the suffix given (wp_basename). |
| static | mapDeep(mixed $value, callable $callback): mixed | A value with the callback run over every scalar inside it, arrays and objects followed (map_deep). |
Time final class
public/minn/src/Minn/Support/Time.php · 21 lines · Open the class →
Human-scale spans: a number of seconds as the largest whole unit it fills, rounded, never below one.
| static | span(int $seconds): array | A number of seconds as its largest whole unit and count. @return array{0: int, 1: string} count and unit name |
TimezoneChoice final class
public/minn/src/Minn/Support/TimezoneChoice.php · 109 lines · Open the class →
The timezone choices a settings form offers (wp_timezone_choice, probe placeholder-helpers): the zones of each continent, cities in natural order (a zone with three parts reads "City - Sub-city"), then UTC, then the offsets set by hand. "Select a city" leads when nothing is chosen, and a real zone outside the list (an old name, Etc/) leads when it is the one chosen. Each choice is a line of its own.
| static | html(string $selected, Closure $translate): string | The choices as option lines, the chosen zone marked. @param \Closure(string, string): string $translate a text in a text domain, translated |
| inside | zones(), groups(), outsideList(), offset(), offsets(), option() |
Url final class
public/minn/src/Minn/Support/Url.php · 271 lines · Open the class →
URL shaping the escaping and query helpers share: the character cleanup esc_url applies, bracket encoding outside the authority, and query argument merging. Behaviour pinned by contracts/fixtures/api/functions.json.
| static | withTrailingSlash(string $value): string | The value with one trailing slash, whatever slashes or backslashes it ended in (trailingslashit). |
| static | withoutTrailingSlash(string $value): string | The value with every trailing slash and backslash taken off (untrailingslashit). |
| static | clean(string $url, string $scheme = 'http'): string | Spaces encoded, stray characters dropped, ";//" healed, a bare host given http; '' when nothing survives. |
| static | encodeBrackets(string $url, array $parsed): string | Square brackets after the authority are percent-encoded; the authority itself is left alone. @param array<string, mixed> $parsed @param array<string, mixed> $parsed |
| static | withQuery(string $uri, array $new, Closure $encode, Closure $build): string | The URI with query arguments merged in (false removes one), the fragment kept, a bare query string treated as such; a URI that is only a query (or nothing) keeps its leading question mark. @param array<string, mixed> $new@param Closure(array): array $encode encodes the existing arguments the way the reference does@param Closure(array): string $build builds the query string |
| static | validateForHttp(string $url, string $homeHost, int $homePort, Closure $externalAllowed, ?Closure $safePorts = NULL): ?string | The checks wp_http_validate_url makes on a URL whose protocol already passed: an http(s) scheme, a host without credentials or a colon, no private address unless it is this site or allowed, only the safe ports (80, 443 and 8080 unless the caller's list says otherwise; the site's own always). Returns the URL, or null when refused. @param Closure(string, string): bool $externalAllowed whether a private host may be fetched anyway@param (Closure(list<int>, string, string): array)|null $safePorts the port list for a URL that names a port |
| static | buildQuery(array $data, string $prefix = ''): string | A query string in the reference's spelling (probe query-args): keys and values as given, nested keys as `a%5Bb%5D`, null left out, booleans as 0/1. |
| static | parse(string $url, int $component = -1): array|string|int|false|null | parse_url that also accepts scheme-relative and path-only URLs; a single component by its PHP_URL_* constant. |
| static | withScheme(string $url, string $scheme): string | The URL under a scheme, or scheme-and-host stripped for 'relative'; a protocol-relative URL is read as http first. |
| static | safeRedirect(string $location, Closure $allowedHosts, string $requestPath = ''): ?string | A redirect target the site may send a browser to: http(s) only and a host the caller allows. A relative one stays on the site: a path without a leading slash is put after the request path's folder (up to its last "/", the dots kept), anything else as given. Credentials before the host are kept unless they hold an "@" (probe functions-formatting-doubts). @param Closure(string): list<string> $allowedHosts the hosts allowed for the target's host |
| static | absolute(string $relative, string $base): string | A reference made absolute against a base URL, as WP_Http resolves a redirect's Location: one with a scheme stays as it is, "//host" takes the base's scheme, a path without a leading slash joins the base's folder with its "../" steps folded, and no path keeps the base's. |
| inside | isPrivate() |
Utf8 final class
public/minn/src/Minn/Support/Utf8.php · 182 lines · Open the class →
UTF-8 as the reference reads it. Well-formed means no overlong forms, surrogates, code points past U+10FFFF, stray continuation bytes or truncated sequences; noncharacters, NUL and a byte order mark pass. Split into characters (the multibyte fallbacks in compat.php), a malformed byte is one character and so is the longest start of a sequence that breaks off, so "\xE2\x82" counts once.
| static | isValid(string $bytes): bool | True for well-formed UTF-8, including the empty string. |
| static | characters(string $bytes): array | The bytes cut into characters, a malformed byte or a broken-off sequence counting as one. @return list<string> |
| static | scan(string $bytes, int $at, ?int $maxBytes = NULL, ?int $maxCodePoints = NULL): array | Reads well-formed characters from $at, as the reference's scanner does (probe utf8). It stops $maxBytes past $at (a character begun before that is read whole), after $maxCodePoints, or at a malformed byte. The answer: the characters read, where it stopped, the length of the malformed run there (a broken-off start of a sequence, else one byte, cut at the byte limit; 0 when there is none), and whether a character that could be a noncharacter was one (null when none could be: only EF and four-byte sequences hold them). @return array{int, int, int, ?bool} |
| static | isNoncharacter(int $code): bool | Whether a code point is a noncharacter: U+FDD0 to U+FDEF, or the last two of any plane. |
| static | hasNoncharacters(string $bytes): bool | Whether any well-formed character is a noncharacter, malformed bytes stepped over. |
| static | scrub(string $bytes): string | The bytes with each malformed run (as characters() cuts them) replaced by U+FFFD. |
| static | span(string $bytes, int $offset, int $maxCodePoints): array | How many bytes from $offset the first $maxCodePoints characters take, and how many there were. @return array{int, int} |
| static | toLatin1(string $bytes): string | UTF-8 as ISO-8859-1: a character past U+00FF, or a malformed run, becomes "?". |
| static | keptBy(string $bytes, string $charset): string | What a column in this charset keeps: utf8mb4 drops each malformed run, utf8 (utf8mb3) every four-byte character too; any other charset keeps the bytes. |
| static | fits(string $bytes, string|false $charset): bool | Whether text can go to a table in this charset as the reference's database door judges it (probe invalid-text): anything for a binary or latin1 table or one without text; otherwise well-formed UTF-8, and of that only what the charset holds (no four-byte character for utf8, no byte past ASCII for ascii). |
| static | fromLatin1(string $bytes): string | ISO-8859-1 as UTF-8: each byte the character of its value. |
| static | fromCodePoint(int $code): ?string | The UTF-8 bytes for a code point, or null for a negative one, a surrogate, or one past U+10FFFF. |
| static | firstCodePoint(string $bytes): ?int | The code point of the first character, or null when the bytes do not start with a whole, well-formed one. |
Nothing matches.