API / Minn\Runtime / PostFields

PostFields final class

Minn\Runtime\PostFields · public/minn/src/Minn/Runtime/PostFields.php · 89 lines

A post's fields put in a context as WordPress's sanitize_post_field puts them: raw as stored; for the database through the pre_ filters; for editing through the edit_ filters and made safe for a form; for display through the field's own filter, escaped for an attribute or a script when asked. The integer columns stay integers in every context.

Public

staticvalue(mixed $field, mixed $value, mixed $postId, mixed $context = 'display'): mixed#

One field in a context (sanitize_post_field).

staticsanitize(mixed $post, mixed $context = 'display'): mixed#

Every field of a post object or array in a context (sanitize_post), unless it is in that context already.

staticformatToEdit(mixed $content, mixed $richText = false): mixed#

Text made ready for an edit field (format_to_edit): through format_to_edit, encoded for a textarea unless rich.

staticrichEdit(): bool#

Whether the user edits in the rich editor (user_can_richedit): their preference, and a browser that can.

Internals 1

Private and protected methods: how the class does its work. Not a contract; they change whenever the code is tidied.

privatecontextual(string $field, mixed $value, mixed $postId, string $context): mixed#