@@ -10,7 +10,7 @@ discard block |
||
10 | 10 | */ |
11 | 11 | |
12 | 12 | // Exit if accessed directly. |
13 | -if ( ! defined( 'ABSPATH' ) ) { |
|
13 | +if ( ! defined('ABSPATH')) { |
|
14 | 14 | exit; |
15 | 15 | } |
16 | 16 | |
@@ -25,52 +25,52 @@ discard block |
||
25 | 25 | * |
26 | 26 | * @return void |
27 | 27 | */ |
28 | -function give_update_payment_details( $data ) { |
|
28 | +function give_update_payment_details($data) { |
|
29 | 29 | |
30 | - if ( ! current_user_can( 'edit_give_payments', $data['give_payment_id'] ) ) { |
|
31 | - wp_die( esc_html__( 'You do not have permission to edit payments.', 'give' ), esc_html__( 'Error', 'give' ), array( 'response' => 403 ) ); |
|
30 | + if ( ! current_user_can('edit_give_payments', $data['give_payment_id'])) { |
|
31 | + wp_die(esc_html__('You do not have permission to edit payments.', 'give'), esc_html__('Error', 'give'), array('response' => 403)); |
|
32 | 32 | } |
33 | 33 | |
34 | - check_admin_referer( 'give_update_payment_details_nonce' ); |
|
34 | + check_admin_referer('give_update_payment_details_nonce'); |
|
35 | 35 | |
36 | 36 | // Retrieve the payment ID. |
37 | - $payment_id = absint( $data['give_payment_id'] ); |
|
37 | + $payment_id = absint($data['give_payment_id']); |
|
38 | 38 | |
39 | 39 | /* @var Give_Payment $payment */ |
40 | - $payment = new Give_Payment( $payment_id ); |
|
40 | + $payment = new Give_Payment($payment_id); |
|
41 | 41 | |
42 | 42 | // Retrieve existing payment meta. |
43 | 43 | $meta = $payment->get_meta(); |
44 | 44 | $user_info = $payment->user_info; |
45 | 45 | |
46 | 46 | $status = $data['give-payment-status']; |
47 | - $date = sanitize_text_field( $data['give-payment-date'] ); |
|
48 | - $hour = sanitize_text_field( $data['give-payment-time-hour'] ); |
|
47 | + $date = sanitize_text_field($data['give-payment-date']); |
|
48 | + $hour = sanitize_text_field($data['give-payment-time-hour']); |
|
49 | 49 | |
50 | 50 | // Restrict to our high and low. |
51 | - if ( $hour > 23 ) { |
|
51 | + if ($hour > 23) { |
|
52 | 52 | $hour = 23; |
53 | - } elseif ( $hour < 0 ) { |
|
53 | + } elseif ($hour < 0) { |
|
54 | 54 | $hour = 00; |
55 | 55 | } |
56 | 56 | |
57 | - $minute = sanitize_text_field( $data['give-payment-time-min'] ); |
|
57 | + $minute = sanitize_text_field($data['give-payment-time-min']); |
|
58 | 58 | |
59 | 59 | // Restrict to our high and low. |
60 | - if ( $minute > 59 ) { |
|
60 | + if ($minute > 59) { |
|
61 | 61 | $minute = 59; |
62 | - } elseif ( $minute < 0 ) { |
|
62 | + } elseif ($minute < 0) { |
|
63 | 63 | $minute = 00; |
64 | 64 | } |
65 | 65 | |
66 | - $address = array_map( 'trim', $data['give-payment-address'][0] ); |
|
66 | + $address = array_map('trim', $data['give-payment-address'][0]); |
|
67 | 67 | |
68 | - $curr_total = give_sanitize_amount( $payment->total ); |
|
69 | - $new_total = give_sanitize_amount( $data['give-payment-total'] ); |
|
70 | - $date = date( 'Y-m-d', strtotime( $date ) ) . ' ' . $hour . ':' . $minute . ':00'; |
|
68 | + $curr_total = give_sanitize_amount($payment->total); |
|
69 | + $new_total = give_sanitize_amount($data['give-payment-total']); |
|
70 | + $date = date('Y-m-d', strtotime($date)).' '.$hour.':'.$minute.':00'; |
|
71 | 71 | |
72 | - $curr_donor_id = sanitize_text_field( $data['give-current-donor'] ); |
|
73 | - $new_donor_id = sanitize_text_field( $data['donor-id'] ); |
|
72 | + $curr_donor_id = sanitize_text_field($data['give-current-donor']); |
|
73 | + $new_donor_id = sanitize_text_field($data['donor-id']); |
|
74 | 74 | |
75 | 75 | /** |
76 | 76 | * Fires before updating edited donation. |
@@ -80,98 +80,98 @@ discard block |
||
80 | 80 | * |
81 | 81 | * @param int $payment_id The ID of the payment. |
82 | 82 | */ |
83 | - do_action( 'give_update_edited_donation', $payment_id ); |
|
83 | + do_action('give_update_edited_donation', $payment_id); |
|
84 | 84 | |
85 | 85 | $payment->date = $date; |
86 | 86 | $updated = $payment->save(); |
87 | 87 | |
88 | - if ( 0 === $updated ) { |
|
89 | - wp_die( esc_html__( 'Error Updating Donation.', 'give' ), esc_html__( 'Error', 'give' ), array( 'response' => 400 ) ); |
|
88 | + if (0 === $updated) { |
|
89 | + wp_die(esc_html__('Error Updating Donation.', 'give'), esc_html__('Error', 'give'), array('response' => 400)); |
|
90 | 90 | } |
91 | 91 | |
92 | 92 | $donor_changed = false; |
93 | 93 | |
94 | - if ( isset( $data['give-new-donor'] ) && $data['give-new-donor'] == '1' ) { |
|
94 | + if (isset($data['give-new-donor']) && $data['give-new-donor'] == '1') { |
|
95 | 95 | |
96 | - $email = isset( $data['give-new-donor-email'] ) ? sanitize_text_field( $data['give-new-donor-email'] ) : ''; |
|
97 | - $names = isset( $data['give-new-donor-name'] ) ? sanitize_text_field( $data['give-new-donor-name'] ) : ''; |
|
96 | + $email = isset($data['give-new-donor-email']) ? sanitize_text_field($data['give-new-donor-email']) : ''; |
|
97 | + $names = isset($data['give-new-donor-name']) ? sanitize_text_field($data['give-new-donor-name']) : ''; |
|
98 | 98 | |
99 | - if ( empty( $email ) || empty( $names ) ) { |
|
100 | - wp_die( esc_html__( 'New donors require a name and email address.', 'give' ), esc_html__( 'Error', 'give' ), array( 'response' => 400 ) ); |
|
99 | + if (empty($email) || empty($names)) { |
|
100 | + wp_die(esc_html__('New donors require a name and email address.', 'give'), esc_html__('Error', 'give'), array('response' => 400)); |
|
101 | 101 | } |
102 | 102 | |
103 | - $donor = new Give_Donor( $email ); |
|
104 | - if ( empty( $donor->id ) ) { |
|
105 | - $donor_data = array( 'name' => $names, 'email' => $email ); |
|
106 | - $user_id = email_exists( $email ); |
|
107 | - if ( false !== $user_id ) { |
|
103 | + $donor = new Give_Donor($email); |
|
104 | + if (empty($donor->id)) { |
|
105 | + $donor_data = array('name' => $names, 'email' => $email); |
|
106 | + $user_id = email_exists($email); |
|
107 | + if (false !== $user_id) { |
|
108 | 108 | $donor_data['user_id'] = $user_id; |
109 | 109 | } |
110 | 110 | |
111 | - if ( ! $donor->create( $donor_data ) ) { |
|
111 | + if ( ! $donor->create($donor_data)) { |
|
112 | 112 | // Failed to crete the new donor, assume the previous donor. |
113 | 113 | $donor_changed = false; |
114 | - $donor = new Give_Donor( $curr_donor_id ); |
|
115 | - give_set_error( 'give-payment-new-donor-fail', __( 'Error creating new donor.', 'give' ) ); |
|
114 | + $donor = new Give_Donor($curr_donor_id); |
|
115 | + give_set_error('give-payment-new-donor-fail', __('Error creating new donor.', 'give')); |
|
116 | 116 | } |
117 | 117 | } |
118 | 118 | |
119 | 119 | $new_donor_id = $donor->id; |
120 | 120 | |
121 | - $previous_donor = new Give_Donor( $curr_donor_id ); |
|
121 | + $previous_donor = new Give_Donor($curr_donor_id); |
|
122 | 122 | |
123 | 123 | $donor_changed = true; |
124 | 124 | |
125 | - } elseif ( $curr_donor_id !== $new_donor_id ) { |
|
125 | + } elseif ($curr_donor_id !== $new_donor_id) { |
|
126 | 126 | |
127 | - $donor = new Give_Donor( $new_donor_id ); |
|
127 | + $donor = new Give_Donor($new_donor_id); |
|
128 | 128 | $email = $donor->email; |
129 | 129 | $names = $donor->name; |
130 | 130 | |
131 | - $previous_donor = new Give_Donor( $curr_donor_id ); |
|
131 | + $previous_donor = new Give_Donor($curr_donor_id); |
|
132 | 132 | |
133 | 133 | $donor_changed = true; |
134 | 134 | |
135 | 135 | } else { |
136 | 136 | |
137 | - $donor = new Give_Donor( $curr_donor_id ); |
|
137 | + $donor = new Give_Donor($curr_donor_id); |
|
138 | 138 | $email = $donor->email; |
139 | 139 | $names = $donor->name; |
140 | 140 | |
141 | 141 | } |
142 | 142 | |
143 | 143 | // Setup first and last name from input values. |
144 | - $names = explode( ' ', $names ); |
|
145 | - $first_name = ! empty( $names[0] ) ? $names[0] : ''; |
|
144 | + $names = explode(' ', $names); |
|
145 | + $first_name = ! empty($names[0]) ? $names[0] : ''; |
|
146 | 146 | $last_name = ''; |
147 | - if ( ! empty( $names[1] ) ) { |
|
148 | - unset( $names[0] ); |
|
149 | - $last_name = implode( ' ', $names ); |
|
147 | + if ( ! empty($names[1])) { |
|
148 | + unset($names[0]); |
|
149 | + $last_name = implode(' ', $names); |
|
150 | 150 | } |
151 | 151 | |
152 | - if ( $donor_changed ) { |
|
152 | + if ($donor_changed) { |
|
153 | 153 | |
154 | 154 | // Remove the stats and payment from the previous donor and attach it to the new donor. |
155 | - $previous_donor->remove_payment( $payment_id, false ); |
|
156 | - $donor->attach_payment( $payment_id, false ); |
|
155 | + $previous_donor->remove_payment($payment_id, false); |
|
156 | + $donor->attach_payment($payment_id, false); |
|
157 | 157 | |
158 | - if ( 'publish' == $status ) { |
|
158 | + if ('publish' == $status) { |
|
159 | 159 | |
160 | 160 | // Reduce previous user donation count and amount. |
161 | 161 | $previous_donor->decrease_donation_count(); |
162 | - $previous_donor->decrease_value( $curr_total ); |
|
162 | + $previous_donor->decrease_value($curr_total); |
|
163 | 163 | |
164 | 164 | // If donation was completed adjust stats of new donors. |
165 | 165 | $donor->increase_purchase_count(); |
166 | - $donor->increase_value( $new_total ); |
|
166 | + $donor->increase_value($new_total); |
|
167 | 167 | } |
168 | 168 | |
169 | 169 | $payment->customer_id = $donor->id; |
170 | 170 | } else { |
171 | 171 | |
172 | - if ( 'publish' === $status ) { |
|
172 | + if ('publish' === $status) { |
|
173 | 173 | // Update user donation stat. |
174 | - $donor->update_donation_value( $curr_total, $new_total ); |
|
174 | + $donor->update_donation_value($curr_total, $new_total); |
|
175 | 175 | } |
176 | 176 | } |
177 | 177 | |
@@ -184,10 +184,10 @@ discard block |
||
184 | 184 | $payment->total = $new_total; |
185 | 185 | |
186 | 186 | // Check for payment notes. |
187 | - if ( ! empty( $data['give-payment-note'] ) ) { |
|
187 | + if ( ! empty($data['give-payment-note'])) { |
|
188 | 188 | |
189 | - $note = wp_kses( $data['give-payment-note'], array() ); |
|
190 | - give_insert_payment_note( $payment_id, $note ); |
|
189 | + $note = wp_kses($data['give-payment-note'], array()); |
|
190 | + give_insert_payment_note($payment_id, $note); |
|
191 | 191 | |
192 | 192 | } |
193 | 193 | |
@@ -195,17 +195,17 @@ discard block |
||
195 | 195 | $payment->status = $status; |
196 | 196 | |
197 | 197 | // Adjust total store earnings if the payment total has been changed. |
198 | - if ( $new_total !== $curr_total && 'publish' == $status ) { |
|
198 | + if ($new_total !== $curr_total && 'publish' == $status) { |
|
199 | 199 | |
200 | - if ( $new_total > $curr_total ) { |
|
200 | + if ($new_total > $curr_total) { |
|
201 | 201 | // Increase if our new total is higher. |
202 | 202 | $difference = $new_total - $curr_total; |
203 | - give_increase_total_earnings( $difference ); |
|
203 | + give_increase_total_earnings($difference); |
|
204 | 204 | |
205 | - } elseif ( $curr_total > $new_total ) { |
|
205 | + } elseif ($curr_total > $new_total) { |
|
206 | 206 | // Decrease if our new total is lower. |
207 | 207 | $difference = $curr_total - $new_total; |
208 | - give_decrease_total_earnings( $difference ); |
|
208 | + give_decrease_total_earnings($difference); |
|
209 | 209 | |
210 | 210 | } |
211 | 211 | } |
@@ -213,16 +213,16 @@ discard block |
||
213 | 213 | $payment->save(); |
214 | 214 | |
215 | 215 | // Get new give form ID. |
216 | - $new_form_id = absint( $data['give-payment-form-select'] ); |
|
217 | - $current_form_id = absint( $payment->get_meta( '_give_payment_form_id' ) ); |
|
216 | + $new_form_id = absint($data['give-payment-form-select']); |
|
217 | + $current_form_id = absint($payment->get_meta('_give_payment_form_id')); |
|
218 | 218 | |
219 | 219 | // We are adding payment transfer code in last to remove any conflict with above functionality. |
220 | 220 | // For example: above code will automatically handle form stat (increase/decrease) when payment status changes. |
221 | 221 | // Check if user want to transfer current payment to new give form id. |
222 | - if ( $new_form_id != $current_form_id ) { |
|
222 | + if ($new_form_id != $current_form_id) { |
|
223 | 223 | |
224 | 224 | // Get new give form title. |
225 | - $new_form_title = get_the_title( $new_form_id ); |
|
225 | + $new_form_title = get_the_title($new_form_id); |
|
226 | 226 | |
227 | 227 | // Update new give form data in payment data. |
228 | 228 | $payment_meta = $payment->get_meta(); |
@@ -230,56 +230,56 @@ discard block |
||
230 | 230 | $payment_meta['form_id'] = $new_form_id; |
231 | 231 | |
232 | 232 | // Update price id post meta data for set donation form. |
233 | - if ( ! give_has_variable_prices( $new_form_id ) ) { |
|
233 | + if ( ! give_has_variable_prices($new_form_id)) { |
|
234 | 234 | $payment_meta['price_id'] = ''; |
235 | 235 | } |
236 | 236 | |
237 | 237 | // Update payment give form meta data. |
238 | - $payment->update_meta( '_give_payment_form_id', $new_form_id ); |
|
239 | - $payment->update_meta( '_give_payment_form_title', $new_form_title ); |
|
240 | - $payment->update_meta( '_give_payment_meta', $payment_meta ); |
|
238 | + $payment->update_meta('_give_payment_form_id', $new_form_id); |
|
239 | + $payment->update_meta('_give_payment_form_title', $new_form_title); |
|
240 | + $payment->update_meta('_give_payment_meta', $payment_meta); |
|
241 | 241 | |
242 | 242 | // Update price id payment metadata. |
243 | - if ( ! give_has_variable_prices( $new_form_id ) ) { |
|
244 | - $payment->update_meta( '_give_payment_price_id', '' ); |
|
243 | + if ( ! give_has_variable_prices($new_form_id)) { |
|
244 | + $payment->update_meta('_give_payment_price_id', ''); |
|
245 | 245 | } |
246 | 246 | |
247 | 247 | // If donation was completed, adjust stats of forms. |
248 | - if ( 'publish' == $status ) { |
|
248 | + if ('publish' == $status) { |
|
249 | 249 | |
250 | 250 | // Decrease sale of old give form. For other payment status. |
251 | - $current_form = new Give_Donate_Form( $current_form_id ); |
|
251 | + $current_form = new Give_Donate_Form($current_form_id); |
|
252 | 252 | $current_form->decrease_sales(); |
253 | - $current_form->decrease_earnings( $curr_total ); |
|
253 | + $current_form->decrease_earnings($curr_total); |
|
254 | 254 | |
255 | 255 | // Increase sale of new give form. |
256 | - $new_form = new Give_Donate_Form( $new_form_id ); |
|
256 | + $new_form = new Give_Donate_Form($new_form_id); |
|
257 | 257 | $new_form->increase_sales(); |
258 | - $new_form->increase_earnings( $new_total ); |
|
258 | + $new_form->increase_earnings($new_total); |
|
259 | 259 | } |
260 | 260 | |
261 | 261 | // Re setup payment to update new meta value in object. |
262 | - $payment->update_payment_setup( $payment->ID ); |
|
262 | + $payment->update_payment_setup($payment->ID); |
|
263 | 263 | } |
264 | 264 | |
265 | 265 | // Update price id if current form is variable form. |
266 | - if ( ! empty( $data['give-variable-price'] ) && give_has_variable_prices( $payment->form_id ) ) { |
|
266 | + if ( ! empty($data['give-variable-price']) && give_has_variable_prices($payment->form_id)) { |
|
267 | 267 | |
268 | 268 | // Get payment meta data. |
269 | 269 | $payment_meta = $payment->get_meta(); |
270 | 270 | |
271 | 271 | // Set payment id to empty string if variable price id is negative ( i.e. custom amount feature enabled ). |
272 | - $data['give-variable-price'] = ( 'custom' === $data['give-variable-price'] ) ? 'custom' : ( 0 < $data['give-variable-price'] ) ? $data['give-variable-price'] : ''; |
|
272 | + $data['give-variable-price'] = ('custom' === $data['give-variable-price']) ? 'custom' : (0 < $data['give-variable-price']) ? $data['give-variable-price'] : ''; |
|
273 | 273 | |
274 | 274 | // Update payment meta data. |
275 | 275 | $payment_meta['price_id'] = $data['give-variable-price']; |
276 | 276 | |
277 | 277 | // Update payment give form meta data. |
278 | - $payment->update_meta( '_give_payment_price_id', $data['give-variable-price'] ); |
|
279 | - $payment->update_meta( '_give_payment_meta', $payment_meta ); |
|
278 | + $payment->update_meta('_give_payment_price_id', $data['give-variable-price']); |
|
279 | + $payment->update_meta('_give_payment_meta', $payment_meta); |
|
280 | 280 | |
281 | 281 | // Re setup payment to update new meta value in object. |
282 | - $payment->update_payment_setup( $payment->ID ); |
|
282 | + $payment->update_payment_setup($payment->ID); |
|
283 | 283 | } |
284 | 284 | |
285 | 285 | /** |
@@ -290,13 +290,13 @@ discard block |
||
290 | 290 | * |
291 | 291 | * @param int $payment_id The ID of the payment. |
292 | 292 | */ |
293 | - do_action( 'give_updated_edited_donation', $payment_id ); |
|
293 | + do_action('give_updated_edited_donation', $payment_id); |
|
294 | 294 | |
295 | - wp_safe_redirect( admin_url( 'edit.php?post_type=give_forms&page=give-payment-history&view=view-payment-details&give-message=payment-updated&id=' . $payment_id ) ); |
|
295 | + wp_safe_redirect(admin_url('edit.php?post_type=give_forms&page=give-payment-history&view=view-payment-details&give-message=payment-updated&id='.$payment_id)); |
|
296 | 296 | exit; |
297 | 297 | } |
298 | 298 | |
299 | -add_action( 'give_update_payment_details', 'give_update_payment_details' ); |
|
299 | +add_action('give_update_payment_details', 'give_update_payment_details'); |
|
300 | 300 | |
301 | 301 | /** |
302 | 302 | * Trigger a Donation Deletion. |
@@ -307,48 +307,48 @@ discard block |
||
307 | 307 | * |
308 | 308 | * @return void |
309 | 309 | */ |
310 | -function give_trigger_donation_delete( $data ) { |
|
311 | - if ( wp_verify_nonce( $data['_wpnonce'], 'give_donation_nonce' ) ) { |
|
310 | +function give_trigger_donation_delete($data) { |
|
311 | + if (wp_verify_nonce($data['_wpnonce'], 'give_donation_nonce')) { |
|
312 | 312 | |
313 | - $payment_id = absint( $data['purchase_id'] ); |
|
313 | + $payment_id = absint($data['purchase_id']); |
|
314 | 314 | |
315 | - if ( ! current_user_can( 'edit_give_payments', $payment_id ) ) { |
|
316 | - wp_die( __( 'You do not have permission to edit payments.', 'give' ), __( 'Error', 'give' ), array( 'response' => 403 ) ); |
|
315 | + if ( ! current_user_can('edit_give_payments', $payment_id)) { |
|
316 | + wp_die(__('You do not have permission to edit payments.', 'give'), __('Error', 'give'), array('response' => 403)); |
|
317 | 317 | } |
318 | 318 | |
319 | - give_delete_donation( $payment_id ); |
|
320 | - wp_redirect( admin_url( 'edit.php?post_type=give_forms&page=give-payment-history&give-message=donation_deleted' ) ); |
|
319 | + give_delete_donation($payment_id); |
|
320 | + wp_redirect(admin_url('edit.php?post_type=give_forms&page=give-payment-history&give-message=donation_deleted')); |
|
321 | 321 | give_die(); |
322 | 322 | } |
323 | 323 | } |
324 | 324 | |
325 | -add_action( 'give_delete_payment', 'give_trigger_donation_delete' ); |
|
325 | +add_action('give_delete_payment', 'give_trigger_donation_delete'); |
|
326 | 326 | |
327 | 327 | /** |
328 | 328 | * AJAX Store Donation Note |
329 | 329 | */ |
330 | 330 | function give_ajax_store_payment_note() { |
331 | 331 | |
332 | - $payment_id = absint( $_POST['payment_id'] ); |
|
333 | - $note = wp_kses( $_POST['note'], array() ); |
|
332 | + $payment_id = absint($_POST['payment_id']); |
|
333 | + $note = wp_kses($_POST['note'], array()); |
|
334 | 334 | |
335 | - if ( ! current_user_can( 'edit_give_payments', $payment_id ) ) { |
|
336 | - wp_die( __( 'You do not have permission to edit payments.', 'give' ), __( 'Error', 'give' ), array( 'response' => 403 ) ); |
|
335 | + if ( ! current_user_can('edit_give_payments', $payment_id)) { |
|
336 | + wp_die(__('You do not have permission to edit payments.', 'give'), __('Error', 'give'), array('response' => 403)); |
|
337 | 337 | } |
338 | 338 | |
339 | - if ( empty( $payment_id ) ) { |
|
340 | - die( '-1' ); |
|
339 | + if (empty($payment_id)) { |
|
340 | + die('-1'); |
|
341 | 341 | } |
342 | 342 | |
343 | - if ( empty( $note ) ) { |
|
344 | - die( '-1' ); |
|
343 | + if (empty($note)) { |
|
344 | + die('-1'); |
|
345 | 345 | } |
346 | 346 | |
347 | - $note_id = give_insert_payment_note( $payment_id, $note ); |
|
348 | - die( give_get_payment_note_html( $note_id ) ); |
|
347 | + $note_id = give_insert_payment_note($payment_id, $note); |
|
348 | + die(give_get_payment_note_html($note_id)); |
|
349 | 349 | } |
350 | 350 | |
351 | -add_action( 'wp_ajax_give_insert_payment_note', 'give_ajax_store_payment_note' ); |
|
351 | +add_action('wp_ajax_give_insert_payment_note', 'give_ajax_store_payment_note'); |
|
352 | 352 | |
353 | 353 | /** |
354 | 354 | * Triggers a donation note deletion without ajax |
@@ -359,24 +359,24 @@ discard block |
||
359 | 359 | * |
360 | 360 | * @return void |
361 | 361 | */ |
362 | -function give_trigger_payment_note_deletion( $data ) { |
|
362 | +function give_trigger_payment_note_deletion($data) { |
|
363 | 363 | |
364 | - if ( ! wp_verify_nonce( $data['_wpnonce'], 'give_delete_payment_note_' . $data['note_id'] ) ) { |
|
364 | + if ( ! wp_verify_nonce($data['_wpnonce'], 'give_delete_payment_note_'.$data['note_id'])) { |
|
365 | 365 | return; |
366 | 366 | } |
367 | 367 | |
368 | - if ( ! current_user_can( 'edit_give_payments', $data['payment_id'] ) ) { |
|
369 | - wp_die( esc_html__( 'You do not have permission to edit payments.', 'give' ), esc_html__( 'Error', 'give' ), array( 'response' => 403 ) ); |
|
368 | + if ( ! current_user_can('edit_give_payments', $data['payment_id'])) { |
|
369 | + wp_die(esc_html__('You do not have permission to edit payments.', 'give'), esc_html__('Error', 'give'), array('response' => 403)); |
|
370 | 370 | } |
371 | 371 | |
372 | - $edit_order_url = admin_url( 'edit.php?post_type=give_forms&page=give-payment-history&view=view-payment-details&give-message=donation-note-deleted&id=' . absint( $data['payment_id'] ) ); |
|
372 | + $edit_order_url = admin_url('edit.php?post_type=give_forms&page=give-payment-history&view=view-payment-details&give-message=donation-note-deleted&id='.absint($data['payment_id'])); |
|
373 | 373 | |
374 | - give_delete_payment_note( $data['note_id'], $data['payment_id'] ); |
|
374 | + give_delete_payment_note($data['note_id'], $data['payment_id']); |
|
375 | 375 | |
376 | - wp_redirect( $edit_order_url ); |
|
376 | + wp_redirect($edit_order_url); |
|
377 | 377 | } |
378 | 378 | |
379 | -add_action( 'give_delete_payment_note', 'give_trigger_payment_note_deletion' ); |
|
379 | +add_action('give_delete_payment_note', 'give_trigger_payment_note_deletion'); |
|
380 | 380 | |
381 | 381 | /** |
382 | 382 | * Delete a payment note deletion with ajax |
@@ -387,16 +387,16 @@ discard block |
||
387 | 387 | */ |
388 | 388 | function give_ajax_delete_payment_note() { |
389 | 389 | |
390 | - if ( ! current_user_can( 'edit_give_payments', $_POST['payment_id'] ) ) { |
|
391 | - wp_die( esc_html__( 'You do not have permission to edit payments.', 'give' ), esc_html__( 'Error', 'give' ), array( 'response' => 403 ) ); |
|
390 | + if ( ! current_user_can('edit_give_payments', $_POST['payment_id'])) { |
|
391 | + wp_die(esc_html__('You do not have permission to edit payments.', 'give'), esc_html__('Error', 'give'), array('response' => 403)); |
|
392 | 392 | } |
393 | 393 | |
394 | - if ( give_delete_payment_note( $_POST['note_id'], $_POST['payment_id'] ) ) { |
|
395 | - die( '1' ); |
|
394 | + if (give_delete_payment_note($_POST['note_id'], $_POST['payment_id'])) { |
|
395 | + die('1'); |
|
396 | 396 | } else { |
397 | - die( '-1' ); |
|
397 | + die('-1'); |
|
398 | 398 | } |
399 | 399 | |
400 | 400 | } |
401 | 401 | |
402 | -add_action( 'wp_ajax_give_delete_payment_note', 'give_ajax_delete_payment_note' ); |
|
402 | +add_action('wp_ajax_give_delete_payment_note', 'give_ajax_delete_payment_note'); |
@@ -514,16 +514,16 @@ |
||
514 | 514 | <p> |
515 | 515 | <strong><?php esc_html_e( 'Donor Name:', 'give' ); ?></strong><br> |
516 | 516 | <?php |
517 | - $donor_billing_name = give_get_donor_name_by( $payment_id, 'donation' ); |
|
518 | - $donor_name = give_get_donor_name_by( $donor_id, 'donor' ); |
|
519 | - |
|
520 | - // Check whether the donor name and WP_User name is same or not. |
|
521 | - if( sanitize_title( $donor_billing_name ) != sanitize_title( $donor_name ) ){ |
|
522 | - echo $donor_billing_name . ' (<a href="' . esc_url( admin_url( "edit.php?post_type=give_forms&page=give-donors&view=overview&id=$donor_id" ) ) . '">' . $donor_name . '</a>)'; |
|
523 | - }else{ |
|
524 | - echo $donor_name; |
|
525 | - } |
|
526 | - ?> |
|
517 | + $donor_billing_name = give_get_donor_name_by( $payment_id, 'donation' ); |
|
518 | + $donor_name = give_get_donor_name_by( $donor_id, 'donor' ); |
|
519 | + |
|
520 | + // Check whether the donor name and WP_User name is same or not. |
|
521 | + if( sanitize_title( $donor_billing_name ) != sanitize_title( $donor_name ) ){ |
|
522 | + echo $donor_billing_name . ' (<a href="' . esc_url( admin_url( "edit.php?post_type=give_forms&page=give-donors&view=overview&id=$donor_id" ) ) . '">' . $donor_name . '</a>)'; |
|
523 | + }else{ |
|
524 | + echo $donor_name; |
|
525 | + } |
|
526 | + ?> |
|
527 | 527 | </p> |
528 | 528 | <p> |
529 | 529 | <strong><?php esc_html_e( 'Donor Email:', 'give' ); ?></strong><br> |
@@ -10,7 +10,7 @@ discard block |
||
10 | 10 | */ |
11 | 11 | |
12 | 12 | // Exit if accessed directly. |
13 | -if ( ! defined( 'ABSPATH' ) ) { |
|
13 | +if ( ! defined('ABSPATH')) { |
|
14 | 14 | exit; |
15 | 15 | } |
16 | 16 | |
@@ -20,27 +20,27 @@ discard block |
||
20 | 20 | * @since 1.0 |
21 | 21 | * @return void |
22 | 22 | */ |
23 | -if ( ! isset( $_GET['id'] ) || ! is_numeric( $_GET['id'] ) ) { |
|
24 | - wp_die( esc_html__( 'Donation ID not supplied. Please try again.', 'give' ), esc_html__( 'Error', 'give' ), array( 'response' => 400 ) ); |
|
23 | +if ( ! isset($_GET['id']) || ! is_numeric($_GET['id'])) { |
|
24 | + wp_die(esc_html__('Donation ID not supplied. Please try again.', 'give'), esc_html__('Error', 'give'), array('response' => 400)); |
|
25 | 25 | } |
26 | 26 | |
27 | 27 | // Setup the variables |
28 | -$payment_id = absint( $_GET['id'] ); |
|
29 | -$payment = new Give_Payment( $payment_id ); |
|
28 | +$payment_id = absint($_GET['id']); |
|
29 | +$payment = new Give_Payment($payment_id); |
|
30 | 30 | |
31 | 31 | // Sanity check... fail if donation ID is invalid |
32 | 32 | $payment_exists = $payment->ID; |
33 | -if ( empty( $payment_exists ) ) { |
|
34 | - wp_die( esc_html__( 'The specified ID does not belong to a donation. Please try again.', 'give' ), esc_html__( 'Error', 'give' ), array( 'response' => 400 ) ); |
|
33 | +if (empty($payment_exists)) { |
|
34 | + wp_die(esc_html__('The specified ID does not belong to a donation. Please try again.', 'give'), esc_html__('Error', 'give'), array('response' => 400)); |
|
35 | 35 | } |
36 | 36 | |
37 | 37 | $number = $payment->number; |
38 | 38 | $payment_meta = $payment->get_meta(); |
39 | -$transaction_id = esc_attr( $payment->transaction_id ); |
|
39 | +$transaction_id = esc_attr($payment->transaction_id); |
|
40 | 40 | $user_id = $payment->user_id; |
41 | 41 | $donor_id = $payment->customer_id; |
42 | -$payment_date = strtotime( $payment->date ); |
|
43 | -$user_info = give_get_payment_meta_user_info( $payment_id ); |
|
42 | +$payment_date = strtotime($payment->date); |
|
43 | +$user_info = give_get_payment_meta_user_info($payment_id); |
|
44 | 44 | $address = $payment->address; |
45 | 45 | $currency_code = $payment->currency; |
46 | 46 | $gateway = $payment->gateway; |
@@ -52,11 +52,11 @@ discard block |
||
52 | 52 | <h1 id="transaction-details-heading"><?php |
53 | 53 | printf( |
54 | 54 | /* translators: %s: donation number */ |
55 | - esc_html__( 'Donation %s', 'give' ), |
|
55 | + esc_html__('Donation %s', 'give'), |
|
56 | 56 | $number |
57 | 57 | ); |
58 | - if ( $payment_mode == 'test' ) { |
|
59 | - echo '<span id="test-payment-label" class="give-item-label give-item-label-orange" data-tooltip="' . esc_attr__( 'This donation was made in test mode.', 'give' ) . '" data-tooltip-my-position="center left" data-tooltip-target-position="center right">' . esc_html__( 'Test Donation', 'give' ) . '</span>'; |
|
58 | + if ($payment_mode == 'test') { |
|
59 | + echo '<span id="test-payment-label" class="give-item-label give-item-label-orange" data-tooltip="'.esc_attr__('This donation was made in test mode.', 'give').'" data-tooltip-my-position="center left" data-tooltip-target-position="center right">'.esc_html__('Test Donation', 'give').'</span>'; |
|
60 | 60 | } |
61 | 61 | ?></h1> |
62 | 62 | |
@@ -68,7 +68,7 @@ discard block |
||
68 | 68 | * |
69 | 69 | * @param int $payment_id Payment id. |
70 | 70 | */ |
71 | - do_action( 'give_view_order_details_before', $payment_id ); |
|
71 | + do_action('give_view_order_details_before', $payment_id); |
|
72 | 72 | ?> |
73 | 73 | <form id="give-edit-order-form" method="post"> |
74 | 74 | <?php |
@@ -79,7 +79,7 @@ discard block |
||
79 | 79 | * |
80 | 80 | * @param int $payment_id Payment id. |
81 | 81 | */ |
82 | - do_action( 'give_view_order_details_form_top', $payment_id ); |
|
82 | + do_action('give_view_order_details_form_top', $payment_id); |
|
83 | 83 | ?> |
84 | 84 | <div id="poststuff"> |
85 | 85 | <div id="give-dashboard-widgets-wrap"> |
@@ -95,12 +95,12 @@ discard block |
||
95 | 95 | * |
96 | 96 | * @param int $payment_id Payment id. |
97 | 97 | */ |
98 | - do_action( 'give_view_order_details_sidebar_before', $payment_id ); |
|
98 | + do_action('give_view_order_details_sidebar_before', $payment_id); |
|
99 | 99 | ?> |
100 | 100 | |
101 | 101 | <div id="give-order-update" class="postbox give-order-data"> |
102 | 102 | |
103 | - <h3 class="hndle"><?php esc_html_e( 'Update Donation', 'give' ); ?></h3> |
|
103 | + <h3 class="hndle"><?php esc_html_e('Update Donation', 'give'); ?></h3> |
|
104 | 104 | |
105 | 105 | <div class="inside"> |
106 | 106 | <div class="give-admin-box"> |
@@ -113,33 +113,33 @@ discard block |
||
113 | 113 | * |
114 | 114 | * @param int $payment_id Payment id. |
115 | 115 | */ |
116 | - do_action( 'give_view_order_details_totals_before', $payment_id ); |
|
116 | + do_action('give_view_order_details_totals_before', $payment_id); |
|
117 | 117 | ?> |
118 | 118 | |
119 | 119 | <div class="give-admin-box-inside"> |
120 | 120 | <p> |
121 | - <label for="give-payment-status" class="strong"><?php esc_html_e( 'Status:', 'give' ); ?></label> |
|
121 | + <label for="give-payment-status" class="strong"><?php esc_html_e('Status:', 'give'); ?></label> |
|
122 | 122 | <select id="give-payment-status" name="give-payment-status" class="medium-text"> |
123 | - <?php foreach ( give_get_payment_statuses() as $key => $status ) : ?> |
|
124 | - <option value="<?php echo esc_attr( $key ); ?>"<?php selected( $payment->status, $key, true ); ?>><?php echo esc_html( $status ); ?></option> |
|
123 | + <?php foreach (give_get_payment_statuses() as $key => $status) : ?> |
|
124 | + <option value="<?php echo esc_attr($key); ?>"<?php selected($payment->status, $key, true); ?>><?php echo esc_html($status); ?></option> |
|
125 | 125 | <?php endforeach; ?> |
126 | 126 | </select> |
127 | - <span class="give-donation-status status-<?php echo sanitize_title( $payment->status ); ?>"><span class="give-donation-status-icon"></span></span> |
|
127 | + <span class="give-donation-status status-<?php echo sanitize_title($payment->status); ?>"><span class="give-donation-status-icon"></span></span> |
|
128 | 128 | </p> |
129 | 129 | </div> |
130 | 130 | |
131 | 131 | <div class="give-admin-box-inside"> |
132 | 132 | <p> |
133 | - <label for="give-payment-date" class="strong"><?php esc_html_e( 'Date:', 'give' ); ?></label> |
|
134 | - <input type="text" id="give-payment-date" name="give-payment-date" value="<?php echo esc_attr( date( 'm/d/Y', $payment_date ) ); ?>" class="medium-text give_datepicker"/> |
|
133 | + <label for="give-payment-date" class="strong"><?php esc_html_e('Date:', 'give'); ?></label> |
|
134 | + <input type="text" id="give-payment-date" name="give-payment-date" value="<?php echo esc_attr(date('m/d/Y', $payment_date)); ?>" class="medium-text give_datepicker"/> |
|
135 | 135 | </p> |
136 | 136 | </div> |
137 | 137 | |
138 | 138 | <div class="give-admin-box-inside"> |
139 | 139 | <p> |
140 | - <label for="give-payment-time-hour" class="strong"><?php esc_html_e( 'Time:', 'give' ); ?></label> |
|
141 | - <input type="number" step="1" max="24" id="give-payment-time-hour" name="give-payment-time-hour" value="<?php echo esc_attr( date_i18n( 'H', $payment_date ) ); ?>" class="small-text give-payment-time-hour"/> : |
|
142 | - <input type="number" step="1" max="59" id="give-payment-time-min" name="give-payment-time-min" value="<?php echo esc_attr( date( 'i', $payment_date ) ); ?>" class="small-text give-payment-time-min"/> |
|
140 | + <label for="give-payment-time-hour" class="strong"><?php esc_html_e('Time:', 'give'); ?></label> |
|
141 | + <input type="number" step="1" max="24" id="give-payment-time-hour" name="give-payment-time-hour" value="<?php echo esc_attr(date_i18n('H', $payment_date)); ?>" class="small-text give-payment-time-hour"/> : |
|
142 | + <input type="number" step="1" max="59" id="give-payment-time-min" name="give-payment-time-min" value="<?php echo esc_attr(date('i', $payment_date)); ?>" class="small-text give-payment-time-min"/> |
|
143 | 143 | </p> |
144 | 144 | </div> |
145 | 145 | |
@@ -153,13 +153,13 @@ discard block |
||
153 | 153 | * |
154 | 154 | * @param int $payment_id Payment id. |
155 | 155 | */ |
156 | - do_action( 'give_view_order_details_update_inner', $payment_id ); ?> |
|
156 | + do_action('give_view_order_details_update_inner', $payment_id); ?> |
|
157 | 157 | |
158 | 158 | <div class="give-order-payment give-admin-box-inside"> |
159 | 159 | <p> |
160 | - <label for="give-payment-total" class="strong"><?php esc_html_e( 'Total Donation:', 'give' ); ?></label> |
|
161 | - <?php echo give_currency_symbol( $payment->currency ); ?> |
|
162 | - <input id="give-payment-total" name="give-payment-total" type="text" class="small-text give-price-field" value="<?php echo esc_attr( give_format_decimal( give_get_payment_amount( $payment_id ) ) ); ?>"/> |
|
160 | + <label for="give-payment-total" class="strong"><?php esc_html_e('Total Donation:', 'give'); ?></label> |
|
161 | + <?php echo give_currency_symbol($payment->currency); ?> |
|
162 | + <input id="give-payment-total" name="give-payment-total" type="text" class="small-text give-price-field" value="<?php echo esc_attr(give_format_decimal(give_get_payment_amount($payment_id))); ?>"/> |
|
163 | 163 | </p> |
164 | 164 | </div> |
165 | 165 | |
@@ -171,7 +171,7 @@ discard block |
||
171 | 171 | * |
172 | 172 | * @param int $payment_id Payment id. |
173 | 173 | */ |
174 | - do_action( 'give_view_order_details_totals_after', $payment_id ); |
|
174 | + do_action('give_view_order_details_totals_after', $payment_id); |
|
175 | 175 | ?> |
176 | 176 | |
177 | 177 | </div> |
@@ -189,17 +189,17 @@ discard block |
||
189 | 189 | * |
190 | 190 | * @param int $payment_id Payment id. |
191 | 191 | */ |
192 | - do_action( 'give_view_order_details_update_before', $payment_id ); |
|
192 | + do_action('give_view_order_details_update_before', $payment_id); |
|
193 | 193 | ?> |
194 | 194 | |
195 | 195 | <div id="major-publishing-actions"> |
196 | 196 | <div id="publishing-action"> |
197 | - <input type="submit" class="button button-primary right" value="<?php esc_attr_e( 'Save Donation', 'give' ); ?>"/> |
|
198 | - <?php if ( give_is_payment_complete( $payment_id ) ) : ?> |
|
199 | - <a href="<?php echo esc_url( add_query_arg( array( |
|
197 | + <input type="submit" class="button button-primary right" value="<?php esc_attr_e('Save Donation', 'give'); ?>"/> |
|
198 | + <?php if (give_is_payment_complete($payment_id)) : ?> |
|
199 | + <a href="<?php echo esc_url(add_query_arg(array( |
|
200 | 200 | 'give-action' => 'email_links', |
201 | 201 | 'purchase_id' => $payment_id, |
202 | - ) ) ); ?>" id="give-resend-receipt" class="button-secondary right"><?php esc_html_e( 'Resend Receipt', 'give' ); ?></a> |
|
202 | + ))); ?>" id="give-resend-receipt" class="button-secondary right"><?php esc_html_e('Resend Receipt', 'give'); ?></a> |
|
203 | 203 | <?php endif; ?> |
204 | 204 | </div> |
205 | 205 | <div class="clear"></div> |
@@ -213,7 +213,7 @@ discard block |
||
213 | 213 | * |
214 | 214 | * @param int $payment_id Payment id. |
215 | 215 | */ |
216 | - do_action( 'give_view_order_details_update_after', $payment_id ); |
|
216 | + do_action('give_view_order_details_update_after', $payment_id); |
|
217 | 217 | ?> |
218 | 218 | |
219 | 219 | </div> |
@@ -224,7 +224,7 @@ discard block |
||
224 | 224 | |
225 | 225 | <div id="give-order-details" class="postbox give-order-data"> |
226 | 226 | |
227 | - <h3 class="hndle"><?php esc_html_e( 'Donation Meta', 'give' ); ?></h3> |
|
227 | + <h3 class="hndle"><?php esc_html_e('Donation Meta', 'give'); ?></h3> |
|
228 | 228 | |
229 | 229 | <div class="inside"> |
230 | 230 | <div class="give-admin-box"> |
@@ -237,44 +237,44 @@ discard block |
||
237 | 237 | * |
238 | 238 | * @param int $payment_id Payment id. |
239 | 239 | */ |
240 | - do_action( 'give_view_order_details_payment_meta_before', $payment_id ); |
|
240 | + do_action('give_view_order_details_payment_meta_before', $payment_id); |
|
241 | 241 | |
242 | - $gateway = give_get_payment_gateway( $payment_id ); |
|
243 | - if ( $gateway ) : ?> |
|
242 | + $gateway = give_get_payment_gateway($payment_id); |
|
243 | + if ($gateway) : ?> |
|
244 | 244 | <div class="give-order-gateway give-admin-box-inside"> |
245 | 245 | <p> |
246 | - <strong><?php esc_html_e( 'Gateway:', 'give' ); ?></strong> |
|
247 | - <?php echo give_get_gateway_admin_label( $gateway ); ?> |
|
246 | + <strong><?php esc_html_e('Gateway:', 'give'); ?></strong> |
|
247 | + <?php echo give_get_gateway_admin_label($gateway); ?> |
|
248 | 248 | </p> |
249 | 249 | </div> |
250 | 250 | <?php endif; ?> |
251 | 251 | |
252 | 252 | <div class="give-order-payment-key give-admin-box-inside"> |
253 | 253 | <p> |
254 | - <strong><?php esc_html_e( 'Key:', 'give' ); ?></strong> |
|
255 | - <?php echo give_get_payment_key( $payment_id ); ?> |
|
254 | + <strong><?php esc_html_e('Key:', 'give'); ?></strong> |
|
255 | + <?php echo give_get_payment_key($payment_id); ?> |
|
256 | 256 | </p> |
257 | 257 | </div> |
258 | 258 | |
259 | 259 | <div class="give-order-ip give-admin-box-inside"> |
260 | 260 | <p> |
261 | - <strong><?php esc_html_e( 'IP:', 'give' ); ?></strong> |
|
262 | - <?php echo esc_html( give_get_payment_user_ip( $payment_id ) ); ?> |
|
261 | + <strong><?php esc_html_e('IP:', 'give'); ?></strong> |
|
262 | + <?php echo esc_html(give_get_payment_user_ip($payment_id)); ?> |
|
263 | 263 | </p> |
264 | 264 | </div> |
265 | 265 | |
266 | - <?php if ( $transaction_id ) : ?> |
|
266 | + <?php if ($transaction_id) : ?> |
|
267 | 267 | <div class="give-order-tx-id give-admin-box-inside"> |
268 | 268 | <p> |
269 | - <strong><?php esc_html_e( 'Donation ID:', 'give' ); ?></strong> |
|
270 | - <?php echo apply_filters( "give_payment_details_transaction_id-{$gateway}", $transaction_id, $payment_id ); ?> |
|
269 | + <strong><?php esc_html_e('Donation ID:', 'give'); ?></strong> |
|
270 | + <?php echo apply_filters("give_payment_details_transaction_id-{$gateway}", $transaction_id, $payment_id); ?> |
|
271 | 271 | </p> |
272 | 272 | </div> |
273 | 273 | <?php endif; ?> |
274 | 274 | |
275 | 275 | <div class="give-admin-box-inside"> |
276 | - <p><?php $purchase_url = admin_url( 'edit.php?post_type=give_forms&page=give-payment-history&user=' . urlencode( esc_attr( give_get_payment_user_email( $payment_id ) ) ) ); ?> |
|
277 | - <a href="<?php echo $purchase_url; ?>"><?php esc_html_e( 'View all donations for this donor »', 'give' ); ?></a> |
|
276 | + <p><?php $purchase_url = admin_url('edit.php?post_type=give_forms&page=give-payment-history&user='.urlencode(esc_attr(give_get_payment_user_email($payment_id)))); ?> |
|
277 | + <a href="<?php echo $purchase_url; ?>"><?php esc_html_e('View all donations for this donor »', 'give'); ?></a> |
|
278 | 278 | </p> |
279 | 279 | </div> |
280 | 280 | |
@@ -286,7 +286,7 @@ discard block |
||
286 | 286 | * |
287 | 287 | * @param int $payment_id Payment id. |
288 | 288 | */ |
289 | - do_action( 'give_view_order_details_payment_meta_after', $payment_id ); |
|
289 | + do_action('give_view_order_details_payment_meta_after', $payment_id); |
|
290 | 290 | ?> |
291 | 291 | |
292 | 292 | </div> |
@@ -306,7 +306,7 @@ discard block |
||
306 | 306 | * |
307 | 307 | * @param int $payment_id Payment id. |
308 | 308 | */ |
309 | - do_action( 'give_view_order_details_sidebar_after', $payment_id ); |
|
309 | + do_action('give_view_order_details_sidebar_after', $payment_id); |
|
310 | 310 | ?> |
311 | 311 | |
312 | 312 | </div> |
@@ -326,56 +326,56 @@ discard block |
||
326 | 326 | * |
327 | 327 | * @param int $payment_id Payment id. |
328 | 328 | */ |
329 | - do_action( 'give_view_order_details_main_before', $payment_id ); |
|
329 | + do_action('give_view_order_details_main_before', $payment_id); |
|
330 | 330 | ?> |
331 | 331 | |
332 | 332 | <?php $column_count = 'columns-3'; ?> |
333 | 333 | <div id="give-donation-overview" class="postbox <?php echo $column_count; ?>"> |
334 | - <h3 class="hndle"><?php esc_html_e( 'Donation Information', 'give' ); ?></h3> |
|
334 | + <h3 class="hndle"><?php esc_html_e('Donation Information', 'give'); ?></h3> |
|
335 | 335 | |
336 | 336 | <div class="inside"> |
337 | 337 | |
338 | 338 | <div class="column-container"> |
339 | 339 | <div class="column"> |
340 | 340 | <p> |
341 | - <strong><?php esc_html_e( 'Donation Form ID:', 'give' ); ?></strong><br> |
|
341 | + <strong><?php esc_html_e('Donation Form ID:', 'give'); ?></strong><br> |
|
342 | 342 | <?php |
343 | - if ( $payment_meta['form_id'] ) : |
|
343 | + if ($payment_meta['form_id']) : |
|
344 | 344 | printf( |
345 | 345 | '<a href="%1$s" target="_blank">#%2$s</a>', |
346 | - admin_url( 'post.php?action=edit&post=' . $payment_meta['form_id'] ), |
|
346 | + admin_url('post.php?action=edit&post='.$payment_meta['form_id']), |
|
347 | 347 | $payment_meta['form_id'] |
348 | 348 | ); |
349 | 349 | endif; |
350 | 350 | ?> |
351 | 351 | </p> |
352 | 352 | <p> |
353 | - <strong><?php esc_html_e( 'Donation Form Title:', 'give' ); ?></strong><br> |
|
354 | - <?php echo Give()->html->forms_dropdown( array( |
|
353 | + <strong><?php esc_html_e('Donation Form Title:', 'give'); ?></strong><br> |
|
354 | + <?php echo Give()->html->forms_dropdown(array( |
|
355 | 355 | 'selected' => $payment_meta['form_id'], |
356 | 356 | 'name' => 'give-payment-form-select', |
357 | 357 | 'id' => 'give-payment-form-select', |
358 | 358 | 'chosen' => true, |
359 | - ) ); ?> |
|
359 | + )); ?> |
|
360 | 360 | </p> |
361 | 361 | </div> |
362 | 362 | <div class="column"> |
363 | 363 | <p> |
364 | - <strong><?php esc_html_e( 'Donation Date:', 'give' ); ?></strong><br> |
|
365 | - <?php echo date_i18n( give_date_format(), $payment_date ); ?> |
|
364 | + <strong><?php esc_html_e('Donation Date:', 'give'); ?></strong><br> |
|
365 | + <?php echo date_i18n(give_date_format(), $payment_date); ?> |
|
366 | 366 | </p> |
367 | 367 | <p> |
368 | - <strong><?php esc_html_e( 'Donation Level:', 'give' ); ?></strong><br> |
|
368 | + <strong><?php esc_html_e('Donation Level:', 'give'); ?></strong><br> |
|
369 | 369 | <span class="give-donation-level"> |
370 | 370 | <?php |
371 | - $var_prices = give_has_variable_prices( $payment_meta['form_id'] ); |
|
372 | - if ( empty( $var_prices ) ) { |
|
373 | - esc_html_e( 'n/a', 'give' ); |
|
371 | + $var_prices = give_has_variable_prices($payment_meta['form_id']); |
|
372 | + if (empty($var_prices)) { |
|
373 | + esc_html_e('n/a', 'give'); |
|
374 | 374 | } else { |
375 | 375 | $prices_atts = ''; |
376 | - if( $variable_prices = give_get_variable_prices( $payment_meta['form_id'] ) ) { |
|
377 | - foreach ( $variable_prices as $variable_price ) { |
|
378 | - $prices_atts[$variable_price['_give_id']['level_id']] = give_format_amount( $variable_price['_give_amount'] ); |
|
376 | + if ($variable_prices = give_get_variable_prices($payment_meta['form_id'])) { |
|
377 | + foreach ($variable_prices as $variable_price) { |
|
378 | + $prices_atts[$variable_price['_give_id']['level_id']] = give_format_amount($variable_price['_give_amount']); |
|
379 | 379 | } |
380 | 380 | } |
381 | 381 | // Variable price dropdown options. |
@@ -385,11 +385,11 @@ discard block |
||
385 | 385 | 'chosen' => true, |
386 | 386 | 'show_option_all' => '', |
387 | 387 | 'show_option_none' => '', |
388 | - 'select_atts' => 'data-prices=' . esc_attr( json_encode( $prices_atts ) ), |
|
388 | + 'select_atts' => 'data-prices='.esc_attr(json_encode($prices_atts)), |
|
389 | 389 | 'selected' => $payment_meta['price_id'], |
390 | 390 | ); |
391 | 391 | // Render variable prices select tag html. |
392 | - give_get_form_variable_price_dropdown( $variable_price_dropdown_option, true ); |
|
392 | + give_get_form_variable_price_dropdown($variable_price_dropdown_option, true); |
|
393 | 393 | } |
394 | 394 | ?> |
395 | 395 | </span> |
@@ -397,8 +397,8 @@ discard block |
||
397 | 397 | </div> |
398 | 398 | <div class="column"> |
399 | 399 | <p> |
400 | - <strong><?php esc_html_e( 'Total Donation:', 'give' ); ?></strong><br> |
|
401 | - <?php echo give_currency_filter( give_format_amount( $payment->total ), give_get_payment_currency_code( $payment->ID ) ); ?> |
|
400 | + <strong><?php esc_html_e('Total Donation:', 'give'); ?></strong><br> |
|
401 | + <?php echo give_currency_filter(give_format_amount($payment->total), give_get_payment_currency_code($payment->ID)); ?> |
|
402 | 402 | </p> |
403 | 403 | <p> |
404 | 404 | <?php |
@@ -411,7 +411,7 @@ discard block |
||
411 | 411 | * |
412 | 412 | * @param int $payment_id Payment id. |
413 | 413 | */ |
414 | - do_action( 'give_donation_details_thead_before', $payment_id ); |
|
414 | + do_action('give_donation_details_thead_before', $payment_id); |
|
415 | 415 | |
416 | 416 | |
417 | 417 | /** |
@@ -423,7 +423,7 @@ discard block |
||
423 | 423 | * |
424 | 424 | * @param int $payment_id Payment id. |
425 | 425 | */ |
426 | - do_action( 'give_donation_details_thead_after', $payment_id ); |
|
426 | + do_action('give_donation_details_thead_after', $payment_id); |
|
427 | 427 | |
428 | 428 | /** |
429 | 429 | * Fires in order details page, in the donation-information metabox, before the body elements. |
@@ -434,7 +434,7 @@ discard block |
||
434 | 434 | * |
435 | 435 | * @param int $payment_id Payment id. |
436 | 436 | */ |
437 | - do_action( 'give_donation_details_tbody_before', $payment_id ); |
|
437 | + do_action('give_donation_details_tbody_before', $payment_id); |
|
438 | 438 | |
439 | 439 | /** |
440 | 440 | * Fires in order details page, in the donation-information metabox, after the body elements. |
@@ -445,7 +445,7 @@ discard block |
||
445 | 445 | * |
446 | 446 | * @param int $payment_id Payment id. |
447 | 447 | */ |
448 | - do_action( 'give_donation_details_tbody_after', $payment_id ); |
|
448 | + do_action('give_donation_details_tbody_after', $payment_id); |
|
449 | 449 | ?> |
450 | 450 | </p> |
451 | 451 | </div> |
@@ -465,67 +465,67 @@ discard block |
||
465 | 465 | * |
466 | 466 | * @param int $payment_id Payment id. |
467 | 467 | */ |
468 | - do_action( 'give_view_order_details_files_after', $payment_id ); |
|
468 | + do_action('give_view_order_details_files_after', $payment_id); |
|
469 | 469 | ?> |
470 | 470 | |
471 | 471 | <div id="give-donor-details" class="postbox"> |
472 | - <h3 class="hndle"><?php esc_html_e( 'Donor Details', 'give' ); ?></h3> |
|
472 | + <h3 class="hndle"><?php esc_html_e('Donor Details', 'give'); ?></h3> |
|
473 | 473 | |
474 | 474 | <div class="inside"> |
475 | 475 | |
476 | - <?php $donor = new Give_Donor( $donor_id ); ?> |
|
476 | + <?php $donor = new Give_Donor($donor_id); ?> |
|
477 | 477 | |
478 | 478 | <div class="column-container donor-info"> |
479 | 479 | <div class="column"> |
480 | 480 | <p> |
481 | - <strong><?php esc_html_e( 'Donor ID:', 'give' ); ?></strong><br> |
|
481 | + <strong><?php esc_html_e('Donor ID:', 'give'); ?></strong><br> |
|
482 | 482 | <?php |
483 | - if ( ! empty( $donor->id ) ) { |
|
483 | + if ( ! empty($donor->id)) { |
|
484 | 484 | printf( |
485 | 485 | '<a href="%1$s" target="_blank">#%2$s</a>', |
486 | - admin_url( 'edit.php?post_type=give_forms&page=give-donors&view=overview&id=' . $donor->id ), |
|
486 | + admin_url('edit.php?post_type=give_forms&page=give-donors&view=overview&id='.$donor->id), |
|
487 | 487 | $donor->id |
488 | 488 | ); |
489 | 489 | } |
490 | 490 | ?> |
491 | 491 | </p> |
492 | 492 | <p> |
493 | - <strong><?php esc_html_e( 'Donor Since:', 'give' ); ?></strong><br> |
|
494 | - <?php echo date_i18n( give_date_format(), strtotime( $donor->date_created ) ) ?> |
|
493 | + <strong><?php esc_html_e('Donor Since:', 'give'); ?></strong><br> |
|
494 | + <?php echo date_i18n(give_date_format(), strtotime($donor->date_created)) ?> |
|
495 | 495 | </p> |
496 | 496 | </div> |
497 | 497 | <div class="column"> |
498 | 498 | <p> |
499 | - <strong><?php esc_html_e( 'Donor Name:', 'give' ); ?></strong><br> |
|
499 | + <strong><?php esc_html_e('Donor Name:', 'give'); ?></strong><br> |
|
500 | 500 | <?php |
501 | - $donor_billing_name = give_get_donor_name_by( $payment_id, 'donation' ); |
|
502 | - $donor_name = give_get_donor_name_by( $donor_id, 'donor' ); |
|
501 | + $donor_billing_name = give_get_donor_name_by($payment_id, 'donation'); |
|
502 | + $donor_name = give_get_donor_name_by($donor_id, 'donor'); |
|
503 | 503 | |
504 | 504 | // Check whether the donor name and WP_User name is same or not. |
505 | - if( sanitize_title( $donor_billing_name ) != sanitize_title( $donor_name ) ){ |
|
506 | - echo $donor_billing_name . ' (<a href="' . esc_url( admin_url( "edit.php?post_type=give_forms&page=give-donors&view=overview&id=$donor_id" ) ) . '">' . $donor_name . '</a>)'; |
|
507 | - }else{ |
|
505 | + if (sanitize_title($donor_billing_name) != sanitize_title($donor_name)) { |
|
506 | + echo $donor_billing_name.' (<a href="'.esc_url(admin_url("edit.php?post_type=give_forms&page=give-donors&view=overview&id=$donor_id")).'">'.$donor_name.'</a>)'; |
|
507 | + } else { |
|
508 | 508 | echo $donor_name; |
509 | 509 | } |
510 | 510 | ?> |
511 | 511 | </p> |
512 | 512 | <p> |
513 | - <strong><?php esc_html_e( 'Donor Email:', 'give' ); ?></strong><br> |
|
513 | + <strong><?php esc_html_e('Donor Email:', 'give'); ?></strong><br> |
|
514 | 514 | <?php echo $donor->email; ?> |
515 | 515 | </p> |
516 | 516 | </div> |
517 | 517 | <div class="column"> |
518 | 518 | <p> |
519 | - <strong><?php esc_html_e( 'Change Donor:', 'give' ); ?></strong><br> |
|
519 | + <strong><?php esc_html_e('Change Donor:', 'give'); ?></strong><br> |
|
520 | 520 | <?php |
521 | - echo Give()->html->donor_dropdown( array( |
|
521 | + echo Give()->html->donor_dropdown(array( |
|
522 | 522 | 'selected' => $donor->id, |
523 | 523 | 'name' => 'donor-id', |
524 | - ) ); |
|
524 | + )); |
|
525 | 525 | ?> |
526 | 526 | </p> |
527 | 527 | <p> |
528 | - <a href="#new" class="give-payment-new-donor"><?php esc_html_e( 'Create New Donor', 'give' ); ?></a> |
|
528 | + <a href="#new" class="give-payment-new-donor"><?php esc_html_e('Create New Donor', 'give'); ?></a> |
|
529 | 529 | </p> |
530 | 530 | </div> |
531 | 531 | </div> |
@@ -533,13 +533,13 @@ discard block |
||
533 | 533 | <div class="column-container new-donor" style="display: none"> |
534 | 534 | <div class="column"> |
535 | 535 | <p> |
536 | - <label for="give-new-donor-name"><?php esc_html_e( 'New Donor Name:', 'give' ); ?></label> |
|
536 | + <label for="give-new-donor-name"><?php esc_html_e('New Donor Name:', 'give'); ?></label> |
|
537 | 537 | <input id="give-new-donor-name" type="text" name="give-new-donor-name" value="" class="medium-text"/> |
538 | 538 | </p> |
539 | 539 | </div> |
540 | 540 | <div class="column"> |
541 | 541 | <p> |
542 | - <label for="give-new-donor-email"><?php esc_html_e( 'New Donor Email:', 'give' ); ?></label> |
|
542 | + <label for="give-new-donor-email"><?php esc_html_e('New Donor Email:', 'give'); ?></label> |
|
543 | 543 | <input id="give-new-donor-email" type="email" name="give-new-donor-email" value="" class="medium-text"/> |
544 | 544 | </p> |
545 | 545 | </div> |
@@ -547,9 +547,9 @@ discard block |
||
547 | 547 | <p> |
548 | 548 | <input type="hidden" name="give-current-donor" value="<?php echo $donor->id; ?>"/> |
549 | 549 | <input type="hidden" id="give-new-donor" name="give-new-donor" value="0"/> |
550 | - <a href="#cancel" class="give-payment-new-donor-cancel give-delete"><?php esc_html_e( 'Cancel', 'give' ); ?></a> |
|
550 | + <a href="#cancel" class="give-payment-new-donor-cancel give-delete"><?php esc_html_e('Cancel', 'give'); ?></a> |
|
551 | 551 | <br> |
552 | - <em><?php esc_html_e( 'Click "Save Donation" to create new donor.', 'give' ); ?></em> |
|
552 | + <em><?php esc_html_e('Click "Save Donation" to create new donor.', 'give'); ?></em> |
|
553 | 553 | </p> |
554 | 554 | </div> |
555 | 555 | </div> |
@@ -565,7 +565,7 @@ discard block |
||
565 | 565 | * @param array $payment_meta Payment meta. |
566 | 566 | * @param array $user_info User information. |
567 | 567 | */ |
568 | - do_action( 'give_payment_personal_details_list', $payment_meta, $user_info ); |
|
568 | + do_action('give_payment_personal_details_list', $payment_meta, $user_info); |
|
569 | 569 | |
570 | 570 | /** |
571 | 571 | * Fires on the donation details page, in the donor-details metabox. |
@@ -574,7 +574,7 @@ discard block |
||
574 | 574 | * |
575 | 575 | * @param int $payment_id Payment id. |
576 | 576 | */ |
577 | - do_action( 'give_payment_view_details', $payment_id ); |
|
577 | + do_action('give_payment_view_details', $payment_id); |
|
578 | 578 | ?> |
579 | 579 | |
580 | 580 | </div> |
@@ -590,11 +590,11 @@ discard block |
||
590 | 590 | * |
591 | 591 | * @param int $payment_id Payment id. |
592 | 592 | */ |
593 | - do_action( 'give_view_order_details_billing_before', $payment_id ); |
|
593 | + do_action('give_view_order_details_billing_before', $payment_id); |
|
594 | 594 | ?> |
595 | 595 | |
596 | 596 | <div id="give-billing-details" class="postbox"> |
597 | - <h3 class="hndle"><?php esc_html_e( 'Billing Address', 'give' ); ?></h3> |
|
597 | + <h3 class="hndle"><?php esc_html_e('Billing Address', 'give'); ?></h3> |
|
598 | 598 | |
599 | 599 | <div class="inside"> |
600 | 600 | |
@@ -604,59 +604,59 @@ discard block |
||
604 | 604 | <div class="data column-container"> |
605 | 605 | <div class="column"> |
606 | 606 | <div class="give-wrap-address-line1"> |
607 | - <label for="give-payment-address-line1" class="order-data-address"><?php esc_html_e( 'Address 1:', 'give' ); ?></label> |
|
608 | - <input id="give-payment-address-line1" type="text" name="give-payment-address[0][line1]" value="<?php echo esc_attr( $address['line1'] ); ?>" class="medium-text"/> |
|
607 | + <label for="give-payment-address-line1" class="order-data-address"><?php esc_html_e('Address 1:', 'give'); ?></label> |
|
608 | + <input id="give-payment-address-line1" type="text" name="give-payment-address[0][line1]" value="<?php echo esc_attr($address['line1']); ?>" class="medium-text"/> |
|
609 | 609 | </div> |
610 | 610 | <div class="give-wrap-address-line2"> |
611 | - <label for="give-payment-address-line2" class="order-data-address-line"><?php esc_html_e( 'Address 2:', 'give' ); ?></label> |
|
612 | - <input id="give-payment-address-line2" type="text" name="give-payment-address[0][line2]" value="<?php echo esc_attr( $address['line2'] ); ?>" class="medium-text"/> |
|
611 | + <label for="give-payment-address-line2" class="order-data-address-line"><?php esc_html_e('Address 2:', 'give'); ?></label> |
|
612 | + <input id="give-payment-address-line2" type="text" name="give-payment-address[0][line2]" value="<?php echo esc_attr($address['line2']); ?>" class="medium-text"/> |
|
613 | 613 | </div> |
614 | 614 | </div> |
615 | 615 | <div class="column"> |
616 | 616 | <div class="give-wrap-address-city"> |
617 | - <label for="give-payment-address-city" class="order-data-address-line"><?php esc_html_e( 'City:', 'give' ); ?></label> |
|
618 | - <input id="give-payment-address-city" type="text" name="give-payment-address[0][city]" value="<?php echo esc_attr( $address['city'] ); ?>" class="medium-text"/> |
|
617 | + <label for="give-payment-address-city" class="order-data-address-line"><?php esc_html_e('City:', 'give'); ?></label> |
|
618 | + <input id="give-payment-address-city" type="text" name="give-payment-address[0][city]" value="<?php echo esc_attr($address['city']); ?>" class="medium-text"/> |
|
619 | 619 | </div> |
620 | 620 | <div class="give-wrap-address-zip"> |
621 | - <label for="give-payment-address-zip" class="order-data-address-line"><?php esc_html_e( 'Zip / Postal Code:', 'give' ); ?></label> |
|
622 | - <input id="give-payment-address-zip" type="text" name="give-payment-address[0][zip]" value="<?php echo esc_attr( $address['zip'] ); ?>" class="medium-text"/> |
|
621 | + <label for="give-payment-address-zip" class="order-data-address-line"><?php esc_html_e('Zip / Postal Code:', 'give'); ?></label> |
|
622 | + <input id="give-payment-address-zip" type="text" name="give-payment-address[0][zip]" value="<?php echo esc_attr($address['zip']); ?>" class="medium-text"/> |
|
623 | 623 | |
624 | 624 | </div> |
625 | 625 | </div> |
626 | 626 | <div class="column"> |
627 | 627 | <div id="give-order-address-country-wrap"> |
628 | - <label class="order-data-address-line"><?php esc_html_e( 'Country:', 'give' ); ?></label> |
|
628 | + <label class="order-data-address-line"><?php esc_html_e('Country:', 'give'); ?></label> |
|
629 | 629 | <?php |
630 | - echo Give()->html->select( array( |
|
630 | + echo Give()->html->select(array( |
|
631 | 631 | 'options' => give_get_country_list(), |
632 | 632 | 'name' => 'give-payment-address[0][country]', |
633 | 633 | 'selected' => $address['country'], |
634 | 634 | 'show_option_all' => false, |
635 | 635 | 'show_option_none' => false, |
636 | 636 | 'chosen' => true, |
637 | - 'placeholder' => esc_attr__( 'Select a country', 'give' ), |
|
638 | - 'data' => array( 'search-type' => 'no_ajax' ), |
|
639 | - ) ); |
|
637 | + 'placeholder' => esc_attr__('Select a country', 'give'), |
|
638 | + 'data' => array('search-type' => 'no_ajax'), |
|
639 | + )); |
|
640 | 640 | ?> |
641 | 641 | </div> |
642 | 642 | <div id="give-order-address-state-wrap"> |
643 | - <label for="give-payment-address-state" class="order-data-address-line"><?php esc_html_e( 'State / Province:', 'give' ); ?></label> |
|
643 | + <label for="give-payment-address-state" class="order-data-address-line"><?php esc_html_e('State / Province:', 'give'); ?></label> |
|
644 | 644 | <?php |
645 | - $states = give_get_states( $address['country'] ); |
|
646 | - if ( ! empty( $states ) ) { |
|
647 | - echo Give()->html->select( array( |
|
645 | + $states = give_get_states($address['country']); |
|
646 | + if ( ! empty($states)) { |
|
647 | + echo Give()->html->select(array( |
|
648 | 648 | 'options' => $states, |
649 | 649 | 'name' => 'give-payment-address[0][state]', |
650 | 650 | 'selected' => $address['state'], |
651 | 651 | 'show_option_all' => false, |
652 | 652 | 'show_option_none' => false, |
653 | 653 | 'chosen' => true, |
654 | - 'placeholder' => esc_attr__( 'Select a state', 'give' ), |
|
655 | - 'data' => array( 'search-type' => 'no_ajax' ), |
|
656 | - ) ); |
|
654 | + 'placeholder' => esc_attr__('Select a state', 'give'), |
|
655 | + 'data' => array('search-type' => 'no_ajax'), |
|
656 | + )); |
|
657 | 657 | } else { |
658 | 658 | ?> |
659 | - <input id="give-payment-address-state" type="text" name="give-payment-address[0][state]" value="<?php echo esc_attr( $address['state'] ); ?>" class="medium-text"/> |
|
659 | + <input id="give-payment-address-state" type="text" name="give-payment-address[0][state]" value="<?php echo esc_attr($address['state']); ?>" class="medium-text"/> |
|
660 | 660 | <?php |
661 | 661 | } ?> |
662 | 662 | </div> |
@@ -676,7 +676,7 @@ discard block |
||
676 | 676 | * |
677 | 677 | * @param int $payment_id Payment id. |
678 | 678 | */ |
679 | - do_action( 'give_payment_billing_details', $payment_id ); |
|
679 | + do_action('give_payment_billing_details', $payment_id); |
|
680 | 680 | ?> |
681 | 681 | |
682 | 682 | </div> |
@@ -692,32 +692,32 @@ discard block |
||
692 | 692 | * |
693 | 693 | * @param int $payment_id Payment id. |
694 | 694 | */ |
695 | - do_action( 'give_view_order_details_billing_after', $payment_id ); |
|
695 | + do_action('give_view_order_details_billing_after', $payment_id); |
|
696 | 696 | ?> |
697 | 697 | |
698 | 698 | <div id="give-payment-notes" class="postbox"> |
699 | - <h3 class="hndle"><?php esc_html_e( 'Donation Notes', 'give' ); ?></h3> |
|
699 | + <h3 class="hndle"><?php esc_html_e('Donation Notes', 'give'); ?></h3> |
|
700 | 700 | |
701 | 701 | <div class="inside"> |
702 | 702 | <div id="give-payment-notes-inner"> |
703 | 703 | <?php |
704 | - $notes = give_get_payment_notes( $payment_id ); |
|
705 | - if ( ! empty( $notes ) ) { |
|
704 | + $notes = give_get_payment_notes($payment_id); |
|
705 | + if ( ! empty($notes)) { |
|
706 | 706 | $no_notes_display = ' style="display:none;"'; |
707 | - foreach ( $notes as $note ) : |
|
707 | + foreach ($notes as $note) : |
|
708 | 708 | |
709 | - echo give_get_payment_note_html( $note, $payment_id ); |
|
709 | + echo give_get_payment_note_html($note, $payment_id); |
|
710 | 710 | |
711 | 711 | endforeach; |
712 | 712 | } else { |
713 | 713 | $no_notes_display = ''; |
714 | 714 | } |
715 | - echo '<p class="give-no-payment-notes"' . $no_notes_display . '>' . esc_html__( 'No donation notes.', 'give' ) . '</p>'; ?> |
|
715 | + echo '<p class="give-no-payment-notes"'.$no_notes_display.'>'.esc_html__('No donation notes.', 'give').'</p>'; ?> |
|
716 | 716 | </div> |
717 | 717 | <textarea name="give-payment-note" id="give-payment-note" class="large-text"></textarea> |
718 | 718 | |
719 | 719 | <div class="give-clearfix"> |
720 | - <button id="give-add-payment-note" class="button button-secondary button-small" data-payment-id="<?php echo absint( $payment_id ); ?>"><?php esc_html_e( 'Add Note', 'give' ); ?></button> |
|
720 | + <button id="give-add-payment-note" class="button button-secondary button-small" data-payment-id="<?php echo absint($payment_id); ?>"><?php esc_html_e('Add Note', 'give'); ?></button> |
|
721 | 721 | </div> |
722 | 722 | |
723 | 723 | </div> |
@@ -733,7 +733,7 @@ discard block |
||
733 | 733 | * |
734 | 734 | * @param int $payment_id Payment id. |
735 | 735 | */ |
736 | - do_action( 'give_view_order_details_main_after', $payment_id ); |
|
736 | + do_action('give_view_order_details_main_after', $payment_id); |
|
737 | 737 | ?> |
738 | 738 | |
739 | 739 | </div> |
@@ -755,11 +755,11 @@ discard block |
||
755 | 755 | * |
756 | 756 | * @param int $payment_id Payment id. |
757 | 757 | */ |
758 | - do_action( 'give_view_order_details_form_bottom', $payment_id ); |
|
758 | + do_action('give_view_order_details_form_bottom', $payment_id); |
|
759 | 759 | |
760 | - wp_nonce_field( 'give_update_payment_details_nonce' ); |
|
760 | + wp_nonce_field('give_update_payment_details_nonce'); |
|
761 | 761 | ?> |
762 | - <input type="hidden" name="give_payment_id" value="<?php echo esc_attr( $payment_id ); ?>"/> |
|
762 | + <input type="hidden" name="give_payment_id" value="<?php echo esc_attr($payment_id); ?>"/> |
|
763 | 763 | <input type="hidden" name="give_action" value="update_payment_details"/> |
764 | 764 | </form> |
765 | 765 | <?php |
@@ -770,6 +770,6 @@ discard block |
||
770 | 770 | * |
771 | 771 | * @param int $payment_id Payment id. |
772 | 772 | */ |
773 | - do_action( 'give_view_order_details_after', $payment_id ); |
|
773 | + do_action('give_view_order_details_after', $payment_id); |
|
774 | 774 | ?> |
775 | 775 | </div><!-- /.wrap --> |
@@ -520,7 +520,7 @@ |
||
520 | 520 | // Check whether the donor name and WP_User name is same or not. |
521 | 521 | if( sanitize_title( $donor_billing_name ) != sanitize_title( $donor_name ) ){ |
522 | 522 | echo $donor_billing_name . ' (<a href="' . esc_url( admin_url( "edit.php?post_type=give_forms&page=give-donors&view=overview&id=$donor_id" ) ) . '">' . $donor_name . '</a>)'; |
523 | - }else{ |
|
523 | + } else{ |
|
524 | 524 | echo $donor_name; |
525 | 525 | } |
526 | 526 | ?> |
@@ -10,7 +10,7 @@ discard block |
||
10 | 10 | */ |
11 | 11 | |
12 | 12 | // Exit if accessed directly. |
13 | -if ( ! defined( 'ABSPATH' ) ) { |
|
13 | +if ( ! defined('ABSPATH')) { |
|
14 | 14 | exit; |
15 | 15 | } |
16 | 16 | |
@@ -25,12 +25,12 @@ discard block |
||
25 | 25 | */ |
26 | 26 | function give_payment_history_page() { |
27 | 27 | |
28 | - $give_payment = get_post_type_object( 'give_payment' ); |
|
28 | + $give_payment = get_post_type_object('give_payment'); |
|
29 | 29 | |
30 | - if ( isset( $_GET['view'] ) && 'view-payment-details' == $_GET['view'] ) { |
|
31 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/payments/view-payment-details.php'; |
|
30 | + if (isset($_GET['view']) && 'view-payment-details' == $_GET['view']) { |
|
31 | + require_once GIVE_PLUGIN_DIR.'includes/admin/payments/view-payment-details.php'; |
|
32 | 32 | } else { |
33 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/payments/class-payments-table.php'; |
|
33 | + require_once GIVE_PLUGIN_DIR.'includes/admin/payments/class-payments-table.php'; |
|
34 | 34 | $payments_table = new Give_Payment_History_Table(); |
35 | 35 | $payments_table->prepare_items(); |
36 | 36 | ?> |
@@ -44,17 +44,17 @@ discard block |
||
44 | 44 | * |
45 | 45 | * @since 1.7 |
46 | 46 | */ |
47 | - do_action( 'give_payments_page_top' ); |
|
47 | + do_action('give_payments_page_top'); |
|
48 | 48 | ?> |
49 | 49 | |
50 | - <form id="give-payments-advanced-filter" method="get" action="<?php echo admin_url( 'edit.php?post_type=give_forms&page=give-payment-history' ); ?>"> |
|
50 | + <form id="give-payments-advanced-filter" method="get" action="<?php echo admin_url('edit.php?post_type=give_forms&page=give-payment-history'); ?>"> |
|
51 | 51 | <input type="hidden" name="post_type" value="give_forms" /> |
52 | 52 | <input type="hidden" name="page" value="give-payment-history" /> |
53 | 53 | <?php $payments_table->views() ?> |
54 | 54 | <?php $payments_table->advanced_filters(); ?> |
55 | 55 | </form> |
56 | 56 | |
57 | - <form id="give-payments-filter" method="get" action="<?php echo admin_url( 'edit.php?post_type=give_forms&page=give-payment-history' ); ?>"> |
|
57 | + <form id="give-payments-filter" method="get" action="<?php echo admin_url('edit.php?post_type=give_forms&page=give-payment-history'); ?>"> |
|
58 | 58 | <input type="hidden" name="post_type" value="give_forms" /> |
59 | 59 | <input type="hidden" name="page" value="give-payment-history" /> |
60 | 60 | <?php $payments_table->display() ?> |
@@ -66,7 +66,7 @@ discard block |
||
66 | 66 | * |
67 | 67 | * @since 1.7 |
68 | 68 | */ |
69 | - do_action( 'give_payments_page_bottom' ); |
|
69 | + do_action('give_payments_page_bottom'); |
|
70 | 70 | ?> |
71 | 71 | |
72 | 72 | </div> |
@@ -83,29 +83,29 @@ discard block |
||
83 | 83 | * @param $title |
84 | 84 | * @return string |
85 | 85 | */ |
86 | -function give_view_order_details_title( $admin_title, $title ) { |
|
86 | +function give_view_order_details_title($admin_title, $title) { |
|
87 | 87 | |
88 | - if ( 'give_forms_page_give-payment-history' != get_current_screen()->base ) { |
|
88 | + if ('give_forms_page_give-payment-history' != get_current_screen()->base) { |
|
89 | 89 | return $admin_title; |
90 | 90 | } |
91 | 91 | |
92 | - if( ! isset( $_GET['give-action'] ) ) { |
|
92 | + if ( ! isset($_GET['give-action'])) { |
|
93 | 93 | return $admin_title; |
94 | 94 | } |
95 | 95 | |
96 | - switch( $_GET['give-action'] ) : |
|
96 | + switch ($_GET['give-action']) : |
|
97 | 97 | |
98 | 98 | case 'view-payment-details' : |
99 | 99 | $title = sprintf( |
100 | 100 | /* translators: %s: admin title */ |
101 | - esc_html__( 'View Donation Details - %s', 'give' ), |
|
101 | + esc_html__('View Donation Details - %s', 'give'), |
|
102 | 102 | $admin_title |
103 | 103 | ); |
104 | 104 | break; |
105 | 105 | case 'edit-payment' : |
106 | 106 | $title = sprintf( |
107 | 107 | /* translators: %s: admin title */ |
108 | - esc_html__( 'Edit Donation - %s', 'give' ), |
|
108 | + esc_html__('Edit Donation - %s', 'give'), |
|
109 | 109 | $admin_title |
110 | 110 | ); |
111 | 111 | break; |
@@ -116,7 +116,7 @@ discard block |
||
116 | 116 | |
117 | 117 | return $title; |
118 | 118 | } |
119 | -add_filter( 'admin_title', 'give_view_order_details_title', 10, 2 ); |
|
119 | +add_filter('admin_title', 'give_view_order_details_title', 10, 2); |
|
120 | 120 | |
121 | 121 | /** |
122 | 122 | * Intercept default Edit post links for Give payments and rewrite them to the View Order Details screen. |
@@ -128,20 +128,20 @@ discard block |
||
128 | 128 | * @param $context |
129 | 129 | * @return string |
130 | 130 | */ |
131 | -function give_override_edit_post_for_payment_link( $url, $post_id = 0, $context ) { |
|
131 | +function give_override_edit_post_for_payment_link($url, $post_id = 0, $context) { |
|
132 | 132 | |
133 | - $post = get_post( $post_id ); |
|
133 | + $post = get_post($post_id); |
|
134 | 134 | |
135 | - if( ! $post ) { |
|
135 | + if ( ! $post) { |
|
136 | 136 | return $url; |
137 | 137 | } |
138 | 138 | |
139 | - if( 'give_payment' != $post->post_type ) { |
|
139 | + if ('give_payment' != $post->post_type) { |
|
140 | 140 | return $url; |
141 | 141 | } |
142 | 142 | |
143 | - $url = admin_url( 'edit.php?post_type=give_forms&page=give-payment-history&view=view-payment-details&id=' . $post_id ); |
|
143 | + $url = admin_url('edit.php?post_type=give_forms&page=give-payment-history&view=view-payment-details&id='.$post_id); |
|
144 | 144 | |
145 | 145 | return $url; |
146 | 146 | } |
147 | -add_filter( 'get_edit_post_link', 'give_override_edit_post_for_payment_link', 10, 3 ); |
|
147 | +add_filter('get_edit_post_link', 'give_override_edit_post_for_payment_link', 10, 3); |
@@ -10,13 +10,13 @@ discard block |
||
10 | 10 | */ |
11 | 11 | |
12 | 12 | // Exit if accessed directly. |
13 | -if ( ! defined( 'ABSPATH' ) ) { |
|
13 | +if ( ! defined('ABSPATH')) { |
|
14 | 14 | exit; |
15 | 15 | } |
16 | 16 | |
17 | 17 | // Load WP_List_Table if not loaded. |
18 | -if ( ! class_exists( 'WP_List_Table' ) ) { |
|
19 | - require_once ABSPATH . 'wp-admin/includes/class-wp-list-table.php'; |
|
18 | +if ( ! class_exists('WP_List_Table')) { |
|
19 | + require_once ABSPATH.'wp-admin/includes/class-wp-list-table.php'; |
|
20 | 20 | } |
21 | 21 | |
22 | 22 | /** |
@@ -126,15 +126,15 @@ discard block |
||
126 | 126 | public function __construct() { |
127 | 127 | |
128 | 128 | // Set parent defaults. |
129 | - parent::__construct( array( |
|
130 | - 'singular' => give_get_forms_label_singular(), // Singular name of the listed records. |
|
131 | - 'plural' => give_get_forms_label_plural(), // Plural name of the listed records. |
|
132 | - 'ajax' => false, // Does this table support ajax? |
|
133 | - ) ); |
|
129 | + parent::__construct(array( |
|
130 | + 'singular' => give_get_forms_label_singular(), // Singular name of the listed records. |
|
131 | + 'plural' => give_get_forms_label_plural(), // Plural name of the listed records. |
|
132 | + 'ajax' => false, // Does this table support ajax? |
|
133 | + )); |
|
134 | 134 | |
135 | 135 | $this->get_payment_counts(); |
136 | 136 | $this->process_bulk_action(); |
137 | - $this->base_url = admin_url( 'edit.php?post_type=give_forms&page=give-payment-history' ); |
|
137 | + $this->base_url = admin_url('edit.php?post_type=give_forms&page=give-payment-history'); |
|
138 | 138 | } |
139 | 139 | |
140 | 140 | /** |
@@ -143,31 +143,31 @@ discard block |
||
143 | 143 | * @return void |
144 | 144 | */ |
145 | 145 | public function advanced_filters() { |
146 | - $start_date = isset( $_GET['start-date'] ) ? sanitize_text_field( $_GET['start-date'] ) : null; |
|
147 | - $end_date = isset( $_GET['end-date'] ) ? sanitize_text_field( $_GET['end-date'] ) : null; |
|
148 | - $status = isset( $_GET['status'] ) ? sanitize_text_field( $_GET['status'] ) : ''; |
|
149 | - $donor = isset( $_GET['donor'] ) ? sanitize_text_field( $_GET['donor'] ) : ''; |
|
150 | - $search = isset( $_GET['s'] ) ? sanitize_text_field( $_GET['s'] ) : ''; |
|
146 | + $start_date = isset($_GET['start-date']) ? sanitize_text_field($_GET['start-date']) : null; |
|
147 | + $end_date = isset($_GET['end-date']) ? sanitize_text_field($_GET['end-date']) : null; |
|
148 | + $status = isset($_GET['status']) ? sanitize_text_field($_GET['status']) : ''; |
|
149 | + $donor = isset($_GET['donor']) ? sanitize_text_field($_GET['donor']) : ''; |
|
150 | + $search = isset($_GET['s']) ? sanitize_text_field($_GET['s']) : ''; |
|
151 | 151 | ?> |
152 | 152 | <div id="give-payment-filters"> |
153 | 153 | <span id="give-payment-date-filters"> |
154 | 154 | <label for="start-date" |
155 | - class="give-start-date-label"><?php esc_html_e( 'Start Date:', 'give' ); ?></label> |
|
155 | + class="give-start-date-label"><?php esc_html_e('Start Date:', 'give'); ?></label> |
|
156 | 156 | <input type="text" id="start-date" name="start-date" class="give_datepicker" |
157 | 157 | value="<?php echo $start_date; ?>" placeholder="mm/dd/yyyy" /> |
158 | - <label for="end-date" class="give-end-date-label"><?php esc_html_e( 'End Date:', 'give' ); ?></label> |
|
158 | + <label for="end-date" class="give-end-date-label"><?php esc_html_e('End Date:', 'give'); ?></label> |
|
159 | 159 | <input type="text" id="end-date" name="end-date" class="give_datepicker" |
160 | 160 | value="<?php echo $end_date; ?>" placeholder="mm/dd/yyyy" /> |
161 | - <input type="submit" class="button-secondary" value="<?php esc_attr_e( 'Apply', 'give' ); ?>" /> |
|
161 | + <input type="submit" class="button-secondary" value="<?php esc_attr_e('Apply', 'give'); ?>" /> |
|
162 | 162 | </span> |
163 | - <?php if ( ! empty( $status ) ) : ?> |
|
164 | - <input type="hidden" name="status" value="<?php echo esc_attr( $status ); ?>" /> |
|
163 | + <?php if ( ! empty($status)) : ?> |
|
164 | + <input type="hidden" name="status" value="<?php echo esc_attr($status); ?>" /> |
|
165 | 165 | <?php endif; ?> |
166 | - <?php if ( ! empty( $start_date ) || ! empty( $end_date ) || ! empty( $donor )|| ! empty( $search ) ) : ?> |
|
167 | - <a href="<?php echo admin_url( 'edit.php?post_type=give_forms&page=give-payment-history' ); ?>" |
|
168 | - class="button-secondary"><?php esc_html_e( 'Clear Filter', 'give' ); ?></a> |
|
166 | + <?php if ( ! empty($start_date) || ! empty($end_date) || ! empty($donor) || ! empty($search)) : ?> |
|
167 | + <a href="<?php echo admin_url('edit.php?post_type=give_forms&page=give-payment-history'); ?>" |
|
168 | + class="button-secondary"><?php esc_html_e('Clear Filter', 'give'); ?></a> |
|
169 | 169 | <?php endif; ?> |
170 | - <?php $this->search_box( esc_html__( 'Search', 'give' ), 'give-payments' ); ?> |
|
170 | + <?php $this->search_box(esc_html__('Search', 'give'), 'give-payments'); ?> |
|
171 | 171 | </div> |
172 | 172 | |
173 | 173 | <?php |
@@ -184,18 +184,18 @@ discard block |
||
184 | 184 | * |
185 | 185 | * @return void |
186 | 186 | */ |
187 | - public function search_box( $text, $input_id ) { |
|
188 | - if ( empty( $_REQUEST['s'] ) && ! $this->has_items() ) { |
|
187 | + public function search_box($text, $input_id) { |
|
188 | + if (empty($_REQUEST['s']) && ! $this->has_items()) { |
|
189 | 189 | return; |
190 | 190 | } |
191 | 191 | |
192 | - $input_id = $input_id . '-search-input'; |
|
192 | + $input_id = $input_id.'-search-input'; |
|
193 | 193 | |
194 | - if ( ! empty( $_REQUEST['orderby'] ) ) { |
|
195 | - echo '<input type="hidden" name="orderby" value="' . esc_attr( $_REQUEST['orderby'] ) . '" />'; |
|
194 | + if ( ! empty($_REQUEST['orderby'])) { |
|
195 | + echo '<input type="hidden" name="orderby" value="'.esc_attr($_REQUEST['orderby']).'" />'; |
|
196 | 196 | } |
197 | - if ( ! empty( $_REQUEST['order'] ) ) { |
|
198 | - echo '<input type="hidden" name="order" value="' . esc_attr( $_REQUEST['order'] ) . '" />'; |
|
197 | + if ( ! empty($_REQUEST['order'])) { |
|
198 | + echo '<input type="hidden" name="order" value="'.esc_attr($_REQUEST['order']).'" />'; |
|
199 | 199 | } |
200 | 200 | ?> |
201 | 201 | <p class="search-box" role="search"> |
@@ -207,13 +207,13 @@ discard block |
||
207 | 207 | * |
208 | 208 | * @since 1.7 |
209 | 209 | */ |
210 | - do_action( 'give_payment_history_search' ); |
|
210 | + do_action('give_payment_history_search'); |
|
211 | 211 | ?> |
212 | 212 | <label class="screen-reader-text" for="<?php echo $input_id ?>"><?php echo $text; ?>:</label> |
213 | 213 | <input type="search" id="<?php echo $input_id ?>" name="s" value="<?php _admin_search_query(); ?>" /> |
214 | - <?php submit_button( $text, 'button', false, false, array( |
|
214 | + <?php submit_button($text, 'button', false, false, array( |
|
215 | 215 | 'ID' => 'search-submit', |
216 | - ) ); ?><br /> |
|
216 | + )); ?><br /> |
|
217 | 217 | </p> |
218 | 218 | <?php |
219 | 219 | } |
@@ -227,57 +227,57 @@ discard block |
||
227 | 227 | */ |
228 | 228 | public function get_views() { |
229 | 229 | |
230 | - $current = isset( $_GET['status'] ) ? $_GET['status'] : ''; |
|
231 | - $total_count = ' <span class="count">(' . $this->total_count . ')</span>'; |
|
232 | - $complete_count = ' <span class="count">(' . $this->complete_count . ')</span>'; |
|
233 | - $cancelled_count = ' <span class="count">(' . $this->cancelled_count . ')</span>'; |
|
234 | - $pending_count = ' <span class="count">(' . $this->pending_count . ')</span>'; |
|
235 | - $processing_count = ' <span class="count">(' . $this->processing_count . ')</span>'; |
|
236 | - $refunded_count = ' <span class="count">(' . $this->refunded_count . ')</span>'; |
|
237 | - $failed_count = ' <span class="count">(' . $this->failed_count . ')</span>'; |
|
238 | - $abandoned_count = ' <span class="count">(' . $this->abandoned_count . ')</span>'; |
|
239 | - $revoked_count = ' <span class="count">(' . $this->revoked_count . ')</span>'; |
|
230 | + $current = isset($_GET['status']) ? $_GET['status'] : ''; |
|
231 | + $total_count = ' <span class="count">('.$this->total_count.')</span>'; |
|
232 | + $complete_count = ' <span class="count">('.$this->complete_count.')</span>'; |
|
233 | + $cancelled_count = ' <span class="count">('.$this->cancelled_count.')</span>'; |
|
234 | + $pending_count = ' <span class="count">('.$this->pending_count.')</span>'; |
|
235 | + $processing_count = ' <span class="count">('.$this->processing_count.')</span>'; |
|
236 | + $refunded_count = ' <span class="count">('.$this->refunded_count.')</span>'; |
|
237 | + $failed_count = ' <span class="count">('.$this->failed_count.')</span>'; |
|
238 | + $abandoned_count = ' <span class="count">('.$this->abandoned_count.')</span>'; |
|
239 | + $revoked_count = ' <span class="count">('.$this->revoked_count.')</span>'; |
|
240 | 240 | |
241 | 241 | $views = array( |
242 | - 'all' => sprintf( '<a href="%s"%s>%s</a>', remove_query_arg( array( |
|
242 | + 'all' => sprintf('<a href="%s"%s>%s</a>', remove_query_arg(array( |
|
243 | 243 | 'status', |
244 | 244 | 'paged', |
245 | - ) ), $current === 'all' || $current == '' ? ' class="current"' : '', esc_html__( 'All', 'give' ) . $total_count ), |
|
246 | - 'publish' => sprintf( '<a href="%s"%s>%s</a>', esc_url( add_query_arg( array( |
|
245 | + )), $current === 'all' || $current == '' ? ' class="current"' : '', esc_html__('All', 'give').$total_count), |
|
246 | + 'publish' => sprintf('<a href="%s"%s>%s</a>', esc_url(add_query_arg(array( |
|
247 | 247 | 'status' => 'publish', |
248 | 248 | 'paged' => false, |
249 | - ) ) ), $current === 'publish' ? ' class="current"' : '', esc_html__( 'Completed', 'give' ) . $complete_count ), |
|
250 | - 'pending' => sprintf( '<a href="%s"%s>%s</a>', esc_url( add_query_arg( array( |
|
249 | + ))), $current === 'publish' ? ' class="current"' : '', esc_html__('Completed', 'give').$complete_count), |
|
250 | + 'pending' => sprintf('<a href="%s"%s>%s</a>', esc_url(add_query_arg(array( |
|
251 | 251 | 'status' => 'pending', |
252 | 252 | 'paged' => false, |
253 | - ) ) ), $current === 'pending' ? ' class="current"' : '', esc_html__( 'Pending', 'give' ) . $pending_count ), |
|
254 | - 'processing' => sprintf( '<a href="%s"%s>%s</a>', esc_url( add_query_arg( array( |
|
253 | + ))), $current === 'pending' ? ' class="current"' : '', esc_html__('Pending', 'give').$pending_count), |
|
254 | + 'processing' => sprintf('<a href="%s"%s>%s</a>', esc_url(add_query_arg(array( |
|
255 | 255 | 'status' => 'processing', |
256 | 256 | 'paged' => false, |
257 | - ) ) ), $current === 'processing' ? ' class="current"' : '', esc_html__( 'Processing', 'give' ) . $processing_count ), |
|
258 | - 'refunded' => sprintf( '<a href="%s"%s>%s</a>', esc_url( add_query_arg( array( |
|
257 | + ))), $current === 'processing' ? ' class="current"' : '', esc_html__('Processing', 'give').$processing_count), |
|
258 | + 'refunded' => sprintf('<a href="%s"%s>%s</a>', esc_url(add_query_arg(array( |
|
259 | 259 | 'status' => 'refunded', |
260 | 260 | 'paged' => false, |
261 | - ) ) ), $current === 'refunded' ? ' class="current"' : '', esc_html__( 'Refunded', 'give' ) . $refunded_count ), |
|
262 | - 'revoked' => sprintf( '<a href="%s"%s>%s</a>', esc_url( add_query_arg( array( |
|
261 | + ))), $current === 'refunded' ? ' class="current"' : '', esc_html__('Refunded', 'give').$refunded_count), |
|
262 | + 'revoked' => sprintf('<a href="%s"%s>%s</a>', esc_url(add_query_arg(array( |
|
263 | 263 | 'status' => 'revoked', |
264 | 264 | 'paged' => false, |
265 | - ) ) ), $current === 'revoked' ? ' class="current"' : '', esc_html__( 'Revoked', 'give' ) . $revoked_count ), |
|
266 | - 'failed' => sprintf( '<a href="%s"%s>%s</a>', esc_url( add_query_arg( array( |
|
265 | + ))), $current === 'revoked' ? ' class="current"' : '', esc_html__('Revoked', 'give').$revoked_count), |
|
266 | + 'failed' => sprintf('<a href="%s"%s>%s</a>', esc_url(add_query_arg(array( |
|
267 | 267 | 'status' => 'failed', |
268 | 268 | 'paged' => false, |
269 | - ) ) ), $current === 'failed' ? ' class="current"' : '', esc_html__( 'Failed', 'give' ) . $failed_count ), |
|
270 | - 'cancelled' => sprintf( '<a href="%s"%s>%s</a>', esc_url( add_query_arg( array( |
|
269 | + ))), $current === 'failed' ? ' class="current"' : '', esc_html__('Failed', 'give').$failed_count), |
|
270 | + 'cancelled' => sprintf('<a href="%s"%s>%s</a>', esc_url(add_query_arg(array( |
|
271 | 271 | 'status' => 'cancelled', |
272 | 272 | 'paged' => false, |
273 | - ) ) ), $current === 'cancelled' ? ' class="current"' : '', esc_html__( 'Cancelled', 'give' ) . $cancelled_count ), |
|
274 | - 'abandoned' => sprintf( '<a href="%s"%s>%s</a>', esc_url( add_query_arg( array( |
|
273 | + ))), $current === 'cancelled' ? ' class="current"' : '', esc_html__('Cancelled', 'give').$cancelled_count), |
|
274 | + 'abandoned' => sprintf('<a href="%s"%s>%s</a>', esc_url(add_query_arg(array( |
|
275 | 275 | 'status' => 'abandoned', |
276 | 276 | 'paged' => false, |
277 | - ) ) ), $current === 'abandoned' ? ' class="current"' : '', esc_html__( 'Abandoned', 'give' ) . $abandoned_count ), |
|
277 | + ))), $current === 'abandoned' ? ' class="current"' : '', esc_html__('Abandoned', 'give').$abandoned_count), |
|
278 | 278 | ); |
279 | 279 | |
280 | - return apply_filters( 'give_payments_table_views', $views ); |
|
280 | + return apply_filters('give_payments_table_views', $views); |
|
281 | 281 | } |
282 | 282 | |
283 | 283 | /** |
@@ -290,15 +290,15 @@ discard block |
||
290 | 290 | public function get_columns() { |
291 | 291 | $columns = array( |
292 | 292 | 'cb' => '<input type="checkbox" />', // Render a checkbox instead of text. |
293 | - 'donation' => esc_html__( 'Donation', 'give' ), |
|
294 | - 'donation_form' => esc_html__( 'Donation Form', 'give' ), |
|
295 | - 'status' => esc_html__( 'Status', 'give' ), |
|
296 | - 'date' => esc_html__( 'Date', 'give' ), |
|
297 | - 'amount' => esc_html__( 'Amount', 'give' ), |
|
298 | - 'details' => esc_html__( 'Details', 'give' ), |
|
293 | + 'donation' => esc_html__('Donation', 'give'), |
|
294 | + 'donation_form' => esc_html__('Donation Form', 'give'), |
|
295 | + 'status' => esc_html__('Status', 'give'), |
|
296 | + 'date' => esc_html__('Date', 'give'), |
|
297 | + 'amount' => esc_html__('Amount', 'give'), |
|
298 | + 'details' => esc_html__('Details', 'give'), |
|
299 | 299 | ); |
300 | 300 | |
301 | - return apply_filters( 'give_payments_table_columns', $columns ); |
|
301 | + return apply_filters('give_payments_table_columns', $columns); |
|
302 | 302 | } |
303 | 303 | |
304 | 304 | /** |
@@ -310,14 +310,14 @@ discard block |
||
310 | 310 | */ |
311 | 311 | public function get_sortable_columns() { |
312 | 312 | $columns = array( |
313 | - 'donation' => array( 'ID', true ), |
|
314 | - 'donation_form' => array( 'donation_form', false ), |
|
315 | - 'status' => array( 'status', false ), |
|
316 | - 'amount' => array( 'amount', false ), |
|
317 | - 'date' => array( 'date', false ), |
|
313 | + 'donation' => array('ID', true), |
|
314 | + 'donation_form' => array('donation_form', false), |
|
315 | + 'status' => array('status', false), |
|
316 | + 'amount' => array('amount', false), |
|
317 | + 'date' => array('date', false), |
|
318 | 318 | ); |
319 | 319 | |
320 | - return apply_filters( 'give_payments_table_sortable_columns', $columns ); |
|
320 | + return apply_filters('give_payments_table_sortable_columns', $columns); |
|
321 | 321 | } |
322 | 322 | |
323 | 323 | /** |
@@ -343,55 +343,55 @@ discard block |
||
343 | 343 | * |
344 | 344 | * @return string Column Name |
345 | 345 | */ |
346 | - public function column_default( $payment, $column_name ) { |
|
346 | + public function column_default($payment, $column_name) { |
|
347 | 347 | |
348 | - $single_donation_url = esc_url( add_query_arg( 'id', $payment->ID, admin_url( 'edit.php?post_type=give_forms&page=give-payment-history&view=view-payment-details' ) ) ); |
|
349 | - $row_actions = $this->get_row_actions( $payment ); |
|
348 | + $single_donation_url = esc_url(add_query_arg('id', $payment->ID, admin_url('edit.php?post_type=give_forms&page=give-payment-history&view=view-payment-details'))); |
|
349 | + $row_actions = $this->get_row_actions($payment); |
|
350 | 350 | |
351 | - switch ( $column_name ) { |
|
351 | + switch ($column_name) { |
|
352 | 352 | case 'donation' : |
353 | - $value = sprintf( '<a href="%1$s" data-tooltip="%2$s">#%3$s</a> %4$s %5$s<br>', $single_donation_url, sprintf( esc_attr__( 'View Donation #%s', 'give' ), $payment->ID ), $payment->ID, esc_html__( 'by', 'give' ), $this->get_donor( $payment ) ); |
|
354 | - $value .= $this->get_donor_email( $payment ); |
|
355 | - $value .= $this->row_actions( $row_actions ); |
|
353 | + $value = sprintf('<a href="%1$s" data-tooltip="%2$s">#%3$s</a> %4$s %5$s<br>', $single_donation_url, sprintf(esc_attr__('View Donation #%s', 'give'), $payment->ID), $payment->ID, esc_html__('by', 'give'), $this->get_donor($payment)); |
|
354 | + $value .= $this->get_donor_email($payment); |
|
355 | + $value .= $this->row_actions($row_actions); |
|
356 | 356 | break; |
357 | 357 | |
358 | 358 | case 'amount' : |
359 | - $amount = ! empty( $payment->total ) ? $payment->total : 0; |
|
360 | - $value = give_currency_filter( give_format_amount( $amount ), give_get_payment_currency_code( $payment->ID ) ); |
|
361 | - $value .= sprintf( '<br><small>%1$s %2$s</small>', __( 'via', 'give' ), give_get_gateway_admin_label( $payment->gateway ) ); |
|
359 | + $amount = ! empty($payment->total) ? $payment->total : 0; |
|
360 | + $value = give_currency_filter(give_format_amount($amount), give_get_payment_currency_code($payment->ID)); |
|
361 | + $value .= sprintf('<br><small>%1$s %2$s</small>', __('via', 'give'), give_get_gateway_admin_label($payment->gateway)); |
|
362 | 362 | break; |
363 | 363 | |
364 | 364 | case 'donation_form' : |
365 | - $form_title = empty( $payment->form_title ) ? sprintf( __( 'Untitled (#%s)', 'give' ), $payment->form_id ) : $payment->form_title; |
|
366 | - $value = '<a href="' . admin_url( 'post.php?post=' . $payment->form_id . '&action=edit' ) . '">' . $form_title . '</a>'; |
|
367 | - $level = give_get_payment_form_title( $payment->meta, true ); |
|
365 | + $form_title = empty($payment->form_title) ? sprintf(__('Untitled (#%s)', 'give'), $payment->form_id) : $payment->form_title; |
|
366 | + $value = '<a href="'.admin_url('post.php?post='.$payment->form_id.'&action=edit').'">'.$form_title.'</a>'; |
|
367 | + $level = give_get_payment_form_title($payment->meta, true); |
|
368 | 368 | |
369 | - if ( ! empty( $level ) ) { |
|
369 | + if ( ! empty($level)) { |
|
370 | 370 | $value .= $level; |
371 | 371 | } |
372 | 372 | |
373 | 373 | break; |
374 | 374 | |
375 | 375 | case 'date' : |
376 | - $date = strtotime( $payment->date ); |
|
377 | - $value = date_i18n( give_date_format(), $date ); |
|
376 | + $date = strtotime($payment->date); |
|
377 | + $value = date_i18n(give_date_format(), $date); |
|
378 | 378 | break; |
379 | 379 | |
380 | 380 | case 'status' : |
381 | - $value = $this->get_payment_status( $payment ); |
|
381 | + $value = $this->get_payment_status($payment); |
|
382 | 382 | break; |
383 | 383 | |
384 | 384 | case 'details' : |
385 | - $value = sprintf( '<div class="give-payment-details-link-wrap"><a href="%1$s" class="give-payment-details-link button button-small" data-tooltip="%2$s" aria-label="%2$s"><span class="dashicons dashicons-visibility"></span></a></div>', $single_donation_url, sprintf( esc_attr__( 'View Donation #%s', 'give' ), $payment->ID ) ); |
|
385 | + $value = sprintf('<div class="give-payment-details-link-wrap"><a href="%1$s" class="give-payment-details-link button button-small" data-tooltip="%2$s" aria-label="%2$s"><span class="dashicons dashicons-visibility"></span></a></div>', $single_donation_url, sprintf(esc_attr__('View Donation #%s', 'give'), $payment->ID)); |
|
386 | 386 | break; |
387 | 387 | |
388 | 388 | default: |
389 | - $value = isset( $payment->$column_name ) ? $payment->$column_name : ''; |
|
389 | + $value = isset($payment->$column_name) ? $payment->$column_name : ''; |
|
390 | 390 | break; |
391 | 391 | |
392 | 392 | }// End switch(). |
393 | 393 | |
394 | - return apply_filters( 'give_payments_table_column', $value, $payment->ID, $column_name ); |
|
394 | + return apply_filters('give_payments_table_column', $value, $payment->ID, $column_name); |
|
395 | 395 | } |
396 | 396 | |
397 | 397 | /** |
@@ -404,17 +404,17 @@ discard block |
||
404 | 404 | * |
405 | 405 | * @return string Data shown in the Email column |
406 | 406 | */ |
407 | - public function get_donor_email( $payment ) { |
|
407 | + public function get_donor_email($payment) { |
|
408 | 408 | |
409 | - $email = give_get_payment_user_email( $payment->ID ); |
|
409 | + $email = give_get_payment_user_email($payment->ID); |
|
410 | 410 | |
411 | - if ( empty( $email ) ) { |
|
412 | - $email = esc_html__( '(unknown)', 'give' ); |
|
411 | + if (empty($email)) { |
|
412 | + $email = esc_html__('(unknown)', 'give'); |
|
413 | 413 | } |
414 | 414 | |
415 | - $value = '<a href="mailto:' . $email . '" data-tooltip="' . esc_attr__( 'Email donor', 'give' ) . '">' . $email . '</a>'; |
|
415 | + $value = '<a href="mailto:'.$email.'" data-tooltip="'.esc_attr__('Email donor', 'give').'">'.$email.'</a>'; |
|
416 | 416 | |
417 | - return apply_filters( 'give_payments_table_column', $value, $payment->ID, 'email' ); |
|
417 | + return apply_filters('give_payments_table_column', $value, $payment->ID, 'email'); |
|
418 | 418 | } |
419 | 419 | |
420 | 420 | /** |
@@ -426,32 +426,32 @@ discard block |
||
426 | 426 | * |
427 | 427 | * @return array $actions |
428 | 428 | */ |
429 | - function get_row_actions( $payment ) { |
|
429 | + function get_row_actions($payment) { |
|
430 | 430 | |
431 | 431 | $actions = array(); |
432 | - $email = give_get_payment_user_email( $payment->ID ); |
|
432 | + $email = give_get_payment_user_email($payment->ID); |
|
433 | 433 | |
434 | 434 | // Add search term string back to base URL. |
435 | - $search_terms = ( isset( $_GET['s'] ) ? trim( $_GET['s'] ) : '' ); |
|
436 | - if ( ! empty( $search_terms ) ) { |
|
437 | - $this->base_url = add_query_arg( 's', $search_terms, $this->base_url ); |
|
435 | + $search_terms = (isset($_GET['s']) ? trim($_GET['s']) : ''); |
|
436 | + if ( ! empty($search_terms)) { |
|
437 | + $this->base_url = add_query_arg('s', $search_terms, $this->base_url); |
|
438 | 438 | } |
439 | 439 | |
440 | - if ( give_is_payment_complete( $payment->ID ) && ! empty( $email ) ) { |
|
440 | + if (give_is_payment_complete($payment->ID) && ! empty($email)) { |
|
441 | 441 | |
442 | - $actions['email_links'] = sprintf( '<a class="resend-single-donation-receipt" href="%1$s" aria-label="%2$s">%3$s</a>', wp_nonce_url( add_query_arg( array( |
|
442 | + $actions['email_links'] = sprintf('<a class="resend-single-donation-receipt" href="%1$s" aria-label="%2$s">%3$s</a>', wp_nonce_url(add_query_arg(array( |
|
443 | 443 | 'give-action' => 'email_links', |
444 | 444 | 'purchase_id' => $payment->ID, |
445 | - ), $this->base_url ), 'give_payment_nonce' ), sprintf( esc_attr__( 'Resend Donation %s Receipt', 'give' ), $payment->ID ), esc_html__( 'Resend Receipt', 'give' ) ); |
|
445 | + ), $this->base_url), 'give_payment_nonce'), sprintf(esc_attr__('Resend Donation %s Receipt', 'give'), $payment->ID), esc_html__('Resend Receipt', 'give')); |
|
446 | 446 | |
447 | 447 | } |
448 | 448 | |
449 | - $actions['delete'] = sprintf( '<a class="delete-single-donation" href="%1$s" aria-label="%2$s">%3$s</a>', wp_nonce_url( add_query_arg( array( |
|
449 | + $actions['delete'] = sprintf('<a class="delete-single-donation" href="%1$s" aria-label="%2$s">%3$s</a>', wp_nonce_url(add_query_arg(array( |
|
450 | 450 | 'give-action' => 'delete_payment', |
451 | 451 | 'purchase_id' => $payment->ID, |
452 | - ), $this->base_url ), 'give_donation_nonce' ), sprintf( esc_attr__( 'Delete Donation %s', 'give' ), $payment->ID ), esc_html__( 'Delete', 'give' ) ); |
|
452 | + ), $this->base_url), 'give_donation_nonce'), sprintf(esc_attr__('Delete Donation %s', 'give'), $payment->ID), esc_html__('Delete', 'give')); |
|
453 | 453 | |
454 | - return apply_filters( 'give_payment_row_actions', $actions, $payment ); |
|
454 | + return apply_filters('give_payment_row_actions', $actions, $payment); |
|
455 | 455 | } |
456 | 456 | |
457 | 457 | |
@@ -465,10 +465,10 @@ discard block |
||
465 | 465 | * |
466 | 466 | * @return string Data shown in the Email column |
467 | 467 | */ |
468 | - function get_payment_status( $payment ) { |
|
469 | - $value = '<div class="give-donation-status status-' . sanitize_title( give_get_payment_status( $payment, true ) ) . '"><span class="give-donation-status-icon"></span> ' . give_get_payment_status( $payment, true ) . '</div>'; |
|
470 | - if ( $payment->mode == 'test' ) { |
|
471 | - $value .= ' <span class="give-item-label give-item-label-orange give-test-mode-transactions-label" data-tooltip="' . esc_attr__( 'This donation was made in test mode.', 'give' ) . '">' . esc_html__( 'Test', 'give' ) . '</span>'; |
|
468 | + function get_payment_status($payment) { |
|
469 | + $value = '<div class="give-donation-status status-'.sanitize_title(give_get_payment_status($payment, true)).'"><span class="give-donation-status-icon"></span> '.give_get_payment_status($payment, true).'</div>'; |
|
470 | + if ($payment->mode == 'test') { |
|
471 | + $value .= ' <span class="give-item-label give-item-label-orange give-test-mode-transactions-label" data-tooltip="'.esc_attr__('This donation was made in test mode.', 'give').'">'.esc_html__('Test', 'give').'</span>'; |
|
472 | 472 | } |
473 | 473 | |
474 | 474 | return $value; |
@@ -484,8 +484,8 @@ discard block |
||
484 | 484 | * |
485 | 485 | * @return string Displays a checkbox. |
486 | 486 | */ |
487 | - public function column_cb( $payment ) { |
|
488 | - return sprintf( '<input type="checkbox" name="%1$s[]" value="%2$s" />', 'payment', $payment->ID ); |
|
487 | + public function column_cb($payment) { |
|
488 | + return sprintf('<input type="checkbox" name="%1$s[]" value="%2$s" />', 'payment', $payment->ID); |
|
489 | 489 | } |
490 | 490 | |
491 | 491 | /** |
@@ -498,8 +498,8 @@ discard block |
||
498 | 498 | * |
499 | 499 | * @return string Displays a checkbox. |
500 | 500 | */ |
501 | - public function get_payment_id( $payment ) { |
|
502 | - return '<span class="give-payment-id">' . give_get_payment_number( $payment->ID ) . '</span>'; |
|
501 | + public function get_payment_id($payment) { |
|
502 | + return '<span class="give-payment-id">'.give_get_payment_number($payment->ID).'</span>'; |
|
503 | 503 | } |
504 | 504 | |
505 | 505 | /** |
@@ -512,32 +512,32 @@ discard block |
||
512 | 512 | * |
513 | 513 | * @return string Data shown in the User column |
514 | 514 | */ |
515 | - public function get_donor( $payment ) { |
|
515 | + public function get_donor($payment) { |
|
516 | 516 | |
517 | - $donor_id = give_get_payment_donor_id( $payment->ID ); |
|
518 | - $donor_billing_name = give_get_donor_name_by( $payment->ID, 'donation' ); |
|
519 | - $donor_name = give_get_donor_name_by( $donor_id, 'donor' ); |
|
517 | + $donor_id = give_get_payment_donor_id($payment->ID); |
|
518 | + $donor_billing_name = give_get_donor_name_by($payment->ID, 'donation'); |
|
519 | + $donor_name = give_get_donor_name_by($donor_id, 'donor'); |
|
520 | 520 | |
521 | 521 | $value = ''; |
522 | - if ( ! empty( $donor_id ) ) { |
|
522 | + if ( ! empty($donor_id)) { |
|
523 | 523 | |
524 | 524 | // Check whether the donor name and WP_User name is same or not. |
525 | - if ( sanitize_title( $donor_billing_name ) != sanitize_title( $donor_name ) ) { |
|
526 | - $value .= $donor_billing_name . ' ('; |
|
525 | + if (sanitize_title($donor_billing_name) != sanitize_title($donor_name)) { |
|
526 | + $value .= $donor_billing_name.' ('; |
|
527 | 527 | } |
528 | 528 | |
529 | - $value .= '<a href="' . esc_url( admin_url( "edit.php?post_type=give_forms&page=give-donors&view=overview&id=$donor_id" ) ) . '">' . $donor_name . '</a>'; |
|
529 | + $value .= '<a href="'.esc_url(admin_url("edit.php?post_type=give_forms&page=give-donors&view=overview&id=$donor_id")).'">'.$donor_name.'</a>'; |
|
530 | 530 | |
531 | 531 | // Check whether the donor name and WP_User name is same or not. |
532 | - if ( sanitize_title( $donor_billing_name ) != sanitize_title( $donor_name ) ) { |
|
532 | + if (sanitize_title($donor_billing_name) != sanitize_title($donor_name)) { |
|
533 | 533 | $value .= ')'; |
534 | 534 | } |
535 | 535 | } else { |
536 | - $email = give_get_payment_user_email( $payment->ID ); |
|
537 | - $value .= '<a href="' . esc_url( admin_url( "edit.php?post_type=give_forms&page=give-payment-history&s=$email" ) ) . '">' . esc_html__( '(donor missing)', 'give' ) . '</a>'; |
|
536 | + $email = give_get_payment_user_email($payment->ID); |
|
537 | + $value .= '<a href="'.esc_url(admin_url("edit.php?post_type=give_forms&page=give-payment-history&s=$email")).'">'.esc_html__('(donor missing)', 'give').'</a>'; |
|
538 | 538 | } |
539 | 539 | |
540 | - return apply_filters( 'give_payments_table_column', $value, $payment->ID, 'donor' ); |
|
540 | + return apply_filters('give_payments_table_column', $value, $payment->ID, 'donor'); |
|
541 | 541 | } |
542 | 542 | |
543 | 543 | /** |
@@ -549,20 +549,20 @@ discard block |
||
549 | 549 | */ |
550 | 550 | public function get_bulk_actions() { |
551 | 551 | $actions = array( |
552 | - 'delete' => __( 'Delete', 'give' ), |
|
553 | - 'set-status-publish' => __( 'Set To Completed', 'give' ), |
|
554 | - 'set-status-pending' => __( 'Set To Pending', 'give' ), |
|
555 | - 'set-status-processing' => __( 'Set To Processing', 'give' ), |
|
556 | - 'set-status-refunded' => __( 'Set To Refunded', 'give' ), |
|
557 | - 'set-status-revoked' => __( 'Set To Revoked', 'give' ), |
|
558 | - 'set-status-failed' => __( 'Set To Failed', 'give' ), |
|
559 | - 'set-status-cancelled' => __( 'Set To Cancelled', 'give' ), |
|
560 | - 'set-status-abandoned' => __( 'Set To Abandoned', 'give' ), |
|
561 | - 'set-status-preapproval' => __( 'Set To Preapproval', 'give' ), |
|
562 | - 'resend-receipt' => __( 'Resend Email Receipts', 'give' ), |
|
552 | + 'delete' => __('Delete', 'give'), |
|
553 | + 'set-status-publish' => __('Set To Completed', 'give'), |
|
554 | + 'set-status-pending' => __('Set To Pending', 'give'), |
|
555 | + 'set-status-processing' => __('Set To Processing', 'give'), |
|
556 | + 'set-status-refunded' => __('Set To Refunded', 'give'), |
|
557 | + 'set-status-revoked' => __('Set To Revoked', 'give'), |
|
558 | + 'set-status-failed' => __('Set To Failed', 'give'), |
|
559 | + 'set-status-cancelled' => __('Set To Cancelled', 'give'), |
|
560 | + 'set-status-abandoned' => __('Set To Abandoned', 'give'), |
|
561 | + 'set-status-preapproval' => __('Set To Preapproval', 'give'), |
|
562 | + 'resend-receipt' => __('Resend Email Receipts', 'give'), |
|
563 | 563 | ); |
564 | 564 | |
565 | - return apply_filters( 'give_payments_table_bulk_actions', $actions ); |
|
565 | + return apply_filters('give_payments_table_bulk_actions', $actions); |
|
566 | 566 | } |
567 | 567 | |
568 | 568 | /** |
@@ -573,63 +573,63 @@ discard block |
||
573 | 573 | * @return void |
574 | 574 | */ |
575 | 575 | public function process_bulk_action() { |
576 | - $ids = isset( $_GET['payment'] ) ? $_GET['payment'] : false; |
|
576 | + $ids = isset($_GET['payment']) ? $_GET['payment'] : false; |
|
577 | 577 | $action = $this->current_action(); |
578 | 578 | |
579 | - if ( ! is_array( $ids ) ) { |
|
580 | - $ids = array( $ids ); |
|
579 | + if ( ! is_array($ids)) { |
|
580 | + $ids = array($ids); |
|
581 | 581 | } |
582 | 582 | |
583 | - if ( empty( $action ) ) { |
|
583 | + if (empty($action)) { |
|
584 | 584 | return; |
585 | 585 | } |
586 | 586 | |
587 | - foreach ( $ids as $id ) { |
|
587 | + foreach ($ids as $id) { |
|
588 | 588 | |
589 | 589 | // Detect when a bulk action is being triggered. |
590 | - switch ( $this->current_action() ) { |
|
590 | + switch ($this->current_action()) { |
|
591 | 591 | |
592 | 592 | case'delete': |
593 | - give_delete_donation( $id ); |
|
593 | + give_delete_donation($id); |
|
594 | 594 | break; |
595 | 595 | |
596 | 596 | case 'set-status-publish': |
597 | - give_update_payment_status( $id, 'publish' ); |
|
597 | + give_update_payment_status($id, 'publish'); |
|
598 | 598 | break; |
599 | 599 | |
600 | 600 | case 'set-status-pending': |
601 | - give_update_payment_status( $id, 'pending' ); |
|
601 | + give_update_payment_status($id, 'pending'); |
|
602 | 602 | break; |
603 | 603 | |
604 | 604 | case 'set-status-processing': |
605 | - give_update_payment_status( $id, 'processing' ); |
|
605 | + give_update_payment_status($id, 'processing'); |
|
606 | 606 | break; |
607 | 607 | |
608 | 608 | case 'set-status-refunded': |
609 | - give_update_payment_status( $id, 'refunded' ); |
|
609 | + give_update_payment_status($id, 'refunded'); |
|
610 | 610 | break; |
611 | 611 | case 'set-status-revoked': |
612 | - give_update_payment_status( $id, 'revoked' ); |
|
612 | + give_update_payment_status($id, 'revoked'); |
|
613 | 613 | break; |
614 | 614 | |
615 | 615 | case 'set-status-failed': |
616 | - give_update_payment_status( $id, 'failed' ); |
|
616 | + give_update_payment_status($id, 'failed'); |
|
617 | 617 | break; |
618 | 618 | |
619 | 619 | case 'set-status-cancelled': |
620 | - give_update_payment_status( $id, 'cancelled' ); |
|
620 | + give_update_payment_status($id, 'cancelled'); |
|
621 | 621 | break; |
622 | 622 | |
623 | 623 | case 'set-status-abandoned': |
624 | - give_update_payment_status( $id, 'abandoned' ); |
|
624 | + give_update_payment_status($id, 'abandoned'); |
|
625 | 625 | break; |
626 | 626 | |
627 | 627 | case 'set-status-preapproval': |
628 | - give_update_payment_status( $id, 'preapproval' ); |
|
628 | + give_update_payment_status($id, 'preapproval'); |
|
629 | 629 | break; |
630 | 630 | |
631 | 631 | case 'resend-receipt': |
632 | - give_email_donation_receipt( $id, false ); |
|
632 | + give_email_donation_receipt($id, false); |
|
633 | 633 | break; |
634 | 634 | }// End switch(). |
635 | 635 | |
@@ -641,7 +641,7 @@ discard block |
||
641 | 641 | * @param int $id The ID of the payment. |
642 | 642 | * @param string $current_action The action that is being triggered. |
643 | 643 | */ |
644 | - do_action( 'give_payments_table_do_bulk_action', $id, $this->current_action() ); |
|
644 | + do_action('give_payments_table_do_bulk_action', $id, $this->current_action()); |
|
645 | 645 | }// End foreach(). |
646 | 646 | |
647 | 647 | } |
@@ -657,29 +657,29 @@ discard block |
||
657 | 657 | |
658 | 658 | $args = array(); |
659 | 659 | |
660 | - if ( isset( $_GET['user'] ) ) { |
|
661 | - $args['user'] = urldecode( $_GET['user'] ); |
|
662 | - } elseif ( isset( $_GET['donor'] ) ) { |
|
663 | - $args['donor'] = absint( $_GET['donor'] ); |
|
664 | - } elseif ( isset( $_GET['s'] ) ) { |
|
665 | - $is_user = strpos( $_GET['s'], strtolower( 'user:' ) ) !== false; |
|
666 | - if ( $is_user ) { |
|
667 | - $args['user'] = absint( trim( str_replace( 'user:', '', strtolower( $_GET['s'] ) ) ) ); |
|
668 | - unset( $args['s'] ); |
|
660 | + if (isset($_GET['user'])) { |
|
661 | + $args['user'] = urldecode($_GET['user']); |
|
662 | + } elseif (isset($_GET['donor'])) { |
|
663 | + $args['donor'] = absint($_GET['donor']); |
|
664 | + } elseif (isset($_GET['s'])) { |
|
665 | + $is_user = strpos($_GET['s'], strtolower('user:')) !== false; |
|
666 | + if ($is_user) { |
|
667 | + $args['user'] = absint(trim(str_replace('user:', '', strtolower($_GET['s'])))); |
|
668 | + unset($args['s']); |
|
669 | 669 | } else { |
670 | - $args['s'] = sanitize_text_field( $_GET['s'] ); |
|
670 | + $args['s'] = sanitize_text_field($_GET['s']); |
|
671 | 671 | } |
672 | 672 | } |
673 | 673 | |
674 | - if ( ! empty( $_GET['start-date'] ) ) { |
|
675 | - $args['start-date'] = urldecode( $_GET['start-date'] ); |
|
674 | + if ( ! empty($_GET['start-date'])) { |
|
675 | + $args['start-date'] = urldecode($_GET['start-date']); |
|
676 | 676 | } |
677 | 677 | |
678 | - if ( ! empty( $_GET['end-date'] ) ) { |
|
679 | - $args['end-date'] = urldecode( $_GET['end-date'] ); |
|
678 | + if ( ! empty($_GET['end-date'])) { |
|
679 | + $args['end-date'] = urldecode($_GET['end-date']); |
|
680 | 680 | } |
681 | 681 | |
682 | - $payment_count = give_count_payments( $args ); |
|
682 | + $payment_count = give_count_payments($args); |
|
683 | 683 | $this->complete_count = $payment_count->publish; |
684 | 684 | $this->pending_count = $payment_count->pending; |
685 | 685 | $this->processing_count = $payment_count->processing; |
@@ -689,7 +689,7 @@ discard block |
||
689 | 689 | $this->cancelled_count = $payment_count->cancelled; |
690 | 690 | $this->abandoned_count = $payment_count->abandoned; |
691 | 691 | |
692 | - foreach ( $payment_count as $count ) { |
|
692 | + foreach ($payment_count as $count) { |
|
693 | 693 | $this->total_count += $count; |
694 | 694 | } |
695 | 695 | } |
@@ -704,27 +704,27 @@ discard block |
||
704 | 704 | public function payments_data() { |
705 | 705 | |
706 | 706 | $per_page = $this->per_page; |
707 | - $orderby = isset( $_GET['orderby'] ) ? urldecode( $_GET['orderby'] ) : 'ID'; |
|
708 | - $order = isset( $_GET['order'] ) ? $_GET['order'] : 'DESC'; |
|
709 | - $user = isset( $_GET['user'] ) ? $_GET['user'] : null; |
|
710 | - $donor = isset( $_GET['donor'] ) ? $_GET['donor'] : null; |
|
711 | - $status = isset( $_GET['status'] ) ? $_GET['status'] : give_get_payment_status_keys(); |
|
712 | - $meta_key = isset( $_GET['meta_key'] ) ? $_GET['meta_key'] : null; |
|
713 | - $year = isset( $_GET['year'] ) ? $_GET['year'] : null; |
|
714 | - $month = isset( $_GET['m'] ) ? $_GET['m'] : null; |
|
715 | - $day = isset( $_GET['day'] ) ? $_GET['day'] : null; |
|
716 | - $search = isset( $_GET['s'] ) ? sanitize_text_field( $_GET['s'] ) : null; |
|
717 | - $start_date = isset( $_GET['start-date'] ) ? sanitize_text_field( $_GET['start-date'] ) : null; |
|
718 | - $end_date = isset( $_GET['end-date'] ) ? sanitize_text_field( $_GET['end-date'] ) : $start_date; |
|
719 | - |
|
720 | - if ( ! empty( $search ) ) { |
|
707 | + $orderby = isset($_GET['orderby']) ? urldecode($_GET['orderby']) : 'ID'; |
|
708 | + $order = isset($_GET['order']) ? $_GET['order'] : 'DESC'; |
|
709 | + $user = isset($_GET['user']) ? $_GET['user'] : null; |
|
710 | + $donor = isset($_GET['donor']) ? $_GET['donor'] : null; |
|
711 | + $status = isset($_GET['status']) ? $_GET['status'] : give_get_payment_status_keys(); |
|
712 | + $meta_key = isset($_GET['meta_key']) ? $_GET['meta_key'] : null; |
|
713 | + $year = isset($_GET['year']) ? $_GET['year'] : null; |
|
714 | + $month = isset($_GET['m']) ? $_GET['m'] : null; |
|
715 | + $day = isset($_GET['day']) ? $_GET['day'] : null; |
|
716 | + $search = isset($_GET['s']) ? sanitize_text_field($_GET['s']) : null; |
|
717 | + $start_date = isset($_GET['start-date']) ? sanitize_text_field($_GET['start-date']) : null; |
|
718 | + $end_date = isset($_GET['end-date']) ? sanitize_text_field($_GET['end-date']) : $start_date; |
|
719 | + |
|
720 | + if ( ! empty($search)) { |
|
721 | 721 | $status = 'any'; // Force all payment statuses when searching. |
722 | 722 | } |
723 | 723 | |
724 | 724 | $args = array( |
725 | 725 | 'output' => 'payments', |
726 | 726 | 'number' => $per_page, |
727 | - 'page' => isset( $_GET['paged'] ) ? $_GET['paged'] : null, |
|
727 | + 'page' => isset($_GET['paged']) ? $_GET['paged'] : null, |
|
728 | 728 | 'orderby' => $orderby, |
729 | 729 | 'order' => $order, |
730 | 730 | 'user' => $user, |
@@ -739,12 +739,12 @@ discard block |
||
739 | 739 | 'end_date' => $end_date, |
740 | 740 | ); |
741 | 741 | |
742 | - if ( is_string( $search ) && false !== strpos( $search, 'txn:' ) ) { |
|
742 | + if (is_string($search) && false !== strpos($search, 'txn:')) { |
|
743 | 743 | $args['search_in_notes'] = true; |
744 | - $args['s'] = trim( str_replace( 'txn:', '', $args['s'] ) ); |
|
744 | + $args['s'] = trim(str_replace('txn:', '', $args['s'])); |
|
745 | 745 | } |
746 | 746 | |
747 | - $p_query = new Give_Payments_Query( $args ); |
|
747 | + $p_query = new Give_Payments_Query($args); |
|
748 | 748 | |
749 | 749 | return $p_query->get_payments(); |
750 | 750 | |
@@ -764,17 +764,17 @@ discard block |
||
764 | 764 | */ |
765 | 765 | public function prepare_items() { |
766 | 766 | |
767 | - wp_reset_vars( array( 'action', 'payment', 'orderby', 'order', 's' ) ); |
|
767 | + wp_reset_vars(array('action', 'payment', 'orderby', 'order', 's')); |
|
768 | 768 | |
769 | 769 | $columns = $this->get_columns(); |
770 | 770 | $hidden = array(); // No hidden columns. |
771 | 771 | $sortable = $this->get_sortable_columns(); |
772 | 772 | $data = $this->payments_data(); |
773 | - $status = isset( $_GET['status'] ) ? $_GET['status'] : 'any'; |
|
773 | + $status = isset($_GET['status']) ? $_GET['status'] : 'any'; |
|
774 | 774 | |
775 | - $this->_column_headers = array( $columns, $hidden, $sortable ); |
|
775 | + $this->_column_headers = array($columns, $hidden, $sortable); |
|
776 | 776 | |
777 | - switch ( $status ) { |
|
777 | + switch ($status) { |
|
778 | 778 | case 'publish': |
779 | 779 | $total_items = $this->complete_count; |
780 | 780 | break; |
@@ -804,20 +804,20 @@ discard block |
||
804 | 804 | break; |
805 | 805 | default: |
806 | 806 | // Retrieve the count of the non-default-Give status. |
807 | - $count = wp_count_posts( 'give_payment' ); |
|
808 | - $total_items = isset( $count->{$status} ) ? $count->{$status} : 0; |
|
807 | + $count = wp_count_posts('give_payment'); |
|
808 | + $total_items = isset($count->{$status} ) ? $count->{$status} : 0; |
|
809 | 809 | break; |
810 | 810 | } |
811 | 811 | |
812 | 812 | $this->items = $data; |
813 | 813 | |
814 | - $this->set_pagination_args( array( |
|
814 | + $this->set_pagination_args(array( |
|
815 | 815 | 'total_items' => $total_items, |
816 | 816 | // We have to calculate the total number of items. |
817 | 817 | 'per_page' => $this->per_page, |
818 | 818 | // We have to determine how many items to show on a page. |
819 | - 'total_pages' => ceil( $total_items / $this->per_page ), |
|
819 | + 'total_pages' => ceil($total_items / $this->per_page), |
|
820 | 820 | // We have to calculate the total number of pages. |
821 | - ) ); |
|
821 | + )); |
|
822 | 822 | } |
823 | 823 | } |
@@ -10,7 +10,7 @@ discard block |
||
10 | 10 | */ |
11 | 11 | |
12 | 12 | // Exit if accessed directly. |
13 | -if ( ! defined( 'ABSPATH' ) ) { |
|
13 | +if ( ! defined('ABSPATH')) { |
|
14 | 14 | exit; |
15 | 15 | } |
16 | 16 | |
@@ -27,34 +27,34 @@ discard block |
||
27 | 27 | * @return array $form_columns Updated array of forms columns |
28 | 28 | * Post Type List Table |
29 | 29 | */ |
30 | -function give_form_columns( $give_form_columns ) { |
|
30 | +function give_form_columns($give_form_columns) { |
|
31 | 31 | |
32 | 32 | // Standard columns |
33 | 33 | $give_form_columns = array( |
34 | 34 | 'cb' => '<input type="checkbox"/>', |
35 | - 'title' => __( 'Name', 'give' ), |
|
36 | - 'form_category' => __( 'Categories', 'give' ), |
|
37 | - 'form_tag' => __( 'Tags', 'give' ), |
|
38 | - 'price' => __( 'Amount', 'give' ), |
|
39 | - 'goal' => __( 'Goal', 'give' ), |
|
40 | - 'donations' => __( 'Donations', 'give' ), |
|
41 | - 'earnings' => __( 'Income', 'give' ), |
|
42 | - 'shortcode' => __( 'Shortcode', 'give' ), |
|
43 | - 'date' => __( 'Date', 'give' ), |
|
35 | + 'title' => __('Name', 'give'), |
|
36 | + 'form_category' => __('Categories', 'give'), |
|
37 | + 'form_tag' => __('Tags', 'give'), |
|
38 | + 'price' => __('Amount', 'give'), |
|
39 | + 'goal' => __('Goal', 'give'), |
|
40 | + 'donations' => __('Donations', 'give'), |
|
41 | + 'earnings' => __('Income', 'give'), |
|
42 | + 'shortcode' => __('Shortcode', 'give'), |
|
43 | + 'date' => __('Date', 'give'), |
|
44 | 44 | ); |
45 | 45 | |
46 | 46 | // Does the user want categories / tags? |
47 | - if ( ! give_is_setting_enabled( give_get_option( 'categories', 'disabled' ) ) ) { |
|
48 | - unset( $give_form_columns['form_category'] ); |
|
47 | + if ( ! give_is_setting_enabled(give_get_option('categories', 'disabled'))) { |
|
48 | + unset($give_form_columns['form_category']); |
|
49 | 49 | } |
50 | - if ( ! give_is_setting_enabled( give_get_option( 'tags', 'disabled' ) ) ) { |
|
51 | - unset( $give_form_columns['form_tag'] ); |
|
50 | + if ( ! give_is_setting_enabled(give_get_option('tags', 'disabled'))) { |
|
51 | + unset($give_form_columns['form_tag']); |
|
52 | 52 | } |
53 | 53 | |
54 | - return apply_filters( 'give_forms_columns', $give_form_columns ); |
|
54 | + return apply_filters('give_forms_columns', $give_form_columns); |
|
55 | 55 | } |
56 | 56 | |
57 | -add_filter( 'manage_edit-give_forms_columns', 'give_form_columns' ); |
|
57 | +add_filter('manage_edit-give_forms_columns', 'give_form_columns'); |
|
58 | 58 | |
59 | 59 | /** |
60 | 60 | * Render Give Form Columns |
@@ -66,59 +66,59 @@ discard block |
||
66 | 66 | * |
67 | 67 | * @return void |
68 | 68 | */ |
69 | -function give_render_form_columns( $column_name, $post_id ) { |
|
70 | - if ( get_post_type( $post_id ) == 'give_forms' ) { |
|
69 | +function give_render_form_columns($column_name, $post_id) { |
|
70 | + if (get_post_type($post_id) == 'give_forms') { |
|
71 | 71 | |
72 | - switch ( $column_name ) { |
|
72 | + switch ($column_name) { |
|
73 | 73 | case 'form_category': |
74 | - echo get_the_term_list( $post_id, 'give_forms_category', '', ', ', '' ); |
|
74 | + echo get_the_term_list($post_id, 'give_forms_category', '', ', ', ''); |
|
75 | 75 | break; |
76 | 76 | case 'form_tag': |
77 | - echo get_the_term_list( $post_id, 'give_forms_tag', '', ', ', '' ); |
|
77 | + echo get_the_term_list($post_id, 'give_forms_tag', '', ', ', ''); |
|
78 | 78 | break; |
79 | 79 | case 'price': |
80 | - if ( give_has_variable_prices( $post_id ) ) { |
|
81 | - echo give_price_range( $post_id ); |
|
80 | + if (give_has_variable_prices($post_id)) { |
|
81 | + echo give_price_range($post_id); |
|
82 | 82 | } else { |
83 | - echo give_price( $post_id, false ); |
|
84 | - echo '<input type="hidden" class="formprice-' . $post_id . '" value="' . give_get_form_price( $post_id ) . '" />'; |
|
83 | + echo give_price($post_id, false); |
|
84 | + echo '<input type="hidden" class="formprice-'.$post_id.'" value="'.give_get_form_price($post_id).'" />'; |
|
85 | 85 | } |
86 | 86 | break; |
87 | 87 | case 'goal': |
88 | - if ( give_is_setting_enabled( give_get_meta( $post_id, '_give_goal_option', true ) ) ) { |
|
89 | - echo give_goal( $post_id, false ); |
|
88 | + if (give_is_setting_enabled(give_get_meta($post_id, '_give_goal_option', true))) { |
|
89 | + echo give_goal($post_id, false); |
|
90 | 90 | } else { |
91 | - esc_html_e( 'No Goal Set', 'give' ); |
|
91 | + esc_html_e('No Goal Set', 'give'); |
|
92 | 92 | } |
93 | 93 | |
94 | - echo '<input type="hidden" class="formgoal-' . $post_id . '" value="' . give_get_form_goal( $post_id ) . '" />'; |
|
94 | + echo '<input type="hidden" class="formgoal-'.$post_id.'" value="'.give_get_form_goal($post_id).'" />'; |
|
95 | 95 | break; |
96 | 96 | case 'donations': |
97 | - if ( current_user_can( 'view_give_form_stats', $post_id ) ) { |
|
98 | - echo '<a href="' . esc_url( admin_url( 'edit.php?post_type=give_forms&page=give-tools&tab=logs&form=' . $post_id ) ) . '">'; |
|
99 | - echo give_get_form_sales_stats( $post_id ); |
|
97 | + if (current_user_can('view_give_form_stats', $post_id)) { |
|
98 | + echo '<a href="'.esc_url(admin_url('edit.php?post_type=give_forms&page=give-tools&tab=logs&form='.$post_id)).'">'; |
|
99 | + echo give_get_form_sales_stats($post_id); |
|
100 | 100 | echo '</a>'; |
101 | 101 | } else { |
102 | 102 | echo '-'; |
103 | 103 | } |
104 | 104 | break; |
105 | 105 | case 'earnings': |
106 | - if ( current_user_can( 'view_give_form_stats', $post_id ) ) { |
|
107 | - echo '<a href="' . esc_url( admin_url( 'edit.php?post_type=give_forms&page=give-reports&tab=forms&form-id=' . $post_id ) ) . '">'; |
|
108 | - echo give_currency_filter( give_format_amount( give_get_form_earnings_stats( $post_id ) ) ); |
|
106 | + if (current_user_can('view_give_form_stats', $post_id)) { |
|
107 | + echo '<a href="'.esc_url(admin_url('edit.php?post_type=give_forms&page=give-reports&tab=forms&form-id='.$post_id)).'">'; |
|
108 | + echo give_currency_filter(give_format_amount(give_get_form_earnings_stats($post_id))); |
|
109 | 109 | echo '</a>'; |
110 | 110 | } else { |
111 | 111 | echo '-'; |
112 | 112 | } |
113 | 113 | break; |
114 | 114 | case 'shortcode': |
115 | - echo '<input onclick="this.setSelectionRange(0, this.value.length)" type="text" class="shortcode-input" readonly="" value="[give_form id="' . absint( $post_id ) . '"]">'; |
|
115 | + echo '<input onclick="this.setSelectionRange(0, this.value.length)" type="text" class="shortcode-input" readonly="" value="[give_form id="'.absint($post_id).'"]">'; |
|
116 | 116 | break; |
117 | 117 | }// End switch(). |
118 | 118 | }// End if(). |
119 | 119 | } |
120 | 120 | |
121 | -add_action( 'manage_posts_custom_column', 'give_render_form_columns', 10, 2 ); |
|
121 | +add_action('manage_posts_custom_column', 'give_render_form_columns', 10, 2); |
|
122 | 122 | |
123 | 123 | /** |
124 | 124 | * Registers the sortable columns in the list table |
@@ -129,7 +129,7 @@ discard block |
||
129 | 129 | * |
130 | 130 | * @return array $columns Array of sortable columns |
131 | 131 | */ |
132 | -function give_sortable_form_columns( $columns ) { |
|
132 | +function give_sortable_form_columns($columns) { |
|
133 | 133 | $columns['price'] = 'amount'; |
134 | 134 | $columns['sales'] = 'sales'; |
135 | 135 | $columns['earnings'] = 'earnings'; |
@@ -139,7 +139,7 @@ discard block |
||
139 | 139 | return $columns; |
140 | 140 | } |
141 | 141 | |
142 | -add_filter( 'manage_edit-give_forms_sortable_columns', 'give_sortable_form_columns' ); |
|
142 | +add_filter('manage_edit-give_forms_sortable_columns', 'give_sortable_form_columns'); |
|
143 | 143 | |
144 | 144 | /** |
145 | 145 | * Sorts Columns in the Forms List Table |
@@ -150,13 +150,13 @@ discard block |
||
150 | 150 | * |
151 | 151 | * @return array $vars Array of all the sort variables. |
152 | 152 | */ |
153 | -function give_sort_forms( $vars ) { |
|
153 | +function give_sort_forms($vars) { |
|
154 | 154 | // Check if we're viewing the "give_forms" post type. |
155 | - if ( ! isset( $vars['post_type'] ) || ! isset( $vars['orderby'] ) || 'give_forms' !== $vars['post_type'] ) { |
|
155 | + if ( ! isset($vars['post_type']) || ! isset($vars['orderby']) || 'give_forms' !== $vars['post_type']) { |
|
156 | 156 | return $vars; |
157 | 157 | } |
158 | 158 | |
159 | - switch ( $vars['orderby'] ) { |
|
159 | + switch ($vars['orderby']) { |
|
160 | 160 | // Check if 'orderby' is set to "sales". |
161 | 161 | case 'sales': |
162 | 162 | $vars = array_merge( |
@@ -181,7 +181,7 @@ discard block |
||
181 | 181 | |
182 | 182 | // Check if "orderby" is set to "price/amount". |
183 | 183 | case 'amount': |
184 | - $multi_level_meta_key = ( 'asc' === $vars['order'] ) ? '_give_levels_minimum_amount' : '_give_levels_maximum_amount'; |
|
184 | + $multi_level_meta_key = ('asc' === $vars['order']) ? '_give_levels_minimum_amount' : '_give_levels_maximum_amount'; |
|
185 | 185 | |
186 | 186 | $vars['orderby'] = 'meta_value_num'; |
187 | 187 | $vars['meta_query'] = array( |
@@ -233,17 +233,17 @@ discard block |
||
233 | 233 | * |
234 | 234 | * @return array Array of all sort variables. |
235 | 235 | */ |
236 | -function give_filter_forms( $vars ) { |
|
237 | - if ( isset( $vars['post_type'] ) && 'give_forms' == $vars['post_type'] ) { |
|
236 | +function give_filter_forms($vars) { |
|
237 | + if (isset($vars['post_type']) && 'give_forms' == $vars['post_type']) { |
|
238 | 238 | |
239 | 239 | // If an author ID was passed, use it |
240 | - if ( isset( $_REQUEST['author'] ) && ! current_user_can( 'view_give_reports' ) ) { |
|
240 | + if (isset($_REQUEST['author']) && ! current_user_can('view_give_reports')) { |
|
241 | 241 | |
242 | 242 | $author_id = $_REQUEST['author']; |
243 | - if ( (int) $author_id !== get_current_user_id() ) { |
|
244 | - wp_die( esc_html__( 'You do not have permission to view this data.', 'give' ), esc_html__( 'Error', 'give' ), array( |
|
243 | + if ((int) $author_id !== get_current_user_id()) { |
|
244 | + wp_die(esc_html__('You do not have permission to view this data.', 'give'), esc_html__('Error', 'give'), array( |
|
245 | 245 | 'response' => 403, |
246 | - ) ); |
|
246 | + )); |
|
247 | 247 | } |
248 | 248 | $vars = array_merge( |
249 | 249 | $vars, |
@@ -267,11 +267,11 @@ discard block |
||
267 | 267 | * @return void |
268 | 268 | */ |
269 | 269 | function give_forms_load() { |
270 | - add_filter( 'request', 'give_sort_forms' ); |
|
271 | - add_filter( 'request', 'give_filter_forms' ); |
|
270 | + add_filter('request', 'give_sort_forms'); |
|
271 | + add_filter('request', 'give_filter_forms'); |
|
272 | 272 | } |
273 | 273 | |
274 | -add_action( 'load-edit.php', 'give_forms_load', 9999 ); |
|
274 | +add_action('load-edit.php', 'give_forms_load', 9999); |
|
275 | 275 | |
276 | 276 | /** |
277 | 277 | * Remove Forms Month Filter |
@@ -285,17 +285,17 @@ discard block |
||
285 | 285 | * @global $typenow The post type we are viewing. |
286 | 286 | * @return array Empty array disables the dropdown. |
287 | 287 | */ |
288 | -function give_remove_month_filter( $dates ) { |
|
288 | +function give_remove_month_filter($dates) { |
|
289 | 289 | global $typenow; |
290 | 290 | |
291 | - if ( $typenow == 'give_forms' ) { |
|
291 | + if ($typenow == 'give_forms') { |
|
292 | 292 | $dates = array(); |
293 | 293 | } |
294 | 294 | |
295 | 295 | return $dates; |
296 | 296 | } |
297 | 297 | |
298 | -add_filter( 'months_dropdown_results', 'give_remove_month_filter', 99 ); |
|
298 | +add_filter('months_dropdown_results', 'give_remove_month_filter', 99); |
|
299 | 299 | |
300 | 300 | /** |
301 | 301 | * Updates price when saving post |
@@ -306,23 +306,23 @@ discard block |
||
306 | 306 | * |
307 | 307 | * @return int|null |
308 | 308 | */ |
309 | -function give_price_save_quick_edit( $post_id ) { |
|
310 | - if ( ! isset( $_POST['post_type'] ) || 'give_forms' !== $_POST['post_type'] ) { |
|
309 | +function give_price_save_quick_edit($post_id) { |
|
310 | + if ( ! isset($_POST['post_type']) || 'give_forms' !== $_POST['post_type']) { |
|
311 | 311 | return; |
312 | 312 | } |
313 | - if ( ! current_user_can( 'edit_post', $post_id ) ) { |
|
313 | + if ( ! current_user_can('edit_post', $post_id)) { |
|
314 | 314 | return $post_id; |
315 | 315 | } |
316 | - if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) { |
|
316 | + if (defined('DOING_AUTOSAVE') && DOING_AUTOSAVE) { |
|
317 | 317 | return $post_id; |
318 | 318 | } |
319 | 319 | |
320 | - if ( isset( $_REQUEST['_give_regprice'] ) ) { |
|
321 | - give_update_meta( $post_id, '_give_set_price', strip_tags( stripslashes( $_REQUEST['_give_regprice'] ) ) ); |
|
320 | + if (isset($_REQUEST['_give_regprice'])) { |
|
321 | + give_update_meta($post_id, '_give_set_price', strip_tags(stripslashes($_REQUEST['_give_regprice']))); |
|
322 | 322 | } |
323 | 323 | } |
324 | 324 | |
325 | -add_action( 'save_post', 'give_price_save_quick_edit' ); |
|
325 | +add_action('save_post', 'give_price_save_quick_edit'); |
|
326 | 326 | |
327 | 327 | /** |
328 | 328 | * Process bulk edit actions via AJAX |
@@ -332,18 +332,18 @@ discard block |
||
332 | 332 | */ |
333 | 333 | function give_save_bulk_edit() { |
334 | 334 | |
335 | - $post_ids = ( isset( $_POST['post_ids'] ) && ! empty( $_POST['post_ids'] ) ) ? $_POST['post_ids'] : array(); |
|
335 | + $post_ids = (isset($_POST['post_ids']) && ! empty($_POST['post_ids'])) ? $_POST['post_ids'] : array(); |
|
336 | 336 | |
337 | - if ( ! empty( $post_ids ) && is_array( $post_ids ) ) { |
|
338 | - $price = isset( $_POST['price'] ) ? strip_tags( stripslashes( $_POST['price'] ) ) : 0; |
|
339 | - foreach ( $post_ids as $post_id ) { |
|
337 | + if ( ! empty($post_ids) && is_array($post_ids)) { |
|
338 | + $price = isset($_POST['price']) ? strip_tags(stripslashes($_POST['price'])) : 0; |
|
339 | + foreach ($post_ids as $post_id) { |
|
340 | 340 | |
341 | - if ( ! current_user_can( 'edit_post', $post_id ) ) { |
|
341 | + if ( ! current_user_can('edit_post', $post_id)) { |
|
342 | 342 | continue; |
343 | 343 | } |
344 | 344 | |
345 | - if ( ! empty( $price ) ) { |
|
346 | - give_update_meta( $post_id, '_give_set_price', give_sanitize_amount( $price ) ); |
|
345 | + if ( ! empty($price)) { |
|
346 | + give_update_meta($post_id, '_give_set_price', give_sanitize_amount($price)); |
|
347 | 347 | } |
348 | 348 | } |
349 | 349 | } |
@@ -351,4 +351,4 @@ discard block |
||
351 | 351 | die(); |
352 | 352 | } |
353 | 353 | |
354 | -add_action( 'wp_ajax_give_save_bulk_edit', 'give_save_bulk_edit' ); |
|
354 | +add_action('wp_ajax_give_save_bulk_edit', 'give_save_bulk_edit'); |
@@ -16,7 +16,7 @@ discard block |
||
16 | 16 | */ |
17 | 17 | |
18 | 18 | // Exit if accessed directly. |
19 | -if ( ! defined( 'ABSPATH' ) ) { |
|
19 | +if ( ! defined('ABSPATH')) { |
|
20 | 20 | exit; |
21 | 21 | } |
22 | 22 | |
@@ -29,8 +29,8 @@ discard block |
||
29 | 29 | * @return void |
30 | 30 | */ |
31 | 31 | function give_reports_page() { |
32 | - $current_page = admin_url( 'edit.php?post_type=give_forms&page=give-reports' ); |
|
33 | - $active_tab = isset( $_GET['tab'] ) ? sanitize_text_field( $_GET['tab'] ) : 'earnings'; |
|
32 | + $current_page = admin_url('edit.php?post_type=give_forms&page=give-reports'); |
|
33 | + $active_tab = isset($_GET['tab']) ? sanitize_text_field($_GET['tab']) : 'earnings'; |
|
34 | 34 | $views = give_reports_default_views(); |
35 | 35 | ?> |
36 | 36 | <div class="wrap give-settings-page"> |
@@ -38,17 +38,17 @@ discard block |
||
38 | 38 | <h1 class="screen-reader-text"><?php echo get_admin_page_title(); ?></h1> |
39 | 39 | |
40 | 40 | <h2 class="nav-tab-wrapper"> |
41 | - <?php foreach ( $views as $tab => $label ) { ?> |
|
42 | - <a href="<?php echo esc_url( add_query_arg( array( |
|
41 | + <?php foreach ($views as $tab => $label) { ?> |
|
42 | + <a href="<?php echo esc_url(add_query_arg(array( |
|
43 | 43 | 'tab' => $tab, |
44 | 44 | 'settings-updated' => false, |
45 | - ), $current_page ) ); ?>" class="nav-tab <?php echo $tab === $active_tab ? esc_attr( 'nav-tab-active' ) : ''; ?>"><?php echo esc_html( $label ); ?></a> |
|
45 | + ), $current_page)); ?>" class="nav-tab <?php echo $tab === $active_tab ? esc_attr('nav-tab-active') : ''; ?>"><?php echo esc_html($label); ?></a> |
|
46 | 46 | <?php } ?> |
47 | - <?php if ( current_user_can( 'export_give_reports' ) ) { ?> |
|
48 | - <a href="<?php echo esc_url( add_query_arg( array( |
|
47 | + <?php if (current_user_can('export_give_reports')) { ?> |
|
48 | + <a href="<?php echo esc_url(add_query_arg(array( |
|
49 | 49 | 'tab' => 'export', |
50 | 50 | 'settings-updated' => false, |
51 | - ), $current_page ) ); ?>" class="nav-tab <?php echo 'export' === $active_tab ? esc_attr( 'nav-tab-active' ) : ''; ?>"><?php esc_html_e( 'Export', 'give' ); ?></a> |
|
51 | + ), $current_page)); ?>" class="nav-tab <?php echo 'export' === $active_tab ? esc_attr('nav-tab-active') : ''; ?>"><?php esc_html_e('Export', 'give'); ?></a> |
|
52 | 52 | <?php } |
53 | 53 | /** |
54 | 54 | * Fires in the report tabs. |
@@ -57,7 +57,7 @@ discard block |
||
57 | 57 | * |
58 | 58 | * @since 1.0 |
59 | 59 | */ |
60 | - do_action( 'give_reports_tabs' ); |
|
60 | + do_action('give_reports_tabs'); |
|
61 | 61 | ?> |
62 | 62 | </h2> |
63 | 63 | |
@@ -67,10 +67,10 @@ discard block |
||
67 | 67 | * |
68 | 68 | * @since 1.0 |
69 | 69 | */ |
70 | - do_action( 'give_reports_page_top' ); |
|
70 | + do_action('give_reports_page_top'); |
|
71 | 71 | |
72 | 72 | // Set $active_tab prior to hook firing. |
73 | - if ( in_array( $active_tab, array_keys( $views ) ) ) { |
|
73 | + if (in_array($active_tab, array_keys($views))) { |
|
74 | 74 | $active_tab = 'reports'; |
75 | 75 | } |
76 | 76 | |
@@ -79,14 +79,14 @@ discard block |
||
79 | 79 | * |
80 | 80 | * @since 1.0 |
81 | 81 | */ |
82 | - do_action( "give_reports_tab_{$active_tab}" ); |
|
82 | + do_action("give_reports_tab_{$active_tab}"); |
|
83 | 83 | |
84 | 84 | /** |
85 | 85 | * Fires after the report page. |
86 | 86 | * |
87 | 87 | * @since 1.0 |
88 | 88 | */ |
89 | - do_action( 'give_reports_page_bottom' ); |
|
89 | + do_action('give_reports_page_bottom'); |
|
90 | 90 | ?> |
91 | 91 | </div><!-- .wrap --> |
92 | 92 | <?php |
@@ -100,13 +100,13 @@ discard block |
||
100 | 100 | */ |
101 | 101 | function give_reports_default_views() { |
102 | 102 | $views = array( |
103 | - 'earnings' => esc_html__( 'Income', 'give' ), |
|
104 | - 'forms' => esc_html__( 'Forms', 'give' ), |
|
105 | - 'donors' => esc_html__( 'Donors', 'give' ), |
|
106 | - 'gateways' => esc_html__( 'Donation Methods', 'give' ), |
|
103 | + 'earnings' => esc_html__('Income', 'give'), |
|
104 | + 'forms' => esc_html__('Forms', 'give'), |
|
105 | + 'donors' => esc_html__('Donors', 'give'), |
|
106 | + 'gateways' => esc_html__('Donation Methods', 'give'), |
|
107 | 107 | ); |
108 | 108 | |
109 | - $views = apply_filters( 'give_report_views', $views ); |
|
109 | + $views = apply_filters('give_report_views', $views); |
|
110 | 110 | |
111 | 111 | return $views; |
112 | 112 | } |
@@ -121,15 +121,15 @@ discard block |
||
121 | 121 | * @since 1.0 |
122 | 122 | * @return string $view Report View |
123 | 123 | */ |
124 | -function give_get_reporting_view( $default = 'earnings' ) { |
|
124 | +function give_get_reporting_view($default = 'earnings') { |
|
125 | 125 | |
126 | - if ( ! isset( $_GET['view'] ) || ! in_array( $_GET['view'], array_keys( give_reports_default_views() ) ) ) { |
|
126 | + if ( ! isset($_GET['view']) || ! in_array($_GET['view'], array_keys(give_reports_default_views()))) { |
|
127 | 127 | $view = $default; |
128 | 128 | } else { |
129 | 129 | $view = $_GET['view']; |
130 | 130 | } |
131 | 131 | |
132 | - return apply_filters( 'give_get_reporting_view', $view ); |
|
132 | + return apply_filters('give_get_reporting_view', $view); |
|
133 | 133 | } |
134 | 134 | |
135 | 135 | /** |
@@ -142,7 +142,7 @@ discard block |
||
142 | 142 | $current_view = 'earnings'; |
143 | 143 | $views = give_reports_default_views(); |
144 | 144 | |
145 | - if ( isset( $_GET['tab'] ) && array_key_exists( $_GET['tab'], $views ) ) { |
|
145 | + if (isset($_GET['tab']) && array_key_exists($_GET['tab'], $views)) { |
|
146 | 146 | $current_view = $_GET['tab']; |
147 | 147 | } |
148 | 148 | |
@@ -151,10 +151,10 @@ discard block |
||
151 | 151 | * |
152 | 152 | * @since 1.0 |
153 | 153 | */ |
154 | - do_action( "give_reports_view_{$current_view}" ); |
|
154 | + do_action("give_reports_view_{$current_view}"); |
|
155 | 155 | } |
156 | 156 | |
157 | -add_action( 'give_reports_tab_reports', 'give_reports_tab_reports' ); |
|
157 | +add_action('give_reports_tab_reports', 'give_reports_tab_reports'); |
|
158 | 158 | |
159 | 159 | /** |
160 | 160 | * Renders the Reports Page Views Drop Downs |
@@ -164,19 +164,19 @@ discard block |
||
164 | 164 | */ |
165 | 165 | function give_report_views() { |
166 | 166 | $views = give_reports_default_views(); |
167 | - $current_view = isset( $_GET['view'] ) ? $_GET['view'] : 'earnings'; |
|
167 | + $current_view = isset($_GET['view']) ? $_GET['view'] : 'earnings'; |
|
168 | 168 | /** |
169 | 169 | * Fires before the report page actions form. |
170 | 170 | * |
171 | 171 | * @since 1.0 |
172 | 172 | */ |
173 | - do_action( 'give_report_view_actions_before' ); |
|
173 | + do_action('give_report_view_actions_before'); |
|
174 | 174 | ?> |
175 | 175 | <form id="give-reports-filter" method="get"> |
176 | 176 | <select id="give-reports-view" name="view"> |
177 | - <option value="-1"><?php esc_html_e( 'Report Type', 'give' ); ?></option> |
|
178 | - <?php foreach ( $views as $view_id => $label ) : ?> |
|
179 | - <option value="<?php echo esc_attr( $view_id ); ?>" <?php selected( $view_id, $current_view ); ?>><?php echo $label; ?></option> |
|
177 | + <option value="-1"><?php esc_html_e('Report Type', 'give'); ?></option> |
|
178 | + <?php foreach ($views as $view_id => $label) : ?> |
|
179 | + <option value="<?php echo esc_attr($view_id); ?>" <?php selected($view_id, $current_view); ?>><?php echo $label; ?></option> |
|
180 | 180 | <?php endforeach; ?> |
181 | 181 | </select> |
182 | 182 | |
@@ -188,12 +188,12 @@ discard block |
||
188 | 188 | * |
189 | 189 | * @since 1.0 |
190 | 190 | */ |
191 | - do_action( 'give_report_view_actions' ); |
|
191 | + do_action('give_report_view_actions'); |
|
192 | 192 | ?> |
193 | 193 | |
194 | 194 | <input type="hidden" name="post_type" value="give_forms"/> |
195 | 195 | <input type="hidden" name="page" value="give-reports"/> |
196 | - <?php submit_button( esc_html__( 'Show', 'give' ), 'secondary', 'submit', false ); ?> |
|
196 | + <?php submit_button(esc_html__('Show', 'give'), 'secondary', 'submit', false); ?> |
|
197 | 197 | </form> |
198 | 198 | <?php |
199 | 199 | /** |
@@ -201,7 +201,7 @@ discard block |
||
201 | 201 | * |
202 | 202 | * @since 1.0 |
203 | 203 | */ |
204 | - do_action( 'give_report_view_actions_after' ); |
|
204 | + do_action('give_report_view_actions_after'); |
|
205 | 205 | } |
206 | 206 | |
207 | 207 | /** |
@@ -214,18 +214,18 @@ discard block |
||
214 | 214 | */ |
215 | 215 | function give_reports_forms_table() { |
216 | 216 | |
217 | - if ( isset( $_GET['form-id'] ) ) { |
|
217 | + if (isset($_GET['form-id'])) { |
|
218 | 218 | return; |
219 | 219 | } |
220 | 220 | |
221 | - include( dirname( __FILE__ ) . '/class-form-reports-table.php' ); |
|
221 | + include(dirname(__FILE__).'/class-form-reports-table.php'); |
|
222 | 222 | |
223 | 223 | $give_table = new Give_Form_Reports_Table(); |
224 | 224 | $give_table->prepare_items(); |
225 | 225 | $give_table->display(); |
226 | 226 | } |
227 | 227 | |
228 | -add_action( 'give_reports_view_forms', 'give_reports_forms_table' ); |
|
228 | +add_action('give_reports_view_forms', 'give_reports_forms_table'); |
|
229 | 229 | |
230 | 230 | /** |
231 | 231 | * Renders the detailed report for a specific give form. |
@@ -234,20 +234,20 @@ discard block |
||
234 | 234 | * @return void |
235 | 235 | */ |
236 | 236 | function give_reports_form_details() { |
237 | - if ( ! isset( $_GET['form-id'] ) ) { |
|
237 | + if ( ! isset($_GET['form-id'])) { |
|
238 | 238 | return; |
239 | 239 | } |
240 | 240 | ?> |
241 | 241 | <div class="tablenav top reports-forms-details-wrap"> |
242 | 242 | <div class="actions bulkactions"> |
243 | - <button onclick="history.go(-1);" class="button-secondary"><?php esc_html_e( 'Go Back', 'give' ); ?></button> |
|
243 | + <button onclick="history.go(-1);" class="button-secondary"><?php esc_html_e('Go Back', 'give'); ?></button> |
|
244 | 244 | </div> |
245 | 245 | </div> |
246 | 246 | <?php |
247 | - give_reports_graph_of_form( absint( $_GET['form-id'] ) ); |
|
247 | + give_reports_graph_of_form(absint($_GET['form-id'])); |
|
248 | 248 | } |
249 | 249 | |
250 | -add_action( 'give_reports_view_forms', 'give_reports_form_details' ); |
|
250 | +add_action('give_reports_view_forms', 'give_reports_form_details'); |
|
251 | 251 | |
252 | 252 | /** |
253 | 253 | * Renders the Reports Donors Table |
@@ -258,7 +258,7 @@ discard block |
||
258 | 258 | * @return void |
259 | 259 | */ |
260 | 260 | function give_reports_donors_table() { |
261 | - include( dirname( __FILE__ ) . '/class-donor-reports-table.php' ); |
|
261 | + include(dirname(__FILE__).'/class-donor-reports-table.php'); |
|
262 | 262 | |
263 | 263 | $give_table = new Give_Donor_Reports_Table(); |
264 | 264 | $give_table->prepare_items(); |
@@ -270,11 +270,11 @@ discard block |
||
270 | 270 | * |
271 | 271 | * @since 1.0 |
272 | 272 | */ |
273 | - do_action( 'give_logs_donors_table_top' ); |
|
273 | + do_action('give_logs_donors_table_top'); |
|
274 | 274 | ?> |
275 | 275 | <form id="give-donors-filter" method="get"> |
276 | 276 | <?php |
277 | - $give_table->search_box( esc_html__( 'Search', 'give' ), 'give-donors' ); |
|
277 | + $give_table->search_box(esc_html__('Search', 'give'), 'give-donors'); |
|
278 | 278 | $give_table->display(); |
279 | 279 | ?> |
280 | 280 | <input type="hidden" name="post_type" value="give_forms"/> |
@@ -287,13 +287,13 @@ discard block |
||
287 | 287 | * |
288 | 288 | * @since 1.0 |
289 | 289 | */ |
290 | - do_action( 'give_logs_donors_table_bottom' ); |
|
290 | + do_action('give_logs_donors_table_bottom'); |
|
291 | 291 | ?> |
292 | 292 | </div> |
293 | 293 | <?php |
294 | 294 | } |
295 | 295 | |
296 | -add_action( 'give_reports_view_donors', 'give_reports_donors_table' ); |
|
296 | +add_action('give_reports_view_donors', 'give_reports_donors_table'); |
|
297 | 297 | |
298 | 298 | |
299 | 299 | /** |
@@ -305,14 +305,14 @@ discard block |
||
305 | 305 | * @return void |
306 | 306 | */ |
307 | 307 | function give_reports_gateways_table() { |
308 | - include( dirname( __FILE__ ) . '/class-gateways-reports-table.php' ); |
|
308 | + include(dirname(__FILE__).'/class-gateways-reports-table.php'); |
|
309 | 309 | |
310 | 310 | $give_table = new Give_Gateway_Reports_Table(); |
311 | 311 | $give_table->prepare_items(); |
312 | 312 | $give_table->display(); |
313 | 313 | } |
314 | 314 | |
315 | -add_action( 'give_reports_view_gateways', 'give_reports_gateways_table' ); |
|
315 | +add_action('give_reports_view_gateways', 'give_reports_gateways_table'); |
|
316 | 316 | |
317 | 317 | |
318 | 318 | /** |
@@ -324,13 +324,13 @@ discard block |
||
324 | 324 | function give_reports_earnings() { |
325 | 325 | ?> |
326 | 326 | <div class="tablenav top reports-table-nav"> |
327 | - <h3 class="alignleft reports-earnings-title"><span><?php esc_html_e( 'Income Report', 'give' ); ?></span></h3> |
|
327 | + <h3 class="alignleft reports-earnings-title"><span><?php esc_html_e('Income Report', 'give'); ?></span></h3> |
|
328 | 328 | </div> |
329 | 329 | <?php |
330 | 330 | give_reports_graph(); |
331 | 331 | } |
332 | 332 | |
333 | -add_action( 'give_reports_view_earnings', 'give_reports_earnings' ); |
|
333 | +add_action('give_reports_view_earnings', 'give_reports_earnings'); |
|
334 | 334 | |
335 | 335 | |
336 | 336 | /** |
@@ -341,9 +341,9 @@ discard block |
||
341 | 341 | */ |
342 | 342 | function give_estimated_monthly_stats() { |
343 | 343 | |
344 | - $estimated = Give_Cache::get( 'give_estimated_monthly_stats', true ); |
|
344 | + $estimated = Give_Cache::get('give_estimated_monthly_stats', true); |
|
345 | 345 | |
346 | - if ( false === $estimated ) { |
|
346 | + if (false === $estimated) { |
|
347 | 347 | |
348 | 348 | $estimated = array( |
349 | 349 | 'earnings' => 0, |
@@ -352,22 +352,22 @@ discard block |
||
352 | 352 | |
353 | 353 | $stats = new Give_Payment_Stats; |
354 | 354 | |
355 | - $to_date_earnings = $stats->get_earnings( 0, 'this_month' ); |
|
356 | - $to_date_sales = $stats->get_sales( 0, 'this_month' ); |
|
355 | + $to_date_earnings = $stats->get_earnings(0, 'this_month'); |
|
356 | + $to_date_sales = $stats->get_sales(0, 'this_month'); |
|
357 | 357 | |
358 | - $current_day = date( 'd', current_time( 'timestamp' ) ); |
|
359 | - $current_month = date( 'n', current_time( 'timestamp' ) ); |
|
360 | - $current_year = date( 'Y', current_time( 'timestamp' ) ); |
|
361 | - $days_in_month = cal_days_in_month( CAL_GREGORIAN, $current_month, $current_year ); |
|
358 | + $current_day = date('d', current_time('timestamp')); |
|
359 | + $current_month = date('n', current_time('timestamp')); |
|
360 | + $current_year = date('Y', current_time('timestamp')); |
|
361 | + $days_in_month = cal_days_in_month(CAL_GREGORIAN, $current_month, $current_year); |
|
362 | 362 | |
363 | - $estimated['earnings'] = ( $to_date_earnings / $current_day ) * $days_in_month; |
|
364 | - $estimated['sales'] = ( $to_date_sales / $current_day ) * $days_in_month; |
|
363 | + $estimated['earnings'] = ($to_date_earnings / $current_day) * $days_in_month; |
|
364 | + $estimated['sales'] = ($to_date_sales / $current_day) * $days_in_month; |
|
365 | 365 | |
366 | 366 | // Cache for one day |
367 | - Give_Cache::set( 'give_estimated_monthly_stats', $estimated, DAY_IN_SECONDS, true ); |
|
367 | + Give_Cache::set('give_estimated_monthly_stats', $estimated, DAY_IN_SECONDS, true); |
|
368 | 368 | } |
369 | 369 | |
370 | - return maybe_unserialize( $estimated ); |
|
370 | + return maybe_unserialize($estimated); |
|
371 | 371 | } |
372 | 372 | |
373 | 373 | // @TODO: After release 1.8 Donations -> Reports generates with new setting api, so we can remove some old code from this file. |
@@ -10,7 +10,7 @@ discard block |
||
10 | 10 | */ |
11 | 11 | |
12 | 12 | // Exit if accessed directly. |
13 | -if ( ! defined( 'ABSPATH' ) ) { |
|
13 | +if ( ! defined('ABSPATH')) { |
|
14 | 14 | exit; |
15 | 15 | } |
16 | 16 | |
@@ -24,9 +24,9 @@ discard block |
||
24 | 24 | */ |
25 | 25 | function give_donors_page() { |
26 | 26 | $default_views = give_donor_views(); |
27 | - $requested_view = isset( $_GET['view'] ) ? sanitize_text_field( $_GET['view'] ) : 'donors'; |
|
28 | - if ( array_key_exists( $requested_view, $default_views ) && function_exists( $default_views[ $requested_view ] ) ) { |
|
29 | - give_render_donor_view( $requested_view, $default_views ); |
|
27 | + $requested_view = isset($_GET['view']) ? sanitize_text_field($_GET['view']) : 'donors'; |
|
28 | + if (array_key_exists($requested_view, $default_views) && function_exists($default_views[$requested_view])) { |
|
29 | + give_render_donor_view($requested_view, $default_views); |
|
30 | 30 | } else { |
31 | 31 | give_donors_list(); |
32 | 32 | } |
@@ -42,7 +42,7 @@ discard block |
||
42 | 42 | |
43 | 43 | $views = array(); |
44 | 44 | |
45 | - return apply_filters( 'give_donor_views', $views ); |
|
45 | + return apply_filters('give_donor_views', $views); |
|
46 | 46 | |
47 | 47 | } |
48 | 48 | |
@@ -56,7 +56,7 @@ discard block |
||
56 | 56 | |
57 | 57 | $tabs = array(); |
58 | 58 | |
59 | - return apply_filters( 'give_donor_tabs', $tabs ); |
|
59 | + return apply_filters('give_donor_tabs', $tabs); |
|
60 | 60 | |
61 | 61 | } |
62 | 62 | |
@@ -67,7 +67,7 @@ discard block |
||
67 | 67 | * @return void |
68 | 68 | */ |
69 | 69 | function give_donors_list() { |
70 | - include dirname( __FILE__ ) . '/class-donor-table.php'; |
|
70 | + include dirname(__FILE__).'/class-donor-table.php'; |
|
71 | 71 | |
72 | 72 | $donors_table = new Give_Donor_List_Table(); |
73 | 73 | $donors_table->prepare_items(); |
@@ -80,11 +80,11 @@ discard block |
||
80 | 80 | * |
81 | 81 | * @since 1.0 |
82 | 82 | */ |
83 | - do_action( 'give_donors_table_top' ); |
|
83 | + do_action('give_donors_table_top'); |
|
84 | 84 | ?> |
85 | - <form id="give-donors-filter" method="get" action="<?php echo admin_url( 'edit.php?post_type=give_forms&page=give-donors' ); ?>"> |
|
85 | + <form id="give-donors-filter" method="get" action="<?php echo admin_url('edit.php?post_type=give_forms&page=give-donors'); ?>"> |
|
86 | 86 | <?php |
87 | - $donors_table->search_box( esc_html__( 'Search Donors', 'give' ), 'give-donors' ); |
|
87 | + $donors_table->search_box(esc_html__('Search Donors', 'give'), 'give-donors'); |
|
88 | 88 | $donors_table->display(); |
89 | 89 | ?> |
90 | 90 | <input type="hidden" name="post_type" value="give_forms" /> |
@@ -97,7 +97,7 @@ discard block |
||
97 | 97 | * |
98 | 98 | * @since 1.0 |
99 | 99 | */ |
100 | - do_action( 'give_donors_table_bottom' ); |
|
100 | + do_action('give_donors_table_bottom'); |
|
101 | 101 | ?> |
102 | 102 | </div> |
103 | 103 | <?php |
@@ -113,27 +113,27 @@ discard block |
||
113 | 113 | * |
114 | 114 | * @return void |
115 | 115 | */ |
116 | -function give_render_donor_view( $view, $callbacks ) { |
|
116 | +function give_render_donor_view($view, $callbacks) { |
|
117 | 117 | |
118 | 118 | $render = true; |
119 | 119 | |
120 | - $donor_view_role = apply_filters( 'give_view_donors_role', 'view_give_reports' ); |
|
120 | + $donor_view_role = apply_filters('give_view_donors_role', 'view_give_reports'); |
|
121 | 121 | |
122 | - if ( ! current_user_can( $donor_view_role ) ) { |
|
123 | - give_set_error( 'give-no-access', __( 'You are not permitted to view this data.', 'give' ) ); |
|
122 | + if ( ! current_user_can($donor_view_role)) { |
|
123 | + give_set_error('give-no-access', __('You are not permitted to view this data.', 'give')); |
|
124 | 124 | $render = false; |
125 | 125 | } |
126 | 126 | |
127 | - if ( ! isset( $_GET['id'] ) || ! is_numeric( $_GET['id'] ) ) { |
|
128 | - give_set_error( 'give-invalid_donor', __( 'Invalid Donor ID.', 'give' ) ); |
|
127 | + if ( ! isset($_GET['id']) || ! is_numeric($_GET['id'])) { |
|
128 | + give_set_error('give-invalid_donor', __('Invalid Donor ID.', 'give')); |
|
129 | 129 | $render = false; |
130 | 130 | } |
131 | 131 | |
132 | 132 | $donor_id = (int) $_GET['id']; |
133 | - $donor = new Give_Donor( $donor_id ); |
|
133 | + $donor = new Give_Donor($donor_id); |
|
134 | 134 | |
135 | - if ( empty( $donor->id ) ) { |
|
136 | - give_set_error( 'give-invalid_donor', __( 'Invalid Donor ID.', 'give' ) ); |
|
135 | + if (empty($donor->id)) { |
|
136 | + give_set_error('give-invalid_donor', __('Invalid Donor ID.', 'give')); |
|
137 | 137 | $render = false; |
138 | 138 | } |
139 | 139 | |
@@ -142,34 +142,34 @@ discard block |
||
142 | 142 | |
143 | 143 | <div class='wrap'> |
144 | 144 | |
145 | - <?php if ( give_get_errors() ) : ?> |
|
145 | + <?php if (give_get_errors()) : ?> |
|
146 | 146 | <div class="error settings-error"> |
147 | - <?php Give()->notices->render_frontend_notices( 0 ); ?> |
|
147 | + <?php Give()->notices->render_frontend_notices(0); ?> |
|
148 | 148 | </div> |
149 | 149 | <?php endif; ?> |
150 | 150 | |
151 | - <h1 class="screen-reader-text"><?php esc_html_e( 'Donor', 'give' ); ?></h1> |
|
151 | + <h1 class="screen-reader-text"><?php esc_html_e('Donor', 'give'); ?></h1> |
|
152 | 152 | |
153 | - <?php if ( $donor && $render ) : ?> |
|
153 | + <?php if ($donor && $render) : ?> |
|
154 | 154 | |
155 | 155 | <h2 class="nav-tab-wrapper"> |
156 | 156 | <?php |
157 | - foreach ( $donor_tabs as $key => $tab ) : |
|
157 | + foreach ($donor_tabs as $key => $tab) : |
|
158 | 158 | $active = $key === $view ? true : false; |
159 | 159 | $class = $active ? 'nav-tab nav-tab-active' : 'nav-tab'; |
160 | 160 | printf( |
161 | - '<a href="%1$s" class="%2$s"><span class="dashicons %3$s"></span>%4$s</a>' . "\n", |
|
162 | - esc_url( admin_url( 'edit.php?post_type=give_forms&page=give-donors&view=' . $key . '&id=' . $donor->id ) ), |
|
163 | - esc_attr( $class ), |
|
164 | - sanitize_html_class( $tab['dashicon'] ), |
|
165 | - esc_html( $tab['title'] ) |
|
161 | + '<a href="%1$s" class="%2$s"><span class="dashicons %3$s"></span>%4$s</a>'."\n", |
|
162 | + esc_url(admin_url('edit.php?post_type=give_forms&page=give-donors&view='.$key.'&id='.$donor->id)), |
|
163 | + esc_attr($class), |
|
164 | + sanitize_html_class($tab['dashicon']), |
|
165 | + esc_html($tab['title']) |
|
166 | 166 | ); |
167 | 167 | endforeach; |
168 | 168 | ?> |
169 | 169 | </h2> |
170 | 170 | |
171 | 171 | <div id="give-donor-card-wrapper"> |
172 | - <?php $callbacks[ $view ]( $donor ) ?> |
|
172 | + <?php $callbacks[$view]($donor) ?> |
|
173 | 173 | </div> |
174 | 174 | |
175 | 175 | <?php endif; ?> |
@@ -189,9 +189,9 @@ discard block |
||
189 | 189 | * |
190 | 190 | * @return void |
191 | 191 | */ |
192 | -function give_donor_view( $donor ) { |
|
192 | +function give_donor_view($donor) { |
|
193 | 193 | |
194 | - $donor_edit_role = apply_filters( 'give_edit_donors_role', 'edit_give_payments' ); |
|
194 | + $donor_edit_role = apply_filters('give_edit_donors_role', 'edit_give_payments'); |
|
195 | 195 | |
196 | 196 | /** |
197 | 197 | * Fires in donor profile screen, above the donor card. |
@@ -200,32 +200,32 @@ discard block |
||
200 | 200 | * |
201 | 201 | * @param object $donor The donor object being displayed. |
202 | 202 | */ |
203 | - do_action( 'give_donor_card_top', $donor ); |
|
203 | + do_action('give_donor_card_top', $donor); |
|
204 | 204 | ?> |
205 | 205 | |
206 | 206 | <div id="donor-summary" class="info-wrapper donor-section postbox"> |
207 | 207 | |
208 | - <form id="edit-donor-info" method="post" action="<?php echo admin_url( 'edit.php?post_type=give_forms&page=give-donors&view=overview&id=' . $donor->id ); ?>"> |
|
208 | + <form id="edit-donor-info" method="post" action="<?php echo admin_url('edit.php?post_type=give_forms&page=give-donors&view=overview&id='.$donor->id); ?>"> |
|
209 | 209 | |
210 | 210 | <div class="donor-info"> |
211 | 211 | |
212 | 212 | <div class="donor-bio-header clearfix"> |
213 | 213 | |
214 | 214 | <div class="avatar-wrap left" id="donor-avatar"> |
215 | - <?php echo get_avatar( $donor->email ); ?> |
|
215 | + <?php echo get_avatar($donor->email); ?> |
|
216 | 216 | </div> |
217 | 217 | |
218 | 218 | <div id="donor-name-wrap" class="left"> |
219 | 219 | <span class="donor-id">#<?php echo $donor->id; ?></span> |
220 | - <span class="donor-name info-item edit-item"><input size="15" data-key="name" name="customerinfo[name]" type="text" value="<?php echo esc_attr( $donor->name ); ?>" placeholder="<?php esc_attr_e( 'Donor Name', 'give' ); ?>" /></span> |
|
220 | + <span class="donor-name info-item edit-item"><input size="15" data-key="name" name="customerinfo[name]" type="text" value="<?php echo esc_attr($donor->name); ?>" placeholder="<?php esc_attr_e('Donor Name', 'give'); ?>" /></span> |
|
221 | 221 | <span class="donor-name info-item editable"><span data-key="name"><?php echo $donor->name; ?></span></span> |
222 | 222 | </div> |
223 | 223 | <p class="donor-since info-item"> |
224 | - <?php esc_html_e( 'Donor since', 'give' ); ?> |
|
225 | - <?php echo date_i18n( give_date_format(), strtotime( $donor->date_created ) ) ?> |
|
224 | + <?php esc_html_e('Donor since', 'give'); ?> |
|
225 | + <?php echo date_i18n(give_date_format(), strtotime($donor->date_created)) ?> |
|
226 | 226 | </p> |
227 | - <?php if ( current_user_can( $donor_edit_role ) ) : ?> |
|
228 | - <a href="#" id="edit-donor" class="button info-item editable donor-edit-link"><?php esc_html_e( 'Edit Donor', 'give' ); ?></a> |
|
227 | + <?php if (current_user_can($donor_edit_role)) : ?> |
|
228 | + <a href="#" id="edit-donor" class="button info-item editable donor-edit-link"><?php esc_html_e('Edit Donor', 'give'); ?></a> |
|
229 | 229 | <?php endif; ?> |
230 | 230 | </div> |
231 | 231 | <!-- /donor-bio-header --> |
@@ -235,7 +235,7 @@ discard block |
||
235 | 235 | <table class="widefat"> |
236 | 236 | <tbody> |
237 | 237 | <tr class="alternate"> |
238 | - <th scope="col"><label for="tablecell"><?php esc_html_e( 'User:', 'give' ); ?></label></th> |
|
238 | + <th scope="col"><label for="tablecell"><?php esc_html_e('User:', 'give'); ?></label></th> |
|
239 | 239 | <td> |
240 | 240 | <span class="donor-user-id info-item edit-item"> |
241 | 241 | <?php |
@@ -252,37 +252,37 @@ discard block |
||
252 | 252 | 'data' => $data_atts, |
253 | 253 | ); |
254 | 254 | |
255 | - if ( ! empty( $user_id ) ) { |
|
256 | - $userdata = get_userdata( $user_id ); |
|
255 | + if ( ! empty($user_id)) { |
|
256 | + $userdata = get_userdata($user_id); |
|
257 | 257 | $user_args['selected'] = $user_id; |
258 | 258 | } |
259 | 259 | |
260 | - echo Give()->html->ajax_user_search( $user_args ); |
|
260 | + echo Give()->html->ajax_user_search($user_args); |
|
261 | 261 | ?> |
262 | 262 | </span> |
263 | 263 | |
264 | 264 | <span class="donor-user-id info-item editable"> |
265 | - <?php if ( ! empty( $userdata ) ) { ?> |
|
266 | - <span data-key="user_id">#<?php echo $donor->user_id . ' - ' . $userdata->display_name; ?></span> |
|
265 | + <?php if ( ! empty($userdata)) { ?> |
|
266 | + <span data-key="user_id">#<?php echo $donor->user_id.' - '.$userdata->display_name; ?></span> |
|
267 | 267 | <?php } else { ?> |
268 | - <span data-key="user_id"><?php esc_html_e( 'None', 'give' ); ?></span> |
|
268 | + <span data-key="user_id"><?php esc_html_e('None', 'give'); ?></span> |
|
269 | 269 | <?php } ?> |
270 | - <?php if ( current_user_can( $donor_edit_role ) && intval( $donor->user_id ) > 0 ) { ?> |
|
271 | - <span class="disconnect-user"> - <a id="disconnect-donor" href="#disconnect" aria-label="<?php esc_attr_e( 'Disconnects the current user ID from this donor record.', 'give' ); ?>"><?php esc_html_e( 'Disconnect User', 'give' ); ?></a></span> |
|
270 | + <?php if (current_user_can($donor_edit_role) && intval($donor->user_id) > 0) { ?> |
|
271 | + <span class="disconnect-user"> - <a id="disconnect-donor" href="#disconnect" aria-label="<?php esc_attr_e('Disconnects the current user ID from this donor record.', 'give'); ?>"><?php esc_html_e('Disconnect User', 'give'); ?></a></span> |
|
272 | 272 | <?php } ?> |
273 | 273 | </span> |
274 | 274 | </td> |
275 | 275 | </tr> |
276 | - <?php if ( isset( $donor->user_id ) && $donor->user_id > 0 ) : ?> |
|
276 | + <?php if (isset($donor->user_id) && $donor->user_id > 0) : ?> |
|
277 | 277 | |
278 | 278 | <tr> |
279 | - <th scope="col"><?php esc_html_e( 'Address:', 'give' ); ?></th> |
|
279 | + <th scope="col"><?php esc_html_e('Address:', 'give'); ?></th> |
|
280 | 280 | <td class="row-title"> |
281 | 281 | |
282 | 282 | <div class="donor-address-wrapper"> |
283 | 283 | |
284 | 284 | <?php |
285 | - $address = get_user_meta( $donor->user_id, '_give_user_address', true ); |
|
285 | + $address = get_user_meta($donor->user_id, '_give_user_address', true); |
|
286 | 286 | $defaults = array( |
287 | 287 | 'line1' => '', |
288 | 288 | 'line2' => '', |
@@ -292,10 +292,10 @@ discard block |
||
292 | 292 | 'zip' => '', |
293 | 293 | ); |
294 | 294 | |
295 | - $address = wp_parse_args( $address, $defaults ); |
|
295 | + $address = wp_parse_args($address, $defaults); |
|
296 | 296 | ?> |
297 | 297 | |
298 | - <?php if ( ! empty( $address ) ) { ?> |
|
298 | + <?php if ( ! empty($address)) { ?> |
|
299 | 299 | <span class="donor-address info-item editable"> |
300 | 300 | <span class="info-item" data-key="line1"><?php echo $address['line1']; ?></span> |
301 | 301 | <span class="info-item" data-key="line2"><?php echo $address['line2']; ?></span> |
@@ -306,43 +306,43 @@ discard block |
||
306 | 306 | </span> |
307 | 307 | <?php } ?> |
308 | 308 | <span class="donor-address info-item edit-item"> |
309 | - <input class="info-item" type="text" data-key="line1" name="customerinfo[line1]" placeholder="<?php esc_attr_e( 'Address 1', 'give' ); ?>" value="<?php echo $address['line1']; ?>" /> |
|
310 | - <input class="info-item" type="text" data-key="line2" name="customerinfo[line2]" placeholder="<?php esc_attr_e( 'Address 2', 'give' ); ?>" value="<?php echo $address['line2']; ?>" /> |
|
311 | - <input class="info-item" type="text" data-key="city" name="customerinfo[city]" placeholder="<?php esc_attr_e( 'City', 'give' ); ?>" value="<?php echo $address['city']; ?>" /> |
|
309 | + <input class="info-item" type="text" data-key="line1" name="customerinfo[line1]" placeholder="<?php esc_attr_e('Address 1', 'give'); ?>" value="<?php echo $address['line1']; ?>" /> |
|
310 | + <input class="info-item" type="text" data-key="line2" name="customerinfo[line2]" placeholder="<?php esc_attr_e('Address 2', 'give'); ?>" value="<?php echo $address['line2']; ?>" /> |
|
311 | + <input class="info-item" type="text" data-key="city" name="customerinfo[city]" placeholder="<?php esc_attr_e('City', 'give'); ?>" value="<?php echo $address['city']; ?>" /> |
|
312 | 312 | <select data-key="country" name="customerinfo[country]" id="billing_country" class="billing_country give-select edit-item"> |
313 | 313 | <?php |
314 | 314 | |
315 | 315 | $selected_country = $address['country']; |
316 | 316 | |
317 | 317 | $countries = give_get_country_list(); |
318 | - foreach ( $countries as $country_code => $country ) { |
|
319 | - echo '<option value="' . esc_attr( $country_code ) . '"' . selected( $country_code, $selected_country, false ) . '>' . $country . '</option>'; |
|
318 | + foreach ($countries as $country_code => $country) { |
|
319 | + echo '<option value="'.esc_attr($country_code).'"'.selected($country_code, $selected_country, false).'>'.$country.'</option>'; |
|
320 | 320 | } |
321 | 321 | ?> |
322 | 322 | </select> |
323 | 323 | <?php |
324 | 324 | $selected_state = give_get_state(); |
325 | - $states = give_get_states( $selected_country ); |
|
325 | + $states = give_get_states($selected_country); |
|
326 | 326 | |
327 | - $selected_state = isset( $address['state'] ) ? $address['state'] : $selected_state; |
|
327 | + $selected_state = isset($address['state']) ? $address['state'] : $selected_state; |
|
328 | 328 | |
329 | - if ( ! empty( $states ) ) { |
|
329 | + if ( ! empty($states)) { |
|
330 | 330 | ?> |
331 | 331 | <select data-key="state" name="customerinfo[state]" id="card_state" class="card_state give-select info-item"> |
332 | 332 | <?php |
333 | - foreach ( $states as $state_code => $state ) { |
|
334 | - echo '<option value="' . $state_code . '"' . selected( $state_code, $selected_state, false ) . '>' . $state . '</option>'; |
|
333 | + foreach ($states as $state_code => $state) { |
|
334 | + echo '<option value="'.$state_code.'"'.selected($state_code, $selected_state, false).'>'.$state.'</option>'; |
|
335 | 335 | } |
336 | 336 | ?> |
337 | 337 | </select> |
338 | 338 | <?php |
339 | 339 | } else { |
340 | 340 | ?> |
341 | - <input type="text" size="6" data-key="state" name="customerinfo[state]" id="card_state" class="card_state give-input info-item" placeholder="<?php esc_attr_e( 'State / Province', 'give' ); ?>" /> |
|
341 | + <input type="text" size="6" data-key="state" name="customerinfo[state]" id="card_state" class="card_state give-input info-item" placeholder="<?php esc_attr_e('State / Province', 'give'); ?>" /> |
|
342 | 342 | <?php |
343 | 343 | } |
344 | 344 | ?> |
345 | - <input class="info-item" type="text" data-key="zip" name="customerinfo[zip]" placeholder="<?php esc_attr_e( 'Zip / Postal Code', 'give' ); ?>" value="<?php echo $address['zip']; ?>" /> |
|
345 | + <input class="info-item" type="text" data-key="zip" name="customerinfo[zip]" placeholder="<?php esc_attr_e('Zip / Postal Code', 'give'); ?>" value="<?php echo $address['zip']; ?>" /> |
|
346 | 346 | </span> |
347 | 347 | |
348 | 348 | </div> |
@@ -358,10 +358,10 @@ discard block |
||
358 | 358 | |
359 | 359 | <span id="donor-edit-actions" class="edit-item"> |
360 | 360 | <input type="hidden" data-key="id" name="customerinfo[id]" value="<?php echo $donor->id; ?>" /> |
361 | - <?php wp_nonce_field( 'edit-donor', '_wpnonce', false, true ); ?> |
|
361 | + <?php wp_nonce_field('edit-donor', '_wpnonce', false, true); ?> |
|
362 | 362 | <input type="hidden" name="give_action" value="edit-donor" /> |
363 | - <input type="submit" id="give-edit-donor-save" class="button-secondary" value="<?php esc_attr_e( 'Update Donor', 'give' ); ?>" /> |
|
364 | - <a id="give-edit-donor-cancel" href="" class="delete"><?php esc_html_e( 'Cancel', 'give' ); ?></a> |
|
363 | + <input type="submit" id="give-edit-donor-save" class="button-secondary" value="<?php esc_attr_e('Update Donor', 'give'); ?>" /> |
|
364 | + <a id="give-edit-donor-cancel" href="" class="delete"><?php esc_html_e('Cancel', 'give'); ?></a> |
|
365 | 365 | </span> |
366 | 366 | |
367 | 367 | </form> |
@@ -376,24 +376,24 @@ discard block |
||
376 | 376 | * |
377 | 377 | * @param object $donor The donor object being displayed. |
378 | 378 | */ |
379 | - do_action( 'give_donor_before_stats', $donor ); |
|
379 | + do_action('give_donor_before_stats', $donor); |
|
380 | 380 | ?> |
381 | 381 | |
382 | 382 | <div id="donor-stats-wrapper" class="donor-section postbox clear"> |
383 | 383 | <ul> |
384 | 384 | <li> |
385 | - <a href="<?php echo admin_url( 'edit.php?post_type=give_forms&page=give-payment-history&user=' . urlencode( $donor->email ) ); ?>"> |
|
385 | + <a href="<?php echo admin_url('edit.php?post_type=give_forms&page=give-payment-history&user='.urlencode($donor->email)); ?>"> |
|
386 | 386 | <span class="dashicons dashicons-heart"></span> |
387 | 387 | <?php |
388 | 388 | // Completed Donations |
389 | - $completed_donations_text = sprintf( _n( '%d Completed Donation', '%d Completed Donations', $donor->purchase_count, 'give' ), $donor->purchase_count ); |
|
390 | - echo apply_filters( 'give_donor_completed_donations', $completed_donations_text, $donor ); |
|
389 | + $completed_donations_text = sprintf(_n('%d Completed Donation', '%d Completed Donations', $donor->purchase_count, 'give'), $donor->purchase_count); |
|
390 | + echo apply_filters('give_donor_completed_donations', $completed_donations_text, $donor); |
|
391 | 391 | ?> |
392 | 392 | </a> |
393 | 393 | </li> |
394 | 394 | <li> |
395 | 395 | <span class="dashicons dashicons-chart-area"></span> |
396 | - <?php echo give_currency_filter( give_format_amount( $donor->purchase_value ) ); ?> <?php esc_html_e( 'Lifetime Donations', 'give' ); ?> |
|
396 | + <?php echo give_currency_filter(give_format_amount($donor->purchase_value)); ?> <?php esc_html_e('Lifetime Donations', 'give'); ?> |
|
397 | 397 | </li> |
398 | 398 | <?php |
399 | 399 | /** |
@@ -405,7 +405,7 @@ discard block |
||
405 | 405 | * |
406 | 406 | * @param object $donor The donor object being displayed. |
407 | 407 | */ |
408 | - do_action( 'give_donor_stats_list', $donor ); |
|
408 | + do_action('give_donor_stats_list', $donor); |
|
409 | 409 | ?> |
410 | 410 | </ul> |
411 | 411 | </div> |
@@ -418,7 +418,7 @@ discard block |
||
418 | 418 | * |
419 | 419 | * @param object $donor The donor object being displayed. |
420 | 420 | */ |
421 | - do_action( 'give_donor_before_tables_wrapper', $donor ); |
|
421 | + do_action('give_donor_before_tables_wrapper', $donor); |
|
422 | 422 | ?> |
423 | 423 | |
424 | 424 | <div id="donor-tables-wrapper" class="donor-section"> |
@@ -431,46 +431,46 @@ discard block |
||
431 | 431 | * |
432 | 432 | * @param object $donor The donor object being displayed. |
433 | 433 | */ |
434 | - do_action( 'give_donor_before_tables', $donor ); |
|
434 | + do_action('give_donor_before_tables', $donor); |
|
435 | 435 | ?> |
436 | 436 | |
437 | - <h3><?php _e( 'Donor Emails', 'give' ); ?></h3> |
|
437 | + <h3><?php _e('Donor Emails', 'give'); ?></h3> |
|
438 | 438 | |
439 | 439 | <table class="wp-list-table widefat striped emails"> |
440 | 440 | <thead> |
441 | 441 | <tr> |
442 | - <th><?php _e( 'Email', 'give' ); ?></th> |
|
443 | - <th><?php _e( 'Actions', 'give' ); ?></th> |
|
442 | + <th><?php _e('Email', 'give'); ?></th> |
|
443 | + <th><?php _e('Actions', 'give'); ?></th> |
|
444 | 444 | </tr> |
445 | 445 | </thead> |
446 | 446 | |
447 | 447 | <tbody> |
448 | - <?php if ( ! empty( $donor->emails ) ) { ?> |
|
448 | + <?php if ( ! empty($donor->emails)) { ?> |
|
449 | 449 | |
450 | - <?php foreach ( $donor->emails as $key => $email ) : ?> |
|
450 | + <?php foreach ($donor->emails as $key => $email) : ?> |
|
451 | 451 | <tr data-key="<?php echo $key; ?>"> |
452 | 452 | <td> |
453 | 453 | <?php echo $email; ?> |
454 | - <?php if ( 'primary' === $key ) : ?> |
|
454 | + <?php if ('primary' === $key) : ?> |
|
455 | 455 | <span class="dashicons dashicons-star-filled primary-email-icon"></span> |
456 | 456 | <?php endif; ?> |
457 | 457 | </td> |
458 | 458 | <td> |
459 | - <?php if ( 'primary' !== $key ) : ?> |
|
459 | + <?php if ('primary' !== $key) : ?> |
|
460 | 460 | <?php |
461 | - $base_url = admin_url( 'edit.php?post_type=give_forms&page=give-donors&view=overview&id=' . $donor->id ); |
|
462 | - $promote_url = wp_nonce_url( add_query_arg( array( |
|
463 | - 'email' => rawurlencode( $email ), |
|
461 | + $base_url = admin_url('edit.php?post_type=give_forms&page=give-donors&view=overview&id='.$donor->id); |
|
462 | + $promote_url = wp_nonce_url(add_query_arg(array( |
|
463 | + 'email' => rawurlencode($email), |
|
464 | 464 | 'give_action' => 'set_donor_primary_email', |
465 | - ), $base_url ), 'give-set-donor-primary-email' ); |
|
466 | - $remove_url = wp_nonce_url( add_query_arg( array( |
|
467 | - 'email' => rawurlencode( $email ), |
|
465 | + ), $base_url), 'give-set-donor-primary-email'); |
|
466 | + $remove_url = wp_nonce_url(add_query_arg(array( |
|
467 | + 'email' => rawurlencode($email), |
|
468 | 468 | 'give_action' => 'remove_donor_email', |
469 | - ), $base_url ), 'give-remove-donor-email' ); |
|
469 | + ), $base_url), 'give-remove-donor-email'); |
|
470 | 470 | ?> |
471 | - <a href="<?php echo $promote_url; ?>"><?php _e( 'Make Primary', 'give' ); ?></a> |
|
471 | + <a href="<?php echo $promote_url; ?>"><?php _e('Make Primary', 'give'); ?></a> |
|
472 | 472 | | |
473 | - <a href="<?php echo $remove_url; ?>" class="delete"><?php _e( 'Remove', 'give' ); ?></a> |
|
473 | + <a href="<?php echo $remove_url; ?>" class="delete"><?php _e('Remove', 'give'); ?></a> |
|
474 | 474 | <?php endif; ?> |
475 | 475 | </td> |
476 | 476 | </tr> |
@@ -480,59 +480,59 @@ discard block |
||
480 | 480 | <td colspan="2" class="add-donor-email-td"> |
481 | 481 | <div class="add-donor-email-wrapper"> |
482 | 482 | <input type="hidden" name="donor-id" value="<?php echo $donor->id; ?>" /> |
483 | - <?php wp_nonce_field( 'give_add_donor_email', 'add_email_nonce', false, true ); ?> |
|
484 | - <input type="email" name="additional-email" value="" placeholder="<?php _e( 'Email Address', 'give' ); ?>" /> |
|
485 | - <input type="checkbox" name="make-additional-primary" value="1" id="make-additional-primary" /> <label for="make-additional-primary"><?php _e( 'Make Primary', 'give' ); ?></label> |
|
486 | - <button class="button-secondary give-add-donor-email" id="add-donor-email"><?php _e( 'Add Email', 'give' ); ?></button> |
|
483 | + <?php wp_nonce_field('give_add_donor_email', 'add_email_nonce', false, true); ?> |
|
484 | + <input type="email" name="additional-email" value="" placeholder="<?php _e('Email Address', 'give'); ?>" /> |
|
485 | + <input type="checkbox" name="make-additional-primary" value="1" id="make-additional-primary" /> <label for="make-additional-primary"><?php _e('Make Primary', 'give'); ?></label> |
|
486 | + <button class="button-secondary give-add-donor-email" id="add-donor-email"><?php _e('Add Email', 'give'); ?></button> |
|
487 | 487 | <span class="spinner"></span> |
488 | 488 | </div> |
489 | 489 | <div class="notice-wrap"></div> |
490 | 490 | </td> |
491 | 491 | </tr> |
492 | 492 | <?php } else { ?> |
493 | - <tr><td colspan="2"><?php _e( 'No Emails Found', 'give' ); ?></td></tr> |
|
493 | + <tr><td colspan="2"><?php _e('No Emails Found', 'give'); ?></td></tr> |
|
494 | 494 | <?php }// End if(). |
495 | 495 | ?> |
496 | 496 | </tbody> |
497 | 497 | </table> |
498 | 498 | |
499 | - <h3><?php esc_html_e( 'Recent Donations', 'give' ); ?></h3> |
|
499 | + <h3><?php esc_html_e('Recent Donations', 'give'); ?></h3> |
|
500 | 500 | <?php |
501 | - $payment_ids = explode( ',', $donor->payment_ids ); |
|
502 | - $payments = give_get_payments( array( |
|
501 | + $payment_ids = explode(',', $donor->payment_ids); |
|
502 | + $payments = give_get_payments(array( |
|
503 | 503 | 'post__in' => $payment_ids, |
504 | - ) ); |
|
505 | - $payments = array_slice( $payments, 0, 10 ); |
|
504 | + )); |
|
505 | + $payments = array_slice($payments, 0, 10); |
|
506 | 506 | ?> |
507 | 507 | <table class="wp-list-table widefat striped payments"> |
508 | 508 | <thead> |
509 | 509 | <tr> |
510 | - <th scope="col"><?php esc_html_e( 'ID', 'give' ); ?></th> |
|
511 | - <th scope="col"><?php esc_html_e( 'Amount', 'give' ); ?></th> |
|
512 | - <th scope="col"><?php esc_html_e( 'Date', 'give' ); ?></th> |
|
513 | - <th scope="col"><?php esc_html_e( 'Status', 'give' ); ?></th> |
|
514 | - <th scope="col"><?php esc_html_e( 'Actions', 'give' ); ?></th> |
|
510 | + <th scope="col"><?php esc_html_e('ID', 'give'); ?></th> |
|
511 | + <th scope="col"><?php esc_html_e('Amount', 'give'); ?></th> |
|
512 | + <th scope="col"><?php esc_html_e('Date', 'give'); ?></th> |
|
513 | + <th scope="col"><?php esc_html_e('Status', 'give'); ?></th> |
|
514 | + <th scope="col"><?php esc_html_e('Actions', 'give'); ?></th> |
|
515 | 515 | </tr> |
516 | 516 | </thead> |
517 | 517 | <tbody> |
518 | - <?php if ( ! empty( $payments ) ) { ?> |
|
519 | - <?php foreach ( $payments as $payment ) : ?> |
|
518 | + <?php if ( ! empty($payments)) { ?> |
|
519 | + <?php foreach ($payments as $payment) : ?> |
|
520 | 520 | <tr> |
521 | 521 | <td><?php echo $payment->ID; ?></td> |
522 | - <td><?php echo give_payment_amount( $payment->ID ); ?></td> |
|
523 | - <td><?php echo date_i18n( give_date_format(), strtotime( $payment->post_date ) ); ?></td> |
|
524 | - <td><?php echo give_get_payment_status( $payment, true ); ?></td> |
|
522 | + <td><?php echo give_payment_amount($payment->ID); ?></td> |
|
523 | + <td><?php echo date_i18n(give_date_format(), strtotime($payment->post_date)); ?></td> |
|
524 | + <td><?php echo give_get_payment_status($payment, true); ?></td> |
|
525 | 525 | <td> |
526 | 526 | <?php |
527 | 527 | printf( |
528 | 528 | '<a href="%1$s" aria-label="%2$s">%3$s</a>', |
529 | - admin_url( 'edit.php?post_type=give_forms&page=give-payment-history&view=view-payment-details&id=' . $payment->ID ), |
|
529 | + admin_url('edit.php?post_type=give_forms&page=give-payment-history&view=view-payment-details&id='.$payment->ID), |
|
530 | 530 | sprintf( |
531 | 531 | /* translators: %s: Donation ID */ |
532 | - esc_attr__( 'View Donation %s.', 'give' ), |
|
532 | + esc_attr__('View Donation %s.', 'give'), |
|
533 | 533 | $payment->ID |
534 | 534 | ), |
535 | - esc_html__( 'View Donation', 'give' ) |
|
535 | + esc_html__('View Donation', 'give') |
|
536 | 536 | ); |
537 | 537 | ?> |
538 | 538 | |
@@ -547,47 +547,47 @@ discard block |
||
547 | 547 | * @param object $donor The donor object being displayed. |
548 | 548 | * @param object $payment The payment object being displayed. |
549 | 549 | */ |
550 | - do_action( 'give_donor_recent_purchases_actions', $donor, $payment ); |
|
550 | + do_action('give_donor_recent_purchases_actions', $donor, $payment); |
|
551 | 551 | ?> |
552 | 552 | </td> |
553 | 553 | </tr> |
554 | 554 | <?php endforeach; ?> |
555 | 555 | <?php } else { ?> |
556 | 556 | <tr> |
557 | - <td colspan="5"><?php esc_html_e( 'No donations found.', 'give' ); ?></td> |
|
557 | + <td colspan="5"><?php esc_html_e('No donations found.', 'give'); ?></td> |
|
558 | 558 | </tr> |
559 | 559 | <?php }// End if(). |
560 | 560 | ?> |
561 | 561 | </tbody> |
562 | 562 | </table> |
563 | 563 | |
564 | - <h3><?php esc_html_e( 'Completed Forms', 'give' ); ?></h3> |
|
564 | + <h3><?php esc_html_e('Completed Forms', 'give'); ?></h3> |
|
565 | 565 | <?php |
566 | - $donations = give_get_users_completed_donations( $donor->email ); |
|
566 | + $donations = give_get_users_completed_donations($donor->email); |
|
567 | 567 | ?> |
568 | 568 | <table class="wp-list-table widefat striped donations"> |
569 | 569 | <thead> |
570 | 570 | <tr> |
571 | - <th scope="col"><?php esc_html_e( 'Form', 'give' ); ?></th> |
|
572 | - <th scope="col" width="120px"><?php esc_html_e( 'Actions', 'give' ); ?></th> |
|
571 | + <th scope="col"><?php esc_html_e('Form', 'give'); ?></th> |
|
572 | + <th scope="col" width="120px"><?php esc_html_e('Actions', 'give'); ?></th> |
|
573 | 573 | </tr> |
574 | 574 | </thead> |
575 | 575 | <tbody> |
576 | - <?php if ( ! empty( $donations ) ) { ?> |
|
577 | - <?php foreach ( $donations as $donation ) : ?> |
|
576 | + <?php if ( ! empty($donations)) { ?> |
|
577 | + <?php foreach ($donations as $donation) : ?> |
|
578 | 578 | <tr> |
579 | 579 | <td><?php echo $donation->post_title; ?></td> |
580 | 580 | <td> |
581 | 581 | <?php |
582 | 582 | printf( |
583 | 583 | '<a href="%1$s" aria-label="%2$s">%3$s</a>', |
584 | - esc_url( admin_url( 'post.php?action=edit&post=' . $donation->ID ) ), |
|
584 | + esc_url(admin_url('post.php?action=edit&post='.$donation->ID)), |
|
585 | 585 | sprintf( |
586 | 586 | /* translators: %s: form name */ |
587 | - esc_attr__( 'View Form %s.', 'give' ), |
|
587 | + esc_attr__('View Form %s.', 'give'), |
|
588 | 588 | $donation->post_title |
589 | 589 | ), |
590 | - esc_html__( 'View Form', 'give' ) |
|
590 | + esc_html__('View Form', 'give') |
|
591 | 591 | ); |
592 | 592 | ?> |
593 | 593 | </td> |
@@ -595,7 +595,7 @@ discard block |
||
595 | 595 | <?php endforeach; ?> |
596 | 596 | <?php } else { ?> |
597 | 597 | <tr> |
598 | - <td colspan="2"><?php esc_html_e( 'No completed donations found.', 'give' ); ?></td> |
|
598 | + <td colspan="2"><?php esc_html_e('No completed donations found.', 'give'); ?></td> |
|
599 | 599 | </tr> |
600 | 600 | <?php } ?> |
601 | 601 | </tbody> |
@@ -609,7 +609,7 @@ discard block |
||
609 | 609 | * |
610 | 610 | * @param object $donor The donor object being displayed. |
611 | 611 | */ |
612 | - do_action( 'give_donor_after_tables', $donor ); |
|
612 | + do_action('give_donor_after_tables', $donor); |
|
613 | 613 | ?> |
614 | 614 | |
615 | 615 | </div> |
@@ -622,7 +622,7 @@ discard block |
||
622 | 622 | * |
623 | 623 | * @param object $donor The donor object being displayed. |
624 | 624 | */ |
625 | - do_action( 'give_donor_card_bottom', $donor ); |
|
625 | + do_action('give_donor_card_bottom', $donor); |
|
626 | 626 | |
627 | 627 | } |
628 | 628 | |
@@ -635,30 +635,30 @@ discard block |
||
635 | 635 | * |
636 | 636 | * @return void |
637 | 637 | */ |
638 | -function give_donor_notes_view( $donor ) { |
|
638 | +function give_donor_notes_view($donor) { |
|
639 | 639 | |
640 | - $paged = isset( $_GET['paged'] ) && is_numeric( $_GET['paged'] ) ? $_GET['paged'] : 1; |
|
641 | - $paged = absint( $paged ); |
|
640 | + $paged = isset($_GET['paged']) && is_numeric($_GET['paged']) ? $_GET['paged'] : 1; |
|
641 | + $paged = absint($paged); |
|
642 | 642 | $note_count = $donor->get_notes_count(); |
643 | - $per_page = apply_filters( 'give_donor_notes_per_page', 20 ); |
|
644 | - $total_pages = ceil( $note_count / $per_page ); |
|
645 | - $donor_notes = $donor->get_notes( $per_page, $paged ); |
|
643 | + $per_page = apply_filters('give_donor_notes_per_page', 20); |
|
644 | + $total_pages = ceil($note_count / $per_page); |
|
645 | + $donor_notes = $donor->get_notes($per_page, $paged); |
|
646 | 646 | ?> |
647 | 647 | |
648 | 648 | <div id="donor-notes-wrapper"> |
649 | 649 | <div class="donor-notes-header"> |
650 | - <?php echo get_avatar( $donor->email, 30 ); ?> <span><?php echo $donor->name; ?></span> |
|
650 | + <?php echo get_avatar($donor->email, 30); ?> <span><?php echo $donor->name; ?></span> |
|
651 | 651 | </div> |
652 | - <h3><?php esc_html_e( 'Notes', 'give' ); ?></h3> |
|
652 | + <h3><?php esc_html_e('Notes', 'give'); ?></h3> |
|
653 | 653 | |
654 | - <?php if ( 1 == $paged ) : ?> |
|
654 | + <?php if (1 == $paged) : ?> |
|
655 | 655 | <div style="display: block; margin-bottom: 55px;"> |
656 | - <form id="give-add-donor-note" method="post" action="<?php echo admin_url( 'edit.php?post_type=give_forms&page=give-donors&view=notes&id=' . $donor->id ); ?>"> |
|
656 | + <form id="give-add-donor-note" method="post" action="<?php echo admin_url('edit.php?post_type=give_forms&page=give-donors&view=notes&id='.$donor->id); ?>"> |
|
657 | 657 | <textarea id="donor-note" name="donor_note" class="donor-note-input" rows="10"></textarea> |
658 | 658 | <br /> |
659 | 659 | <input type="hidden" id="donor-id" name="customer_id" value="<?php echo $donor->id; ?>" /> |
660 | 660 | <input type="hidden" name="give_action" value="add-donor-note" /> |
661 | - <?php wp_nonce_field( 'add-donor-note', 'add_donor_note_nonce', true, true ); ?> |
|
661 | + <?php wp_nonce_field('add-donor-note', 'add_donor_note_nonce', true, true); ?> |
|
662 | 662 | <input id="add-donor-note" class="right button-primary" type="submit" value="Add Note" /> |
663 | 663 | </form> |
664 | 664 | </div> |
@@ -673,26 +673,26 @@ discard block |
||
673 | 673 | 'show_all' => true, |
674 | 674 | ); |
675 | 675 | |
676 | - echo paginate_links( $pagination_args ); |
|
676 | + echo paginate_links($pagination_args); |
|
677 | 677 | ?> |
678 | 678 | |
679 | 679 | <div id="give-donor-notes" class="postbox"> |
680 | - <?php if ( count( $donor_notes ) > 0 ) { ?> |
|
681 | - <?php foreach ( $donor_notes as $key => $note ) : ?> |
|
680 | + <?php if (count($donor_notes) > 0) { ?> |
|
681 | + <?php foreach ($donor_notes as $key => $note) : ?> |
|
682 | 682 | <div class="donor-note-wrapper dashboard-comment-wrap comment-item"> |
683 | 683 | <span class="note-content-wrap"> |
684 | - <?php echo stripslashes( $note ); ?> |
|
684 | + <?php echo stripslashes($note); ?> |
|
685 | 685 | </span> |
686 | 686 | </div> |
687 | 687 | <?php endforeach; ?> |
688 | 688 | <?php } else { ?> |
689 | 689 | <div class="give-no-donor-notes"> |
690 | - <?php esc_html_e( 'No donor notes found.', 'give' ); ?> |
|
690 | + <?php esc_html_e('No donor notes found.', 'give'); ?> |
|
691 | 691 | </div> |
692 | 692 | <?php } ?> |
693 | 693 | </div> |
694 | 694 | |
695 | - <?php echo paginate_links( $pagination_args ); ?> |
|
695 | + <?php echo paginate_links($pagination_args); ?> |
|
696 | 696 | |
697 | 697 | </div> |
698 | 698 | |
@@ -708,9 +708,9 @@ discard block |
||
708 | 708 | * |
709 | 709 | * @return void |
710 | 710 | */ |
711 | -function give_donor_delete_view( $donor ) { |
|
711 | +function give_donor_delete_view($donor) { |
|
712 | 712 | |
713 | - $donor_edit_role = apply_filters( 'give_edit_donors_role', 'edit_give_payments' ); |
|
713 | + $donor_edit_role = apply_filters('give_edit_donors_role', 'edit_give_payments'); |
|
714 | 714 | |
715 | 715 | /** |
716 | 716 | * Fires in donor delete screen, above the content. |
@@ -719,15 +719,15 @@ discard block |
||
719 | 719 | * |
720 | 720 | * @param object $donor The donor object being displayed. |
721 | 721 | */ |
722 | - do_action( 'give_donor_delete_top', $donor ); |
|
722 | + do_action('give_donor_delete_top', $donor); |
|
723 | 723 | ?> |
724 | 724 | |
725 | 725 | <div class="info-wrapper donor-section"> |
726 | 726 | |
727 | - <form id="delete-donor" method="post" action="<?php echo admin_url( 'edit.php?post_type=give_forms&page=give-donors&view=delete&id=' . $donor->id ); ?>"> |
|
727 | + <form id="delete-donor" method="post" action="<?php echo admin_url('edit.php?post_type=give_forms&page=give-donors&view=delete&id='.$donor->id); ?>"> |
|
728 | 728 | |
729 | 729 | <div class="donor-notes-header"> |
730 | - <?php echo get_avatar( $donor->email, 30 ); ?> <span><?php echo $donor->name; ?></span> |
|
730 | + <?php echo get_avatar($donor->email, 30); ?> <span><?php echo $donor->name; ?></span> |
|
731 | 731 | </div> |
732 | 732 | |
733 | 733 | |
@@ -735,20 +735,20 @@ discard block |
||
735 | 735 | |
736 | 736 | <span class="delete-donor-options"> |
737 | 737 | <p> |
738 | - <?php echo Give()->html->checkbox( array( |
|
738 | + <?php echo Give()->html->checkbox(array( |
|
739 | 739 | 'name' => 'give-donor-delete-confirm', |
740 | - ) ); ?> |
|
741 | - <label for="give-donor-delete-confirm"><?php esc_html_e( 'Are you sure you want to delete this donor?', 'give' ); ?></label> |
|
740 | + )); ?> |
|
741 | + <label for="give-donor-delete-confirm"><?php esc_html_e('Are you sure you want to delete this donor?', 'give'); ?></label> |
|
742 | 742 | </p> |
743 | 743 | |
744 | 744 | <p> |
745 | - <?php echo Give()->html->checkbox( array( |
|
745 | + <?php echo Give()->html->checkbox(array( |
|
746 | 746 | 'name' => 'give-donor-delete-records', |
747 | 747 | 'options' => array( |
748 | 748 | 'disabled' => true, |
749 | 749 | ), |
750 | - ) ); ?> |
|
751 | - <label for="give-donor-delete-records"><?php esc_html_e( 'Delete all associated donations and records?', 'give' ); ?></label> |
|
750 | + )); ?> |
|
751 | + <label for="give-donor-delete-records"><?php esc_html_e('Delete all associated donations and records?', 'give'); ?></label> |
|
752 | 752 | </p> |
753 | 753 | |
754 | 754 | <?php |
@@ -761,16 +761,16 @@ discard block |
||
761 | 761 | * |
762 | 762 | * @param object $donor The donor object being displayed. |
763 | 763 | */ |
764 | - do_action( 'give_donor_delete_inputs', $donor ); |
|
764 | + do_action('give_donor_delete_inputs', $donor); |
|
765 | 765 | ?> |
766 | 766 | </span> |
767 | 767 | |
768 | 768 | <span id="donor-edit-actions"> |
769 | 769 | <input type="hidden" name="customer_id" value="<?php echo $donor->id; ?>" /> |
770 | - <?php wp_nonce_field( 'delete-donor', '_wpnonce', false, true ); ?> |
|
770 | + <?php wp_nonce_field('delete-donor', '_wpnonce', false, true); ?> |
|
771 | 771 | <input type="hidden" name="give_action" value="delete-donor" /> |
772 | - <input type="submit" disabled="disabled" id="give-delete-donor" class="button-primary" value="<?php esc_attr_e( 'Delete Donor', 'give' ); ?>" /> |
|
773 | - <a id="give-delete-donor-cancel" href="<?php echo admin_url( 'edit.php?post_type=give_forms&page=give-donors&view=overview&id=' . $donor->id ); ?>" class="delete"><?php esc_html_e( 'Cancel', 'give' ); ?></a> |
|
772 | + <input type="submit" disabled="disabled" id="give-delete-donor" class="button-primary" value="<?php esc_attr_e('Delete Donor', 'give'); ?>" /> |
|
773 | + <a id="give-delete-donor-cancel" href="<?php echo admin_url('edit.php?post_type=give_forms&page=give-donors&view=overview&id='.$donor->id); ?>" class="delete"><?php esc_html_e('Cancel', 'give'); ?></a> |
|
774 | 774 | </span> |
775 | 775 | |
776 | 776 | </div> |
@@ -786,5 +786,5 @@ discard block |
||
786 | 786 | * |
787 | 787 | * @param object $donor The donor object being displayed. |
788 | 788 | */ |
789 | - do_action( 'give_donor_delete_bottom', $donor ); |
|
789 | + do_action('give_donor_delete_bottom', $donor); |
|
790 | 790 | } |
@@ -10,7 +10,7 @@ discard block |
||
10 | 10 | */ |
11 | 11 | |
12 | 12 | // Exit if accessed directly. |
13 | -if ( ! defined( 'ABSPATH' ) ) { |
|
13 | +if ( ! defined('ABSPATH')) { |
|
14 | 14 | exit; |
15 | 15 | } |
16 | 16 | |
@@ -23,7 +23,7 @@ discard block |
||
23 | 23 | * |
24 | 24 | * @return array The altered list of views. |
25 | 25 | */ |
26 | -function give_register_default_donor_views( $views ) { |
|
26 | +function give_register_default_donor_views($views) { |
|
27 | 27 | |
28 | 28 | $default_views = array( |
29 | 29 | 'overview' => 'give_donor_view', |
@@ -31,11 +31,11 @@ discard block |
||
31 | 31 | 'notes' => 'give_donor_notes_view', |
32 | 32 | ); |
33 | 33 | |
34 | - return array_merge( $views, $default_views ); |
|
34 | + return array_merge($views, $default_views); |
|
35 | 35 | |
36 | 36 | } |
37 | 37 | |
38 | -add_filter( 'give_donor_views', 'give_register_default_donor_views', 1, 1 ); |
|
38 | +add_filter('give_donor_views', 'give_register_default_donor_views', 1, 1); |
|
39 | 39 | |
40 | 40 | /** |
41 | 41 | * Register a tab for the single donor view. |
@@ -46,23 +46,23 @@ discard block |
||
46 | 46 | * |
47 | 47 | * @return array The altered list of tabs |
48 | 48 | */ |
49 | -function give_register_default_donor_tabs( $tabs ) { |
|
49 | +function give_register_default_donor_tabs($tabs) { |
|
50 | 50 | |
51 | 51 | $default_tabs = array( |
52 | 52 | 'overview' => array( |
53 | 53 | 'dashicon' => 'dashicons-admin-users', |
54 | - 'title' => __( 'Donor Profile', 'give' ), |
|
54 | + 'title' => __('Donor Profile', 'give'), |
|
55 | 55 | ), |
56 | 56 | 'notes' => array( |
57 | 57 | 'dashicon' => 'dashicons-admin-comments', |
58 | - 'title' => __( 'Donor Notes', 'give' ), |
|
58 | + 'title' => __('Donor Notes', 'give'), |
|
59 | 59 | ), |
60 | 60 | ); |
61 | 61 | |
62 | - return array_merge( $tabs, $default_tabs ); |
|
62 | + return array_merge($tabs, $default_tabs); |
|
63 | 63 | } |
64 | 64 | |
65 | -add_filter( 'give_donor_tabs', 'give_register_default_donor_tabs', 1, 1 ); |
|
65 | +add_filter('give_donor_tabs', 'give_register_default_donor_tabs', 1, 1); |
|
66 | 66 | |
67 | 67 | /** |
68 | 68 | * Register the Delete icon as late as possible so it's at the bottom. |
@@ -73,14 +73,14 @@ discard block |
||
73 | 73 | * |
74 | 74 | * @return array The altered list of tabs, with 'delete' at the bottom. |
75 | 75 | */ |
76 | -function give_register_delete_donor_tab( $tabs ) { |
|
76 | +function give_register_delete_donor_tab($tabs) { |
|
77 | 77 | |
78 | 78 | $tabs['delete'] = array( |
79 | 79 | 'dashicon' => 'dashicons-trash', |
80 | - 'title' => esc_html__( 'Delete Donor', 'give' ), |
|
80 | + 'title' => esc_html__('Delete Donor', 'give'), |
|
81 | 81 | ); |
82 | 82 | |
83 | 83 | return $tabs; |
84 | 84 | } |
85 | 85 | |
86 | -add_filter( 'give_donor_tabs', 'give_register_delete_donor_tab', PHP_INT_MAX, 1 ); |
|
86 | +add_filter('give_donor_tabs', 'give_register_delete_donor_tab', PHP_INT_MAX, 1); |
@@ -12,7 +12,7 @@ discard block |
||
12 | 12 | */ |
13 | 13 | |
14 | 14 | // Exit if accessed directly. |
15 | -if ( ! defined( 'ABSPATH' ) ) { |
|
15 | +if ( ! defined('ABSPATH')) { |
|
16 | 16 | exit; |
17 | 17 | } |
18 | 18 | |
@@ -25,48 +25,48 @@ discard block |
||
25 | 25 | */ |
26 | 26 | function give_do_automatic_upgrades() { |
27 | 27 | $did_upgrade = false; |
28 | - $give_version = preg_replace( '/[^0-9.].*/', '', get_option( 'give_version' ) ); |
|
28 | + $give_version = preg_replace('/[^0-9.].*/', '', get_option('give_version')); |
|
29 | 29 | |
30 | - if ( ! $give_version ) { |
|
30 | + if ( ! $give_version) { |
|
31 | 31 | // 1.0 is the first version to use this option so we must add it. |
32 | 32 | $give_version = '1.0'; |
33 | 33 | } |
34 | 34 | |
35 | - switch ( true ) { |
|
35 | + switch (true) { |
|
36 | 36 | |
37 | - case version_compare( $give_version, '1.6', '<' ) : |
|
37 | + case version_compare($give_version, '1.6', '<') : |
|
38 | 38 | give_v16_upgrades(); |
39 | 39 | $did_upgrade = true; |
40 | 40 | |
41 | - case version_compare( $give_version, '1.7', '<' ) : |
|
41 | + case version_compare($give_version, '1.7', '<') : |
|
42 | 42 | give_v17_upgrades(); |
43 | 43 | $did_upgrade = true; |
44 | 44 | |
45 | - case version_compare( $give_version, '1.8', '<' ) : |
|
45 | + case version_compare($give_version, '1.8', '<') : |
|
46 | 46 | give_v18_upgrades(); |
47 | 47 | $did_upgrade = true; |
48 | 48 | |
49 | - case version_compare( $give_version, '1.8.7', '<' ) : |
|
49 | + case version_compare($give_version, '1.8.7', '<') : |
|
50 | 50 | give_v187_upgrades(); |
51 | 51 | $did_upgrade = true; |
52 | 52 | |
53 | - case version_compare( $give_version, '1.8.8', '<' ) : |
|
53 | + case version_compare($give_version, '1.8.8', '<') : |
|
54 | 54 | give_v188_upgrades(); |
55 | 55 | $did_upgrade = true; |
56 | 56 | |
57 | - case version_compare( $give_version, '1.8.9', '<' ) : |
|
57 | + case version_compare($give_version, '1.8.9', '<') : |
|
58 | 58 | give_v189_upgrades(); |
59 | 59 | $did_upgrade = true; |
60 | 60 | |
61 | 61 | } |
62 | 62 | |
63 | - if ( $did_upgrade ) { |
|
64 | - update_option( 'give_version', preg_replace( '/[^0-9.].*/', '', GIVE_VERSION ) ); |
|
63 | + if ($did_upgrade) { |
|
64 | + update_option('give_version', preg_replace('/[^0-9.].*/', '', GIVE_VERSION)); |
|
65 | 65 | } |
66 | 66 | } |
67 | 67 | |
68 | -add_action( 'admin_init', 'give_do_automatic_upgrades' ); |
|
69 | -add_action( 'give_upgrades', 'give_do_automatic_upgrades' ); |
|
68 | +add_action('admin_init', 'give_do_automatic_upgrades'); |
|
69 | +add_action('give_upgrades', 'give_do_automatic_upgrades'); |
|
70 | 70 | |
71 | 71 | /** |
72 | 72 | * Display Upgrade Notices |
@@ -76,18 +76,18 @@ discard block |
||
76 | 76 | */ |
77 | 77 | function give_show_upgrade_notices() { |
78 | 78 | // Don't show notices on the upgrades page. |
79 | - if ( isset( $_GET['page'] ) && $_GET['page'] == 'give-upgrades' ) { |
|
79 | + if (isset($_GET['page']) && $_GET['page'] == 'give-upgrades') { |
|
80 | 80 | return; |
81 | 81 | } |
82 | 82 | |
83 | - $give_version = get_option( 'give_version' ); |
|
83 | + $give_version = get_option('give_version'); |
|
84 | 84 | |
85 | - if ( ! $give_version ) { |
|
85 | + if ( ! $give_version) { |
|
86 | 86 | // 1.0 is the first version to use this option so we must add it. |
87 | 87 | $give_version = '1.0'; |
88 | 88 | } |
89 | 89 | |
90 | - $give_version = preg_replace( '/[^0-9.].*/', '', $give_version ); |
|
90 | + $give_version = preg_replace('/[^0-9.].*/', '', $give_version); |
|
91 | 91 | |
92 | 92 | /* |
93 | 93 | * NOTICE: |
@@ -100,64 +100,64 @@ discard block |
||
100 | 100 | // Resume updates. |
101 | 101 | // Check if we have a stalled upgrade. |
102 | 102 | $resume_upgrade = give_maybe_resume_upgrade(); |
103 | - if ( ! empty( $resume_upgrade ) ) { |
|
104 | - $resume_url = add_query_arg( give_maybe_resume_upgrade(), admin_url( 'index.php' ) ); |
|
103 | + if ( ! empty($resume_upgrade)) { |
|
104 | + $resume_url = add_query_arg(give_maybe_resume_upgrade(), admin_url('index.php')); |
|
105 | 105 | |
106 | - Give()->notices->register_notice( array( |
|
106 | + Give()->notices->register_notice(array( |
|
107 | 107 | 'id' => 'give-resume-updates', |
108 | 108 | 'type' => 'warning', |
109 | 109 | 'description' => sprintf( |
110 | - __( 'Give needs to complete a database upgrade that was previously started, click <a href="%s">here</a> to resume the upgrade.', 'give' ), |
|
111 | - esc_url( $resume_url ) |
|
110 | + __('Give needs to complete a database upgrade that was previously started, click <a href="%s">here</a> to resume the upgrade.', 'give'), |
|
111 | + esc_url($resume_url) |
|
112 | 112 | ), |
113 | - ) ); |
|
113 | + )); |
|
114 | 114 | |
115 | 115 | return; |
116 | 116 | } |
117 | 117 | |
118 | 118 | // v1.3.2 Upgrades |
119 | - Give()->notices->register_notice( array( |
|
119 | + Give()->notices->register_notice(array( |
|
120 | 120 | 'id' => 'give-version-1-3-2-updates', |
121 | 121 | 'type' => 'warning', |
122 | 122 | 'description' => sprintf( |
123 | - '<p>' . __( 'Give 1.3.2 needs to upgrade the donor database, click <a href="%s">here</a> to start the upgrade.', 'give' ) . '</p>', |
|
124 | - esc_url( admin_url( 'index.php?page=give-upgrades&give-upgrade=upgrade_give_payment_customer_id' ) ) |
|
123 | + '<p>'.__('Give 1.3.2 needs to upgrade the donor database, click <a href="%s">here</a> to start the upgrade.', 'give').'</p>', |
|
124 | + esc_url(admin_url('index.php?page=give-upgrades&give-upgrade=upgrade_give_payment_customer_id')) |
|
125 | 125 | ), |
126 | - 'show' => ( version_compare( $give_version, '1.3.2', '<' ) || ! give_has_upgrade_completed( 'upgrade_give_payment_customer_id' ) ), |
|
127 | - ) ); |
|
126 | + 'show' => (version_compare($give_version, '1.3.2', '<') || ! give_has_upgrade_completed('upgrade_give_payment_customer_id')), |
|
127 | + )); |
|
128 | 128 | |
129 | 129 | // v1.3.4 Upgrades //ensure the user has gone through 1.3.4. |
130 | - Give()->notices->register_notice( array( |
|
130 | + Give()->notices->register_notice(array( |
|
131 | 131 | 'id' => 'give-version-1-3-4-updates', |
132 | 132 | 'type' => 'warning', |
133 | 133 | 'description' => sprintf( |
134 | - '<p>' . __( 'Give 1.3.4 needs to upgrade the donations database, click <a href="%s">here</a> to start the upgrade.', 'give' ) . '</p>', |
|
135 | - esc_url( admin_url( 'index.php?page=give-upgrades&give-upgrade=upgrade_give_offline_status' ) ) |
|
134 | + '<p>'.__('Give 1.3.4 needs to upgrade the donations database, click <a href="%s">here</a> to start the upgrade.', 'give').'</p>', |
|
135 | + esc_url(admin_url('index.php?page=give-upgrades&give-upgrade=upgrade_give_offline_status')) |
|
136 | 136 | ), |
137 | - 'show' => ( version_compare( $give_version, '1.3.4', '<' ) || ( ! give_has_upgrade_completed( 'upgrade_give_offline_status' ) && give_has_upgrade_completed( 'upgrade_give_payment_customer_id' ) ) ), |
|
138 | - ) ); |
|
137 | + 'show' => (version_compare($give_version, '1.3.4', '<') || ( ! give_has_upgrade_completed('upgrade_give_offline_status') && give_has_upgrade_completed('upgrade_give_payment_customer_id'))), |
|
138 | + )); |
|
139 | 139 | |
140 | 140 | // v1.8 form metadata upgrades. |
141 | - Give()->notices->register_notice( array( |
|
141 | + Give()->notices->register_notice(array( |
|
142 | 142 | 'id' => 'give-version-1-8-updates', |
143 | 143 | 'type' => 'warning', |
144 | 144 | 'description' => sprintf( |
145 | - __( 'Give 1.8 needs to upgrade the form database, click <a class="give-upgrade-link" href="%s">here</a> to start the upgrade.', 'give' ), |
|
146 | - esc_url( admin_url( 'index.php?page=give-upgrades&give-upgrade=give_v18_upgrades_form_metadata' ) ) |
|
145 | + __('Give 1.8 needs to upgrade the form database, click <a class="give-upgrade-link" href="%s">here</a> to start the upgrade.', 'give'), |
|
146 | + esc_url(admin_url('index.php?page=give-upgrades&give-upgrade=give_v18_upgrades_form_metadata')) |
|
147 | 147 | ), |
148 | - 'show' => ( version_compare( $give_version, '1.8', '<' ) || ! give_has_upgrade_completed( 'v18_upgrades_form_metadata' ) ) |
|
149 | - ) ); |
|
148 | + 'show' => (version_compare($give_version, '1.8', '<') || ! give_has_upgrade_completed('v18_upgrades_form_metadata')) |
|
149 | + )); |
|
150 | 150 | |
151 | 151 | // v1.8.9 Upgrades |
152 | - Give()->notices->register_notice( array( |
|
152 | + Give()->notices->register_notice(array( |
|
153 | 153 | 'id' => 'give-version-1-8-9-updates', |
154 | 154 | 'type' => 'warning', |
155 | 155 | 'description' => sprintf( |
156 | - __( 'Give 1.8.9 needs to update the donation form\'s meta fields within database, click <a href="%s">here</a> to start the upgrade.', 'give' ), |
|
157 | - esc_url( admin_url( 'index.php?page=give-upgrades&give-upgrade=v189_upgrades_levels_post_meta' ) ) |
|
156 | + __('Give 1.8.9 needs to update the donation form\'s meta fields within database, click <a href="%s">here</a> to start the upgrade.', 'give'), |
|
157 | + esc_url(admin_url('index.php?page=give-upgrades&give-upgrade=v189_upgrades_levels_post_meta')) |
|
158 | 158 | ), |
159 | - 'show' => ( version_compare( $give_version, '1.8.9', '<' ) || ( ! give_has_upgrade_completed( 'v189_upgrades_levels_post_meta' ) ) ), |
|
160 | - ) ); |
|
159 | + 'show' => (version_compare($give_version, '1.8.9', '<') || ( ! give_has_upgrade_completed('v189_upgrades_levels_post_meta'))), |
|
160 | + )); |
|
161 | 161 | |
162 | 162 | // End 'Stepped' upgrade process notices. |
163 | 163 | ?> |
@@ -168,7 +168,7 @@ discard block |
||
168 | 168 | $upgrade_links.on('click', function (e) { |
169 | 169 | e.preventDefault(); |
170 | 170 | |
171 | - if (!window.confirm('<?php _e( 'Please make sure to create a database backup before initiating the upgrade.', 'give' ); ?>')) { |
|
171 | + if (!window.confirm('<?php _e('Please make sure to create a database backup before initiating the upgrade.', 'give'); ?>')) { |
|
172 | 172 | return; |
173 | 173 | } |
174 | 174 | |
@@ -181,7 +181,7 @@ discard block |
||
181 | 181 | <?php |
182 | 182 | } |
183 | 183 | |
184 | -add_action( 'admin_notices', 'give_show_upgrade_notices' ); |
|
184 | +add_action('admin_notices', 'give_show_upgrade_notices'); |
|
185 | 185 | |
186 | 186 | /** |
187 | 187 | * Triggers all upgrade functions |
@@ -193,29 +193,29 @@ discard block |
||
193 | 193 | */ |
194 | 194 | function give_trigger_upgrades() { |
195 | 195 | |
196 | - if ( ! current_user_can( 'manage_give_settings' ) ) { |
|
197 | - wp_die( esc_html__( 'You do not have permission to do Give upgrades.', 'give' ), esc_html__( 'Error', 'give' ), array( |
|
196 | + if ( ! current_user_can('manage_give_settings')) { |
|
197 | + wp_die(esc_html__('You do not have permission to do Give upgrades.', 'give'), esc_html__('Error', 'give'), array( |
|
198 | 198 | 'response' => 403, |
199 | - ) ); |
|
199 | + )); |
|
200 | 200 | } |
201 | 201 | |
202 | - $give_version = get_option( 'give_version' ); |
|
202 | + $give_version = get_option('give_version'); |
|
203 | 203 | |
204 | - if ( ! $give_version ) { |
|
204 | + if ( ! $give_version) { |
|
205 | 205 | // 1.0 is the first version to use this option so we must add it. |
206 | 206 | $give_version = '1.0'; |
207 | - add_option( 'give_version', $give_version ); |
|
207 | + add_option('give_version', $give_version); |
|
208 | 208 | } |
209 | 209 | |
210 | - update_option( 'give_version', GIVE_VERSION ); |
|
211 | - delete_option( 'give_doing_upgrade' ); |
|
210 | + update_option('give_version', GIVE_VERSION); |
|
211 | + delete_option('give_doing_upgrade'); |
|
212 | 212 | |
213 | - if ( DOING_AJAX ) { |
|
214 | - die( 'complete' ); |
|
213 | + if (DOING_AJAX) { |
|
214 | + die('complete'); |
|
215 | 215 | } // End if(). |
216 | 216 | } |
217 | 217 | |
218 | -add_action( 'wp_ajax_give_trigger_upgrades', 'give_trigger_upgrades' ); |
|
218 | +add_action('wp_ajax_give_trigger_upgrades', 'give_trigger_upgrades'); |
|
219 | 219 | |
220 | 220 | /** |
221 | 221 | * Check if the upgrade routine has been run for a specific action |
@@ -226,15 +226,15 @@ discard block |
||
226 | 226 | * |
227 | 227 | * @return bool If the action has been added to the completed actions array |
228 | 228 | */ |
229 | -function give_has_upgrade_completed( $upgrade_action = '' ) { |
|
229 | +function give_has_upgrade_completed($upgrade_action = '') { |
|
230 | 230 | |
231 | - if ( empty( $upgrade_action ) ) { |
|
231 | + if (empty($upgrade_action)) { |
|
232 | 232 | return false; |
233 | 233 | } |
234 | 234 | |
235 | 235 | $completed_upgrades = give_get_completed_upgrades(); |
236 | 236 | |
237 | - return in_array( $upgrade_action, $completed_upgrades ); |
|
237 | + return in_array($upgrade_action, $completed_upgrades); |
|
238 | 238 | |
239 | 239 | } |
240 | 240 | |
@@ -246,8 +246,8 @@ discard block |
||
246 | 246 | * @return mixed When nothing to resume returns false, otherwise starts the upgrade where it left off |
247 | 247 | */ |
248 | 248 | function give_maybe_resume_upgrade() { |
249 | - $doing_upgrade = get_option( 'give_doing_upgrade', false ); |
|
250 | - if ( empty( $doing_upgrade ) ) { |
|
249 | + $doing_upgrade = get_option('give_doing_upgrade', false); |
|
250 | + if (empty($doing_upgrade)) { |
|
251 | 251 | return false; |
252 | 252 | } |
253 | 253 | |
@@ -263,9 +263,9 @@ discard block |
||
263 | 263 | * |
264 | 264 | * @return bool If the function was successfully added |
265 | 265 | */ |
266 | -function give_set_upgrade_complete( $upgrade_action = '' ) { |
|
266 | +function give_set_upgrade_complete($upgrade_action = '') { |
|
267 | 267 | |
268 | - if ( empty( $upgrade_action ) ) { |
|
268 | + if (empty($upgrade_action)) { |
|
269 | 269 | return false; |
270 | 270 | } |
271 | 271 | |
@@ -273,9 +273,9 @@ discard block |
||
273 | 273 | $completed_upgrades[] = $upgrade_action; |
274 | 274 | |
275 | 275 | // Remove any blanks, and only show uniques. |
276 | - $completed_upgrades = array_unique( array_values( $completed_upgrades ) ); |
|
276 | + $completed_upgrades = array_unique(array_values($completed_upgrades)); |
|
277 | 277 | |
278 | - return update_option( 'give_completed_upgrades', $completed_upgrades ); |
|
278 | + return update_option('give_completed_upgrades', $completed_upgrades); |
|
279 | 279 | } |
280 | 280 | |
281 | 281 | /** |
@@ -286,9 +286,9 @@ discard block |
||
286 | 286 | */ |
287 | 287 | function give_get_completed_upgrades() { |
288 | 288 | |
289 | - $completed_upgrades = get_option( 'give_completed_upgrades' ); |
|
289 | + $completed_upgrades = get_option('give_completed_upgrades'); |
|
290 | 290 | |
291 | - if ( false === $completed_upgrades ) { |
|
291 | + if (false === $completed_upgrades) { |
|
292 | 292 | $completed_upgrades = array(); |
293 | 293 | } |
294 | 294 | |
@@ -305,31 +305,31 @@ discard block |
||
305 | 305 | */ |
306 | 306 | function give_v132_upgrade_give_payment_customer_id() { |
307 | 307 | global $wpdb; |
308 | - if ( ! current_user_can( 'manage_give_settings' ) ) { |
|
309 | - wp_die( esc_html__( 'You do not have permission to do Give upgrades.', 'give' ), esc_html__( 'Error', 'give' ), array( |
|
308 | + if ( ! current_user_can('manage_give_settings')) { |
|
309 | + wp_die(esc_html__('You do not have permission to do Give upgrades.', 'give'), esc_html__('Error', 'give'), array( |
|
310 | 310 | 'response' => 403, |
311 | - ) ); |
|
311 | + )); |
|
312 | 312 | } |
313 | 313 | |
314 | - ignore_user_abort( true ); |
|
314 | + ignore_user_abort(true); |
|
315 | 315 | |
316 | - if ( ! give_is_func_disabled( 'set_time_limit' ) && ! ini_get( 'safe_mode' ) ) { |
|
317 | - @set_time_limit( 0 ); |
|
316 | + if ( ! give_is_func_disabled('set_time_limit') && ! ini_get('safe_mode')) { |
|
317 | + @set_time_limit(0); |
|
318 | 318 | } |
319 | 319 | |
320 | 320 | // UPDATE DB METAKEYS. |
321 | 321 | $sql = "UPDATE $wpdb->postmeta SET meta_key = '_give_payment_customer_id' WHERE meta_key = '_give_payment_donor_id'"; |
322 | - $query = $wpdb->query( $sql ); |
|
322 | + $query = $wpdb->query($sql); |
|
323 | 323 | |
324 | - update_option( 'give_version', preg_replace( '/[^0-9.].*/', '', GIVE_VERSION ) ); |
|
325 | - give_set_upgrade_complete( 'upgrade_give_payment_customer_id' ); |
|
326 | - delete_option( 'give_doing_upgrade' ); |
|
327 | - wp_redirect( admin_url() ); |
|
324 | + update_option('give_version', preg_replace('/[^0-9.].*/', '', GIVE_VERSION)); |
|
325 | + give_set_upgrade_complete('upgrade_give_payment_customer_id'); |
|
326 | + delete_option('give_doing_upgrade'); |
|
327 | + wp_redirect(admin_url()); |
|
328 | 328 | exit; |
329 | 329 | |
330 | 330 | } |
331 | 331 | |
332 | -add_action( 'give_upgrade_give_payment_customer_id', 'give_v132_upgrade_give_payment_customer_id' ); |
|
332 | +add_action('give_upgrade_give_payment_customer_id', 'give_v132_upgrade_give_payment_customer_id'); |
|
333 | 333 | |
334 | 334 | /** |
335 | 335 | * Upgrades the Offline Status |
@@ -342,16 +342,16 @@ discard block |
||
342 | 342 | |
343 | 343 | global $wpdb; |
344 | 344 | |
345 | - if ( ! current_user_can( 'manage_give_settings' ) ) { |
|
346 | - wp_die( esc_html__( 'You do not have permission to do Give upgrades.', 'give' ), esc_html__( 'Error', 'give' ), array( |
|
345 | + if ( ! current_user_can('manage_give_settings')) { |
|
346 | + wp_die(esc_html__('You do not have permission to do Give upgrades.', 'give'), esc_html__('Error', 'give'), array( |
|
347 | 347 | 'response' => 403, |
348 | - ) ); |
|
348 | + )); |
|
349 | 349 | } |
350 | 350 | |
351 | - ignore_user_abort( true ); |
|
351 | + ignore_user_abort(true); |
|
352 | 352 | |
353 | - if ( ! give_is_func_disabled( 'set_time_limit' ) && ! ini_get( 'safe_mode' ) ) { |
|
354 | - @set_time_limit( 0 ); |
|
353 | + if ( ! give_is_func_disabled('set_time_limit') && ! ini_get('safe_mode')) { |
|
354 | + @set_time_limit(0); |
|
355 | 355 | } |
356 | 356 | |
357 | 357 | // Get abandoned offline payments. |
@@ -361,31 +361,31 @@ discard block |
||
361 | 361 | $where .= "AND ( p.post_status = 'abandoned' )"; |
362 | 362 | $where .= "AND ( m.meta_key = '_give_payment_gateway' AND m.meta_value = 'offline' )"; |
363 | 363 | |
364 | - $sql = $select . $join . $where; |
|
365 | - $found_payments = $wpdb->get_col( $sql ); |
|
364 | + $sql = $select.$join.$where; |
|
365 | + $found_payments = $wpdb->get_col($sql); |
|
366 | 366 | |
367 | - foreach ( $found_payments as $payment ) { |
|
367 | + foreach ($found_payments as $payment) { |
|
368 | 368 | |
369 | 369 | // Only change ones marked abandoned since our release last week because the admin may have marked some abandoned themselves. |
370 | - $modified_time = get_post_modified_time( 'U', false, $payment ); |
|
370 | + $modified_time = get_post_modified_time('U', false, $payment); |
|
371 | 371 | |
372 | 372 | // 1450124863 = 12/10/2015 20:42:25. |
373 | - if ( $modified_time >= 1450124863 ) { |
|
373 | + if ($modified_time >= 1450124863) { |
|
374 | 374 | |
375 | - give_update_payment_status( $payment, 'pending' ); |
|
375 | + give_update_payment_status($payment, 'pending'); |
|
376 | 376 | |
377 | 377 | } |
378 | 378 | } |
379 | 379 | |
380 | - update_option( 'give_version', preg_replace( '/[^0-9.].*/', '', GIVE_VERSION ) ); |
|
381 | - give_set_upgrade_complete( 'upgrade_give_offline_status' ); |
|
382 | - delete_option( 'give_doing_upgrade' ); |
|
383 | - wp_redirect( admin_url() ); |
|
380 | + update_option('give_version', preg_replace('/[^0-9.].*/', '', GIVE_VERSION)); |
|
381 | + give_set_upgrade_complete('upgrade_give_offline_status'); |
|
382 | + delete_option('give_doing_upgrade'); |
|
383 | + wp_redirect(admin_url()); |
|
384 | 384 | exit; |
385 | 385 | |
386 | 386 | } |
387 | 387 | |
388 | -add_action( 'give_upgrade_give_offline_status', 'give_v134_upgrade_give_offline_status' ); |
|
388 | +add_action('give_upgrade_give_offline_status', 'give_v134_upgrade_give_offline_status'); |
|
389 | 389 | |
390 | 390 | /** |
391 | 391 | * Cleanup User Roles |
@@ -396,17 +396,17 @@ discard block |
||
396 | 396 | */ |
397 | 397 | function give_v152_cleanup_users() { |
398 | 398 | |
399 | - $give_version = get_option( 'give_version' ); |
|
399 | + $give_version = get_option('give_version'); |
|
400 | 400 | |
401 | - if ( ! $give_version ) { |
|
401 | + if ( ! $give_version) { |
|
402 | 402 | // 1.0 is the first version to use this option so we must add it. |
403 | 403 | $give_version = '1.0'; |
404 | 404 | } |
405 | 405 | |
406 | - $give_version = preg_replace( '/[^0-9.].*/', '', $give_version ); |
|
406 | + $give_version = preg_replace('/[^0-9.].*/', '', $give_version); |
|
407 | 407 | |
408 | 408 | // v1.5.2 Upgrades |
409 | - if ( version_compare( $give_version, '1.5.2', '<' ) || ! give_has_upgrade_completed( 'upgrade_give_user_caps_cleanup' ) ) { |
|
409 | + if (version_compare($give_version, '1.5.2', '<') || ! give_has_upgrade_completed('upgrade_give_user_caps_cleanup')) { |
|
410 | 410 | |
411 | 411 | // Delete all caps with "ss". |
412 | 412 | // Also delete all unused "campaign" roles. |
@@ -453,9 +453,9 @@ discard block |
||
453 | 453 | ); |
454 | 454 | |
455 | 455 | global $wp_roles; |
456 | - foreach ( $delete_caps as $cap ) { |
|
457 | - foreach ( array_keys( $wp_roles->roles ) as $role ) { |
|
458 | - $wp_roles->remove_cap( $role, $cap ); |
|
456 | + foreach ($delete_caps as $cap) { |
|
457 | + foreach (array_keys($wp_roles->roles) as $role) { |
|
458 | + $wp_roles->remove_cap($role, $cap); |
|
459 | 459 | } |
460 | 460 | } |
461 | 461 | |
@@ -465,15 +465,15 @@ discard block |
||
465 | 465 | $roles->add_caps(); |
466 | 466 | |
467 | 467 | // The Update Ran. |
468 | - update_option( 'give_version', preg_replace( '/[^0-9.].*/', '', GIVE_VERSION ) ); |
|
469 | - give_set_upgrade_complete( 'upgrade_give_user_caps_cleanup' ); |
|
470 | - delete_option( 'give_doing_upgrade' ); |
|
468 | + update_option('give_version', preg_replace('/[^0-9.].*/', '', GIVE_VERSION)); |
|
469 | + give_set_upgrade_complete('upgrade_give_user_caps_cleanup'); |
|
470 | + delete_option('give_doing_upgrade'); |
|
471 | 471 | |
472 | 472 | }// End if(). |
473 | 473 | |
474 | 474 | } |
475 | 475 | |
476 | -add_action( 'admin_init', 'give_v152_cleanup_users' ); |
|
476 | +add_action('admin_init', 'give_v152_cleanup_users'); |
|
477 | 477 | |
478 | 478 | /** |
479 | 479 | * 1.6 Upgrade routine to create the customer meta table. |
@@ -516,53 +516,53 @@ discard block |
||
516 | 516 | |
517 | 517 | // Get addons license key. |
518 | 518 | $addons = array(); |
519 | - foreach ( $give_options as $key => $value ) { |
|
520 | - if ( false !== strpos( $key, '_license_key' ) ) { |
|
521 | - $addons[ $key ] = $value; |
|
519 | + foreach ($give_options as $key => $value) { |
|
520 | + if (false !== strpos($key, '_license_key')) { |
|
521 | + $addons[$key] = $value; |
|
522 | 522 | } |
523 | 523 | } |
524 | 524 | |
525 | 525 | // Bailout: We do not have any addon license data to upgrade. |
526 | - if ( empty( $addons ) ) { |
|
526 | + if (empty($addons)) { |
|
527 | 527 | return false; |
528 | 528 | } |
529 | 529 | |
530 | - foreach ( $addons as $key => $addon_license ) { |
|
530 | + foreach ($addons as $key => $addon_license) { |
|
531 | 531 | |
532 | 532 | // Get addon shortname. |
533 | - $shortname = str_replace( '_license_key', '', $key ); |
|
533 | + $shortname = str_replace('_license_key', '', $key); |
|
534 | 534 | |
535 | 535 | // Addon license option name. |
536 | - $addon_license_option_name = $shortname . '_license_active'; |
|
536 | + $addon_license_option_name = $shortname.'_license_active'; |
|
537 | 537 | |
538 | 538 | // bailout if license is empty. |
539 | - if ( empty( $addon_license ) ) { |
|
540 | - delete_option( $addon_license_option_name ); |
|
539 | + if (empty($addon_license)) { |
|
540 | + delete_option($addon_license_option_name); |
|
541 | 541 | continue; |
542 | 542 | } |
543 | 543 | |
544 | 544 | // Get addon name. |
545 | 545 | $addon_name = array(); |
546 | - $addon_name_parts = explode( '_', str_replace( 'give_', '', $shortname ) ); |
|
547 | - foreach ( $addon_name_parts as $name_part ) { |
|
546 | + $addon_name_parts = explode('_', str_replace('give_', '', $shortname)); |
|
547 | + foreach ($addon_name_parts as $name_part) { |
|
548 | 548 | |
549 | 549 | // Fix addon name |
550 | - switch ( $name_part ) { |
|
550 | + switch ($name_part) { |
|
551 | 551 | case 'authorizenet' : |
552 | 552 | $name_part = 'authorize.net'; |
553 | 553 | break; |
554 | 554 | } |
555 | 555 | |
556 | - $addon_name[] = ucfirst( $name_part ); |
|
556 | + $addon_name[] = ucfirst($name_part); |
|
557 | 557 | } |
558 | 558 | |
559 | - $addon_name = implode( ' ', $addon_name ); |
|
559 | + $addon_name = implode(' ', $addon_name); |
|
560 | 560 | |
561 | 561 | // Data to send to the API |
562 | 562 | $api_params = array( |
563 | 563 | 'edd_action' => 'activate_license', // never change from "edd_" to "give_"! |
564 | 564 | 'license' => $addon_license, |
565 | - 'item_name' => urlencode( $addon_name ), |
|
565 | + 'item_name' => urlencode($addon_name), |
|
566 | 566 | 'url' => home_url(), |
567 | 567 | ); |
568 | 568 | |
@@ -577,17 +577,17 @@ discard block |
||
577 | 577 | ); |
578 | 578 | |
579 | 579 | // Make sure there are no errors. |
580 | - if ( is_wp_error( $response ) ) { |
|
581 | - delete_option( $addon_license_option_name ); |
|
580 | + if (is_wp_error($response)) { |
|
581 | + delete_option($addon_license_option_name); |
|
582 | 582 | continue; |
583 | 583 | } |
584 | 584 | |
585 | 585 | // Tell WordPress to look for updates. |
586 | - set_site_transient( 'update_plugins', null ); |
|
586 | + set_site_transient('update_plugins', null); |
|
587 | 587 | |
588 | 588 | // Decode license data. |
589 | - $license_data = json_decode( wp_remote_retrieve_body( $response ) ); |
|
590 | - update_option( $addon_license_option_name, $license_data ); |
|
589 | + $license_data = json_decode(wp_remote_retrieve_body($response)); |
|
590 | + update_option($addon_license_option_name, $license_data); |
|
591 | 591 | }// End foreach(). |
592 | 592 | } |
593 | 593 | |
@@ -617,9 +617,9 @@ discard block |
||
617 | 617 | ); |
618 | 618 | |
619 | 619 | global $wp_roles; |
620 | - foreach ( $delete_caps as $cap ) { |
|
621 | - foreach ( array_keys( $wp_roles->roles ) as $role ) { |
|
622 | - $wp_roles->remove_cap( $role, $cap ); |
|
620 | + foreach ($delete_caps as $cap) { |
|
621 | + foreach (array_keys($wp_roles->roles) as $role) { |
|
622 | + $wp_roles->remove_cap($role, $cap); |
|
623 | 623 | } |
624 | 624 | } |
625 | 625 | |
@@ -653,7 +653,7 @@ discard block |
||
653 | 653 | function give_v18_upgrades_core_setting() { |
654 | 654 | // Core settings which changes from checkbox to radio. |
655 | 655 | $core_setting_names = array_merge( |
656 | - array_keys( give_v18_renamed_core_settings() ), |
|
656 | + array_keys(give_v18_renamed_core_settings()), |
|
657 | 657 | array( |
658 | 658 | 'uninstall_on_delete', |
659 | 659 | 'scripts_footer', |
@@ -665,48 +665,48 @@ discard block |
||
665 | 665 | ); |
666 | 666 | |
667 | 667 | // Bailout: If not any setting define. |
668 | - if ( $give_settings = get_option( 'give_settings' ) ) { |
|
668 | + if ($give_settings = get_option('give_settings')) { |
|
669 | 669 | |
670 | 670 | $setting_changed = false; |
671 | 671 | |
672 | 672 | // Loop: check each setting field. |
673 | - foreach ( $core_setting_names as $setting_name ) { |
|
673 | + foreach ($core_setting_names as $setting_name) { |
|
674 | 674 | // New setting name. |
675 | - $new_setting_name = preg_replace( '/^(enable_|disable_)/', '', $setting_name ); |
|
675 | + $new_setting_name = preg_replace('/^(enable_|disable_)/', '', $setting_name); |
|
676 | 676 | |
677 | 677 | // Continue: If setting already set. |
678 | 678 | if ( |
679 | - array_key_exists( $new_setting_name, $give_settings ) |
|
680 | - && in_array( $give_settings[ $new_setting_name ], array( 'enabled', 'disabled' ) ) |
|
679 | + array_key_exists($new_setting_name, $give_settings) |
|
680 | + && in_array($give_settings[$new_setting_name], array('enabled', 'disabled')) |
|
681 | 681 | ) { |
682 | 682 | continue; |
683 | 683 | } |
684 | 684 | |
685 | 685 | // Set checkbox value to radio value. |
686 | - $give_settings[ $setting_name ] = ( ! empty( $give_settings[ $setting_name ] ) && 'on' === $give_settings[ $setting_name ] ? 'enabled' : 'disabled' ); |
|
686 | + $give_settings[$setting_name] = ( ! empty($give_settings[$setting_name]) && 'on' === $give_settings[$setting_name] ? 'enabled' : 'disabled'); |
|
687 | 687 | |
688 | 688 | // @see https://github.com/WordImpress/Give/issues/1063 |
689 | - if ( false !== strpos( $setting_name, 'disable_' ) ) { |
|
689 | + if (false !== strpos($setting_name, 'disable_')) { |
|
690 | 690 | |
691 | - $give_settings[ $new_setting_name ] = ( give_is_setting_enabled( $give_settings[ $setting_name ] ) ? 'disabled' : 'enabled' ); |
|
692 | - } elseif ( false !== strpos( $setting_name, 'enable_' ) ) { |
|
691 | + $give_settings[$new_setting_name] = (give_is_setting_enabled($give_settings[$setting_name]) ? 'disabled' : 'enabled'); |
|
692 | + } elseif (false !== strpos($setting_name, 'enable_')) { |
|
693 | 693 | |
694 | - $give_settings[ $new_setting_name ] = ( give_is_setting_enabled( $give_settings[ $setting_name ] ) ? 'enabled' : 'disabled' ); |
|
694 | + $give_settings[$new_setting_name] = (give_is_setting_enabled($give_settings[$setting_name]) ? 'enabled' : 'disabled'); |
|
695 | 695 | } |
696 | 696 | |
697 | 697 | // Tell bot to update core setting to db. |
698 | - if ( ! $setting_changed ) { |
|
698 | + if ( ! $setting_changed) { |
|
699 | 699 | $setting_changed = true; |
700 | 700 | } |
701 | 701 | } |
702 | 702 | |
703 | 703 | // Update setting only if they changed. |
704 | - if ( $setting_changed ) { |
|
705 | - update_option( 'give_settings', $give_settings ); |
|
704 | + if ($setting_changed) { |
|
705 | + update_option('give_settings', $give_settings); |
|
706 | 706 | } |
707 | 707 | }// End if(). |
708 | 708 | |
709 | - give_set_upgrade_complete( 'v18_upgrades_core_setting' ); |
|
709 | + give_set_upgrade_complete('v18_upgrades_core_setting'); |
|
710 | 710 | } |
711 | 711 | |
712 | 712 | /** |
@@ -716,22 +716,22 @@ discard block |
||
716 | 716 | * @return void |
717 | 717 | */ |
718 | 718 | function give_v18_upgrades_form_metadata() { |
719 | - if ( ! current_user_can( 'manage_give_settings' ) ) { |
|
720 | - wp_die( esc_html__( 'You do not have permission to do Give upgrades.', 'give' ), esc_html__( 'Error', 'give' ), array( |
|
719 | + if ( ! current_user_can('manage_give_settings')) { |
|
720 | + wp_die(esc_html__('You do not have permission to do Give upgrades.', 'give'), esc_html__('Error', 'give'), array( |
|
721 | 721 | 'response' => 403, |
722 | - ) ); |
|
722 | + )); |
|
723 | 723 | } |
724 | 724 | |
725 | - ignore_user_abort( true ); |
|
725 | + ignore_user_abort(true); |
|
726 | 726 | |
727 | - if ( ! give_is_func_disabled( 'set_time_limit' ) && ! ini_get( 'safe_mode' ) ) { |
|
728 | - @set_time_limit( 0 ); |
|
727 | + if ( ! give_is_func_disabled('set_time_limit') && ! ini_get('safe_mode')) { |
|
728 | + @set_time_limit(0); |
|
729 | 729 | } |
730 | 730 | |
731 | - $step = isset( $_GET['step'] ) ? absint( $_GET['step'] ) : 1; |
|
731 | + $step = isset($_GET['step']) ? absint($_GET['step']) : 1; |
|
732 | 732 | |
733 | 733 | // form query |
734 | - $forms = new WP_Query( array( |
|
734 | + $forms = new WP_Query(array( |
|
735 | 735 | 'paged' => $step, |
736 | 736 | 'status' => 'any', |
737 | 737 | 'order' => 'ASC', |
@@ -740,39 +740,39 @@ discard block |
||
740 | 740 | ) |
741 | 741 | ); |
742 | 742 | |
743 | - if ( $forms->have_posts() ) { |
|
744 | - while ( $forms->have_posts() ) { |
|
743 | + if ($forms->have_posts()) { |
|
744 | + while ($forms->have_posts()) { |
|
745 | 745 | $forms->the_post(); |
746 | 746 | |
747 | 747 | // Form content. |
748 | 748 | // Note in version 1.8 display content setting split into display content and content placement setting. |
749 | 749 | // You can delete _give_content_option in future |
750 | - $show_content = give_get_meta( get_the_ID(), '_give_content_option', true ); |
|
751 | - if ( $show_content && ! give_get_meta( get_the_ID(), '_give_display_content', true ) ) { |
|
752 | - $field_value = ( 'none' !== $show_content ? 'enabled' : 'disabled' ); |
|
753 | - give_update_meta( get_the_ID(), '_give_display_content', $field_value ); |
|
750 | + $show_content = give_get_meta(get_the_ID(), '_give_content_option', true); |
|
751 | + if ($show_content && ! give_get_meta(get_the_ID(), '_give_display_content', true)) { |
|
752 | + $field_value = ('none' !== $show_content ? 'enabled' : 'disabled'); |
|
753 | + give_update_meta(get_the_ID(), '_give_display_content', $field_value); |
|
754 | 754 | |
755 | - $field_value = ( 'none' !== $show_content ? $show_content : 'give_pre_form' ); |
|
756 | - give_update_meta( get_the_ID(), '_give_content_placement', $field_value ); |
|
755 | + $field_value = ('none' !== $show_content ? $show_content : 'give_pre_form'); |
|
756 | + give_update_meta(get_the_ID(), '_give_content_placement', $field_value); |
|
757 | 757 | } |
758 | 758 | |
759 | 759 | // "Disable" Guest Donation. Checkbox |
760 | 760 | // See: https://github.com/WordImpress/Give/issues/1470 |
761 | - $guest_donation = give_get_meta( get_the_ID(), '_give_logged_in_only', true ); |
|
762 | - $guest_donation_newval = ( in_array( $guest_donation, array( 'yes', 'on' ) ) ? 'disabled' : 'enabled' ); |
|
763 | - give_update_meta( get_the_ID(), '_give_logged_in_only', $guest_donation_newval ); |
|
761 | + $guest_donation = give_get_meta(get_the_ID(), '_give_logged_in_only', true); |
|
762 | + $guest_donation_newval = (in_array($guest_donation, array('yes', 'on')) ? 'disabled' : 'enabled'); |
|
763 | + give_update_meta(get_the_ID(), '_give_logged_in_only', $guest_donation_newval); |
|
764 | 764 | |
765 | 765 | // Offline Donations |
766 | 766 | // See: https://github.com/WordImpress/Give/issues/1579 |
767 | - $offline_donation = give_get_meta( get_the_ID(), '_give_customize_offline_donations', true ); |
|
768 | - if ( 'no' === $offline_donation ) { |
|
767 | + $offline_donation = give_get_meta(get_the_ID(), '_give_customize_offline_donations', true); |
|
768 | + if ('no' === $offline_donation) { |
|
769 | 769 | $offline_donation_newval = 'global'; |
770 | - } elseif ( 'yes' === $offline_donation ) { |
|
770 | + } elseif ('yes' === $offline_donation) { |
|
771 | 771 | $offline_donation_newval = 'enabled'; |
772 | 772 | } else { |
773 | 773 | $offline_donation_newval = 'disabled'; |
774 | 774 | } |
775 | - give_update_meta( get_the_ID(), '_give_customize_offline_donations', $offline_donation_newval ); |
|
775 | + give_update_meta(get_the_ID(), '_give_customize_offline_donations', $offline_donation_newval); |
|
776 | 776 | |
777 | 777 | // Convert yes/no setting field to enabled/disabled. |
778 | 778 | $form_radio_settings = array( |
@@ -792,15 +792,15 @@ discard block |
||
792 | 792 | '_give_offline_donation_enable_billing_fields_single', |
793 | 793 | ); |
794 | 794 | |
795 | - foreach ( $form_radio_settings as $meta_key ) { |
|
795 | + foreach ($form_radio_settings as $meta_key) { |
|
796 | 796 | // Get value. |
797 | - $field_value = give_get_meta( get_the_ID(), $meta_key, true ); |
|
797 | + $field_value = give_get_meta(get_the_ID(), $meta_key, true); |
|
798 | 798 | |
799 | 799 | // Convert meta value only if it is in yes/no/none. |
800 | - if ( in_array( $field_value, array( 'yes', 'on', 'no', 'none' ) ) ) { |
|
800 | + if (in_array($field_value, array('yes', 'on', 'no', 'none'))) { |
|
801 | 801 | |
802 | - $field_value = ( in_array( $field_value, array( 'yes', 'on' ) ) ? 'enabled' : 'disabled' ); |
|
803 | - give_update_meta( get_the_ID(), $meta_key, $field_value ); |
|
802 | + $field_value = (in_array($field_value, array('yes', 'on')) ? 'enabled' : 'disabled'); |
|
803 | + give_update_meta(get_the_ID(), $meta_key, $field_value); |
|
804 | 804 | } |
805 | 805 | } |
806 | 806 | }// End while(). |
@@ -808,27 +808,27 @@ discard block |
||
808 | 808 | wp_reset_postdata(); |
809 | 809 | |
810 | 810 | // Forms found so upgrade them |
811 | - $step ++; |
|
812 | - $redirect = add_query_arg( array( |
|
811 | + $step++; |
|
812 | + $redirect = add_query_arg(array( |
|
813 | 813 | 'page' => 'give-upgrades', |
814 | 814 | 'give-upgrade' => 'give_v18_upgrades_form_metadata', |
815 | 815 | 'step' => $step, |
816 | - ), admin_url( 'index.php' ) ); |
|
817 | - wp_redirect( $redirect ); |
|
816 | + ), admin_url('index.php')); |
|
817 | + wp_redirect($redirect); |
|
818 | 818 | exit(); |
819 | 819 | |
820 | 820 | } else { |
821 | 821 | // No more forms found, finish up. |
822 | - update_option( 'give_version', preg_replace( '/[^0-9.].*/', '', GIVE_VERSION ) ); |
|
823 | - delete_option( 'give_doing_upgrade' ); |
|
824 | - give_set_upgrade_complete( 'v18_upgrades_form_metadata' ); |
|
822 | + update_option('give_version', preg_replace('/[^0-9.].*/', '', GIVE_VERSION)); |
|
823 | + delete_option('give_doing_upgrade'); |
|
824 | + give_set_upgrade_complete('v18_upgrades_form_metadata'); |
|
825 | 825 | |
826 | - wp_redirect( admin_url() ); |
|
826 | + wp_redirect(admin_url()); |
|
827 | 827 | exit; |
828 | 828 | } |
829 | 829 | } |
830 | 830 | |
831 | -add_action( 'give_give_v18_upgrades_form_metadata', 'give_v18_upgrades_form_metadata' ); |
|
831 | +add_action('give_give_v18_upgrades_form_metadata', 'give_v18_upgrades_form_metadata'); |
|
832 | 832 | |
833 | 833 | /** |
834 | 834 | * Get list of core setting renamed in version 1.8. |
@@ -874,7 +874,7 @@ discard block |
||
874 | 874 | '_transient_give_stats_', |
875 | 875 | 'give_cache', |
876 | 876 | '_transient_give_add_ons_feed', |
877 | - '_transient__give_ajax_works' . |
|
877 | + '_transient__give_ajax_works'. |
|
878 | 878 | '_transient_give_total_api_keys', |
879 | 879 | '_transient_give_i18n_give_promo_hide', |
880 | 880 | '_transient_give_contributors', |
@@ -901,24 +901,24 @@ discard block |
||
901 | 901 | ARRAY_A |
902 | 902 | ); |
903 | 903 | |
904 | - if ( ! empty( $user_apikey_options ) ) { |
|
905 | - foreach ( $user_apikey_options as $user ) { |
|
906 | - $cached_options[] = '_transient_' . md5( 'give_api_user_' . $user['meta_key'] ); |
|
907 | - $cached_options[] = '_transient_' . md5( 'give_api_user_public_key' . $user['user_id'] ); |
|
908 | - $cached_options[] = '_transient_' . md5( 'give_api_user_secret_key' . $user['user_id'] ); |
|
904 | + if ( ! empty($user_apikey_options)) { |
|
905 | + foreach ($user_apikey_options as $user) { |
|
906 | + $cached_options[] = '_transient_'.md5('give_api_user_'.$user['meta_key']); |
|
907 | + $cached_options[] = '_transient_'.md5('give_api_user_public_key'.$user['user_id']); |
|
908 | + $cached_options[] = '_transient_'.md5('give_api_user_secret_key'.$user['user_id']); |
|
909 | 909 | } |
910 | 910 | } |
911 | 911 | |
912 | - if ( ! empty( $cached_options ) ) { |
|
913 | - foreach ( $cached_options as $option ) { |
|
914 | - switch ( true ) { |
|
915 | - case ( false !== strpos( $option, 'transient' ) ): |
|
916 | - $option = str_replace( '_transient_', '', $option ); |
|
917 | - delete_transient( $option ); |
|
912 | + if ( ! empty($cached_options)) { |
|
913 | + foreach ($cached_options as $option) { |
|
914 | + switch (true) { |
|
915 | + case (false !== strpos($option, 'transient')): |
|
916 | + $option = str_replace('_transient_', '', $option); |
|
917 | + delete_transient($option); |
|
918 | 918 | break; |
919 | 919 | |
920 | 920 | default: |
921 | - delete_option( $option ); |
|
921 | + delete_option($option); |
|
922 | 922 | } |
923 | 923 | } |
924 | 924 | } |
@@ -936,7 +936,7 @@ discard block |
||
936 | 936 | global $wp_roles; |
937 | 937 | |
938 | 938 | // Get the role object. |
939 | - $give_worker = get_role( 'give_worker' ); |
|
939 | + $give_worker = get_role('give_worker'); |
|
940 | 940 | |
941 | 941 | // A list of capabilities to add for give workers. |
942 | 942 | $caps_to_add = array( |
@@ -944,9 +944,9 @@ discard block |
||
944 | 944 | 'edit_pages', |
945 | 945 | ); |
946 | 946 | |
947 | - foreach ( $caps_to_add as $cap ) { |
|
947 | + foreach ($caps_to_add as $cap) { |
|
948 | 948 | // Add the capability. |
949 | - $give_worker->add_cap( $cap ); |
|
949 | + $give_worker->add_cap($cap); |
|
950 | 950 | } |
951 | 951 | |
952 | 952 | } |
@@ -960,22 +960,22 @@ discard block |
||
960 | 960 | */ |
961 | 961 | function give_v189_upgrades_levels_post_meta_callback() { |
962 | 962 | |
963 | - if ( ! current_user_can( 'manage_give_settings' ) ) { |
|
964 | - wp_die( esc_html__( 'You do not have permission to do Give upgrades.', 'give' ), esc_html__( 'Error', 'give' ), array( |
|
963 | + if ( ! current_user_can('manage_give_settings')) { |
|
964 | + wp_die(esc_html__('You do not have permission to do Give upgrades.', 'give'), esc_html__('Error', 'give'), array( |
|
965 | 965 | 'response' => 403, |
966 | - ) ); |
|
966 | + )); |
|
967 | 967 | } |
968 | 968 | |
969 | - ignore_user_abort( true ); |
|
969 | + ignore_user_abort(true); |
|
970 | 970 | |
971 | - if ( ! give_is_func_disabled( 'set_time_limit' ) && ! ini_get( 'safe_mode' ) ) { |
|
972 | - @set_time_limit( 0 ); |
|
971 | + if ( ! give_is_func_disabled('set_time_limit') && ! ini_get('safe_mode')) { |
|
972 | + @set_time_limit(0); |
|
973 | 973 | } |
974 | 974 | |
975 | - $step = isset( $_GET['step'] ) ? absint( $_GET['step'] ) : 1; |
|
975 | + $step = isset($_GET['step']) ? absint($_GET['step']) : 1; |
|
976 | 976 | |
977 | 977 | // form query |
978 | - $donation_forms = new WP_Query( array( |
|
978 | + $donation_forms = new WP_Query(array( |
|
979 | 979 | 'paged' => $step, |
980 | 980 | 'status' => 'any', |
981 | 981 | 'order' => 'ASC', |
@@ -984,8 +984,8 @@ discard block |
||
984 | 984 | ) |
985 | 985 | ); |
986 | 986 | |
987 | - if ( $donation_forms->have_posts() ) { |
|
988 | - while ( $donation_forms->have_posts() ) { |
|
987 | + if ($donation_forms->have_posts()) { |
|
988 | + while ($donation_forms->have_posts()) { |
|
989 | 989 | $donation_forms->the_post(); |
990 | 990 | $form_id = get_the_ID(); |
991 | 991 | |
@@ -993,41 +993,41 @@ discard block |
||
993 | 993 | update_post_meta( |
994 | 994 | $form_id, |
995 | 995 | '_give_set_price', |
996 | - give_sanitize_amount( get_post_meta( $form_id, '_give_set_price', true ) ) |
|
996 | + give_sanitize_amount(get_post_meta($form_id, '_give_set_price', true)) |
|
997 | 997 | ); |
998 | 998 | |
999 | 999 | // Remove formatting from _give_custom_amount_minimum |
1000 | 1000 | update_post_meta( |
1001 | 1001 | $form_id, |
1002 | 1002 | '_give_custom_amount_minimum', |
1003 | - give_sanitize_amount( get_post_meta( $form_id, '_give_custom_amount_minimum', true ) ) |
|
1003 | + give_sanitize_amount(get_post_meta($form_id, '_give_custom_amount_minimum', true)) |
|
1004 | 1004 | ); |
1005 | 1005 | |
1006 | 1006 | // Bailout. |
1007 | - if ( 'set' === get_post_meta( $form_id, '_give_price_option', true ) ) { |
|
1007 | + if ('set' === get_post_meta($form_id, '_give_price_option', true)) { |
|
1008 | 1008 | continue; |
1009 | 1009 | } |
1010 | 1010 | |
1011 | - $donation_levels = get_post_meta( $form_id, '_give_donation_levels', true ); |
|
1011 | + $donation_levels = get_post_meta($form_id, '_give_donation_levels', true); |
|
1012 | 1012 | |
1013 | - if ( ! empty( $donation_levels ) ) { |
|
1013 | + if ( ! empty($donation_levels)) { |
|
1014 | 1014 | |
1015 | - foreach ( $donation_levels as $index => $donation_level ) { |
|
1016 | - if( isset( $donation_level['_give_amount'] ) ) { |
|
1017 | - $donation_levels[$index]['_give_amount'] = give_sanitize_amount( $donation_level['_give_amount'] ); |
|
1015 | + foreach ($donation_levels as $index => $donation_level) { |
|
1016 | + if (isset($donation_level['_give_amount'])) { |
|
1017 | + $donation_levels[$index]['_give_amount'] = give_sanitize_amount($donation_level['_give_amount']); |
|
1018 | 1018 | } |
1019 | 1019 | } |
1020 | 1020 | |
1021 | - update_post_meta( $form_id, '_give_donation_levels', $donation_levels ); |
|
1021 | + update_post_meta($form_id, '_give_donation_levels', $donation_levels); |
|
1022 | 1022 | |
1023 | - $donation_levels_amounts = wp_list_pluck( $donation_levels, '_give_amount' ); |
|
1023 | + $donation_levels_amounts = wp_list_pluck($donation_levels, '_give_amount'); |
|
1024 | 1024 | |
1025 | - $min_amount = min( $donation_levels_amounts ); |
|
1026 | - $max_amount = max( $donation_levels_amounts ); |
|
1025 | + $min_amount = min($donation_levels_amounts); |
|
1026 | + $max_amount = max($donation_levels_amounts); |
|
1027 | 1027 | |
1028 | 1028 | // Set Minimum and Maximum amount for Multi Level Donation Forms |
1029 | - give_update_meta( $form_id, '_give_levels_minimum_amount', $min_amount ? give_sanitize_amount( $min_amount ) : 0 ); |
|
1030 | - give_update_meta( $form_id, '_give_levels_maximum_amount', $max_amount ? give_sanitize_amount( $max_amount ) : 0 ); |
|
1029 | + give_update_meta($form_id, '_give_levels_minimum_amount', $min_amount ? give_sanitize_amount($min_amount) : 0); |
|
1030 | + give_update_meta($form_id, '_give_levels_maximum_amount', $max_amount ? give_sanitize_amount($max_amount) : 0); |
|
1031 | 1031 | } |
1032 | 1032 | |
1033 | 1033 | } |
@@ -1036,27 +1036,27 @@ discard block |
||
1036 | 1036 | wp_reset_postdata(); |
1037 | 1037 | |
1038 | 1038 | // Forms found so upgrade them |
1039 | - $step ++; |
|
1040 | - $redirect = add_query_arg( array( |
|
1039 | + $step++; |
|
1040 | + $redirect = add_query_arg(array( |
|
1041 | 1041 | 'page' => 'give-upgrades', |
1042 | 1042 | 'give-upgrade' => 'v189_upgrades_levels_post_meta', |
1043 | 1043 | 'step' => $step, |
1044 | - ), admin_url( 'index.php' ) ); |
|
1045 | - wp_redirect( $redirect ); |
|
1044 | + ), admin_url('index.php')); |
|
1045 | + wp_redirect($redirect); |
|
1046 | 1046 | exit(); |
1047 | 1047 | } else { |
1048 | 1048 | // The Update Ran. |
1049 | - update_option( 'give_version', preg_replace( '/[^0-9.].*/', '', GIVE_VERSION ) ); |
|
1050 | - give_set_upgrade_complete( 'v189_upgrades_levels_post_meta' ); |
|
1051 | - delete_option( 'give_doing_upgrade' ); |
|
1049 | + update_option('give_version', preg_replace('/[^0-9.].*/', '', GIVE_VERSION)); |
|
1050 | + give_set_upgrade_complete('v189_upgrades_levels_post_meta'); |
|
1051 | + delete_option('give_doing_upgrade'); |
|
1052 | 1052 | |
1053 | - wp_redirect( admin_url() ); |
|
1053 | + wp_redirect(admin_url()); |
|
1054 | 1054 | exit; |
1055 | 1055 | } |
1056 | 1056 | |
1057 | 1057 | } |
1058 | 1058 | |
1059 | -add_action( 'give_v189_upgrades_levels_post_meta', 'give_v189_upgrades_levels_post_meta_callback' ); |
|
1059 | +add_action('give_v189_upgrades_levels_post_meta', 'give_v189_upgrades_levels_post_meta_callback'); |
|
1060 | 1060 | |
1061 | 1061 | |
1062 | 1062 | /** |