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