!extension_loaded($ext))); if (PHP_VERSION_ID < 80200 || $aiwend_missing !== []) { add_action('admin_notices', static function () use ($aiwend_missing): void { echo '

' . esc_html(sprintf( /* translators: 1: running PHP version, 2: missing PHP extensions or "none" */ __('Aiwend is inactive: it requires PHP 8.2 or newer with the sodium and mbstring extensions. This server runs PHP %1$s; missing extensions: %2$s. Ask your host to enable them (in XAMPP: uncomment extension=sodium and extension=mbstring in php.ini, then restart Apache).', 'aiwend'), PHP_VERSION, $aiwend_missing === [] ? __('none', 'aiwend') : implode(', ', $aiwend_missing) )) . '

'; }); return; } $aiwend_autoload = __DIR__ . '/vendor/autoload.php'; // Skip if Aiwend classes are already autoloadable (e.g. the test runner loaded this project's autoloader). if (!class_exists(\Aiwend\WordPress\Plugin::class) && !is_readable($aiwend_autoload)) { add_action('admin_notices', static function (): void { echo '

' . esc_html__('Aiwend is missing its dependencies. Install a built release package, or run "composer install" in the plugin folder.', 'aiwend') . '

'; }); return; } if (!class_exists(\Aiwend\WordPress\Plugin::class)) { require $aiwend_autoload; } // Registered at file load so it also exists during the activation request. add_filter('cron_schedules', static function (array $schedules): array { // Other code may read schedules before "init"; translating then would load the text domain too early. $schedules['aiwend_minute'] ??= ['interval' => 60, 'display' => did_action('init') ? __('Every minute (Aiwend jobs)', 'aiwend') : 'Every minute (Aiwend jobs)']; return $schedules; }); register_activation_hook(__FILE__, [\Aiwend\WordPress\Plugin::class, 'activate']); register_deactivation_hook(__FILE__, [\Aiwend\WordPress\Plugin::class, 'deactivate']); add_action('plugins_loaded', static function (): void { \Aiwend\WordPress\Plugin::instance()->boot(); });