@@ -7,11 +7,11 @@ |
||
7 | 7 | * @version 1.0.19 |
8 | 8 | */ |
9 | 9 | |
10 | -defined( 'ABSPATH' ) || exit; |
|
10 | +defined('ABSPATH') || exit; |
|
11 | 11 | |
12 | -$heading_tag = isset( $element['level'] ) ? trim( sanitize_key( $element['level'] ) ) : 'h3'; |
|
13 | -$text = isset( $element['text'] ) ? trim( $element['text'] ) : ''; |
|
12 | +$heading_tag = isset($element['level']) ? trim(sanitize_key($element['level'])) : 'h3'; |
|
13 | +$text = isset($element['text']) ? trim($element['text']) : ''; |
|
14 | 14 | |
15 | -if ( ! empty( $text ) ) { |
|
16 | - echo wp_kses_post( "<$heading_tag>$text</$heading_tag>" ); |
|
15 | +if (!empty($text)) { |
|
16 | + echo wp_kses_post("<$heading_tag>$text</$heading_tag>"); |
|
17 | 17 | } |
@@ -7,33 +7,33 @@ discard block |
||
7 | 7 | * @version 1.0.19 |
8 | 8 | */ |
9 | 9 | |
10 | -defined( 'ABSPATH' ) || exit; |
|
11 | - |
|
12 | -$label = empty( $label ) ? '' : wp_kses_post( $label ); |
|
13 | -$label_class = sanitize_key( preg_replace( '/[^A-Za-z0-9_-]/', '-', $label ) ); |
|
14 | -$id = esc_attr( $id ); |
|
15 | -$_id = $id . uniqid( '_' ); |
|
16 | -$max_file_num = empty( $max_file_num ) ? 1 : absint( $max_file_num ); |
|
17 | -$file_types = empty( $file_types ) ? array( 'jpg|jpeg|jpe', 'gif', 'png' ) : $file_types; |
|
10 | +defined('ABSPATH') || exit; |
|
11 | + |
|
12 | +$label = empty($label) ? '' : wp_kses_post($label); |
|
13 | +$label_class = sanitize_key(preg_replace('/[^A-Za-z0-9_-]/', '-', $label)); |
|
14 | +$id = esc_attr($id); |
|
15 | +$_id = $id . uniqid('_'); |
|
16 | +$max_file_num = empty($max_file_num) ? 1 : absint($max_file_num); |
|
17 | +$file_types = empty($file_types) ? array('jpg|jpeg|jpe', 'gif', 'png') : $file_types; |
|
18 | 18 | $all_types = getpaid_get_allowed_mime_types(); |
19 | 19 | $types = array(); |
20 | 20 | $_types = array(); |
21 | 21 | |
22 | -foreach ( $file_types as $file_type ) { |
|
22 | +foreach ($file_types as $file_type) { |
|
23 | 23 | |
24 | - if ( isset( $all_types[ $file_type ] ) ) { |
|
25 | - $types[] = $all_types[ $file_type ]; |
|
26 | - $file_type = explode( '|', $file_type ); |
|
24 | + if (isset($all_types[$file_type])) { |
|
25 | + $types[] = $all_types[$file_type]; |
|
26 | + $file_type = explode('|', $file_type); |
|
27 | 27 | |
28 | - foreach ( $file_type as $type ) { |
|
29 | - $type = trim( $type ); |
|
28 | + foreach ($file_type as $type) { |
|
29 | + $type = trim($type); |
|
30 | 30 | $types[] = ".$type"; |
31 | 31 | $_types[] = $type; |
32 | 32 | } |
33 | 33 | } |
34 | 34 | } |
35 | 35 | |
36 | -if ( ! empty( $required ) ) { |
|
36 | +if (!empty($required)) { |
|
37 | 37 | $label .= "<span class='text-danger'> *</span>"; |
38 | 38 | } |
39 | 39 | |
@@ -41,16 +41,16 @@ discard block |
||
41 | 41 | |
42 | 42 | <label><span v-html="form_element.label"></span></label> |
43 | 43 | |
44 | -<div class="form-group <?php echo sanitize_html_class( $label_class ); ?>" data-name="<?php echo esc_attr( $id ); ?>" data-max="<?php echo esc_attr( $max_file_num ); ?>"> |
|
45 | - <label for="<?php echo esc_attr( $id ); ?>"><?php echo wp_kses_post( $label ); ?></label> |
|
46 | - <input type="file" class="sr-only getpaid-files-input" id="<?php echo esc_attr( $id ); ?>" accept="<?php echo esc_attr( implode( ', ', $types ) ); ?>" data-extensions="<?php echo esc_attr( wp_json_encode( $_types ) ); ?>" <?php echo $max_file_num == 1 ? '' : 'multiple="multiple"'; ?>> |
|
44 | +<div class="form-group <?php echo sanitize_html_class($label_class); ?>" data-name="<?php echo esc_attr($id); ?>" data-max="<?php echo esc_attr($max_file_num); ?>"> |
|
45 | + <label for="<?php echo esc_attr($id); ?>"><?php echo wp_kses_post($label); ?></label> |
|
46 | + <input type="file" class="sr-only getpaid-files-input" id="<?php echo esc_attr($id); ?>" accept="<?php echo esc_attr(implode(', ', $types)); ?>" data-extensions="<?php echo esc_attr(wp_json_encode($_types)); ?>" <?php echo $max_file_num == 1 ? '' : 'multiple="multiple"'; ?>> |
|
47 | 47 | |
48 | - <label for="<?php echo esc_attr( $id ); ?>" class="getpaid-file-upload-element d-flex w-100 flex-column align-items-center justify-content-center p-2 mb-2"> |
|
48 | + <label for="<?php echo esc_attr($id); ?>" class="getpaid-file-upload-element d-flex w-100 flex-column align-items-center justify-content-center p-2 mb-2"> |
|
49 | 49 | <div class="h5 text-dark"> |
50 | - <?php echo esc_html( _n( 'Drag your file to this area or click to upload', 'Drag files to this area or click to upload', $max_file_num, 'invoicing' ) ); ?> |
|
50 | + <?php echo esc_html(_n('Drag your file to this area or click to upload', 'Drag files to this area or click to upload', $max_file_num, 'invoicing')); ?> |
|
51 | 51 | </div> |
52 | - <?php if ( ! empty( $description ) ) : ?> |
|
53 | - <small class="form-text text-muted"><?php echo wp_kses_post( $description ); ?></small> |
|
52 | + <?php if (!empty($description)) : ?> |
|
53 | + <small class="form-text text-muted"><?php echo wp_kses_post($description); ?></small> |
|
54 | 54 | <?php endif; ?> |
55 | 55 | </label> |
56 | 56 | |
@@ -59,7 +59,7 @@ discard block |
||
59 | 59 | <div class="form-row mb-3 d-none getpaid-progress-template"> |
60 | 60 | |
61 | 61 | <div class="overflow-hidden text-nowrap col-7 col-sm-4"> |
62 | - <a href="" class="close float-none" title="<?php esc_attr_e( 'Remove File', 'invoicing' ); ?>">×<span class="sr-only"><?php esc_html_e( 'Close', 'invoicing' ); ?></span></a> |
|
62 | + <a href="" class="close float-none" title="<?php esc_attr_e('Remove File', 'invoicing'); ?>">×<span class="sr-only"><?php esc_html_e('Close', 'invoicing'); ?></span></a> |
|
63 | 63 | <i class="fa fa-file" aria-hidden="true"></i> <span class="getpaid-progress-file-name"></span> |
64 | 64 | </div> |
65 | 65 |
@@ -7,35 +7,35 @@ discard block |
||
7 | 7 | * @version 1.0.19 |
8 | 8 | */ |
9 | 9 | |
10 | -defined( 'ABSPATH' ) || exit; |
|
10 | +defined('ABSPATH') || exit; |
|
11 | 11 | |
12 | 12 | // Ensure that we have options. |
13 | -if ( empty( $options ) ) { |
|
13 | +if (empty($options)) { |
|
14 | 14 | return; |
15 | 15 | } |
16 | 16 | |
17 | 17 | // Prepare price options. |
18 | -$options = getpaid_convert_price_string_to_options( $options ); |
|
19 | -$keys = array_keys( $options ); |
|
20 | -$value = empty( $options ) ? '' : $keys[0]; |
|
18 | +$options = getpaid_convert_price_string_to_options($options); |
|
19 | +$keys = array_keys($options); |
|
20 | +$value = empty($options) ? '' : $keys[0]; |
|
21 | 21 | |
22 | 22 | // Prepare id. |
23 | -$id = esc_attr( $id ); |
|
23 | +$id = esc_attr($id); |
|
24 | 24 | |
25 | -$select_type = empty( $select_type ) ? 'select' : $select_type; |
|
25 | +$select_type = empty($select_type) ? 'select' : $select_type; |
|
26 | 26 | |
27 | 27 | // Item select; |
28 | -if ( $select_type == 'select' ) { |
|
28 | +if ($select_type == 'select') { |
|
29 | 29 | aui()->select( |
30 | 30 | array( |
31 | 31 | 'name' => $id, |
32 | - 'id' => $id . uniqid( '_' ), |
|
33 | - 'placeholder' => empty( $placeholder ) ? '' : esc_attr( $placeholder ), |
|
32 | + 'id' => $id . uniqid('_'), |
|
33 | + 'placeholder' => empty($placeholder) ? '' : esc_attr($placeholder), |
|
34 | 34 | 'value' => $value, |
35 | - 'label' => empty( $label ) ? '' : esc_html( $label ), |
|
35 | + 'label' => empty($label) ? '' : esc_html($label), |
|
36 | 36 | 'label_type' => 'vertical', |
37 | 37 | 'class' => 'getpaid-price-select-dropdown getpaid-refresh-on-change', |
38 | - 'help_text' => empty( $description ) ? '' : wp_kses_post( $description ), |
|
38 | + 'help_text' => empty($description) ? '' : wp_kses_post($description), |
|
39 | 39 | 'options' => $options, |
40 | 40 | ), |
41 | 41 | true |
@@ -44,18 +44,18 @@ discard block |
||
44 | 44 | } |
45 | 45 | |
46 | 46 | // Item radios; |
47 | -if ( $select_type == 'radios' ) { |
|
47 | +if ($select_type == 'radios') { |
|
48 | 48 | aui()->radio( |
49 | 49 | array( |
50 | - 'name' => esc_attr( $id ), |
|
51 | - 'id' => esc_attr( $id ) . uniqid( '_' ), |
|
52 | - 'label' => empty( $label ) ? '' : esc_html( $label ), |
|
50 | + 'name' => esc_attr($id), |
|
51 | + 'id' => esc_attr($id) . uniqid('_'), |
|
52 | + 'label' => empty($label) ? '' : esc_html($label), |
|
53 | 53 | 'label_type' => 'vertical', |
54 | 54 | 'class' => 'getpaid-price-select-radio getpaid-refresh-on-change w-100', |
55 | 55 | 'value' => $value, |
56 | 56 | 'inline' => false, |
57 | 57 | 'options' => $options, |
58 | - 'help_text' => empty( $description ) ? '' : wp_kses_post( $description ), |
|
58 | + 'help_text' => empty($description) ? '' : wp_kses_post($description), |
|
59 | 59 | ), |
60 | 60 | true |
61 | 61 | ); |
@@ -64,32 +64,32 @@ discard block |
||
64 | 64 | |
65 | 65 | |
66 | 66 | // Display the label. |
67 | -if ( ! empty( $label ) ) { |
|
68 | - echo '<label>' . esc_html( $label ) . '</label>'; |
|
67 | +if (!empty($label)) { |
|
68 | + echo '<label>' . esc_html($label) . '</label>'; |
|
69 | 69 | } |
70 | 70 | |
71 | 71 | // Item buttons; |
72 | -if ( $select_type == 'buttons' || $select_type == 'circles' ) { |
|
72 | +if ($select_type == 'buttons' || $select_type == 'circles') { |
|
73 | 73 | |
74 | 74 | $class = 'getpaid-price-buttons'; |
75 | 75 | |
76 | - if ( $select_type == 'circles' ) { |
|
76 | + if ($select_type == 'circles') { |
|
77 | 77 | $class .= ' getpaid-price-circles'; |
78 | 78 | } |
79 | - echo "<div class='" . esc_attr( $class ) . "'>"; |
|
79 | + echo "<div class='" . esc_attr($class) . "'>"; |
|
80 | 80 | |
81 | - foreach ( $options as $price => $label ) { |
|
82 | - $_id = $id . uniqid( '_' ); |
|
81 | + foreach ($options as $price => $label) { |
|
82 | + $_id = $id . uniqid('_'); |
|
83 | 83 | |
84 | 84 | $class = 'rounded'; |
85 | 85 | |
86 | - if ( $select_type == 'circles' ) { |
|
86 | + if ($select_type == 'circles') { |
|
87 | 87 | $class = ''; |
88 | 88 | } |
89 | 89 | echo " |
90 | 90 | <span class='d-inline-block'> |
91 | - <input type='radio' class='getpaid-price-select-button getpaid-refresh-on-change w-auto' id='" . esc_attr( $_id ) . "' value='" . esc_attr( $price ) . "' name='" . esc_attr( $id ) . "' " . checked( $price, $value, false ) . " /> |
|
92 | - <label for='" . esc_attr( $_id ) . "' class='" . esc_attr( $class ) . "'><span>" . esc_html( $label ) . '</span></label> |
|
91 | + <input type='radio' class='getpaid-price-select-button getpaid-refresh-on-change w-auto' id='" . esc_attr($_id) . "' value='" . esc_attr($price) . "' name='" . esc_attr($id) . "' " . checked($price, $value, false) . " /> |
|
92 | + <label for='" . esc_attr($_id) . "' class='" . esc_attr($class) . "'><span>" . esc_html($label) . '</span></label> |
|
93 | 93 | </span> |
94 | 94 | '; |
95 | 95 | } |
@@ -99,14 +99,14 @@ discard block |
||
99 | 99 | } |
100 | 100 | |
101 | 101 | // Item checkboxes; |
102 | -if ( $select_type == 'checkboxes' ) { |
|
102 | +if ($select_type == 'checkboxes') { |
|
103 | 103 | echo '<div class="form-group">'; |
104 | 104 | |
105 | - foreach ( $options as $price => $label ) { |
|
105 | + foreach ($options as $price => $label) { |
|
106 | 106 | echo " |
107 | 107 | <label class='d-block'> |
108 | - <input type='checkbox' class='getpaid-price-select-checkbox getpaid-refresh-on-change w-auto' name='" . esc_attr( $id ) . "[]' value='" . esc_attr( $price ) . "' " . checked( $price, $value, false ) . ' /> |
|
109 | - <span>' . esc_html( $label ) . '</span> |
|
108 | + <input type='checkbox' class='getpaid-price-select-checkbox getpaid-refresh-on-change w-auto' name='" . esc_attr($id) . "[]' value='" . esc_attr($price) . "' " . checked($price, $value, false) . ' /> |
|
109 | + <span>' . esc_html($label) . '</span> |
|
110 | 110 | </label> |
111 | 111 | '; |
112 | 112 | } |
@@ -115,6 +115,6 @@ discard block |
||
115 | 115 | |
116 | 116 | } |
117 | 117 | |
118 | -if ( ! empty( $description ) ) { |
|
119 | - echo "<small class='form-text text-muted'>" . wp_kses_post( $description ) . '</small>'; |
|
118 | +if (!empty($description)) { |
|
119 | + echo "<small class='form-text text-muted'>" . wp_kses_post($description) . '</small>'; |
|
120 | 120 | } |
@@ -12,75 +12,75 @@ discard block |
||
12 | 12 | * @var GetPaid_Payment_Form $form |
13 | 13 | */ |
14 | 14 | |
15 | -defined( 'ABSPATH' ) || exit; |
|
15 | +defined('ABSPATH') || exit; |
|
16 | 16 | |
17 | -$field_type = sanitize_key( $field_type ); |
|
17 | +$field_type = sanitize_key($field_type); |
|
18 | 18 | |
19 | -echo "<div class='row " . esc_attr( $field_type ) . "'>"; |
|
19 | +echo "<div class='row " . esc_attr($field_type) . "'>"; |
|
20 | 20 | |
21 | 21 | // Prepare current user. |
22 | -if ( ! empty( $form->invoice ) ) { |
|
22 | +if (!empty($form->invoice)) { |
|
23 | 23 | $user_id = $form->invoice->get_user_id(); |
24 | 24 | } |
25 | 25 | |
26 | -if ( empty( $user_id ) && is_user_logged_in() ) { |
|
26 | +if (empty($user_id) && is_user_logged_in()) { |
|
27 | 27 | $user_id = get_current_user_id(); |
28 | 28 | } |
29 | 29 | |
30 | -if ( ! empty( $user_id ) ) { |
|
31 | - $user = wp_get_current_user(); |
|
30 | +if (!empty($user_id)) { |
|
31 | + $user = wp_get_current_user(); |
|
32 | 32 | } |
33 | 33 | |
34 | -foreach ( $fields as $address_field ) { |
|
34 | +foreach ($fields as $address_field) { |
|
35 | 35 | |
36 | 36 | // Skip if it is hidden. |
37 | - if ( empty( $address_field['visible'] ) ) { |
|
37 | + if (empty($address_field['visible'])) { |
|
38 | 38 | continue; |
39 | 39 | } |
40 | 40 | |
41 | - do_action( 'getpaid_payment_form_address_field_before_' . $address_field['name'], $field_type, $address_field ); |
|
41 | + do_action('getpaid_payment_form_address_field_before_' . $address_field['name'], $field_type, $address_field); |
|
42 | 42 | |
43 | 43 | // Prepare variables. |
44 | 44 | $field_name = $address_field['name']; |
45 | 45 | $field_name = "{$field_type}[$field_name]"; |
46 | - $wrap_class = getpaid_get_form_element_grid_class( $address_field ); |
|
47 | - $wrap_class = esc_attr( "$wrap_class getpaid-address-field-wrapper" ); |
|
48 | - $placeholder = empty( $address_field['placeholder'] ) ? '' : esc_attr( $address_field['placeholder'] ); |
|
49 | - $description = empty( $address_field['description'] ) ? '' : wp_kses_post( $address_field['description'] ); |
|
50 | - $value = ! empty( $user_id ) ? get_user_meta( $user_id, '_' . $address_field['name'], true ) : ''; |
|
51 | - $label = empty( $address_field['label'] ) ? '' : wp_kses_post( $address_field['label'] ); |
|
52 | - |
|
53 | - $method_name = 'get_' . str_replace( 'wpinv_', '', $address_field['name'] ); |
|
54 | - if ( ! empty( $form->invoice ) && is_callable( array( $form->invoice, $method_name ) ) ) { |
|
55 | - $value = call_user_func( array( $form->invoice, $method_name ) ); |
|
46 | + $wrap_class = getpaid_get_form_element_grid_class($address_field); |
|
47 | + $wrap_class = esc_attr("$wrap_class getpaid-address-field-wrapper"); |
|
48 | + $placeholder = empty($address_field['placeholder']) ? '' : esc_attr($address_field['placeholder']); |
|
49 | + $description = empty($address_field['description']) ? '' : wp_kses_post($address_field['description']); |
|
50 | + $value = !empty($user_id) ? get_user_meta($user_id, '_' . $address_field['name'], true) : ''; |
|
51 | + $label = empty($address_field['label']) ? '' : wp_kses_post($address_field['label']); |
|
52 | + |
|
53 | + $method_name = 'get_' . str_replace('wpinv_', '', $address_field['name']); |
|
54 | + if (!empty($form->invoice) && is_callable(array($form->invoice, $method_name))) { |
|
55 | + $value = call_user_func(array($form->invoice, $method_name)); |
|
56 | 56 | } |
57 | 57 | |
58 | - if ( empty( $value ) && 'wpinv_first_name' == $address_field['name'] && ! empty( $user ) ) { |
|
58 | + if (empty($value) && 'wpinv_first_name' == $address_field['name'] && !empty($user)) { |
|
59 | 59 | $value = $user->first_name; |
60 | 60 | } |
61 | 61 | |
62 | - if ( empty( $value ) && 'wpinv_last_name' == $address_field['name'] && ! empty( $user ) ) { |
|
62 | + if (empty($value) && 'wpinv_last_name' == $address_field['name'] && !empty($user)) { |
|
63 | 63 | $value = $user->last_name; |
64 | 64 | } |
65 | 65 | |
66 | - if ( ! empty( $address_field['required'] ) ) { |
|
66 | + if (!empty($address_field['required'])) { |
|
67 | 67 | $label .= "<span class='text-danger'> *</span>"; |
68 | 68 | } |
69 | 69 | |
70 | 70 | // Display the country. |
71 | - if ( 'wpinv_country' == $address_field['name'] ) { |
|
71 | + if ('wpinv_country' == $address_field['name']) { |
|
72 | 72 | |
73 | - echo "<div class='form-group " . esc_attr( $wrap_class ) . " getpaid-address-field-wrapper__country'"; |
|
73 | + echo "<div class='form-group " . esc_attr($wrap_class) . " getpaid-address-field-wrapper__country'"; |
|
74 | 74 | |
75 | 75 | aui()->select( |
76 | 76 | array( |
77 | 77 | 'options' => wpinv_get_country_list(), |
78 | - 'name' => esc_attr( $field_name ), |
|
79 | - 'id' => sanitize_html_class( $field_name ) . $uniqid, |
|
80 | - 'value' => esc_attr( $country ), |
|
78 | + 'name' => esc_attr($field_name), |
|
79 | + 'id' => sanitize_html_class($field_name) . $uniqid, |
|
80 | + 'value' => esc_attr($country), |
|
81 | 81 | 'placeholder' => $placeholder, |
82 | - 'required' => ! empty( $address_field['required'] ), |
|
83 | - 'label' => wp_kses_post( $label ), |
|
82 | + 'required' => !empty($address_field['required']), |
|
83 | + 'label' => wp_kses_post($label), |
|
84 | 84 | 'label_type' => 'vertical', |
85 | 85 | 'help_text' => $description, |
86 | 86 | 'class' => 'getpaid-address-field wpinv_country', |
@@ -94,7 +94,7 @@ discard block |
||
94 | 94 | true |
95 | 95 | ); |
96 | 96 | |
97 | - if ( wpinv_should_validate_vat_number() ) { |
|
97 | + if (wpinv_should_validate_vat_number()) { |
|
98 | 98 | |
99 | 99 | aui()->input( |
100 | 100 | array( |
@@ -103,7 +103,7 @@ discard block |
||
103 | 103 | 'id' => "shipping-toggle$uniqid", |
104 | 104 | 'wrap_class' => 'getpaid-address-field-wrapper__address-confirm mt-1 d-none', |
105 | 105 | 'required' => false, |
106 | - 'label' => __( 'I certify that I live in the country selected above', 'invoicing' ) . "<span class='text-danger'> *</span>", |
|
106 | + 'label' => __('I certify that I live in the country selected above', 'invoicing') . "<span class='text-danger'> *</span>", |
|
107 | 107 | 'value' => 1, |
108 | 108 | 'checked' => true, |
109 | 109 | 'class' => 'w-auto', |
@@ -118,9 +118,9 @@ discard block |
||
118 | 118 | } |
119 | 119 | |
120 | 120 | // Display the state. |
121 | - elseif ( 'wpinv_state' == $address_field['name'] ) { |
|
121 | + elseif ('wpinv_state' == $address_field['name']) { |
|
122 | 122 | |
123 | - if ( empty( $value ) ) { |
|
123 | + if (empty($value)) { |
|
124 | 124 | $value = wpinv_get_default_state(); |
125 | 125 | } |
126 | 126 | |
@@ -130,7 +130,7 @@ discard block |
||
130 | 130 | $placeholder, |
131 | 131 | $label, |
132 | 132 | $description, |
133 | - ! empty( $address_field['required'] ), |
|
133 | + !empty($address_field['required']), |
|
134 | 134 | $wrap_class, |
135 | 135 | $field_name, |
136 | 136 | true |
@@ -138,8 +138,8 @@ discard block |
||
138 | 138 | |
139 | 139 | } else { |
140 | 140 | |
141 | - $key = str_replace( 'wpinv_', '', $address_field['name'] ); |
|
142 | - $key = esc_attr( str_replace( '_', '-', $key ) ); |
|
141 | + $key = str_replace('wpinv_', '', $address_field['name']); |
|
142 | + $key = esc_attr(str_replace('_', '-', $key)); |
|
143 | 143 | $autocomplete = ''; |
144 | 144 | $replacements = array( |
145 | 145 | 'zip' => 'postal-code', |
@@ -152,37 +152,37 @@ discard block |
||
152 | 152 | ); |
153 | 153 | |
154 | 154 | |
155 | - if ( isset( $replacements[ $key ] ) ) { |
|
155 | + if (isset($replacements[$key])) { |
|
156 | 156 | $autocomplete = array( |
157 | - 'autocomplete' => "$field_type {$replacements[ $key ]}", |
|
157 | + 'autocomplete' => "$field_type {$replacements[$key]}", |
|
158 | 158 | ); |
159 | 159 | } |
160 | 160 | |
161 | 161 | $append = ''; |
162 | 162 | |
163 | - if ( 'billing' === $field_type && wpinv_should_validate_vat_number() && 'vat-number' === $key ) { |
|
164 | - $valid = esc_attr__( 'Valid', 'invoicing' ); |
|
165 | - $invalid = esc_attr__( 'Invalid', 'invoicing' ); |
|
166 | - $validate = esc_attr__( 'Validate', 'invoicing' ); |
|
163 | + if ('billing' === $field_type && wpinv_should_validate_vat_number() && 'vat-number' === $key) { |
|
164 | + $valid = esc_attr__('Valid', 'invoicing'); |
|
165 | + $invalid = esc_attr__('Invalid', 'invoicing'); |
|
166 | + $validate = esc_attr__('Validate', 'invoicing'); |
|
167 | 167 | $append = "<span class='btn btn-primary getpaid-vat-number-validate' data-valid='$valid' data-invalid='$invalid' data-validate='$validate'>$validate</span>"; |
168 | 168 | } |
169 | 169 | |
170 | - if ( 'billing' === $field_type ) { |
|
171 | - $description .= '<div class="getpaid-error-' . esc_attr( $field_name ) . ' getpaid-custom-payment-form-errors alert alert-danger d-none"></div>'; |
|
170 | + if ('billing' === $field_type) { |
|
171 | + $description .= '<div class="getpaid-error-' . esc_attr($field_name) . ' getpaid-custom-payment-form-errors alert alert-danger d-none"></div>'; |
|
172 | 172 | } |
173 | 173 | |
174 | 174 | aui()->input( |
175 | 175 | array( |
176 | - 'name' => esc_attr( $field_name ), |
|
177 | - 'id' => sanitize_html_class( $field_name ) . $uniqid, |
|
178 | - 'required' => ! empty( $address_field['required'] ), |
|
176 | + 'name' => esc_attr($field_name), |
|
177 | + 'id' => sanitize_html_class($field_name) . $uniqid, |
|
178 | + 'required' => !empty($address_field['required']), |
|
179 | 179 | 'placeholder' => $placeholder, |
180 | - 'label' => wp_kses_post( $label ), |
|
180 | + 'label' => wp_kses_post($label), |
|
181 | 181 | 'label_type' => 'vertical', |
182 | 182 | 'help_text' => $description, |
183 | 183 | 'type' => 'text', |
184 | - 'value' => esc_attr( $value ), |
|
185 | - 'class' => 'getpaid-address-field ' . esc_attr( $address_field['name'] ), |
|
184 | + 'value' => esc_attr($value), |
|
185 | + 'class' => 'getpaid-address-field ' . esc_attr($address_field['name']), |
|
186 | 186 | 'wrap_class' => "$wrap_class getpaid-address-field-wrapper__$key", |
187 | 187 | 'label_class' => 'getpaid-address-field-label getpaid-address-field-label__' . $key, |
188 | 188 | 'extra_attributes' => $autocomplete, |
@@ -193,7 +193,7 @@ discard block |
||
193 | 193 | |
194 | 194 | } |
195 | 195 | |
196 | - do_action( 'getpaid_payment_form_address_field_after_' . $address_field['name'], $field_type, $address_field ); |
|
196 | + do_action('getpaid_payment_form_address_field_after_' . $address_field['name'], $field_type, $address_field); |
|
197 | 197 | } |
198 | 198 | |
199 | 199 | echo '</div>'; |
@@ -7,35 +7,35 @@ discard block |
||
7 | 7 | * @version 1.0.19 |
8 | 8 | */ |
9 | 9 | |
10 | -defined( 'ABSPATH' ) || exit; |
|
10 | +defined('ABSPATH') || exit; |
|
11 | 11 | |
12 | 12 | $value = ''; |
13 | 13 | $class = ''; |
14 | 14 | |
15 | -if ( ! empty( $form->invoice ) ) { |
|
16 | - $value = sanitize_email( $form->invoice->get_email() ); |
|
17 | -} elseif ( is_user_logged_in() ) { |
|
15 | +if (!empty($form->invoice)) { |
|
16 | + $value = sanitize_email($form->invoice->get_email()); |
|
17 | +} elseif (is_user_logged_in()) { |
|
18 | 18 | $user = wp_get_current_user(); |
19 | - $value = sanitize_email( $user->user_email ); |
|
19 | + $value = sanitize_email($user->user_email); |
|
20 | 20 | } |
21 | 21 | |
22 | -if ( ! empty( $value ) && ! empty( $hide_billing_email ) ) { |
|
22 | +if (!empty($value) && !empty($hide_billing_email)) { |
|
23 | 23 | $class = 'd-none'; |
24 | 24 | } |
25 | 25 | |
26 | -do_action( 'getpaid_before_payment_form_billing_email', $form ); |
|
26 | +do_action('getpaid_before_payment_form_billing_email', $form); |
|
27 | 27 | |
28 | -echo "<span class='" . esc_attr( $class ) . "'>"; |
|
28 | +echo "<span class='" . esc_attr($class) . "'>"; |
|
29 | 29 | |
30 | 30 | aui()->input( |
31 | 31 | array( |
32 | 32 | 'name' => 'billing_email', |
33 | - 'id' => esc_attr( $id ) . uniqid( '_' ), |
|
34 | - 'placeholder' => empty( $placeholder ) ? '' : esc_attr( $placeholder ), |
|
35 | - 'required' => ! empty( $required ), |
|
36 | - 'label' => empty( $label ) ? '' : wp_kses_post( $label ) . '<span class="text-danger"> *</span>', |
|
33 | + 'id' => esc_attr($id) . uniqid('_'), |
|
34 | + 'placeholder' => empty($placeholder) ? '' : esc_attr($placeholder), |
|
35 | + 'required' => !empty($required), |
|
36 | + 'label' => empty($label) ? '' : wp_kses_post($label) . '<span class="text-danger"> *</span>', |
|
37 | 37 | 'label_type' => 'vertical', |
38 | - 'help_text' => empty( $description ) ? '' : wp_kses_post( $description ), |
|
38 | + 'help_text' => empty($description) ? '' : wp_kses_post($description), |
|
39 | 39 | 'type' => 'email', |
40 | 40 | 'value' => $value, |
41 | 41 | 'class' => 'wpinv_billing_email', |
@@ -48,4 +48,4 @@ discard block |
||
48 | 48 | |
49 | 49 | echo '</span>'; |
50 | 50 | |
51 | -do_action( 'getpaid_after_payment_form_billing_email', $form ); |
|
51 | +do_action('getpaid_after_payment_form_billing_email', $form); |
@@ -26,57 +26,57 @@ discard block |
||
26 | 26 | |
27 | 27 | <?php |
28 | 28 | |
29 | - // Fires before printing a line item column. |
|
30 | - do_action( "getpaid_form_cart_item_before_$key", $item, $form ); |
|
29 | + // Fires before printing a line item column. |
|
30 | + do_action( "getpaid_form_cart_item_before_$key", $item, $form ); |
|
31 | 31 | |
32 | - // Item name. |
|
33 | - if ( 'name' == $key ) { |
|
32 | + // Item name. |
|
33 | + if ( 'name' == $key ) { |
|
34 | 34 | |
35 | - ob_start(); |
|
36 | - // And an optional description. |
|
37 | - $description = $item->get_description(); |
|
35 | + ob_start(); |
|
36 | + // And an optional description. |
|
37 | + $description = $item->get_description(); |
|
38 | 38 | |
39 | - if ( ! empty( $description ) ) { |
|
40 | - echo "<small class='form-text text-muted pr-2 m-0'>" . wp_kses_post( $description ) . "</small>"; |
|
41 | - } |
|
39 | + if ( ! empty( $description ) ) { |
|
40 | + echo "<small class='form-text text-muted pr-2 m-0'>" . wp_kses_post( $description ) . "</small>"; |
|
41 | + } |
|
42 | 42 | |
43 | - // Price help text. |
|
44 | - $description = getpaid_item_recurring_price_help_text( $item, $currency ); |
|
45 | - if ( $description ) { |
|
46 | - echo "<small class='getpaid-form-item-price-desc form-text text-muted pr-2 m-0'>" . wp_kses_post( $description ) . "</small>"; |
|
47 | - } |
|
43 | + // Price help text. |
|
44 | + $description = getpaid_item_recurring_price_help_text( $item, $currency ); |
|
45 | + if ( $description ) { |
|
46 | + echo "<small class='getpaid-form-item-price-desc form-text text-muted pr-2 m-0'>" . wp_kses_post( $description ) . "</small>"; |
|
47 | + } |
|
48 | 48 | |
49 | - do_action( 'getpaid_payment_form_cart_item_description', $item, $form ); |
|
49 | + do_action( 'getpaid_payment_form_cart_item_description', $item, $form ); |
|
50 | 50 | |
51 | - if ( wpinv_current_user_can_manage_invoicing() ) { |
|
51 | + if ( wpinv_current_user_can_manage_invoicing() ) { |
|
52 | 52 | |
53 | - edit_post_link( |
|
54 | - __( 'Edit this item.', 'invoicing' ), |
|
55 | - '<small class="form-text text-muted">', |
|
56 | - '</small>', |
|
57 | - $item->get_id(), |
|
58 | - 'text-danger' |
|
59 | - ); |
|
53 | + edit_post_link( |
|
54 | + __( 'Edit this item.', 'invoicing' ), |
|
55 | + '<small class="form-text text-muted">', |
|
56 | + '</small>', |
|
57 | + $item->get_id(), |
|
58 | + 'text-danger' |
|
59 | + ); |
|
60 | 60 | |
61 | - } |
|
61 | + } |
|
62 | 62 | |
63 | - $description = ob_get_clean(); |
|
63 | + $description = ob_get_clean(); |
|
64 | 64 | |
65 | - // Display the name. |
|
66 | - $tootip = empty( $description ) ? '' : ' ' . '<i class="fas fa-xs fa-info gp-tooltip d-sm-none text-muted"></i>'; |
|
67 | - echo '<div class="mb-1">' . esc_html( $item->get_name() ) . wp_kses_post( $tootip ) . '</div>'; |
|
65 | + // Display the name. |
|
66 | + $tootip = empty( $description ) ? '' : ' ' . '<i class="fas fa-xs fa-info gp-tooltip d-sm-none text-muted"></i>'; |
|
67 | + echo '<div class="mb-1">' . esc_html( $item->get_name() ) . wp_kses_post( $tootip ) . '</div>'; |
|
68 | 68 | |
69 | - if ( ! empty( $description ) ) { |
|
70 | - printf( '<span class="d-none d-sm-block getpaid-item-desc">%s</span>', wp_kses_post( $description ) ); |
|
71 | - } |
|
69 | + if ( ! empty( $description ) ) { |
|
70 | + printf( '<span class="d-none d-sm-block getpaid-item-desc">%s</span>', wp_kses_post( $description ) ); |
|
71 | + } |
|
72 | 72 | |
73 | - if ( $item->allows_quantities() ) { |
|
74 | - printf( |
|
75 | - '<small class="d-sm-none text-muted form-text">%s</small>', |
|
76 | - sprintf( |
|
77 | - esc_html__( 'Qty %s', 'invoicing' ), |
|
78 | - sprintf( |
|
79 | - '<input |
|
73 | + if ( $item->allows_quantities() ) { |
|
74 | + printf( |
|
75 | + '<small class="d-sm-none text-muted form-text">%s</small>', |
|
76 | + sprintf( |
|
77 | + esc_html__( 'Qty %s', 'invoicing' ), |
|
78 | + sprintf( |
|
79 | + '<input |
|
80 | 80 | type="number" |
81 | 81 | step="0.01" |
82 | 82 | style="width: 48px;" |
@@ -87,53 +87,53 @@ discard block |
||
87 | 87 | %s>', |
88 | 88 | (float) $item->get_quantity() == 0 ? 1 : (float) $item->get_quantity(), |
89 | 89 | floatval( null !== $max_qty ? $max_qty : 1000000000000 ) |
90 | - ) |
|
91 | - ) |
|
92 | - ); |
|
93 | - } else { |
|
94 | - printf( |
|
95 | - '<small class="d-sm-none text-muted form-text">%s</small>', |
|
96 | - sprintf( |
|
97 | - esc_html__( 'Qty %s', 'invoicing' ), |
|
98 | - (float) $item->get_quantity() |
|
99 | - ) |
|
100 | - ); |
|
101 | - } |
|
90 | + ) |
|
91 | + ) |
|
92 | + ); |
|
93 | + } else { |
|
94 | + printf( |
|
95 | + '<small class="d-sm-none text-muted form-text">%s</small>', |
|
96 | + sprintf( |
|
97 | + esc_html__( 'Qty %s', 'invoicing' ), |
|
98 | + (float) $item->get_quantity() |
|
99 | + ) |
|
100 | + ); |
|
101 | + } |
|
102 | 102 | } |
103 | 103 | |
104 | - // Item price. |
|
105 | - if ( 'price' == $key ) { |
|
104 | + // Item price. |
|
105 | + if ( 'price' == $key ) { |
|
106 | 106 | |
107 | - // Set the currency position. |
|
108 | - $position = wpinv_currency_position(); |
|
107 | + // Set the currency position. |
|
108 | + $position = wpinv_currency_position(); |
|
109 | 109 | |
110 | - if ( $position == 'left_space' ) { |
|
111 | - $position = 'left'; |
|
112 | - } |
|
110 | + if ( $position == 'left_space' ) { |
|
111 | + $position = 'left'; |
|
112 | + } |
|
113 | 113 | |
114 | - if ( $position == 'right_space' ) { |
|
115 | - $position = 'right'; |
|
116 | - } |
|
114 | + if ( $position == 'right_space' ) { |
|
115 | + $position = 'right'; |
|
116 | + } |
|
117 | 117 | |
118 | - if ( $item->user_can_set_their_price() ) { |
|
119 | - $price = max( (float) $item->get_price(), (float) $item->get_minimum_price() ); |
|
120 | - $minimum = (float) $item->get_minimum_price(); |
|
121 | - $validate_minimum = ''; |
|
122 | - $class = ''; |
|
123 | - $data_minimum = ''; |
|
118 | + if ( $item->user_can_set_their_price() ) { |
|
119 | + $price = max( (float) $item->get_price(), (float) $item->get_minimum_price() ); |
|
120 | + $minimum = (float) $item->get_minimum_price(); |
|
121 | + $validate_minimum = ''; |
|
122 | + $class = ''; |
|
123 | + $data_minimum = ''; |
|
124 | 124 | |
125 | - if ( $minimum > 0 ) { |
|
126 | - $validate_minimum = sprintf( |
|
127 | - esc_attr__( 'The minimum allowed amount is %s', 'invoicing' ), |
|
128 | - strip_tags( wpinv_price( $minimum, $currency ) ) |
|
129 | - ); |
|
125 | + if ( $minimum > 0 ) { |
|
126 | + $validate_minimum = sprintf( |
|
127 | + esc_attr__( 'The minimum allowed amount is %s', 'invoicing' ), |
|
128 | + strip_tags( wpinv_price( $minimum, $currency ) ) |
|
129 | + ); |
|
130 | 130 | |
131 | - $class = 'getpaid-validate-minimum-amount'; |
|
131 | + $class = 'getpaid-validate-minimum-amount'; |
|
132 | 132 | |
133 | - $data_minimum = "data-minimum-amount='" . esc_attr( getpaid_unstandardize_amount( $minimum ) ) . "'"; |
|
134 | - } |
|
133 | + $data_minimum = "data-minimum-amount='" . esc_attr( getpaid_unstandardize_amount( $minimum ) ) . "'"; |
|
134 | + } |
|
135 | 135 | |
136 | - ?> |
|
136 | + ?> |
|
137 | 137 | <div class="input-group input-group-sm"> |
138 | 138 | <?php if ( 'left' == $position ) : ?> |
139 | 139 | <div class="input-group-prepend"> |
@@ -158,43 +158,43 @@ discard block |
||
158 | 158 | |
159 | 159 | <?php |
160 | 160 | |
161 | - } else { |
|
162 | - echo wp_kses_post( wpinv_price( $item->get_price(), $currency ) ); |
|
161 | + } else { |
|
162 | + echo wp_kses_post( wpinv_price( $item->get_price(), $currency ) ); |
|
163 | 163 | |
164 | - ?> |
|
164 | + ?> |
|
165 | 165 | <input name='getpaid-items[<?php echo (int) $item->get_id(); ?>][price]' type='hidden' class='getpaid-item-price-input' value='<?php echo esc_attr( $item->get_price() ); ?>'> |
166 | 166 | <?php |
167 | - } |
|
167 | + } |
|
168 | 168 | |
169 | - printf( |
|
169 | + printf( |
|
170 | 170 | '<small class="d-sm-none text-muted form-text getpaid-mobile-item-subtotal">%s</small>', |
171 | 171 | sprintf( esc_html__( 'Subtotal: %s', 'invoicing' ), wp_kses_post( wpinv_price( $item->get_sub_total(), $currency ) ) ) |
172 | 172 | ); |
173 | - } |
|
173 | + } |
|
174 | 174 | |
175 | - // Item quantity. |
|
176 | - if ( 'quantity' == $key ) { |
|
175 | + // Item quantity. |
|
176 | + if ( 'quantity' == $key ) { |
|
177 | 177 | |
178 | - if ( $item->allows_quantities() ) { |
|
179 | - ?> |
|
178 | + if ( $item->allows_quantities() ) { |
|
179 | + ?> |
|
180 | 180 | <input name='getpaid-items[<?php echo (int) $item->get_id(); ?>][quantity]' type="number" step="0.01" style='width: 64px; line-height: 1; min-height: 35px;' class='getpaid-item-quantity-input p-1 align-middle font-weight-normal shadow-none m-0 rounded-0 text-center border' value='<?php echo (float) $item->get_quantity() == 0 ? 1 : (float) $item->get_quantity(); ?>' min='1' <?php echo null !== $max_qty ? 'max="' . (float) $max_qty . '"' : ''; ?> required> |
181 | 181 | <?php |
182 | - } else { |
|
183 | - echo (float) $item->get_quantity(); |
|
184 | - echo ' '; |
|
185 | - ?> |
|
182 | + } else { |
|
183 | + echo (float) $item->get_quantity(); |
|
184 | + echo ' '; |
|
185 | + ?> |
|
186 | 186 | <input type='hidden' name='getpaid-items[<?php echo (int) $item->get_id(); ?>][quantity]' class='getpaid-item-quantity-input' value='<?php echo (float) $item->get_quantity(); ?>'> |
187 | 187 | <?php |
188 | - } |
|
188 | + } |
|
189 | 189 | } |
190 | 190 | |
191 | - // Item sub total. |
|
192 | - if ( 'subtotal' == $key ) { |
|
193 | - echo wp_kses_post( wpinv_price( $item->get_sub_total(), $currency ) ); |
|
194 | - } |
|
191 | + // Item sub total. |
|
192 | + if ( 'subtotal' == $key ) { |
|
193 | + echo wp_kses_post( wpinv_price( $item->get_sub_total(), $currency ) ); |
|
194 | + } |
|
195 | 195 | |
196 | - do_action( "getpaid_payment_form_cart_item_$key", $item, $form ); |
|
197 | - ?> |
|
196 | + do_action( "getpaid_payment_form_cart_item_$key", $item, $form ); |
|
197 | + ?> |
|
198 | 198 | |
199 | 199 | </div> |
200 | 200 |
@@ -9,49 +9,49 @@ discard block |
||
9 | 9 | * @var GetPaid_Form_Item $item |
10 | 10 | */ |
11 | 11 | |
12 | -defined( 'ABSPATH' ) || exit; |
|
12 | +defined('ABSPATH') || exit; |
|
13 | 13 | |
14 | -do_action( 'getpaid_before_payment_form_cart_item', $form, $item ); |
|
14 | +do_action('getpaid_before_payment_form_cart_item', $form, $item); |
|
15 | 15 | |
16 | 16 | $currency = $form->get_currency(); |
17 | -$max_qty = wpinv_item_max_buyable_quantity( $item->get_id() ); |
|
17 | +$max_qty = wpinv_item_max_buyable_quantity($item->get_id()); |
|
18 | 18 | ?> |
19 | 19 | <div class='getpaid-payment-form-items-cart-item getpaid-<?php echo $item->is_required() ? 'required' : 'selectable'; ?> item-<?php echo (int) $item->get_id(); ?> border-bottom py-2 px-3'> |
20 | 20 | |
21 | 21 | <div class="form-row needs-validation"> |
22 | 22 | |
23 | - <?php foreach ( array_keys( $columns ) as $key ) : ?> |
|
23 | + <?php foreach (array_keys($columns) as $key) : ?> |
|
24 | 24 | |
25 | - <div class="<?php echo 'name' == $key ? 'col-6' : 'col'; ?> <?php echo ( in_array( $key, array( 'subtotal', 'quantity', 'tax_rate' ) ) ) ? 'd-none d-sm-block' : ''; ?> position-relative getpaid-form-cart-item-<?php echo sanitize_html_class( $key ); ?> getpaid-form-cart-item-<?php echo sanitize_html_class( $key ); ?>-<?php echo (int) $item->get_id(); ?>"> |
|
25 | + <div class="<?php echo 'name' == $key ? 'col-6' : 'col'; ?> <?php echo (in_array($key, array('subtotal', 'quantity', 'tax_rate'))) ? 'd-none d-sm-block' : ''; ?> position-relative getpaid-form-cart-item-<?php echo sanitize_html_class($key); ?> getpaid-form-cart-item-<?php echo sanitize_html_class($key); ?>-<?php echo (int) $item->get_id(); ?>"> |
|
26 | 26 | |
27 | 27 | <?php |
28 | 28 | |
29 | 29 | // Fires before printing a line item column. |
30 | - do_action( "getpaid_form_cart_item_before_$key", $item, $form ); |
|
30 | + do_action("getpaid_form_cart_item_before_$key", $item, $form); |
|
31 | 31 | |
32 | 32 | // Item name. |
33 | - if ( 'name' == $key ) { |
|
33 | + if ('name' == $key) { |
|
34 | 34 | |
35 | 35 | ob_start(); |
36 | 36 | // And an optional description. |
37 | 37 | $description = $item->get_description(); |
38 | 38 | |
39 | - if ( ! empty( $description ) ) { |
|
40 | - echo "<small class='form-text text-muted pr-2 m-0'>" . wp_kses_post( $description ) . "</small>"; |
|
39 | + if (!empty($description)) { |
|
40 | + echo "<small class='form-text text-muted pr-2 m-0'>" . wp_kses_post($description) . "</small>"; |
|
41 | 41 | } |
42 | 42 | |
43 | 43 | // Price help text. |
44 | - $description = getpaid_item_recurring_price_help_text( $item, $currency ); |
|
45 | - if ( $description ) { |
|
46 | - echo "<small class='getpaid-form-item-price-desc form-text text-muted pr-2 m-0'>" . wp_kses_post( $description ) . "</small>"; |
|
44 | + $description = getpaid_item_recurring_price_help_text($item, $currency); |
|
45 | + if ($description) { |
|
46 | + echo "<small class='getpaid-form-item-price-desc form-text text-muted pr-2 m-0'>" . wp_kses_post($description) . "</small>"; |
|
47 | 47 | } |
48 | 48 | |
49 | - do_action( 'getpaid_payment_form_cart_item_description', $item, $form ); |
|
49 | + do_action('getpaid_payment_form_cart_item_description', $item, $form); |
|
50 | 50 | |
51 | - if ( wpinv_current_user_can_manage_invoicing() ) { |
|
51 | + if (wpinv_current_user_can_manage_invoicing()) { |
|
52 | 52 | |
53 | 53 | edit_post_link( |
54 | - __( 'Edit this item.', 'invoicing' ), |
|
54 | + __('Edit this item.', 'invoicing'), |
|
55 | 55 | '<small class="form-text text-muted">', |
56 | 56 | '</small>', |
57 | 57 | $item->get_id(), |
@@ -63,18 +63,18 @@ discard block |
||
63 | 63 | $description = ob_get_clean(); |
64 | 64 | |
65 | 65 | // Display the name. |
66 | - $tootip = empty( $description ) ? '' : ' ' . '<i class="fas fa-xs fa-info gp-tooltip d-sm-none text-muted"></i>'; |
|
67 | - echo '<div class="mb-1">' . esc_html( $item->get_name() ) . wp_kses_post( $tootip ) . '</div>'; |
|
66 | + $tootip = empty($description) ? '' : ' ' . '<i class="fas fa-xs fa-info gp-tooltip d-sm-none text-muted"></i>'; |
|
67 | + echo '<div class="mb-1">' . esc_html($item->get_name()) . wp_kses_post($tootip) . '</div>'; |
|
68 | 68 | |
69 | - if ( ! empty( $description ) ) { |
|
70 | - printf( '<span class="d-none d-sm-block getpaid-item-desc">%s</span>', wp_kses_post( $description ) ); |
|
69 | + if (!empty($description)) { |
|
70 | + printf('<span class="d-none d-sm-block getpaid-item-desc">%s</span>', wp_kses_post($description)); |
|
71 | 71 | } |
72 | 72 | |
73 | - if ( $item->allows_quantities() ) { |
|
73 | + if ($item->allows_quantities()) { |
|
74 | 74 | printf( |
75 | 75 | '<small class="d-sm-none text-muted form-text">%s</small>', |
76 | 76 | sprintf( |
77 | - esc_html__( 'Qty %s', 'invoicing' ), |
|
77 | + esc_html__('Qty %s', 'invoicing'), |
|
78 | 78 | sprintf( |
79 | 79 | '<input |
80 | 80 | type="number" |
@@ -86,7 +86,7 @@ discard block |
||
86 | 86 | max="%s" |
87 | 87 | %s>', |
88 | 88 | (float) $item->get_quantity() == 0 ? 1 : (float) $item->get_quantity(), |
89 | - floatval( null !== $max_qty ? $max_qty : 1000000000000 ) |
|
89 | + floatval(null !== $max_qty ? $max_qty : 1000000000000) |
|
90 | 90 | ) |
91 | 91 | ) |
92 | 92 | ); |
@@ -94,7 +94,7 @@ discard block |
||
94 | 94 | printf( |
95 | 95 | '<small class="d-sm-none text-muted form-text">%s</small>', |
96 | 96 | sprintf( |
97 | - esc_html__( 'Qty %s', 'invoicing' ), |
|
97 | + esc_html__('Qty %s', 'invoicing'), |
|
98 | 98 | (float) $item->get_quantity() |
99 | 99 | ) |
100 | 100 | ); |
@@ -102,56 +102,56 @@ discard block |
||
102 | 102 | } |
103 | 103 | |
104 | 104 | // Item price. |
105 | - if ( 'price' == $key ) { |
|
105 | + if ('price' == $key) { |
|
106 | 106 | |
107 | 107 | // Set the currency position. |
108 | 108 | $position = wpinv_currency_position(); |
109 | 109 | |
110 | - if ( $position == 'left_space' ) { |
|
110 | + if ($position == 'left_space') { |
|
111 | 111 | $position = 'left'; |
112 | 112 | } |
113 | 113 | |
114 | - if ( $position == 'right_space' ) { |
|
114 | + if ($position == 'right_space') { |
|
115 | 115 | $position = 'right'; |
116 | 116 | } |
117 | 117 | |
118 | - if ( $item->user_can_set_their_price() ) { |
|
119 | - $price = max( (float) $item->get_price(), (float) $item->get_minimum_price() ); |
|
118 | + if ($item->user_can_set_their_price()) { |
|
119 | + $price = max((float) $item->get_price(), (float) $item->get_minimum_price()); |
|
120 | 120 | $minimum = (float) $item->get_minimum_price(); |
121 | 121 | $validate_minimum = ''; |
122 | 122 | $class = ''; |
123 | 123 | $data_minimum = ''; |
124 | 124 | |
125 | - if ( $minimum > 0 ) { |
|
125 | + if ($minimum > 0) { |
|
126 | 126 | $validate_minimum = sprintf( |
127 | - esc_attr__( 'The minimum allowed amount is %s', 'invoicing' ), |
|
128 | - strip_tags( wpinv_price( $minimum, $currency ) ) |
|
127 | + esc_attr__('The minimum allowed amount is %s', 'invoicing'), |
|
128 | + strip_tags(wpinv_price($minimum, $currency)) |
|
129 | 129 | ); |
130 | 130 | |
131 | 131 | $class = 'getpaid-validate-minimum-amount'; |
132 | 132 | |
133 | - $data_minimum = "data-minimum-amount='" . esc_attr( getpaid_unstandardize_amount( $minimum ) ) . "'"; |
|
133 | + $data_minimum = "data-minimum-amount='" . esc_attr(getpaid_unstandardize_amount($minimum)) . "'"; |
|
134 | 134 | } |
135 | 135 | |
136 | 136 | ?> |
137 | 137 | <div class="input-group input-group-sm"> |
138 | - <?php if ( 'left' == $position ) : ?> |
|
138 | + <?php if ('left' == $position) : ?> |
|
139 | 139 | <div class="input-group-prepend"> |
140 | - <span class="input-group-text"><?php echo wp_kses_post( wpinv_currency_symbol( $currency ) ); ?></span> |
|
140 | + <span class="input-group-text"><?php echo wp_kses_post(wpinv_currency_symbol($currency)); ?></span> |
|
141 | 141 | </div> |
142 | 142 | <?php endif; ?> |
143 | 143 | |
144 | - <input type="text" <?php echo wp_kses_post( $data_minimum ); ?> name="getpaid-items[<?php echo (int) $item->get_id(); ?>][price]" value="<?php echo esc_attr( getpaid_unstandardize_amount( $price ) ); ?>" placeholder="<?php echo esc_attr( getpaid_unstandardize_amount( $item->get_minimum_price() ) ); ?>" class="getpaid-item-price-input p-1 align-middle font-weight-normal shadow-none m-0 rounded-0 text-center border <?php echo esc_attr( $class ); ?>" style="width: 64px; line-height: 1; min-height: 35px;"> |
|
144 | + <input type="text" <?php echo wp_kses_post($data_minimum); ?> name="getpaid-items[<?php echo (int) $item->get_id(); ?>][price]" value="<?php echo esc_attr(getpaid_unstandardize_amount($price)); ?>" placeholder="<?php echo esc_attr(getpaid_unstandardize_amount($item->get_minimum_price())); ?>" class="getpaid-item-price-input p-1 align-middle font-weight-normal shadow-none m-0 rounded-0 text-center border <?php echo esc_attr($class); ?>" style="width: 64px; line-height: 1; min-height: 35px;"> |
|
145 | 145 | |
146 | - <?php if ( ! empty( $validate_minimum ) ) : ?> |
|
146 | + <?php if (!empty($validate_minimum)) : ?> |
|
147 | 147 | <div class="invalid-tooltip"> |
148 | - <?php echo wp_kses_post( $validate_minimum ); ?> |
|
148 | + <?php echo wp_kses_post($validate_minimum); ?> |
|
149 | 149 | </div> |
150 | 150 | <?php endif; ?> |
151 | 151 | |
152 | - <?php if ( 'left' != $position ) : ?> |
|
152 | + <?php if ('left' != $position) : ?> |
|
153 | 153 | <div class="input-group-append"> |
154 | - <span class="input-group-text"><?php echo wp_kses_post( wpinv_currency_symbol( $currency ) ); ?></span> |
|
154 | + <span class="input-group-text"><?php echo wp_kses_post(wpinv_currency_symbol($currency)); ?></span> |
|
155 | 155 | </div> |
156 | 156 | <?php endif; ?> |
157 | 157 | </div> |
@@ -159,23 +159,23 @@ discard block |
||
159 | 159 | <?php |
160 | 160 | |
161 | 161 | } else { |
162 | - echo wp_kses_post( wpinv_price( $item->get_price(), $currency ) ); |
|
162 | + echo wp_kses_post(wpinv_price($item->get_price(), $currency)); |
|
163 | 163 | |
164 | 164 | ?> |
165 | - <input name='getpaid-items[<?php echo (int) $item->get_id(); ?>][price]' type='hidden' class='getpaid-item-price-input' value='<?php echo esc_attr( $item->get_price() ); ?>'> |
|
165 | + <input name='getpaid-items[<?php echo (int) $item->get_id(); ?>][price]' type='hidden' class='getpaid-item-price-input' value='<?php echo esc_attr($item->get_price()); ?>'> |
|
166 | 166 | <?php |
167 | 167 | } |
168 | 168 | |
169 | 169 | printf( |
170 | 170 | '<small class="d-sm-none text-muted form-text getpaid-mobile-item-subtotal">%s</small>', |
171 | - sprintf( esc_html__( 'Subtotal: %s', 'invoicing' ), wp_kses_post( wpinv_price( $item->get_sub_total(), $currency ) ) ) |
|
171 | + sprintf(esc_html__('Subtotal: %s', 'invoicing'), wp_kses_post(wpinv_price($item->get_sub_total(), $currency))) |
|
172 | 172 | ); |
173 | 173 | } |
174 | 174 | |
175 | 175 | // Item quantity. |
176 | - if ( 'quantity' == $key ) { |
|
176 | + if ('quantity' == $key) { |
|
177 | 177 | |
178 | - if ( $item->allows_quantities() ) { |
|
178 | + if ($item->allows_quantities()) { |
|
179 | 179 | ?> |
180 | 180 | <input name='getpaid-items[<?php echo (int) $item->get_id(); ?>][quantity]' type="number" step="0.01" style='width: 64px; line-height: 1; min-height: 35px;' class='getpaid-item-quantity-input p-1 align-middle font-weight-normal shadow-none m-0 rounded-0 text-center border' value='<?php echo (float) $item->get_quantity() == 0 ? 1 : (float) $item->get_quantity(); ?>' min='1' <?php echo null !== $max_qty ? 'max="' . (float) $max_qty . '"' : ''; ?> required> |
181 | 181 | <?php |
@@ -189,11 +189,11 @@ discard block |
||
189 | 189 | } |
190 | 190 | |
191 | 191 | // Item sub total. |
192 | - if ( 'subtotal' == $key ) { |
|
193 | - echo wp_kses_post( wpinv_price( $item->get_sub_total(), $currency ) ); |
|
192 | + if ('subtotal' == $key) { |
|
193 | + echo wp_kses_post(wpinv_price($item->get_sub_total(), $currency)); |
|
194 | 194 | } |
195 | 195 | |
196 | - do_action( "getpaid_payment_form_cart_item_$key", $item, $form ); |
|
196 | + do_action("getpaid_payment_form_cart_item_$key", $item, $form); |
|
197 | 197 | ?> |
198 | 198 | |
199 | 199 | </div> |
@@ -204,4 +204,4 @@ discard block |
||
204 | 204 | |
205 | 205 | </div> |
206 | 206 | <?php |
207 | -do_action( 'getpaid_payment_form_cart_item', $form, $item ); |
|
207 | +do_action('getpaid_payment_form_cart_item', $form, $item); |
@@ -11,26 +11,26 @@ discard block |
||
11 | 11 | |
12 | 12 | // Totals rows. |
13 | 13 | $totals = apply_filters( |
14 | - 'getpaid_payment_form_cart_table_totals', |
|
15 | - array( |
|
16 | - 'subtotal' => __( 'Subtotal', 'invoicing' ), |
|
17 | - 'tax' => __( 'Tax', 'invoicing' ), |
|
18 | - 'fees' => __( 'Fee', 'invoicing' ), |
|
19 | - 'discount' => __( 'Discount', 'invoicing' ), |
|
20 | - 'total' => __( 'Total', 'invoicing' ), |
|
21 | - ), |
|
22 | - $form |
|
14 | + 'getpaid_payment_form_cart_table_totals', |
|
15 | + array( |
|
16 | + 'subtotal' => __( 'Subtotal', 'invoicing' ), |
|
17 | + 'tax' => __( 'Tax', 'invoicing' ), |
|
18 | + 'fees' => __( 'Fee', 'invoicing' ), |
|
19 | + 'discount' => __( 'Discount', 'invoicing' ), |
|
20 | + 'total' => __( 'Total', 'invoicing' ), |
|
21 | + ), |
|
22 | + $form |
|
23 | 23 | ); |
24 | 24 | |
25 | 25 | $currency = $form->get_currency(); |
26 | 26 | $country = wpinv_get_default_country(); |
27 | 27 | |
28 | 28 | if ( ! empty( $form->invoice ) ) { |
29 | - $country = $form->invoice->get_country(); |
|
29 | + $country = $form->invoice->get_country(); |
|
30 | 30 | } |
31 | 31 | |
32 | 32 | if ( ! wpinv_use_taxes() && isset( $totals['tax'] ) ) { |
33 | - unset( $totals['tax'] ); |
|
33 | + unset( $totals['tax'] ); |
|
34 | 34 | } |
35 | 35 | |
36 | 36 | do_action( 'getpaid_before_payment_form_cart_totals', $form, $totals ); |
@@ -61,13 +61,13 @@ discard block |
||
61 | 61 | |
62 | 62 | <?php |
63 | 63 | |
64 | - // Total tax. |
|
65 | - if ( in_array( $key, array( 'tax', 'discount', 'subtotal', 'total', 'fees' ) ) ) { |
|
66 | - wpinv_the_price( 0, $currency ); |
|
67 | - } |
|
64 | + // Total tax. |
|
65 | + if ( in_array( $key, array( 'tax', 'discount', 'subtotal', 'total', 'fees' ) ) ) { |
|
66 | + wpinv_the_price( 0, $currency ); |
|
67 | + } |
|
68 | 68 | |
69 | - do_action( "getpaid_payment_form_cart_totals_$key", $form ); |
|
70 | - ?> |
|
69 | + do_action( "getpaid_payment_form_cart_totals_$key", $form ); |
|
70 | + ?> |
|
71 | 71 | |
72 | 72 | </div> |
73 | 73 |
@@ -7,17 +7,17 @@ discard block |
||
7 | 7 | * @version 1.0.19 |
8 | 8 | */ |
9 | 9 | |
10 | -defined( 'ABSPATH' ) || exit; |
|
10 | +defined('ABSPATH') || exit; |
|
11 | 11 | |
12 | 12 | // Totals rows. |
13 | 13 | $totals = apply_filters( |
14 | 14 | 'getpaid_payment_form_cart_table_totals', |
15 | 15 | array( |
16 | - 'subtotal' => __( 'Subtotal', 'invoicing' ), |
|
17 | - 'tax' => __( 'Tax', 'invoicing' ), |
|
18 | - 'fees' => __( 'Fee', 'invoicing' ), |
|
19 | - 'discount' => __( 'Discount', 'invoicing' ), |
|
20 | - 'total' => __( 'Total', 'invoicing' ), |
|
16 | + 'subtotal' => __('Subtotal', 'invoicing'), |
|
17 | + 'tax' => __('Tax', 'invoicing'), |
|
18 | + 'fees' => __('Fee', 'invoicing'), |
|
19 | + 'discount' => __('Discount', 'invoicing'), |
|
20 | + 'total' => __('Total', 'invoicing'), |
|
21 | 21 | ), |
22 | 22 | $form |
23 | 23 | ); |
@@ -25,15 +25,15 @@ discard block |
||
25 | 25 | $currency = $form->get_currency(); |
26 | 26 | $country = wpinv_get_default_country(); |
27 | 27 | |
28 | -if ( ! empty( $form->invoice ) ) { |
|
29 | - $country = $form->invoice->get_country(); |
|
28 | +if (!empty($form->invoice)) { |
|
29 | + $country = $form->invoice->get_country(); |
|
30 | 30 | } |
31 | 31 | |
32 | -if ( ! wpinv_use_taxes() && isset( $totals['tax'] ) ) { |
|
33 | - unset( $totals['tax'] ); |
|
32 | +if (!wpinv_use_taxes() && isset($totals['tax'])) { |
|
33 | + unset($totals['tax']); |
|
34 | 34 | } |
35 | 35 | |
36 | -do_action( 'getpaid_before_payment_form_cart_totals', $form, $totals ); |
|
36 | +do_action('getpaid_before_payment_form_cart_totals', $form, $totals); |
|
37 | 37 | |
38 | 38 | ?> |
39 | 39 | <style> |
@@ -47,26 +47,26 @@ discard block |
||
47 | 47 | <div class="row"> |
48 | 48 | <div class="col-12 offset-sm-6 col-sm-6 border-sm-left pl-sm-0"> |
49 | 49 | |
50 | - <?php foreach ( $totals as $key => $label ) : ?> |
|
50 | + <?php foreach ($totals as $key => $label) : ?> |
|
51 | 51 | |
52 | - <div class="getpaid-form-cart-totals-col getpaid-form-cart-totals-<?php echo esc_attr( $key ); ?> font-weight-bold py-2 px-3 <?php echo 'total' == $key ? 'bg-light' : 'border-bottom'; ?>"> |
|
52 | + <div class="getpaid-form-cart-totals-col getpaid-form-cart-totals-<?php echo esc_attr($key); ?> font-weight-bold py-2 px-3 <?php echo 'total' == $key ? 'bg-light' : 'border-bottom'; ?>"> |
|
53 | 53 | |
54 | 54 | <div class="form-row"> |
55 | 55 | |
56 | 56 | <div class="col-8 pl-sm-0 getpaid-payment-form-line-totals-label"> |
57 | - <?php echo esc_html( $label ); ?> |
|
57 | + <?php echo esc_html($label); ?> |
|
58 | 58 | </div> |
59 | 59 | |
60 | - <div class="col-4 getpaid-payment-form-line-totals-value getpaid-form-cart-totals-total-<?php echo esc_attr( $key ); ?>"> |
|
60 | + <div class="col-4 getpaid-payment-form-line-totals-value getpaid-form-cart-totals-total-<?php echo esc_attr($key); ?>"> |
|
61 | 61 | |
62 | 62 | <?php |
63 | 63 | |
64 | 64 | // Total tax. |
65 | - if ( in_array( $key, array( 'tax', 'discount', 'subtotal', 'total', 'fees' ) ) ) { |
|
66 | - wpinv_the_price( 0, $currency ); |
|
65 | + if (in_array($key, array('tax', 'discount', 'subtotal', 'total', 'fees'))) { |
|
66 | + wpinv_the_price(0, $currency); |
|
67 | 67 | } |
68 | 68 | |
69 | - do_action( "getpaid_payment_form_cart_totals_$key", $form ); |
|
69 | + do_action("getpaid_payment_form_cart_totals_$key", $form); |
|
70 | 70 | ?> |
71 | 71 | |
72 | 72 | </div> |
@@ -82,4 +82,4 @@ discard block |
||
82 | 82 | </div> |
83 | 83 | |
84 | 84 | <?php |
85 | -do_action( 'getpaid_payment_form_cart_totals', $form, $totals ); |
|
85 | +do_action('getpaid_payment_form_cart_totals', $form, $totals); |
@@ -1,32 +1,32 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | |
3 | - // Is the request set up correctly? |
|
4 | - if ( empty( $_GET['form'] ) && empty( $_GET['item'] ) ) { |
|
5 | - return aui()->alert( |
|
3 | + // Is the request set up correctly? |
|
4 | + if ( empty( $_GET['form'] ) && empty( $_GET['item'] ) ) { |
|
5 | + return aui()->alert( |
|
6 | 6 | array( |
7 | - 'type' => 'warning', |
|
8 | - 'content' => __( 'No payment form or item selected', 'invoicing' ), |
|
7 | + 'type' => 'warning', |
|
8 | + 'content' => __( 'No payment form or item selected', 'invoicing' ), |
|
9 | 9 | ) |
10 | 10 | ); |
11 | 11 | wp_die( esc_html__( 'No payment form or item selected', 'invoicing' ), 400 ); |
12 | - } |
|
12 | + } |
|
13 | 13 | |
14 | - // Payment form or button? |
|
15 | - if ( ! empty( $_GET['form'] ) ) { |
|
14 | + // Payment form or button? |
|
15 | + if ( ! empty( $_GET['form'] ) ) { |
|
16 | 16 | |
17 | - $shortcode = sprintf( |
|
17 | + $shortcode = sprintf( |
|
18 | 18 | '[getpaid form=%s]', |
19 | 19 | (int) $_GET['form'] |
20 | 20 | ); |
21 | 21 | |
22 | - } else { |
|
22 | + } else { |
|
23 | 23 | |
24 | - $shortcode = sprintf( |
|
24 | + $shortcode = sprintf( |
|
25 | 25 | '[getpaid item=%s]', |
26 | 26 | esc_attr( urldecode( $_GET['item'] ) ) |
27 | - ); |
|
27 | + ); |
|
28 | 28 | |
29 | - } |
|
29 | + } |
|
30 | 30 | |
31 | 31 | ?> |
32 | 32 | |
@@ -44,12 +44,12 @@ discard block |
||
44 | 44 | |
45 | 45 | <title>GetPaid</title> |
46 | 46 | <?php |
47 | - wp_enqueue_scripts(); |
|
48 | - wp_print_styles(); |
|
49 | - wp_print_head_scripts(); |
|
50 | - wp_custom_css_cb(); |
|
51 | - wpinv_get_template( 'frontend-head.php' ); |
|
52 | - ?> |
|
47 | + wp_enqueue_scripts(); |
|
48 | + wp_print_styles(); |
|
49 | + wp_print_head_scripts(); |
|
50 | + wp_custom_css_cb(); |
|
51 | + wpinv_get_template( 'frontend-head.php' ); |
|
52 | + ?> |
|
53 | 53 | |
54 | 54 | <style type="text/css"> |
55 | 55 | .body{ |
@@ -83,11 +83,11 @@ discard block |
||
83 | 83 | <body class="body page-template-default page"> |
84 | 84 | <div id="getpaid-form-embed" class="container my-5 page type-page status-publish hentry post post-content"> |
85 | 85 | <?php |
86 | - do_action( 'getpaid_payment_form_embed_top' ); |
|
87 | - echo do_shortcode( $shortcode ); |
|
88 | - do_action( 'getpaid_payment_form_embed_bottom' ); |
|
89 | - wpinv_get_template( 'frontend-footer.php' ); |
|
90 | - ?> |
|
86 | + do_action( 'getpaid_payment_form_embed_top' ); |
|
87 | + echo do_shortcode( $shortcode ); |
|
88 | + do_action( 'getpaid_payment_form_embed_bottom' ); |
|
89 | + wpinv_get_template( 'frontend-footer.php' ); |
|
90 | + ?> |
|
91 | 91 | </div> |
92 | 92 | <?php wp_footer(); ?> |
93 | 93 | </body> |
@@ -1,18 +1,18 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | |
3 | 3 | // Is the request set up correctly? |
4 | - if ( empty( $_GET['form'] ) && empty( $_GET['item'] ) ) { |
|
4 | + if (empty($_GET['form']) && empty($_GET['item'])) { |
|
5 | 5 | return aui()->alert( |
6 | 6 | array( |
7 | 7 | 'type' => 'warning', |
8 | - 'content' => __( 'No payment form or item selected', 'invoicing' ), |
|
8 | + 'content' => __('No payment form or item selected', 'invoicing'), |
|
9 | 9 | ) |
10 | 10 | ); |
11 | -wp_die( esc_html__( 'No payment form or item selected', 'invoicing' ), 400 ); |
|
11 | +wp_die(esc_html__('No payment form or item selected', 'invoicing'), 400); |
|
12 | 12 | } |
13 | 13 | |
14 | 14 | // Payment form or button? |
15 | - if ( ! empty( $_GET['form'] ) ) { |
|
15 | + if (!empty($_GET['form'])) { |
|
16 | 16 | |
17 | 17 | $shortcode = sprintf( |
18 | 18 | '[getpaid form=%s]', |
@@ -23,7 +23,7 @@ discard block |
||
23 | 23 | |
24 | 24 | $shortcode = sprintf( |
25 | 25 | '[getpaid item=%s]', |
26 | - esc_attr( urldecode( $_GET['item'] ) ) |
|
26 | + esc_attr(urldecode($_GET['item'])) |
|
27 | 27 | ); |
28 | 28 | |
29 | 29 | } |
@@ -35,7 +35,7 @@ discard block |
||
35 | 35 | |
36 | 36 | <head> |
37 | 37 | |
38 | - <meta charset="<?php bloginfo( 'charset' ); ?>"> |
|
38 | + <meta charset="<?php bloginfo('charset'); ?>"> |
|
39 | 39 | <meta name="viewport" content="width=device-width, initial-scale=1.0" > |
40 | 40 | |
41 | 41 | <meta name="robots" content="noindex,nofollow"> |
@@ -48,7 +48,7 @@ discard block |
||
48 | 48 | wp_print_styles(); |
49 | 49 | wp_print_head_scripts(); |
50 | 50 | wp_custom_css_cb(); |
51 | - wpinv_get_template( 'frontend-head.php' ); |
|
51 | + wpinv_get_template('frontend-head.php'); |
|
52 | 52 | ?> |
53 | 53 | |
54 | 54 | <style type="text/css"> |
@@ -83,10 +83,10 @@ discard block |
||
83 | 83 | <body class="body page-template-default page"> |
84 | 84 | <div id="getpaid-form-embed" class="container my-5 page type-page status-publish hentry post post-content"> |
85 | 85 | <?php |
86 | - do_action( 'getpaid_payment_form_embed_top' ); |
|
87 | - echo do_shortcode( $shortcode ); |
|
88 | - do_action( 'getpaid_payment_form_embed_bottom' ); |
|
89 | - wpinv_get_template( 'frontend-footer.php' ); |
|
86 | + do_action('getpaid_payment_form_embed_top'); |
|
87 | + echo do_shortcode($shortcode); |
|
88 | + do_action('getpaid_payment_form_embed_bottom'); |
|
89 | + wpinv_get_template('frontend-footer.php'); |
|
90 | 90 | ?> |
91 | 91 | </div> |
92 | 92 | <?php wp_footer(); ?> |
@@ -48,7 +48,7 @@ discard block |
||
48 | 48 | |
49 | 49 | // And the optional invoice id. |
50 | 50 | if ( ! empty( $form->invoice ) ) { |
51 | - getpaid_hidden_field( 'invoice_id', $form->invoice->get_id() ); |
|
51 | + getpaid_hidden_field( 'invoice_id', $form->invoice->get_id() ); |
|
52 | 52 | } |
53 | 53 | |
54 | 54 | // We also want to include the form id. |
@@ -68,12 +68,12 @@ discard block |
||
68 | 68 | |
69 | 69 | foreach ( $form->get_elements() as $element ) { |
70 | 70 | |
71 | - if ( isset( $element['type'] ) ) { |
|
72 | - $grid_class = getpaid_get_form_element_grid_class( $element ); |
|
73 | - echo "<div class='" . esc_attr( $grid_class ) . "'>"; |
|
74 | - do_action( 'getpaid_payment_form_element', $element, $form ); |
|
75 | - do_action( "getpaid_payment_form_element_{$element['type']}_template", $element, $form ); |
|
76 | - echo '</div>'; |
|
71 | + if ( isset( $element['type'] ) ) { |
|
72 | + $grid_class = getpaid_get_form_element_grid_class( $element ); |
|
73 | + echo "<div class='" . esc_attr( $grid_class ) . "'>"; |
|
74 | + do_action( 'getpaid_payment_form_element', $element, $form ); |
|
75 | + do_action( "getpaid_payment_form_element_{$element['type']}_template", $element, $form ); |
|
76 | + echo '</div>'; |
|
77 | 77 | } |
78 | 78 | } |
79 | 79 |
@@ -7,14 +7,14 @@ 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 | 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 | true |
20 | 20 | ); |
@@ -22,12 +22,12 @@ discard block |
||
22 | 22 | } |
23 | 23 | |
24 | 24 | // Require login to checkout. |
25 | -if ( wpinv_require_login_to_checkout() && ! get_current_user_id() ) { |
|
25 | +if (wpinv_require_login_to_checkout() && !get_current_user_id()) { |
|
26 | 26 | |
27 | 27 | aui()->alert( |
28 | 28 | array( |
29 | 29 | 'type' => 'danger', |
30 | - 'content' => __( 'You must be logged in to checkout.', 'invoicing' ), |
|
30 | + 'content' => __('You must be logged in to checkout.', 'invoicing'), |
|
31 | 31 | ), |
32 | 32 | true |
33 | 33 | ); |
@@ -36,29 +36,29 @@ discard block |
||
36 | 36 | } |
37 | 37 | |
38 | 38 | // Fires before displaying a payment form. |
39 | -do_action( 'getpaid_before_payment_form', $form ); |
|
39 | +do_action('getpaid_before_payment_form', $form); |
|
40 | 40 | ?> |
41 | 41 | |
42 | -<form class='getpaid-payment-form getpaid-payment-form-<?php echo absint( $form->get_id() ); ?> bsui position-relative' method='POST' data-key='<?php echo esc_attr( uniqid( 'gpf' ) ); ?>' data-currency='<?php echo esc_attr( empty( $form->invoice ) ? wpinv_get_currency() : $form->invoice->get_currency() ); ?>' novalidate> |
|
42 | +<form class='getpaid-payment-form getpaid-payment-form-<?php echo absint($form->get_id()); ?> bsui position-relative' method='POST' data-key='<?php echo esc_attr(uniqid('gpf')); ?>' data-currency='<?php echo esc_attr(empty($form->invoice) ? wpinv_get_currency() : $form->invoice->get_currency()); ?>' novalidate> |
|
43 | 43 | |
44 | 44 | <?php |
45 | 45 | |
46 | 46 | // Fires when printing the top of a payment form. |
47 | - do_action( 'getpaid_payment_form_top', $form ); |
|
47 | + do_action('getpaid_payment_form_top', $form); |
|
48 | 48 | |
49 | 49 | // And the optional invoice id. |
50 | - if ( ! empty( $form->invoice ) ) { |
|
51 | - getpaid_hidden_field( 'invoice_id', $form->invoice->get_id() ); |
|
50 | + if (!empty($form->invoice)) { |
|
51 | + getpaid_hidden_field('invoice_id', $form->invoice->get_id()); |
|
52 | 52 | } |
53 | 53 | |
54 | 54 | // We also want to include the form id. |
55 | - getpaid_hidden_field( 'form_id', $form->get_id() ); |
|
55 | + getpaid_hidden_field('form_id', $form->get_id()); |
|
56 | 56 | |
57 | 57 | // And an indication that this is a payment form submission. |
58 | - getpaid_hidden_field( 'getpaid_payment_form_submission', '1' ); |
|
58 | + getpaid_hidden_field('getpaid_payment_form_submission', '1'); |
|
59 | 59 | |
60 | 60 | // Fires before displaying payment form elements. |
61 | - do_action( 'getpaid_payment_form_before_elements', $form ); |
|
61 | + do_action('getpaid_payment_form_before_elements', $form); |
|
62 | 62 | |
63 | 63 | // Display the elements. |
64 | 64 | ?> |
@@ -66,13 +66,13 @@ discard block |
||
66 | 66 | <div class="row"> |
67 | 67 | <?php |
68 | 68 | |
69 | - foreach ( $form->get_elements() as $element ) { |
|
69 | + foreach ($form->get_elements() as $element) { |
|
70 | 70 | |
71 | - if ( isset( $element['type'] ) ) { |
|
72 | - $grid_class = getpaid_get_form_element_grid_class( $element ); |
|
73 | - echo "<div class='" . esc_attr( $grid_class ) . "'>"; |
|
74 | - do_action( 'getpaid_payment_form_element', $element, $form ); |
|
75 | - do_action( "getpaid_payment_form_element_{$element['type']}_template", $element, $form ); |
|
71 | + if (isset($element['type'])) { |
|
72 | + $grid_class = getpaid_get_form_element_grid_class($element); |
|
73 | + echo "<div class='" . esc_attr($grid_class) . "'>"; |
|
74 | + do_action('getpaid_payment_form_element', $element, $form); |
|
75 | + do_action("getpaid_payment_form_element_{$element['type']}_template", $element, $form); |
|
76 | 76 | echo '</div>'; |
77 | 77 | } |
78 | 78 | } |
@@ -83,28 +83,28 @@ discard block |
||
83 | 83 | |
84 | 84 | <?php |
85 | 85 | // Fires after displaying payment form elements. |
86 | - do_action( 'getpaid_payment_form_after_elements', $form ); |
|
86 | + do_action('getpaid_payment_form_after_elements', $form); |
|
87 | 87 | |
88 | 88 | echo "<div class='getpaid-payment-form-errors alert alert-danger d-none'></div>"; |
89 | 89 | |
90 | - if ( wpinv_current_user_can_manage_invoicing() ) { |
|
90 | + if (wpinv_current_user_can_manage_invoicing()) { |
|
91 | 91 | |
92 | 92 | edit_post_link( |
93 | - __( 'Edit this form.', 'invoicing' ), |
|
93 | + __('Edit this form.', 'invoicing'), |
|
94 | 94 | '<small class="form-text text-muted">', |
95 | - ' ' . __( 'This is only visible to website administators.', 'invoicing' ) . '</small>', |
|
95 | + ' ' . __('This is only visible to website administators.', 'invoicing') . '</small>', |
|
96 | 96 | $form->get_id(), |
97 | 97 | 'text-danger' |
98 | 98 | ); |
99 | 99 | |
100 | 100 | } |
101 | 101 | |
102 | - echo wp_kses_post( $extra_markup ); |
|
102 | + echo wp_kses_post($extra_markup); |
|
103 | 103 | ?> |
104 | 104 | |
105 | 105 | <div class="loading_div overlay overlay-black position-absolute row m-0 rounded overflow-hidden" style="height: 100%;width: 100%;top: 0px;z-index: 2;display:none;"> |
106 | 106 | <div class="spinner-border mx-auto align-self-center text-white" role="status"> |
107 | - <span class="sr-only"><?php esc_html_e( 'Loading...', 'invoicing' ); ?></span> |
|
107 | + <span class="sr-only"><?php esc_html_e('Loading...', 'invoicing'); ?></span> |
|
108 | 108 | </div> |
109 | 109 | </div> |
110 | 110 | |
@@ -113,4 +113,4 @@ discard block |
||
113 | 113 | <?php |
114 | 114 | |
115 | 115 | // Fires after displaying a payment form. |
116 | -do_action( 'getpaid_after_payment_form', $form ); |
|
116 | +do_action('getpaid_after_payment_form', $form); |