API / Minn\Runtime / Plugins

Plugins final class

Minn\Runtime\Plugins · public/minn/src/Minn/Runtime/Plugins.php · 272 lines

Loads the site's plugins into the runtime the way the reference does: mu-plugins first, then active_plugins in stored order, each file included once. A plugin loads only when the static symbol read finds nothing the runtime lacks; otherwise it is reported and skipped so the site keeps rendering. The lifecycle actions fire between the phases.

Constants and properties

privateMINN_ADMIN = 'minn-admin/minn-admin.php'

Minn Admin loads as code for its adapters (surfaces, licenses, connectors, custom CSS, the plugin routes the engine has no controller for), but the engine owns the shell, the front bar, the sign-in flow, and maintenance: those hooks come off right after the include so the two never print twice or disagree.

privateMINN_ADMIN_HOOKS = array ( 0 => array ( 0 => 'template_redirect', 1 => array ( 0 => 'Minn_Admin', 1 => 'maybe_render_app', ), 2 => 0, ), 1 => array ( 0 => 'template_redirect', 1 => array ( 0 => 'Minn_Admin', 1 => 'maybe_maintenance_mode', ), 2 => 1, ), 2 => array ( 0 => 'rest_authentication_errors', 1 => array ( 0 => 'Minn_Admin', 1 => 'maintenance_rest', ), 2 => 20, ), 3 => array ( 0 => 'login_redirect', 1 => array ( 0 => 'Minn_Admin', 1 => 'login_redirect', ), 2 => 20, ), 4 => array ( 0 => 'show_admin_bar', 1 => array ( 0 => 'Minn_Admin', 1 => 'enforce_toolbar_policy', ), 2 => 99, ), 5 => array ( 0 => 'show_admin_bar', 1 => array ( 0 => 'Minn_Admin_Bar', 1 => 'suppress_core_bar', ), 2 => 100, ), 6 => array ( 0 => 'wp_enqueue_scripts', 1 => array ( 0 => 'Minn_Admin_Bar', 1 => 'enqueue', ), 2 => 10, ), 7 => array ( 0 => 'wp_footer', 1 => array ( 0 => 'Minn_Admin_Bar', 1 => 'render', ), 2 => 10, ), 8 => array ( 0 => 'body_class', 1 => array ( 0 => 'Minn_Admin_Bar', 1 => 'body_class', ), 2 => 10, ), )
privatestatic array $loaded
privatestatic array $skipped

Public

staticload(Minn\Runtime\Runtime $runtime): void#

Loads the active plugins as code and fires the boot hooks. Recovery is armed for exactly this window: a failure here is one every visitor would hit, so it may be recorded against its extension.

staticloadTheme(Minn\Runtime\Runtime $runtime): void#

The theme's setup without the plugins: setup_theme, the theme's functions.php, after_setup_theme, then wp_loaded. The probe runtime ends its boot with this, so a theme's supports are what a request's would be and a late declaration is judged as one; it skips init, whose work the probes compare on their own.

staticloaded(): array#

The plugins that loaded.

@return list<string>
staticskipped(): array#

The plugins the symbol gate refused, with what they lacked.

@return array<string, array<string, mixed>> plugin file => why it did not load
staticloadNow(string $plugin, Minn\Runtime\Runtime $runtime): ?string#

Loads one plugin's main file now, as activating it does: the reference includes the file (once) before activate_plugin fires, so the plugin's activation hook is in place to hear activate_<file>, and announces no plugin_loaded for it. The same gate as the boot decides, its folder walked again first; null once the plugin is running, otherwise why the gate refused it.

staticisLoaded(string $plugin): bool#

True when the named plugin file is running as code this request.

Internals 6

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

privateboot(Minn\Runtime\Runtime $runtime): void#
privateloadThemeFunctions(Minn\Runtime\Runtime $runtime): void#

The active theme's functions.php, child first then parent, between setup_theme and after_setup_theme as the reference loads them. Each file goes through the same symbol gate as a plugin folder and is reported under "theme:{slug}" when it cannot load. Templates never run as PHP; a block theme's functions.php only registers hooks.

privaterememberThemeDomain(string $folder, string $slug): void#

An active theme's own text domain, named in its stylesheet header (the slug when it names none), reads its folder ("Domain Path", or "/languages") with files named by locale alone.

privateincludeFile(string $file, string $name, Minn\Runtime\Runtime $runtime): void#
privateregisterRealpath(string $file, string $name, Minn\Runtime\Runtime $runtime): void#

A symlinked plugin folder resolves __FILE__ to its real location; the global map from the plugins directory's folder to that location keeps plugin_basename() and plugins_url() truthful, as the reference's $wp_plugin_paths does.

privateisolatedInclude(string $file): void#

The include gets a clean local scope, as wp-settings.php gives every plugin file.