redundant(); if ( empty( $redundant ) ) { return; } printf( '

%1$s

%2$s

%3$s

%4$s   %6$s

', esc_html__( '404 to 301: your add-ons are now built in', '404-to-301' ), esc_html( sprintf( /* translators: %s: comma-separated list of addon plugin names. */ _n( 'The %s add-on is now included in 404 to 301 itself, and the matching feature has been switched on for you.', 'The following add-ons are now included in 404 to 301 itself, and the matching features have been switched on for you: %s.', count( $redundant ), '404-to-301' ), implode( ', ', $redundant ) ) ), esc_html__( 'You can safely deactivate and delete the separate add-on plugin(s) — nothing will stop working.', '404-to-301' ), sprintf( '%2$s', esc_url( admin_url( 'plugins.php' ) ), esc_html__( 'Go to Plugins', '404-to-301' ) ), esc_url( $this->dismissUrl() ), esc_html__( 'Dismiss', '404-to-301' ) ); } /** * Names of the redundant addon plugins that are still active. * * Re-checked against `active_plugins` on every render rather than * trusted from the stored option, so the notice disappears on its own * once the user has removed the plugins. * * @since 4.0.3 * * @return array Human-readable addon names. */ private function redundant(): array { // The 4.0.3 adoption folds the legacy `404_to_301_redundant_addons` option into here. $stored = aioseo404To301()->internalOptions->internal->redundantAddons; if ( ! is_array( $stored ) || empty( $stored ) ) { return []; } if ( ! function_exists( 'is_plugin_active' ) ) { require_once ABSPATH . 'wp-admin/includes/plugin.php'; } $names = []; foreach ( $stored as $basename => $name ) { if ( is_plugin_active( (string) $basename ) ) { $names[] = (string) $name; } } // Everything has been removed - clear the list so we stop looking on every admin page load. if ( empty( $names ) ) { aioseo404To301()->internalOptions->internal->redundantAddons = []; } return $names; } /** * Build the nonced dismiss URL for the current screen. * * @since 4.0.3 * * @return string */ private function dismissUrl(): string { return wp_nonce_url( add_query_arg( self::DISMISS_ARG, '1' ), self::DISMISS_NONCE ); } }