reason = 'missing'; return false; } if ( version_compare( (string) WC_VERSION, EXTROVA_MIN_WC, '<' ) ) { $this->reason = 'version'; return false; } return true; } /** * Hooks the Plugins-screen-only notice. */ public function register_notice(): void { add_action( 'admin_notices', array( $this, 'render_notice' ) ); } /** * Renders the notice on the Plugins screen only. */ public function render_notice(): void { $screen = function_exists( 'get_current_screen' ) ? get_current_screen() : null; if ( ! $screen || 'plugins' !== $screen->id ) { return; } if ( 'version' === $this->reason ) { $message = sprintf( /* translators: %s: minimum WooCommerce version. */ __( 'Extrova requires WooCommerce %s or later. The plugin is inactive until WooCommerce is updated.', 'extrova' ), EXTROVA_MIN_WC ); } else { $message = __( 'Extrova requires WooCommerce to be installed and active.', 'extrova' ); } printf( '

%s

', esc_html( $message ) ); } }