@@ -83,21 +83,21 @@ discard block |
||
83 | 83 | </div> |
84 | 84 | <br class="clear" /> |
85 | 85 | <?php |
86 | - $no_payments = $grand_raw_total > 0 |
|
87 | - || $TXN_status !== EEM_Transaction::complete_status_code |
|
88 | - || ! empty($payments); |
|
89 | - ?> |
|
86 | + $no_payments = $grand_raw_total > 0 |
|
87 | + || $TXN_status !== EEM_Transaction::complete_status_code |
|
88 | + || ! empty($payments); |
|
89 | + ?> |
|
90 | 90 | <?php if ($attendee instanceof EE_Attendee && $no_payments) : ?> |
91 | 91 | <?php $no_payment_text = $can_edit_payments |
92 | - ? esc_html__( |
|
93 | - 'No payments have been applied to this transaction yet. Click "Apply Payment" below to make a payment.', |
|
94 | - 'event_espresso' |
|
95 | - ) |
|
96 | - : esc_html__( |
|
97 | - 'No payments have been applied to this transaction yet.', |
|
98 | - 'event_espresso' |
|
99 | - ); |
|
100 | - ?> |
|
92 | + ? esc_html__( |
|
93 | + 'No payments have been applied to this transaction yet. Click "Apply Payment" below to make a payment.', |
|
94 | + 'event_espresso' |
|
95 | + ) |
|
96 | + : esc_html__( |
|
97 | + 'No payments have been applied to this transaction yet.', |
|
98 | + 'event_espresso' |
|
99 | + ); |
|
100 | + ?> |
|
101 | 101 | |
102 | 102 | <h3 class="admin-primary-mbox-h4 hdr-has-icon"> |
103 | 103 | <?php esc_html_e('Payment Details', 'event_espresso'); ?> |
@@ -143,13 +143,13 @@ discard block |
||
143 | 143 | <?php if ($payments) : ?> |
144 | 144 | <?php $payment_total = 0; ?> |
145 | 145 | <?php foreach ($payments as $PAY_ID => $payment) : |
146 | - if (! $payment instanceof EE_Payment) { |
|
147 | - continue; |
|
148 | - } |
|
149 | - $existing_reg_payment_json = isset($existing_reg_payments[ $PAY_ID ]) |
|
150 | - ? wp_json_encode($existing_reg_payments[ $PAY_ID ]) |
|
151 | - : '{}'; |
|
152 | - ?> |
|
146 | + if (! $payment instanceof EE_Payment) { |
|
147 | + continue; |
|
148 | + } |
|
149 | + $existing_reg_payment_json = isset($existing_reg_payments[ $PAY_ID ]) |
|
150 | + ? wp_json_encode($existing_reg_payments[ $PAY_ID ]) |
|
151 | + : '{}'; |
|
152 | + ?> |
|
153 | 153 | <tr id="txn-admin-payment-tr-<?php echo absint($PAY_ID); ?>" class=' jst-cntr'> |
154 | 154 | <td class="jst-cntr no-pad"> |
155 | 155 | <span id="payment-status-<?php echo absint($PAY_ID); ?>" |
@@ -173,20 +173,20 @@ discard block |
||
173 | 173 | </td> |
174 | 174 | <td class=' jst-rght'> |
175 | 175 | <?php |
176 | - $payment_class = $payment->amount() > 0 |
|
177 | - ? 'txn-admin-payment-status-' . $payment->STS_ID() |
|
178 | - : 'txn-admin-payment-status-PDC'; |
|
179 | - ?> |
|
176 | + $payment_class = $payment->amount() > 0 |
|
177 | + ? 'txn-admin-payment-status-' . $payment->STS_ID() |
|
178 | + : 'txn-admin-payment-status-PDC'; |
|
179 | + ?> |
|
180 | 180 | <span class="<?php echo esc_attr($payment_class); ?>"> |
181 | 181 | <span id="payment-amount-<?php echo absint($PAY_ID); ?>" |
182 | 182 | style="display:inline;" |
183 | 183 | > |
184 | 184 | <?php echo EEH_Template::format_currency( |
185 | - $payment->amount(), |
|
186 | - false, |
|
187 | - false |
|
188 | - ); // already escaped |
|
189 | - ?> |
|
185 | + $payment->amount(), |
|
186 | + false, |
|
187 | + false |
|
188 | + ); // already escaped |
|
189 | + ?> |
|
190 | 190 | </span> |
191 | 191 | </span> |
192 | 192 | </td> |
@@ -197,13 +197,13 @@ discard block |
||
197 | 197 | <span class="ee-status--ignore">»</span> |
198 | 198 | <span id="payment-gateway-<?php echo absint($PAY_ID); ?>"> |
199 | 199 | <?php echo ($payment->payment_method() instanceof EE_Payment_Method |
200 | - ? esc_html($payment->payment_method()->admin_name()) |
|
201 | - : esc_html__("Unknown", 'event_espresso')); ?> |
|
200 | + ? esc_html($payment->payment_method()->admin_name()) |
|
201 | + : esc_html__("Unknown", 'event_espresso')); ?> |
|
202 | 202 | </span> |
203 | 203 | <span id="payment-gateway-id-<?php echo absint($PAY_ID); ?>" class="hidden"> |
204 | 204 | <?php echo ($payment->payment_method() instanceof EE_Payment_Method |
205 | - ? esc_html($payment->payment_method()->ID()) |
|
206 | - : 0); ?> |
|
205 | + ? esc_html($payment->payment_method()->ID()) |
|
206 | + : 0); ?> |
|
207 | 207 | </span> |
208 | 208 | </td> |
209 | 209 | <td class=" jst-left"> |
@@ -228,18 +228,18 @@ discard block |
||
228 | 228 | </td> |
229 | 229 | <td class=" jst-rght"> |
230 | 230 | <?php |
231 | - $payment_class = $payment->amount() > 0 |
|
232 | - ? 'txn-admin-payment-status-' . $payment->STS_ID() |
|
233 | - : 'txn-admin-payment-status-PDC'; |
|
234 | - ?> |
|
231 | + $payment_class = $payment->amount() > 0 |
|
232 | + ? 'txn-admin-payment-status-' . $payment->STS_ID() |
|
233 | + : 'txn-admin-payment-status-PDC'; |
|
234 | + ?> |
|
235 | 235 | <span class="<?php echo esc_attr($payment_class); ?>"> |
236 | 236 | <span id="payment-amount-<?php echo absint($PAY_ID); ?>" style="display:inline;"> |
237 | 237 | <?php echo EEH_Template::format_currency( |
238 | - $payment->amount(), |
|
239 | - false, |
|
240 | - false |
|
241 | - ); // already escaped |
|
242 | - ?> |
|
238 | + $payment->amount(), |
|
239 | + false, |
|
240 | + false |
|
241 | + ); // already escaped |
|
242 | + ?> |
|
243 | 243 | </span> |
244 | 244 | </span> |
245 | 245 | </td> |
@@ -271,9 +271,9 @@ discard block |
||
271 | 271 | <?php $payment_total += $payment->STS_ID() == 'PAP' ? $payment->amount() : 0; ?> |
272 | 272 | <?php endforeach; ?> |
273 | 273 | <?php $pay_totals_class = $payment_total > $grand_raw_total |
274 | - ? ' important-notice' |
|
275 | - : ''; |
|
276 | - ?> |
|
274 | + ? ' important-notice' |
|
275 | + : ''; |
|
276 | + ?> |
|
277 | 277 | <tr id="txn-admin-no-payments-tr" class="admin-primary-mbox-total-tr hidden"> |
278 | 278 | <td class=" jst-rght" colspan="10"> |
279 | 279 | <span class="important-notice"><?php echo wp_kses($no_payment_text, AllowedTags::getAllowedTags()); ?></span> |
@@ -285,27 +285,27 @@ discard block |
||
285 | 285 | <th class=" jst-rght" colspan="9"> |
286 | 286 | <span id="payments-total-spn"> |
287 | 287 | <?php |
288 | - $overpaid = $payment_total > $grand_raw_total |
|
289 | - ? '<span id="overpaid">' |
|
290 | - . __('This transaction has been overpaid ! ', 'event_espresso') |
|
291 | - . '</span>' |
|
292 | - : ''; |
|
293 | - echo $overpaid . esc_html( |
|
294 | - sprintf( |
|
295 | - __('Payments Total %s', 'event_espresso'), |
|
296 | - '(' . EE_Registry::instance()->CFG->currency->code . ')' |
|
297 | - ) |
|
298 | - ); ?> |
|
288 | + $overpaid = $payment_total > $grand_raw_total |
|
289 | + ? '<span id="overpaid">' |
|
290 | + . __('This transaction has been overpaid ! ', 'event_espresso') |
|
291 | + . '</span>' |
|
292 | + : ''; |
|
293 | + echo $overpaid . esc_html( |
|
294 | + sprintf( |
|
295 | + __('Payments Total %s', 'event_espresso'), |
|
296 | + '(' . EE_Registry::instance()->CFG->currency->code . ')' |
|
297 | + ) |
|
298 | + ); ?> |
|
299 | 299 | </span> |
300 | 300 | </th> |
301 | 301 | <th class=" jst-rght"> |
302 | 302 | <span id="txn-admin-payment-total"> |
303 | 303 | <?php |
304 | - echo EEH_Template::format_currency( |
|
305 | - $payment_total, |
|
306 | - false, |
|
307 | - false |
|
308 | - ); // already escaped ?> |
|
304 | + echo EEH_Template::format_currency( |
|
305 | + $payment_total, |
|
306 | + false, |
|
307 | + false |
|
308 | + ); // already escaped ?> |
|
309 | 309 | </span> |
310 | 310 | </th> |
311 | 311 | </tr> |
@@ -406,15 +406,15 @@ discard block |
||
406 | 406 | </span> |
407 | 407 | <?php endif; ?> |
408 | 408 | <?php |
409 | - // Allows extend the fields at actions area. |
|
410 | - ob_start(); |
|
411 | - do_action( |
|
412 | - 'AHEE__txn_admin_details_main_meta_box_txn_details__after_actions_buttons', |
|
413 | - $can_edit_payments |
|
414 | - ); |
|
415 | - $extra_actions = ob_get_clean(); |
|
416 | - echo str_replace(['<li', '</li>'], ['<span', '</span>'], $extra_actions); |
|
417 | - ?> |
|
409 | + // Allows extend the fields at actions area. |
|
410 | + ob_start(); |
|
411 | + do_action( |
|
412 | + 'AHEE__txn_admin_details_main_meta_box_txn_details__after_actions_buttons', |
|
413 | + $can_edit_payments |
|
414 | + ); |
|
415 | + $extra_actions = ob_get_clean(); |
|
416 | + echo str_replace(['<li', '</li>'], ['<span', '</span>'], $extra_actions); |
|
417 | + ?> |
|
418 | 418 | </div> |
419 | 419 | |
420 | 420 | <div id="txn-admin-apply-payment-dv" class="txn-admin-payment-option auto-hide" style="display: none;"> |
@@ -430,23 +430,23 @@ discard block |
||
430 | 430 | style="display:none;" |
431 | 431 | > |
432 | 432 | <?php |
433 | - printf( |
|
434 | - esc_html__('Edit Payment #%s for Transaction #%s', 'event_espresso'), |
|
435 | - '<span class="ee-admin-payment-id"></span>', |
|
436 | - $txn_nmbr['value'] |
|
437 | - ); |
|
438 | - ?> |
|
433 | + printf( |
|
434 | + esc_html__('Edit Payment #%s for Transaction #%s', 'event_espresso'), |
|
435 | + '<span class="ee-admin-payment-id"></span>', |
|
436 | + $txn_nmbr['value'] |
|
437 | + ); |
|
438 | + ?> |
|
439 | 439 | <span class='dashicons dashicons-money-alt'></span> |
440 | 440 | </h2> |
441 | 441 | |
442 | 442 | <h2 id="admin-modal-dialog-edit-refund-h2" class="admin-modal-dialog-h2 hdr-has-icon" style="display:none;"> |
443 | 443 | <?php |
444 | - printf( |
|
445 | - esc_html__('Edit Refund #%s for Transaction #%s', 'event_espresso'), |
|
446 | - '<span class="ee-admin-payment-id"></span>', |
|
447 | - $txn_nmbr['value'] |
|
448 | - ); |
|
449 | - ?> |
|
444 | + printf( |
|
445 | + esc_html__('Edit Refund #%s for Transaction #%s', 'event_espresso'), |
|
446 | + '<span class="ee-admin-payment-id"></span>', |
|
447 | + $txn_nmbr['value'] |
|
448 | + ); |
|
449 | + ?> |
|
450 | 450 | <span class='dashicons dashicons-money-alt'></span> |
451 | 451 | </h2> |
452 | 452 | |
@@ -454,9 +454,9 @@ discard block |
||
454 | 454 | style="display:none;" |
455 | 455 | > |
456 | 456 | <?php |
457 | - echo esc_html__('Apply a Refund to Transaction #', 'event_espresso'); |
|
458 | - echo esc_html($txn_nmbr['value']); |
|
459 | - ?> |
|
457 | + echo esc_html__('Apply a Refund to Transaction #', 'event_espresso'); |
|
458 | + echo esc_html($txn_nmbr['value']); |
|
459 | + ?> |
|
460 | 460 | <span class='dashicons dashicons-money-alt'></span> |
461 | 461 | </h2> |
462 | 462 | |
@@ -570,20 +570,20 @@ discard block |
||
570 | 570 | <?php echo esc_attr($selected); ?> |
571 | 571 | > |
572 | 572 | <?php |
573 | - echo esc_html( |
|
574 | - sanitize_key($method->admin_desc()) |
|
575 | - ? substr($method->admin_desc(), 0, 128) |
|
576 | - : $method->admin_name() |
|
577 | - ); |
|
578 | - ?> |
|
573 | + echo esc_html( |
|
574 | + sanitize_key($method->admin_desc()) |
|
575 | + ? substr($method->admin_desc(), 0, 128) |
|
576 | + : $method->admin_name() |
|
577 | + ); |
|
578 | + ?> |
|
579 | 579 | </option> |
580 | 580 | <?php endforeach; ?> |
581 | 581 | </select> |
582 | 582 | <p class="description"> |
583 | 583 | <?php esc_html_e( |
584 | - 'Whether the payment was made via PayPal, Credit Card, Cheque, or Cash', |
|
585 | - 'event_espresso' |
|
586 | - ); ?> |
|
584 | + 'Whether the payment was made via PayPal, Credit Card, Cheque, or Cash', |
|
585 | + 'event_espresso' |
|
586 | + ); ?> |
|
587 | 587 | </p> |
588 | 588 | </div> |
589 | 589 | </div> |
@@ -592,9 +592,9 @@ discard block |
||
592 | 592 | admin-modal-dialog-row ee-layout-row"> |
593 | 593 | <label for="txn-admin-payment-txn-id-chq-nmbr-inp" class=""> |
594 | 594 | <?php esc_html_e( |
595 | - 'TXN ID / CHQ #', |
|
596 | - 'event_espresso' |
|
597 | - ); ?> |
|
595 | + 'TXN ID / CHQ #', |
|
596 | + 'event_espresso' |
|
597 | + ); ?> |
|
598 | 598 | </label> |
599 | 599 | <div class='ee-layout-stack'> |
600 | 600 | <input name="txn_admin_payment[txn_id_chq_nmbr]" |
@@ -604,9 +604,9 @@ discard block |
||
604 | 604 | /> |
605 | 605 | <p class="description"> |
606 | 606 | <?php esc_html_e( |
607 | - 'The Transaction ID sent back from the payment gateway, or the Cheque #', |
|
608 | - 'event_espresso' |
|
609 | - ); ?> |
|
607 | + 'The Transaction ID sent back from the payment gateway, or the Cheque #', |
|
608 | + 'event_espresso' |
|
609 | + ); ?> |
|
610 | 610 | </p> |
611 | 611 | </div> |
612 | 612 | </div> |
@@ -624,9 +624,9 @@ discard block |
||
624 | 624 | /> |
625 | 625 | <p class="description"> |
626 | 626 | <?php esc_html_e( |
627 | - 'The gateway response string (optional)', |
|
628 | - 'event_espresso' |
|
629 | - ); ?> |
|
627 | + 'The gateway response string (optional)', |
|
628 | + 'event_espresso' |
|
629 | + ); ?> |
|
630 | 630 | </p> |
631 | 631 | </div> |
632 | 632 | </div> |
@@ -635,9 +635,9 @@ discard block |
||
635 | 635 | ee-layout-row"> |
636 | 636 | <label for="txn-admin-payment-status-slct" class=""> |
637 | 637 | <?php esc_html_e( |
638 | - 'Payment Status', |
|
639 | - 'event_espresso' |
|
640 | - ); ?> |
|
638 | + 'Payment Status', |
|
639 | + 'event_espresso' |
|
640 | + ); ?> |
|
641 | 641 | </label> |
642 | 642 | <div class='ee-layout-stack'> |
643 | 643 | <select name="txn_admin_payment[status]" |
@@ -647,10 +647,10 @@ discard block |
||
647 | 647 | > |
648 | 648 | <?php foreach ($payment_status as $STS_ID => $STS_code) : ?> |
649 | 649 | <?php |
650 | - $selected = $STS_ID == 'PAP' |
|
651 | - ? 'selected' |
|
652 | - : ''; |
|
653 | - ?> |
|
650 | + $selected = $STS_ID == 'PAP' |
|
651 | + ? 'selected' |
|
652 | + : ''; |
|
653 | + ?> |
|
654 | 654 | <option id="payment-status-opt-<?php echo esc_attr($STS_ID); ?>" |
655 | 655 | value="<?php echo esc_attr($STS_ID); ?>" |
656 | 656 | <?php echo esc_attr($selected); ?> |
@@ -661,10 +661,10 @@ discard block |
||
661 | 661 | </select> |
662 | 662 | <p class="description"> |
663 | 663 | <?php |
664 | - esc_html_e( |
|
665 | - 'Whether the payment was approved, cancelled, declined or failed after submission to the gateway', |
|
666 | - 'event_espresso' |
|
667 | - ); ?> |
|
664 | + esc_html_e( |
|
665 | + 'Whether the payment was approved, cancelled, declined or failed after submission to the gateway', |
|
666 | + 'event_espresso' |
|
667 | + ); ?> |
|
668 | 668 | </p> |
669 | 669 | </div> |
670 | 670 | </div> |
@@ -682,9 +682,9 @@ discard block |
||
682 | 682 | /> |
683 | 683 | <p class="description"> |
684 | 684 | <?php esc_html_e( |
685 | - 'The Purchase or Sales Order Number if any (optional)', |
|
686 | - 'event_espresso' |
|
687 | - ); ?> |
|
685 | + 'The Purchase or Sales Order Number if any (optional)', |
|
686 | + 'event_espresso' |
|
687 | + ); ?> |
|
688 | 688 | </p> |
689 | 689 | </div> |
690 | 690 | </div> |
@@ -707,9 +707,9 @@ discard block |
||
707 | 707 | /> |
708 | 708 | <p class="description"> |
709 | 709 | <?php esc_html_e( |
710 | - 'An extra field you may use for accounting purposes or simple notes. Defaults to the primary registrant\'s registration code.', |
|
711 | - 'event_espresso' |
|
712 | - ); ?> |
|
710 | + 'An extra field you may use for accounting purposes or simple notes. Defaults to the primary registrant\'s registration code.', |
|
711 | + 'event_espresso' |
|
712 | + ); ?> |
|
713 | 713 | </p> |
714 | 714 | </div> |
715 | 715 | </div> |
@@ -748,9 +748,9 @@ discard block |
||
748 | 748 | <?php echo wp_kses($status_change_select, AllowedTags::getWithFormTags()); ?> |
749 | 749 | <p class="description"> |
750 | 750 | <?php esc_html_e( |
751 | - 'If you wish to change the status for the registrations selected above, then select which status from this dropdown.', |
|
752 | - 'event_espresso' |
|
753 | - ); ?> |
|
751 | + 'If you wish to change the status for the registrations selected above, then select which status from this dropdown.', |
|
752 | + 'event_espresso' |
|
753 | + ); ?> |
|
754 | 754 | </p> |
755 | 755 | </div> |
756 | 756 | </div> |
@@ -781,14 +781,14 @@ discard block |
||
781 | 781 | <br class="clear-float" /> |
782 | 782 | <p class="description"> |
783 | 783 | <?php printf( |
784 | - esc_html__( |
|
785 | - 'By default %1$sa payment message is sent to the primary registrant%2$s after submitting this form.%3$sHowever, if you check the "Registration Messages" box, the system will also send any related messages matching the status of the registrations to %1$seach registration for this transaction%2$s.', |
|
786 | - 'event_espresso' |
|
787 | - ), |
|
788 | - '<strong>', |
|
789 | - '</strong>', |
|
790 | - '<br />' |
|
791 | - ); ?> |
|
784 | + esc_html__( |
|
785 | + 'By default %1$sa payment message is sent to the primary registrant%2$s after submitting this form.%3$sHowever, if you check the "Registration Messages" box, the system will also send any related messages matching the status of the registrations to %1$seach registration for this transaction%2$s.', |
|
786 | + 'event_espresso' |
|
787 | + ), |
|
788 | + '<strong>', |
|
789 | + '</strong>', |
|
790 | + '<br />' |
|
791 | + ); ?> |
|
792 | 792 | </p> |
793 | 793 | </div> |
794 | 794 | </div> |
@@ -843,10 +843,10 @@ discard block |
||
843 | 843 | style="display:none;" |
844 | 844 | > |
845 | 845 | <?php printf( |
846 | - esc_html__('Delete Payment/Refund for Transaction #', 'event_espresso'), |
|
847 | - $txn_nmbr['value'] |
|
848 | - ); |
|
849 | - ?> |
|
846 | + esc_html__('Delete Payment/Refund for Transaction #', 'event_espresso'), |
|
847 | + $txn_nmbr['value'] |
|
848 | + ); |
|
849 | + ?> |
|
850 | 850 | <span class='dashicons dashicons-money-alt'></span> |
851 | 851 | </h2> |
852 | 852 | |
@@ -886,13 +886,13 @@ discard block |
||
886 | 886 | <?php echo wp_kses($delete_status_change_select, AllowedTags::getWithFormTags()); ?> |
887 | 887 | <p class="description"> |
888 | 888 | <?php printf( |
889 | - esc_html__( |
|
890 | - 'If you wish to change the status of all the registrations associated with this transaction after deleting this payment/refund, then select which status from this dropdown. %sNote: ALL registrations associated with this transaction will be updated to this new status.%s', |
|
891 | - 'event_espresso' |
|
892 | - ), |
|
893 | - '<strong>', |
|
894 | - '</strong>' |
|
895 | - ); ?> |
|
889 | + esc_html__( |
|
890 | + 'If you wish to change the status of all the registrations associated with this transaction after deleting this payment/refund, then select which status from this dropdown. %sNote: ALL registrations associated with this transaction will be updated to this new status.%s', |
|
891 | + 'event_espresso' |
|
892 | + ), |
|
893 | + '<strong>', |
|
894 | + '</strong>' |
|
895 | + ); ?> |
|
896 | 896 | </p> |
897 | 897 | </div> |
898 | 898 | </div> |
@@ -909,10 +909,10 @@ discard block |
||
909 | 909 | /> |
910 | 910 | <p class="description"> |
911 | 911 | <?php |
912 | - esc_html_e( |
|
913 | - 'If you check this box, the system will send any related registration messages matching the status of the registrations to each registration for this transaction. No Payment notifications are sent when deleting a payment.', |
|
914 | - 'event_espresso' |
|
915 | - ); ?> |
|
912 | + esc_html_e( |
|
913 | + 'If you check this box, the system will send any related registration messages matching the status of the registrations to each registration for this transaction. No Payment notifications are sent when deleting a payment.', |
|
914 | + 'event_espresso' |
|
915 | + ); ?> |
|
916 | 916 | </p> |
917 | 917 | </div> |
918 | 918 | </div> |
@@ -940,8 +940,8 @@ discard block |
||
940 | 940 | <?php endif; // $grand_raw_total > 0?> |
941 | 941 | |
942 | 942 | <?php if (WP_DEBUG) { |
943 | - $delivered_messages = get_option('EED_Messages__payment', []); |
|
944 | - if (isset($delivered_messages[ $TXN_ID ])) { ?> |
|
943 | + $delivered_messages = get_option('EED_Messages__payment', []); |
|
944 | + if (isset($delivered_messages[ $TXN_ID ])) { ?> |
|
945 | 945 | <h4 class="admin-primary-mbox-h4 hdr-has-icon"> |
946 | 946 | <?php esc_html_e('Messages Sent to Primary Registrant', 'event_espresso'); ?> |
947 | 947 | <span class="dashicons dashicons-email-alt"></span> |
@@ -953,39 +953,39 @@ discard block |
||
953 | 953 | <th class="jst-left"><?php esc_html_e('Date & Time', 'event_espresso'); ?></th> |
954 | 954 | <th class="jst-left"><?php esc_html_e('Message Type', 'event_espresso'); ?></th> |
955 | 955 | <th class="jst-left"><?php esc_html_e( |
956 | - 'Payment Status Upon Sending', |
|
957 | - 'event_espresso' |
|
958 | - ); ?></th> |
|
956 | + 'Payment Status Upon Sending', |
|
957 | + 'event_espresso' |
|
958 | + ); ?></th> |
|
959 | 959 | <th class="jst-left"><?php esc_html_e('TXN Status Upon Sending', 'event_espresso'); ?></th> |
960 | 960 | </tr> |
961 | 961 | </thead> |
962 | 962 | <tbody> |
963 | 963 | <?php |
964 | - foreach ($delivered_messages[ $TXN_ID ] as $timestamp => $delivered_message) : |
|
965 | - ?> |
|
964 | + foreach ($delivered_messages[ $TXN_ID ] as $timestamp => $delivered_message) : |
|
965 | + ?> |
|
966 | 966 | <tr> |
967 | 967 | <td class="jst-left"> |
968 | 968 | <?php echo esc_html( |
969 | - date( |
|
970 | - get_option('date_format') . ' ' . get_option('time_format'), |
|
971 | - ($timestamp + (get_option('gmt_offset') * HOUR_IN_SECONDS)) |
|
972 | - ) |
|
973 | - ); ?> |
|
969 | + date( |
|
970 | + get_option('date_format') . ' ' . get_option('time_format'), |
|
971 | + ($timestamp + (get_option('gmt_offset') * HOUR_IN_SECONDS)) |
|
972 | + ) |
|
973 | + ); ?> |
|
974 | 974 | </td> |
975 | 975 | <td class="jst-left"><?php |
976 | - echo isset($delivered_message['message_type']) |
|
977 | - ? esc_html($delivered_message['message_type']) |
|
978 | - : ''; ?> |
|
976 | + echo isset($delivered_message['message_type']) |
|
977 | + ? esc_html($delivered_message['message_type']) |
|
978 | + : ''; ?> |
|
979 | 979 | </td> |
980 | 980 | <td class="jst-left"><?php |
981 | - echo isset($delivered_message['pay_status']) |
|
982 | - ? esc_html($delivered_message['pay_status']) |
|
983 | - : ''; ?> |
|
981 | + echo isset($delivered_message['pay_status']) |
|
982 | + ? esc_html($delivered_message['pay_status']) |
|
983 | + : ''; ?> |
|
984 | 984 | </td> |
985 | 985 | <td class="jst-left"><?php |
986 | - echo isset($delivered_message['txn_status']) |
|
987 | - ? esc_html($delivered_message['txn_status']) |
|
988 | - : ''; ?> |
|
986 | + echo isset($delivered_message['txn_status']) |
|
987 | + ? esc_html($delivered_message['txn_status']) |
|
988 | + : ''; ?> |
|
989 | 989 | </td> |
990 | 990 | </tr> |
991 | 991 | <?php endforeach; // $delivered_messages?> |
@@ -993,7 +993,7 @@ discard block |
||
993 | 993 | </table> |
994 | 994 | </div> |
995 | 995 | <?php |
996 | - } |
|
997 | - } |
|
998 | - ?> |
|
996 | + } |
|
997 | + } |
|
998 | + ?> |
|
999 | 999 | </div> |
@@ -14,595 +14,595 @@ discard block |
||
14 | 14 | */ |
15 | 15 | class EE_Registrations_List_Table extends EE_Admin_List_Table |
16 | 16 | { |
17 | - /** |
|
18 | - * @var Registrations_Admin_Page |
|
19 | - */ |
|
20 | - protected $_admin_page; |
|
21 | - |
|
22 | - /** |
|
23 | - * @var RegistrationsListTableUserCapabilities |
|
24 | - */ |
|
25 | - protected $caps_handler; |
|
26 | - |
|
27 | - /** |
|
28 | - * @var array |
|
29 | - */ |
|
30 | - private $_status; |
|
31 | - |
|
32 | - /** |
|
33 | - * An array of transaction details for the related transaction to the registration being processed. |
|
34 | - * This is set via the _set_related_details method. |
|
35 | - * |
|
36 | - * @var array |
|
37 | - */ |
|
38 | - protected $_transaction_details = []; |
|
39 | - |
|
40 | - /** |
|
41 | - * An array of event details for the related event to the registration being processed. |
|
42 | - * This is set via the _set_related_details method. |
|
43 | - * |
|
44 | - * @var array |
|
45 | - */ |
|
46 | - protected $_event_details = []; |
|
47 | - |
|
48 | - |
|
49 | - /** |
|
50 | - * @param Registrations_Admin_Page $admin_page |
|
51 | - */ |
|
52 | - public function __construct(Registrations_Admin_Page $admin_page) |
|
53 | - { |
|
54 | - $this->caps_handler = new RegistrationsListTableUserCapabilities(EE_Registry::instance()->CAP); |
|
55 | - $req_data = $admin_page->get_request_data(); |
|
56 | - if (! empty($req_data['event_id'])) { |
|
57 | - $extra_query_args = []; |
|
58 | - foreach ($admin_page->get_views() as $view_details) { |
|
59 | - $extra_query_args[ $view_details['slug'] ] = ['event_id' => $req_data['event_id']]; |
|
60 | - } |
|
61 | - $this->_views = $admin_page->get_list_table_view_RLs($extra_query_args); |
|
62 | - } |
|
63 | - parent::__construct($admin_page); |
|
64 | - $this->_status = $this->_admin_page->get_registration_status_array(); |
|
65 | - } |
|
66 | - |
|
67 | - |
|
68 | - /** |
|
69 | - * @return void |
|
70 | - * @throws EE_Error |
|
71 | - */ |
|
72 | - protected function _setup_data() |
|
73 | - { |
|
74 | - $this->_data = $this->_admin_page->get_registrations($this->_per_page); |
|
75 | - $this->_all_data_count = $this->_admin_page->get_registrations($this->_per_page, true); |
|
76 | - } |
|
77 | - |
|
78 | - |
|
79 | - /** |
|
80 | - * @return void |
|
81 | - */ |
|
82 | - protected function _set_properties() |
|
83 | - { |
|
84 | - $return_url = $this->getReturnUrl(); |
|
85 | - $this->_wp_list_args = [ |
|
86 | - 'singular' => esc_html__('registration', 'event_espresso'), |
|
87 | - 'plural' => esc_html__('registrations', 'event_espresso'), |
|
88 | - 'ajax' => true, |
|
89 | - 'screen' => $this->_admin_page->get_current_screen()->id, |
|
90 | - ]; |
|
91 | - $req_data = $this->_admin_page->get_request_data(); |
|
92 | - if (isset($req_data['event_id'])) { |
|
93 | - $this->_columns = [ |
|
94 | - 'cb' => '<input type="checkbox" />', // Render a checkbox instead of text |
|
95 | - 'id' => esc_html__('ID', 'event_espresso'), |
|
96 | - 'ATT_fname' => esc_html__('Name', 'event_espresso'), |
|
97 | - 'ATT_email' => esc_html__('Email', 'event_espresso'), |
|
98 | - '_REG_date' => esc_html__('Reg Date', 'event_espresso'), |
|
99 | - 'PRC_amount' => esc_html__('TKT Price', 'event_espresso'), |
|
100 | - '_REG_final_price' => esc_html__('Final Price', 'event_espresso'), |
|
101 | - 'TXN_total' => esc_html__('Total Txn', 'event_espresso'), |
|
102 | - 'TXN_paid' => esc_html__('Paid', 'event_espresso'), |
|
103 | - 'actions' => $this->actionsColumnHeader(), |
|
104 | - ]; |
|
105 | - $this->_bottom_buttons = [ |
|
106 | - 'report' => [ |
|
107 | - 'route' => 'registrations_report', |
|
108 | - 'extra_request' => [ |
|
109 | - 'EVT_ID' => $this->_req_data['event_id'] ?? null, |
|
110 | - 'return_url' => $return_url, |
|
111 | - ], |
|
112 | - ], |
|
113 | - ]; |
|
114 | - } else { |
|
115 | - $this->_columns = [ |
|
116 | - 'cb' => '<input type="checkbox" />', // Render a checkbox instead of text |
|
117 | - 'id' => esc_html__('ID', 'event_espresso'), |
|
118 | - 'ATT_fname' => esc_html__('Name', 'event_espresso'), |
|
119 | - '_REG_date' => esc_html__('TXN Date', 'event_espresso'), |
|
120 | - 'event_name' => esc_html__('Event', 'event_espresso'), |
|
121 | - 'DTT_EVT_start' => esc_html__('Event Date', 'event_espresso'), |
|
122 | - '_REG_final_price' => esc_html__('Price', 'event_espresso'), |
|
123 | - '_REG_paid' => esc_html__('Paid', 'event_espresso'), |
|
124 | - 'actions' => $this->actionsColumnHeader(), |
|
125 | - ]; |
|
126 | - $this->_bottom_buttons = [ |
|
127 | - 'report_all' => [ |
|
128 | - 'route' => 'registrations_report', |
|
129 | - 'extra_request' => [ |
|
130 | - 'return_url' => $return_url, |
|
131 | - ], |
|
132 | - ], |
|
133 | - ]; |
|
134 | - } |
|
135 | - $this->_bottom_buttons['report_filtered'] = [ |
|
136 | - 'route' => 'registrations_report', |
|
137 | - 'extra_request' => [ |
|
138 | - 'use_filters' => true, |
|
139 | - 'return_url' => $return_url, |
|
140 | - ], |
|
141 | - ]; |
|
142 | - $filters = array_diff_key( |
|
143 | - $this->_req_data, |
|
144 | - array_flip( |
|
145 | - [ |
|
146 | - 'page', |
|
147 | - 'action', |
|
148 | - 'default_nonce', |
|
149 | - ] |
|
150 | - ) |
|
151 | - ); |
|
152 | - if (! empty($filters)) { |
|
153 | - $this->_bottom_buttons['report_filtered']['extra_request']['filters'] = $filters; |
|
154 | - } |
|
155 | - $this->_primary_column = 'id'; |
|
156 | - $this->_sortable_columns = [ |
|
157 | - '_REG_date' => ['_REG_date' => true], // true means its already sorted |
|
158 | - /** |
|
159 | - * Allows users to change the default sort if they wish. |
|
160 | - * Returning a falsey on this filter will result in the default sort to be by firstname rather than last |
|
161 | - * name. |
|
162 | - */ |
|
163 | - 'ATT_fname' => [ |
|
164 | - 'FHEE__EE_Registrations_List_Table___set_properties__default_sort_by_registration_last_name', |
|
165 | - true, |
|
166 | - $this, |
|
167 | - ] |
|
168 | - ? ['ATT_lname' => false] |
|
169 | - : ['ATT_fname' => false], |
|
170 | - 'event_name' => ['event_name' => false], |
|
171 | - 'DTT_EVT_start' => ['DTT_EVT_start' => false], |
|
172 | - 'id' => ['REG_ID' => false], |
|
173 | - ]; |
|
174 | - $this->_hidden_columns = []; |
|
175 | - } |
|
176 | - |
|
177 | - |
|
178 | - /** |
|
179 | - * This simply sets up the row class for the table rows. |
|
180 | - * Allows for easier overriding of child methods for setting up sorting. |
|
181 | - * |
|
182 | - * @param EE_Registration $item the current item |
|
183 | - * @return string |
|
184 | - */ |
|
185 | - protected function _get_row_class($item): string |
|
186 | - { |
|
187 | - $class = parent::_get_row_class($item); |
|
188 | - if ($this->_has_checkbox_column) { |
|
189 | - $class .= ' has-checkbox-column'; |
|
190 | - } |
|
191 | - return $class; |
|
192 | - } |
|
193 | - |
|
194 | - |
|
195 | - /** |
|
196 | - * Set the $_transaction_details property if not set yet. |
|
197 | - * |
|
198 | - * @param EE_Registration $registration |
|
199 | - * @throws EE_Error |
|
200 | - * @throws InvalidArgumentException |
|
201 | - * @throws ReflectionException |
|
202 | - * @throws InvalidDataTypeException |
|
203 | - * @throws InvalidInterfaceException |
|
204 | - */ |
|
205 | - protected function _set_related_details(EE_Registration $registration) |
|
206 | - { |
|
207 | - $transaction = $registration->get_first_related('Transaction'); |
|
208 | - $status = $transaction instanceof EE_Transaction |
|
209 | - ? $transaction->status_ID() |
|
210 | - : EEM_Transaction::failed_status_code; |
|
211 | - $this->_transaction_details = [ |
|
212 | - 'transaction' => $transaction, |
|
213 | - 'status' => $status, |
|
214 | - 'id' => $transaction instanceof EE_Transaction |
|
215 | - ? $transaction->ID() |
|
216 | - : 0, |
|
217 | - 'title_attr' => sprintf( |
|
218 | - esc_html__('View Transaction Details (%s)', 'event_espresso'), |
|
219 | - EEH_Template::pretty_status($status, false, 'sentence') |
|
220 | - ), |
|
221 | - ]; |
|
222 | - try { |
|
223 | - $event = $registration->event(); |
|
224 | - } catch (EntityNotFoundException $e) { |
|
225 | - $event = null; |
|
226 | - } |
|
227 | - $status = $event instanceof EE_Event |
|
228 | - ? $event->get_active_status() |
|
229 | - : EE_Datetime::inactive; |
|
230 | - $this->_event_details = [ |
|
231 | - 'event' => $event, |
|
232 | - 'status' => $status, |
|
233 | - 'id' => $event instanceof EE_Event |
|
234 | - ? $event->ID() |
|
235 | - : 0, |
|
236 | - 'title_attr' => sprintf( |
|
237 | - esc_html__('Edit Event (%s)', 'event_espresso'), |
|
238 | - EEH_Template::pretty_status($status, false, 'sentence') |
|
239 | - ), |
|
240 | - ]; |
|
241 | - } |
|
242 | - |
|
243 | - |
|
244 | - /** |
|
245 | - * @return array |
|
246 | - * @throws EE_Error |
|
247 | - * @throws ReflectionException |
|
248 | - */ |
|
249 | - protected function _get_table_filters(): array |
|
250 | - { |
|
251 | - $filters = []; |
|
252 | - // todo we're currently using old functions here. We need to move things into the Events_Admin_Page() class as |
|
253 | - // methods. |
|
254 | - $cur_date = $this->_req_data['month_range'] ?? ''; |
|
255 | - $cur_category = $this->_req_data['EVT_CAT'] ?? -1; |
|
256 | - $reg_status = $this->_req_data['_reg_status'] ?? ''; |
|
257 | - $filters[] = EEH_Form_Fields::generate_registration_months_dropdown($cur_date, $reg_status, $cur_category); |
|
258 | - $filters[] = EEH_Form_Fields::generate_event_category_dropdown($cur_category); |
|
259 | - $status = []; |
|
260 | - $status[] = ['id' => 0, 'text' => esc_html__('Select Status', 'event_espresso')]; |
|
261 | - foreach ($this->_status as $key => $value) { |
|
262 | - $status[] = ['id' => $key, 'text' => $value]; |
|
263 | - } |
|
264 | - if ($this->_view !== 'incomplete') { |
|
265 | - $filters[] = EEH_Form_Fields::select_input( |
|
266 | - '_reg_status', |
|
267 | - $status, |
|
268 | - isset($this->_req_data['_reg_status']) |
|
269 | - ? strtoupper(sanitize_key($this->_req_data['_reg_status'])) |
|
270 | - : '' |
|
271 | - ); |
|
272 | - } |
|
273 | - if (isset($this->_req_data['event_id'])) { |
|
274 | - $filters[] = EEH_Form_Fields::hidden_input('event_id', $this->_req_data['event_id'], 'reg_event_id'); |
|
275 | - } |
|
276 | - return $filters; |
|
277 | - } |
|
278 | - |
|
279 | - |
|
280 | - /** |
|
281 | - * @return void |
|
282 | - * @throws EE_Error |
|
283 | - * @throws InvalidArgumentException |
|
284 | - * @throws InvalidDataTypeException |
|
285 | - * @throws InvalidInterfaceException |
|
286 | - * @throws ReflectionException |
|
287 | - */ |
|
288 | - protected function _add_view_counts() |
|
289 | - { |
|
290 | - $this->_views['all']['count'] = $this->_total_registrations(); |
|
291 | - $this->_views['month']['count'] = $this->_total_registrations_this_month(); |
|
292 | - $this->_views['today']['count'] = $this->_total_registrations_today(); |
|
293 | - if ($this->caps_handler->userCanTrashRegistrations()) { |
|
294 | - $this->_views['incomplete']['count'] = $this->_total_registrations('incomplete'); |
|
295 | - $this->_views['trash']['count'] = $this->_total_registrations('trash'); |
|
296 | - } |
|
297 | - } |
|
298 | - |
|
299 | - |
|
300 | - /** |
|
301 | - * @param string $view |
|
302 | - * @return int |
|
303 | - * @throws EE_Error |
|
304 | - * @throws ReflectionException |
|
305 | - */ |
|
306 | - protected function _total_registrations(string $view = ''): int |
|
307 | - { |
|
308 | - $_where = []; |
|
309 | - $EVT_ID = isset($this->_req_data['event_id']) |
|
310 | - ? absint($this->_req_data['event_id']) |
|
311 | - : false; |
|
312 | - if ($EVT_ID) { |
|
313 | - $_where['EVT_ID'] = $EVT_ID; |
|
314 | - } |
|
315 | - switch ($view) { |
|
316 | - case 'trash': |
|
317 | - return EEM_Registration::instance()->count_deleted([$_where]); |
|
318 | - case 'incomplete': |
|
319 | - $_where['STS_ID'] = EEM_Registration::status_id_incomplete; |
|
320 | - break; |
|
321 | - default: |
|
322 | - $_where['STS_ID'] = ['!=', EEM_Registration::status_id_incomplete]; |
|
323 | - } |
|
324 | - return EEM_Registration::instance()->count([$_where]); |
|
325 | - } |
|
326 | - |
|
327 | - |
|
328 | - /** |
|
329 | - * @return int |
|
330 | - * @throws EE_Error |
|
331 | - * @throws ReflectionException |
|
332 | - */ |
|
333 | - protected function _total_registrations_this_month(): int |
|
334 | - { |
|
335 | - $EVT_ID = isset($this->_req_data['event_id']) |
|
336 | - ? absint($this->_req_data['event_id']) |
|
337 | - : false; |
|
338 | - $_where = $EVT_ID |
|
339 | - ? ['EVT_ID' => $EVT_ID] |
|
340 | - : []; |
|
341 | - $this_year_r = date('Y', current_time('timestamp')); |
|
342 | - $time_start = ' 00:00:00'; |
|
343 | - $time_end = ' 23:59:59'; |
|
344 | - $this_month_r = date('m', current_time('timestamp')); |
|
345 | - $days_this_month = date('t', current_time('timestamp')); |
|
346 | - // setup date query. |
|
347 | - $beginning_string = EEM_Registration::instance()->convert_datetime_for_query( |
|
348 | - 'REG_date', |
|
349 | - $this_year_r . '-' . $this_month_r . '-01' . ' ' . $time_start, |
|
350 | - 'Y-m-d H:i:s' |
|
351 | - ); |
|
352 | - $end_string = EEM_Registration::instance()->convert_datetime_for_query( |
|
353 | - 'REG_date', |
|
354 | - $this_year_r . '-' . $this_month_r . '-' . $days_this_month . ' ' . $time_end, |
|
355 | - 'Y-m-d H:i:s' |
|
356 | - ); |
|
357 | - $_where['REG_date'] = [ |
|
358 | - 'BETWEEN', |
|
359 | - [ |
|
360 | - $beginning_string, |
|
361 | - $end_string, |
|
362 | - ], |
|
363 | - ]; |
|
364 | - $_where['STS_ID'] = ['!=', EEM_Registration::status_id_incomplete]; |
|
365 | - return EEM_Registration::instance()->count([$_where]); |
|
366 | - } |
|
367 | - |
|
368 | - |
|
369 | - /** |
|
370 | - * @return int |
|
371 | - * @throws EE_Error |
|
372 | - * @throws ReflectionException |
|
373 | - */ |
|
374 | - protected function _total_registrations_today(): int |
|
375 | - { |
|
376 | - $EVT_ID = isset($this->_req_data['event_id']) |
|
377 | - ? absint($this->_req_data['event_id']) |
|
378 | - : false; |
|
379 | - $_where = $EVT_ID |
|
380 | - ? ['EVT_ID' => $EVT_ID] |
|
381 | - : []; |
|
382 | - $current_date = date('Y-m-d', current_time('timestamp')); |
|
383 | - $time_start = ' 00:00:00'; |
|
384 | - $time_end = ' 23:59:59'; |
|
385 | - $_where['REG_date'] = [ |
|
386 | - 'BETWEEN', |
|
387 | - [ |
|
388 | - EEM_Registration::instance()->convert_datetime_for_query( |
|
389 | - 'REG_date', |
|
390 | - $current_date . $time_start, |
|
391 | - 'Y-m-d H:i:s' |
|
392 | - ), |
|
393 | - EEM_Registration::instance()->convert_datetime_for_query( |
|
394 | - 'REG_date', |
|
395 | - $current_date . $time_end, |
|
396 | - 'Y-m-d H:i:s' |
|
397 | - ), |
|
398 | - ], |
|
399 | - ]; |
|
400 | - $_where['STS_ID'] = ['!=', EEM_Registration::status_id_incomplete]; |
|
401 | - return EEM_Registration::instance()->count([$_where]); |
|
402 | - } |
|
403 | - |
|
404 | - |
|
405 | - /** |
|
406 | - * @param EE_Registration $item |
|
407 | - * @return string |
|
408 | - * @throws EE_Error |
|
409 | - * @throws InvalidArgumentException |
|
410 | - * @throws InvalidDataTypeException |
|
411 | - * @throws InvalidInterfaceException |
|
412 | - * @throws ReflectionException |
|
413 | - */ |
|
414 | - public function column_cb($item): string |
|
415 | - { |
|
416 | - /** checkbox/lock **/ |
|
417 | - $REG_ID = $item->ID(); |
|
418 | - $transaction = $item->get_first_related('Transaction'); |
|
419 | - $payment_count = $transaction instanceof EE_Transaction |
|
420 | - ? $transaction->count_related('Payment') |
|
421 | - : 0; |
|
422 | - |
|
423 | - $content = '<input type="checkbox" name="_REG_ID[]" value="' . $REG_ID . '" />'; |
|
424 | - $content .= $payment_count > 0 || ! $this->caps_handler->userCanEditRegistration($item) |
|
425 | - ? '<span class="ee-locked-entity dashicons dashicons-lock ee-aria-tooltip ee-aria-tooltip--big-box" |
|
17 | + /** |
|
18 | + * @var Registrations_Admin_Page |
|
19 | + */ |
|
20 | + protected $_admin_page; |
|
21 | + |
|
22 | + /** |
|
23 | + * @var RegistrationsListTableUserCapabilities |
|
24 | + */ |
|
25 | + protected $caps_handler; |
|
26 | + |
|
27 | + /** |
|
28 | + * @var array |
|
29 | + */ |
|
30 | + private $_status; |
|
31 | + |
|
32 | + /** |
|
33 | + * An array of transaction details for the related transaction to the registration being processed. |
|
34 | + * This is set via the _set_related_details method. |
|
35 | + * |
|
36 | + * @var array |
|
37 | + */ |
|
38 | + protected $_transaction_details = []; |
|
39 | + |
|
40 | + /** |
|
41 | + * An array of event details for the related event to the registration being processed. |
|
42 | + * This is set via the _set_related_details method. |
|
43 | + * |
|
44 | + * @var array |
|
45 | + */ |
|
46 | + protected $_event_details = []; |
|
47 | + |
|
48 | + |
|
49 | + /** |
|
50 | + * @param Registrations_Admin_Page $admin_page |
|
51 | + */ |
|
52 | + public function __construct(Registrations_Admin_Page $admin_page) |
|
53 | + { |
|
54 | + $this->caps_handler = new RegistrationsListTableUserCapabilities(EE_Registry::instance()->CAP); |
|
55 | + $req_data = $admin_page->get_request_data(); |
|
56 | + if (! empty($req_data['event_id'])) { |
|
57 | + $extra_query_args = []; |
|
58 | + foreach ($admin_page->get_views() as $view_details) { |
|
59 | + $extra_query_args[ $view_details['slug'] ] = ['event_id' => $req_data['event_id']]; |
|
60 | + } |
|
61 | + $this->_views = $admin_page->get_list_table_view_RLs($extra_query_args); |
|
62 | + } |
|
63 | + parent::__construct($admin_page); |
|
64 | + $this->_status = $this->_admin_page->get_registration_status_array(); |
|
65 | + } |
|
66 | + |
|
67 | + |
|
68 | + /** |
|
69 | + * @return void |
|
70 | + * @throws EE_Error |
|
71 | + */ |
|
72 | + protected function _setup_data() |
|
73 | + { |
|
74 | + $this->_data = $this->_admin_page->get_registrations($this->_per_page); |
|
75 | + $this->_all_data_count = $this->_admin_page->get_registrations($this->_per_page, true); |
|
76 | + } |
|
77 | + |
|
78 | + |
|
79 | + /** |
|
80 | + * @return void |
|
81 | + */ |
|
82 | + protected function _set_properties() |
|
83 | + { |
|
84 | + $return_url = $this->getReturnUrl(); |
|
85 | + $this->_wp_list_args = [ |
|
86 | + 'singular' => esc_html__('registration', 'event_espresso'), |
|
87 | + 'plural' => esc_html__('registrations', 'event_espresso'), |
|
88 | + 'ajax' => true, |
|
89 | + 'screen' => $this->_admin_page->get_current_screen()->id, |
|
90 | + ]; |
|
91 | + $req_data = $this->_admin_page->get_request_data(); |
|
92 | + if (isset($req_data['event_id'])) { |
|
93 | + $this->_columns = [ |
|
94 | + 'cb' => '<input type="checkbox" />', // Render a checkbox instead of text |
|
95 | + 'id' => esc_html__('ID', 'event_espresso'), |
|
96 | + 'ATT_fname' => esc_html__('Name', 'event_espresso'), |
|
97 | + 'ATT_email' => esc_html__('Email', 'event_espresso'), |
|
98 | + '_REG_date' => esc_html__('Reg Date', 'event_espresso'), |
|
99 | + 'PRC_amount' => esc_html__('TKT Price', 'event_espresso'), |
|
100 | + '_REG_final_price' => esc_html__('Final Price', 'event_espresso'), |
|
101 | + 'TXN_total' => esc_html__('Total Txn', 'event_espresso'), |
|
102 | + 'TXN_paid' => esc_html__('Paid', 'event_espresso'), |
|
103 | + 'actions' => $this->actionsColumnHeader(), |
|
104 | + ]; |
|
105 | + $this->_bottom_buttons = [ |
|
106 | + 'report' => [ |
|
107 | + 'route' => 'registrations_report', |
|
108 | + 'extra_request' => [ |
|
109 | + 'EVT_ID' => $this->_req_data['event_id'] ?? null, |
|
110 | + 'return_url' => $return_url, |
|
111 | + ], |
|
112 | + ], |
|
113 | + ]; |
|
114 | + } else { |
|
115 | + $this->_columns = [ |
|
116 | + 'cb' => '<input type="checkbox" />', // Render a checkbox instead of text |
|
117 | + 'id' => esc_html__('ID', 'event_espresso'), |
|
118 | + 'ATT_fname' => esc_html__('Name', 'event_espresso'), |
|
119 | + '_REG_date' => esc_html__('TXN Date', 'event_espresso'), |
|
120 | + 'event_name' => esc_html__('Event', 'event_espresso'), |
|
121 | + 'DTT_EVT_start' => esc_html__('Event Date', 'event_espresso'), |
|
122 | + '_REG_final_price' => esc_html__('Price', 'event_espresso'), |
|
123 | + '_REG_paid' => esc_html__('Paid', 'event_espresso'), |
|
124 | + 'actions' => $this->actionsColumnHeader(), |
|
125 | + ]; |
|
126 | + $this->_bottom_buttons = [ |
|
127 | + 'report_all' => [ |
|
128 | + 'route' => 'registrations_report', |
|
129 | + 'extra_request' => [ |
|
130 | + 'return_url' => $return_url, |
|
131 | + ], |
|
132 | + ], |
|
133 | + ]; |
|
134 | + } |
|
135 | + $this->_bottom_buttons['report_filtered'] = [ |
|
136 | + 'route' => 'registrations_report', |
|
137 | + 'extra_request' => [ |
|
138 | + 'use_filters' => true, |
|
139 | + 'return_url' => $return_url, |
|
140 | + ], |
|
141 | + ]; |
|
142 | + $filters = array_diff_key( |
|
143 | + $this->_req_data, |
|
144 | + array_flip( |
|
145 | + [ |
|
146 | + 'page', |
|
147 | + 'action', |
|
148 | + 'default_nonce', |
|
149 | + ] |
|
150 | + ) |
|
151 | + ); |
|
152 | + if (! empty($filters)) { |
|
153 | + $this->_bottom_buttons['report_filtered']['extra_request']['filters'] = $filters; |
|
154 | + } |
|
155 | + $this->_primary_column = 'id'; |
|
156 | + $this->_sortable_columns = [ |
|
157 | + '_REG_date' => ['_REG_date' => true], // true means its already sorted |
|
158 | + /** |
|
159 | + * Allows users to change the default sort if they wish. |
|
160 | + * Returning a falsey on this filter will result in the default sort to be by firstname rather than last |
|
161 | + * name. |
|
162 | + */ |
|
163 | + 'ATT_fname' => [ |
|
164 | + 'FHEE__EE_Registrations_List_Table___set_properties__default_sort_by_registration_last_name', |
|
165 | + true, |
|
166 | + $this, |
|
167 | + ] |
|
168 | + ? ['ATT_lname' => false] |
|
169 | + : ['ATT_fname' => false], |
|
170 | + 'event_name' => ['event_name' => false], |
|
171 | + 'DTT_EVT_start' => ['DTT_EVT_start' => false], |
|
172 | + 'id' => ['REG_ID' => false], |
|
173 | + ]; |
|
174 | + $this->_hidden_columns = []; |
|
175 | + } |
|
176 | + |
|
177 | + |
|
178 | + /** |
|
179 | + * This simply sets up the row class for the table rows. |
|
180 | + * Allows for easier overriding of child methods for setting up sorting. |
|
181 | + * |
|
182 | + * @param EE_Registration $item the current item |
|
183 | + * @return string |
|
184 | + */ |
|
185 | + protected function _get_row_class($item): string |
|
186 | + { |
|
187 | + $class = parent::_get_row_class($item); |
|
188 | + if ($this->_has_checkbox_column) { |
|
189 | + $class .= ' has-checkbox-column'; |
|
190 | + } |
|
191 | + return $class; |
|
192 | + } |
|
193 | + |
|
194 | + |
|
195 | + /** |
|
196 | + * Set the $_transaction_details property if not set yet. |
|
197 | + * |
|
198 | + * @param EE_Registration $registration |
|
199 | + * @throws EE_Error |
|
200 | + * @throws InvalidArgumentException |
|
201 | + * @throws ReflectionException |
|
202 | + * @throws InvalidDataTypeException |
|
203 | + * @throws InvalidInterfaceException |
|
204 | + */ |
|
205 | + protected function _set_related_details(EE_Registration $registration) |
|
206 | + { |
|
207 | + $transaction = $registration->get_first_related('Transaction'); |
|
208 | + $status = $transaction instanceof EE_Transaction |
|
209 | + ? $transaction->status_ID() |
|
210 | + : EEM_Transaction::failed_status_code; |
|
211 | + $this->_transaction_details = [ |
|
212 | + 'transaction' => $transaction, |
|
213 | + 'status' => $status, |
|
214 | + 'id' => $transaction instanceof EE_Transaction |
|
215 | + ? $transaction->ID() |
|
216 | + : 0, |
|
217 | + 'title_attr' => sprintf( |
|
218 | + esc_html__('View Transaction Details (%s)', 'event_espresso'), |
|
219 | + EEH_Template::pretty_status($status, false, 'sentence') |
|
220 | + ), |
|
221 | + ]; |
|
222 | + try { |
|
223 | + $event = $registration->event(); |
|
224 | + } catch (EntityNotFoundException $e) { |
|
225 | + $event = null; |
|
226 | + } |
|
227 | + $status = $event instanceof EE_Event |
|
228 | + ? $event->get_active_status() |
|
229 | + : EE_Datetime::inactive; |
|
230 | + $this->_event_details = [ |
|
231 | + 'event' => $event, |
|
232 | + 'status' => $status, |
|
233 | + 'id' => $event instanceof EE_Event |
|
234 | + ? $event->ID() |
|
235 | + : 0, |
|
236 | + 'title_attr' => sprintf( |
|
237 | + esc_html__('Edit Event (%s)', 'event_espresso'), |
|
238 | + EEH_Template::pretty_status($status, false, 'sentence') |
|
239 | + ), |
|
240 | + ]; |
|
241 | + } |
|
242 | + |
|
243 | + |
|
244 | + /** |
|
245 | + * @return array |
|
246 | + * @throws EE_Error |
|
247 | + * @throws ReflectionException |
|
248 | + */ |
|
249 | + protected function _get_table_filters(): array |
|
250 | + { |
|
251 | + $filters = []; |
|
252 | + // todo we're currently using old functions here. We need to move things into the Events_Admin_Page() class as |
|
253 | + // methods. |
|
254 | + $cur_date = $this->_req_data['month_range'] ?? ''; |
|
255 | + $cur_category = $this->_req_data['EVT_CAT'] ?? -1; |
|
256 | + $reg_status = $this->_req_data['_reg_status'] ?? ''; |
|
257 | + $filters[] = EEH_Form_Fields::generate_registration_months_dropdown($cur_date, $reg_status, $cur_category); |
|
258 | + $filters[] = EEH_Form_Fields::generate_event_category_dropdown($cur_category); |
|
259 | + $status = []; |
|
260 | + $status[] = ['id' => 0, 'text' => esc_html__('Select Status', 'event_espresso')]; |
|
261 | + foreach ($this->_status as $key => $value) { |
|
262 | + $status[] = ['id' => $key, 'text' => $value]; |
|
263 | + } |
|
264 | + if ($this->_view !== 'incomplete') { |
|
265 | + $filters[] = EEH_Form_Fields::select_input( |
|
266 | + '_reg_status', |
|
267 | + $status, |
|
268 | + isset($this->_req_data['_reg_status']) |
|
269 | + ? strtoupper(sanitize_key($this->_req_data['_reg_status'])) |
|
270 | + : '' |
|
271 | + ); |
|
272 | + } |
|
273 | + if (isset($this->_req_data['event_id'])) { |
|
274 | + $filters[] = EEH_Form_Fields::hidden_input('event_id', $this->_req_data['event_id'], 'reg_event_id'); |
|
275 | + } |
|
276 | + return $filters; |
|
277 | + } |
|
278 | + |
|
279 | + |
|
280 | + /** |
|
281 | + * @return void |
|
282 | + * @throws EE_Error |
|
283 | + * @throws InvalidArgumentException |
|
284 | + * @throws InvalidDataTypeException |
|
285 | + * @throws InvalidInterfaceException |
|
286 | + * @throws ReflectionException |
|
287 | + */ |
|
288 | + protected function _add_view_counts() |
|
289 | + { |
|
290 | + $this->_views['all']['count'] = $this->_total_registrations(); |
|
291 | + $this->_views['month']['count'] = $this->_total_registrations_this_month(); |
|
292 | + $this->_views['today']['count'] = $this->_total_registrations_today(); |
|
293 | + if ($this->caps_handler->userCanTrashRegistrations()) { |
|
294 | + $this->_views['incomplete']['count'] = $this->_total_registrations('incomplete'); |
|
295 | + $this->_views['trash']['count'] = $this->_total_registrations('trash'); |
|
296 | + } |
|
297 | + } |
|
298 | + |
|
299 | + |
|
300 | + /** |
|
301 | + * @param string $view |
|
302 | + * @return int |
|
303 | + * @throws EE_Error |
|
304 | + * @throws ReflectionException |
|
305 | + */ |
|
306 | + protected function _total_registrations(string $view = ''): int |
|
307 | + { |
|
308 | + $_where = []; |
|
309 | + $EVT_ID = isset($this->_req_data['event_id']) |
|
310 | + ? absint($this->_req_data['event_id']) |
|
311 | + : false; |
|
312 | + if ($EVT_ID) { |
|
313 | + $_where['EVT_ID'] = $EVT_ID; |
|
314 | + } |
|
315 | + switch ($view) { |
|
316 | + case 'trash': |
|
317 | + return EEM_Registration::instance()->count_deleted([$_where]); |
|
318 | + case 'incomplete': |
|
319 | + $_where['STS_ID'] = EEM_Registration::status_id_incomplete; |
|
320 | + break; |
|
321 | + default: |
|
322 | + $_where['STS_ID'] = ['!=', EEM_Registration::status_id_incomplete]; |
|
323 | + } |
|
324 | + return EEM_Registration::instance()->count([$_where]); |
|
325 | + } |
|
326 | + |
|
327 | + |
|
328 | + /** |
|
329 | + * @return int |
|
330 | + * @throws EE_Error |
|
331 | + * @throws ReflectionException |
|
332 | + */ |
|
333 | + protected function _total_registrations_this_month(): int |
|
334 | + { |
|
335 | + $EVT_ID = isset($this->_req_data['event_id']) |
|
336 | + ? absint($this->_req_data['event_id']) |
|
337 | + : false; |
|
338 | + $_where = $EVT_ID |
|
339 | + ? ['EVT_ID' => $EVT_ID] |
|
340 | + : []; |
|
341 | + $this_year_r = date('Y', current_time('timestamp')); |
|
342 | + $time_start = ' 00:00:00'; |
|
343 | + $time_end = ' 23:59:59'; |
|
344 | + $this_month_r = date('m', current_time('timestamp')); |
|
345 | + $days_this_month = date('t', current_time('timestamp')); |
|
346 | + // setup date query. |
|
347 | + $beginning_string = EEM_Registration::instance()->convert_datetime_for_query( |
|
348 | + 'REG_date', |
|
349 | + $this_year_r . '-' . $this_month_r . '-01' . ' ' . $time_start, |
|
350 | + 'Y-m-d H:i:s' |
|
351 | + ); |
|
352 | + $end_string = EEM_Registration::instance()->convert_datetime_for_query( |
|
353 | + 'REG_date', |
|
354 | + $this_year_r . '-' . $this_month_r . '-' . $days_this_month . ' ' . $time_end, |
|
355 | + 'Y-m-d H:i:s' |
|
356 | + ); |
|
357 | + $_where['REG_date'] = [ |
|
358 | + 'BETWEEN', |
|
359 | + [ |
|
360 | + $beginning_string, |
|
361 | + $end_string, |
|
362 | + ], |
|
363 | + ]; |
|
364 | + $_where['STS_ID'] = ['!=', EEM_Registration::status_id_incomplete]; |
|
365 | + return EEM_Registration::instance()->count([$_where]); |
|
366 | + } |
|
367 | + |
|
368 | + |
|
369 | + /** |
|
370 | + * @return int |
|
371 | + * @throws EE_Error |
|
372 | + * @throws ReflectionException |
|
373 | + */ |
|
374 | + protected function _total_registrations_today(): int |
|
375 | + { |
|
376 | + $EVT_ID = isset($this->_req_data['event_id']) |
|
377 | + ? absint($this->_req_data['event_id']) |
|
378 | + : false; |
|
379 | + $_where = $EVT_ID |
|
380 | + ? ['EVT_ID' => $EVT_ID] |
|
381 | + : []; |
|
382 | + $current_date = date('Y-m-d', current_time('timestamp')); |
|
383 | + $time_start = ' 00:00:00'; |
|
384 | + $time_end = ' 23:59:59'; |
|
385 | + $_where['REG_date'] = [ |
|
386 | + 'BETWEEN', |
|
387 | + [ |
|
388 | + EEM_Registration::instance()->convert_datetime_for_query( |
|
389 | + 'REG_date', |
|
390 | + $current_date . $time_start, |
|
391 | + 'Y-m-d H:i:s' |
|
392 | + ), |
|
393 | + EEM_Registration::instance()->convert_datetime_for_query( |
|
394 | + 'REG_date', |
|
395 | + $current_date . $time_end, |
|
396 | + 'Y-m-d H:i:s' |
|
397 | + ), |
|
398 | + ], |
|
399 | + ]; |
|
400 | + $_where['STS_ID'] = ['!=', EEM_Registration::status_id_incomplete]; |
|
401 | + return EEM_Registration::instance()->count([$_where]); |
|
402 | + } |
|
403 | + |
|
404 | + |
|
405 | + /** |
|
406 | + * @param EE_Registration $item |
|
407 | + * @return string |
|
408 | + * @throws EE_Error |
|
409 | + * @throws InvalidArgumentException |
|
410 | + * @throws InvalidDataTypeException |
|
411 | + * @throws InvalidInterfaceException |
|
412 | + * @throws ReflectionException |
|
413 | + */ |
|
414 | + public function column_cb($item): string |
|
415 | + { |
|
416 | + /** checkbox/lock **/ |
|
417 | + $REG_ID = $item->ID(); |
|
418 | + $transaction = $item->get_first_related('Transaction'); |
|
419 | + $payment_count = $transaction instanceof EE_Transaction |
|
420 | + ? $transaction->count_related('Payment') |
|
421 | + : 0; |
|
422 | + |
|
423 | + $content = '<input type="checkbox" name="_REG_ID[]" value="' . $REG_ID . '" />'; |
|
424 | + $content .= $payment_count > 0 || ! $this->caps_handler->userCanEditRegistration($item) |
|
425 | + ? '<span class="ee-locked-entity dashicons dashicons-lock ee-aria-tooltip ee-aria-tooltip--big-box" |
|
426 | 426 | aria-label="' . $this->lockedRegMessage() . '"></span>' |
427 | - : ''; |
|
428 | - return $this->columnContent('cb', $content, 'center'); |
|
429 | - } |
|
430 | - |
|
431 | - |
|
432 | - private function lockedRegMessage(): string |
|
433 | - { |
|
434 | - return esc_html__( |
|
435 | - 'This lock-icon means that this registration cannot be trashed. Registrations that belong to a transaction that has payments cannot be trashed. If you wish to trash this registration then you must delete all payments attached to the related transaction first.', |
|
436 | - 'event_espresso' |
|
437 | - ); |
|
438 | - } |
|
439 | - |
|
440 | - |
|
441 | - /** |
|
442 | - * @param EE_Registration $registration |
|
443 | - * @return string |
|
444 | - * @throws EE_Error |
|
445 | - * @throws InvalidArgumentException |
|
446 | - * @throws InvalidDataTypeException |
|
447 | - * @throws InvalidInterfaceException |
|
448 | - * @throws ReflectionException |
|
449 | - */ |
|
450 | - public function column_id(EE_Registration $registration): string |
|
451 | - { |
|
452 | - $content = '<span class="ee-entity-id">' . $registration->ID() . '</span>'; |
|
453 | - $content .= '<span class="show-on-mobile-view-only">'; |
|
454 | - $content .= $this->column_ATT_fname($registration, false); |
|
455 | - $content .= '</span>'; |
|
456 | - |
|
457 | - return $this->columnContent('id', $content, 'end'); |
|
458 | - } |
|
459 | - |
|
460 | - |
|
461 | - /** |
|
462 | - * @param EE_Registration $registration |
|
463 | - * @param bool $prep_content |
|
464 | - * @return string |
|
465 | - * @throws EE_Error |
|
466 | - * @throws ReflectionException |
|
467 | - */ |
|
468 | - public function column_ATT_fname(EE_Registration $registration, bool $prep_content = true): string |
|
469 | - { |
|
470 | - |
|
471 | - $status = esc_attr($registration->status_ID()); |
|
472 | - $pretty_status = EEH_Template::pretty_status($status, false, 'sentence'); |
|
473 | - $prime_reg_star = $registration->count() === 1 |
|
474 | - ? '<sup><span class="dashicons dashicons-star-filled gold-icon"></span></sup>' |
|
475 | - : ''; |
|
476 | - |
|
477 | - $group_count = ' |
|
427 | + : ''; |
|
428 | + return $this->columnContent('cb', $content, 'center'); |
|
429 | + } |
|
430 | + |
|
431 | + |
|
432 | + private function lockedRegMessage(): string |
|
433 | + { |
|
434 | + return esc_html__( |
|
435 | + 'This lock-icon means that this registration cannot be trashed. Registrations that belong to a transaction that has payments cannot be trashed. If you wish to trash this registration then you must delete all payments attached to the related transaction first.', |
|
436 | + 'event_espresso' |
|
437 | + ); |
|
438 | + } |
|
439 | + |
|
440 | + |
|
441 | + /** |
|
442 | + * @param EE_Registration $registration |
|
443 | + * @return string |
|
444 | + * @throws EE_Error |
|
445 | + * @throws InvalidArgumentException |
|
446 | + * @throws InvalidDataTypeException |
|
447 | + * @throws InvalidInterfaceException |
|
448 | + * @throws ReflectionException |
|
449 | + */ |
|
450 | + public function column_id(EE_Registration $registration): string |
|
451 | + { |
|
452 | + $content = '<span class="ee-entity-id">' . $registration->ID() . '</span>'; |
|
453 | + $content .= '<span class="show-on-mobile-view-only">'; |
|
454 | + $content .= $this->column_ATT_fname($registration, false); |
|
455 | + $content .= '</span>'; |
|
456 | + |
|
457 | + return $this->columnContent('id', $content, 'end'); |
|
458 | + } |
|
459 | + |
|
460 | + |
|
461 | + /** |
|
462 | + * @param EE_Registration $registration |
|
463 | + * @param bool $prep_content |
|
464 | + * @return string |
|
465 | + * @throws EE_Error |
|
466 | + * @throws ReflectionException |
|
467 | + */ |
|
468 | + public function column_ATT_fname(EE_Registration $registration, bool $prep_content = true): string |
|
469 | + { |
|
470 | + |
|
471 | + $status = esc_attr($registration->status_ID()); |
|
472 | + $pretty_status = EEH_Template::pretty_status($status, false, 'sentence'); |
|
473 | + $prime_reg_star = $registration->count() === 1 |
|
474 | + ? '<sup><span class="dashicons dashicons-star-filled gold-icon"></span></sup>' |
|
475 | + : ''; |
|
476 | + |
|
477 | + $group_count = ' |
|
478 | 478 | <span class="reg-count-group-size" > |
479 | 479 | ' . sprintf( |
480 | - esc_html__('(%1$s / %2$s)', 'event_espresso'), |
|
481 | - $registration->count(), |
|
482 | - $registration->group_size() |
|
483 | - ) . ' |
|
480 | + esc_html__('(%1$s / %2$s)', 'event_espresso'), |
|
481 | + $registration->count(), |
|
482 | + $registration->group_size() |
|
483 | + ) . ' |
|
484 | 484 | </span >'; |
485 | 485 | |
486 | - $content = ' |
|
486 | + $content = ' |
|
487 | 487 | <div class="ee-layout-row"> |
488 | 488 | <span aria-label="' . $pretty_status . '" |
489 | 489 | class="ee-status-dot ee-status-bg--' . $status . ' ee-aria-tooltip" |
490 | 490 | ></span> |
491 | 491 | ' . $this->viewRegistrationLink($registration, $status) |
492 | - . $prime_reg_star |
|
493 | - . $group_count . ' |
|
492 | + . $prime_reg_star |
|
493 | + . $group_count . ' |
|
494 | 494 | <span class="spacer"></span> |
495 | 495 | <span> |
496 | 496 | ' . sprintf( |
497 | - esc_html__('Reg Code: %s', 'event_espresso'), |
|
498 | - $registration->get('REG_code') |
|
499 | - ) . ' |
|
497 | + esc_html__('Reg Code: %s', 'event_espresso'), |
|
498 | + $registration->get('REG_code') |
|
499 | + ) . ' |
|
500 | 500 | </span> |
501 | 501 | </div>'; |
502 | 502 | |
503 | - $url_params = ['_REG_ID' => $registration->ID()]; |
|
504 | - if (isset($this->_req_data['event_id'])) { |
|
505 | - $url_params['event_id'] = $registration->event_ID(); |
|
506 | - } |
|
507 | - // trash/restore/delete actions |
|
508 | - $actions = $this->trashRegistrationLink($registration, $url_params); |
|
509 | - $actions = $this->restoreRegistrationLink($registration, $url_params, $actions); |
|
510 | - $actions = $this->deleteRegistrationLink($registration, $url_params, $actions); |
|
511 | - |
|
512 | - $content = sprintf('%1$s %2$s', $content, $this->row_actions($actions)); |
|
513 | - |
|
514 | - return $prep_content ? $this->columnContent('ATT_fname', $content) : $content; |
|
515 | - } |
|
516 | - |
|
517 | - |
|
518 | - /** |
|
519 | - * @param EE_Registration $registration |
|
520 | - * @param bool $prep_content |
|
521 | - * @return string |
|
522 | - * @throws EE_Error |
|
523 | - * @throws ReflectionException |
|
524 | - */ |
|
525 | - public function column__REG_date(EE_Registration $registration, bool $prep_content = true): string |
|
526 | - { |
|
527 | - $this->_set_related_details($registration); |
|
528 | - // Build row actions |
|
529 | - $content = $this->caps_handler->userCanViewTransaction() |
|
530 | - ? '<a class="ee-aria-tooltip ee-status-color--' . $this->_transaction_details['status'] . '" href="' |
|
531 | - . $this->viewTransactionUrl() |
|
532 | - . '" aria-label="' |
|
533 | - . esc_attr($this->_transaction_details['title_attr']) |
|
534 | - . '">' |
|
535 | - . $registration->get_i18n_datetime('REG_date', 'M jS Y g:i a') |
|
536 | - . '</a>' |
|
537 | - : $registration->get_i18n_datetime('REG_date'); |
|
538 | - |
|
539 | - return $prep_content ? $this->columnContent('_REG_date', $content) : $content; |
|
540 | - } |
|
541 | - |
|
542 | - |
|
543 | - /** |
|
544 | - * @param EE_Registration $registration |
|
545 | - * @return string |
|
546 | - * @throws EE_Error |
|
547 | - * @throws InvalidArgumentException |
|
548 | - * @throws InvalidDataTypeException |
|
549 | - * @throws InvalidInterfaceException |
|
550 | - * @throws ReflectionException |
|
551 | - */ |
|
552 | - public function column_event_name(EE_Registration $registration): string |
|
553 | - { |
|
554 | - $this->_set_related_details($registration); |
|
555 | - $EVT_ID = $registration->event_ID(); |
|
556 | - $event_name = $registration->event_name(); |
|
557 | - $event_name = $event_name ?: esc_html__("No Associated Event", 'event_espresso'); |
|
558 | - $event_name = wp_trim_words($event_name, 30, '...'); |
|
559 | - $edit_event = $this->editEventLink($EVT_ID, $event_name); |
|
560 | - $actions['event_filter'] = $this->eventFilterLink($EVT_ID, $event_name); |
|
561 | - $content = sprintf('%1$s %2$s', $edit_event, $this->row_actions($actions)); |
|
562 | - |
|
563 | - return $this->columnContent('event_name', $content); |
|
564 | - } |
|
565 | - |
|
566 | - |
|
567 | - /** |
|
568 | - * @param EE_Registration $registration |
|
569 | - * @return string |
|
570 | - * @throws EE_Error |
|
571 | - * @throws InvalidArgumentException |
|
572 | - * @throws InvalidDataTypeException |
|
573 | - * @throws InvalidInterfaceException |
|
574 | - * @throws ReflectionException |
|
575 | - */ |
|
576 | - public function column_DTT_EVT_start(EE_Registration $registration): string |
|
577 | - { |
|
578 | - $datetime_strings = []; |
|
579 | - $ticket = $registration->ticket(); |
|
580 | - if ($ticket instanceof EE_Ticket) { |
|
581 | - $remove_defaults = ['default_where_conditions' => 'none']; |
|
582 | - $datetimes = $ticket->datetimes($remove_defaults); |
|
583 | - foreach ($datetimes as $datetime) { |
|
584 | - $datetime_strings[] = $datetime->get_i18n_datetime('DTT_EVT_start', 'M jS Y g:i a'); |
|
585 | - } |
|
586 | - $content = $this->generateDisplayForDatetimes($datetime_strings); |
|
587 | - } else { |
|
588 | - $content = esc_html__('There is no ticket on this registration', 'event_espresso'); |
|
589 | - } |
|
590 | - return $this->columnContent('DTT_EVT_start', $content); |
|
591 | - } |
|
592 | - |
|
593 | - |
|
594 | - /** |
|
595 | - * Receives an array of datetime strings to display and converts them to the html container for the column. |
|
596 | - * |
|
597 | - * @param array $datetime_strings |
|
598 | - * @return string |
|
599 | - */ |
|
600 | - public function generateDisplayForDatetimes(array $datetime_strings): string |
|
601 | - { |
|
602 | - // get first item for initial visibility |
|
603 | - $content = (string) array_shift($datetime_strings); |
|
604 | - if (! empty($datetime_strings)) { |
|
605 | - $content .= ' |
|
503 | + $url_params = ['_REG_ID' => $registration->ID()]; |
|
504 | + if (isset($this->_req_data['event_id'])) { |
|
505 | + $url_params['event_id'] = $registration->event_ID(); |
|
506 | + } |
|
507 | + // trash/restore/delete actions |
|
508 | + $actions = $this->trashRegistrationLink($registration, $url_params); |
|
509 | + $actions = $this->restoreRegistrationLink($registration, $url_params, $actions); |
|
510 | + $actions = $this->deleteRegistrationLink($registration, $url_params, $actions); |
|
511 | + |
|
512 | + $content = sprintf('%1$s %2$s', $content, $this->row_actions($actions)); |
|
513 | + |
|
514 | + return $prep_content ? $this->columnContent('ATT_fname', $content) : $content; |
|
515 | + } |
|
516 | + |
|
517 | + |
|
518 | + /** |
|
519 | + * @param EE_Registration $registration |
|
520 | + * @param bool $prep_content |
|
521 | + * @return string |
|
522 | + * @throws EE_Error |
|
523 | + * @throws ReflectionException |
|
524 | + */ |
|
525 | + public function column__REG_date(EE_Registration $registration, bool $prep_content = true): string |
|
526 | + { |
|
527 | + $this->_set_related_details($registration); |
|
528 | + // Build row actions |
|
529 | + $content = $this->caps_handler->userCanViewTransaction() |
|
530 | + ? '<a class="ee-aria-tooltip ee-status-color--' . $this->_transaction_details['status'] . '" href="' |
|
531 | + . $this->viewTransactionUrl() |
|
532 | + . '" aria-label="' |
|
533 | + . esc_attr($this->_transaction_details['title_attr']) |
|
534 | + . '">' |
|
535 | + . $registration->get_i18n_datetime('REG_date', 'M jS Y g:i a') |
|
536 | + . '</a>' |
|
537 | + : $registration->get_i18n_datetime('REG_date'); |
|
538 | + |
|
539 | + return $prep_content ? $this->columnContent('_REG_date', $content) : $content; |
|
540 | + } |
|
541 | + |
|
542 | + |
|
543 | + /** |
|
544 | + * @param EE_Registration $registration |
|
545 | + * @return string |
|
546 | + * @throws EE_Error |
|
547 | + * @throws InvalidArgumentException |
|
548 | + * @throws InvalidDataTypeException |
|
549 | + * @throws InvalidInterfaceException |
|
550 | + * @throws ReflectionException |
|
551 | + */ |
|
552 | + public function column_event_name(EE_Registration $registration): string |
|
553 | + { |
|
554 | + $this->_set_related_details($registration); |
|
555 | + $EVT_ID = $registration->event_ID(); |
|
556 | + $event_name = $registration->event_name(); |
|
557 | + $event_name = $event_name ?: esc_html__("No Associated Event", 'event_espresso'); |
|
558 | + $event_name = wp_trim_words($event_name, 30, '...'); |
|
559 | + $edit_event = $this->editEventLink($EVT_ID, $event_name); |
|
560 | + $actions['event_filter'] = $this->eventFilterLink($EVT_ID, $event_name); |
|
561 | + $content = sprintf('%1$s %2$s', $edit_event, $this->row_actions($actions)); |
|
562 | + |
|
563 | + return $this->columnContent('event_name', $content); |
|
564 | + } |
|
565 | + |
|
566 | + |
|
567 | + /** |
|
568 | + * @param EE_Registration $registration |
|
569 | + * @return string |
|
570 | + * @throws EE_Error |
|
571 | + * @throws InvalidArgumentException |
|
572 | + * @throws InvalidDataTypeException |
|
573 | + * @throws InvalidInterfaceException |
|
574 | + * @throws ReflectionException |
|
575 | + */ |
|
576 | + public function column_DTT_EVT_start(EE_Registration $registration): string |
|
577 | + { |
|
578 | + $datetime_strings = []; |
|
579 | + $ticket = $registration->ticket(); |
|
580 | + if ($ticket instanceof EE_Ticket) { |
|
581 | + $remove_defaults = ['default_where_conditions' => 'none']; |
|
582 | + $datetimes = $ticket->datetimes($remove_defaults); |
|
583 | + foreach ($datetimes as $datetime) { |
|
584 | + $datetime_strings[] = $datetime->get_i18n_datetime('DTT_EVT_start', 'M jS Y g:i a'); |
|
585 | + } |
|
586 | + $content = $this->generateDisplayForDatetimes($datetime_strings); |
|
587 | + } else { |
|
588 | + $content = esc_html__('There is no ticket on this registration', 'event_espresso'); |
|
589 | + } |
|
590 | + return $this->columnContent('DTT_EVT_start', $content); |
|
591 | + } |
|
592 | + |
|
593 | + |
|
594 | + /** |
|
595 | + * Receives an array of datetime strings to display and converts them to the html container for the column. |
|
596 | + * |
|
597 | + * @param array $datetime_strings |
|
598 | + * @return string |
|
599 | + */ |
|
600 | + public function generateDisplayForDatetimes(array $datetime_strings): string |
|
601 | + { |
|
602 | + // get first item for initial visibility |
|
603 | + $content = (string) array_shift($datetime_strings); |
|
604 | + if (! empty($datetime_strings)) { |
|
605 | + $content .= ' |
|
606 | 606 | <div class="ee-registration-event-datetimes-container-wrap"> |
607 | 607 | <button aria-label="' . esc_attr__('Click to view all dates', 'event_espresso') . '" |
608 | 608 | class="ee-aria-tooltip button button--secondary button--tiny button--icon-only ee-js ee-more-datetimes-toggle" |
@@ -613,539 +613,539 @@ discard block |
||
613 | 613 | ' . implode("", $datetime_strings) . ' |
614 | 614 | </div> |
615 | 615 | </div>'; |
616 | - } |
|
617 | - return $content; |
|
618 | - } |
|
619 | - |
|
620 | - |
|
621 | - /** |
|
622 | - * @param EE_Registration $registration |
|
623 | - * @return string |
|
624 | - * @throws EE_Error |
|
625 | - * @throws InvalidArgumentException |
|
626 | - * @throws InvalidDataTypeException |
|
627 | - * @throws InvalidInterfaceException |
|
628 | - * @throws ReflectionException |
|
629 | - */ |
|
630 | - public function column_ATT_email(EE_Registration $registration): string |
|
631 | - { |
|
632 | - $attendee = $registration->get_first_related('Attendee'); |
|
633 | - $content = ! $attendee instanceof EE_Attendee |
|
634 | - ? esc_html__('No attached contact record.', 'event_espresso') |
|
635 | - : $attendee->email(); |
|
636 | - return $this->columnContent('ATT_email', $content); |
|
637 | - } |
|
638 | - |
|
639 | - |
|
640 | - /** |
|
641 | - * @param EE_Registration $registration |
|
642 | - * @return string |
|
643 | - */ |
|
644 | - public function column__REG_count(EE_Registration $registration): string |
|
645 | - { |
|
646 | - $content = |
|
647 | - sprintf(esc_html__('%1$s / %2$s', 'event_espresso'), $registration->count(), $registration->group_size()); |
|
648 | - return $this->columnContent('_REG_count', $content); |
|
649 | - } |
|
650 | - |
|
651 | - |
|
652 | - /** |
|
653 | - * @param EE_Registration $registration |
|
654 | - * @return string |
|
655 | - * @throws EE_Error |
|
656 | - * @throws ReflectionException |
|
657 | - */ |
|
658 | - public function column_PRC_amount(EE_Registration $registration): string |
|
659 | - { |
|
660 | - $ticket = $registration->ticket(); |
|
661 | - $req_data = $this->_admin_page->get_request_data(); |
|
662 | - |
|
663 | - $content = isset($req_data['event_id']) && $ticket instanceof EE_Ticket |
|
664 | - ? '<div class="TKT_name">' . $ticket->name() . '</div>' |
|
665 | - : ''; |
|
666 | - |
|
667 | - $payment_status = $registration->owes_monies_and_can_pay() ? 'TFL' : 'TCM'; |
|
668 | - $content .= $registration->final_price() > 0 |
|
669 | - ? '<span class="reg-overview-paid-event-spn ee-status-color--' . $payment_status . '"> |
|
616 | + } |
|
617 | + return $content; |
|
618 | + } |
|
619 | + |
|
620 | + |
|
621 | + /** |
|
622 | + * @param EE_Registration $registration |
|
623 | + * @return string |
|
624 | + * @throws EE_Error |
|
625 | + * @throws InvalidArgumentException |
|
626 | + * @throws InvalidDataTypeException |
|
627 | + * @throws InvalidInterfaceException |
|
628 | + * @throws ReflectionException |
|
629 | + */ |
|
630 | + public function column_ATT_email(EE_Registration $registration): string |
|
631 | + { |
|
632 | + $attendee = $registration->get_first_related('Attendee'); |
|
633 | + $content = ! $attendee instanceof EE_Attendee |
|
634 | + ? esc_html__('No attached contact record.', 'event_espresso') |
|
635 | + : $attendee->email(); |
|
636 | + return $this->columnContent('ATT_email', $content); |
|
637 | + } |
|
638 | + |
|
639 | + |
|
640 | + /** |
|
641 | + * @param EE_Registration $registration |
|
642 | + * @return string |
|
643 | + */ |
|
644 | + public function column__REG_count(EE_Registration $registration): string |
|
645 | + { |
|
646 | + $content = |
|
647 | + sprintf(esc_html__('%1$s / %2$s', 'event_espresso'), $registration->count(), $registration->group_size()); |
|
648 | + return $this->columnContent('_REG_count', $content); |
|
649 | + } |
|
650 | + |
|
651 | + |
|
652 | + /** |
|
653 | + * @param EE_Registration $registration |
|
654 | + * @return string |
|
655 | + * @throws EE_Error |
|
656 | + * @throws ReflectionException |
|
657 | + */ |
|
658 | + public function column_PRC_amount(EE_Registration $registration): string |
|
659 | + { |
|
660 | + $ticket = $registration->ticket(); |
|
661 | + $req_data = $this->_admin_page->get_request_data(); |
|
662 | + |
|
663 | + $content = isset($req_data['event_id']) && $ticket instanceof EE_Ticket |
|
664 | + ? '<div class="TKT_name">' . $ticket->name() . '</div>' |
|
665 | + : ''; |
|
666 | + |
|
667 | + $payment_status = $registration->owes_monies_and_can_pay() ? 'TFL' : 'TCM'; |
|
668 | + $content .= $registration->final_price() > 0 |
|
669 | + ? '<span class="reg-overview-paid-event-spn ee-status-color--' . $payment_status . '"> |
|
670 | 670 | ' . $registration->pretty_final_price() . ' |
671 | 671 | </span>' |
672 | - // free event |
|
673 | - : '<span class="reg-overview-free-event-spn">' . esc_html__('free', 'event_espresso') . '</span>'; |
|
674 | - |
|
675 | - return $this->columnContent('PRC_amount', $content, 'end'); |
|
676 | - } |
|
677 | - |
|
678 | - |
|
679 | - /** |
|
680 | - * @param EE_Registration $registration |
|
681 | - * @return string |
|
682 | - * @throws EE_Error |
|
683 | - * @throws ReflectionException |
|
684 | - */ |
|
685 | - public function column__REG_final_price(EE_Registration $registration): string |
|
686 | - { |
|
687 | - $ticket = $registration->ticket(); |
|
688 | - $req_data = $this->_admin_page->get_request_data(); |
|
689 | - $content = isset($req_data['event_id']) || ! $ticket instanceof EE_Ticket |
|
690 | - ? '' |
|
691 | - : '<span class="TKT_name ee-status-color--' |
|
692 | - . $ticket->ticket_status() |
|
693 | - . '">' |
|
694 | - . $ticket->name() |
|
695 | - . '</span> '; |
|
696 | - |
|
697 | - $content .= ' |
|
672 | + // free event |
|
673 | + : '<span class="reg-overview-free-event-spn">' . esc_html__('free', 'event_espresso') . '</span>'; |
|
674 | + |
|
675 | + return $this->columnContent('PRC_amount', $content, 'end'); |
|
676 | + } |
|
677 | + |
|
678 | + |
|
679 | + /** |
|
680 | + * @param EE_Registration $registration |
|
681 | + * @return string |
|
682 | + * @throws EE_Error |
|
683 | + * @throws ReflectionException |
|
684 | + */ |
|
685 | + public function column__REG_final_price(EE_Registration $registration): string |
|
686 | + { |
|
687 | + $ticket = $registration->ticket(); |
|
688 | + $req_data = $this->_admin_page->get_request_data(); |
|
689 | + $content = isset($req_data['event_id']) || ! $ticket instanceof EE_Ticket |
|
690 | + ? '' |
|
691 | + : '<span class="TKT_name ee-status-color--' |
|
692 | + . $ticket->ticket_status() |
|
693 | + . '">' |
|
694 | + . $ticket->name() |
|
695 | + . '</span> '; |
|
696 | + |
|
697 | + $content .= ' |
|
698 | 698 | <span class="reg-overview-paid-event-spn"> |
699 | 699 | ' . $registration->pretty_final_price() . ' |
700 | 700 | </span>'; |
701 | - return $this->columnContent('_REG_final_price', $content, 'end'); |
|
702 | - } |
|
703 | - |
|
704 | - |
|
705 | - /** |
|
706 | - * @param EE_Registration $registration |
|
707 | - * @return string |
|
708 | - * @throws EE_Error |
|
709 | - */ |
|
710 | - public function column__REG_paid(EE_Registration $registration): string |
|
711 | - { |
|
712 | - $payment_method = $registration->payment_method(); |
|
713 | - $payment_method_name = $payment_method instanceof EE_Payment_Method |
|
714 | - ? $payment_method->admin_name() |
|
715 | - : esc_html__('Unknown', 'event_espresso'); |
|
716 | - |
|
717 | - $payment_status = $registration->owes_monies_and_can_pay() ? 'TFL' : 'TCM'; |
|
718 | - $content = ' |
|
701 | + return $this->columnContent('_REG_final_price', $content, 'end'); |
|
702 | + } |
|
703 | + |
|
704 | + |
|
705 | + /** |
|
706 | + * @param EE_Registration $registration |
|
707 | + * @return string |
|
708 | + * @throws EE_Error |
|
709 | + */ |
|
710 | + public function column__REG_paid(EE_Registration $registration): string |
|
711 | + { |
|
712 | + $payment_method = $registration->payment_method(); |
|
713 | + $payment_method_name = $payment_method instanceof EE_Payment_Method |
|
714 | + ? $payment_method->admin_name() |
|
715 | + : esc_html__('Unknown', 'event_espresso'); |
|
716 | + |
|
717 | + $payment_status = $registration->owes_monies_and_can_pay() ? 'TFL' : 'TCM'; |
|
718 | + $content = ' |
|
719 | 719 | <span class="reg-overview-paid-event-spn ee-status-color--' . $payment_status . '"> |
720 | 720 | ' . $registration->pretty_paid() . ' |
721 | 721 | </span>'; |
722 | - if ($registration->paid() > 0) { |
|
723 | - $content .= '<span class="ee-status-text-small">' |
|
724 | - . sprintf( |
|
725 | - esc_html__('...via %s', 'event_espresso'), |
|
726 | - $payment_method_name |
|
727 | - ) |
|
728 | - . '</span>'; |
|
729 | - } |
|
730 | - return $this->columnContent('_REG_paid', $content, 'end'); |
|
731 | - } |
|
732 | - |
|
733 | - |
|
734 | - /** |
|
735 | - * @param EE_Registration $registration |
|
736 | - * @return string |
|
737 | - * @throws EE_Error |
|
738 | - * @throws EntityNotFoundException |
|
739 | - * @throws InvalidArgumentException |
|
740 | - * @throws InvalidDataTypeException |
|
741 | - * @throws InvalidInterfaceException |
|
742 | - * @throws ReflectionException |
|
743 | - */ |
|
744 | - public function column_TXN_total(EE_Registration $registration): string |
|
745 | - { |
|
746 | - if ($registration->transaction()) { |
|
747 | - $content = $this->caps_handler->userCanViewTransaction() |
|
748 | - ? ' |
|
722 | + if ($registration->paid() > 0) { |
|
723 | + $content .= '<span class="ee-status-text-small">' |
|
724 | + . sprintf( |
|
725 | + esc_html__('...via %s', 'event_espresso'), |
|
726 | + $payment_method_name |
|
727 | + ) |
|
728 | + . '</span>'; |
|
729 | + } |
|
730 | + return $this->columnContent('_REG_paid', $content, 'end'); |
|
731 | + } |
|
732 | + |
|
733 | + |
|
734 | + /** |
|
735 | + * @param EE_Registration $registration |
|
736 | + * @return string |
|
737 | + * @throws EE_Error |
|
738 | + * @throws EntityNotFoundException |
|
739 | + * @throws InvalidArgumentException |
|
740 | + * @throws InvalidDataTypeException |
|
741 | + * @throws InvalidInterfaceException |
|
742 | + * @throws ReflectionException |
|
743 | + */ |
|
744 | + public function column_TXN_total(EE_Registration $registration): string |
|
745 | + { |
|
746 | + if ($registration->transaction()) { |
|
747 | + $content = $this->caps_handler->userCanViewTransaction() |
|
748 | + ? ' |
|
749 | 749 | <a class="ee-aria-tooltip ee-status-color--' . $registration->transaction()->status_ID() . '" |
750 | 750 | href="' . $this->viewTransactionUrl() . '" |
751 | 751 | aria-label="' . esc_attr__('View Transaction', 'event_espresso') . '" |
752 | 752 | > |
753 | 753 | ' . $registration->transaction()->pretty_total() . ' |
754 | 754 | </a>' |
755 | - : $registration->transaction()->pretty_total(); |
|
756 | - } else { |
|
757 | - $content = esc_html__("None", "event_espresso"); |
|
758 | - } |
|
759 | - return $this->columnContent('TXN_total', $content, 'end'); |
|
760 | - } |
|
761 | - |
|
762 | - |
|
763 | - /** |
|
764 | - * @param EE_Registration $registration |
|
765 | - * @return string |
|
766 | - * @throws EE_Error |
|
767 | - * @throws EntityNotFoundException |
|
768 | - * @throws InvalidArgumentException |
|
769 | - * @throws InvalidDataTypeException |
|
770 | - * @throws InvalidInterfaceException |
|
771 | - * @throws ReflectionException |
|
772 | - */ |
|
773 | - public function column_TXN_paid(EE_Registration $registration): string |
|
774 | - { |
|
775 | - $content = ' '; |
|
776 | - $align = 'end'; |
|
777 | - if ($registration->count() === 1) { |
|
778 | - $transaction = $registration->transaction() |
|
779 | - ? $registration->transaction() |
|
780 | - : EE_Transaction::new_instance(); |
|
781 | - if ($transaction->paid() >= $transaction->total()) { |
|
782 | - $align = 'center'; |
|
783 | - $content = '<span class="dashicons dashicons-yes green-icon"></span>'; |
|
784 | - } else { |
|
785 | - $content = $this->caps_handler->userCanViewTransaction() |
|
786 | - ? ' |
|
755 | + : $registration->transaction()->pretty_total(); |
|
756 | + } else { |
|
757 | + $content = esc_html__("None", "event_espresso"); |
|
758 | + } |
|
759 | + return $this->columnContent('TXN_total', $content, 'end'); |
|
760 | + } |
|
761 | + |
|
762 | + |
|
763 | + /** |
|
764 | + * @param EE_Registration $registration |
|
765 | + * @return string |
|
766 | + * @throws EE_Error |
|
767 | + * @throws EntityNotFoundException |
|
768 | + * @throws InvalidArgumentException |
|
769 | + * @throws InvalidDataTypeException |
|
770 | + * @throws InvalidInterfaceException |
|
771 | + * @throws ReflectionException |
|
772 | + */ |
|
773 | + public function column_TXN_paid(EE_Registration $registration): string |
|
774 | + { |
|
775 | + $content = ' '; |
|
776 | + $align = 'end'; |
|
777 | + if ($registration->count() === 1) { |
|
778 | + $transaction = $registration->transaction() |
|
779 | + ? $registration->transaction() |
|
780 | + : EE_Transaction::new_instance(); |
|
781 | + if ($transaction->paid() >= $transaction->total()) { |
|
782 | + $align = 'center'; |
|
783 | + $content = '<span class="dashicons dashicons-yes green-icon"></span>'; |
|
784 | + } else { |
|
785 | + $content = $this->caps_handler->userCanViewTransaction() |
|
786 | + ? ' |
|
787 | 787 | <a class="ee-aria-tooltip ee-status-color--' . $transaction->status_ID() . '" |
788 | 788 | href="' . $this->viewTransactionUrl() . '" |
789 | 789 | aria-label="' . esc_attr__('View Transaction', 'event_espresso') . '" |
790 | 790 | > |
791 | 791 | ' . $registration->transaction()->pretty_paid() . ' |
792 | 792 | </a>' |
793 | - : $registration->transaction()->pretty_paid(); |
|
794 | - } |
|
795 | - } |
|
796 | - return $this->columnContent('TXN_paid', $content, $align); |
|
797 | - } |
|
798 | - |
|
799 | - |
|
800 | - /** |
|
801 | - * @param EE_Registration $registration |
|
802 | - * @return string |
|
803 | - * @throws EE_Error |
|
804 | - * @throws InvalidArgumentException |
|
805 | - * @throws InvalidDataTypeException |
|
806 | - * @throws InvalidInterfaceException |
|
807 | - * @throws ReflectionException |
|
808 | - */ |
|
809 | - public function column_actions(EE_Registration $registration): string |
|
810 | - { |
|
811 | - $attendee = $registration->attendee(); |
|
812 | - $this->_set_related_details($registration); |
|
813 | - |
|
814 | - // Build and filter row actions |
|
815 | - $actions = apply_filters( |
|
816 | - 'FHEE__EE_Registrations_List_Table__column_actions__actions', |
|
817 | - [ |
|
818 | - 'view_lnk' => $this->viewRegistrationAction($registration), |
|
819 | - 'edit_lnk' => $this->editContactAction($registration, $attendee), |
|
820 | - 'resend_reg_lnk' => $this->resendRegistrationMessageAction($registration, $attendee), |
|
821 | - 'view_txn_lnk' => $this->viewTransactionAction(), |
|
822 | - 'dl_invoice_lnk' => $this->viewTransactionInvoiceAction($registration, $attendee), |
|
823 | - 'filtered_messages_link' => $this->viewNotificationsAction($registration), |
|
824 | - ], |
|
825 | - $registration, |
|
826 | - $this |
|
827 | - ); |
|
828 | - |
|
829 | - $content = $this->_action_string( |
|
830 | - implode('', $actions), |
|
831 | - $registration, |
|
832 | - 'div', |
|
833 | - 'reg-overview-actions ee-list-table-actions' |
|
834 | - ); |
|
835 | - |
|
836 | - return $this->columnContent('actions', $this->actionsModalMenu($content)); |
|
837 | - } |
|
838 | - |
|
839 | - |
|
840 | - /** |
|
841 | - * @throws EE_Error |
|
842 | - * @throws ReflectionException |
|
843 | - */ |
|
844 | - private function viewRegistrationUrl(EE_Registration $registration): string |
|
845 | - { |
|
846 | - return EE_Admin_Page::add_query_args_and_nonce( |
|
847 | - [ |
|
848 | - 'action' => 'view_registration', |
|
849 | - '_REG_ID' => $registration->ID(), |
|
850 | - ], |
|
851 | - REG_ADMIN_URL |
|
852 | - ); |
|
853 | - } |
|
854 | - |
|
855 | - |
|
856 | - /** |
|
857 | - * @throws EE_Error |
|
858 | - * @throws ReflectionException |
|
859 | - */ |
|
860 | - private function viewRegistrationLink( |
|
861 | - EE_Registration $registration, |
|
862 | - string $status |
|
863 | - ): string { |
|
864 | - $attendee = $registration->attendee(); |
|
865 | - $attendee_name = $attendee instanceof EE_Attendee |
|
866 | - ? $attendee->full_name() |
|
867 | - : ''; |
|
868 | - return $this->caps_handler->userCanReadRegistration($registration) |
|
869 | - ? ' |
|
793 | + : $registration->transaction()->pretty_paid(); |
|
794 | + } |
|
795 | + } |
|
796 | + return $this->columnContent('TXN_paid', $content, $align); |
|
797 | + } |
|
798 | + |
|
799 | + |
|
800 | + /** |
|
801 | + * @param EE_Registration $registration |
|
802 | + * @return string |
|
803 | + * @throws EE_Error |
|
804 | + * @throws InvalidArgumentException |
|
805 | + * @throws InvalidDataTypeException |
|
806 | + * @throws InvalidInterfaceException |
|
807 | + * @throws ReflectionException |
|
808 | + */ |
|
809 | + public function column_actions(EE_Registration $registration): string |
|
810 | + { |
|
811 | + $attendee = $registration->attendee(); |
|
812 | + $this->_set_related_details($registration); |
|
813 | + |
|
814 | + // Build and filter row actions |
|
815 | + $actions = apply_filters( |
|
816 | + 'FHEE__EE_Registrations_List_Table__column_actions__actions', |
|
817 | + [ |
|
818 | + 'view_lnk' => $this->viewRegistrationAction($registration), |
|
819 | + 'edit_lnk' => $this->editContactAction($registration, $attendee), |
|
820 | + 'resend_reg_lnk' => $this->resendRegistrationMessageAction($registration, $attendee), |
|
821 | + 'view_txn_lnk' => $this->viewTransactionAction(), |
|
822 | + 'dl_invoice_lnk' => $this->viewTransactionInvoiceAction($registration, $attendee), |
|
823 | + 'filtered_messages_link' => $this->viewNotificationsAction($registration), |
|
824 | + ], |
|
825 | + $registration, |
|
826 | + $this |
|
827 | + ); |
|
828 | + |
|
829 | + $content = $this->_action_string( |
|
830 | + implode('', $actions), |
|
831 | + $registration, |
|
832 | + 'div', |
|
833 | + 'reg-overview-actions ee-list-table-actions' |
|
834 | + ); |
|
835 | + |
|
836 | + return $this->columnContent('actions', $this->actionsModalMenu($content)); |
|
837 | + } |
|
838 | + |
|
839 | + |
|
840 | + /** |
|
841 | + * @throws EE_Error |
|
842 | + * @throws ReflectionException |
|
843 | + */ |
|
844 | + private function viewRegistrationUrl(EE_Registration $registration): string |
|
845 | + { |
|
846 | + return EE_Admin_Page::add_query_args_and_nonce( |
|
847 | + [ |
|
848 | + 'action' => 'view_registration', |
|
849 | + '_REG_ID' => $registration->ID(), |
|
850 | + ], |
|
851 | + REG_ADMIN_URL |
|
852 | + ); |
|
853 | + } |
|
854 | + |
|
855 | + |
|
856 | + /** |
|
857 | + * @throws EE_Error |
|
858 | + * @throws ReflectionException |
|
859 | + */ |
|
860 | + private function viewRegistrationLink( |
|
861 | + EE_Registration $registration, |
|
862 | + string $status |
|
863 | + ): string { |
|
864 | + $attendee = $registration->attendee(); |
|
865 | + $attendee_name = $attendee instanceof EE_Attendee |
|
866 | + ? $attendee->full_name() |
|
867 | + : ''; |
|
868 | + return $this->caps_handler->userCanReadRegistration($registration) |
|
869 | + ? ' |
|
870 | 870 | <a href="' . $this->viewRegistrationUrl($registration) . '" |
871 | 871 | class="row-title ee-status-color--' . $status . ' ee-aria-tooltip" |
872 | 872 | aria-label="' . esc_attr__('View Registration Details', 'event_espresso') . '" |
873 | 873 | > |
874 | 874 | ' . $attendee_name . ' |
875 | 875 | </a>' |
876 | - : $attendee_name; |
|
877 | - } |
|
878 | - |
|
879 | - |
|
880 | - /** |
|
881 | - * @throws EE_Error |
|
882 | - * @throws ReflectionException |
|
883 | - */ |
|
884 | - private function viewRegistrationAction(EE_Registration $registration): string |
|
885 | - { |
|
886 | - return $this->caps_handler->userCanReadRegistration($registration) |
|
887 | - ? ' |
|
876 | + : $attendee_name; |
|
877 | + } |
|
878 | + |
|
879 | + |
|
880 | + /** |
|
881 | + * @throws EE_Error |
|
882 | + * @throws ReflectionException |
|
883 | + */ |
|
884 | + private function viewRegistrationAction(EE_Registration $registration): string |
|
885 | + { |
|
886 | + return $this->caps_handler->userCanReadRegistration($registration) |
|
887 | + ? ' |
|
888 | 888 | <a href="' . $this->viewRegistrationUrl($registration) . '" |
889 | 889 | class="ee-aria-tooltip button button--icon-only" |
890 | 890 | aria-label="' . esc_attr__('View Registration Details', 'event_espresso') . '" |
891 | 891 | > |
892 | 892 | <span class="dashicons dashicons-clipboard"></span> |
893 | 893 | </a>' |
894 | - : ''; |
|
895 | - } |
|
896 | - |
|
897 | - |
|
898 | - private function editContactAction(EE_Registration $registration, ?EE_Attendee $attendee = null): string |
|
899 | - { |
|
900 | - |
|
901 | - if ($attendee instanceof EE_Attendee && $this->caps_handler->userCanEditContacts()) { |
|
902 | - $edit_link_url = EE_Admin_Page::add_query_args_and_nonce( |
|
903 | - [ |
|
904 | - 'action' => 'edit_attendee', |
|
905 | - 'post' => $registration->attendee_ID(), |
|
906 | - ], |
|
907 | - REG_ADMIN_URL |
|
908 | - ); |
|
909 | - return ' |
|
894 | + : ''; |
|
895 | + } |
|
896 | + |
|
897 | + |
|
898 | + private function editContactAction(EE_Registration $registration, ?EE_Attendee $attendee = null): string |
|
899 | + { |
|
900 | + |
|
901 | + if ($attendee instanceof EE_Attendee && $this->caps_handler->userCanEditContacts()) { |
|
902 | + $edit_link_url = EE_Admin_Page::add_query_args_and_nonce( |
|
903 | + [ |
|
904 | + 'action' => 'edit_attendee', |
|
905 | + 'post' => $registration->attendee_ID(), |
|
906 | + ], |
|
907 | + REG_ADMIN_URL |
|
908 | + ); |
|
909 | + return ' |
|
910 | 910 | <a href="' . $edit_link_url . '" |
911 | 911 | aria-label="' . esc_attr__('Edit Contact Details', 'event_espresso') . '" |
912 | 912 | class="ee-aria-tooltip button button--secondary button--icon-only" |
913 | 913 | > |
914 | 914 | <span class="dashicons dashicons-admin-users"></span> |
915 | 915 | </a>'; |
916 | - } |
|
917 | - return ''; |
|
918 | - } |
|
919 | - |
|
920 | - |
|
921 | - /** |
|
922 | - * @throws EE_Error |
|
923 | - * @throws ReflectionException |
|
924 | - */ |
|
925 | - private function resendRegistrationMessageAction( |
|
926 | - EE_Registration $registration, |
|
927 | - ?EE_Attendee $attendee = null |
|
928 | - ): string { |
|
929 | - if ($attendee instanceof EE_Attendee && $this->caps_handler->userCanResendMessage($registration)) { |
|
930 | - $resend_reg_link_url = EE_Admin_Page::add_query_args_and_nonce( |
|
931 | - [ |
|
932 | - 'action' => 'resend_registration', |
|
933 | - '_REG_ID' => $registration->ID(), |
|
934 | - ], |
|
935 | - REG_ADMIN_URL, |
|
936 | - true |
|
937 | - ); |
|
938 | - return ' |
|
916 | + } |
|
917 | + return ''; |
|
918 | + } |
|
919 | + |
|
920 | + |
|
921 | + /** |
|
922 | + * @throws EE_Error |
|
923 | + * @throws ReflectionException |
|
924 | + */ |
|
925 | + private function resendRegistrationMessageAction( |
|
926 | + EE_Registration $registration, |
|
927 | + ?EE_Attendee $attendee = null |
|
928 | + ): string { |
|
929 | + if ($attendee instanceof EE_Attendee && $this->caps_handler->userCanResendMessage($registration)) { |
|
930 | + $resend_reg_link_url = EE_Admin_Page::add_query_args_and_nonce( |
|
931 | + [ |
|
932 | + 'action' => 'resend_registration', |
|
933 | + '_REG_ID' => $registration->ID(), |
|
934 | + ], |
|
935 | + REG_ADMIN_URL, |
|
936 | + true |
|
937 | + ); |
|
938 | + return ' |
|
939 | 939 | <a href="' . $resend_reg_link_url . '" aria-label="' |
940 | - . esc_attr__('Resend Registration Details', 'event_espresso') |
|
941 | - . '" class="ee-aria-tooltip button button--icon-only"> |
|
940 | + . esc_attr__('Resend Registration Details', 'event_espresso') |
|
941 | + . '" class="ee-aria-tooltip button button--icon-only"> |
|
942 | 942 | <span class="dashicons dashicons-email-alt"></span> |
943 | 943 | </a>'; |
944 | - } |
|
945 | - return ''; |
|
946 | - } |
|
947 | - |
|
948 | - |
|
949 | - private function viewTransactionUrl(): string |
|
950 | - { |
|
951 | - return EE_Admin_Page::add_query_args_and_nonce( |
|
952 | - [ |
|
953 | - 'action' => 'view_transaction', |
|
954 | - 'TXN_ID' => $this->_transaction_details['id'], |
|
955 | - ], |
|
956 | - TXN_ADMIN_URL |
|
957 | - ); |
|
958 | - } |
|
959 | - |
|
960 | - |
|
961 | - private function viewTransactionAction(): string |
|
962 | - { |
|
963 | - if ($this->caps_handler->userCanViewTransaction()) { |
|
964 | - return ' |
|
944 | + } |
|
945 | + return ''; |
|
946 | + } |
|
947 | + |
|
948 | + |
|
949 | + private function viewTransactionUrl(): string |
|
950 | + { |
|
951 | + return EE_Admin_Page::add_query_args_and_nonce( |
|
952 | + [ |
|
953 | + 'action' => 'view_transaction', |
|
954 | + 'TXN_ID' => $this->_transaction_details['id'], |
|
955 | + ], |
|
956 | + TXN_ADMIN_URL |
|
957 | + ); |
|
958 | + } |
|
959 | + |
|
960 | + |
|
961 | + private function viewTransactionAction(): string |
|
962 | + { |
|
963 | + if ($this->caps_handler->userCanViewTransaction()) { |
|
964 | + return ' |
|
965 | 965 | <a class="ee-aria-tooltip button button--icon-only" |
966 | 966 | href="' . $this->viewTransactionUrl() . '" |
967 | 967 | aria-label="' . $this->_transaction_details['title_attr'] . '" |
968 | 968 | > |
969 | 969 | <span class="dashicons dashicons-cart"></span> |
970 | 970 | </a>'; |
971 | - } |
|
972 | - return ''; |
|
973 | - } |
|
974 | - |
|
975 | - |
|
976 | - /** |
|
977 | - * @throws EE_Error |
|
978 | - * @throws ReflectionException |
|
979 | - */ |
|
980 | - private function viewTransactionInvoiceAction( |
|
981 | - EE_Registration $registration, |
|
982 | - ?EE_Attendee $attendee = null |
|
983 | - ): string { |
|
984 | - // only show invoice link if message type is active. |
|
985 | - if ( |
|
986 | - $attendee instanceof EE_Attendee |
|
987 | - && $registration->is_primary_registrant() |
|
988 | - && EEH_MSG_Template::is_mt_active('invoice') |
|
989 | - ) { |
|
990 | - return ' |
|
971 | + } |
|
972 | + return ''; |
|
973 | + } |
|
974 | + |
|
975 | + |
|
976 | + /** |
|
977 | + * @throws EE_Error |
|
978 | + * @throws ReflectionException |
|
979 | + */ |
|
980 | + private function viewTransactionInvoiceAction( |
|
981 | + EE_Registration $registration, |
|
982 | + ?EE_Attendee $attendee = null |
|
983 | + ): string { |
|
984 | + // only show invoice link if message type is active. |
|
985 | + if ( |
|
986 | + $attendee instanceof EE_Attendee |
|
987 | + && $registration->is_primary_registrant() |
|
988 | + && EEH_MSG_Template::is_mt_active('invoice') |
|
989 | + ) { |
|
990 | + return ' |
|
991 | 991 | <a aria-label="' . esc_attr__('View Transaction Invoice', 'event_espresso') |
992 | - . '" target="_blank" href="' . $registration->invoice_url() . '" class="ee-aria-tooltip button button--icon-only"> |
|
992 | + . '" target="_blank" href="' . $registration->invoice_url() . '" class="ee-aria-tooltip button button--icon-only"> |
|
993 | 993 | <span class="dashicons dashicons-media-spreadsheet"></span> |
994 | 994 | </a>'; |
995 | - } |
|
996 | - return ''; |
|
997 | - } |
|
998 | - |
|
999 | - |
|
1000 | - /** |
|
1001 | - * @throws ReflectionException |
|
1002 | - * @throws EE_Error |
|
1003 | - */ |
|
1004 | - private function viewNotificationsAction(EE_Registration $registration): string |
|
1005 | - { |
|
1006 | - // message list table link (filtered by REG_ID |
|
1007 | - return $this->caps_handler->userCanReadGlobalMessages() |
|
1008 | - ? EEH_MSG_Template::get_message_action_link( |
|
1009 | - 'see_notifications_for', |
|
1010 | - null, |
|
1011 | - ['_REG_ID' => $registration->ID()] |
|
1012 | - ) |
|
1013 | - : ''; |
|
1014 | - } |
|
1015 | - |
|
1016 | - |
|
1017 | - /** |
|
1018 | - * @throws EE_Error |
|
1019 | - * @throws ReflectionException |
|
1020 | - */ |
|
1021 | - private function trashRegistrationLink( |
|
1022 | - EE_Registration $registration, |
|
1023 | - array $url_params |
|
1024 | - ): array { |
|
1025 | - $actions = []; |
|
1026 | - // can't trash what's already trashed |
|
1027 | - if ($this->_view === 'trash') { |
|
1028 | - return $actions; |
|
1029 | - } |
|
1030 | - |
|
1031 | - // check caps |
|
1032 | - if (! $this->caps_handler->userCanTrashRegistration($registration)) { |
|
1033 | - return $actions; |
|
1034 | - } |
|
1035 | - |
|
1036 | - // don't delete registrations that have payments applied |
|
1037 | - $transaction = $registration->get_first_related('Transaction'); |
|
1038 | - $payment_count = $transaction instanceof EE_Transaction |
|
1039 | - ? $transaction->count_related('Payment') |
|
1040 | - : 0; |
|
1041 | - |
|
1042 | - if ($payment_count > 0) { |
|
1043 | - return $actions; |
|
1044 | - } |
|
1045 | - |
|
1046 | - $url_params['action'] = 'trash_registrations'; |
|
1047 | - $trash_link_url = EE_Admin_Page::add_query_args_and_nonce($url_params, REG_ADMIN_URL); |
|
1048 | - $actions['trash'] = ' |
|
995 | + } |
|
996 | + return ''; |
|
997 | + } |
|
998 | + |
|
999 | + |
|
1000 | + /** |
|
1001 | + * @throws ReflectionException |
|
1002 | + * @throws EE_Error |
|
1003 | + */ |
|
1004 | + private function viewNotificationsAction(EE_Registration $registration): string |
|
1005 | + { |
|
1006 | + // message list table link (filtered by REG_ID |
|
1007 | + return $this->caps_handler->userCanReadGlobalMessages() |
|
1008 | + ? EEH_MSG_Template::get_message_action_link( |
|
1009 | + 'see_notifications_for', |
|
1010 | + null, |
|
1011 | + ['_REG_ID' => $registration->ID()] |
|
1012 | + ) |
|
1013 | + : ''; |
|
1014 | + } |
|
1015 | + |
|
1016 | + |
|
1017 | + /** |
|
1018 | + * @throws EE_Error |
|
1019 | + * @throws ReflectionException |
|
1020 | + */ |
|
1021 | + private function trashRegistrationLink( |
|
1022 | + EE_Registration $registration, |
|
1023 | + array $url_params |
|
1024 | + ): array { |
|
1025 | + $actions = []; |
|
1026 | + // can't trash what's already trashed |
|
1027 | + if ($this->_view === 'trash') { |
|
1028 | + return $actions; |
|
1029 | + } |
|
1030 | + |
|
1031 | + // check caps |
|
1032 | + if (! $this->caps_handler->userCanTrashRegistration($registration)) { |
|
1033 | + return $actions; |
|
1034 | + } |
|
1035 | + |
|
1036 | + // don't delete registrations that have payments applied |
|
1037 | + $transaction = $registration->get_first_related('Transaction'); |
|
1038 | + $payment_count = $transaction instanceof EE_Transaction |
|
1039 | + ? $transaction->count_related('Payment') |
|
1040 | + : 0; |
|
1041 | + |
|
1042 | + if ($payment_count > 0) { |
|
1043 | + return $actions; |
|
1044 | + } |
|
1045 | + |
|
1046 | + $url_params['action'] = 'trash_registrations'; |
|
1047 | + $trash_link_url = EE_Admin_Page::add_query_args_and_nonce($url_params, REG_ADMIN_URL); |
|
1048 | + $actions['trash'] = ' |
|
1049 | 1049 | <a class="ee-aria-tooltip" |
1050 | 1050 | href="' . $trash_link_url . '" |
1051 | 1051 | aria-label="' . esc_attr__('Trash Registration', 'event_espresso') . '" |
1052 | 1052 | > |
1053 | 1053 | ' . esc_html__('Trash', 'event_espresso') . ' |
1054 | 1054 | </a>'; |
1055 | - return $actions; |
|
1056 | - } |
|
1057 | - |
|
1058 | - |
|
1059 | - /** |
|
1060 | - * @throws EE_Error |
|
1061 | - * @throws ReflectionException |
|
1062 | - */ |
|
1063 | - private function restoreRegistrationLink( |
|
1064 | - EE_Registration $registration, |
|
1065 | - array $url_params, |
|
1066 | - array $actions |
|
1067 | - ): array { |
|
1068 | - // can't restore what's not trashed |
|
1069 | - if ($this->_view !== 'trash') { |
|
1070 | - return $actions; |
|
1071 | - } |
|
1072 | - |
|
1073 | - // restore registration link |
|
1074 | - if ($this->caps_handler->userCanRestoreRegistration($registration)) { |
|
1075 | - $url_params['action'] = 'restore_registrations'; |
|
1076 | - $restore_link_url = EE_Admin_Page::add_query_args_and_nonce($url_params, REG_ADMIN_URL); |
|
1077 | - $actions['restore'] = ' |
|
1055 | + return $actions; |
|
1056 | + } |
|
1057 | + |
|
1058 | + |
|
1059 | + /** |
|
1060 | + * @throws EE_Error |
|
1061 | + * @throws ReflectionException |
|
1062 | + */ |
|
1063 | + private function restoreRegistrationLink( |
|
1064 | + EE_Registration $registration, |
|
1065 | + array $url_params, |
|
1066 | + array $actions |
|
1067 | + ): array { |
|
1068 | + // can't restore what's not trashed |
|
1069 | + if ($this->_view !== 'trash') { |
|
1070 | + return $actions; |
|
1071 | + } |
|
1072 | + |
|
1073 | + // restore registration link |
|
1074 | + if ($this->caps_handler->userCanRestoreRegistration($registration)) { |
|
1075 | + $url_params['action'] = 'restore_registrations'; |
|
1076 | + $restore_link_url = EE_Admin_Page::add_query_args_and_nonce($url_params, REG_ADMIN_URL); |
|
1077 | + $actions['restore'] = ' |
|
1078 | 1078 | <a class="ee-aria-tooltip" |
1079 | 1079 | href="' . $restore_link_url . '" |
1080 | 1080 | aria-label="' . esc_attr__('Restore Registration', 'event_espresso') . '" |
1081 | 1081 | > |
1082 | 1082 | ' . esc_html__('Restore', 'event_espresso') . ' |
1083 | 1083 | </a>'; |
1084 | - } |
|
1085 | - |
|
1086 | - return $actions; |
|
1087 | - } |
|
1088 | - |
|
1089 | - |
|
1090 | - /** |
|
1091 | - * @throws EE_Error |
|
1092 | - * @throws ReflectionException |
|
1093 | - */ |
|
1094 | - private function deleteRegistrationLink( |
|
1095 | - EE_Registration $registration, |
|
1096 | - array $url_params, |
|
1097 | - array $actions |
|
1098 | - ): array { |
|
1099 | - if ($this->_view === 'trash' && $this->caps_handler->userCanDeleteRegistration($registration)) { |
|
1100 | - $url_params['action'] = 'delete_registrations'; |
|
1101 | - $delete_link_url = EE_Admin_Page::add_query_args_and_nonce($url_params, REG_ADMIN_URL); |
|
1102 | - $actions['delete'] = ' |
|
1084 | + } |
|
1085 | + |
|
1086 | + return $actions; |
|
1087 | + } |
|
1088 | + |
|
1089 | + |
|
1090 | + /** |
|
1091 | + * @throws EE_Error |
|
1092 | + * @throws ReflectionException |
|
1093 | + */ |
|
1094 | + private function deleteRegistrationLink( |
|
1095 | + EE_Registration $registration, |
|
1096 | + array $url_params, |
|
1097 | + array $actions |
|
1098 | + ): array { |
|
1099 | + if ($this->_view === 'trash' && $this->caps_handler->userCanDeleteRegistration($registration)) { |
|
1100 | + $url_params['action'] = 'delete_registrations'; |
|
1101 | + $delete_link_url = EE_Admin_Page::add_query_args_and_nonce($url_params, REG_ADMIN_URL); |
|
1102 | + $actions['delete'] = ' |
|
1103 | 1103 | <a class="ee-aria-tooltip" |
1104 | 1104 | href="' . $delete_link_url . '" |
1105 | 1105 | aria-label="' . esc_attr__('Delete Registration Permanently', 'event_espresso') . '" |
1106 | 1106 | > |
1107 | 1107 | ' . esc_html__('Delete', 'event_espresso') . ' |
1108 | 1108 | </a>'; |
1109 | - } |
|
1110 | - return $actions; |
|
1111 | - } |
|
1112 | - |
|
1113 | - |
|
1114 | - private function editEventLink(int $EVT_ID, string $event_name): string |
|
1115 | - { |
|
1116 | - if (! $EVT_ID || ! $this->caps_handler->userCanEditEvent($EVT_ID)) { |
|
1117 | - return $event_name; |
|
1118 | - } |
|
1119 | - $edit_event_url = EE_Admin_Page::add_query_args_and_nonce( |
|
1120 | - ['action' => 'edit', 'post' => $EVT_ID], |
|
1121 | - EVENTS_ADMIN_URL |
|
1122 | - ); |
|
1123 | - return ' |
|
1109 | + } |
|
1110 | + return $actions; |
|
1111 | + } |
|
1112 | + |
|
1113 | + |
|
1114 | + private function editEventLink(int $EVT_ID, string $event_name): string |
|
1115 | + { |
|
1116 | + if (! $EVT_ID || ! $this->caps_handler->userCanEditEvent($EVT_ID)) { |
|
1117 | + return $event_name; |
|
1118 | + } |
|
1119 | + $edit_event_url = EE_Admin_Page::add_query_args_and_nonce( |
|
1120 | + ['action' => 'edit', 'post' => $EVT_ID], |
|
1121 | + EVENTS_ADMIN_URL |
|
1122 | + ); |
|
1123 | + return ' |
|
1124 | 1124 | <a class="ee-aria-tooltip ee-status-color--' . $this->_event_details['status'] . '" |
1125 | 1125 | href="' . $edit_event_url . '" |
1126 | 1126 | aria-label="' . esc_attr($this->_event_details['title_attr']) . '" |
1127 | 1127 | > |
1128 | 1128 | ' . $event_name . ' |
1129 | 1129 | </a>'; |
1130 | - } |
|
1130 | + } |
|
1131 | 1131 | |
1132 | 1132 | |
1133 | - private function eventFilterLink(int $EVT_ID, string $event_name): string |
|
1134 | - { |
|
1135 | - if (!$EVT_ID) { |
|
1136 | - return ''; |
|
1137 | - } |
|
1138 | - $event_filter_url = EE_Admin_Page::add_query_args_and_nonce(['event_id' => $EVT_ID], REG_ADMIN_URL); |
|
1139 | - return ' |
|
1133 | + private function eventFilterLink(int $EVT_ID, string $event_name): string |
|
1134 | + { |
|
1135 | + if (!$EVT_ID) { |
|
1136 | + return ''; |
|
1137 | + } |
|
1138 | + $event_filter_url = EE_Admin_Page::add_query_args_and_nonce(['event_id' => $EVT_ID], REG_ADMIN_URL); |
|
1139 | + return ' |
|
1140 | 1140 | <a class="ee-aria-tooltip ee-event-filter-link" |
1141 | 1141 | href="' . $event_filter_url . '" |
1142 | 1142 | aria-label="' . sprintf( |
1143 | - esc_attr__('Filter this list to only show registrations for %s', 'event_espresso'), |
|
1144 | - $event_name |
|
1145 | - ) . '" |
|
1143 | + esc_attr__('Filter this list to only show registrations for %s', 'event_espresso'), |
|
1144 | + $event_name |
|
1145 | + ) . '" |
|
1146 | 1146 | > |
1147 | 1147 | <span class="dashicons dashicons-groups dashicons--small"></span>' |
1148 | - . esc_html__('View Registrations', 'event_espresso') . ' |
|
1148 | + . esc_html__('View Registrations', 'event_espresso') . ' |
|
1149 | 1149 | </a>'; |
1150 | - } |
|
1150 | + } |
|
1151 | 1151 | } |
@@ -53,10 +53,10 @@ discard block |
||
53 | 53 | { |
54 | 54 | $this->caps_handler = new RegistrationsListTableUserCapabilities(EE_Registry::instance()->CAP); |
55 | 55 | $req_data = $admin_page->get_request_data(); |
56 | - if (! empty($req_data['event_id'])) { |
|
56 | + if ( ! empty($req_data['event_id'])) { |
|
57 | 57 | $extra_query_args = []; |
58 | 58 | foreach ($admin_page->get_views() as $view_details) { |
59 | - $extra_query_args[ $view_details['slug'] ] = ['event_id' => $req_data['event_id']]; |
|
59 | + $extra_query_args[$view_details['slug']] = ['event_id' => $req_data['event_id']]; |
|
60 | 60 | } |
61 | 61 | $this->_views = $admin_page->get_list_table_view_RLs($extra_query_args); |
62 | 62 | } |
@@ -88,9 +88,9 @@ discard block |
||
88 | 88 | 'ajax' => true, |
89 | 89 | 'screen' => $this->_admin_page->get_current_screen()->id, |
90 | 90 | ]; |
91 | - $req_data = $this->_admin_page->get_request_data(); |
|
91 | + $req_data = $this->_admin_page->get_request_data(); |
|
92 | 92 | if (isset($req_data['event_id'])) { |
93 | - $this->_columns = [ |
|
93 | + $this->_columns = [ |
|
94 | 94 | 'cb' => '<input type="checkbox" />', // Render a checkbox instead of text |
95 | 95 | 'id' => esc_html__('ID', 'event_espresso'), |
96 | 96 | 'ATT_fname' => esc_html__('Name', 'event_espresso'), |
@@ -112,7 +112,7 @@ discard block |
||
112 | 112 | ], |
113 | 113 | ]; |
114 | 114 | } else { |
115 | - $this->_columns = [ |
|
115 | + $this->_columns = [ |
|
116 | 116 | 'cb' => '<input type="checkbox" />', // Render a checkbox instead of text |
117 | 117 | 'id' => esc_html__('ID', 'event_espresso'), |
118 | 118 | 'ATT_fname' => esc_html__('Name', 'event_espresso'), |
@@ -139,7 +139,7 @@ discard block |
||
139 | 139 | 'return_url' => $return_url, |
140 | 140 | ], |
141 | 141 | ]; |
142 | - $filters = array_diff_key( |
|
142 | + $filters = array_diff_key( |
|
143 | 143 | $this->_req_data, |
144 | 144 | array_flip( |
145 | 145 | [ |
@@ -149,12 +149,12 @@ discard block |
||
149 | 149 | ] |
150 | 150 | ) |
151 | 151 | ); |
152 | - if (! empty($filters)) { |
|
152 | + if ( ! empty($filters)) { |
|
153 | 153 | $this->_bottom_buttons['report_filtered']['extra_request']['filters'] = $filters; |
154 | 154 | } |
155 | 155 | $this->_primary_column = 'id'; |
156 | 156 | $this->_sortable_columns = [ |
157 | - '_REG_date' => ['_REG_date' => true], // true means its already sorted |
|
157 | + '_REG_date' => ['_REG_date' => true], // true means its already sorted |
|
158 | 158 | /** |
159 | 159 | * Allows users to change the default sort if they wish. |
160 | 160 | * Returning a falsey on this filter will result in the default sort to be by firstname rather than last |
@@ -171,7 +171,7 @@ discard block |
||
171 | 171 | 'DTT_EVT_start' => ['DTT_EVT_start' => false], |
172 | 172 | 'id' => ['REG_ID' => false], |
173 | 173 | ]; |
174 | - $this->_hidden_columns = []; |
|
174 | + $this->_hidden_columns = []; |
|
175 | 175 | } |
176 | 176 | |
177 | 177 | |
@@ -344,14 +344,14 @@ discard block |
||
344 | 344 | $this_month_r = date('m', current_time('timestamp')); |
345 | 345 | $days_this_month = date('t', current_time('timestamp')); |
346 | 346 | // setup date query. |
347 | - $beginning_string = EEM_Registration::instance()->convert_datetime_for_query( |
|
347 | + $beginning_string = EEM_Registration::instance()->convert_datetime_for_query( |
|
348 | 348 | 'REG_date', |
349 | - $this_year_r . '-' . $this_month_r . '-01' . ' ' . $time_start, |
|
349 | + $this_year_r.'-'.$this_month_r.'-01'.' '.$time_start, |
|
350 | 350 | 'Y-m-d H:i:s' |
351 | 351 | ); |
352 | - $end_string = EEM_Registration::instance()->convert_datetime_for_query( |
|
352 | + $end_string = EEM_Registration::instance()->convert_datetime_for_query( |
|
353 | 353 | 'REG_date', |
354 | - $this_year_r . '-' . $this_month_r . '-' . $days_this_month . ' ' . $time_end, |
|
354 | + $this_year_r.'-'.$this_month_r.'-'.$days_this_month.' '.$time_end, |
|
355 | 355 | 'Y-m-d H:i:s' |
356 | 356 | ); |
357 | 357 | $_where['REG_date'] = [ |
@@ -361,7 +361,7 @@ discard block |
||
361 | 361 | $end_string, |
362 | 362 | ], |
363 | 363 | ]; |
364 | - $_where['STS_ID'] = ['!=', EEM_Registration::status_id_incomplete]; |
|
364 | + $_where['STS_ID'] = ['!=', EEM_Registration::status_id_incomplete]; |
|
365 | 365 | return EEM_Registration::instance()->count([$_where]); |
366 | 366 | } |
367 | 367 | |
@@ -387,17 +387,17 @@ discard block |
||
387 | 387 | [ |
388 | 388 | EEM_Registration::instance()->convert_datetime_for_query( |
389 | 389 | 'REG_date', |
390 | - $current_date . $time_start, |
|
390 | + $current_date.$time_start, |
|
391 | 391 | 'Y-m-d H:i:s' |
392 | 392 | ), |
393 | 393 | EEM_Registration::instance()->convert_datetime_for_query( |
394 | 394 | 'REG_date', |
395 | - $current_date . $time_end, |
|
395 | + $current_date.$time_end, |
|
396 | 396 | 'Y-m-d H:i:s' |
397 | 397 | ), |
398 | 398 | ], |
399 | 399 | ]; |
400 | - $_where['STS_ID'] = ['!=', EEM_Registration::status_id_incomplete]; |
|
400 | + $_where['STS_ID'] = ['!=', EEM_Registration::status_id_incomplete]; |
|
401 | 401 | return EEM_Registration::instance()->count([$_where]); |
402 | 402 | } |
403 | 403 | |
@@ -420,10 +420,10 @@ discard block |
||
420 | 420 | ? $transaction->count_related('Payment') |
421 | 421 | : 0; |
422 | 422 | |
423 | - $content = '<input type="checkbox" name="_REG_ID[]" value="' . $REG_ID . '" />'; |
|
423 | + $content = '<input type="checkbox" name="_REG_ID[]" value="'.$REG_ID.'" />'; |
|
424 | 424 | $content .= $payment_count > 0 || ! $this->caps_handler->userCanEditRegistration($item) |
425 | 425 | ? '<span class="ee-locked-entity dashicons dashicons-lock ee-aria-tooltip ee-aria-tooltip--big-box" |
426 | - aria-label="' . $this->lockedRegMessage() . '"></span>' |
|
426 | + aria-label="' . $this->lockedRegMessage().'"></span>' |
|
427 | 427 | : ''; |
428 | 428 | return $this->columnContent('cb', $content, 'center'); |
429 | 429 | } |
@@ -449,7 +449,7 @@ discard block |
||
449 | 449 | */ |
450 | 450 | public function column_id(EE_Registration $registration): string |
451 | 451 | { |
452 | - $content = '<span class="ee-entity-id">' . $registration->ID() . '</span>'; |
|
452 | + $content = '<span class="ee-entity-id">'.$registration->ID().'</span>'; |
|
453 | 453 | $content .= '<span class="show-on-mobile-view-only">'; |
454 | 454 | $content .= $this->column_ATT_fname($registration, false); |
455 | 455 | $content .= '</span>'; |
@@ -480,23 +480,23 @@ discard block |
||
480 | 480 | esc_html__('(%1$s / %2$s)', 'event_espresso'), |
481 | 481 | $registration->count(), |
482 | 482 | $registration->group_size() |
483 | - ) . ' |
|
483 | + ).' |
|
484 | 484 | </span >'; |
485 | 485 | |
486 | 486 | $content = ' |
487 | 487 | <div class="ee-layout-row"> |
488 | - <span aria-label="' . $pretty_status . '" |
|
489 | - class="ee-status-dot ee-status-bg--' . $status . ' ee-aria-tooltip" |
|
488 | + <span aria-label="' . $pretty_status.'" |
|
489 | + class="ee-status-dot ee-status-bg--' . $status.' ee-aria-tooltip" |
|
490 | 490 | ></span> |
491 | 491 | ' . $this->viewRegistrationLink($registration, $status) |
492 | 492 | . $prime_reg_star |
493 | - . $group_count . ' |
|
493 | + . $group_count.' |
|
494 | 494 | <span class="spacer"></span> |
495 | 495 | <span> |
496 | 496 | ' . sprintf( |
497 | 497 | esc_html__('Reg Code: %s', 'event_espresso'), |
498 | 498 | $registration->get('REG_code') |
499 | - ) . ' |
|
499 | + ).' |
|
500 | 500 | </span> |
501 | 501 | </div>'; |
502 | 502 | |
@@ -527,7 +527,7 @@ discard block |
||
527 | 527 | $this->_set_related_details($registration); |
528 | 528 | // Build row actions |
529 | 529 | $content = $this->caps_handler->userCanViewTransaction() |
530 | - ? '<a class="ee-aria-tooltip ee-status-color--' . $this->_transaction_details['status'] . '" href="' |
|
530 | + ? '<a class="ee-aria-tooltip ee-status-color--'.$this->_transaction_details['status'].'" href="' |
|
531 | 531 | . $this->viewTransactionUrl() |
532 | 532 | . '" aria-label="' |
533 | 533 | . esc_attr($this->_transaction_details['title_attr']) |
@@ -601,16 +601,16 @@ discard block |
||
601 | 601 | { |
602 | 602 | // get first item for initial visibility |
603 | 603 | $content = (string) array_shift($datetime_strings); |
604 | - if (! empty($datetime_strings)) { |
|
604 | + if ( ! empty($datetime_strings)) { |
|
605 | 605 | $content .= ' |
606 | 606 | <div class="ee-registration-event-datetimes-container-wrap"> |
607 | - <button aria-label="' . esc_attr__('Click to view all dates', 'event_espresso') . '" |
|
607 | + <button aria-label="' . esc_attr__('Click to view all dates', 'event_espresso').'" |
|
608 | 608 | class="ee-aria-tooltip button button--secondary button--tiny button--icon-only ee-js ee-more-datetimes-toggle" |
609 | 609 | > |
610 | 610 | <span class="dashicons dashicons-admin-collapse"></span> |
611 | 611 | </button> |
612 | 612 | <div class="ee-registration-event-datetimes-container more-items hidden"> |
613 | - ' . implode("", $datetime_strings) . ' |
|
613 | + ' . implode("", $datetime_strings).' |
|
614 | 614 | </div> |
615 | 615 | </div>'; |
616 | 616 | } |
@@ -661,16 +661,16 @@ discard block |
||
661 | 661 | $req_data = $this->_admin_page->get_request_data(); |
662 | 662 | |
663 | 663 | $content = isset($req_data['event_id']) && $ticket instanceof EE_Ticket |
664 | - ? '<div class="TKT_name">' . $ticket->name() . '</div>' |
|
664 | + ? '<div class="TKT_name">'.$ticket->name().'</div>' |
|
665 | 665 | : ''; |
666 | 666 | |
667 | 667 | $payment_status = $registration->owes_monies_and_can_pay() ? 'TFL' : 'TCM'; |
668 | - $content .= $registration->final_price() > 0 |
|
669 | - ? '<span class="reg-overview-paid-event-spn ee-status-color--' . $payment_status . '"> |
|
670 | - ' . $registration->pretty_final_price() . ' |
|
668 | + $content .= $registration->final_price() > 0 |
|
669 | + ? '<span class="reg-overview-paid-event-spn ee-status-color--'.$payment_status.'"> |
|
670 | + ' . $registration->pretty_final_price().' |
|
671 | 671 | </span>' |
672 | 672 | // free event |
673 | - : '<span class="reg-overview-free-event-spn">' . esc_html__('free', 'event_espresso') . '</span>'; |
|
673 | + : '<span class="reg-overview-free-event-spn">'.esc_html__('free', 'event_espresso').'</span>'; |
|
674 | 674 | |
675 | 675 | return $this->columnContent('PRC_amount', $content, 'end'); |
676 | 676 | } |
@@ -696,7 +696,7 @@ discard block |
||
696 | 696 | |
697 | 697 | $content .= ' |
698 | 698 | <span class="reg-overview-paid-event-spn"> |
699 | - ' . $registration->pretty_final_price() . ' |
|
699 | + ' . $registration->pretty_final_price().' |
|
700 | 700 | </span>'; |
701 | 701 | return $this->columnContent('_REG_final_price', $content, 'end'); |
702 | 702 | } |
@@ -716,8 +716,8 @@ discard block |
||
716 | 716 | |
717 | 717 | $payment_status = $registration->owes_monies_and_can_pay() ? 'TFL' : 'TCM'; |
718 | 718 | $content = ' |
719 | - <span class="reg-overview-paid-event-spn ee-status-color--' . $payment_status . '"> |
|
720 | - ' . $registration->pretty_paid() . ' |
|
719 | + <span class="reg-overview-paid-event-spn ee-status-color--' . $payment_status.'"> |
|
720 | + ' . $registration->pretty_paid().' |
|
721 | 721 | </span>'; |
722 | 722 | if ($registration->paid() > 0) { |
723 | 723 | $content .= '<span class="ee-status-text-small">' |
@@ -746,11 +746,11 @@ discard block |
||
746 | 746 | if ($registration->transaction()) { |
747 | 747 | $content = $this->caps_handler->userCanViewTransaction() |
748 | 748 | ? ' |
749 | - <a class="ee-aria-tooltip ee-status-color--' . $registration->transaction()->status_ID() . '" |
|
750 | - href="' . $this->viewTransactionUrl() . '" |
|
751 | - aria-label="' . esc_attr__('View Transaction', 'event_espresso') . '" |
|
749 | + <a class="ee-aria-tooltip ee-status-color--' . $registration->transaction()->status_ID().'" |
|
750 | + href="' . $this->viewTransactionUrl().'" |
|
751 | + aria-label="' . esc_attr__('View Transaction', 'event_espresso').'" |
|
752 | 752 | > |
753 | - ' . $registration->transaction()->pretty_total() . ' |
|
753 | + ' . $registration->transaction()->pretty_total().' |
|
754 | 754 | </a>' |
755 | 755 | : $registration->transaction()->pretty_total(); |
756 | 756 | } else { |
@@ -784,11 +784,11 @@ discard block |
||
784 | 784 | } else { |
785 | 785 | $content = $this->caps_handler->userCanViewTransaction() |
786 | 786 | ? ' |
787 | - <a class="ee-aria-tooltip ee-status-color--' . $transaction->status_ID() . '" |
|
788 | - href="' . $this->viewTransactionUrl() . '" |
|
789 | - aria-label="' . esc_attr__('View Transaction', 'event_espresso') . '" |
|
787 | + <a class="ee-aria-tooltip ee-status-color--' . $transaction->status_ID().'" |
|
788 | + href="' . $this->viewTransactionUrl().'" |
|
789 | + aria-label="' . esc_attr__('View Transaction', 'event_espresso').'" |
|
790 | 790 | > |
791 | - ' . $registration->transaction()->pretty_paid() . ' |
|
791 | + ' . $registration->transaction()->pretty_paid().' |
|
792 | 792 | </a>' |
793 | 793 | : $registration->transaction()->pretty_paid(); |
794 | 794 | } |
@@ -867,11 +867,11 @@ discard block |
||
867 | 867 | : ''; |
868 | 868 | return $this->caps_handler->userCanReadRegistration($registration) |
869 | 869 | ? ' |
870 | - <a href="' . $this->viewRegistrationUrl($registration) . '" |
|
871 | - class="row-title ee-status-color--' . $status . ' ee-aria-tooltip" |
|
872 | - aria-label="' . esc_attr__('View Registration Details', 'event_espresso') . '" |
|
870 | + <a href="' . $this->viewRegistrationUrl($registration).'" |
|
871 | + class="row-title ee-status-color--' . $status.' ee-aria-tooltip" |
|
872 | + aria-label="' . esc_attr__('View Registration Details', 'event_espresso').'" |
|
873 | 873 | > |
874 | - ' . $attendee_name . ' |
|
874 | + ' . $attendee_name.' |
|
875 | 875 | </a>' |
876 | 876 | : $attendee_name; |
877 | 877 | } |
@@ -885,9 +885,9 @@ discard block |
||
885 | 885 | { |
886 | 886 | return $this->caps_handler->userCanReadRegistration($registration) |
887 | 887 | ? ' |
888 | - <a href="' . $this->viewRegistrationUrl($registration) . '" |
|
888 | + <a href="' . $this->viewRegistrationUrl($registration).'" |
|
889 | 889 | class="ee-aria-tooltip button button--icon-only" |
890 | - aria-label="' . esc_attr__('View Registration Details', 'event_espresso') . '" |
|
890 | + aria-label="' . esc_attr__('View Registration Details', 'event_espresso').'" |
|
891 | 891 | > |
892 | 892 | <span class="dashicons dashicons-clipboard"></span> |
893 | 893 | </a>' |
@@ -907,8 +907,8 @@ discard block |
||
907 | 907 | REG_ADMIN_URL |
908 | 908 | ); |
909 | 909 | return ' |
910 | - <a href="' . $edit_link_url . '" |
|
911 | - aria-label="' . esc_attr__('Edit Contact Details', 'event_espresso') . '" |
|
910 | + <a href="' . $edit_link_url.'" |
|
911 | + aria-label="' . esc_attr__('Edit Contact Details', 'event_espresso').'" |
|
912 | 912 | class="ee-aria-tooltip button button--secondary button--icon-only" |
913 | 913 | > |
914 | 914 | <span class="dashicons dashicons-admin-users"></span> |
@@ -936,7 +936,7 @@ discard block |
||
936 | 936 | true |
937 | 937 | ); |
938 | 938 | return ' |
939 | - <a href="' . $resend_reg_link_url . '" aria-label="' |
|
939 | + <a href="' . $resend_reg_link_url.'" aria-label="' |
|
940 | 940 | . esc_attr__('Resend Registration Details', 'event_espresso') |
941 | 941 | . '" class="ee-aria-tooltip button button--icon-only"> |
942 | 942 | <span class="dashicons dashicons-email-alt"></span> |
@@ -963,8 +963,8 @@ discard block |
||
963 | 963 | if ($this->caps_handler->userCanViewTransaction()) { |
964 | 964 | return ' |
965 | 965 | <a class="ee-aria-tooltip button button--icon-only" |
966 | - href="' . $this->viewTransactionUrl() . '" |
|
967 | - aria-label="' . $this->_transaction_details['title_attr'] . '" |
|
966 | + href="' . $this->viewTransactionUrl().'" |
|
967 | + aria-label="' . $this->_transaction_details['title_attr'].'" |
|
968 | 968 | > |
969 | 969 | <span class="dashicons dashicons-cart"></span> |
970 | 970 | </a>'; |
@@ -989,7 +989,7 @@ discard block |
||
989 | 989 | ) { |
990 | 990 | return ' |
991 | 991 | <a aria-label="' . esc_attr__('View Transaction Invoice', 'event_espresso') |
992 | - . '" target="_blank" href="' . $registration->invoice_url() . '" class="ee-aria-tooltip button button--icon-only"> |
|
992 | + . '" target="_blank" href="'.$registration->invoice_url().'" class="ee-aria-tooltip button button--icon-only"> |
|
993 | 993 | <span class="dashicons dashicons-media-spreadsheet"></span> |
994 | 994 | </a>'; |
995 | 995 | } |
@@ -1029,7 +1029,7 @@ discard block |
||
1029 | 1029 | } |
1030 | 1030 | |
1031 | 1031 | // check caps |
1032 | - if (! $this->caps_handler->userCanTrashRegistration($registration)) { |
|
1032 | + if ( ! $this->caps_handler->userCanTrashRegistration($registration)) { |
|
1033 | 1033 | return $actions; |
1034 | 1034 | } |
1035 | 1035 | |
@@ -1047,10 +1047,10 @@ discard block |
||
1047 | 1047 | $trash_link_url = EE_Admin_Page::add_query_args_and_nonce($url_params, REG_ADMIN_URL); |
1048 | 1048 | $actions['trash'] = ' |
1049 | 1049 | <a class="ee-aria-tooltip" |
1050 | - href="' . $trash_link_url . '" |
|
1051 | - aria-label="' . esc_attr__('Trash Registration', 'event_espresso') . '" |
|
1050 | + href="' . $trash_link_url.'" |
|
1051 | + aria-label="' . esc_attr__('Trash Registration', 'event_espresso').'" |
|
1052 | 1052 | > |
1053 | - ' . esc_html__('Trash', 'event_espresso') . ' |
|
1053 | + ' . esc_html__('Trash', 'event_espresso').' |
|
1054 | 1054 | </a>'; |
1055 | 1055 | return $actions; |
1056 | 1056 | } |
@@ -1076,10 +1076,10 @@ discard block |
||
1076 | 1076 | $restore_link_url = EE_Admin_Page::add_query_args_and_nonce($url_params, REG_ADMIN_URL); |
1077 | 1077 | $actions['restore'] = ' |
1078 | 1078 | <a class="ee-aria-tooltip" |
1079 | - href="' . $restore_link_url . '" |
|
1080 | - aria-label="' . esc_attr__('Restore Registration', 'event_espresso') . '" |
|
1079 | + href="' . $restore_link_url.'" |
|
1080 | + aria-label="' . esc_attr__('Restore Registration', 'event_espresso').'" |
|
1081 | 1081 | > |
1082 | - ' . esc_html__('Restore', 'event_espresso') . ' |
|
1082 | + ' . esc_html__('Restore', 'event_espresso').' |
|
1083 | 1083 | </a>'; |
1084 | 1084 | } |
1085 | 1085 | |
@@ -1101,10 +1101,10 @@ discard block |
||
1101 | 1101 | $delete_link_url = EE_Admin_Page::add_query_args_and_nonce($url_params, REG_ADMIN_URL); |
1102 | 1102 | $actions['delete'] = ' |
1103 | 1103 | <a class="ee-aria-tooltip" |
1104 | - href="' . $delete_link_url . '" |
|
1105 | - aria-label="' . esc_attr__('Delete Registration Permanently', 'event_espresso') . '" |
|
1104 | + href="' . $delete_link_url.'" |
|
1105 | + aria-label="' . esc_attr__('Delete Registration Permanently', 'event_espresso').'" |
|
1106 | 1106 | > |
1107 | - ' . esc_html__('Delete', 'event_espresso') . ' |
|
1107 | + ' . esc_html__('Delete', 'event_espresso').' |
|
1108 | 1108 | </a>'; |
1109 | 1109 | } |
1110 | 1110 | return $actions; |
@@ -1113,7 +1113,7 @@ discard block |
||
1113 | 1113 | |
1114 | 1114 | private function editEventLink(int $EVT_ID, string $event_name): string |
1115 | 1115 | { |
1116 | - if (! $EVT_ID || ! $this->caps_handler->userCanEditEvent($EVT_ID)) { |
|
1116 | + if ( ! $EVT_ID || ! $this->caps_handler->userCanEditEvent($EVT_ID)) { |
|
1117 | 1117 | return $event_name; |
1118 | 1118 | } |
1119 | 1119 | $edit_event_url = EE_Admin_Page::add_query_args_and_nonce( |
@@ -1121,31 +1121,31 @@ discard block |
||
1121 | 1121 | EVENTS_ADMIN_URL |
1122 | 1122 | ); |
1123 | 1123 | return ' |
1124 | - <a class="ee-aria-tooltip ee-status-color--' . $this->_event_details['status'] . '" |
|
1125 | - href="' . $edit_event_url . '" |
|
1126 | - aria-label="' . esc_attr($this->_event_details['title_attr']) . '" |
|
1124 | + <a class="ee-aria-tooltip ee-status-color--' . $this->_event_details['status'].'" |
|
1125 | + href="' . $edit_event_url.'" |
|
1126 | + aria-label="' . esc_attr($this->_event_details['title_attr']).'" |
|
1127 | 1127 | > |
1128 | - ' . $event_name . ' |
|
1128 | + ' . $event_name.' |
|
1129 | 1129 | </a>'; |
1130 | 1130 | } |
1131 | 1131 | |
1132 | 1132 | |
1133 | 1133 | private function eventFilterLink(int $EVT_ID, string $event_name): string |
1134 | 1134 | { |
1135 | - if (!$EVT_ID) { |
|
1135 | + if ( ! $EVT_ID) { |
|
1136 | 1136 | return ''; |
1137 | 1137 | } |
1138 | 1138 | $event_filter_url = EE_Admin_Page::add_query_args_and_nonce(['event_id' => $EVT_ID], REG_ADMIN_URL); |
1139 | 1139 | return ' |
1140 | 1140 | <a class="ee-aria-tooltip ee-event-filter-link" |
1141 | - href="' . $event_filter_url . '" |
|
1141 | + href="' . $event_filter_url.'" |
|
1142 | 1142 | aria-label="' . sprintf( |
1143 | 1143 | esc_attr__('Filter this list to only show registrations for %s', 'event_espresso'), |
1144 | 1144 | $event_name |
1145 | - ) . '" |
|
1145 | + ).'" |
|
1146 | 1146 | > |
1147 | 1147 | <span class="dashicons dashicons-groups dashicons--small"></span>' |
1148 | - . esc_html__('View Registrations', 'event_espresso') . ' |
|
1148 | + . esc_html__('View Registrations', 'event_espresso').' |
|
1149 | 1149 | </a>'; |
1150 | 1150 | } |
1151 | 1151 | } |
@@ -19,1425 +19,1425 @@ |
||
19 | 19 | */ |
20 | 20 | class General_Settings_Admin_Page extends EE_Admin_Page |
21 | 21 | { |
22 | - /** |
|
23 | - * @var EE_Core_Config |
|
24 | - */ |
|
25 | - public $core_config; |
|
26 | - |
|
27 | - |
|
28 | - /** |
|
29 | - * Initialize basic properties. |
|
30 | - */ |
|
31 | - protected function _init_page_props() |
|
32 | - { |
|
33 | - $this->page_slug = GEN_SET_PG_SLUG; |
|
34 | - $this->page_label = GEN_SET_LABEL; |
|
35 | - $this->_admin_base_url = GEN_SET_ADMIN_URL; |
|
36 | - $this->_admin_base_path = GEN_SET_ADMIN; |
|
37 | - } |
|
38 | - |
|
39 | - |
|
40 | - /** |
|
41 | - * Set ajax hooks |
|
42 | - */ |
|
43 | - protected function _ajax_hooks() |
|
44 | - { |
|
45 | - add_action('wp_ajax_espresso_display_country_settings', [$this, 'display_country_settings']); |
|
46 | - add_action('wp_ajax_espresso_display_country_states', [$this, 'display_country_states']); |
|
47 | - add_action('wp_ajax_espresso_delete_state', [$this, 'delete_state'], 10, 3); |
|
48 | - add_action('wp_ajax_espresso_add_new_state', [$this, 'add_new_state']); |
|
49 | - } |
|
50 | - |
|
51 | - |
|
52 | - /** |
|
53 | - * More page properties initialization. |
|
54 | - */ |
|
55 | - protected function _define_page_props() |
|
56 | - { |
|
57 | - $this->_admin_page_title = GEN_SET_LABEL; |
|
58 | - $this->_labels = ['publishbox' => esc_html__('Update Settings', 'event_espresso')]; |
|
59 | - } |
|
60 | - |
|
61 | - |
|
62 | - /** |
|
63 | - * Set page routes property. |
|
64 | - */ |
|
65 | - protected function _set_page_routes() |
|
66 | - { |
|
67 | - $this->_page_routes = [ |
|
68 | - 'critical_pages' => [ |
|
69 | - 'func' => '_espresso_page_settings', |
|
70 | - 'capability' => 'manage_options', |
|
71 | - ], |
|
72 | - 'update_espresso_page_settings' => [ |
|
73 | - 'func' => '_update_espresso_page_settings', |
|
74 | - 'capability' => 'manage_options', |
|
75 | - 'noheader' => true, |
|
76 | - ], |
|
77 | - 'default' => [ |
|
78 | - 'func' => '_your_organization_settings', |
|
79 | - 'capability' => 'manage_options', |
|
80 | - ], |
|
81 | - |
|
82 | - 'update_your_organization_settings' => [ |
|
83 | - 'func' => '_update_your_organization_settings', |
|
84 | - 'capability' => 'manage_options', |
|
85 | - 'noheader' => true, |
|
86 | - ], |
|
87 | - |
|
88 | - 'admin_option_settings' => [ |
|
89 | - 'func' => '_admin_option_settings', |
|
90 | - 'capability' => 'manage_options', |
|
91 | - ], |
|
92 | - |
|
93 | - 'update_admin_option_settings' => [ |
|
94 | - 'func' => '_update_admin_option_settings', |
|
95 | - 'capability' => 'manage_options', |
|
96 | - 'noheader' => true, |
|
97 | - ], |
|
98 | - |
|
99 | - 'country_settings' => [ |
|
100 | - 'func' => '_country_settings', |
|
101 | - 'capability' => 'manage_options', |
|
102 | - ], |
|
103 | - |
|
104 | - 'update_country_settings' => [ |
|
105 | - 'func' => '_update_country_settings', |
|
106 | - 'capability' => 'manage_options', |
|
107 | - 'noheader' => true, |
|
108 | - ], |
|
109 | - |
|
110 | - 'display_country_settings' => [ |
|
111 | - 'func' => 'display_country_settings', |
|
112 | - 'capability' => 'manage_options', |
|
113 | - 'noheader' => true, |
|
114 | - ], |
|
115 | - |
|
116 | - 'add_new_state' => [ |
|
117 | - 'func' => 'add_new_state', |
|
118 | - 'capability' => 'manage_options', |
|
119 | - 'noheader' => true, |
|
120 | - ], |
|
121 | - |
|
122 | - 'delete_state' => [ |
|
123 | - 'func' => 'delete_state', |
|
124 | - 'capability' => 'manage_options', |
|
125 | - 'noheader' => true, |
|
126 | - ], |
|
127 | - 'privacy_settings' => [ |
|
128 | - 'func' => 'privacySettings', |
|
129 | - 'capability' => 'manage_options', |
|
130 | - ], |
|
131 | - 'update_privacy_settings' => [ |
|
132 | - 'func' => 'updatePrivacySettings', |
|
133 | - 'capability' => 'manage_options', |
|
134 | - 'noheader' => true, |
|
135 | - 'headers_sent_route' => 'privacy_settings', |
|
136 | - ], |
|
137 | - ]; |
|
138 | - } |
|
139 | - |
|
140 | - |
|
141 | - /** |
|
142 | - * Set page configuration property |
|
143 | - */ |
|
144 | - protected function _set_page_config() |
|
145 | - { |
|
146 | - $this->_page_config = [ |
|
147 | - 'critical_pages' => [ |
|
148 | - 'nav' => [ |
|
149 | - 'label' => esc_html__('Critical Pages', 'event_espresso'), |
|
150 | - 'order' => 50, |
|
151 | - ], |
|
152 | - 'metaboxes' => array_merge($this->_default_espresso_metaboxes, ['_publish_post_box']), |
|
153 | - 'help_tabs' => [ |
|
154 | - 'general_settings_critical_pages_help_tab' => [ |
|
155 | - 'title' => esc_html__('Critical Pages', 'event_espresso'), |
|
156 | - 'filename' => 'general_settings_critical_pages', |
|
157 | - ], |
|
158 | - ], |
|
159 | - 'require_nonce' => false, |
|
160 | - ], |
|
161 | - 'default' => [ |
|
162 | - 'nav' => [ |
|
163 | - 'label' => esc_html__('Your Organization', 'event_espresso'), |
|
164 | - 'order' => 20, |
|
165 | - ], |
|
166 | - 'help_tabs' => [ |
|
167 | - 'general_settings_your_organization_help_tab' => [ |
|
168 | - 'title' => esc_html__('Your Organization', 'event_espresso'), |
|
169 | - 'filename' => 'general_settings_your_organization', |
|
170 | - ], |
|
171 | - ], |
|
172 | - 'metaboxes' => array_merge($this->_default_espresso_metaboxes, ['_publish_post_box']), |
|
173 | - 'require_nonce' => false, |
|
174 | - ], |
|
175 | - 'admin_option_settings' => [ |
|
176 | - 'nav' => [ |
|
177 | - 'label' => esc_html__('Admin Options', 'event_espresso'), |
|
178 | - 'order' => 60, |
|
179 | - ], |
|
180 | - 'metaboxes' => array_merge($this->_default_espresso_metaboxes, ['_publish_post_box']), |
|
181 | - 'help_tabs' => [ |
|
182 | - 'general_settings_admin_options_help_tab' => [ |
|
183 | - 'title' => esc_html__('Admin Options', 'event_espresso'), |
|
184 | - 'filename' => 'general_settings_admin_options', |
|
185 | - ], |
|
186 | - ], |
|
187 | - 'require_nonce' => false, |
|
188 | - ], |
|
189 | - 'country_settings' => [ |
|
190 | - 'nav' => [ |
|
191 | - 'label' => esc_html__('Countries', 'event_espresso'), |
|
192 | - 'order' => 70, |
|
193 | - ], |
|
194 | - 'help_tabs' => [ |
|
195 | - 'general_settings_countries_help_tab' => [ |
|
196 | - 'title' => esc_html__('Countries', 'event_espresso'), |
|
197 | - 'filename' => 'general_settings_countries', |
|
198 | - ], |
|
199 | - ], |
|
200 | - 'require_nonce' => false, |
|
201 | - ], |
|
202 | - 'privacy_settings' => [ |
|
203 | - 'nav' => [ |
|
204 | - 'label' => esc_html__('Privacy', 'event_espresso'), |
|
205 | - 'order' => 80, |
|
206 | - ], |
|
207 | - 'metaboxes' => array_merge($this->_default_espresso_metaboxes, ['_publish_post_box']), |
|
208 | - 'require_nonce' => false, |
|
209 | - ], |
|
210 | - ]; |
|
211 | - } |
|
212 | - |
|
213 | - |
|
214 | - protected function _add_screen_options() |
|
215 | - { |
|
216 | - } |
|
217 | - |
|
218 | - |
|
219 | - protected function _add_feature_pointers() |
|
220 | - { |
|
221 | - } |
|
222 | - |
|
223 | - |
|
224 | - /** |
|
225 | - * Enqueue global scripts and styles for all routes in the General Settings Admin Pages. |
|
226 | - */ |
|
227 | - public function load_scripts_styles() |
|
228 | - { |
|
229 | - // styles |
|
230 | - wp_enqueue_style('espresso-ui-theme'); |
|
231 | - // scripts |
|
232 | - wp_enqueue_script('ee_admin_js'); |
|
233 | - } |
|
234 | - |
|
235 | - |
|
236 | - /** |
|
237 | - * Execute logic running on `admin_init` |
|
238 | - */ |
|
239 | - public function admin_init() |
|
240 | - { |
|
241 | - $this->core_config = EE_Registry::instance()->CFG->core; |
|
242 | - |
|
243 | - EE_Registry::$i18n_js_strings['invalid_server_response'] = wp_strip_all_tags( |
|
244 | - esc_html__( |
|
245 | - 'An error occurred! Your request may have been processed, but a valid response from the server was not received. Please refresh the page and try again.', |
|
246 | - 'event_espresso' |
|
247 | - ) |
|
248 | - ); |
|
249 | - EE_Registry::$i18n_js_strings['error_occurred'] = wp_strip_all_tags( |
|
250 | - esc_html__( |
|
251 | - 'An error occurred! Please refresh the page and try again.', |
|
252 | - 'event_espresso' |
|
253 | - ) |
|
254 | - ); |
|
255 | - EE_Registry::$i18n_js_strings['confirm_delete_state'] = wp_strip_all_tags( |
|
256 | - esc_html__( |
|
257 | - 'Are you sure you want to delete this State / Province?', |
|
258 | - 'event_espresso' |
|
259 | - ) |
|
260 | - ); |
|
261 | - EE_Registry::$i18n_js_strings['ajax_url'] = admin_url( |
|
262 | - 'admin-ajax.php?page=espresso_general_settings', |
|
263 | - is_ssl() ? 'https://' : 'http://' |
|
264 | - ); |
|
265 | - } |
|
266 | - |
|
267 | - |
|
268 | - public function admin_notices() |
|
269 | - { |
|
270 | - } |
|
271 | - |
|
272 | - |
|
273 | - public function admin_footer_scripts() |
|
274 | - { |
|
275 | - } |
|
276 | - |
|
277 | - |
|
278 | - /** |
|
279 | - * Enqueue scripts and styles for the default route. |
|
280 | - */ |
|
281 | - public function load_scripts_styles_default() |
|
282 | - { |
|
283 | - // styles |
|
284 | - wp_enqueue_style('thickbox'); |
|
285 | - // scripts |
|
286 | - wp_enqueue_script('media-upload'); |
|
287 | - wp_enqueue_script('thickbox'); |
|
288 | - wp_register_script( |
|
289 | - 'organization_settings', |
|
290 | - GEN_SET_ASSETS_URL . 'your_organization_settings.js', |
|
291 | - ['jquery', 'media-upload', 'thickbox'], |
|
292 | - EVENT_ESPRESSO_VERSION, |
|
293 | - true |
|
294 | - ); |
|
295 | - wp_register_style('organization-css', GEN_SET_ASSETS_URL . 'organization.css', [], EVENT_ESPRESSO_VERSION); |
|
296 | - wp_enqueue_script('organization_settings'); |
|
297 | - wp_enqueue_style('organization-css'); |
|
298 | - $confirm_image_delete = [ |
|
299 | - 'text' => wp_strip_all_tags( |
|
300 | - esc_html__( |
|
301 | - 'Do you really want to delete this image? Please remember to save your settings to complete the removal.', |
|
302 | - 'event_espresso' |
|
303 | - ) |
|
304 | - ), |
|
305 | - ]; |
|
306 | - wp_localize_script('organization_settings', 'confirm_image_delete', $confirm_image_delete); |
|
307 | - } |
|
308 | - |
|
309 | - |
|
310 | - /** |
|
311 | - * Enqueue scripts and styles for the country settings route. |
|
312 | - */ |
|
313 | - public function load_scripts_styles_country_settings() |
|
314 | - { |
|
315 | - // scripts |
|
316 | - wp_register_script( |
|
317 | - 'gen_settings_countries', |
|
318 | - GEN_SET_ASSETS_URL . 'gen_settings_countries.js', |
|
319 | - ['ee_admin_js'], |
|
320 | - EVENT_ESPRESSO_VERSION, |
|
321 | - true |
|
322 | - ); |
|
323 | - wp_register_style('organization-css', GEN_SET_ASSETS_URL . 'organization.css', [], EVENT_ESPRESSO_VERSION); |
|
324 | - wp_enqueue_script('gen_settings_countries'); |
|
325 | - wp_enqueue_style('organization-css'); |
|
326 | - } |
|
327 | - |
|
328 | - |
|
329 | - /************* Espresso Pages *************/ |
|
330 | - /** |
|
331 | - * _espresso_page_settings |
|
332 | - * |
|
333 | - * @throws EE_Error |
|
334 | - * @throws DomainException |
|
335 | - * @throws DomainException |
|
336 | - * @throws InvalidDataTypeException |
|
337 | - * @throws InvalidArgumentException |
|
338 | - */ |
|
339 | - protected function _espresso_page_settings() |
|
340 | - { |
|
341 | - // Check to make sure all of the main pages are set up properly, |
|
342 | - // if not create the default pages and display an admin notice |
|
343 | - EEH_Activation::verify_default_pages_exist(); |
|
344 | - $this->_transient_garbage_collection(); |
|
345 | - |
|
346 | - $this->_template_args['values'] = $this->_yes_no_values; |
|
347 | - |
|
348 | - $this->_template_args['reg_page_id'] = $this->core_config->reg_page_id ?? null; |
|
349 | - $this->_template_args['reg_page_obj'] = isset($this->core_config->reg_page_id) |
|
350 | - ? get_post($this->core_config->reg_page_id) |
|
351 | - : false; |
|
352 | - |
|
353 | - $this->_template_args['txn_page_id'] = $this->core_config->txn_page_id ?? null; |
|
354 | - $this->_template_args['txn_page_obj'] = isset($this->core_config->txn_page_id) |
|
355 | - ? get_post($this->core_config->txn_page_id) |
|
356 | - : false; |
|
357 | - |
|
358 | - $this->_template_args['thank_you_page_id'] = $this->core_config->thank_you_page_id ?? null; |
|
359 | - $this->_template_args['thank_you_page_obj'] = isset($this->core_config->thank_you_page_id) |
|
360 | - ? get_post($this->core_config->thank_you_page_id) |
|
361 | - : false; |
|
362 | - |
|
363 | - $this->_template_args['cancel_page_id'] = $this->core_config->cancel_page_id ?? null; |
|
364 | - $this->_template_args['cancel_page_obj'] = isset($this->core_config->cancel_page_id) |
|
365 | - ? get_post($this->core_config->cancel_page_id) |
|
366 | - : false; |
|
367 | - |
|
368 | - $this->_set_add_edit_form_tags('update_espresso_page_settings'); |
|
369 | - $this->_set_publish_post_box_vars(null, false, false, null, false); |
|
370 | - $this->_template_args['admin_page_content'] = EEH_Template::display_template( |
|
371 | - GEN_SET_TEMPLATE_PATH . 'espresso_page_settings.template.php', |
|
372 | - $this->_template_args, |
|
373 | - true |
|
374 | - ); |
|
375 | - $this->display_admin_page_with_sidebar(); |
|
376 | - } |
|
377 | - |
|
378 | - |
|
379 | - /** |
|
380 | - * Handler for updating espresso page settings. |
|
381 | - * |
|
382 | - * @throws EE_Error |
|
383 | - */ |
|
384 | - protected function _update_espresso_page_settings() |
|
385 | - { |
|
22 | + /** |
|
23 | + * @var EE_Core_Config |
|
24 | + */ |
|
25 | + public $core_config; |
|
26 | + |
|
27 | + |
|
28 | + /** |
|
29 | + * Initialize basic properties. |
|
30 | + */ |
|
31 | + protected function _init_page_props() |
|
32 | + { |
|
33 | + $this->page_slug = GEN_SET_PG_SLUG; |
|
34 | + $this->page_label = GEN_SET_LABEL; |
|
35 | + $this->_admin_base_url = GEN_SET_ADMIN_URL; |
|
36 | + $this->_admin_base_path = GEN_SET_ADMIN; |
|
37 | + } |
|
38 | + |
|
39 | + |
|
40 | + /** |
|
41 | + * Set ajax hooks |
|
42 | + */ |
|
43 | + protected function _ajax_hooks() |
|
44 | + { |
|
45 | + add_action('wp_ajax_espresso_display_country_settings', [$this, 'display_country_settings']); |
|
46 | + add_action('wp_ajax_espresso_display_country_states', [$this, 'display_country_states']); |
|
47 | + add_action('wp_ajax_espresso_delete_state', [$this, 'delete_state'], 10, 3); |
|
48 | + add_action('wp_ajax_espresso_add_new_state', [$this, 'add_new_state']); |
|
49 | + } |
|
50 | + |
|
51 | + |
|
52 | + /** |
|
53 | + * More page properties initialization. |
|
54 | + */ |
|
55 | + protected function _define_page_props() |
|
56 | + { |
|
57 | + $this->_admin_page_title = GEN_SET_LABEL; |
|
58 | + $this->_labels = ['publishbox' => esc_html__('Update Settings', 'event_espresso')]; |
|
59 | + } |
|
60 | + |
|
61 | + |
|
62 | + /** |
|
63 | + * Set page routes property. |
|
64 | + */ |
|
65 | + protected function _set_page_routes() |
|
66 | + { |
|
67 | + $this->_page_routes = [ |
|
68 | + 'critical_pages' => [ |
|
69 | + 'func' => '_espresso_page_settings', |
|
70 | + 'capability' => 'manage_options', |
|
71 | + ], |
|
72 | + 'update_espresso_page_settings' => [ |
|
73 | + 'func' => '_update_espresso_page_settings', |
|
74 | + 'capability' => 'manage_options', |
|
75 | + 'noheader' => true, |
|
76 | + ], |
|
77 | + 'default' => [ |
|
78 | + 'func' => '_your_organization_settings', |
|
79 | + 'capability' => 'manage_options', |
|
80 | + ], |
|
81 | + |
|
82 | + 'update_your_organization_settings' => [ |
|
83 | + 'func' => '_update_your_organization_settings', |
|
84 | + 'capability' => 'manage_options', |
|
85 | + 'noheader' => true, |
|
86 | + ], |
|
87 | + |
|
88 | + 'admin_option_settings' => [ |
|
89 | + 'func' => '_admin_option_settings', |
|
90 | + 'capability' => 'manage_options', |
|
91 | + ], |
|
92 | + |
|
93 | + 'update_admin_option_settings' => [ |
|
94 | + 'func' => '_update_admin_option_settings', |
|
95 | + 'capability' => 'manage_options', |
|
96 | + 'noheader' => true, |
|
97 | + ], |
|
98 | + |
|
99 | + 'country_settings' => [ |
|
100 | + 'func' => '_country_settings', |
|
101 | + 'capability' => 'manage_options', |
|
102 | + ], |
|
103 | + |
|
104 | + 'update_country_settings' => [ |
|
105 | + 'func' => '_update_country_settings', |
|
106 | + 'capability' => 'manage_options', |
|
107 | + 'noheader' => true, |
|
108 | + ], |
|
109 | + |
|
110 | + 'display_country_settings' => [ |
|
111 | + 'func' => 'display_country_settings', |
|
112 | + 'capability' => 'manage_options', |
|
113 | + 'noheader' => true, |
|
114 | + ], |
|
115 | + |
|
116 | + 'add_new_state' => [ |
|
117 | + 'func' => 'add_new_state', |
|
118 | + 'capability' => 'manage_options', |
|
119 | + 'noheader' => true, |
|
120 | + ], |
|
121 | + |
|
122 | + 'delete_state' => [ |
|
123 | + 'func' => 'delete_state', |
|
124 | + 'capability' => 'manage_options', |
|
125 | + 'noheader' => true, |
|
126 | + ], |
|
127 | + 'privacy_settings' => [ |
|
128 | + 'func' => 'privacySettings', |
|
129 | + 'capability' => 'manage_options', |
|
130 | + ], |
|
131 | + 'update_privacy_settings' => [ |
|
132 | + 'func' => 'updatePrivacySettings', |
|
133 | + 'capability' => 'manage_options', |
|
134 | + 'noheader' => true, |
|
135 | + 'headers_sent_route' => 'privacy_settings', |
|
136 | + ], |
|
137 | + ]; |
|
138 | + } |
|
139 | + |
|
140 | + |
|
141 | + /** |
|
142 | + * Set page configuration property |
|
143 | + */ |
|
144 | + protected function _set_page_config() |
|
145 | + { |
|
146 | + $this->_page_config = [ |
|
147 | + 'critical_pages' => [ |
|
148 | + 'nav' => [ |
|
149 | + 'label' => esc_html__('Critical Pages', 'event_espresso'), |
|
150 | + 'order' => 50, |
|
151 | + ], |
|
152 | + 'metaboxes' => array_merge($this->_default_espresso_metaboxes, ['_publish_post_box']), |
|
153 | + 'help_tabs' => [ |
|
154 | + 'general_settings_critical_pages_help_tab' => [ |
|
155 | + 'title' => esc_html__('Critical Pages', 'event_espresso'), |
|
156 | + 'filename' => 'general_settings_critical_pages', |
|
157 | + ], |
|
158 | + ], |
|
159 | + 'require_nonce' => false, |
|
160 | + ], |
|
161 | + 'default' => [ |
|
162 | + 'nav' => [ |
|
163 | + 'label' => esc_html__('Your Organization', 'event_espresso'), |
|
164 | + 'order' => 20, |
|
165 | + ], |
|
166 | + 'help_tabs' => [ |
|
167 | + 'general_settings_your_organization_help_tab' => [ |
|
168 | + 'title' => esc_html__('Your Organization', 'event_espresso'), |
|
169 | + 'filename' => 'general_settings_your_organization', |
|
170 | + ], |
|
171 | + ], |
|
172 | + 'metaboxes' => array_merge($this->_default_espresso_metaboxes, ['_publish_post_box']), |
|
173 | + 'require_nonce' => false, |
|
174 | + ], |
|
175 | + 'admin_option_settings' => [ |
|
176 | + 'nav' => [ |
|
177 | + 'label' => esc_html__('Admin Options', 'event_espresso'), |
|
178 | + 'order' => 60, |
|
179 | + ], |
|
180 | + 'metaboxes' => array_merge($this->_default_espresso_metaboxes, ['_publish_post_box']), |
|
181 | + 'help_tabs' => [ |
|
182 | + 'general_settings_admin_options_help_tab' => [ |
|
183 | + 'title' => esc_html__('Admin Options', 'event_espresso'), |
|
184 | + 'filename' => 'general_settings_admin_options', |
|
185 | + ], |
|
186 | + ], |
|
187 | + 'require_nonce' => false, |
|
188 | + ], |
|
189 | + 'country_settings' => [ |
|
190 | + 'nav' => [ |
|
191 | + 'label' => esc_html__('Countries', 'event_espresso'), |
|
192 | + 'order' => 70, |
|
193 | + ], |
|
194 | + 'help_tabs' => [ |
|
195 | + 'general_settings_countries_help_tab' => [ |
|
196 | + 'title' => esc_html__('Countries', 'event_espresso'), |
|
197 | + 'filename' => 'general_settings_countries', |
|
198 | + ], |
|
199 | + ], |
|
200 | + 'require_nonce' => false, |
|
201 | + ], |
|
202 | + 'privacy_settings' => [ |
|
203 | + 'nav' => [ |
|
204 | + 'label' => esc_html__('Privacy', 'event_espresso'), |
|
205 | + 'order' => 80, |
|
206 | + ], |
|
207 | + 'metaboxes' => array_merge($this->_default_espresso_metaboxes, ['_publish_post_box']), |
|
208 | + 'require_nonce' => false, |
|
209 | + ], |
|
210 | + ]; |
|
211 | + } |
|
212 | + |
|
213 | + |
|
214 | + protected function _add_screen_options() |
|
215 | + { |
|
216 | + } |
|
217 | + |
|
218 | + |
|
219 | + protected function _add_feature_pointers() |
|
220 | + { |
|
221 | + } |
|
222 | + |
|
223 | + |
|
224 | + /** |
|
225 | + * Enqueue global scripts and styles for all routes in the General Settings Admin Pages. |
|
226 | + */ |
|
227 | + public function load_scripts_styles() |
|
228 | + { |
|
229 | + // styles |
|
230 | + wp_enqueue_style('espresso-ui-theme'); |
|
231 | + // scripts |
|
232 | + wp_enqueue_script('ee_admin_js'); |
|
233 | + } |
|
234 | + |
|
235 | + |
|
236 | + /** |
|
237 | + * Execute logic running on `admin_init` |
|
238 | + */ |
|
239 | + public function admin_init() |
|
240 | + { |
|
386 | 241 | $this->core_config = EE_Registry::instance()->CFG->core; |
387 | - // capture incoming request data && set page IDs |
|
388 | - $this->core_config->reg_page_id = $this->request->getRequestParam( |
|
389 | - 'reg_page_id', |
|
390 | - $this->core_config->reg_page_id, |
|
391 | - DataType::INT |
|
392 | - ); |
|
393 | - $this->core_config->txn_page_id = $this->request->getRequestParam( |
|
394 | - 'txn_page_id', |
|
395 | - $this->core_config->txn_page_id, |
|
396 | - DataType::INT |
|
397 | - ); |
|
398 | - $this->core_config->thank_you_page_id = $this->request->getRequestParam( |
|
399 | - 'thank_you_page_id', |
|
400 | - $this->core_config->thank_you_page_id, |
|
401 | - DataType::INT |
|
402 | - ); |
|
403 | - $this->core_config->cancel_page_id = $this->request->getRequestParam( |
|
404 | - 'cancel_page_id', |
|
405 | - $this->core_config->cancel_page_id, |
|
406 | - DataType::INT |
|
407 | - ); |
|
408 | - |
|
409 | - $this->core_config = apply_filters( |
|
410 | - 'FHEE__General_Settings_Admin_Page___update_espresso_page_settings__CFG_core', |
|
411 | - $this->core_config, |
|
412 | - $this->request->requestParams() |
|
413 | - ); |
|
414 | - |
|
415 | - $what = esc_html__('Critical Pages & Shortcodes', 'event_espresso'); |
|
416 | - $this->_redirect_after_action( |
|
417 | - $this->_update_espresso_configuration( |
|
418 | - $what, |
|
419 | - $this->core_config, |
|
420 | - __FILE__, |
|
421 | - __FUNCTION__, |
|
422 | - __LINE__ |
|
423 | - ), |
|
424 | - $what, |
|
425 | - '', |
|
426 | - [ |
|
427 | - 'action' => 'critical_pages', |
|
428 | - ], |
|
429 | - true |
|
430 | - ); |
|
431 | - } |
|
432 | - |
|
433 | - |
|
434 | - /************* Your Organization *************/ |
|
435 | - |
|
436 | - |
|
437 | - /** |
|
438 | - * @throws DomainException |
|
439 | - * @throws EE_Error |
|
440 | - * @throws InvalidArgumentException |
|
441 | - * @throws InvalidDataTypeException |
|
442 | - * @throws InvalidInterfaceException |
|
443 | - */ |
|
444 | - protected function _your_organization_settings() |
|
445 | - { |
|
446 | - $this->_template_args['admin_page_content'] = ''; |
|
447 | - try { |
|
448 | - /** @var OrganizationSettings $organization_settings_form */ |
|
449 | - $organization_settings_form = $this->loader->getShared(OrganizationSettings::class); |
|
450 | - |
|
451 | - $this->_template_args['admin_page_content'] = EEH_HTML::div( |
|
452 | - $organization_settings_form->display(), |
|
453 | - '', |
|
454 | - 'padding' |
|
455 | - ); |
|
456 | - } catch (Exception $e) { |
|
457 | - EE_Error::add_error($e->getMessage(), __FILE__, __FUNCTION__, __LINE__); |
|
458 | - } |
|
459 | - $this->_set_add_edit_form_tags('update_your_organization_settings'); |
|
460 | - $this->_set_publish_post_box_vars(null, false, false, null, false); |
|
461 | - $this->display_admin_page_with_sidebar(); |
|
462 | - } |
|
463 | - |
|
464 | - |
|
465 | - /** |
|
466 | - * Handler for updating organization settings. |
|
467 | - * |
|
468 | - * @throws EE_Error |
|
469 | - */ |
|
470 | - protected function _update_your_organization_settings() |
|
471 | - { |
|
472 | - try { |
|
473 | - /** @var OrganizationSettings $organization_settings_form */ |
|
474 | - $organization_settings_form = $this->loader->getShared(OrganizationSettings::class); |
|
475 | - |
|
476 | - $success = $organization_settings_form->process($this->request->requestParams()); |
|
477 | - |
|
478 | - EE_Registry::instance()->CFG = apply_filters( |
|
479 | - 'FHEE__General_Settings_Admin_Page___update_your_organization_settings__CFG', |
|
480 | - EE_Registry::instance()->CFG |
|
481 | - ); |
|
482 | - } catch (Exception $e) { |
|
483 | - EE_Error::add_error($e->getMessage(), __FILE__, __FUNCTION__, __LINE__); |
|
484 | - $success = false; |
|
485 | - } |
|
486 | - |
|
487 | - if ($success) { |
|
488 | - $success = $this->_update_espresso_configuration( |
|
489 | - esc_html__('Your Organization Settings', 'event_espresso'), |
|
490 | - EE_Registry::instance()->CFG, |
|
491 | - __FILE__, |
|
492 | - __FUNCTION__, |
|
493 | - __LINE__ |
|
494 | - ); |
|
495 | - } |
|
496 | - |
|
497 | - $this->_redirect_after_action($success, '', '', ['action' => 'default'], true); |
|
498 | - } |
|
499 | - |
|
500 | - |
|
501 | - |
|
502 | - /************* Admin Options *************/ |
|
503 | - |
|
504 | - |
|
505 | - /** |
|
506 | - * _admin_option_settings |
|
507 | - * |
|
508 | - * @throws EE_Error |
|
509 | - * @throws LogicException |
|
510 | - */ |
|
511 | - protected function _admin_option_settings() |
|
512 | - { |
|
513 | - $this->_template_args['admin_page_content'] = ''; |
|
514 | - try { |
|
515 | - $admin_options_settings_form = new AdminOptionsSettings(EE_Registry::instance()); |
|
516 | - // still need this for the old school form in Extend_General_Settings_Admin_Page |
|
517 | - $this->_template_args['values'] = $this->_yes_no_values; |
|
518 | - // also need to account for the do_action that was in the old template |
|
519 | - $admin_options_settings_form->setTemplateArgs($this->_template_args); |
|
520 | - $this->_template_args['admin_page_content'] = EEH_HTML::div( |
|
521 | - $admin_options_settings_form->display(), |
|
522 | - '', |
|
523 | - 'padding' |
|
524 | - ); |
|
525 | - } catch (Exception $e) { |
|
526 | - EE_Error::add_error($e->getMessage(), __FILE__, __FUNCTION__, __LINE__); |
|
527 | - } |
|
528 | - $this->_set_add_edit_form_tags('update_admin_option_settings'); |
|
529 | - $this->_set_publish_post_box_vars(null, false, false, null, false); |
|
530 | - $this->display_admin_page_with_sidebar(); |
|
531 | - } |
|
532 | - |
|
533 | - |
|
534 | - /** |
|
535 | - * _update_admin_option_settings |
|
536 | - * |
|
537 | - * @throws EE_Error |
|
538 | - * @throws InvalidDataTypeException |
|
539 | - * @throws InvalidFormSubmissionException |
|
540 | - * @throws InvalidArgumentException |
|
541 | - * @throws LogicException |
|
542 | - */ |
|
543 | - protected function _update_admin_option_settings() |
|
544 | - { |
|
545 | - try { |
|
546 | - $admin_options_settings_form = new AdminOptionsSettings(EE_Registry::instance()); |
|
547 | - $admin_options_settings_form->process( |
|
548 | - $this->request->getRequestParam( |
|
549 | - $admin_options_settings_form->slug(), |
|
550 | - [], |
|
551 | - DataType::STRING, |
|
552 | - true |
|
553 | - ) |
|
554 | - ); |
|
555 | - EE_Registry::instance()->CFG->admin = apply_filters( |
|
556 | - 'FHEE__General_Settings_Admin_Page___update_admin_option_settings__CFG_admin', |
|
557 | - EE_Registry::instance()->CFG->admin |
|
558 | - ); |
|
559 | - } catch (Exception $e) { |
|
560 | - EE_Error::add_error($e->getMessage(), __FILE__, __FUNCTION__, __LINE__); |
|
561 | - } |
|
562 | - $this->_redirect_after_action( |
|
563 | - apply_filters( |
|
564 | - 'FHEE__General_Settings_Admin_Page___update_admin_option_settings__success', |
|
565 | - $this->_update_espresso_configuration( |
|
566 | - esc_html__('Admin Options', 'event_espresso'), |
|
567 | - EE_Registry::instance()->CFG->admin, |
|
568 | - __FILE__, |
|
569 | - __FUNCTION__, |
|
570 | - __LINE__ |
|
571 | - ) |
|
572 | - ), |
|
573 | - esc_html__('Admin Options', 'event_espresso'), |
|
574 | - 'updated', |
|
575 | - ['action' => 'admin_option_settings'] |
|
576 | - ); |
|
577 | - } |
|
578 | - |
|
579 | - |
|
580 | - /************* Countries *************/ |
|
581 | - |
|
582 | - |
|
583 | - /** |
|
584 | - * @param string|null $default |
|
585 | - * @return string |
|
586 | - */ |
|
587 | - protected function getCountryISO(?string $default = null): string |
|
588 | - { |
|
589 | - $default = $default ?? $this->getCountryIsoForSite(); |
|
590 | - $CNT_ISO = $this->request->getRequestParam('country', $default); |
|
591 | - return strtoupper($CNT_ISO); |
|
592 | - } |
|
593 | - |
|
594 | - |
|
595 | - /** |
|
596 | - * @return string |
|
597 | - */ |
|
598 | - protected function getCountryIsoForSite(): string |
|
599 | - { |
|
600 | - return ! empty(EE_Registry::instance()->CFG->organization->CNT_ISO) |
|
601 | - ? EE_Registry::instance()->CFG->organization->CNT_ISO |
|
602 | - : 'US'; |
|
603 | - } |
|
604 | - |
|
605 | - |
|
606 | - /** |
|
607 | - * @param string $CNT_ISO |
|
608 | - * @param EE_Country|null $country |
|
609 | - * @return EE_Base_Class|EE_Country |
|
610 | - * @throws EE_Error |
|
611 | - * @throws InvalidArgumentException |
|
612 | - * @throws InvalidDataTypeException |
|
613 | - * @throws InvalidInterfaceException |
|
614 | - * @throws ReflectionException |
|
615 | - */ |
|
616 | - protected function verifyOrGetCountryFromIso(string $CNT_ISO, ?EE_Country $country = null) |
|
617 | - { |
|
618 | - /** @var EE_Country $country */ |
|
619 | - return $country instanceof EE_Country && $country->ID() === $CNT_ISO |
|
620 | - ? $country |
|
621 | - : EEM_Country::instance()->get_one_by_ID($CNT_ISO); |
|
622 | - } |
|
623 | - |
|
624 | - |
|
625 | - /** |
|
626 | - * Output Country Settings view. |
|
627 | - * |
|
628 | - * @throws DomainException |
|
629 | - * @throws EE_Error |
|
630 | - * @throws InvalidArgumentException |
|
631 | - * @throws InvalidDataTypeException |
|
632 | - * @throws InvalidInterfaceException |
|
633 | - * @throws ReflectionException |
|
634 | - */ |
|
635 | - protected function _country_settings() |
|
636 | - { |
|
637 | - $CNT_ISO = $this->getCountryISO(); |
|
638 | - |
|
639 | - $this->_template_args['values'] = $this->_yes_no_values; |
|
640 | - $this->_template_args['countries'] = new EE_Question_Form_Input( |
|
641 | - EE_Question::new_instance( |
|
642 | - [ |
|
643 | - 'QST_ID' => 0, |
|
644 | - 'QST_display_text' => esc_html__('Select Country', 'event_espresso'), |
|
645 | - 'QST_system' => 'admin-country', |
|
646 | - ] |
|
647 | - ), |
|
648 | - EE_Answer::new_instance( |
|
649 | - [ |
|
650 | - 'ANS_ID' => 0, |
|
651 | - 'ANS_value' => $CNT_ISO, |
|
652 | - ] |
|
653 | - ), |
|
654 | - [ |
|
655 | - 'input_id' => 'country', |
|
656 | - 'input_name' => 'country', |
|
657 | - 'input_prefix' => '', |
|
658 | - 'append_qstn_id' => false, |
|
659 | - ] |
|
660 | - ); |
|
661 | - |
|
662 | - $country = $this->verifyOrGetCountryFromIso($CNT_ISO); |
|
663 | - add_filter('FHEE__EEH_Form_Fields__label_html', [$this, 'country_form_field_label_wrap'], 10); |
|
664 | - add_filter('FHEE__EEH_Form_Fields__input_html', [$this, 'country_form_field_input__wrap'], 10); |
|
665 | - $this->_template_args['country_details_settings'] = $this->display_country_settings( |
|
666 | - $country->ID(), |
|
667 | - $country |
|
668 | - ); |
|
669 | - $this->_template_args['country_states_settings'] = $this->display_country_states( |
|
670 | - $country->ID(), |
|
671 | - $country |
|
672 | - ); |
|
673 | - $this->_template_args['CNT_name_for_site'] = $country->name(); |
|
674 | - |
|
675 | - $this->_set_add_edit_form_tags('update_country_settings'); |
|
676 | - $this->_set_publish_post_box_vars(null, false, false, null, false); |
|
677 | - $this->_template_args['admin_page_content'] = EEH_Template::display_template( |
|
678 | - GEN_SET_TEMPLATE_PATH . 'countries_settings.template.php', |
|
679 | - $this->_template_args, |
|
680 | - true |
|
681 | - ); |
|
682 | - $this->display_admin_page_with_no_sidebar(); |
|
683 | - } |
|
684 | - |
|
685 | - |
|
686 | - /** |
|
687 | - * @param string $CNT_ISO |
|
688 | - * @param EE_Country|null $country |
|
689 | - * @return string |
|
690 | - * @throws DomainException |
|
691 | - * @throws EE_Error |
|
692 | - * @throws InvalidArgumentException |
|
693 | - * @throws InvalidDataTypeException |
|
694 | - * @throws InvalidInterfaceException |
|
695 | - * @throws ReflectionException |
|
696 | - */ |
|
697 | - public function display_country_settings(string $CNT_ISO = '', ?EE_Country $country = null): string |
|
698 | - { |
|
699 | - $CNT_ISO = $this->getCountryISO($CNT_ISO); |
|
700 | - $CNT_ISO_for_site = $this->getCountryIsoForSite(); |
|
701 | - |
|
702 | - if (! $CNT_ISO) { |
|
703 | - return ''; |
|
704 | - } |
|
705 | - |
|
706 | - // for ajax |
|
707 | - remove_all_filters('FHEE__EEH_Form_Fields__label_html'); |
|
708 | - remove_all_filters('FHEE__EEH_Form_Fields__input_html'); |
|
709 | - add_filter('FHEE__EEH_Form_Fields__label_html', [$this, 'country_form_field_label_wrap'], 10, 2); |
|
710 | - add_filter('FHEE__EEH_Form_Fields__input_html', [$this, 'country_form_field_input__wrap'], 10, 2); |
|
711 | - $country = $this->verifyOrGetCountryFromIso($CNT_ISO, $country); |
|
712 | - $CNT_cur_disabled = $CNT_ISO !== $CNT_ISO_for_site; |
|
713 | - $this->_template_args['CNT_cur_disabled'] = $CNT_cur_disabled; |
|
714 | - |
|
715 | - $country_input_types = [ |
|
716 | - 'CNT_active' => [ |
|
717 | - 'type' => 'RADIO_BTN', |
|
718 | - 'input_name' => "cntry[$CNT_ISO]", |
|
719 | - 'class' => '', |
|
720 | - 'options' => $this->_yes_no_values, |
|
721 | - 'use_desc_4_label' => true, |
|
722 | - ], |
|
723 | - 'CNT_ISO' => [ |
|
724 | - 'type' => 'TEXT', |
|
725 | - 'input_name' => "cntry[$CNT_ISO]", |
|
726 | - 'class' => 'ee-input-width--small', |
|
727 | - ], |
|
728 | - 'CNT_ISO3' => [ |
|
729 | - 'type' => 'TEXT', |
|
730 | - 'input_name' => "cntry[$CNT_ISO]", |
|
731 | - 'class' => 'ee-input-width--small', |
|
732 | - ], |
|
733 | - // 'RGN_ID' => [ |
|
734 | - // 'type' => 'TEXT', |
|
735 | - // 'input_name' => "cntry[$CNT_ISO]", |
|
736 | - // 'class' => 'ee-input-width--small', |
|
737 | - // ], |
|
738 | - 'CNT_name' => [ |
|
739 | - 'type' => 'TEXT', |
|
740 | - 'input_name' => "cntry[$CNT_ISO]", |
|
741 | - 'class' => 'ee-input-width--big', |
|
742 | - ], |
|
743 | - 'CNT_cur_code' => [ |
|
744 | - 'type' => 'TEXT', |
|
745 | - 'input_name' => "cntry[$CNT_ISO]", |
|
746 | - 'class' => 'ee-input-width--small', |
|
747 | - 'disabled' => $CNT_cur_disabled, |
|
748 | - ], |
|
749 | - 'CNT_cur_single' => [ |
|
750 | - 'type' => 'TEXT', |
|
751 | - 'input_name' => "cntry[$CNT_ISO]", |
|
752 | - 'class' => 'ee-input-width--reg', |
|
753 | - 'disabled' => $CNT_cur_disabled, |
|
754 | - ], |
|
755 | - 'CNT_cur_plural' => [ |
|
756 | - 'type' => 'TEXT', |
|
757 | - 'input_name' => "cntry[$CNT_ISO]", |
|
758 | - 'class' => 'ee-input-width--reg', |
|
759 | - 'disabled' => $CNT_cur_disabled, |
|
760 | - ], |
|
761 | - 'CNT_cur_sign' => [ |
|
762 | - 'type' => 'TEXT', |
|
763 | - 'input_name' => "cntry[$CNT_ISO]", |
|
764 | - 'class' => 'ee-input-width--small', |
|
765 | - 'htmlentities' => false, |
|
766 | - 'disabled' => $CNT_cur_disabled, |
|
767 | - ], |
|
768 | - 'CNT_cur_sign_b4' => [ |
|
769 | - 'type' => 'RADIO_BTN', |
|
770 | - 'input_name' => "cntry[$CNT_ISO]", |
|
771 | - 'class' => '', |
|
772 | - 'options' => $this->_yes_no_values, |
|
773 | - 'use_desc_4_label' => true, |
|
774 | - 'disabled' => $CNT_cur_disabled, |
|
775 | - ], |
|
776 | - 'CNT_cur_dec_plc' => [ |
|
777 | - 'type' => 'RADIO_BTN', |
|
778 | - 'input_name' => "cntry[$CNT_ISO]", |
|
779 | - 'class' => '', |
|
780 | - 'options' => [ |
|
781 | - ['id' => 0, 'text' => ''], |
|
782 | - ['id' => 1, 'text' => ''], |
|
783 | - ['id' => 2, 'text' => ''], |
|
784 | - ['id' => 3, 'text' => ''], |
|
785 | - ], |
|
786 | - 'disabled' => $CNT_cur_disabled, |
|
787 | - ], |
|
788 | - 'CNT_cur_dec_mrk' => [ |
|
789 | - 'type' => 'RADIO_BTN', |
|
790 | - 'input_name' => "cntry[$CNT_ISO]", |
|
791 | - 'class' => '', |
|
792 | - 'options' => [ |
|
793 | - [ |
|
794 | - 'id' => ',', |
|
795 | - 'text' => esc_html__(', (comma)', 'event_espresso'), |
|
796 | - ], |
|
797 | - ['id' => '.', 'text' => esc_html__('. (decimal)', 'event_espresso')], |
|
798 | - ], |
|
799 | - 'use_desc_4_label' => true, |
|
800 | - 'disabled' => $CNT_cur_disabled, |
|
801 | - ], |
|
802 | - 'CNT_cur_thsnds' => [ |
|
803 | - 'type' => 'RADIO_BTN', |
|
804 | - 'input_name' => "cntry[$CNT_ISO]", |
|
805 | - 'class' => '', |
|
806 | - 'options' => [ |
|
807 | - [ |
|
808 | - 'id' => ',', |
|
809 | - 'text' => esc_html__(', (comma)', 'event_espresso'), |
|
810 | - ], |
|
811 | - [ |
|
812 | - 'id' => '.', |
|
813 | - 'text' => esc_html__('. (decimal)', 'event_espresso'), |
|
814 | - ], |
|
815 | - [ |
|
816 | - 'id' => ' ', |
|
817 | - 'text' => esc_html__('(space)', 'event_espresso'), |
|
818 | - ], |
|
819 | - ], |
|
820 | - 'use_desc_4_label' => true, |
|
821 | - 'disabled' => $CNT_cur_disabled, |
|
822 | - ], |
|
823 | - 'CNT_tel_code' => [ |
|
824 | - 'type' => 'TEXT', |
|
825 | - 'input_name' => "cntry[$CNT_ISO]", |
|
826 | - 'class' => 'ee-input-width--small', |
|
827 | - ], |
|
828 | - 'CNT_is_EU' => [ |
|
829 | - 'type' => 'RADIO_BTN', |
|
830 | - 'input_name' => "cntry[$CNT_ISO]", |
|
831 | - 'class' => '', |
|
832 | - 'options' => $this->_yes_no_values, |
|
833 | - 'use_desc_4_label' => true, |
|
834 | - ], |
|
835 | - ]; |
|
836 | - $this->_template_args['inputs'] = EE_Question_Form_Input::generate_question_form_inputs_for_object( |
|
837 | - $country, |
|
838 | - $country_input_types |
|
839 | - ); |
|
840 | - $country_details_settings = EEH_Template::display_template( |
|
841 | - GEN_SET_TEMPLATE_PATH . 'country_details_settings.template.php', |
|
842 | - $this->_template_args, |
|
843 | - true |
|
844 | - ); |
|
845 | - |
|
846 | - if (defined('DOING_AJAX')) { |
|
847 | - $notices = EE_Error::get_notices(false, false, false); |
|
848 | - echo wp_json_encode( |
|
849 | - [ |
|
850 | - 'return_data' => $country_details_settings, |
|
851 | - 'success' => $notices['success'], |
|
852 | - 'errors' => $notices['errors'], |
|
853 | - ] |
|
854 | - ); |
|
855 | - die(); |
|
856 | - } |
|
857 | - return $country_details_settings; |
|
858 | - } |
|
859 | - |
|
860 | - |
|
861 | - /** |
|
862 | - * @param string $CNT_ISO |
|
863 | - * @param EE_Country|null $country |
|
864 | - * @return string |
|
865 | - * @throws DomainException |
|
866 | - * @throws EE_Error |
|
867 | - * @throws InvalidArgumentException |
|
868 | - * @throws InvalidDataTypeException |
|
869 | - * @throws InvalidInterfaceException |
|
870 | - * @throws ReflectionException |
|
871 | - */ |
|
872 | - public function display_country_states(string $CNT_ISO = '', ?EE_Country $country = null): string |
|
873 | - { |
|
874 | - $CNT_ISO = $this->getCountryISO($CNT_ISO); |
|
875 | - if (! $CNT_ISO) { |
|
876 | - return ''; |
|
877 | - } |
|
878 | - // for ajax |
|
879 | - remove_all_filters('FHEE__EEH_Form_Fields__label_html'); |
|
880 | - remove_all_filters('FHEE__EEH_Form_Fields__input_html'); |
|
881 | - add_filter('FHEE__EEH_Form_Fields__label_html', [$this, 'state_form_field_label_wrap'], 10, 2); |
|
882 | - add_filter('FHEE__EEH_Form_Fields__input_html', [$this, 'state_form_field_input__wrap'], 10); |
|
883 | - $states = EEM_State::instance()->get_all_states_for_these_countries([$CNT_ISO => $CNT_ISO]); |
|
884 | - if (empty($states)) { |
|
885 | - /** @var EventEspresso\core\services\address\CountrySubRegionDao $countrySubRegionDao */ |
|
886 | - $countrySubRegionDao = $this->loader->getShared( |
|
887 | - 'EventEspresso\core\services\address\CountrySubRegionDao' |
|
888 | - ); |
|
889 | - if ($countrySubRegionDao instanceof EventEspresso\core\services\address\CountrySubRegionDao) { |
|
890 | - $country = $this->verifyOrGetCountryFromIso($CNT_ISO, $country); |
|
891 | - if ($countrySubRegionDao->saveCountrySubRegions($country)) { |
|
892 | - $states = EEM_State::instance()->get_all_states_for_these_countries([$CNT_ISO => $CNT_ISO]); |
|
893 | - } |
|
894 | - } |
|
895 | - } |
|
896 | - if (is_array($states)) { |
|
897 | - foreach ($states as $STA_ID => $state) { |
|
898 | - if ($state instanceof EE_State) { |
|
899 | - $inputs = EE_Question_Form_Input::generate_question_form_inputs_for_object( |
|
900 | - $state, |
|
901 | - [ |
|
902 | - 'STA_abbrev' => [ |
|
903 | - 'type' => 'TEXT', |
|
904 | - 'label' => esc_html__('Code', 'event_espresso'), |
|
905 | - 'input_name' => "states[$STA_ID]", |
|
906 | - 'class' => 'ee-input-width--tiny', |
|
907 | - 'add_mobile_label' => true, |
|
908 | - ], |
|
909 | - 'STA_name' => [ |
|
910 | - 'type' => 'TEXT', |
|
911 | - 'label' => esc_html__('Name', 'event_espresso'), |
|
912 | - 'input_name' => "states[$STA_ID]", |
|
913 | - 'class' => 'ee-input-width--big', |
|
914 | - 'add_mobile_label' => true, |
|
915 | - ], |
|
916 | - 'STA_active' => [ |
|
917 | - 'type' => 'RADIO_BTN', |
|
918 | - 'label' => esc_html__('State Appears in Dropdown Select Lists', 'event_espresso'), |
|
919 | - 'input_name' => "states[$STA_ID]", |
|
920 | - 'options' => $this->_yes_no_values, |
|
921 | - 'use_desc_4_label' => true, |
|
922 | - 'add_mobile_label' => true, |
|
923 | - ], |
|
924 | - ] |
|
925 | - ); |
|
926 | - |
|
927 | - $delete_state_url = EE_Admin_Page::add_query_args_and_nonce( |
|
928 | - [ |
|
929 | - 'action' => 'delete_state', |
|
930 | - 'STA_ID' => $STA_ID, |
|
931 | - 'CNT_ISO' => $CNT_ISO, |
|
932 | - 'STA_abbrev' => $state->abbrev(), |
|
933 | - ], |
|
934 | - GEN_SET_ADMIN_URL |
|
935 | - ); |
|
936 | - |
|
937 | - $this->_template_args['states'][ $STA_ID ]['inputs'] = $inputs; |
|
938 | - $this->_template_args['states'][ $STA_ID ]['delete_state_url'] = $delete_state_url; |
|
939 | - } |
|
940 | - } |
|
941 | - } else { |
|
942 | - $this->_template_args['states'] = false; |
|
943 | - } |
|
944 | - |
|
945 | - $this->_template_args['add_new_state_url'] = EE_Admin_Page::add_query_args_and_nonce( |
|
946 | - ['action' => 'add_new_state'], |
|
947 | - GEN_SET_ADMIN_URL |
|
948 | - ); |
|
949 | - |
|
950 | - $state_details_settings = EEH_Template::display_template( |
|
951 | - GEN_SET_TEMPLATE_PATH . 'state_details_settings.template.php', |
|
952 | - $this->_template_args, |
|
953 | - true |
|
954 | - ); |
|
955 | - |
|
956 | - if (defined('DOING_AJAX')) { |
|
957 | - $notices = EE_Error::get_notices(false, false, false); |
|
958 | - echo wp_json_encode( |
|
959 | - [ |
|
960 | - 'return_data' => $state_details_settings, |
|
961 | - 'success' => $notices['success'], |
|
962 | - 'errors' => $notices['errors'], |
|
963 | - ] |
|
964 | - ); |
|
965 | - die(); |
|
966 | - } |
|
967 | - return $state_details_settings; |
|
968 | - } |
|
969 | - |
|
970 | - |
|
971 | - /** |
|
972 | - * @return void |
|
973 | - * @throws EE_Error |
|
974 | - * @throws InvalidArgumentException |
|
975 | - * @throws InvalidDataTypeException |
|
976 | - * @throws InvalidInterfaceException |
|
977 | - * @throws ReflectionException |
|
978 | - */ |
|
979 | - public function add_new_state() |
|
980 | - { |
|
981 | - $success = true; |
|
982 | - $CNT_ISO = $this->getCountryISO(''); |
|
983 | - if (! $CNT_ISO) { |
|
984 | - EE_Error::add_error( |
|
985 | - esc_html__('No Country ISO code or an invalid Country ISO code was received.', 'event_espresso'), |
|
986 | - __FILE__, |
|
987 | - __FUNCTION__, |
|
988 | - __LINE__ |
|
989 | - ); |
|
990 | - $success = false; |
|
991 | - } |
|
992 | - $STA_abbrev = $this->request->getRequestParam('STA_abbrev'); |
|
993 | - if (! $STA_abbrev) { |
|
994 | - EE_Error::add_error( |
|
995 | - esc_html__('No State ISO code or an invalid State ISO code was received.', 'event_espresso'), |
|
996 | - __FILE__, |
|
997 | - __FUNCTION__, |
|
998 | - __LINE__ |
|
999 | - ); |
|
1000 | - $success = false; |
|
1001 | - } |
|
1002 | - $STA_name = $this->request->getRequestParam('STA_name'); |
|
1003 | - if (! $STA_name) { |
|
1004 | - EE_Error::add_error( |
|
1005 | - esc_html__('No State name or an invalid State name was received.', 'event_espresso'), |
|
1006 | - __FILE__, |
|
1007 | - __FUNCTION__, |
|
1008 | - __LINE__ |
|
1009 | - ); |
|
1010 | - $success = false; |
|
1011 | - } |
|
1012 | - |
|
1013 | - if ($success) { |
|
1014 | - $cols_n_values = [ |
|
1015 | - 'CNT_ISO' => $CNT_ISO, |
|
1016 | - 'STA_abbrev' => $STA_abbrev, |
|
1017 | - 'STA_name' => $STA_name, |
|
1018 | - 'STA_active' => true, |
|
1019 | - ]; |
|
1020 | - $success = EEM_State::instance()->insert($cols_n_values); |
|
1021 | - EE_Error::add_success(esc_html__('The State was added successfully.', 'event_espresso')); |
|
1022 | - } |
|
1023 | - |
|
1024 | - if (defined('DOING_AJAX')) { |
|
1025 | - $notices = EE_Error::get_notices(false, false, false); |
|
1026 | - echo wp_json_encode(array_merge($notices, ['return_data' => $CNT_ISO])); |
|
1027 | - die(); |
|
1028 | - } |
|
1029 | - $this->_redirect_after_action( |
|
1030 | - $success, |
|
1031 | - esc_html__('State', 'event_espresso'), |
|
1032 | - 'added', |
|
1033 | - ['action' => 'country_settings'] |
|
1034 | - ); |
|
1035 | - } |
|
1036 | - |
|
1037 | - |
|
1038 | - /** |
|
1039 | - * @return void |
|
1040 | - * @throws EE_Error |
|
1041 | - * @throws InvalidArgumentException |
|
1042 | - * @throws InvalidDataTypeException |
|
1043 | - * @throws InvalidInterfaceException |
|
1044 | - * @throws ReflectionException |
|
1045 | - */ |
|
1046 | - public function delete_state() |
|
1047 | - { |
|
1048 | - $CNT_ISO = $this->getCountryISO(); |
|
1049 | - $STA_ID = $this->request->getRequestParam('STA_ID'); |
|
1050 | - $STA_abbrev = $this->request->getRequestParam('STA_abbrev'); |
|
1051 | - |
|
1052 | - if (! $STA_ID) { |
|
1053 | - EE_Error::add_error( |
|
1054 | - esc_html__('No State ID or an invalid State ID was received.', 'event_espresso'), |
|
1055 | - __FILE__, |
|
1056 | - __FUNCTION__, |
|
1057 | - __LINE__ |
|
1058 | - ); |
|
1059 | - return; |
|
1060 | - } |
|
1061 | - |
|
1062 | - $success = EEM_State::instance()->delete_by_ID($STA_ID); |
|
1063 | - if ($success !== false) { |
|
1064 | - do_action( |
|
1065 | - 'AHEE__General_Settings_Admin_Page__delete_state__state_deleted', |
|
1066 | - $CNT_ISO, |
|
1067 | - $STA_ID, |
|
1068 | - ['STA_abbrev' => $STA_abbrev] |
|
1069 | - ); |
|
1070 | - EE_Error::add_success(esc_html__('The State was deleted successfully.', 'event_espresso')); |
|
1071 | - } |
|
1072 | - if (defined('DOING_AJAX')) { |
|
1073 | - $notices = EE_Error::get_notices(false); |
|
1074 | - $notices['return_data'] = true; |
|
1075 | - echo wp_json_encode($notices); |
|
1076 | - die(); |
|
1077 | - } |
|
1078 | - $this->_redirect_after_action( |
|
1079 | - $success, |
|
1080 | - esc_html__('State', 'event_espresso'), |
|
1081 | - 'deleted', |
|
1082 | - ['action' => 'country_settings'] |
|
1083 | - ); |
|
1084 | - } |
|
1085 | - |
|
1086 | - |
|
1087 | - /** |
|
1088 | - * @return void |
|
1089 | - * @throws EE_Error |
|
1090 | - * @throws InvalidArgumentException |
|
1091 | - * @throws InvalidDataTypeException |
|
1092 | - * @throws InvalidInterfaceException |
|
1093 | - * @throws ReflectionException |
|
1094 | - */ |
|
1095 | - protected function _update_country_settings() |
|
1096 | - { |
|
1097 | - $CNT_ISO = $this->getCountryISO(); |
|
1098 | - if (! $CNT_ISO) { |
|
1099 | - EE_Error::add_error( |
|
1100 | - esc_html__('No Country ISO code or an invalid Country ISO code was received.', 'event_espresso'), |
|
1101 | - __FILE__, |
|
1102 | - __FUNCTION__, |
|
1103 | - __LINE__ |
|
1104 | - ); |
|
1105 | - return; |
|
1106 | - } |
|
1107 | - |
|
1108 | - $country = $this->verifyOrGetCountryFromIso($CNT_ISO); |
|
1109 | - |
|
1110 | - $cols_n_values = []; |
|
1111 | - $cols_n_values['CNT_ISO3'] = strtoupper( |
|
1112 | - $this->request->getRequestParam('cntry', '', $country->ISO3()) |
|
1113 | - ); |
|
1114 | - $cols_n_values['CNT_name'] = |
|
1115 | - $this->request->getRequestParam("cntry[$CNT_ISO][CNT_name]", $country->name()); |
|
1116 | - $cols_n_values['CNT_cur_code'] = strtoupper( |
|
1117 | - $this->request->getRequestParam( |
|
1118 | - "cntry[$CNT_ISO][CNT_cur_code]", |
|
1119 | - $country->currency_code() |
|
1120 | - ) |
|
1121 | - ); |
|
1122 | - $cols_n_values['CNT_cur_single'] = $this->request->getRequestParam( |
|
1123 | - "cntry[$CNT_ISO][CNT_cur_single]", |
|
1124 | - $country->currency_name_single() |
|
1125 | - ); |
|
1126 | - $cols_n_values['CNT_cur_plural'] = $this->request->getRequestParam( |
|
1127 | - "cntry[$CNT_ISO][CNT_cur_plural]", |
|
1128 | - $country->currency_name_plural() |
|
1129 | - ); |
|
1130 | - $cols_n_values['CNT_cur_sign'] = $this->request->getRequestParam( |
|
1131 | - "cntry[$CNT_ISO][CNT_cur_sign]", |
|
1132 | - $country->currency_sign() |
|
1133 | - ); |
|
1134 | - $cols_n_values['CNT_cur_sign_b4'] = $this->request->getRequestParam( |
|
1135 | - "cntry[$CNT_ISO][CNT_cur_sign_b4]", |
|
1136 | - $country->currency_sign_before(), |
|
1137 | - DataType::BOOL |
|
1138 | - ); |
|
1139 | - $cols_n_values['CNT_cur_dec_plc'] = $this->request->getRequestParam( |
|
1140 | - "cntry[$CNT_ISO][CNT_cur_dec_plc]", |
|
1141 | - $country->currency_decimal_places() |
|
1142 | - ); |
|
1143 | - $cols_n_values['CNT_cur_dec_mrk'] = $this->request->getRequestParam( |
|
1144 | - "cntry[$CNT_ISO][CNT_cur_dec_mrk]", |
|
1145 | - $country->currency_decimal_mark() |
|
1146 | - ); |
|
1147 | - $cols_n_values['CNT_cur_thsnds'] = $this->request->getRequestParam( |
|
1148 | - "cntry[$CNT_ISO][CNT_cur_thsnds]", |
|
1149 | - $country->currency_thousands_separator() |
|
1150 | - ); |
|
1151 | - $cols_n_values['CNT_tel_code'] = $this->request->getRequestParam( |
|
1152 | - "cntry[$CNT_ISO][CNT_tel_code]", |
|
1153 | - $country->telephoneCode() |
|
1154 | - ); |
|
1155 | - $cols_n_values['CNT_active'] = $this->request->getRequestParam( |
|
1156 | - "cntry[$CNT_ISO][CNT_active]", |
|
1157 | - $country->isActive(), |
|
1158 | - DataType::BOOL |
|
1159 | - ); |
|
1160 | - |
|
1161 | - // allow filtering of country data |
|
1162 | - $cols_n_values = apply_filters( |
|
1163 | - 'FHEE__General_Settings_Admin_Page___update_country_settings__cols_n_values', |
|
1164 | - $cols_n_values |
|
1165 | - ); |
|
1166 | - |
|
1167 | - // where values |
|
1168 | - $where_cols_n_values = [['CNT_ISO' => $CNT_ISO]]; |
|
1169 | - // run the update |
|
1170 | - $success = EEM_Country::instance()->update($cols_n_values, $where_cols_n_values); |
|
1171 | - |
|
1172 | - // allow filtering of states data |
|
1173 | - $states = apply_filters( |
|
1174 | - 'FHEE__General_Settings_Admin_Page___update_country_settings__states', |
|
1175 | - $this->request->getRequestParam('states', [], DataType::STRING, true) |
|
1176 | - ); |
|
1177 | - |
|
1178 | - if (! empty($states) && $success !== false) { |
|
1179 | - // loop thru state data ( looks like : states[75][STA_name] ) |
|
1180 | - foreach ($states as $STA_ID => $state) { |
|
1181 | - $cols_n_values = [ |
|
1182 | - 'CNT_ISO' => $CNT_ISO, |
|
1183 | - 'STA_abbrev' => sanitize_text_field($state['STA_abbrev']), |
|
1184 | - 'STA_name' => sanitize_text_field($state['STA_name']), |
|
1185 | - 'STA_active' => filter_var($state['STA_active'], FILTER_VALIDATE_BOOLEAN), |
|
1186 | - ]; |
|
1187 | - // where values |
|
1188 | - $where_cols_n_values = [['STA_ID' => $STA_ID]]; |
|
1189 | - // run the update |
|
1190 | - $success = EEM_State::instance()->update($cols_n_values, $where_cols_n_values); |
|
1191 | - if ($success !== false) { |
|
1192 | - do_action( |
|
1193 | - 'AHEE__General_Settings_Admin_Page__update_country_settings__state_saved', |
|
1194 | - $CNT_ISO, |
|
1195 | - $STA_ID, |
|
1196 | - $cols_n_values |
|
1197 | - ); |
|
1198 | - } |
|
1199 | - } |
|
1200 | - } |
|
1201 | - // check if country being edited matches org option country, and if so, then update EE_Config with new settings |
|
1202 | - if ( |
|
1203 | - isset(EE_Registry::instance()->CFG->organization->CNT_ISO) |
|
1204 | - && $CNT_ISO == EE_Registry::instance()->CFG->organization->CNT_ISO |
|
1205 | - ) { |
|
1206 | - EE_Registry::instance()->CFG->currency = new EE_Currency_Config($CNT_ISO); |
|
1207 | - EE_Registry::instance()->CFG->update_espresso_config(); |
|
1208 | - } |
|
1209 | - |
|
1210 | - if ($success !== false) { |
|
1211 | - EE_Error::add_success( |
|
1212 | - esc_html__('Country Settings updated successfully.', 'event_espresso') |
|
1213 | - ); |
|
1214 | - } |
|
1215 | - $this->_redirect_after_action( |
|
1216 | - $success, |
|
1217 | - '', |
|
1218 | - '', |
|
1219 | - ['action' => 'country_settings', 'country' => $CNT_ISO], |
|
1220 | - true |
|
1221 | - ); |
|
1222 | - } |
|
1223 | - |
|
1224 | - |
|
1225 | - /** |
|
1226 | - * form_form_field_label_wrap |
|
1227 | - * |
|
1228 | - * @param string $label |
|
1229 | - * @return string |
|
1230 | - */ |
|
1231 | - public function country_form_field_label_wrap(string $label): string |
|
1232 | - { |
|
1233 | - return ' |
|
242 | + |
|
243 | + EE_Registry::$i18n_js_strings['invalid_server_response'] = wp_strip_all_tags( |
|
244 | + esc_html__( |
|
245 | + 'An error occurred! Your request may have been processed, but a valid response from the server was not received. Please refresh the page and try again.', |
|
246 | + 'event_espresso' |
|
247 | + ) |
|
248 | + ); |
|
249 | + EE_Registry::$i18n_js_strings['error_occurred'] = wp_strip_all_tags( |
|
250 | + esc_html__( |
|
251 | + 'An error occurred! Please refresh the page and try again.', |
|
252 | + 'event_espresso' |
|
253 | + ) |
|
254 | + ); |
|
255 | + EE_Registry::$i18n_js_strings['confirm_delete_state'] = wp_strip_all_tags( |
|
256 | + esc_html__( |
|
257 | + 'Are you sure you want to delete this State / Province?', |
|
258 | + 'event_espresso' |
|
259 | + ) |
|
260 | + ); |
|
261 | + EE_Registry::$i18n_js_strings['ajax_url'] = admin_url( |
|
262 | + 'admin-ajax.php?page=espresso_general_settings', |
|
263 | + is_ssl() ? 'https://' : 'http://' |
|
264 | + ); |
|
265 | + } |
|
266 | + |
|
267 | + |
|
268 | + public function admin_notices() |
|
269 | + { |
|
270 | + } |
|
271 | + |
|
272 | + |
|
273 | + public function admin_footer_scripts() |
|
274 | + { |
|
275 | + } |
|
276 | + |
|
277 | + |
|
278 | + /** |
|
279 | + * Enqueue scripts and styles for the default route. |
|
280 | + */ |
|
281 | + public function load_scripts_styles_default() |
|
282 | + { |
|
283 | + // styles |
|
284 | + wp_enqueue_style('thickbox'); |
|
285 | + // scripts |
|
286 | + wp_enqueue_script('media-upload'); |
|
287 | + wp_enqueue_script('thickbox'); |
|
288 | + wp_register_script( |
|
289 | + 'organization_settings', |
|
290 | + GEN_SET_ASSETS_URL . 'your_organization_settings.js', |
|
291 | + ['jquery', 'media-upload', 'thickbox'], |
|
292 | + EVENT_ESPRESSO_VERSION, |
|
293 | + true |
|
294 | + ); |
|
295 | + wp_register_style('organization-css', GEN_SET_ASSETS_URL . 'organization.css', [], EVENT_ESPRESSO_VERSION); |
|
296 | + wp_enqueue_script('organization_settings'); |
|
297 | + wp_enqueue_style('organization-css'); |
|
298 | + $confirm_image_delete = [ |
|
299 | + 'text' => wp_strip_all_tags( |
|
300 | + esc_html__( |
|
301 | + 'Do you really want to delete this image? Please remember to save your settings to complete the removal.', |
|
302 | + 'event_espresso' |
|
303 | + ) |
|
304 | + ), |
|
305 | + ]; |
|
306 | + wp_localize_script('organization_settings', 'confirm_image_delete', $confirm_image_delete); |
|
307 | + } |
|
308 | + |
|
309 | + |
|
310 | + /** |
|
311 | + * Enqueue scripts and styles for the country settings route. |
|
312 | + */ |
|
313 | + public function load_scripts_styles_country_settings() |
|
314 | + { |
|
315 | + // scripts |
|
316 | + wp_register_script( |
|
317 | + 'gen_settings_countries', |
|
318 | + GEN_SET_ASSETS_URL . 'gen_settings_countries.js', |
|
319 | + ['ee_admin_js'], |
|
320 | + EVENT_ESPRESSO_VERSION, |
|
321 | + true |
|
322 | + ); |
|
323 | + wp_register_style('organization-css', GEN_SET_ASSETS_URL . 'organization.css', [], EVENT_ESPRESSO_VERSION); |
|
324 | + wp_enqueue_script('gen_settings_countries'); |
|
325 | + wp_enqueue_style('organization-css'); |
|
326 | + } |
|
327 | + |
|
328 | + |
|
329 | + /************* Espresso Pages *************/ |
|
330 | + /** |
|
331 | + * _espresso_page_settings |
|
332 | + * |
|
333 | + * @throws EE_Error |
|
334 | + * @throws DomainException |
|
335 | + * @throws DomainException |
|
336 | + * @throws InvalidDataTypeException |
|
337 | + * @throws InvalidArgumentException |
|
338 | + */ |
|
339 | + protected function _espresso_page_settings() |
|
340 | + { |
|
341 | + // Check to make sure all of the main pages are set up properly, |
|
342 | + // if not create the default pages and display an admin notice |
|
343 | + EEH_Activation::verify_default_pages_exist(); |
|
344 | + $this->_transient_garbage_collection(); |
|
345 | + |
|
346 | + $this->_template_args['values'] = $this->_yes_no_values; |
|
347 | + |
|
348 | + $this->_template_args['reg_page_id'] = $this->core_config->reg_page_id ?? null; |
|
349 | + $this->_template_args['reg_page_obj'] = isset($this->core_config->reg_page_id) |
|
350 | + ? get_post($this->core_config->reg_page_id) |
|
351 | + : false; |
|
352 | + |
|
353 | + $this->_template_args['txn_page_id'] = $this->core_config->txn_page_id ?? null; |
|
354 | + $this->_template_args['txn_page_obj'] = isset($this->core_config->txn_page_id) |
|
355 | + ? get_post($this->core_config->txn_page_id) |
|
356 | + : false; |
|
357 | + |
|
358 | + $this->_template_args['thank_you_page_id'] = $this->core_config->thank_you_page_id ?? null; |
|
359 | + $this->_template_args['thank_you_page_obj'] = isset($this->core_config->thank_you_page_id) |
|
360 | + ? get_post($this->core_config->thank_you_page_id) |
|
361 | + : false; |
|
362 | + |
|
363 | + $this->_template_args['cancel_page_id'] = $this->core_config->cancel_page_id ?? null; |
|
364 | + $this->_template_args['cancel_page_obj'] = isset($this->core_config->cancel_page_id) |
|
365 | + ? get_post($this->core_config->cancel_page_id) |
|
366 | + : false; |
|
367 | + |
|
368 | + $this->_set_add_edit_form_tags('update_espresso_page_settings'); |
|
369 | + $this->_set_publish_post_box_vars(null, false, false, null, false); |
|
370 | + $this->_template_args['admin_page_content'] = EEH_Template::display_template( |
|
371 | + GEN_SET_TEMPLATE_PATH . 'espresso_page_settings.template.php', |
|
372 | + $this->_template_args, |
|
373 | + true |
|
374 | + ); |
|
375 | + $this->display_admin_page_with_sidebar(); |
|
376 | + } |
|
377 | + |
|
378 | + |
|
379 | + /** |
|
380 | + * Handler for updating espresso page settings. |
|
381 | + * |
|
382 | + * @throws EE_Error |
|
383 | + */ |
|
384 | + protected function _update_espresso_page_settings() |
|
385 | + { |
|
386 | + $this->core_config = EE_Registry::instance()->CFG->core; |
|
387 | + // capture incoming request data && set page IDs |
|
388 | + $this->core_config->reg_page_id = $this->request->getRequestParam( |
|
389 | + 'reg_page_id', |
|
390 | + $this->core_config->reg_page_id, |
|
391 | + DataType::INT |
|
392 | + ); |
|
393 | + $this->core_config->txn_page_id = $this->request->getRequestParam( |
|
394 | + 'txn_page_id', |
|
395 | + $this->core_config->txn_page_id, |
|
396 | + DataType::INT |
|
397 | + ); |
|
398 | + $this->core_config->thank_you_page_id = $this->request->getRequestParam( |
|
399 | + 'thank_you_page_id', |
|
400 | + $this->core_config->thank_you_page_id, |
|
401 | + DataType::INT |
|
402 | + ); |
|
403 | + $this->core_config->cancel_page_id = $this->request->getRequestParam( |
|
404 | + 'cancel_page_id', |
|
405 | + $this->core_config->cancel_page_id, |
|
406 | + DataType::INT |
|
407 | + ); |
|
408 | + |
|
409 | + $this->core_config = apply_filters( |
|
410 | + 'FHEE__General_Settings_Admin_Page___update_espresso_page_settings__CFG_core', |
|
411 | + $this->core_config, |
|
412 | + $this->request->requestParams() |
|
413 | + ); |
|
414 | + |
|
415 | + $what = esc_html__('Critical Pages & Shortcodes', 'event_espresso'); |
|
416 | + $this->_redirect_after_action( |
|
417 | + $this->_update_espresso_configuration( |
|
418 | + $what, |
|
419 | + $this->core_config, |
|
420 | + __FILE__, |
|
421 | + __FUNCTION__, |
|
422 | + __LINE__ |
|
423 | + ), |
|
424 | + $what, |
|
425 | + '', |
|
426 | + [ |
|
427 | + 'action' => 'critical_pages', |
|
428 | + ], |
|
429 | + true |
|
430 | + ); |
|
431 | + } |
|
432 | + |
|
433 | + |
|
434 | + /************* Your Organization *************/ |
|
435 | + |
|
436 | + |
|
437 | + /** |
|
438 | + * @throws DomainException |
|
439 | + * @throws EE_Error |
|
440 | + * @throws InvalidArgumentException |
|
441 | + * @throws InvalidDataTypeException |
|
442 | + * @throws InvalidInterfaceException |
|
443 | + */ |
|
444 | + protected function _your_organization_settings() |
|
445 | + { |
|
446 | + $this->_template_args['admin_page_content'] = ''; |
|
447 | + try { |
|
448 | + /** @var OrganizationSettings $organization_settings_form */ |
|
449 | + $organization_settings_form = $this->loader->getShared(OrganizationSettings::class); |
|
450 | + |
|
451 | + $this->_template_args['admin_page_content'] = EEH_HTML::div( |
|
452 | + $organization_settings_form->display(), |
|
453 | + '', |
|
454 | + 'padding' |
|
455 | + ); |
|
456 | + } catch (Exception $e) { |
|
457 | + EE_Error::add_error($e->getMessage(), __FILE__, __FUNCTION__, __LINE__); |
|
458 | + } |
|
459 | + $this->_set_add_edit_form_tags('update_your_organization_settings'); |
|
460 | + $this->_set_publish_post_box_vars(null, false, false, null, false); |
|
461 | + $this->display_admin_page_with_sidebar(); |
|
462 | + } |
|
463 | + |
|
464 | + |
|
465 | + /** |
|
466 | + * Handler for updating organization settings. |
|
467 | + * |
|
468 | + * @throws EE_Error |
|
469 | + */ |
|
470 | + protected function _update_your_organization_settings() |
|
471 | + { |
|
472 | + try { |
|
473 | + /** @var OrganizationSettings $organization_settings_form */ |
|
474 | + $organization_settings_form = $this->loader->getShared(OrganizationSettings::class); |
|
475 | + |
|
476 | + $success = $organization_settings_form->process($this->request->requestParams()); |
|
477 | + |
|
478 | + EE_Registry::instance()->CFG = apply_filters( |
|
479 | + 'FHEE__General_Settings_Admin_Page___update_your_organization_settings__CFG', |
|
480 | + EE_Registry::instance()->CFG |
|
481 | + ); |
|
482 | + } catch (Exception $e) { |
|
483 | + EE_Error::add_error($e->getMessage(), __FILE__, __FUNCTION__, __LINE__); |
|
484 | + $success = false; |
|
485 | + } |
|
486 | + |
|
487 | + if ($success) { |
|
488 | + $success = $this->_update_espresso_configuration( |
|
489 | + esc_html__('Your Organization Settings', 'event_espresso'), |
|
490 | + EE_Registry::instance()->CFG, |
|
491 | + __FILE__, |
|
492 | + __FUNCTION__, |
|
493 | + __LINE__ |
|
494 | + ); |
|
495 | + } |
|
496 | + |
|
497 | + $this->_redirect_after_action($success, '', '', ['action' => 'default'], true); |
|
498 | + } |
|
499 | + |
|
500 | + |
|
501 | + |
|
502 | + /************* Admin Options *************/ |
|
503 | + |
|
504 | + |
|
505 | + /** |
|
506 | + * _admin_option_settings |
|
507 | + * |
|
508 | + * @throws EE_Error |
|
509 | + * @throws LogicException |
|
510 | + */ |
|
511 | + protected function _admin_option_settings() |
|
512 | + { |
|
513 | + $this->_template_args['admin_page_content'] = ''; |
|
514 | + try { |
|
515 | + $admin_options_settings_form = new AdminOptionsSettings(EE_Registry::instance()); |
|
516 | + // still need this for the old school form in Extend_General_Settings_Admin_Page |
|
517 | + $this->_template_args['values'] = $this->_yes_no_values; |
|
518 | + // also need to account for the do_action that was in the old template |
|
519 | + $admin_options_settings_form->setTemplateArgs($this->_template_args); |
|
520 | + $this->_template_args['admin_page_content'] = EEH_HTML::div( |
|
521 | + $admin_options_settings_form->display(), |
|
522 | + '', |
|
523 | + 'padding' |
|
524 | + ); |
|
525 | + } catch (Exception $e) { |
|
526 | + EE_Error::add_error($e->getMessage(), __FILE__, __FUNCTION__, __LINE__); |
|
527 | + } |
|
528 | + $this->_set_add_edit_form_tags('update_admin_option_settings'); |
|
529 | + $this->_set_publish_post_box_vars(null, false, false, null, false); |
|
530 | + $this->display_admin_page_with_sidebar(); |
|
531 | + } |
|
532 | + |
|
533 | + |
|
534 | + /** |
|
535 | + * _update_admin_option_settings |
|
536 | + * |
|
537 | + * @throws EE_Error |
|
538 | + * @throws InvalidDataTypeException |
|
539 | + * @throws InvalidFormSubmissionException |
|
540 | + * @throws InvalidArgumentException |
|
541 | + * @throws LogicException |
|
542 | + */ |
|
543 | + protected function _update_admin_option_settings() |
|
544 | + { |
|
545 | + try { |
|
546 | + $admin_options_settings_form = new AdminOptionsSettings(EE_Registry::instance()); |
|
547 | + $admin_options_settings_form->process( |
|
548 | + $this->request->getRequestParam( |
|
549 | + $admin_options_settings_form->slug(), |
|
550 | + [], |
|
551 | + DataType::STRING, |
|
552 | + true |
|
553 | + ) |
|
554 | + ); |
|
555 | + EE_Registry::instance()->CFG->admin = apply_filters( |
|
556 | + 'FHEE__General_Settings_Admin_Page___update_admin_option_settings__CFG_admin', |
|
557 | + EE_Registry::instance()->CFG->admin |
|
558 | + ); |
|
559 | + } catch (Exception $e) { |
|
560 | + EE_Error::add_error($e->getMessage(), __FILE__, __FUNCTION__, __LINE__); |
|
561 | + } |
|
562 | + $this->_redirect_after_action( |
|
563 | + apply_filters( |
|
564 | + 'FHEE__General_Settings_Admin_Page___update_admin_option_settings__success', |
|
565 | + $this->_update_espresso_configuration( |
|
566 | + esc_html__('Admin Options', 'event_espresso'), |
|
567 | + EE_Registry::instance()->CFG->admin, |
|
568 | + __FILE__, |
|
569 | + __FUNCTION__, |
|
570 | + __LINE__ |
|
571 | + ) |
|
572 | + ), |
|
573 | + esc_html__('Admin Options', 'event_espresso'), |
|
574 | + 'updated', |
|
575 | + ['action' => 'admin_option_settings'] |
|
576 | + ); |
|
577 | + } |
|
578 | + |
|
579 | + |
|
580 | + /************* Countries *************/ |
|
581 | + |
|
582 | + |
|
583 | + /** |
|
584 | + * @param string|null $default |
|
585 | + * @return string |
|
586 | + */ |
|
587 | + protected function getCountryISO(?string $default = null): string |
|
588 | + { |
|
589 | + $default = $default ?? $this->getCountryIsoForSite(); |
|
590 | + $CNT_ISO = $this->request->getRequestParam('country', $default); |
|
591 | + return strtoupper($CNT_ISO); |
|
592 | + } |
|
593 | + |
|
594 | + |
|
595 | + /** |
|
596 | + * @return string |
|
597 | + */ |
|
598 | + protected function getCountryIsoForSite(): string |
|
599 | + { |
|
600 | + return ! empty(EE_Registry::instance()->CFG->organization->CNT_ISO) |
|
601 | + ? EE_Registry::instance()->CFG->organization->CNT_ISO |
|
602 | + : 'US'; |
|
603 | + } |
|
604 | + |
|
605 | + |
|
606 | + /** |
|
607 | + * @param string $CNT_ISO |
|
608 | + * @param EE_Country|null $country |
|
609 | + * @return EE_Base_Class|EE_Country |
|
610 | + * @throws EE_Error |
|
611 | + * @throws InvalidArgumentException |
|
612 | + * @throws InvalidDataTypeException |
|
613 | + * @throws InvalidInterfaceException |
|
614 | + * @throws ReflectionException |
|
615 | + */ |
|
616 | + protected function verifyOrGetCountryFromIso(string $CNT_ISO, ?EE_Country $country = null) |
|
617 | + { |
|
618 | + /** @var EE_Country $country */ |
|
619 | + return $country instanceof EE_Country && $country->ID() === $CNT_ISO |
|
620 | + ? $country |
|
621 | + : EEM_Country::instance()->get_one_by_ID($CNT_ISO); |
|
622 | + } |
|
623 | + |
|
624 | + |
|
625 | + /** |
|
626 | + * Output Country Settings view. |
|
627 | + * |
|
628 | + * @throws DomainException |
|
629 | + * @throws EE_Error |
|
630 | + * @throws InvalidArgumentException |
|
631 | + * @throws InvalidDataTypeException |
|
632 | + * @throws InvalidInterfaceException |
|
633 | + * @throws ReflectionException |
|
634 | + */ |
|
635 | + protected function _country_settings() |
|
636 | + { |
|
637 | + $CNT_ISO = $this->getCountryISO(); |
|
638 | + |
|
639 | + $this->_template_args['values'] = $this->_yes_no_values; |
|
640 | + $this->_template_args['countries'] = new EE_Question_Form_Input( |
|
641 | + EE_Question::new_instance( |
|
642 | + [ |
|
643 | + 'QST_ID' => 0, |
|
644 | + 'QST_display_text' => esc_html__('Select Country', 'event_espresso'), |
|
645 | + 'QST_system' => 'admin-country', |
|
646 | + ] |
|
647 | + ), |
|
648 | + EE_Answer::new_instance( |
|
649 | + [ |
|
650 | + 'ANS_ID' => 0, |
|
651 | + 'ANS_value' => $CNT_ISO, |
|
652 | + ] |
|
653 | + ), |
|
654 | + [ |
|
655 | + 'input_id' => 'country', |
|
656 | + 'input_name' => 'country', |
|
657 | + 'input_prefix' => '', |
|
658 | + 'append_qstn_id' => false, |
|
659 | + ] |
|
660 | + ); |
|
661 | + |
|
662 | + $country = $this->verifyOrGetCountryFromIso($CNT_ISO); |
|
663 | + add_filter('FHEE__EEH_Form_Fields__label_html', [$this, 'country_form_field_label_wrap'], 10); |
|
664 | + add_filter('FHEE__EEH_Form_Fields__input_html', [$this, 'country_form_field_input__wrap'], 10); |
|
665 | + $this->_template_args['country_details_settings'] = $this->display_country_settings( |
|
666 | + $country->ID(), |
|
667 | + $country |
|
668 | + ); |
|
669 | + $this->_template_args['country_states_settings'] = $this->display_country_states( |
|
670 | + $country->ID(), |
|
671 | + $country |
|
672 | + ); |
|
673 | + $this->_template_args['CNT_name_for_site'] = $country->name(); |
|
674 | + |
|
675 | + $this->_set_add_edit_form_tags('update_country_settings'); |
|
676 | + $this->_set_publish_post_box_vars(null, false, false, null, false); |
|
677 | + $this->_template_args['admin_page_content'] = EEH_Template::display_template( |
|
678 | + GEN_SET_TEMPLATE_PATH . 'countries_settings.template.php', |
|
679 | + $this->_template_args, |
|
680 | + true |
|
681 | + ); |
|
682 | + $this->display_admin_page_with_no_sidebar(); |
|
683 | + } |
|
684 | + |
|
685 | + |
|
686 | + /** |
|
687 | + * @param string $CNT_ISO |
|
688 | + * @param EE_Country|null $country |
|
689 | + * @return string |
|
690 | + * @throws DomainException |
|
691 | + * @throws EE_Error |
|
692 | + * @throws InvalidArgumentException |
|
693 | + * @throws InvalidDataTypeException |
|
694 | + * @throws InvalidInterfaceException |
|
695 | + * @throws ReflectionException |
|
696 | + */ |
|
697 | + public function display_country_settings(string $CNT_ISO = '', ?EE_Country $country = null): string |
|
698 | + { |
|
699 | + $CNT_ISO = $this->getCountryISO($CNT_ISO); |
|
700 | + $CNT_ISO_for_site = $this->getCountryIsoForSite(); |
|
701 | + |
|
702 | + if (! $CNT_ISO) { |
|
703 | + return ''; |
|
704 | + } |
|
705 | + |
|
706 | + // for ajax |
|
707 | + remove_all_filters('FHEE__EEH_Form_Fields__label_html'); |
|
708 | + remove_all_filters('FHEE__EEH_Form_Fields__input_html'); |
|
709 | + add_filter('FHEE__EEH_Form_Fields__label_html', [$this, 'country_form_field_label_wrap'], 10, 2); |
|
710 | + add_filter('FHEE__EEH_Form_Fields__input_html', [$this, 'country_form_field_input__wrap'], 10, 2); |
|
711 | + $country = $this->verifyOrGetCountryFromIso($CNT_ISO, $country); |
|
712 | + $CNT_cur_disabled = $CNT_ISO !== $CNT_ISO_for_site; |
|
713 | + $this->_template_args['CNT_cur_disabled'] = $CNT_cur_disabled; |
|
714 | + |
|
715 | + $country_input_types = [ |
|
716 | + 'CNT_active' => [ |
|
717 | + 'type' => 'RADIO_BTN', |
|
718 | + 'input_name' => "cntry[$CNT_ISO]", |
|
719 | + 'class' => '', |
|
720 | + 'options' => $this->_yes_no_values, |
|
721 | + 'use_desc_4_label' => true, |
|
722 | + ], |
|
723 | + 'CNT_ISO' => [ |
|
724 | + 'type' => 'TEXT', |
|
725 | + 'input_name' => "cntry[$CNT_ISO]", |
|
726 | + 'class' => 'ee-input-width--small', |
|
727 | + ], |
|
728 | + 'CNT_ISO3' => [ |
|
729 | + 'type' => 'TEXT', |
|
730 | + 'input_name' => "cntry[$CNT_ISO]", |
|
731 | + 'class' => 'ee-input-width--small', |
|
732 | + ], |
|
733 | + // 'RGN_ID' => [ |
|
734 | + // 'type' => 'TEXT', |
|
735 | + // 'input_name' => "cntry[$CNT_ISO]", |
|
736 | + // 'class' => 'ee-input-width--small', |
|
737 | + // ], |
|
738 | + 'CNT_name' => [ |
|
739 | + 'type' => 'TEXT', |
|
740 | + 'input_name' => "cntry[$CNT_ISO]", |
|
741 | + 'class' => 'ee-input-width--big', |
|
742 | + ], |
|
743 | + 'CNT_cur_code' => [ |
|
744 | + 'type' => 'TEXT', |
|
745 | + 'input_name' => "cntry[$CNT_ISO]", |
|
746 | + 'class' => 'ee-input-width--small', |
|
747 | + 'disabled' => $CNT_cur_disabled, |
|
748 | + ], |
|
749 | + 'CNT_cur_single' => [ |
|
750 | + 'type' => 'TEXT', |
|
751 | + 'input_name' => "cntry[$CNT_ISO]", |
|
752 | + 'class' => 'ee-input-width--reg', |
|
753 | + 'disabled' => $CNT_cur_disabled, |
|
754 | + ], |
|
755 | + 'CNT_cur_plural' => [ |
|
756 | + 'type' => 'TEXT', |
|
757 | + 'input_name' => "cntry[$CNT_ISO]", |
|
758 | + 'class' => 'ee-input-width--reg', |
|
759 | + 'disabled' => $CNT_cur_disabled, |
|
760 | + ], |
|
761 | + 'CNT_cur_sign' => [ |
|
762 | + 'type' => 'TEXT', |
|
763 | + 'input_name' => "cntry[$CNT_ISO]", |
|
764 | + 'class' => 'ee-input-width--small', |
|
765 | + 'htmlentities' => false, |
|
766 | + 'disabled' => $CNT_cur_disabled, |
|
767 | + ], |
|
768 | + 'CNT_cur_sign_b4' => [ |
|
769 | + 'type' => 'RADIO_BTN', |
|
770 | + 'input_name' => "cntry[$CNT_ISO]", |
|
771 | + 'class' => '', |
|
772 | + 'options' => $this->_yes_no_values, |
|
773 | + 'use_desc_4_label' => true, |
|
774 | + 'disabled' => $CNT_cur_disabled, |
|
775 | + ], |
|
776 | + 'CNT_cur_dec_plc' => [ |
|
777 | + 'type' => 'RADIO_BTN', |
|
778 | + 'input_name' => "cntry[$CNT_ISO]", |
|
779 | + 'class' => '', |
|
780 | + 'options' => [ |
|
781 | + ['id' => 0, 'text' => ''], |
|
782 | + ['id' => 1, 'text' => ''], |
|
783 | + ['id' => 2, 'text' => ''], |
|
784 | + ['id' => 3, 'text' => ''], |
|
785 | + ], |
|
786 | + 'disabled' => $CNT_cur_disabled, |
|
787 | + ], |
|
788 | + 'CNT_cur_dec_mrk' => [ |
|
789 | + 'type' => 'RADIO_BTN', |
|
790 | + 'input_name' => "cntry[$CNT_ISO]", |
|
791 | + 'class' => '', |
|
792 | + 'options' => [ |
|
793 | + [ |
|
794 | + 'id' => ',', |
|
795 | + 'text' => esc_html__(', (comma)', 'event_espresso'), |
|
796 | + ], |
|
797 | + ['id' => '.', 'text' => esc_html__('. (decimal)', 'event_espresso')], |
|
798 | + ], |
|
799 | + 'use_desc_4_label' => true, |
|
800 | + 'disabled' => $CNT_cur_disabled, |
|
801 | + ], |
|
802 | + 'CNT_cur_thsnds' => [ |
|
803 | + 'type' => 'RADIO_BTN', |
|
804 | + 'input_name' => "cntry[$CNT_ISO]", |
|
805 | + 'class' => '', |
|
806 | + 'options' => [ |
|
807 | + [ |
|
808 | + 'id' => ',', |
|
809 | + 'text' => esc_html__(', (comma)', 'event_espresso'), |
|
810 | + ], |
|
811 | + [ |
|
812 | + 'id' => '.', |
|
813 | + 'text' => esc_html__('. (decimal)', 'event_espresso'), |
|
814 | + ], |
|
815 | + [ |
|
816 | + 'id' => ' ', |
|
817 | + 'text' => esc_html__('(space)', 'event_espresso'), |
|
818 | + ], |
|
819 | + ], |
|
820 | + 'use_desc_4_label' => true, |
|
821 | + 'disabled' => $CNT_cur_disabled, |
|
822 | + ], |
|
823 | + 'CNT_tel_code' => [ |
|
824 | + 'type' => 'TEXT', |
|
825 | + 'input_name' => "cntry[$CNT_ISO]", |
|
826 | + 'class' => 'ee-input-width--small', |
|
827 | + ], |
|
828 | + 'CNT_is_EU' => [ |
|
829 | + 'type' => 'RADIO_BTN', |
|
830 | + 'input_name' => "cntry[$CNT_ISO]", |
|
831 | + 'class' => '', |
|
832 | + 'options' => $this->_yes_no_values, |
|
833 | + 'use_desc_4_label' => true, |
|
834 | + ], |
|
835 | + ]; |
|
836 | + $this->_template_args['inputs'] = EE_Question_Form_Input::generate_question_form_inputs_for_object( |
|
837 | + $country, |
|
838 | + $country_input_types |
|
839 | + ); |
|
840 | + $country_details_settings = EEH_Template::display_template( |
|
841 | + GEN_SET_TEMPLATE_PATH . 'country_details_settings.template.php', |
|
842 | + $this->_template_args, |
|
843 | + true |
|
844 | + ); |
|
845 | + |
|
846 | + if (defined('DOING_AJAX')) { |
|
847 | + $notices = EE_Error::get_notices(false, false, false); |
|
848 | + echo wp_json_encode( |
|
849 | + [ |
|
850 | + 'return_data' => $country_details_settings, |
|
851 | + 'success' => $notices['success'], |
|
852 | + 'errors' => $notices['errors'], |
|
853 | + ] |
|
854 | + ); |
|
855 | + die(); |
|
856 | + } |
|
857 | + return $country_details_settings; |
|
858 | + } |
|
859 | + |
|
860 | + |
|
861 | + /** |
|
862 | + * @param string $CNT_ISO |
|
863 | + * @param EE_Country|null $country |
|
864 | + * @return string |
|
865 | + * @throws DomainException |
|
866 | + * @throws EE_Error |
|
867 | + * @throws InvalidArgumentException |
|
868 | + * @throws InvalidDataTypeException |
|
869 | + * @throws InvalidInterfaceException |
|
870 | + * @throws ReflectionException |
|
871 | + */ |
|
872 | + public function display_country_states(string $CNT_ISO = '', ?EE_Country $country = null): string |
|
873 | + { |
|
874 | + $CNT_ISO = $this->getCountryISO($CNT_ISO); |
|
875 | + if (! $CNT_ISO) { |
|
876 | + return ''; |
|
877 | + } |
|
878 | + // for ajax |
|
879 | + remove_all_filters('FHEE__EEH_Form_Fields__label_html'); |
|
880 | + remove_all_filters('FHEE__EEH_Form_Fields__input_html'); |
|
881 | + add_filter('FHEE__EEH_Form_Fields__label_html', [$this, 'state_form_field_label_wrap'], 10, 2); |
|
882 | + add_filter('FHEE__EEH_Form_Fields__input_html', [$this, 'state_form_field_input__wrap'], 10); |
|
883 | + $states = EEM_State::instance()->get_all_states_for_these_countries([$CNT_ISO => $CNT_ISO]); |
|
884 | + if (empty($states)) { |
|
885 | + /** @var EventEspresso\core\services\address\CountrySubRegionDao $countrySubRegionDao */ |
|
886 | + $countrySubRegionDao = $this->loader->getShared( |
|
887 | + 'EventEspresso\core\services\address\CountrySubRegionDao' |
|
888 | + ); |
|
889 | + if ($countrySubRegionDao instanceof EventEspresso\core\services\address\CountrySubRegionDao) { |
|
890 | + $country = $this->verifyOrGetCountryFromIso($CNT_ISO, $country); |
|
891 | + if ($countrySubRegionDao->saveCountrySubRegions($country)) { |
|
892 | + $states = EEM_State::instance()->get_all_states_for_these_countries([$CNT_ISO => $CNT_ISO]); |
|
893 | + } |
|
894 | + } |
|
895 | + } |
|
896 | + if (is_array($states)) { |
|
897 | + foreach ($states as $STA_ID => $state) { |
|
898 | + if ($state instanceof EE_State) { |
|
899 | + $inputs = EE_Question_Form_Input::generate_question_form_inputs_for_object( |
|
900 | + $state, |
|
901 | + [ |
|
902 | + 'STA_abbrev' => [ |
|
903 | + 'type' => 'TEXT', |
|
904 | + 'label' => esc_html__('Code', 'event_espresso'), |
|
905 | + 'input_name' => "states[$STA_ID]", |
|
906 | + 'class' => 'ee-input-width--tiny', |
|
907 | + 'add_mobile_label' => true, |
|
908 | + ], |
|
909 | + 'STA_name' => [ |
|
910 | + 'type' => 'TEXT', |
|
911 | + 'label' => esc_html__('Name', 'event_espresso'), |
|
912 | + 'input_name' => "states[$STA_ID]", |
|
913 | + 'class' => 'ee-input-width--big', |
|
914 | + 'add_mobile_label' => true, |
|
915 | + ], |
|
916 | + 'STA_active' => [ |
|
917 | + 'type' => 'RADIO_BTN', |
|
918 | + 'label' => esc_html__('State Appears in Dropdown Select Lists', 'event_espresso'), |
|
919 | + 'input_name' => "states[$STA_ID]", |
|
920 | + 'options' => $this->_yes_no_values, |
|
921 | + 'use_desc_4_label' => true, |
|
922 | + 'add_mobile_label' => true, |
|
923 | + ], |
|
924 | + ] |
|
925 | + ); |
|
926 | + |
|
927 | + $delete_state_url = EE_Admin_Page::add_query_args_and_nonce( |
|
928 | + [ |
|
929 | + 'action' => 'delete_state', |
|
930 | + 'STA_ID' => $STA_ID, |
|
931 | + 'CNT_ISO' => $CNT_ISO, |
|
932 | + 'STA_abbrev' => $state->abbrev(), |
|
933 | + ], |
|
934 | + GEN_SET_ADMIN_URL |
|
935 | + ); |
|
936 | + |
|
937 | + $this->_template_args['states'][ $STA_ID ]['inputs'] = $inputs; |
|
938 | + $this->_template_args['states'][ $STA_ID ]['delete_state_url'] = $delete_state_url; |
|
939 | + } |
|
940 | + } |
|
941 | + } else { |
|
942 | + $this->_template_args['states'] = false; |
|
943 | + } |
|
944 | + |
|
945 | + $this->_template_args['add_new_state_url'] = EE_Admin_Page::add_query_args_and_nonce( |
|
946 | + ['action' => 'add_new_state'], |
|
947 | + GEN_SET_ADMIN_URL |
|
948 | + ); |
|
949 | + |
|
950 | + $state_details_settings = EEH_Template::display_template( |
|
951 | + GEN_SET_TEMPLATE_PATH . 'state_details_settings.template.php', |
|
952 | + $this->_template_args, |
|
953 | + true |
|
954 | + ); |
|
955 | + |
|
956 | + if (defined('DOING_AJAX')) { |
|
957 | + $notices = EE_Error::get_notices(false, false, false); |
|
958 | + echo wp_json_encode( |
|
959 | + [ |
|
960 | + 'return_data' => $state_details_settings, |
|
961 | + 'success' => $notices['success'], |
|
962 | + 'errors' => $notices['errors'], |
|
963 | + ] |
|
964 | + ); |
|
965 | + die(); |
|
966 | + } |
|
967 | + return $state_details_settings; |
|
968 | + } |
|
969 | + |
|
970 | + |
|
971 | + /** |
|
972 | + * @return void |
|
973 | + * @throws EE_Error |
|
974 | + * @throws InvalidArgumentException |
|
975 | + * @throws InvalidDataTypeException |
|
976 | + * @throws InvalidInterfaceException |
|
977 | + * @throws ReflectionException |
|
978 | + */ |
|
979 | + public function add_new_state() |
|
980 | + { |
|
981 | + $success = true; |
|
982 | + $CNT_ISO = $this->getCountryISO(''); |
|
983 | + if (! $CNT_ISO) { |
|
984 | + EE_Error::add_error( |
|
985 | + esc_html__('No Country ISO code or an invalid Country ISO code was received.', 'event_espresso'), |
|
986 | + __FILE__, |
|
987 | + __FUNCTION__, |
|
988 | + __LINE__ |
|
989 | + ); |
|
990 | + $success = false; |
|
991 | + } |
|
992 | + $STA_abbrev = $this->request->getRequestParam('STA_abbrev'); |
|
993 | + if (! $STA_abbrev) { |
|
994 | + EE_Error::add_error( |
|
995 | + esc_html__('No State ISO code or an invalid State ISO code was received.', 'event_espresso'), |
|
996 | + __FILE__, |
|
997 | + __FUNCTION__, |
|
998 | + __LINE__ |
|
999 | + ); |
|
1000 | + $success = false; |
|
1001 | + } |
|
1002 | + $STA_name = $this->request->getRequestParam('STA_name'); |
|
1003 | + if (! $STA_name) { |
|
1004 | + EE_Error::add_error( |
|
1005 | + esc_html__('No State name or an invalid State name was received.', 'event_espresso'), |
|
1006 | + __FILE__, |
|
1007 | + __FUNCTION__, |
|
1008 | + __LINE__ |
|
1009 | + ); |
|
1010 | + $success = false; |
|
1011 | + } |
|
1012 | + |
|
1013 | + if ($success) { |
|
1014 | + $cols_n_values = [ |
|
1015 | + 'CNT_ISO' => $CNT_ISO, |
|
1016 | + 'STA_abbrev' => $STA_abbrev, |
|
1017 | + 'STA_name' => $STA_name, |
|
1018 | + 'STA_active' => true, |
|
1019 | + ]; |
|
1020 | + $success = EEM_State::instance()->insert($cols_n_values); |
|
1021 | + EE_Error::add_success(esc_html__('The State was added successfully.', 'event_espresso')); |
|
1022 | + } |
|
1023 | + |
|
1024 | + if (defined('DOING_AJAX')) { |
|
1025 | + $notices = EE_Error::get_notices(false, false, false); |
|
1026 | + echo wp_json_encode(array_merge($notices, ['return_data' => $CNT_ISO])); |
|
1027 | + die(); |
|
1028 | + } |
|
1029 | + $this->_redirect_after_action( |
|
1030 | + $success, |
|
1031 | + esc_html__('State', 'event_espresso'), |
|
1032 | + 'added', |
|
1033 | + ['action' => 'country_settings'] |
|
1034 | + ); |
|
1035 | + } |
|
1036 | + |
|
1037 | + |
|
1038 | + /** |
|
1039 | + * @return void |
|
1040 | + * @throws EE_Error |
|
1041 | + * @throws InvalidArgumentException |
|
1042 | + * @throws InvalidDataTypeException |
|
1043 | + * @throws InvalidInterfaceException |
|
1044 | + * @throws ReflectionException |
|
1045 | + */ |
|
1046 | + public function delete_state() |
|
1047 | + { |
|
1048 | + $CNT_ISO = $this->getCountryISO(); |
|
1049 | + $STA_ID = $this->request->getRequestParam('STA_ID'); |
|
1050 | + $STA_abbrev = $this->request->getRequestParam('STA_abbrev'); |
|
1051 | + |
|
1052 | + if (! $STA_ID) { |
|
1053 | + EE_Error::add_error( |
|
1054 | + esc_html__('No State ID or an invalid State ID was received.', 'event_espresso'), |
|
1055 | + __FILE__, |
|
1056 | + __FUNCTION__, |
|
1057 | + __LINE__ |
|
1058 | + ); |
|
1059 | + return; |
|
1060 | + } |
|
1061 | + |
|
1062 | + $success = EEM_State::instance()->delete_by_ID($STA_ID); |
|
1063 | + if ($success !== false) { |
|
1064 | + do_action( |
|
1065 | + 'AHEE__General_Settings_Admin_Page__delete_state__state_deleted', |
|
1066 | + $CNT_ISO, |
|
1067 | + $STA_ID, |
|
1068 | + ['STA_abbrev' => $STA_abbrev] |
|
1069 | + ); |
|
1070 | + EE_Error::add_success(esc_html__('The State was deleted successfully.', 'event_espresso')); |
|
1071 | + } |
|
1072 | + if (defined('DOING_AJAX')) { |
|
1073 | + $notices = EE_Error::get_notices(false); |
|
1074 | + $notices['return_data'] = true; |
|
1075 | + echo wp_json_encode($notices); |
|
1076 | + die(); |
|
1077 | + } |
|
1078 | + $this->_redirect_after_action( |
|
1079 | + $success, |
|
1080 | + esc_html__('State', 'event_espresso'), |
|
1081 | + 'deleted', |
|
1082 | + ['action' => 'country_settings'] |
|
1083 | + ); |
|
1084 | + } |
|
1085 | + |
|
1086 | + |
|
1087 | + /** |
|
1088 | + * @return void |
|
1089 | + * @throws EE_Error |
|
1090 | + * @throws InvalidArgumentException |
|
1091 | + * @throws InvalidDataTypeException |
|
1092 | + * @throws InvalidInterfaceException |
|
1093 | + * @throws ReflectionException |
|
1094 | + */ |
|
1095 | + protected function _update_country_settings() |
|
1096 | + { |
|
1097 | + $CNT_ISO = $this->getCountryISO(); |
|
1098 | + if (! $CNT_ISO) { |
|
1099 | + EE_Error::add_error( |
|
1100 | + esc_html__('No Country ISO code or an invalid Country ISO code was received.', 'event_espresso'), |
|
1101 | + __FILE__, |
|
1102 | + __FUNCTION__, |
|
1103 | + __LINE__ |
|
1104 | + ); |
|
1105 | + return; |
|
1106 | + } |
|
1107 | + |
|
1108 | + $country = $this->verifyOrGetCountryFromIso($CNT_ISO); |
|
1109 | + |
|
1110 | + $cols_n_values = []; |
|
1111 | + $cols_n_values['CNT_ISO3'] = strtoupper( |
|
1112 | + $this->request->getRequestParam('cntry', '', $country->ISO3()) |
|
1113 | + ); |
|
1114 | + $cols_n_values['CNT_name'] = |
|
1115 | + $this->request->getRequestParam("cntry[$CNT_ISO][CNT_name]", $country->name()); |
|
1116 | + $cols_n_values['CNT_cur_code'] = strtoupper( |
|
1117 | + $this->request->getRequestParam( |
|
1118 | + "cntry[$CNT_ISO][CNT_cur_code]", |
|
1119 | + $country->currency_code() |
|
1120 | + ) |
|
1121 | + ); |
|
1122 | + $cols_n_values['CNT_cur_single'] = $this->request->getRequestParam( |
|
1123 | + "cntry[$CNT_ISO][CNT_cur_single]", |
|
1124 | + $country->currency_name_single() |
|
1125 | + ); |
|
1126 | + $cols_n_values['CNT_cur_plural'] = $this->request->getRequestParam( |
|
1127 | + "cntry[$CNT_ISO][CNT_cur_plural]", |
|
1128 | + $country->currency_name_plural() |
|
1129 | + ); |
|
1130 | + $cols_n_values['CNT_cur_sign'] = $this->request->getRequestParam( |
|
1131 | + "cntry[$CNT_ISO][CNT_cur_sign]", |
|
1132 | + $country->currency_sign() |
|
1133 | + ); |
|
1134 | + $cols_n_values['CNT_cur_sign_b4'] = $this->request->getRequestParam( |
|
1135 | + "cntry[$CNT_ISO][CNT_cur_sign_b4]", |
|
1136 | + $country->currency_sign_before(), |
|
1137 | + DataType::BOOL |
|
1138 | + ); |
|
1139 | + $cols_n_values['CNT_cur_dec_plc'] = $this->request->getRequestParam( |
|
1140 | + "cntry[$CNT_ISO][CNT_cur_dec_plc]", |
|
1141 | + $country->currency_decimal_places() |
|
1142 | + ); |
|
1143 | + $cols_n_values['CNT_cur_dec_mrk'] = $this->request->getRequestParam( |
|
1144 | + "cntry[$CNT_ISO][CNT_cur_dec_mrk]", |
|
1145 | + $country->currency_decimal_mark() |
|
1146 | + ); |
|
1147 | + $cols_n_values['CNT_cur_thsnds'] = $this->request->getRequestParam( |
|
1148 | + "cntry[$CNT_ISO][CNT_cur_thsnds]", |
|
1149 | + $country->currency_thousands_separator() |
|
1150 | + ); |
|
1151 | + $cols_n_values['CNT_tel_code'] = $this->request->getRequestParam( |
|
1152 | + "cntry[$CNT_ISO][CNT_tel_code]", |
|
1153 | + $country->telephoneCode() |
|
1154 | + ); |
|
1155 | + $cols_n_values['CNT_active'] = $this->request->getRequestParam( |
|
1156 | + "cntry[$CNT_ISO][CNT_active]", |
|
1157 | + $country->isActive(), |
|
1158 | + DataType::BOOL |
|
1159 | + ); |
|
1160 | + |
|
1161 | + // allow filtering of country data |
|
1162 | + $cols_n_values = apply_filters( |
|
1163 | + 'FHEE__General_Settings_Admin_Page___update_country_settings__cols_n_values', |
|
1164 | + $cols_n_values |
|
1165 | + ); |
|
1166 | + |
|
1167 | + // where values |
|
1168 | + $where_cols_n_values = [['CNT_ISO' => $CNT_ISO]]; |
|
1169 | + // run the update |
|
1170 | + $success = EEM_Country::instance()->update($cols_n_values, $where_cols_n_values); |
|
1171 | + |
|
1172 | + // allow filtering of states data |
|
1173 | + $states = apply_filters( |
|
1174 | + 'FHEE__General_Settings_Admin_Page___update_country_settings__states', |
|
1175 | + $this->request->getRequestParam('states', [], DataType::STRING, true) |
|
1176 | + ); |
|
1177 | + |
|
1178 | + if (! empty($states) && $success !== false) { |
|
1179 | + // loop thru state data ( looks like : states[75][STA_name] ) |
|
1180 | + foreach ($states as $STA_ID => $state) { |
|
1181 | + $cols_n_values = [ |
|
1182 | + 'CNT_ISO' => $CNT_ISO, |
|
1183 | + 'STA_abbrev' => sanitize_text_field($state['STA_abbrev']), |
|
1184 | + 'STA_name' => sanitize_text_field($state['STA_name']), |
|
1185 | + 'STA_active' => filter_var($state['STA_active'], FILTER_VALIDATE_BOOLEAN), |
|
1186 | + ]; |
|
1187 | + // where values |
|
1188 | + $where_cols_n_values = [['STA_ID' => $STA_ID]]; |
|
1189 | + // run the update |
|
1190 | + $success = EEM_State::instance()->update($cols_n_values, $where_cols_n_values); |
|
1191 | + if ($success !== false) { |
|
1192 | + do_action( |
|
1193 | + 'AHEE__General_Settings_Admin_Page__update_country_settings__state_saved', |
|
1194 | + $CNT_ISO, |
|
1195 | + $STA_ID, |
|
1196 | + $cols_n_values |
|
1197 | + ); |
|
1198 | + } |
|
1199 | + } |
|
1200 | + } |
|
1201 | + // check if country being edited matches org option country, and if so, then update EE_Config with new settings |
|
1202 | + if ( |
|
1203 | + isset(EE_Registry::instance()->CFG->organization->CNT_ISO) |
|
1204 | + && $CNT_ISO == EE_Registry::instance()->CFG->organization->CNT_ISO |
|
1205 | + ) { |
|
1206 | + EE_Registry::instance()->CFG->currency = new EE_Currency_Config($CNT_ISO); |
|
1207 | + EE_Registry::instance()->CFG->update_espresso_config(); |
|
1208 | + } |
|
1209 | + |
|
1210 | + if ($success !== false) { |
|
1211 | + EE_Error::add_success( |
|
1212 | + esc_html__('Country Settings updated successfully.', 'event_espresso') |
|
1213 | + ); |
|
1214 | + } |
|
1215 | + $this->_redirect_after_action( |
|
1216 | + $success, |
|
1217 | + '', |
|
1218 | + '', |
|
1219 | + ['action' => 'country_settings', 'country' => $CNT_ISO], |
|
1220 | + true |
|
1221 | + ); |
|
1222 | + } |
|
1223 | + |
|
1224 | + |
|
1225 | + /** |
|
1226 | + * form_form_field_label_wrap |
|
1227 | + * |
|
1228 | + * @param string $label |
|
1229 | + * @return string |
|
1230 | + */ |
|
1231 | + public function country_form_field_label_wrap(string $label): string |
|
1232 | + { |
|
1233 | + return ' |
|
1234 | 1234 | <tr> |
1235 | 1235 | <th> |
1236 | 1236 | ' . $label . ' |
1237 | 1237 | </th>'; |
1238 | - } |
|
1239 | - |
|
1240 | - |
|
1241 | - /** |
|
1242 | - * form_form_field_input__wrap |
|
1243 | - * |
|
1244 | - * @param string $input |
|
1245 | - * @return string |
|
1246 | - */ |
|
1247 | - public function country_form_field_input__wrap(string $input): string |
|
1248 | - { |
|
1249 | - return ' |
|
1238 | + } |
|
1239 | + |
|
1240 | + |
|
1241 | + /** |
|
1242 | + * form_form_field_input__wrap |
|
1243 | + * |
|
1244 | + * @param string $input |
|
1245 | + * @return string |
|
1246 | + */ |
|
1247 | + public function country_form_field_input__wrap(string $input): string |
|
1248 | + { |
|
1249 | + return ' |
|
1250 | 1250 | <td class="general-settings-country-input-td"> |
1251 | 1251 | ' . $input . ' |
1252 | 1252 | </td> |
1253 | 1253 | </tr>'; |
1254 | - } |
|
1255 | - |
|
1256 | - |
|
1257 | - /** |
|
1258 | - * form_form_field_label_wrap |
|
1259 | - * |
|
1260 | - * @param string $label |
|
1261 | - * @param string $required_text |
|
1262 | - * @return string |
|
1263 | - */ |
|
1264 | - public function state_form_field_label_wrap(string $label, string $required_text): string |
|
1265 | - { |
|
1266 | - return $required_text; |
|
1267 | - } |
|
1268 | - |
|
1269 | - |
|
1270 | - /** |
|
1271 | - * form_form_field_input__wrap |
|
1272 | - * |
|
1273 | - * @param string $input |
|
1274 | - * @return string |
|
1275 | - */ |
|
1276 | - public function state_form_field_input__wrap(string $input): string |
|
1277 | - { |
|
1278 | - return ' |
|
1254 | + } |
|
1255 | + |
|
1256 | + |
|
1257 | + /** |
|
1258 | + * form_form_field_label_wrap |
|
1259 | + * |
|
1260 | + * @param string $label |
|
1261 | + * @param string $required_text |
|
1262 | + * @return string |
|
1263 | + */ |
|
1264 | + public function state_form_field_label_wrap(string $label, string $required_text): string |
|
1265 | + { |
|
1266 | + return $required_text; |
|
1267 | + } |
|
1268 | + |
|
1269 | + |
|
1270 | + /** |
|
1271 | + * form_form_field_input__wrap |
|
1272 | + * |
|
1273 | + * @param string $input |
|
1274 | + * @return string |
|
1275 | + */ |
|
1276 | + public function state_form_field_input__wrap(string $input): string |
|
1277 | + { |
|
1278 | + return ' |
|
1279 | 1279 | <td class="general-settings-country-state-input-td"> |
1280 | 1280 | ' . $input . ' |
1281 | 1281 | </td>'; |
1282 | - } |
|
1283 | - |
|
1284 | - |
|
1285 | - /***********/ |
|
1286 | - |
|
1287 | - |
|
1288 | - /** |
|
1289 | - * displays edit and view links for critical EE pages |
|
1290 | - * |
|
1291 | - * @param int $ee_page_id |
|
1292 | - * @return string |
|
1293 | - */ |
|
1294 | - public static function edit_view_links(int $ee_page_id): string |
|
1295 | - { |
|
1296 | - $edit_url = add_query_arg( |
|
1297 | - ['post' => $ee_page_id, 'action' => 'edit'], |
|
1298 | - admin_url('post.php') |
|
1299 | - ); |
|
1300 | - $links = '<a href="' . esc_url_raw($edit_url) . '" >' . esc_html__('Edit', 'event_espresso') . '</a>'; |
|
1301 | - $links .= ' | '; |
|
1302 | - $links .= '<a href="' . get_permalink($ee_page_id) . '" >' . esc_html__('View', 'event_espresso') . '</a>'; |
|
1303 | - |
|
1304 | - return $links; |
|
1305 | - } |
|
1306 | - |
|
1307 | - |
|
1308 | - /** |
|
1309 | - * displays page and shortcode status for critical EE pages |
|
1310 | - * |
|
1311 | - * @param WP_Post $ee_page |
|
1312 | - * @param string $shortcode |
|
1313 | - * @return string |
|
1314 | - */ |
|
1315 | - public static function page_and_shortcode_status(WP_Post $ee_page, string $shortcode): string |
|
1316 | - { |
|
1317 | - // page status |
|
1318 | - if (isset($ee_page->post_status) && $ee_page->post_status == 'publish') { |
|
1319 | - $pg_class = 'ee-status-bg--success'; |
|
1320 | - $pg_status = sprintf(esc_html__('Page%sStatus%sOK', 'event_espresso'), ' ', ' '); |
|
1321 | - } else { |
|
1322 | - $pg_class = 'ee-status-bg--error'; |
|
1323 | - $pg_status = sprintf(esc_html__('Page%sVisibility%sProblem', 'event_espresso'), ' ', ' '); |
|
1324 | - } |
|
1325 | - |
|
1326 | - // shortcode status |
|
1327 | - if (isset($ee_page->post_content) && strpos($ee_page->post_content, $shortcode) !== false) { |
|
1328 | - $sc_class = 'ee-status-bg--success'; |
|
1329 | - $sc_status = sprintf(esc_html__('Shortcode%sOK', 'event_espresso'), ' '); |
|
1330 | - } else { |
|
1331 | - $sc_class = 'ee-status-bg--error'; |
|
1332 | - $sc_status = sprintf(esc_html__('Shortcode%sProblem', 'event_espresso'), ' '); |
|
1333 | - } |
|
1334 | - |
|
1335 | - return ' |
|
1282 | + } |
|
1283 | + |
|
1284 | + |
|
1285 | + /***********/ |
|
1286 | + |
|
1287 | + |
|
1288 | + /** |
|
1289 | + * displays edit and view links for critical EE pages |
|
1290 | + * |
|
1291 | + * @param int $ee_page_id |
|
1292 | + * @return string |
|
1293 | + */ |
|
1294 | + public static function edit_view_links(int $ee_page_id): string |
|
1295 | + { |
|
1296 | + $edit_url = add_query_arg( |
|
1297 | + ['post' => $ee_page_id, 'action' => 'edit'], |
|
1298 | + admin_url('post.php') |
|
1299 | + ); |
|
1300 | + $links = '<a href="' . esc_url_raw($edit_url) . '" >' . esc_html__('Edit', 'event_espresso') . '</a>'; |
|
1301 | + $links .= ' | '; |
|
1302 | + $links .= '<a href="' . get_permalink($ee_page_id) . '" >' . esc_html__('View', 'event_espresso') . '</a>'; |
|
1303 | + |
|
1304 | + return $links; |
|
1305 | + } |
|
1306 | + |
|
1307 | + |
|
1308 | + /** |
|
1309 | + * displays page and shortcode status for critical EE pages |
|
1310 | + * |
|
1311 | + * @param WP_Post $ee_page |
|
1312 | + * @param string $shortcode |
|
1313 | + * @return string |
|
1314 | + */ |
|
1315 | + public static function page_and_shortcode_status(WP_Post $ee_page, string $shortcode): string |
|
1316 | + { |
|
1317 | + // page status |
|
1318 | + if (isset($ee_page->post_status) && $ee_page->post_status == 'publish') { |
|
1319 | + $pg_class = 'ee-status-bg--success'; |
|
1320 | + $pg_status = sprintf(esc_html__('Page%sStatus%sOK', 'event_espresso'), ' ', ' '); |
|
1321 | + } else { |
|
1322 | + $pg_class = 'ee-status-bg--error'; |
|
1323 | + $pg_status = sprintf(esc_html__('Page%sVisibility%sProblem', 'event_espresso'), ' ', ' '); |
|
1324 | + } |
|
1325 | + |
|
1326 | + // shortcode status |
|
1327 | + if (isset($ee_page->post_content) && strpos($ee_page->post_content, $shortcode) !== false) { |
|
1328 | + $sc_class = 'ee-status-bg--success'; |
|
1329 | + $sc_status = sprintf(esc_html__('Shortcode%sOK', 'event_espresso'), ' '); |
|
1330 | + } else { |
|
1331 | + $sc_class = 'ee-status-bg--error'; |
|
1332 | + $sc_status = sprintf(esc_html__('Shortcode%sProblem', 'event_espresso'), ' '); |
|
1333 | + } |
|
1334 | + |
|
1335 | + return ' |
|
1336 | 1336 | <span class="ee-page-status ' . $pg_class . '"><strong>' . $pg_status . '</strong></span> |
1337 | 1337 | <span class="ee-page-status ' . $sc_class . '"><strong>' . $sc_status . '</strong></span>'; |
1338 | - } |
|
1339 | - |
|
1340 | - |
|
1341 | - /** |
|
1342 | - * generates a dropdown of all parent pages - copied from WP core |
|
1343 | - * |
|
1344 | - * @param int $default |
|
1345 | - * @param int $parent |
|
1346 | - * @param int $level |
|
1347 | - * @param bool $echo |
|
1348 | - * @return string; |
|
1349 | - */ |
|
1350 | - public static function page_settings_dropdown( |
|
1351 | - int $default = 0, |
|
1352 | - int $parent = 0, |
|
1353 | - int $level = 0, |
|
1354 | - bool $echo = true |
|
1355 | - ): string { |
|
1356 | - global $wpdb; |
|
1357 | - $items = $wpdb->get_results( |
|
1358 | - $wpdb->prepare( |
|
1359 | - "SELECT ID, post_parent, post_title FROM $wpdb->posts WHERE post_parent = %d AND post_type = 'page' AND post_status != 'trash' ORDER BY menu_order", |
|
1360 | - $parent |
|
1361 | - ) |
|
1362 | - ); |
|
1363 | - $output = ''; |
|
1364 | - |
|
1365 | - if ($items) { |
|
1366 | - $level = absint($level); |
|
1367 | - foreach ($items as $item) { |
|
1368 | - $ID = absint($item->ID); |
|
1369 | - $post_title = wp_strip_all_tags($item->post_title); |
|
1370 | - $pad = str_repeat(' ', $level * 3); |
|
1371 | - $option = "\n\t"; |
|
1372 | - $option .= '<option class="level-' . $level . '" '; |
|
1373 | - $option .= 'value="' . $ID . '" '; |
|
1374 | - $option .= $ID === absint($default) ? ' selected' : ''; |
|
1375 | - $option .= '>'; |
|
1376 | - $option .= "$pad {$post_title}"; |
|
1377 | - $option .= '</option>'; |
|
1378 | - $output .= $option; |
|
1379 | - ob_start(); |
|
1380 | - parent_dropdown($default, $item->ID, $level + 1); |
|
1381 | - $output .= ob_get_clean(); |
|
1382 | - } |
|
1383 | - } |
|
1384 | - if ($echo) { |
|
1385 | - echo wp_kses($output, AllowedTags::getWithFormTags()); |
|
1386 | - return ''; |
|
1387 | - } |
|
1388 | - return $output; |
|
1389 | - } |
|
1390 | - |
|
1391 | - |
|
1392 | - /** |
|
1393 | - * Loads the scripts for the privacy settings form |
|
1394 | - */ |
|
1395 | - public function load_scripts_styles_privacy_settings() |
|
1396 | - { |
|
1397 | - $form_handler = $this->loader->getShared( |
|
1398 | - 'EventEspresso\core\domain\services\admin\privacy\forms\PrivacySettingsFormHandler' |
|
1399 | - ); |
|
1400 | - $form_handler->enqueueStylesAndScripts(); |
|
1401 | - } |
|
1402 | - |
|
1403 | - |
|
1404 | - /** |
|
1405 | - * display the privacy settings form |
|
1406 | - * |
|
1407 | - * @throws EE_Error |
|
1408 | - */ |
|
1409 | - public function privacySettings() |
|
1410 | - { |
|
1411 | - $this->_set_add_edit_form_tags('update_privacy_settings'); |
|
1412 | - $this->_set_publish_post_box_vars(null, false, false, null, false); |
|
1413 | - $form_handler = $this->loader->getShared( |
|
1414 | - 'EventEspresso\core\domain\services\admin\privacy\forms\PrivacySettingsFormHandler' |
|
1415 | - ); |
|
1416 | - $this->_template_args['admin_page_content'] = EEH_HTML::div( |
|
1417 | - $form_handler->display(), |
|
1418 | - '', |
|
1419 | - 'padding' |
|
1420 | - ); |
|
1421 | - $this->display_admin_page_with_sidebar(); |
|
1422 | - } |
|
1423 | - |
|
1424 | - |
|
1425 | - /** |
|
1426 | - * Update the privacy settings from form data |
|
1427 | - * |
|
1428 | - * @throws EE_Error |
|
1429 | - */ |
|
1430 | - public function updatePrivacySettings() |
|
1431 | - { |
|
1432 | - $form_handler = $this->loader->getShared( |
|
1433 | - 'EventEspresso\core\domain\services\admin\privacy\forms\PrivacySettingsFormHandler' |
|
1434 | - ); |
|
1435 | - $success = $form_handler->process($this->get_request_data()); |
|
1436 | - $this->_redirect_after_action( |
|
1437 | - $success, |
|
1438 | - esc_html__('Registration Form Options', 'event_espresso'), |
|
1439 | - 'updated', |
|
1440 | - ['action' => 'privacy_settings'] |
|
1441 | - ); |
|
1442 | - } |
|
1338 | + } |
|
1339 | + |
|
1340 | + |
|
1341 | + /** |
|
1342 | + * generates a dropdown of all parent pages - copied from WP core |
|
1343 | + * |
|
1344 | + * @param int $default |
|
1345 | + * @param int $parent |
|
1346 | + * @param int $level |
|
1347 | + * @param bool $echo |
|
1348 | + * @return string; |
|
1349 | + */ |
|
1350 | + public static function page_settings_dropdown( |
|
1351 | + int $default = 0, |
|
1352 | + int $parent = 0, |
|
1353 | + int $level = 0, |
|
1354 | + bool $echo = true |
|
1355 | + ): string { |
|
1356 | + global $wpdb; |
|
1357 | + $items = $wpdb->get_results( |
|
1358 | + $wpdb->prepare( |
|
1359 | + "SELECT ID, post_parent, post_title FROM $wpdb->posts WHERE post_parent = %d AND post_type = 'page' AND post_status != 'trash' ORDER BY menu_order", |
|
1360 | + $parent |
|
1361 | + ) |
|
1362 | + ); |
|
1363 | + $output = ''; |
|
1364 | + |
|
1365 | + if ($items) { |
|
1366 | + $level = absint($level); |
|
1367 | + foreach ($items as $item) { |
|
1368 | + $ID = absint($item->ID); |
|
1369 | + $post_title = wp_strip_all_tags($item->post_title); |
|
1370 | + $pad = str_repeat(' ', $level * 3); |
|
1371 | + $option = "\n\t"; |
|
1372 | + $option .= '<option class="level-' . $level . '" '; |
|
1373 | + $option .= 'value="' . $ID . '" '; |
|
1374 | + $option .= $ID === absint($default) ? ' selected' : ''; |
|
1375 | + $option .= '>'; |
|
1376 | + $option .= "$pad {$post_title}"; |
|
1377 | + $option .= '</option>'; |
|
1378 | + $output .= $option; |
|
1379 | + ob_start(); |
|
1380 | + parent_dropdown($default, $item->ID, $level + 1); |
|
1381 | + $output .= ob_get_clean(); |
|
1382 | + } |
|
1383 | + } |
|
1384 | + if ($echo) { |
|
1385 | + echo wp_kses($output, AllowedTags::getWithFormTags()); |
|
1386 | + return ''; |
|
1387 | + } |
|
1388 | + return $output; |
|
1389 | + } |
|
1390 | + |
|
1391 | + |
|
1392 | + /** |
|
1393 | + * Loads the scripts for the privacy settings form |
|
1394 | + */ |
|
1395 | + public function load_scripts_styles_privacy_settings() |
|
1396 | + { |
|
1397 | + $form_handler = $this->loader->getShared( |
|
1398 | + 'EventEspresso\core\domain\services\admin\privacy\forms\PrivacySettingsFormHandler' |
|
1399 | + ); |
|
1400 | + $form_handler->enqueueStylesAndScripts(); |
|
1401 | + } |
|
1402 | + |
|
1403 | + |
|
1404 | + /** |
|
1405 | + * display the privacy settings form |
|
1406 | + * |
|
1407 | + * @throws EE_Error |
|
1408 | + */ |
|
1409 | + public function privacySettings() |
|
1410 | + { |
|
1411 | + $this->_set_add_edit_form_tags('update_privacy_settings'); |
|
1412 | + $this->_set_publish_post_box_vars(null, false, false, null, false); |
|
1413 | + $form_handler = $this->loader->getShared( |
|
1414 | + 'EventEspresso\core\domain\services\admin\privacy\forms\PrivacySettingsFormHandler' |
|
1415 | + ); |
|
1416 | + $this->_template_args['admin_page_content'] = EEH_HTML::div( |
|
1417 | + $form_handler->display(), |
|
1418 | + '', |
|
1419 | + 'padding' |
|
1420 | + ); |
|
1421 | + $this->display_admin_page_with_sidebar(); |
|
1422 | + } |
|
1423 | + |
|
1424 | + |
|
1425 | + /** |
|
1426 | + * Update the privacy settings from form data |
|
1427 | + * |
|
1428 | + * @throws EE_Error |
|
1429 | + */ |
|
1430 | + public function updatePrivacySettings() |
|
1431 | + { |
|
1432 | + $form_handler = $this->loader->getShared( |
|
1433 | + 'EventEspresso\core\domain\services\admin\privacy\forms\PrivacySettingsFormHandler' |
|
1434 | + ); |
|
1435 | + $success = $form_handler->process($this->get_request_data()); |
|
1436 | + $this->_redirect_after_action( |
|
1437 | + $success, |
|
1438 | + esc_html__('Registration Form Options', 'event_espresso'), |
|
1439 | + 'updated', |
|
1440 | + ['action' => 'privacy_settings'] |
|
1441 | + ); |
|
1442 | + } |
|
1443 | 1443 | } |
@@ -246,19 +246,19 @@ discard block |
||
246 | 246 | 'event_espresso' |
247 | 247 | ) |
248 | 248 | ); |
249 | - EE_Registry::$i18n_js_strings['error_occurred'] = wp_strip_all_tags( |
|
249 | + EE_Registry::$i18n_js_strings['error_occurred'] = wp_strip_all_tags( |
|
250 | 250 | esc_html__( |
251 | 251 | 'An error occurred! Please refresh the page and try again.', |
252 | 252 | 'event_espresso' |
253 | 253 | ) |
254 | 254 | ); |
255 | - EE_Registry::$i18n_js_strings['confirm_delete_state'] = wp_strip_all_tags( |
|
255 | + EE_Registry::$i18n_js_strings['confirm_delete_state'] = wp_strip_all_tags( |
|
256 | 256 | esc_html__( |
257 | 257 | 'Are you sure you want to delete this State / Province?', |
258 | 258 | 'event_espresso' |
259 | 259 | ) |
260 | 260 | ); |
261 | - EE_Registry::$i18n_js_strings['ajax_url'] = admin_url( |
|
261 | + EE_Registry::$i18n_js_strings['ajax_url'] = admin_url( |
|
262 | 262 | 'admin-ajax.php?page=espresso_general_settings', |
263 | 263 | is_ssl() ? 'https://' : 'http://' |
264 | 264 | ); |
@@ -287,12 +287,12 @@ discard block |
||
287 | 287 | wp_enqueue_script('thickbox'); |
288 | 288 | wp_register_script( |
289 | 289 | 'organization_settings', |
290 | - GEN_SET_ASSETS_URL . 'your_organization_settings.js', |
|
290 | + GEN_SET_ASSETS_URL.'your_organization_settings.js', |
|
291 | 291 | ['jquery', 'media-upload', 'thickbox'], |
292 | 292 | EVENT_ESPRESSO_VERSION, |
293 | 293 | true |
294 | 294 | ); |
295 | - wp_register_style('organization-css', GEN_SET_ASSETS_URL . 'organization.css', [], EVENT_ESPRESSO_VERSION); |
|
295 | + wp_register_style('organization-css', GEN_SET_ASSETS_URL.'organization.css', [], EVENT_ESPRESSO_VERSION); |
|
296 | 296 | wp_enqueue_script('organization_settings'); |
297 | 297 | wp_enqueue_style('organization-css'); |
298 | 298 | $confirm_image_delete = [ |
@@ -315,12 +315,12 @@ discard block |
||
315 | 315 | // scripts |
316 | 316 | wp_register_script( |
317 | 317 | 'gen_settings_countries', |
318 | - GEN_SET_ASSETS_URL . 'gen_settings_countries.js', |
|
318 | + GEN_SET_ASSETS_URL.'gen_settings_countries.js', |
|
319 | 319 | ['ee_admin_js'], |
320 | 320 | EVENT_ESPRESSO_VERSION, |
321 | 321 | true |
322 | 322 | ); |
323 | - wp_register_style('organization-css', GEN_SET_ASSETS_URL . 'organization.css', [], EVENT_ESPRESSO_VERSION); |
|
323 | + wp_register_style('organization-css', GEN_SET_ASSETS_URL.'organization.css', [], EVENT_ESPRESSO_VERSION); |
|
324 | 324 | wp_enqueue_script('gen_settings_countries'); |
325 | 325 | wp_enqueue_style('organization-css'); |
326 | 326 | } |
@@ -368,7 +368,7 @@ discard block |
||
368 | 368 | $this->_set_add_edit_form_tags('update_espresso_page_settings'); |
369 | 369 | $this->_set_publish_post_box_vars(null, false, false, null, false); |
370 | 370 | $this->_template_args['admin_page_content'] = EEH_Template::display_template( |
371 | - GEN_SET_TEMPLATE_PATH . 'espresso_page_settings.template.php', |
|
371 | + GEN_SET_TEMPLATE_PATH.'espresso_page_settings.template.php', |
|
372 | 372 | $this->_template_args, |
373 | 373 | true |
374 | 374 | ); |
@@ -385,12 +385,12 @@ discard block |
||
385 | 385 | { |
386 | 386 | $this->core_config = EE_Registry::instance()->CFG->core; |
387 | 387 | // capture incoming request data && set page IDs |
388 | - $this->core_config->reg_page_id = $this->request->getRequestParam( |
|
388 | + $this->core_config->reg_page_id = $this->request->getRequestParam( |
|
389 | 389 | 'reg_page_id', |
390 | 390 | $this->core_config->reg_page_id, |
391 | 391 | DataType::INT |
392 | 392 | ); |
393 | - $this->core_config->txn_page_id = $this->request->getRequestParam( |
|
393 | + $this->core_config->txn_page_id = $this->request->getRequestParam( |
|
394 | 394 | 'txn_page_id', |
395 | 395 | $this->core_config->txn_page_id, |
396 | 396 | DataType::INT |
@@ -400,7 +400,7 @@ discard block |
||
400 | 400 | $this->core_config->thank_you_page_id, |
401 | 401 | DataType::INT |
402 | 402 | ); |
403 | - $this->core_config->cancel_page_id = $this->request->getRequestParam( |
|
403 | + $this->core_config->cancel_page_id = $this->request->getRequestParam( |
|
404 | 404 | 'cancel_page_id', |
405 | 405 | $this->core_config->cancel_page_id, |
406 | 406 | DataType::INT |
@@ -666,16 +666,16 @@ discard block |
||
666 | 666 | $country->ID(), |
667 | 667 | $country |
668 | 668 | ); |
669 | - $this->_template_args['country_states_settings'] = $this->display_country_states( |
|
669 | + $this->_template_args['country_states_settings'] = $this->display_country_states( |
|
670 | 670 | $country->ID(), |
671 | 671 | $country |
672 | 672 | ); |
673 | - $this->_template_args['CNT_name_for_site'] = $country->name(); |
|
673 | + $this->_template_args['CNT_name_for_site'] = $country->name(); |
|
674 | 674 | |
675 | 675 | $this->_set_add_edit_form_tags('update_country_settings'); |
676 | 676 | $this->_set_publish_post_box_vars(null, false, false, null, false); |
677 | 677 | $this->_template_args['admin_page_content'] = EEH_Template::display_template( |
678 | - GEN_SET_TEMPLATE_PATH . 'countries_settings.template.php', |
|
678 | + GEN_SET_TEMPLATE_PATH.'countries_settings.template.php', |
|
679 | 679 | $this->_template_args, |
680 | 680 | true |
681 | 681 | ); |
@@ -699,7 +699,7 @@ discard block |
||
699 | 699 | $CNT_ISO = $this->getCountryISO($CNT_ISO); |
700 | 700 | $CNT_ISO_for_site = $this->getCountryIsoForSite(); |
701 | 701 | |
702 | - if (! $CNT_ISO) { |
|
702 | + if ( ! $CNT_ISO) { |
|
703 | 703 | return ''; |
704 | 704 | } |
705 | 705 | |
@@ -712,7 +712,7 @@ discard block |
||
712 | 712 | $CNT_cur_disabled = $CNT_ISO !== $CNT_ISO_for_site; |
713 | 713 | $this->_template_args['CNT_cur_disabled'] = $CNT_cur_disabled; |
714 | 714 | |
715 | - $country_input_types = [ |
|
715 | + $country_input_types = [ |
|
716 | 716 | 'CNT_active' => [ |
717 | 717 | 'type' => 'RADIO_BTN', |
718 | 718 | 'input_name' => "cntry[$CNT_ISO]", |
@@ -837,8 +837,8 @@ discard block |
||
837 | 837 | $country, |
838 | 838 | $country_input_types |
839 | 839 | ); |
840 | - $country_details_settings = EEH_Template::display_template( |
|
841 | - GEN_SET_TEMPLATE_PATH . 'country_details_settings.template.php', |
|
840 | + $country_details_settings = EEH_Template::display_template( |
|
841 | + GEN_SET_TEMPLATE_PATH.'country_details_settings.template.php', |
|
842 | 842 | $this->_template_args, |
843 | 843 | true |
844 | 844 | ); |
@@ -872,7 +872,7 @@ discard block |
||
872 | 872 | public function display_country_states(string $CNT_ISO = '', ?EE_Country $country = null): string |
873 | 873 | { |
874 | 874 | $CNT_ISO = $this->getCountryISO($CNT_ISO); |
875 | - if (! $CNT_ISO) { |
|
875 | + if ( ! $CNT_ISO) { |
|
876 | 876 | return ''; |
877 | 877 | } |
878 | 878 | // for ajax |
@@ -934,8 +934,8 @@ discard block |
||
934 | 934 | GEN_SET_ADMIN_URL |
935 | 935 | ); |
936 | 936 | |
937 | - $this->_template_args['states'][ $STA_ID ]['inputs'] = $inputs; |
|
938 | - $this->_template_args['states'][ $STA_ID ]['delete_state_url'] = $delete_state_url; |
|
937 | + $this->_template_args['states'][$STA_ID]['inputs'] = $inputs; |
|
938 | + $this->_template_args['states'][$STA_ID]['delete_state_url'] = $delete_state_url; |
|
939 | 939 | } |
940 | 940 | } |
941 | 941 | } else { |
@@ -948,7 +948,7 @@ discard block |
||
948 | 948 | ); |
949 | 949 | |
950 | 950 | $state_details_settings = EEH_Template::display_template( |
951 | - GEN_SET_TEMPLATE_PATH . 'state_details_settings.template.php', |
|
951 | + GEN_SET_TEMPLATE_PATH.'state_details_settings.template.php', |
|
952 | 952 | $this->_template_args, |
953 | 953 | true |
954 | 954 | ); |
@@ -980,7 +980,7 @@ discard block |
||
980 | 980 | { |
981 | 981 | $success = true; |
982 | 982 | $CNT_ISO = $this->getCountryISO(''); |
983 | - if (! $CNT_ISO) { |
|
983 | + if ( ! $CNT_ISO) { |
|
984 | 984 | EE_Error::add_error( |
985 | 985 | esc_html__('No Country ISO code or an invalid Country ISO code was received.', 'event_espresso'), |
986 | 986 | __FILE__, |
@@ -990,7 +990,7 @@ discard block |
||
990 | 990 | $success = false; |
991 | 991 | } |
992 | 992 | $STA_abbrev = $this->request->getRequestParam('STA_abbrev'); |
993 | - if (! $STA_abbrev) { |
|
993 | + if ( ! $STA_abbrev) { |
|
994 | 994 | EE_Error::add_error( |
995 | 995 | esc_html__('No State ISO code or an invalid State ISO code was received.', 'event_espresso'), |
996 | 996 | __FILE__, |
@@ -1000,7 +1000,7 @@ discard block |
||
1000 | 1000 | $success = false; |
1001 | 1001 | } |
1002 | 1002 | $STA_name = $this->request->getRequestParam('STA_name'); |
1003 | - if (! $STA_name) { |
|
1003 | + if ( ! $STA_name) { |
|
1004 | 1004 | EE_Error::add_error( |
1005 | 1005 | esc_html__('No State name or an invalid State name was received.', 'event_espresso'), |
1006 | 1006 | __FILE__, |
@@ -1017,7 +1017,7 @@ discard block |
||
1017 | 1017 | 'STA_name' => $STA_name, |
1018 | 1018 | 'STA_active' => true, |
1019 | 1019 | ]; |
1020 | - $success = EEM_State::instance()->insert($cols_n_values); |
|
1020 | + $success = EEM_State::instance()->insert($cols_n_values); |
|
1021 | 1021 | EE_Error::add_success(esc_html__('The State was added successfully.', 'event_espresso')); |
1022 | 1022 | } |
1023 | 1023 | |
@@ -1049,7 +1049,7 @@ discard block |
||
1049 | 1049 | $STA_ID = $this->request->getRequestParam('STA_ID'); |
1050 | 1050 | $STA_abbrev = $this->request->getRequestParam('STA_abbrev'); |
1051 | 1051 | |
1052 | - if (! $STA_ID) { |
|
1052 | + if ( ! $STA_ID) { |
|
1053 | 1053 | EE_Error::add_error( |
1054 | 1054 | esc_html__('No State ID or an invalid State ID was received.', 'event_espresso'), |
1055 | 1055 | __FILE__, |
@@ -1095,7 +1095,7 @@ discard block |
||
1095 | 1095 | protected function _update_country_settings() |
1096 | 1096 | { |
1097 | 1097 | $CNT_ISO = $this->getCountryISO(); |
1098 | - if (! $CNT_ISO) { |
|
1098 | + if ( ! $CNT_ISO) { |
|
1099 | 1099 | EE_Error::add_error( |
1100 | 1100 | esc_html__('No Country ISO code or an invalid Country ISO code was received.', 'event_espresso'), |
1101 | 1101 | __FILE__, |
@@ -1119,15 +1119,15 @@ discard block |
||
1119 | 1119 | $country->currency_code() |
1120 | 1120 | ) |
1121 | 1121 | ); |
1122 | - $cols_n_values['CNT_cur_single'] = $this->request->getRequestParam( |
|
1122 | + $cols_n_values['CNT_cur_single'] = $this->request->getRequestParam( |
|
1123 | 1123 | "cntry[$CNT_ISO][CNT_cur_single]", |
1124 | 1124 | $country->currency_name_single() |
1125 | 1125 | ); |
1126 | - $cols_n_values['CNT_cur_plural'] = $this->request->getRequestParam( |
|
1126 | + $cols_n_values['CNT_cur_plural'] = $this->request->getRequestParam( |
|
1127 | 1127 | "cntry[$CNT_ISO][CNT_cur_plural]", |
1128 | 1128 | $country->currency_name_plural() |
1129 | 1129 | ); |
1130 | - $cols_n_values['CNT_cur_sign'] = $this->request->getRequestParam( |
|
1130 | + $cols_n_values['CNT_cur_sign'] = $this->request->getRequestParam( |
|
1131 | 1131 | "cntry[$CNT_ISO][CNT_cur_sign]", |
1132 | 1132 | $country->currency_sign() |
1133 | 1133 | ); |
@@ -1144,15 +1144,15 @@ discard block |
||
1144 | 1144 | "cntry[$CNT_ISO][CNT_cur_dec_mrk]", |
1145 | 1145 | $country->currency_decimal_mark() |
1146 | 1146 | ); |
1147 | - $cols_n_values['CNT_cur_thsnds'] = $this->request->getRequestParam( |
|
1147 | + $cols_n_values['CNT_cur_thsnds'] = $this->request->getRequestParam( |
|
1148 | 1148 | "cntry[$CNT_ISO][CNT_cur_thsnds]", |
1149 | 1149 | $country->currency_thousands_separator() |
1150 | 1150 | ); |
1151 | - $cols_n_values['CNT_tel_code'] = $this->request->getRequestParam( |
|
1151 | + $cols_n_values['CNT_tel_code'] = $this->request->getRequestParam( |
|
1152 | 1152 | "cntry[$CNT_ISO][CNT_tel_code]", |
1153 | 1153 | $country->telephoneCode() |
1154 | 1154 | ); |
1155 | - $cols_n_values['CNT_active'] = $this->request->getRequestParam( |
|
1155 | + $cols_n_values['CNT_active'] = $this->request->getRequestParam( |
|
1156 | 1156 | "cntry[$CNT_ISO][CNT_active]", |
1157 | 1157 | $country->isActive(), |
1158 | 1158 | DataType::BOOL |
@@ -1175,7 +1175,7 @@ discard block |
||
1175 | 1175 | $this->request->getRequestParam('states', [], DataType::STRING, true) |
1176 | 1176 | ); |
1177 | 1177 | |
1178 | - if (! empty($states) && $success !== false) { |
|
1178 | + if ( ! empty($states) && $success !== false) { |
|
1179 | 1179 | // loop thru state data ( looks like : states[75][STA_name] ) |
1180 | 1180 | foreach ($states as $STA_ID => $state) { |
1181 | 1181 | $cols_n_values = [ |
@@ -1233,7 +1233,7 @@ discard block |
||
1233 | 1233 | return ' |
1234 | 1234 | <tr> |
1235 | 1235 | <th> |
1236 | - ' . $label . ' |
|
1236 | + ' . $label.' |
|
1237 | 1237 | </th>'; |
1238 | 1238 | } |
1239 | 1239 | |
@@ -1248,7 +1248,7 @@ discard block |
||
1248 | 1248 | { |
1249 | 1249 | return ' |
1250 | 1250 | <td class="general-settings-country-input-td"> |
1251 | - ' . $input . ' |
|
1251 | + ' . $input.' |
|
1252 | 1252 | </td> |
1253 | 1253 | </tr>'; |
1254 | 1254 | } |
@@ -1277,7 +1277,7 @@ discard block |
||
1277 | 1277 | { |
1278 | 1278 | return ' |
1279 | 1279 | <td class="general-settings-country-state-input-td"> |
1280 | - ' . $input . ' |
|
1280 | + ' . $input.' |
|
1281 | 1281 | </td>'; |
1282 | 1282 | } |
1283 | 1283 | |
@@ -1297,9 +1297,9 @@ discard block |
||
1297 | 1297 | ['post' => $ee_page_id, 'action' => 'edit'], |
1298 | 1298 | admin_url('post.php') |
1299 | 1299 | ); |
1300 | - $links = '<a href="' . esc_url_raw($edit_url) . '" >' . esc_html__('Edit', 'event_espresso') . '</a>'; |
|
1300 | + $links = '<a href="'.esc_url_raw($edit_url).'" >'.esc_html__('Edit', 'event_espresso').'</a>'; |
|
1301 | 1301 | $links .= ' | '; |
1302 | - $links .= '<a href="' . get_permalink($ee_page_id) . '" >' . esc_html__('View', 'event_espresso') . '</a>'; |
|
1302 | + $links .= '<a href="'.get_permalink($ee_page_id).'" >'.esc_html__('View', 'event_espresso').'</a>'; |
|
1303 | 1303 | |
1304 | 1304 | return $links; |
1305 | 1305 | } |
@@ -1333,8 +1333,8 @@ discard block |
||
1333 | 1333 | } |
1334 | 1334 | |
1335 | 1335 | return ' |
1336 | - <span class="ee-page-status ' . $pg_class . '"><strong>' . $pg_status . '</strong></span> |
|
1337 | - <span class="ee-page-status ' . $sc_class . '"><strong>' . $sc_status . '</strong></span>'; |
|
1336 | + <span class="ee-page-status ' . $pg_class.'"><strong>'.$pg_status.'</strong></span> |
|
1337 | + <span class="ee-page-status ' . $sc_class.'"><strong>'.$sc_status.'</strong></span>'; |
|
1338 | 1338 | } |
1339 | 1339 | |
1340 | 1340 | |
@@ -1354,7 +1354,7 @@ discard block |
||
1354 | 1354 | bool $echo = true |
1355 | 1355 | ): string { |
1356 | 1356 | global $wpdb; |
1357 | - $items = $wpdb->get_results( |
|
1357 | + $items = $wpdb->get_results( |
|
1358 | 1358 | $wpdb->prepare( |
1359 | 1359 | "SELECT ID, post_parent, post_title FROM $wpdb->posts WHERE post_parent = %d AND post_type = 'page' AND post_status != 'trash' ORDER BY menu_order", |
1360 | 1360 | $parent |
@@ -1369,8 +1369,8 @@ discard block |
||
1369 | 1369 | $post_title = wp_strip_all_tags($item->post_title); |
1370 | 1370 | $pad = str_repeat(' ', $level * 3); |
1371 | 1371 | $option = "\n\t"; |
1372 | - $option .= '<option class="level-' . $level . '" '; |
|
1373 | - $option .= 'value="' . $ID . '" '; |
|
1372 | + $option .= '<option class="level-'.$level.'" '; |
|
1373 | + $option .= 'value="'.$ID.'" '; |
|
1374 | 1374 | $option .= $ID === absint($default) ? ' selected' : ''; |
1375 | 1375 | $option .= '>'; |
1376 | 1376 | $option .= "$pad {$post_title}"; |