Skip to content

Commit

Permalink
Update Plugins.php
Browse files Browse the repository at this point in the history
  • Loading branch information
officiallygod committed Oct 7, 2024
1 parent b822681 commit faad24e
Showing 1 changed file with 46 additions and 43 deletions.
89 changes: 46 additions & 43 deletions includes/Plugins.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
namespace NewfoldLabs\WP\Module\Onboarding\Data;

use NewfoldLabs\WP\Module\Installer\Data\Plugins as PluginsInstaller;
use NewfoldLabs\WP\Module\Installer\Services\PluginInstaller as PluginsInstallerService;

use function NewfoldLabs\WP\ModuleLoader\container;

Expand Down Expand Up @@ -55,55 +56,13 @@ final class Plugins {
),
),
'site-capabilities' => array(
'hasEcomdash' => array(
'hasEcomdash' => array(
array(
'slug' => 'nfd_slug_ecomdash_wordpress_plugin',
'activate' => true,
'priority' => 220,
),
),
'hasYithExtended' => array(
array(
'slug' => 'woocommerce',
'activate' => true,
'priority' => 300,
),
array(
'slug' => 'nfd_slug_yith_woocommerce_booking',
'activate' => true,
'priority' => 100,
),
array(
'slug' => 'yith-woocommerce-ajax-search',
'activate' => true,
'priority' => 120,
),
array(
'slug' => 'nfd_slug_yith_woocommerce_gift_cards',
'activate' => true,
'priority' => 140,
),
array(
'slug' => 'nfd_slug_yith_woocommerce_wishlist',
'activate' => true,
'priority' => 160,
),
array(
'slug' => 'nfd_slug_yith_woocommerce_customize_myaccount_page',
'activate' => true,
'priority' => 180,
),
array(
'slug' => 'nfd_slug_yith_woocommerce_ajax_product_filter',
'activate' => true,
'priority' => 200,
),
array(
'slug' => 'nfd_slug_wonder_cart',
'activate' => true,
'priority' => 210,
),
),
),
'ecommerce' => array(
'default' => array(
Expand Down Expand Up @@ -255,6 +214,42 @@ final class Plugins {
),
);

/**
* Default Premium Yith Plugins Data
*
* @var array
*/
protected static $default_premium_yith_plugins = array(
array(
'slug' => 'nfd_slug_yith_woocommerce_booking',
'activate' => true,
),
array(
'slug' => 'yith-woocommerce-ajax-search',
'activate' => true,
),
array(
'slug' => 'nfd_slug_yith_woocommerce_gift_cards',
'activate' => true,
),
array(
'slug' => 'nfd_slug_yith_woocommerce_wishlist',
'activate' => true,
),
array(
'slug' => 'nfd_slug_yith_woocommerce_customize_myaccount_page',
'activate' => true,
),
array(
'slug' => 'nfd_slug_yith_woocommerce_ajax_product_filter',
'activate' => true,
),
array(
'slug' => 'nfd_slug_wonder_cart',
'activate' => true,
),
);

/**
* Get the list of initial plugins to be installed for a particular hosting plan.
*
Expand All @@ -263,6 +258,8 @@ final class Plugins {
public static function get_init() {
// The Default plugins for all types
$init_list = self::$init_list['default'];
// The Default premium Yith plugins to be installed
$default_premium_yith_plugins = self::$default_premium_yith_plugins;

// The default plugins for Site Capabilities.
if ( isset( self::$init_list['site-capabilities'] ) ) {
Expand All @@ -279,6 +276,12 @@ public static function get_init() {
}
}

if ( isset( $default_premium_yith_plugins ) ) {
foreach ( $default_premium_yith_plugins as $yith_plugin_data ) {
PluginsInstallerService::install_premium_plugin( $yith_plugin_data['slug'], $yith_plugin_data['activate'] );
}
}

$plan_data = Data::current_plan();
$plan_flow = $plan_data['flow'];
if ( $plan_flow && isset( self::$init_list[ $plan_flow ] ) ) {
Expand Down

0 comments on commit faad24e

Please sign in to comment.