|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
namespace EventEspresso\core\domain\services\admin; |
|
4
|
|
|
|
|
5
|
|
|
use EE_Capabilities; |
|
6
|
|
|
use EE_Maintenance_Mode; |
|
7
|
|
|
use EEH_URL; |
|
8
|
|
|
use EEM_Registration; |
|
9
|
|
|
use WP_Admin_Bar; |
|
10
|
|
|
|
|
11
|
|
|
defined('EVENT_ESPRESSO_VERSION') || exit('No direct script access allowed'); |
|
12
|
|
|
|
|
13
|
|
|
|
|
14
|
|
|
/** |
|
15
|
|
|
* AdminToolBar |
|
16
|
|
|
* Adds Event Espresso items to the WordPress Admin Bar |
|
17
|
|
|
* |
|
18
|
|
|
* @package Event Espresso |
|
19
|
|
|
* @subpackage core/ |
|
20
|
|
|
* @author Brent Christensen |
|
21
|
|
|
*/ |
|
22
|
|
|
class AdminToolBar |
|
23
|
|
|
{ |
|
24
|
|
|
|
|
25
|
|
|
/** |
|
26
|
|
|
* @var WP_Admin_Bar $admin_bar |
|
27
|
|
|
*/ |
|
28
|
|
|
private $admin_bar; |
|
29
|
|
|
|
|
30
|
|
|
/** |
|
31
|
|
|
* @var EE_Capabilities $capabilities |
|
32
|
|
|
*/ |
|
33
|
|
|
private $capabilities; |
|
34
|
|
|
|
|
35
|
|
|
/** |
|
36
|
|
|
* @var string $events_admin_url |
|
37
|
|
|
*/ |
|
38
|
|
|
private $events_admin_url; |
|
39
|
|
|
|
|
40
|
|
|
/** |
|
41
|
|
|
* @var string $menu_class |
|
42
|
|
|
*/ |
|
43
|
|
|
private $menu_class = 'espresso_menu_item_class'; |
|
44
|
|
|
|
|
45
|
|
|
/** |
|
46
|
|
|
* @var string $reg_admin_url |
|
47
|
|
|
*/ |
|
48
|
|
|
private $reg_admin_url; |
|
49
|
|
|
|
|
50
|
|
|
|
|
51
|
|
|
|
|
52
|
|
|
/** |
|
53
|
|
|
* AdminToolBar constructor. |
|
54
|
|
|
* |
|
55
|
|
|
* @param EE_Capabilities $capabilities |
|
56
|
|
|
*/ |
|
57
|
|
|
public function __construct(EE_Capabilities $capabilities) |
|
58
|
|
|
{ |
|
59
|
|
|
$this->capabilities = $capabilities; |
|
60
|
|
|
add_action('admin_bar_menu', array($this, 'espressoToolbarItems'), 100); |
|
61
|
|
|
$this->enqueueAssets(); |
|
62
|
|
|
} |
|
63
|
|
|
|
|
64
|
|
|
|
|
65
|
|
|
|
|
66
|
|
|
/** |
|
67
|
|
|
* espresso_toolbar_items |
|
68
|
|
|
* |
|
69
|
|
|
* @access public |
|
70
|
|
|
* @param WP_Admin_Bar $admin_bar |
|
71
|
|
|
* @return void |
|
72
|
|
|
*/ |
|
73
|
|
|
public function espressoToolbarItems(WP_Admin_Bar $admin_bar) |
|
74
|
|
|
{ |
|
75
|
|
|
// if its an AJAX request, or user is NOT an admin, or in full M-Mode |
|
76
|
|
|
if ( |
|
77
|
|
|
defined('DOING_AJAX') |
|
78
|
|
|
|| ! $this->capabilities->current_user_can('ee_read_ee', 'ee_admin_bar_menu_top_level') |
|
79
|
|
|
|| EE_Maintenance_Mode::instance()->level() === EE_Maintenance_Mode::level_2_complete_maintenance |
|
80
|
|
|
) { |
|
81
|
|
|
return; |
|
82
|
|
|
} |
|
83
|
|
|
do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
84
|
|
|
$this->admin_bar = $admin_bar; |
|
85
|
|
|
//we don't use the constants EVENTS_ADMIN_URL or REG_ADMIN_URL |
|
86
|
|
|
//because they're only defined in each of their respective constructors |
|
87
|
|
|
//and this might be a frontend request, in which case they aren't available |
|
88
|
|
|
$this->events_admin_url = admin_url('admin.php?page=espresso_events'); |
|
89
|
|
|
$this->reg_admin_url = admin_url('admin.php?page=espresso_registrations'); |
|
90
|
|
|
// now let's add all of the menu items |
|
91
|
|
|
$this->addTopLevelMenu(); |
|
92
|
|
|
$this->addEventsSubMenu(); |
|
93
|
|
|
$this->addEventsAddEditHeader(); |
|
94
|
|
|
$this->addEventsAddNew(); |
|
95
|
|
|
$this->addEventsEditCurrentEvent(); |
|
96
|
|
|
$this->addEventsViewHeader(); |
|
97
|
|
|
$this->addEventsViewAll(); |
|
98
|
|
|
$this->addEventsViewToday(); |
|
99
|
|
|
$this->addEventsViewThisMonth(); |
|
100
|
|
|
$this->addRegistrationSubMenu(); |
|
101
|
|
|
$this->addRegistrationOverviewToday(); |
|
102
|
|
|
$this->addRegistrationOverviewTodayApproved(); |
|
103
|
|
|
$this->addRegistrationOverviewTodayPendingPayment(); |
|
104
|
|
|
$this->addRegistrationOverviewTodayNotApproved(); |
|
105
|
|
|
$this->addRegistrationOverviewTodayCancelled(); |
|
106
|
|
|
$this->addRegistrationOverviewThisMonth(); |
|
107
|
|
|
$this->addRegistrationOverviewThisMonthApproved(); |
|
108
|
|
|
$this->addRegistrationOverviewThisMonthPending(); |
|
109
|
|
|
$this->addRegistrationOverviewThisMonthNotApproved(); |
|
110
|
|
|
$this->addRegistrationOverviewThisMonthCancelled(); |
|
111
|
|
|
$this->addExtensionsAndServices(); |
|
112
|
|
|
} |
|
113
|
|
|
|
|
114
|
|
|
|
|
115
|
|
|
|
|
116
|
|
|
/** |
|
117
|
|
|
* @return void |
|
118
|
|
|
*/ |
|
119
|
|
|
private function enqueueAssets() |
|
120
|
|
|
{ |
|
121
|
|
|
wp_register_style( |
|
122
|
|
|
'espresso-admin-toolbar', |
|
123
|
|
|
EE_GLOBAL_ASSETS_URL . 'css/espresso-admin-toolbar.css', |
|
124
|
|
|
array('dashicons'), |
|
125
|
|
|
EVENT_ESPRESSO_VERSION |
|
126
|
|
|
); |
|
127
|
|
|
wp_enqueue_style('espresso-admin-toolbar'); |
|
128
|
|
|
} |
|
129
|
|
|
|
|
130
|
|
|
|
|
131
|
|
|
|
|
132
|
|
|
/** |
|
133
|
|
|
* @return void |
|
134
|
|
|
*/ |
|
135
|
|
|
private function addTopLevelMenu() |
|
136
|
|
|
{ |
|
137
|
|
|
$this->admin_bar->add_menu( |
|
138
|
|
|
array( |
|
139
|
|
|
'id' => 'espresso-toolbar', |
|
140
|
|
|
'title' => '<span class="ee-icon ee-icon-ee-cup-thick ee-icon-size-20"></span><span class="ab-label">' |
|
141
|
|
|
. esc_html_x('Event Espresso', 'admin bar menu group label', 'event_espresso') |
|
142
|
|
|
. '</span>', |
|
143
|
|
|
'href' => $this->events_admin_url, |
|
144
|
|
|
'meta' => array( |
|
145
|
|
|
'title' => esc_html__('Event Espresso', 'event_espresso'), |
|
146
|
|
|
'class' => $this->menu_class . 'first', |
|
147
|
|
|
), |
|
148
|
|
|
) |
|
149
|
|
|
); |
|
150
|
|
|
} |
|
151
|
|
|
|
|
152
|
|
|
|
|
153
|
|
|
|
|
154
|
|
|
/** |
|
155
|
|
|
* @return void |
|
156
|
|
|
*/ |
|
157
|
|
|
private function addEventsSubMenu() |
|
158
|
|
|
{ |
|
159
|
|
|
if ( |
|
160
|
|
|
$this->capabilities->current_user_can( |
|
161
|
|
|
'ee_read_events', |
|
162
|
|
|
'ee_admin_bar_menu_espresso-toolbar-events' |
|
163
|
|
|
) |
|
164
|
|
|
) { |
|
165
|
|
|
$this->admin_bar->add_menu( |
|
166
|
|
|
array( |
|
167
|
|
|
'id' => 'espresso-toolbar-events', |
|
168
|
|
|
'parent' => 'espresso-toolbar', |
|
169
|
|
|
'title' => '<span class="ee-toolbar-icon"></span>' |
|
170
|
|
|
. esc_html__('Events', 'event_espresso'), |
|
171
|
|
|
'href' => $this->events_admin_url, |
|
172
|
|
|
'meta' => array( |
|
173
|
|
|
'title' => esc_html__('Events', 'event_espresso'), |
|
174
|
|
|
'target' => '', |
|
175
|
|
|
'class' => $this->menu_class, |
|
176
|
|
|
), |
|
177
|
|
|
) |
|
178
|
|
|
); |
|
179
|
|
|
} |
|
180
|
|
|
} |
|
181
|
|
|
|
|
182
|
|
|
|
|
183
|
|
|
|
|
184
|
|
|
/** |
|
185
|
|
|
* @return void |
|
186
|
|
|
*/ |
|
187
|
|
View Code Duplication |
private function addEventsAddEditHeader() |
|
188
|
|
|
{ |
|
189
|
|
|
if ( |
|
190
|
|
|
$this->capabilities->current_user_can( |
|
191
|
|
|
'ee_read_events', |
|
192
|
|
|
'ee_admin_bar_menu_espresso-toolbar-events-view' |
|
193
|
|
|
) |
|
194
|
|
|
) { |
|
195
|
|
|
$this->admin_bar->add_menu( |
|
196
|
|
|
array( |
|
197
|
|
|
'id' => 'espresso-toolbar-events-add-edit', |
|
198
|
|
|
'parent' => 'espresso-toolbar-events', |
|
199
|
|
|
'title' => esc_html__('Add / Edit', 'event_espresso'), |
|
200
|
|
|
'href' => '', |
|
201
|
|
|
) |
|
202
|
|
|
); |
|
203
|
|
|
} |
|
204
|
|
|
} |
|
205
|
|
|
|
|
206
|
|
|
|
|
207
|
|
|
|
|
208
|
|
|
/** |
|
209
|
|
|
* @return void |
|
210
|
|
|
*/ |
|
211
|
|
View Code Duplication |
private function addEventsAddNew() |
|
212
|
|
|
{ |
|
213
|
|
|
if ( |
|
214
|
|
|
$this->capabilities->current_user_can( |
|
215
|
|
|
'ee_edit_events', |
|
216
|
|
|
'ee_admin_bar_menu_espresso-toolbar-events-new' |
|
217
|
|
|
) |
|
218
|
|
|
) { |
|
219
|
|
|
$this->admin_bar->add_menu( |
|
220
|
|
|
array( |
|
221
|
|
|
'id' => 'espresso-toolbar-events-new', |
|
222
|
|
|
'parent' => 'espresso-toolbar-events', |
|
223
|
|
|
'title' => '<span class="ee-toolbar-icon"></span>' |
|
224
|
|
|
. esc_html__('Add New', 'event_espresso'), |
|
225
|
|
|
'href' => EEH_URL::add_query_args_and_nonce( |
|
226
|
|
|
array('action' => 'create_new'), |
|
227
|
|
|
$this->events_admin_url |
|
228
|
|
|
), |
|
229
|
|
|
'meta' => array( |
|
230
|
|
|
'title' => esc_html__('Add New', 'event_espresso'), |
|
231
|
|
|
'target' => '', |
|
232
|
|
|
'class' => $this->menu_class, |
|
233
|
|
|
), |
|
234
|
|
|
) |
|
235
|
|
|
); |
|
236
|
|
|
} |
|
237
|
|
|
} |
|
238
|
|
|
|
|
239
|
|
|
|
|
240
|
|
|
|
|
241
|
|
|
/** |
|
242
|
|
|
* @return void |
|
243
|
|
|
*/ |
|
244
|
|
|
private function addEventsEditCurrentEvent() |
|
245
|
|
|
{ |
|
246
|
|
|
if (is_single() && (get_post_type() === 'espresso_events')) { |
|
247
|
|
|
//Current post |
|
248
|
|
|
global $post; |
|
249
|
|
|
if ( |
|
250
|
|
|
$this->capabilities->current_user_can( |
|
251
|
|
|
'ee_edit_event', |
|
252
|
|
|
'ee_admin_bar_menu_espresso-toolbar-events-edit', $post->ID |
|
253
|
|
|
) |
|
254
|
|
|
) { |
|
255
|
|
|
$this->admin_bar->add_menu( |
|
256
|
|
|
array( |
|
257
|
|
|
'id' => 'espresso-toolbar-events-edit', |
|
258
|
|
|
'parent' => 'espresso-toolbar-events', |
|
259
|
|
|
'title' => '<span class="ee-toolbar-icon"></span>' |
|
260
|
|
|
. esc_html__('Edit Event', 'event_espresso'), |
|
261
|
|
|
'href' => EEH_URL::add_query_args_and_nonce( |
|
262
|
|
|
array( |
|
263
|
|
|
'action' => 'edit', |
|
264
|
|
|
'post' => $post->ID |
|
265
|
|
|
), |
|
266
|
|
|
$this->events_admin_url |
|
267
|
|
|
), |
|
268
|
|
|
'meta' => array( |
|
269
|
|
|
'title' => esc_html__('Edit Event', 'event_espresso'), |
|
270
|
|
|
'target' => '', |
|
271
|
|
|
'class' => $this->menu_class, |
|
272
|
|
|
), |
|
273
|
|
|
) |
|
274
|
|
|
); |
|
275
|
|
|
} |
|
276
|
|
|
} |
|
277
|
|
|
} |
|
278
|
|
|
|
|
279
|
|
|
|
|
280
|
|
|
|
|
281
|
|
|
/** |
|
282
|
|
|
* @return void |
|
283
|
|
|
*/ |
|
284
|
|
View Code Duplication |
private function addEventsViewHeader() |
|
285
|
|
|
{ |
|
286
|
|
|
if ( |
|
287
|
|
|
$this->capabilities->current_user_can( |
|
288
|
|
|
'ee_read_events', |
|
289
|
|
|
'ee_admin_bar_menu_espresso-toolbar-events-view' |
|
290
|
|
|
) |
|
291
|
|
|
) { |
|
292
|
|
|
$this->admin_bar->add_menu( |
|
293
|
|
|
array( |
|
294
|
|
|
'id' => 'espresso-toolbar-events-view', |
|
295
|
|
|
'parent' => 'espresso-toolbar-events', |
|
296
|
|
|
'title' => esc_html__('View', 'event_espresso'), |
|
297
|
|
|
'href' => '', |
|
298
|
|
|
) |
|
299
|
|
|
); |
|
300
|
|
|
} |
|
301
|
|
|
} |
|
302
|
|
|
|
|
303
|
|
|
|
|
304
|
|
|
|
|
305
|
|
|
/** |
|
306
|
|
|
* @return void |
|
307
|
|
|
*/ |
|
308
|
|
|
private function addEventsViewAll() |
|
309
|
|
|
{ |
|
310
|
|
|
if ( |
|
311
|
|
|
$this->capabilities->current_user_can( |
|
312
|
|
|
'ee_read_events', |
|
313
|
|
|
'ee_admin_bar_menu_espresso-toolbar-events-all' |
|
314
|
|
|
) |
|
315
|
|
|
) { |
|
316
|
|
|
$this->admin_bar->add_menu( |
|
317
|
|
|
array( |
|
318
|
|
|
'id' => 'espresso-toolbar-events-all', |
|
319
|
|
|
'parent' => 'espresso-toolbar-events', |
|
320
|
|
|
'title' => '<span class="ee-toolbar-icon"></span>' |
|
321
|
|
|
. esc_html__('All', 'event_espresso'), |
|
322
|
|
|
'href' => $this->events_admin_url, |
|
323
|
|
|
'meta' => array( |
|
324
|
|
|
'title' => esc_html__('All', 'event_espresso'), |
|
325
|
|
|
'target' => '', |
|
326
|
|
|
'class' => $this->menu_class, |
|
327
|
|
|
), |
|
328
|
|
|
) |
|
329
|
|
|
); |
|
330
|
|
|
} |
|
331
|
|
|
} |
|
332
|
|
|
|
|
333
|
|
|
|
|
334
|
|
|
|
|
335
|
|
|
/** |
|
336
|
|
|
* @return void |
|
337
|
|
|
*/ |
|
338
|
|
View Code Duplication |
private function addEventsViewToday() |
|
339
|
|
|
{ |
|
340
|
|
|
if ( |
|
341
|
|
|
$this->capabilities->current_user_can( |
|
342
|
|
|
'ee_read_events', |
|
343
|
|
|
'ee_admin_bar_menu_espresso-toolbar-events-today' |
|
344
|
|
|
) |
|
345
|
|
|
) { |
|
346
|
|
|
$this->admin_bar->add_menu( |
|
347
|
|
|
array( |
|
348
|
|
|
'id' => 'espresso-toolbar-events-today', |
|
349
|
|
|
'parent' => 'espresso-toolbar-events', |
|
350
|
|
|
'title' => '<span class="ee-toolbar-icon"></span>' |
|
351
|
|
|
. esc_html__('Today', 'event_espresso'), |
|
352
|
|
|
'href' => EEH_URL::add_query_args_and_nonce( |
|
353
|
|
|
array( |
|
354
|
|
|
'action' => 'default', |
|
355
|
|
|
'status' => 'today' |
|
356
|
|
|
), |
|
357
|
|
|
$this->events_admin_url |
|
358
|
|
|
), |
|
359
|
|
|
'meta' => array( |
|
360
|
|
|
'title' => esc_html__('Today', 'event_espresso'), |
|
361
|
|
|
'target' => '', |
|
362
|
|
|
'class' => $this->menu_class, |
|
363
|
|
|
), |
|
364
|
|
|
) |
|
365
|
|
|
); |
|
366
|
|
|
} |
|
367
|
|
|
} |
|
368
|
|
|
|
|
369
|
|
|
|
|
370
|
|
|
|
|
371
|
|
|
/** |
|
372
|
|
|
* @return void |
|
373
|
|
|
*/ |
|
374
|
|
View Code Duplication |
private function addEventsViewThisMonth() |
|
375
|
|
|
{ |
|
376
|
|
|
if ( |
|
377
|
|
|
$this->capabilities->current_user_can( |
|
378
|
|
|
'ee_read_events', |
|
379
|
|
|
'ee_admin_bar_menu_espresso-toolbar-events-month' |
|
380
|
|
|
) |
|
381
|
|
|
) { |
|
382
|
|
|
$this->admin_bar->add_menu( |
|
383
|
|
|
array( |
|
384
|
|
|
'id' => 'espresso-toolbar-events-month', |
|
385
|
|
|
'parent' => 'espresso-toolbar-events', |
|
386
|
|
|
'title' => '<span class="ee-toolbar-icon"></span>' |
|
387
|
|
|
. esc_html__('This Month', 'event_espresso'), |
|
388
|
|
|
'href' => EEH_URL::add_query_args_and_nonce( |
|
389
|
|
|
array( |
|
390
|
|
|
'action' => 'default', |
|
391
|
|
|
'status' => 'month' |
|
392
|
|
|
), |
|
393
|
|
|
$this->events_admin_url |
|
394
|
|
|
), |
|
395
|
|
|
'meta' => array( |
|
396
|
|
|
'title' => esc_html__('This Month', 'event_espresso'), |
|
397
|
|
|
'target' => '', |
|
398
|
|
|
'class' => $this->menu_class, |
|
399
|
|
|
), |
|
400
|
|
|
) |
|
401
|
|
|
); |
|
402
|
|
|
} |
|
403
|
|
|
} |
|
404
|
|
|
|
|
405
|
|
|
|
|
406
|
|
|
|
|
407
|
|
|
/** |
|
408
|
|
|
* @return void |
|
409
|
|
|
*/ |
|
410
|
|
|
private function addRegistrationSubMenu() |
|
411
|
|
|
{ |
|
412
|
|
|
if ( |
|
413
|
|
|
$this->capabilities->current_user_can( |
|
414
|
|
|
'ee_read_registrations', |
|
415
|
|
|
'ee_admin_bar_menu_espresso-toolbar-registrations' |
|
416
|
|
|
) |
|
417
|
|
|
) { |
|
418
|
|
|
$this->admin_bar->add_menu( |
|
419
|
|
|
array( |
|
420
|
|
|
'id' => 'espresso-toolbar-registrations', |
|
421
|
|
|
'parent' => 'espresso-toolbar', |
|
422
|
|
|
'title' => '<span class="ee-toolbar-icon"></span>' |
|
423
|
|
|
. esc_html__('Registrations', 'event_espresso'), |
|
424
|
|
|
'href' => $this->reg_admin_url, |
|
425
|
|
|
'meta' => array( |
|
426
|
|
|
'title' => esc_html__('Registrations', 'event_espresso'), |
|
427
|
|
|
'target' => '', |
|
428
|
|
|
'class' => $this->menu_class, |
|
429
|
|
|
), |
|
430
|
|
|
) |
|
431
|
|
|
); |
|
432
|
|
|
} |
|
433
|
|
|
} |
|
434
|
|
|
|
|
435
|
|
|
|
|
436
|
|
|
|
|
437
|
|
|
/** |
|
438
|
|
|
* @return void |
|
439
|
|
|
*/ |
|
440
|
|
|
private function addRegistrationOverviewToday() |
|
441
|
|
|
{ |
|
442
|
|
|
if ( |
|
443
|
|
|
$this->capabilities->current_user_can( |
|
444
|
|
|
'ee_read_registrations', |
|
445
|
|
|
'ee_admin_bar_menu_espresso-toolbar-registrations-today' |
|
446
|
|
|
) |
|
447
|
|
|
) { |
|
448
|
|
|
$this->admin_bar->add_menu( |
|
449
|
|
|
array( |
|
450
|
|
|
'id' => 'espresso-toolbar-registrations-today', |
|
451
|
|
|
'parent' => 'espresso-toolbar-registrations', |
|
452
|
|
|
'title' => esc_html__('Today', 'event_espresso'), |
|
453
|
|
|
'href' => '', |
|
454
|
|
|
'meta' => array( |
|
455
|
|
|
'title' => esc_html__('Today', 'event_espresso'), |
|
456
|
|
|
'target' => '', |
|
457
|
|
|
'class' => $this->menu_class, |
|
458
|
|
|
), |
|
459
|
|
|
) |
|
460
|
|
|
); |
|
461
|
|
|
} |
|
462
|
|
|
} |
|
463
|
|
|
|
|
464
|
|
|
|
|
465
|
|
|
|
|
466
|
|
|
/** |
|
467
|
|
|
* @return void |
|
468
|
|
|
*/ |
|
469
|
|
View Code Duplication |
private function addRegistrationOverviewTodayApproved() |
|
470
|
|
|
{ |
|
471
|
|
|
if ( |
|
472
|
|
|
$this->capabilities->current_user_can( |
|
473
|
|
|
'ee_read_registrations', |
|
474
|
|
|
'ee_admin_bar_menu_espresso-toolbar-registrations-today-approved' |
|
475
|
|
|
) |
|
476
|
|
|
) { |
|
477
|
|
|
$this->admin_bar->add_menu( |
|
478
|
|
|
array( |
|
479
|
|
|
'id' => 'espresso-toolbar-registrations-today-approved', |
|
480
|
|
|
'parent' => 'espresso-toolbar-registrations', |
|
481
|
|
|
'title' => '<span class="ee-toolbar-icon"></span>' |
|
482
|
|
|
. esc_html__('Approved', 'event_espresso'), |
|
483
|
|
|
'href' => EEH_URL::add_query_args_and_nonce( |
|
484
|
|
|
array( |
|
485
|
|
|
'action' => 'default', |
|
486
|
|
|
'status' => 'today', |
|
487
|
|
|
'_reg_status' => EEM_Registration::status_id_approved, |
|
488
|
|
|
), |
|
489
|
|
|
$this->reg_admin_url |
|
490
|
|
|
), |
|
491
|
|
|
'meta' => array( |
|
492
|
|
|
'title' => esc_html__('Approved', 'event_espresso'), |
|
493
|
|
|
'target' => '', |
|
494
|
|
|
'class' => $this->menu_class . ' ee-toolbar-icon-approved', |
|
495
|
|
|
), |
|
496
|
|
|
) |
|
497
|
|
|
); |
|
498
|
|
|
} |
|
499
|
|
|
} |
|
500
|
|
|
|
|
501
|
|
|
|
|
502
|
|
|
|
|
503
|
|
|
/** |
|
504
|
|
|
* @return void |
|
505
|
|
|
*/ |
|
506
|
|
View Code Duplication |
private function addRegistrationOverviewTodayPendingPayment() |
|
507
|
|
|
{ |
|
508
|
|
|
if ( |
|
509
|
|
|
$this->capabilities->current_user_can( |
|
510
|
|
|
'ee_read_registrations', |
|
511
|
|
|
'ee_admin_bar_menu_espresso-toolbar-registrations-today-pending' |
|
512
|
|
|
) |
|
513
|
|
|
) { |
|
514
|
|
|
$this->admin_bar->add_menu( |
|
515
|
|
|
array( |
|
516
|
|
|
'id' => 'espresso-toolbar-registrations-today-pending', |
|
517
|
|
|
'parent' => 'espresso-toolbar-registrations', |
|
518
|
|
|
'title' => '<span class="ee-toolbar-icon"></span>' |
|
519
|
|
|
. esc_html__('Pending', 'event_espresso'), |
|
520
|
|
|
'href' => EEH_URL::add_query_args_and_nonce( |
|
521
|
|
|
array( |
|
522
|
|
|
'action' => 'default', |
|
523
|
|
|
'status' => 'today', |
|
524
|
|
|
'_reg_status' => EEM_Registration::status_id_pending_payment, |
|
525
|
|
|
), |
|
526
|
|
|
$this->reg_admin_url |
|
527
|
|
|
), |
|
528
|
|
|
'meta' => array( |
|
529
|
|
|
'title' => esc_html__('Pending Payment', 'event_espresso'), |
|
530
|
|
|
'target' => '', |
|
531
|
|
|
'class' => $this->menu_class . ' ee-toolbar-icon-pending', |
|
532
|
|
|
), |
|
533
|
|
|
) |
|
534
|
|
|
); |
|
535
|
|
|
} |
|
536
|
|
|
} |
|
537
|
|
|
|
|
538
|
|
|
|
|
539
|
|
|
|
|
540
|
|
|
/** |
|
541
|
|
|
* @return void |
|
542
|
|
|
*/ |
|
543
|
|
View Code Duplication |
private function addRegistrationOverviewTodayNotApproved() |
|
544
|
|
|
{ |
|
545
|
|
|
if ( |
|
546
|
|
|
$this->capabilities->current_user_can( |
|
547
|
|
|
'ee_read_registrations', |
|
548
|
|
|
'ee_admin_bar_menu_espresso-toolbar-registrations-today-not-approved' |
|
549
|
|
|
) |
|
550
|
|
|
) { |
|
551
|
|
|
$this->admin_bar->add_menu( |
|
552
|
|
|
array( |
|
553
|
|
|
'id' => 'espresso-toolbar-registrations-today-not-approved', |
|
554
|
|
|
'parent' => 'espresso-toolbar-registrations', |
|
555
|
|
|
'title' => '<span class="ee-toolbar-icon"></span>' |
|
556
|
|
|
. esc_html__('Not Approved', 'event_espresso'), |
|
557
|
|
|
'href' => EEH_URL::add_query_args_and_nonce( |
|
558
|
|
|
array( |
|
559
|
|
|
'action' => 'default', |
|
560
|
|
|
'status' => 'today', |
|
561
|
|
|
'_reg_status' => EEM_Registration::status_id_not_approved, |
|
562
|
|
|
), |
|
563
|
|
|
$this->reg_admin_url |
|
564
|
|
|
), |
|
565
|
|
|
'meta' => array( |
|
566
|
|
|
'title' => esc_html__('Not Approved', 'event_espresso'), |
|
567
|
|
|
'target' => '', |
|
568
|
|
|
'class' => $this->menu_class . ' ee-toolbar-icon-not-approved', |
|
569
|
|
|
), |
|
570
|
|
|
) |
|
571
|
|
|
); |
|
572
|
|
|
} |
|
573
|
|
|
} |
|
574
|
|
|
|
|
575
|
|
|
|
|
576
|
|
|
|
|
577
|
|
|
/** |
|
578
|
|
|
* @return void |
|
579
|
|
|
*/ |
|
580
|
|
View Code Duplication |
private function addRegistrationOverviewTodayCancelled() |
|
581
|
|
|
{ |
|
582
|
|
|
if ( |
|
583
|
|
|
$this->capabilities->current_user_can( |
|
584
|
|
|
'ee_read_registrations', |
|
585
|
|
|
'ee_admin_bar_menu_espresso-toolbar-registrations-today-cancelled' |
|
586
|
|
|
) |
|
587
|
|
|
) { |
|
588
|
|
|
$this->admin_bar->add_menu( |
|
589
|
|
|
array( |
|
590
|
|
|
'id' => 'espresso-toolbar-registrations-today-cancelled', |
|
591
|
|
|
'parent' => 'espresso-toolbar-registrations', |
|
592
|
|
|
'title' => '<span class="ee-toolbar-icon"></span>' |
|
593
|
|
|
. esc_html__('Cancelled', 'event_espresso'), |
|
594
|
|
|
'href' => EEH_URL::add_query_args_and_nonce( |
|
595
|
|
|
array( |
|
596
|
|
|
'action' => 'default', |
|
597
|
|
|
'status' => 'today', |
|
598
|
|
|
'_reg_status' => EEM_Registration::status_id_cancelled, |
|
599
|
|
|
), |
|
600
|
|
|
$this->reg_admin_url |
|
601
|
|
|
), |
|
602
|
|
|
'meta' => array( |
|
603
|
|
|
'title' => esc_html__('Cancelled', 'event_espresso'), |
|
604
|
|
|
'target' => '', |
|
605
|
|
|
'class' => $this->menu_class . ' ee-toolbar-icon-cancelled', |
|
606
|
|
|
), |
|
607
|
|
|
) |
|
608
|
|
|
); |
|
609
|
|
|
} |
|
610
|
|
|
} |
|
611
|
|
|
|
|
612
|
|
|
|
|
613
|
|
|
|
|
614
|
|
|
/** |
|
615
|
|
|
* @return void |
|
616
|
|
|
*/ |
|
617
|
|
|
private function addRegistrationOverviewThisMonth() |
|
618
|
|
|
{ |
|
619
|
|
|
if ( |
|
620
|
|
|
$this->capabilities->current_user_can( |
|
621
|
|
|
'ee_read_registrations', |
|
622
|
|
|
'ee_admin_bar_menu_espresso-toolbar-registrations-month' |
|
623
|
|
|
) |
|
624
|
|
|
) { |
|
625
|
|
|
$this->admin_bar->add_menu( |
|
626
|
|
|
array( |
|
627
|
|
|
'id' => 'espresso-toolbar-registrations-month', |
|
628
|
|
|
'parent' => 'espresso-toolbar-registrations', |
|
629
|
|
|
'title' => esc_html__('This Month', 'event_espresso'), |
|
630
|
|
|
'href' => '', //EEH_URL::add_query_args_and_nonce( |
|
631
|
|
|
// array( |
|
632
|
|
|
// 'action' => 'default', |
|
633
|
|
|
// 'status' => 'month' |
|
634
|
|
|
// ), |
|
635
|
|
|
// $this->reg_admin_url |
|
636
|
|
|
// ), |
|
637
|
|
|
'meta' => array( |
|
638
|
|
|
'title' => esc_html__('This Month', 'event_espresso'), |
|
639
|
|
|
'target' => '', |
|
640
|
|
|
'class' => $this->menu_class, |
|
641
|
|
|
), |
|
642
|
|
|
) |
|
643
|
|
|
); |
|
644
|
|
|
} |
|
645
|
|
|
} |
|
646
|
|
|
|
|
647
|
|
|
|
|
648
|
|
|
|
|
649
|
|
|
/** |
|
650
|
|
|
* @return void |
|
651
|
|
|
*/ |
|
652
|
|
View Code Duplication |
private function addRegistrationOverviewThisMonthApproved() |
|
653
|
|
|
{ |
|
654
|
|
|
if ( |
|
655
|
|
|
$this->capabilities->current_user_can( |
|
656
|
|
|
'ee_read_registrations', |
|
657
|
|
|
'ee_admin_bar_menu_espresso-toolbar-registrations-month-approved' |
|
658
|
|
|
) |
|
659
|
|
|
) { |
|
660
|
|
|
$this->admin_bar->add_menu( |
|
661
|
|
|
array( |
|
662
|
|
|
'id' => 'espresso-toolbar-registrations-month-approved', |
|
663
|
|
|
'parent' => 'espresso-toolbar-registrations', |
|
664
|
|
|
'title' => '<span class="ee-toolbar-icon"></span>' |
|
665
|
|
|
. esc_html__('Approved', 'event_espresso'), |
|
666
|
|
|
'href' => EEH_URL::add_query_args_and_nonce( |
|
667
|
|
|
array( |
|
668
|
|
|
'action' => 'default', |
|
669
|
|
|
'status' => 'month', |
|
670
|
|
|
'_reg_status' => EEM_Registration::status_id_approved, |
|
671
|
|
|
), |
|
672
|
|
|
$this->reg_admin_url |
|
673
|
|
|
), |
|
674
|
|
|
'meta' => array( |
|
675
|
|
|
'title' => esc_html__('Approved', 'event_espresso'), |
|
676
|
|
|
'target' => '', |
|
677
|
|
|
'class' => $this->menu_class . ' ee-toolbar-icon-approved', |
|
678
|
|
|
), |
|
679
|
|
|
) |
|
680
|
|
|
); |
|
681
|
|
|
} |
|
682
|
|
|
} |
|
683
|
|
|
|
|
684
|
|
|
|
|
685
|
|
|
|
|
686
|
|
|
/** |
|
687
|
|
|
* @return void |
|
688
|
|
|
*/ |
|
689
|
|
View Code Duplication |
private function addRegistrationOverviewThisMonthPending() |
|
690
|
|
|
{ |
|
691
|
|
|
if ( |
|
692
|
|
|
$this->capabilities->current_user_can( |
|
693
|
|
|
'ee_read_registrations', |
|
694
|
|
|
'ee_admin_bar_menu_espresso-toolbar-registrations-month-pending' |
|
695
|
|
|
) |
|
696
|
|
|
) { |
|
697
|
|
|
$this->admin_bar->add_menu( |
|
698
|
|
|
array( |
|
699
|
|
|
'id' => 'espresso-toolbar-registrations-month-pending', |
|
700
|
|
|
'parent' => 'espresso-toolbar-registrations', |
|
701
|
|
|
'title' => '<span class="ee-toolbar-icon"></span>' |
|
702
|
|
|
. esc_html__('Pending', 'event_espresso'), |
|
703
|
|
|
'href' => EEH_URL::add_query_args_and_nonce( |
|
704
|
|
|
array( |
|
705
|
|
|
'action' => 'default', |
|
706
|
|
|
'status' => 'month', |
|
707
|
|
|
'_reg_status' => EEM_Registration::status_id_pending_payment, |
|
708
|
|
|
), |
|
709
|
|
|
$this->reg_admin_url |
|
710
|
|
|
), |
|
711
|
|
|
'meta' => array( |
|
712
|
|
|
'title' => esc_html__('Pending', 'event_espresso'), |
|
713
|
|
|
'target' => '', |
|
714
|
|
|
'class' => $this->menu_class . ' ee-toolbar-icon-pending', |
|
715
|
|
|
), |
|
716
|
|
|
) |
|
717
|
|
|
); |
|
718
|
|
|
} |
|
719
|
|
|
} |
|
720
|
|
|
|
|
721
|
|
|
|
|
722
|
|
|
|
|
723
|
|
|
/** |
|
724
|
|
|
* @return void |
|
725
|
|
|
*/ |
|
726
|
|
View Code Duplication |
private function addRegistrationOverviewThisMonthNotApproved() |
|
727
|
|
|
{ |
|
728
|
|
|
if ( |
|
729
|
|
|
$this->capabilities->current_user_can( |
|
730
|
|
|
'ee_read_registrations', |
|
731
|
|
|
'ee_admin_bar_menu_espresso-toolbar-registrations-month-not-approved' |
|
732
|
|
|
) |
|
733
|
|
|
) { |
|
734
|
|
|
$this->admin_bar->add_menu( |
|
735
|
|
|
array( |
|
736
|
|
|
'id' => 'espresso-toolbar-registrations-month-not-approved', |
|
737
|
|
|
'parent' => 'espresso-toolbar-registrations', |
|
738
|
|
|
'title' => '<span class="ee-toolbar-icon"></span>' |
|
739
|
|
|
. esc_html__('Not Approved', 'event_espresso'), |
|
740
|
|
|
'href' => EEH_URL::add_query_args_and_nonce( |
|
741
|
|
|
array( |
|
742
|
|
|
'action' => 'default', |
|
743
|
|
|
'status' => 'month', |
|
744
|
|
|
'_reg_status' => EEM_Registration::status_id_not_approved, |
|
745
|
|
|
), |
|
746
|
|
|
$this->reg_admin_url |
|
747
|
|
|
), |
|
748
|
|
|
'meta' => array( |
|
749
|
|
|
'title' => esc_html__('Not Approved', 'event_espresso'), |
|
750
|
|
|
'target' => '', |
|
751
|
|
|
'class' => $this->menu_class . ' ee-toolbar-icon-not-approved', |
|
752
|
|
|
), |
|
753
|
|
|
) |
|
754
|
|
|
); |
|
755
|
|
|
} |
|
756
|
|
|
} |
|
757
|
|
|
|
|
758
|
|
|
|
|
759
|
|
|
|
|
760
|
|
|
/** |
|
761
|
|
|
* @return void |
|
762
|
|
|
*/ |
|
763
|
|
View Code Duplication |
private function addRegistrationOverviewThisMonthCancelled() |
|
764
|
|
|
{ |
|
765
|
|
|
if ( |
|
766
|
|
|
$this->capabilities->current_user_can( |
|
767
|
|
|
'ee_read_registrations', |
|
768
|
|
|
'ee_admin_bar_menu_espresso-toolbar-registrations-month-cancelled' |
|
769
|
|
|
) |
|
770
|
|
|
) { |
|
771
|
|
|
$this->admin_bar->add_menu( |
|
772
|
|
|
array( |
|
773
|
|
|
'id' => 'espresso-toolbar-registrations-month-cancelled', |
|
774
|
|
|
'parent' => 'espresso-toolbar-registrations', |
|
775
|
|
|
'title' => '<span class="ee-toolbar-icon"></span>' |
|
776
|
|
|
. esc_html__('Cancelled', 'event_espresso'), |
|
777
|
|
|
'href' => EEH_URL::add_query_args_and_nonce( |
|
778
|
|
|
array( |
|
779
|
|
|
'action' => 'default', |
|
780
|
|
|
'status' => 'month', |
|
781
|
|
|
'_reg_status' => EEM_Registration::status_id_cancelled, |
|
782
|
|
|
), |
|
783
|
|
|
$this->reg_admin_url |
|
784
|
|
|
), |
|
785
|
|
|
'meta' => array( |
|
786
|
|
|
'title' => esc_html__('Cancelled', 'event_espresso'), |
|
787
|
|
|
'target' => '', |
|
788
|
|
|
'class' => $this->menu_class . ' ee-toolbar-icon-cancelled', |
|
789
|
|
|
), |
|
790
|
|
|
) |
|
791
|
|
|
); |
|
792
|
|
|
} |
|
793
|
|
|
} |
|
794
|
|
|
|
|
795
|
|
|
|
|
796
|
|
|
|
|
797
|
|
|
/** |
|
798
|
|
|
* @return void |
|
799
|
|
|
*/ |
|
800
|
|
|
private function addExtensionsAndServices() |
|
801
|
|
|
{ |
|
802
|
|
|
if ( |
|
803
|
|
|
$this->capabilities->current_user_can( |
|
804
|
|
|
'ee_read_ee', |
|
805
|
|
|
'ee_admin_bar_menu_espresso-toolbar-extensions-and-services' |
|
806
|
|
|
) |
|
807
|
|
|
) { |
|
808
|
|
|
$this->admin_bar->add_menu( |
|
809
|
|
|
array( |
|
810
|
|
|
'id' => 'espresso-toolbar-extensions-and-services', |
|
811
|
|
|
'parent' => 'espresso-toolbar', |
|
812
|
|
|
'title' => '<span class="ee-toolbar-icon"></span>' |
|
813
|
|
|
. esc_html__('Extensions & Services', 'event_espresso'), |
|
814
|
|
|
'href' => admin_url('admin.php?page=espresso_packages'), |
|
815
|
|
|
'meta' => array( |
|
816
|
|
|
'title' => esc_html__('Extensions & Services', 'event_espresso'), |
|
817
|
|
|
'target' => '', |
|
818
|
|
|
'class' => $this->menu_class, |
|
819
|
|
|
), |
|
820
|
|
|
) |
|
821
|
|
|
); |
|
822
|
|
|
} |
|
823
|
|
|
} |
|
824
|
|
|
|
|
825
|
|
|
} |
|
826
|
|
|
|