admin
1 year ago
components
1 year ago
data
1 year ago
elementor
1 year ago
gutenberg
1 year ago
library
1 year ago
tours
1 year ago
class-config.php
1 year ago
class-plugin.php
1 year ago
class-plugin.php
70 lines
| 1 | <?php |
| 2 | |
| 3 | namespace SuperbAddons; |
| 4 | |
| 5 | defined('ABSPATH') || exit(); |
| 6 | |
| 7 | use Exception; |
| 8 | use SuperbAddons\Admin\Controllers\AdminNoticeController; |
| 9 | use SuperbAddons\Elementor\Controllers\ElementorController; |
| 10 | use SuperbAddons\Admin\Controllers\DashboardController; |
| 11 | use SuperbAddons\Admin\Controllers\NewsletterSignupController; |
| 12 | use SuperbAddons\Admin\Controllers\Wizard\WizardController; |
| 13 | use SuperbAddons\Admin\Controllers\Wizard\WizardRestorationPointController; |
| 14 | use SuperbAddons\Data\Controllers\CSSController; |
| 15 | use SuperbAddons\Data\Controllers\LogController; |
| 16 | use SuperbAddons\Data\Controllers\RestController; |
| 17 | use SuperbAddons\Gutenberg\Controllers\GutenbergController; |
| 18 | use SuperbAddons\Library\Controllers\LibraryRequestController; |
| 19 | use SuperbAddons\Tours\Controllers\TourController; |
| 20 | |
| 21 | class SuperbAddonsPlugin |
| 22 | { |
| 23 | private static $instance; |
| 24 | |
| 25 | public static function GetInstance() |
| 26 | { |
| 27 | if (!isset(self::$instance)) { |
| 28 | self::$instance = new self(); |
| 29 | } |
| 30 | return self::$instance; |
| 31 | } |
| 32 | |
| 33 | public function __construct() |
| 34 | { |
| 35 | register_activation_hook(SUPERBADDONS_BASE_PATH, array($this, 'ActivationHookFunction')); |
| 36 | register_deactivation_hook(SUPERBADDONS_BASE_PATH, array($this, 'DeactivationHookFunction')); |
| 37 | new DashboardController(); |
| 38 | new GutenbergController(); |
| 39 | new ElementorController(); |
| 40 | new LibraryRequestController(); |
| 41 | new TourController(); |
| 42 | new CSSController(); |
| 43 | LogController::AddCronAction(); |
| 44 | RestController::RegisterRoutes(); |
| 45 | } |
| 46 | |
| 47 | public function ActivationHookFunction() |
| 48 | { |
| 49 | try { |
| 50 | add_option('superbaddons_pre_activation', time(), false); |
| 51 | WizardController::MaybeSetWizardRecommenderTransient(); |
| 52 | } catch (Exception $e) { |
| 53 | LogController::HandleException($e); |
| 54 | } |
| 55 | } |
| 56 | |
| 57 | public function DeactivationHookFunction() |
| 58 | { |
| 59 | try { |
| 60 | LogController::MaybeUnsubscribeCron(); |
| 61 | WizardRestorationPointController::MaybeUnsubscribeCron(); |
| 62 | AdminNoticeController::Cleanup(); |
| 63 | NewsletterSignupController::Cleanup(); |
| 64 | } catch (Exception $e) { |
| 65 | // Make sure deactivation succeeds |
| 66 | LogController::HandleException($e); |
| 67 | } |
| 68 | } |
| 69 | } |
| 70 |