db = new FiveD_Site_Bridge_DB(); $this->settings = new FiveD_Site_Bridge_Settings( $this->db ); $this->transport = new FiveD_Site_Bridge_Transport( $this->settings ); add_action( 'admin_notices', array( $this, 'maybe_show_transport_notice' ) ); } /** * Explain the active transport during the compatibility handoff. * * @return void */ public function maybe_show_transport_notice() { if ( ! current_user_can( 'manage_options' ) ) { return; } if ( ! $this->transport->is_primary() && ! $this->is_ai_engine_active() ) { echo '

'; echo esc_html__( 'Your AI client cannot reach this site yet. Open Divi Powers → AI Connection to check the connection.', '5d-powers-for-divi' ); echo '

'; } if ( $this->transport->is_primary() && $this->is_ai_engine_active() ) { echo '

'; echo esc_html__( '5D Powers for Divi is ready to work with ChatGPT. AI Engine may remain active while you test, but it is no longer required.', '5d-powers-for-divi' ); echo '

'; } if ( $this->is_legacy_bridge_active() ) { echo '

'; echo esc_html__( 'The original Oraya Site Bridge is still active. After confirming the 5D Powers for Divi connection tools, deactivate the old bridge to avoid duplicate site-management toolsets.', '5d-powers-for-divi' ); echo '

'; } } /** * Check whether the original single-site bridge is still active. * * @return bool */ private function is_legacy_bridge_active() { if ( ! function_exists( 'is_plugin_active' ) ) { require_once ABSPATH . 'wp-admin/includes/plugin.php'; } return is_plugin_active( 'oraya-site-bridge/oraya-site-bridge.php' ) || is_plugin_active_for_network( 'oraya-site-bridge/oraya-site-bridge.php' ); } /** * Check the known AI Engine bootstrap signals. * * @return bool */ public function is_ai_engine_active() { global $mwai; if ( ! function_exists( 'is_plugin_active' ) ) { require_once ABSPATH . 'wp-admin/includes/plugin.php'; } return isset( $mwai ) || defined( 'MWAI_VERSION' ) || class_exists( 'Meow_MWAI_Core' ) || is_plugin_active( 'ai-engine/ai-engine.php' ) || is_plugin_active_for_network( 'ai-engine/ai-engine.php' ); } }