@@ -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,75 +52,75 @@ 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 | - <tr id="txn-admin-payment-tr-<?php echo $PAY_ID;?>"> |
|
70 | + <?php foreach ($payments as $PAY_ID => $payment) : ?> |
|
71 | + <tr id="txn-admin-payment-tr-<?php echo $PAY_ID; ?>"> |
|
72 | 72 | <td> |
73 | 73 | <span id="payment-status-<?php echo $PAY_ID; ?>" class="ee-status-strip-td ee-status-strip pymt-status-<?php echo $payment->STS_ID(); ?>"></span> |
74 | - <div id="payment-STS_ID-<?php echo $PAY_ID;?>" class="hidden"><?php echo $payment->STS_ID();?></div> |
|
75 | - <div id="reg-payments-<?php echo $PAY_ID;?>" class="hidden"><?php echo json_encode( $existing_reg_payments[ $PAY_ID ] );?></div> |
|
74 | + <div id="payment-STS_ID-<?php echo $PAY_ID; ?>" class="hidden"><?php echo $payment->STS_ID(); ?></div> |
|
75 | + <div id="reg-payments-<?php echo $PAY_ID; ?>" class="hidden"><?php echo json_encode($existing_reg_payments[$PAY_ID]); ?></div> |
|
76 | 76 | </td> |
77 | 77 | <td class=" jst-cntr"> |
78 | 78 | <ul class="txn-overview-actions-ul"> |
79 | 79 | <li> |
80 | - <a class="txn-admin-payment-action-edit-lnk" title="<?php esc_attr_e( 'Edit Payment', 'event_espresso' );?>" data-payment-id="<?php echo $PAY_ID;?>"> |
|
80 | + <a class="txn-admin-payment-action-edit-lnk" title="<?php esc_attr_e('Edit Payment', 'event_espresso'); ?>" data-payment-id="<?php echo $PAY_ID; ?>"> |
|
81 | 81 | <div class="dashicons dashicons-edit" style="margin: 0;"></div> |
82 | 82 | </a> |
83 | 83 | </li> |
84 | 84 | <li> |
85 | - <a class="txn-admin-payment-action-delete-lnk" title="<?php esc_attr_e( 'Delete Payment', 'event_espresso' );?>" data-payment-id="<?php echo $PAY_ID;?>"> |
|
85 | + <a class="txn-admin-payment-action-delete-lnk" title="<?php esc_attr_e('Delete Payment', 'event_espresso'); ?>" data-payment-id="<?php echo $PAY_ID; ?>"> |
|
86 | 86 | <div class="dashicons dashicons-trash" style="margin: 0;"></div> |
87 | 87 | </a> |
88 | 88 | </li> |
89 | 89 | </ul> |
90 | 90 | </td> |
91 | 91 | <td class=" jst-rght"> |
92 | - <div id="payment-id-<?php echo $PAY_ID;?>"><?php echo $PAY_ID;?></div> |
|
92 | + <div id="payment-id-<?php echo $PAY_ID; ?>"><?php echo $PAY_ID; ?></div> |
|
93 | 93 | </td> |
94 | 94 | <td class=" jst-left"> |
95 | - <div id="payment-date-<?php echo $PAY_ID;?>" class="payment-date-dv"><?php echo $payment->timestamp('Y-m-d', 'g:i a');?></div> |
|
95 | + <div id="payment-date-<?php echo $PAY_ID; ?>" class="payment-date-dv"><?php echo $payment->timestamp('Y-m-d', 'g:i a'); ?></div> |
|
96 | 96 | </td> |
97 | 97 | <td class=" jst-cntr"> |
98 | - <div id="payment-method-<?php echo $PAY_ID;?>"> |
|
99 | - <?php echo $payment->source();?> |
|
98 | + <div id="payment-method-<?php echo $PAY_ID; ?>"> |
|
99 | + <?php echo $payment->source(); ?> |
|
100 | 100 | </div> |
101 | 101 | </td> |
102 | 102 | <td class=" jst-left"> |
103 | - <div id="payment-gateway-<?php echo $PAY_ID;?>"> |
|
104 | - <?php echo $payment->payment_method() ? $payment->payment_method()->admin_name() : __("Unknown", 'event_espresso');?> |
|
103 | + <div id="payment-gateway-<?php echo $PAY_ID; ?>"> |
|
104 | + <?php echo $payment->payment_method() ? $payment->payment_method()->admin_name() : __("Unknown", 'event_espresso'); ?> |
|
105 | 105 | </div> |
106 | - <div id="payment-gateway-id-<?php echo $PAY_ID;?>" class="hidden"><?php echo $payment->payment_method() ? $payment->payment_method()->ID() : 0;?></div> |
|
106 | + <div id="payment-gateway-id-<?php echo $PAY_ID; ?>" class="hidden"><?php echo $payment->payment_method() ? $payment->payment_method()->ID() : 0; ?></div> |
|
107 | 107 | </td> |
108 | 108 | <td class=" jst-left"> |
109 | - <div id="payment-response-<?php echo $PAY_ID;?>"><?php echo $payment->gateway_response();?></div> |
|
109 | + <div id="payment-response-<?php echo $PAY_ID; ?>"><?php echo $payment->gateway_response(); ?></div> |
|
110 | 110 | </td> |
111 | 111 | <td class=" jst-left"> |
112 | - <div id="payment-txn-id-chq-nmbr-<?php echo $PAY_ID;?>"><?php echo $payment->txn_id_chq_nmbr();?></div> |
|
112 | + <div id="payment-txn-id-chq-nmbr-<?php echo $PAY_ID; ?>"><?php echo $payment->txn_id_chq_nmbr(); ?></div> |
|
113 | 113 | </td> |
114 | 114 | <td class=" jst-left"> |
115 | - <div id="payment-po-nmbr-<?php echo $PAY_ID;?>"><?php echo $payment->po_number();?></div> |
|
115 | + <div id="payment-po-nmbr-<?php echo $PAY_ID; ?>"><?php echo $payment->po_number(); ?></div> |
|
116 | 116 | </td> |
117 | 117 | <td class=" jst-left"> |
118 | - <div id="payment-accntng-<?php echo $PAY_ID;?>"><?php echo $payment->extra_accntng();?></div> |
|
118 | + <div id="payment-accntng-<?php echo $PAY_ID; ?>"><?php echo $payment->extra_accntng(); ?></div> |
|
119 | 119 | </td> |
120 | 120 | <td class=" jst-rght"> |
121 | - <?php $payment_class = $payment->amount() > 0 ? 'txn-admin-payment-status-' . $payment->STS_ID() : 'txn-admin-payment-status-PDC'; ?> |
|
122 | - <span class="<?php echo $payment_class;?>"> |
|
123 | - <div id="payment-amount-<?php echo $PAY_ID;?>" style="display:inline;"><?php echo EEH_Template::format_currency($payment->amount(), FALSE, FALSE ); ?></div> |
|
121 | + <?php $payment_class = $payment->amount() > 0 ? 'txn-admin-payment-status-'.$payment->STS_ID() : 'txn-admin-payment-status-PDC'; ?> |
|
122 | + <span class="<?php echo $payment_class; ?>"> |
|
123 | + <div id="payment-amount-<?php echo $PAY_ID; ?>" style="display:inline;"><?php echo EEH_Template::format_currency($payment->amount(), FALSE, FALSE); ?></div> |
|
124 | 124 | </span> |
125 | 125 | </td> |
126 | 126 | </tr> |
@@ -130,25 +130,25 @@ discard block |
||
130 | 130 | <?php endforeach; // $payment?> |
131 | 131 | <?php |
132 | 132 | $pay_totals_class = $payment_total > $grand_raw_total ? ' important-notice' : ''; |
133 | - $overpaid = $payment_total > $grand_raw_total ? '<span id="overpaid">' . __( 'This transaction has been overpaid ! ', 'event_espresso' ) . '</span>' : ''; |
|
133 | + $overpaid = $payment_total > $grand_raw_total ? '<span id="overpaid">'.__('This transaction has been overpaid ! ', 'event_espresso').'</span>' : ''; |
|
134 | 134 | ?> |
135 | 135 | <tr id="txn-admin-no-payments-tr" class="admin-primary-mbox-total-tr hidden"> |
136 | 136 | <td class=" jst-rght" colspan="11"> |
137 | - <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> |
|
137 | + <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> |
|
138 | 138 | </td> |
139 | 139 | </tr> |
140 | - <tr id="txn-admin-payments-total-tr" class="admin-primary-mbox-total-tr<?php echo $pay_totals_class;?>"> |
|
141 | - <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> |
|
142 | - <th class=" jst-rght"><span id="txn-admin-payment-total"><?php echo EEH_Template::format_currency($payment_total, FALSE, FALSE);?></span></th> |
|
140 | + <tr id="txn-admin-payments-total-tr" class="admin-primary-mbox-total-tr<?php echo $pay_totals_class; ?>"> |
|
141 | + <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> |
|
142 | + <th class=" jst-rght"><span id="txn-admin-payment-total"><?php echo EEH_Template::format_currency($payment_total, FALSE, FALSE); ?></span></th> |
|
143 | 143 | </tr> |
144 | 144 | <?php else : ?> |
145 | 145 | <tr id="txn-admin-no-payments-tr" class="admin-primary-mbox-total-tr"> |
146 | 146 | <td class=" jst-rght" colspan="11"> |
147 | - <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> |
|
147 | + <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> |
|
148 | 148 | </td> |
149 | 149 | </tr> |
150 | 150 | <tr id="txn-admin-payments-total-tr" class="admin-primary-mbox-total-tr hidden"> |
151 | - <th class=" jst-rght" colspan="10"><span id="payments-total-spn"><?php echo __( 'Payments Total', 'event_espresso' );?></span></th> |
|
151 | + <th class=" jst-rght" colspan="10"><span id="payments-total-spn"><?php echo __('Payments Total', 'event_espresso'); ?></span></th> |
|
152 | 152 | <th class=" jst-rght"><span id="txn-admin-payment-total"></span></th> |
153 | 153 | </tr> |
154 | 154 | <?php endif; // $payments?> |
@@ -161,12 +161,12 @@ discard block |
||
161 | 161 | <td class=" jst-cntr"> |
162 | 162 | <ul class="txn-overview-actions-ul"> |
163 | 163 | <li> |
164 | - <a class="txn-admin-payment-action-edit-lnk" title="<?php esc_attr_e( 'Edit Payment', 'event_espresso' );?>" data-payment-id="PAY_ID"> |
|
164 | + <a class="txn-admin-payment-action-edit-lnk" title="<?php esc_attr_e('Edit Payment', 'event_espresso'); ?>" data-payment-id="PAY_ID"> |
|
165 | 165 | <div class="dashicons dashicons-edit" style="margin: 0;"></div> |
166 | 166 | </a> |
167 | 167 | </li> |
168 | 168 | <li> |
169 | - <a class="txn-admin-payment-action-delete-lnk" title="<?php esc_attr_e( 'Delete Payment', 'event_espresso' );?>" data-payment-id="PAY_ID"> |
|
169 | + <a class="txn-admin-payment-action-delete-lnk" title="<?php esc_attr_e('Delete Payment', 'event_espresso'); ?>" data-payment-id="PAY_ID"> |
|
170 | 170 | <div class="dashicons dashicons-trash" style="margin: 0;"></div> |
171 | 171 | </a> |
172 | 172 | </li> |
@@ -213,12 +213,12 @@ discard block |
||
213 | 213 | <ul id="txn-admin-payment-options-ul"> |
214 | 214 | <li> |
215 | 215 | <a id="display-txn-admin-apply-payment" class="button-primary no-icon no-hide" rel="txn-admin-apply-payment" > <!--display-the-hidden --> |
216 | - <?php _e( 'Apply Payment', 'event_espresso' );?> |
|
216 | + <?php _e('Apply Payment', 'event_espresso'); ?> |
|
217 | 217 | </a> |
218 | 218 | </li> |
219 | 219 | <li> |
220 | 220 | <a id="display-txn-admin-apply-refund" class="button-secondary no-icon no-hide" rel="txn-admin-apply-refund" > <!--display-the-hidden --> |
221 | - <?php _e( 'Apply Refund', 'event_espresso' );?> |
|
221 | + <?php _e('Apply Refund', 'event_espresso'); ?> |
|
222 | 222 | </a> |
223 | 223 | </li> |
224 | 224 | </ul> |
@@ -228,14 +228,14 @@ discard block |
||
228 | 228 | |
229 | 229 | <h2 id="admin-modal-dialog-apply-payment-h2" class="admin-modal-dialog-h2 hdr-has-icon" style="display:none;"> |
230 | 230 | <div class="ee-icon ee-icon-cash-add float-left"></div> |
231 | - <?php echo __( 'Apply a Payment to Transaction #', 'event_espresso' ) . $txn_nmbr['value'];?> |
|
231 | + <?php echo __('Apply a Payment to Transaction #', 'event_espresso').$txn_nmbr['value']; ?> |
|
232 | 232 | </h2> |
233 | 233 | |
234 | 234 | <h2 id="admin-modal-dialog-edit-payment-h2" class="admin-modal-dialog-h2 hdr-has-icon" style="display:none;"> |
235 | 235 | <div class="ee-icon ee-icon-cash-edit float-left"></div> |
236 | 236 | <?php |
237 | 237 | echo sprintf( |
238 | - __( 'Edit Payment #%s for Transaction #%s', 'event_espresso' ), |
|
238 | + __('Edit Payment #%s for Transaction #%s', 'event_espresso'), |
|
239 | 239 | '<span></span>', |
240 | 240 | $txn_nmbr['value'] |
241 | 241 | ); |
@@ -246,7 +246,7 @@ discard block |
||
246 | 246 | <div class="ee-icon ee-icon-cash-edit float-left"></div> |
247 | 247 | <?php |
248 | 248 | echo sprintf( |
249 | - __( 'Edit Refund #%s for Transaction #%s', 'event_espresso' ), |
|
249 | + __('Edit Refund #%s for Transaction #%s', 'event_espresso'), |
|
250 | 250 | '<span></span>', |
251 | 251 | $txn_nmbr['value'] |
252 | 252 | ); |
@@ -255,14 +255,14 @@ discard block |
||
255 | 255 | |
256 | 256 | <h2 id="admin-modal-dialog-apply-refund-h2" class="admin-modal-dialog-h2 hdr-has-icon" style="display:none;"> |
257 | 257 | <div class="ee-icon ee-icon-cash-remove float-left"></div> |
258 | - <?php echo __( 'Apply a Refund to Transaction #', 'event_espresso' ) . $txn_nmbr['value'];?> |
|
258 | + <?php echo __('Apply a Refund to Transaction #', 'event_espresso').$txn_nmbr['value']; ?> |
|
259 | 259 | </h2> |
260 | 260 | |
261 | 261 | <form name="txn-admin-apply-payment-frm" id="txn-admin-apply-payment-frm" action="<?php echo $apply_payment_form_url; ?>"> |
262 | 262 | <div class="admin-modal-dialog-wrap"> |
263 | 263 | <div class="admin-modal-dialog-inner"> |
264 | 264 | |
265 | - <input type="hidden" name="espresso_apply_payment_nonce" id="espresso_apply_payment_nonce" value="<?php echo wp_create_nonce( 'espresso_apply_payment_nonce' );?>"/> |
|
265 | + <input type="hidden" name="espresso_apply_payment_nonce" id="espresso_apply_payment_nonce" value="<?php echo wp_create_nonce('espresso_apply_payment_nonce'); ?>"/> |
|
266 | 266 | <input type="hidden" name="espresso_ajax" id="espresso-ajax" value="0"/> |
267 | 267 | <input type="hidden" name="noheader" id="txn-admin-noheader-inp" value="0"/> |
268 | 268 | <input type="hidden" name="txn_admin_payment[PAY_ID]" id="txn-admin-payment-payment-id-inp" class="txn-admin-apply-payment-inp" value="0"/> |
@@ -270,108 +270,108 @@ discard block |
||
270 | 270 | <input type="hidden" name="txn_admin_payment[type]" id="txn-admin-payment-type-inp" value="1"/> |
271 | 271 | <input type="hidden" name="txn_admin_payment[details]" id="txn-admin-payment-details-inp" value=""/> |
272 | 272 | <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; ?>"/> |
273 | - <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' )); ?>"/> |
|
273 | + <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')); ?>"/> |
|
274 | 274 | |
275 | 275 | <div class="txn-admin-apply-payment-date-dv admin-modal-dialog-row"> |
276 | - <div class="validation-notice-dv"><?php _e( 'The following is a required field', 'event_espresso' );?></div> |
|
277 | - <label for="txn-admin-payment-date-inp" class=""><?php _e( 'Payment Date', 'event_espresso' );?></label> |
|
278 | - <input name="[date]txn_admin_payment" 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' )); ?>"/> |
|
279 | - <p class="description"><?php _e( 'The date the payment was actually made on', 'event_espresso' );?></p> |
|
276 | + <div class="validation-notice-dv"><?php _e('The following is a required field', 'event_espresso'); ?></div> |
|
277 | + <label for="txn-admin-payment-date-inp" class=""><?php _e('Payment Date', 'event_espresso'); ?></label> |
|
278 | + <input name="[date]txn_admin_payment" 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')); ?>"/> |
|
279 | + <p class="description"><?php _e('The date the payment was actually made on', 'event_espresso'); ?></p> |
|
280 | 280 | </div> |
281 | 281 | |
282 | 282 | <div class="txn-admin-apply-payment-amount-dv admin-modal-dialog-row"> |
283 | - <div class="validation-notice-dv"><?php _e( 'The following is a required field', 'event_espresso' );?></div> |
|
284 | - <label for="txn-admin-payment-amount-inp" class=""><?php _e( 'Amount', 'event_espresso' );?></label> |
|
283 | + <div class="validation-notice-dv"><?php _e('The following is a required field', 'event_espresso'); ?></div> |
|
284 | + <label for="txn-admin-payment-amount-inp" class=""><?php _e('Amount', 'event_espresso'); ?></label> |
|
285 | 285 | <input name="txn_admin_payment[amount]" id="txn-admin-payment-amount-inp" class="txn-admin-apply-payment-inp required" type="text" value=""/> |
286 | - <p class="description"><?php _e( 'The amount of the payment', 'event_espresso' );?></p> |
|
286 | + <p class="description"><?php _e('The amount of the payment', 'event_espresso'); ?></p> |
|
287 | 287 | </div> |
288 | 288 | |
289 | 289 | <div class="txn-admin-apply-payment-method-dv admin-modal-dialog-row"> |
290 | - <div class="validation-notice-dv"><?php _e( 'The following is a required field', 'event_espresso' );?></div> |
|
291 | - <label for="txn-admin-payment-method-inp" class=""><?php _e( 'Method of Payment', 'event_espresso' );?></label> |
|
290 | + <div class="validation-notice-dv"><?php _e('The following is a required field', 'event_espresso'); ?></div> |
|
291 | + <label for="txn-admin-payment-method-inp" class=""><?php _e('Method of Payment', 'event_espresso'); ?></label> |
|
292 | 292 | <select name="txn_admin_payment[PMD_ID]" id="txn-admin-payment-method-slct" class="txn-admin-apply-payment-slct required" type="text" > |
293 | - <?php foreach ( $payment_methods as $method ) : ?> |
|
293 | + <?php foreach ($payment_methods as $method) : ?> |
|
294 | 294 | <?php $selected = $method->slug() == 'cash' ? ' selected="selected"' : ''; ?> |
295 | - <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> |
|
295 | + <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> |
|
296 | 296 | <?php endforeach; ?> |
297 | 297 | </select> |
298 | - <p class="description"><?php _e( 'Whether the payment was made via PayPal, Credit Card, Cheque, or Cash', 'event_espresso' );?></p> |
|
298 | + <p class="description"><?php _e('Whether the payment was made via PayPal, Credit Card, Cheque, or Cash', 'event_espresso'); ?></p> |
|
299 | 299 | </div> |
300 | 300 | |
301 | 301 | <div class="mop-PP mop-CC mop-CHQ mop"> |
302 | 302 | <div class="txn-admin-apply-payment-gw-txn-id-dv admin-modal-dialog-row"> |
303 | - <label for="txn-admin-payment-txn-id-inp" class=""><?php _e( 'TXN ID / CHQ #', 'event_espresso' );?></label> |
|
303 | + <label for="txn-admin-payment-txn-id-inp" class=""><?php _e('TXN ID / CHQ #', 'event_espresso'); ?></label> |
|
304 | 304 | <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"/> |
305 | - <p class="description"><?php _e( 'The Transaction ID sent back from the payment gateway, or the Cheque #', 'event_espresso' );?></p> |
|
305 | + <p class="description"><?php _e('The Transaction ID sent back from the payment gateway, or the Cheque #', 'event_espresso'); ?></p> |
|
306 | 306 | </div> |
307 | 307 | </div> |
308 | 308 | |
309 | 309 | <div class="mop-CC mop" style="display:none"> |
310 | 310 | <div class="txn-admin-apply-payment-response-dv admin-modal-dialog-row"> |
311 | - <label for="txn-admin-payment-gateway-response-inp" class=""><?php _e( 'Gateway Response', 'event_espresso' );?></label> |
|
311 | + <label for="txn-admin-payment-gateway-response-inp" class=""><?php _e('Gateway Response', 'event_espresso'); ?></label> |
|
312 | 312 | <input name="txn_admin_payment[gateway_response]" id="txn-admin-payment-gateway-response-inp" class="txn-admin-apply-payment-inp" type="text"/> |
313 | - <p class="description"><?php _e( 'The gateway response string (optional)', 'event_espresso' );?></p> |
|
313 | + <p class="description"><?php _e('The gateway response string (optional)', 'event_espresso'); ?></p> |
|
314 | 314 | </div> |
315 | 315 | </div> |
316 | 316 | |
317 | 317 | <div class="mop-PP mop-CC mop"> |
318 | 318 | <div class="txn-admin-apply-payment-status-dv admin-modal-dialog-row"> |
319 | - <label for="txn-admin-payment-status-inp" class=""><?php _e( 'Payment Status', 'event_espresso' );?></label> |
|
319 | + <label for="txn-admin-payment-status-inp" class=""><?php _e('Payment Status', 'event_espresso'); ?></label> |
|
320 | 320 | <select name="txn_admin_payment[status]" id="txn-admin-payment-status-slct" class="txn-admin-apply-payment-slct" type="text" > |
321 | - <?php foreach ( $payment_status as $STS_ID => $STS_code ) : ?> |
|
321 | + <?php foreach ($payment_status as $STS_ID => $STS_code) : ?> |
|
322 | 322 | <?php $selected = $STS_ID == 'PAP' ? ' selected="selected"' : ''; ?> |
323 | 323 | <option id="payment-status-opt-<?php echo $STS_ID; ?>" value="<?php echo $STS_ID; ?>"<?php echo $selected; ?>><?php echo $STS_code; ?> </option> |
324 | 324 | <?php endforeach; ?> |
325 | 325 | </select> |
326 | - <p class="description"><?php _e( 'Whether the payment was approved, cancelled, declined or failed after submission to the gateway', 'event_espresso' );?></p> |
|
326 | + <p class="description"><?php _e('Whether the payment was approved, cancelled, declined or failed after submission to the gateway', 'event_espresso'); ?></p> |
|
327 | 327 | </div> |
328 | 328 | </div> |
329 | 329 | |
330 | 330 | <div class="txn-admin-apply-payment-po-nmbr-dv admin-modal-dialog-row"> |
331 | - <label for="txn-admin-payment-po-nmbr-inp" class=""><?php _e( 'P.O. / S.O. #', 'event_espresso' );?></label> |
|
331 | + <label for="txn-admin-payment-po-nmbr-inp" class=""><?php _e('P.O. / S.O. #', 'event_espresso'); ?></label> |
|
332 | 332 | <input name="txn_admin_payment[po_number]" id="txn-admin-payment-po-nmbr-inp" class="txn-admin-apply-payment-inp" type="text" maxlength="100"/> |
333 | - <p class="description"><?php _e( 'The Purchase or Sales Order Number if any (optional)', 'event_espresso' );?></p> |
|
333 | + <p class="description"><?php _e('The Purchase or Sales Order Number if any (optional)', 'event_espresso'); ?></p> |
|
334 | 334 | </div> |
335 | 335 | |
336 | 336 | <div class="txn-admin-apply-payment-accounting-dv admin-modal-dialog-row"> |
337 | - <label for="txn-admin-payment-accounting-inp" class="last"><?php _e( 'Notes / Extra Accounting', 'event_espresso' );?></label> |
|
337 | + <label for="txn-admin-payment-accounting-inp" class="last"><?php _e('Notes / Extra Accounting', 'event_espresso'); ?></label> |
|
338 | 338 | <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; ?>"/> |
339 | - <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> |
|
339 | + <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> |
|
340 | 340 | </div> |
341 | 341 | |
342 | 342 | <div class="txn-admin-apply-payment-registrations-dv admin-modal-dialog-row"> |
343 | - <label for="txn-admin-payment-registrations-inp" class="last"><?php _e( 'Registrations to Apply Payment to:', 'event_espresso' ); ?></label> |
|
343 | + <label for="txn-admin-payment-registrations-inp" class="last"><?php _e('Registrations to Apply Payment to:', 'event_espresso'); ?></label> |
|
344 | 344 | <label class="txn-admin-apply-payment-to-registrations-lbl"> |
345 | 345 | <input type="radio" value="1" id="txn-admin-apply-payment-to-all-registrations-inp" name="txn_admin_payment[apply_to_all_registrations]" checked="checked"/> |
346 | - <?php _e( 'ALL Registrations', 'event_espresso' ); ?> |
|
346 | + <?php _e('ALL Registrations', 'event_espresso'); ?> |
|
347 | 347 | </label> |
348 | 348 | <label class="txn-admin-apply-payment-to-registrations-lbl"> |
349 | 349 | <input type="radio" value="0" id="txn-admin-apply-payment-to-some-registrations-inp" name="txn_admin_payment[apply_to_all_registrations]" /> |
350 | - <?php _e( 'Just the following Registrations', 'event_espresso' ); ?> |
|
350 | + <?php _e('Just the following Registrations', 'event_espresso'); ?> |
|
351 | 351 | </label> |
352 | 352 | <?php echo $registrations_to_apply_payment_to; ?> |
353 | 353 | </div> |
354 | 354 | |
355 | 355 | <div class="txn-admin-payment-reg-status-dv admin-modal-dialog-row"> |
356 | - <label for="txn-admin-payment-reg-status-inp" class="last"><?php _e( 'Change Registration Status?', 'event_espresso' );?></label> |
|
356 | + <label for="txn-admin-payment-reg-status-inp" class="last"><?php _e('Change Registration Status?', 'event_espresso'); ?></label> |
|
357 | 357 | <?php echo $status_change_select; ?> |
358 | - <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> |
|
358 | + <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> |
|
359 | 359 | <br/> |
360 | 360 | </div> |
361 | 361 | |
362 | 362 | <div class="txn-admin-apply-payment-send-notifications-dv admin-modal-dialog-row"> |
363 | 363 | |
364 | - <label for="txn-admin-payment-send-notifications-inp" class="last"><?php _e( 'Send Related Messages?', 'event_espresso' );?></label> |
|
364 | + <label for="txn-admin-payment-send-notifications-inp" class="last"><?php _e('Send Related Messages?', 'event_espresso'); ?></label> |
|
365 | 365 | <label class="txn-admin-payment-send-notifications-lbl"> |
366 | 366 | <input type="checkbox" value="1" name="txn_payments[send_notifications]" checked="checked" aria-checked="true" style="vertical-align: middle;"> |
367 | - <?php _e( 'Payment Messages?', 'event_espresso' ); ?> |
|
367 | + <?php _e('Payment Messages?', 'event_espresso'); ?> |
|
368 | 368 | </label> |
369 | 369 | <label class="txn-admin-payment-send-notifications-lbl"> |
370 | 370 | <input type="checkbox" value="1" name="txn_reg_status_change[send_notifications]" style="vertical-align: middle;"> |
371 | - <?php _e( 'Registration Messages?', 'event_espresso' ); ?> |
|
371 | + <?php _e('Registration Messages?', 'event_espresso'); ?> |
|
372 | 372 | </label> |
373 | 373 | <br class="clear-float"/> |
374 | - <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> |
|
374 | + <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> |
|
375 | 375 | <label></label> |
376 | 376 | </div> |
377 | 377 | <div class="clear"></div> |
@@ -382,27 +382,27 @@ discard block |
||
382 | 382 | <ul id="admin-modal-dialog-options-ul"> |
383 | 383 | <li> |
384 | 384 | <a id="txn-admin-modal-dialog-apply-payment-lnk" class="button-primary no-icon" style="display:none;" > |
385 | - <?php _e( 'Apply Payment', 'event_espresso' );?> |
|
385 | + <?php _e('Apply Payment', 'event_espresso'); ?> |
|
386 | 386 | </a> |
387 | 387 | </li> |
388 | 388 | <li> |
389 | 389 | <a id="txn-admin-modal-dialog-edit-payment-lnk" class="button-primary no-icon" style="display:none;" > |
390 | - <?php _e( 'Save Payment Details', 'event_espresso' );?> |
|
390 | + <?php _e('Save Payment Details', 'event_espresso'); ?> |
|
391 | 391 | </a> |
392 | 392 | </li> |
393 | 393 | <li> |
394 | 394 | <a id="txn-admin-modal-dialog-edit-refund-lnk" class="button-primary no-icon" style="display:none;" > |
395 | - <?php _e( 'Save Refund Details', 'event_espresso' );?> |
|
395 | + <?php _e('Save Refund Details', 'event_espresso'); ?> |
|
396 | 396 | </a> |
397 | 397 | </li> |
398 | 398 | <li> |
399 | 399 | <a id="txn-admin-modal-dialog-apply-refund-lnk" class="button-primary no-icon" style="display:none;" > |
400 | - <?php _e( 'Apply Refund', 'event_espresso' );?> |
|
400 | + <?php _e('Apply Refund', 'event_espresso'); ?> |
|
401 | 401 | </a> |
402 | 402 | </li> |
403 | 403 | <li> |
404 | 404 | <a id="txn-admin-modal-dialog-cancel-lnk" class="button-secondary no-icon" > |
405 | - <?php _e( 'Cancel', 'event_espresso' );?> |
|
405 | + <?php _e('Cancel', 'event_espresso'); ?> |
|
406 | 406 | </a> |
407 | 407 | </li> |
408 | 408 | <li> |
@@ -419,29 +419,29 @@ discard block |
||
419 | 419 | |
420 | 420 | <h2 id="admin-modal-dialog-delete-payment-h2" class="admin-modal-dialog-h2 hdr-has-icon" style="display:none;"> |
421 | 421 | <span class="ee-icon ee-icon-cash-add"></span> |
422 | - <?php echo __( 'Delete Payment/Refund for Transaction #', 'event_espresso' ) . $txn_nmbr['value'];?> |
|
422 | + <?php echo __('Delete Payment/Refund for Transaction #', 'event_espresso').$txn_nmbr['value']; ?> |
|
423 | 423 | </h2> |
424 | 424 | |
425 | 425 | <form name="txn-admin-delete-payment-frm" id="txn-admin-delete-payment-frm" action="<?php echo $delete_payment_url; ?>"> |
426 | 426 | <div class="admin-modal-dialog-wrap"> |
427 | 427 | <div class="admin-modal-dialog-inner"> |
428 | 428 | |
429 | - <input type="hidden" name="espresso_delete_payment_nonce" id="espresso_delete_payment_nonce" value="<?php echo wp_create_nonce( 'espresso_delete_payment_nonce' );?>"/> |
|
429 | + <input type="hidden" name="espresso_delete_payment_nonce" id="espresso_delete_payment_nonce" value="<?php echo wp_create_nonce('espresso_delete_payment_nonce'); ?>"/> |
|
430 | 430 | <input type="hidden" name="delete_espresso_ajax" id="delete-espresso-ajax" value="0"/> |
431 | 431 | <input type="hidden" name="delete_noheader" id="delete-txn-admin-noheader-inp" value="0"/> |
432 | 432 | <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"/> |
433 | 433 | <input type="hidden" name="delete_txn_admin_payment[TXN_ID]" id="delete-txn-admin-payment-txn-id-inp" value="<?php echo $txn_nmbr['value']; ?>"/> |
434 | 434 | |
435 | 435 | <div class="txn-admin-apply-payment-accounting-dv admin-modal-dialog-row"> |
436 | - <label for="delete-txn-admin-payment-reg-status-inp" class="last"><?php _e( 'Change Registration Status?', 'event_espresso' );?></label> |
|
436 | + <label for="delete-txn-admin-payment-reg-status-inp" class="last"><?php _e('Change Registration Status?', 'event_espresso'); ?></label> |
|
437 | 437 | <?php echo $delete_status_change_select; ?> |
438 | - <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> |
|
438 | + <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> |
|
439 | 439 | </div> |
440 | 440 | |
441 | 441 | <div class="ee-attention txn-admin-apply-payment-accounting-dv admin-modal-dialog-row"> |
442 | - <label for="delete-txn-admin-payment-accounting-inp" class="last"><?php _e( 'Send Related Messages?', 'event_espresso' );?></label> |
|
442 | + <label for="delete-txn-admin-payment-accounting-inp" class="last"><?php _e('Send Related Messages?', 'event_espresso'); ?></label> |
|
443 | 443 | <input type="checkbox" value="1" name="delete_txn_reg_status_change[send_notifications]"> |
444 | - <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> |
|
444 | + <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> |
|
445 | 445 | </div> |
446 | 446 | <div class="clear"></div> |
447 | 447 | |
@@ -451,12 +451,12 @@ discard block |
||
451 | 451 | <ul id="del-admin-modal-dialog-options-ul"> |
452 | 452 | <li> |
453 | 453 | <a id="txn-admin-modal-dialog-delete-lnk" class="button-primary no-icon" style="display:none;" > |
454 | - <?php _e( 'Delete', 'event_espresso' );?> |
|
454 | + <?php _e('Delete', 'event_espresso'); ?> |
|
455 | 455 | </a> |
456 | 456 | </li> |
457 | 457 | <li> |
458 | 458 | <a id="del-txn-admin-modal-dialog-cancel-lnk" class="button-secondary no-icon" > |
459 | - <?php _e( 'Cancel', 'event_espresso' );?> |
|
459 | + <?php _e('Cancel', 'event_espresso'); ?> |
|
460 | 460 | </a> |
461 | 461 | </li> |
462 | 462 | <li> |
@@ -472,30 +472,30 @@ discard block |
||
472 | 472 | <?php endif; // $grand_raw_total > 0?> |
473 | 473 | |
474 | 474 | <?php |
475 | - if ( WP_DEBUG ) { |
|
476 | - $delivered_messages = get_option( 'EED_Messages__payment', array() ); |
|
477 | - if ( isset( $delivered_messages[ $TXN_ID ] )) { |
|
475 | + if (WP_DEBUG) { |
|
476 | + $delivered_messages = get_option('EED_Messages__payment', array()); |
|
477 | + if (isset($delivered_messages[$TXN_ID])) { |
|
478 | 478 | ?> |
479 | - <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> |
|
479 | + <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> |
|
480 | 480 | |
481 | 481 | <div class="admin-primary-mbox-tbl-wrap"> |
482 | 482 | <table class="admin-primary-mbox-tbl"> |
483 | 483 | <thead> |
484 | 484 | <tr> |
485 | - <th class="jst-left"><?php _e( 'Date & Time', 'event_espresso' );?></th> |
|
486 | - <th class="jst-left"><?php _e( 'Message Type', 'event_espresso' );?></th> |
|
487 | - <th class="jst-left"><?php _e( 'Payment Status Upon Sending', 'event_espresso' );?></th> |
|
488 | - <th class="jst-left"><?php _e( 'TXN Status Upon Sending', 'event_espresso' );?></th> |
|
485 | + <th class="jst-left"><?php _e('Date & Time', 'event_espresso'); ?></th> |
|
486 | + <th class="jst-left"><?php _e('Message Type', 'event_espresso'); ?></th> |
|
487 | + <th class="jst-left"><?php _e('Payment Status Upon Sending', 'event_espresso'); ?></th> |
|
488 | + <th class="jst-left"><?php _e('TXN Status Upon Sending', 'event_espresso'); ?></th> |
|
489 | 489 | </tr> |
490 | 490 | </thead> |
491 | 491 | <tbody> |
492 | - <?php foreach ( $delivered_messages[ $TXN_ID ] as $timestamp => $delivered_message ) : |
|
492 | + <?php foreach ($delivered_messages[$TXN_ID] as $timestamp => $delivered_message) : |
|
493 | 493 | ?> |
494 | 494 | <tr> |
495 | - <td class="jst-left"><?php echo gmdate( get_option('date_format') . ' ' . get_option('time_format'), ( $timestamp + ( get_option( 'gmt_offset' ) * HOUR_IN_SECONDS ) ) );?></td> |
|
496 | - <td class="jst-left"><?php echo isset( $delivered_message['message_type'] ) ? $delivered_message['message_type'] : '';?></td> |
|
497 | - <td class="jst-left"><?php echo isset( $delivered_message['pay_status'] ) ? $delivered_message['pay_status'] : '';?></td> |
|
498 | - <td class="jst-left"><?php echo isset( $delivered_message['txn_status'] ) ? $delivered_message['txn_status'] : '';?></td> |
|
495 | + <td class="jst-left"><?php echo gmdate(get_option('date_format').' '.get_option('time_format'), ($timestamp + (get_option('gmt_offset') * HOUR_IN_SECONDS))); ?></td> |
|
496 | + <td class="jst-left"><?php echo isset($delivered_message['message_type']) ? $delivered_message['message_type'] : ''; ?></td> |
|
497 | + <td class="jst-left"><?php echo isset($delivered_message['pay_status']) ? $delivered_message['pay_status'] : ''; ?></td> |
|
498 | + <td class="jst-left"><?php echo isset($delivered_message['txn_status']) ? $delivered_message['txn_status'] : ''; ?></td> |
|
499 | 499 | </tr> |
500 | 500 | <?php endforeach; // $delivered_messages?> |
501 | 501 | </tbody> |
@@ -1,5 +1,5 @@ discard block |
||
1 | -<?php if ( !defined( 'EVENT_ESPRESSO_VERSION' ) ) { |
|
2 | - exit( 'No direct script access allowed' ); |
|
1 | +<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
|
2 | + exit('No direct script access allowed'); |
|
3 | 3 | } |
4 | 4 | /** |
5 | 5 | * Event Espresso |
@@ -34,7 +34,7 @@ discard block |
||
34 | 34 | * @param boolean $allow_blocking ignored, because we never block soft deletes |
35 | 35 | * @return bool|int |
36 | 36 | */ |
37 | - protected function _delete( $allow_blocking = true ) { |
|
37 | + protected function _delete($allow_blocking = true) { |
|
38 | 38 | return $this->delete_or_restore(); |
39 | 39 | } |
40 | 40 | |
@@ -44,23 +44,23 @@ discard block |
||
44 | 44 | * @param bool $delete true=>delete, false=>restore |
45 | 45 | * @return bool|int |
46 | 46 | */ |
47 | - public function delete_or_restore( $delete = true ) { |
|
47 | + public function delete_or_restore($delete = true) { |
|
48 | 48 | /** |
49 | 49 | * Called just before trashing (soft delete) or restoring a trashed item. |
50 | 50 | * |
51 | 51 | * @param EE_Base_Class $model_object about to be trashed or restored |
52 | 52 | * @param bool $delete true the item is being trashed, false the item is being restored. |
53 | 53 | */ |
54 | - do_action( 'AHEE__EE_Soft_Delete_Base_Class__delete_or_restore__before', $this, $delete ); |
|
54 | + do_action('AHEE__EE_Soft_Delete_Base_Class__delete_or_restore__before', $this, $delete); |
|
55 | 55 | $model = $this->get_model(); |
56 | - $result = $model->delete_or_restore_by_ID( $delete, $this->ID() ); |
|
56 | + $result = $model->delete_or_restore_by_ID($delete, $this->ID()); |
|
57 | 57 | /** |
58 | 58 | * Called just after trashing (soft delete) or restoring a trashed item. |
59 | 59 | * @param EE_Base_Class $model_object that was just trashed or restored. |
60 | 60 | * @param bool $delete true the item is being trashed, false the item is being restored. |
61 | 61 | * @param bool|int $result |
62 | 62 | */ |
63 | - do_action( 'AHEE__EE_Soft_Delete_Base_Class__delete_or_restore__after', $this, $delete, $result ); |
|
63 | + do_action('AHEE__EE_Soft_Delete_Base_Class__delete_or_restore__after', $this, $delete, $result); |
|
64 | 64 | return $result; |
65 | 65 | } |
66 | 66 | |
@@ -71,6 +71,6 @@ discard block |
||
71 | 71 | * @return bool|int |
72 | 72 | */ |
73 | 73 | public function restore() { |
74 | - return $this->delete_or_restore( false ); |
|
74 | + return $this->delete_or_restore(false); |
|
75 | 75 | } |
76 | 76 | } |
77 | 77 | \ No newline at end of file |
@@ -1,5 +1,5 @@ discard block |
||
1 | 1 | <?php |
2 | -define('EE_Event_Category_Taxonomy','espresso_event_category'); |
|
2 | +define('EE_Event_Category_Taxonomy', 'espresso_event_category'); |
|
3 | 3 | /** |
4 | 4 | * |
5 | 5 | * EEM_CPT_Base |
@@ -16,7 +16,7 @@ discard block |
||
16 | 16 | * @author Mike Nelson |
17 | 17 | * |
18 | 18 | */ |
19 | -abstract class EEM_CPT_Base extends EEM_Soft_Delete_Base{ |
|
19 | +abstract class EEM_CPT_Base extends EEM_Soft_Delete_Base { |
|
20 | 20 | |
21 | 21 | /** |
22 | 22 | * @var string post_status_publish - the wp post status for published cpts |
@@ -69,56 +69,56 @@ discard block |
||
69 | 69 | * @param string $timezone |
70 | 70 | * @throws \EE_Error |
71 | 71 | */ |
72 | - protected function __construct( $timezone = NULL ){ |
|
72 | + protected function __construct($timezone = NULL) { |
|
73 | 73 | |
74 | 74 | //adds a relationship to Term_Taxonomy for all these models. For this to work |
75 | 75 | //Term_Relationship must have a relation to each model subclassing EE_CPT_Base explicitly |
76 | 76 | //eg, in EEM_Term_Relationship, inside the _model_relations array, there must be an entry |
77 | 77 | //with key equalling the subclassing model's model name (eg 'Event' or 'Venue'), and the value |
78 | 78 | //must also be new EE_HABTM_Relation('Term_Relationship'); |
79 | - $this->_model_relations['Term_Taxonomy'] =new EE_HABTM_Relation('Term_Relationship'); |
|
80 | - $this->_model_relations[ 'Post_Meta' ] = new EE_Has_Many_Relation( false ); |
|
79 | + $this->_model_relations['Term_Taxonomy'] = new EE_HABTM_Relation('Term_Relationship'); |
|
80 | + $this->_model_relations['Post_Meta'] = new EE_Has_Many_Relation(false); |
|
81 | 81 | $primary_table_name = NULL; |
82 | 82 | //add the common _status field to all CPT primary tables. |
83 | - foreach ( $this->_tables as $alias => $table_obj ) { |
|
84 | - if ( $table_obj instanceof EE_Primary_Table ) { |
|
83 | + foreach ($this->_tables as $alias => $table_obj) { |
|
84 | + if ($table_obj instanceof EE_Primary_Table) { |
|
85 | 85 | $primary_table_name = $alias; |
86 | 86 | } |
87 | 87 | } |
88 | 88 | //set default wp post statuses if child has not already set. |
89 | - if ( ! isset( $this->_fields[$primary_table_name]['status'] )) { |
|
89 | + if ( ! isset($this->_fields[$primary_table_name]['status'])) { |
|
90 | 90 | $this->_fields[$primary_table_name]['status'] = new EE_WP_Post_Status_Field('post_status', __("Event Status", "event_espresso"), false, 'draft'); |
91 | 91 | } |
92 | - if( ! isset( $this->_fields[$primary_table_name]['to_ping'])){ |
|
93 | - $this->_fields[$primary_table_name]['to_ping'] = new EE_DB_Only_Text_Field('to_ping', __( 'To Ping', 'event_espresso' ), FALSE, ''); |
|
92 | + if ( ! isset($this->_fields[$primary_table_name]['to_ping'])) { |
|
93 | + $this->_fields[$primary_table_name]['to_ping'] = new EE_DB_Only_Text_Field('to_ping', __('To Ping', 'event_espresso'), FALSE, ''); |
|
94 | 94 | } |
95 | - if( ! isset( $this->_fields[$primary_table_name]['pinged'])){ |
|
96 | - $this->_fields[$primary_table_name]['pinged'] = new EE_DB_Only_Text_Field('pinged', __( 'Pinged', 'event_espresso' ), FALSE, ''); |
|
95 | + if ( ! isset($this->_fields[$primary_table_name]['pinged'])) { |
|
96 | + $this->_fields[$primary_table_name]['pinged'] = new EE_DB_Only_Text_Field('pinged', __('Pinged', 'event_espresso'), FALSE, ''); |
|
97 | 97 | } |
98 | 98 | |
99 | - if( ! isset( $this->_fields[$primary_table_name]['comment_status'])){ |
|
100 | - $this->_fields[$primary_table_name]['comment_status'] = new EE_Plain_Text_Field('comment_status', __('Comment Status', 'event_espresso' ), FALSE, 'open'); |
|
99 | + if ( ! isset($this->_fields[$primary_table_name]['comment_status'])) { |
|
100 | + $this->_fields[$primary_table_name]['comment_status'] = new EE_Plain_Text_Field('comment_status', __('Comment Status', 'event_espresso'), FALSE, 'open'); |
|
101 | 101 | } |
102 | 102 | |
103 | - if( ! isset( $this->_fields[$primary_table_name]['ping_status'])){ |
|
103 | + if ( ! isset($this->_fields[$primary_table_name]['ping_status'])) { |
|
104 | 104 | $this->_fields[$primary_table_name]['ping_status'] = new EE_Plain_Text_Field('ping_status', __('Ping Status', 'event_espresso'), FALSE, 'open'); |
105 | 105 | } |
106 | 106 | |
107 | - if( ! isset( $this->_fields[$primary_table_name]['post_content_filtered'])){ |
|
108 | - $this->_fields[$primary_table_name]['post_content_filtered'] = new EE_DB_Only_Text_Field('post_content_filtered', __( 'Post Content Filtered', 'event_espresso' ), FALSE, ''); |
|
107 | + if ( ! isset($this->_fields[$primary_table_name]['post_content_filtered'])) { |
|
108 | + $this->_fields[$primary_table_name]['post_content_filtered'] = new EE_DB_Only_Text_Field('post_content_filtered', __('Post Content Filtered', 'event_espresso'), FALSE, ''); |
|
109 | 109 | } |
110 | - if( ! isset( $this->_model_relations[ 'Post_Meta' ] ) ) { |
|
110 | + if ( ! isset($this->_model_relations['Post_Meta'])) { |
|
111 | 111 | //don't block deletes though because we want to maintain the current behaviour |
112 | - $this->_model_relations[ 'Post_Meta' ] = new EE_Has_Many_Relation( false ); |
|
112 | + $this->_model_relations['Post_Meta'] = new EE_Has_Many_Relation(false); |
|
113 | 113 | } |
114 | - if( ! $this->_minimum_where_conditions_strategy instanceof EE_Default_Where_Conditions ){ |
|
114 | + if ( ! $this->_minimum_where_conditions_strategy instanceof EE_Default_Where_Conditions) { |
|
115 | 115 | //nothing was set during child constructor, so set default |
116 | - $this->_minimum_where_conditions_strategy = new EE_CPT_Minimum_Where_Conditions( $this->post_type() ); |
|
116 | + $this->_minimum_where_conditions_strategy = new EE_CPT_Minimum_Where_Conditions($this->post_type()); |
|
117 | 117 | } |
118 | - if( ! $this->_default_where_conditions_strategy instanceof EE_Default_Where_Conditions ) { |
|
118 | + if ( ! $this->_default_where_conditions_strategy instanceof EE_Default_Where_Conditions) { |
|
119 | 119 | //nothing was set during child constructor, so set default |
120 | 120 | //it's ok for child classes to specify this, but generally this is more DRY |
121 | - $this->_default_where_conditions_strategy = new EE_CPT_Where_Conditions( $this->post_type() ); |
|
121 | + $this->_default_where_conditions_strategy = new EE_CPT_Where_Conditions($this->post_type()); |
|
122 | 122 | } |
123 | 123 | parent::__construct($timezone); |
124 | 124 | |
@@ -131,7 +131,7 @@ discard block |
||
131 | 131 | */ |
132 | 132 | public function public_event_stati() { |
133 | 133 | // @see wp-includes/post.php |
134 | - return get_post_stati( array( 'public' => TRUE )); |
|
134 | + return get_post_stati(array('public' => TRUE)); |
|
135 | 135 | } |
136 | 136 | |
137 | 137 | |
@@ -142,7 +142,7 @@ discard block |
||
142 | 142 | * @return string |
143 | 143 | * @throws EE_Error |
144 | 144 | */ |
145 | - public function deleted_field_name(){ |
|
145 | + public function deleted_field_name() { |
|
146 | 146 | throw new EE_Error(sprintf(__("EEM_CPT_Base should nto call deleted_field_name! It should instead use post_status_field_name", "event_espresso"))); |
147 | 147 | } |
148 | 148 | |
@@ -153,12 +153,12 @@ discard block |
||
153 | 153 | * @return string |
154 | 154 | * @throws EE_Error |
155 | 155 | */ |
156 | - public function post_status_field_name(){ |
|
156 | + public function post_status_field_name() { |
|
157 | 157 | $field = $this->get_a_field_of_type('EE_WP_Post_Status_Field'); |
158 | - if($field){ |
|
158 | + if ($field) { |
|
159 | 159 | return $field->get_name(); |
160 | - }else{ |
|
161 | - throw new EE_Error(sprintf(__('We are trying to find the post status flag field on %s, but none was found. Are you sure there is a field of type EE_Trashed_Flag_Field in %s constructor?','event_espresso'),get_class($this),get_class($this))); |
|
160 | + } else { |
|
161 | + throw new EE_Error(sprintf(__('We are trying to find the post status flag field on %s, but none was found. Are you sure there is a field of type EE_Trashed_Flag_Field in %s constructor?', 'event_espresso'), get_class($this), get_class($this))); |
|
162 | 162 | } |
163 | 163 | } |
164 | 164 | |
@@ -169,9 +169,9 @@ discard block |
||
169 | 169 | * @param array $query_params like EEM_Base::get_all's $query_params |
170 | 170 | * @return array like EEM_Base::get_all's $query_params |
171 | 171 | */ |
172 | - protected function _alter_query_params_so_only_trashed_items_included($query_params){ |
|
173 | - $post_status_field_name=$this->post_status_field_name(); |
|
174 | - $query_params[0][$post_status_field_name]=self::post_status_trashed; |
|
172 | + protected function _alter_query_params_so_only_trashed_items_included($query_params) { |
|
173 | + $post_status_field_name = $this->post_status_field_name(); |
|
174 | + $query_params[0][$post_status_field_name] = self::post_status_trashed; |
|
175 | 175 | return $query_params; |
176 | 176 | } |
177 | 177 | |
@@ -182,8 +182,8 @@ discard block |
||
182 | 182 | * @param array $query_params |
183 | 183 | * @return array |
184 | 184 | */ |
185 | - protected function _alter_query_params_so_deleted_and_undeleted_items_included($query_params){ |
|
186 | - $query_params[ 'default_where_conditions' ] = 'minimum'; |
|
185 | + protected function _alter_query_params_so_deleted_and_undeleted_items_included($query_params) { |
|
186 | + $query_params['default_where_conditions'] = 'minimum'; |
|
187 | 187 | return $query_params; |
188 | 188 | } |
189 | 189 | |
@@ -195,11 +195,11 @@ discard block |
||
195 | 195 | * @param array $query_params like EEM_Base::get_all |
196 | 196 | * @return boolean success |
197 | 197 | */ |
198 | - function delete_or_restore($delete=true,$query_params = array()){ |
|
199 | - $post_status_field_name=$this->post_status_field_name(); |
|
198 | + function delete_or_restore($delete = true, $query_params = array()) { |
|
199 | + $post_status_field_name = $this->post_status_field_name(); |
|
200 | 200 | $query_params = $this->_alter_query_params_so_deleted_and_undeleted_items_included($query_params); |
201 | 201 | $new_status = $delete ? self::post_status_trashed : 'draft'; |
202 | - if ( $this->update (array($post_status_field_name=>$new_status), $query_params )) { |
|
202 | + if ($this->update(array($post_status_field_name=>$new_status), $query_params)) { |
|
203 | 203 | return TRUE; |
204 | 204 | } else { |
205 | 205 | return FALSE; |
@@ -216,7 +216,7 @@ discard block |
||
216 | 216 | */ |
217 | 217 | public function meta_table() { |
218 | 218 | $meta_table = $this->_get_other_tables(); |
219 | - $meta_table = reset( $meta_table ); |
|
219 | + $meta_table = reset($meta_table); |
|
220 | 220 | return $meta_table instanceof EE_Secondary_Table ? $meta_table->get_table_name() : NULL; |
221 | 221 | } |
222 | 222 | |
@@ -228,16 +228,16 @@ discard block |
||
228 | 228 | * @param bool $all triggers whether we include DB_Only fields or JUST non DB_Only fields. Defaults to false (no db only fields) |
229 | 229 | * @return array |
230 | 230 | */ |
231 | - public function get_meta_table_fields( $all = FALSE ) { |
|
231 | + public function get_meta_table_fields($all = FALSE) { |
|
232 | 232 | $all_fields = $fields_to_return = array(); |
233 | - foreach ( $this->_tables as $alias => $table_obj ) { |
|
234 | - if ( $table_obj instanceof EE_Secondary_Table ) |
|
235 | - $all_fields = array_merge( $this->_get_fields_for_table($alias), $all_fields ); |
|
233 | + foreach ($this->_tables as $alias => $table_obj) { |
|
234 | + if ($table_obj instanceof EE_Secondary_Table) |
|
235 | + $all_fields = array_merge($this->_get_fields_for_table($alias), $all_fields); |
|
236 | 236 | } |
237 | 237 | |
238 | - if ( !$all ) { |
|
239 | - foreach ( $all_fields as $name => $obj ) { |
|
240 | - if ( $obj instanceof EE_DB_Only_Field_Base ) |
|
238 | + if ( ! $all) { |
|
239 | + foreach ($all_fields as $name => $obj) { |
|
240 | + if ($obj instanceof EE_DB_Only_Field_Base) |
|
241 | 241 | continue; |
242 | 242 | $fields_to_return[] = $name; |
243 | 243 | } |
@@ -260,13 +260,13 @@ discard block |
||
260 | 260 | * @param int $parent_term_taxonomy_id |
261 | 261 | * @return EE_Term_Taxonomy |
262 | 262 | */ |
263 | - function add_event_category(EE_CPT_Base $cpt_model_object, $category_name, $category_description ='',$parent_term_taxonomy_id = null){ |
|
263 | + function add_event_category(EE_CPT_Base $cpt_model_object, $category_name, $category_description = '', $parent_term_taxonomy_id = null) { |
|
264 | 264 | //create term |
265 | - require_once( EE_MODELS . 'EEM_Term.model.php'); |
|
265 | + require_once(EE_MODELS.'EEM_Term.model.php'); |
|
266 | 266 | //first, check for a term by the same name or slug |
267 | 267 | $category_slug = sanitize_title($category_name); |
268 | - $term = EEM_Term::instance()->get_one(array(array('OR'=>array('name'=>$category_name,'slug'=>$category_slug)))); |
|
269 | - if( ! $term ){ |
|
268 | + $term = EEM_Term::instance()->get_one(array(array('OR'=>array('name'=>$category_name, 'slug'=>$category_slug)))); |
|
269 | + if ( ! $term) { |
|
270 | 270 | $term = EE_Term::new_instance(array( |
271 | 271 | 'name'=>$category_name, |
272 | 272 | 'slug'=>$category_slug |
@@ -274,10 +274,10 @@ discard block |
||
274 | 274 | $term->save(); |
275 | 275 | } |
276 | 276 | //make sure there's a term-taxonomy entry too |
277 | - require_once( EE_MODELS . 'EEM_Term_Taxonomy.model.php'); |
|
278 | - $term_taxonomy = EEM_Term_Taxonomy::instance()->get_one(array(array('term_id'=>$term->ID(),'taxonomy'=>EE_Event_Category_Taxonomy))); |
|
277 | + require_once(EE_MODELS.'EEM_Term_Taxonomy.model.php'); |
|
278 | + $term_taxonomy = EEM_Term_Taxonomy::instance()->get_one(array(array('term_id'=>$term->ID(), 'taxonomy'=>EE_Event_Category_Taxonomy))); |
|
279 | 279 | /** @var $term_taxonomy EE_Term_Taxonomy */ |
280 | - if( ! $term_taxonomy ){ |
|
280 | + if ( ! $term_taxonomy) { |
|
281 | 281 | $term_taxonomy = EE_Term_Taxonomy::new_instance(array( |
282 | 282 | 'term_id'=>$term->ID(), |
283 | 283 | 'taxonomy'=>EE_Event_Category_Taxonomy, |
@@ -286,7 +286,7 @@ discard block |
||
286 | 286 | 'parent'=>$parent_term_taxonomy_id |
287 | 287 | )); |
288 | 288 | $term_taxonomy->save(); |
289 | - }else{ |
|
289 | + } else { |
|
290 | 290 | $term_taxonomy->set_count($term_taxonomy->count() + 1); |
291 | 291 | $term_taxonomy->save(); |
292 | 292 | } |
@@ -301,11 +301,11 @@ discard block |
||
301 | 301 | * @param string $category_name name of the event category (term) |
302 | 302 | * @return bool |
303 | 303 | */ |
304 | - function remove_event_category(EE_CPT_Base $cpt_model_object_event, $category_name){ |
|
304 | + function remove_event_category(EE_CPT_Base $cpt_model_object_event, $category_name) { |
|
305 | 305 | //find the term_taxonomy by that name |
306 | - $term_taxonomy = $this->get_first_related($cpt_model_object_event, 'Term_Taxonomy', array(array('Term.name'=>$category_name,'taxonomy'=>EE_Event_Category_Taxonomy))); |
|
306 | + $term_taxonomy = $this->get_first_related($cpt_model_object_event, 'Term_Taxonomy', array(array('Term.name'=>$category_name, 'taxonomy'=>EE_Event_Category_Taxonomy))); |
|
307 | 307 | /** @var $term_taxonomy EE_Term_Taxonomy */ |
308 | - if( $term_taxonomy ){ |
|
308 | + if ($term_taxonomy) { |
|
309 | 309 | $term_taxonomy->set_count($term_taxonomy->count() - 1); |
310 | 310 | $term_taxonomy->save(); |
311 | 311 | } |
@@ -325,8 +325,8 @@ discard block |
||
325 | 325 | * @param string|array $attr Optional. Query string or array of attributes. |
326 | 326 | * @return string HTML image element |
327 | 327 | */ |
328 | - public function get_feature_image( $id, $size = 'thumbnail', $attr = '' ) { |
|
329 | - return get_the_post_thumbnail( $id, $size, $attr ); |
|
328 | + public function get_feature_image($id, $size = 'thumbnail', $attr = '') { |
|
329 | + return get_the_post_thumbnail($id, $size, $attr); |
|
330 | 330 | } |
331 | 331 | |
332 | 332 | |
@@ -339,10 +339,10 @@ discard block |
||
339 | 339 | * @global array $wp_post_statuses set in wp core for storing all the post stati |
340 | 340 | * @return array |
341 | 341 | */ |
342 | - public function get_post_statuses(){ |
|
342 | + public function get_post_statuses() { |
|
343 | 343 | global $wp_post_statuses; |
344 | 344 | $statuses = array(); |
345 | - foreach($wp_post_statuses as $post_status => $args_object){ |
|
345 | + foreach ($wp_post_statuses as $post_status => $args_object) { |
|
346 | 346 | $statuses[$post_status] = $args_object->label; |
347 | 347 | } |
348 | 348 | return $statuses; |
@@ -357,9 +357,9 @@ discard block |
||
357 | 357 | public function get_status_array() { |
358 | 358 | $statuses = $this->get_post_statuses(); |
359 | 359 | //first the global filter |
360 | - $statuses = apply_filters( 'FHEE_EEM_CPT_Base__get_status_array', $statuses ); |
|
360 | + $statuses = apply_filters('FHEE_EEM_CPT_Base__get_status_array', $statuses); |
|
361 | 361 | //now the class specific filter |
362 | - $statuses = apply_filters( 'FHEE_EEM_' . get_class($this) . '__get_status_array', $statuses ); |
|
362 | + $statuses = apply_filters('FHEE_EEM_'.get_class($this).'__get_status_array', $statuses); |
|
363 | 363 | return $statuses; |
364 | 364 | } |
365 | 365 | |
@@ -371,7 +371,7 @@ discard block |
||
371 | 371 | */ |
372 | 372 | public function get_custom_post_statuses() { |
373 | 373 | $new_stati = array(); |
374 | - foreach ( $this->_custom_stati as $status => $props ) { |
|
374 | + foreach ($this->_custom_stati as $status => $props) { |
|
375 | 375 | $new_stati[$status] = $props['label']; |
376 | 376 | } |
377 | 377 | return $new_stati; |
@@ -387,24 +387,24 @@ discard block |
||
387 | 387 | * @param WP_Post|array $post |
388 | 388 | * @return EE_CPT_Base |
389 | 389 | */ |
390 | - public function instantiate_class_from_post_object_orig($post){ |
|
391 | - $post = (array)$post; |
|
390 | + public function instantiate_class_from_post_object_orig($post) { |
|
391 | + $post = (array) $post; |
|
392 | 392 | $has_all_necessary_fields_for_table = true; |
393 | 393 | //check if the post has fields on the meta table already |
394 | - foreach($this->_get_other_tables() as $table_obj){ |
|
394 | + foreach ($this->_get_other_tables() as $table_obj) { |
|
395 | 395 | $fields_for_that_table = $this->_get_fields_for_table($table_obj->get_table_alias()); |
396 | - foreach($fields_for_that_table as $field_obj){ |
|
397 | - if( ! isset($post[$field_obj->get_table_column()]) |
|
398 | - && ! isset($post[$field_obj->get_qualified_column()])){ |
|
396 | + foreach ($fields_for_that_table as $field_obj) { |
|
397 | + if ( ! isset($post[$field_obj->get_table_column()]) |
|
398 | + && ! isset($post[$field_obj->get_qualified_column()])) { |
|
399 | 399 | $has_all_necessary_fields_for_table = false; |
400 | 400 | } |
401 | 401 | } |
402 | 402 | } |
403 | 403 | //if we don't have all the fields we need, then just fetch the proper model from the DB |
404 | - if( ! $has_all_necessary_fields_for_table){ |
|
404 | + if ( ! $has_all_necessary_fields_for_table) { |
|
405 | 405 | |
406 | 406 | return $this->get_one_by_ID($post['ID']); |
407 | - }else{ |
|
407 | + } else { |
|
408 | 408 | return $this->instantiate_class_from_array_or_object($post); |
409 | 409 | } |
410 | 410 | } |
@@ -415,30 +415,30 @@ discard block |
||
415 | 415 | * @param null $post |
416 | 416 | * @return EE_Base_Class|EE_Soft_Delete_Base_Class |
417 | 417 | */ |
418 | - public function instantiate_class_from_post_object( $post = NULL ){ |
|
419 | - if ( empty( $post )) { |
|
418 | + public function instantiate_class_from_post_object($post = NULL) { |
|
419 | + if (empty($post)) { |
|
420 | 420 | global $post; |
421 | 421 | } |
422 | - $post = (array)$post; |
|
422 | + $post = (array) $post; |
|
423 | 423 | $tables_needing_to_be_queried = array(); |
424 | 424 | //check if the post has fields on the meta table already |
425 | - foreach($this->get_tables() as $table_obj){ |
|
425 | + foreach ($this->get_tables() as $table_obj) { |
|
426 | 426 | $fields_for_that_table = $this->_get_fields_for_table($table_obj->get_table_alias()); |
427 | - foreach($fields_for_that_table as $field_obj){ |
|
428 | - if( ! isset($post[$field_obj->get_table_column()]) |
|
429 | - && ! isset($post[$field_obj->get_qualified_column()])){ |
|
427 | + foreach ($fields_for_that_table as $field_obj) { |
|
428 | + if ( ! isset($post[$field_obj->get_table_column()]) |
|
429 | + && ! isset($post[$field_obj->get_qualified_column()])) { |
|
430 | 430 | $tables_needing_to_be_queried[$table_obj->get_table_alias()] = $table_obj; |
431 | 431 | } |
432 | 432 | } |
433 | 433 | } |
434 | 434 | //if we don't have all the fields we need, then just fetch the proper model from the DB |
435 | - if( $tables_needing_to_be_queried){ |
|
436 | - if(count($tables_needing_to_be_queried) == 1 && reset($tables_needing_to_be_queried) instanceof EE_Secondary_Table){ |
|
435 | + if ($tables_needing_to_be_queried) { |
|
436 | + if (count($tables_needing_to_be_queried) == 1 && reset($tables_needing_to_be_queried) instanceof EE_Secondary_Table) { |
|
437 | 437 | //so we're only missing data from a secondary table. Well that's not too hard to query for |
438 | 438 | $table_to_query = reset($tables_needing_to_be_queried); |
439 | - $missing_data = $this->_do_wpdb_query( 'get_row', array( 'SELECT * FROM ' . $table_to_query->get_table_name() . ' WHERE ' . $table_to_query->get_fk_on_table() . ' = ' . $post['ID'], ARRAY_A )); |
|
440 | - if ( ! empty( $missing_data )) { |
|
441 | - $post = array_merge( $post, $missing_data ); |
|
439 | + $missing_data = $this->_do_wpdb_query('get_row', array('SELECT * FROM '.$table_to_query->get_table_name().' WHERE '.$table_to_query->get_fk_on_table().' = '.$post['ID'], ARRAY_A)); |
|
440 | + if ( ! empty($missing_data)) { |
|
441 | + $post = array_merge($post, $missing_data); |
|
442 | 442 | } |
443 | 443 | } else { |
444 | 444 | return $this->get_one_by_ID($post['ID']); |
@@ -455,15 +455,15 @@ discard block |
||
455 | 455 | * @throws EE_Error |
456 | 456 | * @return string |
457 | 457 | */ |
458 | - public function post_type(){ |
|
458 | + public function post_type() { |
|
459 | 459 | $post_type_field = NULL; |
460 | - foreach($this->field_settings(true) as $field_obj){ |
|
461 | - if($field_obj instanceof EE_WP_Post_Type_Field){ |
|
462 | - $post_type_field = $field_obj;break; |
|
460 | + foreach ($this->field_settings(true) as $field_obj) { |
|
461 | + if ($field_obj instanceof EE_WP_Post_Type_Field) { |
|
462 | + $post_type_field = $field_obj; break; |
|
463 | 463 | } |
464 | 464 | } |
465 | - if($post_type_field == NULL){ |
|
466 | - throw new EE_Error(sprintf(__("CPT Model %s should have a field of type EE_WP_Post_Type, but doesnt", "event_espresso"),get_class($this))); |
|
465 | + if ($post_type_field == NULL) { |
|
466 | + throw new EE_Error(sprintf(__("CPT Model %s should have a field of type EE_WP_Post_Type, but doesnt", "event_espresso"), get_class($this))); |
|
467 | 467 | } |
468 | 468 | return $post_type_field->get_default_value(); |
469 | 469 | } |
@@ -1,6 +1,6 @@ discard block |
||
1 | 1 | <?php |
2 | -if ( ! defined( 'EVENT_ESPRESSO_VERSION' ) ) { |
|
3 | - exit( 'No direct script access allowed' ); |
|
2 | +if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
|
3 | + exit('No direct script access allowed'); |
|
4 | 4 | } |
5 | 5 | /** |
6 | 6 | * |
@@ -15,7 +15,7 @@ discard block |
||
15 | 15 | * @since 4.6.0 |
16 | 16 | * |
17 | 17 | */ |
18 | -class EE_Default_Where_Conditions{ |
|
18 | +class EE_Default_Where_Conditions { |
|
19 | 19 | /** |
20 | 20 | * This const can be used in EE_Default_Where_Conditions values, and at the time of querying it will be |
21 | 21 | * replaced with the current user's ID (because we don't want to use the current user's ID at time of |
@@ -47,7 +47,7 @@ discard block |
||
47 | 47 | * onto any field names |
48 | 48 | * @param array $custom_where_conditions |
49 | 49 | */ |
50 | - public function __construct( $custom_where_conditions = array() ) { |
|
50 | + public function __construct($custom_where_conditions = array()) { |
|
51 | 51 | $this->_where_conditions_provided = $custom_where_conditions; |
52 | 52 | } |
53 | 53 | |
@@ -56,7 +56,7 @@ discard block |
||
56 | 56 | * for querying of the model. |
57 | 57 | * @param EEM_Base $model |
58 | 58 | */ |
59 | - function _finalize_construct(EEM_Base $model){ |
|
59 | + function _finalize_construct(EEM_Base $model) { |
|
60 | 60 | $this->_model = $model; |
61 | 61 | } |
62 | 62 | |
@@ -70,7 +70,7 @@ discard block |
||
70 | 70 | * @param string $model_relation_chain |
71 | 71 | * @return array |
72 | 72 | */ |
73 | - function get_minimum_where_conditions( $model_relation_chain = null ){ |
|
73 | + function get_minimum_where_conditions($model_relation_chain = null) { |
|
74 | 74 | return $this->prepare_where_conditions_for_querying( |
75 | 75 | $this->get_where_conditions_provided(), |
76 | 76 | $model_relation_chain |
@@ -82,9 +82,9 @@ discard block |
||
82 | 82 | * @param string $model_relation_chain |
83 | 83 | * @return string |
84 | 84 | */ |
85 | - protected function _ensure_model_relation_chain_ends_in_period( $model_relation_chain ){ |
|
86 | - if($model_relation_chain != '' && $model_relation_chain[strlen($model_relation_chain)-1] !='.'){ |
|
87 | - $model_relation_chain=$model_relation_chain."."; |
|
85 | + protected function _ensure_model_relation_chain_ends_in_period($model_relation_chain) { |
|
86 | + if ($model_relation_chain != '' && $model_relation_chain[strlen($model_relation_chain) - 1] != '.') { |
|
87 | + $model_relation_chain = $model_relation_chain."."; |
|
88 | 88 | } |
89 | 89 | return $model_relation_chain; |
90 | 90 | } |
@@ -100,7 +100,7 @@ discard block |
||
100 | 100 | * @param string $model_relation_chain |
101 | 101 | * @return array like what's expected in EEM_Base::get_all()'s $query_params[0] |
102 | 102 | */ |
103 | - function get_default_where_conditions( $model_relation_chain = '' ){ |
|
103 | + function get_default_where_conditions($model_relation_chain = '') { |
|
104 | 104 | return $this->prepare_where_conditions_for_querying( |
105 | 105 | array_replace_recursive( |
106 | 106 | $this->_get_default_where_conditions(), |
@@ -114,7 +114,7 @@ discard block |
||
114 | 114 | * Adding model relation chains is handled by the public method get_default_where_conditions |
115 | 115 | * @return array |
116 | 116 | */ |
117 | - protected function _get_default_where_conditions(){ |
|
117 | + protected function _get_default_where_conditions() { |
|
118 | 118 | return array(); |
119 | 119 | } |
120 | 120 | |
@@ -128,31 +128,31 @@ discard block |
||
128 | 128 | * @return array |
129 | 129 | * @throws \EE_Error |
130 | 130 | */ |
131 | - public function prepare_where_conditions_for_querying( $where_conditions, $model_relation_chain ) { |
|
131 | + public function prepare_where_conditions_for_querying($where_conditions, $model_relation_chain) { |
|
132 | 132 | $where_conditions_with_model_relation_chain_prefixes = array(); |
133 | - if( ! is_array( $where_conditions ) ){ |
|
133 | + if ( ! is_array($where_conditions)) { |
|
134 | 134 | $where_conditions = array(); |
135 | 135 | } |
136 | - foreach( $where_conditions as $key => $value ) { |
|
137 | - if( in_array( $key, array( 'OR', 'AND', 'NOT' ) ) || |
|
138 | - strpos( $key, 'OR*' ) !== false || |
|
139 | - strpos( $key, 'AND*' ) !== false || |
|
140 | - strpos( $key, 'NOT*' ) !== false ){ |
|
141 | - $where_conditions_with_model_relation_chain_prefixes[ $key ] = $this->prepare_where_conditions_for_querying( $value, $model_relation_chain ); |
|
142 | - }else{ |
|
143 | - $model_relation_chain = $this->_ensure_model_relation_chain_ends_in_period( $model_relation_chain ); |
|
136 | + foreach ($where_conditions as $key => $value) { |
|
137 | + if (in_array($key, array('OR', 'AND', 'NOT')) || |
|
138 | + strpos($key, 'OR*') !== false || |
|
139 | + strpos($key, 'AND*') !== false || |
|
140 | + strpos($key, 'NOT*') !== false) { |
|
141 | + $where_conditions_with_model_relation_chain_prefixes[$key] = $this->prepare_where_conditions_for_querying($value, $model_relation_chain); |
|
142 | + } else { |
|
143 | + $model_relation_chain = $this->_ensure_model_relation_chain_ends_in_period($model_relation_chain); |
|
144 | 144 | //check for the current user id place holder, and if present change it |
145 | - if( $value === self::current_user_placeholder ){ |
|
145 | + if ($value === self::current_user_placeholder) { |
|
146 | 146 | $value = get_current_user_id(); |
147 | 147 | } |
148 | 148 | //check for user field placeholder |
149 | - if( $key == self::user_field_name_placeholder ) { |
|
150 | - if( ! $this->_model->wp_user_field_name() ) { |
|
151 | - throw new EE_Error( sprintf( __( 'There is no foreign key to the WP_User model on model %s. Please either modify your default where conditions, add a _model_chain_to_wp_user onto the model, or a proper EE_WP_User_Field onto the model', 'event_espresso' ), $this->_model->get_this_model_name() ) ); |
|
149 | + if ($key == self::user_field_name_placeholder) { |
|
150 | + if ( ! $this->_model->wp_user_field_name()) { |
|
151 | + throw new EE_Error(sprintf(__('There is no foreign key to the WP_User model on model %s. Please either modify your default where conditions, add a _model_chain_to_wp_user onto the model, or a proper EE_WP_User_Field onto the model', 'event_espresso'), $this->_model->get_this_model_name())); |
|
152 | 152 | } |
153 | 153 | $key = $this->_model->wp_user_field_name(); |
154 | 154 | } |
155 | - $where_conditions_with_model_relation_chain_prefixes[ $model_relation_chain . $key ] = $value; |
|
155 | + $where_conditions_with_model_relation_chain_prefixes[$model_relation_chain.$key] = $value; |
|
156 | 156 | } |
157 | 157 | } |
158 | 158 | return $where_conditions_with_model_relation_chain_prefixes; |
@@ -5,7 +5,7 @@ |
||
5 | 5 | /** |
6 | 6 | * |
7 | 7 | * Class EE_CPT_Minimum_Where_Conditions |
8 | - * |
|
8 | + * |
|
9 | 9 | * Strategy specifically for adding where conditions specific to CPT models. |
10 | 10 | * But only sets the minimum, so any row of the right type will get used |
11 | 11 | * |
@@ -1,6 +1,6 @@ discard block |
||
1 | 1 | <?php |
2 | -if ( ! defined( 'EVENT_ESPRESSO_VERSION' ) ) { |
|
3 | - exit( 'No direct script access allowed' ); |
|
2 | +if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
|
3 | + exit('No direct script access allowed'); |
|
4 | 4 | } |
5 | 5 | /** |
6 | 6 | * |
@@ -13,7 +13,7 @@ discard block |
||
13 | 13 | * @author Mike Nelson |
14 | 14 | * @since 4.6.0 |
15 | 15 | */ |
16 | -class EE_Soft_Delete_Where_Conditions extends EE_Default_Where_Conditions{ |
|
16 | +class EE_Soft_Delete_Where_Conditions extends EE_Default_Where_Conditions { |
|
17 | 17 | |
18 | 18 | |
19 | 19 | |
@@ -26,8 +26,8 @@ discard block |
||
26 | 26 | * |
27 | 27 | * @param array $custom_where_conditions |
28 | 28 | */ |
29 | - function __construct( $custom_where_conditions = array() ){ |
|
30 | - parent::__construct( $custom_where_conditions ); |
|
29 | + function __construct($custom_where_conditions = array()) { |
|
30 | + parent::__construct($custom_where_conditions); |
|
31 | 31 | } |
32 | 32 | |
33 | 33 | |
@@ -36,7 +36,7 @@ discard block |
||
36 | 36 | * Gets the where default where conditions for a custom post type model |
37 | 37 | * @return array like EEM_Base::get_all's $query_params's index [0] (where conditions) |
38 | 38 | */ |
39 | - protected function _get_default_where_conditions(){ |
|
39 | + protected function _get_default_where_conditions() { |
|
40 | 40 | $trashed_field_name = $this->deleted_field_name(); |
41 | 41 | return array( |
42 | 42 | $trashed_field_name => false |
@@ -51,15 +51,15 @@ discard block |
||
51 | 51 | * @return string |
52 | 52 | * @throws EE_Error |
53 | 53 | */ |
54 | - private function deleted_field_name(){ |
|
54 | + private function deleted_field_name() { |
|
55 | 55 | $field = $this->_model->get_a_field_of_type('EE_Trashed_Flag_Field'); |
56 | - if($field){ |
|
56 | + if ($field) { |
|
57 | 57 | return $field->get_name(); |
58 | - }else{ |
|
58 | + } else { |
|
59 | 59 | throw new EE_Error( |
60 | 60 | sprintf( |
61 | - __( 'We are trying to find the deleted flag field on %1$s, but none was found. Are you sure there is a field of type EE_Trashed_Flag_Field in the %1$s constructor?', 'event_espresso' ), |
|
62 | - get_class( $this ) |
|
61 | + __('We are trying to find the deleted flag field on %1$s, but none was found. Are you sure there is a field of type EE_Trashed_Flag_Field in the %1$s constructor?', 'event_espresso'), |
|
62 | + get_class($this) |
|
63 | 63 | ) |
64 | 64 | ); |
65 | 65 | } |
@@ -1,5 +1,5 @@ discard block |
||
1 | 1 | <?php |
2 | -if (!defined('EVENT_ESPRESSO_VERSION') ) |
|
2 | +if ( ! defined('EVENT_ESPRESSO_VERSION')) |
|
3 | 3 | exit('NO direct script access allowed'); |
4 | 4 | |
5 | 5 | /** |
@@ -271,7 +271,7 @@ discard block |
||
271 | 271 | * @param bool $preview indicate whether a preview is being generated or not. |
272 | 272 | * @return void |
273 | 273 | */ |
274 | - public function set_messages($data, EE_messenger $active_messenger, $context = '', $preview = FALSE ) { |
|
274 | + public function set_messages($data, EE_messenger $active_messenger, $context = '', $preview = FALSE) { |
|
275 | 275 | |
276 | 276 | $this->_active_messenger = $active_messenger; |
277 | 277 | |
@@ -280,10 +280,10 @@ discard block |
||
280 | 280 | |
281 | 281 | //this is a special method that allows child message types to trigger an exit from generating messages early (in cases where there may be a delay on send). |
282 | 282 | $exit = $this->_trigger_exit(); |
283 | - if ( $exit && ! $this->_preview ) return FALSE; |
|
283 | + if ($exit && ! $this->_preview) return FALSE; |
|
284 | 284 | |
285 | 285 | //todo: need to move require into registration hook but for now we'll require here. |
286 | - EE_Registry::instance()->load_helper( 'Parse_Shortcodes' ); |
|
286 | + EE_Registry::instance()->load_helper('Parse_Shortcodes'); |
|
287 | 287 | //get shortcode_replace instance- set when _get_messages is called in child... |
288 | 288 | $this->_shortcode_replace = new EEH_Parse_Shortcodes(); |
289 | 289 | |
@@ -294,9 +294,9 @@ discard block |
||
294 | 294 | $this->_data_handler = ! $this->_preview ? $this->_data_handler : 'Preview'; |
295 | 295 | |
296 | 296 | //if there is an incoming context then this is a preview so let's ONLY show the given context! |
297 | - if ( !empty( $context ) ) { |
|
298 | - $cntxt = ! empty( $this->_contexts[$context] ) ? $this->_contexts[$context] : ''; |
|
299 | - if ( ! empty( $cntxt ) ) { |
|
297 | + if ( ! empty($context)) { |
|
298 | + $cntxt = ! empty($this->_contexts[$context]) ? $this->_contexts[$context] : ''; |
|
299 | + if ( ! empty($cntxt)) { |
|
300 | 300 | $this->_contexts = array(); |
301 | 301 | $this->_contexts[$context] = $cntxt; |
302 | 302 | } |
@@ -305,7 +305,7 @@ discard block |
||
305 | 305 | $exit = $this->_init_data(); |
306 | 306 | |
307 | 307 | //final check for if we exit or not cause child objects may have run conditionals that cleared out data so no addresees generated. |
308 | - if ( $exit ) return FALSE; |
|
308 | + if ($exit) return FALSE; |
|
309 | 309 | |
310 | 310 | $this->_get_templates(); //get the templates that have been set with this type and for the given messenger that have been saved in the database. |
311 | 311 | $this->_assemble_messages(); |
@@ -341,7 +341,7 @@ discard block |
||
341 | 341 | * @param int $id Optional. Integer corresponding to the value for the primary key of a EE_Base_Class_Object |
342 | 342 | * @return mixed ( EE_Base_Class||EE_Base_Class[] ) |
343 | 343 | */ |
344 | - abstract protected function _get_data_for_context( $context, EE_Registration $registration, $id ); |
|
344 | + abstract protected function _get_data_for_context($context, EE_Registration $registration, $id); |
|
345 | 345 | |
346 | 346 | |
347 | 347 | |
@@ -373,7 +373,7 @@ discard block |
||
373 | 373 | * |
374 | 374 | * @return int |
375 | 375 | */ |
376 | - protected function _get_id_for_msg_url( $context, EE_Registration $registration ) { |
|
376 | + protected function _get_id_for_msg_url($context, EE_Registration $registration) { |
|
377 | 377 | return 0; |
378 | 378 | } |
379 | 379 | |
@@ -406,28 +406,28 @@ discard block |
||
406 | 406 | * |
407 | 407 | * @return string generated url |
408 | 408 | */ |
409 | - public function get_url_trigger( $context, $sending_messenger, EE_Registration $registration ) { |
|
409 | + public function get_url_trigger($context, $sending_messenger, EE_Registration $registration) { |
|
410 | 410 | |
411 | 411 | //validate context |
412 | 412 | //valid context? |
413 | - if ( !isset( $this->_contexts[$context] ) ) { |
|
414 | - throw new EE_Error( sprintf( __('The context %s is not a valid context for %s.', 'event_espresso'), $context, get_class( $this ) ) ); |
|
413 | + if ( ! isset($this->_contexts[$context])) { |
|
414 | + throw new EE_Error(sprintf(__('The context %s is not a valid context for %s.', 'event_espresso'), $context, get_class($this))); |
|
415 | 415 | } |
416 | 416 | |
417 | 417 | //valid sending_messenger? |
418 | 418 | $not_valid_msgr = FALSE; |
419 | - foreach ( $this->_with_messengers as $generating => $sendings ) { |
|
420 | - if ( empty( $sendings ) || array_search( $sending_messenger, $sendings ) === FALSE ) { |
|
419 | + foreach ($this->_with_messengers as $generating => $sendings) { |
|
420 | + if (empty($sendings) || array_search($sending_messenger, $sendings) === FALSE) { |
|
421 | 421 | $not_valid_msgr = TRUE; |
422 | 422 | } |
423 | 423 | } |
424 | 424 | |
425 | - if ( $not_valid_msgr ) { |
|
426 | - throw new EE_Error( sprintf( __('The given sending messenger string (%s) does not match a valid sending messenger with the %s. If this is incorrect, make sure that the message type has defined this messenger as a sending messenger in its $_with_messengers array.', 'event_espresso'), $sending_messenger, get_class( $this ) ) ); |
|
425 | + if ($not_valid_msgr) { |
|
426 | + throw new EE_Error(sprintf(__('The given sending messenger string (%s) does not match a valid sending messenger with the %s. If this is incorrect, make sure that the message type has defined this messenger as a sending messenger in its $_with_messengers array.', 'event_espresso'), $sending_messenger, get_class($this))); |
|
427 | 427 | } |
428 | 428 | |
429 | 429 | EE_Registry::instance()->load_helper('MSG_Template'); |
430 | - return EEH_MSG_Template::generate_url_trigger( $sending_messenger, $this->_active_messenger->name, $context, $this->name, $registration, $this->_GRP_ID, $this->_get_id_for_msg_url( $context, $registration ) ); |
|
430 | + return EEH_MSG_Template::generate_url_trigger($sending_messenger, $this->_active_messenger->name, $context, $this->name, $registration, $this->_GRP_ID, $this->_get_id_for_msg_url($context, $registration)); |
|
431 | 431 | } |
432 | 432 | |
433 | 433 | |
@@ -448,19 +448,19 @@ discard block |
||
448 | 448 | * |
449 | 449 | * @return mixed (EE_Base_Class||EE_Base_Class[]) |
450 | 450 | */ |
451 | - public function get_data_for_context( $context, EE_Registration $registration, $id = 0 ) { |
|
451 | + public function get_data_for_context($context, EE_Registration $registration, $id = 0) { |
|
452 | 452 | //valid context? |
453 | - if ( !isset( $this->_contexts[$context] ) ) { |
|
454 | - throw new EE_Error( sprintf( __('The context %s is not a valid context for %s.', 'event_espresso'), $context, get_class( $this ) ) ); |
|
453 | + if ( ! isset($this->_contexts[$context])) { |
|
454 | + throw new EE_Error(sprintf(__('The context %s is not a valid context for %s.', 'event_espresso'), $context, get_class($this))); |
|
455 | 455 | } |
456 | 456 | |
457 | 457 | //get data and apply global and class specific filters on it. |
458 | - $data = apply_filters( 'FHEE__EE_message_type__get_data_for_context__data', $this->_get_data_for_context( $context, $registration, $id ), $this ); |
|
459 | - $data = apply_filters( 'FHEE__' . get_class( $this ) . '__get_data_for_context__data', $data, $this ); |
|
458 | + $data = apply_filters('FHEE__EE_message_type__get_data_for_context__data', $this->_get_data_for_context($context, $registration, $id), $this); |
|
459 | + $data = apply_filters('FHEE__'.get_class($this).'__get_data_for_context__data', $data, $this); |
|
460 | 460 | |
461 | 461 | //if empty then something went wrong! |
462 | - if ( empty( $data ) ) { |
|
463 | - throw new EE_Error( sprintf( __('There is no data retrieved, it is possible that the id given (%d) does not match any value in the database for the corresponding EE_Base_Class used by the data handler for the %s message type.', 'event_espresso'), $id, $this->name ) ); |
|
462 | + if (empty($data)) { |
|
463 | + throw new EE_Error(sprintf(__('There is no data retrieved, it is possible that the id given (%d) does not match any value in the database for the corresponding EE_Base_Class used by the data handler for the %s message type.', 'event_espresso'), $id, $this->name)); |
|
464 | 464 | } |
465 | 465 | |
466 | 466 | return $data; |
@@ -495,7 +495,7 @@ discard block |
||
495 | 495 | */ |
496 | 496 | public function with_messengers() { |
497 | 497 | |
498 | - return apply_filters( 'FHEE__EE_message_type__get_with_messengers__with_messengers__' . get_class( $this ), $this->_with_messengers); |
|
498 | + return apply_filters('FHEE__EE_message_type__get_with_messengers__with_messengers__'.get_class($this), $this->_with_messengers); |
|
499 | 499 | } |
500 | 500 | |
501 | 501 | |
@@ -513,9 +513,9 @@ discard block |
||
513 | 513 | * @access public |
514 | 514 | * @return void |
515 | 515 | */ |
516 | - public function get_message_type_admin_page_content($page, $action = NULL, $extra = array(), $messengers = array() ) { |
|
516 | + public function get_message_type_admin_page_content($page, $action = NULL, $extra = array(), $messengers = array()) { |
|
517 | 517 | //we can also further refine the context by action (if present). |
518 | - return $this->_get_admin_page_content( $page, $action, $extra, $messengers ); |
|
518 | + return $this->_get_admin_page_content($page, $action, $extra, $messengers); |
|
519 | 519 | } |
520 | 520 | |
521 | 521 | |
@@ -559,8 +559,8 @@ discard block |
||
559 | 559 | */ |
560 | 560 | public function get_master_templates() { |
561 | 561 | //first class specific filter then filter that by the global filter. |
562 | - $master_templates = apply_filters( 'FHEE__' . get_class( $this ) . '__get_master_templates', $this->_master_templates ); |
|
563 | - return apply_filters( 'FHEE__EE_message_type__get_master_templates', $master_templates, $this ); |
|
562 | + $master_templates = apply_filters('FHEE__'.get_class($this).'__get_master_templates', $this->_master_templates); |
|
563 | + return apply_filters('FHEE__EE_message_type__get_master_templates', $master_templates, $this); |
|
564 | 564 | } |
565 | 565 | |
566 | 566 | |
@@ -579,31 +579,31 @@ discard block |
||
579 | 579 | /** |
580 | 580 | * first let's make sure that incoming data isn't empty! |
581 | 581 | */ |
582 | - if ( is_array($this->_data) && empty($this->_data) && !$this->_preview ) { |
|
583 | - $msg = sprintf( __( '"%s" message type incoming data is empty. There is nothing to work with so why are you bugging me?', 'event_espresso'), $this->label['singular'] ); |
|
584 | - throw new EE_Error( $msg ); |
|
582 | + if (is_array($this->_data) && empty($this->_data) && ! $this->_preview) { |
|
583 | + $msg = sprintf(__('"%s" message type incoming data is empty. There is nothing to work with so why are you bugging me?', 'event_espresso'), $this->label['singular']); |
|
584 | + throw new EE_Error($msg); |
|
585 | 585 | } |
586 | 586 | |
587 | - if ( empty( $this->_data_handler) ) { |
|
588 | - $msg = sprintf( __('Hey %s hasn\'t declared a handler for the incoming data, so I\'m stuck', 'event_espresso'), __CLASS__ ); |
|
589 | - throw new EE_Error( $msg ); |
|
587 | + if (empty($this->_data_handler)) { |
|
588 | + $msg = sprintf(__('Hey %s hasn\'t declared a handler for the incoming data, so I\'m stuck', 'event_espresso'), __CLASS__); |
|
589 | + throw new EE_Error($msg); |
|
590 | 590 | } |
591 | 591 | |
592 | 592 | |
593 | 593 | //setup class name for the data handler |
594 | - $classname = 'EE_Messages_' . $this->_data_handler . '_incoming_data'; |
|
594 | + $classname = 'EE_Messages_'.$this->_data_handler.'_incoming_data'; |
|
595 | 595 | |
596 | 596 | //check that the class exists |
597 | - if ( !class_exists( $classname ) ) { |
|
597 | + if ( ! class_exists($classname)) { |
|
598 | 598 | |
599 | 599 | $msg[] = __('uhoh, Something went wrong and no data handler is found', 'event_espresso'); |
600 | - $msg[] = sprintf( __('The %s class has set the "$_data_handler" property but the string included (%s) does not match any existing "EE_Messages_incoming_data" classes (found in "/includes/core/messages/data_class"). Looking for %s.', 'event_espresso'), __CLASS__, $this->_data_handler, $classname ); |
|
601 | - throw new EE_error( implode('||', $msg) ); |
|
600 | + $msg[] = sprintf(__('The %s class has set the "$_data_handler" property but the string included (%s) does not match any existing "EE_Messages_incoming_data" classes (found in "/includes/core/messages/data_class"). Looking for %s.', 'event_espresso'), __CLASS__, $this->_data_handler, $classname); |
|
601 | + throw new EE_error(implode('||', $msg)); |
|
602 | 602 | } |
603 | 603 | |
604 | 604 | //k lets get the prepared data object and replace existing data property with it. |
605 | - $a = new ReflectionClass( $classname ); |
|
606 | - $this->_data = $a->newInstance( $this->_data ); |
|
605 | + $a = new ReflectionClass($classname); |
|
606 | + $this->_data = $a->newInstance($this->_data); |
|
607 | 607 | |
608 | 608 | $this->_set_default_addressee_data(); |
609 | 609 | return $this->_process_data(); |
@@ -619,15 +619,15 @@ discard block |
||
619 | 619 | protected function _process_data() { |
620 | 620 | //at a minimum, we NEED EE_Attendee objects. |
621 | 621 | |
622 | - if ( empty( $this->_data->attendees ) ) |
|
623 | - return TRUE; //EXIT! |
|
622 | + if (empty($this->_data->attendees)) |
|
623 | + return TRUE; //EXIT! |
|
624 | 624 | |
625 | 625 | //process addressees for each context. Child classes will have to have methods for each context defined to handle the processing of the data object within them |
626 | - foreach ( $this->_contexts as $context => $details ) { |
|
627 | - $xpctd_method = '_' . $context . '_addressees'; |
|
628 | - if ( !method_exists( $this, $xpctd_method ) ) |
|
629 | - throw new EE_Error( sprintf( __('The data for %1$s message type cannot be prepared because there is no set method for doing so. The expected method name is "%2$s" please doublecheck the %1$s message type class and make sure that method is present', 'event_espresso'), $this->label['singular'], $xpctd_method) ); |
|
630 | - $this->_addressees[$context] = call_user_func( array( $this, $xpctd_method ) ); |
|
626 | + foreach ($this->_contexts as $context => $details) { |
|
627 | + $xpctd_method = '_'.$context.'_addressees'; |
|
628 | + if ( ! method_exists($this, $xpctd_method)) |
|
629 | + throw new EE_Error(sprintf(__('The data for %1$s message type cannot be prepared because there is no set method for doing so. The expected method name is "%2$s" please doublecheck the %1$s message type class and make sure that method is present', 'event_espresso'), $this->label['singular'], $xpctd_method)); |
|
630 | + $this->_addressees[$context] = call_user_func(array($this, $xpctd_method)); |
|
631 | 631 | } |
632 | 632 | return FALSE; //DON'T EXIT |
633 | 633 | } |
@@ -662,8 +662,8 @@ discard block |
||
662 | 662 | 'total_ticket_count' => $this->_data->total_ticket_count |
663 | 663 | ); |
664 | 664 | |
665 | - if ( is_array( $this->_data->primary_attendee_data ) ) { |
|
666 | - $this->_default_addressee_data = array_merge( $this->_default_addressee_data, $this->_data->primary_attendee_data ); |
|
665 | + if (is_array($this->_data->primary_attendee_data)) { |
|
666 | + $this->_default_addressee_data = array_merge($this->_default_addressee_data, $this->_data->primary_attendee_data); |
|
667 | 667 | $this->_default_addressee_data['primary_att_obj'] = $this->_data->primary_attendee_data['att_obj']; |
668 | 668 | $this->_default_addressee_data['primary_reg_obj'] = $this->_data->primary_attendee_data['reg_obj']; |
669 | 669 | } |
@@ -681,26 +681,26 @@ discard block |
||
681 | 681 | * see abstract declaration in parent class for details, children message types can override these valid shortcodes if desired (we include all for all contexts by default). |
682 | 682 | */ |
683 | 683 | protected function _set_valid_shortcodes() { |
684 | - $all_shortcodes = array( 'attendee_list', 'attendee', 'datetime_list', 'datetime', 'event_list', 'event_meta', 'event', 'organization', 'recipient_details', 'recipient_list', 'ticket_list', 'ticket', 'transaction', 'venue', 'primary_registration_details', 'primary_registration_list', 'event_author', 'email', 'messenger' ); |
|
684 | + $all_shortcodes = array('attendee_list', 'attendee', 'datetime_list', 'datetime', 'event_list', 'event_meta', 'event', 'organization', 'recipient_details', 'recipient_list', 'ticket_list', 'ticket', 'transaction', 'venue', 'primary_registration_details', 'primary_registration_list', 'event_author', 'email', 'messenger'); |
|
685 | 685 | $contexts = $this->get_contexts(); |
686 | - foreach ( $contexts as $context => $details ) { |
|
686 | + foreach ($contexts as $context => $details) { |
|
687 | 687 | $this->_valid_shortcodes[$context] = $all_shortcodes; |
688 | 688 | |
689 | 689 | //make sure non admin context does not include the event_author shortcodes |
690 | - if ( $context != 'admin' ) { |
|
691 | - if( ($key = array_search('event_author', $this->_valid_shortcodes[$context] ) ) !== false) { |
|
690 | + if ($context != 'admin') { |
|
691 | + if (($key = array_search('event_author', $this->_valid_shortcodes[$context])) !== false) { |
|
692 | 692 | unset($this->_valid_shortcodes[$context][$key]); |
693 | 693 | } |
694 | 694 | } |
695 | 695 | } |
696 | 696 | |
697 | 697 | //make sure admin context does not include the recipient_details shortcodes IF we have admin context hooked in message types might not have that context. |
698 | - if ( !empty( $this->_valid_shortcodes['admin'] ) ) { |
|
699 | - if( ($key = array_search('recipient_details', $this->_valid_shortcodes['admin'] ) ) !== false) { |
|
698 | + if ( ! empty($this->_valid_shortcodes['admin'])) { |
|
699 | + if (($key = array_search('recipient_details', $this->_valid_shortcodes['admin'])) !== false) { |
|
700 | 700 | unset($this->_valid_shortcodes['admin'][$key]); |
701 | 701 | } |
702 | 702 | //make sure admin context does not include the recipient_details shortcodes |
703 | - if( ($key = array_search('recipient_list', $this->_valid_shortcodes['admin'] ) ) !== false) { |
|
703 | + if (($key = array_search('recipient_list', $this->_valid_shortcodes['admin'])) !== false) { |
|
704 | 704 | unset($this->_valid_shortcodes['admin'][$key]); |
705 | 705 | } |
706 | 706 | } |
@@ -713,8 +713,8 @@ discard block |
||
713 | 713 | * @param array $new_config array of valid shortcodes (by context) |
714 | 714 | * @return void sets valid_shortcodes property |
715 | 715 | */ |
716 | - public function reset_valid_shortcodes_config( $new_config ) { |
|
717 | - foreach ( $new_config as $context => $shortcodes ) { |
|
716 | + public function reset_valid_shortcodes_config($new_config) { |
|
717 | + foreach ($new_config as $context => $shortcodes) { |
|
718 | 718 | $this->_valid_shortcodes[$context] = $shortcodes; |
719 | 719 | } |
720 | 720 | } |
@@ -734,7 +734,7 @@ discard block |
||
734 | 734 | $addressees = array(); |
735 | 735 | |
736 | 736 | //first we need to get the event admin user id for all the events and setup an addressee object for each unique admin user. |
737 | - foreach ( $this->_data->events as $line_ref => $event ) { |
|
737 | + foreach ($this->_data->events as $line_ref => $event) { |
|
738 | 738 | $admin_id = $this->_get_event_admin_id($event['ID']); |
739 | 739 | //get the user_id for the event |
740 | 740 | $admin_ids[] = $admin_id; |
@@ -746,14 +746,14 @@ discard block |
||
746 | 746 | $admin_ids = array_unique($admin_ids); |
747 | 747 | |
748 | 748 | //k now we can loop through the event_admins and setup the addressee data. |
749 | - foreach ( $admin_ids as $event_admin ) { |
|
749 | + foreach ($admin_ids as $event_admin) { |
|
750 | 750 | $aee = array( |
751 | 751 | 'user_id' => $event_admin, |
752 | 752 | 'events' => $admin_events[$event_admin], |
753 | 753 | 'attendees' => $this->_data->attendees |
754 | 754 | ); |
755 | - $aee = array_merge( $this->_default_addressee_data, $aee ); |
|
756 | - $addressees[] = new EE_Messages_Addressee( $aee ); |
|
755 | + $aee = array_merge($this->_default_addressee_data, $aee); |
|
756 | + $addressees[] = new EE_Messages_Addressee($aee); |
|
757 | 757 | } |
758 | 758 | |
759 | 759 | return $addressees; |
@@ -773,7 +773,7 @@ discard block |
||
773 | 773 | $aee['attendees'] = $this->_data->attendees; |
774 | 774 | |
775 | 775 | //great now we can instantiate the $addressee object and return (as an array); |
776 | - $add[] = new EE_Messages_Addressee( $aee ); |
|
776 | + $add[] = new EE_Messages_Addressee($aee); |
|
777 | 777 | return $add; |
778 | 778 | } |
779 | 779 | |
@@ -792,34 +792,34 @@ discard block |
||
792 | 792 | //use to verify unique attendee emails... we don't want to sent multiple copies to the same attendee do we? |
793 | 793 | $already_processed = array(); |
794 | 794 | |
795 | - foreach ( $this->_data->attendees as $att_id => $details ) { |
|
795 | + foreach ($this->_data->attendees as $att_id => $details) { |
|
796 | 796 | //set the attendee array to blank on each loop; |
797 | 797 | $aee = array(); |
798 | 798 | |
799 | - if ( isset( $this->_data->reg_obj ) && ( $this->_data->reg_obj->attendee_ID() != $att_id ) && $this->_single_message ) continue; |
|
799 | + if (isset($this->_data->reg_obj) && ($this->_data->reg_obj->attendee_ID() != $att_id) && $this->_single_message) continue; |
|
800 | 800 | |
801 | 801 | //is $this->_regs_for_sending present? If so, let's make sure we ONLY generate addressee for registrations in that array. |
802 | - if ( ! empty( $this->_regs_for_sending ) && is_array( $this->_regs_for_sending ) ) { |
|
803 | - $regs_allowed = array_intersect_key( array_flip( $this->_regs_for_sending ), $details['reg_objs'] ); |
|
804 | - if ( empty( $regs_allowed ) ) { |
|
802 | + if ( ! empty($this->_regs_for_sending) && is_array($this->_regs_for_sending)) { |
|
803 | + $regs_allowed = array_intersect_key(array_flip($this->_regs_for_sending), $details['reg_objs']); |
|
804 | + if (empty($regs_allowed)) { |
|
805 | 805 | continue; |
806 | 806 | } |
807 | 807 | } |
808 | 808 | |
809 | - if ( in_array( $details['attendee_email'], $already_processed ) ) |
|
809 | + if (in_array($details['attendee_email'], $already_processed)) |
|
810 | 810 | continue; |
811 | 811 | |
812 | 812 | $already_processed[] = $details['attendee_email']; |
813 | 813 | |
814 | - foreach ( $details as $item => $value ) { |
|
814 | + foreach ($details as $item => $value) { |
|
815 | 815 | $aee[$item] = $value; |
816 | - if ( $item == 'line_ref' ) { |
|
817 | - foreach ( $value as $event_id ) { |
|
816 | + if ($item == 'line_ref') { |
|
817 | + foreach ($value as $event_id) { |
|
818 | 818 | $aee['events'][$event_id] = $this->_data->events[$event_id]; |
819 | 819 | } |
820 | 820 | } |
821 | 821 | |
822 | - if ( $item == 'attendee_email' ) { |
|
822 | + if ($item == 'attendee_email') { |
|
823 | 823 | $aee['attendee_email'] = $value; |
824 | 824 | } |
825 | 825 | |
@@ -834,8 +834,8 @@ discard block |
||
834 | 834 | $aee['attendees'] = $this->_data->attendees; |
835 | 835 | |
836 | 836 | //merge in the primary attendee data |
837 | - $aee = array_merge( $this->_default_addressee_data, $aee ); |
|
838 | - $add[] = new EE_Messages_Addressee( $aee ); |
|
837 | + $aee = array_merge($this->_default_addressee_data, $aee); |
|
838 | + $add[] = new EE_Messages_Addressee($aee); |
|
839 | 839 | } |
840 | 840 | |
841 | 841 | return $add; |
@@ -860,46 +860,46 @@ discard block |
||
860 | 860 | ); |
861 | 861 | |
862 | 862 | //in vanilla EE we're assuming there's only one event. However, if there are multiple events then we'll just use the default templates instead of different templates per event (which could create problems). |
863 | - if ( count($this->_data->events) === 1 ) { |
|
864 | - foreach ( $this->_data->events as $event ) { |
|
863 | + if (count($this->_data->events) === 1) { |
|
864 | + foreach ($this->_data->events as $event) { |
|
865 | 865 | $EVT_ID = $event['ID']; |
866 | 866 | } |
867 | 867 | } |
868 | 868 | // is there a Group ID in the incoming request? |
869 | - EE_Registry::instance()->load_core( 'Request_Handler' ); |
|
869 | + EE_Registry::instance()->load_core('Request_Handler'); |
|
870 | 870 | // if not, set a default value of false |
871 | - $GRP_ID = EE_Registry::instance()->REQ->get( 'GRP_ID', false ); |
|
871 | + $GRP_ID = EE_Registry::instance()->REQ->get('GRP_ID', false); |
|
872 | 872 | //if this is a preview then we just get whatever message group is for the preview and skip this part! |
873 | - if ( $this->_preview && $GRP_ID ) { |
|
874 | - $mtpg = EEM_Message_Template_Group::instance()->get_one_by_ID( $GRP_ID ); |
|
873 | + if ($this->_preview && $GRP_ID) { |
|
874 | + $mtpg = EEM_Message_Template_Group::instance()->get_one_by_ID($GRP_ID); |
|
875 | 875 | } else { |
876 | 876 | //not a preview or test send so lets continue on our way! |
877 | 877 | //is there an evt_id? If so let's get that. template. |
878 | - if ( !empty( $EVT_ID ) ) { |
|
878 | + if ( ! empty($EVT_ID)) { |
|
879 | 879 | $evt_qa = array( |
880 | 880 | 'Event.EVT_ID' => $EVT_ID |
881 | 881 | ); |
882 | - $qa = array_merge( $template_qa, $evt_qa ); |
|
883 | - $mtpg = EEM_Message_Template_Group::instance()->get_one( array( $qa ) ); |
|
882 | + $qa = array_merge($template_qa, $evt_qa); |
|
883 | + $mtpg = EEM_Message_Template_Group::instance()->get_one(array($qa)); |
|
884 | 884 | } |
885 | 885 | |
886 | 886 | //is there a 'GRP_ID' ? if so let's get that. |
887 | 887 | |
888 | 888 | //if global template is NOT an override, and there is a 'GRP_ID' in the request, then we'll assume a specific template has ben requested. |
889 | - if ( $GRP_ID ) { |
|
890 | - $mtpg = EEM_Message_Template_Group::instance()->get_one_by_ID( $GRP_ID ); |
|
889 | + if ($GRP_ID) { |
|
890 | + $mtpg = EEM_Message_Template_Group::instance()->get_one_by_ID($GRP_ID); |
|
891 | 891 | } |
892 | 892 | |
893 | 893 | |
894 | 894 | $template_qa['MTP_is_global'] = TRUE; |
895 | 895 | |
896 | 896 | //this gets the current global template (message template group) for the active messenger and message type. |
897 | - $global_mtpg = EEM_Message_Template_Group::instance()->get_one( array( $template_qa ) ); |
|
897 | + $global_mtpg = EEM_Message_Template_Group::instance()->get_one(array($template_qa)); |
|
898 | 898 | |
899 | - $mtpg = $mtpg instanceof EE_Message_Template_Group && ! $global_mtpg->get( 'MTP_is_override' ) ? $mtpg : $global_mtpg; |
|
899 | + $mtpg = $mtpg instanceof EE_Message_Template_Group && ! $global_mtpg->get('MTP_is_override') ? $mtpg : $global_mtpg; |
|
900 | 900 | } |
901 | 901 | |
902 | - if ( ! $mtpg instanceof EE_Message_Template_Group ) { |
|
902 | + if ( ! $mtpg instanceof EE_Message_Template_Group) { |
|
903 | 903 | //get out because we can't process anything, there are no message template groups |
904 | 904 | // and thus some sort of bad setup issues. |
905 | 905 | return false; |
@@ -915,8 +915,8 @@ discard block |
||
915 | 915 | |
916 | 916 | |
917 | 917 | |
918 | - foreach ( $templates as $context => $template_fields ) { |
|
919 | - foreach( $template_fields as $template_field=> $template_obj ) { |
|
918 | + foreach ($templates as $context => $template_fields) { |
|
919 | + foreach ($template_fields as $template_field=> $template_obj) { |
|
920 | 920 | $this->_templates[$template_field][$context] = $template_obj->get('MTP_content'); |
921 | 921 | } |
922 | 922 | } |
@@ -931,11 +931,11 @@ discard block |
||
931 | 931 | protected function _assemble_messages() { |
932 | 932 | //make sure any set messages object is cleared |
933 | 933 | $this->messages = array(); |
934 | - foreach ( $this->_addressees as $context => $addressees ) { |
|
935 | - foreach ( $addressees as $addressee ) { |
|
934 | + foreach ($this->_addressees as $context => $addressees) { |
|
935 | + foreach ($addressees as $addressee) { |
|
936 | 936 | $message = $this->_setup_message_object($context, $addressee); |
937 | 937 | //only assign message if everything went okay |
938 | - if ( $message ) { |
|
938 | + if ($message) { |
|
939 | 939 | $message->template_pack = $this->_template_pack; |
940 | 940 | $message->variation = $this->_variation; |
941 | 941 | $this->messages[] = $message; |
@@ -959,22 +959,22 @@ discard block |
||
959 | 959 | $m_shortcodes = $this->_active_messenger->get_valid_shortcodes(); |
960 | 960 | |
961 | 961 | //if the 'to' field is empty (messages will ALWAYS have a "to" field, then we get out because this context is turned off) EXCEPT if we're previewing |
962 | - if ( ( isset( $this->_templates['to'][$context] ) && empty( $this->_templates['to'][$context] ) ) && !$this->_preview ) |
|
962 | + if ((isset($this->_templates['to'][$context]) && empty($this->_templates['to'][$context])) && ! $this->_preview) |
|
963 | 963 | return false; |
964 | 964 | |
965 | - if ( empty( $this->_templates ) ) { |
|
965 | + if (empty($this->_templates)) { |
|
966 | 966 | //unable to setup any messages because there are no templates. Some sort of catastrophic setup |
967 | 967 | //issue exists |
968 | 968 | return false; |
969 | 969 | } |
970 | 970 | |
971 | - foreach ( $this->_templates as $field => $ctxt ) { |
|
971 | + foreach ($this->_templates as $field => $ctxt) { |
|
972 | 972 | //let's setup the valid shortcodes for the incoming context. |
973 | 973 | $valid_shortcodes = $mt_shortcodes[$context]; |
974 | 974 | //merge in valid shortcodes for the field. |
975 | 975 | $shortcodes = isset($m_shortcodes[$field]) ? $m_shortcodes[$field] : $valid_shortcodes; |
976 | - if ( isset( $this->_templates[$field][$context] ) ) { |
|
977 | - $message->{$field} = $this->_shortcode_replace->parse_message_template($this->_templates[$field][$context], $addressee, $shortcodes, $this, $this->_active_messenger, $context, $this->_GRP_ID ); |
|
976 | + if (isset($this->_templates[$field][$context])) { |
|
977 | + $message->{$field} = $this->_shortcode_replace->parse_message_template($this->_templates[$field][$context], $addressee, $shortcodes, $this, $this->_active_messenger, $context, $this->_GRP_ID); |
|
978 | 978 | } |
979 | 979 | } |
980 | 980 | return $message; |
@@ -38,8 +38,8 @@ discard block |
||
38 | 38 | * @return EED_Single_Page_Checkout |
39 | 39 | */ |
40 | 40 | public static function instance() { |
41 | - add_filter( 'EED_Single_Page_Checkout__SPCO_active', '__return_true' ); |
|
42 | - return parent::get_instance( __CLASS__ ); |
|
41 | + add_filter('EED_Single_Page_Checkout__SPCO_active', '__return_true'); |
|
42 | + return parent::get_instance(__CLASS__); |
|
43 | 43 | } |
44 | 44 | |
45 | 45 | |
@@ -84,22 +84,22 @@ discard block |
||
84 | 84 | */ |
85 | 85 | public static function set_hooks_admin() { |
86 | 86 | EED_Single_Page_Checkout::set_definitions(); |
87 | - if ( defined( 'DOING_AJAX' )) { |
|
87 | + if (defined('DOING_AJAX')) { |
|
88 | 88 | // going to start an output buffer in case anything gets accidentally output that might disrupt our JSON response |
89 | 89 | ob_start(); |
90 | 90 | EED_Single_Page_Checkout::load_request_handler(); |
91 | 91 | EED_Single_Page_Checkout::load_reg_steps(); |
92 | 92 | } else { |
93 | 93 | // hook into the top of pre_get_posts to set the reg step routing, which gives other modules or plugins a chance to modify the reg steps, but just before the routes get called |
94 | - add_action( 'pre_get_posts', array( 'EED_Single_Page_Checkout', 'load_reg_steps' ), 1 ); |
|
94 | + add_action('pre_get_posts', array('EED_Single_Page_Checkout', 'load_reg_steps'), 1); |
|
95 | 95 | } |
96 | 96 | // set ajax hooks |
97 | - add_action( 'wp_ajax_process_reg_step', array( 'EED_Single_Page_Checkout', 'process_reg_step' )); |
|
98 | - add_action( 'wp_ajax_nopriv_process_reg_step', array( 'EED_Single_Page_Checkout', 'process_reg_step' )); |
|
99 | - add_action( 'wp_ajax_display_spco_reg_step', array( 'EED_Single_Page_Checkout', 'display_reg_step' )); |
|
100 | - add_action( 'wp_ajax_nopriv_display_spco_reg_step', array( 'EED_Single_Page_Checkout', 'display_reg_step' )); |
|
101 | - add_action( 'wp_ajax_update_reg_step', array( 'EED_Single_Page_Checkout', 'update_reg_step' )); |
|
102 | - add_action( 'wp_ajax_nopriv_update_reg_step', array( 'EED_Single_Page_Checkout', 'update_reg_step' )); |
|
97 | + add_action('wp_ajax_process_reg_step', array('EED_Single_Page_Checkout', 'process_reg_step')); |
|
98 | + add_action('wp_ajax_nopriv_process_reg_step', array('EED_Single_Page_Checkout', 'process_reg_step')); |
|
99 | + add_action('wp_ajax_display_spco_reg_step', array('EED_Single_Page_Checkout', 'display_reg_step')); |
|
100 | + add_action('wp_ajax_nopriv_display_spco_reg_step', array('EED_Single_Page_Checkout', 'display_reg_step')); |
|
101 | + add_action('wp_ajax_update_reg_step', array('EED_Single_Page_Checkout', 'update_reg_step')); |
|
102 | + add_action('wp_ajax_nopriv_update_reg_step', array('EED_Single_Page_Checkout', 'update_reg_step')); |
|
103 | 103 | } |
104 | 104 | |
105 | 105 | |
@@ -108,8 +108,8 @@ discard block |
||
108 | 108 | * process ajax request |
109 | 109 | * @param string $ajax_action |
110 | 110 | */ |
111 | - public static function process_ajax_request( $ajax_action ) { |
|
112 | - EE_Registry::instance()->REQ->set( 'action', $ajax_action ); |
|
111 | + public static function process_ajax_request($ajax_action) { |
|
112 | + EE_Registry::instance()->REQ->set('action', $ajax_action); |
|
113 | 113 | EED_Single_Page_Checkout::instance()->_initialize(); |
114 | 114 | } |
115 | 115 | |
@@ -119,7 +119,7 @@ discard block |
||
119 | 119 | * ajax display registration step |
120 | 120 | */ |
121 | 121 | public static function display_reg_step() { |
122 | - EED_Single_Page_Checkout::process_ajax_request( 'display_spco_reg_step' ); |
|
122 | + EED_Single_Page_Checkout::process_ajax_request('display_spco_reg_step'); |
|
123 | 123 | } |
124 | 124 | |
125 | 125 | |
@@ -128,7 +128,7 @@ discard block |
||
128 | 128 | * ajax process registration step |
129 | 129 | */ |
130 | 130 | public static function process_reg_step() { |
131 | - EED_Single_Page_Checkout::process_ajax_request( 'process_reg_step' ); |
|
131 | + EED_Single_Page_Checkout::process_ajax_request('process_reg_step'); |
|
132 | 132 | } |
133 | 133 | |
134 | 134 | |
@@ -137,7 +137,7 @@ discard block |
||
137 | 137 | * ajax process registration step |
138 | 138 | */ |
139 | 139 | public static function update_reg_step() { |
140 | - EED_Single_Page_Checkout::process_ajax_request( 'update_reg_step' ); |
|
140 | + EED_Single_Page_Checkout::process_ajax_request('update_reg_step'); |
|
141 | 141 | } |
142 | 142 | |
143 | 143 | |
@@ -149,7 +149,7 @@ discard block |
||
149 | 149 | * @return void |
150 | 150 | */ |
151 | 151 | public static function update_checkout() { |
152 | - EED_Single_Page_Checkout::process_ajax_request( 'update_checkout' ); |
|
152 | + EED_Single_Page_Checkout::process_ajax_request('update_checkout'); |
|
153 | 153 | } |
154 | 154 | |
155 | 155 | |
@@ -162,8 +162,8 @@ discard block |
||
162 | 162 | */ |
163 | 163 | public static function load_request_handler() { |
164 | 164 | // load core Request_Handler class |
165 | - if ( ! isset( EE_Registry::instance()->REQ )) { |
|
166 | - EE_Registry::instance()->load_core( 'Request_Handler' ); |
|
165 | + if ( ! isset(EE_Registry::instance()->REQ)) { |
|
166 | + EE_Registry::instance()->load_core('Request_Handler'); |
|
167 | 167 | } |
168 | 168 | } |
169 | 169 | |
@@ -176,14 +176,14 @@ discard block |
||
176 | 176 | * @return void |
177 | 177 | */ |
178 | 178 | public static function set_definitions() { |
179 | - define( 'SPCO_BASE_PATH', rtrim( str_replace( array( '\\', '/' ), DS, plugin_dir_path( __FILE__ )), DS ) . DS ); |
|
180 | - define( 'SPCO_CSS_URL', plugin_dir_url( __FILE__ ) . 'css' . DS ); |
|
181 | - define( 'SPCO_IMG_URL', plugin_dir_url( __FILE__ ) . 'img' . DS ); |
|
182 | - define( 'SPCO_JS_URL', plugin_dir_url( __FILE__ ) . 'js' . DS ); |
|
183 | - define( 'SPCO_INC_PATH', SPCO_BASE_PATH . 'inc' . DS ); |
|
184 | - define( 'SPCO_REG_STEPS_PATH', SPCO_BASE_PATH . 'reg_steps' . DS ); |
|
185 | - define( 'SPCO_TEMPLATES_PATH', SPCO_BASE_PATH . 'templates' . DS ); |
|
186 | - EEH_Autoloader::register_autoloaders_for_each_file_in_folder( SPCO_BASE_PATH, TRUE ); |
|
179 | + define('SPCO_BASE_PATH', rtrim(str_replace(array('\\', '/'), DS, plugin_dir_path(__FILE__)), DS).DS); |
|
180 | + define('SPCO_CSS_URL', plugin_dir_url(__FILE__).'css'.DS); |
|
181 | + define('SPCO_IMG_URL', plugin_dir_url(__FILE__).'img'.DS); |
|
182 | + define('SPCO_JS_URL', plugin_dir_url(__FILE__).'js'.DS); |
|
183 | + define('SPCO_INC_PATH', SPCO_BASE_PATH.'inc'.DS); |
|
184 | + define('SPCO_REG_STEPS_PATH', SPCO_BASE_PATH.'reg_steps'.DS); |
|
185 | + define('SPCO_TEMPLATES_PATH', SPCO_BASE_PATH.'templates'.DS); |
|
186 | + EEH_Autoloader::register_autoloaders_for_each_file_in_folder(SPCO_BASE_PATH, TRUE); |
|
187 | 187 | } |
188 | 188 | |
189 | 189 | |
@@ -198,7 +198,7 @@ discard block |
||
198 | 198 | */ |
199 | 199 | public static function load_reg_steps() { |
200 | 200 | static $reg_steps_loaded = FALSE; |
201 | - if ( $reg_steps_loaded ) { |
|
201 | + if ($reg_steps_loaded) { |
|
202 | 202 | return; |
203 | 203 | } |
204 | 204 | // filter list of reg_steps |
@@ -207,24 +207,24 @@ discard block |
||
207 | 207 | EED_Single_Page_Checkout::get_reg_steps() |
208 | 208 | ); |
209 | 209 | // sort by key (order) |
210 | - ksort( $reg_steps_to_load ); |
|
210 | + ksort($reg_steps_to_load); |
|
211 | 211 | // loop through folders |
212 | - foreach ( $reg_steps_to_load as $order => $reg_step ) { |
|
212 | + foreach ($reg_steps_to_load as $order => $reg_step) { |
|
213 | 213 | // we need a |
214 | - if ( isset( $reg_step['file_path'], $reg_step['class_name'], $reg_step['slug'] )) { |
|
214 | + if (isset($reg_step['file_path'], $reg_step['class_name'], $reg_step['slug'])) { |
|
215 | 215 | // copy over to the reg_steps_array |
216 | - EED_Single_Page_Checkout::$_reg_steps_array[ $order ] = $reg_step; |
|
216 | + EED_Single_Page_Checkout::$_reg_steps_array[$order] = $reg_step; |
|
217 | 217 | // register custom key route for each reg step |
218 | 218 | // ie: step=>"slug" - this is the entire reason we load the reg steps array now |
219 | - EE_Config::register_route( $reg_step['slug'], 'EED_Single_Page_Checkout', 'run', 'step' ); |
|
219 | + EE_Config::register_route($reg_step['slug'], 'EED_Single_Page_Checkout', 'run', 'step'); |
|
220 | 220 | // add AJAX or other hooks |
221 | - if ( isset( $reg_step['has_hooks'] ) && $reg_step['has_hooks'] ) { |
|
221 | + if (isset($reg_step['has_hooks']) && $reg_step['has_hooks']) { |
|
222 | 222 | // setup autoloaders if necessary |
223 | - if ( ! class_exists( $reg_step['class_name'] )) { |
|
224 | - EEH_Autoloader::register_autoloaders_for_each_file_in_folder( $reg_step['file_path'], TRUE ); |
|
223 | + if ( ! class_exists($reg_step['class_name'])) { |
|
224 | + EEH_Autoloader::register_autoloaders_for_each_file_in_folder($reg_step['file_path'], TRUE); |
|
225 | 225 | } |
226 | - if ( is_callable( $reg_step['class_name'], 'set_hooks' )) { |
|
227 | - call_user_func( array( $reg_step['class_name'], 'set_hooks' )); |
|
226 | + if (is_callable($reg_step['class_name'], 'set_hooks')) { |
|
227 | + call_user_func(array($reg_step['class_name'], 'set_hooks')); |
|
228 | 228 | } |
229 | 229 | } |
230 | 230 | } |
@@ -243,28 +243,28 @@ discard block |
||
243 | 243 | */ |
244 | 244 | public static function get_reg_steps() { |
245 | 245 | $reg_steps = EE_Registry::instance()->CFG->registration->reg_steps; |
246 | - if ( empty( $reg_steps )) { |
|
246 | + if (empty($reg_steps)) { |
|
247 | 247 | $reg_steps = array( |
248 | 248 | 10 => array( |
249 | - 'file_path' => SPCO_REG_STEPS_PATH . 'attendee_information', |
|
249 | + 'file_path' => SPCO_REG_STEPS_PATH.'attendee_information', |
|
250 | 250 | 'class_name' => 'EE_SPCO_Reg_Step_Attendee_Information', |
251 | 251 | 'slug' => 'attendee_information', |
252 | 252 | 'has_hooks' => FALSE |
253 | 253 | ), |
254 | 254 | 20 => array( |
255 | - 'file_path' => SPCO_REG_STEPS_PATH . 'registration_confirmation', |
|
255 | + 'file_path' => SPCO_REG_STEPS_PATH.'registration_confirmation', |
|
256 | 256 | 'class_name' => 'EE_SPCO_Reg_Step_Registration_Confirmation', |
257 | 257 | 'slug' => 'registration_confirmation', |
258 | 258 | 'has_hooks' => FALSE |
259 | 259 | ), |
260 | 260 | 30 => array( |
261 | - 'file_path' => SPCO_REG_STEPS_PATH . 'payment_options', |
|
261 | + 'file_path' => SPCO_REG_STEPS_PATH.'payment_options', |
|
262 | 262 | 'class_name' => 'EE_SPCO_Reg_Step_Payment_Options', |
263 | 263 | 'slug' => 'payment_options', |
264 | 264 | 'has_hooks' => TRUE |
265 | 265 | ), |
266 | 266 | 999 => array( |
267 | - 'file_path' => SPCO_REG_STEPS_PATH . 'finalize_registration', |
|
267 | + 'file_path' => SPCO_REG_STEPS_PATH.'finalize_registration', |
|
268 | 268 | 'class_name' => 'EE_SPCO_Reg_Step_Finalize_Registration', |
269 | 269 | 'slug' => 'finalize_registration', |
270 | 270 | 'has_hooks' => FALSE |
@@ -284,9 +284,9 @@ discard block |
||
284 | 284 | */ |
285 | 285 | public static function registration_checkout_for_admin() { |
286 | 286 | EED_Single_Page_Checkout::load_reg_steps(); |
287 | - EE_Registry::instance()->REQ->set( 'step', 'attendee_information' ); |
|
288 | - EE_Registry::instance()->REQ->set( 'action', 'display_spco_reg_step' ); |
|
289 | - EE_Registry::instance()->REQ->set( 'process_form_submission', false ); |
|
287 | + EE_Registry::instance()->REQ->set('step', 'attendee_information'); |
|
288 | + EE_Registry::instance()->REQ->set('action', 'display_spco_reg_step'); |
|
289 | + EE_Registry::instance()->REQ->set('process_form_submission', false); |
|
290 | 290 | EED_Single_Page_Checkout::instance()->_initialize(); |
291 | 291 | EED_Single_Page_Checkout::instance()->_display_spco_reg_form(); |
292 | 292 | return EE_Registry::instance()->REQ->get_output(); |
@@ -302,14 +302,14 @@ discard block |
||
302 | 302 | */ |
303 | 303 | public static function process_registration_from_admin() { |
304 | 304 | EED_Single_Page_Checkout::load_reg_steps(); |
305 | - EE_Registry::instance()->REQ->set( 'step', 'attendee_information' ); |
|
306 | - EE_Registry::instance()->REQ->set( 'action', 'process_reg_step' ); |
|
307 | - EE_Registry::instance()->REQ->set( 'process_form_submission', true ); |
|
305 | + EE_Registry::instance()->REQ->set('step', 'attendee_information'); |
|
306 | + EE_Registry::instance()->REQ->set('action', 'process_reg_step'); |
|
307 | + EE_Registry::instance()->REQ->set('process_form_submission', true); |
|
308 | 308 | EED_Single_Page_Checkout::instance()->_initialize(); |
309 | - if ( EED_Single_Page_Checkout::instance()->checkout->current_step->completed() ) { |
|
310 | - $final_reg_step = end( EED_Single_Page_Checkout::instance()->checkout->reg_steps ); |
|
311 | - if ( $final_reg_step instanceof EE_SPCO_Reg_Step_Finalize_Registration ) { |
|
312 | - if ( $final_reg_step->process_reg_step() ) { |
|
309 | + if (EED_Single_Page_Checkout::instance()->checkout->current_step->completed()) { |
|
310 | + $final_reg_step = end(EED_Single_Page_Checkout::instance()->checkout->reg_steps); |
|
311 | + if ($final_reg_step instanceof EE_SPCO_Reg_Step_Finalize_Registration) { |
|
312 | + if ($final_reg_step->process_reg_step()) { |
|
313 | 313 | return EED_Single_Page_Checkout::instance()->checkout->transaction; |
314 | 314 | } |
315 | 315 | } |
@@ -326,11 +326,11 @@ discard block |
||
326 | 326 | * @param WP_Query $WP_Query |
327 | 327 | * @return void |
328 | 328 | */ |
329 | - public function run( $WP_Query ) { |
|
329 | + public function run($WP_Query) { |
|
330 | 330 | if ( |
331 | 331 | $WP_Query instanceof WP_Query |
332 | 332 | && $WP_Query->is_main_query() |
333 | - && apply_filters( 'FHEE__EED_Single_Page_Checkout__run', true ) |
|
333 | + && apply_filters('FHEE__EED_Single_Page_Checkout__run', true) |
|
334 | 334 | ) { |
335 | 335 | $this->_initialize(); |
336 | 336 | } |
@@ -346,8 +346,8 @@ discard block |
||
346 | 346 | * @param WP_Query $WP_Query |
347 | 347 | * @return void |
348 | 348 | */ |
349 | - public static function init( $WP_Query ) { |
|
350 | - EED_Single_Page_Checkout::instance()->run( $WP_Query ); |
|
349 | + public static function init($WP_Query) { |
|
350 | + EED_Single_Page_Checkout::instance()->run($WP_Query); |
|
351 | 351 | } |
352 | 352 | |
353 | 353 | |
@@ -361,35 +361,35 @@ discard block |
||
361 | 361 | */ |
362 | 362 | private function _initialize() { |
363 | 363 | // ensure SPCO doesn't run twice |
364 | - if ( EED_Single_Page_Checkout::$_initialized ) { |
|
364 | + if (EED_Single_Page_Checkout::$_initialized) { |
|
365 | 365 | return; |
366 | 366 | } |
367 | 367 | // setup the EE_Checkout object |
368 | 368 | $this->checkout = $this->_initialize_checkout(); |
369 | 369 | // filter checkout |
370 | - $this->checkout = apply_filters( 'FHEE__EED_Single_Page_Checkout___initialize__checkout', $this->checkout ); |
|
370 | + $this->checkout = apply_filters('FHEE__EED_Single_Page_Checkout___initialize__checkout', $this->checkout); |
|
371 | 371 | // get the $_GET |
372 | 372 | $this->_get_request_vars(); |
373 | 373 | // filter continue_reg |
374 | - $this->checkout->continue_reg = apply_filters( 'FHEE__EED_Single_Page_Checkout__init___continue_reg', TRUE, $this->checkout ); |
|
374 | + $this->checkout->continue_reg = apply_filters('FHEE__EED_Single_Page_Checkout__init___continue_reg', TRUE, $this->checkout); |
|
375 | 375 | // load the reg steps array |
376 | - if ( ! $this->_load_and_instantiate_reg_steps() ) { |
|
376 | + if ( ! $this->_load_and_instantiate_reg_steps()) { |
|
377 | 377 | EED_Single_Page_Checkout::$_initialized = true; |
378 | 378 | return; |
379 | 379 | } |
380 | 380 | // set the current step |
381 | - $this->checkout->set_current_step( $this->checkout->step ); |
|
381 | + $this->checkout->set_current_step($this->checkout->step); |
|
382 | 382 | // and the next step |
383 | 383 | $this->checkout->set_next_step(); |
384 | 384 | // was there already a valid transaction in the checkout from the session ? |
385 | - if ( ! $this->checkout->transaction instanceof EE_Transaction ) { |
|
385 | + if ( ! $this->checkout->transaction instanceof EE_Transaction) { |
|
386 | 386 | // get transaction from db or session |
387 | 387 | $this->checkout->transaction = $this->checkout->reg_url_link && ! is_admin() |
388 | 388 | ? $this->_get_transaction_and_cart_for_previous_visit() |
389 | 389 | : $this->_get_cart_for_current_session_and_setup_new_transaction(); |
390 | - if ( ! $this->checkout->transaction instanceof EE_Transaction ) { |
|
390 | + if ( ! $this->checkout->transaction instanceof EE_Transaction) { |
|
391 | 391 | EE_Error::add_error( |
392 | - __( 'Your Registration and Transaction information could not be retrieved from the db.', 'event_espresso' ), |
|
392 | + __('Your Registration and Transaction information could not be retrieved from the db.', 'event_espresso'), |
|
393 | 393 | __FILE__, __FUNCTION__, __LINE__ |
394 | 394 | ); |
395 | 395 | // add some style and make it dance |
@@ -399,10 +399,10 @@ discard block |
||
399 | 399 | return; |
400 | 400 | } |
401 | 401 | // and the registrations for the transaction |
402 | - $this->_get_registrations( $this->checkout->transaction ); |
|
402 | + $this->_get_registrations($this->checkout->transaction); |
|
403 | 403 | } |
404 | 404 | // verify that everything has been setup correctly |
405 | - if ( ! $this->_final_verifications() ) { |
|
405 | + if ( ! $this->_final_verifications()) { |
|
406 | 406 | EED_Single_Page_Checkout::$_initialized = true; |
407 | 407 | return; |
408 | 408 | } |
@@ -427,9 +427,9 @@ discard block |
||
427 | 427 | // set no cache headers and constants |
428 | 428 | EE_System::do_not_cache(); |
429 | 429 | // add anchor |
430 | - add_action( 'loop_start', array( $this, 'set_checkout_anchor' ), 1 ); |
|
430 | + add_action('loop_start', array($this, 'set_checkout_anchor'), 1); |
|
431 | 431 | // remove transaction lock |
432 | - add_action( 'shutdown', array( $this, 'unlock_transaction' ), 1 ); |
|
432 | + add_action('shutdown', array($this, 'unlock_transaction'), 1); |
|
433 | 433 | } |
434 | 434 | |
435 | 435 | |
@@ -446,20 +446,20 @@ discard block |
||
446 | 446 | // look in session for existing checkout |
447 | 447 | $checkout = EE_Registry::instance()->SSN->checkout(); |
448 | 448 | // verify |
449 | - if ( ! $checkout instanceof EE_Checkout ) { |
|
449 | + if ( ! $checkout instanceof EE_Checkout) { |
|
450 | 450 | // instantiate EE_Checkout object for handling the properties of the current checkout process |
451 | - $checkout = EE_Registry::instance()->load_file( SPCO_INC_PATH, 'EE_Checkout', 'class', array(), FALSE ); |
|
451 | + $checkout = EE_Registry::instance()->load_file(SPCO_INC_PATH, 'EE_Checkout', 'class', array(), FALSE); |
|
452 | 452 | // verify again |
453 | - if ( ! $checkout instanceof EE_Checkout ) { |
|
454 | - throw new EE_Error( __( 'The EE_Checkout class could not be loaded.', 'event_espresso' ) ); |
|
453 | + if ( ! $checkout instanceof EE_Checkout) { |
|
454 | + throw new EE_Error(__('The EE_Checkout class could not be loaded.', 'event_espresso')); |
|
455 | 455 | } |
456 | 456 | } else { |
457 | - if ( $checkout->current_step->is_final_step() && $checkout->exit_spco() === true ) { |
|
458 | - wp_safe_redirect( $checkout->redirect_url ); |
|
457 | + if ($checkout->current_step->is_final_step() && $checkout->exit_spco() === true) { |
|
458 | + wp_safe_redirect($checkout->redirect_url); |
|
459 | 459 | exit(); |
460 | 460 | } |
461 | 461 | } |
462 | - $checkout = apply_filters( 'FHEE__EED_Single_Page_Checkout___initialize_checkout__checkout', $checkout ); |
|
462 | + $checkout = apply_filters('FHEE__EED_Single_Page_Checkout___initialize_checkout__checkout', $checkout); |
|
463 | 463 | // reset anything that needs a clean slate for each request |
464 | 464 | $checkout->reset_for_current_request(); |
465 | 465 | return $checkout; |
@@ -477,24 +477,24 @@ discard block |
||
477 | 477 | // load classes |
478 | 478 | EED_Single_Page_Checkout::load_request_handler(); |
479 | 479 | //make sure this request is marked as belonging to EE |
480 | - EE_Registry::instance()->REQ->set_espresso_page( TRUE ); |
|
480 | + EE_Registry::instance()->REQ->set_espresso_page(TRUE); |
|
481 | 481 | // which step is being requested ? |
482 | - $this->checkout->step = EE_Registry::instance()->REQ->get( 'step', $this->_get_first_step() ); |
|
482 | + $this->checkout->step = EE_Registry::instance()->REQ->get('step', $this->_get_first_step()); |
|
483 | 483 | // which step is being edited ? |
484 | - $this->checkout->edit_step = EE_Registry::instance()->REQ->get( 'edit_step', '' ); |
|
484 | + $this->checkout->edit_step = EE_Registry::instance()->REQ->get('edit_step', ''); |
|
485 | 485 | // and what we're doing on the current step |
486 | - $this->checkout->action = EE_Registry::instance()->REQ->get( 'action', 'display_spco_reg_step' ); |
|
486 | + $this->checkout->action = EE_Registry::instance()->REQ->get('action', 'display_spco_reg_step'); |
|
487 | 487 | // returning to edit ? |
488 | - $this->checkout->reg_url_link = EE_Registry::instance()->REQ->get( 'e_reg_url_link', '' ); |
|
488 | + $this->checkout->reg_url_link = EE_Registry::instance()->REQ->get('e_reg_url_link', ''); |
|
489 | 489 | // or some other kind of revisit ? |
490 | - $this->checkout->revisit = EE_Registry::instance()->REQ->get( 'revisit', FALSE ); |
|
490 | + $this->checkout->revisit = EE_Registry::instance()->REQ->get('revisit', FALSE); |
|
491 | 491 | // and whether or not to generate a reg form for this request |
492 | - $this->checkout->generate_reg_form = EE_Registry::instance()->REQ->get( 'generate_reg_form', TRUE ); // TRUE FALSE |
|
492 | + $this->checkout->generate_reg_form = EE_Registry::instance()->REQ->get('generate_reg_form', TRUE); // TRUE FALSE |
|
493 | 493 | // and whether or not to process a reg form submission for this request |
494 | - $this->checkout->process_form_submission = EE_Registry::instance()->REQ->get( 'process_form_submission', FALSE ); // TRUE FALSE |
|
494 | + $this->checkout->process_form_submission = EE_Registry::instance()->REQ->get('process_form_submission', FALSE); // TRUE FALSE |
|
495 | 495 | $this->checkout->process_form_submission = $this->checkout->action !== 'display_spco_reg_step' |
496 | 496 | ? $this->checkout->process_form_submission |
497 | - : FALSE; // TRUE FALSE |
|
497 | + : FALSE; // TRUE FALSE |
|
498 | 498 | //$this->_display_request_vars(); |
499 | 499 | } |
500 | 500 | |
@@ -507,17 +507,17 @@ discard block |
||
507 | 507 | * @return void |
508 | 508 | */ |
509 | 509 | protected function _display_request_vars() { |
510 | - if ( ! WP_DEBUG ) { |
|
510 | + if ( ! WP_DEBUG) { |
|
511 | 511 | return; |
512 | 512 | } |
513 | - EEH_Debug_Tools::printr( $_REQUEST, '$_REQUEST', __FILE__, __LINE__ ); |
|
514 | - EEH_Debug_Tools::printr( $this->checkout->step, '$this->checkout->step', __FILE__, __LINE__ ); |
|
515 | - EEH_Debug_Tools::printr( $this->checkout->edit_step, '$this->checkout->edit_step', __FILE__, __LINE__ ); |
|
516 | - EEH_Debug_Tools::printr( $this->checkout->action, '$this->checkout->action', __FILE__, __LINE__ ); |
|
517 | - EEH_Debug_Tools::printr( $this->checkout->reg_url_link, '$this->checkout->reg_url_link', __FILE__, __LINE__ ); |
|
518 | - EEH_Debug_Tools::printr( $this->checkout->revisit, '$this->checkout->revisit', __FILE__, __LINE__ ); |
|
519 | - EEH_Debug_Tools::printr( $this->checkout->generate_reg_form, '$this->checkout->generate_reg_form', __FILE__, __LINE__ ); |
|
520 | - EEH_Debug_Tools::printr( $this->checkout->process_form_submission, '$this->checkout->process_form_submission', __FILE__, __LINE__ ); |
|
513 | + EEH_Debug_Tools::printr($_REQUEST, '$_REQUEST', __FILE__, __LINE__); |
|
514 | + EEH_Debug_Tools::printr($this->checkout->step, '$this->checkout->step', __FILE__, __LINE__); |
|
515 | + EEH_Debug_Tools::printr($this->checkout->edit_step, '$this->checkout->edit_step', __FILE__, __LINE__); |
|
516 | + EEH_Debug_Tools::printr($this->checkout->action, '$this->checkout->action', __FILE__, __LINE__); |
|
517 | + EEH_Debug_Tools::printr($this->checkout->reg_url_link, '$this->checkout->reg_url_link', __FILE__, __LINE__); |
|
518 | + EEH_Debug_Tools::printr($this->checkout->revisit, '$this->checkout->revisit', __FILE__, __LINE__); |
|
519 | + EEH_Debug_Tools::printr($this->checkout->generate_reg_form, '$this->checkout->generate_reg_form', __FILE__, __LINE__); |
|
520 | + EEH_Debug_Tools::printr($this->checkout->process_form_submission, '$this->checkout->process_form_submission', __FILE__, __LINE__); |
|
521 | 521 | } |
522 | 522 | |
523 | 523 | |
@@ -531,8 +531,8 @@ discard block |
||
531 | 531 | * @return array |
532 | 532 | */ |
533 | 533 | private function _get_first_step() { |
534 | - $first_step = reset( EED_Single_Page_Checkout::$_reg_steps_array ); |
|
535 | - return isset( $first_step['slug'] ) ? $first_step['slug'] : 'attendee_information'; |
|
534 | + $first_step = reset(EED_Single_Page_Checkout::$_reg_steps_array); |
|
535 | + return isset($first_step['slug']) ? $first_step['slug'] : 'attendee_information'; |
|
536 | 536 | } |
537 | 537 | |
538 | 538 | |
@@ -548,27 +548,27 @@ discard block |
||
548 | 548 | private function _load_and_instantiate_reg_steps() { |
549 | 549 | // have reg_steps already been instantiated ? |
550 | 550 | if ( |
551 | - empty( $this->checkout->reg_steps ) || |
|
552 | - apply_filters( 'FHEE__Single_Page_Checkout__load_reg_steps__reload_reg_steps', false, $this->checkout ) |
|
551 | + empty($this->checkout->reg_steps) || |
|
552 | + apply_filters('FHEE__Single_Page_Checkout__load_reg_steps__reload_reg_steps', false, $this->checkout) |
|
553 | 553 | ) { |
554 | 554 | // if not, then loop through raw reg steps array |
555 | - foreach ( EED_Single_Page_Checkout::$_reg_steps_array as $order => $reg_step ) { |
|
556 | - if ( ! $this->_load_and_instantiate_reg_step( $reg_step, $order )) { |
|
555 | + foreach (EED_Single_Page_Checkout::$_reg_steps_array as $order => $reg_step) { |
|
556 | + if ( ! $this->_load_and_instantiate_reg_step($reg_step, $order)) { |
|
557 | 557 | return false; |
558 | 558 | } |
559 | 559 | } |
560 | 560 | EE_Registry::instance()->CFG->registration->skip_reg_confirmation = TRUE; |
561 | 561 | EE_Registry::instance()->CFG->registration->reg_confirmation_last = TRUE; |
562 | 562 | // skip the registration_confirmation page ? |
563 | - if ( EE_Registry::instance()->CFG->registration->skip_reg_confirmation ) { |
|
563 | + if (EE_Registry::instance()->CFG->registration->skip_reg_confirmation) { |
|
564 | 564 | // just remove it from the reg steps array |
565 | - $this->checkout->remove_reg_step( 'registration_confirmation', false ); |
|
565 | + $this->checkout->remove_reg_step('registration_confirmation', false); |
|
566 | 566 | } else if ( |
567 | 567 | EE_Registry::instance()->CFG->registration->reg_confirmation_last |
568 | - && isset( $this->checkout->reg_steps['registration_confirmation'] ) |
|
568 | + && isset($this->checkout->reg_steps['registration_confirmation']) |
|
569 | 569 | ) { |
570 | 570 | // set the order to something big like 100 |
571 | - $this->checkout->set_reg_step_order( 'registration_confirmation', 100 ); |
|
571 | + $this->checkout->set_reg_step_order('registration_confirmation', 100); |
|
572 | 572 | } |
573 | 573 | // filter the array for good luck |
574 | 574 | $this->checkout->reg_steps = apply_filters( |
@@ -578,13 +578,13 @@ discard block |
||
578 | 578 | // finally re-sort based on the reg step class order properties |
579 | 579 | $this->checkout->sort_reg_steps(); |
580 | 580 | } else { |
581 | - foreach ( $this->checkout->reg_steps as $reg_step ) { |
|
581 | + foreach ($this->checkout->reg_steps as $reg_step) { |
|
582 | 582 | // set all current step stati to FALSE |
583 | - $reg_step->set_is_current_step( FALSE ); |
|
583 | + $reg_step->set_is_current_step(FALSE); |
|
584 | 584 | } |
585 | 585 | } |
586 | - if ( empty( $this->checkout->reg_steps )) { |
|
587 | - EE_Error::add_error( __( 'No Reg Steps were loaded..', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__); |
|
586 | + if (empty($this->checkout->reg_steps)) { |
|
587 | + EE_Error::add_error(__('No Reg Steps were loaded..', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
588 | 588 | return false; |
589 | 589 | } |
590 | 590 | // make reg step details available to JS |
@@ -602,10 +602,10 @@ discard block |
||
602 | 602 | * @param int $order |
603 | 603 | * @return bool |
604 | 604 | */ |
605 | - private function _load_and_instantiate_reg_step( $reg_step = array(), $order = 0 ) { |
|
605 | + private function _load_and_instantiate_reg_step($reg_step = array(), $order = 0) { |
|
606 | 606 | |
607 | 607 | // we need a file_path, class_name, and slug to add a reg step |
608 | - if ( isset( $reg_step['file_path'], $reg_step['class_name'], $reg_step['slug'] )) { |
|
608 | + if (isset($reg_step['file_path'], $reg_step['class_name'], $reg_step['slug'])) { |
|
609 | 609 | // if editing a specific step, but this is NOT that step... (and it's not the 'finalize_registration' step) |
610 | 610 | if ( |
611 | 611 | $this->checkout->reg_url_link |
@@ -623,26 +623,26 @@ discard block |
||
623 | 623 | FALSE |
624 | 624 | ); |
625 | 625 | // did we gets the goods ? |
626 | - if ( $reg_step_obj instanceof EE_SPCO_Reg_Step ) { |
|
626 | + if ($reg_step_obj instanceof EE_SPCO_Reg_Step) { |
|
627 | 627 | // set reg step order based on config |
628 | - $reg_step_obj->set_order( $order ); |
|
628 | + $reg_step_obj->set_order($order); |
|
629 | 629 | // add instantiated reg step object to the master reg steps array |
630 | - $this->checkout->add_reg_step( $reg_step_obj ); |
|
630 | + $this->checkout->add_reg_step($reg_step_obj); |
|
631 | 631 | } else { |
632 | 632 | EE_Error::add_error( |
633 | - __( 'The current step could not be set.', 'event_espresso' ), |
|
633 | + __('The current step could not be set.', 'event_espresso'), |
|
634 | 634 | __FILE__, __FUNCTION__, __LINE__ |
635 | 635 | ); |
636 | 636 | return false; |
637 | 637 | } |
638 | 638 | } else { |
639 | - if ( WP_DEBUG ) { |
|
639 | + if (WP_DEBUG) { |
|
640 | 640 | EE_Error::add_error( |
641 | 641 | sprintf( |
642 | - __( 'A registration step could not be loaded. One or more of the following data points is invalid:%4$s%5$sFile Path: %1$s%6$s%5$sClass Name: %2$s%6$s%5$sSlug: %3$s%6$s%7$s', 'event_espresso' ), |
|
643 | - isset( $reg_step['file_path'] ) ? $reg_step['file_path'] : '', |
|
644 | - isset( $reg_step['class_name'] ) ? $reg_step['class_name'] : '', |
|
645 | - isset( $reg_step['slug'] ) ? $reg_step['slug'] : '', |
|
642 | + __('A registration step could not be loaded. One or more of the following data points is invalid:%4$s%5$sFile Path: %1$s%6$s%5$sClass Name: %2$s%6$s%5$sSlug: %3$s%6$s%7$s', 'event_espresso'), |
|
643 | + isset($reg_step['file_path']) ? $reg_step['file_path'] : '', |
|
644 | + isset($reg_step['class_name']) ? $reg_step['class_name'] : '', |
|
645 | + isset($reg_step['slug']) ? $reg_step['slug'] : '', |
|
646 | 646 | '<ul>', |
647 | 647 | '<li>', |
648 | 648 | '</li>', |
@@ -666,16 +666,16 @@ discard block |
||
666 | 666 | */ |
667 | 667 | private function _get_transaction_and_cart_for_previous_visit() { |
668 | 668 | /** @var $TXN_model EEM_Transaction */ |
669 | - $TXN_model = EE_Registry::instance()->load_model( 'Transaction' ); |
|
669 | + $TXN_model = EE_Registry::instance()->load_model('Transaction'); |
|
670 | 670 | // because the reg_url_link is present in the request, this is a return visit to SPCO, so we'll get the transaction data from the db |
671 | - $transaction = $TXN_model->get_transaction_from_reg_url_link( $this->checkout->reg_url_link ); |
|
671 | + $transaction = $TXN_model->get_transaction_from_reg_url_link($this->checkout->reg_url_link); |
|
672 | 672 | // verify transaction |
673 | - if ( $transaction instanceof EE_Transaction ) { |
|
673 | + if ($transaction instanceof EE_Transaction) { |
|
674 | 674 | // and get the cart that was used for that transaction |
675 | - $this->checkout->cart = $this->_get_cart_for_transaction( $transaction ); |
|
675 | + $this->checkout->cart = $this->_get_cart_for_transaction($transaction); |
|
676 | 676 | return $transaction; |
677 | 677 | } else { |
678 | - EE_Error::add_error( __( 'Your Registration and Transaction information could not be retrieved from the db.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__); |
|
678 | + EE_Error::add_error(__('Your Registration and Transaction information could not be retrieved from the db.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
679 | 679 | return NULL; |
680 | 680 | } |
681 | 681 | } |
@@ -689,11 +689,11 @@ discard block |
||
689 | 689 | * @param EE_Transaction $transaction |
690 | 690 | * @return EE_Cart |
691 | 691 | */ |
692 | - private function _get_cart_for_transaction( $transaction ) { |
|
693 | - $cart = $transaction instanceof EE_Transaction ? EE_Cart::get_cart_from_txn( $transaction ) : NULL; |
|
692 | + private function _get_cart_for_transaction($transaction) { |
|
693 | + $cart = $transaction instanceof EE_Transaction ? EE_Cart::get_cart_from_txn($transaction) : NULL; |
|
694 | 694 | // verify cart |
695 | - if ( ! $cart instanceof EE_Cart ) { |
|
696 | - $cart = EE_Registry::instance()->load_core( 'Cart' ); |
|
695 | + if ( ! $cart instanceof EE_Cart) { |
|
696 | + $cart = EE_Registry::instance()->load_core('Cart'); |
|
697 | 697 | } |
698 | 698 | return $cart; |
699 | 699 | } |
@@ -708,8 +708,8 @@ discard block |
||
708 | 708 | * @param EE_Transaction $transaction |
709 | 709 | * @return EE_Cart |
710 | 710 | */ |
711 | - public function get_cart_for_transaction( EE_Transaction $transaction ) { |
|
712 | - return EE_Cart::get_cart_from_txn( $transaction ); |
|
711 | + public function get_cart_for_transaction(EE_Transaction $transaction) { |
|
712 | + return EE_Cart::get_cart_from_txn($transaction); |
|
713 | 713 | } |
714 | 714 | |
715 | 715 | |
@@ -724,17 +724,17 @@ discard block |
||
724 | 724 | private function _get_cart_for_current_session_and_setup_new_transaction() { |
725 | 725 | // if there's no transaction, then this is the FIRST visit to SPCO |
726 | 726 | // so load up the cart ( passing nothing for the TXN because it doesn't exist yet ) |
727 | - $this->checkout->cart = $this->_get_cart_for_transaction( NULL ); |
|
727 | + $this->checkout->cart = $this->_get_cart_for_transaction(NULL); |
|
728 | 728 | // and then create a new transaction |
729 | 729 | $transaction = $this->_initialize_transaction(); |
730 | 730 | // verify transaction |
731 | - if ( $transaction instanceof EE_Transaction ) { |
|
731 | + if ($transaction instanceof EE_Transaction) { |
|
732 | 732 | // save it so that we have an ID for other objects to use |
733 | 733 | $transaction->save(); |
734 | 734 | // and save TXN data to the cart |
735 | - $this->checkout->cart->get_grand_total()->save_this_and_descendants_to_txn( $transaction->ID() ); |
|
735 | + $this->checkout->cart->get_grand_total()->save_this_and_descendants_to_txn($transaction->ID()); |
|
736 | 736 | } else { |
737 | - EE_Error::add_error( __( 'A Valid Transaction could not be initialized.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ ); |
|
737 | + EE_Error::add_error(__('A Valid Transaction could not be initialized.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
738 | 738 | } |
739 | 739 | return $transaction; |
740 | 740 | } |
@@ -754,15 +754,15 @@ discard block |
||
754 | 754 | // grab the cart grand total |
755 | 755 | $cart_total = $this->checkout->cart->get_cart_grand_total(); |
756 | 756 | // create new TXN |
757 | - return EE_Transaction::new_instance( array( |
|
757 | + return EE_Transaction::new_instance(array( |
|
758 | 758 | 'TXN_timestamp' => time(), |
759 | 759 | 'TXN_reg_steps' => $this->checkout->initialize_txn_reg_steps_array(), |
760 | 760 | 'TXN_total' => $cart_total > 0 ? $cart_total : 0, |
761 | 761 | 'TXN_paid' => 0, |
762 | 762 | 'STS_ID' => EEM_Transaction::failed_status_code, |
763 | 763 | )); |
764 | - } catch( Exception $e ) { |
|
765 | - EE_Error::add_error( $e->getMessage(), __FILE__, __FUNCTION__, __LINE__); |
|
764 | + } catch (Exception $e) { |
|
765 | + EE_Error::add_error($e->getMessage(), __FILE__, __FUNCTION__, __LINE__); |
|
766 | 766 | } |
767 | 767 | return NULL; |
768 | 768 | } |
@@ -776,34 +776,34 @@ discard block |
||
776 | 776 | * @param EE_Transaction $transaction |
777 | 777 | * @return EE_Cart |
778 | 778 | */ |
779 | - private function _get_registrations( EE_Transaction $transaction ) { |
|
779 | + private function _get_registrations(EE_Transaction $transaction) { |
|
780 | 780 | // first step: grab the registrants { : o |
781 | - $registrations = $transaction->registrations( $this->checkout->reg_cache_where_params, true ); |
|
781 | + $registrations = $transaction->registrations($this->checkout->reg_cache_where_params, true); |
|
782 | 782 | // verify registrations have been set |
783 | - if ( empty( $registrations )) { |
|
783 | + if (empty($registrations)) { |
|
784 | 784 | // if no cached registrations, then check the db |
785 | - $registrations = $transaction->registrations( $this->checkout->reg_cache_where_params, false ); |
|
785 | + $registrations = $transaction->registrations($this->checkout->reg_cache_where_params, false); |
|
786 | 786 | // still nothing ? well as long as this isn't a revisit |
787 | - if ( empty( $registrations ) && ! $this->checkout->revisit ) { |
|
787 | + if (empty($registrations) && ! $this->checkout->revisit) { |
|
788 | 788 | // generate new registrations from scratch |
789 | - $registrations = $this->_initialize_registrations( $transaction ); |
|
789 | + $registrations = $this->_initialize_registrations($transaction); |
|
790 | 790 | } |
791 | 791 | } |
792 | 792 | // sort by their original registration order |
793 | - usort( $registrations, array( 'EED_Single_Page_Checkout', 'sort_registrations_by_REG_count' )); |
|
793 | + usort($registrations, array('EED_Single_Page_Checkout', 'sort_registrations_by_REG_count')); |
|
794 | 794 | // then loop thru the array |
795 | - foreach ( $registrations as $registration ) { |
|
795 | + foreach ($registrations as $registration) { |
|
796 | 796 | // verify each registration |
797 | - if ( $registration instanceof EE_Registration ) { |
|
797 | + if ($registration instanceof EE_Registration) { |
|
798 | 798 | // we display all attendee info for the primary registrant |
799 | - if ( $this->checkout->reg_url_link == $registration->reg_url_link() && $registration->is_primary_registrant() ) { |
|
799 | + if ($this->checkout->reg_url_link == $registration->reg_url_link() && $registration->is_primary_registrant()) { |
|
800 | 800 | $this->checkout->primary_revisit = TRUE; |
801 | 801 | break; |
802 | - } else if ( $this->checkout->revisit && $this->checkout->reg_url_link != $registration->reg_url_link() ) { |
|
802 | + } else if ($this->checkout->revisit && $this->checkout->reg_url_link != $registration->reg_url_link()) { |
|
803 | 803 | // but hide info if it doesn't belong to you |
804 | - $transaction->clear_cache( 'Registration', $registration->ID() ); |
|
804 | + $transaction->clear_cache('Registration', $registration->ID()); |
|
805 | 805 | } |
806 | - $this->checkout->set_reg_status_updated( $registration->ID(), false ); |
|
806 | + $this->checkout->set_reg_status_updated($registration->ID(), false); |
|
807 | 807 | } |
808 | 808 | } |
809 | 809 | } |
@@ -817,17 +817,17 @@ discard block |
||
817 | 817 | * @param EE_Transaction $transaction |
818 | 818 | * @return array |
819 | 819 | */ |
820 | - private function _initialize_registrations( EE_Transaction $transaction ) { |
|
820 | + private function _initialize_registrations(EE_Transaction $transaction) { |
|
821 | 821 | $att_nmbr = 0; |
822 | 822 | $registrations = array(); |
823 | - if ( $transaction instanceof EE_Transaction ) { |
|
823 | + if ($transaction instanceof EE_Transaction) { |
|
824 | 824 | /** @type EE_Registration_Processor $registration_processor */ |
825 | - $registration_processor = EE_Registry::instance()->load_class( 'Registration_Processor' ); |
|
825 | + $registration_processor = EE_Registry::instance()->load_class('Registration_Processor'); |
|
826 | 826 | $this->checkout->total_ticket_count = $this->checkout->cart->all_ticket_quantity_count(); |
827 | 827 | // now let's add the cart items to the $transaction |
828 | - foreach ( $this->checkout->cart->get_tickets() as $line_item ) { |
|
828 | + foreach ($this->checkout->cart->get_tickets() as $line_item) { |
|
829 | 829 | //do the following for each ticket of this type they selected |
830 | - for ( $x = 1; $x <= $line_item->quantity(); $x++ ) { |
|
830 | + for ($x = 1; $x <= $line_item->quantity(); $x++) { |
|
831 | 831 | $att_nmbr++; |
832 | 832 | $registration = $registration_processor->generate_ONE_registration_from_line_item( |
833 | 833 | $line_item, |
@@ -835,12 +835,12 @@ discard block |
||
835 | 835 | $att_nmbr, |
836 | 836 | $this->checkout->total_ticket_count |
837 | 837 | ); |
838 | - if ( $registration instanceof EE_Registration ) { |
|
839 | - $registrations[ $registration->ID() ] = $registration; |
|
838 | + if ($registration instanceof EE_Registration) { |
|
839 | + $registrations[$registration->ID()] = $registration; |
|
840 | 840 | } |
841 | 841 | } |
842 | 842 | } |
843 | - $registration_processor->fix_reg_final_price_rounding_issue( $transaction ); |
|
843 | + $registration_processor->fix_reg_final_price_rounding_issue($transaction); |
|
844 | 844 | } |
845 | 845 | return $registrations; |
846 | 846 | } |
@@ -855,12 +855,12 @@ discard block |
||
855 | 855 | * @param EE_Registration $reg_B |
856 | 856 | * @return array() |
857 | 857 | */ |
858 | - public static function sort_registrations_by_REG_count( EE_Registration $reg_A, EE_Registration $reg_B ) { |
|
858 | + public static function sort_registrations_by_REG_count(EE_Registration $reg_A, EE_Registration $reg_B) { |
|
859 | 859 | // this shouldn't ever happen within the same TXN, but oh well |
860 | - if ( $reg_A->count() == $reg_B->count() ) { |
|
860 | + if ($reg_A->count() == $reg_B->count()) { |
|
861 | 861 | return 0; |
862 | 862 | } |
863 | - return ( $reg_A->count() > $reg_B->count() ) ? 1 : -1; |
|
863 | + return ($reg_A->count() > $reg_B->count()) ? 1 : -1; |
|
864 | 864 | } |
865 | 865 | |
866 | 866 | |
@@ -875,35 +875,35 @@ discard block |
||
875 | 875 | */ |
876 | 876 | private function _final_verifications() { |
877 | 877 | // filter checkout |
878 | - $this->checkout = apply_filters( 'FHEE__EED_Single_Page_Checkout___final_verifications__checkout', $this->checkout ); |
|
878 | + $this->checkout = apply_filters('FHEE__EED_Single_Page_Checkout___final_verifications__checkout', $this->checkout); |
|
879 | 879 | //verify that current step is still set correctly |
880 | - if ( ! $this->checkout->current_step instanceof EE_SPCO_Reg_Step ) { |
|
881 | - EE_Error::add_error( __( 'We\'re sorry but the registration process can not proceed because one or more registration steps were not setup correctly. Please refresh the page and try again or contact support.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ ); |
|
880 | + if ( ! $this->checkout->current_step instanceof EE_SPCO_Reg_Step) { |
|
881 | + EE_Error::add_error(__('We\'re sorry but the registration process can not proceed because one or more registration steps were not setup correctly. Please refresh the page and try again or contact support.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
882 | 882 | return false; |
883 | 883 | } |
884 | 884 | // if returning to SPCO, then verify that primary registrant is set |
885 | - if ( ! empty( $this->checkout->reg_url_link )) { |
|
885 | + if ( ! empty($this->checkout->reg_url_link)) { |
|
886 | 886 | $valid_registrant = $this->checkout->transaction->primary_registration(); |
887 | - if ( ! $valid_registrant instanceof EE_Registration ) { |
|
888 | - EE_Error::add_error( __( 'We\'re sorry but there appears to be an error with the "reg_url_link" or the primary registrant for this transaction. Please refresh the page and try again or contact support.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ ); |
|
887 | + if ( ! $valid_registrant instanceof EE_Registration) { |
|
888 | + EE_Error::add_error(__('We\'re sorry but there appears to be an error with the "reg_url_link" or the primary registrant for this transaction. Please refresh the page and try again or contact support.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
889 | 889 | return false; |
890 | 890 | } |
891 | 891 | $valid_registrant = null; |
892 | - foreach ( $this->checkout->transaction->registrations( $this->checkout->reg_cache_where_params ) as $registration ) { |
|
893 | - if ( $registration instanceof EE_Registration ) { |
|
894 | - if ( $registration->reg_url_link() == $this->checkout->reg_url_link ) { |
|
892 | + foreach ($this->checkout->transaction->registrations($this->checkout->reg_cache_where_params) as $registration) { |
|
893 | + if ($registration instanceof EE_Registration) { |
|
894 | + if ($registration->reg_url_link() == $this->checkout->reg_url_link) { |
|
895 | 895 | $valid_registrant = $registration; |
896 | 896 | } |
897 | 897 | } |
898 | 898 | } |
899 | - if ( ! $valid_registrant instanceof EE_Registration ) { |
|
900 | - EE_Error::add_error( __( 'We\'re sorry but there appears to be an error with the "reg_url_link" or the transaction itself. Please refresh the page and try again or contact support.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ ); |
|
899 | + if ( ! $valid_registrant instanceof EE_Registration) { |
|
900 | + EE_Error::add_error(__('We\'re sorry but there appears to be an error with the "reg_url_link" or the transaction itself. Please refresh the page and try again or contact support.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
901 | 901 | return false; |
902 | 902 | } |
903 | 903 | } |
904 | 904 | // now that things have been kinda sufficiently verified, |
905 | 905 | // let's add the checkout to the session so that's available other systems |
906 | - EE_Registry::instance()->SSN->set_checkout( $this->checkout ); |
|
906 | + EE_Registry::instance()->SSN->set_checkout($this->checkout); |
|
907 | 907 | return true; |
908 | 908 | } |
909 | 909 | |
@@ -919,28 +919,28 @@ discard block |
||
919 | 919 | * @access private |
920 | 920 | * @param bool $reinitializing |
921 | 921 | */ |
922 | - private function _initialize_reg_steps( $reinitializing = false ) { |
|
923 | - $this->checkout->set_reg_step_initiated( $this->checkout->current_step ); |
|
922 | + private function _initialize_reg_steps($reinitializing = false) { |
|
923 | + $this->checkout->set_reg_step_initiated($this->checkout->current_step); |
|
924 | 924 | // loop thru all steps to call their individual "initialize" methods and set i18n strings for JS |
925 | - foreach ( $this->checkout->reg_steps as $reg_step ) { |
|
926 | - if ( ! $reg_step->initialize_reg_step() ) { |
|
925 | + foreach ($this->checkout->reg_steps as $reg_step) { |
|
926 | + if ( ! $reg_step->initialize_reg_step()) { |
|
927 | 927 | // if not initialized then maybe this step is being removed... |
928 | - if ( $reg_step->is_current_step() && ! $reinitializing ) { |
|
928 | + if ($reg_step->is_current_step() && ! $reinitializing) { |
|
929 | 929 | // if it was the current step, then we need to start over here |
930 | - $this->_initialize_reg_steps( true ); |
|
930 | + $this->_initialize_reg_steps(true); |
|
931 | 931 | return; |
932 | 932 | } |
933 | 933 | continue; |
934 | 934 | } |
935 | 935 | // i18n |
936 | 936 | $reg_step->translate_js_strings(); |
937 | - if ( $reg_step->is_current_step() ) { |
|
937 | + if ($reg_step->is_current_step()) { |
|
938 | 938 | // the text that appears on the reg step form submit button |
939 | 939 | $reg_step->set_submit_button_text(); |
940 | 940 | } |
941 | 941 | } |
942 | 942 | // dynamically creates hook point like: AHEE__Single_Page_Checkout___initialize_reg_step__attendee_information |
943 | - do_action( "AHEE__Single_Page_Checkout___initialize_reg_step__{$this->checkout->current_step->slug()}", $this->checkout->current_step ); |
|
943 | + do_action("AHEE__Single_Page_Checkout___initialize_reg_step__{$this->checkout->current_step->slug()}", $this->checkout->current_step); |
|
944 | 944 | } |
945 | 945 | |
946 | 946 | |
@@ -953,39 +953,39 @@ discard block |
||
953 | 953 | */ |
954 | 954 | private function _check_form_submission() { |
955 | 955 | //does this request require the reg form to be generated ? |
956 | - if ( $this->checkout->generate_reg_form ) { |
|
956 | + if ($this->checkout->generate_reg_form) { |
|
957 | 957 | // ever heard that song by Blue Rodeo ? |
958 | 958 | try { |
959 | 959 | $this->checkout->current_step->reg_form = $this->checkout->current_step->generate_reg_form(); |
960 | 960 | // if not displaying a form, then check for form submission |
961 | - if ( $this->checkout->process_form_submission && $this->checkout->current_step->reg_form->was_submitted() ) { |
|
961 | + if ($this->checkout->process_form_submission && $this->checkout->current_step->reg_form->was_submitted()) { |
|
962 | 962 | // clear out any old data in case this step is being run again |
963 | - $this->checkout->current_step->set_valid_data( array() ); |
|
963 | + $this->checkout->current_step->set_valid_data(array()); |
|
964 | 964 | // capture submitted form data |
965 | 965 | $this->checkout->current_step->reg_form->receive_form_submission( |
966 | - apply_filters( 'FHEE__Single_Page_Checkout___check_form_submission__request_params', EE_Registry::instance()->REQ->params(), $this->checkout ) |
|
966 | + apply_filters('FHEE__Single_Page_Checkout___check_form_submission__request_params', EE_Registry::instance()->REQ->params(), $this->checkout) |
|
967 | 967 | ); |
968 | 968 | // validate submitted form data |
969 | - if ( ! $this->checkout->current_step->reg_form->is_valid() || ! $this->checkout->continue_reg ) { |
|
969 | + if ( ! $this->checkout->current_step->reg_form->is_valid() || ! $this->checkout->continue_reg) { |
|
970 | 970 | // thou shall not pass !!! |
971 | 971 | $this->checkout->continue_reg = FALSE; |
972 | 972 | // any form validation errors? |
973 | - if ( $this->checkout->current_step->reg_form->submission_error_message() != '' ) { |
|
973 | + if ($this->checkout->current_step->reg_form->submission_error_message() != '') { |
|
974 | 974 | $submission_error_messages = array(); |
975 | 975 | // bad, bad, bad registrant |
976 | - foreach( $this->checkout->current_step->reg_form->get_validation_errors_accumulated() as $validation_error ){ |
|
977 | - if ( $validation_error instanceof EE_Validation_Error ) { |
|
978 | - $submission_error_messages[] = sprintf( __( '%s : %s', 'event_espresso' ), $validation_error->get_form_section()->html_label_text(), $validation_error->getMessage() ); |
|
976 | + foreach ($this->checkout->current_step->reg_form->get_validation_errors_accumulated() as $validation_error) { |
|
977 | + if ($validation_error instanceof EE_Validation_Error) { |
|
978 | + $submission_error_messages[] = sprintf(__('%s : %s', 'event_espresso'), $validation_error->get_form_section()->html_label_text(), $validation_error->getMessage()); |
|
979 | 979 | } |
980 | 980 | } |
981 | - EE_Error::add_error( join( '<br />', $submission_error_messages ), __FILE__, __FUNCTION__, __LINE__ ); |
|
981 | + EE_Error::add_error(join('<br />', $submission_error_messages), __FILE__, __FUNCTION__, __LINE__); |
|
982 | 982 | } |
983 | 983 | // well not really... what will happen is we'll just get redirected back to redo the current step |
984 | 984 | $this->go_to_next_step(); |
985 | 985 | return; |
986 | 986 | } |
987 | 987 | } |
988 | - } catch( EE_Error $e ) { |
|
988 | + } catch (EE_Error $e) { |
|
989 | 989 | $e->get_error(); |
990 | 990 | } |
991 | 991 | } |
@@ -1001,38 +1001,38 @@ discard block |
||
1001 | 1001 | */ |
1002 | 1002 | private function _process_form_action() { |
1003 | 1003 | // what cha wanna do? |
1004 | - switch( $this->checkout->action ) { |
|
1004 | + switch ($this->checkout->action) { |
|
1005 | 1005 | // AJAX next step reg form |
1006 | 1006 | case 'display_spco_reg_step' : |
1007 | 1007 | $this->checkout->redirect = FALSE; |
1008 | - if ( EE_Registry::instance()->REQ->ajax ) { |
|
1009 | - $this->checkout->json_response->set_reg_step_html( $this->checkout->current_step->display_reg_form() ); |
|
1008 | + if (EE_Registry::instance()->REQ->ajax) { |
|
1009 | + $this->checkout->json_response->set_reg_step_html($this->checkout->current_step->display_reg_form()); |
|
1010 | 1010 | } |
1011 | 1011 | break; |
1012 | 1012 | |
1013 | 1013 | default : |
1014 | 1014 | // meh... do one of those other steps first |
1015 | - if ( ! empty( $this->checkout->action ) && is_callable( array( $this->checkout->current_step, $this->checkout->action ))) { |
|
1015 | + if ( ! empty($this->checkout->action) && is_callable(array($this->checkout->current_step, $this->checkout->action))) { |
|
1016 | 1016 | // dynamically creates hook point like: AHEE__Single_Page_Checkout__before_attendee_information__process_reg_step |
1017 | - do_action( "AHEE__Single_Page_Checkout__before_{$this->checkout->current_step->slug()}__{$this->checkout->action}", $this->checkout->current_step ); |
|
1017 | + do_action("AHEE__Single_Page_Checkout__before_{$this->checkout->current_step->slug()}__{$this->checkout->action}", $this->checkout->current_step); |
|
1018 | 1018 | // call action on current step |
1019 | - if ( call_user_func( array( $this->checkout->current_step, $this->checkout->action )) ) { |
|
1019 | + if (call_user_func(array($this->checkout->current_step, $this->checkout->action))) { |
|
1020 | 1020 | // good registrant, you get to proceed |
1021 | - if ( $this->checkout->current_step->success_message() != '' ) { |
|
1022 | - if ( apply_filters( 'FHEE__Single_Page_Checkout___process_form_action__display_success', false ) ) { |
|
1023 | - EE_Error::add_success( $this->checkout->current_step->success_message() . '<br />' . $this->checkout->next_step->_instructions() ); |
|
1021 | + if ($this->checkout->current_step->success_message() != '') { |
|
1022 | + if (apply_filters('FHEE__Single_Page_Checkout___process_form_action__display_success', false)) { |
|
1023 | + EE_Error::add_success($this->checkout->current_step->success_message().'<br />'.$this->checkout->next_step->_instructions()); |
|
1024 | 1024 | } |
1025 | 1025 | } |
1026 | 1026 | // pack it up, pack it in... |
1027 | 1027 | $this->_setup_redirect(); |
1028 | 1028 | } |
1029 | 1029 | // dynamically creates hook point like: AHEE__Single_Page_Checkout__after_payment_options__process_reg_step |
1030 | - do_action( "AHEE__Single_Page_Checkout__after_{$this->checkout->current_step->slug()}__{$this->checkout->action}", $this->checkout->current_step ); |
|
1030 | + do_action("AHEE__Single_Page_Checkout__after_{$this->checkout->current_step->slug()}__{$this->checkout->action}", $this->checkout->current_step); |
|
1031 | 1031 | |
1032 | 1032 | } else { |
1033 | 1033 | EE_Error::add_error( |
1034 | 1034 | sprintf( |
1035 | - __( 'The requested form action "%s" does not exist for the current "%s" registration step.', 'event_espresso' ), |
|
1035 | + __('The requested form action "%s" does not exist for the current "%s" registration step.', 'event_espresso'), |
|
1036 | 1036 | $this->checkout->action, |
1037 | 1037 | $this->checkout->current_step->name() |
1038 | 1038 | ), |
@@ -1058,10 +1058,10 @@ discard block |
||
1058 | 1058 | public function add_styles_and_scripts() { |
1059 | 1059 | // i18n |
1060 | 1060 | $this->translate_js_strings(); |
1061 | - if ( $this->checkout->admin_request ) { |
|
1062 | - add_action('admin_enqueue_scripts', array($this, 'enqueue_styles_and_scripts'), 10 ); |
|
1061 | + if ($this->checkout->admin_request) { |
|
1062 | + add_action('admin_enqueue_scripts', array($this, 'enqueue_styles_and_scripts'), 10); |
|
1063 | 1063 | } else { |
1064 | - add_action( 'wp_enqueue_scripts', array( $this, 'enqueue_styles_and_scripts' ), 10 ); |
|
1064 | + add_action('wp_enqueue_scripts', array($this, 'enqueue_styles_and_scripts'), 10); |
|
1065 | 1065 | } |
1066 | 1066 | } |
1067 | 1067 | |
@@ -1077,42 +1077,42 @@ discard block |
||
1077 | 1077 | EE_Registry::$i18n_js_strings['revisit'] = $this->checkout->revisit; |
1078 | 1078 | EE_Registry::$i18n_js_strings['e_reg_url_link'] = $this->checkout->reg_url_link; |
1079 | 1079 | EE_Registry::$i18n_js_strings['server_error'] = __('An unknown error occurred on the server while attempting to process your request. Please refresh the page and try again or contact support.', 'event_espresso'); |
1080 | - EE_Registry::$i18n_js_strings['invalid_json_response'] = __( 'An invalid response was returned from the server while attempting to process your request. Please refresh the page and try again or contact support.', 'event_espresso' ); |
|
1081 | - EE_Registry::$i18n_js_strings['validation_error'] = __( 'There appears to be a problem with the form validation configuration! Please check the admin settings or contact support.', 'event_espresso' ); |
|
1082 | - EE_Registry::$i18n_js_strings['invalid_payment_method'] = __( 'There appears to be a problem with the payment method configuration! Please refresh the page and try again or contact support.', 'event_espresso' ); |
|
1080 | + EE_Registry::$i18n_js_strings['invalid_json_response'] = __('An invalid response was returned from the server while attempting to process your request. Please refresh the page and try again or contact support.', 'event_espresso'); |
|
1081 | + EE_Registry::$i18n_js_strings['validation_error'] = __('There appears to be a problem with the form validation configuration! Please check the admin settings or contact support.', 'event_espresso'); |
|
1082 | + EE_Registry::$i18n_js_strings['invalid_payment_method'] = __('There appears to be a problem with the payment method configuration! Please refresh the page and try again or contact support.', 'event_espresso'); |
|
1083 | 1083 | EE_Registry::$i18n_js_strings['reg_step_error'] = __('This registration step could not be completed. Please refresh the page and try again.', 'event_espresso'); |
1084 | 1084 | EE_Registry::$i18n_js_strings['invalid_coupon'] = __('We\'re sorry but that coupon code does not appear to be valid. If this is incorrect, please contact the site administrator.', 'event_espresso'); |
1085 | - EE_Registry::$i18n_js_strings['process_registration'] = sprintf( __( 'Please wait while we process your registration.%sDo not refresh the page or navigate away while this is happening.%sThank you for your patience.', 'event_espresso' ), '<br/>', '<br/>' ); |
|
1086 | - EE_Registry::$i18n_js_strings['language'] = get_bloginfo( 'language' ); |
|
1085 | + EE_Registry::$i18n_js_strings['process_registration'] = sprintf(__('Please wait while we process your registration.%sDo not refresh the page or navigate away while this is happening.%sThank you for your patience.', 'event_espresso'), '<br/>', '<br/>'); |
|
1086 | + EE_Registry::$i18n_js_strings['language'] = get_bloginfo('language'); |
|
1087 | 1087 | EE_Registry::$i18n_js_strings['EESID'] = EE_Registry::instance()->SSN->id(); |
1088 | 1088 | EE_Registry::$i18n_js_strings['currency'] = EE_Registry::instance()->CFG->currency; |
1089 | 1089 | EE_Registry::$i18n_js_strings['datepicker_yearRange'] = '-150:+20'; |
1090 | - EE_Registry::$i18n_js_strings['timer_years'] = __( 'years', 'event_espresso' ); |
|
1091 | - EE_Registry::$i18n_js_strings['timer_months'] = __( 'months', 'event_espresso' ); |
|
1092 | - EE_Registry::$i18n_js_strings['timer_weeks'] = __( 'weeks', 'event_espresso' ); |
|
1093 | - EE_Registry::$i18n_js_strings['timer_days'] = __( 'days', 'event_espresso' ); |
|
1094 | - EE_Registry::$i18n_js_strings['timer_hours'] = __( 'hours', 'event_espresso' ); |
|
1095 | - EE_Registry::$i18n_js_strings['timer_minutes'] = __( 'minutes', 'event_espresso' ); |
|
1096 | - EE_Registry::$i18n_js_strings['timer_seconds'] = __( 'seconds', 'event_espresso' ); |
|
1097 | - EE_Registry::$i18n_js_strings['timer_year'] = __( 'year', 'event_espresso' ); |
|
1098 | - EE_Registry::$i18n_js_strings['timer_month'] = __( 'month', 'event_espresso' ); |
|
1099 | - EE_Registry::$i18n_js_strings['timer_week'] = __( 'week', 'event_espresso' ); |
|
1100 | - EE_Registry::$i18n_js_strings['timer_day'] = __( 'day', 'event_espresso' ); |
|
1101 | - EE_Registry::$i18n_js_strings['timer_hour'] = __( 'hour', 'event_espresso' ); |
|
1102 | - EE_Registry::$i18n_js_strings['timer_minute'] = __( 'minute', 'event_espresso' ); |
|
1103 | - EE_Registry::$i18n_js_strings['timer_second'] = __( 'second', 'event_espresso' ); |
|
1090 | + EE_Registry::$i18n_js_strings['timer_years'] = __('years', 'event_espresso'); |
|
1091 | + EE_Registry::$i18n_js_strings['timer_months'] = __('months', 'event_espresso'); |
|
1092 | + EE_Registry::$i18n_js_strings['timer_weeks'] = __('weeks', 'event_espresso'); |
|
1093 | + EE_Registry::$i18n_js_strings['timer_days'] = __('days', 'event_espresso'); |
|
1094 | + EE_Registry::$i18n_js_strings['timer_hours'] = __('hours', 'event_espresso'); |
|
1095 | + EE_Registry::$i18n_js_strings['timer_minutes'] = __('minutes', 'event_espresso'); |
|
1096 | + EE_Registry::$i18n_js_strings['timer_seconds'] = __('seconds', 'event_espresso'); |
|
1097 | + EE_Registry::$i18n_js_strings['timer_year'] = __('year', 'event_espresso'); |
|
1098 | + EE_Registry::$i18n_js_strings['timer_month'] = __('month', 'event_espresso'); |
|
1099 | + EE_Registry::$i18n_js_strings['timer_week'] = __('week', 'event_espresso'); |
|
1100 | + EE_Registry::$i18n_js_strings['timer_day'] = __('day', 'event_espresso'); |
|
1101 | + EE_Registry::$i18n_js_strings['timer_hour'] = __('hour', 'event_espresso'); |
|
1102 | + EE_Registry::$i18n_js_strings['timer_minute'] = __('minute', 'event_espresso'); |
|
1103 | + EE_Registry::$i18n_js_strings['timer_second'] = __('second', 'event_espresso'); |
|
1104 | 1104 | EE_Registry::$i18n_js_strings['registration_expiration_notice'] = sprintf( |
1105 | - __( '%1$sWe\'re sorry, but your registration time has expired.%2$s%3$s%4$sIf you still wish to complete your registration, please return to the %5$sEvent List%6$sEvent List%7$s and reselect your tickets if available. Please except our apologies for any inconvenience this may have caused.%8$s', 'event_espresso' ), |
|
1105 | + __('%1$sWe\'re sorry, but your registration time has expired.%2$s%3$s%4$sIf you still wish to complete your registration, please return to the %5$sEvent List%6$sEvent List%7$s and reselect your tickets if available. Please except our apologies for any inconvenience this may have caused.%8$s', 'event_espresso'), |
|
1106 | 1106 | '<h4 class="important-notice">', |
1107 | 1107 | '</h4>', |
1108 | 1108 | '<br />', |
1109 | 1109 | '<p>', |
1110 | - '<a href="'. get_post_type_archive_link( 'espresso_events' ) . '" title="', |
|
1110 | + '<a href="'.get_post_type_archive_link('espresso_events').'" title="', |
|
1111 | 1111 | '">', |
1112 | 1112 | '</a>', |
1113 | 1113 | '</p>' |
1114 | 1114 | ); |
1115 | - EE_Registry::$i18n_js_strings[ 'ajax_submit' ] = apply_filters( 'FHEE__Single_Page_Checkout__translate_js_strings__ajax_submit', true ); |
|
1115 | + EE_Registry::$i18n_js_strings['ajax_submit'] = apply_filters('FHEE__Single_Page_Checkout__translate_js_strings__ajax_submit', true); |
|
1116 | 1116 | } |
1117 | 1117 | |
1118 | 1118 | |
@@ -1125,25 +1125,25 @@ discard block |
||
1125 | 1125 | */ |
1126 | 1126 | public function enqueue_styles_and_scripts() { |
1127 | 1127 | // load css |
1128 | - wp_register_style( 'single_page_checkout', SPCO_CSS_URL . 'single_page_checkout.css', array(), EVENT_ESPRESSO_VERSION ); |
|
1129 | - wp_enqueue_style( 'single_page_checkout' ); |
|
1128 | + wp_register_style('single_page_checkout', SPCO_CSS_URL.'single_page_checkout.css', array(), EVENT_ESPRESSO_VERSION); |
|
1129 | + wp_enqueue_style('single_page_checkout'); |
|
1130 | 1130 | // load JS |
1131 | - wp_register_script( 'jquery_plugin', EE_THIRD_PARTY_URL . 'jquery .plugin.min.js', array( 'jquery' ), '1.0.1', TRUE ); |
|
1132 | - wp_register_script( 'jquery_countdown', EE_THIRD_PARTY_URL . 'jquery .countdown.min.js', array( 'jquery_plugin' ), '2.0.2', TRUE ); |
|
1133 | - wp_register_script( 'single_page_checkout', SPCO_JS_URL . 'single_page_checkout.js', array( 'espresso_core', 'underscore', 'ee_form_section_validation', 'jquery_countdown' ), EVENT_ESPRESSO_VERSION, TRUE ); |
|
1134 | - wp_enqueue_script( 'single_page_checkout' ); |
|
1131 | + wp_register_script('jquery_plugin', EE_THIRD_PARTY_URL.'jquery .plugin.min.js', array('jquery'), '1.0.1', TRUE); |
|
1132 | + wp_register_script('jquery_countdown', EE_THIRD_PARTY_URL.'jquery .countdown.min.js', array('jquery_plugin'), '2.0.2', TRUE); |
|
1133 | + wp_register_script('single_page_checkout', SPCO_JS_URL.'single_page_checkout.js', array('espresso_core', 'underscore', 'ee_form_section_validation', 'jquery_countdown'), EVENT_ESPRESSO_VERSION, TRUE); |
|
1134 | + wp_enqueue_script('single_page_checkout'); |
|
1135 | 1135 | |
1136 | 1136 | /** |
1137 | 1137 | * global action hook for enqueueing styles and scripts with |
1138 | 1138 | * spco calls. |
1139 | 1139 | */ |
1140 | - do_action( 'AHEE__EED_Single_Page_Checkout__enqueue_styles_and_scripts', $this ); |
|
1140 | + do_action('AHEE__EED_Single_Page_Checkout__enqueue_styles_and_scripts', $this); |
|
1141 | 1141 | |
1142 | 1142 | /** |
1143 | 1143 | * dynamic action hook for enqueueing styles and scripts with spco calls. |
1144 | 1144 | * The hook will end up being something like AHEE__EED_Single_Page_Checkout__enqueue_styles_and_scripts__attendee_information |
1145 | 1145 | */ |
1146 | - do_action( 'AHEE__EED_Single_Page_Checkout__enqueue_styles_and_scripts__' . $this->checkout->current_step->slug(), $this ); |
|
1146 | + do_action('AHEE__EED_Single_Page_Checkout__enqueue_styles_and_scripts__'.$this->checkout->current_step->slug(), $this); |
|
1147 | 1147 | |
1148 | 1148 | // add css and JS for current step |
1149 | 1149 | $this->checkout->current_step->enqueue_styles_and_scripts(); |
@@ -1159,20 +1159,20 @@ discard block |
||
1159 | 1159 | */ |
1160 | 1160 | private function _display_spco_reg_form() { |
1161 | 1161 | // if registering via the admin, just display the reg form for the current step |
1162 | - if ( $this->checkout->admin_request ) { |
|
1163 | - EE_Registry::instance()->REQ->add_output( $this->checkout->current_step->display_reg_form() ); |
|
1162 | + if ($this->checkout->admin_request) { |
|
1163 | + EE_Registry::instance()->REQ->add_output($this->checkout->current_step->display_reg_form()); |
|
1164 | 1164 | } else { |
1165 | 1165 | // add powered by EE msg |
1166 | - add_action( 'AHEE__SPCO__reg_form_footer', array( 'EED_Single_Page_Checkout', 'display_registration_footer' )); |
|
1166 | + add_action('AHEE__SPCO__reg_form_footer', array('EED_Single_Page_Checkout', 'display_registration_footer')); |
|
1167 | 1167 | |
1168 | - $empty_cart = count( $this->checkout->transaction->registrations( $this->checkout->reg_cache_where_params ) ) < 1 ? true : false; |
|
1168 | + $empty_cart = count($this->checkout->transaction->registrations($this->checkout->reg_cache_where_params)) < 1 ? true : false; |
|
1169 | 1169 | $cookies_not_set_msg = ''; |
1170 | - if ( $empty_cart ) { |
|
1171 | - if ( ! isset( $_COOKIE[ 'ee_cookie_test' ] ) ) { |
|
1170 | + if ($empty_cart) { |
|
1171 | + if ( ! isset($_COOKIE['ee_cookie_test'])) { |
|
1172 | 1172 | $cookies_not_set_msg = apply_filters( |
1173 | 1173 | 'FHEE__Single_Page_Checkout__display_spco_reg_form__cookies_not_set_msg', |
1174 | 1174 | sprintf( |
1175 | - __( '%1$s%3$sIt appears your browser is not currently set to accept Cookies%4$s%5$sIn order to register for events, you need to enable cookies.%7$sIf you require assistance, then click the following link to learn how to %8$senable cookies%9$s%6$s%2$s', 'event_espresso' ), |
|
1175 | + __('%1$s%3$sIt appears your browser is not currently set to accept Cookies%4$s%5$sIn order to register for events, you need to enable cookies.%7$sIf you require assistance, then click the following link to learn how to %8$senable cookies%9$s%6$s%2$s', 'event_espresso'), |
|
1176 | 1176 | '<div class="ee-attention">', |
1177 | 1177 | '</div>', |
1178 | 1178 | '<h6 class="important-notice">', |
@@ -1193,7 +1193,7 @@ discard block |
||
1193 | 1193 | 'layout_strategy' => |
1194 | 1194 | new EE_Template_Layout( |
1195 | 1195 | array( |
1196 | - 'layout_template_file' => SPCO_TEMPLATES_PATH . 'registration_page_wrapper.template.php', |
|
1196 | + 'layout_template_file' => SPCO_TEMPLATES_PATH.'registration_page_wrapper.template.php', |
|
1197 | 1197 | 'template_args' => array( |
1198 | 1198 | 'empty_cart' => $empty_cart, |
1199 | 1199 | 'revisit' => $this->checkout->revisit, |
@@ -1202,8 +1202,8 @@ discard block |
||
1202 | 1202 | 'empty_msg' => apply_filters( |
1203 | 1203 | 'FHEE__Single_Page_Checkout__display_spco_reg_form__empty_msg', |
1204 | 1204 | sprintf( |
1205 | - __( 'You need to %1$sReturn to Events list%2$sselect at least one event%3$s before you can proceed with the registration process.', 'event_espresso' ), |
|
1206 | - '<a href="' . get_post_type_archive_link( 'espresso_events' ) . '" title="', |
|
1205 | + __('You need to %1$sReturn to Events list%2$sselect at least one event%3$s before you can proceed with the registration process.', 'event_espresso'), |
|
1206 | + '<a href="'.get_post_type_archive_link('espresso_events').'" title="', |
|
1207 | 1207 | '">', |
1208 | 1208 | '</a>' |
1209 | 1209 | ) |
@@ -1211,14 +1211,14 @@ discard block |
||
1211 | 1211 | 'cookies_not_set_msg' => $cookies_not_set_msg, |
1212 | 1212 | 'registration_time_limit' => $this->checkout->get_registration_time_limit(), |
1213 | 1213 | 'session_expiration' => |
1214 | - gmdate( 'M d, Y H:i:s', EE_Registry::instance()->SSN->expiration() + ( get_option( 'gmt_offset' ) * HOUR_IN_SECONDS ) ) |
|
1214 | + gmdate('M d, Y H:i:s', EE_Registry::instance()->SSN->expiration() + (get_option('gmt_offset') * HOUR_IN_SECONDS)) |
|
1215 | 1215 | ) |
1216 | 1216 | ) |
1217 | 1217 | ) |
1218 | 1218 | ) |
1219 | 1219 | ); |
1220 | 1220 | // load template and add to output sent that gets filtered into the_content() |
1221 | - EE_Registry::instance()->REQ->add_output( $this->checkout->registration_form->get_html_and_js() ); |
|
1221 | + EE_Registry::instance()->REQ->add_output($this->checkout->registration_form->get_html_and_js()); |
|
1222 | 1222 | } |
1223 | 1223 | } |
1224 | 1224 | |
@@ -1232,8 +1232,8 @@ discard block |
||
1232 | 1232 | * @internal param string $label |
1233 | 1233 | * @return string |
1234 | 1234 | */ |
1235 | - public function add_extra_finalize_registration_inputs( $next_step ) { |
|
1236 | - if ( $next_step == 'finalize_registration' ) { |
|
1235 | + public function add_extra_finalize_registration_inputs($next_step) { |
|
1236 | + if ($next_step == 'finalize_registration') { |
|
1237 | 1237 | echo '<div id="spco-extra-finalize_registration-inputs-dv"></div>'; |
1238 | 1238 | } |
1239 | 1239 | } |
@@ -1247,18 +1247,18 @@ discard block |
||
1247 | 1247 | * @return string |
1248 | 1248 | */ |
1249 | 1249 | public static function display_registration_footer() { |
1250 | - if ( apply_filters( 'FHEE__EE_Front__Controller__show_reg_footer', EE_Registry::instance()->CFG->admin->show_reg_footer ) ) { |
|
1251 | - EE_Registry::instance()->CFG->admin->affiliate_id = ! empty( EE_Registry::instance()->CFG->admin->affiliate_id ) ? EE_Registry::instance()->CFG->admin->affiliate_id : 'default'; |
|
1252 | - $url = add_query_arg( array( 'ap_id' => EE_Registry::instance()->CFG->admin->affiliate_id ), 'https://eventespresso.com/' ); |
|
1253 | - $url = apply_filters( 'FHEE__EE_Front_Controller__registration_footer__url', $url ); |
|
1250 | + if (apply_filters('FHEE__EE_Front__Controller__show_reg_footer', EE_Registry::instance()->CFG->admin->show_reg_footer)) { |
|
1251 | + EE_Registry::instance()->CFG->admin->affiliate_id = ! empty(EE_Registry::instance()->CFG->admin->affiliate_id) ? EE_Registry::instance()->CFG->admin->affiliate_id : 'default'; |
|
1252 | + $url = add_query_arg(array('ap_id' => EE_Registry::instance()->CFG->admin->affiliate_id), 'https://eventespresso.com/'); |
|
1253 | + $url = apply_filters('FHEE__EE_Front_Controller__registration_footer__url', $url); |
|
1254 | 1254 | echo apply_filters( |
1255 | 1255 | 'FHEE__EE_Front_Controller__display_registration_footer', |
1256 | 1256 | sprintf( |
1257 | - __( '%1$sEvent Registration Powered by Event Espresso%2$sEvent Registration and Ticketing%3$s Powered by %4$sEvent Espresso - Event Registration and Management System for WordPress%5$sEvent Espresso%6$s', 'event_espresso' ), |
|
1258 | - '<div id="espresso-registration-footer-dv"><a href="' . $url . '" title="', |
|
1257 | + __('%1$sEvent Registration Powered by Event Espresso%2$sEvent Registration and Ticketing%3$s Powered by %4$sEvent Espresso - Event Registration and Management System for WordPress%5$sEvent Espresso%6$s', 'event_espresso'), |
|
1258 | + '<div id="espresso-registration-footer-dv"><a href="'.$url.'" title="', |
|
1259 | 1259 | '" target="_blank">', |
1260 | 1260 | '</a>', |
1261 | - '<a href="' . $url . '" title="', |
|
1261 | + '<a href="'.$url.'" title="', |
|
1262 | 1262 | '" target="_blank">', |
1263 | 1263 | '</a></div>' |
1264 | 1264 | ) |
@@ -1289,12 +1289,12 @@ discard block |
||
1289 | 1289 | * @return array |
1290 | 1290 | */ |
1291 | 1291 | private function _setup_redirect() { |
1292 | - if ( $this->checkout->continue_reg && $this->checkout->next_step instanceof EE_SPCO_Reg_Step ) { |
|
1292 | + if ($this->checkout->continue_reg && $this->checkout->next_step instanceof EE_SPCO_Reg_Step) { |
|
1293 | 1293 | $this->checkout->redirect = TRUE; |
1294 | - if ( empty( $this->checkout->redirect_url )) { |
|
1294 | + if (empty($this->checkout->redirect_url)) { |
|
1295 | 1295 | $this->checkout->redirect_url = $this->checkout->next_step->reg_step_url(); |
1296 | 1296 | } |
1297 | - $this->checkout->redirect_url = apply_filters( 'FHEE__EED_Single_Page_Checkout___setup_redirect__checkout_redirect_url', $this->checkout->redirect_url, $this->checkout ); |
|
1297 | + $this->checkout->redirect_url = apply_filters('FHEE__EED_Single_Page_Checkout___setup_redirect__checkout_redirect_url', $this->checkout->redirect_url, $this->checkout); |
|
1298 | 1298 | } |
1299 | 1299 | } |
1300 | 1300 | |
@@ -1307,12 +1307,12 @@ discard block |
||
1307 | 1307 | * @return void |
1308 | 1308 | */ |
1309 | 1309 | public function go_to_next_step() { |
1310 | - if ( EE_Registry::instance()->REQ->ajax ) { |
|
1310 | + if (EE_Registry::instance()->REQ->ajax) { |
|
1311 | 1311 | // capture contents of output buffer we started earlier in the request, and insert into JSON response |
1312 | - $this->checkout->json_response->set_unexpected_errors( ob_get_clean() ); |
|
1312 | + $this->checkout->json_response->set_unexpected_errors(ob_get_clean()); |
|
1313 | 1313 | } |
1314 | 1314 | // just return for these conditions |
1315 | - if ( $this->checkout->admin_request || $this->checkout->action == 'redirect_form' || $this->checkout->action == 'update_checkout' ) { |
|
1315 | + if ($this->checkout->admin_request || $this->checkout->action == 'redirect_form' || $this->checkout->action == 'update_checkout') { |
|
1316 | 1316 | return; |
1317 | 1317 | } |
1318 | 1318 | // AJAX response |
@@ -1333,7 +1333,7 @@ discard block |
||
1333 | 1333 | */ |
1334 | 1334 | protected function _handle_json_response() { |
1335 | 1335 | // if this is an ajax request |
1336 | - if ( EE_Registry::instance()->REQ->ajax ) { |
|
1336 | + if (EE_Registry::instance()->REQ->ajax) { |
|
1337 | 1337 | // DEBUG LOG |
1338 | 1338 | //$this->checkout->log( |
1339 | 1339 | // __CLASS__, __FUNCTION__, __LINE__, |
@@ -1343,10 +1343,10 @@ discard block |
||
1343 | 1343 | // 'continue_reg' => $this->checkout->continue_reg, |
1344 | 1344 | // ) |
1345 | 1345 | //); |
1346 | - $this->checkout->json_response->set_registration_time_limit( $this->checkout->get_registration_time_limit() ); |
|
1347 | - $this->checkout->json_response->set_payment_amount( $this->checkout->amount_owing ); |
|
1346 | + $this->checkout->json_response->set_registration_time_limit($this->checkout->get_registration_time_limit()); |
|
1347 | + $this->checkout->json_response->set_payment_amount($this->checkout->amount_owing); |
|
1348 | 1348 | // just send the ajax ( |
1349 | - $json_response = apply_filters( 'FHEE__EE_Single_Page_Checkout__JSON_response', $this->checkout->json_response ); |
|
1349 | + $json_response = apply_filters('FHEE__EE_Single_Page_Checkout__JSON_response', $this->checkout->json_response); |
|
1350 | 1350 | $this->unlock_transaction(); |
1351 | 1351 | echo $json_response; |
1352 | 1352 | exit(); |
@@ -1363,9 +1363,9 @@ discard block |
||
1363 | 1363 | */ |
1364 | 1364 | protected function _handle_html_redirects() { |
1365 | 1365 | // going somewhere ? |
1366 | - if ( $this->checkout->redirect && ! empty( $this->checkout->redirect_url ) ) { |
|
1366 | + if ($this->checkout->redirect && ! empty($this->checkout->redirect_url)) { |
|
1367 | 1367 | // store notices in a transient |
1368 | - EE_Error::get_notices( false, true, true ); |
|
1368 | + EE_Error::get_notices(false, true, true); |
|
1369 | 1369 | $this->unlock_transaction(); |
1370 | 1370 | // DEBUG LOG |
1371 | 1371 | //$this->checkout->log( |
@@ -1376,7 +1376,7 @@ discard block |
||
1376 | 1376 | // 'headers_list' => headers_list(), |
1377 | 1377 | // ) |
1378 | 1378 | //); |
1379 | - wp_safe_redirect( $this->checkout->redirect_url ); |
|
1379 | + wp_safe_redirect($this->checkout->redirect_url); |
|
1380 | 1380 | exit(); |
1381 | 1381 | } |
1382 | 1382 | } |
@@ -236,13 +236,13 @@ |
||
236 | 236 | |
237 | 237 | if ( ! function_exists( 'espresso_deactivate_plugin' ) ) { |
238 | 238 | /** |
239 | - * deactivate_plugin |
|
240 | - * usage: espresso_deactivate_plugin( plugin_basename( __FILE__ )); |
|
241 | - * |
|
242 | - * @access public |
|
243 | - * @param string $plugin_basename - the results of plugin_basename( __FILE__ ) for the plugin's main file |
|
244 | - * @return void |
|
245 | - */ |
|
239 | + * deactivate_plugin |
|
240 | + * usage: espresso_deactivate_plugin( plugin_basename( __FILE__ )); |
|
241 | + * |
|
242 | + * @access public |
|
243 | + * @param string $plugin_basename - the results of plugin_basename( __FILE__ ) for the plugin's main file |
|
244 | + * @return void |
|
245 | + */ |
|
246 | 246 | function espresso_deactivate_plugin( $plugin_basename = '' ) { |
247 | 247 | if ( ! function_exists( 'deactivate_plugins' ) ) { |
248 | 248 | require_once( ABSPATH . 'wp-admin/includes/plugin.php' ); |