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