Completed
Branch dev (f21e69)
by
unknown
11:41 queued 06:15
created
admin/new/pricing/templates/event_tickets_datetime_ticket_row.template.php 3 patches
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -168,7 +168,7 @@  discard block
 block discarded – undo
168 168
 
169 169
             <!--<div class="total-price-container"><?php printf(
170 170
                 esc_html__('Total Final Price: %s', 'event_espresso'),
171
-                '<span class="ticket-price-amount">' . $TKT_price . '</span>'
171
+                '<span class="ticket-price-amount">'.$TKT_price.'</span>'
172 172
             ); ?> </div>-->
173 173
             <textarea name="<?php echo esc_attr($edit_tickets_name); ?>[<?php echo esc_attr($tkt_row); ?>][TKT_description]"
174 174
                       class="edit-ticket-TKT_description ee-full-textarea-inp"
@@ -267,7 +267,7 @@  discard block
 block discarded – undo
267 267
                         ); ?></label>
268 268
                 </div>
269 269
                 <div class="ticket-is-taxable-container">
270
-                    <?php if (! empty($tax_rows)) { ?>
270
+                    <?php if ( ! empty($tax_rows)) { ?>
271 271
                         <?php if ($disabled) : ?>
272 272
                             <?php
273 273
                             $tax_value = ! empty($TKT_taxable) ? 1 : 0;
Please login to merge, or discard this patch.
Braces   +40 added lines, -16 removed lines patch added patch discarded remove patch
@@ -79,8 +79,11 @@  discard block
 block discarded – undo
79 79
                    class="edit-ticket-TKT_start_date ee-text-inp" value="<?php echo esc_attr($TKT_start_date); ?>">
80 80
             <input type="text" name="archived_ticket[TKT_start_date]" class="edit-ticket-TKT_start_date ee-text-inp"
81 81
                    value="<?php echo esc_attr($TKT_start_date); ?>" disabled>
82
-        <?php else : ?>
83
-            <input id="edit-ticket-TKT_start_date-<?php echo esc_attr($tkt_row); ?>" type="text"
82
+        <?php else {
83
+	: ?>
84
+            <input id="edit-ticket-TKT_start_date-<?php echo esc_attr($tkt_row);
85
+}
86
+?>" type="text"
84 87
                    name="<?php echo esc_attr($edit_tickets_name); ?>[<?php echo esc_attr($tkt_row); ?>][TKT_start_date]"
85 88
                    class="edit-ticket-TKT_start_date ee-text-inp ee-datepicker" value="<?php echo esc_attr($TKT_start_date); ?>"
86 89
                    data-context="start-ticket" data-date-field-context="#display-ticketrow-<?php echo esc_attr($tkt_row); ?>"
@@ -94,8 +97,11 @@  discard block
 block discarded – undo
94 97
                    class="edit-ticket-TKT_end_date ee-text-inp" value="<?php echo esc_attr($TKT_end_date); ?>">
95 98
             <input type="text" name="archived_ticket[TKT_end_date]" class="edit-ticket-TKT_end_date ee-text-inp"
96 99
                    value="<?php echo esc_attr($TKT_end_date); ?>" disabled>
97
-        <?php else : ?>
98
-            <input id="edit-ticket-TKT_end_date-<?php echo esc_attr($tkt_row); ?>" type="text"
100
+        <?php else {
101
+	: ?>
102
+            <input id="edit-ticket-TKT_end_date-<?php echo esc_attr($tkt_row);
103
+}
104
+?>" type="text"
99 105
                    name="<?php echo esc_attr($edit_tickets_name); ?>[<?php echo esc_attr($tkt_row); ?>][TKT_end_date]"
100 106
                    class="edit-ticket-TKT_end_date ee-text-inp ee-datepicker" value="<?php echo esc_attr($TKT_end_date); ?>"
101 107
                    data-context="end-ticket" data-date-field-context="#display-ticketrow-<?php echo esc_attr($tkt_row); ?>"
@@ -111,8 +117,11 @@  discard block
 block discarded – undo
111 117
             <input type="text" name="archived_ticket[<?php echo esc_attr($tkt_row); ?>][TKT_base_price]"
112 118
                    class="edit-ticket-TKT_base_price ee-small-text-inp edit-price-PRC_amount ee-numeric"
113 119
                    value="<?php echo esc_attr($TKT_base_price); ?>" disabled>
114
-        <?php else : ?>
115
-            <input id="edit-ticket-TKT_base_price-<?php echo esc_attr($tkt_row); ?>" type="text"
120
+        <?php else {
121
+	: ?>
122
+            <input id="edit-ticket-TKT_base_price-<?php echo esc_attr($tkt_row);
123
+}
124
+?>" type="text"
116 125
                    name="<?php echo esc_attr($edit_tickets_name); ?>[<?php echo esc_attr($tkt_row); ?>][TKT_base_price]"
117 126
                    class="edit-ticket-TKT_base_price ee-small-text-inp edit-price-PRC_amount ee-numeric"
118 127
                    value="<?php echo esc_attr($TKT_base_price); ?>">
@@ -129,8 +138,11 @@  discard block
 block discarded – undo
129 138
             <input type="text" class="edit-ticket-TKT_qty ee-small-text-inp ee-numeric"
130 139
                    name="archived_ticket[<?php echo esc_attr($tkt_row); ?>][TKT_qty]" value="<?php echo esc_attr($TKT_qty_for_input); ?>"
131 140
                    disabled>
132
-        <?php else : ?>
133
-            <input type="text" id="edit-ticket-TKT_qty-<?php echo esc_attr($tkt_row); ?>"
141
+        <?php else {
142
+	: ?>
143
+            <input type="text" id="edit-ticket-TKT_qty-<?php echo esc_attr($tkt_row);
144
+}
145
+?>"
134 146
                    class="edit-ticket-TKT_qty ee-small-text-inp ee-numeric"
135 147
                    name="<?php echo esc_attr($edit_tickets_name); ?>[<?php echo esc_attr($tkt_row); ?>][TKT_qty]"
136 148
                    value="<?php echo esc_attr($TKT_qty_for_input); ?>">
@@ -209,9 +221,12 @@  discard block
 block discarded – undo
209 221
                                 <input type="text" class="edit-ticket-TKT_uses ee-small-text-inp ee-numeric"
210 222
                                        name="archived_ticket[<?php echo esc_attr($tkt_row); ?>][TKT_uses]"
211 223
                                        value="<?php echo esc_attr($TKT_uses); ?>" disabled>
212
-                            <?php else : ?>
224
+                            <?php else {
225
+	: ?>
213 226
                                 <input type="text" class="edit-ticket-TKT_uses ee-small-text-inp ee-numeric"
214
-                                       name="<?php echo esc_attr($edit_tickets_name); ?>[<?php echo esc_attr($tkt_row); ?>][TKT_uses]"
227
+                                       name="<?php echo esc_attr($edit_tickets_name);
228
+}
229
+?>[<?php echo esc_attr($tkt_row); ?>][TKT_uses]"
215 230
                                        value="<?php echo esc_attr($TKT_uses); ?>">
216 231
                             <?php endif; ?>
217 232
                         </td>
@@ -223,9 +238,12 @@  discard block
 block discarded – undo
223 238
                                 <input type="text" class="edit-ticket-TKT_min ee-small-text-inp ee-numeric"
224 239
                                        name="archived_ticket[<?php echo esc_attr($tkt_row); ?>][TKT_min]"
225 240
                                        value="<?php echo esc_attr($TKT_min); ?>" disabled>
226
-                            <?php else : ?>
241
+                            <?php else {
242
+	: ?>
227 243
                                 <input type="text" class="edit-ticket-TKT_min ee-small-text-inp ee-numeric"
228
-                                       name="<?php echo esc_attr($edit_tickets_name); ?>[<?php echo esc_attr($tkt_row); ?>][TKT_min]"
244
+                                       name="<?php echo esc_attr($edit_tickets_name);
245
+}
246
+?>[<?php echo esc_attr($tkt_row); ?>][TKT_min]"
229 247
                                        value="<?php echo esc_attr($TKT_min); ?>">
230 248
                             <?php endif; ?>
231 249
                         </td>
@@ -237,9 +255,12 @@  discard block
 block discarded – undo
237 255
                                 <input type="text" class="edit-ticket-TKT_max ee-small-text-inp ee-numeric"
238 256
                                        name="<?php echo esc_attr($edit_tickets_name); ?>[<?php echo esc_attr($tkt_row); ?>][TKT_max]"
239 257
                                        value="<?php echo esc_attr($TKT_max); ?>" disabled>
240
-                            <?php else : ?>
258
+                            <?php else {
259
+	: ?>
241 260
                                 <input type="text" class="edit-ticket-TKT_max ee-small-text-inp ee-numeric"
242
-                                       name="<?php echo esc_attr($edit_tickets_name); ?>[<?php echo esc_attr($tkt_row); ?>][TKT_max]"
261
+                                       name="<?php echo esc_attr($edit_tickets_name);
262
+}
263
+?>[<?php echo esc_attr($tkt_row); ?>][TKT_max]"
243 264
                                        value="<?php echo esc_attr($TKT_max); ?>">
244 265
                             <?php endif; ?>
245 266
                         </td>
@@ -278,8 +299,11 @@  discard block
 block discarded – undo
278 299
                         <input class="TKT-taxable-checkbox" id="edit-ticket-TKT_taxable-<?php echo esc_attr($tkt_row); ?>"
279 300
                                type="checkbox" name="archived_ticket[<?php echo esc_attr($tkt_row); ?>][TKT_taxable]"
280 301
                                value="1"<?php echo $TKT_taxable; ?> disabled>
281
-                        <?php else : ?>
282
-                        <input class="TKT-taxable-checkbox" id="edit-ticket-TKT_taxable-<?php echo esc_attr($tkt_row); ?>"
302
+                        <?php else {
303
+	: ?>
304
+                        <input class="TKT-taxable-checkbox" id="edit-ticket-TKT_taxable-<?php echo esc_attr($tkt_row);
305
+}
306
+?>"
283 307
                                type="checkbox"
284 308
                                name="<?php echo esc_attr($edit_tickets_name); ?>[<?php echo esc_attr($tkt_row); ?>][TKT_taxable]"
285 309
                                value="1"<?php echo $TKT_taxable; ?>>
Please login to merge, or discard this patch.
Indentation   +59 added lines, -59 removed lines patch added patch discarded remove patch
@@ -57,7 +57,7 @@  discard block
 block discarded – undo
57 57
 ?>
58 58
 <tr valign="top" class="ee-ticket-sortable ticket-row <?php echo sanitize_html_class($ticket_archive_class);
59 59
 if (WP_DEBUG) {
60
-    echo ' ee-wp-debug';
60
+	echo ' ee-wp-debug';
61 61
 } ?>" id="display-ticketrow-<?php echo esc_attr($tkt_row); ?>">
62 62
     <!--<td class="ee-tkt-order-field"><span class="dashicons dashicons-sort <?php echo sanitize_html_class($tkt_status_class); ?>">
63 63
     <input type="hidden" name="<?php echo esc_attr($edit_tickets_name); ?>[<?php echo esc_attr($tkt_row); ?>][TKT_order]" class="edit-ticket-TKT_order" value ="<?php echo absint($TKT_order); ?>" ></span></td>-->
@@ -166,9 +166,9 @@  discard block
 block discarded – undo
166 166
                    class="edit-ticket-TKT_row" value="<?php echo esc_attr($tkt_row); ?>">
167 167
 
168 168
             <!--<div class="total-price-container"><?php printf(
169
-                esc_html__('Total Final Price: %s', 'event_espresso'),
170
-                '<span class="ticket-price-amount">' . $TKT_price . '</span>'
171
-            ); ?> </div>-->
169
+				esc_html__('Total Final Price: %s', 'event_espresso'),
170
+				'<span class="ticket-price-amount">' . $TKT_price . '</span>'
171
+			); ?> </div>-->
172 172
             <textarea name="<?php echo esc_attr($edit_tickets_name); ?>[<?php echo esc_attr($tkt_row); ?>][TKT_description]"
173 173
                       class="edit-ticket-TKT_description ee-full-textarea-inp"
174 174
                       placeholder="Ticket Description"><?php echo esc_textarea($TKT_description); ?></textarea>
@@ -182,20 +182,20 @@  discard block
 block discarded – undo
182 182
                     <thead>
183 183
                     <tr valign="bottom">
184 184
                         <td><span class="TD_TKT_number_datetimes_label"><?php
185
-                                esc_html_e(
186
-                                    '# Datetimes',
187
-                                    'event_espresso'
188
-                                ); ?></span></td>
185
+								esc_html_e(
186
+									'# Datetimes',
187
+									'event_espresso'
188
+								); ?></span></td>
189 189
                         <td><span class="TD_TKT_min_qty_label"><?php
190
-                                esc_html_e(
191
-                                    'Minimum Quantity',
192
-                                    'event_espresso'
193
-                                ); ?></span></td>
190
+								esc_html_e(
191
+									'Minimum Quantity',
192
+									'event_espresso'
193
+								); ?></span></td>
194 194
                         <td><span class="TD_TKT_max_qty_label"><?php
195
-                                esc_html_e(
196
-                                    'Maximum Quantity',
197
-                                    'event_espresso'
198
-                                ); ?></span></td>
195
+								esc_html_e(
196
+									'Maximum Quantity',
197
+									'event_espresso'
198
+								); ?></span></td>
199 199
                     </tr>
200 200
                     </thead>
201 201
                     <tbody>
@@ -256,24 +256,24 @@  discard block
 block discarded – undo
256 256
                     <input type="checkbox"
257 257
                            name="<?php echo esc_attr($edit_tickets_name); ?>[<?php echo esc_attr($tkt_row); ?>][TKT_required]"
258 258
                            class="edit-ticket-TKT_required" value="1"<?php
259
-                            echo $TKT_required
260
-                                ? ' checked="checked"'
261
-                                : '';
262
-                            echo $disabled
263
-                                ? ' disabled'
264
-                                : ''; ?>>
259
+							echo $TKT_required
260
+								? ' checked="checked"'
261
+								: '';
262
+							echo $disabled
263
+								? ' disabled'
264
+								: ''; ?>>
265 265
                     <label for="edit-ticket-TKT_required"><?php
266
-                        esc_html_e(
267
-                            'This ticket is required (will appear first in frontend ticket lists).',
268
-                            'event_espresso'
269
-                        ); ?></label>
266
+						esc_html_e(
267
+							'This ticket is required (will appear first in frontend ticket lists).',
268
+							'event_espresso'
269
+						); ?></label>
270 270
                 </div>
271 271
                 <div class="ticket-is-taxable-container">
272 272
                     <?php if (! empty($tax_rows)) { ?>
273 273
                         <?php if ($disabled) : ?>
274 274
                             <?php
275
-                            $tax_value = ! empty($TKT_taxable) ? 1 : 0;
276
-                            ?>
275
+							$tax_value = ! empty($TKT_taxable) ? 1 : 0;
276
+							?>
277 277
                         <input class="TKT-taxable-checkbox" type="hidden"
278 278
                                name="<?php echo esc_attr($edit_tickets_name); ?>[<?php echo esc_attr($tkt_row); ?>][TKT_taxable]"
279 279
                                value="<?php echo esc_attr($tax_value); ?>">
@@ -287,16 +287,16 @@  discard block
 block discarded – undo
287 287
                                value="1"<?php echo $TKT_taxable; ?>>
288 288
                         <?php endif; ?>
289 289
                     <label for="edit-ticket-TKT_taxable-<?php echo esc_attr($tkt_row); ?>"> <?php
290
-                        esc_html_e('This ticket is taxable.', 'event_espresso'); ?>
290
+						esc_html_e('This ticket is taxable.', 'event_espresso'); ?>
291 291
                     <?php } //end tax_rows check ?>
292 292
                 </div>
293 293
             </div>
294 294
             <div class="price-table-container">
295 295
                 <h4 class="tickets-heading price-table-info"<?php echo $show_price_modifier; ?>><?php
296
-                    esc_html_e(
297
-                        'Price Modifiers',
298
-                        'event_espresso'
299
-                    ); ?></h4>
296
+					esc_html_e(
297
+						'Price Modifiers',
298
+						'event_espresso'
299
+					); ?></h4>
300 300
                 <table class="price-table">
301 301
                     <thead class="price-table-info"<?php echo $show_price_modifier; ?>>
302 302
                     <tr>
@@ -316,10 +316,10 @@  discard block
 block discarded – undo
316 316
                     <tr class="price-subtotal-row TKT-taxes-display"<?php echo $display_subtotal; ?>>
317 317
                         <td colspan="4" class="ee-numeric">
318 318
                             <span class="TKT-taxable-subtotal-label"><strong><?php
319
-                                    esc_html_e(
320
-                                        'Subtotal',
321
-                                        'event_espresso'
322
-                                    ); ?></strong></span>
319
+									esc_html_e(
320
+										'Subtotal',
321
+										'event_espresso'
322
+									); ?></strong></span>
323 323
                         </td>
324 324
                         <td class="ee-numeric">
325 325
                             <span
@@ -352,41 +352,41 @@  discard block
 block discarded – undo
352 352
             <div style="clear:both"></div>
353 353
             <h4 class="tickets-heading"><?php esc_html_e('Event Datetimes', 'event_espresso'); ?></h4>
354 354
             <p><?php
355
-                esc_html_e(
356
-                    'This ticket will be usable (allow entrance) for the following selected event datetimes (click to select).  The "# Datetimes" amount (above) indicates how many of the assigned datetimes the ticket holder can gain access to:',
357
-                    'event_espresso'
358
-                ); ?></p>
355
+				esc_html_e(
356
+					'This ticket will be usable (allow entrance) for the following selected event datetimes (click to select).  The "# Datetimes" amount (above) indicates how many of the assigned datetimes the ticket holder can gain access to:',
357
+					'event_espresso'
358
+				); ?></p>
359 359
             <ul class="datetime-tickets-list">
360 360
                 <?php echo $ticket_datetimes_list; ?>
361 361
             </ul>
362 362
 
363 363
             <?php do_action(
364
-                'AHEE__event_tickets_datetime_ticket_row_template__advanced_details_end',
365
-                $tkt_row,
366
-                $TKT_ID
367
-            ); ?>
364
+				'AHEE__event_tickets_datetime_ticket_row_template__advanced_details_end',
365
+				$tkt_row,
366
+				$TKT_ID
367
+			); ?>
368 368
             <div class="ee-editor-footer-container">
369 369
                 <div class="ee-editor-id-container">
370 370
                     <span class="ee-item-id"><?php echo
371
-                        $TKT_ID
372
-                            ? sprintf(
373
-                                esc_html__('Ticket ID: %d', 'event_espresso'),
374
-                                $TKT_ID
375
-                            )
376
-                                             : ''; ?></span>
371
+						$TKT_ID
372
+							? sprintf(
373
+								esc_html__('Ticket ID: %d', 'event_espresso'),
374
+								$TKT_ID
375
+							)
376
+											 : ''; ?></span>
377 377
                 </div>
378 378
                 <div class="save-cancel-button-container">
379 379
                     <label for="edit-ticket-TKT_is_default_selector"><?php
380
-                        esc_html_e(
381
-                            'use this new ticket as a default ticket for any new events',
382
-                            'event_espresso'
383
-                        ); ?></label>
380
+						esc_html_e(
381
+							'use this new ticket as a default ticket for any new events',
382
+							'event_espresso'
383
+						); ?></label>
384 384
                     <input type="checkbox"
385 385
                            name="<?php echo esc_attr($edit_tickets_name); ?>[<?php echo esc_attr($tkt_row); ?>][TKT_is_default_selector]"
386 386
                            class="edit-ticket-TKT_is_default_selector" value="1"<?php
387
-                            echo $disabled
388
-                                ? ' disabled'
389
-                                : ''; ?>>
387
+							echo $disabled
388
+								? ' disabled'
389
+								: ''; ?>>
390 390
                     <input type="hidden"
391 391
                            name="<?php echo esc_attr($edit_tickets_name); ?>[<?php echo esc_attr($tkt_row); ?>][TKT_is_default]"
392 392
                            class="edit-ticket-TKT_is_default"
@@ -395,7 +395,7 @@  discard block
 block discarded – undo
395 395
                     <button class="button button--secondary ee-cancel-button"
396 396
                             data-context="ticket"
397 397
                             data-ticket-row="<?php echo esc_attr($tkt_row); ?>"><?php
398
-                                    esc_html_e('Close', 'event_espresso'); ?></button>
398
+									esc_html_e('Close', 'event_espresso'); ?></button>
399 399
                 </div>
400 400
             </div>
401 401
             <!-- these hidden inputs are for tracking changes in dtts attached to tickets during a js session -->
Please login to merge, or discard this patch.
core/services/request/sanitizers/AllowedTags.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -129,7 +129,7 @@
 block discarded – undo
129 129
         $allowed_post_tags = wp_kses_allowed_html('post');
130 130
         $allowed_tags = [];
131 131
         foreach (AllowedTags::$tags as $tag) {
132
-            $allowed_tags[ $tag ] = AllowedTags::$attributes;
132
+            $allowed_tags[$tag] = AllowedTags::$attributes;
133 133
         }
134 134
         AllowedTags::$allowed_tags = array_merge_recursive($allowed_post_tags, $allowed_tags);
135 135
     }
Please login to merge, or discard this patch.
Indentation   +221 added lines, -221 removed lines patch added patch discarded remove patch
@@ -12,225 +12,225 @@
 block discarded – undo
12 12
  */
13 13
 class AllowedTags
14 14
 {
15
-    /**
16
-     * @var array[]
17
-     */
18
-    private static $attributes = [
19
-        'accept-charset'    => 1,
20
-        'action'            => 1,
21
-        'alt'               => 1,
22
-        'allow'             => 1,
23
-        'allowfullscreen'   => 1,
24
-        'align'             => 1,
25
-        'aria-*'            => 1,
26
-        'autocomplete'      => 1,
27
-        'checked'           => 1,
28
-        'class'             => 1,
29
-        'cols'              => 1,
30
-        'content'           => 1,
31
-        'data-*'            => 1,
32
-        'dir'               => 1,
33
-        'disabled'          => 1,
34
-        'enctype'           => 1,
35
-        'for'               => 1,
36
-        'frameborder'       => 1,
37
-        'height'            => 1,
38
-        'href'              => 1,
39
-        'id'                => 1,
40
-        'itemprop'          => 1,
41
-        'itemscope'         => 1,
42
-        'itemtype'          => 1,
43
-        'label'             => 1,
44
-        'lang'              => 1,
45
-        'max'               => 1,
46
-        'method'            => 1,
47
-        'min'               => 1,
48
-        'multiple'          => 1,
49
-        'name'              => 1,
50
-        'novalidate'        => 1,
51
-        'placeholder'       => 1,
52
-        'readonly'          => 1,
53
-        'rel'               => 1,
54
-        'required'          => 1,
55
-        'rows'              => 1,
56
-        'selected'          => 1,
57
-        'src'               => 1,
58
-        'style'             => 1,
59
-        'step'              => 1,
60
-        'tabindex'          => 1,
61
-        'target'            => 1,
62
-        'title'             => 1,
63
-        'type'              => 1,
64
-        'value'             => 1,
65
-        'width'             => 1,
66
-    ];
67
-
68
-
69
-    /**
70
-     * @var array
71
-     */
72
-    private static $tags = [
73
-        'a',
74
-        'abbr',
75
-        'b',
76
-        'br',
77
-        'code',
78
-        'div',
79
-        'em',
80
-        'h1',
81
-        'h2',
82
-        'h3',
83
-        'h4',
84
-        'h5',
85
-        'h6',
86
-        'hr',
87
-        'i',
88
-        'img',
89
-        'li',
90
-        'ol',
91
-        'p',
92
-        'pre',
93
-        'small',
94
-        'span',
95
-        'strong',
96
-        'table',
97
-        'td',
98
-        'tr',
99
-        'ul',
100
-    ];
101
-
102
-
103
-    /**
104
-     * @var array
105
-     */
106
-    private static $allowed_tags;
107
-
108
-
109
-    /**
110
-     * @var array
111
-     */
112
-    private static $allowed_with_embed_tags;
113
-
114
-
115
-    /**
116
-     * @var array
117
-     */
118
-    private static $allowed_with_form_tags;
119
-
120
-
121
-    /**
122
-     * @var array
123
-     */
124
-    private static $allowed_with_script_and_style_tags;
125
-
126
-
127
-    /**
128
-     * merges additional tags and attributes into the WP post tags
129
-     */
130
-    private static function initializeAllowedTags()
131
-    {
132
-        $allowed_post_tags = wp_kses_allowed_html('post');
133
-        $allowed_tags = [];
134
-        foreach (AllowedTags::$tags as $tag) {
135
-            $allowed_tags[ $tag ] = AllowedTags::$attributes;
136
-        }
137
-        AllowedTags::$allowed_tags = array_merge_recursive($allowed_post_tags, $allowed_tags);
138
-    }
139
-
140
-
141
-    /**
142
-     * merges embed tags and attributes into the EE all tags
143
-     */
144
-    private static function initializeWithEmbedTags()
145
-    {
146
-        $all_tags = AllowedTags::getAllowedTags();
147
-        $embed_tags = [
148
-            'iframe' => AllowedTags::$attributes
149
-        ];
150
-        AllowedTags::$allowed_with_embed_tags = array_merge_recursive($all_tags, $embed_tags);
151
-    }
152
-
153
-
154
-    /**
155
-     * merges form tags and attributes into the EE all tags
156
-     */
157
-    private static function initializeWithFormTags()
158
-    {
159
-        $all_tags = AllowedTags::getAllowedTags();
160
-        $form_tags = [
161
-            'form' => AllowedTags::$attributes,
162
-            'label' => AllowedTags::$attributes,
163
-            'input' => AllowedTags::$attributes,
164
-            'select' => AllowedTags::$attributes,
165
-            'option' => AllowedTags::$attributes,
166
-            'optgroup' => AllowedTags::$attributes,
167
-            'textarea' => AllowedTags::$attributes,
168
-            'button' => AllowedTags::$attributes,
169
-            'fieldset' => AllowedTags::$attributes,
170
-            'output' => AllowedTags::$attributes,
171
-        ];
172
-        AllowedTags::$allowed_with_form_tags = array_merge_recursive($all_tags, $form_tags);
173
-    }
174
-
175
-
176
-    /**
177
-     * merges form script and style tags and attributes into the EE all tags
178
-     */
179
-    private static function initializeWithScriptAndStyleTags()
180
-    {
181
-        $all_tags = AllowedTags::getAllowedTags();
182
-        $script_and_style_tags = [
183
-            'script' => AllowedTags::$attributes,
184
-            'style' => AllowedTags::$attributes,
185
-        ];
186
-        AllowedTags::$allowed_with_script_and_style_tags = array_merge_recursive($all_tags, $script_and_style_tags);
187
-    }
188
-
189
-
190
-    /**
191
-     * @return array[]
192
-     */
193
-    public static function getAllowedTags()
194
-    {
195
-        if (empty(AllowedTags::$allowed_tags)) {
196
-            AllowedTags::initializeAllowedTags();
197
-        }
198
-        return AllowedTags::$allowed_tags;
199
-    }
200
-
201
-
202
-    /**
203
-     * @return array[]
204
-     */
205
-    public static function getWithEmbedTags()
206
-    {
207
-        if (empty(AllowedTags::$allowed_with_embed_tags)) {
208
-            AllowedTags::initializeWithEmbedTags();
209
-        }
210
-        return AllowedTags::$allowed_with_embed_tags;
211
-    }
212
-
213
-
214
-    /**
215
-     * @return array[]
216
-     */
217
-    public static function getWithFormTags()
218
-    {
219
-        if (empty(AllowedTags::$allowed_with_form_tags)) {
220
-            AllowedTags::initializeWithFormTags();
221
-        }
222
-        return AllowedTags::$allowed_with_form_tags;
223
-    }
224
-
225
-
226
-    /**
227
-     * @return array[]
228
-     */
229
-    public static function getWithScriptAndStyleTags()
230
-    {
231
-        if (empty(AllowedTags::$allowed_with_script_and_style_tags)) {
232
-            AllowedTags::initializeWithScriptAndStyleTags();
233
-        }
234
-        return AllowedTags::$allowed_with_script_and_style_tags;
235
-    }
15
+	/**
16
+	 * @var array[]
17
+	 */
18
+	private static $attributes = [
19
+		'accept-charset'    => 1,
20
+		'action'            => 1,
21
+		'alt'               => 1,
22
+		'allow'             => 1,
23
+		'allowfullscreen'   => 1,
24
+		'align'             => 1,
25
+		'aria-*'            => 1,
26
+		'autocomplete'      => 1,
27
+		'checked'           => 1,
28
+		'class'             => 1,
29
+		'cols'              => 1,
30
+		'content'           => 1,
31
+		'data-*'            => 1,
32
+		'dir'               => 1,
33
+		'disabled'          => 1,
34
+		'enctype'           => 1,
35
+		'for'               => 1,
36
+		'frameborder'       => 1,
37
+		'height'            => 1,
38
+		'href'              => 1,
39
+		'id'                => 1,
40
+		'itemprop'          => 1,
41
+		'itemscope'         => 1,
42
+		'itemtype'          => 1,
43
+		'label'             => 1,
44
+		'lang'              => 1,
45
+		'max'               => 1,
46
+		'method'            => 1,
47
+		'min'               => 1,
48
+		'multiple'          => 1,
49
+		'name'              => 1,
50
+		'novalidate'        => 1,
51
+		'placeholder'       => 1,
52
+		'readonly'          => 1,
53
+		'rel'               => 1,
54
+		'required'          => 1,
55
+		'rows'              => 1,
56
+		'selected'          => 1,
57
+		'src'               => 1,
58
+		'style'             => 1,
59
+		'step'              => 1,
60
+		'tabindex'          => 1,
61
+		'target'            => 1,
62
+		'title'             => 1,
63
+		'type'              => 1,
64
+		'value'             => 1,
65
+		'width'             => 1,
66
+	];
67
+
68
+
69
+	/**
70
+	 * @var array
71
+	 */
72
+	private static $tags = [
73
+		'a',
74
+		'abbr',
75
+		'b',
76
+		'br',
77
+		'code',
78
+		'div',
79
+		'em',
80
+		'h1',
81
+		'h2',
82
+		'h3',
83
+		'h4',
84
+		'h5',
85
+		'h6',
86
+		'hr',
87
+		'i',
88
+		'img',
89
+		'li',
90
+		'ol',
91
+		'p',
92
+		'pre',
93
+		'small',
94
+		'span',
95
+		'strong',
96
+		'table',
97
+		'td',
98
+		'tr',
99
+		'ul',
100
+	];
101
+
102
+
103
+	/**
104
+	 * @var array
105
+	 */
106
+	private static $allowed_tags;
107
+
108
+
109
+	/**
110
+	 * @var array
111
+	 */
112
+	private static $allowed_with_embed_tags;
113
+
114
+
115
+	/**
116
+	 * @var array
117
+	 */
118
+	private static $allowed_with_form_tags;
119
+
120
+
121
+	/**
122
+	 * @var array
123
+	 */
124
+	private static $allowed_with_script_and_style_tags;
125
+
126
+
127
+	/**
128
+	 * merges additional tags and attributes into the WP post tags
129
+	 */
130
+	private static function initializeAllowedTags()
131
+	{
132
+		$allowed_post_tags = wp_kses_allowed_html('post');
133
+		$allowed_tags = [];
134
+		foreach (AllowedTags::$tags as $tag) {
135
+			$allowed_tags[ $tag ] = AllowedTags::$attributes;
136
+		}
137
+		AllowedTags::$allowed_tags = array_merge_recursive($allowed_post_tags, $allowed_tags);
138
+	}
139
+
140
+
141
+	/**
142
+	 * merges embed tags and attributes into the EE all tags
143
+	 */
144
+	private static function initializeWithEmbedTags()
145
+	{
146
+		$all_tags = AllowedTags::getAllowedTags();
147
+		$embed_tags = [
148
+			'iframe' => AllowedTags::$attributes
149
+		];
150
+		AllowedTags::$allowed_with_embed_tags = array_merge_recursive($all_tags, $embed_tags);
151
+	}
152
+
153
+
154
+	/**
155
+	 * merges form tags and attributes into the EE all tags
156
+	 */
157
+	private static function initializeWithFormTags()
158
+	{
159
+		$all_tags = AllowedTags::getAllowedTags();
160
+		$form_tags = [
161
+			'form' => AllowedTags::$attributes,
162
+			'label' => AllowedTags::$attributes,
163
+			'input' => AllowedTags::$attributes,
164
+			'select' => AllowedTags::$attributes,
165
+			'option' => AllowedTags::$attributes,
166
+			'optgroup' => AllowedTags::$attributes,
167
+			'textarea' => AllowedTags::$attributes,
168
+			'button' => AllowedTags::$attributes,
169
+			'fieldset' => AllowedTags::$attributes,
170
+			'output' => AllowedTags::$attributes,
171
+		];
172
+		AllowedTags::$allowed_with_form_tags = array_merge_recursive($all_tags, $form_tags);
173
+	}
174
+
175
+
176
+	/**
177
+	 * merges form script and style tags and attributes into the EE all tags
178
+	 */
179
+	private static function initializeWithScriptAndStyleTags()
180
+	{
181
+		$all_tags = AllowedTags::getAllowedTags();
182
+		$script_and_style_tags = [
183
+			'script' => AllowedTags::$attributes,
184
+			'style' => AllowedTags::$attributes,
185
+		];
186
+		AllowedTags::$allowed_with_script_and_style_tags = array_merge_recursive($all_tags, $script_and_style_tags);
187
+	}
188
+
189
+
190
+	/**
191
+	 * @return array[]
192
+	 */
193
+	public static function getAllowedTags()
194
+	{
195
+		if (empty(AllowedTags::$allowed_tags)) {
196
+			AllowedTags::initializeAllowedTags();
197
+		}
198
+		return AllowedTags::$allowed_tags;
199
+	}
200
+
201
+
202
+	/**
203
+	 * @return array[]
204
+	 */
205
+	public static function getWithEmbedTags()
206
+	{
207
+		if (empty(AllowedTags::$allowed_with_embed_tags)) {
208
+			AllowedTags::initializeWithEmbedTags();
209
+		}
210
+		return AllowedTags::$allowed_with_embed_tags;
211
+	}
212
+
213
+
214
+	/**
215
+	 * @return array[]
216
+	 */
217
+	public static function getWithFormTags()
218
+	{
219
+		if (empty(AllowedTags::$allowed_with_form_tags)) {
220
+			AllowedTags::initializeWithFormTags();
221
+		}
222
+		return AllowedTags::$allowed_with_form_tags;
223
+	}
224
+
225
+
226
+	/**
227
+	 * @return array[]
228
+	 */
229
+	public static function getWithScriptAndStyleTags()
230
+	{
231
+		if (empty(AllowedTags::$allowed_with_script_and_style_tags)) {
232
+			AllowedTags::initializeWithScriptAndStyleTags();
233
+		}
234
+		return AllowedTags::$allowed_with_script_and_style_tags;
235
+	}
236 236
 }
Please login to merge, or discard this patch.
new/pricing/templates/event_tickets_datetime_dtt_tickets_list.template.php 1 patch
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -14,7 +14,7 @@
 block discarded – undo
14 14
 
15 15
 <li data-datetime-row="<?php echo absint($dtt_row); ?>" data-context="datetime-ticket" data-ticket-row="<?php echo esc_attr($tkt_row); ?>"
16 16
     class="datetime-ticket clickable<?php echo $ticket_selected;
17
-    echo $tkt_status_class; ?>">
17
+	echo $tkt_status_class; ?>">
18 18
     <input type="checkbox" name="datetime_ticket[<?php echo absint($dtt_row); ?>][<?php echo esc_attr($tkt_row); ?>]"
19 19
            class="datetime-ticket-checkbox" value="1"<?php echo $datetime_ticket_checked; ?>>
20 20
     <span class="ee-icon ee-icon-tickets ticket-list-ticket-name"><?php echo $TKT_name; ?></span>
Please login to merge, or discard this patch.
form_sections/payment_methods/EE_Billing_Attendee_Info_Form.form.php 1 patch
Indentation   +188 added lines, -188 removed lines patch added patch discarded remove patch
@@ -13,204 +13,204 @@
 block discarded – undo
13 13
  */
14 14
 class EE_Billing_Attendee_Info_Form extends EE_Billing_Info_Form
15 15
 {
16
-    /**
17
-     *
18
-     * @param EE_Payment_Method $payment_method
19
-     * @param array             $options_array @see EE_Form_Section_Proper::__construct()
20
-     * @throws EE_Error
21
-     * @throws ReflectionException
22
-     */
23
-    public function __construct(EE_Payment_Method $payment_method, $options_array = [])
24
-    {
25
-        $options_array['subsections'] = array_merge(
26
-            [
27
-                'first_name' => new EE_Text_Input([
28
-                        'required'        => true,
29
-                        'html_class'      => 'ee-billing-qstn ee-billing-qstn-fname',
30
-                        'html_label_text' => esc_html__('First Name', 'event_espresso'),
31
-                    ]),
32
-                'last_name'  => new EE_Text_Input([
33
-                        'required'        => true,
34
-                        'html_class'      => 'ee-billing-qstn ee-billing-qstn-lname',
35
-                        'html_label_text' => esc_html__('Last Name', 'event_espresso'),
36
-                    ]),
37
-                'email'      => new EE_Email_Input([
38
-                        'required'        => true,
39
-                        'html_class'      => 'ee-billing-qstn ee-billing-qstn-email',
40
-                        'html_label_text' => esc_html__('Email', 'event_espresso'),
41
-                    ]),
42
-                'address'    => new EE_Text_Input([
43
-                        'html_label_text' => esc_html__('Address', 'event_espresso'),
44
-                        'required'        => true,
45
-                        'html_class'      => 'ee-billing-qstn ee-billing-qstn-address',
46
-                    ]),
47
-                'address2'   => new EE_Text_Input([
48
-                        'html_label_text' => esc_html__('Address 2', 'event_espresso'),
49
-                        'html_class'      => 'ee-billing-qstn ee-billing-qstn-address2',
50
-                    ]),
51
-                'city'       => new EE_Text_Input([
52
-                        'required'        => true,
53
-                        'html_class'      => 'ee-billing-qstn ee-billing-qstn-city',
54
-                        'html_label_text' => esc_html__('City', 'event_espresso'),
55
-                    ]),
56
-                'state'      => apply_filters(
57
-                    'FHEE__EE_Billing_Attendee_Info_Form__state_field',
58
-                    new EE_State_Select_Input(null, [
59
-                            'required'        => true,
60
-                            'html_class'      => 'ee-billing-qstn ee-billing-qstn-state',
61
-                            'html_label_text' => esc_html__('State', 'event_espresso'),
62
-                        ])
63
-                ),
64
-                'country'    => apply_filters(
65
-                    'FHEE__EE_Billing_Attendee_Info_Form__country_field',
66
-                    new EE_Country_Select_Input(null, [
67
-                            'required'        => true,
68
-                            'html_class'      => 'ee-billing-qstn ee-billing-qstn-country',
69
-                            'html_label_text' => esc_html__('Country', 'event_espresso'),
70
-                        ])
71
-                ),
72
-                'zip'        => new EE_Text_Input([
73
-                        'required'        => true,
74
-                        'html_class'      => 'ee-billing-qstn ee-billing-qstn-zip',
75
-                        'html_label_text' => esc_html__('Zip', 'event_espresso'),
76
-                    ]),
77
-                'phone'      => new EE_Text_Input([
78
-                        'html_class'      => 'ee-billing-qstn ee-billing-qstn-phone',
79
-                        'html_label_text' => esc_html__('Phone', 'event_espresso'),
80
-                    ]),
81
-            ],
82
-            $options_array['subsections'] ?? []
83
-        );
16
+	/**
17
+	 *
18
+	 * @param EE_Payment_Method $payment_method
19
+	 * @param array             $options_array @see EE_Form_Section_Proper::__construct()
20
+	 * @throws EE_Error
21
+	 * @throws ReflectionException
22
+	 */
23
+	public function __construct(EE_Payment_Method $payment_method, $options_array = [])
24
+	{
25
+		$options_array['subsections'] = array_merge(
26
+			[
27
+				'first_name' => new EE_Text_Input([
28
+						'required'        => true,
29
+						'html_class'      => 'ee-billing-qstn ee-billing-qstn-fname',
30
+						'html_label_text' => esc_html__('First Name', 'event_espresso'),
31
+					]),
32
+				'last_name'  => new EE_Text_Input([
33
+						'required'        => true,
34
+						'html_class'      => 'ee-billing-qstn ee-billing-qstn-lname',
35
+						'html_label_text' => esc_html__('Last Name', 'event_espresso'),
36
+					]),
37
+				'email'      => new EE_Email_Input([
38
+						'required'        => true,
39
+						'html_class'      => 'ee-billing-qstn ee-billing-qstn-email',
40
+						'html_label_text' => esc_html__('Email', 'event_espresso'),
41
+					]),
42
+				'address'    => new EE_Text_Input([
43
+						'html_label_text' => esc_html__('Address', 'event_espresso'),
44
+						'required'        => true,
45
+						'html_class'      => 'ee-billing-qstn ee-billing-qstn-address',
46
+					]),
47
+				'address2'   => new EE_Text_Input([
48
+						'html_label_text' => esc_html__('Address 2', 'event_espresso'),
49
+						'html_class'      => 'ee-billing-qstn ee-billing-qstn-address2',
50
+					]),
51
+				'city'       => new EE_Text_Input([
52
+						'required'        => true,
53
+						'html_class'      => 'ee-billing-qstn ee-billing-qstn-city',
54
+						'html_label_text' => esc_html__('City', 'event_espresso'),
55
+					]),
56
+				'state'      => apply_filters(
57
+					'FHEE__EE_Billing_Attendee_Info_Form__state_field',
58
+					new EE_State_Select_Input(null, [
59
+							'required'        => true,
60
+							'html_class'      => 'ee-billing-qstn ee-billing-qstn-state',
61
+							'html_label_text' => esc_html__('State', 'event_espresso'),
62
+						])
63
+				),
64
+				'country'    => apply_filters(
65
+					'FHEE__EE_Billing_Attendee_Info_Form__country_field',
66
+					new EE_Country_Select_Input(null, [
67
+							'required'        => true,
68
+							'html_class'      => 'ee-billing-qstn ee-billing-qstn-country',
69
+							'html_label_text' => esc_html__('Country', 'event_espresso'),
70
+						])
71
+				),
72
+				'zip'        => new EE_Text_Input([
73
+						'required'        => true,
74
+						'html_class'      => 'ee-billing-qstn ee-billing-qstn-zip',
75
+						'html_label_text' => esc_html__('Zip', 'event_espresso'),
76
+					]),
77
+				'phone'      => new EE_Text_Input([
78
+						'html_class'      => 'ee-billing-qstn ee-billing-qstn-phone',
79
+						'html_label_text' => esc_html__('Phone', 'event_espresso'),
80
+					]),
81
+			],
82
+			$options_array['subsections'] ?? []
83
+		);
84 84
 
85
-        parent::__construct($payment_method, $options_array);
86
-    }
85
+		parent::__construct($payment_method, $options_array);
86
+	}
87 87
 
88 88
 
89
-    /**
90
-     * Sets the defaults for the billing form according to the attendee's details
91
-     *
92
-     * @param EE_Attendee $attendee
93
-     * @throws EE_Error
94
-     * @throws ReflectionException
95
-     */
96
-    public function populate_from_attendee(EE_Attendee $attendee)
97
-    {
98
-        /** @var $attendee EE_Attendee */
99
-        $attendee = EEM_Attendee::instance()->ensure_is_obj($attendee);
100
-        $this->populate_defaults(
101
-            apply_filters(
102
-                'FHEE__EE_Billing_Attendee_Info_Form__populate_from_attendee',
103
-                [
104
-                    'first_name' => $attendee->fname(),
105
-                    'last_name'  => $attendee->lname(),
106
-                    'email'      => $attendee->email(),
107
-                    'address'    => $attendee->address(),
108
-                    'address2'   => $attendee->address2(),
109
-                    'city'       => $attendee->city(),
110
-                    'state'      => $this->getAttendeeStateValueForForm($attendee),
111
-                    'country'    => $attendee->country_ID(),
112
-                    'zip'        => $attendee->zip(),
113
-                    'phone'      => $attendee->phone(),
114
-                ],
115
-                $attendee,
116
-                $this
117
-            )
118
-        );
119
-    }
89
+	/**
90
+	 * Sets the defaults for the billing form according to the attendee's details
91
+	 *
92
+	 * @param EE_Attendee $attendee
93
+	 * @throws EE_Error
94
+	 * @throws ReflectionException
95
+	 */
96
+	public function populate_from_attendee(EE_Attendee $attendee)
97
+	{
98
+		/** @var $attendee EE_Attendee */
99
+		$attendee = EEM_Attendee::instance()->ensure_is_obj($attendee);
100
+		$this->populate_defaults(
101
+			apply_filters(
102
+				'FHEE__EE_Billing_Attendee_Info_Form__populate_from_attendee',
103
+				[
104
+					'first_name' => $attendee->fname(),
105
+					'last_name'  => $attendee->lname(),
106
+					'email'      => $attendee->email(),
107
+					'address'    => $attendee->address(),
108
+					'address2'   => $attendee->address2(),
109
+					'city'       => $attendee->city(),
110
+					'state'      => $this->getAttendeeStateValueForForm($attendee),
111
+					'country'    => $attendee->country_ID(),
112
+					'zip'        => $attendee->zip(),
113
+					'phone'      => $attendee->phone(),
114
+				],
115
+				$attendee,
116
+				$this
117
+			)
118
+		);
119
+	}
120 120
 
121 121
 
122
-    /**
123
-     * Gets the default value to use for the billing form's state value.
124
-     *
125
-     * @param EE_Attendee $attendee
126
-     * @return string
127
-     * @throws EE_Error
128
-     * @since 4.10.0.p
129
-     */
130
-    protected function getAttendeeStateValueForForm(EE_Attendee $attendee): string
131
-    {
132
-        // If the state input was removed, just return a blank string.
133
-        if (! $this->has_subsection('state')) {
134
-            return '';
135
-        }
136
-        $state_input = $this->get_input('state', false);
137
-        if ($state_input instanceof EE_State_Select_Input) {
138
-            $state_field_to_use = $state_input->valueFieldName();
139
-        } else {
140
-            $state_field_to_use = 'STA_ID';
141
-        }
142
-        switch ($state_field_to_use) {
143
-            case 'STA_abbrev':
144
-                $state_value = $attendee->state_abbrev();
145
-                break;
146
-            case 'STA_name':
147
-                $state_value = $attendee->state_name();
148
-                break;
149
-            default:
150
-                $state_value = $attendee->state_ID();
151
-        }
152
-        return $state_value;
153
-    }
122
+	/**
123
+	 * Gets the default value to use for the billing form's state value.
124
+	 *
125
+	 * @param EE_Attendee $attendee
126
+	 * @return string
127
+	 * @throws EE_Error
128
+	 * @since 4.10.0.p
129
+	 */
130
+	protected function getAttendeeStateValueForForm(EE_Attendee $attendee): string
131
+	{
132
+		// If the state input was removed, just return a blank string.
133
+		if (! $this->has_subsection('state')) {
134
+			return '';
135
+		}
136
+		$state_input = $this->get_input('state', false);
137
+		if ($state_input instanceof EE_State_Select_Input) {
138
+			$state_field_to_use = $state_input->valueFieldName();
139
+		} else {
140
+			$state_field_to_use = 'STA_ID';
141
+		}
142
+		switch ($state_field_to_use) {
143
+			case 'STA_abbrev':
144
+				$state_value = $attendee->state_abbrev();
145
+				break;
146
+			case 'STA_name':
147
+				$state_value = $attendee->state_name();
148
+				break;
149
+			default:
150
+				$state_value = $attendee->state_ID();
151
+		}
152
+		return $state_value;
153
+	}
154 154
 
155 155
 
156
-    /**
157
-     * copy_billing_form_data_to_attendee
158
-     * copies info from the billing form to the attendee's details
159
-     *
160
-     * @param EE_Attendee $attendee the attendee object to copy details to
161
-     * @return EE_Attendee
162
-     * @throws EE_Error
163
-     */
164
-    public function copy_billing_form_data_to_attendee(EE_Attendee $attendee): EE_Attendee
165
-    {
166
-        // grab billing form data
167
-        $data = $this->valid_data();
156
+	/**
157
+	 * copy_billing_form_data_to_attendee
158
+	 * copies info from the billing form to the attendee's details
159
+	 *
160
+	 * @param EE_Attendee $attendee the attendee object to copy details to
161
+	 * @return EE_Attendee
162
+	 * @throws EE_Error
163
+	 */
164
+	public function copy_billing_form_data_to_attendee(EE_Attendee $attendee): EE_Attendee
165
+	{
166
+		// grab billing form data
167
+		$data = $this->valid_data();
168 168
 
169
-        $fields_and_setters = [
170
-            'first_name' => 'set_fname',
171
-            'last_name'  => 'set_lname',
172
-            'email'      => 'set_email',
173
-            'address'    => 'set_address',
174
-            'address2'   => 'set_address2',
175
-            'city'       => 'set_city',
176
-            'state'      => 'set_state',
177
-            'country'    => 'set_country',
178
-            'zip'        => 'set_zip',
179
-            'phone'      => 'set_phone',
180
-        ];
181
-        foreach ($fields_and_setters as $field => $setter) {
182
-            if (! empty($data[ $field ]) && method_exists($attendee, $setter)) {
183
-                $attendee->{$setter}($data[ $field ]);
184
-            }
185
-        }
186
-        return $attendee;
187
-    }
169
+		$fields_and_setters = [
170
+			'first_name' => 'set_fname',
171
+			'last_name'  => 'set_lname',
172
+			'email'      => 'set_email',
173
+			'address'    => 'set_address',
174
+			'address2'   => 'set_address2',
175
+			'city'       => 'set_city',
176
+			'state'      => 'set_state',
177
+			'country'    => 'set_country',
178
+			'zip'        => 'set_zip',
179
+			'phone'      => 'set_phone',
180
+		];
181
+		foreach ($fields_and_setters as $field => $setter) {
182
+			if (! empty($data[ $field ]) && method_exists($attendee, $setter)) {
183
+				$attendee->{$setter}($data[ $field ]);
184
+			}
185
+		}
186
+		return $attendee;
187
+	}
188 188
 
189 189
 
190
-    /**
191
-     * create_attendee_from_billing_form_data
192
-     * uses info from the billing form to create a new attendee
193
-     *
194
-     * @return EE_Attendee
195
-     * @throws EE_Error
196
-     */
197
-    public function create_attendee_from_billing_form_data()
198
-    {
199
-        // grab billing form data
200
-        $data = $this->valid_data();
201
-        return EE_Attendee::new_instance([
202
-            'ATT_fname'    => ! empty($data['first_name']) ? $data['first_name'] : '',
203
-            'ATT_lname'    => ! empty($data['last_name']) ? $data['last_name'] : '',
204
-            'ATT_email'    => ! empty($data['email']) ? $data['email'] : '',
205
-            'ATT_address'  => ! empty($data['address']) ? $data['address'] : '',
206
-            'ATT_address2' => ! empty($data['address2']) ? $data['address2'] : '',
207
-            'ATT_city'     => ! empty($data['city']) ? $data['city'] : '',
208
-            'STA_ID'       => ! empty($data['state']) ? $data['state'] : '',
209
-            'CNT_ISO'      => ! empty($data['country']) ? $data['country'] : '',
210
-            'ATT_zip'      => ! empty($data['zip']) ? $data['zip'] : '',
211
-            'ATT_phone'    => ! empty($data['phone']) ? $data['phone'] : '',
212
-        ]);
213
-    }
190
+	/**
191
+	 * create_attendee_from_billing_form_data
192
+	 * uses info from the billing form to create a new attendee
193
+	 *
194
+	 * @return EE_Attendee
195
+	 * @throws EE_Error
196
+	 */
197
+	public function create_attendee_from_billing_form_data()
198
+	{
199
+		// grab billing form data
200
+		$data = $this->valid_data();
201
+		return EE_Attendee::new_instance([
202
+			'ATT_fname'    => ! empty($data['first_name']) ? $data['first_name'] : '',
203
+			'ATT_lname'    => ! empty($data['last_name']) ? $data['last_name'] : '',
204
+			'ATT_email'    => ! empty($data['email']) ? $data['email'] : '',
205
+			'ATT_address'  => ! empty($data['address']) ? $data['address'] : '',
206
+			'ATT_address2' => ! empty($data['address2']) ? $data['address2'] : '',
207
+			'ATT_city'     => ! empty($data['city']) ? $data['city'] : '',
208
+			'STA_ID'       => ! empty($data['state']) ? $data['state'] : '',
209
+			'CNT_ISO'      => ! empty($data['country']) ? $data['country'] : '',
210
+			'ATT_zip'      => ! empty($data['zip']) ? $data['zip'] : '',
211
+			'ATT_phone'    => ! empty($data['phone']) ? $data['phone'] : '',
212
+		]);
213
+	}
214 214
 }
215 215
 
216 216
 // End of file EE_Billing_Attendee_Info_Form.form.php
Please login to merge, or discard this patch.
admin_pages/events/Events_Admin_Page.core.php 1 patch
Indentation   +2907 added lines, -2907 removed lines patch added patch discarded remove patch
@@ -16,2914 +16,2914 @@
 block discarded – undo
16 16
  */
17 17
 class Events_Admin_Page extends EE_Admin_Page_CPT
18 18
 {
19
-    /**
20
-     * This will hold the event object for event_details screen.
19
+	/**
20
+	 * This will hold the event object for event_details screen.
21
+	 *
22
+	 * @var EE_Event $_event
23
+	 */
24
+	protected $_event;
25
+
26
+
27
+	/**
28
+	 * This will hold the category object for category_details screen.
29
+	 *
30
+	 * @var stdClass $_category
31
+	 */
32
+	protected $_category;
33
+
34
+
35
+	/**
36
+	 * This will hold the event model instance
37
+	 *
38
+	 * @var EEM_Event $_event_model
39
+	 */
40
+	protected $_event_model;
41
+
42
+
43
+	/**
44
+	 * @var EE_Event
45
+	 */
46
+	protected $_cpt_model_obj = false;
47
+
48
+
49
+	/**
50
+	 * @var NodeGroupDao
51
+	 */
52
+	protected $model_obj_node_group_persister;
53
+
54
+	/**
55
+	 * @var AdvancedEditorAdminFormSection
56
+	 */
57
+	protected $advanced_editor_admin_form;
58
+
59
+
60
+	/**
61
+	 * Initialize page props for this admin page group.
62
+	 */
63
+	protected function _init_page_props()
64
+	{
65
+		$this->page_slug        = EVENTS_PG_SLUG;
66
+		$this->page_label       = EVENTS_LABEL;
67
+		$this->_admin_base_url  = EVENTS_ADMIN_URL;
68
+		$this->_admin_base_path = EVENTS_ADMIN;
69
+		$this->_cpt_model_names = [
70
+			'create_new' => 'EEM_Event',
71
+			'edit'       => 'EEM_Event',
72
+		];
73
+		$this->_cpt_edit_routes = [
74
+			'espresso_events' => 'edit',
75
+		];
76
+		add_action(
77
+			'AHEE__EE_Admin_Page_CPT__set_model_object__after_set_object',
78
+			[$this, 'verify_event_edit'],
79
+			10,
80
+			2
81
+		);
82
+	}
83
+
84
+
85
+	/**
86
+	 * Sets the ajax hooks used for this admin page group.
87
+	 */
88
+	protected function _ajax_hooks()
89
+	{
90
+		add_action('wp_ajax_ee_save_timezone_setting', [$this, 'saveTimezoneString']);
91
+	}
92
+
93
+
94
+	/**
95
+	 * Sets the page properties for this admin page group.
96
+	 */
97
+	protected function _define_page_props()
98
+	{
99
+		$this->_admin_page_title = EVENTS_LABEL;
100
+		$this->_labels           = [
101
+			'buttons'      => [
102
+				'add'             => esc_html__('Add New Event', 'event_espresso'),
103
+				'edit'            => esc_html__('Edit Event', 'event_espresso'),
104
+				'delete'          => esc_html__('Delete Event', 'event_espresso'),
105
+				'add_category'    => esc_html__('Add New Category', 'event_espresso'),
106
+				'edit_category'   => esc_html__('Edit Category', 'event_espresso'),
107
+				'delete_category' => esc_html__('Delete Category', 'event_espresso'),
108
+			],
109
+			'editor_title' => [
110
+				'espresso_events' => esc_html__('Enter event title here', 'event_espresso'),
111
+			],
112
+			'publishbox'   => [
113
+				'create_new'        => esc_html__('Save New Event', 'event_espresso'),
114
+				'edit'              => esc_html__('Update Event', 'event_espresso'),
115
+				'add_category'      => esc_html__('Save New Category', 'event_espresso'),
116
+				'edit_category'     => esc_html__('Update Category', 'event_espresso'),
117
+				'template_settings' => esc_html__('Update Settings', 'event_espresso'),
118
+			],
119
+		];
120
+	}
121
+
122
+
123
+	/**
124
+	 * Sets the page routes property for this admin page group.
125
+	 */
126
+	protected function _set_page_routes()
127
+	{
128
+		// load formatter helper
129
+		// load field generator helper
130
+		// is there a evt_id in the request?
131
+		$EVT_ID = $this->request->getRequestParam('EVT_ID', 0, 'int');
132
+		$EVT_ID = $this->request->getRequestParam('post', $EVT_ID, 'int');
133
+
134
+		$this->_page_routes = [
135
+			'default'                       => [
136
+				'func'       => '_events_overview_list_table',
137
+				'capability' => 'ee_read_events',
138
+			],
139
+			'create_new'                    => [
140
+				'func'       => '_create_new_cpt_item',
141
+				'capability' => 'ee_edit_events',
142
+			],
143
+			'edit'                          => [
144
+				'func'       => '_edit_cpt_item',
145
+				'capability' => 'ee_edit_event',
146
+				'obj_id'     => $EVT_ID,
147
+			],
148
+			'copy_event'                    => [
149
+				'func'       => '_copy_events',
150
+				'capability' => 'ee_edit_event',
151
+				'obj_id'     => $EVT_ID,
152
+				'noheader'   => true,
153
+			],
154
+			'trash_event'                   => [
155
+				'func'       => '_trash_or_restore_event',
156
+				'args'       => ['event_status' => 'trash'],
157
+				'capability' => 'ee_delete_event',
158
+				'obj_id'     => $EVT_ID,
159
+				'noheader'   => true,
160
+			],
161
+			'trash_events'                  => [
162
+				'func'       => '_trash_or_restore_events',
163
+				'args'       => ['event_status' => 'trash'],
164
+				'capability' => 'ee_delete_events',
165
+				'noheader'   => true,
166
+			],
167
+			'restore_event'                 => [
168
+				'func'       => '_trash_or_restore_event',
169
+				'args'       => ['event_status' => 'draft'],
170
+				'capability' => 'ee_delete_event',
171
+				'obj_id'     => $EVT_ID,
172
+				'noheader'   => true,
173
+			],
174
+			'restore_events'                => [
175
+				'func'       => '_trash_or_restore_events',
176
+				'args'       => ['event_status' => 'draft'],
177
+				'capability' => 'ee_delete_events',
178
+				'noheader'   => true,
179
+			],
180
+			'delete_event'                  => [
181
+				'func'       => '_delete_event',
182
+				'capability' => 'ee_delete_event',
183
+				'obj_id'     => $EVT_ID,
184
+				'noheader'   => true,
185
+			],
186
+			'delete_events'                 => [
187
+				'func'       => '_delete_events',
188
+				'capability' => 'ee_delete_events',
189
+				'noheader'   => true,
190
+			],
191
+			'view_report'                   => [
192
+				'func'       => '_view_report',
193
+				'capability' => 'ee_edit_events',
194
+			],
195
+			'default_event_settings'        => [
196
+				'func'       => '_default_event_settings',
197
+				'capability' => 'manage_options',
198
+			],
199
+			'update_default_event_settings' => [
200
+				'func'       => '_update_default_event_settings',
201
+				'capability' => 'manage_options',
202
+				'noheader'   => true,
203
+			],
204
+			'template_settings'             => [
205
+				'func'       => '_template_settings',
206
+				'capability' => 'manage_options',
207
+			],
208
+			// event category tab related
209
+			'add_category'                  => [
210
+				'func'       => '_category_details',
211
+				'capability' => 'ee_edit_event_category',
212
+				'args'       => ['add'],
213
+			],
214
+			'edit_category'                 => [
215
+				'func'       => '_category_details',
216
+				'capability' => 'ee_edit_event_category',
217
+				'args'       => ['edit'],
218
+			],
219
+			'delete_categories'             => [
220
+				'func'       => '_delete_categories',
221
+				'capability' => 'ee_delete_event_category',
222
+				'noheader'   => true,
223
+			],
224
+			'delete_category'               => [
225
+				'func'       => '_delete_categories',
226
+				'capability' => 'ee_delete_event_category',
227
+				'noheader'   => true,
228
+			],
229
+			'insert_category'               => [
230
+				'func'       => '_insert_or_update_category',
231
+				'args'       => ['new_category' => true],
232
+				'capability' => 'ee_edit_event_category',
233
+				'noheader'   => true,
234
+			],
235
+			'update_category'               => [
236
+				'func'       => '_insert_or_update_category',
237
+				'args'       => ['new_category' => false],
238
+				'capability' => 'ee_edit_event_category',
239
+				'noheader'   => true,
240
+			],
241
+			'category_list'                 => [
242
+				'func'       => '_category_list_table',
243
+				'capability' => 'ee_manage_event_categories',
244
+			],
245
+			'preview_deletion'              => [
246
+				'func'       => 'previewDeletion',
247
+				'capability' => 'ee_delete_events',
248
+			],
249
+			'confirm_deletion'              => [
250
+				'func'       => 'confirmDeletion',
251
+				'capability' => 'ee_delete_events',
252
+				'noheader'   => true,
253
+			],
254
+		];
255
+	}
256
+
257
+
258
+	/**
259
+	 * Set the _page_config property for this admin page group.
260
+	 */
261
+	protected function _set_page_config()
262
+	{
263
+		$post_id            = $this->request->getRequestParam('post', 0, 'int');
264
+		$EVT_CAT_ID         = $this->request->getRequestParam('EVT_CAT_ID', 0, 'int');
265
+		$this->_page_config = [
266
+			'default'                => [
267
+				'nav'           => [
268
+					'label' => esc_html__('Overview', 'event_espresso'),
269
+					'order' => 10,
270
+				],
271
+				'list_table'    => 'Events_Admin_List_Table',
272
+				'help_tabs'     => [
273
+					'events_overview_help_tab'                       => [
274
+						'title'    => esc_html__('Events Overview', 'event_espresso'),
275
+						'filename' => 'events_overview',
276
+					],
277
+					'events_overview_table_column_headings_help_tab' => [
278
+						'title'    => esc_html__('Events Overview Table Column Headings', 'event_espresso'),
279
+						'filename' => 'events_overview_table_column_headings',
280
+					],
281
+					'events_overview_filters_help_tab'               => [
282
+						'title'    => esc_html__('Events Overview Filters', 'event_espresso'),
283
+						'filename' => 'events_overview_filters',
284
+					],
285
+					'events_overview_view_help_tab'                  => [
286
+						'title'    => esc_html__('Events Overview Views', 'event_espresso'),
287
+						'filename' => 'events_overview_views',
288
+					],
289
+					'events_overview_other_help_tab'                 => [
290
+						'title'    => esc_html__('Events Overview Other', 'event_espresso'),
291
+						'filename' => 'events_overview_other',
292
+					],
293
+				],
294
+				'require_nonce' => false,
295
+			],
296
+			'create_new'             => [
297
+				'nav'           => [
298
+					'label'      => esc_html__('Add New Event', 'event_espresso'),
299
+					'order'      => 5,
300
+					'persistent' => false,
301
+				],
302
+				'metaboxes'     => ['_register_event_editor_meta_boxes'],
303
+				'help_tabs'     => [
304
+					'event_editor_help_tab'                            => [
305
+						'title'    => esc_html__('Event Editor', 'event_espresso'),
306
+						'filename' => 'event_editor',
307
+					],
308
+					'event_editor_title_richtexteditor_help_tab'       => [
309
+						'title'    => esc_html__('Event Title & Rich Text Editor', 'event_espresso'),
310
+						'filename' => 'event_editor_title_richtexteditor',
311
+					],
312
+					'event_editor_venue_details_help_tab'              => [
313
+						'title'    => esc_html__('Event Venue Details', 'event_espresso'),
314
+						'filename' => 'event_editor_venue_details',
315
+					],
316
+					'event_editor_event_datetimes_help_tab'            => [
317
+						'title'    => esc_html__('Event Datetimes', 'event_espresso'),
318
+						'filename' => 'event_editor_event_datetimes',
319
+					],
320
+					'event_editor_event_tickets_help_tab'              => [
321
+						'title'    => esc_html__('Event Tickets', 'event_espresso'),
322
+						'filename' => 'event_editor_event_tickets',
323
+					],
324
+					'event_editor_event_registration_options_help_tab' => [
325
+						'title'    => esc_html__('Event Registration Options', 'event_espresso'),
326
+						'filename' => 'event_editor_event_registration_options',
327
+					],
328
+					'event_editor_tags_categories_help_tab'            => [
329
+						'title'    => esc_html__('Event Tags & Categories', 'event_espresso'),
330
+						'filename' => 'event_editor_tags_categories',
331
+					],
332
+					'event_editor_questions_registrants_help_tab'      => [
333
+						'title'    => esc_html__('Questions for Registrants', 'event_espresso'),
334
+						'filename' => 'event_editor_questions_registrants',
335
+					],
336
+					'event_editor_save_new_event_help_tab'             => [
337
+						'title'    => esc_html__('Save New Event', 'event_espresso'),
338
+						'filename' => 'event_editor_save_new_event',
339
+					],
340
+					'event_editor_other_help_tab'                      => [
341
+						'title'    => esc_html__('Event Other', 'event_espresso'),
342
+						'filename' => 'event_editor_other',
343
+					],
344
+				],
345
+				'qtips'         => ['EE_Event_Editor_Decaf_Tips'],
346
+				'require_nonce' => false,
347
+			],
348
+			'edit'                   => [
349
+				'nav'           => [
350
+					'label'      => esc_html__('Edit Event', 'event_espresso'),
351
+					'order'      => 5,
352
+					'persistent' => false,
353
+					'url'        => $post_id
354
+						? EE_Admin_Page::add_query_args_and_nonce(
355
+							['post' => $post_id, 'action' => 'edit'],
356
+							$this->_current_page_view_url
357
+						)
358
+						: $this->_admin_base_url,
359
+				],
360
+				'metaboxes'     => ['_register_event_editor_meta_boxes'],
361
+				'help_tabs'     => [
362
+					'event_editor_help_tab'                            => [
363
+						'title'    => esc_html__('Event Editor', 'event_espresso'),
364
+						'filename' => 'event_editor',
365
+					],
366
+					'event_editor_title_richtexteditor_help_tab'       => [
367
+						'title'    => esc_html__('Event Title & Rich Text Editor', 'event_espresso'),
368
+						'filename' => 'event_editor_title_richtexteditor',
369
+					],
370
+					'event_editor_venue_details_help_tab'              => [
371
+						'title'    => esc_html__('Event Venue Details', 'event_espresso'),
372
+						'filename' => 'event_editor_venue_details',
373
+					],
374
+					'event_editor_event_datetimes_help_tab'            => [
375
+						'title'    => esc_html__('Event Datetimes', 'event_espresso'),
376
+						'filename' => 'event_editor_event_datetimes',
377
+					],
378
+					'event_editor_event_tickets_help_tab'              => [
379
+						'title'    => esc_html__('Event Tickets', 'event_espresso'),
380
+						'filename' => 'event_editor_event_tickets',
381
+					],
382
+					'event_editor_event_registration_options_help_tab' => [
383
+						'title'    => esc_html__('Event Registration Options', 'event_espresso'),
384
+						'filename' => 'event_editor_event_registration_options',
385
+					],
386
+					'event_editor_tags_categories_help_tab'            => [
387
+						'title'    => esc_html__('Event Tags & Categories', 'event_espresso'),
388
+						'filename' => 'event_editor_tags_categories',
389
+					],
390
+					'event_editor_questions_registrants_help_tab'      => [
391
+						'title'    => esc_html__('Questions for Registrants', 'event_espresso'),
392
+						'filename' => 'event_editor_questions_registrants',
393
+					],
394
+					'event_editor_save_new_event_help_tab'             => [
395
+						'title'    => esc_html__('Save New Event', 'event_espresso'),
396
+						'filename' => 'event_editor_save_new_event',
397
+					],
398
+					'event_editor_other_help_tab'                      => [
399
+						'title'    => esc_html__('Event Other', 'event_espresso'),
400
+						'filename' => 'event_editor_other',
401
+					],
402
+				],
403
+				'require_nonce' => false,
404
+			],
405
+			'default_event_settings' => [
406
+				'nav'           => [
407
+					'label' => esc_html__('Default Settings', 'event_espresso'),
408
+					'order' => 40,
409
+				],
410
+				'metaboxes'     => array_merge($this->_default_espresso_metaboxes, ['_publish_post_box']),
411
+				'labels'        => [
412
+					'publishbox' => esc_html__('Update Settings', 'event_espresso'),
413
+				],
414
+				'help_tabs'     => [
415
+					'default_settings_help_tab'        => [
416
+						'title'    => esc_html__('Default Event Settings', 'event_espresso'),
417
+						'filename' => 'events_default_settings',
418
+					],
419
+					'default_settings_status_help_tab' => [
420
+						'title'    => esc_html__('Default Registration Status', 'event_espresso'),
421
+						'filename' => 'events_default_settings_status',
422
+					],
423
+					'default_maximum_tickets_help_tab' => [
424
+						'title'    => esc_html__('Default Maximum Tickets Per Order', 'event_espresso'),
425
+						'filename' => 'events_default_settings_max_tickets',
426
+					],
427
+				],
428
+				'require_nonce' => false,
429
+			],
430
+			// template settings
431
+			'template_settings'      => [
432
+				'nav'           => [
433
+					'label' => esc_html__('Templates', 'event_espresso'),
434
+					'order' => 30,
435
+				],
436
+				'metaboxes'     => $this->_default_espresso_metaboxes,
437
+				'help_tabs'     => [
438
+					'general_settings_templates_help_tab' => [
439
+						'title'    => esc_html__('Templates', 'event_espresso'),
440
+						'filename' => 'general_settings_templates',
441
+					],
442
+				],
443
+				'require_nonce' => false,
444
+			],
445
+			// event category stuff
446
+			'add_category'           => [
447
+				'nav'           => [
448
+					'label'      => esc_html__('Add Category', 'event_espresso'),
449
+					'order'      => 15,
450
+					'persistent' => false,
451
+				],
452
+				'help_tabs'     => [
453
+					'add_category_help_tab' => [
454
+						'title'    => esc_html__('Add New Event Category', 'event_espresso'),
455
+						'filename' => 'events_add_category',
456
+					],
457
+				],
458
+				'metaboxes'     => ['_publish_post_box'],
459
+				'require_nonce' => false,
460
+			],
461
+			'edit_category'          => [
462
+				'nav'           => [
463
+					'label'      => esc_html__('Edit Category', 'event_espresso'),
464
+					'order'      => 15,
465
+					'persistent' => false,
466
+					'url'        => $EVT_CAT_ID
467
+						? add_query_arg(
468
+							['EVT_CAT_ID' => $EVT_CAT_ID],
469
+							$this->_current_page_view_url
470
+						)
471
+						: $this->_admin_base_url,
472
+				],
473
+				'help_tabs'     => [
474
+					'edit_category_help_tab' => [
475
+						'title'    => esc_html__('Edit Event Category', 'event_espresso'),
476
+						'filename' => 'events_edit_category',
477
+					],
478
+				],
479
+				'metaboxes'     => ['_publish_post_box'],
480
+				'require_nonce' => false,
481
+			],
482
+			'category_list'          => [
483
+				'nav'           => [
484
+					'label' => esc_html__('Categories', 'event_espresso'),
485
+					'order' => 20,
486
+				],
487
+				'list_table'    => 'Event_Categories_Admin_List_Table',
488
+				'help_tabs'     => [
489
+					'events_categories_help_tab'                       => [
490
+						'title'    => esc_html__('Event Categories', 'event_espresso'),
491
+						'filename' => 'events_categories',
492
+					],
493
+					'events_categories_table_column_headings_help_tab' => [
494
+						'title'    => esc_html__('Event Categories Table Column Headings', 'event_espresso'),
495
+						'filename' => 'events_categories_table_column_headings',
496
+					],
497
+					'events_categories_view_help_tab'                  => [
498
+						'title'    => esc_html__('Event Categories Views', 'event_espresso'),
499
+						'filename' => 'events_categories_views',
500
+					],
501
+					'events_categories_other_help_tab'                 => [
502
+						'title'    => esc_html__('Event Categories Other', 'event_espresso'),
503
+						'filename' => 'events_categories_other',
504
+					],
505
+				],
506
+				'metaboxes'     => $this->_default_espresso_metaboxes,
507
+				'require_nonce' => false,
508
+			],
509
+			'preview_deletion'       => [
510
+				'nav'           => [
511
+					'label'      => esc_html__('Preview Deletion', 'event_espresso'),
512
+					'order'      => 15,
513
+					'persistent' => false,
514
+					'url'        => '',
515
+				],
516
+				'require_nonce' => false,
517
+			],
518
+		];
519
+	}
520
+
521
+
522
+	/**
523
+	 * Used to register any global screen options if necessary for every route in this admin page group.
524
+	 */
525
+	protected function _add_screen_options()
526
+	{
527
+	}
528
+
529
+
530
+	/**
531
+	 * Implementing the screen options for the 'default' route.
532
+	 *
533
+	 * @throws InvalidArgumentException
534
+	 * @throws InvalidDataTypeException
535
+	 * @throws InvalidInterfaceException
536
+	 */
537
+	protected function _add_screen_options_default()
538
+	{
539
+		$this->_per_page_screen_option();
540
+	}
541
+
542
+
543
+	/**
544
+	 * Implementing screen options for the category list route.
545
+	 *
546
+	 * @throws InvalidArgumentException
547
+	 * @throws InvalidDataTypeException
548
+	 * @throws InvalidInterfaceException
549
+	 */
550
+	protected function _add_screen_options_category_list()
551
+	{
552
+		$page_title              = $this->_admin_page_title;
553
+		$this->_admin_page_title = esc_html__('Categories', 'event_espresso');
554
+		$this->_per_page_screen_option();
555
+		$this->_admin_page_title = $page_title;
556
+	}
557
+
558
+
559
+	/**
560
+	 * Used to register any global feature pointers for the admin page group.
561
+	 */
562
+	protected function _add_feature_pointers()
563
+	{
564
+	}
565
+
566
+
567
+	/**
568
+	 * Registers and enqueues any global scripts and styles for the entire admin page group.
569
+	 */
570
+	public function load_scripts_styles()
571
+	{
572
+		wp_register_style(
573
+			'events-admin-css',
574
+			EVENTS_ASSETS_URL . 'events-admin-page.css',
575
+			[],
576
+			EVENT_ESPRESSO_VERSION
577
+		);
578
+		wp_register_style(
579
+			'ee-cat-admin',
580
+			EVENTS_ASSETS_URL . 'ee-cat-admin.css',
581
+			[],
582
+			EVENT_ESPRESSO_VERSION
583
+		);
584
+		wp_enqueue_style('events-admin-css');
585
+		wp_enqueue_style('ee-cat-admin');
586
+		// scripts
587
+		wp_register_script(
588
+			'event_editor_js',
589
+			EVENTS_ASSETS_URL . 'event_editor.js',
590
+			['ee_admin_js', 'jquery-ui-slider', 'jquery-ui-timepicker-addon'],
591
+			EVENT_ESPRESSO_VERSION,
592
+			true
593
+		);
594
+	}
595
+
596
+
597
+	/**
598
+	 * Enqueuing scripts and styles specific to this view
599
+	 */
600
+	public function load_scripts_styles_create_new()
601
+	{
602
+		$this->load_scripts_styles_edit();
603
+	}
604
+
605
+
606
+	/**
607
+	 * Enqueuing scripts and styles specific to this view
608
+	 */
609
+	public function load_scripts_styles_edit()
610
+	{
611
+		// styles
612
+		wp_enqueue_style('espresso-ui-theme');
613
+		wp_register_style(
614
+			'event-editor-css',
615
+			EVENTS_ASSETS_URL . 'event-editor.css',
616
+			['ee-admin-css'],
617
+			EVENT_ESPRESSO_VERSION
618
+		);
619
+		wp_enqueue_style('event-editor-css');
620
+		// scripts
621
+		if (! $this->admin_config->useAdvancedEditor()) {
622
+			wp_register_script(
623
+				'event-datetime-metabox',
624
+				EVENTS_ASSETS_URL . 'event-datetime-metabox.js',
625
+				['event_editor_js', 'ee-datepicker'],
626
+				EVENT_ESPRESSO_VERSION
627
+			);
628
+			wp_enqueue_script('event-datetime-metabox');
629
+		}
630
+	}
631
+
632
+
633
+	/**
634
+	 * Populating the _views property for the category list table view.
635
+	 */
636
+	protected function _set_list_table_views_category_list()
637
+	{
638
+		$this->_views = [
639
+			'all' => [
640
+				'slug'        => 'all',
641
+				'label'       => esc_html__('All', 'event_espresso'),
642
+				'count'       => 0,
643
+				'bulk_action' => [
644
+					'delete_categories' => esc_html__('Delete Permanently', 'event_espresso'),
645
+				],
646
+			],
647
+		];
648
+	}
649
+
650
+
651
+	/**
652
+	 * For adding anything that fires on the admin_init hook for any route within this admin page group.
653
+	 */
654
+	public function admin_init()
655
+	{
656
+		EE_Registry::$i18n_js_strings['image_confirm'] = esc_html__(
657
+			'Do you really want to delete this image? Please remember to update your event to complete the removal.',
658
+			'event_espresso'
659
+		);
660
+	}
661
+
662
+
663
+	/**
664
+	 * For adding anything that should be triggered on the admin_notices hook for any route within this admin page
665
+	 * group.
666
+	 */
667
+	public function admin_notices()
668
+	{
669
+	}
670
+
671
+
672
+	/**
673
+	 * For adding anything that should be triggered on the `admin_print_footer_scripts` hook for any route within
674
+	 * this admin page group.
675
+	 */
676
+	public function admin_footer_scripts()
677
+	{
678
+	}
679
+
680
+
681
+	/**
682
+	 * Call this function to verify if an event is public and has tickets for sale.  If it does, then we need to show a
683
+	 * warning (via EE_Error::add_error());
684
+	 *
685
+	 * @param EE_Event $event Event object
686
+	 * @param string   $req_type
687
+	 * @return void
688
+	 * @throws EE_Error
689
+	 * @throws ReflectionException
690
+	 */
691
+	public function verify_event_edit($event = null, $req_type = '')
692
+	{
693
+		// don't need to do this when processing
694
+		if (! empty($req_type)) {
695
+			return;
696
+		}
697
+		// no event?
698
+		if (! $event instanceof EE_Event) {
699
+			$event = $this->_cpt_model_obj;
700
+		}
701
+		// STILL no event?
702
+		if (! $event instanceof EE_Event) {
703
+			return;
704
+		}
705
+		$orig_status = $event->status();
706
+		// first check if event is active.
707
+		if (
708
+			$orig_status === EEM_Event::cancelled
709
+			|| $orig_status === EEM_Event::postponed
710
+			|| $event->is_expired()
711
+			|| $event->is_inactive()
712
+		) {
713
+			return;
714
+		}
715
+		// made it here so it IS active... next check that any of the tickets are sold.
716
+		if ($event->is_sold_out(true)) {
717
+			if ($orig_status !== EEM_Event::sold_out && $event->status() !== $orig_status) {
718
+				EE_Error::add_attention(
719
+					sprintf(
720
+						esc_html__(
721
+							'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.',
722
+							'event_espresso'
723
+						),
724
+						EEH_Template::pretty_status(EEM_Event::sold_out, false, 'sentence')
725
+					)
726
+				);
727
+			}
728
+			return;
729
+		}
730
+		if ($orig_status === EEM_Event::sold_out) {
731
+			EE_Error::add_attention(
732
+				sprintf(
733
+					esc_html__(
734
+						'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.',
735
+						'event_espresso'
736
+					),
737
+					EEH_Template::pretty_status($event->status(), false, 'sentence')
738
+				)
739
+			);
740
+		}
741
+		// now we need to determine if the event has any tickets on sale.  If not then we dont' show the error
742
+		if (! $event->tickets_on_sale()) {
743
+			return;
744
+		}
745
+		// made it here so show warning
746
+		$this->_edit_event_warning();
747
+	}
748
+
749
+
750
+	/**
751
+	 * This is the text used for when an event is being edited that is public and has tickets for sale.
752
+	 * When needed, hook this into a EE_Error::add_error() notice.
753
+	 *
754
+	 * @access protected
755
+	 * @return void
756
+	 */
757
+	protected function _edit_event_warning()
758
+	{
759
+		// we don't want to add warnings during these requests
760
+		if ($this->request->getRequestParam('action') === 'editpost') {
761
+			return;
762
+		}
763
+		EE_Error::add_attention(
764
+			sprintf(
765
+				esc_html__(
766
+					'Your event is open for registration. Making changes may disrupt any transactions in progress. %sLearn more%s',
767
+					'event_espresso'
768
+				),
769
+				'<a class="espresso-help-tab-lnk ee-help-tab-link">',
770
+				'</a>'
771
+			)
772
+		);
773
+	}
774
+
775
+
776
+	/**
777
+	 * When a user is creating a new event, notify them if they haven't set their timezone.
778
+	 * Otherwise, do the normal logic
779
+	 *
780
+	 * @return void
781
+	 * @throws EE_Error
782
+	 * @throws InvalidArgumentException
783
+	 * @throws InvalidDataTypeException
784
+	 * @throws InvalidInterfaceException
785
+	 */
786
+	protected function _create_new_cpt_item()
787
+	{
788
+		$has_timezone_string = get_option('timezone_string');
789
+		// only nag them about setting their timezone if it's their first event, and they haven't already done it
790
+		if (! $has_timezone_string && ! EEM_Event::instance()->exists([])) {
791
+			EE_Error::add_attention(
792
+				sprintf(
793
+					esc_html__(
794
+						'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',
795
+						'event_espresso'
796
+					),
797
+					'<br>',
798
+					'<select id="timezone_string" name="timezone_string" aria-describedby="timezone-description">'
799
+					. EEH_DTT_Helper::wp_timezone_choice('', EEH_DTT_Helper::get_user_locale())
800
+					. '</select>',
801
+					'<button class="button button--secondary timezone-submit">',
802
+					'</button><span class="spinner"></span>'
803
+				),
804
+				__FILE__,
805
+				__FUNCTION__,
806
+				__LINE__
807
+			);
808
+		}
809
+		parent::_create_new_cpt_item();
810
+	}
811
+
812
+
813
+	/**
814
+	 * Sets the _views property for the default route in this admin page group.
815
+	 */
816
+	protected function _set_list_table_views_default()
817
+	{
818
+		$this->_views = [
819
+			'all'   => [
820
+				'slug'        => 'all',
821
+				'label'       => esc_html__('View All Events', 'event_espresso'),
822
+				'count'       => 0,
823
+				'bulk_action' => [
824
+					'trash_events' => esc_html__('Move to Trash', 'event_espresso'),
825
+				],
826
+			],
827
+			'draft' => [
828
+				'slug'        => 'draft',
829
+				'label'       => esc_html__('Draft', 'event_espresso'),
830
+				'count'       => 0,
831
+				'bulk_action' => [
832
+					'trash_events' => esc_html__('Move to Trash', 'event_espresso'),
833
+				],
834
+			],
835
+		];
836
+		if (EE_Registry::instance()->CAP->current_user_can('ee_delete_events', 'espresso_events_trash_events')) {
837
+			$this->_views['trash'] = [
838
+				'slug'        => 'trash',
839
+				'label'       => esc_html__('Trash', 'event_espresso'),
840
+				'count'       => 0,
841
+				'bulk_action' => [
842
+					'restore_events' => esc_html__('Restore From Trash', 'event_espresso'),
843
+					'delete_events'  => esc_html__('Delete Permanently', 'event_espresso'),
844
+				],
845
+			];
846
+		}
847
+	}
848
+
849
+
850
+	/**
851
+	 * Provides the legend item array for the default list table view.
852
+	 *
853
+	 * @return array
854
+	 * @throws EE_Error
855
+	 * @throws EE_Error
856
+	 */
857
+	protected function _event_legend_items()
858
+	{
859
+		$items    = [
860
+			'view_details'   => [
861
+				'class' => 'dashicons dashicons-visibility',
862
+				'desc'  => esc_html__('View Event', 'event_espresso'),
863
+			],
864
+			'edit_event'     => [
865
+				'class' => 'dashicons dashicons-calendar-alt',
866
+				'desc'  => esc_html__('Edit Event Details', 'event_espresso'),
867
+			],
868
+			'view_attendees' => [
869
+				'class' => 'dashicons dashicons-groups',
870
+				'desc'  => esc_html__('View Registrations for Event', 'event_espresso'),
871
+			],
872
+		];
873
+		$items    = apply_filters('FHEE__Events_Admin_Page___event_legend_items__items', $items);
874
+		$statuses = [
875
+			'sold_out_status'  => [
876
+				'class' => 'ee-status-legend ee-status-bg--' . EE_Datetime::sold_out,
877
+				'desc'  => EEH_Template::pretty_status(EE_Datetime::sold_out, false, 'sentence'),
878
+			],
879
+			'active_status'    => [
880
+				'class' => 'ee-status-legend ee-status-bg--' . EE_Datetime::active,
881
+				'desc'  => EEH_Template::pretty_status(EE_Datetime::active, false, 'sentence'),
882
+			],
883
+			'upcoming_status'  => [
884
+				'class' => 'ee-status-legend ee-status-bg--' . EE_Datetime::upcoming,
885
+				'desc'  => EEH_Template::pretty_status(EE_Datetime::upcoming, false, 'sentence'),
886
+			],
887
+			'postponed_status' => [
888
+				'class' => 'ee-status-legend ee-status-bg--' . EE_Datetime::postponed,
889
+				'desc'  => EEH_Template::pretty_status(EE_Datetime::postponed, false, 'sentence'),
890
+			],
891
+			'cancelled_status' => [
892
+				'class' => 'ee-status-legend ee-status-bg--' . EE_Datetime::cancelled,
893
+				'desc'  => EEH_Template::pretty_status(EE_Datetime::cancelled, false, 'sentence'),
894
+			],
895
+			'expired_status'   => [
896
+				'class' => 'ee-status-legend ee-status-bg--' . EE_Datetime::expired,
897
+				'desc'  => EEH_Template::pretty_status(EE_Datetime::expired, false, 'sentence'),
898
+			],
899
+			'inactive_status'  => [
900
+				'class' => 'ee-status-legend ee-status-bg--' . EE_Datetime::inactive,
901
+				'desc'  => EEH_Template::pretty_status(EE_Datetime::inactive, false, 'sentence'),
902
+			],
903
+		];
904
+		$statuses = apply_filters('FHEE__Events_Admin_Page__event_legend_items__statuses', $statuses);
905
+		return array_merge($items, $statuses);
906
+	}
907
+
908
+
909
+	/**
910
+	 * @return EEM_Event
911
+	 * @throws EE_Error
912
+	 * @throws InvalidArgumentException
913
+	 * @throws InvalidDataTypeException
914
+	 * @throws InvalidInterfaceException
915
+	 * @throws ReflectionException
916
+	 */
917
+	private function _event_model()
918
+	{
919
+		if (! $this->_event_model instanceof EEM_Event) {
920
+			$this->_event_model = EE_Registry::instance()->load_model('Event');
921
+		}
922
+		return $this->_event_model;
923
+	}
924
+
925
+
926
+	/**
927
+	 * Adds extra buttons to the WP CPT permalink field row.
928
+	 * Method is called from parent and is hooked into the wp 'get_sample_permalink_html' filter.
929
+	 *
930
+	 * @param string $return    the current html
931
+	 * @param int    $id        the post id for the page
932
+	 * @param string $new_title What the title is
933
+	 * @param string $new_slug  what the slug is
934
+	 * @return string            The new html string for the permalink area
935
+	 */
936
+	public function extra_permalink_field_buttons($return, $id, $new_title, $new_slug)
937
+	{
938
+		// make sure this is only when editing
939
+		if (! empty($id)) {
940
+			$post = get_post($id);
941
+			$return .= '<a class="button button--small button--secondary" onclick="prompt(\'Shortcode:\', jQuery(\'#shortcode\').val()); return false;" href="#"  tabindex="-1">'
942
+					   . esc_html__('Shortcode', 'event_espresso')
943
+					   . '</a> ';
944
+			$return .= '<input id="shortcode" type="hidden" value="[ESPRESSO_TICKET_SELECTOR event_id='
945
+					   . $post->ID
946
+					   . ']">';
947
+		}
948
+		return $return;
949
+	}
950
+
951
+
952
+	/**
953
+	 * _events_overview_list_table
954
+	 * This contains the logic for showing the events_overview list
955
+	 *
956
+	 * @access protected
957
+	 * @return void
958
+	 * @throws DomainException
959
+	 * @throws EE_Error
960
+	 * @throws InvalidArgumentException
961
+	 * @throws InvalidDataTypeException
962
+	 * @throws InvalidInterfaceException
963
+	 */
964
+	protected function _events_overview_list_table()
965
+	{
966
+		$after_list_table                           = [];
967
+		$links_html = EEH_HTML::div('', '', 'ee-admin-section ee-layout-stack');
968
+		$links_html .= EEH_HTML::h3(esc_html__('Links', 'event_espresso'));
969
+		$links_html .= EEH_HTML::div(
970
+			EEH_Template::get_button_or_link(
971
+				get_post_type_archive_link('espresso_events'),
972
+				esc_html__('View Event Archive Page', 'event_espresso'),
973
+				'button button--small button--secondary'
974
+			),
975
+			'',
976
+			'ee-admin-button-row ee-admin-button-row--align-start'
977
+		);
978
+		$links_html .= EEH_HTML::divx();
979
+
980
+		$after_list_table['view_event_list_button'] = $links_html;
981
+
982
+		$after_list_table['legend'] = $this->_display_legend($this->_event_legend_items());
983
+		$this->_admin_page_title                    .= ' ' . $this->get_action_link_or_button(
984
+			'create_new',
985
+			'add',
986
+			[],
987
+			'add-new-h2'
988
+		);
989
+
990
+		$this->_template_args['after_list_table']   = array_merge(
991
+			(array) $this->_template_args['after_list_table'],
992
+			$after_list_table
993
+		);
994
+		$this->display_admin_list_table_page_with_no_sidebar();
995
+	}
996
+
997
+
998
+	/**
999
+	 * this allows for extra misc actions in the default WP publish box
1000
+	 *
1001
+	 * @return void
1002
+	 * @throws DomainException
1003
+	 * @throws EE_Error
1004
+	 * @throws InvalidArgumentException
1005
+	 * @throws InvalidDataTypeException
1006
+	 * @throws InvalidInterfaceException
1007
+	 * @throws ReflectionException
1008
+	 */
1009
+	public function extra_misc_actions_publish_box()
1010
+	{
1011
+		$this->_generate_publish_box_extra_content();
1012
+	}
1013
+
1014
+
1015
+	/**
1016
+	 * This is hooked into the WordPress do_action('save_post') hook and runs after the custom post type has been
1017
+	 * saved.
1018
+	 * Typically you would use this to save any additional data.
1019
+	 * Keep in mind also that "save_post" runs on EVERY post update to the database.
1020
+	 * ALSO very important.  When a post transitions from scheduled to published,
1021
+	 * the save_post action is fired but you will NOT have any _POST data containing any extra info you may have from
1022
+	 * other meta saves. So MAKE sure that you handle this accordingly.
1023
+	 *
1024
+	 * @access protected
1025
+	 * @abstract
1026
+	 * @param string $post_id The ID of the cpt that was saved (so you can link relationally)
1027
+	 * @param WP_Post $post    The post object of the cpt that was saved.
1028
+	 * @return void
1029
+	 * @throws EE_Error
1030
+	 * @throws InvalidArgumentException
1031
+	 * @throws InvalidDataTypeException
1032
+	 * @throws InvalidInterfaceException
1033
+	 * @throws ReflectionException
1034
+	 */
1035
+	protected function _insert_update_cpt_item($post_id, $post)
1036
+	{
1037
+		if ($post instanceof WP_Post && $post->post_type !== 'espresso_events') {
1038
+			// get out we're not processing an event save.
1039
+			return;
1040
+		}
1041
+		$event_values = [
1042
+			'EVT_member_only'     => $this->request->getRequestParam('member_only', false, 'bool'),
1043
+			'EVT_allow_overflow'  => $this->request->getRequestParam('EVT_allow_overflow', false, 'bool'),
1044
+			'EVT_timezone_string' => $this->request->getRequestParam('timezone_string'),
1045
+		];
1046
+		// check if the new EDTR reg options meta box is being used, and if so, don't run updates for legacy version
1047
+		if (! $this->admin_config->useAdvancedEditor() || ! $this->feature->allowed('use_reg_options_meta_box')) {
1048
+			$event_values['EVT_display_ticket_selector']     = $this->request->getRequestParam(
1049
+				'display_ticket_selector',
1050
+				false,
1051
+				'bool'
1052
+			);
1053
+			$event_values['EVT_additional_limit']            = min(
1054
+				apply_filters('FHEE__EE_Events_Admin__insert_update_cpt_item__EVT_additional_limit_max', 255),
1055
+				$this->request->getRequestParam('additional_limit', null, 'int')
1056
+			);
1057
+			$event_values['EVT_default_registration_status'] = $this->request->getRequestParam(
1058
+				'EVT_default_registration_status',
1059
+				EE_Registry::instance()->CFG->registration->default_STS_ID
1060
+			);
1061
+
1062
+			$event_values['EVT_external_URL'] = $this->request->getRequestParam('externalURL');
1063
+			$event_values['EVT_phone']        = $this->request->getRequestParam('event_phone');
1064
+			$event_values['EVT_display_desc'] = $this->request->getRequestParam('display_desc', false, 'bool');
1065
+		}
1066
+		// update event
1067
+		$success = $this->_event_model()->update_by_ID($event_values, $post_id);
1068
+		// get event_object for other metaboxes...
1069
+		// though it would seem to make sense to just use $this->_event_model()->get_one_by_ID( $post_id )..
1070
+		// i have to setup where conditions to override the filters in the model
1071
+		// that filter out autodraft and inherit statuses so we GET the inherit id!
1072
+		$event = $this->_event_model()->get_one(
1073
+			[
1074
+				[
1075
+					$this->_event_model()->primary_key_name() => $post_id,
1076
+					'OR'                                      => [
1077
+						'status'   => $post->post_status,
1078
+						// if trying to "Publish" a sold out event, it's status will get switched back to "sold_out" in the db,
1079
+						// but the returned object here has a status of "publish", so use the original post status as well
1080
+						'status*1' => $this->request->getRequestParam('original_post_status'),
1081
+					],
1082
+				],
1083
+			]
1084
+		);
1085
+
1086
+		// the following are default callbacks for event attachment updates
1087
+		// that can be overridden by caffeinated functionality and/or addons.
1088
+		$event_update_callbacks = [];
1089
+		if (! $this->admin_config->useAdvancedEditor()) {
1090
+			$event_update_callbacks['_default_venue_update']   = [$this, '_default_venue_update'];
1091
+			$event_update_callbacks['_default_tickets_update'] = [$this, '_default_tickets_update'];
1092
+		}
1093
+		$event_update_callbacks = apply_filters(
1094
+			'FHEE__Events_Admin_Page___insert_update_cpt_item__event_update_callbacks',
1095
+			$event_update_callbacks
1096
+		);
1097
+
1098
+		$att_success = true;
1099
+		foreach ($event_update_callbacks as $e_callback) {
1100
+			$_success = is_callable($e_callback)
1101
+				? $e_callback($event, $this->request->requestParams())
1102
+				: false;
1103
+			// if ANY of these updates fail then we want the appropriate global error message
1104
+			$att_success = $_success !== false ? $att_success : false;
1105
+		}
1106
+		// any errors?
1107
+		if ($success && $att_success === false) {
1108
+			EE_Error::add_error(
1109
+				esc_html__(
1110
+					'Event Details saved successfully but something went wrong with saving attachments.',
1111
+					'event_espresso'
1112
+				),
1113
+				__FILE__,
1114
+				__FUNCTION__,
1115
+				__LINE__
1116
+			);
1117
+		} elseif ($success === false) {
1118
+			EE_Error::add_error(
1119
+				esc_html__('Event Details did not save successfully.', 'event_espresso'),
1120
+				__FILE__,
1121
+				__FUNCTION__,
1122
+				__LINE__
1123
+			);
1124
+		}
1125
+	}
1126
+
1127
+
1128
+	/**
1129
+	 * @param int $post_id
1130
+	 * @param int $revision_id
1131
+	 * @throws EE_Error
1132
+	 * @throws EE_Error
1133
+	 * @throws ReflectionException
1134
+	 * @see parent::restore_item()
1135
+	 */
1136
+	protected function _restore_cpt_item($post_id, $revision_id)
1137
+	{
1138
+		// copy existing event meta to new post
1139
+		$post_evt = $this->_event_model()->get_one_by_ID($post_id);
1140
+		if ($post_evt instanceof EE_Event) {
1141
+			// meta revision restore
1142
+			$post_evt->restore_revision($revision_id);
1143
+			// related objs restore
1144
+			$post_evt->restore_revision($revision_id, ['Venue', 'Datetime', 'Price']);
1145
+		}
1146
+	}
1147
+
1148
+
1149
+	/**
1150
+	 * Attach the venue to the Event
1151
+	 *
1152
+	 * @param EE_Event $event Event Object to add the venue to
1153
+	 * @param array    $data  The request data from the form
1154
+	 * @return bool           Success or fail.
1155
+	 * @throws EE_Error
1156
+	 * @throws ReflectionException
1157
+	 */
1158
+	protected function _default_venue_update(EE_Event $event, $data)
1159
+	{
1160
+		require_once(EE_MODELS . 'EEM_Venue.model.php');
1161
+		$venue_model = EE_Registry::instance()->load_model('Venue');
1162
+		$venue_id    = ! empty($data['venue_id']) ? $data['venue_id'] : null;
1163
+		// very important.  If we don't have a venue name...
1164
+		// then we'll get out because not necessary to create empty venue
1165
+		if (empty($data['venue_title'])) {
1166
+			return false;
1167
+		}
1168
+		$venue_array = [
1169
+			'VNU_wp_user'         => $event->get('EVT_wp_user'),
1170
+			'VNU_name'            => ! empty($data['venue_title']) ? $data['venue_title'] : null,
1171
+			'VNU_desc'            => ! empty($data['venue_description']) ? $data['venue_description'] : null,
1172
+			'VNU_identifier'      => ! empty($data['venue_identifier']) ? $data['venue_identifier'] : null,
1173
+			'VNU_short_desc'      => ! empty($data['venue_short_description'])
1174
+				? $data['venue_short_description']
1175
+				: null,
1176
+			'VNU_address'         => ! empty($data['address']) ? $data['address'] : null,
1177
+			'VNU_address2'        => ! empty($data['address2']) ? $data['address2'] : null,
1178
+			'VNU_city'            => ! empty($data['city']) ? $data['city'] : null,
1179
+			'STA_ID'              => ! empty($data['state']) ? $data['state'] : null,
1180
+			'CNT_ISO'             => ! empty($data['countries']) ? $data['countries'] : null,
1181
+			'VNU_zip'             => ! empty($data['zip']) ? $data['zip'] : null,
1182
+			'VNU_phone'           => ! empty($data['venue_phone']) ? $data['venue_phone'] : null,
1183
+			'VNU_capacity'        => ! empty($data['venue_capacity']) ? $data['venue_capacity'] : null,
1184
+			'VNU_url'             => ! empty($data['venue_url']) ? $data['venue_url'] : null,
1185
+			'VNU_virtual_phone'   => ! empty($data['virtual_phone']) ? $data['virtual_phone'] : null,
1186
+			'VNU_virtual_url'     => ! empty($data['virtual_url']) ? $data['virtual_url'] : null,
1187
+			'VNU_enable_for_gmap' => isset($data['enable_for_gmap']) ? 1 : 0,
1188
+			'status'              => 'publish',
1189
+		];
1190
+		// if we've got the venue_id then we're just updating the existing venue so let's do that and then get out.
1191
+		if (! empty($venue_id)) {
1192
+			$update_where  = [$venue_model->primary_key_name() => $venue_id];
1193
+			$rows_affected = $venue_model->update($venue_array, [$update_where]);
1194
+			// we've gotta make sure that the venue is always attached to a revision..
1195
+			// add_relation_to should take care of making sure that the relation is already present.
1196
+			$event->_add_relation_to($venue_id, 'Venue');
1197
+			return $rows_affected > 0;
1198
+		}
1199
+		// we insert the venue
1200
+		$venue_id = $venue_model->insert($venue_array);
1201
+		$event->_add_relation_to($venue_id, 'Venue');
1202
+		return ! empty($venue_id);
1203
+		// when we have the ancestor come in it's already been handled by the revision save.
1204
+	}
1205
+
1206
+
1207
+	/**
1208
+	 * Handles saving everything related to Tickets (datetimes, tickets, prices)
1209
+	 *
1210
+	 * @param EE_Event $event The Event object we're attaching data to
1211
+	 * @param array    $data  The request data from the form
1212
+	 * @return array
1213
+	 * @throws EE_Error
1214
+	 * @throws ReflectionException
1215
+	 * @throws Exception
1216
+	 */
1217
+	protected function _default_tickets_update(EE_Event $event, $data)
1218
+	{
1219
+		if ($this->admin_config->useAdvancedEditor()) {
1220
+			return [];
1221
+		}
1222
+		$datetime       = null;
1223
+		$saved_tickets  = [];
1224
+		$event_timezone = $event->get_timezone();
1225
+		$date_formats   = ['Y-m-d', 'h:i a'];
1226
+		foreach ($data['edit_event_datetimes'] as $row => $datetime_data) {
1227
+			// trim all values to ensure any excess whitespace is removed.
1228
+			$datetime_data                = array_map('trim', $datetime_data);
1229
+			$datetime_data['DTT_EVT_end'] =
1230
+				isset($datetime_data['DTT_EVT_end']) && ! empty($datetime_data['DTT_EVT_end'])
1231
+					? $datetime_data['DTT_EVT_end']
1232
+					: $datetime_data['DTT_EVT_start'];
1233
+			$datetime_values              = [
1234
+				'DTT_ID'        => ! empty($datetime_data['DTT_ID']) ? $datetime_data['DTT_ID'] : null,
1235
+				'DTT_EVT_start' => $datetime_data['DTT_EVT_start'],
1236
+				'DTT_EVT_end'   => $datetime_data['DTT_EVT_end'],
1237
+				'DTT_reg_limit' => empty($datetime_data['DTT_reg_limit']) ? EE_INF : $datetime_data['DTT_reg_limit'],
1238
+				'DTT_order'     => $row,
1239
+			];
1240
+			// if we have an id then let's get existing object first and then set the new values.
1241
+			//  Otherwise we instantiate a new object for save.
1242
+			if (! empty($datetime_data['DTT_ID'])) {
1243
+				$datetime = EEM_Datetime::instance($event_timezone)->get_one_by_ID($datetime_data['DTT_ID']);
1244
+				if (! $datetime instanceof EE_Datetime) {
1245
+					throw new RuntimeException(
1246
+						sprintf(
1247
+							esc_html__(
1248
+								'Something went wrong! A valid Datetime could not be retrieved from the database using the supplied ID: %1$d',
1249
+								'event_espresso'
1250
+							),
1251
+							$datetime_data['DTT_ID']
1252
+						)
1253
+					);
1254
+				}
1255
+				$datetime->set_date_format($date_formats[0]);
1256
+				$datetime->set_time_format($date_formats[1]);
1257
+				foreach ($datetime_values as $field => $value) {
1258
+					$datetime->set($field, $value);
1259
+				}
1260
+			} else {
1261
+				$datetime = EE_Datetime::new_instance($datetime_values, $event_timezone, $date_formats);
1262
+			}
1263
+			if (! $datetime instanceof EE_Datetime) {
1264
+				throw new RuntimeException(
1265
+					sprintf(
1266
+						esc_html__(
1267
+							'Something went wrong! A valid Datetime could not be generated or retrieved using the supplied data: %1$s',
1268
+							'event_espresso'
1269
+						),
1270
+						print_r($datetime_values, true)
1271
+					)
1272
+				);
1273
+			}
1274
+			// before going any further make sure our dates are setup correctly
1275
+			// so that the end date is always equal or greater than the start date.
1276
+			if ($datetime->get_raw('DTT_EVT_start') > $datetime->get_raw('DTT_EVT_end')) {
1277
+				$datetime->set('DTT_EVT_end', $datetime->get('DTT_EVT_start'));
1278
+				$datetime = EEH_DTT_Helper::date_time_add($datetime, 'DTT_EVT_end', 'days');
1279
+			}
1280
+			$datetime->save();
1281
+			$event->_add_relation_to($datetime, 'Datetime');
1282
+		}
1283
+		// no datetimes get deleted so we don't do any of that logic here.
1284
+		// update tickets next
1285
+		$old_tickets = isset($data['ticket_IDs']) ? explode(',', $data['ticket_IDs']) : [];
1286
+
1287
+		// set up some default start and end dates in case those are not present in the incoming data
1288
+		$default_start_date = new DateTime('now', new DateTimeZone($event->get_timezone()));
1289
+		$default_start_date = $default_start_date->format($date_formats[0] . ' ' . $date_formats[1]);
1290
+		// use the start date of the first datetime for the end date
1291
+		$first_datetime   = $event->first_datetime();
1292
+		$default_end_date = $first_datetime->start_date_and_time($date_formats[0], $date_formats[1]);
1293
+
1294
+		// now process the incoming data
1295
+		foreach ($data['edit_tickets'] as $row => $ticket_data) {
1296
+			$update_prices = false;
1297
+			$ticket_price  = isset($data['edit_prices'][ $row ][1]['PRC_amount'])
1298
+				? $data['edit_prices'][ $row ][1]['PRC_amount']
1299
+				: 0;
1300
+			// trim inputs to ensure any excess whitespace is removed.
1301
+			$ticket_data   = array_map('trim', $ticket_data);
1302
+			$ticket_values = [
1303
+				'TKT_ID'          => ! empty($ticket_data['TKT_ID']) ? $ticket_data['TKT_ID'] : null,
1304
+				'TTM_ID'          => ! empty($ticket_data['TTM_ID']) ? $ticket_data['TTM_ID'] : 0,
1305
+				'TKT_name'        => ! empty($ticket_data['TKT_name']) ? $ticket_data['TKT_name'] : '',
1306
+				'TKT_description' => ! empty($ticket_data['TKT_description']) ? $ticket_data['TKT_description'] : '',
1307
+				'TKT_start_date'  => ! empty($ticket_data['TKT_start_date'])
1308
+					? $ticket_data['TKT_start_date']
1309
+					: $default_start_date,
1310
+				'TKT_end_date'    => ! empty($ticket_data['TKT_end_date'])
1311
+					? $ticket_data['TKT_end_date']
1312
+					: $default_end_date,
1313
+				'TKT_qty'         => ! empty($ticket_data['TKT_qty'])
1314
+									 || (isset($ticket_data['TKT_qty']) && (int) $ticket_data['TKT_qty'] === 0)
1315
+					? $ticket_data['TKT_qty']
1316
+					: EE_INF,
1317
+				'TKT_uses'        => ! empty($ticket_data['TKT_uses'])
1318
+									 || (isset($ticket_data['TKT_uses']) && (int) $ticket_data['TKT_uses'] === 0)
1319
+					? $ticket_data['TKT_uses']
1320
+					: EE_INF,
1321
+				'TKT_min'         => ! empty($ticket_data['TKT_min']) ? $ticket_data['TKT_min'] : 0,
1322
+				'TKT_max'         => ! empty($ticket_data['TKT_max']) ? $ticket_data['TKT_max'] : EE_INF,
1323
+				'TKT_order'       => isset($ticket_data['TKT_order']) ? $ticket_data['TKT_order'] : $row,
1324
+				'TKT_price'       => $ticket_price,
1325
+				'TKT_row'         => $row,
1326
+			];
1327
+			// if this is a default ticket, then we need to set the TKT_ID to 0 and update accordingly,
1328
+			// which means in turn that the prices will become new prices as well.
1329
+			if (isset($ticket_data['TKT_is_default']) && $ticket_data['TKT_is_default']) {
1330
+				$ticket_values['TKT_ID']         = 0;
1331
+				$ticket_values['TKT_is_default'] = 0;
1332
+				$update_prices                   = true;
1333
+			}
1334
+			// if we have a TKT_ID then we need to get that existing TKT_obj and update it
1335
+			// we actually do our saves ahead of adding any relations because its entirely possible that this
1336
+			// ticket didn't get removed or added to any datetime in the session but DID have it's items modified.
1337
+			// keep in mind that if the ticket has been sold (and we have changed pricing information),
1338
+			// then we won't be updating the tkt but instead a new tkt will be created and the old one archived.
1339
+			if (! empty($ticket_data['TKT_ID'])) {
1340
+				$existing_ticket = EEM_Ticket::instance($event_timezone)->get_one_by_ID($ticket_data['TKT_ID']);
1341
+				if (! $existing_ticket instanceof EE_Ticket) {
1342
+					throw new RuntimeException(
1343
+						sprintf(
1344
+							esc_html__(
1345
+								'Something went wrong! A valid Ticket could not be retrieved from the database using the supplied ID: %1$d',
1346
+								'event_espresso'
1347
+							),
1348
+							$ticket_data['TKT_ID']
1349
+						)
1350
+					);
1351
+				}
1352
+				$ticket_sold = $existing_ticket->count_related(
1353
+					'Registration',
1354
+					[
1355
+							[
1356
+								'STS_ID' => [
1357
+									'NOT IN',
1358
+									[EEM_Registration::status_id_incomplete],
1359
+								],
1360
+							],
1361
+						]
1362
+				) > 0;
1363
+				// let's just check the total price for the existing ticket and determine if it matches the new total price.
1364
+				// if they are different then we create a new ticket (if $ticket_sold)
1365
+				// if they aren't different then we go ahead and modify existing ticket.
1366
+				$create_new_ticket = $ticket_sold
1367
+									 && $ticket_price !== $existing_ticket->price()
1368
+									 && ! $existing_ticket->deleted();
1369
+				$existing_ticket->set_date_format($date_formats[0]);
1370
+				$existing_ticket->set_time_format($date_formats[1]);
1371
+				// set new values
1372
+				foreach ($ticket_values as $field => $value) {
1373
+					if ($field == 'TKT_qty') {
1374
+						$existing_ticket->set_qty($value);
1375
+					} elseif ($field == 'TKT_price') {
1376
+						$existing_ticket->set('TKT_price', $ticket_price);
1377
+					} else {
1378
+						$existing_ticket->set($field, $value);
1379
+					}
1380
+				}
1381
+				$ticket = $existing_ticket;
1382
+				// if $create_new_ticket is false then we can safely update the existing ticket.
1383
+				//  Otherwise we have to create a new ticket.
1384
+				if ($create_new_ticket) {
1385
+					// archive the old ticket first
1386
+					$existing_ticket->set('TKT_deleted', 1);
1387
+					$existing_ticket->save();
1388
+					// make sure this ticket is still recorded in our $saved_tickets
1389
+					// so we don't run it through the regular trash routine.
1390
+					$saved_tickets[ $existing_ticket->ID() ] = $existing_ticket;
1391
+					// create new ticket that's a copy of the existing except,
1392
+					// (a new id of course and not archived) AND has the new TKT_price associated with it.
1393
+					$new_ticket = clone $existing_ticket;
1394
+					$new_ticket->set('TKT_ID', 0);
1395
+					$new_ticket->set('TKT_deleted', 0);
1396
+					$new_ticket->set('TKT_sold', 0);
1397
+					// now we need to make sure that $new prices are created as well and attached to new ticket.
1398
+					$update_prices = true;
1399
+					$ticket        = $new_ticket;
1400
+				}
1401
+			} else {
1402
+				// no TKT_id so a new ticket
1403
+				$ticket_values['TKT_price'] = $ticket_price;
1404
+				$ticket                     = EE_Ticket::new_instance($ticket_values, $event_timezone, $date_formats);
1405
+				$update_prices              = true;
1406
+			}
1407
+			if (! $ticket instanceof EE_Ticket) {
1408
+				throw new RuntimeException(
1409
+					sprintf(
1410
+						esc_html__(
1411
+							'Something went wrong! A valid Ticket could not be generated or retrieved using the supplied data: %1$s',
1412
+							'event_espresso'
1413
+						),
1414
+						print_r($ticket_values, true)
1415
+					)
1416
+				);
1417
+			}
1418
+			// cap ticket qty by datetime reg limits
1419
+			$ticket->set_qty(min($ticket->qty(), $ticket->qty('reg_limit')));
1420
+			// update ticket.
1421
+			$ticket->save();
1422
+			// before going any further make sure our dates are setup correctly
1423
+			// so that the end date is always equal or greater than the start date.
1424
+			if ($ticket->get_raw('TKT_start_date') > $ticket->get_raw('TKT_end_date')) {
1425
+				$ticket->set('TKT_end_date', $ticket->get('TKT_start_date'));
1426
+				$ticket = EEH_DTT_Helper::date_time_add($ticket, 'TKT_end_date', 'days');
1427
+				$ticket->save();
1428
+			}
1429
+			// initially let's add the ticket to the datetime
1430
+			$datetime->_add_relation_to($ticket, 'Ticket');
1431
+			$saved_tickets[ $ticket->ID() ] = $ticket;
1432
+			// add prices to ticket
1433
+			$prices_data = isset($data['edit_prices'][ $row ]) && is_array($data['edit_prices'][ $row ])
1434
+				? $data['edit_prices'][ $row ]
1435
+				: [];
1436
+			$this->_add_prices_to_ticket($prices_data, $ticket, $update_prices);
1437
+		}
1438
+		// however now we need to handle permanently deleting tickets via the ui.
1439
+		// Keep in mind that the ui does not allow deleting/archiving tickets that have ticket sold.
1440
+		// However, it does allow for deleting tickets that have no tickets sold,
1441
+		// in which case we want to get rid of permanently because there is no need to save in db.
1442
+		$old_tickets     = isset($old_tickets[0]) && $old_tickets[0] === '' ? [] : $old_tickets;
1443
+		$tickets_removed = array_diff($old_tickets, array_keys($saved_tickets));
1444
+		foreach ($tickets_removed as $id) {
1445
+			$id = absint($id);
1446
+			// get the ticket for this id
1447
+			$ticket_to_remove = EEM_Ticket::instance()->get_one_by_ID($id);
1448
+			if (! $ticket_to_remove instanceof EE_Ticket) {
1449
+				continue;
1450
+			}
1451
+			// need to get all the related datetimes on this ticket and remove from every single one of them
1452
+			// (remember this process can ONLY kick off if there are NO tickets sold)
1453
+			$related_datetimes = $ticket_to_remove->get_many_related('Datetime');
1454
+			foreach ($related_datetimes as $related_datetime) {
1455
+				$ticket_to_remove->_remove_relation_to($related_datetime, 'Datetime');
1456
+			}
1457
+			// need to do the same for prices (except these prices can also be deleted because again,
1458
+			// tickets can only be trashed if they don't have any TKTs sold (otherwise they are just archived))
1459
+			$ticket_to_remove->delete_related_permanently('Price');
1460
+			// finally let's delete this ticket
1461
+			// (which should not be blocked at this point b/c we've removed all our relationships)
1462
+			$ticket_to_remove->delete_permanently();
1463
+		}
1464
+		return [$datetime, $saved_tickets];
1465
+	}
1466
+
1467
+
1468
+	/**
1469
+	 * This attaches a list of given prices to a ticket.
1470
+	 * Note we dont' have to worry about ever removing relationships (or archiving prices)
1471
+	 * because if there is a change in price information on a ticket, a new ticket is created anyways
1472
+	 * so the archived ticket will retain the old price info and prices are automatically "archived" via the ticket.
1473
+	 *
1474
+	 * @access  private
1475
+	 * @param array     $prices_data Array of prices from the form.
1476
+	 * @param EE_Ticket $ticket      EE_Ticket object that prices are being attached to.
1477
+	 * @param bool      $new_prices  Whether attach existing incoming prices or create new ones.
1478
+	 * @return  void
1479
+	 * @throws EE_Error
1480
+	 * @throws ReflectionException
1481
+	 */
1482
+	private function _add_prices_to_ticket($prices_data, EE_Ticket $ticket, $new_prices = false)
1483
+	{
1484
+		$timezone = $ticket->get_timezone();
1485
+		foreach ($prices_data as $row => $price_data) {
1486
+			$price_values = [
1487
+				'PRC_ID'         => ! empty($price_data['PRC_ID']) ? $price_data['PRC_ID'] : null,
1488
+				'PRT_ID'         => ! empty($price_data['PRT_ID']) ? $price_data['PRT_ID'] : null,
1489
+				'PRC_amount'     => ! empty($price_data['PRC_amount']) ? $price_data['PRC_amount'] : 0,
1490
+				'PRC_name'       => ! empty($price_data['PRC_name']) ? $price_data['PRC_name'] : '',
1491
+				'PRC_desc'       => ! empty($price_data['PRC_desc']) ? $price_data['PRC_desc'] : '',
1492
+				'PRC_is_default' => 0, // make sure prices are NOT set as default from this context
1493
+				'PRC_order'      => $row,
1494
+			];
1495
+			if ($new_prices || empty($price_values['PRC_ID'])) {
1496
+				$price_values['PRC_ID'] = 0;
1497
+				$price                  = EE_Price::new_instance($price_values, $timezone);
1498
+			} else {
1499
+				$price = EEM_Price::instance($timezone)->get_one_by_ID($price_data['PRC_ID']);
1500
+				// update this price with new values
1501
+				foreach ($price_values as $field => $new_price) {
1502
+					$price->set($field, $new_price);
1503
+				}
1504
+			}
1505
+			if (! $price instanceof EE_Price) {
1506
+				throw new RuntimeException(
1507
+					sprintf(
1508
+						esc_html__(
1509
+							'Something went wrong! A valid Price could not be generated or retrieved using the supplied data: %1$s',
1510
+							'event_espresso'
1511
+						),
1512
+						print_r($price_values, true)
1513
+					)
1514
+				);
1515
+			}
1516
+			$price->save();
1517
+			$ticket->_add_relation_to($price, 'Price');
1518
+		}
1519
+	}
1520
+
1521
+
1522
+	/**
1523
+	 * Add in our autosave ajax handlers
1524
+	 *
1525
+	 */
1526
+	protected function _ee_autosave_create_new()
1527
+	{
1528
+	}
1529
+
1530
+
1531
+	/**
1532
+	 * More autosave handlers.
1533
+	 */
1534
+	protected function _ee_autosave_edit()
1535
+	{
1536
+	}
1537
+
1538
+
1539
+	/**
1540
+	 * @throws EE_Error
1541
+	 * @throws ReflectionException
1542
+	 */
1543
+	private function _generate_publish_box_extra_content()
1544
+	{
1545
+		// load formatter helper
1546
+		// args for getting related registrations
1547
+		$approved_query_args        = [
1548
+			[
1549
+				'REG_deleted' => 0,
1550
+				'STS_ID'      => EEM_Registration::status_id_approved,
1551
+			],
1552
+		];
1553
+		$not_approved_query_args    = [
1554
+			[
1555
+				'REG_deleted' => 0,
1556
+				'STS_ID'      => EEM_Registration::status_id_not_approved,
1557
+			],
1558
+		];
1559
+		$pending_payment_query_args = [
1560
+			[
1561
+				'REG_deleted' => 0,
1562
+				'STS_ID'      => EEM_Registration::status_id_pending_payment,
1563
+			],
1564
+		];
1565
+		// publish box
1566
+		$publish_box_extra_args = [
1567
+			'view_approved_reg_url'        => add_query_arg(
1568
+				[
1569
+					'action'      => 'default',
1570
+					'event_id'    => $this->_cpt_model_obj->ID(),
1571
+					'_reg_status' => EEM_Registration::status_id_approved,
1572
+				],
1573
+				REG_ADMIN_URL
1574
+			),
1575
+			'view_not_approved_reg_url'    => add_query_arg(
1576
+				[
1577
+					'action'      => 'default',
1578
+					'event_id'    => $this->_cpt_model_obj->ID(),
1579
+					'_reg_status' => EEM_Registration::status_id_not_approved,
1580
+				],
1581
+				REG_ADMIN_URL
1582
+			),
1583
+			'view_pending_payment_reg_url' => add_query_arg(
1584
+				[
1585
+					'action'      => 'default',
1586
+					'event_id'    => $this->_cpt_model_obj->ID(),
1587
+					'_reg_status' => EEM_Registration::status_id_pending_payment,
1588
+				],
1589
+				REG_ADMIN_URL
1590
+			),
1591
+			'approved_regs'                => $this->_cpt_model_obj->count_related(
1592
+				'Registration',
1593
+				$approved_query_args
1594
+			),
1595
+			'not_approved_regs'            => $this->_cpt_model_obj->count_related(
1596
+				'Registration',
1597
+				$not_approved_query_args
1598
+			),
1599
+			'pending_payment_regs'         => $this->_cpt_model_obj->count_related(
1600
+				'Registration',
1601
+				$pending_payment_query_args
1602
+			),
1603
+			'misc_pub_section_class'       => apply_filters(
1604
+				'FHEE_Events_Admin_Page___generate_publish_box_extra_content__misc_pub_section_class',
1605
+				'misc-pub-section'
1606
+			),
1607
+		];
1608
+		ob_start();
1609
+		do_action(
1610
+			'AHEE__Events_Admin_Page___generate_publish_box_extra_content__event_editor_overview_add',
1611
+			$this->_cpt_model_obj
1612
+		);
1613
+		$publish_box_extra_args['event_editor_overview_add'] = ob_get_clean();
1614
+		// load template
1615
+		EEH_Template::display_template(
1616
+			EVENTS_TEMPLATE_PATH . 'event_publish_box_extras.template.php',
1617
+			$publish_box_extra_args
1618
+		);
1619
+	}
1620
+
1621
+
1622
+	/**
1623
+	 * @return EE_Event
1624
+	 */
1625
+	public function get_event_object()
1626
+	{
1627
+		return $this->_cpt_model_obj;
1628
+	}
1629
+
1630
+
1631
+
1632
+
1633
+	/** METABOXES * */
1634
+	/**
1635
+	 * _register_event_editor_meta_boxes
1636
+	 * add all metaboxes related to the event_editor
1637
+	 *
1638
+	 * @return void
1639
+	 * @throws EE_Error
1640
+	 * @throws ReflectionException
1641
+	 */
1642
+	protected function _register_event_editor_meta_boxes()
1643
+	{
1644
+		$this->verify_cpt_object();
1645
+		$use_advanced_editor = $this->admin_config->useAdvancedEditor();
1646
+		// check if the new EDTR reg options meta box is being used, and if so, don't load the legacy version
1647
+		if (! $use_advanced_editor || ! $this->feature->allowed('use_reg_options_meta_box')) {
1648
+			$this->addMetaBox(
1649
+				'espresso_event_editor_event_options',
1650
+				esc_html__('Event Registration Options', 'event_espresso'),
1651
+				[$this, 'registration_options_meta_box'],
1652
+				$this->page_slug,
1653
+				'side'
1654
+			);
1655
+		}
1656
+		if (! $use_advanced_editor) {
1657
+			$this->addMetaBox(
1658
+				'espresso_event_editor_tickets',
1659
+				esc_html__('Event Datetime & Ticket', 'event_espresso'),
1660
+				[$this, 'ticket_metabox'],
1661
+				$this->page_slug,
1662
+				'normal',
1663
+				'high'
1664
+			);
1665
+		} elseif ($this->feature->allowed('use_reg_options_meta_box')) {
1666
+			add_action(
1667
+				'add_meta_boxes_espresso_events',
1668
+				function () {
1669
+					global $current_screen;
1670
+					remove_meta_box('authordiv', $current_screen, 'normal');
1671
+				},
1672
+				99
1673
+			);
1674
+		}
1675
+		// NOTE: if you're looking for other metaboxes in here,
1676
+		// where a metabox has a related management page in the admin
1677
+		// you will find it setup in the related management page's "_Hooks" file.
1678
+		// i.e. messages metabox is found in "espresso_events_Messages_Hooks.class.php".
1679
+	}
1680
+
1681
+
1682
+	/**
1683
+	 * @throws DomainException
1684
+	 * @throws EE_Error
1685
+	 * @throws ReflectionException
1686
+	 */
1687
+	public function ticket_metabox()
1688
+	{
1689
+		$existing_datetime_ids = $existing_ticket_ids = [];
1690
+		// defaults for template args
1691
+		$template_args = [
1692
+			'existing_datetime_ids'    => '',
1693
+			'event_datetime_help_link' => '',
1694
+			'ticket_options_help_link' => '',
1695
+			'time'                     => null,
1696
+			'ticket_rows'              => '',
1697
+			'existing_ticket_ids'      => '',
1698
+			'total_ticket_rows'        => 1,
1699
+			'ticket_js_structure'      => '',
1700
+			'trash_icon'               => 'dashicons dashicons-lock',
1701
+			'disabled'                 => '',
1702
+		];
1703
+		$event_id      = is_object($this->_cpt_model_obj) ? $this->_cpt_model_obj->ID() : null;
1704
+		/**
1705
+		 * 1. Start with retrieving Datetimes
1706
+		 * 2. Fore each datetime get related tickets
1707
+		 * 3. For each ticket get related prices
1708
+		 */
1709
+		/** @var EEM_Datetime $datetime_model */
1710
+		$datetime_model = EE_Registry::instance()->load_model('Datetime');
1711
+		/** @var EEM_Ticket $datetime_model */
1712
+		$ticket_model = EE_Registry::instance()->load_model('Ticket');
1713
+		$times        = $datetime_model->get_all_event_dates($event_id);
1714
+		/** @type EE_Datetime $first_datetime */
1715
+		$first_datetime = reset($times);
1716
+		// do we get related tickets?
1717
+		if (
1718
+			$first_datetime instanceof EE_Datetime
1719
+			&& $first_datetime->ID() !== 0
1720
+		) {
1721
+			$existing_datetime_ids[] = $first_datetime->get('DTT_ID');
1722
+			$template_args['time']   = $first_datetime;
1723
+			$related_tickets         = $first_datetime->tickets(
1724
+				[
1725
+					['OR' => ['TKT_deleted' => 1, 'TKT_deleted*' => 0]],
1726
+					'default_where_conditions' => 'none',
1727
+				]
1728
+			);
1729
+			if (! empty($related_tickets)) {
1730
+				$template_args['total_ticket_rows'] = count($related_tickets);
1731
+				$row                                = 0;
1732
+				foreach ($related_tickets as $ticket) {
1733
+					$existing_ticket_ids[]        = $ticket->get('TKT_ID');
1734
+					$template_args['ticket_rows'] .= $this->_get_ticket_row($ticket, false, $row);
1735
+					$row++;
1736
+				}
1737
+			} else {
1738
+				$template_args['total_ticket_rows'] = 1;
1739
+				/** @type EE_Ticket $ticket */
1740
+				$ticket                       = $ticket_model->create_default_object();
1741
+				$template_args['ticket_rows'] .= $this->_get_ticket_row($ticket);
1742
+			}
1743
+		} else {
1744
+			$template_args['time'] = $times[0];
1745
+			/** @type EE_Ticket[] $tickets */
1746
+			$tickets                      = $ticket_model->get_all_default_tickets();
1747
+			$template_args['ticket_rows'] .= $this->_get_ticket_row($tickets[1]);
1748
+			// NOTE: we're just sending the first default row
1749
+			// (decaf can't manage default tickets so this should be sufficient);
1750
+		}
1751
+		$template_args['event_datetime_help_link'] = $this->_get_help_tab_link(
1752
+			'event_editor_event_datetimes_help_tab'
1753
+		);
1754
+		$template_args['ticket_options_help_link'] = $this->_get_help_tab_link('ticket_options_info');
1755
+		$template_args['existing_datetime_ids']    = implode(',', $existing_datetime_ids);
1756
+		$template_args['existing_ticket_ids']      = implode(',', $existing_ticket_ids);
1757
+		$template_args['ticket_js_structure']      = $this->_get_ticket_row(
1758
+			$ticket_model->create_default_object(),
1759
+			true
1760
+		);
1761
+		$template                                  = apply_filters(
1762
+			'FHEE__Events_Admin_Page__ticket_metabox__template',
1763
+			EVENTS_TEMPLATE_PATH . 'event_tickets_metabox_main.template.php'
1764
+		);
1765
+		EEH_Template::display_template($template, $template_args);
1766
+	}
1767
+
1768
+
1769
+	/**
1770
+	 * Setup an individual ticket form for the decaf event editor page
1771
+	 *
1772
+	 * @access private
1773
+	 * @param EE_Ticket $ticket   the ticket object
1774
+	 * @param boolean   $skeleton whether we're generating a skeleton for js manipulation
1775
+	 * @param int       $row
1776
+	 * @return string generated html for the ticket row.
1777
+	 * @throws EE_Error
1778
+	 * @throws ReflectionException
1779
+	 */
1780
+	private function _get_ticket_row($ticket, $skeleton = false, $row = 0)
1781
+	{
1782
+		$template_args = [
1783
+			'tkt_status_class'    => ' tkt-status-' . $ticket->ticket_status(),
1784
+			'tkt_archive_class'   => $ticket->ticket_status() === EE_Ticket::archived && ! $skeleton ? ' tkt-archived'
1785
+				: '',
1786
+			'ticketrow'           => $skeleton ? 'TICKETNUM' : $row,
1787
+			'TKT_ID'              => $ticket->get('TKT_ID'),
1788
+			'TKT_name'            => $ticket->get('TKT_name'),
1789
+			'TKT_start_date'      => $skeleton ? '' : $ticket->get_date('TKT_start_date', 'Y-m-d h:i a'),
1790
+			'TKT_end_date'        => $skeleton ? '' : $ticket->get_date('TKT_end_date', 'Y-m-d h:i a'),
1791
+			'TKT_is_default'      => $ticket->get('TKT_is_default'),
1792
+			'TKT_qty'             => $ticket->get_pretty('TKT_qty', 'input'),
1793
+			'edit_ticketrow_name' => $skeleton ? 'TICKETNAMEATTR' : 'edit_tickets',
1794
+			'TKT_sold'            => $skeleton ? 0 : $ticket->get('TKT_sold'),
1795
+			'trash_icon'          => ($skeleton || (! empty($ticket) && ! $ticket->get('TKT_deleted')))
1796
+									 && (! empty($ticket) && $ticket->get('TKT_sold') === 0)
1797
+				? 'trash-icon dashicons dashicons-post-trash clickable' : 'dashicons dashicons-lock',
1798
+			'disabled'            => $skeleton || (! empty($ticket) && ! $ticket->get('TKT_deleted')) ? ''
1799
+				: ' disabled=disabled',
1800
+		];
1801
+		$price         = $ticket->ID() !== 0
1802
+			? $ticket->get_first_related('Price', ['default_where_conditions' => 'none'])
1803
+			: null;
1804
+		$price         = $price instanceof EE_Price
1805
+			? $price
1806
+			: EEM_Price::instance()->create_default_object();
1807
+		$price_args    = [
1808
+			'price_currency_symbol' => EE_Registry::instance()->CFG->currency->sign,
1809
+			'PRC_amount'            => $price->get('PRC_amount'),
1810
+			'PRT_ID'                => $price->get('PRT_ID'),
1811
+			'PRC_ID'                => $price->get('PRC_ID'),
1812
+			'PRC_is_default'        => $price->get('PRC_is_default'),
1813
+		];
1814
+		// make sure we have default start and end dates if skeleton
1815
+		// handle rows that should NOT be empty
1816
+		if (empty($template_args['TKT_start_date'])) {
1817
+			// if empty then the start date will be now.
1818
+			$template_args['TKT_start_date'] = date('Y-m-d h:i a', current_time('timestamp'));
1819
+		}
1820
+		if (empty($template_args['TKT_end_date'])) {
1821
+			// get the earliest datetime (if present);
1822
+			$earliest_datetime             = $this->_cpt_model_obj->ID() > 0
1823
+				? $this->_cpt_model_obj->get_first_related(
1824
+					'Datetime',
1825
+					['order_by' => ['DTT_EVT_start' => 'ASC']]
1826
+				)
1827
+				: null;
1828
+			$template_args['TKT_end_date'] = $earliest_datetime instanceof EE_Datetime
1829
+				? $earliest_datetime->get_datetime('DTT_EVT_start', 'Y-m-d', 'h:i a')
1830
+				: date('Y-m-d h:i a', mktime(0, 0, 0, date('m'), date('d') + 7, date('Y')));
1831
+		}
1832
+		$template_args = array_merge($template_args, $price_args);
1833
+		$template      = apply_filters(
1834
+			'FHEE__Events_Admin_Page__get_ticket_row__template',
1835
+			EVENTS_TEMPLATE_PATH . 'event_tickets_metabox_ticket_row.template.php',
1836
+			$ticket
1837
+		);
1838
+		return EEH_Template::display_template($template, $template_args, true);
1839
+	}
1840
+
1841
+
1842
+	/**
1843
+	 * @throws EE_Error
1844
+	 * @throws ReflectionException
1845
+	 */
1846
+	public function registration_options_meta_box()
1847
+	{
1848
+		$yes_no_values             = [
1849
+			['id' => true, 'text' => esc_html__('Yes', 'event_espresso')],
1850
+			['id' => false, 'text' => esc_html__('No', 'event_espresso')],
1851
+		];
1852
+		$default_reg_status_values = EEM_Registration::reg_status_array(
1853
+			[
1854
+				EEM_Registration::status_id_cancelled,
1855
+				EEM_Registration::status_id_declined,
1856
+				EEM_Registration::status_id_incomplete,
1857
+			],
1858
+			true
1859
+		);
1860
+		// $template_args['is_active_select'] = EEH_Form_Fields::select_input('is_active', $yes_no_values, $this->_cpt_model_obj->is_active());
1861
+		$template_args['_event']                          = $this->_cpt_model_obj;
1862
+		$template_args['event']                           = $this->_cpt_model_obj;
1863
+		$template_args['active_status']                   = $this->_cpt_model_obj->pretty_active_status(false);
1864
+		$template_args['additional_limit']                = $this->_cpt_model_obj->additional_limit();
1865
+		$template_args['default_registration_status']     = EEH_Form_Fields::select_input(
1866
+			'default_reg_status',
1867
+			$default_reg_status_values,
1868
+			$this->_cpt_model_obj->default_registration_status()
1869
+		);
1870
+		$template_args['display_description']             = EEH_Form_Fields::select_input(
1871
+			'display_desc',
1872
+			$yes_no_values,
1873
+			$this->_cpt_model_obj->display_description()
1874
+		);
1875
+		$template_args['display_ticket_selector']         = EEH_Form_Fields::select_input(
1876
+			'display_ticket_selector',
1877
+			$yes_no_values,
1878
+			$this->_cpt_model_obj->display_ticket_selector(),
1879
+			'',
1880
+			'',
1881
+			false
1882
+		);
1883
+		$template_args['additional_registration_options'] = apply_filters(
1884
+			'FHEE__Events_Admin_Page__registration_options_meta_box__additional_registration_options',
1885
+			'',
1886
+			$template_args,
1887
+			$yes_no_values,
1888
+			$default_reg_status_values
1889
+		);
1890
+		EEH_Template::display_template(
1891
+			EVENTS_TEMPLATE_PATH . 'event_registration_options.template.php',
1892
+			$template_args
1893
+		);
1894
+	}
1895
+
1896
+
1897
+	/**
1898
+	 * _get_events()
1899
+	 * This method simply returns all the events (for the given _view and paging)
1900
+	 *
1901
+	 * @access public
1902
+	 * @param int  $per_page     count of items per page (20 default);
1903
+	 * @param int  $current_page what is the current page being viewed.
1904
+	 * @param bool $count        if TRUE then we just return a count of ALL events matching the given _view.
1905
+	 *                           If FALSE then we return an array of event objects
1906
+	 *                           that match the given _view and paging parameters.
1907
+	 * @return array|int         an array of event objects or a count of them.
1908
+	 * @throws Exception
1909
+	 */
1910
+	public function get_events($per_page = 10, $current_page = 1, $count = false)
1911
+	{
1912
+		$EEM_Event   = $this->_event_model();
1913
+		$offset      = ($current_page - 1) * $per_page;
1914
+		$limit       = $count ? null : $offset . ',' . $per_page;
1915
+		$orderby     = $this->request->getRequestParam('orderby', 'EVT_ID');
1916
+		$order       = $this->request->getRequestParam('order', 'DESC');
1917
+		$month_range = $this->request->getRequestParam('month_range');
1918
+		if ($month_range) {
1919
+			$pieces = explode(' ', $month_range, 3);
1920
+			// simulate the FIRST day of the month, that fixes issues for months like February
1921
+			// where PHP doesn't know what to assume for date.
1922
+			// @see https://events.codebasehq.com/projects/event-espresso/tickets/10437
1923
+			$month_r = ! empty($pieces[0]) ? date('m', EEH_DTT_Helper::first_of_month_timestamp($pieces[0])) : '';
1924
+			$year_r  = ! empty($pieces[1]) ? $pieces[1] : '';
1925
+		}
1926
+		$where  = [];
1927
+		$status = $this->request->getRequestParam('status');
1928
+		// determine what post_status our condition will have for the query.
1929
+		switch ($status) {
1930
+			case 'month':
1931
+			case 'today':
1932
+			case null:
1933
+			case 'all':
1934
+				break;
1935
+			case 'draft':
1936
+				$where['status'] = ['IN', ['draft', 'auto-draft']];
1937
+				break;
1938
+			default:
1939
+				$where['status'] = $status;
1940
+		}
1941
+		// categories? The default for all categories is -1
1942
+		$category = $this->request->getRequestParam('EVT_CAT', -1, 'int');
1943
+		if ($category !== -1) {
1944
+			$where['Term_Taxonomy.taxonomy'] = EEM_CPT_Base::EVENT_CATEGORY_TAXONOMY;
1945
+			$where['Term_Taxonomy.term_id']  = $category;
1946
+		}
1947
+		// date where conditions
1948
+		$start_formats = EEM_Datetime::instance()->get_formats_for('DTT_EVT_start');
1949
+		if ($month_range) {
1950
+			$DateTime = new DateTime(
1951
+				$year_r . '-' . $month_r . '-01 00:00:00',
1952
+				new DateTimeZone('UTC')
1953
+			);
1954
+			$start    = $DateTime->getTimestamp();
1955
+			// set the datetime to be the end of the month
1956
+			$DateTime->setDate(
1957
+				$year_r,
1958
+				$month_r,
1959
+				$DateTime->format('t')
1960
+			)->setTime(23, 59, 59);
1961
+			$end                             = $DateTime->getTimestamp();
1962
+			$where['Datetime.DTT_EVT_start'] = ['BETWEEN', [$start, $end]];
1963
+		} elseif ($status === 'today') {
1964
+			$DateTime                        =
1965
+				new DateTime('now', new DateTimeZone(EEM_Event::instance()->get_timezone()));
1966
+			$start                           = $DateTime->setTime(0, 0)->format(implode(' ', $start_formats));
1967
+			$end                             = $DateTime->setTime(23, 59, 59)->format(implode(' ', $start_formats));
1968
+			$where['Datetime.DTT_EVT_start'] = ['BETWEEN', [$start, $end]];
1969
+		} elseif ($status === 'month') {
1970
+			$now                             = date('Y-m-01');
1971
+			$DateTime                        =
1972
+				new DateTime($now, new DateTimeZone(EEM_Event::instance()->get_timezone()));
1973
+			$start                           = $DateTime->setTime(0, 0)->format(implode(' ', $start_formats));
1974
+			$end                             = $DateTime->setDate(date('Y'), date('m'), $DateTime->format('t'))
1975
+														->setTime(23, 59, 59)
1976
+														->format(implode(' ', $start_formats));
1977
+			$where['Datetime.DTT_EVT_start'] = ['BETWEEN', [$start, $end]];
1978
+		}
1979
+		if (! EE_Registry::instance()->CAP->current_user_can('ee_read_others_events', 'get_events')) {
1980
+			$where['EVT_wp_user'] = get_current_user_id();
1981
+		} else {
1982
+			if (! isset($where['status'])) {
1983
+				if (! EE_Registry::instance()->CAP->current_user_can('ee_read_private_events', 'get_events')) {
1984
+					$where['OR'] = [
1985
+						'status*restrict_private' => ['!=', 'private'],
1986
+						'AND'                     => [
1987
+							'status*inclusive' => ['=', 'private'],
1988
+							'EVT_wp_user'      => get_current_user_id(),
1989
+						],
1990
+					];
1991
+				}
1992
+			}
1993
+		}
1994
+		$wp_user = $this->request->getRequestParam('EVT_wp_user', 0, 'int');
1995
+		if (
1996
+			$wp_user
1997
+			&& $wp_user !== get_current_user_id()
1998
+			&& EE_Registry::instance()->CAP->current_user_can('ee_read_others_events', 'get_events')
1999
+		) {
2000
+			$where['EVT_wp_user'] = $wp_user;
2001
+		}
2002
+		// search query handling
2003
+		$search_term = $this->request->getRequestParam('s');
2004
+		if ($search_term) {
2005
+			$search_term = '%' . $search_term . '%';
2006
+			$where['OR'] = [
2007
+				'EVT_name'       => ['LIKE', $search_term],
2008
+				'EVT_desc'       => ['LIKE', $search_term],
2009
+				'EVT_short_desc' => ['LIKE', $search_term],
2010
+			];
2011
+		}
2012
+		// filter events by venue.
2013
+		$venue = $this->request->getRequestParam('venue', 0, 'int');
2014
+		if ($venue) {
2015
+			$where['Venue.VNU_ID'] = $venue;
2016
+		}
2017
+		$request_params = $this->request->requestParams();
2018
+		$where          = apply_filters('FHEE__Events_Admin_Page__get_events__where', $where, $request_params);
2019
+		$query_params   = apply_filters(
2020
+			'FHEE__Events_Admin_Page__get_events__query_params',
2021
+			[
2022
+				$where,
2023
+				'limit'    => $limit,
2024
+				'order_by' => $orderby,
2025
+				'order'    => $order,
2026
+				'group_by' => 'EVT_ID',
2027
+			],
2028
+			$request_params
2029
+		);
2030
+
2031
+		// let's first check if we have special requests coming in.
2032
+		$active_status = $this->request->getRequestParam('active_status');
2033
+		if ($active_status) {
2034
+			switch ($active_status) {
2035
+				case 'upcoming':
2036
+					return $EEM_Event->get_upcoming_events($query_params, $count);
2037
+				case 'expired':
2038
+					return $EEM_Event->get_expired_events($query_params, $count);
2039
+				case 'active':
2040
+					return $EEM_Event->get_active_events($query_params, $count);
2041
+				case 'inactive':
2042
+					return $EEM_Event->get_inactive_events($query_params, $count);
2043
+			}
2044
+		}
2045
+
2046
+		return $count ? $EEM_Event->count([$where], 'EVT_ID', true) : $EEM_Event->get_all($query_params);
2047
+	}
2048
+
2049
+
2050
+	/**
2051
+	 * handling for WordPress CPT actions (trash, restore, delete)
2052
+	 *
2053
+	 * @param string $post_id
2054
+	 * @throws EE_Error
2055
+	 * @throws ReflectionException
2056
+	 */
2057
+	public function trash_cpt_item($post_id)
2058
+	{
2059
+		$this->request->setRequestParam('EVT_ID', $post_id);
2060
+		$this->_trash_or_restore_event('trash', false);
2061
+	}
2062
+
2063
+
2064
+	/**
2065
+	 * @param string $post_id
2066
+	 * @throws EE_Error
2067
+	 * @throws ReflectionException
2068
+	 */
2069
+	public function restore_cpt_item($post_id)
2070
+	{
2071
+		$this->request->setRequestParam('EVT_ID', $post_id);
2072
+		$this->_trash_or_restore_event('draft', false);
2073
+	}
2074
+
2075
+
2076
+	/**
2077
+	 * @param string $post_id
2078
+	 * @throws EE_Error
2079
+	 * @throws EE_Error
2080
+	 */
2081
+	public function delete_cpt_item($post_id)
2082
+	{
2083
+		throw new EE_Error(
2084
+			esc_html__(
2085
+				'Please contact Event Espresso support with the details of the steps taken to produce this error.',
2086
+				'event_espresso'
2087
+			)
2088
+		);
2089
+		// $this->request->setRequestParam('EVT_ID', $post_id);
2090
+		// $this->_delete_event();
2091
+	}
2092
+
2093
+
2094
+	/**
2095
+	 * _trash_or_restore_event
2096
+	 *
2097
+	 * @access protected
2098
+	 * @param string $event_status
2099
+	 * @param bool   $redirect_after
2100
+	 * @throws EE_Error
2101
+	 * @throws EE_Error
2102
+	 * @throws ReflectionException
2103
+	 */
2104
+	protected function _trash_or_restore_event($event_status = 'trash', $redirect_after = true)
2105
+	{
2106
+		// determine the event id and set to array.
2107
+		$EVT_ID = $this->request->getRequestParam('EVT_ID', 0, 'int');
2108
+		// loop thru events
2109
+		if ($EVT_ID) {
2110
+			// clean status
2111
+			$event_status = sanitize_key($event_status);
2112
+			// grab status
2113
+			if (! empty($event_status)) {
2114
+				$success = $this->_change_event_status($EVT_ID, $event_status);
2115
+			} else {
2116
+				$success = false;
2117
+				$msg     = esc_html__(
2118
+					'An error occurred. The event could not be moved to the trash because a valid event status was not not supplied.',
2119
+					'event_espresso'
2120
+				);
2121
+				EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__);
2122
+			}
2123
+		} else {
2124
+			$success = false;
2125
+			$msg     = esc_html__(
2126
+				'An error occurred. The event could not be moved to the trash because a valid event ID was not not supplied.',
2127
+				'event_espresso'
2128
+			);
2129
+			EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__);
2130
+		}
2131
+		$action = $event_status === 'trash' ? 'moved to the trash' : 'restored from the trash';
2132
+		if ($redirect_after) {
2133
+			$this->_redirect_after_action($success, 'Event', $action, ['action' => 'default']);
2134
+		}
2135
+	}
2136
+
2137
+
2138
+	/**
2139
+	 * _trash_or_restore_events
2140
+	 *
2141
+	 * @access protected
2142
+	 * @param string $event_status
2143
+	 * @return void
2144
+	 * @throws EE_Error
2145
+	 * @throws EE_Error
2146
+	 * @throws ReflectionException
2147
+	 */
2148
+	protected function _trash_or_restore_events($event_status = 'trash')
2149
+	{
2150
+		// clean status
2151
+		$event_status = sanitize_key($event_status);
2152
+		// grab status
2153
+		if (! empty($event_status)) {
2154
+			$success = true;
2155
+			// determine the event id and set to array.
2156
+			$EVT_IDs = $this->request->getRequestParam('EVT_IDs', [], 'int', true);
2157
+			// loop thru events
2158
+			foreach ($EVT_IDs as $EVT_ID) {
2159
+				if ($EVT_ID = absint($EVT_ID)) {
2160
+					$results = $this->_change_event_status($EVT_ID, $event_status);
2161
+					$success = $results !== false ? $success : false;
2162
+				} else {
2163
+					$msg = sprintf(
2164
+						esc_html__(
2165
+							'An error occurred. Event #%d could not be moved to the trash because a valid event ID was not not supplied.',
2166
+							'event_espresso'
2167
+						),
2168
+						$EVT_ID
2169
+					);
2170
+					EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__);
2171
+					$success = false;
2172
+				}
2173
+			}
2174
+		} else {
2175
+			$success = false;
2176
+			$msg     = esc_html__(
2177
+				'An error occurred. The event could not be moved to the trash because a valid event status was not not supplied.',
2178
+				'event_espresso'
2179
+			);
2180
+			EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__);
2181
+		}
2182
+		// in order to force a pluralized result message we need to send back a success status greater than 1
2183
+		$success = $success ? 2 : false;
2184
+		$action  = $event_status === 'trash' ? 'moved to the trash' : 'restored from the trash';
2185
+		$this->_redirect_after_action($success, 'Events', $action, ['action' => 'default']);
2186
+	}
2187
+
2188
+
2189
+	/**
2190
+	 * @param int    $EVT_ID
2191
+	 * @param string $event_status
2192
+	 * @return bool
2193
+	 * @throws EE_Error
2194
+	 * @throws ReflectionException
2195
+	 */
2196
+	private function _change_event_status($EVT_ID = 0, $event_status = '')
2197
+	{
2198
+		// grab event id
2199
+		if (! $EVT_ID) {
2200
+			$msg = esc_html__(
2201
+				'An error occurred. No Event ID or an invalid Event ID was received.',
2202
+				'event_espresso'
2203
+			);
2204
+			EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__);
2205
+			return false;
2206
+		}
2207
+		$this->_cpt_model_obj = EEM_Event::instance()->get_one_by_ID($EVT_ID);
2208
+		// clean status
2209
+		$event_status = sanitize_key($event_status);
2210
+		// grab status
2211
+		if (empty($event_status)) {
2212
+			$msg = esc_html__(
2213
+				'An error occurred. No Event Status or an invalid Event Status was received.',
2214
+				'event_espresso'
2215
+			);
2216
+			EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__);
2217
+			return false;
2218
+		}
2219
+		// was event trashed or restored ?
2220
+		switch ($event_status) {
2221
+			case 'draft':
2222
+				$action = 'restored from the trash';
2223
+				$hook   = 'AHEE_event_restored_from_trash';
2224
+				break;
2225
+			case 'trash':
2226
+				$action = 'moved to the trash';
2227
+				$hook   = 'AHEE_event_moved_to_trash';
2228
+				break;
2229
+			default:
2230
+				$action = 'updated';
2231
+				$hook   = false;
2232
+		}
2233
+		// use class to change status
2234
+		$this->_cpt_model_obj->set_status($event_status);
2235
+		$success = $this->_cpt_model_obj->save();
2236
+		if (! $success) {
2237
+			$msg = sprintf(esc_html__('An error occurred. The event could not be %s.', 'event_espresso'), $action);
2238
+			EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__);
2239
+			return false;
2240
+		}
2241
+		if ($hook) {
2242
+			do_action($hook);
2243
+		}
2244
+		return true;
2245
+	}
2246
+
2247
+
2248
+	/**
2249
+	 * @param array $event_ids
2250
+	 * @return array
2251
+	 * @since   4.10.23.p
2252
+	 */
2253
+	private function cleanEventIds(array $event_ids)
2254
+	{
2255
+		return array_map('absint', $event_ids);
2256
+	}
2257
+
2258
+
2259
+	/**
2260
+	 * @return array
2261
+	 * @since   4.10.23.p
2262
+	 */
2263
+	private function getEventIdsFromRequest()
2264
+	{
2265
+		if ($this->request->requestParamIsSet('EVT_IDs')) {
2266
+			return $this->request->getRequestParam('EVT_IDs', [], 'int', true);
2267
+		} else {
2268
+			return $this->request->getRequestParam('EVT_ID', [], 'int', true);
2269
+		}
2270
+	}
2271
+
2272
+
2273
+	/**
2274
+	 * @param bool $preview_delete
2275
+	 * @throws EE_Error
2276
+	 */
2277
+	protected function _delete_event($preview_delete = true)
2278
+	{
2279
+		$this->_delete_events($preview_delete);
2280
+	}
2281
+
2282
+
2283
+	/**
2284
+	 * Gets the tree traversal batch persister.
2285
+	 *
2286
+	 * @return NodeGroupDao
2287
+	 * @throws InvalidArgumentException
2288
+	 * @throws InvalidDataTypeException
2289
+	 * @throws InvalidInterfaceException
2290
+	 * @since 4.10.12.p
2291
+	 */
2292
+	protected function getModelObjNodeGroupPersister()
2293
+	{
2294
+		if (! $this->model_obj_node_group_persister instanceof NodeGroupDao) {
2295
+			$this->model_obj_node_group_persister =
2296
+				$this->getLoader()->load('\EventEspresso\core\services\orm\tree_traversal\NodeGroupDao');
2297
+		}
2298
+		return $this->model_obj_node_group_persister;
2299
+	}
2300
+
2301
+
2302
+	/**
2303
+	 * @param bool $preview_delete
2304
+	 * @return void
2305
+	 * @throws EE_Error
2306
+	 */
2307
+	protected function _delete_events($preview_delete = true)
2308
+	{
2309
+		$event_ids = $this->getEventIdsFromRequest();
2310
+		if ($preview_delete) {
2311
+			$this->generateDeletionPreview($event_ids);
2312
+		} else {
2313
+			EEM_Event::instance()->delete_permanently([['EVT_ID' => ['IN', $event_ids]]]);
2314
+		}
2315
+	}
2316
+
2317
+
2318
+	/**
2319
+	 * @param array $event_ids
2320
+	 */
2321
+	protected function generateDeletionPreview(array $event_ids)
2322
+	{
2323
+		$event_ids = $this->cleanEventIds($event_ids);
2324
+		// Set a code we can use to reference this deletion task in the batch jobs and preview page.
2325
+		$deletion_job_code = $this->getModelObjNodeGroupPersister()->generateGroupCode();
2326
+		$return_url        = EE_Admin_Page::add_query_args_and_nonce(
2327
+			[
2328
+				'action'            => 'preview_deletion',
2329
+				'deletion_job_code' => $deletion_job_code,
2330
+			],
2331
+			$this->_admin_base_url
2332
+		);
2333
+		EEH_URL::safeRedirectAndExit(
2334
+			EE_Admin_Page::add_query_args_and_nonce(
2335
+				[
2336
+					'page'              => 'espresso_batch',
2337
+					'batch'             => EED_Batch::batch_job,
2338
+					'EVT_IDs'           => $event_ids,
2339
+					'deletion_job_code' => $deletion_job_code,
2340
+					'job_handler'       => urlencode('EventEspressoBatchRequest\JobHandlers\PreviewEventDeletion'),
2341
+					'return_url'        => urlencode($return_url),
2342
+				],
2343
+				admin_url()
2344
+			)
2345
+		);
2346
+	}
2347
+
2348
+
2349
+	/**
2350
+	 * Checks for a POST submission
2351
+	 *
2352
+	 * @since 4.10.12.p
2353
+	 */
2354
+	protected function confirmDeletion()
2355
+	{
2356
+		$deletion_redirect_logic =
2357
+			$this->getLoader()->getShared('\EventEspresso\core\domain\services\admin\events\data\ConfirmDeletion');
2358
+		$deletion_redirect_logic->handle($this->get_request_data(), $this->admin_base_url());
2359
+	}
2360
+
2361
+
2362
+	/**
2363
+	 * A page for users to preview what exactly will be deleted, and confirm they want to delete it.
2364
+	 *
2365
+	 * @throws EE_Error
2366
+	 * @since 4.10.12.p
2367
+	 */
2368
+	protected function previewDeletion()
2369
+	{
2370
+		$preview_deletion_logic =
2371
+			$this->getLoader()->getShared('\EventEspresso\core\domain\services\admin\events\data\PreviewDeletion');
2372
+		$this->set_template_args($preview_deletion_logic->handle($this->get_request_data(), $this->admin_base_url()));
2373
+		$this->display_admin_page_with_no_sidebar();
2374
+	}
2375
+
2376
+
2377
+	/**
2378
+	 * get total number of events
2379
+	 *
2380
+	 * @access public
2381
+	 * @return int
2382
+	 * @throws EE_Error
2383
+	 * @throws EE_Error
2384
+	 */
2385
+	public function total_events()
2386
+	{
2387
+		return EEM_Event::instance()->count(
2388
+			['caps' => 'read_admin'],
2389
+			'EVT_ID',
2390
+			true
2391
+		);
2392
+	}
2393
+
2394
+
2395
+	/**
2396
+	 * get total number of draft events
2397
+	 *
2398
+	 * @access public
2399
+	 * @return int
2400
+	 * @throws EE_Error
2401
+	 * @throws EE_Error
2402
+	 */
2403
+	public function total_events_draft()
2404
+	{
2405
+		return EEM_Event::instance()->count(
2406
+			[
2407
+				['status' => ['IN', ['draft', 'auto-draft']]],
2408
+				'caps' => 'read_admin',
2409
+			],
2410
+			'EVT_ID',
2411
+			true
2412
+		);
2413
+	}
2414
+
2415
+
2416
+	/**
2417
+	 * get total number of trashed events
2418
+	 *
2419
+	 * @access public
2420
+	 * @return int
2421
+	 * @throws EE_Error
2422
+	 * @throws EE_Error
2423
+	 */
2424
+	public function total_trashed_events()
2425
+	{
2426
+		return EEM_Event::instance()->count(
2427
+			[
2428
+				['status' => 'trash'],
2429
+				'caps' => 'read_admin',
2430
+			],
2431
+			'EVT_ID',
2432
+			true
2433
+		);
2434
+	}
2435
+
2436
+
2437
+	/**
2438
+	 *    _default_event_settings
2439
+	 *    This generates the Default Settings Tab
2440
+	 *
2441
+	 * @return void
2442
+	 * @throws DomainException
2443
+	 * @throws EE_Error
2444
+	 * @throws InvalidArgumentException
2445
+	 * @throws InvalidDataTypeException
2446
+	 * @throws InvalidInterfaceException
2447
+	 */
2448
+	protected function _default_event_settings()
2449
+	{
2450
+		$this->_set_add_edit_form_tags('update_default_event_settings');
2451
+		$this->_set_publish_post_box_vars(null, false, false, null, false);
2452
+		$this->_template_args['admin_page_content'] = EEH_HTML::div(
2453
+			$this->_default_event_settings_form()->get_html(),
2454
+			'',
2455
+			'padding'
2456
+		);
2457
+		$this->display_admin_page_with_sidebar();
2458
+	}
2459
+
2460
+
2461
+	/**
2462
+	 * Return the form for event settings.
2463
+	 *
2464
+	 * @return EE_Form_Section_Proper
2465
+	 * @throws EE_Error
2466
+	 */
2467
+	protected function _default_event_settings_form()
2468
+	{
2469
+		$registration_config              = EE_Registry::instance()->CFG->registration;
2470
+		$registration_stati_for_selection = EEM_Registration::reg_status_array(
2471
+		// exclude
2472
+			[
2473
+				EEM_Registration::status_id_cancelled,
2474
+				EEM_Registration::status_id_declined,
2475
+				EEM_Registration::status_id_incomplete,
2476
+				EEM_Registration::status_id_wait_list,
2477
+			],
2478
+			true
2479
+		);
2480
+		// setup Advanced Editor ???
2481
+		if (
2482
+			$this->raw_req_action === 'default_event_settings'
2483
+			|| $this->raw_req_action === 'update_default_event_settings'
2484
+		) {
2485
+			$this->advanced_editor_admin_form = $this->loader->getShared(AdvancedEditorAdminFormSection::class);
2486
+		}
2487
+		return new EE_Form_Section_Proper(
2488
+			[
2489
+				'name'            => 'update_default_event_settings',
2490
+				'html_id'         => 'update_default_event_settings',
2491
+				'html_class'      => 'form-table',
2492
+				'layout_strategy' => new EE_Admin_Two_Column_Layout(),
2493
+				'subsections'     => apply_filters(
2494
+					'FHEE__Events_Admin_Page___default_event_settings_form__form_subsections',
2495
+					[
2496
+						'defaults_section_header' => new EE_Form_Section_HTML(
2497
+							EEH_HTML::h2(
2498
+								esc_html__('Default Settings', 'event_espresso'),
2499
+								'',
2500
+								'ee-admin-settings-hdr'
2501
+							)
2502
+						),
2503
+						'default_reg_status'  => new EE_Select_Input(
2504
+							$registration_stati_for_selection,
2505
+							[
2506
+								'default'         => isset($registration_config->default_STS_ID)
2507
+													 && array_key_exists(
2508
+														 $registration_config->default_STS_ID,
2509
+														 $registration_stati_for_selection
2510
+													 )
2511
+									? sanitize_text_field($registration_config->default_STS_ID)
2512
+									: EEM_Registration::status_id_pending_payment,
2513
+								'html_label_text' => esc_html__('Default Registration Status', 'event_espresso')
2514
+													 . EEH_Template::get_help_tab_link(
2515
+														 'default_settings_status_help_tab'
2516
+													 ),
2517
+								'html_help_text'  => esc_html__(
2518
+									'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.',
2519
+									'event_espresso'
2520
+								),
2521
+							]
2522
+						),
2523
+						'default_max_tickets' => new EE_Integer_Input(
2524
+							[
2525
+								'default'         => isset($registration_config->default_maximum_number_of_tickets)
2526
+									? $registration_config->default_maximum_number_of_tickets
2527
+									: EEM_Event::get_default_additional_limit(),
2528
+								'html_label_text' => esc_html__(
2529
+									'Default Maximum Tickets Allowed Per Order:',
2530
+									'event_espresso'
2531
+								)
2532
+													 . EEH_Template::get_help_tab_link(
2533
+														 'default_maximum_tickets_help_tab"'
2534
+													 ),
2535
+								'html_help_text'  => esc_html__(
2536
+									'This setting allows you to indicate what will be the default for the maximum number of tickets per order when creating new events.',
2537
+									'event_espresso'
2538
+								),
2539
+							]
2540
+						),
2541
+					]
2542
+				),
2543
+			]
2544
+		);
2545
+	}
2546
+
2547
+
2548
+	/**
2549
+	 * @return void
2550
+	 * @throws EE_Error
2551
+	 * @throws InvalidArgumentException
2552
+	 * @throws InvalidDataTypeException
2553
+	 * @throws InvalidInterfaceException
2554
+	 */
2555
+	protected function _update_default_event_settings()
2556
+	{
2557
+		$form = $this->_default_event_settings_form();
2558
+		if ($form->was_submitted()) {
2559
+			$form->receive_form_submission();
2560
+			if ($form->is_valid()) {
2561
+				$registration_config = EE_Registry::instance()->CFG->registration;
2562
+				$valid_data          = $form->valid_data();
2563
+				if (isset($valid_data['default_reg_status'])) {
2564
+					$registration_config->default_STS_ID = $valid_data['default_reg_status'];
2565
+				}
2566
+				if (isset($valid_data['default_max_tickets'])) {
2567
+					$registration_config->default_maximum_number_of_tickets = $valid_data['default_max_tickets'];
2568
+				}
2569
+				do_action(
2570
+					'AHEE__Events_Admin_Page___update_default_event_settings',
2571
+					$valid_data,
2572
+					EE_Registry::instance()->CFG,
2573
+					$this
2574
+				);
2575
+				// update because data was valid!
2576
+				EE_Registry::instance()->CFG->update_espresso_config();
2577
+				EE_Error::overwrite_success();
2578
+				EE_Error::add_success(
2579
+					esc_html__('Default Event Settings were updated', 'event_espresso')
2580
+				);
2581
+			}
2582
+		}
2583
+		$this->_redirect_after_action(0, '', '', ['action' => 'default_event_settings'], true);
2584
+	}
2585
+
2586
+
2587
+	/*************        Templates        *************
21 2588
      *
22
-     * @var EE_Event $_event
23
-     */
24
-    protected $_event;
25
-
26
-
27
-    /**
28
-     * This will hold the category object for category_details screen.
29
-     *
30
-     * @var stdClass $_category
31
-     */
32
-    protected $_category;
33
-
34
-
35
-    /**
36
-     * This will hold the event model instance
37
-     *
38
-     * @var EEM_Event $_event_model
39
-     */
40
-    protected $_event_model;
41
-
42
-
43
-    /**
44
-     * @var EE_Event
45
-     */
46
-    protected $_cpt_model_obj = false;
47
-
48
-
49
-    /**
50
-     * @var NodeGroupDao
51
-     */
52
-    protected $model_obj_node_group_persister;
53
-
54
-    /**
55
-     * @var AdvancedEditorAdminFormSection
56
-     */
57
-    protected $advanced_editor_admin_form;
58
-
59
-
60
-    /**
61
-     * Initialize page props for this admin page group.
62
-     */
63
-    protected function _init_page_props()
64
-    {
65
-        $this->page_slug        = EVENTS_PG_SLUG;
66
-        $this->page_label       = EVENTS_LABEL;
67
-        $this->_admin_base_url  = EVENTS_ADMIN_URL;
68
-        $this->_admin_base_path = EVENTS_ADMIN;
69
-        $this->_cpt_model_names = [
70
-            'create_new' => 'EEM_Event',
71
-            'edit'       => 'EEM_Event',
72
-        ];
73
-        $this->_cpt_edit_routes = [
74
-            'espresso_events' => 'edit',
75
-        ];
76
-        add_action(
77
-            'AHEE__EE_Admin_Page_CPT__set_model_object__after_set_object',
78
-            [$this, 'verify_event_edit'],
79
-            10,
80
-            2
81
-        );
82
-    }
83
-
84
-
85
-    /**
86
-     * Sets the ajax hooks used for this admin page group.
87
-     */
88
-    protected function _ajax_hooks()
89
-    {
90
-        add_action('wp_ajax_ee_save_timezone_setting', [$this, 'saveTimezoneString']);
91
-    }
92
-
93
-
94
-    /**
95
-     * Sets the page properties for this admin page group.
96
-     */
97
-    protected function _define_page_props()
98
-    {
99
-        $this->_admin_page_title = EVENTS_LABEL;
100
-        $this->_labels           = [
101
-            'buttons'      => [
102
-                'add'             => esc_html__('Add New Event', 'event_espresso'),
103
-                'edit'            => esc_html__('Edit Event', 'event_espresso'),
104
-                'delete'          => esc_html__('Delete Event', 'event_espresso'),
105
-                'add_category'    => esc_html__('Add New Category', 'event_espresso'),
106
-                'edit_category'   => esc_html__('Edit Category', 'event_espresso'),
107
-                'delete_category' => esc_html__('Delete Category', 'event_espresso'),
108
-            ],
109
-            'editor_title' => [
110
-                'espresso_events' => esc_html__('Enter event title here', 'event_espresso'),
111
-            ],
112
-            'publishbox'   => [
113
-                'create_new'        => esc_html__('Save New Event', 'event_espresso'),
114
-                'edit'              => esc_html__('Update Event', 'event_espresso'),
115
-                'add_category'      => esc_html__('Save New Category', 'event_espresso'),
116
-                'edit_category'     => esc_html__('Update Category', 'event_espresso'),
117
-                'template_settings' => esc_html__('Update Settings', 'event_espresso'),
118
-            ],
119
-        ];
120
-    }
121
-
122
-
123
-    /**
124
-     * Sets the page routes property for this admin page group.
125
-     */
126
-    protected function _set_page_routes()
127
-    {
128
-        // load formatter helper
129
-        // load field generator helper
130
-        // is there a evt_id in the request?
131
-        $EVT_ID = $this->request->getRequestParam('EVT_ID', 0, 'int');
132
-        $EVT_ID = $this->request->getRequestParam('post', $EVT_ID, 'int');
133
-
134
-        $this->_page_routes = [
135
-            'default'                       => [
136
-                'func'       => '_events_overview_list_table',
137
-                'capability' => 'ee_read_events',
138
-            ],
139
-            'create_new'                    => [
140
-                'func'       => '_create_new_cpt_item',
141
-                'capability' => 'ee_edit_events',
142
-            ],
143
-            'edit'                          => [
144
-                'func'       => '_edit_cpt_item',
145
-                'capability' => 'ee_edit_event',
146
-                'obj_id'     => $EVT_ID,
147
-            ],
148
-            'copy_event'                    => [
149
-                'func'       => '_copy_events',
150
-                'capability' => 'ee_edit_event',
151
-                'obj_id'     => $EVT_ID,
152
-                'noheader'   => true,
153
-            ],
154
-            'trash_event'                   => [
155
-                'func'       => '_trash_or_restore_event',
156
-                'args'       => ['event_status' => 'trash'],
157
-                'capability' => 'ee_delete_event',
158
-                'obj_id'     => $EVT_ID,
159
-                'noheader'   => true,
160
-            ],
161
-            'trash_events'                  => [
162
-                'func'       => '_trash_or_restore_events',
163
-                'args'       => ['event_status' => 'trash'],
164
-                'capability' => 'ee_delete_events',
165
-                'noheader'   => true,
166
-            ],
167
-            'restore_event'                 => [
168
-                'func'       => '_trash_or_restore_event',
169
-                'args'       => ['event_status' => 'draft'],
170
-                'capability' => 'ee_delete_event',
171
-                'obj_id'     => $EVT_ID,
172
-                'noheader'   => true,
173
-            ],
174
-            'restore_events'                => [
175
-                'func'       => '_trash_or_restore_events',
176
-                'args'       => ['event_status' => 'draft'],
177
-                'capability' => 'ee_delete_events',
178
-                'noheader'   => true,
179
-            ],
180
-            'delete_event'                  => [
181
-                'func'       => '_delete_event',
182
-                'capability' => 'ee_delete_event',
183
-                'obj_id'     => $EVT_ID,
184
-                'noheader'   => true,
185
-            ],
186
-            'delete_events'                 => [
187
-                'func'       => '_delete_events',
188
-                'capability' => 'ee_delete_events',
189
-                'noheader'   => true,
190
-            ],
191
-            'view_report'                   => [
192
-                'func'       => '_view_report',
193
-                'capability' => 'ee_edit_events',
194
-            ],
195
-            'default_event_settings'        => [
196
-                'func'       => '_default_event_settings',
197
-                'capability' => 'manage_options',
198
-            ],
199
-            'update_default_event_settings' => [
200
-                'func'       => '_update_default_event_settings',
201
-                'capability' => 'manage_options',
202
-                'noheader'   => true,
203
-            ],
204
-            'template_settings'             => [
205
-                'func'       => '_template_settings',
206
-                'capability' => 'manage_options',
207
-            ],
208
-            // event category tab related
209
-            'add_category'                  => [
210
-                'func'       => '_category_details',
211
-                'capability' => 'ee_edit_event_category',
212
-                'args'       => ['add'],
213
-            ],
214
-            'edit_category'                 => [
215
-                'func'       => '_category_details',
216
-                'capability' => 'ee_edit_event_category',
217
-                'args'       => ['edit'],
218
-            ],
219
-            'delete_categories'             => [
220
-                'func'       => '_delete_categories',
221
-                'capability' => 'ee_delete_event_category',
222
-                'noheader'   => true,
223
-            ],
224
-            'delete_category'               => [
225
-                'func'       => '_delete_categories',
226
-                'capability' => 'ee_delete_event_category',
227
-                'noheader'   => true,
228
-            ],
229
-            'insert_category'               => [
230
-                'func'       => '_insert_or_update_category',
231
-                'args'       => ['new_category' => true],
232
-                'capability' => 'ee_edit_event_category',
233
-                'noheader'   => true,
234
-            ],
235
-            'update_category'               => [
236
-                'func'       => '_insert_or_update_category',
237
-                'args'       => ['new_category' => false],
238
-                'capability' => 'ee_edit_event_category',
239
-                'noheader'   => true,
240
-            ],
241
-            'category_list'                 => [
242
-                'func'       => '_category_list_table',
243
-                'capability' => 'ee_manage_event_categories',
244
-            ],
245
-            'preview_deletion'              => [
246
-                'func'       => 'previewDeletion',
247
-                'capability' => 'ee_delete_events',
248
-            ],
249
-            'confirm_deletion'              => [
250
-                'func'       => 'confirmDeletion',
251
-                'capability' => 'ee_delete_events',
252
-                'noheader'   => true,
253
-            ],
254
-        ];
255
-    }
256
-
257
-
258
-    /**
259
-     * Set the _page_config property for this admin page group.
260
-     */
261
-    protected function _set_page_config()
262
-    {
263
-        $post_id            = $this->request->getRequestParam('post', 0, 'int');
264
-        $EVT_CAT_ID         = $this->request->getRequestParam('EVT_CAT_ID', 0, 'int');
265
-        $this->_page_config = [
266
-            'default'                => [
267
-                'nav'           => [
268
-                    'label' => esc_html__('Overview', 'event_espresso'),
269
-                    'order' => 10,
270
-                ],
271
-                'list_table'    => 'Events_Admin_List_Table',
272
-                'help_tabs'     => [
273
-                    'events_overview_help_tab'                       => [
274
-                        'title'    => esc_html__('Events Overview', 'event_espresso'),
275
-                        'filename' => 'events_overview',
276
-                    ],
277
-                    'events_overview_table_column_headings_help_tab' => [
278
-                        'title'    => esc_html__('Events Overview Table Column Headings', 'event_espresso'),
279
-                        'filename' => 'events_overview_table_column_headings',
280
-                    ],
281
-                    'events_overview_filters_help_tab'               => [
282
-                        'title'    => esc_html__('Events Overview Filters', 'event_espresso'),
283
-                        'filename' => 'events_overview_filters',
284
-                    ],
285
-                    'events_overview_view_help_tab'                  => [
286
-                        'title'    => esc_html__('Events Overview Views', 'event_espresso'),
287
-                        'filename' => 'events_overview_views',
288
-                    ],
289
-                    'events_overview_other_help_tab'                 => [
290
-                        'title'    => esc_html__('Events Overview Other', 'event_espresso'),
291
-                        'filename' => 'events_overview_other',
292
-                    ],
293
-                ],
294
-                'require_nonce' => false,
295
-            ],
296
-            'create_new'             => [
297
-                'nav'           => [
298
-                    'label'      => esc_html__('Add New Event', 'event_espresso'),
299
-                    'order'      => 5,
300
-                    'persistent' => false,
301
-                ],
302
-                'metaboxes'     => ['_register_event_editor_meta_boxes'],
303
-                'help_tabs'     => [
304
-                    'event_editor_help_tab'                            => [
305
-                        'title'    => esc_html__('Event Editor', 'event_espresso'),
306
-                        'filename' => 'event_editor',
307
-                    ],
308
-                    'event_editor_title_richtexteditor_help_tab'       => [
309
-                        'title'    => esc_html__('Event Title & Rich Text Editor', 'event_espresso'),
310
-                        'filename' => 'event_editor_title_richtexteditor',
311
-                    ],
312
-                    'event_editor_venue_details_help_tab'              => [
313
-                        'title'    => esc_html__('Event Venue Details', 'event_espresso'),
314
-                        'filename' => 'event_editor_venue_details',
315
-                    ],
316
-                    'event_editor_event_datetimes_help_tab'            => [
317
-                        'title'    => esc_html__('Event Datetimes', 'event_espresso'),
318
-                        'filename' => 'event_editor_event_datetimes',
319
-                    ],
320
-                    'event_editor_event_tickets_help_tab'              => [
321
-                        'title'    => esc_html__('Event Tickets', 'event_espresso'),
322
-                        'filename' => 'event_editor_event_tickets',
323
-                    ],
324
-                    'event_editor_event_registration_options_help_tab' => [
325
-                        'title'    => esc_html__('Event Registration Options', 'event_espresso'),
326
-                        'filename' => 'event_editor_event_registration_options',
327
-                    ],
328
-                    'event_editor_tags_categories_help_tab'            => [
329
-                        'title'    => esc_html__('Event Tags & Categories', 'event_espresso'),
330
-                        'filename' => 'event_editor_tags_categories',
331
-                    ],
332
-                    'event_editor_questions_registrants_help_tab'      => [
333
-                        'title'    => esc_html__('Questions for Registrants', 'event_espresso'),
334
-                        'filename' => 'event_editor_questions_registrants',
335
-                    ],
336
-                    'event_editor_save_new_event_help_tab'             => [
337
-                        'title'    => esc_html__('Save New Event', 'event_espresso'),
338
-                        'filename' => 'event_editor_save_new_event',
339
-                    ],
340
-                    'event_editor_other_help_tab'                      => [
341
-                        'title'    => esc_html__('Event Other', 'event_espresso'),
342
-                        'filename' => 'event_editor_other',
343
-                    ],
344
-                ],
345
-                'qtips'         => ['EE_Event_Editor_Decaf_Tips'],
346
-                'require_nonce' => false,
347
-            ],
348
-            'edit'                   => [
349
-                'nav'           => [
350
-                    'label'      => esc_html__('Edit Event', 'event_espresso'),
351
-                    'order'      => 5,
352
-                    'persistent' => false,
353
-                    'url'        => $post_id
354
-                        ? EE_Admin_Page::add_query_args_and_nonce(
355
-                            ['post' => $post_id, 'action' => 'edit'],
356
-                            $this->_current_page_view_url
357
-                        )
358
-                        : $this->_admin_base_url,
359
-                ],
360
-                'metaboxes'     => ['_register_event_editor_meta_boxes'],
361
-                'help_tabs'     => [
362
-                    'event_editor_help_tab'                            => [
363
-                        'title'    => esc_html__('Event Editor', 'event_espresso'),
364
-                        'filename' => 'event_editor',
365
-                    ],
366
-                    'event_editor_title_richtexteditor_help_tab'       => [
367
-                        'title'    => esc_html__('Event Title & Rich Text Editor', 'event_espresso'),
368
-                        'filename' => 'event_editor_title_richtexteditor',
369
-                    ],
370
-                    'event_editor_venue_details_help_tab'              => [
371
-                        'title'    => esc_html__('Event Venue Details', 'event_espresso'),
372
-                        'filename' => 'event_editor_venue_details',
373
-                    ],
374
-                    'event_editor_event_datetimes_help_tab'            => [
375
-                        'title'    => esc_html__('Event Datetimes', 'event_espresso'),
376
-                        'filename' => 'event_editor_event_datetimes',
377
-                    ],
378
-                    'event_editor_event_tickets_help_tab'              => [
379
-                        'title'    => esc_html__('Event Tickets', 'event_espresso'),
380
-                        'filename' => 'event_editor_event_tickets',
381
-                    ],
382
-                    'event_editor_event_registration_options_help_tab' => [
383
-                        'title'    => esc_html__('Event Registration Options', 'event_espresso'),
384
-                        'filename' => 'event_editor_event_registration_options',
385
-                    ],
386
-                    'event_editor_tags_categories_help_tab'            => [
387
-                        'title'    => esc_html__('Event Tags & Categories', 'event_espresso'),
388
-                        'filename' => 'event_editor_tags_categories',
389
-                    ],
390
-                    'event_editor_questions_registrants_help_tab'      => [
391
-                        'title'    => esc_html__('Questions for Registrants', 'event_espresso'),
392
-                        'filename' => 'event_editor_questions_registrants',
393
-                    ],
394
-                    'event_editor_save_new_event_help_tab'             => [
395
-                        'title'    => esc_html__('Save New Event', 'event_espresso'),
396
-                        'filename' => 'event_editor_save_new_event',
397
-                    ],
398
-                    'event_editor_other_help_tab'                      => [
399
-                        'title'    => esc_html__('Event Other', 'event_espresso'),
400
-                        'filename' => 'event_editor_other',
401
-                    ],
402
-                ],
403
-                'require_nonce' => false,
404
-            ],
405
-            'default_event_settings' => [
406
-                'nav'           => [
407
-                    'label' => esc_html__('Default Settings', 'event_espresso'),
408
-                    'order' => 40,
409
-                ],
410
-                'metaboxes'     => array_merge($this->_default_espresso_metaboxes, ['_publish_post_box']),
411
-                'labels'        => [
412
-                    'publishbox' => esc_html__('Update Settings', 'event_espresso'),
413
-                ],
414
-                'help_tabs'     => [
415
-                    'default_settings_help_tab'        => [
416
-                        'title'    => esc_html__('Default Event Settings', 'event_espresso'),
417
-                        'filename' => 'events_default_settings',
418
-                    ],
419
-                    'default_settings_status_help_tab' => [
420
-                        'title'    => esc_html__('Default Registration Status', 'event_espresso'),
421
-                        'filename' => 'events_default_settings_status',
422
-                    ],
423
-                    'default_maximum_tickets_help_tab' => [
424
-                        'title'    => esc_html__('Default Maximum Tickets Per Order', 'event_espresso'),
425
-                        'filename' => 'events_default_settings_max_tickets',
426
-                    ],
427
-                ],
428
-                'require_nonce' => false,
429
-            ],
430
-            // template settings
431
-            'template_settings'      => [
432
-                'nav'           => [
433
-                    'label' => esc_html__('Templates', 'event_espresso'),
434
-                    'order' => 30,
435
-                ],
436
-                'metaboxes'     => $this->_default_espresso_metaboxes,
437
-                'help_tabs'     => [
438
-                    'general_settings_templates_help_tab' => [
439
-                        'title'    => esc_html__('Templates', 'event_espresso'),
440
-                        'filename' => 'general_settings_templates',
441
-                    ],
442
-                ],
443
-                'require_nonce' => false,
444
-            ],
445
-            // event category stuff
446
-            'add_category'           => [
447
-                'nav'           => [
448
-                    'label'      => esc_html__('Add Category', 'event_espresso'),
449
-                    'order'      => 15,
450
-                    'persistent' => false,
451
-                ],
452
-                'help_tabs'     => [
453
-                    'add_category_help_tab' => [
454
-                        'title'    => esc_html__('Add New Event Category', 'event_espresso'),
455
-                        'filename' => 'events_add_category',
456
-                    ],
457
-                ],
458
-                'metaboxes'     => ['_publish_post_box'],
459
-                'require_nonce' => false,
460
-            ],
461
-            'edit_category'          => [
462
-                'nav'           => [
463
-                    'label'      => esc_html__('Edit Category', 'event_espresso'),
464
-                    'order'      => 15,
465
-                    'persistent' => false,
466
-                    'url'        => $EVT_CAT_ID
467
-                        ? add_query_arg(
468
-                            ['EVT_CAT_ID' => $EVT_CAT_ID],
469
-                            $this->_current_page_view_url
470
-                        )
471
-                        : $this->_admin_base_url,
472
-                ],
473
-                'help_tabs'     => [
474
-                    'edit_category_help_tab' => [
475
-                        'title'    => esc_html__('Edit Event Category', 'event_espresso'),
476
-                        'filename' => 'events_edit_category',
477
-                    ],
478
-                ],
479
-                'metaboxes'     => ['_publish_post_box'],
480
-                'require_nonce' => false,
481
-            ],
482
-            'category_list'          => [
483
-                'nav'           => [
484
-                    'label' => esc_html__('Categories', 'event_espresso'),
485
-                    'order' => 20,
486
-                ],
487
-                'list_table'    => 'Event_Categories_Admin_List_Table',
488
-                'help_tabs'     => [
489
-                    'events_categories_help_tab'                       => [
490
-                        'title'    => esc_html__('Event Categories', 'event_espresso'),
491
-                        'filename' => 'events_categories',
492
-                    ],
493
-                    'events_categories_table_column_headings_help_tab' => [
494
-                        'title'    => esc_html__('Event Categories Table Column Headings', 'event_espresso'),
495
-                        'filename' => 'events_categories_table_column_headings',
496
-                    ],
497
-                    'events_categories_view_help_tab'                  => [
498
-                        'title'    => esc_html__('Event Categories Views', 'event_espresso'),
499
-                        'filename' => 'events_categories_views',
500
-                    ],
501
-                    'events_categories_other_help_tab'                 => [
502
-                        'title'    => esc_html__('Event Categories Other', 'event_espresso'),
503
-                        'filename' => 'events_categories_other',
504
-                    ],
505
-                ],
506
-                'metaboxes'     => $this->_default_espresso_metaboxes,
507
-                'require_nonce' => false,
508
-            ],
509
-            'preview_deletion'       => [
510
-                'nav'           => [
511
-                    'label'      => esc_html__('Preview Deletion', 'event_espresso'),
512
-                    'order'      => 15,
513
-                    'persistent' => false,
514
-                    'url'        => '',
515
-                ],
516
-                'require_nonce' => false,
517
-            ],
518
-        ];
519
-    }
520
-
521
-
522
-    /**
523
-     * Used to register any global screen options if necessary for every route in this admin page group.
524
-     */
525
-    protected function _add_screen_options()
526
-    {
527
-    }
528
-
529
-
530
-    /**
531
-     * Implementing the screen options for the 'default' route.
532
-     *
533
-     * @throws InvalidArgumentException
534
-     * @throws InvalidDataTypeException
535
-     * @throws InvalidInterfaceException
536
-     */
537
-    protected function _add_screen_options_default()
538
-    {
539
-        $this->_per_page_screen_option();
540
-    }
541
-
542
-
543
-    /**
544
-     * Implementing screen options for the category list route.
545
-     *
546
-     * @throws InvalidArgumentException
547
-     * @throws InvalidDataTypeException
548
-     * @throws InvalidInterfaceException
549
-     */
550
-    protected function _add_screen_options_category_list()
551
-    {
552
-        $page_title              = $this->_admin_page_title;
553
-        $this->_admin_page_title = esc_html__('Categories', 'event_espresso');
554
-        $this->_per_page_screen_option();
555
-        $this->_admin_page_title = $page_title;
556
-    }
557
-
558
-
559
-    /**
560
-     * Used to register any global feature pointers for the admin page group.
561
-     */
562
-    protected function _add_feature_pointers()
563
-    {
564
-    }
565
-
566
-
567
-    /**
568
-     * Registers and enqueues any global scripts and styles for the entire admin page group.
569
-     */
570
-    public function load_scripts_styles()
571
-    {
572
-        wp_register_style(
573
-            'events-admin-css',
574
-            EVENTS_ASSETS_URL . 'events-admin-page.css',
575
-            [],
576
-            EVENT_ESPRESSO_VERSION
577
-        );
578
-        wp_register_style(
579
-            'ee-cat-admin',
580
-            EVENTS_ASSETS_URL . 'ee-cat-admin.css',
581
-            [],
582
-            EVENT_ESPRESSO_VERSION
583
-        );
584
-        wp_enqueue_style('events-admin-css');
585
-        wp_enqueue_style('ee-cat-admin');
586
-        // scripts
587
-        wp_register_script(
588
-            'event_editor_js',
589
-            EVENTS_ASSETS_URL . 'event_editor.js',
590
-            ['ee_admin_js', 'jquery-ui-slider', 'jquery-ui-timepicker-addon'],
591
-            EVENT_ESPRESSO_VERSION,
592
-            true
593
-        );
594
-    }
595
-
596
-
597
-    /**
598
-     * Enqueuing scripts and styles specific to this view
599
-     */
600
-    public function load_scripts_styles_create_new()
601
-    {
602
-        $this->load_scripts_styles_edit();
603
-    }
604
-
605
-
606
-    /**
607
-     * Enqueuing scripts and styles specific to this view
608
-     */
609
-    public function load_scripts_styles_edit()
610
-    {
611
-        // styles
612
-        wp_enqueue_style('espresso-ui-theme');
613
-        wp_register_style(
614
-            'event-editor-css',
615
-            EVENTS_ASSETS_URL . 'event-editor.css',
616
-            ['ee-admin-css'],
617
-            EVENT_ESPRESSO_VERSION
618
-        );
619
-        wp_enqueue_style('event-editor-css');
620
-        // scripts
621
-        if (! $this->admin_config->useAdvancedEditor()) {
622
-            wp_register_script(
623
-                'event-datetime-metabox',
624
-                EVENTS_ASSETS_URL . 'event-datetime-metabox.js',
625
-                ['event_editor_js', 'ee-datepicker'],
626
-                EVENT_ESPRESSO_VERSION
627
-            );
628
-            wp_enqueue_script('event-datetime-metabox');
629
-        }
630
-    }
631
-
632
-
633
-    /**
634
-     * Populating the _views property for the category list table view.
635
-     */
636
-    protected function _set_list_table_views_category_list()
637
-    {
638
-        $this->_views = [
639
-            'all' => [
640
-                'slug'        => 'all',
641
-                'label'       => esc_html__('All', 'event_espresso'),
642
-                'count'       => 0,
643
-                'bulk_action' => [
644
-                    'delete_categories' => esc_html__('Delete Permanently', 'event_espresso'),
645
-                ],
646
-            ],
647
-        ];
648
-    }
649
-
650
-
651
-    /**
652
-     * For adding anything that fires on the admin_init hook for any route within this admin page group.
653
-     */
654
-    public function admin_init()
655
-    {
656
-        EE_Registry::$i18n_js_strings['image_confirm'] = esc_html__(
657
-            'Do you really want to delete this image? Please remember to update your event to complete the removal.',
658
-            'event_espresso'
659
-        );
660
-    }
661
-
662
-
663
-    /**
664
-     * For adding anything that should be triggered on the admin_notices hook for any route within this admin page
665
-     * group.
666
-     */
667
-    public function admin_notices()
668
-    {
669
-    }
670
-
671
-
672
-    /**
673
-     * For adding anything that should be triggered on the `admin_print_footer_scripts` hook for any route within
674
-     * this admin page group.
675
-     */
676
-    public function admin_footer_scripts()
677
-    {
678
-    }
679
-
680
-
681
-    /**
682
-     * Call this function to verify if an event is public and has tickets for sale.  If it does, then we need to show a
683
-     * warning (via EE_Error::add_error());
684
-     *
685
-     * @param EE_Event $event Event object
686
-     * @param string   $req_type
687
-     * @return void
688
-     * @throws EE_Error
689
-     * @throws ReflectionException
690
-     */
691
-    public function verify_event_edit($event = null, $req_type = '')
692
-    {
693
-        // don't need to do this when processing
694
-        if (! empty($req_type)) {
695
-            return;
696
-        }
697
-        // no event?
698
-        if (! $event instanceof EE_Event) {
699
-            $event = $this->_cpt_model_obj;
700
-        }
701
-        // STILL no event?
702
-        if (! $event instanceof EE_Event) {
703
-            return;
704
-        }
705
-        $orig_status = $event->status();
706
-        // first check if event is active.
707
-        if (
708
-            $orig_status === EEM_Event::cancelled
709
-            || $orig_status === EEM_Event::postponed
710
-            || $event->is_expired()
711
-            || $event->is_inactive()
712
-        ) {
713
-            return;
714
-        }
715
-        // made it here so it IS active... next check that any of the tickets are sold.
716
-        if ($event->is_sold_out(true)) {
717
-            if ($orig_status !== EEM_Event::sold_out && $event->status() !== $orig_status) {
718
-                EE_Error::add_attention(
719
-                    sprintf(
720
-                        esc_html__(
721
-                            '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.',
722
-                            'event_espresso'
723
-                        ),
724
-                        EEH_Template::pretty_status(EEM_Event::sold_out, false, 'sentence')
725
-                    )
726
-                );
727
-            }
728
-            return;
729
-        }
730
-        if ($orig_status === EEM_Event::sold_out) {
731
-            EE_Error::add_attention(
732
-                sprintf(
733
-                    esc_html__(
734
-                        '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.',
735
-                        'event_espresso'
736
-                    ),
737
-                    EEH_Template::pretty_status($event->status(), false, 'sentence')
738
-                )
739
-            );
740
-        }
741
-        // now we need to determine if the event has any tickets on sale.  If not then we dont' show the error
742
-        if (! $event->tickets_on_sale()) {
743
-            return;
744
-        }
745
-        // made it here so show warning
746
-        $this->_edit_event_warning();
747
-    }
748
-
749
-
750
-    /**
751
-     * This is the text used for when an event is being edited that is public and has tickets for sale.
752
-     * When needed, hook this into a EE_Error::add_error() notice.
753
-     *
754
-     * @access protected
755
-     * @return void
756
-     */
757
-    protected function _edit_event_warning()
758
-    {
759
-        // we don't want to add warnings during these requests
760
-        if ($this->request->getRequestParam('action') === 'editpost') {
761
-            return;
762
-        }
763
-        EE_Error::add_attention(
764
-            sprintf(
765
-                esc_html__(
766
-                    'Your event is open for registration. Making changes may disrupt any transactions in progress. %sLearn more%s',
767
-                    'event_espresso'
768
-                ),
769
-                '<a class="espresso-help-tab-lnk ee-help-tab-link">',
770
-                '</a>'
771
-            )
772
-        );
773
-    }
774
-
775
-
776
-    /**
777
-     * When a user is creating a new event, notify them if they haven't set their timezone.
778
-     * Otherwise, do the normal logic
779
-     *
780
-     * @return void
781
-     * @throws EE_Error
782
-     * @throws InvalidArgumentException
783
-     * @throws InvalidDataTypeException
784
-     * @throws InvalidInterfaceException
785
-     */
786
-    protected function _create_new_cpt_item()
787
-    {
788
-        $has_timezone_string = get_option('timezone_string');
789
-        // only nag them about setting their timezone if it's their first event, and they haven't already done it
790
-        if (! $has_timezone_string && ! EEM_Event::instance()->exists([])) {
791
-            EE_Error::add_attention(
792
-                sprintf(
793
-                    esc_html__(
794
-                        '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',
795
-                        'event_espresso'
796
-                    ),
797
-                    '<br>',
798
-                    '<select id="timezone_string" name="timezone_string" aria-describedby="timezone-description">'
799
-                    . EEH_DTT_Helper::wp_timezone_choice('', EEH_DTT_Helper::get_user_locale())
800
-                    . '</select>',
801
-                    '<button class="button button--secondary timezone-submit">',
802
-                    '</button><span class="spinner"></span>'
803
-                ),
804
-                __FILE__,
805
-                __FUNCTION__,
806
-                __LINE__
807
-            );
808
-        }
809
-        parent::_create_new_cpt_item();
810
-    }
811
-
812
-
813
-    /**
814
-     * Sets the _views property for the default route in this admin page group.
815
-     */
816
-    protected function _set_list_table_views_default()
817
-    {
818
-        $this->_views = [
819
-            'all'   => [
820
-                'slug'        => 'all',
821
-                'label'       => esc_html__('View All Events', 'event_espresso'),
822
-                'count'       => 0,
823
-                'bulk_action' => [
824
-                    'trash_events' => esc_html__('Move to Trash', 'event_espresso'),
825
-                ],
826
-            ],
827
-            'draft' => [
828
-                'slug'        => 'draft',
829
-                'label'       => esc_html__('Draft', 'event_espresso'),
830
-                'count'       => 0,
831
-                'bulk_action' => [
832
-                    'trash_events' => esc_html__('Move to Trash', 'event_espresso'),
833
-                ],
834
-            ],
835
-        ];
836
-        if (EE_Registry::instance()->CAP->current_user_can('ee_delete_events', 'espresso_events_trash_events')) {
837
-            $this->_views['trash'] = [
838
-                'slug'        => 'trash',
839
-                'label'       => esc_html__('Trash', 'event_espresso'),
840
-                'count'       => 0,
841
-                'bulk_action' => [
842
-                    'restore_events' => esc_html__('Restore From Trash', 'event_espresso'),
843
-                    'delete_events'  => esc_html__('Delete Permanently', 'event_espresso'),
844
-                ],
845
-            ];
846
-        }
847
-    }
848
-
849
-
850
-    /**
851
-     * Provides the legend item array for the default list table view.
852
-     *
853
-     * @return array
854
-     * @throws EE_Error
855
-     * @throws EE_Error
856
-     */
857
-    protected function _event_legend_items()
858
-    {
859
-        $items    = [
860
-            'view_details'   => [
861
-                'class' => 'dashicons dashicons-visibility',
862
-                'desc'  => esc_html__('View Event', 'event_espresso'),
863
-            ],
864
-            'edit_event'     => [
865
-                'class' => 'dashicons dashicons-calendar-alt',
866
-                'desc'  => esc_html__('Edit Event Details', 'event_espresso'),
867
-            ],
868
-            'view_attendees' => [
869
-                'class' => 'dashicons dashicons-groups',
870
-                'desc'  => esc_html__('View Registrations for Event', 'event_espresso'),
871
-            ],
872
-        ];
873
-        $items    = apply_filters('FHEE__Events_Admin_Page___event_legend_items__items', $items);
874
-        $statuses = [
875
-            'sold_out_status'  => [
876
-                'class' => 'ee-status-legend ee-status-bg--' . EE_Datetime::sold_out,
877
-                'desc'  => EEH_Template::pretty_status(EE_Datetime::sold_out, false, 'sentence'),
878
-            ],
879
-            'active_status'    => [
880
-                'class' => 'ee-status-legend ee-status-bg--' . EE_Datetime::active,
881
-                'desc'  => EEH_Template::pretty_status(EE_Datetime::active, false, 'sentence'),
882
-            ],
883
-            'upcoming_status'  => [
884
-                'class' => 'ee-status-legend ee-status-bg--' . EE_Datetime::upcoming,
885
-                'desc'  => EEH_Template::pretty_status(EE_Datetime::upcoming, false, 'sentence'),
886
-            ],
887
-            'postponed_status' => [
888
-                'class' => 'ee-status-legend ee-status-bg--' . EE_Datetime::postponed,
889
-                'desc'  => EEH_Template::pretty_status(EE_Datetime::postponed, false, 'sentence'),
890
-            ],
891
-            'cancelled_status' => [
892
-                'class' => 'ee-status-legend ee-status-bg--' . EE_Datetime::cancelled,
893
-                'desc'  => EEH_Template::pretty_status(EE_Datetime::cancelled, false, 'sentence'),
894
-            ],
895
-            'expired_status'   => [
896
-                'class' => 'ee-status-legend ee-status-bg--' . EE_Datetime::expired,
897
-                'desc'  => EEH_Template::pretty_status(EE_Datetime::expired, false, 'sentence'),
898
-            ],
899
-            'inactive_status'  => [
900
-                'class' => 'ee-status-legend ee-status-bg--' . EE_Datetime::inactive,
901
-                'desc'  => EEH_Template::pretty_status(EE_Datetime::inactive, false, 'sentence'),
902
-            ],
903
-        ];
904
-        $statuses = apply_filters('FHEE__Events_Admin_Page__event_legend_items__statuses', $statuses);
905
-        return array_merge($items, $statuses);
906
-    }
907
-
908
-
909
-    /**
910
-     * @return EEM_Event
911
-     * @throws EE_Error
912
-     * @throws InvalidArgumentException
913
-     * @throws InvalidDataTypeException
914
-     * @throws InvalidInterfaceException
915
-     * @throws ReflectionException
916
-     */
917
-    private function _event_model()
918
-    {
919
-        if (! $this->_event_model instanceof EEM_Event) {
920
-            $this->_event_model = EE_Registry::instance()->load_model('Event');
921
-        }
922
-        return $this->_event_model;
923
-    }
924
-
925
-
926
-    /**
927
-     * Adds extra buttons to the WP CPT permalink field row.
928
-     * Method is called from parent and is hooked into the wp 'get_sample_permalink_html' filter.
929
-     *
930
-     * @param string $return    the current html
931
-     * @param int    $id        the post id for the page
932
-     * @param string $new_title What the title is
933
-     * @param string $new_slug  what the slug is
934
-     * @return string            The new html string for the permalink area
935
-     */
936
-    public function extra_permalink_field_buttons($return, $id, $new_title, $new_slug)
937
-    {
938
-        // make sure this is only when editing
939
-        if (! empty($id)) {
940
-            $post = get_post($id);
941
-            $return .= '<a class="button button--small button--secondary" onclick="prompt(\'Shortcode:\', jQuery(\'#shortcode\').val()); return false;" href="#"  tabindex="-1">'
942
-                       . esc_html__('Shortcode', 'event_espresso')
943
-                       . '</a> ';
944
-            $return .= '<input id="shortcode" type="hidden" value="[ESPRESSO_TICKET_SELECTOR event_id='
945
-                       . $post->ID
946
-                       . ']">';
947
-        }
948
-        return $return;
949
-    }
950
-
951
-
952
-    /**
953
-     * _events_overview_list_table
954
-     * This contains the logic for showing the events_overview list
955
-     *
956
-     * @access protected
957
-     * @return void
958
-     * @throws DomainException
959
-     * @throws EE_Error
960
-     * @throws InvalidArgumentException
961
-     * @throws InvalidDataTypeException
962
-     * @throws InvalidInterfaceException
963
-     */
964
-    protected function _events_overview_list_table()
965
-    {
966
-        $after_list_table                           = [];
967
-        $links_html = EEH_HTML::div('', '', 'ee-admin-section ee-layout-stack');
968
-        $links_html .= EEH_HTML::h3(esc_html__('Links', 'event_espresso'));
969
-        $links_html .= EEH_HTML::div(
970
-            EEH_Template::get_button_or_link(
971
-                get_post_type_archive_link('espresso_events'),
972
-                esc_html__('View Event Archive Page', 'event_espresso'),
973
-                'button button--small button--secondary'
974
-            ),
975
-            '',
976
-            'ee-admin-button-row ee-admin-button-row--align-start'
977
-        );
978
-        $links_html .= EEH_HTML::divx();
979
-
980
-        $after_list_table['view_event_list_button'] = $links_html;
981
-
982
-        $after_list_table['legend'] = $this->_display_legend($this->_event_legend_items());
983
-        $this->_admin_page_title                    .= ' ' . $this->get_action_link_or_button(
984
-            'create_new',
985
-            'add',
986
-            [],
987
-            'add-new-h2'
988
-        );
989
-
990
-        $this->_template_args['after_list_table']   = array_merge(
991
-            (array) $this->_template_args['after_list_table'],
992
-            $after_list_table
993
-        );
994
-        $this->display_admin_list_table_page_with_no_sidebar();
995
-    }
996
-
997
-
998
-    /**
999
-     * this allows for extra misc actions in the default WP publish box
1000
-     *
1001
-     * @return void
1002
-     * @throws DomainException
1003
-     * @throws EE_Error
1004
-     * @throws InvalidArgumentException
1005
-     * @throws InvalidDataTypeException
1006
-     * @throws InvalidInterfaceException
1007
-     * @throws ReflectionException
1008
-     */
1009
-    public function extra_misc_actions_publish_box()
1010
-    {
1011
-        $this->_generate_publish_box_extra_content();
1012
-    }
1013
-
1014
-
1015
-    /**
1016
-     * This is hooked into the WordPress do_action('save_post') hook and runs after the custom post type has been
1017
-     * saved.
1018
-     * Typically you would use this to save any additional data.
1019
-     * Keep in mind also that "save_post" runs on EVERY post update to the database.
1020
-     * ALSO very important.  When a post transitions from scheduled to published,
1021
-     * the save_post action is fired but you will NOT have any _POST data containing any extra info you may have from
1022
-     * other meta saves. So MAKE sure that you handle this accordingly.
1023
-     *
1024
-     * @access protected
1025
-     * @abstract
1026
-     * @param string $post_id The ID of the cpt that was saved (so you can link relationally)
1027
-     * @param WP_Post $post    The post object of the cpt that was saved.
1028
-     * @return void
1029
-     * @throws EE_Error
1030
-     * @throws InvalidArgumentException
1031
-     * @throws InvalidDataTypeException
1032
-     * @throws InvalidInterfaceException
1033
-     * @throws ReflectionException
1034
-     */
1035
-    protected function _insert_update_cpt_item($post_id, $post)
1036
-    {
1037
-        if ($post instanceof WP_Post && $post->post_type !== 'espresso_events') {
1038
-            // get out we're not processing an event save.
1039
-            return;
1040
-        }
1041
-        $event_values = [
1042
-            'EVT_member_only'     => $this->request->getRequestParam('member_only', false, 'bool'),
1043
-            'EVT_allow_overflow'  => $this->request->getRequestParam('EVT_allow_overflow', false, 'bool'),
1044
-            'EVT_timezone_string' => $this->request->getRequestParam('timezone_string'),
1045
-        ];
1046
-        // check if the new EDTR reg options meta box is being used, and if so, don't run updates for legacy version
1047
-        if (! $this->admin_config->useAdvancedEditor() || ! $this->feature->allowed('use_reg_options_meta_box')) {
1048
-            $event_values['EVT_display_ticket_selector']     = $this->request->getRequestParam(
1049
-                'display_ticket_selector',
1050
-                false,
1051
-                'bool'
1052
-            );
1053
-            $event_values['EVT_additional_limit']            = min(
1054
-                apply_filters('FHEE__EE_Events_Admin__insert_update_cpt_item__EVT_additional_limit_max', 255),
1055
-                $this->request->getRequestParam('additional_limit', null, 'int')
1056
-            );
1057
-            $event_values['EVT_default_registration_status'] = $this->request->getRequestParam(
1058
-                'EVT_default_registration_status',
1059
-                EE_Registry::instance()->CFG->registration->default_STS_ID
1060
-            );
1061
-
1062
-            $event_values['EVT_external_URL'] = $this->request->getRequestParam('externalURL');
1063
-            $event_values['EVT_phone']        = $this->request->getRequestParam('event_phone');
1064
-            $event_values['EVT_display_desc'] = $this->request->getRequestParam('display_desc', false, 'bool');
1065
-        }
1066
-        // update event
1067
-        $success = $this->_event_model()->update_by_ID($event_values, $post_id);
1068
-        // get event_object for other metaboxes...
1069
-        // though it would seem to make sense to just use $this->_event_model()->get_one_by_ID( $post_id )..
1070
-        // i have to setup where conditions to override the filters in the model
1071
-        // that filter out autodraft and inherit statuses so we GET the inherit id!
1072
-        $event = $this->_event_model()->get_one(
1073
-            [
1074
-                [
1075
-                    $this->_event_model()->primary_key_name() => $post_id,
1076
-                    'OR'                                      => [
1077
-                        'status'   => $post->post_status,
1078
-                        // if trying to "Publish" a sold out event, it's status will get switched back to "sold_out" in the db,
1079
-                        // but the returned object here has a status of "publish", so use the original post status as well
1080
-                        'status*1' => $this->request->getRequestParam('original_post_status'),
1081
-                    ],
1082
-                ],
1083
-            ]
1084
-        );
1085
-
1086
-        // the following are default callbacks for event attachment updates
1087
-        // that can be overridden by caffeinated functionality and/or addons.
1088
-        $event_update_callbacks = [];
1089
-        if (! $this->admin_config->useAdvancedEditor()) {
1090
-            $event_update_callbacks['_default_venue_update']   = [$this, '_default_venue_update'];
1091
-            $event_update_callbacks['_default_tickets_update'] = [$this, '_default_tickets_update'];
1092
-        }
1093
-        $event_update_callbacks = apply_filters(
1094
-            'FHEE__Events_Admin_Page___insert_update_cpt_item__event_update_callbacks',
1095
-            $event_update_callbacks
1096
-        );
1097
-
1098
-        $att_success = true;
1099
-        foreach ($event_update_callbacks as $e_callback) {
1100
-            $_success = is_callable($e_callback)
1101
-                ? $e_callback($event, $this->request->requestParams())
1102
-                : false;
1103
-            // if ANY of these updates fail then we want the appropriate global error message
1104
-            $att_success = $_success !== false ? $att_success : false;
1105
-        }
1106
-        // any errors?
1107
-        if ($success && $att_success === false) {
1108
-            EE_Error::add_error(
1109
-                esc_html__(
1110
-                    'Event Details saved successfully but something went wrong with saving attachments.',
1111
-                    'event_espresso'
1112
-                ),
1113
-                __FILE__,
1114
-                __FUNCTION__,
1115
-                __LINE__
1116
-            );
1117
-        } elseif ($success === false) {
1118
-            EE_Error::add_error(
1119
-                esc_html__('Event Details did not save successfully.', 'event_espresso'),
1120
-                __FILE__,
1121
-                __FUNCTION__,
1122
-                __LINE__
1123
-            );
1124
-        }
1125
-    }
1126
-
1127
-
1128
-    /**
1129
-     * @param int $post_id
1130
-     * @param int $revision_id
1131
-     * @throws EE_Error
1132
-     * @throws EE_Error
1133
-     * @throws ReflectionException
1134
-     * @see parent::restore_item()
1135
-     */
1136
-    protected function _restore_cpt_item($post_id, $revision_id)
1137
-    {
1138
-        // copy existing event meta to new post
1139
-        $post_evt = $this->_event_model()->get_one_by_ID($post_id);
1140
-        if ($post_evt instanceof EE_Event) {
1141
-            // meta revision restore
1142
-            $post_evt->restore_revision($revision_id);
1143
-            // related objs restore
1144
-            $post_evt->restore_revision($revision_id, ['Venue', 'Datetime', 'Price']);
1145
-        }
1146
-    }
1147
-
1148
-
1149
-    /**
1150
-     * Attach the venue to the Event
1151
-     *
1152
-     * @param EE_Event $event Event Object to add the venue to
1153
-     * @param array    $data  The request data from the form
1154
-     * @return bool           Success or fail.
1155
-     * @throws EE_Error
1156
-     * @throws ReflectionException
1157
-     */
1158
-    protected function _default_venue_update(EE_Event $event, $data)
1159
-    {
1160
-        require_once(EE_MODELS . 'EEM_Venue.model.php');
1161
-        $venue_model = EE_Registry::instance()->load_model('Venue');
1162
-        $venue_id    = ! empty($data['venue_id']) ? $data['venue_id'] : null;
1163
-        // very important.  If we don't have a venue name...
1164
-        // then we'll get out because not necessary to create empty venue
1165
-        if (empty($data['venue_title'])) {
1166
-            return false;
1167
-        }
1168
-        $venue_array = [
1169
-            'VNU_wp_user'         => $event->get('EVT_wp_user'),
1170
-            'VNU_name'            => ! empty($data['venue_title']) ? $data['venue_title'] : null,
1171
-            'VNU_desc'            => ! empty($data['venue_description']) ? $data['venue_description'] : null,
1172
-            'VNU_identifier'      => ! empty($data['venue_identifier']) ? $data['venue_identifier'] : null,
1173
-            'VNU_short_desc'      => ! empty($data['venue_short_description'])
1174
-                ? $data['venue_short_description']
1175
-                : null,
1176
-            'VNU_address'         => ! empty($data['address']) ? $data['address'] : null,
1177
-            'VNU_address2'        => ! empty($data['address2']) ? $data['address2'] : null,
1178
-            'VNU_city'            => ! empty($data['city']) ? $data['city'] : null,
1179
-            'STA_ID'              => ! empty($data['state']) ? $data['state'] : null,
1180
-            'CNT_ISO'             => ! empty($data['countries']) ? $data['countries'] : null,
1181
-            'VNU_zip'             => ! empty($data['zip']) ? $data['zip'] : null,
1182
-            'VNU_phone'           => ! empty($data['venue_phone']) ? $data['venue_phone'] : null,
1183
-            'VNU_capacity'        => ! empty($data['venue_capacity']) ? $data['venue_capacity'] : null,
1184
-            'VNU_url'             => ! empty($data['venue_url']) ? $data['venue_url'] : null,
1185
-            'VNU_virtual_phone'   => ! empty($data['virtual_phone']) ? $data['virtual_phone'] : null,
1186
-            'VNU_virtual_url'     => ! empty($data['virtual_url']) ? $data['virtual_url'] : null,
1187
-            'VNU_enable_for_gmap' => isset($data['enable_for_gmap']) ? 1 : 0,
1188
-            'status'              => 'publish',
1189
-        ];
1190
-        // if we've got the venue_id then we're just updating the existing venue so let's do that and then get out.
1191
-        if (! empty($venue_id)) {
1192
-            $update_where  = [$venue_model->primary_key_name() => $venue_id];
1193
-            $rows_affected = $venue_model->update($venue_array, [$update_where]);
1194
-            // we've gotta make sure that the venue is always attached to a revision..
1195
-            // add_relation_to should take care of making sure that the relation is already present.
1196
-            $event->_add_relation_to($venue_id, 'Venue');
1197
-            return $rows_affected > 0;
1198
-        }
1199
-        // we insert the venue
1200
-        $venue_id = $venue_model->insert($venue_array);
1201
-        $event->_add_relation_to($venue_id, 'Venue');
1202
-        return ! empty($venue_id);
1203
-        // when we have the ancestor come in it's already been handled by the revision save.
1204
-    }
1205
-
1206
-
1207
-    /**
1208
-     * Handles saving everything related to Tickets (datetimes, tickets, prices)
1209
-     *
1210
-     * @param EE_Event $event The Event object we're attaching data to
1211
-     * @param array    $data  The request data from the form
1212
-     * @return array
1213
-     * @throws EE_Error
1214
-     * @throws ReflectionException
1215
-     * @throws Exception
1216
-     */
1217
-    protected function _default_tickets_update(EE_Event $event, $data)
1218
-    {
1219
-        if ($this->admin_config->useAdvancedEditor()) {
1220
-            return [];
1221
-        }
1222
-        $datetime       = null;
1223
-        $saved_tickets  = [];
1224
-        $event_timezone = $event->get_timezone();
1225
-        $date_formats   = ['Y-m-d', 'h:i a'];
1226
-        foreach ($data['edit_event_datetimes'] as $row => $datetime_data) {
1227
-            // trim all values to ensure any excess whitespace is removed.
1228
-            $datetime_data                = array_map('trim', $datetime_data);
1229
-            $datetime_data['DTT_EVT_end'] =
1230
-                isset($datetime_data['DTT_EVT_end']) && ! empty($datetime_data['DTT_EVT_end'])
1231
-                    ? $datetime_data['DTT_EVT_end']
1232
-                    : $datetime_data['DTT_EVT_start'];
1233
-            $datetime_values              = [
1234
-                'DTT_ID'        => ! empty($datetime_data['DTT_ID']) ? $datetime_data['DTT_ID'] : null,
1235
-                'DTT_EVT_start' => $datetime_data['DTT_EVT_start'],
1236
-                'DTT_EVT_end'   => $datetime_data['DTT_EVT_end'],
1237
-                'DTT_reg_limit' => empty($datetime_data['DTT_reg_limit']) ? EE_INF : $datetime_data['DTT_reg_limit'],
1238
-                'DTT_order'     => $row,
1239
-            ];
1240
-            // if we have an id then let's get existing object first and then set the new values.
1241
-            //  Otherwise we instantiate a new object for save.
1242
-            if (! empty($datetime_data['DTT_ID'])) {
1243
-                $datetime = EEM_Datetime::instance($event_timezone)->get_one_by_ID($datetime_data['DTT_ID']);
1244
-                if (! $datetime instanceof EE_Datetime) {
1245
-                    throw new RuntimeException(
1246
-                        sprintf(
1247
-                            esc_html__(
1248
-                                'Something went wrong! A valid Datetime could not be retrieved from the database using the supplied ID: %1$d',
1249
-                                'event_espresso'
1250
-                            ),
1251
-                            $datetime_data['DTT_ID']
1252
-                        )
1253
-                    );
1254
-                }
1255
-                $datetime->set_date_format($date_formats[0]);
1256
-                $datetime->set_time_format($date_formats[1]);
1257
-                foreach ($datetime_values as $field => $value) {
1258
-                    $datetime->set($field, $value);
1259
-                }
1260
-            } else {
1261
-                $datetime = EE_Datetime::new_instance($datetime_values, $event_timezone, $date_formats);
1262
-            }
1263
-            if (! $datetime instanceof EE_Datetime) {
1264
-                throw new RuntimeException(
1265
-                    sprintf(
1266
-                        esc_html__(
1267
-                            'Something went wrong! A valid Datetime could not be generated or retrieved using the supplied data: %1$s',
1268
-                            'event_espresso'
1269
-                        ),
1270
-                        print_r($datetime_values, true)
1271
-                    )
1272
-                );
1273
-            }
1274
-            // before going any further make sure our dates are setup correctly
1275
-            // so that the end date is always equal or greater than the start date.
1276
-            if ($datetime->get_raw('DTT_EVT_start') > $datetime->get_raw('DTT_EVT_end')) {
1277
-                $datetime->set('DTT_EVT_end', $datetime->get('DTT_EVT_start'));
1278
-                $datetime = EEH_DTT_Helper::date_time_add($datetime, 'DTT_EVT_end', 'days');
1279
-            }
1280
-            $datetime->save();
1281
-            $event->_add_relation_to($datetime, 'Datetime');
1282
-        }
1283
-        // no datetimes get deleted so we don't do any of that logic here.
1284
-        // update tickets next
1285
-        $old_tickets = isset($data['ticket_IDs']) ? explode(',', $data['ticket_IDs']) : [];
1286
-
1287
-        // set up some default start and end dates in case those are not present in the incoming data
1288
-        $default_start_date = new DateTime('now', new DateTimeZone($event->get_timezone()));
1289
-        $default_start_date = $default_start_date->format($date_formats[0] . ' ' . $date_formats[1]);
1290
-        // use the start date of the first datetime for the end date
1291
-        $first_datetime   = $event->first_datetime();
1292
-        $default_end_date = $first_datetime->start_date_and_time($date_formats[0], $date_formats[1]);
1293
-
1294
-        // now process the incoming data
1295
-        foreach ($data['edit_tickets'] as $row => $ticket_data) {
1296
-            $update_prices = false;
1297
-            $ticket_price  = isset($data['edit_prices'][ $row ][1]['PRC_amount'])
1298
-                ? $data['edit_prices'][ $row ][1]['PRC_amount']
1299
-                : 0;
1300
-            // trim inputs to ensure any excess whitespace is removed.
1301
-            $ticket_data   = array_map('trim', $ticket_data);
1302
-            $ticket_values = [
1303
-                'TKT_ID'          => ! empty($ticket_data['TKT_ID']) ? $ticket_data['TKT_ID'] : null,
1304
-                'TTM_ID'          => ! empty($ticket_data['TTM_ID']) ? $ticket_data['TTM_ID'] : 0,
1305
-                'TKT_name'        => ! empty($ticket_data['TKT_name']) ? $ticket_data['TKT_name'] : '',
1306
-                'TKT_description' => ! empty($ticket_data['TKT_description']) ? $ticket_data['TKT_description'] : '',
1307
-                'TKT_start_date'  => ! empty($ticket_data['TKT_start_date'])
1308
-                    ? $ticket_data['TKT_start_date']
1309
-                    : $default_start_date,
1310
-                'TKT_end_date'    => ! empty($ticket_data['TKT_end_date'])
1311
-                    ? $ticket_data['TKT_end_date']
1312
-                    : $default_end_date,
1313
-                'TKT_qty'         => ! empty($ticket_data['TKT_qty'])
1314
-                                     || (isset($ticket_data['TKT_qty']) && (int) $ticket_data['TKT_qty'] === 0)
1315
-                    ? $ticket_data['TKT_qty']
1316
-                    : EE_INF,
1317
-                'TKT_uses'        => ! empty($ticket_data['TKT_uses'])
1318
-                                     || (isset($ticket_data['TKT_uses']) && (int) $ticket_data['TKT_uses'] === 0)
1319
-                    ? $ticket_data['TKT_uses']
1320
-                    : EE_INF,
1321
-                'TKT_min'         => ! empty($ticket_data['TKT_min']) ? $ticket_data['TKT_min'] : 0,
1322
-                'TKT_max'         => ! empty($ticket_data['TKT_max']) ? $ticket_data['TKT_max'] : EE_INF,
1323
-                'TKT_order'       => isset($ticket_data['TKT_order']) ? $ticket_data['TKT_order'] : $row,
1324
-                'TKT_price'       => $ticket_price,
1325
-                'TKT_row'         => $row,
1326
-            ];
1327
-            // if this is a default ticket, then we need to set the TKT_ID to 0 and update accordingly,
1328
-            // which means in turn that the prices will become new prices as well.
1329
-            if (isset($ticket_data['TKT_is_default']) && $ticket_data['TKT_is_default']) {
1330
-                $ticket_values['TKT_ID']         = 0;
1331
-                $ticket_values['TKT_is_default'] = 0;
1332
-                $update_prices                   = true;
1333
-            }
1334
-            // if we have a TKT_ID then we need to get that existing TKT_obj and update it
1335
-            // we actually do our saves ahead of adding any relations because its entirely possible that this
1336
-            // ticket didn't get removed or added to any datetime in the session but DID have it's items modified.
1337
-            // keep in mind that if the ticket has been sold (and we have changed pricing information),
1338
-            // then we won't be updating the tkt but instead a new tkt will be created and the old one archived.
1339
-            if (! empty($ticket_data['TKT_ID'])) {
1340
-                $existing_ticket = EEM_Ticket::instance($event_timezone)->get_one_by_ID($ticket_data['TKT_ID']);
1341
-                if (! $existing_ticket instanceof EE_Ticket) {
1342
-                    throw new RuntimeException(
1343
-                        sprintf(
1344
-                            esc_html__(
1345
-                                'Something went wrong! A valid Ticket could not be retrieved from the database using the supplied ID: %1$d',
1346
-                                'event_espresso'
1347
-                            ),
1348
-                            $ticket_data['TKT_ID']
1349
-                        )
1350
-                    );
1351
-                }
1352
-                $ticket_sold = $existing_ticket->count_related(
1353
-                    'Registration',
1354
-                    [
1355
-                            [
1356
-                                'STS_ID' => [
1357
-                                    'NOT IN',
1358
-                                    [EEM_Registration::status_id_incomplete],
1359
-                                ],
1360
-                            ],
1361
-                        ]
1362
-                ) > 0;
1363
-                // let's just check the total price for the existing ticket and determine if it matches the new total price.
1364
-                // if they are different then we create a new ticket (if $ticket_sold)
1365
-                // if they aren't different then we go ahead and modify existing ticket.
1366
-                $create_new_ticket = $ticket_sold
1367
-                                     && $ticket_price !== $existing_ticket->price()
1368
-                                     && ! $existing_ticket->deleted();
1369
-                $existing_ticket->set_date_format($date_formats[0]);
1370
-                $existing_ticket->set_time_format($date_formats[1]);
1371
-                // set new values
1372
-                foreach ($ticket_values as $field => $value) {
1373
-                    if ($field == 'TKT_qty') {
1374
-                        $existing_ticket->set_qty($value);
1375
-                    } elseif ($field == 'TKT_price') {
1376
-                        $existing_ticket->set('TKT_price', $ticket_price);
1377
-                    } else {
1378
-                        $existing_ticket->set($field, $value);
1379
-                    }
1380
-                }
1381
-                $ticket = $existing_ticket;
1382
-                // if $create_new_ticket is false then we can safely update the existing ticket.
1383
-                //  Otherwise we have to create a new ticket.
1384
-                if ($create_new_ticket) {
1385
-                    // archive the old ticket first
1386
-                    $existing_ticket->set('TKT_deleted', 1);
1387
-                    $existing_ticket->save();
1388
-                    // make sure this ticket is still recorded in our $saved_tickets
1389
-                    // so we don't run it through the regular trash routine.
1390
-                    $saved_tickets[ $existing_ticket->ID() ] = $existing_ticket;
1391
-                    // create new ticket that's a copy of the existing except,
1392
-                    // (a new id of course and not archived) AND has the new TKT_price associated with it.
1393
-                    $new_ticket = clone $existing_ticket;
1394
-                    $new_ticket->set('TKT_ID', 0);
1395
-                    $new_ticket->set('TKT_deleted', 0);
1396
-                    $new_ticket->set('TKT_sold', 0);
1397
-                    // now we need to make sure that $new prices are created as well and attached to new ticket.
1398
-                    $update_prices = true;
1399
-                    $ticket        = $new_ticket;
1400
-                }
1401
-            } else {
1402
-                // no TKT_id so a new ticket
1403
-                $ticket_values['TKT_price'] = $ticket_price;
1404
-                $ticket                     = EE_Ticket::new_instance($ticket_values, $event_timezone, $date_formats);
1405
-                $update_prices              = true;
1406
-            }
1407
-            if (! $ticket instanceof EE_Ticket) {
1408
-                throw new RuntimeException(
1409
-                    sprintf(
1410
-                        esc_html__(
1411
-                            'Something went wrong! A valid Ticket could not be generated or retrieved using the supplied data: %1$s',
1412
-                            'event_espresso'
1413
-                        ),
1414
-                        print_r($ticket_values, true)
1415
-                    )
1416
-                );
1417
-            }
1418
-            // cap ticket qty by datetime reg limits
1419
-            $ticket->set_qty(min($ticket->qty(), $ticket->qty('reg_limit')));
1420
-            // update ticket.
1421
-            $ticket->save();
1422
-            // before going any further make sure our dates are setup correctly
1423
-            // so that the end date is always equal or greater than the start date.
1424
-            if ($ticket->get_raw('TKT_start_date') > $ticket->get_raw('TKT_end_date')) {
1425
-                $ticket->set('TKT_end_date', $ticket->get('TKT_start_date'));
1426
-                $ticket = EEH_DTT_Helper::date_time_add($ticket, 'TKT_end_date', 'days');
1427
-                $ticket->save();
1428
-            }
1429
-            // initially let's add the ticket to the datetime
1430
-            $datetime->_add_relation_to($ticket, 'Ticket');
1431
-            $saved_tickets[ $ticket->ID() ] = $ticket;
1432
-            // add prices to ticket
1433
-            $prices_data = isset($data['edit_prices'][ $row ]) && is_array($data['edit_prices'][ $row ])
1434
-                ? $data['edit_prices'][ $row ]
1435
-                : [];
1436
-            $this->_add_prices_to_ticket($prices_data, $ticket, $update_prices);
1437
-        }
1438
-        // however now we need to handle permanently deleting tickets via the ui.
1439
-        // Keep in mind that the ui does not allow deleting/archiving tickets that have ticket sold.
1440
-        // However, it does allow for deleting tickets that have no tickets sold,
1441
-        // in which case we want to get rid of permanently because there is no need to save in db.
1442
-        $old_tickets     = isset($old_tickets[0]) && $old_tickets[0] === '' ? [] : $old_tickets;
1443
-        $tickets_removed = array_diff($old_tickets, array_keys($saved_tickets));
1444
-        foreach ($tickets_removed as $id) {
1445
-            $id = absint($id);
1446
-            // get the ticket for this id
1447
-            $ticket_to_remove = EEM_Ticket::instance()->get_one_by_ID($id);
1448
-            if (! $ticket_to_remove instanceof EE_Ticket) {
1449
-                continue;
1450
-            }
1451
-            // need to get all the related datetimes on this ticket and remove from every single one of them
1452
-            // (remember this process can ONLY kick off if there are NO tickets sold)
1453
-            $related_datetimes = $ticket_to_remove->get_many_related('Datetime');
1454
-            foreach ($related_datetimes as $related_datetime) {
1455
-                $ticket_to_remove->_remove_relation_to($related_datetime, 'Datetime');
1456
-            }
1457
-            // need to do the same for prices (except these prices can also be deleted because again,
1458
-            // tickets can only be trashed if they don't have any TKTs sold (otherwise they are just archived))
1459
-            $ticket_to_remove->delete_related_permanently('Price');
1460
-            // finally let's delete this ticket
1461
-            // (which should not be blocked at this point b/c we've removed all our relationships)
1462
-            $ticket_to_remove->delete_permanently();
1463
-        }
1464
-        return [$datetime, $saved_tickets];
1465
-    }
1466
-
1467
-
1468
-    /**
1469
-     * This attaches a list of given prices to a ticket.
1470
-     * Note we dont' have to worry about ever removing relationships (or archiving prices)
1471
-     * because if there is a change in price information on a ticket, a new ticket is created anyways
1472
-     * so the archived ticket will retain the old price info and prices are automatically "archived" via the ticket.
1473
-     *
1474
-     * @access  private
1475
-     * @param array     $prices_data Array of prices from the form.
1476
-     * @param EE_Ticket $ticket      EE_Ticket object that prices are being attached to.
1477
-     * @param bool      $new_prices  Whether attach existing incoming prices or create new ones.
1478
-     * @return  void
1479
-     * @throws EE_Error
1480
-     * @throws ReflectionException
1481
-     */
1482
-    private function _add_prices_to_ticket($prices_data, EE_Ticket $ticket, $new_prices = false)
1483
-    {
1484
-        $timezone = $ticket->get_timezone();
1485
-        foreach ($prices_data as $row => $price_data) {
1486
-            $price_values = [
1487
-                'PRC_ID'         => ! empty($price_data['PRC_ID']) ? $price_data['PRC_ID'] : null,
1488
-                'PRT_ID'         => ! empty($price_data['PRT_ID']) ? $price_data['PRT_ID'] : null,
1489
-                'PRC_amount'     => ! empty($price_data['PRC_amount']) ? $price_data['PRC_amount'] : 0,
1490
-                'PRC_name'       => ! empty($price_data['PRC_name']) ? $price_data['PRC_name'] : '',
1491
-                'PRC_desc'       => ! empty($price_data['PRC_desc']) ? $price_data['PRC_desc'] : '',
1492
-                'PRC_is_default' => 0, // make sure prices are NOT set as default from this context
1493
-                'PRC_order'      => $row,
1494
-            ];
1495
-            if ($new_prices || empty($price_values['PRC_ID'])) {
1496
-                $price_values['PRC_ID'] = 0;
1497
-                $price                  = EE_Price::new_instance($price_values, $timezone);
1498
-            } else {
1499
-                $price = EEM_Price::instance($timezone)->get_one_by_ID($price_data['PRC_ID']);
1500
-                // update this price with new values
1501
-                foreach ($price_values as $field => $new_price) {
1502
-                    $price->set($field, $new_price);
1503
-                }
1504
-            }
1505
-            if (! $price instanceof EE_Price) {
1506
-                throw new RuntimeException(
1507
-                    sprintf(
1508
-                        esc_html__(
1509
-                            'Something went wrong! A valid Price could not be generated or retrieved using the supplied data: %1$s',
1510
-                            'event_espresso'
1511
-                        ),
1512
-                        print_r($price_values, true)
1513
-                    )
1514
-                );
1515
-            }
1516
-            $price->save();
1517
-            $ticket->_add_relation_to($price, 'Price');
1518
-        }
1519
-    }
1520
-
1521
-
1522
-    /**
1523
-     * Add in our autosave ajax handlers
1524
-     *
1525
-     */
1526
-    protected function _ee_autosave_create_new()
1527
-    {
1528
-    }
1529
-
1530
-
1531
-    /**
1532
-     * More autosave handlers.
1533
-     */
1534
-    protected function _ee_autosave_edit()
1535
-    {
1536
-    }
1537
-
1538
-
1539
-    /**
1540
-     * @throws EE_Error
1541
-     * @throws ReflectionException
1542
-     */
1543
-    private function _generate_publish_box_extra_content()
1544
-    {
1545
-        // load formatter helper
1546
-        // args for getting related registrations
1547
-        $approved_query_args        = [
1548
-            [
1549
-                'REG_deleted' => 0,
1550
-                'STS_ID'      => EEM_Registration::status_id_approved,
1551
-            ],
1552
-        ];
1553
-        $not_approved_query_args    = [
1554
-            [
1555
-                'REG_deleted' => 0,
1556
-                'STS_ID'      => EEM_Registration::status_id_not_approved,
1557
-            ],
1558
-        ];
1559
-        $pending_payment_query_args = [
1560
-            [
1561
-                'REG_deleted' => 0,
1562
-                'STS_ID'      => EEM_Registration::status_id_pending_payment,
1563
-            ],
1564
-        ];
1565
-        // publish box
1566
-        $publish_box_extra_args = [
1567
-            'view_approved_reg_url'        => add_query_arg(
1568
-                [
1569
-                    'action'      => 'default',
1570
-                    'event_id'    => $this->_cpt_model_obj->ID(),
1571
-                    '_reg_status' => EEM_Registration::status_id_approved,
1572
-                ],
1573
-                REG_ADMIN_URL
1574
-            ),
1575
-            'view_not_approved_reg_url'    => add_query_arg(
1576
-                [
1577
-                    'action'      => 'default',
1578
-                    'event_id'    => $this->_cpt_model_obj->ID(),
1579
-                    '_reg_status' => EEM_Registration::status_id_not_approved,
1580
-                ],
1581
-                REG_ADMIN_URL
1582
-            ),
1583
-            'view_pending_payment_reg_url' => add_query_arg(
1584
-                [
1585
-                    'action'      => 'default',
1586
-                    'event_id'    => $this->_cpt_model_obj->ID(),
1587
-                    '_reg_status' => EEM_Registration::status_id_pending_payment,
1588
-                ],
1589
-                REG_ADMIN_URL
1590
-            ),
1591
-            'approved_regs'                => $this->_cpt_model_obj->count_related(
1592
-                'Registration',
1593
-                $approved_query_args
1594
-            ),
1595
-            'not_approved_regs'            => $this->_cpt_model_obj->count_related(
1596
-                'Registration',
1597
-                $not_approved_query_args
1598
-            ),
1599
-            'pending_payment_regs'         => $this->_cpt_model_obj->count_related(
1600
-                'Registration',
1601
-                $pending_payment_query_args
1602
-            ),
1603
-            'misc_pub_section_class'       => apply_filters(
1604
-                'FHEE_Events_Admin_Page___generate_publish_box_extra_content__misc_pub_section_class',
1605
-                'misc-pub-section'
1606
-            ),
1607
-        ];
1608
-        ob_start();
1609
-        do_action(
1610
-            'AHEE__Events_Admin_Page___generate_publish_box_extra_content__event_editor_overview_add',
1611
-            $this->_cpt_model_obj
1612
-        );
1613
-        $publish_box_extra_args['event_editor_overview_add'] = ob_get_clean();
1614
-        // load template
1615
-        EEH_Template::display_template(
1616
-            EVENTS_TEMPLATE_PATH . 'event_publish_box_extras.template.php',
1617
-            $publish_box_extra_args
1618
-        );
1619
-    }
1620
-
1621
-
1622
-    /**
1623
-     * @return EE_Event
1624
-     */
1625
-    public function get_event_object()
1626
-    {
1627
-        return $this->_cpt_model_obj;
1628
-    }
1629
-
1630
-
1631
-
1632
-
1633
-    /** METABOXES * */
1634
-    /**
1635
-     * _register_event_editor_meta_boxes
1636
-     * add all metaboxes related to the event_editor
1637
-     *
1638
-     * @return void
1639
-     * @throws EE_Error
1640
-     * @throws ReflectionException
1641
-     */
1642
-    protected function _register_event_editor_meta_boxes()
1643
-    {
1644
-        $this->verify_cpt_object();
1645
-        $use_advanced_editor = $this->admin_config->useAdvancedEditor();
1646
-        // check if the new EDTR reg options meta box is being used, and if so, don't load the legacy version
1647
-        if (! $use_advanced_editor || ! $this->feature->allowed('use_reg_options_meta_box')) {
1648
-            $this->addMetaBox(
1649
-                'espresso_event_editor_event_options',
1650
-                esc_html__('Event Registration Options', 'event_espresso'),
1651
-                [$this, 'registration_options_meta_box'],
1652
-                $this->page_slug,
1653
-                'side'
1654
-            );
1655
-        }
1656
-        if (! $use_advanced_editor) {
1657
-            $this->addMetaBox(
1658
-                'espresso_event_editor_tickets',
1659
-                esc_html__('Event Datetime & Ticket', 'event_espresso'),
1660
-                [$this, 'ticket_metabox'],
1661
-                $this->page_slug,
1662
-                'normal',
1663
-                'high'
1664
-            );
1665
-        } elseif ($this->feature->allowed('use_reg_options_meta_box')) {
1666
-            add_action(
1667
-                'add_meta_boxes_espresso_events',
1668
-                function () {
1669
-                    global $current_screen;
1670
-                    remove_meta_box('authordiv', $current_screen, 'normal');
1671
-                },
1672
-                99
1673
-            );
1674
-        }
1675
-        // NOTE: if you're looking for other metaboxes in here,
1676
-        // where a metabox has a related management page in the admin
1677
-        // you will find it setup in the related management page's "_Hooks" file.
1678
-        // i.e. messages metabox is found in "espresso_events_Messages_Hooks.class.php".
1679
-    }
1680
-
1681
-
1682
-    /**
1683
-     * @throws DomainException
1684
-     * @throws EE_Error
1685
-     * @throws ReflectionException
1686
-     */
1687
-    public function ticket_metabox()
1688
-    {
1689
-        $existing_datetime_ids = $existing_ticket_ids = [];
1690
-        // defaults for template args
1691
-        $template_args = [
1692
-            'existing_datetime_ids'    => '',
1693
-            'event_datetime_help_link' => '',
1694
-            'ticket_options_help_link' => '',
1695
-            'time'                     => null,
1696
-            'ticket_rows'              => '',
1697
-            'existing_ticket_ids'      => '',
1698
-            'total_ticket_rows'        => 1,
1699
-            'ticket_js_structure'      => '',
1700
-            'trash_icon'               => 'dashicons dashicons-lock',
1701
-            'disabled'                 => '',
1702
-        ];
1703
-        $event_id      = is_object($this->_cpt_model_obj) ? $this->_cpt_model_obj->ID() : null;
1704
-        /**
1705
-         * 1. Start with retrieving Datetimes
1706
-         * 2. Fore each datetime get related tickets
1707
-         * 3. For each ticket get related prices
1708
-         */
1709
-        /** @var EEM_Datetime $datetime_model */
1710
-        $datetime_model = EE_Registry::instance()->load_model('Datetime');
1711
-        /** @var EEM_Ticket $datetime_model */
1712
-        $ticket_model = EE_Registry::instance()->load_model('Ticket');
1713
-        $times        = $datetime_model->get_all_event_dates($event_id);
1714
-        /** @type EE_Datetime $first_datetime */
1715
-        $first_datetime = reset($times);
1716
-        // do we get related tickets?
1717
-        if (
1718
-            $first_datetime instanceof EE_Datetime
1719
-            && $first_datetime->ID() !== 0
1720
-        ) {
1721
-            $existing_datetime_ids[] = $first_datetime->get('DTT_ID');
1722
-            $template_args['time']   = $first_datetime;
1723
-            $related_tickets         = $first_datetime->tickets(
1724
-                [
1725
-                    ['OR' => ['TKT_deleted' => 1, 'TKT_deleted*' => 0]],
1726
-                    'default_where_conditions' => 'none',
1727
-                ]
1728
-            );
1729
-            if (! empty($related_tickets)) {
1730
-                $template_args['total_ticket_rows'] = count($related_tickets);
1731
-                $row                                = 0;
1732
-                foreach ($related_tickets as $ticket) {
1733
-                    $existing_ticket_ids[]        = $ticket->get('TKT_ID');
1734
-                    $template_args['ticket_rows'] .= $this->_get_ticket_row($ticket, false, $row);
1735
-                    $row++;
1736
-                }
1737
-            } else {
1738
-                $template_args['total_ticket_rows'] = 1;
1739
-                /** @type EE_Ticket $ticket */
1740
-                $ticket                       = $ticket_model->create_default_object();
1741
-                $template_args['ticket_rows'] .= $this->_get_ticket_row($ticket);
1742
-            }
1743
-        } else {
1744
-            $template_args['time'] = $times[0];
1745
-            /** @type EE_Ticket[] $tickets */
1746
-            $tickets                      = $ticket_model->get_all_default_tickets();
1747
-            $template_args['ticket_rows'] .= $this->_get_ticket_row($tickets[1]);
1748
-            // NOTE: we're just sending the first default row
1749
-            // (decaf can't manage default tickets so this should be sufficient);
1750
-        }
1751
-        $template_args['event_datetime_help_link'] = $this->_get_help_tab_link(
1752
-            'event_editor_event_datetimes_help_tab'
1753
-        );
1754
-        $template_args['ticket_options_help_link'] = $this->_get_help_tab_link('ticket_options_info');
1755
-        $template_args['existing_datetime_ids']    = implode(',', $existing_datetime_ids);
1756
-        $template_args['existing_ticket_ids']      = implode(',', $existing_ticket_ids);
1757
-        $template_args['ticket_js_structure']      = $this->_get_ticket_row(
1758
-            $ticket_model->create_default_object(),
1759
-            true
1760
-        );
1761
-        $template                                  = apply_filters(
1762
-            'FHEE__Events_Admin_Page__ticket_metabox__template',
1763
-            EVENTS_TEMPLATE_PATH . 'event_tickets_metabox_main.template.php'
1764
-        );
1765
-        EEH_Template::display_template($template, $template_args);
1766
-    }
1767
-
1768
-
1769
-    /**
1770
-     * Setup an individual ticket form for the decaf event editor page
1771
-     *
1772
-     * @access private
1773
-     * @param EE_Ticket $ticket   the ticket object
1774
-     * @param boolean   $skeleton whether we're generating a skeleton for js manipulation
1775
-     * @param int       $row
1776
-     * @return string generated html for the ticket row.
1777
-     * @throws EE_Error
1778
-     * @throws ReflectionException
1779
-     */
1780
-    private function _get_ticket_row($ticket, $skeleton = false, $row = 0)
1781
-    {
1782
-        $template_args = [
1783
-            'tkt_status_class'    => ' tkt-status-' . $ticket->ticket_status(),
1784
-            'tkt_archive_class'   => $ticket->ticket_status() === EE_Ticket::archived && ! $skeleton ? ' tkt-archived'
1785
-                : '',
1786
-            'ticketrow'           => $skeleton ? 'TICKETNUM' : $row,
1787
-            'TKT_ID'              => $ticket->get('TKT_ID'),
1788
-            'TKT_name'            => $ticket->get('TKT_name'),
1789
-            'TKT_start_date'      => $skeleton ? '' : $ticket->get_date('TKT_start_date', 'Y-m-d h:i a'),
1790
-            'TKT_end_date'        => $skeleton ? '' : $ticket->get_date('TKT_end_date', 'Y-m-d h:i a'),
1791
-            'TKT_is_default'      => $ticket->get('TKT_is_default'),
1792
-            'TKT_qty'             => $ticket->get_pretty('TKT_qty', 'input'),
1793
-            'edit_ticketrow_name' => $skeleton ? 'TICKETNAMEATTR' : 'edit_tickets',
1794
-            'TKT_sold'            => $skeleton ? 0 : $ticket->get('TKT_sold'),
1795
-            'trash_icon'          => ($skeleton || (! empty($ticket) && ! $ticket->get('TKT_deleted')))
1796
-                                     && (! empty($ticket) && $ticket->get('TKT_sold') === 0)
1797
-                ? 'trash-icon dashicons dashicons-post-trash clickable' : 'dashicons dashicons-lock',
1798
-            'disabled'            => $skeleton || (! empty($ticket) && ! $ticket->get('TKT_deleted')) ? ''
1799
-                : ' disabled=disabled',
1800
-        ];
1801
-        $price         = $ticket->ID() !== 0
1802
-            ? $ticket->get_first_related('Price', ['default_where_conditions' => 'none'])
1803
-            : null;
1804
-        $price         = $price instanceof EE_Price
1805
-            ? $price
1806
-            : EEM_Price::instance()->create_default_object();
1807
-        $price_args    = [
1808
-            'price_currency_symbol' => EE_Registry::instance()->CFG->currency->sign,
1809
-            'PRC_amount'            => $price->get('PRC_amount'),
1810
-            'PRT_ID'                => $price->get('PRT_ID'),
1811
-            'PRC_ID'                => $price->get('PRC_ID'),
1812
-            'PRC_is_default'        => $price->get('PRC_is_default'),
1813
-        ];
1814
-        // make sure we have default start and end dates if skeleton
1815
-        // handle rows that should NOT be empty
1816
-        if (empty($template_args['TKT_start_date'])) {
1817
-            // if empty then the start date will be now.
1818
-            $template_args['TKT_start_date'] = date('Y-m-d h:i a', current_time('timestamp'));
1819
-        }
1820
-        if (empty($template_args['TKT_end_date'])) {
1821
-            // get the earliest datetime (if present);
1822
-            $earliest_datetime             = $this->_cpt_model_obj->ID() > 0
1823
-                ? $this->_cpt_model_obj->get_first_related(
1824
-                    'Datetime',
1825
-                    ['order_by' => ['DTT_EVT_start' => 'ASC']]
1826
-                )
1827
-                : null;
1828
-            $template_args['TKT_end_date'] = $earliest_datetime instanceof EE_Datetime
1829
-                ? $earliest_datetime->get_datetime('DTT_EVT_start', 'Y-m-d', 'h:i a')
1830
-                : date('Y-m-d h:i a', mktime(0, 0, 0, date('m'), date('d') + 7, date('Y')));
1831
-        }
1832
-        $template_args = array_merge($template_args, $price_args);
1833
-        $template      = apply_filters(
1834
-            'FHEE__Events_Admin_Page__get_ticket_row__template',
1835
-            EVENTS_TEMPLATE_PATH . 'event_tickets_metabox_ticket_row.template.php',
1836
-            $ticket
1837
-        );
1838
-        return EEH_Template::display_template($template, $template_args, true);
1839
-    }
1840
-
1841
-
1842
-    /**
1843
-     * @throws EE_Error
1844
-     * @throws ReflectionException
1845
-     */
1846
-    public function registration_options_meta_box()
1847
-    {
1848
-        $yes_no_values             = [
1849
-            ['id' => true, 'text' => esc_html__('Yes', 'event_espresso')],
1850
-            ['id' => false, 'text' => esc_html__('No', 'event_espresso')],
1851
-        ];
1852
-        $default_reg_status_values = EEM_Registration::reg_status_array(
1853
-            [
1854
-                EEM_Registration::status_id_cancelled,
1855
-                EEM_Registration::status_id_declined,
1856
-                EEM_Registration::status_id_incomplete,
1857
-            ],
1858
-            true
1859
-        );
1860
-        // $template_args['is_active_select'] = EEH_Form_Fields::select_input('is_active', $yes_no_values, $this->_cpt_model_obj->is_active());
1861
-        $template_args['_event']                          = $this->_cpt_model_obj;
1862
-        $template_args['event']                           = $this->_cpt_model_obj;
1863
-        $template_args['active_status']                   = $this->_cpt_model_obj->pretty_active_status(false);
1864
-        $template_args['additional_limit']                = $this->_cpt_model_obj->additional_limit();
1865
-        $template_args['default_registration_status']     = EEH_Form_Fields::select_input(
1866
-            'default_reg_status',
1867
-            $default_reg_status_values,
1868
-            $this->_cpt_model_obj->default_registration_status()
1869
-        );
1870
-        $template_args['display_description']             = EEH_Form_Fields::select_input(
1871
-            'display_desc',
1872
-            $yes_no_values,
1873
-            $this->_cpt_model_obj->display_description()
1874
-        );
1875
-        $template_args['display_ticket_selector']         = EEH_Form_Fields::select_input(
1876
-            'display_ticket_selector',
1877
-            $yes_no_values,
1878
-            $this->_cpt_model_obj->display_ticket_selector(),
1879
-            '',
1880
-            '',
1881
-            false
1882
-        );
1883
-        $template_args['additional_registration_options'] = apply_filters(
1884
-            'FHEE__Events_Admin_Page__registration_options_meta_box__additional_registration_options',
1885
-            '',
1886
-            $template_args,
1887
-            $yes_no_values,
1888
-            $default_reg_status_values
1889
-        );
1890
-        EEH_Template::display_template(
1891
-            EVENTS_TEMPLATE_PATH . 'event_registration_options.template.php',
1892
-            $template_args
1893
-        );
1894
-    }
1895
-
1896
-
1897
-    /**
1898
-     * _get_events()
1899
-     * This method simply returns all the events (for the given _view and paging)
1900
-     *
1901
-     * @access public
1902
-     * @param int  $per_page     count of items per page (20 default);
1903
-     * @param int  $current_page what is the current page being viewed.
1904
-     * @param bool $count        if TRUE then we just return a count of ALL events matching the given _view.
1905
-     *                           If FALSE then we return an array of event objects
1906
-     *                           that match the given _view and paging parameters.
1907
-     * @return array|int         an array of event objects or a count of them.
1908
-     * @throws Exception
1909
-     */
1910
-    public function get_events($per_page = 10, $current_page = 1, $count = false)
1911
-    {
1912
-        $EEM_Event   = $this->_event_model();
1913
-        $offset      = ($current_page - 1) * $per_page;
1914
-        $limit       = $count ? null : $offset . ',' . $per_page;
1915
-        $orderby     = $this->request->getRequestParam('orderby', 'EVT_ID');
1916
-        $order       = $this->request->getRequestParam('order', 'DESC');
1917
-        $month_range = $this->request->getRequestParam('month_range');
1918
-        if ($month_range) {
1919
-            $pieces = explode(' ', $month_range, 3);
1920
-            // simulate the FIRST day of the month, that fixes issues for months like February
1921
-            // where PHP doesn't know what to assume for date.
1922
-            // @see https://events.codebasehq.com/projects/event-espresso/tickets/10437
1923
-            $month_r = ! empty($pieces[0]) ? date('m', EEH_DTT_Helper::first_of_month_timestamp($pieces[0])) : '';
1924
-            $year_r  = ! empty($pieces[1]) ? $pieces[1] : '';
1925
-        }
1926
-        $where  = [];
1927
-        $status = $this->request->getRequestParam('status');
1928
-        // determine what post_status our condition will have for the query.
1929
-        switch ($status) {
1930
-            case 'month':
1931
-            case 'today':
1932
-            case null:
1933
-            case 'all':
1934
-                break;
1935
-            case 'draft':
1936
-                $where['status'] = ['IN', ['draft', 'auto-draft']];
1937
-                break;
1938
-            default:
1939
-                $where['status'] = $status;
1940
-        }
1941
-        // categories? The default for all categories is -1
1942
-        $category = $this->request->getRequestParam('EVT_CAT', -1, 'int');
1943
-        if ($category !== -1) {
1944
-            $where['Term_Taxonomy.taxonomy'] = EEM_CPT_Base::EVENT_CATEGORY_TAXONOMY;
1945
-            $where['Term_Taxonomy.term_id']  = $category;
1946
-        }
1947
-        // date where conditions
1948
-        $start_formats = EEM_Datetime::instance()->get_formats_for('DTT_EVT_start');
1949
-        if ($month_range) {
1950
-            $DateTime = new DateTime(
1951
-                $year_r . '-' . $month_r . '-01 00:00:00',
1952
-                new DateTimeZone('UTC')
1953
-            );
1954
-            $start    = $DateTime->getTimestamp();
1955
-            // set the datetime to be the end of the month
1956
-            $DateTime->setDate(
1957
-                $year_r,
1958
-                $month_r,
1959
-                $DateTime->format('t')
1960
-            )->setTime(23, 59, 59);
1961
-            $end                             = $DateTime->getTimestamp();
1962
-            $where['Datetime.DTT_EVT_start'] = ['BETWEEN', [$start, $end]];
1963
-        } elseif ($status === 'today') {
1964
-            $DateTime                        =
1965
-                new DateTime('now', new DateTimeZone(EEM_Event::instance()->get_timezone()));
1966
-            $start                           = $DateTime->setTime(0, 0)->format(implode(' ', $start_formats));
1967
-            $end                             = $DateTime->setTime(23, 59, 59)->format(implode(' ', $start_formats));
1968
-            $where['Datetime.DTT_EVT_start'] = ['BETWEEN', [$start, $end]];
1969
-        } elseif ($status === 'month') {
1970
-            $now                             = date('Y-m-01');
1971
-            $DateTime                        =
1972
-                new DateTime($now, new DateTimeZone(EEM_Event::instance()->get_timezone()));
1973
-            $start                           = $DateTime->setTime(0, 0)->format(implode(' ', $start_formats));
1974
-            $end                             = $DateTime->setDate(date('Y'), date('m'), $DateTime->format('t'))
1975
-                                                        ->setTime(23, 59, 59)
1976
-                                                        ->format(implode(' ', $start_formats));
1977
-            $where['Datetime.DTT_EVT_start'] = ['BETWEEN', [$start, $end]];
1978
-        }
1979
-        if (! EE_Registry::instance()->CAP->current_user_can('ee_read_others_events', 'get_events')) {
1980
-            $where['EVT_wp_user'] = get_current_user_id();
1981
-        } else {
1982
-            if (! isset($where['status'])) {
1983
-                if (! EE_Registry::instance()->CAP->current_user_can('ee_read_private_events', 'get_events')) {
1984
-                    $where['OR'] = [
1985
-                        'status*restrict_private' => ['!=', 'private'],
1986
-                        'AND'                     => [
1987
-                            'status*inclusive' => ['=', 'private'],
1988
-                            'EVT_wp_user'      => get_current_user_id(),
1989
-                        ],
1990
-                    ];
1991
-                }
1992
-            }
1993
-        }
1994
-        $wp_user = $this->request->getRequestParam('EVT_wp_user', 0, 'int');
1995
-        if (
1996
-            $wp_user
1997
-            && $wp_user !== get_current_user_id()
1998
-            && EE_Registry::instance()->CAP->current_user_can('ee_read_others_events', 'get_events')
1999
-        ) {
2000
-            $where['EVT_wp_user'] = $wp_user;
2001
-        }
2002
-        // search query handling
2003
-        $search_term = $this->request->getRequestParam('s');
2004
-        if ($search_term) {
2005
-            $search_term = '%' . $search_term . '%';
2006
-            $where['OR'] = [
2007
-                'EVT_name'       => ['LIKE', $search_term],
2008
-                'EVT_desc'       => ['LIKE', $search_term],
2009
-                'EVT_short_desc' => ['LIKE', $search_term],
2010
-            ];
2011
-        }
2012
-        // filter events by venue.
2013
-        $venue = $this->request->getRequestParam('venue', 0, 'int');
2014
-        if ($venue) {
2015
-            $where['Venue.VNU_ID'] = $venue;
2016
-        }
2017
-        $request_params = $this->request->requestParams();
2018
-        $where          = apply_filters('FHEE__Events_Admin_Page__get_events__where', $where, $request_params);
2019
-        $query_params   = apply_filters(
2020
-            'FHEE__Events_Admin_Page__get_events__query_params',
2021
-            [
2022
-                $where,
2023
-                'limit'    => $limit,
2024
-                'order_by' => $orderby,
2025
-                'order'    => $order,
2026
-                'group_by' => 'EVT_ID',
2027
-            ],
2028
-            $request_params
2029
-        );
2030
-
2031
-        // let's first check if we have special requests coming in.
2032
-        $active_status = $this->request->getRequestParam('active_status');
2033
-        if ($active_status) {
2034
-            switch ($active_status) {
2035
-                case 'upcoming':
2036
-                    return $EEM_Event->get_upcoming_events($query_params, $count);
2037
-                case 'expired':
2038
-                    return $EEM_Event->get_expired_events($query_params, $count);
2039
-                case 'active':
2040
-                    return $EEM_Event->get_active_events($query_params, $count);
2041
-                case 'inactive':
2042
-                    return $EEM_Event->get_inactive_events($query_params, $count);
2043
-            }
2044
-        }
2045
-
2046
-        return $count ? $EEM_Event->count([$where], 'EVT_ID', true) : $EEM_Event->get_all($query_params);
2047
-    }
2048
-
2049
-
2050
-    /**
2051
-     * handling for WordPress CPT actions (trash, restore, delete)
2052
-     *
2053
-     * @param string $post_id
2054
-     * @throws EE_Error
2055
-     * @throws ReflectionException
2056
-     */
2057
-    public function trash_cpt_item($post_id)
2058
-    {
2059
-        $this->request->setRequestParam('EVT_ID', $post_id);
2060
-        $this->_trash_or_restore_event('trash', false);
2061
-    }
2062
-
2063
-
2064
-    /**
2065
-     * @param string $post_id
2066
-     * @throws EE_Error
2067
-     * @throws ReflectionException
2068
-     */
2069
-    public function restore_cpt_item($post_id)
2070
-    {
2071
-        $this->request->setRequestParam('EVT_ID', $post_id);
2072
-        $this->_trash_or_restore_event('draft', false);
2073
-    }
2074
-
2075
-
2076
-    /**
2077
-     * @param string $post_id
2078
-     * @throws EE_Error
2079
-     * @throws EE_Error
2080
-     */
2081
-    public function delete_cpt_item($post_id)
2082
-    {
2083
-        throw new EE_Error(
2084
-            esc_html__(
2085
-                'Please contact Event Espresso support with the details of the steps taken to produce this error.',
2086
-                'event_espresso'
2087
-            )
2088
-        );
2089
-        // $this->request->setRequestParam('EVT_ID', $post_id);
2090
-        // $this->_delete_event();
2091
-    }
2092
-
2093
-
2094
-    /**
2095
-     * _trash_or_restore_event
2096
-     *
2097
-     * @access protected
2098
-     * @param string $event_status
2099
-     * @param bool   $redirect_after
2100
-     * @throws EE_Error
2101
-     * @throws EE_Error
2102
-     * @throws ReflectionException
2103
-     */
2104
-    protected function _trash_or_restore_event($event_status = 'trash', $redirect_after = true)
2105
-    {
2106
-        // determine the event id and set to array.
2107
-        $EVT_ID = $this->request->getRequestParam('EVT_ID', 0, 'int');
2108
-        // loop thru events
2109
-        if ($EVT_ID) {
2110
-            // clean status
2111
-            $event_status = sanitize_key($event_status);
2112
-            // grab status
2113
-            if (! empty($event_status)) {
2114
-                $success = $this->_change_event_status($EVT_ID, $event_status);
2115
-            } else {
2116
-                $success = false;
2117
-                $msg     = esc_html__(
2118
-                    'An error occurred. The event could not be moved to the trash because a valid event status was not not supplied.',
2119
-                    'event_espresso'
2120
-                );
2121
-                EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__);
2122
-            }
2123
-        } else {
2124
-            $success = false;
2125
-            $msg     = esc_html__(
2126
-                'An error occurred. The event could not be moved to the trash because a valid event ID was not not supplied.',
2127
-                'event_espresso'
2128
-            );
2129
-            EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__);
2130
-        }
2131
-        $action = $event_status === 'trash' ? 'moved to the trash' : 'restored from the trash';
2132
-        if ($redirect_after) {
2133
-            $this->_redirect_after_action($success, 'Event', $action, ['action' => 'default']);
2134
-        }
2135
-    }
2136
-
2137
-
2138
-    /**
2139
-     * _trash_or_restore_events
2140
-     *
2141
-     * @access protected
2142
-     * @param string $event_status
2143
-     * @return void
2144
-     * @throws EE_Error
2145
-     * @throws EE_Error
2146
-     * @throws ReflectionException
2147
-     */
2148
-    protected function _trash_or_restore_events($event_status = 'trash')
2149
-    {
2150
-        // clean status
2151
-        $event_status = sanitize_key($event_status);
2152
-        // grab status
2153
-        if (! empty($event_status)) {
2154
-            $success = true;
2155
-            // determine the event id and set to array.
2156
-            $EVT_IDs = $this->request->getRequestParam('EVT_IDs', [], 'int', true);
2157
-            // loop thru events
2158
-            foreach ($EVT_IDs as $EVT_ID) {
2159
-                if ($EVT_ID = absint($EVT_ID)) {
2160
-                    $results = $this->_change_event_status($EVT_ID, $event_status);
2161
-                    $success = $results !== false ? $success : false;
2162
-                } else {
2163
-                    $msg = sprintf(
2164
-                        esc_html__(
2165
-                            'An error occurred. Event #%d could not be moved to the trash because a valid event ID was not not supplied.',
2166
-                            'event_espresso'
2167
-                        ),
2168
-                        $EVT_ID
2169
-                    );
2170
-                    EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__);
2171
-                    $success = false;
2172
-                }
2173
-            }
2174
-        } else {
2175
-            $success = false;
2176
-            $msg     = esc_html__(
2177
-                'An error occurred. The event could not be moved to the trash because a valid event status was not not supplied.',
2178
-                'event_espresso'
2179
-            );
2180
-            EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__);
2181
-        }
2182
-        // in order to force a pluralized result message we need to send back a success status greater than 1
2183
-        $success = $success ? 2 : false;
2184
-        $action  = $event_status === 'trash' ? 'moved to the trash' : 'restored from the trash';
2185
-        $this->_redirect_after_action($success, 'Events', $action, ['action' => 'default']);
2186
-    }
2187
-
2188
-
2189
-    /**
2190
-     * @param int    $EVT_ID
2191
-     * @param string $event_status
2192
-     * @return bool
2193
-     * @throws EE_Error
2194
-     * @throws ReflectionException
2195
-     */
2196
-    private function _change_event_status($EVT_ID = 0, $event_status = '')
2197
-    {
2198
-        // grab event id
2199
-        if (! $EVT_ID) {
2200
-            $msg = esc_html__(
2201
-                'An error occurred. No Event ID or an invalid Event ID was received.',
2202
-                'event_espresso'
2203
-            );
2204
-            EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__);
2205
-            return false;
2206
-        }
2207
-        $this->_cpt_model_obj = EEM_Event::instance()->get_one_by_ID($EVT_ID);
2208
-        // clean status
2209
-        $event_status = sanitize_key($event_status);
2210
-        // grab status
2211
-        if (empty($event_status)) {
2212
-            $msg = esc_html__(
2213
-                'An error occurred. No Event Status or an invalid Event Status was received.',
2214
-                'event_espresso'
2215
-            );
2216
-            EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__);
2217
-            return false;
2218
-        }
2219
-        // was event trashed or restored ?
2220
-        switch ($event_status) {
2221
-            case 'draft':
2222
-                $action = 'restored from the trash';
2223
-                $hook   = 'AHEE_event_restored_from_trash';
2224
-                break;
2225
-            case 'trash':
2226
-                $action = 'moved to the trash';
2227
-                $hook   = 'AHEE_event_moved_to_trash';
2228
-                break;
2229
-            default:
2230
-                $action = 'updated';
2231
-                $hook   = false;
2232
-        }
2233
-        // use class to change status
2234
-        $this->_cpt_model_obj->set_status($event_status);
2235
-        $success = $this->_cpt_model_obj->save();
2236
-        if (! $success) {
2237
-            $msg = sprintf(esc_html__('An error occurred. The event could not be %s.', 'event_espresso'), $action);
2238
-            EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__);
2239
-            return false;
2240
-        }
2241
-        if ($hook) {
2242
-            do_action($hook);
2243
-        }
2244
-        return true;
2245
-    }
2246
-
2247
-
2248
-    /**
2249
-     * @param array $event_ids
2250
-     * @return array
2251
-     * @since   4.10.23.p
2252
-     */
2253
-    private function cleanEventIds(array $event_ids)
2254
-    {
2255
-        return array_map('absint', $event_ids);
2256
-    }
2257
-
2258
-
2259
-    /**
2260
-     * @return array
2261
-     * @since   4.10.23.p
2262
-     */
2263
-    private function getEventIdsFromRequest()
2264
-    {
2265
-        if ($this->request->requestParamIsSet('EVT_IDs')) {
2266
-            return $this->request->getRequestParam('EVT_IDs', [], 'int', true);
2267
-        } else {
2268
-            return $this->request->getRequestParam('EVT_ID', [], 'int', true);
2269
-        }
2270
-    }
2271
-
2272
-
2273
-    /**
2274
-     * @param bool $preview_delete
2275
-     * @throws EE_Error
2276
-     */
2277
-    protected function _delete_event($preview_delete = true)
2278
-    {
2279
-        $this->_delete_events($preview_delete);
2280
-    }
2281
-
2282
-
2283
-    /**
2284
-     * Gets the tree traversal batch persister.
2285
-     *
2286
-     * @return NodeGroupDao
2287
-     * @throws InvalidArgumentException
2288
-     * @throws InvalidDataTypeException
2289
-     * @throws InvalidInterfaceException
2290
-     * @since 4.10.12.p
2291
-     */
2292
-    protected function getModelObjNodeGroupPersister()
2293
-    {
2294
-        if (! $this->model_obj_node_group_persister instanceof NodeGroupDao) {
2295
-            $this->model_obj_node_group_persister =
2296
-                $this->getLoader()->load('\EventEspresso\core\services\orm\tree_traversal\NodeGroupDao');
2297
-        }
2298
-        return $this->model_obj_node_group_persister;
2299
-    }
2300
-
2301
-
2302
-    /**
2303
-     * @param bool $preview_delete
2304
-     * @return void
2305
-     * @throws EE_Error
2306
-     */
2307
-    protected function _delete_events($preview_delete = true)
2308
-    {
2309
-        $event_ids = $this->getEventIdsFromRequest();
2310
-        if ($preview_delete) {
2311
-            $this->generateDeletionPreview($event_ids);
2312
-        } else {
2313
-            EEM_Event::instance()->delete_permanently([['EVT_ID' => ['IN', $event_ids]]]);
2314
-        }
2315
-    }
2316
-
2317
-
2318
-    /**
2319
-     * @param array $event_ids
2320
-     */
2321
-    protected function generateDeletionPreview(array $event_ids)
2322
-    {
2323
-        $event_ids = $this->cleanEventIds($event_ids);
2324
-        // Set a code we can use to reference this deletion task in the batch jobs and preview page.
2325
-        $deletion_job_code = $this->getModelObjNodeGroupPersister()->generateGroupCode();
2326
-        $return_url        = EE_Admin_Page::add_query_args_and_nonce(
2327
-            [
2328
-                'action'            => 'preview_deletion',
2329
-                'deletion_job_code' => $deletion_job_code,
2330
-            ],
2331
-            $this->_admin_base_url
2332
-        );
2333
-        EEH_URL::safeRedirectAndExit(
2334
-            EE_Admin_Page::add_query_args_and_nonce(
2335
-                [
2336
-                    'page'              => 'espresso_batch',
2337
-                    'batch'             => EED_Batch::batch_job,
2338
-                    'EVT_IDs'           => $event_ids,
2339
-                    'deletion_job_code' => $deletion_job_code,
2340
-                    'job_handler'       => urlencode('EventEspressoBatchRequest\JobHandlers\PreviewEventDeletion'),
2341
-                    'return_url'        => urlencode($return_url),
2342
-                ],
2343
-                admin_url()
2344
-            )
2345
-        );
2346
-    }
2347
-
2348
-
2349
-    /**
2350
-     * Checks for a POST submission
2351
-     *
2352
-     * @since 4.10.12.p
2353
-     */
2354
-    protected function confirmDeletion()
2355
-    {
2356
-        $deletion_redirect_logic =
2357
-            $this->getLoader()->getShared('\EventEspresso\core\domain\services\admin\events\data\ConfirmDeletion');
2358
-        $deletion_redirect_logic->handle($this->get_request_data(), $this->admin_base_url());
2359
-    }
2360
-
2361
-
2362
-    /**
2363
-     * A page for users to preview what exactly will be deleted, and confirm they want to delete it.
2364
-     *
2365
-     * @throws EE_Error
2366
-     * @since 4.10.12.p
2367
-     */
2368
-    protected function previewDeletion()
2369
-    {
2370
-        $preview_deletion_logic =
2371
-            $this->getLoader()->getShared('\EventEspresso\core\domain\services\admin\events\data\PreviewDeletion');
2372
-        $this->set_template_args($preview_deletion_logic->handle($this->get_request_data(), $this->admin_base_url()));
2373
-        $this->display_admin_page_with_no_sidebar();
2374
-    }
2375
-
2376
-
2377
-    /**
2378
-     * get total number of events
2379
-     *
2380
-     * @access public
2381
-     * @return int
2382
-     * @throws EE_Error
2383
-     * @throws EE_Error
2384
-     */
2385
-    public function total_events()
2386
-    {
2387
-        return EEM_Event::instance()->count(
2388
-            ['caps' => 'read_admin'],
2389
-            'EVT_ID',
2390
-            true
2391
-        );
2392
-    }
2393
-
2394
-
2395
-    /**
2396
-     * get total number of draft events
2397
-     *
2398
-     * @access public
2399
-     * @return int
2400
-     * @throws EE_Error
2401
-     * @throws EE_Error
2402
-     */
2403
-    public function total_events_draft()
2404
-    {
2405
-        return EEM_Event::instance()->count(
2406
-            [
2407
-                ['status' => ['IN', ['draft', 'auto-draft']]],
2408
-                'caps' => 'read_admin',
2409
-            ],
2410
-            'EVT_ID',
2411
-            true
2412
-        );
2413
-    }
2414
-
2415
-
2416
-    /**
2417
-     * get total number of trashed events
2418
-     *
2419
-     * @access public
2420
-     * @return int
2421
-     * @throws EE_Error
2422
-     * @throws EE_Error
2423
-     */
2424
-    public function total_trashed_events()
2425
-    {
2426
-        return EEM_Event::instance()->count(
2427
-            [
2428
-                ['status' => 'trash'],
2429
-                'caps' => 'read_admin',
2430
-            ],
2431
-            'EVT_ID',
2432
-            true
2433
-        );
2434
-    }
2435
-
2436
-
2437
-    /**
2438
-     *    _default_event_settings
2439
-     *    This generates the Default Settings Tab
2440
-     *
2441
-     * @return void
2442
-     * @throws DomainException
2443
-     * @throws EE_Error
2444
-     * @throws InvalidArgumentException
2445
-     * @throws InvalidDataTypeException
2446
-     * @throws InvalidInterfaceException
2447
-     */
2448
-    protected function _default_event_settings()
2449
-    {
2450
-        $this->_set_add_edit_form_tags('update_default_event_settings');
2451
-        $this->_set_publish_post_box_vars(null, false, false, null, false);
2452
-        $this->_template_args['admin_page_content'] = EEH_HTML::div(
2453
-            $this->_default_event_settings_form()->get_html(),
2454
-            '',
2455
-            'padding'
2456
-        );
2457
-        $this->display_admin_page_with_sidebar();
2458
-    }
2459
-
2460
-
2461
-    /**
2462
-     * Return the form for event settings.
2463
-     *
2464
-     * @return EE_Form_Section_Proper
2465
-     * @throws EE_Error
2466
-     */
2467
-    protected function _default_event_settings_form()
2468
-    {
2469
-        $registration_config              = EE_Registry::instance()->CFG->registration;
2470
-        $registration_stati_for_selection = EEM_Registration::reg_status_array(
2471
-        // exclude
2472
-            [
2473
-                EEM_Registration::status_id_cancelled,
2474
-                EEM_Registration::status_id_declined,
2475
-                EEM_Registration::status_id_incomplete,
2476
-                EEM_Registration::status_id_wait_list,
2477
-            ],
2478
-            true
2479
-        );
2480
-        // setup Advanced Editor ???
2481
-        if (
2482
-            $this->raw_req_action === 'default_event_settings'
2483
-            || $this->raw_req_action === 'update_default_event_settings'
2484
-        ) {
2485
-            $this->advanced_editor_admin_form = $this->loader->getShared(AdvancedEditorAdminFormSection::class);
2486
-        }
2487
-        return new EE_Form_Section_Proper(
2488
-            [
2489
-                'name'            => 'update_default_event_settings',
2490
-                'html_id'         => 'update_default_event_settings',
2491
-                'html_class'      => 'form-table',
2492
-                'layout_strategy' => new EE_Admin_Two_Column_Layout(),
2493
-                'subsections'     => apply_filters(
2494
-                    'FHEE__Events_Admin_Page___default_event_settings_form__form_subsections',
2495
-                    [
2496
-                        'defaults_section_header' => new EE_Form_Section_HTML(
2497
-                            EEH_HTML::h2(
2498
-                                esc_html__('Default Settings', 'event_espresso'),
2499
-                                '',
2500
-                                'ee-admin-settings-hdr'
2501
-                            )
2502
-                        ),
2503
-                        'default_reg_status'  => new EE_Select_Input(
2504
-                            $registration_stati_for_selection,
2505
-                            [
2506
-                                'default'         => isset($registration_config->default_STS_ID)
2507
-                                                     && array_key_exists(
2508
-                                                         $registration_config->default_STS_ID,
2509
-                                                         $registration_stati_for_selection
2510
-                                                     )
2511
-                                    ? sanitize_text_field($registration_config->default_STS_ID)
2512
-                                    : EEM_Registration::status_id_pending_payment,
2513
-                                'html_label_text' => esc_html__('Default Registration Status', 'event_espresso')
2514
-                                                     . EEH_Template::get_help_tab_link(
2515
-                                                         'default_settings_status_help_tab'
2516
-                                                     ),
2517
-                                'html_help_text'  => esc_html__(
2518
-                                    '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.',
2519
-                                    'event_espresso'
2520
-                                ),
2521
-                            ]
2522
-                        ),
2523
-                        'default_max_tickets' => new EE_Integer_Input(
2524
-                            [
2525
-                                'default'         => isset($registration_config->default_maximum_number_of_tickets)
2526
-                                    ? $registration_config->default_maximum_number_of_tickets
2527
-                                    : EEM_Event::get_default_additional_limit(),
2528
-                                'html_label_text' => esc_html__(
2529
-                                    'Default Maximum Tickets Allowed Per Order:',
2530
-                                    'event_espresso'
2531
-                                )
2532
-                                                     . EEH_Template::get_help_tab_link(
2533
-                                                         'default_maximum_tickets_help_tab"'
2534
-                                                     ),
2535
-                                'html_help_text'  => esc_html__(
2536
-                                    'This setting allows you to indicate what will be the default for the maximum number of tickets per order when creating new events.',
2537
-                                    'event_espresso'
2538
-                                ),
2539
-                            ]
2540
-                        ),
2541
-                    ]
2542
-                ),
2543
-            ]
2544
-        );
2545
-    }
2546
-
2547
-
2548
-    /**
2549
-     * @return void
2550
-     * @throws EE_Error
2551
-     * @throws InvalidArgumentException
2552
-     * @throws InvalidDataTypeException
2553
-     * @throws InvalidInterfaceException
2554
-     */
2555
-    protected function _update_default_event_settings()
2556
-    {
2557
-        $form = $this->_default_event_settings_form();
2558
-        if ($form->was_submitted()) {
2559
-            $form->receive_form_submission();
2560
-            if ($form->is_valid()) {
2561
-                $registration_config = EE_Registry::instance()->CFG->registration;
2562
-                $valid_data          = $form->valid_data();
2563
-                if (isset($valid_data['default_reg_status'])) {
2564
-                    $registration_config->default_STS_ID = $valid_data['default_reg_status'];
2565
-                }
2566
-                if (isset($valid_data['default_max_tickets'])) {
2567
-                    $registration_config->default_maximum_number_of_tickets = $valid_data['default_max_tickets'];
2568
-                }
2569
-                do_action(
2570
-                    'AHEE__Events_Admin_Page___update_default_event_settings',
2571
-                    $valid_data,
2572
-                    EE_Registry::instance()->CFG,
2573
-                    $this
2574
-                );
2575
-                // update because data was valid!
2576
-                EE_Registry::instance()->CFG->update_espresso_config();
2577
-                EE_Error::overwrite_success();
2578
-                EE_Error::add_success(
2579
-                    esc_html__('Default Event Settings were updated', 'event_espresso')
2580
-                );
2581
-            }
2582
-        }
2583
-        $this->_redirect_after_action(0, '', '', ['action' => 'default_event_settings'], true);
2584
-    }
2585
-
2586
-
2587
-    /*************        Templates        *************
2588
-     *
2589
-     * @throws EE_Error
2590
-     */
2591
-    protected function _template_settings()
2592
-    {
2593
-        $this->_admin_page_title              = esc_html__('Template Settings (Preview)', 'event_espresso');
2594
-        $this->_template_args['preview_img']  = '<img src="'
2595
-                                                . EVENTS_ASSETS_URL
2596
-                                                . '/images/'
2597
-                                                . 'caffeinated_template_features.jpg" alt="'
2598
-                                                . esc_attr__('Template Settings Preview screenshot', 'event_espresso')
2599
-                                                . '" />';
2600
-        $this->_template_args['preview_text'] = '<strong>'
2601
-                                                . esc_html__(
2602
-                                                    '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.',
2603
-                                                    'event_espresso'
2604
-                                                ) . '</strong>';
2605
-        $this->display_admin_caf_preview_page('template_settings_tab');
2606
-    }
2607
-
2608
-
2609
-    /** Event Category Stuff **/
2610
-    /**
2611
-     * set the _category property with the category object for the loaded page.
2612
-     *
2613
-     * @access private
2614
-     * @return void
2615
-     */
2616
-    private function _set_category_object()
2617
-    {
2618
-        if (isset($this->_category->id) && ! empty($this->_category->id)) {
2619
-            return;
2620
-        } //already have the category object so get out.
2621
-        // set default category object
2622
-        $this->_set_empty_category_object();
2623
-        // only set if we've got an id
2624
-        $category_ID = $this->request->getRequestParam('EVT_CAT_ID', 0, 'int');
2625
-        if (! $category_ID) {
2626
-            return;
2627
-        }
2628
-        $term = get_term($category_ID, EEM_CPT_Base::EVENT_CATEGORY_TAXONOMY);
2629
-        if (! empty($term)) {
2630
-            $this->_category->category_name       = $term->name;
2631
-            $this->_category->category_identifier = $term->slug;
2632
-            $this->_category->category_desc       = $term->description;
2633
-            $this->_category->id                  = $term->term_id;
2634
-            $this->_category->parent              = $term->parent;
2635
-        }
2636
-    }
2637
-
2638
-
2639
-    /**
2640
-     * Clears out category properties.
2641
-     */
2642
-    private function _set_empty_category_object()
2643
-    {
2644
-        $this->_category                = new stdClass();
2645
-        $this->_category->category_name = $this->_category->category_identifier = $this->_category->category_desc = '';
2646
-        $this->_category->id            = $this->_category->parent = 0;
2647
-    }
2648
-
2649
-
2650
-    /**
2651
-     * @throws DomainException
2652
-     * @throws EE_Error
2653
-     * @throws InvalidArgumentException
2654
-     * @throws InvalidDataTypeException
2655
-     * @throws InvalidInterfaceException
2656
-     */
2657
-    protected function _category_list_table()
2658
-    {
2659
-        do_action('AHEE_log', __FILE__, __FUNCTION__, '');
2660
-        $this->_search_btn_label = esc_html__('Categories', 'event_espresso');
2661
-        $this->_admin_page_title .= ' ';
2662
-        $this->_admin_page_title .= $this->get_action_link_or_button(
2663
-            'add_category',
2664
-            'add_category',
2665
-            [],
2666
-            'add-new-h2'
2667
-        );
2668
-        $this->display_admin_list_table_page_with_sidebar();
2669
-    }
2670
-
2671
-
2672
-    /**
2673
-     * Output category details view.
2674
-     *
2675
-     * @throws EE_Error
2676
-     * @throws EE_Error
2677
-     */
2678
-    protected function _category_details($view)
2679
-    {
2680
-        // load formatter helper
2681
-        // load field generator helper
2682
-        $route = $view === 'edit' ? 'update_category' : 'insert_category';
2683
-        $this->_set_add_edit_form_tags($route);
2684
-        $this->_set_category_object();
2685
-        $id            = ! empty($this->_category->id) ? $this->_category->id : '';
2686
-        $delete_action = 'delete_category';
2687
-        // custom redirect
2688
-        $redirect = EE_Admin_Page::add_query_args_and_nonce(
2689
-            ['action' => 'category_list'],
2690
-            $this->_admin_base_url
2691
-        );
2692
-        $this->_set_publish_post_box_vars('EVT_CAT_ID', $id, $delete_action, $redirect);
2693
-        // take care of contents
2694
-        $this->_template_args['admin_page_content'] = $this->_category_details_content();
2695
-        $this->display_admin_page_with_sidebar();
2696
-    }
2697
-
2698
-
2699
-    /**
2700
-     * Output category details content.
2701
-     *
2702
-     * @throws DomainException
2703
-     */
2704
-    protected function _category_details_content()
2705
-    {
2706
-        $editor_args['category_desc'] = [
2707
-            'type'          => 'wp_editor',
2708
-            'value'         => EEH_Formatter::admin_format_content($this->_category->category_desc),
2709
-            'class'         => 'my_editor_custom',
2710
-            'wpeditor_args' => ['media_buttons' => false],
2711
-        ];
2712
-        $_wp_editor                   = $this->_generate_admin_form_fields($editor_args, 'array');
2713
-        $all_terms                    = get_terms(
2714
-            [EEM_CPT_Base::EVENT_CATEGORY_TAXONOMY],
2715
-            ['hide_empty' => 0, 'exclude' => [$this->_category->id]]
2716
-        );
2717
-        // setup category select for term parents.
2718
-        $category_select_values[] = [
2719
-            'text' => esc_html__('No Parent', 'event_espresso'),
2720
-            'id'   => 0,
2721
-        ];
2722
-        foreach ($all_terms as $term) {
2723
-            $category_select_values[] = [
2724
-                'text' => $term->name,
2725
-                'id'   => $term->term_id,
2726
-            ];
2727
-        }
2728
-        $category_select = EEH_Form_Fields::select_input(
2729
-            'category_parent',
2730
-            $category_select_values,
2731
-            $this->_category->parent
2732
-        );
2733
-        $template_args   = [
2734
-            'category'                 => $this->_category,
2735
-            'category_select'          => $category_select,
2736
-            'unique_id_info_help_link' => $this->_get_help_tab_link('unique_id_info'),
2737
-            'category_desc_editor'     => $_wp_editor['category_desc']['field'],
2738
-            'disable'                  => '',
2739
-            'disabled_message'         => false,
2740
-        ];
2741
-        $template        = EVENTS_TEMPLATE_PATH . 'event_category_details.template.php';
2742
-        return EEH_Template::display_template($template, $template_args, true);
2743
-    }
2744
-
2745
-
2746
-    /**
2747
-     * Handles deleting categories.
2748
-     *
2749
-     * @throws EE_Error
2750
-     */
2751
-    protected function _delete_categories()
2752
-    {
2753
-        $category_IDs = $this->request->getRequestParam('EVT_CAT_ID', 0, 'int', true);
2754
-        foreach ($category_IDs as $category_ID) {
2755
-            $this->_delete_category($category_ID);
2756
-        }
2757
-        // doesn't matter what page we're coming from... we're going to the same place after delete.
2758
-        $query_args = [
2759
-            'action' => 'category_list',
2760
-        ];
2761
-        $this->_redirect_after_action(0, '', '', $query_args);
2762
-    }
2763
-
2764
-
2765
-    /**
2766
-     * Handles deleting specific category.
2767
-     *
2768
-     * @param int $cat_id
2769
-     */
2770
-    protected function _delete_category($cat_id)
2771
-    {
2772
-        $cat_id = absint($cat_id);
2773
-        wp_delete_term($cat_id, EEM_CPT_Base::EVENT_CATEGORY_TAXONOMY);
2774
-    }
2775
-
2776
-
2777
-    /**
2778
-     * Handles triggering the update or insertion of a new category.
2779
-     *
2780
-     * @param bool $new_category true means we're triggering the insert of a new category.
2781
-     * @throws EE_Error
2782
-     * @throws EE_Error
2783
-     */
2784
-    protected function _insert_or_update_category($new_category)
2785
-    {
2786
-        $cat_id  = $new_category ? $this->_insert_category() : $this->_insert_category(true);
2787
-        $success = 0; // we already have a success message so lets not send another.
2788
-        if ($cat_id) {
2789
-            $query_args = [
2790
-                'action'     => 'edit_category',
2791
-                'EVT_CAT_ID' => $cat_id,
2792
-            ];
2793
-        } else {
2794
-            $query_args = ['action' => 'add_category'];
2795
-        }
2796
-        $this->_redirect_after_action($success, '', '', $query_args, true);
2797
-    }
2798
-
2799
-
2800
-    /**
2801
-     * Inserts or updates category
2802
-     *
2803
-     * @param bool $update (true indicates we're updating a category).
2804
-     * @return bool|mixed|string
2805
-     */
2806
-    private function _insert_category($update = false)
2807
-    {
2808
-        $category_ID         = $update ? $this->request->getRequestParam('EVT_CAT_ID', 0, 'int') : 0;
2809
-        $category_name       = $this->request->getRequestParam('category_name', '');
2810
-        $category_desc       = $this->request->getRequestParam('category_desc', '');
2811
-        $category_parent     = $this->request->getRequestParam('category_parent', 0, 'int');
2812
-        $category_identifier = $this->request->getRequestParam('category_identifier', '');
2813
-
2814
-        if (empty($category_name)) {
2815
-            $msg = esc_html__('You must add a name for the category.', 'event_espresso');
2816
-            EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__);
2817
-            return false;
2818
-        }
2819
-        $term_args = [
2820
-            'name'        => $category_name,
2821
-            'description' => $category_desc,
2822
-            'parent'      => $category_parent,
2823
-        ];
2824
-        // was the category_identifier input disabled?
2825
-        if ($category_identifier) {
2826
-            $term_args['slug'] = $category_identifier;
2827
-        }
2828
-        $insert_ids = $update
2829
-            ? wp_update_term($category_ID, EEM_CPT_Base::EVENT_CATEGORY_TAXONOMY, $term_args)
2830
-            : wp_insert_term($category_name, EEM_CPT_Base::EVENT_CATEGORY_TAXONOMY, $term_args);
2831
-        if (! is_array($insert_ids)) {
2832
-            $msg = esc_html__(
2833
-                'An error occurred and the category has not been saved to the database.',
2834
-                'event_espresso'
2835
-            );
2836
-            EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__);
2837
-        } else {
2838
-            $category_ID = $insert_ids['term_id'];
2839
-            $msg         = sprintf(
2840
-                esc_html__('The category %s was successfully saved', 'event_espresso'),
2841
-                $category_name
2842
-            );
2843
-            EE_Error::add_success($msg);
2844
-        }
2845
-        return $category_ID;
2846
-    }
2847
-
2848
-
2849
-    /**
2850
-     * Gets categories or count of categories matching the arguments in the request.
2851
-     *
2852
-     * @param int  $per_page
2853
-     * @param int  $current_page
2854
-     * @param bool $count
2855
-     * @return EE_Term_Taxonomy[]|int
2856
-     * @throws EE_Error
2857
-     */
2858
-    public function get_categories($per_page = 10, $current_page = 1, $count = false)
2859
-    {
2860
-        // testing term stuff
2861
-        $orderby     = $this->request->getRequestParam('orderby', 'Term.term_id');
2862
-        $order       = $this->request->getRequestParam('order', 'DESC');
2863
-        $limit       = ($current_page - 1) * $per_page;
2864
-        $where       = ['taxonomy' => EEM_CPT_Base::EVENT_CATEGORY_TAXONOMY];
2865
-        $search_term = $this->request->getRequestParam('s');
2866
-        if ($search_term) {
2867
-            $search_term = '%' . $search_term . '%';
2868
-            $where['OR'] = [
2869
-                'Term.name'   => ['LIKE', $search_term],
2870
-                'description' => ['LIKE', $search_term],
2871
-            ];
2872
-        }
2873
-        $query_params = [
2874
-            $where,
2875
-            'order_by'   => [$orderby => $order],
2876
-            'limit'      => $limit . ',' . $per_page,
2877
-            'force_join' => ['Term'],
2878
-        ];
2879
-        return $count
2880
-            ? EEM_Term_Taxonomy::instance()->count($query_params, 'term_id')
2881
-            : EEM_Term_Taxonomy::instance()->get_all($query_params);
2882
-    }
2883
-
2884
-    /* end category stuff */
2885
-
2886
-
2887
-    /**************/
2888
-
2889
-
2890
-    /**
2891
-     * Callback for the `ee_save_timezone_setting` ajax action.
2892
-     *
2893
-     * @throws EE_Error
2894
-     * @throws InvalidArgumentException
2895
-     * @throws InvalidDataTypeException
2896
-     * @throws InvalidInterfaceException
2897
-     */
2898
-    public function saveTimezoneString()
2899
-    {
2900
-        $timezone_string = $this->request->getRequestParam('timezone_selected');
2901
-        if (empty($timezone_string) || ! EEH_DTT_Helper::validate_timezone($timezone_string, false)) {
2902
-            EE_Error::add_error(
2903
-                esc_html__('An invalid timezone string submitted.', 'event_espresso'),
2904
-                __FILE__,
2905
-                __FUNCTION__,
2906
-                __LINE__
2907
-            );
2908
-            $this->_template_args['error'] = true;
2909
-            $this->_return_json();
2910
-        }
2911
-
2912
-        update_option('timezone_string', $timezone_string);
2913
-        EE_Error::add_success(
2914
-            esc_html__('Your timezone string was updated.', 'event_espresso')
2915
-        );
2916
-        $this->_template_args['success'] = true;
2917
-        $this->_return_json(true, ['action' => 'create_new']);
2918
-    }
2919
-
2920
-
2921
-    /**
2922 2589
      * @throws EE_Error
2923
-     * @deprecated 4.10.25.p
2924 2590
      */
2925
-    public function save_timezonestring_setting()
2926
-    {
2927
-        $this->saveTimezoneString();
2928
-    }
2591
+	protected function _template_settings()
2592
+	{
2593
+		$this->_admin_page_title              = esc_html__('Template Settings (Preview)', 'event_espresso');
2594
+		$this->_template_args['preview_img']  = '<img src="'
2595
+												. EVENTS_ASSETS_URL
2596
+												. '/images/'
2597
+												. 'caffeinated_template_features.jpg" alt="'
2598
+												. esc_attr__('Template Settings Preview screenshot', 'event_espresso')
2599
+												. '" />';
2600
+		$this->_template_args['preview_text'] = '<strong>'
2601
+												. esc_html__(
2602
+													'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.',
2603
+													'event_espresso'
2604
+												) . '</strong>';
2605
+		$this->display_admin_caf_preview_page('template_settings_tab');
2606
+	}
2607
+
2608
+
2609
+	/** Event Category Stuff **/
2610
+	/**
2611
+	 * set the _category property with the category object for the loaded page.
2612
+	 *
2613
+	 * @access private
2614
+	 * @return void
2615
+	 */
2616
+	private function _set_category_object()
2617
+	{
2618
+		if (isset($this->_category->id) && ! empty($this->_category->id)) {
2619
+			return;
2620
+		} //already have the category object so get out.
2621
+		// set default category object
2622
+		$this->_set_empty_category_object();
2623
+		// only set if we've got an id
2624
+		$category_ID = $this->request->getRequestParam('EVT_CAT_ID', 0, 'int');
2625
+		if (! $category_ID) {
2626
+			return;
2627
+		}
2628
+		$term = get_term($category_ID, EEM_CPT_Base::EVENT_CATEGORY_TAXONOMY);
2629
+		if (! empty($term)) {
2630
+			$this->_category->category_name       = $term->name;
2631
+			$this->_category->category_identifier = $term->slug;
2632
+			$this->_category->category_desc       = $term->description;
2633
+			$this->_category->id                  = $term->term_id;
2634
+			$this->_category->parent              = $term->parent;
2635
+		}
2636
+	}
2637
+
2638
+
2639
+	/**
2640
+	 * Clears out category properties.
2641
+	 */
2642
+	private function _set_empty_category_object()
2643
+	{
2644
+		$this->_category                = new stdClass();
2645
+		$this->_category->category_name = $this->_category->category_identifier = $this->_category->category_desc = '';
2646
+		$this->_category->id            = $this->_category->parent = 0;
2647
+	}
2648
+
2649
+
2650
+	/**
2651
+	 * @throws DomainException
2652
+	 * @throws EE_Error
2653
+	 * @throws InvalidArgumentException
2654
+	 * @throws InvalidDataTypeException
2655
+	 * @throws InvalidInterfaceException
2656
+	 */
2657
+	protected function _category_list_table()
2658
+	{
2659
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
2660
+		$this->_search_btn_label = esc_html__('Categories', 'event_espresso');
2661
+		$this->_admin_page_title .= ' ';
2662
+		$this->_admin_page_title .= $this->get_action_link_or_button(
2663
+			'add_category',
2664
+			'add_category',
2665
+			[],
2666
+			'add-new-h2'
2667
+		);
2668
+		$this->display_admin_list_table_page_with_sidebar();
2669
+	}
2670
+
2671
+
2672
+	/**
2673
+	 * Output category details view.
2674
+	 *
2675
+	 * @throws EE_Error
2676
+	 * @throws EE_Error
2677
+	 */
2678
+	protected function _category_details($view)
2679
+	{
2680
+		// load formatter helper
2681
+		// load field generator helper
2682
+		$route = $view === 'edit' ? 'update_category' : 'insert_category';
2683
+		$this->_set_add_edit_form_tags($route);
2684
+		$this->_set_category_object();
2685
+		$id            = ! empty($this->_category->id) ? $this->_category->id : '';
2686
+		$delete_action = 'delete_category';
2687
+		// custom redirect
2688
+		$redirect = EE_Admin_Page::add_query_args_and_nonce(
2689
+			['action' => 'category_list'],
2690
+			$this->_admin_base_url
2691
+		);
2692
+		$this->_set_publish_post_box_vars('EVT_CAT_ID', $id, $delete_action, $redirect);
2693
+		// take care of contents
2694
+		$this->_template_args['admin_page_content'] = $this->_category_details_content();
2695
+		$this->display_admin_page_with_sidebar();
2696
+	}
2697
+
2698
+
2699
+	/**
2700
+	 * Output category details content.
2701
+	 *
2702
+	 * @throws DomainException
2703
+	 */
2704
+	protected function _category_details_content()
2705
+	{
2706
+		$editor_args['category_desc'] = [
2707
+			'type'          => 'wp_editor',
2708
+			'value'         => EEH_Formatter::admin_format_content($this->_category->category_desc),
2709
+			'class'         => 'my_editor_custom',
2710
+			'wpeditor_args' => ['media_buttons' => false],
2711
+		];
2712
+		$_wp_editor                   = $this->_generate_admin_form_fields($editor_args, 'array');
2713
+		$all_terms                    = get_terms(
2714
+			[EEM_CPT_Base::EVENT_CATEGORY_TAXONOMY],
2715
+			['hide_empty' => 0, 'exclude' => [$this->_category->id]]
2716
+		);
2717
+		// setup category select for term parents.
2718
+		$category_select_values[] = [
2719
+			'text' => esc_html__('No Parent', 'event_espresso'),
2720
+			'id'   => 0,
2721
+		];
2722
+		foreach ($all_terms as $term) {
2723
+			$category_select_values[] = [
2724
+				'text' => $term->name,
2725
+				'id'   => $term->term_id,
2726
+			];
2727
+		}
2728
+		$category_select = EEH_Form_Fields::select_input(
2729
+			'category_parent',
2730
+			$category_select_values,
2731
+			$this->_category->parent
2732
+		);
2733
+		$template_args   = [
2734
+			'category'                 => $this->_category,
2735
+			'category_select'          => $category_select,
2736
+			'unique_id_info_help_link' => $this->_get_help_tab_link('unique_id_info'),
2737
+			'category_desc_editor'     => $_wp_editor['category_desc']['field'],
2738
+			'disable'                  => '',
2739
+			'disabled_message'         => false,
2740
+		];
2741
+		$template        = EVENTS_TEMPLATE_PATH . 'event_category_details.template.php';
2742
+		return EEH_Template::display_template($template, $template_args, true);
2743
+	}
2744
+
2745
+
2746
+	/**
2747
+	 * Handles deleting categories.
2748
+	 *
2749
+	 * @throws EE_Error
2750
+	 */
2751
+	protected function _delete_categories()
2752
+	{
2753
+		$category_IDs = $this->request->getRequestParam('EVT_CAT_ID', 0, 'int', true);
2754
+		foreach ($category_IDs as $category_ID) {
2755
+			$this->_delete_category($category_ID);
2756
+		}
2757
+		// doesn't matter what page we're coming from... we're going to the same place after delete.
2758
+		$query_args = [
2759
+			'action' => 'category_list',
2760
+		];
2761
+		$this->_redirect_after_action(0, '', '', $query_args);
2762
+	}
2763
+
2764
+
2765
+	/**
2766
+	 * Handles deleting specific category.
2767
+	 *
2768
+	 * @param int $cat_id
2769
+	 */
2770
+	protected function _delete_category($cat_id)
2771
+	{
2772
+		$cat_id = absint($cat_id);
2773
+		wp_delete_term($cat_id, EEM_CPT_Base::EVENT_CATEGORY_TAXONOMY);
2774
+	}
2775
+
2776
+
2777
+	/**
2778
+	 * Handles triggering the update or insertion of a new category.
2779
+	 *
2780
+	 * @param bool $new_category true means we're triggering the insert of a new category.
2781
+	 * @throws EE_Error
2782
+	 * @throws EE_Error
2783
+	 */
2784
+	protected function _insert_or_update_category($new_category)
2785
+	{
2786
+		$cat_id  = $new_category ? $this->_insert_category() : $this->_insert_category(true);
2787
+		$success = 0; // we already have a success message so lets not send another.
2788
+		if ($cat_id) {
2789
+			$query_args = [
2790
+				'action'     => 'edit_category',
2791
+				'EVT_CAT_ID' => $cat_id,
2792
+			];
2793
+		} else {
2794
+			$query_args = ['action' => 'add_category'];
2795
+		}
2796
+		$this->_redirect_after_action($success, '', '', $query_args, true);
2797
+	}
2798
+
2799
+
2800
+	/**
2801
+	 * Inserts or updates category
2802
+	 *
2803
+	 * @param bool $update (true indicates we're updating a category).
2804
+	 * @return bool|mixed|string
2805
+	 */
2806
+	private function _insert_category($update = false)
2807
+	{
2808
+		$category_ID         = $update ? $this->request->getRequestParam('EVT_CAT_ID', 0, 'int') : 0;
2809
+		$category_name       = $this->request->getRequestParam('category_name', '');
2810
+		$category_desc       = $this->request->getRequestParam('category_desc', '');
2811
+		$category_parent     = $this->request->getRequestParam('category_parent', 0, 'int');
2812
+		$category_identifier = $this->request->getRequestParam('category_identifier', '');
2813
+
2814
+		if (empty($category_name)) {
2815
+			$msg = esc_html__('You must add a name for the category.', 'event_espresso');
2816
+			EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__);
2817
+			return false;
2818
+		}
2819
+		$term_args = [
2820
+			'name'        => $category_name,
2821
+			'description' => $category_desc,
2822
+			'parent'      => $category_parent,
2823
+		];
2824
+		// was the category_identifier input disabled?
2825
+		if ($category_identifier) {
2826
+			$term_args['slug'] = $category_identifier;
2827
+		}
2828
+		$insert_ids = $update
2829
+			? wp_update_term($category_ID, EEM_CPT_Base::EVENT_CATEGORY_TAXONOMY, $term_args)
2830
+			: wp_insert_term($category_name, EEM_CPT_Base::EVENT_CATEGORY_TAXONOMY, $term_args);
2831
+		if (! is_array($insert_ids)) {
2832
+			$msg = esc_html__(
2833
+				'An error occurred and the category has not been saved to the database.',
2834
+				'event_espresso'
2835
+			);
2836
+			EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__);
2837
+		} else {
2838
+			$category_ID = $insert_ids['term_id'];
2839
+			$msg         = sprintf(
2840
+				esc_html__('The category %s was successfully saved', 'event_espresso'),
2841
+				$category_name
2842
+			);
2843
+			EE_Error::add_success($msg);
2844
+		}
2845
+		return $category_ID;
2846
+	}
2847
+
2848
+
2849
+	/**
2850
+	 * Gets categories or count of categories matching the arguments in the request.
2851
+	 *
2852
+	 * @param int  $per_page
2853
+	 * @param int  $current_page
2854
+	 * @param bool $count
2855
+	 * @return EE_Term_Taxonomy[]|int
2856
+	 * @throws EE_Error
2857
+	 */
2858
+	public function get_categories($per_page = 10, $current_page = 1, $count = false)
2859
+	{
2860
+		// testing term stuff
2861
+		$orderby     = $this->request->getRequestParam('orderby', 'Term.term_id');
2862
+		$order       = $this->request->getRequestParam('order', 'DESC');
2863
+		$limit       = ($current_page - 1) * $per_page;
2864
+		$where       = ['taxonomy' => EEM_CPT_Base::EVENT_CATEGORY_TAXONOMY];
2865
+		$search_term = $this->request->getRequestParam('s');
2866
+		if ($search_term) {
2867
+			$search_term = '%' . $search_term . '%';
2868
+			$where['OR'] = [
2869
+				'Term.name'   => ['LIKE', $search_term],
2870
+				'description' => ['LIKE', $search_term],
2871
+			];
2872
+		}
2873
+		$query_params = [
2874
+			$where,
2875
+			'order_by'   => [$orderby => $order],
2876
+			'limit'      => $limit . ',' . $per_page,
2877
+			'force_join' => ['Term'],
2878
+		];
2879
+		return $count
2880
+			? EEM_Term_Taxonomy::instance()->count($query_params, 'term_id')
2881
+			: EEM_Term_Taxonomy::instance()->get_all($query_params);
2882
+	}
2883
+
2884
+	/* end category stuff */
2885
+
2886
+
2887
+	/**************/
2888
+
2889
+
2890
+	/**
2891
+	 * Callback for the `ee_save_timezone_setting` ajax action.
2892
+	 *
2893
+	 * @throws EE_Error
2894
+	 * @throws InvalidArgumentException
2895
+	 * @throws InvalidDataTypeException
2896
+	 * @throws InvalidInterfaceException
2897
+	 */
2898
+	public function saveTimezoneString()
2899
+	{
2900
+		$timezone_string = $this->request->getRequestParam('timezone_selected');
2901
+		if (empty($timezone_string) || ! EEH_DTT_Helper::validate_timezone($timezone_string, false)) {
2902
+			EE_Error::add_error(
2903
+				esc_html__('An invalid timezone string submitted.', 'event_espresso'),
2904
+				__FILE__,
2905
+				__FUNCTION__,
2906
+				__LINE__
2907
+			);
2908
+			$this->_template_args['error'] = true;
2909
+			$this->_return_json();
2910
+		}
2911
+
2912
+		update_option('timezone_string', $timezone_string);
2913
+		EE_Error::add_success(
2914
+			esc_html__('Your timezone string was updated.', 'event_espresso')
2915
+		);
2916
+		$this->_template_args['success'] = true;
2917
+		$this->_return_json(true, ['action' => 'create_new']);
2918
+	}
2919
+
2920
+
2921
+	/**
2922
+	 * @throws EE_Error
2923
+	 * @deprecated 4.10.25.p
2924
+	 */
2925
+	public function save_timezonestring_setting()
2926
+	{
2927
+		$this->saveTimezoneString();
2928
+	}
2929 2929
 }
Please login to merge, or discard this patch.
vendor/composer/installed.php 2 patches
Indentation   +410 added lines, -410 removed lines patch added patch discarded remove patch
@@ -1,412 +1,412 @@
 block discarded – undo
1 1
 <?php return array(
2
-    'root' => array(
3
-        'pretty_version' => 'dev-master',
4
-        'version' => 'dev-master',
5
-        'type' => 'wordpress-plugin',
6
-        'install_path' => __DIR__ . '/../../',
7
-        'aliases' => array(),
8
-        'reference' => '473c8e78d795988fc9a79bf76e917ad26b76aa24',
9
-        'name' => 'eventespresso/event-espresso-core',
10
-        'dev' => true,
11
-    ),
12
-    'versions' => array(
13
-        'composer/installers' => array(
14
-            'pretty_version' => 'v2.1.0',
15
-            'version' => '2.1.0.0',
16
-            'type' => 'composer-plugin',
17
-            'install_path' => __DIR__ . '/./installers',
18
-            'aliases' => array(),
19
-            'reference' => '75e5ef05436c90ac565a48176cc7465991908352',
20
-            'dev_requirement' => false,
21
-        ),
22
-        'doctrine/instantiator' => array(
23
-            'pretty_version' => '1.4.1',
24
-            'version' => '1.4.1.0',
25
-            'type' => 'library',
26
-            'install_path' => __DIR__ . '/../doctrine/instantiator',
27
-            'aliases' => array(),
28
-            'reference' => '10dcfce151b967d20fde1b34ae6640712c3891bc',
29
-            'dev_requirement' => true,
30
-        ),
31
-        'eventespresso/ee-coding-standards' => array(
32
-            'pretty_version' => 'dev-master',
33
-            'version' => 'dev-master',
34
-            'type' => 'phpcodesniffer-standard',
35
-            'install_path' => __DIR__ . '/../eventespresso/ee-coding-standards',
36
-            'aliases' => array(
37
-                0 => '9999999-dev',
38
-            ),
39
-            'reference' => '4bbdbb4ed08aeb7ac719b19d8adbd0974c8b63ae',
40
-            'dev_requirement' => true,
41
-        ),
42
-        'eventespresso/event-espresso-core' => array(
43
-            'pretty_version' => 'dev-master',
44
-            'version' => 'dev-master',
45
-            'type' => 'wordpress-plugin',
46
-            'install_path' => __DIR__ . '/../../',
47
-            'aliases' => array(),
48
-            'reference' => '473c8e78d795988fc9a79bf76e917ad26b76aa24',
49
-            'dev_requirement' => false,
50
-        ),
51
-        'myclabs/deep-copy' => array(
52
-            'pretty_version' => '1.11.0',
53
-            'version' => '1.11.0.0',
54
-            'type' => 'library',
55
-            'install_path' => __DIR__ . '/../myclabs/deep-copy',
56
-            'aliases' => array(),
57
-            'reference' => '14daed4296fae74d9e3201d2c4925d1acb7aa614',
58
-            'dev_requirement' => true,
59
-        ),
60
-        'nikic/php-parser' => array(
61
-            'pretty_version' => 'v4.13.2',
62
-            'version' => '4.13.2.0',
63
-            'type' => 'library',
64
-            'install_path' => __DIR__ . '/../nikic/php-parser',
65
-            'aliases' => array(),
66
-            'reference' => '210577fe3cf7badcc5814d99455df46564f3c077',
67
-            'dev_requirement' => true,
68
-        ),
69
-        'phar-io/manifest' => array(
70
-            'pretty_version' => '2.0.3',
71
-            'version' => '2.0.3.0',
72
-            'type' => 'library',
73
-            'install_path' => __DIR__ . '/../phar-io/manifest',
74
-            'aliases' => array(),
75
-            'reference' => '97803eca37d319dfa7826cc2437fc020857acb53',
76
-            'dev_requirement' => true,
77
-        ),
78
-        'phar-io/version' => array(
79
-            'pretty_version' => '3.2.1',
80
-            'version' => '3.2.1.0',
81
-            'type' => 'library',
82
-            'install_path' => __DIR__ . '/../phar-io/version',
83
-            'aliases' => array(),
84
-            'reference' => '4f7fd7836c6f332bb2933569e566a0d6c4cbed74',
85
-            'dev_requirement' => true,
86
-        ),
87
-        'phpcompatibility/php-compatibility' => array(
88
-            'pretty_version' => '9.3.5',
89
-            'version' => '9.3.5.0',
90
-            'type' => 'phpcodesniffer-standard',
91
-            'install_path' => __DIR__ . '/../phpcompatibility/php-compatibility',
92
-            'aliases' => array(),
93
-            'reference' => '9fb324479acf6f39452e0655d2429cc0d3914243',
94
-            'dev_requirement' => true,
95
-        ),
96
-        'phpcompatibility/phpcompatibility-paragonie' => array(
97
-            'pretty_version' => '1.3.1',
98
-            'version' => '1.3.1.0',
99
-            'type' => 'phpcodesniffer-standard',
100
-            'install_path' => __DIR__ . '/../phpcompatibility/phpcompatibility-paragonie',
101
-            'aliases' => array(),
102
-            'reference' => 'ddabec839cc003651f2ce695c938686d1086cf43',
103
-            'dev_requirement' => true,
104
-        ),
105
-        'phpcompatibility/phpcompatibility-wp' => array(
106
-            'pretty_version' => '2.1.3',
107
-            'version' => '2.1.3.0',
108
-            'type' => 'phpcodesniffer-standard',
109
-            'install_path' => __DIR__ . '/../phpcompatibility/phpcompatibility-wp',
110
-            'aliases' => array(),
111
-            'reference' => 'd55de55f88697b9cdb94bccf04f14eb3b11cf308',
112
-            'dev_requirement' => true,
113
-        ),
114
-        'phpdocumentor/reflection-common' => array(
115
-            'pretty_version' => '2.2.0',
116
-            'version' => '2.2.0.0',
117
-            'type' => 'library',
118
-            'install_path' => __DIR__ . '/../phpdocumentor/reflection-common',
119
-            'aliases' => array(),
120
-            'reference' => '1d01c49d4ed62f25aa84a747ad35d5a16924662b',
121
-            'dev_requirement' => true,
122
-        ),
123
-        'phpdocumentor/reflection-docblock' => array(
124
-            'pretty_version' => '5.3.0',
125
-            'version' => '5.3.0.0',
126
-            'type' => 'library',
127
-            'install_path' => __DIR__ . '/../phpdocumentor/reflection-docblock',
128
-            'aliases' => array(),
129
-            'reference' => '622548b623e81ca6d78b721c5e029f4ce664f170',
130
-            'dev_requirement' => true,
131
-        ),
132
-        'phpdocumentor/type-resolver' => array(
133
-            'pretty_version' => '1.6.0',
134
-            'version' => '1.6.0.0',
135
-            'type' => 'library',
136
-            'install_path' => __DIR__ . '/../phpdocumentor/type-resolver',
137
-            'aliases' => array(),
138
-            'reference' => '93ebd0014cab80c4ea9f5e297ea48672f1b87706',
139
-            'dev_requirement' => true,
140
-        ),
141
-        'phpspec/prophecy' => array(
142
-            'pretty_version' => 'v1.15.0',
143
-            'version' => '1.15.0.0',
144
-            'type' => 'library',
145
-            'install_path' => __DIR__ . '/../phpspec/prophecy',
146
-            'aliases' => array(),
147
-            'reference' => 'bbcd7380b0ebf3961ee21409db7b38bc31d69a13',
148
-            'dev_requirement' => true,
149
-        ),
150
-        'phpunit/php-code-coverage' => array(
151
-            'pretty_version' => '9.2.15',
152
-            'version' => '9.2.15.0',
153
-            'type' => 'library',
154
-            'install_path' => __DIR__ . '/../phpunit/php-code-coverage',
155
-            'aliases' => array(),
156
-            'reference' => '2e9da11878c4202f97915c1cb4bb1ca318a63f5f',
157
-            'dev_requirement' => true,
158
-        ),
159
-        'phpunit/php-file-iterator' => array(
160
-            'pretty_version' => '3.0.6',
161
-            'version' => '3.0.6.0',
162
-            'type' => 'library',
163
-            'install_path' => __DIR__ . '/../phpunit/php-file-iterator',
164
-            'aliases' => array(),
165
-            'reference' => 'cf1c2e7c203ac650e352f4cc675a7021e7d1b3cf',
166
-            'dev_requirement' => true,
167
-        ),
168
-        'phpunit/php-invoker' => array(
169
-            'pretty_version' => '3.1.1',
170
-            'version' => '3.1.1.0',
171
-            'type' => 'library',
172
-            'install_path' => __DIR__ . '/../phpunit/php-invoker',
173
-            'aliases' => array(),
174
-            'reference' => '5a10147d0aaf65b58940a0b72f71c9ac0423cc67',
175
-            'dev_requirement' => true,
176
-        ),
177
-        'phpunit/php-text-template' => array(
178
-            'pretty_version' => '2.0.4',
179
-            'version' => '2.0.4.0',
180
-            'type' => 'library',
181
-            'install_path' => __DIR__ . '/../phpunit/php-text-template',
182
-            'aliases' => array(),
183
-            'reference' => '5da5f67fc95621df9ff4c4e5a84d6a8a2acf7c28',
184
-            'dev_requirement' => true,
185
-        ),
186
-        'phpunit/php-timer' => array(
187
-            'pretty_version' => '5.0.3',
188
-            'version' => '5.0.3.0',
189
-            'type' => 'library',
190
-            'install_path' => __DIR__ . '/../phpunit/php-timer',
191
-            'aliases' => array(),
192
-            'reference' => '5a63ce20ed1b5bf577850e2c4e87f4aa902afbd2',
193
-            'dev_requirement' => true,
194
-        ),
195
-        'phpunit/phpunit' => array(
196
-            'pretty_version' => '9.5.19',
197
-            'version' => '9.5.19.0',
198
-            'type' => 'library',
199
-            'install_path' => __DIR__ . '/../phpunit/phpunit',
200
-            'aliases' => array(),
201
-            'reference' => '35ea4b7f3acabb26f4bb640f8c30866c401da807',
202
-            'dev_requirement' => true,
203
-        ),
204
-        'roave/security-advisories' => array(
205
-            'pretty_version' => 'dev-master',
206
-            'version' => 'dev-master',
207
-            'type' => 'metapackage',
208
-            'install_path' => NULL,
209
-            'aliases' => array(),
210
-            'reference' => 'a1696aadf99f7ff55d44c56e7ebf54eace85310c',
211
-            'dev_requirement' => true,
212
-        ),
213
-        'sebastian/cli-parser' => array(
214
-            'pretty_version' => '1.0.1',
215
-            'version' => '1.0.1.0',
216
-            'type' => 'library',
217
-            'install_path' => __DIR__ . '/../sebastian/cli-parser',
218
-            'aliases' => array(),
219
-            'reference' => '442e7c7e687e42adc03470c7b668bc4b2402c0b2',
220
-            'dev_requirement' => true,
221
-        ),
222
-        'sebastian/code-unit' => array(
223
-            'pretty_version' => '1.0.8',
224
-            'version' => '1.0.8.0',
225
-            'type' => 'library',
226
-            'install_path' => __DIR__ . '/../sebastian/code-unit',
227
-            'aliases' => array(),
228
-            'reference' => '1fc9f64c0927627ef78ba436c9b17d967e68e120',
229
-            'dev_requirement' => true,
230
-        ),
231
-        'sebastian/code-unit-reverse-lookup' => array(
232
-            'pretty_version' => '2.0.3',
233
-            'version' => '2.0.3.0',
234
-            'type' => 'library',
235
-            'install_path' => __DIR__ . '/../sebastian/code-unit-reverse-lookup',
236
-            'aliases' => array(),
237
-            'reference' => 'ac91f01ccec49fb77bdc6fd1e548bc70f7faa3e5',
238
-            'dev_requirement' => true,
239
-        ),
240
-        'sebastian/comparator' => array(
241
-            'pretty_version' => '4.0.6',
242
-            'version' => '4.0.6.0',
243
-            'type' => 'library',
244
-            'install_path' => __DIR__ . '/../sebastian/comparator',
245
-            'aliases' => array(),
246
-            'reference' => '55f4261989e546dc112258c7a75935a81a7ce382',
247
-            'dev_requirement' => true,
248
-        ),
249
-        'sebastian/complexity' => array(
250
-            'pretty_version' => '2.0.2',
251
-            'version' => '2.0.2.0',
252
-            'type' => 'library',
253
-            'install_path' => __DIR__ . '/../sebastian/complexity',
254
-            'aliases' => array(),
255
-            'reference' => '739b35e53379900cc9ac327b2147867b8b6efd88',
256
-            'dev_requirement' => true,
257
-        ),
258
-        'sebastian/diff' => array(
259
-            'pretty_version' => '4.0.4',
260
-            'version' => '4.0.4.0',
261
-            'type' => 'library',
262
-            'install_path' => __DIR__ . '/../sebastian/diff',
263
-            'aliases' => array(),
264
-            'reference' => '3461e3fccc7cfdfc2720be910d3bd73c69be590d',
265
-            'dev_requirement' => true,
266
-        ),
267
-        'sebastian/environment' => array(
268
-            'pretty_version' => '5.1.3',
269
-            'version' => '5.1.3.0',
270
-            'type' => 'library',
271
-            'install_path' => __DIR__ . '/../sebastian/environment',
272
-            'aliases' => array(),
273
-            'reference' => '388b6ced16caa751030f6a69e588299fa09200ac',
274
-            'dev_requirement' => true,
275
-        ),
276
-        'sebastian/exporter' => array(
277
-            'pretty_version' => '4.0.4',
278
-            'version' => '4.0.4.0',
279
-            'type' => 'library',
280
-            'install_path' => __DIR__ . '/../sebastian/exporter',
281
-            'aliases' => array(),
282
-            'reference' => '65e8b7db476c5dd267e65eea9cab77584d3cfff9',
283
-            'dev_requirement' => true,
284
-        ),
285
-        'sebastian/global-state' => array(
286
-            'pretty_version' => '5.0.5',
287
-            'version' => '5.0.5.0',
288
-            'type' => 'library',
289
-            'install_path' => __DIR__ . '/../sebastian/global-state',
290
-            'aliases' => array(),
291
-            'reference' => '0ca8db5a5fc9c8646244e629625ac486fa286bf2',
292
-            'dev_requirement' => true,
293
-        ),
294
-        'sebastian/lines-of-code' => array(
295
-            'pretty_version' => '1.0.3',
296
-            'version' => '1.0.3.0',
297
-            'type' => 'library',
298
-            'install_path' => __DIR__ . '/../sebastian/lines-of-code',
299
-            'aliases' => array(),
300
-            'reference' => 'c1c2e997aa3146983ed888ad08b15470a2e22ecc',
301
-            'dev_requirement' => true,
302
-        ),
303
-        'sebastian/object-enumerator' => array(
304
-            'pretty_version' => '4.0.4',
305
-            'version' => '4.0.4.0',
306
-            'type' => 'library',
307
-            'install_path' => __DIR__ . '/../sebastian/object-enumerator',
308
-            'aliases' => array(),
309
-            'reference' => '5c9eeac41b290a3712d88851518825ad78f45c71',
310
-            'dev_requirement' => true,
311
-        ),
312
-        'sebastian/object-reflector' => array(
313
-            'pretty_version' => '2.0.4',
314
-            'version' => '2.0.4.0',
315
-            'type' => 'library',
316
-            'install_path' => __DIR__ . '/../sebastian/object-reflector',
317
-            'aliases' => array(),
318
-            'reference' => 'b4f479ebdbf63ac605d183ece17d8d7fe49c15c7',
319
-            'dev_requirement' => true,
320
-        ),
321
-        'sebastian/recursion-context' => array(
322
-            'pretty_version' => '4.0.4',
323
-            'version' => '4.0.4.0',
324
-            'type' => 'library',
325
-            'install_path' => __DIR__ . '/../sebastian/recursion-context',
326
-            'aliases' => array(),
327
-            'reference' => 'cd9d8cf3c5804de4341c283ed787f099f5506172',
328
-            'dev_requirement' => true,
329
-        ),
330
-        'sebastian/resource-operations' => array(
331
-            'pretty_version' => '3.0.3',
332
-            'version' => '3.0.3.0',
333
-            'type' => 'library',
334
-            'install_path' => __DIR__ . '/../sebastian/resource-operations',
335
-            'aliases' => array(),
336
-            'reference' => '0f4443cb3a1d92ce809899753bc0d5d5a8dd19a8',
337
-            'dev_requirement' => true,
338
-        ),
339
-        'sebastian/type' => array(
340
-            'pretty_version' => '3.0.0',
341
-            'version' => '3.0.0.0',
342
-            'type' => 'library',
343
-            'install_path' => __DIR__ . '/../sebastian/type',
344
-            'aliases' => array(),
345
-            'reference' => 'b233b84bc4465aff7b57cf1c4bc75c86d00d6dad',
346
-            'dev_requirement' => true,
347
-        ),
348
-        'sebastian/version' => array(
349
-            'pretty_version' => '3.0.2',
350
-            'version' => '3.0.2.0',
351
-            'type' => 'library',
352
-            'install_path' => __DIR__ . '/../sebastian/version',
353
-            'aliases' => array(),
354
-            'reference' => 'c6c1022351a901512170118436c764e473f6de8c',
355
-            'dev_requirement' => true,
356
-        ),
357
-        'squizlabs/php_codesniffer' => array(
358
-            'pretty_version' => '3.6.2',
359
-            'version' => '3.6.2.0',
360
-            'type' => 'library',
361
-            'install_path' => __DIR__ . '/../squizlabs/php_codesniffer',
362
-            'aliases' => array(),
363
-            'reference' => '5e4e71592f69da17871dba6e80dd51bce74a351a',
364
-            'dev_requirement' => true,
365
-        ),
366
-        'symfony/polyfill-ctype' => array(
367
-            'pretty_version' => 'v1.25.0',
368
-            'version' => '1.25.0.0',
369
-            'type' => 'library',
370
-            'install_path' => __DIR__ . '/../symfony/polyfill-ctype',
371
-            'aliases' => array(),
372
-            'reference' => '30885182c981ab175d4d034db0f6f469898070ab',
373
-            'dev_requirement' => true,
374
-        ),
375
-        'theseer/tokenizer' => array(
376
-            'pretty_version' => '1.2.1',
377
-            'version' => '1.2.1.0',
378
-            'type' => 'library',
379
-            'install_path' => __DIR__ . '/../theseer/tokenizer',
380
-            'aliases' => array(),
381
-            'reference' => '34a41e998c2183e22995f158c581e7b5e755ab9e',
382
-            'dev_requirement' => true,
383
-        ),
384
-        'webmozart/assert' => array(
385
-            'pretty_version' => '1.10.0',
386
-            'version' => '1.10.0.0',
387
-            'type' => 'library',
388
-            'install_path' => __DIR__ . '/../webmozart/assert',
389
-            'aliases' => array(),
390
-            'reference' => '6964c76c7804814a842473e0c8fd15bab0f18e25',
391
-            'dev_requirement' => true,
392
-        ),
393
-        'wp-coding-standards/wpcs' => array(
394
-            'pretty_version' => '2.3.0',
395
-            'version' => '2.3.0.0',
396
-            'type' => 'phpcodesniffer-standard',
397
-            'install_path' => __DIR__ . '/../wp-coding-standards/wpcs',
398
-            'aliases' => array(),
399
-            'reference' => '7da1894633f168fe244afc6de00d141f27517b62',
400
-            'dev_requirement' => true,
401
-        ),
402
-        'yoast/phpunit-polyfills' => array(
403
-            'pretty_version' => '1.0.3',
404
-            'version' => '1.0.3.0',
405
-            'type' => 'library',
406
-            'install_path' => __DIR__ . '/../yoast/phpunit-polyfills',
407
-            'aliases' => array(),
408
-            'reference' => '5ea3536428944955f969bc764bbe09738e151ada',
409
-            'dev_requirement' => true,
410
-        ),
411
-    ),
2
+	'root' => array(
3
+		'pretty_version' => 'dev-master',
4
+		'version' => 'dev-master',
5
+		'type' => 'wordpress-plugin',
6
+		'install_path' => __DIR__ . '/../../',
7
+		'aliases' => array(),
8
+		'reference' => '473c8e78d795988fc9a79bf76e917ad26b76aa24',
9
+		'name' => 'eventespresso/event-espresso-core',
10
+		'dev' => true,
11
+	),
12
+	'versions' => array(
13
+		'composer/installers' => array(
14
+			'pretty_version' => 'v2.1.0',
15
+			'version' => '2.1.0.0',
16
+			'type' => 'composer-plugin',
17
+			'install_path' => __DIR__ . '/./installers',
18
+			'aliases' => array(),
19
+			'reference' => '75e5ef05436c90ac565a48176cc7465991908352',
20
+			'dev_requirement' => false,
21
+		),
22
+		'doctrine/instantiator' => array(
23
+			'pretty_version' => '1.4.1',
24
+			'version' => '1.4.1.0',
25
+			'type' => 'library',
26
+			'install_path' => __DIR__ . '/../doctrine/instantiator',
27
+			'aliases' => array(),
28
+			'reference' => '10dcfce151b967d20fde1b34ae6640712c3891bc',
29
+			'dev_requirement' => true,
30
+		),
31
+		'eventespresso/ee-coding-standards' => array(
32
+			'pretty_version' => 'dev-master',
33
+			'version' => 'dev-master',
34
+			'type' => 'phpcodesniffer-standard',
35
+			'install_path' => __DIR__ . '/../eventespresso/ee-coding-standards',
36
+			'aliases' => array(
37
+				0 => '9999999-dev',
38
+			),
39
+			'reference' => '4bbdbb4ed08aeb7ac719b19d8adbd0974c8b63ae',
40
+			'dev_requirement' => true,
41
+		),
42
+		'eventespresso/event-espresso-core' => array(
43
+			'pretty_version' => 'dev-master',
44
+			'version' => 'dev-master',
45
+			'type' => 'wordpress-plugin',
46
+			'install_path' => __DIR__ . '/../../',
47
+			'aliases' => array(),
48
+			'reference' => '473c8e78d795988fc9a79bf76e917ad26b76aa24',
49
+			'dev_requirement' => false,
50
+		),
51
+		'myclabs/deep-copy' => array(
52
+			'pretty_version' => '1.11.0',
53
+			'version' => '1.11.0.0',
54
+			'type' => 'library',
55
+			'install_path' => __DIR__ . '/../myclabs/deep-copy',
56
+			'aliases' => array(),
57
+			'reference' => '14daed4296fae74d9e3201d2c4925d1acb7aa614',
58
+			'dev_requirement' => true,
59
+		),
60
+		'nikic/php-parser' => array(
61
+			'pretty_version' => 'v4.13.2',
62
+			'version' => '4.13.2.0',
63
+			'type' => 'library',
64
+			'install_path' => __DIR__ . '/../nikic/php-parser',
65
+			'aliases' => array(),
66
+			'reference' => '210577fe3cf7badcc5814d99455df46564f3c077',
67
+			'dev_requirement' => true,
68
+		),
69
+		'phar-io/manifest' => array(
70
+			'pretty_version' => '2.0.3',
71
+			'version' => '2.0.3.0',
72
+			'type' => 'library',
73
+			'install_path' => __DIR__ . '/../phar-io/manifest',
74
+			'aliases' => array(),
75
+			'reference' => '97803eca37d319dfa7826cc2437fc020857acb53',
76
+			'dev_requirement' => true,
77
+		),
78
+		'phar-io/version' => array(
79
+			'pretty_version' => '3.2.1',
80
+			'version' => '3.2.1.0',
81
+			'type' => 'library',
82
+			'install_path' => __DIR__ . '/../phar-io/version',
83
+			'aliases' => array(),
84
+			'reference' => '4f7fd7836c6f332bb2933569e566a0d6c4cbed74',
85
+			'dev_requirement' => true,
86
+		),
87
+		'phpcompatibility/php-compatibility' => array(
88
+			'pretty_version' => '9.3.5',
89
+			'version' => '9.3.5.0',
90
+			'type' => 'phpcodesniffer-standard',
91
+			'install_path' => __DIR__ . '/../phpcompatibility/php-compatibility',
92
+			'aliases' => array(),
93
+			'reference' => '9fb324479acf6f39452e0655d2429cc0d3914243',
94
+			'dev_requirement' => true,
95
+		),
96
+		'phpcompatibility/phpcompatibility-paragonie' => array(
97
+			'pretty_version' => '1.3.1',
98
+			'version' => '1.3.1.0',
99
+			'type' => 'phpcodesniffer-standard',
100
+			'install_path' => __DIR__ . '/../phpcompatibility/phpcompatibility-paragonie',
101
+			'aliases' => array(),
102
+			'reference' => 'ddabec839cc003651f2ce695c938686d1086cf43',
103
+			'dev_requirement' => true,
104
+		),
105
+		'phpcompatibility/phpcompatibility-wp' => array(
106
+			'pretty_version' => '2.1.3',
107
+			'version' => '2.1.3.0',
108
+			'type' => 'phpcodesniffer-standard',
109
+			'install_path' => __DIR__ . '/../phpcompatibility/phpcompatibility-wp',
110
+			'aliases' => array(),
111
+			'reference' => 'd55de55f88697b9cdb94bccf04f14eb3b11cf308',
112
+			'dev_requirement' => true,
113
+		),
114
+		'phpdocumentor/reflection-common' => array(
115
+			'pretty_version' => '2.2.0',
116
+			'version' => '2.2.0.0',
117
+			'type' => 'library',
118
+			'install_path' => __DIR__ . '/../phpdocumentor/reflection-common',
119
+			'aliases' => array(),
120
+			'reference' => '1d01c49d4ed62f25aa84a747ad35d5a16924662b',
121
+			'dev_requirement' => true,
122
+		),
123
+		'phpdocumentor/reflection-docblock' => array(
124
+			'pretty_version' => '5.3.0',
125
+			'version' => '5.3.0.0',
126
+			'type' => 'library',
127
+			'install_path' => __DIR__ . '/../phpdocumentor/reflection-docblock',
128
+			'aliases' => array(),
129
+			'reference' => '622548b623e81ca6d78b721c5e029f4ce664f170',
130
+			'dev_requirement' => true,
131
+		),
132
+		'phpdocumentor/type-resolver' => array(
133
+			'pretty_version' => '1.6.0',
134
+			'version' => '1.6.0.0',
135
+			'type' => 'library',
136
+			'install_path' => __DIR__ . '/../phpdocumentor/type-resolver',
137
+			'aliases' => array(),
138
+			'reference' => '93ebd0014cab80c4ea9f5e297ea48672f1b87706',
139
+			'dev_requirement' => true,
140
+		),
141
+		'phpspec/prophecy' => array(
142
+			'pretty_version' => 'v1.15.0',
143
+			'version' => '1.15.0.0',
144
+			'type' => 'library',
145
+			'install_path' => __DIR__ . '/../phpspec/prophecy',
146
+			'aliases' => array(),
147
+			'reference' => 'bbcd7380b0ebf3961ee21409db7b38bc31d69a13',
148
+			'dev_requirement' => true,
149
+		),
150
+		'phpunit/php-code-coverage' => array(
151
+			'pretty_version' => '9.2.15',
152
+			'version' => '9.2.15.0',
153
+			'type' => 'library',
154
+			'install_path' => __DIR__ . '/../phpunit/php-code-coverage',
155
+			'aliases' => array(),
156
+			'reference' => '2e9da11878c4202f97915c1cb4bb1ca318a63f5f',
157
+			'dev_requirement' => true,
158
+		),
159
+		'phpunit/php-file-iterator' => array(
160
+			'pretty_version' => '3.0.6',
161
+			'version' => '3.0.6.0',
162
+			'type' => 'library',
163
+			'install_path' => __DIR__ . '/../phpunit/php-file-iterator',
164
+			'aliases' => array(),
165
+			'reference' => 'cf1c2e7c203ac650e352f4cc675a7021e7d1b3cf',
166
+			'dev_requirement' => true,
167
+		),
168
+		'phpunit/php-invoker' => array(
169
+			'pretty_version' => '3.1.1',
170
+			'version' => '3.1.1.0',
171
+			'type' => 'library',
172
+			'install_path' => __DIR__ . '/../phpunit/php-invoker',
173
+			'aliases' => array(),
174
+			'reference' => '5a10147d0aaf65b58940a0b72f71c9ac0423cc67',
175
+			'dev_requirement' => true,
176
+		),
177
+		'phpunit/php-text-template' => array(
178
+			'pretty_version' => '2.0.4',
179
+			'version' => '2.0.4.0',
180
+			'type' => 'library',
181
+			'install_path' => __DIR__ . '/../phpunit/php-text-template',
182
+			'aliases' => array(),
183
+			'reference' => '5da5f67fc95621df9ff4c4e5a84d6a8a2acf7c28',
184
+			'dev_requirement' => true,
185
+		),
186
+		'phpunit/php-timer' => array(
187
+			'pretty_version' => '5.0.3',
188
+			'version' => '5.0.3.0',
189
+			'type' => 'library',
190
+			'install_path' => __DIR__ . '/../phpunit/php-timer',
191
+			'aliases' => array(),
192
+			'reference' => '5a63ce20ed1b5bf577850e2c4e87f4aa902afbd2',
193
+			'dev_requirement' => true,
194
+		),
195
+		'phpunit/phpunit' => array(
196
+			'pretty_version' => '9.5.19',
197
+			'version' => '9.5.19.0',
198
+			'type' => 'library',
199
+			'install_path' => __DIR__ . '/../phpunit/phpunit',
200
+			'aliases' => array(),
201
+			'reference' => '35ea4b7f3acabb26f4bb640f8c30866c401da807',
202
+			'dev_requirement' => true,
203
+		),
204
+		'roave/security-advisories' => array(
205
+			'pretty_version' => 'dev-master',
206
+			'version' => 'dev-master',
207
+			'type' => 'metapackage',
208
+			'install_path' => NULL,
209
+			'aliases' => array(),
210
+			'reference' => 'a1696aadf99f7ff55d44c56e7ebf54eace85310c',
211
+			'dev_requirement' => true,
212
+		),
213
+		'sebastian/cli-parser' => array(
214
+			'pretty_version' => '1.0.1',
215
+			'version' => '1.0.1.0',
216
+			'type' => 'library',
217
+			'install_path' => __DIR__ . '/../sebastian/cli-parser',
218
+			'aliases' => array(),
219
+			'reference' => '442e7c7e687e42adc03470c7b668bc4b2402c0b2',
220
+			'dev_requirement' => true,
221
+		),
222
+		'sebastian/code-unit' => array(
223
+			'pretty_version' => '1.0.8',
224
+			'version' => '1.0.8.0',
225
+			'type' => 'library',
226
+			'install_path' => __DIR__ . '/../sebastian/code-unit',
227
+			'aliases' => array(),
228
+			'reference' => '1fc9f64c0927627ef78ba436c9b17d967e68e120',
229
+			'dev_requirement' => true,
230
+		),
231
+		'sebastian/code-unit-reverse-lookup' => array(
232
+			'pretty_version' => '2.0.3',
233
+			'version' => '2.0.3.0',
234
+			'type' => 'library',
235
+			'install_path' => __DIR__ . '/../sebastian/code-unit-reverse-lookup',
236
+			'aliases' => array(),
237
+			'reference' => 'ac91f01ccec49fb77bdc6fd1e548bc70f7faa3e5',
238
+			'dev_requirement' => true,
239
+		),
240
+		'sebastian/comparator' => array(
241
+			'pretty_version' => '4.0.6',
242
+			'version' => '4.0.6.0',
243
+			'type' => 'library',
244
+			'install_path' => __DIR__ . '/../sebastian/comparator',
245
+			'aliases' => array(),
246
+			'reference' => '55f4261989e546dc112258c7a75935a81a7ce382',
247
+			'dev_requirement' => true,
248
+		),
249
+		'sebastian/complexity' => array(
250
+			'pretty_version' => '2.0.2',
251
+			'version' => '2.0.2.0',
252
+			'type' => 'library',
253
+			'install_path' => __DIR__ . '/../sebastian/complexity',
254
+			'aliases' => array(),
255
+			'reference' => '739b35e53379900cc9ac327b2147867b8b6efd88',
256
+			'dev_requirement' => true,
257
+		),
258
+		'sebastian/diff' => array(
259
+			'pretty_version' => '4.0.4',
260
+			'version' => '4.0.4.0',
261
+			'type' => 'library',
262
+			'install_path' => __DIR__ . '/../sebastian/diff',
263
+			'aliases' => array(),
264
+			'reference' => '3461e3fccc7cfdfc2720be910d3bd73c69be590d',
265
+			'dev_requirement' => true,
266
+		),
267
+		'sebastian/environment' => array(
268
+			'pretty_version' => '5.1.3',
269
+			'version' => '5.1.3.0',
270
+			'type' => 'library',
271
+			'install_path' => __DIR__ . '/../sebastian/environment',
272
+			'aliases' => array(),
273
+			'reference' => '388b6ced16caa751030f6a69e588299fa09200ac',
274
+			'dev_requirement' => true,
275
+		),
276
+		'sebastian/exporter' => array(
277
+			'pretty_version' => '4.0.4',
278
+			'version' => '4.0.4.0',
279
+			'type' => 'library',
280
+			'install_path' => __DIR__ . '/../sebastian/exporter',
281
+			'aliases' => array(),
282
+			'reference' => '65e8b7db476c5dd267e65eea9cab77584d3cfff9',
283
+			'dev_requirement' => true,
284
+		),
285
+		'sebastian/global-state' => array(
286
+			'pretty_version' => '5.0.5',
287
+			'version' => '5.0.5.0',
288
+			'type' => 'library',
289
+			'install_path' => __DIR__ . '/../sebastian/global-state',
290
+			'aliases' => array(),
291
+			'reference' => '0ca8db5a5fc9c8646244e629625ac486fa286bf2',
292
+			'dev_requirement' => true,
293
+		),
294
+		'sebastian/lines-of-code' => array(
295
+			'pretty_version' => '1.0.3',
296
+			'version' => '1.0.3.0',
297
+			'type' => 'library',
298
+			'install_path' => __DIR__ . '/../sebastian/lines-of-code',
299
+			'aliases' => array(),
300
+			'reference' => 'c1c2e997aa3146983ed888ad08b15470a2e22ecc',
301
+			'dev_requirement' => true,
302
+		),
303
+		'sebastian/object-enumerator' => array(
304
+			'pretty_version' => '4.0.4',
305
+			'version' => '4.0.4.0',
306
+			'type' => 'library',
307
+			'install_path' => __DIR__ . '/../sebastian/object-enumerator',
308
+			'aliases' => array(),
309
+			'reference' => '5c9eeac41b290a3712d88851518825ad78f45c71',
310
+			'dev_requirement' => true,
311
+		),
312
+		'sebastian/object-reflector' => array(
313
+			'pretty_version' => '2.0.4',
314
+			'version' => '2.0.4.0',
315
+			'type' => 'library',
316
+			'install_path' => __DIR__ . '/../sebastian/object-reflector',
317
+			'aliases' => array(),
318
+			'reference' => 'b4f479ebdbf63ac605d183ece17d8d7fe49c15c7',
319
+			'dev_requirement' => true,
320
+		),
321
+		'sebastian/recursion-context' => array(
322
+			'pretty_version' => '4.0.4',
323
+			'version' => '4.0.4.0',
324
+			'type' => 'library',
325
+			'install_path' => __DIR__ . '/../sebastian/recursion-context',
326
+			'aliases' => array(),
327
+			'reference' => 'cd9d8cf3c5804de4341c283ed787f099f5506172',
328
+			'dev_requirement' => true,
329
+		),
330
+		'sebastian/resource-operations' => array(
331
+			'pretty_version' => '3.0.3',
332
+			'version' => '3.0.3.0',
333
+			'type' => 'library',
334
+			'install_path' => __DIR__ . '/../sebastian/resource-operations',
335
+			'aliases' => array(),
336
+			'reference' => '0f4443cb3a1d92ce809899753bc0d5d5a8dd19a8',
337
+			'dev_requirement' => true,
338
+		),
339
+		'sebastian/type' => array(
340
+			'pretty_version' => '3.0.0',
341
+			'version' => '3.0.0.0',
342
+			'type' => 'library',
343
+			'install_path' => __DIR__ . '/../sebastian/type',
344
+			'aliases' => array(),
345
+			'reference' => 'b233b84bc4465aff7b57cf1c4bc75c86d00d6dad',
346
+			'dev_requirement' => true,
347
+		),
348
+		'sebastian/version' => array(
349
+			'pretty_version' => '3.0.2',
350
+			'version' => '3.0.2.0',
351
+			'type' => 'library',
352
+			'install_path' => __DIR__ . '/../sebastian/version',
353
+			'aliases' => array(),
354
+			'reference' => 'c6c1022351a901512170118436c764e473f6de8c',
355
+			'dev_requirement' => true,
356
+		),
357
+		'squizlabs/php_codesniffer' => array(
358
+			'pretty_version' => '3.6.2',
359
+			'version' => '3.6.2.0',
360
+			'type' => 'library',
361
+			'install_path' => __DIR__ . '/../squizlabs/php_codesniffer',
362
+			'aliases' => array(),
363
+			'reference' => '5e4e71592f69da17871dba6e80dd51bce74a351a',
364
+			'dev_requirement' => true,
365
+		),
366
+		'symfony/polyfill-ctype' => array(
367
+			'pretty_version' => 'v1.25.0',
368
+			'version' => '1.25.0.0',
369
+			'type' => 'library',
370
+			'install_path' => __DIR__ . '/../symfony/polyfill-ctype',
371
+			'aliases' => array(),
372
+			'reference' => '30885182c981ab175d4d034db0f6f469898070ab',
373
+			'dev_requirement' => true,
374
+		),
375
+		'theseer/tokenizer' => array(
376
+			'pretty_version' => '1.2.1',
377
+			'version' => '1.2.1.0',
378
+			'type' => 'library',
379
+			'install_path' => __DIR__ . '/../theseer/tokenizer',
380
+			'aliases' => array(),
381
+			'reference' => '34a41e998c2183e22995f158c581e7b5e755ab9e',
382
+			'dev_requirement' => true,
383
+		),
384
+		'webmozart/assert' => array(
385
+			'pretty_version' => '1.10.0',
386
+			'version' => '1.10.0.0',
387
+			'type' => 'library',
388
+			'install_path' => __DIR__ . '/../webmozart/assert',
389
+			'aliases' => array(),
390
+			'reference' => '6964c76c7804814a842473e0c8fd15bab0f18e25',
391
+			'dev_requirement' => true,
392
+		),
393
+		'wp-coding-standards/wpcs' => array(
394
+			'pretty_version' => '2.3.0',
395
+			'version' => '2.3.0.0',
396
+			'type' => 'phpcodesniffer-standard',
397
+			'install_path' => __DIR__ . '/../wp-coding-standards/wpcs',
398
+			'aliases' => array(),
399
+			'reference' => '7da1894633f168fe244afc6de00d141f27517b62',
400
+			'dev_requirement' => true,
401
+		),
402
+		'yoast/phpunit-polyfills' => array(
403
+			'pretty_version' => '1.0.3',
404
+			'version' => '1.0.3.0',
405
+			'type' => 'library',
406
+			'install_path' => __DIR__ . '/../yoast/phpunit-polyfills',
407
+			'aliases' => array(),
408
+			'reference' => '5ea3536428944955f969bc764bbe09738e151ada',
409
+			'dev_requirement' => true,
410
+		),
411
+	),
412 412
 );
Please login to merge, or discard this patch.
Spacing   +44 added lines, -44 removed lines patch added patch discarded remove patch
@@ -3,7 +3,7 @@  discard block
 block discarded – undo
3 3
         'pretty_version' => 'dev-master',
4 4
         'version' => 'dev-master',
5 5
         'type' => 'wordpress-plugin',
6
-        'install_path' => __DIR__ . '/../../',
6
+        'install_path' => __DIR__.'/../../',
7 7
         'aliases' => array(),
8 8
         'reference' => '473c8e78d795988fc9a79bf76e917ad26b76aa24',
9 9
         'name' => 'eventespresso/event-espresso-core',
@@ -14,7 +14,7 @@  discard block
 block discarded – undo
14 14
             'pretty_version' => 'v2.1.0',
15 15
             'version' => '2.1.0.0',
16 16
             'type' => 'composer-plugin',
17
-            'install_path' => __DIR__ . '/./installers',
17
+            'install_path' => __DIR__.'/./installers',
18 18
             'aliases' => array(),
19 19
             'reference' => '75e5ef05436c90ac565a48176cc7465991908352',
20 20
             'dev_requirement' => false,
@@ -23,7 +23,7 @@  discard block
 block discarded – undo
23 23
             'pretty_version' => '1.4.1',
24 24
             'version' => '1.4.1.0',
25 25
             'type' => 'library',
26
-            'install_path' => __DIR__ . '/../doctrine/instantiator',
26
+            'install_path' => __DIR__.'/../doctrine/instantiator',
27 27
             'aliases' => array(),
28 28
             'reference' => '10dcfce151b967d20fde1b34ae6640712c3891bc',
29 29
             'dev_requirement' => true,
@@ -32,7 +32,7 @@  discard block
 block discarded – undo
32 32
             'pretty_version' => 'dev-master',
33 33
             'version' => 'dev-master',
34 34
             'type' => 'phpcodesniffer-standard',
35
-            'install_path' => __DIR__ . '/../eventespresso/ee-coding-standards',
35
+            'install_path' => __DIR__.'/../eventespresso/ee-coding-standards',
36 36
             'aliases' => array(
37 37
                 0 => '9999999-dev',
38 38
             ),
@@ -43,7 +43,7 @@  discard block
 block discarded – undo
43 43
             'pretty_version' => 'dev-master',
44 44
             'version' => 'dev-master',
45 45
             'type' => 'wordpress-plugin',
46
-            'install_path' => __DIR__ . '/../../',
46
+            'install_path' => __DIR__.'/../../',
47 47
             'aliases' => array(),
48 48
             'reference' => '473c8e78d795988fc9a79bf76e917ad26b76aa24',
49 49
             'dev_requirement' => false,
@@ -52,7 +52,7 @@  discard block
 block discarded – undo
52 52
             'pretty_version' => '1.11.0',
53 53
             'version' => '1.11.0.0',
54 54
             'type' => 'library',
55
-            'install_path' => __DIR__ . '/../myclabs/deep-copy',
55
+            'install_path' => __DIR__.'/../myclabs/deep-copy',
56 56
             'aliases' => array(),
57 57
             'reference' => '14daed4296fae74d9e3201d2c4925d1acb7aa614',
58 58
             'dev_requirement' => true,
@@ -61,7 +61,7 @@  discard block
 block discarded – undo
61 61
             'pretty_version' => 'v4.13.2',
62 62
             'version' => '4.13.2.0',
63 63
             'type' => 'library',
64
-            'install_path' => __DIR__ . '/../nikic/php-parser',
64
+            'install_path' => __DIR__.'/../nikic/php-parser',
65 65
             'aliases' => array(),
66 66
             'reference' => '210577fe3cf7badcc5814d99455df46564f3c077',
67 67
             'dev_requirement' => true,
@@ -70,7 +70,7 @@  discard block
 block discarded – undo
70 70
             'pretty_version' => '2.0.3',
71 71
             'version' => '2.0.3.0',
72 72
             'type' => 'library',
73
-            'install_path' => __DIR__ . '/../phar-io/manifest',
73
+            'install_path' => __DIR__.'/../phar-io/manifest',
74 74
             'aliases' => array(),
75 75
             'reference' => '97803eca37d319dfa7826cc2437fc020857acb53',
76 76
             'dev_requirement' => true,
@@ -79,7 +79,7 @@  discard block
 block discarded – undo
79 79
             'pretty_version' => '3.2.1',
80 80
             'version' => '3.2.1.0',
81 81
             'type' => 'library',
82
-            'install_path' => __DIR__ . '/../phar-io/version',
82
+            'install_path' => __DIR__.'/../phar-io/version',
83 83
             'aliases' => array(),
84 84
             'reference' => '4f7fd7836c6f332bb2933569e566a0d6c4cbed74',
85 85
             'dev_requirement' => true,
@@ -88,7 +88,7 @@  discard block
 block discarded – undo
88 88
             'pretty_version' => '9.3.5',
89 89
             'version' => '9.3.5.0',
90 90
             'type' => 'phpcodesniffer-standard',
91
-            'install_path' => __DIR__ . '/../phpcompatibility/php-compatibility',
91
+            'install_path' => __DIR__.'/../phpcompatibility/php-compatibility',
92 92
             'aliases' => array(),
93 93
             'reference' => '9fb324479acf6f39452e0655d2429cc0d3914243',
94 94
             'dev_requirement' => true,
@@ -97,7 +97,7 @@  discard block
 block discarded – undo
97 97
             'pretty_version' => '1.3.1',
98 98
             'version' => '1.3.1.0',
99 99
             'type' => 'phpcodesniffer-standard',
100
-            'install_path' => __DIR__ . '/../phpcompatibility/phpcompatibility-paragonie',
100
+            'install_path' => __DIR__.'/../phpcompatibility/phpcompatibility-paragonie',
101 101
             'aliases' => array(),
102 102
             'reference' => 'ddabec839cc003651f2ce695c938686d1086cf43',
103 103
             'dev_requirement' => true,
@@ -106,7 +106,7 @@  discard block
 block discarded – undo
106 106
             'pretty_version' => '2.1.3',
107 107
             'version' => '2.1.3.0',
108 108
             'type' => 'phpcodesniffer-standard',
109
-            'install_path' => __DIR__ . '/../phpcompatibility/phpcompatibility-wp',
109
+            'install_path' => __DIR__.'/../phpcompatibility/phpcompatibility-wp',
110 110
             'aliases' => array(),
111 111
             'reference' => 'd55de55f88697b9cdb94bccf04f14eb3b11cf308',
112 112
             'dev_requirement' => true,
@@ -115,7 +115,7 @@  discard block
 block discarded – undo
115 115
             'pretty_version' => '2.2.0',
116 116
             'version' => '2.2.0.0',
117 117
             'type' => 'library',
118
-            'install_path' => __DIR__ . '/../phpdocumentor/reflection-common',
118
+            'install_path' => __DIR__.'/../phpdocumentor/reflection-common',
119 119
             'aliases' => array(),
120 120
             'reference' => '1d01c49d4ed62f25aa84a747ad35d5a16924662b',
121 121
             'dev_requirement' => true,
@@ -124,7 +124,7 @@  discard block
 block discarded – undo
124 124
             'pretty_version' => '5.3.0',
125 125
             'version' => '5.3.0.0',
126 126
             'type' => 'library',
127
-            'install_path' => __DIR__ . '/../phpdocumentor/reflection-docblock',
127
+            'install_path' => __DIR__.'/../phpdocumentor/reflection-docblock',
128 128
             'aliases' => array(),
129 129
             'reference' => '622548b623e81ca6d78b721c5e029f4ce664f170',
130 130
             'dev_requirement' => true,
@@ -133,7 +133,7 @@  discard block
 block discarded – undo
133 133
             'pretty_version' => '1.6.0',
134 134
             'version' => '1.6.0.0',
135 135
             'type' => 'library',
136
-            'install_path' => __DIR__ . '/../phpdocumentor/type-resolver',
136
+            'install_path' => __DIR__.'/../phpdocumentor/type-resolver',
137 137
             'aliases' => array(),
138 138
             'reference' => '93ebd0014cab80c4ea9f5e297ea48672f1b87706',
139 139
             'dev_requirement' => true,
@@ -142,7 +142,7 @@  discard block
 block discarded – undo
142 142
             'pretty_version' => 'v1.15.0',
143 143
             'version' => '1.15.0.0',
144 144
             'type' => 'library',
145
-            'install_path' => __DIR__ . '/../phpspec/prophecy',
145
+            'install_path' => __DIR__.'/../phpspec/prophecy',
146 146
             'aliases' => array(),
147 147
             'reference' => 'bbcd7380b0ebf3961ee21409db7b38bc31d69a13',
148 148
             'dev_requirement' => true,
@@ -151,7 +151,7 @@  discard block
 block discarded – undo
151 151
             'pretty_version' => '9.2.15',
152 152
             'version' => '9.2.15.0',
153 153
             'type' => 'library',
154
-            'install_path' => __DIR__ . '/../phpunit/php-code-coverage',
154
+            'install_path' => __DIR__.'/../phpunit/php-code-coverage',
155 155
             'aliases' => array(),
156 156
             'reference' => '2e9da11878c4202f97915c1cb4bb1ca318a63f5f',
157 157
             'dev_requirement' => true,
@@ -160,7 +160,7 @@  discard block
 block discarded – undo
160 160
             'pretty_version' => '3.0.6',
161 161
             'version' => '3.0.6.0',
162 162
             'type' => 'library',
163
-            'install_path' => __DIR__ . '/../phpunit/php-file-iterator',
163
+            'install_path' => __DIR__.'/../phpunit/php-file-iterator',
164 164
             'aliases' => array(),
165 165
             'reference' => 'cf1c2e7c203ac650e352f4cc675a7021e7d1b3cf',
166 166
             'dev_requirement' => true,
@@ -169,7 +169,7 @@  discard block
 block discarded – undo
169 169
             'pretty_version' => '3.1.1',
170 170
             'version' => '3.1.1.0',
171 171
             'type' => 'library',
172
-            'install_path' => __DIR__ . '/../phpunit/php-invoker',
172
+            'install_path' => __DIR__.'/../phpunit/php-invoker',
173 173
             'aliases' => array(),
174 174
             'reference' => '5a10147d0aaf65b58940a0b72f71c9ac0423cc67',
175 175
             'dev_requirement' => true,
@@ -178,7 +178,7 @@  discard block
 block discarded – undo
178 178
             'pretty_version' => '2.0.4',
179 179
             'version' => '2.0.4.0',
180 180
             'type' => 'library',
181
-            'install_path' => __DIR__ . '/../phpunit/php-text-template',
181
+            'install_path' => __DIR__.'/../phpunit/php-text-template',
182 182
             'aliases' => array(),
183 183
             'reference' => '5da5f67fc95621df9ff4c4e5a84d6a8a2acf7c28',
184 184
             'dev_requirement' => true,
@@ -187,7 +187,7 @@  discard block
 block discarded – undo
187 187
             'pretty_version' => '5.0.3',
188 188
             'version' => '5.0.3.0',
189 189
             'type' => 'library',
190
-            'install_path' => __DIR__ . '/../phpunit/php-timer',
190
+            'install_path' => __DIR__.'/../phpunit/php-timer',
191 191
             'aliases' => array(),
192 192
             'reference' => '5a63ce20ed1b5bf577850e2c4e87f4aa902afbd2',
193 193
             'dev_requirement' => true,
@@ -196,7 +196,7 @@  discard block
 block discarded – undo
196 196
             'pretty_version' => '9.5.19',
197 197
             'version' => '9.5.19.0',
198 198
             'type' => 'library',
199
-            'install_path' => __DIR__ . '/../phpunit/phpunit',
199
+            'install_path' => __DIR__.'/../phpunit/phpunit',
200 200
             'aliases' => array(),
201 201
             'reference' => '35ea4b7f3acabb26f4bb640f8c30866c401da807',
202 202
             'dev_requirement' => true,
@@ -214,7 +214,7 @@  discard block
 block discarded – undo
214 214
             'pretty_version' => '1.0.1',
215 215
             'version' => '1.0.1.0',
216 216
             'type' => 'library',
217
-            'install_path' => __DIR__ . '/../sebastian/cli-parser',
217
+            'install_path' => __DIR__.'/../sebastian/cli-parser',
218 218
             'aliases' => array(),
219 219
             'reference' => '442e7c7e687e42adc03470c7b668bc4b2402c0b2',
220 220
             'dev_requirement' => true,
@@ -223,7 +223,7 @@  discard block
 block discarded – undo
223 223
             'pretty_version' => '1.0.8',
224 224
             'version' => '1.0.8.0',
225 225
             'type' => 'library',
226
-            'install_path' => __DIR__ . '/../sebastian/code-unit',
226
+            'install_path' => __DIR__.'/../sebastian/code-unit',
227 227
             'aliases' => array(),
228 228
             'reference' => '1fc9f64c0927627ef78ba436c9b17d967e68e120',
229 229
             'dev_requirement' => true,
@@ -232,7 +232,7 @@  discard block
 block discarded – undo
232 232
             'pretty_version' => '2.0.3',
233 233
             'version' => '2.0.3.0',
234 234
             'type' => 'library',
235
-            'install_path' => __DIR__ . '/../sebastian/code-unit-reverse-lookup',
235
+            'install_path' => __DIR__.'/../sebastian/code-unit-reverse-lookup',
236 236
             'aliases' => array(),
237 237
             'reference' => 'ac91f01ccec49fb77bdc6fd1e548bc70f7faa3e5',
238 238
             'dev_requirement' => true,
@@ -241,7 +241,7 @@  discard block
 block discarded – undo
241 241
             'pretty_version' => '4.0.6',
242 242
             'version' => '4.0.6.0',
243 243
             'type' => 'library',
244
-            'install_path' => __DIR__ . '/../sebastian/comparator',
244
+            'install_path' => __DIR__.'/../sebastian/comparator',
245 245
             'aliases' => array(),
246 246
             'reference' => '55f4261989e546dc112258c7a75935a81a7ce382',
247 247
             'dev_requirement' => true,
@@ -250,7 +250,7 @@  discard block
 block discarded – undo
250 250
             'pretty_version' => '2.0.2',
251 251
             'version' => '2.0.2.0',
252 252
             'type' => 'library',
253
-            'install_path' => __DIR__ . '/../sebastian/complexity',
253
+            'install_path' => __DIR__.'/../sebastian/complexity',
254 254
             'aliases' => array(),
255 255
             'reference' => '739b35e53379900cc9ac327b2147867b8b6efd88',
256 256
             'dev_requirement' => true,
@@ -259,7 +259,7 @@  discard block
 block discarded – undo
259 259
             'pretty_version' => '4.0.4',
260 260
             'version' => '4.0.4.0',
261 261
             'type' => 'library',
262
-            'install_path' => __DIR__ . '/../sebastian/diff',
262
+            'install_path' => __DIR__.'/../sebastian/diff',
263 263
             'aliases' => array(),
264 264
             'reference' => '3461e3fccc7cfdfc2720be910d3bd73c69be590d',
265 265
             'dev_requirement' => true,
@@ -268,7 +268,7 @@  discard block
 block discarded – undo
268 268
             'pretty_version' => '5.1.3',
269 269
             'version' => '5.1.3.0',
270 270
             'type' => 'library',
271
-            'install_path' => __DIR__ . '/../sebastian/environment',
271
+            'install_path' => __DIR__.'/../sebastian/environment',
272 272
             'aliases' => array(),
273 273
             'reference' => '388b6ced16caa751030f6a69e588299fa09200ac',
274 274
             'dev_requirement' => true,
@@ -277,7 +277,7 @@  discard block
 block discarded – undo
277 277
             'pretty_version' => '4.0.4',
278 278
             'version' => '4.0.4.0',
279 279
             'type' => 'library',
280
-            'install_path' => __DIR__ . '/../sebastian/exporter',
280
+            'install_path' => __DIR__.'/../sebastian/exporter',
281 281
             'aliases' => array(),
282 282
             'reference' => '65e8b7db476c5dd267e65eea9cab77584d3cfff9',
283 283
             'dev_requirement' => true,
@@ -286,7 +286,7 @@  discard block
 block discarded – undo
286 286
             'pretty_version' => '5.0.5',
287 287
             'version' => '5.0.5.0',
288 288
             'type' => 'library',
289
-            'install_path' => __DIR__ . '/../sebastian/global-state',
289
+            'install_path' => __DIR__.'/../sebastian/global-state',
290 290
             'aliases' => array(),
291 291
             'reference' => '0ca8db5a5fc9c8646244e629625ac486fa286bf2',
292 292
             'dev_requirement' => true,
@@ -295,7 +295,7 @@  discard block
 block discarded – undo
295 295
             'pretty_version' => '1.0.3',
296 296
             'version' => '1.0.3.0',
297 297
             'type' => 'library',
298
-            'install_path' => __DIR__ . '/../sebastian/lines-of-code',
298
+            'install_path' => __DIR__.'/../sebastian/lines-of-code',
299 299
             'aliases' => array(),
300 300
             'reference' => 'c1c2e997aa3146983ed888ad08b15470a2e22ecc',
301 301
             'dev_requirement' => true,
@@ -304,7 +304,7 @@  discard block
 block discarded – undo
304 304
             'pretty_version' => '4.0.4',
305 305
             'version' => '4.0.4.0',
306 306
             'type' => 'library',
307
-            'install_path' => __DIR__ . '/../sebastian/object-enumerator',
307
+            'install_path' => __DIR__.'/../sebastian/object-enumerator',
308 308
             'aliases' => array(),
309 309
             'reference' => '5c9eeac41b290a3712d88851518825ad78f45c71',
310 310
             'dev_requirement' => true,
@@ -313,7 +313,7 @@  discard block
 block discarded – undo
313 313
             'pretty_version' => '2.0.4',
314 314
             'version' => '2.0.4.0',
315 315
             'type' => 'library',
316
-            'install_path' => __DIR__ . '/../sebastian/object-reflector',
316
+            'install_path' => __DIR__.'/../sebastian/object-reflector',
317 317
             'aliases' => array(),
318 318
             'reference' => 'b4f479ebdbf63ac605d183ece17d8d7fe49c15c7',
319 319
             'dev_requirement' => true,
@@ -322,7 +322,7 @@  discard block
 block discarded – undo
322 322
             'pretty_version' => '4.0.4',
323 323
             'version' => '4.0.4.0',
324 324
             'type' => 'library',
325
-            'install_path' => __DIR__ . '/../sebastian/recursion-context',
325
+            'install_path' => __DIR__.'/../sebastian/recursion-context',
326 326
             'aliases' => array(),
327 327
             'reference' => 'cd9d8cf3c5804de4341c283ed787f099f5506172',
328 328
             'dev_requirement' => true,
@@ -331,7 +331,7 @@  discard block
 block discarded – undo
331 331
             'pretty_version' => '3.0.3',
332 332
             'version' => '3.0.3.0',
333 333
             'type' => 'library',
334
-            'install_path' => __DIR__ . '/../sebastian/resource-operations',
334
+            'install_path' => __DIR__.'/../sebastian/resource-operations',
335 335
             'aliases' => array(),
336 336
             'reference' => '0f4443cb3a1d92ce809899753bc0d5d5a8dd19a8',
337 337
             'dev_requirement' => true,
@@ -340,7 +340,7 @@  discard block
 block discarded – undo
340 340
             'pretty_version' => '3.0.0',
341 341
             'version' => '3.0.0.0',
342 342
             'type' => 'library',
343
-            'install_path' => __DIR__ . '/../sebastian/type',
343
+            'install_path' => __DIR__.'/../sebastian/type',
344 344
             'aliases' => array(),
345 345
             'reference' => 'b233b84bc4465aff7b57cf1c4bc75c86d00d6dad',
346 346
             'dev_requirement' => true,
@@ -349,7 +349,7 @@  discard block
 block discarded – undo
349 349
             'pretty_version' => '3.0.2',
350 350
             'version' => '3.0.2.0',
351 351
             'type' => 'library',
352
-            'install_path' => __DIR__ . '/../sebastian/version',
352
+            'install_path' => __DIR__.'/../sebastian/version',
353 353
             'aliases' => array(),
354 354
             'reference' => 'c6c1022351a901512170118436c764e473f6de8c',
355 355
             'dev_requirement' => true,
@@ -358,7 +358,7 @@  discard block
 block discarded – undo
358 358
             'pretty_version' => '3.6.2',
359 359
             'version' => '3.6.2.0',
360 360
             'type' => 'library',
361
-            'install_path' => __DIR__ . '/../squizlabs/php_codesniffer',
361
+            'install_path' => __DIR__.'/../squizlabs/php_codesniffer',
362 362
             'aliases' => array(),
363 363
             'reference' => '5e4e71592f69da17871dba6e80dd51bce74a351a',
364 364
             'dev_requirement' => true,
@@ -367,7 +367,7 @@  discard block
 block discarded – undo
367 367
             'pretty_version' => 'v1.25.0',
368 368
             'version' => '1.25.0.0',
369 369
             'type' => 'library',
370
-            'install_path' => __DIR__ . '/../symfony/polyfill-ctype',
370
+            'install_path' => __DIR__.'/../symfony/polyfill-ctype',
371 371
             'aliases' => array(),
372 372
             'reference' => '30885182c981ab175d4d034db0f6f469898070ab',
373 373
             'dev_requirement' => true,
@@ -376,7 +376,7 @@  discard block
 block discarded – undo
376 376
             'pretty_version' => '1.2.1',
377 377
             'version' => '1.2.1.0',
378 378
             'type' => 'library',
379
-            'install_path' => __DIR__ . '/../theseer/tokenizer',
379
+            'install_path' => __DIR__.'/../theseer/tokenizer',
380 380
             'aliases' => array(),
381 381
             'reference' => '34a41e998c2183e22995f158c581e7b5e755ab9e',
382 382
             'dev_requirement' => true,
@@ -385,7 +385,7 @@  discard block
 block discarded – undo
385 385
             'pretty_version' => '1.10.0',
386 386
             'version' => '1.10.0.0',
387 387
             'type' => 'library',
388
-            'install_path' => __DIR__ . '/../webmozart/assert',
388
+            'install_path' => __DIR__.'/../webmozart/assert',
389 389
             'aliases' => array(),
390 390
             'reference' => '6964c76c7804814a842473e0c8fd15bab0f18e25',
391 391
             'dev_requirement' => true,
@@ -394,7 +394,7 @@  discard block
 block discarded – undo
394 394
             'pretty_version' => '2.3.0',
395 395
             'version' => '2.3.0.0',
396 396
             'type' => 'phpcodesniffer-standard',
397
-            'install_path' => __DIR__ . '/../wp-coding-standards/wpcs',
397
+            'install_path' => __DIR__.'/../wp-coding-standards/wpcs',
398 398
             'aliases' => array(),
399 399
             'reference' => '7da1894633f168fe244afc6de00d141f27517b62',
400 400
             'dev_requirement' => true,
@@ -403,7 +403,7 @@  discard block
 block discarded – undo
403 403
             'pretty_version' => '1.0.3',
404 404
             'version' => '1.0.3.0',
405 405
             'type' => 'library',
406
-            'install_path' => __DIR__ . '/../yoast/phpunit-polyfills',
406
+            'install_path' => __DIR__.'/../yoast/phpunit-polyfills',
407 407
             'aliases' => array(),
408 408
             'reference' => '5ea3536428944955f969bc764bbe09738e151ada',
409 409
             'dev_requirement' => true,
Please login to merge, or discard this patch.
new/pricing/templates/event_tickets_datetime_ticket_price_row.template.php 1 patch
Braces   +10 added lines, -4 removed lines patch added patch discarded remove patch
@@ -61,9 +61,12 @@  discard block
 block discarded – undo
61 61
             <input type="text" size="1" class="edit-price-PRC_amount ee-numeric"
62 62
                    name="prices_archive[<?php echo esc_attr($tkt_row); ?>][<?php echo absint($PRC_order); ?>][PRC_amount]"
63 63
                    value="<?php echo esc_attr($PRC_amount); ?>" disabled>
64
-        <?php else : ?>
64
+        <?php else {
65
+	: ?>
65 66
             <input type="text" size="1" class="edit-price-PRC_amount ee-numeric"
66
-                   name="<?php echo esc_attr($edit_prices_name); ?>[<?php echo esc_attr($tkt_row); ?>][<?php echo absint($PRC_order); ?>][PRC_amount]"
67
+                   name="<?php echo esc_attr($edit_prices_name);
68
+}
69
+?>[<?php echo esc_attr($tkt_row); ?>][<?php echo absint($PRC_order); ?>][PRC_amount]"
67 70
                    value="<?php echo esc_attr($PRC_amount); ?>">
68 71
         <?php endif; ?>
69 72
     </td>
@@ -74,8 +77,11 @@  discard block
 block discarded – undo
74 77
     <td>
75 78
         <?php if ($disabled) : ?>
76 79
             <span class="dashicons dashicons-lock"></span>
77
-        <?php else : ?>
78
-            <!-- <span class="gear-icon dashicons dashicons-admin-generic clickable" data-ticket-row="<?php echo esc_attr($tkt_row); ?>" data-context="price" data-price-row="<?php echo absint($PRC_order); ?>"></span> -->
80
+        <?php else {
81
+	: ?>
82
+            <!-- <span class="gear-icon dashicons dashicons-admin-generic clickable" data-ticket-row="<?php echo esc_attr($tkt_row);
83
+}
84
+?>" data-context="price" data-price-row="<?php echo absint($PRC_order); ?>"></span> -->
79 85
             <span class="trash-icon dashicons dashicons-post-trash clickable" data-ticket-row="<?php echo esc_attr($tkt_row); ?>"
80 86
                   data-context="price" data-price-row="<?php echo absint($PRC_order); ?>"<?php echo $show_trash_icon; ?>></span>
81 87
             <button data-ticket-row="<?php echo esc_attr($tkt_row); ?>" data-price-row="<?php echo absint($PRC_order); ?>"
Please login to merge, or discard this patch.