API / Minn\Runtime / Handoff

Handoff final class

Minn\Runtime\Handoff · public/minn/src/Minn/Runtime/Handoff.php · 484 lines

What the engine asks of the layer it runs under, where a plugin may have the last word. WordPress lets a plugin define its own version of the replaceable functions (the current user, users by id or field, hashes, nonces, passwords, mail, avatars, redirects, signing in) before the defaults load; its user records are that layer's objects, and it ends a request with a message its own way (handlers plugins choose); the WordPress layer binds each answer here (the replaceable ones once the plugins have had their chance), so a plugin's version answers the engine as it answers WordPress. Arguments pass as given, so each answer's own defaults hold.

Used by 113 (show)
Auth\AuthCookiesAuth\CanAuth\SignInBlocks\BindingsBlocks\Dynamic\Theme\CommentsBlocks\Dynamic\Theme\NavigationBlocks\Dynamic\Theme\QueryBlocksContent\PasswordGateEngineFront\CommentPostControllerFront\FeedTagsFront\PostEmbedFront\SitemapRequestFront\ToolbarMenusLogin\LoginControllerLogin\LoginHooksLogin\LoginNoticesMail\MailerOps\DirectoryApiOps\UpgraderRunRest\BatchControllerRest\BlockRendererControllerRest\BlockTypesControllerRest\CommentsControllerRest\InstalledThemesControllerRest\MediaControllerRest\MenuItemObjectRest\PolicyGateRest\PostsControllerRest\PostsWriteControllerRest\RenderedFieldsRest\ResponsesRest\RestMetaRest\RuntimePrepareRest\RuntimeRoutesRest\SidebarsControllerRest\SiteSchemaRest\TemplatesControllerRest\UserObjectRest\UsersControllerRest\WidgetObjectRest\WidgetsControllerAbilitiesAbilityRunAccountFlowsAjaxControllerApplicationPasswordRecordsApplicationPasswordSignInBlockFiltersBlockHooksBlockQueriesCommentChecksCommentEventsCommentFormCommentPagesCommentQueryRunnerCommentQueryWhereCommentReadsCommentThreadsCommentWritesCronEventsCurrentUserEditLinksHeartbeatMainQueryMenuEventsMetaMetaDataMetaKeysNavMenuOptionWritesPagesPluginRemovalPluginsPostCachesPostDataPostEventsPostLinksPostQueryPostQueryResultsPostQueryStatusPostQueryWherePostReadsPostRevisionsPostTagsPostWritesQueryArgsRecordsRegistryRewriteRulesRuntimeTemplateFilesTermEventsTermLookupTermQueryRunnerTermSaveTermTagsTermWritesThemeSupportsThemesTranslationsUpgradeUserEventsUserOrderUserQueryRunnerUserSaveUserWritesWidgetAreasTheme\ClassicRendererTheme\EmbedRendererTheme\FrontLifecycleTheme\PageRendererTheme\ThemeJsonData

Constants and properties

privatestatic array $answers

Public

staticbind(array $answers): void#

Binds answers by name: currentUser, signedIn, user, userBy, becomeUser, cacheUsers, authenticate, setPassword, password, hashPassword, hash, createNonce, verifyNonce, mail, avatar, redirect, safeRedirect, stop, escSql, cacheGet, cacheSet, cacheDelete, and the record factories newError, newPost, postInstance, newTerm, newComment, commentInstance, newUser, and the query factories newQuery, newCommentQuery, newUserQuery, newTermQuery, newMetaQuery, newDateQuery, and the REST ones newRestRequest, restRequestFromUrl, newRestResponse, restController, newTheme, and the empty registered-type objects blankPostType and blankTaxonomy, a user's sessionTokens, the locale's newLocale and newTextdomainRegistry, newUpgrader and newUpgraderSkin, the blocks' newBlock, newBlockList, newBlockTemplate, newTagProcessor and newThemeJsonData, newSitemapStylesheet, and the registries blockTypes, blockPatterns, blockStyles, blockBindings, abilities and abilityCategories.

$answersarray<string, Closure>
staticcurrentUser(): mixed#

The user the request is (wp_get_current_user).

staticsignedIn(): bool#

Whether someone is signed in (is_user_logged_in).

staticuser(mixed $id): mixed#

A user by id, or false (get_userdata).

staticuserBy(mixed $field, mixed $value): mixed#

A user by a field (id, ID, slug, email or login), or false (get_user_by).

staticbecomeUser(mixed ...$args): mixed#

Makes a user the request's (wp_set_current_user): the user's record.

staticcacheUsers(mixed $ids): void#

Reads users and their meta into the cache together (cache_users).

staticauthenticate(mixed $username, mixed $password): mixed#

Signs in by name and password (wp_authenticate): the user, or an error.

staticsetPassword(mixed $password, mixed $userId): mixed#

Sets a user's password (wp_set_password).

staticpassword(mixed ...$args): mixed#

A random password (wp_generate_password).

statichashPassword(mixed $password): mixed#

A password hashed for storing (wp_hash_password).

statichash(mixed ...$args): mixed#

A hash of the data keyed with the site's salt (wp_hash).

staticcreateNonce(mixed ...$args): mixed#

A nonce for an action (wp_create_nonce).

staticverifyNonce(mixed ...$args): mixed#

Whether a nonce holds for an action: 1 or 2 by its age, or false (wp_verify_nonce).

staticmail(mixed ...$args): mixed#

Sends an email (wp_mail): whether it was accepted for delivery.

staticavatar(mixed ...$args): mixed#

A user's or address's avatar image, or false (get_avatar).

staticredirect(mixed ...$args): mixed#

Sends the browser elsewhere (wp_redirect): whether it was sent.

staticsafeRedirect(mixed ...$args): mixed#

Sends the browser elsewhere on the site's own hosts, else to the admin (wp_safe_redirect).

staticstop(mixed ...$args): void#

Ends the request with a message (wp_die), as the handler plugins choose draws it.

staticcacheGet(mixed $key, mixed $group = '', mixed $force = false, mixed $found = NULL): mixed#

A value from the object cache (wp_cache_get), $found told whether it was there.

staticcacheSet(mixed ...$args): mixed#

A value stored in the object cache (wp_cache_set).

staticcacheDelete(mixed ...$args): mixed#

A value removed from the object cache (wp_cache_delete).

staticescSql(mixed $data): mixed#

A value, or each in a list, escaped for SQL by the database object plugins query with (esc_sql).

staticnewError(mixed ...$args): Minn\Objects\Errors#

A list of errors, the first given (new WP_Error).

staticnewPost(mixed $post): Minn\Objects\Post#

A post object made from a row or another post (new WP_Post).

staticpostInstance(mixed $id): mixed#

The post object for an id, or false (WP_Post::get_instance).

staticnewTerm(mixed $term): Minn\Objects\Term#

A term object made from a row (new WP_Term).

staticnewComment(mixed $comment): Minn\Objects\Comment#

A comment object made from a row (new WP_Comment).

staticcommentInstance(mixed $id): mixed#

The comment object for an id, or false (WP_Comment::get_instance).

staticnewUser(mixed ...$args): Minn\Objects\User#

A user object by id (or login, with no id), nobody for 0 (new WP_User).

staticnewQuery(mixed ...$args): Minn\Objects\Query#

A posts query, run at once when given its variables (new WP_Query).

staticnewCommentQuery(mixed ...$args): Minn\Objects\CommentsQuery#

A comments query, run at once when given its variables (new WP_Comment_Query).

staticnewUserQuery(mixed ...$args): Minn\Objects\UsersQuery#

A users query, run at once when given its variables (new WP_User_Query).

staticnewTermQuery(mixed ...$args): Minn\Objects\TermsQuery#

A terms query, run at once when given its variables (new WP_Term_Query).

staticnewMetaQuery(mixed ...$args): object#

A meta query from its clauses (new WP_Meta_Query).

staticnewDateQuery(mixed ...$args): object#

A date query from its clauses and column (new WP_Date_Query).

staticnewRestRequest(mixed ...$args): Minn\Objects\RestRequest#

A REST request for a method and route (new WP_REST_Request).

staticrestRequestFromUrl(mixed $url): mixed#

A REST request for an address on this site's API, or false (WP_REST_Request::from_url).

staticnewRestResponse(mixed ...$args): Minn\Objects\RestResponse#

A REST response with data, a status and headers (new WP_REST_Response).

staticrestController(string $kind, mixed ...$args): object#

One of the REST controllers a filter is handed, by kind: menus, menu-items or menu-locations.

staticblankPostType(): Minn\Objects\PostType#

A post type's object with nothing set yet, for the registry to fill (WP_Post_Type, built without its constructor).

staticblankTaxonomy(): Minn\Objects\Taxonomy#

A taxonomy's object with nothing set yet, for the registry to fill (WP_Taxonomy, built without its constructor).

staticsessionTokens(mixed $userId): Minn\Objects\SessionTokens#

A user's sessions (WP_Session_Tokens::get_instance), through the manager session_token_manager names.

staticnewLocale(): Minn\Objects\SiteLocale#

The site's locale: its names, number format and direction (new WP_Locale).

staticnewTextdomainRegistry(): object#

Where each text domain's translations are found (new WP_Textdomain_Registry).

staticnewUpgrader(mixed $kind, mixed $skin): Minn\Objects\Upgrader#

An upgrader for plugins, or for themes when the kind is "theme", reporting through the skin.

staticnewUpgraderSkin(mixed ...$args): Minn\Objects\UpgraderSkin#

The skin an upgrader reports through when no screen shows it (new WP_Ajax_Upgrader_Skin).

staticnewBlock(mixed ...$args): Minn\Objects\RenderedBlock#

A block to render, with its context (new WP_Block).

staticnewBlockList(mixed ...$args): object#

Blocks to render as one list (new WP_Block_List).

staticnewBlockTemplate(mixed ...$args): object#

An empty block template record (new WP_Block_Template).

staticnewTagProcessor(mixed ...$args): object#

A cursor over HTML's tags and attributes (new WP_HTML_Tag_Processor).

staticnewThemeJsonData(mixed ...$args): Minn\Objects\ThemeJsonLayer#

One origin's theme.json data for its filter (new WP_Theme_JSON_Data).

staticnewSitemapStylesheet(mixed ...$args): object#

The stylesheet a sitemap is shown with (new WP_Sitemaps_Stylesheet).

staticblockTypes(mixed ...$args): object#

The registered block types (WP_Block_Type_Registry::get_instance).

staticblockPatterns(mixed ...$args): object#

The registered block patterns (WP_Block_Patterns_Registry::get_instance).

staticblockStyles(mixed ...$args): object#

The registered block styles (WP_Block_Styles_Registry::get_instance).

staticblockBindings(mixed ...$args): object#

The registered block binding sources (WP_Block_Bindings_Registry::get_instance).

staticabilities(mixed ...$args): object#

The registered abilities (WP_Abilities_Registry::get_instance).

staticabilityCategories(mixed ...$args): object#

The registered ability categories (WP_Ability_Categories_Registry::get_instance).

staticbound(string $name): bool#

Whether the layer has bound an answer by that name yet (it binds them as it loads).

staticroles(): object#

The site's roles object (wp_roles), made the first time it is asked for.

staticresetKses(): void#

The content filters set again for the current user (kses_remove_filters, then kses_init_filters), by the names plugins remove them by.

staticloadTemplate(mixed ...$args): void#

A theme template file run where templates run (load_template): in the layer's globals, the query's variables in scope.

statictranslationController(): object#

The object that loads translation files and looks translations up (WP_Translation_Controller::get_instance).

staticrewrite(): object#

The rewrite object ($wp_rewrite), with the request's environment ($wp), made the first time they are asked for.

staticwidgetFactory(): object#

The widget factory ($wp_widget_factory) the registered widgets live in.

staticsitemaps(): object#

The sitemap server, started the first time it is asked for (wp_sitemaps_get_server).

staticnewMenuWalker(): object#

The walker a menu is printed with when its arguments name none (new Walker_Nav_Menu).

staticattachmentMetadata(mixed $attachmentId, mixed $file): mixed#

An attachment's metadata made from its file by the layer's image editors (wp_generate_attachment_metadata): sizes, previews, the file's size.

staticregisterInitMeta(): void#

The meta core and Minn Admin register on init, registered by the layer that holds their callbacks by name.

staticqueryTemplate(mixed ...$args): mixed#

The theme file for a template type, through the hierarchy and its filters (get_query_template); a block theme's canvas when it has a block template.

staticblockTemplates(mixed ...$args): mixed#

The block templates a query finds, the theme's and the ones plugins registered (get_block_templates).

staticblockHooks(mixed ...$args): mixed#

Content with its hooked blocks inserted by the callback named (apply_block_hooks_to_content).

staticblockHooksForPost(mixed $content, mixed $post, mixed $callback, mixed $ignoredAtRoot): mixed#

A post's content with its hooked blocks inserted (apply_block_hooks_to_content_from_post_object), a navigation's root ignored list filled in.

staticnewTheme(mixed ...$args): Minn\Objects\Theme#

A theme by its folder and root (new WP_Theme).

Internals 1

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

privateanswer(string $name, mixed ...$args): mixed#