@@ -108,15 +108,21 @@ public static function canActivate()
108
108
$ polylang = false ;
109
109
$ woocommerce = false ;
110
110
111
+ $ polylang_file = 'polylang/polylang.php ' ;
112
+ $ polylang_pro_file = 'polylang-pro/polylang.php ' ;
113
+ $ woocommerce_file = 'woocommerce/woocommerce.php ' ;
114
+
111
115
/* check polylang plugin */
112
116
if (
113
117
(
114
- is_plugin_active ('polylang/polylang.php ' ) ||
115
- is_plugin_active ('polylang-pro/polylang.php ' )
118
+ is_plugin_active ($ polylang_file ) ||
119
+ self ::isMuPlugin ($ polylang_file ) ||
120
+ is_plugin_active ($ polylang_pro_file ) ||
121
+ self ::isMuPlugin ($ polylang_pro_file )
116
122
) ||
117
123
(
118
- is_plugin_active_for_network (' polylang/polylang.php ' ) ||
119
- is_plugin_active_for_network (' polylang-pro/polylang.php ' )
124
+ is_plugin_active_for_network ($ polylang_file ) ||
125
+ is_plugin_active_for_network ($ polylang_pro_file )
120
126
)
121
127
) {
122
128
if (isset ($ GLOBALS ['polylang ' ], \PLL ()->model , PLL ()->links_model )) {
@@ -128,8 +134,9 @@ public static function canActivate()
128
134
129
135
/* check woocommerce plugin */
130
136
if (
131
- is_plugin_active ('woocommerce/woocommerce.php ' ) ||
132
- is_plugin_active_for_network ('woocommerce/woocommerce.php ' )
137
+ is_plugin_active ($ woocommerce_file ) ||
138
+ self ::isMuPlugin ($ woocommerce_file ) ||
139
+ is_plugin_active_for_network ($ woocommerce_file )
133
140
) {
134
141
$ woocommerce = true ;
135
142
}
@@ -139,6 +146,17 @@ public static function canActivate()
139
146
($ woocommerce && Utilities::woocommerceVersionCheck (self ::WOOCOMMERCE_VERSION ));
140
147
}
141
148
149
+ /**
150
+ * Check if Mu-plugin
151
+ *
152
+ * @param string $plugin
153
+ * @return boolean
154
+ */
155
+ public static function isMuPlugin ($ plugin )
156
+ {
157
+ return file_exists ( trailingslashit ( WPMU_PLUGIN_DIR ) . $ plugin ) ;
158
+ }
159
+
142
160
/**
143
161
* On Upgrade
144
162
*
0 commit comments