@@ -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 | echo 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 ) ? '' : sanitize_text_field( $label ), |
|
| 35 | + 'label' => empty($label) ? '' : sanitize_text_field($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 | ); |
@@ -43,18 +43,18 @@ discard block |
||
| 43 | 43 | } |
| 44 | 44 | |
| 45 | 45 | // Item radios; |
| 46 | -if ( $select_type == 'radios' ) { |
|
| 46 | +if ($select_type == 'radios') { |
|
| 47 | 47 | echo aui()->radio( |
| 48 | 48 | array( |
| 49 | - 'name' => esc_attr( $id ), |
|
| 50 | - 'id' => esc_attr( $id ) . uniqid( '_' ), |
|
| 51 | - 'label' => empty( $label ) ? '' : sanitize_text_field( $label ), |
|
| 49 | + 'name' => esc_attr($id), |
|
| 50 | + 'id' => esc_attr($id) . uniqid('_'), |
|
| 51 | + 'label' => empty($label) ? '' : sanitize_text_field($label), |
|
| 52 | 52 | 'label_type' => 'vertical', |
| 53 | 53 | 'class' => 'getpaid-price-select-radio getpaid-refresh-on-change w-100', |
| 54 | 54 | 'value' => $value, |
| 55 | 55 | 'inline' => false, |
| 56 | 56 | 'options' => $options, |
| 57 | - 'help_text' => empty( $description ) ? '' : wp_kses_post( $description ), |
|
| 57 | + 'help_text' => empty($description) ? '' : wp_kses_post($description), |
|
| 58 | 58 | ) |
| 59 | 59 | ); |
| 60 | 60 | return; |
@@ -62,30 +62,30 @@ discard block |
||
| 62 | 62 | |
| 63 | 63 | |
| 64 | 64 | // Display the label. |
| 65 | -if ( ! empty( $label ) ) { |
|
| 66 | - $label = sanitize_text_field( $label ); |
|
| 65 | +if (!empty($label)) { |
|
| 66 | + $label = sanitize_text_field($label); |
|
| 67 | 67 | echo "<label>$label</label>"; |
| 68 | 68 | } |
| 69 | 69 | |
| 70 | 70 | // Item buttons; |
| 71 | -if ( $select_type == 'buttons' || $select_type == 'circles' ) { |
|
| 71 | +if ($select_type == 'buttons' || $select_type == 'circles') { |
|
| 72 | 72 | |
| 73 | 73 | $class = 'getpaid-price-buttons'; |
| 74 | 74 | |
| 75 | - if ( $select_type == 'circles' ) { |
|
| 75 | + if ($select_type == 'circles') { |
|
| 76 | 76 | $class .= ' getpaid-price-circles'; |
| 77 | 77 | } |
| 78 | 78 | echo "<div class='$class'>"; |
| 79 | 79 | |
| 80 | - foreach ( $options as $price => $label ) { |
|
| 81 | - $label = sanitize_text_field( $label ); |
|
| 82 | - $price = esc_attr( $price ); |
|
| 83 | - $_id = $id . uniqid( '_' ); |
|
| 84 | - $checked = checked( $price, $value, false ); |
|
| 80 | + foreach ($options as $price => $label) { |
|
| 81 | + $label = sanitize_text_field($label); |
|
| 82 | + $price = esc_attr($price); |
|
| 83 | + $_id = $id . uniqid('_'); |
|
| 84 | + $checked = checked($price, $value, false); |
|
| 85 | 85 | |
| 86 | 86 | $class = 'rounded'; |
| 87 | 87 | |
| 88 | - if ( $select_type == 'circles' ) { |
|
| 88 | + if ($select_type == 'circles') { |
|
| 89 | 89 | $class = ''; |
| 90 | 90 | } |
| 91 | 91 | echo " |
@@ -101,13 +101,13 @@ discard block |
||
| 101 | 101 | } |
| 102 | 102 | |
| 103 | 103 | // Item checkboxes; |
| 104 | -if ( $select_type == 'checkboxes' ) { |
|
| 104 | +if ($select_type == 'checkboxes') { |
|
| 105 | 105 | echo '<div class="form-group">'; |
| 106 | 106 | |
| 107 | - foreach ( $options as $price => $label ) { |
|
| 108 | - $label = sanitize_text_field( $label ); |
|
| 109 | - $price = esc_attr( $price ); |
|
| 110 | - $checked = checked( $price, $value, false ); |
|
| 107 | + foreach ($options as $price => $label) { |
|
| 108 | + $label = sanitize_text_field($label); |
|
| 109 | + $price = esc_attr($price); |
|
| 110 | + $checked = checked($price, $value, false); |
|
| 111 | 111 | echo " |
| 112 | 112 | <label class='d-block'> |
| 113 | 113 | <input type='checkbox' class='getpaid-price-select-checkbox getpaid-refresh-on-change w-auto' name='{$id}[]' value='$price' $checked /> |
@@ -120,6 +120,6 @@ discard block |
||
| 120 | 120 | |
| 121 | 121 | } |
| 122 | 122 | |
| 123 | -if ( ! empty( $description ) ) { |
|
| 123 | +if (!empty($description)) { |
|
| 124 | 124 | echo "<small class='form-text text-muted'>$description</small>"; |
| 125 | 125 | } |
@@ -10,7 +10,7 @@ discard block |
||
| 10 | 10 | defined( 'ABSPATH' ) || exit; |
| 11 | 11 | |
| 12 | 12 | if ( empty( $fields ) ) { |
| 13 | - return; |
|
| 13 | + return; |
|
| 14 | 14 | } |
| 15 | 15 | |
| 16 | 16 | // A prefix for all ids (so that a form can be included in the same page multiple times). |
@@ -18,12 +18,12 @@ discard block |
||
| 18 | 18 | |
| 19 | 19 | // Prepare the user's country. |
| 20 | 20 | if ( ! empty( $form->invoice ) ) { |
| 21 | - $country = $form->invoice->get_country(); |
|
| 21 | + $country = $form->invoice->get_country(); |
|
| 22 | 22 | } |
| 23 | 23 | |
| 24 | 24 | if ( empty( $country ) ) { |
| 25 | - $country = empty( $country ) ? getpaid_get_ip_country() : $country; |
|
| 26 | - $country = empty( $country ) ? wpinv_get_default_country() : $country; |
|
| 25 | + $country = empty( $country ) ? getpaid_get_ip_country() : $country; |
|
| 26 | + $country = empty( $country ) ? wpinv_get_default_country() : $country; |
|
| 27 | 27 | } |
| 28 | 28 | |
| 29 | 29 | // A prefix for all ids (so that a form can be included in the same page multiple times). |
@@ -55,10 +55,10 @@ discard block |
||
| 55 | 55 | <!-- Start Billing Address --> |
| 56 | 56 | <div class="getpaid-billing-address-wrapper"> |
| 57 | 57 | <?php |
| 58 | - $field_type = 'billing'; |
|
| 59 | - include plugin_dir_path( __FILE__ ) . 'address-fields.php'; |
|
| 60 | - do_action( 'getpaid_after_payment_form_billing_fields', $form ); |
|
| 61 | - ?> |
|
| 58 | + $field_type = 'billing'; |
|
| 59 | + include plugin_dir_path( __FILE__ ) . 'address-fields.php'; |
|
| 60 | + do_action( 'getpaid_after_payment_form_billing_fields', $form ); |
|
| 61 | + ?> |
|
| 62 | 62 | </div> |
| 63 | 63 | <!-- End Billing Address --> |
| 64 | 64 | |
@@ -70,20 +70,20 @@ discard block |
||
| 70 | 70 | |
| 71 | 71 | <?php |
| 72 | 72 | |
| 73 | - echo aui()->input( |
|
| 74 | - array( |
|
| 75 | - 'type' => 'checkbox', |
|
| 76 | - 'name' => 'same-shipping-address', |
|
| 77 | - 'id' => "shipping-toggle$uniqid", |
|
| 78 | - 'required' => false, |
|
| 79 | - 'label' => wp_kses_post( $shipping_address_toggle ), |
|
| 80 | - 'value' => 1, |
|
| 81 | - 'checked' => true, |
|
| 82 | - 'class' => 'w-auto', |
|
| 83 | - ) |
|
| 84 | - ); |
|
| 73 | + echo aui()->input( |
|
| 74 | + array( |
|
| 75 | + 'type' => 'checkbox', |
|
| 76 | + 'name' => 'same-shipping-address', |
|
| 77 | + 'id' => "shipping-toggle$uniqid", |
|
| 78 | + 'required' => false, |
|
| 79 | + 'label' => wp_kses_post( $shipping_address_toggle ), |
|
| 80 | + 'value' => 1, |
|
| 81 | + 'checked' => true, |
|
| 82 | + 'class' => 'w-auto', |
|
| 83 | + ) |
|
| 84 | + ); |
|
| 85 | 85 | |
| 86 | - ?> |
|
| 86 | + ?> |
|
| 87 | 87 | |
| 88 | 88 | |
| 89 | 89 | <!-- Start Shipping Address Title --> |
@@ -102,10 +102,10 @@ discard block |
||
| 102 | 102 | <!-- Start Shipping Address --> |
| 103 | 103 | <div class="getpaid-shipping-address-wrapper"> |
| 104 | 104 | <?php |
| 105 | - $field_type = 'shipping'; |
|
| 106 | - include plugin_dir_path( __FILE__ ) . 'address-fields.php'; |
|
| 107 | - do_action( 'getpaid_after_payment_form_shipping_fields', $form ); |
|
| 108 | - ?> |
|
| 105 | + $field_type = 'shipping'; |
|
| 106 | + include plugin_dir_path( __FILE__ ) . 'address-fields.php'; |
|
| 107 | + do_action( 'getpaid_after_payment_form_shipping_fields', $form ); |
|
| 108 | + ?> |
|
| 109 | 109 | </div> |
| 110 | 110 | <!-- End Shipping Address --> |
| 111 | 111 | |
@@ -7,57 +7,57 @@ 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 | // A prefix for all ids (so that a form can be included in the same page multiple times). |
| 17 | -$uniqid = uniqid( '_' ); |
|
| 17 | +$uniqid = uniqid('_'); |
|
| 18 | 18 | |
| 19 | 19 | // Prepare the user's country. |
| 20 | -if ( ! empty( $form->invoice ) ) { |
|
| 20 | +if (!empty($form->invoice)) { |
|
| 21 | 21 | $country = $form->invoice->get_country(); |
| 22 | 22 | } |
| 23 | 23 | |
| 24 | -if ( empty( $country ) ) { |
|
| 25 | - $country = empty( $country ) ? getpaid_get_ip_country() : $country; |
|
| 26 | - $country = empty( $country ) ? wpinv_get_default_country() : $country; |
|
| 24 | +if (empty($country)) { |
|
| 25 | + $country = empty($country) ? getpaid_get_ip_country() : $country; |
|
| 26 | + $country = empty($country) ? wpinv_get_default_country() : $country; |
|
| 27 | 27 | } |
| 28 | 28 | |
| 29 | 29 | // A prefix for all ids (so that a form can be included in the same page multiple times). |
| 30 | -$uniqid = uniqid( '_' ); |
|
| 30 | +$uniqid = uniqid('_'); |
|
| 31 | 31 | |
| 32 | -$address_type = empty( $address_type ) ? 'billing' : $address_type; |
|
| 32 | +$address_type = empty($address_type) ? 'billing' : $address_type; |
|
| 33 | 33 | |
| 34 | 34 | ?> |
| 35 | 35 | |
| 36 | -<?php if ( 'both' === $address_type ) : ?> |
|
| 36 | +<?php if ('both' === $address_type) : ?> |
|
| 37 | 37 | |
| 38 | 38 | <!-- Start Billing/Shipping Address Title --> |
| 39 | 39 | <h4 class="mb-3 getpaid-shipping-billing-address-title"> |
| 40 | - <?php _e( 'Billing / Shipping Address', 'invoicing' ); ?> |
|
| 40 | + <?php _e('Billing / Shipping Address', 'invoicing'); ?> |
|
| 41 | 41 | </h4> |
| 42 | 42 | <!-- End Billing Address Title --> |
| 43 | 43 | |
| 44 | 44 | <!-- Start Billing Address Title --> |
| 45 | 45 | <h4 class="mb-3 getpaid-billing-address-title"> |
| 46 | - <?php _e( 'Billing Address', 'invoicing' ); ?> |
|
| 46 | + <?php _e('Billing Address', 'invoicing'); ?> |
|
| 47 | 47 | </h4> |
| 48 | 48 | <!-- End Billing Address Title --> |
| 49 | 49 | |
| 50 | 50 | <?php endif; ?> |
| 51 | 51 | |
| 52 | 52 | |
| 53 | -<?php if ( 'both' === $address_type || 'billing' === $address_type ) : ?> |
|
| 53 | +<?php if ('both' === $address_type || 'billing' === $address_type) : ?> |
|
| 54 | 54 | |
| 55 | 55 | <!-- Start Billing Address --> |
| 56 | 56 | <div class="getpaid-billing-address-wrapper"> |
| 57 | 57 | <?php |
| 58 | 58 | $field_type = 'billing'; |
| 59 | - include plugin_dir_path( __FILE__ ) . 'address-fields.php'; |
|
| 60 | - do_action( 'getpaid_after_payment_form_billing_fields', $form ); |
|
| 59 | + include plugin_dir_path(__FILE__) . 'address-fields.php'; |
|
| 60 | + do_action('getpaid_after_payment_form_billing_fields', $form); |
|
| 61 | 61 | ?> |
| 62 | 62 | </div> |
| 63 | 63 | <!-- End Billing Address --> |
@@ -65,7 +65,7 @@ discard block |
||
| 65 | 65 | <?php endif; ?> |
| 66 | 66 | |
| 67 | 67 | |
| 68 | -<?php if ( 'both' === $address_type ) : ?> |
|
| 68 | +<?php if ('both' === $address_type) : ?> |
|
| 69 | 69 | |
| 70 | 70 | |
| 71 | 71 | <?php |
@@ -76,7 +76,7 @@ discard block |
||
| 76 | 76 | 'name' => 'same-shipping-address', |
| 77 | 77 | 'id' => "shipping-toggle$uniqid", |
| 78 | 78 | 'required' => false, |
| 79 | - 'label' => wp_kses_post( $shipping_address_toggle ), |
|
| 79 | + 'label' => wp_kses_post($shipping_address_toggle), |
|
| 80 | 80 | 'value' => 1, |
| 81 | 81 | 'checked' => true, |
| 82 | 82 | 'class' => 'w-auto', |
@@ -88,7 +88,7 @@ discard block |
||
| 88 | 88 | |
| 89 | 89 | <!-- Start Shipping Address Title --> |
| 90 | 90 | <h4 class="mb-3 getpaid-shipping-address-title"> |
| 91 | - <?php _e( 'Shipping Address', 'invoicing' ); ?> |
|
| 91 | + <?php _e('Shipping Address', 'invoicing'); ?> |
|
| 92 | 92 | </h4> |
| 93 | 93 | <!-- End Shipping Address Title --> |
| 94 | 94 | |
@@ -97,14 +97,14 @@ discard block |
||
| 97 | 97 | |
| 98 | 98 | |
| 99 | 99 | |
| 100 | -<?php if ( 'both' === $address_type || 'shipping' === $address_type ) : ?> |
|
| 100 | +<?php if ('both' === $address_type || 'shipping' === $address_type) : ?> |
|
| 101 | 101 | |
| 102 | 102 | <!-- Start Shipping Address --> |
| 103 | 103 | <div class="getpaid-shipping-address-wrapper"> |
| 104 | 104 | <?php |
| 105 | 105 | $field_type = 'shipping'; |
| 106 | - include plugin_dir_path( __FILE__ ) . 'address-fields.php'; |
|
| 107 | - do_action( 'getpaid_after_payment_form_shipping_fields', $form ); |
|
| 106 | + include plugin_dir_path(__FILE__) . 'address-fields.php'; |
|
| 107 | + do_action('getpaid_after_payment_form_shipping_fields', $form); |
|
| 108 | 108 | ?> |
| 109 | 109 | </div> |
| 110 | 110 | <!-- End Shipping Address --> |
@@ -7,24 +7,24 @@ |
||
| 7 | 7 | * @version 1.0.19 |
| 8 | 8 | */ |
| 9 | 9 | |
| 10 | -defined( 'ABSPATH' ) || exit; |
|
| 10 | +defined('ABSPATH') || exit; |
|
| 11 | 11 | |
| 12 | -$label = empty( $label ) ? '' : wp_kses_post( $label ); |
|
| 12 | +$label = empty($label) ? '' : wp_kses_post($label); |
|
| 13 | 13 | |
| 14 | -if ( ! empty( $required ) ) { |
|
| 14 | +if (!empty($required)) { |
|
| 15 | 15 | $label .= "<span class='text-danger'> *</span>"; |
| 16 | 16 | } |
| 17 | 17 | |
| 18 | 18 | echo aui()->radio( |
| 19 | 19 | array( |
| 20 | - 'name' => esc_attr( $id ), |
|
| 21 | - 'id' => esc_attr( $id ) . uniqid( '_' ), |
|
| 22 | - 'required' => ! empty( $required ), |
|
| 20 | + 'name' => esc_attr($id), |
|
| 21 | + 'id' => esc_attr($id) . uniqid('_'), |
|
| 22 | + 'required' => !empty($required), |
|
| 23 | 23 | 'label' => $label, |
| 24 | 24 | 'label_type' => 'vertical', |
| 25 | 25 | 'class' => 'w-auto', |
| 26 | 26 | 'inline' => false, |
| 27 | - 'options' => empty( $options ) ? array() : array_combine( $options, $options ), |
|
| 28 | - 'help_text' => empty( $description ) ? '' : wp_kses_post( $description ), |
|
| 27 | + 'options' => empty($options) ? array() : array_combine($options, $options), |
|
| 28 | + 'help_text' => empty($description) ? '' : wp_kses_post($description), |
|
| 29 | 29 | ) |
| 30 | 30 | ); |
@@ -11,58 +11,58 @@ discard block |
||
| 11 | 11 | * @var string $country The current user's country |
| 12 | 12 | */ |
| 13 | 13 | |
| 14 | -defined( 'ABSPATH' ) || exit; |
|
| 14 | +defined('ABSPATH') || exit; |
|
| 15 | 15 | |
| 16 | 16 | |
| 17 | -$field_type = sanitize_key( $field_type ); |
|
| 17 | +$field_type = sanitize_key($field_type); |
|
| 18 | 18 | |
| 19 | 19 | echo "<div class='row $field_type'>"; |
| 20 | 20 | |
| 21 | -foreach ( $fields as $address_field ) { |
|
| 21 | +foreach ($fields as $address_field) { |
|
| 22 | 22 | |
| 23 | 23 | // Skip if it is hidden. |
| 24 | - if ( empty( $address_field['visible'] ) ) { |
|
| 24 | + if (empty($address_field['visible'])) { |
|
| 25 | 25 | continue; |
| 26 | 26 | } |
| 27 | 27 | |
| 28 | - do_action( 'getpaid_payment_form_address_field_before_' . $address_field['name'], $field_type, $address_field ); |
|
| 28 | + do_action('getpaid_payment_form_address_field_before_' . $address_field['name'], $field_type, $address_field); |
|
| 29 | 29 | |
| 30 | 30 | // Prepare variables. |
| 31 | - if ( ! empty( $form->invoice ) ) { |
|
| 31 | + if (!empty($form->invoice)) { |
|
| 32 | 32 | $user_id = $form->invoice->get_user_id(); |
| 33 | 33 | } |
| 34 | 34 | |
| 35 | - if ( empty( $user_id ) && is_user_logged_in() ) { |
|
| 35 | + if (empty($user_id) && is_user_logged_in()) { |
|
| 36 | 36 | $user_id = get_current_user_id(); |
| 37 | 37 | } |
| 38 | 38 | |
| 39 | 39 | $field_name = $address_field['name']; |
| 40 | 40 | $field_name = "{$field_type}[$field_name]"; |
| 41 | - $wrap_class = getpaid_get_form_element_grid_class( $address_field ); |
|
| 42 | - $wrap_class = esc_attr( "$wrap_class getpaid-address-field-wrapper" ); |
|
| 43 | - $placeholder = empty( $address_field['placeholder'] ) ? '' : esc_attr( $address_field['placeholder'] ); |
|
| 44 | - $description = empty( $address_field['description'] ) ? '' : wp_kses_post( $address_field['description'] ); |
|
| 45 | - $value = ! empty( $user_id ) ? get_user_meta( $user_id, '_' . $address_field['name'], true ) : ''; |
|
| 46 | - $label = empty( $address_field['label'] ) ? '' : wp_kses_post( $address_field['label'] ); |
|
| 47 | - |
|
| 48 | - if ( ! empty( $address_field['required'] ) ) { |
|
| 41 | + $wrap_class = getpaid_get_form_element_grid_class($address_field); |
|
| 42 | + $wrap_class = esc_attr("$wrap_class getpaid-address-field-wrapper"); |
|
| 43 | + $placeholder = empty($address_field['placeholder']) ? '' : esc_attr($address_field['placeholder']); |
|
| 44 | + $description = empty($address_field['description']) ? '' : wp_kses_post($address_field['description']); |
|
| 45 | + $value = !empty($user_id) ? get_user_meta($user_id, '_' . $address_field['name'], true) : ''; |
|
| 46 | + $label = empty($address_field['label']) ? '' : wp_kses_post($address_field['label']); |
|
| 47 | + |
|
| 48 | + if (!empty($address_field['required'])) { |
|
| 49 | 49 | $label .= "<span class='text-danger'> *</span>"; |
| 50 | 50 | } |
| 51 | 51 | |
| 52 | 52 | // Display the country. |
| 53 | - if ( 'wpinv_country' == $address_field['name'] ) { |
|
| 53 | + if ('wpinv_country' == $address_field['name']) { |
|
| 54 | 54 | |
| 55 | 55 | echo "<div class='form-group $wrap_class getpaid-address-field-wrapper__country'"; |
| 56 | 56 | |
| 57 | 57 | echo aui()->select( |
| 58 | 58 | array( |
| 59 | 59 | 'options' => wpinv_get_country_list(), |
| 60 | - 'name' => esc_attr( $field_name ), |
|
| 61 | - 'id' => sanitize_html_class( $field_name ) . $uniqid, |
|
| 62 | - 'value' => sanitize_text_field( $country ), |
|
| 60 | + 'name' => esc_attr($field_name), |
|
| 61 | + 'id' => sanitize_html_class($field_name) . $uniqid, |
|
| 62 | + 'value' => sanitize_text_field($country), |
|
| 63 | 63 | 'placeholder' => $placeholder, |
| 64 | - 'required' => ! empty( $address_field['required'] ), |
|
| 65 | - 'label' => wp_kses_post( $label ), |
|
| 64 | + 'required' => !empty($address_field['required']), |
|
| 65 | + 'label' => wp_kses_post($label), |
|
| 66 | 66 | 'label_type' => 'vertical', |
| 67 | 67 | 'help_text' => $description, |
| 68 | 68 | 'class' => 'getpaid-address-field wpinv_country', |
@@ -75,7 +75,7 @@ discard block |
||
| 75 | 75 | ) |
| 76 | 76 | ); |
| 77 | 77 | |
| 78 | - if ( wpinv_should_validate_vat_number() ) { |
|
| 78 | + if (wpinv_should_validate_vat_number()) { |
|
| 79 | 79 | |
| 80 | 80 | echo aui()->input( |
| 81 | 81 | array( |
@@ -84,7 +84,7 @@ discard block |
||
| 84 | 84 | 'id' => "shipping-toggle$uniqid", |
| 85 | 85 | 'wrap_class' => "getpaid-address-field-wrapper__address-confirm mt-1 d-none", |
| 86 | 86 | 'required' => false, |
| 87 | - 'label' => __( 'I certify that I live in the country selected above', 'invoicing' ) . "<span class='text-danger'> *</span>", |
|
| 87 | + 'label' => __('I certify that I live in the country selected above', 'invoicing') . "<span class='text-danger'> *</span>", |
|
| 88 | 88 | 'value' => 1, |
| 89 | 89 | 'checked' => true, |
| 90 | 90 | 'class' => 'w-auto', |
@@ -98,27 +98,27 @@ discard block |
||
| 98 | 98 | } |
| 99 | 99 | |
| 100 | 100 | // Display the state. |
| 101 | - else if ( 'wpinv_state' == $address_field['name'] ) { |
|
| 101 | + else if ('wpinv_state' == $address_field['name']) { |
|
| 102 | 102 | |
| 103 | - if ( empty( $value ) ) { |
|
| 103 | + if (empty($value)) { |
|
| 104 | 104 | $value = wpinv_get_default_state(); |
| 105 | 105 | } |
| 106 | 106 | |
| 107 | - echo getpaid_get_states_select_markup ( |
|
| 107 | + echo getpaid_get_states_select_markup( |
|
| 108 | 108 | $country, |
| 109 | 109 | $value, |
| 110 | 110 | $placeholder, |
| 111 | 111 | $label, |
| 112 | 112 | $description, |
| 113 | - ! empty( $address_field['required'] ), |
|
| 113 | + !empty($address_field['required']), |
|
| 114 | 114 | $wrap_class, |
| 115 | 115 | $field_name |
| 116 | 116 | ); |
| 117 | 117 | |
| 118 | 118 | } else { |
| 119 | 119 | |
| 120 | - $key = str_replace( 'wpinv_', '', $address_field['name'] ); |
|
| 121 | - $key = esc_attr( str_replace( '_', '-', $key ) ); |
|
| 120 | + $key = str_replace('wpinv_', '', $address_field['name']); |
|
| 121 | + $key = esc_attr(str_replace('_', '-', $key)); |
|
| 122 | 122 | $autocomplete = ''; |
| 123 | 123 | $replacements = array( |
| 124 | 124 | 'zip' => 'postal-code', |
@@ -131,33 +131,33 @@ discard block |
||
| 131 | 131 | ); |
| 132 | 132 | |
| 133 | 133 | |
| 134 | - if ( isset( $replacements[ $key ] ) ) { |
|
| 134 | + if (isset($replacements[$key])) { |
|
| 135 | 135 | $autocomplete = array( |
| 136 | - 'autocomplete' => "$field_type {$replacements[ $key ]}", |
|
| 136 | + 'autocomplete' => "$field_type {$replacements[$key]}", |
|
| 137 | 137 | ); |
| 138 | 138 | } |
| 139 | 139 | |
| 140 | 140 | $append = ''; |
| 141 | 141 | |
| 142 | - if ( 'billing' === $field_type && wpinv_should_validate_vat_number() && 'vat-number' === $key ) { |
|
| 143 | - $valid = esc_attr__( 'Valid', 'invoicing' ); |
|
| 144 | - $invalid = esc_attr__( 'Invalid', 'invoicing' ); |
|
| 145 | - $validate = esc_attr__( 'Validate', 'invoicing' ); |
|
| 142 | + if ('billing' === $field_type && wpinv_should_validate_vat_number() && 'vat-number' === $key) { |
|
| 143 | + $valid = esc_attr__('Valid', 'invoicing'); |
|
| 144 | + $invalid = esc_attr__('Invalid', 'invoicing'); |
|
| 145 | + $validate = esc_attr__('Validate', 'invoicing'); |
|
| 146 | 146 | $append = "<span class='btn btn-secondary getpaid-vat-number-validate' data-valid='$valid' data-invalid='$invalid' data-validate='$validate'>$validate</span>"; |
| 147 | 147 | } |
| 148 | 148 | |
| 149 | 149 | echo aui()->input( |
| 150 | 150 | array( |
| 151 | - 'name' => esc_attr( $field_name ), |
|
| 152 | - 'id' => sanitize_html_class( $field_name ) . $uniqid, |
|
| 153 | - 'required' => ! empty( $address_field['required'] ), |
|
| 151 | + 'name' => esc_attr($field_name), |
|
| 152 | + 'id' => sanitize_html_class($field_name) . $uniqid, |
|
| 153 | + 'required' => !empty($address_field['required']), |
|
| 154 | 154 | 'placeholder' => $placeholder, |
| 155 | - 'label' => wp_kses_post( $label ), |
|
| 155 | + 'label' => wp_kses_post($label), |
|
| 156 | 156 | 'label_type' => 'vertical', |
| 157 | 157 | 'help_text' => $description, |
| 158 | 158 | 'type' => 'text', |
| 159 | - 'value' => sanitize_text_field( $value ), |
|
| 160 | - 'class' => 'getpaid-address-field ' . esc_attr( $address_field['name'] ), |
|
| 159 | + 'value' => sanitize_text_field($value), |
|
| 160 | + 'class' => 'getpaid-address-field ' . esc_attr($address_field['name']), |
|
| 161 | 161 | 'wrap_class' => "$wrap_class getpaid-address-field-wrapper__$key", |
| 162 | 162 | 'label_class' => 'getpaid-address-field-label getpaid-address-field-label__' . $key, |
| 163 | 163 | 'extra_attributes' => $autocomplete, |
@@ -167,7 +167,7 @@ discard block |
||
| 167 | 167 | |
| 168 | 168 | } |
| 169 | 169 | |
| 170 | - do_action( 'getpaid_payment_form_address_field_after_' . $address_field['name'], $field_type, $address_field ); |
|
| 170 | + do_action('getpaid_payment_form_address_field_after_' . $address_field['name'], $field_type, $address_field); |
|
| 171 | 171 | } |
| 172 | 172 | |
| 173 | 173 | echo "</div>"; |
@@ -7,23 +7,23 @@ |
||
| 7 | 7 | * @version 1.0.19 |
| 8 | 8 | */ |
| 9 | 9 | |
| 10 | -defined( 'ABSPATH' ) || exit; |
|
| 10 | +defined('ABSPATH') || exit; |
|
| 11 | 11 | |
| 12 | -$label = empty( $label ) ? '' : wp_kses_post( $label ); |
|
| 12 | +$label = empty($label) ? '' : wp_kses_post($label); |
|
| 13 | 13 | |
| 14 | -if ( ! empty( $required ) ) { |
|
| 14 | +if (!empty($required)) { |
|
| 15 | 15 | $label .= "<span class='text-danger'> *</span>"; |
| 16 | 16 | } |
| 17 | 17 | |
| 18 | 18 | echo aui()->input( |
| 19 | 19 | array( |
| 20 | 20 | 'type' => 'checkbox', |
| 21 | - 'name' => esc_attr( $id ), |
|
| 22 | - 'id' => esc_attr( $id ) . uniqid( '_' ), |
|
| 23 | - 'required' => ! empty( $required ), |
|
| 21 | + 'name' => esc_attr($id), |
|
| 22 | + 'id' => esc_attr($id) . uniqid('_'), |
|
| 23 | + 'required' => !empty($required), |
|
| 24 | 24 | 'label' => $label, |
| 25 | - 'value' => esc_attr__( 'Yes', 'invoicing' ), |
|
| 26 | - 'help_text' => empty( $description ) ? '' : wp_kses_post( $description ), |
|
| 25 | + 'value' => esc_attr__('Yes', 'invoicing'), |
|
| 26 | + 'help_text' => empty($description) ? '' : wp_kses_post($description), |
|
| 27 | 27 | 'class' => 'w-auto', |
| 28 | 28 | ) |
| 29 | 29 | ); |
@@ -7,45 +7,45 @@ discard block |
||
| 7 | 7 | * @version 1.0.19 |
| 8 | 8 | */ |
| 9 | 9 | |
| 10 | -defined( 'ABSPATH' ) || exit; |
|
| 10 | +defined('ABSPATH') || exit; |
|
| 11 | 11 | |
| 12 | 12 | // The payment methods select title. |
| 13 | -if ( empty( $text ) ) { |
|
| 14 | - $text = __( 'Select Payment Method', 'invoicing' ); |
|
| 13 | +if (empty($text)) { |
|
| 14 | + $text = __('Select Payment Method', 'invoicing'); |
|
| 15 | 15 | } |
| 16 | 16 | |
| 17 | 17 | // An array of active payment methods. |
| 18 | -$gateways = wpinv_get_enabled_payment_gateways( true ); |
|
| 18 | +$gateways = wpinv_get_enabled_payment_gateways(true); |
|
| 19 | 19 | |
| 20 | 20 | // The current invoice id. |
| 21 | 21 | $invoice_id = 0; |
| 22 | 22 | $chosen_gateway = wpinv_get_default_gateway(); |
| 23 | 23 | |
| 24 | -if ( ! empty( $form->invoice ) ) { |
|
| 24 | +if (!empty($form->invoice)) { |
|
| 25 | 25 | $invoice_id = $form->invoice->get_id(); |
| 26 | 26 | $chosen_gateway = $form->invoice->get_gateway(); |
| 27 | 27 | } |
| 28 | 28 | |
| 29 | 29 | ?> |
| 30 | 30 | |
| 31 | - <?php do_action( 'getpaid_before_payment_form_gateway_select', $form ); ?> |
|
| 31 | + <?php do_action('getpaid_before_payment_form_gateway_select', $form); ?> |
|
| 32 | 32 | <div class="mt-4 mb-4 getpaid-gateways"> |
| 33 | 33 | |
| 34 | - <?php do_action( 'wpinv_payment_mode_top', $invoice_id, $chosen_gateway, $gateways, $form ); ?> |
|
| 34 | + <?php do_action('wpinv_payment_mode_top', $invoice_id, $chosen_gateway, $gateways, $form); ?> |
|
| 35 | 35 | |
| 36 | 36 | <div class="getpaid-select-gateway-title-div"> |
| 37 | - <h6><?php echo sanitize_text_field( $text ); ?></h6> |
|
| 37 | + <h6><?php echo sanitize_text_field($text); ?></h6> |
|
| 38 | 38 | </div> |
| 39 | 39 | |
| 40 | 40 | <div class="getpaid-available-gateways-div"> |
| 41 | 41 | |
| 42 | - <?php foreach ( array_keys( $gateways ) as $gateway ) : ?> |
|
| 42 | + <?php foreach (array_keys($gateways) as $gateway) : ?> |
|
| 43 | 43 | |
| 44 | - <div class="pt-1 pb-1 getpaid-gateway getpaid-gateway-<?php echo sanitize_html_class( $gateway ) ;?>" data-checkout-label='<?php echo esc_attr( apply_filters( "getpaid_gateway_{$gateway}_checkout_button_label", '' ) ); ?>'> |
|
| 44 | + <div class="pt-1 pb-1 getpaid-gateway getpaid-gateway-<?php echo sanitize_html_class($gateway); ?>" data-checkout-label='<?php echo esc_attr(apply_filters("getpaid_gateway_{$gateway}_checkout_button_label", '')); ?>'> |
|
| 45 | 45 | |
| 46 | 46 | <label class="d-block w-100 getpaid-gateway-radio"> |
| 47 | - <input type="radio" class="w-auto" value="<?php echo esc_attr( $gateway ) ;?>" <?php checked( $gateway, $chosen_gateway ) ;?> name="wpi-gateway"> |
|
| 48 | - <span><?php echo sanitize_text_field( wpinv_get_gateway_checkout_label( $gateway ) ); ?></span> |
|
| 47 | + <input type="radio" class="w-auto" value="<?php echo esc_attr($gateway); ?>" <?php checked($gateway, $chosen_gateway); ?> name="wpi-gateway"> |
|
| 48 | + <span><?php echo sanitize_text_field(wpinv_get_gateway_checkout_label($gateway)); ?></span> |
|
| 49 | 49 | </label> |
| 50 | 50 | |
| 51 | 51 | </div> |
@@ -56,22 +56,22 @@ discard block |
||
| 56 | 56 | |
| 57 | 57 | <div class="getpaid-gateway-descriptions-div"> |
| 58 | 58 | |
| 59 | - <?php foreach ( array_keys( $gateways ) as $gateway ) : ?> |
|
| 59 | + <?php foreach (array_keys($gateways) as $gateway) : ?> |
|
| 60 | 60 | |
| 61 | - <div class="my-2 p-3 bg-light border getpaid-gateway-description getpaid-description-<?php echo sanitize_html_class( $gateway ) ;?>" style="display: none;"> |
|
| 61 | + <div class="my-2 p-3 bg-light border getpaid-gateway-description getpaid-description-<?php echo sanitize_html_class($gateway); ?>" style="display: none;"> |
|
| 62 | 62 | <?php |
| 63 | 63 | |
| 64 | - $description = wpinv_get_gateway_description( $gateway ); |
|
| 64 | + $description = wpinv_get_gateway_description($gateway); |
|
| 65 | 65 | |
| 66 | - if ( wpinv_is_test_mode( $gateway ) ) { |
|
| 67 | - $sandbox_notice = apply_filters( "getpaid_{$gateway}_sandbox_notice", __( 'SANDBOX ENABLED: No real payments will occur.', 'invoicing' ) ); |
|
| 66 | + if (wpinv_is_test_mode($gateway)) { |
|
| 67 | + $sandbox_notice = apply_filters("getpaid_{$gateway}_sandbox_notice", __('SANDBOX ENABLED: No real payments will occur.', 'invoicing')); |
|
| 68 | 68 | $description = "$description $sandbox_notice"; |
| 69 | 69 | } |
| 70 | 70 | |
| 71 | - echo wpautop( wp_kses_post( $description ) ); |
|
| 71 | + echo wpautop(wp_kses_post($description)); |
|
| 72 | 72 | |
| 73 | - do_action( 'wpinv_' . $gateway . '_checkout_fields', $invoice_id ) ; |
|
| 74 | - do_action( 'wpinv_' . $gateway . '_cc_form', $invoice_id, $form ) ; |
|
| 73 | + do_action('wpinv_' . $gateway . '_checkout_fields', $invoice_id); |
|
| 74 | + do_action('wpinv_' . $gateway . '_cc_form', $invoice_id, $form); |
|
| 75 | 75 | |
| 76 | 76 | ?> |
| 77 | 77 | </div> |
@@ -84,7 +84,7 @@ discard block |
||
| 84 | 84 | <?php |
| 85 | 85 | echo aui()->alert( |
| 86 | 86 | array( |
| 87 | - 'content' => __( 'None of the available payment gateways support subscriptions.', 'invoicing' ), |
|
| 87 | + 'content' => __('None of the available payment gateways support subscriptions.', 'invoicing'), |
|
| 88 | 88 | 'type' => 'danger', |
| 89 | 89 | ) |
| 90 | 90 | ); |
@@ -95,14 +95,14 @@ discard block |
||
| 95 | 95 | <?php |
| 96 | 96 | echo aui()->alert( |
| 97 | 97 | array( |
| 98 | - 'content' => __( 'There is no active payment gateway available to process your request.', 'invoicing' ), |
|
| 98 | + 'content' => __('There is no active payment gateway available to process your request.', 'invoicing'), |
|
| 99 | 99 | 'type' => 'danger', |
| 100 | 100 | ) |
| 101 | 101 | ); |
| 102 | 102 | ?> |
| 103 | 103 | </div> |
| 104 | 104 | |
| 105 | - <?php do_action( 'wpinv_payment_mode_bottom', $invoice_id, $chosen_gateway, $gateways, $form ); ?> |
|
| 105 | + <?php do_action('wpinv_payment_mode_bottom', $invoice_id, $chosen_gateway, $gateways, $form); ?> |
|
| 106 | 106 | |
| 107 | 107 | </div> |
| 108 | - <?php do_action( 'getpaid_after_payment_form_gateway_select', $form ); ?> |
|
| 108 | + <?php do_action('getpaid_after_payment_form_gateway_select', $form); ?> |
|
@@ -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 | // Prepare the selectable items. |
| 13 | 13 | $selectable = array(); |
| 14 | -foreach ( $form->get_items() as $item ) { |
|
| 15 | - if ( ! $item->is_required ) { |
|
| 16 | - $selectable[$item->get_id()] = $item->get_name() . ' — ' . wpinv_price( $item->get_initial_price() ); |
|
| 14 | +foreach ($form->get_items() as $item) { |
|
| 15 | + if (!$item->is_required) { |
|
| 16 | + $selectable[$item->get_id()] = $item->get_name() . ' — ' . wpinv_price($item->get_initial_price()); |
|
| 17 | 17 | } |
| 18 | 18 | } |
| 19 | 19 | |
| 20 | -if ( empty( $selectable ) ) { |
|
| 20 | +if (empty($selectable)) { |
|
| 21 | 21 | return; |
| 22 | 22 | } |
| 23 | 23 | |
@@ -27,9 +27,9 @@ discard block |
||
| 27 | 27 | echo aui()->radio( |
| 28 | 28 | array( |
| 29 | 29 | 'name' => 'getpaid-payment-form-selected-item', |
| 30 | - 'id' => 'getpaid-payment-form-selected-item' . uniqid( '_' ), |
|
| 30 | + 'id' => 'getpaid-payment-form-selected-item' . uniqid('_'), |
|
| 31 | 31 | 'required' => true, |
| 32 | - 'label' => __( 'Select Item', 'invoicing' ), |
|
| 32 | + 'label' => __('Select Item', 'invoicing'), |
|
| 33 | 33 | 'label_type' => 'vertical', |
| 34 | 34 | 'class' => 'w-auto', |
| 35 | 35 | 'inline' => false, |