@@ -7,44 +7,44 @@ |
||
| 7 | 7 | * @version 1.0.19 |
| 8 | 8 | */ |
| 9 | 9 | |
| 10 | -defined( 'ABSPATH' ) || exit; |
|
| 10 | +defined('ABSPATH') || exit; |
|
| 11 | 11 | |
| 12 | -if ( empty( $form->get_items() ) ) { |
|
| 12 | +if (empty($form->get_items())) { |
|
| 13 | 13 | return; |
| 14 | 14 | } |
| 15 | 15 | |
| 16 | -if ( ! empty( $GLOBALS['getpaid_force_checkbox'] ) ) { |
|
| 16 | +if (!empty($GLOBALS['getpaid_force_checkbox'])) { |
|
| 17 | 17 | $items_type = 'checkbox'; |
| 18 | 18 | } |
| 19 | 19 | |
| 20 | -if ( empty( $items_type ) ) { |
|
| 20 | +if (empty($items_type)) { |
|
| 21 | 21 | $items_type = 'total'; |
| 22 | 22 | } |
| 23 | 23 | |
| 24 | -do_action( 'getpaid_before_payment_form_items', $form ); |
|
| 24 | +do_action('getpaid_before_payment_form_items', $form); |
|
| 25 | 25 | |
| 26 | -switch ( $items_type ) { |
|
| 26 | +switch ($items_type) { |
|
| 27 | 27 | case 'radio': |
| 28 | - wpinv_get_template( 'payment-forms/variations/radio.php', compact( 'form', 'items_type' ) ); |
|
| 28 | + wpinv_get_template('payment-forms/variations/radio.php', compact('form', 'items_type')); |
|
| 29 | 29 | break; |
| 30 | 30 | case 'checkbox': |
| 31 | - wpinv_get_template( 'payment-forms/variations/checkbox.php', compact( 'form', 'items_type' ) ); |
|
| 31 | + wpinv_get_template('payment-forms/variations/checkbox.php', compact('form', 'items_type')); |
|
| 32 | 32 | break; |
| 33 | 33 | case 'select': |
| 34 | - wpinv_get_template( 'payment-forms/variations/select.php', compact( 'form', 'items_type' ) ); |
|
| 34 | + wpinv_get_template('payment-forms/variations/select.php', compact('form', 'items_type')); |
|
| 35 | 35 | break; |
| 36 | 36 | } |
| 37 | 37 | |
| 38 | -do_action( 'getpaid_before_payment_form_cart', $form ); |
|
| 38 | +do_action('getpaid_before_payment_form_cart', $form); |
|
| 39 | 39 | |
| 40 | 40 | // Display the cart totals. |
| 41 | -if ( ! empty( $hide_cart ) ) { |
|
| 41 | +if (!empty($hide_cart)) { |
|
| 42 | 42 | echo '<div class="d-none">'; |
| 43 | 43 | } |
| 44 | 44 | |
| 45 | 45 | // Display the cart totals. |
| 46 | -wpinv_get_template( 'payment-forms/cart.php', compact( 'form', 'items_type' ) ); |
|
| 46 | +wpinv_get_template('payment-forms/cart.php', compact('form', 'items_type')); |
|
| 47 | 47 | |
| 48 | -if ( ! empty( $hide_cart ) ) { |
|
| 48 | +if (!empty($hide_cart)) { |
|
| 49 | 49 | echo '</div>'; |
| 50 | 50 | } |
@@ -7,26 +7,26 @@ |
||
| 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 ); |
|
| 13 | -$label_class = sanitize_key( preg_replace( '/[^A-Za-z0-9_-]/', '-', $label ) ); |
|
| 12 | +$label = empty($label) ? '' : wp_kses_post($label); |
|
| 13 | +$label_class = sanitize_key(preg_replace('/[^A-Za-z0-9_-]/', '-', $label)); |
|
| 14 | 14 | |
| 15 | -if ( ! empty( $required ) ) { |
|
| 15 | +if (!empty($required)) { |
|
| 16 | 16 | $label .= "<span class='text-danger'> *</span>"; |
| 17 | 17 | } |
| 18 | 18 | |
| 19 | 19 | echo aui()->radio( |
| 20 | 20 | array( |
| 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 | 25 | 'label_type' => 'vertical', |
| 26 | 26 | 'class' => 'w-auto', |
| 27 | 27 | 'inline' => false, |
| 28 | - 'options' => empty( $options ) ? array() : array_combine( $options, $options ), |
|
| 29 | - 'help_text' => empty( $description ) ? '' : wp_kses_post( $description ), |
|
| 28 | + 'options' => empty($options) ? array() : array_combine($options, $options), |
|
| 29 | + 'help_text' => empty($description) ? '' : wp_kses_post($description), |
|
| 30 | 30 | 'class' => $label_class, |
| 31 | 31 | ) |
| 32 | 32 | ); |
@@ -26,58 +26,58 @@ 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 ); |
|
| 31 | - |
|
| 32 | - // Item name. |
|
| 33 | - if ( 'name' == $key ) { |
|
| 34 | - |
|
| 35 | - ob_start(); |
|
| 36 | - // And an optional description. |
|
| 37 | - $description = $item->get_description(); |
|
| 38 | - |
|
| 39 | - if ( ! empty( $description ) ) { |
|
| 40 | - $description = wp_kses_post( $description ); |
|
| 41 | - echo "<small class='form-text text-muted pr-2 m-0'>$description</small>"; |
|
| 42 | - } |
|
| 43 | - |
|
| 44 | - // Price help text. |
|
| 45 | - $description = getpaid_item_recurring_price_help_text( $item, $currency ); |
|
| 46 | - if ( $description ) { |
|
| 47 | - echo "<small class='getpaid-form-item-price-desc form-text text-muted pr-2 m-0'>$description</small>"; |
|
| 48 | - } |
|
| 49 | - |
|
| 50 | - do_action( 'getpaid_payment_form_cart_item_description', $item, $form ); |
|
| 51 | - |
|
| 52 | - if ( wpinv_current_user_can_manage_invoicing() ) { |
|
| 53 | - |
|
| 54 | - edit_post_link( |
|
| 55 | - __( 'Edit this item.', 'invoicing' ), |
|
| 56 | - '<small class="form-text text-muted">', |
|
| 57 | - '</small>', |
|
| 58 | - $item->get_id(), |
|
| 59 | - 'text-danger' |
|
| 60 | - ); |
|
| 61 | - |
|
| 62 | - } |
|
| 63 | - |
|
| 64 | - $description = ob_get_clean(); |
|
| 65 | - |
|
| 66 | - // Display the name. |
|
| 67 | - $tootip = empty( $description ) ? '' : ' ' . '<i class="fas fa-xs fa-info gp-tooltip d-sm-none text-muted"></i>'; |
|
| 68 | - echo '<div class="mb-1">' . esc_html( $item->get_name() ) . wp_kses_post( $tootip ) . '</div>'; |
|
| 69 | - |
|
| 70 | - if ( ! empty( $description ) ) { |
|
| 71 | - printf( '<span class="d-none d-sm-block getpaid-item-desc">%s</span>', $description ); |
|
| 72 | - } |
|
| 73 | - |
|
| 74 | - if ( $item->allows_quantities() ) { |
|
| 75 | - printf( |
|
| 76 | - '<small class="d-sm-none text-muted form-text">%s</small>', |
|
| 77 | - sprintf( |
|
| 78 | - __( 'Qty %s', 'invoicing' ), |
|
| 79 | - sprintf( |
|
| 80 | - '<input |
|
| 29 | + // Fires before printing a line item column. |
|
| 30 | + do_action( "getpaid_form_cart_item_before_$key", $item, $form ); |
|
| 31 | + |
|
| 32 | + // Item name. |
|
| 33 | + if ( 'name' == $key ) { |
|
| 34 | + |
|
| 35 | + ob_start(); |
|
| 36 | + // And an optional description. |
|
| 37 | + $description = $item->get_description(); |
|
| 38 | + |
|
| 39 | + if ( ! empty( $description ) ) { |
|
| 40 | + $description = wp_kses_post( $description ); |
|
| 41 | + echo "<small class='form-text text-muted pr-2 m-0'>$description</small>"; |
|
| 42 | + } |
|
| 43 | + |
|
| 44 | + // Price help text. |
|
| 45 | + $description = getpaid_item_recurring_price_help_text( $item, $currency ); |
|
| 46 | + if ( $description ) { |
|
| 47 | + echo "<small class='getpaid-form-item-price-desc form-text text-muted pr-2 m-0'>$description</small>"; |
|
| 48 | + } |
|
| 49 | + |
|
| 50 | + do_action( 'getpaid_payment_form_cart_item_description', $item, $form ); |
|
| 51 | + |
|
| 52 | + if ( wpinv_current_user_can_manage_invoicing() ) { |
|
| 53 | + |
|
| 54 | + edit_post_link( |
|
| 55 | + __( 'Edit this item.', 'invoicing' ), |
|
| 56 | + '<small class="form-text text-muted">', |
|
| 57 | + '</small>', |
|
| 58 | + $item->get_id(), |
|
| 59 | + 'text-danger' |
|
| 60 | + ); |
|
| 61 | + |
|
| 62 | + } |
|
| 63 | + |
|
| 64 | + $description = ob_get_clean(); |
|
| 65 | + |
|
| 66 | + // Display the name. |
|
| 67 | + $tootip = empty( $description ) ? '' : ' ' . '<i class="fas fa-xs fa-info gp-tooltip d-sm-none text-muted"></i>'; |
|
| 68 | + echo '<div class="mb-1">' . esc_html( $item->get_name() ) . wp_kses_post( $tootip ) . '</div>'; |
|
| 69 | + |
|
| 70 | + if ( ! empty( $description ) ) { |
|
| 71 | + printf( '<span class="d-none d-sm-block getpaid-item-desc">%s</span>', $description ); |
|
| 72 | + } |
|
| 73 | + |
|
| 74 | + if ( $item->allows_quantities() ) { |
|
| 75 | + printf( |
|
| 76 | + '<small class="d-sm-none text-muted form-text">%s</small>', |
|
| 77 | + sprintf( |
|
| 78 | + __( 'Qty %s', 'invoicing' ), |
|
| 79 | + sprintf( |
|
| 80 | + '<input |
|
| 81 | 81 | type="number" |
| 82 | 82 | step="0.01" |
| 83 | 83 | 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 | null !== $max_qty ? 'max="' . (float) $max_qty . '"' : '' |
| 90 | - ) |
|
| 91 | - ) |
|
| 92 | - ); |
|
| 93 | - } else { |
|
| 94 | - printf( |
|
| 95 | - '<small class="d-sm-none text-muted form-text">%s</small>', |
|
| 96 | - sprintf( |
|
| 97 | - __( '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 | + __( '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 wpinv_price( $item->get_price(), $currency ); |
|
| 161 | + } else { |
|
| 162 | + echo 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( |
|
| 170 | - '<small class="d-sm-none text-muted form-text getpaid-mobile-item-subtotal">%s</small>', |
|
| 171 | - sprintf( __( 'Subtotal: %s', 'invoicing' ), wpinv_price( $item->get_sub_total(), $currency ) ) |
|
| 172 | - ); |
|
| 173 | - } |
|
| 169 | + printf( |
|
| 170 | + '<small class="d-sm-none text-muted form-text getpaid-mobile-item-subtotal">%s</small>', |
|
| 171 | + sprintf( __( 'Subtotal: %s', 'invoicing' ), wpinv_price( $item->get_sub_total(), $currency ) ) |
|
| 172 | + ); |
|
| 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 wpinv_price( $item->get_sub_total(), $currency ); |
|
| 194 | - } |
|
| 191 | + // Item sub total. |
|
| 192 | + if ( 'subtotal' == $key ) { |
|
| 193 | + echo 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,50 +9,50 @@ 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 | - $description = wp_kses_post( $description ); |
|
| 39 | + if (!empty($description)) { |
|
| 40 | + $description = wp_kses_post($description); |
|
| 41 | 41 | echo "<small class='form-text text-muted pr-2 m-0'>$description</small>"; |
| 42 | 42 | } |
| 43 | 43 | |
| 44 | 44 | // Price help text. |
| 45 | - $description = getpaid_item_recurring_price_help_text( $item, $currency ); |
|
| 46 | - if ( $description ) { |
|
| 45 | + $description = getpaid_item_recurring_price_help_text($item, $currency); |
|
| 46 | + if ($description) { |
|
| 47 | 47 | echo "<small class='getpaid-form-item-price-desc form-text text-muted pr-2 m-0'>$description</small>"; |
| 48 | 48 | } |
| 49 | 49 | |
| 50 | - do_action( 'getpaid_payment_form_cart_item_description', $item, $form ); |
|
| 50 | + do_action('getpaid_payment_form_cart_item_description', $item, $form); |
|
| 51 | 51 | |
| 52 | - if ( wpinv_current_user_can_manage_invoicing() ) { |
|
| 52 | + if (wpinv_current_user_can_manage_invoicing()) { |
|
| 53 | 53 | |
| 54 | 54 | edit_post_link( |
| 55 | - __( 'Edit this item.', 'invoicing' ), |
|
| 55 | + __('Edit this item.', 'invoicing'), |
|
| 56 | 56 | '<small class="form-text text-muted">', |
| 57 | 57 | '</small>', |
| 58 | 58 | $item->get_id(), |
@@ -64,18 +64,18 @@ discard block |
||
| 64 | 64 | $description = ob_get_clean(); |
| 65 | 65 | |
| 66 | 66 | // Display the name. |
| 67 | - $tootip = empty( $description ) ? '' : ' ' . '<i class="fas fa-xs fa-info gp-tooltip d-sm-none text-muted"></i>'; |
|
| 68 | - echo '<div class="mb-1">' . esc_html( $item->get_name() ) . wp_kses_post( $tootip ) . '</div>'; |
|
| 67 | + $tootip = empty($description) ? '' : ' ' . '<i class="fas fa-xs fa-info gp-tooltip d-sm-none text-muted"></i>'; |
|
| 68 | + echo '<div class="mb-1">' . esc_html($item->get_name()) . wp_kses_post($tootip) . '</div>'; |
|
| 69 | 69 | |
| 70 | - if ( ! empty( $description ) ) { |
|
| 71 | - printf( '<span class="d-none d-sm-block getpaid-item-desc">%s</span>', $description ); |
|
| 70 | + if (!empty($description)) { |
|
| 71 | + printf('<span class="d-none d-sm-block getpaid-item-desc">%s</span>', $description); |
|
| 72 | 72 | } |
| 73 | 73 | |
| 74 | - if ( $item->allows_quantities() ) { |
|
| 74 | + if ($item->allows_quantities()) { |
|
| 75 | 75 | printf( |
| 76 | 76 | '<small class="d-sm-none text-muted form-text">%s</small>', |
| 77 | 77 | sprintf( |
| 78 | - __( 'Qty %s', 'invoicing' ), |
|
| 78 | + __('Qty %s', 'invoicing'), |
|
| 79 | 79 | sprintf( |
| 80 | 80 | '<input |
| 81 | 81 | type="number" |
@@ -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 | - __( 'Qty %s', 'invoicing' ), |
|
| 97 | + __('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 wpinv_currency_symbol( $currency ); ?></span> |
|
| 140 | + <span class="input-group-text"><?php echo wpinv_currency_symbol($currency); ?></span> |
|
| 141 | 141 | </div> |
| 142 | 142 | <?php endif; ?> |
| 143 | 143 | |
| 144 | - <input type="text" <?php echo $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 $class; ?>" style="width: 64px; line-height: 1; min-height: 35px;"> |
|
| 144 | + <input type="text" <?php echo $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 $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 | 148 | <?php echo $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 wpinv_currency_symbol( $currency ); ?></span> |
|
| 154 | + <span class="input-group-text"><?php echo 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 wpinv_price( $item->get_price(), $currency ); |
|
| 162 | + echo 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( __( 'Subtotal: %s', 'invoicing' ), wpinv_price( $item->get_sub_total(), $currency ) ) |
|
| 171 | + sprintf(__('Subtotal: %s', 'invoicing'), 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 wpinv_price( $item->get_sub_total(), $currency ); |
|
| 192 | + if ('subtotal' == $key) { |
|
| 193 | + echo 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 | - echo wpinv_price( 0, $currency ); |
|
| 67 | - } |
|
| 64 | + // Total tax. |
|
| 65 | + if ( in_array( $key, array( 'tax', 'discount', 'subtotal', 'total', 'fees' ) ) ) { |
|
| 66 | + echo wpinv_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 | - echo wpinv_price( 0, $currency ); |
|
| 65 | + if (in_array($key, array('tax', 'discount', 'subtotal', 'total', 'fees'))) { |
|
| 66 | + echo wpinv_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); |
|
@@ -7,31 +7,31 @@ |
||
| 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 | |
| 24 | 24 | echo '<div class="getpaid-payment-form-items-checkbox form-group">'; |
| 25 | 25 | |
| 26 | -foreach ( $selectable as $item_id => $item_name ) { |
|
| 26 | +foreach ($selectable as $item_id => $item_name) { |
|
| 27 | 27 | |
| 28 | - $is_checked = get_post_meta( $item_id, 'selected_by_default', true ); |
|
| 28 | + $is_checked = get_post_meta($item_id, 'selected_by_default', true); |
|
| 29 | 29 | |
| 30 | 30 | echo aui()->input( |
| 31 | 31 | array( |
| 32 | 32 | 'type' => 'checkbox', |
| 33 | 33 | 'name' => 'getpaid-payment-form-selected-item', |
| 34 | - 'id' => 'getpaid-payment-form-selected-item' . uniqid( '_' ) . $item_id, |
|
| 34 | + 'id' => 'getpaid-payment-form-selected-item' . uniqid('_') . $item_id, |
|
| 35 | 35 | 'label' => $item_name, |
| 36 | 36 | 'value' => $item_id, |
| 37 | 37 | 'no_wrap' => true, |
@@ -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() ] = strip_tags( $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()] = strip_tags($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()->select( |
| 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 | 'inline' => false, |
| 35 | 35 | 'options' => $selectable, |
@@ -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, |
@@ -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( |
|
| 6 | - array( |
|
| 3 | + // Is the request set up correctly? |
|
| 4 | + if ( empty( $_GET['form'] ) && empty( $_GET['item'] ) ) { |
|
| 5 | + return aui()->alert( |
|
| 6 | + array( |
|
| 7 | 7 | 'type' => 'warning', |
| 8 | 8 | 'content' => __( 'No payment form or item selected', 'invoicing' ), |
| 9 | - ) |
|
| 9 | + ) |
|
| 10 | 10 | ); |
| 11 | 11 | wp_die( __( '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( |
|
| 18 | - '[getpaid form=%s]', |
|
| 19 | - (int) $_GET['form'] |
|
| 17 | + $shortcode = sprintf( |
|
| 18 | + '[getpaid form=%s]', |
|
| 19 | + (int) $_GET['form'] |
|
| 20 | 20 | ); |
| 21 | 21 | |
| 22 | - } else { |
|
| 22 | + } else { |
|
| 23 | 23 | |
| 24 | - $shortcode = sprintf( |
|
| 25 | - '[getpaid item=%s]', |
|
| 26 | - esc_attr( urldecode( $_GET['item'] ) ) |
|
| 27 | - ); |
|
| 24 | + $shortcode = sprintf( |
|
| 25 | + '[getpaid item=%s]', |
|
| 26 | + esc_attr( urldecode( $_GET['item'] ) ) |
|
| 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( __( 'No payment form or item selected', 'invoicing' ), 400 ); |
|
| 11 | +wp_die(__('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(); ?> |
@@ -46,7 +46,7 @@ discard block |
||
| 46 | 46 | |
| 47 | 47 | // And the optional invoice id. |
| 48 | 48 | if ( ! empty( $form->invoice ) ) { |
| 49 | - echo getpaid_hidden_field( 'invoice_id', $form->invoice->get_id() ); |
|
| 49 | + echo getpaid_hidden_field( 'invoice_id', $form->invoice->get_id() ); |
|
| 50 | 50 | } |
| 51 | 51 | |
| 52 | 52 | // We also want to include the form id. |
@@ -66,12 +66,12 @@ discard block |
||
| 66 | 66 | |
| 67 | 67 | foreach ( $form->get_elements() as $element ) { |
| 68 | 68 | |
| 69 | - if ( isset( $element['type'] ) ) { |
|
| 70 | - $grid_class = esc_attr( getpaid_get_form_element_grid_class( $element ) ); |
|
| 71 | - echo "<div class='$grid_class'>"; |
|
| 72 | - do_action( 'getpaid_payment_form_element', $element, $form ); |
|
| 73 | - do_action( "getpaid_payment_form_element_{$element['type']}_template", $element, $form ); |
|
| 74 | - echo '</div>'; |
|
| 69 | + if ( isset( $element['type'] ) ) { |
|
| 70 | + $grid_class = esc_attr( getpaid_get_form_element_grid_class( $element ) ); |
|
| 71 | + echo "<div class='$grid_class'>"; |
|
| 72 | + do_action( 'getpaid_payment_form_element', $element, $form ); |
|
| 73 | + do_action( "getpaid_payment_form_element_{$element['type']}_template", $element, $form ); |
|
| 74 | + echo '</div>'; |
|
| 75 | 75 | } |
| 76 | 76 | } |
| 77 | 77 | |
@@ -7,26 +7,26 @@ discard block |
||
| 7 | 7 | * @version 1.0.19 |
| 8 | 8 | */ |
| 9 | 9 | |
| 10 | -defined( 'ABSPATH' ) || exit; |
|
| 10 | +defined('ABSPATH') || exit; |
|
| 11 | 11 | |
| 12 | 12 | // Make sure that the form is active. |
| 13 | -if ( ! $form->is_active() ) { |
|
| 13 | +if (!$form->is_active()) { |
|
| 14 | 14 | echo aui()->alert( |
| 15 | 15 | array( |
| 16 | 16 | 'type' => 'warning', |
| 17 | - 'content' => __( 'This payment form is no longer active', 'invoicing' ), |
|
| 17 | + 'content' => __('This payment form is no longer active', 'invoicing'), |
|
| 18 | 18 | ) |
| 19 | 19 | ); |
| 20 | 20 | return; |
| 21 | 21 | } |
| 22 | 22 | |
| 23 | 23 | // Require login to checkout. |
| 24 | -if ( wpinv_require_login_to_checkout() && ! get_current_user_id() ) { |
|
| 24 | +if (wpinv_require_login_to_checkout() && !get_current_user_id()) { |
|
| 25 | 25 | |
| 26 | 26 | echo aui()->alert( |
| 27 | 27 | array( |
| 28 | 28 | 'type' => 'danger', |
| 29 | - 'content' => __( 'You must be logged in to checkout.', 'invoicing' ), |
|
| 29 | + 'content' => __('You must be logged in to checkout.', 'invoicing'), |
|
| 30 | 30 | ) |
| 31 | 31 | ); |
| 32 | 32 | return; |
@@ -34,29 +34,29 @@ discard block |
||
| 34 | 34 | } |
| 35 | 35 | |
| 36 | 36 | // Fires before displaying a payment form. |
| 37 | -do_action( 'getpaid_before_payment_form', $form ); |
|
| 37 | +do_action('getpaid_before_payment_form', $form); |
|
| 38 | 38 | ?> |
| 39 | 39 | |
| 40 | -<form class='getpaid-payment-form getpaid-payment-form-<?php echo absint( $form->get_id() ); ?> bsui position-relative' method='POST' data-key='<?php echo uniqid( 'gpf' ); ?>' data-currency='<?php echo esc_attr( empty( $form->invoice ) ? wpinv_get_currency() : $form->invoice->get_currency() ); ?>' novalidate> |
|
| 40 | +<form class='getpaid-payment-form getpaid-payment-form-<?php echo absint($form->get_id()); ?> bsui position-relative' method='POST' data-key='<?php echo uniqid('gpf'); ?>' data-currency='<?php echo esc_attr(empty($form->invoice) ? wpinv_get_currency() : $form->invoice->get_currency()); ?>' novalidate> |
|
| 41 | 41 | |
| 42 | 42 | <?php |
| 43 | 43 | |
| 44 | 44 | // Fires when printing the top of a payment form. |
| 45 | - do_action( 'getpaid_payment_form_top', $form ); |
|
| 45 | + do_action('getpaid_payment_form_top', $form); |
|
| 46 | 46 | |
| 47 | 47 | // And the optional invoice id. |
| 48 | - if ( ! empty( $form->invoice ) ) { |
|
| 49 | - echo getpaid_hidden_field( 'invoice_id', $form->invoice->get_id() ); |
|
| 48 | + if (!empty($form->invoice)) { |
|
| 49 | + echo getpaid_hidden_field('invoice_id', $form->invoice->get_id()); |
|
| 50 | 50 | } |
| 51 | 51 | |
| 52 | 52 | // We also want to include the form id. |
| 53 | - echo getpaid_hidden_field( 'form_id', $form->get_id() ); |
|
| 53 | + echo getpaid_hidden_field('form_id', $form->get_id()); |
|
| 54 | 54 | |
| 55 | 55 | // And an indication that this is a payment form submission. |
| 56 | - echo getpaid_hidden_field( 'getpaid_payment_form_submission', '1' ); |
|
| 56 | + echo getpaid_hidden_field('getpaid_payment_form_submission', '1'); |
|
| 57 | 57 | |
| 58 | 58 | // Fires before displaying payment form elements. |
| 59 | - do_action( 'getpaid_payment_form_before_elements', $form ); |
|
| 59 | + do_action('getpaid_payment_form_before_elements', $form); |
|
| 60 | 60 | |
| 61 | 61 | // Display the elements. |
| 62 | 62 | ?> |
@@ -64,13 +64,13 @@ discard block |
||
| 64 | 64 | <div class="row"> |
| 65 | 65 | <?php |
| 66 | 66 | |
| 67 | - foreach ( $form->get_elements() as $element ) { |
|
| 67 | + foreach ($form->get_elements() as $element) { |
|
| 68 | 68 | |
| 69 | - if ( isset( $element['type'] ) ) { |
|
| 70 | - $grid_class = esc_attr( getpaid_get_form_element_grid_class( $element ) ); |
|
| 69 | + if (isset($element['type'])) { |
|
| 70 | + $grid_class = esc_attr(getpaid_get_form_element_grid_class($element)); |
|
| 71 | 71 | echo "<div class='$grid_class'>"; |
| 72 | - do_action( 'getpaid_payment_form_element', $element, $form ); |
|
| 73 | - do_action( "getpaid_payment_form_element_{$element['type']}_template", $element, $form ); |
|
| 72 | + do_action('getpaid_payment_form_element', $element, $form); |
|
| 73 | + do_action("getpaid_payment_form_element_{$element['type']}_template", $element, $form); |
|
| 74 | 74 | echo '</div>'; |
| 75 | 75 | } |
| 76 | 76 | } |
@@ -81,28 +81,28 @@ discard block |
||
| 81 | 81 | |
| 82 | 82 | <?php |
| 83 | 83 | // Fires after displaying payment form elements. |
| 84 | - do_action( 'getpaid_payment_form_after_elements', $form ); |
|
| 84 | + do_action('getpaid_payment_form_after_elements', $form); |
|
| 85 | 85 | |
| 86 | 86 | echo "<div class='getpaid-payment-form-errors alert alert-danger d-none'></div>"; |
| 87 | 87 | |
| 88 | - if ( wpinv_current_user_can_manage_invoicing() ) { |
|
| 88 | + if (wpinv_current_user_can_manage_invoicing()) { |
|
| 89 | 89 | |
| 90 | 90 | edit_post_link( |
| 91 | - __( 'Edit this form.', 'invoicing' ), |
|
| 91 | + __('Edit this form.', 'invoicing'), |
|
| 92 | 92 | '<small class="form-text text-muted">', |
| 93 | - ' ' . __( 'This is only visible to website administators.', 'invoicing' ) . '</small>', |
|
| 93 | + ' ' . __('This is only visible to website administators.', 'invoicing') . '</small>', |
|
| 94 | 94 | $form->get_id(), |
| 95 | 95 | 'text-danger' |
| 96 | 96 | ); |
| 97 | 97 | |
| 98 | 98 | } |
| 99 | 99 | |
| 100 | - echo wp_kses_post( $extra_markup ); |
|
| 100 | + echo wp_kses_post($extra_markup); |
|
| 101 | 101 | ?> |
| 102 | 102 | |
| 103 | 103 | <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;"> |
| 104 | 104 | <div class="spinner-border mx-auto align-self-center text-white" role="status"> |
| 105 | - <span class="sr-only"><?php _e( 'Loading...', 'invoicing' ); ?></span> |
|
| 105 | + <span class="sr-only"><?php _e('Loading...', 'invoicing'); ?></span> |
|
| 106 | 106 | </div> |
| 107 | 107 | </div> |
| 108 | 108 | |
@@ -111,4 +111,4 @@ discard block |
||
| 111 | 111 | <?php |
| 112 | 112 | |
| 113 | 113 | // Fires after displaying a payment form. |
| 114 | -do_action( 'getpaid_after_payment_form', $form ); |
|
| 114 | +do_action('getpaid_after_payment_form', $form); |
|