PatternText final class
Minn\Theme\PatternText · public/minn/src/Minn/Theme/PatternText.php · 234 lines
Block-theme patterns are PHP files whose only code is a handful of echo-and-escape calls around literal strings. The engine never executes them: it interprets that small text grammar (string literals, "." concatenation, the i18n and escaping wrappers, the theme URI helper, and printf with %s) and leaves anything else out. A translated string is looked up in its domain (the theme's own), with its context where it gives one, as the reference's patterns ask for theirs. The header comment block is dropped, and every byte outside the PHP tags is kept as-is.
Constants and properties
| private | PASSTHROUGH = array ( 0 => 'wp_kses_post', ) | Wrappers whose value is their first argument, unchanged. |
| private | URLS = array ( 0 => 'esc_url', 1 => 'esc_url_raw', ) | Wrappers whose value is their first argument as a URL: empty when what stands before a colon is no allowed scheme. |
| private | ESCAPING = array ( 0 => 'esc_html', 1 => 'esc_attr', ) | Wrappers whose value is their first argument with HTML special characters encoded. |
| private | TRANSLATING = array ( '__' => 'text', '_x' => 'context', 'esc_html__' => 'text escaped', 'esc_attr__' => 'text escaped', 'esc_html_x' => 'context escaped', 'esc_attr_x' => 'context escaped', ) | The translating wrappers, by how they read: "text" (text, domain) or "context" (text, context, domain), escaped or not; those that echo are statements, the rest values. |
| private | ECHOING = array ( '_e' => 'text', '_ex' => 'context', 'esc_html_e' => 'text escaped', 'esc_attr_e' => 'text escaped', ) | |
| private | string $themeUri | |
| private | string $source | |
| private | int $position |
Public
Internals 10
Private and protected methods: how the class does its work. Not a contract; they change whenever the code is tidied.
| private | statements(): string# | ||||
| private | printf(array $arguments): string# | ||||
| private | expression(): ?string# | A concatenation of terms. | |||
| private | term(): ?string# | ||||
| private | translated(string $layout, array $arguments): string# | A message in the site's language, read as its wrapper reads it (TRANSLATING): (text, domain) or (text, context, domain), escaped for the escaping wrappers.
| |||
| private | escape(string $text): string# | Special characters encoded once; entities already present are kept. | |||
| private | arguments(): array# | @return list<string|null> | |||
| private | stringLiteral(string $quote): string# | ||||
| private | identifier(): ?string# | ||||
| private | skipSpace(): void# | Whitespace and comments, anywhere a token may follow. |
Nothing matches.