should_take_over() ) { return $data; } $data['evnetin_ai_active'] = true; $data['evnetin_pro_active'] = true; // Banner images are out of scope for now (one AI image costs hundreds of credits). // New Eventin hides the banner AI icon when this is false. $data['banner_ai_active'] = false; return $data; } /** * Give our empty class the name EventinAI, for old Eventin versions. * Runs only while admin scripts load, so it can never block activating the real plugin. * * @return bool True when the alias was made now. */ public function maybe_declare_shim(): bool { if ( ! class_exists( 'Wpeventin' ) || class_exists( 'EventinAI', false ) ) { return false; } return class_alias( Eventin_Ai_Legacy_Shim::class, 'EventinAI' ); } /** * Remove the old plugin's React bundle, so only Aisentic's AI window opens. * * @return void */ public function remove_legacy_assets(): void { if ( ! $this->legacy_plugin_active() || ! $this->should_take_over() ) { return; } wp_dequeue_script( 'etn-ai-script' ); wp_dequeue_style( 'etn-ai-style' ); } /** * Tell admins the old plugin can go. Only on the Plugins page and Eventin pages. * * @return void */ public function legacy_plugin_notice(): void { if ( ! $this->legacy_plugin_active() || ! current_user_can( 'activate_plugins' ) ) { return; } $screen = function_exists( 'get_current_screen' ) ? get_current_screen() : null; if ( ! $screen || ! in_array( $screen->id, [ 'plugins', 'toplevel_page_eventin' ], true ) ) { return; } if ( get_user_meta( get_current_user_id(), self::DISMISS_META, true ) ) { return; } $dismiss_url = wp_nonce_url( add_query_arg( self::DISMISS_ACTION, '1' ), self::DISMISS_ACTION ); $message = $this->should_take_over() ? __( 'Aisentic now handles Eventin AI features. You can deactivate the Eventin AI plugin.', 'aisentic' ) : __( 'Aisentic can now handle Eventin AI features. Connect Aisentic in its settings, then you can deactivate the Eventin AI plugin.', 'aisentic' ); printf( '
%1$s %3$s