API / Minn\Support / Text

Text final class

Minn\Support\Text · public/minn/src/Minn/Support/Text.php · 69 lines

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.

Public

statictrimWords(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.

statichtmlExcerpt(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).

staticnumericReferences(mixed $text): mixed#

Named character references written as numeric ones (ent2ncr), unless pre_ent2ncr answers first.

staticencodeAmpersands(mixed $content): string#

Ampersands that begin no reference written as & (convert_chars).

staticnormalizeWhitespace(mixed $text): string#

Line breaks as single newlines and runs of spaces and tabs as one space, ends trimmed (normalize_whitespace).

staticbasename(mixed $path, string $suffix = ''): string#

A path's last part, multibyte names intact, without the suffix given (wp_basename).

staticmapDeep(mixed $value, callable $callback): mixed#

A value with the callback run over every scalar inside it, arrays and objects followed (map_deep).