| @@ -10,11 +10,11 @@ | ||
| 10 | 10 | */ |
| 11 | 11 | declare (strict_types=1); |
| 12 | 12 | namespace WindPress\WindPress\Utils; |
| 13 | 13 | |
| 14 | -use WindPressDeps\EDD_SL\PluginUpdater; | |
| 15 | 14 | use Exception; |
| 16 | 15 | use WIND_PRESS; |
| 16 | +use WindPress\WindPress\Plugin; | |
| 17 | 17 | /** |
| 18 | 18 | * Common utility functions for the plugin. |
| 19 | 19 | * |
| 20 | 20 | * @since 3.0.0 |
| @@ -68,9 +68,14 @@ | ||
| 68 | 68 | return $key ? $plugin_data[$key] : $plugin_data; |
| 69 | 69 | } |
| 70 | 70 | public static function is_updater_library_available(): bool |
| 71 | 71 | { |
| 72 | - return class_exists(PluginUpdater::class); | |
| 72 | + if (method_exists(Plugin::class, 'is_pro_edition')) { | |
| 73 | + return Plugin::is_pro_edition(); | |
| 74 | + } | |
| 75 | + // WordPress can run the old Plugin class against the newly installed files during an upgrade. | |
| 76 | + $plugin_directory = dirname(WIND_PRESS::FILE); | |
| 77 | + return is_file($plugin_directory . '/vendor/easy-digital-downloads/edd-sl-sdk/edd-sl-sdk.php') || is_file($plugin_directory . '/vendor/rosua/edd-sl-plugin-updater/src/PluginUpdater.php'); | |
| 73 | 78 | } |
| 74 | 79 | public static function random_slug(int $length = 21): string |
| 75 | 80 | { |
| 76 | 81 | return (new \WindPressDeps\Hidehalo\Nanoid\Client())->generateId($length, \WindPressDeps\Hidehalo\Nanoid\Client::MODE_DYNAMIC); |