@@ -100,12 +100,12 @@ discard block |
||
100 | 100 | * @param bool $_id |
101 | 101 | * @param array $_args |
102 | 102 | */ |
103 | - public function __construct( $_id = false, $_args = array() ) { |
|
103 | + public function __construct($_id = false, $_args = array()) { |
|
104 | 104 | |
105 | 105 | |
106 | - $donation_form = WP_Post::get_instance( $_id ); |
|
106 | + $donation_form = WP_Post::get_instance($_id); |
|
107 | 107 | |
108 | - return $this->setup_donation_form( $donation_form ); |
|
108 | + return $this->setup_donation_form($donation_form); |
|
109 | 109 | } |
110 | 110 | |
111 | 111 | /** |
@@ -117,23 +117,23 @@ discard block |
||
117 | 117 | * |
118 | 118 | * @return bool If the setup was successful or not |
119 | 119 | */ |
120 | - private function setup_donation_form( $donation_form ) { |
|
120 | + private function setup_donation_form($donation_form) { |
|
121 | 121 | |
122 | - if ( ! is_object( $donation_form ) ) { |
|
122 | + if ( ! is_object($donation_form)) { |
|
123 | 123 | return false; |
124 | 124 | } |
125 | 125 | |
126 | - if ( ! is_a( $donation_form, 'WP_Post' ) ) { |
|
126 | + if ( ! is_a($donation_form, 'WP_Post')) { |
|
127 | 127 | return false; |
128 | 128 | } |
129 | 129 | |
130 | - if ( 'give_forms' !== $donation_form->post_type ) { |
|
130 | + if ('give_forms' !== $donation_form->post_type) { |
|
131 | 131 | return false; |
132 | 132 | } |
133 | 133 | |
134 | - foreach ( $donation_form as $key => $value ) { |
|
134 | + foreach ($donation_form as $key => $value) { |
|
135 | 135 | |
136 | - switch ( $key ) { |
|
136 | + switch ($key) { |
|
137 | 137 | |
138 | 138 | default: |
139 | 139 | $this->$key = $value; |
@@ -157,15 +157,15 @@ discard block |
||
157 | 157 | * @return mixed |
158 | 158 | * @throws Exception |
159 | 159 | */ |
160 | - public function __get( $key ) { |
|
160 | + public function __get($key) { |
|
161 | 161 | |
162 | - if ( method_exists( $this, 'get_' . $key ) ) { |
|
162 | + if (method_exists($this, 'get_'.$key)) { |
|
163 | 163 | |
164 | - return call_user_func( array( $this, 'get_' . $key ) ); |
|
164 | + return call_user_func(array($this, 'get_'.$key)); |
|
165 | 165 | |
166 | 166 | } else { |
167 | 167 | |
168 | - return new WP_Error( 'give-form-invalid-property', sprintf( __( 'Can\'t get property %s', 'give' ), $key ) ); |
|
168 | + return new WP_Error('give-form-invalid-property', sprintf(__('Can\'t get property %s', 'give'), $key)); |
|
169 | 169 | |
170 | 170 | } |
171 | 171 | |
@@ -181,30 +181,30 @@ discard block |
||
181 | 181 | * |
182 | 182 | * @return mixed false if data isn't passed and class not instantiated for creation, or New Form ID |
183 | 183 | */ |
184 | - public function create( $data = array() ) { |
|
184 | + public function create($data = array()) { |
|
185 | 185 | |
186 | - if ( $this->id != 0 ) { |
|
186 | + if ($this->id != 0) { |
|
187 | 187 | return false; |
188 | 188 | } |
189 | 189 | |
190 | 190 | $defaults = array( |
191 | 191 | 'post_type' => 'give_forms', |
192 | 192 | 'post_status' => 'draft', |
193 | - 'post_title' => __( 'New Donation Form', 'give' ) |
|
193 | + 'post_title' => __('New Donation Form', 'give') |
|
194 | 194 | ); |
195 | 195 | |
196 | - $args = wp_parse_args( $data, $defaults ); |
|
196 | + $args = wp_parse_args($data, $defaults); |
|
197 | 197 | |
198 | 198 | /** |
199 | 199 | * Fired before a donation form is created |
200 | 200 | * |
201 | 201 | * @param array $args The post object arguments used for creation. |
202 | 202 | */ |
203 | - do_action( 'give_form_pre_create', $args ); |
|
203 | + do_action('give_form_pre_create', $args); |
|
204 | 204 | |
205 | - $id = wp_insert_post( $args, true ); |
|
205 | + $id = wp_insert_post($args, true); |
|
206 | 206 | |
207 | - $donation_form = WP_Post::get_instance( $id ); |
|
207 | + $donation_form = WP_Post::get_instance($id); |
|
208 | 208 | |
209 | 209 | /** |
210 | 210 | * Fired after a donation form is created |
@@ -212,9 +212,9 @@ discard block |
||
212 | 212 | * @param int $id The post ID of the created item. |
213 | 213 | * @param array $args The post object arguments used for creation. |
214 | 214 | */ |
215 | - do_action( 'give_form_post_create', $id, $args ); |
|
215 | + do_action('give_form_post_create', $id, $args); |
|
216 | 216 | |
217 | - return $this->setup_donation_form( $donation_form ); |
|
217 | + return $this->setup_donation_form($donation_form); |
|
218 | 218 | |
219 | 219 | } |
220 | 220 | |
@@ -237,7 +237,7 @@ discard block |
||
237 | 237 | * @return string Name of the donation form |
238 | 238 | */ |
239 | 239 | public function get_name() { |
240 | - return get_the_title( $this->ID ); |
|
240 | + return get_the_title($this->ID); |
|
241 | 241 | } |
242 | 242 | |
243 | 243 | /** |
@@ -248,13 +248,13 @@ discard block |
||
248 | 248 | */ |
249 | 249 | public function get_price() { |
250 | 250 | |
251 | - if ( ! isset( $this->price ) ) { |
|
251 | + if ( ! isset($this->price)) { |
|
252 | 252 | |
253 | - $this->price = get_post_meta( $this->ID, '_give_set_price', true ); |
|
253 | + $this->price = get_post_meta($this->ID, '_give_set_price', true); |
|
254 | 254 | |
255 | - if ( $this->price ) { |
|
255 | + if ($this->price) { |
|
256 | 256 | |
257 | - $this->price = give_sanitize_amount( $this->price ); |
|
257 | + $this->price = give_sanitize_amount($this->price); |
|
258 | 258 | |
259 | 259 | } else { |
260 | 260 | |
@@ -272,7 +272,7 @@ discard block |
||
272 | 272 | * @param string $price The donation form price. |
273 | 273 | * @param string|int $id The form ID. |
274 | 274 | */ |
275 | - return apply_filters( 'give_get_set_price', $this->price, $this->ID ); |
|
275 | + return apply_filters('give_get_set_price', $this->price, $this->ID); |
|
276 | 276 | } |
277 | 277 | |
278 | 278 | /** |
@@ -283,14 +283,14 @@ discard block |
||
283 | 283 | */ |
284 | 284 | public function get_minimum_price() { |
285 | 285 | |
286 | - if ( ! isset( $this->minimum_price ) ) { |
|
286 | + if ( ! isset($this->minimum_price)) { |
|
287 | 287 | |
288 | - $allow_custom_amount = get_post_meta( $this->ID, '_give_custom_amount', true ); |
|
289 | - $this->minimum_price = get_post_meta( $this->ID, '_give_custom_amount_minimum', true ); |
|
288 | + $allow_custom_amount = get_post_meta($this->ID, '_give_custom_amount', true); |
|
289 | + $this->minimum_price = get_post_meta($this->ID, '_give_custom_amount_minimum', true); |
|
290 | 290 | |
291 | - if ( $allow_custom_amount != 'no' && $this->minimum_price ) { |
|
291 | + if ($allow_custom_amount != 'no' && $this->minimum_price) { |
|
292 | 292 | |
293 | - $this->minimum_price = give_sanitize_amount( $this->minimum_price ); |
|
293 | + $this->minimum_price = give_sanitize_amount($this->minimum_price); |
|
294 | 294 | |
295 | 295 | } else { |
296 | 296 | |
@@ -300,7 +300,7 @@ discard block |
||
300 | 300 | |
301 | 301 | } |
302 | 302 | |
303 | - return apply_filters( 'give_get_set_minimum_price', $this->minimum_price, $this->ID ); |
|
303 | + return apply_filters('give_get_set_minimum_price', $this->minimum_price, $this->ID); |
|
304 | 304 | } |
305 | 305 | |
306 | 306 | /** |
@@ -311,9 +311,9 @@ discard block |
||
311 | 311 | */ |
312 | 312 | public function get_prices() { |
313 | 313 | |
314 | - if ( ! isset( $this->prices ) ) { |
|
314 | + if ( ! isset($this->prices)) { |
|
315 | 315 | |
316 | - $this->prices = get_post_meta( $this->ID, '_give_donation_levels', true ); |
|
316 | + $this->prices = get_post_meta($this->ID, '_give_donation_levels', true); |
|
317 | 317 | |
318 | 318 | } |
319 | 319 | |
@@ -325,7 +325,7 @@ discard block |
||
325 | 325 | * @param array $prices The array of mulit-level prices. |
326 | 326 | * @param int|string The ID of the form. |
327 | 327 | */ |
328 | - return apply_filters( 'give_get_donation_levels', $this->prices, $this->ID ); |
|
328 | + return apply_filters('give_get_donation_levels', $this->prices, $this->ID); |
|
329 | 329 | |
330 | 330 | } |
331 | 331 | |
@@ -337,13 +337,13 @@ discard block |
||
337 | 337 | */ |
338 | 338 | public function get_goal() { |
339 | 339 | |
340 | - if ( ! isset( $this->goal ) ) { |
|
340 | + if ( ! isset($this->goal)) { |
|
341 | 341 | |
342 | - $this->goal = get_post_meta( $this->ID, '_give_set_goal', true ); |
|
342 | + $this->goal = get_post_meta($this->ID, '_give_set_goal', true); |
|
343 | 343 | |
344 | - if ( $this->goal ) { |
|
344 | + if ($this->goal) { |
|
345 | 345 | |
346 | - $this->goal = give_sanitize_amount( $this->goal ); |
|
346 | + $this->goal = give_sanitize_amount($this->goal); |
|
347 | 347 | |
348 | 348 | } else { |
349 | 349 | |
@@ -353,7 +353,7 @@ discard block |
||
353 | 353 | |
354 | 354 | } |
355 | 355 | |
356 | - return apply_filters( 'give_get_set_goal', $this->goal, $this->ID ); |
|
356 | + return apply_filters('give_get_set_goal', $this->goal, $this->ID); |
|
357 | 357 | |
358 | 358 | } |
359 | 359 | |
@@ -365,10 +365,10 @@ discard block |
||
365 | 365 | */ |
366 | 366 | public function is_single_price_mode() { |
367 | 367 | |
368 | - $option = get_post_meta( $this->ID, '_give_price_options_mode', true ); |
|
368 | + $option = get_post_meta($this->ID, '_give_price_options_mode', true); |
|
369 | 369 | $ret = 0; |
370 | 370 | |
371 | - if ( empty( $option ) || $option === 'set' ) { |
|
371 | + if (empty($option) || $option === 'set') { |
|
372 | 372 | $ret = 1; |
373 | 373 | } |
374 | 374 | |
@@ -380,7 +380,7 @@ discard block |
||
380 | 380 | * @param bool $ret Is donation form in single price mode? |
381 | 381 | * @param int|string The ID of the donation form. |
382 | 382 | */ |
383 | - return (bool) apply_filters( 'give_single_price_option_mode', $ret, $this->ID ); |
|
383 | + return (bool) apply_filters('give_single_price_option_mode', $ret, $this->ID); |
|
384 | 384 | |
385 | 385 | } |
386 | 386 | |
@@ -394,10 +394,10 @@ discard block |
||
394 | 394 | */ |
395 | 395 | public function has_variable_prices() { |
396 | 396 | |
397 | - $option = get_post_meta( $this->ID, '_give_price_option', true ); |
|
397 | + $option = get_post_meta($this->ID, '_give_price_option', true); |
|
398 | 398 | $ret = 0; |
399 | 399 | |
400 | - if ( $option === 'multi' ) { |
|
400 | + if ($option === 'multi') { |
|
401 | 401 | $ret = 1; |
402 | 402 | } |
403 | 403 | |
@@ -407,7 +407,7 @@ discard block |
||
407 | 407 | * @param bool $ret Does donation form have variable prices? |
408 | 408 | * @param int|string The ID of the donation form. |
409 | 409 | */ |
410 | - return (bool) apply_filters( 'give_has_variable_prices', $ret, $this->ID ); |
|
410 | + return (bool) apply_filters('give_has_variable_prices', $ret, $this->ID); |
|
411 | 411 | |
412 | 412 | } |
413 | 413 | |
@@ -419,17 +419,17 @@ discard block |
||
419 | 419 | */ |
420 | 420 | public function get_type() { |
421 | 421 | |
422 | - if ( ! isset( $this->type ) ) { |
|
422 | + if ( ! isset($this->type)) { |
|
423 | 423 | |
424 | - $this->type = get_post_meta( $this->ID, '_give_price_option', true ); |
|
424 | + $this->type = get_post_meta($this->ID, '_give_price_option', true); |
|
425 | 425 | |
426 | - if ( empty( $this->type ) ) { |
|
426 | + if (empty($this->type)) { |
|
427 | 427 | $this->type = 'set'; |
428 | 428 | } |
429 | 429 | |
430 | 430 | } |
431 | 431 | |
432 | - return apply_filters( 'give_get_form_type', $this->type, $this->ID ); |
|
432 | + return apply_filters('give_get_form_type', $this->type, $this->ID); |
|
433 | 433 | |
434 | 434 | } |
435 | 435 | |
@@ -441,15 +441,15 @@ discard block |
||
441 | 441 | */ |
442 | 442 | public function get_sales() { |
443 | 443 | |
444 | - if ( ! isset( $this->sales ) ) { |
|
444 | + if ( ! isset($this->sales)) { |
|
445 | 445 | |
446 | - if ( '' == get_post_meta( $this->ID, '_give_form_sales', true ) ) { |
|
447 | - add_post_meta( $this->ID, '_give_form_sales', 0 ); |
|
446 | + if ('' == get_post_meta($this->ID, '_give_form_sales', true)) { |
|
447 | + add_post_meta($this->ID, '_give_form_sales', 0); |
|
448 | 448 | } // End if |
449 | 449 | |
450 | - $this->sales = get_post_meta( $this->ID, '_give_form_sales', true ); |
|
450 | + $this->sales = get_post_meta($this->ID, '_give_form_sales', true); |
|
451 | 451 | |
452 | - if ( $this->sales < 0 ) { |
|
452 | + if ($this->sales < 0) { |
|
453 | 453 | // Never let sales be less than zero |
454 | 454 | $this->sales = 0; |
455 | 455 | } |
@@ -469,13 +469,13 @@ discard block |
||
469 | 469 | * |
470 | 470 | * @return int|false New number of total sales |
471 | 471 | */ |
472 | - public function increase_sales( $quantity = 1 ) { |
|
472 | + public function increase_sales($quantity = 1) { |
|
473 | 473 | |
474 | - $sales = give_get_form_sales_stats( $this->ID ); |
|
475 | - $quantity = absint( $quantity ); |
|
474 | + $sales = give_get_form_sales_stats($this->ID); |
|
475 | + $quantity = absint($quantity); |
|
476 | 476 | $total_sales = $sales + $quantity; |
477 | 477 | |
478 | - if ( $this->update_meta( '_give_form_sales', $total_sales ) ) { |
|
478 | + if ($this->update_meta('_give_form_sales', $total_sales)) { |
|
479 | 479 | |
480 | 480 | $this->sales = $total_sales; |
481 | 481 | |
@@ -495,17 +495,17 @@ discard block |
||
495 | 495 | * |
496 | 496 | * @return int|false New number of total sales |
497 | 497 | */ |
498 | - public function decrease_sales( $quantity = 1 ) { |
|
498 | + public function decrease_sales($quantity = 1) { |
|
499 | 499 | |
500 | - $sales = give_get_form_sales_stats( $this->ID ); |
|
500 | + $sales = give_get_form_sales_stats($this->ID); |
|
501 | 501 | |
502 | 502 | // Only decrease if not already zero |
503 | - if ( $sales > 0 ) { |
|
503 | + if ($sales > 0) { |
|
504 | 504 | |
505 | - $quantity = absint( $quantity ); |
|
505 | + $quantity = absint($quantity); |
|
506 | 506 | $total_sales = $sales - $quantity; |
507 | 507 | |
508 | - if ( $this->update_meta( '_give_form_sales', $total_sales ) ) { |
|
508 | + if ($this->update_meta('_give_form_sales', $total_sales)) { |
|
509 | 509 | |
510 | 510 | $this->sales = $sales; |
511 | 511 | |
@@ -527,15 +527,15 @@ discard block |
||
527 | 527 | */ |
528 | 528 | public function get_earnings() { |
529 | 529 | |
530 | - if ( ! isset( $this->earnings ) ) { |
|
530 | + if ( ! isset($this->earnings)) { |
|
531 | 531 | |
532 | - if ( '' == get_post_meta( $this->ID, '_give_form_earnings', true ) ) { |
|
533 | - add_post_meta( $this->ID, '_give_form_earnings', 0 ); |
|
532 | + if ('' == get_post_meta($this->ID, '_give_form_earnings', true)) { |
|
533 | + add_post_meta($this->ID, '_give_form_earnings', 0); |
|
534 | 534 | } |
535 | 535 | |
536 | - $this->earnings = get_post_meta( $this->ID, '_give_form_earnings', true ); |
|
536 | + $this->earnings = get_post_meta($this->ID, '_give_form_earnings', true); |
|
537 | 537 | |
538 | - if ( $this->earnings < 0 ) { |
|
538 | + if ($this->earnings < 0) { |
|
539 | 539 | // Never let earnings be less than zero |
540 | 540 | $this->earnings = 0; |
541 | 541 | } |
@@ -552,12 +552,12 @@ discard block |
||
552 | 552 | * @since 1.0 |
553 | 553 | * @return float|false |
554 | 554 | */ |
555 | - public function increase_earnings( $amount = 0 ) { |
|
555 | + public function increase_earnings($amount = 0) { |
|
556 | 556 | |
557 | - $earnings = give_get_form_earnings_stats( $this->ID ); |
|
557 | + $earnings = give_get_form_earnings_stats($this->ID); |
|
558 | 558 | $new_amount = $earnings + (float) $amount; |
559 | 559 | |
560 | - if ( $this->update_meta( '_give_form_earnings', $new_amount ) ) { |
|
560 | + if ($this->update_meta('_give_form_earnings', $new_amount)) { |
|
561 | 561 | |
562 | 562 | $this->earnings = $new_amount; |
563 | 563 | |
@@ -575,16 +575,16 @@ discard block |
||
575 | 575 | * @since 1.0 |
576 | 576 | * @return float|false |
577 | 577 | */ |
578 | - public function decrease_earnings( $amount ) { |
|
578 | + public function decrease_earnings($amount) { |
|
579 | 579 | |
580 | - $earnings = give_get_form_earnings_stats( $this->ID ); |
|
580 | + $earnings = give_get_form_earnings_stats($this->ID); |
|
581 | 581 | |
582 | - if ( $earnings > 0 ) { |
|
582 | + if ($earnings > 0) { |
|
583 | 583 | // Only decrease if greater than zero |
584 | 584 | $new_amount = $earnings - (float) $amount; |
585 | 585 | |
586 | 586 | |
587 | - if ( $this->update_meta( '_give_form_earnings', $new_amount ) ) { |
|
587 | + if ($this->update_meta('_give_form_earnings', $new_amount)) { |
|
588 | 588 | |
589 | 589 | $this->earnings = $new_amount; |
590 | 590 | |
@@ -604,22 +604,22 @@ discard block |
||
604 | 604 | * @since 1.0 |
605 | 605 | * @return bool |
606 | 606 | */ |
607 | - public function is_free( $price_id = false ) { |
|
607 | + public function is_free($price_id = false) { |
|
608 | 608 | |
609 | 609 | $is_free = false; |
610 | - $variable_pricing = give_has_variable_prices( $this->ID ); |
|
610 | + $variable_pricing = give_has_variable_prices($this->ID); |
|
611 | 611 | |
612 | - if ( $variable_pricing && ! is_null( $price_id ) && $price_id !== false ) { |
|
613 | - $price = give_get_price_option_amount( $this->ID, $price_id ); |
|
614 | - } elseif ( ! $variable_pricing ) { |
|
615 | - $price = get_post_meta( $this->ID, '_give_set_price', true ); |
|
612 | + if ($variable_pricing && ! is_null($price_id) && $price_id !== false) { |
|
613 | + $price = give_get_price_option_amount($this->ID, $price_id); |
|
614 | + } elseif ( ! $variable_pricing) { |
|
615 | + $price = get_post_meta($this->ID, '_give_set_price', true); |
|
616 | 616 | } |
617 | 617 | |
618 | - if ( isset( $price ) && (float) $price == 0 ) { |
|
618 | + if (isset($price) && (float) $price == 0) { |
|
619 | 619 | $is_free = true; |
620 | 620 | } |
621 | 621 | |
622 | - return (bool) apply_filters( 'give_is_free_donation', $is_free, $this->ID, $price_id ); |
|
622 | + return (bool) apply_filters('give_is_free_donation', $is_free, $this->ID, $price_id); |
|
623 | 623 | |
624 | 624 | } |
625 | 625 | |
@@ -636,9 +636,9 @@ discard block |
||
636 | 636 | */ |
637 | 637 | public function is_close_donation_form() { |
638 | 638 | return ( |
639 | - 'yes' === get_post_meta( $this->ID, '_give_goal_option', true ) ) |
|
640 | - && ( 'yes' === get_post_meta( $this->ID, '_give_close_form_when_goal_achieved', true ) ) |
|
641 | - && ( $this->get_goal() <= $this->get_earnings() |
|
639 | + 'yes' === get_post_meta($this->ID, '_give_goal_option', true) ) |
|
640 | + && ('yes' === get_post_meta($this->ID, '_give_close_form_when_goal_achieved', true)) |
|
641 | + && ($this->get_goal() <= $this->get_earnings() |
|
642 | 642 | ); |
643 | 643 | } |
644 | 644 | |
@@ -654,28 +654,28 @@ discard block |
||
654 | 654 | * |
655 | 655 | * @return bool The result of the update query |
656 | 656 | */ |
657 | - private function update_meta( $meta_key = '', $meta_value = '' ) { |
|
657 | + private function update_meta($meta_key = '', $meta_value = '') { |
|
658 | 658 | |
659 | 659 | global $wpdb; |
660 | 660 | |
661 | - if ( empty( $meta_key ) || empty( $meta_value ) ) { |
|
661 | + if (empty($meta_key) || empty($meta_value)) { |
|
662 | 662 | return false; |
663 | 663 | } |
664 | 664 | |
665 | 665 | // Make sure if it needs to be serialized, we do |
666 | - $meta_value = maybe_serialize( $meta_value ); |
|
666 | + $meta_value = maybe_serialize($meta_value); |
|
667 | 667 | |
668 | - if ( is_numeric( $meta_value ) ) { |
|
669 | - $value_type = is_float( $meta_value ) ? '%f' : '%d'; |
|
668 | + if (is_numeric($meta_value)) { |
|
669 | + $value_type = is_float($meta_value) ? '%f' : '%d'; |
|
670 | 670 | } else { |
671 | 671 | $value_type = "'%s'"; |
672 | 672 | } |
673 | 673 | |
674 | - $sql = $wpdb->prepare( "UPDATE $wpdb->postmeta SET meta_value = $value_type WHERE post_id = $this->ID AND meta_key = '%s'", $meta_value, $meta_key ); |
|
674 | + $sql = $wpdb->prepare("UPDATE $wpdb->postmeta SET meta_value = $value_type WHERE post_id = $this->ID AND meta_key = '%s'", $meta_value, $meta_key); |
|
675 | 675 | |
676 | - if ( $wpdb->query( $sql ) ) { |
|
676 | + if ($wpdb->query($sql)) { |
|
677 | 677 | |
678 | - clean_post_cache( $this->ID ); |
|
678 | + clean_post_cache($this->ID); |
|
679 | 679 | |
680 | 680 | return true; |
681 | 681 |
@@ -10,7 +10,7 @@ discard block |
||
10 | 10 | */ |
11 | 11 | |
12 | 12 | // Exit if accessed directly |
13 | -if ( ! defined( 'ABSPATH' ) ) { |
|
13 | +if ( ! defined('ABSPATH')) { |
|
14 | 14 | exit; |
15 | 15 | } |
16 | 16 | |
@@ -23,64 +23,64 @@ discard block |
||
23 | 23 | * |
24 | 24 | * @return string $purchase_form |
25 | 25 | */ |
26 | -function give_get_donation_form( $args = array() ) { |
|
26 | +function give_get_donation_form($args = array()) { |
|
27 | 27 | |
28 | 28 | global $post; |
29 | 29 | |
30 | - $form_id = is_object( $post ) ? $post->ID : 0; |
|
30 | + $form_id = is_object($post) ? $post->ID : 0; |
|
31 | 31 | |
32 | - if ( isset( $args['id'] ) ) { |
|
32 | + if (isset($args['id'])) { |
|
33 | 33 | $form_id = $args['id']; |
34 | 34 | } |
35 | 35 | |
36 | - $defaults = apply_filters( 'give_form_args_defaults', array( |
|
36 | + $defaults = apply_filters('give_form_args_defaults', array( |
|
37 | 37 | 'form_id' => $form_id |
38 | - ) ); |
|
38 | + )); |
|
39 | 39 | |
40 | - $args = wp_parse_args( $args, $defaults ); |
|
40 | + $args = wp_parse_args($args, $defaults); |
|
41 | 41 | |
42 | - $form = new Give_Donate_Form( $args['form_id'] ); |
|
42 | + $form = new Give_Donate_Form($args['form_id']); |
|
43 | 43 | |
44 | 44 | //bail if no form ID |
45 | - if ( empty( $form->ID ) ) { |
|
45 | + if (empty($form->ID)) { |
|
46 | 46 | return false; |
47 | 47 | } |
48 | 48 | |
49 | - $payment_mode = give_get_chosen_gateway( $form->ID ); |
|
49 | + $payment_mode = give_get_chosen_gateway($form->ID); |
|
50 | 50 | |
51 | - $form_action = esc_url( add_query_arg( apply_filters( 'give_form_action_args', array( |
|
51 | + $form_action = esc_url(add_query_arg(apply_filters('give_form_action_args', array( |
|
52 | 52 | 'payment-mode' => $payment_mode, |
53 | - ) ), |
|
53 | + )), |
|
54 | 54 | give_get_current_page_url() |
55 | - ) ); |
|
55 | + )); |
|
56 | 56 | |
57 | 57 | //Sanity Check: Donation form not published or user doesn't have permission to view drafts |
58 | - if ( 'publish' !== $form->post_status && ! current_user_can( 'edit_give_forms', $form->ID ) ) { |
|
58 | + if ('publish' !== $form->post_status && ! current_user_can('edit_give_forms', $form->ID)) { |
|
59 | 59 | return false; |
60 | 60 | } |
61 | 61 | |
62 | - $display_option = ( isset( $args['display_style'] ) && ! empty( $args['display_style'] ) ) |
|
62 | + $display_option = (isset($args['display_style']) && ! empty($args['display_style'])) |
|
63 | 63 | ? $args['display_style'] |
64 | - : get_post_meta( $form->ID, '_give_payment_display', true ); |
|
64 | + : get_post_meta($form->ID, '_give_payment_display', true); |
|
65 | 65 | |
66 | - $float_labels_option = give_is_float_labels_enabled( $args ) |
|
66 | + $float_labels_option = give_is_float_labels_enabled($args) |
|
67 | 67 | ? ' float-labels-enabled' |
68 | 68 | : ''; |
69 | 69 | |
70 | 70 | //Form Wrap Classes |
71 | - $form_wrap_classes_array = apply_filters( 'give_form_wrap_classes', array( |
|
71 | + $form_wrap_classes_array = apply_filters('give_form_wrap_classes', array( |
|
72 | 72 | 'give-form-wrap', |
73 | - 'give-display-' . $display_option |
|
74 | - ), $form->ID, $args ); |
|
75 | - $form_wrap_classes = implode( ' ', $form_wrap_classes_array ); |
|
73 | + 'give-display-'.$display_option |
|
74 | + ), $form->ID, $args); |
|
75 | + $form_wrap_classes = implode(' ', $form_wrap_classes_array); |
|
76 | 76 | |
77 | 77 | //Form Classes |
78 | - $form_classes_array = apply_filters( 'give_form_classes', array( |
|
78 | + $form_classes_array = apply_filters('give_form_classes', array( |
|
79 | 79 | 'give-form', |
80 | - 'give-form-' . $form->ID, |
|
80 | + 'give-form-'.$form->ID, |
|
81 | 81 | $float_labels_option |
82 | - ), $form->ID, $args ); |
|
83 | - $form_classes = implode( ' ', $form_classes_array ); |
|
82 | + ), $form->ID, $args); |
|
83 | + $form_classes = implode(' ', $form_classes_array); |
|
84 | 84 | |
85 | 85 | |
86 | 86 | ob_start(); |
@@ -93,35 +93,35 @@ discard block |
||
93 | 93 | * @param int $form ->ID The current form ID |
94 | 94 | * @param array $args An array of form args |
95 | 95 | */ |
96 | - do_action( 'give_pre_form_output', $form->ID, $args ); ?> |
|
96 | + do_action('give_pre_form_output', $form->ID, $args); ?> |
|
97 | 97 | |
98 | 98 | <div id="give-form-<?php echo $form->ID; ?>-wrap" class="<?php echo $form_wrap_classes; ?>"> |
99 | 99 | |
100 | - <?php if ( $form->is_close_donation_form() ) : ?> |
|
100 | + <?php if ($form->is_close_donation_form()) : ?> |
|
101 | 101 | <?php |
102 | 102 | //Get thank you message. |
103 | - $display_thankyou_message = get_post_meta( $form->ID, '_give_form_goal_achieved_message', true ); |
|
104 | - $display_thankyou_message = ! empty( $display_thankyou_message ) ? $display_thankyou_message : __( 'Thank you to all our donors, we have met our goal.', 'give' ); |
|
103 | + $display_thankyou_message = get_post_meta($form->ID, '_give_form_goal_achieved_message', true); |
|
104 | + $display_thankyou_message = ! empty($display_thankyou_message) ? $display_thankyou_message : __('Thank you to all our donors, we have met our goal.', 'give'); |
|
105 | 105 | |
106 | 106 | //Print thank you message. |
107 | 107 | echo "<p class=\"give-from-thankyou-msg\">{$display_thankyou_message}</p>"; |
108 | 108 | ?> |
109 | 109 | <?php else : ?> |
110 | 110 | <?php |
111 | - if ( isset( $args['show_title'] ) && $args['show_title'] == true ) { |
|
111 | + if (isset($args['show_title']) && $args['show_title'] == true) { |
|
112 | 112 | |
113 | - echo apply_filters( 'give_form_title', '<h2 class="give-form-title">' . get_the_title( $form_id ) . '</h2>' ); |
|
113 | + echo apply_filters('give_form_title', '<h2 class="give-form-title">'.get_the_title($form_id).'</h2>'); |
|
114 | 114 | |
115 | 115 | } ?> |
116 | 116 | |
117 | - <?php do_action( 'give_pre_form', $form->ID, $args ); ?> |
|
117 | + <?php do_action('give_pre_form', $form->ID, $args); ?> |
|
118 | 118 | |
119 | 119 | <form id="give-form-<?php echo $form_id; ?>" class="<?php echo $form_classes; ?>" action="<?php echo $form_action; ?>" method="post"> |
120 | 120 | <input type="hidden" name="give-form-id" value="<?php echo $form->ID; ?>"/> |
121 | - <input type="hidden" name="give-form-title" value="<?php echo htmlentities( $form->post_title ); ?>"/> |
|
122 | - <input type="hidden" name="give-current-url" value="<?php echo htmlspecialchars( give_get_current_page_url() ); ?>"/> |
|
123 | - <input type="hidden" name="give-form-url" value="<?php echo htmlspecialchars( give_get_current_page_url() ); ?>"/> |
|
124 | - <input type="hidden" name="give-form-minimum" value="<?php echo give_format_amount( give_get_form_minimum_price( $form->ID ) ); ?>"/> |
|
121 | + <input type="hidden" name="give-form-title" value="<?php echo htmlentities($form->post_title); ?>"/> |
|
122 | + <input type="hidden" name="give-current-url" value="<?php echo htmlspecialchars(give_get_current_page_url()); ?>"/> |
|
123 | + <input type="hidden" name="give-form-url" value="<?php echo htmlspecialchars(give_get_current_page_url()); ?>"/> |
|
124 | + <input type="hidden" name="give-form-minimum" value="<?php echo give_format_amount(give_get_form_minimum_price($form->ID)); ?>"/> |
|
125 | 125 | |
126 | 126 | <!-- The following field is for robots only, invisible to humans: --> |
127 | 127 | <span class="give-hidden" style="display: none !important;"> |
@@ -132,13 +132,13 @@ discard block |
||
132 | 132 | <?php |
133 | 133 | |
134 | 134 | //Price ID hidden field for variable (mult-level) donation forms |
135 | - if ( give_has_variable_prices( $form_id ) ) { |
|
135 | + if (give_has_variable_prices($form_id)) { |
|
136 | 136 | //get default selected price ID |
137 | - $prices = apply_filters( 'give_form_variable_prices', give_get_variable_prices( $form_id ), $form_id ); |
|
137 | + $prices = apply_filters('give_form_variable_prices', give_get_variable_prices($form_id), $form_id); |
|
138 | 138 | $price_id = 0; |
139 | 139 | //loop through prices |
140 | - foreach ( $prices as $price ) { |
|
141 | - if ( isset( $price['_give_default'] ) && $price['_give_default'] === 'default' ) { |
|
140 | + foreach ($prices as $price) { |
|
141 | + if (isset($price['_give_default']) && $price['_give_default'] === 'default') { |
|
142 | 142 | $price_id = $price['_give_id']['level_id']; |
143 | 143 | }; |
144 | 144 | } |
@@ -146,20 +146,20 @@ discard block |
||
146 | 146 | <input type="hidden" name="give-price-id" value="<?php echo $price_id; ?>"/> |
147 | 147 | <?php } |
148 | 148 | |
149 | - do_action( 'give_checkout_form_top', $form->ID, $args ); |
|
149 | + do_action('give_checkout_form_top', $form->ID, $args); |
|
150 | 150 | |
151 | - do_action( 'give_payment_mode_select', $form->ID, $args ); |
|
151 | + do_action('give_payment_mode_select', $form->ID, $args); |
|
152 | 152 | |
153 | - do_action( 'give_checkout_form_bottom', $form->ID, $args ); |
|
153 | + do_action('give_checkout_form_bottom', $form->ID, $args); |
|
154 | 154 | |
155 | 155 | ?> |
156 | 156 | </form> |
157 | 157 | |
158 | - <?php do_action( 'give_post_form', $form->ID, $args ); ?> |
|
158 | + <?php do_action('give_post_form', $form->ID, $args); ?> |
|
159 | 159 | |
160 | 160 | <?php endif; ?> |
161 | 161 | |
162 | - <!--end #give-form-<?php echo absint( $form->ID ); ?>--></div> |
|
162 | + <!--end #give-form-<?php echo absint($form->ID); ?>--></div> |
|
163 | 163 | <?php |
164 | 164 | |
165 | 165 | /** |
@@ -170,11 +170,11 @@ discard block |
||
170 | 170 | * @param int $form ->ID The current form ID |
171 | 171 | * @param array $args An array of form args |
172 | 172 | */ |
173 | - do_action( 'give_post_form_output', $form->ID, $args ); |
|
173 | + do_action('give_post_form_output', $form->ID, $args); |
|
174 | 174 | |
175 | 175 | $final_output = ob_get_clean(); |
176 | 176 | |
177 | - echo apply_filters( 'give_donate_form', $final_output, $args ); |
|
177 | + echo apply_filters('give_donate_form', $final_output, $args); |
|
178 | 178 | } |
179 | 179 | |
180 | 180 | |
@@ -194,43 +194,43 @@ discard block |
||
194 | 194 | * @global $give_options Array of all the Give options |
195 | 195 | * @return string |
196 | 196 | */ |
197 | -function give_show_purchase_form( $form_id ) { |
|
197 | +function give_show_purchase_form($form_id) { |
|
198 | 198 | |
199 | - $payment_mode = give_get_chosen_gateway( $form_id ); |
|
199 | + $payment_mode = give_get_chosen_gateway($form_id); |
|
200 | 200 | |
201 | - if ( ! isset( $form_id ) && isset( $_POST['give_form_id'] ) ) { |
|
201 | + if ( ! isset($form_id) && isset($_POST['give_form_id'])) { |
|
202 | 202 | $form_id = $_POST['give_form_id']; |
203 | 203 | } |
204 | 204 | |
205 | - do_action( 'give_purchase_form_top', $form_id ); |
|
205 | + do_action('give_purchase_form_top', $form_id); |
|
206 | 206 | |
207 | - if ( give_can_checkout() && isset( $form_id ) ) { |
|
207 | + if (give_can_checkout() && isset($form_id)) { |
|
208 | 208 | |
209 | - do_action( 'give_purchase_form_before_register_login', $form_id ); |
|
209 | + do_action('give_purchase_form_before_register_login', $form_id); |
|
210 | 210 | |
211 | - do_action( 'give_purchase_form_register_login_fields', $form_id ); |
|
211 | + do_action('give_purchase_form_register_login_fields', $form_id); |
|
212 | 212 | |
213 | - do_action( 'give_purchase_form_before_cc_form', $form_id ); |
|
213 | + do_action('give_purchase_form_before_cc_form', $form_id); |
|
214 | 214 | |
215 | 215 | // Load the credit card form and allow gateways to load their own if they wish |
216 | - if ( has_action( 'give_' . $payment_mode . '_cc_form' ) ) { |
|
217 | - do_action( 'give_' . $payment_mode . '_cc_form', $form_id ); |
|
216 | + if (has_action('give_'.$payment_mode.'_cc_form')) { |
|
217 | + do_action('give_'.$payment_mode.'_cc_form', $form_id); |
|
218 | 218 | } else { |
219 | - do_action( 'give_cc_form', $form_id ); |
|
219 | + do_action('give_cc_form', $form_id); |
|
220 | 220 | } |
221 | 221 | |
222 | - do_action( 'give_purchase_form_after_cc_form', $form_id ); |
|
222 | + do_action('give_purchase_form_after_cc_form', $form_id); |
|
223 | 223 | |
224 | 224 | } else { |
225 | 225 | // Can't checkout |
226 | - do_action( 'give_purchase_form_no_access', $form_id ); |
|
226 | + do_action('give_purchase_form_no_access', $form_id); |
|
227 | 227 | |
228 | 228 | } |
229 | 229 | |
230 | - do_action( 'give_purchase_form_bottom', $form_id ); |
|
230 | + do_action('give_purchase_form_bottom', $form_id); |
|
231 | 231 | } |
232 | 232 | |
233 | -add_action( 'give_purchase_form', 'give_show_purchase_form' ); |
|
233 | +add_action('give_purchase_form', 'give_show_purchase_form'); |
|
234 | 234 | |
235 | 235 | /** |
236 | 236 | * |
@@ -242,26 +242,26 @@ discard block |
||
242 | 242 | * |
243 | 243 | * @return void |
244 | 244 | */ |
245 | -function give_show_register_login_fields( $form_id ) { |
|
245 | +function give_show_register_login_fields($form_id) { |
|
246 | 246 | |
247 | - $show_register_form = give_show_login_register_option( $form_id ); |
|
247 | + $show_register_form = give_show_login_register_option($form_id); |
|
248 | 248 | |
249 | - if ( ( $show_register_form === 'registration' || ( $show_register_form === 'both' && ! isset( $_GET['login'] ) ) ) && ! is_user_logged_in() ) : ?> |
|
249 | + if (($show_register_form === 'registration' || ($show_register_form === 'both' && ! isset($_GET['login']))) && ! is_user_logged_in()) : ?> |
|
250 | 250 | <div id="give-checkout-login-register-<?php echo $form_id; ?>"> |
251 | - <?php do_action( 'give_purchase_form_register_fields', $form_id ); ?> |
|
251 | + <?php do_action('give_purchase_form_register_fields', $form_id); ?> |
|
252 | 252 | </div> |
253 | - <?php elseif ( ( $show_register_form === 'login' || ( $show_register_form === 'both' && isset( $_GET['login'] ) ) ) && ! is_user_logged_in() ) : ?> |
|
253 | + <?php elseif (($show_register_form === 'login' || ($show_register_form === 'both' && isset($_GET['login']))) && ! is_user_logged_in()) : ?> |
|
254 | 254 | <div id="give-checkout-login-register-<?php echo $form_id; ?>"> |
255 | - <?php do_action( 'give_purchase_form_login_fields', $form_id ); ?> |
|
255 | + <?php do_action('give_purchase_form_login_fields', $form_id); ?> |
|
256 | 256 | </div> |
257 | 257 | <?php endif; ?> |
258 | 258 | |
259 | - <?php if ( ( ! isset( $_GET['login'] ) && is_user_logged_in() ) || ! isset( $show_register_form ) || 'none' === $show_register_form || 'login' === $show_register_form ) { |
|
260 | - do_action( 'give_purchase_form_after_user_info', $form_id ); |
|
259 | + <?php if (( ! isset($_GET['login']) && is_user_logged_in()) || ! isset($show_register_form) || 'none' === $show_register_form || 'login' === $show_register_form) { |
|
260 | + do_action('give_purchase_form_after_user_info', $form_id); |
|
261 | 261 | } |
262 | 262 | } |
263 | 263 | |
264 | -add_action( 'give_purchase_form_register_login_fields', 'give_show_register_login_fields' ); |
|
264 | +add_action('give_purchase_form_register_login_fields', 'give_show_register_login_fields'); |
|
265 | 265 | |
266 | 266 | /** |
267 | 267 | * Donation Amount Field |
@@ -275,33 +275,33 @@ discard block |
||
275 | 275 | * |
276 | 276 | * @return void |
277 | 277 | */ |
278 | -function give_output_donation_amount_top( $form_id = 0, $args = array() ) { |
|
278 | +function give_output_donation_amount_top($form_id = 0, $args = array()) { |
|
279 | 279 | |
280 | 280 | global $give_options; |
281 | 281 | |
282 | - $variable_pricing = give_has_variable_prices( $form_id ); |
|
283 | - $allow_custom_amount = get_post_meta( $form_id, '_give_custom_amount', true ); |
|
284 | - $currency_position = isset( $give_options['currency_position'] ) ? $give_options['currency_position'] : 'before'; |
|
285 | - $symbol = give_currency_symbol( give_get_currency() ); |
|
286 | - $currency_output = '<span class="give-currency-symbol give-currency-position-' . $currency_position . '">' . $symbol . '</span>'; |
|
287 | - $default_amount = give_format_amount( give_get_default_form_amount( $form_id ) ); |
|
288 | - $custom_amount_text = get_post_meta( $form_id, '_give_custom_amount_text', true ); |
|
282 | + $variable_pricing = give_has_variable_prices($form_id); |
|
283 | + $allow_custom_amount = get_post_meta($form_id, '_give_custom_amount', true); |
|
284 | + $currency_position = isset($give_options['currency_position']) ? $give_options['currency_position'] : 'before'; |
|
285 | + $symbol = give_currency_symbol(give_get_currency()); |
|
286 | + $currency_output = '<span class="give-currency-symbol give-currency-position-'.$currency_position.'">'.$symbol.'</span>'; |
|
287 | + $default_amount = give_format_amount(give_get_default_form_amount($form_id)); |
|
288 | + $custom_amount_text = get_post_meta($form_id, '_give_custom_amount_text', true); |
|
289 | 289 | |
290 | - do_action( 'give_before_donation_levels', $form_id, $args ); |
|
290 | + do_action('give_before_donation_levels', $form_id, $args); |
|
291 | 291 | |
292 | 292 | //Set Price, No Custom Amount Allowed means hidden price field |
293 | - if ( $allow_custom_amount == 'no' ) { |
|
293 | + if ($allow_custom_amount == 'no') { |
|
294 | 294 | ?> |
295 | 295 | |
296 | - <label class="give-hidden" for="give-amount-hidden"><?php echo __( 'Donation Amount:', 'give' ); ?></label> |
|
296 | + <label class="give-hidden" for="give-amount-hidden"><?php echo __('Donation Amount:', 'give'); ?></label> |
|
297 | 297 | <input id="give-amount" class="give-amount-hidden" type="hidden" name="give-amount" |
298 | 298 | value="<?php echo $default_amount; ?>" required> |
299 | 299 | <div class="set-price give-donation-amount form-row-wide"> |
300 | - <?php if ( $currency_position == 'before' ) { |
|
300 | + <?php if ($currency_position == 'before') { |
|
301 | 301 | echo $currency_output; |
302 | 302 | } ?> |
303 | 303 | <span id="give-amount-text" class="give-text-input give-amount-top"><?php echo $default_amount; ?></span> |
304 | - <?php if ( $currency_position == 'after' ) { |
|
304 | + <?php if ($currency_position == 'after') { |
|
305 | 305 | echo $currency_output; |
306 | 306 | } ?> |
307 | 307 | </div> |
@@ -311,34 +311,34 @@ discard block |
||
311 | 311 | ?> |
312 | 312 | <div class="give-total-wrap"> |
313 | 313 | <div class="give-donation-amount form-row-wide"> |
314 | - <?php if ( $currency_position == 'before' ) { |
|
314 | + <?php if ($currency_position == 'before') { |
|
315 | 315 | echo $currency_output; |
316 | 316 | } ?> |
317 | - <label class="give-hidden" for="give-amount"><?php echo __( 'Donation Amount:', 'give' ); ?></label> |
|
317 | + <label class="give-hidden" for="give-amount"><?php echo __('Donation Amount:', 'give'); ?></label> |
|
318 | 318 | <input class="give-text-input give-amount-top" id="give-amount" name="give-amount" type="tel" placeholder="" value="<?php echo $default_amount; ?>" autocomplete="off"> |
319 | - <?php if ( $currency_position == 'after' ) { |
|
319 | + <?php if ($currency_position == 'after') { |
|
320 | 320 | echo $currency_output; |
321 | 321 | } ?> |
322 | 322 | </div> |
323 | 323 | </div> |
324 | 324 | <?php } |
325 | 325 | |
326 | - do_action( 'give_after_donation_amount', $form_id, $args ); |
|
326 | + do_action('give_after_donation_amount', $form_id, $args); |
|
327 | 327 | |
328 | 328 | //Custom Amount Text |
329 | - if ( ! $variable_pricing && $allow_custom_amount == 'yes' && ! empty( $custom_amount_text ) ) { ?> |
|
329 | + if ( ! $variable_pricing && $allow_custom_amount == 'yes' && ! empty($custom_amount_text)) { ?> |
|
330 | 330 | <p class="give-custom-amount-text"><?php echo $custom_amount_text; ?></p> |
331 | 331 | <?php } |
332 | 332 | |
333 | 333 | //Output Variable Pricing Levels |
334 | - if ( $variable_pricing ) { |
|
335 | - give_output_levels( $form_id ); |
|
334 | + if ($variable_pricing) { |
|
335 | + give_output_levels($form_id); |
|
336 | 336 | } |
337 | 337 | |
338 | - do_action( 'give_after_donation_levels', $form_id, $args ); |
|
338 | + do_action('give_after_donation_levels', $form_id, $args); |
|
339 | 339 | } |
340 | 340 | |
341 | -add_action( 'give_checkout_form_top', 'give_output_donation_amount_top', 10, 2 ); |
|
341 | +add_action('give_checkout_form_top', 'give_output_donation_amount_top', 10, 2); |
|
342 | 342 | |
343 | 343 | |
344 | 344 | /** |
@@ -350,32 +350,32 @@ discard block |
||
350 | 350 | * |
351 | 351 | * @return string |
352 | 352 | */ |
353 | -function give_output_levels( $form_id ) { |
|
353 | +function give_output_levels($form_id) { |
|
354 | 354 | |
355 | 355 | //Get variable pricing |
356 | - $prices = apply_filters( 'give_form_variable_prices', give_get_variable_prices( $form_id ), $form_id ); |
|
357 | - $display_style = get_post_meta( $form_id, '_give_display_style', true ); |
|
358 | - $custom_amount = get_post_meta( $form_id, '_give_custom_amount', true ); |
|
359 | - $custom_amount_text = get_post_meta( $form_id, '_give_custom_amount_text', true ); |
|
360 | - if ( empty( $custom_amount_text ) ) { |
|
361 | - $custom_amount_text = __( 'Give a Custom Amount', 'give' ); |
|
356 | + $prices = apply_filters('give_form_variable_prices', give_get_variable_prices($form_id), $form_id); |
|
357 | + $display_style = get_post_meta($form_id, '_give_display_style', true); |
|
358 | + $custom_amount = get_post_meta($form_id, '_give_custom_amount', true); |
|
359 | + $custom_amount_text = get_post_meta($form_id, '_give_custom_amount_text', true); |
|
360 | + if (empty($custom_amount_text)) { |
|
361 | + $custom_amount_text = __('Give a Custom Amount', 'give'); |
|
362 | 362 | } |
363 | 363 | |
364 | 364 | $output = ''; |
365 | 365 | $counter = 0; |
366 | 366 | |
367 | - switch ( $display_style ) { |
|
367 | + switch ($display_style) { |
|
368 | 368 | case 'buttons': |
369 | 369 | |
370 | 370 | $output .= '<ul id="give-donation-level-button-wrap" class="give-donation-levels-wrap give-list-inline">'; |
371 | 371 | |
372 | - foreach ( $prices as $price ) { |
|
373 | - $counter ++; |
|
374 | - $level_text = apply_filters( 'give_form_level_text', ! empty( $price['_give_text'] ) ? $price['_give_text'] : give_currency_filter( give_format_amount( $price['_give_amount'] ) ), $form_id, $price ); |
|
375 | - $level_classes = apply_filters( 'give_form_level_classes', 'give-donation-level-btn give-btn give-btn-level-' . $counter . ' ' . ( ( isset( $price['_give_default'] ) && $price['_give_default'] === 'default' ) ? 'give-default-level' : '' ), $form_id, $price ); |
|
372 | + foreach ($prices as $price) { |
|
373 | + $counter++; |
|
374 | + $level_text = apply_filters('give_form_level_text', ! empty($price['_give_text']) ? $price['_give_text'] : give_currency_filter(give_format_amount($price['_give_amount'])), $form_id, $price); |
|
375 | + $level_classes = apply_filters('give_form_level_classes', 'give-donation-level-btn give-btn give-btn-level-'.$counter.' '.((isset($price['_give_default']) && $price['_give_default'] === 'default') ? 'give-default-level' : ''), $form_id, $price); |
|
376 | 376 | |
377 | 377 | $output .= '<li>'; |
378 | - $output .= '<button type="button" data-price-id="' . $price['_give_id']['level_id'] . '" class=" ' . $level_classes . '" value="' . give_format_amount( $price['_give_amount'] ) . '">'; |
|
378 | + $output .= '<button type="button" data-price-id="'.$price['_give_id']['level_id'].'" class=" '.$level_classes.'" value="'.give_format_amount($price['_give_amount']).'">'; |
|
379 | 379 | $output .= $level_text; |
380 | 380 | $output .= '</button>'; |
381 | 381 | $output .= '</li>'; |
@@ -383,7 +383,7 @@ discard block |
||
383 | 383 | } |
384 | 384 | |
385 | 385 | //Custom Amount |
386 | - if ( $custom_amount === 'yes' && ! empty( $custom_amount_text ) ) { |
|
386 | + if ($custom_amount === 'yes' && ! empty($custom_amount_text)) { |
|
387 | 387 | $output .= '<li>'; |
388 | 388 | $output .= '<button type="button" data-price-id="custom" class="give-donation-level-btn give-btn give-btn-level-custom" value="custom">'; |
389 | 389 | $output .= $custom_amount_text; |
@@ -399,23 +399,23 @@ discard block |
||
399 | 399 | |
400 | 400 | $output .= '<ul id="give-donation-level-radio-list" class="give-donation-levels-wrap">'; |
401 | 401 | |
402 | - foreach ( $prices as $price ) { |
|
403 | - $counter ++; |
|
404 | - $level_text = apply_filters( 'give_form_level_text', ! empty( $price['_give_text'] ) ? $price['_give_text'] : give_currency_filter( give_format_amount( $price['_give_amount'] ) ), $form_id, $price ); |
|
405 | - $level_classes = apply_filters( 'give_form_level_classes', 'give-radio-input give-radio-input-level give-radio-level-' . $counter . ( ( isset( $price['_give_default'] ) && $price['_give_default'] === 'default' ) ? ' give-default-level' : '' ), $form_id, $price ); |
|
402 | + foreach ($prices as $price) { |
|
403 | + $counter++; |
|
404 | + $level_text = apply_filters('give_form_level_text', ! empty($price['_give_text']) ? $price['_give_text'] : give_currency_filter(give_format_amount($price['_give_amount'])), $form_id, $price); |
|
405 | + $level_classes = apply_filters('give_form_level_classes', 'give-radio-input give-radio-input-level give-radio-level-'.$counter.((isset($price['_give_default']) && $price['_give_default'] === 'default') ? ' give-default-level' : ''), $form_id, $price); |
|
406 | 406 | |
407 | 407 | $output .= '<li>'; |
408 | - $output .= '<input type="radio" data-price-id="' . $price['_give_id']['level_id'] . '" class="' . $level_classes . '" name="give-radio-donation-level" id="give-radio-level-' . $counter . '" ' . ( ( isset( $price['_give_default'] ) && $price['_give_default'] === 'default' ) ? 'checked="checked"' : '' ) . ' value="' . give_format_amount( $price['_give_amount'] ) . '">'; |
|
409 | - $output .= '<label for="give-radio-level-' . $counter . '">' . $level_text . '</label>'; |
|
408 | + $output .= '<input type="radio" data-price-id="'.$price['_give_id']['level_id'].'" class="'.$level_classes.'" name="give-radio-donation-level" id="give-radio-level-'.$counter.'" '.((isset($price['_give_default']) && $price['_give_default'] === 'default') ? 'checked="checked"' : '').' value="'.give_format_amount($price['_give_amount']).'">'; |
|
409 | + $output .= '<label for="give-radio-level-'.$counter.'">'.$level_text.'</label>'; |
|
410 | 410 | $output .= '</li>'; |
411 | 411 | |
412 | 412 | } |
413 | 413 | |
414 | 414 | //Custom Amount |
415 | - if ( $custom_amount === 'yes' && ! empty( $custom_amount_text ) ) { |
|
415 | + if ($custom_amount === 'yes' && ! empty($custom_amount_text)) { |
|
416 | 416 | $output .= '<li>'; |
417 | 417 | $output .= '<input type="radio" data-price-id="custom" class="give-radio-input give-radio-input-level give-radio-level-custom" name="give-radio-donation-level" id="give-radio-level-custom" value="custom">'; |
418 | - $output .= '<label for="give-radio-level-custom">' . $custom_amount_text . '</label>'; |
|
418 | + $output .= '<label for="give-radio-level-custom">'.$custom_amount_text.'</label>'; |
|
419 | 419 | $output .= '</li>'; |
420 | 420 | } |
421 | 421 | |
@@ -425,23 +425,23 @@ discard block |
||
425 | 425 | |
426 | 426 | case 'dropdown': |
427 | 427 | |
428 | - $output .= '<label for="give-donation-level" class="give-hidden">' . __( 'Choose Your Donation Amount', 'give' ) . ':</label>'; |
|
429 | - $output .= '<select id="give-donation-level-' . $form_id . '" class="give-select give-select-level">'; |
|
428 | + $output .= '<label for="give-donation-level" class="give-hidden">'.__('Choose Your Donation Amount', 'give').':</label>'; |
|
429 | + $output .= '<select id="give-donation-level-'.$form_id.'" class="give-select give-select-level">'; |
|
430 | 430 | |
431 | 431 | //first loop through prices |
432 | - foreach ( $prices as $price ) { |
|
433 | - $level_text = apply_filters( 'give_form_level_text', ! empty( $price['_give_text'] ) ? $price['_give_text'] : give_currency_filter( give_format_amount( $price['_give_amount'] ) ), $form_id, $price ); |
|
434 | - $level_classes = apply_filters( 'give_form_level_classes', 'give-donation-level-' . $form_id . ( ( isset( $price['_give_default'] ) && $price['_give_default'] === 'default' ) ? ' give-default-level' : '' ), $form_id, $price ); |
|
432 | + foreach ($prices as $price) { |
|
433 | + $level_text = apply_filters('give_form_level_text', ! empty($price['_give_text']) ? $price['_give_text'] : give_currency_filter(give_format_amount($price['_give_amount'])), $form_id, $price); |
|
434 | + $level_classes = apply_filters('give_form_level_classes', 'give-donation-level-'.$form_id.((isset($price['_give_default']) && $price['_give_default'] === 'default') ? ' give-default-level' : ''), $form_id, $price); |
|
435 | 435 | |
436 | - $output .= '<option data-price-id="' . $price['_give_id']['level_id'] . '" class="' . $level_classes . '" ' . ( ( isset( $price['_give_default'] ) && $price['_give_default'] === 'default' ) ? 'selected="selected"' : '' ) . ' value="' . give_format_amount( $price['_give_amount'] ) . '">'; |
|
436 | + $output .= '<option data-price-id="'.$price['_give_id']['level_id'].'" class="'.$level_classes.'" '.((isset($price['_give_default']) && $price['_give_default'] === 'default') ? 'selected="selected"' : '').' value="'.give_format_amount($price['_give_amount']).'">'; |
|
437 | 437 | $output .= $level_text; |
438 | 438 | $output .= '</option>'; |
439 | 439 | |
440 | 440 | } |
441 | 441 | |
442 | 442 | //Custom Amount |
443 | - if ( $custom_amount === 'yes' && ! empty( $custom_amount_text ) ) { |
|
444 | - $output .= '<option data-price-id="custom" class="give-donation-level-custom" value="custom">' . $custom_amount_text . '</option>'; |
|
443 | + if ($custom_amount === 'yes' && ! empty($custom_amount_text)) { |
|
444 | + $output .= '<option data-price-id="custom" class="give-donation-level-custom" value="custom">'.$custom_amount_text.'</option>'; |
|
445 | 445 | } |
446 | 446 | |
447 | 447 | $output .= '</select>'; |
@@ -449,7 +449,7 @@ discard block |
||
449 | 449 | break; |
450 | 450 | } |
451 | 451 | |
452 | - echo apply_filters( 'give_form_level_output', $output, $form_id ); |
|
452 | + echo apply_filters('give_form_level_output', $output, $form_id); |
|
453 | 453 | } |
454 | 454 | |
455 | 455 | /** |
@@ -461,26 +461,26 @@ discard block |
||
461 | 461 | * @param array $args |
462 | 462 | * |
463 | 463 | */ |
464 | -function give_display_checkout_button( $form_id, $args ) { |
|
464 | +function give_display_checkout_button($form_id, $args) { |
|
465 | 465 | |
466 | - $display_option = ( isset( $args['display_style'] ) && ! empty( $args['display_style'] ) ) |
|
466 | + $display_option = (isset($args['display_style']) && ! empty($args['display_style'])) |
|
467 | 467 | ? $args['display_style'] |
468 | - : get_post_meta( $form_id, '_give_payment_display', true ); |
|
468 | + : get_post_meta($form_id, '_give_payment_display', true); |
|
469 | 469 | |
470 | 470 | //no btn for onpage |
471 | - if ( $display_option === 'onpage' ) { |
|
471 | + if ($display_option === 'onpage') { |
|
472 | 472 | return; |
473 | 473 | } |
474 | 474 | |
475 | - $display_label_field = get_post_meta( $form_id, '_give_reveal_label', true ); |
|
476 | - $display_label = ( ! empty( $display_label_field ) ? $display_label_field : __( 'Donate Now', 'give' ) ); |
|
475 | + $display_label_field = get_post_meta($form_id, '_give_reveal_label', true); |
|
476 | + $display_label = ( ! empty($display_label_field) ? $display_label_field : __('Donate Now', 'give')); |
|
477 | 477 | |
478 | - $output = '<button type="button" class="give-btn give-btn-' . $display_option . '">' . $display_label . '</button>'; |
|
478 | + $output = '<button type="button" class="give-btn give-btn-'.$display_option.'">'.$display_label.'</button>'; |
|
479 | 479 | |
480 | - echo apply_filters( 'give_display_checkout_button', $output ); |
|
480 | + echo apply_filters('give_display_checkout_button', $output); |
|
481 | 481 | } |
482 | 482 | |
483 | -add_action( 'give_after_donation_levels', 'give_display_checkout_button', 10, 2 ); |
|
483 | +add_action('give_after_donation_levels', 'give_display_checkout_button', 10, 2); |
|
484 | 484 | |
485 | 485 | /** |
486 | 486 | * Shows the User Info fields in the Personal Info box, more fields can be added via the hooks provided. |
@@ -491,71 +491,71 @@ discard block |
||
491 | 491 | * |
492 | 492 | * @return void |
493 | 493 | */ |
494 | -function give_user_info_fields( $form_id ) { |
|
494 | +function give_user_info_fields($form_id) { |
|
495 | 495 | |
496 | - if ( is_user_logged_in() ) : |
|
497 | - $user_data = get_userdata( get_current_user_id() ); |
|
496 | + if (is_user_logged_in()) : |
|
497 | + $user_data = get_userdata(get_current_user_id()); |
|
498 | 498 | endif; |
499 | 499 | |
500 | - do_action( 'give_purchase_form_before_personal_info', $form_id ); |
|
500 | + do_action('give_purchase_form_before_personal_info', $form_id); |
|
501 | 501 | ?> |
502 | 502 | <fieldset id="give_checkout_user_info"> |
503 | - <legend><?php echo apply_filters( 'give_checkout_personal_info_text', __( 'Personal Info', 'give' ) ); ?></legend> |
|
503 | + <legend><?php echo apply_filters('give_checkout_personal_info_text', __('Personal Info', 'give')); ?></legend> |
|
504 | 504 | <p id="give-first-name-wrap" class="form-row form-row-first"> |
505 | 505 | <label class="give-label" for="give-first"> |
506 | - <?php _e( 'First Name', 'give' ); ?> |
|
507 | - <?php if ( give_field_is_required( 'give_first', $form_id ) ) { ?> |
|
506 | + <?php _e('First Name', 'give'); ?> |
|
507 | + <?php if (give_field_is_required('give_first', $form_id)) { ?> |
|
508 | 508 | <span class="give-required-indicator">*</span> |
509 | 509 | <?php } ?> |
510 | - <span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php _e( 'We will use this to personalize your account experience.', 'give' ); ?>"></span> |
|
510 | + <span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php _e('We will use this to personalize your account experience.', 'give'); ?>"></span> |
|
511 | 511 | </label> |
512 | - <input class="give-input required" type="text" name="give_first" placeholder="<?php _e( 'First name', 'give' ); ?>" id="give-first" value="<?php echo is_user_logged_in() ? $user_data->first_name : ''; ?>"<?php if ( give_field_is_required( 'give_first', $form_id ) ) { |
|
512 | + <input class="give-input required" type="text" name="give_first" placeholder="<?php _e('First name', 'give'); ?>" id="give-first" value="<?php echo is_user_logged_in() ? $user_data->first_name : ''; ?>"<?php if (give_field_is_required('give_first', $form_id)) { |
|
513 | 513 | echo ' required '; |
514 | 514 | } ?>/> |
515 | 515 | </p> |
516 | 516 | |
517 | 517 | <p id="give-last-name-wrap" class="form-row form-row-last"> |
518 | 518 | <label class="give-label" for="give-last"> |
519 | - <?php _e( 'Last Name', 'give' ); ?> |
|
520 | - <?php if ( give_field_is_required( 'give_last', $form_id ) ) { ?> |
|
519 | + <?php _e('Last Name', 'give'); ?> |
|
520 | + <?php if (give_field_is_required('give_last', $form_id)) { ?> |
|
521 | 521 | <span class="give-required-indicator">*</span> |
522 | 522 | <?php } ?> |
523 | - <span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php _e( 'We will use this as well to personalize your account experience.', 'give' ); ?>"></span> |
|
523 | + <span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php _e('We will use this as well to personalize your account experience.', 'give'); ?>"></span> |
|
524 | 524 | </label> |
525 | 525 | |
526 | - <input class="give-input<?php if ( give_field_is_required( 'give_last', $form_id ) ) { |
|
526 | + <input class="give-input<?php if (give_field_is_required('give_last', $form_id)) { |
|
527 | 527 | echo ' required'; |
528 | - } ?>" type="text" name="give_last" id="give-last" placeholder="<?php _e( 'Last name', 'give' ); ?>" value="<?php echo is_user_logged_in() ? $user_data->last_name : ''; ?>"<?php if ( give_field_is_required( 'give_last', $form_id ) ) { |
|
528 | + } ?>" type="text" name="give_last" id="give-last" placeholder="<?php _e('Last name', 'give'); ?>" value="<?php echo is_user_logged_in() ? $user_data->last_name : ''; ?>"<?php if (give_field_is_required('give_last', $form_id)) { |
|
529 | 529 | echo ' required '; |
530 | 530 | } ?> /> |
531 | 531 | </p> |
532 | 532 | |
533 | - <?php do_action( 'give_purchase_form_before_email', $form_id ); ?> |
|
533 | + <?php do_action('give_purchase_form_before_email', $form_id); ?> |
|
534 | 534 | <p id="give-email-wrap" class="form-row form-row-wide"> |
535 | 535 | <label class="give-label" for="give-email"> |
536 | - <?php _e( 'Email Address', 'give' ); ?> |
|
537 | - <?php if ( give_field_is_required( 'give_email', $form_id ) ) { ?> |
|
536 | + <?php _e('Email Address', 'give'); ?> |
|
537 | + <?php if (give_field_is_required('give_email', $form_id)) { ?> |
|
538 | 538 | <span class="give-required-indicator">*</span> |
539 | 539 | <?php } ?> |
540 | - <span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php _e( 'We will send the purchase receipt to this address.', 'give' ); ?>"></span> |
|
540 | + <span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php _e('We will send the purchase receipt to this address.', 'give'); ?>"></span> |
|
541 | 541 | </label> |
542 | 542 | |
543 | - <input class="give-input required" type="email" name="give_email" placeholder="<?php _e( 'Email address', 'give' ); ?>" id="give-email" value="<?php echo is_user_logged_in() ? $user_data->user_email : ''; ?>"<?php if ( give_field_is_required( 'give_email', $form_id ) ) { |
|
543 | + <input class="give-input required" type="email" name="give_email" placeholder="<?php _e('Email address', 'give'); ?>" id="give-email" value="<?php echo is_user_logged_in() ? $user_data->user_email : ''; ?>"<?php if (give_field_is_required('give_email', $form_id)) { |
|
544 | 544 | echo ' required '; |
545 | 545 | } ?>/> |
546 | 546 | |
547 | 547 | </p> |
548 | - <?php do_action( 'give_purchase_form_after_email', $form_id ); ?> |
|
548 | + <?php do_action('give_purchase_form_after_email', $form_id); ?> |
|
549 | 549 | |
550 | - <?php do_action( 'give_purchase_form_user_info', $form_id ); ?> |
|
550 | + <?php do_action('give_purchase_form_user_info', $form_id); ?> |
|
551 | 551 | </fieldset> |
552 | 552 | <?php |
553 | - do_action( 'give_purchase_form_after_personal_info', $form_id ); |
|
553 | + do_action('give_purchase_form_after_personal_info', $form_id); |
|
554 | 554 | |
555 | 555 | } |
556 | 556 | |
557 | -add_action( 'give_purchase_form_after_user_info', 'give_user_info_fields' ); |
|
558 | -add_action( 'give_register_fields_before', 'give_user_info_fields' ); |
|
557 | +add_action('give_purchase_form_after_user_info', 'give_user_info_fields'); |
|
558 | +add_action('give_register_fields_before', 'give_user_info_fields'); |
|
559 | 559 | |
560 | 560 | /** |
561 | 561 | * Renders the credit card info form. |
@@ -566,73 +566,73 @@ discard block |
||
566 | 566 | * |
567 | 567 | * @return void |
568 | 568 | */ |
569 | -function give_get_cc_form( $form_id ) { |
|
569 | +function give_get_cc_form($form_id) { |
|
570 | 570 | |
571 | 571 | ob_start(); |
572 | 572 | |
573 | - do_action( 'give_before_cc_fields', $form_id ); ?> |
|
573 | + do_action('give_before_cc_fields', $form_id); ?> |
|
574 | 574 | |
575 | 575 | <fieldset id="give_cc_fields-<?php echo $form_id ?>" class="give-do-validate"> |
576 | - <legend><?php echo apply_filters( 'give_credit_card_fieldset_heading', __( 'Credit Card Info', 'give' ) ); ?></legend> |
|
577 | - <?php if ( is_ssl() ) : ?> |
|
576 | + <legend><?php echo apply_filters('give_credit_card_fieldset_heading', __('Credit Card Info', 'give')); ?></legend> |
|
577 | + <?php if (is_ssl()) : ?> |
|
578 | 578 | <div id="give_secure_site_wrapper-<?php echo $form_id ?>"> |
579 | 579 | <span class="give-icon padlock"></span> |
580 | - <span><?php _e( 'This is a secure SSL encrypted payment.', 'give' ); ?></span> |
|
580 | + <span><?php _e('This is a secure SSL encrypted payment.', 'give'); ?></span> |
|
581 | 581 | </div> |
582 | 582 | <?php endif; ?> |
583 | 583 | <p id="give-card-number-wrap-<?php echo $form_id ?>" class="form-row form-row-two-thirds"> |
584 | 584 | <label for="card_number-<?php echo $form_id ?>" class="give-label"> |
585 | - <?php _e( 'Card Number', 'give' ); ?> |
|
585 | + <?php _e('Card Number', 'give'); ?> |
|
586 | 586 | <span class="give-required-indicator">*</span> |
587 | - <span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php _e( 'The (typically) 16 digits on the front of your credit card.', 'give' ); ?>"></span> |
|
587 | + <span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php _e('The (typically) 16 digits on the front of your credit card.', 'give'); ?>"></span> |
|
588 | 588 | <span class="card-type"></span> |
589 | 589 | </label> |
590 | 590 | |
591 | - <input type="tel" autocomplete="off" name="card_number" id="card_number-<?php echo $form_id ?>" class="card-number give-input required" placeholder="<?php _e( 'Card number', 'give' ); ?>" required/> |
|
591 | + <input type="tel" autocomplete="off" name="card_number" id="card_number-<?php echo $form_id ?>" class="card-number give-input required" placeholder="<?php _e('Card number', 'give'); ?>" required/> |
|
592 | 592 | </p> |
593 | 593 | |
594 | 594 | <p id="give-card-cvc-wrap-<?php echo $form_id ?>" class="form-row form-row-one-third"> |
595 | 595 | <label for="card_cvc-<?php echo $form_id ?>" class="give-label"> |
596 | - <?php _e( 'CVC', 'give' ); ?> |
|
596 | + <?php _e('CVC', 'give'); ?> |
|
597 | 597 | <span class="give-required-indicator">*</span> |
598 | - <span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php _e( 'The 3 digit (back) or 4 digit (front) value on your card.', 'give' ); ?>"></span> |
|
598 | + <span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php _e('The 3 digit (back) or 4 digit (front) value on your card.', 'give'); ?>"></span> |
|
599 | 599 | </label> |
600 | 600 | |
601 | - <input type="tel" size="4" autocomplete="off" name="card_cvc" id="card_cvc-<?php echo $form_id ?>" class="card-cvc give-input required" placeholder="<?php _e( 'Security code', 'give' ); ?>" required/> |
|
601 | + <input type="tel" size="4" autocomplete="off" name="card_cvc" id="card_cvc-<?php echo $form_id ?>" class="card-cvc give-input required" placeholder="<?php _e('Security code', 'give'); ?>" required/> |
|
602 | 602 | </p> |
603 | 603 | |
604 | 604 | <p id="give-card-name-wrap-<?php echo $form_id ?>" class="form-row form-row-two-thirds"> |
605 | 605 | <label for="card_name-<?php echo $form_id ?>" class="give-label"> |
606 | - <?php _e( 'Name on the Card', 'give' ); ?> |
|
606 | + <?php _e('Name on the Card', 'give'); ?> |
|
607 | 607 | <span class="give-required-indicator">*</span> |
608 | - <span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php _e( 'The name printed on the front of your credit card.', 'give' ); ?>"></span> |
|
608 | + <span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php _e('The name printed on the front of your credit card.', 'give'); ?>"></span> |
|
609 | 609 | </label> |
610 | 610 | |
611 | - <input type="text" autocomplete="off" name="card_name" id="card_name-<?php echo $form_id ?>" class="card-name give-input required" placeholder="<?php _e( 'Card name', 'give' ); ?>" required/> |
|
611 | + <input type="text" autocomplete="off" name="card_name" id="card_name-<?php echo $form_id ?>" class="card-name give-input required" placeholder="<?php _e('Card name', 'give'); ?>" required/> |
|
612 | 612 | </p> |
613 | - <?php do_action( 'give_before_cc_expiration' ); ?> |
|
613 | + <?php do_action('give_before_cc_expiration'); ?> |
|
614 | 614 | <p class="card-expiration form-row form-row-one-third"> |
615 | 615 | <label for="card_expiry-<?php echo $form_id ?>" class="give-label"> |
616 | - <?php _e( 'Expiration', 'give' ); ?> |
|
616 | + <?php _e('Expiration', 'give'); ?> |
|
617 | 617 | <span class="give-required-indicator">*</span> |
618 | - <span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php _e( 'The date your credit card expires, typically on the front of the card.', 'give' ); ?>"></span> |
|
618 | + <span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php _e('The date your credit card expires, typically on the front of the card.', 'give'); ?>"></span> |
|
619 | 619 | </label> |
620 | 620 | |
621 | 621 | <input type="hidden" id="card_exp_month-<?php echo $form_id ?>" name="card_exp_month" class="card-expiry-month"/> |
622 | 622 | <input type="hidden" id="card_exp_year-<?php echo $form_id ?>" name="card_exp_year" class="card-expiry-year"/> |
623 | 623 | |
624 | - <input type="tel" autocomplete="off" name="card_expiry" id="card_expiry-<?php echo $form_id ?>" class="card-expiry give-input required" placeholder="<?php _e( 'MM / YY', 'give' ); ?>" required/> |
|
624 | + <input type="tel" autocomplete="off" name="card_expiry" id="card_expiry-<?php echo $form_id ?>" class="card-expiry give-input required" placeholder="<?php _e('MM / YY', 'give'); ?>" required/> |
|
625 | 625 | </p> |
626 | - <?php do_action( 'give_after_cc_expiration', $form_id ); ?> |
|
626 | + <?php do_action('give_after_cc_expiration', $form_id); ?> |
|
627 | 627 | |
628 | 628 | </fieldset> |
629 | 629 | <?php |
630 | - do_action( 'give_after_cc_fields', $form_id ); |
|
630 | + do_action('give_after_cc_fields', $form_id); |
|
631 | 631 | |
632 | 632 | echo ob_get_clean(); |
633 | 633 | } |
634 | 634 | |
635 | -add_action( 'give_cc_form', 'give_get_cc_form' ); |
|
635 | +add_action('give_cc_form', 'give_get_cc_form'); |
|
636 | 636 | |
637 | 637 | /** |
638 | 638 | * Outputs the default credit card address fields |
@@ -643,110 +643,110 @@ discard block |
||
643 | 643 | * |
644 | 644 | * @return void |
645 | 645 | */ |
646 | -function give_default_cc_address_fields( $form_id ) { |
|
646 | +function give_default_cc_address_fields($form_id) { |
|
647 | 647 | |
648 | 648 | $logged_in = is_user_logged_in(); |
649 | 649 | |
650 | - if ( $logged_in ) { |
|
651 | - $user_address = get_user_meta( get_current_user_id(), '_give_user_address', true ); |
|
650 | + if ($logged_in) { |
|
651 | + $user_address = get_user_meta(get_current_user_id(), '_give_user_address', true); |
|
652 | 652 | } |
653 | - $line1 = $logged_in && ! empty( $user_address['line1'] ) ? $user_address['line1'] : ''; |
|
654 | - $line2 = $logged_in && ! empty( $user_address['line2'] ) ? $user_address['line2'] : ''; |
|
655 | - $city = $logged_in && ! empty( $user_address['city'] ) ? $user_address['city'] : ''; |
|
656 | - $zip = $logged_in && ! empty( $user_address['zip'] ) ? $user_address['zip'] : ''; |
|
653 | + $line1 = $logged_in && ! empty($user_address['line1']) ? $user_address['line1'] : ''; |
|
654 | + $line2 = $logged_in && ! empty($user_address['line2']) ? $user_address['line2'] : ''; |
|
655 | + $city = $logged_in && ! empty($user_address['city']) ? $user_address['city'] : ''; |
|
656 | + $zip = $logged_in && ! empty($user_address['zip']) ? $user_address['zip'] : ''; |
|
657 | 657 | ob_start(); ?> |
658 | 658 | <fieldset id="give_cc_address" class="cc-address"> |
659 | - <legend><?php echo apply_filters( 'give_billing_details_fieldset_heading', __( 'Billing Details', 'give' ) ); ?></legend> |
|
660 | - <?php do_action( 'give_cc_billing_top' ); ?> |
|
659 | + <legend><?php echo apply_filters('give_billing_details_fieldset_heading', __('Billing Details', 'give')); ?></legend> |
|
660 | + <?php do_action('give_cc_billing_top'); ?> |
|
661 | 661 | <p id="give-card-address-wrap" class="form-row form-row-two-thirds"> |
662 | 662 | <label for="card_address" class="give-label"> |
663 | - <?php _e( 'Address', 'give' ); ?> |
|
663 | + <?php _e('Address', 'give'); ?> |
|
664 | 664 | <?php |
665 | - if ( give_field_is_required( 'card_address', $form_id ) ) { ?> |
|
665 | + if (give_field_is_required('card_address', $form_id)) { ?> |
|
666 | 666 | <span class="give-required-indicator">*</span> |
667 | 667 | <?php } ?> |
668 | - <span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php _e( 'The primary billing address for your credit card.', 'give' ); ?>"></span> |
|
668 | + <span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php _e('The primary billing address for your credit card.', 'give'); ?>"></span> |
|
669 | 669 | </label> |
670 | 670 | |
671 | - <input type="text" id="card_address" name="card_address" class="card-address give-input<?php if ( give_field_is_required( 'card_address', $form_id ) ) { |
|
671 | + <input type="text" id="card_address" name="card_address" class="card-address give-input<?php if (give_field_is_required('card_address', $form_id)) { |
|
672 | 672 | echo ' required'; |
673 | - } ?>" placeholder="<?php _e( 'Address line 1', 'give' ); ?>" value="<?php echo $line1; ?>"<?php if ( give_field_is_required( 'card_address', $form_id ) ) { |
|
673 | + } ?>" placeholder="<?php _e('Address line 1', 'give'); ?>" value="<?php echo $line1; ?>"<?php if (give_field_is_required('card_address', $form_id)) { |
|
674 | 674 | echo ' required '; |
675 | 675 | } ?>/> |
676 | 676 | </p> |
677 | 677 | |
678 | 678 | <p id="give-card-address-2-wrap" class="form-row form-row-one-third"> |
679 | 679 | <label for="card_address_2" class="give-label"> |
680 | - <?php _e( 'Address Line 2', 'give' ); ?> |
|
681 | - <?php if ( give_field_is_required( 'card_address_2', $form_id ) ) { ?> |
|
680 | + <?php _e('Address Line 2', 'give'); ?> |
|
681 | + <?php if (give_field_is_required('card_address_2', $form_id)) { ?> |
|
682 | 682 | <span class="give-required-indicator">*</span> |
683 | 683 | <?php } ?> |
684 | - <span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php _e( '(optional) The suite, apt no, PO box, etc, associated with your billing address.', 'give' ); ?>"></span> |
|
684 | + <span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php _e('(optional) The suite, apt no, PO box, etc, associated with your billing address.', 'give'); ?>"></span> |
|
685 | 685 | </label> |
686 | 686 | |
687 | - <input type="text" id="card_address_2" name="card_address_2" class="card-address-2 give-input<?php if ( give_field_is_required( 'card_address_2', $form_id ) ) { |
|
687 | + <input type="text" id="card_address_2" name="card_address_2" class="card-address-2 give-input<?php if (give_field_is_required('card_address_2', $form_id)) { |
|
688 | 688 | echo ' required'; |
689 | - } ?>" placeholder="<?php _e( 'Address line 2', 'give' ); ?>" value="<?php echo $line2; ?>"<?php if ( give_field_is_required( 'card_address_2', $form_id ) ) { |
|
689 | + } ?>" placeholder="<?php _e('Address line 2', 'give'); ?>" value="<?php echo $line2; ?>"<?php if (give_field_is_required('card_address_2', $form_id)) { |
|
690 | 690 | echo ' required '; |
691 | 691 | } ?>/> |
692 | 692 | </p> |
693 | 693 | |
694 | 694 | <p id="give-card-city-wrap" class="form-row form-row-two-thirds"> |
695 | 695 | <label for="card_city" class="give-label"> |
696 | - <?php _e( 'City', 'give' ); ?> |
|
697 | - <?php if ( give_field_is_required( 'card_city', $form_id ) ) { ?> |
|
696 | + <?php _e('City', 'give'); ?> |
|
697 | + <?php if (give_field_is_required('card_city', $form_id)) { ?> |
|
698 | 698 | <span class="give-required-indicator">*</span> |
699 | 699 | <?php } ?> |
700 | - <span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php _e( 'The city for your billing address.', 'give' ); ?>"></span> |
|
700 | + <span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php _e('The city for your billing address.', 'give'); ?>"></span> |
|
701 | 701 | </label> |
702 | - <input type="text" id="card_city" name="card_city" class="card-city give-input<?php if ( give_field_is_required( 'card_city', $form_id ) ) { |
|
702 | + <input type="text" id="card_city" name="card_city" class="card-city give-input<?php if (give_field_is_required('card_city', $form_id)) { |
|
703 | 703 | echo ' required'; |
704 | - } ?>" placeholder="<?php _e( 'City', 'give' ); ?>" value="<?php echo $city; ?>"<?php if ( give_field_is_required( 'card_city', $form_id ) ) { |
|
704 | + } ?>" placeholder="<?php _e('City', 'give'); ?>" value="<?php echo $city; ?>"<?php if (give_field_is_required('card_city', $form_id)) { |
|
705 | 705 | echo ' required '; |
706 | 706 | } ?>/> |
707 | 707 | </p> |
708 | 708 | |
709 | 709 | <p id="give-card-zip-wrap" class="form-row form-row-one-third"> |
710 | 710 | <label for="card_zip" class="give-label"> |
711 | - <?php _e( 'Zip / Postal Code', 'give' ); ?> |
|
712 | - <?php if ( give_field_is_required( 'card_zip', $form_id ) ) { ?> |
|
711 | + <?php _e('Zip / Postal Code', 'give'); ?> |
|
712 | + <?php if (give_field_is_required('card_zip', $form_id)) { ?> |
|
713 | 713 | <span class="give-required-indicator">*</span> |
714 | 714 | <?php } ?> |
715 | - <span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php _e( 'The zip or postal code for your billing address.', 'give' ); ?>"></span> |
|
715 | + <span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php _e('The zip or postal code for your billing address.', 'give'); ?>"></span> |
|
716 | 716 | </label> |
717 | 717 | |
718 | - <input type="text" size="4" id="card_zip" name="card_zip" class="card-zip give-input<?php if ( give_field_is_required( 'card_zip', $form_id ) ) { |
|
718 | + <input type="text" size="4" id="card_zip" name="card_zip" class="card-zip give-input<?php if (give_field_is_required('card_zip', $form_id)) { |
|
719 | 719 | echo ' required'; |
720 | - } ?>" placeholder="<?php _e( 'Zip / Postal code', 'give' ); ?>" value="<?php echo $zip; ?>" <?php if ( give_field_is_required( 'card_zip', $form_id ) ) { |
|
720 | + } ?>" placeholder="<?php _e('Zip / Postal code', 'give'); ?>" value="<?php echo $zip; ?>" <?php if (give_field_is_required('card_zip', $form_id)) { |
|
721 | 721 | echo ' required '; |
722 | 722 | } ?>/> |
723 | 723 | </p> |
724 | 724 | |
725 | 725 | <p id="give-card-country-wrap" class="form-row form-row-first"> |
726 | 726 | <label for="billing_country" class="give-label"> |
727 | - <?php _e( 'Country', 'give' ); ?> |
|
728 | - <?php if ( give_field_is_required( 'billing_country', $form_id ) ) { ?> |
|
727 | + <?php _e('Country', 'give'); ?> |
|
728 | + <?php if (give_field_is_required('billing_country', $form_id)) { ?> |
|
729 | 729 | <span class="give-required-indicator">*</span> |
730 | 730 | <?php } ?> |
731 | - <span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php _e( 'The country for your billing address.', 'give' ); ?>"></span> |
|
731 | + <span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php _e('The country for your billing address.', 'give'); ?>"></span> |
|
732 | 732 | </label> |
733 | 733 | |
734 | - <select name="billing_country" id="billing_country" class="billing-country billing_country give-select<?php if ( give_field_is_required( 'billing_country', $form_id ) ) { |
|
734 | + <select name="billing_country" id="billing_country" class="billing-country billing_country give-select<?php if (give_field_is_required('billing_country', $form_id)) { |
|
735 | 735 | echo ' required'; |
736 | - } ?>"<?php if ( give_field_is_required( 'billing_country', $form_id ) ) { |
|
736 | + } ?>"<?php if (give_field_is_required('billing_country', $form_id)) { |
|
737 | 737 | echo ' required '; |
738 | 738 | } ?>> |
739 | 739 | <?php |
740 | 740 | |
741 | 741 | $selected_country = give_get_country(); |
742 | 742 | |
743 | - if ( $logged_in && ! empty( $user_address['country'] ) && '*' !== $user_address['country'] ) { |
|
743 | + if ($logged_in && ! empty($user_address['country']) && '*' !== $user_address['country']) { |
|
744 | 744 | $selected_country = $user_address['country']; |
745 | 745 | } |
746 | 746 | |
747 | 747 | $countries = give_get_country_list(); |
748 | - foreach ( $countries as $country_code => $country ) { |
|
749 | - echo '<option value="' . esc_attr( $country_code ) . '"' . selected( $country_code, $selected_country, false ) . '>' . $country . '</option>'; |
|
748 | + foreach ($countries as $country_code => $country) { |
|
749 | + echo '<option value="'.esc_attr($country_code).'"'.selected($country_code, $selected_country, false).'>'.$country.'</option>'; |
|
750 | 750 | } |
751 | 751 | ?> |
752 | 752 | </select> |
@@ -754,44 +754,44 @@ discard block |
||
754 | 754 | |
755 | 755 | <p id="give-card-state-wrap" class="form-row form-row-last"> |
756 | 756 | <label for="card_state" class="give-label"> |
757 | - <?php _e( 'State / Province', 'give' ); ?> |
|
758 | - <?php if ( give_field_is_required( 'card_state', $form_id ) ) { ?> |
|
757 | + <?php _e('State / Province', 'give'); ?> |
|
758 | + <?php if (give_field_is_required('card_state', $form_id)) { ?> |
|
759 | 759 | <span class="give-required-indicator">*</span> |
760 | 760 | <?php } ?> |
761 | - <span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php _e( 'The state or province for your billing address.', 'give' ); ?>"></span> |
|
761 | + <span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php _e('The state or province for your billing address.', 'give'); ?>"></span> |
|
762 | 762 | </label> |
763 | 763 | |
764 | 764 | <?php |
765 | 765 | $selected_state = give_get_state(); |
766 | - $states = give_get_states( $selected_country ); |
|
766 | + $states = give_get_states($selected_country); |
|
767 | 767 | |
768 | - if ( $logged_in && ! empty( $user_address['state'] ) ) { |
|
768 | + if ($logged_in && ! empty($user_address['state'])) { |
|
769 | 769 | $selected_state = $user_address['state']; |
770 | 770 | } |
771 | 771 | |
772 | - if ( ! empty( $states ) ) : ?> |
|
773 | - <select name="card_state" id="card_state" class="card_state give-select<?php if ( give_field_is_required( 'card_state', $form_id ) ) { |
|
772 | + if ( ! empty($states)) : ?> |
|
773 | + <select name="card_state" id="card_state" class="card_state give-select<?php if (give_field_is_required('card_state', $form_id)) { |
|
774 | 774 | echo ' required'; |
775 | - } ?>"<?php if ( give_field_is_required( 'card_state', $form_id ) ) { |
|
775 | + } ?>"<?php if (give_field_is_required('card_state', $form_id)) { |
|
776 | 776 | echo ' required '; |
777 | 777 | } ?>> |
778 | 778 | <?php |
779 | - foreach ( $states as $state_code => $state ) { |
|
780 | - echo '<option value="' . $state_code . '"' . selected( $state_code, $selected_state, false ) . '>' . $state . '</option>'; |
|
779 | + foreach ($states as $state_code => $state) { |
|
780 | + echo '<option value="'.$state_code.'"'.selected($state_code, $selected_state, false).'>'.$state.'</option>'; |
|
781 | 781 | } |
782 | 782 | ?> |
783 | 783 | </select> |
784 | 784 | <?php else : ?> |
785 | - <input type="text" size="6" name="card_state" id="card_state" class="card_state give-input" placeholder="<?php _e( 'State / Province', 'give' ); ?>"/> |
|
785 | + <input type="text" size="6" name="card_state" id="card_state" class="card_state give-input" placeholder="<?php _e('State / Province', 'give'); ?>"/> |
|
786 | 786 | <?php endif; ?> |
787 | 787 | </p> |
788 | - <?php do_action( 'give_cc_billing_bottom' ); ?> |
|
788 | + <?php do_action('give_cc_billing_bottom'); ?> |
|
789 | 789 | </fieldset> |
790 | 790 | <?php |
791 | 791 | echo ob_get_clean(); |
792 | 792 | } |
793 | 793 | |
794 | -add_action( 'give_after_cc_fields', 'give_default_cc_address_fields' ); |
|
794 | +add_action('give_after_cc_fields', 'give_default_cc_address_fields'); |
|
795 | 795 | |
796 | 796 | |
797 | 797 | /** |
@@ -803,93 +803,93 @@ discard block |
||
803 | 803 | * |
804 | 804 | * @return string |
805 | 805 | */ |
806 | -function give_get_register_fields( $form_id ) { |
|
806 | +function give_get_register_fields($form_id) { |
|
807 | 807 | |
808 | 808 | global $user_ID; |
809 | 809 | |
810 | - if ( is_user_logged_in() ) { |
|
811 | - $user_data = get_userdata( $user_ID ); |
|
810 | + if (is_user_logged_in()) { |
|
811 | + $user_data = get_userdata($user_ID); |
|
812 | 812 | } |
813 | 813 | |
814 | - $show_register_form = give_show_login_register_option( $form_id ); |
|
814 | + $show_register_form = give_show_login_register_option($form_id); |
|
815 | 815 | |
816 | 816 | ob_start(); ?> |
817 | 817 | <fieldset id="give-register-fields-<?php echo $form_id; ?>"> |
818 | 818 | |
819 | - <?php if ( $show_register_form == 'both' ) { ?> |
|
819 | + <?php if ($show_register_form == 'both') { ?> |
|
820 | 820 | <div class="give-login-account-wrap"> |
821 | - <p class="give-login-message"><?php _e( 'Already have an account?', 'give' ); ?> |
|
822 | - <a href="<?php echo esc_url( add_query_arg( 'login', 1 ) ); ?>" class="give-checkout-login" data-action="give_checkout_login"><?php _e( 'Login', 'give' ); ?></a> |
|
821 | + <p class="give-login-message"><?php _e('Already have an account?', 'give'); ?> |
|
822 | + <a href="<?php echo esc_url(add_query_arg('login', 1)); ?>" class="give-checkout-login" data-action="give_checkout_login"><?php _e('Login', 'give'); ?></a> |
|
823 | 823 | </p> |
824 | 824 | <p class="give-loading-text"> |
825 | - <span class="give-loading-animation"></span> <?php _e( 'Loading...', 'give' ); ?></p> |
|
825 | + <span class="give-loading-animation"></span> <?php _e('Loading...', 'give'); ?></p> |
|
826 | 826 | </div> |
827 | 827 | <?php } ?> |
828 | 828 | |
829 | - <?php do_action( 'give_register_fields_before', $form_id ); ?> |
|
829 | + <?php do_action('give_register_fields_before', $form_id); ?> |
|
830 | 830 | |
831 | 831 | <fieldset id="give-register-account-fields-<?php echo $form_id; ?>"> |
832 | - <legend><?php echo apply_filters( 'give_create_account_fieldset_heading', __( 'Create an account', 'give' ) ); |
|
833 | - if ( ! give_logged_in_only( $form_id ) ) { |
|
834 | - echo ' <span class="sub-text">' . __( '(optional)', 'give' ) . '</span>'; |
|
832 | + <legend><?php echo apply_filters('give_create_account_fieldset_heading', __('Create an account', 'give')); |
|
833 | + if ( ! give_logged_in_only($form_id)) { |
|
834 | + echo ' <span class="sub-text">'.__('(optional)', 'give').'</span>'; |
|
835 | 835 | } ?></legend> |
836 | - <?php do_action( 'give_register_account_fields_before', $form_id ); ?> |
|
836 | + <?php do_action('give_register_account_fields_before', $form_id); ?> |
|
837 | 837 | <div id="give-user-login-wrap-<?php echo $form_id; ?>" class="form-row form-row-one-third form-row-first"> |
838 | 838 | <label for="give-user-login-<?php echo $form_id; ?>"> |
839 | - <?php _e( 'Username', 'give' ); ?> |
|
840 | - <?php if ( give_logged_in_only( $form_id ) ) { ?> |
|
839 | + <?php _e('Username', 'give'); ?> |
|
840 | + <?php if (give_logged_in_only($form_id)) { ?> |
|
841 | 841 | <span class="give-required-indicator">*</span> |
842 | 842 | <?php } ?> |
843 | - <span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php _e( 'The username you will use to log into your account.', 'give' ); ?>"></span> |
|
843 | + <span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php _e('The username you will use to log into your account.', 'give'); ?>"></span> |
|
844 | 844 | </label> |
845 | 845 | |
846 | - <input name="give_user_login" id="give-user-login-<?php echo $form_id; ?>" class="<?php if ( give_logged_in_only( $form_id ) ) { |
|
846 | + <input name="give_user_login" id="give-user-login-<?php echo $form_id; ?>" class="<?php if (give_logged_in_only($form_id)) { |
|
847 | 847 | echo 'required '; |
848 | - } ?>give-input" type="text" placeholder="<?php _e( 'Username', 'give' ); ?>" title="<?php _e( 'Username', 'give' ); ?>"/> |
|
848 | + } ?>give-input" type="text" placeholder="<?php _e('Username', 'give'); ?>" title="<?php _e('Username', 'give'); ?>"/> |
|
849 | 849 | </div> |
850 | 850 | |
851 | 851 | <div id="give-user-pass-wrap-<?php echo $form_id; ?>" class="form-row form-row-one-third"> |
852 | 852 | <label for="give-user-pass-<?php echo $form_id; ?>"> |
853 | - <?php _e( 'Password', 'give' ); ?> |
|
854 | - <?php if ( give_logged_in_only( $form_id ) ) { ?> |
|
853 | + <?php _e('Password', 'give'); ?> |
|
854 | + <?php if (give_logged_in_only($form_id)) { ?> |
|
855 | 855 | <span class="give-required-indicator">*</span> |
856 | 856 | <?php } ?> |
857 | - <span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php _e( 'The password used to access your account.', 'give' ); ?>"></span> |
|
857 | + <span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php _e('The password used to access your account.', 'give'); ?>"></span> |
|
858 | 858 | </label> |
859 | 859 | |
860 | - <input name="give_user_pass" id="give-user-pass-<?php echo $form_id; ?>" class="<?php if ( give_logged_in_only( $form_id ) ) { |
|
860 | + <input name="give_user_pass" id="give-user-pass-<?php echo $form_id; ?>" class="<?php if (give_logged_in_only($form_id)) { |
|
861 | 861 | echo 'required '; |
862 | - } ?>give-input" placeholder="<?php _e( 'Password', 'give' ); ?>" type="password"/> |
|
862 | + } ?>give-input" placeholder="<?php _e('Password', 'give'); ?>" type="password"/> |
|
863 | 863 | </div> |
864 | 864 | |
865 | 865 | <div id="give-user-pass-confirm-wrap-<?php echo $form_id; ?>" class="give-register-password form-row form-row-one-third"> |
866 | 866 | <label for="give-user-pass-confirm-<?php echo $form_id; ?>"> |
867 | - <?php _e( 'Confirm PW', 'give' ); ?> |
|
868 | - <?php if ( give_logged_in_only( $form_id ) ) { ?> |
|
867 | + <?php _e('Confirm PW', 'give'); ?> |
|
868 | + <?php if (give_logged_in_only($form_id)) { ?> |
|
869 | 869 | <span class="give-required-indicator">*</span> |
870 | 870 | <?php } ?> |
871 | - <span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php _e( 'Please retype your password to confirm.', 'give' ); ?>"></span> |
|
871 | + <span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php _e('Please retype your password to confirm.', 'give'); ?>"></span> |
|
872 | 872 | </label> |
873 | 873 | |
874 | - <input name="give_user_pass_confirm" id="give-user-pass-confirm-<?php echo $form_id; ?>" class="<?php if ( give_logged_in_only( $form_id ) ) { |
|
874 | + <input name="give_user_pass_confirm" id="give-user-pass-confirm-<?php echo $form_id; ?>" class="<?php if (give_logged_in_only($form_id)) { |
|
875 | 875 | echo 'required '; |
876 | - } ?>give-input" placeholder="<?php _e( 'Confirm password', 'give' ); ?>" type="password"/> |
|
876 | + } ?>give-input" placeholder="<?php _e('Confirm password', 'give'); ?>" type="password"/> |
|
877 | 877 | </div> |
878 | - <?php do_action( 'give_register_account_fields_after', $form_id ); ?> |
|
878 | + <?php do_action('give_register_account_fields_after', $form_id); ?> |
|
879 | 879 | </fieldset> |
880 | 880 | |
881 | - <?php do_action( 'give_register_fields_after', $form_id ); ?> |
|
881 | + <?php do_action('give_register_fields_after', $form_id); ?> |
|
882 | 882 | |
883 | 883 | <input type="hidden" name="give-purchase-var" value="needs-to-register"/> |
884 | 884 | |
885 | - <?php do_action( 'give_purchase_form_user_info', $form_id ); ?> |
|
885 | + <?php do_action('give_purchase_form_user_info', $form_id); ?> |
|
886 | 886 | |
887 | 887 | </fieldset> |
888 | 888 | <?php |
889 | 889 | echo ob_get_clean(); |
890 | 890 | } |
891 | 891 | |
892 | -add_action( 'give_purchase_form_register_fields', 'give_get_register_fields' ); |
|
892 | +add_action('give_purchase_form_register_fields', 'give_get_register_fields'); |
|
893 | 893 | |
894 | 894 | /** |
895 | 895 | * Gets the login fields for the login form on the checkout. This function hooks |
@@ -902,73 +902,73 @@ discard block |
||
902 | 902 | * |
903 | 903 | * @return string |
904 | 904 | */ |
905 | -function give_get_login_fields( $form_id ) { |
|
905 | +function give_get_login_fields($form_id) { |
|
906 | 906 | |
907 | - $form_id = isset( $_POST['form_id'] ) ? $_POST['form_id'] : $form_id; |
|
908 | - $show_register_form = give_show_login_register_option( $form_id ); |
|
907 | + $form_id = isset($_POST['form_id']) ? $_POST['form_id'] : $form_id; |
|
908 | + $show_register_form = give_show_login_register_option($form_id); |
|
909 | 909 | |
910 | 910 | ob_start(); |
911 | 911 | ?> |
912 | 912 | <fieldset id="give-login-fields-<?php echo $form_id; ?>"> |
913 | - <legend><?php echo apply_filters( 'give_account_login_fieldset_heading', __( 'Login to Your Account', 'give' ) ); |
|
914 | - if ( ! give_logged_in_only( $form_id ) ) { |
|
915 | - echo ' <span class="sub-text">' . __( '(optional)', 'give' ) . '</span>'; |
|
913 | + <legend><?php echo apply_filters('give_account_login_fieldset_heading', __('Login to Your Account', 'give')); |
|
914 | + if ( ! give_logged_in_only($form_id)) { |
|
915 | + echo ' <span class="sub-text">'.__('(optional)', 'give').'</span>'; |
|
916 | 916 | } ?> |
917 | 917 | </legend> |
918 | - <?php if ( $show_register_form == 'both' ) { ?> |
|
918 | + <?php if ($show_register_form == 'both') { ?> |
|
919 | 919 | <p class="give-new-account-link"> |
920 | - <?php _e( 'Need to create an account?', 'give' ); ?> |
|
921 | - <a href="<?php echo remove_query_arg( 'login' ); ?>" class="give-checkout-register-cancel" data-action="give_checkout_register"> |
|
922 | - <?php _e( 'Register', 'give' ); |
|
923 | - if ( ! give_logged_in_only( $form_id ) ) { |
|
924 | - echo ' ' . __( 'or checkout as a guest.', 'give' ); |
|
920 | + <?php _e('Need to create an account?', 'give'); ?> |
|
921 | + <a href="<?php echo remove_query_arg('login'); ?>" class="give-checkout-register-cancel" data-action="give_checkout_register"> |
|
922 | + <?php _e('Register', 'give'); |
|
923 | + if ( ! give_logged_in_only($form_id)) { |
|
924 | + echo ' '.__('or checkout as a guest.', 'give'); |
|
925 | 925 | } ?> |
926 | 926 | </a> |
927 | 927 | </p> |
928 | 928 | <p class="give-loading-text"> |
929 | - <span class="give-loading-animation"></span> <?php _e( 'Loading...', 'give' ); ?> </p> |
|
929 | + <span class="give-loading-animation"></span> <?php _e('Loading...', 'give'); ?> </p> |
|
930 | 930 | <?php } ?> |
931 | - <?php do_action( 'give_checkout_login_fields_before', $form_id ); ?> |
|
931 | + <?php do_action('give_checkout_login_fields_before', $form_id); ?> |
|
932 | 932 | <div id="give-user-login-wrap-<?php echo $form_id; ?>" class="form-row form-row-first"> |
933 | 933 | <label class="give-label" for="give-user-login-<?php echo $form_id; ?>"> |
934 | - <?php _e( 'Username', 'give' ); ?> |
|
935 | - <?php if ( give_logged_in_only( $form_id ) ) { ?> |
|
934 | + <?php _e('Username', 'give'); ?> |
|
935 | + <?php if (give_logged_in_only($form_id)) { ?> |
|
936 | 936 | <span class="give-required-indicator">*</span> |
937 | 937 | <?php } ?> |
938 | 938 | </label> |
939 | 939 | |
940 | - <input class="<?php if ( give_logged_in_only( $form_id ) ) { |
|
940 | + <input class="<?php if (give_logged_in_only($form_id)) { |
|
941 | 941 | echo 'required '; |
942 | - } ?>give-input" type="text" name="give_user_login" id="give-user-login-<?php echo $form_id; ?>" value="" placeholder="<?php _e( 'Your username', 'give' ); ?>"/> |
|
942 | + } ?>give-input" type="text" name="give_user_login" id="give-user-login-<?php echo $form_id; ?>" value="" placeholder="<?php _e('Your username', 'give'); ?>"/> |
|
943 | 943 | </div> |
944 | 944 | |
945 | 945 | <div id="give-user-pass-wrap-<?php echo $form_id; ?>" class="give_login_password form-row form-row-last"> |
946 | 946 | <label class="give-label" for="give-user-pass-<?php echo $form_id; ?>"> |
947 | - <?php _e( 'Password', 'give' ); ?> |
|
948 | - <?php if ( give_logged_in_only( $form_id ) ) { ?> |
|
947 | + <?php _e('Password', 'give'); ?> |
|
948 | + <?php if (give_logged_in_only($form_id)) { ?> |
|
949 | 949 | <span class="give-required-indicator">*</span> |
950 | 950 | <?php } ?> |
951 | 951 | </label> |
952 | - <input class="<?php if ( give_logged_in_only( $form_id ) ) { |
|
952 | + <input class="<?php if (give_logged_in_only($form_id)) { |
|
953 | 953 | echo 'required '; |
954 | - } ?>give-input" type="password" name="give_user_pass" id="give-user-pass-<?php echo $form_id; ?>" placeholder="<?php _e( 'Your password', 'give' ); ?>"/> |
|
954 | + } ?>give-input" type="password" name="give_user_pass" id="give-user-pass-<?php echo $form_id; ?>" placeholder="<?php _e('Your password', 'give'); ?>"/> |
|
955 | 955 | <input type="hidden" name="give-purchase-var" value="needs-to-login"/> |
956 | 956 | </div> |
957 | 957 | |
958 | 958 | <div id="give-user-login-submit-<?php echo $form_id; ?>" class="give-clearfix"> |
959 | - <input type="submit" class="give-submit give-btn button" name="give_login_submit" value="<?php _e( 'Login', 'give' ); ?>"/> |
|
960 | - <?php if ( $show_register_form !== 'login' ) { ?> |
|
961 | - <input type="button" data-action="give_cancel_login" class="give-cancel-login give-checkout-register-cancel give-btn button" name="give_login_cancel" value="<?php _e( 'Cancel', 'give' ); ?>"/> |
|
959 | + <input type="submit" class="give-submit give-btn button" name="give_login_submit" value="<?php _e('Login', 'give'); ?>"/> |
|
960 | + <?php if ($show_register_form !== 'login') { ?> |
|
961 | + <input type="button" data-action="give_cancel_login" class="give-cancel-login give-checkout-register-cancel give-btn button" name="give_login_cancel" value="<?php _e('Cancel', 'give'); ?>"/> |
|
962 | 962 | <?php } ?> |
963 | 963 | <span class="give-loading-animation"></span> |
964 | 964 | </div> |
965 | - <?php do_action( 'give_checkout_login_fields_after', $form_id ); ?> |
|
965 | + <?php do_action('give_checkout_login_fields_after', $form_id); ?> |
|
966 | 966 | </fieldset><!--end #give-login-fields--> |
967 | 967 | <?php |
968 | 968 | echo ob_get_clean(); |
969 | 969 | } |
970 | 970 | |
971 | -add_action( 'give_purchase_form_login_fields', 'give_get_login_fields', 10, 1 ); |
|
971 | +add_action('give_purchase_form_login_fields', 'give_get_login_fields', 10, 1); |
|
972 | 972 | |
973 | 973 | /** |
974 | 974 | * Payment Mode Select |
@@ -984,49 +984,49 @@ discard block |
||
984 | 984 | * |
985 | 985 | * @return void |
986 | 986 | */ |
987 | -function give_payment_mode_select( $form_id ) { |
|
987 | +function give_payment_mode_select($form_id) { |
|
988 | 988 | |
989 | 989 | $gateways = give_get_enabled_payment_gateways(); |
990 | 990 | |
991 | - do_action( 'give_payment_mode_top', $form_id ); ?> |
|
991 | + do_action('give_payment_mode_top', $form_id); ?> |
|
992 | 992 | |
993 | 993 | <fieldset id="give-payment-mode-select"> |
994 | - <?php do_action( 'give_payment_mode_before_gateways_wrap' ); ?> |
|
994 | + <?php do_action('give_payment_mode_before_gateways_wrap'); ?> |
|
995 | 995 | <div id="give-payment-mode-wrap"> |
996 | - <legend class="give-payment-mode-label"><?php echo apply_filters( 'give_checkout_payment_method_text', __( 'Select Payment Method', 'give' ) ); ?> |
|
997 | - <span class="give-loading-text"><span class="give-loading-animation"></span> <?php _e( 'Loading...', 'give' ); ?></span> |
|
996 | + <legend class="give-payment-mode-label"><?php echo apply_filters('give_checkout_payment_method_text', __('Select Payment Method', 'give')); ?> |
|
997 | + <span class="give-loading-text"><span class="give-loading-animation"></span> <?php _e('Loading...', 'give'); ?></span> |
|
998 | 998 | </legend> |
999 | 999 | <?php |
1000 | 1000 | |
1001 | - do_action( 'give_payment_mode_before_gateways' ) ?> |
|
1001 | + do_action('give_payment_mode_before_gateways') ?> |
|
1002 | 1002 | |
1003 | 1003 | <ul id="give-gateway-radio-list"> |
1004 | - <?php foreach ( $gateways as $gateway_id => $gateway ) : |
|
1005 | - $checked = checked( $gateway_id, give_get_default_gateway( $form_id ), false ); |
|
1004 | + <?php foreach ($gateways as $gateway_id => $gateway) : |
|
1005 | + $checked = checked($gateway_id, give_get_default_gateway($form_id), false); |
|
1006 | 1006 | $checked_class = $checked ? ' give-gateway-option-selected' : ''; |
1007 | - echo '<li><label for="give-gateway-' . esc_attr( $gateway_id ) . '-' . $form_id . '" class="give-gateway-option' . $checked_class . '" id="give-gateway-option-' . esc_attr( $gateway_id ) . '">'; |
|
1008 | - echo '<input type="radio" name="payment-mode" class="give-gateway" id="give-gateway-' . esc_attr( $gateway_id ) . '-' . $form_id . '" value="' . esc_attr( $gateway_id ) . '"' . $checked . '>' . esc_html( $gateway['checkout_label'] ); |
|
1007 | + echo '<li><label for="give-gateway-'.esc_attr($gateway_id).'-'.$form_id.'" class="give-gateway-option'.$checked_class.'" id="give-gateway-option-'.esc_attr($gateway_id).'">'; |
|
1008 | + echo '<input type="radio" name="payment-mode" class="give-gateway" id="give-gateway-'.esc_attr($gateway_id).'-'.$form_id.'" value="'.esc_attr($gateway_id).'"'.$checked.'>'.esc_html($gateway['checkout_label']); |
|
1009 | 1009 | echo '</label></li>'; |
1010 | 1010 | endforeach; ?> |
1011 | 1011 | </ul> |
1012 | - <?php do_action( 'give_payment_mode_after_gateways' ); ?> |
|
1012 | + <?php do_action('give_payment_mode_after_gateways'); ?> |
|
1013 | 1013 | </div> |
1014 | - <?php do_action( 'give_payment_mode_after_gateways_wrap' ); ?> |
|
1014 | + <?php do_action('give_payment_mode_after_gateways_wrap'); ?> |
|
1015 | 1015 | </fieldset> |
1016 | 1016 | |
1017 | - <?php do_action( 'give_payment_mode_bottom', $form_id ); ?> |
|
1017 | + <?php do_action('give_payment_mode_bottom', $form_id); ?> |
|
1018 | 1018 | |
1019 | 1019 | <div id="give_purchase_form_wrap"> |
1020 | 1020 | |
1021 | - <?php do_action( 'give_purchase_form', $form_id ); ?> |
|
1021 | + <?php do_action('give_purchase_form', $form_id); ?> |
|
1022 | 1022 | |
1023 | 1023 | </div><!-- the checkout fields are loaded into this--> |
1024 | 1024 | |
1025 | - <?php do_action( 'give_purchase_form_wrap_bottom', $form_id ); |
|
1025 | + <?php do_action('give_purchase_form_wrap_bottom', $form_id); |
|
1026 | 1026 | |
1027 | 1027 | } |
1028 | 1028 | |
1029 | -add_action( 'give_payment_mode_select', 'give_payment_mode_select' ); |
|
1029 | +add_action('give_payment_mode_select', 'give_payment_mode_select'); |
|
1030 | 1030 | |
1031 | 1031 | |
1032 | 1032 | /** |
@@ -1041,35 +1041,35 @@ discard block |
||
1041 | 1041 | * |
1042 | 1042 | * @return void |
1043 | 1043 | */ |
1044 | -function give_terms_agreement( $form_id ) { |
|
1044 | +function give_terms_agreement($form_id) { |
|
1045 | 1045 | |
1046 | - $form_option = get_post_meta( $form_id, '_give_terms_option', true ); |
|
1047 | - $label = get_post_meta( $form_id, '_give_agree_label', true ); |
|
1048 | - $terms = get_post_meta( $form_id, '_give_agree_text', true ); |
|
1046 | + $form_option = get_post_meta($form_id, '_give_terms_option', true); |
|
1047 | + $label = get_post_meta($form_id, '_give_agree_label', true); |
|
1048 | + $terms = get_post_meta($form_id, '_give_agree_text', true); |
|
1049 | 1049 | |
1050 | - if ( $form_option === 'yes' && ! empty( $terms ) ) { ?> |
|
1050 | + if ($form_option === 'yes' && ! empty($terms)) { ?> |
|
1051 | 1051 | <fieldset id="give_terms_agreement"> |
1052 | 1052 | <div id="give_terms" style="display:none;"> |
1053 | 1053 | <?php |
1054 | - do_action( 'give_before_terms' ); |
|
1055 | - echo wpautop( stripslashes( $terms ) ); |
|
1056 | - do_action( 'give_after_terms' ); |
|
1054 | + do_action('give_before_terms'); |
|
1055 | + echo wpautop(stripslashes($terms)); |
|
1056 | + do_action('give_after_terms'); |
|
1057 | 1057 | ?> |
1058 | 1058 | </div> |
1059 | 1059 | <div id="give_show_terms"> |
1060 | - <a href="#" class="give_terms_links"><?php _e( 'Show Terms', 'give' ); ?></a> |
|
1061 | - <a href="#" class="give_terms_links" style="display:none;"><?php _e( 'Hide Terms', 'give' ); ?></a> |
|
1060 | + <a href="#" class="give_terms_links"><?php _e('Show Terms', 'give'); ?></a> |
|
1061 | + <a href="#" class="give_terms_links" style="display:none;"><?php _e('Hide Terms', 'give'); ?></a> |
|
1062 | 1062 | </div> |
1063 | 1063 | |
1064 | 1064 | <label |
1065 | - for="give_agree_to_terms"><?php echo ! empty( $label ) ? stripslashes( $label ) : __( 'Agree to Terms?', 'give' ); ?></label> |
|
1065 | + for="give_agree_to_terms"><?php echo ! empty($label) ? stripslashes($label) : __('Agree to Terms?', 'give'); ?></label> |
|
1066 | 1066 | <input name="give_agree_to_terms" class="required" type="checkbox" id="give_agree_to_terms" value="1"/> |
1067 | 1067 | </fieldset> |
1068 | 1068 | <?php |
1069 | 1069 | } |
1070 | 1070 | } |
1071 | 1071 | |
1072 | -add_action( 'give_purchase_form_before_submit', 'give_terms_agreement', 10, 1 ); |
|
1072 | +add_action('give_purchase_form_before_submit', 'give_terms_agreement', 10, 1); |
|
1073 | 1073 | |
1074 | 1074 | /** |
1075 | 1075 | * Checkout Final Total |
@@ -1081,27 +1081,27 @@ discard block |
||
1081 | 1081 | * @since 1.0 |
1082 | 1082 | * @return void |
1083 | 1083 | */ |
1084 | -function give_checkout_final_total( $form_id ) { |
|
1084 | +function give_checkout_final_total($form_id) { |
|
1085 | 1085 | |
1086 | - if ( isset( $_POST['give_total'] ) ) { |
|
1087 | - $total = apply_filters( 'give_donation_total', $_POST['give_total'] ); |
|
1086 | + if (isset($_POST['give_total'])) { |
|
1087 | + $total = apply_filters('give_donation_total', $_POST['give_total']); |
|
1088 | 1088 | } else { |
1089 | 1089 | //default total |
1090 | - $total = give_get_default_form_amount( $form_id ); |
|
1090 | + $total = give_get_default_form_amount($form_id); |
|
1091 | 1091 | } |
1092 | 1092 | //Only proceed if give_total available |
1093 | - if ( empty( $total ) ) { |
|
1093 | + if (empty($total)) { |
|
1094 | 1094 | return; |
1095 | 1095 | } |
1096 | 1096 | ?> |
1097 | 1097 | <p id="give-final-total-wrap" class="form-wrap "> |
1098 | - <span class="give-donation-total-label"><?php echo apply_filters( 'give_donation_total_label', esc_attr__( 'Donation Total:', 'give' ) ); ?></span> |
|
1099 | - <span class="give-final-total-amount" data-total="<?php echo give_format_amount( $total ); ?>"><?php echo give_currency_filter( give_format_amount( $total ) ); ?></span> |
|
1098 | + <span class="give-donation-total-label"><?php echo apply_filters('give_donation_total_label', esc_attr__('Donation Total:', 'give')); ?></span> |
|
1099 | + <span class="give-final-total-amount" data-total="<?php echo give_format_amount($total); ?>"><?php echo give_currency_filter(give_format_amount($total)); ?></span> |
|
1100 | 1100 | </p> |
1101 | 1101 | <?php |
1102 | 1102 | } |
1103 | 1103 | |
1104 | -add_action( 'give_purchase_form_before_submit', 'give_checkout_final_total', 999 ); |
|
1104 | +add_action('give_purchase_form_before_submit', 'give_checkout_final_total', 999); |
|
1105 | 1105 | |
1106 | 1106 | |
1107 | 1107 | /** |
@@ -1113,22 +1113,22 @@ discard block |
||
1113 | 1113 | * |
1114 | 1114 | * @return void |
1115 | 1115 | */ |
1116 | -function give_checkout_submit( $form_id ) { |
|
1116 | +function give_checkout_submit($form_id) { |
|
1117 | 1117 | ?> |
1118 | 1118 | <fieldset id="give_purchase_submit"> |
1119 | - <?php do_action( 'give_purchase_form_before_submit', $form_id ); ?> |
|
1119 | + <?php do_action('give_purchase_form_before_submit', $form_id); ?> |
|
1120 | 1120 | |
1121 | - <?php give_checkout_hidden_fields( $form_id ); ?> |
|
1121 | + <?php give_checkout_hidden_fields($form_id); ?> |
|
1122 | 1122 | |
1123 | - <?php echo give_checkout_button_purchase( $form_id ); ?> |
|
1123 | + <?php echo give_checkout_button_purchase($form_id); ?> |
|
1124 | 1124 | |
1125 | - <?php do_action( 'give_purchase_form_after_submit', $form_id ); ?> |
|
1125 | + <?php do_action('give_purchase_form_after_submit', $form_id); ?> |
|
1126 | 1126 | |
1127 | 1127 | </fieldset> |
1128 | 1128 | <?php |
1129 | 1129 | } |
1130 | 1130 | |
1131 | -add_action( 'give_purchase_form_after_cc_form', 'give_checkout_submit', 9999 ); |
|
1131 | +add_action('give_purchase_form_after_cc_form', 'give_checkout_submit', 9999); |
|
1132 | 1132 | |
1133 | 1133 | |
1134 | 1134 | /** |
@@ -1141,17 +1141,17 @@ discard block |
||
1141 | 1141 | * |
1142 | 1142 | * @return string |
1143 | 1143 | */ |
1144 | -function give_checkout_button_purchase( $form_id ) { |
|
1144 | +function give_checkout_button_purchase($form_id) { |
|
1145 | 1145 | |
1146 | - $display_label_field = get_post_meta( $form_id, '_give_checkout_label', true ); |
|
1147 | - $display_label = ( ! empty( $display_label_field ) ? $display_label_field : __( 'Donate Now', 'give' ) ); |
|
1146 | + $display_label_field = get_post_meta($form_id, '_give_checkout_label', true); |
|
1147 | + $display_label = ( ! empty($display_label_field) ? $display_label_field : __('Donate Now', 'give')); |
|
1148 | 1148 | ob_start(); ?> |
1149 | 1149 | <div class="give-submit-button-wrap give-clearfix"> |
1150 | 1150 | <input type="submit" class="give-submit give-btn" id="give-purchase-button" name="give-purchase" value="<?php echo $display_label; ?>"/> |
1151 | 1151 | <span class="give-loading-animation"></span> |
1152 | 1152 | </div> |
1153 | 1153 | <?php |
1154 | - return apply_filters( 'give_checkout_button_purchase', ob_get_clean(), $form_id ); |
|
1154 | + return apply_filters('give_checkout_button_purchase', ob_get_clean(), $form_id); |
|
1155 | 1155 | } |
1156 | 1156 | |
1157 | 1157 | /** |
@@ -1164,11 +1164,11 @@ discard block |
||
1164 | 1164 | * |
1165 | 1165 | * @return void |
1166 | 1166 | */ |
1167 | -function give_agree_to_terms_js( $form_id ) { |
|
1167 | +function give_agree_to_terms_js($form_id) { |
|
1168 | 1168 | |
1169 | - $form_option = get_post_meta( $form_id, '_give_terms_option', true ); |
|
1169 | + $form_option = get_post_meta($form_id, '_give_terms_option', true); |
|
1170 | 1170 | |
1171 | - if ( $form_option === 'yes' ) { |
|
1171 | + if ($form_option === 'yes') { |
|
1172 | 1172 | ?> |
1173 | 1173 | <script type="text/javascript"> |
1174 | 1174 | jQuery(document).ready(function ($) { |
@@ -1184,7 +1184,7 @@ discard block |
||
1184 | 1184 | } |
1185 | 1185 | } |
1186 | 1186 | |
1187 | -add_action( 'give_checkout_form_top', 'give_agree_to_terms_js', 10, 2 ); |
|
1187 | +add_action('give_checkout_form_top', 'give_agree_to_terms_js', 10, 2); |
|
1188 | 1188 | |
1189 | 1189 | /** |
1190 | 1190 | * Show Give Goals |
@@ -1197,25 +1197,25 @@ discard block |
||
1197 | 1197 | * @return mixed |
1198 | 1198 | */ |
1199 | 1199 | |
1200 | -function give_show_goal_progress( $form_id, $args ) { |
|
1200 | +function give_show_goal_progress($form_id, $args) { |
|
1201 | 1201 | |
1202 | - $goal_option = get_post_meta( $form_id, '_give_goal_option', true ); |
|
1203 | - $form = new Give_Donate_Form( $form_id ); |
|
1202 | + $goal_option = get_post_meta($form_id, '_give_goal_option', true); |
|
1203 | + $form = new Give_Donate_Form($form_id); |
|
1204 | 1204 | $goal = $form->goal; |
1205 | - $goal_format = get_post_meta( $form_id, '_give_goal_format', true ); |
|
1205 | + $goal_format = get_post_meta($form_id, '_give_goal_format', true); |
|
1206 | 1206 | $income = $form->get_earnings(); |
1207 | - $color = get_post_meta( $form_id, '_give_goal_color', true ); |
|
1208 | - $show_text = (bool) isset( $args['show_text'] ) ? filter_var( $args['show_text'], FILTER_VALIDATE_BOOLEAN ) : true; |
|
1209 | - $show_bar = (bool) isset( $args['show_bar'] ) ? filter_var( $args['show_bar'], FILTER_VALIDATE_BOOLEAN ) : true; |
|
1207 | + $color = get_post_meta($form_id, '_give_goal_color', true); |
|
1208 | + $show_text = (bool) isset($args['show_text']) ? filter_var($args['show_text'], FILTER_VALIDATE_BOOLEAN) : true; |
|
1209 | + $show_bar = (bool) isset($args['show_bar']) ? filter_var($args['show_bar'], FILTER_VALIDATE_BOOLEAN) : true; |
|
1210 | 1210 | |
1211 | 1211 | //Sanity check - respect shortcode args |
1212 | - if ( isset( $args['show_goal'] ) && $args['show_goal'] === false ) { |
|
1212 | + if (isset($args['show_goal']) && $args['show_goal'] === false) { |
|
1213 | 1213 | return false; |
1214 | 1214 | } |
1215 | 1215 | |
1216 | 1216 | //Sanity check - ensure form has goal set to output |
1217 | - if ( empty( $form->ID ) |
|
1218 | - || ( is_singular( 'give_forms' ) && $goal_option !== 'yes' ) |
|
1217 | + if (empty($form->ID) |
|
1218 | + || (is_singular('give_forms') && $goal_option !== 'yes') |
|
1219 | 1219 | || $goal_option !== 'yes' |
1220 | 1220 | || $goal == 0 |
1221 | 1221 | ) { |
@@ -1223,26 +1223,26 @@ discard block |
||
1223 | 1223 | return false; |
1224 | 1224 | } |
1225 | 1225 | |
1226 | - $progress = round( ( $income / $goal ) * 100, 2 ); |
|
1226 | + $progress = round(($income / $goal) * 100, 2); |
|
1227 | 1227 | |
1228 | - if ( $income >= $goal ) { |
|
1228 | + if ($income >= $goal) { |
|
1229 | 1229 | $progress = 100; |
1230 | 1230 | } |
1231 | 1231 | |
1232 | 1232 | $output = '<div class="give-goal-progress">'; |
1233 | 1233 | |
1234 | 1234 | //Goal Progress Text |
1235 | - if ( ! empty( $show_text ) ) { |
|
1235 | + if ( ! empty($show_text)) { |
|
1236 | 1236 | |
1237 | 1237 | $output .= '<div class="raised">'; |
1238 | 1238 | |
1239 | - if ( $goal_format !== 'percentage' ) { |
|
1239 | + if ($goal_format !== 'percentage') { |
|
1240 | 1240 | |
1241 | - $output .= sprintf( _x( '%s of %s raised', 'This text displays the amount of income raised compared to the goal.', 'give' ), '<span class="income">' . apply_filters( 'give_goal_amount_raised_output', give_currency_filter( give_format_amount( $income ) ) ) . '</span>', '<span class="goal-text">' . apply_filters( 'give_goal_amount_target_output', give_currency_filter( give_format_amount( $goal ) ) ) ) . '</span>'; |
|
1241 | + $output .= sprintf(_x('%s of %s raised', 'This text displays the amount of income raised compared to the goal.', 'give'), '<span class="income">'.apply_filters('give_goal_amount_raised_output', give_currency_filter(give_format_amount($income))).'</span>', '<span class="goal-text">'.apply_filters('give_goal_amount_target_output', give_currency_filter(give_format_amount($goal)))).'</span>'; |
|
1242 | 1242 | |
1243 | - } elseif ( $goal_format == 'percentage' ) { |
|
1243 | + } elseif ($goal_format == 'percentage') { |
|
1244 | 1244 | |
1245 | - $output .= sprintf( _x( '%s%% funded', 'This text displays the percentage amount of income raised compared to the goal target.', 'give' ), '<span class="give-percentage">' . apply_filters( 'give_goal_amount_funded_percentage_output', round( $progress ) ) . '</span>' ) . '</span>'; |
|
1245 | + $output .= sprintf(_x('%s%% funded', 'This text displays the percentage amount of income raised compared to the goal target.', 'give'), '<span class="give-percentage">'.apply_filters('give_goal_amount_funded_percentage_output', round($progress)).'</span>').'</span>'; |
|
1246 | 1246 | |
1247 | 1247 | } |
1248 | 1248 | |
@@ -1251,11 +1251,11 @@ discard block |
||
1251 | 1251 | } |
1252 | 1252 | |
1253 | 1253 | //Goal Progress Bar |
1254 | - if ( ! empty( $show_bar ) ) { |
|
1254 | + if ( ! empty($show_bar)) { |
|
1255 | 1255 | $output .= '<div class="give-progress-bar">'; |
1256 | - $output .= '<span style="width: ' . esc_attr( $progress ) . '%;'; |
|
1257 | - if ( ! empty( $color ) ) { |
|
1258 | - $output .= 'background-color:' . $color; |
|
1256 | + $output .= '<span style="width: '.esc_attr($progress).'%;'; |
|
1257 | + if ( ! empty($color)) { |
|
1258 | + $output .= 'background-color:'.$color; |
|
1259 | 1259 | } |
1260 | 1260 | $output .= '"></span>'; |
1261 | 1261 | $output .= '</div><!-- /.give-progress-bar -->'; |
@@ -1263,13 +1263,13 @@ discard block |
||
1263 | 1263 | |
1264 | 1264 | $output .= '</div><!-- /.goal-progress -->'; |
1265 | 1265 | |
1266 | - echo apply_filters( 'give_goal_output', $output ); |
|
1266 | + echo apply_filters('give_goal_output', $output); |
|
1267 | 1267 | |
1268 | 1268 | return false; |
1269 | 1269 | |
1270 | 1270 | } |
1271 | 1271 | |
1272 | -add_action( 'give_pre_form', 'give_show_goal_progress', 10, 2 ); |
|
1272 | +add_action('give_pre_form', 'give_show_goal_progress', 10, 2); |
|
1273 | 1273 | |
1274 | 1274 | /** |
1275 | 1275 | * Adds Actions to Render Form Content |
@@ -1281,19 +1281,19 @@ discard block |
||
1281 | 1281 | * |
1282 | 1282 | * @return void |
1283 | 1283 | */ |
1284 | -function give_form_content( $form_id, $args ) { |
|
1284 | +function give_form_content($form_id, $args) { |
|
1285 | 1285 | |
1286 | - $show_content = ( isset( $args['show_content'] ) && ! empty( $args['show_content'] ) ) |
|
1286 | + $show_content = (isset($args['show_content']) && ! empty($args['show_content'])) |
|
1287 | 1287 | ? $args['show_content'] |
1288 | - : get_post_meta( $form_id, '_give_content_option', true ); |
|
1288 | + : get_post_meta($form_id, '_give_content_option', true); |
|
1289 | 1289 | |
1290 | - if ( $show_content !== 'none' ) { |
|
1290 | + if ($show_content !== 'none') { |
|
1291 | 1291 | //add action according to value |
1292 | - add_action( $show_content, 'give_form_display_content', 10, 2 ); |
|
1292 | + add_action($show_content, 'give_form_display_content', 10, 2); |
|
1293 | 1293 | } |
1294 | 1294 | } |
1295 | 1295 | |
1296 | -add_action( 'give_pre_form_output', 'give_form_content', 10, 2 ); |
|
1296 | +add_action('give_pre_form_output', 'give_form_content', 10, 2); |
|
1297 | 1297 | |
1298 | 1298 | /** |
1299 | 1299 | * Renders Post Form Content |
@@ -1305,24 +1305,24 @@ discard block |
||
1305 | 1305 | * @return void |
1306 | 1306 | * @since 1.0 |
1307 | 1307 | */ |
1308 | -function give_form_display_content( $form_id, $args ) { |
|
1308 | +function give_form_display_content($form_id, $args) { |
|
1309 | 1309 | |
1310 | - $content = wpautop( get_post_meta( $form_id, '_give_form_content', true ) ); |
|
1311 | - $show_content = ( isset( $args['show_content'] ) && ! empty( $args['show_content'] ) ) |
|
1310 | + $content = wpautop(get_post_meta($form_id, '_give_form_content', true)); |
|
1311 | + $show_content = (isset($args['show_content']) && ! empty($args['show_content'])) |
|
1312 | 1312 | ? $args['show_content'] |
1313 | - : get_post_meta( $form_id, '_give_content_option', true ); |
|
1313 | + : get_post_meta($form_id, '_give_content_option', true); |
|
1314 | 1314 | |
1315 | - if ( give_get_option( 'disable_the_content_filter' ) !== 'on' ) { |
|
1316 | - $content = apply_filters( 'the_content', $content ); |
|
1315 | + if (give_get_option('disable_the_content_filter') !== 'on') { |
|
1316 | + $content = apply_filters('the_content', $content); |
|
1317 | 1317 | } |
1318 | 1318 | |
1319 | - $output = '<div id="give-form-content-' . $form_id . '" class="give-form-content-wrap" >' . $content . '</div>'; |
|
1319 | + $output = '<div id="give-form-content-'.$form_id.'" class="give-form-content-wrap" >'.$content.'</div>'; |
|
1320 | 1320 | |
1321 | - echo apply_filters( 'give_form_content_output', $output ); |
|
1321 | + echo apply_filters('give_form_content_output', $output); |
|
1322 | 1322 | |
1323 | 1323 | //remove action to prevent content output on addition forms on page |
1324 | 1324 | //@see: https://github.com/WordImpress/Give/issues/634 |
1325 | - remove_action( $show_content, 'give_form_display_content' ); |
|
1325 | + remove_action($show_content, 'give_form_display_content'); |
|
1326 | 1326 | } |
1327 | 1327 | |
1328 | 1328 | |
@@ -1335,16 +1335,16 @@ discard block |
||
1335 | 1335 | * |
1336 | 1336 | * @return void |
1337 | 1337 | */ |
1338 | -function give_checkout_hidden_fields( $form_id ) { |
|
1338 | +function give_checkout_hidden_fields($form_id) { |
|
1339 | 1339 | |
1340 | - do_action( 'give_hidden_fields_before', $form_id ); |
|
1341 | - if ( is_user_logged_in() ) { ?> |
|
1340 | + do_action('give_hidden_fields_before', $form_id); |
|
1341 | + if (is_user_logged_in()) { ?> |
|
1342 | 1342 | <input type="hidden" name="give-user-id" value="<?php echo get_current_user_id(); ?>"/> |
1343 | 1343 | <?php } ?> |
1344 | 1344 | <input type="hidden" name="give_action" value="purchase"/> |
1345 | - <input type="hidden" name="give-gateway" value="<?php echo give_get_chosen_gateway( $form_id ); ?>"/> |
|
1345 | + <input type="hidden" name="give-gateway" value="<?php echo give_get_chosen_gateway($form_id); ?>"/> |
|
1346 | 1346 | <?php |
1347 | - do_action( 'give_hidden_fields_after', $form_id ); |
|
1347 | + do_action('give_hidden_fields_after', $form_id); |
|
1348 | 1348 | |
1349 | 1349 | } |
1350 | 1350 | |
@@ -1359,20 +1359,20 @@ discard block |
||
1359 | 1359 | * |
1360 | 1360 | * @return string $content Filtered content |
1361 | 1361 | */ |
1362 | -function give_filter_success_page_content( $content ) { |
|
1362 | +function give_filter_success_page_content($content) { |
|
1363 | 1363 | |
1364 | 1364 | global $give_options; |
1365 | 1365 | |
1366 | - if ( isset( $give_options['success_page'] ) && isset( $_GET['payment-confirmation'] ) && is_page( $give_options['success_page'] ) ) { |
|
1367 | - if ( has_filter( 'give_payment_confirm_' . $_GET['payment-confirmation'] ) ) { |
|
1368 | - $content = apply_filters( 'give_payment_confirm_' . $_GET['payment-confirmation'], $content ); |
|
1366 | + if (isset($give_options['success_page']) && isset($_GET['payment-confirmation']) && is_page($give_options['success_page'])) { |
|
1367 | + if (has_filter('give_payment_confirm_'.$_GET['payment-confirmation'])) { |
|
1368 | + $content = apply_filters('give_payment_confirm_'.$_GET['payment-confirmation'], $content); |
|
1369 | 1369 | } |
1370 | 1370 | } |
1371 | 1371 | |
1372 | 1372 | return $content; |
1373 | 1373 | } |
1374 | 1374 | |
1375 | -add_filter( 'the_content', 'give_filter_success_page_content' ); |
|
1375 | +add_filter('the_content', 'give_filter_success_page_content'); |
|
1376 | 1376 | |
1377 | 1377 | |
1378 | 1378 | /** |
@@ -1384,14 +1384,14 @@ discard block |
||
1384 | 1384 | |
1385 | 1385 | function give_test_mode_frontend_warning() { |
1386 | 1386 | |
1387 | - $test_mode = give_get_option( 'test_mode' ); |
|
1387 | + $test_mode = give_get_option('test_mode'); |
|
1388 | 1388 | |
1389 | - if ( $test_mode == 'on' ) { |
|
1390 | - echo '<div class="give_error give_warning" id="give_error_test_mode"><p><strong>' . __( 'Notice', 'give' ) . '</strong>: ' . esc_attr__( 'Test mode is enabled. While in test mode no live transactions are processed.', 'give' ) . '</p></div>'; |
|
1389 | + if ($test_mode == 'on') { |
|
1390 | + echo '<div class="give_error give_warning" id="give_error_test_mode"><p><strong>'.__('Notice', 'give').'</strong>: '.esc_attr__('Test mode is enabled. While in test mode no live transactions are processed.', 'give').'</p></div>'; |
|
1391 | 1391 | } |
1392 | 1392 | } |
1393 | 1393 | |
1394 | -add_action( 'give_pre_form', 'give_test_mode_frontend_warning', 10 ); |
|
1394 | +add_action('give_pre_form', 'give_test_mode_frontend_warning', 10); |
|
1395 | 1395 | |
1396 | 1396 | |
1397 | 1397 | /** |
@@ -1401,21 +1401,21 @@ discard block |
||
1401 | 1401 | * @since 1.4.1 |
1402 | 1402 | */ |
1403 | 1403 | |
1404 | -function give_members_only_form( $final_output, $args ) { |
|
1404 | +function give_members_only_form($final_output, $args) { |
|
1405 | 1405 | |
1406 | - $form_id = isset( $args['form_id'] ) ? $args['form_id'] : 0; |
|
1406 | + $form_id = isset($args['form_id']) ? $args['form_id'] : 0; |
|
1407 | 1407 | |
1408 | 1408 | //Sanity Check: Must have form_id & not be logged in |
1409 | - if ( empty( $form_id ) || is_user_logged_in() ) { |
|
1409 | + if (empty($form_id) || is_user_logged_in()) { |
|
1410 | 1410 | return $final_output; |
1411 | 1411 | } |
1412 | 1412 | |
1413 | 1413 | //Logged in only and Register / Login set to none |
1414 | - if ( give_logged_in_only( $form_id ) && give_show_login_register_option( $form_id ) == 'none' ) { |
|
1414 | + if (give_logged_in_only($form_id) && give_show_login_register_option($form_id) == 'none') { |
|
1415 | 1415 | |
1416 | - $final_output = give_output_error( __( 'Please login in order to complete your donation.', 'give' ), false ); |
|
1416 | + $final_output = give_output_error(__('Please login in order to complete your donation.', 'give'), false); |
|
1417 | 1417 | |
1418 | - return apply_filters( 'give_members_only_output', $final_output, $form_id ); |
|
1418 | + return apply_filters('give_members_only_output', $final_output, $form_id); |
|
1419 | 1419 | |
1420 | 1420 | } |
1421 | 1421 | |
@@ -1423,4 +1423,4 @@ discard block |
||
1423 | 1423 | |
1424 | 1424 | } |
1425 | 1425 | |
1426 | -add_filter( 'give_donate_form', 'give_members_only_form', 10, 2 ); |
|
1427 | 1426 | \ No newline at end of file |
1427 | +add_filter('give_donate_form', 'give_members_only_form', 10, 2); |
|
1428 | 1428 | \ No newline at end of file |
@@ -106,11 +106,13 @@ discard block |
||
106 | 106 | //Print thank you message. |
107 | 107 | echo "<p class=\"give-from-thankyou-msg\">{$display_thankyou_message}</p>"; |
108 | 108 | ?> |
109 | - <?php else : ?> |
|
109 | + <?php else { |
|
110 | + : ?> |
|
110 | 111 | <?php |
111 | 112 | if ( isset( $args['show_title'] ) && $args['show_title'] == true ) { |
112 | 113 | |
113 | 114 | echo apply_filters( 'give_form_title', '<h2 class="give-form-title">' . get_the_title( $form_id ) . '</h2>' ); |
115 | +} |
|
114 | 116 | |
115 | 117 | } ?> |
116 | 118 | |
@@ -781,8 +783,11 @@ discard block |
||
781 | 783 | } |
782 | 784 | ?> |
783 | 785 | </select> |
784 | - <?php else : ?> |
|
785 | - <input type="text" size="6" name="card_state" id="card_state" class="card_state give-input" placeholder="<?php _e( 'State / Province', 'give' ); ?>"/> |
|
786 | + <?php else { |
|
787 | + : ?> |
|
788 | + <input type="text" size="6" name="card_state" id="card_state" class="card_state give-input" placeholder="<?php _e( 'State / Province', 'give' ); |
|
789 | +} |
|
790 | +?>"/> |
|
786 | 791 | <?php endif; ?> |
787 | 792 | </p> |
788 | 793 | <?php do_action( 'give_cc_billing_bottom' ); ?> |
@@ -10,7 +10,7 @@ discard block |
||
10 | 10 | */ |
11 | 11 | |
12 | 12 | // Exit if accessed directly |
13 | -if ( ! defined( 'ABSPATH' ) ) { |
|
13 | +if ( ! defined('ABSPATH')) { |
|
14 | 14 | exit; |
15 | 15 | } |
16 | 16 | |
@@ -28,94 +28,94 @@ discard block |
||
28 | 28 | |
29 | 29 | global $give_options; |
30 | 30 | |
31 | - $js_dir = GIVE_PLUGIN_URL . 'assets/js/frontend/'; |
|
32 | - $js_plugins = GIVE_PLUGIN_URL . 'assets/js/plugins/'; |
|
33 | - $scripts_footer = ( give_get_option( 'scripts_footer' ) == 'on' ) ? true : false; |
|
31 | + $js_dir = GIVE_PLUGIN_URL.'assets/js/frontend/'; |
|
32 | + $js_plugins = GIVE_PLUGIN_URL.'assets/js/plugins/'; |
|
33 | + $scripts_footer = (give_get_option('scripts_footer') == 'on') ? true : false; |
|
34 | 34 | |
35 | 35 | // Use minified libraries if SCRIPT_DEBUG is turned off |
36 | - $suffix = ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) ? '' : '.min'; |
|
36 | + $suffix = (defined('SCRIPT_DEBUG') && SCRIPT_DEBUG) ? '' : '.min'; |
|
37 | 37 | |
38 | 38 | //Localize / PHP to AJAX vars |
39 | - $localize_give_checkout = apply_filters( 'give_global_script_vars', array( |
|
39 | + $localize_give_checkout = apply_filters('give_global_script_vars', array( |
|
40 | 40 | 'ajaxurl' => give_get_ajax_url(), |
41 | - 'checkout_nonce' => wp_create_nonce( 'give_checkout_nonce' ), |
|
42 | - 'currency_sign' => give_currency_filter( '' ), |
|
41 | + 'checkout_nonce' => wp_create_nonce('give_checkout_nonce'), |
|
42 | + 'currency_sign' => give_currency_filter(''), |
|
43 | 43 | 'currency_pos' => give_get_currency_position(), |
44 | - 'thousands_separator' => isset( $give_options['thousands_separator'] ) ? $give_options['thousands_separator'] : ',', |
|
45 | - 'decimal_separator' => isset( $give_options['decimal_separator'] ) ? $give_options['decimal_separator'] : '.', |
|
46 | - 'no_gateway' => __( 'Please select a payment method', 'give' ), |
|
47 | - 'bad_minimum' => __( 'The minimum donation amount for this form is', 'give' ), |
|
48 | - 'general_loading' => __( 'Loading...', 'give' ), |
|
49 | - 'purchase_loading' => __( 'Please Wait...', 'give' ), |
|
50 | - 'number_decimals' => apply_filters( 'give_format_amount_decimals', 2 ), |
|
44 | + 'thousands_separator' => isset($give_options['thousands_separator']) ? $give_options['thousands_separator'] : ',', |
|
45 | + 'decimal_separator' => isset($give_options['decimal_separator']) ? $give_options['decimal_separator'] : '.', |
|
46 | + 'no_gateway' => __('Please select a payment method', 'give'), |
|
47 | + 'bad_minimum' => __('The minimum donation amount for this form is', 'give'), |
|
48 | + 'general_loading' => __('Loading...', 'give'), |
|
49 | + 'purchase_loading' => __('Please Wait...', 'give'), |
|
50 | + 'number_decimals' => apply_filters('give_format_amount_decimals', 2), |
|
51 | 51 | 'give_version' => GIVE_VERSION |
52 | - ) ); |
|
53 | - $localize_give_ajax = apply_filters( 'give_global_ajax_vars', array( |
|
52 | + )); |
|
53 | + $localize_give_ajax = apply_filters('give_global_ajax_vars', array( |
|
54 | 54 | 'ajaxurl' => give_get_ajax_url(), |
55 | - 'loading' => __( 'Loading', 'give' ), |
|
55 | + 'loading' => __('Loading', 'give'), |
|
56 | 56 | // General loading message |
57 | - 'select_option' => __( 'Please select an option', 'give' ), |
|
57 | + 'select_option' => __('Please select an option', 'give'), |
|
58 | 58 | // Variable pricing error with multi-purchase option enabled |
59 | - 'default_gateway' => give_get_default_gateway( null ), |
|
60 | - 'permalinks' => get_option( 'permalink_structure' ) ? '1' : '0', |
|
61 | - 'number_decimals' => apply_filters( 'give_format_amount_decimals', 2 ) |
|
62 | - ) ); |
|
59 | + 'default_gateway' => give_get_default_gateway(null), |
|
60 | + 'permalinks' => get_option('permalink_structure') ? '1' : '0', |
|
61 | + 'number_decimals' => apply_filters('give_format_amount_decimals', 2) |
|
62 | + )); |
|
63 | 63 | |
64 | 64 | //DEBUG is On |
65 | - if ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) { |
|
65 | + if (defined('SCRIPT_DEBUG') && SCRIPT_DEBUG) { |
|
66 | 66 | |
67 | - if ( give_is_cc_verify_enabled() ) { |
|
68 | - wp_register_script( 'give-cc-validator', $js_plugins . 'jquery.payment' . $suffix . '.js', array( 'jquery' ), GIVE_VERSION, $scripts_footer ); |
|
69 | - wp_enqueue_script( 'give-cc-validator' ); |
|
67 | + if (give_is_cc_verify_enabled()) { |
|
68 | + wp_register_script('give-cc-validator', $js_plugins.'jquery.payment'.$suffix.'.js', array('jquery'), GIVE_VERSION, $scripts_footer); |
|
69 | + wp_enqueue_script('give-cc-validator'); |
|
70 | 70 | } |
71 | 71 | |
72 | - wp_register_script( 'give-float-labels', $js_plugins . 'float-labels' . $suffix . '.js', array( 'jquery' ), GIVE_VERSION, $scripts_footer ); |
|
73 | - wp_enqueue_script( 'give-float-labels' ); |
|
72 | + wp_register_script('give-float-labels', $js_plugins.'float-labels'.$suffix.'.js', array('jquery'), GIVE_VERSION, $scripts_footer); |
|
73 | + wp_enqueue_script('give-float-labels'); |
|
74 | 74 | |
75 | - wp_register_script( 'give-blockui', $js_plugins . 'jquery.blockUI' . $suffix . '.js', array( 'jquery' ), GIVE_VERSION, $scripts_footer ); |
|
76 | - wp_enqueue_script( 'give-blockui' ); |
|
75 | + wp_register_script('give-blockui', $js_plugins.'jquery.blockUI'.$suffix.'.js', array('jquery'), GIVE_VERSION, $scripts_footer); |
|
76 | + wp_enqueue_script('give-blockui'); |
|
77 | 77 | |
78 | - wp_register_script( 'give-qtip', $js_plugins . 'jquery.qtip' . $suffix . '.js', array( 'jquery' ), GIVE_VERSION, $scripts_footer ); |
|
79 | - wp_enqueue_script( 'give-qtip' ); |
|
78 | + wp_register_script('give-qtip', $js_plugins.'jquery.qtip'.$suffix.'.js', array('jquery'), GIVE_VERSION, $scripts_footer); |
|
79 | + wp_enqueue_script('give-qtip'); |
|
80 | 80 | |
81 | - wp_register_script( 'give-accounting', $js_plugins . 'accounting' . $suffix . '.js', array( 'jquery' ), GIVE_VERSION, $scripts_footer ); |
|
82 | - wp_enqueue_script( 'give-accounting' ); |
|
81 | + wp_register_script('give-accounting', $js_plugins.'accounting'.$suffix.'.js', array('jquery'), GIVE_VERSION, $scripts_footer); |
|
82 | + wp_enqueue_script('give-accounting'); |
|
83 | 83 | |
84 | - wp_register_script( 'give-magnific', $js_plugins . 'jquery.magnific-popup' . $suffix . '.js', array( 'jquery' ), GIVE_VERSION, $scripts_footer ); |
|
85 | - wp_enqueue_script( 'give-magnific' ); |
|
84 | + wp_register_script('give-magnific', $js_plugins.'jquery.magnific-popup'.$suffix.'.js', array('jquery'), GIVE_VERSION, $scripts_footer); |
|
85 | + wp_enqueue_script('give-magnific'); |
|
86 | 86 | |
87 | - wp_register_script( 'give-checkout-global', $js_dir . 'give-checkout-global' . $suffix . '.js', array( 'jquery' ), GIVE_VERSION, $scripts_footer ); |
|
88 | - wp_enqueue_script( 'give-checkout-global' ); |
|
87 | + wp_register_script('give-checkout-global', $js_dir.'give-checkout-global'.$suffix.'.js', array('jquery'), GIVE_VERSION, $scripts_footer); |
|
88 | + wp_enqueue_script('give-checkout-global'); |
|
89 | 89 | |
90 | 90 | //General scripts |
91 | - wp_register_script( 'give-scripts', $js_dir . 'give' . $suffix . '.js', array( 'jquery' ), GIVE_VERSION, $scripts_footer ); |
|
92 | - wp_enqueue_script( 'give-scripts' ); |
|
91 | + wp_register_script('give-scripts', $js_dir.'give'.$suffix.'.js', array('jquery'), GIVE_VERSION, $scripts_footer); |
|
92 | + wp_enqueue_script('give-scripts'); |
|
93 | 93 | |
94 | 94 | // Load AJAX scripts, if enabled |
95 | - wp_register_script( 'give-ajax', $js_dir . 'give-ajax' . $suffix . '.js', array( 'jquery' ), GIVE_VERSION, $scripts_footer ); |
|
96 | - wp_enqueue_script( 'give-ajax' ); |
|
95 | + wp_register_script('give-ajax', $js_dir.'give-ajax'.$suffix.'.js', array('jquery'), GIVE_VERSION, $scripts_footer); |
|
96 | + wp_enqueue_script('give-ajax'); |
|
97 | 97 | |
98 | 98 | //Localize / Pass AJAX vars from PHP |
99 | - wp_localize_script( 'give-checkout-global', 'give_global_vars', $localize_give_checkout ); |
|
100 | - wp_localize_script( 'give-ajax', 'give_scripts', $localize_give_ajax ); |
|
99 | + wp_localize_script('give-checkout-global', 'give_global_vars', $localize_give_checkout); |
|
100 | + wp_localize_script('give-ajax', 'give_scripts', $localize_give_ajax); |
|
101 | 101 | |
102 | 102 | |
103 | 103 | } else { |
104 | 104 | |
105 | 105 | //DEBUG is OFF (one JS file to rule them all!) |
106 | - wp_register_script( 'give', $js_dir . 'give.all.min.js', array( 'jquery' ), GIVE_VERSION, $scripts_footer ); |
|
107 | - wp_enqueue_script( 'give' ); |
|
106 | + wp_register_script('give', $js_dir.'give.all.min.js', array('jquery'), GIVE_VERSION, $scripts_footer); |
|
107 | + wp_enqueue_script('give'); |
|
108 | 108 | |
109 | 109 | //Localize / Pass AJAX vars from PHP |
110 | - wp_localize_script( 'give', 'give_global_vars', $localize_give_checkout ); |
|
111 | - wp_localize_script( 'give', 'give_scripts', $localize_give_ajax ); |
|
110 | + wp_localize_script('give', 'give_global_vars', $localize_give_checkout); |
|
111 | + wp_localize_script('give', 'give_scripts', $localize_give_ajax); |
|
112 | 112 | |
113 | 113 | } |
114 | 114 | |
115 | 115 | |
116 | 116 | } |
117 | 117 | |
118 | -add_action( 'wp_enqueue_scripts', 'give_load_scripts' ); |
|
118 | +add_action('wp_enqueue_scripts', 'give_load_scripts'); |
|
119 | 119 | |
120 | 120 | /** |
121 | 121 | * Register Styles |
@@ -127,47 +127,47 @@ discard block |
||
127 | 127 | */ |
128 | 128 | function give_register_styles() { |
129 | 129 | |
130 | - if ( give_get_option( 'disable_css', false ) ) { |
|
130 | + if (give_get_option('disable_css', false)) { |
|
131 | 131 | return; |
132 | 132 | } |
133 | 133 | |
134 | 134 | // Use minified libraries if SCRIPT_DEBUG is turned off |
135 | - $suffix = ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) ? '' : '.min'; |
|
135 | + $suffix = (defined('SCRIPT_DEBUG') && SCRIPT_DEBUG) ? '' : '.min'; |
|
136 | 136 | |
137 | - $file = 'give' . $suffix . '.css'; |
|
137 | + $file = 'give'.$suffix.'.css'; |
|
138 | 138 | $templates_dir = give_get_theme_template_dir_name(); |
139 | 139 | |
140 | - $child_theme_style_sheet = trailingslashit( get_stylesheet_directory() ) . $templates_dir . $file; |
|
141 | - $child_theme_style_sheet_2 = trailingslashit( get_stylesheet_directory() ) . $templates_dir . 'give.css'; |
|
142 | - $parent_theme_style_sheet = trailingslashit( get_template_directory() ) . $templates_dir . $file; |
|
143 | - $parent_theme_style_sheet_2 = trailingslashit( get_template_directory() ) . $templates_dir . 'give.css'; |
|
144 | - $give_plugin_style_sheet = trailingslashit( give_get_templates_dir() ) . $file; |
|
140 | + $child_theme_style_sheet = trailingslashit(get_stylesheet_directory()).$templates_dir.$file; |
|
141 | + $child_theme_style_sheet_2 = trailingslashit(get_stylesheet_directory()).$templates_dir.'give.css'; |
|
142 | + $parent_theme_style_sheet = trailingslashit(get_template_directory()).$templates_dir.$file; |
|
143 | + $parent_theme_style_sheet_2 = trailingslashit(get_template_directory()).$templates_dir.'give.css'; |
|
144 | + $give_plugin_style_sheet = trailingslashit(give_get_templates_dir()).$file; |
|
145 | 145 | |
146 | 146 | // Look in the child theme directory first, followed by the parent theme, followed by the Give core templates directory |
147 | 147 | // Also look for the min version first, followed by non minified version, even if SCRIPT_DEBUG is not enabled. |
148 | 148 | // This allows users to copy just give.css to their theme |
149 | - if ( file_exists( $child_theme_style_sheet ) || ( ! empty( $suffix ) && ( $nonmin = file_exists( $child_theme_style_sheet_2 ) ) ) ) { |
|
150 | - if ( ! empty( $nonmin ) ) { |
|
151 | - $url = trailingslashit( get_stylesheet_directory_uri() ) . $templates_dir . 'give.css'; |
|
149 | + if (file_exists($child_theme_style_sheet) || ( ! empty($suffix) && ($nonmin = file_exists($child_theme_style_sheet_2)))) { |
|
150 | + if ( ! empty($nonmin)) { |
|
151 | + $url = trailingslashit(get_stylesheet_directory_uri()).$templates_dir.'give.css'; |
|
152 | 152 | } else { |
153 | - $url = trailingslashit( get_stylesheet_directory_uri() ) . $templates_dir . $file; |
|
153 | + $url = trailingslashit(get_stylesheet_directory_uri()).$templates_dir.$file; |
|
154 | 154 | } |
155 | - } elseif ( file_exists( $parent_theme_style_sheet ) || ( ! empty( $suffix ) && ( $nonmin = file_exists( $parent_theme_style_sheet_2 ) ) ) ) { |
|
156 | - if ( ! empty( $nonmin ) ) { |
|
157 | - $url = trailingslashit( get_template_directory_uri() ) . $templates_dir . 'give.css'; |
|
155 | + } elseif (file_exists($parent_theme_style_sheet) || ( ! empty($suffix) && ($nonmin = file_exists($parent_theme_style_sheet_2)))) { |
|
156 | + if ( ! empty($nonmin)) { |
|
157 | + $url = trailingslashit(get_template_directory_uri()).$templates_dir.'give.css'; |
|
158 | 158 | } else { |
159 | - $url = trailingslashit( get_template_directory_uri() ) . $templates_dir . $file; |
|
159 | + $url = trailingslashit(get_template_directory_uri()).$templates_dir.$file; |
|
160 | 160 | } |
161 | - } elseif ( file_exists( $give_plugin_style_sheet ) || file_exists( $give_plugin_style_sheet ) ) { |
|
162 | - $url = trailingslashit( give_get_templates_url() ) . $file; |
|
161 | + } elseif (file_exists($give_plugin_style_sheet) || file_exists($give_plugin_style_sheet)) { |
|
162 | + $url = trailingslashit(give_get_templates_url()).$file; |
|
163 | 163 | } |
164 | 164 | |
165 | - wp_register_style( 'give-styles', $url, array(), GIVE_VERSION, 'all' ); |
|
166 | - wp_enqueue_style( 'give-styles' ); |
|
165 | + wp_register_style('give-styles', $url, array(), GIVE_VERSION, 'all'); |
|
166 | + wp_enqueue_style('give-styles'); |
|
167 | 167 | |
168 | 168 | } |
169 | 169 | |
170 | -add_action( 'wp_enqueue_scripts', 'give_register_styles' ); |
|
170 | +add_action('wp_enqueue_scripts', 'give_register_styles'); |
|
171 | 171 | |
172 | 172 | /** |
173 | 173 | * Load Admin Scripts |
@@ -181,103 +181,103 @@ discard block |
||
181 | 181 | * |
182 | 182 | * @return void |
183 | 183 | */ |
184 | -function give_load_admin_scripts( $hook ) { |
|
184 | +function give_load_admin_scripts($hook) { |
|
185 | 185 | |
186 | 186 | global $wp_version, $post, $post_type; |
187 | 187 | |
188 | 188 | //Directories of assets |
189 | - $js_dir = GIVE_PLUGIN_URL . 'assets/js/admin/'; |
|
190 | - $js_plugins = GIVE_PLUGIN_URL . 'assets/js/plugins/'; |
|
191 | - $css_dir = GIVE_PLUGIN_URL . 'assets/css/'; |
|
189 | + $js_dir = GIVE_PLUGIN_URL.'assets/js/admin/'; |
|
190 | + $js_plugins = GIVE_PLUGIN_URL.'assets/js/plugins/'; |
|
191 | + $css_dir = GIVE_PLUGIN_URL.'assets/css/'; |
|
192 | 192 | |
193 | 193 | // Use minified libraries if SCRIPT_DEBUG is turned off |
194 | - $suffix = ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) ? '' : '.min'; |
|
194 | + $suffix = (defined('SCRIPT_DEBUG') && SCRIPT_DEBUG) ? '' : '.min'; |
|
195 | 195 | |
196 | 196 | //Global Admin: |
197 | - wp_register_style( 'give-admin-bar-notification', $css_dir . 'adminbar-style.css' ); |
|
198 | - wp_enqueue_style( 'give-admin-bar-notification' ); |
|
197 | + wp_register_style('give-admin-bar-notification', $css_dir.'adminbar-style.css'); |
|
198 | + wp_enqueue_style('give-admin-bar-notification'); |
|
199 | 199 | |
200 | 200 | //Give Admin Only: |
201 | - if ( ! apply_filters( 'give_load_admin_scripts', give_is_admin_page(), $hook ) ) { |
|
201 | + if ( ! apply_filters('give_load_admin_scripts', give_is_admin_page(), $hook)) { |
|
202 | 202 | return; |
203 | 203 | } |
204 | 204 | |
205 | 205 | //CSS |
206 | - wp_register_style( 'jquery-ui-css', $css_dir . 'jquery-ui-fresh' . $suffix . '.css' ); |
|
207 | - wp_enqueue_style( 'jquery-ui-css' ); |
|
208 | - wp_register_style( 'give-admin', $css_dir . 'give-admin' . $suffix . '.css', GIVE_VERSION ); |
|
209 | - wp_enqueue_style( 'give-admin' ); |
|
210 | - wp_register_style( 'jquery-chosen', $css_dir . 'chosen' . $suffix . '.css', array(), GIVE_VERSION ); |
|
211 | - wp_enqueue_style( 'jquery-chosen' ); |
|
212 | - wp_enqueue_style( 'thickbox' ); |
|
206 | + wp_register_style('jquery-ui-css', $css_dir.'jquery-ui-fresh'.$suffix.'.css'); |
|
207 | + wp_enqueue_style('jquery-ui-css'); |
|
208 | + wp_register_style('give-admin', $css_dir.'give-admin'.$suffix.'.css', GIVE_VERSION); |
|
209 | + wp_enqueue_style('give-admin'); |
|
210 | + wp_register_style('jquery-chosen', $css_dir.'chosen'.$suffix.'.css', array(), GIVE_VERSION); |
|
211 | + wp_enqueue_style('jquery-chosen'); |
|
212 | + wp_enqueue_style('thickbox'); |
|
213 | 213 | |
214 | 214 | //JS |
215 | - wp_register_script( 'jquery-chosen', $js_plugins . 'chosen.jquery' . $suffix . '.js', array( 'jquery' ), GIVE_VERSION ); |
|
216 | - wp_enqueue_script( 'jquery-chosen' ); |
|
215 | + wp_register_script('jquery-chosen', $js_plugins.'chosen.jquery'.$suffix.'.js', array('jquery'), GIVE_VERSION); |
|
216 | + wp_enqueue_script('jquery-chosen'); |
|
217 | 217 | |
218 | - wp_register_script( 'give-admin-scripts', $js_dir . 'admin-scripts' . $suffix . '.js', array( 'jquery' ), GIVE_VERSION, false ); |
|
219 | - wp_enqueue_script( 'give-admin-scripts' ); |
|
218 | + wp_register_script('give-admin-scripts', $js_dir.'admin-scripts'.$suffix.'.js', array('jquery'), GIVE_VERSION, false); |
|
219 | + wp_enqueue_script('give-admin-scripts'); |
|
220 | 220 | |
221 | - wp_register_script( 'jquery-flot', $js_plugins . 'jquery.flot' . $suffix . '.js' ); |
|
222 | - wp_enqueue_script( 'jquery-flot' ); |
|
221 | + wp_register_script('jquery-flot', $js_plugins.'jquery.flot'.$suffix.'.js'); |
|
222 | + wp_enqueue_script('jquery-flot'); |
|
223 | 223 | |
224 | - wp_register_script( 'give-qtip', $js_plugins . 'jquery.qtip' . $suffix . '.js', array( 'jquery' ), GIVE_VERSION, false ); |
|
225 | - wp_enqueue_script( 'give-qtip' ); |
|
224 | + wp_register_script('give-qtip', $js_plugins.'jquery.qtip'.$suffix.'.js', array('jquery'), GIVE_VERSION, false); |
|
225 | + wp_enqueue_script('give-qtip'); |
|
226 | 226 | |
227 | - wp_enqueue_script( 'jquery-ui-datepicker' ); |
|
228 | - wp_enqueue_script( 'thickbox' ); |
|
227 | + wp_enqueue_script('jquery-ui-datepicker'); |
|
228 | + wp_enqueue_script('thickbox'); |
|
229 | 229 | |
230 | 230 | //Forms CPT Script |
231 | - if ( $post_type === 'give_forms' ) { |
|
232 | - wp_register_script( 'give-admin-forms-scripts', $js_dir . 'admin-forms' . $suffix . '.js', array( 'jquery' ), GIVE_VERSION, false ); |
|
233 | - wp_enqueue_script( 'give-admin-forms-scripts' ); |
|
231 | + if ($post_type === 'give_forms') { |
|
232 | + wp_register_script('give-admin-forms-scripts', $js_dir.'admin-forms'.$suffix.'.js', array('jquery'), GIVE_VERSION, false); |
|
233 | + wp_enqueue_script('give-admin-forms-scripts'); |
|
234 | 234 | } |
235 | 235 | |
236 | 236 | //Settings Scripts |
237 | - if (isset($_GET['page']) && $_GET['page'] == 'give-settings' ) { |
|
237 | + if (isset($_GET['page']) && $_GET['page'] == 'give-settings') { |
|
238 | 238 | wp_enqueue_script('jquery-ui-sortable'); |
239 | - wp_register_script( 'give-admin-settings-scripts', $js_dir . 'admin-settings' . $suffix . '.js', array( 'jquery' ), GIVE_VERSION, false ); |
|
240 | - wp_enqueue_script( 'give-admin-settings-scripts' ); |
|
239 | + wp_register_script('give-admin-settings-scripts', $js_dir.'admin-settings'.$suffix.'.js', array('jquery'), GIVE_VERSION, false); |
|
240 | + wp_enqueue_script('give-admin-settings-scripts'); |
|
241 | 241 | } |
242 | 242 | |
243 | 243 | //Localize strings & variables for JS |
244 | - wp_localize_script( 'give-admin-scripts', 'give_vars', array( |
|
245 | - 'post_id' => isset( $post->ID ) ? $post->ID : null, |
|
244 | + wp_localize_script('give-admin-scripts', 'give_vars', array( |
|
245 | + 'post_id' => isset($post->ID) ? $post->ID : null, |
|
246 | 246 | 'give_version' => GIVE_VERSION, |
247 | - 'quick_edit_warning' => __( 'Sorry, not available for variable priced forms.', 'give' ), |
|
248 | - 'delete_payment' => __( 'Are you sure you wish to delete this payment?', 'give' ), |
|
249 | - 'delete_payment_note' => __( 'Are you sure you wish to delete this note?', 'give' ), |
|
250 | - 'revoke_api_key' => __( 'Are you sure you wish to revoke this API key?', 'give' ), |
|
251 | - 'regenerate_api_key' => __( 'Are you sure you wish to regenerate this API key?', 'give' ), |
|
252 | - 'resend_receipt' => __( 'Are you sure you wish to resend the donation receipt?', 'give' ), |
|
253 | - 'copy_download_link_text' => __( 'Copy these links to your clipboard and give them to your donor', 'give' ), |
|
254 | - 'delete_payment_download' => sprintf( __( 'Are you sure you wish to delete this %s?', 'give' ), give_get_forms_label_singular() ), |
|
255 | - 'one_price_min' => __( 'You must have at least one price', 'give' ), |
|
256 | - 'one_file_min' => __( 'You must have at least one file', 'give' ), |
|
257 | - 'one_field_min' => __( 'You must have at least one field', 'give' ), |
|
258 | - 'one_option' => sprintf( __( 'Choose a %s', 'give' ), give_get_forms_label_singular() ), |
|
259 | - 'one_or_more_option' => sprintf( __( 'Choose one or more %s', 'give' ), give_get_forms_label_plural() ), |
|
260 | - 'numeric_item_price' => __( 'Item price must be numeric', 'give' ), |
|
261 | - 'numeric_quantity' => __( 'Quantity must be numeric', 'give' ), |
|
262 | - 'currency_sign' => give_currency_filter( '' ), |
|
263 | - 'currency_pos' => isset( $give_options['currency_position'] ) ? $give_options['currency_position'] : 'before', |
|
247 | + 'quick_edit_warning' => __('Sorry, not available for variable priced forms.', 'give'), |
|
248 | + 'delete_payment' => __('Are you sure you wish to delete this payment?', 'give'), |
|
249 | + 'delete_payment_note' => __('Are you sure you wish to delete this note?', 'give'), |
|
250 | + 'revoke_api_key' => __('Are you sure you wish to revoke this API key?', 'give'), |
|
251 | + 'regenerate_api_key' => __('Are you sure you wish to regenerate this API key?', 'give'), |
|
252 | + 'resend_receipt' => __('Are you sure you wish to resend the donation receipt?', 'give'), |
|
253 | + 'copy_download_link_text' => __('Copy these links to your clipboard and give them to your donor', 'give'), |
|
254 | + 'delete_payment_download' => sprintf(__('Are you sure you wish to delete this %s?', 'give'), give_get_forms_label_singular()), |
|
255 | + 'one_price_min' => __('You must have at least one price', 'give'), |
|
256 | + 'one_file_min' => __('You must have at least one file', 'give'), |
|
257 | + 'one_field_min' => __('You must have at least one field', 'give'), |
|
258 | + 'one_option' => sprintf(__('Choose a %s', 'give'), give_get_forms_label_singular()), |
|
259 | + 'one_or_more_option' => sprintf(__('Choose one or more %s', 'give'), give_get_forms_label_plural()), |
|
260 | + 'numeric_item_price' => __('Item price must be numeric', 'give'), |
|
261 | + 'numeric_quantity' => __('Quantity must be numeric', 'give'), |
|
262 | + 'currency_sign' => give_currency_filter(''), |
|
263 | + 'currency_pos' => isset($give_options['currency_position']) ? $give_options['currency_position'] : 'before', |
|
264 | 264 | 'currency_decimals' => give_currency_decimal_filter(), |
265 | - 'new_media_ui' => apply_filters( 'give_use_35_media_ui', 1 ), |
|
266 | - 'remove_text' => __( 'Remove', 'give' ), |
|
267 | - 'type_to_search' => sprintf( __( 'Type to search %s', 'give' ), give_get_forms_label_plural() ), |
|
268 | - 'batch_export_no_class' => __( 'You must choose a method.', 'give' ), |
|
269 | - 'batch_export_no_reqs' => __( 'Required fields not completed.', 'give' ), |
|
270 | - 'reset_stats_warn' => __( 'Are you sure you want to reset Give? This process is <strong><em>not reversible</em></strong> and will delete all data regardless of test or live mode. Please be sure you have a recent backup before proceeding.', 'give' ), |
|
271 | - ) ); |
|
272 | - |
|
273 | - if ( function_exists( 'wp_enqueue_media' ) && version_compare( $wp_version, '3.5', '>=' ) ) { |
|
265 | + 'new_media_ui' => apply_filters('give_use_35_media_ui', 1), |
|
266 | + 'remove_text' => __('Remove', 'give'), |
|
267 | + 'type_to_search' => sprintf(__('Type to search %s', 'give'), give_get_forms_label_plural()), |
|
268 | + 'batch_export_no_class' => __('You must choose a method.', 'give'), |
|
269 | + 'batch_export_no_reqs' => __('Required fields not completed.', 'give'), |
|
270 | + 'reset_stats_warn' => __('Are you sure you want to reset Give? This process is <strong><em>not reversible</em></strong> and will delete all data regardless of test or live mode. Please be sure you have a recent backup before proceeding.', 'give'), |
|
271 | + )); |
|
272 | + |
|
273 | + if (function_exists('wp_enqueue_media') && version_compare($wp_version, '3.5', '>=')) { |
|
274 | 274 | //call for new media manager |
275 | 275 | wp_enqueue_media(); |
276 | 276 | } |
277 | 277 | |
278 | 278 | } |
279 | 279 | |
280 | -add_action( 'admin_enqueue_scripts', 'give_load_admin_scripts', 100 ); |
|
280 | +add_action('admin_enqueue_scripts', 'give_load_admin_scripts', 100); |
|
281 | 281 | |
282 | 282 | /** |
283 | 283 | * Admin Give Icon |
@@ -294,14 +294,14 @@ discard block |
||
294 | 294 | ?> |
295 | 295 | <style type="text/css" media="screen"> |
296 | 296 | |
297 | - <?php if( version_compare( $wp_version, '3.8-RC', '>=' ) || version_compare( $wp_version, '3.8', '>=' ) ) { ?> |
|
297 | + <?php if (version_compare($wp_version, '3.8-RC', '>=') || version_compare($wp_version, '3.8', '>=')) { ?> |
|
298 | 298 | @font-face { |
299 | 299 | font-family: 'give-icomoon'; |
300 | - src: url('<?php echo GIVE_PLUGIN_URL . '/assets/fonts/icomoon.eot?-ngjl88'; ?>'); |
|
301 | - src: url('<?php echo GIVE_PLUGIN_URL . '/assets/fonts/icomoon.eot?#iefix-ngjl88'?>') format('embedded-opentype'), |
|
302 | - url('<?php echo GIVE_PLUGIN_URL . '/assets/fonts/icomoon.woff?-ngjl88'; ?>') format('woff'), |
|
303 | - url('<?php echo GIVE_PLUGIN_URL . '/assets/fonts/icomoon.ttf?-ngjl88'; ?>') format('truetype'), |
|
304 | - url('<?php echo GIVE_PLUGIN_URL . '/assets/fonts/icomoon.svg?-ngjl88#icomoon'; ?>') format('svg'); |
|
300 | + src: url('<?php echo GIVE_PLUGIN_URL.'/assets/fonts/icomoon.eot?-ngjl88'; ?>'); |
|
301 | + src: url('<?php echo GIVE_PLUGIN_URL.'/assets/fonts/icomoon.eot?#iefix-ngjl88'?>') format('embedded-opentype'), |
|
302 | + url('<?php echo GIVE_PLUGIN_URL.'/assets/fonts/icomoon.woff?-ngjl88'; ?>') format('woff'), |
|
303 | + url('<?php echo GIVE_PLUGIN_URL.'/assets/fonts/icomoon.ttf?-ngjl88'; ?>') format('truetype'), |
|
304 | + url('<?php echo GIVE_PLUGIN_URL.'/assets/fonts/icomoon.svg?-ngjl88#icomoon'; ?>') format('svg'); |
|
305 | 305 | font-weight: normal; |
306 | 306 | font-style: normal; |
307 | 307 | } |
@@ -320,4 +320,4 @@ discard block |
||
320 | 320 | <?php |
321 | 321 | } |
322 | 322 | |
323 | -add_action( 'admin_head', 'give_admin_icon' ); |
|
323 | +add_action('admin_head', 'give_admin_icon'); |
@@ -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,17 +24,17 @@ discard block |
||
24 | 24 | // Default, built-in gateways |
25 | 25 | $gateways = array( |
26 | 26 | 'paypal' => array( |
27 | - 'admin_label' => __( 'PayPal Standard', 'give' ), |
|
28 | - 'checkout_label' => __( 'PayPal', 'give' ), |
|
29 | - 'supports' => array( 'buy_now' ) |
|
27 | + 'admin_label' => __('PayPal Standard', 'give'), |
|
28 | + 'checkout_label' => __('PayPal', 'give'), |
|
29 | + 'supports' => array('buy_now') |
|
30 | 30 | ), |
31 | 31 | 'manual' => array( |
32 | - 'admin_label' => __( 'Test Payment', 'give' ), |
|
33 | - 'checkout_label' => __( 'Test Payment', 'give' ) |
|
32 | + 'admin_label' => __('Test Payment', 'give'), |
|
33 | + 'checkout_label' => __('Test Payment', 'give') |
|
34 | 34 | ), |
35 | 35 | ); |
36 | 36 | |
37 | - return apply_filters( 'give_payment_gateways', $gateways ); |
|
37 | + return apply_filters('give_payment_gateways', $gateways); |
|
38 | 38 | |
39 | 39 | } |
40 | 40 | |
@@ -49,22 +49,22 @@ discard block |
||
49 | 49 | |
50 | 50 | $gateways = give_get_payment_gateways(); |
51 | 51 | |
52 | - $enabled = isset( $_POST['gateways'] ) |
|
52 | + $enabled = isset($_POST['gateways']) |
|
53 | 53 | ? $_POST['gateways'] |
54 | - : ( isset( $give_options['gateways'] ) ? $give_options['gateways'] : false ); |
|
54 | + : (isset($give_options['gateways']) ? $give_options['gateways'] : false); |
|
55 | 55 | |
56 | 56 | $gateway_list = array(); |
57 | 57 | |
58 | - foreach ( $gateways as $key => $gateway ) { |
|
59 | - if ( isset( $enabled[ $key ] ) && $enabled[ $key ] == 1 ) { |
|
60 | - $gateway_list[ $key ] = $gateway; |
|
58 | + foreach ($gateways as $key => $gateway) { |
|
59 | + if (isset($enabled[$key]) && $enabled[$key] == 1) { |
|
60 | + $gateway_list[$key] = $gateway; |
|
61 | 61 | } |
62 | 62 | } |
63 | 63 | |
64 | 64 | // Set order of payment gateway in list. |
65 | - $gateway_list = give_get_ordered_payment_gateways( $gateway_list ); |
|
65 | + $gateway_list = give_get_ordered_payment_gateways($gateway_list); |
|
66 | 66 | |
67 | - return apply_filters( 'give_enabled_payment_gateways', $gateway_list ); |
|
67 | + return apply_filters('give_enabled_payment_gateways', $gateway_list); |
|
68 | 68 | } |
69 | 69 | |
70 | 70 | /** |
@@ -76,12 +76,12 @@ discard block |
||
76 | 76 | * |
77 | 77 | * @return boolean true if enabled, false otherwise |
78 | 78 | */ |
79 | -function give_is_gateway_active( $gateway ) { |
|
79 | +function give_is_gateway_active($gateway) { |
|
80 | 80 | $gateways = give_get_enabled_payment_gateways(); |
81 | 81 | |
82 | - $ret = array_key_exists( $gateway, $gateways ); |
|
82 | + $ret = array_key_exists($gateway, $gateways); |
|
83 | 83 | |
84 | - return apply_filters( 'give_is_gateway_active', $ret, $gateway, $gateways ); |
|
84 | + return apply_filters('give_is_gateway_active', $ret, $gateway, $gateways); |
|
85 | 85 | } |
86 | 86 | |
87 | 87 | /** |
@@ -94,24 +94,24 @@ discard block |
||
94 | 94 | * |
95 | 95 | * @return string Gateway ID |
96 | 96 | */ |
97 | -function give_get_default_gateway( $form_id ) { |
|
97 | +function give_get_default_gateway($form_id) { |
|
98 | 98 | |
99 | 99 | global $give_options; |
100 | 100 | |
101 | - $default = isset( $give_options['default_gateway'] ) && give_is_gateway_active( $give_options['default_gateway'] ) ? $give_options['default_gateway'] : 'paypal'; |
|
102 | - $form_default = get_post_meta( $form_id, '_give_default_gateway', true ); |
|
101 | + $default = isset($give_options['default_gateway']) && give_is_gateway_active($give_options['default_gateway']) ? $give_options['default_gateway'] : 'paypal'; |
|
102 | + $form_default = get_post_meta($form_id, '_give_default_gateway', true); |
|
103 | 103 | |
104 | 104 | //Single Form settings varies compared to the Global default settings |
105 | - if ( ! empty( $form_default ) && |
|
105 | + if ( ! empty($form_default) && |
|
106 | 106 | $form_id !== null && |
107 | 107 | $default !== $form_default && |
108 | 108 | $form_default !== 'global' && |
109 | - give_is_gateway_active( $form_default ) |
|
109 | + give_is_gateway_active($form_default) |
|
110 | 110 | ) { |
111 | 111 | $default = $form_default; |
112 | 112 | } |
113 | 113 | |
114 | - return apply_filters( 'give_default_gateway', $default ); |
|
114 | + return apply_filters('give_default_gateway', $default); |
|
115 | 115 | } |
116 | 116 | |
117 | 117 | /** |
@@ -123,18 +123,18 @@ discard block |
||
123 | 123 | * |
124 | 124 | * @return string Gateway admin label |
125 | 125 | */ |
126 | -function give_get_gateway_admin_label( $gateway ) { |
|
126 | +function give_get_gateway_admin_label($gateway) { |
|
127 | 127 | $gateways = give_get_enabled_payment_gateways(); |
128 | - $label = isset( $gateways[ $gateway ] ) ? $gateways[ $gateway ]['admin_label'] : $gateway; |
|
129 | - $payment = isset( $_GET['id'] ) ? absint( $_GET['id'] ) : false; |
|
128 | + $label = isset($gateways[$gateway]) ? $gateways[$gateway]['admin_label'] : $gateway; |
|
129 | + $payment = isset($_GET['id']) ? absint($_GET['id']) : false; |
|
130 | 130 | |
131 | - if ( $gateway == 'manual' && $payment ) { |
|
132 | - if ( give_get_payment_amount( $payment ) == 0 ) { |
|
133 | - $label = __( 'Test Donation', 'give' ); |
|
131 | + if ($gateway == 'manual' && $payment) { |
|
132 | + if (give_get_payment_amount($payment) == 0) { |
|
133 | + $label = __('Test Donation', 'give'); |
|
134 | 134 | } |
135 | 135 | } |
136 | 136 | |
137 | - return apply_filters( 'give_gateway_admin_label', $label, $gateway ); |
|
137 | + return apply_filters('give_gateway_admin_label', $label, $gateway); |
|
138 | 138 | } |
139 | 139 | |
140 | 140 | /** |
@@ -146,15 +146,15 @@ discard block |
||
146 | 146 | * |
147 | 147 | * @return string Checkout label for the gateway |
148 | 148 | */ |
149 | -function give_get_gateway_checkout_label( $gateway ) { |
|
149 | +function give_get_gateway_checkout_label($gateway) { |
|
150 | 150 | $gateways = give_get_enabled_payment_gateways(); |
151 | - $label = isset( $gateways[ $gateway ] ) ? $gateways[ $gateway ]['checkout_label'] : $gateway; |
|
151 | + $label = isset($gateways[$gateway]) ? $gateways[$gateway]['checkout_label'] : $gateway; |
|
152 | 152 | |
153 | - if ( $gateway == 'manual' ) { |
|
154 | - $label = __( 'Test Donation', 'give' ); |
|
153 | + if ($gateway == 'manual') { |
|
154 | + $label = __('Test Donation', 'give'); |
|
155 | 155 | } |
156 | 156 | |
157 | - return apply_filters( 'give_gateway_checkout_label', $label, $gateway ); |
|
157 | + return apply_filters('give_gateway_checkout_label', $label, $gateway); |
|
158 | 158 | } |
159 | 159 | |
160 | 160 | /** |
@@ -166,11 +166,11 @@ discard block |
||
166 | 166 | * |
167 | 167 | * @return array Options the gateway supports |
168 | 168 | */ |
169 | -function give_get_gateway_supports( $gateway ) { |
|
169 | +function give_get_gateway_supports($gateway) { |
|
170 | 170 | $gateways = give_get_enabled_payment_gateways(); |
171 | - $supports = isset( $gateways[ $gateway ]['supports'] ) ? $gateways[ $gateway ]['supports'] : array(); |
|
171 | + $supports = isset($gateways[$gateway]['supports']) ? $gateways[$gateway]['supports'] : array(); |
|
172 | 172 | |
173 | - return apply_filters( 'give_gateway_supports', $supports, $gateway ); |
|
173 | + return apply_filters('give_gateway_supports', $supports, $gateway); |
|
174 | 174 | } |
175 | 175 | |
176 | 176 | /** |
@@ -182,11 +182,11 @@ discard block |
||
182 | 182 | * |
183 | 183 | * @return bool |
184 | 184 | */ |
185 | -function give_gateway_supports_buy_now( $gateway ) { |
|
186 | - $supports = give_get_gateway_supports( $gateway ); |
|
187 | - $ret = in_array( 'buy_now', $supports ); |
|
185 | +function give_gateway_supports_buy_now($gateway) { |
|
186 | + $supports = give_get_gateway_supports($gateway); |
|
187 | + $ret = in_array('buy_now', $supports); |
|
188 | 188 | |
189 | - return apply_filters( 'give_gateway_supports_buy_now', $ret, $gateway ); |
|
189 | + return apply_filters('give_gateway_supports_buy_now', $ret, $gateway); |
|
190 | 190 | } |
191 | 191 | |
192 | 192 | /** |
@@ -199,16 +199,16 @@ discard block |
||
199 | 199 | $gateways = give_get_enabled_payment_gateways(); |
200 | 200 | $ret = false; |
201 | 201 | |
202 | - if ( $gateways ) { |
|
203 | - foreach ( $gateways as $gateway_id => $gateway ) { |
|
204 | - if ( give_gateway_supports_buy_now( $gateway_id ) ) { |
|
202 | + if ($gateways) { |
|
203 | + foreach ($gateways as $gateway_id => $gateway) { |
|
204 | + if (give_gateway_supports_buy_now($gateway_id)) { |
|
205 | 205 | $ret = true; |
206 | 206 | break; |
207 | 207 | } |
208 | 208 | } |
209 | 209 | } |
210 | 210 | |
211 | - return apply_filters( 'give_give_supports_buy_now', $ret ); |
|
211 | + return apply_filters('give_give_supports_buy_now', $ret); |
|
212 | 212 | } |
213 | 213 | |
214 | 214 | /** |
@@ -221,12 +221,12 @@ discard block |
||
221 | 221 | * |
222 | 222 | * @return void |
223 | 223 | */ |
224 | -function give_send_to_gateway( $gateway, $payment_data ) { |
|
224 | +function give_send_to_gateway($gateway, $payment_data) { |
|
225 | 225 | |
226 | - $payment_data['gateway_nonce'] = wp_create_nonce( 'give-gateway' ); |
|
226 | + $payment_data['gateway_nonce'] = wp_create_nonce('give-gateway'); |
|
227 | 227 | |
228 | 228 | // $gateway must match the ID used when registering the gateway |
229 | - do_action( 'give_gateway_' . $gateway, $payment_data ); |
|
229 | + do_action('give_gateway_'.$gateway, $payment_data); |
|
230 | 230 | } |
231 | 231 | |
232 | 232 | |
@@ -243,32 +243,32 @@ discard block |
||
243 | 243 | * |
244 | 244 | * @return string $enabled_gateway The slug of the gateway |
245 | 245 | */ |
246 | -function give_get_chosen_gateway( $form_id ) { |
|
246 | +function give_get_chosen_gateway($form_id) { |
|
247 | 247 | $gateways = give_get_enabled_payment_gateways(); |
248 | - $request_form_id = isset( $_REQUEST['give_form_id'] ) ? $_REQUEST['give_form_id'] : 0; |
|
249 | - if ( empty( $request_form_id ) ) { |
|
250 | - $request_form_id = isset( $_REQUEST['form-id'] ) ? $_REQUEST['form-id'] : 0; |
|
248 | + $request_form_id = isset($_REQUEST['give_form_id']) ? $_REQUEST['give_form_id'] : 0; |
|
249 | + if (empty($request_form_id)) { |
|
250 | + $request_form_id = isset($_REQUEST['form-id']) ? $_REQUEST['form-id'] : 0; |
|
251 | 251 | } |
252 | - $chosen = give_get_default_gateway( $form_id ); |
|
252 | + $chosen = give_get_default_gateway($form_id); |
|
253 | 253 | $enabled_gateway = ''; |
254 | 254 | |
255 | 255 | //Take into account request Form ID args |
256 | - if ( ! empty( $request_form_id ) && $form_id == $request_form_id ) { |
|
256 | + if ( ! empty($request_form_id) && $form_id == $request_form_id) { |
|
257 | 257 | $chosen = $_REQUEST['payment-mode']; |
258 | 258 | } |
259 | 259 | |
260 | - if ( $chosen ) { |
|
261 | - $enabled_gateway = urldecode( $chosen ); |
|
262 | - } else if ( count( $gateways ) >= 1 && ! $chosen ) { |
|
263 | - foreach ( $gateways as $gateway_id => $gateway ): |
|
260 | + if ($chosen) { |
|
261 | + $enabled_gateway = urldecode($chosen); |
|
262 | + } else if (count($gateways) >= 1 && ! $chosen) { |
|
263 | + foreach ($gateways as $gateway_id => $gateway): |
|
264 | 264 | $enabled_gateway = $gateway_id; |
265 | 265 | endforeach; |
266 | 266 | } else { |
267 | - $enabled_gateway = give_get_default_gateway( $form_id ); |
|
267 | + $enabled_gateway = give_get_default_gateway($form_id); |
|
268 | 268 | } |
269 | 269 | |
270 | 270 | |
271 | - return apply_filters( 'give_chosen_gateway', $enabled_gateway ); |
|
271 | + return apply_filters('give_chosen_gateway', $enabled_gateway); |
|
272 | 272 | } |
273 | 273 | |
274 | 274 | /** |
@@ -285,8 +285,8 @@ discard block |
||
285 | 285 | * |
286 | 286 | * @return int ID of the new log entry |
287 | 287 | */ |
288 | -function give_record_gateway_error( $title = '', $message = '', $parent = 0 ) { |
|
289 | - return give_record_log( $title, $message, $parent, 'gateway_error' ); |
|
288 | +function give_record_gateway_error($title = '', $message = '', $parent = 0) { |
|
289 | + return give_record_log($title, $message, $parent, 'gateway_error'); |
|
290 | 290 | } |
291 | 291 | |
292 | 292 | /** |
@@ -299,7 +299,7 @@ discard block |
||
299 | 299 | * |
300 | 300 | * @return int |
301 | 301 | */ |
302 | -function give_count_sales_by_gateway( $gateway_id = 'paypal', $status = 'publish' ) { |
|
302 | +function give_count_sales_by_gateway($gateway_id = 'paypal', $status = 'publish') { |
|
303 | 303 | |
304 | 304 | $ret = 0; |
305 | 305 | $args = array( |
@@ -311,9 +311,9 @@ discard block |
||
311 | 311 | 'fields' => 'ids' |
312 | 312 | ); |
313 | 313 | |
314 | - $payments = new WP_Query( $args ); |
|
314 | + $payments = new WP_Query($args); |
|
315 | 315 | |
316 | - if ( $payments ) { |
|
316 | + if ($payments) { |
|
317 | 317 | $ret = $payments->post_count; |
318 | 318 | } |
319 | 319 | |
@@ -330,25 +330,25 @@ discard block |
||
330 | 330 | * |
331 | 331 | * @return array $gateways All the available gateways |
332 | 332 | */ |
333 | -function give_get_ordered_payment_gateways( $gateways ) { |
|
333 | +function give_get_ordered_payment_gateways($gateways) { |
|
334 | 334 | |
335 | 335 | // Get gateways setting. |
336 | - $gateways_setting = give_get_option( 'gateways' ); |
|
336 | + $gateways_setting = give_get_option('gateways'); |
|
337 | 337 | |
338 | 338 | // Return from here if we do not have gateways setting. |
339 | - if ( empty( $gateways_setting ) ) { |
|
339 | + if (empty($gateways_setting)) { |
|
340 | 340 | return $gateways; |
341 | 341 | } |
342 | 342 | |
343 | 343 | // Reverse array to order payment gateways. |
344 | - $gateways_setting = array_reverse( $gateways_setting ); |
|
344 | + $gateways_setting = array_reverse($gateways_setting); |
|
345 | 345 | |
346 | 346 | // Reorder gateways array |
347 | - foreach ( $gateways_setting as $gateway_key => $value ) { |
|
347 | + foreach ($gateways_setting as $gateway_key => $value) { |
|
348 | 348 | |
349 | - $new_gateway_value = isset( $gateways[ $gateway_key ] ) ? $gateways[ $gateway_key ] : ''; |
|
350 | - unset( $gateways[ $gateway_key ] ); |
|
351 | - $gateways = array_merge( array( $gateway_key => $new_gateway_value ), $gateways ); |
|
349 | + $new_gateway_value = isset($gateways[$gateway_key]) ? $gateways[$gateway_key] : ''; |
|
350 | + unset($gateways[$gateway_key]); |
|
351 | + $gateways = array_merge(array($gateway_key => $new_gateway_value), $gateways); |
|
352 | 352 | } |
353 | 353 | |
354 | 354 | /** |
@@ -358,5 +358,5 @@ discard block |
||
358 | 358 | * |
359 | 359 | * @param array $gateways All the available gateways |
360 | 360 | */ |
361 | - return apply_filters( 'give_payment_gateways_order', $gateways ); |
|
361 | + return apply_filters('give_payment_gateways_order', $gateways); |
|
362 | 362 | } |
@@ -10,7 +10,7 @@ discard block |
||
10 | 10 | */ |
11 | 11 | |
12 | 12 | // Exit if accessed directly |
13 | -if ( ! defined( 'ABSPATH' ) ) { |
|
13 | +if ( ! defined('ABSPATH')) { |
|
14 | 14 | exit; |
15 | 15 | } |
16 | 16 | |
@@ -25,27 +25,27 @@ discard block |
||
25 | 25 | */ |
26 | 26 | function give_process_purchase_form() { |
27 | 27 | |
28 | - do_action( 'give_pre_process_purchase' ); |
|
28 | + do_action('give_pre_process_purchase'); |
|
29 | 29 | |
30 | 30 | // Validate the form $_POST data |
31 | 31 | $valid_data = give_purchase_form_validate_fields(); |
32 | 32 | |
33 | 33 | // Allow themes and plugins to hook to errors |
34 | - do_action( 'give_checkout_error_checks', $valid_data, $_POST ); |
|
34 | + do_action('give_checkout_error_checks', $valid_data, $_POST); |
|
35 | 35 | |
36 | - $is_ajax = isset( $_POST['give_ajax'] ); |
|
36 | + $is_ajax = isset($_POST['give_ajax']); |
|
37 | 37 | |
38 | 38 | // Process the login form |
39 | - if ( isset( $_POST['give_login_submit'] ) ) { |
|
39 | + if (isset($_POST['give_login_submit'])) { |
|
40 | 40 | give_process_form_login(); |
41 | 41 | } |
42 | 42 | |
43 | 43 | // Validate the user |
44 | - $user = give_get_purchase_form_user( $valid_data ); |
|
44 | + $user = give_get_purchase_form_user($valid_data); |
|
45 | 45 | |
46 | - if ( false === $valid_data || give_get_errors() || ! $user ) { |
|
47 | - if ( $is_ajax ) { |
|
48 | - do_action( 'give_ajax_checkout_errors' ); |
|
46 | + if (false === $valid_data || give_get_errors() || ! $user) { |
|
47 | + if ($is_ajax) { |
|
48 | + do_action('give_ajax_checkout_errors'); |
|
49 | 49 | give_die(); |
50 | 50 | } else { |
51 | 51 | return false; |
@@ -53,17 +53,17 @@ discard block |
||
53 | 53 | } |
54 | 54 | |
55 | 55 | //If AJAX send back success to proceed with form submission |
56 | - if ( $is_ajax ) { |
|
56 | + if ($is_ajax) { |
|
57 | 57 | echo 'success'; |
58 | 58 | give_die(); |
59 | 59 | } |
60 | 60 | |
61 | 61 | //After AJAX: Setup session if not using php_sessions |
62 | - if ( ! Give()->session->use_php_sessions() ) { |
|
62 | + if ( ! Give()->session->use_php_sessions()) { |
|
63 | 63 | //Double-check that set_cookie is publicly accessible; |
64 | 64 | // we're using a slightly modified class-wp-sessions.php |
65 | - $session_reflection = new ReflectionMethod( 'WP_Session', 'set_cookie' ); |
|
66 | - if ( $session_reflection->isPublic() ) { |
|
65 | + $session_reflection = new ReflectionMethod('WP_Session', 'set_cookie'); |
|
66 | + if ($session_reflection->isPublic()) { |
|
67 | 67 | // Manually set the cookie. |
68 | 68 | Give()->session->init()->set_cookie(); |
69 | 69 | } |
@@ -78,18 +78,18 @@ discard block |
||
78 | 78 | 'address' => $user['address'] |
79 | 79 | ); |
80 | 80 | |
81 | - $auth_key = defined( 'AUTH_KEY' ) ? AUTH_KEY : ''; |
|
81 | + $auth_key = defined('AUTH_KEY') ? AUTH_KEY : ''; |
|
82 | 82 | |
83 | - $price = isset( $_POST['give-amount'] ) ? (float) apply_filters( 'give_donation_total', give_sanitize_amount( give_format_amount( $_POST['give-amount'] ) ) ) : '0.00'; |
|
84 | - $purchase_key = strtolower( md5( $user['user_email'] . date( 'Y-m-d H:i:s' ) . $auth_key . uniqid( 'give', true ) ) ); |
|
83 | + $price = isset($_POST['give-amount']) ? (float) apply_filters('give_donation_total', give_sanitize_amount(give_format_amount($_POST['give-amount']))) : '0.00'; |
|
84 | + $purchase_key = strtolower(md5($user['user_email'].date('Y-m-d H:i:s').$auth_key.uniqid('give', true))); |
|
85 | 85 | |
86 | 86 | // Setup purchase information |
87 | 87 | $purchase_data = array( |
88 | 88 | 'price' => $price, |
89 | 89 | 'purchase_key' => $purchase_key, |
90 | 90 | 'user_email' => $user['user_email'], |
91 | - 'date' => date( 'Y-m-d H:i:s', current_time( 'timestamp' ) ), |
|
92 | - 'user_info' => stripslashes_deep( $user_info ), |
|
91 | + 'date' => date('Y-m-d H:i:s', current_time('timestamp')), |
|
92 | + 'user_info' => stripslashes_deep($user_info), |
|
93 | 93 | 'post_data' => $_POST, |
94 | 94 | 'gateway' => $valid_data['gateway'], |
95 | 95 | 'card_info' => $valid_data['cc_info'] |
@@ -99,37 +99,37 @@ discard block |
||
99 | 99 | $valid_data['user'] = $user; |
100 | 100 | |
101 | 101 | // Allow themes and plugins to hook before the gateway |
102 | - do_action( 'give_checkout_before_gateway', $_POST, $user_info, $valid_data ); |
|
102 | + do_action('give_checkout_before_gateway', $_POST, $user_info, $valid_data); |
|
103 | 103 | |
104 | 104 | //Sanity check for price |
105 | - if ( ! $purchase_data['price'] ) { |
|
105 | + if ( ! $purchase_data['price']) { |
|
106 | 106 | // Revert to manual |
107 | 107 | $purchase_data['gateway'] = 'manual'; |
108 | 108 | $_POST['give-gateway'] = 'manual'; |
109 | 109 | } |
110 | 110 | |
111 | 111 | // Allow the purchase data to be modified before it is sent to the gateway |
112 | - $purchase_data = apply_filters( 'give_purchase_data_before_gateway', $purchase_data, $valid_data ); |
|
112 | + $purchase_data = apply_filters('give_purchase_data_before_gateway', $purchase_data, $valid_data); |
|
113 | 113 | |
114 | 114 | // Setup the data we're storing in the purchase session |
115 | 115 | $session_data = $purchase_data; |
116 | 116 | |
117 | 117 | // Make sure credit card numbers are never stored in sessions |
118 | - unset( $session_data['card_info']['card_number'] ); |
|
119 | - unset( $session_data['post_data']['card_number'] ); |
|
118 | + unset($session_data['card_info']['card_number']); |
|
119 | + unset($session_data['post_data']['card_number']); |
|
120 | 120 | |
121 | 121 | // Used for showing data to non logged-in users after purchase, and for other plugins needing purchase data. |
122 | - give_set_purchase_session( $session_data ); |
|
122 | + give_set_purchase_session($session_data); |
|
123 | 123 | |
124 | 124 | // Send info to the gateway for payment processing |
125 | - give_send_to_gateway( $purchase_data['gateway'], $purchase_data ); |
|
125 | + give_send_to_gateway($purchase_data['gateway'], $purchase_data); |
|
126 | 126 | give_die(); |
127 | 127 | |
128 | 128 | } |
129 | 129 | |
130 | -add_action( 'give_purchase', 'give_process_purchase_form' ); |
|
131 | -add_action( 'wp_ajax_give_process_checkout', 'give_process_purchase_form' ); |
|
132 | -add_action( 'wp_ajax_nopriv_give_process_checkout', 'give_process_purchase_form' ); |
|
130 | +add_action('give_purchase', 'give_process_purchase_form'); |
|
131 | +add_action('wp_ajax_give_process_checkout', 'give_process_purchase_form'); |
|
132 | +add_action('wp_ajax_nopriv_give_process_checkout', 'give_process_purchase_form'); |
|
133 | 133 | |
134 | 134 | /** |
135 | 135 | * Process the checkout login form |
@@ -140,32 +140,32 @@ discard block |
||
140 | 140 | */ |
141 | 141 | function give_process_form_login() { |
142 | 142 | |
143 | - $is_ajax = isset( $_POST['give_ajax'] ); |
|
143 | + $is_ajax = isset($_POST['give_ajax']); |
|
144 | 144 | |
145 | 145 | $user_data = give_purchase_form_validate_user_login(); |
146 | 146 | |
147 | - if ( give_get_errors() || $user_data['user_id'] < 1 ) { |
|
148 | - if ( $is_ajax ) { |
|
149 | - do_action( 'give_ajax_checkout_errors' ); |
|
147 | + if (give_get_errors() || $user_data['user_id'] < 1) { |
|
148 | + if ($is_ajax) { |
|
149 | + do_action('give_ajax_checkout_errors'); |
|
150 | 150 | give_die(); |
151 | 151 | } else { |
152 | - wp_redirect( $_SERVER['HTTP_REFERER'] ); |
|
152 | + wp_redirect($_SERVER['HTTP_REFERER']); |
|
153 | 153 | exit; |
154 | 154 | } |
155 | 155 | } |
156 | 156 | |
157 | - give_log_user_in( $user_data['user_id'], $user_data['user_login'], $user_data['user_pass'] ); |
|
157 | + give_log_user_in($user_data['user_id'], $user_data['user_login'], $user_data['user_pass']); |
|
158 | 158 | |
159 | - if ( $is_ajax ) { |
|
159 | + if ($is_ajax) { |
|
160 | 160 | echo 'success'; |
161 | 161 | give_die(); |
162 | 162 | } else { |
163 | - wp_redirect( $_SERVER['HTTP_REFERER'] ); |
|
163 | + wp_redirect($_SERVER['HTTP_REFERER']); |
|
164 | 164 | } |
165 | 165 | } |
166 | 166 | |
167 | -add_action( 'wp_ajax_give_process_checkout_login', 'give_process_form_login' ); |
|
168 | -add_action( 'wp_ajax_nopriv_give_process_checkout_login', 'give_process_form_login' ); |
|
167 | +add_action('wp_ajax_give_process_checkout_login', 'give_process_form_login'); |
|
168 | +add_action('wp_ajax_nopriv_give_process_checkout_login', 'give_process_form_login'); |
|
169 | 169 | |
170 | 170 | /** |
171 | 171 | * Purchase Form Validate Fields |
@@ -177,45 +177,45 @@ discard block |
||
177 | 177 | function give_purchase_form_validate_fields() { |
178 | 178 | |
179 | 179 | // Check if there is $_POST |
180 | - if ( empty( $_POST ) ) { |
|
180 | + if (empty($_POST)) { |
|
181 | 181 | return false; |
182 | 182 | } |
183 | 183 | |
184 | - $form_id = isset( $_POST['give-form-id'] ) ? $_POST['give-form-id'] : ''; |
|
184 | + $form_id = isset($_POST['give-form-id']) ? $_POST['give-form-id'] : ''; |
|
185 | 185 | |
186 | 186 | // Start an array to collect valid data |
187 | 187 | $valid_data = array( |
188 | 188 | 'gateway' => give_purchase_form_validate_gateway(), // Gateway fallback (amount is validated here) |
189 | - 'need_new_user' => false, // New user flag |
|
190 | - 'need_user_login' => false, // Login user flag |
|
191 | - 'logged_user_data' => array(), // Logged user collected data |
|
192 | - 'new_user_data' => array(), // New user collected data |
|
193 | - 'login_user_data' => array(), // Login user collected data |
|
194 | - 'guest_user_data' => array(), // Guest user collected data |
|
189 | + 'need_new_user' => false, // New user flag |
|
190 | + 'need_user_login' => false, // Login user flag |
|
191 | + 'logged_user_data' => array(), // Logged user collected data |
|
192 | + 'new_user_data' => array(), // New user collected data |
|
193 | + 'login_user_data' => array(), // Login user collected data |
|
194 | + 'guest_user_data' => array(), // Guest user collected data |
|
195 | 195 | 'cc_info' => give_purchase_form_validate_cc() // Credit card info |
196 | 196 | ); |
197 | 197 | |
198 | 198 | //Validate Honeypot First |
199 | - if ( ! empty( $_POST['give-honeypot'] ) ) { |
|
200 | - give_set_error( 'invalid_honeypot', __( 'Honeypot field detected. Go away bad bot!', 'give' ) ); |
|
199 | + if ( ! empty($_POST['give-honeypot'])) { |
|
200 | + give_set_error('invalid_honeypot', __('Honeypot field detected. Go away bad bot!', 'give')); |
|
201 | 201 | } |
202 | 202 | |
203 | 203 | // Validate agree to terms |
204 | - $terms_option = get_post_meta( $form_id, '_give_terms_option', true ); |
|
205 | - if ( isset( $terms_option ) && $terms_option === 'yes' ) { |
|
204 | + $terms_option = get_post_meta($form_id, '_give_terms_option', true); |
|
205 | + if (isset($terms_option) && $terms_option === 'yes') { |
|
206 | 206 | give_purchase_form_validate_agree_to_terms(); |
207 | 207 | } |
208 | 208 | |
209 | - if ( is_user_logged_in() ) { |
|
209 | + if (is_user_logged_in()) { |
|
210 | 210 | // Collect logged in user data |
211 | 211 | $valid_data['logged_in_user'] = give_purchase_form_validate_logged_in_user(); |
212 | - } else if ( isset( $_POST['give-purchase-var'] ) && $_POST['give-purchase-var'] == 'needs-to-register' ) { |
|
212 | + } else if (isset($_POST['give-purchase-var']) && $_POST['give-purchase-var'] == 'needs-to-register') { |
|
213 | 213 | // Set new user registration as required |
214 | 214 | $valid_data['need_new_user'] = true; |
215 | 215 | // Validate new user data |
216 | 216 | $valid_data['new_user_data'] = give_purchase_form_validate_new_user(); |
217 | 217 | // Check if login validation is needed |
218 | - } else if ( isset( $_POST['give-purchase-var'] ) && $_POST['give-purchase-var'] == 'needs-to-login' ) { |
|
218 | + } else if (isset($_POST['give-purchase-var']) && $_POST['give-purchase-var'] == 'needs-to-login') { |
|
219 | 219 | // Set user login as required |
220 | 220 | $valid_data['need_user_login'] = true; |
221 | 221 | // Validate users login info |
@@ -240,37 +240,37 @@ discard block |
||
240 | 240 | */ |
241 | 241 | function give_purchase_form_validate_gateway() { |
242 | 242 | |
243 | - $form_id = isset( $_REQUEST['give-form-id'] ) ? $_REQUEST['give-form-id'] : 0; |
|
244 | - $amount = isset( $_REQUEST['give-amount'] ) ? give_sanitize_amount( $_REQUEST['give-amount'] ) : 0; |
|
245 | - $gateway = give_get_default_gateway( $form_id ); |
|
243 | + $form_id = isset($_REQUEST['give-form-id']) ? $_REQUEST['give-form-id'] : 0; |
|
244 | + $amount = isset($_REQUEST['give-amount']) ? give_sanitize_amount($_REQUEST['give-amount']) : 0; |
|
245 | + $gateway = give_get_default_gateway($form_id); |
|
246 | 246 | |
247 | 247 | // Check if a gateway value is present |
248 | - if ( ! empty( $_REQUEST['give-gateway'] ) ) { |
|
248 | + if ( ! empty($_REQUEST['give-gateway'])) { |
|
249 | 249 | |
250 | - $gateway = sanitize_text_field( $_REQUEST['give-gateway'] ); |
|
250 | + $gateway = sanitize_text_field($_REQUEST['give-gateway']); |
|
251 | 251 | |
252 | 252 | //Is amount being donated in LIVE mode 0.00? If so, error: |
253 | - if ( $amount == 0 && ! give_is_test_mode() ) { |
|
253 | + if ($amount == 0 && ! give_is_test_mode()) { |
|
254 | 254 | |
255 | - give_set_error( 'invalid_donation_amount', __( 'Please insert a valid donation amount.', 'give' ) ); |
|
255 | + give_set_error('invalid_donation_amount', __('Please insert a valid donation amount.', 'give')); |
|
256 | 256 | |
257 | 257 | } //Check for a minimum custom amount |
258 | - elseif ( ! give_verify_minimum_price() ) { |
|
258 | + elseif ( ! give_verify_minimum_price()) { |
|
259 | 259 | |
260 | - $minimum = give_currency_filter( give_format_amount( give_get_form_minimum_price( $form_id ) ) ); |
|
261 | - $error_message = __( 'This form has a minimum donation amount of %s', 'give' ); |
|
260 | + $minimum = give_currency_filter(give_format_amount(give_get_form_minimum_price($form_id))); |
|
261 | + $error_message = __('This form has a minimum donation amount of %s', 'give'); |
|
262 | 262 | |
263 | - give_set_error( 'invalid_donation_minimum', sprintf( $error_message, $minimum ) ); |
|
263 | + give_set_error('invalid_donation_minimum', sprintf($error_message, $minimum)); |
|
264 | 264 | |
265 | 265 | } //Is this test mode zero donation? Let it through but set to manual gateway |
266 | - elseif ( $amount == 0 && give_is_test_mode() ) { |
|
266 | + elseif ($amount == 0 && give_is_test_mode()) { |
|
267 | 267 | |
268 | 268 | $gateway = 'manual'; |
269 | 269 | |
270 | 270 | } //Check if this gateway is active |
271 | - elseif ( ! give_is_gateway_active( $gateway ) ) { |
|
271 | + elseif ( ! give_is_gateway_active($gateway)) { |
|
272 | 272 | |
273 | - give_set_error( 'invalid_gateway', __( 'The selected payment gateway is not enabled', 'give' ) ); |
|
273 | + give_set_error('invalid_gateway', __('The selected payment gateway is not enabled', 'give')); |
|
274 | 274 | |
275 | 275 | } |
276 | 276 | |
@@ -289,23 +289,23 @@ discard block |
||
289 | 289 | */ |
290 | 290 | function give_verify_minimum_price() { |
291 | 291 | |
292 | - $amount = give_sanitize_amount( $_REQUEST['give-amount'] ); |
|
293 | - $form_id = isset( $_REQUEST['give-form-id'] ) ? $_REQUEST['give-form-id'] : 0; |
|
294 | - $price_id = isset( $_REQUEST['give-price-id'] ) ? $_REQUEST['give-price-id'] : 0; |
|
295 | - $variable_prices = give_has_variable_prices( $form_id ); |
|
292 | + $amount = give_sanitize_amount($_REQUEST['give-amount']); |
|
293 | + $form_id = isset($_REQUEST['give-form-id']) ? $_REQUEST['give-form-id'] : 0; |
|
294 | + $price_id = isset($_REQUEST['give-price-id']) ? $_REQUEST['give-price-id'] : 0; |
|
295 | + $variable_prices = give_has_variable_prices($form_id); |
|
296 | 296 | |
297 | - if ( $variable_prices && ! empty( $price_id ) ) { |
|
297 | + if ($variable_prices && ! empty($price_id)) { |
|
298 | 298 | |
299 | - $price_level_amount = give_get_price_option_amount( $form_id, $price_id ); |
|
299 | + $price_level_amount = give_get_price_option_amount($form_id, $price_id); |
|
300 | 300 | |
301 | - if ( $price_level_amount == $amount ) { |
|
301 | + if ($price_level_amount == $amount) { |
|
302 | 302 | return true; |
303 | 303 | } |
304 | 304 | } |
305 | 305 | |
306 | - $minimum = give_get_form_minimum_price( $form_id ); |
|
306 | + $minimum = give_get_form_minimum_price($form_id); |
|
307 | 307 | |
308 | - if ( $minimum > $amount ) { |
|
308 | + if ($minimum > $amount) { |
|
309 | 309 | return false; |
310 | 310 | } |
311 | 311 | |
@@ -321,9 +321,9 @@ discard block |
||
321 | 321 | */ |
322 | 322 | function give_purchase_form_validate_agree_to_terms() { |
323 | 323 | // Validate agree to terms |
324 | - if ( ! isset( $_POST['give_agree_to_terms'] ) || $_POST['give_agree_to_terms'] != 1 ) { |
|
324 | + if ( ! isset($_POST['give_agree_to_terms']) || $_POST['give_agree_to_terms'] != 1) { |
|
325 | 325 | // User did not agree |
326 | - give_set_error( 'agree_to_terms', apply_filters( 'give_agree_to_terms_text', __( 'You must agree to the terms of use', 'give' ) ) ); |
|
326 | + give_set_error('agree_to_terms', apply_filters('give_agree_to_terms_text', __('You must agree to the terms of use', 'give'))); |
|
327 | 327 | } |
328 | 328 | } |
329 | 329 | |
@@ -337,47 +337,47 @@ discard block |
||
337 | 337 | * |
338 | 338 | * @return array |
339 | 339 | */ |
340 | -function give_purchase_form_required_fields( $form_id ) { |
|
340 | +function give_purchase_form_required_fields($form_id) { |
|
341 | 341 | |
342 | - $payment_mode = give_get_chosen_gateway( $form_id ); |
|
342 | + $payment_mode = give_get_chosen_gateway($form_id); |
|
343 | 343 | |
344 | 344 | $required_fields = array( |
345 | 345 | 'give_email' => array( |
346 | 346 | 'error_id' => 'invalid_email', |
347 | - 'error_message' => __( 'Please enter a valid email address', 'give' ) |
|
347 | + 'error_message' => __('Please enter a valid email address', 'give') |
|
348 | 348 | ), |
349 | 349 | 'give_first' => array( |
350 | 350 | 'error_id' => 'invalid_first_name', |
351 | - 'error_message' => __( 'Please enter your first name', 'give' ) |
|
351 | + 'error_message' => __('Please enter your first name', 'give') |
|
352 | 352 | ) |
353 | 353 | ); |
354 | 354 | |
355 | - $require_address = give_require_billing_address( $payment_mode ); |
|
355 | + $require_address = give_require_billing_address($payment_mode); |
|
356 | 356 | |
357 | - if ( $require_address ) { |
|
358 | - $required_fields['card_address'] = array( |
|
357 | + if ($require_address) { |
|
358 | + $required_fields['card_address'] = array( |
|
359 | 359 | 'error_id' => 'invalid_card_address', |
360 | - 'error_message' => __( 'Please enter your primary billing address', 'give' ) |
|
360 | + 'error_message' => __('Please enter your primary billing address', 'give') |
|
361 | 361 | ); |
362 | - $required_fields['card_zip'] = array( |
|
362 | + $required_fields['card_zip'] = array( |
|
363 | 363 | 'error_id' => 'invalid_zip_code', |
364 | - 'error_message' => __( 'Please enter your zip / postal code', 'give' ) |
|
364 | + 'error_message' => __('Please enter your zip / postal code', 'give') |
|
365 | 365 | ); |
366 | - $required_fields['card_city'] = array( |
|
366 | + $required_fields['card_city'] = array( |
|
367 | 367 | 'error_id' => 'invalid_city', |
368 | - 'error_message' => __( 'Please enter your billing city', 'give' ) |
|
368 | + 'error_message' => __('Please enter your billing city', 'give') |
|
369 | 369 | ); |
370 | 370 | $required_fields['billing_country'] = array( |
371 | 371 | 'error_id' => 'invalid_country', |
372 | - 'error_message' => __( 'Please select your billing country', 'give' ) |
|
372 | + 'error_message' => __('Please select your billing country', 'give') |
|
373 | 373 | ); |
374 | - $required_fields['card_state'] = array( |
|
374 | + $required_fields['card_state'] = array( |
|
375 | 375 | 'error_id' => 'invalid_state', |
376 | - 'error_message' => __( 'Please enter billing state / province', 'give' ) |
|
376 | + 'error_message' => __('Please enter billing state / province', 'give') |
|
377 | 377 | ); |
378 | 378 | } |
379 | 379 | |
380 | - return apply_filters( 'give_purchase_form_required_fields', $required_fields, $form_id ); |
|
380 | + return apply_filters('give_purchase_form_required_fields', $required_fields, $form_id); |
|
381 | 381 | |
382 | 382 | } |
383 | 383 | |
@@ -390,16 +390,16 @@ discard block |
||
390 | 390 | * |
391 | 391 | * @return mixed|void |
392 | 392 | */ |
393 | -function give_require_billing_address( $payment_mode ) { |
|
393 | +function give_require_billing_address($payment_mode) { |
|
394 | 394 | |
395 | 395 | $return = false; |
396 | 396 | |
397 | - if ( isset( $_POST['billing_country'] ) || did_action( "give_{$payment_mode}_cc_form" ) || did_action( 'give_cc_form' ) ) { |
|
397 | + if (isset($_POST['billing_country']) || did_action("give_{$payment_mode}_cc_form") || did_action('give_cc_form')) { |
|
398 | 398 | $return = true; |
399 | 399 | } |
400 | 400 | |
401 | 401 | // Let payment gateways and other extensions determine if address fields should be required |
402 | - return apply_filters( 'give_require_billing_address', $return ); |
|
402 | + return apply_filters('give_require_billing_address', $return); |
|
403 | 403 | |
404 | 404 | } |
405 | 405 | |
@@ -413,43 +413,43 @@ discard block |
||
413 | 413 | function give_purchase_form_validate_logged_in_user() { |
414 | 414 | global $user_ID; |
415 | 415 | |
416 | - $form_id = isset( $_POST['give-form-id'] ) ? $_POST['give-form-id'] : ''; |
|
416 | + $form_id = isset($_POST['give-form-id']) ? $_POST['give-form-id'] : ''; |
|
417 | 417 | |
418 | 418 | // Start empty array to collect valid user data |
419 | 419 | $valid_user_data = array( |
420 | 420 | // Assume there will be errors |
421 | - 'user_id' => - 1 |
|
421 | + 'user_id' => -1 |
|
422 | 422 | ); |
423 | 423 | |
424 | 424 | // Verify there is a user_ID |
425 | - if ( $user_ID > 0 ) { |
|
425 | + if ($user_ID > 0) { |
|
426 | 426 | // Get the logged in user data |
427 | - $user_data = get_userdata( $user_ID ); |
|
427 | + $user_data = get_userdata($user_ID); |
|
428 | 428 | |
429 | 429 | // Loop through required fields and show error messages |
430 | - foreach ( give_purchase_form_required_fields( $form_id ) as $field_name => $value ) { |
|
431 | - if ( in_array( $value, give_purchase_form_required_fields( $form_id ) ) && empty( $_POST[ $field_name ] ) ) { |
|
432 | - give_set_error( $value['error_id'], $value['error_message'] ); |
|
430 | + foreach (give_purchase_form_required_fields($form_id) as $field_name => $value) { |
|
431 | + if (in_array($value, give_purchase_form_required_fields($form_id)) && empty($_POST[$field_name])) { |
|
432 | + give_set_error($value['error_id'], $value['error_message']); |
|
433 | 433 | } |
434 | 434 | } |
435 | 435 | |
436 | 436 | // Verify data |
437 | - if ( $user_data ) { |
|
437 | + if ($user_data) { |
|
438 | 438 | // Collected logged in user data |
439 | 439 | $valid_user_data = array( |
440 | 440 | 'user_id' => $user_ID, |
441 | - 'user_email' => isset( $_POST['give_email'] ) ? sanitize_email( $_POST['give_email'] ) : $user_data->user_email, |
|
442 | - 'user_first' => isset( $_POST['give_first'] ) && ! empty( $_POST['give_first'] ) ? sanitize_text_field( $_POST['give_first'] ) : $user_data->first_name, |
|
443 | - 'user_last' => isset( $_POST['give_last'] ) && ! empty( $_POST['give_last'] ) ? sanitize_text_field( $_POST['give_last'] ) : $user_data->last_name, |
|
441 | + 'user_email' => isset($_POST['give_email']) ? sanitize_email($_POST['give_email']) : $user_data->user_email, |
|
442 | + 'user_first' => isset($_POST['give_first']) && ! empty($_POST['give_first']) ? sanitize_text_field($_POST['give_first']) : $user_data->first_name, |
|
443 | + 'user_last' => isset($_POST['give_last']) && ! empty($_POST['give_last']) ? sanitize_text_field($_POST['give_last']) : $user_data->last_name, |
|
444 | 444 | ); |
445 | 445 | |
446 | - if ( ! is_email( $valid_user_data['user_email'] ) ) { |
|
447 | - give_set_error( 'email_invalid', __( 'Invalid email', 'give' ) ); |
|
446 | + if ( ! is_email($valid_user_data['user_email'])) { |
|
447 | + give_set_error('email_invalid', __('Invalid email', 'give')); |
|
448 | 448 | } |
449 | 449 | |
450 | 450 | } else { |
451 | 451 | // Set invalid user error |
452 | - give_set_error( 'invalid_user', __( 'The user information is invalid', 'give' ) ); |
|
452 | + give_set_error('invalid_user', __('The user information is invalid', 'give')); |
|
453 | 453 | } |
454 | 454 | } |
455 | 455 | |
@@ -467,90 +467,90 @@ discard block |
||
467 | 467 | function give_purchase_form_validate_new_user() { |
468 | 468 | |
469 | 469 | $registering_new_user = false; |
470 | - $form_id = isset( $_POST['give-form-id'] ) ? $_POST['give-form-id'] : ''; |
|
470 | + $form_id = isset($_POST['give-form-id']) ? $_POST['give-form-id'] : ''; |
|
471 | 471 | |
472 | 472 | // Start an empty array to collect valid user data |
473 | 473 | $valid_user_data = array( |
474 | 474 | // Assume there will be errors |
475 | - 'user_id' => - 1, |
|
475 | + 'user_id' => -1, |
|
476 | 476 | // Get first name |
477 | - 'user_first' => isset( $_POST['give_first'] ) ? sanitize_text_field( $_POST['give_first'] ) : '', |
|
477 | + 'user_first' => isset($_POST['give_first']) ? sanitize_text_field($_POST['give_first']) : '', |
|
478 | 478 | // Get last name |
479 | - 'user_last' => isset( $_POST['give_last'] ) ? sanitize_text_field( $_POST['give_last'] ) : '', |
|
479 | + 'user_last' => isset($_POST['give_last']) ? sanitize_text_field($_POST['give_last']) : '', |
|
480 | 480 | ); |
481 | 481 | |
482 | 482 | // Check the new user's credentials against existing ones |
483 | - $user_login = isset( $_POST['give_user_login'] ) ? trim( $_POST['give_user_login'] ) : false; |
|
484 | - $user_email = isset( $_POST['give_email'] ) ? trim( $_POST['give_email'] ) : false; |
|
485 | - $user_pass = isset( $_POST['give_user_pass'] ) ? trim( $_POST['give_user_pass'] ) : false; |
|
486 | - $pass_confirm = isset( $_POST['give_user_pass_confirm'] ) ? trim( $_POST['give_user_pass_confirm'] ) : false; |
|
483 | + $user_login = isset($_POST['give_user_login']) ? trim($_POST['give_user_login']) : false; |
|
484 | + $user_email = isset($_POST['give_email']) ? trim($_POST['give_email']) : false; |
|
485 | + $user_pass = isset($_POST['give_user_pass']) ? trim($_POST['give_user_pass']) : false; |
|
486 | + $pass_confirm = isset($_POST['give_user_pass_confirm']) ? trim($_POST['give_user_pass_confirm']) : false; |
|
487 | 487 | |
488 | 488 | // Loop through required fields and show error messages |
489 | - foreach ( give_purchase_form_required_fields( $form_id ) as $field_name => $value ) { |
|
490 | - if ( in_array( $value, give_purchase_form_required_fields( $form_id ) ) && empty( $_POST[ $field_name ] ) ) { |
|
491 | - give_set_error( $value['error_id'], $value['error_message'] ); |
|
489 | + foreach (give_purchase_form_required_fields($form_id) as $field_name => $value) { |
|
490 | + if (in_array($value, give_purchase_form_required_fields($form_id)) && empty($_POST[$field_name])) { |
|
491 | + give_set_error($value['error_id'], $value['error_message']); |
|
492 | 492 | } |
493 | 493 | } |
494 | 494 | |
495 | 495 | // Check if we have an username to register |
496 | - if ( $user_login && strlen( $user_login ) > 0 ) { |
|
496 | + if ($user_login && strlen($user_login) > 0) { |
|
497 | 497 | $registering_new_user = true; |
498 | 498 | |
499 | 499 | // We have an user name, check if it already exists |
500 | - if ( username_exists( $user_login ) ) { |
|
500 | + if (username_exists($user_login)) { |
|
501 | 501 | // Username already registered |
502 | - give_set_error( 'username_unavailable', __( 'Username already taken', 'give' ) ); |
|
502 | + give_set_error('username_unavailable', __('Username already taken', 'give')); |
|
503 | 503 | // Check if it's valid |
504 | - } else if ( ! give_validate_username( $user_login ) ) { |
|
504 | + } else if ( ! give_validate_username($user_login)) { |
|
505 | 505 | // Invalid username |
506 | - if ( is_multisite() ) { |
|
507 | - give_set_error( 'username_invalid', __( 'Invalid username. Only lowercase letters (a-z) and numbers are allowed', 'give' ) ); |
|
506 | + if (is_multisite()) { |
|
507 | + give_set_error('username_invalid', __('Invalid username. Only lowercase letters (a-z) and numbers are allowed', 'give')); |
|
508 | 508 | } else { |
509 | - give_set_error( 'username_invalid', __( 'Invalid username', 'give' ) ); |
|
509 | + give_set_error('username_invalid', __('Invalid username', 'give')); |
|
510 | 510 | } |
511 | 511 | } else { |
512 | 512 | // All the checks have run and it's good to go |
513 | 513 | $valid_user_data['user_login'] = $user_login; |
514 | 514 | } |
515 | - } elseif ( give_logged_in_only( $form_id ) ) { |
|
516 | - give_set_error( 'registration_required', esc_html__( 'You must register or login to complete your donation', 'give' ) ); |
|
515 | + } elseif (give_logged_in_only($form_id)) { |
|
516 | + give_set_error('registration_required', esc_html__('You must register or login to complete your donation', 'give')); |
|
517 | 517 | } |
518 | 518 | |
519 | 519 | // Check if we have an email to verify |
520 | - if ( $user_email && strlen( $user_email ) > 0 ) { |
|
520 | + if ($user_email && strlen($user_email) > 0) { |
|
521 | 521 | // Validate email |
522 | - if ( ! is_email( $user_email ) ) { |
|
523 | - give_set_error( 'email_invalid', __( 'Sorry, that email is invalid', 'give' ) ); |
|
522 | + if ( ! is_email($user_email)) { |
|
523 | + give_set_error('email_invalid', __('Sorry, that email is invalid', 'give')); |
|
524 | 524 | // Check if email exists |
525 | - } else if ( email_exists( $user_email ) && $registering_new_user ) { |
|
526 | - give_set_error( 'email_used', __( 'Sorry, that email already active for another user', 'give' ) ); |
|
525 | + } else if (email_exists($user_email) && $registering_new_user) { |
|
526 | + give_set_error('email_used', __('Sorry, that email already active for another user', 'give')); |
|
527 | 527 | } else { |
528 | 528 | // All the checks have run and it's good to go |
529 | 529 | $valid_user_data['user_email'] = $user_email; |
530 | 530 | } |
531 | 531 | } else { |
532 | 532 | // No email |
533 | - give_set_error( 'email_empty', __( 'Enter an email', 'give' ) ); |
|
533 | + give_set_error('email_empty', __('Enter an email', 'give')); |
|
534 | 534 | } |
535 | 535 | |
536 | 536 | // Check password |
537 | - if ( $user_pass && $pass_confirm ) { |
|
537 | + if ($user_pass && $pass_confirm) { |
|
538 | 538 | // Verify confirmation matches |
539 | - if ( $user_pass != $pass_confirm ) { |
|
539 | + if ($user_pass != $pass_confirm) { |
|
540 | 540 | // Passwords do not match |
541 | - give_set_error( 'password_mismatch', __( 'Passwords don\'t match', 'give' ) ); |
|
541 | + give_set_error('password_mismatch', __('Passwords don\'t match', 'give')); |
|
542 | 542 | } else { |
543 | 543 | // All is good to go |
544 | 544 | $valid_user_data['user_pass'] = $user_pass; |
545 | 545 | } |
546 | 546 | } else { |
547 | 547 | // Password or confirmation missing |
548 | - if ( ! $user_pass && $registering_new_user ) { |
|
548 | + if ( ! $user_pass && $registering_new_user) { |
|
549 | 549 | // The password is invalid |
550 | - give_set_error( 'password_empty', __( 'Enter a password', 'give' ) ); |
|
551 | - } else if ( ! $pass_confirm && $registering_new_user ) { |
|
550 | + give_set_error('password_empty', __('Enter a password', 'give')); |
|
551 | + } else if ( ! $pass_confirm && $registering_new_user) { |
|
552 | 552 | // Confirmation password is invalid |
553 | - give_set_error( 'confirmation_empty', __( 'Enter the password confirmation', 'give' ) ); |
|
553 | + give_set_error('confirmation_empty', __('Enter the password confirmation', 'give')); |
|
554 | 554 | } |
555 | 555 | } |
556 | 556 | |
@@ -569,34 +569,34 @@ discard block |
||
569 | 569 | // Start an array to collect valid user data |
570 | 570 | $valid_user_data = array( |
571 | 571 | // Assume there will be errors |
572 | - 'user_id' => - 1 |
|
572 | + 'user_id' => -1 |
|
573 | 573 | ); |
574 | 574 | |
575 | 575 | // Username |
576 | - if ( ! isset( $_POST['give_user_login'] ) || $_POST['give_user_login'] == '' ) { |
|
577 | - give_set_error( 'must_log_in', __( 'You must login or register to complete your donation', 'give' ) ); |
|
576 | + if ( ! isset($_POST['give_user_login']) || $_POST['give_user_login'] == '') { |
|
577 | + give_set_error('must_log_in', __('You must login or register to complete your donation', 'give')); |
|
578 | 578 | |
579 | 579 | return $valid_user_data; |
580 | 580 | } |
581 | 581 | |
582 | 582 | // Get the user by login |
583 | - $user_data = get_user_by( 'login', strip_tags( $_POST['give_user_login'] ) ); |
|
583 | + $user_data = get_user_by('login', strip_tags($_POST['give_user_login'])); |
|
584 | 584 | |
585 | 585 | // Check if user exists |
586 | - if ( $user_data ) { |
|
586 | + if ($user_data) { |
|
587 | 587 | // Get password |
588 | - $user_pass = isset( $_POST['give_user_pass'] ) ? $_POST['give_user_pass'] : false; |
|
588 | + $user_pass = isset($_POST['give_user_pass']) ? $_POST['give_user_pass'] : false; |
|
589 | 589 | |
590 | 590 | // Check user_pass |
591 | - if ( $user_pass ) { |
|
591 | + if ($user_pass) { |
|
592 | 592 | // Check if password is valid |
593 | - if ( ! wp_check_password( $user_pass, $user_data->user_pass, $user_data->ID ) ) { |
|
593 | + if ( ! wp_check_password($user_pass, $user_data->user_pass, $user_data->ID)) { |
|
594 | 594 | // Incorrect password |
595 | 595 | give_set_error( |
596 | 596 | 'password_incorrect', |
597 | 597 | sprintf( |
598 | - __( 'The password you entered is incorrect. %sReset Password%s', 'give' ), |
|
599 | - '<a href="' . wp_lostpassword_url( "http://$_SERVER[HTTP_HOST]$_SERVER[REQUEST_URI]" ) . '" title="' . __( 'Lost Password', 'give' ) . '">', |
|
598 | + __('The password you entered is incorrect. %sReset Password%s', 'give'), |
|
599 | + '<a href="'.wp_lostpassword_url("http://$_SERVER[HTTP_HOST]$_SERVER[REQUEST_URI]").'" title="'.__('Lost Password', 'give').'">', |
|
600 | 600 | '</a>' |
601 | 601 | ) |
602 | 602 | ); |
@@ -614,11 +614,11 @@ discard block |
||
614 | 614 | } |
615 | 615 | } else { |
616 | 616 | // Empty password |
617 | - give_set_error( 'password_empty', __( 'Enter a password', 'give' ) ); |
|
617 | + give_set_error('password_empty', __('Enter a password', 'give')); |
|
618 | 618 | } |
619 | 619 | } else { |
620 | 620 | // no username |
621 | - give_set_error( 'username_incorrect', __( 'The username you entered does not exist', 'give' ) ); |
|
621 | + give_set_error('username_incorrect', __('The username you entered does not exist', 'give')); |
|
622 | 622 | } |
623 | 623 | |
624 | 624 | return $valid_user_data; |
@@ -633,7 +633,7 @@ discard block |
||
633 | 633 | */ |
634 | 634 | function give_purchase_form_validate_guest_user() { |
635 | 635 | |
636 | - $form_id = isset( $_POST['give-form-id'] ) ? $_POST['give-form-id'] : ''; |
|
636 | + $form_id = isset($_POST['give-form-id']) ? $_POST['give-form-id'] : ''; |
|
637 | 637 | |
638 | 638 | // Start an array to collect valid user data |
639 | 639 | $valid_user_data = array( |
@@ -642,32 +642,32 @@ discard block |
||
642 | 642 | ); |
643 | 643 | |
644 | 644 | // Show error message if user must be logged in |
645 | - if ( give_logged_in_only( $form_id ) ) { |
|
646 | - give_set_error( 'logged_in_only', __( 'You must be logged into to donate', 'give' ) ); |
|
645 | + if (give_logged_in_only($form_id)) { |
|
646 | + give_set_error('logged_in_only', __('You must be logged into to donate', 'give')); |
|
647 | 647 | } |
648 | 648 | |
649 | 649 | // Get the guest email |
650 | - $guest_email = isset( $_POST['give_email'] ) ? $_POST['give_email'] : false; |
|
650 | + $guest_email = isset($_POST['give_email']) ? $_POST['give_email'] : false; |
|
651 | 651 | |
652 | 652 | // Check email |
653 | - if ( $guest_email && strlen( $guest_email ) > 0 ) { |
|
653 | + if ($guest_email && strlen($guest_email) > 0) { |
|
654 | 654 | // Validate email |
655 | - if ( ! is_email( $guest_email ) ) { |
|
655 | + if ( ! is_email($guest_email)) { |
|
656 | 656 | // Invalid email |
657 | - give_set_error( 'email_invalid', __( 'Invalid email', 'give' ) ); |
|
657 | + give_set_error('email_invalid', __('Invalid email', 'give')); |
|
658 | 658 | } else { |
659 | 659 | // All is good to go |
660 | 660 | $valid_user_data['user_email'] = $guest_email; |
661 | 661 | } |
662 | 662 | } else { |
663 | 663 | // No email |
664 | - give_set_error( 'email_empty', __( 'Enter an email', 'give' ) ); |
|
664 | + give_set_error('email_empty', __('Enter an email', 'give')); |
|
665 | 665 | } |
666 | 666 | |
667 | 667 | // Loop through required fields and show error messages |
668 | - foreach ( give_purchase_form_required_fields( $form_id ) as $field_name => $value ) { |
|
669 | - if ( in_array( $value, give_purchase_form_required_fields( $form_id ) ) && empty( $_POST[ $field_name ] ) ) { |
|
670 | - give_set_error( $value['error_id'], $value['error_message'] ); |
|
668 | + foreach (give_purchase_form_required_fields($form_id) as $field_name => $value) { |
|
669 | + if (in_array($value, give_purchase_form_required_fields($form_id)) && empty($_POST[$field_name])) { |
|
670 | + give_set_error($value['error_id'], $value['error_message']); |
|
671 | 671 | } |
672 | 672 | } |
673 | 673 | |
@@ -683,42 +683,42 @@ discard block |
||
683 | 683 | * @since 1.0 |
684 | 684 | * @return integer |
685 | 685 | */ |
686 | -function give_register_and_login_new_user( $user_data = array() ) { |
|
686 | +function give_register_and_login_new_user($user_data = array()) { |
|
687 | 687 | // Verify the array |
688 | - if ( empty( $user_data ) ) { |
|
689 | - return - 1; |
|
688 | + if (empty($user_data)) { |
|
689 | + return -1; |
|
690 | 690 | } |
691 | 691 | |
692 | - if ( give_get_errors() ) { |
|
693 | - return - 1; |
|
692 | + if (give_get_errors()) { |
|
693 | + return -1; |
|
694 | 694 | } |
695 | 695 | |
696 | - $user_args = apply_filters( 'give_insert_user_args', array( |
|
697 | - 'user_login' => isset( $user_data['user_login'] ) ? $user_data['user_login'] : '', |
|
698 | - 'user_pass' => isset( $user_data['user_pass'] ) ? $user_data['user_pass'] : '', |
|
699 | - 'user_email' => isset( $user_data['user_email'] ) ? $user_data['user_email'] : '', |
|
700 | - 'first_name' => isset( $user_data['user_first'] ) ? $user_data['user_first'] : '', |
|
701 | - 'last_name' => isset( $user_data['user_last'] ) ? $user_data['user_last'] : '', |
|
702 | - 'user_registered' => date( 'Y-m-d H:i:s' ), |
|
703 | - 'role' => get_option( 'default_role' ) |
|
704 | - ), $user_data ); |
|
696 | + $user_args = apply_filters('give_insert_user_args', array( |
|
697 | + 'user_login' => isset($user_data['user_login']) ? $user_data['user_login'] : '', |
|
698 | + 'user_pass' => isset($user_data['user_pass']) ? $user_data['user_pass'] : '', |
|
699 | + 'user_email' => isset($user_data['user_email']) ? $user_data['user_email'] : '', |
|
700 | + 'first_name' => isset($user_data['user_first']) ? $user_data['user_first'] : '', |
|
701 | + 'last_name' => isset($user_data['user_last']) ? $user_data['user_last'] : '', |
|
702 | + 'user_registered' => date('Y-m-d H:i:s'), |
|
703 | + 'role' => get_option('default_role') |
|
704 | + ), $user_data); |
|
705 | 705 | |
706 | 706 | // Insert new user |
707 | - $user_id = wp_insert_user( $user_args ); |
|
707 | + $user_id = wp_insert_user($user_args); |
|
708 | 708 | |
709 | 709 | // Validate inserted user |
710 | - if ( is_wp_error( $user_id ) ) { |
|
711 | - return - 1; |
|
710 | + if (is_wp_error($user_id)) { |
|
711 | + return -1; |
|
712 | 712 | } |
713 | 713 | |
714 | 714 | // Allow themes and plugins to filter the user data |
715 | - $user_data = apply_filters( 'give_insert_user_data', $user_data, $user_args ); |
|
715 | + $user_data = apply_filters('give_insert_user_data', $user_data, $user_args); |
|
716 | 716 | |
717 | 717 | // Allow themes and plugins to hook |
718 | - do_action( 'give_insert_user', $user_id, $user_data ); |
|
718 | + do_action('give_insert_user', $user_id, $user_data); |
|
719 | 719 | |
720 | 720 | // Login new user |
721 | - give_log_user_in( $user_id, $user_data['user_login'], $user_data['user_pass'] ); |
|
721 | + give_log_user_in($user_id, $user_data['user_login'], $user_data['user_pass']); |
|
722 | 722 | |
723 | 723 | // Return user id |
724 | 724 | return $user_id; |
@@ -733,27 +733,27 @@ discard block |
||
733 | 733 | * @since 1.0 |
734 | 734 | * @return array |
735 | 735 | */ |
736 | -function give_get_purchase_form_user( $valid_data = array() ) { |
|
736 | +function give_get_purchase_form_user($valid_data = array()) { |
|
737 | 737 | |
738 | 738 | // Initialize user |
739 | 739 | $user = false; |
740 | - $is_ajax = defined( 'DOING_AJAX' ) && DOING_AJAX; |
|
740 | + $is_ajax = defined('DOING_AJAX') && DOING_AJAX; |
|
741 | 741 | |
742 | - if ( $is_ajax ) { |
|
742 | + if ($is_ajax) { |
|
743 | 743 | // Do not create or login the user during the ajax submission (check for errors only) |
744 | 744 | return true; |
745 | - } else if ( is_user_logged_in() ) { |
|
745 | + } else if (is_user_logged_in()) { |
|
746 | 746 | // Set the valid user as the logged in collected data |
747 | 747 | $user = $valid_data['logged_in_user']; |
748 | - } else if ( $valid_data['need_new_user'] === true || $valid_data['need_user_login'] === true ) { |
|
748 | + } else if ($valid_data['need_new_user'] === true || $valid_data['need_user_login'] === true) { |
|
749 | 749 | // New user registration |
750 | - if ( $valid_data['need_new_user'] === true ) { |
|
750 | + if ($valid_data['need_new_user'] === true) { |
|
751 | 751 | // Set user |
752 | 752 | $user = $valid_data['new_user_data']; |
753 | 753 | // Register and login new user |
754 | - $user['user_id'] = give_register_and_login_new_user( $user ); |
|
754 | + $user['user_id'] = give_register_and_login_new_user($user); |
|
755 | 755 | // User login |
756 | - } else if ( $valid_data['need_user_login'] === true && ! $is_ajax ) { |
|
756 | + } else if ($valid_data['need_user_login'] === true && ! $is_ajax) { |
|
757 | 757 | |
758 | 758 | /* |
759 | 759 | * The login form is now processed in the give_process_purchase_login() function. |
@@ -768,48 +768,48 @@ discard block |
||
768 | 768 | // Set user |
769 | 769 | $user = $valid_data['login_user_data']; |
770 | 770 | // Login user |
771 | - give_log_user_in( $user['user_id'], $user['user_login'], $user['user_pass'] ); |
|
771 | + give_log_user_in($user['user_id'], $user['user_login'], $user['user_pass']); |
|
772 | 772 | } |
773 | 773 | } |
774 | 774 | |
775 | 775 | // Check guest checkout |
776 | - if ( false === $user && false === give_logged_in_only( $_POST['give-form-id'] ) ) { |
|
776 | + if (false === $user && false === give_logged_in_only($_POST['give-form-id'])) { |
|
777 | 777 | // Set user |
778 | 778 | $user = $valid_data['guest_user_data']; |
779 | 779 | } |
780 | 780 | |
781 | 781 | // Verify we have an user |
782 | - if ( false === $user || empty( $user ) ) { |
|
782 | + if (false === $user || empty($user)) { |
|
783 | 783 | // Return false |
784 | 784 | return false; |
785 | 785 | } |
786 | 786 | |
787 | 787 | // Get user first name |
788 | - if ( ! isset( $user['user_first'] ) || strlen( trim( $user['user_first'] ) ) < 1 ) { |
|
789 | - $user['user_first'] = isset( $_POST['give_first'] ) ? strip_tags( trim( $_POST['give_first'] ) ) : ''; |
|
788 | + if ( ! isset($user['user_first']) || strlen(trim($user['user_first'])) < 1) { |
|
789 | + $user['user_first'] = isset($_POST['give_first']) ? strip_tags(trim($_POST['give_first'])) : ''; |
|
790 | 790 | } |
791 | 791 | |
792 | 792 | // Get user last name |
793 | - if ( ! isset( $user['user_last'] ) || strlen( trim( $user['user_last'] ) ) < 1 ) { |
|
794 | - $user['user_last'] = isset( $_POST['give_last'] ) ? strip_tags( trim( $_POST['give_last'] ) ) : ''; |
|
793 | + if ( ! isset($user['user_last']) || strlen(trim($user['user_last'])) < 1) { |
|
794 | + $user['user_last'] = isset($_POST['give_last']) ? strip_tags(trim($_POST['give_last'])) : ''; |
|
795 | 795 | } |
796 | 796 | |
797 | 797 | // Get the user's billing address details |
798 | 798 | $user['address'] = array(); |
799 | - $user['address']['line1'] = ! empty( $_POST['card_address'] ) ? sanitize_text_field( $_POST['card_address'] ) : false; |
|
800 | - $user['address']['line2'] = ! empty( $_POST['card_address_2'] ) ? sanitize_text_field( $_POST['card_address_2'] ) : false; |
|
801 | - $user['address']['city'] = ! empty( $_POST['card_city'] ) ? sanitize_text_field( $_POST['card_city'] ) : false; |
|
802 | - $user['address']['state'] = ! empty( $_POST['card_state'] ) ? sanitize_text_field( $_POST['card_state'] ) : false; |
|
803 | - $user['address']['country'] = ! empty( $_POST['billing_country'] ) ? sanitize_text_field( $_POST['billing_country'] ) : false; |
|
804 | - $user['address']['zip'] = ! empty( $_POST['card_zip'] ) ? sanitize_text_field( $_POST['card_zip'] ) : false; |
|
805 | - |
|
806 | - if ( empty( $user['address']['country'] ) ) { |
|
799 | + $user['address']['line1'] = ! empty($_POST['card_address']) ? sanitize_text_field($_POST['card_address']) : false; |
|
800 | + $user['address']['line2'] = ! empty($_POST['card_address_2']) ? sanitize_text_field($_POST['card_address_2']) : false; |
|
801 | + $user['address']['city'] = ! empty($_POST['card_city']) ? sanitize_text_field($_POST['card_city']) : false; |
|
802 | + $user['address']['state'] = ! empty($_POST['card_state']) ? sanitize_text_field($_POST['card_state']) : false; |
|
803 | + $user['address']['country'] = ! empty($_POST['billing_country']) ? sanitize_text_field($_POST['billing_country']) : false; |
|
804 | + $user['address']['zip'] = ! empty($_POST['card_zip']) ? sanitize_text_field($_POST['card_zip']) : false; |
|
805 | + |
|
806 | + if (empty($user['address']['country'])) { |
|
807 | 807 | $user['address'] = false; |
808 | 808 | } // Country will always be set if address fields are present |
809 | 809 | |
810 | - if ( ! empty( $user['user_id'] ) && $user['user_id'] > 0 && ! empty( $user['address'] ) ) { |
|
810 | + if ( ! empty($user['user_id']) && $user['user_id'] > 0 && ! empty($user['address'])) { |
|
811 | 811 | // Store the address in the user's meta so the donation form can be pre-populated with it on return purchases |
812 | - update_user_meta( $user['user_id'], '_give_user_address', $user['address'] ); |
|
812 | + update_user_meta($user['user_id'], '_give_user_address', $user['address']); |
|
813 | 813 | } |
814 | 814 | |
815 | 815 | // Return valid user |
@@ -828,16 +828,16 @@ discard block |
||
828 | 828 | $card_data = give_get_purchase_cc_info(); |
829 | 829 | |
830 | 830 | // Validate the card zip |
831 | - if ( ! empty( $card_data['card_zip'] ) ) { |
|
832 | - if ( ! give_purchase_form_validate_cc_zip( $card_data['card_zip'], $card_data['card_country'] ) ) { |
|
833 | - give_set_error( 'invalid_cc_zip', __( 'The zip / postal code you entered for your billing address is invalid', 'give' ) ); |
|
831 | + if ( ! empty($card_data['card_zip'])) { |
|
832 | + if ( ! give_purchase_form_validate_cc_zip($card_data['card_zip'], $card_data['card_country'])) { |
|
833 | + give_set_error('invalid_cc_zip', __('The zip / postal code you entered for your billing address is invalid', 'give')); |
|
834 | 834 | } |
835 | 835 | } |
836 | 836 | |
837 | 837 | //Ensure no spaces |
838 | - if ( ! empty( $card_data['card_number'] ) ) { |
|
839 | - $card_data['card_number'] = str_replace( '+', '', $card_data['card_number'] ); //no "+" signs |
|
840 | - $card_data['card_number'] = str_replace( ' ', '', $card_data['card_number'] ); // No spaces |
|
838 | + if ( ! empty($card_data['card_number'])) { |
|
839 | + $card_data['card_number'] = str_replace('+', '', $card_data['card_number']); //no "+" signs |
|
840 | + $card_data['card_number'] = str_replace(' ', '', $card_data['card_number']); // No spaces |
|
841 | 841 | } |
842 | 842 | |
843 | 843 | // This should validate card numbers at some point too |
@@ -853,17 +853,17 @@ discard block |
||
853 | 853 | */ |
854 | 854 | function give_get_purchase_cc_info() { |
855 | 855 | $cc_info = array(); |
856 | - $cc_info['card_name'] = isset( $_POST['card_name'] ) ? sanitize_text_field( $_POST['card_name'] ) : ''; |
|
857 | - $cc_info['card_number'] = isset( $_POST['card_number'] ) ? sanitize_text_field( $_POST['card_number'] ) : ''; |
|
858 | - $cc_info['card_cvc'] = isset( $_POST['card_cvc'] ) ? sanitize_text_field( $_POST['card_cvc'] ) : ''; |
|
859 | - $cc_info['card_exp_month'] = isset( $_POST['card_exp_month'] ) ? sanitize_text_field( $_POST['card_exp_month'] ) : ''; |
|
860 | - $cc_info['card_exp_year'] = isset( $_POST['card_exp_year'] ) ? sanitize_text_field( $_POST['card_exp_year'] ) : ''; |
|
861 | - $cc_info['card_address'] = isset( $_POST['card_address'] ) ? sanitize_text_field( $_POST['card_address'] ) : ''; |
|
862 | - $cc_info['card_address_2'] = isset( $_POST['card_address_2'] ) ? sanitize_text_field( $_POST['card_address_2'] ) : ''; |
|
863 | - $cc_info['card_city'] = isset( $_POST['card_city'] ) ? sanitize_text_field( $_POST['card_city'] ) : ''; |
|
864 | - $cc_info['card_state'] = isset( $_POST['card_state'] ) ? sanitize_text_field( $_POST['card_state'] ) : ''; |
|
865 | - $cc_info['card_country'] = isset( $_POST['billing_country'] ) ? sanitize_text_field( $_POST['billing_country'] ) : ''; |
|
866 | - $cc_info['card_zip'] = isset( $_POST['card_zip'] ) ? sanitize_text_field( $_POST['card_zip'] ) : ''; |
|
856 | + $cc_info['card_name'] = isset($_POST['card_name']) ? sanitize_text_field($_POST['card_name']) : ''; |
|
857 | + $cc_info['card_number'] = isset($_POST['card_number']) ? sanitize_text_field($_POST['card_number']) : ''; |
|
858 | + $cc_info['card_cvc'] = isset($_POST['card_cvc']) ? sanitize_text_field($_POST['card_cvc']) : ''; |
|
859 | + $cc_info['card_exp_month'] = isset($_POST['card_exp_month']) ? sanitize_text_field($_POST['card_exp_month']) : ''; |
|
860 | + $cc_info['card_exp_year'] = isset($_POST['card_exp_year']) ? sanitize_text_field($_POST['card_exp_year']) : ''; |
|
861 | + $cc_info['card_address'] = isset($_POST['card_address']) ? sanitize_text_field($_POST['card_address']) : ''; |
|
862 | + $cc_info['card_address_2'] = isset($_POST['card_address_2']) ? sanitize_text_field($_POST['card_address_2']) : ''; |
|
863 | + $cc_info['card_city'] = isset($_POST['card_city']) ? sanitize_text_field($_POST['card_city']) : ''; |
|
864 | + $cc_info['card_state'] = isset($_POST['card_state']) ? sanitize_text_field($_POST['card_state']) : ''; |
|
865 | + $cc_info['card_country'] = isset($_POST['billing_country']) ? sanitize_text_field($_POST['billing_country']) : ''; |
|
866 | + $cc_info['card_zip'] = isset($_POST['card_zip']) ? sanitize_text_field($_POST['card_zip']) : ''; |
|
867 | 867 | |
868 | 868 | // Return cc info |
869 | 869 | return $cc_info; |
@@ -879,14 +879,14 @@ discard block |
||
879 | 879 | * |
880 | 880 | * @return bool|mixed|void |
881 | 881 | */ |
882 | -function give_purchase_form_validate_cc_zip( $zip = 0, $country_code = '' ) { |
|
882 | +function give_purchase_form_validate_cc_zip($zip = 0, $country_code = '') { |
|
883 | 883 | $ret = false; |
884 | 884 | |
885 | - if ( empty( $zip ) || empty( $country_code ) ) { |
|
885 | + if (empty($zip) || empty($country_code)) { |
|
886 | 886 | return $ret; |
887 | 887 | } |
888 | 888 | |
889 | - $country_code = strtoupper( $country_code ); |
|
889 | + $country_code = strtoupper($country_code); |
|
890 | 890 | |
891 | 891 | $zip_regex = array( |
892 | 892 | "AD" => "AD\d{3}", |
@@ -1046,9 +1046,9 @@ discard block |
||
1046 | 1046 | "ZM" => "\d{5}" |
1047 | 1047 | ); |
1048 | 1048 | |
1049 | - if ( ! isset ( $zip_regex[ $country_code ] ) || preg_match( "/" . $zip_regex[ $country_code ] . "/i", $zip ) ) { |
|
1049 | + if ( ! isset ($zip_regex[$country_code]) || preg_match("/".$zip_regex[$country_code]."/i", $zip)) { |
|
1050 | 1050 | $ret = true; |
1051 | 1051 | } |
1052 | 1052 | |
1053 | - return apply_filters( 'give_is_zip_valid', $ret, $zip, $country_code ); |
|
1053 | + return apply_filters('give_is_zip_valid', $ret, $zip, $country_code); |
|
1054 | 1054 | } |
1055 | 1055 | \ No newline at end of file |
@@ -10,11 +10,11 @@ discard block |
||
10 | 10 | */ |
11 | 11 | |
12 | 12 | // Exit if accessed directly |
13 | -if ( ! defined( 'ABSPATH' ) ) { |
|
13 | +if ( ! defined('ABSPATH')) { |
|
14 | 14 | exit; |
15 | 15 | } |
16 | 16 | |
17 | -add_filter( 'cmb2_meta_boxes', 'give_single_forms_cmb2_metaboxes' ); |
|
17 | +add_filter('cmb2_meta_boxes', 'give_single_forms_cmb2_metaboxes'); |
|
18 | 18 | |
19 | 19 | /** |
20 | 20 | * Define the metabox and field configurations. |
@@ -23,23 +23,23 @@ discard block |
||
23 | 23 | * |
24 | 24 | * @return array |
25 | 25 | */ |
26 | -function give_single_forms_cmb2_metaboxes( array $meta_boxes ) { |
|
26 | +function give_single_forms_cmb2_metaboxes(array $meta_boxes) { |
|
27 | 27 | |
28 | 28 | $post_id = give_get_admin_post_id(); |
29 | - $price = give_get_form_price( $post_id ); |
|
30 | - $custom_amount_minimum = give_get_form_minimum_price( $post_id ); |
|
31 | - $goal = give_get_form_goal( $post_id ); |
|
32 | - $variable_pricing = give_has_variable_prices( $post_id ); |
|
33 | - $prices = give_get_variable_prices( $post_id ); |
|
29 | + $price = give_get_form_price($post_id); |
|
30 | + $custom_amount_minimum = give_get_form_minimum_price($post_id); |
|
31 | + $goal = give_get_form_goal($post_id); |
|
32 | + $variable_pricing = give_has_variable_prices($post_id); |
|
33 | + $prices = give_get_variable_prices($post_id); |
|
34 | 34 | |
35 | 35 | //No empty prices - min. 1.00 for new forms |
36 | - if ( empty( $price ) && is_null( $post_id ) ) { |
|
37 | - $price = esc_attr( give_format_amount( '1.00' ) ); |
|
36 | + if (empty($price) && is_null($post_id)) { |
|
37 | + $price = esc_attr(give_format_amount('1.00')); |
|
38 | 38 | } |
39 | 39 | |
40 | 40 | //Min. $1.00 for new forms |
41 | - if ( empty( $custom_amount_minimum ) ) { |
|
42 | - $custom_amount_minimum = esc_attr( give_format_amount( '1.00' ) ); |
|
41 | + if (empty($custom_amount_minimum)) { |
|
42 | + $custom_amount_minimum = esc_attr(give_format_amount('1.00')); |
|
43 | 43 | } |
44 | 44 | |
45 | 45 | // Start with an underscore to hide fields from custom fields list |
@@ -48,324 +48,324 @@ discard block |
||
48 | 48 | /** |
49 | 49 | * Repeatable Field Groups |
50 | 50 | */ |
51 | - $meta_boxes['form_field_options'] = apply_filters( 'give_forms_field_options', array( |
|
51 | + $meta_boxes['form_field_options'] = apply_filters('give_forms_field_options', array( |
|
52 | 52 | 'id' => 'form_field_options', |
53 | - 'title' => __( 'Donation Options', 'give' ), |
|
54 | - 'object_types' => array( 'give_forms' ), |
|
53 | + 'title' => __('Donation Options', 'give'), |
|
54 | + 'object_types' => array('give_forms'), |
|
55 | 55 | 'context' => 'normal', |
56 | 56 | 'priority' => 'high', //Show above Content WYSIWYG |
57 | - 'fields' => apply_filters( 'give_forms_donation_form_metabox_fields', array( |
|
57 | + 'fields' => apply_filters('give_forms_donation_form_metabox_fields', array( |
|
58 | 58 | //Donation Option |
59 | 59 | array( |
60 | - 'name' => __( 'Donation Option', 'give' ), |
|
61 | - 'description' => __( 'Would you like this form to have one set donation price or multiple levels (for example, $10, $20, $50)?', 'give' ), |
|
62 | - 'id' => $prefix . 'price_option', |
|
60 | + 'name' => __('Donation Option', 'give'), |
|
61 | + 'description' => __('Would you like this form to have one set donation price or multiple levels (for example, $10, $20, $50)?', 'give'), |
|
62 | + 'id' => $prefix.'price_option', |
|
63 | 63 | 'type' => 'radio_inline', |
64 | 64 | 'default' => 'set', |
65 | - 'options' => apply_filters( 'give_forms_price_options', array( |
|
66 | - 'set' => __( 'Set Donation', 'give' ), |
|
67 | - 'multi' => __( 'Multi-level Donation', 'give' ), |
|
68 | - ) ), |
|
65 | + 'options' => apply_filters('give_forms_price_options', array( |
|
66 | + 'set' => __('Set Donation', 'give'), |
|
67 | + 'multi' => __('Multi-level Donation', 'give'), |
|
68 | + )), |
|
69 | 69 | ), |
70 | 70 | array( |
71 | - 'name' => __( 'Set Donation', 'give' ), |
|
72 | - 'description' => __( 'This is the set donation amount for this form. If you have a "Custom Amount Minimum" set, make sure it is less than this amount.', 'give' ), |
|
73 | - 'id' => $prefix . 'set_price', |
|
71 | + 'name' => __('Set Donation', 'give'), |
|
72 | + 'description' => __('This is the set donation amount for this form. If you have a "Custom Amount Minimum" set, make sure it is less than this amount.', 'give'), |
|
73 | + 'id' => $prefix.'set_price', |
|
74 | 74 | 'type' => 'text_small', |
75 | 75 | 'row_classes' => 'give-subfield', |
76 | - 'before_field' => give_get_option( 'currency_position' ) == 'before' ? '<span class="give-money-symbol give-money-symbol-before">' . give_currency_symbol() . '</span>' : '', |
|
77 | - 'after_field' => give_get_option( 'currency_position' ) == 'after' ? '<span class="give-money-symbol give-money-symbol-after">' . give_currency_symbol() . '</span>' : '', |
|
76 | + 'before_field' => give_get_option('currency_position') == 'before' ? '<span class="give-money-symbol give-money-symbol-before">'.give_currency_symbol().'</span>' : '', |
|
77 | + 'after_field' => give_get_option('currency_position') == 'after' ? '<span class="give-money-symbol give-money-symbol-after">'.give_currency_symbol().'</span>' : '', |
|
78 | 78 | 'attributes' => array( |
79 | - 'placeholder' => give_format_amount( '1.00' ), |
|
80 | - 'value' => give_format_amount( $price ), |
|
79 | + 'placeholder' => give_format_amount('1.00'), |
|
80 | + 'value' => give_format_amount($price), |
|
81 | 81 | 'class' => 'cmb-type-text-small give-money-field', |
82 | 82 | ), |
83 | 83 | ), |
84 | 84 | //Donation levels: Header |
85 | 85 | array( |
86 | - 'id' => $prefix . 'levels_header', |
|
86 | + 'id' => $prefix.'levels_header', |
|
87 | 87 | 'type' => 'levels_repeater_header', |
88 | 88 | ), |
89 | 89 | //Donation Levels: Repeatable CMB2 Group |
90 | 90 | array( |
91 | - 'id' => $prefix . 'donation_levels', |
|
91 | + 'id' => $prefix.'donation_levels', |
|
92 | 92 | 'type' => 'group', |
93 | 93 | 'row_classes' => 'give-subfield', |
94 | 94 | 'options' => array( |
95 | - 'add_button' => __( 'Add Level', 'give' ), |
|
96 | - 'remove_button' => __( '<span class="dashicons dashicons-no"></span>', 'give' ), |
|
95 | + 'add_button' => __('Add Level', 'give'), |
|
96 | + 'remove_button' => __('<span class="dashicons dashicons-no"></span>', 'give'), |
|
97 | 97 | 'sortable' => true, // beta |
98 | 98 | ), |
99 | 99 | // Fields array works the same, except id's only need to be unique for this group. Prefix is not needed. |
100 | - 'fields' => apply_filters( 'give_donation_levels_table_row', array( |
|
100 | + 'fields' => apply_filters('give_donation_levels_table_row', array( |
|
101 | 101 | array( |
102 | - 'name' => __( 'ID', 'give' ), |
|
103 | - 'id' => $prefix . 'id', |
|
102 | + 'name' => __('ID', 'give'), |
|
103 | + 'id' => $prefix.'id', |
|
104 | 104 | 'type' => 'levels_id', |
105 | 105 | ), |
106 | 106 | array( |
107 | - 'name' => __( 'Amount', 'give' ), |
|
108 | - 'id' => $prefix . 'amount', |
|
107 | + 'name' => __('Amount', 'give'), |
|
108 | + 'id' => $prefix.'amount', |
|
109 | 109 | 'type' => 'text_small', |
110 | - 'before_field' => give_get_option( 'currency_position' ) == 'before' ? '<span class="give-money-symbol give-money-symbol-before">' . give_currency_symbol() . '</span>' : '', |
|
111 | - 'after_field' => give_get_option( 'currency_position' ) == 'after' ? '<span class="give-money-symbol give-money-symbol-after">' . give_currency_symbol() . '</span>' : '', |
|
110 | + 'before_field' => give_get_option('currency_position') == 'before' ? '<span class="give-money-symbol give-money-symbol-before">'.give_currency_symbol().'</span>' : '', |
|
111 | + 'after_field' => give_get_option('currency_position') == 'after' ? '<span class="give-money-symbol give-money-symbol-after">'.give_currency_symbol().'</span>' : '', |
|
112 | 112 | 'attributes' => array( |
113 | - 'placeholder' => give_format_amount( '1.00' ), |
|
113 | + 'placeholder' => give_format_amount('1.00'), |
|
114 | 114 | 'class' => 'cmb-type-text-small give-money-field', |
115 | 115 | ), |
116 | 116 | 'before' => 'give_format_admin_multilevel_amount', |
117 | 117 | ), |
118 | 118 | array( |
119 | - 'name' => __( 'Text', 'give' ), |
|
120 | - 'id' => $prefix . 'text', |
|
119 | + 'name' => __('Text', 'give'), |
|
120 | + 'id' => $prefix.'text', |
|
121 | 121 | 'type' => 'text', |
122 | 122 | 'attributes' => array( |
123 | - 'placeholder' => __( 'Donation Level', 'give' ), |
|
123 | + 'placeholder' => __('Donation Level', 'give'), |
|
124 | 124 | 'class' => 'give-multilevel-text-field', |
125 | 125 | ), |
126 | 126 | ), |
127 | 127 | array( |
128 | - 'name' => __( 'Default', 'give' ), |
|
129 | - 'id' => $prefix . 'default', |
|
128 | + 'name' => __('Default', 'give'), |
|
129 | + 'id' => $prefix.'default', |
|
130 | 130 | 'type' => 'give_default_radio_inline' |
131 | 131 | ), |
132 | - ) ), |
|
132 | + )), |
|
133 | 133 | ), |
134 | 134 | //Display Style |
135 | 135 | array( |
136 | - 'name' => __( 'Display Style', 'give' ), |
|
137 | - 'description' => __( 'Set how the donations levels will display on the form.', 'give' ), |
|
138 | - 'id' => $prefix . 'display_style', |
|
136 | + 'name' => __('Display Style', 'give'), |
|
137 | + 'description' => __('Set how the donations levels will display on the form.', 'give'), |
|
138 | + 'id' => $prefix.'display_style', |
|
139 | 139 | 'type' => 'radio_inline', |
140 | 140 | 'default' => 'buttons', |
141 | 141 | 'options' => array( |
142 | - 'buttons' => __( 'Buttons', 'give' ), |
|
143 | - 'radios' => __( 'Radios', 'give' ), |
|
144 | - 'dropdown' => __( 'Dropdown', 'give' ), |
|
142 | + 'buttons' => __('Buttons', 'give'), |
|
143 | + 'radios' => __('Radios', 'give'), |
|
144 | + 'dropdown' => __('Dropdown', 'give'), |
|
145 | 145 | ), |
146 | 146 | ), |
147 | 147 | //Custom Amount |
148 | 148 | array( |
149 | - 'name' => __( 'Custom Amount', 'give' ), |
|
150 | - 'description' => __( 'Do you want the user to be able to input their own donation amount?', 'give' ), |
|
151 | - 'id' => $prefix . 'custom_amount', |
|
149 | + 'name' => __('Custom Amount', 'give'), |
|
150 | + 'description' => __('Do you want the user to be able to input their own donation amount?', 'give'), |
|
151 | + 'id' => $prefix.'custom_amount', |
|
152 | 152 | 'type' => 'radio_inline', |
153 | 153 | 'default' => 'no', |
154 | 154 | 'options' => array( |
155 | - 'yes' => __( 'Yes', 'give' ), |
|
156 | - 'no' => __( 'No', 'give' ), |
|
155 | + 'yes' => __('Yes', 'give'), |
|
156 | + 'no' => __('No', 'give'), |
|
157 | 157 | ), |
158 | 158 | ), |
159 | 159 | array( |
160 | - 'name' => __( 'Custom Amount Minimum', 'give' ), |
|
161 | - 'description' => __( 'If you would like to set a minimum custom donation amount please enter it here.', 'give' ), |
|
162 | - 'id' => $prefix . 'custom_amount_minimum', |
|
160 | + 'name' => __('Custom Amount Minimum', 'give'), |
|
161 | + 'description' => __('If you would like to set a minimum custom donation amount please enter it here.', 'give'), |
|
162 | + 'id' => $prefix.'custom_amount_minimum', |
|
163 | 163 | 'type' => 'text_small', |
164 | 164 | 'row_classes' => 'give-subfield', |
165 | - 'before_field' => give_get_option( 'currency_position' ) == 'before' ? '<span class="give-money-symbol give-money-symbol-before">' . give_currency_symbol() . '</span>' : '', |
|
166 | - 'after_field' => give_get_option( 'currency_position' ) == 'after' ? '<span class="give-money-symbol give-money-symbol-after">' . give_currency_symbol() . '</span>' : '', |
|
165 | + 'before_field' => give_get_option('currency_position') == 'before' ? '<span class="give-money-symbol give-money-symbol-before">'.give_currency_symbol().'</span>' : '', |
|
166 | + 'after_field' => give_get_option('currency_position') == 'after' ? '<span class="give-money-symbol give-money-symbol-after">'.give_currency_symbol().'</span>' : '', |
|
167 | 167 | 'attributes' => array( |
168 | - 'placeholder' => give_format_amount( '1.00' ), |
|
169 | - 'value' => give_format_amount( $custom_amount_minimum ), |
|
168 | + 'placeholder' => give_format_amount('1.00'), |
|
169 | + 'value' => give_format_amount($custom_amount_minimum), |
|
170 | 170 | 'class' => 'cmb-type-text-small give-money-field', |
171 | 171 | ), |
172 | 172 | ), |
173 | 173 | array( |
174 | - 'name' => __( 'Custom Amount Text', 'give' ), |
|
175 | - 'description' => __( 'This text appears as a label below the custom amount field for set donation forms. For multi-level forms the text will appear as it\'s own level (ie button, radio, or select option).', 'give' ), |
|
176 | - 'id' => $prefix . 'custom_amount_text', |
|
174 | + 'name' => __('Custom Amount Text', 'give'), |
|
175 | + 'description' => __('This text appears as a label below the custom amount field for set donation forms. For multi-level forms the text will appear as it\'s own level (ie button, radio, or select option).', 'give'), |
|
176 | + 'id' => $prefix.'custom_amount_text', |
|
177 | 177 | 'type' => 'text', |
178 | 178 | 'row_classes' => 'give-subfield', |
179 | 179 | 'attributes' => array( |
180 | 180 | 'rows' => 3, |
181 | - 'placeholder' => __( 'Give a Custom Amount', 'give' ), |
|
181 | + 'placeholder' => __('Give a Custom Amount', 'give'), |
|
182 | 182 | ), |
183 | 183 | ), |
184 | 184 | //Goals |
185 | 185 | array( |
186 | - 'name' => __( 'Goal', 'give' ), |
|
187 | - 'description' => __( 'Do you want to set a donation goal for this form?', 'give' ), |
|
188 | - 'id' => $prefix . 'goal_option', |
|
186 | + 'name' => __('Goal', 'give'), |
|
187 | + 'description' => __('Do you want to set a donation goal for this form?', 'give'), |
|
188 | + 'id' => $prefix.'goal_option', |
|
189 | 189 | 'type' => 'radio_inline', |
190 | 190 | 'default' => 'no', |
191 | 191 | 'options' => array( |
192 | - 'yes' => __( 'Yes', 'give' ), |
|
193 | - 'no' => __( 'No', 'give' ), |
|
192 | + 'yes' => __('Yes', 'give'), |
|
193 | + 'no' => __('No', 'give'), |
|
194 | 194 | ), |
195 | 195 | ), |
196 | 196 | array( |
197 | - 'name' => __( 'Goal Amount', 'give' ), |
|
198 | - 'description' => __( 'This is the monetary goal amount you want to reach for this donation form.', 'give' ), |
|
199 | - 'id' => $prefix . 'set_goal', |
|
197 | + 'name' => __('Goal Amount', 'give'), |
|
198 | + 'description' => __('This is the monetary goal amount you want to reach for this donation form.', 'give'), |
|
199 | + 'id' => $prefix.'set_goal', |
|
200 | 200 | 'type' => 'text_small', |
201 | 201 | 'row_classes' => 'give-subfield', |
202 | - 'before_field' => give_get_option( 'currency_position' ) == 'before' ? '<span class="give-money-symbol give-money-symbol-before">' . give_currency_symbol() . '</span>' : '', |
|
203 | - 'after_field' => give_get_option( 'currency_position' ) == 'after' ? '<span class="give-money-symbol give-money-symbol-after">' . give_currency_symbol() . '</span>' : '', |
|
202 | + 'before_field' => give_get_option('currency_position') == 'before' ? '<span class="give-money-symbol give-money-symbol-before">'.give_currency_symbol().'</span>' : '', |
|
203 | + 'after_field' => give_get_option('currency_position') == 'after' ? '<span class="give-money-symbol give-money-symbol-after">'.give_currency_symbol().'</span>' : '', |
|
204 | 204 | 'attributes' => array( |
205 | - 'placeholder' => give_format_amount( '0.00' ), |
|
206 | - 'value' => isset( $goal ) ? esc_attr( give_format_amount( $goal ) ) : '', |
|
205 | + 'placeholder' => give_format_amount('0.00'), |
|
206 | + 'value' => isset($goal) ? esc_attr(give_format_amount($goal)) : '', |
|
207 | 207 | 'class' => 'cmb-type-text-small give-money-field', |
208 | 208 | ), |
209 | 209 | ), |
210 | 210 | |
211 | 211 | array( |
212 | - 'name' => __( 'Goal Format', 'give' ), |
|
213 | - 'description' => __( 'Would you like to display the total amount raised based on your monetary goal or a percentage? For instance, "$500 of $1,000 raised" or "50% funded".', 'give' ), |
|
214 | - 'id' => $prefix . 'goal_format', |
|
212 | + 'name' => __('Goal Format', 'give'), |
|
213 | + 'description' => __('Would you like to display the total amount raised based on your monetary goal or a percentage? For instance, "$500 of $1,000 raised" or "50% funded".', 'give'), |
|
214 | + 'id' => $prefix.'goal_format', |
|
215 | 215 | 'type' => 'radio_inline', |
216 | 216 | 'default' => 'amount', |
217 | 217 | 'row_classes' => 'give-subfield', |
218 | 218 | 'options' => array( |
219 | - 'amount' => __( 'Amount ', 'give' ), |
|
220 | - 'percentage' => __( 'Percentage', 'give' ), |
|
219 | + 'amount' => __('Amount ', 'give'), |
|
220 | + 'percentage' => __('Percentage', 'give'), |
|
221 | 221 | ), |
222 | 222 | ), |
223 | 223 | array( |
224 | - 'name' => __( 'Goal Progress Bar Color', 'give' ), |
|
225 | - 'id' => $prefix . 'goal_color', |
|
224 | + 'name' => __('Goal Progress Bar Color', 'give'), |
|
225 | + 'id' => $prefix.'goal_color', |
|
226 | 226 | 'type' => 'colorpicker', |
227 | 227 | 'row_classes' => 'give-subfield', |
228 | 228 | 'default' => '#2bc253', |
229 | 229 | ), |
230 | 230 | ) |
231 | 231 | ) |
232 | - ) ); |
|
232 | + )); |
|
233 | 233 | |
234 | 234 | |
235 | 235 | /** |
236 | 236 | * Content Field |
237 | 237 | */ |
238 | - $meta_boxes['form_content_options'] = apply_filters( 'give_forms_content_options', array( |
|
238 | + $meta_boxes['form_content_options'] = apply_filters('give_forms_content_options', array( |
|
239 | 239 | 'id' => 'form_content_options', |
240 | - 'title' => __( 'Form Content', 'give' ), |
|
241 | - 'object_types' => array( 'give_forms' ), |
|
240 | + 'title' => __('Form Content', 'give'), |
|
241 | + 'object_types' => array('give_forms'), |
|
242 | 242 | 'context' => 'normal', |
243 | 243 | 'priority' => 'high', //Show above Content WYSIWYG |
244 | - 'fields' => apply_filters( 'give_forms_content_options_metabox_fields', array( |
|
244 | + 'fields' => apply_filters('give_forms_content_options_metabox_fields', array( |
|
245 | 245 | //Donation Option |
246 | 246 | array( |
247 | - 'name' => __( 'Display Content', 'give' ), |
|
248 | - 'description' => __( 'Do you want to display content? If you select "Yes" a WYSIWYG editor will appear which you will be able to enter content to display above or below the form.', 'give' ), |
|
249 | - 'id' => $prefix . 'content_option', |
|
247 | + 'name' => __('Display Content', 'give'), |
|
248 | + 'description' => __('Do you want to display content? If you select "Yes" a WYSIWYG editor will appear which you will be able to enter content to display above or below the form.', 'give'), |
|
249 | + 'id' => $prefix.'content_option', |
|
250 | 250 | 'type' => 'select', |
251 | - 'options' => apply_filters( 'give_forms_content_options_select', array( |
|
252 | - 'none' => __( 'No content', 'give' ), |
|
253 | - 'give_pre_form' => __( 'Yes, display content ABOVE the form fields', 'give' ), |
|
254 | - 'give_post_form' => __( 'Yes, display content BELOW the form fields', 'give' ), |
|
251 | + 'options' => apply_filters('give_forms_content_options_select', array( |
|
252 | + 'none' => __('No content', 'give'), |
|
253 | + 'give_pre_form' => __('Yes, display content ABOVE the form fields', 'give'), |
|
254 | + 'give_post_form' => __('Yes, display content BELOW the form fields', 'give'), |
|
255 | 255 | ) |
256 | 256 | ), |
257 | 257 | 'default' => 'none', |
258 | 258 | ), |
259 | 259 | array( |
260 | - 'name' => __( 'Content', 'give' ), |
|
261 | - 'description' => __( 'This content will display on the single give form page.', 'give' ), |
|
262 | - 'id' => $prefix . 'form_content', |
|
260 | + 'name' => __('Content', 'give'), |
|
261 | + 'description' => __('This content will display on the single give form page.', 'give'), |
|
262 | + 'id' => $prefix.'form_content', |
|
263 | 263 | 'row_classes' => 'give-subfield', |
264 | 264 | 'type' => 'wysiwyg' |
265 | 265 | ), |
266 | 266 | ) |
267 | 267 | ) |
268 | - ) ); |
|
268 | + )); |
|
269 | 269 | |
270 | 270 | |
271 | 271 | /** |
272 | 272 | * Display Options |
273 | 273 | */ |
274 | - $meta_boxes['form_display_options'] = apply_filters( 'give_form_display_options', array( |
|
274 | + $meta_boxes['form_display_options'] = apply_filters('give_form_display_options', array( |
|
275 | 275 | 'id' => 'form_display_options', |
276 | - 'title' => __( 'Form Display Options', 'give' ), |
|
277 | - 'object_types' => array( 'give_forms' ), |
|
276 | + 'title' => __('Form Display Options', 'give'), |
|
277 | + 'object_types' => array('give_forms'), |
|
278 | 278 | 'context' => 'normal', // 'normal', 'advanced', or 'side' |
279 | 279 | 'priority' => 'high', //Show above Content WYSIWYG |
280 | 280 | 'show_names' => true, // Show field names on the left |
281 | - 'fields' => apply_filters( 'give_forms_display_options_metabox_fields', array( |
|
281 | + 'fields' => apply_filters('give_forms_display_options_metabox_fields', array( |
|
282 | 282 | array( |
283 | - 'name' => __( 'Payment Fields', 'give' ), |
|
284 | - 'desc' => __( 'How would you like to display payment information for this form? The "Show on Page" option will display the entire form when the page loads. "Reveal Upon Click" places a button below the donation fields and upon click slides into view the rest of the fields. "Modal Window Upon Click" is a similar option, rather than sliding into view the fields they will open in a shadow box or "modal" window.', 'give' ), |
|
285 | - 'id' => $prefix . 'payment_display', |
|
283 | + 'name' => __('Payment Fields', 'give'), |
|
284 | + 'desc' => __('How would you like to display payment information for this form? The "Show on Page" option will display the entire form when the page loads. "Reveal Upon Click" places a button below the donation fields and upon click slides into view the rest of the fields. "Modal Window Upon Click" is a similar option, rather than sliding into view the fields they will open in a shadow box or "modal" window.', 'give'), |
|
285 | + 'id' => $prefix.'payment_display', |
|
286 | 286 | 'type' => 'select', |
287 | 287 | 'options' => array( |
288 | - 'onpage' => __( 'Show on Page', 'give' ), |
|
289 | - 'reveal' => __( 'Reveal Upon Click', 'give' ), |
|
290 | - 'modal' => __( 'Modal Window Upon Click', 'give' ), |
|
288 | + 'onpage' => __('Show on Page', 'give'), |
|
289 | + 'reveal' => __('Reveal Upon Click', 'give'), |
|
290 | + 'modal' => __('Modal Window Upon Click', 'give'), |
|
291 | 291 | ), |
292 | 292 | 'default' => 'onpage', |
293 | 293 | ), |
294 | 294 | array( |
295 | - 'id' => $prefix . 'reveal_label', |
|
296 | - 'name' => __( 'Reveal / Modal Open Text', 'give' ), |
|
297 | - 'desc' => __( 'The button label for completing the donation.', 'give' ), |
|
295 | + 'id' => $prefix.'reveal_label', |
|
296 | + 'name' => __('Reveal / Modal Open Text', 'give'), |
|
297 | + 'desc' => __('The button label for completing the donation.', 'give'), |
|
298 | 298 | 'type' => 'text_small', |
299 | 299 | 'row_classes' => 'give-subfield', |
300 | 300 | 'attributes' => array( |
301 | - 'placeholder' => __( 'Donate Now', 'give' ), |
|
301 | + 'placeholder' => __('Donate Now', 'give'), |
|
302 | 302 | ), |
303 | 303 | ), |
304 | 304 | array( |
305 | - 'id' => $prefix . 'checkout_label', |
|
306 | - 'name' => __( 'Complete Donation Text', 'give' ), |
|
307 | - 'desc' => __( 'The button label for completing a donation.', 'give' ), |
|
305 | + 'id' => $prefix.'checkout_label', |
|
306 | + 'name' => __('Complete Donation Text', 'give'), |
|
307 | + 'desc' => __('The button label for completing a donation.', 'give'), |
|
308 | 308 | 'type' => 'text_small', |
309 | 309 | 'attributes' => array( |
310 | - 'placeholder' => __( 'Donate Now', 'give' ), |
|
310 | + 'placeholder' => __('Donate Now', 'give'), |
|
311 | 311 | ), |
312 | 312 | ), |
313 | 313 | array( |
314 | - 'name' => __( 'Default Gateway', 'give' ), |
|
315 | - 'desc' => __( 'By default, the gateway for this form will inherit the global default gateway (set under Give > Settings > Payment Gateways). This option allows you to customize the default gateway for this form only.', 'give' ), |
|
316 | - 'id' => $prefix . 'default_gateway', |
|
314 | + 'name' => __('Default Gateway', 'give'), |
|
315 | + 'desc' => __('By default, the gateway for this form will inherit the global default gateway (set under Give > Settings > Payment Gateways). This option allows you to customize the default gateway for this form only.', 'give'), |
|
316 | + 'id' => $prefix.'default_gateway', |
|
317 | 317 | 'type' => 'default_gateway' |
318 | 318 | ), |
319 | 319 | array( |
320 | - 'name' => __( 'Disable Guest Donations', 'give' ), |
|
321 | - 'desc' => __( 'Do you want to require users be logged-in to make donations?', 'give' ), |
|
322 | - 'id' => $prefix . 'logged_in_only', |
|
320 | + 'name' => __('Disable Guest Donations', 'give'), |
|
321 | + 'desc' => __('Do you want to require users be logged-in to make donations?', 'give'), |
|
322 | + 'id' => $prefix.'logged_in_only', |
|
323 | 323 | 'type' => 'checkbox' |
324 | 324 | ), |
325 | 325 | array( |
326 | - 'name' => __( 'Register / Login Form', 'give' ), |
|
327 | - 'desc' => __( 'Display the registration and login forms in the payment section for non-logged-in users.', 'give' ), |
|
328 | - 'id' => $prefix . 'show_register_form', |
|
326 | + 'name' => __('Register / Login Form', 'give'), |
|
327 | + 'desc' => __('Display the registration and login forms in the payment section for non-logged-in users.', 'give'), |
|
328 | + 'id' => $prefix.'show_register_form', |
|
329 | 329 | 'type' => 'select', |
330 | 330 | 'options' => array( |
331 | - 'both' => __( 'Registration and Login Forms', 'give' ), |
|
332 | - 'registration' => __( 'Registration Form Only', 'give' ), |
|
333 | - 'login' => __( 'Login Form Only', 'give' ), |
|
334 | - 'none' => __( 'None', 'give' ), |
|
331 | + 'both' => __('Registration and Login Forms', 'give'), |
|
332 | + 'registration' => __('Registration Form Only', 'give'), |
|
333 | + 'login' => __('Login Form Only', 'give'), |
|
334 | + 'none' => __('None', 'give'), |
|
335 | 335 | ), |
336 | 336 | 'default' => 'none', |
337 | 337 | ), |
338 | 338 | array( |
339 | - 'name' => __( 'Floating Labels', 'give' ), |
|
340 | - 'desc' => sprintf( __( 'Select the <a href="%s" target="_blank">floating labels</a> setting for this Give form.<br>Be aware that if you have the "Disable CSS" option enabled, you will need to style the floating labels yourself.', 'give' ), esc_url( "http://bradfrost.com/blog/post/float-label-pattern/" ) ), |
|
341 | - 'id' => $prefix . 'form_floating_labels', |
|
339 | + 'name' => __('Floating Labels', 'give'), |
|
340 | + 'desc' => sprintf(__('Select the <a href="%s" target="_blank">floating labels</a> setting for this Give form.<br>Be aware that if you have the "Disable CSS" option enabled, you will need to style the floating labels yourself.', 'give'), esc_url("http://bradfrost.com/blog/post/float-label-pattern/")), |
|
341 | + 'id' => $prefix.'form_floating_labels', |
|
342 | 342 | 'type' => 'select', |
343 | 343 | 'options' => array( |
344 | - '' => __( 'Use the global setting', 'give' ), |
|
345 | - 'enabled' => __( 'Enabled', 'give' ), |
|
346 | - 'disabled' => __( 'Disabled', 'give' ), |
|
344 | + '' => __('Use the global setting', 'give'), |
|
345 | + 'enabled' => __('Enabled', 'give'), |
|
346 | + 'disabled' => __('Disabled', 'give'), |
|
347 | 347 | ), |
348 | 348 | 'default' => 'none', |
349 | 349 | ), |
350 | 350 | array( |
351 | - 'name' => __( 'Close Form when Goal Achieved', 'give' ), |
|
352 | - 'desc' => __( 'Would you like to close the donation forms and stop accepting donations once this goal has been met?', 'give' ), |
|
353 | - 'id' => $prefix . 'close_form_when_goal_achieved', |
|
351 | + 'name' => __('Close Form when Goal Achieved', 'give'), |
|
352 | + 'desc' => __('Would you like to close the donation forms and stop accepting donations once this goal has been met?', 'give'), |
|
353 | + 'id' => $prefix.'close_form_when_goal_achieved', |
|
354 | 354 | 'type' => 'radio_inline', |
355 | 355 | 'options' => array( |
356 | - 'yes' => __( 'Yes', 'give' ), |
|
357 | - 'no' => __( 'No', 'give' ), |
|
356 | + 'yes' => __('Yes', 'give'), |
|
357 | + 'no' => __('No', 'give'), |
|
358 | 358 | ), |
359 | 359 | 'default' => 'no', |
360 | 360 | ), |
361 | 361 | array( |
362 | - 'name' => __( 'Goal Achieved Message', 'give' ), |
|
363 | - 'desc' => __( 'Would you like to display a custom message when the goal is closed? If none is provided the default message will be displayed', 'give' ), |
|
364 | - 'id' => $prefix . 'form_goal_achieved_message', |
|
362 | + 'name' => __('Goal Achieved Message', 'give'), |
|
363 | + 'desc' => __('Would you like to display a custom message when the goal is closed? If none is provided the default message will be displayed', 'give'), |
|
364 | + 'id' => $prefix.'form_goal_achieved_message', |
|
365 | 365 | 'type' => 'textarea', |
366 | 366 | 'row_classes' => 'give-subfield', |
367 | 367 | 'attributes' => array( |
368 | - 'placeholder' => __( 'Thank you to all our donors, we have met our goal.', 'give' ), |
|
368 | + 'placeholder' => __('Thank you to all our donors, we have met our goal.', 'give'), |
|
369 | 369 | ), |
370 | 370 | ) |
371 | 371 | ) |
@@ -376,47 +376,47 @@ discard block |
||
376 | 376 | /** |
377 | 377 | * Terms & Conditions |
378 | 378 | */ |
379 | - $meta_boxes['form_terms_options'] = apply_filters( 'give_forms_terms_options', array( |
|
379 | + $meta_boxes['form_terms_options'] = apply_filters('give_forms_terms_options', array( |
|
380 | 380 | 'id' => 'form_terms_options', |
381 | - 'title' => __( 'Terms and Conditions', 'give' ), |
|
382 | - 'object_types' => array( 'give_forms' ), |
|
381 | + 'title' => __('Terms and Conditions', 'give'), |
|
382 | + 'object_types' => array('give_forms'), |
|
383 | 383 | 'context' => 'normal', |
384 | 384 | 'priority' => 'high', //Show above Content WYSIWYG |
385 | - 'fields' => apply_filters( 'give_forms_terms_options_metabox_fields', array( |
|
385 | + 'fields' => apply_filters('give_forms_terms_options_metabox_fields', array( |
|
386 | 386 | //Donation Option |
387 | 387 | array( |
388 | - 'name' => __( 'Terms and Conditions', 'give' ), |
|
389 | - 'description' => __( 'Do you want to require the user to agree to terms and conditions prior to being able to complete their donation?', 'give' ), |
|
390 | - 'id' => $prefix . 'terms_option', |
|
388 | + 'name' => __('Terms and Conditions', 'give'), |
|
389 | + 'description' => __('Do you want to require the user to agree to terms and conditions prior to being able to complete their donation?', 'give'), |
|
390 | + 'id' => $prefix.'terms_option', |
|
391 | 391 | 'type' => 'select', |
392 | - 'options' => apply_filters( 'give_forms_content_options_select', array( |
|
393 | - 'none' => __( 'No', 'give' ), |
|
394 | - 'yes' => __( 'Yes', 'give' ), |
|
392 | + 'options' => apply_filters('give_forms_content_options_select', array( |
|
393 | + 'none' => __('No', 'give'), |
|
394 | + 'yes' => __('Yes', 'give'), |
|
395 | 395 | ) |
396 | 396 | ), |
397 | 397 | 'default' => 'none', |
398 | 398 | ), |
399 | 399 | array( |
400 | - 'id' => $prefix . 'agree_label', |
|
401 | - 'name' => __( 'Agree to Terms Label', 'give' ), |
|
402 | - 'desc' => __( 'The label shown next to the agree to terms check box. Add your own to customize or leave blank to use the default text placeholder.', 'give' ), |
|
400 | + 'id' => $prefix.'agree_label', |
|
401 | + 'name' => __('Agree to Terms Label', 'give'), |
|
402 | + 'desc' => __('The label shown next to the agree to terms check box. Add your own to customize or leave blank to use the default text placeholder.', 'give'), |
|
403 | 403 | 'type' => 'text', |
404 | 404 | 'row_classes' => 'give-subfield', |
405 | 405 | 'size' => 'regular', |
406 | 406 | 'attributes' => array( |
407 | - 'placeholder' => __( 'Agree to Terms?', 'give' ), |
|
407 | + 'placeholder' => __('Agree to Terms?', 'give'), |
|
408 | 408 | ), |
409 | 409 | ), |
410 | 410 | array( |
411 | - 'id' => $prefix . 'agree_text', |
|
411 | + 'id' => $prefix.'agree_text', |
|
412 | 412 | 'row_classes' => 'give-subfield', |
413 | - 'name' => __( 'Agreement Text', 'give' ), |
|
414 | - 'desc' => __( 'This is the actual text which the user will have to agree to in order to make a donation.', 'give' ), |
|
413 | + 'name' => __('Agreement Text', 'give'), |
|
414 | + 'desc' => __('This is the actual text which the user will have to agree to in order to make a donation.', 'give'), |
|
415 | 415 | 'type' => 'wysiwyg' |
416 | 416 | ), |
417 | 417 | ) |
418 | 418 | ) |
419 | - ) ); |
|
419 | + )); |
|
420 | 420 | |
421 | 421 | return $meta_boxes; |
422 | 422 | |
@@ -430,18 +430,18 @@ discard block |
||
430 | 430 | |
431 | 431 | <div class="table-container"> |
432 | 432 | <div class="table-row"> |
433 | - <div class="table-cell col-amount"><?php _e( 'Amount', 'give' ); ?></div> |
|
434 | - <div class="table-cell col-text"><?php _e( 'Text', 'give' ); ?></div> |
|
435 | - <div class="table-cell col-default"><?php _e( 'Default', 'give' ); ?></div> |
|
436 | - <?php do_action( 'give_donation_levels_table_head' ); ?> |
|
437 | - <div class="table-cell col-sort"><?php _e( 'Sort', 'give' ); ?></div> |
|
433 | + <div class="table-cell col-amount"><?php _e('Amount', 'give'); ?></div> |
|
434 | + <div class="table-cell col-text"><?php _e('Text', 'give'); ?></div> |
|
435 | + <div class="table-cell col-default"><?php _e('Default', 'give'); ?></div> |
|
436 | + <?php do_action('give_donation_levels_table_head'); ?> |
|
437 | + <div class="table-cell col-sort"><?php _e('Sort', 'give'); ?></div> |
|
438 | 438 | |
439 | 439 | </div> |
440 | 440 | </div> |
441 | 441 | |
442 | 442 | <?php |
443 | 443 | } |
444 | -add_action( 'cmb2_render_levels_repeater_header', 'give_cmb_render_levels_repeater_header', 10 ); |
|
444 | +add_action('cmb2_render_levels_repeater_header', 'give_cmb_render_levels_repeater_header', 10); |
|
445 | 445 | |
446 | 446 | |
447 | 447 | /** |
@@ -458,24 +458,24 @@ discard block |
||
458 | 458 | * @param $object_type |
459 | 459 | * @param $field_type_object |
460 | 460 | */ |
461 | -function give_cmb_render_levels_id( $field_object, $escaped_value, $object_id, $object_type, $field_type_object ) { |
|
461 | +function give_cmb_render_levels_id($field_object, $escaped_value, $object_id, $object_type, $field_type_object) { |
|
462 | 462 | |
463 | - $escaped_value = ( isset( $escaped_value['level_id'] ) ? $escaped_value['level_id'] : '' ); |
|
463 | + $escaped_value = (isset($escaped_value['level_id']) ? $escaped_value['level_id'] : ''); |
|
464 | 464 | |
465 | 465 | $field_options_array = array( |
466 | 466 | 'class' => 'give-hidden give-level-id-input', |
467 | - 'name' => $field_type_object->_name( '[level_id]' ), |
|
468 | - 'id' => $field_type_object->_id( '_level_id' ), |
|
467 | + 'name' => $field_type_object->_name('[level_id]'), |
|
468 | + 'id' => $field_type_object->_id('_level_id'), |
|
469 | 469 | 'value' => $escaped_value, |
470 | 470 | 'type' => 'number', |
471 | 471 | 'desc' => '', |
472 | 472 | ); |
473 | 473 | |
474 | - echo '<p class="give-level-id">' . $escaped_value . '</p>'; |
|
475 | - echo $field_type_object->input( $field_options_array ); |
|
474 | + echo '<p class="give-level-id">'.$escaped_value.'</p>'; |
|
475 | + echo $field_type_object->input($field_options_array); |
|
476 | 476 | |
477 | 477 | } |
478 | -add_action( 'cmb2_render_levels_id', 'give_cmb_render_levels_id', 10, 5 ); |
|
478 | +add_action('cmb2_render_levels_id', 'give_cmb_render_levels_id', 10, 5); |
|
479 | 479 | |
480 | 480 | |
481 | 481 | /** |
@@ -487,13 +487,13 @@ discard block |
||
487 | 487 | * @param $object_type |
488 | 488 | * @param $field_type_object |
489 | 489 | */ |
490 | -function give_cmb_give_default_radio_inline( $field_object, $escaped_value, $object_id, $object_type, $field_type_object ) { |
|
491 | - echo '<input type="radio" class="cmb2-option donation-level-radio" name="' . $field_object->args['_name'] . '" id="' . $field_object->args['id'] . '" value="default" ' . checked( 'default', $escaped_value, false ) . '>'; |
|
492 | - echo '<label for="' . $field_object->args['id'] . '">Default</label>'; |
|
490 | +function give_cmb_give_default_radio_inline($field_object, $escaped_value, $object_id, $object_type, $field_type_object) { |
|
491 | + echo '<input type="radio" class="cmb2-option donation-level-radio" name="'.$field_object->args['_name'].'" id="'.$field_object->args['id'].'" value="default" '.checked('default', $escaped_value, false).'>'; |
|
492 | + echo '<label for="'.$field_object->args['id'].'">Default</label>'; |
|
493 | 493 | |
494 | 494 | } |
495 | 495 | |
496 | -add_action( 'cmb2_render_give_default_radio_inline', 'give_cmb_give_default_radio_inline', 10, 5 ); |
|
496 | +add_action('cmb2_render_give_default_radio_inline', 'give_cmb_give_default_radio_inline', 10, 5); |
|
497 | 497 | |
498 | 498 | |
499 | 499 | /** |
@@ -503,20 +503,20 @@ discard block |
||
503 | 503 | */ |
504 | 504 | function give_add_shortcode_to_publish_metabox() { |
505 | 505 | |
506 | - if ( 'give_forms' !== get_post_type() ) { |
|
506 | + if ('give_forms' !== get_post_type()) { |
|
507 | 507 | return false; |
508 | 508 | } |
509 | 509 | |
510 | 510 | global $post; |
511 | 511 | |
512 | 512 | //Only enqueue scripts for CPT on post type screen |
513 | - if ( 'give_forms' === $post->post_type ) { |
|
513 | + if ('give_forms' === $post->post_type) { |
|
514 | 514 | //Shortcode column with select all input |
515 | - $shortcode = htmlentities( '[give_form id="' . $post->ID . '"]' ); |
|
516 | - echo '<div class="shortcode-wrap box-sizing"><label>' . __( 'Give Form Shortcode:', 'give' ) . '</label><input onClick="this.setSelectionRange(0, this.value.length)" type="text" class="shortcode-input" readonly value="' . $shortcode . '"></div>'; |
|
515 | + $shortcode = htmlentities('[give_form id="'.$post->ID.'"]'); |
|
516 | + echo '<div class="shortcode-wrap box-sizing"><label>'.__('Give Form Shortcode:', 'give').'</label><input onClick="this.setSelectionRange(0, this.value.length)" type="text" class="shortcode-input" readonly value="'.$shortcode.'"></div>'; |
|
517 | 517 | |
518 | 518 | } |
519 | 519 | |
520 | 520 | } |
521 | 521 | |
522 | -add_action( 'post_submitbox_misc_actions', 'give_add_shortcode_to_publish_metabox' ); |
|
522 | +add_action('post_submitbox_misc_actions', 'give_add_shortcode_to_publish_metabox'); |
@@ -49,26 +49,26 @@ discard block |
||
49 | 49 | */ |
50 | 50 | public function __construct() { |
51 | 51 | |
52 | - add_action( 'admin_init', array( $this, 'init' ) ); |
|
52 | + add_action('admin_init', array($this, 'init')); |
|
53 | 53 | |
54 | 54 | //Customize CMB2 URL |
55 | - add_filter( 'cmb2_meta_box_url', array( $this, 'give_update_cmb_meta_box_url' ) ); |
|
55 | + add_filter('cmb2_meta_box_url', array($this, 'give_update_cmb_meta_box_url')); |
|
56 | 56 | |
57 | 57 | //Custom CMB2 Settings Fields |
58 | - add_action( 'cmb2_render_give_title', 'give_title_callback', 10, 5 ); |
|
59 | - add_action( 'cmb2_render_give_description', 'give_description_callback', 10, 5 ); |
|
60 | - add_action( 'cmb2_render_enabled_gateways', 'give_enabled_gateways_callback', 10, 5 ); |
|
61 | - add_action( 'cmb2_render_default_gateway', 'give_default_gateway_callback', 10, 5 ); |
|
62 | - add_action( 'cmb2_render_email_preview_buttons', 'give_email_preview_buttons_callback', 10, 5 ); |
|
63 | - add_action( 'cmb2_render_system_info', 'give_system_info_callback', 10, 5 ); |
|
64 | - add_action( 'cmb2_render_api', 'give_api_callback', 10, 5 ); |
|
65 | - add_action( 'cmb2_render_license_key', 'give_license_key_callback', 10, 5 ); |
|
66 | - add_action( 'admin_notices', array( $this, 'settings_notices' ) ); |
|
58 | + add_action('cmb2_render_give_title', 'give_title_callback', 10, 5); |
|
59 | + add_action('cmb2_render_give_description', 'give_description_callback', 10, 5); |
|
60 | + add_action('cmb2_render_enabled_gateways', 'give_enabled_gateways_callback', 10, 5); |
|
61 | + add_action('cmb2_render_default_gateway', 'give_default_gateway_callback', 10, 5); |
|
62 | + add_action('cmb2_render_email_preview_buttons', 'give_email_preview_buttons_callback', 10, 5); |
|
63 | + add_action('cmb2_render_system_info', 'give_system_info_callback', 10, 5); |
|
64 | + add_action('cmb2_render_api', 'give_api_callback', 10, 5); |
|
65 | + add_action('cmb2_render_license_key', 'give_license_key_callback', 10, 5); |
|
66 | + add_action('admin_notices', array($this, 'settings_notices')); |
|
67 | 67 | |
68 | 68 | // Include CMB CSS in the head to avoid FOUC |
69 | - add_action( 'admin_print_styles-give_forms_page_give-settings', array( 'CMB2_hookup', 'enqueue_cmb_css' ) ); |
|
69 | + add_action('admin_print_styles-give_forms_page_give-settings', array('CMB2_hookup', 'enqueue_cmb_css')); |
|
70 | 70 | |
71 | - add_filter( 'cmb2_get_metabox_form_format', array( $this, 'give_modify_cmb2_form_output' ), 10, 3 ); |
|
71 | + add_filter('cmb2_get_metabox_form_format', array($this, 'give_modify_cmb2_form_output'), 10, 3); |
|
72 | 72 | |
73 | 73 | } |
74 | 74 | |
@@ -78,7 +78,7 @@ discard block |
||
78 | 78 | * @since 1.0 |
79 | 79 | */ |
80 | 80 | public function init() { |
81 | - register_setting( $this->key, $this->key ); |
|
81 | + register_setting($this->key, $this->key); |
|
82 | 82 | |
83 | 83 | } |
84 | 84 | |
@@ -92,9 +92,9 @@ discard block |
||
92 | 92 | * |
93 | 93 | * @return mixed |
94 | 94 | */ |
95 | - public function give_update_cmb_meta_box_url( $url ) { |
|
95 | + public function give_update_cmb_meta_box_url($url) { |
|
96 | 96 | //Path to Give's CMB |
97 | - return GIVE_PLUGIN_URL . '/includes/libraries/cmb2'; |
|
97 | + return GIVE_PLUGIN_URL.'/includes/libraries/cmb2'; |
|
98 | 98 | } |
99 | 99 | |
100 | 100 | |
@@ -106,27 +106,27 @@ discard block |
||
106 | 106 | */ |
107 | 107 | public function give_get_settings_tabs() { |
108 | 108 | |
109 | - $settings = $this->give_settings( null ); |
|
109 | + $settings = $this->give_settings(null); |
|
110 | 110 | |
111 | 111 | $tabs = array(); |
112 | - $tabs['general'] = __( 'General', 'give' ); |
|
113 | - $tabs['gateways'] = __( 'Payment Gateways', 'give' ); |
|
114 | - $tabs['display'] = __( 'Display Options', 'give' ); |
|
115 | - $tabs['emails'] = __( 'Emails', 'give' ); |
|
112 | + $tabs['general'] = __('General', 'give'); |
|
113 | + $tabs['gateways'] = __('Payment Gateways', 'give'); |
|
114 | + $tabs['display'] = __('Display Options', 'give'); |
|
115 | + $tabs['emails'] = __('Emails', 'give'); |
|
116 | 116 | |
117 | - if ( ! empty( $settings['addons']['fields'] ) ) { |
|
118 | - $tabs['addons'] = __( 'Add-ons', 'give' ); |
|
117 | + if ( ! empty($settings['addons']['fields'])) { |
|
118 | + $tabs['addons'] = __('Add-ons', 'give'); |
|
119 | 119 | } |
120 | 120 | |
121 | - if ( ! empty( $settings['licenses']['fields'] ) ) { |
|
122 | - $tabs['licenses'] = __( 'Licenses', 'give' ); |
|
121 | + if ( ! empty($settings['licenses']['fields'])) { |
|
122 | + $tabs['licenses'] = __('Licenses', 'give'); |
|
123 | 123 | } |
124 | 124 | |
125 | - $tabs['advanced'] = __( 'Advanced', 'give' ); |
|
126 | - $tabs['api'] = __( 'API', 'give' ); |
|
127 | - $tabs['system_info'] = __( 'System Info', 'give' ); |
|
125 | + $tabs['advanced'] = __('Advanced', 'give'); |
|
126 | + $tabs['api'] = __('API', 'give'); |
|
127 | + $tabs['system_info'] = __('System Info', 'give'); |
|
128 | 128 | |
129 | - return apply_filters( 'give_settings_tabs', $tabs ); |
|
129 | + return apply_filters('give_settings_tabs', $tabs); |
|
130 | 130 | } |
131 | 131 | |
132 | 132 | |
@@ -136,7 +136,7 @@ discard block |
||
136 | 136 | */ |
137 | 137 | public function admin_page_display() { |
138 | 138 | |
139 | - $active_tab = isset( $_GET['tab'] ) && array_key_exists( $_GET['tab'], $this->give_get_settings_tabs() ) ? $_GET['tab'] : 'general'; |
|
139 | + $active_tab = isset($_GET['tab']) && array_key_exists($_GET['tab'], $this->give_get_settings_tabs()) ? $_GET['tab'] : 'general'; |
|
140 | 140 | |
141 | 141 | ?> |
142 | 142 | |
@@ -144,20 +144,20 @@ discard block |
||
144 | 144 | |
145 | 145 | <h1 class="nav-tab-wrapper"> |
146 | 146 | <?php |
147 | - foreach ( $this->give_get_settings_tabs() as $tab_id => $tab_name ) { |
|
147 | + foreach ($this->give_get_settings_tabs() as $tab_id => $tab_name) { |
|
148 | 148 | |
149 | 149 | //Support legacy tab creation conditions based off $_GET parameter |
150 | 150 | //We pass the $_GET['tab'] to conditions executed later |
151 | 151 | $_GET['tab'] = $tab_id; |
152 | 152 | |
153 | - $tab_url = esc_url( add_query_arg( array( |
|
153 | + $tab_url = esc_url(add_query_arg(array( |
|
154 | 154 | 'settings-updated' => false, |
155 | 155 | 'tab' => $tab_id |
156 | - ) ) ); |
|
156 | + ))); |
|
157 | 157 | |
158 | - $active = $active_tab == $tab_id ? ' nav-tab-active' : ''; |
|
158 | + $active = $active_tab == $tab_id ? ' nav-tab-active' : ''; |
|
159 | 159 | |
160 | - echo '<a href="' . esc_url( $tab_url ) . '" title="' . esc_attr( $tab_name ) . '" class="nav-tab' . $active . '" id="tab-' . $tab_id . '">' . esc_html( $tab_name ) . '</a>'; |
|
160 | + echo '<a href="'.esc_url($tab_url).'" title="'.esc_attr($tab_name).'" class="nav-tab'.$active.'" id="tab-'.$tab_id.'">'.esc_html($tab_name).'</a>'; |
|
161 | 161 | |
162 | 162 | } |
163 | 163 | ?> |
@@ -165,20 +165,20 @@ discard block |
||
165 | 165 | |
166 | 166 | <?php |
167 | 167 | //Loop through and output settings |
168 | - foreach ( $this->give_get_settings_tabs() as $tab_id => $tab_name ) { |
|
168 | + foreach ($this->give_get_settings_tabs() as $tab_id => $tab_name) { |
|
169 | 169 | |
170 | 170 | //Support legacy tab creation conditions based off $_GET parameter |
171 | 171 | //We 'trick' the conditions into thinking this is the tab |
172 | 172 | $_GET['tab'] = $tab_id; |
173 | 173 | |
174 | - $tab_settings = $this->give_settings( $tab_id ); |
|
174 | + $tab_settings = $this->give_settings($tab_id); |
|
175 | 175 | |
176 | 176 | //Pass active tab within $tab_settings so we can hide with CSS via PHP |
177 | - if ( $active_tab == $tab_id ) { |
|
177 | + if ($active_tab == $tab_id) { |
|
178 | 178 | $tab_settings['active_tab'] = true; |
179 | 179 | } |
180 | 180 | |
181 | - cmb2_metabox_form( $tab_settings, $this->key ); |
|
181 | + cmb2_metabox_form($tab_settings, $this->key); |
|
182 | 182 | |
183 | 183 | } ?> |
184 | 184 | |
@@ -196,34 +196,34 @@ discard block |
||
196 | 196 | * @since 1.5 Modified to CSS hide non-active tabs |
197 | 197 | * @since 1.0 |
198 | 198 | */ |
199 | - function give_modify_cmb2_form_output( $form_format, $object_id, $cmb ) { |
|
199 | + function give_modify_cmb2_form_output($form_format, $object_id, $cmb) { |
|
200 | 200 | |
201 | 201 | |
202 | - $pagenow = isset( $_GET['page'] ) ? $_GET['page'] : ''; |
|
202 | + $pagenow = isset($_GET['page']) ? $_GET['page'] : ''; |
|
203 | 203 | |
204 | 204 | //only modify the give settings form |
205 | - if ( 'give_settings' == $object_id && $pagenow == 'give-settings' ) { |
|
205 | + if ('give_settings' == $object_id && $pagenow == 'give-settings') { |
|
206 | 206 | |
207 | 207 | $style = ''; |
208 | - if ( ! isset( $cmb->meta_box['active_tab'] ) ) { |
|
208 | + if ( ! isset($cmb->meta_box['active_tab'])) { |
|
209 | 209 | $style = 'style="display:none;"'; |
210 | 210 | } |
211 | 211 | |
212 | 212 | //Set ID based off tab name - protects backwards compatibility |
213 | - $tab_id = isset( $_GET['tab'] ) ? $_GET['tab'] : $cmb->meta_box['id']; |
|
213 | + $tab_id = isset($_GET['tab']) ? $_GET['tab'] : $cmb->meta_box['id']; |
|
214 | 214 | |
215 | - $save_button = apply_filters( 'give_save_button_markup', '<div class="give-submit-wrap"><input type="submit" name="submit-cmb" value="' . __( 'Save Settings', 'give' ) . '" class="button-primary"></div>' ); |
|
215 | + $save_button = apply_filters('give_save_button_markup', '<div class="give-submit-wrap"><input type="submit" name="submit-cmb" value="'.__('Save Settings', 'give').'" class="button-primary"></div>'); |
|
216 | 216 | |
217 | 217 | //Filter so some tabs won't have save settings |
218 | - $no_save_button = apply_filters( 'give_settings_no_save_output', array( |
|
218 | + $no_save_button = apply_filters('give_settings_no_save_output', array( |
|
219 | 219 | 'system_info' |
220 | - ) ); |
|
220 | + )); |
|
221 | 221 | |
222 | - if ( in_array( $tab_id, $no_save_button ) ) { |
|
222 | + if (in_array($tab_id, $no_save_button)) { |
|
223 | 223 | $save_button = ''; |
224 | 224 | } |
225 | 225 | |
226 | - $form_format = '<form class="cmb-form" method="post" id="%1$s" enctype="multipart/form-data" encoding="multipart/form-data" ' . $style . ' data-tab="' . $tab_id . '"><input type="hidden" name="give_settings_saved" value="true"><input type="hidden" name="object_id" value="%2$s">%3$s' . $save_button . '</form>'; |
|
226 | + $form_format = '<form class="cmb-form" method="post" id="%1$s" enctype="multipart/form-data" encoding="multipart/form-data" '.$style.' data-tab="'.$tab_id.'"><input type="hidden" name="give_settings_saved" value="true"><input type="hidden" name="object_id" value="%2$s">%3$s'.$save_button.'</form>'; |
|
227 | 227 | |
228 | 228 | } |
229 | 229 | |
@@ -240,7 +240,7 @@ discard block |
||
240 | 240 | * |
241 | 241 | * @return array |
242 | 242 | */ |
243 | - public function give_settings( $active_tab ) { |
|
243 | + public function give_settings($active_tab) { |
|
244 | 244 | |
245 | 245 | $give_settings = array( |
246 | 246 | /** |
@@ -248,60 +248,60 @@ discard block |
||
248 | 248 | */ |
249 | 249 | 'general' => array( |
250 | 250 | 'id' => 'general_settings', |
251 | - 'give_title' => __( 'General Settings', 'give' ), |
|
252 | - 'show_on' => array( 'key' => 'options-page', 'value' => array( $this->key, ), ), |
|
253 | - 'fields' => apply_filters( 'give_settings_general', array( |
|
251 | + 'give_title' => __('General Settings', 'give'), |
|
252 | + 'show_on' => array('key' => 'options-page', 'value' => array($this->key,),), |
|
253 | + 'fields' => apply_filters('give_settings_general', array( |
|
254 | 254 | array( |
255 | - 'name' => __( 'General Settings', 'give' ), |
|
255 | + 'name' => __('General Settings', 'give'), |
|
256 | 256 | 'desc' => '', |
257 | 257 | 'type' => 'give_title', |
258 | 258 | 'id' => 'give_title_general_settings_1' |
259 | 259 | ), |
260 | 260 | array( |
261 | - 'name' => __( 'Success Page', 'give' ), |
|
262 | - 'desc' => sprintf( __( 'This is the page donors are sent to after completing their donations. The %1$s[give_receipt]%2$s shortcode should be on this page.', 'give' ), '<code>', '</code>' ), |
|
261 | + 'name' => __('Success Page', 'give'), |
|
262 | + 'desc' => sprintf(__('This is the page donors are sent to after completing their donations. The %1$s[give_receipt]%2$s shortcode should be on this page.', 'give'), '<code>', '</code>'), |
|
263 | 263 | 'id' => 'success_page', |
264 | 264 | 'type' => 'select', |
265 | - 'options' => give_cmb2_get_post_options( array( |
|
265 | + 'options' => give_cmb2_get_post_options(array( |
|
266 | 266 | 'post_type' => 'page', |
267 | - 'numberposts' => - 1 |
|
268 | - ) ), |
|
267 | + 'numberposts' => -1 |
|
268 | + )), |
|
269 | 269 | ), |
270 | 270 | array( |
271 | - 'name' => __( 'Failed Transaction Page', 'give' ), |
|
272 | - 'desc' => __( 'This is the page donors are sent to if their transaction is cancelled or fails.', 'give' ), |
|
271 | + 'name' => __('Failed Transaction Page', 'give'), |
|
272 | + 'desc' => __('This is the page donors are sent to if their transaction is cancelled or fails.', 'give'), |
|
273 | 273 | 'id' => 'failure_page', |
274 | 274 | 'type' => 'select', |
275 | - 'options' => give_cmb2_get_post_options( array( |
|
275 | + 'options' => give_cmb2_get_post_options(array( |
|
276 | 276 | 'post_type' => 'page', |
277 | - 'numberposts' => - 1 |
|
278 | - ) ), |
|
277 | + 'numberposts' => -1 |
|
278 | + )), |
|
279 | 279 | ), |
280 | 280 | array( |
281 | - 'name' => __( 'Donation History Page', 'give' ), |
|
282 | - 'desc' => sprintf( __( 'This page shows a complete donation history for the current user. The %1$s[donation_history]%2$s shortcode should be on this page.', 'give' ), '<code>', '</code>' ), |
|
281 | + 'name' => __('Donation History Page', 'give'), |
|
282 | + 'desc' => sprintf(__('This page shows a complete donation history for the current user. The %1$s[donation_history]%2$s shortcode should be on this page.', 'give'), '<code>', '</code>'), |
|
283 | 283 | 'id' => 'history_page', |
284 | 284 | 'type' => 'select', |
285 | - 'options' => give_cmb2_get_post_options( array( |
|
285 | + 'options' => give_cmb2_get_post_options(array( |
|
286 | 286 | 'post_type' => 'page', |
287 | - 'numberposts' => - 1 |
|
288 | - ) ), |
|
287 | + 'numberposts' => -1 |
|
288 | + )), |
|
289 | 289 | ), |
290 | 290 | array( |
291 | - 'name' => __( 'Base Country', 'give' ), |
|
292 | - 'desc' => __( 'Where does your site operate from?', 'give' ), |
|
291 | + 'name' => __('Base Country', 'give'), |
|
292 | + 'desc' => __('Where does your site operate from?', 'give'), |
|
293 | 293 | 'id' => 'base_country', |
294 | 294 | 'type' => 'select', |
295 | 295 | 'options' => give_get_country_list(), |
296 | 296 | ), |
297 | 297 | array( |
298 | - 'name' => __( 'Currency Settings', 'give' ), |
|
298 | + 'name' => __('Currency Settings', 'give'), |
|
299 | 299 | 'desc' => '', |
300 | 300 | 'type' => 'give_title', |
301 | 301 | 'id' => 'give_title_general_settings_2' |
302 | 302 | ), |
303 | 303 | array( |
304 | - 'name' => __( 'Currency', 'give' ), |
|
304 | + 'name' => __('Currency', 'give'), |
|
305 | 305 | 'desc' => 'Choose your currency. Note that some payment gateways have currency restrictions.', |
306 | 306 | 'id' => 'currency', |
307 | 307 | 'type' => 'select', |
@@ -309,26 +309,26 @@ discard block |
||
309 | 309 | 'default' => 'USD', |
310 | 310 | ), |
311 | 311 | array( |
312 | - 'name' => __( 'Currency Position', 'give' ), |
|
312 | + 'name' => __('Currency Position', 'give'), |
|
313 | 313 | 'desc' => 'Choose the position of the currency sign.', |
314 | 314 | 'id' => 'currency_position', |
315 | 315 | 'type' => 'select', |
316 | 316 | 'options' => array( |
317 | - 'before' => sprintf( __( 'Before - %1$s10', 'give' ), give_currency_symbol( give_get_currency() ) ), |
|
318 | - 'after' => sprintf( __( 'After - 10%1$s', 'give' ), give_currency_symbol( give_get_currency() ) ) |
|
317 | + 'before' => sprintf(__('Before - %1$s10', 'give'), give_currency_symbol(give_get_currency())), |
|
318 | + 'after' => sprintf(__('After - 10%1$s', 'give'), give_currency_symbol(give_get_currency())) |
|
319 | 319 | ), |
320 | 320 | 'default' => 'before', |
321 | 321 | ), |
322 | 322 | array( |
323 | - 'name' => __( 'Thousands Separator', 'give' ), |
|
324 | - 'desc' => __( 'The symbol (typically , or .) to separate thousands', 'give' ), |
|
323 | + 'name' => __('Thousands Separator', 'give'), |
|
324 | + 'desc' => __('The symbol (typically , or .) to separate thousands', 'give'), |
|
325 | 325 | 'id' => 'thousands_separator', |
326 | 326 | 'type' => 'text_small', |
327 | 327 | 'default' => ',', |
328 | 328 | ), |
329 | 329 | array( |
330 | - 'name' => __( 'Decimal Separator', 'give' ), |
|
331 | - 'desc' => __( 'The symbol (usually , or .) to separate decimal points', 'give' ), |
|
330 | + 'name' => __('Decimal Separator', 'give'), |
|
331 | + 'desc' => __('The symbol (usually , or .) to separate decimal points', 'give'), |
|
332 | 332 | 'id' => 'decimal_separator', |
333 | 333 | 'type' => 'text_small', |
334 | 334 | 'default' => '.', |
@@ -341,83 +341,83 @@ discard block |
||
341 | 341 | */ |
342 | 342 | 'gateways' => array( |
343 | 343 | 'id' => 'payment_gateways', |
344 | - 'give_title' => __( 'Payment Gateways', 'give' ), |
|
345 | - 'show_on' => array( 'key' => 'options-page', 'value' => array( $this->key, ), ), |
|
346 | - 'fields' => apply_filters( 'give_settings_gateways', array( |
|
344 | + 'give_title' => __('Payment Gateways', 'give'), |
|
345 | + 'show_on' => array('key' => 'options-page', 'value' => array($this->key,),), |
|
346 | + 'fields' => apply_filters('give_settings_gateways', array( |
|
347 | 347 | array( |
348 | - 'name' => __( 'Gateways Settings', 'give' ), |
|
348 | + 'name' => __('Gateways Settings', 'give'), |
|
349 | 349 | 'desc' => '', |
350 | 350 | 'id' => 'give_title_gateway_settings_1', |
351 | 351 | 'type' => 'give_title' |
352 | 352 | ), |
353 | 353 | array( |
354 | - 'name' => __( 'Test Mode', 'give' ), |
|
355 | - 'desc' => __( 'While in test mode no live transactions are processed. To fully use test mode, you must have a sandbox (test) account for the payment gateway you are testing.', 'give' ), |
|
354 | + 'name' => __('Test Mode', 'give'), |
|
355 | + 'desc' => __('While in test mode no live transactions are processed. To fully use test mode, you must have a sandbox (test) account for the payment gateway you are testing.', 'give'), |
|
356 | 356 | 'id' => 'test_mode', |
357 | 357 | 'type' => 'checkbox' |
358 | 358 | ), |
359 | 359 | array( |
360 | - 'name' => __( 'Enabled Gateways', 'give' ), |
|
361 | - 'desc' => __( 'Choose the payment gateways you would like enabled. You can drag-and-drop payment gateways to reorder them.', 'give' ), |
|
360 | + 'name' => __('Enabled Gateways', 'give'), |
|
361 | + 'desc' => __('Choose the payment gateways you would like enabled. You can drag-and-drop payment gateways to reorder them.', 'give'), |
|
362 | 362 | 'id' => 'gateways', |
363 | 363 | 'type' => 'enabled_gateways' |
364 | 364 | ), |
365 | 365 | array( |
366 | - 'name' => __( 'Default Gateway', 'give' ), |
|
367 | - 'desc' => __( 'This is the gateway that will be selected by default.', 'give' ), |
|
366 | + 'name' => __('Default Gateway', 'give'), |
|
367 | + 'desc' => __('This is the gateway that will be selected by default.', 'give'), |
|
368 | 368 | 'id' => 'default_gateway', |
369 | 369 | 'type' => 'default_gateway' |
370 | 370 | ), |
371 | 371 | array( |
372 | - 'name' => __( 'PayPal Standard', 'give' ), |
|
372 | + 'name' => __('PayPal Standard', 'give'), |
|
373 | 373 | 'desc' => '', |
374 | 374 | 'type' => 'give_title', |
375 | 375 | 'id' => 'give_title_gateway_settings_2', |
376 | 376 | ), |
377 | 377 | array( |
378 | - 'name' => __( 'PayPal Email', 'give' ), |
|
379 | - 'desc' => __( 'Enter your PayPal account\'s email', 'give' ), |
|
378 | + 'name' => __('PayPal Email', 'give'), |
|
379 | + 'desc' => __('Enter your PayPal account\'s email', 'give'), |
|
380 | 380 | 'id' => 'paypal_email', |
381 | 381 | 'type' => 'text_email', |
382 | 382 | ), |
383 | 383 | array( |
384 | - 'name' => __( 'PayPal Page Style', 'give' ), |
|
385 | - 'desc' => __( 'Enter the name of the page style to use, or leave blank to use the default', 'give' ), |
|
384 | + 'name' => __('PayPal Page Style', 'give'), |
|
385 | + 'desc' => __('Enter the name of the page style to use, or leave blank to use the default', 'give'), |
|
386 | 386 | 'id' => 'paypal_page_style', |
387 | 387 | 'type' => 'text', |
388 | 388 | ), |
389 | 389 | array( |
390 | - 'name' => __( 'PayPal Transaction Type', 'give' ), |
|
391 | - 'desc' => __( 'Nonprofits must verify their status to withdraw donations they receive via PayPal. PayPal users that are not verified nonprofits must demonstrate how their donations will be used, once they raise more than $10,000. By default, Give transactions are sent to PayPal as donations. You may change the transaction type using this option if you feel you may not meet PayPal\'s donation requirements.', 'give' ), |
|
390 | + 'name' => __('PayPal Transaction Type', 'give'), |
|
391 | + 'desc' => __('Nonprofits must verify their status to withdraw donations they receive via PayPal. PayPal users that are not verified nonprofits must demonstrate how their donations will be used, once they raise more than $10,000. By default, Give transactions are sent to PayPal as donations. You may change the transaction type using this option if you feel you may not meet PayPal\'s donation requirements.', 'give'), |
|
392 | 392 | 'id' => 'paypal_button_type', |
393 | 393 | 'type' => 'radio_inline', |
394 | 394 | 'options' => array( |
395 | - 'donation' => __( 'Donation', 'give' ), |
|
396 | - 'standard' => __( 'Standard Transaction', 'give' ) |
|
395 | + 'donation' => __('Donation', 'give'), |
|
396 | + 'standard' => __('Standard Transaction', 'give') |
|
397 | 397 | ), |
398 | 398 | 'default' => 'donation', |
399 | 399 | ), |
400 | 400 | array( |
401 | - 'name' => __( 'Disable PayPal IPN Verification', 'give' ), |
|
402 | - 'desc' => __( 'If donations are not getting marked as complete, then check this box. This forces the site to use a slightly less secure method of verifying donations.', 'give' ), |
|
401 | + 'name' => __('Disable PayPal IPN Verification', 'give'), |
|
402 | + 'desc' => __('If donations are not getting marked as complete, then check this box. This forces the site to use a slightly less secure method of verifying donations.', 'give'), |
|
403 | 403 | 'id' => 'disable_paypal_verification', |
404 | 404 | 'type' => 'checkbox' |
405 | 405 | ), |
406 | 406 | array( |
407 | - 'name' => __( 'Offline Donations', 'give' ), |
|
407 | + 'name' => __('Offline Donations', 'give'), |
|
408 | 408 | 'desc' => '', |
409 | 409 | 'type' => 'give_title', |
410 | 410 | 'id' => 'give_title_gateway_settings_3', |
411 | 411 | ), |
412 | 412 | array( |
413 | - 'name' => __( 'Collect Billing Details', 'give' ), |
|
414 | - 'desc' => __( 'This option will enable the billing details section for offline donations. The fieldset will appear above the offline donation instructions. Note: You may customize this option per form as needed.', 'give' ), |
|
413 | + 'name' => __('Collect Billing Details', 'give'), |
|
414 | + 'desc' => __('This option will enable the billing details section for offline donations. The fieldset will appear above the offline donation instructions. Note: You may customize this option per form as needed.', 'give'), |
|
415 | 415 | 'id' => 'give_offline_donation_enable_billing_fields', |
416 | 416 | 'type' => 'checkbox' |
417 | 417 | ), |
418 | 418 | array( |
419 | - 'name' => __( 'Offline Donation Instructions', 'give' ), |
|
420 | - 'desc' => __( 'The following content will appear for all forms when the user selects the offline donation payment option. Note: You may customize the content per form as needed.', 'give' ), |
|
419 | + 'name' => __('Offline Donation Instructions', 'give'), |
|
420 | + 'desc' => __('The following content will appear for all forms when the user selects the offline donation payment option. Note: You may customize the content per form as needed.', 'give'), |
|
421 | 421 | 'id' => 'global_offline_donation_content', |
422 | 422 | 'default' => give_get_default_offline_donation_content(), |
423 | 423 | 'type' => 'wysiwyg', |
@@ -426,15 +426,15 @@ discard block |
||
426 | 426 | ) |
427 | 427 | ), |
428 | 428 | array( |
429 | - 'name' => __( 'Offline Donation Email Instructions Subject', 'give' ), |
|
430 | - 'desc' => __( 'Enter the subject line for the donation receipt email.', 'give' ), |
|
429 | + 'name' => __('Offline Donation Email Instructions Subject', 'give'), |
|
430 | + 'desc' => __('Enter the subject line for the donation receipt email.', 'give'), |
|
431 | 431 | 'id' => 'offline_donation_subject', |
432 | - 'default' => __( '{donation} - Offline Donation Instructions', 'give' ), |
|
432 | + 'default' => __('{donation} - Offline Donation Instructions', 'give'), |
|
433 | 433 | 'type' => 'text' |
434 | 434 | ), |
435 | 435 | array( |
436 | - 'name' => __( 'Offline Donation Email Instructions', 'give' ), |
|
437 | - 'desc' => __( 'Enter the instructions you want emailed to the donor after they have submitted the donation form. Most likely this would include important information like mailing address and who to make the check out to.', 'give' ), |
|
436 | + 'name' => __('Offline Donation Email Instructions', 'give'), |
|
437 | + 'desc' => __('Enter the instructions you want emailed to the donor after they have submitted the donation form. Most likely this would include important information like mailing address and who to make the check out to.', 'give'), |
|
438 | 438 | 'id' => 'global_offline_donation_email', |
439 | 439 | 'default' => give_get_default_offline_donation_email_content(), |
440 | 440 | 'type' => 'wysiwyg', |
@@ -448,93 +448,93 @@ discard block |
||
448 | 448 | /** Display Settings */ |
449 | 449 | 'display' => array( |
450 | 450 | 'id' => 'display_settings', |
451 | - 'give_title' => __( 'Display Settings', 'give' ), |
|
452 | - 'show_on' => array( 'key' => 'options-page', 'value' => array( $this->key, ), ), |
|
453 | - 'fields' => apply_filters( 'give_settings_display', array( |
|
451 | + 'give_title' => __('Display Settings', 'give'), |
|
452 | + 'show_on' => array('key' => 'options-page', 'value' => array($this->key,),), |
|
453 | + 'fields' => apply_filters('give_settings_display', array( |
|
454 | 454 | array( |
455 | - 'name' => __( 'Display Settings', 'give' ), |
|
455 | + 'name' => __('Display Settings', 'give'), |
|
456 | 456 | 'desc' => '', |
457 | 457 | 'id' => 'give_title_display_settings_1', |
458 | 458 | 'type' => 'give_title' |
459 | 459 | ), |
460 | 460 | array( |
461 | - 'name' => __( 'Disable CSS', 'give' ), |
|
462 | - 'desc' => __( 'Enable this option if you would like to disable all of Give\'s included CSS stylesheets.', 'give' ), |
|
461 | + 'name' => __('Disable CSS', 'give'), |
|
462 | + 'desc' => __('Enable this option if you would like to disable all of Give\'s included CSS stylesheets.', 'give'), |
|
463 | 463 | 'id' => 'disable_css', |
464 | 464 | 'type' => 'checkbox' |
465 | 465 | ), |
466 | 466 | array( |
467 | - 'name' => __( 'Enable Floating Labels', 'give' ), |
|
468 | - 'desc' => sprintf( esc_html__( 'Enable this option if you would like to enable %1$sfloating labels%2$s in Give\'s donation forms. %3$sBe aware that if you have the "Disable CSS" option enabled, you will need to style the floating labels yourself.', 'give' ), '<a href="' . esc_url( "http://bradfrost.com/blog/post/float-label-pattern/" ) . '" target="_blank">', '</a>', '<br />' ), |
|
467 | + 'name' => __('Enable Floating Labels', 'give'), |
|
468 | + 'desc' => sprintf(esc_html__('Enable this option if you would like to enable %1$sfloating labels%2$s in Give\'s donation forms. %3$sBe aware that if you have the "Disable CSS" option enabled, you will need to style the floating labels yourself.', 'give'), '<a href="'.esc_url("http://bradfrost.com/blog/post/float-label-pattern/").'" target="_blank">', '</a>', '<br />'), |
|
469 | 469 | 'id' => 'enable_floatlabels', |
470 | 470 | 'type' => 'checkbox' |
471 | 471 | ), |
472 | 472 | array( |
473 | - 'name' => __( 'Disable Welcome Screen', 'give' ), |
|
474 | - 'desc' => sprintf( esc_html__( 'Enable this option if you would like to disable the Give Welcome screen every time Give is activated and/or updated. You can always access the Welcome Screen %1$shere%2$s if you want in the future.', 'give' ), '<a href="' . esc_url( admin_url( 'index.php?page=give-about' ) ) . '">', '</a>' ), |
|
473 | + 'name' => __('Disable Welcome Screen', 'give'), |
|
474 | + 'desc' => sprintf(esc_html__('Enable this option if you would like to disable the Give Welcome screen every time Give is activated and/or updated. You can always access the Welcome Screen %1$shere%2$s if you want in the future.', 'give'), '<a href="'.esc_url(admin_url('index.php?page=give-about')).'">', '</a>'), |
|
475 | 475 | 'id' => 'disable_welcome', |
476 | 476 | 'type' => 'checkbox' |
477 | 477 | ), |
478 | 478 | array( |
479 | - 'name' => __( 'Post Types', 'give' ), |
|
479 | + 'name' => __('Post Types', 'give'), |
|
480 | 480 | 'desc' => '', |
481 | 481 | 'id' => 'give_title_display_settings_2', |
482 | 482 | 'type' => 'give_title' |
483 | 483 | ), |
484 | 484 | array( |
485 | - 'name' => __( 'Disable Form Single Views', 'give' ), |
|
486 | - 'desc' => __( 'By default, all forms have single views enabled which create a specific URL on your website for that form. This option disables the singular and archive views from being publicly viewable. Note: you will need to embed forms using a shortcode or widget if enabled.', 'give' ), |
|
485 | + 'name' => __('Disable Form Single Views', 'give'), |
|
486 | + 'desc' => __('By default, all forms have single views enabled which create a specific URL on your website for that form. This option disables the singular and archive views from being publicly viewable. Note: you will need to embed forms using a shortcode or widget if enabled.', 'give'), |
|
487 | 487 | 'id' => 'disable_forms_singular', |
488 | 488 | 'type' => 'checkbox' |
489 | 489 | ), |
490 | 490 | array( |
491 | - 'name' => __( 'Disable Form Archives', 'give' ), |
|
492 | - 'desc' => __( 'Archives pages list all the forms you have created. This option will disable only the form\'s archive page(s). The single form\'s view will remain in place. Note: you will need to refresh your permalinks after this option has been enabled.', 'give' ), |
|
491 | + 'name' => __('Disable Form Archives', 'give'), |
|
492 | + 'desc' => __('Archives pages list all the forms you have created. This option will disable only the form\'s archive page(s). The single form\'s view will remain in place. Note: you will need to refresh your permalinks after this option has been enabled.', 'give'), |
|
493 | 493 | 'id' => 'disable_forms_archives', |
494 | 494 | 'type' => 'checkbox' |
495 | 495 | ), |
496 | 496 | array( |
497 | - 'name' => __( 'Disable Form Excerpts', 'give' ), |
|
498 | - 'desc' => __( 'The excerpt is an optional summary or description of a donation form; in short, a summary as to why the user should give.', 'give' ), |
|
497 | + 'name' => __('Disable Form Excerpts', 'give'), |
|
498 | + 'desc' => __('The excerpt is an optional summary or description of a donation form; in short, a summary as to why the user should give.', 'give'), |
|
499 | 499 | 'id' => 'disable_forms_excerpt', |
500 | 500 | 'type' => 'checkbox' |
501 | 501 | ), |
502 | 502 | |
503 | 503 | array( |
504 | - 'name' => __( 'Featured Image Size', 'give' ), |
|
505 | - 'desc' => __( 'The Featured Image is an image that is chosen as the representative image for a donation form. Some themes may have custom featured image sizes. Please select the size you would like to display for your single donation forms\' featured image.', 'give' ), |
|
504 | + 'name' => __('Featured Image Size', 'give'), |
|
505 | + 'desc' => __('The Featured Image is an image that is chosen as the representative image for a donation form. Some themes may have custom featured image sizes. Please select the size you would like to display for your single donation forms\' featured image.', 'give'), |
|
506 | 506 | 'id' => 'featured_image_size', |
507 | 507 | 'type' => 'select', |
508 | 508 | 'default' => 'large', |
509 | 509 | 'options' => give_get_featured_image_sizes() |
510 | 510 | ), |
511 | 511 | array( |
512 | - 'name' => __( 'Disable Form Featured Image', 'give' ), |
|
513 | - 'desc' => __( 'If you do not wish to use the featured image functionality you can disable it using this option and it will not be displayed for single donation forms.', 'give' ), |
|
512 | + 'name' => __('Disable Form Featured Image', 'give'), |
|
513 | + 'desc' => __('If you do not wish to use the featured image functionality you can disable it using this option and it will not be displayed for single donation forms.', 'give'), |
|
514 | 514 | 'id' => 'disable_form_featured_img', |
515 | 515 | 'type' => 'checkbox' |
516 | 516 | ), |
517 | 517 | array( |
518 | - 'name' => __( 'Disable Single Form Sidebar', 'give' ), |
|
519 | - 'desc' => __( 'The sidebar allows you to add additional widget to the Give single form view. If you don\'t plan on using the sidebar you may disable it with this option.', 'give' ), |
|
518 | + 'name' => __('Disable Single Form Sidebar', 'give'), |
|
519 | + 'desc' => __('The sidebar allows you to add additional widget to the Give single form view. If you don\'t plan on using the sidebar you may disable it with this option.', 'give'), |
|
520 | 520 | 'id' => 'disable_form_sidebar', |
521 | 521 | 'type' => 'checkbox' |
522 | 522 | ), |
523 | 523 | array( |
524 | - 'name' => __( 'Taxonomies', 'give' ), |
|
524 | + 'name' => __('Taxonomies', 'give'), |
|
525 | 525 | 'desc' => '', |
526 | 526 | 'id' => 'give_title_display_settings_3', |
527 | 527 | 'type' => 'give_title' |
528 | 528 | ), |
529 | 529 | array( |
530 | - 'name' => __( 'Enable Form Categories', 'give' ), |
|
531 | - 'desc' => __( 'Check this option if you would like to categorize your donation forms. This option enables the form\'s category taxonomy.', 'give' ), |
|
530 | + 'name' => __('Enable Form Categories', 'give'), |
|
531 | + 'desc' => __('Check this option if you would like to categorize your donation forms. This option enables the form\'s category taxonomy.', 'give'), |
|
532 | 532 | 'id' => 'enable_categories', |
533 | 533 | 'type' => 'checkbox' |
534 | 534 | ), |
535 | 535 | array( |
536 | - 'name' => __( 'Enable Form Tags', 'give' ), |
|
537 | - 'desc' => __( 'Check this option if you would like to tag your donation forms. This option enables the form\'s tag taxonomy.', 'give' ), |
|
536 | + 'name' => __('Enable Form Tags', 'give'), |
|
537 | + 'desc' => __('Check this option if you would like to tag your donation forms. This option enables the form\'s tag taxonomy.', 'give'), |
|
538 | 538 | 'id' => 'enable_tags', |
539 | 539 | 'type' => 'checkbox' |
540 | 540 | ), |
@@ -547,93 +547,93 @@ discard block |
||
547 | 547 | */ |
548 | 548 | 'emails' => array( |
549 | 549 | 'id' => 'email_settings', |
550 | - 'give_title' => __( 'Email Settings', 'give' ), |
|
551 | - 'show_on' => array( 'key' => 'options-page', 'value' => array( $this->key, ), ), |
|
552 | - 'fields' => apply_filters( 'give_settings_emails', array( |
|
550 | + 'give_title' => __('Email Settings', 'give'), |
|
551 | + 'show_on' => array('key' => 'options-page', 'value' => array($this->key,),), |
|
552 | + 'fields' => apply_filters('give_settings_emails', array( |
|
553 | 553 | array( |
554 | - 'name' => __( 'Email Settings', 'give' ), |
|
554 | + 'name' => __('Email Settings', 'give'), |
|
555 | 555 | 'desc' => '', |
556 | 556 | 'id' => 'give_title_email_settings_1', |
557 | 557 | 'type' => 'give_title' |
558 | 558 | ), |
559 | 559 | array( |
560 | 560 | 'id' => 'email_template', |
561 | - 'name' => __( 'Email Template', 'give' ), |
|
562 | - 'desc' => __( 'Choose a template. Click "Save Changes" then "Preview Donation Receipt" to see the new template.', 'give' ), |
|
561 | + 'name' => __('Email Template', 'give'), |
|
562 | + 'desc' => __('Choose a template. Click "Save Changes" then "Preview Donation Receipt" to see the new template.', 'give'), |
|
563 | 563 | 'type' => 'select', |
564 | 564 | 'options' => give_get_email_templates() |
565 | 565 | ), |
566 | 566 | array( |
567 | 567 | 'id' => 'email_logo', |
568 | - 'name' => __( 'Logo', 'give' ), |
|
569 | - 'desc' => __( 'Upload or choose a logo to be displayed at the top of the donation receipt emails. Displayed on HTML emails only.', 'give' ), |
|
568 | + 'name' => __('Logo', 'give'), |
|
569 | + 'desc' => __('Upload or choose a logo to be displayed at the top of the donation receipt emails. Displayed on HTML emails only.', 'give'), |
|
570 | 570 | 'type' => 'file' |
571 | 571 | ), |
572 | 572 | array( |
573 | 573 | 'id' => 'from_name', |
574 | - 'name' => __( 'From Name', 'give' ), |
|
575 | - 'desc' => __( 'The name donation receipts are said to come from. This should probably be your site or shop name.', 'give' ), |
|
576 | - 'default' => get_bloginfo( 'name' ), |
|
574 | + 'name' => __('From Name', 'give'), |
|
575 | + 'desc' => __('The name donation receipts are said to come from. This should probably be your site or shop name.', 'give'), |
|
576 | + 'default' => get_bloginfo('name'), |
|
577 | 577 | 'type' => 'text' |
578 | 578 | ), |
579 | 579 | array( |
580 | 580 | 'id' => 'from_email', |
581 | - 'name' => __( 'From Email', 'give' ), |
|
582 | - 'desc' => __( 'Email to send donation receipts from. This will act as the "from" and "reply-to" address.', 'give' ), |
|
583 | - 'default' => get_bloginfo( 'admin_email' ), |
|
581 | + 'name' => __('From Email', 'give'), |
|
582 | + 'desc' => __('Email to send donation receipts from. This will act as the "from" and "reply-to" address.', 'give'), |
|
583 | + 'default' => get_bloginfo('admin_email'), |
|
584 | 584 | 'type' => 'text' |
585 | 585 | ), |
586 | 586 | array( |
587 | - 'name' => __( 'Donation Receipt', 'give' ), |
|
587 | + 'name' => __('Donation Receipt', 'give'), |
|
588 | 588 | 'desc' => '', |
589 | 589 | 'id' => 'give_title_email_settings_2', |
590 | 590 | 'type' => 'give_title' |
591 | 591 | ), |
592 | 592 | array( |
593 | 593 | 'id' => 'donation_subject', |
594 | - 'name' => __( 'Donation Email Subject', 'give' ), |
|
595 | - 'desc' => __( 'Enter the subject line for the donation receipt email', 'give' ), |
|
596 | - 'default' => __( 'Donation Receipt', 'give' ), |
|
594 | + 'name' => __('Donation Email Subject', 'give'), |
|
595 | + 'desc' => __('Enter the subject line for the donation receipt email', 'give'), |
|
596 | + 'default' => __('Donation Receipt', 'give'), |
|
597 | 597 | 'type' => 'text' |
598 | 598 | ), |
599 | 599 | array( |
600 | 600 | 'id' => 'donation_receipt', |
601 | - 'name' => __( 'Donation Receipt', 'give' ), |
|
602 | - 'desc' => __( 'Enter the email that is sent to users after completing a successful donation. HTML is accepted. Available template tags:', 'give' ) . '<br/>' . give_get_emails_tags_list(), |
|
601 | + 'name' => __('Donation Receipt', 'give'), |
|
602 | + 'desc' => __('Enter the email that is sent to users after completing a successful donation. HTML is accepted. Available template tags:', 'give').'<br/>'.give_get_emails_tags_list(), |
|
603 | 603 | 'type' => 'wysiwyg', |
604 | 604 | 'default' => give_get_default_donation_receipt_email() |
605 | 605 | ), |
606 | 606 | array( |
607 | - 'name' => __( 'New Donation Notification', 'give' ), |
|
607 | + 'name' => __('New Donation Notification', 'give'), |
|
608 | 608 | 'desc' => '', |
609 | 609 | 'id' => 'give_title_email_settings_3', |
610 | 610 | 'type' => 'give_title' |
611 | 611 | ), |
612 | 612 | array( |
613 | 613 | 'id' => 'donation_notification_subject', |
614 | - 'name' => __( 'Donation Notification Subject', 'give' ), |
|
615 | - 'desc' => __( 'Enter the subject line for the donation notification email', 'give' ), |
|
614 | + 'name' => __('Donation Notification Subject', 'give'), |
|
615 | + 'desc' => __('Enter the subject line for the donation notification email', 'give'), |
|
616 | 616 | 'type' => 'text', |
617 | - 'default' => __( 'New Donation - #{payment_id}', 'give' ) |
|
617 | + 'default' => __('New Donation - #{payment_id}', 'give') |
|
618 | 618 | ), |
619 | 619 | array( |
620 | 620 | 'id' => 'donation_notification', |
621 | - 'name' => __( 'Donation Notification', 'give' ), |
|
622 | - 'desc' => __( 'Enter the email that is sent to donation notification emails after completion of a donation. HTML is accepted. Available template tags:', 'give' ) . '<br/>' . give_get_emails_tags_list(), |
|
621 | + 'name' => __('Donation Notification', 'give'), |
|
622 | + 'desc' => __('Enter the email that is sent to donation notification emails after completion of a donation. HTML is accepted. Available template tags:', 'give').'<br/>'.give_get_emails_tags_list(), |
|
623 | 623 | 'type' => 'wysiwyg', |
624 | 624 | 'default' => give_get_default_donation_notification_email() |
625 | 625 | ), |
626 | 626 | array( |
627 | 627 | 'id' => 'admin_notice_emails', |
628 | - 'name' => __( 'Donation Notification Emails', 'give' ), |
|
629 | - 'desc' => sprintf( __( 'Enter the email address(es) that should receive a notification anytime a donation is made, please only enter %1$sone email address per line%2$s and not separated by commas.', 'give' ), '<span class="give-underline">', '</span>' ), |
|
628 | + 'name' => __('Donation Notification Emails', 'give'), |
|
629 | + 'desc' => sprintf(__('Enter the email address(es) that should receive a notification anytime a donation is made, please only enter %1$sone email address per line%2$s and not separated by commas.', 'give'), '<span class="give-underline">', '</span>'), |
|
630 | 630 | 'type' => 'textarea', |
631 | - 'default' => get_bloginfo( 'admin_email' ) |
|
631 | + 'default' => get_bloginfo('admin_email') |
|
632 | 632 | ), |
633 | 633 | array( |
634 | 634 | 'id' => 'disable_admin_notices', |
635 | - 'name' => __( 'Disable Admin Notifications', 'give' ), |
|
636 | - 'desc' => __( 'Check this box if you do not want to receive emails when new donations are made.', 'give' ), |
|
635 | + 'name' => __('Disable Admin Notifications', 'give'), |
|
636 | + 'desc' => __('Check this box if you do not want to receive emails when new donations are made.', 'give'), |
|
637 | 637 | 'type' => 'checkbox' |
638 | 638 | ) |
639 | 639 | ) |
@@ -642,96 +642,96 @@ discard block |
||
642 | 642 | /** Extension Settings */ |
643 | 643 | 'addons' => array( |
644 | 644 | 'id' => 'addons', |
645 | - 'give_title' => __( 'Give Add-ons Settings', 'give' ), |
|
646 | - 'show_on' => array( 'key' => 'options-page', 'value' => array( $this->key, ), ), |
|
647 | - 'fields' => apply_filters( 'give_settings_addons', array() |
|
645 | + 'give_title' => __('Give Add-ons Settings', 'give'), |
|
646 | + 'show_on' => array('key' => 'options-page', 'value' => array($this->key,),), |
|
647 | + 'fields' => apply_filters('give_settings_addons', array() |
|
648 | 648 | ) |
649 | 649 | ), |
650 | 650 | /** Licenses Settings */ |
651 | 651 | 'licenses' => array( |
652 | 652 | 'id' => 'licenses', |
653 | - 'give_title' => __( 'Give Licenses', 'give' ), |
|
654 | - 'show_on' => array( 'key' => 'options-page', 'value' => array( $this->key, ), ), |
|
655 | - 'fields' => apply_filters( 'give_settings_licenses', array() |
|
653 | + 'give_title' => __('Give Licenses', 'give'), |
|
654 | + 'show_on' => array('key' => 'options-page', 'value' => array($this->key,),), |
|
655 | + 'fields' => apply_filters('give_settings_licenses', array() |
|
656 | 656 | ) |
657 | 657 | ), |
658 | 658 | /** Advanced Options */ |
659 | 659 | 'advanced' => array( |
660 | 660 | 'id' => 'advanced_options', |
661 | - 'give_title' => __( 'Advanced Options', 'give' ), |
|
662 | - 'show_on' => array( 'key' => 'options-page', 'value' => array( $this->key, ), ), |
|
663 | - 'fields' => apply_filters( 'give_settings_advanced', array( |
|
661 | + 'give_title' => __('Advanced Options', 'give'), |
|
662 | + 'show_on' => array('key' => 'options-page', 'value' => array($this->key,),), |
|
663 | + 'fields' => apply_filters('give_settings_advanced', array( |
|
664 | 664 | array( |
665 | - 'name' => __( 'Access Control', 'give' ), |
|
665 | + 'name' => __('Access Control', 'give'), |
|
666 | 666 | 'desc' => '', |
667 | 667 | 'id' => 'give_title_session_control_1', |
668 | 668 | 'type' => 'give_title' |
669 | 669 | ), |
670 | 670 | array( |
671 | 671 | 'id' => 'session_lifetime', |
672 | - 'name' => __( 'Session Lifetime', 'give' ), |
|
673 | - 'desc' => __( 'Give will start a new session per user once they have donated. This option controls the lifetime a user\'s session is kept alive. An active session allows users to view donation receipts on your site without having to be logged in as long as they are using the same browser they used when donating.', 'give' ), |
|
672 | + 'name' => __('Session Lifetime', 'give'), |
|
673 | + 'desc' => __('Give will start a new session per user once they have donated. This option controls the lifetime a user\'s session is kept alive. An active session allows users to view donation receipts on your site without having to be logged in as long as they are using the same browser they used when donating.', 'give'), |
|
674 | 674 | 'type' => 'select', |
675 | 675 | 'options' => array( |
676 | - '86400' => __( '24 Hours', 'give' ), |
|
677 | - '172800' => __( '48 Hours', 'give' ), |
|
678 | - '259200' => __( '72 Hours', 'give' ), |
|
679 | - '604800' => __( '1 Week', 'give' ), |
|
676 | + '86400' => __('24 Hours', 'give'), |
|
677 | + '172800' => __('48 Hours', 'give'), |
|
678 | + '259200' => __('72 Hours', 'give'), |
|
679 | + '604800' => __('1 Week', 'give'), |
|
680 | 680 | ) |
681 | 681 | ), |
682 | 682 | array( |
683 | - 'name' => __( 'Email Access', 'give' ), |
|
684 | - 'desc' => __( 'Would you like your donors to be able to access their donation history using only email? Donors whose sessions have expired and do not have an account may still access their donation history via a temporary email access link.', 'give' ), |
|
683 | + 'name' => __('Email Access', 'give'), |
|
684 | + 'desc' => __('Would you like your donors to be able to access their donation history using only email? Donors whose sessions have expired and do not have an account may still access their donation history via a temporary email access link.', 'give'), |
|
685 | 685 | 'id' => 'email_access', |
686 | 686 | 'type' => 'checkbox', |
687 | 687 | ), |
688 | 688 | array( |
689 | 689 | 'id' => 'recaptcha_key', |
690 | - 'name' => __( 'reCAPTCHA Site Key', 'give' ), |
|
691 | - 'desc' => sprintf( __( 'If you would like to prevent spam on the email access form navigate to %1$sthe reCAPTCHA website%2$s and sign up for an API key. The reCAPTCHA uses Google\'s user-friendly single click verification method.', 'give' ), '<a href="https://www.google.com/recaptcha/" target="_blank">', '</a>' ), |
|
690 | + 'name' => __('reCAPTCHA Site Key', 'give'), |
|
691 | + 'desc' => sprintf(__('If you would like to prevent spam on the email access form navigate to %1$sthe reCAPTCHA website%2$s and sign up for an API key. The reCAPTCHA uses Google\'s user-friendly single click verification method.', 'give'), '<a href="https://www.google.com/recaptcha/" target="_blank">', '</a>'), |
|
692 | 692 | 'default' => '', |
693 | 693 | 'type' => 'text' |
694 | 694 | ), |
695 | 695 | array( |
696 | 696 | 'id' => 'recaptcha_secret', |
697 | - 'name' => __( 'reCAPTCHA Secret Key', 'give' ), |
|
698 | - 'desc' => __( 'Please paste the reCAPTCHA secret key here from your manage reCAPTCHA API Keys panel.', 'give' ), |
|
697 | + 'name' => __('reCAPTCHA Secret Key', 'give'), |
|
698 | + 'desc' => __('Please paste the reCAPTCHA secret key here from your manage reCAPTCHA API Keys panel.', 'give'), |
|
699 | 699 | 'default' => '', |
700 | 700 | 'type' => 'text' |
701 | 701 | ), |
702 | 702 | array( |
703 | - 'name' => __( 'Data Control', 'give' ), |
|
703 | + 'name' => __('Data Control', 'give'), |
|
704 | 704 | 'desc' => '', |
705 | 705 | 'id' => 'give_title_data_control_2', |
706 | 706 | 'type' => 'give_title' |
707 | 707 | ), |
708 | 708 | array( |
709 | - 'name' => __( 'Remove All Data on Uninstall?', 'give' ), |
|
710 | - 'desc' => __( 'Check this box if you would like Give to completely remove all of its data when the plugin is deleted.', 'give' ), |
|
709 | + 'name' => __('Remove All Data on Uninstall?', 'give'), |
|
710 | + 'desc' => __('Check this box if you would like Give to completely remove all of its data when the plugin is deleted.', 'give'), |
|
711 | 711 | 'id' => 'uninstall_on_delete', |
712 | 712 | 'type' => 'checkbox' |
713 | 713 | ), |
714 | 714 | array( |
715 | - 'name' => __( 'Filter Control', 'give' ), |
|
715 | + 'name' => __('Filter Control', 'give'), |
|
716 | 716 | 'desc' => '', |
717 | 717 | 'id' => 'give_title_filter_control', |
718 | 718 | 'type' => 'give_title' |
719 | 719 | ), |
720 | 720 | array( |
721 | - 'name' => __( 'Disable <code>the_content</code> filter', 'give' ), |
|
722 | - 'desc' => sprintf( __( 'If you are seeing extra social buttons, related posts, or other unwanted elements appearing within your forms then you can disable WordPress\' content filter. <a href="%s" target="_blank">Learn more</a> about the_content filter.', 'give' ), esc_url( 'https://codex.wordpress.org/Plugin_API/Filter_Reference/the_content' ) ), |
|
721 | + 'name' => __('Disable <code>the_content</code> filter', 'give'), |
|
722 | + 'desc' => sprintf(__('If you are seeing extra social buttons, related posts, or other unwanted elements appearing within your forms then you can disable WordPress\' content filter. <a href="%s" target="_blank">Learn more</a> about the_content filter.', 'give'), esc_url('https://codex.wordpress.org/Plugin_API/Filter_Reference/the_content')), |
|
723 | 723 | 'id' => 'disable_the_content_filter', |
724 | 724 | 'type' => 'checkbox' |
725 | 725 | ), |
726 | 726 | array( |
727 | - 'name' => __( 'Script Loading', 'give' ), |
|
727 | + 'name' => __('Script Loading', 'give'), |
|
728 | 728 | 'desc' => '', |
729 | 729 | 'id' => 'give_title_script_control', |
730 | 730 | 'type' => 'give_title' |
731 | 731 | ), |
732 | 732 | array( |
733 | - 'name' => __( 'Load Scripts in Footer?', 'give' ), |
|
734 | - 'desc' => __( 'Check this box if you would like Give to load all frontend JavaScript files in the footer.', 'give' ), |
|
733 | + 'name' => __('Load Scripts in Footer?', 'give'), |
|
734 | + 'desc' => __('Check this box if you would like Give to load all frontend JavaScript files in the footer.', 'give'), |
|
735 | 735 | 'id' => 'scripts_footer', |
736 | 736 | 'type' => 'checkbox' |
737 | 737 | ) |
@@ -741,13 +741,13 @@ discard block |
||
741 | 741 | /** API Settings */ |
742 | 742 | 'api' => array( |
743 | 743 | 'id' => 'api', |
744 | - 'give_title' => __( 'API', 'give' ), |
|
745 | - 'show_on' => array( 'key' => 'options-page', 'value' => array( $this->key, ), ), |
|
744 | + 'give_title' => __('API', 'give'), |
|
745 | + 'show_on' => array('key' => 'options-page', 'value' => array($this->key,),), |
|
746 | 746 | 'show_names' => false, // Hide field names on the left |
747 | - 'fields' => apply_filters( 'give_settings_system', array( |
|
747 | + 'fields' => apply_filters('give_settings_system', array( |
|
748 | 748 | array( |
749 | 749 | 'id' => 'api', |
750 | - 'name' => __( 'API', 'give' ), |
|
750 | + 'name' => __('API', 'give'), |
|
751 | 751 | 'type' => 'api' |
752 | 752 | ) |
753 | 753 | ) |
@@ -756,13 +756,13 @@ discard block |
||
756 | 756 | /** Licenses Settings */ |
757 | 757 | 'system_info' => array( |
758 | 758 | 'id' => 'system_info', |
759 | - 'give_title' => __( 'System Info', 'give' ), |
|
760 | - 'show_on' => array( 'key' => 'options-page', 'value' => array( $this->key, ), ), |
|
761 | - 'fields' => apply_filters( 'give_settings_system', array( |
|
759 | + 'give_title' => __('System Info', 'give'), |
|
760 | + 'show_on' => array('key' => 'options-page', 'value' => array($this->key,),), |
|
761 | + 'fields' => apply_filters('give_settings_system', array( |
|
762 | 762 | array( |
763 | 763 | 'id' => 'system_info', |
764 | - 'name' => __( 'System Info', 'give' ), |
|
765 | - 'desc' => __( 'Please copy and paste this information in your ticket when contacting support.', 'give' ), |
|
764 | + 'name' => __('System Info', 'give'), |
|
765 | + 'desc' => __('Please copy and paste this information in your ticket when contacting support.', 'give'), |
|
766 | 766 | 'type' => 'system_info' |
767 | 767 | ) |
768 | 768 | ) |
@@ -771,15 +771,15 @@ discard block |
||
771 | 771 | ); |
772 | 772 | |
773 | 773 | //Return all settings array if no active tab |
774 | - if ( $active_tab === null || ! isset( $give_settings[ $active_tab ] ) ) { |
|
774 | + if ($active_tab === null || ! isset($give_settings[$active_tab])) { |
|
775 | 775 | |
776 | - return apply_filters( 'give_registered_settings', $give_settings ); |
|
776 | + return apply_filters('give_registered_settings', $give_settings); |
|
777 | 777 | |
778 | 778 | } |
779 | 779 | |
780 | 780 | |
781 | 781 | // Add other tabs and settings fields as needed |
782 | - return apply_filters( 'give_registered_settings', $give_settings[ $active_tab ] ); |
|
782 | + return apply_filters('give_registered_settings', $give_settings[$active_tab]); |
|
783 | 783 | |
784 | 784 | } |
785 | 785 | |
@@ -788,11 +788,11 @@ discard block |
||
788 | 788 | */ |
789 | 789 | public function settings_notices() { |
790 | 790 | |
791 | - if ( ! isset( $_POST['give_settings_saved'] ) ) { |
|
791 | + if ( ! isset($_POST['give_settings_saved'])) { |
|
792 | 792 | return; |
793 | 793 | } |
794 | 794 | |
795 | - add_settings_error( 'give-notices', 'global-settings-updated', __( 'Settings updated.', 'give' ), 'updated' ); |
|
795 | + add_settings_error('give-notices', 'global-settings-updated', __('Settings updated.', 'give'), 'updated'); |
|
796 | 796 | |
797 | 797 | } |
798 | 798 | |
@@ -806,17 +806,17 @@ discard block |
||
806 | 806 | * |
807 | 807 | * @return mixed Field value or exception is thrown |
808 | 808 | */ |
809 | - public function __get( $field ) { |
|
809 | + public function __get($field) { |
|
810 | 810 | |
811 | 811 | // Allowed fields to retrieve |
812 | - if ( in_array( $field, array( 'key', 'fields', 'give_title', 'options_page' ), true ) ) { |
|
812 | + if (in_array($field, array('key', 'fields', 'give_title', 'options_page'), true)) { |
|
813 | 813 | return $this->{$field}; |
814 | 814 | } |
815 | - if ( 'option_metabox' === $field ) { |
|
815 | + if ('option_metabox' === $field) { |
|
816 | 816 | return $this->option_metabox(); |
817 | 817 | } |
818 | 818 | |
819 | - throw new Exception( 'Invalid property: ' . $field ); |
|
819 | + throw new Exception('Invalid property: '.$field); |
|
820 | 820 | } |
821 | 821 | |
822 | 822 | |
@@ -833,12 +833,12 @@ discard block |
||
833 | 833 | * |
834 | 834 | * @return mixed Option value |
835 | 835 | */ |
836 | -function give_get_option( $key = '', $default = false ) { |
|
836 | +function give_get_option($key = '', $default = false) { |
|
837 | 837 | global $give_options; |
838 | - $value = ! empty( $give_options[ $key ] ) ? $give_options[ $key ] : $default; |
|
839 | - $value = apply_filters( 'give_get_option', $value, $key, $default ); |
|
838 | + $value = ! empty($give_options[$key]) ? $give_options[$key] : $default; |
|
839 | + $value = apply_filters('give_get_option', $value, $key, $default); |
|
840 | 840 | |
841 | - return apply_filters( 'give_get_option_' . $key, $value, $key, $default ); |
|
841 | + return apply_filters('give_get_option_'.$key, $value, $key, $default); |
|
842 | 842 | } |
843 | 843 | |
844 | 844 | |
@@ -856,33 +856,33 @@ discard block |
||
856 | 856 | * |
857 | 857 | * @return boolean True if updated, false if not. |
858 | 858 | */ |
859 | -function give_update_option( $key = '', $value = false ) { |
|
859 | +function give_update_option($key = '', $value = false) { |
|
860 | 860 | |
861 | 861 | // If no key, exit |
862 | - if ( empty( $key ) ) { |
|
862 | + if (empty($key)) { |
|
863 | 863 | return false; |
864 | 864 | } |
865 | 865 | |
866 | - if ( empty( $value ) ) { |
|
867 | - $remove_option = give_delete_option( $key ); |
|
866 | + if (empty($value)) { |
|
867 | + $remove_option = give_delete_option($key); |
|
868 | 868 | |
869 | 869 | return $remove_option; |
870 | 870 | } |
871 | 871 | |
872 | 872 | // First let's grab the current settings |
873 | - $options = get_option( 'give_settings' ); |
|
873 | + $options = get_option('give_settings'); |
|
874 | 874 | |
875 | 875 | // Let's let devs alter that value coming in |
876 | - $value = apply_filters( 'give_update_option', $value, $key ); |
|
876 | + $value = apply_filters('give_update_option', $value, $key); |
|
877 | 877 | |
878 | 878 | // Next let's try to update the value |
879 | - $options[ $key ] = $value; |
|
880 | - $did_update = update_option( 'give_settings', $options ); |
|
879 | + $options[$key] = $value; |
|
880 | + $did_update = update_option('give_settings', $options); |
|
881 | 881 | |
882 | 882 | // If it updated, let's update the global variable |
883 | - if ( $did_update ) { |
|
883 | + if ($did_update) { |
|
884 | 884 | global $give_options; |
885 | - $give_options[ $key ] = $value; |
|
885 | + $give_options[$key] = $value; |
|
886 | 886 | } |
887 | 887 | |
888 | 888 | return $did_update; |
@@ -899,27 +899,27 @@ discard block |
||
899 | 899 | * |
900 | 900 | * @return boolean True if updated, false if not. |
901 | 901 | */ |
902 | -function give_delete_option( $key = '' ) { |
|
902 | +function give_delete_option($key = '') { |
|
903 | 903 | |
904 | 904 | // If no key, exit |
905 | - if ( empty( $key ) ) { |
|
905 | + if (empty($key)) { |
|
906 | 906 | return false; |
907 | 907 | } |
908 | 908 | |
909 | 909 | // First let's grab the current settings |
910 | - $options = get_option( 'give_settings' ); |
|
910 | + $options = get_option('give_settings'); |
|
911 | 911 | |
912 | 912 | // Next let's try to update the value |
913 | - if ( isset( $options[ $key ] ) ) { |
|
913 | + if (isset($options[$key])) { |
|
914 | 914 | |
915 | - unset( $options[ $key ] ); |
|
915 | + unset($options[$key]); |
|
916 | 916 | |
917 | 917 | } |
918 | 918 | |
919 | - $did_update = update_option( 'give_settings', $options ); |
|
919 | + $did_update = update_option('give_settings', $options); |
|
920 | 920 | |
921 | 921 | // If it updated, let's update the global variable |
922 | - if ( $did_update ) { |
|
922 | + if ($did_update) { |
|
923 | 923 | global $give_options; |
924 | 924 | $give_options = $options; |
925 | 925 | } |
@@ -938,9 +938,9 @@ discard block |
||
938 | 938 | */ |
939 | 939 | function give_get_settings() { |
940 | 940 | |
941 | - $settings = get_option( 'give_settings' ); |
|
941 | + $settings = get_option('give_settings'); |
|
942 | 942 | |
943 | - return (array) apply_filters( 'give_get_settings', $settings ); |
|
943 | + return (array) apply_filters('give_get_settings', $settings); |
|
944 | 944 | |
945 | 945 | } |
946 | 946 | |
@@ -958,25 +958,25 @@ discard block |
||
958 | 958 | * |
959 | 959 | * @return array |
960 | 960 | */ |
961 | -function give_settings_array_insert( $array, $position, $insert ) { |
|
962 | - if ( is_int( $position ) ) { |
|
963 | - array_splice( $array, $position, 0, $insert ); |
|
961 | +function give_settings_array_insert($array, $position, $insert) { |
|
962 | + if (is_int($position)) { |
|
963 | + array_splice($array, $position, 0, $insert); |
|
964 | 964 | } else { |
965 | 965 | |
966 | - foreach ( $array as $index => $subarray ) { |
|
967 | - if ( isset( $subarray['id'] ) && $subarray['id'] == $position ) { |
|
966 | + foreach ($array as $index => $subarray) { |
|
967 | + if (isset($subarray['id']) && $subarray['id'] == $position) { |
|
968 | 968 | $pos = $index; |
969 | 969 | } |
970 | 970 | } |
971 | 971 | |
972 | - if ( ! isset( $pos ) ) { |
|
972 | + if ( ! isset($pos)) { |
|
973 | 973 | return $array; |
974 | 974 | } |
975 | 975 | |
976 | 976 | $array = array_merge( |
977 | - array_slice( $array, 0, $pos ), |
|
977 | + array_slice($array, 0, $pos), |
|
978 | 978 | $insert, |
979 | - array_slice( $array, $pos ) |
|
979 | + array_slice($array, $pos) |
|
980 | 980 | ); |
981 | 981 | } |
982 | 982 | |
@@ -999,31 +999,31 @@ discard block |
||
999 | 999 | * |
1000 | 1000 | * @return void |
1001 | 1001 | */ |
1002 | -function give_enabled_gateways_callback( $field_object, $escaped_value, $object_id, $object_type, $field_type_object ) { |
|
1002 | +function give_enabled_gateways_callback($field_object, $escaped_value, $object_id, $object_type, $field_type_object) { |
|
1003 | 1003 | |
1004 | 1004 | $id = $field_type_object->field->args['id']; |
1005 | 1005 | $field_description = $field_type_object->field->args['desc']; |
1006 | - $gateways = give_get_ordered_payment_gateways( give_get_payment_gateways() ); |
|
1006 | + $gateways = give_get_ordered_payment_gateways(give_get_payment_gateways()); |
|
1007 | 1007 | |
1008 | 1008 | echo '<ul class="cmb2-checkbox-list cmb2-list">'; |
1009 | 1009 | |
1010 | - foreach ( $gateways as $key => $option ) : |
|
1010 | + foreach ($gateways as $key => $option) : |
|
1011 | 1011 | |
1012 | - if ( is_array( $escaped_value ) && array_key_exists( $key, $escaped_value ) ) { |
|
1012 | + if (is_array($escaped_value) && array_key_exists($key, $escaped_value)) { |
|
1013 | 1013 | $enabled = '1'; |
1014 | 1014 | } else { |
1015 | 1015 | $enabled = null; |
1016 | 1016 | } |
1017 | 1017 | |
1018 | - echo '<li><span class="give-drag-handle"><span class="dashicons dashicons-menu"></span></span><input name="' . $id . '[' . $key . ']" id="' . $id . '[' . $key . ']" type="checkbox" value="1" ' . checked( '1', $enabled, false ) . '/> '; |
|
1019 | - echo '<label for="' . $id . '[' . $key . ']">' . $option['admin_label'] . '</label></li>'; |
|
1018 | + echo '<li><span class="give-drag-handle"><span class="dashicons dashicons-menu"></span></span><input name="'.$id.'['.$key.']" id="'.$id.'['.$key.']" type="checkbox" value="1" '.checked('1', $enabled, false).'/> '; |
|
1019 | + echo '<label for="'.$id.'['.$key.']">'.$option['admin_label'].'</label></li>'; |
|
1020 | 1020 | |
1021 | 1021 | endforeach; |
1022 | 1022 | |
1023 | 1023 | echo '</ul>'; |
1024 | 1024 | |
1025 | - if ( $field_description ) { |
|
1026 | - echo '<p class="cmb2-metabox-description">' . $field_description . '</p>'; |
|
1025 | + if ($field_description) { |
|
1026 | + echo '<p class="cmb2-metabox-description">'.$field_description.'</p>'; |
|
1027 | 1027 | } |
1028 | 1028 | |
1029 | 1029 | } |
@@ -1039,31 +1039,31 @@ discard block |
||
1039 | 1039 | * |
1040 | 1040 | * @return void |
1041 | 1041 | */ |
1042 | -function give_default_gateway_callback( $field_object, $escaped_value, $object_id, $object_type, $field_type_object ) { |
|
1042 | +function give_default_gateway_callback($field_object, $escaped_value, $object_id, $object_type, $field_type_object) { |
|
1043 | 1043 | |
1044 | 1044 | $id = $field_type_object->field->args['id']; |
1045 | 1045 | $field_description = $field_type_object->field->args['desc']; |
1046 | 1046 | $gateways = give_get_enabled_payment_gateways(); |
1047 | 1047 | |
1048 | - echo '<select class="cmb2_select" name="' . $id . '" id="' . $id . '">'; |
|
1048 | + echo '<select class="cmb2_select" name="'.$id.'" id="'.$id.'">'; |
|
1049 | 1049 | |
1050 | 1050 | //Add a field to the Give Form admin single post view of this field |
1051 | - if ( $field_type_object->field->object_type === 'post' ) { |
|
1052 | - echo '<option value="global">' . __( 'Global Default', 'give' ) . '</option>'; |
|
1051 | + if ($field_type_object->field->object_type === 'post') { |
|
1052 | + echo '<option value="global">'.__('Global Default', 'give').'</option>'; |
|
1053 | 1053 | } |
1054 | 1054 | |
1055 | - foreach ( $gateways as $key => $option ) : |
|
1055 | + foreach ($gateways as $key => $option) : |
|
1056 | 1056 | |
1057 | - $selected = isset( $escaped_value ) ? selected( $key, $escaped_value, false ) : ''; |
|
1057 | + $selected = isset($escaped_value) ? selected($key, $escaped_value, false) : ''; |
|
1058 | 1058 | |
1059 | 1059 | |
1060 | - echo '<option value="' . esc_attr( $key ) . '"' . $selected . '>' . esc_html( $option['admin_label'] ) . '</option>'; |
|
1060 | + echo '<option value="'.esc_attr($key).'"'.$selected.'>'.esc_html($option['admin_label']).'</option>'; |
|
1061 | 1061 | |
1062 | 1062 | endforeach; |
1063 | 1063 | |
1064 | 1064 | echo '</select>'; |
1065 | 1065 | |
1066 | - echo '<p class="cmb2-metabox-description">' . $field_description . '</p>'; |
|
1066 | + echo '<p class="cmb2-metabox-description">'.$field_description.'</p>'; |
|
1067 | 1067 | |
1068 | 1068 | } |
1069 | 1069 | |
@@ -1078,13 +1078,13 @@ discard block |
||
1078 | 1078 | * |
1079 | 1079 | * @return void |
1080 | 1080 | */ |
1081 | -function give_title_callback( $field_object, $escaped_value, $object_id, $object_type, $field_type_object ) { |
|
1081 | +function give_title_callback($field_object, $escaped_value, $object_id, $object_type, $field_type_object) { |
|
1082 | 1082 | |
1083 | 1083 | $id = $field_type_object->field->args['id']; |
1084 | 1084 | $title = $field_type_object->field->args['name']; |
1085 | 1085 | $field_description = $field_type_object->field->args['desc']; |
1086 | 1086 | |
1087 | - echo '<hr>' . $field_description; |
|
1087 | + echo '<hr>'.$field_description; |
|
1088 | 1088 | |
1089 | 1089 | } |
1090 | 1090 | |
@@ -1099,7 +1099,7 @@ discard block |
||
1099 | 1099 | * |
1100 | 1100 | * @return void |
1101 | 1101 | */ |
1102 | -function give_description_callback( $field_object, $escaped_value, $object_id, $object_type, $field_type_object ) { |
|
1102 | +function give_description_callback($field_object, $escaped_value, $object_id, $object_type, $field_type_object) { |
|
1103 | 1103 | |
1104 | 1104 | $id = $field_type_object->field->args['id']; |
1105 | 1105 | $title = $field_type_object->field->args['name']; |
@@ -1119,25 +1119,25 @@ discard block |
||
1119 | 1119 | * @see: https://github.com/WebDevStudios/CMB2/wiki/Adding-your-own-field-types |
1120 | 1120 | * @return array An array of options that matches the CMB2 options array |
1121 | 1121 | */ |
1122 | -function give_cmb2_get_post_options( $query_args, $force = false ) { |
|
1122 | +function give_cmb2_get_post_options($query_args, $force = false) { |
|
1123 | 1123 | |
1124 | - $post_options = array( '' => '' ); // Blank option |
|
1124 | + $post_options = array('' => ''); // Blank option |
|
1125 | 1125 | |
1126 | - if ( ( ! isset( $_GET['page'] ) || 'give-settings' != $_GET['page'] ) && ! $force ) { |
|
1126 | + if (( ! isset($_GET['page']) || 'give-settings' != $_GET['page']) && ! $force) { |
|
1127 | 1127 | return $post_options; |
1128 | 1128 | } |
1129 | 1129 | |
1130 | - $args = wp_parse_args( $query_args, array( |
|
1130 | + $args = wp_parse_args($query_args, array( |
|
1131 | 1131 | 'post_type' => 'page', |
1132 | 1132 | 'numberposts' => 10, |
1133 | - ) ); |
|
1133 | + )); |
|
1134 | 1134 | |
1135 | - $posts = get_posts( $args ); |
|
1135 | + $posts = get_posts($args); |
|
1136 | 1136 | |
1137 | - if ( $posts ) { |
|
1138 | - foreach ( $posts as $post ) { |
|
1137 | + if ($posts) { |
|
1138 | + foreach ($posts as $post) { |
|
1139 | 1139 | |
1140 | - $post_options[ $post->ID ] = $post->post_title; |
|
1140 | + $post_options[$post->ID] = $post->post_title; |
|
1141 | 1141 | |
1142 | 1142 | } |
1143 | 1143 | } |
@@ -1157,17 +1157,17 @@ discard block |
||
1157 | 1157 | global $_wp_additional_image_sizes; |
1158 | 1158 | $sizes = array(); |
1159 | 1159 | |
1160 | - foreach ( get_intermediate_image_sizes() as $_size ) { |
|
1160 | + foreach (get_intermediate_image_sizes() as $_size) { |
|
1161 | 1161 | |
1162 | - if ( in_array( $_size, array( 'thumbnail', 'medium', 'medium_large', 'large' ) ) ) { |
|
1163 | - $sizes[ $_size ] = $_size . ' - ' . get_option( "{$_size}_size_w" ) . 'x' . get_option( "{$_size}_size_h" ); |
|
1164 | - } elseif ( isset( $_wp_additional_image_sizes[ $_size ] ) ) { |
|
1165 | - $sizes[ $_size ] = $_size . ' - ' . $_wp_additional_image_sizes[ $_size ]['width'] . 'x' . $_wp_additional_image_sizes[ $_size ]['height']; |
|
1162 | + if (in_array($_size, array('thumbnail', 'medium', 'medium_large', 'large'))) { |
|
1163 | + $sizes[$_size] = $_size.' - '.get_option("{$_size}_size_w").'x'.get_option("{$_size}_size_h"); |
|
1164 | + } elseif (isset($_wp_additional_image_sizes[$_size])) { |
|
1165 | + $sizes[$_size] = $_size.' - '.$_wp_additional_image_sizes[$_size]['width'].'x'.$_wp_additional_image_sizes[$_size]['height']; |
|
1166 | 1166 | } |
1167 | 1167 | |
1168 | 1168 | } |
1169 | 1169 | |
1170 | - return apply_filters( 'give_get_featured_image_sizes', $sizes ); |
|
1170 | + return apply_filters('give_get_featured_image_sizes', $sizes); |
|
1171 | 1171 | } |
1172 | 1172 | |
1173 | 1173 | |
@@ -1181,34 +1181,34 @@ discard block |
||
1181 | 1181 | * |
1182 | 1182 | * @return void |
1183 | 1183 | */ |
1184 | -function give_license_key_callback( $field_object, $escaped_value, $object_id, $object_type, $field_type_object ) { |
|
1184 | +function give_license_key_callback($field_object, $escaped_value, $object_id, $object_type, $field_type_object) { |
|
1185 | 1185 | |
1186 | 1186 | $id = $field_type_object->field->args['id']; |
1187 | 1187 | $field_description = $field_type_object->field->args['desc']; |
1188 | - $license_status = get_option( $field_type_object->field->args['options']['is_valid_license_option'] ); |
|
1188 | + $license_status = get_option($field_type_object->field->args['options']['is_valid_license_option']); |
|
1189 | 1189 | $field_classes = 'regular-text give-license-field'; |
1190 | - $type = empty( $escaped_value ) ? 'text' : 'password'; |
|
1190 | + $type = empty($escaped_value) ? 'text' : 'password'; |
|
1191 | 1191 | |
1192 | - if ( $license_status === 'valid' ) { |
|
1192 | + if ($license_status === 'valid') { |
|
1193 | 1193 | $field_classes .= ' give-license-active'; |
1194 | 1194 | } |
1195 | 1195 | |
1196 | - $html = $field_type_object->input( array( |
|
1196 | + $html = $field_type_object->input(array( |
|
1197 | 1197 | 'class' => $field_classes, |
1198 | 1198 | 'type' => $type |
1199 | - ) ); |
|
1199 | + )); |
|
1200 | 1200 | |
1201 | 1201 | //License is active so show deactivate button |
1202 | - if ( $license_status === 'valid' ) { |
|
1203 | - $html .= '<input type="submit" class="button-secondary give-license-deactivate" name="' . $id . '_deactivate" value="' . __( 'Deactivate License', 'give' ) . '"/>'; |
|
1202 | + if ($license_status === 'valid') { |
|
1203 | + $html .= '<input type="submit" class="button-secondary give-license-deactivate" name="'.$id.'_deactivate" value="'.__('Deactivate License', 'give').'"/>'; |
|
1204 | 1204 | } else { |
1205 | 1205 | //This license is not valid so delete it |
1206 | - give_delete_option( $id ); |
|
1206 | + give_delete_option($id); |
|
1207 | 1207 | } |
1208 | 1208 | |
1209 | - $html .= '<label for="give_settings[' . $id . ']"> ' . $field_description . '</label>'; |
|
1209 | + $html .= '<label for="give_settings['.$id.']"> '.$field_description.'</label>'; |
|
1210 | 1210 | |
1211 | - wp_nonce_field( $id . '-nonce', $id . '-nonce' ); |
|
1211 | + wp_nonce_field($id.'-nonce', $id.'-nonce'); |
|
1212 | 1212 | |
1213 | 1213 | echo $html; |
1214 | 1214 | } |
@@ -1222,13 +1222,13 @@ discard block |
||
1222 | 1222 | */ |
1223 | 1223 | function give_api_callback() { |
1224 | 1224 | |
1225 | - if ( ! current_user_can( 'manage_give_settings' ) ) { |
|
1225 | + if ( ! current_user_can('manage_give_settings')) { |
|
1226 | 1226 | return; |
1227 | 1227 | } |
1228 | 1228 | |
1229 | - do_action( 'give_tools_api_keys_before' ); |
|
1229 | + do_action('give_tools_api_keys_before'); |
|
1230 | 1230 | |
1231 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/class-api-keys-table.php'; |
|
1231 | + require_once GIVE_PLUGIN_DIR.'includes/admin/class-api-keys-table.php'; |
|
1232 | 1232 | |
1233 | 1233 | $api_keys_table = new Give_API_Keys_Table(); |
1234 | 1234 | $api_keys_table->prepare_items(); |
@@ -1236,7 +1236,7 @@ discard block |
||
1236 | 1236 | ?> |
1237 | 1237 | <p> |
1238 | 1238 | <?php printf( |
1239 | - __( 'API keys allow users to use the <a href="%s">Give REST API</a> to retrieve donation data in JSON or XML for external applications or devices, such as <a href="%s">Zapier</a>.', 'give' ), |
|
1239 | + __('API keys allow users to use the <a href="%s">Give REST API</a> to retrieve donation data in JSON or XML for external applications or devices, such as <a href="%s">Zapier</a>.', 'give'), |
|
1240 | 1240 | 'https://givewp.com/documentation/give-api-reference/', |
1241 | 1241 | 'https://givewp.com/addons/zapier/' |
1242 | 1242 | ); ?> |
@@ -1244,10 +1244,10 @@ discard block |
||
1244 | 1244 | |
1245 | 1245 | <?php |
1246 | 1246 | |
1247 | - do_action( 'give_tools_api_keys_after' ); |
|
1247 | + do_action('give_tools_api_keys_after'); |
|
1248 | 1248 | } |
1249 | 1249 | |
1250 | -add_action( 'give_settings_tab_api_keys', 'give_api_callback' ); |
|
1250 | +add_action('give_settings_tab_api_keys', 'give_api_callback'); |
|
1251 | 1251 | |
1252 | 1252 | /** |
1253 | 1253 | * Hook Callback |
@@ -1260,8 +1260,8 @@ discard block |
||
1260 | 1260 | * |
1261 | 1261 | * @return void |
1262 | 1262 | */ |
1263 | -function give_hook_callback( $args ) { |
|
1264 | - do_action( 'give_' . $args['id'] ); |
|
1263 | +function give_hook_callback($args) { |
|
1264 | + do_action('give_'.$args['id']); |
|
1265 | 1265 | } |
1266 | 1266 | |
1267 | 1267 | /** |
@@ -1271,10 +1271,10 @@ discard block |
||
1271 | 1271 | * |
1272 | 1272 | */ |
1273 | 1273 | |
1274 | -if ( file_exists( WP_PLUGIN_DIR . '/cmb2/init.php' ) && ! defined( 'CMB2_LOADED' ) ) { |
|
1275 | - require_once WP_PLUGIN_DIR . '/cmb2/init.php'; |
|
1276 | -} elseif ( file_exists( GIVE_PLUGIN_DIR . '/includes/libraries/cmb2/init.php' ) && ! defined( 'CMB2_LOADED' ) ) { |
|
1277 | - require_once GIVE_PLUGIN_DIR . '/includes/libraries/cmb2/init.php'; |
|
1278 | -} elseif ( file_exists( GIVE_PLUGIN_DIR . '/includes/libraries/CMB2/init.php' ) && ! defined( 'CMB2_LOADED' ) ) { |
|
1279 | - require_once GIVE_PLUGIN_DIR . '/includes/libraries/CMB2/init.php'; |
|
1274 | +if (file_exists(WP_PLUGIN_DIR.'/cmb2/init.php') && ! defined('CMB2_LOADED')) { |
|
1275 | + require_once WP_PLUGIN_DIR.'/cmb2/init.php'; |
|
1276 | +} elseif (file_exists(GIVE_PLUGIN_DIR.'/includes/libraries/cmb2/init.php') && ! defined('CMB2_LOADED')) { |
|
1277 | + require_once GIVE_PLUGIN_DIR.'/includes/libraries/cmb2/init.php'; |
|
1278 | +} elseif (file_exists(GIVE_PLUGIN_DIR.'/includes/libraries/CMB2/init.php') && ! defined('CMB2_LOADED')) { |
|
1279 | + require_once GIVE_PLUGIN_DIR.'/includes/libraries/CMB2/init.php'; |
|
1280 | 1280 | } |
1281 | 1281 | \ No newline at end of file |