Completed
Branch master (16095c)
by
unknown
09:17 queued 04:49
created
core/domain/services/admin/AdminToolBar.php 2 patches
Indentation   +818 added lines, -818 removed lines patch added patch discarded remove patch
@@ -20,822 +20,822 @@
 block discarded – undo
20 20
  */
21 21
 class AdminToolBar
22 22
 {
23
-    private ?WP_Admin_Bar   $admin_bar        = null;
24
-
25
-    private EE_Capabilities $capabilities;
26
-
27
-    private string          $events_admin_url = '';
28
-
29
-    private string          $menu_class       = 'espresso_menu_item_class';
30
-
31
-    private string          $reg_admin_url    = '';
32
-
33
-
34
-    /**
35
-     * AdminToolBar constructor.
36
-     *
37
-     * @param EE_Capabilities $capabilities
38
-     */
39
-    public function __construct(EE_Capabilities $capabilities)
40
-    {
41
-        $this->capabilities = $capabilities;
42
-        add_action('admin_bar_menu', [$this, 'espressoToolbarItems'], 100);
43
-        $this->enqueueAssets();
44
-    }
45
-
46
-
47
-    /**
48
-     *    espresso_toolbar_items
49
-     *
50
-     * @access public
51
-     * @param WP_Admin_Bar $admin_bar
52
-     * @return void
53
-     */
54
-    public function espressoToolbarItems(WP_Admin_Bar $admin_bar)
55
-    {
56
-        // if its an AJAX request, or user is NOT an admin, or in full M-Mode
57
-        if (
58
-            defined('DOING_AJAX')
59
-            || ! $this->capabilities->current_user_can('ee_read_ee', 'ee_admin_bar_menu_top_level')
60
-            || EE_Maintenance_Mode::instance()->level() === EE_Maintenance_Mode::level_2_complete_maintenance
61
-        ) {
62
-            return;
63
-        }
64
-        $this->admin_bar = $admin_bar;
65
-        // we don't use the constants EVENTS_ADMIN_URL or REG_ADMIN_URL
66
-        // because they're only defined in each of their respective constructors
67
-        // and this might be a frontend request, in which case they aren't available
68
-        $this->events_admin_url = admin_url('admin.php?page=espresso_events');
69
-        $this->reg_admin_url    = admin_url('admin.php?page=espresso_registrations');
70
-        // now let's add all of the menu items
71
-        $this->addTopLevelMenu();
72
-        $this->addEventsSubMenu();
73
-        $this->addEventsAddEditHeader();
74
-        $this->addEventsAddNew();
75
-        $this->addEventsEditCurrentEvent();
76
-        $this->addEventsViewHeader();
77
-        $this->addEventsViewAll();
78
-        $this->addEventsViewToday();
79
-        $this->addEventsViewThisMonth();
80
-        $this->addRegistrationSubMenu();
81
-        $this->addRegistrationOverviewToday();
82
-        $this->addRegistrationOverviewTodayApproved();
83
-        $this->addRegistrationOverviewTodayPendingPayment();
84
-        $this->addRegistrationOverviewTodayNotApproved();
85
-        $this->addRegistrationOverviewTodayCancelled();
86
-        $this->addRegistrationOverviewThisMonth();
87
-        $this->addRegistrationOverviewThisMonthApproved();
88
-        $this->addRegistrationOverviewThisMonthPending();
89
-        $this->addRegistrationOverviewThisMonthNotApproved();
90
-        $this->addRegistrationOverviewThisMonthCancelled();
91
-        $this->addExtensionsAndServices();
92
-        $this->addFontSizeSubMenu();
93
-    }
94
-
95
-
96
-    /**
97
-     * @return void
98
-     */
99
-    private function enqueueAssets()
100
-    {
101
-        wp_register_style(
102
-            'espresso-admin-toolbar',
103
-            EE_GLOBAL_ASSETS_URL . 'css/espresso-admin-toolbar.css',
104
-            ['dashicons'],
105
-            EVENT_ESPRESSO_VERSION
106
-        );
107
-        wp_enqueue_style('espresso-admin-toolbar');
108
-    }
109
-
110
-
111
-    /**
112
-     * @return void
113
-     */
114
-    private function addTopLevelMenu()
115
-    {
116
-        $this->admin_bar->add_menu(
117
-            [
118
-                'id'    => 'espresso-toolbar',
119
-                'title' => '<span class="ee-icon ee-icon-ee-cup-thick ee-icon-size-20"></span><span class="ab-label">'
120
-                           . esc_html_x('Event Espresso', 'admin bar menu group label', 'event_espresso')
121
-                           . '</span>',
122
-                'href'  => $this->events_admin_url,
123
-                'meta'  => [
124
-                    'title' => esc_html__('Event Espresso', 'event_espresso'),
125
-                    'class' => $this->menu_class . 'first',
126
-                ],
127
-            ]
128
-        );
129
-    }
130
-
131
-
132
-    /**
133
-     * @return void
134
-     */
135
-    private function addEventsSubMenu()
136
-    {
137
-        if (
138
-            $this->capabilities->current_user_can(
139
-                'ee_read_events',
140
-                'ee_admin_bar_menu_espresso-toolbar-events'
141
-            )
142
-        ) {
143
-            $this->admin_bar->add_menu(
144
-                [
145
-                    'id'     => 'espresso-toolbar-events',
146
-                    'parent' => 'espresso-toolbar',
147
-                    'title'  => '<span class="ee-toolbar-icon"></span>'
148
-                                . esc_html__('Events', 'event_espresso'),
149
-                    'href'   => $this->events_admin_url,
150
-                    'meta'   => [
151
-                        'title'  => esc_html__('Events', 'event_espresso'),
152
-                        'target' => '',
153
-                        'class'  => $this->menu_class,
154
-                    ],
155
-                ]
156
-            );
157
-        }
158
-    }
159
-
160
-
161
-    /**
162
-     * @return void
163
-     */
164
-    private function addEventsAddEditHeader()
165
-    {
166
-        if (
167
-            $this->capabilities->current_user_can(
168
-                'ee_read_events',
169
-                'ee_admin_bar_menu_espresso-toolbar-events-view'
170
-            )
171
-        ) {
172
-            $this->admin_bar->add_menu(
173
-                [
174
-                    'id'     => 'espresso-toolbar-events-add-edit',
175
-                    'parent' => 'espresso-toolbar-events',
176
-                    'title'  => esc_html__('Add / Edit', 'event_espresso'),
177
-                    'href'   => '',
178
-                ]
179
-            );
180
-        }
181
-    }
182
-
183
-
184
-    /**
185
-     * @return void
186
-     */
187
-    private function addEventsAddNew()
188
-    {
189
-        if (
190
-            $this->capabilities->current_user_can(
191
-                'ee_edit_events',
192
-                'ee_admin_bar_menu_espresso-toolbar-events-new'
193
-            )
194
-        ) {
195
-            $this->admin_bar->add_menu(
196
-                [
197
-                    'id'     => 'espresso-toolbar-events-new',
198
-                    'parent' => 'espresso-toolbar-events',
199
-                    'title'  => '<span class="ee-toolbar-icon"></span>'
200
-                                . esc_html__('Add New', 'event_espresso'),
201
-                    'href'   => EEH_URL::add_query_args_and_nonce(
202
-                        ['action' => 'create_new'],
203
-                        $this->events_admin_url
204
-                    ),
205
-                    'meta'   => [
206
-                        'title'  => esc_html__('Add New', 'event_espresso'),
207
-                        'target' => '',
208
-                        'class'  => $this->menu_class,
209
-                    ],
210
-                ]
211
-            );
212
-        }
213
-    }
214
-
215
-
216
-    /**
217
-     * @return void
218
-     */
219
-    private function addEventsEditCurrentEvent()
220
-    {
221
-        if (is_single() && (get_post_type() === 'espresso_events')) {
222
-            // Current post
223
-            global $post;
224
-            if (
225
-                $this->capabilities->current_user_can(
226
-                    'ee_edit_event',
227
-                    'ee_admin_bar_menu_espresso-toolbar-events-edit',
228
-                    $post->ID
229
-                )
230
-            ) {
231
-                $this->admin_bar->add_menu(
232
-                    [
233
-                        'id'     => 'espresso-toolbar-events-edit',
234
-                        'parent' => 'espresso-toolbar-events',
235
-                        'title'  => '<span class="ee-toolbar-icon"></span>'
236
-                                    . esc_html__('Edit Event', 'event_espresso'),
237
-                        'href'   => EEH_URL::add_query_args_and_nonce(
238
-                            [
239
-                                'action' => 'edit',
240
-                                'post'   => $post->ID,
241
-                            ],
242
-                            $this->events_admin_url
243
-                        ),
244
-                        'meta'   => [
245
-                            'title'  => esc_html__('Edit Event', 'event_espresso'),
246
-                            'target' => '',
247
-                            'class'  => $this->menu_class,
248
-                        ],
249
-                    ]
250
-                );
251
-            }
252
-        }
253
-    }
254
-
255
-
256
-    /**
257
-     * @return void
258
-     */
259
-    private function addEventsViewHeader()
260
-    {
261
-        if (
262
-            $this->capabilities->current_user_can(
263
-                'ee_read_events',
264
-                'ee_admin_bar_menu_espresso-toolbar-events-view'
265
-            )
266
-        ) {
267
-            $this->admin_bar->add_menu(
268
-                [
269
-                    'id'     => 'espresso-toolbar-events-view',
270
-                    'parent' => 'espresso-toolbar-events',
271
-                    'title'  => esc_html__('View', 'event_espresso'),
272
-                    'href'   => '',
273
-                ]
274
-            );
275
-        }
276
-    }
277
-
278
-
279
-    /**
280
-     * @return void
281
-     */
282
-    private function addEventsViewAll()
283
-    {
284
-        if (
285
-            $this->capabilities->current_user_can(
286
-                'ee_read_events',
287
-                'ee_admin_bar_menu_espresso-toolbar-events-all'
288
-            )
289
-        ) {
290
-            $this->admin_bar->add_menu(
291
-                [
292
-                    'id'     => 'espresso-toolbar-events-all',
293
-                    'parent' => 'espresso-toolbar-events',
294
-                    'title'  => '<span class="ee-toolbar-icon"></span>'
295
-                                . esc_html__('All', 'event_espresso'),
296
-                    'href'   => $this->events_admin_url,
297
-                    'meta'   => [
298
-                        'title'  => esc_html__('All', 'event_espresso'),
299
-                        'target' => '',
300
-                        'class'  => $this->menu_class,
301
-                    ],
302
-                ]
303
-            );
304
-        }
305
-    }
306
-
307
-
308
-    /**
309
-     * @return void
310
-     */
311
-    private function addEventsViewToday()
312
-    {
313
-        if (
314
-            $this->capabilities->current_user_can(
315
-                'ee_read_events',
316
-                'ee_admin_bar_menu_espresso-toolbar-events-today'
317
-            )
318
-        ) {
319
-            $this->admin_bar->add_menu(
320
-                [
321
-                    'id'     => 'espresso-toolbar-events-today',
322
-                    'parent' => 'espresso-toolbar-events',
323
-                    'title'  => '<span class="ee-toolbar-icon"></span>'
324
-                                . esc_html__('Today', 'event_espresso'),
325
-                    'href'   => EEH_URL::add_query_args_and_nonce(
326
-                        [
327
-                            'action' => 'default',
328
-                            'status' => 'today',
329
-                        ],
330
-                        $this->events_admin_url
331
-                    ),
332
-                    'meta'   => [
333
-                        'title'  => esc_html__('Today', 'event_espresso'),
334
-                        'target' => '',
335
-                        'class'  => $this->menu_class,
336
-                    ],
337
-                ]
338
-            );
339
-        }
340
-    }
341
-
342
-
343
-    /**
344
-     * @return void
345
-     */
346
-    private function addEventsViewThisMonth()
347
-    {
348
-        if (
349
-            $this->capabilities->current_user_can(
350
-                'ee_read_events',
351
-                'ee_admin_bar_menu_espresso-toolbar-events-month'
352
-            )
353
-        ) {
354
-            $this->admin_bar->add_menu(
355
-                [
356
-                    'id'     => 'espresso-toolbar-events-month',
357
-                    'parent' => 'espresso-toolbar-events',
358
-                    'title'  => '<span class="ee-toolbar-icon"></span>'
359
-                                . esc_html__('This Month', 'event_espresso'),
360
-                    'href'   => EEH_URL::add_query_args_and_nonce(
361
-                        [
362
-                            'action' => 'default',
363
-                            'status' => 'month',
364
-                        ],
365
-                        $this->events_admin_url
366
-                    ),
367
-                    'meta'   => [
368
-                        'title'  => esc_html__('This Month', 'event_espresso'),
369
-                        'target' => '',
370
-                        'class'  => $this->menu_class,
371
-                    ],
372
-                ]
373
-            );
374
-        }
375
-    }
376
-
377
-
378
-    /**
379
-     * @return void
380
-     */
381
-    private function addRegistrationSubMenu()
382
-    {
383
-        if (
384
-            $this->capabilities->current_user_can(
385
-                'ee_read_registrations',
386
-                'ee_admin_bar_menu_espresso-toolbar-registrations'
387
-            )
388
-        ) {
389
-            $this->admin_bar->add_menu(
390
-                [
391
-                    'id'     => 'espresso-toolbar-registrations',
392
-                    'parent' => 'espresso-toolbar',
393
-                    'title'  => '<span class="ee-toolbar-icon"></span>'
394
-                                . esc_html__('Registrations', 'event_espresso'),
395
-                    'href'   => $this->reg_admin_url,
396
-                    'meta'   => [
397
-                        'title'  => esc_html__('Registrations', 'event_espresso'),
398
-                        'target' => '',
399
-                        'class'  => $this->menu_class,
400
-                    ],
401
-                ]
402
-            );
403
-        }
404
-    }
405
-
406
-
407
-    /**
408
-     * @return void
409
-     */
410
-    private function addRegistrationOverviewToday()
411
-    {
412
-        if (
413
-            $this->capabilities->current_user_can(
414
-                'ee_read_registrations',
415
-                'ee_admin_bar_menu_espresso-toolbar-registrations-today'
416
-            )
417
-        ) {
418
-            $this->admin_bar->add_menu(
419
-                [
420
-                    'id'     => 'espresso-toolbar-registrations-today',
421
-                    'parent' => 'espresso-toolbar-registrations',
422
-                    'title'  => esc_html__('Today', 'event_espresso'),
423
-                    'href'   => '',
424
-                    'meta'   => [
425
-                        'title'  => esc_html__('Today', 'event_espresso'),
426
-                        'target' => '',
427
-                        'class'  => $this->menu_class,
428
-                    ],
429
-                ]
430
-            );
431
-        }
432
-    }
433
-
434
-
435
-    /**
436
-     * @return void
437
-     */
438
-    private function addRegistrationOverviewTodayApproved()
439
-    {
440
-        if (
441
-            $this->capabilities->current_user_can(
442
-                'ee_read_registrations',
443
-                'ee_admin_bar_menu_espresso-toolbar-registrations-today-approved'
444
-            )
445
-        ) {
446
-            $this->admin_bar->add_menu(
447
-                [
448
-                    'id'     => 'espresso-toolbar-registrations-today-approved',
449
-                    'parent' => 'espresso-toolbar-registrations',
450
-                    'title'  => '<span class="ee-toolbar-icon"></span>'
451
-                                . esc_html__('Approved', 'event_espresso'),
452
-                    'href'   => EEH_URL::add_query_args_and_nonce(
453
-                        [
454
-                            'action'      => 'default',
455
-                            'status'      => 'today',
456
-                            '_reg_status' => EEM_Registration::status_id_approved,
457
-                        ],
458
-                        $this->reg_admin_url
459
-                    ),
460
-                    'meta'   => [
461
-                        'title'  => esc_html__('Approved', 'event_espresso'),
462
-                        'target' => '',
463
-                        'class'  => $this->menu_class . ' ee-toolbar-icon-approved',
464
-                    ],
465
-                ]
466
-            );
467
-        }
468
-    }
469
-
470
-
471
-    /**
472
-     * @return void
473
-     */
474
-    private function addRegistrationOverviewTodayPendingPayment()
475
-    {
476
-        if (
477
-            $this->capabilities->current_user_can(
478
-                'ee_read_registrations',
479
-                'ee_admin_bar_menu_espresso-toolbar-registrations-today-pending'
480
-            )
481
-        ) {
482
-            $this->admin_bar->add_menu(
483
-                [
484
-                    'id'     => 'espresso-toolbar-registrations-today-pending',
485
-                    'parent' => 'espresso-toolbar-registrations',
486
-                    'title'  => '<span class="ee-toolbar-icon"></span>'
487
-                                . esc_html__('Pending', 'event_espresso'),
488
-                    'href'   => EEH_URL::add_query_args_and_nonce(
489
-                        [
490
-                            'action'      => 'default',
491
-                            'status'      => 'today',
492
-                            '_reg_status' => EEM_Registration::status_id_pending_payment,
493
-                        ],
494
-                        $this->reg_admin_url
495
-                    ),
496
-                    'meta'   => [
497
-                        'title'  => esc_html__('Pending Payment', 'event_espresso'),
498
-                        'target' => '',
499
-                        'class'  => $this->menu_class . ' ee-toolbar-icon-pending',
500
-                    ],
501
-                ]
502
-            );
503
-        }
504
-    }
505
-
506
-
507
-    /**
508
-     * @return void
509
-     */
510
-    private function addRegistrationOverviewTodayNotApproved()
511
-    {
512
-        if (
513
-            $this->capabilities->current_user_can(
514
-                'ee_read_registrations',
515
-                'ee_admin_bar_menu_espresso-toolbar-registrations-today-not-approved'
516
-            )
517
-        ) {
518
-            $this->admin_bar->add_menu(
519
-                [
520
-                    'id'     => 'espresso-toolbar-registrations-today-not-approved',
521
-                    'parent' => 'espresso-toolbar-registrations',
522
-                    'title'  => '<span class="ee-toolbar-icon"></span>'
523
-                                . esc_html__('Not Approved', 'event_espresso'),
524
-                    'href'   => EEH_URL::add_query_args_and_nonce(
525
-                        [
526
-                            'action'      => 'default',
527
-                            'status'      => 'today',
528
-                            '_reg_status' => EEM_Registration::status_id_not_approved,
529
-                        ],
530
-                        $this->reg_admin_url
531
-                    ),
532
-                    'meta'   => [
533
-                        'title'  => esc_html__('Not Approved', 'event_espresso'),
534
-                        'target' => '',
535
-                        'class'  => $this->menu_class . ' ee-toolbar-icon-not-approved',
536
-                    ],
537
-                ]
538
-            );
539
-        }
540
-    }
541
-
542
-
543
-    /**
544
-     * @return void
545
-     */
546
-    private function addRegistrationOverviewTodayCancelled()
547
-    {
548
-        if (
549
-            $this->capabilities->current_user_can(
550
-                'ee_read_registrations',
551
-                'ee_admin_bar_menu_espresso-toolbar-registrations-today-cancelled'
552
-            )
553
-        ) {
554
-            $this->admin_bar->add_menu(
555
-                [
556
-                    'id'     => 'espresso-toolbar-registrations-today-cancelled',
557
-                    'parent' => 'espresso-toolbar-registrations',
558
-                    'title'  => '<span class="ee-toolbar-icon"></span>'
559
-                                . esc_html__('Cancelled', 'event_espresso'),
560
-                    'href'   => EEH_URL::add_query_args_and_nonce(
561
-                        [
562
-                            'action'      => 'default',
563
-                            'status'      => 'today',
564
-                            '_reg_status' => EEM_Registration::status_id_cancelled,
565
-                        ],
566
-                        $this->reg_admin_url
567
-                    ),
568
-                    'meta'   => [
569
-                        'title'  => esc_html__('Cancelled', 'event_espresso'),
570
-                        'target' => '',
571
-                        'class'  => $this->menu_class . ' ee-toolbar-icon-cancelled',
572
-                    ],
573
-                ]
574
-            );
575
-        }
576
-    }
577
-
578
-
579
-    /**
580
-     * @return void
581
-     */
582
-    private function addRegistrationOverviewThisMonth()
583
-    {
584
-        if (
585
-            $this->capabilities->current_user_can(
586
-                'ee_read_registrations',
587
-                'ee_admin_bar_menu_espresso-toolbar-registrations-month'
588
-            )
589
-        ) {
590
-            $this->admin_bar->add_menu(
591
-                [
592
-                    'id'     => 'espresso-toolbar-registrations-month',
593
-                    'parent' => 'espresso-toolbar-registrations',
594
-                    'title'  => esc_html__('This Month', 'event_espresso'),
595
-                    'href'   => '', // EEH_URL::add_query_args_and_nonce(
596
-                    //     array(
597
-                    //         'action' => 'default',
598
-                    //         'status' => 'month'
599
-                    //     ),
600
-                    //     $this->reg_admin_url
601
-                    // ),
602
-                    'meta'   => [
603
-                        'title'  => esc_html__('This Month', 'event_espresso'),
604
-                        'target' => '',
605
-                        'class'  => $this->menu_class,
606
-                    ],
607
-                ]
608
-            );
609
-        }
610
-    }
611
-
612
-
613
-    /**
614
-     * @return void
615
-     */
616
-    private function addRegistrationOverviewThisMonthApproved()
617
-    {
618
-        if (
619
-            $this->capabilities->current_user_can(
620
-                'ee_read_registrations',
621
-                'ee_admin_bar_menu_espresso-toolbar-registrations-month-approved'
622
-            )
623
-        ) {
624
-            $this->admin_bar->add_menu(
625
-                [
626
-                    'id'     => 'espresso-toolbar-registrations-month-approved',
627
-                    'parent' => 'espresso-toolbar-registrations',
628
-                    'title'  => '<span class="ee-toolbar-icon"></span>'
629
-                                . esc_html__('Approved', 'event_espresso'),
630
-                    'href'   => EEH_URL::add_query_args_and_nonce(
631
-                        [
632
-                            'action'      => 'default',
633
-                            'status'      => 'month',
634
-                            '_reg_status' => EEM_Registration::status_id_approved,
635
-                        ],
636
-                        $this->reg_admin_url
637
-                    ),
638
-                    'meta'   => [
639
-                        'title'  => esc_html__('Approved', 'event_espresso'),
640
-                        'target' => '',
641
-                        'class'  => $this->menu_class . ' ee-toolbar-icon-approved',
642
-                    ],
643
-                ]
644
-            );
645
-        }
646
-    }
647
-
648
-
649
-    /**
650
-     * @return void
651
-     */
652
-    private function addRegistrationOverviewThisMonthPending()
653
-    {
654
-        if (
655
-            $this->capabilities->current_user_can(
656
-                'ee_read_registrations',
657
-                'ee_admin_bar_menu_espresso-toolbar-registrations-month-pending'
658
-            )
659
-        ) {
660
-            $this->admin_bar->add_menu(
661
-                [
662
-                    'id'     => 'espresso-toolbar-registrations-month-pending',
663
-                    'parent' => 'espresso-toolbar-registrations',
664
-                    'title'  => '<span class="ee-toolbar-icon"></span>'
665
-                                . esc_html__('Pending', 'event_espresso'),
666
-                    'href'   => EEH_URL::add_query_args_and_nonce(
667
-                        [
668
-                            'action'      => 'default',
669
-                            'status'      => 'month',
670
-                            '_reg_status' => EEM_Registration::status_id_pending_payment,
671
-                        ],
672
-                        $this->reg_admin_url
673
-                    ),
674
-                    'meta'   => [
675
-                        'title'  => esc_html__('Pending', 'event_espresso'),
676
-                        'target' => '',
677
-                        'class'  => $this->menu_class . ' ee-toolbar-icon-pending',
678
-                    ],
679
-                ]
680
-            );
681
-        }
682
-    }
683
-
684
-
685
-    /**
686
-     * @return void
687
-     */
688
-    private function addRegistrationOverviewThisMonthNotApproved()
689
-    {
690
-        if (
691
-            $this->capabilities->current_user_can(
692
-                'ee_read_registrations',
693
-                'ee_admin_bar_menu_espresso-toolbar-registrations-month-not-approved'
694
-            )
695
-        ) {
696
-            $this->admin_bar->add_menu(
697
-                [
698
-                    'id'     => 'espresso-toolbar-registrations-month-not-approved',
699
-                    'parent' => 'espresso-toolbar-registrations',
700
-                    'title'  => '<span class="ee-toolbar-icon"></span>'
701
-                                . esc_html__('Not Approved', 'event_espresso'),
702
-                    'href'   => EEH_URL::add_query_args_and_nonce(
703
-                        [
704
-                            'action'      => 'default',
705
-                            'status'      => 'month',
706
-                            '_reg_status' => EEM_Registration::status_id_not_approved,
707
-                        ],
708
-                        $this->reg_admin_url
709
-                    ),
710
-                    'meta'   => [
711
-                        'title'  => esc_html__('Not Approved', 'event_espresso'),
712
-                        'target' => '',
713
-                        'class'  => $this->menu_class . ' ee-toolbar-icon-not-approved',
714
-                    ],
715
-                ]
716
-            );
717
-        }
718
-    }
719
-
720
-
721
-    /**
722
-     * @return void
723
-     */
724
-    private function addRegistrationOverviewThisMonthCancelled()
725
-    {
726
-        if (
727
-            $this->capabilities->current_user_can(
728
-                'ee_read_registrations',
729
-                'ee_admin_bar_menu_espresso-toolbar-registrations-month-cancelled'
730
-            )
731
-        ) {
732
-            $this->admin_bar->add_menu(
733
-                [
734
-                    'id'     => 'espresso-toolbar-registrations-month-cancelled',
735
-                    'parent' => 'espresso-toolbar-registrations',
736
-                    'title'  => '<span class="ee-toolbar-icon"></span>'
737
-                                . esc_html__('Cancelled', 'event_espresso'),
738
-                    'href'   => EEH_URL::add_query_args_and_nonce(
739
-                        [
740
-                            'action'      => 'default',
741
-                            'status'      => 'month',
742
-                            '_reg_status' => EEM_Registration::status_id_cancelled,
743
-                        ],
744
-                        $this->reg_admin_url
745
-                    ),
746
-                    'meta'   => [
747
-                        'title'  => esc_html__('Cancelled', 'event_espresso'),
748
-                        'target' => '',
749
-                        'class'  => $this->menu_class . ' ee-toolbar-icon-cancelled',
750
-                    ],
751
-                ]
752
-            );
753
-        }
754
-    }
755
-
756
-
757
-    /**
758
-     * @return void
759
-     */
760
-    private function addExtensionsAndServices()
761
-    {
762
-        if (
763
-            $this->capabilities->current_user_can(
764
-                'ee_read_ee',
765
-                'ee_admin_bar_menu_espresso-toolbar-extensions-and-services'
766
-            )
767
-        ) {
768
-            $this->admin_bar->add_menu(
769
-                [
770
-                    'id'     => 'espresso-toolbar-extensions-and-services',
771
-                    'parent' => 'espresso-toolbar',
772
-                    'title'  => '<span class="ee-toolbar-icon"></span>'
773
-                                . esc_html__('Extensions & Services', 'event_espresso'),
774
-                    'href'   => admin_url('admin.php?page=espresso_packages'),
775
-                    'meta'   => [
776
-                        'title'  => esc_html__('Extensions & Services', 'event_espresso'),
777
-                        'target' => '',
778
-                        'class'  => $this->menu_class,
779
-                    ],
780
-                ]
781
-            );
782
-        }
783
-    }
784
-
785
-
786
-    /**
787
-     * @return void
788
-     */
789
-    private function addFontSizeSubMenu()
790
-    {
791
-        $this->admin_bar->add_menu(
792
-            [
793
-                'id'     => 'espresso-toolbar-font-size',
794
-                'parent' => 'espresso-toolbar',
795
-                'title'  => '<span class="ee-toolbar-icon"></span>'
796
-                            . esc_html__('Set Font Size', 'event_espresso'),
797
-                'href'   => '',
798
-                'meta'   => [
799
-                    'title'  => esc_html__('Set Font Size', 'event_espresso'),
800
-                    'target' => '',
801
-                    'class'  => $this->menu_class,
802
-                ],
803
-            ]
804
-        );
805
-
806
-        $settings_admin_url = admin_url('admin.php?page=espresso_general_settings');
807
-
808
-        $font_sizes = [
809
-            'tiny'    => AdminFontSize::FONT_SIZE_TINY,
810
-            'smaller' => AdminFontSize::FONT_SIZE_SMALLER,
811
-            'small'   => AdminFontSize::FONT_SIZE_SMALL,
812
-            'default' => AdminFontSize::FONT_SIZE_DEFAULT,
813
-            'big'     => AdminFontSize::FONT_SIZE_BIG,
814
-            'bigger'  => AdminFontSize::FONT_SIZE_BIGGER,
815
-        ];
816
-
817
-        foreach ($font_sizes as $font_size => $value) {
818
-            $this->admin_bar->add_menu(
819
-                [
820
-                    'id'     => "espresso-toolbar-set-font-size-$font_size",
821
-                    'parent' => 'espresso-toolbar-font-size',
822
-                    'title'  => '<span class="ee-toolbar-icon"></span>'
823
-                                . sprintf(
824
-                                    /* translators: Font Size Small */
825
-                                    esc_html__('Font Size %1$s', 'event_espresso'),
826
-                                    ucwords($font_size)
827
-                                ),
828
-                    'href'   => EEH_URL::add_query_args_and_nonce(
829
-                        ['action' => 'set_font_size', 'font_size' => $value],
830
-                        $settings_admin_url
831
-                    ),
832
-                    'meta'   => [
833
-                        'title'  => esc_html__('increases or decreases the Event Espresso admin font size', 'event_espresso'),
834
-                        'target' => '',
835
-                        'class'  => $this->menu_class,
836
-                    ],
837
-                ]
838
-            );
839
-        }
840
-    }
23
+	private ?WP_Admin_Bar   $admin_bar        = null;
24
+
25
+	private EE_Capabilities $capabilities;
26
+
27
+	private string          $events_admin_url = '';
28
+
29
+	private string          $menu_class       = 'espresso_menu_item_class';
30
+
31
+	private string          $reg_admin_url    = '';
32
+
33
+
34
+	/**
35
+	 * AdminToolBar constructor.
36
+	 *
37
+	 * @param EE_Capabilities $capabilities
38
+	 */
39
+	public function __construct(EE_Capabilities $capabilities)
40
+	{
41
+		$this->capabilities = $capabilities;
42
+		add_action('admin_bar_menu', [$this, 'espressoToolbarItems'], 100);
43
+		$this->enqueueAssets();
44
+	}
45
+
46
+
47
+	/**
48
+	 *    espresso_toolbar_items
49
+	 *
50
+	 * @access public
51
+	 * @param WP_Admin_Bar $admin_bar
52
+	 * @return void
53
+	 */
54
+	public function espressoToolbarItems(WP_Admin_Bar $admin_bar)
55
+	{
56
+		// if its an AJAX request, or user is NOT an admin, or in full M-Mode
57
+		if (
58
+			defined('DOING_AJAX')
59
+			|| ! $this->capabilities->current_user_can('ee_read_ee', 'ee_admin_bar_menu_top_level')
60
+			|| EE_Maintenance_Mode::instance()->level() === EE_Maintenance_Mode::level_2_complete_maintenance
61
+		) {
62
+			return;
63
+		}
64
+		$this->admin_bar = $admin_bar;
65
+		// we don't use the constants EVENTS_ADMIN_URL or REG_ADMIN_URL
66
+		// because they're only defined in each of their respective constructors
67
+		// and this might be a frontend request, in which case they aren't available
68
+		$this->events_admin_url = admin_url('admin.php?page=espresso_events');
69
+		$this->reg_admin_url    = admin_url('admin.php?page=espresso_registrations');
70
+		// now let's add all of the menu items
71
+		$this->addTopLevelMenu();
72
+		$this->addEventsSubMenu();
73
+		$this->addEventsAddEditHeader();
74
+		$this->addEventsAddNew();
75
+		$this->addEventsEditCurrentEvent();
76
+		$this->addEventsViewHeader();
77
+		$this->addEventsViewAll();
78
+		$this->addEventsViewToday();
79
+		$this->addEventsViewThisMonth();
80
+		$this->addRegistrationSubMenu();
81
+		$this->addRegistrationOverviewToday();
82
+		$this->addRegistrationOverviewTodayApproved();
83
+		$this->addRegistrationOverviewTodayPendingPayment();
84
+		$this->addRegistrationOverviewTodayNotApproved();
85
+		$this->addRegistrationOverviewTodayCancelled();
86
+		$this->addRegistrationOverviewThisMonth();
87
+		$this->addRegistrationOverviewThisMonthApproved();
88
+		$this->addRegistrationOverviewThisMonthPending();
89
+		$this->addRegistrationOverviewThisMonthNotApproved();
90
+		$this->addRegistrationOverviewThisMonthCancelled();
91
+		$this->addExtensionsAndServices();
92
+		$this->addFontSizeSubMenu();
93
+	}
94
+
95
+
96
+	/**
97
+	 * @return void
98
+	 */
99
+	private function enqueueAssets()
100
+	{
101
+		wp_register_style(
102
+			'espresso-admin-toolbar',
103
+			EE_GLOBAL_ASSETS_URL . 'css/espresso-admin-toolbar.css',
104
+			['dashicons'],
105
+			EVENT_ESPRESSO_VERSION
106
+		);
107
+		wp_enqueue_style('espresso-admin-toolbar');
108
+	}
109
+
110
+
111
+	/**
112
+	 * @return void
113
+	 */
114
+	private function addTopLevelMenu()
115
+	{
116
+		$this->admin_bar->add_menu(
117
+			[
118
+				'id'    => 'espresso-toolbar',
119
+				'title' => '<span class="ee-icon ee-icon-ee-cup-thick ee-icon-size-20"></span><span class="ab-label">'
120
+						   . esc_html_x('Event Espresso', 'admin bar menu group label', 'event_espresso')
121
+						   . '</span>',
122
+				'href'  => $this->events_admin_url,
123
+				'meta'  => [
124
+					'title' => esc_html__('Event Espresso', 'event_espresso'),
125
+					'class' => $this->menu_class . 'first',
126
+				],
127
+			]
128
+		);
129
+	}
130
+
131
+
132
+	/**
133
+	 * @return void
134
+	 */
135
+	private function addEventsSubMenu()
136
+	{
137
+		if (
138
+			$this->capabilities->current_user_can(
139
+				'ee_read_events',
140
+				'ee_admin_bar_menu_espresso-toolbar-events'
141
+			)
142
+		) {
143
+			$this->admin_bar->add_menu(
144
+				[
145
+					'id'     => 'espresso-toolbar-events',
146
+					'parent' => 'espresso-toolbar',
147
+					'title'  => '<span class="ee-toolbar-icon"></span>'
148
+								. esc_html__('Events', 'event_espresso'),
149
+					'href'   => $this->events_admin_url,
150
+					'meta'   => [
151
+						'title'  => esc_html__('Events', 'event_espresso'),
152
+						'target' => '',
153
+						'class'  => $this->menu_class,
154
+					],
155
+				]
156
+			);
157
+		}
158
+	}
159
+
160
+
161
+	/**
162
+	 * @return void
163
+	 */
164
+	private function addEventsAddEditHeader()
165
+	{
166
+		if (
167
+			$this->capabilities->current_user_can(
168
+				'ee_read_events',
169
+				'ee_admin_bar_menu_espresso-toolbar-events-view'
170
+			)
171
+		) {
172
+			$this->admin_bar->add_menu(
173
+				[
174
+					'id'     => 'espresso-toolbar-events-add-edit',
175
+					'parent' => 'espresso-toolbar-events',
176
+					'title'  => esc_html__('Add / Edit', 'event_espresso'),
177
+					'href'   => '',
178
+				]
179
+			);
180
+		}
181
+	}
182
+
183
+
184
+	/**
185
+	 * @return void
186
+	 */
187
+	private function addEventsAddNew()
188
+	{
189
+		if (
190
+			$this->capabilities->current_user_can(
191
+				'ee_edit_events',
192
+				'ee_admin_bar_menu_espresso-toolbar-events-new'
193
+			)
194
+		) {
195
+			$this->admin_bar->add_menu(
196
+				[
197
+					'id'     => 'espresso-toolbar-events-new',
198
+					'parent' => 'espresso-toolbar-events',
199
+					'title'  => '<span class="ee-toolbar-icon"></span>'
200
+								. esc_html__('Add New', 'event_espresso'),
201
+					'href'   => EEH_URL::add_query_args_and_nonce(
202
+						['action' => 'create_new'],
203
+						$this->events_admin_url
204
+					),
205
+					'meta'   => [
206
+						'title'  => esc_html__('Add New', 'event_espresso'),
207
+						'target' => '',
208
+						'class'  => $this->menu_class,
209
+					],
210
+				]
211
+			);
212
+		}
213
+	}
214
+
215
+
216
+	/**
217
+	 * @return void
218
+	 */
219
+	private function addEventsEditCurrentEvent()
220
+	{
221
+		if (is_single() && (get_post_type() === 'espresso_events')) {
222
+			// Current post
223
+			global $post;
224
+			if (
225
+				$this->capabilities->current_user_can(
226
+					'ee_edit_event',
227
+					'ee_admin_bar_menu_espresso-toolbar-events-edit',
228
+					$post->ID
229
+				)
230
+			) {
231
+				$this->admin_bar->add_menu(
232
+					[
233
+						'id'     => 'espresso-toolbar-events-edit',
234
+						'parent' => 'espresso-toolbar-events',
235
+						'title'  => '<span class="ee-toolbar-icon"></span>'
236
+									. esc_html__('Edit Event', 'event_espresso'),
237
+						'href'   => EEH_URL::add_query_args_and_nonce(
238
+							[
239
+								'action' => 'edit',
240
+								'post'   => $post->ID,
241
+							],
242
+							$this->events_admin_url
243
+						),
244
+						'meta'   => [
245
+							'title'  => esc_html__('Edit Event', 'event_espresso'),
246
+							'target' => '',
247
+							'class'  => $this->menu_class,
248
+						],
249
+					]
250
+				);
251
+			}
252
+		}
253
+	}
254
+
255
+
256
+	/**
257
+	 * @return void
258
+	 */
259
+	private function addEventsViewHeader()
260
+	{
261
+		if (
262
+			$this->capabilities->current_user_can(
263
+				'ee_read_events',
264
+				'ee_admin_bar_menu_espresso-toolbar-events-view'
265
+			)
266
+		) {
267
+			$this->admin_bar->add_menu(
268
+				[
269
+					'id'     => 'espresso-toolbar-events-view',
270
+					'parent' => 'espresso-toolbar-events',
271
+					'title'  => esc_html__('View', 'event_espresso'),
272
+					'href'   => '',
273
+				]
274
+			);
275
+		}
276
+	}
277
+
278
+
279
+	/**
280
+	 * @return void
281
+	 */
282
+	private function addEventsViewAll()
283
+	{
284
+		if (
285
+			$this->capabilities->current_user_can(
286
+				'ee_read_events',
287
+				'ee_admin_bar_menu_espresso-toolbar-events-all'
288
+			)
289
+		) {
290
+			$this->admin_bar->add_menu(
291
+				[
292
+					'id'     => 'espresso-toolbar-events-all',
293
+					'parent' => 'espresso-toolbar-events',
294
+					'title'  => '<span class="ee-toolbar-icon"></span>'
295
+								. esc_html__('All', 'event_espresso'),
296
+					'href'   => $this->events_admin_url,
297
+					'meta'   => [
298
+						'title'  => esc_html__('All', 'event_espresso'),
299
+						'target' => '',
300
+						'class'  => $this->menu_class,
301
+					],
302
+				]
303
+			);
304
+		}
305
+	}
306
+
307
+
308
+	/**
309
+	 * @return void
310
+	 */
311
+	private function addEventsViewToday()
312
+	{
313
+		if (
314
+			$this->capabilities->current_user_can(
315
+				'ee_read_events',
316
+				'ee_admin_bar_menu_espresso-toolbar-events-today'
317
+			)
318
+		) {
319
+			$this->admin_bar->add_menu(
320
+				[
321
+					'id'     => 'espresso-toolbar-events-today',
322
+					'parent' => 'espresso-toolbar-events',
323
+					'title'  => '<span class="ee-toolbar-icon"></span>'
324
+								. esc_html__('Today', 'event_espresso'),
325
+					'href'   => EEH_URL::add_query_args_and_nonce(
326
+						[
327
+							'action' => 'default',
328
+							'status' => 'today',
329
+						],
330
+						$this->events_admin_url
331
+					),
332
+					'meta'   => [
333
+						'title'  => esc_html__('Today', 'event_espresso'),
334
+						'target' => '',
335
+						'class'  => $this->menu_class,
336
+					],
337
+				]
338
+			);
339
+		}
340
+	}
341
+
342
+
343
+	/**
344
+	 * @return void
345
+	 */
346
+	private function addEventsViewThisMonth()
347
+	{
348
+		if (
349
+			$this->capabilities->current_user_can(
350
+				'ee_read_events',
351
+				'ee_admin_bar_menu_espresso-toolbar-events-month'
352
+			)
353
+		) {
354
+			$this->admin_bar->add_menu(
355
+				[
356
+					'id'     => 'espresso-toolbar-events-month',
357
+					'parent' => 'espresso-toolbar-events',
358
+					'title'  => '<span class="ee-toolbar-icon"></span>'
359
+								. esc_html__('This Month', 'event_espresso'),
360
+					'href'   => EEH_URL::add_query_args_and_nonce(
361
+						[
362
+							'action' => 'default',
363
+							'status' => 'month',
364
+						],
365
+						$this->events_admin_url
366
+					),
367
+					'meta'   => [
368
+						'title'  => esc_html__('This Month', 'event_espresso'),
369
+						'target' => '',
370
+						'class'  => $this->menu_class,
371
+					],
372
+				]
373
+			);
374
+		}
375
+	}
376
+
377
+
378
+	/**
379
+	 * @return void
380
+	 */
381
+	private function addRegistrationSubMenu()
382
+	{
383
+		if (
384
+			$this->capabilities->current_user_can(
385
+				'ee_read_registrations',
386
+				'ee_admin_bar_menu_espresso-toolbar-registrations'
387
+			)
388
+		) {
389
+			$this->admin_bar->add_menu(
390
+				[
391
+					'id'     => 'espresso-toolbar-registrations',
392
+					'parent' => 'espresso-toolbar',
393
+					'title'  => '<span class="ee-toolbar-icon"></span>'
394
+								. esc_html__('Registrations', 'event_espresso'),
395
+					'href'   => $this->reg_admin_url,
396
+					'meta'   => [
397
+						'title'  => esc_html__('Registrations', 'event_espresso'),
398
+						'target' => '',
399
+						'class'  => $this->menu_class,
400
+					],
401
+				]
402
+			);
403
+		}
404
+	}
405
+
406
+
407
+	/**
408
+	 * @return void
409
+	 */
410
+	private function addRegistrationOverviewToday()
411
+	{
412
+		if (
413
+			$this->capabilities->current_user_can(
414
+				'ee_read_registrations',
415
+				'ee_admin_bar_menu_espresso-toolbar-registrations-today'
416
+			)
417
+		) {
418
+			$this->admin_bar->add_menu(
419
+				[
420
+					'id'     => 'espresso-toolbar-registrations-today',
421
+					'parent' => 'espresso-toolbar-registrations',
422
+					'title'  => esc_html__('Today', 'event_espresso'),
423
+					'href'   => '',
424
+					'meta'   => [
425
+						'title'  => esc_html__('Today', 'event_espresso'),
426
+						'target' => '',
427
+						'class'  => $this->menu_class,
428
+					],
429
+				]
430
+			);
431
+		}
432
+	}
433
+
434
+
435
+	/**
436
+	 * @return void
437
+	 */
438
+	private function addRegistrationOverviewTodayApproved()
439
+	{
440
+		if (
441
+			$this->capabilities->current_user_can(
442
+				'ee_read_registrations',
443
+				'ee_admin_bar_menu_espresso-toolbar-registrations-today-approved'
444
+			)
445
+		) {
446
+			$this->admin_bar->add_menu(
447
+				[
448
+					'id'     => 'espresso-toolbar-registrations-today-approved',
449
+					'parent' => 'espresso-toolbar-registrations',
450
+					'title'  => '<span class="ee-toolbar-icon"></span>'
451
+								. esc_html__('Approved', 'event_espresso'),
452
+					'href'   => EEH_URL::add_query_args_and_nonce(
453
+						[
454
+							'action'      => 'default',
455
+							'status'      => 'today',
456
+							'_reg_status' => EEM_Registration::status_id_approved,
457
+						],
458
+						$this->reg_admin_url
459
+					),
460
+					'meta'   => [
461
+						'title'  => esc_html__('Approved', 'event_espresso'),
462
+						'target' => '',
463
+						'class'  => $this->menu_class . ' ee-toolbar-icon-approved',
464
+					],
465
+				]
466
+			);
467
+		}
468
+	}
469
+
470
+
471
+	/**
472
+	 * @return void
473
+	 */
474
+	private function addRegistrationOverviewTodayPendingPayment()
475
+	{
476
+		if (
477
+			$this->capabilities->current_user_can(
478
+				'ee_read_registrations',
479
+				'ee_admin_bar_menu_espresso-toolbar-registrations-today-pending'
480
+			)
481
+		) {
482
+			$this->admin_bar->add_menu(
483
+				[
484
+					'id'     => 'espresso-toolbar-registrations-today-pending',
485
+					'parent' => 'espresso-toolbar-registrations',
486
+					'title'  => '<span class="ee-toolbar-icon"></span>'
487
+								. esc_html__('Pending', 'event_espresso'),
488
+					'href'   => EEH_URL::add_query_args_and_nonce(
489
+						[
490
+							'action'      => 'default',
491
+							'status'      => 'today',
492
+							'_reg_status' => EEM_Registration::status_id_pending_payment,
493
+						],
494
+						$this->reg_admin_url
495
+					),
496
+					'meta'   => [
497
+						'title'  => esc_html__('Pending Payment', 'event_espresso'),
498
+						'target' => '',
499
+						'class'  => $this->menu_class . ' ee-toolbar-icon-pending',
500
+					],
501
+				]
502
+			);
503
+		}
504
+	}
505
+
506
+
507
+	/**
508
+	 * @return void
509
+	 */
510
+	private function addRegistrationOverviewTodayNotApproved()
511
+	{
512
+		if (
513
+			$this->capabilities->current_user_can(
514
+				'ee_read_registrations',
515
+				'ee_admin_bar_menu_espresso-toolbar-registrations-today-not-approved'
516
+			)
517
+		) {
518
+			$this->admin_bar->add_menu(
519
+				[
520
+					'id'     => 'espresso-toolbar-registrations-today-not-approved',
521
+					'parent' => 'espresso-toolbar-registrations',
522
+					'title'  => '<span class="ee-toolbar-icon"></span>'
523
+								. esc_html__('Not Approved', 'event_espresso'),
524
+					'href'   => EEH_URL::add_query_args_and_nonce(
525
+						[
526
+							'action'      => 'default',
527
+							'status'      => 'today',
528
+							'_reg_status' => EEM_Registration::status_id_not_approved,
529
+						],
530
+						$this->reg_admin_url
531
+					),
532
+					'meta'   => [
533
+						'title'  => esc_html__('Not Approved', 'event_espresso'),
534
+						'target' => '',
535
+						'class'  => $this->menu_class . ' ee-toolbar-icon-not-approved',
536
+					],
537
+				]
538
+			);
539
+		}
540
+	}
541
+
542
+
543
+	/**
544
+	 * @return void
545
+	 */
546
+	private function addRegistrationOverviewTodayCancelled()
547
+	{
548
+		if (
549
+			$this->capabilities->current_user_can(
550
+				'ee_read_registrations',
551
+				'ee_admin_bar_menu_espresso-toolbar-registrations-today-cancelled'
552
+			)
553
+		) {
554
+			$this->admin_bar->add_menu(
555
+				[
556
+					'id'     => 'espresso-toolbar-registrations-today-cancelled',
557
+					'parent' => 'espresso-toolbar-registrations',
558
+					'title'  => '<span class="ee-toolbar-icon"></span>'
559
+								. esc_html__('Cancelled', 'event_espresso'),
560
+					'href'   => EEH_URL::add_query_args_and_nonce(
561
+						[
562
+							'action'      => 'default',
563
+							'status'      => 'today',
564
+							'_reg_status' => EEM_Registration::status_id_cancelled,
565
+						],
566
+						$this->reg_admin_url
567
+					),
568
+					'meta'   => [
569
+						'title'  => esc_html__('Cancelled', 'event_espresso'),
570
+						'target' => '',
571
+						'class'  => $this->menu_class . ' ee-toolbar-icon-cancelled',
572
+					],
573
+				]
574
+			);
575
+		}
576
+	}
577
+
578
+
579
+	/**
580
+	 * @return void
581
+	 */
582
+	private function addRegistrationOverviewThisMonth()
583
+	{
584
+		if (
585
+			$this->capabilities->current_user_can(
586
+				'ee_read_registrations',
587
+				'ee_admin_bar_menu_espresso-toolbar-registrations-month'
588
+			)
589
+		) {
590
+			$this->admin_bar->add_menu(
591
+				[
592
+					'id'     => 'espresso-toolbar-registrations-month',
593
+					'parent' => 'espresso-toolbar-registrations',
594
+					'title'  => esc_html__('This Month', 'event_espresso'),
595
+					'href'   => '', // EEH_URL::add_query_args_and_nonce(
596
+					//     array(
597
+					//         'action' => 'default',
598
+					//         'status' => 'month'
599
+					//     ),
600
+					//     $this->reg_admin_url
601
+					// ),
602
+					'meta'   => [
603
+						'title'  => esc_html__('This Month', 'event_espresso'),
604
+						'target' => '',
605
+						'class'  => $this->menu_class,
606
+					],
607
+				]
608
+			);
609
+		}
610
+	}
611
+
612
+
613
+	/**
614
+	 * @return void
615
+	 */
616
+	private function addRegistrationOverviewThisMonthApproved()
617
+	{
618
+		if (
619
+			$this->capabilities->current_user_can(
620
+				'ee_read_registrations',
621
+				'ee_admin_bar_menu_espresso-toolbar-registrations-month-approved'
622
+			)
623
+		) {
624
+			$this->admin_bar->add_menu(
625
+				[
626
+					'id'     => 'espresso-toolbar-registrations-month-approved',
627
+					'parent' => 'espresso-toolbar-registrations',
628
+					'title'  => '<span class="ee-toolbar-icon"></span>'
629
+								. esc_html__('Approved', 'event_espresso'),
630
+					'href'   => EEH_URL::add_query_args_and_nonce(
631
+						[
632
+							'action'      => 'default',
633
+							'status'      => 'month',
634
+							'_reg_status' => EEM_Registration::status_id_approved,
635
+						],
636
+						$this->reg_admin_url
637
+					),
638
+					'meta'   => [
639
+						'title'  => esc_html__('Approved', 'event_espresso'),
640
+						'target' => '',
641
+						'class'  => $this->menu_class . ' ee-toolbar-icon-approved',
642
+					],
643
+				]
644
+			);
645
+		}
646
+	}
647
+
648
+
649
+	/**
650
+	 * @return void
651
+	 */
652
+	private function addRegistrationOverviewThisMonthPending()
653
+	{
654
+		if (
655
+			$this->capabilities->current_user_can(
656
+				'ee_read_registrations',
657
+				'ee_admin_bar_menu_espresso-toolbar-registrations-month-pending'
658
+			)
659
+		) {
660
+			$this->admin_bar->add_menu(
661
+				[
662
+					'id'     => 'espresso-toolbar-registrations-month-pending',
663
+					'parent' => 'espresso-toolbar-registrations',
664
+					'title'  => '<span class="ee-toolbar-icon"></span>'
665
+								. esc_html__('Pending', 'event_espresso'),
666
+					'href'   => EEH_URL::add_query_args_and_nonce(
667
+						[
668
+							'action'      => 'default',
669
+							'status'      => 'month',
670
+							'_reg_status' => EEM_Registration::status_id_pending_payment,
671
+						],
672
+						$this->reg_admin_url
673
+					),
674
+					'meta'   => [
675
+						'title'  => esc_html__('Pending', 'event_espresso'),
676
+						'target' => '',
677
+						'class'  => $this->menu_class . ' ee-toolbar-icon-pending',
678
+					],
679
+				]
680
+			);
681
+		}
682
+	}
683
+
684
+
685
+	/**
686
+	 * @return void
687
+	 */
688
+	private function addRegistrationOverviewThisMonthNotApproved()
689
+	{
690
+		if (
691
+			$this->capabilities->current_user_can(
692
+				'ee_read_registrations',
693
+				'ee_admin_bar_menu_espresso-toolbar-registrations-month-not-approved'
694
+			)
695
+		) {
696
+			$this->admin_bar->add_menu(
697
+				[
698
+					'id'     => 'espresso-toolbar-registrations-month-not-approved',
699
+					'parent' => 'espresso-toolbar-registrations',
700
+					'title'  => '<span class="ee-toolbar-icon"></span>'
701
+								. esc_html__('Not Approved', 'event_espresso'),
702
+					'href'   => EEH_URL::add_query_args_and_nonce(
703
+						[
704
+							'action'      => 'default',
705
+							'status'      => 'month',
706
+							'_reg_status' => EEM_Registration::status_id_not_approved,
707
+						],
708
+						$this->reg_admin_url
709
+					),
710
+					'meta'   => [
711
+						'title'  => esc_html__('Not Approved', 'event_espresso'),
712
+						'target' => '',
713
+						'class'  => $this->menu_class . ' ee-toolbar-icon-not-approved',
714
+					],
715
+				]
716
+			);
717
+		}
718
+	}
719
+
720
+
721
+	/**
722
+	 * @return void
723
+	 */
724
+	private function addRegistrationOverviewThisMonthCancelled()
725
+	{
726
+		if (
727
+			$this->capabilities->current_user_can(
728
+				'ee_read_registrations',
729
+				'ee_admin_bar_menu_espresso-toolbar-registrations-month-cancelled'
730
+			)
731
+		) {
732
+			$this->admin_bar->add_menu(
733
+				[
734
+					'id'     => 'espresso-toolbar-registrations-month-cancelled',
735
+					'parent' => 'espresso-toolbar-registrations',
736
+					'title'  => '<span class="ee-toolbar-icon"></span>'
737
+								. esc_html__('Cancelled', 'event_espresso'),
738
+					'href'   => EEH_URL::add_query_args_and_nonce(
739
+						[
740
+							'action'      => 'default',
741
+							'status'      => 'month',
742
+							'_reg_status' => EEM_Registration::status_id_cancelled,
743
+						],
744
+						$this->reg_admin_url
745
+					),
746
+					'meta'   => [
747
+						'title'  => esc_html__('Cancelled', 'event_espresso'),
748
+						'target' => '',
749
+						'class'  => $this->menu_class . ' ee-toolbar-icon-cancelled',
750
+					],
751
+				]
752
+			);
753
+		}
754
+	}
755
+
756
+
757
+	/**
758
+	 * @return void
759
+	 */
760
+	private function addExtensionsAndServices()
761
+	{
762
+		if (
763
+			$this->capabilities->current_user_can(
764
+				'ee_read_ee',
765
+				'ee_admin_bar_menu_espresso-toolbar-extensions-and-services'
766
+			)
767
+		) {
768
+			$this->admin_bar->add_menu(
769
+				[
770
+					'id'     => 'espresso-toolbar-extensions-and-services',
771
+					'parent' => 'espresso-toolbar',
772
+					'title'  => '<span class="ee-toolbar-icon"></span>'
773
+								. esc_html__('Extensions & Services', 'event_espresso'),
774
+					'href'   => admin_url('admin.php?page=espresso_packages'),
775
+					'meta'   => [
776
+						'title'  => esc_html__('Extensions & Services', 'event_espresso'),
777
+						'target' => '',
778
+						'class'  => $this->menu_class,
779
+					],
780
+				]
781
+			);
782
+		}
783
+	}
784
+
785
+
786
+	/**
787
+	 * @return void
788
+	 */
789
+	private function addFontSizeSubMenu()
790
+	{
791
+		$this->admin_bar->add_menu(
792
+			[
793
+				'id'     => 'espresso-toolbar-font-size',
794
+				'parent' => 'espresso-toolbar',
795
+				'title'  => '<span class="ee-toolbar-icon"></span>'
796
+							. esc_html__('Set Font Size', 'event_espresso'),
797
+				'href'   => '',
798
+				'meta'   => [
799
+					'title'  => esc_html__('Set Font Size', 'event_espresso'),
800
+					'target' => '',
801
+					'class'  => $this->menu_class,
802
+				],
803
+			]
804
+		);
805
+
806
+		$settings_admin_url = admin_url('admin.php?page=espresso_general_settings');
807
+
808
+		$font_sizes = [
809
+			'tiny'    => AdminFontSize::FONT_SIZE_TINY,
810
+			'smaller' => AdminFontSize::FONT_SIZE_SMALLER,
811
+			'small'   => AdminFontSize::FONT_SIZE_SMALL,
812
+			'default' => AdminFontSize::FONT_SIZE_DEFAULT,
813
+			'big'     => AdminFontSize::FONT_SIZE_BIG,
814
+			'bigger'  => AdminFontSize::FONT_SIZE_BIGGER,
815
+		];
816
+
817
+		foreach ($font_sizes as $font_size => $value) {
818
+			$this->admin_bar->add_menu(
819
+				[
820
+					'id'     => "espresso-toolbar-set-font-size-$font_size",
821
+					'parent' => 'espresso-toolbar-font-size',
822
+					'title'  => '<span class="ee-toolbar-icon"></span>'
823
+								. sprintf(
824
+									/* translators: Font Size Small */
825
+									esc_html__('Font Size %1$s', 'event_espresso'),
826
+									ucwords($font_size)
827
+								),
828
+					'href'   => EEH_URL::add_query_args_and_nonce(
829
+						['action' => 'set_font_size', 'font_size' => $value],
830
+						$settings_admin_url
831
+					),
832
+					'meta'   => [
833
+						'title'  => esc_html__('increases or decreases the Event Espresso admin font size', 'event_espresso'),
834
+						'target' => '',
835
+						'class'  => $this->menu_class,
836
+					],
837
+				]
838
+			);
839
+		}
840
+	}
841 841
 }
Please login to merge, or discard this patch.
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -20,7 +20,7 @@  discard block
 block discarded – undo
20 20
  */
21 21
 class AdminToolBar
22 22
 {
23
-    private ?WP_Admin_Bar   $admin_bar        = null;
23
+    private ?WP_Admin_Bar   $admin_bar = null;
24 24
 
25 25
     private EE_Capabilities $capabilities;
26 26
 
@@ -100,7 +100,7 @@  discard block
 block discarded – undo
100 100
     {
101 101
         wp_register_style(
102 102
             'espresso-admin-toolbar',
103
-            EE_GLOBAL_ASSETS_URL . 'css/espresso-admin-toolbar.css',
103
+            EE_GLOBAL_ASSETS_URL.'css/espresso-admin-toolbar.css',
104 104
             ['dashicons'],
105 105
             EVENT_ESPRESSO_VERSION
106 106
         );
@@ -122,7 +122,7 @@  discard block
 block discarded – undo
122 122
                 'href'  => $this->events_admin_url,
123 123
                 'meta'  => [
124 124
                     'title' => esc_html__('Event Espresso', 'event_espresso'),
125
-                    'class' => $this->menu_class . 'first',
125
+                    'class' => $this->menu_class.'first',
126 126
                 ],
127 127
             ]
128 128
         );
@@ -460,7 +460,7 @@  discard block
 block discarded – undo
460 460
                     'meta'   => [
461 461
                         'title'  => esc_html__('Approved', 'event_espresso'),
462 462
                         'target' => '',
463
-                        'class'  => $this->menu_class . ' ee-toolbar-icon-approved',
463
+                        'class'  => $this->menu_class.' ee-toolbar-icon-approved',
464 464
                     ],
465 465
                 ]
466 466
             );
@@ -496,7 +496,7 @@  discard block
 block discarded – undo
496 496
                     'meta'   => [
497 497
                         'title'  => esc_html__('Pending Payment', 'event_espresso'),
498 498
                         'target' => '',
499
-                        'class'  => $this->menu_class . ' ee-toolbar-icon-pending',
499
+                        'class'  => $this->menu_class.' ee-toolbar-icon-pending',
500 500
                     ],
501 501
                 ]
502 502
             );
@@ -532,7 +532,7 @@  discard block
 block discarded – undo
532 532
                     'meta'   => [
533 533
                         'title'  => esc_html__('Not Approved', 'event_espresso'),
534 534
                         'target' => '',
535
-                        'class'  => $this->menu_class . ' ee-toolbar-icon-not-approved',
535
+                        'class'  => $this->menu_class.' ee-toolbar-icon-not-approved',
536 536
                     ],
537 537
                 ]
538 538
             );
@@ -568,7 +568,7 @@  discard block
 block discarded – undo
568 568
                     'meta'   => [
569 569
                         'title'  => esc_html__('Cancelled', 'event_espresso'),
570 570
                         'target' => '',
571
-                        'class'  => $this->menu_class . ' ee-toolbar-icon-cancelled',
571
+                        'class'  => $this->menu_class.' ee-toolbar-icon-cancelled',
572 572
                     ],
573 573
                 ]
574 574
             );
@@ -638,7 +638,7 @@  discard block
 block discarded – undo
638 638
                     'meta'   => [
639 639
                         'title'  => esc_html__('Approved', 'event_espresso'),
640 640
                         'target' => '',
641
-                        'class'  => $this->menu_class . ' ee-toolbar-icon-approved',
641
+                        'class'  => $this->menu_class.' ee-toolbar-icon-approved',
642 642
                     ],
643 643
                 ]
644 644
             );
@@ -674,7 +674,7 @@  discard block
 block discarded – undo
674 674
                     'meta'   => [
675 675
                         'title'  => esc_html__('Pending', 'event_espresso'),
676 676
                         'target' => '',
677
-                        'class'  => $this->menu_class . ' ee-toolbar-icon-pending',
677
+                        'class'  => $this->menu_class.' ee-toolbar-icon-pending',
678 678
                     ],
679 679
                 ]
680 680
             );
@@ -710,7 +710,7 @@  discard block
 block discarded – undo
710 710
                     'meta'   => [
711 711
                         'title'  => esc_html__('Not Approved', 'event_espresso'),
712 712
                         'target' => '',
713
-                        'class'  => $this->menu_class . ' ee-toolbar-icon-not-approved',
713
+                        'class'  => $this->menu_class.' ee-toolbar-icon-not-approved',
714 714
                     ],
715 715
                 ]
716 716
             );
@@ -746,7 +746,7 @@  discard block
 block discarded – undo
746 746
                     'meta'   => [
747 747
                         'title'  => esc_html__('Cancelled', 'event_espresso'),
748 748
                         'target' => '',
749
-                        'class'  => $this->menu_class . ' ee-toolbar-icon-cancelled',
749
+                        'class'  => $this->menu_class.' ee-toolbar-icon-cancelled',
750 750
                     ],
751 751
                 ]
752 752
             );
Please login to merge, or discard this patch.
core/domain/services/admin/AdminFontSize.php 2 patches
Indentation   +73 added lines, -73 removed lines patch added patch discarded remove patch
@@ -7,77 +7,77 @@
 block discarded – undo
7 7
 
8 8
 class AdminFontSize extends WordPressOption
9 9
 {
10
-    private const OPTION_NAME      = 'ee-admin-font-size';
11
-
12
-    public const FONT_SIZE_TINY    = 1;
13
-
14
-    public const FONT_SIZE_SMALLER = 2;
15
-
16
-    public const FONT_SIZE_SMALL   = 3;
17
-
18
-    public const FONT_SIZE_DEFAULT = 4;
19
-
20
-    public const FONT_SIZE_BIG     = 5;
21
-
22
-    public const FONT_SIZE_BIGGER  = 6;
23
-
24
-    private array $css_classes = [
25
-        AdminFontSize::FONT_SIZE_TINY    => 'espresso-admin-font-size-tiny',
26
-        AdminFontSize::FONT_SIZE_SMALLER => 'espresso-admin-font-size-smaller',
27
-        AdminFontSize::FONT_SIZE_SMALL   => 'espresso-admin-font-size-small',
28
-        AdminFontSize::FONT_SIZE_DEFAULT => 'espresso-admin-font-size-default',
29
-        AdminFontSize::FONT_SIZE_BIG     => 'espresso-admin-font-size-big',
30
-        AdminFontSize::FONT_SIZE_BIGGER  => 'espresso-admin-font-size-bigger',
31
-    ];
32
-
33
-
34
-    /**
35
-     * SessionLifespanOption constructor.
36
-     */
37
-    public function __construct()
38
-    {
39
-        parent::__construct(
40
-            AdminFontSize::OPTION_NAME . '-' . get_current_user_id(),
41
-            AdminFontSize::FONT_SIZE_DEFAULT,
42
-            true
43
-        );
44
-    }
45
-
46
-
47
-    /**
48
-     * @return false|mixed|void
49
-     */
50
-    public function getAdminFontSize()
51
-    {
52
-        return $this->loadOption();
53
-    }
54
-
55
-
56
-    public static function setAdminFontSizeBodyClass()
57
-    {
58
-        add_filter('admin_body_class', [AdminFontSize::class, 'adminFontSizeBodyClass'], 99);
59
-    }
60
-
61
-
62
-    public static function adminFontSizeBodyClass($classes): string
63
-    {
64
-        /** @var AdminFontSize $AFS */
65
-        $AFS       = LoaderFactory::getShared(AdminFontSize::class);
66
-        $font_size = $AFS->getAdminFontSize();
67
-        $font_size_class = $AFS->css_classes[ $font_size ] ?? $AFS->css_classes[ AdminFontSize::FONT_SIZE_DEFAULT ];
68
-        if (strpos($classes, $font_size_class) === false) {
69
-            $classes .= " $font_size_class";
70
-        }
71
-        return $classes;
72
-    }
73
-
74
-
75
-    public static function setAdminFontSize(int $font_size): int
76
-    {
77
-        /** @var AdminFontSize $AFS */
78
-        $AFS       = LoaderFactory::getShared(AdminFontSize::class);
79
-        $font_size = max($font_size, AdminFontSize::FONT_SIZE_TINY);
80
-        $font_size = min($font_size, AdminFontSize::FONT_SIZE_BIGGER);
81
-        return $AFS->updateOption($font_size);
82
-    }
10
+	private const OPTION_NAME      = 'ee-admin-font-size';
11
+
12
+	public const FONT_SIZE_TINY    = 1;
13
+
14
+	public const FONT_SIZE_SMALLER = 2;
15
+
16
+	public const FONT_SIZE_SMALL   = 3;
17
+
18
+	public const FONT_SIZE_DEFAULT = 4;
19
+
20
+	public const FONT_SIZE_BIG     = 5;
21
+
22
+	public const FONT_SIZE_BIGGER  = 6;
23
+
24
+	private array $css_classes = [
25
+		AdminFontSize::FONT_SIZE_TINY    => 'espresso-admin-font-size-tiny',
26
+		AdminFontSize::FONT_SIZE_SMALLER => 'espresso-admin-font-size-smaller',
27
+		AdminFontSize::FONT_SIZE_SMALL   => 'espresso-admin-font-size-small',
28
+		AdminFontSize::FONT_SIZE_DEFAULT => 'espresso-admin-font-size-default',
29
+		AdminFontSize::FONT_SIZE_BIG     => 'espresso-admin-font-size-big',
30
+		AdminFontSize::FONT_SIZE_BIGGER  => 'espresso-admin-font-size-bigger',
31
+	];
32
+
33
+
34
+	/**
35
+	 * SessionLifespanOption constructor.
36
+	 */
37
+	public function __construct()
38
+	{
39
+		parent::__construct(
40
+			AdminFontSize::OPTION_NAME . '-' . get_current_user_id(),
41
+			AdminFontSize::FONT_SIZE_DEFAULT,
42
+			true
43
+		);
44
+	}
45
+
46
+
47
+	/**
48
+	 * @return false|mixed|void
49
+	 */
50
+	public function getAdminFontSize()
51
+	{
52
+		return $this->loadOption();
53
+	}
54
+
55
+
56
+	public static function setAdminFontSizeBodyClass()
57
+	{
58
+		add_filter('admin_body_class', [AdminFontSize::class, 'adminFontSizeBodyClass'], 99);
59
+	}
60
+
61
+
62
+	public static function adminFontSizeBodyClass($classes): string
63
+	{
64
+		/** @var AdminFontSize $AFS */
65
+		$AFS       = LoaderFactory::getShared(AdminFontSize::class);
66
+		$font_size = $AFS->getAdminFontSize();
67
+		$font_size_class = $AFS->css_classes[ $font_size ] ?? $AFS->css_classes[ AdminFontSize::FONT_SIZE_DEFAULT ];
68
+		if (strpos($classes, $font_size_class) === false) {
69
+			$classes .= " $font_size_class";
70
+		}
71
+		return $classes;
72
+	}
73
+
74
+
75
+	public static function setAdminFontSize(int $font_size): int
76
+	{
77
+		/** @var AdminFontSize $AFS */
78
+		$AFS       = LoaderFactory::getShared(AdminFontSize::class);
79
+		$font_size = max($font_size, AdminFontSize::FONT_SIZE_TINY);
80
+		$font_size = min($font_size, AdminFontSize::FONT_SIZE_BIGGER);
81
+		return $AFS->updateOption($font_size);
82
+	}
83 83
 }
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -37,7 +37,7 @@  discard block
 block discarded – undo
37 37
     public function __construct()
38 38
     {
39 39
         parent::__construct(
40
-            AdminFontSize::OPTION_NAME . '-' . get_current_user_id(),
40
+            AdminFontSize::OPTION_NAME.'-'.get_current_user_id(),
41 41
             AdminFontSize::FONT_SIZE_DEFAULT,
42 42
             true
43 43
         );
@@ -64,7 +64,7 @@  discard block
 block discarded – undo
64 64
         /** @var AdminFontSize $AFS */
65 65
         $AFS       = LoaderFactory::getShared(AdminFontSize::class);
66 66
         $font_size = $AFS->getAdminFontSize();
67
-        $font_size_class = $AFS->css_classes[ $font_size ] ?? $AFS->css_classes[ AdminFontSize::FONT_SIZE_DEFAULT ];
67
+        $font_size_class = $AFS->css_classes[$font_size] ?? $AFS->css_classes[AdminFontSize::FONT_SIZE_DEFAULT];
68 68
         if (strpos($classes, $font_size_class) === false) {
69 69
             $classes .= " $font_size_class";
70 70
         }
Please login to merge, or discard this patch.
core/domain/services/admin/events/editor/TicketMeta.php 1 patch
Indentation   +34 added lines, -34 removed lines patch added patch discarded remove patch
@@ -14,42 +14,42 @@
 block discarded – undo
14 14
  */
15 15
 class TicketMeta implements EventEditorDataInterface
16 16
 {
17
-    /**
18
-     * @var EEM_Ticket $ticket_model
19
-     */
20
-    protected $ticket_model;
17
+	/**
18
+	 * @var EEM_Ticket $ticket_model
19
+	 */
20
+	protected $ticket_model;
21 21
 
22 22
 
23
-    /**
24
-     * TicketMeta constructor.
25
-     *
26
-     * @param EEM_Ticket $ticket_model
27
-     */
28
-    public function __construct(EEM_Ticket $ticket_model)
29
-    {
30
-        $this->ticket_model = $ticket_model;
31
-    }
23
+	/**
24
+	 * TicketMeta constructor.
25
+	 *
26
+	 * @param EEM_Ticket $ticket_model
27
+	 */
28
+	public function __construct(EEM_Ticket $ticket_model)
29
+	{
30
+		$this->ticket_model = $ticket_model;
31
+	}
32 32
 
33 33
 
34
-    /**
35
-     * @param int $eventId
36
-     * @return array
37
-     */
38
-    public function getData(int $eventId): array
39
-    {
40
-        $ticket_visibility_options = apply_filters(
41
-            'FHEE___EventEspresso_core_domain_services_admin_events_editor_TicketMeta__getData__visibilityOptions',
42
-            $this->ticket_model->ticketVisibilityOptions()
43
-        );
44
-        $visibility_options = [];
45
-        foreach ($ticket_visibility_options as $key => $ticket_visibility_option) {
46
-            $visibility_options[] = [
47
-                'desc' => $ticket_visibility_option['desc'],
48
-                'label' => $ticket_visibility_option['label'],
49
-                'level' => $ticket_visibility_option['value'],
50
-                'value' => $key, // we want to use the keys like PUBLIC or ADMINS_ONLY as values in the client
51
-            ];
52
-        }
53
-        return ['visibilityOptions' => $visibility_options];
54
-    }
34
+	/**
35
+	 * @param int $eventId
36
+	 * @return array
37
+	 */
38
+	public function getData(int $eventId): array
39
+	{
40
+		$ticket_visibility_options = apply_filters(
41
+			'FHEE___EventEspresso_core_domain_services_admin_events_editor_TicketMeta__getData__visibilityOptions',
42
+			$this->ticket_model->ticketVisibilityOptions()
43
+		);
44
+		$visibility_options = [];
45
+		foreach ($ticket_visibility_options as $key => $ticket_visibility_option) {
46
+			$visibility_options[] = [
47
+				'desc' => $ticket_visibility_option['desc'],
48
+				'label' => $ticket_visibility_option['label'],
49
+				'level' => $ticket_visibility_option['value'],
50
+				'value' => $key, // we want to use the keys like PUBLIC or ADMINS_ONLY as values in the client
51
+			];
52
+		}
53
+		return ['visibilityOptions' => $visibility_options];
54
+	}
55 55
 }
Please login to merge, or discard this patch.
core/domain/services/graphql/data/mutations/EventMutation.php 2 patches
Indentation   +105 added lines, -105 removed lines patch added patch discarded remove patch
@@ -20,109 +20,109 @@
 block discarded – undo
20 20
  */
21 21
 class EventMutation
22 22
 {
23
-    /**
24
-     * Maps the GraphQL input to a format that the model functions can use
25
-     *
26
-     * @param array  $input         Data coming from the GraphQL mutation query input
27
-     * @return array
28
-     * @throws Exception
29
-     */
30
-    public static function prepareFields(array $input): array
31
-    {
32
-        $args = [];
33
-
34
-        if (array_key_exists('allowDonations', $input)) {
35
-            $args['EVT_donations'] = filter_var($input['allowDonations'], FILTER_VALIDATE_BOOLEAN);
36
-        }
37
-
38
-        if (array_key_exists('allowOverflow', $input)) {
39
-            $args['EVT_allow_overflow'] = filter_var($input['allowOverflow'], FILTER_VALIDATE_BOOLEAN);
40
-        }
41
-
42
-        if (array_key_exists('altRegPage', $input)) {
43
-            $args['EVT_external_URL'] = sanitize_text_field($input['altRegPage']);
44
-        }
45
-
46
-        if (! empty($input['defaultRegStatus'])) {
47
-            $args['EVT_default_registration_status'] = sanitize_text_field($input['defaultRegStatus']);
48
-        }
49
-
50
-        if (! empty($input['description'])) {
51
-            $args['EVT_desc'] = sanitize_post_field('post_content', $input['description'], null, 'db');
52
-        }
53
-
54
-        if (array_key_exists('displayDescription', $input)) {
55
-            $args['EVT_display_desc'] = filter_var($input['displayDescription'], FILTER_VALIDATE_BOOLEAN);
56
-        }
57
-
58
-        if (array_key_exists('displayTicketSelector', $input)) {
59
-            $args['EVT_display_ticket_selector'] = filter_var($input['displayTicketSelector'], FILTER_VALIDATE_BOOLEAN);
60
-        }
61
-
62
-        if (! empty($input['maxRegistrations'])) {
63
-            $args['EVT_additional_limit'] = absint($input['maxRegistrations']);
64
-        }
65
-
66
-        if (array_key_exists('memberOnly', $input)) {
67
-            $args['EVT_member_only'] = filter_var($input['memberOnly'], FILTER_VALIDATE_BOOLEAN);
68
-        }
69
-
70
-        if (! empty($input['name'])) {
71
-            $args['EVT_name'] = sanitize_text_field($input['name']);
72
-        }
73
-
74
-        if (array_key_exists('order', $input)) {
75
-            $args['EVT_order'] = absint($input['order']);
76
-        }
77
-
78
-        if (array_key_exists('phoneNumber', $input)) {
79
-            $args['EVT_phone'] = sanitize_text_field($input['phoneNumber']);
80
-        }
81
-
82
-        if (array_key_exists('shortDescription', $input)) {
83
-            $args['EVT_short_desc'] = sanitize_post_field('post_excerpt', $input['shortDescription'], null, 'db');
84
-        }
85
-
86
-        if (array_key_exists('timezoneString', $input)) {
87
-            $args['EVT_timezone_string'] = sanitize_text_field($input['timezoneString']);
88
-        }
89
-
90
-        if (! empty($input['manager'])) {
91
-            $parts = Relay::fromGlobalId(sanitize_text_field($input['manager']));
92
-            $args['EVT_wp_user'] = ! empty($parts['id']) ? $parts['id'] : null;
93
-        }
94
-
95
-        if (array_key_exists('venue', $input)) {
96
-            $venue_id = sanitize_text_field($input['venue']);
97
-            $parts = Relay::fromGlobalId($venue_id);
98
-            $args['venue'] = ! empty($parts['id']) ? $parts['id'] : $venue_id;
99
-        }
100
-
101
-        return apply_filters(
102
-            'FHEE__EventEspresso_core_domain_services_graphql_data_mutations__event_args',
103
-            $args,
104
-            $input
105
-        );
106
-    }
107
-
108
-
109
-    /**
110
-     * Sets the venue for the event.
111
-     *
112
-     * @param EE_Event $entity The event instance.
113
-     * @param int      $venue  The venue ID
114
-     * @throws EE_Error
115
-     * @throws InvalidDataTypeException
116
-     * @throws InvalidInterfaceException
117
-     * @throws InvalidArgumentException
118
-     * @throws ReflectionException
119
-     */
120
-    public static function setEventVenue(EE_Event $entity, int $venue)
121
-    {
122
-        if (empty($venue)) {
123
-            $entity->remove_venue($venue);
124
-        } else {
125
-            $entity->add_venue($venue);
126
-        }
127
-    }
23
+	/**
24
+	 * Maps the GraphQL input to a format that the model functions can use
25
+	 *
26
+	 * @param array  $input         Data coming from the GraphQL mutation query input
27
+	 * @return array
28
+	 * @throws Exception
29
+	 */
30
+	public static function prepareFields(array $input): array
31
+	{
32
+		$args = [];
33
+
34
+		if (array_key_exists('allowDonations', $input)) {
35
+			$args['EVT_donations'] = filter_var($input['allowDonations'], FILTER_VALIDATE_BOOLEAN);
36
+		}
37
+
38
+		if (array_key_exists('allowOverflow', $input)) {
39
+			$args['EVT_allow_overflow'] = filter_var($input['allowOverflow'], FILTER_VALIDATE_BOOLEAN);
40
+		}
41
+
42
+		if (array_key_exists('altRegPage', $input)) {
43
+			$args['EVT_external_URL'] = sanitize_text_field($input['altRegPage']);
44
+		}
45
+
46
+		if (! empty($input['defaultRegStatus'])) {
47
+			$args['EVT_default_registration_status'] = sanitize_text_field($input['defaultRegStatus']);
48
+		}
49
+
50
+		if (! empty($input['description'])) {
51
+			$args['EVT_desc'] = sanitize_post_field('post_content', $input['description'], null, 'db');
52
+		}
53
+
54
+		if (array_key_exists('displayDescription', $input)) {
55
+			$args['EVT_display_desc'] = filter_var($input['displayDescription'], FILTER_VALIDATE_BOOLEAN);
56
+		}
57
+
58
+		if (array_key_exists('displayTicketSelector', $input)) {
59
+			$args['EVT_display_ticket_selector'] = filter_var($input['displayTicketSelector'], FILTER_VALIDATE_BOOLEAN);
60
+		}
61
+
62
+		if (! empty($input['maxRegistrations'])) {
63
+			$args['EVT_additional_limit'] = absint($input['maxRegistrations']);
64
+		}
65
+
66
+		if (array_key_exists('memberOnly', $input)) {
67
+			$args['EVT_member_only'] = filter_var($input['memberOnly'], FILTER_VALIDATE_BOOLEAN);
68
+		}
69
+
70
+		if (! empty($input['name'])) {
71
+			$args['EVT_name'] = sanitize_text_field($input['name']);
72
+		}
73
+
74
+		if (array_key_exists('order', $input)) {
75
+			$args['EVT_order'] = absint($input['order']);
76
+		}
77
+
78
+		if (array_key_exists('phoneNumber', $input)) {
79
+			$args['EVT_phone'] = sanitize_text_field($input['phoneNumber']);
80
+		}
81
+
82
+		if (array_key_exists('shortDescription', $input)) {
83
+			$args['EVT_short_desc'] = sanitize_post_field('post_excerpt', $input['shortDescription'], null, 'db');
84
+		}
85
+
86
+		if (array_key_exists('timezoneString', $input)) {
87
+			$args['EVT_timezone_string'] = sanitize_text_field($input['timezoneString']);
88
+		}
89
+
90
+		if (! empty($input['manager'])) {
91
+			$parts = Relay::fromGlobalId(sanitize_text_field($input['manager']));
92
+			$args['EVT_wp_user'] = ! empty($parts['id']) ? $parts['id'] : null;
93
+		}
94
+
95
+		if (array_key_exists('venue', $input)) {
96
+			$venue_id = sanitize_text_field($input['venue']);
97
+			$parts = Relay::fromGlobalId($venue_id);
98
+			$args['venue'] = ! empty($parts['id']) ? $parts['id'] : $venue_id;
99
+		}
100
+
101
+		return apply_filters(
102
+			'FHEE__EventEspresso_core_domain_services_graphql_data_mutations__event_args',
103
+			$args,
104
+			$input
105
+		);
106
+	}
107
+
108
+
109
+	/**
110
+	 * Sets the venue for the event.
111
+	 *
112
+	 * @param EE_Event $entity The event instance.
113
+	 * @param int      $venue  The venue ID
114
+	 * @throws EE_Error
115
+	 * @throws InvalidDataTypeException
116
+	 * @throws InvalidInterfaceException
117
+	 * @throws InvalidArgumentException
118
+	 * @throws ReflectionException
119
+	 */
120
+	public static function setEventVenue(EE_Event $entity, int $venue)
121
+	{
122
+		if (empty($venue)) {
123
+			$entity->remove_venue($venue);
124
+		} else {
125
+			$entity->add_venue($venue);
126
+		}
127
+	}
128 128
 }
Please login to merge, or discard this patch.
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -43,11 +43,11 @@  discard block
 block discarded – undo
43 43
             $args['EVT_external_URL'] = sanitize_text_field($input['altRegPage']);
44 44
         }
45 45
 
46
-        if (! empty($input['defaultRegStatus'])) {
46
+        if ( ! empty($input['defaultRegStatus'])) {
47 47
             $args['EVT_default_registration_status'] = sanitize_text_field($input['defaultRegStatus']);
48 48
         }
49 49
 
50
-        if (! empty($input['description'])) {
50
+        if ( ! empty($input['description'])) {
51 51
             $args['EVT_desc'] = sanitize_post_field('post_content', $input['description'], null, 'db');
52 52
         }
53 53
 
@@ -59,7 +59,7 @@  discard block
 block discarded – undo
59 59
             $args['EVT_display_ticket_selector'] = filter_var($input['displayTicketSelector'], FILTER_VALIDATE_BOOLEAN);
60 60
         }
61 61
 
62
-        if (! empty($input['maxRegistrations'])) {
62
+        if ( ! empty($input['maxRegistrations'])) {
63 63
             $args['EVT_additional_limit'] = absint($input['maxRegistrations']);
64 64
         }
65 65
 
@@ -67,7 +67,7 @@  discard block
 block discarded – undo
67 67
             $args['EVT_member_only'] = filter_var($input['memberOnly'], FILTER_VALIDATE_BOOLEAN);
68 68
         }
69 69
 
70
-        if (! empty($input['name'])) {
70
+        if ( ! empty($input['name'])) {
71 71
             $args['EVT_name'] = sanitize_text_field($input['name']);
72 72
         }
73 73
 
@@ -87,7 +87,7 @@  discard block
 block discarded – undo
87 87
             $args['EVT_timezone_string'] = sanitize_text_field($input['timezoneString']);
88 88
         }
89 89
 
90
-        if (! empty($input['manager'])) {
90
+        if ( ! empty($input['manager'])) {
91 91
             $parts = Relay::fromGlobalId(sanitize_text_field($input['manager']));
92 92
             $args['EVT_wp_user'] = ! empty($parts['id']) ? $parts['id'] : null;
93 93
         }
Please login to merge, or discard this patch.
core/domain/services/graphql/mutators/TicketUpdate.php 1 patch
Indentation   +57 added lines, -57 removed lines patch added patch discarded remove patch
@@ -14,68 +14,68 @@
 block discarded – undo
14 14
 
15 15
 class TicketUpdate extends EntityMutator
16 16
 {
17
-    /**
18
-     * Defines the mutation data modification closure.
19
-     *
20
-     * @param EEM_Ticket $model
21
-     * @param Ticket     $type
22
-     * @return callable
23
-     */
24
-    public static function mutateAndGetPayload(EEM_Ticket $model, Ticket $type)
25
-    {
26
-        /**
27
-         * Updates an entity.
28
-         *
29
-         * @param array       $input   The input for the mutation
30
-         * @param AppContext  $context The AppContext passed down to all resolvers
31
-         * @param ResolveInfo $info    The ResolveInfo passed down to all resolvers
32
-         * @return array
33
-         * @throws EE_Error
34
-         * @throws ReflectionException
35
-         */
36
-        return static function (array $input, AppContext $context, ResolveInfo $info) use ($model, $type): array {
37
-            try {
38
-                /** @var EE_Ticket $entity */
39
-                $entity = EntityMutator::getEntityFromInputData($model, $input);
17
+	/**
18
+	 * Defines the mutation data modification closure.
19
+	 *
20
+	 * @param EEM_Ticket $model
21
+	 * @param Ticket     $type
22
+	 * @return callable
23
+	 */
24
+	public static function mutateAndGetPayload(EEM_Ticket $model, Ticket $type)
25
+	{
26
+		/**
27
+		 * Updates an entity.
28
+		 *
29
+		 * @param array       $input   The input for the mutation
30
+		 * @param AppContext  $context The AppContext passed down to all resolvers
31
+		 * @param ResolveInfo $info    The ResolveInfo passed down to all resolvers
32
+		 * @return array
33
+		 * @throws EE_Error
34
+		 * @throws ReflectionException
35
+		 */
36
+		return static function (array $input, AppContext $context, ResolveInfo $info) use ($model, $type): array {
37
+			try {
38
+				/** @var EE_Ticket $entity */
39
+				$entity = EntityMutator::getEntityFromInputData($model, $input);
40 40
 
41
-                $datetimes = [];
42
-                $prices = null;
41
+				$datetimes = [];
42
+				$prices = null;
43 43
 
44
-                $args = TicketMutation::prepareFields($input);
44
+				$args = TicketMutation::prepareFields($input);
45 45
 
46
-                if (isset($args['datetimes'])) {
47
-                    $datetimes = $args['datetimes'];
48
-                    unset($args['datetimes']);
49
-                }
50
-                if (array_key_exists('prices', $args)) {
51
-                    $prices = $args['prices'];
52
-                    unset($args['prices']);
53
-                }
46
+				if (isset($args['datetimes'])) {
47
+					$datetimes = $args['datetimes'];
48
+					unset($args['datetimes']);
49
+				}
50
+				if (array_key_exists('prices', $args)) {
51
+					$prices = $args['prices'];
52
+					unset($args['prices']);
53
+				}
54 54
 
55
-                $entity->save($args);
55
+				$entity->save($args);
56 56
 
57
-                if (! empty($datetimes)) {
58
-                    TicketMutation::setRelatedDatetimes($entity, $datetimes);
59
-                }
60
-                // if prices array is passed.
61
-                if (is_array($prices)) {
62
-                    TicketMutation::setRelatedPrices($entity, $prices);
63
-                }
57
+				if (! empty($datetimes)) {
58
+					TicketMutation::setRelatedDatetimes($entity, $datetimes);
59
+				}
60
+				// if prices array is passed.
61
+				if (is_array($prices)) {
62
+					TicketMutation::setRelatedPrices($entity, $prices);
63
+				}
64 64
 
65
-                do_action('AHEE__EventEspresso_core_domain_services_graphql_mutators_ticket_update', $entity, $input);
66
-            } catch (Exception $exception) {
67
-                EntityMutator::handleExceptions(
68
-                    $exception,
69
-                    esc_html__(
70
-                        'The ticket could not be updated because of the following error(s)',
71
-                        'event_espresso'
72
-                    )
73
-                );
74
-            }
65
+				do_action('AHEE__EventEspresso_core_domain_services_graphql_mutators_ticket_update', $entity, $input);
66
+			} catch (Exception $exception) {
67
+				EntityMutator::handleExceptions(
68
+					$exception,
69
+					esc_html__(
70
+						'The ticket could not be updated because of the following error(s)',
71
+						'event_espresso'
72
+					)
73
+				);
74
+			}
75 75
 
76
-            return [
77
-                'id' => $entity->ID(),
78
-            ];
79
-        };
80
-    }
76
+			return [
77
+				'id' => $entity->ID(),
78
+			];
79
+		};
80
+	}
81 81
 }
Please login to merge, or discard this patch.
core/domain/services/graphql/types/Event.php 1 patch
Indentation   +211 added lines, -211 removed lines patch added patch discarded remove patch
@@ -24,219 +24,219 @@
 block discarded – undo
24 24
  */
25 25
 class Event extends TypeBase
26 26
 {
27
-    /**
28
-     * Event constructor.
29
-     *
30
-     * @param EEM_Event $event_model
31
-     */
32
-    public function __construct(EEM_Event $event_model)
33
-    {
34
-        $this->setName($this->namespace . 'Event');
35
-        $this->setIsCustomPostType(true);
36
-        parent::__construct($event_model);
37
-    }
27
+	/**
28
+	 * Event constructor.
29
+	 *
30
+	 * @param EEM_Event $event_model
31
+	 */
32
+	public function __construct(EEM_Event $event_model)
33
+	{
34
+		$this->setName($this->namespace . 'Event');
35
+		$this->setIsCustomPostType(true);
36
+		parent::__construct($event_model);
37
+	}
38 38
 
39 39
 
40
-    /**
41
-     * @return GraphQLFieldInterface[]
42
-     */
43
-    public function getFields(): array
44
-    {
45
-        return apply_filters(
46
-            'FHEE__EventEspresso_core_domain_services_graphql_types__event_fields',
47
-            [
48
-                new GraphQLField(
49
-                    'allowDonations',
50
-                    'Boolean',
51
-                    'donations',
52
-                    esc_html__('Accept Donations?', 'event_espresso')
53
-                ),
54
-                new GraphQLField(
55
-                    'allowOverflow',
56
-                    'Boolean',
57
-                    'allow_overflow',
58
-                    esc_html__('Enable Wait List for Event', 'event_espresso')
59
-                ),
60
-                new GraphQLField(
61
-                    'altRegPage',
62
-                    'String',
63
-                    'external_url',
64
-                    esc_html__('URL of Event Page if hosted elsewhere', 'event_espresso')
65
-                ),
66
-                new GraphQLOutputField(
67
-                    'cacheId',
68
-                    ['non_null' => 'String'],
69
-                    null,
70
-                    esc_html__('The cache ID of the object.', 'event_espresso')
71
-                ),
72
-                new GraphQLField(
73
-                    'created',
74
-                    'String',
75
-                    'created',
76
-                    esc_html__('Date/Time Event Created', 'event_espresso')
77
-                ),
78
-                new GraphQLOutputField(
79
-                    'dbId',
80
-                    ['non_null' => 'Int'],
81
-                    'ID',
82
-                    esc_html__('The event ID.', 'event_espresso')
83
-                ),
84
-                new GraphQLField(
85
-                    'defaultRegStatus',
86
-                    $this->namespace . 'RegistrationStatusEnum',
87
-                    'default_registration_status',
88
-                    esc_html__('Default Event Registration Status', 'event_espresso')
89
-                ),
90
-                new GraphQLField(
91
-                    'description',
92
-                    'String',
93
-                    'description',
94
-                    esc_html__('Event Description', 'event_espresso')
95
-                ),
96
-                new GraphQLField(
97
-                    'displayDescription',
98
-                    'Boolean',
99
-                    'display_description',
100
-                    esc_html__('Display Description Flag', 'event_espresso')
101
-                ),
102
-                new GraphQLField(
103
-                    'displayTicketSelector',
104
-                    'Boolean',
105
-                    'display_ticket_selector',
106
-                    esc_html__('Display Ticket Selector Flag', 'event_espresso')
107
-                ),
108
-                new GraphQLOutputField(
109
-                    'isActive',
110
-                    'Boolean',
111
-                    'is_active',
112
-                    esc_html__('Flag indicating event is active', 'event_espresso')
113
-                ),
114
-                new GraphQLOutputField(
115
-                    'isCancelled',
116
-                    'Boolean',
117
-                    'is_cancelled',
118
-                    esc_html__('Flag indicating whether the event is marked as cancelled', 'event_espresso')
119
-                ),
120
-                new GraphQLOutputField(
121
-                    'isExpired',
122
-                    'Boolean',
123
-                    'is_expired',
124
-                    esc_html__('Flag indicating event is expired or not', 'event_espresso')
125
-                ),
126
-                new GraphQLOutputField(
127
-                    'isInactive',
128
-                    'Boolean',
129
-                    'is_inactive',
130
-                    esc_html__('Flag indicating event is inactive', 'event_espresso')
131
-                ),
132
-                new GraphQLOutputField(
133
-                    'isPostponed',
134
-                    'Boolean',
135
-                    'is_postponed',
136
-                    esc_html__('Flag indicating whether the event is marked as postponed', 'event_espresso')
137
-                ),
138
-                new GraphQLOutputField(
139
-                    'isSoldOut',
140
-                    'Boolean',
141
-                    'is_sold_out',
142
-                    esc_html__(
143
-                        'Flag indicating whether the tickets sold for the event, met or exceed the registration limit',
144
-                        'event_espresso'
145
-                    )
146
-                ),
147
-                new GraphQLOutputField(
148
-                    'isUpcoming',
149
-                    'Boolean',
150
-                    'is_upcoming',
151
-                    esc_html__('Whether the event is upcoming', 'event_espresso')
152
-                ),
153
-                new GraphQLInputField(
154
-                    'manager',
155
-                    'String',
156
-                    null,
157
-                    esc_html__('Globally unique event ID for the event manager', 'event_espresso')
158
-                ),
159
-                new GraphQLOutputField(
160
-                    'manager',
161
-                    'User',
162
-                    null,
163
-                    esc_html__('Event Manager', 'event_espresso')
164
-                ),
165
-                new GraphQLField(
166
-                    'maxRegistrations',
167
-                    'Int',
168
-                    'additional_limit',
169
-                    esc_html__('Limit of Additional Registrations on Same Transaction', 'event_espresso')
170
-                ),
171
-                new GraphQLField(
172
-                    'memberOnly',
173
-                    'Boolean',
174
-                    'member_only',
175
-                    esc_html__('Member-Only Event Flag', 'event_espresso')
176
-                ),
177
-                new GraphQLField(
178
-                    'name',
179
-                    'String',
180
-                    'name',
181
-                    esc_html__('Event Name', 'event_espresso')
182
-                ),
183
-                new GraphQLField(
184
-                    'order',
185
-                    'Int',
186
-                    'order',
187
-                    esc_html__('Event Menu Order', 'event_espresso')
188
-                ),
189
-                new GraphQLField(
190
-                    'phoneNumber',
191
-                    'String',
192
-                    'phone',
193
-                    esc_html__('Event Phone Number', 'event_espresso')
194
-                ),
195
-                new GraphQLField(
196
-                    'shortDescription',
197
-                    'String',
198
-                    'short_description',
199
-                    esc_html__('Event Short Description', 'event_espresso')
200
-                ),
201
-                new GraphQLField(
202
-                    'timezoneString',
203
-                    'String',
204
-                    'timezone_string',
205
-                    esc_html__('Timezone (name) for Event times', 'event_espresso')
206
-                ),
207
-                new GraphQLField(
208
-                    'venue',
209
-                    'String',
210
-                    null,
211
-                    esc_html__('Event venue ID', 'event_espresso'),
212
-                    null,
213
-                    function (EE_Event $source) {
214
-                        $venue_ID = $source->venue_ID();
215
-                        return $venue_ID
216
-                            // Since venue is a CPT, $type will be 'post'
217
-                            ? Relay::toGlobalId('post', $venue_ID)
218
-                            : null;
219
-                    }
220
-                ),
221
-            ],
222
-            $this->name,
223
-            $this->model
224
-        );
225
-    }
40
+	/**
41
+	 * @return GraphQLFieldInterface[]
42
+	 */
43
+	public function getFields(): array
44
+	{
45
+		return apply_filters(
46
+			'FHEE__EventEspresso_core_domain_services_graphql_types__event_fields',
47
+			[
48
+				new GraphQLField(
49
+					'allowDonations',
50
+					'Boolean',
51
+					'donations',
52
+					esc_html__('Accept Donations?', 'event_espresso')
53
+				),
54
+				new GraphQLField(
55
+					'allowOverflow',
56
+					'Boolean',
57
+					'allow_overflow',
58
+					esc_html__('Enable Wait List for Event', 'event_espresso')
59
+				),
60
+				new GraphQLField(
61
+					'altRegPage',
62
+					'String',
63
+					'external_url',
64
+					esc_html__('URL of Event Page if hosted elsewhere', 'event_espresso')
65
+				),
66
+				new GraphQLOutputField(
67
+					'cacheId',
68
+					['non_null' => 'String'],
69
+					null,
70
+					esc_html__('The cache ID of the object.', 'event_espresso')
71
+				),
72
+				new GraphQLField(
73
+					'created',
74
+					'String',
75
+					'created',
76
+					esc_html__('Date/Time Event Created', 'event_espresso')
77
+				),
78
+				new GraphQLOutputField(
79
+					'dbId',
80
+					['non_null' => 'Int'],
81
+					'ID',
82
+					esc_html__('The event ID.', 'event_espresso')
83
+				),
84
+				new GraphQLField(
85
+					'defaultRegStatus',
86
+					$this->namespace . 'RegistrationStatusEnum',
87
+					'default_registration_status',
88
+					esc_html__('Default Event Registration Status', 'event_espresso')
89
+				),
90
+				new GraphQLField(
91
+					'description',
92
+					'String',
93
+					'description',
94
+					esc_html__('Event Description', 'event_espresso')
95
+				),
96
+				new GraphQLField(
97
+					'displayDescription',
98
+					'Boolean',
99
+					'display_description',
100
+					esc_html__('Display Description Flag', 'event_espresso')
101
+				),
102
+				new GraphQLField(
103
+					'displayTicketSelector',
104
+					'Boolean',
105
+					'display_ticket_selector',
106
+					esc_html__('Display Ticket Selector Flag', 'event_espresso')
107
+				),
108
+				new GraphQLOutputField(
109
+					'isActive',
110
+					'Boolean',
111
+					'is_active',
112
+					esc_html__('Flag indicating event is active', 'event_espresso')
113
+				),
114
+				new GraphQLOutputField(
115
+					'isCancelled',
116
+					'Boolean',
117
+					'is_cancelled',
118
+					esc_html__('Flag indicating whether the event is marked as cancelled', 'event_espresso')
119
+				),
120
+				new GraphQLOutputField(
121
+					'isExpired',
122
+					'Boolean',
123
+					'is_expired',
124
+					esc_html__('Flag indicating event is expired or not', 'event_espresso')
125
+				),
126
+				new GraphQLOutputField(
127
+					'isInactive',
128
+					'Boolean',
129
+					'is_inactive',
130
+					esc_html__('Flag indicating event is inactive', 'event_espresso')
131
+				),
132
+				new GraphQLOutputField(
133
+					'isPostponed',
134
+					'Boolean',
135
+					'is_postponed',
136
+					esc_html__('Flag indicating whether the event is marked as postponed', 'event_espresso')
137
+				),
138
+				new GraphQLOutputField(
139
+					'isSoldOut',
140
+					'Boolean',
141
+					'is_sold_out',
142
+					esc_html__(
143
+						'Flag indicating whether the tickets sold for the event, met or exceed the registration limit',
144
+						'event_espresso'
145
+					)
146
+				),
147
+				new GraphQLOutputField(
148
+					'isUpcoming',
149
+					'Boolean',
150
+					'is_upcoming',
151
+					esc_html__('Whether the event is upcoming', 'event_espresso')
152
+				),
153
+				new GraphQLInputField(
154
+					'manager',
155
+					'String',
156
+					null,
157
+					esc_html__('Globally unique event ID for the event manager', 'event_espresso')
158
+				),
159
+				new GraphQLOutputField(
160
+					'manager',
161
+					'User',
162
+					null,
163
+					esc_html__('Event Manager', 'event_espresso')
164
+				),
165
+				new GraphQLField(
166
+					'maxRegistrations',
167
+					'Int',
168
+					'additional_limit',
169
+					esc_html__('Limit of Additional Registrations on Same Transaction', 'event_espresso')
170
+				),
171
+				new GraphQLField(
172
+					'memberOnly',
173
+					'Boolean',
174
+					'member_only',
175
+					esc_html__('Member-Only Event Flag', 'event_espresso')
176
+				),
177
+				new GraphQLField(
178
+					'name',
179
+					'String',
180
+					'name',
181
+					esc_html__('Event Name', 'event_espresso')
182
+				),
183
+				new GraphQLField(
184
+					'order',
185
+					'Int',
186
+					'order',
187
+					esc_html__('Event Menu Order', 'event_espresso')
188
+				),
189
+				new GraphQLField(
190
+					'phoneNumber',
191
+					'String',
192
+					'phone',
193
+					esc_html__('Event Phone Number', 'event_espresso')
194
+				),
195
+				new GraphQLField(
196
+					'shortDescription',
197
+					'String',
198
+					'short_description',
199
+					esc_html__('Event Short Description', 'event_espresso')
200
+				),
201
+				new GraphQLField(
202
+					'timezoneString',
203
+					'String',
204
+					'timezone_string',
205
+					esc_html__('Timezone (name) for Event times', 'event_espresso')
206
+				),
207
+				new GraphQLField(
208
+					'venue',
209
+					'String',
210
+					null,
211
+					esc_html__('Event venue ID', 'event_espresso'),
212
+					null,
213
+					function (EE_Event $source) {
214
+						$venue_ID = $source->venue_ID();
215
+						return $venue_ID
216
+							// Since venue is a CPT, $type will be 'post'
217
+							? Relay::toGlobalId('post', $venue_ID)
218
+							: null;
219
+					}
220
+				),
221
+			],
222
+			$this->name,
223
+			$this->model
224
+		);
225
+	}
226 226
 
227 227
 
228
-    /**
229
-     * Extends the existing WP GraphQL mutations.
230
-     *
231
-     * @since 5.0.0.p
232
-     */
233
-    public function extendMutations()
234
-    {
235
-        add_action(
236
-            'graphql_post_object_mutation_update_additional_data',
237
-            EventUpdate::mutateFields($this->model, $this),
238
-            10,
239
-            6
240
-        );
241
-    }
228
+	/**
229
+	 * Extends the existing WP GraphQL mutations.
230
+	 *
231
+	 * @since 5.0.0.p
232
+	 */
233
+	public function extendMutations()
234
+	{
235
+		add_action(
236
+			'graphql_post_object_mutation_update_additional_data',
237
+			EventUpdate::mutateFields($this->model, $this),
238
+			10,
239
+			6
240
+		);
241
+	}
242 242
 }
Please login to merge, or discard this patch.
core/domain/services/assets/EspressoLegacyAdminAssetManager.php 2 patches
Indentation   +227 added lines, -227 removed lines patch added patch discarded remove patch
@@ -15,243 +15,243 @@
 block discarded – undo
15 15
 class EspressoLegacyAdminAssetManager extends AssetManager
16 16
 {
17 17
 
18
-    const JS_HANDLE_EE_ADMIN                = 'ee_admin_js';
18
+	const JS_HANDLE_EE_ADMIN                = 'ee_admin_js';
19 19
 
20
-    const JS_HANDLE_EE_AJAX_TABLE_SORTING   = 'espresso_ajax_table_sorting';
20
+	const JS_HANDLE_EE_AJAX_TABLE_SORTING   = 'espresso_ajax_table_sorting';
21 21
 
22
-    const JS_HANDLE_EE_DATEPICKER           = 'ee-datepicker';
22
+	const JS_HANDLE_EE_DATEPICKER           = 'ee-datepicker';
23 23
 
24
-    const JS_HANDLE_EE_DIALOG               = 'ee-dialog';
24
+	const JS_HANDLE_EE_DIALOG               = 'ee-dialog';
25 25
 
26
-    const JS_HANDLE_EE_HELP_TOUR            = 'ee-help-tour';
26
+	const JS_HANDLE_EE_HELP_TOUR            = 'ee-help-tour';
27 27
 
28
-    const JS_HANDLE_EE_INJECT_WP            = 'ee-inject-wp';
28
+	const JS_HANDLE_EE_INJECT_WP            = 'ee-inject-wp';
29 29
 
30
-    const JS_HANDLE_GOOGLE_CHARTS           = 'google-charts';
30
+	const JS_HANDLE_GOOGLE_CHARTS           = 'google-charts';
31 31
 
32
-    const JS_HANDLE_MOMENT                  = 'ee-moment';
32
+	const JS_HANDLE_MOMENT                  = 'ee-moment';
33 33
 
34
-    const JS_HANDLE_MOMENT_CORE             = 'ee-moment-core';
34
+	const JS_HANDLE_MOMENT_CORE             = 'ee-moment-core';
35 35
 
36
-    const JS_HANDLE_PARSE_URI               = 'ee-parse-uri';
36
+	const JS_HANDLE_PARSE_URI               = 'ee-parse-uri';
37 37
 
38
-    const JS_HANDLE_EE_TEXT_LINKS           = 'ee-text-links';
38
+	const JS_HANDLE_EE_TEXT_LINKS           = 'ee-text-links';
39 39
 
40
-    const JS_HANDLE_EE_SERIALIZE_FULL_ARRAY = 'ee-serialize-full-array';
41
-
42
-    const JS_HANDLE_JOYRIDE_MODERNIZR       = 'joyride-modernizr';
40
+	const JS_HANDLE_EE_SERIALIZE_FULL_ARRAY = 'ee-serialize-full-array';
41
+
42
+	const JS_HANDLE_JOYRIDE_MODERNIZR       = 'joyride-modernizr';
43 43
 
44
-    const JS_HANDLE_JQUERY_JOYRIDE          = 'jquery-joyride';
45
-
46
-    const CSS_HANDLE_EE_ADMIN               = 'ee-admin-css';
47
-
48
-    const CSS_HANDLE_EE_JOYRIDE             = 'ee-joyride-css';
49
-
50
-    const CSS_HANDLE_EE_TEXT_LINKS          = 'ee-text-links';
51
-
52
-    const CSS_HANDLE_EE_UI_THEME            = 'espresso-ui-theme';
53
-
54
-    const CSS_HANDLE_JOYRIDE                = 'joyride-css';
55
-
56
-
57
-    /**
58
-     * @inheritDoc
59
-     */
60
-    public function addAssets()
61
-    {
62
-        $joyride = filter_var(apply_filters('FHEE_load_joyride', false), FILTER_VALIDATE_BOOLEAN);
63
-        $this->registerJavascript($joyride);
64
-        $this->registerStyleSheets($joyride);
65
-    }
66
-
67
-
68
-    /**
69
-     * Register javascript assets
70
-     *
71
-     * @param bool $joyride
72
-     */
73
-    private function registerJavascript($joyride = false)
74
-    {
75
-        $this->addJavascript(
76
-            EspressoLegacyAdminAssetManager::JS_HANDLE_EE_DIALOG,
77
-            EE_ADMIN_URL . 'assets/ee-dialog-helper.js',
78
-            [
79
-                JqueryAssetManager::JS_HANDLE_JQUERY,
80
-                JqueryAssetManager::JS_HANDLE_JQUERY_UI_DRAGGABLE,
81
-            ]
82
-        );
83
-        $this->addJavascript(
84
-            EspressoLegacyAdminAssetManager::JS_HANDLE_EE_ADMIN,
85
-            EE_ADMIN_URL . 'assets/ee-admin-page.js',
86
-            [
87
-                CoreAssetManager::JS_HANDLE_CORE,
88
-                EspressoLegacyAdminAssetManager::JS_HANDLE_PARSE_URI,
89
-                EspressoLegacyAdminAssetManager::JS_HANDLE_EE_DIALOG,
90
-            ]
91
-        );
92
-
93
-        // script for sorting tables
94
-        $this->addJavascript(
95
-            EspressoLegacyAdminAssetManager::JS_HANDLE_EE_AJAX_TABLE_SORTING,
96
-            EE_ADMIN_URL . 'assets/espresso_ajax_table_sorting.js',
97
-            [
98
-                EspressoLegacyAdminAssetManager::JS_HANDLE_EE_ADMIN,
99
-                JqueryAssetManager::JS_HANDLE_JQUERY_UI_SORTABLE,
100
-            ]
101
-        );
102
-
103
-        // script for parsing uri's
104
-        $this->addJavascript(
105
-            EspressoLegacyAdminAssetManager::JS_HANDLE_PARSE_URI,
106
-            EE_GLOBAL_ASSETS_URL . 'scripts/parseuri.js'
107
-        );
108
-
109
-        // and parsing associative serialized form elements
110
-        $this->addJavascript(
111
-            EspressoLegacyAdminAssetManager::JS_HANDLE_EE_SERIALIZE_FULL_ARRAY,
112
-            EE_GLOBAL_ASSETS_URL . 'scripts/jquery.serializefullarray.js',
113
-            [JqueryAssetManager::JS_HANDLE_JQUERY]
114
-
115
-        );
116
-
117
-        // helpers scripts
118
-        $this->addJavascript(
119
-            EspressoLegacyAdminAssetManager::JS_HANDLE_EE_TEXT_LINKS,
120
-            EE_PLUGIN_DIR_URL . 'core/helpers/assets/ee_text_list_helper.js',
121
-            [JqueryAssetManager::JS_HANDLE_JQUERY]
122
-        );
123
-
124
-        $this->addJavascript(
125
-            EspressoLegacyAdminAssetManager::JS_HANDLE_MOMENT_CORE,
126
-            EE_THIRD_PARTY_URL . 'moment/moment-with-locales.min.js'
127
-        );
128
-
129
-        $this->addJavascript(
130
-            EspressoLegacyAdminAssetManager::JS_HANDLE_MOMENT,
131
-            EE_THIRD_PARTY_URL . 'moment/moment-timezone-with-data.min.js',
132
-            [EspressoLegacyAdminAssetManager::JS_HANDLE_MOMENT_CORE]
133
-        );
134
-
135
-        $this->addJavascript(
136
-            EspressoLegacyAdminAssetManager::JS_HANDLE_EE_DATEPICKER,
137
-            EE_ADMIN_URL . 'assets/ee-datepicker.js',
138
-            [
139
-                JqueryAssetManager::JS_HANDLE_JQUERY_UI_TIMEPICKER_ADDON,
140
-                EspressoLegacyAdminAssetManager::JS_HANDLE_MOMENT,
141
-            ]
142
-        );
143
-
144
-        // google charts
145
-        $this->addJavascript(
146
-            EspressoLegacyAdminAssetManager::JS_HANDLE_GOOGLE_CHARTS,
147
-            'https://www.gstatic.com/charts/loader.js'
148
-        );
149
-
150
-        // this javascript is loaded on every admin page to catch any injections ee needs to add to wp run js.
151
-        // Note: the intention of this script is to only do TARGETED injections.
152
-        //ie: only injecting on certain script calls.
153
-        $this->addJavascript(
154
-            EspressoLegacyAdminAssetManager::JS_HANDLE_EE_INJECT_WP,
155
-            EE_ADMIN_URL . 'assets/ee-cpt-wp-injects.js',
156
-            [JqueryAssetManager::JS_HANDLE_JQUERY]
157
-        );
158
-
159
-        $this->loadQtipJs();
160
-
161
-        // joyride is turned OFF by default, but prior to the admin_enqueue_scripts hook,
162
-        // can be turned back on again via: add_filter('FHEE_load_joyride', '__return_true' );
163
-        if (! $joyride) {
164
-            return;
165
-        }
166
-
167
-        $this->addJavascript(
168
-            EspressoLegacyAdminAssetManager::JS_HANDLE_JOYRIDE_MODERNIZR,
169
-            EE_THIRD_PARTY_URL . 'joyride/modernizr.mq.js',
170
-            [],
171
-            true,
172
-            '2.1'
173
-        );
174
-
175
-        // wanna go for a joyride?
176
-        $this->addJavascript(
177
-            EspressoLegacyAdminAssetManager::JS_HANDLE_JQUERY_JOYRIDE,
178
-            EE_THIRD_PARTY_URL . 'joyride/jquery.joyride-2.1.js',
179
-            [
180
-                JqueryAssetManager::JS_HANDLE_JQUERY_COOKIE,
181
-                EspressoLegacyAdminAssetManager::JS_HANDLE_JOYRIDE_MODERNIZR,
182
-            ],
183
-            true,
184
-            '2.1'
185
-        )->setEnqueueImmediately();
186
-
187
-        $this->addJavascript(
188
-            EspressoLegacyAdminAssetManager::JS_HANDLE_EE_HELP_TOUR,
189
-            EE_ADMIN_URL . 'assets/ee-help-tour.js',
190
-            [
191
-                EspressoLegacyAdminAssetManager::JS_HANDLE_JQUERY_JOYRIDE,
192
-            ],
193
-            true,
194
-            '2.1'
195
-        )->setEnqueueImmediately();
196
-    }
197
-
198
-
199
-    /**
200
-     * Register CSS assets.
201
-     *
202
-     * @param bool $joyride
203
-     */
204
-    private function registerStyleSheets($joyride = false)
205
-    {
206
-
207
-        $this->addStylesheet(
208
-            EspressoLegacyAdminAssetManager::CSS_HANDLE_EE_UI_THEME,
209
-            EE_GLOBAL_ASSETS_URL . 'css/espresso-ui-theme/jquery-ui-1.10.3.custom.min.css'
210
-        );
211
-
212
-        $this->addStylesheet(
213
-            EspressoLegacyAdminAssetManager::CSS_HANDLE_EE_TEXT_LINKS,
214
-            EE_PLUGIN_DIR_URL . 'core/helpers/assets/ee_text_list_helper.css'
215
-        );
216
-
217
-        $this->addStylesheet(
218
-            EspressoLegacyAdminAssetManager::CSS_HANDLE_EE_ADMIN,
219
-            EE_ADMIN_URL . 'assets/ee-admin-page.css',
220
-            ['espresso_admin_base']
221
-        )->setEnqueueImmediately();
222
-
223
-        if (! $joyride) {
224
-            return;
225
-        }
226
-        // joyride style
227
-        $this->addStylesheet(
228
-            EspressoLegacyAdminAssetManager::CSS_HANDLE_JOYRIDE,
229
-            EE_THIRD_PARTY_URL . 'joyride/joyride-2.1.css',
230
-            [],
231
-            'all',
232
-            '2.1'
233
-        );
234
-
235
-        $this->addStylesheet(
236
-            EspressoLegacyAdminAssetManager::CSS_HANDLE_EE_JOYRIDE,
237
-            EE_GLOBAL_ASSETS_URL . 'css/ee-joyride-styles.css',
238
-            [EspressoLegacyAdminAssetManager::CSS_HANDLE_JOYRIDE]
239
-        )->setEnqueueImmediately();
240
-    }
241
-
242
-
243
-    /**
244
-     * registers assets for cleaning your ears
245
-     */
246
-    public function loadQtipJs()
247
-    {
248
-        // qtip is turned OFF by default, but prior to the wp_enqueue_scripts hook,
249
-        // can be turned back on again via: add_filter('FHEE_load_qtip', '__return_true' );
250
-        if (apply_filters('FHEE_load_qtip', false)) {
251
-            $qtip_loader = EEH_Qtip_Loader::instance();
252
-            if ($qtip_loader instanceof EEH_Qtip_Loader) {
253
-                $qtip_loader->register_and_enqueue();
254
-            }
255
-        }
256
-    }
44
+	const JS_HANDLE_JQUERY_JOYRIDE          = 'jquery-joyride';
45
+
46
+	const CSS_HANDLE_EE_ADMIN               = 'ee-admin-css';
47
+
48
+	const CSS_HANDLE_EE_JOYRIDE             = 'ee-joyride-css';
49
+
50
+	const CSS_HANDLE_EE_TEXT_LINKS          = 'ee-text-links';
51
+
52
+	const CSS_HANDLE_EE_UI_THEME            = 'espresso-ui-theme';
53
+
54
+	const CSS_HANDLE_JOYRIDE                = 'joyride-css';
55
+
56
+
57
+	/**
58
+	 * @inheritDoc
59
+	 */
60
+	public function addAssets()
61
+	{
62
+		$joyride = filter_var(apply_filters('FHEE_load_joyride', false), FILTER_VALIDATE_BOOLEAN);
63
+		$this->registerJavascript($joyride);
64
+		$this->registerStyleSheets($joyride);
65
+	}
66
+
67
+
68
+	/**
69
+	 * Register javascript assets
70
+	 *
71
+	 * @param bool $joyride
72
+	 */
73
+	private function registerJavascript($joyride = false)
74
+	{
75
+		$this->addJavascript(
76
+			EspressoLegacyAdminAssetManager::JS_HANDLE_EE_DIALOG,
77
+			EE_ADMIN_URL . 'assets/ee-dialog-helper.js',
78
+			[
79
+				JqueryAssetManager::JS_HANDLE_JQUERY,
80
+				JqueryAssetManager::JS_HANDLE_JQUERY_UI_DRAGGABLE,
81
+			]
82
+		);
83
+		$this->addJavascript(
84
+			EspressoLegacyAdminAssetManager::JS_HANDLE_EE_ADMIN,
85
+			EE_ADMIN_URL . 'assets/ee-admin-page.js',
86
+			[
87
+				CoreAssetManager::JS_HANDLE_CORE,
88
+				EspressoLegacyAdminAssetManager::JS_HANDLE_PARSE_URI,
89
+				EspressoLegacyAdminAssetManager::JS_HANDLE_EE_DIALOG,
90
+			]
91
+		);
92
+
93
+		// script for sorting tables
94
+		$this->addJavascript(
95
+			EspressoLegacyAdminAssetManager::JS_HANDLE_EE_AJAX_TABLE_SORTING,
96
+			EE_ADMIN_URL . 'assets/espresso_ajax_table_sorting.js',
97
+			[
98
+				EspressoLegacyAdminAssetManager::JS_HANDLE_EE_ADMIN,
99
+				JqueryAssetManager::JS_HANDLE_JQUERY_UI_SORTABLE,
100
+			]
101
+		);
102
+
103
+		// script for parsing uri's
104
+		$this->addJavascript(
105
+			EspressoLegacyAdminAssetManager::JS_HANDLE_PARSE_URI,
106
+			EE_GLOBAL_ASSETS_URL . 'scripts/parseuri.js'
107
+		);
108
+
109
+		// and parsing associative serialized form elements
110
+		$this->addJavascript(
111
+			EspressoLegacyAdminAssetManager::JS_HANDLE_EE_SERIALIZE_FULL_ARRAY,
112
+			EE_GLOBAL_ASSETS_URL . 'scripts/jquery.serializefullarray.js',
113
+			[JqueryAssetManager::JS_HANDLE_JQUERY]
114
+
115
+		);
116
+
117
+		// helpers scripts
118
+		$this->addJavascript(
119
+			EspressoLegacyAdminAssetManager::JS_HANDLE_EE_TEXT_LINKS,
120
+			EE_PLUGIN_DIR_URL . 'core/helpers/assets/ee_text_list_helper.js',
121
+			[JqueryAssetManager::JS_HANDLE_JQUERY]
122
+		);
123
+
124
+		$this->addJavascript(
125
+			EspressoLegacyAdminAssetManager::JS_HANDLE_MOMENT_CORE,
126
+			EE_THIRD_PARTY_URL . 'moment/moment-with-locales.min.js'
127
+		);
128
+
129
+		$this->addJavascript(
130
+			EspressoLegacyAdminAssetManager::JS_HANDLE_MOMENT,
131
+			EE_THIRD_PARTY_URL . 'moment/moment-timezone-with-data.min.js',
132
+			[EspressoLegacyAdminAssetManager::JS_HANDLE_MOMENT_CORE]
133
+		);
134
+
135
+		$this->addJavascript(
136
+			EspressoLegacyAdminAssetManager::JS_HANDLE_EE_DATEPICKER,
137
+			EE_ADMIN_URL . 'assets/ee-datepicker.js',
138
+			[
139
+				JqueryAssetManager::JS_HANDLE_JQUERY_UI_TIMEPICKER_ADDON,
140
+				EspressoLegacyAdminAssetManager::JS_HANDLE_MOMENT,
141
+			]
142
+		);
143
+
144
+		// google charts
145
+		$this->addJavascript(
146
+			EspressoLegacyAdminAssetManager::JS_HANDLE_GOOGLE_CHARTS,
147
+			'https://www.gstatic.com/charts/loader.js'
148
+		);
149
+
150
+		// this javascript is loaded on every admin page to catch any injections ee needs to add to wp run js.
151
+		// Note: the intention of this script is to only do TARGETED injections.
152
+		//ie: only injecting on certain script calls.
153
+		$this->addJavascript(
154
+			EspressoLegacyAdminAssetManager::JS_HANDLE_EE_INJECT_WP,
155
+			EE_ADMIN_URL . 'assets/ee-cpt-wp-injects.js',
156
+			[JqueryAssetManager::JS_HANDLE_JQUERY]
157
+		);
158
+
159
+		$this->loadQtipJs();
160
+
161
+		// joyride is turned OFF by default, but prior to the admin_enqueue_scripts hook,
162
+		// can be turned back on again via: add_filter('FHEE_load_joyride', '__return_true' );
163
+		if (! $joyride) {
164
+			return;
165
+		}
166
+
167
+		$this->addJavascript(
168
+			EspressoLegacyAdminAssetManager::JS_HANDLE_JOYRIDE_MODERNIZR,
169
+			EE_THIRD_PARTY_URL . 'joyride/modernizr.mq.js',
170
+			[],
171
+			true,
172
+			'2.1'
173
+		);
174
+
175
+		// wanna go for a joyride?
176
+		$this->addJavascript(
177
+			EspressoLegacyAdminAssetManager::JS_HANDLE_JQUERY_JOYRIDE,
178
+			EE_THIRD_PARTY_URL . 'joyride/jquery.joyride-2.1.js',
179
+			[
180
+				JqueryAssetManager::JS_HANDLE_JQUERY_COOKIE,
181
+				EspressoLegacyAdminAssetManager::JS_HANDLE_JOYRIDE_MODERNIZR,
182
+			],
183
+			true,
184
+			'2.1'
185
+		)->setEnqueueImmediately();
186
+
187
+		$this->addJavascript(
188
+			EspressoLegacyAdminAssetManager::JS_HANDLE_EE_HELP_TOUR,
189
+			EE_ADMIN_URL . 'assets/ee-help-tour.js',
190
+			[
191
+				EspressoLegacyAdminAssetManager::JS_HANDLE_JQUERY_JOYRIDE,
192
+			],
193
+			true,
194
+			'2.1'
195
+		)->setEnqueueImmediately();
196
+	}
197
+
198
+
199
+	/**
200
+	 * Register CSS assets.
201
+	 *
202
+	 * @param bool $joyride
203
+	 */
204
+	private function registerStyleSheets($joyride = false)
205
+	{
206
+
207
+		$this->addStylesheet(
208
+			EspressoLegacyAdminAssetManager::CSS_HANDLE_EE_UI_THEME,
209
+			EE_GLOBAL_ASSETS_URL . 'css/espresso-ui-theme/jquery-ui-1.10.3.custom.min.css'
210
+		);
211
+
212
+		$this->addStylesheet(
213
+			EspressoLegacyAdminAssetManager::CSS_HANDLE_EE_TEXT_LINKS,
214
+			EE_PLUGIN_DIR_URL . 'core/helpers/assets/ee_text_list_helper.css'
215
+		);
216
+
217
+		$this->addStylesheet(
218
+			EspressoLegacyAdminAssetManager::CSS_HANDLE_EE_ADMIN,
219
+			EE_ADMIN_URL . 'assets/ee-admin-page.css',
220
+			['espresso_admin_base']
221
+		)->setEnqueueImmediately();
222
+
223
+		if (! $joyride) {
224
+			return;
225
+		}
226
+		// joyride style
227
+		$this->addStylesheet(
228
+			EspressoLegacyAdminAssetManager::CSS_HANDLE_JOYRIDE,
229
+			EE_THIRD_PARTY_URL . 'joyride/joyride-2.1.css',
230
+			[],
231
+			'all',
232
+			'2.1'
233
+		);
234
+
235
+		$this->addStylesheet(
236
+			EspressoLegacyAdminAssetManager::CSS_HANDLE_EE_JOYRIDE,
237
+			EE_GLOBAL_ASSETS_URL . 'css/ee-joyride-styles.css',
238
+			[EspressoLegacyAdminAssetManager::CSS_HANDLE_JOYRIDE]
239
+		)->setEnqueueImmediately();
240
+	}
241
+
242
+
243
+	/**
244
+	 * registers assets for cleaning your ears
245
+	 */
246
+	public function loadQtipJs()
247
+	{
248
+		// qtip is turned OFF by default, but prior to the wp_enqueue_scripts hook,
249
+		// can be turned back on again via: add_filter('FHEE_load_qtip', '__return_true' );
250
+		if (apply_filters('FHEE_load_qtip', false)) {
251
+			$qtip_loader = EEH_Qtip_Loader::instance();
252
+			if ($qtip_loader instanceof EEH_Qtip_Loader) {
253
+				$qtip_loader->register_and_enqueue();
254
+			}
255
+		}
256
+	}
257 257
 }
Please login to merge, or discard this patch.
Spacing   +20 added lines, -20 removed lines patch added patch discarded remove patch
@@ -74,7 +74,7 @@  discard block
 block discarded – undo
74 74
     {
75 75
         $this->addJavascript(
76 76
             EspressoLegacyAdminAssetManager::JS_HANDLE_EE_DIALOG,
77
-            EE_ADMIN_URL . 'assets/ee-dialog-helper.js',
77
+            EE_ADMIN_URL.'assets/ee-dialog-helper.js',
78 78
             [
79 79
                 JqueryAssetManager::JS_HANDLE_JQUERY,
80 80
                 JqueryAssetManager::JS_HANDLE_JQUERY_UI_DRAGGABLE,
@@ -82,7 +82,7 @@  discard block
 block discarded – undo
82 82
         );
83 83
         $this->addJavascript(
84 84
             EspressoLegacyAdminAssetManager::JS_HANDLE_EE_ADMIN,
85
-            EE_ADMIN_URL . 'assets/ee-admin-page.js',
85
+            EE_ADMIN_URL.'assets/ee-admin-page.js',
86 86
             [
87 87
                 CoreAssetManager::JS_HANDLE_CORE,
88 88
                 EspressoLegacyAdminAssetManager::JS_HANDLE_PARSE_URI,
@@ -93,7 +93,7 @@  discard block
 block discarded – undo
93 93
         // script for sorting tables
94 94
         $this->addJavascript(
95 95
             EspressoLegacyAdminAssetManager::JS_HANDLE_EE_AJAX_TABLE_SORTING,
96
-            EE_ADMIN_URL . 'assets/espresso_ajax_table_sorting.js',
96
+            EE_ADMIN_URL.'assets/espresso_ajax_table_sorting.js',
97 97
             [
98 98
                 EspressoLegacyAdminAssetManager::JS_HANDLE_EE_ADMIN,
99 99
                 JqueryAssetManager::JS_HANDLE_JQUERY_UI_SORTABLE,
@@ -103,13 +103,13 @@  discard block
 block discarded – undo
103 103
         // script for parsing uri's
104 104
         $this->addJavascript(
105 105
             EspressoLegacyAdminAssetManager::JS_HANDLE_PARSE_URI,
106
-            EE_GLOBAL_ASSETS_URL . 'scripts/parseuri.js'
106
+            EE_GLOBAL_ASSETS_URL.'scripts/parseuri.js'
107 107
         );
108 108
 
109 109
         // and parsing associative serialized form elements
110 110
         $this->addJavascript(
111 111
             EspressoLegacyAdminAssetManager::JS_HANDLE_EE_SERIALIZE_FULL_ARRAY,
112
-            EE_GLOBAL_ASSETS_URL . 'scripts/jquery.serializefullarray.js',
112
+            EE_GLOBAL_ASSETS_URL.'scripts/jquery.serializefullarray.js',
113 113
             [JqueryAssetManager::JS_HANDLE_JQUERY]
114 114
 
115 115
         );
@@ -117,24 +117,24 @@  discard block
 block discarded – undo
117 117
         // helpers scripts
118 118
         $this->addJavascript(
119 119
             EspressoLegacyAdminAssetManager::JS_HANDLE_EE_TEXT_LINKS,
120
-            EE_PLUGIN_DIR_URL . 'core/helpers/assets/ee_text_list_helper.js',
120
+            EE_PLUGIN_DIR_URL.'core/helpers/assets/ee_text_list_helper.js',
121 121
             [JqueryAssetManager::JS_HANDLE_JQUERY]
122 122
         );
123 123
 
124 124
         $this->addJavascript(
125 125
             EspressoLegacyAdminAssetManager::JS_HANDLE_MOMENT_CORE,
126
-            EE_THIRD_PARTY_URL . 'moment/moment-with-locales.min.js'
126
+            EE_THIRD_PARTY_URL.'moment/moment-with-locales.min.js'
127 127
         );
128 128
 
129 129
         $this->addJavascript(
130 130
             EspressoLegacyAdminAssetManager::JS_HANDLE_MOMENT,
131
-            EE_THIRD_PARTY_URL . 'moment/moment-timezone-with-data.min.js',
131
+            EE_THIRD_PARTY_URL.'moment/moment-timezone-with-data.min.js',
132 132
             [EspressoLegacyAdminAssetManager::JS_HANDLE_MOMENT_CORE]
133 133
         );
134 134
 
135 135
         $this->addJavascript(
136 136
             EspressoLegacyAdminAssetManager::JS_HANDLE_EE_DATEPICKER,
137
-            EE_ADMIN_URL . 'assets/ee-datepicker.js',
137
+            EE_ADMIN_URL.'assets/ee-datepicker.js',
138 138
             [
139 139
                 JqueryAssetManager::JS_HANDLE_JQUERY_UI_TIMEPICKER_ADDON,
140 140
                 EspressoLegacyAdminAssetManager::JS_HANDLE_MOMENT,
@@ -152,7 +152,7 @@  discard block
 block discarded – undo
152 152
         //ie: only injecting on certain script calls.
153 153
         $this->addJavascript(
154 154
             EspressoLegacyAdminAssetManager::JS_HANDLE_EE_INJECT_WP,
155
-            EE_ADMIN_URL . 'assets/ee-cpt-wp-injects.js',
155
+            EE_ADMIN_URL.'assets/ee-cpt-wp-injects.js',
156 156
             [JqueryAssetManager::JS_HANDLE_JQUERY]
157 157
         );
158 158
 
@@ -160,13 +160,13 @@  discard block
 block discarded – undo
160 160
 
161 161
         // joyride is turned OFF by default, but prior to the admin_enqueue_scripts hook,
162 162
         // can be turned back on again via: add_filter('FHEE_load_joyride', '__return_true' );
163
-        if (! $joyride) {
163
+        if ( ! $joyride) {
164 164
             return;
165 165
         }
166 166
 
167 167
         $this->addJavascript(
168 168
             EspressoLegacyAdminAssetManager::JS_HANDLE_JOYRIDE_MODERNIZR,
169
-            EE_THIRD_PARTY_URL . 'joyride/modernizr.mq.js',
169
+            EE_THIRD_PARTY_URL.'joyride/modernizr.mq.js',
170 170
             [],
171 171
             true,
172 172
             '2.1'
@@ -175,7 +175,7 @@  discard block
 block discarded – undo
175 175
         // wanna go for a joyride?
176 176
         $this->addJavascript(
177 177
             EspressoLegacyAdminAssetManager::JS_HANDLE_JQUERY_JOYRIDE,
178
-            EE_THIRD_PARTY_URL . 'joyride/jquery.joyride-2.1.js',
178
+            EE_THIRD_PARTY_URL.'joyride/jquery.joyride-2.1.js',
179 179
             [
180 180
                 JqueryAssetManager::JS_HANDLE_JQUERY_COOKIE,
181 181
                 EspressoLegacyAdminAssetManager::JS_HANDLE_JOYRIDE_MODERNIZR,
@@ -186,7 +186,7 @@  discard block
 block discarded – undo
186 186
 
187 187
         $this->addJavascript(
188 188
             EspressoLegacyAdminAssetManager::JS_HANDLE_EE_HELP_TOUR,
189
-            EE_ADMIN_URL . 'assets/ee-help-tour.js',
189
+            EE_ADMIN_URL.'assets/ee-help-tour.js',
190 190
             [
191 191
                 EspressoLegacyAdminAssetManager::JS_HANDLE_JQUERY_JOYRIDE,
192 192
             ],
@@ -206,27 +206,27 @@  discard block
 block discarded – undo
206 206
 
207 207
         $this->addStylesheet(
208 208
             EspressoLegacyAdminAssetManager::CSS_HANDLE_EE_UI_THEME,
209
-            EE_GLOBAL_ASSETS_URL . 'css/espresso-ui-theme/jquery-ui-1.10.3.custom.min.css'
209
+            EE_GLOBAL_ASSETS_URL.'css/espresso-ui-theme/jquery-ui-1.10.3.custom.min.css'
210 210
         );
211 211
 
212 212
         $this->addStylesheet(
213 213
             EspressoLegacyAdminAssetManager::CSS_HANDLE_EE_TEXT_LINKS,
214
-            EE_PLUGIN_DIR_URL . 'core/helpers/assets/ee_text_list_helper.css'
214
+            EE_PLUGIN_DIR_URL.'core/helpers/assets/ee_text_list_helper.css'
215 215
         );
216 216
 
217 217
         $this->addStylesheet(
218 218
             EspressoLegacyAdminAssetManager::CSS_HANDLE_EE_ADMIN,
219
-            EE_ADMIN_URL . 'assets/ee-admin-page.css',
219
+            EE_ADMIN_URL.'assets/ee-admin-page.css',
220 220
             ['espresso_admin_base']
221 221
         )->setEnqueueImmediately();
222 222
 
223
-        if (! $joyride) {
223
+        if ( ! $joyride) {
224 224
             return;
225 225
         }
226 226
         // joyride style
227 227
         $this->addStylesheet(
228 228
             EspressoLegacyAdminAssetManager::CSS_HANDLE_JOYRIDE,
229
-            EE_THIRD_PARTY_URL . 'joyride/joyride-2.1.css',
229
+            EE_THIRD_PARTY_URL.'joyride/joyride-2.1.css',
230 230
             [],
231 231
             'all',
232 232
             '2.1'
@@ -234,7 +234,7 @@  discard block
 block discarded – undo
234 234
 
235 235
         $this->addStylesheet(
236 236
             EspressoLegacyAdminAssetManager::CSS_HANDLE_EE_JOYRIDE,
237
-            EE_GLOBAL_ASSETS_URL . 'css/ee-joyride-styles.css',
237
+            EE_GLOBAL_ASSETS_URL.'css/ee-joyride-styles.css',
238 238
             [EspressoLegacyAdminAssetManager::CSS_HANDLE_JOYRIDE]
239 239
         )->setEnqueueImmediately();
240 240
     }
Please login to merge, or discard this patch.
core/domain/entities/routing/handlers/admin/WordPressProfilePage.php 1 patch
Indentation   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -15,24 +15,24 @@
 block discarded – undo
15 15
  */
16 16
 class WordPressProfilePage extends AdminRoute
17 17
 {
18
-    /**
19
-     * @return CapCheckInterface
20
-     */
21
-    public function getCapCheck()
22
-    {
23
-        return new CapCheck('read', 'access WordPress profile route');
24
-    }
18
+	/**
19
+	 * @return CapCheckInterface
20
+	 */
21
+	public function getCapCheck()
22
+	{
23
+		return new CapCheck('read', 'access WordPress profile route');
24
+	}
25 25
 
26 26
 
27
-    /**
28
-     * returns true if the current request matches this route
29
-     *
30
-     * @return bool
31
-     * @since   5.0.0.p
32
-     */
33
-    public function matchesCurrentRequest(): bool
34
-    {
35
-        global $pagenow;
36
-        return $pagenow === 'profile.php' && ($this->request->isAdmin() || $this->request->isAdminAjax());
37
-    }
27
+	/**
28
+	 * returns true if the current request matches this route
29
+	 *
30
+	 * @return bool
31
+	 * @since   5.0.0.p
32
+	 */
33
+	public function matchesCurrentRequest(): bool
34
+	{
35
+		global $pagenow;
36
+		return $pagenow === 'profile.php' && ($this->request->isAdmin() || $this->request->isAdminAjax());
37
+	}
38 38
 }
Please login to merge, or discard this patch.
core/domain/entities/routing/handlers/admin/AdminRoute.php 1 patch
Indentation   +93 added lines, -93 removed lines patch added patch discarded remove patch
@@ -27,97 +27,97 @@
 block discarded – undo
27 27
  */
28 28
 class AdminRoute extends Route
29 29
 {
30
-    protected EE_Admin_Config $admin_config;
31
-
32
-    /**
33
-     * @var array $default_dependencies
34
-     */
35
-    protected static $default_dependencies = [
36
-        'EE_Admin_Config'                             => EE_Dependency_Map::load_from_cache,
37
-        'EE_Dependency_Map'                           => EE_Dependency_Map::load_from_cache,
38
-        'EventEspresso\core\services\loaders\Loader'  => EE_Dependency_Map::load_from_cache,
39
-        'EventEspresso\core\services\request\Request' => EE_Dependency_Map::load_from_cache,
40
-    ];
41
-
42
-
43
-    /**
44
-     * Route constructor.
45
-     *
46
-     * @param EE_Admin_Config                       $admin_config
47
-     * @param EE_Dependency_Map                     $dependency_map
48
-     * @param LoaderInterface                       $loader
49
-     * @param RequestInterface                      $request
50
-     * @param JsonDataNode|null                     $data_node
51
-     * @param RouteMatchSpecificationInterface|null $specification
52
-     */
53
-    public function __construct(
54
-        EE_Admin_Config $admin_config,
55
-        EE_Dependency_Map $dependency_map,
56
-        LoaderInterface $loader,
57
-        RequestInterface $request,
58
-        JsonDataNode $data_node = null,
59
-        RouteMatchSpecificationInterface $specification = null
60
-    ) {
61
-        $this->admin_config = $admin_config;
62
-        parent::__construct($dependency_map, $loader, $request, $data_node, $specification);
63
-    }
64
-
65
-
66
-    /**
67
-     * @return CapCheckInterface
68
-     */
69
-    public function getCapCheck()
70
-    {
71
-        return new CapCheck('edit_posts', 'access Event Espresso admin route');
72
-    }
73
-
74
-
75
-    /**
76
-     * @return array
77
-     */
78
-    public static function getDefaultDependencies(): array
79
-    {
80
-        return self::$default_dependencies;
81
-    }
82
-
83
-
84
-    /**
85
-     * returns true if the current request matches this route
86
-     *
87
-     * @return bool
88
-     */
89
-    public function matchesCurrentRequest(): bool
90
-    {
91
-        return $this->request->isAdmin() || $this->request->isAdminAjax() || $this->request->isActivation();
92
-    }
93
-
94
-
95
-    /**
96
-     * @return void
97
-     */
98
-    protected function registerDependencies()
99
-    {
100
-    }
101
-
102
-
103
-    /**
104
-     * implements logic required to run during request
105
-     *
106
-     * @return bool
107
-     */
108
-    protected function requestHandler(): bool
109
-    {
110
-        // don't handle request more than once!!!
111
-        if (did_action('AHEE__EE_System__load_controllers__load_admin_controllers')) {
112
-            return true;
113
-        }
114
-        do_action('AHEE__EE_System__load_controllers__load_admin_controllers');
115
-        $this->loader->getShared('EE_Admin');
116
-        do_action(
117
-            'AHEE__EventEspresso_core_domain_entities_routing_handlers_admin_AdminRoute__requestHandler__admin_loaded'
118
-        );
119
-
120
-        AdminFontSize::setAdminFontSizeBodyClass();
121
-        return true;
122
-    }
30
+	protected EE_Admin_Config $admin_config;
31
+
32
+	/**
33
+	 * @var array $default_dependencies
34
+	 */
35
+	protected static $default_dependencies = [
36
+		'EE_Admin_Config'                             => EE_Dependency_Map::load_from_cache,
37
+		'EE_Dependency_Map'                           => EE_Dependency_Map::load_from_cache,
38
+		'EventEspresso\core\services\loaders\Loader'  => EE_Dependency_Map::load_from_cache,
39
+		'EventEspresso\core\services\request\Request' => EE_Dependency_Map::load_from_cache,
40
+	];
41
+
42
+
43
+	/**
44
+	 * Route constructor.
45
+	 *
46
+	 * @param EE_Admin_Config                       $admin_config
47
+	 * @param EE_Dependency_Map                     $dependency_map
48
+	 * @param LoaderInterface                       $loader
49
+	 * @param RequestInterface                      $request
50
+	 * @param JsonDataNode|null                     $data_node
51
+	 * @param RouteMatchSpecificationInterface|null $specification
52
+	 */
53
+	public function __construct(
54
+		EE_Admin_Config $admin_config,
55
+		EE_Dependency_Map $dependency_map,
56
+		LoaderInterface $loader,
57
+		RequestInterface $request,
58
+		JsonDataNode $data_node = null,
59
+		RouteMatchSpecificationInterface $specification = null
60
+	) {
61
+		$this->admin_config = $admin_config;
62
+		parent::__construct($dependency_map, $loader, $request, $data_node, $specification);
63
+	}
64
+
65
+
66
+	/**
67
+	 * @return CapCheckInterface
68
+	 */
69
+	public function getCapCheck()
70
+	{
71
+		return new CapCheck('edit_posts', 'access Event Espresso admin route');
72
+	}
73
+
74
+
75
+	/**
76
+	 * @return array
77
+	 */
78
+	public static function getDefaultDependencies(): array
79
+	{
80
+		return self::$default_dependencies;
81
+	}
82
+
83
+
84
+	/**
85
+	 * returns true if the current request matches this route
86
+	 *
87
+	 * @return bool
88
+	 */
89
+	public function matchesCurrentRequest(): bool
90
+	{
91
+		return $this->request->isAdmin() || $this->request->isAdminAjax() || $this->request->isActivation();
92
+	}
93
+
94
+
95
+	/**
96
+	 * @return void
97
+	 */
98
+	protected function registerDependencies()
99
+	{
100
+	}
101
+
102
+
103
+	/**
104
+	 * implements logic required to run during request
105
+	 *
106
+	 * @return bool
107
+	 */
108
+	protected function requestHandler(): bool
109
+	{
110
+		// don't handle request more than once!!!
111
+		if (did_action('AHEE__EE_System__load_controllers__load_admin_controllers')) {
112
+			return true;
113
+		}
114
+		do_action('AHEE__EE_System__load_controllers__load_admin_controllers');
115
+		$this->loader->getShared('EE_Admin');
116
+		do_action(
117
+			'AHEE__EventEspresso_core_domain_entities_routing_handlers_admin_AdminRoute__requestHandler__admin_loaded'
118
+		);
119
+
120
+		AdminFontSize::setAdminFontSizeBodyClass();
121
+		return true;
122
+	}
123 123
 }
Please login to merge, or discard this patch.