PluginProbe ʕ •ᴥ•ʔ
Superb Addons: Blocks, Patterns, Pre-built Pages, Sliders, Popups, Free Forms, Animations & More / 3.2.4
Superb Addons: Blocks, Patterns, Pre-built Pages, Sliders, Popups, Free Forms, Animations & More v3.2.4
4.0.6 4.0.5 4.0.4 4.0.3 4.0.2 4.0.1 4.0.0 trunk 1.0.0 2.0.0 2.0.1 2.0.2 2.0.3 3.0 3.0.1 3.0.2 3.0.5 3.0.6 3.0.7 3.0.8 3.0.9 3.1.0 3.1.2 3.1.3 3.2.0 3.2.1 3.2.2 3.2.4 3.2.5 3.2.7 3.2.8 3.2.9 3.3.0 3.3.1 3.3.2 3.4.0 3.4.1 3.4.2 3.4.5 3.4.6 3.5.0 3.5.1 3.5.2 3.5.3 3.5.4 3.5.6 3.5.7 3.5.8 3.5.9 3.6.0 3.6.1 3.6.2 3.7.0 3.7.1
superb-blocks / src / class-plugin.php
superb-blocks / src Last commit date
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
205 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 add_filter('wp_theme_json_data_default', array($this, 'UpdateThemeJsonDefaults'));
43 }
44
45 public function UpdateThemeJsonDefaults($theme_json)
46 {
47 $defaults = array(
48 'version' => '2',
49 'settings' => array(
50 "appearanceTools" => true,
51 "spacing" => [
52 "spacingScale" => [
53 "steps" => 0
54 ],
55 "spacingSizes" => [
56 [
57 "name" => "xxSmall",
58 "size" => "clamp(5px, 1vw, 10px)",
59 "slug" => "superbspacing-xxsmall"
60 ],
61 [
62 "name" => "xSmall",
63 "size" => "clamp(10px, 2vw, 20px)",
64 "slug" => "superbspacing-xsmall"
65 ],
66 [
67 "name" => "Small",
68 "size" => "clamp(20px, 4vw, 40px)",
69 "slug" => "superbspacing-small"
70 ],
71 [
72 "name" => "Medium",
73 "size" => "clamp(30px, 6vw, 60px)",
74 "slug" => "superbspacing-medium"
75 ],
76 [
77 "name" => "Large",
78 "size" => "clamp(40px, 8vw, 80px)",
79 "slug" => "superbspacing-large"
80 ],
81 [
82 "name" => "xLarge",
83 "size" => "clamp(50px, 10vw, 100px)",
84 "slug" => "superbspacing-xlarge"
85 ],
86 [
87 "name" => "xxLarge",
88 "size" => "clamp(60px, 12vw, 120px)",
89 "slug" => "superbspacing-xxlarge"
90 ]
91 ],
92 "units" => [
93 "%",
94 "px",
95 "em",
96 "rem",
97 "vh",
98 "vw"
99 ]
100 ],
101 "typography" => [
102 "dropCap" => false,
103 "fluid" => true,
104 "fontSizes" => [
105 [
106 "name" => "Tiny",
107 "slug" => "superbfont-tiny",
108 "size" => "12px",
109 "fluid" => [
110 "min" => "10px",
111 "max" => "12px"
112 ]
113 ],
114 [
115 "name" => "xxSmall",
116 "slug" => "superbfont-xxsmall",
117 "size" => "14px",
118 "fluid" => [
119 "min" => "12px",
120 "max" => "14px"
121 ]
122 ],
123 [
124 "name" => "xSmall",
125 "slug" => "superbfont-xsmall",
126 "size" => "16px",
127 "fluid" => [
128 "min" => "14px",
129 "max" => "16px"
130 ]
131 ],
132 [
133 "name" => "Small",
134 "slug" => "superbfont-small",
135 "size" => "18px",
136 "fluid" => [
137 "min" => "14px",
138 "max" => "18px"
139 ]
140 ],
141 [
142 "name" => "Medium",
143 "slug" => "superbfont-medium",
144 "size" => "24px",
145 "fluid" => [
146 "min" => "20px",
147 "max" => "24px"
148 ]
149 ],
150 [
151 "name" => "Large",
152 "slug" => "superbfont-large",
153 "size" => "32px",
154 "fluid" => [
155 "min" => "24px",
156 "max" => "32px"
157 ]
158 ],
159 [
160 "name" => "xLarge",
161 "slug" => "superbfont-xlarge",
162 "size" => "48px",
163 "fluid" => [
164 "min" => "36px",
165 "max" => "48px"
166 ]
167 ],
168 [
169 "name" => "xxLarge",
170 "slug" => "superbfont-xxlarge",
171 "size" => "54px",
172 "fluid" => [
173 "min" => "40px",
174 "max" => "54px"
175 ]
176 ]
177 ]
178 ]
179 ),
180 );
181
182 return $theme_json->update_with($defaults);
183 }
184
185 public function ActivationHookFunction()
186 {
187 try {
188 add_option('superbaddons_pre_activation', time(), false);
189 } catch (Exception $e) {
190 LogController::HandleException($e);
191 }
192 }
193
194 public function DeactivationHookFunction()
195 {
196 try {
197 LogController::MaybeUnsubscribeCron();
198 AdminNoticeController::Cleanup();
199 } catch (Exception $e) {
200 // Make sure deactivation succeeds
201 LogController::HandleException($e);
202 }
203 }
204 }
205