This repository was archived by the owner on Mar 17, 2022. It is now read-only.
File tree 2 files changed +3
-35
lines changed
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()
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
-
115
111
/* 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 ' )) {
128
113
if (isset ($ GLOBALS ['polylang ' ], \PLL ()->model , PLL ()->links_model )) {
129
114
if (pll_default_language ()) {
130
115
$ polylang = true ;
@@ -133,11 +118,7 @@ public static function canActivate()
133
118
}
134
119
135
120
/* 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 ' )) {
141
122
$ woocommerce = true ;
142
123
}
143
124
Original file line number Diff line number Diff line change @@ -226,20 +226,7 @@ public static function woocommerceVersionCheck($version)
226
226
*/
227
227
public static function polylangVersionCheck ($ version )
228
228
{
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 , '>= ' )) {
243
230
return true ;
244
231
}
245
232
You can’t perform that action at this time.
0 commit comments