@@ -1,4 +1,4 @@ discard block |
||
1 | -<?php |
|
1 | + <?php |
|
2 | 2 | /** |
3 | 3 | * Displays right side of the invoice header. |
4 | 4 | * |
@@ -8,56 +8,56 @@ discard block |
||
8 | 8 | * @var WPInv_Invoice $invoice |
9 | 9 | */ |
10 | 10 | |
11 | -defined( 'ABSPATH' ) || exit; |
|
11 | + defined( 'ABSPATH' ) || exit; |
|
12 | 12 | |
13 | -?> |
|
13 | + ?> |
|
14 | 14 | |
15 | 15 | <div class="getpaid-header-right-actions"> |
16 | 16 | |
17 | 17 | <?php |
18 | 18 | |
19 | - $actions = array(); |
|
19 | + $actions = array(); |
|
20 | 20 | |
21 | - echo sprintf( |
|
22 | - '<a href="javascript:void(0)" class="btn btn-sm m-1 d-inline-block btn-secondary text-white invoice-action-print d-none d-lg-inline-block" onclick="window.print();">%s</a>', |
|
23 | - sprintf( |
|
24 | - esc_html__( 'Print %s', 'invoicing' ), |
|
25 | - esc_html( ucfirst( $invoice->get_invoice_quote_type() ) ) |
|
26 | - ) |
|
27 | - ); |
|
28 | - |
|
29 | - if ( is_user_logged_in() ) { |
|
30 | - |
|
31 | - $actions[] = sprintf( |
|
32 | - '<a href="%s" class="btn btn-sm btn-secondary text-white m-1 d-inline-block invoice-action-history">%s</a>', |
|
33 | - esc_url( wpinv_get_history_page_uri( $invoice->get_post_type() ) ), |
|
21 | + echo sprintf( |
|
22 | + '<a href="javascript:void(0)" class="btn btn-sm m-1 d-inline-block btn-secondary text-white invoice-action-print d-none d-lg-inline-block" onclick="window.print();">%s</a>', |
|
34 | 23 | sprintf( |
35 | - __( '%s History', 'invoicing' ), |
|
24 | + esc_html__( 'Print %s', 'invoicing' ), |
|
36 | 25 | esc_html( ucfirst( $invoice->get_invoice_quote_type() ) ) |
37 | 26 | ) |
38 | 27 | ); |
39 | 28 | |
40 | - } |
|
29 | + if ( is_user_logged_in() ) { |
|
41 | 30 | |
42 | - if ( wpinv_current_user_can_manage_invoicing() ) { |
|
31 | + $actions[] = sprintf( |
|
32 | + '<a href="%s" class="btn btn-sm btn-secondary text-white m-1 d-inline-block invoice-action-history">%s</a>', |
|
33 | + esc_url( wpinv_get_history_page_uri( $invoice->get_post_type() ) ), |
|
34 | + sprintf( |
|
35 | + __( '%s History', 'invoicing' ), |
|
36 | + esc_html( ucfirst( $invoice->get_invoice_quote_type() ) ) |
|
37 | + ) |
|
38 | + ); |
|
43 | 39 | |
44 | - $actions[] = sprintf( |
|
45 | - '<a href="%s" class="btn btn-sm btn-secondary text-white m-1 d-inline-block invoice-action-edit">%s</a>', |
|
46 | - esc_url( get_edit_post_link( $invoice->get_id() ) ), |
|
47 | - sprintf( |
|
48 | - __( 'Edit %s', 'invoicing' ), |
|
49 | - esc_html( ucfirst( $invoice->get_invoice_quote_type() ) ) |
|
50 | - ) |
|
51 | - ); |
|
40 | + } |
|
41 | + |
|
42 | + if ( wpinv_current_user_can_manage_invoicing() ) { |
|
52 | 43 | |
53 | - } |
|
44 | + $actions[] = sprintf( |
|
45 | + '<a href="%s" class="btn btn-sm btn-secondary text-white m-1 d-inline-block invoice-action-edit">%s</a>', |
|
46 | + esc_url( get_edit_post_link( $invoice->get_id() ) ), |
|
47 | + sprintf( |
|
48 | + __( 'Edit %s', 'invoicing' ), |
|
49 | + esc_html( ucfirst( $invoice->get_invoice_quote_type() ) ) |
|
50 | + ) |
|
51 | + ); |
|
54 | 52 | |
55 | - $actions = apply_filters( 'getpaid_invoice_header_right_actions_array', $actions, $invoice ); |
|
56 | - echo wp_kses_post( implode( '', $actions ) ); |
|
53 | + } |
|
57 | 54 | |
58 | - ?> |
|
55 | + $actions = apply_filters( 'getpaid_invoice_header_right_actions_array', $actions, $invoice ); |
|
56 | + echo wp_kses_post( implode( '', $actions ) ); |
|
59 | 57 | |
58 | + ?> |
|
59 | + |
|
60 | 60 | <?php do_action( 'wpinv_invoice_display_right_actions', $invoice ); ?> |
61 | - </div> |
|
61 | + </div> |
|
62 | 62 | |
63 | -<?php |
|
63 | + <?php |
@@ -1,4 +1,4 @@ discard block |
||
1 | -<?php |
|
1 | + <?php |
|
2 | 2 | |
3 | 3 | /** |
4 | 4 | * Displays invoice cart totals |
@@ -9,14 +9,14 @@ discard block |
||
9 | 9 | * @var WPInv_Invoice $invoice |
10 | 10 | */ |
11 | 11 | |
12 | -defined( 'ABSPATH' ) || exit; |
|
12 | + defined( 'ABSPATH' ) || exit; |
|
13 | 13 | |
14 | -// Totals rows. |
|
15 | -$totals = getpaid_invoice_totals_rows( $invoice ); |
|
14 | + // Totals rows. |
|
15 | + $totals = getpaid_invoice_totals_rows( $invoice ); |
|
16 | 16 | |
17 | -do_action( 'getpaid_before_invoice_line_totals', $invoice, $totals ); |
|
17 | + do_action( 'getpaid_before_invoice_line_totals', $invoice, $totals ); |
|
18 | 18 | |
19 | -?> |
|
19 | + ?> |
|
20 | 20 | <div class='getpaid-invoice-line-totals'> |
21 | 21 | <div class="row"> |
22 | 22 | <div class="col-12 offset-sm-6 col-sm-6 border-sm-left pl-sm-0"> |
@@ -35,65 +35,65 @@ discard block |
||
35 | 35 | |
36 | 36 | <?php |
37 | 37 | |
38 | - // Total tax. |
|
39 | - if ( 'tax' === $key ) { |
|
40 | - wpinv_the_price( $invoice->get_total_tax(), $invoice->get_currency() ); |
|
38 | + // Total tax. |
|
39 | + if ( 'tax' === $key ) { |
|
40 | + wpinv_the_price( $invoice->get_total_tax(), $invoice->get_currency() ); |
|
41 | 41 | |
42 | - if ( wpinv_use_taxes() && ! $invoice->get_disable_taxes() ) { |
|
42 | + if ( wpinv_use_taxes() && ! $invoice->get_disable_taxes() ) { |
|
43 | 43 | |
44 | - $taxes = $invoice->get_total_tax(); |
|
45 | - if ( empty( $taxes ) && GetPaid_Payment_Form_Submission_Taxes::is_eu_transaction( $invoice->get_country() ) ) { |
|
46 | - echo ' <em class="text-muted small">'; |
|
47 | - _x( '(Reverse charged)', 'This is a legal term for reverse charging tax in the EU', 'invoicing' ); |
|
48 | - echo '</em>'; |
|
44 | + $taxes = $invoice->get_total_tax(); |
|
45 | + if ( empty( $taxes ) && GetPaid_Payment_Form_Submission_Taxes::is_eu_transaction( $invoice->get_country() ) ) { |
|
46 | + echo ' <em class="text-muted small">'; |
|
47 | + _x( '(Reverse charged)', 'This is a legal term for reverse charging tax in the EU', 'invoicing' ); |
|
48 | + echo '</em>'; |
|
49 | + } |
|
49 | 50 | } |
50 | 51 | } |
51 | - } |
|
52 | 52 | |
53 | - // Check if field starts with tax__. |
|
54 | - if ( 0 === strpos( $key, 'tax__' ) ) { |
|
55 | - $tax_amount = $invoice->get_tax_total_by_name( str_replace( 'tax__', '', $key ) ); |
|
56 | - wpinv_the_price( $tax_amount, $invoice->get_currency() ); |
|
53 | + // Check if field starts with tax__. |
|
54 | + if ( 0 === strpos( $key, 'tax__' ) ) { |
|
55 | + $tax_amount = $invoice->get_tax_total_by_name( str_replace( 'tax__', '', $key ) ); |
|
56 | + wpinv_the_price( $tax_amount, $invoice->get_currency() ); |
|
57 | 57 | |
58 | - if ( wpinv_use_taxes() && ! $invoice->get_disable_taxes() ) { |
|
58 | + if ( wpinv_use_taxes() && ! $invoice->get_disable_taxes() ) { |
|
59 | 59 | |
60 | - if ( empty( $tax_amount ) && GetPaid_Payment_Form_Submission_Taxes::is_eu_transaction( $invoice->get_country() ) ) { |
|
61 | - echo ' <em class="text-muted small">'; |
|
62 | - _x( '(Reverse charged)', 'This is a legal term for reverse charging tax in the EU', 'invoicing' ); |
|
63 | - echo '</em>'; |
|
60 | + if ( empty( $tax_amount ) && GetPaid_Payment_Form_Submission_Taxes::is_eu_transaction( $invoice->get_country() ) ) { |
|
61 | + echo ' <em class="text-muted small">'; |
|
62 | + _x( '(Reverse charged)', 'This is a legal term for reverse charging tax in the EU', 'invoicing' ); |
|
63 | + echo '</em>'; |
|
64 | + } |
|
64 | 65 | } |
65 | 66 | } |
66 | - } |
|
67 | 67 | |
68 | - // Total Fee. |
|
69 | - if ( 'fee' === $key ) { |
|
70 | - wpinv_the_price( $invoice->get_total_fees(), $invoice->get_currency() ); |
|
71 | - } |
|
68 | + // Total Fee. |
|
69 | + if ( 'fee' === $key ) { |
|
70 | + wpinv_the_price( $invoice->get_total_fees(), $invoice->get_currency() ); |
|
71 | + } |
|
72 | 72 | |
73 | - // Total discount. |
|
74 | - if ( 'discount' === $key ) { |
|
75 | - wpinv_the_price( $invoice->get_total_discount(), $invoice->get_currency() ); |
|
76 | - } |
|
73 | + // Total discount. |
|
74 | + if ( 'discount' === $key ) { |
|
75 | + wpinv_the_price( $invoice->get_total_discount(), $invoice->get_currency() ); |
|
76 | + } |
|
77 | 77 | |
78 | - // Shipping. |
|
79 | - if ( 'shipping' === $key ) { |
|
80 | - wpinv_the_price( $invoice->get_shipping(), $invoice->get_currency() ); |
|
81 | - } |
|
78 | + // Shipping. |
|
79 | + if ( 'shipping' === $key ) { |
|
80 | + wpinv_the_price( $invoice->get_shipping(), $invoice->get_currency() ); |
|
81 | + } |
|
82 | 82 | |
83 | - // Sub total. |
|
84 | - if ( 'subtotal' === $key ) { |
|
85 | - wpinv_the_price( $invoice->get_subtotal(), $invoice->get_currency() ); |
|
86 | - } |
|
83 | + // Sub total. |
|
84 | + if ( 'subtotal' === $key ) { |
|
85 | + wpinv_the_price( $invoice->get_subtotal(), $invoice->get_currency() ); |
|
86 | + } |
|
87 | 87 | |
88 | - // Total. |
|
89 | - if ( 'total' === $key ) { |
|
90 | - wpinv_the_price( $invoice->get_total(), $invoice->get_currency() ); |
|
91 | - } |
|
88 | + // Total. |
|
89 | + if ( 'total' === $key ) { |
|
90 | + wpinv_the_price( $invoice->get_total(), $invoice->get_currency() ); |
|
91 | + } |
|
92 | 92 | |
93 | - // Fires when printing a cart total. |
|
94 | - do_action( "getpaid_invoice_cart_totals_$key", $invoice ); |
|
93 | + // Fires when printing a cart total. |
|
94 | + do_action( "getpaid_invoice_cart_totals_$key", $invoice ); |
|
95 | 95 | |
96 | - ?> |
|
96 | + ?> |
|
97 | 97 | |
98 | 98 | </div> |
99 | 99 | </div> |
@@ -1,4 +1,4 @@ discard block |
||
1 | -<?php |
|
1 | + <?php |
|
2 | 2 | /** |
3 | 3 | * Displays a discount field in payment form |
4 | 4 | * |
@@ -8,25 +8,25 @@ discard block |
||
8 | 8 | * @var GetPaid_Payment_Form $form The current payment form |
9 | 9 | */ |
10 | 10 | |
11 | -defined( 'ABSPATH' ) || exit; |
|
11 | + defined( 'ABSPATH' ) || exit; |
|
12 | 12 | |
13 | -if ( ! getpaid_has_published_discount() ) { |
|
14 | - return; |
|
13 | + if ( ! getpaid_has_published_discount() ) { |
|
14 | + return; |
|
15 | 15 | } |
16 | 16 | |
17 | -if ( ! empty( $description ) ) { |
|
18 | - $description = "<small class='form-text text-muted'>$description</small>"; |
|
17 | + if ( ! empty( $description ) ) { |
|
18 | + $description = "<small class='form-text text-muted'>$description</small>"; |
|
19 | 19 | } else { |
20 | - $description = ''; |
|
20 | + $description = ''; |
|
21 | 21 | } |
22 | 22 | |
23 | -$discount_code = ''; |
|
24 | -if ( ! empty( $form->invoice ) ) { |
|
25 | - $discount_code = $form->invoice->get_discount_code(); |
|
23 | + $discount_code = ''; |
|
24 | + if ( ! empty( $form->invoice ) ) { |
|
25 | + $discount_code = $form->invoice->get_discount_code(); |
|
26 | 26 | } |
27 | 27 | |
28 | -$class = empty( $class ) ? 'btn-secondary' : sanitize_html_class( $class ); |
|
29 | -?> |
|
28 | + $class = empty( $class ) ? 'btn-secondary' : sanitize_html_class( $class ); |
|
29 | + ?> |
|
30 | 30 | |
31 | 31 | <div class="form-group mb-3"> |
32 | 32 | <div class="getpaid-discount-field border rounded p-3"> |
@@ -1,4 +1,4 @@ discard block |
||
1 | -<?php |
|
1 | + <?php |
|
2 | 2 | /** |
3 | 3 | * Displays an invoice. |
4 | 4 | * |
@@ -7,9 +7,9 @@ discard block |
||
7 | 7 | * @version 1.0.19 |
8 | 8 | */ |
9 | 9 | |
10 | -defined( 'ABSPATH' ) || exit; |
|
10 | + defined( 'ABSPATH' ) || exit; |
|
11 | 11 | |
12 | -?> |
|
12 | + ?> |
|
13 | 13 | |
14 | 14 | <div class="bsui"> |
15 | 15 | |
@@ -17,28 +17,28 @@ discard block |
||
17 | 17 | |
18 | 18 | <?php |
19 | 19 | |
20 | - // Fires when printing the header. |
|
21 | - do_action( 'getpaid_invoice_header', $invoice ); |
|
20 | + // Fires when printing the header. |
|
21 | + do_action( 'getpaid_invoice_header', $invoice ); |
|
22 | 22 | |
23 | - // Print the opening wrapper. |
|
24 | - echo '<div class="container bg-white getpaid-print-no-border border mt-4 mb-4 p-4 position-relative flex-grow-1">'; |
|
23 | + // Print the opening wrapper. |
|
24 | + echo '<div class="container bg-white getpaid-print-no-border border mt-4 mb-4 p-4 position-relative flex-grow-1">'; |
|
25 | 25 | |
26 | - // Print notifications. |
|
27 | - wpinv_print_errors(); |
|
26 | + // Print notifications. |
|
27 | + wpinv_print_errors(); |
|
28 | 28 | |
29 | - // Fires when printing the invoice details. |
|
30 | - do_action( 'getpaid_invoice_details', $invoice ); |
|
29 | + // Fires when printing the invoice details. |
|
30 | + do_action( 'getpaid_invoice_details', $invoice ); |
|
31 | 31 | |
32 | - // Fires when printing the invoice line items. |
|
33 | - do_action( 'getpaid_invoice_line_items', $invoice ); |
|
32 | + // Fires when printing the invoice line items. |
|
33 | + do_action( 'getpaid_invoice_line_items', $invoice ); |
|
34 | 34 | |
35 | - // Print the closing wrapper. |
|
36 | - echo '</div>'; |
|
35 | + // Print the closing wrapper. |
|
36 | + echo '</div>'; |
|
37 | 37 | |
38 | - // Fires when printing the invoice footer. |
|
39 | - do_action( 'getpaid_invoice_footer', $invoice ); |
|
38 | + // Fires when printing the invoice footer. |
|
39 | + do_action( 'getpaid_invoice_footer', $invoice ); |
|
40 | 40 | |
41 | - ?> |
|
41 | + ?> |
|
42 | 42 | |
43 | 43 | </div> |
44 | 44 | </div> |
@@ -1,4 +1,4 @@ discard block |
||
1 | -<?php |
|
1 | + <?php |
|
2 | 2 | /** |
3 | 3 | * Template that generates the subscription active email. |
4 | 4 | * |
@@ -8,15 +8,15 @@ discard block |
||
8 | 8 | * @var WPInv_Subscription $object |
9 | 9 | */ |
10 | 10 | |
11 | -defined( 'ABSPATH' ) || exit; |
|
11 | + defined( 'ABSPATH' ) || exit; |
|
12 | 12 | |
13 | -$invoice = $object->get_parent_payment(); |
|
13 | + $invoice = $object->get_parent_payment(); |
|
14 | 14 | |
15 | -// Print the email header. |
|
16 | -do_action( 'wpinv_email_header', $email_heading, $invoice, $email_type, $sent_to_admin ); |
|
15 | + // Print the email header. |
|
16 | + do_action( 'wpinv_email_header', $email_heading, $invoice, $email_type, $sent_to_admin ); |
|
17 | 17 | |
18 | -// Generate the custom message body. |
|
19 | -echo wp_kses_post( $message_body ); |
|
18 | + // Generate the custom message body. |
|
19 | + echo wp_kses_post( $message_body ); |
|
20 | 20 | |
21 | -// Print the email footer. |
|
22 | -do_action( 'wpinv_email_footer', $invoice, $email_type, $sent_to_admin ); |
|
21 | + // Print the email footer. |
|
22 | + do_action( 'wpinv_email_footer', $invoice, $email_type, $sent_to_admin ); |
@@ -1,4 +1,4 @@ discard block |
||
1 | -<?php |
|
1 | + <?php |
|
2 | 2 | /** |
3 | 3 | * Template that prints additional code in the footer when viewing a blog on the frontend.. |
4 | 4 | * |
@@ -7,10 +7,10 @@ discard block |
||
7 | 7 | * @version 1.0.19 |
8 | 8 | */ |
9 | 9 | |
10 | -defined( 'ABSPATH' ) || exit; |
|
10 | + defined( 'ABSPATH' ) || exit; |
|
11 | 11 | |
12 | -global $aui_bs5; |
|
13 | -?> |
|
12 | + global $aui_bs5; |
|
13 | + ?> |
|
14 | 14 | |
15 | 15 | <div class="bsui"> |
16 | 16 | <div id="getpaid-payment-modal" class="modal" tabindex="-1" role="dialog"> |
@@ -19,7 +19,7 @@ discard block |
||
19 | 19 | <div class="modal-body"> |
20 | 20 | <button type="button" class=" btn-close p-2 getpaid-payment-modal-close d-sm-none" data-<?php echo $aui_bs5 ? 'bs-' : ''; ?>dismiss="modal" aria-label="<?php esc_attr__( 'Close', 'invoicing' ); ?>"> |
21 | 21 | <?php if ( empty( $aui_bs5 ) ) : ?> |
22 | - <span aria-hidden="true">×</span> |
|
22 | + <span aria-hidden="true">×</span> |
|
23 | 23 | <?php endif; ?> |
24 | 24 | </button> |
25 | 25 | <div class="modal-body-wrapper"></div> |
@@ -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,46 +9,46 @@ 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() ); |
|
16 | + $currency = $form->get_currency(); |
|
17 | + $max_qty = wpinv_item_max_buyable_quantity( $item->get_id() ); |
|
18 | 18 | |
19 | -$has_variable_pricing = $item->has_variable_pricing(); |
|
20 | -$price_id = $has_variable_pricing ? $variable_price_id : $item->get_id(); |
|
19 | + $has_variable_pricing = $item->has_variable_pricing(); |
|
20 | + $price_id = $has_variable_pricing ? $variable_price_id : $item->get_id(); |
|
21 | 21 | |
22 | -// helper item to display subscription text. |
|
23 | -$helper_item = clone $item; |
|
24 | -$helper_item->set_id( 0 ); |
|
22 | + // helper item to display subscription text. |
|
23 | + $helper_item = clone $item; |
|
24 | + $helper_item->set_id( 0 ); |
|
25 | 25 | |
26 | -if ( $has_variable_pricing && (isset( $price['is-recurring'] ) && 'yes' === $price['is-recurring']) ) { |
|
27 | - $helper_item->set_price( $price['amount'] ); |
|
26 | + if ( $has_variable_pricing && (isset( $price['is-recurring'] ) && 'yes' === $price['is-recurring']) ) { |
|
27 | + $helper_item->set_price( $price['amount'] ); |
|
28 | 28 | |
29 | - if ( isset( $price['trial-interval'], $price['trial-period'] ) && $price['trial-interval'] > 0 ) { |
|
30 | - $trial_interval = (int) $price['trial-interval']; |
|
31 | - $trial_period = $price['trial-period']; |
|
29 | + if ( isset( $price['trial-interval'], $price['trial-period'] ) && $price['trial-interval'] > 0 ) { |
|
30 | + $trial_interval = (int) $price['trial-interval']; |
|
31 | + $trial_period = $price['trial-period']; |
|
32 | 32 | |
33 | - $helper_item->set_is_free_trial( 1 ); |
|
34 | - $helper_item->set_trial_interval( $trial_interval ); |
|
35 | - $helper_item->set_trial_period( $trial_period ); |
|
36 | - } |
|
33 | + $helper_item->set_is_free_trial( 1 ); |
|
34 | + $helper_item->set_trial_interval( $trial_interval ); |
|
35 | + $helper_item->set_trial_period( $trial_period ); |
|
36 | + } |
|
37 | 37 | |
38 | - if ( isset( $price['recurring-interval'], $price['recurring-period'] ) && $price['recurring-interval'] > 0 ) { |
|
39 | - $recurring_interval = (int) $price['recurring-interval']; |
|
40 | - $recurring_period = $price['recurring-period']; |
|
41 | - $recurring_limit = isset( $price['recurring-limit'] ) ? (int) $price['recurring-limit'] : 0; |
|
38 | + if ( isset( $price['recurring-interval'], $price['recurring-period'] ) && $price['recurring-interval'] > 0 ) { |
|
39 | + $recurring_interval = (int) $price['recurring-interval']; |
|
40 | + $recurring_period = $price['recurring-period']; |
|
41 | + $recurring_limit = isset( $price['recurring-limit'] ) ? (int) $price['recurring-limit'] : 0; |
|
42 | 42 | |
43 | - $helper_item->set_is_recurring( 1 ); |
|
44 | - $helper_item->set_recurring_interval( $recurring_interval ); |
|
45 | - $helper_item->set_recurring_period( $recurring_period ); |
|
46 | - $helper_item->set_recurring_limit( $recurring_limit ); |
|
47 | - } |
|
43 | + $helper_item->set_is_recurring( 1 ); |
|
44 | + $helper_item->set_recurring_interval( $recurring_interval ); |
|
45 | + $helper_item->set_recurring_period( $recurring_period ); |
|
46 | + $helper_item->set_recurring_limit( $recurring_limit ); |
|
47 | + } |
|
48 | 48 | } |
49 | 49 | |
50 | -?> |
|
51 | -<div class='getpaid-payment-form-items-cart-item getpaid-<?php echo $item->is_required() ? 'required' : 'selectable'; ?> item-<?php echo (int) $price_id; ?> border-bottom py-2 px-3'> |
|
50 | + ?> |
|
51 | + <div class='getpaid-payment-form-items-cart-item getpaid-<?php echo $item->is_required() ? 'required' : 'selectable'; ?> item-<?php echo (int) $price_id; ?> border-bottom py-2 px-3'> |
|
52 | 52 | |
53 | 53 | <div class="form-row row align-items-center needs-validation"> |
54 | 54 | |
@@ -58,87 +58,87 @@ discard block |
||
58 | 58 | |
59 | 59 | <?php |
60 | 60 | |
61 | - // Fires before printing a line item column. |
|
62 | - do_action( "getpaid_form_cart_item_before_$key", $item, $form ); |
|
61 | + // Fires before printing a line item column. |
|
62 | + do_action( "getpaid_form_cart_item_before_$key", $item, $form ); |
|
63 | 63 | |
64 | - // Item name. |
|
65 | - if ( 'name' === $key ) { |
|
66 | - ob_start(); |
|
64 | + // Item name. |
|
65 | + if ( 'name' === $key ) { |
|
66 | + ob_start(); |
|
67 | 67 | |
68 | - // Add an optional description. |
|
69 | - $description = $item->get_description(); |
|
68 | + // Add an optional description. |
|
69 | + $description = $item->get_description(); |
|
70 | 70 | |
71 | - if ( ! empty( $description ) ) { |
|
72 | - echo "<small class='form-text text-muted pr-2 m-0'>" . wp_kses_post( $description ) . '</small>'; |
|
73 | - } |
|
71 | + if ( ! empty( $description ) ) { |
|
72 | + echo "<small class='form-text text-muted pr-2 m-0'>" . wp_kses_post( $description ) . '</small>'; |
|
73 | + } |
|
74 | 74 | |
75 | - // Price help text. |
|
76 | - $description = getpaid_item_recurring_price_help_text( $helper_item, $currency ); |
|
77 | - if ( $description ) { |
|
78 | - echo "<small class='getpaid-form-item-price-desc form-text text-muted font-italic pr-2 m-0'>" . wp_kses_post( $description ) . '</small>'; |
|
79 | - } |
|
75 | + // Price help text. |
|
76 | + $description = getpaid_item_recurring_price_help_text( $helper_item, $currency ); |
|
77 | + if ( $description ) { |
|
78 | + echo "<small class='getpaid-form-item-price-desc form-text text-muted font-italic pr-2 m-0'>" . wp_kses_post( $description ) . '</small>'; |
|
79 | + } |
|
80 | 80 | |
81 | - do_action( 'getpaid_payment_form_cart_item_description', $item, $form ); |
|
81 | + do_action( 'getpaid_payment_form_cart_item_description', $item, $form ); |
|
82 | 82 | |
83 | - if ( wpinv_current_user_can_manage_invoicing() ) { |
|
83 | + if ( wpinv_current_user_can_manage_invoicing() ) { |
|
84 | 84 | |
85 | - edit_post_link( |
|
86 | - __( 'Edit this item.', 'invoicing' ), |
|
87 | - '<small class="form-text text-muted">', |
|
88 | - '</small>', |
|
89 | - $item->get_id(), |
|
90 | - 'text-danger' |
|
91 | - ); |
|
85 | + edit_post_link( |
|
86 | + __( 'Edit this item.', 'invoicing' ), |
|
87 | + '<small class="form-text text-muted">', |
|
88 | + '</small>', |
|
89 | + $item->get_id(), |
|
90 | + 'text-danger' |
|
91 | + ); |
|
92 | 92 | |
93 | - } |
|
93 | + } |
|
94 | 94 | |
95 | - $description = ob_get_clean(); |
|
95 | + $description = ob_get_clean(); |
|
96 | 96 | |
97 | - // Display the name. |
|
98 | - $tootip = empty( $description ) ? '' : ' <i class="fas fa-xs fa-info gp-tooltip d-sm-none text-muted"></i>'; |
|
97 | + // Display the name. |
|
98 | + $tootip = empty( $description ) ? '' : ' <i class="fas fa-xs fa-info gp-tooltip d-sm-none text-muted"></i>'; |
|
99 | 99 | |
100 | - $has_featured_image = has_post_thumbnail( $item->get_id() ); |
|
100 | + $has_featured_image = has_post_thumbnail( $item->get_id() ); |
|
101 | 101 | |
102 | - if ( $has_featured_image || $has_variable_pricing ) { |
|
103 | - echo '<div class="d-flex align-items-center ' . ($has_featured_image ? 'getpaid-form-item-has-featured-image' : '') . '">'; |
|
102 | + if ( $has_featured_image || $has_variable_pricing ) { |
|
103 | + echo '<div class="d-flex align-items-center ' . ($has_featured_image ? 'getpaid-form-item-has-featured-image' : '') . '">'; |
|
104 | 104 | |
105 | - if ( $has_variable_pricing ) { |
|
106 | - echo '<input type="hidden" value="' . esc_attr( $price_id ) . '" name="getpaid-items[' . (int) $price_id . '][price_id]">'; |
|
107 | - echo '<input type="hidden" value="' . esc_attr( $item->get_id() ) . '" name="getpaid-items[' . (int) $price_id . '][item_id]">'; |
|
108 | - echo '<div class="mr-2">'; |
|
109 | - echo '<label class="form-label d-block w-100">'; |
|
110 | - echo '<input class="getpaid-refresh-on-change" type="' . (true === $item->is_multi_price_mode() ? 'checkbox' : 'radio') . '" value="' . esc_attr( $price_id ) . '" name="getpaid-variable-items[]" ' . ( $item->get_default_price_id() === (int) $price_id ? 'checked' : '') . '>'; |
|
111 | - echo '</label>'; |
|
112 | - echo '</div>'; |
|
113 | - } |
|
114 | - |
|
115 | - if ( $has_featured_image ) { |
|
116 | - echo '<div class="getpaid-form-item-image-container mr-2">'; |
|
117 | - echo get_the_post_thumbnail( $item->get_id(), 'thumbnail', array( 'class' => 'getpaid-form-item-image mb-0' ) ); |
|
118 | - echo '</div>'; |
|
105 | + if ( $has_variable_pricing ) { |
|
106 | + echo '<input type="hidden" value="' . esc_attr( $price_id ) . '" name="getpaid-items[' . (int) $price_id . '][price_id]">'; |
|
107 | + echo '<input type="hidden" value="' . esc_attr( $item->get_id() ) . '" name="getpaid-items[' . (int) $price_id . '][item_id]">'; |
|
108 | + echo '<div class="mr-2">'; |
|
109 | + echo '<label class="form-label d-block w-100">'; |
|
110 | + echo '<input class="getpaid-refresh-on-change" type="' . (true === $item->is_multi_price_mode() ? 'checkbox' : 'radio') . '" value="' . esc_attr( $price_id ) . '" name="getpaid-variable-items[]" ' . ( $item->get_default_price_id() === (int) $price_id ? 'checked' : '') . '>'; |
|
111 | + echo '</label>'; |
|
112 | + echo '</div>'; |
|
113 | + } |
|
114 | + |
|
115 | + if ( $has_featured_image ) { |
|
116 | + echo '<div class="getpaid-form-item-image-container mr-2">'; |
|
117 | + echo get_the_post_thumbnail( $item->get_id(), 'thumbnail', array( 'class' => 'getpaid-form-item-image mb-0' ) ); |
|
118 | + echo '</div>'; |
|
119 | + } |
|
120 | + |
|
121 | + echo '<div class="getpaid-form-item-name-container">'; |
|
122 | + } |
|
123 | + |
|
124 | + if ( $item->has_variable_pricing() ) { |
|
125 | + echo '<div class="mb-1 font-weight-bold">' . esc_html( $item->get_name() . ' — ' . $price['name'] . ($helper_item->is_recurring() ? ' ' . __( '(r)', 'invoicing' ) : '') ) . wp_kses_post( $tootip ) . '</div>'; |
|
126 | + } else { |
|
127 | + echo '<div class="mb-1 font-weight-bold">' . esc_html( $item->get_name() ) . wp_kses_post( $tootip ) . '</div>'; |
|
119 | 128 | } |
120 | 129 | |
121 | - echo '<div class="getpaid-form-item-name-container">'; |
|
122 | - } |
|
123 | - |
|
124 | - if ( $item->has_variable_pricing() ) { |
|
125 | - echo '<div class="mb-1 font-weight-bold">' . esc_html( $item->get_name() . ' — ' . $price['name'] . ($helper_item->is_recurring() ? ' ' . __( '(r)', 'invoicing' ) : '') ) . wp_kses_post( $tootip ) . '</div>'; |
|
126 | - } else { |
|
127 | - echo '<div class="mb-1 font-weight-bold">' . esc_html( $item->get_name() ) . wp_kses_post( $tootip ) . '</div>'; |
|
128 | - } |
|
129 | - |
|
130 | - if ( ! empty( $description ) ) { |
|
131 | - printf( '<span class="d-none d-sm-block getpaid-item-desc">%s</span>', wp_kses_post( $description ) ); |
|
132 | - } |
|
133 | - |
|
134 | - if ( $item->allows_quantities() ) { |
|
135 | - printf( |
|
136 | - '<small class="d-sm-none text-muted form-text">%s</small>', |
|
137 | - sprintf( |
|
138 | - // translators: %s is the item quantity. |
|
139 | - esc_html__( 'Qty %s', 'invoicing' ), |
|
140 | - sprintf( |
|
141 | - '<input |
|
130 | + if ( ! empty( $description ) ) { |
|
131 | + printf( '<span class="d-none d-sm-block getpaid-item-desc">%s</span>', wp_kses_post( $description ) ); |
|
132 | + } |
|
133 | + |
|
134 | + if ( $item->allows_quantities() ) { |
|
135 | + printf( |
|
136 | + '<small class="d-sm-none text-muted form-text">%s</small>', |
|
137 | + sprintf( |
|
138 | + // translators: %s is the item quantity. |
|
139 | + esc_html__( 'Qty %s', 'invoicing' ), |
|
140 | + sprintf( |
|
141 | + '<input |
|
142 | 142 | type="number" |
143 | 143 | step="0.01" |
144 | 144 | style="width: 48px;" |
@@ -147,145 +147,145 @@ discard block |
||
147 | 147 | min="1" |
148 | 148 | max="%s" |
149 | 149 | >', |
150 | - (float) $item->get_quantity() == 0 ? 1 : (float) $item->get_quantity(), |
|
151 | - floatval( null !== $max_qty ? $max_qty : 1000000000000 ) |
|
152 | - ) |
|
153 | - ) |
|
154 | - ); |
|
155 | - } else { |
|
156 | - printf( |
|
157 | - '<small class="d-sm-none text-muted form-text">%s</small>', |
|
158 | - sprintf( |
|
159 | - // translators: %s is the item quantity. |
|
160 | - esc_html__( 'Qty %s', 'invoicing' ), |
|
161 | - (float) $item->get_quantity() |
|
162 | - ) |
|
163 | - ); |
|
164 | - } |
|
165 | - |
|
166 | - if ( $has_featured_image || $has_variable_pricing ) { |
|
167 | - echo '</div>'; |
|
168 | - echo '</div>'; |
|
169 | - } |
|
170 | - } |
|
171 | - |
|
172 | - // Item price. |
|
173 | - if ( 'price' === $key ) { |
|
174 | - |
|
175 | - // Set the currency position. |
|
176 | - $position = wpinv_currency_position(); |
|
177 | - |
|
178 | - if ( 'left_space' === $position ) { |
|
179 | - $position = 'left'; |
|
180 | - } |
|
181 | - |
|
182 | - if ( 'right_space' === $position ) { |
|
183 | - $position = 'right'; |
|
150 | + (float) $item->get_quantity() == 0 ? 1 : (float) $item->get_quantity(), |
|
151 | + floatval( null !== $max_qty ? $max_qty : 1000000000000 ) |
|
152 | + ) |
|
153 | + ) |
|
154 | + ); |
|
155 | + } else { |
|
156 | + printf( |
|
157 | + '<small class="d-sm-none text-muted form-text">%s</small>', |
|
158 | + sprintf( |
|
159 | + // translators: %s is the item quantity. |
|
160 | + esc_html__( 'Qty %s', 'invoicing' ), |
|
161 | + (float) $item->get_quantity() |
|
162 | + ) |
|
163 | + ); |
|
164 | + } |
|
165 | + |
|
166 | + if ( $has_featured_image || $has_variable_pricing ) { |
|
167 | + echo '</div>'; |
|
168 | + echo '</div>'; |
|
169 | + } |
|
184 | 170 | } |
185 | 171 | |
186 | - if ( $has_variable_pricing ) { ?> |
|
187 | - <span class="getpaid-items-<?php echo (int) $price_id; ?>-view-price"> |
|
172 | + // Item price. |
|
173 | + if ( 'price' === $key ) { |
|
174 | + |
|
175 | + // Set the currency position. |
|
176 | + $position = wpinv_currency_position(); |
|
177 | + |
|
178 | + if ( 'left_space' === $position ) { |
|
179 | + $position = 'left'; |
|
180 | + } |
|
181 | + |
|
182 | + if ( 'right_space' === $position ) { |
|
183 | + $position = 'right'; |
|
184 | + } |
|
185 | + |
|
186 | + if ( $has_variable_pricing ) { ?> |
|
187 | + <span class="getpaid-items-<?php echo (int) $price_id; ?>-view-price"> |
|
188 | 188 | <?php echo wp_kses_post( wpinv_price( $price['amount'], $currency ) ); ?> |
189 | 189 | </span> |
190 | 190 | <input name='getpaid-items[<?php echo (int) $price_id; ?>][price]' type='hidden' class='getpaid-item-price-input' value='<?php echo esc_attr( $price['amount'] ); ?>'> |
191 | 191 | <?php } elseif ( $item->user_can_set_their_price() ) { |
192 | - $price = max( (float) $item->get_price(), (float) $item->get_minimum_price() ); |
|
193 | - $minimum = (float) $item->get_minimum_price(); |
|
194 | - $validate_minimum = ''; |
|
195 | - $class = ''; |
|
196 | - $data_minimum = ''; |
|
197 | - |
|
198 | - if ( $minimum > 0 ) { |
|
199 | - $validate_minimum = sprintf( |
|
200 | - // translators: %s is the minimum price. |
|
201 | - esc_attr__( 'The minimum allowed amount is %s', 'invoicing' ), |
|
202 | - wp_strip_all_tags( wpinv_price( $minimum, $currency ) ) |
|
203 | - ); |
|
204 | - |
|
205 | - $class = 'getpaid-validate-minimum-amount'; |
|
206 | - |
|
207 | - $data_minimum = "data-minimum-amount='" . esc_attr( getpaid_unstandardize_amount( $minimum ) ) . "'"; |
|
208 | - } |
|
209 | - |
|
210 | - ?> |
|
211 | - <div class="input-group input-group-sm"> |
|
192 | + $price = max( (float) $item->get_price(), (float) $item->get_minimum_price() ); |
|
193 | + $minimum = (float) $item->get_minimum_price(); |
|
194 | + $validate_minimum = ''; |
|
195 | + $class = ''; |
|
196 | + $data_minimum = ''; |
|
197 | + |
|
198 | + if ( $minimum > 0 ) { |
|
199 | + $validate_minimum = sprintf( |
|
200 | + // translators: %s is the minimum price. |
|
201 | + esc_attr__( 'The minimum allowed amount is %s', 'invoicing' ), |
|
202 | + wp_strip_all_tags( wpinv_price( $minimum, $currency ) ) |
|
203 | + ); |
|
204 | + |
|
205 | + $class = 'getpaid-validate-minimum-amount'; |
|
206 | + |
|
207 | + $data_minimum = "data-minimum-amount='" . esc_attr( getpaid_unstandardize_amount( $minimum ) ) . "'"; |
|
208 | + } |
|
209 | + |
|
210 | + ?> |
|
211 | + <div class="input-group input-group-sm"> |
|
212 | 212 | <?php if ( 'left' === $position ) : ?> |
213 | - <?php if ( empty( $GLOBALS['aui_bs5'] ) ) : ?> |
|
213 | + <?php if ( empty( $GLOBALS['aui_bs5'] ) ) : ?> |
|
214 | 214 | <div class="input-group-prepend "> |
215 | 215 | <span class="input-group-text"> |
216 | 216 | <?php echo wp_kses_post( wpinv_currency_symbol( $currency ) ); ?></span> |
217 | 217 | </span> |
218 | 218 | </div> |
219 | 219 | <?php else : ?> |
220 | - <span class="input-group-text"> |
|
220 | + <span class="input-group-text"> |
|
221 | 221 | <?php echo wp_kses_post( wpinv_currency_symbol( $currency ) ); ?></span> |
222 | 222 | </span> |
223 | 223 | <?php endif; ?> |
224 | - <?php endif; ?> |
|
224 | + <?php endif; ?> |
|
225 | 225 | |
226 | 226 | <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;"> |
227 | 227 | |
228 | 228 | <?php if ( ! empty( $validate_minimum ) ) : ?> |
229 | - <div class="invalid-tooltip"> |
|
229 | + <div class="invalid-tooltip"> |
|
230 | 230 | <?php echo wp_kses_post( $validate_minimum ); ?> |
231 | - </div> |
|
231 | + </div> |
|
232 | 232 | <?php endif; ?> |
233 | - |
|
233 | + |
|
234 | 234 | <?php if ( 'left' !== $position ) : ?> |
235 | - <?php if ( empty( $GLOBALS['aui_bs5'] ) ) : ?> |
|
235 | + <?php if ( empty( $GLOBALS['aui_bs5'] ) ) : ?> |
|
236 | 236 | <div class="input-group-append "> |
237 | 237 | <span class="input-group-text"> |
238 | 238 | <?php echo wp_kses_post( wpinv_currency_symbol( $currency ) ); ?></span> |
239 | 239 | </span> |
240 | 240 | </div> |
241 | 241 | <?php else : ?> |
242 | - <span class="input-group-text"> |
|
242 | + <span class="input-group-text"> |
|
243 | 243 | <?php echo wp_kses_post( wpinv_currency_symbol( $currency ) ); ?></span> |
244 | 244 | </span> |
245 | 245 | <?php endif; ?> |
246 | - <?php endif; ?> |
|
247 | - </div> |
|
246 | + <?php endif; ?> |
|
247 | + </div> |
|
248 | 248 | <?php } else { ?> |
249 | - <span class="getpaid-items-<?php echo (int) $item->get_id(); ?>-view-price"> |
|
249 | + <span class="getpaid-items-<?php echo (int) $item->get_id(); ?>-view-price"> |
|
250 | 250 | <?php echo wp_kses_post( wpinv_price( $item->get_price(), $currency ) ); ?> |
251 | 251 | </span> |
252 | 252 | <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() ); ?>'> |
253 | 253 | <?php |
254 | - } |
|
254 | + } |
|
255 | 255 | |
256 | - printf( |
|
257 | - '<small class="d-sm-none text-muted form-text getpaid-mobile-item-subtotal">%s</small>', |
|
258 | - // translators: %s is the item subtotal. |
|
259 | - sprintf( esc_html__( 'Subtotal: %s', 'invoicing' ), wp_kses_post( wpinv_price( $item->get_sub_total(), $currency ) ) ) |
|
260 | - ); |
|
261 | - } |
|
256 | + printf( |
|
257 | + '<small class="d-sm-none text-muted form-text getpaid-mobile-item-subtotal">%s</small>', |
|
258 | + // translators: %s is the item subtotal. |
|
259 | + sprintf( esc_html__( 'Subtotal: %s', 'invoicing' ), wp_kses_post( wpinv_price( $item->get_sub_total(), $currency ) ) ) |
|
260 | + ); |
|
261 | + } |
|
262 | 262 | |
263 | - // Item quantity. |
|
264 | - if ( 'quantity' === $key ) { |
|
263 | + // Item quantity. |
|
264 | + if ( 'quantity' === $key ) { |
|
265 | 265 | |
266 | - if ( $item->allows_quantities() ) { |
|
267 | - ?> |
|
268 | - <input name='getpaid-items[<?php echo (int) $price_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> |
|
266 | + if ( $item->allows_quantities() ) { |
|
267 | + ?> |
|
268 | + <input name='getpaid-items[<?php echo (int) $price_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> |
|
269 | 269 | <?php } else { ?> |
270 | - <span class="getpaid-items-<?php echo (int) $price_id; ?>-view-quantity"> |
|
270 | + <span class="getpaid-items-<?php echo (int) $price_id; ?>-view-quantity"> |
|
271 | 271 | <?php echo (float) $item->get_quantity(); ?> |
272 | 272 | </span> |
273 | 273 | <input type='hidden' name='getpaid-items[<?php echo (int) $price_id; ?>][quantity]' class='getpaid-item-quantity-input' value='<?php echo (float) $item->get_quantity(); ?>'> |
274 | 274 | <?php |
275 | + } |
|
275 | 276 | } |
276 | - } |
|
277 | - |
|
278 | - // Item sub total. |
|
279 | - if ( 'subtotal' === $key ) { |
|
280 | - if( $has_variable_pricing ) { |
|
281 | - echo wp_kses_post( wpinv_price( $item->get_sub_total( 'view', $price_id ), $currency ) ); |
|
282 | - } else { |
|
283 | - echo wp_kses_post( wpinv_price( $item->get_sub_total(), $currency ) ); |
|
284 | - } |
|
285 | - } |
|
286 | 277 | |
287 | - do_action( "getpaid_payment_form_cart_item_$key", $item, $form ); |
|
288 | - ?> |
|
278 | + // Item sub total. |
|
279 | + if ( 'subtotal' === $key ) { |
|
280 | + if( $has_variable_pricing ) { |
|
281 | + echo wp_kses_post( wpinv_price( $item->get_sub_total( 'view', $price_id ), $currency ) ); |
|
282 | + } else { |
|
283 | + echo wp_kses_post( wpinv_price( $item->get_sub_total(), $currency ) ); |
|
284 | + } |
|
285 | + } |
|
286 | + |
|
287 | + do_action( "getpaid_payment_form_cart_item_$key", $item, $form ); |
|
288 | + ?> |
|
289 | 289 | |
290 | 290 | </div> |
291 | 291 | |
@@ -295,4 +295,4 @@ discard block |
||
295 | 295 | |
296 | 296 | </div> |
297 | 297 | <?php |
298 | -do_action( 'getpaid_payment_form_cart_item', $form, $item ); |
|
298 | + 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,25 +42,25 @@ discard block |
||
42 | 42 | |
43 | 43 | <?php |
44 | 44 | |
45 | - // Display the item totals. |
|
46 | - foreach ( $form->get_items() as $item ) { |
|
47 | - $prices = $item->get_variable_prices(); |
|
45 | + // Display the item totals. |
|
46 | + foreach ( $form->get_items() as $item ) { |
|
47 | + $prices = $item->get_variable_prices(); |
|
48 | 48 | |
49 | - if ( $item->has_variable_pricing() ) { |
|
50 | - foreach ( $prices as $variable_price_id => $price ) { |
|
51 | - wpinv_get_template( 'payment-forms/cart-item.php', compact( 'form', 'item', 'variable_price_id', 'price', 'columns' ) ); |
|
49 | + if ( $item->has_variable_pricing() ) { |
|
50 | + foreach ( $prices as $variable_price_id => $price ) { |
|
51 | + wpinv_get_template( 'payment-forms/cart-item.php', compact( 'form', 'item', 'variable_price_id', 'price', 'columns' ) ); |
|
52 | + } |
|
53 | + } else { |
|
54 | + wpinv_get_template( 'payment-forms/cart-item.php', compact( 'form', 'item', 'columns' ) ); |
|
52 | 55 | } |
53 | - } else { |
|
54 | - wpinv_get_template( 'payment-forms/cart-item.php', compact( 'form', 'item', 'columns' ) ); |
|
55 | 56 | } |
56 | - } |
|
57 | 57 | |
58 | - // Display the cart totals. |
|
59 | - wpinv_get_template( 'payment-forms/cart-totals.php', compact( 'form' ) ); |
|
58 | + // Display the cart totals. |
|
59 | + wpinv_get_template( 'payment-forms/cart-totals.php', compact( 'form' ) ); |
|
60 | 60 | |
61 | - ?> |
|
62 | - </div> |
|
61 | + ?> |
|
62 | + </div> |
|
63 | 63 | |
64 | -<?php |
|
64 | + <?php |
|
65 | 65 | |
66 | -do_action( 'getpaid_after_payment_form_cart', $form ); |
|
66 | + do_action( 'getpaid_after_payment_form_cart', $form ); |