add_action( 'admin_notices', $this, 'render' ); $loader->add_action( 'admin_post_abds_seo_acknowledge_noindex_activation', $this, 'handle_acknowledge' ); } /** * Renders the notice when there's real pending activation to warn * about, gated on the plugin's general management capability (same * gate ABDS_SEO_License_Notices uses). Skipped on the Dashboard screen * itself: the third design pass embeds this same warning as a native * bento card in the dashboard's own composition (dashboard-page.php) — * showing both would be a duplicate, foreign-looking strip stacked * above a design that already carries the message. */ public function render(): void { if ( ! current_user_can( ABDS_SEO_Activator::CAPABILITY ) ) { return; } if ( ! ABDS_SEO_Noindex_Activation::is_pending() ) { return; } $screen = function_exists( 'get_current_screen' ) ? get_current_screen() : null; if ( $screen && 'toplevel_page_' . ABDS_SEO_Admin::MENU_SLUG === $screen->id ) { return; } $count = ABDS_SEO_Noindex_Activation::pending_count(); printf( '

%s

%s %s

', esc_html( sprintf( /* translators: %d: number of affected posts. */ _n( '%d page has long-stored noindex/nofollow settings from a previous SEO plugin migration that now start taking real effect on your live site with this update.', '%d pages have long-stored noindex/nofollow settings from a previous SEO plugin migration that now start taking real effect on your live site with this update.', $count, 'abds-seo' ), $count ) ), sprintf( '%s', esc_url( admin_url( 'admin.php?page=abds-seo-noindex-activation-review' ) ), esc_html__( 'Review affected pages', 'abds-seo' ) ), sprintf( '
%2$s
', esc_url( admin_url( 'admin-post.php' ) ), // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- wp_nonce_field() with $echo=false already returns safe, self-generated HTML (a hidden input), the standard way to inline it into a larger printf-built string. wp_nonce_field( 'abds_seo_acknowledge_noindex_activation', '_wpnonce', true, false ), esc_html__( 'Got it, dismiss', 'abds-seo' ) ) ); } /** * Handles the "Got it, dismiss" submit: marks the current * ACTIVATION_VERSION acknowledged and redirects back. */ public function handle_acknowledge(): void { if ( ! current_user_can( ABDS_SEO_Activator::CAPABILITY ) ) { wp_die( esc_html__( 'You do not have permission to perform this action.', 'abds-seo' ) ); } check_admin_referer( 'abds_seo_acknowledge_noindex_activation' ); ABDS_SEO_Noindex_Activation::acknowledge(); $referer = wp_get_referer(); wp_safe_redirect( $referer ? $referer : admin_url( 'admin.php?page=abds-seo' ) ); exit; } }