plugin_name = $plugin_name; $this->service = null; $this->notice_registered = false; } public function maybe_install() { $service = $this->get_service(); if ($service) { $service->maybe_install(); } } public function install_schema() { $service = $this->get_service(); if ($service) { $service->install_schema(); } } public function register_rest_routes() { $service = $this->get_service(); if ($service) { $service->register_rest_routes(); } } public function cleanup_old_events() { $service = $this->get_service(); if ($service) { $service->cleanup_old_events(); } } public function get_runtime_payload($page_path = '') { $service = $this->get_service(); if (! $service) { return null; } return $service->get_runtime_payload($page_path); } public function get_protect_template() { $service = $this->get_service(); if (! $service) { return null; } return $service->get_protect_template(); } public function render_addon_update_notice() { echo '

'; echo esc_html__('AdUnblocker Pro must be updated to version 2.0.1 or newer before its recovery features can run.', 'adunblocker'); echo '

'; } private function get_service() { if ($this->service instanceof AdUnblocker_Pro_Recovery) { return $this->service; } if (! class_exists('AdUnblocker_Pro_Recovery') || !defined('DAAU_PRO_PLUGIN_VERSION') || version_compare(DAAU_PRO_PLUGIN_VERSION, '2.0.1', '<')) { if ( defined('DAAU_PRO_ACTIVE') && DAAU_PRO_ACTIVE && is_admin() && ! $this->notice_registered ) { add_action('admin_notices', array($this, 'render_addon_update_notice')); $this->notice_registered = true; } return null; } $this->service = new AdUnblocker_Pro_Recovery($this->plugin_name); return $this->service; } }