This repository was archived by the owner on Mar 17, 2022. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +3
-35
lines changed
Expand file tree Collapse file tree 2 files changed +3
-35
lines changed Original file line number Diff line number Diff line change @@ -108,23 +108,8 @@ public static function canActivate()
108108 $ polylang = false ;
109109 $ woocommerce = false ;
110110
111- $ polylang_file = 'polylang/polylang.php ' ;
112- $ polylang_pro_file = 'polylang-pro/polylang.php ' ;
113- $ woocommerce_file = 'woocommerce/woocommerce.php ' ;
114-
115111 /* check polylang plugin */
116- if (
117- (
118- is_plugin_active ($ polylang_file ) ||
119- self ::isMuPlugin ($ polylang_file ) ||
120- is_plugin_active ($ polylang_pro_file ) ||
121- self ::isMuPlugin ($ polylang_pro_file )
122- ) ||
123- (
124- is_plugin_active_for_network ($ polylang_file ) ||
125- is_plugin_active_for_network ($ polylang_pro_file )
126- )
127- ) {
112+ if (class_exists ('Polylang ' )) {
128113 if (isset ($ GLOBALS ['polylang ' ], \PLL ()->model , PLL ()->links_model )) {
129114 if (pll_default_language ()) {
130115 $ polylang = true ;
@@ -133,11 +118,7 @@ public static function canActivate()
133118 }
134119
135120 /* check woocommerce plugin */
136- if (
137- is_plugin_active ($ woocommerce_file ) ||
138- self ::isMuPlugin ($ woocommerce_file ) ||
139- is_plugin_active_for_network ($ woocommerce_file )
140- ) {
121+ if (class_exists ('WooCommerce ' )) {
141122 $ woocommerce = true ;
142123 }
143124
Original file line number Diff line number Diff line change @@ -226,20 +226,7 @@ public static function woocommerceVersionCheck($version)
226226 */
227227 public static function polylangVersionCheck ($ version )
228228 {
229- if (!function_exists ('get_plugin_data ' )) {
230- require_once ABSPATH . 'wp-admin/includes/plugin.php ' ;
231- }
232-
233- $ filepath = ABSPATH . 'wp-content/plugins/polylang/polylang.php ' ;
234- if (! file_exists ($ filepath )) {
235- $ filepath = ABSPATH . 'wp-content/plugins/polylang-pro/polylang.php ' ;
236- if (! file_exists ($ filepath )) {
237- error_log ('Polylang version not tested - polylang file not found ' );
238- return true ;
239- }
240- }
241- $ data = get_plugin_data ($ filepath , false , false );
242- if (version_compare ($ data ['Version ' ], $ version , '>= ' )) {
229+ if (defined ('POLYLANG_VERSION ' ) && version_compare (POLYLANG_VERSION , $ version , '>= ' )) {
243230 return true ;
244231 }
245232
You can’t perform that action at this time.
0 commit comments