@@ -514,12 +514,12 @@ discard block |
||
514 | 514 | |
515 | 515 | /** |
516 | 516 | * Decrease/Increase a customer's lifetime value |
517 | - * |
|
518 | - * This function will update donation stat on basis of current amount and new amount donation difference. |
|
519 | - * Difference value can positive or negative. Negative value will decrease user donation stat while positive value increase donation stat. |
|
520 | - * |
|
521 | - * |
|
522 | - * @access public |
|
517 | + * |
|
518 | + * This function will update donation stat on basis of current amount and new amount donation difference. |
|
519 | + * Difference value can positive or negative. Negative value will decrease user donation stat while positive value increase donation stat. |
|
520 | + * |
|
521 | + * |
|
522 | + * @access public |
|
523 | 523 | * @since 1.0 |
524 | 524 | * |
525 | 525 | * @param float $curr_amount Current Donation amount |
@@ -528,28 +528,28 @@ discard block |
||
528 | 528 | * @return mixed If successful, the new donation stat value, otherwise false |
529 | 529 | */ |
530 | 530 | public function update_donation_value( $curr_amount, $new_amount ) { |
531 | - /** |
|
532 | - * Payment total difference value can be: |
|
533 | - * zero (in case amount not change) |
|
534 | - * or -ve (in case amount decrease) |
|
535 | - * or +ve (in case amount increase) |
|
536 | - */ |
|
537 | - $payment_total_diff = $new_amount - $curr_amount; |
|
538 | - |
|
539 | - // We do not need to update donation stat if donation did not change. |
|
540 | - if( ! $payment_total_diff ) { |
|
541 | - return false; |
|
542 | - } |
|
543 | - |
|
544 | - |
|
545 | - if( $payment_total_diff > 0 ) { |
|
546 | - $this->increase_value( $payment_total_diff ); |
|
547 | - }else{ |
|
548 | - // Pass payment total difference as +ve value to decrease amount from user lifetime stat. |
|
549 | - $this->decrease_value( -$payment_total_diff ); |
|
550 | - } |
|
551 | - |
|
552 | - return $this->purchase_value; |
|
531 | + /** |
|
532 | + * Payment total difference value can be: |
|
533 | + * zero (in case amount not change) |
|
534 | + * or -ve (in case amount decrease) |
|
535 | + * or +ve (in case amount increase) |
|
536 | + */ |
|
537 | + $payment_total_diff = $new_amount - $curr_amount; |
|
538 | + |
|
539 | + // We do not need to update donation stat if donation did not change. |
|
540 | + if( ! $payment_total_diff ) { |
|
541 | + return false; |
|
542 | + } |
|
543 | + |
|
544 | + |
|
545 | + if( $payment_total_diff > 0 ) { |
|
546 | + $this->increase_value( $payment_total_diff ); |
|
547 | + }else{ |
|
548 | + // Pass payment total difference as +ve value to decrease amount from user lifetime stat. |
|
549 | + $this->decrease_value( -$payment_total_diff ); |
|
550 | + } |
|
551 | + |
|
552 | + return $this->purchase_value; |
|
553 | 553 | } |
554 | 554 | |
555 | 555 | /** |
@@ -544,7 +544,7 @@ |
||
544 | 544 | |
545 | 545 | if( $payment_total_diff > 0 ) { |
546 | 546 | $this->increase_value( $payment_total_diff ); |
547 | - }else{ |
|
547 | + } else{ |
|
548 | 548 | // Pass payment total difference as +ve value to decrease amount from user lifetime stat. |
549 | 549 | $this->decrease_value( -$payment_total_diff ); |
550 | 550 | } |
@@ -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 | |
@@ -97,29 +97,29 @@ discard block |
||
97 | 97 | * @param bool $_id_or_email |
98 | 98 | * @param bool $by_user_id |
99 | 99 | */ |
100 | - public function __construct( $_id_or_email = false, $by_user_id = false ) { |
|
100 | + public function __construct($_id_or_email = false, $by_user_id = false) { |
|
101 | 101 | |
102 | 102 | $this->db = new Give_DB_Customers; |
103 | 103 | |
104 | - if ( false === $_id_or_email || ( is_numeric( $_id_or_email ) && (int) $_id_or_email !== absint( $_id_or_email ) ) ) { |
|
104 | + if (false === $_id_or_email || (is_numeric($_id_or_email) && (int) $_id_or_email !== absint($_id_or_email))) { |
|
105 | 105 | return false; |
106 | 106 | } |
107 | 107 | |
108 | - $by_user_id = is_bool( $by_user_id ) ? $by_user_id : false; |
|
108 | + $by_user_id = is_bool($by_user_id) ? $by_user_id : false; |
|
109 | 109 | |
110 | - if ( is_numeric( $_id_or_email ) ) { |
|
110 | + if (is_numeric($_id_or_email)) { |
|
111 | 111 | $field = $by_user_id ? 'user_id' : 'id'; |
112 | 112 | } else { |
113 | 113 | $field = 'email'; |
114 | 114 | } |
115 | 115 | |
116 | - $customer = $this->db->get_customer_by( $field, $_id_or_email ); |
|
116 | + $customer = $this->db->get_customer_by($field, $_id_or_email); |
|
117 | 117 | |
118 | - if ( empty( $customer ) || ! is_object( $customer ) ) { |
|
118 | + if (empty($customer) || ! is_object($customer)) { |
|
119 | 119 | return false; |
120 | 120 | } |
121 | 121 | |
122 | - $this->setup_customer( $customer ); |
|
122 | + $this->setup_customer($customer); |
|
123 | 123 | |
124 | 124 | } |
125 | 125 | |
@@ -132,15 +132,15 @@ discard block |
||
132 | 132 | * |
133 | 133 | * @return bool If the setup was successful or not |
134 | 134 | */ |
135 | - private function setup_customer( $customer ) { |
|
135 | + private function setup_customer($customer) { |
|
136 | 136 | |
137 | - if ( ! is_object( $customer ) ) { |
|
137 | + if ( ! is_object($customer)) { |
|
138 | 138 | return false; |
139 | 139 | } |
140 | 140 | |
141 | - foreach ( $customer as $key => $value ) { |
|
141 | + foreach ($customer as $key => $value) { |
|
142 | 142 | |
143 | - switch ( $key ) { |
|
143 | + switch ($key) { |
|
144 | 144 | |
145 | 145 | case 'notes': |
146 | 146 | $this->$key = $this->get_notes(); |
@@ -155,7 +155,7 @@ discard block |
||
155 | 155 | } |
156 | 156 | |
157 | 157 | // Customer ID and email are the only things that are necessary, make sure they exist |
158 | - if ( ! empty( $this->id ) && ! empty( $this->email ) ) { |
|
158 | + if ( ! empty($this->id) && ! empty($this->email)) { |
|
159 | 159 | return true; |
160 | 160 | } |
161 | 161 | |
@@ -168,16 +168,16 @@ discard block |
||
168 | 168 | * |
169 | 169 | * @since 1.0 |
170 | 170 | */ |
171 | - public function __get( $key ) { |
|
171 | + public function __get($key) { |
|
172 | 172 | |
173 | - if ( method_exists( $this, 'get_' . $key ) ) { |
|
173 | + if (method_exists($this, 'get_'.$key)) { |
|
174 | 174 | |
175 | - return call_user_func( array( $this, 'get_' . $key ) ); |
|
175 | + return call_user_func(array($this, 'get_'.$key)); |
|
176 | 176 | |
177 | 177 | } else { |
178 | 178 | |
179 | 179 | /* translators: %s: property key */ |
180 | - return new WP_Error( 'give-customer-invalid-property', sprintf( esc_html__( 'Can\'t get property %s.', 'give' ), $key ) ); |
|
180 | + return new WP_Error('give-customer-invalid-property', sprintf(esc_html__('Can\'t get property %s.', 'give'), $key)); |
|
181 | 181 | |
182 | 182 | } |
183 | 183 | |
@@ -192,9 +192,9 @@ discard block |
||
192 | 192 | * |
193 | 193 | * @return mixed False if not a valid creation, Customer ID if user is found or valid creation |
194 | 194 | */ |
195 | - public function create( $data = array() ) { |
|
195 | + public function create($data = array()) { |
|
196 | 196 | |
197 | - if ( $this->id != 0 || empty( $data ) ) { |
|
197 | + if ($this->id != 0 || empty($data)) { |
|
198 | 198 | return false; |
199 | 199 | } |
200 | 200 | |
@@ -202,34 +202,34 @@ discard block |
||
202 | 202 | 'payment_ids' => '' |
203 | 203 | ); |
204 | 204 | |
205 | - $args = wp_parse_args( $data, $defaults ); |
|
206 | - $args = $this->sanitize_columns( $args ); |
|
205 | + $args = wp_parse_args($data, $defaults); |
|
206 | + $args = $this->sanitize_columns($args); |
|
207 | 207 | |
208 | - if ( empty( $args['email'] ) || ! is_email( $args['email'] ) ) { |
|
208 | + if (empty($args['email']) || ! is_email($args['email'])) { |
|
209 | 209 | return false; |
210 | 210 | } |
211 | 211 | |
212 | - if ( ! empty( $args['payment_ids'] ) && is_array( $args['payment_ids'] ) ) { |
|
213 | - $args['payment_ids'] = implode( ',', array_unique( array_values( $args['payment_ids'] ) ) ); |
|
212 | + if ( ! empty($args['payment_ids']) && is_array($args['payment_ids'])) { |
|
213 | + $args['payment_ids'] = implode(',', array_unique(array_values($args['payment_ids']))); |
|
214 | 214 | } |
215 | 215 | |
216 | - do_action( 'give_customer_pre_create', $args ); |
|
216 | + do_action('give_customer_pre_create', $args); |
|
217 | 217 | |
218 | 218 | $created = false; |
219 | 219 | |
220 | 220 | // The DB class 'add' implies an update if the customer being asked to be created already exists |
221 | - if ( $this->db->add( $data ) ) { |
|
221 | + if ($this->db->add($data)) { |
|
222 | 222 | |
223 | 223 | // We've successfully added/updated the customer, reset the class vars with the new data |
224 | - $customer = $this->db->get_customer_by( 'email', $args['email'] ); |
|
224 | + $customer = $this->db->get_customer_by('email', $args['email']); |
|
225 | 225 | |
226 | 226 | // Setup the customer data with the values from DB |
227 | - $this->setup_customer( $customer ); |
|
227 | + $this->setup_customer($customer); |
|
228 | 228 | |
229 | 229 | $created = $this->id; |
230 | 230 | } |
231 | 231 | |
232 | - do_action( 'give_customer_post_create', $created, $args ); |
|
232 | + do_action('give_customer_post_create', $created, $args); |
|
233 | 233 | |
234 | 234 | return $created; |
235 | 235 | |
@@ -244,27 +244,27 @@ discard block |
||
244 | 244 | * |
245 | 245 | * @return bool If the update was successful or not |
246 | 246 | */ |
247 | - public function update( $data = array() ) { |
|
247 | + public function update($data = array()) { |
|
248 | 248 | |
249 | - if ( empty( $data ) ) { |
|
249 | + if (empty($data)) { |
|
250 | 250 | return false; |
251 | 251 | } |
252 | 252 | |
253 | - $data = $this->sanitize_columns( $data ); |
|
253 | + $data = $this->sanitize_columns($data); |
|
254 | 254 | |
255 | - do_action( 'give_customer_pre_update', $this->id, $data ); |
|
255 | + do_action('give_customer_pre_update', $this->id, $data); |
|
256 | 256 | |
257 | 257 | $updated = false; |
258 | 258 | |
259 | - if ( $this->db->update( $this->id, $data ) ) { |
|
259 | + if ($this->db->update($this->id, $data)) { |
|
260 | 260 | |
261 | - $customer = $this->db->get_customer_by( 'id', $this->id ); |
|
262 | - $this->setup_customer( $customer ); |
|
261 | + $customer = $this->db->get_customer_by('id', $this->id); |
|
262 | + $this->setup_customer($customer); |
|
263 | 263 | |
264 | 264 | $updated = true; |
265 | 265 | } |
266 | 266 | |
267 | - do_action( 'give_customer_post_update', $updated, $this->id, $data ); |
|
267 | + do_action('give_customer_post_update', $updated, $this->id, $data); |
|
268 | 268 | |
269 | 269 | return $updated; |
270 | 270 | } |
@@ -280,44 +280,44 @@ discard block |
||
280 | 280 | * |
281 | 281 | * @return bool If the attachment was successfuly |
282 | 282 | */ |
283 | - public function attach_payment( $payment_id = 0, $update_stats = true ) { |
|
283 | + public function attach_payment($payment_id = 0, $update_stats = true) { |
|
284 | 284 | |
285 | - if ( empty( $payment_id ) ) { |
|
285 | + if (empty($payment_id)) { |
|
286 | 286 | return false; |
287 | 287 | } |
288 | 288 | |
289 | - if ( empty( $this->payment_ids ) ) { |
|
289 | + if (empty($this->payment_ids)) { |
|
290 | 290 | |
291 | 291 | $new_payment_ids = $payment_id; |
292 | 292 | |
293 | 293 | } else { |
294 | 294 | |
295 | - $payment_ids = array_map( 'absint', explode( ',', $this->payment_ids ) ); |
|
295 | + $payment_ids = array_map('absint', explode(',', $this->payment_ids)); |
|
296 | 296 | |
297 | - if ( in_array( $payment_id, $payment_ids ) ) { |
|
297 | + if (in_array($payment_id, $payment_ids)) { |
|
298 | 298 | $update_stats = false; |
299 | 299 | } |
300 | 300 | |
301 | 301 | $payment_ids[] = $payment_id; |
302 | 302 | |
303 | - $new_payment_ids = implode( ',', array_unique( array_values( $payment_ids ) ) ); |
|
303 | + $new_payment_ids = implode(',', array_unique(array_values($payment_ids))); |
|
304 | 304 | |
305 | 305 | } |
306 | 306 | |
307 | - do_action( 'give_customer_pre_attach_payment', $payment_id, $this->id ); |
|
307 | + do_action('give_customer_pre_attach_payment', $payment_id, $this->id); |
|
308 | 308 | |
309 | - $payment_added = $this->update( array( 'payment_ids' => $new_payment_ids ) ); |
|
309 | + $payment_added = $this->update(array('payment_ids' => $new_payment_ids)); |
|
310 | 310 | |
311 | - if ( $payment_added ) { |
|
311 | + if ($payment_added) { |
|
312 | 312 | |
313 | 313 | $this->payment_ids = $new_payment_ids; |
314 | 314 | |
315 | 315 | // We added this payment successfully, increment the stats |
316 | - if ( $update_stats ) { |
|
317 | - $payment_amount = give_get_payment_amount( $payment_id ); |
|
316 | + if ($update_stats) { |
|
317 | + $payment_amount = give_get_payment_amount($payment_id); |
|
318 | 318 | |
319 | - if ( ! empty( $payment_amount ) ) { |
|
320 | - $this->increase_value( $payment_amount ); |
|
319 | + if ( ! empty($payment_amount)) { |
|
320 | + $this->increase_value($payment_amount); |
|
321 | 321 | } |
322 | 322 | |
323 | 323 | $this->increase_purchase_count(); |
@@ -325,7 +325,7 @@ discard block |
||
325 | 325 | |
326 | 326 | } |
327 | 327 | |
328 | - do_action( 'give_customer_post_attach_payment', $payment_added, $payment_id, $this->id ); |
|
328 | + do_action('give_customer_post_attach_payment', $payment_added, $payment_id, $this->id); |
|
329 | 329 | |
330 | 330 | return $payment_added; |
331 | 331 | } |
@@ -341,50 +341,50 @@ discard block |
||
341 | 341 | * |
342 | 342 | * @return boolean If the removal was successful |
343 | 343 | */ |
344 | - public function remove_payment( $payment_id = 0, $update_stats = true ) { |
|
344 | + public function remove_payment($payment_id = 0, $update_stats = true) { |
|
345 | 345 | |
346 | - if ( empty( $payment_id ) ) { |
|
346 | + if (empty($payment_id)) { |
|
347 | 347 | return false; |
348 | 348 | } |
349 | 349 | |
350 | - $payment = new Give_Payment( $payment_id ); |
|
350 | + $payment = new Give_Payment($payment_id); |
|
351 | 351 | |
352 | - if ( 'publish' !== $payment->status && 'revoked' !== $payment->status ) { |
|
352 | + if ('publish' !== $payment->status && 'revoked' !== $payment->status) { |
|
353 | 353 | $update_stats = false; |
354 | 354 | } |
355 | 355 | |
356 | 356 | $new_payment_ids = ''; |
357 | 357 | |
358 | - if ( ! empty( $this->payment_ids ) ) { |
|
358 | + if ( ! empty($this->payment_ids)) { |
|
359 | 359 | |
360 | - $payment_ids = array_map( 'absint', explode( ',', $this->payment_ids ) ); |
|
360 | + $payment_ids = array_map('absint', explode(',', $this->payment_ids)); |
|
361 | 361 | |
362 | - $pos = array_search( $payment_id, $payment_ids ); |
|
363 | - if ( false === $pos ) { |
|
362 | + $pos = array_search($payment_id, $payment_ids); |
|
363 | + if (false === $pos) { |
|
364 | 364 | return false; |
365 | 365 | } |
366 | 366 | |
367 | - unset( $payment_ids[ $pos ] ); |
|
368 | - $payment_ids = array_filter( $payment_ids ); |
|
367 | + unset($payment_ids[$pos]); |
|
368 | + $payment_ids = array_filter($payment_ids); |
|
369 | 369 | |
370 | - $new_payment_ids = implode( ',', array_unique( array_values( $payment_ids ) ) ); |
|
370 | + $new_payment_ids = implode(',', array_unique(array_values($payment_ids))); |
|
371 | 371 | |
372 | 372 | } |
373 | 373 | |
374 | - do_action( 'give_customer_pre_remove_payment', $payment_id, $this->id ); |
|
374 | + do_action('give_customer_pre_remove_payment', $payment_id, $this->id); |
|
375 | 375 | |
376 | - $payment_removed = $this->update( array( 'payment_ids' => $new_payment_ids ) ); |
|
376 | + $payment_removed = $this->update(array('payment_ids' => $new_payment_ids)); |
|
377 | 377 | |
378 | - if ( $payment_removed ) { |
|
378 | + if ($payment_removed) { |
|
379 | 379 | |
380 | 380 | $this->payment_ids = $new_payment_ids; |
381 | 381 | |
382 | - if ( $update_stats ) { |
|
382 | + if ($update_stats) { |
|
383 | 383 | // We removed this payment successfully, decrement the stats |
384 | - $payment_amount = give_get_payment_amount( $payment_id ); |
|
384 | + $payment_amount = give_get_payment_amount($payment_id); |
|
385 | 385 | |
386 | - if ( ! empty( $payment_amount ) ) { |
|
387 | - $this->decrease_value( $payment_amount ); |
|
386 | + if ( ! empty($payment_amount)) { |
|
387 | + $this->decrease_value($payment_amount); |
|
388 | 388 | } |
389 | 389 | |
390 | 390 | $this->decrease_purchase_count(); |
@@ -392,7 +392,7 @@ discard block |
||
392 | 392 | |
393 | 393 | } |
394 | 394 | |
395 | - do_action( 'give_customer_post_remove_payment', $payment_removed, $payment_id, $this->id ); |
|
395 | + do_action('give_customer_post_remove_payment', $payment_removed, $payment_id, $this->id); |
|
396 | 396 | |
397 | 397 | return $payment_removed; |
398 | 398 | |
@@ -407,22 +407,22 @@ discard block |
||
407 | 407 | * |
408 | 408 | * @return int The purchase count |
409 | 409 | */ |
410 | - public function increase_purchase_count( $count = 1 ) { |
|
410 | + public function increase_purchase_count($count = 1) { |
|
411 | 411 | |
412 | 412 | // Make sure it's numeric and not negative |
413 | - if ( ! is_numeric( $count ) || $count != absint( $count ) ) { |
|
413 | + if ( ! is_numeric($count) || $count != absint($count)) { |
|
414 | 414 | return false; |
415 | 415 | } |
416 | 416 | |
417 | 417 | $new_total = (int) $this->purchase_count + (int) $count; |
418 | 418 | |
419 | - do_action( 'give_customer_pre_increase_purchase_count', $count, $this->id ); |
|
419 | + do_action('give_customer_pre_increase_purchase_count', $count, $this->id); |
|
420 | 420 | |
421 | - if ( $this->update( array( 'purchase_count' => $new_total ) ) ) { |
|
421 | + if ($this->update(array('purchase_count' => $new_total))) { |
|
422 | 422 | $this->purchase_count = $new_total; |
423 | 423 | } |
424 | 424 | |
425 | - do_action( 'give_customer_post_increase_purchase_count', $this->purchase_count, $count, $this->id ); |
|
425 | + do_action('give_customer_post_increase_purchase_count', $this->purchase_count, $count, $this->id); |
|
426 | 426 | |
427 | 427 | return $this->purchase_count; |
428 | 428 | } |
@@ -436,26 +436,26 @@ discard block |
||
436 | 436 | * |
437 | 437 | * @return mixed If successful, the new count, otherwise false |
438 | 438 | */ |
439 | - public function decrease_purchase_count( $count = 1 ) { |
|
439 | + public function decrease_purchase_count($count = 1) { |
|
440 | 440 | |
441 | 441 | // Make sure it's numeric and not negative |
442 | - if ( ! is_numeric( $count ) || $count != absint( $count ) ) { |
|
442 | + if ( ! is_numeric($count) || $count != absint($count)) { |
|
443 | 443 | return false; |
444 | 444 | } |
445 | 445 | |
446 | 446 | $new_total = (int) $this->purchase_count - (int) $count; |
447 | 447 | |
448 | - if ( $new_total < 0 ) { |
|
448 | + if ($new_total < 0) { |
|
449 | 449 | $new_total = 0; |
450 | 450 | } |
451 | 451 | |
452 | - do_action( 'give_customer_pre_decrease_purchase_count', $count, $this->id ); |
|
452 | + do_action('give_customer_pre_decrease_purchase_count', $count, $this->id); |
|
453 | 453 | |
454 | - if ( $this->update( array( 'purchase_count' => $new_total ) ) ) { |
|
454 | + if ($this->update(array('purchase_count' => $new_total))) { |
|
455 | 455 | $this->purchase_count = $new_total; |
456 | 456 | } |
457 | 457 | |
458 | - do_action( 'give_customer_post_decrease_purchase_count', $this->purchase_count, $count, $this->id ); |
|
458 | + do_action('give_customer_post_decrease_purchase_count', $this->purchase_count, $count, $this->id); |
|
459 | 459 | |
460 | 460 | return $this->purchase_count; |
461 | 461 | } |
@@ -469,17 +469,17 @@ discard block |
||
469 | 469 | * |
470 | 470 | * @return mixed If successful, the new value, otherwise false |
471 | 471 | */ |
472 | - public function increase_value( $value = 0.00 ) { |
|
472 | + public function increase_value($value = 0.00) { |
|
473 | 473 | |
474 | - $new_value = floatval( $this->purchase_value ) + $value; |
|
474 | + $new_value = floatval($this->purchase_value) + $value; |
|
475 | 475 | |
476 | - do_action( 'give_customer_pre_increase_value', $value, $this->id ); |
|
476 | + do_action('give_customer_pre_increase_value', $value, $this->id); |
|
477 | 477 | |
478 | - if ( $this->update( array( 'purchase_value' => $new_value ) ) ) { |
|
478 | + if ($this->update(array('purchase_value' => $new_value))) { |
|
479 | 479 | $this->purchase_value = $new_value; |
480 | 480 | } |
481 | 481 | |
482 | - do_action( 'give_customer_post_increase_value', $this->purchase_value, $value, $this->id ); |
|
482 | + do_action('give_customer_post_increase_value', $this->purchase_value, $value, $this->id); |
|
483 | 483 | |
484 | 484 | return $this->purchase_value; |
485 | 485 | } |
@@ -493,21 +493,21 @@ discard block |
||
493 | 493 | * |
494 | 494 | * @return mixed If successful, the new value, otherwise false |
495 | 495 | */ |
496 | - public function decrease_value( $value = 0.00 ) { |
|
496 | + public function decrease_value($value = 0.00) { |
|
497 | 497 | |
498 | - $new_value = floatval( $this->purchase_value ) - $value; |
|
498 | + $new_value = floatval($this->purchase_value) - $value; |
|
499 | 499 | |
500 | - if ( $new_value < 0 ) { |
|
500 | + if ($new_value < 0) { |
|
501 | 501 | $new_value = 0.00; |
502 | 502 | } |
503 | 503 | |
504 | - do_action( 'give_customer_pre_decrease_value', $value, $this->id ); |
|
504 | + do_action('give_customer_pre_decrease_value', $value, $this->id); |
|
505 | 505 | |
506 | - if ( $this->update( array( 'purchase_value' => $new_value ) ) ) { |
|
506 | + if ($this->update(array('purchase_value' => $new_value))) { |
|
507 | 507 | $this->purchase_value = $new_value; |
508 | 508 | } |
509 | 509 | |
510 | - do_action( 'give_customer_post_decrease_value', $this->purchase_value, $value, $this->id ); |
|
510 | + do_action('give_customer_post_decrease_value', $this->purchase_value, $value, $this->id); |
|
511 | 511 | |
512 | 512 | return $this->purchase_value; |
513 | 513 | } |
@@ -527,7 +527,7 @@ discard block |
||
527 | 527 | * |
528 | 528 | * @return mixed If successful, the new donation stat value, otherwise false |
529 | 529 | */ |
530 | - public function update_donation_value( $curr_amount, $new_amount ) { |
|
530 | + public function update_donation_value($curr_amount, $new_amount) { |
|
531 | 531 | /** |
532 | 532 | * Payment total difference value can be: |
533 | 533 | * zero (in case amount not change) |
@@ -537,14 +537,14 @@ discard block |
||
537 | 537 | $payment_total_diff = $new_amount - $curr_amount; |
538 | 538 | |
539 | 539 | // We do not need to update donation stat if donation did not change. |
540 | - if( ! $payment_total_diff ) { |
|
540 | + if ( ! $payment_total_diff) { |
|
541 | 541 | return false; |
542 | 542 | } |
543 | 543 | |
544 | 544 | |
545 | - if( $payment_total_diff > 0 ) { |
|
546 | - $this->increase_value( $payment_total_diff ); |
|
547 | - }else{ |
|
545 | + if ($payment_total_diff > 0) { |
|
546 | + $this->increase_value($payment_total_diff); |
|
547 | + } else { |
|
548 | 548 | // Pass payment total difference as +ve value to decrease amount from user lifetime stat. |
549 | 549 | $this->decrease_value( -$payment_total_diff ); |
550 | 550 | } |
@@ -562,15 +562,15 @@ discard block |
||
562 | 562 | * |
563 | 563 | * @return array The notes requsted |
564 | 564 | */ |
565 | - public function get_notes( $length = 20, $paged = 1 ) { |
|
565 | + public function get_notes($length = 20, $paged = 1) { |
|
566 | 566 | |
567 | - $length = is_numeric( $length ) ? $length : 20; |
|
568 | - $offset = is_numeric( $paged ) && $paged != 1 ? ( ( absint( $paged ) - 1 ) * $length ) : 0; |
|
567 | + $length = is_numeric($length) ? $length : 20; |
|
568 | + $offset = is_numeric($paged) && $paged != 1 ? ((absint($paged) - 1) * $length) : 0; |
|
569 | 569 | |
570 | 570 | $all_notes = $this->get_raw_notes(); |
571 | - $notes_array = array_reverse( array_filter( explode( "\n\n", $all_notes ) ) ); |
|
571 | + $notes_array = array_reverse(array_filter(explode("\n\n", $all_notes))); |
|
572 | 572 | |
573 | - $desired_notes = array_slice( $notes_array, $offset, $length ); |
|
573 | + $desired_notes = array_slice($notes_array, $offset, $length); |
|
574 | 574 | |
575 | 575 | return $desired_notes; |
576 | 576 | |
@@ -585,9 +585,9 @@ discard block |
||
585 | 585 | public function get_notes_count() { |
586 | 586 | |
587 | 587 | $all_notes = $this->get_raw_notes(); |
588 | - $notes_array = array_reverse( array_filter( explode( "\n\n", $all_notes ) ) ); |
|
588 | + $notes_array = array_reverse(array_filter(explode("\n\n", $all_notes))); |
|
589 | 589 | |
590 | - return count( $notes_array ); |
|
590 | + return count($notes_array); |
|
591 | 591 | |
592 | 592 | } |
593 | 593 | |
@@ -600,32 +600,32 @@ discard block |
||
600 | 600 | * |
601 | 601 | * @return string|boolean The new note if added succesfully, false otherwise |
602 | 602 | */ |
603 | - public function add_note( $note = '' ) { |
|
603 | + public function add_note($note = '') { |
|
604 | 604 | |
605 | - $note = trim( $note ); |
|
606 | - if ( empty( $note ) ) { |
|
605 | + $note = trim($note); |
|
606 | + if (empty($note)) { |
|
607 | 607 | return false; |
608 | 608 | } |
609 | 609 | |
610 | 610 | $notes = $this->get_raw_notes(); |
611 | 611 | |
612 | - if ( empty( $notes ) ) { |
|
612 | + if (empty($notes)) { |
|
613 | 613 | $notes = ''; |
614 | 614 | } |
615 | 615 | |
616 | - $note_string = date_i18n( 'F j, Y H:i:s', current_time( 'timestamp' ) ) . ' - ' . $note; |
|
617 | - $new_note = apply_filters( 'give_customer_add_note_string', $note_string ); |
|
618 | - $notes .= "\n\n" . $new_note; |
|
616 | + $note_string = date_i18n('F j, Y H:i:s', current_time('timestamp')).' - '.$note; |
|
617 | + $new_note = apply_filters('give_customer_add_note_string', $note_string); |
|
618 | + $notes .= "\n\n".$new_note; |
|
619 | 619 | |
620 | - do_action( 'give_customer_pre_add_note', $new_note, $this->id ); |
|
620 | + do_action('give_customer_pre_add_note', $new_note, $this->id); |
|
621 | 621 | |
622 | - $updated = $this->update( array( 'notes' => $notes ) ); |
|
622 | + $updated = $this->update(array('notes' => $notes)); |
|
623 | 623 | |
624 | - if ( $updated ) { |
|
624 | + if ($updated) { |
|
625 | 625 | $this->notes = $this->get_notes(); |
626 | 626 | } |
627 | 627 | |
628 | - do_action( 'give_customer_post_add_note', $this->notes, $new_note, $this->id ); |
|
628 | + do_action('give_customer_post_add_note', $this->notes, $new_note, $this->id); |
|
629 | 629 | |
630 | 630 | // Return the formatted note, so we can test, as well as update any displays |
631 | 631 | return $new_note; |
@@ -640,7 +640,7 @@ discard block |
||
640 | 640 | */ |
641 | 641 | private function get_raw_notes() { |
642 | 642 | |
643 | - $all_notes = $this->db->get_column( 'notes', $this->id ); |
|
643 | + $all_notes = $this->db->get_column('notes', $this->id); |
|
644 | 644 | |
645 | 645 | return $all_notes; |
646 | 646 | |
@@ -655,51 +655,51 @@ discard block |
||
655 | 655 | * |
656 | 656 | * @return array The sanitized data, based off column defaults |
657 | 657 | */ |
658 | - private function sanitize_columns( $data ) { |
|
658 | + private function sanitize_columns($data) { |
|
659 | 659 | |
660 | 660 | $columns = $this->db->get_columns(); |
661 | 661 | $default_values = $this->db->get_column_defaults(); |
662 | 662 | |
663 | - foreach ( $columns as $key => $type ) { |
|
663 | + foreach ($columns as $key => $type) { |
|
664 | 664 | |
665 | 665 | // Only sanitize data that we were provided |
666 | - if ( ! array_key_exists( $key, $data ) ) { |
|
666 | + if ( ! array_key_exists($key, $data)) { |
|
667 | 667 | continue; |
668 | 668 | } |
669 | 669 | |
670 | - switch ( $type ) { |
|
670 | + switch ($type) { |
|
671 | 671 | |
672 | 672 | case '%s': |
673 | - if ( 'email' == $key ) { |
|
674 | - $data[ $key ] = sanitize_email( $data[ $key ] ); |
|
675 | - } elseif ( 'notes' == $key ) { |
|
676 | - $data[ $key ] = strip_tags( $data[ $key ] ); |
|
673 | + if ('email' == $key) { |
|
674 | + $data[$key] = sanitize_email($data[$key]); |
|
675 | + } elseif ('notes' == $key) { |
|
676 | + $data[$key] = strip_tags($data[$key]); |
|
677 | 677 | } else { |
678 | - $data[ $key ] = sanitize_text_field( $data[ $key ] ); |
|
678 | + $data[$key] = sanitize_text_field($data[$key]); |
|
679 | 679 | } |
680 | 680 | break; |
681 | 681 | |
682 | 682 | case '%d': |
683 | - if ( ! is_numeric( $data[ $key ] ) || (int) $data[ $key ] !== absint( $data[ $key ] ) ) { |
|
684 | - $data[ $key ] = $default_values[ $key ]; |
|
683 | + if ( ! is_numeric($data[$key]) || (int) $data[$key] !== absint($data[$key])) { |
|
684 | + $data[$key] = $default_values[$key]; |
|
685 | 685 | } else { |
686 | - $data[ $key ] = absint( $data[ $key ] ); |
|
686 | + $data[$key] = absint($data[$key]); |
|
687 | 687 | } |
688 | 688 | break; |
689 | 689 | |
690 | 690 | case '%f': |
691 | 691 | // Convert what was given to a float |
692 | - $value = floatval( $data[ $key ] ); |
|
692 | + $value = floatval($data[$key]); |
|
693 | 693 | |
694 | - if ( ! is_float( $value ) ) { |
|
695 | - $data[ $key ] = $default_values[ $key ]; |
|
694 | + if ( ! is_float($value)) { |
|
695 | + $data[$key] = $default_values[$key]; |
|
696 | 696 | } else { |
697 | - $data[ $key ] = $value; |
|
697 | + $data[$key] = $value; |
|
698 | 698 | } |
699 | 699 | break; |
700 | 700 | |
701 | 701 | default: |
702 | - $data[ $key ] = sanitize_text_field( $data[ $key ] ); |
|
702 | + $data[$key] = sanitize_text_field($data[$key]); |
|
703 | 703 | break; |
704 | 704 | |
705 | 705 | } |
@@ -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 | |
@@ -21,7 +21,7 @@ discard block |
||
21 | 21 | * @return string |
22 | 22 | */ |
23 | 23 | function give_get_templates_dir() { |
24 | - return GIVE_PLUGIN_DIR . 'templates'; |
|
24 | + return GIVE_PLUGIN_DIR.'templates'; |
|
25 | 25 | } |
26 | 26 | |
27 | 27 | /** |
@@ -31,7 +31,7 @@ discard block |
||
31 | 31 | * @return string |
32 | 32 | */ |
33 | 33 | function give_get_templates_url() { |
34 | - return GIVE_PLUGIN_URL . 'templates'; |
|
34 | + return GIVE_PLUGIN_URL.'templates'; |
|
35 | 35 | } |
36 | 36 | |
37 | 37 | /** |
@@ -51,23 +51,23 @@ discard block |
||
51 | 51 | * @uses load_template() |
52 | 52 | * @uses get_template_part() |
53 | 53 | */ |
54 | -function give_get_template_part( $slug, $name = null, $load = true ) { |
|
54 | +function give_get_template_part($slug, $name = null, $load = true) { |
|
55 | 55 | |
56 | 56 | // Execute code for this part |
57 | - do_action( 'get_template_part_' . $slug, $slug, $name ); |
|
57 | + do_action('get_template_part_'.$slug, $slug, $name); |
|
58 | 58 | |
59 | 59 | // Setup possible parts |
60 | 60 | $templates = array(); |
61 | - if ( isset( $name ) ) { |
|
62 | - $templates[] = $slug . '-' . $name . '.php'; |
|
61 | + if (isset($name)) { |
|
62 | + $templates[] = $slug.'-'.$name.'.php'; |
|
63 | 63 | } |
64 | - $templates[] = $slug . '.php'; |
|
64 | + $templates[] = $slug.'.php'; |
|
65 | 65 | |
66 | 66 | // Allow template parts to be filtered |
67 | - $templates = apply_filters( 'give_get_template_part', $templates, $slug, $name ); |
|
67 | + $templates = apply_filters('give_get_template_part', $templates, $slug, $name); |
|
68 | 68 | |
69 | 69 | // Return the part that is found |
70 | - return give_locate_template( $templates, $load, false ); |
|
70 | + return give_locate_template($templates, $load, false); |
|
71 | 71 | } |
72 | 72 | |
73 | 73 | /** |
@@ -88,37 +88,37 @@ discard block |
||
88 | 88 | * |
89 | 89 | * @return string The template filename if one is located. |
90 | 90 | */ |
91 | -function give_locate_template( $template_names, $load = false, $require_once = true ) { |
|
91 | +function give_locate_template($template_names, $load = false, $require_once = true) { |
|
92 | 92 | // No file found yet |
93 | 93 | $located = false; |
94 | 94 | |
95 | 95 | // Try to find a template file |
96 | - foreach ( (array) $template_names as $template_name ) { |
|
96 | + foreach ((array) $template_names as $template_name) { |
|
97 | 97 | |
98 | 98 | // Continue if template is empty |
99 | - if ( empty( $template_name ) ) { |
|
99 | + if (empty($template_name)) { |
|
100 | 100 | continue; |
101 | 101 | } |
102 | 102 | |
103 | 103 | // Trim off any slashes from the template name |
104 | - $template_name = ltrim( $template_name, '/' ); |
|
104 | + $template_name = ltrim($template_name, '/'); |
|
105 | 105 | |
106 | 106 | // try locating this template file by looping through the template paths |
107 | - foreach ( give_get_theme_template_paths() as $template_path ) { |
|
107 | + foreach (give_get_theme_template_paths() as $template_path) { |
|
108 | 108 | |
109 | - if ( file_exists( $template_path . $template_name ) ) { |
|
110 | - $located = $template_path . $template_name; |
|
109 | + if (file_exists($template_path.$template_name)) { |
|
110 | + $located = $template_path.$template_name; |
|
111 | 111 | break; |
112 | 112 | } |
113 | 113 | } |
114 | 114 | |
115 | - if ( $located ) { |
|
115 | + if ($located) { |
|
116 | 116 | break; |
117 | 117 | } |
118 | 118 | } |
119 | 119 | |
120 | - if ( ( true == $load ) && ! empty( $located ) ) { |
|
121 | - load_template( $located, $require_once ); |
|
120 | + if ((true == $load) && ! empty($located)) { |
|
121 | + load_template($located, $require_once); |
|
122 | 122 | } |
123 | 123 | |
124 | 124 | return $located; |
@@ -135,17 +135,17 @@ discard block |
||
135 | 135 | $template_dir = give_get_theme_template_dir_name(); |
136 | 136 | |
137 | 137 | $file_paths = array( |
138 | - 1 => trailingslashit( get_stylesheet_directory() ) . $template_dir, |
|
139 | - 10 => trailingslashit( get_template_directory() ) . $template_dir, |
|
138 | + 1 => trailingslashit(get_stylesheet_directory()).$template_dir, |
|
139 | + 10 => trailingslashit(get_template_directory()).$template_dir, |
|
140 | 140 | 100 => give_get_templates_dir() |
141 | 141 | ); |
142 | 142 | |
143 | - $file_paths = apply_filters( 'give_template_paths', $file_paths ); |
|
143 | + $file_paths = apply_filters('give_template_paths', $file_paths); |
|
144 | 144 | |
145 | 145 | // sort the file paths based on priority |
146 | - ksort( $file_paths, SORT_NUMERIC ); |
|
146 | + ksort($file_paths, SORT_NUMERIC); |
|
147 | 147 | |
148 | - return array_map( 'trailingslashit', $file_paths ); |
|
148 | + return array_map('trailingslashit', $file_paths); |
|
149 | 149 | } |
150 | 150 | |
151 | 151 | /** |
@@ -157,7 +157,7 @@ discard block |
||
157 | 157 | * @return string |
158 | 158 | */ |
159 | 159 | function give_get_theme_template_dir_name() { |
160 | - return trailingslashit( apply_filters( 'give_templates_dir', 'give' ) ); |
|
160 | + return trailingslashit(apply_filters('give_templates_dir', 'give')); |
|
161 | 161 | } |
162 | 162 | |
163 | 163 | /** |
@@ -167,10 +167,10 @@ discard block |
||
167 | 167 | * @return void |
168 | 168 | */ |
169 | 169 | function give_version_in_header() { |
170 | - echo '<meta name="generator" content="Give v' . GIVE_VERSION . '" />' . "\n"; |
|
170 | + echo '<meta name="generator" content="Give v'.GIVE_VERSION.'" />'."\n"; |
|
171 | 171 | } |
172 | 172 | |
173 | -add_action( 'wp_head', 'give_version_in_header' ); |
|
173 | +add_action('wp_head', 'give_version_in_header'); |
|
174 | 174 | |
175 | 175 | /** |
176 | 176 | * Determines if we're currently on the Donations History page. |
@@ -180,9 +180,9 @@ discard block |
||
180 | 180 | */ |
181 | 181 | function give_is_donation_history_page() { |
182 | 182 | |
183 | - $ret = is_page( give_get_option( 'history_page' ) ); |
|
183 | + $ret = is_page(give_get_option('history_page')); |
|
184 | 184 | |
185 | - return apply_filters( 'give_is_donation_history_page', $ret ); |
|
185 | + return apply_filters('give_is_donation_history_page', $ret); |
|
186 | 186 | } |
187 | 187 | |
188 | 188 | /** |
@@ -194,25 +194,25 @@ discard block |
||
194 | 194 | * |
195 | 195 | * @return array Modified array of classes |
196 | 196 | */ |
197 | -function give_add_body_classes( $class ) { |
|
197 | +function give_add_body_classes($class) { |
|
198 | 198 | $classes = (array) $class; |
199 | 199 | |
200 | - if ( give_is_success_page() ) { |
|
200 | + if (give_is_success_page()) { |
|
201 | 201 | $classes[] = 'give-success'; |
202 | 202 | $classes[] = 'give-page'; |
203 | 203 | } |
204 | 204 | |
205 | - if ( give_is_failed_transaction_page() ) { |
|
205 | + if (give_is_failed_transaction_page()) { |
|
206 | 206 | $classes[] = 'give-failed-transaction'; |
207 | 207 | $classes[] = 'give-page'; |
208 | 208 | } |
209 | 209 | |
210 | - if ( give_is_donation_history_page() ) { |
|
210 | + if (give_is_donation_history_page()) { |
|
211 | 211 | $classes[] = 'give-donation-history'; |
212 | 212 | $classes[] = 'give-page'; |
213 | 213 | } |
214 | 214 | |
215 | - if ( give_is_test_mode() ) { |
|
215 | + if (give_is_test_mode()) { |
|
216 | 216 | $classes[] = 'give-test-mode'; |
217 | 217 | $classes[] = 'give-page'; |
218 | 218 | } |
@@ -220,7 +220,7 @@ discard block |
||
220 | 220 | //Theme-specific Classes used to prevent conflicts via CSS |
221 | 221 | $current_theme = wp_get_theme(); |
222 | 222 | |
223 | - switch ( $current_theme->template ) { |
|
223 | + switch ($current_theme->template) { |
|
224 | 224 | |
225 | 225 | case 'Divi': |
226 | 226 | $classes[] = 'give-divi'; |
@@ -234,10 +234,10 @@ discard block |
||
234 | 234 | |
235 | 235 | } |
236 | 236 | |
237 | - return array_unique( $classes ); |
|
237 | + return array_unique($classes); |
|
238 | 238 | } |
239 | 239 | |
240 | -add_filter( 'body_class', 'give_add_body_classes' ); |
|
240 | +add_filter('body_class', 'give_add_body_classes'); |
|
241 | 241 | |
242 | 242 | |
243 | 243 | /** |
@@ -253,22 +253,22 @@ discard block |
||
253 | 253 | * |
254 | 254 | * @return array |
255 | 255 | */ |
256 | -function give_add_post_class( $classes, $class = '', $post_id = '' ) { |
|
257 | - if ( ! $post_id || 'give_forms' !== get_post_type( $post_id ) ) { |
|
256 | +function give_add_post_class($classes, $class = '', $post_id = '') { |
|
257 | + if ( ! $post_id || 'give_forms' !== get_post_type($post_id)) { |
|
258 | 258 | return $classes; |
259 | 259 | } |
260 | 260 | |
261 | 261 | //@TODO: Add classes for custom taxonomy and form configurations (multi vs single donations, etc). |
262 | 262 | |
263 | - if ( false !== ( $key = array_search( 'hentry', $classes ) ) ) { |
|
264 | - unset( $classes[ $key ] ); |
|
263 | + if (false !== ($key = array_search('hentry', $classes))) { |
|
264 | + unset($classes[$key]); |
|
265 | 265 | } |
266 | 266 | |
267 | 267 | return $classes; |
268 | 268 | } |
269 | 269 | |
270 | 270 | |
271 | -add_filter( 'post_class', 'give_add_post_class', 20, 3 ); |
|
271 | +add_filter('post_class', 'give_add_post_class', 20, 3); |
|
272 | 272 | |
273 | 273 | /** |
274 | 274 | * Get the placeholder image URL for forms etc |
@@ -278,84 +278,84 @@ discard block |
||
278 | 278 | */ |
279 | 279 | function give_get_placeholder_img_src() { |
280 | 280 | |
281 | - $placeholder_url = '//placehold.it/600x600&text=' . urlencode( esc_attr__( 'Give Placeholder Image', 'give' ) ); |
|
281 | + $placeholder_url = '//placehold.it/600x600&text='.urlencode(esc_attr__('Give Placeholder Image', 'give')); |
|
282 | 282 | |
283 | - return apply_filters( 'give_placeholder_img_src', $placeholder_url ); |
|
283 | + return apply_filters('give_placeholder_img_src', $placeholder_url); |
|
284 | 284 | } |
285 | 285 | |
286 | 286 | |
287 | 287 | /** |
288 | 288 | * Global |
289 | 289 | */ |
290 | -if ( ! function_exists( 'give_output_content_wrapper' ) ) { |
|
290 | +if ( ! function_exists('give_output_content_wrapper')) { |
|
291 | 291 | |
292 | 292 | /** |
293 | 293 | * Output the start of the page wrapper. |
294 | 294 | */ |
295 | 295 | function give_output_content_wrapper() { |
296 | - give_get_template_part( 'global/wrapper-start' ); |
|
296 | + give_get_template_part('global/wrapper-start'); |
|
297 | 297 | } |
298 | 298 | } |
299 | -if ( ! function_exists( 'give_output_content_wrapper_end' ) ) { |
|
299 | +if ( ! function_exists('give_output_content_wrapper_end')) { |
|
300 | 300 | |
301 | 301 | /** |
302 | 302 | * Output the end of the page wrapper. |
303 | 303 | */ |
304 | 304 | function give_output_content_wrapper_end() { |
305 | - give_get_template_part( 'global/wrapper-end' ); |
|
305 | + give_get_template_part('global/wrapper-end'); |
|
306 | 306 | } |
307 | 307 | } |
308 | 308 | |
309 | 309 | /** |
310 | 310 | * Single Give Form |
311 | 311 | */ |
312 | -if ( ! function_exists( 'give_left_sidebar_pre_wrap' ) ) { |
|
312 | +if ( ! function_exists('give_left_sidebar_pre_wrap')) { |
|
313 | 313 | function give_left_sidebar_pre_wrap() { |
314 | - echo apply_filters( 'give_left_sidebar_pre_wrap', '<div id="give-sidebar-left" class="give-sidebar give-single-form-sidebar-left">' ); |
|
314 | + echo apply_filters('give_left_sidebar_pre_wrap', '<div id="give-sidebar-left" class="give-sidebar give-single-form-sidebar-left">'); |
|
315 | 315 | } |
316 | 316 | } |
317 | 317 | |
318 | -if ( ! function_exists( 'give_left_sidebar_post_wrap' ) ) { |
|
318 | +if ( ! function_exists('give_left_sidebar_post_wrap')) { |
|
319 | 319 | function give_left_sidebar_post_wrap() { |
320 | - echo apply_filters( 'give_left_sidebar_post_wrap', '</div>' ); |
|
320 | + echo apply_filters('give_left_sidebar_post_wrap', '</div>'); |
|
321 | 321 | } |
322 | 322 | } |
323 | 323 | |
324 | -if ( ! function_exists( 'give_get_forms_sidebar' ) ) { |
|
324 | +if ( ! function_exists('give_get_forms_sidebar')) { |
|
325 | 325 | function give_get_forms_sidebar() { |
326 | - give_get_template_part( 'single-give-form/sidebar' ); |
|
326 | + give_get_template_part('single-give-form/sidebar'); |
|
327 | 327 | } |
328 | 328 | } |
329 | 329 | |
330 | -if ( ! function_exists( 'give_show_form_images' ) ) { |
|
330 | +if ( ! function_exists('give_show_form_images')) { |
|
331 | 331 | |
332 | 332 | /** |
333 | 333 | * Output the product image before the single product summary. |
334 | 334 | */ |
335 | 335 | function give_show_form_images() { |
336 | - $featured_image_option = give_get_option( 'disable_form_featured_img' ); |
|
337 | - if ( $featured_image_option !== 'on' ) { |
|
338 | - give_get_template_part( 'single-give-form/featured-image' ); |
|
336 | + $featured_image_option = give_get_option('disable_form_featured_img'); |
|
337 | + if ($featured_image_option !== 'on') { |
|
338 | + give_get_template_part('single-give-form/featured-image'); |
|
339 | 339 | } |
340 | 340 | } |
341 | 341 | } |
342 | 342 | |
343 | -if ( ! function_exists( 'give_template_single_title' ) ) { |
|
343 | +if ( ! function_exists('give_template_single_title')) { |
|
344 | 344 | |
345 | 345 | /** |
346 | 346 | * Output the product title. |
347 | 347 | */ |
348 | 348 | function give_template_single_title() { |
349 | - give_get_template_part( 'single-give-form/title' ); |
|
349 | + give_get_template_part('single-give-form/title'); |
|
350 | 350 | } |
351 | 351 | } |
352 | 352 | |
353 | -if ( ! function_exists( 'give_show_avatars' ) ) { |
|
353 | +if ( ! function_exists('give_show_avatars')) { |
|
354 | 354 | |
355 | 355 | /** |
356 | 356 | * Output the product title. |
357 | 357 | */ |
358 | 358 | function give_show_avatars() { |
359 | - echo do_shortcode( '[give_donators_gravatars]' ); |
|
359 | + echo do_shortcode('[give_donators_gravatars]'); |
|
360 | 360 | } |
361 | 361 | } |
362 | 362 | \ No newline at end of file |
@@ -23,7 +23,7 @@ discard block |
||
23 | 23 | public $error = ''; |
24 | 24 | |
25 | 25 | private $verify_throttle; |
26 | - private $token_expiration; |
|
26 | + private $token_expiration; |
|
27 | 27 | |
28 | 28 | /** |
29 | 29 | * Give_Email_Access constructor. |
@@ -243,7 +243,7 @@ discard block |
||
243 | 243 | * @return bool |
244 | 244 | */ |
245 | 245 | function is_valid_verify_key( $token ) { |
246 | - /* @var WPDB $wpdb */ |
|
246 | + /* @var WPDB $wpdb */ |
|
247 | 247 | global $wpdb; |
248 | 248 | |
249 | 249 | // See if the verify_key exists |
@@ -10,7 +10,7 @@ discard block |
||
10 | 10 | * @since 1.4 |
11 | 11 | */ |
12 | 12 | |
13 | -defined( 'ABSPATH' ) or exit; |
|
13 | +defined('ABSPATH') or exit; |
|
14 | 14 | |
15 | 15 | /** |
16 | 16 | * Class Give_Email_Access |
@@ -30,7 +30,7 @@ discard block |
||
30 | 30 | function __construct() { |
31 | 31 | |
32 | 32 | // get it started |
33 | - add_action( 'init', array( $this, 'init' ) ); |
|
33 | + add_action('init', array($this, 'init')); |
|
34 | 34 | } |
35 | 35 | |
36 | 36 | |
@@ -39,30 +39,30 @@ discard block |
||
39 | 39 | */ |
40 | 40 | function init() { |
41 | 41 | |
42 | - $is_enabled = give_get_option( 'email_access' ); |
|
42 | + $is_enabled = give_get_option('email_access'); |
|
43 | 43 | |
44 | 44 | //Non-logged in users only |
45 | - if ( is_user_logged_in() || $is_enabled !== 'on' || is_admin() ) { |
|
45 | + if (is_user_logged_in() || $is_enabled !== 'on' || is_admin()) { |
|
46 | 46 | return; |
47 | 47 | } |
48 | 48 | |
49 | 49 | //Are db columns setup? |
50 | - $is_setup = give_get_option( 'email_access_installed' ); |
|
51 | - if ( empty( $is_setup ) ) { |
|
50 | + $is_setup = give_get_option('email_access_installed'); |
|
51 | + if (empty($is_setup)) { |
|
52 | 52 | $this->create_columns(); |
53 | 53 | } |
54 | 54 | |
55 | 55 | // Timeouts |
56 | - $this->verify_throttle = apply_filters( 'give_nl_verify_throttle', 300 ); |
|
57 | - $this->token_expiration = apply_filters( 'give_nl_token_expiration', 7200 ); |
|
56 | + $this->verify_throttle = apply_filters('give_nl_verify_throttle', 300); |
|
57 | + $this->token_expiration = apply_filters('give_nl_token_expiration', 7200); |
|
58 | 58 | |
59 | 59 | // Setup login |
60 | 60 | $this->check_for_token(); |
61 | 61 | |
62 | - if ( $this->token_exists ) { |
|
63 | - add_filter( 'give_can_view_receipt', '__return_true' ); |
|
64 | - add_filter( 'give_user_pending_verification', '__return_false' ); |
|
65 | - add_filter( 'give_get_users_purchases_args', array( $this, 'users_purchases_args' ) ); |
|
62 | + if ($this->token_exists) { |
|
63 | + add_filter('give_can_view_receipt', '__return_true'); |
|
64 | + add_filter('give_user_pending_verification', '__return_false'); |
|
65 | + add_filter('give_get_users_purchases_args', array($this, 'users_purchases_args')); |
|
66 | 66 | } |
67 | 67 | } |
68 | 68 | |
@@ -73,24 +73,24 @@ discard block |
||
73 | 73 | * |
74 | 74 | * @return bool |
75 | 75 | */ |
76 | - function can_send_email( $customer_id ) { |
|
76 | + function can_send_email($customer_id) { |
|
77 | 77 | global $wpdb; |
78 | 78 | |
79 | 79 | // Prevent multiple emails within X minutes |
80 | - $throttle = date( 'Y-m-d H:i:s', time() - $this->verify_throttle ); |
|
80 | + $throttle = date('Y-m-d H:i:s', time() - $this->verify_throttle); |
|
81 | 81 | |
82 | 82 | // Does a user row exist? |
83 | 83 | $exists = (int) $wpdb->get_var( |
84 | - $wpdb->prepare( "SELECT COUNT(*) FROM {$wpdb->prefix}give_customers WHERE id = %d", $customer_id ) |
|
84 | + $wpdb->prepare("SELECT COUNT(*) FROM {$wpdb->prefix}give_customers WHERE id = %d", $customer_id) |
|
85 | 85 | ); |
86 | 86 | |
87 | - if ( 0 < $exists ) { |
|
87 | + if (0 < $exists) { |
|
88 | 88 | $row_id = (int) $wpdb->get_var( |
89 | - $wpdb->prepare( "SELECT id FROM {$wpdb->prefix}give_customers WHERE id = %d AND (verify_throttle < %s OR verify_key = '') LIMIT 1", $customer_id, $throttle ) |
|
89 | + $wpdb->prepare("SELECT id FROM {$wpdb->prefix}give_customers WHERE id = %d AND (verify_throttle < %s OR verify_key = '') LIMIT 1", $customer_id, $throttle) |
|
90 | 90 | ); |
91 | 91 | |
92 | - if ( $row_id < 1 ) { |
|
93 | - give_set_error( 'give_email_access_attempts_exhausted', esc_html__( 'Please wait a few minutes before requesting a new email access link.', 'give' ) ); |
|
92 | + if ($row_id < 1) { |
|
93 | + give_set_error('give_email_access_attempts_exhausted', esc_html__('Please wait a few minutes before requesting a new email access link.', 'give')); |
|
94 | 94 | |
95 | 95 | return false; |
96 | 96 | } |
@@ -106,38 +106,38 @@ discard block |
||
106 | 106 | * @param $customer_id |
107 | 107 | * @param $email |
108 | 108 | */ |
109 | - function send_email( $customer_id, $email ) { |
|
109 | + function send_email($customer_id, $email) { |
|
110 | 110 | |
111 | - $verify_key = wp_generate_password( 20, false ); |
|
111 | + $verify_key = wp_generate_password(20, false); |
|
112 | 112 | |
113 | 113 | // Generate a new verify key |
114 | - $this->set_verify_key( $customer_id, $email, $verify_key ); |
|
114 | + $this->set_verify_key($customer_id, $email, $verify_key); |
|
115 | 115 | |
116 | 116 | // Get the purchase history URL |
117 | - $page_id = give_get_option( 'history_page' ); |
|
117 | + $page_id = give_get_option('history_page'); |
|
118 | 118 | |
119 | - $access_url = add_query_arg( array( |
|
119 | + $access_url = add_query_arg(array( |
|
120 | 120 | 'give_nl' => $verify_key, |
121 | - ), get_permalink( $page_id ) ); |
|
121 | + ), get_permalink($page_id)); |
|
122 | 122 | |
123 | 123 | //Nice subject and message |
124 | - $subject = apply_filters( 'give_email_access_token_subject', sprintf( esc_html__( 'Your Access Link to %s', 'give' ), get_bloginfo( 'name' ) ) ); |
|
124 | + $subject = apply_filters('give_email_access_token_subject', sprintf(esc_html__('Your Access Link to %s', 'give'), get_bloginfo('name'))); |
|
125 | 125 | |
126 | - $message = esc_html__( 'You or someone in your organization requested an access link be sent to this email address. This is a temporary access link for you to view your donation information. Click on the link below to view:', 'give' ) . "\n\n"; |
|
126 | + $message = esc_html__('You or someone in your organization requested an access link be sent to this email address. This is a temporary access link for you to view your donation information. Click on the link below to view:', 'give')."\n\n"; |
|
127 | 127 | |
128 | - $message .= '<a href="' . esc_url( $access_url ) . '" target="_blank">' . esc_html__( 'Access My Donation Details', 'give' ) . ' »</a>'; |
|
128 | + $message .= '<a href="'.esc_url($access_url).'" target="_blank">'.esc_html__('Access My Donation Details', 'give').' »</a>'; |
|
129 | 129 | |
130 | 130 | $message .= "\n\n"; |
131 | 131 | $message .= "\n\n"; |
132 | - $message .= esc_html__( 'Sincerely,', 'give' ); |
|
133 | - $message .= "\n" . get_bloginfo( 'name' ) . "\n"; |
|
132 | + $message .= esc_html__('Sincerely,', 'give'); |
|
133 | + $message .= "\n".get_bloginfo('name')."\n"; |
|
134 | 134 | |
135 | - $message = apply_filters( 'give_email_access_token_message', $message ); |
|
135 | + $message = apply_filters('give_email_access_token_message', $message); |
|
136 | 136 | |
137 | 137 | |
138 | 138 | // Send the email |
139 | - Give()->emails->__set( 'heading', apply_filters( 'give_email_access_token_heading', esc_html__( 'Your Access Link', 'give' ) ) ); |
|
140 | - Give()->emails->send( $email, $subject, $message ); |
|
139 | + Give()->emails->__set('heading', apply_filters('give_email_access_token_heading', esc_html__('Your Access Link', 'give'))); |
|
140 | + Give()->emails->send($email, $subject, $message); |
|
141 | 141 | |
142 | 142 | } |
143 | 143 | |
@@ -147,24 +147,24 @@ discard block |
||
147 | 147 | */ |
148 | 148 | function check_for_token() { |
149 | 149 | |
150 | - $token = isset( $_GET['give_nl'] ) ? $_GET['give_nl'] : ''; |
|
150 | + $token = isset($_GET['give_nl']) ? $_GET['give_nl'] : ''; |
|
151 | 151 | |
152 | 152 | // Check for cookie |
153 | - if ( empty( $token ) ) { |
|
154 | - $token = isset( $_COOKIE['give_nl'] ) ? $_COOKIE['give_nl'] : ''; |
|
153 | + if (empty($token)) { |
|
154 | + $token = isset($_COOKIE['give_nl']) ? $_COOKIE['give_nl'] : ''; |
|
155 | 155 | } |
156 | 156 | |
157 | - if ( ! empty( $token ) ) { |
|
158 | - if ( ! $this->is_valid_token( $token ) ) { |
|
159 | - if ( ! $this->is_valid_verify_key( $token ) ) { |
|
157 | + if ( ! empty($token)) { |
|
158 | + if ( ! $this->is_valid_token($token)) { |
|
159 | + if ( ! $this->is_valid_verify_key($token)) { |
|
160 | 160 | return; |
161 | 161 | } |
162 | 162 | } |
163 | 163 | |
164 | 164 | $this->token_exists = true; |
165 | 165 | // Set cookie |
166 | - $lifetime = current_time( 'timestamp' ) + Give()->session->set_expiration_time(); |
|
167 | - @setcookie( 'give_nl', $token, $lifetime, COOKIEPATH, COOKIE_DOMAIN, false ); |
|
166 | + $lifetime = current_time('timestamp') + Give()->session->set_expiration_time(); |
|
167 | + @setcookie('give_nl', $token, $lifetime, COOKIEPATH, COOKIE_DOMAIN, false); |
|
168 | 168 | } |
169 | 169 | } |
170 | 170 | |
@@ -175,18 +175,18 @@ discard block |
||
175 | 175 | * |
176 | 176 | * @return bool |
177 | 177 | */ |
178 | - function is_valid_token( $token ) { |
|
178 | + function is_valid_token($token) { |
|
179 | 179 | |
180 | 180 | global $wpdb; |
181 | 181 | |
182 | 182 | // Make sure token isn't expired |
183 | - $expires = date( 'Y-m-d H:i:s', time() - $this->token_expiration ); |
|
183 | + $expires = date('Y-m-d H:i:s', time() - $this->token_expiration); |
|
184 | 184 | |
185 | 185 | $email = $wpdb->get_var( |
186 | - $wpdb->prepare( "SELECT email FROM {$wpdb->prefix}give_customers WHERE token = %s AND verify_throttle >= %s LIMIT 1", $token, $expires ) |
|
186 | + $wpdb->prepare("SELECT email FROM {$wpdb->prefix}give_customers WHERE token = %s AND verify_throttle >= %s LIMIT 1", $token, $expires) |
|
187 | 187 | ); |
188 | 188 | |
189 | - if ( ! empty( $email ) ) { |
|
189 | + if ( ! empty($email)) { |
|
190 | 190 | $this->token_email = $email; |
191 | 191 | $this->token = $token; |
192 | 192 | |
@@ -194,8 +194,8 @@ discard block |
||
194 | 194 | } |
195 | 195 | |
196 | 196 | //Set error only if email access form isn't being submitted |
197 | - if ( ! isset( $_POST['give_email'] ) && ! isset( $_POST['_wpnonce'] ) ) { |
|
198 | - give_set_error( 'give_email_token_expired', apply_filters( 'give_email_token_expired_message', 'Sorry, your access token has expired. Please request a new one below:', 'give' ) ); |
|
197 | + if ( ! isset($_POST['give_email']) && ! isset($_POST['_wpnonce'])) { |
|
198 | + give_set_error('give_email_token_expired', apply_filters('give_email_token_expired_message', 'Sorry, your access token has expired. Please request a new one below:', 'give')); |
|
199 | 199 | } |
200 | 200 | |
201 | 201 | |
@@ -210,25 +210,25 @@ discard block |
||
210 | 210 | * @param $email |
211 | 211 | * @param $verify_key |
212 | 212 | */ |
213 | - function set_verify_key( $customer_id, $email, $verify_key ) { |
|
213 | + function set_verify_key($customer_id, $email, $verify_key) { |
|
214 | 214 | global $wpdb; |
215 | 215 | |
216 | - $now = date( 'Y-m-d H:i:s' ); |
|
216 | + $now = date('Y-m-d H:i:s'); |
|
217 | 217 | |
218 | 218 | // Insert or update? |
219 | 219 | $row_id = (int) $wpdb->get_var( |
220 | - $wpdb->prepare( "SELECT id FROM {$wpdb->prefix}give_customers WHERE id = %d LIMIT 1", $customer_id ) |
|
220 | + $wpdb->prepare("SELECT id FROM {$wpdb->prefix}give_customers WHERE id = %d LIMIT 1", $customer_id) |
|
221 | 221 | ); |
222 | 222 | |
223 | 223 | // Update |
224 | - if ( ! empty( $row_id ) ) { |
|
224 | + if ( ! empty($row_id)) { |
|
225 | 225 | $wpdb->query( |
226 | - $wpdb->prepare( "UPDATE {$wpdb->prefix}give_customers SET verify_key = %s, verify_throttle = %s WHERE id = %d LIMIT 1", $verify_key, $now, $row_id ) |
|
226 | + $wpdb->prepare("UPDATE {$wpdb->prefix}give_customers SET verify_key = %s, verify_throttle = %s WHERE id = %d LIMIT 1", $verify_key, $now, $row_id) |
|
227 | 227 | ); |
228 | 228 | } // Insert |
229 | 229 | else { |
230 | 230 | $wpdb->query( |
231 | - $wpdb->prepare( "INSERT INTO {$wpdb->prefix}give_customers ( verify_key, verify_throttle) VALUES (%s, %s)", $verify_key, $now ) |
|
231 | + $wpdb->prepare("INSERT INTO {$wpdb->prefix}give_customers ( verify_key, verify_throttle) VALUES (%s, %s)", $verify_key, $now) |
|
232 | 232 | ); |
233 | 233 | } |
234 | 234 | } |
@@ -240,20 +240,20 @@ discard block |
||
240 | 240 | * |
241 | 241 | * @return bool |
242 | 242 | */ |
243 | - function is_valid_verify_key( $token ) { |
|
243 | + function is_valid_verify_key($token) { |
|
244 | 244 | global $wpdb; |
245 | 245 | |
246 | 246 | // See if the verify_key exists |
247 | 247 | $row = $wpdb->get_row( |
248 | - $wpdb->prepare( "SELECT id, email FROM {$wpdb->prefix}give_customers WHERE verify_key = %s LIMIT 1", $token ) |
|
248 | + $wpdb->prepare("SELECT id, email FROM {$wpdb->prefix}give_customers WHERE verify_key = %s LIMIT 1", $token) |
|
249 | 249 | ); |
250 | 250 | |
251 | - $now = date( 'Y-m-d H:i:s' ); |
|
251 | + $now = date('Y-m-d H:i:s'); |
|
252 | 252 | |
253 | 253 | // Set token |
254 | - if ( ! empty( $row ) ) { |
|
254 | + if ( ! empty($row)) { |
|
255 | 255 | $wpdb->query( |
256 | - $wpdb->prepare( "UPDATE {$wpdb->prefix}give_customers SET verify_key = '', token = %s, verify_throttle = %s WHERE id = %d LIMIT 1", $token, $now, $row->id ) |
|
256 | + $wpdb->prepare("UPDATE {$wpdb->prefix}give_customers SET verify_key = '', token = %s, verify_throttle = %s WHERE id = %d LIMIT 1", $token, $now, $row->id) |
|
257 | 257 | ); |
258 | 258 | |
259 | 259 | $this->token_email = $row->email; |
@@ -272,7 +272,7 @@ discard block |
||
272 | 272 | * |
273 | 273 | * @return mixed |
274 | 274 | */ |
275 | - function users_purchases_args( $args ) { |
|
275 | + function users_purchases_args($args) { |
|
276 | 276 | $args['user'] = $this->token_email; |
277 | 277 | |
278 | 278 | return $args; |
@@ -289,11 +289,11 @@ discard block |
||
289 | 289 | global $wpdb; |
290 | 290 | |
291 | 291 | //Create columns in customers table |
292 | - $query = $wpdb->query( "ALTER TABLE {$wpdb->prefix}give_customers ADD `token` VARCHAR(255) CHARACTER SET utf8 NOT NULL, ADD `verify_key` VARCHAR(255) CHARACTER SET utf8 NOT NULL AFTER `token`, ADD `verify_throttle` DATETIME NOT NULL AFTER `verify_key`" ); |
|
292 | + $query = $wpdb->query("ALTER TABLE {$wpdb->prefix}give_customers ADD `token` VARCHAR(255) CHARACTER SET utf8 NOT NULL, ADD `verify_key` VARCHAR(255) CHARACTER SET utf8 NOT NULL AFTER `token`, ADD `verify_throttle` DATETIME NOT NULL AFTER `verify_key`"); |
|
293 | 293 | |
294 | 294 | //Columns added properly |
295 | - if ( $query ) { |
|
296 | - give_update_option( 'email_access_installed', 1 ); |
|
295 | + if ($query) { |
|
296 | + give_update_option('email_access_installed', 1); |
|
297 | 297 | } |
298 | 298 | |
299 | 299 | } |
@@ -259,8 +259,11 @@ discard block |
||
259 | 259 | <span class="customer-user-id info-item editable"> |
260 | 260 | <?php if ( intval( $customer->user_id ) > 0 ) : ?> |
261 | 261 | <span data-key="user_id"><?php echo $customer->user_id; ?></span> |
262 | - <?php else : ?> |
|
263 | - <span data-key="user_id"><?php esc_html_e( 'None', 'give' ); ?></span> |
|
262 | + <?php else { |
|
263 | + : ?> |
|
264 | + <span data-key="user_id"><?php esc_html_e( 'None', 'give' ); |
|
265 | +} |
|
266 | +?></span> |
|
264 | 267 | <?php endif; ?> |
265 | 268 | <?php if ( current_user_can( $customer_edit_role ) && intval( $customer->user_id ) > 0 ) : ?> |
266 | 269 | <span class="disconnect-user"> - <a id="disconnect-customer" href="#disconnect" title="<?php esc_attr_e( 'Disconnects the current user ID from this customer record', 'give' ); ?>"><?php esc_html_e( 'Disconnect User', 'give' ); ?></a></span> |
@@ -329,8 +332,11 @@ discard block |
||
329 | 332 | } |
330 | 333 | ?> |
331 | 334 | </select> |
332 | - <?php else : ?> |
|
333 | - <input type="text" size="6" data-key="state" name="customerinfo[state]" id="card_state" class="card_state give-input info-item" placeholder="<?php esc_attr_e( 'State / Province', 'give' ); ?>" /> |
|
335 | + <?php else { |
|
336 | + : ?> |
|
337 | + <input type="text" size="6" data-key="state" name="customerinfo[state]" id="card_state" class="card_state give-input info-item" placeholder="<?php esc_attr_e( 'State / Province', 'give' ); |
|
338 | +} |
|
339 | +?>" /> |
|
334 | 340 | <?php endif; ?> |
335 | 341 | <input class="info-item" type="text" data-key="zip" name="customerinfo[zip]" placeholder="<?php esc_attr_e( 'Postal', 'give' ); ?>" value="<?php echo $address['zip']; ?>" /> |
336 | 342 | </span> |
@@ -420,9 +426,12 @@ discard block |
||
420 | 426 | </td> |
421 | 427 | </tr> |
422 | 428 | <?php endforeach; ?> |
423 | - <?php else: ?> |
|
429 | + <?php else { |
|
430 | + : ?> |
|
424 | 431 | <tr> |
425 | - <td colspan="5"><?php esc_html_e( 'No Donations Found', 'give' ); ?></td> |
|
432 | + <td colspan="5"><?php esc_html_e( 'No Donations Found', 'give' ); |
|
433 | +} |
|
434 | +?></td> |
|
426 | 435 | </tr> |
427 | 436 | <?php endif; ?> |
428 | 437 | </tbody> |
@@ -463,9 +472,12 @@ discard block |
||
463 | 472 | </td> |
464 | 473 | </tr> |
465 | 474 | <?php endforeach; ?> |
466 | - <?php else: ?> |
|
475 | + <?php else { |
|
476 | + : ?> |
|
467 | 477 | <tr> |
468 | - <td colspan="2"><?php esc_html_e( 'No Completed Donations Found', 'give' ); ?></td> |
|
478 | + <td colspan="2"><?php esc_html_e( 'No Completed Donations Found', 'give' ); |
|
479 | +} |
|
480 | +?></td> |
|
469 | 481 | </tr> |
470 | 482 | <?php endif; ?> |
471 | 483 | </tbody> |
@@ -539,9 +551,12 @@ discard block |
||
539 | 551 | </span> |
540 | 552 | </div> |
541 | 553 | <?php endforeach; ?> |
542 | - <?php else: ?> |
|
554 | + <?php else { |
|
555 | + : ?> |
|
543 | 556 | <div class="give-no-customer-notes"> |
544 | - <?php esc_html_e( 'No Donor Notes', 'give' ); ?> |
|
557 | + <?php esc_html_e( 'No Donor Notes', 'give' ); |
|
558 | +} |
|
559 | +?> |
|
545 | 560 | </div> |
546 | 561 | <?php endif; ?> |
547 | 562 | </div> |
@@ -10,7 +10,7 @@ discard block |
||
10 | 10 | */ |
11 | 11 | |
12 | 12 | // Exit if accessed directly |
13 | -if ( ! defined( 'ABSPATH' ) ) { |
|
13 | +if ( ! defined('ABSPATH')) { |
|
14 | 14 | exit; |
15 | 15 | } |
16 | 16 | |
@@ -24,9 +24,9 @@ discard block |
||
24 | 24 | */ |
25 | 25 | function give_customers_page() { |
26 | 26 | $default_views = give_customer_views(); |
27 | - $requested_view = isset( $_GET['view'] ) ? sanitize_text_field( $_GET['view'] ) : 'customers'; |
|
28 | - if ( array_key_exists( $requested_view, $default_views ) && function_exists( $default_views[ $requested_view ] ) ) { |
|
29 | - give_render_customer_view( $requested_view, $default_views ); |
|
27 | + $requested_view = isset($_GET['view']) ? sanitize_text_field($_GET['view']) : 'customers'; |
|
28 | + if (array_key_exists($requested_view, $default_views) && function_exists($default_views[$requested_view])) { |
|
29 | + give_render_customer_view($requested_view, $default_views); |
|
30 | 30 | } else { |
31 | 31 | give_customers_list(); |
32 | 32 | } |
@@ -42,7 +42,7 @@ discard block |
||
42 | 42 | |
43 | 43 | $views = array(); |
44 | 44 | |
45 | - return apply_filters( 'give_customer_views', $views ); |
|
45 | + return apply_filters('give_customer_views', $views); |
|
46 | 46 | |
47 | 47 | } |
48 | 48 | |
@@ -56,7 +56,7 @@ discard block |
||
56 | 56 | |
57 | 57 | $tabs = array(); |
58 | 58 | |
59 | - return apply_filters( 'give_customer_tabs', $tabs ); |
|
59 | + return apply_filters('give_customer_tabs', $tabs); |
|
60 | 60 | |
61 | 61 | } |
62 | 62 | |
@@ -67,24 +67,24 @@ discard block |
||
67 | 67 | * @return void |
68 | 68 | */ |
69 | 69 | function give_customers_list() { |
70 | - include( dirname( __FILE__ ) . '/class-customer-table.php' ); |
|
70 | + include(dirname(__FILE__).'/class-customer-table.php'); |
|
71 | 71 | |
72 | 72 | $customers_table = new Give_Customer_Reports_Table(); |
73 | 73 | $customers_table->prepare_items(); |
74 | 74 | ?> |
75 | 75 | <div class="wrap"> |
76 | - <h2><?php esc_html_e( 'Donors', 'give' ); ?></h2> |
|
77 | - <?php do_action( 'give_donors_table_top' ); ?> |
|
78 | - <form id="give-donors-filter" method="get" action="<?php echo admin_url( 'edit.php?post_type=give_forms&page=give-donors' ); ?>"> |
|
76 | + <h2><?php esc_html_e('Donors', 'give'); ?></h2> |
|
77 | + <?php do_action('give_donors_table_top'); ?> |
|
78 | + <form id="give-donors-filter" method="get" action="<?php echo admin_url('edit.php?post_type=give_forms&page=give-donors'); ?>"> |
|
79 | 79 | <?php |
80 | - $customers_table->search_box( esc_html__( 'Search Donors', 'give' ), 'give-donors' ); |
|
80 | + $customers_table->search_box(esc_html__('Search Donors', 'give'), 'give-donors'); |
|
81 | 81 | $customers_table->display(); |
82 | 82 | ?> |
83 | 83 | <input type="hidden" name="post_type" value="give_forms" /> |
84 | 84 | <input type="hidden" name="page" value="give-donors" /> |
85 | 85 | <input type="hidden" name="view" value="customers" /> |
86 | 86 | </form> |
87 | - <?php do_action( 'give_donors_table_bottom' ); ?> |
|
87 | + <?php do_action('give_donors_table_bottom'); ?> |
|
88 | 88 | </div> |
89 | 89 | <?php |
90 | 90 | } |
@@ -99,27 +99,27 @@ discard block |
||
99 | 99 | * |
100 | 100 | * @return void |
101 | 101 | */ |
102 | -function give_render_customer_view( $view, $callbacks ) { |
|
102 | +function give_render_customer_view($view, $callbacks) { |
|
103 | 103 | |
104 | 104 | $render = true; |
105 | 105 | |
106 | - $customer_view_role = apply_filters( 'give_view_customers_role', 'view_give_reports' ); |
|
106 | + $customer_view_role = apply_filters('give_view_customers_role', 'view_give_reports'); |
|
107 | 107 | |
108 | - if ( ! current_user_can( $customer_view_role ) ) { |
|
109 | - give_set_error( 'give-no-access', esc_html__( 'You are not permitted to view this data.', 'give' ) ); |
|
108 | + if ( ! current_user_can($customer_view_role)) { |
|
109 | + give_set_error('give-no-access', esc_html__('You are not permitted to view this data.', 'give')); |
|
110 | 110 | $render = false; |
111 | 111 | } |
112 | 112 | |
113 | - if ( ! isset( $_GET['id'] ) || ! is_numeric( $_GET['id'] ) ) { |
|
114 | - give_set_error( 'give-invalid_customer', esc_html__( 'Invalid Donor ID Provided.', 'give' ) ); |
|
113 | + if ( ! isset($_GET['id']) || ! is_numeric($_GET['id'])) { |
|
114 | + give_set_error('give-invalid_customer', esc_html__('Invalid Donor ID Provided.', 'give')); |
|
115 | 115 | $render = false; |
116 | 116 | } |
117 | 117 | |
118 | 118 | $customer_id = (int) $_GET['id']; |
119 | - $customer = new Give_Customer( $customer_id ); |
|
119 | + $customer = new Give_Customer($customer_id); |
|
120 | 120 | |
121 | - if ( empty( $customer->id ) ) { |
|
122 | - give_set_error( 'give-invalid_customer', esc_html__( 'Invalid Donor ID Provided.', 'give' ) ); |
|
121 | + if (empty($customer->id)) { |
|
122 | + give_set_error('give-invalid_customer', esc_html__('Invalid Donor ID Provided.', 'give')); |
|
123 | 123 | $render = false; |
124 | 124 | } |
125 | 125 | |
@@ -128,27 +128,27 @@ discard block |
||
128 | 128 | |
129 | 129 | <div class='wrap'> |
130 | 130 | |
131 | - <?php if ( give_get_errors() ) : ?> |
|
131 | + <?php if (give_get_errors()) : ?> |
|
132 | 132 | <div class="error settings-error"> |
133 | - <?php give_print_errors( 0 ); ?> |
|
133 | + <?php give_print_errors(0); ?> |
|
134 | 134 | </div> |
135 | 135 | <?php endif; ?> |
136 | 136 | |
137 | - <?php if ( $customer && $render ) : ?> |
|
137 | + <?php if ($customer && $render) : ?> |
|
138 | 138 | |
139 | 139 | <div id="customer-tab-wrapper"> |
140 | 140 | <ul id="customer-tab-wrapper-list" class="nav-tab-wrapper"> |
141 | - <?php foreach ( $customer_tabs as $key => $tab ) : ?> |
|
141 | + <?php foreach ($customer_tabs as $key => $tab) : ?> |
|
142 | 142 | <?php $active = $key === $view ? true : false; ?> |
143 | 143 | <?php $class = $active ? 'active' : 'inactive'; ?> |
144 | 144 | |
145 | - <li class="<?php echo sanitize_html_class( $class ); ?>"> |
|
146 | - <?php if ( ! $active ) : ?> |
|
147 | - <a title="<?php esc_attr_e( $tab['title'] ); ?>" aria-label="<?php esc_attr_e( $tab['title'] ); ?>" href="<?php echo esc_url( admin_url( 'edit.php?post_type=give_forms&page=give-donors&view=' . $key . '&id=' . $customer->id ) ); ?>"> |
|
145 | + <li class="<?php echo sanitize_html_class($class); ?>"> |
|
146 | + <?php if ( ! $active) : ?> |
|
147 | + <a title="<?php esc_attr_e($tab['title']); ?>" aria-label="<?php esc_attr_e($tab['title']); ?>" href="<?php echo esc_url(admin_url('edit.php?post_type=give_forms&page=give-donors&view='.$key.'&id='.$customer->id)); ?>"> |
|
148 | 148 | <?php endif; ?> |
149 | 149 | |
150 | - <span class="dashicons <?php echo sanitize_html_class( $tab['dashicon'] ); ?>"></span> <?php esc_html_e( $tab['title'] ); ?> |
|
151 | - <?php if ( ! $active ) : ?> |
|
150 | + <span class="dashicons <?php echo sanitize_html_class($tab['dashicon']); ?>"></span> <?php esc_html_e($tab['title']); ?> |
|
151 | + <?php if ( ! $active) : ?> |
|
152 | 152 | </a> |
153 | 153 | <?php endif; ?> |
154 | 154 | |
@@ -160,7 +160,7 @@ discard block |
||
160 | 160 | </div> |
161 | 161 | |
162 | 162 | <div id="give-customer-card-wrapper"> |
163 | - <?php $callbacks[ $view ]( $customer ) ?> |
|
163 | + <?php $callbacks[$view]($customer) ?> |
|
164 | 164 | </div> |
165 | 165 | |
166 | 166 | <?php endif; ?> |
@@ -180,17 +180,17 @@ discard block |
||
180 | 180 | * |
181 | 181 | * @return void |
182 | 182 | */ |
183 | -function give_customers_view( $customer ) { |
|
183 | +function give_customers_view($customer) { |
|
184 | 184 | |
185 | - $customer_edit_role = apply_filters( 'give_edit_customers_role', 'edit_give_payments' ); |
|
185 | + $customer_edit_role = apply_filters('give_edit_customers_role', 'edit_give_payments'); |
|
186 | 186 | |
187 | 187 | ?> |
188 | 188 | |
189 | - <?php do_action( 'give_donor_card_top', $customer ); ?> |
|
189 | + <?php do_action('give_donor_card_top', $customer); ?> |
|
190 | 190 | |
191 | 191 | <div id="donor-summary" class="info-wrapper customer-section postbox"> |
192 | 192 | |
193 | - <form id="edit-customer-info" method="post" action="<?php echo admin_url( 'edit.php?post_type=give_forms&page=give-donors&view=overview&id=' . $customer->id ); ?>"> |
|
193 | + <form id="edit-customer-info" method="post" action="<?php echo admin_url('edit.php?post_type=give_forms&page=give-donors&view=overview&id='.$customer->id); ?>"> |
|
194 | 194 | |
195 | 195 | <div class="customer-info"> |
196 | 196 | |
@@ -198,20 +198,20 @@ discard block |
||
198 | 198 | <div class="donor-bio-header clearfix"> |
199 | 199 | |
200 | 200 | <div class="avatar-wrap left" id="customer-avatar"> |
201 | - <?php echo get_avatar( $customer->email ); ?> |
|
201 | + <?php echo get_avatar($customer->email); ?> |
|
202 | 202 | </div> |
203 | 203 | |
204 | 204 | <div id="customer-name-wrap" class="left"> |
205 | 205 | <span class="customer-id">#<?php echo $customer->id; ?></span> |
206 | - <span class="customer-name info-item edit-item"><input size="15" data-key="name" name="customerinfo[name]" type="text" value="<?php esc_attr_e( $customer->name ); ?>" placeholder="<?php esc_attr_e( 'Donor Name', 'give' ); ?>" /></span> |
|
206 | + <span class="customer-name info-item edit-item"><input size="15" data-key="name" name="customerinfo[name]" type="text" value="<?php esc_attr_e($customer->name); ?>" placeholder="<?php esc_attr_e('Donor Name', 'give'); ?>" /></span> |
|
207 | 207 | <span class="customer-name info-item editable"><span data-key="name"><?php echo $customer->name; ?></span></span> |
208 | 208 | </div> |
209 | 209 | <p class="customer-since info-item"> |
210 | - <?php esc_html_e( 'Donor since', 'give' ); ?> |
|
211 | - <?php echo date_i18n( get_option( 'date_format' ), strtotime( $customer->date_created ) ) ?> |
|
210 | + <?php esc_html_e('Donor since', 'give'); ?> |
|
211 | + <?php echo date_i18n(get_option('date_format'), strtotime($customer->date_created)) ?> |
|
212 | 212 | </p> |
213 | - <?php if ( current_user_can( $customer_edit_role ) ): ?> |
|
214 | - <a title="<?php esc_attr_e( 'Edit Donor', 'give' ); ?>" href="#" id="edit-customer" class="button info-item editable customer-edit-link"><?php esc_html_e( 'Edit Donor', 'give' ); ?></a> |
|
213 | + <?php if (current_user_can($customer_edit_role)): ?> |
|
214 | + <a title="<?php esc_attr_e('Edit Donor', 'give'); ?>" href="#" id="edit-customer" class="button info-item editable customer-edit-link"><?php esc_html_e('Edit Donor', 'give'); ?></a> |
|
215 | 215 | <?php endif; ?> |
216 | 216 | </div> |
217 | 217 | <!-- /donor-bio-header --> |
@@ -221,14 +221,14 @@ discard block |
||
221 | 221 | <table class="widefat"> |
222 | 222 | <tbody> |
223 | 223 | <tr> |
224 | - <td><label for="tablecell"><?php esc_html_e( 'Email', 'give' ); ?></label>:</td> |
|
224 | + <td><label for="tablecell"><?php esc_html_e('Email', 'give'); ?></label>:</td> |
|
225 | 225 | <td class="row-title"> |
226 | - <span class="customer-name info-item edit-item"><input size="20" data-key="email" name="customerinfo[email]" type="text" value="<?php echo $customer->email; ?>" placeholder="<?php esc_attr_e( 'Donor Email', 'give' ); ?>" /></span> |
|
226 | + <span class="customer-name info-item edit-item"><input size="20" data-key="email" name="customerinfo[email]" type="text" value="<?php echo $customer->email; ?>" placeholder="<?php esc_attr_e('Donor Email', 'give'); ?>" /></span> |
|
227 | 227 | <span class="customer-email info-item editable" data-key="email"><?php echo $customer->email; ?></span> |
228 | 228 | </td> |
229 | 229 | </tr> |
230 | 230 | <tr class="alternate"> |
231 | - <td><label for="tablecell"><?php esc_html_e( 'User ID', 'give' ); ?></label>:</td> |
|
231 | + <td><label for="tablecell"><?php esc_html_e('User ID', 'give'); ?></label>:</td> |
|
232 | 232 | <td class="row-title"> |
233 | 233 | <span class="customer-user-id info-item edit-item"> |
234 | 234 | <?php |
@@ -244,38 +244,38 @@ discard block |
||
244 | 244 | 'data' => $data_atts, |
245 | 245 | ); |
246 | 246 | |
247 | - if ( ! empty( $user_id ) ) { |
|
248 | - $userdata = get_userdata( $user_id ); |
|
247 | + if ( ! empty($user_id)) { |
|
248 | + $userdata = get_userdata($user_id); |
|
249 | 249 | $user_args['value'] = $userdata->user_login; |
250 | 250 | } |
251 | 251 | |
252 | - echo Give()->html->ajax_user_search( $user_args ); |
|
252 | + echo Give()->html->ajax_user_search($user_args); |
|
253 | 253 | ?> |
254 | 254 | <input type="hidden" name="customerinfo[user_id]" data-key="user_id" value="<?php echo $customer->user_id; ?>" /> |
255 | 255 | </span> |
256 | 256 | |
257 | 257 | <span class="customer-user-id info-item editable"> |
258 | - <?php if ( intval( $customer->user_id ) > 0 ) : ?> |
|
258 | + <?php if (intval($customer->user_id) > 0) : ?> |
|
259 | 259 | <span data-key="user_id"><?php echo $customer->user_id; ?></span> |
260 | 260 | <?php else : ?> |
261 | - <span data-key="user_id"><?php esc_html_e( 'None', 'give' ); ?></span> |
|
261 | + <span data-key="user_id"><?php esc_html_e('None', 'give'); ?></span> |
|
262 | 262 | <?php endif; ?> |
263 | - <?php if ( current_user_can( $customer_edit_role ) && intval( $customer->user_id ) > 0 ) : ?> |
|
264 | - <span class="disconnect-user"> - <a id="disconnect-customer" href="#disconnect" title="<?php esc_attr_e( 'Disconnects the current user ID from this customer record', 'give' ); ?>"><?php esc_html_e( 'Disconnect User', 'give' ); ?></a></span> |
|
263 | + <?php if (current_user_can($customer_edit_role) && intval($customer->user_id) > 0) : ?> |
|
264 | + <span class="disconnect-user"> - <a id="disconnect-customer" href="#disconnect" title="<?php esc_attr_e('Disconnects the current user ID from this customer record', 'give'); ?>"><?php esc_html_e('Disconnect User', 'give'); ?></a></span> |
|
265 | 265 | <?php endif; ?> |
266 | 266 | </span> |
267 | 267 | </td> |
268 | 268 | </tr> |
269 | - <?php if ( isset( $customer->user_id ) && $customer->user_id > 0 ) : ?> |
|
269 | + <?php if (isset($customer->user_id) && $customer->user_id > 0) : ?> |
|
270 | 270 | |
271 | 271 | <tr> |
272 | - <td><?php esc_html_e( 'Address', 'give' ); ?>:</td> |
|
272 | + <td><?php esc_html_e('Address', 'give'); ?>:</td> |
|
273 | 273 | <td class="row-title"> |
274 | 274 | |
275 | 275 | <div class="customer-address-wrapper"> |
276 | 276 | |
277 | 277 | <?php |
278 | - $address = get_user_meta( $customer->user_id, '_give_user_address', true ); |
|
278 | + $address = get_user_meta($customer->user_id, '_give_user_address', true); |
|
279 | 279 | $defaults = array( |
280 | 280 | 'line1' => '', |
281 | 281 | 'line2' => '', |
@@ -285,10 +285,10 @@ discard block |
||
285 | 285 | 'zip' => '' |
286 | 286 | ); |
287 | 287 | |
288 | - $address = wp_parse_args( $address, $defaults ); |
|
288 | + $address = wp_parse_args($address, $defaults); |
|
289 | 289 | ?> |
290 | 290 | |
291 | - <?php if ( ! empty( $address ) ) { ?> |
|
291 | + <?php if ( ! empty($address)) { ?> |
|
292 | 292 | <span class="customer-address info-item editable"> |
293 | 293 | <span class="info-item" data-key="line1"><?php echo $address['line1']; ?></span> |
294 | 294 | <span class="info-item" data-key="line2"><?php echo $address['line2']; ?></span> |
@@ -299,38 +299,38 @@ discard block |
||
299 | 299 | </span> |
300 | 300 | <?php } ?> |
301 | 301 | <span class="customer-address info-item edit-item"> |
302 | - <input class="info-item" type="text" data-key="line1" name="customerinfo[line1]" placeholder="<?php esc_attr_e( 'Address 1', 'give' ); ?>" value="<?php echo $address['line1']; ?>" /> |
|
303 | - <input class="info-item" type="text" data-key="line2" name="customerinfo[line2]" placeholder="<?php esc_attr_e( 'Address 2', 'give' ); ?>" value="<?php echo $address['line2']; ?>" /> |
|
304 | - <input class="info-item" type="text" data-key="city" name="customerinfo[city]" placeholder="<?php esc_attr_e( 'City', 'give' ); ?>" value="<?php echo $address['city']; ?>" /> |
|
302 | + <input class="info-item" type="text" data-key="line1" name="customerinfo[line1]" placeholder="<?php esc_attr_e('Address 1', 'give'); ?>" value="<?php echo $address['line1']; ?>" /> |
|
303 | + <input class="info-item" type="text" data-key="line2" name="customerinfo[line2]" placeholder="<?php esc_attr_e('Address 2', 'give'); ?>" value="<?php echo $address['line2']; ?>" /> |
|
304 | + <input class="info-item" type="text" data-key="city" name="customerinfo[city]" placeholder="<?php esc_attr_e('City', 'give'); ?>" value="<?php echo $address['city']; ?>" /> |
|
305 | 305 | <select data-key="country" name="customerinfo[country]" id="billing_country" class="billing_country give-select edit-item"> |
306 | 306 | <?php |
307 | 307 | |
308 | 308 | $selected_country = $address['country']; |
309 | 309 | |
310 | 310 | $countries = give_get_country_list(); |
311 | - foreach ( $countries as $country_code => $country ) { |
|
312 | - echo '<option value="' . esc_attr( $country_code ) . '"' . selected( $country_code, $selected_country, false ) . '>' . $country . '</option>'; |
|
311 | + foreach ($countries as $country_code => $country) { |
|
312 | + echo '<option value="'.esc_attr($country_code).'"'.selected($country_code, $selected_country, false).'>'.$country.'</option>'; |
|
313 | 313 | } |
314 | 314 | ?> |
315 | 315 | </select> |
316 | 316 | <?php |
317 | 317 | $selected_state = give_get_state(); |
318 | - $states = give_get_states( $selected_country ); |
|
318 | + $states = give_get_states($selected_country); |
|
319 | 319 | |
320 | - $selected_state = isset( $address['state'] ) ? $address['state'] : $selected_state; |
|
320 | + $selected_state = isset($address['state']) ? $address['state'] : $selected_state; |
|
321 | 321 | |
322 | - if ( ! empty( $states ) ) : ?> |
|
322 | + if ( ! empty($states)) : ?> |
|
323 | 323 | <select data-key="state" name="customerinfo[state]" id="card_state" class="card_state give-select info-item"> |
324 | 324 | <?php |
325 | - foreach ( $states as $state_code => $state ) { |
|
326 | - echo '<option value="' . $state_code . '"' . selected( $state_code, $selected_state, false ) . '>' . $state . '</option>'; |
|
325 | + foreach ($states as $state_code => $state) { |
|
326 | + echo '<option value="'.$state_code.'"'.selected($state_code, $selected_state, false).'>'.$state.'</option>'; |
|
327 | 327 | } |
328 | 328 | ?> |
329 | 329 | </select> |
330 | 330 | <?php else : ?> |
331 | - <input type="text" size="6" data-key="state" name="customerinfo[state]" id="card_state" class="card_state give-input info-item" placeholder="<?php esc_attr_e( 'State / Province', 'give' ); ?>" /> |
|
331 | + <input type="text" size="6" data-key="state" name="customerinfo[state]" id="card_state" class="card_state give-input info-item" placeholder="<?php esc_attr_e('State / Province', 'give'); ?>" /> |
|
332 | 332 | <?php endif; ?> |
333 | - <input class="info-item" type="text" data-key="zip" name="customerinfo[zip]" placeholder="<?php esc_attr_e( 'Postal', 'give' ); ?>" value="<?php echo $address['zip']; ?>" /> |
|
333 | + <input class="info-item" type="text" data-key="zip" name="customerinfo[zip]" placeholder="<?php esc_attr_e('Postal', 'give'); ?>" value="<?php echo $address['zip']; ?>" /> |
|
334 | 334 | </span> |
335 | 335 | |
336 | 336 | </div> |
@@ -348,112 +348,112 @@ discard block |
||
348 | 348 | |
349 | 349 | <span id="customer-edit-actions" class="edit-item"> |
350 | 350 | <input type="hidden" data-key="id" name="customerinfo[id]" value="<?php echo $customer->id; ?>" /> |
351 | - <?php wp_nonce_field( 'edit-customer', '_wpnonce', false, true ); ?> |
|
351 | + <?php wp_nonce_field('edit-customer', '_wpnonce', false, true); ?> |
|
352 | 352 | <input type="hidden" name="give_action" value="edit-customer" /> |
353 | - <input type="submit" id="give-edit-customer-save" class="button-secondary" value="<?php esc_attr_e( 'Update Donor', 'give' ); ?>" /> |
|
354 | - <a id="give-edit-customer-cancel" href="" class="delete"><?php esc_html_e( 'Cancel', 'give' ); ?></a> |
|
353 | + <input type="submit" id="give-edit-customer-save" class="button-secondary" value="<?php esc_attr_e('Update Donor', 'give'); ?>" /> |
|
354 | + <a id="give-edit-customer-cancel" href="" class="delete"><?php esc_html_e('Cancel', 'give'); ?></a> |
|
355 | 355 | </span> |
356 | 356 | |
357 | 357 | </form> |
358 | 358 | </div> |
359 | 359 | |
360 | - <?php do_action( 'give_donor_before_stats', $customer ); ?> |
|
360 | + <?php do_action('give_donor_before_stats', $customer); ?> |
|
361 | 361 | |
362 | 362 | <div id="customer-stats-wrapper" class="customer-section postbox clear"> |
363 | 363 | <ul> |
364 | 364 | <li> |
365 | - <a title="<?php esc_attr_e( 'View All Donations', 'give' ); ?>" href="<?php echo admin_url( 'edit.php?post_type=give_forms&page=give-payment-history&user=' . urlencode( $customer->email ) ); ?>"> |
|
365 | + <a title="<?php esc_attr_e('View All Donations', 'give'); ?>" href="<?php echo admin_url('edit.php?post_type=give_forms&page=give-payment-history&user='.urlencode($customer->email)); ?>"> |
|
366 | 366 | <span class="dashicons dashicons-heart"></span> |
367 | 367 | <?php |
368 | 368 | //Completed Donations |
369 | - $completed_donations_text = sprintf( _n( '%d Completed Donation', '%d Completed Donations', $customer->purchase_count, 'give' ), $customer->purchase_count ); |
|
370 | - echo apply_filters( 'give_donor_completed_donations', $completed_donations_text, $customer ); |
|
369 | + $completed_donations_text = sprintf(_n('%d Completed Donation', '%d Completed Donations', $customer->purchase_count, 'give'), $customer->purchase_count); |
|
370 | + echo apply_filters('give_donor_completed_donations', $completed_donations_text, $customer); |
|
371 | 371 | ?> |
372 | 372 | </a> |
373 | 373 | </li> |
374 | 374 | <li> |
375 | 375 | <span class="dashicons dashicons-chart-area"></span> |
376 | - <?php echo give_currency_filter( give_format_amount( $customer->purchase_value ) ); ?> <?php esc_html_e( 'Lifetime Donations', 'give' ); ?> |
|
376 | + <?php echo give_currency_filter(give_format_amount($customer->purchase_value)); ?> <?php esc_html_e('Lifetime Donations', 'give'); ?> |
|
377 | 377 | </li> |
378 | - <?php do_action( 'give_donor_stats_list', $customer ); ?> |
|
378 | + <?php do_action('give_donor_stats_list', $customer); ?> |
|
379 | 379 | </ul> |
380 | 380 | </div> |
381 | 381 | |
382 | - <?php do_action( 'give_donor_before_tables_wrapper', $customer ); ?> |
|
382 | + <?php do_action('give_donor_before_tables_wrapper', $customer); ?> |
|
383 | 383 | |
384 | 384 | <div id="customer-tables-wrapper" class="customer-section"> |
385 | 385 | |
386 | - <?php do_action( 'give_donor_before_tables', $customer ); ?> |
|
386 | + <?php do_action('give_donor_before_tables', $customer); ?> |
|
387 | 387 | |
388 | - <h3><?php esc_html_e( 'Recent Donations', 'give' ); ?></h3> |
|
388 | + <h3><?php esc_html_e('Recent Donations', 'give'); ?></h3> |
|
389 | 389 | <?php |
390 | - $payment_ids = explode( ',', $customer->payment_ids ); |
|
391 | - $payments = give_get_payments( array( 'post__in' => $payment_ids ) ); |
|
392 | - $payments = array_slice( $payments, 0, 10 ); |
|
390 | + $payment_ids = explode(',', $customer->payment_ids); |
|
391 | + $payments = give_get_payments(array('post__in' => $payment_ids)); |
|
392 | + $payments = array_slice($payments, 0, 10); |
|
393 | 393 | ?> |
394 | 394 | <table class="wp-list-table widefat striped payments"> |
395 | 395 | <thead> |
396 | 396 | <tr> |
397 | - <th><?php esc_html_e( 'ID', 'give' ); ?></th> |
|
398 | - <th><?php esc_html_e( 'Amount', 'give' ); ?></th> |
|
399 | - <th><?php esc_html_e( 'Date', 'give' ); ?></th> |
|
400 | - <th><?php esc_html_e( 'Status', 'give' ); ?></th> |
|
401 | - <th><?php esc_html_e( 'Actions', 'give' ); ?></th> |
|
397 | + <th><?php esc_html_e('ID', 'give'); ?></th> |
|
398 | + <th><?php esc_html_e('Amount', 'give'); ?></th> |
|
399 | + <th><?php esc_html_e('Date', 'give'); ?></th> |
|
400 | + <th><?php esc_html_e('Status', 'give'); ?></th> |
|
401 | + <th><?php esc_html_e('Actions', 'give'); ?></th> |
|
402 | 402 | </tr> |
403 | 403 | </thead> |
404 | 404 | <tbody> |
405 | - <?php if ( ! empty( $payments ) ) : ?> |
|
406 | - <?php foreach ( $payments as $payment ) : ?> |
|
405 | + <?php if ( ! empty($payments)) : ?> |
|
406 | + <?php foreach ($payments as $payment) : ?> |
|
407 | 407 | <tr> |
408 | 408 | <td><?php echo $payment->ID; ?></td> |
409 | - <td><?php echo give_payment_amount( $payment->ID ); ?></td> |
|
410 | - <td><?php echo date_i18n( get_option( 'date_format' ), strtotime( $payment->post_date ) ); ?></td> |
|
411 | - <td><?php echo give_get_payment_status( $payment, true ); ?></td> |
|
409 | + <td><?php echo give_payment_amount($payment->ID); ?></td> |
|
410 | + <td><?php echo date_i18n(get_option('date_format'), strtotime($payment->post_date)); ?></td> |
|
411 | + <td><?php echo give_get_payment_status($payment, true); ?></td> |
|
412 | 412 | <td> |
413 | - <a title="<?php esc_attr_e( 'View Details for Donation', 'give' ); |
|
414 | - echo ' ' . $payment->ID; ?>" href="<?php echo admin_url( 'edit.php?post_type=give_forms&page=give-payment-history&view=view-order-details&id=' . $payment->ID ); ?>"> |
|
415 | - <?php esc_html_e( 'View Details', 'give' ); ?> |
|
413 | + <a title="<?php esc_attr_e('View Details for Donation', 'give'); |
|
414 | + echo ' '.$payment->ID; ?>" href="<?php echo admin_url('edit.php?post_type=give_forms&page=give-payment-history&view=view-order-details&id='.$payment->ID); ?>"> |
|
415 | + <?php esc_html_e('View Details', 'give'); ?> |
|
416 | 416 | </a> |
417 | - <?php do_action( 'give_donor_recent_purchases_actions', $customer, $payment ); ?> |
|
417 | + <?php do_action('give_donor_recent_purchases_actions', $customer, $payment); ?> |
|
418 | 418 | </td> |
419 | 419 | </tr> |
420 | 420 | <?php endforeach; ?> |
421 | 421 | <?php else: ?> |
422 | 422 | <tr> |
423 | - <td colspan="5"><?php esc_html_e( 'No Donations Found', 'give' ); ?></td> |
|
423 | + <td colspan="5"><?php esc_html_e('No Donations Found', 'give'); ?></td> |
|
424 | 424 | </tr> |
425 | 425 | <?php endif; ?> |
426 | 426 | </tbody> |
427 | 427 | </table> |
428 | 428 | |
429 | - <h3><?php esc_html_e( 'Completed Donations', 'give' ); ?></h3> |
|
429 | + <h3><?php esc_html_e('Completed Donations', 'give'); ?></h3> |
|
430 | 430 | <?php |
431 | - $donations = give_get_users_completed_donations( $customer->email ); |
|
431 | + $donations = give_get_users_completed_donations($customer->email); |
|
432 | 432 | ?> |
433 | 433 | <table class="wp-list-table widefat striped donations"> |
434 | 434 | <thead> |
435 | 435 | <tr> |
436 | 436 | <th><?php echo give_get_forms_label_singular(); ?></th> |
437 | - <th width="120px"><?php esc_html_e( 'Actions', 'give' ); ?></th> |
|
437 | + <th width="120px"><?php esc_html_e('Actions', 'give'); ?></th> |
|
438 | 438 | </tr> |
439 | 439 | </thead> |
440 | 440 | <tbody> |
441 | - <?php if ( ! empty( $donations ) ) : ?> |
|
442 | - <?php foreach ( $donations as $donation ) : ?> |
|
441 | + <?php if ( ! empty($donations)) : ?> |
|
442 | + <?php foreach ($donations as $donation) : ?> |
|
443 | 443 | <tr> |
444 | 444 | <td><?php echo $donation->post_title; ?></td> |
445 | 445 | <td> |
446 | 446 | <a title="<?php |
447 | 447 | printf( |
448 | 448 | /* translators: %s: post title */ |
449 | - esc_attr__( 'View %s', 'give' ), |
|
449 | + esc_attr__('View %s', 'give'), |
|
450 | 450 | $donation->post_title |
451 | - ); ?>" href="<?php echo esc_url( admin_url( 'post.php?action=edit&post=' . $donation->ID ) ); |
|
451 | + ); ?>" href="<?php echo esc_url(admin_url('post.php?action=edit&post='.$donation->ID)); |
|
452 | 452 | ?>"> |
453 | 453 | <?php |
454 | 454 | printf( |
455 | 455 | /* translators: %s: forms singular label */ |
456 | - esc_html__( 'View %s', 'give' ), |
|
456 | + esc_html__('View %s', 'give'), |
|
457 | 457 | give_get_forms_label_singular() |
458 | 458 | ); |
459 | 459 | ?> |
@@ -463,17 +463,17 @@ discard block |
||
463 | 463 | <?php endforeach; ?> |
464 | 464 | <?php else: ?> |
465 | 465 | <tr> |
466 | - <td colspan="2"><?php esc_html_e( 'No Completed Donations Found', 'give' ); ?></td> |
|
466 | + <td colspan="2"><?php esc_html_e('No Completed Donations Found', 'give'); ?></td> |
|
467 | 467 | </tr> |
468 | 468 | <?php endif; ?> |
469 | 469 | </tbody> |
470 | 470 | </table> |
471 | 471 | |
472 | - <?php do_action( 'give_donor_after_tables', $customer ); ?> |
|
472 | + <?php do_action('give_donor_after_tables', $customer); ?> |
|
473 | 473 | |
474 | 474 | </div> |
475 | 475 | |
476 | - <?php do_action( 'give_donor_card_bottom', $customer ); ?> |
|
476 | + <?php do_action('give_donor_card_bottom', $customer); ?> |
|
477 | 477 | |
478 | 478 | <?php |
479 | 479 | } |
@@ -487,30 +487,30 @@ discard block |
||
487 | 487 | * |
488 | 488 | * @return void |
489 | 489 | */ |
490 | -function give_customer_notes_view( $customer ) { |
|
490 | +function give_customer_notes_view($customer) { |
|
491 | 491 | |
492 | - $paged = isset( $_GET['paged'] ) && is_numeric( $_GET['paged'] ) ? $_GET['paged'] : 1; |
|
493 | - $paged = absint( $paged ); |
|
492 | + $paged = isset($_GET['paged']) && is_numeric($_GET['paged']) ? $_GET['paged'] : 1; |
|
493 | + $paged = absint($paged); |
|
494 | 494 | $note_count = $customer->get_notes_count(); |
495 | - $per_page = apply_filters( 'give_customer_notes_per_page', 20 ); |
|
496 | - $total_pages = ceil( $note_count / $per_page ); |
|
497 | - $customer_notes = $customer->get_notes( $per_page, $paged ); |
|
495 | + $per_page = apply_filters('give_customer_notes_per_page', 20); |
|
496 | + $total_pages = ceil($note_count / $per_page); |
|
497 | + $customer_notes = $customer->get_notes($per_page, $paged); |
|
498 | 498 | ?> |
499 | 499 | |
500 | 500 | <div id="customer-notes-wrapper"> |
501 | 501 | <div class="customer-notes-header"> |
502 | - <?php echo get_avatar( $customer->email, 30 ); ?> <span><?php echo $customer->name; ?></span> |
|
502 | + <?php echo get_avatar($customer->email, 30); ?> <span><?php echo $customer->name; ?></span> |
|
503 | 503 | </div> |
504 | - <h3><?php esc_html_e( 'Notes', 'give' ); ?></h3> |
|
504 | + <h3><?php esc_html_e('Notes', 'give'); ?></h3> |
|
505 | 505 | |
506 | - <?php if ( 1 == $paged ) : ?> |
|
506 | + <?php if (1 == $paged) : ?> |
|
507 | 507 | <div style="display: block; margin-bottom: 55px;"> |
508 | - <form id="give-add-customer-note" method="post" action="<?php echo admin_url( 'edit.php?post_type=give_forms&page=give-donors&view=notes&id=' . $customer->id ); ?>"> |
|
508 | + <form id="give-add-customer-note" method="post" action="<?php echo admin_url('edit.php?post_type=give_forms&page=give-donors&view=notes&id='.$customer->id); ?>"> |
|
509 | 509 | <textarea id="customer-note" name="customer_note" class="customer-note-input" rows="10"></textarea> |
510 | 510 | <br /> |
511 | 511 | <input type="hidden" id="customer-id" name="customer_id" value="<?php echo $customer->id; ?>" /> |
512 | 512 | <input type="hidden" name="give_action" value="add-customer-note" /> |
513 | - <?php wp_nonce_field( 'add-customer-note', 'add_customer_note_nonce', true, true ); ?> |
|
513 | + <?php wp_nonce_field('add-customer-note', 'add_customer_note_nonce', true, true); ?> |
|
514 | 514 | <input id="add-customer-note" class="right button-primary" type="submit" value="Add Note" /> |
515 | 515 | </form> |
516 | 516 | </div> |
@@ -525,46 +525,46 @@ discard block |
||
525 | 525 | 'show_all' => true |
526 | 526 | ); |
527 | 527 | |
528 | - echo paginate_links( $pagination_args ); |
|
528 | + echo paginate_links($pagination_args); |
|
529 | 529 | ?> |
530 | 530 | |
531 | 531 | <div id="give-customer-notes" class="postbox"> |
532 | - <?php if ( count( $customer_notes ) > 0 ) : ?> |
|
533 | - <?php foreach ( $customer_notes as $key => $note ) : ?> |
|
532 | + <?php if (count($customer_notes) > 0) : ?> |
|
533 | + <?php foreach ($customer_notes as $key => $note) : ?> |
|
534 | 534 | <div class="customer-note-wrapper dashboard-comment-wrap comment-item"> |
535 | 535 | <span class="note-content-wrap"> |
536 | - <?php echo stripslashes( $note ); ?> |
|
536 | + <?php echo stripslashes($note); ?> |
|
537 | 537 | </span> |
538 | 538 | </div> |
539 | 539 | <?php endforeach; ?> |
540 | 540 | <?php else: ?> |
541 | 541 | <div class="give-no-customer-notes"> |
542 | - <?php esc_html_e( 'No Donor Notes', 'give' ); ?> |
|
542 | + <?php esc_html_e('No Donor Notes', 'give'); ?> |
|
543 | 543 | </div> |
544 | 544 | <?php endif; ?> |
545 | 545 | </div> |
546 | 546 | |
547 | - <?php echo paginate_links( $pagination_args ); ?> |
|
547 | + <?php echo paginate_links($pagination_args); ?> |
|
548 | 548 | |
549 | 549 | </div> |
550 | 550 | |
551 | 551 | <?php |
552 | 552 | } |
553 | 553 | |
554 | -function give_customers_delete_view( $customer ) { |
|
554 | +function give_customers_delete_view($customer) { |
|
555 | 555 | |
556 | - $customer_edit_role = apply_filters( 'give_edit_customers_role', 'edit_give_payments' ); |
|
556 | + $customer_edit_role = apply_filters('give_edit_customers_role', 'edit_give_payments'); |
|
557 | 557 | |
558 | 558 | ?> |
559 | 559 | |
560 | - <?php do_action( 'give_customer_delete_top', $customer ); ?> |
|
560 | + <?php do_action('give_customer_delete_top', $customer); ?> |
|
561 | 561 | |
562 | 562 | <div class="info-wrapper customer-section"> |
563 | 563 | |
564 | - <form id="delete-customer" method="post" action="<?php echo admin_url( 'edit.php?post_type=give_forms&page=give-donors&view=delete&id=' . $customer->id ); ?>"> |
|
564 | + <form id="delete-customer" method="post" action="<?php echo admin_url('edit.php?post_type=give_forms&page=give-donors&view=delete&id='.$customer->id); ?>"> |
|
565 | 565 | |
566 | 566 | <div class="customer-notes-header"> |
567 | - <?php echo get_avatar( $customer->email, 30 ); ?> <span><?php echo $customer->name; ?></span> |
|
567 | + <?php echo get_avatar($customer->email, 30); ?> <span><?php echo $customer->name; ?></span> |
|
568 | 568 | </div> |
569 | 569 | |
570 | 570 | |
@@ -572,27 +572,27 @@ discard block |
||
572 | 572 | |
573 | 573 | <span class="delete-customer-options"> |
574 | 574 | <p> |
575 | - <?php echo Give()->html->checkbox( array( 'name' => 'give-customer-delete-confirm' ) ); ?> |
|
576 | - <label for="give-customer-delete-confirm"><?php esc_html_e( 'Are you sure you want to delete this donor?', 'give' ); ?></label> |
|
575 | + <?php echo Give()->html->checkbox(array('name' => 'give-customer-delete-confirm')); ?> |
|
576 | + <label for="give-customer-delete-confirm"><?php esc_html_e('Are you sure you want to delete this donor?', 'give'); ?></label> |
|
577 | 577 | </p> |
578 | 578 | |
579 | 579 | <p> |
580 | - <?php echo Give()->html->checkbox( array( |
|
580 | + <?php echo Give()->html->checkbox(array( |
|
581 | 581 | 'name' => 'give-customer-delete-records', |
582 | - 'options' => array( 'disabled' => true ) |
|
583 | - ) ); ?> |
|
584 | - <label for="give-customer-delete-records"><?php esc_html_e( 'Delete all associated payments and records?', 'give' ); ?></label> |
|
582 | + 'options' => array('disabled' => true) |
|
583 | + )); ?> |
|
584 | + <label for="give-customer-delete-records"><?php esc_html_e('Delete all associated payments and records?', 'give'); ?></label> |
|
585 | 585 | </p> |
586 | 586 | |
587 | - <?php do_action( 'give_customer_delete_inputs', $customer ); ?> |
|
587 | + <?php do_action('give_customer_delete_inputs', $customer); ?> |
|
588 | 588 | </span> |
589 | 589 | |
590 | 590 | <span id="customer-edit-actions"> |
591 | 591 | <input type="hidden" name="customer_id" value="<?php echo $customer->id; ?>" /> |
592 | - <?php wp_nonce_field( 'delete-customer', '_wpnonce', false, true ); ?> |
|
592 | + <?php wp_nonce_field('delete-customer', '_wpnonce', false, true); ?> |
|
593 | 593 | <input type="hidden" name="give_action" value="delete-customer" /> |
594 | - <input type="submit" disabled="disabled" id="give-delete-customer" class="button-primary" value="<?php esc_attr_e( 'Delete Donor', 'give' ); ?>" /> |
|
595 | - <a id="give-delete-customer-cancel" href="<?php echo admin_url( 'edit.php?post_type=give_forms&page=give-donors&view=overview&id=' . $customer->id ); ?>" class="delete"><?php esc_html_e( 'Cancel', 'give' ); ?></a> |
|
594 | + <input type="submit" disabled="disabled" id="give-delete-customer" class="button-primary" value="<?php esc_attr_e('Delete Donor', 'give'); ?>" /> |
|
595 | + <a id="give-delete-customer-cancel" href="<?php echo admin_url('edit.php?post_type=give_forms&page=give-donors&view=overview&id='.$customer->id); ?>" class="delete"><?php esc_html_e('Cancel', 'give'); ?></a> |
|
596 | 596 | </span> |
597 | 597 | |
598 | 598 | </div> |
@@ -602,5 +602,5 @@ discard block |
||
602 | 602 | |
603 | 603 | <?php |
604 | 604 | |
605 | - do_action( 'give_customer_delete_bottom', $customer ); |
|
605 | + do_action('give_customer_delete_bottom', $customer); |
|
606 | 606 | } |
@@ -64,11 +64,14 @@ |
||
64 | 64 | }, 250 ); |
65 | 65 | </script> |
66 | 66 | |
67 | - <?php else : ?> |
|
67 | + <?php else { |
|
68 | + : ?> |
|
68 | 69 | |
69 | 70 | <div id="give-upgrade-status"> |
70 | 71 | <p style="font-size: 20px;max-width: 900px;"> |
71 | - <?php esc_html_e( 'The upgrade process has started, please be patient and do not close this window or navigate away from this page. This could take several minutes depending on the upgrade and the size of your website. You will be automatically redirected when the upgrade is finished.', 'give' ); ?> |
|
72 | + <?php esc_html_e( 'The upgrade process has started, please be patient and do not close this window or navigate away from this page. This could take several minutes depending on the upgrade and the size of your website. You will be automatically redirected when the upgrade is finished.', 'give' ); |
|
73 | +} |
|
74 | +?> |
|
72 | 75 | <img src="<?php echo GIVE_PLUGIN_URL . '/assets/images/spinner.gif'; ?>" id="give-upgrade-loader" style=" position: relative; top: 3px; left: 6px;" /> |
73 | 76 | </p> |
74 | 77 | </div> |
@@ -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 | |
@@ -21,12 +21,12 @@ discard block |
||
21 | 21 | * @return void |
22 | 22 | */ |
23 | 23 | function give_upgrades_screen() { |
24 | - $action = isset( $_GET['give-upgrade'] ) ? sanitize_text_field( $_GET['give-upgrade'] ) : ''; |
|
25 | - $step = isset( $_GET['step'] ) ? absint( $_GET['step'] ) : 1; |
|
26 | - $total = isset( $_GET['total'] ) ? absint( $_GET['total'] ) : false; |
|
27 | - $custom = isset( $_GET['custom'] ) ? absint( $_GET['custom'] ) : 0; |
|
28 | - $number = isset( $_GET['number'] ) ? absint( $_GET['number'] ) : 100; |
|
29 | - $steps = round( ( $total / $number ), 0 ); |
|
24 | + $action = isset($_GET['give-upgrade']) ? sanitize_text_field($_GET['give-upgrade']) : ''; |
|
25 | + $step = isset($_GET['step']) ? absint($_GET['step']) : 1; |
|
26 | + $total = isset($_GET['total']) ? absint($_GET['total']) : false; |
|
27 | + $custom = isset($_GET['custom']) ? absint($_GET['custom']) : 0; |
|
28 | + $number = isset($_GET['number']) ? absint($_GET['number']) : 100; |
|
29 | + $steps = round(($total / $number), 0); |
|
30 | 30 | |
31 | 31 | $doing_upgrade_args = array( |
32 | 32 | 'page' => 'give-upgrades', |
@@ -36,25 +36,25 @@ discard block |
||
36 | 36 | 'custom' => $custom, |
37 | 37 | 'steps' => $steps |
38 | 38 | ); |
39 | - update_option( 'give_doing_upgrade', $doing_upgrade_args ); |
|
40 | - if ( $step > $steps ) { |
|
39 | + update_option('give_doing_upgrade', $doing_upgrade_args); |
|
40 | + if ($step > $steps) { |
|
41 | 41 | // Prevent a weird case where the estimate was off. Usually only a couple. |
42 | 42 | $steps = $step; |
43 | 43 | } |
44 | 44 | ?> |
45 | 45 | <div class="wrap"> |
46 | - <h2><?php esc_html_e( 'Give - Upgrades', 'give' ); ?></h2> |
|
46 | + <h2><?php esc_html_e('Give - Upgrades', 'give'); ?></h2> |
|
47 | 47 | |
48 | - <?php if ( ! empty( $action ) ) : ?> |
|
48 | + <?php if ( ! empty($action)) : ?> |
|
49 | 49 | |
50 | 50 | <div id="give-upgrade-status"> |
51 | - <p style="font-size: 20px;max-width: 900px;"><?php esc_html_e( 'The upgrade process has started, please be patient and do not close this window or navigate away from this page. This could take several minutes depending on the upgrade and the size of your website. You will be automatically redirected when the upgrade is finished.', 'give' ); ?> |
|
52 | - <img src="<?php echo GIVE_PLUGIN_URL . '/assets/images/spinner.gif'; ?>" id="give-upgrade-loader" style=" position: relative; top: 3px; left: 6px;" /> |
|
51 | + <p style="font-size: 20px;max-width: 900px;"><?php esc_html_e('The upgrade process has started, please be patient and do not close this window or navigate away from this page. This could take several minutes depending on the upgrade and the size of your website. You will be automatically redirected when the upgrade is finished.', 'give'); ?> |
|
52 | + <img src="<?php echo GIVE_PLUGIN_URL.'/assets/images/spinner.gif'; ?>" id="give-upgrade-loader" style=" position: relative; top: 3px; left: 6px;" /> |
|
53 | 53 | </p> |
54 | 54 | |
55 | - <?php if ( ! empty( $total ) ) : ?> |
|
55 | + <?php if ( ! empty($total)) : ?> |
|
56 | 56 | <p> |
57 | - <strong><?php printf( esc_html__( 'Step %d of approximately %d running', 'give' ), $step, $steps ); ?></strong> |
|
57 | + <strong><?php printf(esc_html__('Step %d of approximately %d running', 'give'), $step, $steps); ?></strong> |
|
58 | 58 | </p> |
59 | 59 | <?php endif; ?> |
60 | 60 | </div> |
@@ -68,8 +68,8 @@ discard block |
||
68 | 68 | |
69 | 69 | <div id="give-upgrade-status"> |
70 | 70 | <p style="font-size: 20px;max-width: 900px;"> |
71 | - <?php esc_html_e( 'The upgrade process has started, please be patient and do not close this window or navigate away from this page. This could take several minutes depending on the upgrade and the size of your website. You will be automatically redirected when the upgrade is finished.', 'give' ); ?> |
|
72 | - <img src="<?php echo GIVE_PLUGIN_URL . '/assets/images/spinner.gif'; ?>" id="give-upgrade-loader" style=" position: relative; top: 3px; left: 6px;" /> |
|
71 | + <?php esc_html_e('The upgrade process has started, please be patient and do not close this window or navigate away from this page. This could take several minutes depending on the upgrade and the size of your website. You will be automatically redirected when the upgrade is finished.', 'give'); ?> |
|
72 | + <img src="<?php echo GIVE_PLUGIN_URL.'/assets/images/spinner.gif'; ?>" id="give-upgrade-loader" style=" position: relative; top: 3px; left: 6px;" /> |
|
73 | 73 | </p> |
74 | 74 | </div> |
75 | 75 | <script type="text/javascript"> |
@@ -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 | |
@@ -21,14 +21,14 @@ discard block |
||
21 | 21 | * |
22 | 22 | * @param $data |
23 | 23 | */ |
24 | -function give_process_gateway_select( $data ) { |
|
25 | - if ( isset( $_POST['gateway_submit'] ) ) { |
|
26 | - wp_redirect( esc_url( add_query_arg( 'payment-mode', $_POST['payment-mode'] ) ) ); |
|
24 | +function give_process_gateway_select($data) { |
|
25 | + if (isset($_POST['gateway_submit'])) { |
|
26 | + wp_redirect(esc_url(add_query_arg('payment-mode', $_POST['payment-mode']))); |
|
27 | 27 | exit; |
28 | 28 | } |
29 | 29 | } |
30 | 30 | |
31 | -add_action( 'give_gateway_select', 'give_process_gateway_select' ); |
|
31 | +add_action('give_gateway_select', 'give_process_gateway_select'); |
|
32 | 32 | |
33 | 33 | /** |
34 | 34 | * Loads a payment gateway via AJAX |
@@ -37,14 +37,14 @@ discard block |
||
37 | 37 | * @return void |
38 | 38 | */ |
39 | 39 | function give_load_ajax_gateway() { |
40 | - if ( isset( $_POST['give_payment_mode'] ) ) { |
|
41 | - do_action( 'give_purchase_form', $_POST['give_form_id'] ); |
|
40 | + if (isset($_POST['give_payment_mode'])) { |
|
41 | + do_action('give_purchase_form', $_POST['give_form_id']); |
|
42 | 42 | exit(); |
43 | 43 | } |
44 | 44 | } |
45 | 45 | |
46 | -add_action( 'wp_ajax_give_load_gateway', 'give_load_ajax_gateway' ); |
|
47 | -add_action( 'wp_ajax_nopriv_give_load_gateway', 'give_load_ajax_gateway' ); |
|
46 | +add_action('wp_ajax_give_load_gateway', 'give_load_ajax_gateway'); |
|
47 | +add_action('wp_ajax_nopriv_give_load_gateway', 'give_load_ajax_gateway'); |
|
48 | 48 | |
49 | 49 | /** |
50 | 50 | * Sets an error on checkout if no gateways are enabled |
@@ -55,11 +55,11 @@ discard block |
||
55 | 55 | function give_no_gateway_error() { |
56 | 56 | $gateways = give_get_enabled_payment_gateways(); |
57 | 57 | |
58 | - if ( empty( $gateways ) ) { |
|
59 | - give_set_error( 'no_gateways', esc_html__( 'You must enable a payment gateway to use Give.', 'give' ) ); |
|
58 | + if (empty($gateways)) { |
|
59 | + give_set_error('no_gateways', esc_html__('You must enable a payment gateway to use Give.', 'give')); |
|
60 | 60 | } else { |
61 | - give_unset_error( 'no_gateways' ); |
|
61 | + give_unset_error('no_gateways'); |
|
62 | 62 | } |
63 | 63 | } |
64 | 64 | |
65 | -add_action( 'init', 'give_no_gateway_error' ); |
|
66 | 65 | \ No newline at end of file |
66 | +add_action('init', 'give_no_gateway_error'); |
|
67 | 67 | \ No newline at end of file |
@@ -9,7 +9,7 @@ discard block |
||
9 | 9 | * @since 1.3.0 |
10 | 10 | */ |
11 | 11 | |
12 | -defined( 'ABSPATH' ) or exit; |
|
12 | +defined('ABSPATH') or exit; |
|
13 | 13 | |
14 | 14 | /** |
15 | 15 | * Class Give_Shortcode_Donation_Form |
@@ -21,10 +21,10 @@ discard block |
||
21 | 21 | */ |
22 | 22 | public function __construct() { |
23 | 23 | |
24 | - $this->shortcode['title'] = esc_html__( 'Donation Form', 'give' ); |
|
25 | - $this->shortcode['label'] = esc_html__( 'Donation Form', 'give' ); |
|
24 | + $this->shortcode['title'] = esc_html__('Donation Form', 'give'); |
|
25 | + $this->shortcode['label'] = esc_html__('Donation Form', 'give'); |
|
26 | 26 | |
27 | - parent::__construct( 'give_form' ); |
|
27 | + parent::__construct('give_form'); |
|
28 | 28 | } |
29 | 29 | |
30 | 30 | /** |
@@ -36,8 +36,8 @@ discard block |
||
36 | 36 | |
37 | 37 | $create_form_link = sprintf( |
38 | 38 | /* translators: %s: create new form URL */ |
39 | - __( '<a href="%s">Create</a> a new Donation Form.', 'give' ), |
|
40 | - admin_url( 'post-new.php?post_type=give_forms' ) |
|
39 | + __('<a href="%s">Create</a> a new Donation Form.', 'give'), |
|
40 | + admin_url('post-new.php?post_type=give_forms') |
|
41 | 41 | ); |
42 | 42 | |
43 | 43 | return array( |
@@ -47,68 +47,68 @@ discard block |
||
47 | 47 | 'post_type' => 'give_forms', |
48 | 48 | ), |
49 | 49 | 'name' => 'id', |
50 | - 'tooltip' => esc_attr__( 'Select a Donation Form', 'give' ), |
|
51 | - 'placeholder' => esc_attr__( '- Select a Form -', 'give' ), |
|
50 | + 'tooltip' => esc_attr__('Select a Donation Form', 'give'), |
|
51 | + 'placeholder' => esc_attr__('- Select a Form -', 'give'), |
|
52 | 52 | 'required' => array( |
53 | - 'alert' => esc_html__( 'You must first select a Form!', 'give' ), |
|
54 | - 'error' => sprintf( '<p class="strong">%s</p><p class="no-margin">%s</p>', esc_html__( 'No donation forms were found!', 'give' ), $create_form_link ), |
|
53 | + 'alert' => esc_html__('You must first select a Form!', 'give'), |
|
54 | + 'error' => sprintf('<p class="strong">%s</p><p class="no-margin">%s</p>', esc_html__('No donation forms were found!', 'give'), $create_form_link), |
|
55 | 55 | ), |
56 | 56 | ), |
57 | 57 | array( |
58 | 58 | 'type' => 'container', |
59 | - 'html' => sprintf( '<p class="strong margin-top">%s</p>', esc_html__( 'Optional form settings', 'give' ) ), |
|
59 | + 'html' => sprintf('<p class="strong margin-top">%s</p>', esc_html__('Optional form settings', 'give')), |
|
60 | 60 | ), |
61 | 61 | array( |
62 | 62 | 'type' => 'listbox', |
63 | 63 | 'name' => 'show_title', |
64 | - 'label' => esc_html__( 'Show Title:', 'give' ), |
|
65 | - 'tooltip' => esc_attr__( 'Do you want to display the form title?', 'give' ), |
|
64 | + 'label' => esc_html__('Show Title:', 'give'), |
|
65 | + 'tooltip' => esc_attr__('Do you want to display the form title?', 'give'), |
|
66 | 66 | 'options' => array( |
67 | - 'true' => esc_html__( 'Show', 'give' ), |
|
68 | - 'false' => esc_html__( 'Hide', 'give' ), |
|
67 | + 'true' => esc_html__('Show', 'give'), |
|
68 | + 'false' => esc_html__('Hide', 'give'), |
|
69 | 69 | ), |
70 | 70 | ), |
71 | 71 | array( |
72 | 72 | 'type' => 'listbox', |
73 | 73 | 'name' => 'show_goal', |
74 | - 'label' => esc_html__( 'Show Goal:', 'give' ), |
|
75 | - 'tooltip' => esc_attr__( 'Do you want to display the donation goal?', 'give' ), |
|
74 | + 'label' => esc_html__('Show Goal:', 'give'), |
|
75 | + 'tooltip' => esc_attr__('Do you want to display the donation goal?', 'give'), |
|
76 | 76 | 'options' => array( |
77 | - 'true' => esc_html__( 'Show', 'give' ), |
|
78 | - 'false' => esc_html__( 'Hide', 'give' ), |
|
77 | + 'true' => esc_html__('Show', 'give'), |
|
78 | + 'false' => esc_html__('Hide', 'give'), |
|
79 | 79 | ), |
80 | 80 | ), |
81 | 81 | array( |
82 | 82 | 'type' => 'listbox', |
83 | 83 | 'name' => 'show_content', |
84 | 84 | 'minWidth' => 240, |
85 | - 'label' => esc_html__( 'Display Content:', 'give' ), |
|
86 | - 'tooltip' => esc_attr__( 'Do you want to display the form content?', 'give' ), |
|
85 | + 'label' => esc_html__('Display Content:', 'give'), |
|
86 | + 'tooltip' => esc_attr__('Do you want to display the form content?', 'give'), |
|
87 | 87 | 'options' => array( |
88 | - 'none' => esc_html__( 'No Content', 'give' ), |
|
89 | - 'above' => esc_html__( 'Display above the form fields', 'give' ), |
|
90 | - 'below' => esc_html__( 'Display below the form fields', 'give' ), |
|
88 | + 'none' => esc_html__('No Content', 'give'), |
|
89 | + 'above' => esc_html__('Display above the form fields', 'give'), |
|
90 | + 'below' => esc_html__('Display below the form fields', 'give'), |
|
91 | 91 | ), |
92 | 92 | ), |
93 | 93 | array( |
94 | 94 | 'type' => 'listbox', |
95 | 95 | 'name' => 'display_style', |
96 | - 'label' => esc_html__( 'Payment Fields:', 'give' ), |
|
97 | - 'tooltip' => esc_attr__( 'How would you like to display payment information?', 'give' ), |
|
96 | + 'label' => esc_html__('Payment Fields:', 'give'), |
|
97 | + 'tooltip' => esc_attr__('How would you like to display payment information?', 'give'), |
|
98 | 98 | 'options' => array( |
99 | - 'onpage' => esc_html__( 'Show on Page', 'give' ), |
|
100 | - 'reveal' => esc_html__( 'Reveal Upon Click', 'give' ), |
|
101 | - 'modal' => esc_html__( 'Modal Window Upon Click', 'give' ), |
|
99 | + 'onpage' => esc_html__('Show on Page', 'give'), |
|
100 | + 'reveal' => esc_html__('Reveal Upon Click', 'give'), |
|
101 | + 'modal' => esc_html__('Modal Window Upon Click', 'give'), |
|
102 | 102 | ), |
103 | 103 | ), |
104 | 104 | array( |
105 | 105 | 'type' => 'listbox', |
106 | 106 | 'name' => 'float_labels', |
107 | - 'label' => esc_html__( 'Floating Labels:', 'give' ), |
|
108 | - 'tooltip' => esc_attr__( 'Override the default floating labels setting for this form?', 'give' ), |
|
107 | + 'label' => esc_html__('Floating Labels:', 'give'), |
|
108 | + 'tooltip' => esc_attr__('Override the default floating labels setting for this form?', 'give'), |
|
109 | 109 | 'options' => array( |
110 | - 'enabled' => esc_html__( 'Enabled', 'give' ), |
|
111 | - 'disabled' => esc_html__( 'Disabled', 'give' ), |
|
110 | + 'enabled' => esc_html__('Enabled', 'give'), |
|
111 | + 'disabled' => esc_html__('Disabled', 'give'), |
|
112 | 112 | ), |
113 | 113 | ), |
114 | 114 | ); |
@@ -9,7 +9,7 @@ discard block |
||
9 | 9 | * @since 1.3.0 |
10 | 10 | */ |
11 | 11 | |
12 | -defined( 'ABSPATH' ) or exit; |
|
12 | +defined('ABSPATH') or exit; |
|
13 | 13 | |
14 | 14 | class Give_Shortcode_Profile_Editor extends Give_Shortcode_Generator { |
15 | 15 | |
@@ -18,9 +18,9 @@ discard block |
||
18 | 18 | */ |
19 | 19 | public function __construct() { |
20 | 20 | |
21 | - $this->shortcode['label'] = esc_html__( 'Profile Editor', 'give' ); |
|
21 | + $this->shortcode['label'] = esc_html__('Profile Editor', 'give'); |
|
22 | 22 | |
23 | - parent::__construct( 'give_profile_editor' ); |
|
23 | + parent::__construct('give_profile_editor'); |
|
24 | 24 | } |
25 | 25 | } |
26 | 26 |
@@ -9,7 +9,7 @@ discard block |
||
9 | 9 | * @since 1.3.0 |
10 | 10 | */ |
11 | 11 | |
12 | -defined( 'ABSPATH' ) or exit; |
|
12 | +defined('ABSPATH') or exit; |
|
13 | 13 | |
14 | 14 | class Give_Shortcode_Donation_Receipt extends Give_Shortcode_Generator { |
15 | 15 | |
@@ -18,10 +18,10 @@ discard block |
||
18 | 18 | */ |
19 | 19 | public function __construct() { |
20 | 20 | |
21 | - $this->shortcode['title'] = esc_html__( 'Donation Receipt', 'give' ); |
|
22 | - $this->shortcode['label'] = esc_html__( 'Donation Receipt', 'give' ); |
|
21 | + $this->shortcode['title'] = esc_html__('Donation Receipt', 'give'); |
|
22 | + $this->shortcode['label'] = esc_html__('Donation Receipt', 'give'); |
|
23 | 23 | |
24 | - parent::__construct( 'give_receipt' ); |
|
24 | + parent::__construct('give_receipt'); |
|
25 | 25 | } |
26 | 26 | |
27 | 27 | /** |
@@ -34,60 +34,60 @@ discard block |
||
34 | 34 | return array( |
35 | 35 | array( |
36 | 36 | 'type' => 'container', |
37 | - 'html' => sprintf( '<p class="strong">%s</p>', esc_html__( 'Optional settings', 'give' ) ), |
|
37 | + 'html' => sprintf('<p class="strong">%s</p>', esc_html__('Optional settings', 'give')), |
|
38 | 38 | ), |
39 | 39 | array( |
40 | 40 | 'type' => 'listbox', |
41 | 41 | 'name' => 'price', |
42 | - 'label' => esc_html__( 'Show Donation Amount:', 'give' ), |
|
42 | + 'label' => esc_html__('Show Donation Amount:', 'give'), |
|
43 | 43 | 'options' => array( |
44 | - 'true' => esc_html__( 'Show', 'give' ), |
|
45 | - 'false' => esc_html__( 'Hide', 'give' ), |
|
44 | + 'true' => esc_html__('Show', 'give'), |
|
45 | + 'false' => esc_html__('Hide', 'give'), |
|
46 | 46 | ), |
47 | 47 | ), |
48 | 48 | array( |
49 | 49 | 'type' => 'listbox', |
50 | 50 | 'name' => 'donor', |
51 | - 'label' => esc_html__( 'Show Donor Name:', 'give' ), |
|
51 | + 'label' => esc_html__('Show Donor Name:', 'give'), |
|
52 | 52 | 'options' => array( |
53 | - 'true' => esc_html__( 'Show', 'give' ), |
|
54 | - 'false' => esc_html__( 'Hide', 'give' ), |
|
53 | + 'true' => esc_html__('Show', 'give'), |
|
54 | + 'false' => esc_html__('Hide', 'give'), |
|
55 | 55 | ), |
56 | 56 | ), |
57 | 57 | array( |
58 | 58 | 'type' => 'listbox', |
59 | 59 | 'name' => 'date', |
60 | - 'label' => esc_html__( 'Show Date:', 'give' ), |
|
60 | + 'label' => esc_html__('Show Date:', 'give'), |
|
61 | 61 | 'options' => array( |
62 | - 'true' => esc_html__( 'Show', 'give' ), |
|
63 | - 'false' => esc_html__( 'Hide', 'give' ), |
|
62 | + 'true' => esc_html__('Show', 'give'), |
|
63 | + 'false' => esc_html__('Hide', 'give'), |
|
64 | 64 | ), |
65 | 65 | ), |
66 | 66 | array( |
67 | 67 | 'type' => 'listbox', |
68 | 68 | 'name' => 'payment_key', |
69 | - 'label' => esc_html__( 'Show Payment Key:', 'give' ), |
|
69 | + 'label' => esc_html__('Show Payment Key:', 'give'), |
|
70 | 70 | 'options' => array( |
71 | - 'true' => esc_html__( 'Show', 'give' ), |
|
72 | - 'false' => esc_html__( 'Hide', 'give' ), |
|
71 | + 'true' => esc_html__('Show', 'give'), |
|
72 | + 'false' => esc_html__('Hide', 'give'), |
|
73 | 73 | ), |
74 | 74 | ), |
75 | 75 | array( |
76 | 76 | 'type' => 'listbox', |
77 | 77 | 'name' => 'payment_method', |
78 | - 'label' => esc_html__( 'Show Payment Method:', 'give' ), |
|
78 | + 'label' => esc_html__('Show Payment Method:', 'give'), |
|
79 | 79 | 'options' => array( |
80 | - 'true' => esc_html__( 'Show', 'give' ), |
|
81 | - 'false' => esc_html__( 'Hide', 'give' ), |
|
80 | + 'true' => esc_html__('Show', 'give'), |
|
81 | + 'false' => esc_html__('Hide', 'give'), |
|
82 | 82 | ), |
83 | 83 | ), |
84 | 84 | array( |
85 | 85 | 'type' => 'listbox', |
86 | 86 | 'name' => 'payment_id', |
87 | - 'label' => esc_html__( 'Show Payment ID:', 'give' ), |
|
87 | + 'label' => esc_html__('Show Payment ID:', 'give'), |
|
88 | 88 | 'options' => array( |
89 | - 'true' => esc_html__( 'Show', 'give' ), |
|
90 | - 'false' => esc_html__( 'Hide', 'give' ), |
|
89 | + 'true' => esc_html__('Show', 'give'), |
|
90 | + 'false' => esc_html__('Hide', 'give'), |
|
91 | 91 | ), |
92 | 92 | ), |
93 | 93 | ); |