@@ -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_customer_id = sanitize_text_field( $data['give-current-customer'] ); |
|
73 | - $new_customer_id = sanitize_text_field( $data['customer-id'] ); |
|
72 | + $curr_customer_id = sanitize_text_field($data['give-current-customer']); |
|
73 | + $new_customer_id = sanitize_text_field($data['customer-id']); |
|
74 | 74 | |
75 | 75 | /** |
76 | 76 | * Fires before updating edited donation. |
@@ -79,98 +79,98 @@ discard block |
||
79 | 79 | * |
80 | 80 | * @param int $payment_id The ID of the payment. |
81 | 81 | */ |
82 | - do_action( 'give_update_edited_purchase', $payment_id ); |
|
82 | + do_action('give_update_edited_purchase', $payment_id); |
|
83 | 83 | |
84 | 84 | $payment->date = $date; |
85 | 85 | $updated = $payment->save(); |
86 | 86 | |
87 | - if ( 0 === $updated ) { |
|
88 | - wp_die( esc_html__( 'Error Updating Donation.', 'give' ), esc_html__( 'Error', 'give' ), array( 'response' => 400 ) ); |
|
87 | + if (0 === $updated) { |
|
88 | + wp_die(esc_html__('Error Updating Donation.', 'give'), esc_html__('Error', 'give'), array('response' => 400)); |
|
89 | 89 | } |
90 | 90 | |
91 | 91 | $customer_changed = false; |
92 | 92 | |
93 | - if ( isset( $data['give-new-customer'] ) && $data['give-new-customer'] == '1' ) { |
|
93 | + if (isset($data['give-new-customer']) && $data['give-new-customer'] == '1') { |
|
94 | 94 | |
95 | - $email = isset( $data['give-new-customer-email'] ) ? sanitize_text_field( $data['give-new-customer-email'] ) : ''; |
|
96 | - $names = isset( $data['give-new-customer-name'] ) ? sanitize_text_field( $data['give-new-customer-name'] ) : ''; |
|
95 | + $email = isset($data['give-new-customer-email']) ? sanitize_text_field($data['give-new-customer-email']) : ''; |
|
96 | + $names = isset($data['give-new-customer-name']) ? sanitize_text_field($data['give-new-customer-name']) : ''; |
|
97 | 97 | |
98 | - if ( empty( $email ) || empty( $names ) ) { |
|
99 | - wp_die( esc_html__( 'New Customers require a name and email address.', 'give' ), esc_html__( 'Error', 'give' ), array( 'response' => 400 ) ); |
|
98 | + if (empty($email) || empty($names)) { |
|
99 | + wp_die(esc_html__('New Customers require a name and email address.', 'give'), esc_html__('Error', 'give'), array('response' => 400)); |
|
100 | 100 | } |
101 | 101 | |
102 | - $customer = new Give_Customer( $email ); |
|
103 | - if ( empty( $customer->id ) ) { |
|
104 | - $customer_data = array( 'name' => $names, 'email' => $email ); |
|
105 | - $user_id = email_exists( $email ); |
|
106 | - if ( false !== $user_id ) { |
|
102 | + $customer = new Give_Customer($email); |
|
103 | + if (empty($customer->id)) { |
|
104 | + $customer_data = array('name' => $names, 'email' => $email); |
|
105 | + $user_id = email_exists($email); |
|
106 | + if (false !== $user_id) { |
|
107 | 107 | $customer_data['user_id'] = $user_id; |
108 | 108 | } |
109 | 109 | |
110 | - if ( ! $customer->create( $customer_data ) ) { |
|
110 | + if ( ! $customer->create($customer_data)) { |
|
111 | 111 | // Failed to crete the new donor, assume the previous donor. |
112 | 112 | $customer_changed = false; |
113 | - $customer = new Give_Customer( $curr_customer_id ); |
|
114 | - give_set_error( 'give-payment-new-customer-fail', esc_html__( 'Error creating new donor.', 'give' ) ); |
|
113 | + $customer = new Give_Customer($curr_customer_id); |
|
114 | + give_set_error('give-payment-new-customer-fail', esc_html__('Error creating new donor.', 'give')); |
|
115 | 115 | } |
116 | 116 | } |
117 | 117 | |
118 | 118 | $new_customer_id = $customer->id; |
119 | 119 | |
120 | - $previous_customer = new Give_Customer( $curr_customer_id ); |
|
120 | + $previous_customer = new Give_Customer($curr_customer_id); |
|
121 | 121 | |
122 | 122 | $customer_changed = true; |
123 | 123 | |
124 | - } elseif ( $curr_customer_id !== $new_customer_id ) { |
|
124 | + } elseif ($curr_customer_id !== $new_customer_id) { |
|
125 | 125 | |
126 | - $customer = new Give_Customer( $new_customer_id ); |
|
126 | + $customer = new Give_Customer($new_customer_id); |
|
127 | 127 | $email = $customer->email; |
128 | 128 | $names = $customer->name; |
129 | 129 | |
130 | - $previous_customer = new Give_Customer( $curr_customer_id ); |
|
130 | + $previous_customer = new Give_Customer($curr_customer_id); |
|
131 | 131 | |
132 | 132 | $customer_changed = true; |
133 | 133 | |
134 | 134 | } else { |
135 | 135 | |
136 | - $customer = new Give_Customer( $curr_customer_id ); |
|
136 | + $customer = new Give_Customer($curr_customer_id); |
|
137 | 137 | $email = $customer->email; |
138 | 138 | $names = $customer->name; |
139 | 139 | |
140 | 140 | } |
141 | 141 | |
142 | 142 | // Setup first and last name from input values. |
143 | - $names = explode( ' ', $names ); |
|
144 | - $first_name = ! empty( $names[0] ) ? $names[0] : ''; |
|
143 | + $names = explode(' ', $names); |
|
144 | + $first_name = ! empty($names[0]) ? $names[0] : ''; |
|
145 | 145 | $last_name = ''; |
146 | - if ( ! empty( $names[1] ) ) { |
|
147 | - unset( $names[0] ); |
|
148 | - $last_name = implode( ' ', $names ); |
|
146 | + if ( ! empty($names[1])) { |
|
147 | + unset($names[0]); |
|
148 | + $last_name = implode(' ', $names); |
|
149 | 149 | } |
150 | 150 | |
151 | - if ( $customer_changed ) { |
|
151 | + if ($customer_changed) { |
|
152 | 152 | |
153 | 153 | // Remove the stats and payment from the previous customer and attach it to the new customer. |
154 | - $previous_customer->remove_payment( $payment_id, false ); |
|
155 | - $customer->attach_payment( $payment_id, false ); |
|
154 | + $previous_customer->remove_payment($payment_id, false); |
|
155 | + $customer->attach_payment($payment_id, false); |
|
156 | 156 | |
157 | - if ( 'publish' == $status ) { |
|
157 | + if ('publish' == $status) { |
|
158 | 158 | |
159 | 159 | // Reduce previous user donation count and amount. |
160 | 160 | $previous_customer->decrease_purchase_count(); |
161 | - $previous_customer->decrease_value( $curr_total ); |
|
161 | + $previous_customer->decrease_value($curr_total); |
|
162 | 162 | |
163 | 163 | // If donation was completed adjust stats of new customers. |
164 | 164 | $customer->increase_purchase_count(); |
165 | - $customer->increase_value( $new_total ); |
|
165 | + $customer->increase_value($new_total); |
|
166 | 166 | } |
167 | 167 | |
168 | 168 | $payment->customer_id = $customer->id; |
169 | 169 | } else { |
170 | 170 | |
171 | - if ( 'publish' === $status ) { |
|
171 | + if ('publish' === $status) { |
|
172 | 172 | // Update user donation stat. |
173 | - $customer->update_donation_value( $curr_total, $new_total ); |
|
173 | + $customer->update_donation_value($curr_total, $new_total); |
|
174 | 174 | } |
175 | 175 | } |
176 | 176 | |
@@ -183,10 +183,10 @@ discard block |
||
183 | 183 | $payment->total = $new_total; |
184 | 184 | |
185 | 185 | // Check for payment notes. |
186 | - if ( ! empty( $data['give-payment-note'] ) ) { |
|
186 | + if ( ! empty($data['give-payment-note'])) { |
|
187 | 187 | |
188 | - $note = wp_kses( $data['give-payment-note'], array() ); |
|
189 | - give_insert_payment_note( $payment_id, $note ); |
|
188 | + $note = wp_kses($data['give-payment-note'], array()); |
|
189 | + give_insert_payment_note($payment_id, $note); |
|
190 | 190 | |
191 | 191 | } |
192 | 192 | |
@@ -194,17 +194,17 @@ discard block |
||
194 | 194 | $payment->status = $status; |
195 | 195 | |
196 | 196 | // Adjust total store earnings if the payment total has been changed. |
197 | - if ( $new_total !== $curr_total && 'publish' == $status ) { |
|
197 | + if ($new_total !== $curr_total && 'publish' == $status) { |
|
198 | 198 | |
199 | - if ( $new_total > $curr_total ) { |
|
199 | + if ($new_total > $curr_total) { |
|
200 | 200 | // Increase if our new total is higher. |
201 | 201 | $difference = $new_total - $curr_total; |
202 | - give_increase_total_earnings( $difference ); |
|
202 | + give_increase_total_earnings($difference); |
|
203 | 203 | |
204 | - } elseif ( $curr_total > $new_total ) { |
|
204 | + } elseif ($curr_total > $new_total) { |
|
205 | 205 | // Decrease if our new total is lower. |
206 | 206 | $difference = $curr_total - $new_total; |
207 | - give_decrease_total_earnings( $difference ); |
|
207 | + give_decrease_total_earnings($difference); |
|
208 | 208 | |
209 | 209 | } |
210 | 210 | } |
@@ -212,16 +212,16 @@ discard block |
||
212 | 212 | $payment->save(); |
213 | 213 | |
214 | 214 | // Get new give form ID. |
215 | - $new_form_id = absint( $data['forms'] ); |
|
216 | - $current_form_id = absint( $payment->get_meta( '_give_payment_form_id' ) ); |
|
215 | + $new_form_id = absint($data['forms']); |
|
216 | + $current_form_id = absint($payment->get_meta('_give_payment_form_id')); |
|
217 | 217 | |
218 | 218 | // We are adding payment transfer code in last to remove any conflict with above functionality. |
219 | 219 | // For example: above code will automatically handle form stat (increase/decrease) when payment status changes. |
220 | 220 | // Check if user want to transfer current payment to new give form id. |
221 | - if ( $new_form_id != $current_form_id ) { |
|
221 | + if ($new_form_id != $current_form_id) { |
|
222 | 222 | |
223 | 223 | // Get new give form title. |
224 | - $new_form_title = get_the_title( $new_form_id ); |
|
224 | + $new_form_title = get_the_title($new_form_id); |
|
225 | 225 | |
226 | 226 | // Update new give form data in payment data. |
227 | 227 | $payment_meta = $payment->get_meta(); |
@@ -229,56 +229,56 @@ discard block |
||
229 | 229 | $payment_meta['form_id'] = $new_form_id; |
230 | 230 | |
231 | 231 | // Update price id post meta data for set donation form. |
232 | - if ( ! give_has_variable_prices( $new_form_id ) ) { |
|
232 | + if ( ! give_has_variable_prices($new_form_id)) { |
|
233 | 233 | $payment_meta['price_id'] = ''; |
234 | 234 | } |
235 | 235 | |
236 | 236 | // Update payment give form meta data. |
237 | - $payment->update_meta( '_give_payment_form_id', $new_form_id ); |
|
238 | - $payment->update_meta( '_give_payment_form_title', $new_form_title ); |
|
239 | - $payment->update_meta( '_give_payment_meta', $payment_meta ); |
|
237 | + $payment->update_meta('_give_payment_form_id', $new_form_id); |
|
238 | + $payment->update_meta('_give_payment_form_title', $new_form_title); |
|
239 | + $payment->update_meta('_give_payment_meta', $payment_meta); |
|
240 | 240 | |
241 | 241 | // Update price id payment metadata. |
242 | - if ( ! give_has_variable_prices( $new_form_id ) ) { |
|
243 | - $payment->update_meta( '_give_payment_price_id', '' ); |
|
242 | + if ( ! give_has_variable_prices($new_form_id)) { |
|
243 | + $payment->update_meta('_give_payment_price_id', ''); |
|
244 | 244 | } |
245 | 245 | |
246 | 246 | // If donation was completed, adjust stats of forms. |
247 | - if ( 'publish' == $status ) { |
|
247 | + if ('publish' == $status) { |
|
248 | 248 | |
249 | 249 | // Decrease sale of old give form. For other payment status. |
250 | - $current_form = new Give_Donate_Form( $current_form_id ); |
|
250 | + $current_form = new Give_Donate_Form($current_form_id); |
|
251 | 251 | $current_form->decrease_sales(); |
252 | - $current_form->decrease_earnings( $curr_total ); |
|
252 | + $current_form->decrease_earnings($curr_total); |
|
253 | 253 | |
254 | 254 | // Increase sale of new give form. |
255 | - $new_form = new Give_Donate_Form( $new_form_id ); |
|
255 | + $new_form = new Give_Donate_Form($new_form_id); |
|
256 | 256 | $new_form->increase_sales(); |
257 | - $new_form->increase_earnings( $new_total ); |
|
257 | + $new_form->increase_earnings($new_total); |
|
258 | 258 | } |
259 | 259 | |
260 | 260 | // Re setup payment to update new meta value in object. |
261 | - $payment->update_payment_setup( $payment->ID ); |
|
261 | + $payment->update_payment_setup($payment->ID); |
|
262 | 262 | } |
263 | 263 | |
264 | 264 | // Update price id if current form is variable form. |
265 | - if ( ! empty( $data['give-variable-price'] ) && give_has_variable_prices( $payment->form_id ) ) { |
|
265 | + if ( ! empty($data['give-variable-price']) && give_has_variable_prices($payment->form_id)) { |
|
266 | 266 | |
267 | 267 | // Get payment meta data. |
268 | 268 | $payment_meta = $payment->get_meta(); |
269 | 269 | |
270 | 270 | // Set payment id to empty string if variable price id is negative ( i.e. custom amount feature enabled ). |
271 | - $data['give-variable-price'] = ( 'custom' === $data['give-variable-price'] ) ? 'custom' : ( 0 < $data['give-variable-price'] ) ? $data['give-variable-price'] : ''; |
|
271 | + $data['give-variable-price'] = ('custom' === $data['give-variable-price']) ? 'custom' : (0 < $data['give-variable-price']) ? $data['give-variable-price'] : ''; |
|
272 | 272 | |
273 | 273 | // Update payment meta data. |
274 | 274 | $payment_meta['price_id'] = $data['give-variable-price']; |
275 | 275 | |
276 | 276 | // Update payment give form meta data. |
277 | - $payment->update_meta( '_give_payment_price_id', $data['give-variable-price'] ); |
|
278 | - $payment->update_meta( '_give_payment_meta', $payment_meta ); |
|
277 | + $payment->update_meta('_give_payment_price_id', $data['give-variable-price']); |
|
278 | + $payment->update_meta('_give_payment_meta', $payment_meta); |
|
279 | 279 | |
280 | 280 | // Re setup payment to update new meta value in object. |
281 | - $payment->update_payment_setup( $payment->ID ); |
|
281 | + $payment->update_payment_setup($payment->ID); |
|
282 | 282 | } |
283 | 283 | |
284 | 284 | /** |
@@ -288,13 +288,13 @@ discard block |
||
288 | 288 | * |
289 | 289 | * @param int $payment_id The ID of the payment. |
290 | 290 | */ |
291 | - do_action( 'give_updated_edited_purchase', $payment_id ); |
|
291 | + do_action('give_updated_edited_purchase', $payment_id); |
|
292 | 292 | |
293 | - wp_safe_redirect( admin_url( 'edit.php?post_type=give_forms&page=give-payment-history&view=view-order-details&give-message=payment-updated&id=' . $payment_id ) ); |
|
293 | + wp_safe_redirect(admin_url('edit.php?post_type=give_forms&page=give-payment-history&view=view-order-details&give-message=payment-updated&id='.$payment_id)); |
|
294 | 294 | exit; |
295 | 295 | } |
296 | 296 | |
297 | -add_action( 'give_update_payment_details', 'give_update_payment_details' ); |
|
297 | +add_action('give_update_payment_details', 'give_update_payment_details'); |
|
298 | 298 | |
299 | 299 | /** |
300 | 300 | * Trigger a Donation Deletion |
@@ -305,48 +305,48 @@ discard block |
||
305 | 305 | * |
306 | 306 | * @return void |
307 | 307 | */ |
308 | -function give_trigger_purchase_delete( $data ) { |
|
309 | - if ( wp_verify_nonce( $data['_wpnonce'], 'give_donation_nonce' ) ) { |
|
308 | +function give_trigger_purchase_delete($data) { |
|
309 | + if (wp_verify_nonce($data['_wpnonce'], 'give_donation_nonce')) { |
|
310 | 310 | |
311 | - $payment_id = absint( $data['purchase_id'] ); |
|
311 | + $payment_id = absint($data['purchase_id']); |
|
312 | 312 | |
313 | - if ( ! current_user_can( 'edit_give_payments', $payment_id ) ) { |
|
314 | - wp_die( esc_html__( 'You do not have permission to edit payments.', 'give' ), esc_html__( 'Error', 'give' ), array( 'response' => 403 ) ); |
|
313 | + if ( ! current_user_can('edit_give_payments', $payment_id)) { |
|
314 | + wp_die(esc_html__('You do not have permission to edit payments.', 'give'), esc_html__('Error', 'give'), array('response' => 403)); |
|
315 | 315 | } |
316 | 316 | |
317 | - give_delete_purchase( $payment_id ); |
|
318 | - wp_redirect( admin_url( 'edit.php?post_type=give_forms&page=give-payment-history&give-message=donation_deleted' ) ); |
|
317 | + give_delete_purchase($payment_id); |
|
318 | + wp_redirect(admin_url('edit.php?post_type=give_forms&page=give-payment-history&give-message=donation_deleted')); |
|
319 | 319 | give_die(); |
320 | 320 | } |
321 | 321 | } |
322 | 322 | |
323 | -add_action( 'give_delete_payment', 'give_trigger_purchase_delete' ); |
|
323 | +add_action('give_delete_payment', 'give_trigger_purchase_delete'); |
|
324 | 324 | |
325 | 325 | /** |
326 | 326 | * AJAX Store Donation Note |
327 | 327 | */ |
328 | 328 | function give_ajax_store_payment_note() { |
329 | 329 | |
330 | - $payment_id = absint( $_POST['payment_id'] ); |
|
331 | - $note = wp_kses( $_POST['note'], array() ); |
|
330 | + $payment_id = absint($_POST['payment_id']); |
|
331 | + $note = wp_kses($_POST['note'], array()); |
|
332 | 332 | |
333 | - if ( ! current_user_can( 'edit_give_payments', $payment_id ) ) { |
|
334 | - wp_die( esc_html__( 'You do not have permission to edit payments.', 'give' ), esc_html__( 'Error', 'give' ), array( 'response' => 403 ) ); |
|
333 | + if ( ! current_user_can('edit_give_payments', $payment_id)) { |
|
334 | + wp_die(esc_html__('You do not have permission to edit payments.', 'give'), esc_html__('Error', 'give'), array('response' => 403)); |
|
335 | 335 | } |
336 | 336 | |
337 | - if ( empty( $payment_id ) ) { |
|
338 | - die( '-1' ); |
|
337 | + if (empty($payment_id)) { |
|
338 | + die('-1'); |
|
339 | 339 | } |
340 | 340 | |
341 | - if ( empty( $note ) ) { |
|
342 | - die( '-1' ); |
|
341 | + if (empty($note)) { |
|
342 | + die('-1'); |
|
343 | 343 | } |
344 | 344 | |
345 | - $note_id = give_insert_payment_note( $payment_id, $note ); |
|
346 | - die( give_get_payment_note_html( $note_id ) ); |
|
345 | + $note_id = give_insert_payment_note($payment_id, $note); |
|
346 | + die(give_get_payment_note_html($note_id)); |
|
347 | 347 | } |
348 | 348 | |
349 | -add_action( 'wp_ajax_give_insert_payment_note', 'give_ajax_store_payment_note' ); |
|
349 | +add_action('wp_ajax_give_insert_payment_note', 'give_ajax_store_payment_note'); |
|
350 | 350 | |
351 | 351 | /** |
352 | 352 | * Triggers a donation note deletion without ajax |
@@ -357,24 +357,24 @@ discard block |
||
357 | 357 | * |
358 | 358 | * @return void |
359 | 359 | */ |
360 | -function give_trigger_payment_note_deletion( $data ) { |
|
360 | +function give_trigger_payment_note_deletion($data) { |
|
361 | 361 | |
362 | - if ( ! wp_verify_nonce( $data['_wpnonce'], 'give_delete_payment_note_' . $data['note_id'] ) ) { |
|
362 | + if ( ! wp_verify_nonce($data['_wpnonce'], 'give_delete_payment_note_'.$data['note_id'])) { |
|
363 | 363 | return; |
364 | 364 | } |
365 | 365 | |
366 | - if ( ! current_user_can( 'edit_give_payments', $data['payment_id'] ) ) { |
|
367 | - wp_die( esc_html__( 'You do not have permission to edit payments.', 'give' ), esc_html__( 'Error', 'give' ), array( 'response' => 403 ) ); |
|
366 | + if ( ! current_user_can('edit_give_payments', $data['payment_id'])) { |
|
367 | + wp_die(esc_html__('You do not have permission to edit payments.', 'give'), esc_html__('Error', 'give'), array('response' => 403)); |
|
368 | 368 | } |
369 | 369 | |
370 | - $edit_order_url = admin_url( 'edit.php?post_type=give_forms&page=give-payment-history&view=view-order-details&give-message=donation-note-deleted&id=' . absint( $data['payment_id'] ) ); |
|
370 | + $edit_order_url = admin_url('edit.php?post_type=give_forms&page=give-payment-history&view=view-order-details&give-message=donation-note-deleted&id='.absint($data['payment_id'])); |
|
371 | 371 | |
372 | - give_delete_payment_note( $data['note_id'], $data['payment_id'] ); |
|
372 | + give_delete_payment_note($data['note_id'], $data['payment_id']); |
|
373 | 373 | |
374 | - wp_redirect( $edit_order_url ); |
|
374 | + wp_redirect($edit_order_url); |
|
375 | 375 | } |
376 | 376 | |
377 | -add_action( 'give_delete_payment_note', 'give_trigger_payment_note_deletion' ); |
|
377 | +add_action('give_delete_payment_note', 'give_trigger_payment_note_deletion'); |
|
378 | 378 | |
379 | 379 | /** |
380 | 380 | * Delete a payment note deletion with ajax |
@@ -385,16 +385,16 @@ discard block |
||
385 | 385 | */ |
386 | 386 | function give_ajax_delete_payment_note() { |
387 | 387 | |
388 | - if ( ! current_user_can( 'edit_give_payments', $_POST['payment_id'] ) ) { |
|
389 | - wp_die( esc_html__( 'You do not have permission to edit payments.', 'give' ), esc_html__( 'Error', 'give' ), array( 'response' => 403 ) ); |
|
388 | + if ( ! current_user_can('edit_give_payments', $_POST['payment_id'])) { |
|
389 | + wp_die(esc_html__('You do not have permission to edit payments.', 'give'), esc_html__('Error', 'give'), array('response' => 403)); |
|
390 | 390 | } |
391 | 391 | |
392 | - if ( give_delete_payment_note( $_POST['note_id'], $_POST['payment_id'] ) ) { |
|
393 | - die( '1' ); |
|
392 | + if (give_delete_payment_note($_POST['note_id'], $_POST['payment_id'])) { |
|
393 | + die('1'); |
|
394 | 394 | } else { |
395 | - die( '-1' ); |
|
395 | + die('-1'); |
|
396 | 396 | } |
397 | 397 | |
398 | 398 | } |
399 | 399 | |
400 | -add_action( 'wp_ajax_give_delete_payment_note', 'give_ajax_delete_payment_note' ); |
|
400 | +add_action('wp_ajax_give_delete_payment_note', 'give_ajax_delete_payment_note'); |
@@ -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-order-details' == $_GET['view'] ) { |
|
31 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/payments/view-order-details.php'; |
|
30 | + if (isset($_GET['view']) && 'view-order-details' == $_GET['view']) { |
|
31 | + require_once GIVE_PLUGIN_DIR.'includes/admin/payments/view-order-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,10 +44,10 @@ 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-filter" method="get" action="<?php echo admin_url( 'edit.php?post_type=give_forms&page=give-payment-history' ); ?>"> |
|
50 | + <form id="give-payments-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() ?> |
@@ -61,7 +61,7 @@ discard block |
||
61 | 61 | * |
62 | 62 | * @since 1.7 |
63 | 63 | */ |
64 | - do_action( 'give_payments_page_bottom' ); |
|
64 | + do_action('give_payments_page_bottom'); |
|
65 | 65 | ?> |
66 | 66 | |
67 | 67 | </div> |
@@ -78,29 +78,29 @@ discard block |
||
78 | 78 | * @param $title |
79 | 79 | * @return string |
80 | 80 | */ |
81 | -function give_view_order_details_title( $admin_title, $title ) { |
|
81 | +function give_view_order_details_title($admin_title, $title) { |
|
82 | 82 | |
83 | - if ( 'give_forms_page_give-payment-history' != get_current_screen()->base ) { |
|
83 | + if ('give_forms_page_give-payment-history' != get_current_screen()->base) { |
|
84 | 84 | return $admin_title; |
85 | 85 | } |
86 | 86 | |
87 | - if( ! isset( $_GET['give-action'] ) ) { |
|
87 | + if ( ! isset($_GET['give-action'])) { |
|
88 | 88 | return $admin_title; |
89 | 89 | } |
90 | 90 | |
91 | - switch( $_GET['give-action'] ) : |
|
91 | + switch ($_GET['give-action']) : |
|
92 | 92 | |
93 | 93 | case 'view-order-details' : |
94 | 94 | $title = sprintf( |
95 | 95 | /* translators: %s: admin title */ |
96 | - esc_html__( 'View Donation Details - %s', 'give' ), |
|
96 | + esc_html__('View Donation Details - %s', 'give'), |
|
97 | 97 | $admin_title |
98 | 98 | ); |
99 | 99 | break; |
100 | 100 | case 'edit-payment' : |
101 | 101 | $title = sprintf( |
102 | 102 | /* translators: %s: admin title */ |
103 | - esc_html__( 'Edit Donation - %s', 'give' ), |
|
103 | + esc_html__('Edit Donation - %s', 'give'), |
|
104 | 104 | $admin_title |
105 | 105 | ); |
106 | 106 | break; |
@@ -111,7 +111,7 @@ discard block |
||
111 | 111 | |
112 | 112 | return $title; |
113 | 113 | } |
114 | -add_filter( 'admin_title', 'give_view_order_details_title', 10, 2 ); |
|
114 | +add_filter('admin_title', 'give_view_order_details_title', 10, 2); |
|
115 | 115 | |
116 | 116 | /** |
117 | 117 | * Intercept default Edit post links for Give payments and rewrite them to the View Order Details screen |
@@ -123,20 +123,20 @@ discard block |
||
123 | 123 | * @param $context |
124 | 124 | * @return string |
125 | 125 | */ |
126 | -function give_override_edit_post_for_payment_link( $url, $post_id = 0, $context ) { |
|
126 | +function give_override_edit_post_for_payment_link($url, $post_id = 0, $context) { |
|
127 | 127 | |
128 | - $post = get_post( $post_id ); |
|
128 | + $post = get_post($post_id); |
|
129 | 129 | |
130 | - if( ! $post ) { |
|
130 | + if ( ! $post) { |
|
131 | 131 | return $url; |
132 | 132 | } |
133 | 133 | |
134 | - if( 'give_payment' != $post->post_type ) { |
|
134 | + if ('give_payment' != $post->post_type) { |
|
135 | 135 | return $url; |
136 | 136 | } |
137 | 137 | |
138 | - $url = admin_url( 'edit.php?post_type=give_forms&page=give-payment-history&view=view-order-details&id=' . $post_id ); |
|
138 | + $url = admin_url('edit.php?post_type=give_forms&page=give-payment-history&view=view-order-details&id='.$post_id); |
|
139 | 139 | |
140 | 140 | return $url; |
141 | 141 | } |
142 | -add_filter( 'get_edit_post_link', 'give_override_edit_post_for_payment_link', 10, 3 ); |
|
142 | +add_filter('get_edit_post_link', 'give_override_edit_post_for_payment_link', 10, 3); |
@@ -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,9 +23,9 @@ discard block |
||
23 | 23 | */ |
24 | 24 | function give_get_country() { |
25 | 25 | $give_options = give_get_settings(); |
26 | - $country = isset( $give_options['base_country'] ) ? $give_options['base_country'] : 'US'; |
|
26 | + $country = isset($give_options['base_country']) ? $give_options['base_country'] : 'US'; |
|
27 | 27 | |
28 | - return apply_filters( 'give_give_country', $country ); |
|
28 | + return apply_filters('give_give_country', $country); |
|
29 | 29 | } |
30 | 30 | |
31 | 31 | /** |
@@ -36,9 +36,9 @@ discard block |
||
36 | 36 | */ |
37 | 37 | function give_get_state() { |
38 | 38 | $give_options = give_get_settings(); |
39 | - $state = isset( $give_options['base_state'] ) ? $give_options['base_state'] : false; |
|
39 | + $state = isset($give_options['base_state']) ? $give_options['base_state'] : false; |
|
40 | 40 | |
41 | - return apply_filters( 'give_give_state', $state ); |
|
41 | + return apply_filters('give_give_state', $state); |
|
42 | 42 | } |
43 | 43 | |
44 | 44 | /** |
@@ -50,13 +50,13 @@ discard block |
||
50 | 50 | * |
51 | 51 | * @return mixed|void A list of states for the shop's base country |
52 | 52 | */ |
53 | -function give_get_states( $country = null ) { |
|
53 | +function give_get_states($country = null) { |
|
54 | 54 | |
55 | - if ( empty( $country ) ) { |
|
55 | + if (empty($country)) { |
|
56 | 56 | $country = give_get_country(); |
57 | 57 | } |
58 | 58 | |
59 | - switch ( $country ) : |
|
59 | + switch ($country) : |
|
60 | 60 | |
61 | 61 | case 'US' : |
62 | 62 | $states = give_get_states_list(); |
@@ -106,7 +106,7 @@ discard block |
||
106 | 106 | |
107 | 107 | endswitch; |
108 | 108 | |
109 | - return apply_filters( 'give_give_states', $states ); |
|
109 | + return apply_filters('give_give_states', $states); |
|
110 | 110 | } |
111 | 111 | |
112 | 112 | |
@@ -119,253 +119,253 @@ discard block |
||
119 | 119 | function give_get_country_list() { |
120 | 120 | $countries = array( |
121 | 121 | '' => '', |
122 | - 'US' => esc_html__( 'United States', 'give' ), |
|
123 | - 'CA' => esc_html__( 'Canada', 'give' ), |
|
124 | - 'GB' => esc_html__( 'United Kingdom', 'give' ), |
|
125 | - 'AF' => esc_html__( 'Afghanistan', 'give' ), |
|
126 | - 'AL' => esc_html__( 'Albania', 'give' ), |
|
127 | - 'DZ' => esc_html__( 'Algeria', 'give' ), |
|
128 | - 'AS' => esc_html__( 'American Samoa', 'give' ), |
|
129 | - 'AD' => esc_html__( 'Andorra', 'give' ), |
|
130 | - 'AO' => esc_html__( 'Angola', 'give' ), |
|
131 | - 'AI' => esc_html__( 'Anguilla', 'give' ), |
|
132 | - 'AQ' => esc_html__( 'Antarctica', 'give' ), |
|
133 | - 'AG' => esc_html__( 'Antigua and Barbuda', 'give' ), |
|
134 | - 'AR' => esc_html__( 'Argentina', 'give' ), |
|
135 | - 'AM' => esc_html__( 'Armenia', 'give' ), |
|
136 | - 'AW' => esc_html__( 'Aruba', 'give' ), |
|
137 | - 'AU' => esc_html__( 'Australia', 'give' ), |
|
138 | - 'AT' => esc_html__( 'Austria', 'give' ), |
|
139 | - 'AZ' => esc_html__( 'Azerbaijan', 'give' ), |
|
140 | - 'BS' => esc_html__( 'Bahamas', 'give'), |
|
141 | - 'BH' => esc_html__( 'Bahrain', 'give' ), |
|
142 | - 'BD' => esc_html__( 'Bangladesh', 'give' ), |
|
143 | - 'BB' => esc_html__( 'Barbados', 'give' ), |
|
144 | - 'BY' => esc_html__( 'Belarus', 'give' ), |
|
145 | - 'BE' => esc_html__( 'Belgium', 'give' ), |
|
146 | - 'BZ' => esc_html__( 'Belize', 'give' ), |
|
147 | - 'BJ' => esc_html__( 'Benin', 'give' ), |
|
148 | - 'BM' => esc_html__( 'Bermuda', 'give' ), |
|
149 | - 'BT' => esc_html__( 'Bhutan', 'give' ), |
|
150 | - 'BO' => esc_html__( 'Bolivia', 'give' ), |
|
151 | - 'BA' => esc_html__( 'Bosnia and Herzegovina', 'give' ), |
|
152 | - 'BW' => esc_html__( 'Botswana', 'give' ), |
|
153 | - 'BV' => esc_html__( 'Bouvet Island', 'give' ), |
|
154 | - 'BR' => esc_html__( 'Brazil', 'give' ), |
|
155 | - 'IO' => esc_html__( 'British Indian Ocean Territory', 'give' ), |
|
156 | - 'BN' => esc_html__( 'Brunei Darrussalam', 'give' ), |
|
157 | - 'BG' => esc_html__( 'Bulgaria', 'give' ), |
|
158 | - 'BF' => esc_html__( 'Burkina Faso', 'give' ), |
|
159 | - 'BI' => esc_html__( 'Burundi', 'give' ), |
|
160 | - 'KH' => esc_html__( 'Cambodia', 'give' ), |
|
161 | - 'CM' => esc_html__( 'Cameroon', 'give' ), |
|
162 | - 'CV' => esc_html__( 'Cape Verde', 'give' ), |
|
163 | - 'KY' => esc_html__( 'Cayman Islands', 'give' ), |
|
164 | - 'CF' => esc_html__( 'Central African Republic', 'give' ), |
|
165 | - 'TD' => esc_html__( 'Chad', 'give' ), |
|
166 | - 'CL' => esc_html__( 'Chile', 'give' ), |
|
167 | - 'CN' => esc_html__( 'China', 'give' ), |
|
168 | - 'CX' => esc_html__( 'Christmas Island', 'give' ), |
|
169 | - 'CC' => esc_html__( 'Cocos Islands', 'give' ), |
|
170 | - 'CO' => esc_html__( 'Colombia', 'give' ), |
|
171 | - 'KM' => esc_html__( 'Comoros', 'give' ), |
|
172 | - 'CD' => esc_html__( 'Congo, Democratic People\'s Republic', 'give' ), |
|
173 | - 'CG' => esc_html__( 'Congo, Republic of', 'give' ), |
|
174 | - 'CK' => esc_html__( 'Cook Islands', 'give' ), |
|
175 | - 'CR' => esc_html__( 'Costa Rica', 'give' ), |
|
176 | - 'CI' => esc_html__( 'Cote d\'Ivoire', 'give' ), |
|
177 | - 'HR' => esc_html__( 'Croatia/Hrvatska', 'give' ), |
|
178 | - 'CU' => esc_html__( 'Cuba', 'give' ), |
|
179 | - 'CY' => esc_html__( 'Cyprus Island', 'give' ), |
|
180 | - 'CZ' => esc_html__( 'Czech Republic', 'give' ), |
|
181 | - 'DK' => esc_html__( 'Denmark', 'give' ), |
|
182 | - 'DJ' => esc_html__( 'Djibouti', 'give' ), |
|
183 | - 'DM' => esc_html__( 'Dominica', 'give' ), |
|
184 | - 'DO' => esc_html__( 'Dominican Republic', 'give' ), |
|
185 | - 'TP' => esc_html__( 'East Timor', 'give' ), |
|
186 | - 'EC' => esc_html__( 'Ecuador', 'give' ), |
|
187 | - 'EG' => esc_html__( 'Egypt', 'give' ), |
|
188 | - 'GQ' => esc_html__( 'Equatorial Guinea', 'give' ), |
|
189 | - 'SV' => esc_html__( 'El Salvador', 'give' ), |
|
190 | - 'ER' => esc_html__( 'Eritrea', 'give' ), |
|
191 | - 'EE' => esc_html__( 'Estonia', 'give' ), |
|
192 | - 'ET' => esc_html__( 'Ethiopia', 'give' ), |
|
193 | - 'FK' => esc_html__( 'Falkland Islands', 'give' ), |
|
194 | - 'FO' => esc_html__( 'Faroe Islands', 'give' ), |
|
195 | - 'FJ' => esc_html__( 'Fiji', 'give' ), |
|
196 | - 'FI' => esc_html__( 'Finland', 'give' ), |
|
197 | - 'FR' => esc_html__( 'France', 'give' ), |
|
198 | - 'GF' => esc_html__( 'French Guiana', 'give' ), |
|
199 | - 'PF' => esc_html__( 'French Polynesia', 'give' ), |
|
200 | - 'TF' => esc_html__( 'French Southern Territories', 'give' ), |
|
201 | - 'GA' => esc_html__( 'Gabon', 'give' ), |
|
202 | - 'GM' => esc_html__( 'Gambia', 'give' ), |
|
203 | - 'GE' => esc_html__( 'Georgia', 'give' ), |
|
204 | - 'DE' => esc_html__( 'Germany', 'give' ), |
|
205 | - 'GR' => esc_html__( 'Greece', 'give' ), |
|
206 | - 'GH' => esc_html__( 'Ghana', 'give' ), |
|
207 | - 'GI' => esc_html__( 'Gibraltar', 'give' ), |
|
208 | - 'GL' => esc_html__( 'Greenland', 'give' ), |
|
209 | - 'GD' => esc_html__( 'Grenada', 'give' ), |
|
210 | - 'GP' => esc_html__( 'Guadeloupe', 'give' ), |
|
211 | - 'GU' => esc_html__( 'Guam', 'give' ), |
|
212 | - 'GT' => esc_html__( 'Guatemala', 'give' ), |
|
213 | - 'GG' => esc_html__( 'Guernsey', 'give' ), |
|
214 | - 'GN' => esc_html__( 'Guinea', 'give' ), |
|
215 | - 'GW' => esc_html__( 'Guinea-Bissau', 'give' ), |
|
216 | - 'GY' => esc_html__( 'Guyana', 'give' ), |
|
217 | - 'HT' => esc_html__( 'Haiti', 'give' ), |
|
218 | - 'HM' => esc_html__( 'Heard and McDonald Islands', 'give' ), |
|
219 | - 'VA' => esc_html__( 'Holy See (City Vatican State)', 'give' ), |
|
220 | - 'HN' => esc_html__( 'Honduras', 'give' ), |
|
221 | - 'HK' => esc_html__( 'Hong Kong', 'give' ), |
|
222 | - 'HU' => esc_html__( 'Hungary', 'give' ), |
|
223 | - 'IS' => esc_html__( 'Iceland', 'give' ), |
|
224 | - 'IN' => esc_html__( 'India', 'give' ), |
|
225 | - 'ID' => esc_html__( 'Indonesia', 'give' ), |
|
226 | - 'IR' => esc_html__( 'Iran', 'give' ), |
|
227 | - 'IQ' => esc_html__( 'Iraq', 'give' ), |
|
228 | - 'IE' => esc_html__( 'Ireland', 'give' ), |
|
229 | - 'IM' => esc_html__( 'Isle of Man', 'give' ), |
|
230 | - 'IL' => esc_html__( 'Israel', 'give' ), |
|
231 | - 'IT' => esc_html__( 'Italy', 'give' ), |
|
232 | - 'JM' => esc_html__( 'Jamaica', 'give' ), |
|
233 | - 'JP' => esc_html__( 'Japan', 'give' ), |
|
234 | - 'JE' => esc_html__( 'Jersey', 'give' ), |
|
235 | - 'JO' => esc_html__( 'Jordan', 'give' ), |
|
236 | - 'KZ' => esc_html__( 'Kazakhstan', 'give' ), |
|
237 | - 'KE' => esc_html__( 'Kenya', 'give' ), |
|
238 | - 'KI' => esc_html__( 'Kiribati', 'give' ), |
|
239 | - 'KW' => esc_html__( 'Kuwait', 'give' ), |
|
240 | - 'KG' => esc_html__( 'Kyrgyzstan', 'give' ), |
|
241 | - 'LA' => esc_html__( 'Lao People\'s Democratic Republic', 'give' ), |
|
242 | - 'LV' => esc_html__( 'Latvia', 'give' ), |
|
243 | - 'LB' => esc_html__( 'Lebanon', 'give' ), |
|
244 | - 'LS' => esc_html__( 'Lesotho', 'give' ), |
|
245 | - 'LR' => esc_html__( 'Liberia', 'give' ), |
|
246 | - 'LY' => esc_html__( 'Libyan Arab Jamahiriya', 'give' ), |
|
247 | - 'LI' => esc_html__( 'Liechtenstein', 'give' ), |
|
248 | - 'LT' => esc_html__( 'Lithuania', 'give' ), |
|
249 | - 'LU' => esc_html__( 'Luxembourg', 'give' ), |
|
250 | - 'MO' => esc_html__( 'Macau', 'give' ), |
|
251 | - 'MK' => esc_html__( 'Macedonia', 'give' ), |
|
252 | - 'MG' => esc_html__( 'Madagascar', 'give' ), |
|
253 | - 'MW' => esc_html__( 'Malawi', 'give' ), |
|
254 | - 'MY' => esc_html__( 'Malaysia', 'give' ), |
|
255 | - 'MV' => esc_html__( 'Maldives', 'give' ), |
|
256 | - 'ML' => esc_html__( 'Mali', 'give' ), |
|
257 | - 'MT' => esc_html__( 'Malta', 'give' ), |
|
258 | - 'MH' => esc_html__( 'Marshall Islands', 'give' ), |
|
259 | - 'MQ' => esc_html__( 'Martinique', 'give' ), |
|
260 | - 'MR' => esc_html__( 'Mauritania', 'give' ), |
|
261 | - 'MU' => esc_html__( 'Mauritius', 'give' ), |
|
262 | - 'YT' => esc_html__( 'Mayotte', 'give' ), |
|
263 | - 'MX' => esc_html__( 'Mexico', 'give' ), |
|
264 | - 'FM' => esc_html__( 'Micronesia', 'give' ), |
|
265 | - 'MD' => esc_html__( 'Moldova, Republic of', 'give' ), |
|
266 | - 'MC' => esc_html__( 'Monaco', 'give' ), |
|
267 | - 'MN' => esc_html__( 'Mongolia', 'give' ), |
|
268 | - 'ME' => esc_html__( 'Montenegro', 'give' ), |
|
269 | - 'MS' => esc_html__( 'Montserrat', 'give' ), |
|
270 | - 'MA' => esc_html__( 'Morocco', 'give' ), |
|
271 | - 'MZ' => esc_html__( 'Mozambique', 'give' ), |
|
272 | - 'MM' => esc_html__( 'Myanmar', 'give' ), |
|
273 | - 'NA' => esc_html__( 'Namibia', 'give' ), |
|
274 | - 'NR' => esc_html__( 'Nauru', 'give' ), |
|
275 | - 'NP' => esc_html__( 'Nepal', 'give' ), |
|
276 | - 'NL' => esc_html__( 'Netherlands', 'give' ), |
|
277 | - 'AN' => esc_html__( 'Netherlands Antilles', 'give' ), |
|
278 | - 'NC' => esc_html__( 'New Caledonia', 'give' ), |
|
279 | - 'NZ' => esc_html__( 'New Zealand', 'give' ), |
|
280 | - 'NI' => esc_html__( 'Nicaragua', 'give' ), |
|
281 | - 'NE' => esc_html__( 'Niger', 'give' ), |
|
282 | - 'NG' => esc_html__( 'Nigeria', 'give' ), |
|
283 | - 'NU' => esc_html__( 'Niue', 'give' ), |
|
284 | - 'NF' => esc_html__( 'Norfolk Island', 'give' ), |
|
285 | - 'KP' => esc_html__( 'North Korea', 'give' ), |
|
286 | - 'MP' => esc_html__( 'Northern Mariana Islands', 'give' ), |
|
287 | - 'NO' => esc_html__( 'Norway', 'give' ), |
|
288 | - 'OM' => esc_html__( 'Oman', 'give' ), |
|
289 | - 'PK' => esc_html__( 'Pakistan', 'give' ), |
|
290 | - 'PW' => esc_html__( 'Palau', 'give' ), |
|
291 | - 'PS' => esc_html__( 'Palestinian Territories', 'give' ), |
|
292 | - 'PA' => esc_html__( 'Panama', 'give' ), |
|
293 | - 'PG' => esc_html__( 'Papua New Guinea', 'give' ), |
|
294 | - 'PY' => esc_html__( 'Paraguay', 'give' ), |
|
295 | - 'PE' => esc_html__( 'Peru', 'give' ), |
|
296 | - 'PH' => esc_html__( 'Phillipines', 'give' ), |
|
297 | - 'PN' => esc_html__( 'Pitcairn Island', 'give' ), |
|
298 | - 'PL' => esc_html__( 'Poland', 'give' ), |
|
299 | - 'PT' => esc_html__( 'Portugal', 'give' ), |
|
300 | - 'PR' => esc_html__( 'Puerto Rico', 'give' ), |
|
301 | - 'QA' => esc_html__( 'Qatar', 'give' ), |
|
302 | - 'RE' => esc_html__( 'Reunion Island', 'give' ), |
|
303 | - 'RO' => esc_html__( 'Romania', 'give' ), |
|
304 | - 'RU' => esc_html__( 'Russian Federation', 'give' ), |
|
305 | - 'RW' => esc_html__( 'Rwanda', 'give' ), |
|
306 | - 'SH' => esc_html__( 'Saint Helena', 'give' ), |
|
307 | - 'KN' => esc_html__( 'Saint Kitts and Nevis', 'give' ), |
|
308 | - 'LC' => esc_html__( 'Saint Lucia', 'give' ), |
|
309 | - 'PM' => esc_html__( 'Saint Pierre and Miquelon', 'give' ), |
|
310 | - 'VC' => esc_html__( 'Saint Vincent and the Grenadines', 'give' ), |
|
311 | - 'SM' => esc_html__( 'San Marino', 'give' ), |
|
312 | - 'ST' => esc_html__( 'Sao Tome and Principe', 'give' ), |
|
313 | - 'SA' => esc_html__( 'Saudi Arabia', 'give' ), |
|
314 | - 'SN' => esc_html__( 'Senegal', 'give' ), |
|
315 | - 'RS' => esc_html__( 'Serbia', 'give' ), |
|
316 | - 'SC' => esc_html__( 'Seychelles', 'give' ), |
|
317 | - 'SL' => esc_html__( 'Sierra Leone', 'give' ), |
|
318 | - 'SG' => esc_html__( 'Singapore', 'give' ), |
|
319 | - 'SK' => esc_html__( 'Slovak Republic', 'give' ), |
|
320 | - 'SI' => esc_html__( 'Slovenia', 'give' ), |
|
321 | - 'SB' => esc_html__( 'Solomon Islands', 'give' ), |
|
322 | - 'SO' => esc_html__( 'Somalia', 'give' ), |
|
323 | - 'ZA' => esc_html__( 'South Africa', 'give' ), |
|
324 | - 'GS' => esc_html__( 'South Georgia', 'give' ), |
|
325 | - 'KR' => esc_html__( 'South Korea', 'give' ), |
|
326 | - 'ES' => esc_html__( 'Spain', 'give' ), |
|
327 | - 'LK' => esc_html__( 'Sri Lanka', 'give' ), |
|
328 | - 'SD' => esc_html__( 'Sudan', 'give' ), |
|
329 | - 'SR' => esc_html__( 'Suriname', 'give' ), |
|
330 | - 'SJ' => esc_html__( 'Svalbard and Jan Mayen Islands', 'give' ), |
|
331 | - 'SZ' => esc_html__( 'Swaziland', 'give' ), |
|
332 | - 'SE' => esc_html__( 'Sweden', 'give' ), |
|
333 | - 'CH' => esc_html__( 'Switzerland', 'give' ), |
|
334 | - 'SY' => esc_html__( 'Syrian Arab Republic', 'give' ), |
|
335 | - 'TW' => esc_html__( 'Taiwan', 'give' ), |
|
336 | - 'TJ' => esc_html__( 'Tajikistan', 'give' ), |
|
337 | - 'TZ' => esc_html__( 'Tanzania', 'give' ), |
|
338 | - 'TG' => esc_html__( 'Togo', 'give' ), |
|
339 | - 'TK' => esc_html__( 'Tokelau', 'give' ), |
|
340 | - 'TO' => esc_html__( 'Tonga', 'give' ), |
|
341 | - 'TH' => esc_html__( 'Thailand', 'give' ), |
|
342 | - 'TT' => esc_html__( 'Trinidad and Tobago', 'give' ), |
|
343 | - 'TN' => esc_html__( 'Tunisia', 'give' ), |
|
344 | - 'TR' => esc_html__( 'Turkey', 'give' ), |
|
345 | - 'TM' => esc_html__( 'Turkmenistan', 'give' ), |
|
346 | - 'TC' => esc_html__( 'Turks and Caicos Islands', 'give' ), |
|
347 | - 'TV' => esc_html__( 'Tuvalu', 'give' ), |
|
348 | - 'UG' => esc_html__( 'Uganda', 'give' ), |
|
349 | - 'UA' => esc_html__( 'Ukraine', 'give' ), |
|
350 | - 'AE' => esc_html__( 'United Arab Emirates', 'give' ), |
|
351 | - 'UY' => esc_html__( 'Uruguay', 'give' ), |
|
352 | - 'UM' => esc_html__( 'US Minor Outlying Islands', 'give' ), |
|
353 | - 'UZ' => esc_html__( 'Uzbekistan', 'give' ), |
|
354 | - 'VU' => esc_html__( 'Vanuatu', 'give' ), |
|
355 | - 'VE' => esc_html__( 'Venezuela', 'give' ), |
|
356 | - 'VN' => esc_html__( 'Vietnam', 'give' ), |
|
357 | - 'VG' => esc_html__( 'Virgin Islands (British)', 'give' ), |
|
358 | - 'VI' => esc_html__( 'Virgin Islands (USA)', 'give' ), |
|
359 | - 'WF' => esc_html__( 'Wallis and Futuna Islands', 'give' ), |
|
360 | - 'EH' => esc_html__( 'Western Sahara', 'give' ), |
|
361 | - 'WS' => esc_html__( 'Western Samoa', 'give' ), |
|
362 | - 'YE' => esc_html__( 'Yemen', 'give' ), |
|
363 | - 'YU' => esc_html__( 'Yugoslavia', 'give' ), |
|
364 | - 'ZM' => esc_html__( 'Zambia', 'give' ), |
|
365 | - 'ZW' => esc_html__( 'Zimbabwe', 'give' ) |
|
122 | + 'US' => esc_html__('United States', 'give'), |
|
123 | + 'CA' => esc_html__('Canada', 'give'), |
|
124 | + 'GB' => esc_html__('United Kingdom', 'give'), |
|
125 | + 'AF' => esc_html__('Afghanistan', 'give'), |
|
126 | + 'AL' => esc_html__('Albania', 'give'), |
|
127 | + 'DZ' => esc_html__('Algeria', 'give'), |
|
128 | + 'AS' => esc_html__('American Samoa', 'give'), |
|
129 | + 'AD' => esc_html__('Andorra', 'give'), |
|
130 | + 'AO' => esc_html__('Angola', 'give'), |
|
131 | + 'AI' => esc_html__('Anguilla', 'give'), |
|
132 | + 'AQ' => esc_html__('Antarctica', 'give'), |
|
133 | + 'AG' => esc_html__('Antigua and Barbuda', 'give'), |
|
134 | + 'AR' => esc_html__('Argentina', 'give'), |
|
135 | + 'AM' => esc_html__('Armenia', 'give'), |
|
136 | + 'AW' => esc_html__('Aruba', 'give'), |
|
137 | + 'AU' => esc_html__('Australia', 'give'), |
|
138 | + 'AT' => esc_html__('Austria', 'give'), |
|
139 | + 'AZ' => esc_html__('Azerbaijan', 'give'), |
|
140 | + 'BS' => esc_html__('Bahamas', 'give'), |
|
141 | + 'BH' => esc_html__('Bahrain', 'give'), |
|
142 | + 'BD' => esc_html__('Bangladesh', 'give'), |
|
143 | + 'BB' => esc_html__('Barbados', 'give'), |
|
144 | + 'BY' => esc_html__('Belarus', 'give'), |
|
145 | + 'BE' => esc_html__('Belgium', 'give'), |
|
146 | + 'BZ' => esc_html__('Belize', 'give'), |
|
147 | + 'BJ' => esc_html__('Benin', 'give'), |
|
148 | + 'BM' => esc_html__('Bermuda', 'give'), |
|
149 | + 'BT' => esc_html__('Bhutan', 'give'), |
|
150 | + 'BO' => esc_html__('Bolivia', 'give'), |
|
151 | + 'BA' => esc_html__('Bosnia and Herzegovina', 'give'), |
|
152 | + 'BW' => esc_html__('Botswana', 'give'), |
|
153 | + 'BV' => esc_html__('Bouvet Island', 'give'), |
|
154 | + 'BR' => esc_html__('Brazil', 'give'), |
|
155 | + 'IO' => esc_html__('British Indian Ocean Territory', 'give'), |
|
156 | + 'BN' => esc_html__('Brunei Darrussalam', 'give'), |
|
157 | + 'BG' => esc_html__('Bulgaria', 'give'), |
|
158 | + 'BF' => esc_html__('Burkina Faso', 'give'), |
|
159 | + 'BI' => esc_html__('Burundi', 'give'), |
|
160 | + 'KH' => esc_html__('Cambodia', 'give'), |
|
161 | + 'CM' => esc_html__('Cameroon', 'give'), |
|
162 | + 'CV' => esc_html__('Cape Verde', 'give'), |
|
163 | + 'KY' => esc_html__('Cayman Islands', 'give'), |
|
164 | + 'CF' => esc_html__('Central African Republic', 'give'), |
|
165 | + 'TD' => esc_html__('Chad', 'give'), |
|
166 | + 'CL' => esc_html__('Chile', 'give'), |
|
167 | + 'CN' => esc_html__('China', 'give'), |
|
168 | + 'CX' => esc_html__('Christmas Island', 'give'), |
|
169 | + 'CC' => esc_html__('Cocos Islands', 'give'), |
|
170 | + 'CO' => esc_html__('Colombia', 'give'), |
|
171 | + 'KM' => esc_html__('Comoros', 'give'), |
|
172 | + 'CD' => esc_html__('Congo, Democratic People\'s Republic', 'give'), |
|
173 | + 'CG' => esc_html__('Congo, Republic of', 'give'), |
|
174 | + 'CK' => esc_html__('Cook Islands', 'give'), |
|
175 | + 'CR' => esc_html__('Costa Rica', 'give'), |
|
176 | + 'CI' => esc_html__('Cote d\'Ivoire', 'give'), |
|
177 | + 'HR' => esc_html__('Croatia/Hrvatska', 'give'), |
|
178 | + 'CU' => esc_html__('Cuba', 'give'), |
|
179 | + 'CY' => esc_html__('Cyprus Island', 'give'), |
|
180 | + 'CZ' => esc_html__('Czech Republic', 'give'), |
|
181 | + 'DK' => esc_html__('Denmark', 'give'), |
|
182 | + 'DJ' => esc_html__('Djibouti', 'give'), |
|
183 | + 'DM' => esc_html__('Dominica', 'give'), |
|
184 | + 'DO' => esc_html__('Dominican Republic', 'give'), |
|
185 | + 'TP' => esc_html__('East Timor', 'give'), |
|
186 | + 'EC' => esc_html__('Ecuador', 'give'), |
|
187 | + 'EG' => esc_html__('Egypt', 'give'), |
|
188 | + 'GQ' => esc_html__('Equatorial Guinea', 'give'), |
|
189 | + 'SV' => esc_html__('El Salvador', 'give'), |
|
190 | + 'ER' => esc_html__('Eritrea', 'give'), |
|
191 | + 'EE' => esc_html__('Estonia', 'give'), |
|
192 | + 'ET' => esc_html__('Ethiopia', 'give'), |
|
193 | + 'FK' => esc_html__('Falkland Islands', 'give'), |
|
194 | + 'FO' => esc_html__('Faroe Islands', 'give'), |
|
195 | + 'FJ' => esc_html__('Fiji', 'give'), |
|
196 | + 'FI' => esc_html__('Finland', 'give'), |
|
197 | + 'FR' => esc_html__('France', 'give'), |
|
198 | + 'GF' => esc_html__('French Guiana', 'give'), |
|
199 | + 'PF' => esc_html__('French Polynesia', 'give'), |
|
200 | + 'TF' => esc_html__('French Southern Territories', 'give'), |
|
201 | + 'GA' => esc_html__('Gabon', 'give'), |
|
202 | + 'GM' => esc_html__('Gambia', 'give'), |
|
203 | + 'GE' => esc_html__('Georgia', 'give'), |
|
204 | + 'DE' => esc_html__('Germany', 'give'), |
|
205 | + 'GR' => esc_html__('Greece', 'give'), |
|
206 | + 'GH' => esc_html__('Ghana', 'give'), |
|
207 | + 'GI' => esc_html__('Gibraltar', 'give'), |
|
208 | + 'GL' => esc_html__('Greenland', 'give'), |
|
209 | + 'GD' => esc_html__('Grenada', 'give'), |
|
210 | + 'GP' => esc_html__('Guadeloupe', 'give'), |
|
211 | + 'GU' => esc_html__('Guam', 'give'), |
|
212 | + 'GT' => esc_html__('Guatemala', 'give'), |
|
213 | + 'GG' => esc_html__('Guernsey', 'give'), |
|
214 | + 'GN' => esc_html__('Guinea', 'give'), |
|
215 | + 'GW' => esc_html__('Guinea-Bissau', 'give'), |
|
216 | + 'GY' => esc_html__('Guyana', 'give'), |
|
217 | + 'HT' => esc_html__('Haiti', 'give'), |
|
218 | + 'HM' => esc_html__('Heard and McDonald Islands', 'give'), |
|
219 | + 'VA' => esc_html__('Holy See (City Vatican State)', 'give'), |
|
220 | + 'HN' => esc_html__('Honduras', 'give'), |
|
221 | + 'HK' => esc_html__('Hong Kong', 'give'), |
|
222 | + 'HU' => esc_html__('Hungary', 'give'), |
|
223 | + 'IS' => esc_html__('Iceland', 'give'), |
|
224 | + 'IN' => esc_html__('India', 'give'), |
|
225 | + 'ID' => esc_html__('Indonesia', 'give'), |
|
226 | + 'IR' => esc_html__('Iran', 'give'), |
|
227 | + 'IQ' => esc_html__('Iraq', 'give'), |
|
228 | + 'IE' => esc_html__('Ireland', 'give'), |
|
229 | + 'IM' => esc_html__('Isle of Man', 'give'), |
|
230 | + 'IL' => esc_html__('Israel', 'give'), |
|
231 | + 'IT' => esc_html__('Italy', 'give'), |
|
232 | + 'JM' => esc_html__('Jamaica', 'give'), |
|
233 | + 'JP' => esc_html__('Japan', 'give'), |
|
234 | + 'JE' => esc_html__('Jersey', 'give'), |
|
235 | + 'JO' => esc_html__('Jordan', 'give'), |
|
236 | + 'KZ' => esc_html__('Kazakhstan', 'give'), |
|
237 | + 'KE' => esc_html__('Kenya', 'give'), |
|
238 | + 'KI' => esc_html__('Kiribati', 'give'), |
|
239 | + 'KW' => esc_html__('Kuwait', 'give'), |
|
240 | + 'KG' => esc_html__('Kyrgyzstan', 'give'), |
|
241 | + 'LA' => esc_html__('Lao People\'s Democratic Republic', 'give'), |
|
242 | + 'LV' => esc_html__('Latvia', 'give'), |
|
243 | + 'LB' => esc_html__('Lebanon', 'give'), |
|
244 | + 'LS' => esc_html__('Lesotho', 'give'), |
|
245 | + 'LR' => esc_html__('Liberia', 'give'), |
|
246 | + 'LY' => esc_html__('Libyan Arab Jamahiriya', 'give'), |
|
247 | + 'LI' => esc_html__('Liechtenstein', 'give'), |
|
248 | + 'LT' => esc_html__('Lithuania', 'give'), |
|
249 | + 'LU' => esc_html__('Luxembourg', 'give'), |
|
250 | + 'MO' => esc_html__('Macau', 'give'), |
|
251 | + 'MK' => esc_html__('Macedonia', 'give'), |
|
252 | + 'MG' => esc_html__('Madagascar', 'give'), |
|
253 | + 'MW' => esc_html__('Malawi', 'give'), |
|
254 | + 'MY' => esc_html__('Malaysia', 'give'), |
|
255 | + 'MV' => esc_html__('Maldives', 'give'), |
|
256 | + 'ML' => esc_html__('Mali', 'give'), |
|
257 | + 'MT' => esc_html__('Malta', 'give'), |
|
258 | + 'MH' => esc_html__('Marshall Islands', 'give'), |
|
259 | + 'MQ' => esc_html__('Martinique', 'give'), |
|
260 | + 'MR' => esc_html__('Mauritania', 'give'), |
|
261 | + 'MU' => esc_html__('Mauritius', 'give'), |
|
262 | + 'YT' => esc_html__('Mayotte', 'give'), |
|
263 | + 'MX' => esc_html__('Mexico', 'give'), |
|
264 | + 'FM' => esc_html__('Micronesia', 'give'), |
|
265 | + 'MD' => esc_html__('Moldova, Republic of', 'give'), |
|
266 | + 'MC' => esc_html__('Monaco', 'give'), |
|
267 | + 'MN' => esc_html__('Mongolia', 'give'), |
|
268 | + 'ME' => esc_html__('Montenegro', 'give'), |
|
269 | + 'MS' => esc_html__('Montserrat', 'give'), |
|
270 | + 'MA' => esc_html__('Morocco', 'give'), |
|
271 | + 'MZ' => esc_html__('Mozambique', 'give'), |
|
272 | + 'MM' => esc_html__('Myanmar', 'give'), |
|
273 | + 'NA' => esc_html__('Namibia', 'give'), |
|
274 | + 'NR' => esc_html__('Nauru', 'give'), |
|
275 | + 'NP' => esc_html__('Nepal', 'give'), |
|
276 | + 'NL' => esc_html__('Netherlands', 'give'), |
|
277 | + 'AN' => esc_html__('Netherlands Antilles', 'give'), |
|
278 | + 'NC' => esc_html__('New Caledonia', 'give'), |
|
279 | + 'NZ' => esc_html__('New Zealand', 'give'), |
|
280 | + 'NI' => esc_html__('Nicaragua', 'give'), |
|
281 | + 'NE' => esc_html__('Niger', 'give'), |
|
282 | + 'NG' => esc_html__('Nigeria', 'give'), |
|
283 | + 'NU' => esc_html__('Niue', 'give'), |
|
284 | + 'NF' => esc_html__('Norfolk Island', 'give'), |
|
285 | + 'KP' => esc_html__('North Korea', 'give'), |
|
286 | + 'MP' => esc_html__('Northern Mariana Islands', 'give'), |
|
287 | + 'NO' => esc_html__('Norway', 'give'), |
|
288 | + 'OM' => esc_html__('Oman', 'give'), |
|
289 | + 'PK' => esc_html__('Pakistan', 'give'), |
|
290 | + 'PW' => esc_html__('Palau', 'give'), |
|
291 | + 'PS' => esc_html__('Palestinian Territories', 'give'), |
|
292 | + 'PA' => esc_html__('Panama', 'give'), |
|
293 | + 'PG' => esc_html__('Papua New Guinea', 'give'), |
|
294 | + 'PY' => esc_html__('Paraguay', 'give'), |
|
295 | + 'PE' => esc_html__('Peru', 'give'), |
|
296 | + 'PH' => esc_html__('Phillipines', 'give'), |
|
297 | + 'PN' => esc_html__('Pitcairn Island', 'give'), |
|
298 | + 'PL' => esc_html__('Poland', 'give'), |
|
299 | + 'PT' => esc_html__('Portugal', 'give'), |
|
300 | + 'PR' => esc_html__('Puerto Rico', 'give'), |
|
301 | + 'QA' => esc_html__('Qatar', 'give'), |
|
302 | + 'RE' => esc_html__('Reunion Island', 'give'), |
|
303 | + 'RO' => esc_html__('Romania', 'give'), |
|
304 | + 'RU' => esc_html__('Russian Federation', 'give'), |
|
305 | + 'RW' => esc_html__('Rwanda', 'give'), |
|
306 | + 'SH' => esc_html__('Saint Helena', 'give'), |
|
307 | + 'KN' => esc_html__('Saint Kitts and Nevis', 'give'), |
|
308 | + 'LC' => esc_html__('Saint Lucia', 'give'), |
|
309 | + 'PM' => esc_html__('Saint Pierre and Miquelon', 'give'), |
|
310 | + 'VC' => esc_html__('Saint Vincent and the Grenadines', 'give'), |
|
311 | + 'SM' => esc_html__('San Marino', 'give'), |
|
312 | + 'ST' => esc_html__('Sao Tome and Principe', 'give'), |
|
313 | + 'SA' => esc_html__('Saudi Arabia', 'give'), |
|
314 | + 'SN' => esc_html__('Senegal', 'give'), |
|
315 | + 'RS' => esc_html__('Serbia', 'give'), |
|
316 | + 'SC' => esc_html__('Seychelles', 'give'), |
|
317 | + 'SL' => esc_html__('Sierra Leone', 'give'), |
|
318 | + 'SG' => esc_html__('Singapore', 'give'), |
|
319 | + 'SK' => esc_html__('Slovak Republic', 'give'), |
|
320 | + 'SI' => esc_html__('Slovenia', 'give'), |
|
321 | + 'SB' => esc_html__('Solomon Islands', 'give'), |
|
322 | + 'SO' => esc_html__('Somalia', 'give'), |
|
323 | + 'ZA' => esc_html__('South Africa', 'give'), |
|
324 | + 'GS' => esc_html__('South Georgia', 'give'), |
|
325 | + 'KR' => esc_html__('South Korea', 'give'), |
|
326 | + 'ES' => esc_html__('Spain', 'give'), |
|
327 | + 'LK' => esc_html__('Sri Lanka', 'give'), |
|
328 | + 'SD' => esc_html__('Sudan', 'give'), |
|
329 | + 'SR' => esc_html__('Suriname', 'give'), |
|
330 | + 'SJ' => esc_html__('Svalbard and Jan Mayen Islands', 'give'), |
|
331 | + 'SZ' => esc_html__('Swaziland', 'give'), |
|
332 | + 'SE' => esc_html__('Sweden', 'give'), |
|
333 | + 'CH' => esc_html__('Switzerland', 'give'), |
|
334 | + 'SY' => esc_html__('Syrian Arab Republic', 'give'), |
|
335 | + 'TW' => esc_html__('Taiwan', 'give'), |
|
336 | + 'TJ' => esc_html__('Tajikistan', 'give'), |
|
337 | + 'TZ' => esc_html__('Tanzania', 'give'), |
|
338 | + 'TG' => esc_html__('Togo', 'give'), |
|
339 | + 'TK' => esc_html__('Tokelau', 'give'), |
|
340 | + 'TO' => esc_html__('Tonga', 'give'), |
|
341 | + 'TH' => esc_html__('Thailand', 'give'), |
|
342 | + 'TT' => esc_html__('Trinidad and Tobago', 'give'), |
|
343 | + 'TN' => esc_html__('Tunisia', 'give'), |
|
344 | + 'TR' => esc_html__('Turkey', 'give'), |
|
345 | + 'TM' => esc_html__('Turkmenistan', 'give'), |
|
346 | + 'TC' => esc_html__('Turks and Caicos Islands', 'give'), |
|
347 | + 'TV' => esc_html__('Tuvalu', 'give'), |
|
348 | + 'UG' => esc_html__('Uganda', 'give'), |
|
349 | + 'UA' => esc_html__('Ukraine', 'give'), |
|
350 | + 'AE' => esc_html__('United Arab Emirates', 'give'), |
|
351 | + 'UY' => esc_html__('Uruguay', 'give'), |
|
352 | + 'UM' => esc_html__('US Minor Outlying Islands', 'give'), |
|
353 | + 'UZ' => esc_html__('Uzbekistan', 'give'), |
|
354 | + 'VU' => esc_html__('Vanuatu', 'give'), |
|
355 | + 'VE' => esc_html__('Venezuela', 'give'), |
|
356 | + 'VN' => esc_html__('Vietnam', 'give'), |
|
357 | + 'VG' => esc_html__('Virgin Islands (British)', 'give'), |
|
358 | + 'VI' => esc_html__('Virgin Islands (USA)', 'give'), |
|
359 | + 'WF' => esc_html__('Wallis and Futuna Islands', 'give'), |
|
360 | + 'EH' => esc_html__('Western Sahara', 'give'), |
|
361 | + 'WS' => esc_html__('Western Samoa', 'give'), |
|
362 | + 'YE' => esc_html__('Yemen', 'give'), |
|
363 | + 'YU' => esc_html__('Yugoslavia', 'give'), |
|
364 | + 'ZM' => esc_html__('Zambia', 'give'), |
|
365 | + 'ZW' => esc_html__('Zimbabwe', 'give') |
|
366 | 366 | ); |
367 | 367 | |
368 | - return apply_filters( 'give_countries', $countries ); |
|
368 | + return apply_filters('give_countries', $countries); |
|
369 | 369 | } |
370 | 370 | |
371 | 371 | /** |
@@ -446,7 +446,7 @@ discard block |
||
446 | 446 | 'AP' => 'Armed Forces - Pacific' |
447 | 447 | ); |
448 | 448 | |
449 | - return apply_filters( 'give_us_states', $states ); |
|
449 | + return apply_filters('give_us_states', $states); |
|
450 | 450 | } |
451 | 451 | |
452 | 452 | /** |
@@ -459,22 +459,22 @@ discard block |
||
459 | 459 | function give_get_provinces_list() { |
460 | 460 | $provinces = array( |
461 | 461 | '' => '', |
462 | - 'AB' => esc_html__('Alberta', 'give' ), |
|
463 | - 'BC' => esc_html__('British Columbia', 'give' ), |
|
464 | - 'MB' => esc_html__('Manitoba', 'give' ), |
|
465 | - 'NB' => esc_html__('New Brunswick', 'give' ), |
|
466 | - 'NL' => esc_html__('Newfoundland and Labrador', 'give' ), |
|
467 | - 'NS' => esc_html__('Nova Scotia', 'give' ), |
|
468 | - 'NT' => esc_html__('Northwest Territories', 'give' ), |
|
469 | - 'NU' => esc_html__('Nunavut', 'give' ), |
|
470 | - 'ON' => esc_html__('Ontario', 'give' ), |
|
471 | - 'PE' => esc_html__('Prince Edward Island', 'give' ), |
|
472 | - 'QC' => esc_html__('Quebec', 'give' ), |
|
473 | - 'SK' => esc_html__('Saskatchewan', 'give' ), |
|
474 | - 'YT' => esc_html__('Yukon', 'give' ) |
|
462 | + 'AB' => esc_html__('Alberta', 'give'), |
|
463 | + 'BC' => esc_html__('British Columbia', 'give'), |
|
464 | + 'MB' => esc_html__('Manitoba', 'give'), |
|
465 | + 'NB' => esc_html__('New Brunswick', 'give'), |
|
466 | + 'NL' => esc_html__('Newfoundland and Labrador', 'give'), |
|
467 | + 'NS' => esc_html__('Nova Scotia', 'give'), |
|
468 | + 'NT' => esc_html__('Northwest Territories', 'give'), |
|
469 | + 'NU' => esc_html__('Nunavut', 'give'), |
|
470 | + 'ON' => esc_html__('Ontario', 'give'), |
|
471 | + 'PE' => esc_html__('Prince Edward Island', 'give'), |
|
472 | + 'QC' => esc_html__('Quebec', 'give'), |
|
473 | + 'SK' => esc_html__('Saskatchewan', 'give'), |
|
474 | + 'YT' => esc_html__('Yukon', 'give') |
|
475 | 475 | ); |
476 | 476 | |
477 | - return apply_filters( 'give_canada_provinces', $provinces ); |
|
477 | + return apply_filters('give_canada_provinces', $provinces); |
|
478 | 478 | } |
479 | 479 | |
480 | 480 | /** |
@@ -496,7 +496,7 @@ discard block |
||
496 | 496 | 'WA' => 'Western Australia' |
497 | 497 | ); |
498 | 498 | |
499 | - return apply_filters( 'give_australian_states', $states ); |
|
499 | + return apply_filters('give_australian_states', $states); |
|
500 | 500 | } |
501 | 501 | |
502 | 502 | /** |
@@ -537,7 +537,7 @@ discard block |
||
537 | 537 | 'TO' => 'Tocantins' |
538 | 538 | ); |
539 | 539 | |
540 | - return apply_filters( 'give_brazil_states', $states ); |
|
540 | + return apply_filters('give_brazil_states', $states); |
|
541 | 541 | } |
542 | 542 | |
543 | 543 | /** |
@@ -554,7 +554,7 @@ discard block |
||
554 | 554 | 'NEW TERRITORIES' => 'New Territories' |
555 | 555 | ); |
556 | 556 | |
557 | - return apply_filters( 'give_hong_kong_states', $states ); |
|
557 | + return apply_filters('give_hong_kong_states', $states); |
|
558 | 558 | } |
559 | 559 | |
560 | 560 | /** |
@@ -588,7 +588,7 @@ discard block |
||
588 | 588 | 'ZA' => 'Zala' |
589 | 589 | ); |
590 | 590 | |
591 | - return apply_filters( 'give_hungary_states', $states ); |
|
591 | + return apply_filters('give_hungary_states', $states); |
|
592 | 592 | } |
593 | 593 | |
594 | 594 | /** |
@@ -634,7 +634,7 @@ discard block |
||
634 | 634 | 'CN32' => 'Xinjiang / 新疆' |
635 | 635 | ); |
636 | 636 | |
637 | - return apply_filters( 'give_chinese_states', $states ); |
|
637 | + return apply_filters('give_chinese_states', $states); |
|
638 | 638 | } |
639 | 639 | |
640 | 640 | /** |
@@ -663,7 +663,7 @@ discard block |
||
663 | 663 | 'WC' => 'West Coast' |
664 | 664 | ); |
665 | 665 | |
666 | - return apply_filters( 'give_new_zealand_states', $states ); |
|
666 | + return apply_filters('give_new_zealand_states', $states); |
|
667 | 667 | } |
668 | 668 | |
669 | 669 | /** |
@@ -711,7 +711,7 @@ discard block |
||
711 | 711 | 'PB' => 'Papua Barat' |
712 | 712 | ); |
713 | 713 | |
714 | - return apply_filters( 'give_indonesia_states', $states ); |
|
714 | + return apply_filters('give_indonesia_states', $states); |
|
715 | 715 | } |
716 | 716 | |
717 | 717 | /** |
@@ -761,7 +761,7 @@ discard block |
||
761 | 761 | 'PY' => 'Pondicherry (Puducherry)' |
762 | 762 | ); |
763 | 763 | |
764 | - return apply_filters( 'give_indian_states', $states ); |
|
764 | + return apply_filters('give_indian_states', $states); |
|
765 | 765 | } |
766 | 766 | |
767 | 767 | /** |
@@ -791,7 +791,7 @@ discard block |
||
791 | 791 | 'PJY' => 'W.P. Putrajaya' |
792 | 792 | ); |
793 | 793 | |
794 | - return apply_filters( 'give_malaysian_states', $states ); |
|
794 | + return apply_filters('give_malaysian_states', $states); |
|
795 | 795 | } |
796 | 796 | |
797 | 797 | /** |
@@ -814,7 +814,7 @@ discard block |
||
814 | 814 | 'WC' => 'Western Cape' |
815 | 815 | ); |
816 | 816 | |
817 | - return apply_filters( 'give_south_african_states', $states ); |
|
817 | + return apply_filters('give_south_african_states', $states); |
|
818 | 818 | } |
819 | 819 | |
820 | 820 | /** |
@@ -905,7 +905,7 @@ discard block |
||
905 | 905 | 'TH-35' => 'Yasothon (ยโสธร)' |
906 | 906 | ); |
907 | 907 | |
908 | - return apply_filters( 'give_thailand_states', $states ); |
|
908 | + return apply_filters('give_thailand_states', $states); |
|
909 | 909 | } |
910 | 910 | |
911 | 911 | /** |
@@ -917,59 +917,59 @@ discard block |
||
917 | 917 | function give_get_spain_states_list() { |
918 | 918 | $states = array( |
919 | 919 | '' => '', |
920 | - 'C' => esc_html__( 'A Coruña', 'give' ), |
|
921 | - 'VI' => esc_html__( 'Álava', 'give' ), |
|
922 | - 'AB' => esc_html__( 'Albacete', 'give' ), |
|
923 | - 'A' => esc_html__( 'Alicante', 'give' ), |
|
924 | - 'AL' => esc_html__( 'Almería', 'give' ), |
|
925 | - 'O' => esc_html__( 'Asturias', 'give' ), |
|
926 | - 'AV' => esc_html__( 'Ávila', 'give' ), |
|
927 | - 'BA' => esc_html__( 'Badajoz', 'give' ), |
|
928 | - 'PM' => esc_html__( 'Baleares', 'give' ), |
|
929 | - 'B' => esc_html__( 'Barcelona', 'give' ), |
|
930 | - 'BU' => esc_html__( 'Burgos', 'give' ), |
|
931 | - 'CC' => esc_html__( 'Cáceres', 'give' ), |
|
932 | - 'CA' => esc_html__( 'Cádiz', 'give' ), |
|
933 | - 'S' => esc_html__( 'Cantabria', 'give' ), |
|
934 | - 'CS' => esc_html__( 'Castellón', 'give' ), |
|
935 | - 'CE' => esc_html__( 'Ceuta', 'give' ), |
|
936 | - 'CR' => esc_html__( 'Ciudad Real', 'give' ), |
|
937 | - 'CO' => esc_html__( 'Córdoba', 'give' ), |
|
938 | - 'CU' => esc_html__( 'Cuenca', 'give' ), |
|
939 | - 'GI' => esc_html__( 'Girona', 'give' ), |
|
940 | - 'GR' => esc_html__( 'Granada', 'give' ), |
|
941 | - 'GU' => esc_html__( 'Guadalajara', 'give' ), |
|
942 | - 'SS' => esc_html__( 'Gipuzkoa', 'give' ), |
|
943 | - 'H' => esc_html__( 'Huelva', 'give' ), |
|
944 | - 'HU' => esc_html__( 'Huesca', 'give' ), |
|
945 | - 'J' => esc_html__( 'Jaén', 'give' ), |
|
946 | - 'LO' => esc_html__( 'La Rioja', 'give' ), |
|
947 | - 'GC' => esc_html__( 'Las Palmas', 'give' ), |
|
948 | - 'LE' => esc_html__( 'León', 'give' ), |
|
949 | - 'L' => esc_html__( 'Lleida', 'give' ), |
|
950 | - 'LU' => esc_html__( 'Lugo', 'give' ), |
|
951 | - 'M' => esc_html__( 'Madrid', 'give' ), |
|
952 | - 'MA' => esc_html__( 'Málaga', 'give' ), |
|
953 | - 'ML' => esc_html__( 'Melilla', 'give' ), |
|
954 | - 'MU' => esc_html__( 'Murcia', 'give' ), |
|
955 | - 'NA' => esc_html__( 'Navarra', 'give' ), |
|
956 | - 'OR' => esc_html__( 'Ourense', 'give' ), |
|
957 | - 'P' => esc_html__( 'Palencia', 'give' ), |
|
958 | - 'PO' => esc_html__( 'Pontevedra', 'give' ), |
|
959 | - 'SA' => esc_html__( 'Salamanca', 'give' ), |
|
960 | - 'TF' => esc_html__( 'Santa Cruz de Tenerife', 'give' ), |
|
961 | - 'SG' => esc_html__( 'Segovia', 'give' ), |
|
962 | - 'SE' => esc_html__( 'Sevilla', 'give' ), |
|
963 | - 'SO' => esc_html__( 'Soria', 'give' ), |
|
964 | - 'T' => esc_html__( 'Tarragona', 'give' ), |
|
965 | - 'TE' => esc_html__( 'Teruel', 'give' ), |
|
966 | - 'TO' => esc_html__( 'Toledo', 'give' ), |
|
967 | - 'V' => esc_html__( 'Valencia', 'give' ), |
|
968 | - 'VA' => esc_html__( 'Valladolid', 'give' ), |
|
969 | - 'BI' => esc_html__( 'Bizkaia', 'give' ), |
|
970 | - 'ZA' => esc_html__( 'Zamora', 'give' ), |
|
971 | - 'Z' => esc_html__( 'Zaragoza', 'give' ) |
|
920 | + 'C' => esc_html__('A Coruña', 'give'), |
|
921 | + 'VI' => esc_html__('Álava', 'give'), |
|
922 | + 'AB' => esc_html__('Albacete', 'give'), |
|
923 | + 'A' => esc_html__('Alicante', 'give'), |
|
924 | + 'AL' => esc_html__('Almería', 'give'), |
|
925 | + 'O' => esc_html__('Asturias', 'give'), |
|
926 | + 'AV' => esc_html__('Ávila', 'give'), |
|
927 | + 'BA' => esc_html__('Badajoz', 'give'), |
|
928 | + 'PM' => esc_html__('Baleares', 'give'), |
|
929 | + 'B' => esc_html__('Barcelona', 'give'), |
|
930 | + 'BU' => esc_html__('Burgos', 'give'), |
|
931 | + 'CC' => esc_html__('Cáceres', 'give'), |
|
932 | + 'CA' => esc_html__('Cádiz', 'give'), |
|
933 | + 'S' => esc_html__('Cantabria', 'give'), |
|
934 | + 'CS' => esc_html__('Castellón', 'give'), |
|
935 | + 'CE' => esc_html__('Ceuta', 'give'), |
|
936 | + 'CR' => esc_html__('Ciudad Real', 'give'), |
|
937 | + 'CO' => esc_html__('Córdoba', 'give'), |
|
938 | + 'CU' => esc_html__('Cuenca', 'give'), |
|
939 | + 'GI' => esc_html__('Girona', 'give'), |
|
940 | + 'GR' => esc_html__('Granada', 'give'), |
|
941 | + 'GU' => esc_html__('Guadalajara', 'give'), |
|
942 | + 'SS' => esc_html__('Gipuzkoa', 'give'), |
|
943 | + 'H' => esc_html__('Huelva', 'give'), |
|
944 | + 'HU' => esc_html__('Huesca', 'give'), |
|
945 | + 'J' => esc_html__('Jaén', 'give'), |
|
946 | + 'LO' => esc_html__('La Rioja', 'give'), |
|
947 | + 'GC' => esc_html__('Las Palmas', 'give'), |
|
948 | + 'LE' => esc_html__('León', 'give'), |
|
949 | + 'L' => esc_html__('Lleida', 'give'), |
|
950 | + 'LU' => esc_html__('Lugo', 'give'), |
|
951 | + 'M' => esc_html__('Madrid', 'give'), |
|
952 | + 'MA' => esc_html__('Málaga', 'give'), |
|
953 | + 'ML' => esc_html__('Melilla', 'give'), |
|
954 | + 'MU' => esc_html__('Murcia', 'give'), |
|
955 | + 'NA' => esc_html__('Navarra', 'give'), |
|
956 | + 'OR' => esc_html__('Ourense', 'give'), |
|
957 | + 'P' => esc_html__('Palencia', 'give'), |
|
958 | + 'PO' => esc_html__('Pontevedra', 'give'), |
|
959 | + 'SA' => esc_html__('Salamanca', 'give'), |
|
960 | + 'TF' => esc_html__('Santa Cruz de Tenerife', 'give'), |
|
961 | + 'SG' => esc_html__('Segovia', 'give'), |
|
962 | + 'SE' => esc_html__('Sevilla', 'give'), |
|
963 | + 'SO' => esc_html__('Soria', 'give'), |
|
964 | + 'T' => esc_html__('Tarragona', 'give'), |
|
965 | + 'TE' => esc_html__('Teruel', 'give'), |
|
966 | + 'TO' => esc_html__('Toledo', 'give'), |
|
967 | + 'V' => esc_html__('Valencia', 'give'), |
|
968 | + 'VA' => esc_html__('Valladolid', 'give'), |
|
969 | + 'BI' => esc_html__('Bizkaia', 'give'), |
|
970 | + 'ZA' => esc_html__('Zamora', 'give'), |
|
971 | + 'Z' => esc_html__('Zaragoza', 'give') |
|
972 | 972 | ); |
973 | 973 | |
974 | - return apply_filters( 'give_spain_states', $states ); |
|
974 | + return apply_filters('give_spain_states', $states); |
|
975 | 975 | } |
@@ -4,8 +4,8 @@ discard block |
||
4 | 4 | */ |
5 | 5 | $give_map_deprecated_actions = give_deprecated_actions(); |
6 | 6 | |
7 | -foreach ( $give_map_deprecated_actions as $new => $old ) { |
|
8 | - add_action( $new, 'give_deprecated_action_mapping', 10, 4 ); |
|
7 | +foreach ($give_map_deprecated_actions as $new => $old) { |
|
8 | + add_action($new, 'give_deprecated_action_mapping', 10, 4); |
|
9 | 9 | } |
10 | 10 | |
11 | 11 | /** |
@@ -59,20 +59,20 @@ discard block |
||
59 | 59 | * |
60 | 60 | * @return mixed|void |
61 | 61 | */ |
62 | -function give_deprecated_action_mapping( $data, $arg_1 = '', $arg_2 = '', $arg_3 = '' ) { |
|
62 | +function give_deprecated_action_mapping($data, $arg_1 = '', $arg_2 = '', $arg_3 = '') { |
|
63 | 63 | $give_map_deprecated_actions = give_deprecated_actions(); |
64 | 64 | $action = current_filter(); |
65 | 65 | |
66 | - if ( isset( $give_map_deprecated_actions[ $action ] ) ) { |
|
67 | - if ( has_action( $give_map_deprecated_actions[ $action ] ) ) { |
|
68 | - do_action( $give_map_deprecated_actions[ $action ], $data, $arg_1, $arg_2, $arg_3 ); |
|
66 | + if (isset($give_map_deprecated_actions[$action])) { |
|
67 | + if (has_action($give_map_deprecated_actions[$action])) { |
|
68 | + do_action($give_map_deprecated_actions[$action], $data, $arg_1, $arg_2, $arg_3); |
|
69 | 69 | |
70 | - if ( ! defined( 'DOING_AJAX' ) ) { |
|
70 | + if ( ! defined('DOING_AJAX')) { |
|
71 | 71 | // translators: %s: action name. |
72 | 72 | _give_deprecated_function( |
73 | 73 | sprintf( |
74 | - __( 'The %s action' ), |
|
75 | - $give_map_deprecated_actions[ $action ] |
|
74 | + __('The %s action'), |
|
75 | + $give_map_deprecated_actions[$action] |
|
76 | 76 | ), |
77 | 77 | '1.7', |
78 | 78 | $action |
@@ -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 | |
@@ -74,53 +74,53 @@ discard block |
||
74 | 74 | public function __construct() { |
75 | 75 | |
76 | 76 | $this->use_php_sessions = $this->use_php_sessions(); |
77 | - $this->exp_option = give_get_option( 'session_lifetime' ); |
|
77 | + $this->exp_option = give_get_option('session_lifetime'); |
|
78 | 78 | |
79 | 79 | // PHP Sessions. |
80 | - if ( $this->use_php_sessions ) { |
|
80 | + if ($this->use_php_sessions) { |
|
81 | 81 | |
82 | - if ( is_multisite() ) { |
|
82 | + if (is_multisite()) { |
|
83 | 83 | |
84 | - $this->prefix = '_' . get_current_blog_id(); |
|
84 | + $this->prefix = '_'.get_current_blog_id(); |
|
85 | 85 | |
86 | 86 | } |
87 | 87 | |
88 | - add_action( 'init', array( $this, 'maybe_start_session' ), - 2 ); |
|
88 | + add_action('init', array($this, 'maybe_start_session'), - 2); |
|
89 | 89 | |
90 | 90 | } else { |
91 | 91 | |
92 | - if ( ! $this->should_start_session() ) { |
|
92 | + if ( ! $this->should_start_session()) { |
|
93 | 93 | return; |
94 | 94 | } |
95 | 95 | |
96 | 96 | // Use WP_Session. |
97 | - if ( ! defined( 'WP_SESSION_COOKIE' ) ) { |
|
98 | - define( 'WP_SESSION_COOKIE', 'give_wp_session' ); |
|
97 | + if ( ! defined('WP_SESSION_COOKIE')) { |
|
98 | + define('WP_SESSION_COOKIE', 'give_wp_session'); |
|
99 | 99 | } |
100 | 100 | |
101 | - if ( ! class_exists( 'Recursive_ArrayAccess' ) ) { |
|
102 | - require_once GIVE_PLUGIN_DIR . 'includes/libraries/sessions/class-recursive-arrayaccess.php'; |
|
101 | + if ( ! class_exists('Recursive_ArrayAccess')) { |
|
102 | + require_once GIVE_PLUGIN_DIR.'includes/libraries/sessions/class-recursive-arrayaccess.php'; |
|
103 | 103 | } |
104 | 104 | |
105 | - if ( ! class_exists( 'WP_Session' ) ) { |
|
106 | - require_once GIVE_PLUGIN_DIR . 'includes/libraries/sessions/class-wp-session.php'; |
|
107 | - require_once GIVE_PLUGIN_DIR . 'includes/libraries/sessions/wp-session.php'; |
|
105 | + if ( ! class_exists('WP_Session')) { |
|
106 | + require_once GIVE_PLUGIN_DIR.'includes/libraries/sessions/class-wp-session.php'; |
|
107 | + require_once GIVE_PLUGIN_DIR.'includes/libraries/sessions/wp-session.php'; |
|
108 | 108 | } |
109 | 109 | |
110 | - add_filter( 'wp_session_expiration_variant', array( $this, 'set_expiration_variant_time' ), 99999 ); |
|
111 | - add_filter( 'wp_session_expiration', array( $this, 'set_expiration_time' ), 99999 ); |
|
110 | + add_filter('wp_session_expiration_variant', array($this, 'set_expiration_variant_time'), 99999); |
|
111 | + add_filter('wp_session_expiration', array($this, 'set_expiration_time'), 99999); |
|
112 | 112 | |
113 | 113 | } |
114 | 114 | |
115 | 115 | // Init Session. |
116 | - if ( empty( $this->session ) && ! $this->use_php_sessions ) { |
|
117 | - add_action( 'plugins_loaded', array( $this, 'init' ), - 1 ); |
|
116 | + if (empty($this->session) && ! $this->use_php_sessions) { |
|
117 | + add_action('plugins_loaded', array($this, 'init'), - 1); |
|
118 | 118 | } else { |
119 | - add_action( 'init', array( $this, 'init' ), - 1 ); |
|
119 | + add_action('init', array($this, 'init'), - 1); |
|
120 | 120 | } |
121 | 121 | |
122 | 122 | // Set cookie on Donation Completion page. |
123 | - add_action( 'give_pre_process_donation', array( $this, 'set_session_cookies' ) ); |
|
123 | + add_action('give_pre_process_donation', array($this, 'set_session_cookies')); |
|
124 | 124 | |
125 | 125 | } |
126 | 126 | |
@@ -136,8 +136,8 @@ discard block |
||
136 | 136 | */ |
137 | 137 | public function init() { |
138 | 138 | |
139 | - if ( $this->use_php_sessions ) { |
|
140 | - $this->session = isset( $_SESSION[ 'give' . $this->prefix ] ) && is_array( $_SESSION[ 'give' . $this->prefix ] ) ? $_SESSION[ 'give' . $this->prefix ] : array(); |
|
139 | + if ($this->use_php_sessions) { |
|
140 | + $this->session = isset($_SESSION['give'.$this->prefix]) && is_array($_SESSION['give'.$this->prefix]) ? $_SESSION['give'.$this->prefix] : array(); |
|
141 | 141 | } else { |
142 | 142 | $this->session = WP_Session::get_instance(); |
143 | 143 | } |
@@ -172,10 +172,10 @@ discard block |
||
172 | 172 | * |
173 | 173 | * @return string Session variable. |
174 | 174 | */ |
175 | - public function get( $key ) { |
|
176 | - $key = sanitize_key( $key ); |
|
175 | + public function get($key) { |
|
176 | + $key = sanitize_key($key); |
|
177 | 177 | |
178 | - return isset( $this->session[ $key ] ) ? maybe_unserialize( $this->session[ $key ] ) : false; |
|
178 | + return isset($this->session[$key]) ? maybe_unserialize($this->session[$key]) : false; |
|
179 | 179 | |
180 | 180 | } |
181 | 181 | |
@@ -192,21 +192,21 @@ discard block |
||
192 | 192 | * |
193 | 193 | * @return string Session variable. |
194 | 194 | */ |
195 | - public function set( $key, $value ) { |
|
195 | + public function set($key, $value) { |
|
196 | 196 | |
197 | - $key = sanitize_key( $key ); |
|
197 | + $key = sanitize_key($key); |
|
198 | 198 | |
199 | - if ( is_array( $value ) ) { |
|
200 | - $this->session[ $key ] = serialize( $value ); |
|
199 | + if (is_array($value)) { |
|
200 | + $this->session[$key] = serialize($value); |
|
201 | 201 | } else { |
202 | - $this->session[ $key ] = $value; |
|
202 | + $this->session[$key] = $value; |
|
203 | 203 | } |
204 | 204 | |
205 | - if ( $this->use_php_sessions ) { |
|
206 | - $_SESSION[ 'give' . $this->prefix ] = $this->session; |
|
205 | + if ($this->use_php_sessions) { |
|
206 | + $_SESSION['give'.$this->prefix] = $this->session; |
|
207 | 207 | } |
208 | 208 | |
209 | - return $this->session[ $key ]; |
|
209 | + return $this->session[$key]; |
|
210 | 210 | } |
211 | 211 | |
212 | 212 | /** |
@@ -220,10 +220,10 @@ discard block |
||
220 | 220 | * @hook |
221 | 221 | */ |
222 | 222 | public function set_session_cookies() { |
223 | - if ( ! headers_sent() ) { |
|
224 | - $lifetime = current_time( 'timestamp' ) + $this->set_expiration_time(); |
|
225 | - @setcookie( session_name(), session_id(), $lifetime, COOKIEPATH, COOKIE_DOMAIN, false ); |
|
226 | - @setcookie( session_name() . '_expiration', $lifetime, $lifetime, COOKIEPATH, COOKIE_DOMAIN, false ); |
|
223 | + if ( ! headers_sent()) { |
|
224 | + $lifetime = current_time('timestamp') + $this->set_expiration_time(); |
|
225 | + @setcookie(session_name(), session_id(), $lifetime, COOKIEPATH, COOKIE_DOMAIN, false); |
|
226 | + @setcookie(session_name().'_expiration', $lifetime, $lifetime, COOKIEPATH, COOKIE_DOMAIN, false); |
|
227 | 227 | } |
228 | 228 | } |
229 | 229 | |
@@ -239,7 +239,7 @@ discard block |
||
239 | 239 | */ |
240 | 240 | public function set_expiration_variant_time() { |
241 | 241 | |
242 | - return ( ! empty( $this->exp_option ) ? ( intval( $this->exp_option ) - 3600 ) : 30 * 60 * 23 ); |
|
242 | + return ( ! empty($this->exp_option) ? (intval($this->exp_option) - 3600) : 30 * 60 * 23); |
|
243 | 243 | } |
244 | 244 | |
245 | 245 | /** |
@@ -254,7 +254,7 @@ discard block |
||
254 | 254 | */ |
255 | 255 | public function set_expiration_time() { |
256 | 256 | |
257 | - return ( ! empty( $this->exp_option ) ? intval( $this->exp_option ) : 30 * 60 * 24 ); |
|
257 | + return ( ! empty($this->exp_option) ? intval($this->exp_option) : 30 * 60 * 24); |
|
258 | 258 | } |
259 | 259 | |
260 | 260 | /** |
@@ -272,21 +272,21 @@ discard block |
||
272 | 272 | $ret = false; |
273 | 273 | |
274 | 274 | // If the database variable is already set, no need to run auto detection. |
275 | - $give_use_php_sessions = (bool) get_option( 'give_use_php_sessions' ); |
|
275 | + $give_use_php_sessions = (bool) get_option('give_use_php_sessions'); |
|
276 | 276 | |
277 | - if ( ! $give_use_php_sessions ) { |
|
277 | + if ( ! $give_use_php_sessions) { |
|
278 | 278 | |
279 | 279 | // Attempt to detect if the server supports PHP sessions. |
280 | - if ( function_exists( 'session_start' ) && ! ini_get( 'safe_mode' ) ) { |
|
280 | + if (function_exists('session_start') && ! ini_get('safe_mode')) { |
|
281 | 281 | |
282 | - $this->set( 'give_use_php_sessions', 1 ); |
|
282 | + $this->set('give_use_php_sessions', 1); |
|
283 | 283 | |
284 | - if ( $this->get( 'give_use_php_sessions' ) ) { |
|
284 | + if ($this->get('give_use_php_sessions')) { |
|
285 | 285 | |
286 | 286 | $ret = true; |
287 | 287 | |
288 | 288 | // Set the database option. |
289 | - update_option( 'give_use_php_sessions', true ); |
|
289 | + update_option('give_use_php_sessions', true); |
|
290 | 290 | |
291 | 291 | } |
292 | 292 | } |
@@ -296,13 +296,13 @@ discard block |
||
296 | 296 | } |
297 | 297 | |
298 | 298 | // Enable or disable PHP Sessions based on the GIVE_USE_PHP_SESSIONS constant. |
299 | - if ( defined( 'GIVE_USE_PHP_SESSIONS' ) && GIVE_USE_PHP_SESSIONS ) { |
|
299 | + if (defined('GIVE_USE_PHP_SESSIONS') && GIVE_USE_PHP_SESSIONS) { |
|
300 | 300 | $ret = true; |
301 | - } elseif ( defined( 'GIVE_USE_PHP_SESSIONS' ) && ! GIVE_USE_PHP_SESSIONS ) { |
|
301 | + } elseif (defined('GIVE_USE_PHP_SESSIONS') && ! GIVE_USE_PHP_SESSIONS) { |
|
302 | 302 | $ret = false; |
303 | 303 | } |
304 | 304 | |
305 | - return (bool) apply_filters( 'give_use_php_sessions', $ret ); |
|
305 | + return (bool) apply_filters('give_use_php_sessions', $ret); |
|
306 | 306 | } |
307 | 307 | |
308 | 308 | /** |
@@ -319,9 +319,9 @@ discard block |
||
319 | 319 | |
320 | 320 | $start_session = true; |
321 | 321 | |
322 | - if ( ! empty( $_SERVER['REQUEST_URI'] ) ) { |
|
322 | + if ( ! empty($_SERVER['REQUEST_URI'])) { |
|
323 | 323 | |
324 | - $blacklist = apply_filters( 'give_session_start_uri_blacklist', array( |
|
324 | + $blacklist = apply_filters('give_session_start_uri_blacklist', array( |
|
325 | 325 | 'feed', |
326 | 326 | 'feed', |
327 | 327 | 'feed/rss', |
@@ -329,21 +329,21 @@ discard block |
||
329 | 329 | 'feed/rdf', |
330 | 330 | 'feed/atom', |
331 | 331 | 'comments/feed/', |
332 | - ) ); |
|
333 | - $uri = ltrim( $_SERVER['REQUEST_URI'], '/' ); |
|
334 | - $uri = untrailingslashit( $uri ); |
|
335 | - if ( in_array( $uri, $blacklist ) ) { |
|
332 | + )); |
|
333 | + $uri = ltrim($_SERVER['REQUEST_URI'], '/'); |
|
334 | + $uri = untrailingslashit($uri); |
|
335 | + if (in_array($uri, $blacklist)) { |
|
336 | 336 | $start_session = false; |
337 | 337 | } |
338 | - if ( false !== strpos( $uri, 'feed=' ) ) { |
|
338 | + if (false !== strpos($uri, 'feed=')) { |
|
339 | 339 | $start_session = false; |
340 | 340 | } |
341 | - if ( is_admin() ) { |
|
341 | + if (is_admin()) { |
|
342 | 342 | $start_session = false; |
343 | 343 | } |
344 | 344 | } |
345 | 345 | |
346 | - return apply_filters( 'give_start_session', $start_session ); |
|
346 | + return apply_filters('give_start_session', $start_session); |
|
347 | 347 | } |
348 | 348 | |
349 | 349 | /** |
@@ -359,11 +359,11 @@ discard block |
||
359 | 359 | */ |
360 | 360 | public function maybe_start_session() { |
361 | 361 | |
362 | - if ( ! $this->should_start_session() ) { |
|
362 | + if ( ! $this->should_start_session()) { |
|
363 | 363 | return; |
364 | 364 | } |
365 | 365 | |
366 | - if ( ! session_id() && ! headers_sent() ) { |
|
366 | + if ( ! session_id() && ! headers_sent()) { |
|
367 | 367 | session_start(); |
368 | 368 | } |
369 | 369 | |
@@ -382,9 +382,9 @@ discard block |
||
382 | 382 | |
383 | 383 | $expiration = false; |
384 | 384 | |
385 | - if ( session_id() && isset( $_COOKIE[ session_name() . '_expiration' ] ) ) { |
|
385 | + if (session_id() && isset($_COOKIE[session_name().'_expiration'])) { |
|
386 | 386 | |
387 | - $expiration = date( 'D, d M Y h:i:s', intval( $_COOKIE[ session_name() . '_expiration' ] ) ); |
|
387 | + $expiration = date('D, d M Y h:i:s', intval($_COOKIE[session_name().'_expiration'])); |
|
388 | 388 | |
389 | 389 | } |
390 | 390 |
@@ -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,17 +23,17 @@ discard block |
||
23 | 23 | * |
24 | 24 | * @return void |
25 | 25 | */ |
26 | -function give_trigger_donation_receipt( $payment_id ) { |
|
26 | +function give_trigger_donation_receipt($payment_id) { |
|
27 | 27 | // Make sure we don't send a receipt while editing a donation. |
28 | - if ( isset( $_POST['give-action'] ) && 'edit_payment' == $_POST['give-action'] ) { |
|
28 | + if (isset($_POST['give-action']) && 'edit_payment' == $_POST['give-action']) { |
|
29 | 29 | return; |
30 | 30 | } |
31 | 31 | |
32 | 32 | // Send email. |
33 | - give_email_donation_receipt( $payment_id ); |
|
33 | + give_email_donation_receipt($payment_id); |
|
34 | 34 | } |
35 | 35 | |
36 | -add_action( 'give_complete_donation', 'give_trigger_donation_receipt', 999, 1 ); |
|
36 | +add_action('give_complete_donation', 'give_trigger_donation_receipt', 999, 1); |
|
37 | 37 | |
38 | 38 | /** |
39 | 39 | * Resend the Email Donation Receipt. (This can be done from the Donation History Page) |
@@ -44,29 +44,29 @@ discard block |
||
44 | 44 | * |
45 | 45 | * @return void |
46 | 46 | */ |
47 | -function give_resend_donation_receipt( $data ) { |
|
47 | +function give_resend_donation_receipt($data) { |
|
48 | 48 | |
49 | - $purchase_id = absint( $data['purchase_id'] ); |
|
49 | + $purchase_id = absint($data['purchase_id']); |
|
50 | 50 | |
51 | - if ( empty( $purchase_id ) ) { |
|
51 | + if (empty($purchase_id)) { |
|
52 | 52 | return; |
53 | 53 | } |
54 | 54 | |
55 | - if ( ! current_user_can( 'edit_give_payments', $purchase_id ) ) { |
|
56 | - wp_die( esc_html__( 'You do not have permission to edit payments.', 'give' ), esc_html__( 'Error', 'give' ), array( 'response' => 403 ) ); |
|
55 | + if ( ! current_user_can('edit_give_payments', $purchase_id)) { |
|
56 | + wp_die(esc_html__('You do not have permission to edit payments.', 'give'), esc_html__('Error', 'give'), array('response' => 403)); |
|
57 | 57 | } |
58 | 58 | |
59 | - give_email_donation_receipt( $purchase_id, false ); |
|
59 | + give_email_donation_receipt($purchase_id, false); |
|
60 | 60 | |
61 | - wp_redirect( add_query_arg( array( |
|
61 | + wp_redirect(add_query_arg(array( |
|
62 | 62 | 'give-message' => 'email_sent', |
63 | 63 | 'give-action' => false, |
64 | 64 | 'purchase_id' => false |
65 | - ) ) ); |
|
65 | + ))); |
|
66 | 66 | exit; |
67 | 67 | } |
68 | 68 | |
69 | -add_action( 'give_email_links', 'give_resend_donation_receipt' ); |
|
69 | +add_action('give_email_links', 'give_resend_donation_receipt'); |
|
70 | 70 | |
71 | 71 | /** |
72 | 72 | * Trigger the sending of a Test Email |
@@ -77,8 +77,8 @@ discard block |
||
77 | 77 | * |
78 | 78 | * @return void |
79 | 79 | */ |
80 | -function give_send_test_email( $data ) { |
|
81 | - if ( ! wp_verify_nonce( $data['_wpnonce'], 'give-test-email' ) ) { |
|
80 | +function give_send_test_email($data) { |
|
81 | + if ( ! wp_verify_nonce($data['_wpnonce'], 'give-test-email')) { |
|
82 | 82 | return; |
83 | 83 | } |
84 | 84 | |
@@ -86,8 +86,8 @@ discard block |
||
86 | 86 | give_email_test_donation_receipt(); |
87 | 87 | |
88 | 88 | // Remove the test email query arg. |
89 | - wp_redirect( remove_query_arg( 'give_action' ) ); |
|
89 | + wp_redirect(remove_query_arg('give_action')); |
|
90 | 90 | exit; |
91 | 91 | } |
92 | 92 | |
93 | -add_action( 'give_send_test_email', 'give_send_test_email' ); |
|
93 | +add_action('give_send_test_email', 'give_send_test_email'); |
@@ -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 | |
@@ -28,21 +28,21 @@ discard block |
||
28 | 28 | * |
29 | 29 | * @return void |
30 | 30 | */ |
31 | -function give_complete_purchase( $payment_id, $new_status, $old_status ) { |
|
31 | +function give_complete_purchase($payment_id, $new_status, $old_status) { |
|
32 | 32 | |
33 | 33 | // Make sure that payments are only completed once. |
34 | - if ( $old_status == 'publish' || $old_status == 'complete' ) { |
|
34 | + if ($old_status == 'publish' || $old_status == 'complete') { |
|
35 | 35 | return; |
36 | 36 | } |
37 | 37 | |
38 | 38 | // Make sure the payment completion is only processed when new status is complete. |
39 | - if ( $new_status != 'publish' && $new_status != 'complete' ) { |
|
39 | + if ($new_status != 'publish' && $new_status != 'complete') { |
|
40 | 40 | return; |
41 | 41 | } |
42 | 42 | |
43 | - $payment = new Give_Payment( $payment_id ); |
|
43 | + $payment = new Give_Payment($payment_id); |
|
44 | 44 | |
45 | - $creation_date = get_post_field( 'post_date', $payment_id, 'raw' ); |
|
45 | + $creation_date = get_post_field('post_date', $payment_id, 'raw'); |
|
46 | 46 | $payment_meta = $payment->payment_meta; |
47 | 47 | $completed_date = $payment->completed_date; |
48 | 48 | $user_info = $payment->user_info; |
@@ -58,12 +58,12 @@ discard block |
||
58 | 58 | * |
59 | 59 | * @param int $payment_id The ID of the payment. |
60 | 60 | */ |
61 | - do_action( 'give_pre_complete_purchase', $payment_id ); |
|
61 | + do_action('give_pre_complete_purchase', $payment_id); |
|
62 | 62 | |
63 | 63 | // Ensure these actions only run once, ever. |
64 | - if ( empty( $completed_date ) ) { |
|
64 | + if (empty($completed_date)) { |
|
65 | 65 | |
66 | - give_record_sale_in_log( $form_id, $payment_id, $price_id, $creation_date ); |
|
66 | + give_record_sale_in_log($form_id, $payment_id, $price_id, $creation_date); |
|
67 | 67 | |
68 | 68 | /** |
69 | 69 | * Fires after logging donation record. |
@@ -74,32 +74,32 @@ discard block |
||
74 | 74 | * @param int $payment_id The ID number of the payment. |
75 | 75 | * @param array $payment_meta The payment meta. |
76 | 76 | */ |
77 | - do_action( 'give_complete_form_donation', $form_id, $payment_id, $payment_meta ); |
|
77 | + do_action('give_complete_form_donation', $form_id, $payment_id, $payment_meta); |
|
78 | 78 | |
79 | 79 | } |
80 | 80 | |
81 | 81 | // Increase the earnings for this form ID. |
82 | - give_increase_earnings( $form_id, $amount ); |
|
83 | - give_increase_purchase_count( $form_id ); |
|
82 | + give_increase_earnings($form_id, $amount); |
|
83 | + give_increase_purchase_count($form_id); |
|
84 | 84 | |
85 | 85 | // Clear the total earnings cache. |
86 | - delete_transient( 'give_earnings_total' ); |
|
86 | + delete_transient('give_earnings_total'); |
|
87 | 87 | // Clear the This Month earnings (this_monththis_month is NOT a typo). |
88 | - delete_transient( md5( 'give_earnings_this_monththis_month' ) ); |
|
89 | - delete_transient( md5( 'give_earnings_todaytoday' ) ); |
|
88 | + delete_transient(md5('give_earnings_this_monththis_month')); |
|
89 | + delete_transient(md5('give_earnings_todaytoday')); |
|
90 | 90 | |
91 | 91 | // Increase the donor's donation stats. |
92 | - $customer = new Give_Customer( $customer_id ); |
|
92 | + $customer = new Give_Customer($customer_id); |
|
93 | 93 | $customer->increase_purchase_count(); |
94 | - $customer->increase_value( $amount ); |
|
94 | + $customer->increase_value($amount); |
|
95 | 95 | |
96 | - give_increase_total_earnings( $amount ); |
|
96 | + give_increase_total_earnings($amount); |
|
97 | 97 | |
98 | 98 | // Ensure this action only runs once ever. |
99 | - if ( empty( $completed_date ) ) { |
|
99 | + if (empty($completed_date)) { |
|
100 | 100 | |
101 | 101 | // Save the completed date. |
102 | - $payment->completed_date = current_time( 'mysql' ); |
|
102 | + $payment->completed_date = current_time('mysql'); |
|
103 | 103 | $payment->save(); |
104 | 104 | |
105 | 105 | /** |
@@ -109,12 +109,12 @@ discard block |
||
109 | 109 | * |
110 | 110 | * @param int $payment_id The ID of the payment. |
111 | 111 | */ |
112 | - do_action( 'give_complete_donation', $payment_id ); |
|
112 | + do_action('give_complete_donation', $payment_id); |
|
113 | 113 | } |
114 | 114 | |
115 | 115 | } |
116 | 116 | |
117 | -add_action( 'give_update_payment_status', 'give_complete_purchase', 100, 3 ); |
|
117 | +add_action('give_update_payment_status', 'give_complete_purchase', 100, 3); |
|
118 | 118 | |
119 | 119 | |
120 | 120 | /** |
@@ -128,24 +128,24 @@ discard block |
||
128 | 128 | * |
129 | 129 | * @return void |
130 | 130 | */ |
131 | -function give_record_status_change( $payment_id, $new_status, $old_status ) { |
|
131 | +function give_record_status_change($payment_id, $new_status, $old_status) { |
|
132 | 132 | |
133 | 133 | // Get the list of statuses so that status in the payment note can be translated. |
134 | 134 | $stati = give_get_payment_statuses(); |
135 | - $old_status = isset( $stati[ $old_status ] ) ? $stati[ $old_status ] : $old_status; |
|
136 | - $new_status = isset( $stati[ $new_status ] ) ? $stati[ $new_status ] : $new_status; |
|
135 | + $old_status = isset($stati[$old_status]) ? $stati[$old_status] : $old_status; |
|
136 | + $new_status = isset($stati[$new_status]) ? $stati[$new_status] : $new_status; |
|
137 | 137 | |
138 | 138 | // translators: 1: old status 2: new status. |
139 | 139 | $status_change = sprintf( |
140 | - esc_html__( 'Status changed from %1$s to %2$s.', 'give' ), |
|
140 | + esc_html__('Status changed from %1$s to %2$s.', 'give'), |
|
141 | 141 | $old_status, |
142 | 142 | $new_status |
143 | 143 | ); |
144 | 144 | |
145 | - give_insert_payment_note( $payment_id, $status_change ); |
|
145 | + give_insert_payment_note($payment_id, $status_change); |
|
146 | 146 | } |
147 | 147 | |
148 | -add_action( 'give_update_payment_status', 'give_record_status_change', 100, 3 ); |
|
148 | +add_action('give_update_payment_status', 'give_record_status_change', 100, 3); |
|
149 | 149 | |
150 | 150 | |
151 | 151 | /** |
@@ -162,17 +162,17 @@ discard block |
||
162 | 162 | * |
163 | 163 | * @return void |
164 | 164 | */ |
165 | -function give_clear_user_history_cache( $payment_id, $new_status, $old_status ) { |
|
165 | +function give_clear_user_history_cache($payment_id, $new_status, $old_status) { |
|
166 | 166 | |
167 | - $payment = new Give_Payment( $payment_id ); |
|
167 | + $payment = new Give_Payment($payment_id); |
|
168 | 168 | |
169 | - if ( ! empty( $payment->user_id ) ) { |
|
170 | - delete_transient( 'give_user_' . $payment->user_id . '_purchases' ); |
|
169 | + if ( ! empty($payment->user_id)) { |
|
170 | + delete_transient('give_user_'.$payment->user_id.'_purchases'); |
|
171 | 171 | } |
172 | 172 | |
173 | 173 | } |
174 | 174 | |
175 | -add_action( 'give_update_payment_status', 'give_clear_user_history_cache', 10, 3 ); |
|
175 | +add_action('give_update_payment_status', 'give_clear_user_history_cache', 10, 3); |
|
176 | 176 | |
177 | 177 | /** |
178 | 178 | * Update Old Payments Totals |
@@ -187,25 +187,25 @@ discard block |
||
187 | 187 | * |
188 | 188 | * @return void |
189 | 189 | */ |
190 | -function give_update_old_payments_with_totals( $data ) { |
|
191 | - if ( ! wp_verify_nonce( $data['_wpnonce'], 'give_upgrade_payments_nonce' ) ) { |
|
190 | +function give_update_old_payments_with_totals($data) { |
|
191 | + if ( ! wp_verify_nonce($data['_wpnonce'], 'give_upgrade_payments_nonce')) { |
|
192 | 192 | return; |
193 | 193 | } |
194 | 194 | |
195 | - if ( get_option( 'give_payment_totals_upgraded' ) ) { |
|
195 | + if (get_option('give_payment_totals_upgraded')) { |
|
196 | 196 | return; |
197 | 197 | } |
198 | 198 | |
199 | - $payments = give_get_payments( array( |
|
199 | + $payments = give_get_payments(array( |
|
200 | 200 | 'offset' => 0, |
201 | - 'number' => - 1, |
|
201 | + 'number' => -1, |
|
202 | 202 | 'mode' => 'all', |
203 | - ) ); |
|
203 | + )); |
|
204 | 204 | |
205 | - if ( $payments ) { |
|
206 | - foreach ( $payments as $payment ) { |
|
205 | + if ($payments) { |
|
206 | + foreach ($payments as $payment) { |
|
207 | 207 | |
208 | - $payment = new Give_Payment( $payment->ID ); |
|
208 | + $payment = new Give_Payment($payment->ID); |
|
209 | 209 | $meta = $payment->get_meta(); |
210 | 210 | |
211 | 211 | $payment->total = $meta['amount']; |
@@ -214,10 +214,10 @@ discard block |
||
214 | 214 | } |
215 | 215 | } |
216 | 216 | |
217 | - add_option( 'give_payment_totals_upgraded', 1 ); |
|
217 | + add_option('give_payment_totals_upgraded', 1); |
|
218 | 218 | } |
219 | 219 | |
220 | -add_action( 'give_upgrade_payments', 'give_update_old_payments_with_totals' ); |
|
220 | +add_action('give_upgrade_payments', 'give_update_old_payments_with_totals'); |
|
221 | 221 | |
222 | 222 | /** |
223 | 223 | * Mark Abandoned Donations |
@@ -231,17 +231,17 @@ discard block |
||
231 | 231 | function give_mark_abandoned_donations() { |
232 | 232 | $args = array( |
233 | 233 | 'status' => 'pending', |
234 | - 'number' => - 1, |
|
234 | + 'number' => -1, |
|
235 | 235 | 'output' => 'give_payments', |
236 | 236 | ); |
237 | 237 | |
238 | - add_filter( 'posts_where', 'give_filter_where_older_than_week' ); |
|
238 | + add_filter('posts_where', 'give_filter_where_older_than_week'); |
|
239 | 239 | |
240 | - $payments = give_get_payments( $args ); |
|
240 | + $payments = give_get_payments($args); |
|
241 | 241 | |
242 | - remove_filter( 'posts_where', 'give_filter_where_older_than_week' ); |
|
242 | + remove_filter('posts_where', 'give_filter_where_older_than_week'); |
|
243 | 243 | |
244 | - if ( $payments ) { |
|
244 | + if ($payments) { |
|
245 | 245 | /** |
246 | 246 | * Filter payment gateways: Used to set payment gateways which can be skip while transferring pending payment to abandon. |
247 | 247 | * |
@@ -249,13 +249,13 @@ discard block |
||
249 | 249 | * |
250 | 250 | * @param array $skip_payment_gateways Array of payment gateways |
251 | 251 | */ |
252 | - $skip_payment_gateways = apply_filters( 'give_mark_abandoned_donation_gateways', array( 'offline' ) ); |
|
252 | + $skip_payment_gateways = apply_filters('give_mark_abandoned_donation_gateways', array('offline')); |
|
253 | 253 | |
254 | - foreach ( $payments as $payment ) { |
|
255 | - $gateway = give_get_payment_gateway( $payment ); |
|
254 | + foreach ($payments as $payment) { |
|
255 | + $gateway = give_get_payment_gateway($payment); |
|
256 | 256 | |
257 | 257 | // Skip payment gateways. |
258 | - if ( in_array( $gateway, $skip_payment_gateways ) ) { |
|
258 | + if (in_array($gateway, $skip_payment_gateways)) { |
|
259 | 259 | continue; |
260 | 260 | } |
261 | 261 | |
@@ -265,7 +265,7 @@ discard block |
||
265 | 265 | } |
266 | 266 | } |
267 | 267 | |
268 | -add_action( 'give_weekly_scheduled_events', 'give_mark_abandoned_donations' ); |
|
268 | +add_action('give_weekly_scheduled_events', 'give_mark_abandoned_donations'); |
|
269 | 269 | |
270 | 270 | |
271 | 271 | /** |
@@ -277,15 +277,15 @@ discard block |
||
277 | 277 | * |
278 | 278 | * @return void |
279 | 279 | */ |
280 | -function give_refresh_thismonth_stat_transients( $payment_ID ) { |
|
280 | +function give_refresh_thismonth_stat_transients($payment_ID) { |
|
281 | 281 | |
282 | 282 | /* @var Give_Payment_Stats $stats Give_Payment_Stats class object. */ |
283 | 283 | $stats = new Give_Payment_Stats(); |
284 | 284 | |
285 | 285 | // Delete transients. |
286 | - delete_transient( 'give_estimated_monthly_stats' ); |
|
287 | - delete_transient( 'give_earnings_total' ); |
|
288 | - delete_transient( $stats->get_earnings_cache_key( 0, 'this_month' ) ); |
|
286 | + delete_transient('give_estimated_monthly_stats'); |
|
287 | + delete_transient('give_earnings_total'); |
|
288 | + delete_transient($stats->get_earnings_cache_key(0, 'this_month')); |
|
289 | 289 | } |
290 | 290 | |
291 | -add_action( 'save_post_give_payment', 'give_refresh_thismonth_stat_transients' ); |
|
291 | +add_action('save_post_give_payment', 'give_refresh_thismonth_stat_transients'); |
@@ -713,7 +713,7 @@ |
||
713 | 713 | * |
714 | 714 | * @param array $value The form field value array |
715 | 715 | * |
716 | - * @return array The description and tip as a 2 element array |
|
716 | + * @return string The description and tip as a 2 element array |
|
717 | 717 | */ |
718 | 718 | public static function get_field_description( $value ) { |
719 | 719 | $description = ''; |
@@ -9,11 +9,11 @@ discard block |
||
9 | 9 | * @since 1.8 |
10 | 10 | */ |
11 | 11 | |
12 | -if ( ! defined( 'ABSPATH' ) ) { |
|
12 | +if ( ! defined('ABSPATH')) { |
|
13 | 13 | exit; |
14 | 14 | } |
15 | 15 | |
16 | -if ( ! class_exists( 'Give_Admin_Settings' ) ) : |
|
16 | +if ( ! class_exists('Give_Admin_Settings')) : |
|
17 | 17 | |
18 | 18 | /** |
19 | 19 | * Give_Admin_Settings Class. |
@@ -72,7 +72,7 @@ discard block |
||
72 | 72 | * |
73 | 73 | * @param array $settings Array of settings class object. |
74 | 74 | */ |
75 | - self::$settings = apply_filters( self::$setting_filter_prefix . '_get_settings_pages', array() ); |
|
75 | + self::$settings = apply_filters(self::$setting_filter_prefix.'_get_settings_pages', array()); |
|
76 | 76 | |
77 | 77 | return self::$settings; |
78 | 78 | } |
@@ -86,8 +86,8 @@ discard block |
||
86 | 86 | public static function save() { |
87 | 87 | $current_tab = give_get_current_setting_tab(); |
88 | 88 | |
89 | - if ( empty( $_REQUEST['_give-save-settings'] ) || ! wp_verify_nonce( $_REQUEST['_give-save-settings'], 'give-save-settings' ) ) { |
|
90 | - die( __( 'Action failed. Please refresh the page and retry.', 'give' ) ); |
|
89 | + if (empty($_REQUEST['_give-save-settings']) || ! wp_verify_nonce($_REQUEST['_give-save-settings'], 'give-save-settings')) { |
|
90 | + die(__('Action failed. Please refresh the page and retry.', 'give')); |
|
91 | 91 | } |
92 | 92 | |
93 | 93 | /** |
@@ -99,9 +99,9 @@ discard block |
||
99 | 99 | * |
100 | 100 | * @since 1.8 |
101 | 101 | */ |
102 | - do_action( self::$setting_filter_prefix . '_save_' . $current_tab ); |
|
102 | + do_action(self::$setting_filter_prefix.'_save_'.$current_tab); |
|
103 | 103 | |
104 | - self::add_message( 'give-setting-updated', __( 'Your settings have been saved.', 'give' ) ); |
|
104 | + self::add_message('give-setting-updated', __('Your settings have been saved.', 'give')); |
|
105 | 105 | |
106 | 106 | /** |
107 | 107 | * Trigger Action. |
@@ -112,7 +112,7 @@ discard block |
||
112 | 112 | * |
113 | 113 | * @since 1.8 |
114 | 114 | */ |
115 | - do_action( self::$setting_filter_prefix . '_saved' ); |
|
115 | + do_action(self::$setting_filter_prefix.'_saved'); |
|
116 | 116 | } |
117 | 117 | |
118 | 118 | /** |
@@ -125,8 +125,8 @@ discard block |
||
125 | 125 | * |
126 | 126 | * @return void |
127 | 127 | */ |
128 | - public static function add_message( $code, $message ) { |
|
129 | - self::$messages[ $code ] = $message; |
|
128 | + public static function add_message($code, $message) { |
|
129 | + self::$messages[$code] = $message; |
|
130 | 130 | } |
131 | 131 | |
132 | 132 | /** |
@@ -139,8 +139,8 @@ discard block |
||
139 | 139 | * |
140 | 140 | * @return void |
141 | 141 | */ |
142 | - public static function add_error( $code, $message ) { |
|
143 | - self::$errors[ $code ] = $message; |
|
142 | + public static function add_error($code, $message) { |
|
143 | + self::$errors[$code] = $message; |
|
144 | 144 | } |
145 | 145 | |
146 | 146 | /** |
@@ -153,18 +153,18 @@ discard block |
||
153 | 153 | $notice_html = ''; |
154 | 154 | $classes = 'give-notice settings-error notice is-dismissible'; |
155 | 155 | |
156 | - self::$errors = apply_filters( self::$setting_filter_prefix . '_error_notices', self::$errors ); |
|
157 | - self::$messages = apply_filters( self::$setting_filter_prefix . '_update_notices', self::$messages ); |
|
156 | + self::$errors = apply_filters(self::$setting_filter_prefix.'_error_notices', self::$errors); |
|
157 | + self::$messages = apply_filters(self::$setting_filter_prefix.'_update_notices', self::$messages); |
|
158 | 158 | |
159 | - if ( 0 < count( self::$errors ) ) { |
|
160 | - foreach ( self::$errors as $code => $message ) { |
|
161 | - $notice_html .= '<div id="setting-error-' . $code . '" class="' . $classes . ' error"><p><strong>' . $message . '</strong></p></div>'; |
|
159 | + if (0 < count(self::$errors)) { |
|
160 | + foreach (self::$errors as $code => $message) { |
|
161 | + $notice_html .= '<div id="setting-error-'.$code.'" class="'.$classes.' error"><p><strong>'.$message.'</strong></p></div>'; |
|
162 | 162 | } |
163 | 163 | } |
164 | 164 | |
165 | - if ( 0 < count( self::$messages ) ) { |
|
166 | - foreach ( self::$messages as $code => $message ) { |
|
167 | - $notice_html .= '<div id="setting-error-' . $code . '" class="' . $classes . ' updated"><p><strong>' . $message . '</strong></p></div>'; |
|
165 | + if (0 < count(self::$messages)) { |
|
166 | + foreach (self::$messages as $code => $message) { |
|
167 | + $notice_html .= '<div id="setting-error-'.$code.'" class="'.$classes.' updated"><p><strong>'.$message.'</strong></p></div>'; |
|
168 | 168 | } |
169 | 169 | } |
170 | 170 | |
@@ -184,7 +184,7 @@ discard block |
||
184 | 184 | self::$setting_filter_prefix = give_get_current_setting_page(); |
185 | 185 | |
186 | 186 | // Bailout: Exit if setting page is not defined. |
187 | - if ( empty( self::$setting_filter_prefix ) ) { |
|
187 | + if (empty(self::$setting_filter_prefix)) { |
|
188 | 188 | return false; |
189 | 189 | } |
190 | 190 | |
@@ -197,7 +197,7 @@ discard block |
||
197 | 197 | * |
198 | 198 | * @since 1.8 |
199 | 199 | */ |
200 | - do_action( self::$setting_filter_prefix . '_start' ); |
|
200 | + do_action(self::$setting_filter_prefix.'_start'); |
|
201 | 201 | |
202 | 202 | $current_tab = give_get_current_setting_tab(); |
203 | 203 | |
@@ -205,7 +205,7 @@ discard block |
||
205 | 205 | self::get_settings_pages(); |
206 | 206 | |
207 | 207 | // Save settings if data has been posted. |
208 | - if ( ! empty( $_POST ) ) { |
|
208 | + if ( ! empty($_POST)) { |
|
209 | 209 | self::save(); |
210 | 210 | } |
211 | 211 | |
@@ -218,7 +218,7 @@ discard block |
||
218 | 218 | * |
219 | 219 | * @since 1.8 |
220 | 220 | */ |
221 | - $tabs = apply_filters( self::$setting_filter_prefix . '_tabs_array', array() ); |
|
221 | + $tabs = apply_filters(self::$setting_filter_prefix.'_tabs_array', array()); |
|
222 | 222 | |
223 | 223 | include 'views/html-admin-settings.php'; |
224 | 224 | |
@@ -236,25 +236,25 @@ discard block |
||
236 | 236 | * |
237 | 237 | * @return string|bool |
238 | 238 | */ |
239 | - public static function get_option( $option_name = '', $field_id = '', $default = false ) { |
|
239 | + public static function get_option($option_name = '', $field_id = '', $default = false) { |
|
240 | 240 | // Bailout. |
241 | - if ( empty( $option_name ) && empty( $field_id ) ) { |
|
241 | + if (empty($option_name) && empty($field_id)) { |
|
242 | 242 | return false; |
243 | 243 | } |
244 | 244 | |
245 | - if ( ! empty( $field_id ) && ! empty( $option_name ) ) { |
|
245 | + if ( ! empty($field_id) && ! empty($option_name)) { |
|
246 | 246 | // Get field value if any. |
247 | - $option_value = get_option( $option_name ); |
|
247 | + $option_value = get_option($option_name); |
|
248 | 248 | |
249 | - $option_value = ( is_array( $option_value ) && array_key_exists( $field_id, $option_value ) ) |
|
250 | - ? $option_value[ $field_id ] |
|
249 | + $option_value = (is_array($option_value) && array_key_exists($field_id, $option_value)) |
|
250 | + ? $option_value[$field_id] |
|
251 | 251 | : $default; |
252 | 252 | } else { |
253 | 253 | // If option name is empty but not field name then this means, setting is direct store to option table under there field name. |
254 | 254 | $option_name = ! $option_name ? $field_id : $option_name; |
255 | 255 | |
256 | 256 | // Get option value if any. |
257 | - $option_value = get_option( $option_name, $default ); |
|
257 | + $option_value = get_option($option_name, $default); |
|
258 | 258 | } |
259 | 259 | |
260 | 260 | return $option_value; |
@@ -272,7 +272,7 @@ discard block |
||
272 | 272 | * |
273 | 273 | * @return void |
274 | 274 | */ |
275 | - public static function output_fields( $options, $option_name = '' ) { |
|
275 | + public static function output_fields($options, $option_name = '') { |
|
276 | 276 | $current_tab = give_get_current_setting_tab(); |
277 | 277 | |
278 | 278 | // Field Default values. |
@@ -285,46 +285,46 @@ discard block |
||
285 | 285 | 'table_html' => true, |
286 | 286 | ); |
287 | 287 | |
288 | - foreach ( $options as $value ) { |
|
289 | - if ( ! isset( $value['type'] ) ) { |
|
288 | + foreach ($options as $value) { |
|
289 | + if ( ! isset($value['type'])) { |
|
290 | 290 | continue; |
291 | 291 | } |
292 | 292 | |
293 | 293 | // Set title. |
294 | - $defaults['title'] = isset( $value['name'] ) ? $value['name'] : ''; |
|
294 | + $defaults['title'] = isset($value['name']) ? $value['name'] : ''; |
|
295 | 295 | |
296 | - $value = wp_parse_args( $value, $defaults ); |
|
296 | + $value = wp_parse_args($value, $defaults); |
|
297 | 297 | |
298 | 298 | // Custom attribute handling. |
299 | 299 | $custom_attributes = array(); |
300 | 300 | |
301 | - if ( ! empty( $value['attributes'] ) && is_array( $value['attributes'] ) ) { |
|
302 | - foreach ( $value['attributes'] as $attribute => $attribute_value ) { |
|
303 | - $custom_attributes[] = esc_attr( $attribute ) . '="' . esc_attr( $attribute_value ) . '"'; |
|
301 | + if ( ! empty($value['attributes']) && is_array($value['attributes'])) { |
|
302 | + foreach ($value['attributes'] as $attribute => $attribute_value) { |
|
303 | + $custom_attributes[] = esc_attr($attribute).'="'.esc_attr($attribute_value).'"'; |
|
304 | 304 | } |
305 | 305 | } |
306 | 306 | |
307 | 307 | // Description handling. |
308 | - $description = self::get_field_description( $value ); |
|
308 | + $description = self::get_field_description($value); |
|
309 | 309 | |
310 | 310 | // Switch based on type. |
311 | - switch ( $value['type'] ) { |
|
311 | + switch ($value['type']) { |
|
312 | 312 | |
313 | 313 | // Section Titles |
314 | 314 | case 'title': |
315 | - if ( ! empty( $value['title'] ) ) { |
|
316 | - echo '<div class="give-setting-tab-header give-setting-tab-header-' . $current_tab . '"><h2>' . self::get_field_title( $value ) . '</h2><hr></div>'; |
|
315 | + if ( ! empty($value['title'])) { |
|
316 | + echo '<div class="give-setting-tab-header give-setting-tab-header-'.$current_tab.'"><h2>'.self::get_field_title($value).'</h2><hr></div>'; |
|
317 | 317 | } |
318 | 318 | |
319 | - if ( ! empty( $value['desc'] ) ) { |
|
320 | - echo wpautop( wptexturize( wp_kses_post( $value['desc'] ) ) ); |
|
319 | + if ( ! empty($value['desc'])) { |
|
320 | + echo wpautop(wptexturize(wp_kses_post($value['desc']))); |
|
321 | 321 | } |
322 | 322 | |
323 | - if ( $value['table_html'] ) { |
|
324 | - echo '<table class="form-table give-setting-tab-body give-setting-tab-body-' . $current_tab . '">' . "\n\n"; |
|
323 | + if ($value['table_html']) { |
|
324 | + echo '<table class="form-table give-setting-tab-body give-setting-tab-body-'.$current_tab.'">'."\n\n"; |
|
325 | 325 | } |
326 | 326 | |
327 | - if ( ! empty( $value['id'] ) ) { |
|
327 | + if ( ! empty($value['id'])) { |
|
328 | 328 | |
329 | 329 | /** |
330 | 330 | * Trigger Action. |
@@ -333,14 +333,14 @@ discard block |
||
333 | 333 | * |
334 | 334 | * @since 1.8 |
335 | 335 | */ |
336 | - do_action( 'give_settings_' . sanitize_title( $value['id'] ) ); |
|
336 | + do_action('give_settings_'.sanitize_title($value['id'])); |
|
337 | 337 | } |
338 | 338 | |
339 | 339 | break; |
340 | 340 | |
341 | 341 | // Section Ends. |
342 | 342 | case 'sectionend': |
343 | - if ( ! empty( $value['id'] ) ) { |
|
343 | + if ( ! empty($value['id'])) { |
|
344 | 344 | |
345 | 345 | /** |
346 | 346 | * Trigger Action. |
@@ -349,14 +349,14 @@ discard block |
||
349 | 349 | * |
350 | 350 | * @since 1.8 |
351 | 351 | */ |
352 | - do_action( 'give_settings_' . sanitize_title( $value['id'] ) . '_end' ); |
|
352 | + do_action('give_settings_'.sanitize_title($value['id']).'_end'); |
|
353 | 353 | } |
354 | 354 | |
355 | - if ( $value['table_html'] ) { |
|
355 | + if ($value['table_html']) { |
|
356 | 356 | echo '</table>'; |
357 | 357 | } |
358 | 358 | |
359 | - if ( ! empty( $value['id'] ) ) { |
|
359 | + if ( ! empty($value['id'])) { |
|
360 | 360 | |
361 | 361 | /** |
362 | 362 | * Trigger Action. |
@@ -365,7 +365,7 @@ discard block |
||
365 | 365 | * |
366 | 366 | * @since 1.8 |
367 | 367 | */ |
368 | - do_action( 'give_settings_' . sanitize_title( $value['id'] ) . '_after' ); |
|
368 | + do_action('give_settings_'.sanitize_title($value['id']).'_after'); |
|
369 | 369 | } |
370 | 370 | |
371 | 371 | break; |
@@ -377,22 +377,22 @@ discard block |
||
377 | 377 | case 'password' : |
378 | 378 | |
379 | 379 | $type = $value['type']; |
380 | - $option_value = self::get_option( $option_name, $value['id'], $value['default'] ); |
|
380 | + $option_value = self::get_option($option_name, $value['id'], $value['default']); |
|
381 | 381 | |
382 | 382 | ?> |
383 | - <tr valign="top" <?php echo ! empty( $value['wrapper_class'] ) ? 'class="' . $value['wrapper_class'] . '"' : '' ?>> |
|
383 | + <tr valign="top" <?php echo ! empty($value['wrapper_class']) ? 'class="'.$value['wrapper_class'].'"' : '' ?>> |
|
384 | 384 | <th scope="row" class="titledesc"> |
385 | - <label for="<?php echo esc_attr( $value['id'] ); ?>"><?php echo self::get_field_title( $value ); ?></label> |
|
385 | + <label for="<?php echo esc_attr($value['id']); ?>"><?php echo self::get_field_title($value); ?></label> |
|
386 | 386 | </th> |
387 | - <td class="give-forminp give-forminp-<?php echo sanitize_title( $value['type'] ) ?>"> |
|
387 | + <td class="give-forminp give-forminp-<?php echo sanitize_title($value['type']) ?>"> |
|
388 | 388 | <input |
389 | - name="<?php echo esc_attr( $value['id'] ); ?>" |
|
390 | - id="<?php echo esc_attr( $value['id'] ); ?>" |
|
391 | - type="<?php echo esc_attr( $type ); ?>" |
|
392 | - style="<?php echo esc_attr( $value['css'] ); ?>" |
|
393 | - value="<?php echo esc_attr( $option_value ); ?>" |
|
394 | - class="give-input-field<?php echo( empty( $value['class'] ) ? '' : ' ' . esc_attr( $value['class'] ) ); ?>" |
|
395 | - <?php echo implode( ' ', $custom_attributes ); ?> |
|
389 | + name="<?php echo esc_attr($value['id']); ?>" |
|
390 | + id="<?php echo esc_attr($value['id']); ?>" |
|
391 | + type="<?php echo esc_attr($type); ?>" |
|
392 | + style="<?php echo esc_attr($value['css']); ?>" |
|
393 | + value="<?php echo esc_attr($option_value); ?>" |
|
394 | + class="give-input-field<?php echo(empty($value['class']) ? '' : ' '.esc_attr($value['class'])); ?>" |
|
395 | + <?php echo implode(' ', $custom_attributes); ?> |
|
396 | 396 | /> <?php echo $description; ?> |
397 | 397 | </td> |
398 | 398 | </tr><?php |
@@ -401,23 +401,23 @@ discard block |
||
401 | 401 | // Textarea. |
402 | 402 | case 'textarea': |
403 | 403 | |
404 | - $option_value = self::get_option( $option_name, $value['id'], $value['default'] ); |
|
404 | + $option_value = self::get_option($option_name, $value['id'], $value['default']); |
|
405 | 405 | |
406 | 406 | ?> |
407 | - <tr valign="top" <?php echo ! empty( $value['wrapper_class'] ) ? 'class="' . $value['wrapper_class'] . '"' : '' ?>> |
|
407 | + <tr valign="top" <?php echo ! empty($value['wrapper_class']) ? 'class="'.$value['wrapper_class'].'"' : '' ?>> |
|
408 | 408 | <th scope="row" class="titledesc"> |
409 | - <label for="<?php echo esc_attr( $value['id'] ); ?>"><?php echo self::get_field_title( $value ); ?></label> |
|
409 | + <label for="<?php echo esc_attr($value['id']); ?>"><?php echo self::get_field_title($value); ?></label> |
|
410 | 410 | </th> |
411 | - <td class="give-forminp give-forminp-<?php echo sanitize_title( $value['type'] ) ?>"> |
|
411 | + <td class="give-forminp give-forminp-<?php echo sanitize_title($value['type']) ?>"> |
|
412 | 412 | <textarea |
413 | - name="<?php echo esc_attr( $value['id'] ); ?>" |
|
414 | - id="<?php echo esc_attr( $value['id'] ); ?>" |
|
415 | - style="<?php echo esc_attr( $value['css'] ); ?>" |
|
416 | - class="<?php echo esc_attr( $value['class'] ); ?>" |
|
413 | + name="<?php echo esc_attr($value['id']); ?>" |
|
414 | + id="<?php echo esc_attr($value['id']); ?>" |
|
415 | + style="<?php echo esc_attr($value['css']); ?>" |
|
416 | + class="<?php echo esc_attr($value['class']); ?>" |
|
417 | 417 | rows="10" |
418 | 418 | cols="60" |
419 | - <?php echo implode( ' ', $custom_attributes ); ?> |
|
420 | - ><?php echo esc_textarea( $option_value ); ?></textarea> |
|
419 | + <?php echo implode(' ', $custom_attributes); ?> |
|
420 | + ><?php echo esc_textarea($option_value); ?></textarea> |
|
421 | 421 | <?php echo $description; ?> |
422 | 422 | </td> |
423 | 423 | </tr><?php |
@@ -427,35 +427,35 @@ discard block |
||
427 | 427 | case 'select' : |
428 | 428 | case 'multiselect' : |
429 | 429 | |
430 | - $option_value = self::get_option( $option_name, $value['id'], $value['default'] ); |
|
430 | + $option_value = self::get_option($option_name, $value['id'], $value['default']); |
|
431 | 431 | |
432 | 432 | ?> |
433 | - <tr valign="top" <?php echo ! empty( $value['wrapper_class'] ) ? 'class="' . $value['wrapper_class'] . '"' : '' ?>> |
|
433 | + <tr valign="top" <?php echo ! empty($value['wrapper_class']) ? 'class="'.$value['wrapper_class'].'"' : '' ?>> |
|
434 | 434 | <th scope="row" class="titledesc"> |
435 | - <label for="<?php echo esc_attr( $value['id'] ); ?>"><?php echo self::get_field_title( $value ); ?></label> |
|
435 | + <label for="<?php echo esc_attr($value['id']); ?>"><?php echo self::get_field_title($value); ?></label> |
|
436 | 436 | </th> |
437 | - <td class="give-forminp give-forminp-<?php echo sanitize_title( $value['type'] ) ?>"> |
|
437 | + <td class="give-forminp give-forminp-<?php echo sanitize_title($value['type']) ?>"> |
|
438 | 438 | <select |
439 | - name="<?php echo esc_attr( $value['id'] ); ?><?php if ( $value['type'] == 'multiselect' ) { |
|
439 | + name="<?php echo esc_attr($value['id']); ?><?php if ($value['type'] == 'multiselect') { |
|
440 | 440 | echo '[]'; |
441 | 441 | } ?>" |
442 | - id="<?php echo esc_attr( $value['id'] ); ?>" |
|
443 | - style="<?php echo esc_attr( $value['css'] ); ?>" |
|
444 | - class="<?php echo esc_attr( $value['class'] ); ?>" |
|
445 | - <?php echo implode( ' ', $custom_attributes ); ?> |
|
446 | - <?php echo ( 'multiselect' == $value['type'] ) ? 'multiple="multiple"' : ''; ?> |
|
442 | + id="<?php echo esc_attr($value['id']); ?>" |
|
443 | + style="<?php echo esc_attr($value['css']); ?>" |
|
444 | + class="<?php echo esc_attr($value['class']); ?>" |
|
445 | + <?php echo implode(' ', $custom_attributes); ?> |
|
446 | + <?php echo ('multiselect' == $value['type']) ? 'multiple="multiple"' : ''; ?> |
|
447 | 447 | > |
448 | 448 | |
449 | 449 | <?php |
450 | - if ( ! empty( $value['options'] ) ) { |
|
451 | - foreach ( $value['options'] as $key => $val ) { |
|
450 | + if ( ! empty($value['options'])) { |
|
451 | + foreach ($value['options'] as $key => $val) { |
|
452 | 452 | ?> |
453 | - <option value="<?php echo esc_attr( $key ); ?>" <?php |
|
453 | + <option value="<?php echo esc_attr($key); ?>" <?php |
|
454 | 454 | |
455 | - if ( is_array( $option_value ) ) { |
|
456 | - selected( in_array( $key, $option_value ), true ); |
|
455 | + if (is_array($option_value)) { |
|
456 | + selected(in_array($key, $option_value), true); |
|
457 | 457 | } else { |
458 | - selected( $option_value, $key ); |
|
458 | + selected($option_value, $key); |
|
459 | 459 | } |
460 | 460 | |
461 | 461 | ?>><?php echo $val ?></option> |
@@ -471,28 +471,28 @@ discard block |
||
471 | 471 | |
472 | 472 | // Radio inputs. |
473 | 473 | case 'radio_inline' : |
474 | - $value['class'] = empty( $value['class'] ) ? 'give-radio-inline' : $value['class'] . ' give-radio-inline'; |
|
474 | + $value['class'] = empty($value['class']) ? 'give-radio-inline' : $value['class'].' give-radio-inline'; |
|
475 | 475 | case 'radio' : |
476 | - $option_value = self::get_option( $option_name, $value['id'], $value['default'] ); |
|
476 | + $option_value = self::get_option($option_name, $value['id'], $value['default']); |
|
477 | 477 | ?> |
478 | - <tr valign="top" <?php echo ! empty( $value['wrapper_class'] ) ? 'class="' . $value['wrapper_class'] . '"' : '' ?>> |
|
478 | + <tr valign="top" <?php echo ! empty($value['wrapper_class']) ? 'class="'.$value['wrapper_class'].'"' : '' ?>> |
|
479 | 479 | <th scope="row" class="titledesc"> |
480 | - <label for="<?php echo esc_attr( $value['id'] ); ?>"><?php echo self::get_field_title( $value ); ?></label> |
|
480 | + <label for="<?php echo esc_attr($value['id']); ?>"><?php echo self::get_field_title($value); ?></label> |
|
481 | 481 | </th> |
482 | - <td class="give-forminp give-forminp-<?php echo sanitize_title( $value['type'] ) ?> <?php echo( ! empty( $value['class'] ) ? $value['class'] : '' ); ?>"> |
|
482 | + <td class="give-forminp give-forminp-<?php echo sanitize_title($value['type']) ?> <?php echo( ! empty($value['class']) ? $value['class'] : ''); ?>"> |
|
483 | 483 | <fieldset> |
484 | 484 | <ul> |
485 | 485 | <?php |
486 | - foreach ( $value['options'] as $key => $val ) { |
|
486 | + foreach ($value['options'] as $key => $val) { |
|
487 | 487 | ?> |
488 | 488 | <li> |
489 | 489 | <label><input |
490 | - name="<?php echo esc_attr( $value['id'] ); ?>" |
|
490 | + name="<?php echo esc_attr($value['id']); ?>" |
|
491 | 491 | value="<?php echo $key; ?>" |
492 | 492 | type="radio" |
493 | - style="<?php echo esc_attr( $value['css'] ); ?>" |
|
494 | - <?php echo implode( ' ', $custom_attributes ); ?> |
|
495 | - <?php checked( $key, $option_value ); ?> |
|
493 | + style="<?php echo esc_attr($value['css']); ?>" |
|
494 | + <?php echo implode(' ', $custom_attributes); ?> |
|
495 | + <?php checked($key, $option_value); ?> |
|
496 | 496 | /> <?php echo $val ?></label> |
497 | 497 | </li> |
498 | 498 | <?php |
@@ -506,21 +506,21 @@ discard block |
||
506 | 506 | |
507 | 507 | // Checkbox input. |
508 | 508 | case 'checkbox' : |
509 | - $option_value = self::get_option( $option_name, $value['id'], $value['default'] ); |
|
509 | + $option_value = self::get_option($option_name, $value['id'], $value['default']); |
|
510 | 510 | ?> |
511 | - <tr valign="top" <?php echo ! empty( $value['wrapper_class'] ) ? 'class="' . $value['wrapper_class'] . '"' : '' ?>> |
|
511 | + <tr valign="top" <?php echo ! empty($value['wrapper_class']) ? 'class="'.$value['wrapper_class'].'"' : '' ?>> |
|
512 | 512 | <th scope="row" class="titledesc"> |
513 | - <label for="<?php echo esc_attr( $value['id'] ); ?>"><?php echo self::get_field_title( $value ); ?></label> |
|
513 | + <label for="<?php echo esc_attr($value['id']); ?>"><?php echo self::get_field_title($value); ?></label> |
|
514 | 514 | </th> |
515 | 515 | <td class="give-forminp"> |
516 | 516 | <input |
517 | - name="<?php echo esc_attr( $value['id'] ); ?>" |
|
518 | - id="<?php echo esc_attr( $value['id'] ); ?>" |
|
517 | + name="<?php echo esc_attr($value['id']); ?>" |
|
518 | + id="<?php echo esc_attr($value['id']); ?>" |
|
519 | 519 | type="checkbox" |
520 | - class="<?php echo esc_attr( isset( $value['class'] ) ? $value['class'] : '' ); ?>" |
|
520 | + class="<?php echo esc_attr(isset($value['class']) ? $value['class'] : ''); ?>" |
|
521 | 521 | value="1" |
522 | - <?php checked( $option_value, 'on' ); ?> |
|
523 | - <?php echo implode( ' ', $custom_attributes ); ?> |
|
522 | + <?php checked($option_value, 'on'); ?> |
|
523 | + <?php echo implode(' ', $custom_attributes); ?> |
|
524 | 524 | /> |
525 | 525 | <?php echo $description; ?> |
526 | 526 | </td> |
@@ -530,28 +530,28 @@ discard block |
||
530 | 530 | |
531 | 531 | // Multi Checkbox input. |
532 | 532 | case 'multicheck' : |
533 | - $option_value = self::get_option( $option_name, $value['id'], $value['default'] ); |
|
534 | - $option_value = is_array( $option_value ) ? $option_value : array(); |
|
533 | + $option_value = self::get_option($option_name, $value['id'], $value['default']); |
|
534 | + $option_value = is_array($option_value) ? $option_value : array(); |
|
535 | 535 | ?> |
536 | - <tr valign="top" <?php echo ! empty( $value['wrapper_class'] ) ? 'class="' . $value['wrapper_class'] . '"' : '' ?>> |
|
536 | + <tr valign="top" <?php echo ! empty($value['wrapper_class']) ? 'class="'.$value['wrapper_class'].'"' : '' ?>> |
|
537 | 537 | <th scope="row" class="titledesc"> |
538 | - <label for="<?php echo esc_attr( $value['id'] ); ?>"><?php echo self::get_field_title( $value ); ?></label> |
|
538 | + <label for="<?php echo esc_attr($value['id']); ?>"><?php echo self::get_field_title($value); ?></label> |
|
539 | 539 | </th> |
540 | - <td class="give-forminp give-forminp-<?php echo sanitize_title( $value['type'] ) ?> <?php echo( ! empty( $value['class'] ) ? $value['class'] : '' ); ?>"> |
|
540 | + <td class="give-forminp give-forminp-<?php echo sanitize_title($value['type']) ?> <?php echo( ! empty($value['class']) ? $value['class'] : ''); ?>"> |
|
541 | 541 | <fieldset> |
542 | 542 | <ul> |
543 | 543 | <?php |
544 | - foreach ( $value['options'] as $key => $val ) { |
|
544 | + foreach ($value['options'] as $key => $val) { |
|
545 | 545 | ?> |
546 | 546 | <li> |
547 | 547 | <label> |
548 | 548 | <input |
549 | - name="<?php echo esc_attr( $value['id'] ); ?>[]" |
|
549 | + name="<?php echo esc_attr($value['id']); ?>[]" |
|
550 | 550 | value="<?php echo $key; ?>" |
551 | 551 | type="checkbox" |
552 | - style="<?php echo esc_attr( $value['css'] ); ?>" |
|
553 | - <?php echo implode( ' ', $custom_attributes ); ?> |
|
554 | - <?php if ( in_array( $key, $option_value ) ) { |
|
552 | + style="<?php echo esc_attr($value['css']); ?>" |
|
553 | + <?php echo implode(' ', $custom_attributes); ?> |
|
554 | + <?php if (in_array($key, $option_value)) { |
|
555 | 555 | echo 'checked="checked"'; |
556 | 556 | } ?> |
557 | 557 | /> <?php echo $val ?> |
@@ -569,24 +569,24 @@ discard block |
||
569 | 569 | |
570 | 570 | // File input field. |
571 | 571 | case 'file' : |
572 | - $option_value = self::get_option( $option_name, $value['id'], $value['default'] ); |
|
572 | + $option_value = self::get_option($option_name, $value['id'], $value['default']); |
|
573 | 573 | ?> |
574 | - <tr valign="top" <?php echo ! empty( $value['wrapper_class'] ) ? 'class="' . $value['wrapper_class'] . '"' : '' ?>> |
|
574 | + <tr valign="top" <?php echo ! empty($value['wrapper_class']) ? 'class="'.$value['wrapper_class'].'"' : '' ?>> |
|
575 | 575 | <th scope="row" class="titledesc"> |
576 | - <label for="<?php echo esc_attr( $value['id'] ); ?>"><?php echo self::get_field_title( $value ); ?></label> |
|
576 | + <label for="<?php echo esc_attr($value['id']); ?>"><?php echo self::get_field_title($value); ?></label> |
|
577 | 577 | </th> |
578 | 578 | <td class="give-forminp"> |
579 | 579 | <div class="give-field-wrap"> |
580 | 580 | <label for="<?php echo $value['id'] ?>"> |
581 | 581 | <input |
582 | - name="<?php echo esc_attr( $value['id'] ); ?>" |
|
583 | - id="<?php echo esc_attr( $value['id'] ); ?>" |
|
582 | + name="<?php echo esc_attr($value['id']); ?>" |
|
583 | + id="<?php echo esc_attr($value['id']); ?>" |
|
584 | 584 | type="text" |
585 | - class="give-input-field<?php echo esc_attr( isset( $value['class'] ) ? ' ' . $value['class'] : '' ); ?>" |
|
585 | + class="give-input-field<?php echo esc_attr(isset($value['class']) ? ' '.$value['class'] : ''); ?>" |
|
586 | 586 | value="<?php echo $option_value; ?>" |
587 | - style="<?php echo esc_attr( $value['css'] ); ?>" |
|
588 | - <?php echo implode( ' ', $custom_attributes ); ?> |
|
589 | - /> <input class="give-upload-button button" type="button" value="<?php echo esc_html__( 'Add or Upload File', 'give' ); ?>"> |
|
587 | + style="<?php echo esc_attr($value['css']); ?>" |
|
588 | + <?php echo implode(' ', $custom_attributes); ?> |
|
589 | + /> <input class="give-upload-button button" type="button" value="<?php echo esc_html__('Add or Upload File', 'give'); ?>"> |
|
590 | 590 | <?php echo $description ?> |
591 | 591 | <div class="give-image-thumb<?php echo ! $option_value ? ' give-hidden' : ''; ?>"> |
592 | 592 | <span class="give-delete-image-thumb dashicons dashicons-no-alt"></span> |
@@ -601,17 +601,17 @@ discard block |
||
601 | 601 | // WordPress Editor. |
602 | 602 | case 'wysiwyg' : |
603 | 603 | // Get option value. |
604 | - $option_value = self::get_option( $option_name, $value['id'], $value['default'] ); |
|
604 | + $option_value = self::get_option($option_name, $value['id'], $value['default']); |
|
605 | 605 | |
606 | 606 | // Get editor settings. |
607 | - $editor_settings = ! empty( $value['options'] ) ? $value['options'] : array(); |
|
607 | + $editor_settings = ! empty($value['options']) ? $value['options'] : array(); |
|
608 | 608 | ?> |
609 | - <tr valign="top" <?php echo ! empty( $value['wrapper_class'] ) ? 'class="' . $value['wrapper_class'] . '"' : '' ?>> |
|
609 | + <tr valign="top" <?php echo ! empty($value['wrapper_class']) ? 'class="'.$value['wrapper_class'].'"' : '' ?>> |
|
610 | 610 | <th scope="row" class="titledesc"> |
611 | - <label for="<?php echo esc_attr( $value['id'] ); ?>"><?php echo self::get_field_title( $value ); ?></label> |
|
611 | + <label for="<?php echo esc_attr($value['id']); ?>"><?php echo self::get_field_title($value); ?></label> |
|
612 | 612 | </th> |
613 | 613 | <td class="give-forminp"> |
614 | - <?php wp_editor( $option_value, $value['id'], $editor_settings ); ?> |
|
614 | + <?php wp_editor($option_value, $value['id'], $editor_settings); ?> |
|
615 | 615 | <?php echo $description; ?> |
616 | 616 | </td> |
617 | 617 | </tr><?php |
@@ -620,9 +620,9 @@ discard block |
||
620 | 620 | // Custom: System setting field. |
621 | 621 | case 'system_info' : |
622 | 622 | ?> |
623 | - <tr valign="top" <?php echo ! empty( $value['wrapper_class'] ) ? 'class="' . $value['wrapper_class'] . '"' : '' ?>> |
|
623 | + <tr valign="top" <?php echo ! empty($value['wrapper_class']) ? 'class="'.$value['wrapper_class'].'"' : '' ?>> |
|
624 | 624 | <th scope="row" class="titledesc"> |
625 | - <label for="<?php echo esc_attr( $value['id'] ); ?>"><?php echo self::get_field_title( $value ); ?></label> |
|
625 | + <label for="<?php echo esc_attr($value['id']); ?>"><?php echo self::get_field_title($value); ?></label> |
|
626 | 626 | </th> |
627 | 627 | <td class="give-forminp"> |
628 | 628 | <?php give_system_info_callback(); ?> |
@@ -633,14 +633,14 @@ discard block |
||
633 | 633 | |
634 | 634 | // Custom: Default gateways setting field. |
635 | 635 | case 'default_gateway' : |
636 | - $option_value = self::get_option( $option_name, $value['id'], $value['default'] ); |
|
636 | + $option_value = self::get_option($option_name, $value['id'], $value['default']); |
|
637 | 637 | ?> |
638 | - <tr valign="top" <?php echo ! empty( $value['wrapper_class'] ) ? 'class="' . $value['wrapper_class'] . '"' : '' ?>> |
|
638 | + <tr valign="top" <?php echo ! empty($value['wrapper_class']) ? 'class="'.$value['wrapper_class'].'"' : '' ?>> |
|
639 | 639 | <th scope="row" class="titledesc"> |
640 | - <label for="<?php echo esc_attr( $value['id'] ); ?>"><?php echo self::get_field_title( $value ); ?></label> |
|
640 | + <label for="<?php echo esc_attr($value['id']); ?>"><?php echo self::get_field_title($value); ?></label> |
|
641 | 641 | </th> |
642 | 642 | <td class="give-forminp"> |
643 | - <?php give_default_gateway_callback( $value, $option_value ); ?> |
|
643 | + <?php give_default_gateway_callback($value, $option_value); ?> |
|
644 | 644 | <?php echo $description; ?> |
645 | 645 | </td> |
646 | 646 | </tr><?php |
@@ -648,14 +648,14 @@ discard block |
||
648 | 648 | |
649 | 649 | // Custom: Enable gateways setting field. |
650 | 650 | case 'enabled_gateways' : |
651 | - $option_value = self::get_option( $option_name, $value['id'], $value['default'] ); |
|
651 | + $option_value = self::get_option($option_name, $value['id'], $value['default']); |
|
652 | 652 | ?> |
653 | - <tr valign="top" <?php echo ! empty( $value['wrapper_class'] ) ? 'class="' . $value['wrapper_class'] . '"' : '' ?>> |
|
653 | + <tr valign="top" <?php echo ! empty($value['wrapper_class']) ? 'class="'.$value['wrapper_class'].'"' : '' ?>> |
|
654 | 654 | <th scope="row" class="titledesc"> |
655 | - <label for="<?php echo esc_attr( $value['id'] ); ?>"><?php echo self::get_field_title( $value ); ?></label> |
|
655 | + <label for="<?php echo esc_attr($value['id']); ?>"><?php echo self::get_field_title($value); ?></label> |
|
656 | 656 | </th> |
657 | 657 | <td class="give-forminp"> |
658 | - <?php give_enabled_gateways_callback( $value, $option_value ); ?> |
|
658 | + <?php give_enabled_gateways_callback($value, $option_value); ?> |
|
659 | 659 | <?php echo $description; ?> |
660 | 660 | </td> |
661 | 661 | </tr><?php |
@@ -664,9 +664,9 @@ discard block |
||
664 | 664 | // Custom: Email preview buttons field. |
665 | 665 | case 'email_preview_buttons' : |
666 | 666 | ?> |
667 | - <tr valign="top" <?php echo ! empty( $value['wrapper_class'] ) ? 'class="' . $value['wrapper_class'] . '"' : '' ?>> |
|
667 | + <tr valign="top" <?php echo ! empty($value['wrapper_class']) ? 'class="'.$value['wrapper_class'].'"' : '' ?>> |
|
668 | 668 | <th scope="row" class="titledesc"> |
669 | - <label for="<?php echo esc_attr( $value['id'] ); ?>"><?php echo self::get_field_title( $value ); ?></label> |
|
669 | + <label for="<?php echo esc_attr($value['id']); ?>"><?php echo self::get_field_title($value); ?></label> |
|
670 | 670 | </th> |
671 | 671 | <td class="give-forminp"> |
672 | 672 | <?php give_email_preview_buttons_callback(); ?> |
@@ -697,12 +697,12 @@ discard block |
||
697 | 697 | // Custom: Give Docs Link field type. |
698 | 698 | case 'give_docs_link' : |
699 | 699 | ?> |
700 | - <tr valign="top" <?php echo ! empty( $value['wrapper_class'] ) ? 'class="' . $value['wrapper_class'] . '"' : '' ?>> |
|
700 | + <tr valign="top" <?php echo ! empty($value['wrapper_class']) ? 'class="'.$value['wrapper_class'].'"' : '' ?>> |
|
701 | 701 | <td class="give-docs-link" colspan="2"> |
702 | 702 | <?php |
703 | - echo '<p class="give-docs-link"><a href="' . esc_url( $value['url'] ) |
|
703 | + echo '<p class="give-docs-link"><a href="'.esc_url($value['url']) |
|
704 | 704 | . '" target="_blank">' |
705 | - . sprintf( esc_html__( 'Need Help? See docs on "%s"' ), $value['title'] ) |
|
705 | + . sprintf(esc_html__('Need Help? See docs on "%s"'), $value['title']) |
|
706 | 706 | . '<span class="dashicons dashicons-editor-help"></span></a></p>'; |
707 | 707 | ?> |
708 | 708 | </td> |
@@ -713,8 +713,8 @@ discard block |
||
713 | 713 | // You can add or handle your custom field action. |
714 | 714 | default: |
715 | 715 | // Get option value. |
716 | - $option_value = self::get_option( $option_name, $value['id'], $value['default'] ); |
|
717 | - do_action( 'give_admin_field_' . $value['type'], $value, $option_value ); |
|
716 | + $option_value = self::get_option($option_name, $value['id'], $value['default']); |
|
717 | + do_action('give_admin_field_'.$value['type'], $value, $option_value); |
|
718 | 718 | break; |
719 | 719 | } |
720 | 720 | } |
@@ -730,11 +730,11 @@ discard block |
||
730 | 730 | * |
731 | 731 | * @return array The description and tip as a 2 element array |
732 | 732 | */ |
733 | - public static function get_field_description( $value ) { |
|
733 | + public static function get_field_description($value) { |
|
734 | 734 | $description = ''; |
735 | 735 | |
736 | - if ( ! empty( $value['desc'] ) ) { |
|
737 | - $description = '<p class="give-field-description">' . wp_kses_post( $value['desc'] ) . '</p>'; |
|
736 | + if ( ! empty($value['desc'])) { |
|
737 | + $description = '<p class="give-field-description">'.wp_kses_post($value['desc']).'</p>'; |
|
738 | 738 | } |
739 | 739 | |
740 | 740 | return $description; |
@@ -751,11 +751,11 @@ discard block |
||
751 | 751 | * |
752 | 752 | * @return array The description and tip as a 2 element array |
753 | 753 | */ |
754 | - public static function get_field_title( $value ) { |
|
755 | - $title = esc_html( $value['title'] ); |
|
754 | + public static function get_field_title($value) { |
|
755 | + $title = esc_html($value['title']); |
|
756 | 756 | |
757 | 757 | // If html tag detected then allow them to print. |
758 | - if ( strip_tags( $title ) ) { |
|
758 | + if (strip_tags($title)) { |
|
759 | 759 | $title = $value['title']; |
760 | 760 | } |
761 | 761 | |
@@ -774,8 +774,8 @@ discard block |
||
774 | 774 | * |
775 | 775 | * @return bool |
776 | 776 | */ |
777 | - public static function save_fields( $options, $option_name = '' ) { |
|
778 | - if ( empty( $_POST ) ) { |
|
777 | + public static function save_fields($options, $option_name = '') { |
|
778 | + if (empty($_POST)) { |
|
779 | 779 | return false; |
780 | 780 | } |
781 | 781 | |
@@ -783,37 +783,37 @@ discard block |
||
783 | 783 | $update_options = array(); |
784 | 784 | |
785 | 785 | // Loop options and get values to save. |
786 | - foreach ( $options as $option ) { |
|
787 | - if ( ! isset( $option['id'] ) || ! isset( $option['type'] ) ) { |
|
786 | + foreach ($options as $option) { |
|
787 | + if ( ! isset($option['id']) || ! isset($option['type'])) { |
|
788 | 788 | continue; |
789 | 789 | } |
790 | 790 | |
791 | 791 | // Get posted value. |
792 | - if ( strstr( $option['id'], '[' ) ) { |
|
793 | - parse_str( $option['id'], $option_name_array ); |
|
794 | - $field_option_name = current( array_keys( $option_name_array ) ); |
|
795 | - $setting_name = key( $option_name_array[ $field_option_name ] ); |
|
796 | - $raw_value = isset( $_POST[ $field_option_name ][ $setting_name ] ) ? wp_unslash( $_POST[ $field_option_name ][ $setting_name ] ) : null; |
|
792 | + if (strstr($option['id'], '[')) { |
|
793 | + parse_str($option['id'], $option_name_array); |
|
794 | + $field_option_name = current(array_keys($option_name_array)); |
|
795 | + $setting_name = key($option_name_array[$field_option_name]); |
|
796 | + $raw_value = isset($_POST[$field_option_name][$setting_name]) ? wp_unslash($_POST[$field_option_name][$setting_name]) : null; |
|
797 | 797 | } else { |
798 | 798 | $field_option_name = $option['id']; |
799 | 799 | $setting_name = ''; |
800 | - $raw_value = isset( $_POST[ $option['id'] ] ) ? wp_unslash( $_POST[ $option['id'] ] ) : null; |
|
800 | + $raw_value = isset($_POST[$option['id']]) ? wp_unslash($_POST[$option['id']]) : null; |
|
801 | 801 | } |
802 | 802 | |
803 | 803 | // Format the value based on option type. |
804 | - switch ( $option['type'] ) { |
|
804 | + switch ($option['type']) { |
|
805 | 805 | case 'checkbox' : |
806 | - $value = is_null( $raw_value ) ? '' : 'on'; |
|
806 | + $value = is_null($raw_value) ? '' : 'on'; |
|
807 | 807 | break; |
808 | 808 | case 'wysiwyg' : |
809 | 809 | case 'textarea' : |
810 | - $value = wp_kses_post( trim( $raw_value ) ); |
|
810 | + $value = wp_kses_post(trim($raw_value)); |
|
811 | 811 | break; |
812 | 812 | case 'multiselect' : |
813 | - $value = array_filter( array_map( 'give_clean', (array) $raw_value ) ); |
|
813 | + $value = array_filter(array_map('give_clean', (array) $raw_value)); |
|
814 | 814 | break; |
815 | 815 | default : |
816 | - $value = give_clean( $raw_value ); |
|
816 | + $value = give_clean($raw_value); |
|
817 | 817 | break; |
818 | 818 | } |
819 | 819 | |
@@ -822,37 +822,37 @@ discard block |
||
822 | 822 | * |
823 | 823 | * @since 1.8 |
824 | 824 | */ |
825 | - $value = apply_filters( 'give_admin_settings_sanitize_option', $value, $option, $raw_value ); |
|
825 | + $value = apply_filters('give_admin_settings_sanitize_option', $value, $option, $raw_value); |
|
826 | 826 | |
827 | 827 | /** |
828 | 828 | * Sanitize the value of an option by option name. |
829 | 829 | * |
830 | 830 | * @since 1.8 |
831 | 831 | */ |
832 | - $value = apply_filters( "give_admin_settings_sanitize_option_{$field_option_name}", $value, $option, $raw_value ); |
|
832 | + $value = apply_filters("give_admin_settings_sanitize_option_{$field_option_name}", $value, $option, $raw_value); |
|
833 | 833 | |
834 | - if ( is_null( $value ) ) { |
|
834 | + if (is_null($value)) { |
|
835 | 835 | continue; |
836 | 836 | } |
837 | 837 | |
838 | 838 | // Check if option is an array and handle that differently to single values. |
839 | - if ( $field_option_name && $setting_name ) { |
|
840 | - if ( ! isset( $update_options[ $field_option_name ] ) ) { |
|
841 | - $update_options[ $field_option_name ] = get_option( $field_option_name, array() ); |
|
839 | + if ($field_option_name && $setting_name) { |
|
840 | + if ( ! isset($update_options[$field_option_name])) { |
|
841 | + $update_options[$field_option_name] = get_option($field_option_name, array()); |
|
842 | 842 | } |
843 | - if ( ! is_array( $update_options[ $field_option_name ] ) ) { |
|
844 | - $update_options[ $field_option_name ] = array(); |
|
843 | + if ( ! is_array($update_options[$field_option_name])) { |
|
844 | + $update_options[$field_option_name] = array(); |
|
845 | 845 | } |
846 | - $update_options[ $field_option_name ][ $setting_name ] = $value; |
|
846 | + $update_options[$field_option_name][$setting_name] = $value; |
|
847 | 847 | } else { |
848 | - $update_options[ $field_option_name ] = $value; |
|
848 | + $update_options[$field_option_name] = $value; |
|
849 | 849 | } |
850 | 850 | } |
851 | 851 | |
852 | 852 | // Save all options in our array or there own option name i.e. option id. |
853 | - if ( empty( $option_name ) ) { |
|
854 | - foreach ( $update_options as $name => $value ) { |
|
855 | - update_option( $name, $value ); |
|
853 | + if (empty($option_name)) { |
|
854 | + foreach ($update_options as $name => $value) { |
|
855 | + update_option($name, $value); |
|
856 | 856 | |
857 | 857 | /** |
858 | 858 | * Trigger action. |
@@ -861,13 +861,13 @@ discard block |
||
861 | 861 | * |
862 | 862 | * @since 1.8 |
863 | 863 | */ |
864 | - do_action( "give_save_option_{$name}", $value, $name ); |
|
864 | + do_action("give_save_option_{$name}", $value, $name); |
|
865 | 865 | } |
866 | 866 | } else { |
867 | - $old_options = ( $old_options = get_option( $option_name ) ) ? $old_options : array(); |
|
868 | - $update_options = array_merge( $old_options, $update_options ); |
|
867 | + $old_options = ($old_options = get_option($option_name)) ? $old_options : array(); |
|
868 | + $update_options = array_merge($old_options, $update_options); |
|
869 | 869 | |
870 | - update_option( $option_name, $update_options ); |
|
870 | + update_option($option_name, $update_options); |
|
871 | 871 | |
872 | 872 | /** |
873 | 873 | * Trigger action. |
@@ -876,7 +876,7 @@ discard block |
||
876 | 876 | * |
877 | 877 | * @since 1.8 |
878 | 878 | */ |
879 | - do_action( "give_save_settings_{$option_name}", $update_options, $option_name ); |
|
879 | + do_action("give_save_settings_{$option_name}", $update_options, $option_name); |
|
880 | 880 | } |
881 | 881 | |
882 | 882 | return true; |
@@ -85,7 +85,7 @@ |
||
85 | 85 | * |
86 | 86 | * @since 1.8 |
87 | 87 | * |
88 | - * @param $setting_tab |
|
88 | + * @param string $setting_tab |
|
89 | 89 | * |
90 | 90 | * @return string |
91 | 91 | */ |
@@ -9,7 +9,7 @@ discard block |
||
9 | 9 | * @since 1.8 |
10 | 10 | */ |
11 | 11 | |
12 | -if ( ! class_exists( 'Give_CMB2_Settings_Loader' ) ) : |
|
12 | +if ( ! class_exists('Give_CMB2_Settings_Loader')) : |
|
13 | 13 | |
14 | 14 | /** |
15 | 15 | * This class loads the cmb2 settings. |
@@ -52,30 +52,30 @@ discard block |
||
52 | 52 | |
53 | 53 | // Get current tab. |
54 | 54 | $this->current_tab = give_get_current_setting_tab(); |
55 | - $this->current_section = empty( $_REQUEST['section'] ) ? ( current( array_keys( $this->get_sections() ) ) ) : sanitize_title( $_REQUEST['section'] ); |
|
55 | + $this->current_section = empty($_REQUEST['section']) ? (current(array_keys($this->get_sections()))) : sanitize_title($_REQUEST['section']); |
|
56 | 56 | |
57 | 57 | // Tab ID. |
58 | 58 | $this->id = $this->current_tab; |
59 | 59 | |
60 | 60 | // Add addon tabs. |
61 | - add_filter( 'give-settings_tabs_array', array( $this, 'add_addon_settings_page' ), 999999 ); |
|
61 | + add_filter('give-settings_tabs_array', array($this, 'add_addon_settings_page'), 999999); |
|
62 | 62 | |
63 | 63 | // Add save hook to addons. |
64 | - add_action( 'give-settings_get_settings_pages', array( $this, 'setup_addon_save_hook' ), 999999 ); |
|
64 | + add_action('give-settings_get_settings_pages', array($this, 'setup_addon_save_hook'), 999999); |
|
65 | 65 | |
66 | 66 | // Add backward compatibility filters plugin settings. |
67 | - $setting_tabs = array( 'general', 'gateways', 'display', 'emails', 'addons', 'licenses' ); |
|
67 | + $setting_tabs = array('general', 'gateways', 'display', 'emails', 'addons', 'licenses'); |
|
68 | 68 | |
69 | 69 | // Filter Payment Gateways settings. |
70 | - if ( in_array( $this->current_tab, $setting_tabs ) ) { |
|
71 | - add_filter( "give_get_settings_{$this->current_tab}", array( |
|
70 | + if (in_array($this->current_tab, $setting_tabs)) { |
|
71 | + add_filter("give_get_settings_{$this->current_tab}", array( |
|
72 | 72 | $this, |
73 | 73 | 'get_filtered_addon_settings', |
74 | - ), 999999, 1 ); |
|
75 | - add_filter( "give_get_sections_{$this->current_tab}", array( |
|
74 | + ), 999999, 1); |
|
75 | + add_filter("give_get_sections_{$this->current_tab}", array( |
|
76 | 76 | $this, |
77 | 77 | 'get_filtered_addon_sections', |
78 | - ), 999999, 1 ); |
|
78 | + ), 999999, 1); |
|
79 | 79 | } |
80 | 80 | } |
81 | 81 | |
@@ -88,12 +88,12 @@ discard block |
||
88 | 88 | * |
89 | 89 | * @return string |
90 | 90 | */ |
91 | - function set_default_setting_tab( $setting_tab ) { |
|
91 | + function set_default_setting_tab($setting_tab) { |
|
92 | 92 | $default_tab = ''; |
93 | 93 | |
94 | 94 | // Set default tab to first setting tab. |
95 | - if ( $sections = array_keys( $this->get_sections() ) ) { |
|
96 | - $default_tab = current( $sections ); |
|
95 | + if ($sections = array_keys($this->get_sections())) { |
|
96 | + $default_tab = current($sections); |
|
97 | 97 | } |
98 | 98 | |
99 | 99 | return $default_tab; |
@@ -108,29 +108,29 @@ discard block |
||
108 | 108 | * |
109 | 109 | * @return mixed |
110 | 110 | */ |
111 | - function add_addon_settings_page( $pages ) { |
|
111 | + function add_addon_settings_page($pages) { |
|
112 | 112 | // Previous setting page. |
113 | 113 | $previous_pages = $this->prev_settings->give_get_settings_tabs(); |
114 | 114 | |
115 | 115 | // API and System Info setting tab merge to Tools setting tab, so remove them from tabs. |
116 | - unset( $previous_pages['api'] ); |
|
117 | - unset( $previous_pages['system_info'] ); |
|
116 | + unset($previous_pages['api']); |
|
117 | + unset($previous_pages['system_info']); |
|
118 | 118 | |
119 | 119 | // Tab is not register. |
120 | - $pages_diff = array_keys( array_diff( $previous_pages, $pages ) ); |
|
120 | + $pages_diff = array_keys(array_diff($previous_pages, $pages)); |
|
121 | 121 | |
122 | 122 | // Merge old settings with new settings. |
123 | - $pages = array_merge( $pages, $previous_pages ); |
|
123 | + $pages = array_merge($pages, $previous_pages); |
|
124 | 124 | |
125 | - if ( in_array( $this->current_tab, $pages_diff ) ) { |
|
125 | + if (in_array($this->current_tab, $pages_diff)) { |
|
126 | 126 | // Filter & actions. |
127 | - add_filter( "give_default_setting_tab_section_{$this->current_tab}", array( |
|
127 | + add_filter("give_default_setting_tab_section_{$this->current_tab}", array( |
|
128 | 128 | $this, |
129 | 129 | 'set_default_setting_tab', |
130 | - ), 10 ); |
|
131 | - add_action( "give-settings_sections_{$this->current_tab}_page", array( $this, 'output_sections' ) ); |
|
132 | - add_action( "give-settings_settings_{$this->current_tab}_page", array( $this, 'output' ), 10 ); |
|
133 | - add_action( "give-settings_save_{$this->current_tab}", array( $this, 'save' ) ); |
|
130 | + ), 10); |
|
131 | + add_action("give-settings_sections_{$this->current_tab}_page", array($this, 'output_sections')); |
|
132 | + add_action("give-settings_settings_{$this->current_tab}_page", array($this, 'output'), 10); |
|
133 | + add_action("give-settings_save_{$this->current_tab}", array($this, 'save')); |
|
134 | 134 | } |
135 | 135 | |
136 | 136 | return $pages; |
@@ -146,29 +146,29 @@ discard block |
||
146 | 146 | * |
147 | 147 | * @return mixed |
148 | 148 | */ |
149 | - function setup_addon_save_hook( $pages ) { |
|
149 | + function setup_addon_save_hook($pages) { |
|
150 | 150 | $page_ids = array(); |
151 | 151 | |
152 | - foreach ( $pages as $page ) { |
|
153 | - $page_ids = $page->add_settings_page( $page_ids ); |
|
152 | + foreach ($pages as $page) { |
|
153 | + $page_ids = $page->add_settings_page($page_ids); |
|
154 | 154 | } |
155 | 155 | |
156 | 156 | // Previous setting page. |
157 | 157 | $previous_pages = $this->prev_settings->give_get_settings_tabs(); |
158 | 158 | |
159 | 159 | // API and System Info setting tab merge to Tools setting tab, so remove them from tabs. |
160 | - unset( $previous_pages['api'] ); |
|
161 | - unset( $previous_pages['system_info'] ); |
|
160 | + unset($previous_pages['api']); |
|
161 | + unset($previous_pages['system_info']); |
|
162 | 162 | |
163 | 163 | // Tab is not register. |
164 | - $pages_diff = array_keys( array_diff( $previous_pages, $page_ids ) ); |
|
164 | + $pages_diff = array_keys(array_diff($previous_pages, $page_ids)); |
|
165 | 165 | |
166 | 166 | // Merge old settings with new settings. |
167 | - $pages = array_merge( $page_ids, $previous_pages ); |
|
167 | + $pages = array_merge($page_ids, $previous_pages); |
|
168 | 168 | |
169 | - if ( in_array( $this->current_tab, $pages_diff ) ) { |
|
169 | + if (in_array($this->current_tab, $pages_diff)) { |
|
170 | 170 | // Filter & actions. |
171 | - add_action( "give-settings_save_{$this->current_tab}", array( $this, 'save' ) ); |
|
171 | + add_action("give-settings_save_{$this->current_tab}", array($this, 'save')); |
|
172 | 172 | } |
173 | 173 | |
174 | 174 | return $pages; |
@@ -183,16 +183,16 @@ discard block |
||
183 | 183 | * |
184 | 184 | * @return string |
185 | 185 | */ |
186 | - function get_section_name( $field_name ) { |
|
186 | + function get_section_name($field_name) { |
|
187 | 187 | // Bailout. |
188 | - if ( empty( $field_name ) ) { |
|
188 | + if (empty($field_name)) { |
|
189 | 189 | return $field_name; |
190 | 190 | } |
191 | 191 | |
192 | - $section_name = explode( ' ', $field_name ); |
|
192 | + $section_name = explode(' ', $field_name); |
|
193 | 193 | |
194 | 194 | // Output. |
195 | - return strip_tags( implode( ' ', $section_name ) ); |
|
195 | + return strip_tags(implode(' ', $section_name)); |
|
196 | 196 | } |
197 | 197 | |
198 | 198 | |
@@ -205,39 +205,39 @@ discard block |
||
205 | 205 | * |
206 | 206 | * @return mixed |
207 | 207 | */ |
208 | - function get_filtered_addon_sections( $sections = array() ) { |
|
208 | + function get_filtered_addon_sections($sections = array()) { |
|
209 | 209 | // New sections. |
210 | 210 | $new_sections = array(); |
211 | - $sections_ID = array_keys( $sections ); |
|
211 | + $sections_ID = array_keys($sections); |
|
212 | 212 | |
213 | - if ( ( $setting_fields = $this->prev_settings->give_settings( $this->current_tab ) ) && ! empty( $setting_fields['fields'] ) ) { |
|
213 | + if (($setting_fields = $this->prev_settings->give_settings($this->current_tab)) && ! empty($setting_fields['fields'])) { |
|
214 | 214 | |
215 | - foreach ( $setting_fields['fields'] as $field ) { |
|
215 | + foreach ($setting_fields['fields'] as $field) { |
|
216 | 216 | // Section name. |
217 | - $field['name'] = isset( $field['name'] ) ? $field['name'] : ''; |
|
218 | - $section_name = $this->get_section_name( $field['name'] ); |
|
217 | + $field['name'] = isset($field['name']) ? $field['name'] : ''; |
|
218 | + $section_name = $this->get_section_name($field['name']); |
|
219 | 219 | |
220 | 220 | // Check if section name exit and section title array is not empty. |
221 | - if ( ! empty( $sections ) && ! empty( $field['name'] ) ) { |
|
221 | + if ( ! empty($sections) && ! empty($field['name'])) { |
|
222 | 222 | |
223 | 223 | // Bailout: Do not load section if it is already exist. |
224 | 224 | if ( |
225 | - in_array( sanitize_title( $field['name'] ), $sections_ID ) // Check section id. |
|
226 | - || in_array( $section_name, $sections ) // Check section name. |
|
225 | + in_array(sanitize_title($field['name']), $sections_ID) // Check section id. |
|
226 | + || in_array($section_name, $sections) // Check section name. |
|
227 | 227 | ) { |
228 | 228 | continue; |
229 | 229 | } |
230 | 230 | } |
231 | 231 | |
232 | 232 | // Collect new sections from addons. |
233 | - if ( 'give_title' == $field['type'] ) { |
|
234 | - $new_sections[ sanitize_title( $field['name'] ) ] = $section_name; |
|
233 | + if ('give_title' == $field['type']) { |
|
234 | + $new_sections[sanitize_title($field['name'])] = $section_name; |
|
235 | 235 | } |
236 | 236 | } |
237 | 237 | } |
238 | 238 | |
239 | 239 | // Add new section. |
240 | - $sections = array_merge( $sections, $new_sections ); |
|
240 | + $sections = array_merge($sections, $new_sections); |
|
241 | 241 | |
242 | 242 | // Output. |
243 | 243 | return $sections; |
@@ -254,19 +254,19 @@ discard block |
||
254 | 254 | * |
255 | 255 | * @return array |
256 | 256 | */ |
257 | - function get_filtered_addon_settings( $settings, $setting_fields = array() ) { |
|
257 | + function get_filtered_addon_settings($settings, $setting_fields = array()) { |
|
258 | 258 | global $wp_filter; |
259 | 259 | |
260 | 260 | $new_setting_fields = array(); |
261 | 261 | |
262 | - if ( ! empty( $settings ) ) { |
|
262 | + if ( ! empty($settings)) { |
|
263 | 263 | // Bailout: If setting array contain first element of type title then it means it is already created with new setting api (skip this section ). |
264 | - if ( isset( $settings[0]['type'] ) && 'title' == $settings[0]['type'] ) { |
|
265 | - foreach ( $settings as $setting ) { |
|
264 | + if (isset($settings[0]['type']) && 'title' == $settings[0]['type']) { |
|
265 | + foreach ($settings as $setting) { |
|
266 | 266 | $new_setting_fields[] = $setting; |
267 | 267 | |
268 | 268 | // We need setting only till first section end. |
269 | - if ( 'sectionend' === $setting['type'] ) { |
|
269 | + if ('sectionend' === $setting['type']) { |
|
270 | 270 | break; |
271 | 271 | } |
272 | 272 | } |
@@ -278,24 +278,24 @@ discard block |
||
278 | 278 | $prev_title_field_id = ''; |
279 | 279 | |
280 | 280 | // Create new setting fields. |
281 | - foreach ( $settings as $index => $field ) { |
|
281 | + foreach ($settings as $index => $field) { |
|
282 | 282 | |
283 | 283 | // Bailout: Must need field type to process. |
284 | - if ( ! isset( $field['type'] ) ) { |
|
284 | + if ( ! isset($field['type'])) { |
|
285 | 285 | continue; |
286 | 286 | } |
287 | 287 | |
288 | 288 | // Set wrapper class if any. |
289 | - if ( ! empty( $field['row_classes'] ) ) { |
|
289 | + if ( ! empty($field['row_classes'])) { |
|
290 | 290 | $field['wrapper_class'] = $field['row_classes']; |
291 | - unset( $field['row_classes'] ); |
|
291 | + unset($field['row_classes']); |
|
292 | 292 | } |
293 | 293 | |
294 | - $field['name'] = ! isset( $field['name'] ) ? '' : $field['name']; |
|
295 | - $field['desc'] = ! isset( $field['desc'] ) ? '' : $field['desc']; |
|
294 | + $field['name'] = ! isset($field['name']) ? '' : $field['name']; |
|
295 | + $field['desc'] = ! isset($field['desc']) ? '' : $field['desc']; |
|
296 | 296 | |
297 | 297 | // Modify cmb2 setting fields. |
298 | - switch ( $field['type'] ) { |
|
298 | + switch ($field['type']) { |
|
299 | 299 | case 'text' : |
300 | 300 | case 'file' : |
301 | 301 | $field['css'] = 'width:25em;'; |
@@ -319,18 +319,18 @@ discard block |
||
319 | 319 | $field['type'] = 'title'; |
320 | 320 | |
321 | 321 | // Since we are showing sections, so there now ned to show horizontal rules. |
322 | - if ( '<hr>' === $field['desc'] ) { |
|
322 | + if ('<hr>' === $field['desc']) { |
|
323 | 323 | $field['desc'] = ''; |
324 | 324 | } |
325 | 325 | |
326 | 326 | break; |
327 | 327 | } |
328 | 328 | |
329 | - if ( 'title' === $field['type'] ) { |
|
329 | + if ('title' === $field['type']) { |
|
330 | 330 | |
331 | 331 | // If we do not have first element as title then these field will be skip from frontend |
332 | 332 | // because there are not belong to any section, so put all abandon fields under first section. |
333 | - if ( $index && empty( $prev_title_field_id ) ) { |
|
333 | + if ($index && empty($prev_title_field_id)) { |
|
334 | 334 | array_unshift( |
335 | 335 | $new_setting_fields, |
336 | 336 | array( |
@@ -344,7 +344,7 @@ discard block |
||
344 | 344 | $prev_title_field_id = $field['id']; |
345 | 345 | |
346 | 346 | continue; |
347 | - } elseif ( $index ) { |
|
347 | + } elseif ($index) { |
|
348 | 348 | // Section end. |
349 | 349 | $new_setting_fields[] = array( |
350 | 350 | 'type' => 'sectionend', |
@@ -376,52 +376,52 @@ discard block |
||
376 | 376 | |
377 | 377 | // Check if setting page has title section or not. |
378 | 378 | // If setting page does not have title section then add title section to it and fix section end array id. |
379 | - if ( 'title' !== $new_setting_fields[0]['type'] ) { |
|
379 | + if ('title' !== $new_setting_fields[0]['type']) { |
|
380 | 380 | array_unshift( |
381 | 381 | $new_setting_fields, |
382 | 382 | array( |
383 | - 'title' => ( isset( $settings['give_title'] ) ? $settings['give_title'] : '' ), |
|
383 | + 'title' => (isset($settings['give_title']) ? $settings['give_title'] : ''), |
|
384 | 384 | 'type' => 'title', |
385 | - 'desc' => ! empty( $setting_fields['desc'] ) ? $setting_fields['desc'] : '', |
|
386 | - 'id' => ( isset( $settings['id'] ) ? $settings['id'] : '' ), |
|
385 | + 'desc' => ! empty($setting_fields['desc']) ? $setting_fields['desc'] : '', |
|
386 | + 'id' => (isset($settings['id']) ? $settings['id'] : ''), |
|
387 | 387 | ) |
388 | 388 | ); |
389 | 389 | |
390 | 390 | // Update id in section end array if does not contain. |
391 | - if ( empty( $new_setting_fields[ count( $new_setting_fields ) - 1 ]['id'] ) ) { |
|
392 | - $new_setting_fields[ count( $new_setting_fields ) - 1 ]['id'] = ( isset( $settings['id'] ) ? $settings['id'] : '' ); |
|
391 | + if (empty($new_setting_fields[count($new_setting_fields) - 1]['id'])) { |
|
392 | + $new_setting_fields[count($new_setting_fields) - 1]['id'] = (isset($settings['id']) ? $settings['id'] : ''); |
|
393 | 393 | } |
394 | 394 | } |
395 | 395 | |
396 | 396 | // Return only section related settings. |
397 | - if ( $sections = $this->get_filtered_addon_sections() ) { |
|
398 | - $new_setting_fields = $this->get_section_settings( $new_setting_fields ); |
|
397 | + if ($sections = $this->get_filtered_addon_sections()) { |
|
398 | + $new_setting_fields = $this->get_section_settings($new_setting_fields); |
|
399 | 399 | } |
400 | 400 | |
401 | 401 | // Third party plugin backward compatibility. |
402 | - $wp_filter_keys = array_keys( $wp_filter ); |
|
403 | - foreach ( $new_setting_fields as $index => $field ) { |
|
404 | - if ( ! isset( $field['type'] ) || in_array( $field['type'], array( 'title', 'sectionend' ) ) ) { |
|
402 | + $wp_filter_keys = array_keys($wp_filter); |
|
403 | + foreach ($new_setting_fields as $index => $field) { |
|
404 | + if ( ! isset($field['type']) || in_array($field['type'], array('title', 'sectionend'))) { |
|
405 | 405 | continue; |
406 | 406 | } |
407 | 407 | |
408 | 408 | $cmb2_filter_name = "cmb2_render_{$field['type']}"; |
409 | 409 | |
410 | - if ( in_array( $cmb2_filter_name, $wp_filter_keys ) ) { |
|
410 | + if (in_array($cmb2_filter_name, $wp_filter_keys)) { |
|
411 | 411 | |
412 | - if ( 0 >= version_compare( 4.7, get_bloginfo( 'version' ) ) && ! empty( $wp_filter[ $cmb2_filter_name ]->callbacks ) ) { |
|
413 | - $cmb2_filter_arr = current( $wp_filter[ $cmb2_filter_name ]->callbacks ); |
|
412 | + if (0 >= version_compare(4.7, get_bloginfo('version')) && ! empty($wp_filter[$cmb2_filter_name]->callbacks)) { |
|
413 | + $cmb2_filter_arr = current($wp_filter[$cmb2_filter_name]->callbacks); |
|
414 | 414 | } else { |
415 | - $cmb2_filter_arr = current( $wp_filter[ $cmb2_filter_name ] ); |
|
415 | + $cmb2_filter_arr = current($wp_filter[$cmb2_filter_name]); |
|
416 | 416 | } |
417 | 417 | |
418 | - if ( ! empty( $cmb2_filter_arr ) ) { |
|
418 | + if ( ! empty($cmb2_filter_arr)) { |
|
419 | 419 | // Note: function can be called either globally or with class object, it depends on how developer invoke it. |
420 | - $new_setting_fields[ $index ]['func'] = current( $cmb2_filter_arr ); |
|
421 | - add_action( "give_admin_field_{$field['type']}", array( |
|
420 | + $new_setting_fields[$index]['func'] = current($cmb2_filter_arr); |
|
421 | + add_action("give_admin_field_{$field['type']}", array( |
|
422 | 422 | $this, |
423 | 423 | 'addon_setting_field', |
424 | - ), 10, 2 ); |
|
424 | + ), 10, 2); |
|
425 | 425 | } |
426 | 426 | } |
427 | 427 | } |
@@ -442,31 +442,31 @@ discard block |
||
442 | 442 | * |
443 | 443 | * @return array |
444 | 444 | */ |
445 | - function get_section_settings( $tab_settings ) { |
|
445 | + function get_section_settings($tab_settings) { |
|
446 | 446 | $current_section = give_get_current_setting_section(); |
447 | 447 | |
448 | 448 | // Note: If we are opening default tabe for addon setting then it is possible that we will get empty string as current section |
449 | 449 | // because default section filter added after save hook fire, so we will always get problem to save first section [default] or if there are only on section |
450 | 450 | // This is hack to fix this. |
451 | - if ( empty( $current_section ) ) { |
|
452 | - $current_section = $this->set_default_setting_tab( $current_section ); |
|
451 | + if (empty($current_section)) { |
|
452 | + $current_section = $this->set_default_setting_tab($current_section); |
|
453 | 453 | } |
454 | 454 | |
455 | 455 | $section_start = false; |
456 | 456 | $section_end = false; |
457 | 457 | $section_only_setting_fields = array(); |
458 | 458 | |
459 | - foreach ( $tab_settings as $field ) { |
|
460 | - if ( 'title' == $field['type'] && $current_section == sanitize_title( $field['title'] ) ) { |
|
459 | + foreach ($tab_settings as $field) { |
|
460 | + if ('title' == $field['type'] && $current_section == sanitize_title($field['title'])) { |
|
461 | 461 | $section_start = true; |
462 | 462 | } |
463 | 463 | |
464 | - if ( ! $section_start || $section_end ) { |
|
464 | + if ( ! $section_start || $section_end) { |
|
465 | 465 | continue; |
466 | 466 | } |
467 | 467 | |
468 | - if ( $section_start && ! $section_end ) { |
|
469 | - if ( 'sectionend' == $field['type'] ) { |
|
468 | + if ($section_start && ! $section_end) { |
|
469 | + if ('sectionend' == $field['type']) { |
|
470 | 470 | $section_end = true; |
471 | 471 | } |
472 | 472 | $section_only_setting_fields[] = $field; |
@@ -476,7 +476,7 @@ discard block |
||
476 | 476 | // Remove title from setting, pevent it from render in setting tab. |
477 | 477 | $section_only_setting_fields[0]['title'] = ''; |
478 | 478 | |
479 | - return apply_filters( "give_get_settings_{$this->current_tab}_{$current_section}", $section_only_setting_fields, $tab_settings ); |
|
479 | + return apply_filters("give_get_settings_{$this->current_tab}_{$current_section}", $section_only_setting_fields, $tab_settings); |
|
480 | 480 | } |
481 | 481 | |
482 | 482 | |
@@ -490,17 +490,17 @@ discard block |
||
490 | 490 | * |
491 | 491 | * @return void |
492 | 492 | */ |
493 | - function addon_setting_field( $field, $saved_value ) { |
|
493 | + function addon_setting_field($field, $saved_value) { |
|
494 | 494 | // Create object for cmb2 function callback backward compatibility. |
495 | 495 | // Note: Do not call any cmb2 function on these objects |
496 | - $field_obj = (object) array( 'args' => $field ); |
|
497 | - $field_type_obj = (object) array( 'field' => $field_obj ); |
|
496 | + $field_obj = (object) array('args' => $field); |
|
497 | + $field_type_obj = (object) array('field' => $field_obj); |
|
498 | 498 | |
499 | - switch ( $this->current_tab ) : |
|
499 | + switch ($this->current_tab) : |
|
500 | 500 | case 'licenses': |
501 | 501 | ?> |
502 | 502 | <div class="give-settings-wrap give-settings-wrap-<?php echo $this->current_tab; ?>"> |
503 | - <?php $field['func']['function']( $field_obj, $saved_value, '', '', $field_type_obj ); ?> |
|
503 | + <?php $field['func']['function']($field_obj, $saved_value, '', '', $field_type_obj); ?> |
|
504 | 504 | </div> |
505 | 505 | <?php break; |
506 | 506 | |
@@ -508,19 +508,19 @@ discard block |
||
508 | 508 | $colspan = 'colspan="2"'; |
509 | 509 | ?> |
510 | 510 | <tr valign="top"> |
511 | - <?php if ( ! empty( $field['name'] ) && ! in_array( $field['name'], array( ' ' ) ) ) : ?> |
|
511 | + <?php if ( ! empty($field['name']) && ! in_array($field['name'], array(' '))) : ?> |
|
512 | 512 | <th scope="row" class="titledesc"> |
513 | 513 | <label |
514 | - for="<?php echo esc_attr( $field['name'] ); ?>"><?php echo $field['title']; ?></label> |
|
514 | + for="<?php echo esc_attr($field['name']); ?>"><?php echo $field['title']; ?></label> |
|
515 | 515 | </th> |
516 | 516 | <?php $colspan = ''; ?> |
517 | 517 | <?php endif; ?> |
518 | 518 | <td class="give-forminp" <?php echo $colspan; ?>> |
519 | 519 | <?php |
520 | - if ( is_array( $field['func']['function'] ) ) { |
|
521 | - $field['func']['function'][0]->$field['func']['function'][1]( $field_obj, $saved_value, '', '', $field_type_obj ); |
|
520 | + if (is_array($field['func']['function'])) { |
|
521 | + $field['func']['function'][0]->$field['func']['function'][1]($field_obj, $saved_value, '', '', $field_type_obj); |
|
522 | 522 | } else { |
523 | - $field['func']['function']( $field_obj, $saved_value, '', '', $field_type_obj ); |
|
523 | + $field['func']['function']($field_obj, $saved_value, '', '', $field_type_obj); |
|
524 | 524 | } |
525 | 525 | ?> |
526 | 526 | </td> |
@@ -538,10 +538,10 @@ discard block |
||
538 | 538 | public function get_sections() { |
539 | 539 | $sections = array(); |
540 | 540 | |
541 | - if ( ( $setting_fields = $this->prev_settings->give_settings( $this->current_tab ) ) && ! empty( $setting_fields['fields'] ) ) { |
|
542 | - foreach ( $setting_fields['fields'] as $field ) { |
|
543 | - if ( 'give_title' == $field['type'] ) { |
|
544 | - $sections[ sanitize_title( $field['name'] ) ] = $this->get_section_name( $field['name'] ); |
|
541 | + if (($setting_fields = $this->prev_settings->give_settings($this->current_tab)) && ! empty($setting_fields['fields'])) { |
|
542 | + foreach ($setting_fields['fields'] as $field) { |
|
543 | + if ('give_title' == $field['type']) { |
|
544 | + $sections[sanitize_title($field['name'])] = $this->get_section_name($field['name']); |
|
545 | 545 | } |
546 | 546 | } |
547 | 547 | } |
@@ -561,16 +561,16 @@ discard block |
||
561 | 561 | |
562 | 562 | $new_setting_fields = array(); |
563 | 563 | |
564 | - if ( $setting_fields = $this->prev_settings->give_settings( $this->current_tab ) ) { |
|
565 | - if ( isset( $setting_fields['fields'] ) ) { |
|
564 | + if ($setting_fields = $this->prev_settings->give_settings($this->current_tab)) { |
|
565 | + if (isset($setting_fields['fields'])) { |
|
566 | 566 | |
567 | 567 | $tab_data = array( |
568 | 568 | 'id' => $setting_fields['id'], |
569 | 569 | 'give_title' => $setting_fields['give_title'], |
570 | - 'desc' => ( isset( $setting_fields['desc'] ) ? $setting_fields['desc'] : '' ), |
|
570 | + 'desc' => (isset($setting_fields['desc']) ? $setting_fields['desc'] : ''), |
|
571 | 571 | ); |
572 | 572 | |
573 | - $new_setting_fields = $this->get_filtered_addon_settings( $setting_fields['fields'], $tab_data ); |
|
573 | + $new_setting_fields = $this->get_filtered_addon_settings($setting_fields['fields'], $tab_data); |
|
574 | 574 | } |
575 | 575 | } |
576 | 576 | |
@@ -587,24 +587,24 @@ discard block |
||
587 | 587 | $sections = $this->get_sections(); |
588 | 588 | |
589 | 589 | // Show section settings only if setting section exist. |
590 | - if ( $this->current_section && ! in_array( $this->current_section, array_keys( $sections ) ) ) { |
|
591 | - echo '<div class="error"><p>' . __( 'Oops, this settings page does not exist.', 'give' ) . '</p></div>'; |
|
590 | + if ($this->current_section && ! in_array($this->current_section, array_keys($sections))) { |
|
591 | + echo '<div class="error"><p>'.__('Oops, this settings page does not exist.', 'give').'</p></div>'; |
|
592 | 592 | $GLOBALS['give_hide_save_button'] = true; |
593 | 593 | |
594 | 594 | return; |
595 | 595 | } |
596 | 596 | |
597 | 597 | // Bailout. |
598 | - if ( empty( $sections ) ) { |
|
598 | + if (empty($sections)) { |
|
599 | 599 | return; |
600 | 600 | } |
601 | 601 | |
602 | 602 | echo '<ul class="subsubsub">'; |
603 | 603 | |
604 | - $array_keys = array_keys( $sections ); |
|
604 | + $array_keys = array_keys($sections); |
|
605 | 605 | |
606 | - foreach ( $sections as $id => $label ) { |
|
607 | - echo '<li><a href="' . admin_url( 'edit.php?post_type=give_forms&page=give-settings&tab=' . $this->current_tab . '§ion=' . sanitize_title( $id ) ) . '" class="' . ( $this->current_section == $id ? 'current' : '' ) . '">' . strip_tags( $label ) . '</a> ' . ( end( $array_keys ) == $id ? '' : '|' ) . ' </li>'; |
|
606 | + foreach ($sections as $id => $label) { |
|
607 | + echo '<li><a href="'.admin_url('edit.php?post_type=give_forms&page=give-settings&tab='.$this->current_tab.'§ion='.sanitize_title($id)).'" class="'.($this->current_section == $id ? 'current' : '').'">'.strip_tags($label).'</a> '.(end($array_keys) == $id ? '' : '|').' </li>'; |
|
608 | 608 | } |
609 | 609 | |
610 | 610 | echo '</ul><br class="clear" /><hr>'; |
@@ -619,7 +619,7 @@ discard block |
||
619 | 619 | public function output() { |
620 | 620 | $settings = $this->get_settings(); |
621 | 621 | |
622 | - Give_Admin_Settings::output_fields( $settings, 'give_settings' ); |
|
622 | + Give_Admin_Settings::output_fields($settings, 'give_settings'); |
|
623 | 623 | } |
624 | 624 | |
625 | 625 | /** |
@@ -631,7 +631,7 @@ discard block |
||
631 | 631 | public function save() { |
632 | 632 | $settings = $this->get_settings(); |
633 | 633 | |
634 | - Give_Admin_Settings::save_fields( $settings, 'give_settings' ); |
|
634 | + Give_Admin_Settings::save_fields($settings, 'give_settings'); |
|
635 | 635 | } |
636 | 636 | } |
637 | 637 | endif; |