From b67733d8075bca3fd298f2e583d90f3c0dd087bb Mon Sep 17 00:00:00 2001 From: Allen Benny Date: Thu, 12 Oct 2023 13:50:32 +0530 Subject: [PATCH 1/4] Support --- includes/Options.php | 1 + includes/SiteFeatures.php | 18 ++++++++++++++---- 2 files changed, 15 insertions(+), 4 deletions(-) diff --git a/includes/Options.php b/includes/Options.php index ba75900..1885932 100644 --- a/includes/Options.php +++ b/includes/Options.php @@ -57,6 +57,7 @@ final class Options { 'wc_taxes_enabled' => 'wc_connect_taxes_enabled', 'wc_calc_taxes' => 'woocommerce_calc_taxes', 'wc_no_sales_tax' => 'woocommerce_no_sales_tax', + 'active_plugins' => 'active_plugins', ); /** diff --git a/includes/SiteFeatures.php b/includes/SiteFeatures.php index c669ab5..e4eded5 100644 --- a/includes/SiteFeatures.php +++ b/includes/SiteFeatures.php @@ -299,10 +299,11 @@ public static function get_init() { /** * Filters out selected site features from a plugin list. * - * @param array $plugins List of plugins. + * @param array $plugins List of plugins. + * @param boolean $selected Selected/Unselected list of plugins * @return array */ - public static function filter_selected( $plugins ) { + public static function filter_selected( $plugins, $selected ) { $selected_plugins = array(); $flow_data = FlowService::read_data_from_wp_option( false ); @@ -312,7 +313,7 @@ public static function filter_selected( $plugins ) { $flow_data_site_features = $flow_data['data']['siteFeatures']; foreach ( $plugins as $plugin ) { - if ( ! isset( $flow_data_site_features[ $plugin['slug'] ] ) || true === $flow_data_site_features[ $plugin['slug'] ] ) { + if ( ! isset( $flow_data_site_features[ $plugin['slug'] ] ) || $selected === $flow_data_site_features[ $plugin['slug'] ] ) { $selected_plugins[] = $plugin; } } @@ -326,7 +327,16 @@ public static function filter_selected( $plugins ) { * @return array */ public static function get_selected() { - return self::filter_selected( self::get_init() ); + return self::filter_selected( self::get_init(), true ); + } + + /** + * Get only the unselected plugins from site features init list. + * + * @return array + */ + public static function get_unselected() { + return self::filter_selected( self::get_init(), false ); } } From 88613282f8f2c8f2154d5e77303503ba66a65eae Mon Sep 17 00:00:00 2001 From: Allen Benny Date: Thu, 12 Oct 2023 19:02:42 +0530 Subject: [PATCH 2/4] Change Default plugin activations to be true --- includes/Plugins.php | 62 +++++++++++++++++++-------------------- includes/SiteFeatures.php | 40 ++++++++++++------------- 2 files changed, 51 insertions(+), 51 deletions(-) diff --git a/includes/Plugins.php b/includes/Plugins.php index 62b3bca..2a42b39 100644 --- a/includes/Plugins.php +++ b/includes/Plugins.php @@ -22,32 +22,32 @@ final class Plugins { 'default' => array( array( 'slug' => 'nfd_slug_endurance_page_cache', - 'activate' => false, + 'activate' => true, 'priority' => 240, ), array( 'slug' => 'jetpack', - 'activate' => false, + 'activate' => true, 'priority' => 220, ), array( 'slug' => 'wordpress-seo', - 'activate' => false, + 'activate' => true, 'priority' => 200, ), array( 'slug' => 'wpforms-lite', - 'activate' => false, + 'activate' => true, 'priority' => 180, ), array( 'slug' => 'google-analytics-for-wordpress', - 'activate' => false, + 'activate' => true, 'priority' => 160, ), array( 'slug' => 'optinmonster', - 'activate' => false, + 'activate' => true, 'priority' => 140, ), ), @@ -55,7 +55,7 @@ final class Plugins { 'default' => array( array( 'slug' => 'woocommerce', - 'activate' => false, + 'activate' => true, 'priority' => 260, ), ), @@ -63,71 +63,71 @@ final class Plugins { 'wc_standard' => array( array( 'slug' => 'nfd_slug_yith_woocommerce_customize_myaccount_page', - 'activate' => false, + 'activate' => true, 'priority' => 257, ), array( 'slug' => 'nfd_slug_yith_woocommerce_gift_cards', - 'activate' => false, + 'activate' => true, 'priority' => 100, ), array( 'slug' => 'nfd_slug_yith_woocommerce_wishlist', - 'activate' => false, + 'activate' => true, 'priority' => 80, ), array( 'slug' => 'nfd_slug_yith_shippo_shippings_for_woocommerce', - 'activate' => false, + 'activate' => true, 'priority' => 259, ), array( 'slug' => 'nfd_slug_yith_paypal_payments_for_woocommerce', - 'activate' => false, + 'activate' => true, 'priority' => 258, ), ), 'wc_premium' => array( array( 'slug' => 'nfd_slug_yith_woocommerce_customize_myaccount_page', - 'activate' => false, + 'activate' => true, 'priority' => 257, ), array( 'slug' => 'nfd_slug_yith_woocommerce_gift_cards', - 'activate' => false, + 'activate' => true, 'priority' => 100, ), array( 'slug' => 'nfd_slug_yith_woocommerce_wishlist', - 'activate' => false, + 'activate' => true, 'priority' => 80, ), array( 'slug' => 'nfd_slug_yith_shippo_shippings_for_woocommerce', - 'activate' => false, + 'activate' => true, 'priority' => 259, ), array( 'slug' => 'nfd_slug_yith_paypal_payments_for_woocommerce', - 'activate' => false, + 'activate' => true, 'priority' => 258, ), array( 'slug' => 'nfd_slug_ecomdash_wordpress_plugin', - 'activate' => false, + 'activate' => true, 'priority' => 20, ), ), 'wc_priority' => array( array( 'slug' => 'nfd_slug_yith_shippo_shippings_for_woocommerce', - 'activate' => false, + 'activate' => true, 'priority' => 259, ), array( 'slug' => 'nfd_slug_yith_paypal_payments_for_woocommerce', - 'activate' => false, + 'activate' => true, 'priority' => 258, ), ), @@ -136,49 +136,49 @@ final class Plugins { 'wc_standard' => array( array( 'slug' => 'nfd_slug_yith_woocommerce_customize_myaccount_page', - 'activate' => false, + 'activate' => true, 'priority' => 257, ), array( 'slug' => 'nfd_slug_yith_woocommerce_gift_cards', - 'activate' => false, + 'activate' => true, 'priority' => 100, ), array( 'slug' => 'nfd_slug_yith_woocommerce_wishlist', - 'activate' => false, + 'activate' => true, 'priority' => 80, ), array( 'slug' => 'nfd_slug_woo_razorpay', - 'activate' => false, + 'activate' => true, 'priority' => 258, ), ), 'wc_premium' => array( array( 'slug' => 'nfd_slug_yith_woocommerce_customize_myaccount_page', - 'activate' => false, + 'activate' => true, 'priority' => 257, ), array( 'slug' => 'nfd_slug_yith_woocommerce_gift_cards', - 'activate' => false, + 'activate' => true, 'priority' => 100, ), array( 'slug' => 'nfd_slug_yith_woocommerce_wishlist', - 'activate' => false, + 'activate' => true, 'priority' => 80, ), array( 'slug' => 'nfd_slug_woo_razorpay', - 'activate' => false, + 'activate' => true, 'priority' => 258, ), array( 'slug' => 'nfd_slug_ecomdash_wordpress_plugin', - 'activate' => false, + 'activate' => true, 'priority' => 20, ), ), @@ -188,12 +188,12 @@ final class Plugins { 'wc_priority' => array( array( 'slug' => 'nfd_slug_yith_shippo_shippings_for_woocommerce', - 'activate' => false, + 'activate' => true, 'priority' => 259, ), array( 'slug' => 'nfd_slug_yith_paypal_payments_for_woocommerce', - 'activate' => false, + 'activate' => true, 'priority' => 258, ), ), diff --git a/includes/SiteFeatures.php b/includes/SiteFeatures.php index e4eded5..607c0a8 100644 --- a/includes/SiteFeatures.php +++ b/includes/SiteFeatures.php @@ -25,7 +25,7 @@ protected static function get_site_features_flow_plan_map() { 'desc' => __( 'Jetpack includes dozens of powerful, unique capabilities for your WordPress sites from Automattic.', 'wp-module-onboarding' ), 'selected' => false, 'shown' => true, - 'activate' => false, + 'activate' => true, ), 'wpforms-lite' => array( 'slug' => 'wpforms-lite', @@ -35,7 +35,7 @@ protected static function get_site_features_flow_plan_map() { 'desc' => __( 'Five million people build smarter forms and surveys with WPForms from Awesome Motive.', 'wp-module-onboarding' ), 'selected' => false, 'shown' => true, - 'activate' => false, + 'activate' => true, ), 'google-analytics-for-wordpress' => array( 'slug' => 'google-analytics-for-wordpress', @@ -45,7 +45,7 @@ protected static function get_site_features_flow_plan_map() { 'desc' => __( 'See the opportunities in your website analytics traffic data using MonsterInsights from Awesome Motive.', 'wp-module-onboarding' ), 'selected' => false, 'shown' => true, - 'activate' => false, + 'activate' => true, ), 'wordpress-seo' => array( 'slug' => 'wordpress-seo', @@ -55,7 +55,7 @@ protected static function get_site_features_flow_plan_map() { 'desc' => __( 'Get more traffic to your WordPress site with powerful analysis and tools from our colleagues at Yoast.', 'wp-module-onboarding' ), 'selected' => false, 'shown' => true, - 'activate' => false, + 'activate' => true, ), 'creative-mail-by-constant-contact' => array( 'slug' => 'creative-mail-by-constant-contact', @@ -65,7 +65,7 @@ protected static function get_site_features_flow_plan_map() { 'desc' => __( 'A professional logo builder, marketing automations with WooCommerce and social management -- CreativeMail is a whole lot more than mail from Constant Contact.', 'wp-module-onboarding' ), 'selected' => false, 'shown' => true, - 'activate' => false, + 'activate' => true, ), 'optinmonster' => array( 'slug' => 'optinmonster', @@ -75,7 +75,7 @@ protected static function get_site_features_flow_plan_map() { 'desc' => __( 'Connect with website visitors using a proven kit of tools for growth using this offering from Awesome Motive.', 'wp-module-onboarding' ), 'selected' => false, 'shown' => true, - 'activate' => false, + 'activate' => true, ), ), ), @@ -89,7 +89,7 @@ protected static function get_site_features_flow_plan_map() { 'desc' => __( 'Jetpack includes dozens of powerful, unique capabilities for your WordPress sites from Automattic.', 'wp-module-onboarding' ), 'selected' => false, 'shown' => true, - 'activate' => false, + 'activate' => true, ), 'wpforms-lite' => array( 'slug' => 'wpforms-lite', @@ -99,7 +99,7 @@ protected static function get_site_features_flow_plan_map() { 'desc' => __( 'Five million people build smarter forms and surveys with WPForms from Awesome Motive.', 'wp-module-onboarding' ), 'selected' => false, 'shown' => true, - 'activate' => false, + 'activate' => true, ), 'google-analytics-for-wordpress' => array( 'slug' => 'google-analytics-for-wordpress', @@ -109,7 +109,7 @@ protected static function get_site_features_flow_plan_map() { 'desc' => __( 'See the opportunities in your website analytics traffic data using MonsterInsights from Awesome Motive.', 'wp-module-onboarding' ), 'selected' => false, 'shown' => true, - 'activate' => false, + 'activate' => true, ), 'wordpress-seo' => array( 'slug' => 'wordpress-seo', @@ -119,7 +119,7 @@ protected static function get_site_features_flow_plan_map() { 'desc' => __( 'Get more traffic to your WordPress site with powerful analysis and tools from our colleagues at Yoast.', 'wp-module-onboarding' ), 'selected' => false, 'shown' => true, - 'activate' => false, + 'activate' => true, ), 'creative-mail-by-constant-contact' => array( 'slug' => 'creative-mail-by-constant-contact', @@ -129,7 +129,7 @@ protected static function get_site_features_flow_plan_map() { 'desc' => __( 'A professional logo builder, marketing automations with WooCommerce and social management -- CreativeMail is a whole lot more than mail from Constant Contact.', 'wp-module-onboarding' ), 'selected' => false, 'shown' => true, - 'activate' => false, + 'activate' => true, ), 'optinmonster' => array( 'slug' => 'optinmonster', @@ -139,7 +139,7 @@ protected static function get_site_features_flow_plan_map() { 'desc' => __( 'Connect with website visitors using a proven kit of tools for growth using this offering from Awesome Motive.', 'wp-module-onboarding' ), 'selected' => false, 'shown' => true, - 'activate' => false, + 'activate' => true, ), ), 'wc_standard' => array( @@ -151,7 +151,7 @@ protected static function get_site_features_flow_plan_map() { 'desc' => __( 'Give your visitors great search experiences with this exclusive offering from our colleagues at YITH.', 'wp-module-onboarding' ), 'selected' => false, 'shown' => true, - 'activate' => false, + 'activate' => true, ), 'nfd_slug_yith_woocommerce_ajax_product_filter' => array( 'slug' => 'nfd_slug_yith_woocommerce_ajax_product_filter', @@ -161,7 +161,7 @@ protected static function get_site_features_flow_plan_map() { 'desc' => __( 'Give your visitors powerful tools to discover your great products with this exclusive offering from our colleagues at YITH.', 'wp-module-onboarding' ), 'selected' => false, 'shown' => true, - 'activate' => false, + 'activate' => true, ), 'nfd_slug_yith_woocommerce_booking' => array( 'slug' => 'nfd_slug_yith_woocommerce_booking', @@ -171,7 +171,7 @@ protected static function get_site_features_flow_plan_map() { 'desc' => __( 'Have visitors book meetings and services with you, accepting payment and more using this exclusive offering from our colleagues at YITH.', 'wp-module-onboarding' ), 'selected' => false, 'shown' => true, - 'activate' => false, + 'activate' => true, ), 'nfd_slug_yith_woocommerce_wishlist' => array( 'slug' => 'nfd_slug_yith_woocommerce_wishlist', @@ -181,7 +181,7 @@ protected static function get_site_features_flow_plan_map() { 'desc' => __( 'Let discerning shoppers curate their selections with a system of favorites using this exclusive offering from our colleagues at YITH.', 'wp-module-onboarding' ), 'selected' => false, 'shown' => true, - 'activate' => false, + 'activate' => true, ), ), 'wc_premium' => array( @@ -193,7 +193,7 @@ protected static function get_site_features_flow_plan_map() { 'desc' => __( 'Give your visitors great search experiences with this exclusive offering from our colleagues at YITH.', 'wp-module-onboarding' ), 'selected' => false, 'shown' => true, - 'activate' => false, + 'activate' => true, ), 'nfd_slug_yith_woocommerce_ajax_product_filter' => array( 'slug' => 'nfd_slug_yith_woocommerce_ajax_product_filter', @@ -203,7 +203,7 @@ protected static function get_site_features_flow_plan_map() { 'desc' => __( 'Give your visitors powerful tools to discover your great products with this exclusive offering from our colleagues at YITH.', 'wp-module-onboarding' ), 'selected' => false, 'shown' => true, - 'activate' => false, + 'activate' => true, ), 'nfd_slug_yith_woocommerce_booking' => array( 'slug' => 'nfd_slug_yith_woocommerce_booking', @@ -213,7 +213,7 @@ protected static function get_site_features_flow_plan_map() { 'desc' => __( 'Have visitors book meetings and services with you, accepting payment and more using this exclusive offering from our colleagues at YITH.', 'wp-module-onboarding' ), 'selected' => false, 'shown' => true, - 'activate' => false, + 'activate' => true, ), 'nfd_slug_yith_woocommerce_wishlist' => array( 'slug' => 'nfd_slug_yith_woocommerce_wishlist', @@ -223,7 +223,7 @@ protected static function get_site_features_flow_plan_map() { 'desc' => __( 'Let discerning shoppers curate their selections with a system of favorites using this exclusive offering from our colleagues at YITH.', 'wp-module-onboarding' ), 'selected' => false, 'shown' => true, - 'activate' => false, + 'activate' => true, ), ), 'wc_priority' => array(), From 864c15b9d981264c2e2ed80a15c6818cdae3244c Mon Sep 17 00:00:00 2001 From: Allen Benny Date: Wed, 18 Oct 2023 12:48:47 +0530 Subject: [PATCH 3/4] Update SiteFeatures.php --- includes/SiteFeatures.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/includes/SiteFeatures.php b/includes/SiteFeatures.php index 607c0a8..b6a8252 100644 --- a/includes/SiteFeatures.php +++ b/includes/SiteFeatures.php @@ -303,7 +303,7 @@ public static function get_init() { * @param boolean $selected Selected/Unselected list of plugins * @return array */ - public static function filter_selected( $plugins, $selected ) { + public static function filter( $plugins, $selected ) { $selected_plugins = array(); $flow_data = FlowService::read_data_from_wp_option( false ); @@ -327,7 +327,7 @@ public static function filter_selected( $plugins, $selected ) { * @return array */ public static function get_selected() { - return self::filter_selected( self::get_init(), true ); + return self::filter( self::get_init(), true ); } /** @@ -336,7 +336,7 @@ public static function get_selected() { * @return array */ public static function get_unselected() { - return self::filter_selected( self::get_init(), false ); + return self::filter( self::get_init(), false ); } } From 2a1d5a122d04084b65d353539bed5f57601289b1 Mon Sep 17 00:00:00 2001 From: Allen Benny Date: Wed, 18 Oct 2023 13:26:47 +0530 Subject: [PATCH 4/4] Update Options.php --- includes/Options.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/includes/Options.php b/includes/Options.php index 1885932..0d1e586 100644 --- a/includes/Options.php +++ b/includes/Options.php @@ -57,7 +57,7 @@ final class Options { 'wc_taxes_enabled' => 'wc_connect_taxes_enabled', 'wc_calc_taxes' => 'woocommerce_calc_taxes', 'wc_no_sales_tax' => 'woocommerce_no_sales_tax', - 'active_plugins' => 'active_plugins', + 'filter_active_plugins' => 'filter_active_plugins', ); /**