← All changes
|
backend/src/Services/Integrations/PluginInstaller.php
+18
-0
1.1.1
→
1.5
View file →
| @@ -59,8 +59,26 @@ | ||
| 59 | 59 | return file_exists(WP_PLUGIN_DIR . '/' . $pluginFile); |
| 60 | 60 | } |
| 61 | 61 | |
| 62 | 62 | /** |
| 63 | + * Check if plugin is active | |
| 64 | + * | |
| 65 | + * @param string $pluginSlug | |
| 66 | + * | |
| 67 | + * @return bool | |
| 68 | + */ | |
| 69 | + public function isPluginActive(string $pluginSlug): bool | |
| 70 | + { | |
| 71 | + if (!function_exists('is_plugin_active')) { | |
| 72 | + require_once ABSPATH . 'wp-admin/includes/plugin.php'; | |
| 73 | + } | |
| 74 | + | |
| 75 | + $pluginFile = self::getPluginFile($pluginSlug); | |
| 76 | + | |
| 77 | + return $pluginFile !== null && is_plugin_active($pluginFile); | |
| 78 | + } | |
| 79 | + | |
| 80 | + /** | |
| 63 | 81 | * Activate a plugin |
| 64 | 82 | * |
| 65 | 83 | * @param string $pluginFile |
| 66 | 84 | * |