| @@ -1,13 +1,8 @@ | ||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | 3 | namespace IvyForms\Services\API; |
| 4 | 4 | |
| 5 | -// phpcs:disable PSR1.Files.SideEffects | |
| 6 | -if (!defined('ABSPATH')) { | |
| 7 | - exit; // Exit if accessed directly | |
| 8 | -} | |
| 9 | - | |
| 10 | 5 | use Exception; |
| 11 | 6 | use IvyForms\Factory\Form\FormFactory; |
| 12 | 7 | use IvyForms\Services\Confirmation\ConfirmationService; |
| 13 | 8 | use IvyForms\Services\Entry\EntryService; |
| @@ -77,8 +72,24 @@ | ||
| 77 | 72 | return is_plugin_active('ivyforms/ivyforms.php'); |
| 78 | 73 | } |
| 79 | 74 | |
| 80 | 75 | /** |
| 76 | + * Check if Pro plugin is installed and activated | |
| 77 | + * | |
| 78 | + * @return bool | |
| 79 | + */ | |
| 80 | + public static function isProPluginActive(): bool | |
| 81 | + { | |
| 82 | + // Check if Pro plugin constant is defined | |
| 83 | + if (defined('IVYFORMS_PRO_VERSION')) { | |
| 84 | + return true; | |
| 85 | + } | |
| 86 | + | |
| 87 | + // Alternative check: see if Pro plugin class exists | |
| 88 | + return class_exists('IvyFormsPro\\Plugin\\Plugin', false); | |
| 89 | + } | |
| 90 | + | |
| 91 | + /** | |
| 81 | 92 | * Get instance with error handling |
| 82 | 93 | * |
| 83 | 94 | * @return self|WP_Error Returns an instance of IvyFormsAPI or WP_Error on failure |
| 84 | 95 | */ |
| @@ -322,10 +333,8 @@ | ||
| 322 | 333 | } |
| 323 | 334 | return self::getInstance()->notificationService->getNotificationsByFormId($formId); |
| 324 | 335 | }); |
| 325 | 336 | } |
| 326 | - | |
| 327 | - | |
| 328 | 337 | /** |
| 329 | 338 | * Get all field options for a field |
| 330 | 339 | * |
| 331 | 340 | * @param int $fieldId |
| @@ -416,10 +425,8 @@ | ||
| 416 | 425 | $allForms = self::getInstance()->formService->getAllForms(); |
| 417 | 426 | return self::filterFormsWithIntegration($allForms, $integration); |
| 418 | 427 | }); |
| 419 | 428 | } |
| 420 | - | |
| 421 | - | |
| 422 | 429 | /** |
| 423 | 430 | * Check if a specific form has an integration enabled |
| 424 | 431 | * |
| 425 | 432 | * @param int $formId |