@@ -1,4 +1,4 @@ discard block |
||
1 | -<?php |
|
1 | + <?php |
|
2 | 2 | /** |
3 | 3 | * Displays an alert in payment form |
4 | 4 | * |
@@ -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 | -if ( empty( $text ) ) { |
|
13 | - return; |
|
12 | + if ( empty( $text ) ) { |
|
13 | + return; |
|
14 | 14 | } |
15 | 15 | |
16 | -aui()->alert( |
|
17 | - array( |
|
18 | - 'content' => wp_kses_post( $text ), |
|
19 | - 'dismissible' => ! empty( $dismissible ), |
|
20 | - 'type' => empty( $class ) ? 'info' : str_replace( 'alert-', '', $class ), |
|
21 | - ), |
|
22 | - true |
|
23 | -); |
|
16 | + aui()->alert( |
|
17 | + array( |
|
18 | + 'content' => wp_kses_post( $text ), |
|
19 | + 'dismissible' => ! empty( $dismissible ), |
|
20 | + 'type' => empty( $class ) ? 'info' : str_replace( 'alert-', '', $class ), |
|
21 | + ), |
|
22 | + true |
|
23 | + ); |
@@ -1,4 +1,4 @@ discard block |
||
1 | -<?php |
|
1 | + <?php |
|
2 | 2 | /** |
3 | 3 | * Displays a separator in payment form |
4 | 4 | * |
@@ -7,6 +7,6 @@ discard block |
||
7 | 7 | * @version 1.0.19 |
8 | 8 | */ |
9 | 9 | |
10 | -defined( 'ABSPATH' ) || exit; |
|
11 | -?> |
|
12 | -<hr class="featurette-divider" /> |
|
10 | + defined( 'ABSPATH' ) || exit; |
|
11 | + ?> |
|
12 | + <hr class="featurette-divider" /> |
@@ -1,4 +1,4 @@ discard block |
||
1 | -<?php |
|
1 | + <?php |
|
2 | 2 | /** |
3 | 3 | * Displays a email input in payment form |
4 | 4 | * |
@@ -7,27 +7,27 @@ discard block |
||
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 ) ) { |
|
16 | - $label .= "<span class='text-danger'> *</span>"; |
|
15 | + if ( ! empty( $required ) ) { |
|
16 | + $label .= "<span class='text-danger'> *</span>"; |
|
17 | 17 | } |
18 | 18 | |
19 | -aui()->input( |
|
20 | - array( |
|
21 | - 'name' => esc_attr( $id ), |
|
22 | - 'id' => esc_attr( $element_id ), |
|
23 | - 'placeholder' => empty( $placeholder ) ? '' : esc_attr( $placeholder ), |
|
24 | - 'required' => ! empty( $required ), |
|
25 | - 'label' => $label, |
|
26 | - 'label_type' => 'vertical', |
|
27 | - 'help_text' => empty( $description ) ? '' : wp_kses_post( $description ), |
|
28 | - 'type' => 'email', |
|
29 | - 'class' => $label_class, |
|
30 | - 'value' => $query_value, |
|
31 | - ), |
|
32 | - true |
|
33 | -); |
|
19 | + aui()->input( |
|
20 | + array( |
|
21 | + 'name' => esc_attr( $id ), |
|
22 | + 'id' => esc_attr( $element_id ), |
|
23 | + 'placeholder' => empty( $placeholder ) ? '' : esc_attr( $placeholder ), |
|
24 | + 'required' => ! empty( $required ), |
|
25 | + 'label' => $label, |
|
26 | + 'label_type' => 'vertical', |
|
27 | + 'help_text' => empty( $description ) ? '' : wp_kses_post( $description ), |
|
28 | + 'type' => 'email', |
|
29 | + 'class' => $label_class, |
|
30 | + 'value' => $query_value, |
|
31 | + ), |
|
32 | + true |
|
33 | + ); |
@@ -1,4 +1,4 @@ discard block |
||
1 | -<?php |
|
1 | + <?php |
|
2 | 2 | /** |
3 | 3 | * Displays a checkbox item-select box in a payment form |
4 | 4 | * |
@@ -7,40 +7,40 @@ discard block |
||
7 | 7 | * @version 1.0.19 |
8 | 8 | */ |
9 | 9 | |
10 | -defined( 'ABSPATH' ) || exit; |
|
10 | + defined( 'ABSPATH' ) || exit; |
|
11 | 11 | |
12 | -// Prepare the selectable items. |
|
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() ); |
|
17 | - } |
|
12 | + // Prepare the selectable items. |
|
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() ); |
|
17 | + } |
|
18 | 18 | } |
19 | 19 | |
20 | -if ( empty( $selectable ) ) { |
|
21 | - return; |
|
20 | + if ( empty( $selectable ) ) { |
|
21 | + return; |
|
22 | 22 | } |
23 | 23 | |
24 | -echo '<div class="getpaid-payment-form-items-checkbox form-group mb-3">'; |
|
24 | + echo '<div class="getpaid-payment-form-items-checkbox form-group mb-3">'; |
|
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 | - aui()->input( |
|
31 | - array( |
|
32 | - 'type' => 'checkbox', |
|
33 | - 'name' => 'getpaid-payment-form-selected-item', |
|
34 | - 'id' => 'getpaid-payment-form-selected-item' . uniqid( '_' ) . $item_id, |
|
35 | - 'label' => $item_name, |
|
36 | - 'value' => $item_id, |
|
37 | - 'no_wrap' => true, |
|
38 | - 'class' => 'w-auto', |
|
39 | - 'checked' => '1' == $is_checked, |
|
40 | - ), |
|
41 | - true |
|
42 | - ); |
|
30 | + aui()->input( |
|
31 | + array( |
|
32 | + 'type' => 'checkbox', |
|
33 | + 'name' => 'getpaid-payment-form-selected-item', |
|
34 | + 'id' => 'getpaid-payment-form-selected-item' . uniqid( '_' ) . $item_id, |
|
35 | + 'label' => $item_name, |
|
36 | + 'value' => $item_id, |
|
37 | + 'no_wrap' => true, |
|
38 | + 'class' => 'w-auto', |
|
39 | + 'checked' => '1' == $is_checked, |
|
40 | + ), |
|
41 | + true |
|
42 | + ); |
|
43 | 43 | |
44 | 44 | } |
45 | 45 | |
46 | -echo '</div>'; |
|
46 | + echo '</div>'; |
@@ -1,4 +1,4 @@ discard block |
||
1 | -<?php |
|
1 | + <?php |
|
2 | 2 | /** |
3 | 3 | * Displays an item-select box in a payment form |
4 | 4 | * |
@@ -7,34 +7,34 @@ discard block |
||
7 | 7 | * @version 1.0.19 |
8 | 8 | */ |
9 | 9 | |
10 | -defined( 'ABSPATH' ) || exit; |
|
10 | + defined( 'ABSPATH' ) || exit; |
|
11 | 11 | |
12 | -// Prepare the selectable items. |
|
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() ) ); |
|
17 | - } |
|
12 | + // Prepare the selectable items. |
|
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() ) ); |
|
17 | + } |
|
18 | 18 | } |
19 | 19 | |
20 | -if ( empty( $selectable ) ) { |
|
21 | - return; |
|
20 | + if ( empty( $selectable ) ) { |
|
21 | + return; |
|
22 | 22 | } |
23 | 23 | |
24 | -echo '<div class="getpaid-payment-form-items-select form-group mb-3">'; |
|
24 | + echo '<div class="getpaid-payment-form-items-select form-group mb-3">'; |
|
25 | 25 | |
26 | -// Display the selectable items. |
|
27 | -aui()->select( |
|
28 | - array( |
|
29 | - 'name' => 'getpaid-payment-form-selected-item', |
|
30 | - 'id' => 'getpaid-payment-form-selected-item' . uniqid( '_' ), |
|
31 | - 'required' => true, |
|
32 | - 'label' => __( 'Select Item', 'invoicing' ), |
|
33 | - 'label_type' => 'vertical', |
|
34 | - 'inline' => false, |
|
35 | - 'options' => $selectable, |
|
36 | - ), |
|
37 | - true |
|
38 | -); |
|
26 | + // Display the selectable items. |
|
27 | + aui()->select( |
|
28 | + array( |
|
29 | + 'name' => 'getpaid-payment-form-selected-item', |
|
30 | + 'id' => 'getpaid-payment-form-selected-item' . uniqid( '_' ), |
|
31 | + 'required' => true, |
|
32 | + 'label' => __( 'Select Item', 'invoicing' ), |
|
33 | + 'label_type' => 'vertical', |
|
34 | + 'inline' => false, |
|
35 | + 'options' => $selectable, |
|
36 | + ), |
|
37 | + true |
|
38 | + ); |
|
39 | 39 | |
40 | -echo '</div>'; |
|
40 | + echo '</div>'; |
@@ -1,4 +1,4 @@ discard block |
||
1 | -<?php |
|
1 | + <?php |
|
2 | 2 | /** |
3 | 3 | * Displays a radio item-select box in a payment form |
4 | 4 | * |
@@ -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 | -// Prepare the selectable items. |
|
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() ); |
|
17 | - } |
|
12 | + // Prepare the selectable items. |
|
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() ); |
|
17 | + } |
|
18 | 18 | } |
19 | 19 | |
20 | -if ( empty( $selectable ) ) { |
|
21 | - return; |
|
20 | + if ( empty( $selectable ) ) { |
|
21 | + return; |
|
22 | 22 | } |
23 | 23 | |
24 | -echo '<div class="getpaid-payment-form-items-radio form-group mb-3">'; |
|
24 | + echo '<div class="getpaid-payment-form-items-radio form-group mb-3">'; |
|
25 | 25 | |
26 | -// Display the selectable items. |
|
27 | -aui()->radio( |
|
28 | - array( |
|
29 | - 'name' => 'getpaid-payment-form-selected-item', |
|
30 | - 'id' => 'getpaid-payment-form-selected-item' . uniqid( '_' ), |
|
31 | - 'required' => true, |
|
32 | - 'label' => __( 'Select Item', 'invoicing' ), |
|
33 | - 'label_type' => 'vertical', |
|
34 | - 'class' => 'w-auto', |
|
35 | - 'inline' => false, |
|
36 | - 'options' => $selectable, |
|
37 | - ), |
|
38 | - true |
|
39 | -); |
|
26 | + // Display the selectable items. |
|
27 | + aui()->radio( |
|
28 | + array( |
|
29 | + 'name' => 'getpaid-payment-form-selected-item', |
|
30 | + 'id' => 'getpaid-payment-form-selected-item' . uniqid( '_' ), |
|
31 | + 'required' => true, |
|
32 | + 'label' => __( 'Select Item', 'invoicing' ), |
|
33 | + 'label_type' => 'vertical', |
|
34 | + 'class' => 'w-auto', |
|
35 | + 'inline' => false, |
|
36 | + 'options' => $selectable, |
|
37 | + ), |
|
38 | + true |
|
39 | + ); |
|
40 | 40 | |
41 | -echo '</div>'; |
|
41 | + echo '</div>'; |
@@ -1,4 +1,4 @@ discard block |
||
1 | -<?php |
|
1 | + <?php |
|
2 | 2 | /** |
3 | 3 | * Displays a cart totals in a payment form |
4 | 4 | * |
@@ -7,35 +7,35 @@ discard block |
||
7 | 7 | * @version 1.0.19 |
8 | 8 | */ |
9 | 9 | |
10 | -defined( 'ABSPATH' ) || exit; |
|
11 | - |
|
12 | -// Totals rows. |
|
13 | -$cart_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 |
|
23 | -); |
|
24 | - |
|
25 | -$currency = $form->get_currency(); |
|
26 | -$country = wpinv_get_default_country(); |
|
27 | - |
|
28 | -if ( ! empty( $form->invoice ) ) { |
|
29 | - $country = $form->invoice->get_country(); |
|
10 | + defined( 'ABSPATH' ) || exit; |
|
11 | + |
|
12 | + // Totals rows. |
|
13 | + $cart_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 |
|
23 | + ); |
|
24 | + |
|
25 | + $currency = $form->get_currency(); |
|
26 | + $country = wpinv_get_default_country(); |
|
27 | + |
|
28 | + if ( ! empty( $form->invoice ) ) { |
|
29 | + $country = $form->invoice->get_country(); |
|
30 | 30 | } |
31 | 31 | |
32 | -if ( ! wpinv_use_taxes() && isset( $cart_totals['tax'] ) ) { |
|
33 | - unset( $cart_totals['tax'] ); |
|
32 | + if ( ! wpinv_use_taxes() && isset( $cart_totals['tax'] ) ) { |
|
33 | + unset( $cart_totals['tax'] ); |
|
34 | 34 | } |
35 | 35 | |
36 | -do_action( 'getpaid_before_payment_form_cart_totals', $form, $cart_totals ); |
|
36 | + do_action( 'getpaid_before_payment_form_cart_totals', $form, $cart_totals ); |
|
37 | 37 | |
38 | -?> |
|
38 | + ?> |
|
39 | 39 | <style> |
40 | 40 | @media screen and (min-width: 576px) { |
41 | 41 | .bsui .border-sm-left { |
@@ -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' ), true ) ) { |
|
66 | - wpinv_the_price( 0, $currency ); |
|
67 | - } |
|
64 | + // Total tax. |
|
65 | + if ( in_array( $key, array( 'tax', 'discount', 'subtotal', 'total', 'fees' ), true ) ) { |
|
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 | |
@@ -82,4 +82,4 @@ discard block |
||
82 | 82 | </div> |
83 | 83 | |
84 | 84 | <?php |
85 | -do_action( 'getpaid_payment_form_cart_totals', $form, $cart_totals ); |
|
85 | + do_action( 'getpaid_payment_form_cart_totals', $form, $cart_totals ); |
@@ -1,4 +1,4 @@ discard block |
||
1 | -<?php |
|
1 | + <?php |
|
2 | 2 | /** |
3 | 3 | * Displays a cart item in a payment form |
4 | 4 | * |
@@ -9,14 +9,14 @@ 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 | -$currency = $form->get_currency(); |
|
17 | -$max_qty = wpinv_item_max_buyable_quantity( $item->get_id() ); |
|
18 | -?> |
|
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'> |
|
16 | + $currency = $form->get_currency(); |
|
17 | + $max_qty = wpinv_item_max_buyable_quantity( $item->get_id() ); |
|
18 | + ?> |
|
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 row align-items-center needs-validation"> |
22 | 22 | |
@@ -26,71 +26,71 @@ 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 | 35 | |
36 | - ob_start(); |
|
36 | + ob_start(); |
|
37 | 37 | |
38 | - // Add an optional description. |
|
39 | - $description = $item->get_description(); |
|
38 | + // Add an optional description. |
|
39 | + $description = $item->get_description(); |
|
40 | 40 | |
41 | - if ( ! empty( $description ) ) { |
|
42 | - echo "<small class='form-text text-muted pr-2 m-0'>" . wp_kses_post( $description ) . '</small>'; |
|
43 | - } |
|
41 | + if ( ! empty( $description ) ) { |
|
42 | + echo "<small class='form-text text-muted pr-2 m-0'>" . wp_kses_post( $description ) . '</small>'; |
|
43 | + } |
|
44 | 44 | |
45 | - // Price help text. |
|
46 | - $description = getpaid_item_recurring_price_help_text( $item, $currency ); |
|
47 | - if ( $description ) { |
|
48 | - echo "<small class='getpaid-form-item-price-desc form-text text-muted font-italic pr-2 m-0'>" . wp_kses_post( $description ) . '</small>'; |
|
49 | - } |
|
45 | + // Price help text. |
|
46 | + $description = getpaid_item_recurring_price_help_text( $item, $currency ); |
|
47 | + if ( $description ) { |
|
48 | + echo "<small class='getpaid-form-item-price-desc form-text text-muted font-italic pr-2 m-0'>" . wp_kses_post( $description ) . '</small>'; |
|
49 | + } |
|
50 | 50 | |
51 | - do_action( 'getpaid_payment_form_cart_item_description', $item, $form ); |
|
51 | + do_action( 'getpaid_payment_form_cart_item_description', $item, $form ); |
|
52 | 52 | |
53 | - if ( wpinv_current_user_can_manage_invoicing() ) { |
|
53 | + if ( wpinv_current_user_can_manage_invoicing() ) { |
|
54 | 54 | |
55 | - edit_post_link( |
|
56 | - __( 'Edit this item.', 'invoicing' ), |
|
57 | - '<small class="form-text text-muted">', |
|
58 | - '</small>', |
|
59 | - $item->get_id(), |
|
60 | - 'text-danger' |
|
61 | - ); |
|
55 | + edit_post_link( |
|
56 | + __( 'Edit this item.', 'invoicing' ), |
|
57 | + '<small class="form-text text-muted">', |
|
58 | + '</small>', |
|
59 | + $item->get_id(), |
|
60 | + 'text-danger' |
|
61 | + ); |
|
62 | 62 | |
63 | - } |
|
63 | + } |
|
64 | 64 | |
65 | - $description = ob_get_clean(); |
|
65 | + $description = ob_get_clean(); |
|
66 | 66 | |
67 | - // Display the name. |
|
68 | - $tootip = empty( $description ) ? '' : ' <i class="fas fa-xs fa-info gp-tooltip d-sm-none text-muted"></i>'; |
|
67 | + // Display the name. |
|
68 | + $tootip = empty( $description ) ? '' : ' <i class="fas fa-xs fa-info gp-tooltip d-sm-none text-muted"></i>'; |
|
69 | 69 | |
70 | - $has_featured_image = has_post_thumbnail( $item->get_id() ); |
|
70 | + $has_featured_image = has_post_thumbnail( $item->get_id() ); |
|
71 | 71 | |
72 | - if ( $has_featured_image ) { |
|
73 | - echo '<div class="d-flex align-items-center getpaid-form-item-has-featured-image">'; |
|
74 | - echo '<div class="getpaid-form-item-image-container mr-2">'; |
|
75 | - echo get_the_post_thumbnail( $item->get_id(), 'thumbnail', array( 'class' => 'getpaid-form-item-image mb-0' ) ); |
|
76 | - echo '</div>'; |
|
77 | - echo '<div class="getpaid-form-item-name-container">'; |
|
78 | - } |
|
72 | + if ( $has_featured_image ) { |
|
73 | + echo '<div class="d-flex align-items-center getpaid-form-item-has-featured-image">'; |
|
74 | + echo '<div class="getpaid-form-item-image-container mr-2">'; |
|
75 | + echo get_the_post_thumbnail( $item->get_id(), 'thumbnail', array( 'class' => 'getpaid-form-item-image mb-0' ) ); |
|
76 | + echo '</div>'; |
|
77 | + echo '<div class="getpaid-form-item-name-container">'; |
|
78 | + } |
|
79 | 79 | |
80 | - echo '<div class="mb-1 font-weight-bold">' . esc_html( $item->get_name() ) . wp_kses_post( $tootip ) . '</div>'; |
|
80 | + echo '<div class="mb-1 font-weight-bold">' . esc_html( $item->get_name() ) . wp_kses_post( $tootip ) . '</div>'; |
|
81 | 81 | |
82 | - if ( ! empty( $description ) ) { |
|
83 | - printf( '<span class="d-none d-sm-block getpaid-item-desc">%s</span>', wp_kses_post( $description ) ); |
|
84 | - } |
|
82 | + if ( ! empty( $description ) ) { |
|
83 | + printf( '<span class="d-none d-sm-block getpaid-item-desc">%s</span>', wp_kses_post( $description ) ); |
|
84 | + } |
|
85 | 85 | |
86 | - if ( $item->allows_quantities() ) { |
|
87 | - printf( |
|
88 | - '<small class="d-sm-none text-muted form-text">%s</small>', |
|
89 | - sprintf( |
|
90 | - // translators: %s is the item quantity. |
|
91 | - esc_html__( 'Qty %s', 'invoicing' ), |
|
92 | - sprintf( |
|
93 | - '<input |
|
86 | + if ( $item->allows_quantities() ) { |
|
87 | + printf( |
|
88 | + '<small class="d-sm-none text-muted form-text">%s</small>', |
|
89 | + sprintf( |
|
90 | + // translators: %s is the item quantity. |
|
91 | + esc_html__( 'Qty %s', 'invoicing' ), |
|
92 | + sprintf( |
|
93 | + '<input |
|
94 | 94 | type="number" |
95 | 95 | step="0.01" |
96 | 96 | style="width: 48px;" |
@@ -99,142 +99,142 @@ discard block |
||
99 | 99 | min="1" |
100 | 100 | max="%s" |
101 | 101 | >', |
102 | - (float) $item->get_quantity() == 0 ? 1 : (float) $item->get_quantity(), |
|
103 | - floatval( null !== $max_qty ? $max_qty : 1000000000000 ) |
|
104 | - ) |
|
105 | - ) |
|
106 | - ); |
|
107 | - } else { |
|
108 | - printf( |
|
109 | - '<small class="d-sm-none text-muted form-text">%s</small>', |
|
110 | - sprintf( |
|
111 | - // translators: %s is the item quantity. |
|
112 | - esc_html__( 'Qty %s', 'invoicing' ), |
|
113 | - (float) $item->get_quantity() |
|
114 | - ) |
|
115 | - ); |
|
116 | - } |
|
117 | - |
|
118 | - if ( $has_featured_image ) { |
|
119 | - echo '</div>'; |
|
120 | - echo '</div>'; |
|
121 | - } |
|
122 | - } |
|
123 | - |
|
124 | - // Item price. |
|
125 | - if ( 'price' === $key ) { |
|
126 | - |
|
127 | - // Set the currency position. |
|
128 | - $position = wpinv_currency_position(); |
|
129 | - |
|
130 | - if ( 'left_space' === $position ) { |
|
131 | - $position = 'left'; |
|
132 | - } |
|
133 | - |
|
134 | - if ( 'right_space' === $position ) { |
|
135 | - $position = 'right'; |
|
136 | - } |
|
137 | - |
|
138 | - if ( $item->user_can_set_their_price() ) { |
|
139 | - $price = max( (float) $item->get_price(), (float) $item->get_minimum_price() ); |
|
140 | - $minimum = (float) $item->get_minimum_price(); |
|
141 | - $validate_minimum = ''; |
|
142 | - $class = ''; |
|
143 | - $data_minimum = ''; |
|
144 | - |
|
145 | - if ( $minimum > 0 ) { |
|
146 | - $validate_minimum = sprintf( |
|
147 | - // translators: %s is the minimum price. |
|
148 | - esc_attr__( 'The minimum allowed amount is %s', 'invoicing' ), |
|
149 | - wp_strip_all_tags( wpinv_price( $minimum, $currency ) ) |
|
150 | - ); |
|
151 | - |
|
152 | - $class = 'getpaid-validate-minimum-amount'; |
|
153 | - |
|
154 | - $data_minimum = "data-minimum-amount='" . esc_attr( getpaid_unstandardize_amount( $minimum ) ) . "'"; |
|
155 | - } |
|
156 | - |
|
157 | - ?> |
|
158 | - <div class="input-group input-group-sm"> |
|
102 | + (float) $item->get_quantity() == 0 ? 1 : (float) $item->get_quantity(), |
|
103 | + floatval( null !== $max_qty ? $max_qty : 1000000000000 ) |
|
104 | + ) |
|
105 | + ) |
|
106 | + ); |
|
107 | + } else { |
|
108 | + printf( |
|
109 | + '<small class="d-sm-none text-muted form-text">%s</small>', |
|
110 | + sprintf( |
|
111 | + // translators: %s is the item quantity. |
|
112 | + esc_html__( 'Qty %s', 'invoicing' ), |
|
113 | + (float) $item->get_quantity() |
|
114 | + ) |
|
115 | + ); |
|
116 | + } |
|
117 | + |
|
118 | + if ( $has_featured_image ) { |
|
119 | + echo '</div>'; |
|
120 | + echo '</div>'; |
|
121 | + } |
|
122 | + } |
|
123 | + |
|
124 | + // Item price. |
|
125 | + if ( 'price' === $key ) { |
|
126 | + |
|
127 | + // Set the currency position. |
|
128 | + $position = wpinv_currency_position(); |
|
129 | + |
|
130 | + if ( 'left_space' === $position ) { |
|
131 | + $position = 'left'; |
|
132 | + } |
|
133 | + |
|
134 | + if ( 'right_space' === $position ) { |
|
135 | + $position = 'right'; |
|
136 | + } |
|
137 | + |
|
138 | + if ( $item->user_can_set_their_price() ) { |
|
139 | + $price = max( (float) $item->get_price(), (float) $item->get_minimum_price() ); |
|
140 | + $minimum = (float) $item->get_minimum_price(); |
|
141 | + $validate_minimum = ''; |
|
142 | + $class = ''; |
|
143 | + $data_minimum = ''; |
|
144 | + |
|
145 | + if ( $minimum > 0 ) { |
|
146 | + $validate_minimum = sprintf( |
|
147 | + // translators: %s is the minimum price. |
|
148 | + esc_attr__( 'The minimum allowed amount is %s', 'invoicing' ), |
|
149 | + wp_strip_all_tags( wpinv_price( $minimum, $currency ) ) |
|
150 | + ); |
|
151 | + |
|
152 | + $class = 'getpaid-validate-minimum-amount'; |
|
153 | + |
|
154 | + $data_minimum = "data-minimum-amount='" . esc_attr( getpaid_unstandardize_amount( $minimum ) ) . "'"; |
|
155 | + } |
|
156 | + |
|
157 | + ?> |
|
158 | + <div class="input-group input-group-sm"> |
|
159 | 159 | <?php if ( 'left' === $position ) : ?> |
160 | - <?php if ( empty( $GLOBALS['aui_bs5'] ) ) : ?> |
|
160 | + <?php if ( empty( $GLOBALS['aui_bs5'] ) ) : ?> |
|
161 | 161 | <div class="input-group-prepend "> |
162 | 162 | <span class="input-group-text"> |
163 | 163 | <?php echo wp_kses_post( wpinv_currency_symbol( $currency ) ); ?></span> |
164 | 164 | </span> |
165 | 165 | </div> |
166 | 166 | <?php else : ?> |
167 | - <span class="input-group-text"> |
|
167 | + <span class="input-group-text"> |
|
168 | 168 | <?php echo wp_kses_post( wpinv_currency_symbol( $currency ) ); ?></span> |
169 | 169 | </span> |
170 | 170 | <?php endif; ?> |
171 | - <?php endif; ?> |
|
171 | + <?php endif; ?> |
|
172 | 172 | |
173 | 173 | <input type="number" step="0.01" <?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;"> |
174 | 174 | |
175 | 175 | <?php if ( ! empty( $validate_minimum ) ) : ?> |
176 | - <div class="invalid-tooltip"> |
|
176 | + <div class="invalid-tooltip"> |
|
177 | 177 | <?php echo wp_kses_post( $validate_minimum ); ?> |
178 | - </div> |
|
178 | + </div> |
|
179 | 179 | <?php endif; ?> |
180 | - |
|
180 | + |
|
181 | 181 | <?php if ( 'left' !== $position ) : ?> |
182 | - <?php if ( empty( $GLOBALS['aui_bs5'] ) ) : ?> |
|
182 | + <?php if ( empty( $GLOBALS['aui_bs5'] ) ) : ?> |
|
183 | 183 | <div class="input-group-append "> |
184 | 184 | <span class="input-group-text"> |
185 | 185 | <?php echo wp_kses_post( wpinv_currency_symbol( $currency ) ); ?></span> |
186 | 186 | </span> |
187 | 187 | </div> |
188 | 188 | <?php else : ?> |
189 | - <span class="input-group-text"> |
|
189 | + <span class="input-group-text"> |
|
190 | 190 | <?php echo wp_kses_post( wpinv_currency_symbol( $currency ) ); ?></span> |
191 | 191 | </span> |
192 | 192 | <?php endif; ?> |
193 | - <?php endif; ?> |
|
194 | - </div> |
|
193 | + <?php endif; ?> |
|
194 | + </div> |
|
195 | 195 | |
196 | 196 | <?php |
197 | 197 | |
198 | - } else { |
|
199 | - ?> |
|
200 | - <span class="getpaid-items-<?php echo (int) $item->get_id(); ?>-view-price"> |
|
198 | + } else { |
|
199 | + ?> |
|
200 | + <span class="getpaid-items-<?php echo (int) $item->get_id(); ?>-view-price"> |
|
201 | 201 | <?php echo wp_kses_post( wpinv_price( $item->get_price(), $currency ) ); ?> |
202 | 202 | </span> |
203 | 203 | <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() ); ?>'> |
204 | 204 | <?php |
205 | - } |
|
205 | + } |
|
206 | 206 | |
207 | - printf( |
|
208 | - '<small class="d-sm-none text-muted form-text getpaid-mobile-item-subtotal">%s</small>', |
|
209 | - // translators: %s is the item subtotal. |
|
210 | - sprintf( esc_html__( 'Subtotal: %s', 'invoicing' ), wp_kses_post( wpinv_price( $item->get_sub_total(), $currency ) ) ) |
|
211 | - ); |
|
212 | - } |
|
207 | + printf( |
|
208 | + '<small class="d-sm-none text-muted form-text getpaid-mobile-item-subtotal">%s</small>', |
|
209 | + // translators: %s is the item subtotal. |
|
210 | + sprintf( esc_html__( 'Subtotal: %s', 'invoicing' ), wp_kses_post( wpinv_price( $item->get_sub_total(), $currency ) ) ) |
|
211 | + ); |
|
212 | + } |
|
213 | 213 | |
214 | - // Item quantity. |
|
215 | - if ( 'quantity' === $key ) { |
|
214 | + // Item quantity. |
|
215 | + if ( 'quantity' === $key ) { |
|
216 | 216 | |
217 | - if ( $item->allows_quantities() ) { |
|
218 | - ?> |
|
219 | - <input name='getpaid-items[<?php echo (int) $item->get_id(); ?>][quantity]' type="number" step="any" 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> |
|
217 | + if ( $item->allows_quantities() ) { |
|
218 | + ?> |
|
219 | + <input name='getpaid-items[<?php echo (int) $item->get_id(); ?>][quantity]' type="number" step="any" 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> |
|
220 | 220 | <?php |
221 | - } else { |
|
222 | - ?> |
|
223 | - <span class="getpaid-items-<?php echo (int) $item->get_id(); ?>-view-quantity"> |
|
221 | + } else { |
|
222 | + ?> |
|
223 | + <span class="getpaid-items-<?php echo (int) $item->get_id(); ?>-view-quantity"> |
|
224 | 224 | <?php echo (float) $item->get_quantity(); ?> |
225 | 225 | </span> |
226 | 226 | <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(); ?>'> |
227 | 227 | <?php |
228 | - } |
|
228 | + } |
|
229 | 229 | } |
230 | 230 | |
231 | - // Item sub total. |
|
232 | - if ( 'subtotal' === $key ) { |
|
233 | - echo wp_kses_post( wpinv_price( $item->get_sub_total(), $currency ) ); |
|
234 | - } |
|
231 | + // Item sub total. |
|
232 | + if ( 'subtotal' === $key ) { |
|
233 | + echo wp_kses_post( wpinv_price( $item->get_sub_total(), $currency ) ); |
|
234 | + } |
|
235 | 235 | |
236 | - do_action( "getpaid_payment_form_cart_item_$key", $item, $form ); |
|
237 | - ?> |
|
236 | + do_action( "getpaid_payment_form_cart_item_$key", $item, $form ); |
|
237 | + ?> |
|
238 | 238 | |
239 | 239 | </div> |
240 | 240 | |
@@ -244,4 +244,4 @@ discard block |
||
244 | 244 | |
245 | 245 | </div> |
246 | 246 | <?php |
247 | -do_action( 'getpaid_payment_form_cart_item', $form, $item ); |
|
247 | + do_action( 'getpaid_payment_form_cart_item', $form, $item ); |
@@ -1,4 +1,4 @@ discard block |
||
1 | -<?php |
|
1 | + <?php |
|
2 | 2 | /** |
3 | 3 | * Displays the cart in a payment form |
4 | 4 | * |
@@ -7,33 +7,33 @@ discard block |
||
7 | 7 | * @version 1.0.19 |
8 | 8 | */ |
9 | 9 | |
10 | -defined( 'ABSPATH' ) || exit; |
|
10 | + defined( 'ABSPATH' ) || exit; |
|
11 | 11 | |
12 | -// Cart table columns. |
|
13 | -$columns = array( |
|
14 | - 'name' => __( 'Item', 'invoicing' ), |
|
15 | - 'price' => __( 'Price', 'invoicing' ), |
|
16 | - 'quantity' => __( 'Qty', 'invoicing' ), |
|
17 | - 'subtotal' => __( 'Subtotal', 'invoicing' ), |
|
18 | -); |
|
12 | + // Cart table columns. |
|
13 | + $columns = array( |
|
14 | + 'name' => __( 'Item', 'invoicing' ), |
|
15 | + 'price' => __( 'Price', 'invoicing' ), |
|
16 | + 'quantity' => __( 'Qty', 'invoicing' ), |
|
17 | + 'subtotal' => __( 'Subtotal', 'invoicing' ), |
|
18 | + ); |
|
19 | 19 | |
20 | -if ( ! empty( $form->invoice ) ) { |
|
21 | - $columns = getpaid_invoice_item_columns( $form->invoice ); |
|
20 | + if ( ! empty( $form->invoice ) ) { |
|
21 | + $columns = getpaid_invoice_item_columns( $form->invoice ); |
|
22 | 22 | } |
23 | 23 | |
24 | -if ( isset( $columns['tax_rate'] ) ) { |
|
25 | - unset( $columns['tax_rate'] ); |
|
24 | + if ( isset( $columns['tax_rate'] ) ) { |
|
25 | + unset( $columns['tax_rate'] ); |
|
26 | 26 | } |
27 | 27 | |
28 | -$columns = apply_filters( 'getpaid_payment_form_cart_table_columns', $columns, $form ); |
|
28 | + $columns = apply_filters( 'getpaid_payment_form_cart_table_columns', $columns, $form ); |
|
29 | 29 | |
30 | -?> |
|
30 | + ?> |
|
31 | 31 | <div class="getpaid-payment-form-items-cart border form-group mb-3"> |
32 | 32 | |
33 | 33 | <div class="getpaid-payment-form-items-cart-header font-weight-bold bg-light border-bottom py-2 px-3"> |
34 | 34 | <div class="form-row row"> |
35 | 35 | <?php foreach ( $columns as $key => $label ) : ?> |
36 | - <div class="<?php echo 'name' == $key ? 'col-6' : 'col'; ?> <?php echo ( in_array( $key, array( 'subtotal', 'quantity', 'tax_rate' ) ) ) ? 'd-none d-sm-block' : ''; ?> getpaid-form-cart-item-<?php echo esc_attr( $key ); ?>"> |
|
36 | + <div class="<?php echo 'name' == $key ? 'col-6' : 'col'; ?> <?php echo ( in_array( $key, array( 'subtotal', 'quantity', 'tax_rate' ) ) ) ? 'd-none d-sm-block' : ''; ?> getpaid-form-cart-item-<?php echo esc_attr( $key ); ?>"> |
|
37 | 37 | <span><?php echo esc_html( $label ); ?></span> |
38 | 38 | </div> |
39 | 39 | <?php endforeach; ?> |
@@ -42,17 +42,17 @@ discard block |
||
42 | 42 | |
43 | 43 | <?php |
44 | 44 | |
45 | - // Display the item totals. |
|
46 | - foreach ( $form->get_items() as $item ) { |
|
47 | - wpinv_get_template( 'payment-forms/cart-item.php', compact( 'form', 'item', 'columns' ) ); |
|
48 | - } |
|
45 | + // Display the item totals. |
|
46 | + foreach ( $form->get_items() as $item ) { |
|
47 | + wpinv_get_template( 'payment-forms/cart-item.php', compact( 'form', 'item', 'columns' ) ); |
|
48 | + } |
|
49 | 49 | |
50 | - // Display the cart totals. |
|
51 | - wpinv_get_template( 'payment-forms/cart-totals.php', compact( 'form' ) ); |
|
50 | + // Display the cart totals. |
|
51 | + wpinv_get_template( 'payment-forms/cart-totals.php', compact( 'form' ) ); |
|
52 | 52 | |
53 | - ?> |
|
54 | - </div> |
|
53 | + ?> |
|
54 | + </div> |
|
55 | 55 | |
56 | -<?php |
|
56 | + <?php |
|
57 | 57 | |
58 | -do_action( 'getpaid_after_payment_form_cart', $form ); |
|
58 | + do_action( 'getpaid_after_payment_form_cart', $form ); |