registerAdminPostHandlers(); } if (! Compatibility::isWooCommerceActive()) { Logger::error('Aivie for WooCommerce could not initialize because WooCommerce is not active.'); add_action('admin_notices', [$this, 'noticeWooCommerceRequired']); return; } $this->registerHooks(); $this->registerAdmin($settings); $this->registerCli(); GdprHooks::register(); } private function registerHooks(): void { $paymentFailureRecorder = new StripePaymentFailureRecorder(); $paymentFailureRecorder->register(); $hooks = new OrderHooks(); $hooks->register(); $subscriptionHooks = new SubscriptionHooks(); $subscriptionHooks->register(); } private function registerAdmin(?SettingsPage $settings = null): void { if (! is_admin()) { return; } if (null === $settings) { $settings = new SettingsPage(); $settings->registerAdminPostHandlers(); } $settings->registerPageHooks(); $actions = new OrderActions(); $actions->register(); $bulkActions = new OrderBulkActions(); $bulkActions->register(); $subscriptionActions = new SubscriptionActions(); $subscriptionActions->register(); } private function registerCli(): void { if (! defined('WP_CLI') || ! \WP_CLI) { return; } \WP_CLI::add_command('aivie', SyncOrderCommand::class); } public function noticeWooCommerceRequired(): void { echo '

'; echo esc_html__('Aivie for WooCommerce requires WooCommerce to be installed and active.', 'aivie-for-woocommerce'); echo '

'; } public static function onActivation(): void { // Nothing to do on activation; options are set only when admin saves settings. } public static function onDeactivation(): void { // Nothing to do on deactivation. } }