Completed
Branch fix-dummy-related-question-qst... (e5efcf)
by
unknown
07:49 queued 03:45
created
core/domain/services/admin/AdminToolBar.php 2 patches
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -120,7 +120,7 @@  discard block
 block discarded – undo
120 120
     {
121 121
         wp_register_style(
122 122
             'espresso-admin-toolbar',
123
-            EE_GLOBAL_ASSETS_URL . 'css/espresso-admin-toolbar.css',
123
+            EE_GLOBAL_ASSETS_URL.'css/espresso-admin-toolbar.css',
124 124
             array('dashicons'),
125 125
             EVENT_ESPRESSO_VERSION
126 126
         );
@@ -143,7 +143,7 @@  discard block
 block discarded – undo
143 143
                 'href'  => $this->events_admin_url,
144 144
                 'meta'  => array(
145 145
                     'title' => esc_html__('Event Espresso', 'event_espresso'),
146
-                    'class' => $this->menu_class . 'first',
146
+                    'class' => $this->menu_class.'first',
147 147
                 ),
148 148
             )
149 149
         );
@@ -491,7 +491,7 @@  discard block
 block discarded – undo
491 491
                     'meta'   => array(
492 492
                         'title'  => esc_html__('Approved', 'event_espresso'),
493 493
                         'target' => '',
494
-                        'class'  => $this->menu_class . ' ee-toolbar-icon-approved',
494
+                        'class'  => $this->menu_class.' ee-toolbar-icon-approved',
495 495
                     ),
496 496
                 )
497 497
             );
@@ -528,7 +528,7 @@  discard block
 block discarded – undo
528 528
                     'meta'   => array(
529 529
                         'title'  => esc_html__('Pending Payment', 'event_espresso'),
530 530
                         'target' => '',
531
-                        'class'  => $this->menu_class . ' ee-toolbar-icon-pending',
531
+                        'class'  => $this->menu_class.' ee-toolbar-icon-pending',
532 532
                     ),
533 533
                 )
534 534
             );
@@ -565,7 +565,7 @@  discard block
 block discarded – undo
565 565
                     'meta'   => array(
566 566
                         'title'  => esc_html__('Not Approved', 'event_espresso'),
567 567
                         'target' => '',
568
-                        'class'  => $this->menu_class . ' ee-toolbar-icon-not-approved',
568
+                        'class'  => $this->menu_class.' ee-toolbar-icon-not-approved',
569 569
                     ),
570 570
                 )
571 571
             );
@@ -602,7 +602,7 @@  discard block
 block discarded – undo
602 602
                     'meta'   => array(
603 603
                         'title'  => esc_html__('Cancelled', 'event_espresso'),
604 604
                         'target' => '',
605
-                        'class'  => $this->menu_class . ' ee-toolbar-icon-cancelled',
605
+                        'class'  => $this->menu_class.' ee-toolbar-icon-cancelled',
606 606
                     ),
607 607
                 )
608 608
             );
@@ -674,7 +674,7 @@  discard block
 block discarded – undo
674 674
                     'meta'   => array(
675 675
                         'title'  => esc_html__('Approved', 'event_espresso'),
676 676
                         'target' => '',
677
-                        'class'  => $this->menu_class . ' ee-toolbar-icon-approved',
677
+                        'class'  => $this->menu_class.' ee-toolbar-icon-approved',
678 678
                     ),
679 679
                 )
680 680
             );
@@ -711,7 +711,7 @@  discard block
 block discarded – undo
711 711
                     'meta'   => array(
712 712
                         'title'  => esc_html__('Pending', 'event_espresso'),
713 713
                         'target' => '',
714
-                        'class'  => $this->menu_class . ' ee-toolbar-icon-pending',
714
+                        'class'  => $this->menu_class.' ee-toolbar-icon-pending',
715 715
                     ),
716 716
                 )
717 717
             );
@@ -748,7 +748,7 @@  discard block
 block discarded – undo
748 748
                     'meta'   => array(
749 749
                         'title'  => esc_html__('Not Approved', 'event_espresso'),
750 750
                         'target' => '',
751
-                        'class'  => $this->menu_class . ' ee-toolbar-icon-not-approved',
751
+                        'class'  => $this->menu_class.' ee-toolbar-icon-not-approved',
752 752
                     ),
753 753
                 )
754 754
             );
@@ -785,7 +785,7 @@  discard block
 block discarded – undo
785 785
                     'meta'   => array(
786 786
                         'title'  => esc_html__('Cancelled', 'event_espresso'),
787 787
                         'target' => '',
788
-                        'class'  => $this->menu_class . ' ee-toolbar-icon-cancelled',
788
+                        'class'  => $this->menu_class.' ee-toolbar-icon-cancelled',
789 789
                     ),
790 790
                 )
791 791
             );
Please login to merge, or discard this patch.
Indentation   +776 added lines, -776 removed lines patch added patch discarded remove patch
@@ -18,780 +18,780 @@
 block discarded – undo
18 18
  */
19 19
 class AdminToolBar
20 20
 {
21
-    /**
22
-     * @var WP_Admin_Bar $admin_bar
23
-     */
24
-    private $admin_bar;
25
-
26
-    /**
27
-     * @var EE_Capabilities $capabilities
28
-     */
29
-    private $capabilities;
30
-
31
-    /**
32
-     * @var string $events_admin_url
33
-     */
34
-    private $events_admin_url;
35
-
36
-    /**
37
-     * @var string $menu_class
38
-     */
39
-    private $menu_class = 'espresso_menu_item_class';
40
-
41
-    /**
42
-     * @var string $reg_admin_url
43
-     */
44
-    private $reg_admin_url;
45
-
46
-
47
-    /**
48
-     * AdminToolBar constructor.
49
-     *
50
-     * @param EE_Capabilities $capabilities
51
-     */
52
-    public function __construct(EE_Capabilities $capabilities)
53
-    {
54
-        $this->capabilities = $capabilities;
55
-        add_action('admin_bar_menu', array($this, 'espressoToolbarItems'), 100);
56
-        $this->enqueueAssets();
57
-    }
58
-
59
-
60
-    /**
61
-     *    espresso_toolbar_items
62
-     *
63
-     * @access public
64
-     * @param  WP_Admin_Bar $admin_bar
65
-     * @return void
66
-     */
67
-    public function espressoToolbarItems(WP_Admin_Bar $admin_bar)
68
-    {
69
-        // if its an AJAX request, or user is NOT an admin, or in full M-Mode
70
-        if (
71
-            defined('DOING_AJAX')
72
-            || ! $this->capabilities->current_user_can('ee_read_ee', 'ee_admin_bar_menu_top_level')
73
-            || EE_Maintenance_Mode::instance()->level() === EE_Maintenance_Mode::level_2_complete_maintenance
74
-        ) {
75
-            return;
76
-        }
77
-        do_action('AHEE_log', __FILE__, __FUNCTION__, '');
78
-        $this->admin_bar = $admin_bar;
79
-        // we don't use the constants EVENTS_ADMIN_URL or REG_ADMIN_URL
80
-        // because they're only defined in each of their respective constructors
81
-        // and this might be a frontend request, in which case they aren't available
82
-        $this->events_admin_url = admin_url('admin.php?page=espresso_events');
83
-        $this->reg_admin_url = admin_url('admin.php?page=espresso_registrations');
84
-        // now let's add all of the menu items
85
-        $this->addTopLevelMenu();
86
-        $this->addEventsSubMenu();
87
-        $this->addEventsAddEditHeader();
88
-        $this->addEventsAddNew();
89
-        $this->addEventsEditCurrentEvent();
90
-        $this->addEventsViewHeader();
91
-        $this->addEventsViewAll();
92
-        $this->addEventsViewToday();
93
-        $this->addEventsViewThisMonth();
94
-        $this->addRegistrationSubMenu();
95
-        $this->addRegistrationOverviewToday();
96
-        $this->addRegistrationOverviewTodayApproved();
97
-        $this->addRegistrationOverviewTodayPendingPayment();
98
-        $this->addRegistrationOverviewTodayNotApproved();
99
-        $this->addRegistrationOverviewTodayCancelled();
100
-        $this->addRegistrationOverviewThisMonth();
101
-        $this->addRegistrationOverviewThisMonthApproved();
102
-        $this->addRegistrationOverviewThisMonthPending();
103
-        $this->addRegistrationOverviewThisMonthNotApproved();
104
-        $this->addRegistrationOverviewThisMonthCancelled();
105
-        $this->addExtensionsAndServices();
106
-    }
107
-
108
-
109
-    /**
110
-     * @return void
111
-     */
112
-    private function enqueueAssets()
113
-    {
114
-        wp_register_style(
115
-            'espresso-admin-toolbar',
116
-            EE_GLOBAL_ASSETS_URL . 'css/espresso-admin-toolbar.css',
117
-            array('dashicons'),
118
-            EVENT_ESPRESSO_VERSION
119
-        );
120
-        wp_enqueue_style('espresso-admin-toolbar');
121
-    }
122
-
123
-
124
-    /**
125
-     * @return void
126
-     */
127
-    private function addTopLevelMenu()
128
-    {
129
-        $this->admin_bar->add_menu(
130
-            array(
131
-                'id'    => 'espresso-toolbar',
132
-                'title' => '<span class="ee-icon ee-icon-ee-cup-thick ee-icon-size-20"></span><span class="ab-label">'
133
-                           . esc_html_x('Event Espresso', 'admin bar menu group label', 'event_espresso')
134
-                           . '</span>',
135
-                'href'  => $this->events_admin_url,
136
-                'meta'  => array(
137
-                    'title' => esc_html__('Event Espresso', 'event_espresso'),
138
-                    'class' => $this->menu_class . 'first',
139
-                ),
140
-            )
141
-        );
142
-    }
143
-
144
-
145
-    /**
146
-     * @return void
147
-     */
148
-    private function addEventsSubMenu()
149
-    {
150
-        if (
151
-            $this->capabilities->current_user_can(
152
-                'ee_read_events',
153
-                'ee_admin_bar_menu_espresso-toolbar-events'
154
-            )
155
-        ) {
156
-            $this->admin_bar->add_menu(
157
-                array(
158
-                    'id'     => 'espresso-toolbar-events',
159
-                    'parent' => 'espresso-toolbar',
160
-                    'title'  => '<span class="ee-toolbar-icon"></span>'
161
-                                . esc_html__('Events', 'event_espresso'),
162
-                    'href'   => $this->events_admin_url,
163
-                    'meta'   => array(
164
-                        'title'  => esc_html__('Events', 'event_espresso'),
165
-                        'target' => '',
166
-                        'class'  => $this->menu_class,
167
-                    ),
168
-                )
169
-            );
170
-        }
171
-    }
172
-
173
-
174
-    /**
175
-     * @return void
176
-     */
177
-    private function addEventsAddEditHeader()
178
-    {
179
-        if (
180
-            $this->capabilities->current_user_can(
181
-                'ee_read_events',
182
-                'ee_admin_bar_menu_espresso-toolbar-events-view'
183
-            )
184
-        ) {
185
-            $this->admin_bar->add_menu(
186
-                array(
187
-                    'id'     => 'espresso-toolbar-events-add-edit',
188
-                    'parent' => 'espresso-toolbar-events',
189
-                    'title'  => esc_html__('Add / Edit', 'event_espresso'),
190
-                    'href'   => '',
191
-                )
192
-            );
193
-        }
194
-    }
195
-
196
-
197
-    /**
198
-     * @return void
199
-     */
200
-    private function addEventsAddNew()
201
-    {
202
-        if (
203
-            $this->capabilities->current_user_can(
204
-                'ee_edit_events',
205
-                'ee_admin_bar_menu_espresso-toolbar-events-new'
206
-            )
207
-        ) {
208
-            $this->admin_bar->add_menu(
209
-                array(
210
-                    'id'     => 'espresso-toolbar-events-new',
211
-                    'parent' => 'espresso-toolbar-events',
212
-                    'title'  => '<span class="ee-toolbar-icon"></span>'
213
-                                . esc_html__('Add New', 'event_espresso'),
214
-                    'href'   => EEH_URL::add_query_args_and_nonce(
215
-                        array('action' => 'create_new'),
216
-                        $this->events_admin_url
217
-                    ),
218
-                    'meta'   => array(
219
-                        'title'  => esc_html__('Add New', 'event_espresso'),
220
-                        'target' => '',
221
-                        'class'  => $this->menu_class,
222
-                    ),
223
-                )
224
-            );
225
-        }
226
-    }
227
-
228
-
229
-    /**
230
-     * @return void
231
-     */
232
-    private function addEventsEditCurrentEvent()
233
-    {
234
-        if (is_single() && (get_post_type() === 'espresso_events')) {
235
-            // Current post
236
-            global $post;
237
-            if (
238
-                $this->capabilities->current_user_can(
239
-                    'ee_edit_event',
240
-                    'ee_admin_bar_menu_espresso-toolbar-events-edit',
241
-                    $post->ID
242
-                )
243
-            ) {
244
-                $this->admin_bar->add_menu(
245
-                    array(
246
-                        'id'     => 'espresso-toolbar-events-edit',
247
-                        'parent' => 'espresso-toolbar-events',
248
-                        'title'  => '<span class="ee-toolbar-icon"></span>'
249
-                                    . esc_html__('Edit Event', 'event_espresso'),
250
-                        'href'   => EEH_URL::add_query_args_and_nonce(
251
-                            array(
252
-                                'action' => 'edit',
253
-                                'post'   => $post->ID,
254
-                            ),
255
-                            $this->events_admin_url
256
-                        ),
257
-                        'meta'   => array(
258
-                            'title'  => esc_html__('Edit Event', 'event_espresso'),
259
-                            'target' => '',
260
-                            'class'  => $this->menu_class,
261
-                        ),
262
-                    )
263
-                );
264
-            }
265
-        }
266
-    }
267
-
268
-
269
-    /**
270
-     * @return void
271
-     */
272
-    private function addEventsViewHeader()
273
-    {
274
-        if (
275
-            $this->capabilities->current_user_can(
276
-                'ee_read_events',
277
-                'ee_admin_bar_menu_espresso-toolbar-events-view'
278
-            )
279
-        ) {
280
-            $this->admin_bar->add_menu(
281
-                array(
282
-                    'id'     => 'espresso-toolbar-events-view',
283
-                    'parent' => 'espresso-toolbar-events',
284
-                    'title'  => esc_html__('View', 'event_espresso'),
285
-                    'href'   => '',
286
-                )
287
-            );
288
-        }
289
-    }
290
-
291
-
292
-    /**
293
-     * @return void
294
-     */
295
-    private function addEventsViewAll()
296
-    {
297
-        if (
298
-            $this->capabilities->current_user_can(
299
-                'ee_read_events',
300
-                'ee_admin_bar_menu_espresso-toolbar-events-all'
301
-            )
302
-        ) {
303
-            $this->admin_bar->add_menu(
304
-                array(
305
-                    'id'     => 'espresso-toolbar-events-all',
306
-                    'parent' => 'espresso-toolbar-events',
307
-                    'title'  => '<span class="ee-toolbar-icon"></span>'
308
-                                . esc_html__('All', 'event_espresso'),
309
-                    'href'   => $this->events_admin_url,
310
-                    'meta'   => array(
311
-                        'title'  => esc_html__('All', 'event_espresso'),
312
-                        'target' => '',
313
-                        'class'  => $this->menu_class,
314
-                    ),
315
-                )
316
-            );
317
-        }
318
-    }
319
-
320
-
321
-    /**
322
-     * @return void
323
-     */
324
-    private function addEventsViewToday()
325
-    {
326
-        if (
327
-            $this->capabilities->current_user_can(
328
-                'ee_read_events',
329
-                'ee_admin_bar_menu_espresso-toolbar-events-today'
330
-            )
331
-        ) {
332
-            $this->admin_bar->add_menu(
333
-                array(
334
-                    'id'     => 'espresso-toolbar-events-today',
335
-                    'parent' => 'espresso-toolbar-events',
336
-                    'title'  => '<span class="ee-toolbar-icon"></span>'
337
-                                . esc_html__('Today', 'event_espresso'),
338
-                    'href'   => EEH_URL::add_query_args_and_nonce(
339
-                        array(
340
-                            'action' => 'default',
341
-                            'status' => 'today',
342
-                        ),
343
-                        $this->events_admin_url
344
-                    ),
345
-                    'meta'   => array(
346
-                        'title'  => esc_html__('Today', 'event_espresso'),
347
-                        'target' => '',
348
-                        'class'  => $this->menu_class,
349
-                    ),
350
-                )
351
-            );
352
-        }
353
-    }
354
-
355
-
356
-    /**
357
-     * @return void
358
-     */
359
-    private function addEventsViewThisMonth()
360
-    {
361
-        if (
362
-            $this->capabilities->current_user_can(
363
-                'ee_read_events',
364
-                'ee_admin_bar_menu_espresso-toolbar-events-month'
365
-            )
366
-        ) {
367
-            $this->admin_bar->add_menu(
368
-                array(
369
-                    'id'     => 'espresso-toolbar-events-month',
370
-                    'parent' => 'espresso-toolbar-events',
371
-                    'title'  => '<span class="ee-toolbar-icon"></span>'
372
-                                . esc_html__('This Month', 'event_espresso'),
373
-                    'href'   => EEH_URL::add_query_args_and_nonce(
374
-                        array(
375
-                            'action' => 'default',
376
-                            'status' => 'month',
377
-                        ),
378
-                        $this->events_admin_url
379
-                    ),
380
-                    'meta'   => array(
381
-                        'title'  => esc_html__('This Month', 'event_espresso'),
382
-                        'target' => '',
383
-                        'class'  => $this->menu_class,
384
-                    ),
385
-                )
386
-            );
387
-        }
388
-    }
389
-
390
-
391
-    /**
392
-     * @return void
393
-     */
394
-    private function addRegistrationSubMenu()
395
-    {
396
-        if (
397
-            $this->capabilities->current_user_can(
398
-                'ee_read_registrations',
399
-                'ee_admin_bar_menu_espresso-toolbar-registrations'
400
-            )
401
-        ) {
402
-            $this->admin_bar->add_menu(
403
-                array(
404
-                    'id'     => 'espresso-toolbar-registrations',
405
-                    'parent' => 'espresso-toolbar',
406
-                    'title'  => '<span class="ee-toolbar-icon"></span>'
407
-                                . esc_html__('Registrations', 'event_espresso'),
408
-                    'href'   => $this->reg_admin_url,
409
-                    'meta'   => array(
410
-                        'title'  => esc_html__('Registrations', 'event_espresso'),
411
-                        'target' => '',
412
-                        'class'  => $this->menu_class,
413
-                    ),
414
-                )
415
-            );
416
-        }
417
-    }
418
-
419
-
420
-    /**
421
-     * @return void
422
-     */
423
-    private function addRegistrationOverviewToday()
424
-    {
425
-        if (
426
-            $this->capabilities->current_user_can(
427
-                'ee_read_registrations',
428
-                'ee_admin_bar_menu_espresso-toolbar-registrations-today'
429
-            )
430
-        ) {
431
-            $this->admin_bar->add_menu(
432
-                array(
433
-                    'id'     => 'espresso-toolbar-registrations-today',
434
-                    'parent' => 'espresso-toolbar-registrations',
435
-                    'title'  => esc_html__('Today', 'event_espresso'),
436
-                    'href'   => '',
437
-                    'meta'   => array(
438
-                        'title'  => esc_html__('Today', 'event_espresso'),
439
-                        'target' => '',
440
-                        'class'  => $this->menu_class,
441
-                    ),
442
-                )
443
-            );
444
-        }
445
-    }
446
-
447
-
448
-    /**
449
-     * @return void
450
-     */
451
-    private function addRegistrationOverviewTodayApproved()
452
-    {
453
-        if (
454
-            $this->capabilities->current_user_can(
455
-                'ee_read_registrations',
456
-                'ee_admin_bar_menu_espresso-toolbar-registrations-today-approved'
457
-            )
458
-        ) {
459
-            $this->admin_bar->add_menu(
460
-                array(
461
-                    'id'     => 'espresso-toolbar-registrations-today-approved',
462
-                    'parent' => 'espresso-toolbar-registrations',
463
-                    'title'  => '<span class="ee-toolbar-icon"></span>'
464
-                                . esc_html__('Approved', 'event_espresso'),
465
-                    'href'   => EEH_URL::add_query_args_and_nonce(
466
-                        array(
467
-                            'action'      => 'default',
468
-                            'status'      => 'today',
469
-                            '_reg_status' => EEM_Registration::status_id_approved,
470
-                        ),
471
-                        $this->reg_admin_url
472
-                    ),
473
-                    'meta'   => array(
474
-                        'title'  => esc_html__('Approved', 'event_espresso'),
475
-                        'target' => '',
476
-                        'class'  => $this->menu_class . ' ee-toolbar-icon-approved',
477
-                    ),
478
-                )
479
-            );
480
-        }
481
-    }
482
-
483
-
484
-    /**
485
-     * @return void
486
-     */
487
-    private function addRegistrationOverviewTodayPendingPayment()
488
-    {
489
-        if (
490
-            $this->capabilities->current_user_can(
491
-                'ee_read_registrations',
492
-                'ee_admin_bar_menu_espresso-toolbar-registrations-today-pending'
493
-            )
494
-        ) {
495
-            $this->admin_bar->add_menu(
496
-                array(
497
-                    'id'     => 'espresso-toolbar-registrations-today-pending',
498
-                    'parent' => 'espresso-toolbar-registrations',
499
-                    'title'  => '<span class="ee-toolbar-icon"></span>'
500
-                                . esc_html__('Pending', 'event_espresso'),
501
-                    'href'   => EEH_URL::add_query_args_and_nonce(
502
-                        array(
503
-                            'action'      => 'default',
504
-                            'status'      => 'today',
505
-                            '_reg_status' => EEM_Registration::status_id_pending_payment,
506
-                        ),
507
-                        $this->reg_admin_url
508
-                    ),
509
-                    'meta'   => array(
510
-                        'title'  => esc_html__('Pending Payment', 'event_espresso'),
511
-                        'target' => '',
512
-                        'class'  => $this->menu_class . ' ee-toolbar-icon-pending',
513
-                    ),
514
-                )
515
-            );
516
-        }
517
-    }
518
-
519
-
520
-    /**
521
-     * @return void
522
-     */
523
-    private function addRegistrationOverviewTodayNotApproved()
524
-    {
525
-        if (
526
-            $this->capabilities->current_user_can(
527
-                'ee_read_registrations',
528
-                'ee_admin_bar_menu_espresso-toolbar-registrations-today-not-approved'
529
-            )
530
-        ) {
531
-            $this->admin_bar->add_menu(
532
-                array(
533
-                    'id'     => 'espresso-toolbar-registrations-today-not-approved',
534
-                    'parent' => 'espresso-toolbar-registrations',
535
-                    'title'  => '<span class="ee-toolbar-icon"></span>'
536
-                                . esc_html__('Not Approved', 'event_espresso'),
537
-                    'href'   => EEH_URL::add_query_args_and_nonce(
538
-                        array(
539
-                            'action'      => 'default',
540
-                            'status'      => 'today',
541
-                            '_reg_status' => EEM_Registration::status_id_not_approved,
542
-                        ),
543
-                        $this->reg_admin_url
544
-                    ),
545
-                    'meta'   => array(
546
-                        'title'  => esc_html__('Not Approved', 'event_espresso'),
547
-                        'target' => '',
548
-                        'class'  => $this->menu_class . ' ee-toolbar-icon-not-approved',
549
-                    ),
550
-                )
551
-            );
552
-        }
553
-    }
554
-
555
-
556
-    /**
557
-     * @return void
558
-     */
559
-    private function addRegistrationOverviewTodayCancelled()
560
-    {
561
-        if (
562
-            $this->capabilities->current_user_can(
563
-                'ee_read_registrations',
564
-                'ee_admin_bar_menu_espresso-toolbar-registrations-today-cancelled'
565
-            )
566
-        ) {
567
-            $this->admin_bar->add_menu(
568
-                array(
569
-                    'id'     => 'espresso-toolbar-registrations-today-cancelled',
570
-                    'parent' => 'espresso-toolbar-registrations',
571
-                    'title'  => '<span class="ee-toolbar-icon"></span>'
572
-                                . esc_html__('Cancelled', 'event_espresso'),
573
-                    'href'   => EEH_URL::add_query_args_and_nonce(
574
-                        array(
575
-                            'action'      => 'default',
576
-                            'status'      => 'today',
577
-                            '_reg_status' => EEM_Registration::status_id_cancelled,
578
-                        ),
579
-                        $this->reg_admin_url
580
-                    ),
581
-                    'meta'   => array(
582
-                        'title'  => esc_html__('Cancelled', 'event_espresso'),
583
-                        'target' => '',
584
-                        'class'  => $this->menu_class . ' ee-toolbar-icon-cancelled',
585
-                    ),
586
-                )
587
-            );
588
-        }
589
-    }
590
-
591
-
592
-    /**
593
-     * @return void
594
-     */
595
-    private function addRegistrationOverviewThisMonth()
596
-    {
597
-        if (
598
-            $this->capabilities->current_user_can(
599
-                'ee_read_registrations',
600
-                'ee_admin_bar_menu_espresso-toolbar-registrations-month'
601
-            )
602
-        ) {
603
-            $this->admin_bar->add_menu(
604
-                array(
605
-                    'id'     => 'espresso-toolbar-registrations-month',
606
-                    'parent' => 'espresso-toolbar-registrations',
607
-                    'title'  => esc_html__('This Month', 'event_espresso'),
608
-                    'href'   => '', // EEH_URL::add_query_args_and_nonce(
609
-                    //     array(
610
-                    //         'action' => 'default',
611
-                    //         'status' => 'month'
612
-                    //     ),
613
-                    //     $this->reg_admin_url
614
-                    // ),
615
-                    'meta'   => array(
616
-                        'title'  => esc_html__('This Month', 'event_espresso'),
617
-                        'target' => '',
618
-                        'class'  => $this->menu_class,
619
-                    ),
620
-                )
621
-            );
622
-        }
623
-    }
624
-
625
-
626
-    /**
627
-     * @return void
628
-     */
629
-    private function addRegistrationOverviewThisMonthApproved()
630
-    {
631
-        if (
632
-            $this->capabilities->current_user_can(
633
-                'ee_read_registrations',
634
-                'ee_admin_bar_menu_espresso-toolbar-registrations-month-approved'
635
-            )
636
-        ) {
637
-            $this->admin_bar->add_menu(
638
-                array(
639
-                    'id'     => 'espresso-toolbar-registrations-month-approved',
640
-                    'parent' => 'espresso-toolbar-registrations',
641
-                    'title'  => '<span class="ee-toolbar-icon"></span>'
642
-                                . esc_html__('Approved', 'event_espresso'),
643
-                    'href'   => EEH_URL::add_query_args_and_nonce(
644
-                        array(
645
-                            'action'      => 'default',
646
-                            'status'      => 'month',
647
-                            '_reg_status' => EEM_Registration::status_id_approved,
648
-                        ),
649
-                        $this->reg_admin_url
650
-                    ),
651
-                    'meta'   => array(
652
-                        'title'  => esc_html__('Approved', 'event_espresso'),
653
-                        'target' => '',
654
-                        'class'  => $this->menu_class . ' ee-toolbar-icon-approved',
655
-                    ),
656
-                )
657
-            );
658
-        }
659
-    }
660
-
661
-
662
-    /**
663
-     * @return void
664
-     */
665
-    private function addRegistrationOverviewThisMonthPending()
666
-    {
667
-        if (
668
-            $this->capabilities->current_user_can(
669
-                'ee_read_registrations',
670
-                'ee_admin_bar_menu_espresso-toolbar-registrations-month-pending'
671
-            )
672
-        ) {
673
-            $this->admin_bar->add_menu(
674
-                array(
675
-                    'id'     => 'espresso-toolbar-registrations-month-pending',
676
-                    'parent' => 'espresso-toolbar-registrations',
677
-                    'title'  => '<span class="ee-toolbar-icon"></span>'
678
-                                . esc_html__('Pending', 'event_espresso'),
679
-                    'href'   => EEH_URL::add_query_args_and_nonce(
680
-                        array(
681
-                            'action'      => 'default',
682
-                            'status'      => 'month',
683
-                            '_reg_status' => EEM_Registration::status_id_pending_payment,
684
-                        ),
685
-                        $this->reg_admin_url
686
-                    ),
687
-                    'meta'   => array(
688
-                        'title'  => esc_html__('Pending', 'event_espresso'),
689
-                        'target' => '',
690
-                        'class'  => $this->menu_class . ' ee-toolbar-icon-pending',
691
-                    ),
692
-                )
693
-            );
694
-        }
695
-    }
696
-
697
-
698
-    /**
699
-     * @return void
700
-     */
701
-    private function addRegistrationOverviewThisMonthNotApproved()
702
-    {
703
-        if (
704
-            $this->capabilities->current_user_can(
705
-                'ee_read_registrations',
706
-                'ee_admin_bar_menu_espresso-toolbar-registrations-month-not-approved'
707
-            )
708
-        ) {
709
-            $this->admin_bar->add_menu(
710
-                array(
711
-                    'id'     => 'espresso-toolbar-registrations-month-not-approved',
712
-                    'parent' => 'espresso-toolbar-registrations',
713
-                    'title'  => '<span class="ee-toolbar-icon"></span>'
714
-                                . esc_html__('Not Approved', 'event_espresso'),
715
-                    'href'   => EEH_URL::add_query_args_and_nonce(
716
-                        array(
717
-                            'action'      => 'default',
718
-                            'status'      => 'month',
719
-                            '_reg_status' => EEM_Registration::status_id_not_approved,
720
-                        ),
721
-                        $this->reg_admin_url
722
-                    ),
723
-                    'meta'   => array(
724
-                        'title'  => esc_html__('Not Approved', 'event_espresso'),
725
-                        'target' => '',
726
-                        'class'  => $this->menu_class . ' ee-toolbar-icon-not-approved',
727
-                    ),
728
-                )
729
-            );
730
-        }
731
-    }
732
-
733
-
734
-    /**
735
-     * @return void
736
-     */
737
-    private function addRegistrationOverviewThisMonthCancelled()
738
-    {
739
-        if (
740
-            $this->capabilities->current_user_can(
741
-                'ee_read_registrations',
742
-                'ee_admin_bar_menu_espresso-toolbar-registrations-month-cancelled'
743
-            )
744
-        ) {
745
-            $this->admin_bar->add_menu(
746
-                array(
747
-                    'id'     => 'espresso-toolbar-registrations-month-cancelled',
748
-                    'parent' => 'espresso-toolbar-registrations',
749
-                    'title'  => '<span class="ee-toolbar-icon"></span>'
750
-                                . esc_html__('Cancelled', 'event_espresso'),
751
-                    'href'   => EEH_URL::add_query_args_and_nonce(
752
-                        array(
753
-                            'action'      => 'default',
754
-                            'status'      => 'month',
755
-                            '_reg_status' => EEM_Registration::status_id_cancelled,
756
-                        ),
757
-                        $this->reg_admin_url
758
-                    ),
759
-                    'meta'   => array(
760
-                        'title'  => esc_html__('Cancelled', 'event_espresso'),
761
-                        'target' => '',
762
-                        'class'  => $this->menu_class . ' ee-toolbar-icon-cancelled',
763
-                    ),
764
-                )
765
-            );
766
-        }
767
-    }
768
-
769
-
770
-    /**
771
-     * @return void
772
-     */
773
-    private function addExtensionsAndServices()
774
-    {
775
-        if (
776
-            $this->capabilities->current_user_can(
777
-                'ee_read_ee',
778
-                'ee_admin_bar_menu_espresso-toolbar-extensions-and-services'
779
-            )
780
-        ) {
781
-            $this->admin_bar->add_menu(
782
-                array(
783
-                    'id'     => 'espresso-toolbar-extensions-and-services',
784
-                    'parent' => 'espresso-toolbar',
785
-                    'title'  => '<span class="ee-toolbar-icon"></span>'
786
-                                . esc_html__('Extensions & Services', 'event_espresso'),
787
-                    'href'   => admin_url('admin.php?page=espresso_packages'),
788
-                    'meta'   => array(
789
-                        'title'  => esc_html__('Extensions & Services', 'event_espresso'),
790
-                        'target' => '',
791
-                        'class'  => $this->menu_class,
792
-                    ),
793
-                )
794
-            );
795
-        }
796
-    }
21
+	/**
22
+	 * @var WP_Admin_Bar $admin_bar
23
+	 */
24
+	private $admin_bar;
25
+
26
+	/**
27
+	 * @var EE_Capabilities $capabilities
28
+	 */
29
+	private $capabilities;
30
+
31
+	/**
32
+	 * @var string $events_admin_url
33
+	 */
34
+	private $events_admin_url;
35
+
36
+	/**
37
+	 * @var string $menu_class
38
+	 */
39
+	private $menu_class = 'espresso_menu_item_class';
40
+
41
+	/**
42
+	 * @var string $reg_admin_url
43
+	 */
44
+	private $reg_admin_url;
45
+
46
+
47
+	/**
48
+	 * AdminToolBar constructor.
49
+	 *
50
+	 * @param EE_Capabilities $capabilities
51
+	 */
52
+	public function __construct(EE_Capabilities $capabilities)
53
+	{
54
+		$this->capabilities = $capabilities;
55
+		add_action('admin_bar_menu', array($this, 'espressoToolbarItems'), 100);
56
+		$this->enqueueAssets();
57
+	}
58
+
59
+
60
+	/**
61
+	 *    espresso_toolbar_items
62
+	 *
63
+	 * @access public
64
+	 * @param  WP_Admin_Bar $admin_bar
65
+	 * @return void
66
+	 */
67
+	public function espressoToolbarItems(WP_Admin_Bar $admin_bar)
68
+	{
69
+		// if its an AJAX request, or user is NOT an admin, or in full M-Mode
70
+		if (
71
+			defined('DOING_AJAX')
72
+			|| ! $this->capabilities->current_user_can('ee_read_ee', 'ee_admin_bar_menu_top_level')
73
+			|| EE_Maintenance_Mode::instance()->level() === EE_Maintenance_Mode::level_2_complete_maintenance
74
+		) {
75
+			return;
76
+		}
77
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
78
+		$this->admin_bar = $admin_bar;
79
+		// we don't use the constants EVENTS_ADMIN_URL or REG_ADMIN_URL
80
+		// because they're only defined in each of their respective constructors
81
+		// and this might be a frontend request, in which case they aren't available
82
+		$this->events_admin_url = admin_url('admin.php?page=espresso_events');
83
+		$this->reg_admin_url = admin_url('admin.php?page=espresso_registrations');
84
+		// now let's add all of the menu items
85
+		$this->addTopLevelMenu();
86
+		$this->addEventsSubMenu();
87
+		$this->addEventsAddEditHeader();
88
+		$this->addEventsAddNew();
89
+		$this->addEventsEditCurrentEvent();
90
+		$this->addEventsViewHeader();
91
+		$this->addEventsViewAll();
92
+		$this->addEventsViewToday();
93
+		$this->addEventsViewThisMonth();
94
+		$this->addRegistrationSubMenu();
95
+		$this->addRegistrationOverviewToday();
96
+		$this->addRegistrationOverviewTodayApproved();
97
+		$this->addRegistrationOverviewTodayPendingPayment();
98
+		$this->addRegistrationOverviewTodayNotApproved();
99
+		$this->addRegistrationOverviewTodayCancelled();
100
+		$this->addRegistrationOverviewThisMonth();
101
+		$this->addRegistrationOverviewThisMonthApproved();
102
+		$this->addRegistrationOverviewThisMonthPending();
103
+		$this->addRegistrationOverviewThisMonthNotApproved();
104
+		$this->addRegistrationOverviewThisMonthCancelled();
105
+		$this->addExtensionsAndServices();
106
+	}
107
+
108
+
109
+	/**
110
+	 * @return void
111
+	 */
112
+	private function enqueueAssets()
113
+	{
114
+		wp_register_style(
115
+			'espresso-admin-toolbar',
116
+			EE_GLOBAL_ASSETS_URL . 'css/espresso-admin-toolbar.css',
117
+			array('dashicons'),
118
+			EVENT_ESPRESSO_VERSION
119
+		);
120
+		wp_enqueue_style('espresso-admin-toolbar');
121
+	}
122
+
123
+
124
+	/**
125
+	 * @return void
126
+	 */
127
+	private function addTopLevelMenu()
128
+	{
129
+		$this->admin_bar->add_menu(
130
+			array(
131
+				'id'    => 'espresso-toolbar',
132
+				'title' => '<span class="ee-icon ee-icon-ee-cup-thick ee-icon-size-20"></span><span class="ab-label">'
133
+						   . esc_html_x('Event Espresso', 'admin bar menu group label', 'event_espresso')
134
+						   . '</span>',
135
+				'href'  => $this->events_admin_url,
136
+				'meta'  => array(
137
+					'title' => esc_html__('Event Espresso', 'event_espresso'),
138
+					'class' => $this->menu_class . 'first',
139
+				),
140
+			)
141
+		);
142
+	}
143
+
144
+
145
+	/**
146
+	 * @return void
147
+	 */
148
+	private function addEventsSubMenu()
149
+	{
150
+		if (
151
+			$this->capabilities->current_user_can(
152
+				'ee_read_events',
153
+				'ee_admin_bar_menu_espresso-toolbar-events'
154
+			)
155
+		) {
156
+			$this->admin_bar->add_menu(
157
+				array(
158
+					'id'     => 'espresso-toolbar-events',
159
+					'parent' => 'espresso-toolbar',
160
+					'title'  => '<span class="ee-toolbar-icon"></span>'
161
+								. esc_html__('Events', 'event_espresso'),
162
+					'href'   => $this->events_admin_url,
163
+					'meta'   => array(
164
+						'title'  => esc_html__('Events', 'event_espresso'),
165
+						'target' => '',
166
+						'class'  => $this->menu_class,
167
+					),
168
+				)
169
+			);
170
+		}
171
+	}
172
+
173
+
174
+	/**
175
+	 * @return void
176
+	 */
177
+	private function addEventsAddEditHeader()
178
+	{
179
+		if (
180
+			$this->capabilities->current_user_can(
181
+				'ee_read_events',
182
+				'ee_admin_bar_menu_espresso-toolbar-events-view'
183
+			)
184
+		) {
185
+			$this->admin_bar->add_menu(
186
+				array(
187
+					'id'     => 'espresso-toolbar-events-add-edit',
188
+					'parent' => 'espresso-toolbar-events',
189
+					'title'  => esc_html__('Add / Edit', 'event_espresso'),
190
+					'href'   => '',
191
+				)
192
+			);
193
+		}
194
+	}
195
+
196
+
197
+	/**
198
+	 * @return void
199
+	 */
200
+	private function addEventsAddNew()
201
+	{
202
+		if (
203
+			$this->capabilities->current_user_can(
204
+				'ee_edit_events',
205
+				'ee_admin_bar_menu_espresso-toolbar-events-new'
206
+			)
207
+		) {
208
+			$this->admin_bar->add_menu(
209
+				array(
210
+					'id'     => 'espresso-toolbar-events-new',
211
+					'parent' => 'espresso-toolbar-events',
212
+					'title'  => '<span class="ee-toolbar-icon"></span>'
213
+								. esc_html__('Add New', 'event_espresso'),
214
+					'href'   => EEH_URL::add_query_args_and_nonce(
215
+						array('action' => 'create_new'),
216
+						$this->events_admin_url
217
+					),
218
+					'meta'   => array(
219
+						'title'  => esc_html__('Add New', 'event_espresso'),
220
+						'target' => '',
221
+						'class'  => $this->menu_class,
222
+					),
223
+				)
224
+			);
225
+		}
226
+	}
227
+
228
+
229
+	/**
230
+	 * @return void
231
+	 */
232
+	private function addEventsEditCurrentEvent()
233
+	{
234
+		if (is_single() && (get_post_type() === 'espresso_events')) {
235
+			// Current post
236
+			global $post;
237
+			if (
238
+				$this->capabilities->current_user_can(
239
+					'ee_edit_event',
240
+					'ee_admin_bar_menu_espresso-toolbar-events-edit',
241
+					$post->ID
242
+				)
243
+			) {
244
+				$this->admin_bar->add_menu(
245
+					array(
246
+						'id'     => 'espresso-toolbar-events-edit',
247
+						'parent' => 'espresso-toolbar-events',
248
+						'title'  => '<span class="ee-toolbar-icon"></span>'
249
+									. esc_html__('Edit Event', 'event_espresso'),
250
+						'href'   => EEH_URL::add_query_args_and_nonce(
251
+							array(
252
+								'action' => 'edit',
253
+								'post'   => $post->ID,
254
+							),
255
+							$this->events_admin_url
256
+						),
257
+						'meta'   => array(
258
+							'title'  => esc_html__('Edit Event', 'event_espresso'),
259
+							'target' => '',
260
+							'class'  => $this->menu_class,
261
+						),
262
+					)
263
+				);
264
+			}
265
+		}
266
+	}
267
+
268
+
269
+	/**
270
+	 * @return void
271
+	 */
272
+	private function addEventsViewHeader()
273
+	{
274
+		if (
275
+			$this->capabilities->current_user_can(
276
+				'ee_read_events',
277
+				'ee_admin_bar_menu_espresso-toolbar-events-view'
278
+			)
279
+		) {
280
+			$this->admin_bar->add_menu(
281
+				array(
282
+					'id'     => 'espresso-toolbar-events-view',
283
+					'parent' => 'espresso-toolbar-events',
284
+					'title'  => esc_html__('View', 'event_espresso'),
285
+					'href'   => '',
286
+				)
287
+			);
288
+		}
289
+	}
290
+
291
+
292
+	/**
293
+	 * @return void
294
+	 */
295
+	private function addEventsViewAll()
296
+	{
297
+		if (
298
+			$this->capabilities->current_user_can(
299
+				'ee_read_events',
300
+				'ee_admin_bar_menu_espresso-toolbar-events-all'
301
+			)
302
+		) {
303
+			$this->admin_bar->add_menu(
304
+				array(
305
+					'id'     => 'espresso-toolbar-events-all',
306
+					'parent' => 'espresso-toolbar-events',
307
+					'title'  => '<span class="ee-toolbar-icon"></span>'
308
+								. esc_html__('All', 'event_espresso'),
309
+					'href'   => $this->events_admin_url,
310
+					'meta'   => array(
311
+						'title'  => esc_html__('All', 'event_espresso'),
312
+						'target' => '',
313
+						'class'  => $this->menu_class,
314
+					),
315
+				)
316
+			);
317
+		}
318
+	}
319
+
320
+
321
+	/**
322
+	 * @return void
323
+	 */
324
+	private function addEventsViewToday()
325
+	{
326
+		if (
327
+			$this->capabilities->current_user_can(
328
+				'ee_read_events',
329
+				'ee_admin_bar_menu_espresso-toolbar-events-today'
330
+			)
331
+		) {
332
+			$this->admin_bar->add_menu(
333
+				array(
334
+					'id'     => 'espresso-toolbar-events-today',
335
+					'parent' => 'espresso-toolbar-events',
336
+					'title'  => '<span class="ee-toolbar-icon"></span>'
337
+								. esc_html__('Today', 'event_espresso'),
338
+					'href'   => EEH_URL::add_query_args_and_nonce(
339
+						array(
340
+							'action' => 'default',
341
+							'status' => 'today',
342
+						),
343
+						$this->events_admin_url
344
+					),
345
+					'meta'   => array(
346
+						'title'  => esc_html__('Today', 'event_espresso'),
347
+						'target' => '',
348
+						'class'  => $this->menu_class,
349
+					),
350
+				)
351
+			);
352
+		}
353
+	}
354
+
355
+
356
+	/**
357
+	 * @return void
358
+	 */
359
+	private function addEventsViewThisMonth()
360
+	{
361
+		if (
362
+			$this->capabilities->current_user_can(
363
+				'ee_read_events',
364
+				'ee_admin_bar_menu_espresso-toolbar-events-month'
365
+			)
366
+		) {
367
+			$this->admin_bar->add_menu(
368
+				array(
369
+					'id'     => 'espresso-toolbar-events-month',
370
+					'parent' => 'espresso-toolbar-events',
371
+					'title'  => '<span class="ee-toolbar-icon"></span>'
372
+								. esc_html__('This Month', 'event_espresso'),
373
+					'href'   => EEH_URL::add_query_args_and_nonce(
374
+						array(
375
+							'action' => 'default',
376
+							'status' => 'month',
377
+						),
378
+						$this->events_admin_url
379
+					),
380
+					'meta'   => array(
381
+						'title'  => esc_html__('This Month', 'event_espresso'),
382
+						'target' => '',
383
+						'class'  => $this->menu_class,
384
+					),
385
+				)
386
+			);
387
+		}
388
+	}
389
+
390
+
391
+	/**
392
+	 * @return void
393
+	 */
394
+	private function addRegistrationSubMenu()
395
+	{
396
+		if (
397
+			$this->capabilities->current_user_can(
398
+				'ee_read_registrations',
399
+				'ee_admin_bar_menu_espresso-toolbar-registrations'
400
+			)
401
+		) {
402
+			$this->admin_bar->add_menu(
403
+				array(
404
+					'id'     => 'espresso-toolbar-registrations',
405
+					'parent' => 'espresso-toolbar',
406
+					'title'  => '<span class="ee-toolbar-icon"></span>'
407
+								. esc_html__('Registrations', 'event_espresso'),
408
+					'href'   => $this->reg_admin_url,
409
+					'meta'   => array(
410
+						'title'  => esc_html__('Registrations', 'event_espresso'),
411
+						'target' => '',
412
+						'class'  => $this->menu_class,
413
+					),
414
+				)
415
+			);
416
+		}
417
+	}
418
+
419
+
420
+	/**
421
+	 * @return void
422
+	 */
423
+	private function addRegistrationOverviewToday()
424
+	{
425
+		if (
426
+			$this->capabilities->current_user_can(
427
+				'ee_read_registrations',
428
+				'ee_admin_bar_menu_espresso-toolbar-registrations-today'
429
+			)
430
+		) {
431
+			$this->admin_bar->add_menu(
432
+				array(
433
+					'id'     => 'espresso-toolbar-registrations-today',
434
+					'parent' => 'espresso-toolbar-registrations',
435
+					'title'  => esc_html__('Today', 'event_espresso'),
436
+					'href'   => '',
437
+					'meta'   => array(
438
+						'title'  => esc_html__('Today', 'event_espresso'),
439
+						'target' => '',
440
+						'class'  => $this->menu_class,
441
+					),
442
+				)
443
+			);
444
+		}
445
+	}
446
+
447
+
448
+	/**
449
+	 * @return void
450
+	 */
451
+	private function addRegistrationOverviewTodayApproved()
452
+	{
453
+		if (
454
+			$this->capabilities->current_user_can(
455
+				'ee_read_registrations',
456
+				'ee_admin_bar_menu_espresso-toolbar-registrations-today-approved'
457
+			)
458
+		) {
459
+			$this->admin_bar->add_menu(
460
+				array(
461
+					'id'     => 'espresso-toolbar-registrations-today-approved',
462
+					'parent' => 'espresso-toolbar-registrations',
463
+					'title'  => '<span class="ee-toolbar-icon"></span>'
464
+								. esc_html__('Approved', 'event_espresso'),
465
+					'href'   => EEH_URL::add_query_args_and_nonce(
466
+						array(
467
+							'action'      => 'default',
468
+							'status'      => 'today',
469
+							'_reg_status' => EEM_Registration::status_id_approved,
470
+						),
471
+						$this->reg_admin_url
472
+					),
473
+					'meta'   => array(
474
+						'title'  => esc_html__('Approved', 'event_espresso'),
475
+						'target' => '',
476
+						'class'  => $this->menu_class . ' ee-toolbar-icon-approved',
477
+					),
478
+				)
479
+			);
480
+		}
481
+	}
482
+
483
+
484
+	/**
485
+	 * @return void
486
+	 */
487
+	private function addRegistrationOverviewTodayPendingPayment()
488
+	{
489
+		if (
490
+			$this->capabilities->current_user_can(
491
+				'ee_read_registrations',
492
+				'ee_admin_bar_menu_espresso-toolbar-registrations-today-pending'
493
+			)
494
+		) {
495
+			$this->admin_bar->add_menu(
496
+				array(
497
+					'id'     => 'espresso-toolbar-registrations-today-pending',
498
+					'parent' => 'espresso-toolbar-registrations',
499
+					'title'  => '<span class="ee-toolbar-icon"></span>'
500
+								. esc_html__('Pending', 'event_espresso'),
501
+					'href'   => EEH_URL::add_query_args_and_nonce(
502
+						array(
503
+							'action'      => 'default',
504
+							'status'      => 'today',
505
+							'_reg_status' => EEM_Registration::status_id_pending_payment,
506
+						),
507
+						$this->reg_admin_url
508
+					),
509
+					'meta'   => array(
510
+						'title'  => esc_html__('Pending Payment', 'event_espresso'),
511
+						'target' => '',
512
+						'class'  => $this->menu_class . ' ee-toolbar-icon-pending',
513
+					),
514
+				)
515
+			);
516
+		}
517
+	}
518
+
519
+
520
+	/**
521
+	 * @return void
522
+	 */
523
+	private function addRegistrationOverviewTodayNotApproved()
524
+	{
525
+		if (
526
+			$this->capabilities->current_user_can(
527
+				'ee_read_registrations',
528
+				'ee_admin_bar_menu_espresso-toolbar-registrations-today-not-approved'
529
+			)
530
+		) {
531
+			$this->admin_bar->add_menu(
532
+				array(
533
+					'id'     => 'espresso-toolbar-registrations-today-not-approved',
534
+					'parent' => 'espresso-toolbar-registrations',
535
+					'title'  => '<span class="ee-toolbar-icon"></span>'
536
+								. esc_html__('Not Approved', 'event_espresso'),
537
+					'href'   => EEH_URL::add_query_args_and_nonce(
538
+						array(
539
+							'action'      => 'default',
540
+							'status'      => 'today',
541
+							'_reg_status' => EEM_Registration::status_id_not_approved,
542
+						),
543
+						$this->reg_admin_url
544
+					),
545
+					'meta'   => array(
546
+						'title'  => esc_html__('Not Approved', 'event_espresso'),
547
+						'target' => '',
548
+						'class'  => $this->menu_class . ' ee-toolbar-icon-not-approved',
549
+					),
550
+				)
551
+			);
552
+		}
553
+	}
554
+
555
+
556
+	/**
557
+	 * @return void
558
+	 */
559
+	private function addRegistrationOverviewTodayCancelled()
560
+	{
561
+		if (
562
+			$this->capabilities->current_user_can(
563
+				'ee_read_registrations',
564
+				'ee_admin_bar_menu_espresso-toolbar-registrations-today-cancelled'
565
+			)
566
+		) {
567
+			$this->admin_bar->add_menu(
568
+				array(
569
+					'id'     => 'espresso-toolbar-registrations-today-cancelled',
570
+					'parent' => 'espresso-toolbar-registrations',
571
+					'title'  => '<span class="ee-toolbar-icon"></span>'
572
+								. esc_html__('Cancelled', 'event_espresso'),
573
+					'href'   => EEH_URL::add_query_args_and_nonce(
574
+						array(
575
+							'action'      => 'default',
576
+							'status'      => 'today',
577
+							'_reg_status' => EEM_Registration::status_id_cancelled,
578
+						),
579
+						$this->reg_admin_url
580
+					),
581
+					'meta'   => array(
582
+						'title'  => esc_html__('Cancelled', 'event_espresso'),
583
+						'target' => '',
584
+						'class'  => $this->menu_class . ' ee-toolbar-icon-cancelled',
585
+					),
586
+				)
587
+			);
588
+		}
589
+	}
590
+
591
+
592
+	/**
593
+	 * @return void
594
+	 */
595
+	private function addRegistrationOverviewThisMonth()
596
+	{
597
+		if (
598
+			$this->capabilities->current_user_can(
599
+				'ee_read_registrations',
600
+				'ee_admin_bar_menu_espresso-toolbar-registrations-month'
601
+			)
602
+		) {
603
+			$this->admin_bar->add_menu(
604
+				array(
605
+					'id'     => 'espresso-toolbar-registrations-month',
606
+					'parent' => 'espresso-toolbar-registrations',
607
+					'title'  => esc_html__('This Month', 'event_espresso'),
608
+					'href'   => '', // EEH_URL::add_query_args_and_nonce(
609
+					//     array(
610
+					//         'action' => 'default',
611
+					//         'status' => 'month'
612
+					//     ),
613
+					//     $this->reg_admin_url
614
+					// ),
615
+					'meta'   => array(
616
+						'title'  => esc_html__('This Month', 'event_espresso'),
617
+						'target' => '',
618
+						'class'  => $this->menu_class,
619
+					),
620
+				)
621
+			);
622
+		}
623
+	}
624
+
625
+
626
+	/**
627
+	 * @return void
628
+	 */
629
+	private function addRegistrationOverviewThisMonthApproved()
630
+	{
631
+		if (
632
+			$this->capabilities->current_user_can(
633
+				'ee_read_registrations',
634
+				'ee_admin_bar_menu_espresso-toolbar-registrations-month-approved'
635
+			)
636
+		) {
637
+			$this->admin_bar->add_menu(
638
+				array(
639
+					'id'     => 'espresso-toolbar-registrations-month-approved',
640
+					'parent' => 'espresso-toolbar-registrations',
641
+					'title'  => '<span class="ee-toolbar-icon"></span>'
642
+								. esc_html__('Approved', 'event_espresso'),
643
+					'href'   => EEH_URL::add_query_args_and_nonce(
644
+						array(
645
+							'action'      => 'default',
646
+							'status'      => 'month',
647
+							'_reg_status' => EEM_Registration::status_id_approved,
648
+						),
649
+						$this->reg_admin_url
650
+					),
651
+					'meta'   => array(
652
+						'title'  => esc_html__('Approved', 'event_espresso'),
653
+						'target' => '',
654
+						'class'  => $this->menu_class . ' ee-toolbar-icon-approved',
655
+					),
656
+				)
657
+			);
658
+		}
659
+	}
660
+
661
+
662
+	/**
663
+	 * @return void
664
+	 */
665
+	private function addRegistrationOverviewThisMonthPending()
666
+	{
667
+		if (
668
+			$this->capabilities->current_user_can(
669
+				'ee_read_registrations',
670
+				'ee_admin_bar_menu_espresso-toolbar-registrations-month-pending'
671
+			)
672
+		) {
673
+			$this->admin_bar->add_menu(
674
+				array(
675
+					'id'     => 'espresso-toolbar-registrations-month-pending',
676
+					'parent' => 'espresso-toolbar-registrations',
677
+					'title'  => '<span class="ee-toolbar-icon"></span>'
678
+								. esc_html__('Pending', 'event_espresso'),
679
+					'href'   => EEH_URL::add_query_args_and_nonce(
680
+						array(
681
+							'action'      => 'default',
682
+							'status'      => 'month',
683
+							'_reg_status' => EEM_Registration::status_id_pending_payment,
684
+						),
685
+						$this->reg_admin_url
686
+					),
687
+					'meta'   => array(
688
+						'title'  => esc_html__('Pending', 'event_espresso'),
689
+						'target' => '',
690
+						'class'  => $this->menu_class . ' ee-toolbar-icon-pending',
691
+					),
692
+				)
693
+			);
694
+		}
695
+	}
696
+
697
+
698
+	/**
699
+	 * @return void
700
+	 */
701
+	private function addRegistrationOverviewThisMonthNotApproved()
702
+	{
703
+		if (
704
+			$this->capabilities->current_user_can(
705
+				'ee_read_registrations',
706
+				'ee_admin_bar_menu_espresso-toolbar-registrations-month-not-approved'
707
+			)
708
+		) {
709
+			$this->admin_bar->add_menu(
710
+				array(
711
+					'id'     => 'espresso-toolbar-registrations-month-not-approved',
712
+					'parent' => 'espresso-toolbar-registrations',
713
+					'title'  => '<span class="ee-toolbar-icon"></span>'
714
+								. esc_html__('Not Approved', 'event_espresso'),
715
+					'href'   => EEH_URL::add_query_args_and_nonce(
716
+						array(
717
+							'action'      => 'default',
718
+							'status'      => 'month',
719
+							'_reg_status' => EEM_Registration::status_id_not_approved,
720
+						),
721
+						$this->reg_admin_url
722
+					),
723
+					'meta'   => array(
724
+						'title'  => esc_html__('Not Approved', 'event_espresso'),
725
+						'target' => '',
726
+						'class'  => $this->menu_class . ' ee-toolbar-icon-not-approved',
727
+					),
728
+				)
729
+			);
730
+		}
731
+	}
732
+
733
+
734
+	/**
735
+	 * @return void
736
+	 */
737
+	private function addRegistrationOverviewThisMonthCancelled()
738
+	{
739
+		if (
740
+			$this->capabilities->current_user_can(
741
+				'ee_read_registrations',
742
+				'ee_admin_bar_menu_espresso-toolbar-registrations-month-cancelled'
743
+			)
744
+		) {
745
+			$this->admin_bar->add_menu(
746
+				array(
747
+					'id'     => 'espresso-toolbar-registrations-month-cancelled',
748
+					'parent' => 'espresso-toolbar-registrations',
749
+					'title'  => '<span class="ee-toolbar-icon"></span>'
750
+								. esc_html__('Cancelled', 'event_espresso'),
751
+					'href'   => EEH_URL::add_query_args_and_nonce(
752
+						array(
753
+							'action'      => 'default',
754
+							'status'      => 'month',
755
+							'_reg_status' => EEM_Registration::status_id_cancelled,
756
+						),
757
+						$this->reg_admin_url
758
+					),
759
+					'meta'   => array(
760
+						'title'  => esc_html__('Cancelled', 'event_espresso'),
761
+						'target' => '',
762
+						'class'  => $this->menu_class . ' ee-toolbar-icon-cancelled',
763
+					),
764
+				)
765
+			);
766
+		}
767
+	}
768
+
769
+
770
+	/**
771
+	 * @return void
772
+	 */
773
+	private function addExtensionsAndServices()
774
+	{
775
+		if (
776
+			$this->capabilities->current_user_can(
777
+				'ee_read_ee',
778
+				'ee_admin_bar_menu_espresso-toolbar-extensions-and-services'
779
+			)
780
+		) {
781
+			$this->admin_bar->add_menu(
782
+				array(
783
+					'id'     => 'espresso-toolbar-extensions-and-services',
784
+					'parent' => 'espresso-toolbar',
785
+					'title'  => '<span class="ee-toolbar-icon"></span>'
786
+								. esc_html__('Extensions & Services', 'event_espresso'),
787
+					'href'   => admin_url('admin.php?page=espresso_packages'),
788
+					'meta'   => array(
789
+						'title'  => esc_html__('Extensions & Services', 'event_espresso'),
790
+						'target' => '',
791
+						'class'  => $this->menu_class,
792
+					),
793
+				)
794
+			);
795
+		}
796
+	}
797 797
 }
Please login to merge, or discard this patch.
core/services/cache/BasicCacheManager.php 2 patches
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -140,7 +140,7 @@  discard block
 block discarded – undo
140 140
         // with these parameters
141 141
         $cache_id .= filter_input(INPUT_SERVER, 'QUERY_STRING', FILTER_SANITIZE_URL);
142 142
         // then md5 the above to control it's length, add all of our prefixes, and truncate
143
-        return substr($this->cachePrefix() . $id_prefix . '-' . md5($cache_id), 0, 182);
143
+        return substr($this->cachePrefix().$id_prefix.'-'.md5($cache_id), 0, 182);
144 144
     }
145 145
 
146 146
 
@@ -170,9 +170,9 @@  discard block
 block discarded – undo
170 170
         return '
171 171
 <div class="ee-cached-content-notice" style="position:fixed; bottom:0; left: 0;">
172 172
     <p style="font-size:9px;font-weight:normal;color:#666;line-height: 12px;margin:0 0 3px 5px">
173
-        <b>' . $type . '</b><span style="color:#999"> : </span>
174
-        <span>' . $cache_id . '</span>
175
-        <span style="margin-left:2em;">' . __FILE__ . '</span>
173
+        <b>' . $type.'</b><span style="color:#999"> : </span>
174
+        <span>' . $cache_id.'</span>
175
+        <span style="margin-left:2em;">' . __FILE__.'</span>
176 176
     </p>
177 177
 </div>';
178 178
     }
Please login to merge, or discard this patch.
Indentation   +130 added lines, -130 removed lines patch added patch discarded remove patch
@@ -14,135 +14,135 @@  discard block
 block discarded – undo
14 14
  */
15 15
 class BasicCacheManager implements CacheManagerInterface
16 16
 {
17
-    /**
18
-     * @type string
19
-     */
20
-    const CACHE_PREFIX = 'ee_cache_';
21
-
22
-
23
-    /**
24
-     * @var CacheStorageInterface $cache_storage
25
-     */
26
-    private $cache_storage;
27
-
28
-
29
-    /**
30
-     * BasicCacheManager constructor.
31
-     *
32
-     * @param CacheStorageInterface $cache_storage [required]
33
-     */
34
-    public function __construct(CacheStorageInterface $cache_storage)
35
-    {
36
-        $this->cache_storage = $cache_storage;
37
-    }
38
-
39
-
40
-    /**
41
-     * returns a string that will be prepended to all cache identifiers
42
-     *
43
-     * @return string
44
-     */
45
-    public function cachePrefix()
46
-    {
47
-        return BasicCacheManager::CACHE_PREFIX;
48
-    }
49
-
50
-
51
-    /**
52
-     * @param string  $id_prefix [required] Prepended to all cache IDs. Can be helpful in finding specific cache types.
53
-     *                           May also be helpful to include an additional specific identifier,
54
-     *                           such as a post ID as part of the $id_prefix so that individual caches
55
-     *                           can be found and/or cleared. ex: "venue-28", or "shortcode-156".
56
-     *                           BasicCacheManager::CACHE_PREFIX will also be prepended to the cache id.
57
-     * @param string  $cache_id  [required] Additional identifying details that make this cache unique.
58
-     *                           It is advisable to use some of the actual data
59
-     *                           that is used to generate the content being cached,
60
-     *                           in order to guarantee that the cache id is unique for that content.
61
-     *                           The cache id will be md5'd before usage to make it more db friendly,
62
-     *                           and the entire cache id string will be truncated to 190 characters.
63
-     * @param Closure $callback  [required] since the point of caching is to avoid generating content when not
64
-     *                           necessary,
65
-     *                           we wrap our content creation in a Closure so that it is not executed until needed.
66
-     * @param int     $expiration
67
-     * @return Closure|mixed
68
-     */
69
-    public function get($id_prefix, $cache_id, Closure $callback, $expiration = HOUR_IN_SECONDS)
70
-    {
71
-        $content = '';
72
-        $expiration = absint(
73
-            apply_filters(
74
-                'FHEE__CacheManager__get__cache_expiration',
75
-                $expiration,
76
-                $id_prefix,
77
-                $cache_id
78
-            )
79
-        );
80
-        $cache_id = $this->generateCacheIdentifier($id_prefix, $cache_id);
81
-        // is caching enabled for this content ?
82
-        if ($expiration) {
83
-            $content = $this->cache_storage->get($cache_id);
84
-        }
85
-        // any existing content ?
86
-        if (empty($content)) {
87
-            // nope! let's generate some new stuff
88
-            $content = $callback();
89
-            // save the new content if caching is enabled
90
-            if ($expiration) {
91
-                $this->cache_storage->add($cache_id, $content, $expiration);
92
-                if (EE_DEBUG) {
93
-                    $content .= $this->displayCacheNotice($cache_id, 'REFRESH CACHE');
94
-                }
95
-            }
96
-        } else {
97
-            if (EE_DEBUG) {
98
-                $content .= $this->displayCacheNotice($cache_id, 'CACHED CONTENT');
99
-            }
100
-        }
101
-        return $content;
102
-    }
103
-
104
-
105
-    /**
106
-     * Generates a unique identifier string for the cache
107
-     *
108
-     * @param string $id_prefix [required] see BasicCacheManager::get()
109
-     * @param string $cache_id  [required] see BasicCacheManager::get()
110
-     * @return string
111
-     */
112
-    private function generateCacheIdentifier($id_prefix, $cache_id)
113
-    {
114
-        // let's make the cached content unique for this "page"
115
-        $cache_id .= filter_input(INPUT_SERVER, 'REQUEST_URI', FILTER_SANITIZE_URL);
116
-        // with these parameters
117
-        $cache_id .= filter_input(INPUT_SERVER, 'QUERY_STRING', FILTER_SANITIZE_URL);
118
-        // then md5 the above to control it's length, add all of our prefixes, and truncate
119
-        return substr($this->cachePrefix() . $id_prefix . '-' . md5($cache_id), 0, 182);
120
-    }
121
-
122
-
123
-    /**
124
-     * @param array|string $cache_id [required] Could be an ID prefix affecting many caches
125
-     *                               or a specific ID targeting a single cache item
126
-     * @return void
127
-     */
128
-    public function clear($cache_id)
129
-    {
130
-        // ensure incoming arg is in an array
131
-        $cache_id = is_array($cache_id) ? $cache_id : array($cache_id);
132
-        // delete corresponding transients for the supplied id prefix
133
-        $this->cache_storage->deleteMany($cache_id);
134
-    }
135
-
136
-
137
-    /**
138
-     * @param array|string $cache_id [required] Could be an ID prefix affecting many caches
139
-     *                               or a specific ID targeting a single cache item
140
-     * @param string       $type
141
-     * @return string
142
-     */
143
-    private function displayCacheNotice($cache_id, $type)
144
-    {
145
-        return '
17
+	/**
18
+	 * @type string
19
+	 */
20
+	const CACHE_PREFIX = 'ee_cache_';
21
+
22
+
23
+	/**
24
+	 * @var CacheStorageInterface $cache_storage
25
+	 */
26
+	private $cache_storage;
27
+
28
+
29
+	/**
30
+	 * BasicCacheManager constructor.
31
+	 *
32
+	 * @param CacheStorageInterface $cache_storage [required]
33
+	 */
34
+	public function __construct(CacheStorageInterface $cache_storage)
35
+	{
36
+		$this->cache_storage = $cache_storage;
37
+	}
38
+
39
+
40
+	/**
41
+	 * returns a string that will be prepended to all cache identifiers
42
+	 *
43
+	 * @return string
44
+	 */
45
+	public function cachePrefix()
46
+	{
47
+		return BasicCacheManager::CACHE_PREFIX;
48
+	}
49
+
50
+
51
+	/**
52
+	 * @param string  $id_prefix [required] Prepended to all cache IDs. Can be helpful in finding specific cache types.
53
+	 *                           May also be helpful to include an additional specific identifier,
54
+	 *                           such as a post ID as part of the $id_prefix so that individual caches
55
+	 *                           can be found and/or cleared. ex: "venue-28", or "shortcode-156".
56
+	 *                           BasicCacheManager::CACHE_PREFIX will also be prepended to the cache id.
57
+	 * @param string  $cache_id  [required] Additional identifying details that make this cache unique.
58
+	 *                           It is advisable to use some of the actual data
59
+	 *                           that is used to generate the content being cached,
60
+	 *                           in order to guarantee that the cache id is unique for that content.
61
+	 *                           The cache id will be md5'd before usage to make it more db friendly,
62
+	 *                           and the entire cache id string will be truncated to 190 characters.
63
+	 * @param Closure $callback  [required] since the point of caching is to avoid generating content when not
64
+	 *                           necessary,
65
+	 *                           we wrap our content creation in a Closure so that it is not executed until needed.
66
+	 * @param int     $expiration
67
+	 * @return Closure|mixed
68
+	 */
69
+	public function get($id_prefix, $cache_id, Closure $callback, $expiration = HOUR_IN_SECONDS)
70
+	{
71
+		$content = '';
72
+		$expiration = absint(
73
+			apply_filters(
74
+				'FHEE__CacheManager__get__cache_expiration',
75
+				$expiration,
76
+				$id_prefix,
77
+				$cache_id
78
+			)
79
+		);
80
+		$cache_id = $this->generateCacheIdentifier($id_prefix, $cache_id);
81
+		// is caching enabled for this content ?
82
+		if ($expiration) {
83
+			$content = $this->cache_storage->get($cache_id);
84
+		}
85
+		// any existing content ?
86
+		if (empty($content)) {
87
+			// nope! let's generate some new stuff
88
+			$content = $callback();
89
+			// save the new content if caching is enabled
90
+			if ($expiration) {
91
+				$this->cache_storage->add($cache_id, $content, $expiration);
92
+				if (EE_DEBUG) {
93
+					$content .= $this->displayCacheNotice($cache_id, 'REFRESH CACHE');
94
+				}
95
+			}
96
+		} else {
97
+			if (EE_DEBUG) {
98
+				$content .= $this->displayCacheNotice($cache_id, 'CACHED CONTENT');
99
+			}
100
+		}
101
+		return $content;
102
+	}
103
+
104
+
105
+	/**
106
+	 * Generates a unique identifier string for the cache
107
+	 *
108
+	 * @param string $id_prefix [required] see BasicCacheManager::get()
109
+	 * @param string $cache_id  [required] see BasicCacheManager::get()
110
+	 * @return string
111
+	 */
112
+	private function generateCacheIdentifier($id_prefix, $cache_id)
113
+	{
114
+		// let's make the cached content unique for this "page"
115
+		$cache_id .= filter_input(INPUT_SERVER, 'REQUEST_URI', FILTER_SANITIZE_URL);
116
+		// with these parameters
117
+		$cache_id .= filter_input(INPUT_SERVER, 'QUERY_STRING', FILTER_SANITIZE_URL);
118
+		// then md5 the above to control it's length, add all of our prefixes, and truncate
119
+		return substr($this->cachePrefix() . $id_prefix . '-' . md5($cache_id), 0, 182);
120
+	}
121
+
122
+
123
+	/**
124
+	 * @param array|string $cache_id [required] Could be an ID prefix affecting many caches
125
+	 *                               or a specific ID targeting a single cache item
126
+	 * @return void
127
+	 */
128
+	public function clear($cache_id)
129
+	{
130
+		// ensure incoming arg is in an array
131
+		$cache_id = is_array($cache_id) ? $cache_id : array($cache_id);
132
+		// delete corresponding transients for the supplied id prefix
133
+		$this->cache_storage->deleteMany($cache_id);
134
+	}
135
+
136
+
137
+	/**
138
+	 * @param array|string $cache_id [required] Could be an ID prefix affecting many caches
139
+	 *                               or a specific ID targeting a single cache item
140
+	 * @param string       $type
141
+	 * @return string
142
+	 */
143
+	private function displayCacheNotice($cache_id, $type)
144
+	{
145
+		return '
146 146
 <div class="ee-cached-content-notice" style="position:fixed; bottom:0; left: 0;">
147 147
     <p style="font-size:9px;font-weight:normal;color:#666;line-height: 12px;margin:0 0 3px 5px">
148 148
         <b>' . $type . '</b><span style="color:#999"> : </span>
@@ -150,5 +150,5 @@  discard block
 block discarded – undo
150 150
         <span style="margin-left:2em;">' . __FILE__ . '</span>
151 151
     </p>
152 152
 </div>';
153
-    }
153
+	}
154 154
 }
Please login to merge, or discard this patch.
acceptance_tests/Page/CoreAdmin.php 2 patches
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -66,9 +66,9 @@  discard block
 block discarded – undo
66 66
      */
67 67
     public static function adminUrl($page = 'espresso_events', $action = 'default', $additional_params = '')
68 68
     {
69
-        $url = self::URL_PREFIX . $page;
70
-        $url .= $action ? '&action=' . $action : '';
71
-        $url .= $additional_params ? '&' . ltrim('&', ltrim('?', $additional_params)) : '';
69
+        $url = self::URL_PREFIX.$page;
70
+        $url .= $action ? '&action='.$action : '';
71
+        $url .= $additional_params ? '&'.ltrim('&', ltrim('?', $additional_params)) : '';
72 72
         return $url;
73 73
     }
74 74
 
@@ -80,7 +80,7 @@  discard block
 block discarded – undo
80 80
      */
81 81
     public static function wpEditorTextTabSelector($field_reference)
82 82
     {
83
-        return '#content-' . $field_reference . '-content-html';
83
+        return '#content-'.$field_reference.'-content-html';
84 84
     }
85 85
 
86 86
 
@@ -91,6 +91,6 @@  discard block
 block discarded – undo
91 91
      */
92 92
     public static function wpEditorTextAreaSelector($field_reference)
93 93
     {
94
-        return '#content-' . $field_reference . '-content';
94
+        return '#content-'.$field_reference.'-content';
95 95
     }
96 96
 }
Please login to merge, or discard this patch.
Indentation   +92 added lines, -92 removed lines patch added patch discarded remove patch
@@ -13,96 +13,96 @@
 block discarded – undo
13 13
 class CoreAdmin
14 14
 {
15 15
 
16
-    /**
17
-     * @var string
18
-     */
19
-    const URL_PREFIX = 'admin.php?page=';
20
-
21
-
22
-    /**
23
-     * This is the selector for the next page button on list tables.
24
-     * @var string
25
-     */
26
-    const ADMIN_LIST_TABLE_NEXT_PAGE_CLASS = '.next-page';
27
-
28
-
29
-    /**
30
-     * The selector for the search input submit button on list table pages
31
-     * @var string
32
-     */
33
-    const LIST_TABLE_SEARCH_SUBMIT_SELECTOR = '#search-submit';
34
-
35
-
36
-    /**
37
-     * Selector for the screen options dropdown.
38
-     * @var string
39
-     */
40
-    const WP_SCREEN_SETTINGS_LINK_SELECTOR = '#show-settings-link';
41
-
42
-
43
-    /**
44
-     * Selector for the per page field setting selector (found within screen options dropdown)
45
-     * @var string
46
-     */
47
-    const WP_SCREEN_SETTINGS_PER_PAGE_FIELD_SELECTOR = '.screen-per-page';
48
-
49
-
50
-    /**
51
-     * Selector for apply screen options settings.
52
-     * @var string
53
-     */
54
-    const WP_SCREEN_OPTIONS_APPLY_SETTINGS_BUTTON_SELECTOR = '#screen-options-apply';
55
-
56
-
57
-    /**
58
-     * Selector for bulk action select field on list tables.
59
-     */
60
-    const SELECTOR_LIST_TABLE_BULK_ACTION_FIELD = '#bulk-action-selector-';
61
-
62
-
63
-    /**
64
-     * Selector for applying a bulk action.
65
-     */
66
-    const SELECTOR_LIST_TABLE_BULK_ACTTION_APPLY = '#doaction';
67
-
68
-
69
-    /**
70
-     * Get the EE admin url for the given properties.
71
-     * Note, this is JUST the endpoint for the admin route.  It is expected that the actor/test would be calling this
72
-     * with `amOnAdminPage` action.
73
-     *
74
-     * @param string $page
75
-     * @param string $action
76
-     * @param string $additional_params
77
-     * @return string
78
-     */
79
-    public static function adminUrl($page = 'espresso_events', $action = 'default', $additional_params = '')
80
-    {
81
-        $url = self::URL_PREFIX . $page;
82
-        $url .= $action ? '&action=' . $action : '';
83
-        $url .= $additional_params ? '&' . ltrim('&', ltrim('?', $additional_params)) : '';
84
-        return $url;
85
-    }
86
-
87
-
88
-    /**
89
-     * Returns the selector for the text tab switcher for a wp-editor instance.
90
-     * @param $field_reference
91
-     * @return string
92
-     */
93
-    public static function wpEditorTextTabSelector($field_reference)
94
-    {
95
-        return '#content-' . $field_reference . '-content-html';
96
-    }
97
-
98
-
99
-    /**
100
-     * Returns the selector for the textarea exposed when clicing the text tab switcher for a wp-editor instance.
101
-     * @param $field_reference
102
-     * @return string
103
-     */
104
-    public static function wpEditorTextAreaSelector($field_reference)
105
-    {
106
-        return '#content-' . $field_reference . '-content';
107
-    }
16
+	/**
17
+	 * @var string
18
+	 */
19
+	const URL_PREFIX = 'admin.php?page=';
20
+
21
+
22
+	/**
23
+	 * This is the selector for the next page button on list tables.
24
+	 * @var string
25
+	 */
26
+	const ADMIN_LIST_TABLE_NEXT_PAGE_CLASS = '.next-page';
27
+
28
+
29
+	/**
30
+	 * The selector for the search input submit button on list table pages
31
+	 * @var string
32
+	 */
33
+	const LIST_TABLE_SEARCH_SUBMIT_SELECTOR = '#search-submit';
34
+
35
+
36
+	/**
37
+	 * Selector for the screen options dropdown.
38
+	 * @var string
39
+	 */
40
+	const WP_SCREEN_SETTINGS_LINK_SELECTOR = '#show-settings-link';
41
+
42
+
43
+	/**
44
+	 * Selector for the per page field setting selector (found within screen options dropdown)
45
+	 * @var string
46
+	 */
47
+	const WP_SCREEN_SETTINGS_PER_PAGE_FIELD_SELECTOR = '.screen-per-page';
48
+
49
+
50
+	/**
51
+	 * Selector for apply screen options settings.
52
+	 * @var string
53
+	 */
54
+	const WP_SCREEN_OPTIONS_APPLY_SETTINGS_BUTTON_SELECTOR = '#screen-options-apply';
55
+
56
+
57
+	/**
58
+	 * Selector for bulk action select field on list tables.
59
+	 */
60
+	const SELECTOR_LIST_TABLE_BULK_ACTION_FIELD = '#bulk-action-selector-';
61
+
62
+
63
+	/**
64
+	 * Selector for applying a bulk action.
65
+	 */
66
+	const SELECTOR_LIST_TABLE_BULK_ACTTION_APPLY = '#doaction';
67
+
68
+
69
+	/**
70
+	 * Get the EE admin url for the given properties.
71
+	 * Note, this is JUST the endpoint for the admin route.  It is expected that the actor/test would be calling this
72
+	 * with `amOnAdminPage` action.
73
+	 *
74
+	 * @param string $page
75
+	 * @param string $action
76
+	 * @param string $additional_params
77
+	 * @return string
78
+	 */
79
+	public static function adminUrl($page = 'espresso_events', $action = 'default', $additional_params = '')
80
+	{
81
+		$url = self::URL_PREFIX . $page;
82
+		$url .= $action ? '&action=' . $action : '';
83
+		$url .= $additional_params ? '&' . ltrim('&', ltrim('?', $additional_params)) : '';
84
+		return $url;
85
+	}
86
+
87
+
88
+	/**
89
+	 * Returns the selector for the text tab switcher for a wp-editor instance.
90
+	 * @param $field_reference
91
+	 * @return string
92
+	 */
93
+	public static function wpEditorTextTabSelector($field_reference)
94
+	{
95
+		return '#content-' . $field_reference . '-content-html';
96
+	}
97
+
98
+
99
+	/**
100
+	 * Returns the selector for the textarea exposed when clicing the text tab switcher for a wp-editor instance.
101
+	 * @param $field_reference
102
+	 * @return string
103
+	 */
104
+	public static function wpEditorTextAreaSelector($field_reference)
105
+	{
106
+		return '#content-' . $field_reference . '-content';
107
+	}
108 108
 }
Please login to merge, or discard this patch.
core/libraries/messages/EE_Message_Template_Group_Collection.lib.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -98,7 +98,7 @@
 block discarded – undo
98 98
     {
99 99
         sort($EVT_ID);
100 100
         $EVT_ID = implode(',', array_unique($EVT_ID));
101
-        return md5($messenger . $message_type . $EVT_ID);
101
+        return md5($messenger.$message_type.$EVT_ID);
102 102
     }
103 103
 
104 104
 
Please login to merge, or discard this patch.
Indentation   +100 added lines, -100 removed lines patch added patch discarded remove patch
@@ -10,114 +10,114 @@
 block discarded – undo
10 10
  */
11 11
 class EE_Message_Template_Group_Collection extends EE_Object_Collection
12 12
 {
13
-    /**
14
-     * EE_Message_Template_Group_Collection constructor.
15
-     */
16
-    public function __construct()
17
-    {
18
-        $this->interface = 'EE_Message_Template_Group';
19
-    }
13
+	/**
14
+	 * EE_Message_Template_Group_Collection constructor.
15
+	 */
16
+	public function __construct()
17
+	{
18
+		$this->interface = 'EE_Message_Template_Group';
19
+	}
20 20
 
21 21
 
22
-    /**
23
-     * Adds the Message Template Group object to the repository.
24
-     *
25
-     * @param           $message_template_group
26
-     * @param array|int $EVT_ID    Some templates are specific to EVT, so this is provided as a way of
27
-     *                         indexing the template by key.  If this template is shared among multiple events then
28
-     *                         include the events as an array.
29
-     * @return bool
30
-     */
31
-    public function add($message_template_group, $EVT_ID = array()): bool
32
-    {
33
-        $EVT_ID = is_array($EVT_ID) ? $EVT_ID : (array) $EVT_ID;
34
-        if ($message_template_group instanceof $this->interface) {
35
-            $data['key'] = $this->getKey(
36
-                $message_template_group->messenger(),
37
-                $message_template_group->message_type(),
38
-                $EVT_ID
39
-            );
40
-            return parent::add($message_template_group, $data);
41
-        }
42
-        return false;
43
-    }
22
+	/**
23
+	 * Adds the Message Template Group object to the repository.
24
+	 *
25
+	 * @param           $message_template_group
26
+	 * @param array|int $EVT_ID    Some templates are specific to EVT, so this is provided as a way of
27
+	 *                         indexing the template by key.  If this template is shared among multiple events then
28
+	 *                         include the events as an array.
29
+	 * @return bool
30
+	 */
31
+	public function add($message_template_group, $EVT_ID = array()): bool
32
+	{
33
+		$EVT_ID = is_array($EVT_ID) ? $EVT_ID : (array) $EVT_ID;
34
+		if ($message_template_group instanceof $this->interface) {
35
+			$data['key'] = $this->getKey(
36
+				$message_template_group->messenger(),
37
+				$message_template_group->message_type(),
38
+				$EVT_ID
39
+			);
40
+			return parent::add($message_template_group, $data);
41
+		}
42
+		return false;
43
+	}
44 44
 
45 45
 
46
-    /**
47
-     * This retrieves any EE_Message_Template_Group in the repo by its ID.
48
-     *
49
-     * @param $GRP_ID
50
-     * @return EE_Message_Template_Group | null
51
-     */
52
-    public function get_by_ID($GRP_ID)
53
-    {
54
-        $this->rewind();
55
-        while ($this->valid()) {
56
-            if ($this->current()->ID() === $GRP_ID) {
57
-                /** @var EE_Message_Template_Group $message_template_group */
58
-                $message_template_group = $this->current();
59
-                $this->rewind();
60
-                return $message_template_group;
61
-            }
62
-            $this->next();
63
-        }
64
-        return null;
65
-    }
46
+	/**
47
+	 * This retrieves any EE_Message_Template_Group in the repo by its ID.
48
+	 *
49
+	 * @param $GRP_ID
50
+	 * @return EE_Message_Template_Group | null
51
+	 */
52
+	public function get_by_ID($GRP_ID)
53
+	{
54
+		$this->rewind();
55
+		while ($this->valid()) {
56
+			if ($this->current()->ID() === $GRP_ID) {
57
+				/** @var EE_Message_Template_Group $message_template_group */
58
+				$message_template_group = $this->current();
59
+				$this->rewind();
60
+				return $message_template_group;
61
+			}
62
+			$this->next();
63
+		}
64
+		return null;
65
+	}
66 66
 
67 67
 
68
-    /**
69
-     * Generates a hash used to identify a given Message Template Group.
70
-     *
71
-     * @param string $messenger    The EE_messenger->name
72
-     * @param string $message_type The EE_message_type->name
73
-     * @param int    $EVT_ID       Optional.  If the template is for a specific EVT then that should be included.
74
-     * @deprecated 4.9.40.rc.017  Use getKey instead.
75
-     * @return string
76
-     */
77
-    public function get_key($messenger, $message_type, $EVT_ID = 0)
78
-    {
79
-        $EVT_ID = (array) $EVT_ID;
80
-        return $this->getKey($messenger, $message_type, $EVT_ID);
81
-    }
68
+	/**
69
+	 * Generates a hash used to identify a given Message Template Group.
70
+	 *
71
+	 * @param string $messenger    The EE_messenger->name
72
+	 * @param string $message_type The EE_message_type->name
73
+	 * @param int    $EVT_ID       Optional.  If the template is for a specific EVT then that should be included.
74
+	 * @deprecated 4.9.40.rc.017  Use getKey instead.
75
+	 * @return string
76
+	 */
77
+	public function get_key($messenger, $message_type, $EVT_ID = 0)
78
+	{
79
+		$EVT_ID = (array) $EVT_ID;
80
+		return $this->getKey($messenger, $message_type, $EVT_ID);
81
+	}
82 82
 
83 83
 
84
-    /**
85
-     * Generates a hash used to identify a given Message Template Group
86
-     * @param string    $messenger      The EE_messenger->name
87
-     * @param string    $message_type   The EE_message_type->name
88
-     * @param array     $EVT_ID         Optional.  If the template is for a specific EVT_ID (or events) then that should
89
-     *                                  be included.
90
-     * @since 4.9.40.rc.017
91
-     * @return string
92
-     */
93
-    public function getKey($messenger, $message_type, array $EVT_ID = array())
94
-    {
95
-        sort($EVT_ID);
96
-        $EVT_ID = implode(',', array_unique($EVT_ID));
97
-        return md5($messenger . $message_type . $EVT_ID);
98
-    }
84
+	/**
85
+	 * Generates a hash used to identify a given Message Template Group
86
+	 * @param string    $messenger      The EE_messenger->name
87
+	 * @param string    $message_type   The EE_message_type->name
88
+	 * @param array     $EVT_ID         Optional.  If the template is for a specific EVT_ID (or events) then that should
89
+	 *                                  be included.
90
+	 * @since 4.9.40.rc.017
91
+	 * @return string
92
+	 */
93
+	public function getKey($messenger, $message_type, array $EVT_ID = array())
94
+	{
95
+		sort($EVT_ID);
96
+		$EVT_ID = implode(',', array_unique($EVT_ID));
97
+		return md5($messenger . $message_type . $EVT_ID);
98
+	}
99 99
 
100 100
 
101
-    /**
102
-     * This returns a saved EE_Message_Template_Group object if there is one in the repository indexed by a key matching
103
-     * the given string.
104
-     *
105
-     * @param string $key @see EE_Message_Template_Group::get_key() to setup a key formatted for searching.
106
-     * @return null|EE_Message_Template_Group
107
-     */
108
-    public function get_by_key($key)
109
-    {
110
-        $this->rewind();
111
-        while ($this->valid()) {
112
-            $data = $this->getInfo();
113
-            if (isset($data['key']) && $data['key'] === $key) {
114
-                /** @var EE_Message_Template_Group $message_template_group */
115
-                $message_template_group = $this->current();
116
-                $this->rewind();
117
-                return $message_template_group;
118
-            }
119
-            $this->next();
120
-        }
121
-        return null;
122
-    }
101
+	/**
102
+	 * This returns a saved EE_Message_Template_Group object if there is one in the repository indexed by a key matching
103
+	 * the given string.
104
+	 *
105
+	 * @param string $key @see EE_Message_Template_Group::get_key() to setup a key formatted for searching.
106
+	 * @return null|EE_Message_Template_Group
107
+	 */
108
+	public function get_by_key($key)
109
+	{
110
+		$this->rewind();
111
+		while ($this->valid()) {
112
+			$data = $this->getInfo();
113
+			if (isset($data['key']) && $data['key'] === $key) {
114
+				/** @var EE_Message_Template_Group $message_template_group */
115
+				$message_template_group = $this->current();
116
+				$this->rewind();
117
+				return $message_template_group;
118
+			}
119
+			$this->next();
120
+		}
121
+		return null;
122
+	}
123 123
 }
Please login to merge, or discard this patch.
libraries/form_sections/strategies/layout/EE_Two_Column_Layout.strategy.php 2 patches
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -18,7 +18,7 @@  discard block
 block discarded – undo
18 18
             $this->_form_section->html_id(),
19 19
             $this->_form_section->html_class(),
20 20
             $this->_form_section->html_style()
21
-        ) . EEH_HTML::tbody();
21
+        ).EEH_HTML::tbody();
22 22
     }
23 23
 
24 24
 
@@ -31,7 +31,7 @@  discard block
 block discarded – undo
31 31
      */
32 32
     public function layout_form_end($additional_args = array())
33 33
     {
34
-        return EEH_HTML::tbodyx() . EEH_HTML::tablex($this->_form_section->html_id());
34
+        return EEH_HTML::tbodyx().EEH_HTML::tablex($this->_form_section->html_id());
35 35
     }
36 36
 
37 37
 
@@ -50,11 +50,11 @@  discard block
 block discarded – undo
50 50
         } else {
51 51
             $html_for_input = $input->get_html_for_input();
52 52
             $html_for_input .= $input->get_html_for_errors() != ''
53
-                ? EEH_HTML::nl() . $input->get_html_for_errors()
53
+                ? EEH_HTML::nl().$input->get_html_for_errors()
54 54
                 : '';
55
-            $html_for_input .= $input->get_html_for_help() != '' ? EEH_HTML::nl() . $input->get_html_for_help() : '';
55
+            $html_for_input .= $input->get_html_for_help() != '' ? EEH_HTML::nl().$input->get_html_for_help() : '';
56 56
             $html .= EEH_HTML::tr(
57
-                EEH_HTML::th($input->get_html_for_label()) .
57
+                EEH_HTML::th($input->get_html_for_label()).
58 58
                 EEH_HTML::td($html_for_input)
59 59
             );
60 60
         }
Please login to merge, or discard this patch.
Indentation   +69 added lines, -69 removed lines patch added patch discarded remove patch
@@ -3,82 +3,82 @@
 block discarded – undo
3 3
 class EE_Two_Column_Layout extends EE_Form_Section_Layout_Base
4 4
 {
5 5
 
6
-    /**
7
-     * Should be used to start teh form section (Eg a table tag, or a div tag, etc.)
8
-     *
9
-     * @param array $additional_args
10
-     * @return string
11
-     */
12
-    public function layout_form_begin($additional_args = array())
13
-    {
14
-        return $this->display_form_wide_errors()
15
-        . EEH_HTML::table(
16
-            '',
17
-            $this->_form_section->html_id(),
18
-            $this->_form_section->html_class(),
19
-            $this->_form_section->html_style()
20
-        ) . EEH_HTML::tbody();
21
-    }
6
+	/**
7
+	 * Should be used to start teh form section (Eg a table tag, or a div tag, etc.)
8
+	 *
9
+	 * @param array $additional_args
10
+	 * @return string
11
+	 */
12
+	public function layout_form_begin($additional_args = array())
13
+	{
14
+		return $this->display_form_wide_errors()
15
+		. EEH_HTML::table(
16
+			'',
17
+			$this->_form_section->html_id(),
18
+			$this->_form_section->html_class(),
19
+			$this->_form_section->html_style()
20
+		) . EEH_HTML::tbody();
21
+	}
22 22
 
23 23
 
24 24
 
25
-    /**
26
-     * Should be used to end the form section (eg a /table tag, or a /div tag, etc)
27
-     *
28
-     * @param array $additional_args
29
-     * @return string
30
-     */
31
-    public function layout_form_end($additional_args = array())
32
-    {
33
-        return EEH_HTML::tbodyx() . EEH_HTML::tablex($this->_form_section->html_id());
34
-    }
25
+	/**
26
+	 * Should be used to end the form section (eg a /table tag, or a /div tag, etc)
27
+	 *
28
+	 * @param array $additional_args
29
+	 * @return string
30
+	 */
31
+	public function layout_form_end($additional_args = array())
32
+	{
33
+		return EEH_HTML::tbodyx() . EEH_HTML::tablex($this->_form_section->html_id());
34
+	}
35 35
 
36 36
 
37 37
 
38
-    /**
39
-     * Lays out the row for the input, including label and errors
40
-     *
41
-     * @param EE_Form_Input_Base $input
42
-     * @return string
43
-     */
44
-    public function layout_input($input)
45
-    {
46
-        $html = '';
47
-        if ($input instanceof EE_Hidden_Input) {
48
-            $html .= $input->get_html_for_input();
49
-        } else {
50
-            $html_for_input = $input->get_html_for_input();
51
-            $html_for_input .= $input->get_html_for_errors() != ''
52
-                ? EEH_HTML::nl() . $input->get_html_for_errors()
53
-                : '';
54
-            $html_for_input .= $input->get_html_for_help() != '' ? EEH_HTML::nl() . $input->get_html_for_help() : '';
55
-            $html .= EEH_HTML::tr(
56
-                EEH_HTML::th($input->get_html_for_label()) .
57
-                EEH_HTML::td($html_for_input)
58
-            );
59
-        }
60
-        return $html;
61
-    }
38
+	/**
39
+	 * Lays out the row for the input, including label and errors
40
+	 *
41
+	 * @param EE_Form_Input_Base $input
42
+	 * @return string
43
+	 */
44
+	public function layout_input($input)
45
+	{
46
+		$html = '';
47
+		if ($input instanceof EE_Hidden_Input) {
48
+			$html .= $input->get_html_for_input();
49
+		} else {
50
+			$html_for_input = $input->get_html_for_input();
51
+			$html_for_input .= $input->get_html_for_errors() != ''
52
+				? EEH_HTML::nl() . $input->get_html_for_errors()
53
+				: '';
54
+			$html_for_input .= $input->get_html_for_help() != '' ? EEH_HTML::nl() . $input->get_html_for_help() : '';
55
+			$html .= EEH_HTML::tr(
56
+				EEH_HTML::th($input->get_html_for_label()) .
57
+				EEH_HTML::td($html_for_input)
58
+			);
59
+		}
60
+		return $html;
61
+	}
62 62
 
63 63
 
64 64
 
65
-    /**
66
-     * Lays out a row for the subsection. Please note that if you have a subsection which you don't want wrapped in
67
-     * a tr and td with a colspan=2, you should use a different layout strategy, like EE_No_Layout, EE_Template_Layout,
68
-     * or EE_Div_Per_Section_Layout, and create subsections using EE_Two_Column_Layout for everywhere you want the
69
-     * two-column layout, and then other sub-sections can be outside the EE_Two_Column_Layout table.
70
-     *
71
-     * @param EE_Form_Section_Proper $form_section
72
-     * @return string
73
-    */
74
-    public function layout_subsection($form_section)
75
-    {
76
-        if (
77
-            $form_section instanceof EE_Form_Section_Proper
78
-            || $form_section instanceof EE_Form_Section_HTML
79
-        ) {
80
-            return EEH_HTML::no_row($form_section->get_html());
81
-        }
82
-        return '';
83
-    }
65
+	/**
66
+	 * Lays out a row for the subsection. Please note that if you have a subsection which you don't want wrapped in
67
+	 * a tr and td with a colspan=2, you should use a different layout strategy, like EE_No_Layout, EE_Template_Layout,
68
+	 * or EE_Div_Per_Section_Layout, and create subsections using EE_Two_Column_Layout for everywhere you want the
69
+	 * two-column layout, and then other sub-sections can be outside the EE_Two_Column_Layout table.
70
+	 *
71
+	 * @param EE_Form_Section_Proper $form_section
72
+	 * @return string
73
+	 */
74
+	public function layout_subsection($form_section)
75
+	{
76
+		if (
77
+			$form_section instanceof EE_Form_Section_Proper
78
+			|| $form_section instanceof EE_Form_Section_HTML
79
+		) {
80
+			return EEH_HTML::no_row($form_section->get_html());
81
+		}
82
+		return '';
83
+	}
84 84
 }
Please login to merge, or discard this patch.
acceptance_tests/Page/CountrySettingsAdmin.php 1 patch
Indentation   +38 added lines, -38 removed lines patch added patch discarded remove patch
@@ -14,51 +14,51 @@
 block discarded – undo
14 14
 {
15 15
 
16 16
 
17
-    const COUNTRY_SETTINGS_SAVE_BUTTON = '#country_settings_save_2';
17
+	const COUNTRY_SETTINGS_SAVE_BUTTON = '#country_settings_save_2';
18 18
 
19 19
 
20 20
 
21
-    /**
22
-     * Return the url for the country settings admin page.
23
-     * @param string $additional_params
24
-     * @return string
25
-     */
26
-    public static function url($additional_params = '')
27
-    {
28
-        return self::adminUrl('espresso_general_settings', 'country_settings', $additional_params);
29
-    }
21
+	/**
22
+	 * Return the url for the country settings admin page.
23
+	 * @param string $additional_params
24
+	 * @return string
25
+	 */
26
+	public static function url($additional_params = '')
27
+	{
28
+		return self::adminUrl('espresso_general_settings', 'country_settings', $additional_params);
29
+	}
30 30
 
31 31
 
32
-    /**
33
-     * Return the decimal places (precision) radio field locator for selection.
34
-     * @param int    $decimal_place_value
35
-     * @param string $country_code
36
-     * @return string
37
-     */
38
-    public static function currencyDecimalPlacesRadioField($decimal_place_value = 2, $country_code = 'US')
39
-    {
40
-        return "//input[@id='CNT_cur_dec_plc-$country_code-$decimal_place_value']";
41
-    }
32
+	/**
33
+	 * Return the decimal places (precision) radio field locator for selection.
34
+	 * @param int    $decimal_place_value
35
+	 * @param string $country_code
36
+	 * @return string
37
+	 */
38
+	public static function currencyDecimalPlacesRadioField($decimal_place_value = 2, $country_code = 'US')
39
+	{
40
+		return "//input[@id='CNT_cur_dec_plc-$country_code-$decimal_place_value']";
41
+	}
42 42
 
43 43
 
44
-    /**
45
-     * Return the currency decimal mark field locator for selection.
46
-     * @param string $decimal_mark
47
-     * @return string
48
-     */
49
-    public static function currencyDecimalMarkRadioField($decimal_mark = '.')
50
-    {
51
-        return "//input[@class='CNT_cur_dec_mrk' and @value='$decimal_mark']";
52
-    }
44
+	/**
45
+	 * Return the currency decimal mark field locator for selection.
46
+	 * @param string $decimal_mark
47
+	 * @return string
48
+	 */
49
+	public static function currencyDecimalMarkRadioField($decimal_mark = '.')
50
+	{
51
+		return "//input[@class='CNT_cur_dec_mrk' and @value='$decimal_mark']";
52
+	}
53 53
 
54 54
 
55
-    /**
56
-     * Return the currency thousands separator field locator for selection.
57
-     * @param string $thousands_separator
58
-     * @return string
59
-     */
60
-    public static function currencyThousandsSeparatorField($thousands_separator = ',')
61
-    {
62
-        return "//input[@class='CNT_cur_thsnds' and @value='$thousands_separator']";
63
-    }
55
+	/**
56
+	 * Return the currency thousands separator field locator for selection.
57
+	 * @param string $thousands_separator
58
+	 * @return string
59
+	 */
60
+	public static function currencyThousandsSeparatorField($thousands_separator = ',')
61
+	{
62
+		return "//input[@class='CNT_cur_thsnds' and @value='$thousands_separator']";
63
+	}
64 64
 }
65 65
\ No newline at end of file
Please login to merge, or discard this patch.
strategies/validation/EE_Email_Validation_Strategy.strategy.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -23,7 +23,7 @@
 block discarded – undo
23 23
      */
24 24
     public function __construct($validation_error_message = '')
25 25
     {
26
-        if (! $validation_error_message) {
26
+        if ( ! $validation_error_message) {
27 27
             $validation_error_message = esc_html__('Please enter a valid email address.', 'event_espresso');
28 28
         }
29 29
         parent::__construct($validation_error_message);
Please login to merge, or discard this patch.
Indentation   +59 added lines, -59 removed lines patch added patch discarded remove patch
@@ -15,72 +15,72 @@
 block discarded – undo
15 15
  */
16 16
 class EE_Email_Validation_Strategy extends EE_Text_Validation_Strategy
17 17
 {
18
-    /**
19
-     * @param string               $validation_error_message
20
-     */
21
-    public function __construct($validation_error_message = '')
22
-    {
23
-        if (! $validation_error_message) {
24
-            $validation_error_message = esc_html__('Please enter a valid email address.', 'event_espresso');
25
-        }
26
-        parent::__construct($validation_error_message);
27
-    }
18
+	/**
19
+	 * @param string               $validation_error_message
20
+	 */
21
+	public function __construct($validation_error_message = '')
22
+	{
23
+		if (! $validation_error_message) {
24
+			$validation_error_message = esc_html__('Please enter a valid email address.', 'event_espresso');
25
+		}
26
+		parent::__construct($validation_error_message);
27
+	}
28 28
 
29 29
 
30 30
 
31
-    /**
32
-     * just checks the field isn't blank
33
-     *
34
-     * @param $normalized_value
35
-     * @return bool
36
-     * @throws InvalidArgumentException
37
-     * @throws InvalidInterfaceException
38
-     * @throws InvalidDataTypeException
39
-     * @throws EE_Validation_Error
40
-     */
41
-    public function validate($normalized_value)
42
-    {
43
-        if ($normalized_value && ! $this->_validate_email($normalized_value)) {
44
-            throw new EE_Validation_Error($this->get_validation_error_message(), 'required');
45
-        }
46
-        return true;
47
-    }
31
+	/**
32
+	 * just checks the field isn't blank
33
+	 *
34
+	 * @param $normalized_value
35
+	 * @return bool
36
+	 * @throws InvalidArgumentException
37
+	 * @throws InvalidInterfaceException
38
+	 * @throws InvalidDataTypeException
39
+	 * @throws EE_Validation_Error
40
+	 */
41
+	public function validate($normalized_value)
42
+	{
43
+		if ($normalized_value && ! $this->_validate_email($normalized_value)) {
44
+			throw new EE_Validation_Error($this->get_validation_error_message(), 'required');
45
+		}
46
+		return true;
47
+	}
48 48
 
49 49
 
50 50
 
51
-    /**
52
-     * @return array
53
-     */
54
-    public function get_jquery_validation_rule_array()
55
-    {
56
-        return array('email' => true, 'messages' => array('email' => $this->get_validation_error_message()));
57
-    }
51
+	/**
52
+	 * @return array
53
+	 */
54
+	public function get_jquery_validation_rule_array()
55
+	{
56
+		return array('email' => true, 'messages' => array('email' => $this->get_validation_error_message()));
57
+	}
58 58
 
59 59
 
60 60
 
61
-    /**
62
-     * Validate an email address.
63
-     * Provide email address (raw input)
64
-     *
65
-     * @param $email
66
-     * @return bool of whether the email is valid or not
67
-     * @throws InvalidArgumentException
68
-     * @throws InvalidInterfaceException
69
-     * @throws InvalidDataTypeException
70
-     * @throws EE_Validation_Error
71
-     */
72
-    private function _validate_email($email)
73
-    {
74
-        try {
75
-            EmailAddressFactory::create($email);
76
-        } catch (EmailValidationException $e) {
77
-            throw new EE_Validation_Error(
78
-                $e->getMessage(),
79
-                'invalid_email',
80
-                $this->_input,
81
-                $e
82
-            );
83
-        }
84
-        return true;
85
-    }
61
+	/**
62
+	 * Validate an email address.
63
+	 * Provide email address (raw input)
64
+	 *
65
+	 * @param $email
66
+	 * @return bool of whether the email is valid or not
67
+	 * @throws InvalidArgumentException
68
+	 * @throws InvalidInterfaceException
69
+	 * @throws InvalidDataTypeException
70
+	 * @throws EE_Validation_Error
71
+	 */
72
+	private function _validate_email($email)
73
+	{
74
+		try {
75
+			EmailAddressFactory::create($email);
76
+		} catch (EmailValidationException $e) {
77
+			throw new EE_Validation_Error(
78
+				$e->getMessage(),
79
+				'invalid_email',
80
+				$this->_input,
81
+				$e
82
+			);
83
+		}
84
+		return true;
85
+	}
86 86
 }
Please login to merge, or discard this patch.
acceptance_tests/tests/e-TestContextActivationToggleCept.php 1 patch
Indentation   +62 added lines, -62 removed lines patch added patch discarded remove patch
@@ -8,8 +8,8 @@  discard block
 block discarded – undo
8 8
 $event_label = 'Testing Context Deactivation';
9 9
 
10 10
 $I->wantTo(
11
-    'Test that the context activation toggle for turning on or off specific contexts for message sending works as'
12
-    . ' expected'
11
+	'Test that the context activation toggle for turning on or off specific contexts for message sending works as'
12
+	. ' expected'
13 13
 );
14 14
 
15 15
 $I->loginAsAdmin();
@@ -34,7 +34,7 @@  discard block
 block discarded – undo
34 34
 $I->see('The template for Primary Registrant Recipient is currently inactive.');
35 35
 
36 36
 $I->amGoingTo(
37
-    'Trigger Registration Approved Messages and verify primary registrant context is excluded from sent messages.'
37
+	'Trigger Registration Approved Messages and verify primary registrant context is excluded from sent messages.'
38 38
 );
39 39
 $I->amOnDefaultEventsListTablePage();
40 40
 $I->click(EventsAdmin::ADD_NEW_EVENT_BUTTON_SELECTOR);
@@ -44,9 +44,9 @@  discard block
 block discarded – undo
44 44
 $event_link = $I->observeLinkUrlAt(EventsAdmin::EVENT_EDITOR_VIEW_LINK_AFTER_PUBLISH_SELECTOR);
45 45
 $event_id = $I->observeValueFromInputAt(EventsAdmin::EVENT_EDITOR_EVT_ID_SELECTOR);
46 46
 $test_registration_details = array(
47
-    'fname' => 'ContextTestGuy',
48
-    'lname' => 'ContextTestDude',
49
-    'email' => '[email protected]',
47
+	'fname' => 'ContextTestGuy',
48
+	'lname' => 'ContextTestDude',
49
+	'email' => '[email protected]',
50 50
 );
51 51
 $I->logOut();
52 52
 $I->amOnUrl($event_link);
@@ -63,48 +63,48 @@  discard block
 block discarded – undo
63 63
 $I->amOnMessagesActivityListTablePage();
64 64
 //verify registrant context
65 65
 $I->see(
66
-    $test_registration_details['email'],
67
-    MessagesAdmin::messagesActivityListTableCellSelectorFor(
68
-        'to',
69
-        'Registration Approved',
70
-        MessagesAdmin::MESSAGE_STATUS_SENT,
71
-        '',
72
-        'Registrant'
73
-    )
66
+	$test_registration_details['email'],
67
+	MessagesAdmin::messagesActivityListTableCellSelectorFor(
68
+		'to',
69
+		'Registration Approved',
70
+		MessagesAdmin::MESSAGE_STATUS_SENT,
71
+		'',
72
+		'Registrant'
73
+	)
74 74
 );
75 75
 $I->deleteMessageInMessagesListTableFor(
76
-    'Registration Approved',
77
-    MessagesAdmin::MESSAGE_STATUS_SENT,
78
-    'Email',
79
-    'Registrant'
76
+	'Registration Approved',
77
+	MessagesAdmin::MESSAGE_STATUS_SENT,
78
+	'Email',
79
+	'Registrant'
80 80
 );
81 81
 //verify admin context
82 82
 $I->see(
83
-    '[email protected]',
84
-    MessagesAdmin::messagesActivityListTableCellSelectorFor(
85
-        'to',
86
-        'Registration Approved',
87
-        MessagesAdmin::MESSAGE_STATUS_SENT
88
-    )
83
+	'[email protected]',
84
+	MessagesAdmin::messagesActivityListTableCellSelectorFor(
85
+		'to',
86
+		'Registration Approved',
87
+		MessagesAdmin::MESSAGE_STATUS_SENT
88
+	)
89 89
 );
90 90
 $I->deleteMessageInMessagesListTableFor(
91
-    'Registration Approved'
91
+	'Registration Approved'
92 92
 );
93 93
 //verify primary registrant context is NOT present.
94 94
 $I->dontSee(
95
-    $test_registration_details['email'],
96
-    MessagesAdmin::messagesActivityListTableCellSelectorFor(
97
-        'to',
98
-        'Registration Approved',
99
-        MessagesAdmin::MESSAGE_STATUS_SENT,
100
-        '',
101
-        'Primary Registrant'
102
-    )
95
+	$test_registration_details['email'],
96
+	MessagesAdmin::messagesActivityListTableCellSelectorFor(
97
+		'to',
98
+		'Registration Approved',
99
+		MessagesAdmin::MESSAGE_STATUS_SENT,
100
+		'',
101
+		'Primary Registrant'
102
+	)
103 103
 );
104 104
 
105 105
 $I->amGoingTo(
106
-    'Deactivate primary registrant context for Registration Approved Message Templates and restore the "To"'
107
-    . ' field to an empty string to verify the message does not send for that context.'
106
+	'Deactivate primary registrant context for Registration Approved Message Templates and restore the "To"'
107
+	. ' field to an empty string to verify the message does not send for that context.'
108 108
 );
109 109
 $I->amOnDefaultMessageTemplateListTablePage();
110 110
 $I->clickToEditMessageTemplateByMessageType('registration', 'primary_attendee');
@@ -128,41 +128,41 @@  discard block
 block discarded – undo
128 128
 $I->amOnMessagesActivityListTablePage();
129 129
 //verify registrant context
130 130
 $I->see(
131
-    $test_registration_details['email'],
132
-    MessagesAdmin::messagesActivityListTableCellSelectorFor(
133
-        'to',
134
-        'Registration Approved',
135
-        MessagesAdmin::MESSAGE_STATUS_SENT,
136
-        '',
137
-        'Registrant'
138
-    )
131
+	$test_registration_details['email'],
132
+	MessagesAdmin::messagesActivityListTableCellSelectorFor(
133
+		'to',
134
+		'Registration Approved',
135
+		MessagesAdmin::MESSAGE_STATUS_SENT,
136
+		'',
137
+		'Registrant'
138
+	)
139 139
 );
140 140
 $I->deleteMessageInMessagesListTableFor(
141
-    'Registration Approved',
142
-    MessagesAdmin::MESSAGE_STATUS_SENT,
143
-    'Email',
144
-    'Registrant'
141
+	'Registration Approved',
142
+	MessagesAdmin::MESSAGE_STATUS_SENT,
143
+	'Email',
144
+	'Registrant'
145 145
 );
146 146
 //verify admin context
147 147
 $I->see(
148
-    '[email protected]',
149
-    MessagesAdmin::messagesActivityListTableCellSelectorFor(
150
-        'to',
151
-        'Registration Approved',
152
-        MessagesAdmin::MESSAGE_STATUS_SENT
153
-    )
148
+	'[email protected]',
149
+	MessagesAdmin::messagesActivityListTableCellSelectorFor(
150
+		'to',
151
+		'Registration Approved',
152
+		MessagesAdmin::MESSAGE_STATUS_SENT
153
+	)
154 154
 );
155 155
 $I->deleteMessageInMessagesListTableFor(
156
-    'Registration Approved'
156
+	'Registration Approved'
157 157
 );
158 158
 //verify primary registrant context is NOT present.
159 159
 $I->dontSee(
160
-    $test_registration_details['email'],
161
-    MessagesAdmin::messagesActivityListTableCellSelectorFor(
162
-        'to',
163
-        'Registration Approved',
164
-        MessagesAdmin::MESSAGE_STATUS_SENT,
165
-        '',
166
-        'Primary Registrant'
167
-    )
160
+	$test_registration_details['email'],
161
+	MessagesAdmin::messagesActivityListTableCellSelectorFor(
162
+		'to',
163
+		'Registration Approved',
164
+		MessagesAdmin::MESSAGE_STATUS_SENT,
165
+		'',
166
+		'Primary Registrant'
167
+	)
168 168
 );
169 169
\ No newline at end of file
Please login to merge, or discard this patch.
admin_pages/messages/help_tabs/messages_settings_messengers.help_tab.php 2 patches
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -19,16 +19,16 @@
 block discarded – undo
19 19
             'The green colored gear %s indicates that this messenger is currently active.',
20 20
             'event_espresso'
21 21
         ),
22
-        '<img class="inline-text" src="' . EE_MSG_ASSETS_URL . 'images/email-tab-active.png' . '"'
23
-        . ' alt="' . esc_attr__('Active Email Tab', 'event_espresso') . '" />'
22
+        '<img class="inline-text" src="'.EE_MSG_ASSETS_URL.'images/email-tab-active.png'.'"'
23
+        . ' alt="'.esc_attr__('Active Email Tab', 'event_espresso').'" />'
24 24
     );
25 25
     printf(
26 26
         esc_html__(
27 27
             ' The white colored gear %s indicates the messenger is inactive. This is very helpful for seeing at a glance all the messengers that are active when you first view the page.',
28 28
             'event_espresso'
29 29
         ),
30
-        '<img class="inline-text" src="' . EE_MSG_ASSETS_URL . 'images/email-tab-inactive.png'
31
-        . '" alt="' . esc_attr__('Inactive Email Tab', 'event_espresso') . '" />'
30
+        '<img class="inline-text" src="'.EE_MSG_ASSETS_URL.'images/email-tab-inactive.png'
31
+        . '" alt="'.esc_attr__('Inactive Email Tab', 'event_espresso').'" />'
32 32
     ); ?>
33 33
 </p>
34 34
 <p>
Please login to merge, or discard this patch.
Indentation   +50 added lines, -50 removed lines patch added patch discarded remove patch
@@ -3,79 +3,79 @@
 block discarded – undo
3 3
 </p>
4 4
 <p>
5 5
     <?php esc_html_e(
6
-        'You can select Messengers via the tabs across the top of the settings page. The available messengers you see depends on what version of Event Espresso you have and what addons are installed. Every install include an "Email" messenger tab.  When you click one of those tabs it will display that messenger.',
7
-        'event_espresso'
8
-    ); ?>
6
+		'You can select Messengers via the tabs across the top of the settings page. The available messengers you see depends on what version of Event Espresso you have and what addons are installed. Every install include an "Email" messenger tab.  When you click one of those tabs it will display that messenger.',
7
+		'event_espresso'
8
+	); ?>
9 9
 </p>
10 10
 <p>
11 11
     <?php esc_html_e(
12
-        'There are two ways to determine whether a messenger is active or not.  The first way is via the messenger tab itself.',
13
-        'event_espresso'
14
-    ); ?>
12
+		'There are two ways to determine whether a messenger is active or not.  The first way is via the messenger tab itself.',
13
+		'event_espresso'
14
+	); ?>
15 15
 </p>
16 16
 <p>
17 17
     <?php printf(
18
-        esc_html__(
19
-            'The green colored gear %s indicates that this messenger is currently active.',
20
-            'event_espresso'
21
-        ),
22
-        '<img class="inline-text" src="' . EE_MSG_ASSETS_URL . 'images/email-tab-active.png' . '"'
23
-        . ' alt="' . esc_attr__('Active Email Tab', 'event_espresso') . '" />'
24
-    );
25
-    printf(
26
-        esc_html__(
27
-            ' The white colored gear %s indicates the messenger is inactive. This is very helpful for seeing at a glance all the messengers that are active when you first view the page.',
28
-            'event_espresso'
29
-        ),
30
-        '<img class="inline-text" src="' . EE_MSG_ASSETS_URL . 'images/email-tab-inactive.png'
31
-        . '" alt="' . esc_attr__('Inactive Email Tab', 'event_espresso') . '" />'
32
-    ); ?>
18
+		esc_html__(
19
+			'The green colored gear %s indicates that this messenger is currently active.',
20
+			'event_espresso'
21
+		),
22
+		'<img class="inline-text" src="' . EE_MSG_ASSETS_URL . 'images/email-tab-active.png' . '"'
23
+		. ' alt="' . esc_attr__('Active Email Tab', 'event_espresso') . '" />'
24
+	);
25
+	printf(
26
+		esc_html__(
27
+			' The white colored gear %s indicates the messenger is inactive. This is very helpful for seeing at a glance all the messengers that are active when you first view the page.',
28
+			'event_espresso'
29
+		),
30
+		'<img class="inline-text" src="' . EE_MSG_ASSETS_URL . 'images/email-tab-inactive.png'
31
+		. '" alt="' . esc_attr__('Inactive Email Tab', 'event_espresso') . '" />'
32
+	); ?>
33 33
 </p>
34 34
 <p>
35 35
     <?php esc_html_e(
36
-        'The second way to determine whether a messenger is active or not is via the "on/off" button in the top right corner of the active messenger displayed content:',
37
-        'event_espresso'
38
-    ); ?>
36
+		'The second way to determine whether a messenger is active or not is via the "on/off" button in the top right corner of the active messenger displayed content:',
37
+		'event_espresso'
38
+	); ?>
39 39
 </p>
40 40
 <p>
41 41
     <?php printf(
42
-        esc_html__(
43
-            '%1$s means of course that the messenger is active and %2$s means the messenger is inactive.',
44
-            'event_espresso'
45
-        ),
46
-        '<div class="switch">'
47
-        . '<input class="ee-on-off-toggle ee-toggle-round-flat" type="checkbox" checked disabled>'
48
-        . '<label for="ee-on-off-toggle-on"></label>'
49
-        . '</div>',
50
-        '<div class="switch">'
51
-        . '<input class="ee-on-off-toggle ee-toggle-round-flat" type="checkbox" disabled>'
52
-        . '<label for="ee-on-off-toggle-on"></label>'
53
-        . '</div>'
54
-    ); ?>
42
+		esc_html__(
43
+			'%1$s means of course that the messenger is active and %2$s means the messenger is inactive.',
44
+			'event_espresso'
45
+		),
46
+		'<div class="switch">'
47
+		. '<input class="ee-on-off-toggle ee-toggle-round-flat" type="checkbox" checked disabled>'
48
+		. '<label for="ee-on-off-toggle-on"></label>'
49
+		. '</div>',
50
+		'<div class="switch">'
51
+		. '<input class="ee-on-off-toggle ee-toggle-round-flat" type="checkbox" disabled>'
52
+		. '<label for="ee-on-off-toggle-on"></label>'
53
+		. '</div>'
54
+	); ?>
55 55
 </p>
56 56
 <p>
57 57
     <?php
58
-    esc_html_e(
59
-        'The on/off toggle is also what you use to activate or deactivate a messenger.',
60
-        'event_espresso'
61
-    ); ?>
58
+	esc_html_e(
59
+		'The on/off toggle is also what you use to activate or deactivate a messenger.',
60
+		'event_espresso'
61
+	); ?>
62 62
 </p>
63 63
 <p>
64 64
     <?php esc_html_e(
65
-        'What happens when you click the toggle to activate is the messenger is activated and the system determines what default message types are activated with the messenger.  Then, if there are any default settings for either the messenger or message types those settings are saved.  Next, the system will generate any default templates (if none have been generated before, if there are previously generated templates then they are reactivated).  Finally, you will see the display change to reflect that the messenger is active. If the messenger has settings you can modify them then. Any message types that have settings will also automatically expand so you can see the default settings and make any changes as necessary to fit your needs. Usually the defaults are sufficient however.',
66
-        'event_espresso'
67
-    ); ?>
65
+		'What happens when you click the toggle to activate is the messenger is activated and the system determines what default message types are activated with the messenger.  Then, if there are any default settings for either the messenger or message types those settings are saved.  Next, the system will generate any default templates (if none have been generated before, if there are previously generated templates then they are reactivated).  Finally, you will see the display change to reflect that the messenger is active. If the messenger has settings you can modify them then. Any message types that have settings will also automatically expand so you can see the default settings and make any changes as necessary to fit your needs. Usually the defaults are sufficient however.',
66
+		'event_espresso'
67
+	); ?>
68 68
 </p>
69 69
 <p>
70 70
     <?php esc_html_e(
71
-        'When you deactivate a messenger, the system will first check if there are any custom event templates for that messenger. If there are you will be unable to deactivate the messenger. This is a fail safe to make sure you know that no messages will go out for those specific events so you don\'t accidentally deactivate.  If this check passes, then the system will deactivate any global templates for that messenger (note the templates are not erased, they just become inactive, so if you decide to reactivate the messenger later all your customizations are preserved). Then the display will change to reflect the deactivation.',
72
-        'event_espresso'
73
-    ); ?>
71
+		'When you deactivate a messenger, the system will first check if there are any custom event templates for that messenger. If there are you will be unable to deactivate the messenger. This is a fail safe to make sure you know that no messages will go out for those specific events so you don\'t accidentally deactivate.  If this check passes, then the system will deactivate any global templates for that messenger (note the templates are not erased, they just become inactive, so if you decide to reactivate the messenger later all your customizations are preserved). Then the display will change to reflect the deactivation.',
72
+		'event_espresso'
73
+	); ?>
74 74
 </p>
75 75
 <p>
76 76
     <strong><?php esc_html_e('Important', 'event_espresso'); ?></strong><br />
77 77
     <?php esc_html_e(
78
-        'Although customizations made to global templates are preserved when a messenger is deactivated, any settings for that messenger (or the message types that were attached to it) are lost on deactivation.  Also, once you deactivate a messenger, no more messages will be delivered using that messenger for any of your events.',
79
-        'event_espresso'
80
-    ); ?>
78
+		'Although customizations made to global templates are preserved when a messenger is deactivated, any settings for that messenger (or the message types that were attached to it) are lost on deactivation.  Also, once you deactivate a messenger, no more messages will be delivered using that messenger for any of your events.',
79
+		'event_espresso'
80
+	); ?>
81 81
 </p>
Please login to merge, or discard this patch.