Completed
Branch barista (5d11bd)
by
unknown
52:14 queued 42:26
created
caffeinated/admin/extend/events/Extend_Events_Admin_Page.core.php 2 patches
Indentation   +1410 added lines, -1410 removed lines patch added patch discarded remove patch
@@ -17,1414 +17,1414 @@
 block discarded – undo
17 17
 class Extend_Events_Admin_Page extends Events_Admin_Page
18 18
 {
19 19
 
20
-    /**
21
-     * @var EE_Admin_Config
22
-     */
23
-    protected $admin_config;
24
-
25
-    /**
26
-     * @var AdvancedEditorAdminFormSection
27
-     */
28
-    protected $advanced_editor_admin_form;
29
-
30
-
31
-    /**
32
-     * Extend_Events_Admin_Page constructor.
33
-     *
34
-     * @param bool $routing
35
-     * @throws ReflectionException
36
-     */
37
-    public function __construct($routing = true)
38
-    {
39
-        if (! defined('EVENTS_CAF_TEMPLATE_PATH')) {
40
-            define('EVENTS_CAF_TEMPLATE_PATH', EE_CORE_CAF_ADMIN_EXTEND . 'events/templates/');
41
-            define('EVENTS_CAF_ASSETS', EE_CORE_CAF_ADMIN_EXTEND . 'events/assets/');
42
-            define('EVENTS_CAF_ASSETS_URL', EE_CORE_CAF_ADMIN_EXTEND_URL . 'events/assets/');
43
-        }
44
-        parent::__construct($routing);
45
-        $this->admin_config = $this->loader->getShared('EE_Admin_Config');
46
-    }
47
-
48
-
49
-    /**
50
-     * Sets routes.
51
-     *
52
-     * @throws EE_Error
53
-     * @throws InvalidArgumentException
54
-     * @throws InvalidDataTypeException
55
-     * @throws InvalidInterfaceException
56
-     * @throws Exception
57
-     */
58
-    protected function _extend_page_config()
59
-    {
60
-        $this->_admin_base_path = EE_CORE_CAF_ADMIN_EXTEND . 'events';
61
-        // is there a evt_id in the request?
62
-        $evt_id = ! empty($this->_req_data['EVT_ID']) && ! is_array($this->_req_data['EVT_ID'])
63
-            ? $this->_req_data['EVT_ID']
64
-            : 0;
65
-        $evt_id = ! empty($this->_req_data['post']) ? $this->_req_data['post'] : $evt_id;
66
-        // tkt_id?
67
-        $tkt_id = ! empty($this->_req_data['TKT_ID']) && ! is_array($this->_req_data['TKT_ID'])
68
-            ? $this->_req_data['TKT_ID']
69
-            : 0;
70
-        $new_page_routes = [
71
-            'duplicate_event'          => [
72
-                'func'       => '_duplicate_event',
73
-                'capability' => 'ee_edit_event',
74
-                'obj_id'     => $evt_id,
75
-                'noheader'   => true,
76
-            ],
77
-            'import_page'              => [
78
-                'func'       => '_import_page',
79
-                'capability' => 'import',
80
-            ],
81
-            'import'                   => [
82
-                'func'       => '_import_events',
83
-                'capability' => 'import',
84
-                'noheader'   => true,
85
-            ],
86
-            'import_events'            => [
87
-                'func'       => '_import_events',
88
-                'capability' => 'import',
89
-                'noheader'   => true,
90
-            ],
91
-            'export_events'            => [
92
-                'func'       => '_events_export',
93
-                'capability' => 'export',
94
-                'noheader'   => true,
95
-            ],
96
-            'export_categories'        => [
97
-                'func'       => '_categories_export',
98
-                'capability' => 'export',
99
-                'noheader'   => true,
100
-            ],
101
-            'sample_export_file'       => [
102
-                'func'       => '_sample_export_file',
103
-                'capability' => 'export',
104
-                'noheader'   => true,
105
-            ],
106
-            'update_template_settings' => [
107
-                'func'       => '_update_template_settings',
108
-                'capability' => 'manage_options',
109
-                'noheader'   => true,
110
-            ],
111
-        ];        // don't load these meta boxes if using the advanced editor
112
-        $this->_page_config['create_new']['metaboxes'][] = '_premium_event_editor_meta_boxes';
113
-        $this->_page_config['edit']['metaboxes'][] = '_premium_event_editor_meta_boxes';
114
-        if (! $this->admin_config->useAdvancedEditor()) {
115
-            $this->_page_config['create_new']['qtips'][] = 'EE_Event_Editor_Tips';
116
-            $this->_page_config['edit']['qtips'][] = 'EE_Event_Editor_Tips';
117
-
118
-            $legacy_editor_page_routes = [
119
-                'ticket_list_table' => [
120
-                    'func'       => '_tickets_overview_list_table',
121
-                    'capability' => 'ee_read_default_tickets',
122
-                ],
123
-                'trash_ticket'      => [
124
-                    'func'       => '_trash_or_restore_ticket',
125
-                    'capability' => 'ee_delete_default_ticket',
126
-                    'obj_id'     => $tkt_id,
127
-                    'noheader'   => true,
128
-                    'args'       => ['trash' => true],
129
-                ],
130
-                'trash_tickets'     => [
131
-                    'func'       => '_trash_or_restore_ticket',
132
-                    'capability' => 'ee_delete_default_tickets',
133
-                    'noheader'   => true,
134
-                    'args'       => ['trash' => true],
135
-                ],
136
-                'restore_ticket'    => [
137
-                    'func'       => '_trash_or_restore_ticket',
138
-                    'capability' => 'ee_delete_default_ticket',
139
-                    'obj_id'     => $tkt_id,
140
-                    'noheader'   => true,
141
-                ],
142
-                'restore_tickets'   => [
143
-                    'func'       => '_trash_or_restore_ticket',
144
-                    'capability' => 'ee_delete_default_tickets',
145
-                    'noheader'   => true,
146
-                ],
147
-                'delete_ticket'     => [
148
-                    'func'       => '_delete_ticket',
149
-                    'capability' => 'ee_delete_default_ticket',
150
-                    'obj_id'     => $tkt_id,
151
-                    'noheader'   => true,
152
-                ],
153
-                'delete_tickets'    => [
154
-                    'func'       => '_delete_ticket',
155
-                    'capability' => 'ee_delete_default_tickets',
156
-                    'noheader'   => true,
157
-                ],
158
-            ];
159
-            $new_page_routes = array_merge($new_page_routes, $legacy_editor_page_routes);
160
-        }
161
-
162
-        $this->_page_routes = array_merge($this->_page_routes, $new_page_routes);
163
-        // partial route/config override
164
-        $this->_page_config['import_events']['metaboxes'] = $this->_default_espresso_metaboxes;
165
-        $this->_page_config['default']['list_table'] = 'Extend_Events_Admin_List_Table';
166
-        // add tickets tab but only if there are more than one default ticket!
167
-        $tkt_count = EEM_Ticket::instance()->count_deleted_and_undeleted(
168
-            [['TKT_is_default' => 1]],
169
-            'TKT_ID',
170
-            true
171
-        );
172
-        if ($tkt_count > 1) {
173
-            $new_page_config = [
174
-                'ticket_list_table' => [
175
-                    'nav'           => [
176
-                        'label' => esc_html__('Default Tickets', 'event_espresso'),
177
-                        'order' => 60,
178
-                    ],
179
-                    'list_table'    => 'Tickets_List_Table',
180
-                    'require_nonce' => false,
181
-                ],
182
-            ];
183
-        }
184
-        // template settings
185
-        $new_page_config['template_settings'] = [
186
-            'nav'           => [
187
-                'label' => esc_html__('Templates', 'event_espresso'),
188
-                'order' => 30,
189
-            ],
190
-            'metaboxes'     => array_merge($this->_default_espresso_metaboxes, ['_publish_post_box']),
191
-            'help_tabs'     => [
192
-                'general_settings_templates_help_tab' => [
193
-                    'title'    => esc_html__('Templates', 'event_espresso'),
194
-                    'filename' => 'general_settings_templates',
195
-                ],
196
-            ],
197
-            'help_tour'     => ['Templates_Help_Tour'],
198
-            'require_nonce' => false,
199
-        ];
200
-        $this->_page_config = array_merge($this->_page_config, $new_page_config);
201
-        // add filters and actions
202
-        // modifying _views
203
-        add_filter(
204
-            'FHEE_event_datetime_metabox_add_additional_date_time_template',
205
-            [$this, 'add_additional_datetime_button'],
206
-            10,
207
-            2
208
-        );
209
-        add_filter(
210
-            'FHEE_event_datetime_metabox_clone_button_template',
211
-            [$this, 'add_datetime_clone_button'],
212
-            10,
213
-            2
214
-        );
215
-        add_filter(
216
-            'FHEE_event_datetime_metabox_timezones_template',
217
-            [$this, 'datetime_timezones_template'],
218
-            10,
219
-            2
220
-        );
221
-        // filters for event list table
222
-        add_filter('FHEE__Extend_Events_Admin_List_Table__filters', [$this, 'list_table_filters'], 10, 2);
223
-        add_filter(
224
-            'FHEE__Events_Admin_List_Table__column_actions__action_links',
225
-            [$this, 'extra_list_table_actions'],
226
-            10,
227
-            2
228
-        );
229
-        // legend item
230
-        add_filter('FHEE__Events_Admin_Page___event_legend_items__items', [$this, 'additional_legend_items']);
231
-        add_action('admin_init', [$this, 'admin_init']);
232
-        // load additional handlers
233
-        $this->handleActionRequest();
234
-    }
235
-
236
-
237
-    private function getRequestAction()
238
-    {
239
-        return isset($this->_req_data['action']) ? sanitize_key($this->_req_data['action']) : null;
240
-    }
241
-
242
-
243
-    /**
244
-     * @throws Exception
245
-     */
246
-    private function handleActionRequest()
247
-    {
248
-        $action = $this->getRequestAction();
249
-        if ($action) {
250
-            // setup Advanced Editor ???
251
-            if ($action === 'default_event_settings' || $action === 'update_default_event_settings') {
252
-                $this->advanced_editor_admin_form = $this->loader->getShared(
253
-                    'EventEspresso\core\domain\services\admin\events\default_settings\AdvancedEditorAdminFormSection'
254
-                );
255
-            }
256
-        }
257
-    }
258
-
259
-
260
-    /**
261
-     * admin_init
262
-     */
263
-    public function admin_init()
264
-    {
265
-        EE_Registry::$i18n_js_strings = array_merge(
266
-            EE_Registry::$i18n_js_strings,
267
-            [
268
-                'image_confirm'          => esc_html__(
269
-                    'Do you really want to delete this image? Please remember to update your event to complete the removal.',
270
-                    'event_espresso'
271
-                ),
272
-                'event_starts_on'        => esc_html__('Event Starts on', 'event_espresso'),
273
-                'event_ends_on'          => esc_html__('Event Ends on', 'event_espresso'),
274
-                'event_datetime_actions' => esc_html__('Actions', 'event_espresso'),
275
-                'event_clone_dt_msg'     => esc_html__('Clone this Event Date and Time', 'event_espresso'),
276
-                'remove_event_dt_msg'    => esc_html__('Remove this Event Time', 'event_espresso'),
277
-            ]
278
-        );
279
-    }
280
-
281
-
282
-    /**
283
-     * Add per page screen options to the default ticket list table view.
284
-     *
285
-     * @throws InvalidArgumentException
286
-     * @throws InvalidDataTypeException
287
-     * @throws InvalidInterfaceException
288
-     */
289
-    protected function _add_screen_options_ticket_list_table()
290
-    {
291
-        $this->_per_page_screen_option();
292
-    }
293
-
294
-
295
-    /**
296
-     * @param string $return
297
-     * @param int    $id
298
-     * @param string $new_title
299
-     * @param string $new_slug
300
-     * @return string
301
-     */
302
-    public function extra_permalink_field_buttons($return, $id, $new_title, $new_slug)
303
-    {
304
-        $return = parent::extra_permalink_field_buttons($return, $id, $new_title, $new_slug);
305
-        // make sure this is only when editing
306
-        if (! empty($id)) {
307
-            $href = EE_Admin_Page::add_query_args_and_nonce(
308
-                ['action' => 'duplicate_event', 'EVT_ID' => $id],
309
-                $this->_admin_base_url
310
-            );
311
-            $title = esc_attr__('Duplicate Event', 'event_espresso');
312
-            $return .= '<a href="'
313
-                       . $href
314
-                       . '" title="'
315
-                       . $title
316
-                       . '" id="ee-duplicate-event-button" class="button button-small"  value="duplicate_event">'
317
-                       . $title
318
-                       . '</a>';
319
-        }
320
-        return $return;
321
-    }
322
-
323
-
324
-    /**
325
-     * Set the list table views for the default ticket list table view.
326
-     */
327
-    public function _set_list_table_views_ticket_list_table()
328
-    {
329
-        $this->_views = [
330
-            'all'     => [
331
-                'slug'        => 'all',
332
-                'label'       => esc_html__('All', 'event_espresso'),
333
-                'count'       => 0,
334
-                'bulk_action' => [
335
-                    'trash_tickets' => esc_html__('Move to Trash', 'event_espresso'),
336
-                ],
337
-            ],
338
-            'trashed' => [
339
-                'slug'        => 'trashed',
340
-                'label'       => esc_html__('Trash', 'event_espresso'),
341
-                'count'       => 0,
342
-                'bulk_action' => [
343
-                    'restore_tickets' => esc_html__('Restore from Trash', 'event_espresso'),
344
-                    'delete_tickets'  => esc_html__('Delete Permanently', 'event_espresso'),
345
-                ],
346
-            ],
347
-        ];
348
-    }
349
-
350
-
351
-    /**
352
-     * Enqueue scripts and styles for the event editor.
353
-     */
354
-    public function load_scripts_styles_edit()
355
-    {
356
-        if (! $this->admin_config->useAdvancedEditor()) {
357
-            wp_register_script(
358
-                'ee-event-editor-heartbeat',
359
-                EVENTS_CAF_ASSETS_URL . 'event-editor-heartbeat.js',
360
-                ['ee_admin_js', 'heartbeat'],
361
-                EVENT_ESPRESSO_VERSION,
362
-                true
363
-            );
364
-            wp_enqueue_script('ee-accounting');
365
-            wp_enqueue_script('ee-event-editor-heartbeat');
366
-        }
367
-        wp_enqueue_script('event_editor_js');
368
-        // styles
369
-        wp_enqueue_style('espresso-ui-theme');
370
-    }
371
-
372
-
373
-    /**
374
-     * Returns template for the additional datetime.
375
-     *
376
-     * @param $template
377
-     * @param $template_args
378
-     * @return mixed
379
-     * @throws DomainException
380
-     */
381
-    public function add_additional_datetime_button($template, $template_args)
382
-    {
383
-        return EEH_Template::display_template(
384
-            EVENTS_CAF_TEMPLATE_PATH . 'event_datetime_add_additional_time.template.php',
385
-            $template_args,
386
-            true
387
-        );
388
-    }
389
-
390
-
391
-    /**
392
-     * Returns the template for cloning a datetime.
393
-     *
394
-     * @param $template
395
-     * @param $template_args
396
-     * @return mixed
397
-     * @throws DomainException
398
-     */
399
-    public function add_datetime_clone_button($template, $template_args)
400
-    {
401
-        return EEH_Template::display_template(
402
-            EVENTS_CAF_TEMPLATE_PATH . 'event_datetime_metabox_clone_button.template.php',
403
-            $template_args,
404
-            true
405
-        );
406
-    }
407
-
408
-
409
-    /**
410
-     * Returns the template for datetime timezones.
411
-     *
412
-     * @param $template
413
-     * @param $template_args
414
-     * @return mixed
415
-     * @throws DomainException
416
-     */
417
-    public function datetime_timezones_template($template, $template_args)
418
-    {
419
-        return EEH_Template::display_template(
420
-            EVENTS_CAF_TEMPLATE_PATH . 'event_datetime_timezones.template.php',
421
-            $template_args,
422
-            true
423
-        );
424
-    }
425
-
426
-
427
-    /**
428
-     * Sets the views for the default list table view.
429
-     *
430
-     * @throws EE_Error
431
-     */
432
-    protected function _set_list_table_views_default()
433
-    {
434
-        parent::_set_list_table_views_default();
435
-        $new_views = [
436
-            'today' => [
437
-                'slug'        => 'today',
438
-                'label'       => esc_html__('Today', 'event_espresso'),
439
-                'count'       => $this->total_events_today(),
440
-                'bulk_action' => [
441
-                    'trash_events' => esc_html__('Move to Trash', 'event_espresso'),
442
-                ],
443
-            ],
444
-            'month' => [
445
-                'slug'        => 'month',
446
-                'label'       => esc_html__('This Month', 'event_espresso'),
447
-                'count'       => $this->total_events_this_month(),
448
-                'bulk_action' => [
449
-                    'trash_events' => esc_html__('Move to Trash', 'event_espresso'),
450
-                ],
451
-            ],
452
-        ];
453
-        $this->_views = array_merge($this->_views, $new_views);
454
-    }
455
-
456
-
457
-    /**
458
-     * Returns the extra action links for the default list table view.
459
-     *
460
-     * @param array    $action_links
461
-     * @param EE_Event $event
462
-     * @return array
463
-     * @throws EE_Error
464
-     * @throws InvalidArgumentException
465
-     * @throws InvalidDataTypeException
466
-     * @throws InvalidInterfaceException
467
-     * @throws ReflectionException
468
-     */
469
-    public function extra_list_table_actions(array $action_links, EE_Event $event)
470
-    {
471
-        if (EE_Registry::instance()->CAP->current_user_can(
472
-            'ee_read_registrations',
473
-            'espresso_registrations_reports',
474
-            $event->ID()
475
-        )
476
-        ) {
477
-            $reports_query_args = [
478
-                'action' => 'reports',
479
-                'EVT_ID' => $event->ID(),
480
-            ];
481
-            $reports_link = EE_Admin_Page::add_query_args_and_nonce($reports_query_args, REG_ADMIN_URL);
482
-            $action_links[] = '<a href="'
483
-                              . $reports_link
484
-                              . '" title="'
485
-                              . esc_attr__('View Report', 'event_espresso')
486
-                              . '"><div class="dashicons dashicons-chart-bar"></div></a>'
487
-                              . "\n\t";
488
-        }
489
-        if (EE_Registry::instance()->CAP->current_user_can('ee_read_global_messages', 'view_filtered_messages')) {
490
-            EE_Registry::instance()->load_helper('MSG_Template');
491
-            $action_links[] = EEH_MSG_Template::get_message_action_link(
492
-                'see_notifications_for',
493
-                null,
494
-                ['EVT_ID' => $event->ID()]
495
-            );
496
-        }
497
-        return $action_links;
498
-    }
499
-
500
-
501
-    /**
502
-     * @param $items
503
-     * @return mixed
504
-     */
505
-    public function additional_legend_items($items)
506
-    {
507
-        if (EE_Registry::instance()->CAP->current_user_can(
508
-            'ee_read_registrations',
509
-            'espresso_registrations_reports'
510
-        )
511
-        ) {
512
-            $items['reports'] = [
513
-                'class' => 'dashicons dashicons-chart-bar',
514
-                'desc'  => esc_html__('Event Reports', 'event_espresso'),
515
-            ];
516
-        }
517
-        if (EE_Registry::instance()->CAP->current_user_can('ee_read_global_messages', 'view_filtered_messages')) {
518
-            $related_for_icon = EEH_MSG_Template::get_message_action_icon('see_notifications_for');
519
-            // $related_for_icon can sometimes be a string so 'css_class' would be an illegal offset
520
-            // (can only use numeric offsets when treating strings as arrays)
521
-            if (is_array($related_for_icon) && isset($related_for_icon['css_class'], $related_for_icon['label'])) {
522
-                $items['view_related_messages'] = [
523
-                    'class' => $related_for_icon['css_class'],
524
-                    'desc'  => $related_for_icon['label'],
525
-                ];
526
-            }
527
-        }
528
-        return $items;
529
-    }
530
-
531
-
532
-    /**
533
-     * This is the callback method for the duplicate event route
534
-     * Method looks for 'EVT_ID' in the request and retrieves that event and its details and duplicates them
535
-     * into a new event.  We add a hook so that any plugins that add extra event details can hook into this
536
-     * action.  Note that the dupe will have **DUPLICATE** as its title and slug.
537
-     * After duplication the redirect is to the new event edit page.
538
-     *
539
-     * @return void
540
-     * @throws EE_Error If EE_Event is not available with given ID
541
-     * @throws InvalidArgumentException
542
-     * @throws InvalidDataTypeException
543
-     * @throws InvalidInterfaceException
544
-     * @throws ReflectionException
545
-     * @access protected
546
-     */
547
-    protected function _duplicate_event()
548
-    {
549
-        // first make sure the ID for the event is in the request.
550
-        //  If it isn't then we need to bail and redirect back to overview list table (cause how did we get here?)
551
-        if (! isset($this->_req_data['EVT_ID'])) {
552
-            EE_Error::add_error(
553
-                esc_html__(
554
-                    'In order to duplicate an event an Event ID is required.  None was given.',
555
-                    'event_espresso'
556
-                ),
557
-                __FILE__,
558
-                __FUNCTION__,
559
-                __LINE__
560
-            );
561
-            $this->_redirect_after_action(false, '', '', [], true);
562
-            return;
563
-        }
564
-        // k we've got EVT_ID so let's use that to get the event we'll duplicate
565
-        $orig_event = EEM_Event::instance()->get_one_by_ID($this->_req_data['EVT_ID']);
566
-        if (! $orig_event instanceof EE_Event) {
567
-            throw new EE_Error(
568
-                sprintf(
569
-                    esc_html__('An EE_Event object could not be retrieved for the given ID (%s)', 'event_espresso'),
570
-                    $this->_req_data['EVT_ID']
571
-                )
572
-            );
573
-        }
574
-        // k now let's clone the $orig_event before getting relations
575
-        $new_event = clone $orig_event;
576
-        // original datetimes
577
-        $orig_datetimes = $orig_event->get_many_related('Datetime');
578
-        // other original relations
579
-        $orig_ven = $orig_event->get_many_related('Venue');
580
-        // reset the ID and modify other details to make it clear this is a dupe
581
-        $new_event->set('EVT_ID', 0);
582
-        $new_name = $new_event->name() . ' ' . esc_html__('**DUPLICATE**', 'event_espresso');
583
-        $new_event->set('EVT_name', $new_name);
584
-        $new_event->set(
585
-            'EVT_slug',
586
-            wp_unique_post_slug(
587
-                sanitize_title($orig_event->name()),
588
-                0,
589
-                'publish',
590
-                'espresso_events',
591
-                0
592
-            )
593
-        );
594
-        $new_event->set('status', 'draft');
595
-        // duplicate discussion settings
596
-        $new_event->set('comment_status', $orig_event->get('comment_status'));
597
-        $new_event->set('ping_status', $orig_event->get('ping_status'));
598
-        // save the new event
599
-        $new_event->save();
600
-        // venues
601
-        foreach ($orig_ven as $ven) {
602
-            $new_event->_add_relation_to($ven, 'Venue');
603
-        }
604
-        $new_event->save();
605
-        // now we need to get the question group relations and handle that
606
-        // first primary question groups
607
-        $orig_primary_qgs = $orig_event->get_many_related(
608
-            'Question_Group',
609
-            [['Event_Question_Group.EQG_primary' => true]]
610
-        );
611
-        if (! empty($orig_primary_qgs)) {
612
-            foreach ($orig_primary_qgs as $id => $obj) {
613
-                if ($obj instanceof EE_Question_Group) {
614
-                    $new_event->_add_relation_to($obj, 'Question_Group', ['EQG_primary' => true]);
615
-                }
616
-            }
617
-        }
618
-        // next additional attendee question groups
619
-        $orig_additional_qgs = $orig_event->get_many_related(
620
-            'Question_Group',
621
-            [['Event_Question_Group.EQG_additional' => true]]
622
-        );
623
-        if (! empty($orig_additional_qgs)) {
624
-            foreach ($orig_additional_qgs as $id => $obj) {
625
-                if ($obj instanceof EE_Question_Group) {
626
-                    $new_event->_add_relation_to($obj, 'Question_Group', ['EQG_additional' => true]);
627
-                }
628
-            }
629
-        }
630
-
631
-        $new_event->save();
632
-
633
-        // k now that we have the new event saved we can loop through the datetimes and start adding relations.
634
-        $cloned_tickets = [];
635
-        foreach ($orig_datetimes as $orig_dtt) {
636
-            if (! $orig_dtt instanceof EE_Datetime) {
637
-                continue;
638
-            }
639
-            $new_dtt = clone $orig_dtt;
640
-            $orig_tkts = $orig_dtt->tickets();
641
-            // save new dtt then add to event
642
-            $new_dtt->set('DTT_ID', 0);
643
-            $new_dtt->set('DTT_sold', 0);
644
-            $new_dtt->set_reserved(0);
645
-            $new_dtt->save();
646
-            $new_event->_add_relation_to($new_dtt, 'Datetime');
647
-            $new_event->save();
648
-            // now let's get the ticket relations setup.
649
-            foreach ((array) $orig_tkts as $orig_tkt) {
650
-                // it's possible a datetime will have no tickets so let's verify we HAVE a ticket first.
651
-                if (! $orig_tkt instanceof EE_Ticket) {
652
-                    continue;
653
-                }
654
-                // is this ticket archived?  If it is then let's skip
655
-                if ($orig_tkt->get('TKT_deleted')) {
656
-                    continue;
657
-                }
658
-                // does this original ticket already exist in the clone_tickets cache?
659
-                //  If so we'll just use the new ticket from it.
660
-                if (isset($cloned_tickets[ $orig_tkt->ID() ])) {
661
-                    $new_tkt = $cloned_tickets[ $orig_tkt->ID() ];
662
-                } else {
663
-                    $new_tkt = clone $orig_tkt;
664
-                    // get relations on the $orig_tkt that we need to setup.
665
-                    $orig_prices = $orig_tkt->prices();
666
-                    $new_tkt->set('TKT_ID', 0);
667
-                    $new_tkt->set('TKT_sold', 0);
668
-                    $new_tkt->set('TKT_reserved', 0);
669
-                    $new_tkt->save(); // make sure new ticket has ID.
670
-                    // price relations on new ticket need to be setup.
671
-                    foreach ($orig_prices as $orig_price) {
672
-                        $new_price = clone $orig_price;
673
-                        $new_price->set('PRC_ID', 0);
674
-                        $new_price->save();
675
-                        $new_tkt->_add_relation_to($new_price, 'Price');
676
-                        $new_tkt->save();
677
-                    }
678
-
679
-                    do_action(
680
-                        'AHEE__Extend_Events_Admin_Page___duplicate_event__duplicate_ticket__after',
681
-                        $orig_tkt,
682
-                        $new_tkt,
683
-                        $orig_prices,
684
-                        $orig_event,
685
-                        $orig_dtt,
686
-                        $new_dtt
687
-                    );
688
-                }
689
-                // k now we can add the new ticket as a relation to the new datetime
690
-                // and make sure its added to our cached $cloned_tickets array
691
-                // for use with later datetimes that have the same ticket.
692
-                $new_dtt->_add_relation_to($new_tkt, 'Ticket');
693
-                $new_dtt->save();
694
-                $cloned_tickets[ $orig_tkt->ID() ] = $new_tkt;
695
-            }
696
-        }
697
-        // clone taxonomy information
698
-        $taxonomies_to_clone_with = apply_filters(
699
-            'FHEE__Extend_Events_Admin_Page___duplicate_event__taxonomies_to_clone',
700
-            ['espresso_event_categories', 'espresso_event_type', 'post_tag']
701
-        );
702
-        // get terms for original event (notice)
703
-        $orig_terms = wp_get_object_terms($orig_event->ID(), $taxonomies_to_clone_with);
704
-        // loop through terms and add them to new event.
705
-        foreach ($orig_terms as $term) {
706
-            wp_set_object_terms($new_event->ID(), $term->term_id, $term->taxonomy, true);
707
-        }
708
-
709
-        // duplicate other core WP_Post items for this event.
710
-        // post thumbnail (feature image).
711
-        $feature_image_id = get_post_thumbnail_id($orig_event->ID());
712
-        if ($feature_image_id) {
713
-            update_post_meta($new_event->ID(), '_thumbnail_id', $feature_image_id);
714
-        }
715
-
716
-        // duplicate page_template setting
717
-        $page_template = get_post_meta($orig_event->ID(), '_wp_page_template', true);
718
-        if ($page_template) {
719
-            update_post_meta($new_event->ID(), '_wp_page_template', $page_template);
720
-        }
721
-
722
-        do_action('AHEE__Extend_Events_Admin_Page___duplicate_event__after', $new_event, $orig_event);
723
-        // now let's redirect to the edit page for this duplicated event if we have a new event id.
724
-        if ($new_event->ID()) {
725
-            $redirect_args = [
726
-                'post'   => $new_event->ID(),
727
-                'action' => 'edit',
728
-            ];
729
-            EE_Error::add_success(
730
-                esc_html__(
731
-                    'Event successfully duplicated.  Please review the details below and make any necessary edits',
732
-                    'event_espresso'
733
-                )
734
-            );
735
-        } else {
736
-            $redirect_args = [
737
-                'action' => 'default',
738
-            ];
739
-            EE_Error::add_error(
740
-                esc_html__('Not able to duplicate event.  Something went wrong.', 'event_espresso'),
741
-                __FILE__,
742
-                __FUNCTION__,
743
-                __LINE__
744
-            );
745
-        }
746
-        $this->_redirect_after_action(false, '', '', $redirect_args, true);
747
-    }
748
-
749
-
750
-    /**
751
-     * Generates output for the import page.
752
-     *
753
-     * @throws DomainException
754
-     * @throws EE_Error
755
-     * @throws InvalidArgumentException
756
-     * @throws InvalidDataTypeException
757
-     * @throws InvalidInterfaceException
758
-     */
759
-    protected function _import_page()
760
-    {
761
-        $title = esc_html__('Import', 'event_espresso');
762
-        $intro = esc_html__(
763
-            'If you have a previously exported Event Espresso 4 information in a Comma Separated Value (CSV) file format, you can upload the file here: ',
764
-            'event_espresso'
765
-        );
766
-        $form_url = EVENTS_ADMIN_URL;
767
-        $action = 'import_events';
768
-        $type = 'csv';
769
-        $this->_template_args['form'] = EE_Import::instance()->upload_form(
770
-            $title,
771
-            $intro,
772
-            $form_url,
773
-            $action,
774
-            $type
775
-        );
776
-        $this->_template_args['sample_file_link'] = EE_Admin_Page::add_query_args_and_nonce(
777
-            ['action' => 'sample_export_file'],
778
-            $this->_admin_base_url
779
-        );
780
-        $content = EEH_Template::display_template(
781
-            EVENTS_CAF_TEMPLATE_PATH . 'import_page.template.php',
782
-            $this->_template_args,
783
-            true
784
-        );
785
-        $this->_template_args['admin_page_content'] = $content;
786
-        $this->display_admin_page_with_sidebar();
787
-    }
788
-
789
-
790
-    /**
791
-     * _import_events
792
-     * This handles displaying the screen and running imports for importing events.
793
-     *
794
-     * @return void
795
-     * @throws EE_Error
796
-     * @throws InvalidArgumentException
797
-     * @throws InvalidDataTypeException
798
-     * @throws InvalidInterfaceException
799
-     */
800
-    protected function _import_events()
801
-    {
802
-        require_once(EE_CLASSES . 'EE_Import.class.php');
803
-        $success = EE_Import::instance()->import();
804
-        $this->_redirect_after_action($success, 'Import File', 'ran', ['action' => 'import_page'], true);
805
-    }
806
-
807
-
808
-    /**
809
-     * _events_export
810
-     * Will export all (or just the given event) to a Excel compatible file.
811
-     *
812
-     * @access protected
813
-     * @return void
814
-     */
815
-    protected function _events_export()
816
-    {
817
-        if (isset($this->_req_data['EVT_ID'])) {
818
-            $event_ids = $this->_req_data['EVT_ID'];
819
-        } elseif (isset($this->_req_data['EVT_IDs'])) {
820
-            $event_ids = $this->_req_data['EVT_IDs'];
821
-        } else {
822
-            $event_ids = null;
823
-        }
824
-        // todo: I don't like doing this but it'll do until we modify EE_Export Class.
825
-        $new_request_args = [
826
-            'export' => 'report',
827
-            'action' => 'all_event_data',
828
-            'EVT_ID' => $event_ids,
829
-        ];
830
-        $this->_req_data = array_merge($this->_req_data, $new_request_args);
831
-        if (is_readable(EE_CLASSES . 'EE_Export.class.php')) {
832
-            require_once(EE_CLASSES . 'EE_Export.class.php');
833
-            $EE_Export = EE_Export::instance($this->_req_data);
834
-            if ($EE_Export instanceof EE_Export) {
835
-                $EE_Export->export();
836
-            }
837
-        }
838
-    }
839
-
840
-
841
-    /**
842
-     * handle category exports()
843
-     *
844
-     * @return void
845
-     */
846
-    protected function _categories_export()
847
-    {
848
-        // todo: I don't like doing this but it'll do until we modify EE_Export Class.
849
-        $new_request_args = [
850
-            'export'       => 'report',
851
-            'action'       => 'categories',
852
-            'category_ids' => $this->_req_data['EVT_CAT_ID'],
853
-        ];
854
-        $this->_req_data = array_merge($this->_req_data, $new_request_args);
855
-        if (is_readable(EE_CLASSES . 'EE_Export.class.php')) {
856
-            require_once(EE_CLASSES . 'EE_Export.class.php');
857
-            $EE_Export = EE_Export::instance($this->_req_data);
858
-            if ($EE_Export instanceof EE_Export) {
859
-                $EE_Export->export();
860
-            }
861
-        }
862
-    }
863
-
864
-
865
-    /**
866
-     * Creates a sample CSV file for importing
867
-     */
868
-    protected function _sample_export_file()
869
-    {
870
-        $EE_Export = EE_Export::instance();
871
-        if ($EE_Export instanceof EE_Export) {
872
-            $EE_Export->export();
873
-        }
874
-    }
875
-
876
-
877
-    /*************        Template Settings        *************/
878
-    /**
879
-     * Generates template settings page output
880
-     *
881
-     * @throws DomainException
882
-     * @throws EE_Error
883
-     * @throws InvalidArgumentException
884
-     * @throws InvalidDataTypeException
885
-     * @throws InvalidInterfaceException
886
-     */
887
-    protected function _template_settings()
888
-    {
889
-        $this->_template_args['values'] = $this->_yes_no_values;
890
-        /**
891
-         * Note leaving this filter in for backward compatibility this was moved in 4.6.x
892
-         * from General_Settings_Admin_Page to here.
893
-         */
894
-        $this->_template_args = apply_filters(
895
-            'FHEE__General_Settings_Admin_Page__template_settings__template_args',
896
-            $this->_template_args
897
-        );
898
-        $this->_set_add_edit_form_tags('update_template_settings');
899
-        $this->_set_publish_post_box_vars(null, false, false, null, false);
900
-        $this->_template_args['admin_page_content'] = EEH_Template::display_template(
901
-            EVENTS_CAF_TEMPLATE_PATH . 'template_settings.template.php',
902
-            $this->_template_args,
903
-            true
904
-        );
905
-        $this->display_admin_page_with_sidebar();
906
-    }
907
-
908
-
909
-    /**
910
-     * Handler for updating template settings.
911
-     *
912
-     * @throws EE_Error
913
-     * @throws InvalidArgumentException
914
-     * @throws InvalidDataTypeException
915
-     * @throws InvalidInterfaceException
916
-     */
917
-    protected function _update_template_settings()
918
-    {
919
-        /**
920
-         * Note leaving this filter in for backward compatibility this was moved in 4.6.x
921
-         * from General_Settings_Admin_Page to here.
922
-         */
923
-        EE_Registry::instance()->CFG->template_settings = apply_filters(
924
-            'FHEE__General_Settings_Admin_Page__update_template_settings__data',
925
-            EE_Registry::instance()->CFG->template_settings,
926
-            $this->_req_data
927
-        );
928
-        // update custom post type slugs and detect if we need to flush rewrite rules
929
-        $old_slug = EE_Registry::instance()->CFG->core->event_cpt_slug;
930
-        EE_Registry::instance()->CFG->core->event_cpt_slug = empty($this->_req_data['event_cpt_slug'])
931
-            ? EE_Registry::instance()->CFG->core->event_cpt_slug
932
-            : EEH_URL::slugify($this->_req_data['event_cpt_slug'], 'events');
933
-        $what = 'Template Settings';
934
-        $success = $this->_update_espresso_configuration(
935
-            $what,
936
-            EE_Registry::instance()->CFG->template_settings,
937
-            __FILE__,
938
-            __FUNCTION__,
939
-            __LINE__
940
-        );
941
-        if (EE_Registry::instance()->CFG->core->event_cpt_slug !== $old_slug) {
942
-            /** @var EventEspresso\core\domain\services\custom_post_types\RewriteRules $rewrite_rules */
943
-            $rewrite_rules = LoaderFactory::getLoader()->getShared(
944
-                'EventEspresso\core\domain\services\custom_post_types\RewriteRules'
945
-            );
946
-            $rewrite_rules->flush();
947
-        }
948
-        $this->_redirect_after_action($success, $what, 'updated', ['action' => 'template_settings']);
949
-    }
950
-
951
-
952
-    /**
953
-     * _premium_event_editor_meta_boxes
954
-     * add all metaboxes related to the event_editor
955
-     *
956
-     * @access protected
957
-     * @return void
958
-     * @throws EE_Error
959
-     * @throws InvalidArgumentException
960
-     * @throws InvalidDataTypeException
961
-     * @throws InvalidInterfaceException
962
-     * @throws ReflectionException
963
-     */
964
-    protected function _premium_event_editor_meta_boxes()
965
-    {
966
-        $this->verify_cpt_object();
967
-        /** @var FeatureFlags $flags */
968
-        $flags = $this->loader->getShared('EventEspresso\core\domain\services\capabilities\FeatureFlags');
969
-        // check if the new EDTR reg options meta box is being used, and if so, don't load the legacy version
970
-        if (! $this->admin_config->useAdvancedEditor() || ! $flags->featureAllowed('use_reg_options_meta_box')) {
971
-            add_meta_box(
972
-                'espresso_event_editor_event_options',
973
-                esc_html__('Event Registration Options', 'event_espresso'),
974
-                [$this, 'registration_options_meta_box'],
975
-                $this->page_slug,
976
-                'side',
977
-                'core'
978
-            );
979
-        }
980
-    }
981
-
982
-
983
-    /**
984
-     * override caf metabox
985
-     *
986
-     * @return void
987
-     * @throws DomainException
988
-     * @throws EE_Error
989
-     */
990
-    public function registration_options_meta_box()
991
-    {
992
-        $yes_no_values = [
993
-            ['id' => true, 'text' => esc_html__('Yes', 'event_espresso')],
994
-            ['id' => false, 'text' => esc_html__('No', 'event_espresso')],
995
-        ];
996
-        $default_reg_status_values = EEM_Registration::reg_status_array(
997
-            [
998
-                EEM_Registration::status_id_cancelled,
999
-                EEM_Registration::status_id_declined,
1000
-                EEM_Registration::status_id_incomplete,
1001
-                EEM_Registration::status_id_wait_list,
1002
-            ],
1003
-            true
1004
-        );
1005
-        $template_args['active_status'] = $this->_cpt_model_obj->pretty_active_status(false);
1006
-        $template_args['_event'] = $this->_cpt_model_obj;
1007
-        $template_args['additional_limit'] = $this->_cpt_model_obj->additional_limit();
1008
-        $template_args['default_registration_status'] = EEH_Form_Fields::select_input(
1009
-            'default_reg_status',
1010
-            $default_reg_status_values,
1011
-            $this->_cpt_model_obj->default_registration_status()
1012
-        );
1013
-        $template_args['display_description'] = EEH_Form_Fields::select_input(
1014
-            'display_desc',
1015
-            $yes_no_values,
1016
-            $this->_cpt_model_obj->display_description()
1017
-        );
1018
-        $template_args['display_ticket_selector'] = EEH_Form_Fields::select_input(
1019
-            'display_ticket_selector',
1020
-            $yes_no_values,
1021
-            $this->_cpt_model_obj->display_ticket_selector(),
1022
-            '',
1023
-            '',
1024
-            false
1025
-        );
1026
-        $template_args['EVT_default_registration_status'] = EEH_Form_Fields::select_input(
1027
-            'EVT_default_registration_status',
1028
-            $default_reg_status_values,
1029
-            $this->_cpt_model_obj->default_registration_status()
1030
-        );
1031
-        $template_args['additional_registration_options'] = apply_filters(
1032
-            'FHEE__Events_Admin_Page__registration_options_meta_box__additional_registration_options',
1033
-            '',
1034
-            $template_args,
1035
-            $yes_no_values,
1036
-            $default_reg_status_values
1037
-        );
1038
-        EEH_Template::display_template(
1039
-            EVENTS_CAF_TEMPLATE_PATH . 'event_registration_options.template.php',
1040
-            $template_args
1041
-        );
1042
-    }
1043
-
1044
-
1045
-
1046
-    /**
1047
-     * wp_list_table_mods for caf
1048
-     * ============================
1049
-     */
1050
-    /**
1051
-     * hook into list table filters and provide filters for caffeinated list table
1052
-     *
1053
-     * @param array $old_filters    any existing filters present
1054
-     * @param array $list_table_obj the list table object
1055
-     * @return array                  new filters
1056
-     * @throws EE_Error
1057
-     * @throws InvalidArgumentException
1058
-     * @throws InvalidDataTypeException
1059
-     * @throws InvalidInterfaceException
1060
-     * @throws ReflectionException
1061
-     */
1062
-    public function list_table_filters($old_filters, $list_table_obj)
1063
-    {
1064
-        $filters = [];
1065
-        // first month/year filters
1066
-        $filters[] = $this->espresso_event_months_dropdown();
1067
-        $status = isset($this->_req_data['status']) ? $this->_req_data['status'] : null;
1068
-        // active status dropdown
1069
-        if ($status !== 'draft') {
1070
-            $filters[] = $this->active_status_dropdown(
1071
-                isset($this->_req_data['active_status']) ? $this->_req_data['active_status'] : ''
1072
-            );
1073
-            $filters[] = $this->venuesDropdown(
1074
-                isset($this->_req_data['venue']) ? $this->_req_data['venue'] : ''
1075
-            );
1076
-        }
1077
-        // category filter
1078
-        $filters[] = $this->category_dropdown();
1079
-        return array_merge($old_filters, $filters);
1080
-    }
1081
-
1082
-
1083
-    /**
1084
-     * espresso_event_months_dropdown
1085
-     *
1086
-     * @access public
1087
-     * @return string                dropdown listing month/year selections for events.
1088
-     */
1089
-    public function espresso_event_months_dropdown()
1090
-    {
1091
-        // what we need to do is get all PRIMARY datetimes for all events to filter on.
1092
-        // Note we need to include any other filters that are set!
1093
-        $status = isset($this->_req_data['status']) ? $this->_req_data['status'] : null;
1094
-        // categories?
1095
-        $category = isset($this->_req_data['EVT_CAT']) && $this->_req_data['EVT_CAT'] > 0
1096
-            ? $this->_req_data['EVT_CAT']
1097
-            : null;
1098
-        // active status?
1099
-        $active_status = isset($this->_req_data['active_status']) ? $this->_req_data['active_status'] : null;
1100
-        $cur_date = isset($this->_req_data['month_range']) ? $this->_req_data['month_range'] : '';
1101
-        return EEH_Form_Fields::generate_event_months_dropdown($cur_date, $status, $category, $active_status);
1102
-    }
1103
-
1104
-
1105
-    /**
1106
-     * returns a list of "active" statuses on the event
1107
-     *
1108
-     * @param string $current_value whatever the current active status is
1109
-     * @return string
1110
-     */
1111
-    public function active_status_dropdown($current_value = '')
1112
-    {
1113
-        $select_name = 'active_status';
1114
-        $values = [
1115
-            'none'     => esc_html__('Show Active/Inactive', 'event_espresso'),
1116
-            'active'   => esc_html__('Active', 'event_espresso'),
1117
-            'upcoming' => esc_html__('Upcoming', 'event_espresso'),
1118
-            'expired'  => esc_html__('Expired', 'event_espresso'),
1119
-            'inactive' => esc_html__('Inactive', 'event_espresso'),
1120
-        ];
1121
-
1122
-        return EEH_Form_Fields::select_input($select_name, $values, $current_value, '', 'wide');
1123
-    }
1124
-
1125
-
1126
-    /**
1127
-     * returns a list of "venues"
1128
-     *
1129
-     * @param string $current_value whatever the current active status is
1130
-     * @return string
1131
-     * @throws EE_Error
1132
-     * @throws InvalidArgumentException
1133
-     * @throws InvalidDataTypeException
1134
-     * @throws InvalidInterfaceException
1135
-     * @throws ReflectionException
1136
-     */
1137
-    protected function venuesDropdown($current_value = '')
1138
-    {
1139
-        $select_name = 'venue';
1140
-        $values = [
1141
-            '' => esc_html__('All Venues', 'event_espresso'),
1142
-        ];
1143
-        // populate the list of venues.
1144
-        $venue_model = EE_Registry::instance()->load_model('Venue');
1145
-        $venues = $venue_model->get_all(['order_by' => ['VNU_name' => 'ASC']]);
1146
-
1147
-        foreach ($venues as $venue) {
1148
-            $values[ $venue->ID() ] = $venue->name();
1149
-        }
1150
-
1151
-        return EEH_Form_Fields::select_input($select_name, $values, $current_value, '', 'wide');
1152
-    }
1153
-
1154
-
1155
-    /**
1156
-     * output a dropdown of the categories for the category filter on the event admin list table
1157
-     *
1158
-     * @access  public
1159
-     * @return string html
1160
-     */
1161
-    public function category_dropdown()
1162
-    {
1163
-        $cur_cat = isset($this->_req_data['EVT_CAT']) ? $this->_req_data['EVT_CAT'] : -1;
1164
-        return EEH_Form_Fields::generate_event_category_dropdown($cur_cat);
1165
-    }
1166
-
1167
-
1168
-    /**
1169
-     * get total number of events today
1170
-     *
1171
-     * @access public
1172
-     * @return int
1173
-     * @throws EE_Error
1174
-     * @throws InvalidArgumentException
1175
-     * @throws InvalidDataTypeException
1176
-     * @throws InvalidInterfaceException
1177
-     */
1178
-    public function total_events_today()
1179
-    {
1180
-        $start = EEM_Datetime::instance()->convert_datetime_for_query(
1181
-            'DTT_EVT_start',
1182
-            date('Y-m-d') . ' 00:00:00',
1183
-            'Y-m-d H:i:s',
1184
-            'UTC'
1185
-        );
1186
-        $end = EEM_Datetime::instance()->convert_datetime_for_query(
1187
-            'DTT_EVT_start',
1188
-            date('Y-m-d') . ' 23:59:59',
1189
-            'Y-m-d H:i:s',
1190
-            'UTC'
1191
-        );
1192
-        $where = [
1193
-            'Datetime.DTT_EVT_start' => ['BETWEEN', [$start, $end]],
1194
-        ];
1195
-        return EEM_Event::instance()->count([$where, 'caps' => 'read_admin'], 'EVT_ID', true);
1196
-    }
1197
-
1198
-
1199
-    /**
1200
-     * get total number of events this month
1201
-     *
1202
-     * @access public
1203
-     * @return int
1204
-     * @throws EE_Error
1205
-     * @throws InvalidArgumentException
1206
-     * @throws InvalidDataTypeException
1207
-     * @throws InvalidInterfaceException
1208
-     */
1209
-    public function total_events_this_month()
1210
-    {
1211
-        // Dates
1212
-        $this_year_r = date('Y');
1213
-        $this_month_r = date('m');
1214
-        $days_this_month = date('t');
1215
-        $start = EEM_Datetime::instance()->convert_datetime_for_query(
1216
-            'DTT_EVT_start',
1217
-            $this_year_r . '-' . $this_month_r . '-01 00:00:00',
1218
-            'Y-m-d H:i:s',
1219
-            'UTC'
1220
-        );
1221
-        $end = EEM_Datetime::instance()->convert_datetime_for_query(
1222
-            'DTT_EVT_start',
1223
-            $this_year_r . '-' . $this_month_r . '-' . $days_this_month . ' 23:59:59',
1224
-            'Y-m-d H:i:s',
1225
-            'UTC'
1226
-        );
1227
-        $where = [
1228
-            'Datetime.DTT_EVT_start' => ['BETWEEN', [$start, $end]],
1229
-        ];
1230
-        return EEM_Event::instance()->count([$where, 'caps' => 'read_admin'], 'EVT_ID', true);
1231
-    }
1232
-
1233
-
1234
-    /** DEFAULT TICKETS STUFF **/
1235
-
1236
-    /**
1237
-     * Output default tickets list table view.
1238
-     *
1239
-     * @throws DomainException
1240
-     * @throws EE_Error
1241
-     * @throws InvalidArgumentException
1242
-     * @throws InvalidDataTypeException
1243
-     * @throws InvalidInterfaceException
1244
-     */
1245
-    public function _tickets_overview_list_table()
1246
-    {
1247
-        $this->_search_btn_label = esc_html__('Tickets', 'event_espresso');
1248
-        $this->display_admin_list_table_page_with_no_sidebar();
1249
-    }
1250
-
1251
-
1252
-    /**
1253
-     * @param int  $per_page
1254
-     * @param bool $count
1255
-     * @param bool $trashed
1256
-     * @return EE_Soft_Delete_Base_Class[]|int
1257
-     * @throws EE_Error
1258
-     * @throws InvalidArgumentException
1259
-     * @throws InvalidDataTypeException
1260
-     * @throws InvalidInterfaceException
1261
-     */
1262
-    public function get_default_tickets($per_page = 10, $count = false, $trashed = false)
1263
-    {
1264
-        $orderby = empty($this->_req_data['orderby']) ? 'TKT_name' : $this->_req_data['orderby'];
1265
-        $order = empty($this->_req_data['order']) ? 'ASC' : $this->_req_data['order'];
1266
-        switch ($orderby) {
1267
-            case 'TKT_name':
1268
-                $orderby = ['TKT_name' => $order];
1269
-                break;
1270
-            case 'TKT_price':
1271
-                $orderby = ['TKT_price' => $order];
1272
-                break;
1273
-            case 'TKT_uses':
1274
-                $orderby = ['TKT_uses' => $order];
1275
-                break;
1276
-            case 'TKT_min':
1277
-                $orderby = ['TKT_min' => $order];
1278
-                break;
1279
-            case 'TKT_max':
1280
-                $orderby = ['TKT_max' => $order];
1281
-                break;
1282
-            case 'TKT_qty':
1283
-                $orderby = ['TKT_qty' => $order];
1284
-                break;
1285
-        }
1286
-        $current_page = isset($this->_req_data['paged']) && ! empty($this->_req_data['paged'])
1287
-            ? $this->_req_data['paged']
1288
-            : 1;
1289
-        $per_page = isset($this->_req_data['perpage']) && ! empty($this->_req_data['perpage'])
1290
-            ? $this->_req_data['perpage']
1291
-            : $per_page;
1292
-        $_where = [
1293
-            'TKT_is_default' => 1,
1294
-            'TKT_deleted'    => $trashed,
1295
-        ];
1296
-        $offset = ($current_page - 1) * $per_page;
1297
-        $limit = [$offset, $per_page];
1298
-        if (isset($this->_req_data['s'])) {
1299
-            $sstr = '%' . $this->_req_data['s'] . '%';
1300
-            $_where['OR'] = [
1301
-                'TKT_name'        => ['LIKE', $sstr],
1302
-                'TKT_description' => ['LIKE', $sstr],
1303
-            ];
1304
-        }
1305
-        $query_params = [
1306
-            $_where,
1307
-            'order_by' => $orderby,
1308
-            'limit'    => $limit,
1309
-            'group_by' => 'TKT_ID',
1310
-        ];
1311
-        if ($count) {
1312
-            return EEM_Ticket::instance()->count_deleted_and_undeleted([$_where]);
1313
-        }
1314
-        return EEM_Ticket::instance()->get_all_deleted_and_undeleted($query_params);
1315
-    }
1316
-
1317
-
1318
-    /**
1319
-     * @param bool $trash
1320
-     * @throws EE_Error
1321
-     * @throws InvalidArgumentException
1322
-     * @throws InvalidDataTypeException
1323
-     * @throws InvalidInterfaceException
1324
-     */
1325
-    protected function _trash_or_restore_ticket($trash = false)
1326
-    {
1327
-        $success = 1;
1328
-        $TKT = EEM_Ticket::instance();
1329
-        // checkboxes?
1330
-        if (! empty($this->_req_data['checkbox']) && is_array($this->_req_data['checkbox'])) {
1331
-            // if array has more than one element then success message should be plural
1332
-            $success = count($this->_req_data['checkbox']) > 1 ? 2 : 1;
1333
-            // cycle thru the boxes
1334
-            foreach ($this->_req_data['checkbox'] as $TKT_ID) {
1335
-                if ($trash) {
1336
-                    if (! $TKT->delete_by_ID($TKT_ID)) {
1337
-                        $success = 0;
1338
-                    }
1339
-                } elseif (! $TKT->restore_by_ID($TKT_ID)) {
1340
-                    $success = 0;
1341
-                }
1342
-            }
1343
-        } else {
1344
-            // grab single id and trash
1345
-            $TKT_ID = absint($this->_req_data['TKT_ID']);
1346
-            if ($trash) {
1347
-                if (! $TKT->delete_by_ID($TKT_ID)) {
1348
-                    $success = 0;
1349
-                }
1350
-            } elseif (! $TKT->restore_by_ID($TKT_ID)) {
1351
-                $success = 0;
1352
-            }
1353
-        }
1354
-        $action_desc = $trash ? 'moved to the trash' : 'restored';
1355
-        $query_args = [
1356
-            'action' => 'ticket_list_table',
1357
-            'status' => $trash ? '' : 'trashed',
1358
-        ];
1359
-        $this->_redirect_after_action($success, 'Tickets', $action_desc, $query_args);
1360
-    }
1361
-
1362
-
1363
-    /**
1364
-     * Handles trashing default ticket.
1365
-     *
1366
-     * @throws EE_Error
1367
-     * @throws InvalidArgumentException
1368
-     * @throws InvalidDataTypeException
1369
-     * @throws InvalidInterfaceException
1370
-     * @throws ReflectionException
1371
-     */
1372
-    protected function _delete_ticket()
1373
-    {
1374
-        $success = 1;
1375
-        // checkboxes?
1376
-        if (! empty($this->_req_data['checkbox']) && is_array($this->_req_data['checkbox'])) {
1377
-            // if array has more than one element then success message should be plural
1378
-            $success = count($this->_req_data['checkbox']) > 1 ? 2 : 1;
1379
-            // cycle thru the boxes
1380
-            foreach ($this->_req_data['checkbox'] as $TKT_ID) {
1381
-                // delete
1382
-                if (! $this->_delete_the_ticket($TKT_ID)) {
1383
-                    $success = 0;
1384
-                }
1385
-            }
1386
-        } else {
1387
-            // grab single id and trash
1388
-            $TKT_ID = absint($this->_req_data['TKT_ID']);
1389
-            if (! $this->_delete_the_ticket($TKT_ID)) {
1390
-                $success = 0;
1391
-            }
1392
-        }
1393
-        $action_desc = 'deleted';
1394
-        // fail safe.  If the default ticket count === 1 then we need to redirect to event overview.
1395
-        $ticket_count = EEM_Ticket::instance()->count_deleted_and_undeleted(
1396
-            [['TKT_is_default' => 1]],
1397
-            'TKT_ID',
1398
-            true
1399
-        );
1400
-        $query_args = $ticket_count
1401
-            ? []
1402
-            : [
1403
-                'action' => 'ticket_list_table',
1404
-                'status' => 'trashed',
1405
-            ];
1406
-        $this->_redirect_after_action($success, 'Tickets', $action_desc, $query_args);
1407
-    }
1408
-
1409
-
1410
-    /**
1411
-     * @param int $TKT_ID
1412
-     * @return bool|int
1413
-     * @throws EE_Error
1414
-     * @throws InvalidArgumentException
1415
-     * @throws InvalidDataTypeException
1416
-     * @throws InvalidInterfaceException
1417
-     * @throws ReflectionException
1418
-     */
1419
-    protected function _delete_the_ticket($TKT_ID)
1420
-    {
1421
-        $ticket = EEM_Ticket::instance()->get_one_by_ID($TKT_ID);
1422
-        if (! $ticket instanceof EE_Ticket) {
1423
-            return false;
1424
-        }
1425
-        $ticket->_remove_relations('Datetime');
1426
-        // delete all related prices first
1427
-        $ticket->delete_related_permanently('Price');
1428
-        return $ticket->delete_permanently();
1429
-    }
20
+	/**
21
+	 * @var EE_Admin_Config
22
+	 */
23
+	protected $admin_config;
24
+
25
+	/**
26
+	 * @var AdvancedEditorAdminFormSection
27
+	 */
28
+	protected $advanced_editor_admin_form;
29
+
30
+
31
+	/**
32
+	 * Extend_Events_Admin_Page constructor.
33
+	 *
34
+	 * @param bool $routing
35
+	 * @throws ReflectionException
36
+	 */
37
+	public function __construct($routing = true)
38
+	{
39
+		if (! defined('EVENTS_CAF_TEMPLATE_PATH')) {
40
+			define('EVENTS_CAF_TEMPLATE_PATH', EE_CORE_CAF_ADMIN_EXTEND . 'events/templates/');
41
+			define('EVENTS_CAF_ASSETS', EE_CORE_CAF_ADMIN_EXTEND . 'events/assets/');
42
+			define('EVENTS_CAF_ASSETS_URL', EE_CORE_CAF_ADMIN_EXTEND_URL . 'events/assets/');
43
+		}
44
+		parent::__construct($routing);
45
+		$this->admin_config = $this->loader->getShared('EE_Admin_Config');
46
+	}
47
+
48
+
49
+	/**
50
+	 * Sets routes.
51
+	 *
52
+	 * @throws EE_Error
53
+	 * @throws InvalidArgumentException
54
+	 * @throws InvalidDataTypeException
55
+	 * @throws InvalidInterfaceException
56
+	 * @throws Exception
57
+	 */
58
+	protected function _extend_page_config()
59
+	{
60
+		$this->_admin_base_path = EE_CORE_CAF_ADMIN_EXTEND . 'events';
61
+		// is there a evt_id in the request?
62
+		$evt_id = ! empty($this->_req_data['EVT_ID']) && ! is_array($this->_req_data['EVT_ID'])
63
+			? $this->_req_data['EVT_ID']
64
+			: 0;
65
+		$evt_id = ! empty($this->_req_data['post']) ? $this->_req_data['post'] : $evt_id;
66
+		// tkt_id?
67
+		$tkt_id = ! empty($this->_req_data['TKT_ID']) && ! is_array($this->_req_data['TKT_ID'])
68
+			? $this->_req_data['TKT_ID']
69
+			: 0;
70
+		$new_page_routes = [
71
+			'duplicate_event'          => [
72
+				'func'       => '_duplicate_event',
73
+				'capability' => 'ee_edit_event',
74
+				'obj_id'     => $evt_id,
75
+				'noheader'   => true,
76
+			],
77
+			'import_page'              => [
78
+				'func'       => '_import_page',
79
+				'capability' => 'import',
80
+			],
81
+			'import'                   => [
82
+				'func'       => '_import_events',
83
+				'capability' => 'import',
84
+				'noheader'   => true,
85
+			],
86
+			'import_events'            => [
87
+				'func'       => '_import_events',
88
+				'capability' => 'import',
89
+				'noheader'   => true,
90
+			],
91
+			'export_events'            => [
92
+				'func'       => '_events_export',
93
+				'capability' => 'export',
94
+				'noheader'   => true,
95
+			],
96
+			'export_categories'        => [
97
+				'func'       => '_categories_export',
98
+				'capability' => 'export',
99
+				'noheader'   => true,
100
+			],
101
+			'sample_export_file'       => [
102
+				'func'       => '_sample_export_file',
103
+				'capability' => 'export',
104
+				'noheader'   => true,
105
+			],
106
+			'update_template_settings' => [
107
+				'func'       => '_update_template_settings',
108
+				'capability' => 'manage_options',
109
+				'noheader'   => true,
110
+			],
111
+		];        // don't load these meta boxes if using the advanced editor
112
+		$this->_page_config['create_new']['metaboxes'][] = '_premium_event_editor_meta_boxes';
113
+		$this->_page_config['edit']['metaboxes'][] = '_premium_event_editor_meta_boxes';
114
+		if (! $this->admin_config->useAdvancedEditor()) {
115
+			$this->_page_config['create_new']['qtips'][] = 'EE_Event_Editor_Tips';
116
+			$this->_page_config['edit']['qtips'][] = 'EE_Event_Editor_Tips';
117
+
118
+			$legacy_editor_page_routes = [
119
+				'ticket_list_table' => [
120
+					'func'       => '_tickets_overview_list_table',
121
+					'capability' => 'ee_read_default_tickets',
122
+				],
123
+				'trash_ticket'      => [
124
+					'func'       => '_trash_or_restore_ticket',
125
+					'capability' => 'ee_delete_default_ticket',
126
+					'obj_id'     => $tkt_id,
127
+					'noheader'   => true,
128
+					'args'       => ['trash' => true],
129
+				],
130
+				'trash_tickets'     => [
131
+					'func'       => '_trash_or_restore_ticket',
132
+					'capability' => 'ee_delete_default_tickets',
133
+					'noheader'   => true,
134
+					'args'       => ['trash' => true],
135
+				],
136
+				'restore_ticket'    => [
137
+					'func'       => '_trash_or_restore_ticket',
138
+					'capability' => 'ee_delete_default_ticket',
139
+					'obj_id'     => $tkt_id,
140
+					'noheader'   => true,
141
+				],
142
+				'restore_tickets'   => [
143
+					'func'       => '_trash_or_restore_ticket',
144
+					'capability' => 'ee_delete_default_tickets',
145
+					'noheader'   => true,
146
+				],
147
+				'delete_ticket'     => [
148
+					'func'       => '_delete_ticket',
149
+					'capability' => 'ee_delete_default_ticket',
150
+					'obj_id'     => $tkt_id,
151
+					'noheader'   => true,
152
+				],
153
+				'delete_tickets'    => [
154
+					'func'       => '_delete_ticket',
155
+					'capability' => 'ee_delete_default_tickets',
156
+					'noheader'   => true,
157
+				],
158
+			];
159
+			$new_page_routes = array_merge($new_page_routes, $legacy_editor_page_routes);
160
+		}
161
+
162
+		$this->_page_routes = array_merge($this->_page_routes, $new_page_routes);
163
+		// partial route/config override
164
+		$this->_page_config['import_events']['metaboxes'] = $this->_default_espresso_metaboxes;
165
+		$this->_page_config['default']['list_table'] = 'Extend_Events_Admin_List_Table';
166
+		// add tickets tab but only if there are more than one default ticket!
167
+		$tkt_count = EEM_Ticket::instance()->count_deleted_and_undeleted(
168
+			[['TKT_is_default' => 1]],
169
+			'TKT_ID',
170
+			true
171
+		);
172
+		if ($tkt_count > 1) {
173
+			$new_page_config = [
174
+				'ticket_list_table' => [
175
+					'nav'           => [
176
+						'label' => esc_html__('Default Tickets', 'event_espresso'),
177
+						'order' => 60,
178
+					],
179
+					'list_table'    => 'Tickets_List_Table',
180
+					'require_nonce' => false,
181
+				],
182
+			];
183
+		}
184
+		// template settings
185
+		$new_page_config['template_settings'] = [
186
+			'nav'           => [
187
+				'label' => esc_html__('Templates', 'event_espresso'),
188
+				'order' => 30,
189
+			],
190
+			'metaboxes'     => array_merge($this->_default_espresso_metaboxes, ['_publish_post_box']),
191
+			'help_tabs'     => [
192
+				'general_settings_templates_help_tab' => [
193
+					'title'    => esc_html__('Templates', 'event_espresso'),
194
+					'filename' => 'general_settings_templates',
195
+				],
196
+			],
197
+			'help_tour'     => ['Templates_Help_Tour'],
198
+			'require_nonce' => false,
199
+		];
200
+		$this->_page_config = array_merge($this->_page_config, $new_page_config);
201
+		// add filters and actions
202
+		// modifying _views
203
+		add_filter(
204
+			'FHEE_event_datetime_metabox_add_additional_date_time_template',
205
+			[$this, 'add_additional_datetime_button'],
206
+			10,
207
+			2
208
+		);
209
+		add_filter(
210
+			'FHEE_event_datetime_metabox_clone_button_template',
211
+			[$this, 'add_datetime_clone_button'],
212
+			10,
213
+			2
214
+		);
215
+		add_filter(
216
+			'FHEE_event_datetime_metabox_timezones_template',
217
+			[$this, 'datetime_timezones_template'],
218
+			10,
219
+			2
220
+		);
221
+		// filters for event list table
222
+		add_filter('FHEE__Extend_Events_Admin_List_Table__filters', [$this, 'list_table_filters'], 10, 2);
223
+		add_filter(
224
+			'FHEE__Events_Admin_List_Table__column_actions__action_links',
225
+			[$this, 'extra_list_table_actions'],
226
+			10,
227
+			2
228
+		);
229
+		// legend item
230
+		add_filter('FHEE__Events_Admin_Page___event_legend_items__items', [$this, 'additional_legend_items']);
231
+		add_action('admin_init', [$this, 'admin_init']);
232
+		// load additional handlers
233
+		$this->handleActionRequest();
234
+	}
235
+
236
+
237
+	private function getRequestAction()
238
+	{
239
+		return isset($this->_req_data['action']) ? sanitize_key($this->_req_data['action']) : null;
240
+	}
241
+
242
+
243
+	/**
244
+	 * @throws Exception
245
+	 */
246
+	private function handleActionRequest()
247
+	{
248
+		$action = $this->getRequestAction();
249
+		if ($action) {
250
+			// setup Advanced Editor ???
251
+			if ($action === 'default_event_settings' || $action === 'update_default_event_settings') {
252
+				$this->advanced_editor_admin_form = $this->loader->getShared(
253
+					'EventEspresso\core\domain\services\admin\events\default_settings\AdvancedEditorAdminFormSection'
254
+				);
255
+			}
256
+		}
257
+	}
258
+
259
+
260
+	/**
261
+	 * admin_init
262
+	 */
263
+	public function admin_init()
264
+	{
265
+		EE_Registry::$i18n_js_strings = array_merge(
266
+			EE_Registry::$i18n_js_strings,
267
+			[
268
+				'image_confirm'          => esc_html__(
269
+					'Do you really want to delete this image? Please remember to update your event to complete the removal.',
270
+					'event_espresso'
271
+				),
272
+				'event_starts_on'        => esc_html__('Event Starts on', 'event_espresso'),
273
+				'event_ends_on'          => esc_html__('Event Ends on', 'event_espresso'),
274
+				'event_datetime_actions' => esc_html__('Actions', 'event_espresso'),
275
+				'event_clone_dt_msg'     => esc_html__('Clone this Event Date and Time', 'event_espresso'),
276
+				'remove_event_dt_msg'    => esc_html__('Remove this Event Time', 'event_espresso'),
277
+			]
278
+		);
279
+	}
280
+
281
+
282
+	/**
283
+	 * Add per page screen options to the default ticket list table view.
284
+	 *
285
+	 * @throws InvalidArgumentException
286
+	 * @throws InvalidDataTypeException
287
+	 * @throws InvalidInterfaceException
288
+	 */
289
+	protected function _add_screen_options_ticket_list_table()
290
+	{
291
+		$this->_per_page_screen_option();
292
+	}
293
+
294
+
295
+	/**
296
+	 * @param string $return
297
+	 * @param int    $id
298
+	 * @param string $new_title
299
+	 * @param string $new_slug
300
+	 * @return string
301
+	 */
302
+	public function extra_permalink_field_buttons($return, $id, $new_title, $new_slug)
303
+	{
304
+		$return = parent::extra_permalink_field_buttons($return, $id, $new_title, $new_slug);
305
+		// make sure this is only when editing
306
+		if (! empty($id)) {
307
+			$href = EE_Admin_Page::add_query_args_and_nonce(
308
+				['action' => 'duplicate_event', 'EVT_ID' => $id],
309
+				$this->_admin_base_url
310
+			);
311
+			$title = esc_attr__('Duplicate Event', 'event_espresso');
312
+			$return .= '<a href="'
313
+					   . $href
314
+					   . '" title="'
315
+					   . $title
316
+					   . '" id="ee-duplicate-event-button" class="button button-small"  value="duplicate_event">'
317
+					   . $title
318
+					   . '</a>';
319
+		}
320
+		return $return;
321
+	}
322
+
323
+
324
+	/**
325
+	 * Set the list table views for the default ticket list table view.
326
+	 */
327
+	public function _set_list_table_views_ticket_list_table()
328
+	{
329
+		$this->_views = [
330
+			'all'     => [
331
+				'slug'        => 'all',
332
+				'label'       => esc_html__('All', 'event_espresso'),
333
+				'count'       => 0,
334
+				'bulk_action' => [
335
+					'trash_tickets' => esc_html__('Move to Trash', 'event_espresso'),
336
+				],
337
+			],
338
+			'trashed' => [
339
+				'slug'        => 'trashed',
340
+				'label'       => esc_html__('Trash', 'event_espresso'),
341
+				'count'       => 0,
342
+				'bulk_action' => [
343
+					'restore_tickets' => esc_html__('Restore from Trash', 'event_espresso'),
344
+					'delete_tickets'  => esc_html__('Delete Permanently', 'event_espresso'),
345
+				],
346
+			],
347
+		];
348
+	}
349
+
350
+
351
+	/**
352
+	 * Enqueue scripts and styles for the event editor.
353
+	 */
354
+	public function load_scripts_styles_edit()
355
+	{
356
+		if (! $this->admin_config->useAdvancedEditor()) {
357
+			wp_register_script(
358
+				'ee-event-editor-heartbeat',
359
+				EVENTS_CAF_ASSETS_URL . 'event-editor-heartbeat.js',
360
+				['ee_admin_js', 'heartbeat'],
361
+				EVENT_ESPRESSO_VERSION,
362
+				true
363
+			);
364
+			wp_enqueue_script('ee-accounting');
365
+			wp_enqueue_script('ee-event-editor-heartbeat');
366
+		}
367
+		wp_enqueue_script('event_editor_js');
368
+		// styles
369
+		wp_enqueue_style('espresso-ui-theme');
370
+	}
371
+
372
+
373
+	/**
374
+	 * Returns template for the additional datetime.
375
+	 *
376
+	 * @param $template
377
+	 * @param $template_args
378
+	 * @return mixed
379
+	 * @throws DomainException
380
+	 */
381
+	public function add_additional_datetime_button($template, $template_args)
382
+	{
383
+		return EEH_Template::display_template(
384
+			EVENTS_CAF_TEMPLATE_PATH . 'event_datetime_add_additional_time.template.php',
385
+			$template_args,
386
+			true
387
+		);
388
+	}
389
+
390
+
391
+	/**
392
+	 * Returns the template for cloning a datetime.
393
+	 *
394
+	 * @param $template
395
+	 * @param $template_args
396
+	 * @return mixed
397
+	 * @throws DomainException
398
+	 */
399
+	public function add_datetime_clone_button($template, $template_args)
400
+	{
401
+		return EEH_Template::display_template(
402
+			EVENTS_CAF_TEMPLATE_PATH . 'event_datetime_metabox_clone_button.template.php',
403
+			$template_args,
404
+			true
405
+		);
406
+	}
407
+
408
+
409
+	/**
410
+	 * Returns the template for datetime timezones.
411
+	 *
412
+	 * @param $template
413
+	 * @param $template_args
414
+	 * @return mixed
415
+	 * @throws DomainException
416
+	 */
417
+	public function datetime_timezones_template($template, $template_args)
418
+	{
419
+		return EEH_Template::display_template(
420
+			EVENTS_CAF_TEMPLATE_PATH . 'event_datetime_timezones.template.php',
421
+			$template_args,
422
+			true
423
+		);
424
+	}
425
+
426
+
427
+	/**
428
+	 * Sets the views for the default list table view.
429
+	 *
430
+	 * @throws EE_Error
431
+	 */
432
+	protected function _set_list_table_views_default()
433
+	{
434
+		parent::_set_list_table_views_default();
435
+		$new_views = [
436
+			'today' => [
437
+				'slug'        => 'today',
438
+				'label'       => esc_html__('Today', 'event_espresso'),
439
+				'count'       => $this->total_events_today(),
440
+				'bulk_action' => [
441
+					'trash_events' => esc_html__('Move to Trash', 'event_espresso'),
442
+				],
443
+			],
444
+			'month' => [
445
+				'slug'        => 'month',
446
+				'label'       => esc_html__('This Month', 'event_espresso'),
447
+				'count'       => $this->total_events_this_month(),
448
+				'bulk_action' => [
449
+					'trash_events' => esc_html__('Move to Trash', 'event_espresso'),
450
+				],
451
+			],
452
+		];
453
+		$this->_views = array_merge($this->_views, $new_views);
454
+	}
455
+
456
+
457
+	/**
458
+	 * Returns the extra action links for the default list table view.
459
+	 *
460
+	 * @param array    $action_links
461
+	 * @param EE_Event $event
462
+	 * @return array
463
+	 * @throws EE_Error
464
+	 * @throws InvalidArgumentException
465
+	 * @throws InvalidDataTypeException
466
+	 * @throws InvalidInterfaceException
467
+	 * @throws ReflectionException
468
+	 */
469
+	public function extra_list_table_actions(array $action_links, EE_Event $event)
470
+	{
471
+		if (EE_Registry::instance()->CAP->current_user_can(
472
+			'ee_read_registrations',
473
+			'espresso_registrations_reports',
474
+			$event->ID()
475
+		)
476
+		) {
477
+			$reports_query_args = [
478
+				'action' => 'reports',
479
+				'EVT_ID' => $event->ID(),
480
+			];
481
+			$reports_link = EE_Admin_Page::add_query_args_and_nonce($reports_query_args, REG_ADMIN_URL);
482
+			$action_links[] = '<a href="'
483
+							  . $reports_link
484
+							  . '" title="'
485
+							  . esc_attr__('View Report', 'event_espresso')
486
+							  . '"><div class="dashicons dashicons-chart-bar"></div></a>'
487
+							  . "\n\t";
488
+		}
489
+		if (EE_Registry::instance()->CAP->current_user_can('ee_read_global_messages', 'view_filtered_messages')) {
490
+			EE_Registry::instance()->load_helper('MSG_Template');
491
+			$action_links[] = EEH_MSG_Template::get_message_action_link(
492
+				'see_notifications_for',
493
+				null,
494
+				['EVT_ID' => $event->ID()]
495
+			);
496
+		}
497
+		return $action_links;
498
+	}
499
+
500
+
501
+	/**
502
+	 * @param $items
503
+	 * @return mixed
504
+	 */
505
+	public function additional_legend_items($items)
506
+	{
507
+		if (EE_Registry::instance()->CAP->current_user_can(
508
+			'ee_read_registrations',
509
+			'espresso_registrations_reports'
510
+		)
511
+		) {
512
+			$items['reports'] = [
513
+				'class' => 'dashicons dashicons-chart-bar',
514
+				'desc'  => esc_html__('Event Reports', 'event_espresso'),
515
+			];
516
+		}
517
+		if (EE_Registry::instance()->CAP->current_user_can('ee_read_global_messages', 'view_filtered_messages')) {
518
+			$related_for_icon = EEH_MSG_Template::get_message_action_icon('see_notifications_for');
519
+			// $related_for_icon can sometimes be a string so 'css_class' would be an illegal offset
520
+			// (can only use numeric offsets when treating strings as arrays)
521
+			if (is_array($related_for_icon) && isset($related_for_icon['css_class'], $related_for_icon['label'])) {
522
+				$items['view_related_messages'] = [
523
+					'class' => $related_for_icon['css_class'],
524
+					'desc'  => $related_for_icon['label'],
525
+				];
526
+			}
527
+		}
528
+		return $items;
529
+	}
530
+
531
+
532
+	/**
533
+	 * This is the callback method for the duplicate event route
534
+	 * Method looks for 'EVT_ID' in the request and retrieves that event and its details and duplicates them
535
+	 * into a new event.  We add a hook so that any plugins that add extra event details can hook into this
536
+	 * action.  Note that the dupe will have **DUPLICATE** as its title and slug.
537
+	 * After duplication the redirect is to the new event edit page.
538
+	 *
539
+	 * @return void
540
+	 * @throws EE_Error If EE_Event is not available with given ID
541
+	 * @throws InvalidArgumentException
542
+	 * @throws InvalidDataTypeException
543
+	 * @throws InvalidInterfaceException
544
+	 * @throws ReflectionException
545
+	 * @access protected
546
+	 */
547
+	protected function _duplicate_event()
548
+	{
549
+		// first make sure the ID for the event is in the request.
550
+		//  If it isn't then we need to bail and redirect back to overview list table (cause how did we get here?)
551
+		if (! isset($this->_req_data['EVT_ID'])) {
552
+			EE_Error::add_error(
553
+				esc_html__(
554
+					'In order to duplicate an event an Event ID is required.  None was given.',
555
+					'event_espresso'
556
+				),
557
+				__FILE__,
558
+				__FUNCTION__,
559
+				__LINE__
560
+			);
561
+			$this->_redirect_after_action(false, '', '', [], true);
562
+			return;
563
+		}
564
+		// k we've got EVT_ID so let's use that to get the event we'll duplicate
565
+		$orig_event = EEM_Event::instance()->get_one_by_ID($this->_req_data['EVT_ID']);
566
+		if (! $orig_event instanceof EE_Event) {
567
+			throw new EE_Error(
568
+				sprintf(
569
+					esc_html__('An EE_Event object could not be retrieved for the given ID (%s)', 'event_espresso'),
570
+					$this->_req_data['EVT_ID']
571
+				)
572
+			);
573
+		}
574
+		// k now let's clone the $orig_event before getting relations
575
+		$new_event = clone $orig_event;
576
+		// original datetimes
577
+		$orig_datetimes = $orig_event->get_many_related('Datetime');
578
+		// other original relations
579
+		$orig_ven = $orig_event->get_many_related('Venue');
580
+		// reset the ID and modify other details to make it clear this is a dupe
581
+		$new_event->set('EVT_ID', 0);
582
+		$new_name = $new_event->name() . ' ' . esc_html__('**DUPLICATE**', 'event_espresso');
583
+		$new_event->set('EVT_name', $new_name);
584
+		$new_event->set(
585
+			'EVT_slug',
586
+			wp_unique_post_slug(
587
+				sanitize_title($orig_event->name()),
588
+				0,
589
+				'publish',
590
+				'espresso_events',
591
+				0
592
+			)
593
+		);
594
+		$new_event->set('status', 'draft');
595
+		// duplicate discussion settings
596
+		$new_event->set('comment_status', $orig_event->get('comment_status'));
597
+		$new_event->set('ping_status', $orig_event->get('ping_status'));
598
+		// save the new event
599
+		$new_event->save();
600
+		// venues
601
+		foreach ($orig_ven as $ven) {
602
+			$new_event->_add_relation_to($ven, 'Venue');
603
+		}
604
+		$new_event->save();
605
+		// now we need to get the question group relations and handle that
606
+		// first primary question groups
607
+		$orig_primary_qgs = $orig_event->get_many_related(
608
+			'Question_Group',
609
+			[['Event_Question_Group.EQG_primary' => true]]
610
+		);
611
+		if (! empty($orig_primary_qgs)) {
612
+			foreach ($orig_primary_qgs as $id => $obj) {
613
+				if ($obj instanceof EE_Question_Group) {
614
+					$new_event->_add_relation_to($obj, 'Question_Group', ['EQG_primary' => true]);
615
+				}
616
+			}
617
+		}
618
+		// next additional attendee question groups
619
+		$orig_additional_qgs = $orig_event->get_many_related(
620
+			'Question_Group',
621
+			[['Event_Question_Group.EQG_additional' => true]]
622
+		);
623
+		if (! empty($orig_additional_qgs)) {
624
+			foreach ($orig_additional_qgs as $id => $obj) {
625
+				if ($obj instanceof EE_Question_Group) {
626
+					$new_event->_add_relation_to($obj, 'Question_Group', ['EQG_additional' => true]);
627
+				}
628
+			}
629
+		}
630
+
631
+		$new_event->save();
632
+
633
+		// k now that we have the new event saved we can loop through the datetimes and start adding relations.
634
+		$cloned_tickets = [];
635
+		foreach ($orig_datetimes as $orig_dtt) {
636
+			if (! $orig_dtt instanceof EE_Datetime) {
637
+				continue;
638
+			}
639
+			$new_dtt = clone $orig_dtt;
640
+			$orig_tkts = $orig_dtt->tickets();
641
+			// save new dtt then add to event
642
+			$new_dtt->set('DTT_ID', 0);
643
+			$new_dtt->set('DTT_sold', 0);
644
+			$new_dtt->set_reserved(0);
645
+			$new_dtt->save();
646
+			$new_event->_add_relation_to($new_dtt, 'Datetime');
647
+			$new_event->save();
648
+			// now let's get the ticket relations setup.
649
+			foreach ((array) $orig_tkts as $orig_tkt) {
650
+				// it's possible a datetime will have no tickets so let's verify we HAVE a ticket first.
651
+				if (! $orig_tkt instanceof EE_Ticket) {
652
+					continue;
653
+				}
654
+				// is this ticket archived?  If it is then let's skip
655
+				if ($orig_tkt->get('TKT_deleted')) {
656
+					continue;
657
+				}
658
+				// does this original ticket already exist in the clone_tickets cache?
659
+				//  If so we'll just use the new ticket from it.
660
+				if (isset($cloned_tickets[ $orig_tkt->ID() ])) {
661
+					$new_tkt = $cloned_tickets[ $orig_tkt->ID() ];
662
+				} else {
663
+					$new_tkt = clone $orig_tkt;
664
+					// get relations on the $orig_tkt that we need to setup.
665
+					$orig_prices = $orig_tkt->prices();
666
+					$new_tkt->set('TKT_ID', 0);
667
+					$new_tkt->set('TKT_sold', 0);
668
+					$new_tkt->set('TKT_reserved', 0);
669
+					$new_tkt->save(); // make sure new ticket has ID.
670
+					// price relations on new ticket need to be setup.
671
+					foreach ($orig_prices as $orig_price) {
672
+						$new_price = clone $orig_price;
673
+						$new_price->set('PRC_ID', 0);
674
+						$new_price->save();
675
+						$new_tkt->_add_relation_to($new_price, 'Price');
676
+						$new_tkt->save();
677
+					}
678
+
679
+					do_action(
680
+						'AHEE__Extend_Events_Admin_Page___duplicate_event__duplicate_ticket__after',
681
+						$orig_tkt,
682
+						$new_tkt,
683
+						$orig_prices,
684
+						$orig_event,
685
+						$orig_dtt,
686
+						$new_dtt
687
+					);
688
+				}
689
+				// k now we can add the new ticket as a relation to the new datetime
690
+				// and make sure its added to our cached $cloned_tickets array
691
+				// for use with later datetimes that have the same ticket.
692
+				$new_dtt->_add_relation_to($new_tkt, 'Ticket');
693
+				$new_dtt->save();
694
+				$cloned_tickets[ $orig_tkt->ID() ] = $new_tkt;
695
+			}
696
+		}
697
+		// clone taxonomy information
698
+		$taxonomies_to_clone_with = apply_filters(
699
+			'FHEE__Extend_Events_Admin_Page___duplicate_event__taxonomies_to_clone',
700
+			['espresso_event_categories', 'espresso_event_type', 'post_tag']
701
+		);
702
+		// get terms for original event (notice)
703
+		$orig_terms = wp_get_object_terms($orig_event->ID(), $taxonomies_to_clone_with);
704
+		// loop through terms and add them to new event.
705
+		foreach ($orig_terms as $term) {
706
+			wp_set_object_terms($new_event->ID(), $term->term_id, $term->taxonomy, true);
707
+		}
708
+
709
+		// duplicate other core WP_Post items for this event.
710
+		// post thumbnail (feature image).
711
+		$feature_image_id = get_post_thumbnail_id($orig_event->ID());
712
+		if ($feature_image_id) {
713
+			update_post_meta($new_event->ID(), '_thumbnail_id', $feature_image_id);
714
+		}
715
+
716
+		// duplicate page_template setting
717
+		$page_template = get_post_meta($orig_event->ID(), '_wp_page_template', true);
718
+		if ($page_template) {
719
+			update_post_meta($new_event->ID(), '_wp_page_template', $page_template);
720
+		}
721
+
722
+		do_action('AHEE__Extend_Events_Admin_Page___duplicate_event__after', $new_event, $orig_event);
723
+		// now let's redirect to the edit page for this duplicated event if we have a new event id.
724
+		if ($new_event->ID()) {
725
+			$redirect_args = [
726
+				'post'   => $new_event->ID(),
727
+				'action' => 'edit',
728
+			];
729
+			EE_Error::add_success(
730
+				esc_html__(
731
+					'Event successfully duplicated.  Please review the details below and make any necessary edits',
732
+					'event_espresso'
733
+				)
734
+			);
735
+		} else {
736
+			$redirect_args = [
737
+				'action' => 'default',
738
+			];
739
+			EE_Error::add_error(
740
+				esc_html__('Not able to duplicate event.  Something went wrong.', 'event_espresso'),
741
+				__FILE__,
742
+				__FUNCTION__,
743
+				__LINE__
744
+			);
745
+		}
746
+		$this->_redirect_after_action(false, '', '', $redirect_args, true);
747
+	}
748
+
749
+
750
+	/**
751
+	 * Generates output for the import page.
752
+	 *
753
+	 * @throws DomainException
754
+	 * @throws EE_Error
755
+	 * @throws InvalidArgumentException
756
+	 * @throws InvalidDataTypeException
757
+	 * @throws InvalidInterfaceException
758
+	 */
759
+	protected function _import_page()
760
+	{
761
+		$title = esc_html__('Import', 'event_espresso');
762
+		$intro = esc_html__(
763
+			'If you have a previously exported Event Espresso 4 information in a Comma Separated Value (CSV) file format, you can upload the file here: ',
764
+			'event_espresso'
765
+		);
766
+		$form_url = EVENTS_ADMIN_URL;
767
+		$action = 'import_events';
768
+		$type = 'csv';
769
+		$this->_template_args['form'] = EE_Import::instance()->upload_form(
770
+			$title,
771
+			$intro,
772
+			$form_url,
773
+			$action,
774
+			$type
775
+		);
776
+		$this->_template_args['sample_file_link'] = EE_Admin_Page::add_query_args_and_nonce(
777
+			['action' => 'sample_export_file'],
778
+			$this->_admin_base_url
779
+		);
780
+		$content = EEH_Template::display_template(
781
+			EVENTS_CAF_TEMPLATE_PATH . 'import_page.template.php',
782
+			$this->_template_args,
783
+			true
784
+		);
785
+		$this->_template_args['admin_page_content'] = $content;
786
+		$this->display_admin_page_with_sidebar();
787
+	}
788
+
789
+
790
+	/**
791
+	 * _import_events
792
+	 * This handles displaying the screen and running imports for importing events.
793
+	 *
794
+	 * @return void
795
+	 * @throws EE_Error
796
+	 * @throws InvalidArgumentException
797
+	 * @throws InvalidDataTypeException
798
+	 * @throws InvalidInterfaceException
799
+	 */
800
+	protected function _import_events()
801
+	{
802
+		require_once(EE_CLASSES . 'EE_Import.class.php');
803
+		$success = EE_Import::instance()->import();
804
+		$this->_redirect_after_action($success, 'Import File', 'ran', ['action' => 'import_page'], true);
805
+	}
806
+
807
+
808
+	/**
809
+	 * _events_export
810
+	 * Will export all (or just the given event) to a Excel compatible file.
811
+	 *
812
+	 * @access protected
813
+	 * @return void
814
+	 */
815
+	protected function _events_export()
816
+	{
817
+		if (isset($this->_req_data['EVT_ID'])) {
818
+			$event_ids = $this->_req_data['EVT_ID'];
819
+		} elseif (isset($this->_req_data['EVT_IDs'])) {
820
+			$event_ids = $this->_req_data['EVT_IDs'];
821
+		} else {
822
+			$event_ids = null;
823
+		}
824
+		// todo: I don't like doing this but it'll do until we modify EE_Export Class.
825
+		$new_request_args = [
826
+			'export' => 'report',
827
+			'action' => 'all_event_data',
828
+			'EVT_ID' => $event_ids,
829
+		];
830
+		$this->_req_data = array_merge($this->_req_data, $new_request_args);
831
+		if (is_readable(EE_CLASSES . 'EE_Export.class.php')) {
832
+			require_once(EE_CLASSES . 'EE_Export.class.php');
833
+			$EE_Export = EE_Export::instance($this->_req_data);
834
+			if ($EE_Export instanceof EE_Export) {
835
+				$EE_Export->export();
836
+			}
837
+		}
838
+	}
839
+
840
+
841
+	/**
842
+	 * handle category exports()
843
+	 *
844
+	 * @return void
845
+	 */
846
+	protected function _categories_export()
847
+	{
848
+		// todo: I don't like doing this but it'll do until we modify EE_Export Class.
849
+		$new_request_args = [
850
+			'export'       => 'report',
851
+			'action'       => 'categories',
852
+			'category_ids' => $this->_req_data['EVT_CAT_ID'],
853
+		];
854
+		$this->_req_data = array_merge($this->_req_data, $new_request_args);
855
+		if (is_readable(EE_CLASSES . 'EE_Export.class.php')) {
856
+			require_once(EE_CLASSES . 'EE_Export.class.php');
857
+			$EE_Export = EE_Export::instance($this->_req_data);
858
+			if ($EE_Export instanceof EE_Export) {
859
+				$EE_Export->export();
860
+			}
861
+		}
862
+	}
863
+
864
+
865
+	/**
866
+	 * Creates a sample CSV file for importing
867
+	 */
868
+	protected function _sample_export_file()
869
+	{
870
+		$EE_Export = EE_Export::instance();
871
+		if ($EE_Export instanceof EE_Export) {
872
+			$EE_Export->export();
873
+		}
874
+	}
875
+
876
+
877
+	/*************        Template Settings        *************/
878
+	/**
879
+	 * Generates template settings page output
880
+	 *
881
+	 * @throws DomainException
882
+	 * @throws EE_Error
883
+	 * @throws InvalidArgumentException
884
+	 * @throws InvalidDataTypeException
885
+	 * @throws InvalidInterfaceException
886
+	 */
887
+	protected function _template_settings()
888
+	{
889
+		$this->_template_args['values'] = $this->_yes_no_values;
890
+		/**
891
+		 * Note leaving this filter in for backward compatibility this was moved in 4.6.x
892
+		 * from General_Settings_Admin_Page to here.
893
+		 */
894
+		$this->_template_args = apply_filters(
895
+			'FHEE__General_Settings_Admin_Page__template_settings__template_args',
896
+			$this->_template_args
897
+		);
898
+		$this->_set_add_edit_form_tags('update_template_settings');
899
+		$this->_set_publish_post_box_vars(null, false, false, null, false);
900
+		$this->_template_args['admin_page_content'] = EEH_Template::display_template(
901
+			EVENTS_CAF_TEMPLATE_PATH . 'template_settings.template.php',
902
+			$this->_template_args,
903
+			true
904
+		);
905
+		$this->display_admin_page_with_sidebar();
906
+	}
907
+
908
+
909
+	/**
910
+	 * Handler for updating template settings.
911
+	 *
912
+	 * @throws EE_Error
913
+	 * @throws InvalidArgumentException
914
+	 * @throws InvalidDataTypeException
915
+	 * @throws InvalidInterfaceException
916
+	 */
917
+	protected function _update_template_settings()
918
+	{
919
+		/**
920
+		 * Note leaving this filter in for backward compatibility this was moved in 4.6.x
921
+		 * from General_Settings_Admin_Page to here.
922
+		 */
923
+		EE_Registry::instance()->CFG->template_settings = apply_filters(
924
+			'FHEE__General_Settings_Admin_Page__update_template_settings__data',
925
+			EE_Registry::instance()->CFG->template_settings,
926
+			$this->_req_data
927
+		);
928
+		// update custom post type slugs and detect if we need to flush rewrite rules
929
+		$old_slug = EE_Registry::instance()->CFG->core->event_cpt_slug;
930
+		EE_Registry::instance()->CFG->core->event_cpt_slug = empty($this->_req_data['event_cpt_slug'])
931
+			? EE_Registry::instance()->CFG->core->event_cpt_slug
932
+			: EEH_URL::slugify($this->_req_data['event_cpt_slug'], 'events');
933
+		$what = 'Template Settings';
934
+		$success = $this->_update_espresso_configuration(
935
+			$what,
936
+			EE_Registry::instance()->CFG->template_settings,
937
+			__FILE__,
938
+			__FUNCTION__,
939
+			__LINE__
940
+		);
941
+		if (EE_Registry::instance()->CFG->core->event_cpt_slug !== $old_slug) {
942
+			/** @var EventEspresso\core\domain\services\custom_post_types\RewriteRules $rewrite_rules */
943
+			$rewrite_rules = LoaderFactory::getLoader()->getShared(
944
+				'EventEspresso\core\domain\services\custom_post_types\RewriteRules'
945
+			);
946
+			$rewrite_rules->flush();
947
+		}
948
+		$this->_redirect_after_action($success, $what, 'updated', ['action' => 'template_settings']);
949
+	}
950
+
951
+
952
+	/**
953
+	 * _premium_event_editor_meta_boxes
954
+	 * add all metaboxes related to the event_editor
955
+	 *
956
+	 * @access protected
957
+	 * @return void
958
+	 * @throws EE_Error
959
+	 * @throws InvalidArgumentException
960
+	 * @throws InvalidDataTypeException
961
+	 * @throws InvalidInterfaceException
962
+	 * @throws ReflectionException
963
+	 */
964
+	protected function _premium_event_editor_meta_boxes()
965
+	{
966
+		$this->verify_cpt_object();
967
+		/** @var FeatureFlags $flags */
968
+		$flags = $this->loader->getShared('EventEspresso\core\domain\services\capabilities\FeatureFlags');
969
+		// check if the new EDTR reg options meta box is being used, and if so, don't load the legacy version
970
+		if (! $this->admin_config->useAdvancedEditor() || ! $flags->featureAllowed('use_reg_options_meta_box')) {
971
+			add_meta_box(
972
+				'espresso_event_editor_event_options',
973
+				esc_html__('Event Registration Options', 'event_espresso'),
974
+				[$this, 'registration_options_meta_box'],
975
+				$this->page_slug,
976
+				'side',
977
+				'core'
978
+			);
979
+		}
980
+	}
981
+
982
+
983
+	/**
984
+	 * override caf metabox
985
+	 *
986
+	 * @return void
987
+	 * @throws DomainException
988
+	 * @throws EE_Error
989
+	 */
990
+	public function registration_options_meta_box()
991
+	{
992
+		$yes_no_values = [
993
+			['id' => true, 'text' => esc_html__('Yes', 'event_espresso')],
994
+			['id' => false, 'text' => esc_html__('No', 'event_espresso')],
995
+		];
996
+		$default_reg_status_values = EEM_Registration::reg_status_array(
997
+			[
998
+				EEM_Registration::status_id_cancelled,
999
+				EEM_Registration::status_id_declined,
1000
+				EEM_Registration::status_id_incomplete,
1001
+				EEM_Registration::status_id_wait_list,
1002
+			],
1003
+			true
1004
+		);
1005
+		$template_args['active_status'] = $this->_cpt_model_obj->pretty_active_status(false);
1006
+		$template_args['_event'] = $this->_cpt_model_obj;
1007
+		$template_args['additional_limit'] = $this->_cpt_model_obj->additional_limit();
1008
+		$template_args['default_registration_status'] = EEH_Form_Fields::select_input(
1009
+			'default_reg_status',
1010
+			$default_reg_status_values,
1011
+			$this->_cpt_model_obj->default_registration_status()
1012
+		);
1013
+		$template_args['display_description'] = EEH_Form_Fields::select_input(
1014
+			'display_desc',
1015
+			$yes_no_values,
1016
+			$this->_cpt_model_obj->display_description()
1017
+		);
1018
+		$template_args['display_ticket_selector'] = EEH_Form_Fields::select_input(
1019
+			'display_ticket_selector',
1020
+			$yes_no_values,
1021
+			$this->_cpt_model_obj->display_ticket_selector(),
1022
+			'',
1023
+			'',
1024
+			false
1025
+		);
1026
+		$template_args['EVT_default_registration_status'] = EEH_Form_Fields::select_input(
1027
+			'EVT_default_registration_status',
1028
+			$default_reg_status_values,
1029
+			$this->_cpt_model_obj->default_registration_status()
1030
+		);
1031
+		$template_args['additional_registration_options'] = apply_filters(
1032
+			'FHEE__Events_Admin_Page__registration_options_meta_box__additional_registration_options',
1033
+			'',
1034
+			$template_args,
1035
+			$yes_no_values,
1036
+			$default_reg_status_values
1037
+		);
1038
+		EEH_Template::display_template(
1039
+			EVENTS_CAF_TEMPLATE_PATH . 'event_registration_options.template.php',
1040
+			$template_args
1041
+		);
1042
+	}
1043
+
1044
+
1045
+
1046
+	/**
1047
+	 * wp_list_table_mods for caf
1048
+	 * ============================
1049
+	 */
1050
+	/**
1051
+	 * hook into list table filters and provide filters for caffeinated list table
1052
+	 *
1053
+	 * @param array $old_filters    any existing filters present
1054
+	 * @param array $list_table_obj the list table object
1055
+	 * @return array                  new filters
1056
+	 * @throws EE_Error
1057
+	 * @throws InvalidArgumentException
1058
+	 * @throws InvalidDataTypeException
1059
+	 * @throws InvalidInterfaceException
1060
+	 * @throws ReflectionException
1061
+	 */
1062
+	public function list_table_filters($old_filters, $list_table_obj)
1063
+	{
1064
+		$filters = [];
1065
+		// first month/year filters
1066
+		$filters[] = $this->espresso_event_months_dropdown();
1067
+		$status = isset($this->_req_data['status']) ? $this->_req_data['status'] : null;
1068
+		// active status dropdown
1069
+		if ($status !== 'draft') {
1070
+			$filters[] = $this->active_status_dropdown(
1071
+				isset($this->_req_data['active_status']) ? $this->_req_data['active_status'] : ''
1072
+			);
1073
+			$filters[] = $this->venuesDropdown(
1074
+				isset($this->_req_data['venue']) ? $this->_req_data['venue'] : ''
1075
+			);
1076
+		}
1077
+		// category filter
1078
+		$filters[] = $this->category_dropdown();
1079
+		return array_merge($old_filters, $filters);
1080
+	}
1081
+
1082
+
1083
+	/**
1084
+	 * espresso_event_months_dropdown
1085
+	 *
1086
+	 * @access public
1087
+	 * @return string                dropdown listing month/year selections for events.
1088
+	 */
1089
+	public function espresso_event_months_dropdown()
1090
+	{
1091
+		// what we need to do is get all PRIMARY datetimes for all events to filter on.
1092
+		// Note we need to include any other filters that are set!
1093
+		$status = isset($this->_req_data['status']) ? $this->_req_data['status'] : null;
1094
+		// categories?
1095
+		$category = isset($this->_req_data['EVT_CAT']) && $this->_req_data['EVT_CAT'] > 0
1096
+			? $this->_req_data['EVT_CAT']
1097
+			: null;
1098
+		// active status?
1099
+		$active_status = isset($this->_req_data['active_status']) ? $this->_req_data['active_status'] : null;
1100
+		$cur_date = isset($this->_req_data['month_range']) ? $this->_req_data['month_range'] : '';
1101
+		return EEH_Form_Fields::generate_event_months_dropdown($cur_date, $status, $category, $active_status);
1102
+	}
1103
+
1104
+
1105
+	/**
1106
+	 * returns a list of "active" statuses on the event
1107
+	 *
1108
+	 * @param string $current_value whatever the current active status is
1109
+	 * @return string
1110
+	 */
1111
+	public function active_status_dropdown($current_value = '')
1112
+	{
1113
+		$select_name = 'active_status';
1114
+		$values = [
1115
+			'none'     => esc_html__('Show Active/Inactive', 'event_espresso'),
1116
+			'active'   => esc_html__('Active', 'event_espresso'),
1117
+			'upcoming' => esc_html__('Upcoming', 'event_espresso'),
1118
+			'expired'  => esc_html__('Expired', 'event_espresso'),
1119
+			'inactive' => esc_html__('Inactive', 'event_espresso'),
1120
+		];
1121
+
1122
+		return EEH_Form_Fields::select_input($select_name, $values, $current_value, '', 'wide');
1123
+	}
1124
+
1125
+
1126
+	/**
1127
+	 * returns a list of "venues"
1128
+	 *
1129
+	 * @param string $current_value whatever the current active status is
1130
+	 * @return string
1131
+	 * @throws EE_Error
1132
+	 * @throws InvalidArgumentException
1133
+	 * @throws InvalidDataTypeException
1134
+	 * @throws InvalidInterfaceException
1135
+	 * @throws ReflectionException
1136
+	 */
1137
+	protected function venuesDropdown($current_value = '')
1138
+	{
1139
+		$select_name = 'venue';
1140
+		$values = [
1141
+			'' => esc_html__('All Venues', 'event_espresso'),
1142
+		];
1143
+		// populate the list of venues.
1144
+		$venue_model = EE_Registry::instance()->load_model('Venue');
1145
+		$venues = $venue_model->get_all(['order_by' => ['VNU_name' => 'ASC']]);
1146
+
1147
+		foreach ($venues as $venue) {
1148
+			$values[ $venue->ID() ] = $venue->name();
1149
+		}
1150
+
1151
+		return EEH_Form_Fields::select_input($select_name, $values, $current_value, '', 'wide');
1152
+	}
1153
+
1154
+
1155
+	/**
1156
+	 * output a dropdown of the categories for the category filter on the event admin list table
1157
+	 *
1158
+	 * @access  public
1159
+	 * @return string html
1160
+	 */
1161
+	public function category_dropdown()
1162
+	{
1163
+		$cur_cat = isset($this->_req_data['EVT_CAT']) ? $this->_req_data['EVT_CAT'] : -1;
1164
+		return EEH_Form_Fields::generate_event_category_dropdown($cur_cat);
1165
+	}
1166
+
1167
+
1168
+	/**
1169
+	 * get total number of events today
1170
+	 *
1171
+	 * @access public
1172
+	 * @return int
1173
+	 * @throws EE_Error
1174
+	 * @throws InvalidArgumentException
1175
+	 * @throws InvalidDataTypeException
1176
+	 * @throws InvalidInterfaceException
1177
+	 */
1178
+	public function total_events_today()
1179
+	{
1180
+		$start = EEM_Datetime::instance()->convert_datetime_for_query(
1181
+			'DTT_EVT_start',
1182
+			date('Y-m-d') . ' 00:00:00',
1183
+			'Y-m-d H:i:s',
1184
+			'UTC'
1185
+		);
1186
+		$end = EEM_Datetime::instance()->convert_datetime_for_query(
1187
+			'DTT_EVT_start',
1188
+			date('Y-m-d') . ' 23:59:59',
1189
+			'Y-m-d H:i:s',
1190
+			'UTC'
1191
+		);
1192
+		$where = [
1193
+			'Datetime.DTT_EVT_start' => ['BETWEEN', [$start, $end]],
1194
+		];
1195
+		return EEM_Event::instance()->count([$where, 'caps' => 'read_admin'], 'EVT_ID', true);
1196
+	}
1197
+
1198
+
1199
+	/**
1200
+	 * get total number of events this month
1201
+	 *
1202
+	 * @access public
1203
+	 * @return int
1204
+	 * @throws EE_Error
1205
+	 * @throws InvalidArgumentException
1206
+	 * @throws InvalidDataTypeException
1207
+	 * @throws InvalidInterfaceException
1208
+	 */
1209
+	public function total_events_this_month()
1210
+	{
1211
+		// Dates
1212
+		$this_year_r = date('Y');
1213
+		$this_month_r = date('m');
1214
+		$days_this_month = date('t');
1215
+		$start = EEM_Datetime::instance()->convert_datetime_for_query(
1216
+			'DTT_EVT_start',
1217
+			$this_year_r . '-' . $this_month_r . '-01 00:00:00',
1218
+			'Y-m-d H:i:s',
1219
+			'UTC'
1220
+		);
1221
+		$end = EEM_Datetime::instance()->convert_datetime_for_query(
1222
+			'DTT_EVT_start',
1223
+			$this_year_r . '-' . $this_month_r . '-' . $days_this_month . ' 23:59:59',
1224
+			'Y-m-d H:i:s',
1225
+			'UTC'
1226
+		);
1227
+		$where = [
1228
+			'Datetime.DTT_EVT_start' => ['BETWEEN', [$start, $end]],
1229
+		];
1230
+		return EEM_Event::instance()->count([$where, 'caps' => 'read_admin'], 'EVT_ID', true);
1231
+	}
1232
+
1233
+
1234
+	/** DEFAULT TICKETS STUFF **/
1235
+
1236
+	/**
1237
+	 * Output default tickets list table view.
1238
+	 *
1239
+	 * @throws DomainException
1240
+	 * @throws EE_Error
1241
+	 * @throws InvalidArgumentException
1242
+	 * @throws InvalidDataTypeException
1243
+	 * @throws InvalidInterfaceException
1244
+	 */
1245
+	public function _tickets_overview_list_table()
1246
+	{
1247
+		$this->_search_btn_label = esc_html__('Tickets', 'event_espresso');
1248
+		$this->display_admin_list_table_page_with_no_sidebar();
1249
+	}
1250
+
1251
+
1252
+	/**
1253
+	 * @param int  $per_page
1254
+	 * @param bool $count
1255
+	 * @param bool $trashed
1256
+	 * @return EE_Soft_Delete_Base_Class[]|int
1257
+	 * @throws EE_Error
1258
+	 * @throws InvalidArgumentException
1259
+	 * @throws InvalidDataTypeException
1260
+	 * @throws InvalidInterfaceException
1261
+	 */
1262
+	public function get_default_tickets($per_page = 10, $count = false, $trashed = false)
1263
+	{
1264
+		$orderby = empty($this->_req_data['orderby']) ? 'TKT_name' : $this->_req_data['orderby'];
1265
+		$order = empty($this->_req_data['order']) ? 'ASC' : $this->_req_data['order'];
1266
+		switch ($orderby) {
1267
+			case 'TKT_name':
1268
+				$orderby = ['TKT_name' => $order];
1269
+				break;
1270
+			case 'TKT_price':
1271
+				$orderby = ['TKT_price' => $order];
1272
+				break;
1273
+			case 'TKT_uses':
1274
+				$orderby = ['TKT_uses' => $order];
1275
+				break;
1276
+			case 'TKT_min':
1277
+				$orderby = ['TKT_min' => $order];
1278
+				break;
1279
+			case 'TKT_max':
1280
+				$orderby = ['TKT_max' => $order];
1281
+				break;
1282
+			case 'TKT_qty':
1283
+				$orderby = ['TKT_qty' => $order];
1284
+				break;
1285
+		}
1286
+		$current_page = isset($this->_req_data['paged']) && ! empty($this->_req_data['paged'])
1287
+			? $this->_req_data['paged']
1288
+			: 1;
1289
+		$per_page = isset($this->_req_data['perpage']) && ! empty($this->_req_data['perpage'])
1290
+			? $this->_req_data['perpage']
1291
+			: $per_page;
1292
+		$_where = [
1293
+			'TKT_is_default' => 1,
1294
+			'TKT_deleted'    => $trashed,
1295
+		];
1296
+		$offset = ($current_page - 1) * $per_page;
1297
+		$limit = [$offset, $per_page];
1298
+		if (isset($this->_req_data['s'])) {
1299
+			$sstr = '%' . $this->_req_data['s'] . '%';
1300
+			$_where['OR'] = [
1301
+				'TKT_name'        => ['LIKE', $sstr],
1302
+				'TKT_description' => ['LIKE', $sstr],
1303
+			];
1304
+		}
1305
+		$query_params = [
1306
+			$_where,
1307
+			'order_by' => $orderby,
1308
+			'limit'    => $limit,
1309
+			'group_by' => 'TKT_ID',
1310
+		];
1311
+		if ($count) {
1312
+			return EEM_Ticket::instance()->count_deleted_and_undeleted([$_where]);
1313
+		}
1314
+		return EEM_Ticket::instance()->get_all_deleted_and_undeleted($query_params);
1315
+	}
1316
+
1317
+
1318
+	/**
1319
+	 * @param bool $trash
1320
+	 * @throws EE_Error
1321
+	 * @throws InvalidArgumentException
1322
+	 * @throws InvalidDataTypeException
1323
+	 * @throws InvalidInterfaceException
1324
+	 */
1325
+	protected function _trash_or_restore_ticket($trash = false)
1326
+	{
1327
+		$success = 1;
1328
+		$TKT = EEM_Ticket::instance();
1329
+		// checkboxes?
1330
+		if (! empty($this->_req_data['checkbox']) && is_array($this->_req_data['checkbox'])) {
1331
+			// if array has more than one element then success message should be plural
1332
+			$success = count($this->_req_data['checkbox']) > 1 ? 2 : 1;
1333
+			// cycle thru the boxes
1334
+			foreach ($this->_req_data['checkbox'] as $TKT_ID) {
1335
+				if ($trash) {
1336
+					if (! $TKT->delete_by_ID($TKT_ID)) {
1337
+						$success = 0;
1338
+					}
1339
+				} elseif (! $TKT->restore_by_ID($TKT_ID)) {
1340
+					$success = 0;
1341
+				}
1342
+			}
1343
+		} else {
1344
+			// grab single id and trash
1345
+			$TKT_ID = absint($this->_req_data['TKT_ID']);
1346
+			if ($trash) {
1347
+				if (! $TKT->delete_by_ID($TKT_ID)) {
1348
+					$success = 0;
1349
+				}
1350
+			} elseif (! $TKT->restore_by_ID($TKT_ID)) {
1351
+				$success = 0;
1352
+			}
1353
+		}
1354
+		$action_desc = $trash ? 'moved to the trash' : 'restored';
1355
+		$query_args = [
1356
+			'action' => 'ticket_list_table',
1357
+			'status' => $trash ? '' : 'trashed',
1358
+		];
1359
+		$this->_redirect_after_action($success, 'Tickets', $action_desc, $query_args);
1360
+	}
1361
+
1362
+
1363
+	/**
1364
+	 * Handles trashing default ticket.
1365
+	 *
1366
+	 * @throws EE_Error
1367
+	 * @throws InvalidArgumentException
1368
+	 * @throws InvalidDataTypeException
1369
+	 * @throws InvalidInterfaceException
1370
+	 * @throws ReflectionException
1371
+	 */
1372
+	protected function _delete_ticket()
1373
+	{
1374
+		$success = 1;
1375
+		// checkboxes?
1376
+		if (! empty($this->_req_data['checkbox']) && is_array($this->_req_data['checkbox'])) {
1377
+			// if array has more than one element then success message should be plural
1378
+			$success = count($this->_req_data['checkbox']) > 1 ? 2 : 1;
1379
+			// cycle thru the boxes
1380
+			foreach ($this->_req_data['checkbox'] as $TKT_ID) {
1381
+				// delete
1382
+				if (! $this->_delete_the_ticket($TKT_ID)) {
1383
+					$success = 0;
1384
+				}
1385
+			}
1386
+		} else {
1387
+			// grab single id and trash
1388
+			$TKT_ID = absint($this->_req_data['TKT_ID']);
1389
+			if (! $this->_delete_the_ticket($TKT_ID)) {
1390
+				$success = 0;
1391
+			}
1392
+		}
1393
+		$action_desc = 'deleted';
1394
+		// fail safe.  If the default ticket count === 1 then we need to redirect to event overview.
1395
+		$ticket_count = EEM_Ticket::instance()->count_deleted_and_undeleted(
1396
+			[['TKT_is_default' => 1]],
1397
+			'TKT_ID',
1398
+			true
1399
+		);
1400
+		$query_args = $ticket_count
1401
+			? []
1402
+			: [
1403
+				'action' => 'ticket_list_table',
1404
+				'status' => 'trashed',
1405
+			];
1406
+		$this->_redirect_after_action($success, 'Tickets', $action_desc, $query_args);
1407
+	}
1408
+
1409
+
1410
+	/**
1411
+	 * @param int $TKT_ID
1412
+	 * @return bool|int
1413
+	 * @throws EE_Error
1414
+	 * @throws InvalidArgumentException
1415
+	 * @throws InvalidDataTypeException
1416
+	 * @throws InvalidInterfaceException
1417
+	 * @throws ReflectionException
1418
+	 */
1419
+	protected function _delete_the_ticket($TKT_ID)
1420
+	{
1421
+		$ticket = EEM_Ticket::instance()->get_one_by_ID($TKT_ID);
1422
+		if (! $ticket instanceof EE_Ticket) {
1423
+			return false;
1424
+		}
1425
+		$ticket->_remove_relations('Datetime');
1426
+		// delete all related prices first
1427
+		$ticket->delete_related_permanently('Price');
1428
+		return $ticket->delete_permanently();
1429
+	}
1430 1430
 }
Please login to merge, or discard this patch.
Spacing   +47 added lines, -47 removed lines patch added patch discarded remove patch
@@ -36,10 +36,10 @@  discard block
 block discarded – undo
36 36
      */
37 37
     public function __construct($routing = true)
38 38
     {
39
-        if (! defined('EVENTS_CAF_TEMPLATE_PATH')) {
40
-            define('EVENTS_CAF_TEMPLATE_PATH', EE_CORE_CAF_ADMIN_EXTEND . 'events/templates/');
41
-            define('EVENTS_CAF_ASSETS', EE_CORE_CAF_ADMIN_EXTEND . 'events/assets/');
42
-            define('EVENTS_CAF_ASSETS_URL', EE_CORE_CAF_ADMIN_EXTEND_URL . 'events/assets/');
39
+        if ( ! defined('EVENTS_CAF_TEMPLATE_PATH')) {
40
+            define('EVENTS_CAF_TEMPLATE_PATH', EE_CORE_CAF_ADMIN_EXTEND.'events/templates/');
41
+            define('EVENTS_CAF_ASSETS', EE_CORE_CAF_ADMIN_EXTEND.'events/assets/');
42
+            define('EVENTS_CAF_ASSETS_URL', EE_CORE_CAF_ADMIN_EXTEND_URL.'events/assets/');
43 43
         }
44 44
         parent::__construct($routing);
45 45
         $this->admin_config = $this->loader->getShared('EE_Admin_Config');
@@ -57,7 +57,7 @@  discard block
 block discarded – undo
57 57
      */
58 58
     protected function _extend_page_config()
59 59
     {
60
-        $this->_admin_base_path = EE_CORE_CAF_ADMIN_EXTEND . 'events';
60
+        $this->_admin_base_path = EE_CORE_CAF_ADMIN_EXTEND.'events';
61 61
         // is there a evt_id in the request?
62 62
         $evt_id = ! empty($this->_req_data['EVT_ID']) && ! is_array($this->_req_data['EVT_ID'])
63 63
             ? $this->_req_data['EVT_ID']
@@ -108,10 +108,10 @@  discard block
 block discarded – undo
108 108
                 'capability' => 'manage_options',
109 109
                 'noheader'   => true,
110 110
             ],
111
-        ];        // don't load these meta boxes if using the advanced editor
111
+        ]; // don't load these meta boxes if using the advanced editor
112 112
         $this->_page_config['create_new']['metaboxes'][] = '_premium_event_editor_meta_boxes';
113 113
         $this->_page_config['edit']['metaboxes'][] = '_premium_event_editor_meta_boxes';
114
-        if (! $this->admin_config->useAdvancedEditor()) {
114
+        if ( ! $this->admin_config->useAdvancedEditor()) {
115 115
             $this->_page_config['create_new']['qtips'][] = 'EE_Event_Editor_Tips';
116 116
             $this->_page_config['edit']['qtips'][] = 'EE_Event_Editor_Tips';
117 117
 
@@ -303,7 +303,7 @@  discard block
 block discarded – undo
303 303
     {
304 304
         $return = parent::extra_permalink_field_buttons($return, $id, $new_title, $new_slug);
305 305
         // make sure this is only when editing
306
-        if (! empty($id)) {
306
+        if ( ! empty($id)) {
307 307
             $href = EE_Admin_Page::add_query_args_and_nonce(
308 308
                 ['action' => 'duplicate_event', 'EVT_ID' => $id],
309 309
                 $this->_admin_base_url
@@ -353,10 +353,10 @@  discard block
 block discarded – undo
353 353
      */
354 354
     public function load_scripts_styles_edit()
355 355
     {
356
-        if (! $this->admin_config->useAdvancedEditor()) {
356
+        if ( ! $this->admin_config->useAdvancedEditor()) {
357 357
             wp_register_script(
358 358
                 'ee-event-editor-heartbeat',
359
-                EVENTS_CAF_ASSETS_URL . 'event-editor-heartbeat.js',
359
+                EVENTS_CAF_ASSETS_URL.'event-editor-heartbeat.js',
360 360
                 ['ee_admin_js', 'heartbeat'],
361 361
                 EVENT_ESPRESSO_VERSION,
362 362
                 true
@@ -381,7 +381,7 @@  discard block
 block discarded – undo
381 381
     public function add_additional_datetime_button($template, $template_args)
382 382
     {
383 383
         return EEH_Template::display_template(
384
-            EVENTS_CAF_TEMPLATE_PATH . 'event_datetime_add_additional_time.template.php',
384
+            EVENTS_CAF_TEMPLATE_PATH.'event_datetime_add_additional_time.template.php',
385 385
             $template_args,
386 386
             true
387 387
         );
@@ -399,7 +399,7 @@  discard block
 block discarded – undo
399 399
     public function add_datetime_clone_button($template, $template_args)
400 400
     {
401 401
         return EEH_Template::display_template(
402
-            EVENTS_CAF_TEMPLATE_PATH . 'event_datetime_metabox_clone_button.template.php',
402
+            EVENTS_CAF_TEMPLATE_PATH.'event_datetime_metabox_clone_button.template.php',
403 403
             $template_args,
404 404
             true
405 405
         );
@@ -417,7 +417,7 @@  discard block
 block discarded – undo
417 417
     public function datetime_timezones_template($template, $template_args)
418 418
     {
419 419
         return EEH_Template::display_template(
420
-            EVENTS_CAF_TEMPLATE_PATH . 'event_datetime_timezones.template.php',
420
+            EVENTS_CAF_TEMPLATE_PATH.'event_datetime_timezones.template.php',
421 421
             $template_args,
422 422
             true
423 423
         );
@@ -548,7 +548,7 @@  discard block
 block discarded – undo
548 548
     {
549 549
         // first make sure the ID for the event is in the request.
550 550
         //  If it isn't then we need to bail and redirect back to overview list table (cause how did we get here?)
551
-        if (! isset($this->_req_data['EVT_ID'])) {
551
+        if ( ! isset($this->_req_data['EVT_ID'])) {
552 552
             EE_Error::add_error(
553 553
                 esc_html__(
554 554
                     'In order to duplicate an event an Event ID is required.  None was given.',
@@ -563,7 +563,7 @@  discard block
 block discarded – undo
563 563
         }
564 564
         // k we've got EVT_ID so let's use that to get the event we'll duplicate
565 565
         $orig_event = EEM_Event::instance()->get_one_by_ID($this->_req_data['EVT_ID']);
566
-        if (! $orig_event instanceof EE_Event) {
566
+        if ( ! $orig_event instanceof EE_Event) {
567 567
             throw new EE_Error(
568 568
                 sprintf(
569 569
                     esc_html__('An EE_Event object could not be retrieved for the given ID (%s)', 'event_espresso'),
@@ -579,7 +579,7 @@  discard block
 block discarded – undo
579 579
         $orig_ven = $orig_event->get_many_related('Venue');
580 580
         // reset the ID and modify other details to make it clear this is a dupe
581 581
         $new_event->set('EVT_ID', 0);
582
-        $new_name = $new_event->name() . ' ' . esc_html__('**DUPLICATE**', 'event_espresso');
582
+        $new_name = $new_event->name().' '.esc_html__('**DUPLICATE**', 'event_espresso');
583 583
         $new_event->set('EVT_name', $new_name);
584 584
         $new_event->set(
585 585
             'EVT_slug',
@@ -608,7 +608,7 @@  discard block
 block discarded – undo
608 608
             'Question_Group',
609 609
             [['Event_Question_Group.EQG_primary' => true]]
610 610
         );
611
-        if (! empty($orig_primary_qgs)) {
611
+        if ( ! empty($orig_primary_qgs)) {
612 612
             foreach ($orig_primary_qgs as $id => $obj) {
613 613
                 if ($obj instanceof EE_Question_Group) {
614 614
                     $new_event->_add_relation_to($obj, 'Question_Group', ['EQG_primary' => true]);
@@ -620,7 +620,7 @@  discard block
 block discarded – undo
620 620
             'Question_Group',
621 621
             [['Event_Question_Group.EQG_additional' => true]]
622 622
         );
623
-        if (! empty($orig_additional_qgs)) {
623
+        if ( ! empty($orig_additional_qgs)) {
624 624
             foreach ($orig_additional_qgs as $id => $obj) {
625 625
                 if ($obj instanceof EE_Question_Group) {
626 626
                     $new_event->_add_relation_to($obj, 'Question_Group', ['EQG_additional' => true]);
@@ -633,7 +633,7 @@  discard block
 block discarded – undo
633 633
         // k now that we have the new event saved we can loop through the datetimes and start adding relations.
634 634
         $cloned_tickets = [];
635 635
         foreach ($orig_datetimes as $orig_dtt) {
636
-            if (! $orig_dtt instanceof EE_Datetime) {
636
+            if ( ! $orig_dtt instanceof EE_Datetime) {
637 637
                 continue;
638 638
             }
639 639
             $new_dtt = clone $orig_dtt;
@@ -648,7 +648,7 @@  discard block
 block discarded – undo
648 648
             // now let's get the ticket relations setup.
649 649
             foreach ((array) $orig_tkts as $orig_tkt) {
650 650
                 // it's possible a datetime will have no tickets so let's verify we HAVE a ticket first.
651
-                if (! $orig_tkt instanceof EE_Ticket) {
651
+                if ( ! $orig_tkt instanceof EE_Ticket) {
652 652
                     continue;
653 653
                 }
654 654
                 // is this ticket archived?  If it is then let's skip
@@ -657,8 +657,8 @@  discard block
 block discarded – undo
657 657
                 }
658 658
                 // does this original ticket already exist in the clone_tickets cache?
659 659
                 //  If so we'll just use the new ticket from it.
660
-                if (isset($cloned_tickets[ $orig_tkt->ID() ])) {
661
-                    $new_tkt = $cloned_tickets[ $orig_tkt->ID() ];
660
+                if (isset($cloned_tickets[$orig_tkt->ID()])) {
661
+                    $new_tkt = $cloned_tickets[$orig_tkt->ID()];
662 662
                 } else {
663 663
                     $new_tkt = clone $orig_tkt;
664 664
                     // get relations on the $orig_tkt that we need to setup.
@@ -691,7 +691,7 @@  discard block
 block discarded – undo
691 691
                 // for use with later datetimes that have the same ticket.
692 692
                 $new_dtt->_add_relation_to($new_tkt, 'Ticket');
693 693
                 $new_dtt->save();
694
-                $cloned_tickets[ $orig_tkt->ID() ] = $new_tkt;
694
+                $cloned_tickets[$orig_tkt->ID()] = $new_tkt;
695 695
             }
696 696
         }
697 697
         // clone taxonomy information
@@ -778,7 +778,7 @@  discard block
 block discarded – undo
778 778
             $this->_admin_base_url
779 779
         );
780 780
         $content = EEH_Template::display_template(
781
-            EVENTS_CAF_TEMPLATE_PATH . 'import_page.template.php',
781
+            EVENTS_CAF_TEMPLATE_PATH.'import_page.template.php',
782 782
             $this->_template_args,
783 783
             true
784 784
         );
@@ -799,7 +799,7 @@  discard block
 block discarded – undo
799 799
      */
800 800
     protected function _import_events()
801 801
     {
802
-        require_once(EE_CLASSES . 'EE_Import.class.php');
802
+        require_once(EE_CLASSES.'EE_Import.class.php');
803 803
         $success = EE_Import::instance()->import();
804 804
         $this->_redirect_after_action($success, 'Import File', 'ran', ['action' => 'import_page'], true);
805 805
     }
@@ -828,8 +828,8 @@  discard block
 block discarded – undo
828 828
             'EVT_ID' => $event_ids,
829 829
         ];
830 830
         $this->_req_data = array_merge($this->_req_data, $new_request_args);
831
-        if (is_readable(EE_CLASSES . 'EE_Export.class.php')) {
832
-            require_once(EE_CLASSES . 'EE_Export.class.php');
831
+        if (is_readable(EE_CLASSES.'EE_Export.class.php')) {
832
+            require_once(EE_CLASSES.'EE_Export.class.php');
833 833
             $EE_Export = EE_Export::instance($this->_req_data);
834 834
             if ($EE_Export instanceof EE_Export) {
835 835
                 $EE_Export->export();
@@ -852,8 +852,8 @@  discard block
 block discarded – undo
852 852
             'category_ids' => $this->_req_data['EVT_CAT_ID'],
853 853
         ];
854 854
         $this->_req_data = array_merge($this->_req_data, $new_request_args);
855
-        if (is_readable(EE_CLASSES . 'EE_Export.class.php')) {
856
-            require_once(EE_CLASSES . 'EE_Export.class.php');
855
+        if (is_readable(EE_CLASSES.'EE_Export.class.php')) {
856
+            require_once(EE_CLASSES.'EE_Export.class.php');
857 857
             $EE_Export = EE_Export::instance($this->_req_data);
858 858
             if ($EE_Export instanceof EE_Export) {
859 859
                 $EE_Export->export();
@@ -898,7 +898,7 @@  discard block
 block discarded – undo
898 898
         $this->_set_add_edit_form_tags('update_template_settings');
899 899
         $this->_set_publish_post_box_vars(null, false, false, null, false);
900 900
         $this->_template_args['admin_page_content'] = EEH_Template::display_template(
901
-            EVENTS_CAF_TEMPLATE_PATH . 'template_settings.template.php',
901
+            EVENTS_CAF_TEMPLATE_PATH.'template_settings.template.php',
902 902
             $this->_template_args,
903 903
             true
904 904
         );
@@ -967,7 +967,7 @@  discard block
 block discarded – undo
967 967
         /** @var FeatureFlags $flags */
968 968
         $flags = $this->loader->getShared('EventEspresso\core\domain\services\capabilities\FeatureFlags');
969 969
         // check if the new EDTR reg options meta box is being used, and if so, don't load the legacy version
970
-        if (! $this->admin_config->useAdvancedEditor() || ! $flags->featureAllowed('use_reg_options_meta_box')) {
970
+        if ( ! $this->admin_config->useAdvancedEditor() || ! $flags->featureAllowed('use_reg_options_meta_box')) {
971 971
             add_meta_box(
972 972
                 'espresso_event_editor_event_options',
973 973
                 esc_html__('Event Registration Options', 'event_espresso'),
@@ -1036,7 +1036,7 @@  discard block
 block discarded – undo
1036 1036
             $default_reg_status_values
1037 1037
         );
1038 1038
         EEH_Template::display_template(
1039
-            EVENTS_CAF_TEMPLATE_PATH . 'event_registration_options.template.php',
1039
+            EVENTS_CAF_TEMPLATE_PATH.'event_registration_options.template.php',
1040 1040
             $template_args
1041 1041
         );
1042 1042
     }
@@ -1145,7 +1145,7 @@  discard block
 block discarded – undo
1145 1145
         $venues = $venue_model->get_all(['order_by' => ['VNU_name' => 'ASC']]);
1146 1146
 
1147 1147
         foreach ($venues as $venue) {
1148
-            $values[ $venue->ID() ] = $venue->name();
1148
+            $values[$venue->ID()] = $venue->name();
1149 1149
         }
1150 1150
 
1151 1151
         return EEH_Form_Fields::select_input($select_name, $values, $current_value, '', 'wide');
@@ -1179,13 +1179,13 @@  discard block
 block discarded – undo
1179 1179
     {
1180 1180
         $start = EEM_Datetime::instance()->convert_datetime_for_query(
1181 1181
             'DTT_EVT_start',
1182
-            date('Y-m-d') . ' 00:00:00',
1182
+            date('Y-m-d').' 00:00:00',
1183 1183
             'Y-m-d H:i:s',
1184 1184
             'UTC'
1185 1185
         );
1186 1186
         $end = EEM_Datetime::instance()->convert_datetime_for_query(
1187 1187
             'DTT_EVT_start',
1188
-            date('Y-m-d') . ' 23:59:59',
1188
+            date('Y-m-d').' 23:59:59',
1189 1189
             'Y-m-d H:i:s',
1190 1190
             'UTC'
1191 1191
         );
@@ -1214,13 +1214,13 @@  discard block
 block discarded – undo
1214 1214
         $days_this_month = date('t');
1215 1215
         $start = EEM_Datetime::instance()->convert_datetime_for_query(
1216 1216
             'DTT_EVT_start',
1217
-            $this_year_r . '-' . $this_month_r . '-01 00:00:00',
1217
+            $this_year_r.'-'.$this_month_r.'-01 00:00:00',
1218 1218
             'Y-m-d H:i:s',
1219 1219
             'UTC'
1220 1220
         );
1221 1221
         $end = EEM_Datetime::instance()->convert_datetime_for_query(
1222 1222
             'DTT_EVT_start',
1223
-            $this_year_r . '-' . $this_month_r . '-' . $days_this_month . ' 23:59:59',
1223
+            $this_year_r.'-'.$this_month_r.'-'.$days_this_month.' 23:59:59',
1224 1224
             'Y-m-d H:i:s',
1225 1225
             'UTC'
1226 1226
         );
@@ -1296,7 +1296,7 @@  discard block
 block discarded – undo
1296 1296
         $offset = ($current_page - 1) * $per_page;
1297 1297
         $limit = [$offset, $per_page];
1298 1298
         if (isset($this->_req_data['s'])) {
1299
-            $sstr = '%' . $this->_req_data['s'] . '%';
1299
+            $sstr = '%'.$this->_req_data['s'].'%';
1300 1300
             $_where['OR'] = [
1301 1301
                 'TKT_name'        => ['LIKE', $sstr],
1302 1302
                 'TKT_description' => ['LIKE', $sstr],
@@ -1327,16 +1327,16 @@  discard block
 block discarded – undo
1327 1327
         $success = 1;
1328 1328
         $TKT = EEM_Ticket::instance();
1329 1329
         // checkboxes?
1330
-        if (! empty($this->_req_data['checkbox']) && is_array($this->_req_data['checkbox'])) {
1330
+        if ( ! empty($this->_req_data['checkbox']) && is_array($this->_req_data['checkbox'])) {
1331 1331
             // if array has more than one element then success message should be plural
1332 1332
             $success = count($this->_req_data['checkbox']) > 1 ? 2 : 1;
1333 1333
             // cycle thru the boxes
1334 1334
             foreach ($this->_req_data['checkbox'] as $TKT_ID) {
1335 1335
                 if ($trash) {
1336
-                    if (! $TKT->delete_by_ID($TKT_ID)) {
1336
+                    if ( ! $TKT->delete_by_ID($TKT_ID)) {
1337 1337
                         $success = 0;
1338 1338
                     }
1339
-                } elseif (! $TKT->restore_by_ID($TKT_ID)) {
1339
+                } elseif ( ! $TKT->restore_by_ID($TKT_ID)) {
1340 1340
                     $success = 0;
1341 1341
                 }
1342 1342
             }
@@ -1344,10 +1344,10 @@  discard block
 block discarded – undo
1344 1344
             // grab single id and trash
1345 1345
             $TKT_ID = absint($this->_req_data['TKT_ID']);
1346 1346
             if ($trash) {
1347
-                if (! $TKT->delete_by_ID($TKT_ID)) {
1347
+                if ( ! $TKT->delete_by_ID($TKT_ID)) {
1348 1348
                     $success = 0;
1349 1349
                 }
1350
-            } elseif (! $TKT->restore_by_ID($TKT_ID)) {
1350
+            } elseif ( ! $TKT->restore_by_ID($TKT_ID)) {
1351 1351
                 $success = 0;
1352 1352
             }
1353 1353
         }
@@ -1373,20 +1373,20 @@  discard block
 block discarded – undo
1373 1373
     {
1374 1374
         $success = 1;
1375 1375
         // checkboxes?
1376
-        if (! empty($this->_req_data['checkbox']) && is_array($this->_req_data['checkbox'])) {
1376
+        if ( ! empty($this->_req_data['checkbox']) && is_array($this->_req_data['checkbox'])) {
1377 1377
             // if array has more than one element then success message should be plural
1378 1378
             $success = count($this->_req_data['checkbox']) > 1 ? 2 : 1;
1379 1379
             // cycle thru the boxes
1380 1380
             foreach ($this->_req_data['checkbox'] as $TKT_ID) {
1381 1381
                 // delete
1382
-                if (! $this->_delete_the_ticket($TKT_ID)) {
1382
+                if ( ! $this->_delete_the_ticket($TKT_ID)) {
1383 1383
                     $success = 0;
1384 1384
                 }
1385 1385
             }
1386 1386
         } else {
1387 1387
             // grab single id and trash
1388 1388
             $TKT_ID = absint($this->_req_data['TKT_ID']);
1389
-            if (! $this->_delete_the_ticket($TKT_ID)) {
1389
+            if ( ! $this->_delete_the_ticket($TKT_ID)) {
1390 1390
                 $success = 0;
1391 1391
             }
1392 1392
         }
@@ -1419,7 +1419,7 @@  discard block
 block discarded – undo
1419 1419
     protected function _delete_the_ticket($TKT_ID)
1420 1420
     {
1421 1421
         $ticket = EEM_Ticket::instance()->get_one_by_ID($TKT_ID);
1422
-        if (! $ticket instanceof EE_Ticket) {
1422
+        if ( ! $ticket instanceof EE_Ticket) {
1423 1423
             return false;
1424 1424
         }
1425 1425
         $ticket->_remove_relations('Datetime');
Please login to merge, or discard this patch.
admin_pages/events/Events_Admin_Page.core.php 2 patches
Indentation   +2884 added lines, -2884 removed lines patch added patch discarded remove patch
@@ -16,2888 +16,2888 @@
 block discarded – undo
16 16
 class Events_Admin_Page extends EE_Admin_Page_CPT
17 17
 {
18 18
 
19
-    /**
20
-     * This will hold the event object for event_details screen.
21
-     *
22
-     * @access protected
23
-     * @var EE_Event $_event
24
-     */
25
-    protected $_event;
26
-
27
-
28
-    /**
29
-     * This will hold the category object for category_details screen.
30
-     *
31
-     * @var stdClass $_category
32
-     */
33
-    protected $_category;
34
-
35
-
36
-    /**
37
-     * This will hold the event model instance
38
-     *
39
-     * @var EEM_Event $_event_model
40
-     */
41
-    protected $_event_model;
42
-
43
-
44
-    /**
45
-     * @var EE_Event
46
-     */
47
-    protected $_cpt_model_obj = false;
48
-
49
-
50
-    /**
51
-     * Initialize page props for this admin page group.
52
-     */
53
-    protected function _init_page_props()
54
-    {
55
-        $this->page_slug = EVENTS_PG_SLUG;
56
-        $this->page_label = EVENTS_LABEL;
57
-        $this->_admin_base_url = EVENTS_ADMIN_URL;
58
-        $this->_admin_base_path = EVENTS_ADMIN;
59
-        $this->_cpt_model_names = [
60
-            'create_new' => 'EEM_Event',
61
-            'edit'       => 'EEM_Event',
62
-        ];
63
-        $this->_cpt_edit_routes = [
64
-            'espresso_events' => 'edit',
65
-        ];
66
-        add_action(
67
-            'AHEE__EE_Admin_Page_CPT__set_model_object__after_set_object',
68
-            [$this, 'verify_event_edit'],
69
-            10,
70
-            2
71
-        );
72
-    }
73
-
74
-
75
-    /**
76
-     * Sets the ajax hooks used for this admin page group.
77
-     */
78
-    protected function _ajax_hooks()
79
-    {
80
-        add_action('wp_ajax_ee_save_timezone_setting', [$this, 'save_timezonestring_setting']);
81
-    }
82
-
83
-
84
-    /**
85
-     * Sets the page properties for this admin page group.
86
-     */
87
-    protected function _define_page_props()
88
-    {
89
-        $this->_admin_page_title = EVENTS_LABEL;
90
-        $this->_labels = [
91
-            'buttons'      => [
92
-                'add'             => esc_html__('Add New Event', 'event_espresso'),
93
-                'edit'            => esc_html__('Edit Event', 'event_espresso'),
94
-                'delete'          => esc_html__('Delete Event', 'event_espresso'),
95
-                'add_category'    => esc_html__('Add New Category', 'event_espresso'),
96
-                'edit_category'   => esc_html__('Edit Category', 'event_espresso'),
97
-                'delete_category' => esc_html__('Delete Category', 'event_espresso'),
98
-            ],
99
-            'editor_title' => [
100
-                'espresso_events' => esc_html__('Enter event title here', 'event_espresso'),
101
-            ],
102
-            'publishbox'   => [
103
-                'create_new'        => esc_html__('Save New Event', 'event_espresso'),
104
-                'edit'              => esc_html__('Update Event', 'event_espresso'),
105
-                'add_category'      => esc_html__('Save New Category', 'event_espresso'),
106
-                'edit_category'     => esc_html__('Update Category', 'event_espresso'),
107
-                'template_settings' => esc_html__('Update Settings', 'event_espresso'),
108
-            ],
109
-        ];
110
-    }
111
-
112
-
113
-    /**
114
-     * Sets the page routes property for this admin page group.
115
-     */
116
-    protected function _set_page_routes()
117
-    {
118
-        // load formatter helper
119
-        // load field generator helper
120
-        // is there a evt_id in the request?
121
-        $evt_id = ! empty($this->_req_data['EVT_ID']) && ! is_array($this->_req_data['EVT_ID'])
122
-            ? $this->_req_data['EVT_ID']
123
-            : 0;
124
-        $evt_id = ! empty($this->_req_data['post']) ? $this->_req_data['post'] : $evt_id;
125
-        $this->_page_routes = [
126
-            'default'                       => [
127
-                'func'       => '_events_overview_list_table',
128
-                'capability' => 'ee_read_events',
129
-            ],
130
-            'create_new'                    => [
131
-                'func'       => '_create_new_cpt_item',
132
-                'capability' => 'ee_edit_events',
133
-            ],
134
-            'edit'                          => [
135
-                'func'       => '_edit_cpt_item',
136
-                'capability' => 'ee_edit_event',
137
-                'obj_id'     => $evt_id,
138
-            ],
139
-            'copy_event'                    => [
140
-                'func'       => '_copy_events',
141
-                'capability' => 'ee_edit_event',
142
-                'obj_id'     => $evt_id,
143
-                'noheader'   => true,
144
-            ],
145
-            'trash_event'                   => [
146
-                'func'       => '_trash_or_restore_event',
147
-                'args'       => ['event_status' => 'trash'],
148
-                'capability' => 'ee_delete_event',
149
-                'obj_id'     => $evt_id,
150
-                'noheader'   => true,
151
-            ],
152
-            'trash_events'                  => [
153
-                'func'       => '_trash_or_restore_events',
154
-                'args'       => ['event_status' => 'trash'],
155
-                'capability' => 'ee_delete_events',
156
-                'noheader'   => true,
157
-            ],
158
-            'restore_event'                 => [
159
-                'func'       => '_trash_or_restore_event',
160
-                'args'       => ['event_status' => 'draft'],
161
-                'capability' => 'ee_delete_event',
162
-                'obj_id'     => $evt_id,
163
-                'noheader'   => true,
164
-            ],
165
-            'restore_events'                => [
166
-                'func'       => '_trash_or_restore_events',
167
-                'args'       => ['event_status' => 'draft'],
168
-                'capability' => 'ee_delete_events',
169
-                'noheader'   => true,
170
-            ],
171
-            'delete_event'                  => [
172
-                'func'       => '_delete_event',
173
-                'capability' => 'ee_delete_event',
174
-                'obj_id'     => $evt_id,
175
-                'noheader'   => true,
176
-            ],
177
-            'delete_events'                 => [
178
-                'func'       => '_delete_events',
179
-                'capability' => 'ee_delete_events',
180
-                'noheader'   => true,
181
-            ],
182
-            'view_report'                   => [
183
-                'func'       => '_view_report',
184
-                'capability' => 'ee_edit_events',
185
-            ],
186
-            'default_event_settings'        => [
187
-                'func'       => '_default_event_settings',
188
-                'capability' => 'manage_options',
189
-            ],
190
-            'update_default_event_settings' => [
191
-                'func'       => '_update_default_event_settings',
192
-                'capability' => 'manage_options',
193
-                'noheader'   => true,
194
-            ],
195
-            'template_settings'             => [
196
-                'func'       => '_template_settings',
197
-                'capability' => 'manage_options',
198
-            ],
199
-            // event category tab related
200
-            'add_category'                  => [
201
-                'func'       => '_category_details',
202
-                'capability' => 'ee_edit_event_category',
203
-                'args'       => ['add'],
204
-            ],
205
-            'edit_category'                 => [
206
-                'func'       => '_category_details',
207
-                'capability' => 'ee_edit_event_category',
208
-                'args'       => ['edit'],
209
-            ],
210
-            'delete_categories'             => [
211
-                'func'       => '_delete_categories',
212
-                'capability' => 'ee_delete_event_category',
213
-                'noheader'   => true,
214
-            ],
215
-            'delete_category'               => [
216
-                'func'       => '_delete_categories',
217
-                'capability' => 'ee_delete_event_category',
218
-                'noheader'   => true,
219
-            ],
220
-            'insert_category'               => [
221
-                'func'       => '_insert_or_update_category',
222
-                'args'       => ['new_category' => true],
223
-                'capability' => 'ee_edit_event_category',
224
-                'noheader'   => true,
225
-            ],
226
-            'update_category'               => [
227
-                'func'       => '_insert_or_update_category',
228
-                'args'       => ['new_category' => false],
229
-                'capability' => 'ee_edit_event_category',
230
-                'noheader'   => true,
231
-            ],
232
-            'category_list'                 => [
233
-                'func'       => '_category_list_table',
234
-                'capability' => 'ee_manage_event_categories',
235
-            ],
236
-        ];
237
-    }
238
-
239
-
240
-    /**
241
-     * Set the _page_config property for this admin page group.
242
-     */
243
-    protected function _set_page_config()
244
-    {
245
-        $this->_page_config = [
246
-            'default'                => [
247
-                'nav'           => [
248
-                    'label' => esc_html__('Overview', 'event_espresso'),
249
-                    'order' => 10,
250
-                ],
251
-                'list_table'    => 'Events_Admin_List_Table',
252
-                'help_tabs'     => [
253
-                    'events_overview_help_tab'                       => [
254
-                        'title'    => esc_html__('Events Overview', 'event_espresso'),
255
-                        'filename' => 'events_overview',
256
-                    ],
257
-                    'events_overview_table_column_headings_help_tab' => [
258
-                        'title'    => esc_html__('Events Overview Table Column Headings', 'event_espresso'),
259
-                        'filename' => 'events_overview_table_column_headings',
260
-                    ],
261
-                    'events_overview_filters_help_tab'               => [
262
-                        'title'    => esc_html__('Events Overview Filters', 'event_espresso'),
263
-                        'filename' => 'events_overview_filters',
264
-                    ],
265
-                    'events_overview_view_help_tab'                  => [
266
-                        'title'    => esc_html__('Events Overview Views', 'event_espresso'),
267
-                        'filename' => 'events_overview_views',
268
-                    ],
269
-                    'events_overview_other_help_tab'                 => [
270
-                        'title'    => esc_html__('Events Overview Other', 'event_espresso'),
271
-                        'filename' => 'events_overview_other',
272
-                    ],
273
-                ],
274
-                'help_tour'     => [
275
-                    'Event_Overview_Help_Tour',
276
-                    // 'New_Features_Test_Help_Tour' for testing multiple help tour
277
-                ],
278
-                'require_nonce' => false,
279
-                'qtips'         => ['EE_Event_List_Table_Tips'],
280
-            ],
281
-            'create_new'             => [
282
-                'nav'           => [
283
-                    'label'      => esc_html__('Add Event', 'event_espresso'),
284
-                    'order'      => 5,
285
-                    'persistent' => false,
286
-                ],
287
-                'metaboxes'     => ['_register_event_editor_meta_boxes'],
288
-                'help_tabs'     => [
289
-                    'event_editor_help_tab'                            => [
290
-                        'title'    => esc_html__('Event Editor', 'event_espresso'),
291
-                        'filename' => 'event_editor',
292
-                    ],
293
-                    'event_editor_title_richtexteditor_help_tab'       => [
294
-                        'title'    => esc_html__('Event Title & Rich Text Editor', 'event_espresso'),
295
-                        'filename' => 'event_editor_title_richtexteditor',
296
-                    ],
297
-                    'event_editor_venue_details_help_tab'              => [
298
-                        'title'    => esc_html__('Event Venue Details', 'event_espresso'),
299
-                        'filename' => 'event_editor_venue_details',
300
-                    ],
301
-                    'event_editor_event_datetimes_help_tab'            => [
302
-                        'title'    => esc_html__('Event Datetimes', 'event_espresso'),
303
-                        'filename' => 'event_editor_event_datetimes',
304
-                    ],
305
-                    'event_editor_event_tickets_help_tab'              => [
306
-                        'title'    => esc_html__('Event Tickets', 'event_espresso'),
307
-                        'filename' => 'event_editor_event_tickets',
308
-                    ],
309
-                    'event_editor_event_registration_options_help_tab' => [
310
-                        'title'    => esc_html__('Event Registration Options', 'event_espresso'),
311
-                        'filename' => 'event_editor_event_registration_options',
312
-                    ],
313
-                    'event_editor_tags_categories_help_tab'            => [
314
-                        'title'    => esc_html__('Event Tags & Categories', 'event_espresso'),
315
-                        'filename' => 'event_editor_tags_categories',
316
-                    ],
317
-                    'event_editor_questions_registrants_help_tab'      => [
318
-                        'title'    => esc_html__('Questions for Registrants', 'event_espresso'),
319
-                        'filename' => 'event_editor_questions_registrants',
320
-                    ],
321
-                    'event_editor_save_new_event_help_tab'             => [
322
-                        'title'    => esc_html__('Save New Event', 'event_espresso'),
323
-                        'filename' => 'event_editor_save_new_event',
324
-                    ],
325
-                    'event_editor_other_help_tab'                      => [
326
-                        'title'    => esc_html__('Event Other', 'event_espresso'),
327
-                        'filename' => 'event_editor_other',
328
-                    ],
329
-                ],
330
-                'help_tour'     => [
331
-                    'Event_Editor_Help_Tour',
332
-                ],
333
-                'require_nonce' => false,
334
-            ],
335
-            'edit'                   => [
336
-                'nav'           => [
337
-                    'label'      => esc_html__('Edit Event', 'event_espresso'),
338
-                    'order'      => 5,
339
-                    'persistent' => false,
340
-                    'url'        => isset($this->_req_data['post'])
341
-                        ? EE_Admin_Page::add_query_args_and_nonce(
342
-                            ['post' => $this->_req_data['post'], 'action' => 'edit'],
343
-                            $this->_current_page_view_url
344
-                        )
345
-                        : $this->_admin_base_url,
346
-                ],
347
-                'metaboxes'     => ['_register_event_editor_meta_boxes'],
348
-                'help_tabs'     => [
349
-                    'event_editor_help_tab'                            => [
350
-                        'title'    => esc_html__('Event Editor', 'event_espresso'),
351
-                        'filename' => 'event_editor',
352
-                    ],
353
-                    'event_editor_title_richtexteditor_help_tab'       => [
354
-                        'title'    => esc_html__('Event Title & Rich Text Editor', 'event_espresso'),
355
-                        'filename' => 'event_editor_title_richtexteditor',
356
-                    ],
357
-                    'event_editor_venue_details_help_tab'              => [
358
-                        'title'    => esc_html__('Event Venue Details', 'event_espresso'),
359
-                        'filename' => 'event_editor_venue_details',
360
-                    ],
361
-                    'event_editor_event_datetimes_help_tab'            => [
362
-                        'title'    => esc_html__('Event Datetimes', 'event_espresso'),
363
-                        'filename' => 'event_editor_event_datetimes',
364
-                    ],
365
-                    'event_editor_event_tickets_help_tab'              => [
366
-                        'title'    => esc_html__('Event Tickets', 'event_espresso'),
367
-                        'filename' => 'event_editor_event_tickets',
368
-                    ],
369
-                    'event_editor_event_registration_options_help_tab' => [
370
-                        'title'    => esc_html__('Event Registration Options', 'event_espresso'),
371
-                        'filename' => 'event_editor_event_registration_options',
372
-                    ],
373
-                    'event_editor_tags_categories_help_tab'            => [
374
-                        'title'    => esc_html__('Event Tags & Categories', 'event_espresso'),
375
-                        'filename' => 'event_editor_tags_categories',
376
-                    ],
377
-                    'event_editor_questions_registrants_help_tab'      => [
378
-                        'title'    => esc_html__('Questions for Registrants', 'event_espresso'),
379
-                        'filename' => 'event_editor_questions_registrants',
380
-                    ],
381
-                    'event_editor_save_new_event_help_tab'             => [
382
-                        'title'    => esc_html__('Save New Event', 'event_espresso'),
383
-                        'filename' => 'event_editor_save_new_event',
384
-                    ],
385
-                    'event_editor_other_help_tab'                      => [
386
-                        'title'    => esc_html__('Event Other', 'event_espresso'),
387
-                        'filename' => 'event_editor_other',
388
-                    ],
389
-                ],
390
-                'require_nonce' => false,
391
-            ],
392
-            'default_event_settings' => [
393
-                'nav'           => [
394
-                    'label' => esc_html__('Default Settings', 'event_espresso'),
395
-                    'order' => 40,
396
-                ],
397
-                'metaboxes'     => array_merge($this->_default_espresso_metaboxes, ['_publish_post_box']),
398
-                'labels'        => [
399
-                    'publishbox' => esc_html__('Update Settings', 'event_espresso'),
400
-                ],
401
-                'help_tabs'     => [
402
-                    'default_settings_help_tab'        => [
403
-                        'title'    => esc_html__('Default Event Settings', 'event_espresso'),
404
-                        'filename' => 'events_default_settings',
405
-                    ],
406
-                    'default_settings_status_help_tab' => [
407
-                        'title'    => esc_html__('Default Registration Status', 'event_espresso'),
408
-                        'filename' => 'events_default_settings_status',
409
-                    ],
410
-                    'default_maximum_tickets_help_tab' => [
411
-                        'title'    => esc_html__('Default Maximum Tickets Per Order', 'event_espresso'),
412
-                        'filename' => 'events_default_settings_max_tickets',
413
-                    ],
414
-                ],
415
-                'help_tour'     => ['Event_Default_Settings_Help_Tour'],
416
-                'require_nonce' => false,
417
-            ],
418
-            // template settings
419
-            'template_settings'      => [
420
-                'nav'           => [
421
-                    'label' => esc_html__('Templates', 'event_espresso'),
422
-                    'order' => 30,
423
-                ],
424
-                'metaboxes'     => $this->_default_espresso_metaboxes,
425
-                'help_tabs'     => [
426
-                    'general_settings_templates_help_tab' => [
427
-                        'title'    => esc_html__('Templates', 'event_espresso'),
428
-                        'filename' => 'general_settings_templates',
429
-                    ],
430
-                ],
431
-                'help_tour'     => ['Templates_Help_Tour'],
432
-                'require_nonce' => false,
433
-            ],
434
-            // event category stuff
435
-            'add_category'           => [
436
-                'nav'           => [
437
-                    'label'      => esc_html__('Add Category', 'event_espresso'),
438
-                    'order'      => 15,
439
-                    'persistent' => false,
440
-                ],
441
-                'help_tabs'     => [
442
-                    'add_category_help_tab' => [
443
-                        'title'    => esc_html__('Add New Event Category', 'event_espresso'),
444
-                        'filename' => 'events_add_category',
445
-                    ],
446
-                ],
447
-                'help_tour'     => ['Event_Add_Category_Help_Tour'],
448
-                'metaboxes'     => ['_publish_post_box'],
449
-                'require_nonce' => false,
450
-            ],
451
-            'edit_category'          => [
452
-                'nav'           => [
453
-                    'label'      => esc_html__('Edit Category', 'event_espresso'),
454
-                    'order'      => 15,
455
-                    'persistent' => false,
456
-                    'url'        => isset($this->_req_data['EVT_CAT_ID'])
457
-                        ? add_query_arg(
458
-                            ['EVT_CAT_ID' => $this->_req_data['EVT_CAT_ID']],
459
-                            $this->_current_page_view_url
460
-                        )
461
-                        : $this->_admin_base_url,
462
-                ],
463
-                'help_tabs'     => [
464
-                    'edit_category_help_tab' => [
465
-                        'title'    => esc_html__('Edit Event Category', 'event_espresso'),
466
-                        'filename' => 'events_edit_category',
467
-                    ],
468
-                ],
469
-                /*'help_tour' => array('Event_Edit_Category_Help_Tour'),*/
470
-                'metaboxes'     => ['_publish_post_box'],
471
-                'require_nonce' => false,
472
-            ],
473
-            'category_list'          => [
474
-                'nav'           => [
475
-                    'label' => esc_html__('Categories', 'event_espresso'),
476
-                    'order' => 20,
477
-                ],
478
-                'list_table'    => 'Event_Categories_Admin_List_Table',
479
-                'help_tabs'     => [
480
-                    'events_categories_help_tab'                       => [
481
-                        'title'    => esc_html__('Event Categories', 'event_espresso'),
482
-                        'filename' => 'events_categories',
483
-                    ],
484
-                    'events_categories_table_column_headings_help_tab' => [
485
-                        'title'    => esc_html__('Event Categories Table Column Headings', 'event_espresso'),
486
-                        'filename' => 'events_categories_table_column_headings',
487
-                    ],
488
-                    'events_categories_view_help_tab'                  => [
489
-                        'title'    => esc_html__('Event Categories Views', 'event_espresso'),
490
-                        'filename' => 'events_categories_views',
491
-                    ],
492
-                    'events_categories_other_help_tab'                 => [
493
-                        'title'    => esc_html__('Event Categories Other', 'event_espresso'),
494
-                        'filename' => 'events_categories_other',
495
-                    ],
496
-                ],
497
-                'help_tour'     => [
498
-                    'Event_Categories_Help_Tour',
499
-                ],
500
-                'metaboxes'     => $this->_default_espresso_metaboxes,
501
-                'require_nonce' => false,
502
-            ],
503
-        ];
504
-        // only load EE_Event_Editor_Decaf_Tips if domain is not caffeinated
505
-        $domain = $this->loader->getShared('EventEspresso\core\domain\Domain');
506
-        if (! $domain->isCaffeinated()) {
507
-            $this->_page_config['create_new']['qtips'] = ['EE_Event_Editor_Decaf_Tips'];
508
-            $this->_page_config['edit']['qtips'] = ['EE_Event_Editor_Decaf_Tips'];
509
-        }
510
-    }
511
-
512
-
513
-    /**
514
-     * Used to register any global screen options if necessary for every route in this admin page group.
515
-     */
516
-    protected function _add_screen_options()
517
-    {
518
-    }
519
-
520
-
521
-    /**
522
-     * Implementing the screen options for the 'default' route.
523
-     *
524
-     * @throws InvalidArgumentException
525
-     * @throws InvalidDataTypeException
526
-     * @throws InvalidInterfaceException
527
-     */
528
-    protected function _add_screen_options_default()
529
-    {
530
-        $this->_per_page_screen_option();
531
-    }
532
-
533
-
534
-    /**
535
-     * Implementing screen options for the category list route.
536
-     *
537
-     * @throws InvalidArgumentException
538
-     * @throws InvalidDataTypeException
539
-     * @throws InvalidInterfaceException
540
-     */
541
-    protected function _add_screen_options_category_list()
542
-    {
543
-        $page_title = $this->_admin_page_title;
544
-        $this->_admin_page_title = esc_html__('Categories', 'event_espresso');
545
-        $this->_per_page_screen_option();
546
-        $this->_admin_page_title = $page_title;
547
-    }
548
-
549
-
550
-    /**
551
-     * Used to register any global feature pointers for the admin page group.
552
-     */
553
-    protected function _add_feature_pointers()
554
-    {
555
-    }
556
-
557
-
558
-    /**
559
-     * Registers and enqueues any global scripts and styles for the entire admin page group.
560
-     */
561
-    public function load_scripts_styles()
562
-    {
563
-        wp_register_style(
564
-            'events-admin-css',
565
-            EVENTS_ASSETS_URL . 'events-admin-page.css',
566
-            [],
567
-            EVENT_ESPRESSO_VERSION
568
-        );
569
-        wp_register_style(
570
-            'ee-cat-admin',
571
-            EVENTS_ASSETS_URL . 'ee-cat-admin.css',
572
-            [],
573
-            EVENT_ESPRESSO_VERSION
574
-        );
575
-        wp_enqueue_style('events-admin-css');
576
-        wp_enqueue_style('ee-cat-admin');
577
-        // scripts
578
-        wp_register_script(
579
-            'event_editor_js',
580
-            EVENTS_ASSETS_URL . 'event_editor.js',
581
-            ['ee_admin_js', 'jquery-ui-slider', 'jquery-ui-timepicker-addon'],
582
-            EVENT_ESPRESSO_VERSION,
583
-            true
584
-        );
585
-    }
586
-
587
-
588
-    /**
589
-     * Enqueuing scripts and styles specific to this view
590
-     */
591
-    public function load_scripts_styles_create_new()
592
-    {
593
-        $this->load_scripts_styles_edit();
594
-    }
595
-
596
-
597
-    /**
598
-     * Enqueuing scripts and styles specific to this view
599
-     */
600
-    public function load_scripts_styles_edit()
601
-    {
602
-        // styles
603
-        wp_enqueue_style('espresso-ui-theme');
604
-        wp_register_style(
605
-            'event-editor-css',
606
-            EVENTS_ASSETS_URL . 'event-editor.css',
607
-            ['ee-admin-css'],
608
-            EVENT_ESPRESSO_VERSION
609
-        );
610
-        wp_enqueue_style('event-editor-css');
611
-        // scripts
612
-        if (! $this->admin_config->useAdvancedEditor()) {
613
-            wp_register_script(
614
-                'event-datetime-metabox',
615
-                EVENTS_ASSETS_URL . 'event-datetime-metabox.js',
616
-                ['event_editor_js', 'ee-datepicker'],
617
-                EVENT_ESPRESSO_VERSION
618
-            );
619
-            wp_enqueue_script('event-datetime-metabox');
620
-        }
621
-    }
622
-
623
-
624
-    /**
625
-     * Populating the _views property for the category list table view.
626
-     */
627
-    protected function _set_list_table_views_category_list()
628
-    {
629
-        $this->_views = [
630
-            'all' => [
631
-                'slug'        => 'all',
632
-                'label'       => esc_html__('All', 'event_espresso'),
633
-                'count'       => 0,
634
-                'bulk_action' => [
635
-                    'delete_categories' => esc_html__('Delete Permanently', 'event_espresso'),
636
-                ],
637
-            ],
638
-        ];
639
-    }
640
-
641
-
642
-    /**
643
-     * For adding anything that fires on the admin_init hook for any route within this admin page group.
644
-     */
645
-    public function admin_init()
646
-    {
647
-        EE_Registry::$i18n_js_strings['image_confirm'] = esc_html__(
648
-            'Do you really want to delete this image? Please remember to update your event to complete the removal.',
649
-            'event_espresso'
650
-        );
651
-    }
652
-
653
-
654
-    /**
655
-     * For adding anything that should be triggered on the admin_notices hook for any route within this admin page
656
-     * group.
657
-     */
658
-    public function admin_notices()
659
-    {
660
-    }
661
-
662
-
663
-    /**
664
-     * For adding anything that should be triggered on the `admin_print_footer_scripts` hook for any route within
665
-     * this admin page group.
666
-     */
667
-    public function admin_footer_scripts()
668
-    {
669
-    }
670
-
671
-
672
-    /**
673
-     * Call this function to verify if an event is public and has tickets for sale.  If it does, then we need to show a
674
-     * warning (via EE_Error::add_error());
675
-     *
676
-     * @param EE_Event $event Event object
677
-     * @param string   $req_type
678
-     * @return void
679
-     * @throws EE_Error
680
-     * @access public
681
-     */
682
-    public function verify_event_edit($event = null, $req_type = '')
683
-    {
684
-        // don't need to do this when processing
685
-        if (! empty($req_type)) {
686
-            return;
687
-        }
688
-        // no event?
689
-        if (! $event instanceof EE_Event) {
690
-            $event = $this->_cpt_model_obj;
691
-        }
692
-        // STILL no event?
693
-        if (! $event instanceof EE_Event) {
694
-            return;
695
-        }
696
-        $orig_status = $event->status();
697
-        // first check if event is active.
698
-        if ($orig_status === EEM_Event::cancelled
699
-            || $orig_status === EEM_Event::postponed
700
-            || $event->is_expired()
701
-            || $event->is_inactive()
702
-        ) {
703
-            return;
704
-        }
705
-        // made it here so it IS active... next check that any of the tickets are sold.
706
-        if ($event->is_sold_out(true)) {
707
-            if ($orig_status !== EEM_Event::sold_out && $event->status() !== $orig_status) {
708
-                EE_Error::add_attention(
709
-                    sprintf(
710
-                        esc_html__(
711
-                            'Please note that the Event Status has automatically been changed to %s because there are no more spaces available for this event.  However, this change is not permanent until you update the event.  You can change the status back to something else before updating if you wish.',
712
-                            'event_espresso'
713
-                        ),
714
-                        EEH_Template::pretty_status(EEM_Event::sold_out, false, 'sentence')
715
-                    )
716
-                );
717
-            }
718
-            return;
719
-        }
720
-        if ($orig_status === EEM_Event::sold_out) {
721
-            EE_Error::add_attention(
722
-                sprintf(
723
-                    esc_html__(
724
-                        'Please note that the Event Status has automatically been changed to %s because more spaces have become available for this event, most likely due to abandoned transactions freeing up reserved tickets.  However, this change is not permanent until you update the event. If you wish, you can change the status back to something else before updating.',
725
-                        'event_espresso'
726
-                    ),
727
-                    EEH_Template::pretty_status($event->status(), false, 'sentence')
728
-                )
729
-            );
730
-        }
731
-        // now we need to determine if the event has any tickets on sale.  If not then we dont' show the error
732
-        if (! $event->tickets_on_sale()) {
733
-            return;
734
-        }
735
-        // made it here so show warning
736
-        $this->_edit_event_warning();
737
-    }
738
-
739
-
740
-    /**
741
-     * This is the text used for when an event is being edited that is public and has tickets for sale.
742
-     * When needed, hook this into a EE_Error::add_error() notice.
743
-     *
744
-     * @access protected
745
-     * @return void
746
-     */
747
-    protected function _edit_event_warning()
748
-    {
749
-        // we don't want to add warnings during these requests
750
-        if (isset($this->_req_data['action']) && $this->_req_data['action'] === 'editpost') {
751
-            return;
752
-        }
753
-        EE_Error::add_attention(
754
-            sprintf(
755
-                esc_html__(
756
-                    'Your event is open for registration. Making changes may disrupt any transactions in progress. %sLearn more%s',
757
-                    'event_espresso'
758
-                ),
759
-                '<a class="espresso-help-tab-lnk">',
760
-                '</a>'
761
-            )
762
-        );
763
-    }
764
-
765
-
766
-    /**
767
-     * When a user is creating a new event, notify them if they haven't set their timezone.
768
-     * Otherwise, do the normal logic
769
-     *
770
-     * @return string
771
-     * @throws EE_Error
772
-     * @throws InvalidArgumentException
773
-     * @throws InvalidDataTypeException
774
-     * @throws InvalidInterfaceException
775
-     */
776
-    protected function _create_new_cpt_item()
777
-    {
778
-        $has_timezone_string = get_option('timezone_string');
779
-        // only nag them about setting their timezone if it's their first event, and they haven't already done it
780
-        if (! $has_timezone_string && ! EEM_Event::instance()->exists([])) {
781
-            EE_Error::add_attention(
782
-                sprintf(
783
-                    __(
784
-                        'Your website\'s timezone is currently set to a UTC offset. We recommend updating your timezone to a city or region near you before you create an event. Change your timezone now:%1$s%2$s%3$sChange Timezone%4$s',
785
-                        'event_espresso'
786
-                    ),
787
-                    '<br>',
788
-                    '<select id="timezone_string" name="timezone_string" aria-describedby="timezone-description">'
789
-                    . EEH_DTT_Helper::wp_timezone_choice('', EEH_DTT_Helper::get_user_locale())
790
-                    . '</select>',
791
-                    '<button class="button button-secondary timezone-submit">',
792
-                    '</button><span class="spinner"></span>'
793
-                ),
794
-                __FILE__,
795
-                __FUNCTION__,
796
-                __LINE__
797
-            );
798
-        }
799
-        parent::_create_new_cpt_item();
800
-    }
801
-
802
-
803
-    /**
804
-     * Sets the _views property for the default route in this admin page group.
805
-     */
806
-    protected function _set_list_table_views_default()
807
-    {
808
-        $this->_views = [
809
-            'all'   => [
810
-                'slug'        => 'all',
811
-                'label'       => esc_html__('View All Events', 'event_espresso'),
812
-                'count'       => 0,
813
-                'bulk_action' => [
814
-                    'trash_events' => esc_html__('Move to Trash', 'event_espresso'),
815
-                ],
816
-            ],
817
-            'draft' => [
818
-                'slug'        => 'draft',
819
-                'label'       => esc_html__('Draft', 'event_espresso'),
820
-                'count'       => 0,
821
-                'bulk_action' => [
822
-                    'trash_events' => esc_html__('Move to Trash', 'event_espresso'),
823
-                ],
824
-            ],
825
-        ];
826
-        if (EE_Registry::instance()->CAP->current_user_can('ee_delete_events', 'espresso_events_trash_events')) {
827
-            $this->_views['trash'] = [
828
-                'slug'        => 'trash',
829
-                'label'       => esc_html__('Trash', 'event_espresso'),
830
-                'count'       => 0,
831
-                'bulk_action' => [
832
-                    'restore_events' => esc_html__('Restore From Trash', 'event_espresso'),
833
-                    'delete_events'  => esc_html__('Delete Permanently', 'event_espresso'),
834
-                ],
835
-            ];
836
-        }
837
-    }
838
-
839
-
840
-    /**
841
-     * Provides the legend item array for the default list table view.
842
-     *
843
-     * @return array
844
-     */
845
-    protected function _event_legend_items()
846
-    {
847
-        $items = [
848
-            'view_details'   => [
849
-                'class' => 'dashicons dashicons-search',
850
-                'desc'  => esc_html__('View Event', 'event_espresso'),
851
-            ],
852
-            'edit_event'     => [
853
-                'class' => 'ee-icon ee-icon-calendar-edit',
854
-                'desc'  => esc_html__('Edit Event Details', 'event_espresso'),
855
-            ],
856
-            'view_attendees' => [
857
-                'class' => 'dashicons dashicons-groups',
858
-                'desc'  => esc_html__('View Registrations for Event', 'event_espresso'),
859
-            ],
860
-        ];
861
-        $items = apply_filters('FHEE__Events_Admin_Page___event_legend_items__items', $items);
862
-        $statuses = [
863
-            'sold_out_status'  => [
864
-                'class' => 'ee-status-legend ee-status-legend-' . EE_Datetime::sold_out,
865
-                'desc'  => EEH_Template::pretty_status(EE_Datetime::sold_out, false, 'sentence'),
866
-            ],
867
-            'active_status'    => [
868
-                'class' => 'ee-status-legend ee-status-legend-' . EE_Datetime::active,
869
-                'desc'  => EEH_Template::pretty_status(EE_Datetime::active, false, 'sentence'),
870
-            ],
871
-            'upcoming_status'  => [
872
-                'class' => 'ee-status-legend ee-status-legend-' . EE_Datetime::upcoming,
873
-                'desc'  => EEH_Template::pretty_status(EE_Datetime::upcoming, false, 'sentence'),
874
-            ],
875
-            'postponed_status' => [
876
-                'class' => 'ee-status-legend ee-status-legend-' . EE_Datetime::postponed,
877
-                'desc'  => EEH_Template::pretty_status(EE_Datetime::postponed, false, 'sentence'),
878
-            ],
879
-            'cancelled_status' => [
880
-                'class' => 'ee-status-legend ee-status-legend-' . EE_Datetime::cancelled,
881
-                'desc'  => EEH_Template::pretty_status(EE_Datetime::cancelled, false, 'sentence'),
882
-            ],
883
-            'expired_status'   => [
884
-                'class' => 'ee-status-legend ee-status-legend-' . EE_Datetime::expired,
885
-                'desc'  => EEH_Template::pretty_status(EE_Datetime::expired, false, 'sentence'),
886
-            ],
887
-            'inactive_status'  => [
888
-                'class' => 'ee-status-legend ee-status-legend-' . EE_Datetime::inactive,
889
-                'desc'  => EEH_Template::pretty_status(EE_Datetime::inactive, false, 'sentence'),
890
-            ],
891
-        ];
892
-        $statuses = apply_filters('FHEE__Events_Admin_Page__event_legend_items__statuses', $statuses);
893
-        return array_merge($items, $statuses);
894
-    }
895
-
896
-
897
-    /**
898
-     * @return EEM_Event
899
-     * @throws EE_Error
900
-     * @throws InvalidArgumentException
901
-     * @throws InvalidDataTypeException
902
-     * @throws InvalidInterfaceException
903
-     * @throws ReflectionException
904
-     */
905
-    private function _event_model()
906
-    {
907
-        if (! $this->_event_model instanceof EEM_Event) {
908
-            $this->_event_model = EE_Registry::instance()->load_model('Event');
909
-        }
910
-        return $this->_event_model;
911
-    }
912
-
913
-
914
-    /**
915
-     * Adds extra buttons to the WP CPT permalink field row.
916
-     * Method is called from parent and is hooked into the wp 'get_sample_permalink_html' filter.
917
-     *
918
-     * @param string $return    the current html
919
-     * @param int    $id        the post id for the page
920
-     * @param string $new_title What the title is
921
-     * @param string $new_slug  what the slug is
922
-     * @return string            The new html string for the permalink area
923
-     */
924
-    public function extra_permalink_field_buttons($return, $id, $new_title, $new_slug)
925
-    {
926
-        // make sure this is only when editing
927
-        if (! empty($id)) {
928
-            $post = get_post($id);
929
-            $return .= '<a class="button button-small" onclick="prompt(\'Shortcode:\', jQuery(\'#shortcode\').val()); return false;" href="#"  tabindex="-1">'
930
-                       . esc_html__('Shortcode', 'event_espresso')
931
-                       . '</a> ';
932
-            $return .= '<input id="shortcode" type="hidden" value="[ESPRESSO_TICKET_SELECTOR event_id='
933
-                       . $post->ID
934
-                       . ']">';
935
-        }
936
-        return $return;
937
-    }
938
-
939
-
940
-    /**
941
-     * _events_overview_list_table
942
-     * This contains the logic for showing the events_overview list
943
-     *
944
-     * @access protected
945
-     * @return void
946
-     * @throws DomainException
947
-     * @throws EE_Error
948
-     * @throws InvalidArgumentException
949
-     * @throws InvalidDataTypeException
950
-     * @throws InvalidInterfaceException
951
-     */
952
-    protected function _events_overview_list_table()
953
-    {
954
-        do_action('AHEE_log', __FILE__, __FUNCTION__, '');
955
-        $this->_template_args['after_list_table'] = ! empty($this->_template_args['after_list_table'])
956
-            ? (array) $this->_template_args['after_list_table']
957
-            : [];
958
-        $this->_template_args['after_list_table']['view_event_list_button'] = EEH_HTML::br()
959
-                                                                              . EEH_Template::get_button_or_link(
960
-                                                                                  get_post_type_archive_link('espresso_events'),
961
-                                                                                  esc_html__('View Event Archive Page', 'event_espresso'),
962
-                                                                                  'button'
963
-                                                                              );
964
-        $this->_template_args['after_list_table']['legend'] = $this->_display_legend($this->_event_legend_items());
965
-        $this->_admin_page_title .= ' ' . $this->get_action_link_or_button(
966
-            'create_new',
967
-            'add',
968
-            [],
969
-            'add-new-h2'
970
-        );
971
-        $this->display_admin_list_table_page_with_no_sidebar();
972
-    }
973
-
974
-
975
-    /**
976
-     * this allows for extra misc actions in the default WP publish box
977
-     *
978
-     * @return void
979
-     * @throws DomainException
980
-     * @throws EE_Error
981
-     * @throws InvalidArgumentException
982
-     * @throws InvalidDataTypeException
983
-     * @throws InvalidInterfaceException
984
-     * @throws ReflectionException
985
-     */
986
-    public function extra_misc_actions_publish_box()
987
-    {
988
-        $this->_generate_publish_box_extra_content();
989
-    }
990
-
991
-
992
-    /**
993
-     * This is hooked into the WordPress do_action('save_post') hook and runs after the custom post type has been
994
-     * saved.
995
-     * Typically you would use this to save any additional data.
996
-     * Keep in mind also that "save_post" runs on EVERY post update to the database.
997
-     * ALSO very important.  When a post transitions from scheduled to published,
998
-     * the save_post action is fired but you will NOT have any _POST data containing any extra info you may have from
999
-     * other meta saves. So MAKE sure that you handle this accordingly.
1000
-     *
1001
-     * @access protected
1002
-     * @abstract
1003
-     * @param string $post_id The ID of the cpt that was saved (so you can link relationally)
1004
-     * @param object $post    The post object of the cpt that was saved.
1005
-     * @return void
1006
-     * @throws EE_Error
1007
-     * @throws InvalidArgumentException
1008
-     * @throws InvalidDataTypeException
1009
-     * @throws InvalidInterfaceException
1010
-     * @throws ReflectionException
1011
-     */
1012
-    protected function _insert_update_cpt_item($post_id, $post)
1013
-    {
1014
-        if ($post instanceof WP_Post && $post->post_type !== 'espresso_events') {
1015
-            // get out we're not processing an event save.
1016
-            return;
1017
-        }
1018
-        $event_values = [
1019
-            'EVT_member_only'     => ! empty($this->_req_data['member_only']) ? 1 : 0,
1020
-            'EVT_allow_overflow'  => ! empty($this->_req_data['EVT_allow_overflow']) ? 1 : 0,
1021
-            'EVT_timezone_string' => ! empty($this->_req_data['timezone_string'])
1022
-                ? sanitize_text_field($this->_req_data['timezone_string'])
1023
-                : null,
1024
-        ];
1025
-        /** @var FeatureFlags $flags */
1026
-        $flags = $this->loader->getShared('EventEspresso\core\domain\services\capabilities\FeatureFlags');
1027
-        // check if the new EDTR reg options meta box is being used, and if so, don't run updates for legacy version
1028
-        if (! $this->admin_config->useAdvancedEditor() || ! $flags->featureAllowed('use_reg_options_meta_box')) {
1029
-            $event_values['EVT_display_ticket_selector'] =
1030
-                ! empty($this->_req_data['display_ticket_selector'])
1031
-                    ? 1
1032
-                    : 0;
1033
-            $event_values['EVT_additional_limit'] = min(
1034
-                apply_filters('FHEE__EE_Events_Admin__insert_update_cpt_item__EVT_additional_limit_max', 255),
1035
-                ! empty($this->_req_data['additional_limit'])
1036
-                    ? absint($this->_req_data['additional_limit'])
1037
-                    : null
1038
-            );
1039
-            $event_values['EVT_default_registration_status'] =
1040
-                ! empty($this->_req_data['EVT_default_registration_status'])
1041
-                    ? sanitize_text_field($this->_req_data['EVT_default_registration_status'])
1042
-                    : EE_Registry::instance()->CFG->registration->default_STS_ID;
1043
-            $event_values['EVT_external_URL'] = ! empty($this->_req_data['externalURL'])
1044
-                ? esc_url_raw($this->_req_data['externalURL'])
1045
-                : null;
1046
-            $event_values['EVT_phone'] = ! empty($this->_req_data['event_phone'])
1047
-                ? sanitize_text_field($this->_req_data['event_phone'])
1048
-                : null;
1049
-        }
1050
-        // update event
1051
-        $success = $this->_event_model()->update_by_ID($event_values, $post_id);
1052
-        // get event_object for other metaboxes... though it would seem to make sense to just use $this->_event_model()->get_one_by_ID( $post_id ).. i have to setup where conditions to override the filters in the model that filter out autodraft and inherit statuses so we GET the inherit id!
1053
-        $get_one_where = [
1054
-            $this->_event_model()->primary_key_name() => $post_id,
1055
-            'OR'                                      => [
1056
-                'status'   => $post->post_status,
1057
-                // if trying to "Publish" a sold out event, it's status will get switched back to "sold_out" in the db,
1058
-                // but the returned object here has a status of "publish", so use the original post status as well
1059
-                'status*1' => $this->_req_data['original_post_status'],
1060
-            ],
1061
-        ];
1062
-        $event = $this->_event_model()->get_one([$get_one_where]);
1063
-        // the following are default callbacks for event attachment updates that can be overridden by caffeinated functionality and/or addons.
1064
-        $event_update_callbacks = apply_filters(
1065
-            'FHEE__Events_Admin_Page___insert_update_cpt_item__event_update_callbacks',
1066
-            [
1067
-                [$this, '_default_venue_update'],
1068
-                [$this, '_default_tickets_update'],
1069
-            ]
1070
-        );
1071
-        $att_success = true;
1072
-        foreach ($event_update_callbacks as $e_callback) {
1073
-            $_success = is_callable($e_callback)
1074
-                ? $e_callback($event, $this->_req_data)
1075
-                : false;
1076
-            // if ANY of these updates fail then we want the appropriate global error message
1077
-            $att_success = ! $att_success ? $att_success : $_success;
1078
-        }
1079
-        // any errors?
1080
-        if ($success && false === $att_success) {
1081
-            EE_Error::add_error(
1082
-                esc_html__(
1083
-                    'Event Details saved successfully but something went wrong with saving attachments.',
1084
-                    'event_espresso'
1085
-                ),
1086
-                __FILE__,
1087
-                __FUNCTION__,
1088
-                __LINE__
1089
-            );
1090
-        } elseif ($success === false) {
1091
-            EE_Error::add_error(
1092
-                esc_html__('Event Details did not save successfully.', 'event_espresso'),
1093
-                __FILE__,
1094
-                __FUNCTION__,
1095
-                __LINE__
1096
-            );
1097
-        }
1098
-    }
1099
-
1100
-
1101
-    /**
1102
-     * @param int $post_id
1103
-     * @param int $revision_id
1104
-     * @throws EE_Error
1105
-     * @throws InvalidArgumentException
1106
-     * @throws InvalidDataTypeException
1107
-     * @throws InvalidInterfaceException
1108
-     * @throws ReflectionException
1109
-     * @see parent::restore_item()
1110
-     */
1111
-    protected function _restore_cpt_item($post_id, $revision_id)
1112
-    {
1113
-        // copy existing event meta to new post
1114
-        $post_evt = $this->_event_model()->get_one_by_ID($post_id);
1115
-        if ($post_evt instanceof EE_Event) {
1116
-            // meta revision restore
1117
-            $post_evt->restore_revision($revision_id);
1118
-            // related objs restore
1119
-            $post_evt->restore_revision($revision_id, ['Venue', 'Datetime', 'Price']);
1120
-        }
1121
-    }
1122
-
1123
-
1124
-    /**
1125
-     * Attach the venue to the Event
1126
-     *
1127
-     * @param EE_Event $evtobj Event Object to add the venue to
1128
-     * @param array    $data   The request data from the form
1129
-     * @return bool           Success or fail.
1130
-     * @throws EE_Error
1131
-     * @throws InvalidArgumentException
1132
-     * @throws InvalidDataTypeException
1133
-     * @throws InvalidInterfaceException
1134
-     * @throws ReflectionException
1135
-     */
1136
-    protected function _default_venue_update(EE_Event $evtobj, $data)
1137
-    {
1138
-        require_once(EE_MODELS . 'EEM_Venue.model.php');
1139
-        $venue_model = EE_Registry::instance()->load_model('Venue');
1140
-        $rows_affected = null;
1141
-        $venue_id = ! empty($data['venue_id']) ? $data['venue_id'] : null;
1142
-        // very important.  If we don't have a venue name...
1143
-        // then we'll get out because not necessary to create empty venue
1144
-        if (empty($data['venue_title'])) {
1145
-            return false;
1146
-        }
1147
-        $venue_array = [
1148
-            'VNU_wp_user'         => $evtobj->get('EVT_wp_user'),
1149
-            'VNU_name'            => ! empty($data['venue_title']) ? $data['venue_title'] : null,
1150
-            'VNU_desc'            => ! empty($data['venue_description']) ? $data['venue_description'] : null,
1151
-            'VNU_identifier'      => ! empty($data['venue_identifier']) ? $data['venue_identifier'] : null,
1152
-            'VNU_short_desc'      => ! empty($data['venue_short_description']) ? $data['venue_short_description']
1153
-                : null,
1154
-            'VNU_address'         => ! empty($data['address']) ? $data['address'] : null,
1155
-            'VNU_address2'        => ! empty($data['address2']) ? $data['address2'] : null,
1156
-            'VNU_city'            => ! empty($data['city']) ? $data['city'] : null,
1157
-            'STA_ID'              => ! empty($data['state']) ? $data['state'] : null,
1158
-            'CNT_ISO'             => ! empty($data['countries']) ? $data['countries'] : null,
1159
-            'VNU_zip'             => ! empty($data['zip']) ? $data['zip'] : null,
1160
-            'VNU_phone'           => ! empty($data['venue_phone']) ? $data['venue_phone'] : null,
1161
-            'VNU_capacity'        => ! empty($data['venue_capacity']) ? $data['venue_capacity'] : null,
1162
-            'VNU_url'             => ! empty($data['venue_url']) ? $data['venue_url'] : null,
1163
-            'VNU_virtual_phone'   => ! empty($data['virtual_phone']) ? $data['virtual_phone'] : null,
1164
-            'VNU_virtual_url'     => ! empty($data['virtual_url']) ? $data['virtual_url'] : null,
1165
-            'VNU_enable_for_gmap' => isset($data['enable_for_gmap']) ? 1 : 0,
1166
-            'status'              => 'publish',
1167
-        ];
1168
-        // if we've got the venue_id then we're just updating the existing venue so let's do that and then get out.
1169
-        if (! empty($venue_id)) {
1170
-            $update_where = [$venue_model->primary_key_name() => $venue_id];
1171
-            $rows_affected = $venue_model->update($venue_array, [$update_where]);
1172
-            // we've gotta make sure that the venue is always attached to a revision.. add_relation_to should take care of making sure that the relation is already present.
1173
-            $evtobj->_add_relation_to($venue_id, 'Venue');
1174
-            return $rows_affected > 0;
1175
-        }
1176
-        // we insert the venue
1177
-        $venue_id = $venue_model->insert($venue_array);
1178
-        $evtobj->_add_relation_to($venue_id, 'Venue');
1179
-        return ! empty($venue_id) ? true : false;
1180
-        // when we have the ancestor come in it's already been handled by the revision save.
1181
-    }
1182
-
1183
-
1184
-    /**
1185
-     * Handles saving everything related to Tickets (datetimes, tickets, prices)
1186
-     *
1187
-     * @param EE_Event $evtobj The Event object we're attaching data to
1188
-     * @param array    $data   The request data from the form
1189
-     * @return array
1190
-     * @throws EE_Error
1191
-     * @throws InvalidArgumentException
1192
-     * @throws InvalidDataTypeException
1193
-     * @throws InvalidInterfaceException
1194
-     * @throws ReflectionException
1195
-     * @throws Exception
1196
-     */
1197
-    protected function _default_tickets_update(EE_Event $evtobj, $data)
1198
-    {
1199
-        if ($this->admin_config->useAdvancedEditor()) {
1200
-            return [];
1201
-        }
1202
-        $success = true;
1203
-        $saved_dtt = null;
1204
-        $saved_tickets = [];
1205
-        $incoming_date_formats = ['Y-m-d', 'h:i a'];
1206
-        foreach ($data['edit_event_datetimes'] as $row => $dtt) {
1207
-            // trim all values to ensure any excess whitespace is removed.
1208
-            $dtt = array_map('trim', $dtt);
1209
-            $dtt['DTT_EVT_end'] = isset($dtt['DTT_EVT_end']) && ! empty($dtt['DTT_EVT_end']) ? $dtt['DTT_EVT_end']
1210
-                : $dtt['DTT_EVT_start'];
1211
-            $datetime_values = [
1212
-                'DTT_ID'        => ! empty($dtt['DTT_ID']) ? $dtt['DTT_ID'] : null,
1213
-                'DTT_EVT_start' => $dtt['DTT_EVT_start'],
1214
-                'DTT_EVT_end'   => $dtt['DTT_EVT_end'],
1215
-                'DTT_reg_limit' => empty($dtt['DTT_reg_limit']) ? EE_INF : $dtt['DTT_reg_limit'],
1216
-                'DTT_order'     => $row,
1217
-            ];
1218
-            // if we have an id then let's get existing object first and then set the new values.  Otherwise we instantiate a new object for save.
1219
-            if (! empty($dtt['DTT_ID'])) {
1220
-                $DTM = EE_Registry::instance()
1221
-                                  ->load_model('Datetime', [$evtobj->get_timezone()])
1222
-                                  ->get_one_by_ID($dtt['DTT_ID']);
1223
-                $DTM->set_date_format($incoming_date_formats[0]);
1224
-                $DTM->set_time_format($incoming_date_formats[1]);
1225
-                foreach ($datetime_values as $field => $value) {
1226
-                    $DTM->set($field, $value);
1227
-                }
1228
-                // make sure the $dtt_id here is saved just in case after the add_relation_to() the autosave replaces it.  We need to do this so we dont' TRASH the parent DTT.
1229
-                $saved_dtts[ $DTM->ID() ] = $DTM;
1230
-            } else {
1231
-                $DTM = EE_Registry::instance()->load_class(
1232
-                    'Datetime',
1233
-                    [$datetime_values, $evtobj->get_timezone(), $incoming_date_formats],
1234
-                    false,
1235
-                    false
1236
-                );
1237
-                foreach ($datetime_values as $field => $value) {
1238
-                    $DTM->set($field, $value);
1239
-                }
1240
-            }
1241
-            $DTM->save();
1242
-            $DTT = $evtobj->_add_relation_to($DTM, 'Datetime');
1243
-            // load DTT helper
1244
-            // before going any further make sure our dates are setup correctly so that the end date is always equal or greater than the start date.
1245
-            if ($DTT->get_raw('DTT_EVT_start') > $DTT->get_raw('DTT_EVT_end')) {
1246
-                $DTT->set('DTT_EVT_end', $DTT->get('DTT_EVT_start'));
1247
-                $DTT = EEH_DTT_Helper::date_time_add($DTT, 'DTT_EVT_end', 'days');
1248
-                $DTT->save();
1249
-            }
1250
-            // now we got to make sure we add the new DTT_ID to the $saved_dtts array  because it is possible there was a new one created for the autosave.
1251
-            $saved_dtt = $DTT;
1252
-            $success = ! $success ? $success : $DTT;
1253
-            // if ANY of these updates fail then we want the appropriate global error message.
1254
-            // //todo this is actually sucky we need a better error message but this is what it is for now.
1255
-        }
1256
-        // no dtts get deleted so we don't do any of that logic here.
1257
-        // update tickets next
1258
-        $old_tickets = isset($data['ticket_IDs']) ? explode(',', $data['ticket_IDs']) : [];
1259
-        foreach ($data['edit_tickets'] as $row => $tkt) {
1260
-            $incoming_date_formats = ['Y-m-d', 'h:i a'];
1261
-            $update_prices = false;
1262
-            $ticket_price = isset($data['edit_prices'][ $row ][1]['PRC_amount'])
1263
-                ? $data['edit_prices'][ $row ][1]['PRC_amount'] : 0;
1264
-            // trim inputs to ensure any excess whitespace is removed.
1265
-            $tkt = array_map('trim', $tkt);
1266
-            if (empty($tkt['TKT_start_date'])) {
1267
-                // let's use now in the set timezone.
1268
-                $now = new DateTime('now', new DateTimeZone($evtobj->get_timezone()));
1269
-                $tkt['TKT_start_date'] = $now->format($incoming_date_formats[0] . ' ' . $incoming_date_formats[1]);
1270
-            }
1271
-            if (empty($tkt['TKT_end_date'])) {
1272
-                // use the start date of the first datetime
1273
-                $dtt = $evtobj->first_datetime();
1274
-                $tkt['TKT_end_date'] = $dtt->start_date_and_time(
1275
-                    $incoming_date_formats[0],
1276
-                    $incoming_date_formats[1]
1277
-                );
1278
-            }
1279
-            $TKT_values = [
1280
-                'TKT_ID'          => ! empty($tkt['TKT_ID']) ? $tkt['TKT_ID'] : null,
1281
-                'TTM_ID'          => ! empty($tkt['TTM_ID']) ? $tkt['TTM_ID'] : 0,
1282
-                'TKT_name'        => ! empty($tkt['TKT_name']) ? $tkt['TKT_name'] : '',
1283
-                'TKT_description' => ! empty($tkt['TKT_description']) ? $tkt['TKT_description'] : '',
1284
-                'TKT_start_date'  => $tkt['TKT_start_date'],
1285
-                'TKT_end_date'    => $tkt['TKT_end_date'],
1286
-                'TKT_qty'         => ! isset($tkt['TKT_qty']) || $tkt['TKT_qty'] === '' ? EE_INF : $tkt['TKT_qty'],
1287
-                'TKT_uses'        => ! isset($tkt['TKT_uses']) || $tkt['TKT_uses'] === '' ? EE_INF : $tkt['TKT_uses'],
1288
-                'TKT_min'         => empty($tkt['TKT_min']) ? 0 : $tkt['TKT_min'],
1289
-                'TKT_max'         => empty($tkt['TKT_max']) ? EE_INF : $tkt['TKT_max'],
1290
-                'TKT_row'         => $row,
1291
-                'TKT_order'       => isset($tkt['TKT_order']) ? $tkt['TKT_order'] : $row,
1292
-                'TKT_price'       => $ticket_price,
1293
-            ];
1294
-            // if this is a default TKT, then we need to set the TKT_ID to 0 and update accordingly, which means in turn that the prices will become new prices as well.
1295
-            if (isset($tkt['TKT_is_default']) && $tkt['TKT_is_default']) {
1296
-                $TKT_values['TKT_ID'] = 0;
1297
-                $TKT_values['TKT_is_default'] = 0;
1298
-                $TKT_values['TKT_price'] = $ticket_price;
1299
-                $update_prices = true;
1300
-            }
1301
-            // if we have a TKT_ID then we need to get that existing TKT_obj and update it
1302
-            // we actually do our saves a head of doing any add_relations to because its entirely possible that this ticket didn't removed or added to any datetime in the session but DID have it's items modified.
1303
-            // keep in mind that if the TKT has been sold (and we have changed pricing information), then we won't be updating the tkt but instead a new tkt will be created and the old one archived.
1304
-            if (! empty($tkt['TKT_ID'])) {
1305
-                $TKT = EE_Registry::instance()
1306
-                                  ->load_model('Ticket', [$evtobj->get_timezone()])
1307
-                                  ->get_one_by_ID($tkt['TKT_ID']);
1308
-                if ($TKT instanceof EE_Ticket) {
1309
-                    $ticket_sold = $TKT->count_related(
1310
-                        'Registration',
1311
-                        [
1312
-                                [
1313
-                                    'STS_ID' => [
1314
-                                        'NOT IN',
1315
-                                        [EEM_Registration::status_id_incomplete],
1316
-                                    ],
1317
-                                ],
1318
-                            ]
1319
-                    ) > 0;
1320
-                    // let's just check the total price for the existing ticket and determine if it matches the new
1321
-                    // total price.  if they are different then we create a new ticket (if tickets sold)
1322
-                    // if they aren't different then we go ahead and modify existing ticket.
1323
-                    $create_new_TKT = $ticket_sold && ! $TKT->deleted()
1324
-                                      && EEH_Money::compare_floats(
1325
-                                          $ticket_price,
1326
-                                          $TKT->get('TKT_price'),
1327
-                                          '!=='
1328
-                                      );
1329
-                    $TKT->set_date_format($incoming_date_formats[0]);
1330
-                    $TKT->set_time_format($incoming_date_formats[1]);
1331
-                    // set new values
1332
-                    foreach ($TKT_values as $field => $value) {
1333
-                        if ($field === 'TKT_qty') {
1334
-                            $TKT->set_qty($value);
1335
-                        } else {
1336
-                            $TKT->set($field, $value);
1337
-                        }
1338
-                    }
1339
-                    // if $create_new_TKT is false then we can safely update the existing ticket.  Otherwise we have to create a new ticket.
1340
-                    if ($create_new_TKT) {
1341
-                        // archive the old ticket first
1342
-                        $TKT->set('TKT_deleted', 1);
1343
-                        $TKT->save();
1344
-                        // make sure this ticket is still recorded in our saved_tkts so we don't run it through the regular trash routine.
1345
-                        $saved_tickets[ $TKT->ID() ] = $TKT;
1346
-                        // create new ticket that's a copy of the existing except a new id of course (and not archived) AND has the new TKT_price associated with it.
1347
-                        $TKT = clone $TKT;
1348
-                        $TKT->set('TKT_ID', 0);
1349
-                        $TKT->set('TKT_deleted', 0);
1350
-                        $TKT->set('TKT_price', $ticket_price);
1351
-                        $TKT->set('TKT_sold', 0);
1352
-                        // now we need to make sure that $new prices are created as well and attached to new ticket.
1353
-                        $update_prices = true;
1354
-                    }
1355
-                    // make sure price is set if it hasn't been already
1356
-                    $TKT->set('TKT_price', $ticket_price);
1357
-                }
1358
-            } else {
1359
-                // no TKT_id so a new TKT
1360
-                $TKT_values['TKT_price'] = $ticket_price;
1361
-                $TKT = EE_Registry::instance()->load_class('Ticket', [$TKT_values], false, false);
1362
-                if ($TKT instanceof EE_Ticket) {
1363
-                    // need to reset values to properly account for the date formats
1364
-                    $TKT->set_date_format($incoming_date_formats[0]);
1365
-                    $TKT->set_time_format($incoming_date_formats[1]);
1366
-                    $TKT->set_timezone($evtobj->get_timezone());
1367
-                    // set new values
1368
-                    foreach ($TKT_values as $field => $value) {
1369
-                        if ($field === 'TKT_qty') {
1370
-                            $TKT->set_qty($value);
1371
-                        } else {
1372
-                            $TKT->set($field, $value);
1373
-                        }
1374
-                    }
1375
-                    $update_prices = true;
1376
-                }
1377
-            }
1378
-            // cap ticket qty by datetime reg limits
1379
-            $TKT->set_qty(min($TKT->qty(), $TKT->qty('reg_limit')));
1380
-            // update ticket.
1381
-            $TKT->save();
1382
-            // before going any further make sure our dates are setup correctly so that the end date is always equal or greater than the start date.
1383
-            if ($TKT->get_raw('TKT_start_date') > $TKT->get_raw('TKT_end_date')) {
1384
-                $TKT->set('TKT_end_date', $TKT->get('TKT_start_date'));
1385
-                $TKT = EEH_DTT_Helper::date_time_add($TKT, 'TKT_end_date', 'days');
1386
-                $TKT->save();
1387
-            }
1388
-            // initially let's add the ticket to the dtt
1389
-            $saved_dtt->_add_relation_to($TKT, 'Ticket');
1390
-            $saved_tickets[ $TKT->ID() ] = $TKT;
1391
-            // add prices to ticket
1392
-            $this->_add_prices_to_ticket($data['edit_prices'][ $row ], $TKT, $update_prices);
1393
-        }
1394
-        // however now we need to handle permanently deleting tickets via the ui.  Keep in mind that the ui does not allow deleting/archiving tickets that have ticket sold.  However, it does allow for deleting tickets that have no tickets sold, in which case we want to get rid of permanently because there is no need to save in db.
1395
-        $old_tickets = isset($old_tickets[0]) && $old_tickets[0] === '' ? [] : $old_tickets;
1396
-        $tickets_removed = array_diff($old_tickets, array_keys($saved_tickets));
1397
-        foreach ($tickets_removed as $id) {
1398
-            $id = absint($id);
1399
-            // get the ticket for this id
1400
-            $tkt_to_remove = EE_Registry::instance()->load_model('Ticket')->get_one_by_ID($id);
1401
-            // need to get all the related datetimes on this ticket and remove from every single one of them (remember this process can ONLY kick off if there are NO tkts_sold)
1402
-            $dtts = $tkt_to_remove->get_many_related('Datetime');
1403
-            foreach ($dtts as $dtt) {
1404
-                $tkt_to_remove->_remove_relation_to($dtt, 'Datetime');
1405
-            }
1406
-            // need to do the same for prices (except these prices can also be deleted because again, tickets can only be trashed if they don't have any TKTs sold (otherwise they are just archived))
1407
-            $tkt_to_remove->delete_related_permanently('Price');
1408
-            // finally let's delete this ticket (which should not be blocked at this point b/c we've removed all our relationships)
1409
-            $tkt_to_remove->delete_permanently();
1410
-        }
1411
-        return [$saved_dtt, $saved_tickets];
1412
-    }
1413
-
1414
-
1415
-    /**
1416
-     * This attaches a list of given prices to a ticket.
1417
-     * Note we dont' have to worry about ever removing relationships (or archiving prices) because if there is a change
1418
-     * in price information on a ticket, a new ticket is created anyways so the archived ticket will retain the old
1419
-     * price info and prices are automatically "archived" via the ticket.
1420
-     *
1421
-     * @access  private
1422
-     * @param array     $prices     Array of prices from the form.
1423
-     * @param EE_Ticket $ticket     EE_Ticket object that prices are being attached to.
1424
-     * @param bool      $new_prices Whether attach existing incoming prices or create new ones.
1425
-     * @return  void
1426
-     * @throws EE_Error
1427
-     * @throws InvalidArgumentException
1428
-     * @throws InvalidDataTypeException
1429
-     * @throws InvalidInterfaceException
1430
-     * @throws ReflectionException
1431
-     */
1432
-    private function _add_prices_to_ticket($prices, EE_Ticket $ticket, $new_prices = false)
1433
-    {
1434
-        foreach ($prices as $row => $prc) {
1435
-            $PRC_values = [
1436
-                'PRC_ID'         => ! empty($prc['PRC_ID']) ? $prc['PRC_ID'] : null,
1437
-                'PRT_ID'         => ! empty($prc['PRT_ID']) ? $prc['PRT_ID'] : null,
1438
-                'PRC_amount'     => ! empty($prc['PRC_amount']) ? $prc['PRC_amount'] : 0,
1439
-                'PRC_name'       => ! empty($prc['PRC_name']) ? $prc['PRC_name'] : '',
1440
-                'PRC_desc'       => ! empty($prc['PRC_desc']) ? $prc['PRC_desc'] : '',
1441
-                'PRC_is_default' => 0, // make sure prices are NOT set as default from this context
1442
-                'PRC_order'      => $row,
1443
-            ];
1444
-            if ($new_prices || empty($PRC_values['PRC_ID'])) {
1445
-                $PRC_values['PRC_ID'] = 0;
1446
-                $PRC = EE_Registry::instance()->load_class('Price', [$PRC_values], false, false);
1447
-            } else {
1448
-                $PRC = EE_Registry::instance()->load_model('Price')->get_one_by_ID($prc['PRC_ID']);
1449
-                // update this price with new values
1450
-                foreach ($PRC_values as $field => $newprc) {
1451
-                    $PRC->set($field, $newprc);
1452
-                }
1453
-                $PRC->save();
1454
-            }
1455
-            $ticket->_add_relation_to($PRC, 'Price');
1456
-        }
1457
-    }
1458
-
1459
-
1460
-    /**
1461
-     * Add in our autosave ajax handlers
1462
-     *
1463
-     */
1464
-    protected function _ee_autosave_create_new()
1465
-    {
1466
-    }
1467
-
1468
-
1469
-    /**
1470
-     * More autosave handlers.
1471
-     */
1472
-    protected function _ee_autosave_edit()
1473
-    {
1474
-    }
1475
-
1476
-
1477
-    /**
1478
-     *    _generate_publish_box_extra_content
1479
-     *
1480
-     * @throws DomainException
1481
-     * @throws EE_Error
1482
-     * @throws InvalidArgumentException
1483
-     * @throws InvalidDataTypeException
1484
-     * @throws InvalidInterfaceException
1485
-     * @throws ReflectionException
1486
-     */
1487
-    private function _generate_publish_box_extra_content()
1488
-    {
1489
-        // load formatter helper
1490
-        // args for getting related registrations
1491
-        $approved_query_args = [
1492
-            [
1493
-                'REG_deleted' => 0,
1494
-                'STS_ID'      => EEM_Registration::status_id_approved,
1495
-            ],
1496
-        ];
1497
-        $not_approved_query_args = [
1498
-            [
1499
-                'REG_deleted' => 0,
1500
-                'STS_ID'      => EEM_Registration::status_id_not_approved,
1501
-            ],
1502
-        ];
1503
-        $pending_payment_query_args = [
1504
-            [
1505
-                'REG_deleted' => 0,
1506
-                'STS_ID'      => EEM_Registration::status_id_pending_payment,
1507
-            ],
1508
-        ];
1509
-        // publish box
1510
-        $publish_box_extra_args = [
1511
-            'view_approved_reg_url'        => add_query_arg(
1512
-                [
1513
-                    'action'      => 'default',
1514
-                    'event_id'    => $this->_cpt_model_obj->ID(),
1515
-                    '_reg_status' => EEM_Registration::status_id_approved,
1516
-                ],
1517
-                REG_ADMIN_URL
1518
-            ),
1519
-            'view_not_approved_reg_url'    => add_query_arg(
1520
-                [
1521
-                    'action'      => 'default',
1522
-                    'event_id'    => $this->_cpt_model_obj->ID(),
1523
-                    '_reg_status' => EEM_Registration::status_id_not_approved,
1524
-                ],
1525
-                REG_ADMIN_URL
1526
-            ),
1527
-            'view_pending_payment_reg_url' => add_query_arg(
1528
-                [
1529
-                    'action'      => 'default',
1530
-                    'event_id'    => $this->_cpt_model_obj->ID(),
1531
-                    '_reg_status' => EEM_Registration::status_id_pending_payment,
1532
-                ],
1533
-                REG_ADMIN_URL
1534
-            ),
1535
-            'approved_regs'                => $this->_cpt_model_obj->count_related(
1536
-                'Registration',
1537
-                $approved_query_args
1538
-            ),
1539
-            'not_approved_regs'            => $this->_cpt_model_obj->count_related(
1540
-                'Registration',
1541
-                $not_approved_query_args
1542
-            ),
1543
-            'pending_payment_regs'         => $this->_cpt_model_obj->count_related(
1544
-                'Registration',
1545
-                $pending_payment_query_args
1546
-            ),
1547
-            'misc_pub_section_class'       => apply_filters(
1548
-                'FHEE_Events_Admin_Page___generate_publish_box_extra_content__misc_pub_section_class',
1549
-                'misc-pub-section'
1550
-            ),
1551
-        ];
1552
-        ob_start();
1553
-        do_action(
1554
-            'AHEE__Events_Admin_Page___generate_publish_box_extra_content__event_editor_overview_add',
1555
-            $this->_cpt_model_obj
1556
-        );
1557
-        $publish_box_extra_args['event_editor_overview_add'] = ob_get_clean();
1558
-        // load template
1559
-        EEH_Template::display_template(
1560
-            EVENTS_TEMPLATE_PATH . 'event_publish_box_extras.template.php',
1561
-            $publish_box_extra_args
1562
-        );
1563
-    }
1564
-
1565
-
1566
-    /**
1567
-     * @return EE_Event
1568
-     */
1569
-    public function get_event_object()
1570
-    {
1571
-        return $this->_cpt_model_obj;
1572
-    }
1573
-
1574
-
1575
-
1576
-
1577
-    /** METABOXES * */
1578
-    /**
1579
-     * _register_event_editor_meta_boxes
1580
-     * add all metaboxes related to the event_editor
1581
-     *
1582
-     * @return void
1583
-     * @throws EE_Error
1584
-     * @throws InvalidArgumentException
1585
-     * @throws InvalidDataTypeException
1586
-     * @throws InvalidInterfaceException
1587
-     * @throws ReflectionException
1588
-     */
1589
-    protected function _register_event_editor_meta_boxes()
1590
-    {
1591
-        $this->verify_cpt_object();
1592
-        $use_advanced_editor = $this->admin_config->useAdvancedEditor();
1593
-        /** @var FeatureFlags $flags */
1594
-        $flags = $this->loader->getShared('EventEspresso\core\domain\services\capabilities\FeatureFlags');
1595
-        // check if the new EDTR reg options meta box is being used, and if so, don't load the legacy version
1596
-        if (! $use_advanced_editor || ! $flags->featureAllowed('use_reg_options_meta_box')) {
1597
-            add_meta_box(
1598
-                'espresso_event_editor_event_options',
1599
-                esc_html__('Event Registration Options', 'event_espresso'),
1600
-                [$this, 'registration_options_meta_box'],
1601
-                $this->page_slug,
1602
-                'side'
1603
-            );
1604
-            add_action(
1605
-                'add_meta_boxes_espresso_events',
1606
-                function () {
1607
-                    global $current_screen;
1608
-                    remove_meta_box('authordiv', $current_screen, 'normal');
1609
-                },
1610
-                99
1611
-            );
1612
-        }
1613
-        if (! $use_advanced_editor) {
1614
-            add_meta_box(
1615
-                'espresso_event_editor_tickets',
1616
-                esc_html__('Event Datetime & Ticket', 'event_espresso'),
1617
-                [$this, 'ticket_metabox'],
1618
-                $this->page_slug,
1619
-                'normal',
1620
-                'high'
1621
-            );
1622
-        }
1623
-        // NOTE: if you're looking for other metaboxes in here,
1624
-        // where a metabox has a related management page in the admin
1625
-        // you will find it setup in the related management page's "_Hooks" file.
1626
-        // i.e. messages metabox is found in "espresso_events_Messages_Hooks.class.php".
1627
-    }
1628
-
1629
-
1630
-    /**
1631
-     * @throws DomainException
1632
-     * @throws EE_Error
1633
-     * @throws InvalidArgumentException
1634
-     * @throws InvalidDataTypeException
1635
-     * @throws InvalidInterfaceException
1636
-     * @throws ReflectionException
1637
-     */
1638
-    public function ticket_metabox()
1639
-    {
1640
-        $existing_datetime_ids = $existing_ticket_ids = [];
1641
-        // defaults for template args
1642
-        $template_args = [
1643
-            'existing_datetime_ids'    => '',
1644
-            'event_datetime_help_link' => '',
1645
-            'ticket_options_help_link' => '',
1646
-            'time'                     => null,
1647
-            'ticket_rows'              => '',
1648
-            'existing_ticket_ids'      => '',
1649
-            'total_ticket_rows'        => 1,
1650
-            'ticket_js_structure'      => '',
1651
-            'trash_icon'               => 'ee-lock-icon',
1652
-            'disabled'                 => '',
1653
-        ];
1654
-        $event_id = is_object($this->_cpt_model_obj) ? $this->_cpt_model_obj->ID() : null;
1655
-        do_action('AHEE_log', __FILE__, __FUNCTION__, '');
1656
-        /**
1657
-         * 1. Start with retrieving Datetimes
1658
-         * 2. Fore each datetime get related tickets
1659
-         * 3. For each ticket get related prices
1660
-         */
1661
-        $times = EE_Registry::instance()->load_model('Datetime')->get_all_event_dates($event_id);
1662
-        /** @type EE_Datetime $first_datetime */
1663
-        $first_datetime = reset($times);
1664
-        // do we get related tickets?
1665
-        if ($first_datetime instanceof EE_Datetime
1666
-            && $first_datetime->ID() !== 0
1667
-        ) {
1668
-            $existing_datetime_ids[] = $first_datetime->get('DTT_ID');
1669
-            $template_args['time'] = $first_datetime;
1670
-            $related_tickets = $first_datetime->tickets(
1671
-                [
1672
-                    ['OR' => ['TKT_deleted' => 1, 'TKT_deleted*' => 0]],
1673
-                    'default_where_conditions' => 'none',
1674
-                ]
1675
-            );
1676
-            if (! empty($related_tickets)) {
1677
-                $template_args['total_ticket_rows'] = count($related_tickets);
1678
-                $row = 0;
1679
-                foreach ($related_tickets as $ticket) {
1680
-                    $existing_ticket_ids[] = $ticket->get('TKT_ID');
1681
-                    $template_args['ticket_rows'] .= $this->_get_ticket_row($ticket, false, $row);
1682
-                    $row++;
1683
-                }
1684
-            } else {
1685
-                $template_args['total_ticket_rows'] = 1;
1686
-                /** @type EE_Ticket $ticket */
1687
-                $ticket = EE_Registry::instance()->load_model('Ticket')->create_default_object();
1688
-                $template_args['ticket_rows'] .= $this->_get_ticket_row($ticket);
1689
-            }
1690
-        } else {
1691
-            $template_args['time'] = $times[0];
1692
-            /** @type EE_Ticket $ticket */
1693
-            $ticket = EE_Registry::instance()->load_model('Ticket')->get_all_default_tickets();
1694
-            $template_args['ticket_rows'] .= $this->_get_ticket_row($ticket[1]);
1695
-            // NOTE: we're just sending the first default row
1696
-            // (decaf can't manage default tickets so this should be sufficient);
1697
-        }
1698
-        $template_args['event_datetime_help_link'] = $this->_get_help_tab_link(
1699
-            'event_editor_event_datetimes_help_tab'
1700
-        );
1701
-        $template_args['ticket_options_help_link'] = $this->_get_help_tab_link('ticket_options_info');
1702
-        $template_args['existing_datetime_ids'] = implode(',', $existing_datetime_ids);
1703
-        $template_args['existing_ticket_ids'] = implode(',', $existing_ticket_ids);
1704
-        $template_args['ticket_js_structure'] = $this->_get_ticket_row(
1705
-            EE_Registry::instance()->load_model('Ticket')->create_default_object(),
1706
-            true
1707
-        );
1708
-        $template = apply_filters(
1709
-            'FHEE__Events_Admin_Page__ticket_metabox__template',
1710
-            EVENTS_TEMPLATE_PATH . 'event_tickets_metabox_main.template.php'
1711
-        );
1712
-        EEH_Template::display_template($template, $template_args);
1713
-    }
1714
-
1715
-
1716
-    /**
1717
-     * Setup an individual ticket form for the decaf event editor page
1718
-     *
1719
-     * @access private
1720
-     * @param EE_Ticket $ticket   the ticket object
1721
-     * @param boolean   $skeleton whether we're generating a skeleton for js manipulation
1722
-     * @param int       $row
1723
-     * @return string generated html for the ticket row.
1724
-     * @throws DomainException
1725
-     * @throws EE_Error
1726
-     * @throws InvalidArgumentException
1727
-     * @throws InvalidDataTypeException
1728
-     * @throws InvalidInterfaceException
1729
-     * @throws ReflectionException
1730
-     */
1731
-    private function _get_ticket_row($ticket, $skeleton = false, $row = 0)
1732
-    {
1733
-        $template_args = [
1734
-            'tkt_status_class'    => ' tkt-status-' . $ticket->ticket_status(),
1735
-            'tkt_archive_class'   => $ticket->ticket_status() === EE_Ticket::archived && ! $skeleton ? ' tkt-archived'
1736
-                : '',
1737
-            'ticketrow'           => $skeleton ? 'TICKETNUM' : $row,
1738
-            'TKT_ID'              => $ticket->get('TKT_ID'),
1739
-            'TKT_name'            => $ticket->get('TKT_name'),
1740
-            'TKT_start_date'      => $skeleton ? '' : $ticket->get_date('TKT_start_date', 'Y-m-d h:i a'),
1741
-            'TKT_end_date'        => $skeleton ? '' : $ticket->get_date('TKT_end_date', 'Y-m-d h:i a'),
1742
-            'TKT_is_default'      => $ticket->get('TKT_is_default'),
1743
-            'TKT_qty'             => $ticket->get_pretty('TKT_qty', 'input'),
1744
-            'edit_ticketrow_name' => $skeleton ? 'TICKETNAMEATTR' : 'edit_tickets',
1745
-            'TKT_sold'            => $skeleton ? 0 : $ticket->get('TKT_sold'),
1746
-            'trash_icon'          => ($skeleton || (! empty($ticket) && ! $ticket->get('TKT_deleted')))
1747
-                                     && (! empty($ticket) && $ticket->get('TKT_sold') === 0)
1748
-                ? 'trash-icon dashicons dashicons-post-trash clickable' : 'ee-lock-icon',
1749
-            'disabled'            => $skeleton || (! empty($ticket) && ! $ticket->get('TKT_deleted')) ? ''
1750
-                : ' disabled=disabled',
1751
-        ];
1752
-        $price = $ticket->ID() !== 0
1753
-            ? $ticket->get_first_related('Price', ['default_where_conditions' => 'none'])
1754
-            : EE_Registry::instance()->load_model('Price')->create_default_object();
1755
-        $price_args = [
1756
-            'price_currency_symbol' => EE_Registry::instance()->CFG->currency->sign,
1757
-            'PRC_amount'            => $price->get('PRC_amount'),
1758
-            'PRT_ID'                => $price->get('PRT_ID'),
1759
-            'PRC_ID'                => $price->get('PRC_ID'),
1760
-            'PRC_is_default'        => $price->get('PRC_is_default'),
1761
-        ];
1762
-        // make sure we have default start and end dates if skeleton
1763
-        // handle rows that should NOT be empty
1764
-        if (empty($template_args['TKT_start_date'])) {
1765
-            // if empty then the start date will be now.
1766
-            $template_args['TKT_start_date'] = date('Y-m-d h:i a', current_time('timestamp'));
1767
-        }
1768
-        if (empty($template_args['TKT_end_date'])) {
1769
-            // get the earliest datetime (if present);
1770
-            $earliest_dtt = $this->_cpt_model_obj->ID() > 0
1771
-                ? $this->_cpt_model_obj->get_first_related(
1772
-                    'Datetime',
1773
-                    ['order_by' => ['DTT_EVT_start' => 'ASC']]
1774
-                )
1775
-                : null;
1776
-            if (! empty($earliest_dtt)) {
1777
-                $template_args['TKT_end_date'] = $earliest_dtt->get_datetime('DTT_EVT_start', 'Y-m-d', 'h:i a');
1778
-            } else {
1779
-                $template_args['TKT_end_date'] = date(
1780
-                    'Y-m-d h:i a',
1781
-                    mktime(0, 0, 0, date('m'), date('d') + 7, date('Y'))
1782
-                );
1783
-            }
1784
-        }
1785
-        $template_args = array_merge($template_args, $price_args);
1786
-        $template = apply_filters(
1787
-            'FHEE__Events_Admin_Page__get_ticket_row__template',
1788
-            EVENTS_TEMPLATE_PATH . 'event_tickets_metabox_ticket_row.template.php',
1789
-            $ticket
1790
-        );
1791
-        return EEH_Template::display_template($template, $template_args, true);
1792
-    }
1793
-
1794
-
1795
-    /**
1796
-     * @throws DomainException
1797
-     * @throws EE_Error
1798
-     */
1799
-    public function registration_options_meta_box()
1800
-    {
1801
-        $yes_no_values = [
1802
-            ['id' => true, 'text' => esc_html__('Yes', 'event_espresso')],
1803
-            ['id' => false, 'text' => esc_html__('No', 'event_espresso')],
1804
-        ];
1805
-        $default_reg_status_values = EEM_Registration::reg_status_array(
1806
-            [
1807
-                EEM_Registration::status_id_cancelled,
1808
-                EEM_Registration::status_id_declined,
1809
-                EEM_Registration::status_id_incomplete,
1810
-            ],
1811
-            true
1812
-        );
1813
-        // $template_args['is_active_select'] = EEH_Form_Fields::select_input('is_active', $yes_no_values, $this->_cpt_model_obj->is_active());
1814
-        $template_args['_event'] = $this->_cpt_model_obj;
1815
-        $template_args['active_status'] = $this->_cpt_model_obj->pretty_active_status(false);
1816
-        $template_args['additional_limit'] = $this->_cpt_model_obj->additional_limit();
1817
-        $template_args['default_registration_status'] = EEH_Form_Fields::select_input(
1818
-            'default_reg_status',
1819
-            $default_reg_status_values,
1820
-            $this->_cpt_model_obj->default_registration_status()
1821
-        );
1822
-        $template_args['display_description'] = EEH_Form_Fields::select_input(
1823
-            'display_desc',
1824
-            $yes_no_values,
1825
-            $this->_cpt_model_obj->display_description()
1826
-        );
1827
-        $template_args['display_ticket_selector'] = EEH_Form_Fields::select_input(
1828
-            'display_ticket_selector',
1829
-            $yes_no_values,
1830
-            $this->_cpt_model_obj->display_ticket_selector(),
1831
-            '',
1832
-            '',
1833
-            false
1834
-        );
1835
-        $template_args['additional_registration_options'] = apply_filters(
1836
-            'FHEE__Events_Admin_Page__registration_options_meta_box__additional_registration_options',
1837
-            '',
1838
-            $template_args,
1839
-            $yes_no_values,
1840
-            $default_reg_status_values
1841
-        );
1842
-        EEH_Template::display_template(
1843
-            EVENTS_TEMPLATE_PATH . 'event_registration_options.template.php',
1844
-            $template_args
1845
-        );
1846
-    }
1847
-
1848
-
1849
-    /**
1850
-     * _get_events()
1851
-     * This method simply returns all the events (for the given _view and paging)
1852
-     *
1853
-     * @access public
1854
-     * @param int  $per_page     count of items per page (20 default);
1855
-     * @param int  $current_page what is the current page being viewed.
1856
-     * @param bool $count        if TRUE then we just return a count of ALL events matching the given _view.
1857
-     *                           If FALSE then we return an array of event objects
1858
-     *                           that match the given _view and paging parameters.
1859
-     * @return array an array of event objects.
1860
-     * @throws EE_Error
1861
-     * @throws InvalidArgumentException
1862
-     * @throws InvalidDataTypeException
1863
-     * @throws InvalidInterfaceException
1864
-     * @throws ReflectionException
1865
-     * @throws Exception
1866
-     * @throws Exception
1867
-     * @throws Exception
1868
-     */
1869
-    public function get_events($per_page = 10, $current_page = 1, $count = false)
1870
-    {
1871
-        $EEME = $this->_event_model();
1872
-        $offset = ($current_page - 1) * $per_page;
1873
-        $limit = $count ? null : $offset . ',' . $per_page;
1874
-        $orderby = isset($this->_req_data['orderby']) ? $this->_req_data['orderby'] : 'EVT_ID';
1875
-        $order = isset($this->_req_data['order']) ? $this->_req_data['order'] : 'DESC';
1876
-        if (isset($this->_req_data['month_range'])) {
1877
-            $pieces = explode(' ', $this->_req_data['month_range'], 3);
1878
-            // simulate the FIRST day of the month, that fixes issues for months like February
1879
-            // where PHP doesn't know what to assume for date.
1880
-            // @see https://events.codebasehq.com/projects/event-espresso/tickets/10437
1881
-            $month_r = ! empty($pieces[0]) ? date('m', EEH_DTT_Helper::first_of_month_timestamp($pieces[0])) : '';
1882
-            $year_r = ! empty($pieces[1]) ? $pieces[1] : '';
1883
-        }
1884
-        $where = [];
1885
-        $status = isset($this->_req_data['status']) ? $this->_req_data['status'] : null;
1886
-        // determine what post_status our condition will have for the query.
1887
-        switch ($status) {
1888
-            case 'month':
1889
-            case 'today':
1890
-            case null:
1891
-            case 'all':
1892
-                break;
1893
-            case 'draft':
1894
-                $where['status'] = ['IN', ['draft', 'auto-draft']];
1895
-                break;
1896
-            default:
1897
-                $where['status'] = $status;
1898
-        }
1899
-        // categories?
1900
-        $category = isset($this->_req_data['EVT_CAT']) && $this->_req_data['EVT_CAT'] > 0
1901
-            ? $this->_req_data['EVT_CAT'] : null;
1902
-        if (! empty($category)) {
1903
-            $where['Term_Taxonomy.taxonomy'] = EEM_CPT_Base::EVENT_CATEGORY_TAXONOMY;
1904
-            $where['Term_Taxonomy.term_id'] = $category;
1905
-        }
1906
-        // date where conditions
1907
-        $start_formats = EEM_Datetime::instance()->get_formats_for('DTT_EVT_start');
1908
-        if (isset($this->_req_data['month_range']) && $this->_req_data['month_range'] !== '') {
1909
-            $DateTime = new DateTime(
1910
-                $year_r . '-' . $month_r . '-01 00:00:00',
1911
-                new DateTimeZone('UTC')
1912
-            );
1913
-            $start = $DateTime->getTimestamp();
1914
-            // set the datetime to be the end of the month
1915
-            $DateTime->setDate(
1916
-                $year_r,
1917
-                $month_r,
1918
-                $DateTime->format('t')
1919
-            )->setTime(23, 59, 59);
1920
-            $end = $DateTime->getTimestamp();
1921
-            $where['Datetime.DTT_EVT_start'] = ['BETWEEN', [$start, $end]];
1922
-        } elseif (isset($this->_req_data['status']) && $this->_req_data['status'] === 'today') {
1923
-            $DateTime = new DateTime('now', new DateTimeZone(EEM_Event::instance()->get_timezone()));
1924
-            $start = $DateTime->setTime(0, 0, 0)->format(implode(' ', $start_formats));
1925
-            $end = $DateTime->setTime(23, 59, 59)->format(implode(' ', $start_formats));
1926
-            $where['Datetime.DTT_EVT_start'] = ['BETWEEN', [$start, $end]];
1927
-        } elseif (isset($this->_req_data['status']) && $this->_req_data['status'] === 'month') {
1928
-            $now = date('Y-m-01');
1929
-            $DateTime = new DateTime($now, new DateTimeZone(EEM_Event::instance()->get_timezone()));
1930
-            $start = $DateTime->setTime(0, 0, 0)->format(implode(' ', $start_formats));
1931
-            $end = $DateTime->setDate(date('Y'), date('m'), $DateTime->format('t'))
1932
-                            ->setTime(23, 59, 59)
1933
-                            ->format(implode(' ', $start_formats));
1934
-            $where['Datetime.DTT_EVT_start'] = ['BETWEEN', [$start, $end]];
1935
-        }
1936
-        if (! EE_Registry::instance()->CAP->current_user_can('ee_read_others_events', 'get_events')) {
1937
-            $where['EVT_wp_user'] = get_current_user_id();
1938
-        } elseif (! isset($where['status'])
1939
-                  && ! EE_Registry::instance()->CAP->current_user_can('ee_read_private_events', 'get_events')
1940
-        ) {
1941
-            $where['OR'] = [
1942
-                'status*restrict_private' => ['!=', 'private'],
1943
-                'AND'                     => [
1944
-                    'status*inclusive' => ['=', 'private'],
1945
-                    'EVT_wp_user'      => get_current_user_id(),
1946
-                ],
1947
-            ];
1948
-        }
1949
-
1950
-        if (isset($this->_req_data['EVT_wp_user'])
1951
-            && (int) $this->_req_data['EVT_wp_user'] !== (int) get_current_user_id()
1952
-            && EE_Registry::instance()->CAP->current_user_can('ee_read_others_events', 'get_events')
1953
-        ) {
1954
-            $where['EVT_wp_user'] = $this->_req_data['EVT_wp_user'];
1955
-        }
1956
-        // search query handling
1957
-        if (isset($this->_req_data['s'])) {
1958
-            $search_string = '%' . $this->_req_data['s'] . '%';
1959
-            $where['OR'] = [
1960
-                'EVT_name'       => ['LIKE', $search_string],
1961
-                'EVT_desc'       => ['LIKE', $search_string],
1962
-                'EVT_short_desc' => ['LIKE', $search_string],
1963
-            ];
1964
-        }
1965
-        // filter events by venue.
1966
-        if (isset($this->_req_data['venue']) && ! empty($this->_req_data['venue'])) {
1967
-            $where['Venue.VNU_ID'] = absint($this->_req_data['venue']);
1968
-        }
1969
-        $where = apply_filters('FHEE__Events_Admin_Page__get_events__where', $where, $this->_req_data);
1970
-        $query_params = apply_filters(
1971
-            'FHEE__Events_Admin_Page__get_events__query_params',
1972
-            [
1973
-                $where,
1974
-                'limit'    => $limit,
1975
-                'order_by' => $orderby,
1976
-                'order'    => $order,
1977
-                'group_by' => 'EVT_ID',
1978
-            ],
1979
-            $this->_req_data
1980
-        );
1981
-
1982
-        // let's first check if we have special requests coming in.
1983
-        if (isset($this->_req_data['active_status'])) {
1984
-            switch ($this->_req_data['active_status']) {
1985
-                case 'upcoming':
1986
-                    return $EEME->get_upcoming_events($query_params, $count);
1987
-                    break;
1988
-                case 'expired':
1989
-                    return $EEME->get_expired_events($query_params, $count);
1990
-                    break;
1991
-                case 'active':
1992
-                    return $EEME->get_active_events($query_params, $count);
1993
-                    break;
1994
-                case 'inactive':
1995
-                    return $EEME->get_inactive_events($query_params, $count);
1996
-                    break;
1997
-            }
1998
-        }
1999
-
2000
-        $events = $count ? $EEME->count([$where], 'EVT_ID', true) : $EEME->get_all($query_params);
2001
-        return $events;
2002
-    }
2003
-
2004
-
2005
-    /**
2006
-     * handling for WordPress CPT actions (trash, restore, delete)
2007
-     *
2008
-     * @param string $post_id
2009
-     * @throws EE_Error
2010
-     * @throws InvalidArgumentException
2011
-     * @throws InvalidDataTypeException
2012
-     * @throws InvalidInterfaceException
2013
-     * @throws ReflectionException
2014
-     */
2015
-    public function trash_cpt_item($post_id)
2016
-    {
2017
-        $this->_req_data['EVT_ID'] = $post_id;
2018
-        $this->_trash_or_restore_event('trash', false);
2019
-    }
2020
-
2021
-
2022
-    /**
2023
-     * @param string $post_id
2024
-     * @throws EE_Error
2025
-     * @throws InvalidArgumentException
2026
-     * @throws InvalidDataTypeException
2027
-     * @throws InvalidInterfaceException
2028
-     * @throws ReflectionException
2029
-     */
2030
-    public function restore_cpt_item($post_id)
2031
-    {
2032
-        $this->_req_data['EVT_ID'] = $post_id;
2033
-        $this->_trash_or_restore_event('draft', false);
2034
-    }
2035
-
2036
-
2037
-    /**
2038
-     * @param string $post_id
2039
-     * @throws EE_Error
2040
-     * @throws InvalidArgumentException
2041
-     * @throws InvalidDataTypeException
2042
-     * @throws InvalidInterfaceException
2043
-     * @throws ReflectionException
2044
-     */
2045
-    public function delete_cpt_item($post_id)
2046
-    {
2047
-        $this->_req_data['EVT_ID'] = $post_id;
2048
-        $this->_delete_event(false);
2049
-    }
2050
-
2051
-
2052
-    /**
2053
-     * _trash_or_restore_event
2054
-     *
2055
-     * @access protected
2056
-     * @param string $event_status
2057
-     * @param bool   $redirect_after
2058
-     * @throws EE_Error
2059
-     * @throws InvalidArgumentException
2060
-     * @throws InvalidDataTypeException
2061
-     * @throws InvalidInterfaceException
2062
-     * @throws ReflectionException
2063
-     */
2064
-    protected function _trash_or_restore_event($event_status = 'trash', $redirect_after = true)
2065
-    {
2066
-        // determine the event id and set to array.
2067
-        $EVT_ID = isset($this->_req_data['EVT_ID']) ? absint($this->_req_data['EVT_ID']) : false;
2068
-        // loop thru events
2069
-        if ($EVT_ID) {
2070
-            // clean status
2071
-            $event_status = sanitize_key($event_status);
2072
-            // grab status
2073
-            if (! empty($event_status)) {
2074
-                $success = $this->_change_event_status($EVT_ID, $event_status);
2075
-            } else {
2076
-                $success = false;
2077
-                $msg = esc_html__(
2078
-                    'An error occurred. The event could not be moved to the trash because a valid event status was not not supplied.',
2079
-                    'event_espresso'
2080
-                );
2081
-                EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__);
2082
-            }
2083
-        } else {
2084
-            $success = false;
2085
-            $msg = esc_html__(
2086
-                'An error occurred. The event could not be moved to the trash because a valid event ID was not not supplied.',
2087
-                'event_espresso'
2088
-            );
2089
-            EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__);
2090
-        }
2091
-        $action = $event_status === 'trash' ? 'moved to the trash' : 'restored from the trash';
2092
-        if ($redirect_after) {
2093
-            $this->_redirect_after_action($success, 'Event', $action, ['action' => 'default']);
2094
-        }
2095
-    }
2096
-
2097
-
2098
-    /**
2099
-     * _trash_or_restore_events
2100
-     *
2101
-     * @access protected
2102
-     * @param string $event_status
2103
-     * @return void
2104
-     * @throws EE_Error
2105
-     * @throws InvalidArgumentException
2106
-     * @throws InvalidDataTypeException
2107
-     * @throws InvalidInterfaceException
2108
-     * @throws ReflectionException
2109
-     */
2110
-    protected function _trash_or_restore_events($event_status = 'trash')
2111
-    {
2112
-        // clean status
2113
-        $event_status = sanitize_key($event_status);
2114
-        // grab status
2115
-        if (! empty($event_status)) {
2116
-            $success = true;
2117
-            // determine the event id and set to array.
2118
-            $EVT_IDs = isset($this->_req_data['EVT_IDs']) ? (array) $this->_req_data['EVT_IDs'] : [];
2119
-            // loop thru events
2120
-            foreach ($EVT_IDs as $EVT_ID) {
2121
-                if ($EVT_ID = absint($EVT_ID)) {
2122
-                    $results = $this->_change_event_status($EVT_ID, $event_status);
2123
-                    $success = $results !== false ? $success : false;
2124
-                } else {
2125
-                    $msg = sprintf(
2126
-                        esc_html__(
2127
-                            'An error occurred. Event #%d could not be moved to the trash because a valid event ID was not not supplied.',
2128
-                            'event_espresso'
2129
-                        ),
2130
-                        $EVT_ID
2131
-                    );
2132
-                    EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__);
2133
-                    $success = false;
2134
-                }
2135
-            }
2136
-        } else {
2137
-            $success = false;
2138
-            $msg = esc_html__(
2139
-                'An error occurred. The event could not be moved to the trash because a valid event status was not not supplied.',
2140
-                'event_espresso'
2141
-            );
2142
-            EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__);
2143
-        }
2144
-        // in order to force a pluralized result message we need to send back a success status greater than 1
2145
-        $success = $success ? 2 : false;
2146
-        $action = $event_status === 'trash' ? 'moved to the trash' : 'restored from the trash';
2147
-        $this->_redirect_after_action($success, 'Events', $action, ['action' => 'default']);
2148
-    }
2149
-
2150
-
2151
-    /**
2152
-     * _trash_or_restore_events
2153
-     *
2154
-     * @access  private
2155
-     * @param int    $EVT_ID
2156
-     * @param string $event_status
2157
-     * @return bool
2158
-     * @throws EE_Error
2159
-     * @throws InvalidArgumentException
2160
-     * @throws InvalidDataTypeException
2161
-     * @throws InvalidInterfaceException
2162
-     * @throws ReflectionException
2163
-     */
2164
-    private function _change_event_status($EVT_ID = 0, $event_status = '')
2165
-    {
2166
-        // grab event id
2167
-        if (! $EVT_ID) {
2168
-            $msg = esc_html__(
2169
-                'An error occurred. No Event ID or an invalid Event ID was received.',
2170
-                'event_espresso'
2171
-            );
2172
-            EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__);
2173
-            return false;
2174
-        }
2175
-        $this->_cpt_model_obj = EEM_Event::instance()->get_one_by_ID($EVT_ID);
2176
-        // clean status
2177
-        $event_status = sanitize_key($event_status);
2178
-        // grab status
2179
-        if (empty($event_status)) {
2180
-            $msg = esc_html__(
2181
-                'An error occurred. No Event Status or an invalid Event Status was received.',
2182
-                'event_espresso'
2183
-            );
2184
-            EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__);
2185
-            return false;
2186
-        }
2187
-        // was event trashed or restored ?
2188
-        switch ($event_status) {
2189
-            case 'draft':
2190
-                $action = 'restored from the trash';
2191
-                $hook = 'AHEE_event_restored_from_trash';
2192
-                break;
2193
-            case 'trash':
2194
-                $action = 'moved to the trash';
2195
-                $hook = 'AHEE_event_moved_to_trash';
2196
-                break;
2197
-            default:
2198
-                $action = 'updated';
2199
-                $hook = false;
2200
-        }
2201
-        // use class to change status
2202
-        $this->_cpt_model_obj->set_status($event_status);
2203
-        $success = $this->_cpt_model_obj->save();
2204
-        if ($success === false) {
2205
-            $msg = sprintf(esc_html__('An error occurred. The event could not be %s.', 'event_espresso'), $action);
2206
-            EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__);
2207
-            return false;
2208
-        }
2209
-        if ($hook) {
2210
-            do_action($hook);
2211
-        }
2212
-        return true;
2213
-    }
2214
-
2215
-
2216
-    /**
2217
-     * _delete_event
2218
-     *
2219
-     * @access protected
2220
-     * @param bool $redirect_after
2221
-     * @throws EE_Error
2222
-     * @throws InvalidArgumentException
2223
-     * @throws InvalidDataTypeException
2224
-     * @throws InvalidInterfaceException
2225
-     * @throws ReflectionException
2226
-     */
2227
-    protected function _delete_event($redirect_after = true)
2228
-    {
2229
-        // determine the event id and set to array.
2230
-        $EVT_ID = isset($this->_req_data['EVT_ID']) ? absint($this->_req_data['EVT_ID']) : null;
2231
-        $EVT_ID = isset($this->_req_data['post']) ? absint($this->_req_data['post']) : $EVT_ID;
2232
-        // loop thru events
2233
-        if ($EVT_ID) {
2234
-            $success = $this->_permanently_delete_event($EVT_ID);
2235
-            // get list of events with no prices
2236
-            $espresso_no_ticket_prices = get_option('ee_no_ticket_prices', []);
2237
-            // remove this event from the list of events with no prices
2238
-            if (isset($espresso_no_ticket_prices[ $EVT_ID ])) {
2239
-                unset($espresso_no_ticket_prices[ $EVT_ID ]);
2240
-            }
2241
-            update_option('ee_no_ticket_prices', $espresso_no_ticket_prices);
2242
-        } else {
2243
-            $success = false;
2244
-            $msg = esc_html__(
2245
-                'An error occurred. An event could not be deleted because a valid event ID was not not supplied.',
2246
-                'event_espresso'
2247
-            );
2248
-            EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__);
2249
-        }
2250
-        if ($redirect_after) {
2251
-            $this->_redirect_after_action(
2252
-                $success,
2253
-                'Event',
2254
-                'deleted',
2255
-                ['action' => 'default', 'status' => 'trash']
2256
-            );
2257
-        }
2258
-    }
2259
-
2260
-
2261
-    /**
2262
-     * _delete_events
2263
-     *
2264
-     * @access protected
2265
-     * @return void
2266
-     * @throws EE_Error
2267
-     * @throws InvalidArgumentException
2268
-     * @throws InvalidDataTypeException
2269
-     * @throws InvalidInterfaceException
2270
-     * @throws ReflectionException
2271
-     */
2272
-    protected function _delete_events()
2273
-    {
2274
-        $success = true;
2275
-        // get list of events with no prices
2276
-        $espresso_no_ticket_prices = get_option('ee_no_ticket_prices', []);
2277
-        // determine the event id and set to array.
2278
-        $EVT_IDs = isset($this->_req_data['EVT_IDs']) ? (array) $this->_req_data['EVT_IDs'] : [];
2279
-        // loop thru events
2280
-        foreach ($EVT_IDs as $EVT_ID) {
2281
-            $EVT_ID = absint($EVT_ID);
2282
-            if ($EVT_ID) {
2283
-                $results = $this->_permanently_delete_event($EVT_ID);
2284
-                $success = $results !== false ? $success : false;
2285
-                // remove this event from the list of events with no prices
2286
-                unset($espresso_no_ticket_prices[ $EVT_ID ]);
2287
-            } else {
2288
-                $success = false;
2289
-                $msg = esc_html__(
2290
-                    'An error occurred. An event could not be deleted because a valid event ID was not not supplied.',
2291
-                    'event_espresso'
2292
-                );
2293
-                EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__);
2294
-            }
2295
-        }
2296
-        update_option('ee_no_ticket_prices', $espresso_no_ticket_prices);
2297
-        // in order to force a pluralized result message we need to send back a success status greater than 1
2298
-        $success = $success ? 2 : false;
2299
-        $this->_redirect_after_action($success, 'Events', 'deleted', ['action' => 'default']);
2300
-    }
2301
-
2302
-
2303
-    /**
2304
-     * _permanently_delete_event
2305
-     *
2306
-     * @access  private
2307
-     * @param int $EVT_ID
2308
-     * @return bool
2309
-     * @throws EE_Error
2310
-     * @throws InvalidArgumentException
2311
-     * @throws InvalidDataTypeException
2312
-     * @throws InvalidInterfaceException
2313
-     * @throws ReflectionException
2314
-     */
2315
-    private function _permanently_delete_event($EVT_ID = 0)
2316
-    {
2317
-        // grab event id
2318
-        if (! $EVT_ID) {
2319
-            $msg = esc_html__(
2320
-                'An error occurred. No Event ID or an invalid Event ID was received.',
2321
-                'event_espresso'
2322
-            );
2323
-            EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__);
2324
-            return false;
2325
-        }
2326
-        if (! $this->_cpt_model_obj instanceof EE_Event
2327
-            || $this->_cpt_model_obj->ID() !== $EVT_ID
2328
-        ) {
2329
-            $this->_cpt_model_obj = EEM_Event::instance()->get_one_by_ID($EVT_ID);
2330
-        }
2331
-        if (! $this->_cpt_model_obj instanceof EE_Event) {
2332
-            return false;
2333
-        }
2334
-        // need to delete related tickets and prices first.
2335
-        $datetimes = $this->_cpt_model_obj->get_many_related('Datetime');
2336
-        foreach ($datetimes as $datetime) {
2337
-            $this->_cpt_model_obj->_remove_relation_to($datetime, 'Datetime');
2338
-            $tickets = $datetime->get_many_related('Ticket');
2339
-            foreach ($tickets as $ticket) {
2340
-                $ticket->_remove_relation_to($datetime, 'Datetime');
2341
-                $ticket->delete_related_permanently('Price');
2342
-                $ticket->delete_permanently();
2343
-            }
2344
-            $datetime->delete();
2345
-        }
2346
-        // what about related venues or terms?
2347
-        $venues = $this->_cpt_model_obj->get_many_related('Venue');
2348
-        foreach ($venues as $venue) {
2349
-            $this->_cpt_model_obj->_remove_relation_to($venue, 'Venue');
2350
-        }
2351
-        // any attached question groups?
2352
-        $question_groups = $this->_cpt_model_obj->get_many_related('Question_Group');
2353
-        if (! empty($question_groups)) {
2354
-            foreach ($question_groups as $question_group) {
2355
-                $this->_cpt_model_obj->_remove_relation_to($question_group, 'Question_Group');
2356
-            }
2357
-        }
2358
-        // Message Template Groups
2359
-        $this->_cpt_model_obj->_remove_relations('Message_Template_Group');
2360
-        /** @type EE_Term_Taxonomy[] $term_taxonomies */
2361
-        $term_taxonomies = $this->_cpt_model_obj->term_taxonomies();
2362
-        foreach ($term_taxonomies as $term_taxonomy) {
2363
-            $this->_cpt_model_obj->remove_relation_to_term_taxonomy($term_taxonomy);
2364
-        }
2365
-        $success = $this->_cpt_model_obj->delete_permanently();
2366
-        // did it all go as planned ?
2367
-        if ($success) {
2368
-            $msg = sprintf(esc_html__('Event ID # %d has been deleted.', 'event_espresso'), $EVT_ID);
2369
-            EE_Error::add_success($msg);
2370
-        } else {
2371
-            $msg = sprintf(
2372
-                esc_html__('An error occurred. Event ID # %d could not be deleted.', 'event_espresso'),
2373
-                $EVT_ID
2374
-            );
2375
-            EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__);
2376
-            return false;
2377
-        }
2378
-        do_action('AHEE__Events_Admin_Page___permanently_delete_event__after_event_deleted', $EVT_ID);
2379
-        return true;
2380
-    }
2381
-
2382
-
2383
-    /**
2384
-     * get total number of events
2385
-     *
2386
-     * @access public
2387
-     * @return int
2388
-     * @throws EE_Error
2389
-     * @throws InvalidArgumentException
2390
-     * @throws InvalidDataTypeException
2391
-     * @throws InvalidInterfaceException
2392
-     */
2393
-    public function total_events()
2394
-    {
2395
-        $count = EEM_Event::instance()->count(['caps' => 'read_admin'], 'EVT_ID', true);
2396
-        return $count;
2397
-    }
2398
-
2399
-
2400
-    /**
2401
-     * get total number of draft events
2402
-     *
2403
-     * @access public
2404
-     * @return int
2405
-     * @throws EE_Error
2406
-     * @throws InvalidArgumentException
2407
-     * @throws InvalidDataTypeException
2408
-     * @throws InvalidInterfaceException
2409
-     */
2410
-    public function total_events_draft()
2411
-    {
2412
-        $where = [
2413
-            'status' => ['IN', ['draft', 'auto-draft']],
2414
-        ];
2415
-        $count = EEM_Event::instance()->count([$where, 'caps' => 'read_admin'], 'EVT_ID', true);
2416
-        return $count;
2417
-    }
2418
-
2419
-
2420
-    /**
2421
-     * get total number of trashed events
2422
-     *
2423
-     * @access public
2424
-     * @return int
2425
-     * @throws EE_Error
2426
-     * @throws InvalidArgumentException
2427
-     * @throws InvalidDataTypeException
2428
-     * @throws InvalidInterfaceException
2429
-     */
2430
-    public function total_trashed_events()
2431
-    {
2432
-        $where = [
2433
-            'status' => 'trash',
2434
-        ];
2435
-        $count = EEM_Event::instance()->count([$where, 'caps' => 'read_admin'], 'EVT_ID', true);
2436
-        return $count;
2437
-    }
2438
-
2439
-
2440
-    /**
2441
-     *    _default_event_settings
2442
-     *    This generates the Default Settings Tab
2443
-     *
2444
-     * @return void
2445
-     * @throws DomainException
2446
-     * @throws EE_Error
2447
-     * @throws InvalidArgumentException
2448
-     * @throws InvalidDataTypeException
2449
-     * @throws InvalidInterfaceException
2450
-     */
2451
-    protected function _default_event_settings()
2452
-    {
2453
-        $this->_set_add_edit_form_tags('update_default_event_settings');
2454
-        $this->_set_publish_post_box_vars(null, false, false, null, false);
2455
-        $this->_template_args['admin_page_content'] = $this->_default_event_settings_form()->get_html();
2456
-        $this->display_admin_page_with_sidebar();
2457
-    }
2458
-
2459
-
2460
-    /**
2461
-     * Return the form for event settings.
2462
-     *
2463
-     * @return EE_Form_Section_Proper
2464
-     * @throws EE_Error
2465
-     */
2466
-    protected function _default_event_settings_form()
2467
-    {
2468
-        $registration_config = EE_Registry::instance()->CFG->registration;
2469
-        $registration_stati_for_selection = EEM_Registration::reg_status_array(
2470
-        // exclude
2471
-            [
2472
-                EEM_Registration::status_id_cancelled,
2473
-                EEM_Registration::status_id_declined,
2474
-                EEM_Registration::status_id_incomplete,
2475
-                EEM_Registration::status_id_wait_list,
2476
-            ],
2477
-            true
2478
-        );
2479
-        return new EE_Form_Section_Proper(
2480
-            [
2481
-                'name'            => 'update_default_event_settings',
2482
-                'html_id'         => 'update_default_event_settings',
2483
-                'html_class'      => 'form-table',
2484
-                'layout_strategy' => new EE_Admin_Two_Column_Layout(),
2485
-                'subsections'     => apply_filters(
2486
-                    'FHEE__Events_Admin_Page___default_event_settings_form__form_subsections',
2487
-                    [
2488
-                        'default_reg_status'  => new EE_Select_Input(
2489
-                            $registration_stati_for_selection,
2490
-                            [
2491
-                                'default'         => isset($registration_config->default_STS_ID)
2492
-                                                     && array_key_exists(
2493
-                                                         $registration_config->default_STS_ID,
2494
-                                                         $registration_stati_for_selection
2495
-                                                     )
2496
-                                    ? sanitize_text_field($registration_config->default_STS_ID)
2497
-                                    : EEM_Registration::status_id_pending_payment,
2498
-                                'html_label_text' => esc_html__('Default Registration Status', 'event_espresso')
2499
-                                                     . EEH_Template::get_help_tab_link(
2500
-                                                         'default_settings_status_help_tab'
2501
-                                                     ),
2502
-                                'html_help_text'  => esc_html__(
2503
-                                    'This setting allows you to preselect what the default registration status setting is when creating an event.  Note that changing this setting does NOT retroactively apply it to existing events.',
2504
-                                    'event_espresso'
2505
-                                ),
2506
-                            ]
2507
-                        ),
2508
-                        'default_max_tickets' => new EE_Integer_Input(
2509
-                            [
2510
-                                'default'         => isset($registration_config->default_maximum_number_of_tickets)
2511
-                                    ? $registration_config->default_maximum_number_of_tickets
2512
-                                    : EEM_Event::get_default_additional_limit(),
2513
-                                'html_label_text' => esc_html__(
2514
-                                    'Default Maximum Tickets Allowed Per Order:',
2515
-                                    'event_espresso'
2516
-                                )
2517
-                                                     . EEH_Template::get_help_tab_link(
2518
-                                                         'default_maximum_tickets_help_tab"'
2519
-                                                     ),
2520
-                                'html_help_text'  => esc_html__(
2521
-                                    'This setting allows you to indicate what will be the default for the maximum number of tickets per order when creating new events.',
2522
-                                    'event_espresso'
2523
-                                ),
2524
-                            ]
2525
-                        ),
2526
-                    ]
2527
-                ),
2528
-            ]
2529
-        );
2530
-    }
2531
-
2532
-
2533
-    /**
2534
-     * @return void
2535
-     * @throws EE_Error
2536
-     * @throws InvalidArgumentException
2537
-     * @throws InvalidDataTypeException
2538
-     * @throws InvalidInterfaceException
2539
-     */
2540
-    protected function _update_default_event_settings()
2541
-    {
2542
-        $form = $this->_default_event_settings_form();
2543
-        if ($form->was_submitted()) {
2544
-            $form->receive_form_submission();
2545
-            if ($form->is_valid()) {
2546
-                $registration_config = EE_Registry::instance()->CFG->registration;
2547
-                $valid_data = $form->valid_data();
2548
-                if (isset($valid_data['default_reg_status'])) {
2549
-                    $registration_config->default_STS_ID = $valid_data['default_reg_status'];
2550
-                }
2551
-                if (isset($valid_data['default_max_tickets'])) {
2552
-                    $registration_config->default_maximum_number_of_tickets = $valid_data['default_max_tickets'];
2553
-                }
2554
-                do_action(
2555
-                    'AHEE__Events_Admin_Page___update_default_event_settings',
2556
-                    $valid_data,
2557
-                    EE_Registry::instance()->CFG,
2558
-                    $this
2559
-                );
2560
-                // update because data was valid!
2561
-                EE_Registry::instance()->CFG->update_espresso_config();
2562
-                EE_Error::overwrite_success();
2563
-                EE_Error::add_success(
2564
-                    __('Default Event Settings were updated', 'event_espresso')
2565
-                );
2566
-            }
2567
-        }
2568
-        $this->_redirect_after_action(0, '', '', ['action' => 'default_event_settings'], true);
2569
-    }
2570
-
2571
-
2572
-    /*************        Templates        *************/
2573
-    protected function _template_settings()
2574
-    {
2575
-        $this->_admin_page_title = esc_html__('Template Settings (Preview)', 'event_espresso');
2576
-        $this->_template_args['preview_img'] = '<img src="'
2577
-                                               . EVENTS_ASSETS_URL
2578
-                                               . '/images/'
2579
-                                               . 'caffeinated_template_features.jpg" alt="'
2580
-                                               . esc_attr__('Template Settings Preview screenshot', 'event_espresso')
2581
-                                               . '" />';
2582
-        $this->_template_args['preview_text'] = '<strong>'
2583
-                                                . esc_html__(
2584
-                                                    'Template Settings is a feature that is only available in the premium version of Event Espresso 4 which is available with a support license purchase on EventEspresso.com. Template Settings allow you to configure some of the appearance options for both the Event List and Event Details pages.',
2585
-                                                    'event_espresso'
2586
-                                                ) . '</strong>';
2587
-        $this->display_admin_caf_preview_page('template_settings_tab');
2588
-    }
2589
-
2590
-
2591
-    /** Event Category Stuff **/
2592
-    /**
2593
-     * set the _category property with the category object for the loaded page.
2594
-     *
2595
-     * @access private
2596
-     * @return void
2597
-     */
2598
-    private function _set_category_object()
2599
-    {
2600
-        if (isset($this->_category->id) && ! empty($this->_category->id)) {
2601
-            return;
2602
-        } //already have the category object so get out.
2603
-        // set default category object
2604
-        $this->_set_empty_category_object();
2605
-        // only set if we've got an id
2606
-        if (! isset($this->_req_data['EVT_CAT_ID'])) {
2607
-            return;
2608
-        }
2609
-        $category_id = absint($this->_req_data['EVT_CAT_ID']);
2610
-        $term = get_term($category_id, EEM_CPT_Base::EVENT_CATEGORY_TAXONOMY);
2611
-        if (! empty($term)) {
2612
-            $this->_category->category_name = $term->name;
2613
-            $this->_category->category_identifier = $term->slug;
2614
-            $this->_category->category_desc = $term->description;
2615
-            $this->_category->id = $term->term_id;
2616
-            $this->_category->parent = $term->parent;
2617
-        }
2618
-    }
2619
-
2620
-
2621
-    /**
2622
-     * Clears out category properties.
2623
-     */
2624
-    private function _set_empty_category_object()
2625
-    {
2626
-        $this->_category = new stdClass();
2627
-        $this->_category->category_name = $this->_category->category_identifier = $this->_category->category_desc = '';
2628
-        $this->_category->id = $this->_category->parent = 0;
2629
-    }
2630
-
2631
-
2632
-    /**
2633
-     * @throws DomainException
2634
-     * @throws EE_Error
2635
-     * @throws InvalidArgumentException
2636
-     * @throws InvalidDataTypeException
2637
-     * @throws InvalidInterfaceException
2638
-     */
2639
-    protected function _category_list_table()
2640
-    {
2641
-        do_action('AHEE_log', __FILE__, __FUNCTION__, '');
2642
-        $this->_search_btn_label = esc_html__('Categories', 'event_espresso');
2643
-        $this->_admin_page_title .= ' ' . $this->get_action_link_or_button(
2644
-            'add_category',
2645
-            'add_category',
2646
-            [],
2647
-            'add-new-h2'
2648
-        );
2649
-        $this->display_admin_list_table_page_with_sidebar();
2650
-    }
2651
-
2652
-
2653
-    /**
2654
-     * Output category details view.
2655
-     *
2656
-     * @param string $view
2657
-     * @throws DomainException
2658
-     * @throws EE_Error
2659
-     * @throws InvalidArgumentException
2660
-     * @throws InvalidDataTypeException
2661
-     * @throws InvalidInterfaceException
2662
-     */
2663
-    protected function _category_details($view)
2664
-    {
2665
-        // load formatter helper
2666
-        // load field generator helper
2667
-        $route = $view === 'edit' ? 'update_category' : 'insert_category';
2668
-        $this->_set_add_edit_form_tags($route);
2669
-        $this->_set_category_object();
2670
-        $id = ! empty($this->_category->id) ? $this->_category->id : '';
2671
-        $delete_action = 'delete_category';
2672
-        // custom redirect
2673
-        $redirect = EE_Admin_Page::add_query_args_and_nonce(
2674
-            ['action' => 'category_list'],
2675
-            $this->_admin_base_url
2676
-        );
2677
-        $this->_set_publish_post_box_vars('EVT_CAT_ID', $id, $delete_action, $redirect);
2678
-        // take care of contents
2679
-        $this->_template_args['admin_page_content'] = $this->_category_details_content();
2680
-        $this->display_admin_page_with_sidebar();
2681
-    }
2682
-
2683
-
2684
-    /**
2685
-     * Output category details content.
2686
-     *
2687
-     * @throws DomainException
2688
-     */
2689
-    protected function _category_details_content()
2690
-    {
2691
-        $editor_args['category_desc'] = [
2692
-            'type'          => 'wp_editor',
2693
-            'value'         => EEH_Formatter::admin_format_content($this->_category->category_desc),
2694
-            'class'         => 'my_editor_custom',
2695
-            'wpeditor_args' => ['media_buttons' => false],
2696
-        ];
2697
-        $_wp_editor = $this->_generate_admin_form_fields($editor_args, 'array');
2698
-        $all_terms = get_terms(
2699
-            [EEM_CPT_Base::EVENT_CATEGORY_TAXONOMY],
2700
-            ['hide_empty' => 0, 'exclude' => [$this->_category->id]]
2701
-        );
2702
-        // setup category select for term parents.
2703
-        $category_select_values[] = [
2704
-            'text' => esc_html__('No Parent', 'event_espresso'),
2705
-            'id'   => 0,
2706
-        ];
2707
-        foreach ($all_terms as $term) {
2708
-            $category_select_values[] = [
2709
-                'text' => $term->name,
2710
-                'id'   => $term->term_id,
2711
-            ];
2712
-        }
2713
-        $category_select = EEH_Form_Fields::select_input(
2714
-            'category_parent',
2715
-            $category_select_values,
2716
-            $this->_category->parent
2717
-        );
2718
-        $template_args = [
2719
-            'category'                 => $this->_category,
2720
-            'category_select'          => $category_select,
2721
-            'unique_id_info_help_link' => $this->_get_help_tab_link('unique_id_info'),
2722
-            'category_desc_editor'     => $_wp_editor['category_desc']['field'],
2723
-            'disable'                  => '',
2724
-            'disabled_message'         => false,
2725
-        ];
2726
-        $template = EVENTS_TEMPLATE_PATH . 'event_category_details.template.php';
2727
-        return EEH_Template::display_template($template, $template_args, true);
2728
-    }
2729
-
2730
-
2731
-    /**
2732
-     * Handles deleting categories.
2733
-     */
2734
-    protected function _delete_categories()
2735
-    {
2736
-        $cat_ids = isset($this->_req_data['EVT_CAT_ID']) ? (array) $this->_req_data['EVT_CAT_ID']
2737
-            : (array) $this->_req_data['category_id'];
2738
-        foreach ($cat_ids as $cat_id) {
2739
-            $this->_delete_category($cat_id);
2740
-        }
2741
-        // doesn't matter what page we're coming from... we're going to the same place after delete.
2742
-        $query_args = [
2743
-            'action' => 'category_list',
2744
-        ];
2745
-        $this->_redirect_after_action(0, '', '', $query_args);
2746
-    }
2747
-
2748
-
2749
-    /**
2750
-     * Handles deleting specific category.
2751
-     *
2752
-     * @param int $cat_id
2753
-     */
2754
-    protected function _delete_category($cat_id)
2755
-    {
2756
-        $cat_id = absint($cat_id);
2757
-        wp_delete_term($cat_id, EEM_CPT_Base::EVENT_CATEGORY_TAXONOMY);
2758
-    }
2759
-
2760
-
2761
-    /**
2762
-     * Handles triggering the update or insertion of a new category.
2763
-     *
2764
-     * @param bool $new_category true means we're triggering the insert of a new category.
2765
-     * @throws EE_Error
2766
-     * @throws InvalidArgumentException
2767
-     * @throws InvalidDataTypeException
2768
-     * @throws InvalidInterfaceException
2769
-     */
2770
-    protected function _insert_or_update_category($new_category)
2771
-    {
2772
-        $cat_id = $new_category ? $this->_insert_category() : $this->_insert_category(true);
2773
-        $success = 0; // we already have a success message so lets not send another.
2774
-        if ($cat_id) {
2775
-            $query_args = [
2776
-                'action'     => 'edit_category',
2777
-                'EVT_CAT_ID' => $cat_id,
2778
-            ];
2779
-        } else {
2780
-            $query_args = ['action' => 'add_category'];
2781
-        }
2782
-        $this->_redirect_after_action($success, '', '', $query_args, true);
2783
-    }
2784
-
2785
-
2786
-    /**
2787
-     * Inserts or updates category
2788
-     *
2789
-     * @param bool $update (true indicates we're updating a category).
2790
-     * @return bool|mixed|string
2791
-     */
2792
-    private function _insert_category($update = false)
2793
-    {
2794
-        $cat_id = $update ? $this->_req_data['EVT_CAT_ID'] : '';
2795
-        $category_name = isset($this->_req_data['category_name']) ? $this->_req_data['category_name'] : '';
2796
-        $category_desc = isset($this->_req_data['category_desc']) ? $this->_req_data['category_desc'] : '';
2797
-        $category_parent = isset($this->_req_data['category_parent']) ? $this->_req_data['category_parent'] : 0;
2798
-        if (empty($category_name)) {
2799
-            $msg = esc_html__('You must add a name for the category.', 'event_espresso');
2800
-            EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__);
2801
-            return false;
2802
-        }
2803
-        $term_args = [
2804
-            'name'        => $category_name,
2805
-            'description' => $category_desc,
2806
-            'parent'      => $category_parent,
2807
-        ];
2808
-        // was the category_identifier input disabled?
2809
-        if (isset($this->_req_data['category_identifier'])) {
2810
-            $term_args['slug'] = $this->_req_data['category_identifier'];
2811
-        }
2812
-        $insert_ids = $update
2813
-            ? wp_update_term($cat_id, EEM_CPT_Base::EVENT_CATEGORY_TAXONOMY, $term_args)
2814
-            : wp_insert_term($category_name, EEM_CPT_Base::EVENT_CATEGORY_TAXONOMY, $term_args);
2815
-        if (! is_array($insert_ids)) {
2816
-            $msg = esc_html__(
2817
-                'An error occurred and the category has not been saved to the database.',
2818
-                'event_espresso'
2819
-            );
2820
-            EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__);
2821
-        } else {
2822
-            $cat_id = $insert_ids['term_id'];
2823
-            $msg = sprintf(esc_html__('The category %s was successfully saved', 'event_espresso'), $category_name);
2824
-            EE_Error::add_success($msg);
2825
-        }
2826
-        return $cat_id;
2827
-    }
2828
-
2829
-
2830
-    /**
2831
-     * Gets categories or count of categories matching the arguments in the request.
2832
-     *
2833
-     * @param int  $per_page
2834
-     * @param int  $current_page
2835
-     * @param bool $count
2836
-     * @return EE_Base_Class[]|EE_Term_Taxonomy[]|int
2837
-     * @throws EE_Error
2838
-     * @throws InvalidArgumentException
2839
-     * @throws InvalidDataTypeException
2840
-     * @throws InvalidInterfaceException
2841
-     */
2842
-    public function get_categories($per_page = 10, $current_page = 1, $count = false)
2843
-    {
2844
-        // testing term stuff
2845
-        $orderby = isset($this->_req_data['orderby']) ? $this->_req_data['orderby'] : 'Term.term_id';
2846
-        $order = isset($this->_req_data['order']) ? $this->_req_data['order'] : 'DESC';
2847
-        $limit = ($current_page - 1) * $per_page;
2848
-        $where = ['taxonomy' => EEM_CPT_Base::EVENT_CATEGORY_TAXONOMY];
2849
-        if (isset($this->_req_data['s'])) {
2850
-            $sstr = '%' . $this->_req_data['s'] . '%';
2851
-            $where['OR'] = [
2852
-                'Term.name'   => ['LIKE', $sstr],
2853
-                'description' => ['LIKE', $sstr],
2854
-            ];
2855
-        }
2856
-        $query_params = [
2857
-            $where,
2858
-            'order_by'   => [$orderby => $order],
2859
-            'limit'      => $limit . ',' . $per_page,
2860
-            'force_join' => ['Term'],
2861
-        ];
2862
-        $categories = $count
2863
-            ? EEM_Term_Taxonomy::instance()->count($query_params, 'term_id')
2864
-            : EEM_Term_Taxonomy::instance()->get_all($query_params);
2865
-        return $categories;
2866
-    }
2867
-
2868
-    /* end category stuff */
2869
-    /**************/
2870
-
2871
-
2872
-    /**
2873
-     * Callback for the `ee_save_timezone_setting` ajax action.
2874
-     *
2875
-     * @throws EE_Error
2876
-     * @throws InvalidArgumentException
2877
-     * @throws InvalidDataTypeException
2878
-     * @throws InvalidInterfaceException
2879
-     */
2880
-    public function save_timezonestring_setting()
2881
-    {
2882
-        $timezone_string = isset($this->_req_data['timezone_selected'])
2883
-            ? $this->_req_data['timezone_selected']
2884
-            : '';
2885
-        if (empty($timezone_string) || ! EEH_DTT_Helper::validate_timezone($timezone_string, false)) {
2886
-            EE_Error::add_error(
2887
-                esc_html__('An invalid timezone string submitted.', 'event_espresso'),
2888
-                __FILE__,
2889
-                __FUNCTION__,
2890
-                __LINE__
2891
-            );
2892
-            $this->_template_args['error'] = true;
2893
-            $this->_return_json();
2894
-        }
2895
-
2896
-        update_option('timezone_string', $timezone_string);
2897
-        EE_Error::add_success(
2898
-            esc_html__('Your timezone string was updated.', 'event_espresso')
2899
-        );
2900
-        $this->_template_args['success'] = true;
2901
-        $this->_return_json(true, ['action' => 'create_new']);
2902
-    }
19
+	/**
20
+	 * This will hold the event object for event_details screen.
21
+	 *
22
+	 * @access protected
23
+	 * @var EE_Event $_event
24
+	 */
25
+	protected $_event;
26
+
27
+
28
+	/**
29
+	 * This will hold the category object for category_details screen.
30
+	 *
31
+	 * @var stdClass $_category
32
+	 */
33
+	protected $_category;
34
+
35
+
36
+	/**
37
+	 * This will hold the event model instance
38
+	 *
39
+	 * @var EEM_Event $_event_model
40
+	 */
41
+	protected $_event_model;
42
+
43
+
44
+	/**
45
+	 * @var EE_Event
46
+	 */
47
+	protected $_cpt_model_obj = false;
48
+
49
+
50
+	/**
51
+	 * Initialize page props for this admin page group.
52
+	 */
53
+	protected function _init_page_props()
54
+	{
55
+		$this->page_slug = EVENTS_PG_SLUG;
56
+		$this->page_label = EVENTS_LABEL;
57
+		$this->_admin_base_url = EVENTS_ADMIN_URL;
58
+		$this->_admin_base_path = EVENTS_ADMIN;
59
+		$this->_cpt_model_names = [
60
+			'create_new' => 'EEM_Event',
61
+			'edit'       => 'EEM_Event',
62
+		];
63
+		$this->_cpt_edit_routes = [
64
+			'espresso_events' => 'edit',
65
+		];
66
+		add_action(
67
+			'AHEE__EE_Admin_Page_CPT__set_model_object__after_set_object',
68
+			[$this, 'verify_event_edit'],
69
+			10,
70
+			2
71
+		);
72
+	}
73
+
74
+
75
+	/**
76
+	 * Sets the ajax hooks used for this admin page group.
77
+	 */
78
+	protected function _ajax_hooks()
79
+	{
80
+		add_action('wp_ajax_ee_save_timezone_setting', [$this, 'save_timezonestring_setting']);
81
+	}
82
+
83
+
84
+	/**
85
+	 * Sets the page properties for this admin page group.
86
+	 */
87
+	protected function _define_page_props()
88
+	{
89
+		$this->_admin_page_title = EVENTS_LABEL;
90
+		$this->_labels = [
91
+			'buttons'      => [
92
+				'add'             => esc_html__('Add New Event', 'event_espresso'),
93
+				'edit'            => esc_html__('Edit Event', 'event_espresso'),
94
+				'delete'          => esc_html__('Delete Event', 'event_espresso'),
95
+				'add_category'    => esc_html__('Add New Category', 'event_espresso'),
96
+				'edit_category'   => esc_html__('Edit Category', 'event_espresso'),
97
+				'delete_category' => esc_html__('Delete Category', 'event_espresso'),
98
+			],
99
+			'editor_title' => [
100
+				'espresso_events' => esc_html__('Enter event title here', 'event_espresso'),
101
+			],
102
+			'publishbox'   => [
103
+				'create_new'        => esc_html__('Save New Event', 'event_espresso'),
104
+				'edit'              => esc_html__('Update Event', 'event_espresso'),
105
+				'add_category'      => esc_html__('Save New Category', 'event_espresso'),
106
+				'edit_category'     => esc_html__('Update Category', 'event_espresso'),
107
+				'template_settings' => esc_html__('Update Settings', 'event_espresso'),
108
+			],
109
+		];
110
+	}
111
+
112
+
113
+	/**
114
+	 * Sets the page routes property for this admin page group.
115
+	 */
116
+	protected function _set_page_routes()
117
+	{
118
+		// load formatter helper
119
+		// load field generator helper
120
+		// is there a evt_id in the request?
121
+		$evt_id = ! empty($this->_req_data['EVT_ID']) && ! is_array($this->_req_data['EVT_ID'])
122
+			? $this->_req_data['EVT_ID']
123
+			: 0;
124
+		$evt_id = ! empty($this->_req_data['post']) ? $this->_req_data['post'] : $evt_id;
125
+		$this->_page_routes = [
126
+			'default'                       => [
127
+				'func'       => '_events_overview_list_table',
128
+				'capability' => 'ee_read_events',
129
+			],
130
+			'create_new'                    => [
131
+				'func'       => '_create_new_cpt_item',
132
+				'capability' => 'ee_edit_events',
133
+			],
134
+			'edit'                          => [
135
+				'func'       => '_edit_cpt_item',
136
+				'capability' => 'ee_edit_event',
137
+				'obj_id'     => $evt_id,
138
+			],
139
+			'copy_event'                    => [
140
+				'func'       => '_copy_events',
141
+				'capability' => 'ee_edit_event',
142
+				'obj_id'     => $evt_id,
143
+				'noheader'   => true,
144
+			],
145
+			'trash_event'                   => [
146
+				'func'       => '_trash_or_restore_event',
147
+				'args'       => ['event_status' => 'trash'],
148
+				'capability' => 'ee_delete_event',
149
+				'obj_id'     => $evt_id,
150
+				'noheader'   => true,
151
+			],
152
+			'trash_events'                  => [
153
+				'func'       => '_trash_or_restore_events',
154
+				'args'       => ['event_status' => 'trash'],
155
+				'capability' => 'ee_delete_events',
156
+				'noheader'   => true,
157
+			],
158
+			'restore_event'                 => [
159
+				'func'       => '_trash_or_restore_event',
160
+				'args'       => ['event_status' => 'draft'],
161
+				'capability' => 'ee_delete_event',
162
+				'obj_id'     => $evt_id,
163
+				'noheader'   => true,
164
+			],
165
+			'restore_events'                => [
166
+				'func'       => '_trash_or_restore_events',
167
+				'args'       => ['event_status' => 'draft'],
168
+				'capability' => 'ee_delete_events',
169
+				'noheader'   => true,
170
+			],
171
+			'delete_event'                  => [
172
+				'func'       => '_delete_event',
173
+				'capability' => 'ee_delete_event',
174
+				'obj_id'     => $evt_id,
175
+				'noheader'   => true,
176
+			],
177
+			'delete_events'                 => [
178
+				'func'       => '_delete_events',
179
+				'capability' => 'ee_delete_events',
180
+				'noheader'   => true,
181
+			],
182
+			'view_report'                   => [
183
+				'func'       => '_view_report',
184
+				'capability' => 'ee_edit_events',
185
+			],
186
+			'default_event_settings'        => [
187
+				'func'       => '_default_event_settings',
188
+				'capability' => 'manage_options',
189
+			],
190
+			'update_default_event_settings' => [
191
+				'func'       => '_update_default_event_settings',
192
+				'capability' => 'manage_options',
193
+				'noheader'   => true,
194
+			],
195
+			'template_settings'             => [
196
+				'func'       => '_template_settings',
197
+				'capability' => 'manage_options',
198
+			],
199
+			// event category tab related
200
+			'add_category'                  => [
201
+				'func'       => '_category_details',
202
+				'capability' => 'ee_edit_event_category',
203
+				'args'       => ['add'],
204
+			],
205
+			'edit_category'                 => [
206
+				'func'       => '_category_details',
207
+				'capability' => 'ee_edit_event_category',
208
+				'args'       => ['edit'],
209
+			],
210
+			'delete_categories'             => [
211
+				'func'       => '_delete_categories',
212
+				'capability' => 'ee_delete_event_category',
213
+				'noheader'   => true,
214
+			],
215
+			'delete_category'               => [
216
+				'func'       => '_delete_categories',
217
+				'capability' => 'ee_delete_event_category',
218
+				'noheader'   => true,
219
+			],
220
+			'insert_category'               => [
221
+				'func'       => '_insert_or_update_category',
222
+				'args'       => ['new_category' => true],
223
+				'capability' => 'ee_edit_event_category',
224
+				'noheader'   => true,
225
+			],
226
+			'update_category'               => [
227
+				'func'       => '_insert_or_update_category',
228
+				'args'       => ['new_category' => false],
229
+				'capability' => 'ee_edit_event_category',
230
+				'noheader'   => true,
231
+			],
232
+			'category_list'                 => [
233
+				'func'       => '_category_list_table',
234
+				'capability' => 'ee_manage_event_categories',
235
+			],
236
+		];
237
+	}
238
+
239
+
240
+	/**
241
+	 * Set the _page_config property for this admin page group.
242
+	 */
243
+	protected function _set_page_config()
244
+	{
245
+		$this->_page_config = [
246
+			'default'                => [
247
+				'nav'           => [
248
+					'label' => esc_html__('Overview', 'event_espresso'),
249
+					'order' => 10,
250
+				],
251
+				'list_table'    => 'Events_Admin_List_Table',
252
+				'help_tabs'     => [
253
+					'events_overview_help_tab'                       => [
254
+						'title'    => esc_html__('Events Overview', 'event_espresso'),
255
+						'filename' => 'events_overview',
256
+					],
257
+					'events_overview_table_column_headings_help_tab' => [
258
+						'title'    => esc_html__('Events Overview Table Column Headings', 'event_espresso'),
259
+						'filename' => 'events_overview_table_column_headings',
260
+					],
261
+					'events_overview_filters_help_tab'               => [
262
+						'title'    => esc_html__('Events Overview Filters', 'event_espresso'),
263
+						'filename' => 'events_overview_filters',
264
+					],
265
+					'events_overview_view_help_tab'                  => [
266
+						'title'    => esc_html__('Events Overview Views', 'event_espresso'),
267
+						'filename' => 'events_overview_views',
268
+					],
269
+					'events_overview_other_help_tab'                 => [
270
+						'title'    => esc_html__('Events Overview Other', 'event_espresso'),
271
+						'filename' => 'events_overview_other',
272
+					],
273
+				],
274
+				'help_tour'     => [
275
+					'Event_Overview_Help_Tour',
276
+					// 'New_Features_Test_Help_Tour' for testing multiple help tour
277
+				],
278
+				'require_nonce' => false,
279
+				'qtips'         => ['EE_Event_List_Table_Tips'],
280
+			],
281
+			'create_new'             => [
282
+				'nav'           => [
283
+					'label'      => esc_html__('Add Event', 'event_espresso'),
284
+					'order'      => 5,
285
+					'persistent' => false,
286
+				],
287
+				'metaboxes'     => ['_register_event_editor_meta_boxes'],
288
+				'help_tabs'     => [
289
+					'event_editor_help_tab'                            => [
290
+						'title'    => esc_html__('Event Editor', 'event_espresso'),
291
+						'filename' => 'event_editor',
292
+					],
293
+					'event_editor_title_richtexteditor_help_tab'       => [
294
+						'title'    => esc_html__('Event Title & Rich Text Editor', 'event_espresso'),
295
+						'filename' => 'event_editor_title_richtexteditor',
296
+					],
297
+					'event_editor_venue_details_help_tab'              => [
298
+						'title'    => esc_html__('Event Venue Details', 'event_espresso'),
299
+						'filename' => 'event_editor_venue_details',
300
+					],
301
+					'event_editor_event_datetimes_help_tab'            => [
302
+						'title'    => esc_html__('Event Datetimes', 'event_espresso'),
303
+						'filename' => 'event_editor_event_datetimes',
304
+					],
305
+					'event_editor_event_tickets_help_tab'              => [
306
+						'title'    => esc_html__('Event Tickets', 'event_espresso'),
307
+						'filename' => 'event_editor_event_tickets',
308
+					],
309
+					'event_editor_event_registration_options_help_tab' => [
310
+						'title'    => esc_html__('Event Registration Options', 'event_espresso'),
311
+						'filename' => 'event_editor_event_registration_options',
312
+					],
313
+					'event_editor_tags_categories_help_tab'            => [
314
+						'title'    => esc_html__('Event Tags & Categories', 'event_espresso'),
315
+						'filename' => 'event_editor_tags_categories',
316
+					],
317
+					'event_editor_questions_registrants_help_tab'      => [
318
+						'title'    => esc_html__('Questions for Registrants', 'event_espresso'),
319
+						'filename' => 'event_editor_questions_registrants',
320
+					],
321
+					'event_editor_save_new_event_help_tab'             => [
322
+						'title'    => esc_html__('Save New Event', 'event_espresso'),
323
+						'filename' => 'event_editor_save_new_event',
324
+					],
325
+					'event_editor_other_help_tab'                      => [
326
+						'title'    => esc_html__('Event Other', 'event_espresso'),
327
+						'filename' => 'event_editor_other',
328
+					],
329
+				],
330
+				'help_tour'     => [
331
+					'Event_Editor_Help_Tour',
332
+				],
333
+				'require_nonce' => false,
334
+			],
335
+			'edit'                   => [
336
+				'nav'           => [
337
+					'label'      => esc_html__('Edit Event', 'event_espresso'),
338
+					'order'      => 5,
339
+					'persistent' => false,
340
+					'url'        => isset($this->_req_data['post'])
341
+						? EE_Admin_Page::add_query_args_and_nonce(
342
+							['post' => $this->_req_data['post'], 'action' => 'edit'],
343
+							$this->_current_page_view_url
344
+						)
345
+						: $this->_admin_base_url,
346
+				],
347
+				'metaboxes'     => ['_register_event_editor_meta_boxes'],
348
+				'help_tabs'     => [
349
+					'event_editor_help_tab'                            => [
350
+						'title'    => esc_html__('Event Editor', 'event_espresso'),
351
+						'filename' => 'event_editor',
352
+					],
353
+					'event_editor_title_richtexteditor_help_tab'       => [
354
+						'title'    => esc_html__('Event Title & Rich Text Editor', 'event_espresso'),
355
+						'filename' => 'event_editor_title_richtexteditor',
356
+					],
357
+					'event_editor_venue_details_help_tab'              => [
358
+						'title'    => esc_html__('Event Venue Details', 'event_espresso'),
359
+						'filename' => 'event_editor_venue_details',
360
+					],
361
+					'event_editor_event_datetimes_help_tab'            => [
362
+						'title'    => esc_html__('Event Datetimes', 'event_espresso'),
363
+						'filename' => 'event_editor_event_datetimes',
364
+					],
365
+					'event_editor_event_tickets_help_tab'              => [
366
+						'title'    => esc_html__('Event Tickets', 'event_espresso'),
367
+						'filename' => 'event_editor_event_tickets',
368
+					],
369
+					'event_editor_event_registration_options_help_tab' => [
370
+						'title'    => esc_html__('Event Registration Options', 'event_espresso'),
371
+						'filename' => 'event_editor_event_registration_options',
372
+					],
373
+					'event_editor_tags_categories_help_tab'            => [
374
+						'title'    => esc_html__('Event Tags & Categories', 'event_espresso'),
375
+						'filename' => 'event_editor_tags_categories',
376
+					],
377
+					'event_editor_questions_registrants_help_tab'      => [
378
+						'title'    => esc_html__('Questions for Registrants', 'event_espresso'),
379
+						'filename' => 'event_editor_questions_registrants',
380
+					],
381
+					'event_editor_save_new_event_help_tab'             => [
382
+						'title'    => esc_html__('Save New Event', 'event_espresso'),
383
+						'filename' => 'event_editor_save_new_event',
384
+					],
385
+					'event_editor_other_help_tab'                      => [
386
+						'title'    => esc_html__('Event Other', 'event_espresso'),
387
+						'filename' => 'event_editor_other',
388
+					],
389
+				],
390
+				'require_nonce' => false,
391
+			],
392
+			'default_event_settings' => [
393
+				'nav'           => [
394
+					'label' => esc_html__('Default Settings', 'event_espresso'),
395
+					'order' => 40,
396
+				],
397
+				'metaboxes'     => array_merge($this->_default_espresso_metaboxes, ['_publish_post_box']),
398
+				'labels'        => [
399
+					'publishbox' => esc_html__('Update Settings', 'event_espresso'),
400
+				],
401
+				'help_tabs'     => [
402
+					'default_settings_help_tab'        => [
403
+						'title'    => esc_html__('Default Event Settings', 'event_espresso'),
404
+						'filename' => 'events_default_settings',
405
+					],
406
+					'default_settings_status_help_tab' => [
407
+						'title'    => esc_html__('Default Registration Status', 'event_espresso'),
408
+						'filename' => 'events_default_settings_status',
409
+					],
410
+					'default_maximum_tickets_help_tab' => [
411
+						'title'    => esc_html__('Default Maximum Tickets Per Order', 'event_espresso'),
412
+						'filename' => 'events_default_settings_max_tickets',
413
+					],
414
+				],
415
+				'help_tour'     => ['Event_Default_Settings_Help_Tour'],
416
+				'require_nonce' => false,
417
+			],
418
+			// template settings
419
+			'template_settings'      => [
420
+				'nav'           => [
421
+					'label' => esc_html__('Templates', 'event_espresso'),
422
+					'order' => 30,
423
+				],
424
+				'metaboxes'     => $this->_default_espresso_metaboxes,
425
+				'help_tabs'     => [
426
+					'general_settings_templates_help_tab' => [
427
+						'title'    => esc_html__('Templates', 'event_espresso'),
428
+						'filename' => 'general_settings_templates',
429
+					],
430
+				],
431
+				'help_tour'     => ['Templates_Help_Tour'],
432
+				'require_nonce' => false,
433
+			],
434
+			// event category stuff
435
+			'add_category'           => [
436
+				'nav'           => [
437
+					'label'      => esc_html__('Add Category', 'event_espresso'),
438
+					'order'      => 15,
439
+					'persistent' => false,
440
+				],
441
+				'help_tabs'     => [
442
+					'add_category_help_tab' => [
443
+						'title'    => esc_html__('Add New Event Category', 'event_espresso'),
444
+						'filename' => 'events_add_category',
445
+					],
446
+				],
447
+				'help_tour'     => ['Event_Add_Category_Help_Tour'],
448
+				'metaboxes'     => ['_publish_post_box'],
449
+				'require_nonce' => false,
450
+			],
451
+			'edit_category'          => [
452
+				'nav'           => [
453
+					'label'      => esc_html__('Edit Category', 'event_espresso'),
454
+					'order'      => 15,
455
+					'persistent' => false,
456
+					'url'        => isset($this->_req_data['EVT_CAT_ID'])
457
+						? add_query_arg(
458
+							['EVT_CAT_ID' => $this->_req_data['EVT_CAT_ID']],
459
+							$this->_current_page_view_url
460
+						)
461
+						: $this->_admin_base_url,
462
+				],
463
+				'help_tabs'     => [
464
+					'edit_category_help_tab' => [
465
+						'title'    => esc_html__('Edit Event Category', 'event_espresso'),
466
+						'filename' => 'events_edit_category',
467
+					],
468
+				],
469
+				/*'help_tour' => array('Event_Edit_Category_Help_Tour'),*/
470
+				'metaboxes'     => ['_publish_post_box'],
471
+				'require_nonce' => false,
472
+			],
473
+			'category_list'          => [
474
+				'nav'           => [
475
+					'label' => esc_html__('Categories', 'event_espresso'),
476
+					'order' => 20,
477
+				],
478
+				'list_table'    => 'Event_Categories_Admin_List_Table',
479
+				'help_tabs'     => [
480
+					'events_categories_help_tab'                       => [
481
+						'title'    => esc_html__('Event Categories', 'event_espresso'),
482
+						'filename' => 'events_categories',
483
+					],
484
+					'events_categories_table_column_headings_help_tab' => [
485
+						'title'    => esc_html__('Event Categories Table Column Headings', 'event_espresso'),
486
+						'filename' => 'events_categories_table_column_headings',
487
+					],
488
+					'events_categories_view_help_tab'                  => [
489
+						'title'    => esc_html__('Event Categories Views', 'event_espresso'),
490
+						'filename' => 'events_categories_views',
491
+					],
492
+					'events_categories_other_help_tab'                 => [
493
+						'title'    => esc_html__('Event Categories Other', 'event_espresso'),
494
+						'filename' => 'events_categories_other',
495
+					],
496
+				],
497
+				'help_tour'     => [
498
+					'Event_Categories_Help_Tour',
499
+				],
500
+				'metaboxes'     => $this->_default_espresso_metaboxes,
501
+				'require_nonce' => false,
502
+			],
503
+		];
504
+		// only load EE_Event_Editor_Decaf_Tips if domain is not caffeinated
505
+		$domain = $this->loader->getShared('EventEspresso\core\domain\Domain');
506
+		if (! $domain->isCaffeinated()) {
507
+			$this->_page_config['create_new']['qtips'] = ['EE_Event_Editor_Decaf_Tips'];
508
+			$this->_page_config['edit']['qtips'] = ['EE_Event_Editor_Decaf_Tips'];
509
+		}
510
+	}
511
+
512
+
513
+	/**
514
+	 * Used to register any global screen options if necessary for every route in this admin page group.
515
+	 */
516
+	protected function _add_screen_options()
517
+	{
518
+	}
519
+
520
+
521
+	/**
522
+	 * Implementing the screen options for the 'default' route.
523
+	 *
524
+	 * @throws InvalidArgumentException
525
+	 * @throws InvalidDataTypeException
526
+	 * @throws InvalidInterfaceException
527
+	 */
528
+	protected function _add_screen_options_default()
529
+	{
530
+		$this->_per_page_screen_option();
531
+	}
532
+
533
+
534
+	/**
535
+	 * Implementing screen options for the category list route.
536
+	 *
537
+	 * @throws InvalidArgumentException
538
+	 * @throws InvalidDataTypeException
539
+	 * @throws InvalidInterfaceException
540
+	 */
541
+	protected function _add_screen_options_category_list()
542
+	{
543
+		$page_title = $this->_admin_page_title;
544
+		$this->_admin_page_title = esc_html__('Categories', 'event_espresso');
545
+		$this->_per_page_screen_option();
546
+		$this->_admin_page_title = $page_title;
547
+	}
548
+
549
+
550
+	/**
551
+	 * Used to register any global feature pointers for the admin page group.
552
+	 */
553
+	protected function _add_feature_pointers()
554
+	{
555
+	}
556
+
557
+
558
+	/**
559
+	 * Registers and enqueues any global scripts and styles for the entire admin page group.
560
+	 */
561
+	public function load_scripts_styles()
562
+	{
563
+		wp_register_style(
564
+			'events-admin-css',
565
+			EVENTS_ASSETS_URL . 'events-admin-page.css',
566
+			[],
567
+			EVENT_ESPRESSO_VERSION
568
+		);
569
+		wp_register_style(
570
+			'ee-cat-admin',
571
+			EVENTS_ASSETS_URL . 'ee-cat-admin.css',
572
+			[],
573
+			EVENT_ESPRESSO_VERSION
574
+		);
575
+		wp_enqueue_style('events-admin-css');
576
+		wp_enqueue_style('ee-cat-admin');
577
+		// scripts
578
+		wp_register_script(
579
+			'event_editor_js',
580
+			EVENTS_ASSETS_URL . 'event_editor.js',
581
+			['ee_admin_js', 'jquery-ui-slider', 'jquery-ui-timepicker-addon'],
582
+			EVENT_ESPRESSO_VERSION,
583
+			true
584
+		);
585
+	}
586
+
587
+
588
+	/**
589
+	 * Enqueuing scripts and styles specific to this view
590
+	 */
591
+	public function load_scripts_styles_create_new()
592
+	{
593
+		$this->load_scripts_styles_edit();
594
+	}
595
+
596
+
597
+	/**
598
+	 * Enqueuing scripts and styles specific to this view
599
+	 */
600
+	public function load_scripts_styles_edit()
601
+	{
602
+		// styles
603
+		wp_enqueue_style('espresso-ui-theme');
604
+		wp_register_style(
605
+			'event-editor-css',
606
+			EVENTS_ASSETS_URL . 'event-editor.css',
607
+			['ee-admin-css'],
608
+			EVENT_ESPRESSO_VERSION
609
+		);
610
+		wp_enqueue_style('event-editor-css');
611
+		// scripts
612
+		if (! $this->admin_config->useAdvancedEditor()) {
613
+			wp_register_script(
614
+				'event-datetime-metabox',
615
+				EVENTS_ASSETS_URL . 'event-datetime-metabox.js',
616
+				['event_editor_js', 'ee-datepicker'],
617
+				EVENT_ESPRESSO_VERSION
618
+			);
619
+			wp_enqueue_script('event-datetime-metabox');
620
+		}
621
+	}
622
+
623
+
624
+	/**
625
+	 * Populating the _views property for the category list table view.
626
+	 */
627
+	protected function _set_list_table_views_category_list()
628
+	{
629
+		$this->_views = [
630
+			'all' => [
631
+				'slug'        => 'all',
632
+				'label'       => esc_html__('All', 'event_espresso'),
633
+				'count'       => 0,
634
+				'bulk_action' => [
635
+					'delete_categories' => esc_html__('Delete Permanently', 'event_espresso'),
636
+				],
637
+			],
638
+		];
639
+	}
640
+
641
+
642
+	/**
643
+	 * For adding anything that fires on the admin_init hook for any route within this admin page group.
644
+	 */
645
+	public function admin_init()
646
+	{
647
+		EE_Registry::$i18n_js_strings['image_confirm'] = esc_html__(
648
+			'Do you really want to delete this image? Please remember to update your event to complete the removal.',
649
+			'event_espresso'
650
+		);
651
+	}
652
+
653
+
654
+	/**
655
+	 * For adding anything that should be triggered on the admin_notices hook for any route within this admin page
656
+	 * group.
657
+	 */
658
+	public function admin_notices()
659
+	{
660
+	}
661
+
662
+
663
+	/**
664
+	 * For adding anything that should be triggered on the `admin_print_footer_scripts` hook for any route within
665
+	 * this admin page group.
666
+	 */
667
+	public function admin_footer_scripts()
668
+	{
669
+	}
670
+
671
+
672
+	/**
673
+	 * Call this function to verify if an event is public and has tickets for sale.  If it does, then we need to show a
674
+	 * warning (via EE_Error::add_error());
675
+	 *
676
+	 * @param EE_Event $event Event object
677
+	 * @param string   $req_type
678
+	 * @return void
679
+	 * @throws EE_Error
680
+	 * @access public
681
+	 */
682
+	public function verify_event_edit($event = null, $req_type = '')
683
+	{
684
+		// don't need to do this when processing
685
+		if (! empty($req_type)) {
686
+			return;
687
+		}
688
+		// no event?
689
+		if (! $event instanceof EE_Event) {
690
+			$event = $this->_cpt_model_obj;
691
+		}
692
+		// STILL no event?
693
+		if (! $event instanceof EE_Event) {
694
+			return;
695
+		}
696
+		$orig_status = $event->status();
697
+		// first check if event is active.
698
+		if ($orig_status === EEM_Event::cancelled
699
+			|| $orig_status === EEM_Event::postponed
700
+			|| $event->is_expired()
701
+			|| $event->is_inactive()
702
+		) {
703
+			return;
704
+		}
705
+		// made it here so it IS active... next check that any of the tickets are sold.
706
+		if ($event->is_sold_out(true)) {
707
+			if ($orig_status !== EEM_Event::sold_out && $event->status() !== $orig_status) {
708
+				EE_Error::add_attention(
709
+					sprintf(
710
+						esc_html__(
711
+							'Please note that the Event Status has automatically been changed to %s because there are no more spaces available for this event.  However, this change is not permanent until you update the event.  You can change the status back to something else before updating if you wish.',
712
+							'event_espresso'
713
+						),
714
+						EEH_Template::pretty_status(EEM_Event::sold_out, false, 'sentence')
715
+					)
716
+				);
717
+			}
718
+			return;
719
+		}
720
+		if ($orig_status === EEM_Event::sold_out) {
721
+			EE_Error::add_attention(
722
+				sprintf(
723
+					esc_html__(
724
+						'Please note that the Event Status has automatically been changed to %s because more spaces have become available for this event, most likely due to abandoned transactions freeing up reserved tickets.  However, this change is not permanent until you update the event. If you wish, you can change the status back to something else before updating.',
725
+						'event_espresso'
726
+					),
727
+					EEH_Template::pretty_status($event->status(), false, 'sentence')
728
+				)
729
+			);
730
+		}
731
+		// now we need to determine if the event has any tickets on sale.  If not then we dont' show the error
732
+		if (! $event->tickets_on_sale()) {
733
+			return;
734
+		}
735
+		// made it here so show warning
736
+		$this->_edit_event_warning();
737
+	}
738
+
739
+
740
+	/**
741
+	 * This is the text used for when an event is being edited that is public and has tickets for sale.
742
+	 * When needed, hook this into a EE_Error::add_error() notice.
743
+	 *
744
+	 * @access protected
745
+	 * @return void
746
+	 */
747
+	protected function _edit_event_warning()
748
+	{
749
+		// we don't want to add warnings during these requests
750
+		if (isset($this->_req_data['action']) && $this->_req_data['action'] === 'editpost') {
751
+			return;
752
+		}
753
+		EE_Error::add_attention(
754
+			sprintf(
755
+				esc_html__(
756
+					'Your event is open for registration. Making changes may disrupt any transactions in progress. %sLearn more%s',
757
+					'event_espresso'
758
+				),
759
+				'<a class="espresso-help-tab-lnk">',
760
+				'</a>'
761
+			)
762
+		);
763
+	}
764
+
765
+
766
+	/**
767
+	 * When a user is creating a new event, notify them if they haven't set their timezone.
768
+	 * Otherwise, do the normal logic
769
+	 *
770
+	 * @return string
771
+	 * @throws EE_Error
772
+	 * @throws InvalidArgumentException
773
+	 * @throws InvalidDataTypeException
774
+	 * @throws InvalidInterfaceException
775
+	 */
776
+	protected function _create_new_cpt_item()
777
+	{
778
+		$has_timezone_string = get_option('timezone_string');
779
+		// only nag them about setting their timezone if it's their first event, and they haven't already done it
780
+		if (! $has_timezone_string && ! EEM_Event::instance()->exists([])) {
781
+			EE_Error::add_attention(
782
+				sprintf(
783
+					__(
784
+						'Your website\'s timezone is currently set to a UTC offset. We recommend updating your timezone to a city or region near you before you create an event. Change your timezone now:%1$s%2$s%3$sChange Timezone%4$s',
785
+						'event_espresso'
786
+					),
787
+					'<br>',
788
+					'<select id="timezone_string" name="timezone_string" aria-describedby="timezone-description">'
789
+					. EEH_DTT_Helper::wp_timezone_choice('', EEH_DTT_Helper::get_user_locale())
790
+					. '</select>',
791
+					'<button class="button button-secondary timezone-submit">',
792
+					'</button><span class="spinner"></span>'
793
+				),
794
+				__FILE__,
795
+				__FUNCTION__,
796
+				__LINE__
797
+			);
798
+		}
799
+		parent::_create_new_cpt_item();
800
+	}
801
+
802
+
803
+	/**
804
+	 * Sets the _views property for the default route in this admin page group.
805
+	 */
806
+	protected function _set_list_table_views_default()
807
+	{
808
+		$this->_views = [
809
+			'all'   => [
810
+				'slug'        => 'all',
811
+				'label'       => esc_html__('View All Events', 'event_espresso'),
812
+				'count'       => 0,
813
+				'bulk_action' => [
814
+					'trash_events' => esc_html__('Move to Trash', 'event_espresso'),
815
+				],
816
+			],
817
+			'draft' => [
818
+				'slug'        => 'draft',
819
+				'label'       => esc_html__('Draft', 'event_espresso'),
820
+				'count'       => 0,
821
+				'bulk_action' => [
822
+					'trash_events' => esc_html__('Move to Trash', 'event_espresso'),
823
+				],
824
+			],
825
+		];
826
+		if (EE_Registry::instance()->CAP->current_user_can('ee_delete_events', 'espresso_events_trash_events')) {
827
+			$this->_views['trash'] = [
828
+				'slug'        => 'trash',
829
+				'label'       => esc_html__('Trash', 'event_espresso'),
830
+				'count'       => 0,
831
+				'bulk_action' => [
832
+					'restore_events' => esc_html__('Restore From Trash', 'event_espresso'),
833
+					'delete_events'  => esc_html__('Delete Permanently', 'event_espresso'),
834
+				],
835
+			];
836
+		}
837
+	}
838
+
839
+
840
+	/**
841
+	 * Provides the legend item array for the default list table view.
842
+	 *
843
+	 * @return array
844
+	 */
845
+	protected function _event_legend_items()
846
+	{
847
+		$items = [
848
+			'view_details'   => [
849
+				'class' => 'dashicons dashicons-search',
850
+				'desc'  => esc_html__('View Event', 'event_espresso'),
851
+			],
852
+			'edit_event'     => [
853
+				'class' => 'ee-icon ee-icon-calendar-edit',
854
+				'desc'  => esc_html__('Edit Event Details', 'event_espresso'),
855
+			],
856
+			'view_attendees' => [
857
+				'class' => 'dashicons dashicons-groups',
858
+				'desc'  => esc_html__('View Registrations for Event', 'event_espresso'),
859
+			],
860
+		];
861
+		$items = apply_filters('FHEE__Events_Admin_Page___event_legend_items__items', $items);
862
+		$statuses = [
863
+			'sold_out_status'  => [
864
+				'class' => 'ee-status-legend ee-status-legend-' . EE_Datetime::sold_out,
865
+				'desc'  => EEH_Template::pretty_status(EE_Datetime::sold_out, false, 'sentence'),
866
+			],
867
+			'active_status'    => [
868
+				'class' => 'ee-status-legend ee-status-legend-' . EE_Datetime::active,
869
+				'desc'  => EEH_Template::pretty_status(EE_Datetime::active, false, 'sentence'),
870
+			],
871
+			'upcoming_status'  => [
872
+				'class' => 'ee-status-legend ee-status-legend-' . EE_Datetime::upcoming,
873
+				'desc'  => EEH_Template::pretty_status(EE_Datetime::upcoming, false, 'sentence'),
874
+			],
875
+			'postponed_status' => [
876
+				'class' => 'ee-status-legend ee-status-legend-' . EE_Datetime::postponed,
877
+				'desc'  => EEH_Template::pretty_status(EE_Datetime::postponed, false, 'sentence'),
878
+			],
879
+			'cancelled_status' => [
880
+				'class' => 'ee-status-legend ee-status-legend-' . EE_Datetime::cancelled,
881
+				'desc'  => EEH_Template::pretty_status(EE_Datetime::cancelled, false, 'sentence'),
882
+			],
883
+			'expired_status'   => [
884
+				'class' => 'ee-status-legend ee-status-legend-' . EE_Datetime::expired,
885
+				'desc'  => EEH_Template::pretty_status(EE_Datetime::expired, false, 'sentence'),
886
+			],
887
+			'inactive_status'  => [
888
+				'class' => 'ee-status-legend ee-status-legend-' . EE_Datetime::inactive,
889
+				'desc'  => EEH_Template::pretty_status(EE_Datetime::inactive, false, 'sentence'),
890
+			],
891
+		];
892
+		$statuses = apply_filters('FHEE__Events_Admin_Page__event_legend_items__statuses', $statuses);
893
+		return array_merge($items, $statuses);
894
+	}
895
+
896
+
897
+	/**
898
+	 * @return EEM_Event
899
+	 * @throws EE_Error
900
+	 * @throws InvalidArgumentException
901
+	 * @throws InvalidDataTypeException
902
+	 * @throws InvalidInterfaceException
903
+	 * @throws ReflectionException
904
+	 */
905
+	private function _event_model()
906
+	{
907
+		if (! $this->_event_model instanceof EEM_Event) {
908
+			$this->_event_model = EE_Registry::instance()->load_model('Event');
909
+		}
910
+		return $this->_event_model;
911
+	}
912
+
913
+
914
+	/**
915
+	 * Adds extra buttons to the WP CPT permalink field row.
916
+	 * Method is called from parent and is hooked into the wp 'get_sample_permalink_html' filter.
917
+	 *
918
+	 * @param string $return    the current html
919
+	 * @param int    $id        the post id for the page
920
+	 * @param string $new_title What the title is
921
+	 * @param string $new_slug  what the slug is
922
+	 * @return string            The new html string for the permalink area
923
+	 */
924
+	public function extra_permalink_field_buttons($return, $id, $new_title, $new_slug)
925
+	{
926
+		// make sure this is only when editing
927
+		if (! empty($id)) {
928
+			$post = get_post($id);
929
+			$return .= '<a class="button button-small" onclick="prompt(\'Shortcode:\', jQuery(\'#shortcode\').val()); return false;" href="#"  tabindex="-1">'
930
+					   . esc_html__('Shortcode', 'event_espresso')
931
+					   . '</a> ';
932
+			$return .= '<input id="shortcode" type="hidden" value="[ESPRESSO_TICKET_SELECTOR event_id='
933
+					   . $post->ID
934
+					   . ']">';
935
+		}
936
+		return $return;
937
+	}
938
+
939
+
940
+	/**
941
+	 * _events_overview_list_table
942
+	 * This contains the logic for showing the events_overview list
943
+	 *
944
+	 * @access protected
945
+	 * @return void
946
+	 * @throws DomainException
947
+	 * @throws EE_Error
948
+	 * @throws InvalidArgumentException
949
+	 * @throws InvalidDataTypeException
950
+	 * @throws InvalidInterfaceException
951
+	 */
952
+	protected function _events_overview_list_table()
953
+	{
954
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
955
+		$this->_template_args['after_list_table'] = ! empty($this->_template_args['after_list_table'])
956
+			? (array) $this->_template_args['after_list_table']
957
+			: [];
958
+		$this->_template_args['after_list_table']['view_event_list_button'] = EEH_HTML::br()
959
+																			  . EEH_Template::get_button_or_link(
960
+																				  get_post_type_archive_link('espresso_events'),
961
+																				  esc_html__('View Event Archive Page', 'event_espresso'),
962
+																				  'button'
963
+																			  );
964
+		$this->_template_args['after_list_table']['legend'] = $this->_display_legend($this->_event_legend_items());
965
+		$this->_admin_page_title .= ' ' . $this->get_action_link_or_button(
966
+			'create_new',
967
+			'add',
968
+			[],
969
+			'add-new-h2'
970
+		);
971
+		$this->display_admin_list_table_page_with_no_sidebar();
972
+	}
973
+
974
+
975
+	/**
976
+	 * this allows for extra misc actions in the default WP publish box
977
+	 *
978
+	 * @return void
979
+	 * @throws DomainException
980
+	 * @throws EE_Error
981
+	 * @throws InvalidArgumentException
982
+	 * @throws InvalidDataTypeException
983
+	 * @throws InvalidInterfaceException
984
+	 * @throws ReflectionException
985
+	 */
986
+	public function extra_misc_actions_publish_box()
987
+	{
988
+		$this->_generate_publish_box_extra_content();
989
+	}
990
+
991
+
992
+	/**
993
+	 * This is hooked into the WordPress do_action('save_post') hook and runs after the custom post type has been
994
+	 * saved.
995
+	 * Typically you would use this to save any additional data.
996
+	 * Keep in mind also that "save_post" runs on EVERY post update to the database.
997
+	 * ALSO very important.  When a post transitions from scheduled to published,
998
+	 * the save_post action is fired but you will NOT have any _POST data containing any extra info you may have from
999
+	 * other meta saves. So MAKE sure that you handle this accordingly.
1000
+	 *
1001
+	 * @access protected
1002
+	 * @abstract
1003
+	 * @param string $post_id The ID of the cpt that was saved (so you can link relationally)
1004
+	 * @param object $post    The post object of the cpt that was saved.
1005
+	 * @return void
1006
+	 * @throws EE_Error
1007
+	 * @throws InvalidArgumentException
1008
+	 * @throws InvalidDataTypeException
1009
+	 * @throws InvalidInterfaceException
1010
+	 * @throws ReflectionException
1011
+	 */
1012
+	protected function _insert_update_cpt_item($post_id, $post)
1013
+	{
1014
+		if ($post instanceof WP_Post && $post->post_type !== 'espresso_events') {
1015
+			// get out we're not processing an event save.
1016
+			return;
1017
+		}
1018
+		$event_values = [
1019
+			'EVT_member_only'     => ! empty($this->_req_data['member_only']) ? 1 : 0,
1020
+			'EVT_allow_overflow'  => ! empty($this->_req_data['EVT_allow_overflow']) ? 1 : 0,
1021
+			'EVT_timezone_string' => ! empty($this->_req_data['timezone_string'])
1022
+				? sanitize_text_field($this->_req_data['timezone_string'])
1023
+				: null,
1024
+		];
1025
+		/** @var FeatureFlags $flags */
1026
+		$flags = $this->loader->getShared('EventEspresso\core\domain\services\capabilities\FeatureFlags');
1027
+		// check if the new EDTR reg options meta box is being used, and if so, don't run updates for legacy version
1028
+		if (! $this->admin_config->useAdvancedEditor() || ! $flags->featureAllowed('use_reg_options_meta_box')) {
1029
+			$event_values['EVT_display_ticket_selector'] =
1030
+				! empty($this->_req_data['display_ticket_selector'])
1031
+					? 1
1032
+					: 0;
1033
+			$event_values['EVT_additional_limit'] = min(
1034
+				apply_filters('FHEE__EE_Events_Admin__insert_update_cpt_item__EVT_additional_limit_max', 255),
1035
+				! empty($this->_req_data['additional_limit'])
1036
+					? absint($this->_req_data['additional_limit'])
1037
+					: null
1038
+			);
1039
+			$event_values['EVT_default_registration_status'] =
1040
+				! empty($this->_req_data['EVT_default_registration_status'])
1041
+					? sanitize_text_field($this->_req_data['EVT_default_registration_status'])
1042
+					: EE_Registry::instance()->CFG->registration->default_STS_ID;
1043
+			$event_values['EVT_external_URL'] = ! empty($this->_req_data['externalURL'])
1044
+				? esc_url_raw($this->_req_data['externalURL'])
1045
+				: null;
1046
+			$event_values['EVT_phone'] = ! empty($this->_req_data['event_phone'])
1047
+				? sanitize_text_field($this->_req_data['event_phone'])
1048
+				: null;
1049
+		}
1050
+		// update event
1051
+		$success = $this->_event_model()->update_by_ID($event_values, $post_id);
1052
+		// get event_object for other metaboxes... though it would seem to make sense to just use $this->_event_model()->get_one_by_ID( $post_id ).. i have to setup where conditions to override the filters in the model that filter out autodraft and inherit statuses so we GET the inherit id!
1053
+		$get_one_where = [
1054
+			$this->_event_model()->primary_key_name() => $post_id,
1055
+			'OR'                                      => [
1056
+				'status'   => $post->post_status,
1057
+				// if trying to "Publish" a sold out event, it's status will get switched back to "sold_out" in the db,
1058
+				// but the returned object here has a status of "publish", so use the original post status as well
1059
+				'status*1' => $this->_req_data['original_post_status'],
1060
+			],
1061
+		];
1062
+		$event = $this->_event_model()->get_one([$get_one_where]);
1063
+		// the following are default callbacks for event attachment updates that can be overridden by caffeinated functionality and/or addons.
1064
+		$event_update_callbacks = apply_filters(
1065
+			'FHEE__Events_Admin_Page___insert_update_cpt_item__event_update_callbacks',
1066
+			[
1067
+				[$this, '_default_venue_update'],
1068
+				[$this, '_default_tickets_update'],
1069
+			]
1070
+		);
1071
+		$att_success = true;
1072
+		foreach ($event_update_callbacks as $e_callback) {
1073
+			$_success = is_callable($e_callback)
1074
+				? $e_callback($event, $this->_req_data)
1075
+				: false;
1076
+			// if ANY of these updates fail then we want the appropriate global error message
1077
+			$att_success = ! $att_success ? $att_success : $_success;
1078
+		}
1079
+		// any errors?
1080
+		if ($success && false === $att_success) {
1081
+			EE_Error::add_error(
1082
+				esc_html__(
1083
+					'Event Details saved successfully but something went wrong with saving attachments.',
1084
+					'event_espresso'
1085
+				),
1086
+				__FILE__,
1087
+				__FUNCTION__,
1088
+				__LINE__
1089
+			);
1090
+		} elseif ($success === false) {
1091
+			EE_Error::add_error(
1092
+				esc_html__('Event Details did not save successfully.', 'event_espresso'),
1093
+				__FILE__,
1094
+				__FUNCTION__,
1095
+				__LINE__
1096
+			);
1097
+		}
1098
+	}
1099
+
1100
+
1101
+	/**
1102
+	 * @param int $post_id
1103
+	 * @param int $revision_id
1104
+	 * @throws EE_Error
1105
+	 * @throws InvalidArgumentException
1106
+	 * @throws InvalidDataTypeException
1107
+	 * @throws InvalidInterfaceException
1108
+	 * @throws ReflectionException
1109
+	 * @see parent::restore_item()
1110
+	 */
1111
+	protected function _restore_cpt_item($post_id, $revision_id)
1112
+	{
1113
+		// copy existing event meta to new post
1114
+		$post_evt = $this->_event_model()->get_one_by_ID($post_id);
1115
+		if ($post_evt instanceof EE_Event) {
1116
+			// meta revision restore
1117
+			$post_evt->restore_revision($revision_id);
1118
+			// related objs restore
1119
+			$post_evt->restore_revision($revision_id, ['Venue', 'Datetime', 'Price']);
1120
+		}
1121
+	}
1122
+
1123
+
1124
+	/**
1125
+	 * Attach the venue to the Event
1126
+	 *
1127
+	 * @param EE_Event $evtobj Event Object to add the venue to
1128
+	 * @param array    $data   The request data from the form
1129
+	 * @return bool           Success or fail.
1130
+	 * @throws EE_Error
1131
+	 * @throws InvalidArgumentException
1132
+	 * @throws InvalidDataTypeException
1133
+	 * @throws InvalidInterfaceException
1134
+	 * @throws ReflectionException
1135
+	 */
1136
+	protected function _default_venue_update(EE_Event $evtobj, $data)
1137
+	{
1138
+		require_once(EE_MODELS . 'EEM_Venue.model.php');
1139
+		$venue_model = EE_Registry::instance()->load_model('Venue');
1140
+		$rows_affected = null;
1141
+		$venue_id = ! empty($data['venue_id']) ? $data['venue_id'] : null;
1142
+		// very important.  If we don't have a venue name...
1143
+		// then we'll get out because not necessary to create empty venue
1144
+		if (empty($data['venue_title'])) {
1145
+			return false;
1146
+		}
1147
+		$venue_array = [
1148
+			'VNU_wp_user'         => $evtobj->get('EVT_wp_user'),
1149
+			'VNU_name'            => ! empty($data['venue_title']) ? $data['venue_title'] : null,
1150
+			'VNU_desc'            => ! empty($data['venue_description']) ? $data['venue_description'] : null,
1151
+			'VNU_identifier'      => ! empty($data['venue_identifier']) ? $data['venue_identifier'] : null,
1152
+			'VNU_short_desc'      => ! empty($data['venue_short_description']) ? $data['venue_short_description']
1153
+				: null,
1154
+			'VNU_address'         => ! empty($data['address']) ? $data['address'] : null,
1155
+			'VNU_address2'        => ! empty($data['address2']) ? $data['address2'] : null,
1156
+			'VNU_city'            => ! empty($data['city']) ? $data['city'] : null,
1157
+			'STA_ID'              => ! empty($data['state']) ? $data['state'] : null,
1158
+			'CNT_ISO'             => ! empty($data['countries']) ? $data['countries'] : null,
1159
+			'VNU_zip'             => ! empty($data['zip']) ? $data['zip'] : null,
1160
+			'VNU_phone'           => ! empty($data['venue_phone']) ? $data['venue_phone'] : null,
1161
+			'VNU_capacity'        => ! empty($data['venue_capacity']) ? $data['venue_capacity'] : null,
1162
+			'VNU_url'             => ! empty($data['venue_url']) ? $data['venue_url'] : null,
1163
+			'VNU_virtual_phone'   => ! empty($data['virtual_phone']) ? $data['virtual_phone'] : null,
1164
+			'VNU_virtual_url'     => ! empty($data['virtual_url']) ? $data['virtual_url'] : null,
1165
+			'VNU_enable_for_gmap' => isset($data['enable_for_gmap']) ? 1 : 0,
1166
+			'status'              => 'publish',
1167
+		];
1168
+		// if we've got the venue_id then we're just updating the existing venue so let's do that and then get out.
1169
+		if (! empty($venue_id)) {
1170
+			$update_where = [$venue_model->primary_key_name() => $venue_id];
1171
+			$rows_affected = $venue_model->update($venue_array, [$update_where]);
1172
+			// we've gotta make sure that the venue is always attached to a revision.. add_relation_to should take care of making sure that the relation is already present.
1173
+			$evtobj->_add_relation_to($venue_id, 'Venue');
1174
+			return $rows_affected > 0;
1175
+		}
1176
+		// we insert the venue
1177
+		$venue_id = $venue_model->insert($venue_array);
1178
+		$evtobj->_add_relation_to($venue_id, 'Venue');
1179
+		return ! empty($venue_id) ? true : false;
1180
+		// when we have the ancestor come in it's already been handled by the revision save.
1181
+	}
1182
+
1183
+
1184
+	/**
1185
+	 * Handles saving everything related to Tickets (datetimes, tickets, prices)
1186
+	 *
1187
+	 * @param EE_Event $evtobj The Event object we're attaching data to
1188
+	 * @param array    $data   The request data from the form
1189
+	 * @return array
1190
+	 * @throws EE_Error
1191
+	 * @throws InvalidArgumentException
1192
+	 * @throws InvalidDataTypeException
1193
+	 * @throws InvalidInterfaceException
1194
+	 * @throws ReflectionException
1195
+	 * @throws Exception
1196
+	 */
1197
+	protected function _default_tickets_update(EE_Event $evtobj, $data)
1198
+	{
1199
+		if ($this->admin_config->useAdvancedEditor()) {
1200
+			return [];
1201
+		}
1202
+		$success = true;
1203
+		$saved_dtt = null;
1204
+		$saved_tickets = [];
1205
+		$incoming_date_formats = ['Y-m-d', 'h:i a'];
1206
+		foreach ($data['edit_event_datetimes'] as $row => $dtt) {
1207
+			// trim all values to ensure any excess whitespace is removed.
1208
+			$dtt = array_map('trim', $dtt);
1209
+			$dtt['DTT_EVT_end'] = isset($dtt['DTT_EVT_end']) && ! empty($dtt['DTT_EVT_end']) ? $dtt['DTT_EVT_end']
1210
+				: $dtt['DTT_EVT_start'];
1211
+			$datetime_values = [
1212
+				'DTT_ID'        => ! empty($dtt['DTT_ID']) ? $dtt['DTT_ID'] : null,
1213
+				'DTT_EVT_start' => $dtt['DTT_EVT_start'],
1214
+				'DTT_EVT_end'   => $dtt['DTT_EVT_end'],
1215
+				'DTT_reg_limit' => empty($dtt['DTT_reg_limit']) ? EE_INF : $dtt['DTT_reg_limit'],
1216
+				'DTT_order'     => $row,
1217
+			];
1218
+			// if we have an id then let's get existing object first and then set the new values.  Otherwise we instantiate a new object for save.
1219
+			if (! empty($dtt['DTT_ID'])) {
1220
+				$DTM = EE_Registry::instance()
1221
+								  ->load_model('Datetime', [$evtobj->get_timezone()])
1222
+								  ->get_one_by_ID($dtt['DTT_ID']);
1223
+				$DTM->set_date_format($incoming_date_formats[0]);
1224
+				$DTM->set_time_format($incoming_date_formats[1]);
1225
+				foreach ($datetime_values as $field => $value) {
1226
+					$DTM->set($field, $value);
1227
+				}
1228
+				// make sure the $dtt_id here is saved just in case after the add_relation_to() the autosave replaces it.  We need to do this so we dont' TRASH the parent DTT.
1229
+				$saved_dtts[ $DTM->ID() ] = $DTM;
1230
+			} else {
1231
+				$DTM = EE_Registry::instance()->load_class(
1232
+					'Datetime',
1233
+					[$datetime_values, $evtobj->get_timezone(), $incoming_date_formats],
1234
+					false,
1235
+					false
1236
+				);
1237
+				foreach ($datetime_values as $field => $value) {
1238
+					$DTM->set($field, $value);
1239
+				}
1240
+			}
1241
+			$DTM->save();
1242
+			$DTT = $evtobj->_add_relation_to($DTM, 'Datetime');
1243
+			// load DTT helper
1244
+			// before going any further make sure our dates are setup correctly so that the end date is always equal or greater than the start date.
1245
+			if ($DTT->get_raw('DTT_EVT_start') > $DTT->get_raw('DTT_EVT_end')) {
1246
+				$DTT->set('DTT_EVT_end', $DTT->get('DTT_EVT_start'));
1247
+				$DTT = EEH_DTT_Helper::date_time_add($DTT, 'DTT_EVT_end', 'days');
1248
+				$DTT->save();
1249
+			}
1250
+			// now we got to make sure we add the new DTT_ID to the $saved_dtts array  because it is possible there was a new one created for the autosave.
1251
+			$saved_dtt = $DTT;
1252
+			$success = ! $success ? $success : $DTT;
1253
+			// if ANY of these updates fail then we want the appropriate global error message.
1254
+			// //todo this is actually sucky we need a better error message but this is what it is for now.
1255
+		}
1256
+		// no dtts get deleted so we don't do any of that logic here.
1257
+		// update tickets next
1258
+		$old_tickets = isset($data['ticket_IDs']) ? explode(',', $data['ticket_IDs']) : [];
1259
+		foreach ($data['edit_tickets'] as $row => $tkt) {
1260
+			$incoming_date_formats = ['Y-m-d', 'h:i a'];
1261
+			$update_prices = false;
1262
+			$ticket_price = isset($data['edit_prices'][ $row ][1]['PRC_amount'])
1263
+				? $data['edit_prices'][ $row ][1]['PRC_amount'] : 0;
1264
+			// trim inputs to ensure any excess whitespace is removed.
1265
+			$tkt = array_map('trim', $tkt);
1266
+			if (empty($tkt['TKT_start_date'])) {
1267
+				// let's use now in the set timezone.
1268
+				$now = new DateTime('now', new DateTimeZone($evtobj->get_timezone()));
1269
+				$tkt['TKT_start_date'] = $now->format($incoming_date_formats[0] . ' ' . $incoming_date_formats[1]);
1270
+			}
1271
+			if (empty($tkt['TKT_end_date'])) {
1272
+				// use the start date of the first datetime
1273
+				$dtt = $evtobj->first_datetime();
1274
+				$tkt['TKT_end_date'] = $dtt->start_date_and_time(
1275
+					$incoming_date_formats[0],
1276
+					$incoming_date_formats[1]
1277
+				);
1278
+			}
1279
+			$TKT_values = [
1280
+				'TKT_ID'          => ! empty($tkt['TKT_ID']) ? $tkt['TKT_ID'] : null,
1281
+				'TTM_ID'          => ! empty($tkt['TTM_ID']) ? $tkt['TTM_ID'] : 0,
1282
+				'TKT_name'        => ! empty($tkt['TKT_name']) ? $tkt['TKT_name'] : '',
1283
+				'TKT_description' => ! empty($tkt['TKT_description']) ? $tkt['TKT_description'] : '',
1284
+				'TKT_start_date'  => $tkt['TKT_start_date'],
1285
+				'TKT_end_date'    => $tkt['TKT_end_date'],
1286
+				'TKT_qty'         => ! isset($tkt['TKT_qty']) || $tkt['TKT_qty'] === '' ? EE_INF : $tkt['TKT_qty'],
1287
+				'TKT_uses'        => ! isset($tkt['TKT_uses']) || $tkt['TKT_uses'] === '' ? EE_INF : $tkt['TKT_uses'],
1288
+				'TKT_min'         => empty($tkt['TKT_min']) ? 0 : $tkt['TKT_min'],
1289
+				'TKT_max'         => empty($tkt['TKT_max']) ? EE_INF : $tkt['TKT_max'],
1290
+				'TKT_row'         => $row,
1291
+				'TKT_order'       => isset($tkt['TKT_order']) ? $tkt['TKT_order'] : $row,
1292
+				'TKT_price'       => $ticket_price,
1293
+			];
1294
+			// if this is a default TKT, then we need to set the TKT_ID to 0 and update accordingly, which means in turn that the prices will become new prices as well.
1295
+			if (isset($tkt['TKT_is_default']) && $tkt['TKT_is_default']) {
1296
+				$TKT_values['TKT_ID'] = 0;
1297
+				$TKT_values['TKT_is_default'] = 0;
1298
+				$TKT_values['TKT_price'] = $ticket_price;
1299
+				$update_prices = true;
1300
+			}
1301
+			// if we have a TKT_ID then we need to get that existing TKT_obj and update it
1302
+			// we actually do our saves a head of doing any add_relations to because its entirely possible that this ticket didn't removed or added to any datetime in the session but DID have it's items modified.
1303
+			// keep in mind that if the TKT has been sold (and we have changed pricing information), then we won't be updating the tkt but instead a new tkt will be created and the old one archived.
1304
+			if (! empty($tkt['TKT_ID'])) {
1305
+				$TKT = EE_Registry::instance()
1306
+								  ->load_model('Ticket', [$evtobj->get_timezone()])
1307
+								  ->get_one_by_ID($tkt['TKT_ID']);
1308
+				if ($TKT instanceof EE_Ticket) {
1309
+					$ticket_sold = $TKT->count_related(
1310
+						'Registration',
1311
+						[
1312
+								[
1313
+									'STS_ID' => [
1314
+										'NOT IN',
1315
+										[EEM_Registration::status_id_incomplete],
1316
+									],
1317
+								],
1318
+							]
1319
+					) > 0;
1320
+					// let's just check the total price for the existing ticket and determine if it matches the new
1321
+					// total price.  if they are different then we create a new ticket (if tickets sold)
1322
+					// if they aren't different then we go ahead and modify existing ticket.
1323
+					$create_new_TKT = $ticket_sold && ! $TKT->deleted()
1324
+									  && EEH_Money::compare_floats(
1325
+										  $ticket_price,
1326
+										  $TKT->get('TKT_price'),
1327
+										  '!=='
1328
+									  );
1329
+					$TKT->set_date_format($incoming_date_formats[0]);
1330
+					$TKT->set_time_format($incoming_date_formats[1]);
1331
+					// set new values
1332
+					foreach ($TKT_values as $field => $value) {
1333
+						if ($field === 'TKT_qty') {
1334
+							$TKT->set_qty($value);
1335
+						} else {
1336
+							$TKT->set($field, $value);
1337
+						}
1338
+					}
1339
+					// if $create_new_TKT is false then we can safely update the existing ticket.  Otherwise we have to create a new ticket.
1340
+					if ($create_new_TKT) {
1341
+						// archive the old ticket first
1342
+						$TKT->set('TKT_deleted', 1);
1343
+						$TKT->save();
1344
+						// make sure this ticket is still recorded in our saved_tkts so we don't run it through the regular trash routine.
1345
+						$saved_tickets[ $TKT->ID() ] = $TKT;
1346
+						// create new ticket that's a copy of the existing except a new id of course (and not archived) AND has the new TKT_price associated with it.
1347
+						$TKT = clone $TKT;
1348
+						$TKT->set('TKT_ID', 0);
1349
+						$TKT->set('TKT_deleted', 0);
1350
+						$TKT->set('TKT_price', $ticket_price);
1351
+						$TKT->set('TKT_sold', 0);
1352
+						// now we need to make sure that $new prices are created as well and attached to new ticket.
1353
+						$update_prices = true;
1354
+					}
1355
+					// make sure price is set if it hasn't been already
1356
+					$TKT->set('TKT_price', $ticket_price);
1357
+				}
1358
+			} else {
1359
+				// no TKT_id so a new TKT
1360
+				$TKT_values['TKT_price'] = $ticket_price;
1361
+				$TKT = EE_Registry::instance()->load_class('Ticket', [$TKT_values], false, false);
1362
+				if ($TKT instanceof EE_Ticket) {
1363
+					// need to reset values to properly account for the date formats
1364
+					$TKT->set_date_format($incoming_date_formats[0]);
1365
+					$TKT->set_time_format($incoming_date_formats[1]);
1366
+					$TKT->set_timezone($evtobj->get_timezone());
1367
+					// set new values
1368
+					foreach ($TKT_values as $field => $value) {
1369
+						if ($field === 'TKT_qty') {
1370
+							$TKT->set_qty($value);
1371
+						} else {
1372
+							$TKT->set($field, $value);
1373
+						}
1374
+					}
1375
+					$update_prices = true;
1376
+				}
1377
+			}
1378
+			// cap ticket qty by datetime reg limits
1379
+			$TKT->set_qty(min($TKT->qty(), $TKT->qty('reg_limit')));
1380
+			// update ticket.
1381
+			$TKT->save();
1382
+			// before going any further make sure our dates are setup correctly so that the end date is always equal or greater than the start date.
1383
+			if ($TKT->get_raw('TKT_start_date') > $TKT->get_raw('TKT_end_date')) {
1384
+				$TKT->set('TKT_end_date', $TKT->get('TKT_start_date'));
1385
+				$TKT = EEH_DTT_Helper::date_time_add($TKT, 'TKT_end_date', 'days');
1386
+				$TKT->save();
1387
+			}
1388
+			// initially let's add the ticket to the dtt
1389
+			$saved_dtt->_add_relation_to($TKT, 'Ticket');
1390
+			$saved_tickets[ $TKT->ID() ] = $TKT;
1391
+			// add prices to ticket
1392
+			$this->_add_prices_to_ticket($data['edit_prices'][ $row ], $TKT, $update_prices);
1393
+		}
1394
+		// however now we need to handle permanently deleting tickets via the ui.  Keep in mind that the ui does not allow deleting/archiving tickets that have ticket sold.  However, it does allow for deleting tickets that have no tickets sold, in which case we want to get rid of permanently because there is no need to save in db.
1395
+		$old_tickets = isset($old_tickets[0]) && $old_tickets[0] === '' ? [] : $old_tickets;
1396
+		$tickets_removed = array_diff($old_tickets, array_keys($saved_tickets));
1397
+		foreach ($tickets_removed as $id) {
1398
+			$id = absint($id);
1399
+			// get the ticket for this id
1400
+			$tkt_to_remove = EE_Registry::instance()->load_model('Ticket')->get_one_by_ID($id);
1401
+			// need to get all the related datetimes on this ticket and remove from every single one of them (remember this process can ONLY kick off if there are NO tkts_sold)
1402
+			$dtts = $tkt_to_remove->get_many_related('Datetime');
1403
+			foreach ($dtts as $dtt) {
1404
+				$tkt_to_remove->_remove_relation_to($dtt, 'Datetime');
1405
+			}
1406
+			// need to do the same for prices (except these prices can also be deleted because again, tickets can only be trashed if they don't have any TKTs sold (otherwise they are just archived))
1407
+			$tkt_to_remove->delete_related_permanently('Price');
1408
+			// finally let's delete this ticket (which should not be blocked at this point b/c we've removed all our relationships)
1409
+			$tkt_to_remove->delete_permanently();
1410
+		}
1411
+		return [$saved_dtt, $saved_tickets];
1412
+	}
1413
+
1414
+
1415
+	/**
1416
+	 * This attaches a list of given prices to a ticket.
1417
+	 * Note we dont' have to worry about ever removing relationships (or archiving prices) because if there is a change
1418
+	 * in price information on a ticket, a new ticket is created anyways so the archived ticket will retain the old
1419
+	 * price info and prices are automatically "archived" via the ticket.
1420
+	 *
1421
+	 * @access  private
1422
+	 * @param array     $prices     Array of prices from the form.
1423
+	 * @param EE_Ticket $ticket     EE_Ticket object that prices are being attached to.
1424
+	 * @param bool      $new_prices Whether attach existing incoming prices or create new ones.
1425
+	 * @return  void
1426
+	 * @throws EE_Error
1427
+	 * @throws InvalidArgumentException
1428
+	 * @throws InvalidDataTypeException
1429
+	 * @throws InvalidInterfaceException
1430
+	 * @throws ReflectionException
1431
+	 */
1432
+	private function _add_prices_to_ticket($prices, EE_Ticket $ticket, $new_prices = false)
1433
+	{
1434
+		foreach ($prices as $row => $prc) {
1435
+			$PRC_values = [
1436
+				'PRC_ID'         => ! empty($prc['PRC_ID']) ? $prc['PRC_ID'] : null,
1437
+				'PRT_ID'         => ! empty($prc['PRT_ID']) ? $prc['PRT_ID'] : null,
1438
+				'PRC_amount'     => ! empty($prc['PRC_amount']) ? $prc['PRC_amount'] : 0,
1439
+				'PRC_name'       => ! empty($prc['PRC_name']) ? $prc['PRC_name'] : '',
1440
+				'PRC_desc'       => ! empty($prc['PRC_desc']) ? $prc['PRC_desc'] : '',
1441
+				'PRC_is_default' => 0, // make sure prices are NOT set as default from this context
1442
+				'PRC_order'      => $row,
1443
+			];
1444
+			if ($new_prices || empty($PRC_values['PRC_ID'])) {
1445
+				$PRC_values['PRC_ID'] = 0;
1446
+				$PRC = EE_Registry::instance()->load_class('Price', [$PRC_values], false, false);
1447
+			} else {
1448
+				$PRC = EE_Registry::instance()->load_model('Price')->get_one_by_ID($prc['PRC_ID']);
1449
+				// update this price with new values
1450
+				foreach ($PRC_values as $field => $newprc) {
1451
+					$PRC->set($field, $newprc);
1452
+				}
1453
+				$PRC->save();
1454
+			}
1455
+			$ticket->_add_relation_to($PRC, 'Price');
1456
+		}
1457
+	}
1458
+
1459
+
1460
+	/**
1461
+	 * Add in our autosave ajax handlers
1462
+	 *
1463
+	 */
1464
+	protected function _ee_autosave_create_new()
1465
+	{
1466
+	}
1467
+
1468
+
1469
+	/**
1470
+	 * More autosave handlers.
1471
+	 */
1472
+	protected function _ee_autosave_edit()
1473
+	{
1474
+	}
1475
+
1476
+
1477
+	/**
1478
+	 *    _generate_publish_box_extra_content
1479
+	 *
1480
+	 * @throws DomainException
1481
+	 * @throws EE_Error
1482
+	 * @throws InvalidArgumentException
1483
+	 * @throws InvalidDataTypeException
1484
+	 * @throws InvalidInterfaceException
1485
+	 * @throws ReflectionException
1486
+	 */
1487
+	private function _generate_publish_box_extra_content()
1488
+	{
1489
+		// load formatter helper
1490
+		// args for getting related registrations
1491
+		$approved_query_args = [
1492
+			[
1493
+				'REG_deleted' => 0,
1494
+				'STS_ID'      => EEM_Registration::status_id_approved,
1495
+			],
1496
+		];
1497
+		$not_approved_query_args = [
1498
+			[
1499
+				'REG_deleted' => 0,
1500
+				'STS_ID'      => EEM_Registration::status_id_not_approved,
1501
+			],
1502
+		];
1503
+		$pending_payment_query_args = [
1504
+			[
1505
+				'REG_deleted' => 0,
1506
+				'STS_ID'      => EEM_Registration::status_id_pending_payment,
1507
+			],
1508
+		];
1509
+		// publish box
1510
+		$publish_box_extra_args = [
1511
+			'view_approved_reg_url'        => add_query_arg(
1512
+				[
1513
+					'action'      => 'default',
1514
+					'event_id'    => $this->_cpt_model_obj->ID(),
1515
+					'_reg_status' => EEM_Registration::status_id_approved,
1516
+				],
1517
+				REG_ADMIN_URL
1518
+			),
1519
+			'view_not_approved_reg_url'    => add_query_arg(
1520
+				[
1521
+					'action'      => 'default',
1522
+					'event_id'    => $this->_cpt_model_obj->ID(),
1523
+					'_reg_status' => EEM_Registration::status_id_not_approved,
1524
+				],
1525
+				REG_ADMIN_URL
1526
+			),
1527
+			'view_pending_payment_reg_url' => add_query_arg(
1528
+				[
1529
+					'action'      => 'default',
1530
+					'event_id'    => $this->_cpt_model_obj->ID(),
1531
+					'_reg_status' => EEM_Registration::status_id_pending_payment,
1532
+				],
1533
+				REG_ADMIN_URL
1534
+			),
1535
+			'approved_regs'                => $this->_cpt_model_obj->count_related(
1536
+				'Registration',
1537
+				$approved_query_args
1538
+			),
1539
+			'not_approved_regs'            => $this->_cpt_model_obj->count_related(
1540
+				'Registration',
1541
+				$not_approved_query_args
1542
+			),
1543
+			'pending_payment_regs'         => $this->_cpt_model_obj->count_related(
1544
+				'Registration',
1545
+				$pending_payment_query_args
1546
+			),
1547
+			'misc_pub_section_class'       => apply_filters(
1548
+				'FHEE_Events_Admin_Page___generate_publish_box_extra_content__misc_pub_section_class',
1549
+				'misc-pub-section'
1550
+			),
1551
+		];
1552
+		ob_start();
1553
+		do_action(
1554
+			'AHEE__Events_Admin_Page___generate_publish_box_extra_content__event_editor_overview_add',
1555
+			$this->_cpt_model_obj
1556
+		);
1557
+		$publish_box_extra_args['event_editor_overview_add'] = ob_get_clean();
1558
+		// load template
1559
+		EEH_Template::display_template(
1560
+			EVENTS_TEMPLATE_PATH . 'event_publish_box_extras.template.php',
1561
+			$publish_box_extra_args
1562
+		);
1563
+	}
1564
+
1565
+
1566
+	/**
1567
+	 * @return EE_Event
1568
+	 */
1569
+	public function get_event_object()
1570
+	{
1571
+		return $this->_cpt_model_obj;
1572
+	}
1573
+
1574
+
1575
+
1576
+
1577
+	/** METABOXES * */
1578
+	/**
1579
+	 * _register_event_editor_meta_boxes
1580
+	 * add all metaboxes related to the event_editor
1581
+	 *
1582
+	 * @return void
1583
+	 * @throws EE_Error
1584
+	 * @throws InvalidArgumentException
1585
+	 * @throws InvalidDataTypeException
1586
+	 * @throws InvalidInterfaceException
1587
+	 * @throws ReflectionException
1588
+	 */
1589
+	protected function _register_event_editor_meta_boxes()
1590
+	{
1591
+		$this->verify_cpt_object();
1592
+		$use_advanced_editor = $this->admin_config->useAdvancedEditor();
1593
+		/** @var FeatureFlags $flags */
1594
+		$flags = $this->loader->getShared('EventEspresso\core\domain\services\capabilities\FeatureFlags');
1595
+		// check if the new EDTR reg options meta box is being used, and if so, don't load the legacy version
1596
+		if (! $use_advanced_editor || ! $flags->featureAllowed('use_reg_options_meta_box')) {
1597
+			add_meta_box(
1598
+				'espresso_event_editor_event_options',
1599
+				esc_html__('Event Registration Options', 'event_espresso'),
1600
+				[$this, 'registration_options_meta_box'],
1601
+				$this->page_slug,
1602
+				'side'
1603
+			);
1604
+			add_action(
1605
+				'add_meta_boxes_espresso_events',
1606
+				function () {
1607
+					global $current_screen;
1608
+					remove_meta_box('authordiv', $current_screen, 'normal');
1609
+				},
1610
+				99
1611
+			);
1612
+		}
1613
+		if (! $use_advanced_editor) {
1614
+			add_meta_box(
1615
+				'espresso_event_editor_tickets',
1616
+				esc_html__('Event Datetime & Ticket', 'event_espresso'),
1617
+				[$this, 'ticket_metabox'],
1618
+				$this->page_slug,
1619
+				'normal',
1620
+				'high'
1621
+			);
1622
+		}
1623
+		// NOTE: if you're looking for other metaboxes in here,
1624
+		// where a metabox has a related management page in the admin
1625
+		// you will find it setup in the related management page's "_Hooks" file.
1626
+		// i.e. messages metabox is found in "espresso_events_Messages_Hooks.class.php".
1627
+	}
1628
+
1629
+
1630
+	/**
1631
+	 * @throws DomainException
1632
+	 * @throws EE_Error
1633
+	 * @throws InvalidArgumentException
1634
+	 * @throws InvalidDataTypeException
1635
+	 * @throws InvalidInterfaceException
1636
+	 * @throws ReflectionException
1637
+	 */
1638
+	public function ticket_metabox()
1639
+	{
1640
+		$existing_datetime_ids = $existing_ticket_ids = [];
1641
+		// defaults for template args
1642
+		$template_args = [
1643
+			'existing_datetime_ids'    => '',
1644
+			'event_datetime_help_link' => '',
1645
+			'ticket_options_help_link' => '',
1646
+			'time'                     => null,
1647
+			'ticket_rows'              => '',
1648
+			'existing_ticket_ids'      => '',
1649
+			'total_ticket_rows'        => 1,
1650
+			'ticket_js_structure'      => '',
1651
+			'trash_icon'               => 'ee-lock-icon',
1652
+			'disabled'                 => '',
1653
+		];
1654
+		$event_id = is_object($this->_cpt_model_obj) ? $this->_cpt_model_obj->ID() : null;
1655
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
1656
+		/**
1657
+		 * 1. Start with retrieving Datetimes
1658
+		 * 2. Fore each datetime get related tickets
1659
+		 * 3. For each ticket get related prices
1660
+		 */
1661
+		$times = EE_Registry::instance()->load_model('Datetime')->get_all_event_dates($event_id);
1662
+		/** @type EE_Datetime $first_datetime */
1663
+		$first_datetime = reset($times);
1664
+		// do we get related tickets?
1665
+		if ($first_datetime instanceof EE_Datetime
1666
+			&& $first_datetime->ID() !== 0
1667
+		) {
1668
+			$existing_datetime_ids[] = $first_datetime->get('DTT_ID');
1669
+			$template_args['time'] = $first_datetime;
1670
+			$related_tickets = $first_datetime->tickets(
1671
+				[
1672
+					['OR' => ['TKT_deleted' => 1, 'TKT_deleted*' => 0]],
1673
+					'default_where_conditions' => 'none',
1674
+				]
1675
+			);
1676
+			if (! empty($related_tickets)) {
1677
+				$template_args['total_ticket_rows'] = count($related_tickets);
1678
+				$row = 0;
1679
+				foreach ($related_tickets as $ticket) {
1680
+					$existing_ticket_ids[] = $ticket->get('TKT_ID');
1681
+					$template_args['ticket_rows'] .= $this->_get_ticket_row($ticket, false, $row);
1682
+					$row++;
1683
+				}
1684
+			} else {
1685
+				$template_args['total_ticket_rows'] = 1;
1686
+				/** @type EE_Ticket $ticket */
1687
+				$ticket = EE_Registry::instance()->load_model('Ticket')->create_default_object();
1688
+				$template_args['ticket_rows'] .= $this->_get_ticket_row($ticket);
1689
+			}
1690
+		} else {
1691
+			$template_args['time'] = $times[0];
1692
+			/** @type EE_Ticket $ticket */
1693
+			$ticket = EE_Registry::instance()->load_model('Ticket')->get_all_default_tickets();
1694
+			$template_args['ticket_rows'] .= $this->_get_ticket_row($ticket[1]);
1695
+			// NOTE: we're just sending the first default row
1696
+			// (decaf can't manage default tickets so this should be sufficient);
1697
+		}
1698
+		$template_args['event_datetime_help_link'] = $this->_get_help_tab_link(
1699
+			'event_editor_event_datetimes_help_tab'
1700
+		);
1701
+		$template_args['ticket_options_help_link'] = $this->_get_help_tab_link('ticket_options_info');
1702
+		$template_args['existing_datetime_ids'] = implode(',', $existing_datetime_ids);
1703
+		$template_args['existing_ticket_ids'] = implode(',', $existing_ticket_ids);
1704
+		$template_args['ticket_js_structure'] = $this->_get_ticket_row(
1705
+			EE_Registry::instance()->load_model('Ticket')->create_default_object(),
1706
+			true
1707
+		);
1708
+		$template = apply_filters(
1709
+			'FHEE__Events_Admin_Page__ticket_metabox__template',
1710
+			EVENTS_TEMPLATE_PATH . 'event_tickets_metabox_main.template.php'
1711
+		);
1712
+		EEH_Template::display_template($template, $template_args);
1713
+	}
1714
+
1715
+
1716
+	/**
1717
+	 * Setup an individual ticket form for the decaf event editor page
1718
+	 *
1719
+	 * @access private
1720
+	 * @param EE_Ticket $ticket   the ticket object
1721
+	 * @param boolean   $skeleton whether we're generating a skeleton for js manipulation
1722
+	 * @param int       $row
1723
+	 * @return string generated html for the ticket row.
1724
+	 * @throws DomainException
1725
+	 * @throws EE_Error
1726
+	 * @throws InvalidArgumentException
1727
+	 * @throws InvalidDataTypeException
1728
+	 * @throws InvalidInterfaceException
1729
+	 * @throws ReflectionException
1730
+	 */
1731
+	private function _get_ticket_row($ticket, $skeleton = false, $row = 0)
1732
+	{
1733
+		$template_args = [
1734
+			'tkt_status_class'    => ' tkt-status-' . $ticket->ticket_status(),
1735
+			'tkt_archive_class'   => $ticket->ticket_status() === EE_Ticket::archived && ! $skeleton ? ' tkt-archived'
1736
+				: '',
1737
+			'ticketrow'           => $skeleton ? 'TICKETNUM' : $row,
1738
+			'TKT_ID'              => $ticket->get('TKT_ID'),
1739
+			'TKT_name'            => $ticket->get('TKT_name'),
1740
+			'TKT_start_date'      => $skeleton ? '' : $ticket->get_date('TKT_start_date', 'Y-m-d h:i a'),
1741
+			'TKT_end_date'        => $skeleton ? '' : $ticket->get_date('TKT_end_date', 'Y-m-d h:i a'),
1742
+			'TKT_is_default'      => $ticket->get('TKT_is_default'),
1743
+			'TKT_qty'             => $ticket->get_pretty('TKT_qty', 'input'),
1744
+			'edit_ticketrow_name' => $skeleton ? 'TICKETNAMEATTR' : 'edit_tickets',
1745
+			'TKT_sold'            => $skeleton ? 0 : $ticket->get('TKT_sold'),
1746
+			'trash_icon'          => ($skeleton || (! empty($ticket) && ! $ticket->get('TKT_deleted')))
1747
+									 && (! empty($ticket) && $ticket->get('TKT_sold') === 0)
1748
+				? 'trash-icon dashicons dashicons-post-trash clickable' : 'ee-lock-icon',
1749
+			'disabled'            => $skeleton || (! empty($ticket) && ! $ticket->get('TKT_deleted')) ? ''
1750
+				: ' disabled=disabled',
1751
+		];
1752
+		$price = $ticket->ID() !== 0
1753
+			? $ticket->get_first_related('Price', ['default_where_conditions' => 'none'])
1754
+			: EE_Registry::instance()->load_model('Price')->create_default_object();
1755
+		$price_args = [
1756
+			'price_currency_symbol' => EE_Registry::instance()->CFG->currency->sign,
1757
+			'PRC_amount'            => $price->get('PRC_amount'),
1758
+			'PRT_ID'                => $price->get('PRT_ID'),
1759
+			'PRC_ID'                => $price->get('PRC_ID'),
1760
+			'PRC_is_default'        => $price->get('PRC_is_default'),
1761
+		];
1762
+		// make sure we have default start and end dates if skeleton
1763
+		// handle rows that should NOT be empty
1764
+		if (empty($template_args['TKT_start_date'])) {
1765
+			// if empty then the start date will be now.
1766
+			$template_args['TKT_start_date'] = date('Y-m-d h:i a', current_time('timestamp'));
1767
+		}
1768
+		if (empty($template_args['TKT_end_date'])) {
1769
+			// get the earliest datetime (if present);
1770
+			$earliest_dtt = $this->_cpt_model_obj->ID() > 0
1771
+				? $this->_cpt_model_obj->get_first_related(
1772
+					'Datetime',
1773
+					['order_by' => ['DTT_EVT_start' => 'ASC']]
1774
+				)
1775
+				: null;
1776
+			if (! empty($earliest_dtt)) {
1777
+				$template_args['TKT_end_date'] = $earliest_dtt->get_datetime('DTT_EVT_start', 'Y-m-d', 'h:i a');
1778
+			} else {
1779
+				$template_args['TKT_end_date'] = date(
1780
+					'Y-m-d h:i a',
1781
+					mktime(0, 0, 0, date('m'), date('d') + 7, date('Y'))
1782
+				);
1783
+			}
1784
+		}
1785
+		$template_args = array_merge($template_args, $price_args);
1786
+		$template = apply_filters(
1787
+			'FHEE__Events_Admin_Page__get_ticket_row__template',
1788
+			EVENTS_TEMPLATE_PATH . 'event_tickets_metabox_ticket_row.template.php',
1789
+			$ticket
1790
+		);
1791
+		return EEH_Template::display_template($template, $template_args, true);
1792
+	}
1793
+
1794
+
1795
+	/**
1796
+	 * @throws DomainException
1797
+	 * @throws EE_Error
1798
+	 */
1799
+	public function registration_options_meta_box()
1800
+	{
1801
+		$yes_no_values = [
1802
+			['id' => true, 'text' => esc_html__('Yes', 'event_espresso')],
1803
+			['id' => false, 'text' => esc_html__('No', 'event_espresso')],
1804
+		];
1805
+		$default_reg_status_values = EEM_Registration::reg_status_array(
1806
+			[
1807
+				EEM_Registration::status_id_cancelled,
1808
+				EEM_Registration::status_id_declined,
1809
+				EEM_Registration::status_id_incomplete,
1810
+			],
1811
+			true
1812
+		);
1813
+		// $template_args['is_active_select'] = EEH_Form_Fields::select_input('is_active', $yes_no_values, $this->_cpt_model_obj->is_active());
1814
+		$template_args['_event'] = $this->_cpt_model_obj;
1815
+		$template_args['active_status'] = $this->_cpt_model_obj->pretty_active_status(false);
1816
+		$template_args['additional_limit'] = $this->_cpt_model_obj->additional_limit();
1817
+		$template_args['default_registration_status'] = EEH_Form_Fields::select_input(
1818
+			'default_reg_status',
1819
+			$default_reg_status_values,
1820
+			$this->_cpt_model_obj->default_registration_status()
1821
+		);
1822
+		$template_args['display_description'] = EEH_Form_Fields::select_input(
1823
+			'display_desc',
1824
+			$yes_no_values,
1825
+			$this->_cpt_model_obj->display_description()
1826
+		);
1827
+		$template_args['display_ticket_selector'] = EEH_Form_Fields::select_input(
1828
+			'display_ticket_selector',
1829
+			$yes_no_values,
1830
+			$this->_cpt_model_obj->display_ticket_selector(),
1831
+			'',
1832
+			'',
1833
+			false
1834
+		);
1835
+		$template_args['additional_registration_options'] = apply_filters(
1836
+			'FHEE__Events_Admin_Page__registration_options_meta_box__additional_registration_options',
1837
+			'',
1838
+			$template_args,
1839
+			$yes_no_values,
1840
+			$default_reg_status_values
1841
+		);
1842
+		EEH_Template::display_template(
1843
+			EVENTS_TEMPLATE_PATH . 'event_registration_options.template.php',
1844
+			$template_args
1845
+		);
1846
+	}
1847
+
1848
+
1849
+	/**
1850
+	 * _get_events()
1851
+	 * This method simply returns all the events (for the given _view and paging)
1852
+	 *
1853
+	 * @access public
1854
+	 * @param int  $per_page     count of items per page (20 default);
1855
+	 * @param int  $current_page what is the current page being viewed.
1856
+	 * @param bool $count        if TRUE then we just return a count of ALL events matching the given _view.
1857
+	 *                           If FALSE then we return an array of event objects
1858
+	 *                           that match the given _view and paging parameters.
1859
+	 * @return array an array of event objects.
1860
+	 * @throws EE_Error
1861
+	 * @throws InvalidArgumentException
1862
+	 * @throws InvalidDataTypeException
1863
+	 * @throws InvalidInterfaceException
1864
+	 * @throws ReflectionException
1865
+	 * @throws Exception
1866
+	 * @throws Exception
1867
+	 * @throws Exception
1868
+	 */
1869
+	public function get_events($per_page = 10, $current_page = 1, $count = false)
1870
+	{
1871
+		$EEME = $this->_event_model();
1872
+		$offset = ($current_page - 1) * $per_page;
1873
+		$limit = $count ? null : $offset . ',' . $per_page;
1874
+		$orderby = isset($this->_req_data['orderby']) ? $this->_req_data['orderby'] : 'EVT_ID';
1875
+		$order = isset($this->_req_data['order']) ? $this->_req_data['order'] : 'DESC';
1876
+		if (isset($this->_req_data['month_range'])) {
1877
+			$pieces = explode(' ', $this->_req_data['month_range'], 3);
1878
+			// simulate the FIRST day of the month, that fixes issues for months like February
1879
+			// where PHP doesn't know what to assume for date.
1880
+			// @see https://events.codebasehq.com/projects/event-espresso/tickets/10437
1881
+			$month_r = ! empty($pieces[0]) ? date('m', EEH_DTT_Helper::first_of_month_timestamp($pieces[0])) : '';
1882
+			$year_r = ! empty($pieces[1]) ? $pieces[1] : '';
1883
+		}
1884
+		$where = [];
1885
+		$status = isset($this->_req_data['status']) ? $this->_req_data['status'] : null;
1886
+		// determine what post_status our condition will have for the query.
1887
+		switch ($status) {
1888
+			case 'month':
1889
+			case 'today':
1890
+			case null:
1891
+			case 'all':
1892
+				break;
1893
+			case 'draft':
1894
+				$where['status'] = ['IN', ['draft', 'auto-draft']];
1895
+				break;
1896
+			default:
1897
+				$where['status'] = $status;
1898
+		}
1899
+		// categories?
1900
+		$category = isset($this->_req_data['EVT_CAT']) && $this->_req_data['EVT_CAT'] > 0
1901
+			? $this->_req_data['EVT_CAT'] : null;
1902
+		if (! empty($category)) {
1903
+			$where['Term_Taxonomy.taxonomy'] = EEM_CPT_Base::EVENT_CATEGORY_TAXONOMY;
1904
+			$where['Term_Taxonomy.term_id'] = $category;
1905
+		}
1906
+		// date where conditions
1907
+		$start_formats = EEM_Datetime::instance()->get_formats_for('DTT_EVT_start');
1908
+		if (isset($this->_req_data['month_range']) && $this->_req_data['month_range'] !== '') {
1909
+			$DateTime = new DateTime(
1910
+				$year_r . '-' . $month_r . '-01 00:00:00',
1911
+				new DateTimeZone('UTC')
1912
+			);
1913
+			$start = $DateTime->getTimestamp();
1914
+			// set the datetime to be the end of the month
1915
+			$DateTime->setDate(
1916
+				$year_r,
1917
+				$month_r,
1918
+				$DateTime->format('t')
1919
+			)->setTime(23, 59, 59);
1920
+			$end = $DateTime->getTimestamp();
1921
+			$where['Datetime.DTT_EVT_start'] = ['BETWEEN', [$start, $end]];
1922
+		} elseif (isset($this->_req_data['status']) && $this->_req_data['status'] === 'today') {
1923
+			$DateTime = new DateTime('now', new DateTimeZone(EEM_Event::instance()->get_timezone()));
1924
+			$start = $DateTime->setTime(0, 0, 0)->format(implode(' ', $start_formats));
1925
+			$end = $DateTime->setTime(23, 59, 59)->format(implode(' ', $start_formats));
1926
+			$where['Datetime.DTT_EVT_start'] = ['BETWEEN', [$start, $end]];
1927
+		} elseif (isset($this->_req_data['status']) && $this->_req_data['status'] === 'month') {
1928
+			$now = date('Y-m-01');
1929
+			$DateTime = new DateTime($now, new DateTimeZone(EEM_Event::instance()->get_timezone()));
1930
+			$start = $DateTime->setTime(0, 0, 0)->format(implode(' ', $start_formats));
1931
+			$end = $DateTime->setDate(date('Y'), date('m'), $DateTime->format('t'))
1932
+							->setTime(23, 59, 59)
1933
+							->format(implode(' ', $start_formats));
1934
+			$where['Datetime.DTT_EVT_start'] = ['BETWEEN', [$start, $end]];
1935
+		}
1936
+		if (! EE_Registry::instance()->CAP->current_user_can('ee_read_others_events', 'get_events')) {
1937
+			$where['EVT_wp_user'] = get_current_user_id();
1938
+		} elseif (! isset($where['status'])
1939
+				  && ! EE_Registry::instance()->CAP->current_user_can('ee_read_private_events', 'get_events')
1940
+		) {
1941
+			$where['OR'] = [
1942
+				'status*restrict_private' => ['!=', 'private'],
1943
+				'AND'                     => [
1944
+					'status*inclusive' => ['=', 'private'],
1945
+					'EVT_wp_user'      => get_current_user_id(),
1946
+				],
1947
+			];
1948
+		}
1949
+
1950
+		if (isset($this->_req_data['EVT_wp_user'])
1951
+			&& (int) $this->_req_data['EVT_wp_user'] !== (int) get_current_user_id()
1952
+			&& EE_Registry::instance()->CAP->current_user_can('ee_read_others_events', 'get_events')
1953
+		) {
1954
+			$where['EVT_wp_user'] = $this->_req_data['EVT_wp_user'];
1955
+		}
1956
+		// search query handling
1957
+		if (isset($this->_req_data['s'])) {
1958
+			$search_string = '%' . $this->_req_data['s'] . '%';
1959
+			$where['OR'] = [
1960
+				'EVT_name'       => ['LIKE', $search_string],
1961
+				'EVT_desc'       => ['LIKE', $search_string],
1962
+				'EVT_short_desc' => ['LIKE', $search_string],
1963
+			];
1964
+		}
1965
+		// filter events by venue.
1966
+		if (isset($this->_req_data['venue']) && ! empty($this->_req_data['venue'])) {
1967
+			$where['Venue.VNU_ID'] = absint($this->_req_data['venue']);
1968
+		}
1969
+		$where = apply_filters('FHEE__Events_Admin_Page__get_events__where', $where, $this->_req_data);
1970
+		$query_params = apply_filters(
1971
+			'FHEE__Events_Admin_Page__get_events__query_params',
1972
+			[
1973
+				$where,
1974
+				'limit'    => $limit,
1975
+				'order_by' => $orderby,
1976
+				'order'    => $order,
1977
+				'group_by' => 'EVT_ID',
1978
+			],
1979
+			$this->_req_data
1980
+		);
1981
+
1982
+		// let's first check if we have special requests coming in.
1983
+		if (isset($this->_req_data['active_status'])) {
1984
+			switch ($this->_req_data['active_status']) {
1985
+				case 'upcoming':
1986
+					return $EEME->get_upcoming_events($query_params, $count);
1987
+					break;
1988
+				case 'expired':
1989
+					return $EEME->get_expired_events($query_params, $count);
1990
+					break;
1991
+				case 'active':
1992
+					return $EEME->get_active_events($query_params, $count);
1993
+					break;
1994
+				case 'inactive':
1995
+					return $EEME->get_inactive_events($query_params, $count);
1996
+					break;
1997
+			}
1998
+		}
1999
+
2000
+		$events = $count ? $EEME->count([$where], 'EVT_ID', true) : $EEME->get_all($query_params);
2001
+		return $events;
2002
+	}
2003
+
2004
+
2005
+	/**
2006
+	 * handling for WordPress CPT actions (trash, restore, delete)
2007
+	 *
2008
+	 * @param string $post_id
2009
+	 * @throws EE_Error
2010
+	 * @throws InvalidArgumentException
2011
+	 * @throws InvalidDataTypeException
2012
+	 * @throws InvalidInterfaceException
2013
+	 * @throws ReflectionException
2014
+	 */
2015
+	public function trash_cpt_item($post_id)
2016
+	{
2017
+		$this->_req_data['EVT_ID'] = $post_id;
2018
+		$this->_trash_or_restore_event('trash', false);
2019
+	}
2020
+
2021
+
2022
+	/**
2023
+	 * @param string $post_id
2024
+	 * @throws EE_Error
2025
+	 * @throws InvalidArgumentException
2026
+	 * @throws InvalidDataTypeException
2027
+	 * @throws InvalidInterfaceException
2028
+	 * @throws ReflectionException
2029
+	 */
2030
+	public function restore_cpt_item($post_id)
2031
+	{
2032
+		$this->_req_data['EVT_ID'] = $post_id;
2033
+		$this->_trash_or_restore_event('draft', false);
2034
+	}
2035
+
2036
+
2037
+	/**
2038
+	 * @param string $post_id
2039
+	 * @throws EE_Error
2040
+	 * @throws InvalidArgumentException
2041
+	 * @throws InvalidDataTypeException
2042
+	 * @throws InvalidInterfaceException
2043
+	 * @throws ReflectionException
2044
+	 */
2045
+	public function delete_cpt_item($post_id)
2046
+	{
2047
+		$this->_req_data['EVT_ID'] = $post_id;
2048
+		$this->_delete_event(false);
2049
+	}
2050
+
2051
+
2052
+	/**
2053
+	 * _trash_or_restore_event
2054
+	 *
2055
+	 * @access protected
2056
+	 * @param string $event_status
2057
+	 * @param bool   $redirect_after
2058
+	 * @throws EE_Error
2059
+	 * @throws InvalidArgumentException
2060
+	 * @throws InvalidDataTypeException
2061
+	 * @throws InvalidInterfaceException
2062
+	 * @throws ReflectionException
2063
+	 */
2064
+	protected function _trash_or_restore_event($event_status = 'trash', $redirect_after = true)
2065
+	{
2066
+		// determine the event id and set to array.
2067
+		$EVT_ID = isset($this->_req_data['EVT_ID']) ? absint($this->_req_data['EVT_ID']) : false;
2068
+		// loop thru events
2069
+		if ($EVT_ID) {
2070
+			// clean status
2071
+			$event_status = sanitize_key($event_status);
2072
+			// grab status
2073
+			if (! empty($event_status)) {
2074
+				$success = $this->_change_event_status($EVT_ID, $event_status);
2075
+			} else {
2076
+				$success = false;
2077
+				$msg = esc_html__(
2078
+					'An error occurred. The event could not be moved to the trash because a valid event status was not not supplied.',
2079
+					'event_espresso'
2080
+				);
2081
+				EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__);
2082
+			}
2083
+		} else {
2084
+			$success = false;
2085
+			$msg = esc_html__(
2086
+				'An error occurred. The event could not be moved to the trash because a valid event ID was not not supplied.',
2087
+				'event_espresso'
2088
+			);
2089
+			EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__);
2090
+		}
2091
+		$action = $event_status === 'trash' ? 'moved to the trash' : 'restored from the trash';
2092
+		if ($redirect_after) {
2093
+			$this->_redirect_after_action($success, 'Event', $action, ['action' => 'default']);
2094
+		}
2095
+	}
2096
+
2097
+
2098
+	/**
2099
+	 * _trash_or_restore_events
2100
+	 *
2101
+	 * @access protected
2102
+	 * @param string $event_status
2103
+	 * @return void
2104
+	 * @throws EE_Error
2105
+	 * @throws InvalidArgumentException
2106
+	 * @throws InvalidDataTypeException
2107
+	 * @throws InvalidInterfaceException
2108
+	 * @throws ReflectionException
2109
+	 */
2110
+	protected function _trash_or_restore_events($event_status = 'trash')
2111
+	{
2112
+		// clean status
2113
+		$event_status = sanitize_key($event_status);
2114
+		// grab status
2115
+		if (! empty($event_status)) {
2116
+			$success = true;
2117
+			// determine the event id and set to array.
2118
+			$EVT_IDs = isset($this->_req_data['EVT_IDs']) ? (array) $this->_req_data['EVT_IDs'] : [];
2119
+			// loop thru events
2120
+			foreach ($EVT_IDs as $EVT_ID) {
2121
+				if ($EVT_ID = absint($EVT_ID)) {
2122
+					$results = $this->_change_event_status($EVT_ID, $event_status);
2123
+					$success = $results !== false ? $success : false;
2124
+				} else {
2125
+					$msg = sprintf(
2126
+						esc_html__(
2127
+							'An error occurred. Event #%d could not be moved to the trash because a valid event ID was not not supplied.',
2128
+							'event_espresso'
2129
+						),
2130
+						$EVT_ID
2131
+					);
2132
+					EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__);
2133
+					$success = false;
2134
+				}
2135
+			}
2136
+		} else {
2137
+			$success = false;
2138
+			$msg = esc_html__(
2139
+				'An error occurred. The event could not be moved to the trash because a valid event status was not not supplied.',
2140
+				'event_espresso'
2141
+			);
2142
+			EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__);
2143
+		}
2144
+		// in order to force a pluralized result message we need to send back a success status greater than 1
2145
+		$success = $success ? 2 : false;
2146
+		$action = $event_status === 'trash' ? 'moved to the trash' : 'restored from the trash';
2147
+		$this->_redirect_after_action($success, 'Events', $action, ['action' => 'default']);
2148
+	}
2149
+
2150
+
2151
+	/**
2152
+	 * _trash_or_restore_events
2153
+	 *
2154
+	 * @access  private
2155
+	 * @param int    $EVT_ID
2156
+	 * @param string $event_status
2157
+	 * @return bool
2158
+	 * @throws EE_Error
2159
+	 * @throws InvalidArgumentException
2160
+	 * @throws InvalidDataTypeException
2161
+	 * @throws InvalidInterfaceException
2162
+	 * @throws ReflectionException
2163
+	 */
2164
+	private function _change_event_status($EVT_ID = 0, $event_status = '')
2165
+	{
2166
+		// grab event id
2167
+		if (! $EVT_ID) {
2168
+			$msg = esc_html__(
2169
+				'An error occurred. No Event ID or an invalid Event ID was received.',
2170
+				'event_espresso'
2171
+			);
2172
+			EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__);
2173
+			return false;
2174
+		}
2175
+		$this->_cpt_model_obj = EEM_Event::instance()->get_one_by_ID($EVT_ID);
2176
+		// clean status
2177
+		$event_status = sanitize_key($event_status);
2178
+		// grab status
2179
+		if (empty($event_status)) {
2180
+			$msg = esc_html__(
2181
+				'An error occurred. No Event Status or an invalid Event Status was received.',
2182
+				'event_espresso'
2183
+			);
2184
+			EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__);
2185
+			return false;
2186
+		}
2187
+		// was event trashed or restored ?
2188
+		switch ($event_status) {
2189
+			case 'draft':
2190
+				$action = 'restored from the trash';
2191
+				$hook = 'AHEE_event_restored_from_trash';
2192
+				break;
2193
+			case 'trash':
2194
+				$action = 'moved to the trash';
2195
+				$hook = 'AHEE_event_moved_to_trash';
2196
+				break;
2197
+			default:
2198
+				$action = 'updated';
2199
+				$hook = false;
2200
+		}
2201
+		// use class to change status
2202
+		$this->_cpt_model_obj->set_status($event_status);
2203
+		$success = $this->_cpt_model_obj->save();
2204
+		if ($success === false) {
2205
+			$msg = sprintf(esc_html__('An error occurred. The event could not be %s.', 'event_espresso'), $action);
2206
+			EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__);
2207
+			return false;
2208
+		}
2209
+		if ($hook) {
2210
+			do_action($hook);
2211
+		}
2212
+		return true;
2213
+	}
2214
+
2215
+
2216
+	/**
2217
+	 * _delete_event
2218
+	 *
2219
+	 * @access protected
2220
+	 * @param bool $redirect_after
2221
+	 * @throws EE_Error
2222
+	 * @throws InvalidArgumentException
2223
+	 * @throws InvalidDataTypeException
2224
+	 * @throws InvalidInterfaceException
2225
+	 * @throws ReflectionException
2226
+	 */
2227
+	protected function _delete_event($redirect_after = true)
2228
+	{
2229
+		// determine the event id and set to array.
2230
+		$EVT_ID = isset($this->_req_data['EVT_ID']) ? absint($this->_req_data['EVT_ID']) : null;
2231
+		$EVT_ID = isset($this->_req_data['post']) ? absint($this->_req_data['post']) : $EVT_ID;
2232
+		// loop thru events
2233
+		if ($EVT_ID) {
2234
+			$success = $this->_permanently_delete_event($EVT_ID);
2235
+			// get list of events with no prices
2236
+			$espresso_no_ticket_prices = get_option('ee_no_ticket_prices', []);
2237
+			// remove this event from the list of events with no prices
2238
+			if (isset($espresso_no_ticket_prices[ $EVT_ID ])) {
2239
+				unset($espresso_no_ticket_prices[ $EVT_ID ]);
2240
+			}
2241
+			update_option('ee_no_ticket_prices', $espresso_no_ticket_prices);
2242
+		} else {
2243
+			$success = false;
2244
+			$msg = esc_html__(
2245
+				'An error occurred. An event could not be deleted because a valid event ID was not not supplied.',
2246
+				'event_espresso'
2247
+			);
2248
+			EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__);
2249
+		}
2250
+		if ($redirect_after) {
2251
+			$this->_redirect_after_action(
2252
+				$success,
2253
+				'Event',
2254
+				'deleted',
2255
+				['action' => 'default', 'status' => 'trash']
2256
+			);
2257
+		}
2258
+	}
2259
+
2260
+
2261
+	/**
2262
+	 * _delete_events
2263
+	 *
2264
+	 * @access protected
2265
+	 * @return void
2266
+	 * @throws EE_Error
2267
+	 * @throws InvalidArgumentException
2268
+	 * @throws InvalidDataTypeException
2269
+	 * @throws InvalidInterfaceException
2270
+	 * @throws ReflectionException
2271
+	 */
2272
+	protected function _delete_events()
2273
+	{
2274
+		$success = true;
2275
+		// get list of events with no prices
2276
+		$espresso_no_ticket_prices = get_option('ee_no_ticket_prices', []);
2277
+		// determine the event id and set to array.
2278
+		$EVT_IDs = isset($this->_req_data['EVT_IDs']) ? (array) $this->_req_data['EVT_IDs'] : [];
2279
+		// loop thru events
2280
+		foreach ($EVT_IDs as $EVT_ID) {
2281
+			$EVT_ID = absint($EVT_ID);
2282
+			if ($EVT_ID) {
2283
+				$results = $this->_permanently_delete_event($EVT_ID);
2284
+				$success = $results !== false ? $success : false;
2285
+				// remove this event from the list of events with no prices
2286
+				unset($espresso_no_ticket_prices[ $EVT_ID ]);
2287
+			} else {
2288
+				$success = false;
2289
+				$msg = esc_html__(
2290
+					'An error occurred. An event could not be deleted because a valid event ID was not not supplied.',
2291
+					'event_espresso'
2292
+				);
2293
+				EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__);
2294
+			}
2295
+		}
2296
+		update_option('ee_no_ticket_prices', $espresso_no_ticket_prices);
2297
+		// in order to force a pluralized result message we need to send back a success status greater than 1
2298
+		$success = $success ? 2 : false;
2299
+		$this->_redirect_after_action($success, 'Events', 'deleted', ['action' => 'default']);
2300
+	}
2301
+
2302
+
2303
+	/**
2304
+	 * _permanently_delete_event
2305
+	 *
2306
+	 * @access  private
2307
+	 * @param int $EVT_ID
2308
+	 * @return bool
2309
+	 * @throws EE_Error
2310
+	 * @throws InvalidArgumentException
2311
+	 * @throws InvalidDataTypeException
2312
+	 * @throws InvalidInterfaceException
2313
+	 * @throws ReflectionException
2314
+	 */
2315
+	private function _permanently_delete_event($EVT_ID = 0)
2316
+	{
2317
+		// grab event id
2318
+		if (! $EVT_ID) {
2319
+			$msg = esc_html__(
2320
+				'An error occurred. No Event ID or an invalid Event ID was received.',
2321
+				'event_espresso'
2322
+			);
2323
+			EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__);
2324
+			return false;
2325
+		}
2326
+		if (! $this->_cpt_model_obj instanceof EE_Event
2327
+			|| $this->_cpt_model_obj->ID() !== $EVT_ID
2328
+		) {
2329
+			$this->_cpt_model_obj = EEM_Event::instance()->get_one_by_ID($EVT_ID);
2330
+		}
2331
+		if (! $this->_cpt_model_obj instanceof EE_Event) {
2332
+			return false;
2333
+		}
2334
+		// need to delete related tickets and prices first.
2335
+		$datetimes = $this->_cpt_model_obj->get_many_related('Datetime');
2336
+		foreach ($datetimes as $datetime) {
2337
+			$this->_cpt_model_obj->_remove_relation_to($datetime, 'Datetime');
2338
+			$tickets = $datetime->get_many_related('Ticket');
2339
+			foreach ($tickets as $ticket) {
2340
+				$ticket->_remove_relation_to($datetime, 'Datetime');
2341
+				$ticket->delete_related_permanently('Price');
2342
+				$ticket->delete_permanently();
2343
+			}
2344
+			$datetime->delete();
2345
+		}
2346
+		// what about related venues or terms?
2347
+		$venues = $this->_cpt_model_obj->get_many_related('Venue');
2348
+		foreach ($venues as $venue) {
2349
+			$this->_cpt_model_obj->_remove_relation_to($venue, 'Venue');
2350
+		}
2351
+		// any attached question groups?
2352
+		$question_groups = $this->_cpt_model_obj->get_many_related('Question_Group');
2353
+		if (! empty($question_groups)) {
2354
+			foreach ($question_groups as $question_group) {
2355
+				$this->_cpt_model_obj->_remove_relation_to($question_group, 'Question_Group');
2356
+			}
2357
+		}
2358
+		// Message Template Groups
2359
+		$this->_cpt_model_obj->_remove_relations('Message_Template_Group');
2360
+		/** @type EE_Term_Taxonomy[] $term_taxonomies */
2361
+		$term_taxonomies = $this->_cpt_model_obj->term_taxonomies();
2362
+		foreach ($term_taxonomies as $term_taxonomy) {
2363
+			$this->_cpt_model_obj->remove_relation_to_term_taxonomy($term_taxonomy);
2364
+		}
2365
+		$success = $this->_cpt_model_obj->delete_permanently();
2366
+		// did it all go as planned ?
2367
+		if ($success) {
2368
+			$msg = sprintf(esc_html__('Event ID # %d has been deleted.', 'event_espresso'), $EVT_ID);
2369
+			EE_Error::add_success($msg);
2370
+		} else {
2371
+			$msg = sprintf(
2372
+				esc_html__('An error occurred. Event ID # %d could not be deleted.', 'event_espresso'),
2373
+				$EVT_ID
2374
+			);
2375
+			EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__);
2376
+			return false;
2377
+		}
2378
+		do_action('AHEE__Events_Admin_Page___permanently_delete_event__after_event_deleted', $EVT_ID);
2379
+		return true;
2380
+	}
2381
+
2382
+
2383
+	/**
2384
+	 * get total number of events
2385
+	 *
2386
+	 * @access public
2387
+	 * @return int
2388
+	 * @throws EE_Error
2389
+	 * @throws InvalidArgumentException
2390
+	 * @throws InvalidDataTypeException
2391
+	 * @throws InvalidInterfaceException
2392
+	 */
2393
+	public function total_events()
2394
+	{
2395
+		$count = EEM_Event::instance()->count(['caps' => 'read_admin'], 'EVT_ID', true);
2396
+		return $count;
2397
+	}
2398
+
2399
+
2400
+	/**
2401
+	 * get total number of draft events
2402
+	 *
2403
+	 * @access public
2404
+	 * @return int
2405
+	 * @throws EE_Error
2406
+	 * @throws InvalidArgumentException
2407
+	 * @throws InvalidDataTypeException
2408
+	 * @throws InvalidInterfaceException
2409
+	 */
2410
+	public function total_events_draft()
2411
+	{
2412
+		$where = [
2413
+			'status' => ['IN', ['draft', 'auto-draft']],
2414
+		];
2415
+		$count = EEM_Event::instance()->count([$where, 'caps' => 'read_admin'], 'EVT_ID', true);
2416
+		return $count;
2417
+	}
2418
+
2419
+
2420
+	/**
2421
+	 * get total number of trashed events
2422
+	 *
2423
+	 * @access public
2424
+	 * @return int
2425
+	 * @throws EE_Error
2426
+	 * @throws InvalidArgumentException
2427
+	 * @throws InvalidDataTypeException
2428
+	 * @throws InvalidInterfaceException
2429
+	 */
2430
+	public function total_trashed_events()
2431
+	{
2432
+		$where = [
2433
+			'status' => 'trash',
2434
+		];
2435
+		$count = EEM_Event::instance()->count([$where, 'caps' => 'read_admin'], 'EVT_ID', true);
2436
+		return $count;
2437
+	}
2438
+
2439
+
2440
+	/**
2441
+	 *    _default_event_settings
2442
+	 *    This generates the Default Settings Tab
2443
+	 *
2444
+	 * @return void
2445
+	 * @throws DomainException
2446
+	 * @throws EE_Error
2447
+	 * @throws InvalidArgumentException
2448
+	 * @throws InvalidDataTypeException
2449
+	 * @throws InvalidInterfaceException
2450
+	 */
2451
+	protected function _default_event_settings()
2452
+	{
2453
+		$this->_set_add_edit_form_tags('update_default_event_settings');
2454
+		$this->_set_publish_post_box_vars(null, false, false, null, false);
2455
+		$this->_template_args['admin_page_content'] = $this->_default_event_settings_form()->get_html();
2456
+		$this->display_admin_page_with_sidebar();
2457
+	}
2458
+
2459
+
2460
+	/**
2461
+	 * Return the form for event settings.
2462
+	 *
2463
+	 * @return EE_Form_Section_Proper
2464
+	 * @throws EE_Error
2465
+	 */
2466
+	protected function _default_event_settings_form()
2467
+	{
2468
+		$registration_config = EE_Registry::instance()->CFG->registration;
2469
+		$registration_stati_for_selection = EEM_Registration::reg_status_array(
2470
+		// exclude
2471
+			[
2472
+				EEM_Registration::status_id_cancelled,
2473
+				EEM_Registration::status_id_declined,
2474
+				EEM_Registration::status_id_incomplete,
2475
+				EEM_Registration::status_id_wait_list,
2476
+			],
2477
+			true
2478
+		);
2479
+		return new EE_Form_Section_Proper(
2480
+			[
2481
+				'name'            => 'update_default_event_settings',
2482
+				'html_id'         => 'update_default_event_settings',
2483
+				'html_class'      => 'form-table',
2484
+				'layout_strategy' => new EE_Admin_Two_Column_Layout(),
2485
+				'subsections'     => apply_filters(
2486
+					'FHEE__Events_Admin_Page___default_event_settings_form__form_subsections',
2487
+					[
2488
+						'default_reg_status'  => new EE_Select_Input(
2489
+							$registration_stati_for_selection,
2490
+							[
2491
+								'default'         => isset($registration_config->default_STS_ID)
2492
+													 && array_key_exists(
2493
+														 $registration_config->default_STS_ID,
2494
+														 $registration_stati_for_selection
2495
+													 )
2496
+									? sanitize_text_field($registration_config->default_STS_ID)
2497
+									: EEM_Registration::status_id_pending_payment,
2498
+								'html_label_text' => esc_html__('Default Registration Status', 'event_espresso')
2499
+													 . EEH_Template::get_help_tab_link(
2500
+														 'default_settings_status_help_tab'
2501
+													 ),
2502
+								'html_help_text'  => esc_html__(
2503
+									'This setting allows you to preselect what the default registration status setting is when creating an event.  Note that changing this setting does NOT retroactively apply it to existing events.',
2504
+									'event_espresso'
2505
+								),
2506
+							]
2507
+						),
2508
+						'default_max_tickets' => new EE_Integer_Input(
2509
+							[
2510
+								'default'         => isset($registration_config->default_maximum_number_of_tickets)
2511
+									? $registration_config->default_maximum_number_of_tickets
2512
+									: EEM_Event::get_default_additional_limit(),
2513
+								'html_label_text' => esc_html__(
2514
+									'Default Maximum Tickets Allowed Per Order:',
2515
+									'event_espresso'
2516
+								)
2517
+													 . EEH_Template::get_help_tab_link(
2518
+														 'default_maximum_tickets_help_tab"'
2519
+													 ),
2520
+								'html_help_text'  => esc_html__(
2521
+									'This setting allows you to indicate what will be the default for the maximum number of tickets per order when creating new events.',
2522
+									'event_espresso'
2523
+								),
2524
+							]
2525
+						),
2526
+					]
2527
+				),
2528
+			]
2529
+		);
2530
+	}
2531
+
2532
+
2533
+	/**
2534
+	 * @return void
2535
+	 * @throws EE_Error
2536
+	 * @throws InvalidArgumentException
2537
+	 * @throws InvalidDataTypeException
2538
+	 * @throws InvalidInterfaceException
2539
+	 */
2540
+	protected function _update_default_event_settings()
2541
+	{
2542
+		$form = $this->_default_event_settings_form();
2543
+		if ($form->was_submitted()) {
2544
+			$form->receive_form_submission();
2545
+			if ($form->is_valid()) {
2546
+				$registration_config = EE_Registry::instance()->CFG->registration;
2547
+				$valid_data = $form->valid_data();
2548
+				if (isset($valid_data['default_reg_status'])) {
2549
+					$registration_config->default_STS_ID = $valid_data['default_reg_status'];
2550
+				}
2551
+				if (isset($valid_data['default_max_tickets'])) {
2552
+					$registration_config->default_maximum_number_of_tickets = $valid_data['default_max_tickets'];
2553
+				}
2554
+				do_action(
2555
+					'AHEE__Events_Admin_Page___update_default_event_settings',
2556
+					$valid_data,
2557
+					EE_Registry::instance()->CFG,
2558
+					$this
2559
+				);
2560
+				// update because data was valid!
2561
+				EE_Registry::instance()->CFG->update_espresso_config();
2562
+				EE_Error::overwrite_success();
2563
+				EE_Error::add_success(
2564
+					__('Default Event Settings were updated', 'event_espresso')
2565
+				);
2566
+			}
2567
+		}
2568
+		$this->_redirect_after_action(0, '', '', ['action' => 'default_event_settings'], true);
2569
+	}
2570
+
2571
+
2572
+	/*************        Templates        *************/
2573
+	protected function _template_settings()
2574
+	{
2575
+		$this->_admin_page_title = esc_html__('Template Settings (Preview)', 'event_espresso');
2576
+		$this->_template_args['preview_img'] = '<img src="'
2577
+											   . EVENTS_ASSETS_URL
2578
+											   . '/images/'
2579
+											   . 'caffeinated_template_features.jpg" alt="'
2580
+											   . esc_attr__('Template Settings Preview screenshot', 'event_espresso')
2581
+											   . '" />';
2582
+		$this->_template_args['preview_text'] = '<strong>'
2583
+												. esc_html__(
2584
+													'Template Settings is a feature that is only available in the premium version of Event Espresso 4 which is available with a support license purchase on EventEspresso.com. Template Settings allow you to configure some of the appearance options for both the Event List and Event Details pages.',
2585
+													'event_espresso'
2586
+												) . '</strong>';
2587
+		$this->display_admin_caf_preview_page('template_settings_tab');
2588
+	}
2589
+
2590
+
2591
+	/** Event Category Stuff **/
2592
+	/**
2593
+	 * set the _category property with the category object for the loaded page.
2594
+	 *
2595
+	 * @access private
2596
+	 * @return void
2597
+	 */
2598
+	private function _set_category_object()
2599
+	{
2600
+		if (isset($this->_category->id) && ! empty($this->_category->id)) {
2601
+			return;
2602
+		} //already have the category object so get out.
2603
+		// set default category object
2604
+		$this->_set_empty_category_object();
2605
+		// only set if we've got an id
2606
+		if (! isset($this->_req_data['EVT_CAT_ID'])) {
2607
+			return;
2608
+		}
2609
+		$category_id = absint($this->_req_data['EVT_CAT_ID']);
2610
+		$term = get_term($category_id, EEM_CPT_Base::EVENT_CATEGORY_TAXONOMY);
2611
+		if (! empty($term)) {
2612
+			$this->_category->category_name = $term->name;
2613
+			$this->_category->category_identifier = $term->slug;
2614
+			$this->_category->category_desc = $term->description;
2615
+			$this->_category->id = $term->term_id;
2616
+			$this->_category->parent = $term->parent;
2617
+		}
2618
+	}
2619
+
2620
+
2621
+	/**
2622
+	 * Clears out category properties.
2623
+	 */
2624
+	private function _set_empty_category_object()
2625
+	{
2626
+		$this->_category = new stdClass();
2627
+		$this->_category->category_name = $this->_category->category_identifier = $this->_category->category_desc = '';
2628
+		$this->_category->id = $this->_category->parent = 0;
2629
+	}
2630
+
2631
+
2632
+	/**
2633
+	 * @throws DomainException
2634
+	 * @throws EE_Error
2635
+	 * @throws InvalidArgumentException
2636
+	 * @throws InvalidDataTypeException
2637
+	 * @throws InvalidInterfaceException
2638
+	 */
2639
+	protected function _category_list_table()
2640
+	{
2641
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
2642
+		$this->_search_btn_label = esc_html__('Categories', 'event_espresso');
2643
+		$this->_admin_page_title .= ' ' . $this->get_action_link_or_button(
2644
+			'add_category',
2645
+			'add_category',
2646
+			[],
2647
+			'add-new-h2'
2648
+		);
2649
+		$this->display_admin_list_table_page_with_sidebar();
2650
+	}
2651
+
2652
+
2653
+	/**
2654
+	 * Output category details view.
2655
+	 *
2656
+	 * @param string $view
2657
+	 * @throws DomainException
2658
+	 * @throws EE_Error
2659
+	 * @throws InvalidArgumentException
2660
+	 * @throws InvalidDataTypeException
2661
+	 * @throws InvalidInterfaceException
2662
+	 */
2663
+	protected function _category_details($view)
2664
+	{
2665
+		// load formatter helper
2666
+		// load field generator helper
2667
+		$route = $view === 'edit' ? 'update_category' : 'insert_category';
2668
+		$this->_set_add_edit_form_tags($route);
2669
+		$this->_set_category_object();
2670
+		$id = ! empty($this->_category->id) ? $this->_category->id : '';
2671
+		$delete_action = 'delete_category';
2672
+		// custom redirect
2673
+		$redirect = EE_Admin_Page::add_query_args_and_nonce(
2674
+			['action' => 'category_list'],
2675
+			$this->_admin_base_url
2676
+		);
2677
+		$this->_set_publish_post_box_vars('EVT_CAT_ID', $id, $delete_action, $redirect);
2678
+		// take care of contents
2679
+		$this->_template_args['admin_page_content'] = $this->_category_details_content();
2680
+		$this->display_admin_page_with_sidebar();
2681
+	}
2682
+
2683
+
2684
+	/**
2685
+	 * Output category details content.
2686
+	 *
2687
+	 * @throws DomainException
2688
+	 */
2689
+	protected function _category_details_content()
2690
+	{
2691
+		$editor_args['category_desc'] = [
2692
+			'type'          => 'wp_editor',
2693
+			'value'         => EEH_Formatter::admin_format_content($this->_category->category_desc),
2694
+			'class'         => 'my_editor_custom',
2695
+			'wpeditor_args' => ['media_buttons' => false],
2696
+		];
2697
+		$_wp_editor = $this->_generate_admin_form_fields($editor_args, 'array');
2698
+		$all_terms = get_terms(
2699
+			[EEM_CPT_Base::EVENT_CATEGORY_TAXONOMY],
2700
+			['hide_empty' => 0, 'exclude' => [$this->_category->id]]
2701
+		);
2702
+		// setup category select for term parents.
2703
+		$category_select_values[] = [
2704
+			'text' => esc_html__('No Parent', 'event_espresso'),
2705
+			'id'   => 0,
2706
+		];
2707
+		foreach ($all_terms as $term) {
2708
+			$category_select_values[] = [
2709
+				'text' => $term->name,
2710
+				'id'   => $term->term_id,
2711
+			];
2712
+		}
2713
+		$category_select = EEH_Form_Fields::select_input(
2714
+			'category_parent',
2715
+			$category_select_values,
2716
+			$this->_category->parent
2717
+		);
2718
+		$template_args = [
2719
+			'category'                 => $this->_category,
2720
+			'category_select'          => $category_select,
2721
+			'unique_id_info_help_link' => $this->_get_help_tab_link('unique_id_info'),
2722
+			'category_desc_editor'     => $_wp_editor['category_desc']['field'],
2723
+			'disable'                  => '',
2724
+			'disabled_message'         => false,
2725
+		];
2726
+		$template = EVENTS_TEMPLATE_PATH . 'event_category_details.template.php';
2727
+		return EEH_Template::display_template($template, $template_args, true);
2728
+	}
2729
+
2730
+
2731
+	/**
2732
+	 * Handles deleting categories.
2733
+	 */
2734
+	protected function _delete_categories()
2735
+	{
2736
+		$cat_ids = isset($this->_req_data['EVT_CAT_ID']) ? (array) $this->_req_data['EVT_CAT_ID']
2737
+			: (array) $this->_req_data['category_id'];
2738
+		foreach ($cat_ids as $cat_id) {
2739
+			$this->_delete_category($cat_id);
2740
+		}
2741
+		// doesn't matter what page we're coming from... we're going to the same place after delete.
2742
+		$query_args = [
2743
+			'action' => 'category_list',
2744
+		];
2745
+		$this->_redirect_after_action(0, '', '', $query_args);
2746
+	}
2747
+
2748
+
2749
+	/**
2750
+	 * Handles deleting specific category.
2751
+	 *
2752
+	 * @param int $cat_id
2753
+	 */
2754
+	protected function _delete_category($cat_id)
2755
+	{
2756
+		$cat_id = absint($cat_id);
2757
+		wp_delete_term($cat_id, EEM_CPT_Base::EVENT_CATEGORY_TAXONOMY);
2758
+	}
2759
+
2760
+
2761
+	/**
2762
+	 * Handles triggering the update or insertion of a new category.
2763
+	 *
2764
+	 * @param bool $new_category true means we're triggering the insert of a new category.
2765
+	 * @throws EE_Error
2766
+	 * @throws InvalidArgumentException
2767
+	 * @throws InvalidDataTypeException
2768
+	 * @throws InvalidInterfaceException
2769
+	 */
2770
+	protected function _insert_or_update_category($new_category)
2771
+	{
2772
+		$cat_id = $new_category ? $this->_insert_category() : $this->_insert_category(true);
2773
+		$success = 0; // we already have a success message so lets not send another.
2774
+		if ($cat_id) {
2775
+			$query_args = [
2776
+				'action'     => 'edit_category',
2777
+				'EVT_CAT_ID' => $cat_id,
2778
+			];
2779
+		} else {
2780
+			$query_args = ['action' => 'add_category'];
2781
+		}
2782
+		$this->_redirect_after_action($success, '', '', $query_args, true);
2783
+	}
2784
+
2785
+
2786
+	/**
2787
+	 * Inserts or updates category
2788
+	 *
2789
+	 * @param bool $update (true indicates we're updating a category).
2790
+	 * @return bool|mixed|string
2791
+	 */
2792
+	private function _insert_category($update = false)
2793
+	{
2794
+		$cat_id = $update ? $this->_req_data['EVT_CAT_ID'] : '';
2795
+		$category_name = isset($this->_req_data['category_name']) ? $this->_req_data['category_name'] : '';
2796
+		$category_desc = isset($this->_req_data['category_desc']) ? $this->_req_data['category_desc'] : '';
2797
+		$category_parent = isset($this->_req_data['category_parent']) ? $this->_req_data['category_parent'] : 0;
2798
+		if (empty($category_name)) {
2799
+			$msg = esc_html__('You must add a name for the category.', 'event_espresso');
2800
+			EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__);
2801
+			return false;
2802
+		}
2803
+		$term_args = [
2804
+			'name'        => $category_name,
2805
+			'description' => $category_desc,
2806
+			'parent'      => $category_parent,
2807
+		];
2808
+		// was the category_identifier input disabled?
2809
+		if (isset($this->_req_data['category_identifier'])) {
2810
+			$term_args['slug'] = $this->_req_data['category_identifier'];
2811
+		}
2812
+		$insert_ids = $update
2813
+			? wp_update_term($cat_id, EEM_CPT_Base::EVENT_CATEGORY_TAXONOMY, $term_args)
2814
+			: wp_insert_term($category_name, EEM_CPT_Base::EVENT_CATEGORY_TAXONOMY, $term_args);
2815
+		if (! is_array($insert_ids)) {
2816
+			$msg = esc_html__(
2817
+				'An error occurred and the category has not been saved to the database.',
2818
+				'event_espresso'
2819
+			);
2820
+			EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__);
2821
+		} else {
2822
+			$cat_id = $insert_ids['term_id'];
2823
+			$msg = sprintf(esc_html__('The category %s was successfully saved', 'event_espresso'), $category_name);
2824
+			EE_Error::add_success($msg);
2825
+		}
2826
+		return $cat_id;
2827
+	}
2828
+
2829
+
2830
+	/**
2831
+	 * Gets categories or count of categories matching the arguments in the request.
2832
+	 *
2833
+	 * @param int  $per_page
2834
+	 * @param int  $current_page
2835
+	 * @param bool $count
2836
+	 * @return EE_Base_Class[]|EE_Term_Taxonomy[]|int
2837
+	 * @throws EE_Error
2838
+	 * @throws InvalidArgumentException
2839
+	 * @throws InvalidDataTypeException
2840
+	 * @throws InvalidInterfaceException
2841
+	 */
2842
+	public function get_categories($per_page = 10, $current_page = 1, $count = false)
2843
+	{
2844
+		// testing term stuff
2845
+		$orderby = isset($this->_req_data['orderby']) ? $this->_req_data['orderby'] : 'Term.term_id';
2846
+		$order = isset($this->_req_data['order']) ? $this->_req_data['order'] : 'DESC';
2847
+		$limit = ($current_page - 1) * $per_page;
2848
+		$where = ['taxonomy' => EEM_CPT_Base::EVENT_CATEGORY_TAXONOMY];
2849
+		if (isset($this->_req_data['s'])) {
2850
+			$sstr = '%' . $this->_req_data['s'] . '%';
2851
+			$where['OR'] = [
2852
+				'Term.name'   => ['LIKE', $sstr],
2853
+				'description' => ['LIKE', $sstr],
2854
+			];
2855
+		}
2856
+		$query_params = [
2857
+			$where,
2858
+			'order_by'   => [$orderby => $order],
2859
+			'limit'      => $limit . ',' . $per_page,
2860
+			'force_join' => ['Term'],
2861
+		];
2862
+		$categories = $count
2863
+			? EEM_Term_Taxonomy::instance()->count($query_params, 'term_id')
2864
+			: EEM_Term_Taxonomy::instance()->get_all($query_params);
2865
+		return $categories;
2866
+	}
2867
+
2868
+	/* end category stuff */
2869
+	/**************/
2870
+
2871
+
2872
+	/**
2873
+	 * Callback for the `ee_save_timezone_setting` ajax action.
2874
+	 *
2875
+	 * @throws EE_Error
2876
+	 * @throws InvalidArgumentException
2877
+	 * @throws InvalidDataTypeException
2878
+	 * @throws InvalidInterfaceException
2879
+	 */
2880
+	public function save_timezonestring_setting()
2881
+	{
2882
+		$timezone_string = isset($this->_req_data['timezone_selected'])
2883
+			? $this->_req_data['timezone_selected']
2884
+			: '';
2885
+		if (empty($timezone_string) || ! EEH_DTT_Helper::validate_timezone($timezone_string, false)) {
2886
+			EE_Error::add_error(
2887
+				esc_html__('An invalid timezone string submitted.', 'event_espresso'),
2888
+				__FILE__,
2889
+				__FUNCTION__,
2890
+				__LINE__
2891
+			);
2892
+			$this->_template_args['error'] = true;
2893
+			$this->_return_json();
2894
+		}
2895
+
2896
+		update_option('timezone_string', $timezone_string);
2897
+		EE_Error::add_success(
2898
+			esc_html__('Your timezone string was updated.', 'event_espresso')
2899
+		);
2900
+		$this->_template_args['success'] = true;
2901
+		$this->_return_json(true, ['action' => 'create_new']);
2902
+	}
2903 2903
 }
Please login to merge, or discard this patch.
Spacing   +71 added lines, -71 removed lines patch added patch discarded remove patch
@@ -503,7 +503,7 @@  discard block
 block discarded – undo
503 503
         ];
504 504
         // only load EE_Event_Editor_Decaf_Tips if domain is not caffeinated
505 505
         $domain = $this->loader->getShared('EventEspresso\core\domain\Domain');
506
-        if (! $domain->isCaffeinated()) {
506
+        if ( ! $domain->isCaffeinated()) {
507 507
             $this->_page_config['create_new']['qtips'] = ['EE_Event_Editor_Decaf_Tips'];
508 508
             $this->_page_config['edit']['qtips'] = ['EE_Event_Editor_Decaf_Tips'];
509 509
         }
@@ -562,13 +562,13 @@  discard block
 block discarded – undo
562 562
     {
563 563
         wp_register_style(
564 564
             'events-admin-css',
565
-            EVENTS_ASSETS_URL . 'events-admin-page.css',
565
+            EVENTS_ASSETS_URL.'events-admin-page.css',
566 566
             [],
567 567
             EVENT_ESPRESSO_VERSION
568 568
         );
569 569
         wp_register_style(
570 570
             'ee-cat-admin',
571
-            EVENTS_ASSETS_URL . 'ee-cat-admin.css',
571
+            EVENTS_ASSETS_URL.'ee-cat-admin.css',
572 572
             [],
573 573
             EVENT_ESPRESSO_VERSION
574 574
         );
@@ -577,7 +577,7 @@  discard block
 block discarded – undo
577 577
         // scripts
578 578
         wp_register_script(
579 579
             'event_editor_js',
580
-            EVENTS_ASSETS_URL . 'event_editor.js',
580
+            EVENTS_ASSETS_URL.'event_editor.js',
581 581
             ['ee_admin_js', 'jquery-ui-slider', 'jquery-ui-timepicker-addon'],
582 582
             EVENT_ESPRESSO_VERSION,
583 583
             true
@@ -603,16 +603,16 @@  discard block
 block discarded – undo
603 603
         wp_enqueue_style('espresso-ui-theme');
604 604
         wp_register_style(
605 605
             'event-editor-css',
606
-            EVENTS_ASSETS_URL . 'event-editor.css',
606
+            EVENTS_ASSETS_URL.'event-editor.css',
607 607
             ['ee-admin-css'],
608 608
             EVENT_ESPRESSO_VERSION
609 609
         );
610 610
         wp_enqueue_style('event-editor-css');
611 611
         // scripts
612
-        if (! $this->admin_config->useAdvancedEditor()) {
612
+        if ( ! $this->admin_config->useAdvancedEditor()) {
613 613
             wp_register_script(
614 614
                 'event-datetime-metabox',
615
-                EVENTS_ASSETS_URL . 'event-datetime-metabox.js',
615
+                EVENTS_ASSETS_URL.'event-datetime-metabox.js',
616 616
                 ['event_editor_js', 'ee-datepicker'],
617 617
                 EVENT_ESPRESSO_VERSION
618 618
             );
@@ -682,15 +682,15 @@  discard block
 block discarded – undo
682 682
     public function verify_event_edit($event = null, $req_type = '')
683 683
     {
684 684
         // don't need to do this when processing
685
-        if (! empty($req_type)) {
685
+        if ( ! empty($req_type)) {
686 686
             return;
687 687
         }
688 688
         // no event?
689
-        if (! $event instanceof EE_Event) {
689
+        if ( ! $event instanceof EE_Event) {
690 690
             $event = $this->_cpt_model_obj;
691 691
         }
692 692
         // STILL no event?
693
-        if (! $event instanceof EE_Event) {
693
+        if ( ! $event instanceof EE_Event) {
694 694
             return;
695 695
         }
696 696
         $orig_status = $event->status();
@@ -729,7 +729,7 @@  discard block
 block discarded – undo
729 729
             );
730 730
         }
731 731
         // now we need to determine if the event has any tickets on sale.  If not then we dont' show the error
732
-        if (! $event->tickets_on_sale()) {
732
+        if ( ! $event->tickets_on_sale()) {
733 733
             return;
734 734
         }
735 735
         // made it here so show warning
@@ -777,7 +777,7 @@  discard block
 block discarded – undo
777 777
     {
778 778
         $has_timezone_string = get_option('timezone_string');
779 779
         // only nag them about setting their timezone if it's their first event, and they haven't already done it
780
-        if (! $has_timezone_string && ! EEM_Event::instance()->exists([])) {
780
+        if ( ! $has_timezone_string && ! EEM_Event::instance()->exists([])) {
781 781
             EE_Error::add_attention(
782 782
                 sprintf(
783 783
                     __(
@@ -861,31 +861,31 @@  discard block
 block discarded – undo
861 861
         $items = apply_filters('FHEE__Events_Admin_Page___event_legend_items__items', $items);
862 862
         $statuses = [
863 863
             'sold_out_status'  => [
864
-                'class' => 'ee-status-legend ee-status-legend-' . EE_Datetime::sold_out,
864
+                'class' => 'ee-status-legend ee-status-legend-'.EE_Datetime::sold_out,
865 865
                 'desc'  => EEH_Template::pretty_status(EE_Datetime::sold_out, false, 'sentence'),
866 866
             ],
867 867
             'active_status'    => [
868
-                'class' => 'ee-status-legend ee-status-legend-' . EE_Datetime::active,
868
+                'class' => 'ee-status-legend ee-status-legend-'.EE_Datetime::active,
869 869
                 'desc'  => EEH_Template::pretty_status(EE_Datetime::active, false, 'sentence'),
870 870
             ],
871 871
             'upcoming_status'  => [
872
-                'class' => 'ee-status-legend ee-status-legend-' . EE_Datetime::upcoming,
872
+                'class' => 'ee-status-legend ee-status-legend-'.EE_Datetime::upcoming,
873 873
                 'desc'  => EEH_Template::pretty_status(EE_Datetime::upcoming, false, 'sentence'),
874 874
             ],
875 875
             'postponed_status' => [
876
-                'class' => 'ee-status-legend ee-status-legend-' . EE_Datetime::postponed,
876
+                'class' => 'ee-status-legend ee-status-legend-'.EE_Datetime::postponed,
877 877
                 'desc'  => EEH_Template::pretty_status(EE_Datetime::postponed, false, 'sentence'),
878 878
             ],
879 879
             'cancelled_status' => [
880
-                'class' => 'ee-status-legend ee-status-legend-' . EE_Datetime::cancelled,
880
+                'class' => 'ee-status-legend ee-status-legend-'.EE_Datetime::cancelled,
881 881
                 'desc'  => EEH_Template::pretty_status(EE_Datetime::cancelled, false, 'sentence'),
882 882
             ],
883 883
             'expired_status'   => [
884
-                'class' => 'ee-status-legend ee-status-legend-' . EE_Datetime::expired,
884
+                'class' => 'ee-status-legend ee-status-legend-'.EE_Datetime::expired,
885 885
                 'desc'  => EEH_Template::pretty_status(EE_Datetime::expired, false, 'sentence'),
886 886
             ],
887 887
             'inactive_status'  => [
888
-                'class' => 'ee-status-legend ee-status-legend-' . EE_Datetime::inactive,
888
+                'class' => 'ee-status-legend ee-status-legend-'.EE_Datetime::inactive,
889 889
                 'desc'  => EEH_Template::pretty_status(EE_Datetime::inactive, false, 'sentence'),
890 890
             ],
891 891
         ];
@@ -904,7 +904,7 @@  discard block
 block discarded – undo
904 904
      */
905 905
     private function _event_model()
906 906
     {
907
-        if (! $this->_event_model instanceof EEM_Event) {
907
+        if ( ! $this->_event_model instanceof EEM_Event) {
908 908
             $this->_event_model = EE_Registry::instance()->load_model('Event');
909 909
         }
910 910
         return $this->_event_model;
@@ -924,7 +924,7 @@  discard block
 block discarded – undo
924 924
     public function extra_permalink_field_buttons($return, $id, $new_title, $new_slug)
925 925
     {
926 926
         // make sure this is only when editing
927
-        if (! empty($id)) {
927
+        if ( ! empty($id)) {
928 928
             $post = get_post($id);
929 929
             $return .= '<a class="button button-small" onclick="prompt(\'Shortcode:\', jQuery(\'#shortcode\').val()); return false;" href="#"  tabindex="-1">'
930 930
                        . esc_html__('Shortcode', 'event_espresso')
@@ -962,7 +962,7 @@  discard block
 block discarded – undo
962 962
                                                                                   'button'
963 963
                                                                               );
964 964
         $this->_template_args['after_list_table']['legend'] = $this->_display_legend($this->_event_legend_items());
965
-        $this->_admin_page_title .= ' ' . $this->get_action_link_or_button(
965
+        $this->_admin_page_title .= ' '.$this->get_action_link_or_button(
966 966
             'create_new',
967 967
             'add',
968 968
             [],
@@ -1025,7 +1025,7 @@  discard block
 block discarded – undo
1025 1025
         /** @var FeatureFlags $flags */
1026 1026
         $flags = $this->loader->getShared('EventEspresso\core\domain\services\capabilities\FeatureFlags');
1027 1027
         // check if the new EDTR reg options meta box is being used, and if so, don't run updates for legacy version
1028
-        if (! $this->admin_config->useAdvancedEditor() || ! $flags->featureAllowed('use_reg_options_meta_box')) {
1028
+        if ( ! $this->admin_config->useAdvancedEditor() || ! $flags->featureAllowed('use_reg_options_meta_box')) {
1029 1029
             $event_values['EVT_display_ticket_selector'] =
1030 1030
                 ! empty($this->_req_data['display_ticket_selector'])
1031 1031
                     ? 1
@@ -1135,7 +1135,7 @@  discard block
 block discarded – undo
1135 1135
      */
1136 1136
     protected function _default_venue_update(EE_Event $evtobj, $data)
1137 1137
     {
1138
-        require_once(EE_MODELS . 'EEM_Venue.model.php');
1138
+        require_once(EE_MODELS.'EEM_Venue.model.php');
1139 1139
         $venue_model = EE_Registry::instance()->load_model('Venue');
1140 1140
         $rows_affected = null;
1141 1141
         $venue_id = ! empty($data['venue_id']) ? $data['venue_id'] : null;
@@ -1166,7 +1166,7 @@  discard block
 block discarded – undo
1166 1166
             'status'              => 'publish',
1167 1167
         ];
1168 1168
         // if we've got the venue_id then we're just updating the existing venue so let's do that and then get out.
1169
-        if (! empty($venue_id)) {
1169
+        if ( ! empty($venue_id)) {
1170 1170
             $update_where = [$venue_model->primary_key_name() => $venue_id];
1171 1171
             $rows_affected = $venue_model->update($venue_array, [$update_where]);
1172 1172
             // we've gotta make sure that the venue is always attached to a revision.. add_relation_to should take care of making sure that the relation is already present.
@@ -1216,7 +1216,7 @@  discard block
 block discarded – undo
1216 1216
                 'DTT_order'     => $row,
1217 1217
             ];
1218 1218
             // if we have an id then let's get existing object first and then set the new values.  Otherwise we instantiate a new object for save.
1219
-            if (! empty($dtt['DTT_ID'])) {
1219
+            if ( ! empty($dtt['DTT_ID'])) {
1220 1220
                 $DTM = EE_Registry::instance()
1221 1221
                                   ->load_model('Datetime', [$evtobj->get_timezone()])
1222 1222
                                   ->get_one_by_ID($dtt['DTT_ID']);
@@ -1226,7 +1226,7 @@  discard block
 block discarded – undo
1226 1226
                     $DTM->set($field, $value);
1227 1227
                 }
1228 1228
                 // make sure the $dtt_id here is saved just in case after the add_relation_to() the autosave replaces it.  We need to do this so we dont' TRASH the parent DTT.
1229
-                $saved_dtts[ $DTM->ID() ] = $DTM;
1229
+                $saved_dtts[$DTM->ID()] = $DTM;
1230 1230
             } else {
1231 1231
                 $DTM = EE_Registry::instance()->load_class(
1232 1232
                     'Datetime',
@@ -1259,14 +1259,14 @@  discard block
 block discarded – undo
1259 1259
         foreach ($data['edit_tickets'] as $row => $tkt) {
1260 1260
             $incoming_date_formats = ['Y-m-d', 'h:i a'];
1261 1261
             $update_prices = false;
1262
-            $ticket_price = isset($data['edit_prices'][ $row ][1]['PRC_amount'])
1263
-                ? $data['edit_prices'][ $row ][1]['PRC_amount'] : 0;
1262
+            $ticket_price = isset($data['edit_prices'][$row][1]['PRC_amount'])
1263
+                ? $data['edit_prices'][$row][1]['PRC_amount'] : 0;
1264 1264
             // trim inputs to ensure any excess whitespace is removed.
1265 1265
             $tkt = array_map('trim', $tkt);
1266 1266
             if (empty($tkt['TKT_start_date'])) {
1267 1267
                 // let's use now in the set timezone.
1268 1268
                 $now = new DateTime('now', new DateTimeZone($evtobj->get_timezone()));
1269
-                $tkt['TKT_start_date'] = $now->format($incoming_date_formats[0] . ' ' . $incoming_date_formats[1]);
1269
+                $tkt['TKT_start_date'] = $now->format($incoming_date_formats[0].' '.$incoming_date_formats[1]);
1270 1270
             }
1271 1271
             if (empty($tkt['TKT_end_date'])) {
1272 1272
                 // use the start date of the first datetime
@@ -1301,7 +1301,7 @@  discard block
 block discarded – undo
1301 1301
             // if we have a TKT_ID then we need to get that existing TKT_obj and update it
1302 1302
             // we actually do our saves a head of doing any add_relations to because its entirely possible that this ticket didn't removed or added to any datetime in the session but DID have it's items modified.
1303 1303
             // keep in mind that if the TKT has been sold (and we have changed pricing information), then we won't be updating the tkt but instead a new tkt will be created and the old one archived.
1304
-            if (! empty($tkt['TKT_ID'])) {
1304
+            if ( ! empty($tkt['TKT_ID'])) {
1305 1305
                 $TKT = EE_Registry::instance()
1306 1306
                                   ->load_model('Ticket', [$evtobj->get_timezone()])
1307 1307
                                   ->get_one_by_ID($tkt['TKT_ID']);
@@ -1342,7 +1342,7 @@  discard block
 block discarded – undo
1342 1342
                         $TKT->set('TKT_deleted', 1);
1343 1343
                         $TKT->save();
1344 1344
                         // make sure this ticket is still recorded in our saved_tkts so we don't run it through the regular trash routine.
1345
-                        $saved_tickets[ $TKT->ID() ] = $TKT;
1345
+                        $saved_tickets[$TKT->ID()] = $TKT;
1346 1346
                         // create new ticket that's a copy of the existing except a new id of course (and not archived) AND has the new TKT_price associated with it.
1347 1347
                         $TKT = clone $TKT;
1348 1348
                         $TKT->set('TKT_ID', 0);
@@ -1387,9 +1387,9 @@  discard block
 block discarded – undo
1387 1387
             }
1388 1388
             // initially let's add the ticket to the dtt
1389 1389
             $saved_dtt->_add_relation_to($TKT, 'Ticket');
1390
-            $saved_tickets[ $TKT->ID() ] = $TKT;
1390
+            $saved_tickets[$TKT->ID()] = $TKT;
1391 1391
             // add prices to ticket
1392
-            $this->_add_prices_to_ticket($data['edit_prices'][ $row ], $TKT, $update_prices);
1392
+            $this->_add_prices_to_ticket($data['edit_prices'][$row], $TKT, $update_prices);
1393 1393
         }
1394 1394
         // however now we need to handle permanently deleting tickets via the ui.  Keep in mind that the ui does not allow deleting/archiving tickets that have ticket sold.  However, it does allow for deleting tickets that have no tickets sold, in which case we want to get rid of permanently because there is no need to save in db.
1395 1395
         $old_tickets = isset($old_tickets[0]) && $old_tickets[0] === '' ? [] : $old_tickets;
@@ -1557,7 +1557,7 @@  discard block
 block discarded – undo
1557 1557
         $publish_box_extra_args['event_editor_overview_add'] = ob_get_clean();
1558 1558
         // load template
1559 1559
         EEH_Template::display_template(
1560
-            EVENTS_TEMPLATE_PATH . 'event_publish_box_extras.template.php',
1560
+            EVENTS_TEMPLATE_PATH.'event_publish_box_extras.template.php',
1561 1561
             $publish_box_extra_args
1562 1562
         );
1563 1563
     }
@@ -1593,7 +1593,7 @@  discard block
 block discarded – undo
1593 1593
         /** @var FeatureFlags $flags */
1594 1594
         $flags = $this->loader->getShared('EventEspresso\core\domain\services\capabilities\FeatureFlags');
1595 1595
         // check if the new EDTR reg options meta box is being used, and if so, don't load the legacy version
1596
-        if (! $use_advanced_editor || ! $flags->featureAllowed('use_reg_options_meta_box')) {
1596
+        if ( ! $use_advanced_editor || ! $flags->featureAllowed('use_reg_options_meta_box')) {
1597 1597
             add_meta_box(
1598 1598
                 'espresso_event_editor_event_options',
1599 1599
                 esc_html__('Event Registration Options', 'event_espresso'),
@@ -1603,14 +1603,14 @@  discard block
 block discarded – undo
1603 1603
             );
1604 1604
             add_action(
1605 1605
                 'add_meta_boxes_espresso_events',
1606
-                function () {
1606
+                function() {
1607 1607
                     global $current_screen;
1608 1608
                     remove_meta_box('authordiv', $current_screen, 'normal');
1609 1609
                 },
1610 1610
                 99
1611 1611
             );
1612 1612
         }
1613
-        if (! $use_advanced_editor) {
1613
+        if ( ! $use_advanced_editor) {
1614 1614
             add_meta_box(
1615 1615
                 'espresso_event_editor_tickets',
1616 1616
                 esc_html__('Event Datetime & Ticket', 'event_espresso'),
@@ -1673,7 +1673,7 @@  discard block
 block discarded – undo
1673 1673
                     'default_where_conditions' => 'none',
1674 1674
                 ]
1675 1675
             );
1676
-            if (! empty($related_tickets)) {
1676
+            if ( ! empty($related_tickets)) {
1677 1677
                 $template_args['total_ticket_rows'] = count($related_tickets);
1678 1678
                 $row = 0;
1679 1679
                 foreach ($related_tickets as $ticket) {
@@ -1707,7 +1707,7 @@  discard block
 block discarded – undo
1707 1707
         );
1708 1708
         $template = apply_filters(
1709 1709
             'FHEE__Events_Admin_Page__ticket_metabox__template',
1710
-            EVENTS_TEMPLATE_PATH . 'event_tickets_metabox_main.template.php'
1710
+            EVENTS_TEMPLATE_PATH.'event_tickets_metabox_main.template.php'
1711 1711
         );
1712 1712
         EEH_Template::display_template($template, $template_args);
1713 1713
     }
@@ -1731,7 +1731,7 @@  discard block
 block discarded – undo
1731 1731
     private function _get_ticket_row($ticket, $skeleton = false, $row = 0)
1732 1732
     {
1733 1733
         $template_args = [
1734
-            'tkt_status_class'    => ' tkt-status-' . $ticket->ticket_status(),
1734
+            'tkt_status_class'    => ' tkt-status-'.$ticket->ticket_status(),
1735 1735
             'tkt_archive_class'   => $ticket->ticket_status() === EE_Ticket::archived && ! $skeleton ? ' tkt-archived'
1736 1736
                 : '',
1737 1737
             'ticketrow'           => $skeleton ? 'TICKETNUM' : $row,
@@ -1743,10 +1743,10 @@  discard block
 block discarded – undo
1743 1743
             'TKT_qty'             => $ticket->get_pretty('TKT_qty', 'input'),
1744 1744
             'edit_ticketrow_name' => $skeleton ? 'TICKETNAMEATTR' : 'edit_tickets',
1745 1745
             'TKT_sold'            => $skeleton ? 0 : $ticket->get('TKT_sold'),
1746
-            'trash_icon'          => ($skeleton || (! empty($ticket) && ! $ticket->get('TKT_deleted')))
1747
-                                     && (! empty($ticket) && $ticket->get('TKT_sold') === 0)
1746
+            'trash_icon'          => ($skeleton || ( ! empty($ticket) && ! $ticket->get('TKT_deleted')))
1747
+                                     && ( ! empty($ticket) && $ticket->get('TKT_sold') === 0)
1748 1748
                 ? 'trash-icon dashicons dashicons-post-trash clickable' : 'ee-lock-icon',
1749
-            'disabled'            => $skeleton || (! empty($ticket) && ! $ticket->get('TKT_deleted')) ? ''
1749
+            'disabled'            => $skeleton || ( ! empty($ticket) && ! $ticket->get('TKT_deleted')) ? ''
1750 1750
                 : ' disabled=disabled',
1751 1751
         ];
1752 1752
         $price = $ticket->ID() !== 0
@@ -1773,7 +1773,7 @@  discard block
 block discarded – undo
1773 1773
                     ['order_by' => ['DTT_EVT_start' => 'ASC']]
1774 1774
                 )
1775 1775
                 : null;
1776
-            if (! empty($earliest_dtt)) {
1776
+            if ( ! empty($earliest_dtt)) {
1777 1777
                 $template_args['TKT_end_date'] = $earliest_dtt->get_datetime('DTT_EVT_start', 'Y-m-d', 'h:i a');
1778 1778
             } else {
1779 1779
                 $template_args['TKT_end_date'] = date(
@@ -1785,7 +1785,7 @@  discard block
 block discarded – undo
1785 1785
         $template_args = array_merge($template_args, $price_args);
1786 1786
         $template = apply_filters(
1787 1787
             'FHEE__Events_Admin_Page__get_ticket_row__template',
1788
-            EVENTS_TEMPLATE_PATH . 'event_tickets_metabox_ticket_row.template.php',
1788
+            EVENTS_TEMPLATE_PATH.'event_tickets_metabox_ticket_row.template.php',
1789 1789
             $ticket
1790 1790
         );
1791 1791
         return EEH_Template::display_template($template, $template_args, true);
@@ -1840,7 +1840,7 @@  discard block
 block discarded – undo
1840 1840
             $default_reg_status_values
1841 1841
         );
1842 1842
         EEH_Template::display_template(
1843
-            EVENTS_TEMPLATE_PATH . 'event_registration_options.template.php',
1843
+            EVENTS_TEMPLATE_PATH.'event_registration_options.template.php',
1844 1844
             $template_args
1845 1845
         );
1846 1846
     }
@@ -1870,7 +1870,7 @@  discard block
 block discarded – undo
1870 1870
     {
1871 1871
         $EEME = $this->_event_model();
1872 1872
         $offset = ($current_page - 1) * $per_page;
1873
-        $limit = $count ? null : $offset . ',' . $per_page;
1873
+        $limit = $count ? null : $offset.','.$per_page;
1874 1874
         $orderby = isset($this->_req_data['orderby']) ? $this->_req_data['orderby'] : 'EVT_ID';
1875 1875
         $order = isset($this->_req_data['order']) ? $this->_req_data['order'] : 'DESC';
1876 1876
         if (isset($this->_req_data['month_range'])) {
@@ -1899,7 +1899,7 @@  discard block
 block discarded – undo
1899 1899
         // categories?
1900 1900
         $category = isset($this->_req_data['EVT_CAT']) && $this->_req_data['EVT_CAT'] > 0
1901 1901
             ? $this->_req_data['EVT_CAT'] : null;
1902
-        if (! empty($category)) {
1902
+        if ( ! empty($category)) {
1903 1903
             $where['Term_Taxonomy.taxonomy'] = EEM_CPT_Base::EVENT_CATEGORY_TAXONOMY;
1904 1904
             $where['Term_Taxonomy.term_id'] = $category;
1905 1905
         }
@@ -1907,7 +1907,7 @@  discard block
 block discarded – undo
1907 1907
         $start_formats = EEM_Datetime::instance()->get_formats_for('DTT_EVT_start');
1908 1908
         if (isset($this->_req_data['month_range']) && $this->_req_data['month_range'] !== '') {
1909 1909
             $DateTime = new DateTime(
1910
-                $year_r . '-' . $month_r . '-01 00:00:00',
1910
+                $year_r.'-'.$month_r.'-01 00:00:00',
1911 1911
                 new DateTimeZone('UTC')
1912 1912
             );
1913 1913
             $start = $DateTime->getTimestamp();
@@ -1933,9 +1933,9 @@  discard block
 block discarded – undo
1933 1933
                             ->format(implode(' ', $start_formats));
1934 1934
             $where['Datetime.DTT_EVT_start'] = ['BETWEEN', [$start, $end]];
1935 1935
         }
1936
-        if (! EE_Registry::instance()->CAP->current_user_can('ee_read_others_events', 'get_events')) {
1936
+        if ( ! EE_Registry::instance()->CAP->current_user_can('ee_read_others_events', 'get_events')) {
1937 1937
             $where['EVT_wp_user'] = get_current_user_id();
1938
-        } elseif (! isset($where['status'])
1938
+        } elseif ( ! isset($where['status'])
1939 1939
                   && ! EE_Registry::instance()->CAP->current_user_can('ee_read_private_events', 'get_events')
1940 1940
         ) {
1941 1941
             $where['OR'] = [
@@ -1955,7 +1955,7 @@  discard block
 block discarded – undo
1955 1955
         }
1956 1956
         // search query handling
1957 1957
         if (isset($this->_req_data['s'])) {
1958
-            $search_string = '%' . $this->_req_data['s'] . '%';
1958
+            $search_string = '%'.$this->_req_data['s'].'%';
1959 1959
             $where['OR'] = [
1960 1960
                 'EVT_name'       => ['LIKE', $search_string],
1961 1961
                 'EVT_desc'       => ['LIKE', $search_string],
@@ -2070,7 +2070,7 @@  discard block
 block discarded – undo
2070 2070
             // clean status
2071 2071
             $event_status = sanitize_key($event_status);
2072 2072
             // grab status
2073
-            if (! empty($event_status)) {
2073
+            if ( ! empty($event_status)) {
2074 2074
                 $success = $this->_change_event_status($EVT_ID, $event_status);
2075 2075
             } else {
2076 2076
                 $success = false;
@@ -2112,7 +2112,7 @@  discard block
 block discarded – undo
2112 2112
         // clean status
2113 2113
         $event_status = sanitize_key($event_status);
2114 2114
         // grab status
2115
-        if (! empty($event_status)) {
2115
+        if ( ! empty($event_status)) {
2116 2116
             $success = true;
2117 2117
             // determine the event id and set to array.
2118 2118
             $EVT_IDs = isset($this->_req_data['EVT_IDs']) ? (array) $this->_req_data['EVT_IDs'] : [];
@@ -2164,7 +2164,7 @@  discard block
 block discarded – undo
2164 2164
     private function _change_event_status($EVT_ID = 0, $event_status = '')
2165 2165
     {
2166 2166
         // grab event id
2167
-        if (! $EVT_ID) {
2167
+        if ( ! $EVT_ID) {
2168 2168
             $msg = esc_html__(
2169 2169
                 'An error occurred. No Event ID or an invalid Event ID was received.',
2170 2170
                 'event_espresso'
@@ -2235,8 +2235,8 @@  discard block
 block discarded – undo
2235 2235
             // get list of events with no prices
2236 2236
             $espresso_no_ticket_prices = get_option('ee_no_ticket_prices', []);
2237 2237
             // remove this event from the list of events with no prices
2238
-            if (isset($espresso_no_ticket_prices[ $EVT_ID ])) {
2239
-                unset($espresso_no_ticket_prices[ $EVT_ID ]);
2238
+            if (isset($espresso_no_ticket_prices[$EVT_ID])) {
2239
+                unset($espresso_no_ticket_prices[$EVT_ID]);
2240 2240
             }
2241 2241
             update_option('ee_no_ticket_prices', $espresso_no_ticket_prices);
2242 2242
         } else {
@@ -2283,7 +2283,7 @@  discard block
 block discarded – undo
2283 2283
                 $results = $this->_permanently_delete_event($EVT_ID);
2284 2284
                 $success = $results !== false ? $success : false;
2285 2285
                 // remove this event from the list of events with no prices
2286
-                unset($espresso_no_ticket_prices[ $EVT_ID ]);
2286
+                unset($espresso_no_ticket_prices[$EVT_ID]);
2287 2287
             } else {
2288 2288
                 $success = false;
2289 2289
                 $msg = esc_html__(
@@ -2315,7 +2315,7 @@  discard block
 block discarded – undo
2315 2315
     private function _permanently_delete_event($EVT_ID = 0)
2316 2316
     {
2317 2317
         // grab event id
2318
-        if (! $EVT_ID) {
2318
+        if ( ! $EVT_ID) {
2319 2319
             $msg = esc_html__(
2320 2320
                 'An error occurred. No Event ID or an invalid Event ID was received.',
2321 2321
                 'event_espresso'
@@ -2323,12 +2323,12 @@  discard block
 block discarded – undo
2323 2323
             EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__);
2324 2324
             return false;
2325 2325
         }
2326
-        if (! $this->_cpt_model_obj instanceof EE_Event
2326
+        if ( ! $this->_cpt_model_obj instanceof EE_Event
2327 2327
             || $this->_cpt_model_obj->ID() !== $EVT_ID
2328 2328
         ) {
2329 2329
             $this->_cpt_model_obj = EEM_Event::instance()->get_one_by_ID($EVT_ID);
2330 2330
         }
2331
-        if (! $this->_cpt_model_obj instanceof EE_Event) {
2331
+        if ( ! $this->_cpt_model_obj instanceof EE_Event) {
2332 2332
             return false;
2333 2333
         }
2334 2334
         // need to delete related tickets and prices first.
@@ -2350,7 +2350,7 @@  discard block
 block discarded – undo
2350 2350
         }
2351 2351
         // any attached question groups?
2352 2352
         $question_groups = $this->_cpt_model_obj->get_many_related('Question_Group');
2353
-        if (! empty($question_groups)) {
2353
+        if ( ! empty($question_groups)) {
2354 2354
             foreach ($question_groups as $question_group) {
2355 2355
                 $this->_cpt_model_obj->_remove_relation_to($question_group, 'Question_Group');
2356 2356
             }
@@ -2583,7 +2583,7 @@  discard block
 block discarded – undo
2583 2583
                                                 . esc_html__(
2584 2584
                                                     'Template Settings is a feature that is only available in the premium version of Event Espresso 4 which is available with a support license purchase on EventEspresso.com. Template Settings allow you to configure some of the appearance options for both the Event List and Event Details pages.',
2585 2585
                                                     'event_espresso'
2586
-                                                ) . '</strong>';
2586
+                                                ).'</strong>';
2587 2587
         $this->display_admin_caf_preview_page('template_settings_tab');
2588 2588
     }
2589 2589
 
@@ -2603,12 +2603,12 @@  discard block
 block discarded – undo
2603 2603
         // set default category object
2604 2604
         $this->_set_empty_category_object();
2605 2605
         // only set if we've got an id
2606
-        if (! isset($this->_req_data['EVT_CAT_ID'])) {
2606
+        if ( ! isset($this->_req_data['EVT_CAT_ID'])) {
2607 2607
             return;
2608 2608
         }
2609 2609
         $category_id = absint($this->_req_data['EVT_CAT_ID']);
2610 2610
         $term = get_term($category_id, EEM_CPT_Base::EVENT_CATEGORY_TAXONOMY);
2611
-        if (! empty($term)) {
2611
+        if ( ! empty($term)) {
2612 2612
             $this->_category->category_name = $term->name;
2613 2613
             $this->_category->category_identifier = $term->slug;
2614 2614
             $this->_category->category_desc = $term->description;
@@ -2640,7 +2640,7 @@  discard block
 block discarded – undo
2640 2640
     {
2641 2641
         do_action('AHEE_log', __FILE__, __FUNCTION__, '');
2642 2642
         $this->_search_btn_label = esc_html__('Categories', 'event_espresso');
2643
-        $this->_admin_page_title .= ' ' . $this->get_action_link_or_button(
2643
+        $this->_admin_page_title .= ' '.$this->get_action_link_or_button(
2644 2644
             'add_category',
2645 2645
             'add_category',
2646 2646
             [],
@@ -2723,7 +2723,7 @@  discard block
 block discarded – undo
2723 2723
             'disable'                  => '',
2724 2724
             'disabled_message'         => false,
2725 2725
         ];
2726
-        $template = EVENTS_TEMPLATE_PATH . 'event_category_details.template.php';
2726
+        $template = EVENTS_TEMPLATE_PATH.'event_category_details.template.php';
2727 2727
         return EEH_Template::display_template($template, $template_args, true);
2728 2728
     }
2729 2729
 
@@ -2812,7 +2812,7 @@  discard block
 block discarded – undo
2812 2812
         $insert_ids = $update
2813 2813
             ? wp_update_term($cat_id, EEM_CPT_Base::EVENT_CATEGORY_TAXONOMY, $term_args)
2814 2814
             : wp_insert_term($category_name, EEM_CPT_Base::EVENT_CATEGORY_TAXONOMY, $term_args);
2815
-        if (! is_array($insert_ids)) {
2815
+        if ( ! is_array($insert_ids)) {
2816 2816
             $msg = esc_html__(
2817 2817
                 'An error occurred and the category has not been saved to the database.',
2818 2818
                 'event_espresso'
@@ -2847,7 +2847,7 @@  discard block
 block discarded – undo
2847 2847
         $limit = ($current_page - 1) * $per_page;
2848 2848
         $where = ['taxonomy' => EEM_CPT_Base::EVENT_CATEGORY_TAXONOMY];
2849 2849
         if (isset($this->_req_data['s'])) {
2850
-            $sstr = '%' . $this->_req_data['s'] . '%';
2850
+            $sstr = '%'.$this->_req_data['s'].'%';
2851 2851
             $where['OR'] = [
2852 2852
                 'Term.name'   => ['LIKE', $sstr],
2853 2853
                 'description' => ['LIKE', $sstr],
@@ -2856,7 +2856,7 @@  discard block
 block discarded – undo
2856 2856
         $query_params = [
2857 2857
             $where,
2858 2858
             'order_by'   => [$orderby => $order],
2859
-            'limit'      => $limit . ',' . $per_page,
2859
+            'limit'      => $limit.','.$per_page,
2860 2860
             'force_join' => ['Term'],
2861 2861
         ];
2862 2862
         $categories = $count
Please login to merge, or discard this patch.
core/EE_Dependency_Map.core.php 1 patch
Indentation   +994 added lines, -994 removed lines patch added patch discarded remove patch
@@ -21,998 +21,998 @@
 block discarded – undo
21 21
 class EE_Dependency_Map
22 22
 {
23 23
 
24
-    /**
25
-     * This means that the requested class dependency is not present in the dependency map
26
-     */
27
-    const not_registered = 0;
28
-
29
-    /**
30
-     * This instructs class loaders to ALWAYS return a newly instantiated object for the requested class.
31
-     */
32
-    const load_new_object = 1;
33
-
34
-    /**
35
-     * This instructs class loaders to return a previously instantiated and cached object for the requested class.
36
-     * IF a previously instantiated object does not exist, a new one will be created and added to the cache.
37
-     */
38
-    const load_from_cache = 2;
39
-
40
-    /**
41
-     * When registering a dependency,
42
-     * this indicates to keep any existing dependencies that already exist,
43
-     * and simply discard any new dependencies declared in the incoming data
44
-     */
45
-    const KEEP_EXISTING_DEPENDENCIES = 0;
46
-
47
-    /**
48
-     * When registering a dependency,
49
-     * this indicates to overwrite any existing dependencies that already exist using the incoming data
50
-     */
51
-    const OVERWRITE_DEPENDENCIES = 1;
52
-
53
-    /**
54
-     * @type EE_Dependency_Map $_instance
55
-     */
56
-    protected static $_instance;
57
-
58
-    /**
59
-     * @var ClassInterfaceCache $class_cache
60
-     */
61
-    private $class_cache;
62
-
63
-    /**
64
-     * @type RequestInterface $request
65
-     */
66
-    protected $request;
67
-
68
-    /**
69
-     * @type LegacyRequestInterface $legacy_request
70
-     */
71
-    protected $legacy_request;
72
-
73
-    /**
74
-     * @type ResponseInterface $response
75
-     */
76
-    protected $response;
77
-
78
-    /**
79
-     * @type LoaderInterface $loader
80
-     */
81
-    protected $loader;
82
-
83
-    /**
84
-     * @type array $_dependency_map
85
-     */
86
-    protected $_dependency_map = [];
87
-
88
-    /**
89
-     * @type array $_class_loaders
90
-     */
91
-    protected $_class_loaders = [];
92
-
93
-
94
-    /**
95
-     * EE_Dependency_Map constructor.
96
-     *
97
-     * @param ClassInterfaceCache $class_cache
98
-     */
99
-    protected function __construct(ClassInterfaceCache $class_cache)
100
-    {
101
-        $this->class_cache = $class_cache;
102
-        do_action('EE_Dependency_Map____construct', $this);
103
-    }
104
-
105
-
106
-    /**
107
-     * @return void
108
-     * @throws InvalidAliasException
109
-     */
110
-    public function initialize()
111
-    {
112
-        $this->_register_core_dependencies();
113
-        $this->_register_core_class_loaders();
114
-        $this->_register_core_aliases();
115
-    }
116
-
117
-
118
-    /**
119
-     * @singleton method used to instantiate class object
120
-     * @param ClassInterfaceCache|null $class_cache
121
-     * @return EE_Dependency_Map
122
-     */
123
-    public static function instance(ClassInterfaceCache $class_cache = null)
124
-    {
125
-        // check if class object is instantiated, and instantiated properly
126
-        if (! EE_Dependency_Map::$_instance instanceof EE_Dependency_Map
127
-            && $class_cache instanceof ClassInterfaceCache
128
-        ) {
129
-            EE_Dependency_Map::$_instance = new EE_Dependency_Map($class_cache);
130
-        }
131
-        return EE_Dependency_Map::$_instance;
132
-    }
133
-
134
-
135
-    /**
136
-     * @param RequestInterface $request
137
-     */
138
-    public function setRequest(RequestInterface $request)
139
-    {
140
-        $this->request = $request;
141
-    }
142
-
143
-
144
-    /**
145
-     * @param LegacyRequestInterface $legacy_request
146
-     */
147
-    public function setLegacyRequest(LegacyRequestInterface $legacy_request)
148
-    {
149
-        $this->legacy_request = $legacy_request;
150
-    }
151
-
152
-
153
-    /**
154
-     * @param ResponseInterface $response
155
-     */
156
-    public function setResponse(ResponseInterface $response)
157
-    {
158
-        $this->response = $response;
159
-    }
160
-
161
-
162
-    /**
163
-     * @param LoaderInterface $loader
164
-     */
165
-    public function setLoader(LoaderInterface $loader)
166
-    {
167
-        $this->loader = $loader;
168
-    }
169
-
170
-
171
-    /**
172
-     * @param string $class
173
-     * @param array  $dependencies
174
-     * @param int    $overwrite
175
-     * @return bool
176
-     */
177
-    public static function register_dependencies(
178
-        $class,
179
-        array $dependencies,
180
-        $overwrite = EE_Dependency_Map::KEEP_EXISTING_DEPENDENCIES
181
-    ) {
182
-        return EE_Dependency_Map::$_instance->registerDependencies($class, $dependencies, $overwrite);
183
-    }
184
-
185
-
186
-    /**
187
-     * Assigns an array of class names and corresponding load sources (new or cached)
188
-     * to the class specified by the first parameter.
189
-     * IMPORTANT !!!
190
-     * The order of elements in the incoming $dependencies array MUST match
191
-     * the order of the constructor parameters for the class in question.
192
-     * This is especially important when overriding any existing dependencies that are registered.
193
-     * the third parameter controls whether any duplicate dependencies are overwritten or not.
194
-     *
195
-     * @param string $class
196
-     * @param array  $dependencies
197
-     * @param int    $overwrite
198
-     * @return bool
199
-     */
200
-    public function registerDependencies(
201
-        $class,
202
-        array $dependencies,
203
-        $overwrite = EE_Dependency_Map::KEEP_EXISTING_DEPENDENCIES
204
-    ) {
205
-        $class = trim($class, '\\');
206
-        $registered = false;
207
-        if (empty(EE_Dependency_Map::$_instance->_dependency_map[ $class ])) {
208
-            EE_Dependency_Map::$_instance->_dependency_map[ $class ] = [];
209
-        }
210
-        // we need to make sure that any aliases used when registering a dependency
211
-        // get resolved to the correct class name
212
-        foreach ($dependencies as $dependency => $load_source) {
213
-            $alias = EE_Dependency_Map::$_instance->getFqnForAlias($dependency);
214
-            if ($overwrite === EE_Dependency_Map::OVERWRITE_DEPENDENCIES
215
-                || ! isset(EE_Dependency_Map::$_instance->_dependency_map[ $class ][ $alias ])
216
-            ) {
217
-                unset($dependencies[ $dependency ]);
218
-                $dependencies[ $alias ] = $load_source;
219
-                $registered = true;
220
-            }
221
-        }
222
-        // now add our two lists of dependencies together.
223
-        // using Union (+=) favours the arrays in precedence from left to right,
224
-        // so $dependencies is NOT overwritten because it is listed first
225
-        // ie: with A = B + C, entries in B take precedence over duplicate entries in C
226
-        // Union is way faster than array_merge() but should be used with caution...
227
-        // especially with numerically indexed arrays
228
-        $dependencies += EE_Dependency_Map::$_instance->_dependency_map[ $class ];
229
-        // now we need to ensure that the resulting dependencies
230
-        // array only has the entries that are required for the class
231
-        // so first count how many dependencies were originally registered for the class
232
-        $dependency_count = count(EE_Dependency_Map::$_instance->_dependency_map[ $class ]);
233
-        // if that count is non-zero (meaning dependencies were already registered)
234
-        EE_Dependency_Map::$_instance->_dependency_map[ $class ] = $dependency_count
235
-            // then truncate the  final array to match that count
236
-            ? array_slice($dependencies, 0, $dependency_count)
237
-            // otherwise just take the incoming array because nothing previously existed
238
-            : $dependencies;
239
-        return $registered;
240
-    }
241
-
242
-
243
-    /**
244
-     * @param string $class_name
245
-     * @param string $loader
246
-     * @return bool
247
-     * @throws DomainException
248
-     */
249
-    public static function register_class_loader($class_name, $loader = 'load_core')
250
-    {
251
-        return EE_Dependency_Map::$_instance->registerClassLoader($class_name, $loader);
252
-    }
253
-
254
-
255
-    /**
256
-     * @param string $class_name
257
-     * @param string $loader
258
-     * @return bool
259
-     * @throws DomainException
260
-     */
261
-    public function registerClassLoader($class_name, $loader = 'load_core')
262
-    {
263
-        if (! $loader instanceof Closure && strpos($class_name, '\\') !== false) {
264
-            throw new DomainException(
265
-                esc_html__('Don\'t use class loaders for FQCNs.', 'event_espresso')
266
-            );
267
-        }
268
-        // check that loader is callable or method starts with "load_" and exists in EE_Registry
269
-        if (! is_callable($loader)
270
-            && (
271
-                strpos($loader, 'load_') !== 0
272
-                || ! method_exists('EE_Registry', $loader)
273
-            )
274
-        ) {
275
-            throw new DomainException(
276
-                sprintf(
277
-                    esc_html__(
278
-                        '"%1$s" is not a valid loader method on EE_Registry.',
279
-                        'event_espresso'
280
-                    ),
281
-                    $loader
282
-                )
283
-            );
284
-        }
285
-        $class_name = EE_Dependency_Map::$_instance->getFqnForAlias($class_name);
286
-        if (! isset(EE_Dependency_Map::$_instance->_class_loaders[ $class_name ])) {
287
-            EE_Dependency_Map::$_instance->_class_loaders[ $class_name ] = $loader;
288
-            return true;
289
-        }
290
-        return false;
291
-    }
292
-
293
-
294
-    /**
295
-     * @return array
296
-     */
297
-    public function dependency_map()
298
-    {
299
-        return $this->_dependency_map;
300
-    }
301
-
302
-
303
-    /**
304
-     * returns TRUE if dependency map contains a listing for the provided class name
305
-     *
306
-     * @param string $class_name
307
-     * @return boolean
308
-     */
309
-    public function has($class_name = '')
310
-    {
311
-        // all legacy models have the same dependencies
312
-        if (strpos($class_name, 'EEM_') === 0) {
313
-            $class_name = 'LEGACY_MODELS';
314
-        }
315
-        return isset($this->_dependency_map[ $class_name ]);
316
-    }
317
-
318
-
319
-    /**
320
-     * returns TRUE if dependency map contains a listing for the provided class name AND dependency
321
-     *
322
-     * @param string $class_name
323
-     * @param string $dependency
324
-     * @return bool
325
-     */
326
-    public function has_dependency_for_class($class_name = '', $dependency = '')
327
-    {
328
-        // all legacy models have the same dependencies
329
-        if (strpos($class_name, 'EEM_') === 0) {
330
-            $class_name = 'LEGACY_MODELS';
331
-        }
332
-        $dependency = $this->getFqnForAlias($dependency, $class_name);
333
-        return isset($this->_dependency_map[ $class_name ][ $dependency ]);
334
-    }
335
-
336
-
337
-    /**
338
-     * returns loading strategy for whether a previously cached dependency should be loaded or a new instance returned
339
-     *
340
-     * @param string $class_name
341
-     * @param string $dependency
342
-     * @return int
343
-     */
344
-    public function loading_strategy_for_class_dependency($class_name = '', $dependency = '')
345
-    {
346
-        // all legacy models have the same dependencies
347
-        if (strpos($class_name, 'EEM_') === 0) {
348
-            $class_name = 'LEGACY_MODELS';
349
-        }
350
-        $dependency = $this->getFqnForAlias($dependency);
351
-        return $this->has_dependency_for_class($class_name, $dependency)
352
-            ? $this->_dependency_map[ $class_name ][ $dependency ]
353
-            : EE_Dependency_Map::not_registered;
354
-    }
355
-
356
-
357
-    /**
358
-     * @param string $class_name
359
-     * @return string | Closure
360
-     */
361
-    public function class_loader($class_name)
362
-    {
363
-        // all legacy models use load_model()
364
-        if (strpos($class_name, 'EEM_') === 0) {
365
-            return 'load_model';
366
-        }
367
-        // EE_CPT_*_Strategy classes like EE_CPT_Event_Strategy, EE_CPT_Venue_Strategy, etc
368
-        // perform strpos() first to avoid loading regex every time we load a class
369
-        if (strpos($class_name, 'EE_CPT_') === 0
370
-            && preg_match('/^EE_CPT_([a-zA-Z]+)_Strategy$/', $class_name)
371
-        ) {
372
-            return 'load_core';
373
-        }
374
-        $class_name = $this->getFqnForAlias($class_name);
375
-        return isset($this->_class_loaders[ $class_name ]) ? $this->_class_loaders[ $class_name ] : '';
376
-    }
377
-
378
-
379
-    /**
380
-     * @return array
381
-     */
382
-    public function class_loaders()
383
-    {
384
-        return $this->_class_loaders;
385
-    }
386
-
387
-
388
-    /**
389
-     * adds an alias for a classname
390
-     *
391
-     * @param string $fqcn      the class name that should be used (concrete class to replace interface)
392
-     * @param string $alias     the class name that would be type hinted for (abstract parent or interface)
393
-     * @param string $for_class the class that has the dependency (is type hinting for the interface)
394
-     * @throws InvalidAliasException
395
-     */
396
-    public function add_alias($fqcn, $alias, $for_class = '')
397
-    {
398
-        $this->class_cache->addAlias($fqcn, $alias, $for_class);
399
-    }
400
-
401
-
402
-    /**
403
-     * Returns TRUE if the provided fully qualified name IS an alias
404
-     * WHY?
405
-     * Because if a class is type hinting for a concretion,
406
-     * then why would we need to find another class to supply it?
407
-     * ie: if a class asks for `Fully/Qualified/Namespace/SpecificClassName`,
408
-     * then give it an instance of `Fully/Qualified/Namespace/SpecificClassName`.
409
-     * Don't go looking for some substitute.
410
-     * Whereas if a class is type hinting for an interface...
411
-     * then we need to find an actual class to use.
412
-     * So the interface IS the alias for some other FQN,
413
-     * and we need to find out if `Fully/Qualified/Namespace/SomeInterface`
414
-     * represents some other class.
415
-     *
416
-     * @param string $fqn
417
-     * @param string $for_class
418
-     * @return bool
419
-     */
420
-    public function isAlias($fqn = '', $for_class = '')
421
-    {
422
-        return $this->class_cache->isAlias($fqn, $for_class);
423
-    }
424
-
425
-
426
-    /**
427
-     * Returns a FQN for provided alias if one exists, otherwise returns the original $alias
428
-     * functions recursively, so that multiple aliases can be used to drill down to a FQN
429
-     *  for example:
430
-     *      if the following two entries were added to the _aliases array:
431
-     *          array(
432
-     *              'interface_alias'           => 'some\namespace\interface'
433
-     *              'some\namespace\interface'  => 'some\namespace\classname'
434
-     *          )
435
-     *      then one could use EE_Registry::instance()->create( 'interface_alias' )
436
-     *      to load an instance of 'some\namespace\classname'
437
-     *
438
-     * @param string $alias
439
-     * @param string $for_class
440
-     * @return string
441
-     */
442
-    public function getFqnForAlias($alias = '', $for_class = '')
443
-    {
444
-        return (string) $this->class_cache->getFqnForAlias($alias, $for_class);
445
-    }
446
-
447
-
448
-    /**
449
-     * Registers the core dependencies and whether a previously instantiated object should be loaded from the cache,
450
-     * if one exists, or whether a new object should be generated every time the requested class is loaded.
451
-     * This is done by using the following class constants:
452
-     *        EE_Dependency_Map::load_from_cache - loads previously instantiated object
453
-     *        EE_Dependency_Map::load_new_object - generates a new object every time
454
-     */
455
-    protected function _register_core_dependencies()
456
-    {
457
-        $this->_dependency_map = [
458
-            'EE_Request_Handler'                                                                                          => [
459
-                'EE_Request' => EE_Dependency_Map::load_from_cache,
460
-            ],
461
-            'EE_System'                                                                                                   => [
462
-                'EventEspresso\core\services\loaders\Loader'  => EE_Dependency_Map::load_from_cache,
463
-                'EE_Maintenance_Mode'                         => EE_Dependency_Map::load_from_cache,
464
-                'EE_Registry'                                 => EE_Dependency_Map::load_from_cache,
465
-                'EventEspresso\core\services\request\Request' => EE_Dependency_Map::load_from_cache,
466
-                'EventEspresso\core\services\routing\Router'  => EE_Dependency_Map::load_from_cache,
467
-            ],
468
-            'EE_Admin'                                                                                                    => [
469
-                'EventEspresso\core\services\loaders\Loader'  => EE_Dependency_Map::load_from_cache,
470
-                'EventEspresso\core\services\request\Request' => EE_Dependency_Map::load_from_cache,
471
-            ],
472
-            'EE_Cart'                                                                                                     => [
473
-                'EE_Session' => EE_Dependency_Map::load_from_cache,
474
-            ],
475
-            'EE_Messenger_Collection_Loader'                                                                              => [
476
-                'EE_Messenger_Collection' => EE_Dependency_Map::load_new_object,
477
-            ],
478
-            'EE_Message_Type_Collection_Loader'                                                                           => [
479
-                'EE_Message_Type_Collection' => EE_Dependency_Map::load_new_object,
480
-            ],
481
-            'EE_Message_Resource_Manager'                                                                                 => [
482
-                'EE_Messenger_Collection_Loader'    => EE_Dependency_Map::load_new_object,
483
-                'EE_Message_Type_Collection_Loader' => EE_Dependency_Map::load_new_object,
484
-                'EEM_Message_Template_Group'        => EE_Dependency_Map::load_from_cache,
485
-            ],
486
-            'EE_Message_Factory'                                                                                          => [
487
-                'EE_Message_Resource_Manager' => EE_Dependency_Map::load_from_cache,
488
-            ],
489
-            'EE_messages'                                                                                                 => [
490
-                'EE_Message_Resource_Manager' => EE_Dependency_Map::load_from_cache,
491
-            ],
492
-            'EE_Messages_Generator'                                                                                       => [
493
-                'EE_Messages_Queue'                    => EE_Dependency_Map::load_new_object,
494
-                'EE_Messages_Data_Handler_Collection'  => EE_Dependency_Map::load_new_object,
495
-                'EE_Message_Template_Group_Collection' => EE_Dependency_Map::load_new_object,
496
-                'EEH_Parse_Shortcodes'                 => EE_Dependency_Map::load_from_cache,
497
-            ],
498
-            'EE_Messages_Processor'                                                                                       => [
499
-                'EE_Message_Resource_Manager' => EE_Dependency_Map::load_from_cache,
500
-            ],
501
-            'EE_Messages_Queue'                                                                                           => [
502
-                'EE_Message_Repository' => EE_Dependency_Map::load_new_object,
503
-            ],
504
-            'EE_Messages_Template_Defaults'                                                                               => [
505
-                'EEM_Message_Template_Group' => EE_Dependency_Map::load_from_cache,
506
-                'EEM_Message_Template'       => EE_Dependency_Map::load_from_cache,
507
-            ],
508
-            'EE_Message_To_Generate_From_Request'                                                                         => [
509
-                'EE_Message_Resource_Manager' => EE_Dependency_Map::load_from_cache,
510
-                'EE_Request_Handler'          => EE_Dependency_Map::load_from_cache,
511
-            ],
512
-            'EventEspresso\core\services\commands\CommandBus'                                                             => [
513
-                'EventEspresso\core\services\commands\CommandHandlerManager' => EE_Dependency_Map::load_from_cache,
514
-            ],
515
-            'EventEspresso\services\commands\CommandHandler'                                                              => [
516
-                'EE_Registry'         => EE_Dependency_Map::load_from_cache,
517
-                'CommandBusInterface' => EE_Dependency_Map::load_from_cache,
518
-            ],
519
-            'EventEspresso\core\services\commands\CommandHandlerManager'                                                  => [
520
-                'EventEspresso\core\services\loaders\Loader' => EE_Dependency_Map::load_from_cache,
521
-            ],
522
-            'EventEspresso\core\services\commands\CompositeCommandHandler'                                                => [
523
-                'EventEspresso\core\services\commands\CommandBus'     => EE_Dependency_Map::load_from_cache,
524
-                'EventEspresso\core\services\commands\CommandFactory' => EE_Dependency_Map::load_from_cache,
525
-            ],
526
-            'EventEspresso\core\services\commands\CommandFactory'                                                         => [
527
-                'EventEspresso\core\services\loaders\Loader' => EE_Dependency_Map::load_from_cache,
528
-            ],
529
-            'EventEspresso\core\services\commands\middleware\CapChecker'                                                  => [
530
-                'EventEspresso\core\domain\services\capabilities\CapabilitiesChecker' => EE_Dependency_Map::load_from_cache,
531
-            ],
532
-            'EventEspresso\core\domain\services\capabilities\CapabilitiesChecker'                                         => [
533
-                'EE_Capabilities' => EE_Dependency_Map::load_from_cache,
534
-            ],
535
-            'EventEspresso\core\domain\services\capabilities\RegistrationsCapChecker'                                     => [
536
-                'EE_Capabilities' => EE_Dependency_Map::load_from_cache,
537
-            ],
538
-            'EventEspresso\core\services\commands\registration\CreateRegistrationCommandHandler'                          => [
539
-                'EventEspresso\core\domain\services\registration\CreateRegistrationService' => EE_Dependency_Map::load_from_cache,
540
-            ],
541
-            'EventEspresso\core\services\commands\registration\CopyRegistrationDetailsCommandHandler'                     => [
542
-                'EventEspresso\core\domain\services\registration\CopyRegistrationService' => EE_Dependency_Map::load_from_cache,
543
-            ],
544
-            'EventEspresso\core\services\commands\registration\CopyRegistrationPaymentsCommandHandler'                    => [
545
-                'EventEspresso\core\domain\services\registration\CopyRegistrationService' => EE_Dependency_Map::load_from_cache,
546
-            ],
547
-            'EventEspresso\core\services\commands\registration\CancelRegistrationAndTicketLineItemCommandHandler'         => [
548
-                'EventEspresso\core\domain\services\registration\CancelTicketLineItemService' => EE_Dependency_Map::load_from_cache,
549
-            ],
550
-            'EventEspresso\core\services\commands\registration\UpdateRegistrationAndTransactionAfterChangeCommandHandler' => [
551
-                'EventEspresso\core\domain\services\registration\UpdateRegistrationService' => EE_Dependency_Map::load_from_cache,
552
-            ],
553
-            'EventEspresso\core\services\commands\ticket\CreateTicketLineItemCommandHandler'                              => [
554
-                'EventEspresso\core\domain\services\ticket\CreateTicketLineItemService' => EE_Dependency_Map::load_from_cache,
555
-            ],
556
-            'EventEspresso\core\services\commands\ticket\CancelTicketLineItemCommandHandler'                              => [
557
-                'EventEspresso\core\domain\services\ticket\CancelTicketLineItemService' => EE_Dependency_Map::load_from_cache,
558
-            ],
559
-            'EventEspresso\core\domain\services\registration\CancelRegistrationService'                                   => [
560
-                'EventEspresso\core\domain\services\ticket\CancelTicketLineItemService' => EE_Dependency_Map::load_from_cache,
561
-            ],
562
-            'EventEspresso\core\services\commands\attendee\CreateAttendeeCommandHandler'                                  => [
563
-                'EEM_Attendee' => EE_Dependency_Map::load_from_cache,
564
-            ],
565
-            'EventEspresso\core\services\database\TableManager'                                                           => [
566
-                'EventEspresso\core\services\database\TableAnalysis' => EE_Dependency_Map::load_from_cache,
567
-            ],
568
-            'EE_Data_Migration_Class_Base'                                                                                => [
569
-                'EventEspresso\core\services\database\TableAnalysis' => EE_Dependency_Map::load_from_cache,
570
-                'EventEspresso\core\services\database\TableManager'  => EE_Dependency_Map::load_from_cache,
571
-            ],
572
-            'EE_DMS_Core_4_1_0'                                                                                           => [
573
-                'EventEspresso\core\services\database\TableAnalysis' => EE_Dependency_Map::load_from_cache,
574
-                'EventEspresso\core\services\database\TableManager'  => EE_Dependency_Map::load_from_cache,
575
-            ],
576
-            'EE_DMS_Core_4_2_0'                                                                                           => [
577
-                'EventEspresso\core\services\database\TableAnalysis' => EE_Dependency_Map::load_from_cache,
578
-                'EventEspresso\core\services\database\TableManager'  => EE_Dependency_Map::load_from_cache,
579
-            ],
580
-            'EE_DMS_Core_4_3_0'                                                                                           => [
581
-                'EventEspresso\core\services\database\TableAnalysis' => EE_Dependency_Map::load_from_cache,
582
-                'EventEspresso\core\services\database\TableManager'  => EE_Dependency_Map::load_from_cache,
583
-            ],
584
-            'EE_DMS_Core_4_4_0'                                                                                           => [
585
-                'EventEspresso\core\services\database\TableAnalysis' => EE_Dependency_Map::load_from_cache,
586
-                'EventEspresso\core\services\database\TableManager'  => EE_Dependency_Map::load_from_cache,
587
-            ],
588
-            'EE_DMS_Core_4_5_0'                                                                                           => [
589
-                'EventEspresso\core\services\database\TableAnalysis' => EE_Dependency_Map::load_from_cache,
590
-                'EventEspresso\core\services\database\TableManager'  => EE_Dependency_Map::load_from_cache,
591
-            ],
592
-            'EE_DMS_Core_4_6_0'                                                                                           => [
593
-                'EventEspresso\core\services\database\TableAnalysis' => EE_Dependency_Map::load_from_cache,
594
-                'EventEspresso\core\services\database\TableManager'  => EE_Dependency_Map::load_from_cache,
595
-            ],
596
-            'EE_DMS_Core_4_7_0'                                                                                           => [
597
-                'EventEspresso\core\services\database\TableAnalysis' => EE_Dependency_Map::load_from_cache,
598
-                'EventEspresso\core\services\database\TableManager'  => EE_Dependency_Map::load_from_cache,
599
-            ],
600
-            'EE_DMS_Core_4_8_0'                                                                                           => [
601
-                'EventEspresso\core\services\database\TableAnalysis' => EE_Dependency_Map::load_from_cache,
602
-                'EventEspresso\core\services\database\TableManager'  => EE_Dependency_Map::load_from_cache,
603
-            ],
604
-            'EE_DMS_Core_4_9_0'                                                                                           => [
605
-                'EventEspresso\core\services\database\TableAnalysis' => EE_Dependency_Map::load_from_cache,
606
-                'EventEspresso\core\services\database\TableManager'  => EE_Dependency_Map::load_from_cache,
607
-            ],
608
-            'EE_DMS_Core_4_10_0'                                                                                          => [
609
-                'EventEspresso\core\services\database\TableAnalysis' => EE_Dependency_Map::load_from_cache,
610
-                'EventEspresso\core\services\database\TableManager'  => EE_Dependency_Map::load_from_cache,
611
-                'EE_DMS_Core_4_9_0'                                  => EE_Dependency_Map::load_from_cache,
612
-            ],
613
-            'EventEspresso\core\services\assets\Registry'                                                                 => [
614
-                'EventEspresso\core\services\assets\AssetCollection' => EE_Dependency_Map::load_new_object,
615
-                'EventEspresso\core\services\assets\AssetManifest'   => EE_Dependency_Map::load_from_cache,
616
-            ],
617
-            'EventEspresso\core\services\cache\BasicCacheManager'                                                         => [
618
-                'EventEspresso\core\services\cache\TransientCacheStorage' => EE_Dependency_Map::load_from_cache,
619
-            ],
620
-            'EventEspresso\core\services\cache\PostRelatedCacheManager'                                                   => [
621
-                'EventEspresso\core\services\cache\TransientCacheStorage' => EE_Dependency_Map::load_from_cache,
622
-            ],
623
-            'EventEspresso\core\domain\services\validation\email\EmailValidationService'                                  => [
624
-                'EE_Registration_Config'                     => EE_Dependency_Map::load_from_cache,
625
-                'EventEspresso\core\services\loaders\Loader' => EE_Dependency_Map::load_from_cache,
626
-            ],
627
-            'EventEspresso\core\domain\values\EmailAddress'                                                               => [
628
-                null,
629
-                'EventEspresso\core\domain\services\validation\email\EmailValidationService' => EE_Dependency_Map::load_from_cache,
630
-            ],
631
-            'EventEspresso\core\services\orm\ModelFieldFactory'                                                           => [
632
-                'EventEspresso\core\services\loaders\Loader' => EE_Dependency_Map::load_from_cache,
633
-            ],
634
-            'LEGACY_MODELS'                                                                                               => [
635
-                null,
636
-                'EventEspresso\core\services\database\ModelFieldFactory' => EE_Dependency_Map::load_from_cache,
637
-            ],
638
-            'EE_Module_Request_Router'                                                                                    => [
639
-                'EE_Request' => EE_Dependency_Map::load_from_cache,
640
-            ],
641
-            'EE_Registration_Processor'                                                                                   => [
642
-                'EE_Request' => EE_Dependency_Map::load_from_cache,
643
-            ],
644
-            'EventEspresso\core\services\notifications\PersistentAdminNoticeManager'                                      => [
645
-                null,
646
-                'EventEspresso\core\domain\services\capabilities\CapabilitiesChecker' => EE_Dependency_Map::load_from_cache,
647
-                'EventEspresso\core\services\request\Request'                         => EE_Dependency_Map::load_from_cache,
648
-            ],
649
-            'EventEspresso\caffeinated\modules\recaptcha_invisible\InvisibleRecaptcha'                                    => [
650
-                'EE_Registration_Config' => EE_Dependency_Map::load_from_cache,
651
-                'EE_Session'             => EE_Dependency_Map::load_from_cache,
652
-            ],
653
-            'EventEspresso\modules\ticket_selector\ProcessTicketSelector'                                                 => [
654
-                'EE_Core_Config'                                                          => EE_Dependency_Map::load_from_cache,
655
-                'EventEspresso\core\services\request\Request'                             => EE_Dependency_Map::load_from_cache,
656
-                'EE_Session'                                                              => EE_Dependency_Map::load_from_cache,
657
-                'EEM_Ticket'                                                              => EE_Dependency_Map::load_from_cache,
658
-                'EventEspresso\modules\ticket_selector\TicketDatetimeAvailabilityTracker' => EE_Dependency_Map::load_from_cache,
659
-            ],
660
-            'EventEspresso\modules\ticket_selector\TicketDatetimeAvailabilityTracker'                                     => [
661
-                'EEM_Datetime' => EE_Dependency_Map::load_from_cache,
662
-            ],
663
-            'EventEspresso\core\domain\entities\custom_post_types\CustomPostTypeDefinitions'                              => [
664
-                'EE_Core_Config'                             => EE_Dependency_Map::load_from_cache,
665
-                'EventEspresso\core\services\loaders\Loader' => EE_Dependency_Map::load_from_cache,
666
-            ],
667
-            'EventEspresso\core\domain\services\custom_post_types\RegisterCustomPostTypes'                                => [
668
-                'EventEspresso\core\domain\entities\custom_post_types\CustomPostTypeDefinitions' => EE_Dependency_Map::load_from_cache,
669
-            ],
670
-            'EventEspresso\core\domain\services\custom_post_types\RegisterCustomTaxonomies'                               => [
671
-                'EventEspresso\core\domain\entities\custom_post_types\CustomTaxonomyDefinitions' => EE_Dependency_Map::load_from_cache,
672
-            ],
673
-            'EE_CPT_Strategy'                                                                                             => [
674
-                'EventEspresso\core\domain\entities\custom_post_types\CustomPostTypeDefinitions' => EE_Dependency_Map::load_from_cache,
675
-                'EventEspresso\core\domain\entities\custom_post_types\CustomTaxonomyDefinitions' => EE_Dependency_Map::load_from_cache,
676
-            ],
677
-            'EventEspresso\core\services\loaders\ObjectIdentifier'                                                        => [
678
-                'EventEspresso\core\services\loaders\ClassInterfaceCache' => EE_Dependency_Map::load_from_cache,
679
-            ],
680
-            'EventEspresso\core\CPTs\CptQueryModifier'                                                                    => [
681
-                null,
682
-                null,
683
-                null,
684
-                'EE_Request_Handler'                          => EE_Dependency_Map::load_from_cache,
685
-                'EventEspresso\core\services\request\Request' => EE_Dependency_Map::load_from_cache,
686
-                'EventEspresso\core\services\loaders\Loader'  => EE_Dependency_Map::load_from_cache,
687
-            ],
688
-            'EventEspresso\core\services\dependencies\DependencyResolver'                                                 => [
689
-                'EventEspresso\core\services\container\Mirror'            => EE_Dependency_Map::load_from_cache,
690
-                'EventEspresso\core\services\loaders\ClassInterfaceCache' => EE_Dependency_Map::load_from_cache,
691
-                'EE_Dependency_Map'                                       => EE_Dependency_Map::load_from_cache,
692
-            ],
693
-            'EventEspresso\core\services\routing\RouteMatchSpecificationDependencyResolver'                               => [
694
-                'EventEspresso\core\services\container\Mirror'            => EE_Dependency_Map::load_from_cache,
695
-                'EventEspresso\core\services\loaders\ClassInterfaceCache' => EE_Dependency_Map::load_from_cache,
696
-                'EE_Dependency_Map'                                       => EE_Dependency_Map::load_from_cache,
697
-            ],
698
-            'EventEspresso\core\services\routing\RouteMatchSpecificationFactory'                                          => [
699
-                'EventEspresso\core\services\routing\RouteMatchSpecificationDependencyResolver' => EE_Dependency_Map::load_from_cache,
700
-                'EventEspresso\core\services\loaders\Loader'                                    => EE_Dependency_Map::load_from_cache,
701
-            ],
702
-            'EventEspresso\core\services\routing\RouteMatchSpecificationManager'                                          => [
703
-                'EventEspresso\core\services\routing\RouteMatchSpecificationCollection' => EE_Dependency_Map::load_from_cache,
704
-                'EventEspresso\core\services\routing\RouteMatchSpecificationFactory'    => EE_Dependency_Map::load_from_cache,
705
-            ],
706
-            'EE_URL_Validation_Strategy'                                                                                  => [
707
-                null,
708
-                null,
709
-                'EventEspresso\core\services\validators\URLValidator' => EE_Dependency_Map::load_from_cache,
710
-            ],
711
-            'EventEspresso\core\services\request\files\FilesDataHandler'                                                  => [
712
-                'EventEspresso\core\services\request\Request' => EE_Dependency_Map::load_from_cache,
713
-            ],
714
-            'EventEspressoBatchRequest\BatchRequestProcessor'                                                             => [
715
-                'EventEspresso\core\services\loaders\Loader' => EE_Dependency_Map::load_from_cache,
716
-            ],
717
-            'EventEspresso\core\domain\services\converters\RestApiSpoofer'                                                => [
718
-                'WP_REST_Server'                                               => EE_Dependency_Map::load_from_cache,
719
-                'EED_Core_Rest_Api'                                            => EE_Dependency_Map::load_from_cache,
720
-                'EventEspresso\core\libraries\rest_api\controllers\model\Read' => EE_Dependency_Map::load_from_cache,
721
-                null,
722
-            ],
723
-            'EventEspresso\core\services\routing\RouteHandler'                                                            => [
724
-                'EventEspresso\core\services\json\JsonDataNodeHandler' => EE_Dependency_Map::load_from_cache,
725
-                'EventEspresso\core\services\loaders\Loader'           => EE_Dependency_Map::load_from_cache,
726
-                'EventEspresso\core\services\request\Request'          => EE_Dependency_Map::load_from_cache,
727
-                'EventEspresso\core\services\routing\RouteCollection'  => EE_Dependency_Map::load_from_cache,
728
-            ],
729
-            'EventEspresso\core\services\json\JsonDataNodeHandler'                                                        => [
730
-                'EventEspresso\core\services\json\JsonDataNodeValidator' => EE_Dependency_Map::load_from_cache,
731
-            ],
732
-            'EventEspresso\core\services\routing\Router'                                                                  => [
733
-                'EE_Dependency_Map'                                => EE_Dependency_Map::load_from_cache,
734
-                'EventEspresso\core\services\loaders\Loader'       => EE_Dependency_Map::load_from_cache,
735
-                'EventEspresso\core\services\routing\RouteHandler' => EE_Dependency_Map::load_from_cache,
736
-            ],
737
-            'EventEspresso\core\services\assets\AssetManifest'                                                            => [
738
-                'EventEspresso\core\domain\Domain' => EE_Dependency_Map::load_from_cache,
739
-            ],
740
-            'EventEspresso\core\services\assets\AssetManifestFactory'                                                     => [
741
-                'EventEspresso\core\services\loaders\Loader' => EE_Dependency_Map::load_from_cache,
742
-            ],
743
-            'EventEspresso\core\services\assets\BaristaFactory'                                                           => [
744
-                'EventEspresso\core\services\assets\AssetManifestFactory' => EE_Dependency_Map::load_from_cache,
745
-                'EventEspresso\core\services\loaders\Loader'              => EE_Dependency_Map::load_from_cache,
746
-            ],
747
-            'EventEspresso\core\domain\services\capabilities\FeatureFlags'                                                => [
748
-                'EventEspresso\core\domain\services\capabilities\CapabilitiesChecker' => EE_Dependency_Map::load_from_cache,
749
-            ],
750
-        ];
751
-    }
752
-
753
-
754
-    /**
755
-     * Registers how core classes are loaded.
756
-     * This can either be done by simply providing the name of one of the EE_Registry loader methods such as:
757
-     *        'EE_Request_Handler' => 'load_core'
758
-     *        'EE_Messages_Queue'  => 'load_lib'
759
-     *        'EEH_Debug_Tools'    => 'load_helper'
760
-     * or, if greater control is required, by providing a custom closure. For example:
761
-     *        'Some_Class' => function () {
762
-     *            return new Some_Class();
763
-     *        },
764
-     * This is required for instantiating dependencies
765
-     * where an interface has been type hinted in a class constructor. For example:
766
-     *        'Required_Interface' => function () {
767
-     *            return new A_Class_That_Implements_Required_Interface();
768
-     *        },
769
-     */
770
-    protected function _register_core_class_loaders()
771
-    {
772
-        $this->_class_loaders = [
773
-            // load_core
774
-            'EE_Dependency_Map'                            => function () {
775
-                return $this;
776
-            },
777
-            'EE_Capabilities'                              => 'load_core',
778
-            'EE_Encryption'                                => 'load_core',
779
-            'EE_Front_Controller'                          => 'load_core',
780
-            'EE_Module_Request_Router'                     => 'load_core',
781
-            'EE_Registry'                                  => 'load_core',
782
-            'EE_Request'                                   => function () {
783
-                return $this->legacy_request;
784
-            },
785
-            'EventEspresso\core\services\request\Request'  => function () {
786
-                return $this->request;
787
-            },
788
-            'EventEspresso\core\services\request\Response' => function () {
789
-                return $this->response;
790
-            },
791
-            'EE_Base'                                      => 'load_core',
792
-            'EE_Request_Handler'                           => 'load_core',
793
-            'EE_Session'                                   => 'load_core',
794
-            'EE_Cron_Tasks'                                => 'load_core',
795
-            'EE_System'                                    => 'load_core',
796
-            'EE_Maintenance_Mode'                          => 'load_core',
797
-            'EE_Register_CPTs'                             => 'load_core',
798
-            'EE_Admin'                                     => 'load_core',
799
-            'EE_CPT_Strategy'                              => 'load_core',
800
-            // load_class
801
-            'EE_Registration_Processor'                    => 'load_class',
802
-            // load_lib
803
-            'EE_Message_Resource_Manager'                  => 'load_lib',
804
-            'EE_Message_Type_Collection'                   => 'load_lib',
805
-            'EE_Message_Type_Collection_Loader'            => 'load_lib',
806
-            'EE_Messenger_Collection'                      => 'load_lib',
807
-            'EE_Messenger_Collection_Loader'               => 'load_lib',
808
-            'EE_Messages_Processor'                        => 'load_lib',
809
-            'EE_Message_Repository'                        => 'load_lib',
810
-            'EE_Messages_Queue'                            => 'load_lib',
811
-            'EE_Messages_Data_Handler_Collection'          => 'load_lib',
812
-            'EE_Message_Template_Group_Collection'         => 'load_lib',
813
-            'EE_Payment_Method_Manager'                    => 'load_lib',
814
-            'EE_DMS_Core_4_1_0'                            => 'load_dms',
815
-            'EE_DMS_Core_4_2_0'                            => 'load_dms',
816
-            'EE_DMS_Core_4_3_0'                            => 'load_dms',
817
-            'EE_DMS_Core_4_5_0'                            => 'load_dms',
818
-            'EE_DMS_Core_4_6_0'                            => 'load_dms',
819
-            'EE_DMS_Core_4_7_0'                            => 'load_dms',
820
-            'EE_DMS_Core_4_8_0'                            => 'load_dms',
821
-            'EE_DMS_Core_4_9_0'                            => 'load_dms',
822
-            'EE_DMS_Core_4_10_0'                           => 'load_dms',
823
-            'EE_Messages_Generator'                        => static function () {
824
-                return EE_Registry::instance()->load_lib(
825
-                    'Messages_Generator',
826
-                    [],
827
-                    false,
828
-                    false
829
-                );
830
-            },
831
-            'EE_Messages_Template_Defaults'                => static function ($arguments = []) {
832
-                return EE_Registry::instance()->load_lib(
833
-                    'Messages_Template_Defaults',
834
-                    $arguments,
835
-                    false,
836
-                    false
837
-                );
838
-            },
839
-            // load_helper
840
-            'EEH_Parse_Shortcodes'                         => static function () {
841
-                if (EE_Registry::instance()->load_helper('Parse_Shortcodes')) {
842
-                    return new EEH_Parse_Shortcodes();
843
-                }
844
-                return null;
845
-            },
846
-            'EE_Template_Config'                           => static function () {
847
-                return EE_Config::instance()->template_settings;
848
-            },
849
-            'EE_Currency_Config'                           => static function () {
850
-                return EE_Config::instance()->currency;
851
-            },
852
-            'EE_Registration_Config'                       => static function () {
853
-                return EE_Config::instance()->registration;
854
-            },
855
-            'EE_Core_Config'                               => static function () {
856
-                return EE_Config::instance()->core;
857
-            },
858
-            'EventEspresso\core\services\loaders\Loader'   => static function () {
859
-                return LoaderFactory::getLoader();
860
-            },
861
-            'EE_Network_Config'                            => static function () {
862
-                return EE_Network_Config::instance();
863
-            },
864
-            'EE_Config'                                    => static function () {
865
-                return EE_Config::instance();
866
-            },
867
-            'EventEspresso\core\domain\Domain'             => static function () {
868
-                return DomainFactory::getEventEspressoCoreDomain();
869
-            },
870
-            'EE_Admin_Config'                              => static function () {
871
-                return EE_Config::instance()->admin;
872
-            },
873
-            'EE_Organization_Config'                       => static function () {
874
-                return EE_Config::instance()->organization;
875
-            },
876
-            'EE_Network_Core_Config'                       => static function () {
877
-                return EE_Network_Config::instance()->core;
878
-            },
879
-            'EE_Environment_Config'                        => static function () {
880
-                return EE_Config::instance()->environment;
881
-            },
882
-            'EED_Core_Rest_Api'                            => static function () {
883
-                return EED_Core_Rest_Api::instance();
884
-            },
885
-            'WP_REST_Server'                               => static function () {
886
-                return rest_get_server();
887
-            },
888
-        ];
889
-    }
890
-
891
-
892
-    /**
893
-     * can be used for supplying alternate names for classes,
894
-     * or for connecting interface names to instantiable classes
895
-     *
896
-     * @throws InvalidAliasException
897
-     */
898
-    protected function _register_core_aliases()
899
-    {
900
-        $aliases = [
901
-            'CommandBusInterface'                                                          => 'EventEspresso\core\services\commands\CommandBusInterface',
902
-            'EventEspresso\core\services\commands\CommandBusInterface'                     => 'EventEspresso\core\services\commands\CommandBus',
903
-            'CommandHandlerManagerInterface'                                               => 'EventEspresso\core\services\commands\CommandHandlerManagerInterface',
904
-            'EventEspresso\core\services\commands\CommandHandlerManagerInterface'          => 'EventEspresso\core\services\commands\CommandHandlerManager',
905
-            'CapChecker'                                                                   => 'EventEspresso\core\services\commands\middleware\CapChecker',
906
-            'AddActionHook'                                                                => 'EventEspresso\core\services\commands\middleware\AddActionHook',
907
-            'CapabilitiesChecker'                                                          => 'EventEspresso\core\domain\services\capabilities\CapabilitiesChecker',
908
-            'CapabilitiesCheckerInterface'                                                 => 'EventEspresso\core\domain\services\capabilities\CapabilitiesCheckerInterface',
909
-            'EventEspresso\core\domain\services\capabilities\CapabilitiesCheckerInterface' => 'EventEspresso\core\domain\services\capabilities\CapabilitiesChecker',
910
-            'CreateRegistrationService'                                                    => 'EventEspresso\core\domain\services\registration\CreateRegistrationService',
911
-            'CreateRegistrationCommandHandler'                                             => 'EventEspresso\core\services\commands\registration\CreateRegistrationCommand',
912
-            'CopyRegistrationDetailsCommandHandler'                                        => 'EventEspresso\core\services\commands\registration\CopyRegistrationDetailsCommand',
913
-            'CopyRegistrationPaymentsCommandHandler'                                       => 'EventEspresso\core\services\commands\registration\CopyRegistrationPaymentsCommand',
914
-            'CancelRegistrationAndTicketLineItemCommandHandler'                            => 'EventEspresso\core\services\commands\registration\CancelRegistrationAndTicketLineItemCommandHandler',
915
-            'UpdateRegistrationAndTransactionAfterChangeCommandHandler'                    => 'EventEspresso\core\services\commands\registration\UpdateRegistrationAndTransactionAfterChangeCommandHandler',
916
-            'CreateTicketLineItemCommandHandler'                                           => 'EventEspresso\core\services\commands\ticket\CreateTicketLineItemCommand',
917
-            'CreateTransactionCommandHandler'                                              => 'EventEspresso\core\services\commands\transaction\CreateTransactionCommandHandler',
918
-            'CreateAttendeeCommandHandler'                                                 => 'EventEspresso\core\services\commands\attendee\CreateAttendeeCommandHandler',
919
-            'TableManager'                                                                 => 'EventEspresso\core\services\database\TableManager',
920
-            'TableAnalysis'                                                                => 'EventEspresso\core\services\database\TableAnalysis',
921
-            'EspressoShortcode'                                                            => 'EventEspresso\core\services\shortcodes\EspressoShortcode',
922
-            'ShortcodeInterface'                                                           => 'EventEspresso\core\services\shortcodes\ShortcodeInterface',
923
-            'EventEspresso\core\services\shortcodes\ShortcodeInterface'                    => 'EventEspresso\core\services\shortcodes\EspressoShortcode',
924
-            'EventEspresso\core\services\cache\CacheStorageInterface'                      => 'EventEspresso\core\services\cache\TransientCacheStorage',
925
-            'LoaderInterface'                                                              => 'EventEspresso\core\services\loaders\LoaderInterface',
926
-            'EventEspresso\core\services\loaders\LoaderInterface'                          => 'EventEspresso\core\services\loaders\Loader',
927
-            'CommandFactoryInterface'                                                      => 'EventEspresso\core\services\commands\CommandFactoryInterface',
928
-            'EventEspresso\core\services\commands\CommandFactoryInterface'                 => 'EventEspresso\core\services\commands\CommandFactory',
929
-            'EmailValidatorInterface'                                                      => 'EventEspresso\core\domain\services\validation\email\EmailValidatorInterface',
930
-            'EventEspresso\core\domain\services\validation\email\EmailValidatorInterface'  => 'EventEspresso\core\domain\services\validation\email\EmailValidationService',
931
-            'NoticeConverterInterface'                                                     => 'EventEspresso\core\services\notices\NoticeConverterInterface',
932
-            'EventEspresso\core\services\notices\NoticeConverterInterface'                 => 'EventEspresso\core\services\notices\ConvertNoticesToEeErrors',
933
-            'NoticesContainerInterface'                                                    => 'EventEspresso\core\services\notices\NoticesContainerInterface',
934
-            'EventEspresso\core\services\notices\NoticesContainerInterface'                => 'EventEspresso\core\services\notices\NoticesContainer',
935
-            'EventEspresso\core\services\request\RequestInterface'                         => 'EventEspresso\core\services\request\Request',
936
-            'EventEspresso\core\services\request\ResponseInterface'                        => 'EventEspresso\core\services\request\Response',
937
-            'EventEspresso\core\domain\DomainInterface'                                    => 'EventEspresso\core\domain\Domain',
938
-            'Registration_Processor'                                                       => 'EE_Registration_Processor',
939
-            'EventEspresso\core\services\assets\AssetManifestInterface'                    => 'EventEspresso\core\services\assets\AssetManifest',
940
-        ];
941
-        foreach ($aliases as $alias => $fqn) {
942
-            if (is_array($fqn)) {
943
-                foreach ($fqn as $class => $for_class) {
944
-                    $this->class_cache->addAlias($class, $alias, $for_class);
945
-                }
946
-                continue;
947
-            }
948
-            $this->class_cache->addAlias($fqn, $alias);
949
-        }
950
-        if (! (defined('DOING_AJAX') && DOING_AJAX) && is_admin()) {
951
-            $this->class_cache->addAlias(
952
-                'EventEspresso\core\services\notices\ConvertNoticesToAdminNotices',
953
-                'EventEspresso\core\services\notices\NoticeConverterInterface'
954
-            );
955
-        }
956
-    }
957
-
958
-
959
-    /**
960
-     * This is used to reset the internal map and class_loaders to their original default state at the beginning of the
961
-     * request Primarily used by unit tests.
962
-     */
963
-    public function reset()
964
-    {
965
-        $this->_register_core_class_loaders();
966
-        $this->_register_core_dependencies();
967
-    }
968
-
969
-
970
-    /**
971
-     * PLZ NOTE: a better name for this method would be is_alias()
972
-     * because it returns TRUE if the provided fully qualified name IS an alias
973
-     * WHY?
974
-     * Because if a class is type hinting for a concretion,
975
-     * then why would we need to find another class to supply it?
976
-     * ie: if a class asks for `Fully/Qualified/Namespace/SpecificClassName`,
977
-     * then give it an instance of `Fully/Qualified/Namespace/SpecificClassName`.
978
-     * Don't go looking for some substitute.
979
-     * Whereas if a class is type hinting for an interface...
980
-     * then we need to find an actual class to use.
981
-     * So the interface IS the alias for some other FQN,
982
-     * and we need to find out if `Fully/Qualified/Namespace/SomeInterface`
983
-     * represents some other class.
984
-     *
985
-     * @param string $fqn
986
-     * @param string $for_class
987
-     * @return bool
988
-     * @deprecated 4.9.62.p
989
-     */
990
-    public function has_alias($fqn = '', $for_class = '')
991
-    {
992
-        return $this->isAlias($fqn, $for_class);
993
-    }
994
-
995
-
996
-    /**
997
-     * PLZ NOTE: a better name for this method would be get_fqn_for_alias()
998
-     * because it returns a FQN for provided alias if one exists, otherwise returns the original $alias
999
-     * functions recursively, so that multiple aliases can be used to drill down to a FQN
1000
-     *  for example:
1001
-     *      if the following two entries were added to the _aliases array:
1002
-     *          array(
1003
-     *              'interface_alias'           => 'some\namespace\interface'
1004
-     *              'some\namespace\interface'  => 'some\namespace\classname'
1005
-     *          )
1006
-     *      then one could use EE_Registry::instance()->create( 'interface_alias' )
1007
-     *      to load an instance of 'some\namespace\classname'
1008
-     *
1009
-     * @param string $alias
1010
-     * @param string $for_class
1011
-     * @return string
1012
-     * @deprecated 4.9.62.p
1013
-     */
1014
-    public function get_alias($alias = '', $for_class = '')
1015
-    {
1016
-        return $this->getFqnForAlias($alias, $for_class);
1017
-    }
24
+	/**
25
+	 * This means that the requested class dependency is not present in the dependency map
26
+	 */
27
+	const not_registered = 0;
28
+
29
+	/**
30
+	 * This instructs class loaders to ALWAYS return a newly instantiated object for the requested class.
31
+	 */
32
+	const load_new_object = 1;
33
+
34
+	/**
35
+	 * This instructs class loaders to return a previously instantiated and cached object for the requested class.
36
+	 * IF a previously instantiated object does not exist, a new one will be created and added to the cache.
37
+	 */
38
+	const load_from_cache = 2;
39
+
40
+	/**
41
+	 * When registering a dependency,
42
+	 * this indicates to keep any existing dependencies that already exist,
43
+	 * and simply discard any new dependencies declared in the incoming data
44
+	 */
45
+	const KEEP_EXISTING_DEPENDENCIES = 0;
46
+
47
+	/**
48
+	 * When registering a dependency,
49
+	 * this indicates to overwrite any existing dependencies that already exist using the incoming data
50
+	 */
51
+	const OVERWRITE_DEPENDENCIES = 1;
52
+
53
+	/**
54
+	 * @type EE_Dependency_Map $_instance
55
+	 */
56
+	protected static $_instance;
57
+
58
+	/**
59
+	 * @var ClassInterfaceCache $class_cache
60
+	 */
61
+	private $class_cache;
62
+
63
+	/**
64
+	 * @type RequestInterface $request
65
+	 */
66
+	protected $request;
67
+
68
+	/**
69
+	 * @type LegacyRequestInterface $legacy_request
70
+	 */
71
+	protected $legacy_request;
72
+
73
+	/**
74
+	 * @type ResponseInterface $response
75
+	 */
76
+	protected $response;
77
+
78
+	/**
79
+	 * @type LoaderInterface $loader
80
+	 */
81
+	protected $loader;
82
+
83
+	/**
84
+	 * @type array $_dependency_map
85
+	 */
86
+	protected $_dependency_map = [];
87
+
88
+	/**
89
+	 * @type array $_class_loaders
90
+	 */
91
+	protected $_class_loaders = [];
92
+
93
+
94
+	/**
95
+	 * EE_Dependency_Map constructor.
96
+	 *
97
+	 * @param ClassInterfaceCache $class_cache
98
+	 */
99
+	protected function __construct(ClassInterfaceCache $class_cache)
100
+	{
101
+		$this->class_cache = $class_cache;
102
+		do_action('EE_Dependency_Map____construct', $this);
103
+	}
104
+
105
+
106
+	/**
107
+	 * @return void
108
+	 * @throws InvalidAliasException
109
+	 */
110
+	public function initialize()
111
+	{
112
+		$this->_register_core_dependencies();
113
+		$this->_register_core_class_loaders();
114
+		$this->_register_core_aliases();
115
+	}
116
+
117
+
118
+	/**
119
+	 * @singleton method used to instantiate class object
120
+	 * @param ClassInterfaceCache|null $class_cache
121
+	 * @return EE_Dependency_Map
122
+	 */
123
+	public static function instance(ClassInterfaceCache $class_cache = null)
124
+	{
125
+		// check if class object is instantiated, and instantiated properly
126
+		if (! EE_Dependency_Map::$_instance instanceof EE_Dependency_Map
127
+			&& $class_cache instanceof ClassInterfaceCache
128
+		) {
129
+			EE_Dependency_Map::$_instance = new EE_Dependency_Map($class_cache);
130
+		}
131
+		return EE_Dependency_Map::$_instance;
132
+	}
133
+
134
+
135
+	/**
136
+	 * @param RequestInterface $request
137
+	 */
138
+	public function setRequest(RequestInterface $request)
139
+	{
140
+		$this->request = $request;
141
+	}
142
+
143
+
144
+	/**
145
+	 * @param LegacyRequestInterface $legacy_request
146
+	 */
147
+	public function setLegacyRequest(LegacyRequestInterface $legacy_request)
148
+	{
149
+		$this->legacy_request = $legacy_request;
150
+	}
151
+
152
+
153
+	/**
154
+	 * @param ResponseInterface $response
155
+	 */
156
+	public function setResponse(ResponseInterface $response)
157
+	{
158
+		$this->response = $response;
159
+	}
160
+
161
+
162
+	/**
163
+	 * @param LoaderInterface $loader
164
+	 */
165
+	public function setLoader(LoaderInterface $loader)
166
+	{
167
+		$this->loader = $loader;
168
+	}
169
+
170
+
171
+	/**
172
+	 * @param string $class
173
+	 * @param array  $dependencies
174
+	 * @param int    $overwrite
175
+	 * @return bool
176
+	 */
177
+	public static function register_dependencies(
178
+		$class,
179
+		array $dependencies,
180
+		$overwrite = EE_Dependency_Map::KEEP_EXISTING_DEPENDENCIES
181
+	) {
182
+		return EE_Dependency_Map::$_instance->registerDependencies($class, $dependencies, $overwrite);
183
+	}
184
+
185
+
186
+	/**
187
+	 * Assigns an array of class names and corresponding load sources (new or cached)
188
+	 * to the class specified by the first parameter.
189
+	 * IMPORTANT !!!
190
+	 * The order of elements in the incoming $dependencies array MUST match
191
+	 * the order of the constructor parameters for the class in question.
192
+	 * This is especially important when overriding any existing dependencies that are registered.
193
+	 * the third parameter controls whether any duplicate dependencies are overwritten or not.
194
+	 *
195
+	 * @param string $class
196
+	 * @param array  $dependencies
197
+	 * @param int    $overwrite
198
+	 * @return bool
199
+	 */
200
+	public function registerDependencies(
201
+		$class,
202
+		array $dependencies,
203
+		$overwrite = EE_Dependency_Map::KEEP_EXISTING_DEPENDENCIES
204
+	) {
205
+		$class = trim($class, '\\');
206
+		$registered = false;
207
+		if (empty(EE_Dependency_Map::$_instance->_dependency_map[ $class ])) {
208
+			EE_Dependency_Map::$_instance->_dependency_map[ $class ] = [];
209
+		}
210
+		// we need to make sure that any aliases used when registering a dependency
211
+		// get resolved to the correct class name
212
+		foreach ($dependencies as $dependency => $load_source) {
213
+			$alias = EE_Dependency_Map::$_instance->getFqnForAlias($dependency);
214
+			if ($overwrite === EE_Dependency_Map::OVERWRITE_DEPENDENCIES
215
+				|| ! isset(EE_Dependency_Map::$_instance->_dependency_map[ $class ][ $alias ])
216
+			) {
217
+				unset($dependencies[ $dependency ]);
218
+				$dependencies[ $alias ] = $load_source;
219
+				$registered = true;
220
+			}
221
+		}
222
+		// now add our two lists of dependencies together.
223
+		// using Union (+=) favours the arrays in precedence from left to right,
224
+		// so $dependencies is NOT overwritten because it is listed first
225
+		// ie: with A = B + C, entries in B take precedence over duplicate entries in C
226
+		// Union is way faster than array_merge() but should be used with caution...
227
+		// especially with numerically indexed arrays
228
+		$dependencies += EE_Dependency_Map::$_instance->_dependency_map[ $class ];
229
+		// now we need to ensure that the resulting dependencies
230
+		// array only has the entries that are required for the class
231
+		// so first count how many dependencies were originally registered for the class
232
+		$dependency_count = count(EE_Dependency_Map::$_instance->_dependency_map[ $class ]);
233
+		// if that count is non-zero (meaning dependencies were already registered)
234
+		EE_Dependency_Map::$_instance->_dependency_map[ $class ] = $dependency_count
235
+			// then truncate the  final array to match that count
236
+			? array_slice($dependencies, 0, $dependency_count)
237
+			// otherwise just take the incoming array because nothing previously existed
238
+			: $dependencies;
239
+		return $registered;
240
+	}
241
+
242
+
243
+	/**
244
+	 * @param string $class_name
245
+	 * @param string $loader
246
+	 * @return bool
247
+	 * @throws DomainException
248
+	 */
249
+	public static function register_class_loader($class_name, $loader = 'load_core')
250
+	{
251
+		return EE_Dependency_Map::$_instance->registerClassLoader($class_name, $loader);
252
+	}
253
+
254
+
255
+	/**
256
+	 * @param string $class_name
257
+	 * @param string $loader
258
+	 * @return bool
259
+	 * @throws DomainException
260
+	 */
261
+	public function registerClassLoader($class_name, $loader = 'load_core')
262
+	{
263
+		if (! $loader instanceof Closure && strpos($class_name, '\\') !== false) {
264
+			throw new DomainException(
265
+				esc_html__('Don\'t use class loaders for FQCNs.', 'event_espresso')
266
+			);
267
+		}
268
+		// check that loader is callable or method starts with "load_" and exists in EE_Registry
269
+		if (! is_callable($loader)
270
+			&& (
271
+				strpos($loader, 'load_') !== 0
272
+				|| ! method_exists('EE_Registry', $loader)
273
+			)
274
+		) {
275
+			throw new DomainException(
276
+				sprintf(
277
+					esc_html__(
278
+						'"%1$s" is not a valid loader method on EE_Registry.',
279
+						'event_espresso'
280
+					),
281
+					$loader
282
+				)
283
+			);
284
+		}
285
+		$class_name = EE_Dependency_Map::$_instance->getFqnForAlias($class_name);
286
+		if (! isset(EE_Dependency_Map::$_instance->_class_loaders[ $class_name ])) {
287
+			EE_Dependency_Map::$_instance->_class_loaders[ $class_name ] = $loader;
288
+			return true;
289
+		}
290
+		return false;
291
+	}
292
+
293
+
294
+	/**
295
+	 * @return array
296
+	 */
297
+	public function dependency_map()
298
+	{
299
+		return $this->_dependency_map;
300
+	}
301
+
302
+
303
+	/**
304
+	 * returns TRUE if dependency map contains a listing for the provided class name
305
+	 *
306
+	 * @param string $class_name
307
+	 * @return boolean
308
+	 */
309
+	public function has($class_name = '')
310
+	{
311
+		// all legacy models have the same dependencies
312
+		if (strpos($class_name, 'EEM_') === 0) {
313
+			$class_name = 'LEGACY_MODELS';
314
+		}
315
+		return isset($this->_dependency_map[ $class_name ]);
316
+	}
317
+
318
+
319
+	/**
320
+	 * returns TRUE if dependency map contains a listing for the provided class name AND dependency
321
+	 *
322
+	 * @param string $class_name
323
+	 * @param string $dependency
324
+	 * @return bool
325
+	 */
326
+	public function has_dependency_for_class($class_name = '', $dependency = '')
327
+	{
328
+		// all legacy models have the same dependencies
329
+		if (strpos($class_name, 'EEM_') === 0) {
330
+			$class_name = 'LEGACY_MODELS';
331
+		}
332
+		$dependency = $this->getFqnForAlias($dependency, $class_name);
333
+		return isset($this->_dependency_map[ $class_name ][ $dependency ]);
334
+	}
335
+
336
+
337
+	/**
338
+	 * returns loading strategy for whether a previously cached dependency should be loaded or a new instance returned
339
+	 *
340
+	 * @param string $class_name
341
+	 * @param string $dependency
342
+	 * @return int
343
+	 */
344
+	public function loading_strategy_for_class_dependency($class_name = '', $dependency = '')
345
+	{
346
+		// all legacy models have the same dependencies
347
+		if (strpos($class_name, 'EEM_') === 0) {
348
+			$class_name = 'LEGACY_MODELS';
349
+		}
350
+		$dependency = $this->getFqnForAlias($dependency);
351
+		return $this->has_dependency_for_class($class_name, $dependency)
352
+			? $this->_dependency_map[ $class_name ][ $dependency ]
353
+			: EE_Dependency_Map::not_registered;
354
+	}
355
+
356
+
357
+	/**
358
+	 * @param string $class_name
359
+	 * @return string | Closure
360
+	 */
361
+	public function class_loader($class_name)
362
+	{
363
+		// all legacy models use load_model()
364
+		if (strpos($class_name, 'EEM_') === 0) {
365
+			return 'load_model';
366
+		}
367
+		// EE_CPT_*_Strategy classes like EE_CPT_Event_Strategy, EE_CPT_Venue_Strategy, etc
368
+		// perform strpos() first to avoid loading regex every time we load a class
369
+		if (strpos($class_name, 'EE_CPT_') === 0
370
+			&& preg_match('/^EE_CPT_([a-zA-Z]+)_Strategy$/', $class_name)
371
+		) {
372
+			return 'load_core';
373
+		}
374
+		$class_name = $this->getFqnForAlias($class_name);
375
+		return isset($this->_class_loaders[ $class_name ]) ? $this->_class_loaders[ $class_name ] : '';
376
+	}
377
+
378
+
379
+	/**
380
+	 * @return array
381
+	 */
382
+	public function class_loaders()
383
+	{
384
+		return $this->_class_loaders;
385
+	}
386
+
387
+
388
+	/**
389
+	 * adds an alias for a classname
390
+	 *
391
+	 * @param string $fqcn      the class name that should be used (concrete class to replace interface)
392
+	 * @param string $alias     the class name that would be type hinted for (abstract parent or interface)
393
+	 * @param string $for_class the class that has the dependency (is type hinting for the interface)
394
+	 * @throws InvalidAliasException
395
+	 */
396
+	public function add_alias($fqcn, $alias, $for_class = '')
397
+	{
398
+		$this->class_cache->addAlias($fqcn, $alias, $for_class);
399
+	}
400
+
401
+
402
+	/**
403
+	 * Returns TRUE if the provided fully qualified name IS an alias
404
+	 * WHY?
405
+	 * Because if a class is type hinting for a concretion,
406
+	 * then why would we need to find another class to supply it?
407
+	 * ie: if a class asks for `Fully/Qualified/Namespace/SpecificClassName`,
408
+	 * then give it an instance of `Fully/Qualified/Namespace/SpecificClassName`.
409
+	 * Don't go looking for some substitute.
410
+	 * Whereas if a class is type hinting for an interface...
411
+	 * then we need to find an actual class to use.
412
+	 * So the interface IS the alias for some other FQN,
413
+	 * and we need to find out if `Fully/Qualified/Namespace/SomeInterface`
414
+	 * represents some other class.
415
+	 *
416
+	 * @param string $fqn
417
+	 * @param string $for_class
418
+	 * @return bool
419
+	 */
420
+	public function isAlias($fqn = '', $for_class = '')
421
+	{
422
+		return $this->class_cache->isAlias($fqn, $for_class);
423
+	}
424
+
425
+
426
+	/**
427
+	 * Returns a FQN for provided alias if one exists, otherwise returns the original $alias
428
+	 * functions recursively, so that multiple aliases can be used to drill down to a FQN
429
+	 *  for example:
430
+	 *      if the following two entries were added to the _aliases array:
431
+	 *          array(
432
+	 *              'interface_alias'           => 'some\namespace\interface'
433
+	 *              'some\namespace\interface'  => 'some\namespace\classname'
434
+	 *          )
435
+	 *      then one could use EE_Registry::instance()->create( 'interface_alias' )
436
+	 *      to load an instance of 'some\namespace\classname'
437
+	 *
438
+	 * @param string $alias
439
+	 * @param string $for_class
440
+	 * @return string
441
+	 */
442
+	public function getFqnForAlias($alias = '', $for_class = '')
443
+	{
444
+		return (string) $this->class_cache->getFqnForAlias($alias, $for_class);
445
+	}
446
+
447
+
448
+	/**
449
+	 * Registers the core dependencies and whether a previously instantiated object should be loaded from the cache,
450
+	 * if one exists, or whether a new object should be generated every time the requested class is loaded.
451
+	 * This is done by using the following class constants:
452
+	 *        EE_Dependency_Map::load_from_cache - loads previously instantiated object
453
+	 *        EE_Dependency_Map::load_new_object - generates a new object every time
454
+	 */
455
+	protected function _register_core_dependencies()
456
+	{
457
+		$this->_dependency_map = [
458
+			'EE_Request_Handler'                                                                                          => [
459
+				'EE_Request' => EE_Dependency_Map::load_from_cache,
460
+			],
461
+			'EE_System'                                                                                                   => [
462
+				'EventEspresso\core\services\loaders\Loader'  => EE_Dependency_Map::load_from_cache,
463
+				'EE_Maintenance_Mode'                         => EE_Dependency_Map::load_from_cache,
464
+				'EE_Registry'                                 => EE_Dependency_Map::load_from_cache,
465
+				'EventEspresso\core\services\request\Request' => EE_Dependency_Map::load_from_cache,
466
+				'EventEspresso\core\services\routing\Router'  => EE_Dependency_Map::load_from_cache,
467
+			],
468
+			'EE_Admin'                                                                                                    => [
469
+				'EventEspresso\core\services\loaders\Loader'  => EE_Dependency_Map::load_from_cache,
470
+				'EventEspresso\core\services\request\Request' => EE_Dependency_Map::load_from_cache,
471
+			],
472
+			'EE_Cart'                                                                                                     => [
473
+				'EE_Session' => EE_Dependency_Map::load_from_cache,
474
+			],
475
+			'EE_Messenger_Collection_Loader'                                                                              => [
476
+				'EE_Messenger_Collection' => EE_Dependency_Map::load_new_object,
477
+			],
478
+			'EE_Message_Type_Collection_Loader'                                                                           => [
479
+				'EE_Message_Type_Collection' => EE_Dependency_Map::load_new_object,
480
+			],
481
+			'EE_Message_Resource_Manager'                                                                                 => [
482
+				'EE_Messenger_Collection_Loader'    => EE_Dependency_Map::load_new_object,
483
+				'EE_Message_Type_Collection_Loader' => EE_Dependency_Map::load_new_object,
484
+				'EEM_Message_Template_Group'        => EE_Dependency_Map::load_from_cache,
485
+			],
486
+			'EE_Message_Factory'                                                                                          => [
487
+				'EE_Message_Resource_Manager' => EE_Dependency_Map::load_from_cache,
488
+			],
489
+			'EE_messages'                                                                                                 => [
490
+				'EE_Message_Resource_Manager' => EE_Dependency_Map::load_from_cache,
491
+			],
492
+			'EE_Messages_Generator'                                                                                       => [
493
+				'EE_Messages_Queue'                    => EE_Dependency_Map::load_new_object,
494
+				'EE_Messages_Data_Handler_Collection'  => EE_Dependency_Map::load_new_object,
495
+				'EE_Message_Template_Group_Collection' => EE_Dependency_Map::load_new_object,
496
+				'EEH_Parse_Shortcodes'                 => EE_Dependency_Map::load_from_cache,
497
+			],
498
+			'EE_Messages_Processor'                                                                                       => [
499
+				'EE_Message_Resource_Manager' => EE_Dependency_Map::load_from_cache,
500
+			],
501
+			'EE_Messages_Queue'                                                                                           => [
502
+				'EE_Message_Repository' => EE_Dependency_Map::load_new_object,
503
+			],
504
+			'EE_Messages_Template_Defaults'                                                                               => [
505
+				'EEM_Message_Template_Group' => EE_Dependency_Map::load_from_cache,
506
+				'EEM_Message_Template'       => EE_Dependency_Map::load_from_cache,
507
+			],
508
+			'EE_Message_To_Generate_From_Request'                                                                         => [
509
+				'EE_Message_Resource_Manager' => EE_Dependency_Map::load_from_cache,
510
+				'EE_Request_Handler'          => EE_Dependency_Map::load_from_cache,
511
+			],
512
+			'EventEspresso\core\services\commands\CommandBus'                                                             => [
513
+				'EventEspresso\core\services\commands\CommandHandlerManager' => EE_Dependency_Map::load_from_cache,
514
+			],
515
+			'EventEspresso\services\commands\CommandHandler'                                                              => [
516
+				'EE_Registry'         => EE_Dependency_Map::load_from_cache,
517
+				'CommandBusInterface' => EE_Dependency_Map::load_from_cache,
518
+			],
519
+			'EventEspresso\core\services\commands\CommandHandlerManager'                                                  => [
520
+				'EventEspresso\core\services\loaders\Loader' => EE_Dependency_Map::load_from_cache,
521
+			],
522
+			'EventEspresso\core\services\commands\CompositeCommandHandler'                                                => [
523
+				'EventEspresso\core\services\commands\CommandBus'     => EE_Dependency_Map::load_from_cache,
524
+				'EventEspresso\core\services\commands\CommandFactory' => EE_Dependency_Map::load_from_cache,
525
+			],
526
+			'EventEspresso\core\services\commands\CommandFactory'                                                         => [
527
+				'EventEspresso\core\services\loaders\Loader' => EE_Dependency_Map::load_from_cache,
528
+			],
529
+			'EventEspresso\core\services\commands\middleware\CapChecker'                                                  => [
530
+				'EventEspresso\core\domain\services\capabilities\CapabilitiesChecker' => EE_Dependency_Map::load_from_cache,
531
+			],
532
+			'EventEspresso\core\domain\services\capabilities\CapabilitiesChecker'                                         => [
533
+				'EE_Capabilities' => EE_Dependency_Map::load_from_cache,
534
+			],
535
+			'EventEspresso\core\domain\services\capabilities\RegistrationsCapChecker'                                     => [
536
+				'EE_Capabilities' => EE_Dependency_Map::load_from_cache,
537
+			],
538
+			'EventEspresso\core\services\commands\registration\CreateRegistrationCommandHandler'                          => [
539
+				'EventEspresso\core\domain\services\registration\CreateRegistrationService' => EE_Dependency_Map::load_from_cache,
540
+			],
541
+			'EventEspresso\core\services\commands\registration\CopyRegistrationDetailsCommandHandler'                     => [
542
+				'EventEspresso\core\domain\services\registration\CopyRegistrationService' => EE_Dependency_Map::load_from_cache,
543
+			],
544
+			'EventEspresso\core\services\commands\registration\CopyRegistrationPaymentsCommandHandler'                    => [
545
+				'EventEspresso\core\domain\services\registration\CopyRegistrationService' => EE_Dependency_Map::load_from_cache,
546
+			],
547
+			'EventEspresso\core\services\commands\registration\CancelRegistrationAndTicketLineItemCommandHandler'         => [
548
+				'EventEspresso\core\domain\services\registration\CancelTicketLineItemService' => EE_Dependency_Map::load_from_cache,
549
+			],
550
+			'EventEspresso\core\services\commands\registration\UpdateRegistrationAndTransactionAfterChangeCommandHandler' => [
551
+				'EventEspresso\core\domain\services\registration\UpdateRegistrationService' => EE_Dependency_Map::load_from_cache,
552
+			],
553
+			'EventEspresso\core\services\commands\ticket\CreateTicketLineItemCommandHandler'                              => [
554
+				'EventEspresso\core\domain\services\ticket\CreateTicketLineItemService' => EE_Dependency_Map::load_from_cache,
555
+			],
556
+			'EventEspresso\core\services\commands\ticket\CancelTicketLineItemCommandHandler'                              => [
557
+				'EventEspresso\core\domain\services\ticket\CancelTicketLineItemService' => EE_Dependency_Map::load_from_cache,
558
+			],
559
+			'EventEspresso\core\domain\services\registration\CancelRegistrationService'                                   => [
560
+				'EventEspresso\core\domain\services\ticket\CancelTicketLineItemService' => EE_Dependency_Map::load_from_cache,
561
+			],
562
+			'EventEspresso\core\services\commands\attendee\CreateAttendeeCommandHandler'                                  => [
563
+				'EEM_Attendee' => EE_Dependency_Map::load_from_cache,
564
+			],
565
+			'EventEspresso\core\services\database\TableManager'                                                           => [
566
+				'EventEspresso\core\services\database\TableAnalysis' => EE_Dependency_Map::load_from_cache,
567
+			],
568
+			'EE_Data_Migration_Class_Base'                                                                                => [
569
+				'EventEspresso\core\services\database\TableAnalysis' => EE_Dependency_Map::load_from_cache,
570
+				'EventEspresso\core\services\database\TableManager'  => EE_Dependency_Map::load_from_cache,
571
+			],
572
+			'EE_DMS_Core_4_1_0'                                                                                           => [
573
+				'EventEspresso\core\services\database\TableAnalysis' => EE_Dependency_Map::load_from_cache,
574
+				'EventEspresso\core\services\database\TableManager'  => EE_Dependency_Map::load_from_cache,
575
+			],
576
+			'EE_DMS_Core_4_2_0'                                                                                           => [
577
+				'EventEspresso\core\services\database\TableAnalysis' => EE_Dependency_Map::load_from_cache,
578
+				'EventEspresso\core\services\database\TableManager'  => EE_Dependency_Map::load_from_cache,
579
+			],
580
+			'EE_DMS_Core_4_3_0'                                                                                           => [
581
+				'EventEspresso\core\services\database\TableAnalysis' => EE_Dependency_Map::load_from_cache,
582
+				'EventEspresso\core\services\database\TableManager'  => EE_Dependency_Map::load_from_cache,
583
+			],
584
+			'EE_DMS_Core_4_4_0'                                                                                           => [
585
+				'EventEspresso\core\services\database\TableAnalysis' => EE_Dependency_Map::load_from_cache,
586
+				'EventEspresso\core\services\database\TableManager'  => EE_Dependency_Map::load_from_cache,
587
+			],
588
+			'EE_DMS_Core_4_5_0'                                                                                           => [
589
+				'EventEspresso\core\services\database\TableAnalysis' => EE_Dependency_Map::load_from_cache,
590
+				'EventEspresso\core\services\database\TableManager'  => EE_Dependency_Map::load_from_cache,
591
+			],
592
+			'EE_DMS_Core_4_6_0'                                                                                           => [
593
+				'EventEspresso\core\services\database\TableAnalysis' => EE_Dependency_Map::load_from_cache,
594
+				'EventEspresso\core\services\database\TableManager'  => EE_Dependency_Map::load_from_cache,
595
+			],
596
+			'EE_DMS_Core_4_7_0'                                                                                           => [
597
+				'EventEspresso\core\services\database\TableAnalysis' => EE_Dependency_Map::load_from_cache,
598
+				'EventEspresso\core\services\database\TableManager'  => EE_Dependency_Map::load_from_cache,
599
+			],
600
+			'EE_DMS_Core_4_8_0'                                                                                           => [
601
+				'EventEspresso\core\services\database\TableAnalysis' => EE_Dependency_Map::load_from_cache,
602
+				'EventEspresso\core\services\database\TableManager'  => EE_Dependency_Map::load_from_cache,
603
+			],
604
+			'EE_DMS_Core_4_9_0'                                                                                           => [
605
+				'EventEspresso\core\services\database\TableAnalysis' => EE_Dependency_Map::load_from_cache,
606
+				'EventEspresso\core\services\database\TableManager'  => EE_Dependency_Map::load_from_cache,
607
+			],
608
+			'EE_DMS_Core_4_10_0'                                                                                          => [
609
+				'EventEspresso\core\services\database\TableAnalysis' => EE_Dependency_Map::load_from_cache,
610
+				'EventEspresso\core\services\database\TableManager'  => EE_Dependency_Map::load_from_cache,
611
+				'EE_DMS_Core_4_9_0'                                  => EE_Dependency_Map::load_from_cache,
612
+			],
613
+			'EventEspresso\core\services\assets\Registry'                                                                 => [
614
+				'EventEspresso\core\services\assets\AssetCollection' => EE_Dependency_Map::load_new_object,
615
+				'EventEspresso\core\services\assets\AssetManifest'   => EE_Dependency_Map::load_from_cache,
616
+			],
617
+			'EventEspresso\core\services\cache\BasicCacheManager'                                                         => [
618
+				'EventEspresso\core\services\cache\TransientCacheStorage' => EE_Dependency_Map::load_from_cache,
619
+			],
620
+			'EventEspresso\core\services\cache\PostRelatedCacheManager'                                                   => [
621
+				'EventEspresso\core\services\cache\TransientCacheStorage' => EE_Dependency_Map::load_from_cache,
622
+			],
623
+			'EventEspresso\core\domain\services\validation\email\EmailValidationService'                                  => [
624
+				'EE_Registration_Config'                     => EE_Dependency_Map::load_from_cache,
625
+				'EventEspresso\core\services\loaders\Loader' => EE_Dependency_Map::load_from_cache,
626
+			],
627
+			'EventEspresso\core\domain\values\EmailAddress'                                                               => [
628
+				null,
629
+				'EventEspresso\core\domain\services\validation\email\EmailValidationService' => EE_Dependency_Map::load_from_cache,
630
+			],
631
+			'EventEspresso\core\services\orm\ModelFieldFactory'                                                           => [
632
+				'EventEspresso\core\services\loaders\Loader' => EE_Dependency_Map::load_from_cache,
633
+			],
634
+			'LEGACY_MODELS'                                                                                               => [
635
+				null,
636
+				'EventEspresso\core\services\database\ModelFieldFactory' => EE_Dependency_Map::load_from_cache,
637
+			],
638
+			'EE_Module_Request_Router'                                                                                    => [
639
+				'EE_Request' => EE_Dependency_Map::load_from_cache,
640
+			],
641
+			'EE_Registration_Processor'                                                                                   => [
642
+				'EE_Request' => EE_Dependency_Map::load_from_cache,
643
+			],
644
+			'EventEspresso\core\services\notifications\PersistentAdminNoticeManager'                                      => [
645
+				null,
646
+				'EventEspresso\core\domain\services\capabilities\CapabilitiesChecker' => EE_Dependency_Map::load_from_cache,
647
+				'EventEspresso\core\services\request\Request'                         => EE_Dependency_Map::load_from_cache,
648
+			],
649
+			'EventEspresso\caffeinated\modules\recaptcha_invisible\InvisibleRecaptcha'                                    => [
650
+				'EE_Registration_Config' => EE_Dependency_Map::load_from_cache,
651
+				'EE_Session'             => EE_Dependency_Map::load_from_cache,
652
+			],
653
+			'EventEspresso\modules\ticket_selector\ProcessTicketSelector'                                                 => [
654
+				'EE_Core_Config'                                                          => EE_Dependency_Map::load_from_cache,
655
+				'EventEspresso\core\services\request\Request'                             => EE_Dependency_Map::load_from_cache,
656
+				'EE_Session'                                                              => EE_Dependency_Map::load_from_cache,
657
+				'EEM_Ticket'                                                              => EE_Dependency_Map::load_from_cache,
658
+				'EventEspresso\modules\ticket_selector\TicketDatetimeAvailabilityTracker' => EE_Dependency_Map::load_from_cache,
659
+			],
660
+			'EventEspresso\modules\ticket_selector\TicketDatetimeAvailabilityTracker'                                     => [
661
+				'EEM_Datetime' => EE_Dependency_Map::load_from_cache,
662
+			],
663
+			'EventEspresso\core\domain\entities\custom_post_types\CustomPostTypeDefinitions'                              => [
664
+				'EE_Core_Config'                             => EE_Dependency_Map::load_from_cache,
665
+				'EventEspresso\core\services\loaders\Loader' => EE_Dependency_Map::load_from_cache,
666
+			],
667
+			'EventEspresso\core\domain\services\custom_post_types\RegisterCustomPostTypes'                                => [
668
+				'EventEspresso\core\domain\entities\custom_post_types\CustomPostTypeDefinitions' => EE_Dependency_Map::load_from_cache,
669
+			],
670
+			'EventEspresso\core\domain\services\custom_post_types\RegisterCustomTaxonomies'                               => [
671
+				'EventEspresso\core\domain\entities\custom_post_types\CustomTaxonomyDefinitions' => EE_Dependency_Map::load_from_cache,
672
+			],
673
+			'EE_CPT_Strategy'                                                                                             => [
674
+				'EventEspresso\core\domain\entities\custom_post_types\CustomPostTypeDefinitions' => EE_Dependency_Map::load_from_cache,
675
+				'EventEspresso\core\domain\entities\custom_post_types\CustomTaxonomyDefinitions' => EE_Dependency_Map::load_from_cache,
676
+			],
677
+			'EventEspresso\core\services\loaders\ObjectIdentifier'                                                        => [
678
+				'EventEspresso\core\services\loaders\ClassInterfaceCache' => EE_Dependency_Map::load_from_cache,
679
+			],
680
+			'EventEspresso\core\CPTs\CptQueryModifier'                                                                    => [
681
+				null,
682
+				null,
683
+				null,
684
+				'EE_Request_Handler'                          => EE_Dependency_Map::load_from_cache,
685
+				'EventEspresso\core\services\request\Request' => EE_Dependency_Map::load_from_cache,
686
+				'EventEspresso\core\services\loaders\Loader'  => EE_Dependency_Map::load_from_cache,
687
+			],
688
+			'EventEspresso\core\services\dependencies\DependencyResolver'                                                 => [
689
+				'EventEspresso\core\services\container\Mirror'            => EE_Dependency_Map::load_from_cache,
690
+				'EventEspresso\core\services\loaders\ClassInterfaceCache' => EE_Dependency_Map::load_from_cache,
691
+				'EE_Dependency_Map'                                       => EE_Dependency_Map::load_from_cache,
692
+			],
693
+			'EventEspresso\core\services\routing\RouteMatchSpecificationDependencyResolver'                               => [
694
+				'EventEspresso\core\services\container\Mirror'            => EE_Dependency_Map::load_from_cache,
695
+				'EventEspresso\core\services\loaders\ClassInterfaceCache' => EE_Dependency_Map::load_from_cache,
696
+				'EE_Dependency_Map'                                       => EE_Dependency_Map::load_from_cache,
697
+			],
698
+			'EventEspresso\core\services\routing\RouteMatchSpecificationFactory'                                          => [
699
+				'EventEspresso\core\services\routing\RouteMatchSpecificationDependencyResolver' => EE_Dependency_Map::load_from_cache,
700
+				'EventEspresso\core\services\loaders\Loader'                                    => EE_Dependency_Map::load_from_cache,
701
+			],
702
+			'EventEspresso\core\services\routing\RouteMatchSpecificationManager'                                          => [
703
+				'EventEspresso\core\services\routing\RouteMatchSpecificationCollection' => EE_Dependency_Map::load_from_cache,
704
+				'EventEspresso\core\services\routing\RouteMatchSpecificationFactory'    => EE_Dependency_Map::load_from_cache,
705
+			],
706
+			'EE_URL_Validation_Strategy'                                                                                  => [
707
+				null,
708
+				null,
709
+				'EventEspresso\core\services\validators\URLValidator' => EE_Dependency_Map::load_from_cache,
710
+			],
711
+			'EventEspresso\core\services\request\files\FilesDataHandler'                                                  => [
712
+				'EventEspresso\core\services\request\Request' => EE_Dependency_Map::load_from_cache,
713
+			],
714
+			'EventEspressoBatchRequest\BatchRequestProcessor'                                                             => [
715
+				'EventEspresso\core\services\loaders\Loader' => EE_Dependency_Map::load_from_cache,
716
+			],
717
+			'EventEspresso\core\domain\services\converters\RestApiSpoofer'                                                => [
718
+				'WP_REST_Server'                                               => EE_Dependency_Map::load_from_cache,
719
+				'EED_Core_Rest_Api'                                            => EE_Dependency_Map::load_from_cache,
720
+				'EventEspresso\core\libraries\rest_api\controllers\model\Read' => EE_Dependency_Map::load_from_cache,
721
+				null,
722
+			],
723
+			'EventEspresso\core\services\routing\RouteHandler'                                                            => [
724
+				'EventEspresso\core\services\json\JsonDataNodeHandler' => EE_Dependency_Map::load_from_cache,
725
+				'EventEspresso\core\services\loaders\Loader'           => EE_Dependency_Map::load_from_cache,
726
+				'EventEspresso\core\services\request\Request'          => EE_Dependency_Map::load_from_cache,
727
+				'EventEspresso\core\services\routing\RouteCollection'  => EE_Dependency_Map::load_from_cache,
728
+			],
729
+			'EventEspresso\core\services\json\JsonDataNodeHandler'                                                        => [
730
+				'EventEspresso\core\services\json\JsonDataNodeValidator' => EE_Dependency_Map::load_from_cache,
731
+			],
732
+			'EventEspresso\core\services\routing\Router'                                                                  => [
733
+				'EE_Dependency_Map'                                => EE_Dependency_Map::load_from_cache,
734
+				'EventEspresso\core\services\loaders\Loader'       => EE_Dependency_Map::load_from_cache,
735
+				'EventEspresso\core\services\routing\RouteHandler' => EE_Dependency_Map::load_from_cache,
736
+			],
737
+			'EventEspresso\core\services\assets\AssetManifest'                                                            => [
738
+				'EventEspresso\core\domain\Domain' => EE_Dependency_Map::load_from_cache,
739
+			],
740
+			'EventEspresso\core\services\assets\AssetManifestFactory'                                                     => [
741
+				'EventEspresso\core\services\loaders\Loader' => EE_Dependency_Map::load_from_cache,
742
+			],
743
+			'EventEspresso\core\services\assets\BaristaFactory'                                                           => [
744
+				'EventEspresso\core\services\assets\AssetManifestFactory' => EE_Dependency_Map::load_from_cache,
745
+				'EventEspresso\core\services\loaders\Loader'              => EE_Dependency_Map::load_from_cache,
746
+			],
747
+			'EventEspresso\core\domain\services\capabilities\FeatureFlags'                                                => [
748
+				'EventEspresso\core\domain\services\capabilities\CapabilitiesChecker' => EE_Dependency_Map::load_from_cache,
749
+			],
750
+		];
751
+	}
752
+
753
+
754
+	/**
755
+	 * Registers how core classes are loaded.
756
+	 * This can either be done by simply providing the name of one of the EE_Registry loader methods such as:
757
+	 *        'EE_Request_Handler' => 'load_core'
758
+	 *        'EE_Messages_Queue'  => 'load_lib'
759
+	 *        'EEH_Debug_Tools'    => 'load_helper'
760
+	 * or, if greater control is required, by providing a custom closure. For example:
761
+	 *        'Some_Class' => function () {
762
+	 *            return new Some_Class();
763
+	 *        },
764
+	 * This is required for instantiating dependencies
765
+	 * where an interface has been type hinted in a class constructor. For example:
766
+	 *        'Required_Interface' => function () {
767
+	 *            return new A_Class_That_Implements_Required_Interface();
768
+	 *        },
769
+	 */
770
+	protected function _register_core_class_loaders()
771
+	{
772
+		$this->_class_loaders = [
773
+			// load_core
774
+			'EE_Dependency_Map'                            => function () {
775
+				return $this;
776
+			},
777
+			'EE_Capabilities'                              => 'load_core',
778
+			'EE_Encryption'                                => 'load_core',
779
+			'EE_Front_Controller'                          => 'load_core',
780
+			'EE_Module_Request_Router'                     => 'load_core',
781
+			'EE_Registry'                                  => 'load_core',
782
+			'EE_Request'                                   => function () {
783
+				return $this->legacy_request;
784
+			},
785
+			'EventEspresso\core\services\request\Request'  => function () {
786
+				return $this->request;
787
+			},
788
+			'EventEspresso\core\services\request\Response' => function () {
789
+				return $this->response;
790
+			},
791
+			'EE_Base'                                      => 'load_core',
792
+			'EE_Request_Handler'                           => 'load_core',
793
+			'EE_Session'                                   => 'load_core',
794
+			'EE_Cron_Tasks'                                => 'load_core',
795
+			'EE_System'                                    => 'load_core',
796
+			'EE_Maintenance_Mode'                          => 'load_core',
797
+			'EE_Register_CPTs'                             => 'load_core',
798
+			'EE_Admin'                                     => 'load_core',
799
+			'EE_CPT_Strategy'                              => 'load_core',
800
+			// load_class
801
+			'EE_Registration_Processor'                    => 'load_class',
802
+			// load_lib
803
+			'EE_Message_Resource_Manager'                  => 'load_lib',
804
+			'EE_Message_Type_Collection'                   => 'load_lib',
805
+			'EE_Message_Type_Collection_Loader'            => 'load_lib',
806
+			'EE_Messenger_Collection'                      => 'load_lib',
807
+			'EE_Messenger_Collection_Loader'               => 'load_lib',
808
+			'EE_Messages_Processor'                        => 'load_lib',
809
+			'EE_Message_Repository'                        => 'load_lib',
810
+			'EE_Messages_Queue'                            => 'load_lib',
811
+			'EE_Messages_Data_Handler_Collection'          => 'load_lib',
812
+			'EE_Message_Template_Group_Collection'         => 'load_lib',
813
+			'EE_Payment_Method_Manager'                    => 'load_lib',
814
+			'EE_DMS_Core_4_1_0'                            => 'load_dms',
815
+			'EE_DMS_Core_4_2_0'                            => 'load_dms',
816
+			'EE_DMS_Core_4_3_0'                            => 'load_dms',
817
+			'EE_DMS_Core_4_5_0'                            => 'load_dms',
818
+			'EE_DMS_Core_4_6_0'                            => 'load_dms',
819
+			'EE_DMS_Core_4_7_0'                            => 'load_dms',
820
+			'EE_DMS_Core_4_8_0'                            => 'load_dms',
821
+			'EE_DMS_Core_4_9_0'                            => 'load_dms',
822
+			'EE_DMS_Core_4_10_0'                           => 'load_dms',
823
+			'EE_Messages_Generator'                        => static function () {
824
+				return EE_Registry::instance()->load_lib(
825
+					'Messages_Generator',
826
+					[],
827
+					false,
828
+					false
829
+				);
830
+			},
831
+			'EE_Messages_Template_Defaults'                => static function ($arguments = []) {
832
+				return EE_Registry::instance()->load_lib(
833
+					'Messages_Template_Defaults',
834
+					$arguments,
835
+					false,
836
+					false
837
+				);
838
+			},
839
+			// load_helper
840
+			'EEH_Parse_Shortcodes'                         => static function () {
841
+				if (EE_Registry::instance()->load_helper('Parse_Shortcodes')) {
842
+					return new EEH_Parse_Shortcodes();
843
+				}
844
+				return null;
845
+			},
846
+			'EE_Template_Config'                           => static function () {
847
+				return EE_Config::instance()->template_settings;
848
+			},
849
+			'EE_Currency_Config'                           => static function () {
850
+				return EE_Config::instance()->currency;
851
+			},
852
+			'EE_Registration_Config'                       => static function () {
853
+				return EE_Config::instance()->registration;
854
+			},
855
+			'EE_Core_Config'                               => static function () {
856
+				return EE_Config::instance()->core;
857
+			},
858
+			'EventEspresso\core\services\loaders\Loader'   => static function () {
859
+				return LoaderFactory::getLoader();
860
+			},
861
+			'EE_Network_Config'                            => static function () {
862
+				return EE_Network_Config::instance();
863
+			},
864
+			'EE_Config'                                    => static function () {
865
+				return EE_Config::instance();
866
+			},
867
+			'EventEspresso\core\domain\Domain'             => static function () {
868
+				return DomainFactory::getEventEspressoCoreDomain();
869
+			},
870
+			'EE_Admin_Config'                              => static function () {
871
+				return EE_Config::instance()->admin;
872
+			},
873
+			'EE_Organization_Config'                       => static function () {
874
+				return EE_Config::instance()->organization;
875
+			},
876
+			'EE_Network_Core_Config'                       => static function () {
877
+				return EE_Network_Config::instance()->core;
878
+			},
879
+			'EE_Environment_Config'                        => static function () {
880
+				return EE_Config::instance()->environment;
881
+			},
882
+			'EED_Core_Rest_Api'                            => static function () {
883
+				return EED_Core_Rest_Api::instance();
884
+			},
885
+			'WP_REST_Server'                               => static function () {
886
+				return rest_get_server();
887
+			},
888
+		];
889
+	}
890
+
891
+
892
+	/**
893
+	 * can be used for supplying alternate names for classes,
894
+	 * or for connecting interface names to instantiable classes
895
+	 *
896
+	 * @throws InvalidAliasException
897
+	 */
898
+	protected function _register_core_aliases()
899
+	{
900
+		$aliases = [
901
+			'CommandBusInterface'                                                          => 'EventEspresso\core\services\commands\CommandBusInterface',
902
+			'EventEspresso\core\services\commands\CommandBusInterface'                     => 'EventEspresso\core\services\commands\CommandBus',
903
+			'CommandHandlerManagerInterface'                                               => 'EventEspresso\core\services\commands\CommandHandlerManagerInterface',
904
+			'EventEspresso\core\services\commands\CommandHandlerManagerInterface'          => 'EventEspresso\core\services\commands\CommandHandlerManager',
905
+			'CapChecker'                                                                   => 'EventEspresso\core\services\commands\middleware\CapChecker',
906
+			'AddActionHook'                                                                => 'EventEspresso\core\services\commands\middleware\AddActionHook',
907
+			'CapabilitiesChecker'                                                          => 'EventEspresso\core\domain\services\capabilities\CapabilitiesChecker',
908
+			'CapabilitiesCheckerInterface'                                                 => 'EventEspresso\core\domain\services\capabilities\CapabilitiesCheckerInterface',
909
+			'EventEspresso\core\domain\services\capabilities\CapabilitiesCheckerInterface' => 'EventEspresso\core\domain\services\capabilities\CapabilitiesChecker',
910
+			'CreateRegistrationService'                                                    => 'EventEspresso\core\domain\services\registration\CreateRegistrationService',
911
+			'CreateRegistrationCommandHandler'                                             => 'EventEspresso\core\services\commands\registration\CreateRegistrationCommand',
912
+			'CopyRegistrationDetailsCommandHandler'                                        => 'EventEspresso\core\services\commands\registration\CopyRegistrationDetailsCommand',
913
+			'CopyRegistrationPaymentsCommandHandler'                                       => 'EventEspresso\core\services\commands\registration\CopyRegistrationPaymentsCommand',
914
+			'CancelRegistrationAndTicketLineItemCommandHandler'                            => 'EventEspresso\core\services\commands\registration\CancelRegistrationAndTicketLineItemCommandHandler',
915
+			'UpdateRegistrationAndTransactionAfterChangeCommandHandler'                    => 'EventEspresso\core\services\commands\registration\UpdateRegistrationAndTransactionAfterChangeCommandHandler',
916
+			'CreateTicketLineItemCommandHandler'                                           => 'EventEspresso\core\services\commands\ticket\CreateTicketLineItemCommand',
917
+			'CreateTransactionCommandHandler'                                              => 'EventEspresso\core\services\commands\transaction\CreateTransactionCommandHandler',
918
+			'CreateAttendeeCommandHandler'                                                 => 'EventEspresso\core\services\commands\attendee\CreateAttendeeCommandHandler',
919
+			'TableManager'                                                                 => 'EventEspresso\core\services\database\TableManager',
920
+			'TableAnalysis'                                                                => 'EventEspresso\core\services\database\TableAnalysis',
921
+			'EspressoShortcode'                                                            => 'EventEspresso\core\services\shortcodes\EspressoShortcode',
922
+			'ShortcodeInterface'                                                           => 'EventEspresso\core\services\shortcodes\ShortcodeInterface',
923
+			'EventEspresso\core\services\shortcodes\ShortcodeInterface'                    => 'EventEspresso\core\services\shortcodes\EspressoShortcode',
924
+			'EventEspresso\core\services\cache\CacheStorageInterface'                      => 'EventEspresso\core\services\cache\TransientCacheStorage',
925
+			'LoaderInterface'                                                              => 'EventEspresso\core\services\loaders\LoaderInterface',
926
+			'EventEspresso\core\services\loaders\LoaderInterface'                          => 'EventEspresso\core\services\loaders\Loader',
927
+			'CommandFactoryInterface'                                                      => 'EventEspresso\core\services\commands\CommandFactoryInterface',
928
+			'EventEspresso\core\services\commands\CommandFactoryInterface'                 => 'EventEspresso\core\services\commands\CommandFactory',
929
+			'EmailValidatorInterface'                                                      => 'EventEspresso\core\domain\services\validation\email\EmailValidatorInterface',
930
+			'EventEspresso\core\domain\services\validation\email\EmailValidatorInterface'  => 'EventEspresso\core\domain\services\validation\email\EmailValidationService',
931
+			'NoticeConverterInterface'                                                     => 'EventEspresso\core\services\notices\NoticeConverterInterface',
932
+			'EventEspresso\core\services\notices\NoticeConverterInterface'                 => 'EventEspresso\core\services\notices\ConvertNoticesToEeErrors',
933
+			'NoticesContainerInterface'                                                    => 'EventEspresso\core\services\notices\NoticesContainerInterface',
934
+			'EventEspresso\core\services\notices\NoticesContainerInterface'                => 'EventEspresso\core\services\notices\NoticesContainer',
935
+			'EventEspresso\core\services\request\RequestInterface'                         => 'EventEspresso\core\services\request\Request',
936
+			'EventEspresso\core\services\request\ResponseInterface'                        => 'EventEspresso\core\services\request\Response',
937
+			'EventEspresso\core\domain\DomainInterface'                                    => 'EventEspresso\core\domain\Domain',
938
+			'Registration_Processor'                                                       => 'EE_Registration_Processor',
939
+			'EventEspresso\core\services\assets\AssetManifestInterface'                    => 'EventEspresso\core\services\assets\AssetManifest',
940
+		];
941
+		foreach ($aliases as $alias => $fqn) {
942
+			if (is_array($fqn)) {
943
+				foreach ($fqn as $class => $for_class) {
944
+					$this->class_cache->addAlias($class, $alias, $for_class);
945
+				}
946
+				continue;
947
+			}
948
+			$this->class_cache->addAlias($fqn, $alias);
949
+		}
950
+		if (! (defined('DOING_AJAX') && DOING_AJAX) && is_admin()) {
951
+			$this->class_cache->addAlias(
952
+				'EventEspresso\core\services\notices\ConvertNoticesToAdminNotices',
953
+				'EventEspresso\core\services\notices\NoticeConverterInterface'
954
+			);
955
+		}
956
+	}
957
+
958
+
959
+	/**
960
+	 * This is used to reset the internal map and class_loaders to their original default state at the beginning of the
961
+	 * request Primarily used by unit tests.
962
+	 */
963
+	public function reset()
964
+	{
965
+		$this->_register_core_class_loaders();
966
+		$this->_register_core_dependencies();
967
+	}
968
+
969
+
970
+	/**
971
+	 * PLZ NOTE: a better name for this method would be is_alias()
972
+	 * because it returns TRUE if the provided fully qualified name IS an alias
973
+	 * WHY?
974
+	 * Because if a class is type hinting for a concretion,
975
+	 * then why would we need to find another class to supply it?
976
+	 * ie: if a class asks for `Fully/Qualified/Namespace/SpecificClassName`,
977
+	 * then give it an instance of `Fully/Qualified/Namespace/SpecificClassName`.
978
+	 * Don't go looking for some substitute.
979
+	 * Whereas if a class is type hinting for an interface...
980
+	 * then we need to find an actual class to use.
981
+	 * So the interface IS the alias for some other FQN,
982
+	 * and we need to find out if `Fully/Qualified/Namespace/SomeInterface`
983
+	 * represents some other class.
984
+	 *
985
+	 * @param string $fqn
986
+	 * @param string $for_class
987
+	 * @return bool
988
+	 * @deprecated 4.9.62.p
989
+	 */
990
+	public function has_alias($fqn = '', $for_class = '')
991
+	{
992
+		return $this->isAlias($fqn, $for_class);
993
+	}
994
+
995
+
996
+	/**
997
+	 * PLZ NOTE: a better name for this method would be get_fqn_for_alias()
998
+	 * because it returns a FQN for provided alias if one exists, otherwise returns the original $alias
999
+	 * functions recursively, so that multiple aliases can be used to drill down to a FQN
1000
+	 *  for example:
1001
+	 *      if the following two entries were added to the _aliases array:
1002
+	 *          array(
1003
+	 *              'interface_alias'           => 'some\namespace\interface'
1004
+	 *              'some\namespace\interface'  => 'some\namespace\classname'
1005
+	 *          )
1006
+	 *      then one could use EE_Registry::instance()->create( 'interface_alias' )
1007
+	 *      to load an instance of 'some\namespace\classname'
1008
+	 *
1009
+	 * @param string $alias
1010
+	 * @param string $for_class
1011
+	 * @return string
1012
+	 * @deprecated 4.9.62.p
1013
+	 */
1014
+	public function get_alias($alias = '', $for_class = '')
1015
+	{
1016
+		return $this->getFqnForAlias($alias, $for_class);
1017
+	}
1018 1018
 }
Please login to merge, or discard this patch.
core/domain/entities/routing/data_nodes/core/SitePermissions.php 1 patch
Indentation   +27 added lines, -27 removed lines patch added patch discarded remove patch
@@ -8,31 +8,31 @@
 block discarded – undo
8 8
 
9 9
 class SitePermissions extends JsonDataNode
10 10
 {
11
-    const NODE_NAME = 'sitePermissions';
12
-
13
-    /**
14
-     * @var FeatureFlags
15
-     */
16
-    private $feature_flags;
17
-
18
-
19
-    /**
20
-     * @param FeatureFlags          $feature_flags
21
-     * @param JsonDataNodeValidator $validator
22
-     */
23
-    public function __construct(FeatureFlags $feature_flags, JsonDataNodeValidator $validator)
24
-    {
25
-        $this->feature_flags = $feature_flags;
26
-        parent::__construct($validator);
27
-        $this->setNodeName(SitePermissions::NODE_NAME);
28
-    }
29
-
30
-
31
-    /**
32
-     * @inheritDoc
33
-     */
34
-    public function initialize()
35
-    {
36
-        $this->setDataArray($this->feature_flags->getAllowedFeatures());
37
-    }
11
+	const NODE_NAME = 'sitePermissions';
12
+
13
+	/**
14
+	 * @var FeatureFlags
15
+	 */
16
+	private $feature_flags;
17
+
18
+
19
+	/**
20
+	 * @param FeatureFlags          $feature_flags
21
+	 * @param JsonDataNodeValidator $validator
22
+	 */
23
+	public function __construct(FeatureFlags $feature_flags, JsonDataNodeValidator $validator)
24
+	{
25
+		$this->feature_flags = $feature_flags;
26
+		parent::__construct($validator);
27
+		$this->setNodeName(SitePermissions::NODE_NAME);
28
+	}
29
+
30
+
31
+	/**
32
+	 * @inheritDoc
33
+	 */
34
+	public function initialize()
35
+	{
36
+		$this->setDataArray($this->feature_flags->getAllowedFeatures());
37
+	}
38 38
 }
Please login to merge, or discard this patch.
core/domain/entities/routing/handlers/shared/RegularRequests.php 1 patch
Indentation   +139 added lines, -139 removed lines patch added patch discarded remove patch
@@ -17,149 +17,149 @@
 block discarded – undo
17 17
 class RegularRequests extends PrimaryRoute
18 18
 {
19 19
 
20
-    /**
21
-     * called just before matchesCurrentRequest()
22
-     * and allows Route to perform any setup required such as calling setSpecification()
23
-     *
24
-     * @since $VID:$
25
-     */
26
-    public function initialize()
27
-    {
28
-        $basic_nodes = [
29
-            'EventEspresso\core\domain\entities\routing\data_nodes\core\Api',
30
-            'EventEspresso\core\domain\entities\routing\data_nodes\core\Capabilities',
31
-            'EventEspresso\core\domain\entities\routing\data_nodes\core\Locale',
32
-            'EventEspresso\core\domain\entities\routing\data_nodes\core\SiteUrls',
33
-        ];
34
-        foreach ($basic_nodes as $basic_node) {
35
-            $this->dependency_map->registerDependencies(
36
-                $basic_node,
37
-                ['EventEspresso\core\services\json\JsonDataNodeValidator' => EE_Dependency_Map::load_from_cache]
38
-            );
39
-        }
40
-        $this->dependency_map->registerDependencies(
41
-            'EventEspresso\core\domain\entities\routing\data_nodes\core\SitePermissions',
42
-            [
43
-                'EventEspresso\core\domain\services\capabilities\FeatureFlags' => EE_Dependency_Map::load_from_cache,
44
-                'EventEspresso\core\services\json\JsonDataNodeValidator'       => EE_Dependency_Map::load_from_cache,
45
-            ]
46
-        );
47
-        $this->dependency_map->registerDependencies(
48
-            'EventEspresso\core\domain\entities\routing\data_nodes\core\GeneralSettings',
49
-            [
50
-                'EventEspresso\core\services\json\JsonDataNodeValidator'                => EE_Dependency_Map::load_from_cache,
51
-                'EventEspresso\core\services\converters\date_time_formats\PhpToUnicode' => EE_Dependency_Map::load_from_cache,
52
-            ]
53
-        );
54
-        $this->dependency_map->registerDependencies(
55
-            'EventEspresso\core\domain\entities\routing\data_nodes\EventEspressoData',
56
-            [
57
-                'EventEspresso\core\domain\entities\routing\data_nodes\core\Api'    => EE_Dependency_Map::load_from_cache,
58
-                'EventEspresso\core\domain\entities\routing\data_nodes\core\Config' => EE_Dependency_Map::load_from_cache,
59
-                'EventEspresso\core\services\assets\JedLocaleData'                  => EE_Dependency_Map::load_from_cache,
60
-                'EventEspresso\core\services\json\JsonDataNodeValidator'            => EE_Dependency_Map::load_from_cache,
61
-            ]
62
-        );
63
-        $this->dependency_map->registerDependencies(
64
-            'EventEspresso\core\domain\entities\routing\data_nodes\core\Config',
65
-            [
66
-                'EventEspresso\core\domain\entities\routing\data_nodes\core\CurrentUser'        => EE_Dependency_Map::load_from_cache,
67
-                'EventEspresso\core\domain\entities\routing\data_nodes\core\EspressoCoreDomain' => EE_Dependency_Map::load_from_cache,
68
-                'EventEspresso\core\domain\entities\routing\data_nodes\core\GeneralSettings'    => EE_Dependency_Map::load_from_cache,
69
-                'EventEspresso\core\domain\entities\routing\data_nodes\core\Locale'             => EE_Dependency_Map::load_from_cache,
70
-                'EventEspresso\core\domain\entities\routing\data_nodes\core\SiteCurrency'       => EE_Dependency_Map::load_from_cache,
71
-                'EventEspresso\core\domain\entities\routing\data_nodes\core\SitePermissions'    => EE_Dependency_Map::load_from_cache,
72
-                'EventEspresso\core\domain\entities\routing\data_nodes\core\SiteUrls'           => EE_Dependency_Map::load_from_cache,
73
-                'EventEspresso\core\services\json\JsonDataNodeValidator'                        => EE_Dependency_Map::load_from_cache,
74
-            ]
75
-        );
76
-        $this->dependency_map->registerDependencies(
77
-            'EventEspresso\core\domain\entities\routing\data_nodes\core\CurrentUser',
78
-            [
79
-                'EventEspresso\core\domain\entities\routing\data_nodes\core\Capabilities' => EE_Dependency_Map::load_from_cache,
80
-                'EventEspresso\core\services\json\JsonDataNodeValidator'                  => EE_Dependency_Map::load_from_cache,
81
-            ]
82
-        );
83
-        $this->dependency_map->registerDependencies(
84
-            'EventEspresso\core\domain\entities\routing\data_nodes\core\EspressoCoreDomain',
85
-            [
86
-                'EventEspresso\core\domain\Domain'                       => EE_Dependency_Map::load_from_cache,
87
-                'EventEspresso\core\services\json\JsonDataNodeValidator' => EE_Dependency_Map::load_from_cache,
88
-            ]
89
-        );
90
-        $this->dependency_map->registerDependencies(
91
-            'EventEspresso\core\domain\entities\routing\data_nodes\core\SiteCurrency',
92
-            [
93
-                'EE_Currency_Config'                                     => EE_Dependency_Map::load_from_cache,
94
-                'EventEspresso\core\services\json\JsonDataNodeValidator' => EE_Dependency_Map::load_from_cache,
95
-            ]
96
-        );
97
-        $this->setDataNode(
98
-            $this->loader->getShared('EventEspresso\core\domain\entities\routing\data_nodes\EventEspressoData')
99
-        );
100
-    }
20
+	/**
21
+	 * called just before matchesCurrentRequest()
22
+	 * and allows Route to perform any setup required such as calling setSpecification()
23
+	 *
24
+	 * @since $VID:$
25
+	 */
26
+	public function initialize()
27
+	{
28
+		$basic_nodes = [
29
+			'EventEspresso\core\domain\entities\routing\data_nodes\core\Api',
30
+			'EventEspresso\core\domain\entities\routing\data_nodes\core\Capabilities',
31
+			'EventEspresso\core\domain\entities\routing\data_nodes\core\Locale',
32
+			'EventEspresso\core\domain\entities\routing\data_nodes\core\SiteUrls',
33
+		];
34
+		foreach ($basic_nodes as $basic_node) {
35
+			$this->dependency_map->registerDependencies(
36
+				$basic_node,
37
+				['EventEspresso\core\services\json\JsonDataNodeValidator' => EE_Dependency_Map::load_from_cache]
38
+			);
39
+		}
40
+		$this->dependency_map->registerDependencies(
41
+			'EventEspresso\core\domain\entities\routing\data_nodes\core\SitePermissions',
42
+			[
43
+				'EventEspresso\core\domain\services\capabilities\FeatureFlags' => EE_Dependency_Map::load_from_cache,
44
+				'EventEspresso\core\services\json\JsonDataNodeValidator'       => EE_Dependency_Map::load_from_cache,
45
+			]
46
+		);
47
+		$this->dependency_map->registerDependencies(
48
+			'EventEspresso\core\domain\entities\routing\data_nodes\core\GeneralSettings',
49
+			[
50
+				'EventEspresso\core\services\json\JsonDataNodeValidator'                => EE_Dependency_Map::load_from_cache,
51
+				'EventEspresso\core\services\converters\date_time_formats\PhpToUnicode' => EE_Dependency_Map::load_from_cache,
52
+			]
53
+		);
54
+		$this->dependency_map->registerDependencies(
55
+			'EventEspresso\core\domain\entities\routing\data_nodes\EventEspressoData',
56
+			[
57
+				'EventEspresso\core\domain\entities\routing\data_nodes\core\Api'    => EE_Dependency_Map::load_from_cache,
58
+				'EventEspresso\core\domain\entities\routing\data_nodes\core\Config' => EE_Dependency_Map::load_from_cache,
59
+				'EventEspresso\core\services\assets\JedLocaleData'                  => EE_Dependency_Map::load_from_cache,
60
+				'EventEspresso\core\services\json\JsonDataNodeValidator'            => EE_Dependency_Map::load_from_cache,
61
+			]
62
+		);
63
+		$this->dependency_map->registerDependencies(
64
+			'EventEspresso\core\domain\entities\routing\data_nodes\core\Config',
65
+			[
66
+				'EventEspresso\core\domain\entities\routing\data_nodes\core\CurrentUser'        => EE_Dependency_Map::load_from_cache,
67
+				'EventEspresso\core\domain\entities\routing\data_nodes\core\EspressoCoreDomain' => EE_Dependency_Map::load_from_cache,
68
+				'EventEspresso\core\domain\entities\routing\data_nodes\core\GeneralSettings'    => EE_Dependency_Map::load_from_cache,
69
+				'EventEspresso\core\domain\entities\routing\data_nodes\core\Locale'             => EE_Dependency_Map::load_from_cache,
70
+				'EventEspresso\core\domain\entities\routing\data_nodes\core\SiteCurrency'       => EE_Dependency_Map::load_from_cache,
71
+				'EventEspresso\core\domain\entities\routing\data_nodes\core\SitePermissions'    => EE_Dependency_Map::load_from_cache,
72
+				'EventEspresso\core\domain\entities\routing\data_nodes\core\SiteUrls'           => EE_Dependency_Map::load_from_cache,
73
+				'EventEspresso\core\services\json\JsonDataNodeValidator'                        => EE_Dependency_Map::load_from_cache,
74
+			]
75
+		);
76
+		$this->dependency_map->registerDependencies(
77
+			'EventEspresso\core\domain\entities\routing\data_nodes\core\CurrentUser',
78
+			[
79
+				'EventEspresso\core\domain\entities\routing\data_nodes\core\Capabilities' => EE_Dependency_Map::load_from_cache,
80
+				'EventEspresso\core\services\json\JsonDataNodeValidator'                  => EE_Dependency_Map::load_from_cache,
81
+			]
82
+		);
83
+		$this->dependency_map->registerDependencies(
84
+			'EventEspresso\core\domain\entities\routing\data_nodes\core\EspressoCoreDomain',
85
+			[
86
+				'EventEspresso\core\domain\Domain'                       => EE_Dependency_Map::load_from_cache,
87
+				'EventEspresso\core\services\json\JsonDataNodeValidator' => EE_Dependency_Map::load_from_cache,
88
+			]
89
+		);
90
+		$this->dependency_map->registerDependencies(
91
+			'EventEspresso\core\domain\entities\routing\data_nodes\core\SiteCurrency',
92
+			[
93
+				'EE_Currency_Config'                                     => EE_Dependency_Map::load_from_cache,
94
+				'EventEspresso\core\services\json\JsonDataNodeValidator' => EE_Dependency_Map::load_from_cache,
95
+			]
96
+		);
97
+		$this->setDataNode(
98
+			$this->loader->getShared('EventEspresso\core\domain\entities\routing\data_nodes\EventEspressoData')
99
+		);
100
+	}
101 101
 
102 102
 
103
-    /**
104
-     * returns true if the current request matches this route
105
-     *
106
-     * @return bool
107
-     * @since   $VID:$
108
-     */
109
-    public function matchesCurrentRequest()
110
-    {
111
-        return ! $this->request->isActivation() || $this->request->isUnitTesting();
112
-    }
103
+	/**
104
+	 * returns true if the current request matches this route
105
+	 *
106
+	 * @return bool
107
+	 * @since   $VID:$
108
+	 */
109
+	public function matchesCurrentRequest()
110
+	{
111
+		return ! $this->request->isActivation() || $this->request->isUnitTesting();
112
+	}
113 113
 
114 114
 
115
-    /**
116
-     * @since $VID:$
117
-     */
118
-    protected function registerDependencies()
119
-    {
120
-        $admin = ['EE_Admin_Config' => EE_Dependency_Map::load_from_cache] + Route::$default_dependencies;
121
-        $public = ['EE_Maintenance_Mode' => EE_Dependency_Map::load_from_cache] + Route::$default_dependencies;
122
-        $default_with_barista = [
123
-                                    'EventEspresso\core\services\assets\BaristaFactory' => EE_Dependency_Map::load_from_cache,
124
-                                ] + Route::$default_dependencies;
125
-        $default_with_manifest = [
126
-                                     'EventEspresso\core\services\assets\AssetManifestFactory' => EE_Dependency_Map::load_from_cache,
127
-                                 ] + Route::$default_dependencies;
128
-        $default_routes = [
129
-            // default dependencies
130
-            'EventEspresso\core\domain\entities\routing\handlers\admin\PueRequests'          => Route::$default_dependencies,
131
-            'EventEspresso\core\domain\entities\routing\handlers\admin\WordPressPluginsPage' => Route::$default_dependencies,
132
-            'EventEspresso\core\domain\entities\routing\handlers\frontend\ShortcodeRequests' => Route::$default_dependencies,
133
-            'EventEspresso\core\domain\entities\routing\handlers\shared\RestApiRequests'     => Route::$default_dependencies,
134
-            'EventEspresso\core\domain\entities\routing\handlers\shared\SessionRequests'     => Route::$default_dependencies,
135
-            'EventEspresso\core\domain\entities\routing\handlers\shared\WordPressHeartbeat'  => Route::$default_dependencies,
136
-            'EventEspresso\core\domain\entities\routing\handlers\shared\AssetRequests'       => $default_with_barista,
137
-            'EventEspresso\core\domain\entities\routing\handlers\shared\GQLRequests'         => $default_with_manifest,
138
-            // admin dependencies
139
-            'EventEspresso\core\domain\entities\routing\handlers\admin\AdminRoute'           => $admin,
140
-            'EventEspresso\core\domain\entities\routing\handlers\admin\EspressoEventsAdmin'  => $admin,
141
-            'EventEspresso\core\domain\entities\routing\handlers\admin\EspressoEventEditor'  => $admin,
142
-            'EventEspresso\core\domain\entities\routing\handlers\admin\EspressoLegacyAdmin'  => $admin,
143
-            'EventEspresso\core\domain\entities\routing\handlers\admin\GutenbergEditor'      => $admin,
144
-            // public dependencies
145
-            'EventEspresso\core\domain\entities\routing\handlers\admin\PersonalDataRequests' => $public,
146
-            'EventEspresso\core\domain\entities\routing\handlers\frontend\FrontendRequests'  => $public,
147
-        ];
148
-        foreach ($default_routes as $route => $dependencies) {
149
-            $this->dependency_map->registerDependencies($route, $dependencies);
150
-        }
151
-    }
115
+	/**
116
+	 * @since $VID:$
117
+	 */
118
+	protected function registerDependencies()
119
+	{
120
+		$admin = ['EE_Admin_Config' => EE_Dependency_Map::load_from_cache] + Route::$default_dependencies;
121
+		$public = ['EE_Maintenance_Mode' => EE_Dependency_Map::load_from_cache] + Route::$default_dependencies;
122
+		$default_with_barista = [
123
+									'EventEspresso\core\services\assets\BaristaFactory' => EE_Dependency_Map::load_from_cache,
124
+								] + Route::$default_dependencies;
125
+		$default_with_manifest = [
126
+									 'EventEspresso\core\services\assets\AssetManifestFactory' => EE_Dependency_Map::load_from_cache,
127
+								 ] + Route::$default_dependencies;
128
+		$default_routes = [
129
+			// default dependencies
130
+			'EventEspresso\core\domain\entities\routing\handlers\admin\PueRequests'          => Route::$default_dependencies,
131
+			'EventEspresso\core\domain\entities\routing\handlers\admin\WordPressPluginsPage' => Route::$default_dependencies,
132
+			'EventEspresso\core\domain\entities\routing\handlers\frontend\ShortcodeRequests' => Route::$default_dependencies,
133
+			'EventEspresso\core\domain\entities\routing\handlers\shared\RestApiRequests'     => Route::$default_dependencies,
134
+			'EventEspresso\core\domain\entities\routing\handlers\shared\SessionRequests'     => Route::$default_dependencies,
135
+			'EventEspresso\core\domain\entities\routing\handlers\shared\WordPressHeartbeat'  => Route::$default_dependencies,
136
+			'EventEspresso\core\domain\entities\routing\handlers\shared\AssetRequests'       => $default_with_barista,
137
+			'EventEspresso\core\domain\entities\routing\handlers\shared\GQLRequests'         => $default_with_manifest,
138
+			// admin dependencies
139
+			'EventEspresso\core\domain\entities\routing\handlers\admin\AdminRoute'           => $admin,
140
+			'EventEspresso\core\domain\entities\routing\handlers\admin\EspressoEventsAdmin'  => $admin,
141
+			'EventEspresso\core\domain\entities\routing\handlers\admin\EspressoEventEditor'  => $admin,
142
+			'EventEspresso\core\domain\entities\routing\handlers\admin\EspressoLegacyAdmin'  => $admin,
143
+			'EventEspresso\core\domain\entities\routing\handlers\admin\GutenbergEditor'      => $admin,
144
+			// public dependencies
145
+			'EventEspresso\core\domain\entities\routing\handlers\admin\PersonalDataRequests' => $public,
146
+			'EventEspresso\core\domain\entities\routing\handlers\frontend\FrontendRequests'  => $public,
147
+		];
148
+		foreach ($default_routes as $route => $dependencies) {
149
+			$this->dependency_map->registerDependencies($route, $dependencies);
150
+		}
151
+	}
152 152
 
153 153
 
154
-    /**
155
-     * implements logic required to run during request
156
-     *
157
-     * @return bool
158
-     * @since   $VID:$
159
-     */
160
-    protected function requestHandler()
161
-    {
162
-        $this->setRouteRequestType(PrimaryRoute::ROUTE_REQUEST_TYPE_REGULAR);
163
-        return true;
164
-    }
154
+	/**
155
+	 * implements logic required to run during request
156
+	 *
157
+	 * @return bool
158
+	 * @since   $VID:$
159
+	 */
160
+	protected function requestHandler()
161
+	{
162
+		$this->setRouteRequestType(PrimaryRoute::ROUTE_REQUEST_TYPE_REGULAR);
163
+		return true;
164
+	}
165 165
 }
Please login to merge, or discard this patch.
core/domain/services/capabilities/FeatureFlags.php 2 patches
Indentation   +58 added lines, -58 removed lines patch added patch discarded remove patch
@@ -14,69 +14,69 @@
 block discarded – undo
14 14
 class FeatureFlags
15 15
 {
16 16
 
17
-    /**
18
-     * @var CapabilitiesChecker $capabilities_checker
19
-     */
20
-    private $capabilities_checker;
17
+	/**
18
+	 * @var CapabilitiesChecker $capabilities_checker
19
+	 */
20
+	private $capabilities_checker;
21 21
 
22
-    /**
23
-     * array of key value pairs where the key is the feature flag in question
24
-     * and the value is either a boolean or a CapCheck object defining the required permissions
25
-     * example:
26
-     *       [
27
-     *          'use_bulk_edit' => true,
28
-     *          'use_death_ray' => new CapCheck( 'ee-death-ray-cap', 'context-desc' )
29
-     *      ]
30
-     * array is filterable via FHEE__EventEspresso_core_domain_services_capabilities_FeatureFlags
31
-     *
32
-     * @var boolean[]|CapCheck[]
33
-     */
34
-    private $feature_flags = [];
22
+	/**
23
+	 * array of key value pairs where the key is the feature flag in question
24
+	 * and the value is either a boolean or a CapCheck object defining the required permissions
25
+	 * example:
26
+	 *       [
27
+	 *          'use_bulk_edit' => true,
28
+	 *          'use_death_ray' => new CapCheck( 'ee-death-ray-cap', 'context-desc' )
29
+	 *      ]
30
+	 * array is filterable via FHEE__EventEspresso_core_domain_services_capabilities_FeatureFlags
31
+	 *
32
+	 * @var boolean[]|CapCheck[]
33
+	 */
34
+	private $feature_flags = [];
35 35
 
36 36
 
37
-    /**
38
-     * FeatureFlags constructor.
39
-     *
40
-     * @param CapabilitiesChecker $capabilities_checker
41
-     */
42
-    public function __construct(CapabilitiesChecker $capabilities_checker)
43
-    {
44
-        $this->capabilities_checker = $capabilities_checker;
45
-        $this->feature_flags = apply_filters(
46
-            'FHEE__EventEspresso_core_domain_services_capabilities_FeatureFlags',
47
-            [
48
-                'use_bulk_edit'             => false,
49
-                'use_event_description_rte' => false,
50
-                'use_reg_options_meta_box'  => false,
51
-            ]
52
-        );
53
-    }
37
+	/**
38
+	 * FeatureFlags constructor.
39
+	 *
40
+	 * @param CapabilitiesChecker $capabilities_checker
41
+	 */
42
+	public function __construct(CapabilitiesChecker $capabilities_checker)
43
+	{
44
+		$this->capabilities_checker = $capabilities_checker;
45
+		$this->feature_flags = apply_filters(
46
+			'FHEE__EventEspresso_core_domain_services_capabilities_FeatureFlags',
47
+			[
48
+				'use_bulk_edit'             => false,
49
+				'use_event_description_rte' => false,
50
+				'use_reg_options_meta_box'  => false,
51
+			]
52
+		);
53
+	}
54 54
 
55 55
 
56
-    /**
57
-     * @param string $feature
58
-     * @return bool
59
-     */
60
-    public function featureAllowed(string $feature)
61
-    {
62
-        $flag = isset($this->feature_flags[ $feature ]) ? $this->feature_flags[ $feature ] : false;
63
-        try {
64
-            return $flag instanceof CapCheck
65
-                ? $this->capabilities_checker->processCapCheck($flag)
66
-                : $flag;
67
-        } catch (InsufficientPermissionsException $e) {
68
-            // eat the exception
69
-        }
70
-        return false;
71
-    }
56
+	/**
57
+	 * @param string $feature
58
+	 * @return bool
59
+	 */
60
+	public function featureAllowed(string $feature)
61
+	{
62
+		$flag = isset($this->feature_flags[ $feature ]) ? $this->feature_flags[ $feature ] : false;
63
+		try {
64
+			return $flag instanceof CapCheck
65
+				? $this->capabilities_checker->processCapCheck($flag)
66
+				: $flag;
67
+		} catch (InsufficientPermissionsException $e) {
68
+			// eat the exception
69
+		}
70
+		return false;
71
+	}
72 72
 
73 73
 
74
-    /**
75
-     * @return array
76
-     */
77
-    public function getAllowedFeatures()
78
-    {
79
-        $allowed = array_filter($this->feature_flags, [$this, 'featureAllowed'], ARRAY_FILTER_USE_KEY);
80
-        return array_keys($allowed);
81
-    }
74
+	/**
75
+	 * @return array
76
+	 */
77
+	public function getAllowedFeatures()
78
+	{
79
+		$allowed = array_filter($this->feature_flags, [$this, 'featureAllowed'], ARRAY_FILTER_USE_KEY);
80
+		return array_keys($allowed);
81
+	}
82 82
 }
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -59,7 +59,7 @@
 block discarded – undo
59 59
      */
60 60
     public function featureAllowed(string $feature)
61 61
     {
62
-        $flag = isset($this->feature_flags[ $feature ]) ? $this->feature_flags[ $feature ] : false;
62
+        $flag = isset($this->feature_flags[$feature]) ? $this->feature_flags[$feature] : false;
63 63
         try {
64 64
             return $flag instanceof CapCheck
65 65
                 ? $this->capabilities_checker->processCapCheck($flag)
Please login to merge, or discard this patch.
languages/event_espresso-translations-js.php 1 patch
Spacing   +407 added lines, -407 removed lines patch added patch discarded remove patch
@@ -2,240 +2,240 @@  discard block
 block discarded – undo
2 2
 /* THIS IS A GENERATED FILE. DO NOT EDIT DIRECTLY. */
3 3
 $generated_i18n_strings = array(
4 4
 	// Reference: packages/components/src/Pagination/constants.ts:6
5
-	__( '2', 'event_espresso' ),
5
+	__('2', 'event_espresso'),
6 6
 
7 7
 	// Reference: packages/components/src/Pagination/constants.ts:7
8
-	__( '6', 'event_espresso' ),
8
+	__('6', 'event_espresso'),
9 9
 
10 10
 	// Reference: packages/components/src/Pagination/constants.ts:8
11
-	__( '12', 'event_espresso' ),
11
+	__('12', 'event_espresso'),
12 12
 
13 13
 	// Reference: packages/components/src/Pagination/constants.ts:9
14
-	__( '24', 'event_espresso' ),
14
+	__('24', 'event_espresso'),
15 15
 
16 16
 	// Reference: packages/components/src/Pagination/constants.ts:10
17
-	__( '48', 'event_espresso' ),
17
+	__('48', 'event_espresso'),
18 18
 
19 19
 	// Reference: domains/blocks/src/components/AvatarImage.tsx:27
20
-	__( 'contact avatar', 'event_espresso' ),
20
+	__('contact avatar', 'event_espresso'),
21 21
 
22 22
 	// Reference: domains/blocks/src/components/OrderByControl.tsx:13
23
-	__( 'Order by', 'event_espresso' ),
23
+	__('Order by', 'event_espresso'),
24 24
 
25 25
 	// Reference: domains/blocks/src/components/RegStatusControl.tsx:18
26 26
 	// Reference: domains/blocks/src/event-attendees/controls/SelectStatus.tsx:12
27
-	__( 'Select Registration Status', 'event_espresso' ),
27
+	__('Select Registration Status', 'event_espresso'),
28 28
 
29 29
 	// Reference: domains/blocks/src/components/SortOrderControl.tsx:15
30
-	__( 'Ascending', 'event_espresso' ),
30
+	__('Ascending', 'event_espresso'),
31 31
 
32 32
 	// Reference: domains/blocks/src/components/SortOrderControl.tsx:19
33
-	__( 'Descending', 'event_espresso' ),
33
+	__('Descending', 'event_espresso'),
34 34
 
35 35
 	// Reference: domains/blocks/src/components/SortOrderControl.tsx:25
36
-	__( 'Sort order:', 'event_espresso' ),
36
+	__('Sort order:', 'event_espresso'),
37 37
 
38 38
 	// Reference: domains/blocks/src/event-attendees/AttendeesDisplay.tsx:40
39
-	__( 'There was some error fetching attendees list', 'event_espresso' ),
39
+	__('There was some error fetching attendees list', 'event_espresso'),
40 40
 
41 41
 	// Reference: domains/blocks/src/event-attendees/AttendeesDisplay.tsx:46
42
-	__( 'To get started, select what event you want to show attendees from in the block settings.', 'event_espresso' ),
42
+	__('To get started, select what event you want to show attendees from in the block settings.', 'event_espresso'),
43 43
 
44 44
 	// Reference: domains/blocks/src/event-attendees/AttendeesDisplay.tsx:52
45
-	__( 'There are no attendees for selected options.', 'event_espresso' ),
45
+	__('There are no attendees for selected options.', 'event_espresso'),
46 46
 
47 47
 	// Reference: domains/blocks/src/event-attendees/controls/ArchiveSettings.tsx:11
48
-	__( 'Display on Archives', 'event_espresso' ),
48
+	__('Display on Archives', 'event_espresso'),
49 49
 
50 50
 	// Reference: domains/blocks/src/event-attendees/controls/ArchiveSettings.tsx:16
51
-	__( 'Attendees are shown whenever this post is listed in an archive view.', 'event_espresso' ),
51
+	__('Attendees are shown whenever this post is listed in an archive view.', 'event_espresso'),
52 52
 
53 53
 	// Reference: domains/blocks/src/event-attendees/controls/ArchiveSettings.tsx:17
54
-	__( 'Attendees are hidden whenever this post is listed in an archive view.', 'event_espresso' ),
54
+	__('Attendees are hidden whenever this post is listed in an archive view.', 'event_espresso'),
55 55
 
56 56
 	// Reference: domains/blocks/src/event-attendees/controls/AttendeeLimit.tsx:28
57
-	__( 'Number of Attendees to Display:', 'event_espresso' ),
57
+	__('Number of Attendees to Display:', 'event_espresso'),
58 58
 
59 59
 	// Reference: domains/blocks/src/event-attendees/controls/AttendeeLimit.tsx:33
60 60
 	/* translators: %d attendees count */
61
-	_n_noop( 'Used to adjust the number of attendees displayed (There is %d total attendee for the current filter settings).', 'Used to adjust the number of attendees displayed (There are %d total attendees for the current filter settings).', 'event_espresso' ),
61
+	_n_noop('Used to adjust the number of attendees displayed (There is %d total attendee for the current filter settings).', 'Used to adjust the number of attendees displayed (There are %d total attendees for the current filter settings).', 'event_espresso'),
62 62
 
63 63
 	// Reference: domains/blocks/src/event-attendees/controls/GravatarSettings.tsx:26
64
-	__( 'Display Gravatar', 'event_espresso' ),
64
+	__('Display Gravatar', 'event_espresso'),
65 65
 
66 66
 	// Reference: domains/blocks/src/event-attendees/controls/GravatarSettings.tsx:31
67
-	__( 'Gravatar images are shown for each attendee.', 'event_espresso' ),
67
+	__('Gravatar images are shown for each attendee.', 'event_espresso'),
68 68
 
69 69
 	// Reference: domains/blocks/src/event-attendees/controls/GravatarSettings.tsx:32
70
-	__( 'No gravatar images are shown for each attendee.', 'event_espresso' ),
70
+	__('No gravatar images are shown for each attendee.', 'event_espresso'),
71 71
 
72 72
 	// Reference: domains/blocks/src/event-attendees/controls/GravatarSettings.tsx:37
73
-	__( 'Size of Gravatar', 'event_espresso' ),
73
+	__('Size of Gravatar', 'event_espresso'),
74 74
 
75 75
 	// Reference: domains/blocks/src/event-attendees/controls/SelectDatetime.tsx:21
76
-	__( 'Select Datetime', 'event_espresso' ),
76
+	__('Select Datetime', 'event_espresso'),
77 77
 
78 78
 	// Reference: domains/blocks/src/event-attendees/controls/SelectEvent.tsx:21
79
-	__( 'Select Event', 'event_espresso' ),
79
+	__('Select Event', 'event_espresso'),
80 80
 
81 81
 	// Reference: domains/blocks/src/event-attendees/controls/SelectOrderBy.tsx:10
82
-	__( 'Attendee id', 'event_espresso' ),
82
+	__('Attendee id', 'event_espresso'),
83 83
 
84 84
 	// Reference: domains/blocks/src/event-attendees/controls/SelectOrderBy.tsx:14
85
-	__( 'Last name only', 'event_espresso' ),
85
+	__('Last name only', 'event_espresso'),
86 86
 
87 87
 	// Reference: domains/blocks/src/event-attendees/controls/SelectOrderBy.tsx:18
88
-	__( 'First name only', 'event_espresso' ),
88
+	__('First name only', 'event_espresso'),
89 89
 
90 90
 	// Reference: domains/blocks/src/event-attendees/controls/SelectOrderBy.tsx:22
91
-	__( 'First, then Last name', 'event_espresso' ),
91
+	__('First, then Last name', 'event_espresso'),
92 92
 
93 93
 	// Reference: domains/blocks/src/event-attendees/controls/SelectOrderBy.tsx:26
94
-	__( 'Last, then First name', 'event_espresso' ),
94
+	__('Last, then First name', 'event_espresso'),
95 95
 
96 96
 	// Reference: domains/blocks/src/event-attendees/controls/SelectOrderBy.tsx:40
97
-	__( 'Order Attendees by:', 'event_espresso' ),
97
+	__('Order Attendees by:', 'event_espresso'),
98 98
 
99 99
 	// Reference: domains/blocks/src/event-attendees/controls/SelectTicket.tsx:21
100
-	__( 'Select Ticket', 'event_espresso' ),
100
+	__('Select Ticket', 'event_espresso'),
101 101
 
102 102
 	// Reference: domains/blocks/src/event-attendees/controls/index.tsx:22
103
-	__( 'Filter By Settings', 'event_espresso' ),
103
+	__('Filter By Settings', 'event_espresso'),
104 104
 
105 105
 	// Reference: domains/blocks/src/event-attendees/controls/index.tsx:37
106
-	__( 'Gravatar Setttings', 'event_espresso' ),
106
+	__('Gravatar Setttings', 'event_espresso'),
107 107
 
108 108
 	// Reference: domains/blocks/src/event-attendees/controls/index.tsx:40
109
-	__( 'Archive Settings', 'event_espresso' ),
109
+	__('Archive Settings', 'event_espresso'),
110 110
 
111 111
 	// Reference: domains/blocks/src/event-attendees/index.tsx:10
112
-	__( 'Event Attendees', 'event_espresso' ),
112
+	__('Event Attendees', 'event_espresso'),
113 113
 
114 114
 	// Reference: domains/blocks/src/event-attendees/index.tsx:11
115
-	__( 'Displays a list of people that have registered for the specified event', 'event_espresso' ),
115
+	__('Displays a list of people that have registered for the specified event', 'event_espresso'),
116 116
 
117 117
 	// Reference: domains/blocks/src/event-attendees/index.tsx:14
118
-	__( 'event', 'event_espresso' ),
118
+	__('event', 'event_espresso'),
119 119
 
120 120
 	// Reference: domains/blocks/src/event-attendees/index.tsx:14
121
-	__( 'attendees', 'event_espresso' ),
121
+	__('attendees', 'event_espresso'),
122 122
 
123 123
 	// Reference: domains/blocks/src/event-attendees/index.tsx:14
124
-	__( 'list', 'event_espresso' ),
124
+	__('list', 'event_espresso'),
125 125
 
126 126
 	// Reference: domains/blocks/src/services/utils.ts:11
127
-	__( 'Loading…', 'event_espresso' ),
127
+	__('Loading…', 'event_espresso'),
128 128
 
129 129
 	// Reference: domains/blocks/src/services/utils.ts:19
130 130
 	// Reference: domains/eventEditor/src/ui/ticketAssignmentsManager/components/ErrorMessage.tsx:32
131
-	__( 'Error', 'event_espresso' ),
131
+	__('Error', 'event_espresso'),
132 132
 
133 133
 	// Reference: domains/blocks/src/services/utils.ts:26
134
-	__( 'Select…', 'event_espresso' ),
134
+	__('Select…', 'event_espresso'),
135 135
 
136 136
 	// Reference: domains/eventEditor/src/ui/EventRegistrationOptions/ActiveStatus.tsx:35
137
-	__( 'Active Status', 'event_espresso' ),
137
+	__('Active Status', 'event_espresso'),
138 138
 
139 139
 	// Reference: domains/eventEditor/src/ui/EventRegistrationOptions/AltRegPage.tsx:37
140
-	__( 'Alternative Registration Page', 'event_espresso' ),
140
+	__('Alternative Registration Page', 'event_espresso'),
141 141
 
142 142
 	// Reference: domains/eventEditor/src/ui/EventRegistrationOptions/DefaultRegistrationStatus.tsx:18
143
-	__( 'Default Registration Status', 'event_espresso' ),
143
+	__('Default Registration Status', 'event_espresso'),
144 144
 
145 145
 	// Reference: domains/eventEditor/src/ui/EventRegistrationOptions/Donations.tsx:21
146
-	__( 'Disable Donations', 'event_espresso' ),
146
+	__('Disable Donations', 'event_espresso'),
147 147
 
148 148
 	// Reference: domains/eventEditor/src/ui/EventRegistrationOptions/Donations.tsx:21
149
-	__( 'Enable Donations', 'event_espresso' ),
149
+	__('Enable Donations', 'event_espresso'),
150 150
 
151 151
 	// Reference: domains/eventEditor/src/ui/EventRegistrationOptions/EventManager.tsx:42
152
-	__( 'Event Manager', 'event_espresso' ),
152
+	__('Event Manager', 'event_espresso'),
153 153
 
154 154
 	// Reference: domains/eventEditor/src/ui/EventRegistrationOptions/EventPhoneNumber.tsx:28
155
-	__( 'Event Phone Number', 'event_espresso' ),
155
+	__('Event Phone Number', 'event_espresso'),
156 156
 
157 157
 	// Reference: domains/eventEditor/src/ui/EventRegistrationOptions/MaxRegistrations.tsx:30
158
-	__( 'Maximum Number of Registrations Allowed per Transaction', 'event_espresso' ),
158
+	__('Maximum Number of Registrations Allowed per Transaction', 'event_espresso'),
159 159
 
160 160
 	// Reference: domains/eventEditor/src/ui/EventRegistrationOptions/TicketSelector.tsx:22
161
-	__( 'hide ticket selector', 'event_espresso' ),
161
+	__('hide ticket selector', 'event_espresso'),
162 162
 
163 163
 	// Reference: domains/eventEditor/src/ui/EventRegistrationOptions/TicketSelector.tsx:22
164
-	__( 'show ticket selector', 'event_espresso' ),
164
+	__('show ticket selector', 'event_espresso'),
165 165
 
166 166
 	// Reference: domains/eventEditor/src/ui/EventRegistrationOptions/TicketSelector.tsx:28
167
-	__( 'Display Ticket Selector', 'event_espresso' ),
167
+	__('Display Ticket Selector', 'event_espresso'),
168 168
 
169 169
 	// Reference: domains/eventEditor/src/ui/EventRegistrationOptions/index.tsx:22
170
-	__( 'Registration Options', 'event_espresso' ),
170
+	__('Registration Options', 'event_espresso'),
171 171
 
172 172
 	// Reference: domains/eventEditor/src/ui/datetimes/DateRegistrationsLink.tsx:17
173
-	__( 'view ALL registrations for this date.', 'event_espresso' ),
173
+	__('view ALL registrations for this date.', 'event_espresso'),
174 174
 
175 175
 	// Reference: domains/eventEditor/src/ui/datetimes/dateForm/formValidation.ts:15
176 176
 	// Reference: domains/eventEditor/src/ui/tickets/ticketForm/formValidation.ts:15
177
-	__( 'Name is required', 'event_espresso' ),
177
+	__('Name is required', 'event_espresso'),
178 178
 
179 179
 	// Reference: domains/eventEditor/src/ui/datetimes/dateForm/formValidation.ts:16
180 180
 	// Reference: domains/eventEditor/src/ui/datetimes/datesList/bulkEdit/details/formValidation.ts:12
181 181
 	// Reference: domains/eventEditor/src/ui/tickets/ticketForm/formValidation.ts:16
182 182
 	// Reference: domains/eventEditor/src/ui/tickets/ticketsList/bulkEdit/details/formValidation.ts:12
183
-	__( 'Name must be at least three characters', 'event_espresso' ),
183
+	__('Name must be at least three characters', 'event_espresso'),
184 184
 
185 185
 	// Reference: domains/eventEditor/src/ui/datetimes/dateForm/multiStep/Container.tsx:22
186 186
 	/* translators: %s datetime id */
187
-	__( 'Edit datetime %s', 'event_espresso' ),
187
+	__('Edit datetime %s', 'event_espresso'),
188 188
 
189 189
 	// Reference: domains/eventEditor/src/ui/datetimes/dateForm/multiStep/Container.tsx:25
190
-	__( 'New Datetime', 'event_espresso' ),
190
+	__('New Datetime', 'event_espresso'),
191 191
 
192 192
 	// Reference: domains/eventEditor/src/ui/datetimes/dateForm/multiStep/ContentBody.tsx:40
193
-	__( 'Save and assign tickets', 'event_espresso' ),
193
+	__('Save and assign tickets', 'event_espresso'),
194 194
 
195 195
 	// Reference: domains/eventEditor/src/ui/datetimes/dateForm/multiStep/DateFormSteps.tsx:11
196
-	__( 'primary information about the date', 'event_espresso' ),
196
+	__('primary information about the date', 'event_espresso'),
197 197
 
198 198
 	// Reference: domains/eventEditor/src/ui/datetimes/dateForm/multiStep/DateFormSteps.tsx:11
199
-	__( 'Date Details', 'event_espresso' ),
199
+	__('Date Details', 'event_espresso'),
200 200
 
201 201
 	// Reference: domains/eventEditor/src/ui/datetimes/dateForm/multiStep/DateFormSteps.tsx:12
202 202
 	// Reference: domains/eventEditor/src/ui/tickets/ticketForm/multiStep/TicketFormSteps.tsx:17
203
-	__( 'relations between tickets and dates', 'event_espresso' ),
203
+	__('relations between tickets and dates', 'event_espresso'),
204 204
 
205 205
 	// Reference: domains/eventEditor/src/ui/datetimes/dateForm/multiStep/DateFormSteps.tsx:12
206
-	__( 'Assign Tickets', 'event_espresso' ),
206
+	__('Assign Tickets', 'event_espresso'),
207 207
 
208 208
 	// Reference: domains/eventEditor/src/ui/datetimes/dateForm/useDateFormConfig.ts:102
209 209
 	// Reference: domains/eventEditor/src/ui/datetimes/datesList/tableView/useHeaderRowGenerator.tsx:63
210 210
 	// Reference: domains/eventEditor/src/ui/tickets/ticketForm/useTicketFormConfig.tsx:115
211
-	__( 'End Date', 'event_espresso' ),
211
+	__('End Date', 'event_espresso'),
212 212
 
213 213
 	// Reference: domains/eventEditor/src/ui/datetimes/dateForm/useDateFormConfig.ts:111
214 214
 	// Reference: domains/eventEditor/src/ui/datetimes/datesList/bulkEdit/details/useBulkEditFormConfig.ts:108
215 215
 	// Reference: domains/eventEditor/src/ui/tickets/ticketForm/useTicketFormConfig.tsx:124
216 216
 	// Reference: domains/eventEditor/src/ui/tickets/ticketsList/bulkEdit/details/useBulkEditFormConfig.ts:108
217
-	__( 'Details', 'event_espresso' ),
217
+	__('Details', 'event_espresso'),
218 218
 
219 219
 	// Reference: domains/eventEditor/src/ui/datetimes/dateForm/useDateFormConfig.ts:115
220 220
 	// Reference: domains/eventEditor/src/ui/datetimes/datesList/bulkEdit/details/useBulkEditFormConfig.ts:112
221 221
 	// Reference: domains/eventEditor/src/ui/datetimes/datesList/tableView/useHeaderRowGenerator.tsx:75
222
-	__( 'Capacity', 'event_espresso' ),
222
+	__('Capacity', 'event_espresso'),
223 223
 
224 224
 	// Reference: domains/eventEditor/src/ui/datetimes/dateForm/useDateFormConfig.ts:120
225
-	__( 'The maximum number of registrants that can attend the event at this particular date.', 'event_espresso' ),
225
+	__('The maximum number of registrants that can attend the event at this particular date.', 'event_espresso'),
226 226
 
227 227
 	// Reference: domains/eventEditor/src/ui/datetimes/dateForm/useDateFormConfig.ts:124
228
-	__( 'Set to 0 to close registration or leave blank for no limit.', 'event_espresso' ),
228
+	__('Set to 0 to close registration or leave blank for no limit.', 'event_espresso'),
229 229
 
230 230
 	// Reference: domains/eventEditor/src/ui/datetimes/dateForm/useDateFormConfig.ts:129
231 231
 	// Reference: domains/eventEditor/src/ui/tickets/ticketForm/useTicketFormConfig.tsx:203
232
-	__( 'Trash', 'event_espresso' ),
232
+	__('Trash', 'event_espresso'),
233 233
 
234 234
 	// Reference: domains/eventEditor/src/ui/datetimes/dateForm/useDateFormConfig.ts:73
235 235
 	// Reference: domains/eventEditor/src/ui/datetimes/datesList/bulkEdit/details/useBulkEditFormConfig.ts:45
236 236
 	// Reference: domains/eventEditor/src/ui/tickets/ticketForm/useTicketFormConfig.tsx:86
237 237
 	// Reference: domains/eventEditor/src/ui/tickets/ticketsList/bulkEdit/details/useBulkEditFormConfig.ts:45
238
-	__( 'Basics', 'event_espresso' ),
238
+	__('Basics', 'event_espresso'),
239 239
 
240 240
 	// Reference: domains/eventEditor/src/ui/datetimes/dateForm/useDateFormConfig.ts:77
241 241
 	// Reference: domains/eventEditor/src/ui/datetimes/datesList/bulkEdit/details/useBulkEditFormConfig.ts:49
@@ -243,217 +243,217 @@  discard block
 block discarded – undo
243 243
 	// Reference: domains/eventEditor/src/ui/tickets/ticketForm/useTicketFormConfig.tsx:90
244 244
 	// Reference: domains/eventEditor/src/ui/tickets/ticketsList/bulkEdit/details/useBulkEditFormConfig.ts:49
245 245
 	// Reference: domains/eventEditor/src/ui/tickets/ticketsList/tableView/useHeaderRowGenerator.tsx:42
246
-	__( 'Name', 'event_espresso' ),
246
+	__('Name', 'event_espresso'),
247 247
 
248 248
 	// Reference: domains/eventEditor/src/ui/datetimes/dateForm/useDateFormConfig.ts:84
249 249
 	// Reference: domains/eventEditor/src/ui/datetimes/datesList/bulkEdit/details/useBulkEditFormConfig.ts:55
250 250
 	// Reference: domains/eventEditor/src/ui/tickets/ticketForm/useTicketFormConfig.tsx:97
251 251
 	// Reference: domains/eventEditor/src/ui/tickets/ticketsList/bulkEdit/details/useBulkEditFormConfig.ts:55
252 252
 	// Reference: packages/tpc/src/components/table/useHeaderRowGenerator.ts:41
253
-	__( 'Description', 'event_espresso' ),
253
+	__('Description', 'event_espresso'),
254 254
 
255 255
 	// Reference: domains/eventEditor/src/ui/datetimes/dateForm/useDateFormConfig.ts:92
256 256
 	// Reference: domains/eventEditor/src/ui/datetimes/datesList/bulkEdit/details/useBulkEditFormConfig.ts:63
257 257
 	// Reference: domains/eventEditor/src/ui/tickets/ticketsList/bulkEdit/details/useBulkEditFormConfig.ts:63
258
-	__( 'Dates', 'event_espresso' ),
258
+	__('Dates', 'event_espresso'),
259 259
 
260 260
 	// Reference: domains/eventEditor/src/ui/datetimes/dateForm/useDateFormConfig.ts:96
261 261
 	// Reference: domains/eventEditor/src/ui/datetimes/datesList/tableView/useHeaderRowGenerator.tsx:52
262 262
 	// Reference: domains/eventEditor/src/ui/tickets/ticketForm/useTicketFormConfig.tsx:109
263
-	__( 'Start Date', 'event_espresso' ),
263
+	__('Start Date', 'event_espresso'),
264 264
 
265 265
 	// Reference: domains/eventEditor/src/ui/datetimes/datesList/DatesList.tsx:34
266 266
 	// Reference: domains/eventEditor/src/ui/datetimes/datesList/tableView/TableView.tsx:42
267
-	__( 'Event Dates', 'event_espresso' ),
267
+	__('Event Dates', 'event_espresso'),
268 268
 
269 269
 	// Reference: domains/eventEditor/src/ui/datetimes/datesList/DatesList.tsx:37
270
-	__( 'loading event dates…', 'event_espresso' ),
270
+	__('loading event dates…', 'event_espresso'),
271 271
 
272 272
 	// Reference: domains/eventEditor/src/ui/datetimes/datesList/DatesListButtons.tsx:22
273
-	__( 'Ticket Assignments', 'event_espresso' ),
273
+	__('Ticket Assignments', 'event_espresso'),
274 274
 
275 275
 	// Reference: domains/eventEditor/src/ui/datetimes/datesList/actionsMenu/AssignTicketsButton.tsx:27
276
-	__( 'Number of related tickets', 'event_espresso' ),
276
+	__('Number of related tickets', 'event_espresso'),
277 277
 
278 278
 	// Reference: domains/eventEditor/src/ui/datetimes/datesList/actionsMenu/AssignTicketsButton.tsx:28
279
-	__( 'There are no tickets assigned to this datetime. Please click the ticket icon to update the assignments.', 'event_espresso' ),
279
+	__('There are no tickets assigned to this datetime. Please click the ticket icon to update the assignments.', 'event_espresso'),
280 280
 
281 281
 	// Reference: domains/eventEditor/src/ui/datetimes/datesList/actionsMenu/AssignTicketsButton.tsx:42
282
-	__( 'assign tickets', 'event_espresso' ),
282
+	__('assign tickets', 'event_espresso'),
283 283
 
284 284
 	// Reference: domains/eventEditor/src/ui/datetimes/datesList/actionsMenu/dropdown/DateMainMenu.tsx:17
285
-	__( 'Permanently delete Datetime?', 'event_espresso' ),
285
+	__('Permanently delete Datetime?', 'event_espresso'),
286 286
 
287 287
 	// Reference: domains/eventEditor/src/ui/datetimes/datesList/actionsMenu/dropdown/DateMainMenu.tsx:17
288
-	__( 'Move Datetime to Trash?', 'event_espresso' ),
288
+	__('Move Datetime to Trash?', 'event_espresso'),
289 289
 
290 290
 	// Reference: domains/eventEditor/src/ui/datetimes/datesList/actionsMenu/dropdown/DateMainMenu.tsx:19
291
-	__( 'Are you sure you want to permanently delete this datetime? This action is permanent and can not be undone.', 'event_espresso' ),
291
+	__('Are you sure you want to permanently delete this datetime? This action is permanent and can not be undone.', 'event_espresso'),
292 292
 
293 293
 	// Reference: domains/eventEditor/src/ui/datetimes/datesList/actionsMenu/dropdown/DateMainMenu.tsx:22
294
-	__( 'Are you sure you want to move this datetime to the trash? You can "untrash" this datetime later if you need to.', 'event_espresso' ),
294
+	__('Are you sure you want to move this datetime to the trash? You can "untrash" this datetime later if you need to.', 'event_espresso'),
295 295
 
296 296
 	// Reference: domains/eventEditor/src/ui/datetimes/datesList/actionsMenu/dropdown/DateMainMenu.tsx:32
297
-	__( 'event date main menu', 'event_espresso' ),
297
+	__('event date main menu', 'event_espresso'),
298 298
 
299 299
 	// Reference: domains/eventEditor/src/ui/datetimes/datesList/actionsMenu/dropdown/DateMainMenu.tsx:36
300 300
 	// Reference: domains/eventEditor/src/ui/tickets/ticketsList/actionsMenu/dropdown/TicketMainMenu.tsx:35
301
-	__( 'delete permanently', 'event_espresso' ),
301
+	__('delete permanently', 'event_espresso'),
302 302
 
303 303
 	// Reference: domains/eventEditor/src/ui/datetimes/datesList/actionsMenu/dropdown/DateMainMenu.tsx:36
304
-	__( 'trash datetime', 'event_espresso' ),
304
+	__('trash datetime', 'event_espresso'),
305 305
 
306 306
 	// Reference: domains/eventEditor/src/ui/datetimes/datesList/actionsMenu/dropdown/DateMainMenu.tsx:45
307
-	__( 'edit datetime', 'event_espresso' ),
307
+	__('edit datetime', 'event_espresso'),
308 308
 
309 309
 	// Reference: domains/eventEditor/src/ui/datetimes/datesList/actionsMenu/dropdown/DateMainMenu.tsx:46
310
-	__( 'copy datetime', 'event_espresso' ),
310
+	__('copy datetime', 'event_espresso'),
311 311
 
312 312
 	// Reference: domains/eventEditor/src/ui/datetimes/datesList/bulkEdit/actions/Actions.tsx:30
313
-	__( 'edit datetime details', 'event_espresso' ),
313
+	__('edit datetime details', 'event_espresso'),
314 314
 
315 315
 	// Reference: domains/eventEditor/src/ui/datetimes/datesList/bulkEdit/actions/Actions.tsx:34
316
-	__( 'delete datetimes', 'event_espresso' ),
316
+	__('delete datetimes', 'event_espresso'),
317 317
 
318 318
 	// Reference: domains/eventEditor/src/ui/datetimes/datesList/bulkEdit/actions/Actions.tsx:34
319
-	__( 'trash datetimes', 'event_espresso' ),
319
+	__('trash datetimes', 'event_espresso'),
320 320
 
321 321
 	// Reference: domains/eventEditor/src/ui/datetimes/datesList/bulkEdit/delete/Delete.tsx:13
322
-	__( 'Are you sure you want to permanently delete these datetimes? This action can NOT be undone!', 'event_espresso' ),
322
+	__('Are you sure you want to permanently delete these datetimes? This action can NOT be undone!', 'event_espresso'),
323 323
 
324 324
 	// Reference: domains/eventEditor/src/ui/datetimes/datesList/bulkEdit/delete/Delete.tsx:14
325
-	__( 'Are you sure you want to trash these datetimes?', 'event_espresso' ),
325
+	__('Are you sure you want to trash these datetimes?', 'event_espresso'),
326 326
 
327 327
 	// Reference: domains/eventEditor/src/ui/datetimes/datesList/bulkEdit/delete/Delete.tsx:15
328
-	__( 'Delete datetimes permanently', 'event_espresso' ),
328
+	__('Delete datetimes permanently', 'event_espresso'),
329 329
 
330 330
 	// Reference: domains/eventEditor/src/ui/datetimes/datesList/bulkEdit/delete/Delete.tsx:15
331
-	__( 'Trash datetimes', 'event_espresso' ),
331
+	__('Trash datetimes', 'event_espresso'),
332 332
 
333 333
 	// Reference: domains/eventEditor/src/ui/datetimes/datesList/bulkEdit/details/EditDetails.tsx:22
334
-	__( 'Bulk edit date details', 'event_espresso' ),
334
+	__('Bulk edit date details', 'event_espresso'),
335 335
 
336 336
 	// Reference: domains/eventEditor/src/ui/datetimes/datesList/bulkEdit/details/EditDetails.tsx:23
337
-	__( 'any changes will be applied to ALL of the selected dates.', 'event_espresso' ),
337
+	__('any changes will be applied to ALL of the selected dates.', 'event_espresso'),
338 338
 
339 339
 	// Reference: domains/eventEditor/src/ui/datetimes/datesList/bulkEdit/details/useBulkEditFormConfig.ts:67
340 340
 	// Reference: domains/eventEditor/src/ui/tickets/ticketsList/bulkEdit/details/useBulkEditFormConfig.ts:67
341
-	__( 'Shift dates', 'event_espresso' ),
341
+	__('Shift dates', 'event_espresso'),
342 342
 
343 343
 	// Reference: domains/eventEditor/src/ui/datetimes/datesList/bulkEdit/details/useBulkEditFormConfig.ts:92
344 344
 	// Reference: domains/eventEditor/src/ui/tickets/ticketsList/bulkEdit/details/useBulkEditFormConfig.ts:92
345
-	__( 'earlier', 'event_espresso' ),
345
+	__('earlier', 'event_espresso'),
346 346
 
347 347
 	// Reference: domains/eventEditor/src/ui/datetimes/datesList/bulkEdit/details/useBulkEditFormConfig.ts:96
348 348
 	// Reference: domains/eventEditor/src/ui/tickets/ticketsList/bulkEdit/details/useBulkEditFormConfig.ts:96
349
-	__( 'later', 'event_espresso' ),
349
+	__('later', 'event_espresso'),
350 350
 
351 351
 	// Reference: domains/eventEditor/src/ui/datetimes/datesList/cardView/DateCapacity.tsx:35
352
-	__( 'edit capacity (registration limit)…', 'event_espresso' ),
352
+	__('edit capacity (registration limit)…', 'event_espresso'),
353 353
 
354 354
 	// Reference: domains/eventEditor/src/ui/datetimes/datesList/cardView/DateCardSidebar.tsx:37
355
-	__( 'Edit Event Date', 'event_espresso' ),
355
+	__('Edit Event Date', 'event_espresso'),
356 356
 
357 357
 	// Reference: domains/eventEditor/src/ui/datetimes/datesList/cardView/DateCardSidebar.tsx:40
358
-	__( 'edit start and end dates', 'event_espresso' ),
358
+	__('edit start and end dates', 'event_espresso'),
359 359
 
360 360
 	// Reference: domains/eventEditor/src/ui/datetimes/datesList/cardView/DateDetailsPanel.tsx:14
361 361
 	// Reference: domains/eventEditor/src/ui/tickets/ticketsList/cardView/TicketDetailsPanel.tsx:14
362
-	__( 'sold', 'event_espresso' ),
362
+	__('sold', 'event_espresso'),
363 363
 
364 364
 	// Reference: domains/eventEditor/src/ui/datetimes/datesList/cardView/DateDetailsPanel.tsx:27
365
-	__( 'capacity', 'event_espresso' ),
365
+	__('capacity', 'event_espresso'),
366 366
 
367 367
 	// Reference: domains/eventEditor/src/ui/datetimes/datesList/cardView/DateDetailsPanel.tsx:33
368 368
 	// Reference: domains/eventEditor/src/ui/tickets/ticketsList/cardView/TicketDetailsPanel.tsx:32
369
-	__( 'reg list', 'event_espresso' ),
369
+	__('reg list', 'event_espresso'),
370 370
 
371 371
 	// Reference: domains/eventEditor/src/ui/datetimes/datesList/cardView/Details.tsx:44
372 372
 	// Reference: domains/eventEditor/src/ui/tickets/ticketsList/cardView/Details.tsx:40
373
-	__( 'Edit description', 'event_espresso' ),
373
+	__('Edit description', 'event_espresso'),
374 374
 
375 375
 	// Reference: domains/eventEditor/src/ui/datetimes/datesList/cardView/Details.tsx:45
376 376
 	// Reference: domains/eventEditor/src/ui/tickets/ticketsList/cardView/Details.tsx:41
377
-	__( 'edit description…', 'event_espresso' ),
377
+	__('edit description…', 'event_espresso'),
378 378
 
379 379
 	// Reference: domains/eventEditor/src/ui/datetimes/datesList/config.ts:13
380
-	__( 'Active', 'event_espresso' ),
380
+	__('Active', 'event_espresso'),
381 381
 
382 382
 	// Reference: domains/eventEditor/src/ui/datetimes/datesList/config.ts:14
383 383
 	// Reference: domains/eventEditor/src/ui/tickets/ticketsList/config.ts:13
384
-	__( 'Trashed', 'event_espresso' ),
384
+	__('Trashed', 'event_espresso'),
385 385
 
386 386
 	// Reference: domains/eventEditor/src/ui/datetimes/datesList/config.ts:15
387 387
 	// Reference: domains/eventEditor/src/ui/tickets/ticketsList/config.ts:14
388
-	__( 'Expired', 'event_espresso' ),
388
+	__('Expired', 'event_espresso'),
389 389
 
390 390
 	// Reference: domains/eventEditor/src/ui/datetimes/datesList/config.ts:16
391 391
 	// Reference: domains/eventEditor/src/ui/tickets/ticketsList/config.ts:16
392
-	__( 'Sold Out', 'event_espresso' ),
392
+	__('Sold Out', 'event_espresso'),
393 393
 
394 394
 	// Reference: domains/eventEditor/src/ui/datetimes/datesList/config.ts:17
395
-	__( 'Upcoming', 'event_espresso' ),
395
+	__('Upcoming', 'event_espresso'),
396 396
 
397 397
 	// Reference: domains/eventEditor/src/ui/datetimes/datesList/editable/EditableName.tsx:17
398 398
 	// Reference: domains/eventEditor/src/ui/tickets/ticketsList/editable/EditableName.tsx:27
399
-	__( 'edit title…', 'event_espresso' ),
399
+	__('edit title…', 'event_espresso'),
400 400
 
401 401
 	// Reference: domains/eventEditor/src/ui/datetimes/datesList/filterBar/ActiveDatesFilters.tsx:25
402 402
 	// Reference: domains/eventEditor/src/ui/tickets/ticketsList/filterBar/ActiveTicketsFilters.tsx:25
403
-	__( 'ON', 'event_espresso' ),
403
+	__('ON', 'event_espresso'),
404 404
 
405 405
 	// Reference: domains/eventEditor/src/ui/datetimes/datesList/filterBar/controls/options.ts:10
406
-	__( 'end dates only', 'event_espresso' ),
406
+	__('end dates only', 'event_espresso'),
407 407
 
408 408
 	// Reference: domains/eventEditor/src/ui/datetimes/datesList/filterBar/controls/options.ts:11
409
-	__( 'start and end dates', 'event_espresso' ),
409
+	__('start and end dates', 'event_espresso'),
410 410
 
411 411
 	// Reference: domains/eventEditor/src/ui/datetimes/datesList/filterBar/controls/options.ts:16
412
-	__( 'dates above 90% capacity', 'event_espresso' ),
412
+	__('dates above 90% capacity', 'event_espresso'),
413 413
 
414 414
 	// Reference: domains/eventEditor/src/ui/datetimes/datesList/filterBar/controls/options.ts:17
415
-	__( 'dates above 75% capacity', 'event_espresso' ),
415
+	__('dates above 75% capacity', 'event_espresso'),
416 416
 
417 417
 	// Reference: domains/eventEditor/src/ui/datetimes/datesList/filterBar/controls/options.ts:18
418
-	__( 'dates above 50% capacity', 'event_espresso' ),
418
+	__('dates above 50% capacity', 'event_espresso'),
419 419
 
420 420
 	// Reference: domains/eventEditor/src/ui/datetimes/datesList/filterBar/controls/options.ts:19
421
-	__( 'dates below 50% capacity', 'event_espresso' ),
421
+	__('dates below 50% capacity', 'event_espresso'),
422 422
 
423 423
 	// Reference: domains/eventEditor/src/ui/datetimes/datesList/filterBar/controls/options.ts:23
424
-	__( 'all dates', 'event_espresso' ),
424
+	__('all dates', 'event_espresso'),
425 425
 
426 426
 	// Reference: domains/eventEditor/src/ui/datetimes/datesList/filterBar/controls/options.ts:24
427
-	__( 'all active and upcoming', 'event_espresso' ),
427
+	__('all active and upcoming', 'event_espresso'),
428 428
 
429 429
 	// Reference: domains/eventEditor/src/ui/datetimes/datesList/filterBar/controls/options.ts:25
430
-	__( 'active dates only', 'event_espresso' ),
430
+	__('active dates only', 'event_espresso'),
431 431
 
432 432
 	// Reference: domains/eventEditor/src/ui/datetimes/datesList/filterBar/controls/options.ts:26
433
-	__( 'upcoming dates only', 'event_espresso' ),
433
+	__('upcoming dates only', 'event_espresso'),
434 434
 
435 435
 	// Reference: domains/eventEditor/src/ui/datetimes/datesList/filterBar/controls/options.ts:27
436
-	__( 'next active or upcoming only', 'event_espresso' ),
436
+	__('next active or upcoming only', 'event_espresso'),
437 437
 
438 438
 	// Reference: domains/eventEditor/src/ui/datetimes/datesList/filterBar/controls/options.ts:28
439
-	__( 'sold out dates only', 'event_espresso' ),
439
+	__('sold out dates only', 'event_espresso'),
440 440
 
441 441
 	// Reference: domains/eventEditor/src/ui/datetimes/datesList/filterBar/controls/options.ts:29
442
-	__( 'recently expired dates', 'event_espresso' ),
442
+	__('recently expired dates', 'event_espresso'),
443 443
 
444 444
 	// Reference: domains/eventEditor/src/ui/datetimes/datesList/filterBar/controls/options.ts:30
445
-	__( 'all expired dates', 'event_espresso' ),
445
+	__('all expired dates', 'event_espresso'),
446 446
 
447 447
 	// Reference: domains/eventEditor/src/ui/datetimes/datesList/filterBar/controls/options.ts:31
448
-	__( 'trashed dates only', 'event_espresso' ),
448
+	__('trashed dates only', 'event_espresso'),
449 449
 
450 450
 	// Reference: domains/eventEditor/src/ui/datetimes/datesList/filterBar/controls/options.ts:35
451 451
 	// Reference: packages/dates/src/DateRangePicker/DateRangePickerLegend.tsx:10
452 452
 	// Reference: packages/dates/src/DateRangePicker/index.tsx:42
453
-	__( 'start date', 'event_espresso' ),
453
+	__('start date', 'event_espresso'),
454 454
 
455 455
 	// Reference: domains/eventEditor/src/ui/datetimes/datesList/filterBar/controls/options.ts:36
456
-	__( 'name', 'event_espresso' ),
456
+	__('name', 'event_espresso'),
457 457
 
458 458
 	// Reference: domains/eventEditor/src/ui/datetimes/datesList/filterBar/controls/options.ts:37
459 459
 	// Reference: domains/eventEditor/src/ui/datetimes/datesList/tableView/useHeaderRowGenerator.tsx:38
@@ -461,96 +461,96 @@  discard block
 block discarded – undo
461 461
 	// Reference: domains/eventEditor/src/ui/ticketAssignmentsManager/components/table/HeaderCell.tsx:20
462 462
 	// Reference: domains/eventEditor/src/ui/tickets/ticketsList/tableView/useHeaderRowGenerator.tsx:36
463 463
 	// Reference: packages/tpc/src/components/table/useHeaderRowGenerator.ts:23
464
-	__( 'ID', 'event_espresso' ),
464
+	__('ID', 'event_espresso'),
465 465
 
466 466
 	// Reference: domains/eventEditor/src/ui/datetimes/datesList/filterBar/controls/options.ts:38
467 467
 	// Reference: domains/eventEditor/src/ui/tickets/ticketsList/filterBar/controls/options.ts:47
468
-	__( 'custom order', 'event_espresso' ),
468
+	__('custom order', 'event_espresso'),
469 469
 
470 470
 	// Reference: domains/eventEditor/src/ui/datetimes/datesList/filterBar/controls/options.ts:42
471 471
 	// Reference: domains/eventEditor/src/ui/tickets/ticketsList/filterBar/controls/options.ts:52
472
-	__( 'display', 'event_espresso' ),
472
+	__('display', 'event_espresso'),
473 473
 
474 474
 	// Reference: domains/eventEditor/src/ui/datetimes/datesList/filterBar/controls/options.ts:43
475
-	__( 'recurrence', 'event_espresso' ),
475
+	__('recurrence', 'event_espresso'),
476 476
 
477 477
 	// Reference: domains/eventEditor/src/ui/datetimes/datesList/filterBar/controls/options.ts:44
478 478
 	// Reference: domains/eventEditor/src/ui/tickets/ticketsList/filterBar/controls/options.ts:54
479
-	__( 'sales', 'event_espresso' ),
479
+	__('sales', 'event_espresso'),
480 480
 
481 481
 	// Reference: domains/eventEditor/src/ui/datetimes/datesList/filterBar/controls/options.ts:45
482 482
 	// Reference: domains/eventEditor/src/ui/tickets/ticketsList/filterBar/controls/options.ts:56
483
-	__( 'sort by', 'event_espresso' ),
483
+	__('sort by', 'event_espresso'),
484 484
 
485 485
 	// Reference: domains/eventEditor/src/ui/datetimes/datesList/filterBar/controls/options.ts:46
486 486
 	// Reference: domains/eventEditor/src/ui/tickets/ticketsList/filterBar/controls/options.ts:55
487 487
 	// Reference: packages/components/src/EntityList/filterBar/EntityListFilterBar.tsx:73
488
-	__( 'search', 'event_espresso' ),
488
+	__('search', 'event_espresso'),
489 489
 
490 490
 	// Reference: domains/eventEditor/src/ui/datetimes/datesList/filterBar/controls/options.ts:47
491 491
 	// Reference: domains/eventEditor/src/ui/tickets/ticketsList/filterBar/controls/options.ts:57
492
-	__( 'status', 'event_espresso' ),
492
+	__('status', 'event_espresso'),
493 493
 
494 494
 	// Reference: domains/eventEditor/src/ui/datetimes/datesList/filterBar/controls/options.ts:9
495
-	__( 'start dates only', 'event_espresso' ),
495
+	__('start dates only', 'event_espresso'),
496 496
 
497 497
 	// Reference: domains/eventEditor/src/ui/datetimes/datesList/newDateOptions/AddSingleDate.tsx:20
498 498
 	// Reference: domains/eventEditor/src/ui/datetimes/datesList/newDateOptions/NewDateModal.tsx:15
499 499
 	// Reference: domains/eventEditor/src/ui/datetimes/datesList/newDateOptions/OptionsModalButton.tsx:11
500
-	__( 'Add New Date', 'event_espresso' ),
500
+	__('Add New Date', 'event_espresso'),
501 501
 
502 502
 	// Reference: domains/eventEditor/src/ui/datetimes/datesList/newDateOptions/AddSingleDate.tsx:20
503
-	__( 'Add Single Date', 'event_espresso' ),
503
+	__('Add Single Date', 'event_espresso'),
504 504
 
505 505
 	// Reference: domains/eventEditor/src/ui/datetimes/datesList/newDateOptions/AddSingleDate.tsx:34
506
-	__( 'Add a single date that only occurs once', 'event_espresso' ),
506
+	__('Add a single date that only occurs once', 'event_espresso'),
507 507
 
508 508
 	// Reference: domains/eventEditor/src/ui/datetimes/datesList/newDateOptions/AddSingleDate.tsx:36
509
-	__( 'Single Date', 'event_espresso' ),
509
+	__('Single Date', 'event_espresso'),
510 510
 
511 511
 	// Reference: domains/eventEditor/src/ui/datetimes/datesList/tableView/useHeaderRowGenerator.tsx:105
512 512
 	// Reference: domains/eventEditor/src/ui/tickets/ticketsList/tableView/useHeaderRowGenerator.tsx:103
513 513
 	// Reference: packages/tpc/src/components/table/useHeaderRowGenerator.ts:53
514
-	__( 'Actions', 'event_espresso' ),
514
+	__('Actions', 'event_espresso'),
515 515
 
516 516
 	// Reference: domains/eventEditor/src/ui/datetimes/datesList/tableView/useHeaderRowGenerator.tsx:53
517
-	__( 'Start', 'event_espresso' ),
517
+	__('Start', 'event_espresso'),
518 518
 
519 519
 	// Reference: domains/eventEditor/src/ui/datetimes/datesList/tableView/useHeaderRowGenerator.tsx:64
520
-	__( 'End', 'event_espresso' ),
520
+	__('End', 'event_espresso'),
521 521
 
522 522
 	// Reference: domains/eventEditor/src/ui/datetimes/datesList/tableView/useHeaderRowGenerator.tsx:76
523
-	__( 'Cap', 'event_espresso' ),
523
+	__('Cap', 'event_espresso'),
524 524
 
525 525
 	// Reference: domains/eventEditor/src/ui/datetimes/datesList/tableView/useHeaderRowGenerator.tsx:84
526 526
 	// Reference: domains/eventEditor/src/ui/tickets/ticketsList/tableView/useHeaderRowGenerator.tsx:85
527
-	__( 'Sold', 'event_espresso' ),
527
+	__('Sold', 'event_espresso'),
528 528
 
529 529
 	// Reference: domains/eventEditor/src/ui/datetimes/datesList/tableView/useHeaderRowGenerator.tsx:93
530
-	__( 'Reg list', 'event_espresso' ),
530
+	__('Reg list', 'event_espresso'),
531 531
 
532 532
 	// Reference: domains/eventEditor/src/ui/datetimes/datesList/tableView/useHeaderRowGenerator.tsx:94
533 533
 	// Reference: domains/eventEditor/src/ui/tickets/ticketsList/tableView/useHeaderRowGenerator.tsx:95
534
-	__( 'Regs', 'event_espresso' ),
534
+	__('Regs', 'event_espresso'),
535 535
 
536 536
 	// Reference: domains/eventEditor/src/ui/ticketAssignmentsManager/components/ErrorMessage.tsx:18
537
-	__( 'Tickets must always have at least one date assigned to them but one or more of the tickets below does not have any. Please correct the assignments for the highlighted cells.', 'event_espresso' ),
537
+	__('Tickets must always have at least one date assigned to them but one or more of the tickets below does not have any. Please correct the assignments for the highlighted cells.', 'event_espresso'),
538 538
 
539 539
 	// Reference: domains/eventEditor/src/ui/ticketAssignmentsManager/components/ErrorMessage.tsx:22
540
-	__( 'Event Dates must always have at least one Ticket assigned to them but one or more of the Event Dates below does not have any. Please correct the assignments for the highlighted cells.', 'event_espresso' ),
540
+	__('Event Dates must always have at least one Ticket assigned to them but one or more of the Event Dates below does not have any. Please correct the assignments for the highlighted cells.', 'event_espresso'),
541 541
 
542 542
 	// Reference: domains/eventEditor/src/ui/ticketAssignmentsManager/components/ModalContainer.tsx:25
543 543
 	/* translators: %d entity id, %s entity name */
544
-	__( 'Ticket Assignment Manager for Datetime: %1$d - %2$s', 'event_espresso' ),
544
+	__('Ticket Assignment Manager for Datetime: %1$d - %2$s', 'event_espresso'),
545 545
 
546 546
 	// Reference: domains/eventEditor/src/ui/ticketAssignmentsManager/components/ModalContainer.tsx:32
547 547
 	/* translators: %d entity id, %s entity name */
548
-	__( 'Ticket Assignment Manager for Ticket: %1$d - %2$s', 'event_espresso' ),
548
+	__('Ticket Assignment Manager for Ticket: %1$d - %2$s', 'event_espresso'),
549 549
 
550 550
 	// Reference: domains/eventEditor/src/ui/ticketAssignmentsManager/components/TicketAssignmentsManagerModal/buttons/useCancelButtonProps.tsx:18
551 551
 	// Reference: domains/eventEditor/src/ui/tickets/ticketsList/bulkEdit/prices/buttons/FooterButtons.tsx:16
552 552
 	// Reference: packages/components/src/Modal/useCancelButtonProps.tsx:10
553
-	__( 'Cancel', 'event_espresso' ),
553
+	__('Cancel', 'event_espresso'),
554 554
 
555 555
 	// Reference: domains/eventEditor/src/ui/ticketAssignmentsManager/components/TicketAssignmentsManagerModal/buttons/useSubmitButtonProps.tsx:25
556 556
 	// Reference: domains/eventEditor/src/ui/tickets/ticketsList/bulkEdit/prices/buttons/FooterButtons.tsx:17
@@ -559,770 +559,770 @@  discard block
 block discarded – undo
559 559
 	// Reference: packages/components/src/bulkEdit/details/Submit.tsx:38
560 560
 	// Reference: packages/form/src/Submit.tsx:26
561 561
 	// Reference: packages/tpc/src/buttons/useSubmitButtonProps.tsx:25
562
-	__( 'Submit', 'event_espresso' ),
562
+	__('Submit', 'event_espresso'),
563 563
 
564 564
 	// Reference: domains/eventEditor/src/ui/ticketAssignmentsManager/components/TicketAssignmentsManagerModal/index.tsx:32
565 565
 	// Reference: domains/eventEditor/src/ui/ticketAssignmentsManager/components/table/Table.tsx:14
566
-	__( 'Ticket Assignment Manager', 'event_espresso' ),
566
+	__('Ticket Assignment Manager', 'event_espresso'),
567 567
 
568 568
 	// Reference: domains/eventEditor/src/ui/ticketAssignmentsManager/components/table/BodyCell.tsx:24
569
-	__( 'assign ticket', 'event_espresso' ),
569
+	__('assign ticket', 'event_espresso'),
570 570
 
571 571
 	// Reference: domains/eventEditor/src/ui/ticketAssignmentsManager/filters/controls/DatesByMonthControl.tsx:19
572
-	__( 'All Dates', 'event_espresso' ),
572
+	__('All Dates', 'event_espresso'),
573 573
 
574 574
 	// Reference: domains/eventEditor/src/ui/ticketAssignmentsManager/filters/controls/DatesByMonthControl.tsx:26
575
-	__( 'dates by month', 'event_espresso' ),
575
+	__('dates by month', 'event_espresso'),
576 576
 
577 577
 	// Reference: domains/eventEditor/src/ui/ticketAssignmentsManager/filters/controls/ShowExpiredTicketsControl.tsx:14
578
-	__( 'show expired tickets', 'event_espresso' ),
578
+	__('show expired tickets', 'event_espresso'),
579 579
 
580 580
 	// Reference: domains/eventEditor/src/ui/ticketAssignmentsManager/filters/controls/ShowTrashedDatesControl.tsx:10
581
-	__( 'show trashed dates', 'event_espresso' ),
581
+	__('show trashed dates', 'event_espresso'),
582 582
 
583 583
 	// Reference: domains/eventEditor/src/ui/ticketAssignmentsManager/filters/controls/ShowTrashedTicketsControl.tsx:14
584
-	__( 'show trashed tickets', 'event_espresso' ),
584
+	__('show trashed tickets', 'event_espresso'),
585 585
 
586 586
 	// Reference: domains/eventEditor/src/ui/tickets/TicketRegistrationsLink.tsx:17
587
-	__( 'total registrations.', 'event_espresso' ),
587
+	__('total registrations.', 'event_espresso'),
588 588
 
589 589
 	// Reference: domains/eventEditor/src/ui/tickets/TicketRegistrationsLink.tsx:18
590
-	__( 'view ALL registrations for this ticket.', 'event_espresso' ),
590
+	__('view ALL registrations for this ticket.', 'event_espresso'),
591 591
 
592 592
 	// Reference: domains/eventEditor/src/ui/tickets/ticketForm/multiStep/Container.tsx:21
593 593
 	/* translators: %s ticket id */
594
-	__( 'Edit ticket %s', 'event_espresso' ),
594
+	__('Edit ticket %s', 'event_espresso'),
595 595
 
596 596
 	// Reference: domains/eventEditor/src/ui/tickets/ticketForm/multiStep/Container.tsx:24
597
-	__( 'New Ticket Details', 'event_espresso' ),
597
+	__('New Ticket Details', 'event_espresso'),
598 598
 
599 599
 	// Reference: domains/eventEditor/src/ui/tickets/ticketForm/multiStep/ContentBody.tsx:47
600
-	__( 'Set ticket prices', 'event_espresso' ),
600
+	__('Set ticket prices', 'event_espresso'),
601 601
 
602 602
 	// Reference: domains/eventEditor/src/ui/tickets/ticketForm/multiStep/ContentBody.tsx:54
603
-	__( 'Skip prices - assign dates', 'event_espresso' ),
603
+	__('Skip prices - assign dates', 'event_espresso'),
604 604
 
605 605
 	// Reference: domains/eventEditor/src/ui/tickets/ticketForm/multiStep/ContentBody.tsx:70
606
-	__( 'Save and assign dates', 'event_espresso' ),
606
+	__('Save and assign dates', 'event_espresso'),
607 607
 
608 608
 	// Reference: domains/eventEditor/src/ui/tickets/ticketForm/multiStep/ContentBody.tsx:83
609
-	__( 'Ticket details', 'event_espresso' ),
609
+	__('Ticket details', 'event_espresso'),
610 610
 
611 611
 	// Reference: domains/eventEditor/src/ui/tickets/ticketForm/multiStep/TicketFormSteps.tsx:11
612
-	__( 'primary information about the ticket', 'event_espresso' ),
612
+	__('primary information about the ticket', 'event_espresso'),
613 613
 
614 614
 	// Reference: domains/eventEditor/src/ui/tickets/ticketForm/multiStep/TicketFormSteps.tsx:11
615
-	__( 'Ticket Details', 'event_espresso' ),
615
+	__('Ticket Details', 'event_espresso'),
616 616
 
617 617
 	// Reference: domains/eventEditor/src/ui/tickets/ticketForm/multiStep/TicketFormSteps.tsx:13
618
-	__( 'apply ticket price modifiers and taxes', 'event_espresso' ),
618
+	__('apply ticket price modifiers and taxes', 'event_espresso'),
619 619
 
620 620
 	// Reference: domains/eventEditor/src/ui/tickets/ticketForm/multiStep/TicketFormSteps.tsx:15
621
-	__( 'Price Calculator', 'event_espresso' ),
621
+	__('Price Calculator', 'event_espresso'),
622 622
 
623 623
 	// Reference: domains/eventEditor/src/ui/tickets/ticketForm/multiStep/TicketFormSteps.tsx:17
624
-	__( 'Assign Dates', 'event_espresso' ),
624
+	__('Assign Dates', 'event_espresso'),
625 625
 
626 626
 	// Reference: domains/eventEditor/src/ui/tickets/ticketForm/useTicketFormConfig.tsx:105
627
-	__( 'Ticket Sales', 'event_espresso' ),
627
+	__('Ticket Sales', 'event_espresso'),
628 628
 
629 629
 	// Reference: domains/eventEditor/src/ui/tickets/ticketForm/useTicketFormConfig.tsx:128
630 630
 	// Reference: domains/eventEditor/src/ui/tickets/ticketsList/bulkEdit/details/useBulkEditFormConfig.ts:112
631
-	__( 'Quantity For Sale', 'event_espresso' ),
631
+	__('Quantity For Sale', 'event_espresso'),
632 632
 
633 633
 	// Reference: domains/eventEditor/src/ui/tickets/ticketForm/useTicketFormConfig.tsx:134
634
-	__( 'The maximum number of this ticket available for sale.', 'event_espresso' ),
634
+	__('The maximum number of this ticket available for sale.', 'event_espresso'),
635 635
 
636 636
 	// Reference: domains/eventEditor/src/ui/tickets/ticketForm/useTicketFormConfig.tsx:136
637
-	__( 'Set to 0 to stop sales, or leave blank for no limit.', 'event_espresso' ),
637
+	__('Set to 0 to stop sales, or leave blank for no limit.', 'event_espresso'),
638 638
 
639 639
 	// Reference: domains/eventEditor/src/ui/tickets/ticketForm/useTicketFormConfig.tsx:141
640 640
 	// Reference: domains/eventEditor/src/ui/tickets/ticketsList/bulkEdit/details/useBulkEditFormConfig.ts:121
641
-	__( 'Number of Uses', 'event_espresso' ),
641
+	__('Number of Uses', 'event_espresso'),
642 642
 
643 643
 	// Reference: domains/eventEditor/src/ui/tickets/ticketForm/useTicketFormConfig.tsx:147
644
-	__( 'Controls the total number of times this ticket can be used, regardless of the number of dates it is assigned to.', 'event_espresso' ),
644
+	__('Controls the total number of times this ticket can be used, regardless of the number of dates it is assigned to.', 'event_espresso'),
645 645
 
646 646
 	// Reference: domains/eventEditor/src/ui/tickets/ticketForm/useTicketFormConfig.tsx:151
647
-	__( 'Example: A ticket might have access to 4 different dates, but setting this field to 2 would mean that the ticket could only be used twice. Leave blank for no limit.', 'event_espresso' ),
647
+	__('Example: A ticket might have access to 4 different dates, but setting this field to 2 would mean that the ticket could only be used twice. Leave blank for no limit.', 'event_espresso'),
648 648
 
649 649
 	// Reference: domains/eventEditor/src/ui/tickets/ticketForm/useTicketFormConfig.tsx:158
650 650
 	// Reference: domains/eventEditor/src/ui/tickets/ticketsList/bulkEdit/details/useBulkEditFormConfig.ts:129
651
-	__( 'Minimum Quantity', 'event_espresso' ),
651
+	__('Minimum Quantity', 'event_espresso'),
652 652
 
653 653
 	// Reference: domains/eventEditor/src/ui/tickets/ticketForm/useTicketFormConfig.tsx:163
654
-	__( 'The minimum quantity that can be selected for this ticket. Use this to create ticket bundles or graduated pricing.', 'event_espresso' ),
654
+	__('The minimum quantity that can be selected for this ticket. Use this to create ticket bundles or graduated pricing.', 'event_espresso'),
655 655
 
656 656
 	// Reference: domains/eventEditor/src/ui/tickets/ticketForm/useTicketFormConfig.tsx:167
657
-	__( 'Leave blank for no minimum.', 'event_espresso' ),
657
+	__('Leave blank for no minimum.', 'event_espresso'),
658 658
 
659 659
 	// Reference: domains/eventEditor/src/ui/tickets/ticketForm/useTicketFormConfig.tsx:172
660 660
 	// Reference: domains/eventEditor/src/ui/tickets/ticketsList/bulkEdit/details/useBulkEditFormConfig.ts:137
661
-	__( 'Maximum Quantity', 'event_espresso' ),
661
+	__('Maximum Quantity', 'event_espresso'),
662 662
 
663 663
 	// Reference: domains/eventEditor/src/ui/tickets/ticketForm/useTicketFormConfig.tsx:178
664
-	__( 'The maximum quantity that can be selected for this ticket. Use this to create ticket bundles or graduated pricing.', 'event_espresso' ),
664
+	__('The maximum quantity that can be selected for this ticket. Use this to create ticket bundles or graduated pricing.', 'event_espresso'),
665 665
 
666 666
 	// Reference: domains/eventEditor/src/ui/tickets/ticketForm/useTicketFormConfig.tsx:182
667
-	__( 'Leave blank for no maximum.', 'event_espresso' ),
667
+	__('Leave blank for no maximum.', 'event_espresso'),
668 668
 
669 669
 	// Reference: domains/eventEditor/src/ui/tickets/ticketForm/useTicketFormConfig.tsx:187
670 670
 	// Reference: domains/eventEditor/src/ui/tickets/ticketsList/bulkEdit/details/useBulkEditFormConfig.ts:146
671
-	__( 'Required Ticket', 'event_espresso' ),
671
+	__('Required Ticket', 'event_espresso'),
672 672
 
673 673
 	// Reference: domains/eventEditor/src/ui/tickets/ticketForm/useTicketFormConfig.tsx:189
674
-	__( 'If enabled, the ticket must be selected and will appear first in frontend ticket lists.', 'event_espresso' ),
674
+	__('If enabled, the ticket must be selected and will appear first in frontend ticket lists.', 'event_espresso'),
675 675
 
676 676
 	// Reference: domains/eventEditor/src/ui/tickets/ticketForm/useTicketFormConfig.tsx:196
677
-	__( 'Default Ticket', 'event_espresso' ),
677
+	__('Default Ticket', 'event_espresso'),
678 678
 
679 679
 	// Reference: domains/eventEditor/src/ui/tickets/ticketForm/useTicketFormConfig.tsx:198
680
-	__( 'If enabled, the ticket will appear on all new events.', 'event_espresso' ),
680
+	__('If enabled, the ticket will appear on all new events.', 'event_espresso'),
681 681
 
682 682
 	// Reference: domains/eventEditor/src/ui/tickets/ticketsList/TicketsList.tsx:35
683
-	__( 'Available Tickets', 'event_espresso' ),
683
+	__('Available Tickets', 'event_espresso'),
684 684
 
685 685
 	// Reference: domains/eventEditor/src/ui/tickets/ticketsList/TicketsList.tsx:38
686
-	__( 'loading tickets…', 'event_espresso' ),
686
+	__('loading tickets…', 'event_espresso'),
687 687
 
688 688
 	// Reference: domains/eventEditor/src/ui/tickets/ticketsList/actionsMenu/AssignDatesButton.tsx:27
689
-	__( 'Number of related dates', 'event_espresso' ),
689
+	__('Number of related dates', 'event_espresso'),
690 690
 
691 691
 	// Reference: domains/eventEditor/src/ui/tickets/ticketsList/actionsMenu/AssignDatesButton.tsx:28
692
-	__( 'There are no event dates assigned to this ticket. Please click the calendar icon to update the assignments.', 'event_espresso' ),
692
+	__('There are no event dates assigned to this ticket. Please click the calendar icon to update the assignments.', 'event_espresso'),
693 693
 
694 694
 	// Reference: domains/eventEditor/src/ui/tickets/ticketsList/actionsMenu/AssignDatesButton.tsx:44
695
-	__( 'assign dates', 'event_espresso' ),
695
+	__('assign dates', 'event_espresso'),
696 696
 
697 697
 	// Reference: domains/eventEditor/src/ui/tickets/ticketsList/actionsMenu/dropdown/TicketMainMenu.tsx:17
698
-	__( 'Permanently delete Ticket?', 'event_espresso' ),
698
+	__('Permanently delete Ticket?', 'event_espresso'),
699 699
 
700 700
 	// Reference: domains/eventEditor/src/ui/tickets/ticketsList/actionsMenu/dropdown/TicketMainMenu.tsx:17
701
-	__( 'Move Ticket to Trash?', 'event_espresso' ),
701
+	__('Move Ticket to Trash?', 'event_espresso'),
702 702
 
703 703
 	// Reference: domains/eventEditor/src/ui/tickets/ticketsList/actionsMenu/dropdown/TicketMainMenu.tsx:19
704
-	__( 'Are you sure you want to permanently delete this ticket? This action is permanent and can not be undone.', 'event_espresso' ),
704
+	__('Are you sure you want to permanently delete this ticket? This action is permanent and can not be undone.', 'event_espresso'),
705 705
 
706 706
 	// Reference: domains/eventEditor/src/ui/tickets/ticketsList/actionsMenu/dropdown/TicketMainMenu.tsx:20
707
-	__( 'Are you sure you want to move this ticket to the trash? You can "untrash" this ticket later if you need to.', 'event_espresso' ),
707
+	__('Are you sure you want to move this ticket to the trash? You can "untrash" this ticket later if you need to.', 'event_espresso'),
708 708
 
709 709
 	// Reference: domains/eventEditor/src/ui/tickets/ticketsList/actionsMenu/dropdown/TicketMainMenu.tsx:31
710
-	__( 'ticket main menu', 'event_espresso' ),
710
+	__('ticket main menu', 'event_espresso'),
711 711
 
712 712
 	// Reference: domains/eventEditor/src/ui/tickets/ticketsList/actionsMenu/dropdown/TicketMainMenu.tsx:35
713
-	__( 'trash ticket', 'event_espresso' ),
713
+	__('trash ticket', 'event_espresso'),
714 714
 
715 715
 	// Reference: domains/eventEditor/src/ui/tickets/ticketsList/actionsMenu/dropdown/TicketMainMenu.tsx:44
716
-	__( 'edit ticket', 'event_espresso' ),
716
+	__('edit ticket', 'event_espresso'),
717 717
 
718 718
 	// Reference: domains/eventEditor/src/ui/tickets/ticketsList/actionsMenu/dropdown/TicketMainMenu.tsx:45
719
-	__( 'copy ticket', 'event_espresso' ),
719
+	__('copy ticket', 'event_espresso'),
720 720
 
721 721
 	// Reference: domains/eventEditor/src/ui/tickets/ticketsList/bulkEdit/actions/Actions.tsx:39
722 722
 	// Reference: packages/components/src/bulkEdit/BulkActions.tsx:44
723
-	__( 'bulk actions', 'event_espresso' ),
723
+	__('bulk actions', 'event_espresso'),
724 724
 
725 725
 	// Reference: domains/eventEditor/src/ui/tickets/ticketsList/bulkEdit/actions/Actions.tsx:43
726
-	__( 'edit ticket details', 'event_espresso' ),
726
+	__('edit ticket details', 'event_espresso'),
727 727
 
728 728
 	// Reference: domains/eventEditor/src/ui/tickets/ticketsList/bulkEdit/actions/Actions.tsx:47
729
-	__( 'delete tickets', 'event_espresso' ),
729
+	__('delete tickets', 'event_espresso'),
730 730
 
731 731
 	// Reference: domains/eventEditor/src/ui/tickets/ticketsList/bulkEdit/actions/Actions.tsx:47
732
-	__( 'trash tickets', 'event_espresso' ),
732
+	__('trash tickets', 'event_espresso'),
733 733
 
734 734
 	// Reference: domains/eventEditor/src/ui/tickets/ticketsList/bulkEdit/actions/Actions.tsx:51
735
-	__( 'edit ticket prices', 'event_espresso' ),
735
+	__('edit ticket prices', 'event_espresso'),
736 736
 
737 737
 	// Reference: domains/eventEditor/src/ui/tickets/ticketsList/bulkEdit/delete/Delete.tsx:13
738
-	__( 'Are you sure you want to permanently delete these tickets? This action can NOT be undone!', 'event_espresso' ),
738
+	__('Are you sure you want to permanently delete these tickets? This action can NOT be undone!', 'event_espresso'),
739 739
 
740 740
 	// Reference: domains/eventEditor/src/ui/tickets/ticketsList/bulkEdit/delete/Delete.tsx:14
741
-	__( 'Are you sure you want to trash these tickets?', 'event_espresso' ),
741
+	__('Are you sure you want to trash these tickets?', 'event_espresso'),
742 742
 
743 743
 	// Reference: domains/eventEditor/src/ui/tickets/ticketsList/bulkEdit/delete/Delete.tsx:15
744
-	__( 'Delete tickets permanently', 'event_espresso' ),
744
+	__('Delete tickets permanently', 'event_espresso'),
745 745
 
746 746
 	// Reference: domains/eventEditor/src/ui/tickets/ticketsList/bulkEdit/delete/Delete.tsx:15
747
-	__( 'Trash tickets', 'event_espresso' ),
747
+	__('Trash tickets', 'event_espresso'),
748 748
 
749 749
 	// Reference: domains/eventEditor/src/ui/tickets/ticketsList/bulkEdit/details/EditDetails.tsx:22
750
-	__( 'Bulk edit ticket details', 'event_espresso' ),
750
+	__('Bulk edit ticket details', 'event_espresso'),
751 751
 
752 752
 	// Reference: domains/eventEditor/src/ui/tickets/ticketsList/bulkEdit/details/EditDetails.tsx:23
753
-	__( 'any changes will be applied to ALL of the selected tickets.', 'event_espresso' ),
753
+	__('any changes will be applied to ALL of the selected tickets.', 'event_espresso'),
754 754
 
755 755
 	// Reference: domains/eventEditor/src/ui/tickets/ticketsList/bulkEdit/prices/EditPrices.tsx:18
756
-	__( 'Bulk edit ticket prices', 'event_espresso' ),
756
+	__('Bulk edit ticket prices', 'event_espresso'),
757 757
 
758 758
 	// Reference: domains/eventEditor/src/ui/tickets/ticketsList/bulkEdit/prices/buttons/EditModeButtons.tsx:19
759
-	__( 'Edit all prices together', 'event_espresso' ),
759
+	__('Edit all prices together', 'event_espresso'),
760 760
 
761 761
 	// Reference: domains/eventEditor/src/ui/tickets/ticketsList/bulkEdit/prices/buttons/EditModeButtons.tsx:20
762
-	__( 'Edit all the selected ticket prices dynamically', 'event_espresso' ),
762
+	__('Edit all the selected ticket prices dynamically', 'event_espresso'),
763 763
 
764 764
 	// Reference: domains/eventEditor/src/ui/tickets/ticketsList/bulkEdit/prices/buttons/EditModeButtons.tsx:24
765
-	__( 'Edit prices individually', 'event_espresso' ),
765
+	__('Edit prices individually', 'event_espresso'),
766 766
 
767 767
 	// Reference: domains/eventEditor/src/ui/tickets/ticketsList/bulkEdit/prices/buttons/EditModeButtons.tsx:25
768
-	__( 'Edit prices for each ticket individually', 'event_espresso' ),
768
+	__('Edit prices for each ticket individually', 'event_espresso'),
769 769
 
770 770
 	// Reference: domains/eventEditor/src/ui/tickets/ticketsList/bulkEdit/prices/buttons/FooterButtons.tsx:15
771 771
 	// Reference: packages/components/src/bulkEdit/details/Submit.tsx:45
772 772
 	// Reference: packages/form/src/ResetButton.tsx:17
773 773
 	// Reference: packages/tpc/src/buttons/useResetButtonProps.tsx:12
774
-	__( 'Reset', 'event_espresso' ),
774
+	__('Reset', 'event_espresso'),
775 775
 
776 776
 	// Reference: domains/eventEditor/src/ui/tickets/ticketsList/bulkEdit/prices/editSeparately/TPCInstance.tsx:25
777 777
 	/* translators: %s ticket name */
778
-	__( 'Edit prices for Ticket: %s', 'event_espresso' ),
778
+	__('Edit prices for Ticket: %s', 'event_espresso'),
779 779
 
780 780
 	// Reference: domains/eventEditor/src/ui/tickets/ticketsList/cardView/TicketCardSidebar.tsx:36
781
-	__( 'Edit Ticket Sale Dates', 'event_espresso' ),
781
+	__('Edit Ticket Sale Dates', 'event_espresso'),
782 782
 
783 783
 	// Reference: domains/eventEditor/src/ui/tickets/ticketsList/cardView/TicketCardSidebar.tsx:38
784
-	__( 'edit ticket sales start and end dates', 'event_espresso' ),
784
+	__('edit ticket sales start and end dates', 'event_espresso'),
785 785
 
786 786
 	// Reference: domains/eventEditor/src/ui/tickets/ticketsList/cardView/TicketDetailsPanel.tsx:27
787
-	__( 'quantity', 'event_espresso' ),
787
+	__('quantity', 'event_espresso'),
788 788
 
789 789
 	// Reference: domains/eventEditor/src/ui/tickets/ticketsList/cardView/TicketQuantity.tsx:26
790
-	__( 'edit quantity of tickets available…', 'event_espresso' ),
790
+	__('edit quantity of tickets available…', 'event_espresso'),
791 791
 
792 792
 	// Reference: domains/eventEditor/src/ui/tickets/ticketsList/config.ts:15
793 793
 	// Reference: domains/eventEditor/src/ui/tickets/ticketsList/tableView/useHeaderRowGenerator.tsx:51
794
-	__( 'On Sale', 'event_espresso' ),
794
+	__('On Sale', 'event_espresso'),
795 795
 
796 796
 	// Reference: domains/eventEditor/src/ui/tickets/ticketsList/config.ts:17
797
-	__( 'Pending', 'event_espresso' ),
797
+	__('Pending', 'event_espresso'),
798 798
 
799 799
 	// Reference: domains/eventEditor/src/ui/tickets/ticketsList/editable/EditablePrice.tsx:32
800
-	__( 'edit ticket total…', 'event_espresso' ),
800
+	__('edit ticket total…', 'event_espresso'),
801 801
 
802 802
 	// Reference: domains/eventEditor/src/ui/tickets/ticketsList/editable/EditablePrice.tsx:42
803
-	__( 'set price…', 'event_espresso' ),
803
+	__('set price…', 'event_espresso'),
804 804
 
805 805
 	// Reference: domains/eventEditor/src/ui/tickets/ticketsList/filterBar/controls/IsChainedButton.tsx:24
806
-	__( 'tickets list is linked to dates list and is showing tickets for above dates only', 'event_espresso' ),
806
+	__('tickets list is linked to dates list and is showing tickets for above dates only', 'event_espresso'),
807 807
 
808 808
 	// Reference: domains/eventEditor/src/ui/tickets/ticketsList/filterBar/controls/IsChainedButton.tsx:25
809
-	__( 'tickets list is unlinked and is showing tickets for all event dates', 'event_espresso' ),
809
+	__('tickets list is unlinked and is showing tickets for all event dates', 'event_espresso'),
810 810
 
811 811
 	// Reference: domains/eventEditor/src/ui/tickets/ticketsList/filterBar/controls/options.ts:10
812
-	__( 'ticket sales start and end dates', 'event_espresso' ),
812
+	__('ticket sales start and end dates', 'event_espresso'),
813 813
 
814 814
 	// Reference: domains/eventEditor/src/ui/tickets/ticketsList/filterBar/controls/options.ts:15
815
-	__( 'tickets with 90% or more sold', 'event_espresso' ),
815
+	__('tickets with 90% or more sold', 'event_espresso'),
816 816
 
817 817
 	// Reference: domains/eventEditor/src/ui/tickets/ticketsList/filterBar/controls/options.ts:16
818
-	__( 'tickets with 75% or more sold', 'event_espresso' ),
818
+	__('tickets with 75% or more sold', 'event_espresso'),
819 819
 
820 820
 	// Reference: domains/eventEditor/src/ui/tickets/ticketsList/filterBar/controls/options.ts:17
821
-	__( 'tickets with 50% or more sold', 'event_espresso' ),
821
+	__('tickets with 50% or more sold', 'event_espresso'),
822 822
 
823 823
 	// Reference: domains/eventEditor/src/ui/tickets/ticketsList/filterBar/controls/options.ts:19
824
-	__( 'tickets with less than 50% sold', 'event_espresso' ),
824
+	__('tickets with less than 50% sold', 'event_espresso'),
825 825
 
826 826
 	// Reference: domains/eventEditor/src/ui/tickets/ticketsList/filterBar/controls/options.ts:28
827
-	__( 'all tickets for all dates', 'event_espresso' ),
827
+	__('all tickets for all dates', 'event_espresso'),
828 828
 
829 829
 	// Reference: domains/eventEditor/src/ui/tickets/ticketsList/filterBar/controls/options.ts:29
830
-	__( 'all on sale and sale pending', 'event_espresso' ),
830
+	__('all on sale and sale pending', 'event_espresso'),
831 831
 
832 832
 	// Reference: domains/eventEditor/src/ui/tickets/ticketsList/filterBar/controls/options.ts:30
833
-	__( 'on sale tickets only', 'event_espresso' ),
833
+	__('on sale tickets only', 'event_espresso'),
834 834
 
835 835
 	// Reference: domains/eventEditor/src/ui/tickets/ticketsList/filterBar/controls/options.ts:31
836
-	__( 'sale pending tickets only', 'event_espresso' ),
836
+	__('sale pending tickets only', 'event_espresso'),
837 837
 
838 838
 	// Reference: domains/eventEditor/src/ui/tickets/ticketsList/filterBar/controls/options.ts:32
839
-	__( 'next on sale or sale pending only', 'event_espresso' ),
839
+	__('next on sale or sale pending only', 'event_espresso'),
840 840
 
841 841
 	// Reference: domains/eventEditor/src/ui/tickets/ticketsList/filterBar/controls/options.ts:33
842
-	__( 'sold out tickets only', 'event_espresso' ),
842
+	__('sold out tickets only', 'event_espresso'),
843 843
 
844 844
 	// Reference: domains/eventEditor/src/ui/tickets/ticketsList/filterBar/controls/options.ts:34
845
-	__( 'expired tickets only', 'event_espresso' ),
845
+	__('expired tickets only', 'event_espresso'),
846 846
 
847 847
 	// Reference: domains/eventEditor/src/ui/tickets/ticketsList/filterBar/controls/options.ts:35
848
-	__( 'trashed tickets only', 'event_espresso' ),
848
+	__('trashed tickets only', 'event_espresso'),
849 849
 
850 850
 	// Reference: domains/eventEditor/src/ui/tickets/ticketsList/filterBar/controls/options.ts:40
851
-	__( 'all tickets for above dates', 'event_espresso' ),
851
+	__('all tickets for above dates', 'event_espresso'),
852 852
 
853 853
 	// Reference: domains/eventEditor/src/ui/tickets/ticketsList/filterBar/controls/options.ts:44
854
-	__( 'ticket sale date', 'event_espresso' ),
854
+	__('ticket sale date', 'event_espresso'),
855 855
 
856 856
 	// Reference: domains/eventEditor/src/ui/tickets/ticketsList/filterBar/controls/options.ts:45
857
-	__( 'ticket name', 'event_espresso' ),
857
+	__('ticket name', 'event_espresso'),
858 858
 
859 859
 	// Reference: domains/eventEditor/src/ui/tickets/ticketsList/filterBar/controls/options.ts:46
860
-	__( 'ticket ID', 'event_espresso' ),
860
+	__('ticket ID', 'event_espresso'),
861 861
 
862 862
 	// Reference: domains/eventEditor/src/ui/tickets/ticketsList/filterBar/controls/options.ts:53
863
-	__( 'link', 'event_espresso' ),
863
+	__('link', 'event_espresso'),
864 864
 
865 865
 	// Reference: domains/eventEditor/src/ui/tickets/ticketsList/filterBar/controls/options.ts:8
866
-	__( 'ticket sales start date only', 'event_espresso' ),
866
+	__('ticket sales start date only', 'event_espresso'),
867 867
 
868 868
 	// Reference: domains/eventEditor/src/ui/tickets/ticketsList/filterBar/controls/options.ts:9
869
-	__( 'ticket sales end date only', 'event_espresso' ),
869
+	__('ticket sales end date only', 'event_espresso'),
870 870
 
871 871
 	// Reference: domains/eventEditor/src/ui/tickets/ticketsList/newTicketOptions/AddSingleTicket.tsx:19
872
-	__( 'Add New Ticket', 'event_espresso' ),
872
+	__('Add New Ticket', 'event_espresso'),
873 873
 
874 874
 	// Reference: domains/eventEditor/src/ui/tickets/ticketsList/newTicketOptions/AddSingleTicket.tsx:31
875
-	__( 'Single Ticket', 'event_espresso' ),
875
+	__('Single Ticket', 'event_espresso'),
876 876
 
877 877
 	// Reference: domains/eventEditor/src/ui/tickets/ticketsList/newTicketOptions/AddSingleTicket.tsx:33
878
-	__( 'Add a single ticket and assign the dates to it', 'event_espresso' ),
878
+	__('Add a single ticket and assign the dates to it', 'event_espresso'),
879 879
 
880 880
 	// Reference: domains/eventEditor/src/ui/tickets/ticketsList/tableView/TableView.tsx:40
881
-	__( 'Tickets', 'event_espresso' ),
881
+	__('Tickets', 'event_espresso'),
882 882
 
883 883
 	// Reference: domains/eventEditor/src/ui/tickets/ticketsList/tableView/useHeaderRowGenerator.tsx:50
884
-	__( 'Goes on Sale', 'event_espresso' ),
884
+	__('Goes on Sale', 'event_espresso'),
885 885
 
886 886
 	// Reference: domains/eventEditor/src/ui/tickets/ticketsList/tableView/useHeaderRowGenerator.tsx:61
887
-	__( 'Sale Ends', 'event_espresso' ),
887
+	__('Sale Ends', 'event_espresso'),
888 888
 
889 889
 	// Reference: domains/eventEditor/src/ui/tickets/ticketsList/tableView/useHeaderRowGenerator.tsx:62
890
-	__( 'Ends', 'event_espresso' ),
890
+	__('Ends', 'event_espresso'),
891 891
 
892 892
 	// Reference: domains/eventEditor/src/ui/tickets/ticketsList/tableView/useHeaderRowGenerator.tsx:71
893
-	__( 'Price', 'event_espresso' ),
893
+	__('Price', 'event_espresso'),
894 894
 
895 895
 	// Reference: domains/eventEditor/src/ui/tickets/ticketsList/tableView/useHeaderRowGenerator.tsx:78
896
-	__( 'Quantity', 'event_espresso' ),
896
+	__('Quantity', 'event_espresso'),
897 897
 
898 898
 	// Reference: domains/eventEditor/src/ui/tickets/ticketsList/tableView/useHeaderRowGenerator.tsx:94
899
-	__( 'Registrations', 'event_espresso' ),
899
+	__('Registrations', 'event_espresso'),
900 900
 
901 901
 	// Reference: domains/wpPluginsPage/src/exitSurvey/Popup.tsx:28
902
-	__( 'Do you have a moment to share why you are deactivating Event Espresso?', 'event_espresso' ),
902
+	__('Do you have a moment to share why you are deactivating Event Espresso?', 'event_espresso'),
903 903
 
904 904
 	// Reference: domains/wpPluginsPage/src/exitSurvey/Popup.tsx:39
905
-	__( 'Skip', 'event_espresso' ),
905
+	__('Skip', 'event_espresso'),
906 906
 
907 907
 	// Reference: domains/wpPluginsPage/src/exitSurvey/Popup.tsx:41
908
-	__( 'Sure I\'ll help', 'event_espresso' ),
908
+	__('Sure I\'ll help', 'event_espresso'),
909 909
 
910 910
 	// Reference: packages/adapters/src/Pagination/Pagination.tsx:24
911
-	__( 'pagination', 'event_espresso' ),
911
+	__('pagination', 'event_espresso'),
912 912
 
913 913
 	// Reference: packages/components/src/ActiveFilters/ActiveFilters.tsx:9
914
-	__( 'active filters:', 'event_espresso' ),
914
+	__('active filters:', 'event_espresso'),
915 915
 
916 916
 	// Reference: packages/components/src/ActiveFilters/FilterTag.tsx:11
917 917
 	/* translators: %s filter name */
918
-	__( 'remove filter - %s', 'event_espresso' ),
918
+	__('remove filter - %s', 'event_espresso'),
919 919
 
920 920
 	// Reference: packages/components/src/CalendarDateRange/CalendarDateRange.tsx:39
921
-	__( 'to', 'event_espresso' ),
921
+	__('to', 'event_espresso'),
922 922
 
923 923
 	// Reference: packages/components/src/CalendarDateSwitcher/CalendarDateSwitcher.tsx:33
924
-	__( 'starts', 'event_espresso' ),
924
+	__('starts', 'event_espresso'),
925 925
 
926 926
 	// Reference: packages/components/src/CalendarDateSwitcher/CalendarDateSwitcher.tsx:45
927
-	__( 'ends', 'event_espresso' ),
927
+	__('ends', 'event_espresso'),
928 928
 
929 929
 	// Reference: packages/components/src/CalendarPageDate/CalendarPageDate.tsx:57
930
-	__( 'TO', 'event_espresso' ),
930
+	__('TO', 'event_espresso'),
931 931
 
932 932
 	// Reference: packages/components/src/Confirm/ConfirmClose.tsx:8
933 933
 	// Reference: packages/components/src/Modal/ModalWithAlert.tsx:22
934
-	__( 'Are you sure you want to close this?', 'event_espresso' ),
934
+	__('Are you sure you want to close this?', 'event_espresso'),
935 935
 
936 936
 	// Reference: packages/components/src/Confirm/ConfirmDelete.tsx:8
937
-	__( 'Are you sure you want to delete this?', 'event_espresso' ),
937
+	__('Are you sure you want to delete this?', 'event_espresso'),
938 938
 
939 939
 	// Reference: packages/components/src/Confirm/useConfirmWithButton.tsx:11
940
-	__( 'Please confirm this action.', 'event_espresso' ),
940
+	__('Please confirm this action.', 'event_espresso'),
941 941
 
942 942
 	// Reference: packages/components/src/Confirm/useConfirmationDialog.tsx:34
943
-	__( 'No', 'event_espresso' ),
943
+	__('No', 'event_espresso'),
944 944
 
945 945
 	// Reference: packages/components/src/Confirm/useConfirmationDialog.tsx:35
946
-	__( 'Yes', 'event_espresso' ),
946
+	__('Yes', 'event_espresso'),
947 947
 
948 948
 	// Reference: packages/components/src/DateTimeRangePicker/index.tsx:74
949 949
 	// Reference: packages/components/src/PopoverForm/PopoverForm.tsx:42
950
-	__( 'save', 'event_espresso' ),
950
+	__('save', 'event_espresso'),
951 951
 
952 952
 	// Reference: packages/components/src/DebugInfo/DebugInfo.tsx:38
953
-	__( 'Hide Debug Info', 'event_espresso' ),
953
+	__('Hide Debug Info', 'event_espresso'),
954 954
 
955 955
 	// Reference: packages/components/src/DebugInfo/DebugInfo.tsx:38
956
-	__( 'Show Debug Info', 'event_espresso' ),
956
+	__('Show Debug Info', 'event_espresso'),
957 957
 
958 958
 	// Reference: packages/components/src/EditDateRangeButton/index.tsx:41
959
-	__( 'Edit Start and End Dates and Times', 'event_espresso' ),
959
+	__('Edit Start and End Dates and Times', 'event_espresso'),
960 960
 
961 961
 	// Reference: packages/components/src/EntityActionsMenu/entityMenuItems/Copy.tsx:9
962
-	__( 'copy', 'event_espresso' ),
962
+	__('copy', 'event_espresso'),
963 963
 
964 964
 	// Reference: packages/components/src/EntityActionsMenu/entityMenuItems/Edit.tsx:9
965
-	__( 'edit', 'event_espresso' ),
965
+	__('edit', 'event_espresso'),
966 966
 
967 967
 	// Reference: packages/components/src/EntityActionsMenu/entityMenuItems/Trash.tsx:9
968
-	__( 'trash', 'event_espresso' ),
968
+	__('trash', 'event_espresso'),
969 969
 
970 970
 	// Reference: packages/components/src/EntityDetailsPanel/EntityDetailsPanelSold.tsx:36
971
-	__( 'view approved registrations for this date.', 'event_espresso' ),
971
+	__('view approved registrations for this date.', 'event_espresso'),
972 972
 
973 973
 	// Reference: packages/components/src/EntityDetailsPanel/EntityDetailsPanelSold.tsx:37
974
-	__( 'view approved registrations for this ticket.', 'event_espresso' ),
974
+	__('view approved registrations for this ticket.', 'event_espresso'),
975 975
 
976 976
 	// Reference: packages/components/src/EntityList/EntityList.tsx:36
977
-	__( 'no results found', 'event_espresso' ),
977
+	__('no results found', 'event_espresso'),
978 978
 
979 979
 	// Reference: packages/components/src/EntityList/EntityList.tsx:37
980
-	__( 'try changing filter settings', 'event_espresso' ),
980
+	__('try changing filter settings', 'event_espresso'),
981 981
 
982 982
 	// Reference: packages/components/src/EntityList/filterBar/buttons/CardViewFilterButton.tsx:22
983
-	__( 'card view', 'event_espresso' ),
983
+	__('card view', 'event_espresso'),
984 984
 
985 985
 	// Reference: packages/components/src/EntityList/filterBar/buttons/TableViewFilterButton.tsx:22
986
-	__( 'table view', 'event_espresso' ),
986
+	__('table view', 'event_espresso'),
987 987
 
988 988
 	// Reference: packages/components/src/EntityList/filterBar/buttons/ToggleFiltersButton.tsx:11
989
-	__( 'hide filters', 'event_espresso' ),
989
+	__('hide filters', 'event_espresso'),
990 990
 
991 991
 	// Reference: packages/components/src/EntityList/filterBar/buttons/ToggleFiltersButton.tsx:11
992
-	__( 'show filters', 'event_espresso' ),
992
+	__('show filters', 'event_espresso'),
993 993
 
994 994
 	// Reference: packages/components/src/EntityList/filterBar/buttons/ToggleSortingButton.tsx:28
995
-	__( 'disable sorting', 'event_espresso' ),
995
+	__('disable sorting', 'event_espresso'),
996 996
 
997 997
 	// Reference: packages/components/src/EntityList/filterBar/buttons/ToggleSortingButton.tsx:28
998
-	__( 'enable sorting', 'event_espresso' ),
998
+	__('enable sorting', 'event_espresso'),
999 999
 
1000 1000
 	// Reference: packages/components/src/Legend/ToggleLegendButton.tsx:27
1001
-	__( 'hide legend', 'event_espresso' ),
1001
+	__('hide legend', 'event_espresso'),
1002 1002
 
1003 1003
 	// Reference: packages/components/src/Legend/ToggleLegendButton.tsx:27
1004
-	__( 'show legend', 'event_espresso' ),
1004
+	__('show legend', 'event_espresso'),
1005 1005
 
1006 1006
 	// Reference: packages/components/src/LoadingNotice/LoadingNotice.tsx:12
1007
-	__( 'loading…', 'event_espresso' ),
1007
+	__('loading…', 'event_espresso'),
1008 1008
 
1009 1009
 	// Reference: packages/components/src/Modal/modalCloseButtonProps/index.ts:8
1010
-	__( 'close modal', 'event_espresso' ),
1010
+	__('close modal', 'event_espresso'),
1011 1011
 
1012 1012
 	// Reference: packages/components/src/Pagination/ItemRender.tsx:10
1013
-	__( 'next', 'event_espresso' ),
1013
+	__('next', 'event_espresso'),
1014 1014
 
1015 1015
 	// Reference: packages/components/src/Pagination/ItemRender.tsx:11
1016
-	__( 'jump to previous', 'event_espresso' ),
1016
+	__('jump to previous', 'event_espresso'),
1017 1017
 
1018 1018
 	// Reference: packages/components/src/Pagination/ItemRender.tsx:12
1019
-	__( 'jump to next', 'event_espresso' ),
1019
+	__('jump to next', 'event_espresso'),
1020 1020
 
1021 1021
 	// Reference: packages/components/src/Pagination/ItemRender.tsx:13
1022
-	__( 'page', 'event_espresso' ),
1022
+	__('page', 'event_espresso'),
1023 1023
 
1024 1024
 	// Reference: packages/components/src/Pagination/ItemRender.tsx:9
1025
-	__( 'previous', 'event_espresso' ),
1025
+	__('previous', 'event_espresso'),
1026 1026
 
1027 1027
 	// Reference: packages/components/src/Pagination/PerPage.tsx:37
1028
-	__( 'items per page', 'event_espresso' ),
1028
+	__('items per page', 'event_espresso'),
1029 1029
 
1030 1030
 	// Reference: packages/components/src/Pagination/constants.ts:10
1031 1031
 	/* translators: %s is per page value */
1032
-	__( '%s / page', 'event_espresso' ),
1032
+	__('%s / page', 'event_espresso'),
1033 1033
 
1034 1034
 	// Reference: packages/components/src/Pagination/constants.ts:13
1035
-	__( 'Next Page', 'event_espresso' ),
1035
+	__('Next Page', 'event_espresso'),
1036 1036
 
1037 1037
 	// Reference: packages/components/src/Pagination/constants.ts:14
1038
-	__( 'Previous Page', 'event_espresso' ),
1038
+	__('Previous Page', 'event_espresso'),
1039 1039
 
1040 1040
 	// Reference: packages/components/src/PercentSign/index.tsx:11
1041
-	__( '%', 'event_espresso' ),
1041
+	__('%', 'event_espresso'),
1042 1042
 
1043 1043
 	// Reference: packages/components/src/Stepper/buttons/Next.tsx:12
1044
-	__( 'Next', 'event_espresso' ),
1044
+	__('Next', 'event_espresso'),
1045 1045
 
1046 1046
 	// Reference: packages/components/src/Stepper/buttons/Previous.tsx:12
1047
-	__( 'Previous', 'event_espresso' ),
1047
+	__('Previous', 'event_espresso'),
1048 1048
 
1049 1049
 	// Reference: packages/components/src/Steps/Steps.tsx:30
1050
-	__( 'Steps', 'event_espresso' ),
1050
+	__('Steps', 'event_espresso'),
1051 1051
 
1052 1052
 	// Reference: packages/components/src/TabbableText/index.tsx:19
1053
-	__( 'Click to edit…', 'event_espresso' ),
1053
+	__('Click to edit…', 'event_espresso'),
1054 1054
 
1055 1055
 	// Reference: packages/components/src/TimezoneTimeInfo/Content.tsx:16
1056
-	__( 'Your Local Time Zone', 'event_espresso' ),
1056
+	__('Your Local Time Zone', 'event_espresso'),
1057 1057
 
1058 1058
 	// Reference: packages/components/src/TimezoneTimeInfo/Content.tsx:21
1059
-	__( 'The Website\'s Time Zone', 'event_espresso' ),
1059
+	__('The Website\'s Time Zone', 'event_espresso'),
1060 1060
 
1061 1061
 	// Reference: packages/components/src/TimezoneTimeInfo/Content.tsx:26
1062
-	__( 'UTC (Greenwich Mean Time)', 'event_espresso' ),
1062
+	__('UTC (Greenwich Mean Time)', 'event_espresso'),
1063 1063
 
1064 1064
 	// Reference: packages/components/src/TimezoneTimeInfo/TimezoneTimeInfo.tsx:22
1065
-	__( 'This Date Converted To:', 'event_espresso' ),
1065
+	__('This Date Converted To:', 'event_espresso'),
1066 1066
 
1067 1067
 	// Reference: packages/components/src/TimezoneTimeInfo/TimezoneTimeInfo.tsx:23
1068
-	__( 'click for timezone information', 'event_espresso' ),
1068
+	__('click for timezone information', 'event_espresso'),
1069 1069
 
1070 1070
 	// Reference: packages/components/src/bulkEdit/ActionCheckbox.tsx:38
1071 1071
 	/* translators: %d entity id */
1072
-	__( 'select entity with id %d', 'event_espresso' ),
1072
+	__('select entity with id %d', 'event_espresso'),
1073 1073
 
1074 1074
 	// Reference: packages/components/src/bulkEdit/ActionCheckbox.tsx:41
1075
-	__( 'select all entities', 'event_espresso' ),
1075
+	__('select all entities', 'event_espresso'),
1076 1076
 
1077 1077
 	// Reference: packages/components/src/bulkEdit/BulkActions.tsx:52
1078
-	__( 'select all', 'event_espresso' ),
1078
+	__('select all', 'event_espresso'),
1079 1079
 
1080 1080
 	// Reference: packages/components/src/bulkEdit/BulkActions.tsx:54
1081
-	__( 'apply', 'event_espresso' ),
1081
+	__('apply', 'event_espresso'),
1082 1082
 
1083 1083
 	// Reference: packages/components/src/bulkEdit/details/BulkEditDetailsProps.tsx:20
1084
-	__( 'Note: ', 'event_espresso' ),
1084
+	__('Note: ', 'event_espresso'),
1085 1085
 
1086 1086
 	// Reference: packages/components/src/bulkEdit/details/BulkEditDetailsProps.tsx:20
1087
-	__( 'any changes will be applied to ALL of the selected entities.', 'event_espresso' ),
1087
+	__('any changes will be applied to ALL of the selected entities.', 'event_espresso'),
1088 1088
 
1089 1089
 	// Reference: packages/components/src/bulkEdit/details/BulkEditDetailsProps.tsx:26
1090
-	__( 'Bulk edit details', 'event_espresso' ),
1090
+	__('Bulk edit details', 'event_espresso'),
1091 1091
 
1092 1092
 	// Reference: packages/components/src/bulkEdit/details/Submit.tsx:28
1093
-	__( 'Are you sure you want to bulk update the details?', 'event_espresso' ),
1093
+	__('Are you sure you want to bulk update the details?', 'event_espresso'),
1094 1094
 
1095 1095
 	// Reference: packages/components/src/bulkEdit/details/Submit.tsx:29
1096
-	__( 'Bulk update details', 'event_espresso' ),
1096
+	__('Bulk update details', 'event_espresso'),
1097 1097
 
1098 1098
 	// Reference: packages/dates/src/DateRangePicker/DateRangePickerLegend.tsx:14
1099
-	__( 'day in range', 'event_espresso' ),
1099
+	__('day in range', 'event_espresso'),
1100 1100
 
1101 1101
 	// Reference: packages/dates/src/DateRangePicker/DateRangePickerLegend.tsx:18
1102 1102
 	// Reference: packages/dates/src/DateRangePicker/index.tsx:60
1103
-	__( 'end date', 'event_espresso' ),
1103
+	__('end date', 'event_espresso'),
1104 1104
 
1105 1105
 	// Reference: packages/dates/src/DateTimePicker.tsx:13
1106 1106
 	// Reference: packages/dates/src/TimePicker.tsx:14
1107
-	__( 'time', 'event_espresso' ),
1107
+	__('time', 'event_espresso'),
1108 1108
 
1109 1109
 	// Reference: packages/dates/src/constants.ts:5
1110
-	__( 'End Date & Time must be set later than the Start Date & Time', 'event_espresso' ),
1110
+	__('End Date & Time must be set later than the Start Date & Time', 'event_espresso'),
1111 1111
 
1112 1112
 	// Reference: packages/dates/src/constants.ts:7
1113
-	__( 'Start Date & Time must be set before the End Date & Time', 'event_espresso' ),
1113
+	__('Start Date & Time must be set before the End Date & Time', 'event_espresso'),
1114 1114
 
1115 1115
 	// Reference: packages/dates/src/utils/misc.ts:14
1116
-	__( 'month(s)', 'event_espresso' ),
1116
+	__('month(s)', 'event_espresso'),
1117 1117
 
1118 1118
 	// Reference: packages/dates/src/utils/misc.ts:15
1119
-	__( 'week(s)', 'event_espresso' ),
1119
+	__('week(s)', 'event_espresso'),
1120 1120
 
1121 1121
 	// Reference: packages/dates/src/utils/misc.ts:16
1122
-	__( 'day(s)', 'event_espresso' ),
1122
+	__('day(s)', 'event_espresso'),
1123 1123
 
1124 1124
 	// Reference: packages/dates/src/utils/misc.ts:17
1125
-	__( 'hour(s)', 'event_espresso' ),
1125
+	__('hour(s)', 'event_espresso'),
1126 1126
 
1127 1127
 	// Reference: packages/dates/src/utils/misc.ts:18
1128
-	__( 'minute(s)', 'event_espresso' ),
1128
+	__('minute(s)', 'event_espresso'),
1129 1129
 
1130 1130
 	// Reference: packages/edtr-services/src/apollo/initialization/useCacheRehydration.ts:104
1131
-	__( 'price types initialized', 'event_espresso' ),
1131
+	__('price types initialized', 'event_espresso'),
1132 1132
 
1133 1133
 	// Reference: packages/edtr-services/src/apollo/initialization/useCacheRehydration.ts:114
1134
-	__( 'datetimes initialized', 'event_espresso' ),
1134
+	__('datetimes initialized', 'event_espresso'),
1135 1135
 
1136 1136
 	// Reference: packages/edtr-services/src/apollo/initialization/useCacheRehydration.ts:124
1137
-	__( 'tickets initialized', 'event_espresso' ),
1137
+	__('tickets initialized', 'event_espresso'),
1138 1138
 
1139 1139
 	// Reference: packages/edtr-services/src/apollo/initialization/useCacheRehydration.ts:134
1140
-	__( 'prices initialized', 'event_espresso' ),
1140
+	__('prices initialized', 'event_espresso'),
1141 1141
 
1142 1142
 	// Reference: packages/edtr-services/src/utils/dateAndTime.ts:22
1143
-	__( 'End date has been set one hour after start date', 'event_espresso' ),
1143
+	__('End date has been set one hour after start date', 'event_espresso'),
1144 1144
 
1145 1145
 	// Reference: packages/edtr-services/src/utils/dateAndTime.ts:35
1146
-	__( 'Start date has been set one hour before end date', 'event_espresso' ),
1146
+	__('Start date has been set one hour before end date', 'event_espresso'),
1147 1147
 
1148 1148
 	// Reference: packages/edtr-services/src/utils/dateAndTime.ts:47
1149
-	__( 'Required', 'event_espresso' ),
1149
+	__('Required', 'event_espresso'),
1150 1150
 
1151 1151
 	// Reference: packages/edtr-services/src/utils/dateAndTime.ts:52
1152
-	__( 'Start Date is required', 'event_espresso' ),
1152
+	__('Start Date is required', 'event_espresso'),
1153 1153
 
1154 1154
 	// Reference: packages/edtr-services/src/utils/dateAndTime.ts:56
1155
-	__( 'End Date is required', 'event_espresso' ),
1155
+	__('End Date is required', 'event_espresso'),
1156 1156
 
1157 1157
 	// Reference: packages/form/src/renderers/RepeatableRenderer.tsx:35
1158 1158
 	/* translators: %d the entry number */
1159
-	__( 'Entry %d', 'event_espresso' ),
1159
+	__('Entry %d', 'event_espresso'),
1160 1160
 
1161 1161
 	// Reference: packages/form/src/renderers/RepeatableRenderer.tsx:51
1162
-	__( 'Add', 'event_espresso' ),
1162
+	__('Add', 'event_espresso'),
1163 1163
 
1164 1164
 	// Reference: packages/helpers/src/datetimes/getStatusTextLabel.ts:11
1165 1165
 	// Reference: packages/helpers/src/tickets/getStatusTextLabel.ts:17
1166
-	__( 'sold out', 'event_espresso' ),
1166
+	__('sold out', 'event_espresso'),
1167 1167
 
1168 1168
 	// Reference: packages/helpers/src/datetimes/getStatusTextLabel.ts:14
1169 1169
 	// Reference: packages/helpers/src/tickets/getStatusTextLabel.ts:14
1170
-	__( 'expired', 'event_espresso' ),
1170
+	__('expired', 'event_espresso'),
1171 1171
 
1172 1172
 	// Reference: packages/helpers/src/datetimes/getStatusTextLabel.ts:17
1173
-	__( 'upcoming', 'event_espresso' ),
1173
+	__('upcoming', 'event_espresso'),
1174 1174
 
1175 1175
 	// Reference: packages/helpers/src/datetimes/getStatusTextLabel.ts:20
1176
-	__( 'active', 'event_espresso' ),
1176
+	__('active', 'event_espresso'),
1177 1177
 
1178 1178
 	// Reference: packages/helpers/src/datetimes/getStatusTextLabel.ts:23
1179 1179
 	// Reference: packages/helpers/src/tickets/getStatusTextLabel.ts:11
1180
-	__( 'trashed', 'event_espresso' ),
1180
+	__('trashed', 'event_espresso'),
1181 1181
 
1182 1182
 	// Reference: packages/helpers/src/datetimes/getStatusTextLabel.ts:26
1183
-	__( 'cancelled', 'event_espresso' ),
1183
+	__('cancelled', 'event_espresso'),
1184 1184
 
1185 1185
 	// Reference: packages/helpers/src/datetimes/getStatusTextLabel.ts:29
1186
-	__( 'postponed', 'event_espresso' ),
1186
+	__('postponed', 'event_espresso'),
1187 1187
 
1188 1188
 	// Reference: packages/helpers/src/datetimes/getStatusTextLabel.ts:33
1189
-	__( 'inactive', 'event_espresso' ),
1189
+	__('inactive', 'event_espresso'),
1190 1190
 
1191 1191
 	// Reference: packages/helpers/src/tickets/getStatusTextLabel.ts:20
1192
-	__( 'pending', 'event_espresso' ),
1192
+	__('pending', 'event_espresso'),
1193 1193
 
1194 1194
 	// Reference: packages/helpers/src/tickets/getStatusTextLabel.ts:23
1195
-	__( 'on sale', 'event_espresso' ),
1195
+	__('on sale', 'event_espresso'),
1196 1196
 
1197 1197
 	// Reference: packages/predicates/src/registration/statusOptions.ts:10
1198
-	__( 'Cancelled', 'event_espresso' ),
1198
+	__('Cancelled', 'event_espresso'),
1199 1199
 
1200 1200
 	// Reference: packages/predicates/src/registration/statusOptions.ts:14
1201
-	__( 'Declined', 'event_espresso' ),
1201
+	__('Declined', 'event_espresso'),
1202 1202
 
1203 1203
 	// Reference: packages/predicates/src/registration/statusOptions.ts:18
1204
-	__( 'Incomplete', 'event_espresso' ),
1204
+	__('Incomplete', 'event_espresso'),
1205 1205
 
1206 1206
 	// Reference: packages/predicates/src/registration/statusOptions.ts:22
1207
-	__( 'Not Approved', 'event_espresso' ),
1207
+	__('Not Approved', 'event_espresso'),
1208 1208
 
1209 1209
 	// Reference: packages/predicates/src/registration/statusOptions.ts:26
1210
-	__( 'Pending Payment', 'event_espresso' ),
1210
+	__('Pending Payment', 'event_espresso'),
1211 1211
 
1212 1212
 	// Reference: packages/predicates/src/registration/statusOptions.ts:30
1213
-	__( 'Wait List', 'event_espresso' ),
1213
+	__('Wait List', 'event_espresso'),
1214 1214
 
1215 1215
 	// Reference: packages/predicates/src/registration/statusOptions.ts:6
1216
-	__( 'Approved', 'event_espresso' ),
1216
+	__('Approved', 'event_espresso'),
1217 1217
 
1218 1218
 	// Reference: packages/tpc/src/buttons/AddPriceModifierButton.tsx:15
1219
-	__( 'add new price modifier after this row', 'event_espresso' ),
1219
+	__('add new price modifier after this row', 'event_espresso'),
1220 1220
 
1221 1221
 	// Reference: packages/tpc/src/buttons/DeleteAllPricesButton.tsx:13
1222
-	__( 'Delete all prices', 'event_espresso' ),
1222
+	__('Delete all prices', 'event_espresso'),
1223 1223
 
1224 1224
 	// Reference: packages/tpc/src/buttons/DeleteAllPricesButton.tsx:26
1225
-	__( 'Are you sure you want to delete all of this ticket\'s prices and make it free? This action is permanent and can not be undone.', 'event_espresso' ),
1225
+	__('Are you sure you want to delete all of this ticket\'s prices and make it free? This action is permanent and can not be undone.', 'event_espresso'),
1226 1226
 
1227 1227
 	// Reference: packages/tpc/src/buttons/DeleteAllPricesButton.tsx:30
1228
-	__( 'Delete all prices?', 'event_espresso' ),
1228
+	__('Delete all prices?', 'event_espresso'),
1229 1229
 
1230 1230
 	// Reference: packages/tpc/src/buttons/DeletePriceModifierButton.tsx:12
1231
-	__( 'delete price modifier', 'event_espresso' ),
1231
+	__('delete price modifier', 'event_espresso'),
1232 1232
 
1233 1233
 	// Reference: packages/tpc/src/buttons/ReverseCalculateButton.tsx:15
1234
-	__( 'Ticket base price is being reverse calculated from bottom to top starting with the ticket total. Entering a new ticket total will reverse calculate the ticket base price after applying all price modifiers in reverse. Click to turn off reverse calculations', 'event_espresso' ),
1234
+	__('Ticket base price is being reverse calculated from bottom to top starting with the ticket total. Entering a new ticket total will reverse calculate the ticket base price after applying all price modifiers in reverse. Click to turn off reverse calculations', 'event_espresso'),
1235 1235
 
1236 1236
 	// Reference: packages/tpc/src/buttons/ReverseCalculateButton.tsx:18
1237
-	__( 'Ticket total is being calculated normally from top to bottom starting from the base price. Entering a new ticket base price will recalculate the ticket total after applying all price modifiers. Click to turn on reverse calculations', 'event_espresso' ),
1237
+	__('Ticket total is being calculated normally from top to bottom starting from the base price. Entering a new ticket base price will recalculate the ticket total after applying all price modifiers. Click to turn on reverse calculations', 'event_espresso'),
1238 1238
 
1239 1239
 	// Reference: packages/tpc/src/buttons/TicketPriceCalculatorButton.tsx:29
1240
-	__( 'ticket price calculator', 'event_espresso' ),
1240
+	__('ticket price calculator', 'event_espresso'),
1241 1241
 
1242 1242
 	// Reference: packages/tpc/src/buttons/taxes/AddDefaultTaxesButton.tsx:10
1243
-	__( 'Add default taxes', 'event_espresso' ),
1243
+	__('Add default taxes', 'event_espresso'),
1244 1244
 
1245 1245
 	// Reference: packages/tpc/src/buttons/taxes/RemoveTaxesButton.tsx:11
1246
-	__( 'Are you sure you want to remove all of this ticket\'s taxes?', 'event_espresso' ),
1246
+	__('Are you sure you want to remove all of this ticket\'s taxes?', 'event_espresso'),
1247 1247
 
1248 1248
 	// Reference: packages/tpc/src/buttons/taxes/RemoveTaxesButton.tsx:15
1249
-	__( 'Remove all taxes?', 'event_espresso' ),
1249
+	__('Remove all taxes?', 'event_espresso'),
1250 1250
 
1251 1251
 	// Reference: packages/tpc/src/buttons/taxes/RemoveTaxesButton.tsx:8
1252
-	__( 'Remove taxes', 'event_espresso' ),
1252
+	__('Remove taxes', 'event_espresso'),
1253 1253
 
1254 1254
 	// Reference: packages/tpc/src/components/DefaultPricesInfo.tsx:28
1255
-	__( 'Modify default prices.', 'event_espresso' ),
1255
+	__('Modify default prices.', 'event_espresso'),
1256 1256
 
1257 1257
 	// Reference: packages/tpc/src/components/DefaultTaxesInfo.tsx:28
1258
-	__( 'New default taxes are available. Click the - Add default taxes - button to add them now.', 'event_espresso' ),
1258
+	__('New default taxes are available. Click the - Add default taxes - button to add them now.', 'event_espresso'),
1259 1259
 
1260 1260
 	// Reference: packages/tpc/src/components/NoPricesBanner/AddDefaultPricesButton.tsx:10
1261
-	__( 'Add default prices', 'event_espresso' ),
1261
+	__('Add default prices', 'event_espresso'),
1262 1262
 
1263 1263
 	// Reference: packages/tpc/src/components/NoPricesBanner/index.tsx:14
1264
-	__( 'This Ticket is Currently Free', 'event_espresso' ),
1264
+	__('This Ticket is Currently Free', 'event_espresso'),
1265 1265
 
1266 1266
 	// Reference: packages/tpc/src/components/NoPricesBanner/index.tsx:22
1267 1267
 	/* translators: %s default prices */
1268
-	__( 'Click the button below to load your %s into the calculator.', 'event_espresso' ),
1268
+	__('Click the button below to load your %s into the calculator.', 'event_espresso'),
1269 1269
 
1270 1270
 	// Reference: packages/tpc/src/components/NoPricesBanner/index.tsx:23
1271
-	__( 'default prices', 'event_espresso' ),
1271
+	__('default prices', 'event_espresso'),
1272 1272
 
1273 1273
 	// Reference: packages/tpc/src/components/NoPricesBanner/index.tsx:30
1274
-	__( 'Additional ticket price modifiers can be added or removed.', 'event_espresso' ),
1274
+	__('Additional ticket price modifiers can be added or removed.', 'event_espresso'),
1275 1275
 
1276 1276
 	// Reference: packages/tpc/src/components/NoPricesBanner/index.tsx:33
1277
-	__( 'Click the save button below to assign which dates this ticket will be available for purchase on.', 'event_espresso' ),
1277
+	__('Click the save button below to assign which dates this ticket will be available for purchase on.', 'event_espresso'),
1278 1278
 
1279 1279
 	// Reference: packages/tpc/src/components/TicketPriceCalculatorModal.tsx:32
1280 1280
 	/* translators: %s ticket name */
1281
-	__( 'Price Calculator for Ticket: %s', 'event_espresso' ),
1281
+	__('Price Calculator for Ticket: %s', 'event_espresso'),
1282 1282
 
1283 1283
 	// Reference: packages/tpc/src/components/table/Table.tsx:43
1284
-	__( 'Ticket Price Calculator', 'event_espresso' ),
1284
+	__('Ticket Price Calculator', 'event_espresso'),
1285 1285
 
1286 1286
 	// Reference: packages/tpc/src/components/table/useFooterRowGenerator.tsx:41
1287
-	__( 'Total', 'event_espresso' ),
1287
+	__('Total', 'event_espresso'),
1288 1288
 
1289 1289
 	// Reference: packages/tpc/src/components/table/useFooterRowGenerator.tsx:50
1290
-	__( 'ticket total', 'event_espresso' ),
1290
+	__('ticket total', 'event_espresso'),
1291 1291
 
1292 1292
 	// Reference: packages/tpc/src/components/table/useHeaderRowGenerator.ts:29
1293
-	__( 'Price Type', 'event_espresso' ),
1293
+	__('Price Type', 'event_espresso'),
1294 1294
 
1295 1295
 	// Reference: packages/tpc/src/components/table/useHeaderRowGenerator.ts:35
1296
-	__( 'Label', 'event_espresso' ),
1296
+	__('Label', 'event_espresso'),
1297 1297
 
1298 1298
 	// Reference: packages/tpc/src/components/table/useHeaderRowGenerator.ts:47
1299
-	__( 'Amount', 'event_espresso' ),
1299
+	__('Amount', 'event_espresso'),
1300 1300
 
1301 1301
 	// Reference: packages/tpc/src/inputs/PriceAmountInput.tsx:34
1302
-	__( 'amount', 'event_espresso' ),
1302
+	__('amount', 'event_espresso'),
1303 1303
 
1304 1304
 	// Reference: packages/tpc/src/inputs/PriceAmountInput.tsx:45
1305
-	__( 'amount…', 'event_espresso' ),
1305
+	__('amount…', 'event_espresso'),
1306 1306
 
1307 1307
 	// Reference: packages/tpc/src/inputs/PriceDescriptionInput.tsx:10
1308
-	__( 'price description', 'event_espresso' ),
1308
+	__('price description', 'event_espresso'),
1309 1309
 
1310 1310
 	// Reference: packages/tpc/src/inputs/PriceDescriptionInput.tsx:15
1311
-	__( 'description…', 'event_espresso' ),
1311
+	__('description…', 'event_espresso'),
1312 1312
 
1313 1313
 	// Reference: packages/tpc/src/inputs/PriceIdInput.tsx:9
1314
-	__( 'price id', 'event_espresso' ),
1314
+	__('price id', 'event_espresso'),
1315 1315
 
1316 1316
 	// Reference: packages/tpc/src/inputs/PriceNameInput.tsx:10
1317
-	__( 'price name', 'event_espresso' ),
1317
+	__('price name', 'event_espresso'),
1318 1318
 
1319 1319
 	// Reference: packages/tpc/src/inputs/PriceNameInput.tsx:15
1320
-	__( 'label…', 'event_espresso' ),
1320
+	__('label…', 'event_espresso'),
1321 1321
 
1322 1322
 	// Reference: packages/tpc/src/inputs/PriceTypeInput.tsx:16
1323
-	__( 'price type', 'event_espresso' ),
1323
+	__('price type', 'event_espresso'),
1324 1324
 
1325 1325
 	// Reference: packages/tpc/src/utils/constants.ts:13
1326
-	__( 'Ticket price modifications are blocked for Tickets that have already been sold to registrants, because doing so would negatively affect internal accounting for the event. If you still need to modify ticket prices, then create a copy of those tickets, edit the prices for the new tickets, and then archive the old tickets.', 'event_espresso' )
1326
+	__('Ticket price modifications are blocked for Tickets that have already been sold to registrants, because doing so would negatively affect internal accounting for the event. If you still need to modify ticket prices, then create a copy of those tickets, edit the prices for the new tickets, and then archive the old tickets.', 'event_espresso')
1327 1327
 );
1328 1328
 /* THIS IS THE END OF THE GENERATED FILE */
Please login to merge, or discard this patch.