id || ! current_user_can( 'activate_plugins' ) ) { return; } printf( '

%s

', esc_html( sprintf( /* translators: %s: required PHP version. */ __( 'GripMCP requires PHP %s or higher. The plugin has been halted.', 'gripmcp' ), GRIPMCP_MIN_PHP ) ) ); } ); return; } /* |-------------------------------------------------------------------------- | Autoloading |-------------------------------------------------------------------------- | Prefer Composer's PSR-4 autoloader when present; otherwise fall back to the | bundled lightweight autoloader so the plugin works as a plain zip install. */ if ( is_readable( GRIPMCP_DIR . 'vendor/autoload.php' ) ) { require GRIPMCP_DIR . 'vendor/autoload.php'; } else { require GRIPMCP_DIR . 'includes/Autoloader.php'; Autoloader::register(); } // The crash recorder (and the paid version's temporary debug logging) attach // now, while the plugin file loads, rather than on plugins_loaded: they should // see as much of every request as a plugin can. Support\Debug_Logging::boot(); /* |-------------------------------------------------------------------------- | Lifecycle hooks |-------------------------------------------------------------------------- */ register_activation_hook( GRIPMCP_FILE, array( Activator::class, 'activate' ) ); register_deactivation_hook( GRIPMCP_FILE, array( Deactivator::class, 'deactivate' ) ); // Deleting the plugin removes its data. With the Freemius SDK loaded, Freemius // owns WordPress's uninstall hook (it records the uninstall, then fires // after_uninstall); without it, WordPress calls the clean-up directly. // // Freemius skips both its uninstall hook and after_uninstall when nobody with // activate_plugins is signed in (WP-CLI without --user, a host's control // panel), so the clean-up also runs on WordPress's own uninstall action, // after Freemius's. That action fires only while this copy is being deleted, // and this file gets this far only when the other edition (free or paid) is // not loaded, which is Freemius's rule for keeping the data too. The // Deactivator makes sure the action is registered at all. if ( function_exists( 'gripmcp_fs' ) ) { \gripmcp_fs()->add_action( 'after_uninstall', array( Uninstaller::class, 'run' ) ); add_action( 'uninstall_' . GRIPMCP_BASENAME, array( Uninstaller::class, 'run' ), 20 ); } else { add_action( 'admin_init', array( Uninstaller::class, 'ensure_registered' ) ); } /** * Boot the plugin. * * The single Plugin instance owns the service container and wires every * subsystem together. Nothing else in the codebase instantiates services * directly — everything is resolved through the container. * * @return Plugin */ function gripmcp(): Plugin { return Plugin::instance(); } // Kick things off once WordPress and all plugins are loaded. add_action( 'plugins_loaded', __NAMESPACE__ . '\\gripmcp', 20 );