From f650be541f33d3edffdd70cbf3fd53462bdfa7f1 Mon Sep 17 00:00:00 2001 From: Thijs van der heijden Date: Mon, 27 Jan 2025 13:14:29 +0100 Subject: [PATCH] Onionize the config --- .../recommended-integrations.js | 9 +++-- .../infrastructure/integrations/site-kit.php | 33 +++++++++++++------ 2 files changed, 27 insertions(+), 15 deletions(-) diff --git a/packages/js/src/integrations-page/recommended-integrations.js b/packages/js/src/integrations-page/recommended-integrations.js index 653a19955da..6b45cdb7678 100644 --- a/packages/js/src/integrations-page/recommended-integrations.js +++ b/packages/js/src/integrations-page/recommended-integrations.js @@ -82,16 +82,15 @@ const RecommendedIntegrations = [ ]; const googleSiteKitProps = { - isInstalled: get( window, "wpseoIntegrationsData.google_site_kit_configuration.installed", false ) === "1", - isActive: get( window, "wpseoIntegrationsData.google_site_kit_configuration.active", false ) === "1", - afterSetup: get( window, "wpseoIntegrationsData.google_site_kit_configuration.setup_completed", false ) === "1", - isConnected: get( window, "wpseoIntegrationsData.google_site_kit_configuration.connected", false ) === "1", + isInstalled: get( window, "wpseoIntegrationsData.google_site_kit_configuration.installed", false ), + isActive: get( window, "wpseoIntegrationsData.google_site_kit_configuration.active", false ), + afterSetup: get( window, "wpseoIntegrationsData.google_site_kit_configuration.setup_completed", false ), + isConnected: get( window, "wpseoIntegrationsData.google_site_kit_configuration.connected", false ), installUrl: get( window, "wpseoIntegrationsData.google_site_kit_configuration.install_url", "" ), activateUrl: get( window, "wpseoIntegrationsData.google_site_kit_configuration.activate_url", "" ), setupUrl: get( window, "wpseoIntegrationsData.google_site_kit_configuration.setup_url", "" ), }; -console.log(get( window, "wpseoIntegrationsData.google_site_kit_configuration.installed", false )); if ( isGoogleSiteKitFeatureEnabled ) { RecommendedIntegrations.push( ); diff --git a/src/dashboard/infrastructure/integrations/site-kit.php b/src/dashboard/infrastructure/integrations/site-kit.php index 0212cec08ed..c4fb57eeb55 100644 --- a/src/dashboard/infrastructure/integrations/site-kit.php +++ b/src/dashboard/infrastructure/integrations/site-kit.php @@ -1,11 +1,14 @@ Returns the name and if the feature is enabled. */ public function to_array(): array { - $google_site_kit_activate_url = \wp_nonce_url( - \self_admin_url( 'plugins.php?action=activate&plugin=' . self::GOOGLE_SITE_KIT_FILE ), - 'activate-plugin_' . self::GOOGLE_SITE_KIT_FILE + $google_site_kit_activate_url = \html_entity_decode( + \wp_nonce_url( + \self_admin_url( 'plugins.php?action=activate&plugin=' . self::GOOGLE_SITE_KIT_FILE ), + 'activate-plugin_' . self::GOOGLE_SITE_KIT_FILE + ) ); - $google_site_kit_install_url = \wp_nonce_url( - \self_admin_url( 'update.php?action=install-plugin&plugin=google-site-kit' ), - 'install-plugin_google-site-kit' + $google_site_kit_install_url = \html_entity_decode( + \wp_nonce_url( + \self_admin_url( 'update.php?action=install-plugin&plugin=google-site-kit' ), + 'install-plugin_google-site-kit' + ) ); $google_site_kit_setup_url = \self_admin_url( 'admin.php?page=googlesitekit-splash' ); @@ -62,7 +73,9 @@ public function to_array(): array { } /** - * @inheritDoc + * Return this object represented by a key value array. + * + * @return array Returns the name and if the feature is enabled. */ public function to_legacy_array(): array { return $this->to_array();