Make Klaviyo show up in installed extensions card.

This commit is contained in:
Gan Eng Chin 2023-06-27 23:33:03 +08:00
parent 9d473adeb7
commit ac3097227c
No known key found for this signature in database
GPG Key ID: 94D5D972860ADB01
1 changed files with 32 additions and 0 deletions

View File

@ -29,6 +29,7 @@ class InstalledExtensions {
$google = self::get_google_extension_data(); $google = self::get_google_extension_data();
$amazon_ebay = self::get_amazon_ebay_extension_data(); $amazon_ebay = self::get_amazon_ebay_extension_data();
$mailpoet = self::get_mailpoet_extension_data(); $mailpoet = self::get_mailpoet_extension_data();
$klaviyo = self::get_klaviyo_extension_data();
$creative_mail = self::get_creative_mail_extension_data(); $creative_mail = self::get_creative_mail_extension_data();
$tiktok = self::get_tiktok_extension_data(); $tiktok = self::get_tiktok_extension_data();
$jetpack_crm = self::get_jetpack_crm_extension_data(); $jetpack_crm = self::get_jetpack_crm_extension_data();
@ -73,6 +74,10 @@ class InstalledExtensions {
$data[] = $mailpoet; $data[] = $mailpoet;
} }
if ( $klaviyo ) {
$data[] = $klaviyo;
}
if ( $creative_mail ) { if ( $creative_mail ) {
$data[] = $creative_mail; $data[] = $creative_mail;
} }
@ -380,6 +385,33 @@ class InstalledExtensions {
return $data; return $data;
} }
/**
* Get Klaviyo extension data.
*
* @return array|bool
*/
protected static function get_klaviyo_extension_data() {
$slug = 'klaviyo';
if ( ! PluginsHelper::is_plugin_installed( $slug ) ) {
return false;
}
$data = self::get_extension_base_data( $slug );
$data['icon'] = WC_ADMIN_IMAGES_FOLDER_URL . '/marketing/klaviyo.png';
if ( 'activated' === $data['status'] ) {
$klaviyo_options = get_option('klaviyo_settings');
if (isset($klaviyo_options['klaviyo_public_api_key'])) {
$data['status'] = 'configured';
}
$data['settingsUrl'] = admin_url( 'admin.php?page=klaviyo_settings' );
}
return $data;
}
/** /**
* Get Creative Mail for WooCommerce extension data. * Get Creative Mail for WooCommerce extension data.
* *