settings_repo = new SettingsRepository(); $host_detector = new HostDetector(); $api_endpoint_resolver = new ApiEndpointResolver(); $this->log_manager = new LogReadsManager( $this->settings_repo ); $this->settings_page = new SettingsPage( $this->settings_repo, $this->log_manager ); $this->menu = new Menu( new MainPage(), $this->settings_page ); $this->assets = new Assets( $this->settings_repo, $api_endpoint_resolver ); $this->rest_nonce_ajax = new RestNonceAjax(); $this->activation_disclaimer_notice = new ActivationDisclaimerNotice( $this->settings_repo ); $this->privacy_policy = new PrivacyPolicy(); $this->privacy_data_hooks = new PrivacyDataHooks( new PrivacyApiClient( $this->settings_repo, $api_endpoint_resolver ) ); $site_reader = new SiteReader( $this->settings_repo ); $change_exec = new ChangeExecutor(); $context_ctrl = new ContextController( $this->settings_repo, $host_detector ); $read_ctrl = new ReadSiteController( $site_reader, $this->settings_repo ); $execute_ctrl = new ExecuteChangesController( $change_exec, $this->settings_repo ); $settings_ctrl = new SettingsController( $this->settings_repo, $this->log_manager ); $privacy_proof_ctrl = new PrivacyProofController( $this->settings_repo ); $this->routes = new RoutesRegistrar( $context_ctrl, $read_ctrl, $execute_ctrl, $settings_ctrl, $privacy_proof_ctrl ); } /** * Attach plugin services to WordPress hooks. */ public function register(): void { add_action( 'admin_menu', array( $this->menu, 'register' ) ); add_action( 'admin_init', array( $this->privacy_policy, 'register' ) ); $this->privacy_data_hooks->register(); add_action( 'admin_enqueue_scripts', array( $this->assets, 'enqueue' ), 99 ); add_action( 'admin_post_actionpanel_ai_save_settings', array( $this->settings_page, 'handle_save' ) ); add_action( 'wp_ajax_actionpanel_ai_refresh_rest_nonce', array( $this->rest_nonce_ajax, 'handle' ) ); add_action( 'rest_api_init', array( $this->routes, 'register_routes' ) ); add_action( 'init', array( $this->log_manager, 'maybe_bootstrap' ), 1 ); add_action( LogReadsManager::CRON_HOOK, array( $this->log_manager, 'handle_cron_disable' ) ); add_action( 'admin_notices', array( $this->activation_disclaimer_notice, 'maybe_render' ) ); } /** * Disable temporary log sharing when the plugin is deactivated. */ public function deactivate(): void { $this->log_manager->disable( 'plugin_deactivate' ); } }