Skip to content

Commit

Permalink
Support
Browse files Browse the repository at this point in the history
  • Loading branch information
officiallygod committed Oct 12, 2023
1 parent 6c8cef5 commit b67733d
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 4 deletions.
1 change: 1 addition & 0 deletions includes/Options.php
Original file line number Diff line number Diff line change
Expand Up @@ -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',
);

/**
Expand Down
18 changes: 14 additions & 4 deletions includes/SiteFeatures.php
Original file line number Diff line number Diff line change
Expand Up @@ -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 );
Expand All @@ -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;
}
}
Expand All @@ -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 );
}

}

0 comments on commit b67733d

Please sign in to comment.