@@ -11,438 +11,438 @@ |
||
11 | 11 | |
12 | 12 | class AdminNotification implements RequiresCapCheckInterface |
13 | 13 | { |
14 | - const STATUS_OPEN = 'status-open'; |
|
15 | - |
|
16 | - const STATUS_CLOSED = 'status-closed'; |
|
17 | - |
|
18 | - const STATUS_DISMISSED = 'status-dismissed'; |
|
19 | - |
|
20 | - const STATUS_VIEWED = 'status-viewed'; |
|
21 | - |
|
22 | - const TYPE_CUSTOM = 'notice-custom'; |
|
23 | - |
|
24 | - const TYPE_ERROR = 'notice-error'; |
|
25 | - |
|
26 | - const TYPE_INFO = 'notice-info'; |
|
27 | - |
|
28 | - const TYPE_SUCCESS = 'notice-success'; |
|
29 | - |
|
30 | - const TYPE_WARNING = 'notice-warning'; |
|
31 | - |
|
32 | - |
|
33 | - /** |
|
34 | - * @var array |
|
35 | - */ |
|
36 | - protected $allowed_tags = []; |
|
37 | - |
|
38 | - /** |
|
39 | - * @var CapCheckInterface |
|
40 | - */ |
|
41 | - protected $cap_check; |
|
42 | - |
|
43 | - /** |
|
44 | - * @var string |
|
45 | - */ |
|
46 | - protected $capability = ''; |
|
47 | - |
|
48 | - /** |
|
49 | - * @var string |
|
50 | - */ |
|
51 | - protected $cap_context = ''; |
|
52 | - |
|
53 | - /** |
|
54 | - * @var array |
|
55 | - */ |
|
56 | - protected $css_classes = []; |
|
57 | - |
|
58 | - /** |
|
59 | - * @var string |
|
60 | - */ |
|
61 | - protected $identifier = ''; |
|
62 | - |
|
63 | - /** |
|
64 | - * @var bool |
|
65 | - */ |
|
66 | - protected $is_dismissible = false; |
|
67 | - |
|
68 | - /** |
|
69 | - * @var string |
|
70 | - */ |
|
71 | - protected $message = ''; |
|
72 | - |
|
73 | - /** |
|
74 | - * @var string |
|
75 | - */ |
|
76 | - protected $role = ''; |
|
77 | - |
|
78 | - /** |
|
79 | - * @var string |
|
80 | - */ |
|
81 | - protected $status = ''; |
|
82 | - |
|
83 | - /** |
|
84 | - * @var array |
|
85 | - */ |
|
86 | - protected $valid_statuses = []; |
|
87 | - |
|
88 | - /** |
|
89 | - * @var string |
|
90 | - */ |
|
91 | - protected $type; |
|
92 | - |
|
93 | - /** |
|
94 | - * @var array |
|
95 | - */ |
|
96 | - protected $valid_types = [ |
|
97 | - AdminNotification::TYPE_CUSTOM, |
|
98 | - AdminNotification::TYPE_ERROR, |
|
99 | - AdminNotification::TYPE_INFO, |
|
100 | - AdminNotification::TYPE_SUCCESS, |
|
101 | - AdminNotification::TYPE_WARNING, |
|
102 | - ]; |
|
103 | - |
|
104 | - |
|
105 | - /** |
|
106 | - * PersistentAdminNotice constructor |
|
107 | - * |
|
108 | - * @param string $identifier [required] the name, or key of the Admin Notice |
|
109 | - * @param string $message [required] the message to be displayed to users |
|
110 | - * @param string $type whether notice is an error, info, success, or warning |
|
111 | - * @param bool $autoload whether to automatically hook into "admin_notices" to display notice |
|
112 | - * @param array|null $allowed_tags tags & attributes passed to wp_kses for sanitizing notice content |
|
113 | - */ |
|
114 | - public function __construct( |
|
115 | - string $identifier, |
|
116 | - string $message, |
|
117 | - string $type = AdminNotification::TYPE_INFO, |
|
118 | - bool $autoload = true, |
|
119 | - ?array $allowed_tags = [] |
|
120 | - ) { |
|
121 | - $this->identifier = sanitize_key($identifier); |
|
122 | - $this->setType($type); |
|
123 | - $this->setMessage($message); |
|
124 | - $this->setAllowedTags($allowed_tags); |
|
125 | - if ($autoload) { |
|
126 | - add_action('admin_notices', [$this, 'displayNotification']); |
|
127 | - } |
|
128 | - } |
|
129 | - |
|
130 | - |
|
131 | - /** |
|
132 | - * user capability required to view this notice |
|
133 | - * |
|
134 | - * @return string |
|
135 | - */ |
|
136 | - public function capability(): string |
|
137 | - { |
|
138 | - return $this->capability; |
|
139 | - } |
|
140 | - |
|
141 | - |
|
142 | - /** |
|
143 | - * description for why the cap check is being performed |
|
144 | - * |
|
145 | - * @return string |
|
146 | - */ |
|
147 | - public function capContext(): string |
|
148 | - { |
|
149 | - return $this->cap_context; |
|
150 | - } |
|
151 | - |
|
152 | - |
|
153 | - /** |
|
154 | - * @return array |
|
155 | - */ |
|
156 | - public function cssClasses(): array |
|
157 | - { |
|
158 | - return $this->css_classes; |
|
159 | - } |
|
160 | - |
|
161 | - |
|
162 | - /** |
|
163 | - * @return string |
|
164 | - */ |
|
165 | - public function cssClassString(): string |
|
166 | - { |
|
167 | - return implode(' ', $this->css_classes); |
|
168 | - } |
|
169 | - |
|
170 | - |
|
171 | - /** |
|
172 | - * @return CapCheckInterface |
|
173 | - */ |
|
174 | - public function getCapCheck(): CapCheckInterface |
|
175 | - { |
|
176 | - if (! $this->cap_check instanceof CapCheckInterface) { |
|
177 | - $this->setCapCheck( |
|
178 | - new CapCheck($this->capability, $this->cap_context) |
|
179 | - ); |
|
180 | - } |
|
181 | - return $this->cap_check; |
|
182 | - } |
|
183 | - |
|
184 | - |
|
185 | - public function displayNotification($return = false): string |
|
186 | - { |
|
187 | - $id = esc_attr($this->identifier); |
|
188 | - $class = esc_attr($this->cssClassString()); |
|
189 | - $notification = "<div id='$id' class='$class'>$this->message</div>"; |
|
190 | - if ($return) { |
|
191 | - return $notification; |
|
192 | - } |
|
193 | - echo wp_kses($notification, $this->allowed_tags); |
|
194 | - return ''; |
|
195 | - } |
|
196 | - |
|
197 | - |
|
198 | - /** |
|
199 | - * name/identifier for notice |
|
200 | - * |
|
201 | - * @return string |
|
202 | - */ |
|
203 | - public function identifier(): string |
|
204 | - { |
|
205 | - return $this->identifier; |
|
206 | - } |
|
207 | - |
|
208 | - |
|
209 | - /** |
|
210 | - * @return bool |
|
211 | - */ |
|
212 | - public function isDismissible(): bool |
|
213 | - { |
|
214 | - return $this->is_dismissible; |
|
215 | - } |
|
216 | - |
|
217 | - |
|
218 | - /** |
|
219 | - * the actual content displayed to the user |
|
220 | - * |
|
221 | - * @return string |
|
222 | - */ |
|
223 | - public function message(): string |
|
224 | - { |
|
225 | - return $this->message; |
|
226 | - } |
|
227 | - |
|
228 | - |
|
229 | - /** |
|
230 | - * notice will only displayed to users with this role |
|
231 | - * |
|
232 | - * @return string |
|
233 | - */ |
|
234 | - public function role(): string |
|
235 | - { |
|
236 | - return $this->role; |
|
237 | - } |
|
238 | - |
|
239 | - |
|
240 | - /** |
|
241 | - * whether notice is open/dismissed/viewed/etc one of the AdminNotification::STATUS_* constants |
|
242 | - * |
|
243 | - * @return string |
|
244 | - */ |
|
245 | - public function status(): string |
|
246 | - { |
|
247 | - return $this->status; |
|
248 | - } |
|
249 | - |
|
250 | - |
|
251 | - /** |
|
252 | - * array of valid notification status options (AdminNotification::STATUS_* constants) |
|
253 | - * |
|
254 | - * @return array|string[] |
|
255 | - */ |
|
256 | - public function validStatuses(): array |
|
257 | - { |
|
258 | - return $this->valid_statuses; |
|
259 | - } |
|
260 | - |
|
261 | - |
|
262 | - /** |
|
263 | - * array of valid notification types (AdminNotification::TYPE_* constants) |
|
264 | - * |
|
265 | - * @return array|string[] |
|
266 | - */ |
|
267 | - public function validTypes(): array |
|
268 | - { |
|
269 | - return $this->valid_types; |
|
270 | - } |
|
271 | - |
|
272 | - |
|
273 | - /** |
|
274 | - * @param array $allowed_tags |
|
275 | - */ |
|
276 | - public function setAllowedTags(array $allowed_tags = []): void |
|
277 | - { |
|
278 | - $this->allowed_tags = ! empty($allowed_tags) ? $allowed_tags : AllowedTags::getWithFullTags(); |
|
279 | - } |
|
280 | - |
|
281 | - |
|
282 | - /** |
|
283 | - * @param string|null $capability user capability required to view this notice [default] 'manage_options' |
|
284 | - */ |
|
285 | - protected function setCapability(?string $capability = 'manage_options') |
|
286 | - { |
|
287 | - $this->capability = sanitize_key($capability); |
|
288 | - } |
|
289 | - |
|
290 | - |
|
291 | - /** |
|
292 | - * @param CapCheckInterface|null $cap_check |
|
293 | - */ |
|
294 | - protected function setCapCheck(?CapCheckInterface $cap_check = null) |
|
295 | - { |
|
296 | - $this->cap_check = $cap_check; |
|
297 | - } |
|
298 | - |
|
299 | - |
|
300 | - /** |
|
301 | - * @param string $cap_context description for why the cap check is being performed |
|
302 | - */ |
|
303 | - protected function setCapContext(string $cap_context = 'view admin notice') |
|
304 | - { |
|
305 | - $this->cap_context = sanitize_text_field($cap_context); |
|
306 | - } |
|
307 | - |
|
308 | - |
|
309 | - /** |
|
310 | - * @param string $css_class |
|
311 | - * @param bool $remove_duplicates |
|
312 | - */ |
|
313 | - public function addCssClass(string $css_class, bool $remove_duplicates = true): void |
|
314 | - { |
|
315 | - $this->css_classes[] = sanitize_key($css_class); |
|
316 | - if ($remove_duplicates) { |
|
317 | - $this->removeDuplicateCssClasses(); |
|
318 | - } |
|
319 | - } |
|
320 | - |
|
321 | - |
|
322 | - /** |
|
323 | - * @param array $css_classes |
|
324 | - */ |
|
325 | - public function addCssClasses(array $css_classes): void |
|
326 | - { |
|
327 | - foreach ($css_classes as $css_class) { |
|
328 | - $this->addCssClass($css_class, false); |
|
329 | - } |
|
330 | - $this->removeDuplicateCssClasses(); |
|
331 | - } |
|
332 | - |
|
333 | - |
|
334 | - /** |
|
335 | - * @return void |
|
336 | - */ |
|
337 | - public function removeDuplicateCssClasses(): void |
|
338 | - { |
|
339 | - $this->css_classes = array_unique($this->css_classes, SORT_STRING); |
|
340 | - } |
|
341 | - |
|
342 | - |
|
343 | - /** |
|
344 | - * @param string $css_class |
|
345 | - */ |
|
346 | - public function removeCssClass(string $css_class): void |
|
347 | - { |
|
348 | - $this->css_classes = array_filter( |
|
349 | - $this->css_classes, |
|
350 | - function ($existing_class) use ($css_class) { |
|
351 | - return $existing_class !== $css_class; |
|
352 | - } |
|
353 | - ); |
|
354 | - } |
|
355 | - |
|
356 | - |
|
357 | - /** |
|
358 | - * @param bool $is_dismissible |
|
359 | - */ |
|
360 | - public function setIsDismissible(bool $is_dismissible = false): void |
|
361 | - { |
|
362 | - $this->is_dismissible = filter_var($is_dismissible, FILTER_VALIDATE_BOOLEAN); |
|
363 | - if ($this->is_dismissible) { |
|
364 | - $this->addCssClass('is-dismissible'); |
|
365 | - } else { |
|
366 | - $this->removeCssClass('is-dismissible'); |
|
367 | - } |
|
368 | - } |
|
369 | - |
|
370 | - |
|
371 | - /** |
|
372 | - * @param string $message the actual content displayed to the user |
|
373 | - */ |
|
374 | - protected function setMessage(string $message) |
|
375 | - { |
|
376 | - $this->message = $message; |
|
377 | - } |
|
378 | - |
|
379 | - |
|
380 | - /** |
|
381 | - * @param string $role notice will only displayed to users with this role |
|
382 | - */ |
|
383 | - protected function setRole(string $role): void |
|
384 | - { |
|
385 | - $this->role = $role; |
|
386 | - } |
|
387 | - |
|
388 | - |
|
389 | - /** |
|
390 | - * @param string $status whether notice is open/dismissed/viewed/etc |
|
391 | - */ |
|
392 | - protected function setStatus(string $status): void |
|
393 | - { |
|
394 | - if (! in_array($status, $this->valid_statuses, true)) { |
|
395 | - throw new InvalidStatusException($status, esc_html__('AdminNotification', 'event_espresso')); |
|
396 | - } |
|
397 | - $this->status = $status; |
|
398 | - } |
|
399 | - |
|
400 | - |
|
401 | - /** |
|
402 | - * @param string $type whether notice is an error, info, success, or warning (AdminNotification::TYPE_* constants) |
|
403 | - */ |
|
404 | - protected function setType(string $type): void |
|
405 | - { |
|
406 | - if (! in_array($type, $this->valid_types, true)) { |
|
407 | - throw new DomainException( |
|
408 | - sprintf( |
|
409 | - esc_html__( |
|
410 | - 'Invalid or missing admin notification type (%1$s). Please use one of the AdminNotification::TYPE_* constants.', |
|
411 | - 'event_espresso' |
|
412 | - ), |
|
413 | - $type |
|
414 | - ) |
|
415 | - ); |
|
416 | - } |
|
417 | - $this->type = $type; |
|
418 | - // remove existing type class from notice before adding new one |
|
419 | - foreach ($this->valid_types as $valid_type) { |
|
420 | - $this->removeCssClass($valid_type); |
|
421 | - } |
|
422 | - if ($this->type === AdminNotification::TYPE_CUSTOM) { |
|
423 | - $this->addCssClass('espresso-admin-notice'); |
|
424 | - } else { |
|
425 | - $this->addCssClass($type); |
|
426 | - $this->removeCssClass('espresso-admin-notice'); |
|
427 | - $this->addCssClass('notice'); |
|
428 | - } |
|
429 | - } |
|
430 | - |
|
431 | - |
|
432 | - /** |
|
433 | - * @param array $valid_statuses array of valid notification status options (AdminNotification::STATUS_* constants) |
|
434 | - */ |
|
435 | - protected function setValidStatuses(array $valid_statuses): void |
|
436 | - { |
|
437 | - $this->valid_statuses = $valid_statuses; |
|
438 | - } |
|
439 | - |
|
440 | - |
|
441 | - /** |
|
442 | - * @param array $valid_types array of valid notification types (AdminNotification::TYPE_* constants) |
|
443 | - */ |
|
444 | - protected function setValidTypes(array $valid_types): void |
|
445 | - { |
|
446 | - $this->valid_types = $valid_types; |
|
447 | - } |
|
14 | + const STATUS_OPEN = 'status-open'; |
|
15 | + |
|
16 | + const STATUS_CLOSED = 'status-closed'; |
|
17 | + |
|
18 | + const STATUS_DISMISSED = 'status-dismissed'; |
|
19 | + |
|
20 | + const STATUS_VIEWED = 'status-viewed'; |
|
21 | + |
|
22 | + const TYPE_CUSTOM = 'notice-custom'; |
|
23 | + |
|
24 | + const TYPE_ERROR = 'notice-error'; |
|
25 | + |
|
26 | + const TYPE_INFO = 'notice-info'; |
|
27 | + |
|
28 | + const TYPE_SUCCESS = 'notice-success'; |
|
29 | + |
|
30 | + const TYPE_WARNING = 'notice-warning'; |
|
31 | + |
|
32 | + |
|
33 | + /** |
|
34 | + * @var array |
|
35 | + */ |
|
36 | + protected $allowed_tags = []; |
|
37 | + |
|
38 | + /** |
|
39 | + * @var CapCheckInterface |
|
40 | + */ |
|
41 | + protected $cap_check; |
|
42 | + |
|
43 | + /** |
|
44 | + * @var string |
|
45 | + */ |
|
46 | + protected $capability = ''; |
|
47 | + |
|
48 | + /** |
|
49 | + * @var string |
|
50 | + */ |
|
51 | + protected $cap_context = ''; |
|
52 | + |
|
53 | + /** |
|
54 | + * @var array |
|
55 | + */ |
|
56 | + protected $css_classes = []; |
|
57 | + |
|
58 | + /** |
|
59 | + * @var string |
|
60 | + */ |
|
61 | + protected $identifier = ''; |
|
62 | + |
|
63 | + /** |
|
64 | + * @var bool |
|
65 | + */ |
|
66 | + protected $is_dismissible = false; |
|
67 | + |
|
68 | + /** |
|
69 | + * @var string |
|
70 | + */ |
|
71 | + protected $message = ''; |
|
72 | + |
|
73 | + /** |
|
74 | + * @var string |
|
75 | + */ |
|
76 | + protected $role = ''; |
|
77 | + |
|
78 | + /** |
|
79 | + * @var string |
|
80 | + */ |
|
81 | + protected $status = ''; |
|
82 | + |
|
83 | + /** |
|
84 | + * @var array |
|
85 | + */ |
|
86 | + protected $valid_statuses = []; |
|
87 | + |
|
88 | + /** |
|
89 | + * @var string |
|
90 | + */ |
|
91 | + protected $type; |
|
92 | + |
|
93 | + /** |
|
94 | + * @var array |
|
95 | + */ |
|
96 | + protected $valid_types = [ |
|
97 | + AdminNotification::TYPE_CUSTOM, |
|
98 | + AdminNotification::TYPE_ERROR, |
|
99 | + AdminNotification::TYPE_INFO, |
|
100 | + AdminNotification::TYPE_SUCCESS, |
|
101 | + AdminNotification::TYPE_WARNING, |
|
102 | + ]; |
|
103 | + |
|
104 | + |
|
105 | + /** |
|
106 | + * PersistentAdminNotice constructor |
|
107 | + * |
|
108 | + * @param string $identifier [required] the name, or key of the Admin Notice |
|
109 | + * @param string $message [required] the message to be displayed to users |
|
110 | + * @param string $type whether notice is an error, info, success, or warning |
|
111 | + * @param bool $autoload whether to automatically hook into "admin_notices" to display notice |
|
112 | + * @param array|null $allowed_tags tags & attributes passed to wp_kses for sanitizing notice content |
|
113 | + */ |
|
114 | + public function __construct( |
|
115 | + string $identifier, |
|
116 | + string $message, |
|
117 | + string $type = AdminNotification::TYPE_INFO, |
|
118 | + bool $autoload = true, |
|
119 | + ?array $allowed_tags = [] |
|
120 | + ) { |
|
121 | + $this->identifier = sanitize_key($identifier); |
|
122 | + $this->setType($type); |
|
123 | + $this->setMessage($message); |
|
124 | + $this->setAllowedTags($allowed_tags); |
|
125 | + if ($autoload) { |
|
126 | + add_action('admin_notices', [$this, 'displayNotification']); |
|
127 | + } |
|
128 | + } |
|
129 | + |
|
130 | + |
|
131 | + /** |
|
132 | + * user capability required to view this notice |
|
133 | + * |
|
134 | + * @return string |
|
135 | + */ |
|
136 | + public function capability(): string |
|
137 | + { |
|
138 | + return $this->capability; |
|
139 | + } |
|
140 | + |
|
141 | + |
|
142 | + /** |
|
143 | + * description for why the cap check is being performed |
|
144 | + * |
|
145 | + * @return string |
|
146 | + */ |
|
147 | + public function capContext(): string |
|
148 | + { |
|
149 | + return $this->cap_context; |
|
150 | + } |
|
151 | + |
|
152 | + |
|
153 | + /** |
|
154 | + * @return array |
|
155 | + */ |
|
156 | + public function cssClasses(): array |
|
157 | + { |
|
158 | + return $this->css_classes; |
|
159 | + } |
|
160 | + |
|
161 | + |
|
162 | + /** |
|
163 | + * @return string |
|
164 | + */ |
|
165 | + public function cssClassString(): string |
|
166 | + { |
|
167 | + return implode(' ', $this->css_classes); |
|
168 | + } |
|
169 | + |
|
170 | + |
|
171 | + /** |
|
172 | + * @return CapCheckInterface |
|
173 | + */ |
|
174 | + public function getCapCheck(): CapCheckInterface |
|
175 | + { |
|
176 | + if (! $this->cap_check instanceof CapCheckInterface) { |
|
177 | + $this->setCapCheck( |
|
178 | + new CapCheck($this->capability, $this->cap_context) |
|
179 | + ); |
|
180 | + } |
|
181 | + return $this->cap_check; |
|
182 | + } |
|
183 | + |
|
184 | + |
|
185 | + public function displayNotification($return = false): string |
|
186 | + { |
|
187 | + $id = esc_attr($this->identifier); |
|
188 | + $class = esc_attr($this->cssClassString()); |
|
189 | + $notification = "<div id='$id' class='$class'>$this->message</div>"; |
|
190 | + if ($return) { |
|
191 | + return $notification; |
|
192 | + } |
|
193 | + echo wp_kses($notification, $this->allowed_tags); |
|
194 | + return ''; |
|
195 | + } |
|
196 | + |
|
197 | + |
|
198 | + /** |
|
199 | + * name/identifier for notice |
|
200 | + * |
|
201 | + * @return string |
|
202 | + */ |
|
203 | + public function identifier(): string |
|
204 | + { |
|
205 | + return $this->identifier; |
|
206 | + } |
|
207 | + |
|
208 | + |
|
209 | + /** |
|
210 | + * @return bool |
|
211 | + */ |
|
212 | + public function isDismissible(): bool |
|
213 | + { |
|
214 | + return $this->is_dismissible; |
|
215 | + } |
|
216 | + |
|
217 | + |
|
218 | + /** |
|
219 | + * the actual content displayed to the user |
|
220 | + * |
|
221 | + * @return string |
|
222 | + */ |
|
223 | + public function message(): string |
|
224 | + { |
|
225 | + return $this->message; |
|
226 | + } |
|
227 | + |
|
228 | + |
|
229 | + /** |
|
230 | + * notice will only displayed to users with this role |
|
231 | + * |
|
232 | + * @return string |
|
233 | + */ |
|
234 | + public function role(): string |
|
235 | + { |
|
236 | + return $this->role; |
|
237 | + } |
|
238 | + |
|
239 | + |
|
240 | + /** |
|
241 | + * whether notice is open/dismissed/viewed/etc one of the AdminNotification::STATUS_* constants |
|
242 | + * |
|
243 | + * @return string |
|
244 | + */ |
|
245 | + public function status(): string |
|
246 | + { |
|
247 | + return $this->status; |
|
248 | + } |
|
249 | + |
|
250 | + |
|
251 | + /** |
|
252 | + * array of valid notification status options (AdminNotification::STATUS_* constants) |
|
253 | + * |
|
254 | + * @return array|string[] |
|
255 | + */ |
|
256 | + public function validStatuses(): array |
|
257 | + { |
|
258 | + return $this->valid_statuses; |
|
259 | + } |
|
260 | + |
|
261 | + |
|
262 | + /** |
|
263 | + * array of valid notification types (AdminNotification::TYPE_* constants) |
|
264 | + * |
|
265 | + * @return array|string[] |
|
266 | + */ |
|
267 | + public function validTypes(): array |
|
268 | + { |
|
269 | + return $this->valid_types; |
|
270 | + } |
|
271 | + |
|
272 | + |
|
273 | + /** |
|
274 | + * @param array $allowed_tags |
|
275 | + */ |
|
276 | + public function setAllowedTags(array $allowed_tags = []): void |
|
277 | + { |
|
278 | + $this->allowed_tags = ! empty($allowed_tags) ? $allowed_tags : AllowedTags::getWithFullTags(); |
|
279 | + } |
|
280 | + |
|
281 | + |
|
282 | + /** |
|
283 | + * @param string|null $capability user capability required to view this notice [default] 'manage_options' |
|
284 | + */ |
|
285 | + protected function setCapability(?string $capability = 'manage_options') |
|
286 | + { |
|
287 | + $this->capability = sanitize_key($capability); |
|
288 | + } |
|
289 | + |
|
290 | + |
|
291 | + /** |
|
292 | + * @param CapCheckInterface|null $cap_check |
|
293 | + */ |
|
294 | + protected function setCapCheck(?CapCheckInterface $cap_check = null) |
|
295 | + { |
|
296 | + $this->cap_check = $cap_check; |
|
297 | + } |
|
298 | + |
|
299 | + |
|
300 | + /** |
|
301 | + * @param string $cap_context description for why the cap check is being performed |
|
302 | + */ |
|
303 | + protected function setCapContext(string $cap_context = 'view admin notice') |
|
304 | + { |
|
305 | + $this->cap_context = sanitize_text_field($cap_context); |
|
306 | + } |
|
307 | + |
|
308 | + |
|
309 | + /** |
|
310 | + * @param string $css_class |
|
311 | + * @param bool $remove_duplicates |
|
312 | + */ |
|
313 | + public function addCssClass(string $css_class, bool $remove_duplicates = true): void |
|
314 | + { |
|
315 | + $this->css_classes[] = sanitize_key($css_class); |
|
316 | + if ($remove_duplicates) { |
|
317 | + $this->removeDuplicateCssClasses(); |
|
318 | + } |
|
319 | + } |
|
320 | + |
|
321 | + |
|
322 | + /** |
|
323 | + * @param array $css_classes |
|
324 | + */ |
|
325 | + public function addCssClasses(array $css_classes): void |
|
326 | + { |
|
327 | + foreach ($css_classes as $css_class) { |
|
328 | + $this->addCssClass($css_class, false); |
|
329 | + } |
|
330 | + $this->removeDuplicateCssClasses(); |
|
331 | + } |
|
332 | + |
|
333 | + |
|
334 | + /** |
|
335 | + * @return void |
|
336 | + */ |
|
337 | + public function removeDuplicateCssClasses(): void |
|
338 | + { |
|
339 | + $this->css_classes = array_unique($this->css_classes, SORT_STRING); |
|
340 | + } |
|
341 | + |
|
342 | + |
|
343 | + /** |
|
344 | + * @param string $css_class |
|
345 | + */ |
|
346 | + public function removeCssClass(string $css_class): void |
|
347 | + { |
|
348 | + $this->css_classes = array_filter( |
|
349 | + $this->css_classes, |
|
350 | + function ($existing_class) use ($css_class) { |
|
351 | + return $existing_class !== $css_class; |
|
352 | + } |
|
353 | + ); |
|
354 | + } |
|
355 | + |
|
356 | + |
|
357 | + /** |
|
358 | + * @param bool $is_dismissible |
|
359 | + */ |
|
360 | + public function setIsDismissible(bool $is_dismissible = false): void |
|
361 | + { |
|
362 | + $this->is_dismissible = filter_var($is_dismissible, FILTER_VALIDATE_BOOLEAN); |
|
363 | + if ($this->is_dismissible) { |
|
364 | + $this->addCssClass('is-dismissible'); |
|
365 | + } else { |
|
366 | + $this->removeCssClass('is-dismissible'); |
|
367 | + } |
|
368 | + } |
|
369 | + |
|
370 | + |
|
371 | + /** |
|
372 | + * @param string $message the actual content displayed to the user |
|
373 | + */ |
|
374 | + protected function setMessage(string $message) |
|
375 | + { |
|
376 | + $this->message = $message; |
|
377 | + } |
|
378 | + |
|
379 | + |
|
380 | + /** |
|
381 | + * @param string $role notice will only displayed to users with this role |
|
382 | + */ |
|
383 | + protected function setRole(string $role): void |
|
384 | + { |
|
385 | + $this->role = $role; |
|
386 | + } |
|
387 | + |
|
388 | + |
|
389 | + /** |
|
390 | + * @param string $status whether notice is open/dismissed/viewed/etc |
|
391 | + */ |
|
392 | + protected function setStatus(string $status): void |
|
393 | + { |
|
394 | + if (! in_array($status, $this->valid_statuses, true)) { |
|
395 | + throw new InvalidStatusException($status, esc_html__('AdminNotification', 'event_espresso')); |
|
396 | + } |
|
397 | + $this->status = $status; |
|
398 | + } |
|
399 | + |
|
400 | + |
|
401 | + /** |
|
402 | + * @param string $type whether notice is an error, info, success, or warning (AdminNotification::TYPE_* constants) |
|
403 | + */ |
|
404 | + protected function setType(string $type): void |
|
405 | + { |
|
406 | + if (! in_array($type, $this->valid_types, true)) { |
|
407 | + throw new DomainException( |
|
408 | + sprintf( |
|
409 | + esc_html__( |
|
410 | + 'Invalid or missing admin notification type (%1$s). Please use one of the AdminNotification::TYPE_* constants.', |
|
411 | + 'event_espresso' |
|
412 | + ), |
|
413 | + $type |
|
414 | + ) |
|
415 | + ); |
|
416 | + } |
|
417 | + $this->type = $type; |
|
418 | + // remove existing type class from notice before adding new one |
|
419 | + foreach ($this->valid_types as $valid_type) { |
|
420 | + $this->removeCssClass($valid_type); |
|
421 | + } |
|
422 | + if ($this->type === AdminNotification::TYPE_CUSTOM) { |
|
423 | + $this->addCssClass('espresso-admin-notice'); |
|
424 | + } else { |
|
425 | + $this->addCssClass($type); |
|
426 | + $this->removeCssClass('espresso-admin-notice'); |
|
427 | + $this->addCssClass('notice'); |
|
428 | + } |
|
429 | + } |
|
430 | + |
|
431 | + |
|
432 | + /** |
|
433 | + * @param array $valid_statuses array of valid notification status options (AdminNotification::STATUS_* constants) |
|
434 | + */ |
|
435 | + protected function setValidStatuses(array $valid_statuses): void |
|
436 | + { |
|
437 | + $this->valid_statuses = $valid_statuses; |
|
438 | + } |
|
439 | + |
|
440 | + |
|
441 | + /** |
|
442 | + * @param array $valid_types array of valid notification types (AdminNotification::TYPE_* constants) |
|
443 | + */ |
|
444 | + protected function setValidTypes(array $valid_types): void |
|
445 | + { |
|
446 | + $this->valid_types = $valid_types; |
|
447 | + } |
|
448 | 448 | } |
@@ -173,7 +173,7 @@ discard block |
||
173 | 173 | */ |
174 | 174 | public function getCapCheck(): CapCheckInterface |
175 | 175 | { |
176 | - if (! $this->cap_check instanceof CapCheckInterface) { |
|
176 | + if ( ! $this->cap_check instanceof CapCheckInterface) { |
|
177 | 177 | $this->setCapCheck( |
178 | 178 | new CapCheck($this->capability, $this->cap_context) |
179 | 179 | ); |
@@ -347,7 +347,7 @@ discard block |
||
347 | 347 | { |
348 | 348 | $this->css_classes = array_filter( |
349 | 349 | $this->css_classes, |
350 | - function ($existing_class) use ($css_class) { |
|
350 | + function($existing_class) use ($css_class) { |
|
351 | 351 | return $existing_class !== $css_class; |
352 | 352 | } |
353 | 353 | ); |
@@ -391,7 +391,7 @@ discard block |
||
391 | 391 | */ |
392 | 392 | protected function setStatus(string $status): void |
393 | 393 | { |
394 | - if (! in_array($status, $this->valid_statuses, true)) { |
|
394 | + if ( ! in_array($status, $this->valid_statuses, true)) { |
|
395 | 395 | throw new InvalidStatusException($status, esc_html__('AdminNotification', 'event_espresso')); |
396 | 396 | } |
397 | 397 | $this->status = $status; |
@@ -403,7 +403,7 @@ discard block |
||
403 | 403 | */ |
404 | 404 | protected function setType(string $type): void |
405 | 405 | { |
406 | - if (! in_array($type, $this->valid_types, true)) { |
|
406 | + if ( ! in_array($type, $this->valid_types, true)) { |
|
407 | 407 | throw new DomainException( |
408 | 408 | sprintf( |
409 | 409 | esc_html__( |
@@ -6,95 +6,95 @@ discard block |
||
6 | 6 | |
7 | 7 | class DownloadPluginPrompt extends AdminNotification |
8 | 8 | { |
9 | - /** |
|
10 | - * @var string |
|
11 | - */ |
|
12 | - protected $dependency = ''; |
|
13 | - |
|
14 | - /** |
|
15 | - * @var string |
|
16 | - */ |
|
17 | - protected $heading = ''; |
|
18 | - |
|
19 | - /** |
|
20 | - * @var string |
|
21 | - */ |
|
22 | - protected $image = ''; |
|
23 | - |
|
24 | - /** |
|
25 | - * @var int |
|
26 | - */ |
|
27 | - protected $image_size = 0; |
|
28 | - |
|
29 | - /** |
|
30 | - * @var string |
|
31 | - */ |
|
32 | - protected $message = ''; |
|
33 | - |
|
34 | - /** |
|
35 | - * @var string |
|
36 | - */ |
|
37 | - protected $plugin_name = ''; |
|
38 | - |
|
39 | - /** |
|
40 | - * @var string |
|
41 | - */ |
|
42 | - protected $plugin_url = ''; |
|
43 | - |
|
44 | - |
|
45 | - /** |
|
46 | - * @param string $plugin_name [required] the name, or key of the Persistent Admin Notice to be stored |
|
47 | - * @param string $plugin_url [required] the message to be stored persistently until dismissed |
|
48 | - * @param string $dependency |
|
49 | - * @param string|null $message |
|
50 | - * @param string|null $image |
|
51 | - * @param int|null $image_size |
|
52 | - */ |
|
53 | - public function __construct( |
|
54 | - string $plugin_name, |
|
55 | - string $plugin_url, |
|
56 | - string $dependency, |
|
57 | - ?string $heading = '', |
|
58 | - ?string $message = '', |
|
59 | - ?string $image = '', |
|
60 | - ?int $image_size = 480 |
|
61 | - ) { |
|
62 | - $this->plugin_name = $plugin_name; |
|
63 | - $this->plugin_url = $plugin_url; |
|
64 | - $this->dependency = $dependency; |
|
65 | - $this->heading = $heading; |
|
66 | - $this->message = $message; |
|
67 | - $this->image = $image; |
|
68 | - $this->image_size = absint($image_size) ?? 480; |
|
69 | - $identifier = "$plugin_name-download-plugin-prompt"; |
|
70 | - parent::__construct($identifier, $this->content(), AdminNotification::TYPE_CUSTOM, false); |
|
71 | - $this->addCssClass("ee-download-plugin-prompt"); |
|
72 | - $this->setIsDismissible(true); |
|
73 | - $this->setCapability('activate_plugins'); |
|
74 | - $this->setCapContext('view download plugin prompts'); |
|
75 | - } |
|
76 | - |
|
77 | - |
|
78 | - private function content(): string |
|
79 | - { |
|
80 | - $heading = $this->heading ?? esc_html__("Don't miss out on exciting new features!", 'event_espresso'); |
|
81 | - $message = $this->message ?? sprintf( |
|
82 | - /* translators: 'Some Feature' needs the 'Plugin Name' plugin in order provide your site with the maximum functionality it can offer. */ |
|
83 | - esc_html__( |
|
84 | - '%1$s needs the %2$s plugin in order provide your site with the maximum functionality it can offer.', |
|
85 | - 'event_espresso' |
|
86 | - ), |
|
87 | - // 'Some Feature' |
|
88 | - $this->dependency, |
|
89 | - // 'Plugin Name & Link' |
|
90 | - "<a href='$this->plugin_url' target='_blank'>$this->plugin_name</a>" |
|
91 | - ); |
|
92 | - $button = sprintf( |
|
93 | - /* translators: 'Download and Activate Plugin Name */ |
|
94 | - esc_html__('Download and Activate %1$s', 'event_espresso'), |
|
95 | - $this->plugin_name |
|
96 | - ); |
|
97 | - return " |
|
9 | + /** |
|
10 | + * @var string |
|
11 | + */ |
|
12 | + protected $dependency = ''; |
|
13 | + |
|
14 | + /** |
|
15 | + * @var string |
|
16 | + */ |
|
17 | + protected $heading = ''; |
|
18 | + |
|
19 | + /** |
|
20 | + * @var string |
|
21 | + */ |
|
22 | + protected $image = ''; |
|
23 | + |
|
24 | + /** |
|
25 | + * @var int |
|
26 | + */ |
|
27 | + protected $image_size = 0; |
|
28 | + |
|
29 | + /** |
|
30 | + * @var string |
|
31 | + */ |
|
32 | + protected $message = ''; |
|
33 | + |
|
34 | + /** |
|
35 | + * @var string |
|
36 | + */ |
|
37 | + protected $plugin_name = ''; |
|
38 | + |
|
39 | + /** |
|
40 | + * @var string |
|
41 | + */ |
|
42 | + protected $plugin_url = ''; |
|
43 | + |
|
44 | + |
|
45 | + /** |
|
46 | + * @param string $plugin_name [required] the name, or key of the Persistent Admin Notice to be stored |
|
47 | + * @param string $plugin_url [required] the message to be stored persistently until dismissed |
|
48 | + * @param string $dependency |
|
49 | + * @param string|null $message |
|
50 | + * @param string|null $image |
|
51 | + * @param int|null $image_size |
|
52 | + */ |
|
53 | + public function __construct( |
|
54 | + string $plugin_name, |
|
55 | + string $plugin_url, |
|
56 | + string $dependency, |
|
57 | + ?string $heading = '', |
|
58 | + ?string $message = '', |
|
59 | + ?string $image = '', |
|
60 | + ?int $image_size = 480 |
|
61 | + ) { |
|
62 | + $this->plugin_name = $plugin_name; |
|
63 | + $this->plugin_url = $plugin_url; |
|
64 | + $this->dependency = $dependency; |
|
65 | + $this->heading = $heading; |
|
66 | + $this->message = $message; |
|
67 | + $this->image = $image; |
|
68 | + $this->image_size = absint($image_size) ?? 480; |
|
69 | + $identifier = "$plugin_name-download-plugin-prompt"; |
|
70 | + parent::__construct($identifier, $this->content(), AdminNotification::TYPE_CUSTOM, false); |
|
71 | + $this->addCssClass("ee-download-plugin-prompt"); |
|
72 | + $this->setIsDismissible(true); |
|
73 | + $this->setCapability('activate_plugins'); |
|
74 | + $this->setCapContext('view download plugin prompts'); |
|
75 | + } |
|
76 | + |
|
77 | + |
|
78 | + private function content(): string |
|
79 | + { |
|
80 | + $heading = $this->heading ?? esc_html__("Don't miss out on exciting new features!", 'event_espresso'); |
|
81 | + $message = $this->message ?? sprintf( |
|
82 | + /* translators: 'Some Feature' needs the 'Plugin Name' plugin in order provide your site with the maximum functionality it can offer. */ |
|
83 | + esc_html__( |
|
84 | + '%1$s needs the %2$s plugin in order provide your site with the maximum functionality it can offer.', |
|
85 | + 'event_espresso' |
|
86 | + ), |
|
87 | + // 'Some Feature' |
|
88 | + $this->dependency, |
|
89 | + // 'Plugin Name & Link' |
|
90 | + "<a href='$this->plugin_url' target='_blank'>$this->plugin_name</a>" |
|
91 | + ); |
|
92 | + $button = sprintf( |
|
93 | + /* translators: 'Download and Activate Plugin Name */ |
|
94 | + esc_html__('Download and Activate %1$s', 'event_espresso'), |
|
95 | + $this->plugin_name |
|
96 | + ); |
|
97 | + return " |
|
98 | 98 | <div class='ee-download-plugin-prompt__content'> |
99 | 99 | <div class='ee-download-plugin-prompt__message'> |
100 | 100 | <span class='dashicons dashicons-admin-plugins'></span> |
@@ -110,29 +110,29 @@ discard block |
||
110 | 110 | </div> |
111 | 111 | {$this->image()} |
112 | 112 | </div>"; |
113 | - } |
|
113 | + } |
|
114 | 114 | |
115 | 115 | |
116 | - private function image(): string |
|
117 | - { |
|
118 | - $image = $this->findImage(); |
|
119 | - $alt = esc_html__("download plugin prompt", 'event_espresso'); |
|
120 | - return $image ? |
|
121 | - "<div class='ee-download-plugin-prompt__image'> |
|
116 | + private function image(): string |
|
117 | + { |
|
118 | + $image = $this->findImage(); |
|
119 | + $alt = esc_html__("download plugin prompt", 'event_espresso'); |
|
120 | + return $image ? |
|
121 | + "<div class='ee-download-plugin-prompt__image'> |
|
122 | 122 | <img src='{$image}' alt='$alt' width='{$this->image_size}px'/> |
123 | 123 | </div>" |
124 | - : ''; |
|
125 | - } |
|
126 | - |
|
127 | - |
|
128 | - private function findImage(): string |
|
129 | - { |
|
130 | - // if image is already a URL then just return it |
|
131 | - if (strpos($this->image, 'http') === 0) { |
|
132 | - return $this->image; |
|
133 | - } |
|
134 | - // otherwise look in /global_assets/images/download_plugin_prompt/ |
|
135 | - $file_path = EE_TEMPLATES . "global_assets/images/download_plugin_prompt/{$this->image}"; |
|
136 | - return file_exists($file_path) ? EE_GLOBAL_ASSETS_URL . "images/download_plugin_prompt/{$this->image}" : ''; |
|
137 | - } |
|
124 | + : ''; |
|
125 | + } |
|
126 | + |
|
127 | + |
|
128 | + private function findImage(): string |
|
129 | + { |
|
130 | + // if image is already a URL then just return it |
|
131 | + if (strpos($this->image, 'http') === 0) { |
|
132 | + return $this->image; |
|
133 | + } |
|
134 | + // otherwise look in /global_assets/images/download_plugin_prompt/ |
|
135 | + $file_path = EE_TEMPLATES . "global_assets/images/download_plugin_prompt/{$this->image}"; |
|
136 | + return file_exists($file_path) ? EE_GLOBAL_ASSETS_URL . "images/download_plugin_prompt/{$this->image}" : ''; |
|
137 | + } |
|
138 | 138 | } |
@@ -89,7 +89,7 @@ discard block |
||
89 | 89 | // 'Plugin Name & Link' |
90 | 90 | "<a href='$this->plugin_url' target='_blank'>$this->plugin_name</a>" |
91 | 91 | ); |
92 | - $button = sprintf( |
|
92 | + $button = sprintf( |
|
93 | 93 | /* translators: 'Download and Activate Plugin Name */ |
94 | 94 | esc_html__('Download and Activate %1$s', 'event_espresso'), |
95 | 95 | $this->plugin_name |
@@ -132,7 +132,7 @@ discard block |
||
132 | 132 | return $this->image; |
133 | 133 | } |
134 | 134 | // otherwise look in /global_assets/images/download_plugin_prompt/ |
135 | - $file_path = EE_TEMPLATES . "global_assets/images/download_plugin_prompt/{$this->image}"; |
|
135 | + $file_path = EE_TEMPLATES."global_assets/images/download_plugin_prompt/{$this->image}"; |
|
136 | 136 | return file_exists($file_path) ? EE_GLOBAL_ASSETS_URL . "images/download_plugin_prompt/{$this->image}" : ''; |
137 | 137 | } |
138 | 138 | } |
@@ -26,1365 +26,1365 @@ |
||
26 | 26 | */ |
27 | 27 | final class EE_System implements ResettableInterface |
28 | 28 | { |
29 | - /** |
|
30 | - * indicates this is a 'normal' request. Ie, not activation, nor upgrade, nor activation. |
|
31 | - * So examples of this would be a normal GET request on the frontend or backend, or a POST, etc |
|
32 | - */ |
|
33 | - const req_type_normal = 0; |
|
34 | - |
|
35 | - /** |
|
36 | - * Indicates this is a brand new installation of EE so we should install |
|
37 | - * tables and default data etc |
|
38 | - */ |
|
39 | - const req_type_new_activation = 1; |
|
40 | - |
|
41 | - /** |
|
42 | - * we've detected that EE has been reactivated (or EE was activated during maintenance mode, |
|
43 | - * and we just exited maintenance mode). We MUST check the database is setup properly |
|
44 | - * and that default data is setup too |
|
45 | - */ |
|
46 | - const req_type_reactivation = 2; |
|
47 | - |
|
48 | - /** |
|
49 | - * indicates that EE has been upgraded since its previous request. |
|
50 | - * We may have data migration scripts to call and will want to trigger maintenance mode |
|
51 | - */ |
|
52 | - const req_type_upgrade = 3; |
|
53 | - |
|
54 | - /** |
|
55 | - * TODO will detect that EE has been DOWNGRADED. We probably don't want to run in this case... |
|
56 | - */ |
|
57 | - const req_type_downgrade = 4; |
|
58 | - |
|
59 | - /** |
|
60 | - * @deprecated since version 4.6.0.dev.006 |
|
61 | - * Now whenever a new_activation is detected the request type is still just |
|
62 | - * new_activation (same for reactivation, upgrade, downgrade etc), but if we'r ein maintenance mode |
|
63 | - * EE_System::initialize_db_if_no_migrations_required and EE_Addon::initialize_db_if_no_migrations_required |
|
64 | - * will instead enqueue that EE plugin's db initialization for when we're taken out of maintenance mode. |
|
65 | - * (Specifically, when the migration manager indicates migrations are finished |
|
66 | - * EE_Data_Migration_Manager::initialize_db_for_enqueued_ee_plugins() will be called) |
|
67 | - */ |
|
68 | - const req_type_activation_but_not_installed = 5; |
|
69 | - |
|
70 | - /** |
|
71 | - * option prefix for recording the activation history (like core's "espresso_db_update") of addons |
|
72 | - */ |
|
73 | - const addon_activation_history_option_prefix = 'ee_addon_activation_history_'; |
|
74 | - |
|
75 | - /** |
|
76 | - * @var EE_System $_instance |
|
77 | - */ |
|
78 | - private static $_instance; |
|
79 | - |
|
80 | - /** |
|
81 | - * @var EE_Registry $registry |
|
82 | - */ |
|
83 | - private $registry; |
|
84 | - |
|
85 | - /** |
|
86 | - * @var LoaderInterface $loader |
|
87 | - */ |
|
88 | - private $loader; |
|
89 | - |
|
90 | - /** |
|
91 | - * @var EE_Capabilities $capabilities |
|
92 | - */ |
|
93 | - private $capabilities; |
|
94 | - |
|
95 | - /** |
|
96 | - * @var RequestInterface $request |
|
97 | - */ |
|
98 | - private $request; |
|
99 | - |
|
100 | - /** |
|
101 | - * @var EE_Maintenance_Mode $maintenance_mode |
|
102 | - */ |
|
103 | - private $maintenance_mode; |
|
104 | - |
|
105 | - /** |
|
106 | - * Stores which type of request this is, options being one of the constants on EE_System starting with req_type_*. |
|
107 | - * It can be a brand-new activation, a reactivation, an upgrade, a downgrade, or a normal request. |
|
108 | - * |
|
109 | - * @var int $_req_type |
|
110 | - */ |
|
111 | - private $_req_type; |
|
112 | - |
|
113 | - /** |
|
114 | - * Whether or not there was a non-micro version change in EE core version during this request |
|
115 | - * |
|
116 | - * @var boolean $_major_version_change |
|
117 | - */ |
|
118 | - private $_major_version_change = false; |
|
119 | - |
|
120 | - /** |
|
121 | - * A Context DTO dedicated solely to identifying the current request type. |
|
122 | - * |
|
123 | - * @var RequestTypeContextCheckerInterface $request_type |
|
124 | - */ |
|
125 | - private $request_type; |
|
126 | - |
|
127 | - /** |
|
128 | - * @param EventEspresso\core\domain\services\custom_post_types\RegisterCustomPostTypes |
|
129 | - */ |
|
130 | - private $register_custom_post_types; |
|
131 | - |
|
132 | - /** |
|
133 | - * @param EventEspresso\core\domain\services\custom_post_types\RegisterCustomTaxonomies |
|
134 | - */ |
|
135 | - private $register_custom_taxonomies; |
|
136 | - |
|
137 | - /** |
|
138 | - * @param EventEspresso\core\domain\services\custom_post_types\RegisterCustomTaxonomyTerms |
|
139 | - */ |
|
140 | - private $register_custom_taxonomy_terms; |
|
141 | - |
|
142 | - /** |
|
143 | - * @singleton method used to instantiate class object |
|
144 | - * @param EE_Registry|null $registry |
|
145 | - * @param LoaderInterface|null $loader |
|
146 | - * @param RequestInterface|null $request |
|
147 | - * @param EE_Maintenance_Mode|null $maintenance_mode |
|
148 | - * @return EE_System |
|
149 | - */ |
|
150 | - public static function instance( |
|
151 | - EE_Registry $registry = null, |
|
152 | - LoaderInterface $loader = null, |
|
153 | - RequestInterface $request = null, |
|
154 | - EE_Maintenance_Mode $maintenance_mode = null |
|
155 | - ) { |
|
156 | - // check if class object is instantiated |
|
157 | - if (! self::$_instance instanceof EE_System) { |
|
158 | - self::$_instance = new self($registry, $loader, $request, $maintenance_mode); |
|
159 | - } |
|
160 | - return self::$_instance; |
|
161 | - } |
|
162 | - |
|
163 | - |
|
164 | - /** |
|
165 | - * resets the instance and returns it |
|
166 | - * |
|
167 | - * @return EE_System |
|
168 | - */ |
|
169 | - public static function reset() |
|
170 | - { |
|
171 | - self::$_instance->_req_type = null; |
|
172 | - // make sure none of the old hooks are left hanging around |
|
173 | - remove_all_actions('AHEE__EE_System__perform_activations_upgrades_and_migrations'); |
|
174 | - // we need to reset the migration manager in order for it to detect DMSs properly |
|
175 | - EE_Data_Migration_Manager::reset(); |
|
176 | - self::instance()->detect_activations_or_upgrades(); |
|
177 | - self::instance()->perform_activations_upgrades_and_migrations(); |
|
178 | - return self::instance(); |
|
179 | - } |
|
180 | - |
|
181 | - |
|
182 | - /** |
|
183 | - * sets hooks for running rest of system |
|
184 | - * provides "AHEE__EE_System__construct__complete" hook for EE Addons to use as their starting point |
|
185 | - * starting EE Addons from any other point may lead to problems |
|
186 | - * |
|
187 | - * @param EE_Registry $registry |
|
188 | - * @param LoaderInterface $loader |
|
189 | - * @param RequestInterface $request |
|
190 | - * @param EE_Maintenance_Mode $maintenance_mode |
|
191 | - */ |
|
192 | - private function __construct( |
|
193 | - EE_Registry $registry, |
|
194 | - LoaderInterface $loader, |
|
195 | - RequestInterface $request, |
|
196 | - EE_Maintenance_Mode $maintenance_mode |
|
197 | - ) { |
|
198 | - $this->registry = $registry; |
|
199 | - $this->loader = $loader; |
|
200 | - $this->request = $request; |
|
201 | - $this->maintenance_mode = $maintenance_mode; |
|
202 | - do_action('AHEE__EE_System__construct__begin', $this); |
|
203 | - add_action( |
|
204 | - 'AHEE__EE_Bootstrap__load_espresso_addons', |
|
205 | - array($this, 'loadCapabilities'), |
|
206 | - 5 |
|
207 | - ); |
|
208 | - add_action( |
|
209 | - 'AHEE__EE_Bootstrap__load_espresso_addons', |
|
210 | - array($this, 'loadCommandBus'), |
|
211 | - 7 |
|
212 | - ); |
|
213 | - add_action( |
|
214 | - 'AHEE__EE_Bootstrap__load_espresso_addons', |
|
215 | - array($this, 'loadPluginApi'), |
|
216 | - 9 |
|
217 | - ); |
|
218 | - // allow addons to load first so that they can register autoloaders, set hooks for running DMS's, etc |
|
219 | - add_action( |
|
220 | - 'AHEE__EE_Bootstrap__load_espresso_addons', |
|
221 | - array($this, 'load_espresso_addons') |
|
222 | - ); |
|
223 | - // when an ee addon is activated, we want to call the core hook(s) again |
|
224 | - // because the newly-activated addon didn't get a chance to run at all |
|
225 | - add_action('activate_plugin', array($this, 'load_espresso_addons'), 1); |
|
226 | - // detect whether install or upgrade |
|
227 | - add_action( |
|
228 | - 'AHEE__EE_Bootstrap__detect_activations_or_upgrades', |
|
229 | - array($this, 'detect_activations_or_upgrades'), |
|
230 | - 3 |
|
231 | - ); |
|
232 | - // load EE_Config, EE_Textdomain, etc |
|
233 | - add_action( |
|
234 | - 'AHEE__EE_Bootstrap__load_core_configuration', |
|
235 | - array($this, 'load_core_configuration'), |
|
236 | - 5 |
|
237 | - ); |
|
238 | - // load specifications for matching routes to current request |
|
239 | - add_action( |
|
240 | - 'AHEE__EE_Bootstrap__load_core_configuration', |
|
241 | - array($this, 'loadRouteMatchSpecifications') |
|
242 | - ); |
|
243 | - // load specifications for custom post types |
|
244 | - add_action( |
|
245 | - 'AHEE__EE_Bootstrap__load_core_configuration', |
|
246 | - array($this, 'loadCustomPostTypes') |
|
247 | - ); |
|
248 | - // load EE_Config, EE_Textdomain, etc |
|
249 | - add_action( |
|
250 | - 'AHEE__EE_Bootstrap__register_shortcodes_modules_and_widgets', |
|
251 | - array($this, 'register_shortcodes_modules_and_widgets'), |
|
252 | - 7 |
|
253 | - ); |
|
254 | - // you wanna get going? I wanna get going... let's get going! |
|
255 | - add_action( |
|
256 | - 'AHEE__EE_Bootstrap__brew_espresso', |
|
257 | - array($this, 'brew_espresso'), |
|
258 | - 9 |
|
259 | - ); |
|
260 | - // other housekeeping |
|
261 | - // exclude EE critical pages from wp_list_pages |
|
262 | - add_filter( |
|
263 | - 'wp_list_pages_excludes', |
|
264 | - array($this, 'remove_pages_from_wp_list_pages'), |
|
265 | - 10 |
|
266 | - ); |
|
267 | - // ALL EE Addons should use the following hook point to attach their initial setup too |
|
268 | - // it's extremely important for EE Addons to register any class autoloaders so that they can be available when the EE_Config loads |
|
269 | - do_action('AHEE__EE_System__construct__complete', $this); |
|
270 | - } |
|
271 | - |
|
272 | - |
|
273 | - /** |
|
274 | - * load and setup EE_Capabilities |
|
275 | - * |
|
276 | - * @return void |
|
277 | - * @throws EE_Error |
|
278 | - */ |
|
279 | - public function loadCapabilities() |
|
280 | - { |
|
281 | - $this->capabilities = $this->loader->getShared('EE_Capabilities'); |
|
282 | - add_action( |
|
283 | - 'AHEE__EE_Capabilities__init_caps__before_initialization', |
|
284 | - function () { |
|
285 | - LoaderFactory::getLoader()->getShared('EE_Payment_Method_Manager'); |
|
286 | - } |
|
287 | - ); |
|
288 | - } |
|
289 | - |
|
290 | - |
|
291 | - /** |
|
292 | - * create and cache the CommandBus, and also add middleware |
|
293 | - * The CapChecker middleware requires the use of EE_Capabilities |
|
294 | - * which is why we need to load the CommandBus after Caps are set up |
|
295 | - * CommandBus middleware operate FIFO - First In First Out |
|
296 | - * so LocateMovedCommands will run first in order to return any new commands |
|
297 | - * |
|
298 | - * @return void |
|
299 | - * @throws EE_Error |
|
300 | - */ |
|
301 | - public function loadCommandBus() |
|
302 | - { |
|
303 | - $this->loader->getShared( |
|
304 | - 'CommandBusInterface', |
|
305 | - array( |
|
306 | - null, |
|
307 | - apply_filters( |
|
308 | - 'FHEE__EE_Load_Espresso_Core__handle_request__CommandBus_middleware', |
|
309 | - array( |
|
310 | - $this->loader->getShared('EventEspresso\core\services\commands\middleware\LocateMovedCommands'), |
|
311 | - $this->loader->getShared('EventEspresso\core\services\commands\middleware\CapChecker'), |
|
312 | - $this->loader->getShared('EventEspresso\core\services\commands\middleware\AddActionHook'), |
|
313 | - ) |
|
314 | - ), |
|
315 | - ) |
|
316 | - ); |
|
317 | - } |
|
318 | - |
|
319 | - |
|
320 | - /** |
|
321 | - * @return void |
|
322 | - * @throws EE_Error |
|
323 | - */ |
|
324 | - public function loadPluginApi() |
|
325 | - { |
|
326 | - // set autoloaders for all of the classes implementing EEI_Plugin_API |
|
327 | - // which provide helpers for EE plugin authors to more easily register certain components with EE. |
|
328 | - EEH_Autoloader::instance()->register_autoloaders_for_each_file_in_folder(EE_LIBRARIES . 'plugin_api'); |
|
329 | - } |
|
330 | - |
|
331 | - |
|
332 | - /** |
|
333 | - * @param string $addon_name |
|
334 | - * @param string $version_constant |
|
335 | - * @param string $min_version_required |
|
336 | - * @param string $load_callback |
|
337 | - * @param string $plugin_file_constant |
|
338 | - * @return void |
|
339 | - */ |
|
340 | - private function deactivateIncompatibleAddon( |
|
341 | - $addon_name, |
|
342 | - $version_constant, |
|
343 | - $min_version_required, |
|
344 | - $load_callback, |
|
345 | - $plugin_file_constant |
|
346 | - ) { |
|
347 | - if (! defined($version_constant)) { |
|
348 | - return; |
|
349 | - } |
|
350 | - $addon_version = constant($version_constant); |
|
351 | - if ($addon_version && version_compare($addon_version, $min_version_required, '<')) { |
|
352 | - remove_action('AHEE__EE_System__load_espresso_addons', $load_callback); |
|
353 | - if (! function_exists('deactivate_plugins')) { |
|
354 | - require_once ABSPATH . 'wp-admin/includes/plugin.php'; |
|
355 | - } |
|
356 | - deactivate_plugins(plugin_basename(constant($plugin_file_constant))); |
|
357 | - $this->request->unSetRequestParams(['activate', 'activate-multi'], true); |
|
358 | - EE_Error::add_error( |
|
359 | - sprintf( |
|
360 | - esc_html__( |
|
361 | - 'We\'re sorry, but the Event Espresso %1$s addon was deactivated because version %2$s or higher is required with this version of Event Espresso core.', |
|
362 | - 'event_espresso' |
|
363 | - ), |
|
364 | - $addon_name, |
|
365 | - $min_version_required |
|
366 | - ), |
|
367 | - __FILE__, |
|
368 | - __FUNCTION__ . "({$addon_name})", |
|
369 | - __LINE__ |
|
370 | - ); |
|
371 | - EE_Error::get_notices(false, true); |
|
372 | - } |
|
373 | - } |
|
374 | - |
|
375 | - |
|
376 | - /** |
|
377 | - * load_espresso_addons |
|
378 | - * allow addons to load first so that they can set hooks for running DMS's, etc |
|
379 | - * this is hooked into both: |
|
380 | - * 'AHEE__EE_Bootstrap__load_core_configuration' |
|
381 | - * which runs during the WP 'plugins_loaded' action at priority 5 |
|
382 | - * and the WP 'activate_plugin' hook point |
|
383 | - * |
|
384 | - * @access public |
|
385 | - * @return void |
|
386 | - */ |
|
387 | - public function load_espresso_addons() |
|
388 | - { |
|
389 | - $this->deactivateIncompatibleAddon( |
|
390 | - 'Wait Lists', |
|
391 | - 'EE_WAIT_LISTS_VERSION', |
|
392 | - '1.0.0.beta.074', |
|
393 | - 'load_espresso_wait_lists', |
|
394 | - 'EE_WAIT_LISTS_PLUGIN_FILE' |
|
395 | - ); |
|
396 | - $this->deactivateIncompatibleAddon( |
|
397 | - 'Automated Upcoming Event Notifications', |
|
398 | - 'EE_AUTOMATED_UPCOMING_EVENT_NOTIFICATION_VERSION', |
|
399 | - '1.0.0.beta.091', |
|
400 | - 'load_espresso_automated_upcoming_event_notification', |
|
401 | - 'EE_AUTOMATED_UPCOMING_EVENT_NOTIFICATION_PLUGIN_FILE' |
|
402 | - ); |
|
403 | - do_action('AHEE__EE_System__load_espresso_addons'); |
|
404 | - // if the WP API basic auth plugin isn't already loaded, load it now. |
|
405 | - // We want it for mobile apps. Just include the entire plugin |
|
406 | - // also, don't load the basic auth when a plugin is getting activated, because |
|
407 | - // it could be the basic auth plugin, and it doesn't check if its methods are already defined |
|
408 | - // and causes a fatal error |
|
409 | - if ( |
|
410 | - ($this->request->isWordPressApi() || $this->request->isApi()) |
|
411 | - && $this->request->getRequestParam('activate') !== 'true' |
|
412 | - && ! function_exists('json_basic_auth_handler') |
|
413 | - && ! function_exists('json_basic_auth_error') |
|
414 | - && ! in_array( |
|
415 | - $this->request->getRequestParam('action'), |
|
416 | - array('activate', 'activate-selected'), |
|
417 | - true |
|
418 | - ) |
|
419 | - ) { |
|
420 | - include_once EE_THIRD_PARTY . 'wp-api-basic-auth/basic-auth.php'; |
|
421 | - } |
|
422 | - do_action('AHEE__EE_System__load_espresso_addons__complete'); |
|
423 | - } |
|
424 | - |
|
425 | - |
|
426 | - /** |
|
427 | - * detect_activations_or_upgrades |
|
428 | - * Checks for activation or upgrade of core first; |
|
429 | - * then also checks if any registered addons have been activated or upgraded |
|
430 | - * This is hooked into 'AHEE__EE_Bootstrap__detect_activations_or_upgrades' |
|
431 | - * which runs during the WP 'plugins_loaded' action at priority 3 |
|
432 | - * |
|
433 | - * @access public |
|
434 | - * @return void |
|
435 | - */ |
|
436 | - public function detect_activations_or_upgrades() |
|
437 | - { |
|
438 | - // first off: let's make sure to handle core |
|
439 | - $this->detect_if_activation_or_upgrade(); |
|
440 | - foreach ($this->registry->addons as $addon) { |
|
441 | - if ($addon instanceof EE_Addon) { |
|
442 | - // detect teh request type for that addon |
|
443 | - $addon->detect_req_type(); |
|
444 | - } |
|
445 | - } |
|
446 | - } |
|
447 | - |
|
448 | - |
|
449 | - /** |
|
450 | - * detect_if_activation_or_upgrade |
|
451 | - * Takes care of detecting whether this is a brand new install or code upgrade, |
|
452 | - * and either setting up the DB or setting up maintenance mode etc. |
|
453 | - * |
|
454 | - * @access public |
|
455 | - * @return void |
|
456 | - */ |
|
457 | - public function detect_if_activation_or_upgrade() |
|
458 | - { |
|
459 | - do_action('AHEE__EE_System___detect_if_activation_or_upgrade__begin'); |
|
460 | - // check if db has been updated, or if its a brand-new installation |
|
461 | - $espresso_db_update = $this->fix_espresso_db_upgrade_option(); |
|
462 | - $request_type = $this->detect_req_type($espresso_db_update); |
|
463 | - // EEH_Debug_Tools::printr( $request_type, '$request_type', __FILE__, __LINE__ ); |
|
464 | - switch ($request_type) { |
|
465 | - case EE_System::req_type_new_activation: |
|
466 | - do_action('AHEE__EE_System__detect_if_activation_or_upgrade__new_activation'); |
|
467 | - $this->_handle_core_version_change($espresso_db_update); |
|
468 | - break; |
|
469 | - case EE_System::req_type_reactivation: |
|
470 | - do_action('AHEE__EE_System__detect_if_activation_or_upgrade__reactivation'); |
|
471 | - $this->_handle_core_version_change($espresso_db_update); |
|
472 | - break; |
|
473 | - case EE_System::req_type_upgrade: |
|
474 | - do_action('AHEE__EE_System__detect_if_activation_or_upgrade__upgrade'); |
|
475 | - // migrations may be required now that we've upgraded |
|
476 | - $this->maintenance_mode->set_maintenance_mode_if_db_old(); |
|
477 | - $this->_handle_core_version_change($espresso_db_update); |
|
478 | - break; |
|
479 | - case EE_System::req_type_downgrade: |
|
480 | - do_action('AHEE__EE_System__detect_if_activation_or_upgrade__downgrade'); |
|
481 | - // its possible migrations are no longer required |
|
482 | - $this->maintenance_mode->set_maintenance_mode_if_db_old(); |
|
483 | - $this->_handle_core_version_change($espresso_db_update); |
|
484 | - break; |
|
485 | - case EE_System::req_type_normal: |
|
486 | - default: |
|
487 | - break; |
|
488 | - } |
|
489 | - do_action('AHEE__EE_System__detect_if_activation_or_upgrade__complete'); |
|
490 | - } |
|
491 | - |
|
492 | - |
|
493 | - /** |
|
494 | - * Updates the list of installed versions and sets hooks for |
|
495 | - * initializing the database later during the request |
|
496 | - * |
|
497 | - * @param array $espresso_db_update |
|
498 | - */ |
|
499 | - private function _handle_core_version_change($espresso_db_update) |
|
500 | - { |
|
501 | - $this->update_list_of_installed_versions($espresso_db_update); |
|
502 | - // get ready to verify the DB is ok (provided we aren't in maintenance mode, of course) |
|
503 | - add_action( |
|
504 | - 'AHEE__EE_System__perform_activations_upgrades_and_migrations', |
|
505 | - array($this, 'initialize_db_if_no_migrations_required') |
|
506 | - ); |
|
507 | - } |
|
508 | - |
|
509 | - |
|
510 | - /** |
|
511 | - * standardizes the wp option 'espresso_db_upgrade' which actually stores |
|
512 | - * information about what versions of EE have been installed and activated, |
|
513 | - * NOT necessarily the state of the database |
|
514 | - * |
|
515 | - * @param mixed $espresso_db_update the value of the WordPress option. |
|
516 | - * If not supplied, fetches it from the options table |
|
517 | - * @return array the correct value of 'espresso_db_upgrade', after saving it, if it needed correction |
|
518 | - */ |
|
519 | - private function fix_espresso_db_upgrade_option($espresso_db_update = null) |
|
520 | - { |
|
521 | - do_action('FHEE__EE_System__manage_fix_espresso_db_upgrade_option__begin', $espresso_db_update); |
|
522 | - if (! $espresso_db_update) { |
|
523 | - $espresso_db_update = get_option('espresso_db_update'); |
|
524 | - } |
|
525 | - // check that option is an array |
|
526 | - if (! is_array($espresso_db_update)) { |
|
527 | - // if option is FALSE, then it never existed |
|
528 | - if ($espresso_db_update === false) { |
|
529 | - // make $espresso_db_update an array and save option with autoload OFF |
|
530 | - $espresso_db_update = array(); |
|
531 | - add_option('espresso_db_update', $espresso_db_update, '', 'no'); |
|
532 | - } else { |
|
533 | - // option is NOT FALSE but also is NOT an array, so make it an array and save it |
|
534 | - $espresso_db_update = array($espresso_db_update => array()); |
|
535 | - update_option('espresso_db_update', $espresso_db_update); |
|
536 | - } |
|
537 | - } else { |
|
538 | - $corrected_db_update = array(); |
|
539 | - // if IS an array, but is it an array where KEYS are version numbers, and values are arrays? |
|
540 | - foreach ($espresso_db_update as $should_be_version_string => $should_be_array) { |
|
541 | - if (is_int($should_be_version_string) && ! is_array($should_be_array)) { |
|
542 | - // the key is an int, and the value IS NOT an array |
|
543 | - // so it must be numerically-indexed, where values are versions installed... |
|
544 | - // fix it! |
|
545 | - $version_string = $should_be_array; |
|
546 | - $corrected_db_update[ $version_string ] = array('unknown-date'); |
|
547 | - } else { |
|
548 | - // ok it checks out |
|
549 | - $corrected_db_update[ $should_be_version_string ] = $should_be_array; |
|
550 | - } |
|
551 | - } |
|
552 | - $espresso_db_update = $corrected_db_update; |
|
553 | - update_option('espresso_db_update', $espresso_db_update); |
|
554 | - } |
|
555 | - do_action('FHEE__EE_System__manage_fix_espresso_db_upgrade_option__complete', $espresso_db_update); |
|
556 | - return $espresso_db_update; |
|
557 | - } |
|
558 | - |
|
559 | - |
|
560 | - /** |
|
561 | - * Does the traditional work of setting up the plugin's database and adding default data. |
|
562 | - * If migration script/process did not exist, this is what would happen on every activation/reactivation/upgrade. |
|
563 | - * NOTE: if we're in maintenance mode (which would be the case if we detect there are data |
|
564 | - * migration scripts that need to be run and a version change happens), enqueues core for database initialization, |
|
565 | - * so that it will be done when migrations are finished |
|
566 | - * |
|
567 | - * @param boolean $initialize_addons_too if true, we double-check addons' database tables etc too; |
|
568 | - * @param boolean $verify_schema if true will re-check the database tables have the correct schema. |
|
569 | - * This is a resource-intensive job |
|
570 | - * so we prefer to only do it when necessary |
|
571 | - * @return void |
|
572 | - * @throws EE_Error |
|
573 | - */ |
|
574 | - public function initialize_db_if_no_migrations_required($initialize_addons_too = false, $verify_schema = true) |
|
575 | - { |
|
576 | - $request_type = $this->detect_req_type(); |
|
577 | - // only initialize system if we're not in maintenance mode. |
|
578 | - if ($this->maintenance_mode->level() !== EE_Maintenance_Mode::level_2_complete_maintenance) { |
|
579 | - /** @var EventEspresso\core\domain\services\custom_post_types\RewriteRules $rewrite_rules */ |
|
580 | - $rewrite_rules = $this->loader->getShared( |
|
581 | - 'EventEspresso\core\domain\services\custom_post_types\RewriteRules' |
|
582 | - ); |
|
583 | - $rewrite_rules->flush(); |
|
584 | - if ($verify_schema) { |
|
585 | - EEH_Activation::initialize_db_and_folders(); |
|
586 | - } |
|
587 | - EEH_Activation::initialize_db_content(); |
|
588 | - EEH_Activation::system_initialization(); |
|
589 | - if ($initialize_addons_too) { |
|
590 | - $this->initialize_addons(); |
|
591 | - } |
|
592 | - } else { |
|
593 | - EE_Data_Migration_Manager::instance()->enqueue_db_initialization_for('Core'); |
|
594 | - } |
|
595 | - if ( |
|
596 | - $request_type === EE_System::req_type_new_activation |
|
597 | - || $request_type === EE_System::req_type_reactivation |
|
598 | - || ( |
|
599 | - $request_type === EE_System::req_type_upgrade |
|
600 | - && $this->is_major_version_change() |
|
601 | - ) |
|
602 | - ) { |
|
603 | - add_action('AHEE__EE_System__initialize_last', array($this, 'redirect_to_about_ee'), 9); |
|
604 | - } |
|
605 | - } |
|
606 | - |
|
607 | - |
|
608 | - /** |
|
609 | - * Initializes the db for all registered addons |
|
610 | - * |
|
611 | - * @throws EE_Error |
|
612 | - */ |
|
613 | - public function initialize_addons() |
|
614 | - { |
|
615 | - // foreach registered addon, make sure its db is up-to-date too |
|
616 | - foreach ($this->registry->addons as $addon) { |
|
617 | - if ($addon instanceof EE_Addon) { |
|
618 | - $addon->initialize_db_if_no_migrations_required(); |
|
619 | - } |
|
620 | - } |
|
621 | - } |
|
622 | - |
|
623 | - |
|
624 | - /** |
|
625 | - * Adds the current code version to the saved wp option which stores a list of all ee versions ever installed. |
|
626 | - * |
|
627 | - * @param array $version_history |
|
628 | - * @param string $current_version_to_add version to be added to the version history |
|
629 | - * @return boolean success as to whether or not this option was changed |
|
630 | - */ |
|
631 | - public function update_list_of_installed_versions($version_history = null, $current_version_to_add = null) |
|
632 | - { |
|
633 | - if (! $version_history) { |
|
634 | - $version_history = $this->fix_espresso_db_upgrade_option($version_history); |
|
635 | - } |
|
636 | - if ($current_version_to_add === null) { |
|
637 | - $current_version_to_add = espresso_version(); |
|
638 | - } |
|
639 | - $version_history[ $current_version_to_add ][] = date('Y-m-d H:i:s', time()); |
|
640 | - // re-save |
|
641 | - return update_option('espresso_db_update', $version_history); |
|
642 | - } |
|
643 | - |
|
644 | - |
|
645 | - /** |
|
646 | - * Detects if the current version indicated in the has existed in the list of |
|
647 | - * previously-installed versions of EE (espresso_db_update). Does NOT modify it (ie, no side-effect) |
|
648 | - * |
|
649 | - * @param array $espresso_db_update array from the wp option stored under the name 'espresso_db_update'. |
|
650 | - * If not supplied, fetches it from the options table. |
|
651 | - * Also, caches its result so later parts of the code can also know whether |
|
652 | - * there's been an update or not. This way we can add the current version to |
|
653 | - * espresso_db_update, but still know if this is a new install or not |
|
654 | - * @return int one of the constants on EE_System::req_type_ |
|
655 | - */ |
|
656 | - public function detect_req_type($espresso_db_update = null) |
|
657 | - { |
|
658 | - if ($this->_req_type === null) { |
|
659 | - $espresso_db_update = ! empty($espresso_db_update) |
|
660 | - ? $espresso_db_update |
|
661 | - : $this->fix_espresso_db_upgrade_option(); |
|
662 | - $this->_req_type = EE_System::detect_req_type_given_activation_history( |
|
663 | - $espresso_db_update, |
|
664 | - 'ee_espresso_activation', |
|
665 | - espresso_version() |
|
666 | - ); |
|
667 | - $this->_major_version_change = $this->_detect_major_version_change($espresso_db_update); |
|
668 | - $this->request->setIsActivation($this->_req_type !== EE_System::req_type_normal); |
|
669 | - } |
|
670 | - return $this->_req_type; |
|
671 | - } |
|
672 | - |
|
673 | - |
|
674 | - /** |
|
675 | - * Returns whether or not there was a non-micro version change (ie, change in either |
|
676 | - * the first or second number in the version. Eg 4.9.0.rc.001 to 4.10.0.rc.000, |
|
677 | - * but not 4.9.0.rc.0001 to 4.9.1.rc.0001 |
|
678 | - * |
|
679 | - * @param $activation_history |
|
680 | - * @return bool |
|
681 | - */ |
|
682 | - private function _detect_major_version_change($activation_history) |
|
683 | - { |
|
684 | - $previous_version = EE_System::_get_most_recently_active_version_from_activation_history($activation_history); |
|
685 | - $previous_version_parts = explode('.', $previous_version); |
|
686 | - $current_version_parts = explode('.', espresso_version()); |
|
687 | - return isset($previous_version_parts[0], $previous_version_parts[1], $current_version_parts[0], $current_version_parts[1]) |
|
688 | - && ($previous_version_parts[0] !== $current_version_parts[0] |
|
689 | - || $previous_version_parts[1] !== $current_version_parts[1] |
|
690 | - ); |
|
691 | - } |
|
692 | - |
|
693 | - |
|
694 | - /** |
|
695 | - * Returns true if either the major or minor version of EE changed during this request. |
|
696 | - * Eg 4.9.0.rc.001 to 4.10.0.rc.000, but not 4.9.0.rc.0001 to 4.9.1.rc.0001 |
|
697 | - * |
|
698 | - * @return bool |
|
699 | - */ |
|
700 | - public function is_major_version_change() |
|
701 | - { |
|
702 | - return $this->_major_version_change; |
|
703 | - } |
|
704 | - |
|
705 | - |
|
706 | - /** |
|
707 | - * Determines the request type for any ee addon, given three piece of info: the current array of activation |
|
708 | - * histories (for core that' 'espresso_db_update' wp option); the name of the WordPress option which is temporarily |
|
709 | - * set upon activation of the plugin (for core it's 'ee_espresso_activation'); and the version that this plugin was |
|
710 | - * just activated to (for core that will always be espresso_version()) |
|
711 | - * |
|
712 | - * @param array $activation_history_for_addon the option's value which stores the activation history for this |
|
713 | - * ee plugin. for core that's 'espresso_db_update' |
|
714 | - * @param string $activation_indicator_option_name the name of the WordPress option that is temporarily set to |
|
715 | - * indicate that this plugin was just activated |
|
716 | - * @param string $version_to_upgrade_to the version that was just upgraded to (for core that will be |
|
717 | - * espresso_version()) |
|
718 | - * @return int one of the constants on EE_System::req_type_* |
|
719 | - */ |
|
720 | - public static function detect_req_type_given_activation_history( |
|
721 | - $activation_history_for_addon, |
|
722 | - $activation_indicator_option_name, |
|
723 | - $version_to_upgrade_to |
|
724 | - ) { |
|
725 | - $version_is_higher = self::_new_version_is_higher($activation_history_for_addon, $version_to_upgrade_to); |
|
726 | - if ($activation_history_for_addon) { |
|
727 | - // it exists, so this isn't a completely new install |
|
728 | - // check if this version already in that list of previously installed versions |
|
729 | - if (! isset($activation_history_for_addon[ $version_to_upgrade_to ])) { |
|
730 | - // it a version we haven't seen before |
|
731 | - if ($version_is_higher === 1) { |
|
732 | - $req_type = EE_System::req_type_upgrade; |
|
733 | - } else { |
|
734 | - $req_type = EE_System::req_type_downgrade; |
|
735 | - } |
|
736 | - delete_option($activation_indicator_option_name); |
|
737 | - } else { |
|
738 | - // its not an update. maybe a reactivation? |
|
739 | - if (get_option($activation_indicator_option_name, false)) { |
|
740 | - if ($version_is_higher === -1) { |
|
741 | - $req_type = EE_System::req_type_downgrade; |
|
742 | - } elseif ($version_is_higher === 0) { |
|
743 | - // we've seen this version before, but it's an activation. must be a reactivation |
|
744 | - $req_type = EE_System::req_type_reactivation; |
|
745 | - } else {// $version_is_higher === 1 |
|
746 | - $req_type = EE_System::req_type_upgrade; |
|
747 | - } |
|
748 | - delete_option($activation_indicator_option_name); |
|
749 | - } else { |
|
750 | - // we've seen this version before and the activation indicate doesn't show it was just activated |
|
751 | - if ($version_is_higher === -1) { |
|
752 | - $req_type = EE_System::req_type_downgrade; |
|
753 | - } elseif ($version_is_higher === 0) { |
|
754 | - // we've seen this version before and it's not an activation. its normal request |
|
755 | - $req_type = EE_System::req_type_normal; |
|
756 | - } else {// $version_is_higher === 1 |
|
757 | - $req_type = EE_System::req_type_upgrade; |
|
758 | - } |
|
759 | - } |
|
760 | - } |
|
761 | - } else { |
|
762 | - // brand new install |
|
763 | - $req_type = EE_System::req_type_new_activation; |
|
764 | - delete_option($activation_indicator_option_name); |
|
765 | - } |
|
766 | - return $req_type; |
|
767 | - } |
|
768 | - |
|
769 | - |
|
770 | - /** |
|
771 | - * Detects if the $version_to_upgrade_to is higher than the most recent version in |
|
772 | - * the $activation_history_for_addon |
|
773 | - * |
|
774 | - * @param array $activation_history_for_addon (keys are versions, values are arrays of times activated, |
|
775 | - * sometimes containing 'unknown-date' |
|
776 | - * @param string $version_to_upgrade_to (current version) |
|
777 | - * @return int results of version_compare( $version_to_upgrade_to, $most_recently_active_version ). |
|
778 | - * ie, -1 if $version_to_upgrade_to is LOWER (downgrade); |
|
779 | - * 0 if $version_to_upgrade_to MATCHES (reactivation or normal request); |
|
780 | - * 1 if $version_to_upgrade_to is HIGHER (upgrade) ; |
|
781 | - */ |
|
782 | - private static function _new_version_is_higher($activation_history_for_addon, $version_to_upgrade_to) |
|
783 | - { |
|
784 | - // find the most recently-activated version |
|
785 | - $most_recently_active_version = |
|
786 | - EE_System::_get_most_recently_active_version_from_activation_history($activation_history_for_addon); |
|
787 | - return version_compare($version_to_upgrade_to, $most_recently_active_version); |
|
788 | - } |
|
789 | - |
|
790 | - |
|
791 | - /** |
|
792 | - * Gets the most recently active version listed in the activation history, |
|
793 | - * and if none are found (ie, it's a brand new install) returns '0.0.0.dev.000'. |
|
794 | - * |
|
795 | - * @param array $activation_history (keys are versions, values are arrays of times activated, |
|
796 | - * sometimes containing 'unknown-date' |
|
797 | - * @return string |
|
798 | - */ |
|
799 | - private static function _get_most_recently_active_version_from_activation_history($activation_history) |
|
800 | - { |
|
801 | - $most_recently_active_version_activation = '1970-01-01 00:00:00'; |
|
802 | - $most_recently_active_version = '0.0.0.dev.000'; |
|
803 | - if (is_array($activation_history)) { |
|
804 | - foreach ($activation_history as $version => $times_activated) { |
|
805 | - // check there is a record of when this version was activated. Otherwise, |
|
806 | - // mark it as unknown |
|
807 | - if (! $times_activated) { |
|
808 | - $times_activated = array('unknown-date'); |
|
809 | - } |
|
810 | - if (is_string($times_activated)) { |
|
811 | - $times_activated = array($times_activated); |
|
812 | - } |
|
813 | - foreach ($times_activated as $an_activation) { |
|
814 | - if ( |
|
815 | - $an_activation !== 'unknown-date' |
|
816 | - && $an_activation |
|
817 | - > $most_recently_active_version_activation |
|
818 | - ) { |
|
819 | - $most_recently_active_version = $version; |
|
820 | - $most_recently_active_version_activation = $an_activation === 'unknown-date' |
|
821 | - ? '1970-01-01 00:00:00' |
|
822 | - : $an_activation; |
|
823 | - } |
|
824 | - } |
|
825 | - } |
|
826 | - } |
|
827 | - return $most_recently_active_version; |
|
828 | - } |
|
829 | - |
|
830 | - |
|
831 | - /** |
|
832 | - * This redirects to the about EE page after activation |
|
833 | - * |
|
834 | - * @return void |
|
835 | - */ |
|
836 | - public function redirect_to_about_ee() |
|
837 | - { |
|
838 | - $notices = EE_Error::get_notices(false); |
|
839 | - // if current user is an admin and it's not an ajax or rest request |
|
840 | - if ( |
|
841 | - ! isset($notices['errors']) |
|
842 | - && $this->request->isAdmin() |
|
843 | - && apply_filters( |
|
844 | - 'FHEE__EE_System__redirect_to_about_ee__do_redirect', |
|
845 | - $this->capabilities->current_user_can('manage_options', 'espresso_about_default') |
|
846 | - ) |
|
847 | - ) { |
|
848 | - $query_params = array('page' => 'espresso_about'); |
|
849 | - if (EE_System::instance()->detect_req_type() === EE_System::req_type_new_activation) { |
|
850 | - $query_params['new_activation'] = true; |
|
851 | - } |
|
852 | - if (EE_System::instance()->detect_req_type() === EE_System::req_type_reactivation) { |
|
853 | - $query_params['reactivation'] = true; |
|
854 | - } |
|
855 | - $url = add_query_arg($query_params, admin_url('admin.php')); |
|
856 | - wp_safe_redirect($url); |
|
857 | - exit(); |
|
858 | - } |
|
859 | - } |
|
860 | - |
|
861 | - |
|
862 | - /** |
|
863 | - * load_core_configuration |
|
864 | - * this is hooked into 'AHEE__EE_Bootstrap__load_core_configuration' |
|
865 | - * which runs during the WP 'plugins_loaded' action at priority 5 |
|
866 | - * |
|
867 | - * @return void |
|
868 | - * @throws ReflectionException |
|
869 | - * @throws Exception |
|
870 | - */ |
|
871 | - public function load_core_configuration() |
|
872 | - { |
|
873 | - do_action('AHEE__EE_System__load_core_configuration__begin', $this); |
|
874 | - $this->loader->getShared('EE_Load_Textdomain'); |
|
875 | - // load textdomain |
|
876 | - EE_Load_Textdomain::load_textdomain(); |
|
877 | - // load caf stuff a chance to play during the activation process too. |
|
878 | - $this->_maybe_brew_regular(); |
|
879 | - // load and setup EE_Config and EE_Network_Config |
|
880 | - $config = $this->loader->getShared('EE_Config'); |
|
881 | - $this->loader->getShared('EE_Network_Config'); |
|
882 | - // setup autoloaders |
|
883 | - // enable logging? |
|
884 | - $this->loader->getShared('EventEspresso\core\services\orm\TrashLogger'); |
|
885 | - if ($config->admin->use_remote_logging) { |
|
886 | - $this->loader->getShared('EE_Log'); |
|
887 | - } |
|
888 | - // check for activation errors |
|
889 | - $activation_errors = get_option('ee_plugin_activation_errors', false); |
|
890 | - if ($activation_errors) { |
|
891 | - EE_Error::add_error($activation_errors, __FILE__, __FUNCTION__, __LINE__); |
|
892 | - update_option('ee_plugin_activation_errors', false); |
|
893 | - } |
|
894 | - // get model names |
|
895 | - $this->_parse_model_names(); |
|
896 | - // configure custom post type definitions |
|
897 | - $this->loader->getShared('EventEspresso\core\domain\entities\custom_post_types\CustomTaxonomyDefinitions'); |
|
898 | - $this->loader->getShared('EventEspresso\core\domain\entities\custom_post_types\CustomPostTypeDefinitions'); |
|
899 | - do_action('AHEE__EE_System__load_core_configuration__complete', $this); |
|
900 | - } |
|
901 | - |
|
902 | - |
|
903 | - /** |
|
904 | - * cycles through all of the models/*.model.php files, and assembles an array of model names |
|
905 | - * |
|
906 | - * @return void |
|
907 | - * @throws ReflectionException |
|
908 | - */ |
|
909 | - private function _parse_model_names() |
|
910 | - { |
|
911 | - // get all the files in the EE_MODELS folder that end in .model.php |
|
912 | - $models = glob(EE_MODELS . '*.model.php'); |
|
913 | - $model_names = array(); |
|
914 | - $non_abstract_db_models = array(); |
|
915 | - foreach ($models as $model) { |
|
916 | - // get model classname |
|
917 | - $classname = EEH_File::get_classname_from_filepath_with_standard_filename($model); |
|
918 | - $short_name = str_replace('EEM_', '', $classname); |
|
919 | - $reflectionClass = new ReflectionClass($classname); |
|
920 | - if ($reflectionClass->isSubclassOf('EEM_Base') && ! $reflectionClass->isAbstract()) { |
|
921 | - $non_abstract_db_models[ $short_name ] = $classname; |
|
922 | - } |
|
923 | - $model_names[ $short_name ] = $classname; |
|
924 | - } |
|
925 | - $this->registry->models = apply_filters('FHEE__EE_System__parse_model_names', $model_names); |
|
926 | - $this->registry->non_abstract_db_models = apply_filters( |
|
927 | - 'FHEE__EE_System__parse_implemented_model_names', |
|
928 | - $non_abstract_db_models |
|
929 | - ); |
|
930 | - } |
|
931 | - |
|
932 | - |
|
933 | - /** |
|
934 | - * The purpose of this method is to simply check for a file named "caffeinated/brewing_regular.php" for any hooks |
|
935 | - * that need to be setup before our EE_System launches. |
|
936 | - * |
|
937 | - * @return void |
|
938 | - * @throws DomainException |
|
939 | - * @throws InvalidArgumentException |
|
940 | - * @throws InvalidDataTypeException |
|
941 | - * @throws InvalidInterfaceException |
|
942 | - * @throws InvalidClassException |
|
943 | - * @throws InvalidFilePathException |
|
944 | - */ |
|
945 | - private function _maybe_brew_regular() |
|
946 | - { |
|
947 | - /** @var Domain $domain */ |
|
948 | - $domain = DomainFactory::getShared( |
|
949 | - new FullyQualifiedName( |
|
950 | - 'EventEspresso\core\domain\Domain' |
|
951 | - ), |
|
952 | - array( |
|
953 | - new FilePath(EVENT_ESPRESSO_MAIN_FILE), |
|
954 | - Version::fromString(espresso_version()), |
|
955 | - ) |
|
956 | - ); |
|
957 | - if ($domain->isCaffeinated()) { |
|
958 | - require_once EE_CAFF_PATH . 'brewing_regular.php'; |
|
959 | - } |
|
960 | - } |
|
961 | - |
|
962 | - |
|
963 | - /** |
|
964 | - * @since 4.9.71.p |
|
965 | - * @throws Exception |
|
966 | - */ |
|
967 | - public function loadRouteMatchSpecifications() |
|
968 | - { |
|
969 | - try { |
|
970 | - $this->loader->getShared( |
|
971 | - 'EventEspresso\core\services\route_match\RouteMatchSpecificationManager' |
|
972 | - ); |
|
973 | - } catch (Exception $exception) { |
|
974 | - new ExceptionStackTraceDisplay($exception); |
|
975 | - } |
|
976 | - do_action('AHEE__EE_System__loadRouteMatchSpecifications'); |
|
977 | - } |
|
978 | - |
|
979 | - |
|
980 | - /** |
|
981 | - * loading CPT related classes earlier so that their definitions are available |
|
982 | - * but not performing any actual registration with WP core until load_CPTs_and_session() is called |
|
983 | - * |
|
984 | - * @since 4.10.21.p |
|
985 | - */ |
|
986 | - public function loadCustomPostTypes() |
|
987 | - { |
|
988 | - $this->register_custom_taxonomies = $this->loader->getShared( |
|
989 | - 'EventEspresso\core\domain\services\custom_post_types\RegisterCustomTaxonomies' |
|
990 | - ); |
|
991 | - $this->register_custom_post_types = $this->loader->getShared( |
|
992 | - 'EventEspresso\core\domain\services\custom_post_types\RegisterCustomPostTypes' |
|
993 | - ); |
|
994 | - $this->register_custom_taxonomy_terms = $this->loader->getShared( |
|
995 | - 'EventEspresso\core\domain\services\custom_post_types\RegisterCustomTaxonomyTerms' |
|
996 | - ); |
|
997 | - // integrate WP_Query with the EE models |
|
998 | - $this->loader->getShared('EE_CPT_Strategy'); |
|
999 | - // load legacy EE_Request_Handler in case add-ons still need it |
|
1000 | - $this->loader->getShared('EE_Request_Handler'); |
|
1001 | - } |
|
1002 | - |
|
1003 | - |
|
1004 | - /** |
|
1005 | - * register_shortcodes_modules_and_widgets |
|
1006 | - * generate lists of shortcodes and modules, then verify paths and classes |
|
1007 | - * This is hooked into 'AHEE__EE_Bootstrap__register_shortcodes_modules_and_widgets' |
|
1008 | - * which runs during the WP 'plugins_loaded' action at priority 7 |
|
1009 | - * |
|
1010 | - * @access public |
|
1011 | - * @return void |
|
1012 | - * @throws Exception |
|
1013 | - */ |
|
1014 | - public function register_shortcodes_modules_and_widgets() |
|
1015 | - { |
|
1016 | - if ($this->request->isFrontend() || $this->request->isIframe() || $this->request->isAjax()) { |
|
1017 | - // load, register, and add shortcodes the new way |
|
1018 | - $this->loader->getShared('EventEspresso\core\services\shortcodes\ShortcodesManager'); |
|
1019 | - } |
|
1020 | - do_action('AHEE__EE_System__register_shortcodes_modules_and_widgets'); |
|
1021 | - // check for addons using old hook point |
|
1022 | - if (has_action('AHEE__EE_System__register_shortcodes_modules_and_addons')) { |
|
1023 | - $this->_incompatible_addon_error(); |
|
1024 | - } |
|
1025 | - } |
|
1026 | - |
|
1027 | - |
|
1028 | - /** |
|
1029 | - * _incompatible_addon_error |
|
1030 | - * |
|
1031 | - * @access public |
|
1032 | - * @return void |
|
1033 | - */ |
|
1034 | - private function _incompatible_addon_error() |
|
1035 | - { |
|
1036 | - // get array of classes hooking into here |
|
1037 | - $class_names = EEH_Class_Tools::get_class_names_for_all_callbacks_on_hook( |
|
1038 | - 'AHEE__EE_System__register_shortcodes_modules_and_addons' |
|
1039 | - ); |
|
1040 | - if (! empty($class_names)) { |
|
1041 | - $msg = esc_html__( |
|
1042 | - 'The following plugins, addons, or modules appear to be incompatible with this version of Event Espresso and were automatically deactivated to avoid fatal errors:', |
|
1043 | - 'event_espresso' |
|
1044 | - ); |
|
1045 | - $msg .= '<ul>'; |
|
1046 | - foreach ($class_names as $class_name) { |
|
1047 | - $msg .= '<li><b>Event Espresso - ' |
|
1048 | - . str_replace( |
|
1049 | - array('EE_', 'EEM_', 'EED_', 'EES_', 'EEW_'), |
|
1050 | - '', |
|
1051 | - $class_name |
|
1052 | - ) . '</b></li>'; |
|
1053 | - } |
|
1054 | - $msg .= '</ul>'; |
|
1055 | - $msg .= esc_html__( |
|
1056 | - 'Compatibility issues can be avoided and/or resolved by keeping addons and plugins updated to the latest version.', |
|
1057 | - 'event_espresso' |
|
1058 | - ); |
|
1059 | - // save list of incompatible addons to wp-options for later use |
|
1060 | - add_option('ee_incompatible_addons', $class_names, '', 'no'); |
|
1061 | - if (is_admin()) { |
|
1062 | - EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
|
1063 | - } |
|
1064 | - } |
|
1065 | - } |
|
1066 | - |
|
1067 | - |
|
1068 | - /** |
|
1069 | - * brew_espresso |
|
1070 | - * begins the process of setting hooks for initializing EE in the correct order |
|
1071 | - * This is happening on the 'AHEE__EE_Bootstrap__brew_espresso' hook point |
|
1072 | - * which runs during the WP 'plugins_loaded' action at priority 9 |
|
1073 | - * |
|
1074 | - * @return void |
|
1075 | - */ |
|
1076 | - public function brew_espresso() |
|
1077 | - { |
|
1078 | - do_action('AHEE__EE_System__brew_espresso__begin', $this); |
|
1079 | - // load some final core systems |
|
1080 | - add_action('init', array($this, 'set_hooks_for_core'), 1); |
|
1081 | - add_action('init', array($this, 'perform_activations_upgrades_and_migrations'), 3); |
|
1082 | - add_action('init', array($this, 'load_CPTs_and_session'), 5); |
|
1083 | - add_action('init', array($this, 'load_controllers'), 7); |
|
1084 | - add_action('init', array($this, 'core_loaded_and_ready'), 9); |
|
1085 | - add_action('init', array($this, 'initialize'), 10); |
|
1086 | - add_action('init', array($this, 'initialize_last'), 100); |
|
1087 | - if (is_admin() && apply_filters('FHEE__EE_System__brew_espresso__load_pue', true)) { |
|
1088 | - // pew pew pew |
|
1089 | - $this->loader->getShared('EventEspresso\core\services\licensing\LicenseService'); |
|
1090 | - do_action('AHEE__EE_System__brew_espresso__after_pue_init'); |
|
1091 | - } |
|
1092 | - do_action('AHEE__EE_System__brew_espresso__complete', $this); |
|
1093 | - } |
|
1094 | - |
|
1095 | - |
|
1096 | - /** |
|
1097 | - * set_hooks_for_core |
|
1098 | - * |
|
1099 | - * @access public |
|
1100 | - * @return void |
|
1101 | - * @throws EE_Error |
|
1102 | - */ |
|
1103 | - public function set_hooks_for_core() |
|
1104 | - { |
|
1105 | - $this->_deactivate_incompatible_addons(); |
|
1106 | - do_action('AHEE__EE_System__set_hooks_for_core'); |
|
1107 | - $this->loader->getShared('EventEspresso\core\domain\values\session\SessionLifespan'); |
|
1108 | - // caps need to be initialized on every request so that capability maps are set. |
|
1109 | - // @see https://events.codebasehq.com/projects/event-espresso/tickets/8674 |
|
1110 | - $this->registry->CAP->init_caps(); |
|
1111 | - } |
|
1112 | - |
|
1113 | - |
|
1114 | - /** |
|
1115 | - * Using the information gathered in EE_System::_incompatible_addon_error, |
|
1116 | - * deactivates any addons considered incompatible with the current version of EE |
|
1117 | - */ |
|
1118 | - private function _deactivate_incompatible_addons() |
|
1119 | - { |
|
1120 | - $incompatible_addons = get_option('ee_incompatible_addons', array()); |
|
1121 | - if (! empty($incompatible_addons)) { |
|
1122 | - $active_plugins = get_option('active_plugins', array()); |
|
1123 | - foreach ($active_plugins as $active_plugin) { |
|
1124 | - foreach ($incompatible_addons as $incompatible_addon) { |
|
1125 | - if (strpos($active_plugin, $incompatible_addon) !== false) { |
|
1126 | - $this->request->unSetRequestParams(['activate'], true); |
|
1127 | - espresso_deactivate_plugin($active_plugin); |
|
1128 | - } |
|
1129 | - } |
|
1130 | - } |
|
1131 | - } |
|
1132 | - } |
|
1133 | - |
|
1134 | - |
|
1135 | - /** |
|
1136 | - * perform_activations_upgrades_and_migrations |
|
1137 | - * |
|
1138 | - * @access public |
|
1139 | - * @return void |
|
1140 | - */ |
|
1141 | - public function perform_activations_upgrades_and_migrations() |
|
1142 | - { |
|
1143 | - do_action('AHEE__EE_System__perform_activations_upgrades_and_migrations'); |
|
1144 | - } |
|
1145 | - |
|
1146 | - |
|
1147 | - /** |
|
1148 | - * @return void |
|
1149 | - * @throws DomainException |
|
1150 | - */ |
|
1151 | - public function load_CPTs_and_session() |
|
1152 | - { |
|
1153 | - do_action('AHEE__EE_System__load_CPTs_and_session__start'); |
|
1154 | - $this->register_custom_taxonomies->registerCustomTaxonomies(); |
|
1155 | - $this->register_custom_post_types->registerCustomPostTypes(); |
|
1156 | - $this->register_custom_taxonomy_terms->registerCustomTaxonomyTerms(); |
|
1157 | - // load legacy Custom Post Types and Taxonomies |
|
1158 | - $this->loader->getShared('EE_Register_CPTs'); |
|
1159 | - do_action('AHEE__EE_System__load_CPTs_and_session__complete'); |
|
1160 | - } |
|
1161 | - |
|
1162 | - |
|
1163 | - /** |
|
1164 | - * load_controllers |
|
1165 | - * this is the best place to load any additional controllers that needs access to EE core. |
|
1166 | - * it is expected that all basic core EE systems, that are not dependant on the current request are loaded at this |
|
1167 | - * time |
|
1168 | - * |
|
1169 | - * @access public |
|
1170 | - * @return void |
|
1171 | - */ |
|
1172 | - public function load_controllers() |
|
1173 | - { |
|
1174 | - do_action('AHEE__EE_System__load_controllers__start'); |
|
1175 | - // let's get it started |
|
1176 | - if ( |
|
1177 | - ! $this->maintenance_mode->level() |
|
1178 | - && ($this->request->isFrontend() || $this->request->isFrontAjax()) |
|
1179 | - ) { |
|
1180 | - do_action('AHEE__EE_System__load_controllers__load_front_controllers'); |
|
1181 | - $this->loader->getShared('EE_Front_Controller'); |
|
1182 | - } elseif ($this->request->isAdmin() || $this->request->isAdminAjax()) { |
|
1183 | - do_action('AHEE__EE_System__load_controllers__load_admin_controllers'); |
|
1184 | - $this->loader->getShared('EE_Admin'); |
|
1185 | - $this->loader->getShared( |
|
1186 | - 'EventEspresso\core\services\activation\plugin_prompt\DownloadPluginPromptManager' |
|
1187 | - ); |
|
1188 | - } elseif ($this->request->isWordPressHeartbeat()) { |
|
1189 | - $this->loader->getShared('EventEspresso\core\domain\services\admin\ajax\WordpressHeartbeat'); |
|
1190 | - } |
|
1191 | - do_action('AHEE__EE_System__load_controllers__complete'); |
|
1192 | - } |
|
1193 | - |
|
1194 | - |
|
1195 | - /** |
|
1196 | - * core_loaded_and_ready |
|
1197 | - * all of the basic EE core should be loaded at this point and available regardless of M-Mode |
|
1198 | - * |
|
1199 | - * @access public |
|
1200 | - * @return void |
|
1201 | - * @throws Exception |
|
1202 | - */ |
|
1203 | - public function core_loaded_and_ready() |
|
1204 | - { |
|
1205 | - if ( |
|
1206 | - $this->request->isAdmin() |
|
1207 | - || $this->request->isFrontend() |
|
1208 | - || $this->request->isIframe() |
|
1209 | - || $this->request->isWordPressApi() |
|
1210 | - ) { |
|
1211 | - try { |
|
1212 | - $this->loader->getShared('EventEspresso\core\services\assets\I18nRegistry', [[]]); |
|
1213 | - $this->loader->getShared('EventEspresso\core\services\assets\Registry'); |
|
1214 | - $this->loader->getShared('EventEspresso\core\domain\services\assets\CoreAssetManager'); |
|
1215 | - if ($this->canLoadBlocks()) { |
|
1216 | - $this->loader->getShared( |
|
1217 | - 'EventEspresso\core\services\editor\BlockRegistrationManager' |
|
1218 | - ); |
|
1219 | - } |
|
1220 | - } catch (Exception $exception) { |
|
1221 | - new ExceptionStackTraceDisplay($exception); |
|
1222 | - } |
|
1223 | - } |
|
1224 | - if ( |
|
1225 | - $this->request->isAdmin() |
|
1226 | - || $this->request->isEeAjax() |
|
1227 | - || $this->request->isFrontend() |
|
1228 | - ) { |
|
1229 | - $this->loader->getShared('EE_Session'); |
|
1230 | - } |
|
1231 | - do_action('AHEE__EE_System__core_loaded_and_ready'); |
|
1232 | - // always load template tags, because it's faster than checking if it's a front-end request, and many page |
|
1233 | - // builders require these even on the front-end |
|
1234 | - require_once EE_PUBLIC . 'template_tags.php'; |
|
1235 | - do_action('AHEE__EE_System__set_hooks_for_shortcodes_modules_and_addons'); |
|
1236 | - } |
|
1237 | - |
|
1238 | - |
|
1239 | - /** |
|
1240 | - * initialize |
|
1241 | - * this is the best place to begin initializing client code |
|
1242 | - * |
|
1243 | - * @access public |
|
1244 | - * @return void |
|
1245 | - */ |
|
1246 | - public function initialize() |
|
1247 | - { |
|
1248 | - do_action('AHEE__EE_System__initialize'); |
|
1249 | - add_filter( |
|
1250 | - 'safe_style_css', |
|
1251 | - function ($styles) { |
|
1252 | - $styles[] = 'display'; |
|
1253 | - $styles[] = 'visibility'; |
|
1254 | - $styles[] = 'position'; |
|
1255 | - $styles[] = 'top'; |
|
1256 | - $styles[] = 'right'; |
|
1257 | - $styles[] = 'bottom'; |
|
1258 | - $styles[] = 'left'; |
|
1259 | - $styles[] = 'resize'; |
|
1260 | - $styles[] = 'max-width'; |
|
1261 | - $styles[] = 'max-height'; |
|
1262 | - return $styles; |
|
1263 | - } |
|
1264 | - ); |
|
1265 | - } |
|
1266 | - |
|
1267 | - |
|
1268 | - /** |
|
1269 | - * initialize_last |
|
1270 | - * this is run really late during the WP init hook point, and ensures that mostly everything else that needs to |
|
1271 | - * initialize has done so |
|
1272 | - * |
|
1273 | - * @access public |
|
1274 | - * @return void |
|
1275 | - */ |
|
1276 | - public function initialize_last() |
|
1277 | - { |
|
1278 | - do_action('AHEE__EE_System__initialize_last'); |
|
1279 | - /** @var EventEspresso\core\domain\services\custom_post_types\RewriteRules $rewrite_rules */ |
|
1280 | - $rewrite_rules = $this->loader->getShared( |
|
1281 | - 'EventEspresso\core\domain\services\custom_post_types\RewriteRules' |
|
1282 | - ); |
|
1283 | - $rewrite_rules->flushRewriteRules(); |
|
1284 | - add_action('admin_bar_init', array($this, 'addEspressoToolbar')); |
|
1285 | - if ( |
|
1286 | - ($this->request->isAjax() || $this->request->isAdmin()) |
|
1287 | - && $this->maintenance_mode->models_can_query() |
|
1288 | - ) { |
|
1289 | - $this->loader->getShared('EventEspresso\core\services\privacy\export\PersonalDataExporterManager'); |
|
1290 | - $this->loader->getShared('EventEspresso\core\services\privacy\erasure\PersonalDataEraserManager'); |
|
1291 | - } |
|
1292 | - } |
|
1293 | - |
|
1294 | - |
|
1295 | - /** |
|
1296 | - * @return void |
|
1297 | - * @throws EE_Error |
|
1298 | - */ |
|
1299 | - public function addEspressoToolbar() |
|
1300 | - { |
|
1301 | - $this->loader->getShared( |
|
1302 | - 'EventEspresso\core\domain\services\admin\AdminToolBar', |
|
1303 | - array($this->registry->CAP) |
|
1304 | - ); |
|
1305 | - } |
|
1306 | - |
|
1307 | - |
|
1308 | - /** |
|
1309 | - * do_not_cache |
|
1310 | - * sets no cache headers and defines no cache constants for WP plugins |
|
1311 | - * |
|
1312 | - * @access public |
|
1313 | - * @return void |
|
1314 | - */ |
|
1315 | - public static function do_not_cache() |
|
1316 | - { |
|
1317 | - // set no cache constants |
|
1318 | - if (! defined('DONOTCACHEPAGE')) { |
|
1319 | - define('DONOTCACHEPAGE', true); |
|
1320 | - } |
|
1321 | - if (! defined('DONOTCACHCEOBJECT')) { |
|
1322 | - define('DONOTCACHCEOBJECT', true); |
|
1323 | - } |
|
1324 | - if (! defined('DONOTCACHEDB')) { |
|
1325 | - define('DONOTCACHEDB', true); |
|
1326 | - } |
|
1327 | - // add no cache headers |
|
1328 | - add_action('send_headers', array('EE_System', 'nocache_headers'), 10); |
|
1329 | - // plus a little extra for nginx and Google Chrome |
|
1330 | - add_filter('nocache_headers', array('EE_System', 'extra_nocache_headers'), 10, 1); |
|
1331 | - // prevent browsers from prefetching of the rel='next' link, because it may contain content that interferes with the registration process |
|
1332 | - remove_action('wp_head', 'adjacent_posts_rel_link_wp_head'); |
|
1333 | - } |
|
1334 | - |
|
1335 | - |
|
1336 | - /** |
|
1337 | - * extra_nocache_headers |
|
1338 | - * |
|
1339 | - * @access public |
|
1340 | - * @param $headers |
|
1341 | - * @return array |
|
1342 | - */ |
|
1343 | - public static function extra_nocache_headers($headers) |
|
1344 | - { |
|
1345 | - // for NGINX |
|
1346 | - $headers['X-Accel-Expires'] = 0; |
|
1347 | - // plus extra for Google Chrome since it doesn't seem to respect "no-cache", but WILL respect "no-store" |
|
1348 | - $headers['Cache-Control'] = 'no-store, no-cache, must-revalidate, max-age=0'; |
|
1349 | - return $headers; |
|
1350 | - } |
|
1351 | - |
|
1352 | - |
|
1353 | - /** |
|
1354 | - * nocache_headers |
|
1355 | - * |
|
1356 | - * @access public |
|
1357 | - * @return void |
|
1358 | - */ |
|
1359 | - public static function nocache_headers() |
|
1360 | - { |
|
1361 | - nocache_headers(); |
|
1362 | - } |
|
1363 | - |
|
1364 | - |
|
1365 | - /** |
|
1366 | - * simply hooks into "wp_list_pages_exclude" filter (for wp_list_pages method) and makes sure EE critical pages are |
|
1367 | - * never returned with the function. |
|
1368 | - * |
|
1369 | - * @param array $exclude_array any existing pages being excluded are in this array. |
|
1370 | - * @return array |
|
1371 | - */ |
|
1372 | - public function remove_pages_from_wp_list_pages($exclude_array) |
|
1373 | - { |
|
1374 | - return array_merge($exclude_array, $this->registry->CFG->core->get_critical_pages_array()); |
|
1375 | - } |
|
1376 | - |
|
1377 | - |
|
1378 | - /** |
|
1379 | - * Return whether blocks can be registered/loaded or not. |
|
1380 | - * @return bool |
|
1381 | - */ |
|
1382 | - private function canLoadBlocks() |
|
1383 | - { |
|
1384 | - return apply_filters('FHEE__EE_System__canLoadBlocks', true) |
|
1385 | - && function_exists('register_block_type') |
|
1386 | - // don't load blocks if in the Divi page builder editor context |
|
1387 | - // @see https://github.com/eventespresso/event-espresso-core/issues/814 |
|
1388 | - && ! $this->request->getRequestParam('et_fb', false); |
|
1389 | - } |
|
29 | + /** |
|
30 | + * indicates this is a 'normal' request. Ie, not activation, nor upgrade, nor activation. |
|
31 | + * So examples of this would be a normal GET request on the frontend or backend, or a POST, etc |
|
32 | + */ |
|
33 | + const req_type_normal = 0; |
|
34 | + |
|
35 | + /** |
|
36 | + * Indicates this is a brand new installation of EE so we should install |
|
37 | + * tables and default data etc |
|
38 | + */ |
|
39 | + const req_type_new_activation = 1; |
|
40 | + |
|
41 | + /** |
|
42 | + * we've detected that EE has been reactivated (or EE was activated during maintenance mode, |
|
43 | + * and we just exited maintenance mode). We MUST check the database is setup properly |
|
44 | + * and that default data is setup too |
|
45 | + */ |
|
46 | + const req_type_reactivation = 2; |
|
47 | + |
|
48 | + /** |
|
49 | + * indicates that EE has been upgraded since its previous request. |
|
50 | + * We may have data migration scripts to call and will want to trigger maintenance mode |
|
51 | + */ |
|
52 | + const req_type_upgrade = 3; |
|
53 | + |
|
54 | + /** |
|
55 | + * TODO will detect that EE has been DOWNGRADED. We probably don't want to run in this case... |
|
56 | + */ |
|
57 | + const req_type_downgrade = 4; |
|
58 | + |
|
59 | + /** |
|
60 | + * @deprecated since version 4.6.0.dev.006 |
|
61 | + * Now whenever a new_activation is detected the request type is still just |
|
62 | + * new_activation (same for reactivation, upgrade, downgrade etc), but if we'r ein maintenance mode |
|
63 | + * EE_System::initialize_db_if_no_migrations_required and EE_Addon::initialize_db_if_no_migrations_required |
|
64 | + * will instead enqueue that EE plugin's db initialization for when we're taken out of maintenance mode. |
|
65 | + * (Specifically, when the migration manager indicates migrations are finished |
|
66 | + * EE_Data_Migration_Manager::initialize_db_for_enqueued_ee_plugins() will be called) |
|
67 | + */ |
|
68 | + const req_type_activation_but_not_installed = 5; |
|
69 | + |
|
70 | + /** |
|
71 | + * option prefix for recording the activation history (like core's "espresso_db_update") of addons |
|
72 | + */ |
|
73 | + const addon_activation_history_option_prefix = 'ee_addon_activation_history_'; |
|
74 | + |
|
75 | + /** |
|
76 | + * @var EE_System $_instance |
|
77 | + */ |
|
78 | + private static $_instance; |
|
79 | + |
|
80 | + /** |
|
81 | + * @var EE_Registry $registry |
|
82 | + */ |
|
83 | + private $registry; |
|
84 | + |
|
85 | + /** |
|
86 | + * @var LoaderInterface $loader |
|
87 | + */ |
|
88 | + private $loader; |
|
89 | + |
|
90 | + /** |
|
91 | + * @var EE_Capabilities $capabilities |
|
92 | + */ |
|
93 | + private $capabilities; |
|
94 | + |
|
95 | + /** |
|
96 | + * @var RequestInterface $request |
|
97 | + */ |
|
98 | + private $request; |
|
99 | + |
|
100 | + /** |
|
101 | + * @var EE_Maintenance_Mode $maintenance_mode |
|
102 | + */ |
|
103 | + private $maintenance_mode; |
|
104 | + |
|
105 | + /** |
|
106 | + * Stores which type of request this is, options being one of the constants on EE_System starting with req_type_*. |
|
107 | + * It can be a brand-new activation, a reactivation, an upgrade, a downgrade, or a normal request. |
|
108 | + * |
|
109 | + * @var int $_req_type |
|
110 | + */ |
|
111 | + private $_req_type; |
|
112 | + |
|
113 | + /** |
|
114 | + * Whether or not there was a non-micro version change in EE core version during this request |
|
115 | + * |
|
116 | + * @var boolean $_major_version_change |
|
117 | + */ |
|
118 | + private $_major_version_change = false; |
|
119 | + |
|
120 | + /** |
|
121 | + * A Context DTO dedicated solely to identifying the current request type. |
|
122 | + * |
|
123 | + * @var RequestTypeContextCheckerInterface $request_type |
|
124 | + */ |
|
125 | + private $request_type; |
|
126 | + |
|
127 | + /** |
|
128 | + * @param EventEspresso\core\domain\services\custom_post_types\RegisterCustomPostTypes |
|
129 | + */ |
|
130 | + private $register_custom_post_types; |
|
131 | + |
|
132 | + /** |
|
133 | + * @param EventEspresso\core\domain\services\custom_post_types\RegisterCustomTaxonomies |
|
134 | + */ |
|
135 | + private $register_custom_taxonomies; |
|
136 | + |
|
137 | + /** |
|
138 | + * @param EventEspresso\core\domain\services\custom_post_types\RegisterCustomTaxonomyTerms |
|
139 | + */ |
|
140 | + private $register_custom_taxonomy_terms; |
|
141 | + |
|
142 | + /** |
|
143 | + * @singleton method used to instantiate class object |
|
144 | + * @param EE_Registry|null $registry |
|
145 | + * @param LoaderInterface|null $loader |
|
146 | + * @param RequestInterface|null $request |
|
147 | + * @param EE_Maintenance_Mode|null $maintenance_mode |
|
148 | + * @return EE_System |
|
149 | + */ |
|
150 | + public static function instance( |
|
151 | + EE_Registry $registry = null, |
|
152 | + LoaderInterface $loader = null, |
|
153 | + RequestInterface $request = null, |
|
154 | + EE_Maintenance_Mode $maintenance_mode = null |
|
155 | + ) { |
|
156 | + // check if class object is instantiated |
|
157 | + if (! self::$_instance instanceof EE_System) { |
|
158 | + self::$_instance = new self($registry, $loader, $request, $maintenance_mode); |
|
159 | + } |
|
160 | + return self::$_instance; |
|
161 | + } |
|
162 | + |
|
163 | + |
|
164 | + /** |
|
165 | + * resets the instance and returns it |
|
166 | + * |
|
167 | + * @return EE_System |
|
168 | + */ |
|
169 | + public static function reset() |
|
170 | + { |
|
171 | + self::$_instance->_req_type = null; |
|
172 | + // make sure none of the old hooks are left hanging around |
|
173 | + remove_all_actions('AHEE__EE_System__perform_activations_upgrades_and_migrations'); |
|
174 | + // we need to reset the migration manager in order for it to detect DMSs properly |
|
175 | + EE_Data_Migration_Manager::reset(); |
|
176 | + self::instance()->detect_activations_or_upgrades(); |
|
177 | + self::instance()->perform_activations_upgrades_and_migrations(); |
|
178 | + return self::instance(); |
|
179 | + } |
|
180 | + |
|
181 | + |
|
182 | + /** |
|
183 | + * sets hooks for running rest of system |
|
184 | + * provides "AHEE__EE_System__construct__complete" hook for EE Addons to use as their starting point |
|
185 | + * starting EE Addons from any other point may lead to problems |
|
186 | + * |
|
187 | + * @param EE_Registry $registry |
|
188 | + * @param LoaderInterface $loader |
|
189 | + * @param RequestInterface $request |
|
190 | + * @param EE_Maintenance_Mode $maintenance_mode |
|
191 | + */ |
|
192 | + private function __construct( |
|
193 | + EE_Registry $registry, |
|
194 | + LoaderInterface $loader, |
|
195 | + RequestInterface $request, |
|
196 | + EE_Maintenance_Mode $maintenance_mode |
|
197 | + ) { |
|
198 | + $this->registry = $registry; |
|
199 | + $this->loader = $loader; |
|
200 | + $this->request = $request; |
|
201 | + $this->maintenance_mode = $maintenance_mode; |
|
202 | + do_action('AHEE__EE_System__construct__begin', $this); |
|
203 | + add_action( |
|
204 | + 'AHEE__EE_Bootstrap__load_espresso_addons', |
|
205 | + array($this, 'loadCapabilities'), |
|
206 | + 5 |
|
207 | + ); |
|
208 | + add_action( |
|
209 | + 'AHEE__EE_Bootstrap__load_espresso_addons', |
|
210 | + array($this, 'loadCommandBus'), |
|
211 | + 7 |
|
212 | + ); |
|
213 | + add_action( |
|
214 | + 'AHEE__EE_Bootstrap__load_espresso_addons', |
|
215 | + array($this, 'loadPluginApi'), |
|
216 | + 9 |
|
217 | + ); |
|
218 | + // allow addons to load first so that they can register autoloaders, set hooks for running DMS's, etc |
|
219 | + add_action( |
|
220 | + 'AHEE__EE_Bootstrap__load_espresso_addons', |
|
221 | + array($this, 'load_espresso_addons') |
|
222 | + ); |
|
223 | + // when an ee addon is activated, we want to call the core hook(s) again |
|
224 | + // because the newly-activated addon didn't get a chance to run at all |
|
225 | + add_action('activate_plugin', array($this, 'load_espresso_addons'), 1); |
|
226 | + // detect whether install or upgrade |
|
227 | + add_action( |
|
228 | + 'AHEE__EE_Bootstrap__detect_activations_or_upgrades', |
|
229 | + array($this, 'detect_activations_or_upgrades'), |
|
230 | + 3 |
|
231 | + ); |
|
232 | + // load EE_Config, EE_Textdomain, etc |
|
233 | + add_action( |
|
234 | + 'AHEE__EE_Bootstrap__load_core_configuration', |
|
235 | + array($this, 'load_core_configuration'), |
|
236 | + 5 |
|
237 | + ); |
|
238 | + // load specifications for matching routes to current request |
|
239 | + add_action( |
|
240 | + 'AHEE__EE_Bootstrap__load_core_configuration', |
|
241 | + array($this, 'loadRouteMatchSpecifications') |
|
242 | + ); |
|
243 | + // load specifications for custom post types |
|
244 | + add_action( |
|
245 | + 'AHEE__EE_Bootstrap__load_core_configuration', |
|
246 | + array($this, 'loadCustomPostTypes') |
|
247 | + ); |
|
248 | + // load EE_Config, EE_Textdomain, etc |
|
249 | + add_action( |
|
250 | + 'AHEE__EE_Bootstrap__register_shortcodes_modules_and_widgets', |
|
251 | + array($this, 'register_shortcodes_modules_and_widgets'), |
|
252 | + 7 |
|
253 | + ); |
|
254 | + // you wanna get going? I wanna get going... let's get going! |
|
255 | + add_action( |
|
256 | + 'AHEE__EE_Bootstrap__brew_espresso', |
|
257 | + array($this, 'brew_espresso'), |
|
258 | + 9 |
|
259 | + ); |
|
260 | + // other housekeeping |
|
261 | + // exclude EE critical pages from wp_list_pages |
|
262 | + add_filter( |
|
263 | + 'wp_list_pages_excludes', |
|
264 | + array($this, 'remove_pages_from_wp_list_pages'), |
|
265 | + 10 |
|
266 | + ); |
|
267 | + // ALL EE Addons should use the following hook point to attach their initial setup too |
|
268 | + // it's extremely important for EE Addons to register any class autoloaders so that they can be available when the EE_Config loads |
|
269 | + do_action('AHEE__EE_System__construct__complete', $this); |
|
270 | + } |
|
271 | + |
|
272 | + |
|
273 | + /** |
|
274 | + * load and setup EE_Capabilities |
|
275 | + * |
|
276 | + * @return void |
|
277 | + * @throws EE_Error |
|
278 | + */ |
|
279 | + public function loadCapabilities() |
|
280 | + { |
|
281 | + $this->capabilities = $this->loader->getShared('EE_Capabilities'); |
|
282 | + add_action( |
|
283 | + 'AHEE__EE_Capabilities__init_caps__before_initialization', |
|
284 | + function () { |
|
285 | + LoaderFactory::getLoader()->getShared('EE_Payment_Method_Manager'); |
|
286 | + } |
|
287 | + ); |
|
288 | + } |
|
289 | + |
|
290 | + |
|
291 | + /** |
|
292 | + * create and cache the CommandBus, and also add middleware |
|
293 | + * The CapChecker middleware requires the use of EE_Capabilities |
|
294 | + * which is why we need to load the CommandBus after Caps are set up |
|
295 | + * CommandBus middleware operate FIFO - First In First Out |
|
296 | + * so LocateMovedCommands will run first in order to return any new commands |
|
297 | + * |
|
298 | + * @return void |
|
299 | + * @throws EE_Error |
|
300 | + */ |
|
301 | + public function loadCommandBus() |
|
302 | + { |
|
303 | + $this->loader->getShared( |
|
304 | + 'CommandBusInterface', |
|
305 | + array( |
|
306 | + null, |
|
307 | + apply_filters( |
|
308 | + 'FHEE__EE_Load_Espresso_Core__handle_request__CommandBus_middleware', |
|
309 | + array( |
|
310 | + $this->loader->getShared('EventEspresso\core\services\commands\middleware\LocateMovedCommands'), |
|
311 | + $this->loader->getShared('EventEspresso\core\services\commands\middleware\CapChecker'), |
|
312 | + $this->loader->getShared('EventEspresso\core\services\commands\middleware\AddActionHook'), |
|
313 | + ) |
|
314 | + ), |
|
315 | + ) |
|
316 | + ); |
|
317 | + } |
|
318 | + |
|
319 | + |
|
320 | + /** |
|
321 | + * @return void |
|
322 | + * @throws EE_Error |
|
323 | + */ |
|
324 | + public function loadPluginApi() |
|
325 | + { |
|
326 | + // set autoloaders for all of the classes implementing EEI_Plugin_API |
|
327 | + // which provide helpers for EE plugin authors to more easily register certain components with EE. |
|
328 | + EEH_Autoloader::instance()->register_autoloaders_for_each_file_in_folder(EE_LIBRARIES . 'plugin_api'); |
|
329 | + } |
|
330 | + |
|
331 | + |
|
332 | + /** |
|
333 | + * @param string $addon_name |
|
334 | + * @param string $version_constant |
|
335 | + * @param string $min_version_required |
|
336 | + * @param string $load_callback |
|
337 | + * @param string $plugin_file_constant |
|
338 | + * @return void |
|
339 | + */ |
|
340 | + private function deactivateIncompatibleAddon( |
|
341 | + $addon_name, |
|
342 | + $version_constant, |
|
343 | + $min_version_required, |
|
344 | + $load_callback, |
|
345 | + $plugin_file_constant |
|
346 | + ) { |
|
347 | + if (! defined($version_constant)) { |
|
348 | + return; |
|
349 | + } |
|
350 | + $addon_version = constant($version_constant); |
|
351 | + if ($addon_version && version_compare($addon_version, $min_version_required, '<')) { |
|
352 | + remove_action('AHEE__EE_System__load_espresso_addons', $load_callback); |
|
353 | + if (! function_exists('deactivate_plugins')) { |
|
354 | + require_once ABSPATH . 'wp-admin/includes/plugin.php'; |
|
355 | + } |
|
356 | + deactivate_plugins(plugin_basename(constant($plugin_file_constant))); |
|
357 | + $this->request->unSetRequestParams(['activate', 'activate-multi'], true); |
|
358 | + EE_Error::add_error( |
|
359 | + sprintf( |
|
360 | + esc_html__( |
|
361 | + 'We\'re sorry, but the Event Espresso %1$s addon was deactivated because version %2$s or higher is required with this version of Event Espresso core.', |
|
362 | + 'event_espresso' |
|
363 | + ), |
|
364 | + $addon_name, |
|
365 | + $min_version_required |
|
366 | + ), |
|
367 | + __FILE__, |
|
368 | + __FUNCTION__ . "({$addon_name})", |
|
369 | + __LINE__ |
|
370 | + ); |
|
371 | + EE_Error::get_notices(false, true); |
|
372 | + } |
|
373 | + } |
|
374 | + |
|
375 | + |
|
376 | + /** |
|
377 | + * load_espresso_addons |
|
378 | + * allow addons to load first so that they can set hooks for running DMS's, etc |
|
379 | + * this is hooked into both: |
|
380 | + * 'AHEE__EE_Bootstrap__load_core_configuration' |
|
381 | + * which runs during the WP 'plugins_loaded' action at priority 5 |
|
382 | + * and the WP 'activate_plugin' hook point |
|
383 | + * |
|
384 | + * @access public |
|
385 | + * @return void |
|
386 | + */ |
|
387 | + public function load_espresso_addons() |
|
388 | + { |
|
389 | + $this->deactivateIncompatibleAddon( |
|
390 | + 'Wait Lists', |
|
391 | + 'EE_WAIT_LISTS_VERSION', |
|
392 | + '1.0.0.beta.074', |
|
393 | + 'load_espresso_wait_lists', |
|
394 | + 'EE_WAIT_LISTS_PLUGIN_FILE' |
|
395 | + ); |
|
396 | + $this->deactivateIncompatibleAddon( |
|
397 | + 'Automated Upcoming Event Notifications', |
|
398 | + 'EE_AUTOMATED_UPCOMING_EVENT_NOTIFICATION_VERSION', |
|
399 | + '1.0.0.beta.091', |
|
400 | + 'load_espresso_automated_upcoming_event_notification', |
|
401 | + 'EE_AUTOMATED_UPCOMING_EVENT_NOTIFICATION_PLUGIN_FILE' |
|
402 | + ); |
|
403 | + do_action('AHEE__EE_System__load_espresso_addons'); |
|
404 | + // if the WP API basic auth plugin isn't already loaded, load it now. |
|
405 | + // We want it for mobile apps. Just include the entire plugin |
|
406 | + // also, don't load the basic auth when a plugin is getting activated, because |
|
407 | + // it could be the basic auth plugin, and it doesn't check if its methods are already defined |
|
408 | + // and causes a fatal error |
|
409 | + if ( |
|
410 | + ($this->request->isWordPressApi() || $this->request->isApi()) |
|
411 | + && $this->request->getRequestParam('activate') !== 'true' |
|
412 | + && ! function_exists('json_basic_auth_handler') |
|
413 | + && ! function_exists('json_basic_auth_error') |
|
414 | + && ! in_array( |
|
415 | + $this->request->getRequestParam('action'), |
|
416 | + array('activate', 'activate-selected'), |
|
417 | + true |
|
418 | + ) |
|
419 | + ) { |
|
420 | + include_once EE_THIRD_PARTY . 'wp-api-basic-auth/basic-auth.php'; |
|
421 | + } |
|
422 | + do_action('AHEE__EE_System__load_espresso_addons__complete'); |
|
423 | + } |
|
424 | + |
|
425 | + |
|
426 | + /** |
|
427 | + * detect_activations_or_upgrades |
|
428 | + * Checks for activation or upgrade of core first; |
|
429 | + * then also checks if any registered addons have been activated or upgraded |
|
430 | + * This is hooked into 'AHEE__EE_Bootstrap__detect_activations_or_upgrades' |
|
431 | + * which runs during the WP 'plugins_loaded' action at priority 3 |
|
432 | + * |
|
433 | + * @access public |
|
434 | + * @return void |
|
435 | + */ |
|
436 | + public function detect_activations_or_upgrades() |
|
437 | + { |
|
438 | + // first off: let's make sure to handle core |
|
439 | + $this->detect_if_activation_or_upgrade(); |
|
440 | + foreach ($this->registry->addons as $addon) { |
|
441 | + if ($addon instanceof EE_Addon) { |
|
442 | + // detect teh request type for that addon |
|
443 | + $addon->detect_req_type(); |
|
444 | + } |
|
445 | + } |
|
446 | + } |
|
447 | + |
|
448 | + |
|
449 | + /** |
|
450 | + * detect_if_activation_or_upgrade |
|
451 | + * Takes care of detecting whether this is a brand new install or code upgrade, |
|
452 | + * and either setting up the DB or setting up maintenance mode etc. |
|
453 | + * |
|
454 | + * @access public |
|
455 | + * @return void |
|
456 | + */ |
|
457 | + public function detect_if_activation_or_upgrade() |
|
458 | + { |
|
459 | + do_action('AHEE__EE_System___detect_if_activation_or_upgrade__begin'); |
|
460 | + // check if db has been updated, or if its a brand-new installation |
|
461 | + $espresso_db_update = $this->fix_espresso_db_upgrade_option(); |
|
462 | + $request_type = $this->detect_req_type($espresso_db_update); |
|
463 | + // EEH_Debug_Tools::printr( $request_type, '$request_type', __FILE__, __LINE__ ); |
|
464 | + switch ($request_type) { |
|
465 | + case EE_System::req_type_new_activation: |
|
466 | + do_action('AHEE__EE_System__detect_if_activation_or_upgrade__new_activation'); |
|
467 | + $this->_handle_core_version_change($espresso_db_update); |
|
468 | + break; |
|
469 | + case EE_System::req_type_reactivation: |
|
470 | + do_action('AHEE__EE_System__detect_if_activation_or_upgrade__reactivation'); |
|
471 | + $this->_handle_core_version_change($espresso_db_update); |
|
472 | + break; |
|
473 | + case EE_System::req_type_upgrade: |
|
474 | + do_action('AHEE__EE_System__detect_if_activation_or_upgrade__upgrade'); |
|
475 | + // migrations may be required now that we've upgraded |
|
476 | + $this->maintenance_mode->set_maintenance_mode_if_db_old(); |
|
477 | + $this->_handle_core_version_change($espresso_db_update); |
|
478 | + break; |
|
479 | + case EE_System::req_type_downgrade: |
|
480 | + do_action('AHEE__EE_System__detect_if_activation_or_upgrade__downgrade'); |
|
481 | + // its possible migrations are no longer required |
|
482 | + $this->maintenance_mode->set_maintenance_mode_if_db_old(); |
|
483 | + $this->_handle_core_version_change($espresso_db_update); |
|
484 | + break; |
|
485 | + case EE_System::req_type_normal: |
|
486 | + default: |
|
487 | + break; |
|
488 | + } |
|
489 | + do_action('AHEE__EE_System__detect_if_activation_or_upgrade__complete'); |
|
490 | + } |
|
491 | + |
|
492 | + |
|
493 | + /** |
|
494 | + * Updates the list of installed versions and sets hooks for |
|
495 | + * initializing the database later during the request |
|
496 | + * |
|
497 | + * @param array $espresso_db_update |
|
498 | + */ |
|
499 | + private function _handle_core_version_change($espresso_db_update) |
|
500 | + { |
|
501 | + $this->update_list_of_installed_versions($espresso_db_update); |
|
502 | + // get ready to verify the DB is ok (provided we aren't in maintenance mode, of course) |
|
503 | + add_action( |
|
504 | + 'AHEE__EE_System__perform_activations_upgrades_and_migrations', |
|
505 | + array($this, 'initialize_db_if_no_migrations_required') |
|
506 | + ); |
|
507 | + } |
|
508 | + |
|
509 | + |
|
510 | + /** |
|
511 | + * standardizes the wp option 'espresso_db_upgrade' which actually stores |
|
512 | + * information about what versions of EE have been installed and activated, |
|
513 | + * NOT necessarily the state of the database |
|
514 | + * |
|
515 | + * @param mixed $espresso_db_update the value of the WordPress option. |
|
516 | + * If not supplied, fetches it from the options table |
|
517 | + * @return array the correct value of 'espresso_db_upgrade', after saving it, if it needed correction |
|
518 | + */ |
|
519 | + private function fix_espresso_db_upgrade_option($espresso_db_update = null) |
|
520 | + { |
|
521 | + do_action('FHEE__EE_System__manage_fix_espresso_db_upgrade_option__begin', $espresso_db_update); |
|
522 | + if (! $espresso_db_update) { |
|
523 | + $espresso_db_update = get_option('espresso_db_update'); |
|
524 | + } |
|
525 | + // check that option is an array |
|
526 | + if (! is_array($espresso_db_update)) { |
|
527 | + // if option is FALSE, then it never existed |
|
528 | + if ($espresso_db_update === false) { |
|
529 | + // make $espresso_db_update an array and save option with autoload OFF |
|
530 | + $espresso_db_update = array(); |
|
531 | + add_option('espresso_db_update', $espresso_db_update, '', 'no'); |
|
532 | + } else { |
|
533 | + // option is NOT FALSE but also is NOT an array, so make it an array and save it |
|
534 | + $espresso_db_update = array($espresso_db_update => array()); |
|
535 | + update_option('espresso_db_update', $espresso_db_update); |
|
536 | + } |
|
537 | + } else { |
|
538 | + $corrected_db_update = array(); |
|
539 | + // if IS an array, but is it an array where KEYS are version numbers, and values are arrays? |
|
540 | + foreach ($espresso_db_update as $should_be_version_string => $should_be_array) { |
|
541 | + if (is_int($should_be_version_string) && ! is_array($should_be_array)) { |
|
542 | + // the key is an int, and the value IS NOT an array |
|
543 | + // so it must be numerically-indexed, where values are versions installed... |
|
544 | + // fix it! |
|
545 | + $version_string = $should_be_array; |
|
546 | + $corrected_db_update[ $version_string ] = array('unknown-date'); |
|
547 | + } else { |
|
548 | + // ok it checks out |
|
549 | + $corrected_db_update[ $should_be_version_string ] = $should_be_array; |
|
550 | + } |
|
551 | + } |
|
552 | + $espresso_db_update = $corrected_db_update; |
|
553 | + update_option('espresso_db_update', $espresso_db_update); |
|
554 | + } |
|
555 | + do_action('FHEE__EE_System__manage_fix_espresso_db_upgrade_option__complete', $espresso_db_update); |
|
556 | + return $espresso_db_update; |
|
557 | + } |
|
558 | + |
|
559 | + |
|
560 | + /** |
|
561 | + * Does the traditional work of setting up the plugin's database and adding default data. |
|
562 | + * If migration script/process did not exist, this is what would happen on every activation/reactivation/upgrade. |
|
563 | + * NOTE: if we're in maintenance mode (which would be the case if we detect there are data |
|
564 | + * migration scripts that need to be run and a version change happens), enqueues core for database initialization, |
|
565 | + * so that it will be done when migrations are finished |
|
566 | + * |
|
567 | + * @param boolean $initialize_addons_too if true, we double-check addons' database tables etc too; |
|
568 | + * @param boolean $verify_schema if true will re-check the database tables have the correct schema. |
|
569 | + * This is a resource-intensive job |
|
570 | + * so we prefer to only do it when necessary |
|
571 | + * @return void |
|
572 | + * @throws EE_Error |
|
573 | + */ |
|
574 | + public function initialize_db_if_no_migrations_required($initialize_addons_too = false, $verify_schema = true) |
|
575 | + { |
|
576 | + $request_type = $this->detect_req_type(); |
|
577 | + // only initialize system if we're not in maintenance mode. |
|
578 | + if ($this->maintenance_mode->level() !== EE_Maintenance_Mode::level_2_complete_maintenance) { |
|
579 | + /** @var EventEspresso\core\domain\services\custom_post_types\RewriteRules $rewrite_rules */ |
|
580 | + $rewrite_rules = $this->loader->getShared( |
|
581 | + 'EventEspresso\core\domain\services\custom_post_types\RewriteRules' |
|
582 | + ); |
|
583 | + $rewrite_rules->flush(); |
|
584 | + if ($verify_schema) { |
|
585 | + EEH_Activation::initialize_db_and_folders(); |
|
586 | + } |
|
587 | + EEH_Activation::initialize_db_content(); |
|
588 | + EEH_Activation::system_initialization(); |
|
589 | + if ($initialize_addons_too) { |
|
590 | + $this->initialize_addons(); |
|
591 | + } |
|
592 | + } else { |
|
593 | + EE_Data_Migration_Manager::instance()->enqueue_db_initialization_for('Core'); |
|
594 | + } |
|
595 | + if ( |
|
596 | + $request_type === EE_System::req_type_new_activation |
|
597 | + || $request_type === EE_System::req_type_reactivation |
|
598 | + || ( |
|
599 | + $request_type === EE_System::req_type_upgrade |
|
600 | + && $this->is_major_version_change() |
|
601 | + ) |
|
602 | + ) { |
|
603 | + add_action('AHEE__EE_System__initialize_last', array($this, 'redirect_to_about_ee'), 9); |
|
604 | + } |
|
605 | + } |
|
606 | + |
|
607 | + |
|
608 | + /** |
|
609 | + * Initializes the db for all registered addons |
|
610 | + * |
|
611 | + * @throws EE_Error |
|
612 | + */ |
|
613 | + public function initialize_addons() |
|
614 | + { |
|
615 | + // foreach registered addon, make sure its db is up-to-date too |
|
616 | + foreach ($this->registry->addons as $addon) { |
|
617 | + if ($addon instanceof EE_Addon) { |
|
618 | + $addon->initialize_db_if_no_migrations_required(); |
|
619 | + } |
|
620 | + } |
|
621 | + } |
|
622 | + |
|
623 | + |
|
624 | + /** |
|
625 | + * Adds the current code version to the saved wp option which stores a list of all ee versions ever installed. |
|
626 | + * |
|
627 | + * @param array $version_history |
|
628 | + * @param string $current_version_to_add version to be added to the version history |
|
629 | + * @return boolean success as to whether or not this option was changed |
|
630 | + */ |
|
631 | + public function update_list_of_installed_versions($version_history = null, $current_version_to_add = null) |
|
632 | + { |
|
633 | + if (! $version_history) { |
|
634 | + $version_history = $this->fix_espresso_db_upgrade_option($version_history); |
|
635 | + } |
|
636 | + if ($current_version_to_add === null) { |
|
637 | + $current_version_to_add = espresso_version(); |
|
638 | + } |
|
639 | + $version_history[ $current_version_to_add ][] = date('Y-m-d H:i:s', time()); |
|
640 | + // re-save |
|
641 | + return update_option('espresso_db_update', $version_history); |
|
642 | + } |
|
643 | + |
|
644 | + |
|
645 | + /** |
|
646 | + * Detects if the current version indicated in the has existed in the list of |
|
647 | + * previously-installed versions of EE (espresso_db_update). Does NOT modify it (ie, no side-effect) |
|
648 | + * |
|
649 | + * @param array $espresso_db_update array from the wp option stored under the name 'espresso_db_update'. |
|
650 | + * If not supplied, fetches it from the options table. |
|
651 | + * Also, caches its result so later parts of the code can also know whether |
|
652 | + * there's been an update or not. This way we can add the current version to |
|
653 | + * espresso_db_update, but still know if this is a new install or not |
|
654 | + * @return int one of the constants on EE_System::req_type_ |
|
655 | + */ |
|
656 | + public function detect_req_type($espresso_db_update = null) |
|
657 | + { |
|
658 | + if ($this->_req_type === null) { |
|
659 | + $espresso_db_update = ! empty($espresso_db_update) |
|
660 | + ? $espresso_db_update |
|
661 | + : $this->fix_espresso_db_upgrade_option(); |
|
662 | + $this->_req_type = EE_System::detect_req_type_given_activation_history( |
|
663 | + $espresso_db_update, |
|
664 | + 'ee_espresso_activation', |
|
665 | + espresso_version() |
|
666 | + ); |
|
667 | + $this->_major_version_change = $this->_detect_major_version_change($espresso_db_update); |
|
668 | + $this->request->setIsActivation($this->_req_type !== EE_System::req_type_normal); |
|
669 | + } |
|
670 | + return $this->_req_type; |
|
671 | + } |
|
672 | + |
|
673 | + |
|
674 | + /** |
|
675 | + * Returns whether or not there was a non-micro version change (ie, change in either |
|
676 | + * the first or second number in the version. Eg 4.9.0.rc.001 to 4.10.0.rc.000, |
|
677 | + * but not 4.9.0.rc.0001 to 4.9.1.rc.0001 |
|
678 | + * |
|
679 | + * @param $activation_history |
|
680 | + * @return bool |
|
681 | + */ |
|
682 | + private function _detect_major_version_change($activation_history) |
|
683 | + { |
|
684 | + $previous_version = EE_System::_get_most_recently_active_version_from_activation_history($activation_history); |
|
685 | + $previous_version_parts = explode('.', $previous_version); |
|
686 | + $current_version_parts = explode('.', espresso_version()); |
|
687 | + return isset($previous_version_parts[0], $previous_version_parts[1], $current_version_parts[0], $current_version_parts[1]) |
|
688 | + && ($previous_version_parts[0] !== $current_version_parts[0] |
|
689 | + || $previous_version_parts[1] !== $current_version_parts[1] |
|
690 | + ); |
|
691 | + } |
|
692 | + |
|
693 | + |
|
694 | + /** |
|
695 | + * Returns true if either the major or minor version of EE changed during this request. |
|
696 | + * Eg 4.9.0.rc.001 to 4.10.0.rc.000, but not 4.9.0.rc.0001 to 4.9.1.rc.0001 |
|
697 | + * |
|
698 | + * @return bool |
|
699 | + */ |
|
700 | + public function is_major_version_change() |
|
701 | + { |
|
702 | + return $this->_major_version_change; |
|
703 | + } |
|
704 | + |
|
705 | + |
|
706 | + /** |
|
707 | + * Determines the request type for any ee addon, given three piece of info: the current array of activation |
|
708 | + * histories (for core that' 'espresso_db_update' wp option); the name of the WordPress option which is temporarily |
|
709 | + * set upon activation of the plugin (for core it's 'ee_espresso_activation'); and the version that this plugin was |
|
710 | + * just activated to (for core that will always be espresso_version()) |
|
711 | + * |
|
712 | + * @param array $activation_history_for_addon the option's value which stores the activation history for this |
|
713 | + * ee plugin. for core that's 'espresso_db_update' |
|
714 | + * @param string $activation_indicator_option_name the name of the WordPress option that is temporarily set to |
|
715 | + * indicate that this plugin was just activated |
|
716 | + * @param string $version_to_upgrade_to the version that was just upgraded to (for core that will be |
|
717 | + * espresso_version()) |
|
718 | + * @return int one of the constants on EE_System::req_type_* |
|
719 | + */ |
|
720 | + public static function detect_req_type_given_activation_history( |
|
721 | + $activation_history_for_addon, |
|
722 | + $activation_indicator_option_name, |
|
723 | + $version_to_upgrade_to |
|
724 | + ) { |
|
725 | + $version_is_higher = self::_new_version_is_higher($activation_history_for_addon, $version_to_upgrade_to); |
|
726 | + if ($activation_history_for_addon) { |
|
727 | + // it exists, so this isn't a completely new install |
|
728 | + // check if this version already in that list of previously installed versions |
|
729 | + if (! isset($activation_history_for_addon[ $version_to_upgrade_to ])) { |
|
730 | + // it a version we haven't seen before |
|
731 | + if ($version_is_higher === 1) { |
|
732 | + $req_type = EE_System::req_type_upgrade; |
|
733 | + } else { |
|
734 | + $req_type = EE_System::req_type_downgrade; |
|
735 | + } |
|
736 | + delete_option($activation_indicator_option_name); |
|
737 | + } else { |
|
738 | + // its not an update. maybe a reactivation? |
|
739 | + if (get_option($activation_indicator_option_name, false)) { |
|
740 | + if ($version_is_higher === -1) { |
|
741 | + $req_type = EE_System::req_type_downgrade; |
|
742 | + } elseif ($version_is_higher === 0) { |
|
743 | + // we've seen this version before, but it's an activation. must be a reactivation |
|
744 | + $req_type = EE_System::req_type_reactivation; |
|
745 | + } else {// $version_is_higher === 1 |
|
746 | + $req_type = EE_System::req_type_upgrade; |
|
747 | + } |
|
748 | + delete_option($activation_indicator_option_name); |
|
749 | + } else { |
|
750 | + // we've seen this version before and the activation indicate doesn't show it was just activated |
|
751 | + if ($version_is_higher === -1) { |
|
752 | + $req_type = EE_System::req_type_downgrade; |
|
753 | + } elseif ($version_is_higher === 0) { |
|
754 | + // we've seen this version before and it's not an activation. its normal request |
|
755 | + $req_type = EE_System::req_type_normal; |
|
756 | + } else {// $version_is_higher === 1 |
|
757 | + $req_type = EE_System::req_type_upgrade; |
|
758 | + } |
|
759 | + } |
|
760 | + } |
|
761 | + } else { |
|
762 | + // brand new install |
|
763 | + $req_type = EE_System::req_type_new_activation; |
|
764 | + delete_option($activation_indicator_option_name); |
|
765 | + } |
|
766 | + return $req_type; |
|
767 | + } |
|
768 | + |
|
769 | + |
|
770 | + /** |
|
771 | + * Detects if the $version_to_upgrade_to is higher than the most recent version in |
|
772 | + * the $activation_history_for_addon |
|
773 | + * |
|
774 | + * @param array $activation_history_for_addon (keys are versions, values are arrays of times activated, |
|
775 | + * sometimes containing 'unknown-date' |
|
776 | + * @param string $version_to_upgrade_to (current version) |
|
777 | + * @return int results of version_compare( $version_to_upgrade_to, $most_recently_active_version ). |
|
778 | + * ie, -1 if $version_to_upgrade_to is LOWER (downgrade); |
|
779 | + * 0 if $version_to_upgrade_to MATCHES (reactivation or normal request); |
|
780 | + * 1 if $version_to_upgrade_to is HIGHER (upgrade) ; |
|
781 | + */ |
|
782 | + private static function _new_version_is_higher($activation_history_for_addon, $version_to_upgrade_to) |
|
783 | + { |
|
784 | + // find the most recently-activated version |
|
785 | + $most_recently_active_version = |
|
786 | + EE_System::_get_most_recently_active_version_from_activation_history($activation_history_for_addon); |
|
787 | + return version_compare($version_to_upgrade_to, $most_recently_active_version); |
|
788 | + } |
|
789 | + |
|
790 | + |
|
791 | + /** |
|
792 | + * Gets the most recently active version listed in the activation history, |
|
793 | + * and if none are found (ie, it's a brand new install) returns '0.0.0.dev.000'. |
|
794 | + * |
|
795 | + * @param array $activation_history (keys are versions, values are arrays of times activated, |
|
796 | + * sometimes containing 'unknown-date' |
|
797 | + * @return string |
|
798 | + */ |
|
799 | + private static function _get_most_recently_active_version_from_activation_history($activation_history) |
|
800 | + { |
|
801 | + $most_recently_active_version_activation = '1970-01-01 00:00:00'; |
|
802 | + $most_recently_active_version = '0.0.0.dev.000'; |
|
803 | + if (is_array($activation_history)) { |
|
804 | + foreach ($activation_history as $version => $times_activated) { |
|
805 | + // check there is a record of when this version was activated. Otherwise, |
|
806 | + // mark it as unknown |
|
807 | + if (! $times_activated) { |
|
808 | + $times_activated = array('unknown-date'); |
|
809 | + } |
|
810 | + if (is_string($times_activated)) { |
|
811 | + $times_activated = array($times_activated); |
|
812 | + } |
|
813 | + foreach ($times_activated as $an_activation) { |
|
814 | + if ( |
|
815 | + $an_activation !== 'unknown-date' |
|
816 | + && $an_activation |
|
817 | + > $most_recently_active_version_activation |
|
818 | + ) { |
|
819 | + $most_recently_active_version = $version; |
|
820 | + $most_recently_active_version_activation = $an_activation === 'unknown-date' |
|
821 | + ? '1970-01-01 00:00:00' |
|
822 | + : $an_activation; |
|
823 | + } |
|
824 | + } |
|
825 | + } |
|
826 | + } |
|
827 | + return $most_recently_active_version; |
|
828 | + } |
|
829 | + |
|
830 | + |
|
831 | + /** |
|
832 | + * This redirects to the about EE page after activation |
|
833 | + * |
|
834 | + * @return void |
|
835 | + */ |
|
836 | + public function redirect_to_about_ee() |
|
837 | + { |
|
838 | + $notices = EE_Error::get_notices(false); |
|
839 | + // if current user is an admin and it's not an ajax or rest request |
|
840 | + if ( |
|
841 | + ! isset($notices['errors']) |
|
842 | + && $this->request->isAdmin() |
|
843 | + && apply_filters( |
|
844 | + 'FHEE__EE_System__redirect_to_about_ee__do_redirect', |
|
845 | + $this->capabilities->current_user_can('manage_options', 'espresso_about_default') |
|
846 | + ) |
|
847 | + ) { |
|
848 | + $query_params = array('page' => 'espresso_about'); |
|
849 | + if (EE_System::instance()->detect_req_type() === EE_System::req_type_new_activation) { |
|
850 | + $query_params['new_activation'] = true; |
|
851 | + } |
|
852 | + if (EE_System::instance()->detect_req_type() === EE_System::req_type_reactivation) { |
|
853 | + $query_params['reactivation'] = true; |
|
854 | + } |
|
855 | + $url = add_query_arg($query_params, admin_url('admin.php')); |
|
856 | + wp_safe_redirect($url); |
|
857 | + exit(); |
|
858 | + } |
|
859 | + } |
|
860 | + |
|
861 | + |
|
862 | + /** |
|
863 | + * load_core_configuration |
|
864 | + * this is hooked into 'AHEE__EE_Bootstrap__load_core_configuration' |
|
865 | + * which runs during the WP 'plugins_loaded' action at priority 5 |
|
866 | + * |
|
867 | + * @return void |
|
868 | + * @throws ReflectionException |
|
869 | + * @throws Exception |
|
870 | + */ |
|
871 | + public function load_core_configuration() |
|
872 | + { |
|
873 | + do_action('AHEE__EE_System__load_core_configuration__begin', $this); |
|
874 | + $this->loader->getShared('EE_Load_Textdomain'); |
|
875 | + // load textdomain |
|
876 | + EE_Load_Textdomain::load_textdomain(); |
|
877 | + // load caf stuff a chance to play during the activation process too. |
|
878 | + $this->_maybe_brew_regular(); |
|
879 | + // load and setup EE_Config and EE_Network_Config |
|
880 | + $config = $this->loader->getShared('EE_Config'); |
|
881 | + $this->loader->getShared('EE_Network_Config'); |
|
882 | + // setup autoloaders |
|
883 | + // enable logging? |
|
884 | + $this->loader->getShared('EventEspresso\core\services\orm\TrashLogger'); |
|
885 | + if ($config->admin->use_remote_logging) { |
|
886 | + $this->loader->getShared('EE_Log'); |
|
887 | + } |
|
888 | + // check for activation errors |
|
889 | + $activation_errors = get_option('ee_plugin_activation_errors', false); |
|
890 | + if ($activation_errors) { |
|
891 | + EE_Error::add_error($activation_errors, __FILE__, __FUNCTION__, __LINE__); |
|
892 | + update_option('ee_plugin_activation_errors', false); |
|
893 | + } |
|
894 | + // get model names |
|
895 | + $this->_parse_model_names(); |
|
896 | + // configure custom post type definitions |
|
897 | + $this->loader->getShared('EventEspresso\core\domain\entities\custom_post_types\CustomTaxonomyDefinitions'); |
|
898 | + $this->loader->getShared('EventEspresso\core\domain\entities\custom_post_types\CustomPostTypeDefinitions'); |
|
899 | + do_action('AHEE__EE_System__load_core_configuration__complete', $this); |
|
900 | + } |
|
901 | + |
|
902 | + |
|
903 | + /** |
|
904 | + * cycles through all of the models/*.model.php files, and assembles an array of model names |
|
905 | + * |
|
906 | + * @return void |
|
907 | + * @throws ReflectionException |
|
908 | + */ |
|
909 | + private function _parse_model_names() |
|
910 | + { |
|
911 | + // get all the files in the EE_MODELS folder that end in .model.php |
|
912 | + $models = glob(EE_MODELS . '*.model.php'); |
|
913 | + $model_names = array(); |
|
914 | + $non_abstract_db_models = array(); |
|
915 | + foreach ($models as $model) { |
|
916 | + // get model classname |
|
917 | + $classname = EEH_File::get_classname_from_filepath_with_standard_filename($model); |
|
918 | + $short_name = str_replace('EEM_', '', $classname); |
|
919 | + $reflectionClass = new ReflectionClass($classname); |
|
920 | + if ($reflectionClass->isSubclassOf('EEM_Base') && ! $reflectionClass->isAbstract()) { |
|
921 | + $non_abstract_db_models[ $short_name ] = $classname; |
|
922 | + } |
|
923 | + $model_names[ $short_name ] = $classname; |
|
924 | + } |
|
925 | + $this->registry->models = apply_filters('FHEE__EE_System__parse_model_names', $model_names); |
|
926 | + $this->registry->non_abstract_db_models = apply_filters( |
|
927 | + 'FHEE__EE_System__parse_implemented_model_names', |
|
928 | + $non_abstract_db_models |
|
929 | + ); |
|
930 | + } |
|
931 | + |
|
932 | + |
|
933 | + /** |
|
934 | + * The purpose of this method is to simply check for a file named "caffeinated/brewing_regular.php" for any hooks |
|
935 | + * that need to be setup before our EE_System launches. |
|
936 | + * |
|
937 | + * @return void |
|
938 | + * @throws DomainException |
|
939 | + * @throws InvalidArgumentException |
|
940 | + * @throws InvalidDataTypeException |
|
941 | + * @throws InvalidInterfaceException |
|
942 | + * @throws InvalidClassException |
|
943 | + * @throws InvalidFilePathException |
|
944 | + */ |
|
945 | + private function _maybe_brew_regular() |
|
946 | + { |
|
947 | + /** @var Domain $domain */ |
|
948 | + $domain = DomainFactory::getShared( |
|
949 | + new FullyQualifiedName( |
|
950 | + 'EventEspresso\core\domain\Domain' |
|
951 | + ), |
|
952 | + array( |
|
953 | + new FilePath(EVENT_ESPRESSO_MAIN_FILE), |
|
954 | + Version::fromString(espresso_version()), |
|
955 | + ) |
|
956 | + ); |
|
957 | + if ($domain->isCaffeinated()) { |
|
958 | + require_once EE_CAFF_PATH . 'brewing_regular.php'; |
|
959 | + } |
|
960 | + } |
|
961 | + |
|
962 | + |
|
963 | + /** |
|
964 | + * @since 4.9.71.p |
|
965 | + * @throws Exception |
|
966 | + */ |
|
967 | + public function loadRouteMatchSpecifications() |
|
968 | + { |
|
969 | + try { |
|
970 | + $this->loader->getShared( |
|
971 | + 'EventEspresso\core\services\route_match\RouteMatchSpecificationManager' |
|
972 | + ); |
|
973 | + } catch (Exception $exception) { |
|
974 | + new ExceptionStackTraceDisplay($exception); |
|
975 | + } |
|
976 | + do_action('AHEE__EE_System__loadRouteMatchSpecifications'); |
|
977 | + } |
|
978 | + |
|
979 | + |
|
980 | + /** |
|
981 | + * loading CPT related classes earlier so that their definitions are available |
|
982 | + * but not performing any actual registration with WP core until load_CPTs_and_session() is called |
|
983 | + * |
|
984 | + * @since 4.10.21.p |
|
985 | + */ |
|
986 | + public function loadCustomPostTypes() |
|
987 | + { |
|
988 | + $this->register_custom_taxonomies = $this->loader->getShared( |
|
989 | + 'EventEspresso\core\domain\services\custom_post_types\RegisterCustomTaxonomies' |
|
990 | + ); |
|
991 | + $this->register_custom_post_types = $this->loader->getShared( |
|
992 | + 'EventEspresso\core\domain\services\custom_post_types\RegisterCustomPostTypes' |
|
993 | + ); |
|
994 | + $this->register_custom_taxonomy_terms = $this->loader->getShared( |
|
995 | + 'EventEspresso\core\domain\services\custom_post_types\RegisterCustomTaxonomyTerms' |
|
996 | + ); |
|
997 | + // integrate WP_Query with the EE models |
|
998 | + $this->loader->getShared('EE_CPT_Strategy'); |
|
999 | + // load legacy EE_Request_Handler in case add-ons still need it |
|
1000 | + $this->loader->getShared('EE_Request_Handler'); |
|
1001 | + } |
|
1002 | + |
|
1003 | + |
|
1004 | + /** |
|
1005 | + * register_shortcodes_modules_and_widgets |
|
1006 | + * generate lists of shortcodes and modules, then verify paths and classes |
|
1007 | + * This is hooked into 'AHEE__EE_Bootstrap__register_shortcodes_modules_and_widgets' |
|
1008 | + * which runs during the WP 'plugins_loaded' action at priority 7 |
|
1009 | + * |
|
1010 | + * @access public |
|
1011 | + * @return void |
|
1012 | + * @throws Exception |
|
1013 | + */ |
|
1014 | + public function register_shortcodes_modules_and_widgets() |
|
1015 | + { |
|
1016 | + if ($this->request->isFrontend() || $this->request->isIframe() || $this->request->isAjax()) { |
|
1017 | + // load, register, and add shortcodes the new way |
|
1018 | + $this->loader->getShared('EventEspresso\core\services\shortcodes\ShortcodesManager'); |
|
1019 | + } |
|
1020 | + do_action('AHEE__EE_System__register_shortcodes_modules_and_widgets'); |
|
1021 | + // check for addons using old hook point |
|
1022 | + if (has_action('AHEE__EE_System__register_shortcodes_modules_and_addons')) { |
|
1023 | + $this->_incompatible_addon_error(); |
|
1024 | + } |
|
1025 | + } |
|
1026 | + |
|
1027 | + |
|
1028 | + /** |
|
1029 | + * _incompatible_addon_error |
|
1030 | + * |
|
1031 | + * @access public |
|
1032 | + * @return void |
|
1033 | + */ |
|
1034 | + private function _incompatible_addon_error() |
|
1035 | + { |
|
1036 | + // get array of classes hooking into here |
|
1037 | + $class_names = EEH_Class_Tools::get_class_names_for_all_callbacks_on_hook( |
|
1038 | + 'AHEE__EE_System__register_shortcodes_modules_and_addons' |
|
1039 | + ); |
|
1040 | + if (! empty($class_names)) { |
|
1041 | + $msg = esc_html__( |
|
1042 | + 'The following plugins, addons, or modules appear to be incompatible with this version of Event Espresso and were automatically deactivated to avoid fatal errors:', |
|
1043 | + 'event_espresso' |
|
1044 | + ); |
|
1045 | + $msg .= '<ul>'; |
|
1046 | + foreach ($class_names as $class_name) { |
|
1047 | + $msg .= '<li><b>Event Espresso - ' |
|
1048 | + . str_replace( |
|
1049 | + array('EE_', 'EEM_', 'EED_', 'EES_', 'EEW_'), |
|
1050 | + '', |
|
1051 | + $class_name |
|
1052 | + ) . '</b></li>'; |
|
1053 | + } |
|
1054 | + $msg .= '</ul>'; |
|
1055 | + $msg .= esc_html__( |
|
1056 | + 'Compatibility issues can be avoided and/or resolved by keeping addons and plugins updated to the latest version.', |
|
1057 | + 'event_espresso' |
|
1058 | + ); |
|
1059 | + // save list of incompatible addons to wp-options for later use |
|
1060 | + add_option('ee_incompatible_addons', $class_names, '', 'no'); |
|
1061 | + if (is_admin()) { |
|
1062 | + EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
|
1063 | + } |
|
1064 | + } |
|
1065 | + } |
|
1066 | + |
|
1067 | + |
|
1068 | + /** |
|
1069 | + * brew_espresso |
|
1070 | + * begins the process of setting hooks for initializing EE in the correct order |
|
1071 | + * This is happening on the 'AHEE__EE_Bootstrap__brew_espresso' hook point |
|
1072 | + * which runs during the WP 'plugins_loaded' action at priority 9 |
|
1073 | + * |
|
1074 | + * @return void |
|
1075 | + */ |
|
1076 | + public function brew_espresso() |
|
1077 | + { |
|
1078 | + do_action('AHEE__EE_System__brew_espresso__begin', $this); |
|
1079 | + // load some final core systems |
|
1080 | + add_action('init', array($this, 'set_hooks_for_core'), 1); |
|
1081 | + add_action('init', array($this, 'perform_activations_upgrades_and_migrations'), 3); |
|
1082 | + add_action('init', array($this, 'load_CPTs_and_session'), 5); |
|
1083 | + add_action('init', array($this, 'load_controllers'), 7); |
|
1084 | + add_action('init', array($this, 'core_loaded_and_ready'), 9); |
|
1085 | + add_action('init', array($this, 'initialize'), 10); |
|
1086 | + add_action('init', array($this, 'initialize_last'), 100); |
|
1087 | + if (is_admin() && apply_filters('FHEE__EE_System__brew_espresso__load_pue', true)) { |
|
1088 | + // pew pew pew |
|
1089 | + $this->loader->getShared('EventEspresso\core\services\licensing\LicenseService'); |
|
1090 | + do_action('AHEE__EE_System__brew_espresso__after_pue_init'); |
|
1091 | + } |
|
1092 | + do_action('AHEE__EE_System__brew_espresso__complete', $this); |
|
1093 | + } |
|
1094 | + |
|
1095 | + |
|
1096 | + /** |
|
1097 | + * set_hooks_for_core |
|
1098 | + * |
|
1099 | + * @access public |
|
1100 | + * @return void |
|
1101 | + * @throws EE_Error |
|
1102 | + */ |
|
1103 | + public function set_hooks_for_core() |
|
1104 | + { |
|
1105 | + $this->_deactivate_incompatible_addons(); |
|
1106 | + do_action('AHEE__EE_System__set_hooks_for_core'); |
|
1107 | + $this->loader->getShared('EventEspresso\core\domain\values\session\SessionLifespan'); |
|
1108 | + // caps need to be initialized on every request so that capability maps are set. |
|
1109 | + // @see https://events.codebasehq.com/projects/event-espresso/tickets/8674 |
|
1110 | + $this->registry->CAP->init_caps(); |
|
1111 | + } |
|
1112 | + |
|
1113 | + |
|
1114 | + /** |
|
1115 | + * Using the information gathered in EE_System::_incompatible_addon_error, |
|
1116 | + * deactivates any addons considered incompatible with the current version of EE |
|
1117 | + */ |
|
1118 | + private function _deactivate_incompatible_addons() |
|
1119 | + { |
|
1120 | + $incompatible_addons = get_option('ee_incompatible_addons', array()); |
|
1121 | + if (! empty($incompatible_addons)) { |
|
1122 | + $active_plugins = get_option('active_plugins', array()); |
|
1123 | + foreach ($active_plugins as $active_plugin) { |
|
1124 | + foreach ($incompatible_addons as $incompatible_addon) { |
|
1125 | + if (strpos($active_plugin, $incompatible_addon) !== false) { |
|
1126 | + $this->request->unSetRequestParams(['activate'], true); |
|
1127 | + espresso_deactivate_plugin($active_plugin); |
|
1128 | + } |
|
1129 | + } |
|
1130 | + } |
|
1131 | + } |
|
1132 | + } |
|
1133 | + |
|
1134 | + |
|
1135 | + /** |
|
1136 | + * perform_activations_upgrades_and_migrations |
|
1137 | + * |
|
1138 | + * @access public |
|
1139 | + * @return void |
|
1140 | + */ |
|
1141 | + public function perform_activations_upgrades_and_migrations() |
|
1142 | + { |
|
1143 | + do_action('AHEE__EE_System__perform_activations_upgrades_and_migrations'); |
|
1144 | + } |
|
1145 | + |
|
1146 | + |
|
1147 | + /** |
|
1148 | + * @return void |
|
1149 | + * @throws DomainException |
|
1150 | + */ |
|
1151 | + public function load_CPTs_and_session() |
|
1152 | + { |
|
1153 | + do_action('AHEE__EE_System__load_CPTs_and_session__start'); |
|
1154 | + $this->register_custom_taxonomies->registerCustomTaxonomies(); |
|
1155 | + $this->register_custom_post_types->registerCustomPostTypes(); |
|
1156 | + $this->register_custom_taxonomy_terms->registerCustomTaxonomyTerms(); |
|
1157 | + // load legacy Custom Post Types and Taxonomies |
|
1158 | + $this->loader->getShared('EE_Register_CPTs'); |
|
1159 | + do_action('AHEE__EE_System__load_CPTs_and_session__complete'); |
|
1160 | + } |
|
1161 | + |
|
1162 | + |
|
1163 | + /** |
|
1164 | + * load_controllers |
|
1165 | + * this is the best place to load any additional controllers that needs access to EE core. |
|
1166 | + * it is expected that all basic core EE systems, that are not dependant on the current request are loaded at this |
|
1167 | + * time |
|
1168 | + * |
|
1169 | + * @access public |
|
1170 | + * @return void |
|
1171 | + */ |
|
1172 | + public function load_controllers() |
|
1173 | + { |
|
1174 | + do_action('AHEE__EE_System__load_controllers__start'); |
|
1175 | + // let's get it started |
|
1176 | + if ( |
|
1177 | + ! $this->maintenance_mode->level() |
|
1178 | + && ($this->request->isFrontend() || $this->request->isFrontAjax()) |
|
1179 | + ) { |
|
1180 | + do_action('AHEE__EE_System__load_controllers__load_front_controllers'); |
|
1181 | + $this->loader->getShared('EE_Front_Controller'); |
|
1182 | + } elseif ($this->request->isAdmin() || $this->request->isAdminAjax()) { |
|
1183 | + do_action('AHEE__EE_System__load_controllers__load_admin_controllers'); |
|
1184 | + $this->loader->getShared('EE_Admin'); |
|
1185 | + $this->loader->getShared( |
|
1186 | + 'EventEspresso\core\services\activation\plugin_prompt\DownloadPluginPromptManager' |
|
1187 | + ); |
|
1188 | + } elseif ($this->request->isWordPressHeartbeat()) { |
|
1189 | + $this->loader->getShared('EventEspresso\core\domain\services\admin\ajax\WordpressHeartbeat'); |
|
1190 | + } |
|
1191 | + do_action('AHEE__EE_System__load_controllers__complete'); |
|
1192 | + } |
|
1193 | + |
|
1194 | + |
|
1195 | + /** |
|
1196 | + * core_loaded_and_ready |
|
1197 | + * all of the basic EE core should be loaded at this point and available regardless of M-Mode |
|
1198 | + * |
|
1199 | + * @access public |
|
1200 | + * @return void |
|
1201 | + * @throws Exception |
|
1202 | + */ |
|
1203 | + public function core_loaded_and_ready() |
|
1204 | + { |
|
1205 | + if ( |
|
1206 | + $this->request->isAdmin() |
|
1207 | + || $this->request->isFrontend() |
|
1208 | + || $this->request->isIframe() |
|
1209 | + || $this->request->isWordPressApi() |
|
1210 | + ) { |
|
1211 | + try { |
|
1212 | + $this->loader->getShared('EventEspresso\core\services\assets\I18nRegistry', [[]]); |
|
1213 | + $this->loader->getShared('EventEspresso\core\services\assets\Registry'); |
|
1214 | + $this->loader->getShared('EventEspresso\core\domain\services\assets\CoreAssetManager'); |
|
1215 | + if ($this->canLoadBlocks()) { |
|
1216 | + $this->loader->getShared( |
|
1217 | + 'EventEspresso\core\services\editor\BlockRegistrationManager' |
|
1218 | + ); |
|
1219 | + } |
|
1220 | + } catch (Exception $exception) { |
|
1221 | + new ExceptionStackTraceDisplay($exception); |
|
1222 | + } |
|
1223 | + } |
|
1224 | + if ( |
|
1225 | + $this->request->isAdmin() |
|
1226 | + || $this->request->isEeAjax() |
|
1227 | + || $this->request->isFrontend() |
|
1228 | + ) { |
|
1229 | + $this->loader->getShared('EE_Session'); |
|
1230 | + } |
|
1231 | + do_action('AHEE__EE_System__core_loaded_and_ready'); |
|
1232 | + // always load template tags, because it's faster than checking if it's a front-end request, and many page |
|
1233 | + // builders require these even on the front-end |
|
1234 | + require_once EE_PUBLIC . 'template_tags.php'; |
|
1235 | + do_action('AHEE__EE_System__set_hooks_for_shortcodes_modules_and_addons'); |
|
1236 | + } |
|
1237 | + |
|
1238 | + |
|
1239 | + /** |
|
1240 | + * initialize |
|
1241 | + * this is the best place to begin initializing client code |
|
1242 | + * |
|
1243 | + * @access public |
|
1244 | + * @return void |
|
1245 | + */ |
|
1246 | + public function initialize() |
|
1247 | + { |
|
1248 | + do_action('AHEE__EE_System__initialize'); |
|
1249 | + add_filter( |
|
1250 | + 'safe_style_css', |
|
1251 | + function ($styles) { |
|
1252 | + $styles[] = 'display'; |
|
1253 | + $styles[] = 'visibility'; |
|
1254 | + $styles[] = 'position'; |
|
1255 | + $styles[] = 'top'; |
|
1256 | + $styles[] = 'right'; |
|
1257 | + $styles[] = 'bottom'; |
|
1258 | + $styles[] = 'left'; |
|
1259 | + $styles[] = 'resize'; |
|
1260 | + $styles[] = 'max-width'; |
|
1261 | + $styles[] = 'max-height'; |
|
1262 | + return $styles; |
|
1263 | + } |
|
1264 | + ); |
|
1265 | + } |
|
1266 | + |
|
1267 | + |
|
1268 | + /** |
|
1269 | + * initialize_last |
|
1270 | + * this is run really late during the WP init hook point, and ensures that mostly everything else that needs to |
|
1271 | + * initialize has done so |
|
1272 | + * |
|
1273 | + * @access public |
|
1274 | + * @return void |
|
1275 | + */ |
|
1276 | + public function initialize_last() |
|
1277 | + { |
|
1278 | + do_action('AHEE__EE_System__initialize_last'); |
|
1279 | + /** @var EventEspresso\core\domain\services\custom_post_types\RewriteRules $rewrite_rules */ |
|
1280 | + $rewrite_rules = $this->loader->getShared( |
|
1281 | + 'EventEspresso\core\domain\services\custom_post_types\RewriteRules' |
|
1282 | + ); |
|
1283 | + $rewrite_rules->flushRewriteRules(); |
|
1284 | + add_action('admin_bar_init', array($this, 'addEspressoToolbar')); |
|
1285 | + if ( |
|
1286 | + ($this->request->isAjax() || $this->request->isAdmin()) |
|
1287 | + && $this->maintenance_mode->models_can_query() |
|
1288 | + ) { |
|
1289 | + $this->loader->getShared('EventEspresso\core\services\privacy\export\PersonalDataExporterManager'); |
|
1290 | + $this->loader->getShared('EventEspresso\core\services\privacy\erasure\PersonalDataEraserManager'); |
|
1291 | + } |
|
1292 | + } |
|
1293 | + |
|
1294 | + |
|
1295 | + /** |
|
1296 | + * @return void |
|
1297 | + * @throws EE_Error |
|
1298 | + */ |
|
1299 | + public function addEspressoToolbar() |
|
1300 | + { |
|
1301 | + $this->loader->getShared( |
|
1302 | + 'EventEspresso\core\domain\services\admin\AdminToolBar', |
|
1303 | + array($this->registry->CAP) |
|
1304 | + ); |
|
1305 | + } |
|
1306 | + |
|
1307 | + |
|
1308 | + /** |
|
1309 | + * do_not_cache |
|
1310 | + * sets no cache headers and defines no cache constants for WP plugins |
|
1311 | + * |
|
1312 | + * @access public |
|
1313 | + * @return void |
|
1314 | + */ |
|
1315 | + public static function do_not_cache() |
|
1316 | + { |
|
1317 | + // set no cache constants |
|
1318 | + if (! defined('DONOTCACHEPAGE')) { |
|
1319 | + define('DONOTCACHEPAGE', true); |
|
1320 | + } |
|
1321 | + if (! defined('DONOTCACHCEOBJECT')) { |
|
1322 | + define('DONOTCACHCEOBJECT', true); |
|
1323 | + } |
|
1324 | + if (! defined('DONOTCACHEDB')) { |
|
1325 | + define('DONOTCACHEDB', true); |
|
1326 | + } |
|
1327 | + // add no cache headers |
|
1328 | + add_action('send_headers', array('EE_System', 'nocache_headers'), 10); |
|
1329 | + // plus a little extra for nginx and Google Chrome |
|
1330 | + add_filter('nocache_headers', array('EE_System', 'extra_nocache_headers'), 10, 1); |
|
1331 | + // prevent browsers from prefetching of the rel='next' link, because it may contain content that interferes with the registration process |
|
1332 | + remove_action('wp_head', 'adjacent_posts_rel_link_wp_head'); |
|
1333 | + } |
|
1334 | + |
|
1335 | + |
|
1336 | + /** |
|
1337 | + * extra_nocache_headers |
|
1338 | + * |
|
1339 | + * @access public |
|
1340 | + * @param $headers |
|
1341 | + * @return array |
|
1342 | + */ |
|
1343 | + public static function extra_nocache_headers($headers) |
|
1344 | + { |
|
1345 | + // for NGINX |
|
1346 | + $headers['X-Accel-Expires'] = 0; |
|
1347 | + // plus extra for Google Chrome since it doesn't seem to respect "no-cache", but WILL respect "no-store" |
|
1348 | + $headers['Cache-Control'] = 'no-store, no-cache, must-revalidate, max-age=0'; |
|
1349 | + return $headers; |
|
1350 | + } |
|
1351 | + |
|
1352 | + |
|
1353 | + /** |
|
1354 | + * nocache_headers |
|
1355 | + * |
|
1356 | + * @access public |
|
1357 | + * @return void |
|
1358 | + */ |
|
1359 | + public static function nocache_headers() |
|
1360 | + { |
|
1361 | + nocache_headers(); |
|
1362 | + } |
|
1363 | + |
|
1364 | + |
|
1365 | + /** |
|
1366 | + * simply hooks into "wp_list_pages_exclude" filter (for wp_list_pages method) and makes sure EE critical pages are |
|
1367 | + * never returned with the function. |
|
1368 | + * |
|
1369 | + * @param array $exclude_array any existing pages being excluded are in this array. |
|
1370 | + * @return array |
|
1371 | + */ |
|
1372 | + public function remove_pages_from_wp_list_pages($exclude_array) |
|
1373 | + { |
|
1374 | + return array_merge($exclude_array, $this->registry->CFG->core->get_critical_pages_array()); |
|
1375 | + } |
|
1376 | + |
|
1377 | + |
|
1378 | + /** |
|
1379 | + * Return whether blocks can be registered/loaded or not. |
|
1380 | + * @return bool |
|
1381 | + */ |
|
1382 | + private function canLoadBlocks() |
|
1383 | + { |
|
1384 | + return apply_filters('FHEE__EE_System__canLoadBlocks', true) |
|
1385 | + && function_exists('register_block_type') |
|
1386 | + // don't load blocks if in the Divi page builder editor context |
|
1387 | + // @see https://github.com/eventespresso/event-espresso-core/issues/814 |
|
1388 | + && ! $this->request->getRequestParam('et_fb', false); |
|
1389 | + } |
|
1390 | 1390 | } |
@@ -19,1176 +19,1176 @@ |
||
19 | 19 | */ |
20 | 20 | class EE_Dependency_Map |
21 | 21 | { |
22 | - /** |
|
23 | - * This means that the requested class dependency is not present in the dependency map |
|
24 | - */ |
|
25 | - const not_registered = 0; |
|
26 | - |
|
27 | - /** |
|
28 | - * This instructs class loaders to ALWAYS return a newly instantiated object for the requested class. |
|
29 | - */ |
|
30 | - const load_new_object = 1; |
|
31 | - |
|
32 | - /** |
|
33 | - * This instructs class loaders to return a previously instantiated and cached object for the requested class. |
|
34 | - * IF a previously instantiated object does not exist, a new one will be created and added to the cache. |
|
35 | - */ |
|
36 | - const load_from_cache = 2; |
|
37 | - |
|
38 | - /** |
|
39 | - * When registering a dependency, |
|
40 | - * this indicates to keep any existing dependencies that already exist, |
|
41 | - * and simply discard any new dependencies declared in the incoming data |
|
42 | - */ |
|
43 | - const KEEP_EXISTING_DEPENDENCIES = 0; |
|
44 | - |
|
45 | - /** |
|
46 | - * When registering a dependency, |
|
47 | - * this indicates to overwrite any existing dependencies that already exist using the incoming data |
|
48 | - */ |
|
49 | - const OVERWRITE_DEPENDENCIES = 1; |
|
50 | - |
|
51 | - |
|
52 | - /** |
|
53 | - * @type EE_Dependency_Map $_instance |
|
54 | - */ |
|
55 | - protected static $_instance; |
|
56 | - |
|
57 | - /** |
|
58 | - * @var ClassInterfaceCache $class_cache |
|
59 | - */ |
|
60 | - private $class_cache; |
|
61 | - |
|
62 | - /** |
|
63 | - * @type RequestInterface $request |
|
64 | - */ |
|
65 | - protected $request; |
|
66 | - |
|
67 | - /** |
|
68 | - * @type LegacyRequestInterface $legacy_request |
|
69 | - */ |
|
70 | - protected $legacy_request; |
|
71 | - |
|
72 | - /** |
|
73 | - * @type ResponseInterface $response |
|
74 | - */ |
|
75 | - protected $response; |
|
76 | - |
|
77 | - /** |
|
78 | - * @type LoaderInterface $loader |
|
79 | - */ |
|
80 | - protected $loader; |
|
81 | - |
|
82 | - /** |
|
83 | - * @type array $_dependency_map |
|
84 | - */ |
|
85 | - protected $_dependency_map = []; |
|
86 | - |
|
87 | - /** |
|
88 | - * @type array $_class_loaders |
|
89 | - */ |
|
90 | - protected $_class_loaders = []; |
|
91 | - |
|
92 | - |
|
93 | - /** |
|
94 | - * EE_Dependency_Map constructor. |
|
95 | - * |
|
96 | - * @param ClassInterfaceCache $class_cache |
|
97 | - */ |
|
98 | - protected function __construct(ClassInterfaceCache $class_cache) |
|
99 | - { |
|
100 | - $this->class_cache = $class_cache; |
|
101 | - do_action('EE_Dependency_Map____construct', $this); |
|
102 | - } |
|
103 | - |
|
104 | - |
|
105 | - /** |
|
106 | - * @return void |
|
107 | - */ |
|
108 | - public function initialize() |
|
109 | - { |
|
110 | - $this->_register_core_dependencies(); |
|
111 | - $this->_register_core_class_loaders(); |
|
112 | - $this->_register_core_aliases(); |
|
113 | - } |
|
114 | - |
|
115 | - |
|
116 | - /** |
|
117 | - * @singleton method used to instantiate class object |
|
118 | - * @param ClassInterfaceCache|null $class_cache |
|
119 | - * @return EE_Dependency_Map |
|
120 | - */ |
|
121 | - public static function instance(ClassInterfaceCache $class_cache = null) |
|
122 | - { |
|
123 | - // check if class object is instantiated, and instantiated properly |
|
124 | - if ( |
|
125 | - ! self::$_instance instanceof EE_Dependency_Map |
|
126 | - && $class_cache instanceof ClassInterfaceCache |
|
127 | - ) { |
|
128 | - self::$_instance = new EE_Dependency_Map($class_cache); |
|
129 | - } |
|
130 | - return self::$_instance; |
|
131 | - } |
|
132 | - |
|
133 | - |
|
134 | - /** |
|
135 | - * @param RequestInterface $request |
|
136 | - */ |
|
137 | - public function setRequest(RequestInterface $request) |
|
138 | - { |
|
139 | - $this->request = $request; |
|
140 | - } |
|
141 | - |
|
142 | - |
|
143 | - /** |
|
144 | - * @param LegacyRequestInterface $legacy_request |
|
145 | - */ |
|
146 | - public function setLegacyRequest(LegacyRequestInterface $legacy_request) |
|
147 | - { |
|
148 | - $this->legacy_request = $legacy_request; |
|
149 | - } |
|
150 | - |
|
151 | - |
|
152 | - /** |
|
153 | - * @param ResponseInterface $response |
|
154 | - */ |
|
155 | - public function setResponse(ResponseInterface $response) |
|
156 | - { |
|
157 | - $this->response = $response; |
|
158 | - } |
|
159 | - |
|
160 | - |
|
161 | - /** |
|
162 | - * @param LoaderInterface $loader |
|
163 | - */ |
|
164 | - public function setLoader(LoaderInterface $loader) |
|
165 | - { |
|
166 | - $this->loader = $loader; |
|
167 | - } |
|
168 | - |
|
169 | - |
|
170 | - /** |
|
171 | - * @param string $class |
|
172 | - * @param array $dependencies |
|
173 | - * @param int $overwrite |
|
174 | - * @return bool |
|
175 | - */ |
|
176 | - public static function register_dependencies( |
|
177 | - $class, |
|
178 | - array $dependencies, |
|
179 | - $overwrite = EE_Dependency_Map::KEEP_EXISTING_DEPENDENCIES |
|
180 | - ) { |
|
181 | - return self::$_instance->registerDependencies($class, $dependencies, $overwrite); |
|
182 | - } |
|
183 | - |
|
184 | - |
|
185 | - /** |
|
186 | - * Assigns an array of class names and corresponding load sources (new or cached) |
|
187 | - * to the class specified by the first parameter. |
|
188 | - * IMPORTANT !!! |
|
189 | - * The order of elements in the incoming $dependencies array MUST match |
|
190 | - * the order of the constructor parameters for the class in question. |
|
191 | - * This is especially important when overriding any existing dependencies that are registered. |
|
192 | - * the third parameter controls whether any duplicate dependencies are overwritten or not. |
|
193 | - * |
|
194 | - * @param string $class |
|
195 | - * @param array $dependencies |
|
196 | - * @param int $overwrite |
|
197 | - * @return bool |
|
198 | - */ |
|
199 | - public function registerDependencies( |
|
200 | - $class, |
|
201 | - array $dependencies, |
|
202 | - $overwrite = EE_Dependency_Map::KEEP_EXISTING_DEPENDENCIES |
|
203 | - ) { |
|
204 | - $class = trim($class, '\\'); |
|
205 | - $registered = false; |
|
206 | - if (empty(self::$_instance->_dependency_map[ $class ])) { |
|
207 | - self::$_instance->_dependency_map[ $class ] = []; |
|
208 | - } |
|
209 | - // we need to make sure that any aliases used when registering a dependency |
|
210 | - // get resolved to the correct class name |
|
211 | - foreach ($dependencies as $dependency => $load_source) { |
|
212 | - $alias = self::$_instance->getFqnForAlias($dependency); |
|
213 | - if ( |
|
214 | - $overwrite === EE_Dependency_Map::OVERWRITE_DEPENDENCIES |
|
215 | - || ! isset(self::$_instance->_dependency_map[ $class ][ $alias ]) |
|
216 | - ) { |
|
217 | - unset($dependencies[ $dependency ]); |
|
218 | - $dependencies[ $alias ] = $load_source; |
|
219 | - $registered = true; |
|
220 | - } |
|
221 | - } |
|
222 | - // now add our two lists of dependencies together. |
|
223 | - // using Union (+=) favours the arrays in precedence from left to right, |
|
224 | - // so $dependencies is NOT overwritten because it is listed first |
|
225 | - // ie: with A = B + C, entries in B take precedence over duplicate entries in C |
|
226 | - // Union is way faster than array_merge() but should be used with caution... |
|
227 | - // especially with numerically indexed arrays |
|
228 | - $dependencies += self::$_instance->_dependency_map[ $class ]; |
|
229 | - // now we need to ensure that the resulting dependencies |
|
230 | - // array only has the entries that are required for the class |
|
231 | - // so first count how many dependencies were originally registered for the class |
|
232 | - $dependency_count = count(self::$_instance->_dependency_map[ $class ]); |
|
233 | - // if that count is non-zero (meaning dependencies were already registered) |
|
234 | - self::$_instance->_dependency_map[ $class ] = $dependency_count |
|
235 | - // then truncate the final array to match that count |
|
236 | - ? array_slice($dependencies, 0, $dependency_count) |
|
237 | - // otherwise just take the incoming array because nothing previously existed |
|
238 | - : $dependencies; |
|
239 | - return $registered; |
|
240 | - } |
|
241 | - |
|
242 | - |
|
243 | - /** |
|
244 | - * @param string $class_name |
|
245 | - * @param string $loader |
|
246 | - * @param bool $overwrite |
|
247 | - * @return bool |
|
248 | - * @throws DomainException |
|
249 | - */ |
|
250 | - public static function register_class_loader($class_name, $loader = 'load_core', $overwrite = false) |
|
251 | - { |
|
252 | - if (! $loader instanceof Closure && strpos($class_name, '\\') !== false) { |
|
253 | - throw new DomainException( |
|
254 | - esc_html__('Don\'t use class loaders for FQCNs.', 'event_espresso') |
|
255 | - ); |
|
256 | - } |
|
257 | - // check that loader is callable or method starts with "load_" and exists in EE_Registry |
|
258 | - if ( |
|
259 | - ! is_callable($loader) |
|
260 | - && ( |
|
261 | - strpos($loader, 'load_') !== 0 |
|
262 | - || ! method_exists('EE_Registry', $loader) |
|
263 | - ) |
|
264 | - ) { |
|
265 | - throw new DomainException( |
|
266 | - sprintf( |
|
267 | - esc_html__( |
|
268 | - '"%1$s" is not a valid loader method on EE_Registry.', |
|
269 | - 'event_espresso' |
|
270 | - ), |
|
271 | - $loader |
|
272 | - ) |
|
273 | - ); |
|
274 | - } |
|
275 | - $class_name = self::$_instance->getFqnForAlias($class_name); |
|
276 | - if ($overwrite || ! isset(self::$_instance->_class_loaders[ $class_name ])) { |
|
277 | - self::$_instance->_class_loaders[ $class_name ] = $loader; |
|
278 | - return true; |
|
279 | - } |
|
280 | - return false; |
|
281 | - } |
|
282 | - |
|
283 | - |
|
284 | - /** |
|
285 | - * @return array |
|
286 | - */ |
|
287 | - public function dependency_map() |
|
288 | - { |
|
289 | - return $this->_dependency_map; |
|
290 | - } |
|
291 | - |
|
292 | - |
|
293 | - /** |
|
294 | - * returns TRUE if dependency map contains a listing for the provided class name |
|
295 | - * |
|
296 | - * @param string $class_name |
|
297 | - * @return boolean |
|
298 | - */ |
|
299 | - public function has($class_name = '') |
|
300 | - { |
|
301 | - // all legacy models have the same dependencies |
|
302 | - if (strpos($class_name, 'EEM_') === 0) { |
|
303 | - $class_name = 'LEGACY_MODELS'; |
|
304 | - } |
|
305 | - return isset($this->_dependency_map[ $class_name ]); |
|
306 | - } |
|
307 | - |
|
308 | - |
|
309 | - /** |
|
310 | - * returns TRUE if dependency map contains a listing for the provided class name AND dependency |
|
311 | - * |
|
312 | - * @param string $class_name |
|
313 | - * @param string $dependency |
|
314 | - * @return bool |
|
315 | - */ |
|
316 | - public function has_dependency_for_class($class_name = '', $dependency = '') |
|
317 | - { |
|
318 | - // all legacy models have the same dependencies |
|
319 | - if (strpos($class_name, 'EEM_') === 0) { |
|
320 | - $class_name = 'LEGACY_MODELS'; |
|
321 | - } |
|
322 | - $dependency = $this->getFqnForAlias($dependency, $class_name); |
|
323 | - return isset($this->_dependency_map[ $class_name ][ $dependency ]); |
|
324 | - } |
|
325 | - |
|
326 | - |
|
327 | - /** |
|
328 | - * returns loading strategy for whether a previously cached dependency should be loaded or a new instance returned |
|
329 | - * |
|
330 | - * @param string $class_name |
|
331 | - * @param string $dependency |
|
332 | - * @return int |
|
333 | - */ |
|
334 | - public function loading_strategy_for_class_dependency($class_name = '', $dependency = '') |
|
335 | - { |
|
336 | - // all legacy models have the same dependencies |
|
337 | - if (strpos($class_name, 'EEM_') === 0) { |
|
338 | - $class_name = 'LEGACY_MODELS'; |
|
339 | - } |
|
340 | - $dependency = $this->getFqnForAlias($dependency); |
|
341 | - return $this->has_dependency_for_class($class_name, $dependency) |
|
342 | - ? $this->_dependency_map[ $class_name ][ $dependency ] |
|
343 | - : EE_Dependency_Map::not_registered; |
|
344 | - } |
|
345 | - |
|
346 | - |
|
347 | - /** |
|
348 | - * @param string $class_name |
|
349 | - * @return string | Closure |
|
350 | - */ |
|
351 | - public function class_loader($class_name) |
|
352 | - { |
|
353 | - // all legacy models use load_model() |
|
354 | - if (strpos($class_name, 'EEM_') === 0) { |
|
355 | - return 'load_model'; |
|
356 | - } |
|
357 | - // EE_CPT_*_Strategy classes like EE_CPT_Event_Strategy, EE_CPT_Venue_Strategy, etc |
|
358 | - // perform strpos() first to avoid loading regex every time we load a class |
|
359 | - if ( |
|
360 | - strpos($class_name, 'EE_CPT_') === 0 |
|
361 | - && preg_match('/^EE_CPT_([a-zA-Z]+)_Strategy$/', $class_name) |
|
362 | - ) { |
|
363 | - return 'load_core'; |
|
364 | - } |
|
365 | - $class_name = $this->getFqnForAlias($class_name); |
|
366 | - return isset($this->_class_loaders[ $class_name ]) ? $this->_class_loaders[ $class_name ] : ''; |
|
367 | - } |
|
368 | - |
|
369 | - |
|
370 | - /** |
|
371 | - * @return array |
|
372 | - */ |
|
373 | - public function class_loaders() |
|
374 | - { |
|
375 | - return $this->_class_loaders; |
|
376 | - } |
|
377 | - |
|
378 | - |
|
379 | - /** |
|
380 | - * adds an alias for a classname |
|
381 | - * |
|
382 | - * @param string $fqcn the class name that should be used (concrete class to replace interface) |
|
383 | - * @param string $alias the class name that would be type hinted for (abstract parent or interface) |
|
384 | - * @param string $for_class the class that has the dependency (is type hinting for the interface) |
|
385 | - */ |
|
386 | - public function add_alias($fqcn, $alias, $for_class = '') |
|
387 | - { |
|
388 | - $this->class_cache->addAlias($fqcn, $alias, $for_class); |
|
389 | - } |
|
390 | - |
|
391 | - |
|
392 | - /** |
|
393 | - * Returns TRUE if the provided fully qualified name IS an alias |
|
394 | - * WHY? |
|
395 | - * Because if a class is type hinting for a concretion, |
|
396 | - * then why would we need to find another class to supply it? |
|
397 | - * ie: if a class asks for `Fully/Qualified/Namespace/SpecificClassName`, |
|
398 | - * then give it an instance of `Fully/Qualified/Namespace/SpecificClassName`. |
|
399 | - * Don't go looking for some substitute. |
|
400 | - * Whereas if a class is type hinting for an interface... |
|
401 | - * then we need to find an actual class to use. |
|
402 | - * So the interface IS the alias for some other FQN, |
|
403 | - * and we need to find out if `Fully/Qualified/Namespace/SomeInterface` |
|
404 | - * represents some other class. |
|
405 | - * |
|
406 | - * @param string $fqn |
|
407 | - * @param string $for_class |
|
408 | - * @return bool |
|
409 | - */ |
|
410 | - public function isAlias($fqn = '', $for_class = '') |
|
411 | - { |
|
412 | - return $this->class_cache->isAlias($fqn, $for_class); |
|
413 | - } |
|
414 | - |
|
415 | - |
|
416 | - /** |
|
417 | - * Returns a FQN for provided alias if one exists, otherwise returns the original $alias |
|
418 | - * functions recursively, so that multiple aliases can be used to drill down to a FQN |
|
419 | - * for example: |
|
420 | - * if the following two entries were added to the _aliases array: |
|
421 | - * array( |
|
422 | - * 'interface_alias' => 'some\namespace\interface' |
|
423 | - * 'some\namespace\interface' => 'some\namespace\classname' |
|
424 | - * ) |
|
425 | - * then one could use EE_Registry::instance()->create( 'interface_alias' ) |
|
426 | - * to load an instance of 'some\namespace\classname' |
|
427 | - * |
|
428 | - * @param string $alias |
|
429 | - * @param string $for_class |
|
430 | - * @return string |
|
431 | - */ |
|
432 | - public function getFqnForAlias($alias = '', $for_class = '') |
|
433 | - { |
|
434 | - return $this->class_cache->getFqnForAlias($alias, $for_class); |
|
435 | - } |
|
436 | - |
|
437 | - |
|
438 | - /** |
|
439 | - * Registers the core dependencies and whether a previously instantiated object should be loaded from the cache, |
|
440 | - * if one exists, or whether a new object should be generated every time the requested class is loaded. |
|
441 | - * This is done by using the following class constants: |
|
442 | - * EE_Dependency_Map::load_from_cache - loads previously instantiated object |
|
443 | - * EE_Dependency_Map::load_new_object - generates a new object every time |
|
444 | - */ |
|
445 | - protected function _register_core_dependencies() |
|
446 | - { |
|
447 | - $this->_dependency_map = [ |
|
448 | - 'EE_Admin' => [ |
|
449 | - 'EventEspresso\core\services\request\Request' => EE_Dependency_Map::load_from_cache, |
|
450 | - ], |
|
451 | - 'EE_Request_Handler' => [ |
|
452 | - 'EventEspresso\core\services\request\Request' => EE_Dependency_Map::load_from_cache, |
|
453 | - 'EventEspresso\core\services\request\Response' => EE_Dependency_Map::load_from_cache, |
|
454 | - ], |
|
455 | - 'EE_System' => [ |
|
456 | - 'EE_Registry' => EE_Dependency_Map::load_from_cache, |
|
457 | - 'EventEspresso\core\services\loaders\Loader' => EE_Dependency_Map::load_from_cache, |
|
458 | - 'EventEspresso\core\services\request\Request' => EE_Dependency_Map::load_from_cache, |
|
459 | - 'EE_Maintenance_Mode' => EE_Dependency_Map::load_from_cache, |
|
460 | - ], |
|
461 | - 'EE_Session' => [ |
|
462 | - 'EventEspresso\core\services\cache\TransientCacheStorage' => EE_Dependency_Map::load_from_cache, |
|
463 | - 'EventEspresso\core\domain\values\session\SessionLifespan' => EE_Dependency_Map::load_from_cache, |
|
464 | - 'EventEspresso\core\services\request\Request' => EE_Dependency_Map::load_from_cache, |
|
465 | - 'EventEspresso\core\services\session\SessionStartHandler' => EE_Dependency_Map::load_from_cache, |
|
466 | - 'EE_Encryption' => EE_Dependency_Map::load_from_cache, |
|
467 | - ], |
|
468 | - 'EE_Cart' => [ |
|
469 | - 'EE_Session' => EE_Dependency_Map::load_from_cache, |
|
470 | - ], |
|
471 | - 'EE_Front_Controller' => [ |
|
472 | - 'EE_Registry' => EE_Dependency_Map::load_from_cache, |
|
473 | - 'EventEspresso\core\services\request\CurrentPage' => EE_Dependency_Map::load_from_cache, |
|
474 | - 'EE_Module_Request_Router' => EE_Dependency_Map::load_from_cache, |
|
475 | - ], |
|
476 | - 'EE_Messenger_Collection_Loader' => [ |
|
477 | - 'EE_Messenger_Collection' => EE_Dependency_Map::load_new_object, |
|
478 | - ], |
|
479 | - 'EE_Message_Type_Collection_Loader' => [ |
|
480 | - 'EE_Message_Type_Collection' => EE_Dependency_Map::load_new_object, |
|
481 | - ], |
|
482 | - 'EE_Message_Resource_Manager' => [ |
|
483 | - 'EE_Messenger_Collection_Loader' => EE_Dependency_Map::load_new_object, |
|
484 | - 'EE_Message_Type_Collection_Loader' => EE_Dependency_Map::load_new_object, |
|
485 | - 'EEM_Message_Template_Group' => EE_Dependency_Map::load_from_cache, |
|
486 | - ], |
|
487 | - 'EE_Message_Factory' => [ |
|
488 | - 'EE_Message_Resource_Manager' => EE_Dependency_Map::load_from_cache, |
|
489 | - ], |
|
490 | - 'EE_messages' => [ |
|
491 | - 'EE_Message_Resource_Manager' => EE_Dependency_Map::load_from_cache, |
|
492 | - ], |
|
493 | - 'EE_Messages_Generator' => [ |
|
494 | - 'EE_Messages_Queue' => EE_Dependency_Map::load_new_object, |
|
495 | - 'EE_Messages_Data_Handler_Collection' => EE_Dependency_Map::load_new_object, |
|
496 | - 'EE_Message_Template_Group_Collection' => EE_Dependency_Map::load_new_object, |
|
497 | - 'EEH_Parse_Shortcodes' => EE_Dependency_Map::load_from_cache, |
|
498 | - ], |
|
499 | - 'EE_Messages_Processor' => [ |
|
500 | - 'EE_Message_Resource_Manager' => EE_Dependency_Map::load_from_cache, |
|
501 | - ], |
|
502 | - 'EE_Messages_Queue' => [ |
|
503 | - 'EE_Message_Repository' => EE_Dependency_Map::load_new_object, |
|
504 | - ], |
|
505 | - 'EE_Messages_Template_Defaults' => [ |
|
506 | - 'EEM_Message_Template_Group' => EE_Dependency_Map::load_from_cache, |
|
507 | - 'EEM_Message_Template' => EE_Dependency_Map::load_from_cache, |
|
508 | - ], |
|
509 | - 'EE_Message_To_Generate_From_Request' => [ |
|
510 | - 'EE_Message_Resource_Manager' => EE_Dependency_Map::load_from_cache, |
|
511 | - 'EventEspresso\core\services\request\Request' => EE_Dependency_Map::load_from_cache, |
|
512 | - ], |
|
513 | - 'EventEspresso\core\services\commands\CommandBus' => [ |
|
514 | - 'EventEspresso\core\services\commands\CommandHandlerManager' => EE_Dependency_Map::load_from_cache, |
|
515 | - ], |
|
516 | - 'EventEspresso\services\commands\CommandHandler' => [ |
|
517 | - 'EE_Registry' => EE_Dependency_Map::load_from_cache, |
|
518 | - 'CommandBusInterface' => EE_Dependency_Map::load_from_cache, |
|
519 | - ], |
|
520 | - 'EventEspresso\core\services\commands\CommandHandlerManager' => [ |
|
521 | - 'EventEspresso\core\services\loaders\Loader' => EE_Dependency_Map::load_from_cache, |
|
522 | - ], |
|
523 | - 'EventEspresso\core\services\commands\CompositeCommandHandler' => [ |
|
524 | - 'EventEspresso\core\services\commands\CommandBus' => EE_Dependency_Map::load_from_cache, |
|
525 | - 'EventEspresso\core\services\commands\CommandFactory' => EE_Dependency_Map::load_from_cache, |
|
526 | - ], |
|
527 | - 'EventEspresso\core\services\commands\CommandFactory' => [ |
|
528 | - 'EventEspresso\core\services\loaders\Loader' => EE_Dependency_Map::load_from_cache, |
|
529 | - ], |
|
530 | - 'EventEspresso\core\services\commands\middleware\CapChecker' => [ |
|
531 | - 'EventEspresso\core\domain\services\capabilities\CapabilitiesChecker' => EE_Dependency_Map::load_from_cache, |
|
532 | - ], |
|
533 | - 'EventEspresso\core\domain\services\capabilities\CapabilitiesChecker' => [ |
|
534 | - 'EE_Capabilities' => EE_Dependency_Map::load_from_cache, |
|
535 | - ], |
|
536 | - 'EventEspresso\core\domain\services\capabilities\RegistrationsCapChecker' => [ |
|
537 | - 'EE_Capabilities' => EE_Dependency_Map::load_from_cache, |
|
538 | - ], |
|
539 | - 'EventEspresso\core\domain\services\commands\registration\CreateRegistrationCommandHandler' => [ |
|
540 | - 'EventEspresso\core\domain\services\registration\CreateRegistrationService' => EE_Dependency_Map::load_from_cache, |
|
541 | - ], |
|
542 | - 'EventEspresso\core\domain\services\commands\registration\CopyRegistrationDetailsCommandHandler' => [ |
|
543 | - 'EventEspresso\core\domain\services\registration\CopyRegistrationService' => EE_Dependency_Map::load_from_cache, |
|
544 | - ], |
|
545 | - 'EventEspresso\core\domain\services\commands\registration\CopyRegistrationPaymentsCommandHandler' => [ |
|
546 | - 'EventEspresso\core\domain\services\registration\CopyRegistrationService' => EE_Dependency_Map::load_from_cache, |
|
547 | - ], |
|
548 | - 'EventEspresso\core\domain\services\commands\registration\CancelRegistrationAndTicketLineItemCommandHandler' => [ |
|
549 | - 'EventEspresso\core\domain\services\registration\CancelTicketLineItemService' => EE_Dependency_Map::load_from_cache, |
|
550 | - ], |
|
551 | - 'EventEspresso\core\domain\services\commands\registration\UpdateRegistrationAndTransactionAfterChangeCommandHandler' => [ |
|
552 | - 'EventEspresso\core\domain\services\registration\UpdateRegistrationService' => EE_Dependency_Map::load_from_cache, |
|
553 | - ], |
|
554 | - 'EventEspresso\core\domain\services\commands\ticket\CreateTicketLineItemCommandHandler' => [ |
|
555 | - 'EventEspresso\core\domain\services\ticket\CreateTicketLineItemService' => EE_Dependency_Map::load_from_cache, |
|
556 | - ], |
|
557 | - 'EventEspresso\core\domain\services\commands\ticket\CancelTicketLineItemCommandHandler' => [ |
|
558 | - 'EventEspresso\core\domain\services\ticket\CancelTicketLineItemService' => EE_Dependency_Map::load_from_cache, |
|
559 | - ], |
|
560 | - 'EventEspresso\core\domain\services\registration\CancelRegistrationService' => [ |
|
561 | - 'EventEspresso\core\domain\services\ticket\CancelTicketLineItemService' => EE_Dependency_Map::load_from_cache, |
|
562 | - ], |
|
563 | - 'EventEspresso\core\domain\services\commands\attendee\CreateAttendeeCommandHandler' => [ |
|
564 | - 'EEM_Attendee' => EE_Dependency_Map::load_from_cache, |
|
565 | - ], |
|
566 | - 'EventEspresso\core\services\database\TableManager' => [ |
|
567 | - 'EventEspresso\core\services\database\TableAnalysis' => EE_Dependency_Map::load_from_cache, |
|
568 | - ], |
|
569 | - 'EE_Data_Migration_Class_Base' => [ |
|
570 | - 'EventEspresso\core\services\database\TableAnalysis' => EE_Dependency_Map::load_from_cache, |
|
571 | - 'EventEspresso\core\services\database\TableManager' => EE_Dependency_Map::load_from_cache, |
|
572 | - ], |
|
573 | - 'EE_DMS_Core_4_1_0' => [ |
|
574 | - 'EventEspresso\core\services\database\TableAnalysis' => EE_Dependency_Map::load_from_cache, |
|
575 | - 'EventEspresso\core\services\database\TableManager' => EE_Dependency_Map::load_from_cache, |
|
576 | - ], |
|
577 | - 'EE_DMS_Core_4_2_0' => [ |
|
578 | - 'EventEspresso\core\services\database\TableAnalysis' => EE_Dependency_Map::load_from_cache, |
|
579 | - 'EventEspresso\core\services\database\TableManager' => EE_Dependency_Map::load_from_cache, |
|
580 | - ], |
|
581 | - 'EE_DMS_Core_4_3_0' => [ |
|
582 | - 'EventEspresso\core\services\database\TableAnalysis' => EE_Dependency_Map::load_from_cache, |
|
583 | - 'EventEspresso\core\services\database\TableManager' => EE_Dependency_Map::load_from_cache, |
|
584 | - ], |
|
585 | - 'EE_DMS_Core_4_4_0' => [ |
|
586 | - 'EventEspresso\core\services\database\TableAnalysis' => EE_Dependency_Map::load_from_cache, |
|
587 | - 'EventEspresso\core\services\database\TableManager' => EE_Dependency_Map::load_from_cache, |
|
588 | - ], |
|
589 | - 'EE_DMS_Core_4_5_0' => [ |
|
590 | - 'EventEspresso\core\services\database\TableAnalysis' => EE_Dependency_Map::load_from_cache, |
|
591 | - 'EventEspresso\core\services\database\TableManager' => EE_Dependency_Map::load_from_cache, |
|
592 | - ], |
|
593 | - 'EE_DMS_Core_4_6_0' => [ |
|
594 | - 'EventEspresso\core\services\database\TableAnalysis' => EE_Dependency_Map::load_from_cache, |
|
595 | - 'EventEspresso\core\services\database\TableManager' => EE_Dependency_Map::load_from_cache, |
|
596 | - ], |
|
597 | - 'EE_DMS_Core_4_7_0' => [ |
|
598 | - 'EventEspresso\core\services\database\TableAnalysis' => EE_Dependency_Map::load_from_cache, |
|
599 | - 'EventEspresso\core\services\database\TableManager' => EE_Dependency_Map::load_from_cache, |
|
600 | - ], |
|
601 | - 'EE_DMS_Core_4_8_0' => [ |
|
602 | - 'EventEspresso\core\services\database\TableAnalysis' => EE_Dependency_Map::load_from_cache, |
|
603 | - 'EventEspresso\core\services\database\TableManager' => EE_Dependency_Map::load_from_cache, |
|
604 | - ], |
|
605 | - 'EE_DMS_Core_4_9_0' => [ |
|
606 | - 'EventEspresso\core\services\database\TableAnalysis' => EE_Dependency_Map::load_from_cache, |
|
607 | - 'EventEspresso\core\services\database\TableManager' => EE_Dependency_Map::load_from_cache, |
|
608 | - ], |
|
609 | - 'EE_DMS_Core_4_10_0' => [ |
|
610 | - 'EventEspresso\core\services\database\TableAnalysis' => EE_Dependency_Map::load_from_cache, |
|
611 | - 'EventEspresso\core\services\database\TableManager' => EE_Dependency_Map::load_from_cache, |
|
612 | - 'EE_DMS_Core_4_9_0' => EE_Dependency_Map::load_from_cache, |
|
613 | - ], |
|
614 | - 'EventEspresso\core\services\assets\I18nRegistry' => [ |
|
615 | - 'EventEspresso\core\domain\Domain' => EE_Dependency_Map::load_from_cache, |
|
616 | - ], |
|
617 | - 'EventEspresso\core\services\assets\Registry' => [ |
|
618 | - 'EventEspresso\core\services\assets\AssetCollection' => EE_Dependency_Map::load_from_cache, |
|
619 | - 'EventEspresso\core\services\assets\I18nRegistry' => EE_Dependency_Map::load_from_cache, |
|
620 | - ], |
|
621 | - 'EventEspresso\core\domain\entities\shortcodes\EspressoCancelled' => [ |
|
622 | - 'EventEspresso\core\services\cache\PostRelatedCacheManager' => EE_Dependency_Map::load_from_cache, |
|
623 | - ], |
|
624 | - 'EventEspresso\core\domain\entities\shortcodes\EspressoCheckout' => [ |
|
625 | - 'EventEspresso\core\services\cache\PostRelatedCacheManager' => EE_Dependency_Map::load_from_cache, |
|
626 | - ], |
|
627 | - 'EventEspresso\core\domain\entities\shortcodes\EspressoEventAttendees' => [ |
|
628 | - 'EventEspresso\core\services\cache\PostRelatedCacheManager' => EE_Dependency_Map::load_from_cache, |
|
629 | - ], |
|
630 | - 'EventEspresso\core\domain\entities\shortcodes\EspressoEvents' => [ |
|
631 | - 'EventEspresso\core\services\cache\PostRelatedCacheManager' => EE_Dependency_Map::load_from_cache, |
|
632 | - ], |
|
633 | - 'EventEspresso\core\domain\entities\shortcodes\EspressoThankYou' => [ |
|
634 | - 'EventEspresso\core\services\cache\PostRelatedCacheManager' => EE_Dependency_Map::load_from_cache, |
|
635 | - ], |
|
636 | - 'EventEspresso\core\domain\entities\shortcodes\EspressoTicketSelector' => [ |
|
637 | - 'EventEspresso\core\services\cache\PostRelatedCacheManager' => EE_Dependency_Map::load_from_cache, |
|
638 | - ], |
|
639 | - 'EventEspresso\core\domain\entities\shortcodes\EspressoTxnPage' => [ |
|
640 | - 'EventEspresso\core\services\cache\PostRelatedCacheManager' => EE_Dependency_Map::load_from_cache, |
|
641 | - ], |
|
642 | - 'EventEspresso\core\services\cache\BasicCacheManager' => [ |
|
643 | - 'EventEspresso\core\services\cache\TransientCacheStorage' => EE_Dependency_Map::load_from_cache, |
|
644 | - ], |
|
645 | - 'EventEspresso\core\services\cache\PostRelatedCacheManager' => [ |
|
646 | - 'EventEspresso\core\services\cache\TransientCacheStorage' => EE_Dependency_Map::load_from_cache, |
|
647 | - ], |
|
648 | - 'EventEspresso\core\domain\services\validation\email\EmailValidationService' => [ |
|
649 | - 'EE_Registration_Config' => EE_Dependency_Map::load_from_cache, |
|
650 | - 'EventEspresso\core\services\loaders\Loader' => EE_Dependency_Map::load_from_cache, |
|
651 | - ], |
|
652 | - 'EventEspresso\core\domain\values\EmailAddress' => [ |
|
653 | - null, |
|
654 | - 'EventEspresso\core\domain\services\validation\email\EmailValidationService' => EE_Dependency_Map::load_from_cache, |
|
655 | - ], |
|
656 | - 'EventEspresso\core\services\orm\ModelFieldFactory' => [ |
|
657 | - 'EventEspresso\core\services\loaders\Loader' => EE_Dependency_Map::load_from_cache, |
|
658 | - ], |
|
659 | - 'LEGACY_MODELS' => [ |
|
660 | - null, |
|
661 | - 'EventEspresso\core\services\database\ModelFieldFactory' => EE_Dependency_Map::load_from_cache, |
|
662 | - ], |
|
663 | - 'EE_Module_Request_Router' => [ |
|
664 | - 'EventEspresso\core\services\request\Request' => EE_Dependency_Map::load_from_cache, |
|
665 | - ], |
|
666 | - 'EE_Registration_Processor' => [ |
|
667 | - 'EventEspresso\core\services\request\Request' => EE_Dependency_Map::load_from_cache, |
|
668 | - ], |
|
669 | - 'EventEspresso\core\services\notifications\PersistentAdminNoticeManager' => [ |
|
670 | - 'EventEspresso\core\domain\services\capabilities\CapabilitiesChecker' => EE_Dependency_Map::load_from_cache, |
|
671 | - 'EventEspresso\core\services\request\Request' => EE_Dependency_Map::load_from_cache, |
|
672 | - ], |
|
673 | - 'EventEspresso\core\services\licensing\LicenseService' => [ |
|
674 | - 'EventEspresso\core\domain\services\pue\Stats' => EE_Dependency_Map::load_from_cache, |
|
675 | - 'EventEspresso\core\domain\services\pue\Config' => EE_Dependency_Map::load_from_cache, |
|
676 | - ], |
|
677 | - 'EE_Admin_Transactions_List_Table' => [ |
|
678 | - null, |
|
679 | - 'EventEspresso\core\domain\values\session\SessionLifespan' => EE_Dependency_Map::load_from_cache, |
|
680 | - ], |
|
681 | - 'EventEspresso\core\domain\services\pue\Stats' => [ |
|
682 | - 'EventEspresso\core\domain\services\pue\Config' => EE_Dependency_Map::load_from_cache, |
|
683 | - 'EE_Maintenance_Mode' => EE_Dependency_Map::load_from_cache, |
|
684 | - 'EventEspresso\core\domain\services\pue\StatsGatherer' => EE_Dependency_Map::load_from_cache, |
|
685 | - ], |
|
686 | - 'EventEspresso\core\domain\services\pue\Config' => [ |
|
687 | - 'EE_Network_Config' => EE_Dependency_Map::load_from_cache, |
|
688 | - 'EE_Config' => EE_Dependency_Map::load_from_cache, |
|
689 | - ], |
|
690 | - 'EventEspresso\core\domain\services\pue\StatsGatherer' => [ |
|
691 | - 'EEM_Payment_Method' => EE_Dependency_Map::load_from_cache, |
|
692 | - 'EEM_Event' => EE_Dependency_Map::load_from_cache, |
|
693 | - 'EEM_Datetime' => EE_Dependency_Map::load_from_cache, |
|
694 | - 'EEM_Ticket' => EE_Dependency_Map::load_from_cache, |
|
695 | - 'EEM_Registration' => EE_Dependency_Map::load_from_cache, |
|
696 | - 'EEM_Transaction' => EE_Dependency_Map::load_from_cache, |
|
697 | - 'EE_Config' => EE_Dependency_Map::load_from_cache, |
|
698 | - ], |
|
699 | - 'EventEspresso\core\domain\services\admin\ExitModal' => [ |
|
700 | - 'EventEspresso\core\services\assets\Registry' => EE_Dependency_Map::load_from_cache, |
|
701 | - ], |
|
702 | - 'EventEspresso\core\domain\services\admin\PluginUpsells' => [ |
|
703 | - 'EventEspresso\core\domain\Domain' => EE_Dependency_Map::load_from_cache, |
|
704 | - ], |
|
705 | - 'EventEspresso\caffeinated\modules\recaptcha_invisible\InvisibleRecaptcha' => [ |
|
706 | - 'EE_Registration_Config' => EE_Dependency_Map::load_from_cache, |
|
707 | - 'EE_Session' => EE_Dependency_Map::load_from_cache, |
|
708 | - ], |
|
709 | - 'EventEspresso\caffeinated\modules\recaptcha_invisible\RecaptchaAdminSettings' => [ |
|
710 | - 'EE_Registration_Config' => EE_Dependency_Map::load_from_cache, |
|
711 | - ], |
|
712 | - 'EventEspresso\modules\ticket_selector\DisplayTicketSelector' => [ |
|
713 | - 'EventEspresso\core\services\request\Request' => EE_Dependency_Map::load_from_cache, |
|
714 | - 'EE_Ticket_Selector_Config' => EE_Dependency_Map::load_from_cache, |
|
715 | - ], |
|
716 | - 'EventEspresso\modules\ticket_selector\ProcessTicketSelector' => [ |
|
717 | - 'EE_Core_Config' => EE_Dependency_Map::load_from_cache, |
|
718 | - 'EventEspresso\core\services\request\Request' => EE_Dependency_Map::load_from_cache, |
|
719 | - 'EE_Session' => EE_Dependency_Map::load_from_cache, |
|
720 | - 'EEM_Ticket' => EE_Dependency_Map::load_from_cache, |
|
721 | - 'EventEspresso\modules\ticket_selector\TicketDatetimeAvailabilityTracker' => EE_Dependency_Map::load_from_cache, |
|
722 | - ], |
|
723 | - 'EventEspresso\modules\ticket_selector\TicketDatetimeAvailabilityTracker' => [ |
|
724 | - 'EEM_Datetime' => EE_Dependency_Map::load_from_cache, |
|
725 | - ], |
|
726 | - 'EventEspresso\core\domain\entities\custom_post_types\CustomPostTypeDefinitions' => [ |
|
727 | - 'EE_Core_Config' => EE_Dependency_Map::load_from_cache, |
|
728 | - 'EventEspresso\core\services\loaders\Loader' => EE_Dependency_Map::load_from_cache, |
|
729 | - ], |
|
730 | - 'EventEspresso\core\domain\services\custom_post_types\RegisterCustomPostTypes' => [ |
|
731 | - 'EventEspresso\core\domain\entities\custom_post_types\CustomPostTypeDefinitions' => EE_Dependency_Map::load_from_cache, |
|
732 | - ], |
|
733 | - 'EventEspresso\core\domain\services\custom_post_types\RegisterCustomTaxonomies' => [ |
|
734 | - 'EventEspresso\core\domain\entities\custom_post_types\CustomTaxonomyDefinitions' => EE_Dependency_Map::load_from_cache, |
|
735 | - ], |
|
736 | - 'EE_CPT_Strategy' => [ |
|
737 | - 'EventEspresso\core\domain\entities\custom_post_types\CustomPostTypeDefinitions' => EE_Dependency_Map::load_from_cache, |
|
738 | - 'EventEspresso\core\domain\entities\custom_post_types\CustomTaxonomyDefinitions' => EE_Dependency_Map::load_from_cache, |
|
739 | - ], |
|
740 | - 'EventEspresso\core\services\loaders\ObjectIdentifier' => [ |
|
741 | - 'EventEspresso\core\services\loaders\ClassInterfaceCache' => EE_Dependency_Map::load_from_cache, |
|
742 | - ], |
|
743 | - 'EventEspresso\core\domain\services\assets\CoreAssetManager' => [ |
|
744 | - 'EventEspresso\core\services\assets\AssetCollection' => EE_Dependency_Map::load_from_cache, |
|
745 | - 'EE_Currency_Config' => EE_Dependency_Map::load_from_cache, |
|
746 | - 'EE_Template_Config' => EE_Dependency_Map::load_from_cache, |
|
747 | - 'EventEspresso\core\domain\Domain' => EE_Dependency_Map::load_from_cache, |
|
748 | - 'EventEspresso\core\services\assets\Registry' => EE_Dependency_Map::load_from_cache, |
|
749 | - ], |
|
750 | - 'EventEspresso\core\domain\services\admin\privacy\policy\PrivacyPolicy' => [ |
|
751 | - 'EEM_Payment_Method' => EE_Dependency_Map::load_from_cache, |
|
752 | - 'EventEspresso\core\domain\values\session\SessionLifespan' => EE_Dependency_Map::load_from_cache, |
|
753 | - ], |
|
754 | - 'EventEspresso\core\domain\services\admin\privacy\export\ExportAttendee' => [ |
|
755 | - 'EEM_Attendee' => EE_Dependency_Map::load_from_cache, |
|
756 | - ], |
|
757 | - 'EventEspresso\core\domain\services\admin\privacy\export\ExportAttendeeBillingData' => [ |
|
758 | - 'EEM_Attendee' => EE_Dependency_Map::load_from_cache, |
|
759 | - 'EEM_Payment_Method' => EE_Dependency_Map::load_from_cache, |
|
760 | - ], |
|
761 | - 'EventEspresso\core\domain\services\admin\privacy\export\ExportCheckins' => [ |
|
762 | - 'EEM_Checkin' => EE_Dependency_Map::load_from_cache, |
|
763 | - ], |
|
764 | - 'EventEspresso\core\domain\services\admin\privacy\export\ExportRegistration' => [ |
|
765 | - 'EEM_Registration' => EE_Dependency_Map::load_from_cache, |
|
766 | - ], |
|
767 | - 'EventEspresso\core\domain\services\admin\privacy\export\ExportTransaction' => [ |
|
768 | - 'EEM_Transaction' => EE_Dependency_Map::load_from_cache, |
|
769 | - ], |
|
770 | - 'EventEspresso\core\domain\services\admin\privacy\erasure\EraseAttendeeData' => [ |
|
771 | - 'EEM_Attendee' => EE_Dependency_Map::load_from_cache, |
|
772 | - ], |
|
773 | - 'EventEspresso\core\domain\services\admin\privacy\erasure\EraseAnswers' => [ |
|
774 | - 'EEM_Answer' => EE_Dependency_Map::load_from_cache, |
|
775 | - 'EEM_Question' => EE_Dependency_Map::load_from_cache, |
|
776 | - ], |
|
777 | - 'EventEspresso\core\CPTs\CptQueryModifier' => [ |
|
778 | - null, |
|
779 | - null, |
|
780 | - null, |
|
781 | - 'EventEspresso\core\services\request\CurrentPage' => EE_Dependency_Map::load_from_cache, |
|
782 | - 'EventEspresso\core\services\request\Request' => EE_Dependency_Map::load_from_cache, |
|
783 | - 'EventEspresso\core\services\loaders\Loader' => EE_Dependency_Map::load_from_cache, |
|
784 | - ], |
|
785 | - 'EventEspresso\core\domain\services\admin\privacy\forms\PrivacySettingsFormHandler' => [ |
|
786 | - 'EE_Registry' => EE_Dependency_Map::load_from_cache, |
|
787 | - 'EE_Config' => EE_Dependency_Map::load_from_cache, |
|
788 | - ], |
|
789 | - 'EventEspresso\core\services\editor\BlockRegistrationManager' => [ |
|
790 | - 'EventEspresso\core\services\assets\BlockAssetManagerCollection' => EE_Dependency_Map::load_from_cache, |
|
791 | - 'EventEspresso\core\domain\entities\editor\BlockCollection' => EE_Dependency_Map::load_from_cache, |
|
792 | - 'EventEspresso\core\services\route_match\RouteMatchSpecificationManager' => EE_Dependency_Map::load_from_cache, |
|
793 | - 'EventEspresso\core\services\request\Request' => EE_Dependency_Map::load_from_cache, |
|
794 | - ], |
|
795 | - 'EventEspresso\core\domain\entities\editor\CoreBlocksAssetManager' => [ |
|
796 | - 'EventEspresso\core\domain\Domain' => EE_Dependency_Map::load_from_cache, |
|
797 | - 'EventEspresso\core\services\assets\AssetCollection' => EE_Dependency_Map::load_from_cache, |
|
798 | - 'EventEspresso\core\services\assets\Registry' => EE_Dependency_Map::load_from_cache, |
|
799 | - ], |
|
800 | - 'EventEspresso\core\domain\services\blocks\EventAttendeesBlockRenderer' => [ |
|
801 | - 'EventEspresso\core\domain\Domain' => EE_Dependency_Map::load_from_cache, |
|
802 | - 'EEM_Attendee' => EE_Dependency_Map::load_from_cache, |
|
803 | - ], |
|
804 | - 'EventEspresso\core\domain\entities\editor\blocks\EventAttendees' => [ |
|
805 | - 'EventEspresso\core\domain\entities\editor\CoreBlocksAssetManager' => self::load_from_cache, |
|
806 | - 'EventEspresso\core\services\request\Request' => EE_Dependency_Map::load_from_cache, |
|
807 | - 'EventEspresso\core\domain\services\blocks\EventAttendeesBlockRenderer' => self::load_from_cache, |
|
808 | - ], |
|
809 | - 'EventEspresso\core\services\route_match\RouteMatchSpecificationDependencyResolver' => [ |
|
810 | - 'EventEspresso\core\services\container\Mirror' => EE_Dependency_Map::load_from_cache, |
|
811 | - 'EventEspresso\core\services\loaders\ClassInterfaceCache' => EE_Dependency_Map::load_from_cache, |
|
812 | - 'EE_Dependency_Map' => EE_Dependency_Map::load_from_cache, |
|
813 | - ], |
|
814 | - 'EventEspresso\core\services\route_match\RouteMatchSpecificationFactory' => [ |
|
815 | - 'EventEspresso\core\services\route_match\RouteMatchSpecificationDependencyResolver' => EE_Dependency_Map::load_from_cache, |
|
816 | - 'EventEspresso\core\services\loaders\Loader' => EE_Dependency_Map::load_from_cache, |
|
817 | - ], |
|
818 | - 'EventEspresso\core\services\route_match\RouteMatchSpecificationManager' => [ |
|
819 | - 'EventEspresso\core\services\route_match\RouteMatchSpecificationCollection' => EE_Dependency_Map::load_from_cache, |
|
820 | - 'EventEspresso\core\services\route_match\RouteMatchSpecificationFactory' => EE_Dependency_Map::load_from_cache, |
|
821 | - ], |
|
822 | - 'EventEspresso\core\libraries\rest_api\CalculatedModelFields' => [ |
|
823 | - 'EventEspresso\core\libraries\rest_api\calculations\CalculatedModelFieldsFactory' => EE_Dependency_Map::load_from_cache, |
|
824 | - ], |
|
825 | - 'EventEspresso\core\libraries\rest_api\calculations\CalculatedModelFieldsFactory' => [ |
|
826 | - 'EventEspresso\core\services\loaders\Loader' => EE_Dependency_Map::load_from_cache, |
|
827 | - ], |
|
828 | - 'EventEspresso\core\libraries\rest_api\controllers\model\Read' => [ |
|
829 | - 'EventEspresso\core\libraries\rest_api\CalculatedModelFields' => EE_Dependency_Map::load_from_cache, |
|
830 | - ], |
|
831 | - 'EventEspresso\core\libraries\rest_api\calculations\Datetime' => [ |
|
832 | - 'EEM_Datetime' => EE_Dependency_Map::load_from_cache, |
|
833 | - 'EEM_Registration' => EE_Dependency_Map::load_from_cache, |
|
834 | - ], |
|
835 | - 'EventEspresso\core\libraries\rest_api\calculations\Event' => [ |
|
836 | - 'EEM_Event' => EE_Dependency_Map::load_from_cache, |
|
837 | - 'EEM_Registration' => EE_Dependency_Map::load_from_cache, |
|
838 | - ], |
|
839 | - 'EventEspresso\core\libraries\rest_api\calculations\Registration' => [ |
|
840 | - 'EEM_Registration' => EE_Dependency_Map::load_from_cache, |
|
841 | - ], |
|
842 | - 'EventEspresso\core\services\session\SessionStartHandler' => [ |
|
843 | - 'EventEspresso\core\services\request\Request' => EE_Dependency_Map::load_from_cache, |
|
844 | - ], |
|
845 | - 'EE_URL_Validation_Strategy' => [ |
|
846 | - null, |
|
847 | - null, |
|
848 | - 'EventEspresso\core\services\validators\URLValidator' => EE_Dependency_Map::load_from_cache, |
|
849 | - ], |
|
850 | - 'EventEspresso\admin_pages\general_settings\OrganizationSettings' => [ |
|
851 | - 'EE_Registry' => EE_Dependency_Map::load_from_cache, |
|
852 | - 'EE_Organization_Config' => EE_Dependency_Map::load_from_cache, |
|
853 | - 'EE_Core_Config' => EE_Dependency_Map::load_from_cache, |
|
854 | - 'EE_Network_Core_Config' => EE_Dependency_Map::load_from_cache, |
|
855 | - 'EventEspresso\core\services\address\CountrySubRegionDao' => EE_Dependency_Map::load_from_cache, |
|
856 | - ], |
|
857 | - 'EventEspresso\core\services\address\CountrySubRegionDao' => [ |
|
858 | - 'EEM_State' => EE_Dependency_Map::load_from_cache, |
|
859 | - 'EventEspresso\core\services\validators\JsonValidator' => EE_Dependency_Map::load_from_cache, |
|
860 | - ], |
|
861 | - 'EventEspresso\core\domain\services\admin\ajax\WordpressHeartbeat' => [ |
|
862 | - 'EventEspresso\core\services\loaders\Loader' => EE_Dependency_Map::load_from_cache, |
|
863 | - 'EventEspresso\core\services\request\Request' => EE_Dependency_Map::load_from_cache, |
|
864 | - ], |
|
865 | - 'EventEspresso\core\domain\services\admin\ajax\EventEditorHeartbeat' => [ |
|
866 | - 'EventEspresso\core\domain\Domain' => EE_Dependency_Map::load_from_cache, |
|
867 | - 'EE_Environment_Config' => EE_Dependency_Map::load_from_cache, |
|
868 | - ], |
|
869 | - 'EventEspresso\core\services\request\files\FilesDataHandler' => [ |
|
870 | - 'EventEspresso\core\services\request\Request' => EE_Dependency_Map::load_from_cache, |
|
871 | - ], |
|
872 | - 'EventEspressoBatchRequest\BatchRequestProcessor' => [ |
|
873 | - 'EventEspresso\core\services\loaders\Loader' => EE_Dependency_Map::load_from_cache, |
|
874 | - ], |
|
875 | - 'EventEspresso\core\domain\services\admin\registrations\list_table\QueryBuilder' => [ |
|
876 | - 'EventEspresso\core\services\request\Request' => EE_Dependency_Map::load_from_cache, |
|
877 | - 'EEM_Registration' => EE_Dependency_Map::load_from_cache, |
|
878 | - null, |
|
879 | - ], |
|
880 | - 'EventEspresso\core\domain\services\admin\registrations\list_table\page_header\AttendeeFilterHeader' => [ |
|
881 | - 'EventEspresso\core\services\request\Request' => EE_Dependency_Map::load_from_cache, |
|
882 | - 'EEM_Attendee' => EE_Dependency_Map::load_from_cache, |
|
883 | - ], |
|
884 | - 'EventEspresso\core\domain\services\admin\registrations\list_table\page_header\DateFilterHeader' => [ |
|
885 | - 'EventEspresso\core\services\request\Request' => EE_Dependency_Map::load_from_cache, |
|
886 | - 'EEM_Datetime' => EE_Dependency_Map::load_from_cache, |
|
887 | - ], |
|
888 | - 'EventEspresso\core\domain\services\admin\registrations\list_table\page_header\EventFilterHeader' => [ |
|
889 | - 'EventEspresso\core\services\request\Request' => EE_Dependency_Map::load_from_cache, |
|
890 | - 'EEM_Event' => EE_Dependency_Map::load_from_cache, |
|
891 | - ], |
|
892 | - 'EventEspresso\core\domain\services\admin\registrations\list_table\page_header\TicketFilterHeader' => [ |
|
893 | - 'EventEspresso\core\services\request\Request' => EE_Dependency_Map::load_from_cache, |
|
894 | - 'EEM_Ticket' => EE_Dependency_Map::load_from_cache, |
|
895 | - ], |
|
896 | - 'EventEspressoBatchRequest\JobHandlers\ExecuteBatchDeletion' => [ |
|
897 | - 'EventEspresso\core\services\orm\tree_traversal\NodeGroupDao' => EE_Dependency_Map::load_from_cache, |
|
898 | - ], |
|
899 | - 'EventEspressoBatchRequest\JobHandlers\PreviewEventDeletion' => [ |
|
900 | - 'EventEspresso\core\services\orm\tree_traversal\NodeGroupDao' => EE_Dependency_Map::load_from_cache, |
|
901 | - ], |
|
902 | - 'EventEspresso\core\domain\services\admin\events\data\PreviewDeletion' => [ |
|
903 | - 'EventEspresso\core\services\orm\tree_traversal\NodeGroupDao' => EE_Dependency_Map::load_from_cache, |
|
904 | - 'EEM_Event' => EE_Dependency_Map::load_from_cache, |
|
905 | - 'EEM_Datetime' => EE_Dependency_Map::load_from_cache, |
|
906 | - 'EEM_Registration' => EE_Dependency_Map::load_from_cache, |
|
907 | - ], |
|
908 | - 'EventEspresso\core\domain\services\admin\events\data\ConfirmDeletion' => [ |
|
909 | - 'EventEspresso\core\services\orm\tree_traversal\NodeGroupDao' => EE_Dependency_Map::load_from_cache, |
|
910 | - ], |
|
911 | - 'EventEspresso\core\services\request\CurrentPage' => [ |
|
912 | - 'EE_CPT_Strategy' => EE_Dependency_Map::load_from_cache, |
|
913 | - 'EventEspresso\core\services\request\Request' => EE_Dependency_Map::load_from_cache, |
|
914 | - ], |
|
915 | - 'EventEspresso\core\services\shortcodes\LegacyShortcodesManager' => [ |
|
916 | - 'EE_Registry' => EE_Dependency_Map::load_from_cache, |
|
917 | - 'EventEspresso\core\services\request\CurrentPage' => EE_Dependency_Map::load_from_cache, |
|
918 | - ], |
|
919 | - 'EventEspresso\core\services\shortcodes\ShortcodesManager' => [ |
|
920 | - 'EventEspresso\core\services\shortcodes\LegacyShortcodesManager' => EE_Dependency_Map::load_from_cache, |
|
921 | - 'EventEspresso\core\services\request\CurrentPage' => EE_Dependency_Map::load_from_cache, |
|
922 | - ], |
|
923 | - 'EventEspresso\core\services\activation\plugin_prompt\DownloadPluginPromptManager' => [ |
|
924 | - 'EventEspresso\core\domain\services\capabilities\CapabilitiesChecker' => EE_Dependency_Map::load_from_cache |
|
925 | - ], |
|
926 | - ]; |
|
927 | - } |
|
928 | - |
|
929 | - |
|
930 | - /** |
|
931 | - * Registers how core classes are loaded. |
|
932 | - * This can either be done by simply providing the name of one of the EE_Registry loader methods such as: |
|
933 | - * 'EE_Request_Handler' => 'load_core' |
|
934 | - * 'EE_Messages_Queue' => 'load_lib' |
|
935 | - * 'EEH_Debug_Tools' => 'load_helper' |
|
936 | - * or, if greater control is required, by providing a custom closure. For example: |
|
937 | - * 'Some_Class' => function () { |
|
938 | - * return new Some_Class(); |
|
939 | - * }, |
|
940 | - * This is required for instantiating dependencies |
|
941 | - * where an interface has been type hinted in a class constructor. For example: |
|
942 | - * 'Required_Interface' => function () { |
|
943 | - * return new A_Class_That_Implements_Required_Interface(); |
|
944 | - * }, |
|
945 | - */ |
|
946 | - protected function _register_core_class_loaders() |
|
947 | - { |
|
948 | - $this->_class_loaders = [ |
|
949 | - // load_core |
|
950 | - 'EE_Dependency_Map' => function () { |
|
951 | - return $this; |
|
952 | - }, |
|
953 | - 'EE_Capabilities' => 'load_core', |
|
954 | - 'EE_Encryption' => 'load_core', |
|
955 | - 'EE_Front_Controller' => 'load_core', |
|
956 | - 'EE_Module_Request_Router' => 'load_core', |
|
957 | - 'EE_Registry' => 'load_core', |
|
958 | - 'EE_Request' => function () { |
|
959 | - return $this->legacy_request; |
|
960 | - }, |
|
961 | - 'EventEspresso\core\services\request\Request' => function () { |
|
962 | - return $this->request; |
|
963 | - }, |
|
964 | - 'EventEspresso\core\services\request\Response' => function () { |
|
965 | - return $this->response; |
|
966 | - }, |
|
967 | - 'EE_Base' => 'load_core', |
|
968 | - 'EE_Request_Handler' => 'load_core', |
|
969 | - 'EE_Session' => 'load_core', |
|
970 | - 'EE_Cron_Tasks' => 'load_core', |
|
971 | - 'EE_System' => 'load_core', |
|
972 | - 'EE_Maintenance_Mode' => 'load_core', |
|
973 | - 'EE_Register_CPTs' => 'load_core', |
|
974 | - 'EE_Admin' => 'load_core', |
|
975 | - 'EE_CPT_Strategy' => 'load_core', |
|
976 | - // load_class |
|
977 | - 'EE_Registration_Processor' => 'load_class', |
|
978 | - // load_lib |
|
979 | - 'EE_Message_Resource_Manager' => 'load_lib', |
|
980 | - 'EE_Message_Type_Collection' => 'load_lib', |
|
981 | - 'EE_Message_Type_Collection_Loader' => 'load_lib', |
|
982 | - 'EE_Messenger_Collection' => 'load_lib', |
|
983 | - 'EE_Messenger_Collection_Loader' => 'load_lib', |
|
984 | - 'EE_Messages_Processor' => 'load_lib', |
|
985 | - 'EE_Message_Repository' => 'load_lib', |
|
986 | - 'EE_Messages_Queue' => 'load_lib', |
|
987 | - 'EE_Messages_Data_Handler_Collection' => 'load_lib', |
|
988 | - 'EE_Message_Template_Group_Collection' => 'load_lib', |
|
989 | - 'EE_Payment_Method_Manager' => 'load_lib', |
|
990 | - 'EE_DMS_Core_4_1_0' => 'load_dms', |
|
991 | - 'EE_DMS_Core_4_2_0' => 'load_dms', |
|
992 | - 'EE_DMS_Core_4_3_0' => 'load_dms', |
|
993 | - 'EE_DMS_Core_4_5_0' => 'load_dms', |
|
994 | - 'EE_DMS_Core_4_6_0' => 'load_dms', |
|
995 | - 'EE_DMS_Core_4_7_0' => 'load_dms', |
|
996 | - 'EE_DMS_Core_4_8_0' => 'load_dms', |
|
997 | - 'EE_DMS_Core_4_9_0' => 'load_dms', |
|
998 | - 'EE_DMS_Core_4_10_0' => 'load_dms', |
|
999 | - 'EE_Messages_Generator' => function () { |
|
1000 | - return EE_Registry::instance()->load_lib( |
|
1001 | - 'Messages_Generator', |
|
1002 | - [], |
|
1003 | - false, |
|
1004 | - false |
|
1005 | - ); |
|
1006 | - }, |
|
1007 | - 'EE_Messages_Template_Defaults' => function ($arguments = []) { |
|
1008 | - return EE_Registry::instance()->load_lib( |
|
1009 | - 'Messages_Template_Defaults', |
|
1010 | - $arguments, |
|
1011 | - false, |
|
1012 | - false |
|
1013 | - ); |
|
1014 | - }, |
|
1015 | - // load_helper |
|
1016 | - 'EEH_Parse_Shortcodes' => function () { |
|
1017 | - if (EE_Registry::instance()->load_helper('Parse_Shortcodes')) { |
|
1018 | - return new EEH_Parse_Shortcodes(); |
|
1019 | - } |
|
1020 | - return null; |
|
1021 | - }, |
|
1022 | - 'EE_Template_Config' => function () { |
|
1023 | - return EE_Config::instance()->template_settings; |
|
1024 | - }, |
|
1025 | - 'EE_Currency_Config' => function () { |
|
1026 | - return EE_Config::instance()->currency; |
|
1027 | - }, |
|
1028 | - 'EE_Registration_Config' => function () { |
|
1029 | - return EE_Config::instance()->registration; |
|
1030 | - }, |
|
1031 | - 'EE_Core_Config' => function () { |
|
1032 | - return EE_Config::instance()->core; |
|
1033 | - }, |
|
1034 | - 'EventEspresso\core\services\loaders\Loader' => function () { |
|
1035 | - return LoaderFactory::getLoader(); |
|
1036 | - }, |
|
1037 | - 'EE_Network_Config' => function () { |
|
1038 | - return EE_Network_Config::instance(); |
|
1039 | - }, |
|
1040 | - 'EE_Config' => function () { |
|
1041 | - return EE_Config::instance(); |
|
1042 | - }, |
|
1043 | - 'EventEspresso\core\domain\Domain' => function () { |
|
1044 | - return DomainFactory::getEventEspressoCoreDomain(); |
|
1045 | - }, |
|
1046 | - 'EE_Admin_Config' => function () { |
|
1047 | - return EE_Config::instance()->admin; |
|
1048 | - }, |
|
1049 | - 'EE_Organization_Config' => function () { |
|
1050 | - return EE_Config::instance()->organization; |
|
1051 | - }, |
|
1052 | - 'EE_Network_Core_Config' => function () { |
|
1053 | - return EE_Network_Config::instance()->core; |
|
1054 | - }, |
|
1055 | - 'EE_Environment_Config' => function () { |
|
1056 | - return EE_Config::instance()->environment; |
|
1057 | - }, |
|
1058 | - 'EE_Ticket_Selector_Config' => function () { |
|
1059 | - return EE_Config::instance()->template_settings->EED_Ticket_Selector; |
|
1060 | - }, |
|
1061 | - ]; |
|
1062 | - } |
|
1063 | - |
|
1064 | - |
|
1065 | - /** |
|
1066 | - * can be used for supplying alternate names for classes, |
|
1067 | - * or for connecting interface names to instantiable classes |
|
1068 | - */ |
|
1069 | - protected function _register_core_aliases() |
|
1070 | - { |
|
1071 | - $aliases = [ |
|
1072 | - 'CommandBusInterface' => 'EventEspresso\core\services\commands\CommandBusInterface', |
|
1073 | - 'EventEspresso\core\services\commands\CommandBusInterface' => 'EventEspresso\core\services\commands\CommandBus', |
|
1074 | - 'CommandHandlerManagerInterface' => 'EventEspresso\core\services\commands\CommandHandlerManagerInterface', |
|
1075 | - 'EventEspresso\core\services\commands\CommandHandlerManagerInterface' => 'EventEspresso\core\services\commands\CommandHandlerManager', |
|
1076 | - 'CapChecker' => 'EventEspresso\core\services\commands\middleware\CapChecker', |
|
1077 | - 'AddActionHook' => 'EventEspresso\core\services\commands\middleware\AddActionHook', |
|
1078 | - 'CapabilitiesChecker' => 'EventEspresso\core\domain\services\capabilities\CapabilitiesChecker', |
|
1079 | - 'CapabilitiesCheckerInterface' => 'EventEspresso\core\domain\services\capabilities\CapabilitiesCheckerInterface', |
|
1080 | - 'EventEspresso\core\domain\services\capabilities\CapabilitiesCheckerInterface' => 'EventEspresso\core\domain\services\capabilities\CapabilitiesChecker', |
|
1081 | - 'CreateRegistrationService' => 'EventEspresso\core\domain\services\registration\CreateRegistrationService', |
|
1082 | - 'CreateRegistrationCommandHandler' => 'EventEspresso\core\domain\services\commands\registration\CreateRegistrationCommand', |
|
1083 | - 'CopyRegistrationDetailsCommandHandler' => 'EventEspresso\core\domain\services\commands\registration\CopyRegistrationDetailsCommand', |
|
1084 | - 'CopyRegistrationPaymentsCommandHandler' => 'EventEspresso\core\domain\services\commands\registration\CopyRegistrationPaymentsCommand', |
|
1085 | - 'CancelRegistrationAndTicketLineItemCommandHandler' => 'EventEspresso\core\domain\services\commands\registration\CancelRegistrationAndTicketLineItemCommandHandler', |
|
1086 | - 'UpdateRegistrationAndTransactionAfterChangeCommandHandler' => 'EventEspresso\core\domain\services\commands\registration\UpdateRegistrationAndTransactionAfterChangeCommandHandler', |
|
1087 | - 'CreateTicketLineItemCommandHandler' => 'EventEspresso\core\domain\services\commands\ticket\CreateTicketLineItemCommand', |
|
1088 | - 'CreateTransactionCommandHandler' => 'EventEspresso\core\domain\services\commands\transaction\CreateTransactionCommandHandler', |
|
1089 | - 'CreateAttendeeCommandHandler' => 'EventEspresso\core\domain\services\commands\attendee\CreateAttendeeCommandHandler', |
|
1090 | - 'TableManager' => 'EventEspresso\core\services\database\TableManager', |
|
1091 | - 'TableAnalysis' => 'EventEspresso\core\services\database\TableAnalysis', |
|
1092 | - 'EspressoShortcode' => 'EventEspresso\core\services\shortcodes\EspressoShortcode', |
|
1093 | - 'ShortcodeInterface' => 'EventEspresso\core\services\shortcodes\ShortcodeInterface', |
|
1094 | - 'EventEspresso\core\services\shortcodes\ShortcodeInterface' => 'EventEspresso\core\services\shortcodes\EspressoShortcode', |
|
1095 | - 'EventEspresso\core\services\cache\CacheStorageInterface' => 'EventEspresso\core\services\cache\TransientCacheStorage', |
|
1096 | - 'LoaderInterface' => 'EventEspresso\core\services\loaders\LoaderInterface', |
|
1097 | - 'EventEspresso\core\services\loaders\LoaderInterface' => 'EventEspresso\core\services\loaders\Loader', |
|
1098 | - 'CommandFactoryInterface' => 'EventEspresso\core\services\commands\CommandFactoryInterface', |
|
1099 | - 'EventEspresso\core\services\commands\CommandFactoryInterface' => 'EventEspresso\core\services\commands\CommandFactory', |
|
1100 | - 'EmailValidatorInterface' => 'EventEspresso\core\domain\services\validation\email\EmailValidatorInterface', |
|
1101 | - 'EventEspresso\core\domain\services\validation\email\EmailValidatorInterface' => 'EventEspresso\core\domain\services\validation\email\EmailValidationService', |
|
1102 | - 'NoticeConverterInterface' => 'EventEspresso\core\services\notices\NoticeConverterInterface', |
|
1103 | - 'EventEspresso\core\services\notices\NoticeConverterInterface' => 'EventEspresso\core\services\notices\ConvertNoticesToEeErrors', |
|
1104 | - 'NoticesContainerInterface' => 'EventEspresso\core\services\notices\NoticesContainerInterface', |
|
1105 | - 'EventEspresso\core\services\notices\NoticesContainerInterface' => 'EventEspresso\core\services\notices\NoticesContainer', |
|
1106 | - 'EventEspresso\core\services\request\RequestInterface' => 'EventEspresso\core\services\request\Request', |
|
1107 | - 'EventEspresso\core\services\request\ResponseInterface' => 'EventEspresso\core\services\request\Response', |
|
1108 | - 'EventEspresso\core\domain\DomainInterface' => 'EventEspresso\core\domain\Domain', |
|
1109 | - 'Registration_Processor' => 'EE_Registration_Processor', |
|
1110 | - ]; |
|
1111 | - foreach ($aliases as $alias => $fqn) { |
|
1112 | - if (is_array($fqn)) { |
|
1113 | - foreach ($fqn as $class => $for_class) { |
|
1114 | - $this->class_cache->addAlias($class, $alias, $for_class); |
|
1115 | - } |
|
1116 | - continue; |
|
1117 | - } |
|
1118 | - $this->class_cache->addAlias($fqn, $alias); |
|
1119 | - } |
|
1120 | - if (! (defined('DOING_AJAX') && DOING_AJAX) && is_admin()) { |
|
1121 | - $this->class_cache->addAlias( |
|
1122 | - 'EventEspresso\core\services\notices\ConvertNoticesToAdminNotices', |
|
1123 | - 'EventEspresso\core\services\notices\NoticeConverterInterface' |
|
1124 | - ); |
|
1125 | - } |
|
1126 | - } |
|
1127 | - |
|
1128 | - |
|
1129 | - public function debug($for_class = '') |
|
1130 | - { |
|
1131 | - $this->class_cache->debug($for_class); |
|
1132 | - } |
|
1133 | - |
|
1134 | - |
|
1135 | - /** |
|
1136 | - * This is used to reset the internal map and class_loaders to their original default state at the beginning of the |
|
1137 | - * request Primarily used by unit tests. |
|
1138 | - */ |
|
1139 | - public function reset() |
|
1140 | - { |
|
1141 | - $this->_register_core_class_loaders(); |
|
1142 | - $this->_register_core_dependencies(); |
|
1143 | - } |
|
1144 | - |
|
1145 | - |
|
1146 | - /** |
|
1147 | - * PLZ NOTE: a better name for this method would be is_alias() |
|
1148 | - * because it returns TRUE if the provided fully qualified name IS an alias |
|
1149 | - * WHY? |
|
1150 | - * Because if a class is type hinting for a concretion, |
|
1151 | - * then why would we need to find another class to supply it? |
|
1152 | - * ie: if a class asks for `Fully/Qualified/Namespace/SpecificClassName`, |
|
1153 | - * then give it an instance of `Fully/Qualified/Namespace/SpecificClassName`. |
|
1154 | - * Don't go looking for some substitute. |
|
1155 | - * Whereas if a class is type hinting for an interface... |
|
1156 | - * then we need to find an actual class to use. |
|
1157 | - * So the interface IS the alias for some other FQN, |
|
1158 | - * and we need to find out if `Fully/Qualified/Namespace/SomeInterface` |
|
1159 | - * represents some other class. |
|
1160 | - * |
|
1161 | - * @param string $fqn |
|
1162 | - * @param string $for_class |
|
1163 | - * @return bool |
|
1164 | - * @deprecated 4.9.62.p |
|
1165 | - */ |
|
1166 | - public function has_alias($fqn = '', $for_class = '') |
|
1167 | - { |
|
1168 | - return $this->isAlias($fqn, $for_class); |
|
1169 | - } |
|
1170 | - |
|
1171 | - |
|
1172 | - /** |
|
1173 | - * PLZ NOTE: a better name for this method would be get_fqn_for_alias() |
|
1174 | - * because it returns a FQN for provided alias if one exists, otherwise returns the original $alias |
|
1175 | - * functions recursively, so that multiple aliases can be used to drill down to a FQN |
|
1176 | - * for example: |
|
1177 | - * if the following two entries were added to the _aliases array: |
|
1178 | - * array( |
|
1179 | - * 'interface_alias' => 'some\namespace\interface' |
|
1180 | - * 'some\namespace\interface' => 'some\namespace\classname' |
|
1181 | - * ) |
|
1182 | - * then one could use EE_Registry::instance()->create( 'interface_alias' ) |
|
1183 | - * to load an instance of 'some\namespace\classname' |
|
1184 | - * |
|
1185 | - * @param string $alias |
|
1186 | - * @param string $for_class |
|
1187 | - * @return string |
|
1188 | - * @deprecated 4.9.62.p |
|
1189 | - */ |
|
1190 | - public function get_alias($alias = '', $for_class = '') |
|
1191 | - { |
|
1192 | - return $this->getFqnForAlias($alias, $for_class); |
|
1193 | - } |
|
22 | + /** |
|
23 | + * This means that the requested class dependency is not present in the dependency map |
|
24 | + */ |
|
25 | + const not_registered = 0; |
|
26 | + |
|
27 | + /** |
|
28 | + * This instructs class loaders to ALWAYS return a newly instantiated object for the requested class. |
|
29 | + */ |
|
30 | + const load_new_object = 1; |
|
31 | + |
|
32 | + /** |
|
33 | + * This instructs class loaders to return a previously instantiated and cached object for the requested class. |
|
34 | + * IF a previously instantiated object does not exist, a new one will be created and added to the cache. |
|
35 | + */ |
|
36 | + const load_from_cache = 2; |
|
37 | + |
|
38 | + /** |
|
39 | + * When registering a dependency, |
|
40 | + * this indicates to keep any existing dependencies that already exist, |
|
41 | + * and simply discard any new dependencies declared in the incoming data |
|
42 | + */ |
|
43 | + const KEEP_EXISTING_DEPENDENCIES = 0; |
|
44 | + |
|
45 | + /** |
|
46 | + * When registering a dependency, |
|
47 | + * this indicates to overwrite any existing dependencies that already exist using the incoming data |
|
48 | + */ |
|
49 | + const OVERWRITE_DEPENDENCIES = 1; |
|
50 | + |
|
51 | + |
|
52 | + /** |
|
53 | + * @type EE_Dependency_Map $_instance |
|
54 | + */ |
|
55 | + protected static $_instance; |
|
56 | + |
|
57 | + /** |
|
58 | + * @var ClassInterfaceCache $class_cache |
|
59 | + */ |
|
60 | + private $class_cache; |
|
61 | + |
|
62 | + /** |
|
63 | + * @type RequestInterface $request |
|
64 | + */ |
|
65 | + protected $request; |
|
66 | + |
|
67 | + /** |
|
68 | + * @type LegacyRequestInterface $legacy_request |
|
69 | + */ |
|
70 | + protected $legacy_request; |
|
71 | + |
|
72 | + /** |
|
73 | + * @type ResponseInterface $response |
|
74 | + */ |
|
75 | + protected $response; |
|
76 | + |
|
77 | + /** |
|
78 | + * @type LoaderInterface $loader |
|
79 | + */ |
|
80 | + protected $loader; |
|
81 | + |
|
82 | + /** |
|
83 | + * @type array $_dependency_map |
|
84 | + */ |
|
85 | + protected $_dependency_map = []; |
|
86 | + |
|
87 | + /** |
|
88 | + * @type array $_class_loaders |
|
89 | + */ |
|
90 | + protected $_class_loaders = []; |
|
91 | + |
|
92 | + |
|
93 | + /** |
|
94 | + * EE_Dependency_Map constructor. |
|
95 | + * |
|
96 | + * @param ClassInterfaceCache $class_cache |
|
97 | + */ |
|
98 | + protected function __construct(ClassInterfaceCache $class_cache) |
|
99 | + { |
|
100 | + $this->class_cache = $class_cache; |
|
101 | + do_action('EE_Dependency_Map____construct', $this); |
|
102 | + } |
|
103 | + |
|
104 | + |
|
105 | + /** |
|
106 | + * @return void |
|
107 | + */ |
|
108 | + public function initialize() |
|
109 | + { |
|
110 | + $this->_register_core_dependencies(); |
|
111 | + $this->_register_core_class_loaders(); |
|
112 | + $this->_register_core_aliases(); |
|
113 | + } |
|
114 | + |
|
115 | + |
|
116 | + /** |
|
117 | + * @singleton method used to instantiate class object |
|
118 | + * @param ClassInterfaceCache|null $class_cache |
|
119 | + * @return EE_Dependency_Map |
|
120 | + */ |
|
121 | + public static function instance(ClassInterfaceCache $class_cache = null) |
|
122 | + { |
|
123 | + // check if class object is instantiated, and instantiated properly |
|
124 | + if ( |
|
125 | + ! self::$_instance instanceof EE_Dependency_Map |
|
126 | + && $class_cache instanceof ClassInterfaceCache |
|
127 | + ) { |
|
128 | + self::$_instance = new EE_Dependency_Map($class_cache); |
|
129 | + } |
|
130 | + return self::$_instance; |
|
131 | + } |
|
132 | + |
|
133 | + |
|
134 | + /** |
|
135 | + * @param RequestInterface $request |
|
136 | + */ |
|
137 | + public function setRequest(RequestInterface $request) |
|
138 | + { |
|
139 | + $this->request = $request; |
|
140 | + } |
|
141 | + |
|
142 | + |
|
143 | + /** |
|
144 | + * @param LegacyRequestInterface $legacy_request |
|
145 | + */ |
|
146 | + public function setLegacyRequest(LegacyRequestInterface $legacy_request) |
|
147 | + { |
|
148 | + $this->legacy_request = $legacy_request; |
|
149 | + } |
|
150 | + |
|
151 | + |
|
152 | + /** |
|
153 | + * @param ResponseInterface $response |
|
154 | + */ |
|
155 | + public function setResponse(ResponseInterface $response) |
|
156 | + { |
|
157 | + $this->response = $response; |
|
158 | + } |
|
159 | + |
|
160 | + |
|
161 | + /** |
|
162 | + * @param LoaderInterface $loader |
|
163 | + */ |
|
164 | + public function setLoader(LoaderInterface $loader) |
|
165 | + { |
|
166 | + $this->loader = $loader; |
|
167 | + } |
|
168 | + |
|
169 | + |
|
170 | + /** |
|
171 | + * @param string $class |
|
172 | + * @param array $dependencies |
|
173 | + * @param int $overwrite |
|
174 | + * @return bool |
|
175 | + */ |
|
176 | + public static function register_dependencies( |
|
177 | + $class, |
|
178 | + array $dependencies, |
|
179 | + $overwrite = EE_Dependency_Map::KEEP_EXISTING_DEPENDENCIES |
|
180 | + ) { |
|
181 | + return self::$_instance->registerDependencies($class, $dependencies, $overwrite); |
|
182 | + } |
|
183 | + |
|
184 | + |
|
185 | + /** |
|
186 | + * Assigns an array of class names and corresponding load sources (new or cached) |
|
187 | + * to the class specified by the first parameter. |
|
188 | + * IMPORTANT !!! |
|
189 | + * The order of elements in the incoming $dependencies array MUST match |
|
190 | + * the order of the constructor parameters for the class in question. |
|
191 | + * This is especially important when overriding any existing dependencies that are registered. |
|
192 | + * the third parameter controls whether any duplicate dependencies are overwritten or not. |
|
193 | + * |
|
194 | + * @param string $class |
|
195 | + * @param array $dependencies |
|
196 | + * @param int $overwrite |
|
197 | + * @return bool |
|
198 | + */ |
|
199 | + public function registerDependencies( |
|
200 | + $class, |
|
201 | + array $dependencies, |
|
202 | + $overwrite = EE_Dependency_Map::KEEP_EXISTING_DEPENDENCIES |
|
203 | + ) { |
|
204 | + $class = trim($class, '\\'); |
|
205 | + $registered = false; |
|
206 | + if (empty(self::$_instance->_dependency_map[ $class ])) { |
|
207 | + self::$_instance->_dependency_map[ $class ] = []; |
|
208 | + } |
|
209 | + // we need to make sure that any aliases used when registering a dependency |
|
210 | + // get resolved to the correct class name |
|
211 | + foreach ($dependencies as $dependency => $load_source) { |
|
212 | + $alias = self::$_instance->getFqnForAlias($dependency); |
|
213 | + if ( |
|
214 | + $overwrite === EE_Dependency_Map::OVERWRITE_DEPENDENCIES |
|
215 | + || ! isset(self::$_instance->_dependency_map[ $class ][ $alias ]) |
|
216 | + ) { |
|
217 | + unset($dependencies[ $dependency ]); |
|
218 | + $dependencies[ $alias ] = $load_source; |
|
219 | + $registered = true; |
|
220 | + } |
|
221 | + } |
|
222 | + // now add our two lists of dependencies together. |
|
223 | + // using Union (+=) favours the arrays in precedence from left to right, |
|
224 | + // so $dependencies is NOT overwritten because it is listed first |
|
225 | + // ie: with A = B + C, entries in B take precedence over duplicate entries in C |
|
226 | + // Union is way faster than array_merge() but should be used with caution... |
|
227 | + // especially with numerically indexed arrays |
|
228 | + $dependencies += self::$_instance->_dependency_map[ $class ]; |
|
229 | + // now we need to ensure that the resulting dependencies |
|
230 | + // array only has the entries that are required for the class |
|
231 | + // so first count how many dependencies were originally registered for the class |
|
232 | + $dependency_count = count(self::$_instance->_dependency_map[ $class ]); |
|
233 | + // if that count is non-zero (meaning dependencies were already registered) |
|
234 | + self::$_instance->_dependency_map[ $class ] = $dependency_count |
|
235 | + // then truncate the final array to match that count |
|
236 | + ? array_slice($dependencies, 0, $dependency_count) |
|
237 | + // otherwise just take the incoming array because nothing previously existed |
|
238 | + : $dependencies; |
|
239 | + return $registered; |
|
240 | + } |
|
241 | + |
|
242 | + |
|
243 | + /** |
|
244 | + * @param string $class_name |
|
245 | + * @param string $loader |
|
246 | + * @param bool $overwrite |
|
247 | + * @return bool |
|
248 | + * @throws DomainException |
|
249 | + */ |
|
250 | + public static function register_class_loader($class_name, $loader = 'load_core', $overwrite = false) |
|
251 | + { |
|
252 | + if (! $loader instanceof Closure && strpos($class_name, '\\') !== false) { |
|
253 | + throw new DomainException( |
|
254 | + esc_html__('Don\'t use class loaders for FQCNs.', 'event_espresso') |
|
255 | + ); |
|
256 | + } |
|
257 | + // check that loader is callable or method starts with "load_" and exists in EE_Registry |
|
258 | + if ( |
|
259 | + ! is_callable($loader) |
|
260 | + && ( |
|
261 | + strpos($loader, 'load_') !== 0 |
|
262 | + || ! method_exists('EE_Registry', $loader) |
|
263 | + ) |
|
264 | + ) { |
|
265 | + throw new DomainException( |
|
266 | + sprintf( |
|
267 | + esc_html__( |
|
268 | + '"%1$s" is not a valid loader method on EE_Registry.', |
|
269 | + 'event_espresso' |
|
270 | + ), |
|
271 | + $loader |
|
272 | + ) |
|
273 | + ); |
|
274 | + } |
|
275 | + $class_name = self::$_instance->getFqnForAlias($class_name); |
|
276 | + if ($overwrite || ! isset(self::$_instance->_class_loaders[ $class_name ])) { |
|
277 | + self::$_instance->_class_loaders[ $class_name ] = $loader; |
|
278 | + return true; |
|
279 | + } |
|
280 | + return false; |
|
281 | + } |
|
282 | + |
|
283 | + |
|
284 | + /** |
|
285 | + * @return array |
|
286 | + */ |
|
287 | + public function dependency_map() |
|
288 | + { |
|
289 | + return $this->_dependency_map; |
|
290 | + } |
|
291 | + |
|
292 | + |
|
293 | + /** |
|
294 | + * returns TRUE if dependency map contains a listing for the provided class name |
|
295 | + * |
|
296 | + * @param string $class_name |
|
297 | + * @return boolean |
|
298 | + */ |
|
299 | + public function has($class_name = '') |
|
300 | + { |
|
301 | + // all legacy models have the same dependencies |
|
302 | + if (strpos($class_name, 'EEM_') === 0) { |
|
303 | + $class_name = 'LEGACY_MODELS'; |
|
304 | + } |
|
305 | + return isset($this->_dependency_map[ $class_name ]); |
|
306 | + } |
|
307 | + |
|
308 | + |
|
309 | + /** |
|
310 | + * returns TRUE if dependency map contains a listing for the provided class name AND dependency |
|
311 | + * |
|
312 | + * @param string $class_name |
|
313 | + * @param string $dependency |
|
314 | + * @return bool |
|
315 | + */ |
|
316 | + public function has_dependency_for_class($class_name = '', $dependency = '') |
|
317 | + { |
|
318 | + // all legacy models have the same dependencies |
|
319 | + if (strpos($class_name, 'EEM_') === 0) { |
|
320 | + $class_name = 'LEGACY_MODELS'; |
|
321 | + } |
|
322 | + $dependency = $this->getFqnForAlias($dependency, $class_name); |
|
323 | + return isset($this->_dependency_map[ $class_name ][ $dependency ]); |
|
324 | + } |
|
325 | + |
|
326 | + |
|
327 | + /** |
|
328 | + * returns loading strategy for whether a previously cached dependency should be loaded or a new instance returned |
|
329 | + * |
|
330 | + * @param string $class_name |
|
331 | + * @param string $dependency |
|
332 | + * @return int |
|
333 | + */ |
|
334 | + public function loading_strategy_for_class_dependency($class_name = '', $dependency = '') |
|
335 | + { |
|
336 | + // all legacy models have the same dependencies |
|
337 | + if (strpos($class_name, 'EEM_') === 0) { |
|
338 | + $class_name = 'LEGACY_MODELS'; |
|
339 | + } |
|
340 | + $dependency = $this->getFqnForAlias($dependency); |
|
341 | + return $this->has_dependency_for_class($class_name, $dependency) |
|
342 | + ? $this->_dependency_map[ $class_name ][ $dependency ] |
|
343 | + : EE_Dependency_Map::not_registered; |
|
344 | + } |
|
345 | + |
|
346 | + |
|
347 | + /** |
|
348 | + * @param string $class_name |
|
349 | + * @return string | Closure |
|
350 | + */ |
|
351 | + public function class_loader($class_name) |
|
352 | + { |
|
353 | + // all legacy models use load_model() |
|
354 | + if (strpos($class_name, 'EEM_') === 0) { |
|
355 | + return 'load_model'; |
|
356 | + } |
|
357 | + // EE_CPT_*_Strategy classes like EE_CPT_Event_Strategy, EE_CPT_Venue_Strategy, etc |
|
358 | + // perform strpos() first to avoid loading regex every time we load a class |
|
359 | + if ( |
|
360 | + strpos($class_name, 'EE_CPT_') === 0 |
|
361 | + && preg_match('/^EE_CPT_([a-zA-Z]+)_Strategy$/', $class_name) |
|
362 | + ) { |
|
363 | + return 'load_core'; |
|
364 | + } |
|
365 | + $class_name = $this->getFqnForAlias($class_name); |
|
366 | + return isset($this->_class_loaders[ $class_name ]) ? $this->_class_loaders[ $class_name ] : ''; |
|
367 | + } |
|
368 | + |
|
369 | + |
|
370 | + /** |
|
371 | + * @return array |
|
372 | + */ |
|
373 | + public function class_loaders() |
|
374 | + { |
|
375 | + return $this->_class_loaders; |
|
376 | + } |
|
377 | + |
|
378 | + |
|
379 | + /** |
|
380 | + * adds an alias for a classname |
|
381 | + * |
|
382 | + * @param string $fqcn the class name that should be used (concrete class to replace interface) |
|
383 | + * @param string $alias the class name that would be type hinted for (abstract parent or interface) |
|
384 | + * @param string $for_class the class that has the dependency (is type hinting for the interface) |
|
385 | + */ |
|
386 | + public function add_alias($fqcn, $alias, $for_class = '') |
|
387 | + { |
|
388 | + $this->class_cache->addAlias($fqcn, $alias, $for_class); |
|
389 | + } |
|
390 | + |
|
391 | + |
|
392 | + /** |
|
393 | + * Returns TRUE if the provided fully qualified name IS an alias |
|
394 | + * WHY? |
|
395 | + * Because if a class is type hinting for a concretion, |
|
396 | + * then why would we need to find another class to supply it? |
|
397 | + * ie: if a class asks for `Fully/Qualified/Namespace/SpecificClassName`, |
|
398 | + * then give it an instance of `Fully/Qualified/Namespace/SpecificClassName`. |
|
399 | + * Don't go looking for some substitute. |
|
400 | + * Whereas if a class is type hinting for an interface... |
|
401 | + * then we need to find an actual class to use. |
|
402 | + * So the interface IS the alias for some other FQN, |
|
403 | + * and we need to find out if `Fully/Qualified/Namespace/SomeInterface` |
|
404 | + * represents some other class. |
|
405 | + * |
|
406 | + * @param string $fqn |
|
407 | + * @param string $for_class |
|
408 | + * @return bool |
|
409 | + */ |
|
410 | + public function isAlias($fqn = '', $for_class = '') |
|
411 | + { |
|
412 | + return $this->class_cache->isAlias($fqn, $for_class); |
|
413 | + } |
|
414 | + |
|
415 | + |
|
416 | + /** |
|
417 | + * Returns a FQN for provided alias if one exists, otherwise returns the original $alias |
|
418 | + * functions recursively, so that multiple aliases can be used to drill down to a FQN |
|
419 | + * for example: |
|
420 | + * if the following two entries were added to the _aliases array: |
|
421 | + * array( |
|
422 | + * 'interface_alias' => 'some\namespace\interface' |
|
423 | + * 'some\namespace\interface' => 'some\namespace\classname' |
|
424 | + * ) |
|
425 | + * then one could use EE_Registry::instance()->create( 'interface_alias' ) |
|
426 | + * to load an instance of 'some\namespace\classname' |
|
427 | + * |
|
428 | + * @param string $alias |
|
429 | + * @param string $for_class |
|
430 | + * @return string |
|
431 | + */ |
|
432 | + public function getFqnForAlias($alias = '', $for_class = '') |
|
433 | + { |
|
434 | + return $this->class_cache->getFqnForAlias($alias, $for_class); |
|
435 | + } |
|
436 | + |
|
437 | + |
|
438 | + /** |
|
439 | + * Registers the core dependencies and whether a previously instantiated object should be loaded from the cache, |
|
440 | + * if one exists, or whether a new object should be generated every time the requested class is loaded. |
|
441 | + * This is done by using the following class constants: |
|
442 | + * EE_Dependency_Map::load_from_cache - loads previously instantiated object |
|
443 | + * EE_Dependency_Map::load_new_object - generates a new object every time |
|
444 | + */ |
|
445 | + protected function _register_core_dependencies() |
|
446 | + { |
|
447 | + $this->_dependency_map = [ |
|
448 | + 'EE_Admin' => [ |
|
449 | + 'EventEspresso\core\services\request\Request' => EE_Dependency_Map::load_from_cache, |
|
450 | + ], |
|
451 | + 'EE_Request_Handler' => [ |
|
452 | + 'EventEspresso\core\services\request\Request' => EE_Dependency_Map::load_from_cache, |
|
453 | + 'EventEspresso\core\services\request\Response' => EE_Dependency_Map::load_from_cache, |
|
454 | + ], |
|
455 | + 'EE_System' => [ |
|
456 | + 'EE_Registry' => EE_Dependency_Map::load_from_cache, |
|
457 | + 'EventEspresso\core\services\loaders\Loader' => EE_Dependency_Map::load_from_cache, |
|
458 | + 'EventEspresso\core\services\request\Request' => EE_Dependency_Map::load_from_cache, |
|
459 | + 'EE_Maintenance_Mode' => EE_Dependency_Map::load_from_cache, |
|
460 | + ], |
|
461 | + 'EE_Session' => [ |
|
462 | + 'EventEspresso\core\services\cache\TransientCacheStorage' => EE_Dependency_Map::load_from_cache, |
|
463 | + 'EventEspresso\core\domain\values\session\SessionLifespan' => EE_Dependency_Map::load_from_cache, |
|
464 | + 'EventEspresso\core\services\request\Request' => EE_Dependency_Map::load_from_cache, |
|
465 | + 'EventEspresso\core\services\session\SessionStartHandler' => EE_Dependency_Map::load_from_cache, |
|
466 | + 'EE_Encryption' => EE_Dependency_Map::load_from_cache, |
|
467 | + ], |
|
468 | + 'EE_Cart' => [ |
|
469 | + 'EE_Session' => EE_Dependency_Map::load_from_cache, |
|
470 | + ], |
|
471 | + 'EE_Front_Controller' => [ |
|
472 | + 'EE_Registry' => EE_Dependency_Map::load_from_cache, |
|
473 | + 'EventEspresso\core\services\request\CurrentPage' => EE_Dependency_Map::load_from_cache, |
|
474 | + 'EE_Module_Request_Router' => EE_Dependency_Map::load_from_cache, |
|
475 | + ], |
|
476 | + 'EE_Messenger_Collection_Loader' => [ |
|
477 | + 'EE_Messenger_Collection' => EE_Dependency_Map::load_new_object, |
|
478 | + ], |
|
479 | + 'EE_Message_Type_Collection_Loader' => [ |
|
480 | + 'EE_Message_Type_Collection' => EE_Dependency_Map::load_new_object, |
|
481 | + ], |
|
482 | + 'EE_Message_Resource_Manager' => [ |
|
483 | + 'EE_Messenger_Collection_Loader' => EE_Dependency_Map::load_new_object, |
|
484 | + 'EE_Message_Type_Collection_Loader' => EE_Dependency_Map::load_new_object, |
|
485 | + 'EEM_Message_Template_Group' => EE_Dependency_Map::load_from_cache, |
|
486 | + ], |
|
487 | + 'EE_Message_Factory' => [ |
|
488 | + 'EE_Message_Resource_Manager' => EE_Dependency_Map::load_from_cache, |
|
489 | + ], |
|
490 | + 'EE_messages' => [ |
|
491 | + 'EE_Message_Resource_Manager' => EE_Dependency_Map::load_from_cache, |
|
492 | + ], |
|
493 | + 'EE_Messages_Generator' => [ |
|
494 | + 'EE_Messages_Queue' => EE_Dependency_Map::load_new_object, |
|
495 | + 'EE_Messages_Data_Handler_Collection' => EE_Dependency_Map::load_new_object, |
|
496 | + 'EE_Message_Template_Group_Collection' => EE_Dependency_Map::load_new_object, |
|
497 | + 'EEH_Parse_Shortcodes' => EE_Dependency_Map::load_from_cache, |
|
498 | + ], |
|
499 | + 'EE_Messages_Processor' => [ |
|
500 | + 'EE_Message_Resource_Manager' => EE_Dependency_Map::load_from_cache, |
|
501 | + ], |
|
502 | + 'EE_Messages_Queue' => [ |
|
503 | + 'EE_Message_Repository' => EE_Dependency_Map::load_new_object, |
|
504 | + ], |
|
505 | + 'EE_Messages_Template_Defaults' => [ |
|
506 | + 'EEM_Message_Template_Group' => EE_Dependency_Map::load_from_cache, |
|
507 | + 'EEM_Message_Template' => EE_Dependency_Map::load_from_cache, |
|
508 | + ], |
|
509 | + 'EE_Message_To_Generate_From_Request' => [ |
|
510 | + 'EE_Message_Resource_Manager' => EE_Dependency_Map::load_from_cache, |
|
511 | + 'EventEspresso\core\services\request\Request' => EE_Dependency_Map::load_from_cache, |
|
512 | + ], |
|
513 | + 'EventEspresso\core\services\commands\CommandBus' => [ |
|
514 | + 'EventEspresso\core\services\commands\CommandHandlerManager' => EE_Dependency_Map::load_from_cache, |
|
515 | + ], |
|
516 | + 'EventEspresso\services\commands\CommandHandler' => [ |
|
517 | + 'EE_Registry' => EE_Dependency_Map::load_from_cache, |
|
518 | + 'CommandBusInterface' => EE_Dependency_Map::load_from_cache, |
|
519 | + ], |
|
520 | + 'EventEspresso\core\services\commands\CommandHandlerManager' => [ |
|
521 | + 'EventEspresso\core\services\loaders\Loader' => EE_Dependency_Map::load_from_cache, |
|
522 | + ], |
|
523 | + 'EventEspresso\core\services\commands\CompositeCommandHandler' => [ |
|
524 | + 'EventEspresso\core\services\commands\CommandBus' => EE_Dependency_Map::load_from_cache, |
|
525 | + 'EventEspresso\core\services\commands\CommandFactory' => EE_Dependency_Map::load_from_cache, |
|
526 | + ], |
|
527 | + 'EventEspresso\core\services\commands\CommandFactory' => [ |
|
528 | + 'EventEspresso\core\services\loaders\Loader' => EE_Dependency_Map::load_from_cache, |
|
529 | + ], |
|
530 | + 'EventEspresso\core\services\commands\middleware\CapChecker' => [ |
|
531 | + 'EventEspresso\core\domain\services\capabilities\CapabilitiesChecker' => EE_Dependency_Map::load_from_cache, |
|
532 | + ], |
|
533 | + 'EventEspresso\core\domain\services\capabilities\CapabilitiesChecker' => [ |
|
534 | + 'EE_Capabilities' => EE_Dependency_Map::load_from_cache, |
|
535 | + ], |
|
536 | + 'EventEspresso\core\domain\services\capabilities\RegistrationsCapChecker' => [ |
|
537 | + 'EE_Capabilities' => EE_Dependency_Map::load_from_cache, |
|
538 | + ], |
|
539 | + 'EventEspresso\core\domain\services\commands\registration\CreateRegistrationCommandHandler' => [ |
|
540 | + 'EventEspresso\core\domain\services\registration\CreateRegistrationService' => EE_Dependency_Map::load_from_cache, |
|
541 | + ], |
|
542 | + 'EventEspresso\core\domain\services\commands\registration\CopyRegistrationDetailsCommandHandler' => [ |
|
543 | + 'EventEspresso\core\domain\services\registration\CopyRegistrationService' => EE_Dependency_Map::load_from_cache, |
|
544 | + ], |
|
545 | + 'EventEspresso\core\domain\services\commands\registration\CopyRegistrationPaymentsCommandHandler' => [ |
|
546 | + 'EventEspresso\core\domain\services\registration\CopyRegistrationService' => EE_Dependency_Map::load_from_cache, |
|
547 | + ], |
|
548 | + 'EventEspresso\core\domain\services\commands\registration\CancelRegistrationAndTicketLineItemCommandHandler' => [ |
|
549 | + 'EventEspresso\core\domain\services\registration\CancelTicketLineItemService' => EE_Dependency_Map::load_from_cache, |
|
550 | + ], |
|
551 | + 'EventEspresso\core\domain\services\commands\registration\UpdateRegistrationAndTransactionAfterChangeCommandHandler' => [ |
|
552 | + 'EventEspresso\core\domain\services\registration\UpdateRegistrationService' => EE_Dependency_Map::load_from_cache, |
|
553 | + ], |
|
554 | + 'EventEspresso\core\domain\services\commands\ticket\CreateTicketLineItemCommandHandler' => [ |
|
555 | + 'EventEspresso\core\domain\services\ticket\CreateTicketLineItemService' => EE_Dependency_Map::load_from_cache, |
|
556 | + ], |
|
557 | + 'EventEspresso\core\domain\services\commands\ticket\CancelTicketLineItemCommandHandler' => [ |
|
558 | + 'EventEspresso\core\domain\services\ticket\CancelTicketLineItemService' => EE_Dependency_Map::load_from_cache, |
|
559 | + ], |
|
560 | + 'EventEspresso\core\domain\services\registration\CancelRegistrationService' => [ |
|
561 | + 'EventEspresso\core\domain\services\ticket\CancelTicketLineItemService' => EE_Dependency_Map::load_from_cache, |
|
562 | + ], |
|
563 | + 'EventEspresso\core\domain\services\commands\attendee\CreateAttendeeCommandHandler' => [ |
|
564 | + 'EEM_Attendee' => EE_Dependency_Map::load_from_cache, |
|
565 | + ], |
|
566 | + 'EventEspresso\core\services\database\TableManager' => [ |
|
567 | + 'EventEspresso\core\services\database\TableAnalysis' => EE_Dependency_Map::load_from_cache, |
|
568 | + ], |
|
569 | + 'EE_Data_Migration_Class_Base' => [ |
|
570 | + 'EventEspresso\core\services\database\TableAnalysis' => EE_Dependency_Map::load_from_cache, |
|
571 | + 'EventEspresso\core\services\database\TableManager' => EE_Dependency_Map::load_from_cache, |
|
572 | + ], |
|
573 | + 'EE_DMS_Core_4_1_0' => [ |
|
574 | + 'EventEspresso\core\services\database\TableAnalysis' => EE_Dependency_Map::load_from_cache, |
|
575 | + 'EventEspresso\core\services\database\TableManager' => EE_Dependency_Map::load_from_cache, |
|
576 | + ], |
|
577 | + 'EE_DMS_Core_4_2_0' => [ |
|
578 | + 'EventEspresso\core\services\database\TableAnalysis' => EE_Dependency_Map::load_from_cache, |
|
579 | + 'EventEspresso\core\services\database\TableManager' => EE_Dependency_Map::load_from_cache, |
|
580 | + ], |
|
581 | + 'EE_DMS_Core_4_3_0' => [ |
|
582 | + 'EventEspresso\core\services\database\TableAnalysis' => EE_Dependency_Map::load_from_cache, |
|
583 | + 'EventEspresso\core\services\database\TableManager' => EE_Dependency_Map::load_from_cache, |
|
584 | + ], |
|
585 | + 'EE_DMS_Core_4_4_0' => [ |
|
586 | + 'EventEspresso\core\services\database\TableAnalysis' => EE_Dependency_Map::load_from_cache, |
|
587 | + 'EventEspresso\core\services\database\TableManager' => EE_Dependency_Map::load_from_cache, |
|
588 | + ], |
|
589 | + 'EE_DMS_Core_4_5_0' => [ |
|
590 | + 'EventEspresso\core\services\database\TableAnalysis' => EE_Dependency_Map::load_from_cache, |
|
591 | + 'EventEspresso\core\services\database\TableManager' => EE_Dependency_Map::load_from_cache, |
|
592 | + ], |
|
593 | + 'EE_DMS_Core_4_6_0' => [ |
|
594 | + 'EventEspresso\core\services\database\TableAnalysis' => EE_Dependency_Map::load_from_cache, |
|
595 | + 'EventEspresso\core\services\database\TableManager' => EE_Dependency_Map::load_from_cache, |
|
596 | + ], |
|
597 | + 'EE_DMS_Core_4_7_0' => [ |
|
598 | + 'EventEspresso\core\services\database\TableAnalysis' => EE_Dependency_Map::load_from_cache, |
|
599 | + 'EventEspresso\core\services\database\TableManager' => EE_Dependency_Map::load_from_cache, |
|
600 | + ], |
|
601 | + 'EE_DMS_Core_4_8_0' => [ |
|
602 | + 'EventEspresso\core\services\database\TableAnalysis' => EE_Dependency_Map::load_from_cache, |
|
603 | + 'EventEspresso\core\services\database\TableManager' => EE_Dependency_Map::load_from_cache, |
|
604 | + ], |
|
605 | + 'EE_DMS_Core_4_9_0' => [ |
|
606 | + 'EventEspresso\core\services\database\TableAnalysis' => EE_Dependency_Map::load_from_cache, |
|
607 | + 'EventEspresso\core\services\database\TableManager' => EE_Dependency_Map::load_from_cache, |
|
608 | + ], |
|
609 | + 'EE_DMS_Core_4_10_0' => [ |
|
610 | + 'EventEspresso\core\services\database\TableAnalysis' => EE_Dependency_Map::load_from_cache, |
|
611 | + 'EventEspresso\core\services\database\TableManager' => EE_Dependency_Map::load_from_cache, |
|
612 | + 'EE_DMS_Core_4_9_0' => EE_Dependency_Map::load_from_cache, |
|
613 | + ], |
|
614 | + 'EventEspresso\core\services\assets\I18nRegistry' => [ |
|
615 | + 'EventEspresso\core\domain\Domain' => EE_Dependency_Map::load_from_cache, |
|
616 | + ], |
|
617 | + 'EventEspresso\core\services\assets\Registry' => [ |
|
618 | + 'EventEspresso\core\services\assets\AssetCollection' => EE_Dependency_Map::load_from_cache, |
|
619 | + 'EventEspresso\core\services\assets\I18nRegistry' => EE_Dependency_Map::load_from_cache, |
|
620 | + ], |
|
621 | + 'EventEspresso\core\domain\entities\shortcodes\EspressoCancelled' => [ |
|
622 | + 'EventEspresso\core\services\cache\PostRelatedCacheManager' => EE_Dependency_Map::load_from_cache, |
|
623 | + ], |
|
624 | + 'EventEspresso\core\domain\entities\shortcodes\EspressoCheckout' => [ |
|
625 | + 'EventEspresso\core\services\cache\PostRelatedCacheManager' => EE_Dependency_Map::load_from_cache, |
|
626 | + ], |
|
627 | + 'EventEspresso\core\domain\entities\shortcodes\EspressoEventAttendees' => [ |
|
628 | + 'EventEspresso\core\services\cache\PostRelatedCacheManager' => EE_Dependency_Map::load_from_cache, |
|
629 | + ], |
|
630 | + 'EventEspresso\core\domain\entities\shortcodes\EspressoEvents' => [ |
|
631 | + 'EventEspresso\core\services\cache\PostRelatedCacheManager' => EE_Dependency_Map::load_from_cache, |
|
632 | + ], |
|
633 | + 'EventEspresso\core\domain\entities\shortcodes\EspressoThankYou' => [ |
|
634 | + 'EventEspresso\core\services\cache\PostRelatedCacheManager' => EE_Dependency_Map::load_from_cache, |
|
635 | + ], |
|
636 | + 'EventEspresso\core\domain\entities\shortcodes\EspressoTicketSelector' => [ |
|
637 | + 'EventEspresso\core\services\cache\PostRelatedCacheManager' => EE_Dependency_Map::load_from_cache, |
|
638 | + ], |
|
639 | + 'EventEspresso\core\domain\entities\shortcodes\EspressoTxnPage' => [ |
|
640 | + 'EventEspresso\core\services\cache\PostRelatedCacheManager' => EE_Dependency_Map::load_from_cache, |
|
641 | + ], |
|
642 | + 'EventEspresso\core\services\cache\BasicCacheManager' => [ |
|
643 | + 'EventEspresso\core\services\cache\TransientCacheStorage' => EE_Dependency_Map::load_from_cache, |
|
644 | + ], |
|
645 | + 'EventEspresso\core\services\cache\PostRelatedCacheManager' => [ |
|
646 | + 'EventEspresso\core\services\cache\TransientCacheStorage' => EE_Dependency_Map::load_from_cache, |
|
647 | + ], |
|
648 | + 'EventEspresso\core\domain\services\validation\email\EmailValidationService' => [ |
|
649 | + 'EE_Registration_Config' => EE_Dependency_Map::load_from_cache, |
|
650 | + 'EventEspresso\core\services\loaders\Loader' => EE_Dependency_Map::load_from_cache, |
|
651 | + ], |
|
652 | + 'EventEspresso\core\domain\values\EmailAddress' => [ |
|
653 | + null, |
|
654 | + 'EventEspresso\core\domain\services\validation\email\EmailValidationService' => EE_Dependency_Map::load_from_cache, |
|
655 | + ], |
|
656 | + 'EventEspresso\core\services\orm\ModelFieldFactory' => [ |
|
657 | + 'EventEspresso\core\services\loaders\Loader' => EE_Dependency_Map::load_from_cache, |
|
658 | + ], |
|
659 | + 'LEGACY_MODELS' => [ |
|
660 | + null, |
|
661 | + 'EventEspresso\core\services\database\ModelFieldFactory' => EE_Dependency_Map::load_from_cache, |
|
662 | + ], |
|
663 | + 'EE_Module_Request_Router' => [ |
|
664 | + 'EventEspresso\core\services\request\Request' => EE_Dependency_Map::load_from_cache, |
|
665 | + ], |
|
666 | + 'EE_Registration_Processor' => [ |
|
667 | + 'EventEspresso\core\services\request\Request' => EE_Dependency_Map::load_from_cache, |
|
668 | + ], |
|
669 | + 'EventEspresso\core\services\notifications\PersistentAdminNoticeManager' => [ |
|
670 | + 'EventEspresso\core\domain\services\capabilities\CapabilitiesChecker' => EE_Dependency_Map::load_from_cache, |
|
671 | + 'EventEspresso\core\services\request\Request' => EE_Dependency_Map::load_from_cache, |
|
672 | + ], |
|
673 | + 'EventEspresso\core\services\licensing\LicenseService' => [ |
|
674 | + 'EventEspresso\core\domain\services\pue\Stats' => EE_Dependency_Map::load_from_cache, |
|
675 | + 'EventEspresso\core\domain\services\pue\Config' => EE_Dependency_Map::load_from_cache, |
|
676 | + ], |
|
677 | + 'EE_Admin_Transactions_List_Table' => [ |
|
678 | + null, |
|
679 | + 'EventEspresso\core\domain\values\session\SessionLifespan' => EE_Dependency_Map::load_from_cache, |
|
680 | + ], |
|
681 | + 'EventEspresso\core\domain\services\pue\Stats' => [ |
|
682 | + 'EventEspresso\core\domain\services\pue\Config' => EE_Dependency_Map::load_from_cache, |
|
683 | + 'EE_Maintenance_Mode' => EE_Dependency_Map::load_from_cache, |
|
684 | + 'EventEspresso\core\domain\services\pue\StatsGatherer' => EE_Dependency_Map::load_from_cache, |
|
685 | + ], |
|
686 | + 'EventEspresso\core\domain\services\pue\Config' => [ |
|
687 | + 'EE_Network_Config' => EE_Dependency_Map::load_from_cache, |
|
688 | + 'EE_Config' => EE_Dependency_Map::load_from_cache, |
|
689 | + ], |
|
690 | + 'EventEspresso\core\domain\services\pue\StatsGatherer' => [ |
|
691 | + 'EEM_Payment_Method' => EE_Dependency_Map::load_from_cache, |
|
692 | + 'EEM_Event' => EE_Dependency_Map::load_from_cache, |
|
693 | + 'EEM_Datetime' => EE_Dependency_Map::load_from_cache, |
|
694 | + 'EEM_Ticket' => EE_Dependency_Map::load_from_cache, |
|
695 | + 'EEM_Registration' => EE_Dependency_Map::load_from_cache, |
|
696 | + 'EEM_Transaction' => EE_Dependency_Map::load_from_cache, |
|
697 | + 'EE_Config' => EE_Dependency_Map::load_from_cache, |
|
698 | + ], |
|
699 | + 'EventEspresso\core\domain\services\admin\ExitModal' => [ |
|
700 | + 'EventEspresso\core\services\assets\Registry' => EE_Dependency_Map::load_from_cache, |
|
701 | + ], |
|
702 | + 'EventEspresso\core\domain\services\admin\PluginUpsells' => [ |
|
703 | + 'EventEspresso\core\domain\Domain' => EE_Dependency_Map::load_from_cache, |
|
704 | + ], |
|
705 | + 'EventEspresso\caffeinated\modules\recaptcha_invisible\InvisibleRecaptcha' => [ |
|
706 | + 'EE_Registration_Config' => EE_Dependency_Map::load_from_cache, |
|
707 | + 'EE_Session' => EE_Dependency_Map::load_from_cache, |
|
708 | + ], |
|
709 | + 'EventEspresso\caffeinated\modules\recaptcha_invisible\RecaptchaAdminSettings' => [ |
|
710 | + 'EE_Registration_Config' => EE_Dependency_Map::load_from_cache, |
|
711 | + ], |
|
712 | + 'EventEspresso\modules\ticket_selector\DisplayTicketSelector' => [ |
|
713 | + 'EventEspresso\core\services\request\Request' => EE_Dependency_Map::load_from_cache, |
|
714 | + 'EE_Ticket_Selector_Config' => EE_Dependency_Map::load_from_cache, |
|
715 | + ], |
|
716 | + 'EventEspresso\modules\ticket_selector\ProcessTicketSelector' => [ |
|
717 | + 'EE_Core_Config' => EE_Dependency_Map::load_from_cache, |
|
718 | + 'EventEspresso\core\services\request\Request' => EE_Dependency_Map::load_from_cache, |
|
719 | + 'EE_Session' => EE_Dependency_Map::load_from_cache, |
|
720 | + 'EEM_Ticket' => EE_Dependency_Map::load_from_cache, |
|
721 | + 'EventEspresso\modules\ticket_selector\TicketDatetimeAvailabilityTracker' => EE_Dependency_Map::load_from_cache, |
|
722 | + ], |
|
723 | + 'EventEspresso\modules\ticket_selector\TicketDatetimeAvailabilityTracker' => [ |
|
724 | + 'EEM_Datetime' => EE_Dependency_Map::load_from_cache, |
|
725 | + ], |
|
726 | + 'EventEspresso\core\domain\entities\custom_post_types\CustomPostTypeDefinitions' => [ |
|
727 | + 'EE_Core_Config' => EE_Dependency_Map::load_from_cache, |
|
728 | + 'EventEspresso\core\services\loaders\Loader' => EE_Dependency_Map::load_from_cache, |
|
729 | + ], |
|
730 | + 'EventEspresso\core\domain\services\custom_post_types\RegisterCustomPostTypes' => [ |
|
731 | + 'EventEspresso\core\domain\entities\custom_post_types\CustomPostTypeDefinitions' => EE_Dependency_Map::load_from_cache, |
|
732 | + ], |
|
733 | + 'EventEspresso\core\domain\services\custom_post_types\RegisterCustomTaxonomies' => [ |
|
734 | + 'EventEspresso\core\domain\entities\custom_post_types\CustomTaxonomyDefinitions' => EE_Dependency_Map::load_from_cache, |
|
735 | + ], |
|
736 | + 'EE_CPT_Strategy' => [ |
|
737 | + 'EventEspresso\core\domain\entities\custom_post_types\CustomPostTypeDefinitions' => EE_Dependency_Map::load_from_cache, |
|
738 | + 'EventEspresso\core\domain\entities\custom_post_types\CustomTaxonomyDefinitions' => EE_Dependency_Map::load_from_cache, |
|
739 | + ], |
|
740 | + 'EventEspresso\core\services\loaders\ObjectIdentifier' => [ |
|
741 | + 'EventEspresso\core\services\loaders\ClassInterfaceCache' => EE_Dependency_Map::load_from_cache, |
|
742 | + ], |
|
743 | + 'EventEspresso\core\domain\services\assets\CoreAssetManager' => [ |
|
744 | + 'EventEspresso\core\services\assets\AssetCollection' => EE_Dependency_Map::load_from_cache, |
|
745 | + 'EE_Currency_Config' => EE_Dependency_Map::load_from_cache, |
|
746 | + 'EE_Template_Config' => EE_Dependency_Map::load_from_cache, |
|
747 | + 'EventEspresso\core\domain\Domain' => EE_Dependency_Map::load_from_cache, |
|
748 | + 'EventEspresso\core\services\assets\Registry' => EE_Dependency_Map::load_from_cache, |
|
749 | + ], |
|
750 | + 'EventEspresso\core\domain\services\admin\privacy\policy\PrivacyPolicy' => [ |
|
751 | + 'EEM_Payment_Method' => EE_Dependency_Map::load_from_cache, |
|
752 | + 'EventEspresso\core\domain\values\session\SessionLifespan' => EE_Dependency_Map::load_from_cache, |
|
753 | + ], |
|
754 | + 'EventEspresso\core\domain\services\admin\privacy\export\ExportAttendee' => [ |
|
755 | + 'EEM_Attendee' => EE_Dependency_Map::load_from_cache, |
|
756 | + ], |
|
757 | + 'EventEspresso\core\domain\services\admin\privacy\export\ExportAttendeeBillingData' => [ |
|
758 | + 'EEM_Attendee' => EE_Dependency_Map::load_from_cache, |
|
759 | + 'EEM_Payment_Method' => EE_Dependency_Map::load_from_cache, |
|
760 | + ], |
|
761 | + 'EventEspresso\core\domain\services\admin\privacy\export\ExportCheckins' => [ |
|
762 | + 'EEM_Checkin' => EE_Dependency_Map::load_from_cache, |
|
763 | + ], |
|
764 | + 'EventEspresso\core\domain\services\admin\privacy\export\ExportRegistration' => [ |
|
765 | + 'EEM_Registration' => EE_Dependency_Map::load_from_cache, |
|
766 | + ], |
|
767 | + 'EventEspresso\core\domain\services\admin\privacy\export\ExportTransaction' => [ |
|
768 | + 'EEM_Transaction' => EE_Dependency_Map::load_from_cache, |
|
769 | + ], |
|
770 | + 'EventEspresso\core\domain\services\admin\privacy\erasure\EraseAttendeeData' => [ |
|
771 | + 'EEM_Attendee' => EE_Dependency_Map::load_from_cache, |
|
772 | + ], |
|
773 | + 'EventEspresso\core\domain\services\admin\privacy\erasure\EraseAnswers' => [ |
|
774 | + 'EEM_Answer' => EE_Dependency_Map::load_from_cache, |
|
775 | + 'EEM_Question' => EE_Dependency_Map::load_from_cache, |
|
776 | + ], |
|
777 | + 'EventEspresso\core\CPTs\CptQueryModifier' => [ |
|
778 | + null, |
|
779 | + null, |
|
780 | + null, |
|
781 | + 'EventEspresso\core\services\request\CurrentPage' => EE_Dependency_Map::load_from_cache, |
|
782 | + 'EventEspresso\core\services\request\Request' => EE_Dependency_Map::load_from_cache, |
|
783 | + 'EventEspresso\core\services\loaders\Loader' => EE_Dependency_Map::load_from_cache, |
|
784 | + ], |
|
785 | + 'EventEspresso\core\domain\services\admin\privacy\forms\PrivacySettingsFormHandler' => [ |
|
786 | + 'EE_Registry' => EE_Dependency_Map::load_from_cache, |
|
787 | + 'EE_Config' => EE_Dependency_Map::load_from_cache, |
|
788 | + ], |
|
789 | + 'EventEspresso\core\services\editor\BlockRegistrationManager' => [ |
|
790 | + 'EventEspresso\core\services\assets\BlockAssetManagerCollection' => EE_Dependency_Map::load_from_cache, |
|
791 | + 'EventEspresso\core\domain\entities\editor\BlockCollection' => EE_Dependency_Map::load_from_cache, |
|
792 | + 'EventEspresso\core\services\route_match\RouteMatchSpecificationManager' => EE_Dependency_Map::load_from_cache, |
|
793 | + 'EventEspresso\core\services\request\Request' => EE_Dependency_Map::load_from_cache, |
|
794 | + ], |
|
795 | + 'EventEspresso\core\domain\entities\editor\CoreBlocksAssetManager' => [ |
|
796 | + 'EventEspresso\core\domain\Domain' => EE_Dependency_Map::load_from_cache, |
|
797 | + 'EventEspresso\core\services\assets\AssetCollection' => EE_Dependency_Map::load_from_cache, |
|
798 | + 'EventEspresso\core\services\assets\Registry' => EE_Dependency_Map::load_from_cache, |
|
799 | + ], |
|
800 | + 'EventEspresso\core\domain\services\blocks\EventAttendeesBlockRenderer' => [ |
|
801 | + 'EventEspresso\core\domain\Domain' => EE_Dependency_Map::load_from_cache, |
|
802 | + 'EEM_Attendee' => EE_Dependency_Map::load_from_cache, |
|
803 | + ], |
|
804 | + 'EventEspresso\core\domain\entities\editor\blocks\EventAttendees' => [ |
|
805 | + 'EventEspresso\core\domain\entities\editor\CoreBlocksAssetManager' => self::load_from_cache, |
|
806 | + 'EventEspresso\core\services\request\Request' => EE_Dependency_Map::load_from_cache, |
|
807 | + 'EventEspresso\core\domain\services\blocks\EventAttendeesBlockRenderer' => self::load_from_cache, |
|
808 | + ], |
|
809 | + 'EventEspresso\core\services\route_match\RouteMatchSpecificationDependencyResolver' => [ |
|
810 | + 'EventEspresso\core\services\container\Mirror' => EE_Dependency_Map::load_from_cache, |
|
811 | + 'EventEspresso\core\services\loaders\ClassInterfaceCache' => EE_Dependency_Map::load_from_cache, |
|
812 | + 'EE_Dependency_Map' => EE_Dependency_Map::load_from_cache, |
|
813 | + ], |
|
814 | + 'EventEspresso\core\services\route_match\RouteMatchSpecificationFactory' => [ |
|
815 | + 'EventEspresso\core\services\route_match\RouteMatchSpecificationDependencyResolver' => EE_Dependency_Map::load_from_cache, |
|
816 | + 'EventEspresso\core\services\loaders\Loader' => EE_Dependency_Map::load_from_cache, |
|
817 | + ], |
|
818 | + 'EventEspresso\core\services\route_match\RouteMatchSpecificationManager' => [ |
|
819 | + 'EventEspresso\core\services\route_match\RouteMatchSpecificationCollection' => EE_Dependency_Map::load_from_cache, |
|
820 | + 'EventEspresso\core\services\route_match\RouteMatchSpecificationFactory' => EE_Dependency_Map::load_from_cache, |
|
821 | + ], |
|
822 | + 'EventEspresso\core\libraries\rest_api\CalculatedModelFields' => [ |
|
823 | + 'EventEspresso\core\libraries\rest_api\calculations\CalculatedModelFieldsFactory' => EE_Dependency_Map::load_from_cache, |
|
824 | + ], |
|
825 | + 'EventEspresso\core\libraries\rest_api\calculations\CalculatedModelFieldsFactory' => [ |
|
826 | + 'EventEspresso\core\services\loaders\Loader' => EE_Dependency_Map::load_from_cache, |
|
827 | + ], |
|
828 | + 'EventEspresso\core\libraries\rest_api\controllers\model\Read' => [ |
|
829 | + 'EventEspresso\core\libraries\rest_api\CalculatedModelFields' => EE_Dependency_Map::load_from_cache, |
|
830 | + ], |
|
831 | + 'EventEspresso\core\libraries\rest_api\calculations\Datetime' => [ |
|
832 | + 'EEM_Datetime' => EE_Dependency_Map::load_from_cache, |
|
833 | + 'EEM_Registration' => EE_Dependency_Map::load_from_cache, |
|
834 | + ], |
|
835 | + 'EventEspresso\core\libraries\rest_api\calculations\Event' => [ |
|
836 | + 'EEM_Event' => EE_Dependency_Map::load_from_cache, |
|
837 | + 'EEM_Registration' => EE_Dependency_Map::load_from_cache, |
|
838 | + ], |
|
839 | + 'EventEspresso\core\libraries\rest_api\calculations\Registration' => [ |
|
840 | + 'EEM_Registration' => EE_Dependency_Map::load_from_cache, |
|
841 | + ], |
|
842 | + 'EventEspresso\core\services\session\SessionStartHandler' => [ |
|
843 | + 'EventEspresso\core\services\request\Request' => EE_Dependency_Map::load_from_cache, |
|
844 | + ], |
|
845 | + 'EE_URL_Validation_Strategy' => [ |
|
846 | + null, |
|
847 | + null, |
|
848 | + 'EventEspresso\core\services\validators\URLValidator' => EE_Dependency_Map::load_from_cache, |
|
849 | + ], |
|
850 | + 'EventEspresso\admin_pages\general_settings\OrganizationSettings' => [ |
|
851 | + 'EE_Registry' => EE_Dependency_Map::load_from_cache, |
|
852 | + 'EE_Organization_Config' => EE_Dependency_Map::load_from_cache, |
|
853 | + 'EE_Core_Config' => EE_Dependency_Map::load_from_cache, |
|
854 | + 'EE_Network_Core_Config' => EE_Dependency_Map::load_from_cache, |
|
855 | + 'EventEspresso\core\services\address\CountrySubRegionDao' => EE_Dependency_Map::load_from_cache, |
|
856 | + ], |
|
857 | + 'EventEspresso\core\services\address\CountrySubRegionDao' => [ |
|
858 | + 'EEM_State' => EE_Dependency_Map::load_from_cache, |
|
859 | + 'EventEspresso\core\services\validators\JsonValidator' => EE_Dependency_Map::load_from_cache, |
|
860 | + ], |
|
861 | + 'EventEspresso\core\domain\services\admin\ajax\WordpressHeartbeat' => [ |
|
862 | + 'EventEspresso\core\services\loaders\Loader' => EE_Dependency_Map::load_from_cache, |
|
863 | + 'EventEspresso\core\services\request\Request' => EE_Dependency_Map::load_from_cache, |
|
864 | + ], |
|
865 | + 'EventEspresso\core\domain\services\admin\ajax\EventEditorHeartbeat' => [ |
|
866 | + 'EventEspresso\core\domain\Domain' => EE_Dependency_Map::load_from_cache, |
|
867 | + 'EE_Environment_Config' => EE_Dependency_Map::load_from_cache, |
|
868 | + ], |
|
869 | + 'EventEspresso\core\services\request\files\FilesDataHandler' => [ |
|
870 | + 'EventEspresso\core\services\request\Request' => EE_Dependency_Map::load_from_cache, |
|
871 | + ], |
|
872 | + 'EventEspressoBatchRequest\BatchRequestProcessor' => [ |
|
873 | + 'EventEspresso\core\services\loaders\Loader' => EE_Dependency_Map::load_from_cache, |
|
874 | + ], |
|
875 | + 'EventEspresso\core\domain\services\admin\registrations\list_table\QueryBuilder' => [ |
|
876 | + 'EventEspresso\core\services\request\Request' => EE_Dependency_Map::load_from_cache, |
|
877 | + 'EEM_Registration' => EE_Dependency_Map::load_from_cache, |
|
878 | + null, |
|
879 | + ], |
|
880 | + 'EventEspresso\core\domain\services\admin\registrations\list_table\page_header\AttendeeFilterHeader' => [ |
|
881 | + 'EventEspresso\core\services\request\Request' => EE_Dependency_Map::load_from_cache, |
|
882 | + 'EEM_Attendee' => EE_Dependency_Map::load_from_cache, |
|
883 | + ], |
|
884 | + 'EventEspresso\core\domain\services\admin\registrations\list_table\page_header\DateFilterHeader' => [ |
|
885 | + 'EventEspresso\core\services\request\Request' => EE_Dependency_Map::load_from_cache, |
|
886 | + 'EEM_Datetime' => EE_Dependency_Map::load_from_cache, |
|
887 | + ], |
|
888 | + 'EventEspresso\core\domain\services\admin\registrations\list_table\page_header\EventFilterHeader' => [ |
|
889 | + 'EventEspresso\core\services\request\Request' => EE_Dependency_Map::load_from_cache, |
|
890 | + 'EEM_Event' => EE_Dependency_Map::load_from_cache, |
|
891 | + ], |
|
892 | + 'EventEspresso\core\domain\services\admin\registrations\list_table\page_header\TicketFilterHeader' => [ |
|
893 | + 'EventEspresso\core\services\request\Request' => EE_Dependency_Map::load_from_cache, |
|
894 | + 'EEM_Ticket' => EE_Dependency_Map::load_from_cache, |
|
895 | + ], |
|
896 | + 'EventEspressoBatchRequest\JobHandlers\ExecuteBatchDeletion' => [ |
|
897 | + 'EventEspresso\core\services\orm\tree_traversal\NodeGroupDao' => EE_Dependency_Map::load_from_cache, |
|
898 | + ], |
|
899 | + 'EventEspressoBatchRequest\JobHandlers\PreviewEventDeletion' => [ |
|
900 | + 'EventEspresso\core\services\orm\tree_traversal\NodeGroupDao' => EE_Dependency_Map::load_from_cache, |
|
901 | + ], |
|
902 | + 'EventEspresso\core\domain\services\admin\events\data\PreviewDeletion' => [ |
|
903 | + 'EventEspresso\core\services\orm\tree_traversal\NodeGroupDao' => EE_Dependency_Map::load_from_cache, |
|
904 | + 'EEM_Event' => EE_Dependency_Map::load_from_cache, |
|
905 | + 'EEM_Datetime' => EE_Dependency_Map::load_from_cache, |
|
906 | + 'EEM_Registration' => EE_Dependency_Map::load_from_cache, |
|
907 | + ], |
|
908 | + 'EventEspresso\core\domain\services\admin\events\data\ConfirmDeletion' => [ |
|
909 | + 'EventEspresso\core\services\orm\tree_traversal\NodeGroupDao' => EE_Dependency_Map::load_from_cache, |
|
910 | + ], |
|
911 | + 'EventEspresso\core\services\request\CurrentPage' => [ |
|
912 | + 'EE_CPT_Strategy' => EE_Dependency_Map::load_from_cache, |
|
913 | + 'EventEspresso\core\services\request\Request' => EE_Dependency_Map::load_from_cache, |
|
914 | + ], |
|
915 | + 'EventEspresso\core\services\shortcodes\LegacyShortcodesManager' => [ |
|
916 | + 'EE_Registry' => EE_Dependency_Map::load_from_cache, |
|
917 | + 'EventEspresso\core\services\request\CurrentPage' => EE_Dependency_Map::load_from_cache, |
|
918 | + ], |
|
919 | + 'EventEspresso\core\services\shortcodes\ShortcodesManager' => [ |
|
920 | + 'EventEspresso\core\services\shortcodes\LegacyShortcodesManager' => EE_Dependency_Map::load_from_cache, |
|
921 | + 'EventEspresso\core\services\request\CurrentPage' => EE_Dependency_Map::load_from_cache, |
|
922 | + ], |
|
923 | + 'EventEspresso\core\services\activation\plugin_prompt\DownloadPluginPromptManager' => [ |
|
924 | + 'EventEspresso\core\domain\services\capabilities\CapabilitiesChecker' => EE_Dependency_Map::load_from_cache |
|
925 | + ], |
|
926 | + ]; |
|
927 | + } |
|
928 | + |
|
929 | + |
|
930 | + /** |
|
931 | + * Registers how core classes are loaded. |
|
932 | + * This can either be done by simply providing the name of one of the EE_Registry loader methods such as: |
|
933 | + * 'EE_Request_Handler' => 'load_core' |
|
934 | + * 'EE_Messages_Queue' => 'load_lib' |
|
935 | + * 'EEH_Debug_Tools' => 'load_helper' |
|
936 | + * or, if greater control is required, by providing a custom closure. For example: |
|
937 | + * 'Some_Class' => function () { |
|
938 | + * return new Some_Class(); |
|
939 | + * }, |
|
940 | + * This is required for instantiating dependencies |
|
941 | + * where an interface has been type hinted in a class constructor. For example: |
|
942 | + * 'Required_Interface' => function () { |
|
943 | + * return new A_Class_That_Implements_Required_Interface(); |
|
944 | + * }, |
|
945 | + */ |
|
946 | + protected function _register_core_class_loaders() |
|
947 | + { |
|
948 | + $this->_class_loaders = [ |
|
949 | + // load_core |
|
950 | + 'EE_Dependency_Map' => function () { |
|
951 | + return $this; |
|
952 | + }, |
|
953 | + 'EE_Capabilities' => 'load_core', |
|
954 | + 'EE_Encryption' => 'load_core', |
|
955 | + 'EE_Front_Controller' => 'load_core', |
|
956 | + 'EE_Module_Request_Router' => 'load_core', |
|
957 | + 'EE_Registry' => 'load_core', |
|
958 | + 'EE_Request' => function () { |
|
959 | + return $this->legacy_request; |
|
960 | + }, |
|
961 | + 'EventEspresso\core\services\request\Request' => function () { |
|
962 | + return $this->request; |
|
963 | + }, |
|
964 | + 'EventEspresso\core\services\request\Response' => function () { |
|
965 | + return $this->response; |
|
966 | + }, |
|
967 | + 'EE_Base' => 'load_core', |
|
968 | + 'EE_Request_Handler' => 'load_core', |
|
969 | + 'EE_Session' => 'load_core', |
|
970 | + 'EE_Cron_Tasks' => 'load_core', |
|
971 | + 'EE_System' => 'load_core', |
|
972 | + 'EE_Maintenance_Mode' => 'load_core', |
|
973 | + 'EE_Register_CPTs' => 'load_core', |
|
974 | + 'EE_Admin' => 'load_core', |
|
975 | + 'EE_CPT_Strategy' => 'load_core', |
|
976 | + // load_class |
|
977 | + 'EE_Registration_Processor' => 'load_class', |
|
978 | + // load_lib |
|
979 | + 'EE_Message_Resource_Manager' => 'load_lib', |
|
980 | + 'EE_Message_Type_Collection' => 'load_lib', |
|
981 | + 'EE_Message_Type_Collection_Loader' => 'load_lib', |
|
982 | + 'EE_Messenger_Collection' => 'load_lib', |
|
983 | + 'EE_Messenger_Collection_Loader' => 'load_lib', |
|
984 | + 'EE_Messages_Processor' => 'load_lib', |
|
985 | + 'EE_Message_Repository' => 'load_lib', |
|
986 | + 'EE_Messages_Queue' => 'load_lib', |
|
987 | + 'EE_Messages_Data_Handler_Collection' => 'load_lib', |
|
988 | + 'EE_Message_Template_Group_Collection' => 'load_lib', |
|
989 | + 'EE_Payment_Method_Manager' => 'load_lib', |
|
990 | + 'EE_DMS_Core_4_1_0' => 'load_dms', |
|
991 | + 'EE_DMS_Core_4_2_0' => 'load_dms', |
|
992 | + 'EE_DMS_Core_4_3_0' => 'load_dms', |
|
993 | + 'EE_DMS_Core_4_5_0' => 'load_dms', |
|
994 | + 'EE_DMS_Core_4_6_0' => 'load_dms', |
|
995 | + 'EE_DMS_Core_4_7_0' => 'load_dms', |
|
996 | + 'EE_DMS_Core_4_8_0' => 'load_dms', |
|
997 | + 'EE_DMS_Core_4_9_0' => 'load_dms', |
|
998 | + 'EE_DMS_Core_4_10_0' => 'load_dms', |
|
999 | + 'EE_Messages_Generator' => function () { |
|
1000 | + return EE_Registry::instance()->load_lib( |
|
1001 | + 'Messages_Generator', |
|
1002 | + [], |
|
1003 | + false, |
|
1004 | + false |
|
1005 | + ); |
|
1006 | + }, |
|
1007 | + 'EE_Messages_Template_Defaults' => function ($arguments = []) { |
|
1008 | + return EE_Registry::instance()->load_lib( |
|
1009 | + 'Messages_Template_Defaults', |
|
1010 | + $arguments, |
|
1011 | + false, |
|
1012 | + false |
|
1013 | + ); |
|
1014 | + }, |
|
1015 | + // load_helper |
|
1016 | + 'EEH_Parse_Shortcodes' => function () { |
|
1017 | + if (EE_Registry::instance()->load_helper('Parse_Shortcodes')) { |
|
1018 | + return new EEH_Parse_Shortcodes(); |
|
1019 | + } |
|
1020 | + return null; |
|
1021 | + }, |
|
1022 | + 'EE_Template_Config' => function () { |
|
1023 | + return EE_Config::instance()->template_settings; |
|
1024 | + }, |
|
1025 | + 'EE_Currency_Config' => function () { |
|
1026 | + return EE_Config::instance()->currency; |
|
1027 | + }, |
|
1028 | + 'EE_Registration_Config' => function () { |
|
1029 | + return EE_Config::instance()->registration; |
|
1030 | + }, |
|
1031 | + 'EE_Core_Config' => function () { |
|
1032 | + return EE_Config::instance()->core; |
|
1033 | + }, |
|
1034 | + 'EventEspresso\core\services\loaders\Loader' => function () { |
|
1035 | + return LoaderFactory::getLoader(); |
|
1036 | + }, |
|
1037 | + 'EE_Network_Config' => function () { |
|
1038 | + return EE_Network_Config::instance(); |
|
1039 | + }, |
|
1040 | + 'EE_Config' => function () { |
|
1041 | + return EE_Config::instance(); |
|
1042 | + }, |
|
1043 | + 'EventEspresso\core\domain\Domain' => function () { |
|
1044 | + return DomainFactory::getEventEspressoCoreDomain(); |
|
1045 | + }, |
|
1046 | + 'EE_Admin_Config' => function () { |
|
1047 | + return EE_Config::instance()->admin; |
|
1048 | + }, |
|
1049 | + 'EE_Organization_Config' => function () { |
|
1050 | + return EE_Config::instance()->organization; |
|
1051 | + }, |
|
1052 | + 'EE_Network_Core_Config' => function () { |
|
1053 | + return EE_Network_Config::instance()->core; |
|
1054 | + }, |
|
1055 | + 'EE_Environment_Config' => function () { |
|
1056 | + return EE_Config::instance()->environment; |
|
1057 | + }, |
|
1058 | + 'EE_Ticket_Selector_Config' => function () { |
|
1059 | + return EE_Config::instance()->template_settings->EED_Ticket_Selector; |
|
1060 | + }, |
|
1061 | + ]; |
|
1062 | + } |
|
1063 | + |
|
1064 | + |
|
1065 | + /** |
|
1066 | + * can be used for supplying alternate names for classes, |
|
1067 | + * or for connecting interface names to instantiable classes |
|
1068 | + */ |
|
1069 | + protected function _register_core_aliases() |
|
1070 | + { |
|
1071 | + $aliases = [ |
|
1072 | + 'CommandBusInterface' => 'EventEspresso\core\services\commands\CommandBusInterface', |
|
1073 | + 'EventEspresso\core\services\commands\CommandBusInterface' => 'EventEspresso\core\services\commands\CommandBus', |
|
1074 | + 'CommandHandlerManagerInterface' => 'EventEspresso\core\services\commands\CommandHandlerManagerInterface', |
|
1075 | + 'EventEspresso\core\services\commands\CommandHandlerManagerInterface' => 'EventEspresso\core\services\commands\CommandHandlerManager', |
|
1076 | + 'CapChecker' => 'EventEspresso\core\services\commands\middleware\CapChecker', |
|
1077 | + 'AddActionHook' => 'EventEspresso\core\services\commands\middleware\AddActionHook', |
|
1078 | + 'CapabilitiesChecker' => 'EventEspresso\core\domain\services\capabilities\CapabilitiesChecker', |
|
1079 | + 'CapabilitiesCheckerInterface' => 'EventEspresso\core\domain\services\capabilities\CapabilitiesCheckerInterface', |
|
1080 | + 'EventEspresso\core\domain\services\capabilities\CapabilitiesCheckerInterface' => 'EventEspresso\core\domain\services\capabilities\CapabilitiesChecker', |
|
1081 | + 'CreateRegistrationService' => 'EventEspresso\core\domain\services\registration\CreateRegistrationService', |
|
1082 | + 'CreateRegistrationCommandHandler' => 'EventEspresso\core\domain\services\commands\registration\CreateRegistrationCommand', |
|
1083 | + 'CopyRegistrationDetailsCommandHandler' => 'EventEspresso\core\domain\services\commands\registration\CopyRegistrationDetailsCommand', |
|
1084 | + 'CopyRegistrationPaymentsCommandHandler' => 'EventEspresso\core\domain\services\commands\registration\CopyRegistrationPaymentsCommand', |
|
1085 | + 'CancelRegistrationAndTicketLineItemCommandHandler' => 'EventEspresso\core\domain\services\commands\registration\CancelRegistrationAndTicketLineItemCommandHandler', |
|
1086 | + 'UpdateRegistrationAndTransactionAfterChangeCommandHandler' => 'EventEspresso\core\domain\services\commands\registration\UpdateRegistrationAndTransactionAfterChangeCommandHandler', |
|
1087 | + 'CreateTicketLineItemCommandHandler' => 'EventEspresso\core\domain\services\commands\ticket\CreateTicketLineItemCommand', |
|
1088 | + 'CreateTransactionCommandHandler' => 'EventEspresso\core\domain\services\commands\transaction\CreateTransactionCommandHandler', |
|
1089 | + 'CreateAttendeeCommandHandler' => 'EventEspresso\core\domain\services\commands\attendee\CreateAttendeeCommandHandler', |
|
1090 | + 'TableManager' => 'EventEspresso\core\services\database\TableManager', |
|
1091 | + 'TableAnalysis' => 'EventEspresso\core\services\database\TableAnalysis', |
|
1092 | + 'EspressoShortcode' => 'EventEspresso\core\services\shortcodes\EspressoShortcode', |
|
1093 | + 'ShortcodeInterface' => 'EventEspresso\core\services\shortcodes\ShortcodeInterface', |
|
1094 | + 'EventEspresso\core\services\shortcodes\ShortcodeInterface' => 'EventEspresso\core\services\shortcodes\EspressoShortcode', |
|
1095 | + 'EventEspresso\core\services\cache\CacheStorageInterface' => 'EventEspresso\core\services\cache\TransientCacheStorage', |
|
1096 | + 'LoaderInterface' => 'EventEspresso\core\services\loaders\LoaderInterface', |
|
1097 | + 'EventEspresso\core\services\loaders\LoaderInterface' => 'EventEspresso\core\services\loaders\Loader', |
|
1098 | + 'CommandFactoryInterface' => 'EventEspresso\core\services\commands\CommandFactoryInterface', |
|
1099 | + 'EventEspresso\core\services\commands\CommandFactoryInterface' => 'EventEspresso\core\services\commands\CommandFactory', |
|
1100 | + 'EmailValidatorInterface' => 'EventEspresso\core\domain\services\validation\email\EmailValidatorInterface', |
|
1101 | + 'EventEspresso\core\domain\services\validation\email\EmailValidatorInterface' => 'EventEspresso\core\domain\services\validation\email\EmailValidationService', |
|
1102 | + 'NoticeConverterInterface' => 'EventEspresso\core\services\notices\NoticeConverterInterface', |
|
1103 | + 'EventEspresso\core\services\notices\NoticeConverterInterface' => 'EventEspresso\core\services\notices\ConvertNoticesToEeErrors', |
|
1104 | + 'NoticesContainerInterface' => 'EventEspresso\core\services\notices\NoticesContainerInterface', |
|
1105 | + 'EventEspresso\core\services\notices\NoticesContainerInterface' => 'EventEspresso\core\services\notices\NoticesContainer', |
|
1106 | + 'EventEspresso\core\services\request\RequestInterface' => 'EventEspresso\core\services\request\Request', |
|
1107 | + 'EventEspresso\core\services\request\ResponseInterface' => 'EventEspresso\core\services\request\Response', |
|
1108 | + 'EventEspresso\core\domain\DomainInterface' => 'EventEspresso\core\domain\Domain', |
|
1109 | + 'Registration_Processor' => 'EE_Registration_Processor', |
|
1110 | + ]; |
|
1111 | + foreach ($aliases as $alias => $fqn) { |
|
1112 | + if (is_array($fqn)) { |
|
1113 | + foreach ($fqn as $class => $for_class) { |
|
1114 | + $this->class_cache->addAlias($class, $alias, $for_class); |
|
1115 | + } |
|
1116 | + continue; |
|
1117 | + } |
|
1118 | + $this->class_cache->addAlias($fqn, $alias); |
|
1119 | + } |
|
1120 | + if (! (defined('DOING_AJAX') && DOING_AJAX) && is_admin()) { |
|
1121 | + $this->class_cache->addAlias( |
|
1122 | + 'EventEspresso\core\services\notices\ConvertNoticesToAdminNotices', |
|
1123 | + 'EventEspresso\core\services\notices\NoticeConverterInterface' |
|
1124 | + ); |
|
1125 | + } |
|
1126 | + } |
|
1127 | + |
|
1128 | + |
|
1129 | + public function debug($for_class = '') |
|
1130 | + { |
|
1131 | + $this->class_cache->debug($for_class); |
|
1132 | + } |
|
1133 | + |
|
1134 | + |
|
1135 | + /** |
|
1136 | + * This is used to reset the internal map and class_loaders to their original default state at the beginning of the |
|
1137 | + * request Primarily used by unit tests. |
|
1138 | + */ |
|
1139 | + public function reset() |
|
1140 | + { |
|
1141 | + $this->_register_core_class_loaders(); |
|
1142 | + $this->_register_core_dependencies(); |
|
1143 | + } |
|
1144 | + |
|
1145 | + |
|
1146 | + /** |
|
1147 | + * PLZ NOTE: a better name for this method would be is_alias() |
|
1148 | + * because it returns TRUE if the provided fully qualified name IS an alias |
|
1149 | + * WHY? |
|
1150 | + * Because if a class is type hinting for a concretion, |
|
1151 | + * then why would we need to find another class to supply it? |
|
1152 | + * ie: if a class asks for `Fully/Qualified/Namespace/SpecificClassName`, |
|
1153 | + * then give it an instance of `Fully/Qualified/Namespace/SpecificClassName`. |
|
1154 | + * Don't go looking for some substitute. |
|
1155 | + * Whereas if a class is type hinting for an interface... |
|
1156 | + * then we need to find an actual class to use. |
|
1157 | + * So the interface IS the alias for some other FQN, |
|
1158 | + * and we need to find out if `Fully/Qualified/Namespace/SomeInterface` |
|
1159 | + * represents some other class. |
|
1160 | + * |
|
1161 | + * @param string $fqn |
|
1162 | + * @param string $for_class |
|
1163 | + * @return bool |
|
1164 | + * @deprecated 4.9.62.p |
|
1165 | + */ |
|
1166 | + public function has_alias($fqn = '', $for_class = '') |
|
1167 | + { |
|
1168 | + return $this->isAlias($fqn, $for_class); |
|
1169 | + } |
|
1170 | + |
|
1171 | + |
|
1172 | + /** |
|
1173 | + * PLZ NOTE: a better name for this method would be get_fqn_for_alias() |
|
1174 | + * because it returns a FQN for provided alias if one exists, otherwise returns the original $alias |
|
1175 | + * functions recursively, so that multiple aliases can be used to drill down to a FQN |
|
1176 | + * for example: |
|
1177 | + * if the following two entries were added to the _aliases array: |
|
1178 | + * array( |
|
1179 | + * 'interface_alias' => 'some\namespace\interface' |
|
1180 | + * 'some\namespace\interface' => 'some\namespace\classname' |
|
1181 | + * ) |
|
1182 | + * then one could use EE_Registry::instance()->create( 'interface_alias' ) |
|
1183 | + * to load an instance of 'some\namespace\classname' |
|
1184 | + * |
|
1185 | + * @param string $alias |
|
1186 | + * @param string $for_class |
|
1187 | + * @return string |
|
1188 | + * @deprecated 4.9.62.p |
|
1189 | + */ |
|
1190 | + public function get_alias($alias = '', $for_class = '') |
|
1191 | + { |
|
1192 | + return $this->getFqnForAlias($alias, $for_class); |
|
1193 | + } |
|
1194 | 1194 | } |
@@ -16,25 +16,25 @@ |
||
16 | 16 | */ |
17 | 17 | class BotDetector extends Middleware |
18 | 18 | { |
19 | - /** |
|
20 | - * converts a Request to a Response |
|
21 | - * |
|
22 | - * @param RequestInterface $request |
|
23 | - * @param ResponseInterface $response |
|
24 | - * @return ResponseInterface |
|
25 | - */ |
|
26 | - public function handleRequest(RequestInterface $request, ResponseInterface $response) |
|
27 | - { |
|
28 | - $this->request = $request; |
|
29 | - $this->response = $response; |
|
30 | - /** @var CrawlerDetect $CrawlerDetect */ |
|
31 | - $CrawlerDetect = $this->loader->getShared('EventEspressoVendor\CrawlerDetect\CrawlerDetect'); |
|
32 | - if ($CrawlerDetect instanceof CrawlerDetect) { |
|
33 | - // Check and record the user agent of the current 'visitor' |
|
34 | - $this->request->setIsBot($CrawlerDetect->isCrawler()); |
|
35 | - $this->request->setUserAgent($CrawlerDetect->userAgent()); |
|
36 | - } |
|
37 | - $this->response = $this->processRequestStack($this->request, $this->response); |
|
38 | - return $this->response; |
|
39 | - } |
|
19 | + /** |
|
20 | + * converts a Request to a Response |
|
21 | + * |
|
22 | + * @param RequestInterface $request |
|
23 | + * @param ResponseInterface $response |
|
24 | + * @return ResponseInterface |
|
25 | + */ |
|
26 | + public function handleRequest(RequestInterface $request, ResponseInterface $response) |
|
27 | + { |
|
28 | + $this->request = $request; |
|
29 | + $this->response = $response; |
|
30 | + /** @var CrawlerDetect $CrawlerDetect */ |
|
31 | + $CrawlerDetect = $this->loader->getShared('EventEspressoVendor\CrawlerDetect\CrawlerDetect'); |
|
32 | + if ($CrawlerDetect instanceof CrawlerDetect) { |
|
33 | + // Check and record the user agent of the current 'visitor' |
|
34 | + $this->request->setIsBot($CrawlerDetect->isCrawler()); |
|
35 | + $this->request->setUserAgent($CrawlerDetect->userAgent()); |
|
36 | + } |
|
37 | + $this->response = $this->processRequestStack($this->request, $this->response); |
|
38 | + return $this->response; |
|
39 | + } |
|
40 | 40 | } |
@@ -38,103 +38,103 @@ |
||
38 | 38 | * @since 4.0 |
39 | 39 | */ |
40 | 40 | if (function_exists('espresso_version')) { |
41 | - if (! function_exists('espresso_duplicate_plugin_error')) { |
|
42 | - /** |
|
43 | - * espresso_duplicate_plugin_error |
|
44 | - * displays if more than one version of EE is activated at the same time |
|
45 | - */ |
|
46 | - function espresso_duplicate_plugin_error() |
|
47 | - { |
|
48 | - ?> |
|
41 | + if (! function_exists('espresso_duplicate_plugin_error')) { |
|
42 | + /** |
|
43 | + * espresso_duplicate_plugin_error |
|
44 | + * displays if more than one version of EE is activated at the same time |
|
45 | + */ |
|
46 | + function espresso_duplicate_plugin_error() |
|
47 | + { |
|
48 | + ?> |
|
49 | 49 | <div class="error"> |
50 | 50 | <p> |
51 | 51 | <?php |
52 | - echo esc_html__( |
|
53 | - 'Can not run multiple versions of Event Espresso! One version has been automatically deactivated. Please verify that you have the correct version you want still active.', |
|
54 | - 'event_espresso' |
|
55 | - ); ?> |
|
52 | + echo esc_html__( |
|
53 | + 'Can not run multiple versions of Event Espresso! One version has been automatically deactivated. Please verify that you have the correct version you want still active.', |
|
54 | + 'event_espresso' |
|
55 | + ); ?> |
|
56 | 56 | </p> |
57 | 57 | </div> |
58 | 58 | <?php |
59 | - espresso_deactivate_plugin(plugin_basename(__FILE__)); |
|
60 | - } |
|
61 | - } |
|
62 | - add_action('admin_notices', 'espresso_duplicate_plugin_error', 1); |
|
59 | + espresso_deactivate_plugin(plugin_basename(__FILE__)); |
|
60 | + } |
|
61 | + } |
|
62 | + add_action('admin_notices', 'espresso_duplicate_plugin_error', 1); |
|
63 | 63 | } else { |
64 | - define('EE_MIN_PHP_VER_REQUIRED', '5.6.2'); |
|
65 | - if (! version_compare(PHP_VERSION, EE_MIN_PHP_VER_REQUIRED, '>=')) { |
|
66 | - /** |
|
67 | - * espresso_minimum_php_version_error |
|
68 | - * |
|
69 | - * @return void |
|
70 | - */ |
|
71 | - function espresso_minimum_php_version_error() |
|
72 | - { |
|
73 | - ?> |
|
64 | + define('EE_MIN_PHP_VER_REQUIRED', '5.6.2'); |
|
65 | + if (! version_compare(PHP_VERSION, EE_MIN_PHP_VER_REQUIRED, '>=')) { |
|
66 | + /** |
|
67 | + * espresso_minimum_php_version_error |
|
68 | + * |
|
69 | + * @return void |
|
70 | + */ |
|
71 | + function espresso_minimum_php_version_error() |
|
72 | + { |
|
73 | + ?> |
|
74 | 74 | <div class="error"> |
75 | 75 | <p> |
76 | 76 | <?php |
77 | - printf( |
|
78 | - esc_html__( |
|
79 | - 'We\'re sorry, but Event Espresso requires PHP version %1$s or greater in order to operate. You are currently running version %2$s.%3$sIn order to update your version of PHP, you will need to contact your current hosting provider.%3$sFor information on stable PHP versions, please go to %4$s.', |
|
80 | - 'event_espresso' |
|
81 | - ), |
|
82 | - EE_MIN_PHP_VER_REQUIRED, |
|
83 | - PHP_VERSION, |
|
84 | - '<br/>', |
|
85 | - '<a href="http://php.net/downloads.php">http://php.net/downloads.php</a>' |
|
86 | - ); |
|
87 | - ?> |
|
77 | + printf( |
|
78 | + esc_html__( |
|
79 | + 'We\'re sorry, but Event Espresso requires PHP version %1$s or greater in order to operate. You are currently running version %2$s.%3$sIn order to update your version of PHP, you will need to contact your current hosting provider.%3$sFor information on stable PHP versions, please go to %4$s.', |
|
80 | + 'event_espresso' |
|
81 | + ), |
|
82 | + EE_MIN_PHP_VER_REQUIRED, |
|
83 | + PHP_VERSION, |
|
84 | + '<br/>', |
|
85 | + '<a href="http://php.net/downloads.php">http://php.net/downloads.php</a>' |
|
86 | + ); |
|
87 | + ?> |
|
88 | 88 | </p> |
89 | 89 | </div> |
90 | 90 | <?php |
91 | - espresso_deactivate_plugin(plugin_basename(__FILE__)); |
|
92 | - } |
|
91 | + espresso_deactivate_plugin(plugin_basename(__FILE__)); |
|
92 | + } |
|
93 | 93 | |
94 | - add_action('admin_notices', 'espresso_minimum_php_version_error', 1); |
|
95 | - } else { |
|
96 | - define('EVENT_ESPRESSO_MAIN_FILE', __FILE__); |
|
97 | - /** |
|
98 | - * espresso_version |
|
99 | - * Returns the plugin version |
|
100 | - * |
|
101 | - * @return string |
|
102 | - */ |
|
103 | - function espresso_version() |
|
104 | - { |
|
105 | - return apply_filters('FHEE__espresso__espresso_version', '4.10.39.rc.004'); |
|
106 | - } |
|
94 | + add_action('admin_notices', 'espresso_minimum_php_version_error', 1); |
|
95 | + } else { |
|
96 | + define('EVENT_ESPRESSO_MAIN_FILE', __FILE__); |
|
97 | + /** |
|
98 | + * espresso_version |
|
99 | + * Returns the plugin version |
|
100 | + * |
|
101 | + * @return string |
|
102 | + */ |
|
103 | + function espresso_version() |
|
104 | + { |
|
105 | + return apply_filters('FHEE__espresso__espresso_version', '4.10.39.rc.004'); |
|
106 | + } |
|
107 | 107 | |
108 | - /** |
|
109 | - * espresso_plugin_activation |
|
110 | - * adds a wp-option to indicate that EE has been activated via the WP admin plugins page |
|
111 | - */ |
|
112 | - function espresso_plugin_activation() |
|
113 | - { |
|
114 | - update_option('ee_espresso_activation', true); |
|
115 | - } |
|
108 | + /** |
|
109 | + * espresso_plugin_activation |
|
110 | + * adds a wp-option to indicate that EE has been activated via the WP admin plugins page |
|
111 | + */ |
|
112 | + function espresso_plugin_activation() |
|
113 | + { |
|
114 | + update_option('ee_espresso_activation', true); |
|
115 | + } |
|
116 | 116 | |
117 | - register_activation_hook(EVENT_ESPRESSO_MAIN_FILE, 'espresso_plugin_activation'); |
|
117 | + register_activation_hook(EVENT_ESPRESSO_MAIN_FILE, 'espresso_plugin_activation'); |
|
118 | 118 | |
119 | - require_once __DIR__ . '/core/bootstrap_espresso.php'; |
|
120 | - bootstrap_espresso(); |
|
121 | - } |
|
119 | + require_once __DIR__ . '/core/bootstrap_espresso.php'; |
|
120 | + bootstrap_espresso(); |
|
121 | + } |
|
122 | 122 | } |
123 | 123 | if (! function_exists('espresso_deactivate_plugin')) { |
124 | - /** |
|
125 | - * deactivate_plugin |
|
126 | - * usage: espresso_deactivate_plugin( plugin_basename( __FILE__ )); |
|
127 | - * |
|
128 | - * @access public |
|
129 | - * @param string $plugin_basename - the results of plugin_basename( __FILE__ ) for the plugin's main file |
|
130 | - * @return void |
|
131 | - */ |
|
132 | - function espresso_deactivate_plugin($plugin_basename = '') |
|
133 | - { |
|
134 | - if (! function_exists('deactivate_plugins')) { |
|
135 | - require_once ABSPATH . 'wp-admin/includes/plugin.php'; |
|
136 | - } |
|
137 | - unset($_GET['activate'], $_REQUEST['activate']); |
|
138 | - deactivate_plugins($plugin_basename); |
|
139 | - } |
|
124 | + /** |
|
125 | + * deactivate_plugin |
|
126 | + * usage: espresso_deactivate_plugin( plugin_basename( __FILE__ )); |
|
127 | + * |
|
128 | + * @access public |
|
129 | + * @param string $plugin_basename - the results of plugin_basename( __FILE__ ) for the plugin's main file |
|
130 | + * @return void |
|
131 | + */ |
|
132 | + function espresso_deactivate_plugin($plugin_basename = '') |
|
133 | + { |
|
134 | + if (! function_exists('deactivate_plugins')) { |
|
135 | + require_once ABSPATH . 'wp-admin/includes/plugin.php'; |
|
136 | + } |
|
137 | + unset($_GET['activate'], $_REQUEST['activate']); |
|
138 | + deactivate_plugins($plugin_basename); |
|
139 | + } |
|
140 | 140 | } |
141 | 141 | \ No newline at end of file |
@@ -7,91 +7,91 @@ discard block |
||
7 | 7 | |
8 | 8 | class DownloadPluginPromptManager |
9 | 9 | { |
10 | - /** |
|
11 | - * @var CapabilitiesChecker |
|
12 | - */ |
|
13 | - private $cap_checker; |
|
10 | + /** |
|
11 | + * @var CapabilitiesChecker |
|
12 | + */ |
|
13 | + private $cap_checker; |
|
14 | 14 | |
15 | - /** |
|
16 | - * @var DownloadPluginPrompt[] |
|
17 | - */ |
|
18 | - private $plugin_prompts = []; |
|
15 | + /** |
|
16 | + * @var DownloadPluginPrompt[] |
|
17 | + */ |
|
18 | + private $plugin_prompts = []; |
|
19 | 19 | |
20 | 20 | |
21 | - /** |
|
22 | - * @param CapabilitiesChecker $capabilities_checker |
|
23 | - */ |
|
24 | - public function __construct(CapabilitiesChecker $capabilities_checker) |
|
25 | - { |
|
26 | - $this->cap_checker = $capabilities_checker; |
|
27 | - $this->loadPluginPrompts(); |
|
28 | - if (! empty($this->plugin_prompts)) { |
|
29 | - add_action('pre_current_active_plugins', [$this, 'displayPluginPrompts'], 100); |
|
30 | - } |
|
31 | - } |
|
21 | + /** |
|
22 | + * @param CapabilitiesChecker $capabilities_checker |
|
23 | + */ |
|
24 | + public function __construct(CapabilitiesChecker $capabilities_checker) |
|
25 | + { |
|
26 | + $this->cap_checker = $capabilities_checker; |
|
27 | + $this->loadPluginPrompts(); |
|
28 | + if (! empty($this->plugin_prompts)) { |
|
29 | + add_action('pre_current_active_plugins', [$this, 'displayPluginPrompts'], 100); |
|
30 | + } |
|
31 | + } |
|
32 | 32 | |
33 | 33 | |
34 | - public function loadPluginPrompts() |
|
35 | - { |
|
36 | - $this->wpGraphQlPrompt(); |
|
37 | - $this->restApiAuthPrompt(); |
|
38 | - } |
|
34 | + public function loadPluginPrompts() |
|
35 | + { |
|
36 | + $this->wpGraphQlPrompt(); |
|
37 | + $this->restApiAuthPrompt(); |
|
38 | + } |
|
39 | 39 | |
40 | 40 | |
41 | - public function displayPluginPrompts() |
|
42 | - { |
|
43 | - $notifications = ''; |
|
44 | - foreach ($this->plugin_prompts as $plugin_prompt) { |
|
45 | - if ($this->cap_checker->processCapCheck($plugin_prompt->getCapCheck())) { |
|
46 | - $notifications .= $plugin_prompt->displayNotification(true); |
|
47 | - } |
|
48 | - } |
|
49 | - echo " |
|
41 | + public function displayPluginPrompts() |
|
42 | + { |
|
43 | + $notifications = ''; |
|
44 | + foreach ($this->plugin_prompts as $plugin_prompt) { |
|
45 | + if ($this->cap_checker->processCapCheck($plugin_prompt->getCapCheck())) { |
|
46 | + $notifications .= $plugin_prompt->displayNotification(true); |
|
47 | + } |
|
48 | + } |
|
49 | + echo " |
|
50 | 50 | <div class='ee-download-plugin-prompts__grid'> |
51 | 51 | " . wp_kses($notifications, AllowedTags::getWithFullTags()) . " |
52 | 52 | </div>"; |
53 | - } |
|
53 | + } |
|
54 | 54 | |
55 | 55 | |
56 | - private function wpGraphQlPrompt() |
|
57 | - { |
|
58 | - if (class_exists('EventEspresso\core\services\graphql\GraphQLManager') && ! class_exists('WPGraphQL')) { |
|
59 | - $this->plugin_prompts['WPGraphQL'] = new DownloadPluginPrompt( |
|
60 | - 'WPGraphQL', |
|
61 | - 'https://www.wpgraphql.com/', |
|
62 | - "Event Espresso's new Advanced Editor", |
|
63 | - null, |
|
64 | - null, |
|
65 | - 'keen-performance.svg', |
|
66 | - 500 |
|
67 | - ); |
|
68 | - } |
|
69 | - } |
|
56 | + private function wpGraphQlPrompt() |
|
57 | + { |
|
58 | + if (class_exists('EventEspresso\core\services\graphql\GraphQLManager') && ! class_exists('WPGraphQL')) { |
|
59 | + $this->plugin_prompts['WPGraphQL'] = new DownloadPluginPrompt( |
|
60 | + 'WPGraphQL', |
|
61 | + 'https://www.wpgraphql.com/', |
|
62 | + "Event Espresso's new Advanced Editor", |
|
63 | + null, |
|
64 | + null, |
|
65 | + 'keen-performance.svg', |
|
66 | + 500 |
|
67 | + ); |
|
68 | + } |
|
69 | + } |
|
70 | 70 | |
71 | 71 | |
72 | - private function restApiAuthPrompt() |
|
73 | - { |
|
74 | - if ( |
|
75 | - class_exists('EED_Core_Rest_Api') |
|
76 | - && ! ( |
|
77 | - is_readable(EE_THIRD_PARTY . 'wp-api-basic-auth/basic-auth.php') |
|
78 | - || class_exists('Jwt_Auth') |
|
79 | - || defined('MINIORANGE_API_AUTHENTICATION_VERSION') |
|
80 | - ) |
|
81 | - ) { |
|
82 | - $this->plugin_prompts['REST-API-Auth'] = new DownloadPluginPrompt( |
|
83 | - 'WP REST API Authentication', |
|
84 | - '', |
|
85 | - 'The Event Espresso REST API', |
|
86 | - esc_html__('REST API Authentication!', 'event_espresso'), |
|
87 | - sprintf( |
|
88 | - /* translators: 'Some Feature' needs the 'Plugin Name' plugin in order provide your site with the maximum functionality it can offer. */ |
|
89 | - esc_html__( |
|
90 | - 'The Event Espresso REST API requires an Authentication plugin to protect your site\'s data endpoints. We highly encourage you to secure your site using one of the following plugins: %1$s', |
|
91 | - 'event_espresso' |
|
92 | - ), |
|
93 | - // 'Plugin Name & Link' |
|
94 | - " |
|
72 | + private function restApiAuthPrompt() |
|
73 | + { |
|
74 | + if ( |
|
75 | + class_exists('EED_Core_Rest_Api') |
|
76 | + && ! ( |
|
77 | + is_readable(EE_THIRD_PARTY . 'wp-api-basic-auth/basic-auth.php') |
|
78 | + || class_exists('Jwt_Auth') |
|
79 | + || defined('MINIORANGE_API_AUTHENTICATION_VERSION') |
|
80 | + ) |
|
81 | + ) { |
|
82 | + $this->plugin_prompts['REST-API-Auth'] = new DownloadPluginPrompt( |
|
83 | + 'WP REST API Authentication', |
|
84 | + '', |
|
85 | + 'The Event Espresso REST API', |
|
86 | + esc_html__('REST API Authentication!', 'event_espresso'), |
|
87 | + sprintf( |
|
88 | + /* translators: 'Some Feature' needs the 'Plugin Name' plugin in order provide your site with the maximum functionality it can offer. */ |
|
89 | + esc_html__( |
|
90 | + 'The Event Espresso REST API requires an Authentication plugin to protect your site\'s data endpoints. We highly encourage you to secure your site using one of the following plugins: %1$s', |
|
91 | + 'event_espresso' |
|
92 | + ), |
|
93 | + // 'Plugin Name & Link' |
|
94 | + " |
|
95 | 95 | <ul> |
96 | 96 | <li> |
97 | 97 | <a href='https://wordpress.org/plugins/jwt-authentication-for-wp-rest-api/' target='_blank'> |
@@ -104,10 +104,10 @@ discard block |
||
104 | 104 | </a> |
105 | 105 | </li> |
106 | 106 | </ul>" |
107 | - ), |
|
108 | - 'password.svg', |
|
109 | - 570 |
|
110 | - ); |
|
111 | - } |
|
112 | - } |
|
107 | + ), |
|
108 | + 'password.svg', |
|
109 | + 570 |
|
110 | + ); |
|
111 | + } |
|
112 | + } |
|
113 | 113 | } |
@@ -25,7 +25,7 @@ discard block |
||
25 | 25 | { |
26 | 26 | $this->cap_checker = $capabilities_checker; |
27 | 27 | $this->loadPluginPrompts(); |
28 | - if (! empty($this->plugin_prompts)) { |
|
28 | + if ( ! empty($this->plugin_prompts)) { |
|
29 | 29 | add_action('pre_current_active_plugins', [$this, 'displayPluginPrompts'], 100); |
30 | 30 | } |
31 | 31 | } |
@@ -48,7 +48,7 @@ discard block |
||
48 | 48 | } |
49 | 49 | echo " |
50 | 50 | <div class='ee-download-plugin-prompts__grid'> |
51 | - " . wp_kses($notifications, AllowedTags::getWithFullTags()) . " |
|
51 | + " . wp_kses($notifications, AllowedTags::getWithFullTags())." |
|
52 | 52 | </div>"; |
53 | 53 | } |
54 | 54 | |
@@ -74,7 +74,7 @@ discard block |
||
74 | 74 | if ( |
75 | 75 | class_exists('EED_Core_Rest_Api') |
76 | 76 | && ! ( |
77 | - is_readable(EE_THIRD_PARTY . 'wp-api-basic-auth/basic-auth.php') |
|
77 | + is_readable(EE_THIRD_PARTY.'wp-api-basic-auth/basic-auth.php') |
|
78 | 78 | || class_exists('Jwt_Auth') |
79 | 79 | || defined('MINIORANGE_API_AUTHENTICATION_VERSION') |
80 | 80 | ) |