@@ -7,44 +7,44 @@ discard block |
||
7 | 7 | * @version 1.0.19 |
8 | 8 | */ |
9 | 9 | |
10 | -defined( 'ABSPATH' ) || exit; |
|
10 | +defined('ABSPATH') || exit; |
|
11 | 11 | |
12 | 12 | // Make sure that the form is active. |
13 | -if ( ! $form->is_active() ) { |
|
13 | +if (!$form->is_active()) { |
|
14 | 14 | echo aui()->alert( |
15 | 15 | array( |
16 | 16 | 'type' => 'warning', |
17 | - 'content' => __( 'This payment form is no longer active', 'invoicing' ), |
|
17 | + 'content' => __('This payment form is no longer active', 'invoicing'), |
|
18 | 18 | ) |
19 | 19 | ); |
20 | 20 | return; |
21 | 21 | } |
22 | 22 | |
23 | 23 | // Fires before displaying a payment form. |
24 | -do_action( 'getpaid_before_payment_form', $form ); |
|
24 | +do_action('getpaid_before_payment_form', $form); |
|
25 | 25 | ?> |
26 | 26 | |
27 | -<form class='getpaid-payment-form getpaid-payment-form-<?php echo absint( $form->get_id() ); ?> bsui' method='POST' data-key='<?php echo uniqid('gpf'); ?>'> |
|
27 | +<form class='getpaid-payment-form getpaid-payment-form-<?php echo absint($form->get_id()); ?> bsui' method='POST' data-key='<?php echo uniqid('gpf'); ?>'> |
|
28 | 28 | |
29 | 29 | |
30 | 30 | <?php |
31 | 31 | |
32 | 32 | // Fires when printing the top of a payment form. |
33 | - do_action( 'getpaid_payment_form_top', $form ); |
|
33 | + do_action('getpaid_payment_form_top', $form); |
|
34 | 34 | |
35 | 35 | // And the optional invoice id. |
36 | - if ( ! empty( $form->invoice ) ) { |
|
37 | - echo getpaid_hidden_field( 'invoice_id', $form->invoice->get_id() ); |
|
36 | + if (!empty($form->invoice)) { |
|
37 | + echo getpaid_hidden_field('invoice_id', $form->invoice->get_id()); |
|
38 | 38 | } |
39 | 39 | |
40 | 40 | // We also want to include the form id. |
41 | - echo getpaid_hidden_field( 'form_id', $form->get_id() ); |
|
41 | + echo getpaid_hidden_field('form_id', $form->get_id()); |
|
42 | 42 | |
43 | 43 | // And an indication that this is a payment form submission. |
44 | - echo getpaid_hidden_field( 'getpaid_payment_form_submission', '1' ); |
|
44 | + echo getpaid_hidden_field('getpaid_payment_form_submission', '1'); |
|
45 | 45 | |
46 | 46 | // Fires before displaying payment form elements. |
47 | - do_action( 'getpaid_payment_form_before_elements', $form ); |
|
47 | + do_action('getpaid_payment_form_before_elements', $form); |
|
48 | 48 | |
49 | 49 | // Display the elements. |
50 | 50 | ?> |
@@ -52,13 +52,13 @@ discard block |
||
52 | 52 | <div class="row"> |
53 | 53 | <?php |
54 | 54 | |
55 | - foreach ( $form->get_elements() as $element ) { |
|
55 | + foreach ($form->get_elements() as $element) { |
|
56 | 56 | |
57 | - if ( isset( $element['type'] ) ) { |
|
58 | - $grid_class = esc_attr( getpaid_get_form_element_grid_class( $element ) ); |
|
57 | + if (isset($element['type'])) { |
|
58 | + $grid_class = esc_attr(getpaid_get_form_element_grid_class($element)); |
|
59 | 59 | echo "<div class='$grid_class'>"; |
60 | - do_action( 'getpaid_payment_form_element', $element, $form ); |
|
61 | - do_action( "getpaid_payment_form_element_{$element['type']}_template", $element, $form ); |
|
60 | + do_action('getpaid_payment_form_element', $element, $form); |
|
61 | + do_action("getpaid_payment_form_element_{$element['type']}_template", $element, $form); |
|
62 | 62 | echo "</div>"; |
63 | 63 | } |
64 | 64 | |
@@ -70,16 +70,16 @@ discard block |
||
70 | 70 | |
71 | 71 | <?php |
72 | 72 | // Fires after displaying payment form elements. |
73 | - do_action( 'getpaid_payment_form_after_elements', $form ); |
|
73 | + do_action('getpaid_payment_form_after_elements', $form); |
|
74 | 74 | |
75 | 75 | echo "<div class='getpaid-payment-form-errors alert alert-danger d-none'></div>"; |
76 | 76 | |
77 | - if ( wpinv_current_user_can_manage_invoicing() ) { |
|
77 | + if (wpinv_current_user_can_manage_invoicing()) { |
|
78 | 78 | |
79 | 79 | edit_post_link( |
80 | - __( 'Edit this form.', 'invoicing' ), |
|
80 | + __('Edit this form.', 'invoicing'), |
|
81 | 81 | '<small class="form-text text-muted">', |
82 | - ' ' . __( 'This is only visible to website administators.', 'invoicing' ) . '</small>', |
|
82 | + ' ' . __('This is only visible to website administators.', 'invoicing') . '</small>', |
|
83 | 83 | $form->get_id(), |
84 | 84 | 'text-danger' |
85 | 85 | ); |
@@ -94,4 +94,4 @@ discard block |
||
94 | 94 | <?php |
95 | 95 | |
96 | 96 | // Fires after displaying a payment form. |
97 | -do_action( 'getpaid_after_payment_form', $form ); |
|
97 | +do_action('getpaid_after_payment_form', $form); |
@@ -7,50 +7,50 @@ discard block |
||
7 | 7 | * @version 1.0.19 |
8 | 8 | */ |
9 | 9 | |
10 | -defined( 'ABSPATH' ) || exit; |
|
10 | +defined('ABSPATH') || exit; |
|
11 | 11 | |
12 | -if ( empty( $fields ) ) { |
|
12 | +if (empty($fields)) { |
|
13 | 13 | return; |
14 | 14 | } |
15 | 15 | |
16 | 16 | // Prepare the user's country. |
17 | -$country = is_user_logged_in() ? get_user_meta( get_current_user_id(), '_wpinv_country', true ) : ''; |
|
18 | -$country = empty( $country ) ? wpinv_get_default_country() : $country; |
|
17 | +$country = is_user_logged_in() ? get_user_meta(get_current_user_id(), '_wpinv_country', true) : ''; |
|
18 | +$country = empty($country) ? wpinv_get_default_country() : $country; |
|
19 | 19 | |
20 | 20 | // A prefix for all ids (so that a form can be included in the same page multiple times). |
21 | -$uniqid = uniqid( '_' ); |
|
21 | +$uniqid = uniqid('_'); |
|
22 | 22 | |
23 | 23 | echo "<div class='row'>"; |
24 | -foreach ( $fields as $address_field ) { |
|
24 | +foreach ($fields as $address_field) { |
|
25 | 25 | |
26 | 26 | // Skip if it is hidden. |
27 | - if ( empty( $address_field['visible'] ) ) { |
|
27 | + if (empty($address_field['visible'])) { |
|
28 | 28 | continue; |
29 | 29 | } |
30 | 30 | |
31 | - $wrap_class = getpaid_get_form_element_grid_class( $address_field ); |
|
32 | - $wrap_class = esc_attr( "$wrap_class getpaid-address-field-wrapper" ); |
|
33 | - $placeholder = empty( $address_field['placeholder'] ) ? '' : esc_attr( $address_field['placeholder'] ); |
|
34 | - $description = empty( $address_field['description'] ) ? '' : wp_kses_post( $address_field['description'] ); |
|
35 | - $value = is_user_logged_in() ? get_user_meta( get_current_user_id(), '_' . $address_field['name'], true ) : ''; |
|
36 | - $label = empty( $address_field['label'] ) ? '' : wp_kses_post( $address_field['label'] ); |
|
31 | + $wrap_class = getpaid_get_form_element_grid_class($address_field); |
|
32 | + $wrap_class = esc_attr("$wrap_class getpaid-address-field-wrapper"); |
|
33 | + $placeholder = empty($address_field['placeholder']) ? '' : esc_attr($address_field['placeholder']); |
|
34 | + $description = empty($address_field['description']) ? '' : wp_kses_post($address_field['description']); |
|
35 | + $value = is_user_logged_in() ? get_user_meta(get_current_user_id(), '_' . $address_field['name'], true) : ''; |
|
36 | + $label = empty($address_field['label']) ? '' : wp_kses_post($address_field['label']); |
|
37 | 37 | |
38 | - if ( ! empty( $address_field['required'] ) ) { |
|
38 | + if (!empty($address_field['required'])) { |
|
39 | 39 | $label .= "<span class='text-danger'> *</span>"; |
40 | 40 | } |
41 | 41 | |
42 | 42 | // Display the country. |
43 | - if ( 'wpinv_country' == $address_field['name'] ) { |
|
43 | + if ('wpinv_country' == $address_field['name']) { |
|
44 | 44 | |
45 | 45 | echo aui()->select( |
46 | 46 | array( |
47 | 47 | 'options' => wpinv_get_country_list(), |
48 | 48 | 'name' => 'wpinv_country', |
49 | 49 | 'id' => 'wpinv_country' . $uniqid, |
50 | - 'value' => sanitize_text_field( $country ), |
|
50 | + 'value' => sanitize_text_field($country), |
|
51 | 51 | 'placeholder' => $placeholder, |
52 | - 'required' => ! empty( $address_field['required'] ), |
|
53 | - 'label' => wp_kses_post( $label ), |
|
52 | + 'required' => !empty($address_field['required']), |
|
53 | + 'label' => wp_kses_post($label), |
|
54 | 54 | 'label_type' => 'vertical', |
55 | 55 | 'help_text' => $description, |
56 | 56 | 'class' => 'getpaid-address-field wpinv_country', |
@@ -63,39 +63,39 @@ discard block |
||
63 | 63 | } |
64 | 64 | |
65 | 65 | // Display the state. |
66 | - if ( 'wpinv_state' == $address_field['name'] ) { |
|
66 | + if ('wpinv_state' == $address_field['name']) { |
|
67 | 67 | |
68 | - if ( empty( $value ) ) { |
|
68 | + if (empty($value)) { |
|
69 | 69 | $value = wpinv_get_default_state(); |
70 | 70 | } |
71 | 71 | |
72 | - echo getpaid_get_states_select_markup ( |
|
72 | + echo getpaid_get_states_select_markup( |
|
73 | 73 | $country, |
74 | 74 | $value, |
75 | 75 | $placeholder, |
76 | 76 | $label, |
77 | 77 | $description, |
78 | - ! empty( $address_field['required'] ), |
|
78 | + !empty($address_field['required']), |
|
79 | 79 | $wrap_class |
80 | 80 | ); |
81 | 81 | |
82 | 82 | continue; |
83 | 83 | } |
84 | 84 | |
85 | - $key = str_replace( 'wpinv_', '', $address_field['name'] ); |
|
86 | - $key = esc_attr( str_replace( '_', '-', $key ) ); |
|
85 | + $key = str_replace('wpinv_', '', $address_field['name']); |
|
86 | + $key = esc_attr(str_replace('_', '-', $key)); |
|
87 | 87 | echo aui()->input( |
88 | 88 | array( |
89 | - 'name' => esc_attr( $address_field['name'] ), |
|
90 | - 'id' => esc_attr( $address_field['name'] ) . $uniqid, |
|
91 | - 'required' => ! empty( $address_field['required'] ), |
|
89 | + 'name' => esc_attr($address_field['name']), |
|
90 | + 'id' => esc_attr($address_field['name']) . $uniqid, |
|
91 | + 'required' => !empty($address_field['required']), |
|
92 | 92 | 'placeholder' => $placeholder, |
93 | - 'label' => wp_kses_post( $label ), |
|
93 | + 'label' => wp_kses_post($label), |
|
94 | 94 | 'label_type' => 'vertical', |
95 | 95 | 'help_text' => $description, |
96 | 96 | 'type' => 'text', |
97 | 97 | 'value' => $value, |
98 | - 'class' => 'getpaid-address-field ' . esc_attr( $address_field['name'] ), |
|
98 | + 'class' => 'getpaid-address-field ' . esc_attr($address_field['name']), |
|
99 | 99 | 'wrap_class' => "$wrap_class getpaid-address-field-wrapper__$key", |
100 | 100 | 'label_class' => 'getpaid-address-field-label getpaid-address-field-label__' . $key, |
101 | 101 | ) |