@@ -1,7 +1,7 @@ discard block |
||
1 | 1 | <div id="admin-primary-mbox-dv" class="admin-primary-mbox-dv"> |
2 | 2 | |
3 | 3 | <h3 class="admin-primary-mbox-h4 hdr-has-icon"> |
4 | - <span class="dashicons dashicons-cart"></span><?php _e( 'Transaction Items', 'event_espresso' );?> |
|
4 | + <span class="dashicons dashicons-cart"></span><?php _e('Transaction Items', 'event_espresso'); ?> |
|
5 | 5 | </h3> |
6 | 6 | |
7 | 7 | <div class="admin-primary-mbox-tbl-wrap"> |
@@ -10,27 +10,27 @@ discard block |
||
10 | 10 | </div> |
11 | 11 | |
12 | 12 | <a id="display-additional-transaction-session-info" class="display-the-hidden smaller-text" rel="additional-transaction-session-info"> |
13 | - <span class="dashicons dashicons-plus-alt"></span><?php _e( 'view additional transaction session details', 'event_espresso' );?> |
|
13 | + <span class="dashicons dashicons-plus-alt"></span><?php _e('view additional transaction session details', 'event_espresso'); ?> |
|
14 | 14 | </a> |
15 | 15 | |
16 | 16 | <div id="additional-transaction-session-info-dv" class="hidden"> |
17 | 17 | |
18 | 18 | <a id="hide-additional-transaction-session-info" class="hide-the-displayed hidden smaller-text" rel="additional-transaction-session-info"> |
19 | - <span class="dashicons dashicons-dismiss"></span><?php _e( 'hide additional transaction session details', 'event_espresso' );?> |
|
19 | + <span class="dashicons dashicons-dismiss"></span><?php _e('hide additional transaction session details', 'event_espresso'); ?> |
|
20 | 20 | </a> |
21 | 21 | <br class="clear"/> |
22 | 22 | |
23 | - <h3 class="admin-primary-mbox-h4"><?php _e( 'Transaction Session Details', 'event_espresso' );?></h3> |
|
23 | + <h3 class="admin-primary-mbox-h4"><?php _e('Transaction Session Details', 'event_espresso'); ?></h3> |
|
24 | 24 | |
25 | 25 | <table id="admin-primary-mbox-txn-extra-session-info-tbl" class="form-table skinny-rows"> |
26 | 26 | <tbody> |
27 | - <?php foreach ( $txn_details as $key => $txn_detail ) : ?> |
|
27 | + <?php foreach ($txn_details as $key => $txn_detail) : ?> |
|
28 | 28 | <tr> |
29 | 29 | <th> |
30 | - <label for="<?php echo $key;?>"><?php echo $txn_detail['label'];?></label> |
|
30 | + <label for="<?php echo $key; ?>"><?php echo $txn_detail['label']; ?></label> |
|
31 | 31 | </th> |
32 | 32 | <td> |
33 | - <?php echo $txn_detail['value'];?> |
|
33 | + <?php echo $txn_detail['value']; ?> |
|
34 | 34 | </td> |
35 | 35 | </tr> |
36 | 36 | <?php endforeach; // $txn_details?> |
@@ -40,10 +40,10 @@ discard block |
||
40 | 40 | <br class="clear"/> |
41 | 41 | |
42 | 42 | |
43 | - <?php if ( $attendee instanceof EE_Attendee && ( $grand_raw_total > 0 || $TXN_status != 'TCM' || ! empty( $payments ) ) ) : ?> |
|
43 | + <?php if ($attendee instanceof EE_Attendee && ($grand_raw_total > 0 || $TXN_status != 'TCM' || ! empty($payments))) : ?> |
|
44 | 44 | |
45 | 45 | <h3 class="admin-primary-mbox-h4 hdr-has-icon"> |
46 | - <span class="ee-icon ee-icon-cash"></span><?php _e( 'Payment Details', 'event_espresso' );?> |
|
46 | + <span class="ee-icon ee-icon-cash"></span><?php _e('Payment Details', 'event_espresso'); ?> |
|
47 | 47 | </h3> |
48 | 48 | |
49 | 49 | <div class="admin-primary-mbox-tbl-wrap"> |
@@ -52,79 +52,79 @@ discard block |
||
52 | 52 | <tr> |
53 | 53 | <th></th> |
54 | 54 | <th class="jst-cntr"></th> |
55 | - <th class="jst-cntr"><?php _e( 'ID', 'event_espresso' );?></th> |
|
56 | - <th class="jst-left"><?php _e( 'Date', 'event_espresso' );?></th> |
|
57 | - <th class="jst-cntr"><?php _e( 'Source', 'event_espresso' );?></th> |
|
58 | - <th class="jst-left"><?php _e( 'Method', 'event_espresso' );?></th> |
|
59 | - <th class="jst-left"><?php _e( 'Gateway Response', 'event_espresso' );?></th> |
|
60 | - <th class="jst-left"><?php _e( 'TXN ID / CHQ #', 'event_espresso' );?></th> |
|
61 | - <th class="jst-left"><?php _e( 'P.O. / S.O. #', 'event_espresso' );?></th> |
|
62 | - <th class="jst-left"><?php _e( 'Notes / Extra Accounting', 'event_espresso' );?></th> |
|
63 | - <!--<th class="jst-left"><?php _e( 'Details', 'event_espresso' );?></th>--> |
|
64 | - <th class="jst-cntr"><?php _e( 'Amount', 'event_espresso' );?></th> |
|
55 | + <th class="jst-cntr"><?php _e('ID', 'event_espresso'); ?></th> |
|
56 | + <th class="jst-left"><?php _e('Date', 'event_espresso'); ?></th> |
|
57 | + <th class="jst-cntr"><?php _e('Source', 'event_espresso'); ?></th> |
|
58 | + <th class="jst-left"><?php _e('Method', 'event_espresso'); ?></th> |
|
59 | + <th class="jst-left"><?php _e('Gateway Response', 'event_espresso'); ?></th> |
|
60 | + <th class="jst-left"><?php _e('TXN ID / CHQ #', 'event_espresso'); ?></th> |
|
61 | + <th class="jst-left"><?php _e('P.O. / S.O. #', 'event_espresso'); ?></th> |
|
62 | + <th class="jst-left"><?php _e('Notes / Extra Accounting', 'event_espresso'); ?></th> |
|
63 | + <!--<th class="jst-left"><?php _e('Details', 'event_espresso'); ?></th>--> |
|
64 | + <th class="jst-cntr"><?php _e('Amount', 'event_espresso'); ?></th> |
|
65 | 65 | </tr> |
66 | 66 | </thead> |
67 | 67 | <tbody> |
68 | - <?php if ( $payments ) : ?> |
|
68 | + <?php if ($payments) : ?> |
|
69 | 69 | <?php $payment_total = 0; ?> |
70 | - <?php foreach ( $payments as $PAY_ID => $payment ) : |
|
71 | - $existing_reg_payment_json = isset( $existing_reg_payments[ $PAY_ID ] ) |
|
72 | - ? wp_json_encode( $existing_reg_payments[ $PAY_ID ] ) |
|
70 | + <?php foreach ($payments as $PAY_ID => $payment) : |
|
71 | + $existing_reg_payment_json = isset($existing_reg_payments[$PAY_ID]) |
|
72 | + ? wp_json_encode($existing_reg_payments[$PAY_ID]) |
|
73 | 73 | : '{}'; |
74 | 74 | ?> |
75 | - <tr id="txn-admin-payment-tr-<?php echo $PAY_ID;?>"> |
|
75 | + <tr id="txn-admin-payment-tr-<?php echo $PAY_ID; ?>"> |
|
76 | 76 | <td> |
77 | 77 | <span id="payment-status-<?php echo $PAY_ID; ?>" class="ee-status-strip-td ee-status-strip pymt-status-<?php echo $payment->STS_ID(); ?>"></span> |
78 | - <div id="payment-STS_ID-<?php echo $PAY_ID;?>" class="hidden"><?php echo $payment->STS_ID();?></div> |
|
79 | - <div id="reg-payments-<?php echo $PAY_ID;?>" class="hidden"><?php echo $existing_reg_payment_json; ?></div> |
|
78 | + <div id="payment-STS_ID-<?php echo $PAY_ID; ?>" class="hidden"><?php echo $payment->STS_ID(); ?></div> |
|
79 | + <div id="reg-payments-<?php echo $PAY_ID; ?>" class="hidden"><?php echo $existing_reg_payment_json; ?></div> |
|
80 | 80 | </td> |
81 | 81 | <td class=" jst-cntr"> |
82 | 82 | <ul class="txn-overview-actions-ul"> |
83 | 83 | <li> |
84 | - <a class="txn-admin-payment-action-edit-lnk" title="<?php esc_attr_e( 'Edit Payment', 'event_espresso' );?>" data-payment-id="<?php echo $PAY_ID;?>"> |
|
84 | + <a class="txn-admin-payment-action-edit-lnk" title="<?php esc_attr_e('Edit Payment', 'event_espresso'); ?>" data-payment-id="<?php echo $PAY_ID; ?>"> |
|
85 | 85 | <div class="dashicons dashicons-edit" style="margin: 0;"></div> |
86 | 86 | </a> |
87 | 87 | </li> |
88 | 88 | <li> |
89 | - <a class="txn-admin-payment-action-delete-lnk" title="<?php esc_attr_e( 'Delete Payment', 'event_espresso' );?>" data-payment-id="<?php echo $PAY_ID;?>"> |
|
89 | + <a class="txn-admin-payment-action-delete-lnk" title="<?php esc_attr_e('Delete Payment', 'event_espresso'); ?>" data-payment-id="<?php echo $PAY_ID; ?>"> |
|
90 | 90 | <div class="dashicons dashicons-trash" style="margin: 0;"></div> |
91 | 91 | </a> |
92 | 92 | </li> |
93 | 93 | </ul> |
94 | 94 | </td> |
95 | 95 | <td class=" jst-rght"> |
96 | - <div id="payment-id-<?php echo $PAY_ID;?>"><?php echo $PAY_ID;?></div> |
|
96 | + <div id="payment-id-<?php echo $PAY_ID; ?>"><?php echo $PAY_ID; ?></div> |
|
97 | 97 | </td> |
98 | 98 | <td class=" jst-left"> |
99 | - <div id="payment-date-<?php echo $PAY_ID;?>" class="payment-date-dv"><?php echo $payment->timestamp('Y-m-d', 'g:i a');?></div> |
|
99 | + <div id="payment-date-<?php echo $PAY_ID; ?>" class="payment-date-dv"><?php echo $payment->timestamp('Y-m-d', 'g:i a'); ?></div> |
|
100 | 100 | </td> |
101 | 101 | <td class=" jst-cntr"> |
102 | - <div id="payment-method-<?php echo $PAY_ID;?>"> |
|
103 | - <?php echo $payment->source();?> |
|
102 | + <div id="payment-method-<?php echo $PAY_ID; ?>"> |
|
103 | + <?php echo $payment->source(); ?> |
|
104 | 104 | </div> |
105 | 105 | </td> |
106 | 106 | <td class=" jst-left"> |
107 | - <div id="payment-gateway-<?php echo $PAY_ID;?>"> |
|
108 | - <?php echo $payment->payment_method() ? $payment->payment_method()->admin_name() : __("Unknown", 'event_espresso');?> |
|
107 | + <div id="payment-gateway-<?php echo $PAY_ID; ?>"> |
|
108 | + <?php echo $payment->payment_method() ? $payment->payment_method()->admin_name() : __("Unknown", 'event_espresso'); ?> |
|
109 | 109 | </div> |
110 | - <div id="payment-gateway-id-<?php echo $PAY_ID;?>" class="hidden"><?php echo $payment->payment_method() ? $payment->payment_method()->ID() : 0;?></div> |
|
110 | + <div id="payment-gateway-id-<?php echo $PAY_ID; ?>" class="hidden"><?php echo $payment->payment_method() ? $payment->payment_method()->ID() : 0; ?></div> |
|
111 | 111 | </td> |
112 | 112 | <td class=" jst-left"> |
113 | - <div id="payment-response-<?php echo $PAY_ID;?>"><?php echo $payment->gateway_response();?></div> |
|
113 | + <div id="payment-response-<?php echo $PAY_ID; ?>"><?php echo $payment->gateway_response(); ?></div> |
|
114 | 114 | </td> |
115 | 115 | <td class=" jst-left"> |
116 | - <div id="payment-txn-id-chq-nmbr-<?php echo $PAY_ID;?>"><?php echo $payment->txn_id_chq_nmbr();?></div> |
|
116 | + <div id="payment-txn-id-chq-nmbr-<?php echo $PAY_ID; ?>"><?php echo $payment->txn_id_chq_nmbr(); ?></div> |
|
117 | 117 | </td> |
118 | 118 | <td class=" jst-left"> |
119 | - <div id="payment-po-nmbr-<?php echo $PAY_ID;?>"><?php echo $payment->po_number();?></div> |
|
119 | + <div id="payment-po-nmbr-<?php echo $PAY_ID; ?>"><?php echo $payment->po_number(); ?></div> |
|
120 | 120 | </td> |
121 | 121 | <td class=" jst-left"> |
122 | - <div id="payment-accntng-<?php echo $PAY_ID;?>"><?php echo $payment->extra_accntng();?></div> |
|
122 | + <div id="payment-accntng-<?php echo $PAY_ID; ?>"><?php echo $payment->extra_accntng(); ?></div> |
|
123 | 123 | </td> |
124 | 124 | <td class=" jst-rght"> |
125 | - <?php $payment_class = $payment->amount() > 0 ? 'txn-admin-payment-status-' . $payment->STS_ID() : 'txn-admin-payment-status-PDC'; ?> |
|
126 | - <span class="<?php echo $payment_class;?>"> |
|
127 | - <div id="payment-amount-<?php echo $PAY_ID;?>" style="display:inline;"><?php echo EEH_Template::format_currency($payment->amount(), FALSE, FALSE ); ?></div> |
|
125 | + <?php $payment_class = $payment->amount() > 0 ? 'txn-admin-payment-status-'.$payment->STS_ID() : 'txn-admin-payment-status-PDC'; ?> |
|
126 | + <span class="<?php echo $payment_class; ?>"> |
|
127 | + <div id="payment-amount-<?php echo $PAY_ID; ?>" style="display:inline;"><?php echo EEH_Template::format_currency($payment->amount(), FALSE, FALSE); ?></div> |
|
128 | 128 | </span> |
129 | 129 | </td> |
130 | 130 | </tr> |
@@ -134,25 +134,25 @@ discard block |
||
134 | 134 | <?php endforeach; // $payment?> |
135 | 135 | <?php |
136 | 136 | $pay_totals_class = $payment_total > $grand_raw_total ? ' important-notice' : ''; |
137 | - $overpaid = $payment_total > $grand_raw_total ? '<span id="overpaid">' . __( 'This transaction has been overpaid ! ', 'event_espresso' ) . '</span>' : ''; |
|
137 | + $overpaid = $payment_total > $grand_raw_total ? '<span id="overpaid">'.__('This transaction has been overpaid ! ', 'event_espresso').'</span>' : ''; |
|
138 | 138 | ?> |
139 | 139 | <tr id="txn-admin-no-payments-tr" class="admin-primary-mbox-total-tr hidden"> |
140 | 140 | <td class=" jst-rght" colspan="11"> |
141 | - <span class="important-notice"><?php _e( 'No payments have been applied to this transaction yet. Click "Apply Payment" below to make a payment.', 'event_espresso' ); ?></span> |
|
141 | + <span class="important-notice"><?php _e('No payments have been applied to this transaction yet. Click "Apply Payment" below to make a payment.', 'event_espresso'); ?></span> |
|
142 | 142 | </td> |
143 | 143 | </tr> |
144 | - <tr id="txn-admin-payments-total-tr" class="admin-primary-mbox-total-tr<?php echo $pay_totals_class;?>"> |
|
145 | - <th class=" jst-rght" colspan="10"><span id="payments-total-spn"><?php echo $overpaid . sprintf( __( 'Payments Total %s', 'event_espresso' ), '(' . EE_Registry::instance()->CFG->currency->code . ')' );?></span></th> |
|
146 | - <th class=" jst-rght"><span id="txn-admin-payment-total"><?php echo EEH_Template::format_currency($payment_total, FALSE, FALSE);?></span></th> |
|
144 | + <tr id="txn-admin-payments-total-tr" class="admin-primary-mbox-total-tr<?php echo $pay_totals_class; ?>"> |
|
145 | + <th class=" jst-rght" colspan="10"><span id="payments-total-spn"><?php echo $overpaid.sprintf(__('Payments Total %s', 'event_espresso'), '('.EE_Registry::instance()->CFG->currency->code.')'); ?></span></th> |
|
146 | + <th class=" jst-rght"><span id="txn-admin-payment-total"><?php echo EEH_Template::format_currency($payment_total, FALSE, FALSE); ?></span></th> |
|
147 | 147 | </tr> |
148 | 148 | <?php else : ?> |
149 | 149 | <tr id="txn-admin-no-payments-tr" class="admin-primary-mbox-total-tr"> |
150 | 150 | <td class=" jst-rght" colspan="11"> |
151 | - <span class="important-notice"><?php _e( 'No payments have been applied to this transaction yet. Click "Apply Payment" below to make a payment.', 'event_espresso' ); ?></span> |
|
151 | + <span class="important-notice"><?php _e('No payments have been applied to this transaction yet. Click "Apply Payment" below to make a payment.', 'event_espresso'); ?></span> |
|
152 | 152 | </td> |
153 | 153 | </tr> |
154 | 154 | <tr id="txn-admin-payments-total-tr" class="admin-primary-mbox-total-tr hidden"> |
155 | - <th class=" jst-rght" colspan="10"><span id="payments-total-spn"><?php echo __( 'Payments Total', 'event_espresso' );?></span></th> |
|
155 | + <th class=" jst-rght" colspan="10"><span id="payments-total-spn"><?php echo __('Payments Total', 'event_espresso'); ?></span></th> |
|
156 | 156 | <th class=" jst-rght"><span id="txn-admin-payment-total"></span></th> |
157 | 157 | </tr> |
158 | 158 | <?php endif; // $payments?> |
@@ -165,12 +165,12 @@ discard block |
||
165 | 165 | <td class=" jst-cntr"> |
166 | 166 | <ul class="txn-overview-actions-ul"> |
167 | 167 | <li> |
168 | - <a class="txn-admin-payment-action-edit-lnk" title="<?php esc_attr_e( 'Edit Payment', 'event_espresso' );?>" data-payment-id="PAY_ID"> |
|
168 | + <a class="txn-admin-payment-action-edit-lnk" title="<?php esc_attr_e('Edit Payment', 'event_espresso'); ?>" data-payment-id="PAY_ID"> |
|
169 | 169 | <div class="dashicons dashicons-edit" style="margin: 0;"></div> |
170 | 170 | </a> |
171 | 171 | </li> |
172 | 172 | <li> |
173 | - <a class="txn-admin-payment-action-delete-lnk" title="<?php esc_attr_e( 'Delete Payment', 'event_espresso' );?>" data-payment-id="PAY_ID"> |
|
173 | + <a class="txn-admin-payment-action-delete-lnk" title="<?php esc_attr_e('Delete Payment', 'event_espresso'); ?>" data-payment-id="PAY_ID"> |
|
174 | 174 | <div class="dashicons dashicons-trash" style="margin: 0;"></div> |
175 | 175 | </a> |
176 | 176 | </li> |
@@ -217,12 +217,12 @@ discard block |
||
217 | 217 | <ul id="txn-admin-payment-options-ul"> |
218 | 218 | <li> |
219 | 219 | <a id="display-txn-admin-apply-payment" class="button-primary no-icon no-hide" rel="txn-admin-apply-payment" > <!--display-the-hidden --> |
220 | - <?php _e( 'Apply Payment', 'event_espresso' );?> |
|
220 | + <?php _e('Apply Payment', 'event_espresso'); ?> |
|
221 | 221 | </a> |
222 | 222 | </li> |
223 | 223 | <li> |
224 | 224 | <a id="display-txn-admin-apply-refund" class="button-secondary no-icon no-hide" rel="txn-admin-apply-refund" > <!--display-the-hidden --> |
225 | - <?php _e( 'Apply Refund', 'event_espresso' );?> |
|
225 | + <?php _e('Apply Refund', 'event_espresso'); ?> |
|
226 | 226 | </a> |
227 | 227 | </li> |
228 | 228 | </ul> |
@@ -232,14 +232,14 @@ discard block |
||
232 | 232 | |
233 | 233 | <h2 id="admin-modal-dialog-apply-payment-h2" class="admin-modal-dialog-h2 hdr-has-icon" style="display:none;"> |
234 | 234 | <div class="ee-icon ee-icon-cash-add float-left"></div> |
235 | - <?php echo __( 'Apply a Payment to Transaction #', 'event_espresso' ) . $txn_nmbr['value'];?> |
|
235 | + <?php echo __('Apply a Payment to Transaction #', 'event_espresso').$txn_nmbr['value']; ?> |
|
236 | 236 | </h2> |
237 | 237 | |
238 | 238 | <h2 id="admin-modal-dialog-edit-payment-h2" class="admin-modal-dialog-h2 hdr-has-icon" style="display:none;"> |
239 | 239 | <div class="ee-icon ee-icon-cash-edit float-left"></div> |
240 | 240 | <?php |
241 | 241 | echo sprintf( |
242 | - __( 'Edit Payment #%s for Transaction #%s', 'event_espresso' ), |
|
242 | + __('Edit Payment #%s for Transaction #%s', 'event_espresso'), |
|
243 | 243 | '<span></span>', |
244 | 244 | $txn_nmbr['value'] |
245 | 245 | ); |
@@ -250,7 +250,7 @@ discard block |
||
250 | 250 | <div class="ee-icon ee-icon-cash-edit float-left"></div> |
251 | 251 | <?php |
252 | 252 | echo sprintf( |
253 | - __( 'Edit Refund #%s for Transaction #%s', 'event_espresso' ), |
|
253 | + __('Edit Refund #%s for Transaction #%s', 'event_espresso'), |
|
254 | 254 | '<span></span>', |
255 | 255 | $txn_nmbr['value'] |
256 | 256 | ); |
@@ -259,14 +259,14 @@ discard block |
||
259 | 259 | |
260 | 260 | <h2 id="admin-modal-dialog-apply-refund-h2" class="admin-modal-dialog-h2 hdr-has-icon" style="display:none;"> |
261 | 261 | <div class="ee-icon ee-icon-cash-remove float-left"></div> |
262 | - <?php echo __( 'Apply a Refund to Transaction #', 'event_espresso' ) . $txn_nmbr['value'];?> |
|
262 | + <?php echo __('Apply a Refund to Transaction #', 'event_espresso').$txn_nmbr['value']; ?> |
|
263 | 263 | </h2> |
264 | 264 | |
265 | 265 | <form name="txn-admin-apply-payment-frm" id="txn-admin-apply-payment-frm" action="<?php echo $apply_payment_form_url; ?>"> |
266 | 266 | <div class="admin-modal-dialog-wrap"> |
267 | 267 | <div class="admin-modal-dialog-inner"> |
268 | 268 | |
269 | - <input type="hidden" name="espresso_apply_payment_nonce" id="espresso_apply_payment_nonce" value="<?php echo wp_create_nonce( 'espresso_apply_payment_nonce' );?>"/> |
|
269 | + <input type="hidden" name="espresso_apply_payment_nonce" id="espresso_apply_payment_nonce" value="<?php echo wp_create_nonce('espresso_apply_payment_nonce'); ?>"/> |
|
270 | 270 | <input type="hidden" name="espresso_ajax" id="espresso-ajax" value="0"/> |
271 | 271 | <input type="hidden" name="noheader" id="txn-admin-noheader-inp" value="0"/> |
272 | 272 | <input type="hidden" name="txn_admin_payment[PAY_ID]" id="txn-admin-payment-payment-id-inp" class="txn-admin-apply-payment-inp" value="0"/> |
@@ -274,108 +274,108 @@ discard block |
||
274 | 274 | <input type="hidden" name="txn_admin_payment[type]" id="txn-admin-payment-type-inp" value="1"/> |
275 | 275 | <input type="hidden" name="txn_admin_payment[details]" id="txn-admin-payment-details-inp" value=""/> |
276 | 276 | <input type="hidden" name="txn_admin_delete_payment_form_url" id="txn-admin-delete-payment-form-url-inp" value="<?php echo $delete_payment_form_url; ?>"/> |
277 | - <input type="hidden" name="txn_admin_todays_date" id="txn-admin-todays-date-inp" value="<?php echo date( 'Y-m-d h:i a', current_time( 'timestamp' )); ?>"/> |
|
277 | + <input type="hidden" name="txn_admin_todays_date" id="txn-admin-todays-date-inp" value="<?php echo date('Y-m-d h:i a', current_time('timestamp')); ?>"/> |
|
278 | 278 | |
279 | 279 | <div class="txn-admin-apply-payment-date-dv admin-modal-dialog-row"> |
280 | - <div class="validation-notice-dv"><?php _e( 'The following is a required field', 'event_espresso' );?></div> |
|
281 | - <label for="txn-admin-payment-date-inp" class=""><?php _e( 'Payment Date', 'event_espresso' );?></label> |
|
282 | - <input name="txn_admin_payment[date]" id="txn-admin-payment-date-inp" class="txn-admin-apply-payment-inp required" type="text" value="<?php echo date( 'Y-m-d g:i a', current_time( 'timestamp' )); ?>"/> |
|
283 | - <p class="description"><?php _e( 'The date the payment was actually made on', 'event_espresso' );?></p> |
|
280 | + <div class="validation-notice-dv"><?php _e('The following is a required field', 'event_espresso'); ?></div> |
|
281 | + <label for="txn-admin-payment-date-inp" class=""><?php _e('Payment Date', 'event_espresso'); ?></label> |
|
282 | + <input name="txn_admin_payment[date]" id="txn-admin-payment-date-inp" class="txn-admin-apply-payment-inp required" type="text" value="<?php echo date('Y-m-d g:i a', current_time('timestamp')); ?>"/> |
|
283 | + <p class="description"><?php _e('The date the payment was actually made on', 'event_espresso'); ?></p> |
|
284 | 284 | </div> |
285 | 285 | |
286 | 286 | <div class="txn-admin-apply-payment-amount-dv admin-modal-dialog-row"> |
287 | - <div class="validation-notice-dv"><?php _e( 'The following is a required field', 'event_espresso' );?></div> |
|
288 | - <label for="txn-admin-payment-amount-inp" class=""><?php _e( 'Amount', 'event_espresso' );?></label> |
|
287 | + <div class="validation-notice-dv"><?php _e('The following is a required field', 'event_espresso'); ?></div> |
|
288 | + <label for="txn-admin-payment-amount-inp" class=""><?php _e('Amount', 'event_espresso'); ?></label> |
|
289 | 289 | <input name="txn_admin_payment[amount]" id="txn-admin-payment-amount-inp" class="txn-admin-apply-payment-inp required" type="text" value=""/> |
290 | - <p class="description"><?php _e( 'The amount of the payment', 'event_espresso' );?></p> |
|
290 | + <p class="description"><?php _e('The amount of the payment', 'event_espresso'); ?></p> |
|
291 | 291 | </div> |
292 | 292 | |
293 | 293 | <div class="txn-admin-apply-payment-method-dv admin-modal-dialog-row"> |
294 | - <div class="validation-notice-dv"><?php _e( 'The following is a required field', 'event_espresso' );?></div> |
|
295 | - <label for="txn-admin-payment-method-inp" class=""><?php _e( 'Method of Payment', 'event_espresso' );?></label> |
|
294 | + <div class="validation-notice-dv"><?php _e('The following is a required field', 'event_espresso'); ?></div> |
|
295 | + <label for="txn-admin-payment-method-inp" class=""><?php _e('Method of Payment', 'event_espresso'); ?></label> |
|
296 | 296 | <select name="txn_admin_payment[PMD_ID]" id="txn-admin-payment-method-slct" class="txn-admin-apply-payment-slct required" type="text" > |
297 | - <?php foreach ( $payment_methods as $method ) : ?> |
|
297 | + <?php foreach ($payment_methods as $method) : ?> |
|
298 | 298 | <?php $selected = $method->slug() == 'cash' ? ' selected="selected"' : ''; ?> |
299 | - <option id="payment-method-opt-<?php echo $method->slug(); ?>" value="<?php echo $method->ID(); ?>"<?php echo $selected; ?>><?php echo sanitize_key( $method->admin_desc() ) ? substr( $method->admin_desc(), 0, 128) : $method->admin_name() ; ?> </option> |
|
299 | + <option id="payment-method-opt-<?php echo $method->slug(); ?>" value="<?php echo $method->ID(); ?>"<?php echo $selected; ?>><?php echo sanitize_key($method->admin_desc()) ? substr($method->admin_desc(), 0, 128) : $method->admin_name(); ?> </option> |
|
300 | 300 | <?php endforeach; ?> |
301 | 301 | </select> |
302 | - <p class="description"><?php _e( 'Whether the payment was made via PayPal, Credit Card, Cheque, or Cash', 'event_espresso' );?></p> |
|
302 | + <p class="description"><?php _e('Whether the payment was made via PayPal, Credit Card, Cheque, or Cash', 'event_espresso'); ?></p> |
|
303 | 303 | </div> |
304 | 304 | |
305 | 305 | <div class="mop-PP mop-CC mop-CHQ mop"> |
306 | 306 | <div class="txn-admin-apply-payment-gw-txn-id-dv admin-modal-dialog-row"> |
307 | - <label for="txn-admin-payment-txn-id-inp" class=""><?php _e( 'TXN ID / CHQ #', 'event_espresso' );?></label> |
|
307 | + <label for="txn-admin-payment-txn-id-inp" class=""><?php _e('TXN ID / CHQ #', 'event_espresso'); ?></label> |
|
308 | 308 | <input name="txn_admin_payment[txn_id_chq_nmbr]" id="txn-admin-payment-txn-id-chq-nmbr-inp" class="txn-admin-apply-payment-inp" type="text" maxlength="100"/> |
309 | - <p class="description"><?php _e( 'The Transaction ID sent back from the payment gateway, or the Cheque #', 'event_espresso' );?></p> |
|
309 | + <p class="description"><?php _e('The Transaction ID sent back from the payment gateway, or the Cheque #', 'event_espresso'); ?></p> |
|
310 | 310 | </div> |
311 | 311 | </div> |
312 | 312 | |
313 | 313 | <div class="mop-CC mop" style="display:none"> |
314 | 314 | <div class="txn-admin-apply-payment-response-dv admin-modal-dialog-row"> |
315 | - <label for="txn-admin-payment-gateway-response-inp" class=""><?php _e( 'Gateway Response', 'event_espresso' );?></label> |
|
315 | + <label for="txn-admin-payment-gateway-response-inp" class=""><?php _e('Gateway Response', 'event_espresso'); ?></label> |
|
316 | 316 | <input name="txn_admin_payment[gateway_response]" id="txn-admin-payment-gateway-response-inp" class="txn-admin-apply-payment-inp" type="text"/> |
317 | - <p class="description"><?php _e( 'The gateway response string (optional)', 'event_espresso' );?></p> |
|
317 | + <p class="description"><?php _e('The gateway response string (optional)', 'event_espresso'); ?></p> |
|
318 | 318 | </div> |
319 | 319 | </div> |
320 | 320 | |
321 | 321 | <div class="mop-PP mop-CC mop"> |
322 | 322 | <div class="txn-admin-apply-payment-status-dv admin-modal-dialog-row"> |
323 | - <label for="txn-admin-payment-status-inp" class=""><?php _e( 'Payment Status', 'event_espresso' );?></label> |
|
323 | + <label for="txn-admin-payment-status-inp" class=""><?php _e('Payment Status', 'event_espresso'); ?></label> |
|
324 | 324 | <select name="txn_admin_payment[status]" id="txn-admin-payment-status-slct" class="txn-admin-apply-payment-slct" type="text" > |
325 | - <?php foreach ( $payment_status as $STS_ID => $STS_code ) : ?> |
|
325 | + <?php foreach ($payment_status as $STS_ID => $STS_code) : ?> |
|
326 | 326 | <?php $selected = $STS_ID == 'PAP' ? ' selected="selected"' : ''; ?> |
327 | 327 | <option id="payment-status-opt-<?php echo $STS_ID; ?>" value="<?php echo $STS_ID; ?>"<?php echo $selected; ?>><?php echo $STS_code; ?> </option> |
328 | 328 | <?php endforeach; ?> |
329 | 329 | </select> |
330 | - <p class="description"><?php _e( 'Whether the payment was approved, cancelled, declined or failed after submission to the gateway', 'event_espresso' );?></p> |
|
330 | + <p class="description"><?php _e('Whether the payment was approved, cancelled, declined or failed after submission to the gateway', 'event_espresso'); ?></p> |
|
331 | 331 | </div> |
332 | 332 | </div> |
333 | 333 | |
334 | 334 | <div class="txn-admin-apply-payment-po-nmbr-dv admin-modal-dialog-row"> |
335 | - <label for="txn-admin-payment-po-nmbr-inp" class=""><?php _e( 'P.O. / S.O. #', 'event_espresso' );?></label> |
|
335 | + <label for="txn-admin-payment-po-nmbr-inp" class=""><?php _e('P.O. / S.O. #', 'event_espresso'); ?></label> |
|
336 | 336 | <input name="txn_admin_payment[po_number]" id="txn-admin-payment-po-nmbr-inp" class="txn-admin-apply-payment-inp" type="text" maxlength="100"/> |
337 | - <p class="description"><?php _e( 'The Purchase or Sales Order Number if any (optional)', 'event_espresso' );?></p> |
|
337 | + <p class="description"><?php _e('The Purchase or Sales Order Number if any (optional)', 'event_espresso'); ?></p> |
|
338 | 338 | </div> |
339 | 339 | |
340 | 340 | <div class="txn-admin-apply-payment-accounting-dv admin-modal-dialog-row"> |
341 | - <label for="txn-admin-payment-accounting-inp" class="last"><?php _e( 'Notes / Extra Accounting', 'event_espresso' );?></label> |
|
341 | + <label for="txn-admin-payment-accounting-inp" class="last"><?php _e('Notes / Extra Accounting', 'event_espresso'); ?></label> |
|
342 | 342 | <input name="txn_admin_payment[accounting]" id="txn-admin-payment-accounting-inp" class="txn-admin-apply-payment-inp" type="text" value="<?php echo $REG_code; ?>" maxlength="100"/> <input type="hidden" id="txn-admin-reg-code-inp" value="<?php echo $REG_code; ?>"/> |
343 | - <p class="description"><?php _e( 'An extra field you may use for accounting purposes or simple notes. Defaults to the primary registrant\'s registration code.', 'event_espresso' );?></p> |
|
343 | + <p class="description"><?php _e('An extra field you may use for accounting purposes or simple notes. Defaults to the primary registrant\'s registration code.', 'event_espresso'); ?></p> |
|
344 | 344 | </div> |
345 | 345 | |
346 | 346 | <div class="txn-admin-apply-payment-registrations-dv admin-modal-dialog-row"> |
347 | - <label for="txn-admin-payment-registrations-inp" class="last"><?php _e( 'Registrations to Apply Payment to:', 'event_espresso' ); ?></label> |
|
347 | + <label for="txn-admin-payment-registrations-inp" class="last"><?php _e('Registrations to Apply Payment to:', 'event_espresso'); ?></label> |
|
348 | 348 | <label class="txn-admin-apply-payment-to-registrations-lbl"> |
349 | 349 | <input type="radio" value="1" id="txn-admin-apply-payment-to-all-registrations-inp" name="txn_admin_payment[apply_to_all_registrations]" checked="checked"/> |
350 | - <?php _e( 'ALL Registrations', 'event_espresso' ); ?> |
|
350 | + <?php _e('ALL Registrations', 'event_espresso'); ?> |
|
351 | 351 | </label> |
352 | 352 | <label class="txn-admin-apply-payment-to-registrations-lbl"> |
353 | 353 | <input type="radio" value="0" id="txn-admin-apply-payment-to-some-registrations-inp" name="txn_admin_payment[apply_to_all_registrations]" /> |
354 | - <?php _e( 'Just the following Registrations', 'event_espresso' ); ?> |
|
354 | + <?php _e('Just the following Registrations', 'event_espresso'); ?> |
|
355 | 355 | </label> |
356 | 356 | <?php echo $registrations_to_apply_payment_to; ?> |
357 | 357 | </div> |
358 | 358 | |
359 | 359 | <div class="txn-admin-payment-reg-status-dv admin-modal-dialog-row"> |
360 | - <label for="txn-admin-payment-reg-status-inp" class="last"><?php _e( 'Change Registration Status?', 'event_espresso' );?></label> |
|
360 | + <label for="txn-admin-payment-reg-status-inp" class="last"><?php _e('Change Registration Status?', 'event_espresso'); ?></label> |
|
361 | 361 | <?php echo $status_change_select; ?> |
362 | - <p class="description"><?php _e( 'If you wish to change the status for the registrations selected above, then select which status from this dropdown.', 'event_espresso' ); ?></p> |
|
362 | + <p class="description"><?php _e('If you wish to change the status for the registrations selected above, then select which status from this dropdown.', 'event_espresso'); ?></p> |
|
363 | 363 | <br/> |
364 | 364 | </div> |
365 | 365 | |
366 | 366 | <div class="txn-admin-apply-payment-send-notifications-dv admin-modal-dialog-row"> |
367 | 367 | |
368 | - <label for="txn-admin-payment-send-notifications-inp" class="last"><?php _e( 'Send Related Messages?', 'event_espresso' );?></label> |
|
368 | + <label for="txn-admin-payment-send-notifications-inp" class="last"><?php _e('Send Related Messages?', 'event_espresso'); ?></label> |
|
369 | 369 | <label class="txn-admin-payment-send-notifications-lbl"> |
370 | 370 | <input type="checkbox" value="1" name="txn_payments[send_notifications]" checked="checked" aria-checked="true" style="vertical-align: middle;"> |
371 | - <?php _e( 'Payment Messages?', 'event_espresso' ); ?> |
|
371 | + <?php _e('Payment Messages?', 'event_espresso'); ?> |
|
372 | 372 | </label> |
373 | 373 | <label class="txn-admin-payment-send-notifications-lbl"> |
374 | 374 | <input type="checkbox" value="1" name="txn_reg_status_change[send_notifications]" style="vertical-align: middle;"> |
375 | - <?php _e( 'Registration Messages?', 'event_espresso' ); ?> |
|
375 | + <?php _e('Registration Messages?', 'event_espresso'); ?> |
|
376 | 376 | </label> |
377 | 377 | <br class="clear-float"/> |
378 | - <p class="description"><?php printf( __('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.', 'event_espresso'), '<strong>', '</strong>', '<br />' ); ?></p> |
|
378 | + <p class="description"><?php printf(__('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.', 'event_espresso'), '<strong>', '</strong>', '<br />'); ?></p> |
|
379 | 379 | <label></label> |
380 | 380 | </div> |
381 | 381 | <div class="clear"></div> |
@@ -386,27 +386,27 @@ discard block |
||
386 | 386 | <ul id="admin-modal-dialog-options-ul"> |
387 | 387 | <li> |
388 | 388 | <a id="txn-admin-modal-dialog-apply-payment-lnk" class="button-primary no-icon" style="display:none;" > |
389 | - <?php _e( 'Apply Payment', 'event_espresso' );?> |
|
389 | + <?php _e('Apply Payment', 'event_espresso'); ?> |
|
390 | 390 | </a> |
391 | 391 | </li> |
392 | 392 | <li> |
393 | 393 | <a id="txn-admin-modal-dialog-edit-payment-lnk" class="button-primary no-icon" style="display:none;" > |
394 | - <?php _e( 'Save Payment Details', 'event_espresso' );?> |
|
394 | + <?php _e('Save Payment Details', 'event_espresso'); ?> |
|
395 | 395 | </a> |
396 | 396 | </li> |
397 | 397 | <li> |
398 | 398 | <a id="txn-admin-modal-dialog-edit-refund-lnk" class="button-primary no-icon" style="display:none;" > |
399 | - <?php _e( 'Save Refund Details', 'event_espresso' );?> |
|
399 | + <?php _e('Save Refund Details', 'event_espresso'); ?> |
|
400 | 400 | </a> |
401 | 401 | </li> |
402 | 402 | <li> |
403 | 403 | <a id="txn-admin-modal-dialog-apply-refund-lnk" class="button-primary no-icon" style="display:none;" > |
404 | - <?php _e( 'Apply Refund', 'event_espresso' );?> |
|
404 | + <?php _e('Apply Refund', 'event_espresso'); ?> |
|
405 | 405 | </a> |
406 | 406 | </li> |
407 | 407 | <li> |
408 | 408 | <a id="txn-admin-modal-dialog-cancel-lnk" class="button-secondary no-icon" > |
409 | - <?php _e( 'Cancel', 'event_espresso' );?> |
|
409 | + <?php _e('Cancel', 'event_espresso'); ?> |
|
410 | 410 | </a> |
411 | 411 | </li> |
412 | 412 | <li> |
@@ -423,29 +423,29 @@ discard block |
||
423 | 423 | |
424 | 424 | <h2 id="admin-modal-dialog-delete-payment-h2" class="admin-modal-dialog-h2 hdr-has-icon" style="display:none;"> |
425 | 425 | <span class="ee-icon ee-icon-cash-add"></span> |
426 | - <?php echo __( 'Delete Payment/Refund for Transaction #', 'event_espresso' ) . $txn_nmbr['value'];?> |
|
426 | + <?php echo __('Delete Payment/Refund for Transaction #', 'event_espresso').$txn_nmbr['value']; ?> |
|
427 | 427 | </h2> |
428 | 428 | |
429 | 429 | <form name="txn-admin-delete-payment-frm" id="txn-admin-delete-payment-frm" action="<?php echo $delete_payment_url; ?>"> |
430 | 430 | <div class="admin-modal-dialog-wrap"> |
431 | 431 | <div class="admin-modal-dialog-inner"> |
432 | 432 | |
433 | - <input type="hidden" name="espresso_delete_payment_nonce" id="espresso_delete_payment_nonce" value="<?php echo wp_create_nonce( 'espresso_delete_payment_nonce' );?>"/> |
|
433 | + <input type="hidden" name="espresso_delete_payment_nonce" id="espresso_delete_payment_nonce" value="<?php echo wp_create_nonce('espresso_delete_payment_nonce'); ?>"/> |
|
434 | 434 | <input type="hidden" name="delete_espresso_ajax" id="delete-espresso-ajax" value="0"/> |
435 | 435 | <input type="hidden" name="delete_noheader" id="delete-txn-admin-noheader-inp" value="0"/> |
436 | 436 | <input type="hidden" name="delete_txn_admin_payment[PAY_ID]" id="delete-txn-admin-payment-payment-id-inp" class="txn-admin-apply-payment-inp" value="0"/> |
437 | 437 | <input type="hidden" name="delete_txn_admin_payment[TXN_ID]" id="delete-txn-admin-payment-txn-id-inp" value="<?php echo $txn_nmbr['value']; ?>"/> |
438 | 438 | |
439 | 439 | <div class="txn-admin-apply-payment-accounting-dv admin-modal-dialog-row"> |
440 | - <label for="delete-txn-admin-payment-reg-status-inp" class="last"><?php _e( 'Change Registration Status?', 'event_espresso' );?></label> |
|
440 | + <label for="delete-txn-admin-payment-reg-status-inp" class="last"><?php _e('Change Registration Status?', 'event_espresso'); ?></label> |
|
441 | 441 | <?php echo $delete_status_change_select; ?> |
442 | - <p class="description"><?php printf( __('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', 'event_espresso'), '<strong>', '</strong>' ); ?></p> |
|
442 | + <p class="description"><?php printf(__('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', 'event_espresso'), '<strong>', '</strong>'); ?></p> |
|
443 | 443 | </div> |
444 | 444 | |
445 | 445 | <div class="ee-attention txn-admin-apply-payment-accounting-dv admin-modal-dialog-row"> |
446 | - <label for="delete-txn-admin-payment-accounting-inp" class="last"><?php _e( 'Send Related Messages?', 'event_espresso' );?></label> |
|
446 | + <label for="delete-txn-admin-payment-accounting-inp" class="last"><?php _e('Send Related Messages?', 'event_espresso'); ?></label> |
|
447 | 447 | <input type="checkbox" value="1" name="delete_txn_reg_status_change[send_notifications]"> |
448 | - <p class="description"><?php _e( '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.', 'event_espresso' );?></p> |
|
448 | + <p class="description"><?php _e('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.', 'event_espresso'); ?></p> |
|
449 | 449 | </div> |
450 | 450 | <div class="clear"></div> |
451 | 451 | |
@@ -455,12 +455,12 @@ discard block |
||
455 | 455 | <ul id="del-admin-modal-dialog-options-ul"> |
456 | 456 | <li> |
457 | 457 | <a id="txn-admin-modal-dialog-delete-lnk" class="button-primary no-icon" style="display:none;" > |
458 | - <?php _e( 'Delete', 'event_espresso' );?> |
|
458 | + <?php _e('Delete', 'event_espresso'); ?> |
|
459 | 459 | </a> |
460 | 460 | </li> |
461 | 461 | <li> |
462 | 462 | <a id="del-txn-admin-modal-dialog-cancel-lnk" class="button-secondary no-icon" > |
463 | - <?php _e( 'Cancel', 'event_espresso' );?> |
|
463 | + <?php _e('Cancel', 'event_espresso'); ?> |
|
464 | 464 | </a> |
465 | 465 | </li> |
466 | 466 | <li> |
@@ -476,30 +476,30 @@ discard block |
||
476 | 476 | <?php endif; // $grand_raw_total > 0?> |
477 | 477 | |
478 | 478 | <?php |
479 | - if ( WP_DEBUG ) { |
|
480 | - $delivered_messages = get_option( 'EED_Messages__payment', array() ); |
|
481 | - if ( isset( $delivered_messages[ $TXN_ID ] )) { |
|
479 | + if (WP_DEBUG) { |
|
480 | + $delivered_messages = get_option('EED_Messages__payment', array()); |
|
481 | + if (isset($delivered_messages[$TXN_ID])) { |
|
482 | 482 | ?> |
483 | - <h4 class="admin-primary-mbox-h4 hdr-has-icon"><span class="dashicons dashicons-email-alt"></span><?php _e( 'Messages Sent to Primary Registrant', 'event_espresso' );?></h4> |
|
483 | + <h4 class="admin-primary-mbox-h4 hdr-has-icon"><span class="dashicons dashicons-email-alt"></span><?php _e('Messages Sent to Primary Registrant', 'event_espresso'); ?></h4> |
|
484 | 484 | |
485 | 485 | <div class="admin-primary-mbox-tbl-wrap"> |
486 | 486 | <table class="admin-primary-mbox-tbl"> |
487 | 487 | <thead> |
488 | 488 | <tr> |
489 | - <th class="jst-left"><?php _e( 'Date & Time', 'event_espresso' );?></th> |
|
490 | - <th class="jst-left"><?php _e( 'Message Type', 'event_espresso' );?></th> |
|
491 | - <th class="jst-left"><?php _e( 'Payment Status Upon Sending', 'event_espresso' );?></th> |
|
492 | - <th class="jst-left"><?php _e( 'TXN Status Upon Sending', 'event_espresso' );?></th> |
|
489 | + <th class="jst-left"><?php _e('Date & Time', 'event_espresso'); ?></th> |
|
490 | + <th class="jst-left"><?php _e('Message Type', 'event_espresso'); ?></th> |
|
491 | + <th class="jst-left"><?php _e('Payment Status Upon Sending', 'event_espresso'); ?></th> |
|
492 | + <th class="jst-left"><?php _e('TXN Status Upon Sending', 'event_espresso'); ?></th> |
|
493 | 493 | </tr> |
494 | 494 | </thead> |
495 | 495 | <tbody> |
496 | - <?php foreach ( $delivered_messages[ $TXN_ID ] as $timestamp => $delivered_message ) : |
|
496 | + <?php foreach ($delivered_messages[$TXN_ID] as $timestamp => $delivered_message) : |
|
497 | 497 | ?> |
498 | 498 | <tr> |
499 | - <td class="jst-left"><?php echo date( get_option('date_format') . ' ' . get_option('time_format'), ( $timestamp + ( get_option( 'gmt_offset' ) * HOUR_IN_SECONDS ) ) );?></td> |
|
500 | - <td class="jst-left"><?php echo isset( $delivered_message['message_type'] ) ? $delivered_message['message_type'] : '';?></td> |
|
501 | - <td class="jst-left"><?php echo isset( $delivered_message['pay_status'] ) ? $delivered_message['pay_status'] : '';?></td> |
|
502 | - <td class="jst-left"><?php echo isset( $delivered_message['txn_status'] ) ? $delivered_message['txn_status'] : '';?></td> |
|
499 | + <td class="jst-left"><?php echo date(get_option('date_format').' '.get_option('time_format'), ($timestamp + (get_option('gmt_offset') * HOUR_IN_SECONDS))); ?></td> |
|
500 | + <td class="jst-left"><?php echo isset($delivered_message['message_type']) ? $delivered_message['message_type'] : ''; ?></td> |
|
501 | + <td class="jst-left"><?php echo isset($delivered_message['pay_status']) ? $delivered_message['pay_status'] : ''; ?></td> |
|
502 | + <td class="jst-left"><?php echo isset($delivered_message['txn_status']) ? $delivered_message['txn_status'] : ''; ?></td> |
|
503 | 503 | </tr> |
504 | 504 | <?php endforeach; // $delivered_messages?> |
505 | 505 | </tbody> |
@@ -1,6 +1,6 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
3 | - exit('NO direct script access allowed'); |
|
3 | + exit('NO direct script access allowed'); |
|
4 | 4 | } |
5 | 5 | |
6 | 6 | /** |
@@ -21,62 +21,62 @@ discard block |
||
21 | 21 | { |
22 | 22 | |
23 | 23 | |
24 | - public function __construct($routing = true) |
|
25 | - { |
|
26 | - parent::__construct($routing); |
|
27 | - define('GEN_SET_CAF_TEMPLATE_PATH', EE_CORE_CAF_ADMIN_EXTEND . 'general_settings/templates/'); |
|
28 | - } |
|
24 | + public function __construct($routing = true) |
|
25 | + { |
|
26 | + parent::__construct($routing); |
|
27 | + define('GEN_SET_CAF_TEMPLATE_PATH', EE_CORE_CAF_ADMIN_EXTEND . 'general_settings/templates/'); |
|
28 | + } |
|
29 | 29 | |
30 | 30 | |
31 | - protected function _extend_page_config() |
|
32 | - { |
|
31 | + protected function _extend_page_config() |
|
32 | + { |
|
33 | 33 | |
34 | - $this->_admin_base_path = EE_CORE_CAF_ADMIN_EXTEND . 'general_settings'; |
|
34 | + $this->_admin_base_path = EE_CORE_CAF_ADMIN_EXTEND . 'general_settings'; |
|
35 | 35 | |
36 | - //filters and action hooks here |
|
37 | - add_action('AHEE__admin_option_settings__template__before', array($this, 'debug_logging_options'), 9); |
|
38 | - add_filter('FHEE__General_Settings_Admin_Page___update_admin_option_settings__CFG_admin', |
|
39 | - array($this, 'update_debug_logging_options'), 10, 1); |
|
36 | + //filters and action hooks here |
|
37 | + add_action('AHEE__admin_option_settings__template__before', array($this, 'debug_logging_options'), 9); |
|
38 | + add_filter('FHEE__General_Settings_Admin_Page___update_admin_option_settings__CFG_admin', |
|
39 | + array($this, 'update_debug_logging_options'), 10, 1); |
|
40 | 40 | |
41 | - } |
|
41 | + } |
|
42 | 42 | |
43 | 43 | |
44 | 44 | |
45 | - /************* Logging Settings *************/ |
|
45 | + /************* Logging Settings *************/ |
|
46 | 46 | |
47 | - /** |
|
48 | - * debug_logging_options |
|
49 | - * |
|
50 | - * @param array $template_args |
|
51 | - * |
|
52 | - * @return void |
|
53 | - */ |
|
54 | - public function debug_logging_options($template_args = array()) |
|
55 | - { |
|
56 | - $template_args['use_full_logging'] = EE_Registry::instance()->CFG->admin->use_full_logging; |
|
57 | - $template_args['use_remote_logging'] = isset(EE_Registry::instance()->CFG->admin->use_remote_logging) ? absint(EE_Registry::instance()->CFG->admin->use_remote_logging) : false; |
|
58 | - $template_args['remote_logging_url'] = isset(EE_Registry::instance()->CFG->admin->remote_logging_url) && ! empty(EE_Registry::instance()->CFG->admin->remote_logging_url) ? stripslashes(EE_Registry::instance()->CFG->admin->remote_logging_url) : ''; |
|
59 | - $template = GEN_SET_CAF_TEMPLATE_PATH . 'debug_log_settings.template.php'; |
|
60 | - EEH_Template::display_template($template, $template_args); |
|
61 | - } |
|
47 | + /** |
|
48 | + * debug_logging_options |
|
49 | + * |
|
50 | + * @param array $template_args |
|
51 | + * |
|
52 | + * @return void |
|
53 | + */ |
|
54 | + public function debug_logging_options($template_args = array()) |
|
55 | + { |
|
56 | + $template_args['use_full_logging'] = EE_Registry::instance()->CFG->admin->use_full_logging; |
|
57 | + $template_args['use_remote_logging'] = isset(EE_Registry::instance()->CFG->admin->use_remote_logging) ? absint(EE_Registry::instance()->CFG->admin->use_remote_logging) : false; |
|
58 | + $template_args['remote_logging_url'] = isset(EE_Registry::instance()->CFG->admin->remote_logging_url) && ! empty(EE_Registry::instance()->CFG->admin->remote_logging_url) ? stripslashes(EE_Registry::instance()->CFG->admin->remote_logging_url) : ''; |
|
59 | + $template = GEN_SET_CAF_TEMPLATE_PATH . 'debug_log_settings.template.php'; |
|
60 | + EEH_Template::display_template($template, $template_args); |
|
61 | + } |
|
62 | 62 | |
63 | 63 | |
64 | - /** |
|
65 | - * update_debug_logging_options |
|
66 | - * |
|
67 | - * @param array $admin_options |
|
68 | - * |
|
69 | - * @return array |
|
70 | - */ |
|
71 | - public function update_debug_logging_options($admin_options = array()) |
|
72 | - { |
|
73 | - $use_full_logging = isset($this->_req_data['use_full_logging']) ? (bool)absint($this->_req_data['use_full_logging']) : $admin_options->use_full_logging; |
|
74 | - $admin_options->use_full_logging = $use_full_logging; |
|
75 | - $admin_options->use_remote_logging = isset($this->_req_data['use_remote_logging']) ? absint($this->_req_data['use_remote_logging']) : $admin_options->use_remote_logging; |
|
76 | - $admin_options->remote_logging_url = isset($this->_req_data['remote_logging_url']) ? esc_url_raw($this->_req_data['remote_logging_url']) : $admin_options->remote_logging_url; |
|
64 | + /** |
|
65 | + * update_debug_logging_options |
|
66 | + * |
|
67 | + * @param array $admin_options |
|
68 | + * |
|
69 | + * @return array |
|
70 | + */ |
|
71 | + public function update_debug_logging_options($admin_options = array()) |
|
72 | + { |
|
73 | + $use_full_logging = isset($this->_req_data['use_full_logging']) ? (bool)absint($this->_req_data['use_full_logging']) : $admin_options->use_full_logging; |
|
74 | + $admin_options->use_full_logging = $use_full_logging; |
|
75 | + $admin_options->use_remote_logging = isset($this->_req_data['use_remote_logging']) ? absint($this->_req_data['use_remote_logging']) : $admin_options->use_remote_logging; |
|
76 | + $admin_options->remote_logging_url = isset($this->_req_data['remote_logging_url']) ? esc_url_raw($this->_req_data['remote_logging_url']) : $admin_options->remote_logging_url; |
|
77 | 77 | |
78 | - return $admin_options; |
|
79 | - } |
|
78 | + return $admin_options; |
|
79 | + } |
|
80 | 80 | |
81 | 81 | |
82 | 82 | } |
@@ -24,14 +24,14 @@ discard block |
||
24 | 24 | public function __construct($routing = true) |
25 | 25 | { |
26 | 26 | parent::__construct($routing); |
27 | - define('GEN_SET_CAF_TEMPLATE_PATH', EE_CORE_CAF_ADMIN_EXTEND . 'general_settings/templates/'); |
|
27 | + define('GEN_SET_CAF_TEMPLATE_PATH', EE_CORE_CAF_ADMIN_EXTEND.'general_settings/templates/'); |
|
28 | 28 | } |
29 | 29 | |
30 | 30 | |
31 | 31 | protected function _extend_page_config() |
32 | 32 | { |
33 | 33 | |
34 | - $this->_admin_base_path = EE_CORE_CAF_ADMIN_EXTEND . 'general_settings'; |
|
34 | + $this->_admin_base_path = EE_CORE_CAF_ADMIN_EXTEND.'general_settings'; |
|
35 | 35 | |
36 | 36 | //filters and action hooks here |
37 | 37 | add_action('AHEE__admin_option_settings__template__before', array($this, 'debug_logging_options'), 9); |
@@ -56,7 +56,7 @@ discard block |
||
56 | 56 | $template_args['use_full_logging'] = EE_Registry::instance()->CFG->admin->use_full_logging; |
57 | 57 | $template_args['use_remote_logging'] = isset(EE_Registry::instance()->CFG->admin->use_remote_logging) ? absint(EE_Registry::instance()->CFG->admin->use_remote_logging) : false; |
58 | 58 | $template_args['remote_logging_url'] = isset(EE_Registry::instance()->CFG->admin->remote_logging_url) && ! empty(EE_Registry::instance()->CFG->admin->remote_logging_url) ? stripslashes(EE_Registry::instance()->CFG->admin->remote_logging_url) : ''; |
59 | - $template = GEN_SET_CAF_TEMPLATE_PATH . 'debug_log_settings.template.php'; |
|
59 | + $template = GEN_SET_CAF_TEMPLATE_PATH.'debug_log_settings.template.php'; |
|
60 | 60 | EEH_Template::display_template($template, $template_args); |
61 | 61 | } |
62 | 62 | |
@@ -70,7 +70,7 @@ discard block |
||
70 | 70 | */ |
71 | 71 | public function update_debug_logging_options($admin_options = array()) |
72 | 72 | { |
73 | - $use_full_logging = isset($this->_req_data['use_full_logging']) ? (bool)absint($this->_req_data['use_full_logging']) : $admin_options->use_full_logging; |
|
73 | + $use_full_logging = isset($this->_req_data['use_full_logging']) ? (bool) absint($this->_req_data['use_full_logging']) : $admin_options->use_full_logging; |
|
74 | 74 | $admin_options->use_full_logging = $use_full_logging; |
75 | 75 | $admin_options->use_remote_logging = isset($this->_req_data['use_remote_logging']) ? absint($this->_req_data['use_remote_logging']) : $admin_options->use_remote_logging; |
76 | 76 | $admin_options->remote_logging_url = isset($this->_req_data['remote_logging_url']) ? esc_url_raw($this->_req_data['remote_logging_url']) : $admin_options->remote_logging_url; |
@@ -1,5 +1,5 @@ discard block |
||
1 | 1 | <?php if (! defined('EVENT_ESPRESSO_VERSION')) { |
2 | - exit('No direct script access allowed'); |
|
2 | + exit('No direct script access allowed'); |
|
3 | 3 | } |
4 | 4 | |
5 | 5 | |
@@ -16,698 +16,698 @@ discard block |
||
16 | 16 | |
17 | 17 | |
18 | 18 | |
19 | - /** |
|
20 | - * @return EED_Module|EED_Add_New_State |
|
21 | - */ |
|
22 | - public static function instance() |
|
23 | - { |
|
24 | - return parent::get_instance(__CLASS__); |
|
25 | - } |
|
26 | - |
|
27 | - |
|
28 | - |
|
29 | - /** |
|
30 | - * set_hooks - for hooking into EE Core, other modules, etc |
|
31 | - * |
|
32 | - * @return void |
|
33 | - */ |
|
34 | - public static function set_hooks() |
|
35 | - { |
|
36 | - add_action('wp_loaded', array('EED_Add_New_State', 'set_definitions'), 2); |
|
37 | - add_action('wp_enqueue_scripts', array('EED_Add_New_State', 'translate_js_strings'), 0); |
|
38 | - add_action('wp_enqueue_scripts', array('EED_Add_New_State', 'wp_enqueue_scripts'), 10); |
|
39 | - add_filter('FHEE__EE_SPCO_Reg_Step_Attendee_Information___question_group_reg_form__question_group_reg_form', |
|
40 | - array('EED_Add_New_State', 'display_add_new_state_micro_form'), 1, 1); |
|
41 | - add_filter('FHEE__EE_SPCO_Reg_Step_Payment_Options___get_billing_form_for_payment_method__billing_form', |
|
42 | - array('EED_Add_New_State', 'display_add_new_state_micro_form'), 1, 1); |
|
43 | - add_filter('FHEE__EE_Single_Page_Checkout__process_attendee_information__valid_data_line_item', |
|
44 | - array('EED_Add_New_State', 'unset_new_state_request_params'), 10, 1); |
|
45 | - add_filter('FHEE__EE_SPCO_Reg_Step_Attendee_Information___generate_question_input__state_options', |
|
46 | - array('EED_Add_New_State', 'inject_new_reg_state_into_options'), 10, 5); |
|
47 | - add_filter('FHEE__EE_SPCO_Reg_Step_Attendee_Information___generate_question_input__country_options', |
|
48 | - array('EED_Add_New_State', 'inject_new_reg_country_into_options'), 10, 5); |
|
49 | - add_filter('FHEE__EE_State_Select_Input____construct__state_options', |
|
50 | - array('EED_Add_New_State', 'state_options'), 10, 1); |
|
51 | - add_filter('FHEE__EE_Country_Select_Input____construct__country_options', |
|
52 | - array('EED_Add_New_State', 'country_options'), 10, 1); |
|
53 | - } |
|
54 | - |
|
55 | - |
|
56 | - |
|
57 | - /** |
|
58 | - * set_hooks_admin - for hooking into EE Admin Core, other modules, etc |
|
59 | - * |
|
60 | - * @return void |
|
61 | - */ |
|
62 | - public static function set_hooks_admin() |
|
63 | - { |
|
64 | - add_action('wp_loaded', array('EED_Add_New_State', 'set_definitions'), 2); |
|
65 | - add_filter('FHEE__EE_SPCO_Reg_Step_Attendee_Information___question_group_reg_form__question_group_reg_form', |
|
66 | - array('EED_Add_New_State', 'display_add_new_state_micro_form'), 1, 1); |
|
67 | - add_filter('FHEE__EE_SPCO_Reg_Step_Payment_Options___get_billing_form_for_payment_method__billing_form', |
|
68 | - array('EED_Add_New_State', 'display_add_new_state_micro_form'), 1, 1); |
|
69 | - add_action('wp_ajax_espresso_add_new_state', array('EED_Add_New_State', 'add_new_state')); |
|
70 | - add_action('wp_ajax_nopriv_espresso_add_new_state', array('EED_Add_New_State', 'add_new_state')); |
|
71 | - add_filter('FHEE__EE_Single_Page_Checkout__process_attendee_information__valid_data_line_item', |
|
72 | - array('EED_Add_New_State', 'unset_new_state_request_params'), 10, 1); |
|
73 | - add_action('AHEE__General_Settings_Admin_Page__update_country_settings__state_saved', |
|
74 | - array('EED_Add_New_State', 'update_country_settings'), 10, 3); |
|
75 | - add_action('AHEE__General_Settings_Admin_Page__delete_state__state_deleted', |
|
76 | - array('EED_Add_New_State', 'update_country_settings'), 10, 3); |
|
77 | - add_filter('FHEE__EE_State_Select_Input____construct__state_options', |
|
78 | - array('EED_Add_New_State', 'state_options'), 10, 1); |
|
79 | - add_filter('FHEE__EE_Country_Select_Input____construct__country_options', |
|
80 | - array('EED_Add_New_State', 'country_options'), 10, 1); |
|
81 | - add_filter('FHEE__EE_Form_Section_Proper__receive_form_submission__request_data', |
|
82 | - array('EED_Add_New_State', 'filter_checkout_request_params'), 10, 1); |
|
83 | - add_filter('FHEE__EE_SPCO_Reg_Step_Attendee_Information___generate_question_input__state_options', |
|
84 | - array('EED_Add_New_State', 'inject_new_reg_state_into_options'), 10, 5); |
|
85 | - add_filter('FHEE__EE_SPCO_Reg_Step_Attendee_Information___generate_question_input__country_options', |
|
86 | - array('EED_Add_New_State', 'inject_new_reg_country_into_options'), 10, 5); |
|
87 | - } |
|
88 | - |
|
89 | - |
|
90 | - |
|
91 | - /** |
|
92 | - * @return void |
|
93 | - */ |
|
94 | - public static function set_definitions() |
|
95 | - { |
|
96 | - define('ANS_ASSETS_URL', plugin_dir_url(__FILE__) . 'assets' . DS); |
|
97 | - define('ANS_TEMPLATES_PATH', str_replace( |
|
98 | - '\\', |
|
99 | - DS, plugin_dir_path(__FILE__)) . 'templates' . DS |
|
100 | - ); |
|
101 | - } |
|
102 | - |
|
103 | - |
|
104 | - |
|
105 | - /** |
|
106 | - * @param WP $WP |
|
107 | - * @return void |
|
108 | - */ |
|
109 | - public function run($WP) |
|
110 | - { |
|
111 | - } |
|
112 | - |
|
113 | - |
|
114 | - |
|
115 | - /** |
|
116 | - * @return void |
|
117 | - */ |
|
118 | - public static function translate_js_strings() |
|
119 | - { |
|
120 | - EE_Registry::$i18n_js_strings['ans_no_country'] = esc_html__( |
|
121 | - 'In order to proceed, you need to select the Country that your State/Province belongs to.', |
|
122 | - 'event_espresso' |
|
123 | - ); |
|
124 | - EE_Registry::$i18n_js_strings['ans_no_name'] = esc_html__( |
|
125 | - 'In order to proceed, you need to enter the name of your State/Province.', |
|
126 | - 'event_espresso' |
|
127 | - ); |
|
128 | - EE_Registry::$i18n_js_strings['ans_no_abbreviation'] = esc_html__( |
|
129 | - 'In order to proceed, you need to enter an abbreviation for the name of your State/Province.', |
|
130 | - 'event_espresso' |
|
131 | - ); |
|
132 | - EE_Registry::$i18n_js_strings['ans_save_success'] = esc_html__( |
|
133 | - 'The new state was successfully saved to the database.', |
|
134 | - 'event_espresso' |
|
135 | - ); |
|
136 | - EE_Registry::$i18n_js_strings['ans_server_save_error'] = esc_html__( |
|
137 | - 'An unknown error has occurred on the server while saving the new state to the database.', |
|
138 | - 'event_espresso' |
|
139 | - ); |
|
140 | - } |
|
141 | - |
|
142 | - |
|
143 | - |
|
144 | - /** |
|
145 | - * @return void |
|
146 | - */ |
|
147 | - public static function wp_enqueue_scripts() |
|
148 | - { |
|
149 | - if (apply_filters('EED_Single_Page_Checkout__SPCO_active', false)) { |
|
150 | - wp_register_script('add_new_state', ANS_ASSETS_URL . 'add_new_state.js', |
|
151 | - array('espresso_core', 'single_page_checkout'), EVENT_ESPRESSO_VERSION, true); |
|
152 | - wp_enqueue_script('add_new_state'); |
|
153 | - } |
|
154 | - } |
|
155 | - |
|
156 | - |
|
157 | - |
|
158 | - /** |
|
159 | - * display_add_new_state_micro_form |
|
160 | - * |
|
161 | - * @param EE_Form_Section_Proper $question_group_reg_form |
|
162 | - * @return string |
|
163 | - * @throws EE_Error |
|
164 | - */ |
|
165 | - // public static function display_add_new_state_micro_form( $html, EE_Form_Input_With_Options_Base $input ){ |
|
166 | - public static function display_add_new_state_micro_form(EE_Form_Section_Proper $question_group_reg_form) |
|
167 | - { |
|
168 | - // only add the 'new_state_micro_form' when displaying reg forms, |
|
169 | - // not during processing since we process the 'new_state_micro_form' in it's own AJAX request |
|
170 | - $action = EE_Registry::instance()->REQ->get('action', ''); |
|
171 | - // is the "state" question in this form section? |
|
172 | - $input = $question_group_reg_form->get_subsection('state'); |
|
173 | - if ($action === 'process_reg_step' || $action === 'update_reg_step') { |
|
174 | - //ok then all we need to do is make sure the input's HTML name is consistent |
|
175 | - //by forcing it to set it now, like it did while getting the form for display |
|
176 | - if ($input instanceof EE_State_Select_Input) { |
|
177 | - $input->html_name(); |
|
178 | - } |
|
179 | - return $question_group_reg_form; |
|
180 | - } |
|
181 | - // we're only doing this for state select inputs |
|
182 | - if ($input instanceof EE_State_Select_Input) { |
|
183 | - // grab any set values from the request |
|
184 | - $country_name = str_replace('state', 'nsmf_new_state_country', $input->html_name()); |
|
185 | - $state_name = str_replace('state', 'nsmf_new_state_name', $input->html_name()); |
|
186 | - $abbrv_name = str_replace('state', 'nsmf_new_state_abbrv', $input->html_name()); |
|
187 | - $new_state_submit_id = str_replace('state', 'new_state', $input->html_id()); |
|
188 | - $country_options = array(); |
|
189 | - $countries = EEM_Country::instance()->get_all_countries(); |
|
190 | - if (! empty($countries)) { |
|
191 | - foreach ($countries as $country) { |
|
192 | - if ($country instanceof EE_Country) { |
|
193 | - $country_options[$country->ID()] = $country->name(); |
|
194 | - } |
|
195 | - } |
|
196 | - } |
|
197 | - $new_state_micro_form = new EE_Form_Section_Proper( |
|
198 | - array( |
|
199 | - 'name' => 'new_state_micro_form', |
|
200 | - 'html_id' => 'new_state_micro_form', |
|
201 | - 'layout_strategy' => new EE_Div_Per_Section_Layout(), |
|
202 | - 'subsections' => array( |
|
203 | - // add hidden input to indicate that a new state is being added |
|
204 | - 'add_new_state' => new EE_Hidden_Input( |
|
205 | - array( |
|
206 | - 'html_name' => str_replace( |
|
207 | - 'state', |
|
208 | - 'nsmf_add_new_state', $input->html_name() |
|
209 | - ), |
|
210 | - 'html_id' => str_replace( |
|
211 | - 'state', |
|
212 | - 'nsmf_add_new_state', $input->html_id() |
|
213 | - ), |
|
214 | - 'default' => 0, |
|
215 | - ) |
|
216 | - ), |
|
217 | - // add link for displaying hidden container |
|
218 | - 'click_here_link' => new EE_Form_Section_HTML( |
|
219 | - apply_filters( |
|
220 | - 'FHEE__EED_Add_New_State__display_add_new_state_micro_form__click_here_link', |
|
221 | - EEH_HTML::link( |
|
222 | - '', |
|
223 | - esc_html__('click here to add a new state/province', 'event_espresso'), |
|
224 | - '', |
|
225 | - 'display-' . $input->html_id(), |
|
226 | - 'ee-form-add-new-state-lnk display-the-hidden smaller-text hide-if-no-js', |
|
227 | - '', |
|
228 | - 'data-target="' . $input->html_id() . '"' |
|
229 | - ) |
|
230 | - ) |
|
231 | - ), |
|
232 | - // add initial html for hidden container |
|
233 | - 'add_new_state_micro_form' => new EE_Form_Section_HTML( |
|
234 | - apply_filters( |
|
235 | - 'FHEE__EED_Add_New_State__display_add_new_state_micro_form__add_new_state_micro_form', |
|
236 | - EEH_HTML::div('', $input->html_id() . '-dv', 'ee-form-add-new-state-dv', |
|
237 | - 'display: none;') . |
|
238 | - EEH_HTML::h6( |
|
239 | - esc_html__( |
|
240 | - 'If your State/Province does not appear in the list above, you can easily add it by doing the following:', |
|
241 | - 'event_espresso' |
|
242 | - ) |
|
243 | - ) . |
|
244 | - EEH_HTML::ul() . |
|
245 | - EEH_HTML::li( |
|
246 | - esc_html__( |
|
247 | - 'first select the Country that your State/Province belongs to', |
|
248 | - 'event_espresso' |
|
249 | - ) |
|
250 | - ) . |
|
251 | - EEH_HTML::li( |
|
252 | - esc_html__('enter the name of your State/Province', 'event_espresso') |
|
253 | - ) . |
|
254 | - EEH_HTML::li( |
|
255 | - esc_html__( |
|
256 | - 'enter a two to six letter abbreviation for the name of your State/Province', |
|
257 | - 'event_espresso' |
|
258 | - ) |
|
259 | - ) . |
|
260 | - EEH_HTML::li(esc_html__('click the ADD button', 'event_espresso')) . |
|
261 | - EEH_HTML::ulx() |
|
262 | - ) |
|
263 | - ), |
|
264 | - // NEW STATE COUNTRY |
|
265 | - 'new_state_country' => new EE_Country_Select_Input( |
|
266 | - $country_options, |
|
267 | - array( |
|
268 | - 'html_name' => $country_name, |
|
269 | - 'html_id' => str_replace( |
|
270 | - 'state', |
|
271 | - 'nsmf_new_state_country', $input->html_id() |
|
272 | - ), |
|
273 | - 'html_class' => $input->html_class() . ' new-state-country', |
|
274 | - 'html_label_text' => esc_html__('New State/Province Country', 'event_espresso'), |
|
275 | - 'default' => EE_Registry::instance()->REQ->get($country_name, ''), |
|
276 | - 'required' => false, |
|
277 | - ) |
|
278 | - ), |
|
279 | - // NEW STATE NAME |
|
280 | - 'new_state_name' => new EE_Text_Input( |
|
281 | - array( |
|
282 | - 'html_name' => $state_name, |
|
283 | - 'html_id' => str_replace( |
|
284 | - 'state', |
|
285 | - 'nsmf_new_state_name', $input->html_id() |
|
286 | - ), |
|
287 | - 'html_class' => $input->html_class() . ' new-state-state', |
|
288 | - 'html_label_text' => esc_html__('New State/Province Name', |
|
289 | - 'event_espresso'), |
|
290 | - 'default' => EE_Registry::instance()->REQ->get($state_name, ''), |
|
291 | - 'required' => false, |
|
292 | - ) |
|
293 | - ), |
|
294 | - 'spacer' => new EE_Form_Section_HTML(EEH_HTML::br()), |
|
295 | - // NEW STATE NAME |
|
296 | - 'new_state_abbrv' => new EE_Text_Input( |
|
297 | - array( |
|
298 | - 'html_name' => $abbrv_name, |
|
299 | - 'html_id' => str_replace('state', 'nsmf_new_state_abbrv', |
|
300 | - $input->html_id()), |
|
301 | - 'html_class' => $input->html_class() . ' new-state-abbrv', |
|
302 | - 'html_label_text' => esc_html__( |
|
303 | - 'New State/Province Abbreviation', |
|
304 | - 'event_espresso' |
|
305 | - ) . ' *', |
|
306 | - 'html_other_attributes' => 'size="24"', |
|
307 | - 'default' => EE_Registry::instance()->REQ->get($abbrv_name, ''), |
|
308 | - 'required' => false, |
|
309 | - ) |
|
310 | - ), |
|
311 | - // "submit" button |
|
312 | - 'add_new_state_submit_button' => new EE_Form_Section_HTML( |
|
313 | - apply_filters( |
|
314 | - 'FHEE__EED_Add_New_State__display_add_new_state_micro_form__add_new_state_submit_button', |
|
315 | - EEH_HTML::nbsp(3) . |
|
316 | - EEH_HTML::link( |
|
317 | - '', |
|
318 | - esc_html__('ADD', 'event_espresso'), |
|
319 | - '', |
|
320 | - 'submit-' . $new_state_submit_id, |
|
321 | - 'ee-form-add-new-state-submit button button-secondary', |
|
322 | - '', |
|
323 | - 'data-target="' . $new_state_submit_id . '"' |
|
324 | - ) |
|
325 | - ) |
|
326 | - ), |
|
327 | - // extra info |
|
328 | - 'add_new_state_extra' => new EE_Form_Section_HTML( |
|
329 | - apply_filters( |
|
330 | - 'FHEE__EED_Add_New_State__display_add_new_state_micro_form__add_new_state_extra', |
|
331 | - EEH_HTML::br(2) |
|
332 | - . |
|
333 | - EEH_HTML::div('', '', 'small-text') |
|
334 | - . |
|
335 | - EEH_HTML::strong( |
|
336 | - '* ' . |
|
337 | - esc_html__( |
|
338 | - 'Don\'t know your State/Province Abbreviation?', |
|
339 | - 'event_espresso' |
|
340 | - ) |
|
341 | - ) |
|
342 | - . |
|
343 | - EEH_HTML::br() |
|
344 | - . |
|
345 | - sprintf( |
|
346 | - esc_html__( |
|
347 | - 'You can look here: %s, for a list of Countries and links to their State/Province Abbreviations ("Subdivisions assigned codes" column).', |
|
348 | - 'event_espresso' |
|
349 | - ), |
|
350 | - EEH_HTML::link( |
|
351 | - 'http://en.wikipedia.org/wiki/ISO_3166-2', |
|
352 | - 'http://en.wikipedia.org/wiki/ISO_3166-2', |
|
353 | - '', |
|
354 | - '', |
|
355 | - 'ee-form-add-new-state-wiki-lnk', |
|
356 | - '', |
|
357 | - 'target="_blank"' |
|
358 | - ) |
|
359 | - ) |
|
360 | - . |
|
361 | - EEH_HTML::divx() |
|
362 | - . |
|
363 | - EEH_HTML::br() |
|
364 | - . |
|
365 | - EEH_HTML::link( |
|
366 | - '', |
|
367 | - esc_html__('cancel new State/Province', 'event_espresso'), |
|
368 | - '', |
|
369 | - 'hide-' . $input->html_id(), |
|
370 | - 'ee-form-cancel-new-state-lnk smaller-text', |
|
371 | - '', |
|
372 | - 'data-target="' . $input->html_id() . '"' |
|
373 | - ) |
|
374 | - . |
|
375 | - EEH_HTML::divx() |
|
376 | - . |
|
377 | - EEH_HTML::br() |
|
378 | - ) |
|
379 | - ), |
|
380 | - ), |
|
381 | - ) |
|
382 | - ); |
|
383 | - $question_group_reg_form->add_subsections( |
|
384 | - array('new_state_micro_form' => $new_state_micro_form), |
|
385 | - 'state', |
|
386 | - false |
|
387 | - ); |
|
388 | - } |
|
389 | - return $question_group_reg_form; |
|
390 | - } |
|
391 | - |
|
392 | - |
|
393 | - |
|
394 | - /** |
|
395 | - * set_new_state_input_width |
|
396 | - * |
|
397 | - * @return int|string |
|
398 | - * @throws EE_Error |
|
399 | - */ |
|
400 | - public static function add_new_state() |
|
401 | - { |
|
402 | - $REQ = EE_Registry::instance()->load_core('Request_Handler'); |
|
403 | - if (absint($REQ->get('nsmf_add_new_state')) === 1) { |
|
404 | - EE_Registry::instance()->load_model('State'); |
|
405 | - // grab country ISO code, new state name, and new state abbreviation |
|
406 | - $state_country = $REQ->is_set('nsmf_new_state_country') |
|
407 | - ? sanitize_text_field($REQ->get('nsmf_new_state_country')) |
|
408 | - : false; |
|
409 | - $state_name = $REQ->is_set('nsmf_new_state_name') |
|
410 | - ? sanitize_text_field($REQ->get('nsmf_new_state_name')) |
|
411 | - : false; |
|
412 | - $state_abbr = $REQ->is_set('nsmf_new_state_abbrv') |
|
413 | - ? sanitize_text_field($REQ->get('nsmf_new_state_abbrv')) |
|
414 | - : false; |
|
415 | - if ($state_country && $state_name && $state_abbr) { |
|
416 | - $new_state = EED_Add_New_State::save_new_state_to_db(array( |
|
417 | - 'CNT_ISO' => strtoupper($state_country), |
|
418 | - 'STA_abbrev' => strtoupper($state_abbr), |
|
419 | - 'STA_name' => ucwords($state_name), |
|
420 | - 'STA_active' => false, |
|
421 | - )); |
|
422 | - if ($new_state instanceof EE_State) { |
|
423 | - // clean house |
|
424 | - EE_Registry::instance()->REQ->un_set('nsmf_add_new_state'); |
|
425 | - EE_Registry::instance()->REQ->un_set('nsmf_new_state_country'); |
|
426 | - EE_Registry::instance()->REQ->un_set('nsmf_new_state_name'); |
|
427 | - EE_Registry::instance()->REQ->un_set('nsmf_new_state_abbrv'); |
|
428 | - // get any existing new states |
|
429 | - $new_states = EE_Registry::instance()->SSN->get_session_data( |
|
430 | - 'nsmf_new_states' |
|
431 | - ); |
|
432 | - $new_states[$new_state->ID()] = $new_state; |
|
433 | - EE_Registry::instance()->SSN->set_session_data( |
|
434 | - array('nsmf_new_states' => $new_states) |
|
435 | - ); |
|
436 | - if (EE_Registry::instance()->REQ->ajax) { |
|
437 | - echo wp_json_encode(array( |
|
438 | - 'success' => true, |
|
439 | - 'id' => $new_state->ID(), |
|
440 | - 'name' => $new_state->name(), |
|
441 | - 'abbrev' => $new_state->abbrev(), |
|
442 | - 'country_iso' => $new_state->country_iso(), |
|
443 | - 'country_name' => $new_state->country()->name(), |
|
444 | - )); |
|
445 | - exit(); |
|
446 | - } |
|
447 | - return $new_state->ID(); |
|
448 | - } |
|
449 | - } else { |
|
450 | - $error = esc_html__( |
|
451 | - 'A new State/Province could not be added because invalid or missing data was received.', |
|
452 | - 'event_espresso' |
|
453 | - ); |
|
454 | - if (EE_Registry::instance()->REQ->ajax) { |
|
455 | - echo wp_json_encode(array('error' => $error)); |
|
456 | - exit(); |
|
457 | - } |
|
458 | - EE_Error::add_error($error, __FILE__, __FUNCTION__, __LINE__); |
|
459 | - } |
|
460 | - } |
|
461 | - return false; |
|
462 | - } |
|
463 | - |
|
464 | - |
|
465 | - |
|
466 | - /** |
|
467 | - * recursively drills down through request params to remove any that were added by this module |
|
468 | - * |
|
469 | - * @param array $request_params |
|
470 | - * @return array |
|
471 | - */ |
|
472 | - public static function filter_checkout_request_params($request_params) |
|
473 | - { |
|
474 | - foreach ($request_params as $form_section) { |
|
475 | - if (is_array($form_section)) { |
|
476 | - EED_Add_New_State::unset_new_state_request_params($form_section); |
|
477 | - EED_Add_New_State::filter_checkout_request_params($form_section); |
|
478 | - } |
|
479 | - } |
|
480 | - return $request_params; |
|
481 | - } |
|
482 | - |
|
483 | - |
|
484 | - |
|
485 | - /** |
|
486 | - * @param array $request_params |
|
487 | - * @return array |
|
488 | - */ |
|
489 | - public static function unset_new_state_request_params($request_params) |
|
490 | - { |
|
491 | - unset( |
|
492 | - $request_params['new_state_micro_form'], |
|
493 | - $request_params['new_state_micro_add_new_state'], |
|
494 | - $request_params['new_state_micro_new_state_country'], |
|
495 | - $request_params['new_state_micro_new_state_name'], |
|
496 | - $request_params['new_state_micro_new_state_abbrv'] |
|
497 | - ); |
|
498 | - return $request_params; |
|
499 | - } |
|
500 | - |
|
501 | - |
|
502 | - |
|
503 | - /** |
|
504 | - * @param array $props_n_values |
|
505 | - * @return bool |
|
506 | - * @throws EE_Error |
|
507 | - */ |
|
508 | - public static function save_new_state_to_db($props_n_values = array()) |
|
509 | - { |
|
510 | - $existing_state = EEM_State::instance()->get_all(array($props_n_values, 'limit' => 1)); |
|
511 | - if (! empty($existing_state)) { |
|
512 | - return array_pop($existing_state); |
|
513 | - } |
|
514 | - $new_state = EE_State::new_instance($props_n_values); |
|
515 | - if ($new_state instanceof EE_State) { |
|
516 | - // if not non-ajax admin |
|
517 | - $new_state_key = 'new-state-added-' . $new_state->country_iso() . '-' . $new_state->abbrev(); |
|
518 | - $new_state_notice = sprintf( |
|
519 | - esc_html__( |
|
520 | - 'A new State named "%1$s (%2$s)" was dynamically added from an Event Espresso form for the Country of "%3$s".%5$sTo verify, edit, and/or delete this new State, please go to the %4$s and update the States / Provinces section.%5$sCheck "Yes" to have this new State added to dropdown select lists in forms.', |
|
521 | - 'event_espresso' |
|
522 | - ), |
|
523 | - '<b>' . $new_state->name() . '</b>', |
|
524 | - '<b>' . $new_state->abbrev() . '</b>', |
|
525 | - '<b>' . $new_state->country()->name() . '</b>', |
|
526 | - '<a href="' . add_query_arg(array( |
|
527 | - 'page' => 'espresso_general_settings', |
|
528 | - 'action' => 'country_settings', |
|
529 | - 'country' => $new_state->country_iso(), |
|
530 | - ), admin_url('admin.php')) . '">' . esc_html__('Event Espresso - General Settings > Countries Tab', |
|
531 | - 'event_espresso') . '</a>', |
|
532 | - '<br />' |
|
533 | - ); |
|
534 | - EE_Error::add_persistent_admin_notice($new_state_key, $new_state_notice); |
|
535 | - $new_state->save(); |
|
536 | - EEM_State::instance()->reset_cached_states(); |
|
537 | - return $new_state; |
|
538 | - } |
|
539 | - return false; |
|
540 | - } |
|
541 | - |
|
542 | - |
|
543 | - |
|
544 | - /** |
|
545 | - * @param string $CNT_ISO |
|
546 | - * @param string $STA_ID |
|
547 | - * @param array $cols_n_values |
|
548 | - * @return void |
|
549 | - */ |
|
550 | - public static function update_country_settings($CNT_ISO = '', $STA_ID = '', $cols_n_values = array()) |
|
551 | - { |
|
552 | - $CNT_ISO = ! empty($CNT_ISO) ? $CNT_ISO : false; |
|
553 | - if (! $CNT_ISO) { |
|
554 | - EE_Error::add_error( |
|
555 | - esc_html__('An invalid or missing Country ISO Code was received.', 'event_espresso'), |
|
556 | - __FILE__, |
|
557 | - __FUNCTION__, |
|
558 | - __LINE__ |
|
559 | - ); |
|
560 | - } |
|
561 | - $STA_abbrev = is_array($cols_n_values) && isset($cols_n_values['STA_abbrev']) ? $cols_n_values['STA_abbrev'] |
|
562 | - : false; |
|
563 | - if (! $STA_abbrev && ! empty($STA_ID)) { |
|
564 | - $state = EEM_State::instance()->get_one_by_ID($STA_ID); |
|
565 | - if ($state instanceof EE_State) { |
|
566 | - $STA_abbrev = $state->abbrev(); |
|
567 | - } |
|
568 | - } |
|
569 | - if (! $STA_abbrev) { |
|
570 | - EE_Error::add_error( |
|
571 | - esc_html__('An invalid or missing State Abbreviation was received.', 'event_espresso'), |
|
572 | - __FILE__, |
|
573 | - __FUNCTION__, |
|
574 | - __LINE__ |
|
575 | - ); |
|
576 | - } |
|
577 | - EE_Error::dismiss_persistent_admin_notice($CNT_ISO . '-' . $STA_abbrev, true, true); |
|
578 | - } |
|
579 | - |
|
580 | - |
|
581 | - |
|
582 | - /** |
|
583 | - * @param EE_State[] $state_options |
|
584 | - * @param EE_SPCO_Reg_Step_Attendee_Information $reg_step |
|
585 | - * @param EE_Registration $registration |
|
586 | - * @param EE_Question $question |
|
587 | - * @param $answer |
|
588 | - * @return array |
|
589 | - */ |
|
590 | - public static function inject_new_reg_state_into_options( |
|
591 | - $state_options = array(), |
|
592 | - EE_SPCO_Reg_Step_Attendee_Information $reg_step, |
|
593 | - EE_Registration $registration, |
|
594 | - EE_Question $question, |
|
595 | - $answer |
|
596 | - ) { |
|
597 | - if ($answer instanceof EE_Answer && $question instanceof EE_Question |
|
598 | - && $question->type() |
|
599 | - === EEM_Question::QST_type_state |
|
600 | - ) { |
|
601 | - $STA_ID = $answer->value(); |
|
602 | - if (! empty($STA_ID)) { |
|
603 | - $state = EEM_State::instance()->get_one_by_ID($STA_ID); |
|
604 | - if ($state instanceof EE_State) { |
|
605 | - $country = $state->country(); |
|
606 | - if ($country instanceof EE_Country) { |
|
607 | - if (! isset($state_options[$country->name()])) { |
|
608 | - $state_options[$country->name()] = array(); |
|
609 | - } |
|
610 | - if (! isset($state_options[$country->name()][$STA_ID])) { |
|
611 | - $state_options[$country->name()][$STA_ID] = $state->name(); |
|
612 | - } |
|
613 | - } |
|
614 | - } |
|
615 | - } |
|
616 | - } |
|
617 | - return $state_options; |
|
618 | - } |
|
619 | - |
|
620 | - |
|
621 | - |
|
622 | - /** |
|
623 | - * @param EE_Country[] $country_options |
|
624 | - * @param EE_SPCO_Reg_Step_Attendee_Information $reg_step |
|
625 | - * @param EE_Registration $registration |
|
626 | - * @param EE_Question $question |
|
627 | - * @param $answer |
|
628 | - * @return array |
|
629 | - */ |
|
630 | - public static function inject_new_reg_country_into_options( |
|
631 | - $country_options = array(), |
|
632 | - EE_SPCO_Reg_Step_Attendee_Information $reg_step, |
|
633 | - EE_Registration $registration, |
|
634 | - EE_Question $question, |
|
635 | - $answer |
|
636 | - ) { |
|
637 | - if ($answer instanceof EE_Answer && $question instanceof EE_Question |
|
638 | - && $question->type() |
|
639 | - === EEM_Question::QST_type_country |
|
640 | - ) { |
|
641 | - $CNT_ISO = $answer->value(); |
|
642 | - if (! empty($CNT_ISO)) { |
|
643 | - $country = EEM_Country::instance()->get_one_by_ID($CNT_ISO); |
|
644 | - if ($country instanceof EE_Country) { |
|
645 | - if (! isset($country_options[$CNT_ISO])) { |
|
646 | - $country_options[$CNT_ISO] = $country->name(); |
|
647 | - } |
|
648 | - } |
|
649 | - } |
|
650 | - } |
|
651 | - return $country_options; |
|
652 | - } |
|
653 | - |
|
654 | - |
|
655 | - |
|
656 | - /** |
|
657 | - * @param EE_State[] $state_options |
|
658 | - * @return array |
|
659 | - * @throws EE_Error |
|
660 | - */ |
|
661 | - public static function state_options($state_options = array()) |
|
662 | - { |
|
663 | - $new_states = EED_Add_New_State::_get_new_states(); |
|
664 | - foreach ($new_states as $new_state) { |
|
665 | - if ( |
|
666 | - $new_state instanceof EE_State |
|
667 | - && $new_state->country() instanceof EE_Country |
|
668 | - ) { |
|
669 | - $state_options[$new_state->country()->name()][$new_state->ID()] = $new_state->name(); |
|
670 | - } |
|
671 | - } |
|
672 | - return $state_options; |
|
673 | - } |
|
674 | - |
|
675 | - |
|
676 | - |
|
677 | - /** |
|
678 | - * @return array |
|
679 | - */ |
|
680 | - protected static function _get_new_states() |
|
681 | - { |
|
682 | - $new_states = array(); |
|
683 | - if (EE_Registry::instance()->SSN instanceof EE_Session) { |
|
684 | - $new_states = EE_Registry::instance()->SSN->get_session_data( |
|
685 | - 'nsmf_new_states' |
|
686 | - ); |
|
687 | - } |
|
688 | - return is_array($new_states) ? $new_states : array(); |
|
689 | - } |
|
690 | - |
|
691 | - |
|
692 | - |
|
693 | - /** |
|
694 | - * @param EE_Country[] $country_options |
|
695 | - * @return array |
|
696 | - * @throws EE_Error |
|
697 | - */ |
|
698 | - public static function country_options($country_options = array()) |
|
699 | - { |
|
700 | - $new_states = EED_Add_New_State::_get_new_states(); |
|
701 | - foreach ($new_states as $new_state) { |
|
702 | - if ( |
|
703 | - $new_state instanceof EE_State |
|
704 | - && $new_state->country() instanceof EE_Country |
|
705 | - ) { |
|
706 | - $country_options[$new_state->country()->ID()] = $new_state->country()->name(); |
|
707 | - } |
|
708 | - } |
|
709 | - return $country_options; |
|
710 | - } |
|
19 | + /** |
|
20 | + * @return EED_Module|EED_Add_New_State |
|
21 | + */ |
|
22 | + public static function instance() |
|
23 | + { |
|
24 | + return parent::get_instance(__CLASS__); |
|
25 | + } |
|
26 | + |
|
27 | + |
|
28 | + |
|
29 | + /** |
|
30 | + * set_hooks - for hooking into EE Core, other modules, etc |
|
31 | + * |
|
32 | + * @return void |
|
33 | + */ |
|
34 | + public static function set_hooks() |
|
35 | + { |
|
36 | + add_action('wp_loaded', array('EED_Add_New_State', 'set_definitions'), 2); |
|
37 | + add_action('wp_enqueue_scripts', array('EED_Add_New_State', 'translate_js_strings'), 0); |
|
38 | + add_action('wp_enqueue_scripts', array('EED_Add_New_State', 'wp_enqueue_scripts'), 10); |
|
39 | + add_filter('FHEE__EE_SPCO_Reg_Step_Attendee_Information___question_group_reg_form__question_group_reg_form', |
|
40 | + array('EED_Add_New_State', 'display_add_new_state_micro_form'), 1, 1); |
|
41 | + add_filter('FHEE__EE_SPCO_Reg_Step_Payment_Options___get_billing_form_for_payment_method__billing_form', |
|
42 | + array('EED_Add_New_State', 'display_add_new_state_micro_form'), 1, 1); |
|
43 | + add_filter('FHEE__EE_Single_Page_Checkout__process_attendee_information__valid_data_line_item', |
|
44 | + array('EED_Add_New_State', 'unset_new_state_request_params'), 10, 1); |
|
45 | + add_filter('FHEE__EE_SPCO_Reg_Step_Attendee_Information___generate_question_input__state_options', |
|
46 | + array('EED_Add_New_State', 'inject_new_reg_state_into_options'), 10, 5); |
|
47 | + add_filter('FHEE__EE_SPCO_Reg_Step_Attendee_Information___generate_question_input__country_options', |
|
48 | + array('EED_Add_New_State', 'inject_new_reg_country_into_options'), 10, 5); |
|
49 | + add_filter('FHEE__EE_State_Select_Input____construct__state_options', |
|
50 | + array('EED_Add_New_State', 'state_options'), 10, 1); |
|
51 | + add_filter('FHEE__EE_Country_Select_Input____construct__country_options', |
|
52 | + array('EED_Add_New_State', 'country_options'), 10, 1); |
|
53 | + } |
|
54 | + |
|
55 | + |
|
56 | + |
|
57 | + /** |
|
58 | + * set_hooks_admin - for hooking into EE Admin Core, other modules, etc |
|
59 | + * |
|
60 | + * @return void |
|
61 | + */ |
|
62 | + public static function set_hooks_admin() |
|
63 | + { |
|
64 | + add_action('wp_loaded', array('EED_Add_New_State', 'set_definitions'), 2); |
|
65 | + add_filter('FHEE__EE_SPCO_Reg_Step_Attendee_Information___question_group_reg_form__question_group_reg_form', |
|
66 | + array('EED_Add_New_State', 'display_add_new_state_micro_form'), 1, 1); |
|
67 | + add_filter('FHEE__EE_SPCO_Reg_Step_Payment_Options___get_billing_form_for_payment_method__billing_form', |
|
68 | + array('EED_Add_New_State', 'display_add_new_state_micro_form'), 1, 1); |
|
69 | + add_action('wp_ajax_espresso_add_new_state', array('EED_Add_New_State', 'add_new_state')); |
|
70 | + add_action('wp_ajax_nopriv_espresso_add_new_state', array('EED_Add_New_State', 'add_new_state')); |
|
71 | + add_filter('FHEE__EE_Single_Page_Checkout__process_attendee_information__valid_data_line_item', |
|
72 | + array('EED_Add_New_State', 'unset_new_state_request_params'), 10, 1); |
|
73 | + add_action('AHEE__General_Settings_Admin_Page__update_country_settings__state_saved', |
|
74 | + array('EED_Add_New_State', 'update_country_settings'), 10, 3); |
|
75 | + add_action('AHEE__General_Settings_Admin_Page__delete_state__state_deleted', |
|
76 | + array('EED_Add_New_State', 'update_country_settings'), 10, 3); |
|
77 | + add_filter('FHEE__EE_State_Select_Input____construct__state_options', |
|
78 | + array('EED_Add_New_State', 'state_options'), 10, 1); |
|
79 | + add_filter('FHEE__EE_Country_Select_Input____construct__country_options', |
|
80 | + array('EED_Add_New_State', 'country_options'), 10, 1); |
|
81 | + add_filter('FHEE__EE_Form_Section_Proper__receive_form_submission__request_data', |
|
82 | + array('EED_Add_New_State', 'filter_checkout_request_params'), 10, 1); |
|
83 | + add_filter('FHEE__EE_SPCO_Reg_Step_Attendee_Information___generate_question_input__state_options', |
|
84 | + array('EED_Add_New_State', 'inject_new_reg_state_into_options'), 10, 5); |
|
85 | + add_filter('FHEE__EE_SPCO_Reg_Step_Attendee_Information___generate_question_input__country_options', |
|
86 | + array('EED_Add_New_State', 'inject_new_reg_country_into_options'), 10, 5); |
|
87 | + } |
|
88 | + |
|
89 | + |
|
90 | + |
|
91 | + /** |
|
92 | + * @return void |
|
93 | + */ |
|
94 | + public static function set_definitions() |
|
95 | + { |
|
96 | + define('ANS_ASSETS_URL', plugin_dir_url(__FILE__) . 'assets' . DS); |
|
97 | + define('ANS_TEMPLATES_PATH', str_replace( |
|
98 | + '\\', |
|
99 | + DS, plugin_dir_path(__FILE__)) . 'templates' . DS |
|
100 | + ); |
|
101 | + } |
|
102 | + |
|
103 | + |
|
104 | + |
|
105 | + /** |
|
106 | + * @param WP $WP |
|
107 | + * @return void |
|
108 | + */ |
|
109 | + public function run($WP) |
|
110 | + { |
|
111 | + } |
|
112 | + |
|
113 | + |
|
114 | + |
|
115 | + /** |
|
116 | + * @return void |
|
117 | + */ |
|
118 | + public static function translate_js_strings() |
|
119 | + { |
|
120 | + EE_Registry::$i18n_js_strings['ans_no_country'] = esc_html__( |
|
121 | + 'In order to proceed, you need to select the Country that your State/Province belongs to.', |
|
122 | + 'event_espresso' |
|
123 | + ); |
|
124 | + EE_Registry::$i18n_js_strings['ans_no_name'] = esc_html__( |
|
125 | + 'In order to proceed, you need to enter the name of your State/Province.', |
|
126 | + 'event_espresso' |
|
127 | + ); |
|
128 | + EE_Registry::$i18n_js_strings['ans_no_abbreviation'] = esc_html__( |
|
129 | + 'In order to proceed, you need to enter an abbreviation for the name of your State/Province.', |
|
130 | + 'event_espresso' |
|
131 | + ); |
|
132 | + EE_Registry::$i18n_js_strings['ans_save_success'] = esc_html__( |
|
133 | + 'The new state was successfully saved to the database.', |
|
134 | + 'event_espresso' |
|
135 | + ); |
|
136 | + EE_Registry::$i18n_js_strings['ans_server_save_error'] = esc_html__( |
|
137 | + 'An unknown error has occurred on the server while saving the new state to the database.', |
|
138 | + 'event_espresso' |
|
139 | + ); |
|
140 | + } |
|
141 | + |
|
142 | + |
|
143 | + |
|
144 | + /** |
|
145 | + * @return void |
|
146 | + */ |
|
147 | + public static function wp_enqueue_scripts() |
|
148 | + { |
|
149 | + if (apply_filters('EED_Single_Page_Checkout__SPCO_active', false)) { |
|
150 | + wp_register_script('add_new_state', ANS_ASSETS_URL . 'add_new_state.js', |
|
151 | + array('espresso_core', 'single_page_checkout'), EVENT_ESPRESSO_VERSION, true); |
|
152 | + wp_enqueue_script('add_new_state'); |
|
153 | + } |
|
154 | + } |
|
155 | + |
|
156 | + |
|
157 | + |
|
158 | + /** |
|
159 | + * display_add_new_state_micro_form |
|
160 | + * |
|
161 | + * @param EE_Form_Section_Proper $question_group_reg_form |
|
162 | + * @return string |
|
163 | + * @throws EE_Error |
|
164 | + */ |
|
165 | + // public static function display_add_new_state_micro_form( $html, EE_Form_Input_With_Options_Base $input ){ |
|
166 | + public static function display_add_new_state_micro_form(EE_Form_Section_Proper $question_group_reg_form) |
|
167 | + { |
|
168 | + // only add the 'new_state_micro_form' when displaying reg forms, |
|
169 | + // not during processing since we process the 'new_state_micro_form' in it's own AJAX request |
|
170 | + $action = EE_Registry::instance()->REQ->get('action', ''); |
|
171 | + // is the "state" question in this form section? |
|
172 | + $input = $question_group_reg_form->get_subsection('state'); |
|
173 | + if ($action === 'process_reg_step' || $action === 'update_reg_step') { |
|
174 | + //ok then all we need to do is make sure the input's HTML name is consistent |
|
175 | + //by forcing it to set it now, like it did while getting the form for display |
|
176 | + if ($input instanceof EE_State_Select_Input) { |
|
177 | + $input->html_name(); |
|
178 | + } |
|
179 | + return $question_group_reg_form; |
|
180 | + } |
|
181 | + // we're only doing this for state select inputs |
|
182 | + if ($input instanceof EE_State_Select_Input) { |
|
183 | + // grab any set values from the request |
|
184 | + $country_name = str_replace('state', 'nsmf_new_state_country', $input->html_name()); |
|
185 | + $state_name = str_replace('state', 'nsmf_new_state_name', $input->html_name()); |
|
186 | + $abbrv_name = str_replace('state', 'nsmf_new_state_abbrv', $input->html_name()); |
|
187 | + $new_state_submit_id = str_replace('state', 'new_state', $input->html_id()); |
|
188 | + $country_options = array(); |
|
189 | + $countries = EEM_Country::instance()->get_all_countries(); |
|
190 | + if (! empty($countries)) { |
|
191 | + foreach ($countries as $country) { |
|
192 | + if ($country instanceof EE_Country) { |
|
193 | + $country_options[$country->ID()] = $country->name(); |
|
194 | + } |
|
195 | + } |
|
196 | + } |
|
197 | + $new_state_micro_form = new EE_Form_Section_Proper( |
|
198 | + array( |
|
199 | + 'name' => 'new_state_micro_form', |
|
200 | + 'html_id' => 'new_state_micro_form', |
|
201 | + 'layout_strategy' => new EE_Div_Per_Section_Layout(), |
|
202 | + 'subsections' => array( |
|
203 | + // add hidden input to indicate that a new state is being added |
|
204 | + 'add_new_state' => new EE_Hidden_Input( |
|
205 | + array( |
|
206 | + 'html_name' => str_replace( |
|
207 | + 'state', |
|
208 | + 'nsmf_add_new_state', $input->html_name() |
|
209 | + ), |
|
210 | + 'html_id' => str_replace( |
|
211 | + 'state', |
|
212 | + 'nsmf_add_new_state', $input->html_id() |
|
213 | + ), |
|
214 | + 'default' => 0, |
|
215 | + ) |
|
216 | + ), |
|
217 | + // add link for displaying hidden container |
|
218 | + 'click_here_link' => new EE_Form_Section_HTML( |
|
219 | + apply_filters( |
|
220 | + 'FHEE__EED_Add_New_State__display_add_new_state_micro_form__click_here_link', |
|
221 | + EEH_HTML::link( |
|
222 | + '', |
|
223 | + esc_html__('click here to add a new state/province', 'event_espresso'), |
|
224 | + '', |
|
225 | + 'display-' . $input->html_id(), |
|
226 | + 'ee-form-add-new-state-lnk display-the-hidden smaller-text hide-if-no-js', |
|
227 | + '', |
|
228 | + 'data-target="' . $input->html_id() . '"' |
|
229 | + ) |
|
230 | + ) |
|
231 | + ), |
|
232 | + // add initial html for hidden container |
|
233 | + 'add_new_state_micro_form' => new EE_Form_Section_HTML( |
|
234 | + apply_filters( |
|
235 | + 'FHEE__EED_Add_New_State__display_add_new_state_micro_form__add_new_state_micro_form', |
|
236 | + EEH_HTML::div('', $input->html_id() . '-dv', 'ee-form-add-new-state-dv', |
|
237 | + 'display: none;') . |
|
238 | + EEH_HTML::h6( |
|
239 | + esc_html__( |
|
240 | + 'If your State/Province does not appear in the list above, you can easily add it by doing the following:', |
|
241 | + 'event_espresso' |
|
242 | + ) |
|
243 | + ) . |
|
244 | + EEH_HTML::ul() . |
|
245 | + EEH_HTML::li( |
|
246 | + esc_html__( |
|
247 | + 'first select the Country that your State/Province belongs to', |
|
248 | + 'event_espresso' |
|
249 | + ) |
|
250 | + ) . |
|
251 | + EEH_HTML::li( |
|
252 | + esc_html__('enter the name of your State/Province', 'event_espresso') |
|
253 | + ) . |
|
254 | + EEH_HTML::li( |
|
255 | + esc_html__( |
|
256 | + 'enter a two to six letter abbreviation for the name of your State/Province', |
|
257 | + 'event_espresso' |
|
258 | + ) |
|
259 | + ) . |
|
260 | + EEH_HTML::li(esc_html__('click the ADD button', 'event_espresso')) . |
|
261 | + EEH_HTML::ulx() |
|
262 | + ) |
|
263 | + ), |
|
264 | + // NEW STATE COUNTRY |
|
265 | + 'new_state_country' => new EE_Country_Select_Input( |
|
266 | + $country_options, |
|
267 | + array( |
|
268 | + 'html_name' => $country_name, |
|
269 | + 'html_id' => str_replace( |
|
270 | + 'state', |
|
271 | + 'nsmf_new_state_country', $input->html_id() |
|
272 | + ), |
|
273 | + 'html_class' => $input->html_class() . ' new-state-country', |
|
274 | + 'html_label_text' => esc_html__('New State/Province Country', 'event_espresso'), |
|
275 | + 'default' => EE_Registry::instance()->REQ->get($country_name, ''), |
|
276 | + 'required' => false, |
|
277 | + ) |
|
278 | + ), |
|
279 | + // NEW STATE NAME |
|
280 | + 'new_state_name' => new EE_Text_Input( |
|
281 | + array( |
|
282 | + 'html_name' => $state_name, |
|
283 | + 'html_id' => str_replace( |
|
284 | + 'state', |
|
285 | + 'nsmf_new_state_name', $input->html_id() |
|
286 | + ), |
|
287 | + 'html_class' => $input->html_class() . ' new-state-state', |
|
288 | + 'html_label_text' => esc_html__('New State/Province Name', |
|
289 | + 'event_espresso'), |
|
290 | + 'default' => EE_Registry::instance()->REQ->get($state_name, ''), |
|
291 | + 'required' => false, |
|
292 | + ) |
|
293 | + ), |
|
294 | + 'spacer' => new EE_Form_Section_HTML(EEH_HTML::br()), |
|
295 | + // NEW STATE NAME |
|
296 | + 'new_state_abbrv' => new EE_Text_Input( |
|
297 | + array( |
|
298 | + 'html_name' => $abbrv_name, |
|
299 | + 'html_id' => str_replace('state', 'nsmf_new_state_abbrv', |
|
300 | + $input->html_id()), |
|
301 | + 'html_class' => $input->html_class() . ' new-state-abbrv', |
|
302 | + 'html_label_text' => esc_html__( |
|
303 | + 'New State/Province Abbreviation', |
|
304 | + 'event_espresso' |
|
305 | + ) . ' *', |
|
306 | + 'html_other_attributes' => 'size="24"', |
|
307 | + 'default' => EE_Registry::instance()->REQ->get($abbrv_name, ''), |
|
308 | + 'required' => false, |
|
309 | + ) |
|
310 | + ), |
|
311 | + // "submit" button |
|
312 | + 'add_new_state_submit_button' => new EE_Form_Section_HTML( |
|
313 | + apply_filters( |
|
314 | + 'FHEE__EED_Add_New_State__display_add_new_state_micro_form__add_new_state_submit_button', |
|
315 | + EEH_HTML::nbsp(3) . |
|
316 | + EEH_HTML::link( |
|
317 | + '', |
|
318 | + esc_html__('ADD', 'event_espresso'), |
|
319 | + '', |
|
320 | + 'submit-' . $new_state_submit_id, |
|
321 | + 'ee-form-add-new-state-submit button button-secondary', |
|
322 | + '', |
|
323 | + 'data-target="' . $new_state_submit_id . '"' |
|
324 | + ) |
|
325 | + ) |
|
326 | + ), |
|
327 | + // extra info |
|
328 | + 'add_new_state_extra' => new EE_Form_Section_HTML( |
|
329 | + apply_filters( |
|
330 | + 'FHEE__EED_Add_New_State__display_add_new_state_micro_form__add_new_state_extra', |
|
331 | + EEH_HTML::br(2) |
|
332 | + . |
|
333 | + EEH_HTML::div('', '', 'small-text') |
|
334 | + . |
|
335 | + EEH_HTML::strong( |
|
336 | + '* ' . |
|
337 | + esc_html__( |
|
338 | + 'Don\'t know your State/Province Abbreviation?', |
|
339 | + 'event_espresso' |
|
340 | + ) |
|
341 | + ) |
|
342 | + . |
|
343 | + EEH_HTML::br() |
|
344 | + . |
|
345 | + sprintf( |
|
346 | + esc_html__( |
|
347 | + 'You can look here: %s, for a list of Countries and links to their State/Province Abbreviations ("Subdivisions assigned codes" column).', |
|
348 | + 'event_espresso' |
|
349 | + ), |
|
350 | + EEH_HTML::link( |
|
351 | + 'http://en.wikipedia.org/wiki/ISO_3166-2', |
|
352 | + 'http://en.wikipedia.org/wiki/ISO_3166-2', |
|
353 | + '', |
|
354 | + '', |
|
355 | + 'ee-form-add-new-state-wiki-lnk', |
|
356 | + '', |
|
357 | + 'target="_blank"' |
|
358 | + ) |
|
359 | + ) |
|
360 | + . |
|
361 | + EEH_HTML::divx() |
|
362 | + . |
|
363 | + EEH_HTML::br() |
|
364 | + . |
|
365 | + EEH_HTML::link( |
|
366 | + '', |
|
367 | + esc_html__('cancel new State/Province', 'event_espresso'), |
|
368 | + '', |
|
369 | + 'hide-' . $input->html_id(), |
|
370 | + 'ee-form-cancel-new-state-lnk smaller-text', |
|
371 | + '', |
|
372 | + 'data-target="' . $input->html_id() . '"' |
|
373 | + ) |
|
374 | + . |
|
375 | + EEH_HTML::divx() |
|
376 | + . |
|
377 | + EEH_HTML::br() |
|
378 | + ) |
|
379 | + ), |
|
380 | + ), |
|
381 | + ) |
|
382 | + ); |
|
383 | + $question_group_reg_form->add_subsections( |
|
384 | + array('new_state_micro_form' => $new_state_micro_form), |
|
385 | + 'state', |
|
386 | + false |
|
387 | + ); |
|
388 | + } |
|
389 | + return $question_group_reg_form; |
|
390 | + } |
|
391 | + |
|
392 | + |
|
393 | + |
|
394 | + /** |
|
395 | + * set_new_state_input_width |
|
396 | + * |
|
397 | + * @return int|string |
|
398 | + * @throws EE_Error |
|
399 | + */ |
|
400 | + public static function add_new_state() |
|
401 | + { |
|
402 | + $REQ = EE_Registry::instance()->load_core('Request_Handler'); |
|
403 | + if (absint($REQ->get('nsmf_add_new_state')) === 1) { |
|
404 | + EE_Registry::instance()->load_model('State'); |
|
405 | + // grab country ISO code, new state name, and new state abbreviation |
|
406 | + $state_country = $REQ->is_set('nsmf_new_state_country') |
|
407 | + ? sanitize_text_field($REQ->get('nsmf_new_state_country')) |
|
408 | + : false; |
|
409 | + $state_name = $REQ->is_set('nsmf_new_state_name') |
|
410 | + ? sanitize_text_field($REQ->get('nsmf_new_state_name')) |
|
411 | + : false; |
|
412 | + $state_abbr = $REQ->is_set('nsmf_new_state_abbrv') |
|
413 | + ? sanitize_text_field($REQ->get('nsmf_new_state_abbrv')) |
|
414 | + : false; |
|
415 | + if ($state_country && $state_name && $state_abbr) { |
|
416 | + $new_state = EED_Add_New_State::save_new_state_to_db(array( |
|
417 | + 'CNT_ISO' => strtoupper($state_country), |
|
418 | + 'STA_abbrev' => strtoupper($state_abbr), |
|
419 | + 'STA_name' => ucwords($state_name), |
|
420 | + 'STA_active' => false, |
|
421 | + )); |
|
422 | + if ($new_state instanceof EE_State) { |
|
423 | + // clean house |
|
424 | + EE_Registry::instance()->REQ->un_set('nsmf_add_new_state'); |
|
425 | + EE_Registry::instance()->REQ->un_set('nsmf_new_state_country'); |
|
426 | + EE_Registry::instance()->REQ->un_set('nsmf_new_state_name'); |
|
427 | + EE_Registry::instance()->REQ->un_set('nsmf_new_state_abbrv'); |
|
428 | + // get any existing new states |
|
429 | + $new_states = EE_Registry::instance()->SSN->get_session_data( |
|
430 | + 'nsmf_new_states' |
|
431 | + ); |
|
432 | + $new_states[$new_state->ID()] = $new_state; |
|
433 | + EE_Registry::instance()->SSN->set_session_data( |
|
434 | + array('nsmf_new_states' => $new_states) |
|
435 | + ); |
|
436 | + if (EE_Registry::instance()->REQ->ajax) { |
|
437 | + echo wp_json_encode(array( |
|
438 | + 'success' => true, |
|
439 | + 'id' => $new_state->ID(), |
|
440 | + 'name' => $new_state->name(), |
|
441 | + 'abbrev' => $new_state->abbrev(), |
|
442 | + 'country_iso' => $new_state->country_iso(), |
|
443 | + 'country_name' => $new_state->country()->name(), |
|
444 | + )); |
|
445 | + exit(); |
|
446 | + } |
|
447 | + return $new_state->ID(); |
|
448 | + } |
|
449 | + } else { |
|
450 | + $error = esc_html__( |
|
451 | + 'A new State/Province could not be added because invalid or missing data was received.', |
|
452 | + 'event_espresso' |
|
453 | + ); |
|
454 | + if (EE_Registry::instance()->REQ->ajax) { |
|
455 | + echo wp_json_encode(array('error' => $error)); |
|
456 | + exit(); |
|
457 | + } |
|
458 | + EE_Error::add_error($error, __FILE__, __FUNCTION__, __LINE__); |
|
459 | + } |
|
460 | + } |
|
461 | + return false; |
|
462 | + } |
|
463 | + |
|
464 | + |
|
465 | + |
|
466 | + /** |
|
467 | + * recursively drills down through request params to remove any that were added by this module |
|
468 | + * |
|
469 | + * @param array $request_params |
|
470 | + * @return array |
|
471 | + */ |
|
472 | + public static function filter_checkout_request_params($request_params) |
|
473 | + { |
|
474 | + foreach ($request_params as $form_section) { |
|
475 | + if (is_array($form_section)) { |
|
476 | + EED_Add_New_State::unset_new_state_request_params($form_section); |
|
477 | + EED_Add_New_State::filter_checkout_request_params($form_section); |
|
478 | + } |
|
479 | + } |
|
480 | + return $request_params; |
|
481 | + } |
|
482 | + |
|
483 | + |
|
484 | + |
|
485 | + /** |
|
486 | + * @param array $request_params |
|
487 | + * @return array |
|
488 | + */ |
|
489 | + public static function unset_new_state_request_params($request_params) |
|
490 | + { |
|
491 | + unset( |
|
492 | + $request_params['new_state_micro_form'], |
|
493 | + $request_params['new_state_micro_add_new_state'], |
|
494 | + $request_params['new_state_micro_new_state_country'], |
|
495 | + $request_params['new_state_micro_new_state_name'], |
|
496 | + $request_params['new_state_micro_new_state_abbrv'] |
|
497 | + ); |
|
498 | + return $request_params; |
|
499 | + } |
|
500 | + |
|
501 | + |
|
502 | + |
|
503 | + /** |
|
504 | + * @param array $props_n_values |
|
505 | + * @return bool |
|
506 | + * @throws EE_Error |
|
507 | + */ |
|
508 | + public static function save_new_state_to_db($props_n_values = array()) |
|
509 | + { |
|
510 | + $existing_state = EEM_State::instance()->get_all(array($props_n_values, 'limit' => 1)); |
|
511 | + if (! empty($existing_state)) { |
|
512 | + return array_pop($existing_state); |
|
513 | + } |
|
514 | + $new_state = EE_State::new_instance($props_n_values); |
|
515 | + if ($new_state instanceof EE_State) { |
|
516 | + // if not non-ajax admin |
|
517 | + $new_state_key = 'new-state-added-' . $new_state->country_iso() . '-' . $new_state->abbrev(); |
|
518 | + $new_state_notice = sprintf( |
|
519 | + esc_html__( |
|
520 | + 'A new State named "%1$s (%2$s)" was dynamically added from an Event Espresso form for the Country of "%3$s".%5$sTo verify, edit, and/or delete this new State, please go to the %4$s and update the States / Provinces section.%5$sCheck "Yes" to have this new State added to dropdown select lists in forms.', |
|
521 | + 'event_espresso' |
|
522 | + ), |
|
523 | + '<b>' . $new_state->name() . '</b>', |
|
524 | + '<b>' . $new_state->abbrev() . '</b>', |
|
525 | + '<b>' . $new_state->country()->name() . '</b>', |
|
526 | + '<a href="' . add_query_arg(array( |
|
527 | + 'page' => 'espresso_general_settings', |
|
528 | + 'action' => 'country_settings', |
|
529 | + 'country' => $new_state->country_iso(), |
|
530 | + ), admin_url('admin.php')) . '">' . esc_html__('Event Espresso - General Settings > Countries Tab', |
|
531 | + 'event_espresso') . '</a>', |
|
532 | + '<br />' |
|
533 | + ); |
|
534 | + EE_Error::add_persistent_admin_notice($new_state_key, $new_state_notice); |
|
535 | + $new_state->save(); |
|
536 | + EEM_State::instance()->reset_cached_states(); |
|
537 | + return $new_state; |
|
538 | + } |
|
539 | + return false; |
|
540 | + } |
|
541 | + |
|
542 | + |
|
543 | + |
|
544 | + /** |
|
545 | + * @param string $CNT_ISO |
|
546 | + * @param string $STA_ID |
|
547 | + * @param array $cols_n_values |
|
548 | + * @return void |
|
549 | + */ |
|
550 | + public static function update_country_settings($CNT_ISO = '', $STA_ID = '', $cols_n_values = array()) |
|
551 | + { |
|
552 | + $CNT_ISO = ! empty($CNT_ISO) ? $CNT_ISO : false; |
|
553 | + if (! $CNT_ISO) { |
|
554 | + EE_Error::add_error( |
|
555 | + esc_html__('An invalid or missing Country ISO Code was received.', 'event_espresso'), |
|
556 | + __FILE__, |
|
557 | + __FUNCTION__, |
|
558 | + __LINE__ |
|
559 | + ); |
|
560 | + } |
|
561 | + $STA_abbrev = is_array($cols_n_values) && isset($cols_n_values['STA_abbrev']) ? $cols_n_values['STA_abbrev'] |
|
562 | + : false; |
|
563 | + if (! $STA_abbrev && ! empty($STA_ID)) { |
|
564 | + $state = EEM_State::instance()->get_one_by_ID($STA_ID); |
|
565 | + if ($state instanceof EE_State) { |
|
566 | + $STA_abbrev = $state->abbrev(); |
|
567 | + } |
|
568 | + } |
|
569 | + if (! $STA_abbrev) { |
|
570 | + EE_Error::add_error( |
|
571 | + esc_html__('An invalid or missing State Abbreviation was received.', 'event_espresso'), |
|
572 | + __FILE__, |
|
573 | + __FUNCTION__, |
|
574 | + __LINE__ |
|
575 | + ); |
|
576 | + } |
|
577 | + EE_Error::dismiss_persistent_admin_notice($CNT_ISO . '-' . $STA_abbrev, true, true); |
|
578 | + } |
|
579 | + |
|
580 | + |
|
581 | + |
|
582 | + /** |
|
583 | + * @param EE_State[] $state_options |
|
584 | + * @param EE_SPCO_Reg_Step_Attendee_Information $reg_step |
|
585 | + * @param EE_Registration $registration |
|
586 | + * @param EE_Question $question |
|
587 | + * @param $answer |
|
588 | + * @return array |
|
589 | + */ |
|
590 | + public static function inject_new_reg_state_into_options( |
|
591 | + $state_options = array(), |
|
592 | + EE_SPCO_Reg_Step_Attendee_Information $reg_step, |
|
593 | + EE_Registration $registration, |
|
594 | + EE_Question $question, |
|
595 | + $answer |
|
596 | + ) { |
|
597 | + if ($answer instanceof EE_Answer && $question instanceof EE_Question |
|
598 | + && $question->type() |
|
599 | + === EEM_Question::QST_type_state |
|
600 | + ) { |
|
601 | + $STA_ID = $answer->value(); |
|
602 | + if (! empty($STA_ID)) { |
|
603 | + $state = EEM_State::instance()->get_one_by_ID($STA_ID); |
|
604 | + if ($state instanceof EE_State) { |
|
605 | + $country = $state->country(); |
|
606 | + if ($country instanceof EE_Country) { |
|
607 | + if (! isset($state_options[$country->name()])) { |
|
608 | + $state_options[$country->name()] = array(); |
|
609 | + } |
|
610 | + if (! isset($state_options[$country->name()][$STA_ID])) { |
|
611 | + $state_options[$country->name()][$STA_ID] = $state->name(); |
|
612 | + } |
|
613 | + } |
|
614 | + } |
|
615 | + } |
|
616 | + } |
|
617 | + return $state_options; |
|
618 | + } |
|
619 | + |
|
620 | + |
|
621 | + |
|
622 | + /** |
|
623 | + * @param EE_Country[] $country_options |
|
624 | + * @param EE_SPCO_Reg_Step_Attendee_Information $reg_step |
|
625 | + * @param EE_Registration $registration |
|
626 | + * @param EE_Question $question |
|
627 | + * @param $answer |
|
628 | + * @return array |
|
629 | + */ |
|
630 | + public static function inject_new_reg_country_into_options( |
|
631 | + $country_options = array(), |
|
632 | + EE_SPCO_Reg_Step_Attendee_Information $reg_step, |
|
633 | + EE_Registration $registration, |
|
634 | + EE_Question $question, |
|
635 | + $answer |
|
636 | + ) { |
|
637 | + if ($answer instanceof EE_Answer && $question instanceof EE_Question |
|
638 | + && $question->type() |
|
639 | + === EEM_Question::QST_type_country |
|
640 | + ) { |
|
641 | + $CNT_ISO = $answer->value(); |
|
642 | + if (! empty($CNT_ISO)) { |
|
643 | + $country = EEM_Country::instance()->get_one_by_ID($CNT_ISO); |
|
644 | + if ($country instanceof EE_Country) { |
|
645 | + if (! isset($country_options[$CNT_ISO])) { |
|
646 | + $country_options[$CNT_ISO] = $country->name(); |
|
647 | + } |
|
648 | + } |
|
649 | + } |
|
650 | + } |
|
651 | + return $country_options; |
|
652 | + } |
|
653 | + |
|
654 | + |
|
655 | + |
|
656 | + /** |
|
657 | + * @param EE_State[] $state_options |
|
658 | + * @return array |
|
659 | + * @throws EE_Error |
|
660 | + */ |
|
661 | + public static function state_options($state_options = array()) |
|
662 | + { |
|
663 | + $new_states = EED_Add_New_State::_get_new_states(); |
|
664 | + foreach ($new_states as $new_state) { |
|
665 | + if ( |
|
666 | + $new_state instanceof EE_State |
|
667 | + && $new_state->country() instanceof EE_Country |
|
668 | + ) { |
|
669 | + $state_options[$new_state->country()->name()][$new_state->ID()] = $new_state->name(); |
|
670 | + } |
|
671 | + } |
|
672 | + return $state_options; |
|
673 | + } |
|
674 | + |
|
675 | + |
|
676 | + |
|
677 | + /** |
|
678 | + * @return array |
|
679 | + */ |
|
680 | + protected static function _get_new_states() |
|
681 | + { |
|
682 | + $new_states = array(); |
|
683 | + if (EE_Registry::instance()->SSN instanceof EE_Session) { |
|
684 | + $new_states = EE_Registry::instance()->SSN->get_session_data( |
|
685 | + 'nsmf_new_states' |
|
686 | + ); |
|
687 | + } |
|
688 | + return is_array($new_states) ? $new_states : array(); |
|
689 | + } |
|
690 | + |
|
691 | + |
|
692 | + |
|
693 | + /** |
|
694 | + * @param EE_Country[] $country_options |
|
695 | + * @return array |
|
696 | + * @throws EE_Error |
|
697 | + */ |
|
698 | + public static function country_options($country_options = array()) |
|
699 | + { |
|
700 | + $new_states = EED_Add_New_State::_get_new_states(); |
|
701 | + foreach ($new_states as $new_state) { |
|
702 | + if ( |
|
703 | + $new_state instanceof EE_State |
|
704 | + && $new_state->country() instanceof EE_Country |
|
705 | + ) { |
|
706 | + $country_options[$new_state->country()->ID()] = $new_state->country()->name(); |
|
707 | + } |
|
708 | + } |
|
709 | + return $country_options; |
|
710 | + } |
|
711 | 711 | |
712 | 712 | |
713 | 713 |
@@ -1,4 +1,4 @@ discard block |
||
1 | -<?php if (! defined('EVENT_ESPRESSO_VERSION')) { |
|
1 | +<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
|
2 | 2 | exit('No direct script access allowed'); |
3 | 3 | } |
4 | 4 | |
@@ -93,10 +93,10 @@ discard block |
||
93 | 93 | */ |
94 | 94 | public static function set_definitions() |
95 | 95 | { |
96 | - define('ANS_ASSETS_URL', plugin_dir_url(__FILE__) . 'assets' . DS); |
|
96 | + define('ANS_ASSETS_URL', plugin_dir_url(__FILE__).'assets'.DS); |
|
97 | 97 | define('ANS_TEMPLATES_PATH', str_replace( |
98 | 98 | '\\', |
99 | - DS, plugin_dir_path(__FILE__)) . 'templates' . DS |
|
99 | + DS, plugin_dir_path(__FILE__)).'templates'.DS |
|
100 | 100 | ); |
101 | 101 | } |
102 | 102 | |
@@ -147,7 +147,7 @@ discard block |
||
147 | 147 | public static function wp_enqueue_scripts() |
148 | 148 | { |
149 | 149 | if (apply_filters('EED_Single_Page_Checkout__SPCO_active', false)) { |
150 | - wp_register_script('add_new_state', ANS_ASSETS_URL . 'add_new_state.js', |
|
150 | + wp_register_script('add_new_state', ANS_ASSETS_URL.'add_new_state.js', |
|
151 | 151 | array('espresso_core', 'single_page_checkout'), EVENT_ESPRESSO_VERSION, true); |
152 | 152 | wp_enqueue_script('add_new_state'); |
153 | 153 | } |
@@ -187,7 +187,7 @@ discard block |
||
187 | 187 | $new_state_submit_id = str_replace('state', 'new_state', $input->html_id()); |
188 | 188 | $country_options = array(); |
189 | 189 | $countries = EEM_Country::instance()->get_all_countries(); |
190 | - if (! empty($countries)) { |
|
190 | + if ( ! empty($countries)) { |
|
191 | 191 | foreach ($countries as $country) { |
192 | 192 | if ($country instanceof EE_Country) { |
193 | 193 | $country_options[$country->ID()] = $country->name(); |
@@ -222,10 +222,10 @@ discard block |
||
222 | 222 | '', |
223 | 223 | esc_html__('click here to add a new state/province', 'event_espresso'), |
224 | 224 | '', |
225 | - 'display-' . $input->html_id(), |
|
225 | + 'display-'.$input->html_id(), |
|
226 | 226 | 'ee-form-add-new-state-lnk display-the-hidden smaller-text hide-if-no-js', |
227 | 227 | '', |
228 | - 'data-target="' . $input->html_id() . '"' |
|
228 | + 'data-target="'.$input->html_id().'"' |
|
229 | 229 | ) |
230 | 230 | ) |
231 | 231 | ), |
@@ -233,31 +233,31 @@ discard block |
||
233 | 233 | 'add_new_state_micro_form' => new EE_Form_Section_HTML( |
234 | 234 | apply_filters( |
235 | 235 | 'FHEE__EED_Add_New_State__display_add_new_state_micro_form__add_new_state_micro_form', |
236 | - EEH_HTML::div('', $input->html_id() . '-dv', 'ee-form-add-new-state-dv', |
|
237 | - 'display: none;') . |
|
236 | + EEH_HTML::div('', $input->html_id().'-dv', 'ee-form-add-new-state-dv', |
|
237 | + 'display: none;'). |
|
238 | 238 | EEH_HTML::h6( |
239 | 239 | esc_html__( |
240 | 240 | 'If your State/Province does not appear in the list above, you can easily add it by doing the following:', |
241 | 241 | 'event_espresso' |
242 | 242 | ) |
243 | - ) . |
|
244 | - EEH_HTML::ul() . |
|
243 | + ). |
|
244 | + EEH_HTML::ul(). |
|
245 | 245 | EEH_HTML::li( |
246 | 246 | esc_html__( |
247 | 247 | 'first select the Country that your State/Province belongs to', |
248 | 248 | 'event_espresso' |
249 | 249 | ) |
250 | - ) . |
|
250 | + ). |
|
251 | 251 | EEH_HTML::li( |
252 | 252 | esc_html__('enter the name of your State/Province', 'event_espresso') |
253 | - ) . |
|
253 | + ). |
|
254 | 254 | EEH_HTML::li( |
255 | 255 | esc_html__( |
256 | 256 | 'enter a two to six letter abbreviation for the name of your State/Province', |
257 | 257 | 'event_espresso' |
258 | 258 | ) |
259 | - ) . |
|
260 | - EEH_HTML::li(esc_html__('click the ADD button', 'event_espresso')) . |
|
259 | + ). |
|
260 | + EEH_HTML::li(esc_html__('click the ADD button', 'event_espresso')). |
|
261 | 261 | EEH_HTML::ulx() |
262 | 262 | ) |
263 | 263 | ), |
@@ -270,7 +270,7 @@ discard block |
||
270 | 270 | 'state', |
271 | 271 | 'nsmf_new_state_country', $input->html_id() |
272 | 272 | ), |
273 | - 'html_class' => $input->html_class() . ' new-state-country', |
|
273 | + 'html_class' => $input->html_class().' new-state-country', |
|
274 | 274 | 'html_label_text' => esc_html__('New State/Province Country', 'event_espresso'), |
275 | 275 | 'default' => EE_Registry::instance()->REQ->get($country_name, ''), |
276 | 276 | 'required' => false, |
@@ -284,7 +284,7 @@ discard block |
||
284 | 284 | 'state', |
285 | 285 | 'nsmf_new_state_name', $input->html_id() |
286 | 286 | ), |
287 | - 'html_class' => $input->html_class() . ' new-state-state', |
|
287 | + 'html_class' => $input->html_class().' new-state-state', |
|
288 | 288 | 'html_label_text' => esc_html__('New State/Province Name', |
289 | 289 | 'event_espresso'), |
290 | 290 | 'default' => EE_Registry::instance()->REQ->get($state_name, ''), |
@@ -298,11 +298,11 @@ discard block |
||
298 | 298 | 'html_name' => $abbrv_name, |
299 | 299 | 'html_id' => str_replace('state', 'nsmf_new_state_abbrv', |
300 | 300 | $input->html_id()), |
301 | - 'html_class' => $input->html_class() . ' new-state-abbrv', |
|
301 | + 'html_class' => $input->html_class().' new-state-abbrv', |
|
302 | 302 | 'html_label_text' => esc_html__( |
303 | 303 | 'New State/Province Abbreviation', |
304 | 304 | 'event_espresso' |
305 | - ) . ' *', |
|
305 | + ).' *', |
|
306 | 306 | 'html_other_attributes' => 'size="24"', |
307 | 307 | 'default' => EE_Registry::instance()->REQ->get($abbrv_name, ''), |
308 | 308 | 'required' => false, |
@@ -312,15 +312,15 @@ discard block |
||
312 | 312 | 'add_new_state_submit_button' => new EE_Form_Section_HTML( |
313 | 313 | apply_filters( |
314 | 314 | 'FHEE__EED_Add_New_State__display_add_new_state_micro_form__add_new_state_submit_button', |
315 | - EEH_HTML::nbsp(3) . |
|
315 | + EEH_HTML::nbsp(3). |
|
316 | 316 | EEH_HTML::link( |
317 | 317 | '', |
318 | 318 | esc_html__('ADD', 'event_espresso'), |
319 | 319 | '', |
320 | - 'submit-' . $new_state_submit_id, |
|
320 | + 'submit-'.$new_state_submit_id, |
|
321 | 321 | 'ee-form-add-new-state-submit button button-secondary', |
322 | 322 | '', |
323 | - 'data-target="' . $new_state_submit_id . '"' |
|
323 | + 'data-target="'.$new_state_submit_id.'"' |
|
324 | 324 | ) |
325 | 325 | ) |
326 | 326 | ), |
@@ -333,7 +333,7 @@ discard block |
||
333 | 333 | EEH_HTML::div('', '', 'small-text') |
334 | 334 | . |
335 | 335 | EEH_HTML::strong( |
336 | - '* ' . |
|
336 | + '* '. |
|
337 | 337 | esc_html__( |
338 | 338 | 'Don\'t know your State/Province Abbreviation?', |
339 | 339 | 'event_espresso' |
@@ -366,10 +366,10 @@ discard block |
||
366 | 366 | '', |
367 | 367 | esc_html__('cancel new State/Province', 'event_espresso'), |
368 | 368 | '', |
369 | - 'hide-' . $input->html_id(), |
|
369 | + 'hide-'.$input->html_id(), |
|
370 | 370 | 'ee-form-cancel-new-state-lnk smaller-text', |
371 | 371 | '', |
372 | - 'data-target="' . $input->html_id() . '"' |
|
372 | + 'data-target="'.$input->html_id().'"' |
|
373 | 373 | ) |
374 | 374 | . |
375 | 375 | EEH_HTML::divx() |
@@ -508,27 +508,27 @@ discard block |
||
508 | 508 | public static function save_new_state_to_db($props_n_values = array()) |
509 | 509 | { |
510 | 510 | $existing_state = EEM_State::instance()->get_all(array($props_n_values, 'limit' => 1)); |
511 | - if (! empty($existing_state)) { |
|
511 | + if ( ! empty($existing_state)) { |
|
512 | 512 | return array_pop($existing_state); |
513 | 513 | } |
514 | 514 | $new_state = EE_State::new_instance($props_n_values); |
515 | 515 | if ($new_state instanceof EE_State) { |
516 | 516 | // if not non-ajax admin |
517 | - $new_state_key = 'new-state-added-' . $new_state->country_iso() . '-' . $new_state->abbrev(); |
|
517 | + $new_state_key = 'new-state-added-'.$new_state->country_iso().'-'.$new_state->abbrev(); |
|
518 | 518 | $new_state_notice = sprintf( |
519 | 519 | esc_html__( |
520 | 520 | 'A new State named "%1$s (%2$s)" was dynamically added from an Event Espresso form for the Country of "%3$s".%5$sTo verify, edit, and/or delete this new State, please go to the %4$s and update the States / Provinces section.%5$sCheck "Yes" to have this new State added to dropdown select lists in forms.', |
521 | 521 | 'event_espresso' |
522 | 522 | ), |
523 | - '<b>' . $new_state->name() . '</b>', |
|
524 | - '<b>' . $new_state->abbrev() . '</b>', |
|
525 | - '<b>' . $new_state->country()->name() . '</b>', |
|
526 | - '<a href="' . add_query_arg(array( |
|
523 | + '<b>'.$new_state->name().'</b>', |
|
524 | + '<b>'.$new_state->abbrev().'</b>', |
|
525 | + '<b>'.$new_state->country()->name().'</b>', |
|
526 | + '<a href="'.add_query_arg(array( |
|
527 | 527 | 'page' => 'espresso_general_settings', |
528 | 528 | 'action' => 'country_settings', |
529 | 529 | 'country' => $new_state->country_iso(), |
530 | - ), admin_url('admin.php')) . '">' . esc_html__('Event Espresso - General Settings > Countries Tab', |
|
531 | - 'event_espresso') . '</a>', |
|
530 | + ), admin_url('admin.php')).'">'.esc_html__('Event Espresso - General Settings > Countries Tab', |
|
531 | + 'event_espresso').'</a>', |
|
532 | 532 | '<br />' |
533 | 533 | ); |
534 | 534 | EE_Error::add_persistent_admin_notice($new_state_key, $new_state_notice); |
@@ -550,7 +550,7 @@ discard block |
||
550 | 550 | public static function update_country_settings($CNT_ISO = '', $STA_ID = '', $cols_n_values = array()) |
551 | 551 | { |
552 | 552 | $CNT_ISO = ! empty($CNT_ISO) ? $CNT_ISO : false; |
553 | - if (! $CNT_ISO) { |
|
553 | + if ( ! $CNT_ISO) { |
|
554 | 554 | EE_Error::add_error( |
555 | 555 | esc_html__('An invalid or missing Country ISO Code was received.', 'event_espresso'), |
556 | 556 | __FILE__, |
@@ -560,13 +560,13 @@ discard block |
||
560 | 560 | } |
561 | 561 | $STA_abbrev = is_array($cols_n_values) && isset($cols_n_values['STA_abbrev']) ? $cols_n_values['STA_abbrev'] |
562 | 562 | : false; |
563 | - if (! $STA_abbrev && ! empty($STA_ID)) { |
|
563 | + if ( ! $STA_abbrev && ! empty($STA_ID)) { |
|
564 | 564 | $state = EEM_State::instance()->get_one_by_ID($STA_ID); |
565 | 565 | if ($state instanceof EE_State) { |
566 | 566 | $STA_abbrev = $state->abbrev(); |
567 | 567 | } |
568 | 568 | } |
569 | - if (! $STA_abbrev) { |
|
569 | + if ( ! $STA_abbrev) { |
|
570 | 570 | EE_Error::add_error( |
571 | 571 | esc_html__('An invalid or missing State Abbreviation was received.', 'event_espresso'), |
572 | 572 | __FILE__, |
@@ -574,7 +574,7 @@ discard block |
||
574 | 574 | __LINE__ |
575 | 575 | ); |
576 | 576 | } |
577 | - EE_Error::dismiss_persistent_admin_notice($CNT_ISO . '-' . $STA_abbrev, true, true); |
|
577 | + EE_Error::dismiss_persistent_admin_notice($CNT_ISO.'-'.$STA_abbrev, true, true); |
|
578 | 578 | } |
579 | 579 | |
580 | 580 | |
@@ -599,15 +599,15 @@ discard block |
||
599 | 599 | === EEM_Question::QST_type_state |
600 | 600 | ) { |
601 | 601 | $STA_ID = $answer->value(); |
602 | - if (! empty($STA_ID)) { |
|
602 | + if ( ! empty($STA_ID)) { |
|
603 | 603 | $state = EEM_State::instance()->get_one_by_ID($STA_ID); |
604 | 604 | if ($state instanceof EE_State) { |
605 | 605 | $country = $state->country(); |
606 | 606 | if ($country instanceof EE_Country) { |
607 | - if (! isset($state_options[$country->name()])) { |
|
607 | + if ( ! isset($state_options[$country->name()])) { |
|
608 | 608 | $state_options[$country->name()] = array(); |
609 | 609 | } |
610 | - if (! isset($state_options[$country->name()][$STA_ID])) { |
|
610 | + if ( ! isset($state_options[$country->name()][$STA_ID])) { |
|
611 | 611 | $state_options[$country->name()][$STA_ID] = $state->name(); |
612 | 612 | } |
613 | 613 | } |
@@ -639,10 +639,10 @@ discard block |
||
639 | 639 | === EEM_Question::QST_type_country |
640 | 640 | ) { |
641 | 641 | $CNT_ISO = $answer->value(); |
642 | - if (! empty($CNT_ISO)) { |
|
642 | + if ( ! empty($CNT_ISO)) { |
|
643 | 643 | $country = EEM_Country::instance()->get_one_by_ID($CNT_ISO); |
644 | 644 | if ($country instanceof EE_Country) { |
645 | - if (! isset($country_options[$CNT_ISO])) { |
|
645 | + if ( ! isset($country_options[$CNT_ISO])) { |
|
646 | 646 | $country_options[$CNT_ISO] = $country->name(); |
647 | 647 | } |
648 | 648 | } |
@@ -1,5 +1,5 @@ discard block |
||
1 | 1 | <?php if ( ! defined('ABSPATH')) { |
2 | - exit('No direct script access allowed'); |
|
2 | + exit('No direct script access allowed'); |
|
3 | 3 | } |
4 | 4 | /* |
5 | 5 | Plugin Name: Event Espresso |
@@ -40,243 +40,243 @@ discard block |
||
40 | 40 | * @since 4.0 |
41 | 41 | */ |
42 | 42 | if (function_exists('espresso_version')) { |
43 | - /** |
|
44 | - * espresso_duplicate_plugin_error |
|
45 | - * displays if more than one version of EE is activated at the same time |
|
46 | - */ |
|
47 | - function espresso_duplicate_plugin_error() |
|
48 | - { |
|
49 | - ?> |
|
43 | + /** |
|
44 | + * espresso_duplicate_plugin_error |
|
45 | + * displays if more than one version of EE is activated at the same time |
|
46 | + */ |
|
47 | + function espresso_duplicate_plugin_error() |
|
48 | + { |
|
49 | + ?> |
|
50 | 50 | <div class="error"> |
51 | 51 | <p> |
52 | 52 | <?php echo esc_html__( |
53 | - 'Can not run multiple versions of Event Espresso! One version has been automatically deactivated. Please verify that you have the correct version you want still active.', |
|
54 | - 'event_espresso' |
|
55 | - ); ?> |
|
53 | + 'Can not run multiple versions of Event Espresso! One version has been automatically deactivated. Please verify that you have the correct version you want still active.', |
|
54 | + 'event_espresso' |
|
55 | + ); ?> |
|
56 | 56 | </p> |
57 | 57 | </div> |
58 | 58 | <?php |
59 | - espresso_deactivate_plugin(plugin_basename(__FILE__)); |
|
60 | - } |
|
59 | + espresso_deactivate_plugin(plugin_basename(__FILE__)); |
|
60 | + } |
|
61 | 61 | |
62 | - add_action('admin_notices', 'espresso_duplicate_plugin_error', 1); |
|
62 | + add_action('admin_notices', 'espresso_duplicate_plugin_error', 1); |
|
63 | 63 | } else { |
64 | - define('EE_MIN_PHP_VER_REQUIRED', '5.3.9'); |
|
65 | - if ( ! version_compare(PHP_VERSION, EE_MIN_PHP_VER_REQUIRED, '>=')) { |
|
66 | - /** |
|
67 | - * espresso_minimum_php_version_error |
|
68 | - * |
|
69 | - * @return void |
|
70 | - */ |
|
71 | - function espresso_minimum_php_version_error() |
|
72 | - { |
|
73 | - ?> |
|
64 | + define('EE_MIN_PHP_VER_REQUIRED', '5.3.9'); |
|
65 | + if ( ! version_compare(PHP_VERSION, EE_MIN_PHP_VER_REQUIRED, '>=')) { |
|
66 | + /** |
|
67 | + * espresso_minimum_php_version_error |
|
68 | + * |
|
69 | + * @return void |
|
70 | + */ |
|
71 | + function espresso_minimum_php_version_error() |
|
72 | + { |
|
73 | + ?> |
|
74 | 74 | <div class="error"> |
75 | 75 | <p> |
76 | 76 | <?php |
77 | - printf( |
|
78 | - esc_html__( |
|
79 | - 'We\'re sorry, but Event Espresso requires PHP version %1$s or greater in order to operate. You are currently running version %2$s.%3$sIn order to update your version of PHP, you will need to contact your current hosting provider.%3$sFor information on stable PHP versions, please go to %4$s.', |
|
80 | - 'event_espresso' |
|
81 | - ), |
|
82 | - EE_MIN_PHP_VER_REQUIRED, |
|
83 | - PHP_VERSION, |
|
84 | - '<br/>', |
|
85 | - '<a href="http://php.net/downloads.php">http://php.net/downloads.php</a>' |
|
86 | - ); |
|
87 | - ?> |
|
77 | + printf( |
|
78 | + esc_html__( |
|
79 | + 'We\'re sorry, but Event Espresso requires PHP version %1$s or greater in order to operate. You are currently running version %2$s.%3$sIn order to update your version of PHP, you will need to contact your current hosting provider.%3$sFor information on stable PHP versions, please go to %4$s.', |
|
80 | + 'event_espresso' |
|
81 | + ), |
|
82 | + EE_MIN_PHP_VER_REQUIRED, |
|
83 | + PHP_VERSION, |
|
84 | + '<br/>', |
|
85 | + '<a href="http://php.net/downloads.php">http://php.net/downloads.php</a>' |
|
86 | + ); |
|
87 | + ?> |
|
88 | 88 | </p> |
89 | 89 | </div> |
90 | 90 | <?php |
91 | - espresso_deactivate_plugin(plugin_basename(__FILE__)); |
|
92 | - } |
|
91 | + espresso_deactivate_plugin(plugin_basename(__FILE__)); |
|
92 | + } |
|
93 | 93 | |
94 | - add_action('admin_notices', 'espresso_minimum_php_version_error', 1); |
|
95 | - } else { |
|
96 | - /** |
|
97 | - * espresso_version |
|
98 | - * Returns the plugin version |
|
99 | - * |
|
100 | - * @return string |
|
101 | - */ |
|
102 | - function espresso_version() |
|
103 | - { |
|
104 | - return apply_filters('FHEE__espresso__espresso_version', '4.9.39.rc.006'); |
|
105 | - } |
|
94 | + add_action('admin_notices', 'espresso_minimum_php_version_error', 1); |
|
95 | + } else { |
|
96 | + /** |
|
97 | + * espresso_version |
|
98 | + * Returns the plugin version |
|
99 | + * |
|
100 | + * @return string |
|
101 | + */ |
|
102 | + function espresso_version() |
|
103 | + { |
|
104 | + return apply_filters('FHEE__espresso__espresso_version', '4.9.39.rc.006'); |
|
105 | + } |
|
106 | 106 | |
107 | - // define versions |
|
108 | - define('EVENT_ESPRESSO_VERSION', espresso_version()); |
|
109 | - define('EE_MIN_WP_VER_REQUIRED', '4.1'); |
|
110 | - define('EE_MIN_WP_VER_RECOMMENDED', '4.4.2'); |
|
111 | - define('EE_MIN_PHP_VER_RECOMMENDED', '5.4.44'); |
|
112 | - define('EVENT_ESPRESSO_MAIN_FILE', __FILE__); |
|
113 | - //used to be DIRECTORY_SEPARATOR, but that caused issues on windows |
|
114 | - if ( ! defined('DS')) { |
|
115 | - define('DS', '/'); |
|
116 | - } |
|
117 | - if ( ! defined('PS')) { |
|
118 | - define('PS', PATH_SEPARATOR); |
|
119 | - } |
|
120 | - if ( ! defined('SP')) { |
|
121 | - define('SP', ' '); |
|
122 | - } |
|
123 | - if ( ! defined('EENL')) { |
|
124 | - define('EENL', "\n"); |
|
125 | - } |
|
126 | - define('EE_SUPPORT_EMAIL', '[email protected]'); |
|
127 | - // define the plugin directory and URL |
|
128 | - define('EE_PLUGIN_BASENAME', plugin_basename(EVENT_ESPRESSO_MAIN_FILE)); |
|
129 | - define('EE_PLUGIN_DIR_PATH', plugin_dir_path(EVENT_ESPRESSO_MAIN_FILE)); |
|
130 | - define('EE_PLUGIN_DIR_URL', plugin_dir_url(EVENT_ESPRESSO_MAIN_FILE)); |
|
131 | - // main root folder paths |
|
132 | - define('EE_ADMIN_PAGES', EE_PLUGIN_DIR_PATH . 'admin_pages' . DS); |
|
133 | - define('EE_CORE', EE_PLUGIN_DIR_PATH . 'core' . DS); |
|
134 | - define('EE_MODULES', EE_PLUGIN_DIR_PATH . 'modules' . DS); |
|
135 | - define('EE_PUBLIC', EE_PLUGIN_DIR_PATH . 'public' . DS); |
|
136 | - define('EE_SHORTCODES', EE_PLUGIN_DIR_PATH . 'shortcodes' . DS); |
|
137 | - define('EE_WIDGETS', EE_PLUGIN_DIR_PATH . 'widgets' . DS); |
|
138 | - define('EE_PAYMENT_METHODS', EE_PLUGIN_DIR_PATH . 'payment_methods' . DS); |
|
139 | - define('EE_CAFF_PATH', EE_PLUGIN_DIR_PATH . 'caffeinated' . DS); |
|
140 | - // core system paths |
|
141 | - define('EE_ADMIN', EE_CORE . 'admin' . DS); |
|
142 | - define('EE_CPTS', EE_CORE . 'CPTs' . DS); |
|
143 | - define('EE_CLASSES', EE_CORE . 'db_classes' . DS); |
|
144 | - define('EE_INTERFACES', EE_CORE . 'interfaces' . DS); |
|
145 | - define('EE_BUSINESS', EE_CORE . 'business' . DS); |
|
146 | - define('EE_MODELS', EE_CORE . 'db_models' . DS); |
|
147 | - define('EE_HELPERS', EE_CORE . 'helpers' . DS); |
|
148 | - define('EE_LIBRARIES', EE_CORE . 'libraries' . DS); |
|
149 | - define('EE_TEMPLATES', EE_CORE . 'templates' . DS); |
|
150 | - define('EE_THIRD_PARTY', EE_CORE . 'third_party_libs' . DS); |
|
151 | - define('EE_GLOBAL_ASSETS', EE_TEMPLATES . 'global_assets' . DS); |
|
152 | - define('EE_FORM_SECTIONS', EE_LIBRARIES . 'form_sections' . DS); |
|
153 | - // gateways |
|
154 | - define('EE_GATEWAYS', EE_MODULES . 'gateways' . DS); |
|
155 | - define('EE_GATEWAYS_URL', EE_PLUGIN_DIR_URL . 'modules' . DS . 'gateways' . DS); |
|
156 | - // asset URL paths |
|
157 | - define('EE_TEMPLATES_URL', EE_PLUGIN_DIR_URL . 'core' . DS . 'templates' . DS); |
|
158 | - define('EE_GLOBAL_ASSETS_URL', EE_TEMPLATES_URL . 'global_assets' . DS); |
|
159 | - define('EE_IMAGES_URL', EE_GLOBAL_ASSETS_URL . 'images' . DS); |
|
160 | - define('EE_THIRD_PARTY_URL', EE_PLUGIN_DIR_URL . 'core' . DS . 'third_party_libs' . DS); |
|
161 | - define('EE_HELPERS_ASSETS', EE_PLUGIN_DIR_URL . 'core/helpers/assets/'); |
|
162 | - define('EE_LIBRARIES_URL', EE_PLUGIN_DIR_URL . 'core/libraries/'); |
|
163 | - // define upload paths |
|
164 | - $uploads = wp_upload_dir(); |
|
165 | - // define the uploads directory and URL |
|
166 | - define('EVENT_ESPRESSO_UPLOAD_DIR', $uploads['basedir'] . DS . 'espresso' . DS); |
|
167 | - define('EVENT_ESPRESSO_UPLOAD_URL', $uploads['baseurl'] . DS . 'espresso' . DS); |
|
168 | - // define the templates directory and URL |
|
169 | - define('EVENT_ESPRESSO_TEMPLATE_DIR', $uploads['basedir'] . DS . 'espresso' . DS . 'templates' . DS); |
|
170 | - define('EVENT_ESPRESSO_TEMPLATE_URL', $uploads['baseurl'] . DS . 'espresso' . DS . 'templates' . DS); |
|
171 | - // define the gateway directory and URL |
|
172 | - define('EVENT_ESPRESSO_GATEWAY_DIR', $uploads['basedir'] . DS . 'espresso' . DS . 'gateways' . DS); |
|
173 | - define('EVENT_ESPRESSO_GATEWAY_URL', $uploads['baseurl'] . DS . 'espresso' . DS . 'gateways' . DS); |
|
174 | - // languages folder/path |
|
175 | - define('EE_LANGUAGES_SAFE_LOC', '..' . DS . 'uploads' . DS . 'espresso' . DS . 'languages' . DS); |
|
176 | - define('EE_LANGUAGES_SAFE_DIR', EVENT_ESPRESSO_UPLOAD_DIR . 'languages' . DS); |
|
177 | - //check for dompdf fonts in uploads |
|
178 | - if (file_exists(EVENT_ESPRESSO_UPLOAD_DIR . 'fonts' . DS)) { |
|
179 | - define('DOMPDF_FONT_DIR', EVENT_ESPRESSO_UPLOAD_DIR . 'fonts' . DS); |
|
180 | - } |
|
181 | - //ajax constants |
|
182 | - define( |
|
183 | - 'EE_FRONT_AJAX', |
|
184 | - isset($_REQUEST['ee_front_ajax']) || isset($_REQUEST['data']['ee_front_ajax']) ? true : false |
|
185 | - ); |
|
186 | - define( |
|
187 | - 'EE_ADMIN_AJAX', |
|
188 | - isset($_REQUEST['ee_admin_ajax']) || isset($_REQUEST['data']['ee_admin_ajax']) ? true : false |
|
189 | - ); |
|
190 | - //just a handy constant occasionally needed for finding values representing infinity in the DB |
|
191 | - //you're better to use this than its straight value (currently -1) in case you ever |
|
192 | - //want to change its default value! or find when -1 means infinity |
|
193 | - define('EE_INF_IN_DB', -1); |
|
194 | - define('EE_INF', INF > (float)PHP_INT_MAX ? INF : PHP_INT_MAX); |
|
195 | - define('EE_DEBUG', false); |
|
196 | - // for older WP versions |
|
197 | - if ( ! defined('MONTH_IN_SECONDS')) { |
|
198 | - define('MONTH_IN_SECONDS', DAY_IN_SECONDS * 30); |
|
199 | - } |
|
200 | - /** |
|
201 | - * espresso_plugin_activation |
|
202 | - * adds a wp-option to indicate that EE has been activated via the WP admin plugins page |
|
203 | - */ |
|
204 | - function espresso_plugin_activation() |
|
205 | - { |
|
206 | - update_option('ee_espresso_activation', true); |
|
207 | - } |
|
107 | + // define versions |
|
108 | + define('EVENT_ESPRESSO_VERSION', espresso_version()); |
|
109 | + define('EE_MIN_WP_VER_REQUIRED', '4.1'); |
|
110 | + define('EE_MIN_WP_VER_RECOMMENDED', '4.4.2'); |
|
111 | + define('EE_MIN_PHP_VER_RECOMMENDED', '5.4.44'); |
|
112 | + define('EVENT_ESPRESSO_MAIN_FILE', __FILE__); |
|
113 | + //used to be DIRECTORY_SEPARATOR, but that caused issues on windows |
|
114 | + if ( ! defined('DS')) { |
|
115 | + define('DS', '/'); |
|
116 | + } |
|
117 | + if ( ! defined('PS')) { |
|
118 | + define('PS', PATH_SEPARATOR); |
|
119 | + } |
|
120 | + if ( ! defined('SP')) { |
|
121 | + define('SP', ' '); |
|
122 | + } |
|
123 | + if ( ! defined('EENL')) { |
|
124 | + define('EENL', "\n"); |
|
125 | + } |
|
126 | + define('EE_SUPPORT_EMAIL', '[email protected]'); |
|
127 | + // define the plugin directory and URL |
|
128 | + define('EE_PLUGIN_BASENAME', plugin_basename(EVENT_ESPRESSO_MAIN_FILE)); |
|
129 | + define('EE_PLUGIN_DIR_PATH', plugin_dir_path(EVENT_ESPRESSO_MAIN_FILE)); |
|
130 | + define('EE_PLUGIN_DIR_URL', plugin_dir_url(EVENT_ESPRESSO_MAIN_FILE)); |
|
131 | + // main root folder paths |
|
132 | + define('EE_ADMIN_PAGES', EE_PLUGIN_DIR_PATH . 'admin_pages' . DS); |
|
133 | + define('EE_CORE', EE_PLUGIN_DIR_PATH . 'core' . DS); |
|
134 | + define('EE_MODULES', EE_PLUGIN_DIR_PATH . 'modules' . DS); |
|
135 | + define('EE_PUBLIC', EE_PLUGIN_DIR_PATH . 'public' . DS); |
|
136 | + define('EE_SHORTCODES', EE_PLUGIN_DIR_PATH . 'shortcodes' . DS); |
|
137 | + define('EE_WIDGETS', EE_PLUGIN_DIR_PATH . 'widgets' . DS); |
|
138 | + define('EE_PAYMENT_METHODS', EE_PLUGIN_DIR_PATH . 'payment_methods' . DS); |
|
139 | + define('EE_CAFF_PATH', EE_PLUGIN_DIR_PATH . 'caffeinated' . DS); |
|
140 | + // core system paths |
|
141 | + define('EE_ADMIN', EE_CORE . 'admin' . DS); |
|
142 | + define('EE_CPTS', EE_CORE . 'CPTs' . DS); |
|
143 | + define('EE_CLASSES', EE_CORE . 'db_classes' . DS); |
|
144 | + define('EE_INTERFACES', EE_CORE . 'interfaces' . DS); |
|
145 | + define('EE_BUSINESS', EE_CORE . 'business' . DS); |
|
146 | + define('EE_MODELS', EE_CORE . 'db_models' . DS); |
|
147 | + define('EE_HELPERS', EE_CORE . 'helpers' . DS); |
|
148 | + define('EE_LIBRARIES', EE_CORE . 'libraries' . DS); |
|
149 | + define('EE_TEMPLATES', EE_CORE . 'templates' . DS); |
|
150 | + define('EE_THIRD_PARTY', EE_CORE . 'third_party_libs' . DS); |
|
151 | + define('EE_GLOBAL_ASSETS', EE_TEMPLATES . 'global_assets' . DS); |
|
152 | + define('EE_FORM_SECTIONS', EE_LIBRARIES . 'form_sections' . DS); |
|
153 | + // gateways |
|
154 | + define('EE_GATEWAYS', EE_MODULES . 'gateways' . DS); |
|
155 | + define('EE_GATEWAYS_URL', EE_PLUGIN_DIR_URL . 'modules' . DS . 'gateways' . DS); |
|
156 | + // asset URL paths |
|
157 | + define('EE_TEMPLATES_URL', EE_PLUGIN_DIR_URL . 'core' . DS . 'templates' . DS); |
|
158 | + define('EE_GLOBAL_ASSETS_URL', EE_TEMPLATES_URL . 'global_assets' . DS); |
|
159 | + define('EE_IMAGES_URL', EE_GLOBAL_ASSETS_URL . 'images' . DS); |
|
160 | + define('EE_THIRD_PARTY_URL', EE_PLUGIN_DIR_URL . 'core' . DS . 'third_party_libs' . DS); |
|
161 | + define('EE_HELPERS_ASSETS', EE_PLUGIN_DIR_URL . 'core/helpers/assets/'); |
|
162 | + define('EE_LIBRARIES_URL', EE_PLUGIN_DIR_URL . 'core/libraries/'); |
|
163 | + // define upload paths |
|
164 | + $uploads = wp_upload_dir(); |
|
165 | + // define the uploads directory and URL |
|
166 | + define('EVENT_ESPRESSO_UPLOAD_DIR', $uploads['basedir'] . DS . 'espresso' . DS); |
|
167 | + define('EVENT_ESPRESSO_UPLOAD_URL', $uploads['baseurl'] . DS . 'espresso' . DS); |
|
168 | + // define the templates directory and URL |
|
169 | + define('EVENT_ESPRESSO_TEMPLATE_DIR', $uploads['basedir'] . DS . 'espresso' . DS . 'templates' . DS); |
|
170 | + define('EVENT_ESPRESSO_TEMPLATE_URL', $uploads['baseurl'] . DS . 'espresso' . DS . 'templates' . DS); |
|
171 | + // define the gateway directory and URL |
|
172 | + define('EVENT_ESPRESSO_GATEWAY_DIR', $uploads['basedir'] . DS . 'espresso' . DS . 'gateways' . DS); |
|
173 | + define('EVENT_ESPRESSO_GATEWAY_URL', $uploads['baseurl'] . DS . 'espresso' . DS . 'gateways' . DS); |
|
174 | + // languages folder/path |
|
175 | + define('EE_LANGUAGES_SAFE_LOC', '..' . DS . 'uploads' . DS . 'espresso' . DS . 'languages' . DS); |
|
176 | + define('EE_LANGUAGES_SAFE_DIR', EVENT_ESPRESSO_UPLOAD_DIR . 'languages' . DS); |
|
177 | + //check for dompdf fonts in uploads |
|
178 | + if (file_exists(EVENT_ESPRESSO_UPLOAD_DIR . 'fonts' . DS)) { |
|
179 | + define('DOMPDF_FONT_DIR', EVENT_ESPRESSO_UPLOAD_DIR . 'fonts' . DS); |
|
180 | + } |
|
181 | + //ajax constants |
|
182 | + define( |
|
183 | + 'EE_FRONT_AJAX', |
|
184 | + isset($_REQUEST['ee_front_ajax']) || isset($_REQUEST['data']['ee_front_ajax']) ? true : false |
|
185 | + ); |
|
186 | + define( |
|
187 | + 'EE_ADMIN_AJAX', |
|
188 | + isset($_REQUEST['ee_admin_ajax']) || isset($_REQUEST['data']['ee_admin_ajax']) ? true : false |
|
189 | + ); |
|
190 | + //just a handy constant occasionally needed for finding values representing infinity in the DB |
|
191 | + //you're better to use this than its straight value (currently -1) in case you ever |
|
192 | + //want to change its default value! or find when -1 means infinity |
|
193 | + define('EE_INF_IN_DB', -1); |
|
194 | + define('EE_INF', INF > (float)PHP_INT_MAX ? INF : PHP_INT_MAX); |
|
195 | + define('EE_DEBUG', false); |
|
196 | + // for older WP versions |
|
197 | + if ( ! defined('MONTH_IN_SECONDS')) { |
|
198 | + define('MONTH_IN_SECONDS', DAY_IN_SECONDS * 30); |
|
199 | + } |
|
200 | + /** |
|
201 | + * espresso_plugin_activation |
|
202 | + * adds a wp-option to indicate that EE has been activated via the WP admin plugins page |
|
203 | + */ |
|
204 | + function espresso_plugin_activation() |
|
205 | + { |
|
206 | + update_option('ee_espresso_activation', true); |
|
207 | + } |
|
208 | 208 | |
209 | - register_activation_hook(EVENT_ESPRESSO_MAIN_FILE, 'espresso_plugin_activation'); |
|
210 | - /** |
|
211 | - * espresso_load_error_handling |
|
212 | - * this function loads EE's class for handling exceptions and errors |
|
213 | - */ |
|
214 | - function espresso_load_error_handling() |
|
215 | - { |
|
216 | - // load debugging tools |
|
217 | - if (WP_DEBUG === true && is_readable(EE_HELPERS . 'EEH_Debug_Tools.helper.php')) { |
|
218 | - require_once(EE_HELPERS . 'EEH_Debug_Tools.helper.php'); |
|
219 | - EEH_Debug_Tools::instance(); |
|
220 | - } |
|
221 | - // load error handling |
|
222 | - if (is_readable(EE_CORE . 'EE_Error.core.php')) { |
|
223 | - require_once(EE_CORE . 'EE_Error.core.php'); |
|
224 | - } else { |
|
225 | - wp_die(esc_html__('The EE_Error core class could not be loaded.', 'event_espresso')); |
|
226 | - } |
|
227 | - } |
|
209 | + register_activation_hook(EVENT_ESPRESSO_MAIN_FILE, 'espresso_plugin_activation'); |
|
210 | + /** |
|
211 | + * espresso_load_error_handling |
|
212 | + * this function loads EE's class for handling exceptions and errors |
|
213 | + */ |
|
214 | + function espresso_load_error_handling() |
|
215 | + { |
|
216 | + // load debugging tools |
|
217 | + if (WP_DEBUG === true && is_readable(EE_HELPERS . 'EEH_Debug_Tools.helper.php')) { |
|
218 | + require_once(EE_HELPERS . 'EEH_Debug_Tools.helper.php'); |
|
219 | + EEH_Debug_Tools::instance(); |
|
220 | + } |
|
221 | + // load error handling |
|
222 | + if (is_readable(EE_CORE . 'EE_Error.core.php')) { |
|
223 | + require_once(EE_CORE . 'EE_Error.core.php'); |
|
224 | + } else { |
|
225 | + wp_die(esc_html__('The EE_Error core class could not be loaded.', 'event_espresso')); |
|
226 | + } |
|
227 | + } |
|
228 | 228 | |
229 | - /** |
|
230 | - * espresso_load_required |
|
231 | - * given a class name and path, this function will load that file or throw an exception |
|
232 | - * |
|
233 | - * @param string $classname |
|
234 | - * @param string $full_path_to_file |
|
235 | - * @throws EE_Error |
|
236 | - */ |
|
237 | - function espresso_load_required($classname, $full_path_to_file) |
|
238 | - { |
|
239 | - static $error_handling_loaded = false; |
|
240 | - if ( ! $error_handling_loaded) { |
|
241 | - espresso_load_error_handling(); |
|
242 | - $error_handling_loaded = true; |
|
243 | - } |
|
244 | - if (is_readable($full_path_to_file)) { |
|
245 | - require_once($full_path_to_file); |
|
246 | - } else { |
|
247 | - throw new EE_Error ( |
|
248 | - sprintf( |
|
249 | - esc_html__( |
|
250 | - 'The %s class file could not be located or is not readable due to file permissions.', |
|
251 | - 'event_espresso' |
|
252 | - ), |
|
253 | - $classname |
|
254 | - ) |
|
255 | - ); |
|
256 | - } |
|
257 | - } |
|
229 | + /** |
|
230 | + * espresso_load_required |
|
231 | + * given a class name and path, this function will load that file or throw an exception |
|
232 | + * |
|
233 | + * @param string $classname |
|
234 | + * @param string $full_path_to_file |
|
235 | + * @throws EE_Error |
|
236 | + */ |
|
237 | + function espresso_load_required($classname, $full_path_to_file) |
|
238 | + { |
|
239 | + static $error_handling_loaded = false; |
|
240 | + if ( ! $error_handling_loaded) { |
|
241 | + espresso_load_error_handling(); |
|
242 | + $error_handling_loaded = true; |
|
243 | + } |
|
244 | + if (is_readable($full_path_to_file)) { |
|
245 | + require_once($full_path_to_file); |
|
246 | + } else { |
|
247 | + throw new EE_Error ( |
|
248 | + sprintf( |
|
249 | + esc_html__( |
|
250 | + 'The %s class file could not be located or is not readable due to file permissions.', |
|
251 | + 'event_espresso' |
|
252 | + ), |
|
253 | + $classname |
|
254 | + ) |
|
255 | + ); |
|
256 | + } |
|
257 | + } |
|
258 | 258 | |
259 | - espresso_load_required('EEH_Base', EE_CORE . 'helpers' . DS . 'EEH_Base.helper.php'); |
|
260 | - espresso_load_required('EEH_File', EE_CORE . 'helpers' . DS . 'EEH_File.helper.php'); |
|
261 | - espresso_load_required('EE_Bootstrap', EE_CORE . 'EE_Bootstrap.core.php'); |
|
262 | - new EE_Bootstrap(); |
|
263 | - } |
|
259 | + espresso_load_required('EEH_Base', EE_CORE . 'helpers' . DS . 'EEH_Base.helper.php'); |
|
260 | + espresso_load_required('EEH_File', EE_CORE . 'helpers' . DS . 'EEH_File.helper.php'); |
|
261 | + espresso_load_required('EE_Bootstrap', EE_CORE . 'EE_Bootstrap.core.php'); |
|
262 | + new EE_Bootstrap(); |
|
263 | + } |
|
264 | 264 | } |
265 | 265 | if ( ! function_exists('espresso_deactivate_plugin')) { |
266 | - /** |
|
267 | - * deactivate_plugin |
|
268 | - * usage: espresso_deactivate_plugin( plugin_basename( __FILE__ )); |
|
269 | - * |
|
270 | - * @access public |
|
271 | - * @param string $plugin_basename - the results of plugin_basename( __FILE__ ) for the plugin's main file |
|
272 | - * @return void |
|
273 | - */ |
|
274 | - function espresso_deactivate_plugin($plugin_basename = '') |
|
275 | - { |
|
276 | - if ( ! function_exists('deactivate_plugins')) { |
|
277 | - require_once(ABSPATH . 'wp-admin/includes/plugin.php'); |
|
278 | - } |
|
279 | - unset($_GET['activate'], $_REQUEST['activate']); |
|
280 | - deactivate_plugins($plugin_basename); |
|
281 | - } |
|
266 | + /** |
|
267 | + * deactivate_plugin |
|
268 | + * usage: espresso_deactivate_plugin( plugin_basename( __FILE__ )); |
|
269 | + * |
|
270 | + * @access public |
|
271 | + * @param string $plugin_basename - the results of plugin_basename( __FILE__ ) for the plugin's main file |
|
272 | + * @return void |
|
273 | + */ |
|
274 | + function espresso_deactivate_plugin($plugin_basename = '') |
|
275 | + { |
|
276 | + if ( ! function_exists('deactivate_plugins')) { |
|
277 | + require_once(ABSPATH . 'wp-admin/includes/plugin.php'); |
|
278 | + } |
|
279 | + unset($_GET['activate'], $_REQUEST['activate']); |
|
280 | + deactivate_plugins($plugin_basename); |
|
281 | + } |
|
282 | 282 | } |
283 | 283 | \ No newline at end of file |