Skip to content

Commit

Permalink
fixed multisite woocommerce check
Browse files Browse the repository at this point in the history
  • Loading branch information
eclipsesrl committed Nov 6, 2019
1 parent 16eae32 commit ccbea50
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 14 deletions.
4 changes: 3 additions & 1 deletion README.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Donate link: https://www.udesly.com/
Tags: webflow to wordpress, editor, page builder, layout design, udesly, webflow
Requires at least: 5.0
Tested up to: 5.2.3
Stable tag: 2.0.0.38
Stable tag: 2.0.0.39
License: GPLv3 or later
License URI: https://www.udesly.com/terms-conditions-of-use/#udesly-wordpress-plugin
Requires PHP: 5.6.0
Expand Down Expand Up @@ -80,6 +80,8 @@ That's all!

Absolutely! You can use the Udesly Adapter to create more than one website.
== Changelog ==
= 2.0.0.39 =
* Fixed check for WooCommerce is active when multisite is enabled

= 2.0.0.38 =
* Fixed wrong css for checkout notifications
Expand Down
23 changes: 16 additions & 7 deletions includes/Core/Udesly.php
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,20 @@ public function run()

}

public static function is_wc_active() {
if (is_multisite()) {
if (class_exists('WooCommerce')) {
return true;
}
} else if( in_array(
'woocommerce/woocommerce.php',
apply_filters('active_plugins', get_option('active_plugins'))
)) {
return true;
}
return false;
}

/**
* Loads text locale
*/
Expand Down Expand Up @@ -91,10 +105,7 @@ public function include_dependencies()
}

if (
in_array(
'woocommerce/woocommerce.php',
apply_filters('active_plugins', get_option('active_plugins'))
)
$this->is_wc_active()
) {
require_once UDESLY_ADAPTER_PLUGIN_MISC_PATH . 'woocommerce.php';
}
Expand Down Expand Up @@ -147,9 +158,7 @@ public function add_public_hooks()
CustomPostTypes::public_hooks();
$blog = new Blog();
$blog->public_hooks();
if ( in_array(
'woocommerce/woocommerce.php',
apply_filters('active_plugins', get_option('active_plugins'))) ) {
if ( $this->is_wc_active() ) {
WC::public_hooks();
add_action('wp_enqueue_scripts', array($this, 'enqueue_wc_library'));
}
Expand Down
8 changes: 4 additions & 4 deletions includes/Theme/UdeslyThemeData.php
Original file line number Diff line number Diff line change
Expand Up @@ -64,10 +64,10 @@ private function is_active($plugin) {
case "advanced-custom-fields":
return function_exists("get_field");
case "woocommerce":
return in_array(
'woocommerce/woocommerce.php',
apply_filters( 'active_plugins', get_option( 'active_plugins' ) )
);
if (is_multisite()) {
return true;
}
return is_plugin_active( 'woocommerce/woocommerce.php');
default:
return false;
}
Expand Down
4 changes: 2 additions & 2 deletions udesly-adapter-plugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
* Plugin Name: Udesly Adapter
* Plugin URI: https://www.udesly.com
* Description: This is a support plugin for Udesly (Webflow to WordPress converter) that allows you to enable additional features for your theme.
* Version: 2.0.0.38
* Version: 2.0.0.39
* Author: Udesly
* Author URI: https://www.udesly.com
* License: GPL-2.0+
Expand All @@ -29,7 +29,7 @@
// Constants
defined('UDESLY_ADAPTER_PLUGIN_DIRECTORY_PATH') ?: define('UDESLY_ADAPTER_PLUGIN_DIRECTORY_PATH', plugin_dir_path(__FILE__));
defined('UDESLY_ADAPTER_PLUGIN_DIRECTORY_URL') ?: define('UDESLY_ADAPTER_PLUGIN_DIRECTORY_URL', plugin_dir_url(__FILE__));
defined('UDESLY_ADAPTER_VERSION') ?: define('UDESLY_ADAPTER_VERSION', "2.0.0.38");
defined('UDESLY_ADAPTER_VERSION') ?: define('UDESLY_ADAPTER_VERSION', "2.0.0.39");
defined('UDESLY_TEXT_DOMAIN') ?: define('UDESLY_TEXT_DOMAIN', "udesly-adapter-plugin");

defined('UDESLY_ADAPTER_PLUGIN_MISC_PATH') ?: define('UDESLY_ADAPTER_PLUGIN_MISC_PATH', plugin_dir_path(__FILE__) . 'includes/misc/');
Expand Down

0 comments on commit ccbea50

Please sign in to comment.