addon_manager = $addon_manager; } /** * Registers all hooks to WordPress. * * @return void */ public function register_hooks() { \add_action( 'admin_init', [ $this, 'start_addon_installation' ] ); } /** * Starts the addon installation flow. * * @return void */ public function start_addon_installation() { // Only show the dialog when we explicitly want to see it. // phpcs:ignore WordPress.Security.NonceVerification.Recommended -- Reason: This is not a form. if ( ! isset( $_GET['install'] ) || $_GET['install'] !== 'true' ) { return; } $this->bust_myyoast_addon_information_cache(); $this->owned_addons = $this->get_owned_addons(); if ( \count( $this->owned_addons ) > 0 ) { \add_action( 'admin_enqueue_scripts', [ $this, 'show_modal' ] ); } else { \add_action( 'admin_notices', [ $this, 'throw_no_owned_addons_warning' ] ); } } /** * Throws a no owned addons warning. * * @return void */ public function throw_no_owned_addons_warning() { echo '
' . \sprintf( /* translators: %1$s expands to Yoast SEO */ \esc_html__( 'No %1$s plugins have been installed. You don\'t seem to own any active subscriptions.', 'wordpress-seo' ), 'Yoast SEO' ) . '