@@ -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 | |
@@ -82,28 +82,28 @@ discard block |
||
82 | 82 | |
83 | 83 | <?php |
84 | 84 | // Fires after displaying payment form elements. |
85 | - do_action( 'getpaid_payment_form_after_elements', $form ); |
|
85 | + do_action('getpaid_payment_form_after_elements', $form); |
|
86 | 86 | |
87 | 87 | echo "<div class='getpaid-payment-form-errors alert alert-danger d-none'></div>"; |
88 | 88 | |
89 | - if ( wpinv_current_user_can_manage_invoicing() ) { |
|
89 | + if (wpinv_current_user_can_manage_invoicing()) { |
|
90 | 90 | |
91 | 91 | edit_post_link( |
92 | - __( 'Edit this form.', 'invoicing' ), |
|
92 | + __('Edit this form.', 'invoicing'), |
|
93 | 93 | '<small class="form-text text-muted">', |
94 | - ' ' . __( 'This is only visible to website administators.', 'invoicing' ) . '</small>', |
|
94 | + ' ' . __('This is only visible to website administators.', 'invoicing') . '</small>', |
|
95 | 95 | $form->get_id(), |
96 | 96 | 'text-danger' |
97 | 97 | ); |
98 | 98 | |
99 | 99 | } |
100 | 100 | |
101 | - echo wp_kses_post( $extra_markup ); |
|
101 | + echo wp_kses_post($extra_markup); |
|
102 | 102 | ?> |
103 | 103 | |
104 | 104 | <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;"> |
105 | 105 | <div class="spinner-border mx-auto align-self-center text-white" role="status"> |
106 | - <span class="sr-only"><?php _e( 'Loading...', 'invoicing' );?></span> |
|
106 | + <span class="sr-only"><?php _e('Loading...', 'invoicing'); ?></span> |
|
107 | 107 | </div> |
108 | 108 | </div> |
109 | 109 | |
@@ -112,4 +112,4 @@ discard block |
||
112 | 112 | <?php |
113 | 113 | |
114 | 114 | // Fires after displaying a payment form. |
115 | -do_action( 'getpaid_after_payment_form', $form ); |
|
115 | +do_action('getpaid_after_payment_form', $form); |
@@ -7,14 +7,14 @@ |
||
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 | - $text = __( 'Your IP address is:', 'invoicing' ); |
|
12 | +if (empty($text)) { |
|
13 | + $text = __('Your IP address is:', 'invoicing'); |
|
14 | 14 | } |
15 | 15 | |
16 | 16 | ?> |
17 | 17 | <div class="form-group getpaid-ip-info"> |
18 | - <span><?php echo wp_kses_post( $text ); ?></span> |
|
19 | - <strong><?php echo esc_html( wpinv_get_ip() ); ?></strong> |
|
18 | + <span><?php echo wp_kses_post($text); ?></span> |
|
19 | + <strong><?php echo esc_html(wpinv_get_ip()); ?></strong> |
|
20 | 20 | </div> |
@@ -7,11 +7,11 @@ |
||
7 | 7 | * @version 1.0.19 |
8 | 8 | */ |
9 | 9 | |
10 | -defined( 'ABSPATH' ) || exit; |
|
10 | +defined('ABSPATH') || exit; |
|
11 | 11 | |
12 | -$tag = isset( $element['level'] ) ? trim( sanitize_key( $element['level'] ) ) : 'h3'; |
|
13 | -$text = isset( $element['text'] ) ? wp_kses_post( trim( $element['text'] ) ) : ''; |
|
12 | +$tag = isset($element['level']) ? trim(sanitize_key($element['level'])) : 'h3'; |
|
13 | +$text = isset($element['text']) ? wp_kses_post(trim($element['text'])) : ''; |
|
14 | 14 | |
15 | -if ( ! empty( $text ) ) { |
|
15 | +if (!empty($text)) { |
|
16 | 16 | echo "<$tag>$text</$tag>"; |
17 | 17 | } |
@@ -8,20 +8,20 @@ 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() ) { |
|
13 | +if (!getpaid_has_published_discount()) { |
|
14 | 14 | return; |
15 | 15 | } |
16 | 16 | |
17 | -if ( ! empty( $description ) ) { |
|
17 | +if (!empty($description)) { |
|
18 | 18 | $description = "<small class='form-text text-muted'>$description</small>"; |
19 | 19 | } else { |
20 | 20 | $description = ''; |
21 | 21 | } |
22 | 22 | |
23 | 23 | $discount_code = ''; |
24 | -if ( ! empty( $form->invoice ) ) { |
|
24 | +if (!empty($form->invoice)) { |
|
25 | 25 | $discount_code = $form->invoice->get_discount_code(); |
26 | 26 | } |
27 | 27 | |
@@ -30,12 +30,12 @@ discard block |
||
30 | 30 | <div class="form-group"> |
31 | 31 | <div class="getpaid-discount-field border rounded p-3"> |
32 | 32 | <div class="getpaid-discount-field-inner d-flex flex-column flex-md-row"> |
33 | - <input name="discount" placeholder="<?php echo esc_attr( $input_label ); ?>" value="<?php echo esc_attr( $discount_code ); ?>" class="form-control mr-2 mb-2 getpaid-discount-field-input" style="flex: 1;" type="text"> |
|
34 | - <a href="#" class="btn btn-secondary submit-button mb-2 getpaid-discount-button"><?php echo esc_html( $button_label ); ?></a> |
|
33 | + <input name="discount" placeholder="<?php echo esc_attr($input_label); ?>" value="<?php echo esc_attr($discount_code); ?>" class="form-control mr-2 mb-2 getpaid-discount-field-input" style="flex: 1;" type="text"> |
|
34 | + <a href="#" class="btn btn-secondary submit-button mb-2 getpaid-discount-button"><?php echo esc_html($button_label); ?></a> |
|
35 | 35 | </div> |
36 | - <?php echo wp_kses_post( $description ); ?> |
|
36 | + <?php echo wp_kses_post($description); ?> |
|
37 | 37 | <div class="getpaid-custom-payment-form-errors alert alert-danger d-none"></div> |
38 | - <div class="getpaid-custom-payment-form-success alert alert-success d-none"><?php _e( 'Discount code applied!', 'invoicing' ); ?></div> |
|
38 | + <div class="getpaid-custom-payment-form-success alert alert-success d-none"><?php _e('Discount code applied!', 'invoicing'); ?></div> |
|
39 | 39 | </div> |
40 | 40 | </div> |
41 | 41 |
@@ -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 ); |
|
29 | + // Fires before printing a line item column. |
|
30 | + do_action( "getpaid_form_cart_item_before_$key", $item, $form ); |
|
31 | 31 | |
32 | - // Item name. |
|
33 | - if ( 'name' == $key ) { |
|
32 | + // Item name. |
|
33 | + if ( 'name' == $key ) { |
|
34 | 34 | |
35 | - ob_start(); |
|
36 | - // And an optional description. |
|
35 | + ob_start(); |
|
36 | + // And an optional description. |
|
37 | 37 | $description = $item->get_description(); |
38 | 38 | |
39 | 39 | if ( ! empty( $description ) ) { |
40 | 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 | - // Price help text. |
|
44 | + // Price help text. |
|
45 | 45 | $description = getpaid_item_recurring_price_help_text( $item, $currency ); |
46 | 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 | - 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 | - ); |
|
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 | 61 | |
62 | - } |
|
62 | + } |
|
63 | 63 | |
64 | - $description = ob_get_clean(); |
|
64 | + $description = ob_get_clean(); |
|
65 | 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>'; |
|
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 | 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 |
|
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;" |
@@ -85,56 +85,56 @@ discard block |
||
85 | 85 | value="%s" |
86 | 86 | min="1" |
87 | 87 | %s>', |
88 | - (float) $item->get_quantity() == 0 ? 1 : (float) $item->get_quantity(), |
|
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 | - } |
|
102 | - |
|
103 | - } |
|
104 | - |
|
105 | - // Item price. |
|
106 | - if ( 'price' == $key ) { |
|
107 | - |
|
108 | - // Set the currency position. |
|
109 | - $position = wpinv_currency_position(); |
|
110 | - |
|
111 | - if ( $position == 'left_space' ) { |
|
112 | - $position = 'left'; |
|
113 | - } |
|
114 | - |
|
115 | - if ( $position == 'right_space' ) { |
|
116 | - $position = 'right'; |
|
117 | - } |
|
118 | - |
|
119 | - if ( $item->user_can_set_their_price() ) { |
|
120 | - $price = max( (float) $item->get_price(), (float) $item->get_minimum_price() ); |
|
121 | - $minimum = (float) $item->get_minimum_price(); |
|
122 | - $validate_minimum = ''; |
|
123 | - $class = ''; |
|
124 | - $data_minimum = ''; |
|
125 | - |
|
126 | - if ( $minimum > 0 ) { |
|
127 | - $validate_minimum = sprintf( |
|
128 | - esc_attr__( 'The minimum allowed amount is %s', 'invoicing' ), |
|
129 | - strip_tags( wpinv_price( $minimum, $currency ) ) |
|
130 | - ); |
|
131 | - |
|
132 | - $class = 'getpaid-validate-minimum-amount'; |
|
133 | - |
|
134 | - $data_minimum = "data-minimum-amount='" . esc_attr( getpaid_unstandardize_amount( $minimum ) ) . "'"; |
|
135 | - } |
|
136 | - |
|
137 | - ?> |
|
88 | + (float) $item->get_quantity() == 0 ? 1 : (float) $item->get_quantity(), |
|
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 | + } |
|
102 | + |
|
103 | + } |
|
104 | + |
|
105 | + // Item price. |
|
106 | + if ( 'price' == $key ) { |
|
107 | + |
|
108 | + // Set the currency position. |
|
109 | + $position = wpinv_currency_position(); |
|
110 | + |
|
111 | + if ( $position == 'left_space' ) { |
|
112 | + $position = 'left'; |
|
113 | + } |
|
114 | + |
|
115 | + if ( $position == 'right_space' ) { |
|
116 | + $position = 'right'; |
|
117 | + } |
|
118 | + |
|
119 | + if ( $item->user_can_set_their_price() ) { |
|
120 | + $price = max( (float) $item->get_price(), (float) $item->get_minimum_price() ); |
|
121 | + $minimum = (float) $item->get_minimum_price(); |
|
122 | + $validate_minimum = ''; |
|
123 | + $class = ''; |
|
124 | + $data_minimum = ''; |
|
125 | + |
|
126 | + if ( $minimum > 0 ) { |
|
127 | + $validate_minimum = sprintf( |
|
128 | + esc_attr__( 'The minimum allowed amount is %s', 'invoicing' ), |
|
129 | + strip_tags( wpinv_price( $minimum, $currency ) ) |
|
130 | + ); |
|
131 | + |
|
132 | + $class = 'getpaid-validate-minimum-amount'; |
|
133 | + |
|
134 | + $data_minimum = "data-minimum-amount='" . esc_attr( getpaid_unstandardize_amount( $minimum ) ) . "'"; |
|
135 | + } |
|
136 | + |
|
137 | + ?> |
|
138 | 138 | <div class="input-group input-group-sm"> |
139 | 139 | <?php if( 'left' == $position ) : ?> |
140 | 140 | <div class="input-group-prepend"> |
@@ -159,44 +159,44 @@ discard block |
||
159 | 159 | |
160 | 160 | <?php |
161 | 161 | |
162 | - } else { |
|
163 | - echo wpinv_price( $item->get_price(), $currency ); |
|
162 | + } else { |
|
163 | + echo wpinv_price( $item->get_price(), $currency ); |
|
164 | 164 | |
165 | - ?> |
|
165 | + ?> |
|
166 | 166 | <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() ); ?>'> |
167 | 167 | <?php |
168 | - } |
|
168 | + } |
|
169 | 169 | |
170 | - printf( |
|
171 | - '<small class="d-sm-none text-muted form-text getpaid-mobile-item-subtotal">%s</small>', |
|
172 | - sprintf( __( 'Subtotal: %s', 'invoicing' ), wpinv_price( $item->get_sub_total(), $currency ) ) |
|
173 | - ); |
|
174 | - } |
|
170 | + printf( |
|
171 | + '<small class="d-sm-none text-muted form-text getpaid-mobile-item-subtotal">%s</small>', |
|
172 | + sprintf( __( 'Subtotal: %s', 'invoicing' ), wpinv_price( $item->get_sub_total(), $currency ) ) |
|
173 | + ); |
|
174 | + } |
|
175 | 175 | |
176 | - // Item quantity. |
|
177 | - if ( 'quantity' == $key ) { |
|
176 | + // Item quantity. |
|
177 | + if ( 'quantity' == $key ) { |
|
178 | 178 | |
179 | - if ( $item->allows_quantities() ) { |
|
180 | - ?> |
|
179 | + if ( $item->allows_quantities() ) { |
|
180 | + ?> |
|
181 | 181 | <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> |
182 | 182 | <?php |
183 | - } else { |
|
184 | - echo (float) $item->get_quantity(); |
|
185 | - echo ' '; |
|
186 | - ?> |
|
183 | + } else { |
|
184 | + echo (float) $item->get_quantity(); |
|
185 | + echo ' '; |
|
186 | + ?> |
|
187 | 187 | <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(); ?>'> |
188 | 188 | <?php |
189 | - } |
|
189 | + } |
|
190 | 190 | |
191 | - } |
|
191 | + } |
|
192 | 192 | |
193 | - // Item sub total. |
|
194 | - if ( 'subtotal' == $key ) { |
|
195 | - echo wpinv_price( $item->get_sub_total(), $currency ); |
|
196 | - } |
|
193 | + // Item sub total. |
|
194 | + if ( 'subtotal' == $key ) { |
|
195 | + echo wpinv_price( $item->get_sub_total(), $currency ); |
|
196 | + } |
|
197 | 197 | |
198 | - do_action( "getpaid_payment_form_cart_item_$key", $item, $form ); |
|
199 | - ?> |
|
198 | + do_action( "getpaid_payment_form_cart_item_$key", $item, $form ); |
|
199 | + ?> |
|
200 | 200 | |
201 | 201 | </div> |
202 | 202 |
@@ -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 | -<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'> |
|
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 | ); |
@@ -103,56 +103,56 @@ discard block |
||
103 | 103 | } |
104 | 104 | |
105 | 105 | // Item price. |
106 | - if ( 'price' == $key ) { |
|
106 | + if ('price' == $key) { |
|
107 | 107 | |
108 | 108 | // Set the currency position. |
109 | 109 | $position = wpinv_currency_position(); |
110 | 110 | |
111 | - if ( $position == 'left_space' ) { |
|
111 | + if ($position == 'left_space') { |
|
112 | 112 | $position = 'left'; |
113 | 113 | } |
114 | 114 | |
115 | - if ( $position == 'right_space' ) { |
|
115 | + if ($position == 'right_space') { |
|
116 | 116 | $position = 'right'; |
117 | 117 | } |
118 | 118 | |
119 | - if ( $item->user_can_set_their_price() ) { |
|
120 | - $price = max( (float) $item->get_price(), (float) $item->get_minimum_price() ); |
|
119 | + if ($item->user_can_set_their_price()) { |
|
120 | + $price = max((float) $item->get_price(), (float) $item->get_minimum_price()); |
|
121 | 121 | $minimum = (float) $item->get_minimum_price(); |
122 | 122 | $validate_minimum = ''; |
123 | 123 | $class = ''; |
124 | 124 | $data_minimum = ''; |
125 | 125 | |
126 | - if ( $minimum > 0 ) { |
|
126 | + if ($minimum > 0) { |
|
127 | 127 | $validate_minimum = sprintf( |
128 | - esc_attr__( 'The minimum allowed amount is %s', 'invoicing' ), |
|
129 | - strip_tags( wpinv_price( $minimum, $currency ) ) |
|
128 | + esc_attr__('The minimum allowed amount is %s', 'invoicing'), |
|
129 | + strip_tags(wpinv_price($minimum, $currency)) |
|
130 | 130 | ); |
131 | 131 | |
132 | 132 | $class = 'getpaid-validate-minimum-amount'; |
133 | 133 | |
134 | - $data_minimum = "data-minimum-amount='" . esc_attr( getpaid_unstandardize_amount( $minimum ) ) . "'"; |
|
134 | + $data_minimum = "data-minimum-amount='" . esc_attr(getpaid_unstandardize_amount($minimum)) . "'"; |
|
135 | 135 | } |
136 | 136 | |
137 | 137 | ?> |
138 | 138 | <div class="input-group input-group-sm"> |
139 | - <?php if( 'left' == $position ) : ?> |
|
139 | + <?php if ('left' == $position) : ?> |
|
140 | 140 | <div class="input-group-prepend"> |
141 | - <span class="input-group-text"><?php echo wpinv_currency_symbol( $currency ); ?></span> |
|
141 | + <span class="input-group-text"><?php echo wpinv_currency_symbol($currency); ?></span> |
|
142 | 142 | </div> |
143 | 143 | <?php endif; ?> |
144 | 144 | |
145 | - <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 | + <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;"> |
|
146 | 146 | |
147 | - <?php if ( ! empty( $validate_minimum ) ) : ?> |
|
147 | + <?php if (!empty($validate_minimum)) : ?> |
|
148 | 148 | <div class="invalid-tooltip"> |
149 | 149 | <?php echo $validate_minimum; ?> |
150 | 150 | </div> |
151 | 151 | <?php endif; ?> |
152 | 152 | |
153 | - <?php if( 'left' != $position ) : ?> |
|
153 | + <?php if ('left' != $position) : ?> |
|
154 | 154 | <div class="input-group-append"> |
155 | - <span class="input-group-text"><?php echo wpinv_currency_symbol( $currency ); ?></span> |
|
155 | + <span class="input-group-text"><?php echo wpinv_currency_symbol($currency); ?></span> |
|
156 | 156 | </div> |
157 | 157 | <?php endif; ?> |
158 | 158 | </div> |
@@ -160,23 +160,23 @@ discard block |
||
160 | 160 | <?php |
161 | 161 | |
162 | 162 | } else { |
163 | - echo wpinv_price( $item->get_price(), $currency ); |
|
163 | + echo wpinv_price($item->get_price(), $currency); |
|
164 | 164 | |
165 | 165 | ?> |
166 | - <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 | + <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()); ?>'> |
|
167 | 167 | <?php |
168 | 168 | } |
169 | 169 | |
170 | 170 | printf( |
171 | 171 | '<small class="d-sm-none text-muted form-text getpaid-mobile-item-subtotal">%s</small>', |
172 | - sprintf( __( 'Subtotal: %s', 'invoicing' ), wpinv_price( $item->get_sub_total(), $currency ) ) |
|
172 | + sprintf(__('Subtotal: %s', 'invoicing'), wpinv_price($item->get_sub_total(), $currency)) |
|
173 | 173 | ); |
174 | 174 | } |
175 | 175 | |
176 | 176 | // Item quantity. |
177 | - if ( 'quantity' == $key ) { |
|
177 | + if ('quantity' == $key) { |
|
178 | 178 | |
179 | - if ( $item->allows_quantities() ) { |
|
179 | + if ($item->allows_quantities()) { |
|
180 | 180 | ?> |
181 | 181 | <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> |
182 | 182 | <?php |
@@ -191,11 +191,11 @@ discard block |
||
191 | 191 | } |
192 | 192 | |
193 | 193 | // Item sub total. |
194 | - if ( 'subtotal' == $key ) { |
|
195 | - echo wpinv_price( $item->get_sub_total(), $currency ); |
|
194 | + if ('subtotal' == $key) { |
|
195 | + echo wpinv_price($item->get_sub_total(), $currency); |
|
196 | 196 | } |
197 | 197 | |
198 | - do_action( "getpaid_payment_form_cart_item_$key", $item, $form ); |
|
198 | + do_action("getpaid_payment_form_cart_item_$key", $item, $form); |
|
199 | 199 | ?> |
200 | 200 | |
201 | 201 | </div> |
@@ -206,4 +206,4 @@ discard block |
||
206 | 206 | |
207 | 207 | </div> |
208 | 208 | <?php |
209 | -do_action( 'getpaid_payment_form_cart_item', $form, $item ); |
|
209 | +do_action('getpaid_payment_form_cart_item', $form, $item); |
@@ -42,94 +42,94 @@ discard block |
||
42 | 42 | <tr class="wpinv-item wpinv-item-<?php echo sanitize_html_class( $invoice->get_status() ); ?>"> |
43 | 43 | <?php |
44 | 44 | |
45 | - foreach ( wpinv_get_user_invoices_columns( $post_type ) as $column_id => $column_name ) : |
|
45 | + foreach ( wpinv_get_user_invoices_columns( $post_type ) as $column_id => $column_name ) : |
|
46 | 46 | |
47 | - $column_id = sanitize_html_class( $column_id ); |
|
48 | - $class = empty( $column_name['class'] ) ? '' : sanitize_html_class( $column_name['class'] ); |
|
47 | + $column_id = sanitize_html_class( $column_id ); |
|
48 | + $class = empty( $column_name['class'] ) ? '' : sanitize_html_class( $column_name['class'] ); |
|
49 | 49 | |
50 | - echo "<td class='$column_id $class'>"; |
|
51 | - switch ( $column_id ) { |
|
50 | + echo "<td class='$column_id $class'>"; |
|
51 | + switch ( $column_id ) { |
|
52 | 52 | |
53 | - case 'invoice-number': |
|
54 | - echo wp_kses_post( wpinv_invoice_link( $invoice ) ); |
|
55 | - break; |
|
53 | + case 'invoice-number': |
|
54 | + echo wp_kses_post( wpinv_invoice_link( $invoice ) ); |
|
55 | + break; |
|
56 | 56 | |
57 | - case 'created-date': |
|
58 | - echo getpaid_format_date_value( $invoice->get_date_created() ); |
|
59 | - break; |
|
57 | + case 'created-date': |
|
58 | + echo getpaid_format_date_value( $invoice->get_date_created() ); |
|
59 | + break; |
|
60 | 60 | |
61 | - case 'payment-date': |
|
61 | + case 'payment-date': |
|
62 | 62 | |
63 | - if ( $invoice->needs_payment() ) { |
|
64 | - echo "—"; |
|
65 | - } else { |
|
66 | - echo getpaid_format_date_value( $invoice->get_date_completed() ); |
|
67 | - } |
|
63 | + if ( $invoice->needs_payment() ) { |
|
64 | + echo "—"; |
|
65 | + } else { |
|
66 | + echo getpaid_format_date_value( $invoice->get_date_completed() ); |
|
67 | + } |
|
68 | 68 | |
69 | - break; |
|
69 | + break; |
|
70 | 70 | |
71 | - case 'invoice-status': |
|
72 | - echo wp_kses_post( $invoice->get_status_label_html() ); |
|
71 | + case 'invoice-status': |
|
72 | + echo wp_kses_post( $invoice->get_status_label_html() ); |
|
73 | 73 | |
74 | - break; |
|
74 | + break; |
|
75 | 75 | |
76 | - case 'invoice-total': |
|
77 | - echo wpinv_price( $invoice->get_total(), $invoice->get_currency() ); |
|
76 | + case 'invoice-total': |
|
77 | + echo wpinv_price( $invoice->get_total(), $invoice->get_currency() ); |
|
78 | 78 | |
79 | - break; |
|
79 | + break; |
|
80 | 80 | |
81 | - case 'invoice-actions': |
|
81 | + case 'invoice-actions': |
|
82 | 82 | |
83 | - $actions = array( |
|
83 | + $actions = array( |
|
84 | 84 | |
85 | - 'pay' => array( |
|
86 | - 'url' => $invoice->get_checkout_payment_url(), |
|
87 | - 'name' => __( 'Pay Now', 'invoicing' ), |
|
88 | - 'class' => 'btn-success' |
|
89 | - ), |
|
85 | + 'pay' => array( |
|
86 | + 'url' => $invoice->get_checkout_payment_url(), |
|
87 | + 'name' => __( 'Pay Now', 'invoicing' ), |
|
88 | + 'class' => 'btn-success' |
|
89 | + ), |
|
90 | 90 | |
91 | - 'print' => array( |
|
92 | - 'url' => $invoice->get_view_url(), |
|
93 | - 'name' => __( 'View', 'invoicing' ), |
|
94 | - 'class' => 'btn-secondary', |
|
95 | - 'attrs' => 'target="_blank"' |
|
96 | - ) |
|
97 | - ); |
|
91 | + 'print' => array( |
|
92 | + 'url' => $invoice->get_view_url(), |
|
93 | + 'name' => __( 'View', 'invoicing' ), |
|
94 | + 'class' => 'btn-secondary', |
|
95 | + 'attrs' => 'target="_blank"' |
|
96 | + ) |
|
97 | + ); |
|
98 | 98 | |
99 | - if ( ! $invoice->needs_payment() ) { |
|
100 | - unset( $actions['pay'] ); |
|
101 | - } |
|
99 | + if ( ! $invoice->needs_payment() ) { |
|
100 | + unset( $actions['pay'] ); |
|
101 | + } |
|
102 | 102 | |
103 | - if ( $invoice->needs_payment() ) { |
|
104 | - $actions['delete'] = array( |
|
105 | - 'url' => getpaid_get_authenticated_action_url( 'delete_invoice', add_query_arg( 'invoice_id', $invoice->get_id() ) ), |
|
106 | - 'name' => __( 'Delete', 'invoicing' ), |
|
107 | - 'class' => 'btn-danger' |
|
108 | - ); |
|
109 | - } |
|
103 | + if ( $invoice->needs_payment() ) { |
|
104 | + $actions['delete'] = array( |
|
105 | + 'url' => getpaid_get_authenticated_action_url( 'delete_invoice', add_query_arg( 'invoice_id', $invoice->get_id() ) ), |
|
106 | + 'name' => __( 'Delete', 'invoicing' ), |
|
107 | + 'class' => 'btn-danger' |
|
108 | + ); |
|
109 | + } |
|
110 | 110 | |
111 | - $actions = apply_filters( 'wpinv_user_invoices_actions', $actions, $invoice, $post_type ); |
|
111 | + $actions = apply_filters( 'wpinv_user_invoices_actions', $actions, $invoice, $post_type ); |
|
112 | 112 | |
113 | - foreach ( $actions as $key => $action ) { |
|
114 | - $class = !empty($action['class']) ? sanitize_html_class($action['class']) : ''; |
|
115 | - echo '<a href="' . esc_url( $action['url'] ) . '" class="btn btn-sm btn-block ' . $class . ' ' . sanitize_html_class( $key ) . '" ' . ( !empty($action['attrs']) ? $action['attrs'] : '' ) . '>' . $action['name'] . '</a>'; |
|
116 | - } |
|
113 | + foreach ( $actions as $key => $action ) { |
|
114 | + $class = !empty($action['class']) ? sanitize_html_class($action['class']) : ''; |
|
115 | + echo '<a href="' . esc_url( $action['url'] ) . '" class="btn btn-sm btn-block ' . $class . ' ' . sanitize_html_class( $key ) . '" ' . ( !empty($action['attrs']) ? $action['attrs'] : '' ) . '>' . $action['name'] . '</a>'; |
|
116 | + } |
|
117 | 117 | |
118 | - break; |
|
118 | + break; |
|
119 | 119 | |
120 | - default: |
|
121 | - do_action( "wpinv_user_invoices_column_$column_id", $invoice ); |
|
122 | - break; |
|
120 | + default: |
|
121 | + do_action( "wpinv_user_invoices_column_$column_id", $invoice ); |
|
122 | + break; |
|
123 | 123 | |
124 | 124 | |
125 | - } |
|
125 | + } |
|
126 | 126 | |
127 | - do_action( "wpinv_user_invoices_column_after_$column_id", $invoice ); |
|
127 | + do_action( "wpinv_user_invoices_column_after_$column_id", $invoice ); |
|
128 | 128 | |
129 | - echo '</td>'; |
|
129 | + echo '</td>'; |
|
130 | 130 | |
131 | - endforeach; |
|
132 | - ?> |
|
131 | + endforeach; |
|
132 | + ?> |
|
133 | 133 | </tr> |
134 | 134 | |
135 | 135 | <?php endforeach; ?> |
@@ -143,14 +143,14 @@ discard block |
||
143 | 143 | <?php if ( 1 < $invoices->max_num_pages ) : ?> |
144 | 144 | <div class="invoicing-Pagination"> |
145 | 145 | <?php |
146 | - $big = 999999; |
|
147 | - |
|
148 | - echo paginate_links( array( |
|
149 | - 'base' => str_replace( $big, '%#%', esc_url( get_pagenum_link( $big ) ) ), |
|
150 | - 'format' => '?paged=%#%', |
|
151 | - 'total' => $invoices->max_num_pages, |
|
152 | - ) ); |
|
153 | - ?> |
|
146 | + $big = 999999; |
|
147 | + |
|
148 | + echo paginate_links( array( |
|
149 | + 'base' => str_replace( $big, '%#%', esc_url( get_pagenum_link( $big ) ) ), |
|
150 | + 'format' => '?paged=%#%', |
|
151 | + 'total' => $invoices->max_num_pages, |
|
152 | + ) ); |
|
153 | + ?> |
|
154 | 154 | </div> |
155 | 155 | <?php endif; ?> |
156 | 156 |
@@ -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 | 12 | // Current page. |
13 | -$current_page = empty( $_GET[ 'page' ] ) ? 1 : absint( $_GET[ 'page' ] ); |
|
13 | +$current_page = empty($_GET['page']) ? 1 : absint($_GET['page']); |
|
14 | 14 | |
15 | 15 | // Fires before displaying user invoices. |
16 | -do_action( 'wpinv_before_user_invoices', $invoices->invoices, $invoices->total, $invoices->max_num_pages, $post_type ); |
|
16 | +do_action('wpinv_before_user_invoices', $invoices->invoices, $invoices->total, $invoices->max_num_pages, $post_type); |
|
17 | 17 | |
18 | 18 | ?> |
19 | 19 | |
20 | 20 | |
21 | 21 | <div class="table-responsive"> |
22 | - <table class="table table-bordered table-hover getpaid-user-invoices <?php echo sanitize_html_class( $post_type ); ?>"> |
|
22 | + <table class="table table-bordered table-hover getpaid-user-invoices <?php echo sanitize_html_class($post_type); ?>"> |
|
23 | 23 | |
24 | 24 | |
25 | 25 | <thead> |
26 | 26 | <tr> |
27 | 27 | |
28 | - <?php foreach ( wpinv_get_user_invoices_columns( $post_type ) as $column_id => $column_name ) : ?> |
|
29 | - <th class="<?php echo sanitize_html_class( $column_id ); ?> <?php echo ( ! empty( $column_name['class'] ) ? sanitize_html_class( $column_name['class'] ) : '');?> border-bottom-0"> |
|
30 | - <span class="nobr"><?php echo esc_html( $column_name['title'] ); ?></span> |
|
28 | + <?php foreach (wpinv_get_user_invoices_columns($post_type) as $column_id => $column_name) : ?> |
|
29 | + <th class="<?php echo sanitize_html_class($column_id); ?> <?php echo (!empty($column_name['class']) ? sanitize_html_class($column_name['class']) : ''); ?> border-bottom-0"> |
|
30 | + <span class="nobr"><?php echo esc_html($column_name['title']); ?></span> |
|
31 | 31 | </th> |
32 | 32 | <?php endforeach; ?> |
33 | 33 | |
@@ -37,44 +37,44 @@ discard block |
||
37 | 37 | |
38 | 38 | |
39 | 39 | <tbody> |
40 | - <?php foreach ( $invoices->invoices as $invoice ) : ?> |
|
40 | + <?php foreach ($invoices->invoices as $invoice) : ?> |
|
41 | 41 | |
42 | - <tr class="wpinv-item wpinv-item-<?php echo sanitize_html_class( $invoice->get_status() ); ?>"> |
|
42 | + <tr class="wpinv-item wpinv-item-<?php echo sanitize_html_class($invoice->get_status()); ?>"> |
|
43 | 43 | <?php |
44 | 44 | |
45 | - foreach ( wpinv_get_user_invoices_columns( $post_type ) as $column_id => $column_name ) : |
|
45 | + foreach (wpinv_get_user_invoices_columns($post_type) as $column_id => $column_name) : |
|
46 | 46 | |
47 | - $column_id = sanitize_html_class( $column_id ); |
|
48 | - $class = empty( $column_name['class'] ) ? '' : sanitize_html_class( $column_name['class'] ); |
|
47 | + $column_id = sanitize_html_class($column_id); |
|
48 | + $class = empty($column_name['class']) ? '' : sanitize_html_class($column_name['class']); |
|
49 | 49 | |
50 | 50 | echo "<td class='$column_id $class'>"; |
51 | - switch ( $column_id ) { |
|
51 | + switch ($column_id) { |
|
52 | 52 | |
53 | 53 | case 'invoice-number': |
54 | - echo wp_kses_post( wpinv_invoice_link( $invoice ) ); |
|
54 | + echo wp_kses_post(wpinv_invoice_link($invoice)); |
|
55 | 55 | break; |
56 | 56 | |
57 | 57 | case 'created-date': |
58 | - echo getpaid_format_date_value( $invoice->get_date_created() ); |
|
58 | + echo getpaid_format_date_value($invoice->get_date_created()); |
|
59 | 59 | break; |
60 | 60 | |
61 | 61 | case 'payment-date': |
62 | 62 | |
63 | - if ( $invoice->needs_payment() ) { |
|
63 | + if ($invoice->needs_payment()) { |
|
64 | 64 | echo "—"; |
65 | 65 | } else { |
66 | - echo getpaid_format_date_value( $invoice->get_date_completed() ); |
|
66 | + echo getpaid_format_date_value($invoice->get_date_completed()); |
|
67 | 67 | } |
68 | 68 | |
69 | 69 | break; |
70 | 70 | |
71 | 71 | case 'invoice-status': |
72 | - echo wp_kses_post( $invoice->get_status_label_html() ); |
|
72 | + echo wp_kses_post($invoice->get_status_label_html()); |
|
73 | 73 | |
74 | 74 | break; |
75 | 75 | |
76 | 76 | case 'invoice-total': |
77 | - echo wpinv_price( $invoice->get_total(), $invoice->get_currency() ); |
|
77 | + echo wpinv_price($invoice->get_total(), $invoice->get_currency()); |
|
78 | 78 | |
79 | 79 | break; |
80 | 80 | |
@@ -84,47 +84,47 @@ discard block |
||
84 | 84 | |
85 | 85 | 'pay' => array( |
86 | 86 | 'url' => $invoice->get_checkout_payment_url(), |
87 | - 'name' => __( 'Pay Now', 'invoicing' ), |
|
87 | + 'name' => __('Pay Now', 'invoicing'), |
|
88 | 88 | 'class' => 'btn-success' |
89 | 89 | ), |
90 | 90 | |
91 | 91 | 'print' => array( |
92 | 92 | 'url' => $invoice->get_view_url(), |
93 | - 'name' => __( 'View', 'invoicing' ), |
|
93 | + 'name' => __('View', 'invoicing'), |
|
94 | 94 | 'class' => 'btn-secondary', |
95 | 95 | 'attrs' => 'target="_blank"' |
96 | 96 | ) |
97 | 97 | ); |
98 | 98 | |
99 | - if ( ! $invoice->needs_payment() ) { |
|
100 | - unset( $actions['pay'] ); |
|
99 | + if (!$invoice->needs_payment()) { |
|
100 | + unset($actions['pay']); |
|
101 | 101 | } |
102 | 102 | |
103 | - if ( $invoice->needs_payment() ) { |
|
103 | + if ($invoice->needs_payment()) { |
|
104 | 104 | $actions['delete'] = array( |
105 | - 'url' => getpaid_get_authenticated_action_url( 'delete_invoice', add_query_arg( 'invoice_id', $invoice->get_id() ) ), |
|
106 | - 'name' => __( 'Delete', 'invoicing' ), |
|
105 | + 'url' => getpaid_get_authenticated_action_url('delete_invoice', add_query_arg('invoice_id', $invoice->get_id())), |
|
106 | + 'name' => __('Delete', 'invoicing'), |
|
107 | 107 | 'class' => 'btn-danger' |
108 | 108 | ); |
109 | 109 | } |
110 | 110 | |
111 | - $actions = apply_filters( 'wpinv_user_invoices_actions', $actions, $invoice, $post_type ); |
|
111 | + $actions = apply_filters('wpinv_user_invoices_actions', $actions, $invoice, $post_type); |
|
112 | 112 | |
113 | - foreach ( $actions as $key => $action ) { |
|
113 | + foreach ($actions as $key => $action) { |
|
114 | 114 | $class = !empty($action['class']) ? sanitize_html_class($action['class']) : ''; |
115 | - echo '<a href="' . esc_url( $action['url'] ) . '" class="btn btn-sm btn-block ' . $class . ' ' . sanitize_html_class( $key ) . '" ' . ( !empty($action['attrs']) ? $action['attrs'] : '' ) . '>' . $action['name'] . '</a>'; |
|
115 | + echo '<a href="' . esc_url($action['url']) . '" class="btn btn-sm btn-block ' . $class . ' ' . sanitize_html_class($key) . '" ' . (!empty($action['attrs']) ? $action['attrs'] : '') . '>' . $action['name'] . '</a>'; |
|
116 | 116 | } |
117 | 117 | |
118 | 118 | break; |
119 | 119 | |
120 | 120 | default: |
121 | - do_action( "wpinv_user_invoices_column_$column_id", $invoice ); |
|
121 | + do_action("wpinv_user_invoices_column_$column_id", $invoice); |
|
122 | 122 | break; |
123 | 123 | |
124 | 124 | |
125 | 125 | } |
126 | 126 | |
127 | - do_action( "wpinv_user_invoices_column_after_$column_id", $invoice ); |
|
127 | + do_action("wpinv_user_invoices_column_after_$column_id", $invoice); |
|
128 | 128 | |
129 | 129 | echo '</td>'; |
130 | 130 | |
@@ -138,20 +138,20 @@ discard block |
||
138 | 138 | </table> |
139 | 139 | </div> |
140 | 140 | |
141 | - <?php do_action( 'wpinv_before_user_invoices_pagination' ); ?> |
|
141 | + <?php do_action('wpinv_before_user_invoices_pagination'); ?> |
|
142 | 142 | |
143 | - <?php if ( 1 < $invoices->max_num_pages ) : ?> |
|
143 | + <?php if (1 < $invoices->max_num_pages) : ?> |
|
144 | 144 | <div class="invoicing-Pagination"> |
145 | 145 | <?php |
146 | 146 | $big = 999999; |
147 | 147 | |
148 | - echo paginate_links( array( |
|
149 | - 'base' => str_replace( $big, '%#%', esc_url( get_pagenum_link( $big ) ) ), |
|
148 | + echo paginate_links(array( |
|
149 | + 'base' => str_replace($big, '%#%', esc_url(get_pagenum_link($big))), |
|
150 | 150 | 'format' => '?paged=%#%', |
151 | 151 | 'total' => $invoices->max_num_pages, |
152 | - ) ); |
|
152 | + )); |
|
153 | 153 | ?> |
154 | 154 | </div> |
155 | 155 | <?php endif; ?> |
156 | 156 | |
157 | -<?php do_action( 'wpinv_after_user_invoices', $invoices->invoices, $invoices->total, $invoices->max_num_pages, $post_type ); ?> |
|
157 | +<?php do_action('wpinv_after_user_invoices', $invoices->invoices, $invoices->total, $invoices->max_num_pages, $post_type); ?> |
@@ -13,42 +13,42 @@ |
||
13 | 13 | |
14 | 14 | foreach ( array_keys( $widget->get_subscriptions_table_columns() ) as $column ) : |
15 | 15 | |
16 | - $class = sanitize_html_class( $column ); |
|
17 | - echo "<td class='getpaid-subscriptions-table-column-$class'>"; |
|
16 | + $class = sanitize_html_class( $column ); |
|
17 | + echo "<td class='getpaid-subscriptions-table-column-$class'>"; |
|
18 | 18 | |
19 | - do_action( "getpaid_subscriptions_before_frontend_subscription_table_$column", $subscription ); |
|
19 | + do_action( "getpaid_subscriptions_before_frontend_subscription_table_$column", $subscription ); |
|
20 | 20 | |
21 | - switch( $column ) : |
|
21 | + switch( $column ) : |
|
22 | 22 | |
23 | - case 'subscription': |
|
24 | - $subscription_id = (int) $subscription->get_id(); |
|
25 | - $url = esc_url( $subscription->get_view_url() ); |
|
26 | - $id_label = sprintf( |
|
27 | - esc_attr_x( '#%s', 'subscription id', 'invoicing' ), |
|
28 | - (int) $subscription->get_id() |
|
29 | - ); |
|
30 | - echo $widget->add_row_actions( "<a href='$url' class='font-weight-bold text-decoration-none'>$id_label</a>", $subscription ); |
|
31 | - break; |
|
23 | + case 'subscription': |
|
24 | + $subscription_id = (int) $subscription->get_id(); |
|
25 | + $url = esc_url( $subscription->get_view_url() ); |
|
26 | + $id_label = sprintf( |
|
27 | + esc_attr_x( '#%s', 'subscription id', 'invoicing' ), |
|
28 | + (int) $subscription->get_id() |
|
29 | + ); |
|
30 | + echo $widget->add_row_actions( "<a href='$url' class='font-weight-bold text-decoration-none'>$id_label</a>", $subscription ); |
|
31 | + break; |
|
32 | 32 | |
33 | - case 'status': |
|
34 | - echo esc_html( $subscription->get_status_label() ); |
|
35 | - break; |
|
33 | + case 'status': |
|
34 | + echo esc_html( $subscription->get_status_label() ); |
|
35 | + break; |
|
36 | 36 | |
37 | - case 'renewal-date': |
|
38 | - $renewal = getpaid_format_date_value( $subscription->get_next_renewal_date() ); |
|
39 | - echo $subscription->is_active() ? esc_html( $renewal ) : "—"; |
|
40 | - break; |
|
37 | + case 'renewal-date': |
|
38 | + $renewal = getpaid_format_date_value( $subscription->get_next_renewal_date() ); |
|
39 | + echo $subscription->is_active() ? esc_html( $renewal ) : "—"; |
|
40 | + break; |
|
41 | 41 | |
42 | - case 'amount': |
|
43 | - $frequency = getpaid_get_subscription_period_label( $subscription->get_period(), $subscription->get_frequency(), '' ); |
|
44 | - $amount = wpinv_price( $subscription->get_recurring_amount(), $subscription->get_parent_payment()->get_currency() ); |
|
45 | - echo wp_kses_post( "<span>$amount</span> / <span class='getpaid-item-recurring-period'>$frequency</span>" ); |
|
46 | - break; |
|
42 | + case 'amount': |
|
43 | + $frequency = getpaid_get_subscription_period_label( $subscription->get_period(), $subscription->get_frequency(), '' ); |
|
44 | + $amount = wpinv_price( $subscription->get_recurring_amount(), $subscription->get_parent_payment()->get_currency() ); |
|
45 | + echo wp_kses_post( "<span>$amount</span> / <span class='getpaid-item-recurring-period'>$frequency</span>" ); |
|
46 | + break; |
|
47 | 47 | |
48 | - endswitch; |
|
48 | + endswitch; |
|
49 | 49 | |
50 | - do_action( "getpaid_subscriptions_frontend_subscription_table_$column", $subscription ); |
|
50 | + do_action( "getpaid_subscriptions_frontend_subscription_table_$column", $subscription ); |
|
51 | 51 | |
52 | - echo '</td>'; |
|
52 | + echo '</td>'; |
|
53 | 53 | |
54 | 54 | endforeach; |
@@ -9,45 +9,45 @@ |
||
9 | 9 | * @var WPInv_Subscriptions_Widget $widget |
10 | 10 | */ |
11 | 11 | |
12 | -defined( 'ABSPATH' ) || exit; |
|
12 | +defined('ABSPATH') || exit; |
|
13 | 13 | |
14 | -foreach ( array_keys( $widget->get_subscriptions_table_columns() ) as $column ) : |
|
14 | +foreach (array_keys($widget->get_subscriptions_table_columns()) as $column) : |
|
15 | 15 | |
16 | - $class = sanitize_html_class( $column ); |
|
16 | + $class = sanitize_html_class($column); |
|
17 | 17 | echo "<td class='getpaid-subscriptions-table-column-$class'>"; |
18 | 18 | |
19 | - do_action( "getpaid_subscriptions_before_frontend_subscription_table_$column", $subscription ); |
|
19 | + do_action("getpaid_subscriptions_before_frontend_subscription_table_$column", $subscription); |
|
20 | 20 | |
21 | - switch( $column ) : |
|
21 | + switch ($column) : |
|
22 | 22 | |
23 | 23 | case 'subscription': |
24 | 24 | $subscription_id = (int) $subscription->get_id(); |
25 | - $url = esc_url( $subscription->get_view_url() ); |
|
25 | + $url = esc_url($subscription->get_view_url()); |
|
26 | 26 | $id_label = sprintf( |
27 | - esc_attr_x( '#%s', 'subscription id', 'invoicing' ), |
|
27 | + esc_attr_x('#%s', 'subscription id', 'invoicing'), |
|
28 | 28 | (int) $subscription->get_id() |
29 | 29 | ); |
30 | - echo $widget->add_row_actions( "<a href='$url' class='font-weight-bold text-decoration-none'>$id_label</a>", $subscription ); |
|
30 | + echo $widget->add_row_actions("<a href='$url' class='font-weight-bold text-decoration-none'>$id_label</a>", $subscription); |
|
31 | 31 | break; |
32 | 32 | |
33 | 33 | case 'status': |
34 | - echo esc_html( $subscription->get_status_label() ); |
|
34 | + echo esc_html($subscription->get_status_label()); |
|
35 | 35 | break; |
36 | 36 | |
37 | 37 | case 'renewal-date': |
38 | - $renewal = getpaid_format_date_value( $subscription->get_next_renewal_date() ); |
|
39 | - echo $subscription->is_active() ? esc_html( $renewal ) : "—"; |
|
38 | + $renewal = getpaid_format_date_value($subscription->get_next_renewal_date()); |
|
39 | + echo $subscription->is_active() ? esc_html($renewal) : "—"; |
|
40 | 40 | break; |
41 | 41 | |
42 | 42 | case 'amount': |
43 | - $frequency = getpaid_get_subscription_period_label( $subscription->get_period(), $subscription->get_frequency(), '' ); |
|
44 | - $amount = wpinv_price( $subscription->get_recurring_amount(), $subscription->get_parent_payment()->get_currency() ); |
|
45 | - echo wp_kses_post( "<span>$amount</span> / <span class='getpaid-item-recurring-period'>$frequency</span>" ); |
|
43 | + $frequency = getpaid_get_subscription_period_label($subscription->get_period(), $subscription->get_frequency(), ''); |
|
44 | + $amount = wpinv_price($subscription->get_recurring_amount(), $subscription->get_parent_payment()->get_currency()); |
|
45 | + echo wp_kses_post("<span>$amount</span> / <span class='getpaid-item-recurring-period'>$frequency</span>"); |
|
46 | 46 | break; |
47 | 47 | |
48 | 48 | endswitch; |
49 | 49 | |
50 | - do_action( "getpaid_subscriptions_frontend_subscription_table_$column", $subscription ); |
|
50 | + do_action("getpaid_subscriptions_frontend_subscription_table_$column", $subscription); |
|
51 | 51 | |
52 | 52 | echo '</td>'; |
53 | 53 |
@@ -46,64 +46,64 @@ discard block |
||
46 | 46 | <td style="width: 65%"> |
47 | 47 | <?php |
48 | 48 | |
49 | - switch ( $key ) { |
|
49 | + switch ( $key ) { |
|
50 | 50 | |
51 | - case 'status': |
|
52 | - echo esc_html( $subscription->get_status_label() ); |
|
53 | - break; |
|
51 | + case 'status': |
|
52 | + echo esc_html( $subscription->get_status_label() ); |
|
53 | + break; |
|
54 | 54 | |
55 | - case 'start_date': |
|
56 | - echo esc_html( getpaid_format_date_value( $subscription->get_date_created() ) ); |
|
57 | - break; |
|
55 | + case 'start_date': |
|
56 | + echo esc_html( getpaid_format_date_value( $subscription->get_date_created() ) ); |
|
57 | + break; |
|
58 | 58 | |
59 | - case 'expiry_date': |
|
60 | - echo esc_html( getpaid_format_date_value( $subscription->get_next_renewal_date() ) ); |
|
61 | - break; |
|
59 | + case 'expiry_date': |
|
60 | + echo esc_html( getpaid_format_date_value( $subscription->get_next_renewal_date() ) ); |
|
61 | + break; |
|
62 | 62 | |
63 | - case 'initial_amount': |
|
64 | - echo wpinv_price( $subscription->get_initial_amount(), $subscription->get_parent_payment()->get_currency() ); |
|
63 | + case 'initial_amount': |
|
64 | + echo wpinv_price( $subscription->get_initial_amount(), $subscription->get_parent_payment()->get_currency() ); |
|
65 | 65 | |
66 | - if ( $subscription->has_trial_period() ) { |
|
66 | + if ( $subscription->has_trial_period() ) { |
|
67 | 67 | |
68 | - echo "<small class='text-muted'> "; |
|
69 | - printf( |
|
70 | - _x( '( %1$s trial )', 'Subscription trial period. (e.g.: 1 month trial)', 'invoicing' ), |
|
71 | - esc_html( $subscription->get_trial_period() ) |
|
72 | - ); |
|
73 | - echo '</small>'; |
|
68 | + echo "<small class='text-muted'> "; |
|
69 | + printf( |
|
70 | + _x( '( %1$s trial )', 'Subscription trial period. (e.g.: 1 month trial)', 'invoicing' ), |
|
71 | + esc_html( $subscription->get_trial_period() ) |
|
72 | + ); |
|
73 | + echo '</small>'; |
|
74 | 74 | |
75 | - } |
|
75 | + } |
|
76 | 76 | |
77 | - break; |
|
77 | + break; |
|
78 | 78 | |
79 | - case 'recurring_amount': |
|
80 | - $frequency = getpaid_get_subscription_period_label( $subscription->get_period(), $subscription->get_frequency(), '' ); |
|
81 | - $amount = wpinv_price( $subscription->get_recurring_amount(), $subscription->get_parent_payment()->get_currency() ); |
|
82 | - echo wp_kses_post( strtolower( "<strong style='font-weight: 500;'>$amount</strong> / <span class='getpaid-item-recurring-period'>$frequency</span>" ) ); |
|
83 | - break; |
|
79 | + case 'recurring_amount': |
|
80 | + $frequency = getpaid_get_subscription_period_label( $subscription->get_period(), $subscription->get_frequency(), '' ); |
|
81 | + $amount = wpinv_price( $subscription->get_recurring_amount(), $subscription->get_parent_payment()->get_currency() ); |
|
82 | + echo wp_kses_post( strtolower( "<strong style='font-weight: 500;'>$amount</strong> / <span class='getpaid-item-recurring-period'>$frequency</span>" ) ); |
|
83 | + break; |
|
84 | 84 | |
85 | - case 'item': |
|
85 | + case 'item': |
|
86 | 86 | |
87 | - if ( empty( $subscription_group ) ) { |
|
88 | - echo wp_kses_post( WPInv_Subscriptions_List_Table::generate_item_markup( $subscription->get_product_id() ) ); |
|
89 | - } else { |
|
90 | - $markup = array_map( array( 'WPInv_Subscriptions_List_Table', 'generate_item_markup' ), array_keys( $subscription_group['items'] ) ); |
|
91 | - echo wp_kses_post( implode( ' | ', $markup ) ); |
|
92 | - } |
|
87 | + if ( empty( $subscription_group ) ) { |
|
88 | + echo wp_kses_post( WPInv_Subscriptions_List_Table::generate_item_markup( $subscription->get_product_id() ) ); |
|
89 | + } else { |
|
90 | + $markup = array_map( array( 'WPInv_Subscriptions_List_Table', 'generate_item_markup' ), array_keys( $subscription_group['items'] ) ); |
|
91 | + echo wp_kses_post( implode( ' | ', $markup ) ); |
|
92 | + } |
|
93 | 93 | |
94 | - break; |
|
94 | + break; |
|
95 | 95 | |
96 | - case 'payments': |
|
96 | + case 'payments': |
|
97 | 97 | |
98 | - $max_activations = (int) $subscription->get_bill_times(); |
|
99 | - echo ( (int) $subscription->get_times_billed() ) . ' / ' . ( empty( $max_activations ) ? "∞" : (int) $max_activations ); |
|
98 | + $max_activations = (int) $subscription->get_bill_times(); |
|
99 | + echo ( (int) $subscription->get_times_billed() ) . ' / ' . ( empty( $max_activations ) ? "∞" : (int) $max_activations ); |
|
100 | 100 | |
101 | - break; |
|
101 | + break; |
|
102 | 102 | |
103 | - } |
|
104 | - do_action( "getpaid_render_single_subscription_column_$key", $subscription ); |
|
103 | + } |
|
104 | + do_action( "getpaid_render_single_subscription_column_$key", $subscription ); |
|
105 | 105 | |
106 | - ?> |
|
106 | + ?> |
|
107 | 107 | </td> |
108 | 108 | |
109 | 109 | </tr> |
@@ -130,17 +130,17 @@ discard block |
||
130 | 130 | <span class="form-text"> |
131 | 131 | |
132 | 132 | <?php |
133 | - if ( $subscription->can_cancel() ) { |
|
134 | - printf( |
|
135 | - '<a href="%s" class="btn btn-danger btn-sm" onclick="return confirm(\'%s\')">%s</a> ', |
|
136 | - esc_url( $subscription->get_cancel_url() ), |
|
137 | - esc_attr__( 'Are you sure you want to cancel this subscription?', 'invoicing' ), |
|
138 | - __( 'Cancel Subscription', 'invoicing' ) |
|
139 | - ); |
|
140 | - } |
|
141 | - |
|
142 | - do_action( 'getpaid-single-subscription-page-actions', $subscription ); |
|
143 | - ?> |
|
133 | + if ( $subscription->can_cancel() ) { |
|
134 | + printf( |
|
135 | + '<a href="%s" class="btn btn-danger btn-sm" onclick="return confirm(\'%s\')">%s</a> ', |
|
136 | + esc_url( $subscription->get_cancel_url() ), |
|
137 | + esc_attr__( 'Are you sure you want to cancel this subscription?', 'invoicing' ), |
|
138 | + __( 'Cancel Subscription', 'invoicing' ) |
|
139 | + ); |
|
140 | + } |
|
141 | + |
|
142 | + do_action( 'getpaid-single-subscription-page-actions', $subscription ); |
|
143 | + ?> |
|
144 | 144 | |
145 | 145 | <a href="<?php echo esc_url( getpaid_get_tab_url( 'gp-subscriptions', get_permalink( (int) wpinv_get_option( 'invoice_subscription_page' ) ) ) ); ?>" class="btn btn-secondary btn-sm"><?php _e( 'Go Back', 'invoicing' ); ?></a> |
146 | 146 | </span> |
@@ -9,17 +9,17 @@ discard block |
||
9 | 9 | * @var WPInv_Subscriptions_Widget $widget |
10 | 10 | */ |
11 | 11 | |
12 | -defined( 'ABSPATH' ) || exit; |
|
12 | +defined('ABSPATH') || exit; |
|
13 | 13 | |
14 | -do_action( 'getpaid_single_subscription_before_notices', $subscription ); |
|
14 | +do_action('getpaid_single_subscription_before_notices', $subscription); |
|
15 | 15 | |
16 | 16 | // Display errors and notices. |
17 | 17 | wpinv_print_errors(); |
18 | 18 | |
19 | -$subscription_groups = getpaid_get_invoice_subscription_groups( $subscription->get_parent_invoice_id() ); |
|
20 | -$subscription_group = getpaid_get_invoice_subscription_group( $subscription->get_parent_invoice_id(), $subscription->get_id() ); |
|
19 | +$subscription_groups = getpaid_get_invoice_subscription_groups($subscription->get_parent_invoice_id()); |
|
20 | +$subscription_group = getpaid_get_invoice_subscription_group($subscription->get_parent_invoice_id(), $subscription->get_id()); |
|
21 | 21 | |
22 | -do_action( 'getpaid_before_single_subscription', $subscription, $subscription_groups ); |
|
22 | +do_action('getpaid_before_single_subscription', $subscription, $subscription_groups); |
|
23 | 23 | |
24 | 24 | ?> |
25 | 25 | |
@@ -31,44 +31,44 @@ discard block |
||
31 | 31 | |
32 | 32 | </style> |
33 | 33 | |
34 | -<h2 class="mb-1 h4"><?php _e( 'Subscription Details', 'invoicing' ); ?></h2> |
|
34 | +<h2 class="mb-1 h4"><?php _e('Subscription Details', 'invoicing'); ?></h2> |
|
35 | 35 | <table class="table table-bordered"> |
36 | 36 | <tbody> |
37 | 37 | |
38 | - <?php foreach ( $widget->get_single_subscription_columns( $subscription ) as $key => $label ) : ?> |
|
38 | + <?php foreach ($widget->get_single_subscription_columns($subscription) as $key => $label) : ?> |
|
39 | 39 | |
40 | - <tr class="getpaid-subscription-meta-<?php echo sanitize_html_class( $key ); ?>"> |
|
40 | + <tr class="getpaid-subscription-meta-<?php echo sanitize_html_class($key); ?>"> |
|
41 | 41 | |
42 | 42 | <th class="font-weight-bold" style="width: 35%"> |
43 | - <?php echo esc_html( $label ); ?> |
|
43 | + <?php echo esc_html($label); ?> |
|
44 | 44 | </th> |
45 | 45 | |
46 | 46 | <td style="width: 65%"> |
47 | 47 | <?php |
48 | 48 | |
49 | - switch ( $key ) { |
|
49 | + switch ($key) { |
|
50 | 50 | |
51 | 51 | case 'status': |
52 | - echo esc_html( $subscription->get_status_label() ); |
|
52 | + echo esc_html($subscription->get_status_label()); |
|
53 | 53 | break; |
54 | 54 | |
55 | 55 | case 'start_date': |
56 | - echo esc_html( getpaid_format_date_value( $subscription->get_date_created() ) ); |
|
56 | + echo esc_html(getpaid_format_date_value($subscription->get_date_created())); |
|
57 | 57 | break; |
58 | 58 | |
59 | 59 | case 'expiry_date': |
60 | - echo esc_html( getpaid_format_date_value( $subscription->get_next_renewal_date() ) ); |
|
60 | + echo esc_html(getpaid_format_date_value($subscription->get_next_renewal_date())); |
|
61 | 61 | break; |
62 | 62 | |
63 | 63 | case 'initial_amount': |
64 | - echo wpinv_price( $subscription->get_initial_amount(), $subscription->get_parent_payment()->get_currency() ); |
|
64 | + echo wpinv_price($subscription->get_initial_amount(), $subscription->get_parent_payment()->get_currency()); |
|
65 | 65 | |
66 | - if ( $subscription->has_trial_period() ) { |
|
66 | + if ($subscription->has_trial_period()) { |
|
67 | 67 | |
68 | 68 | echo "<small class='text-muted'> "; |
69 | 69 | printf( |
70 | - _x( '( %1$s trial )', 'Subscription trial period. (e.g.: 1 month trial)', 'invoicing' ), |
|
71 | - esc_html( $subscription->get_trial_period() ) |
|
70 | + _x('( %1$s trial )', 'Subscription trial period. (e.g.: 1 month trial)', 'invoicing'), |
|
71 | + esc_html($subscription->get_trial_period()) |
|
72 | 72 | ); |
73 | 73 | echo '</small>'; |
74 | 74 | |
@@ -77,18 +77,18 @@ discard block |
||
77 | 77 | break; |
78 | 78 | |
79 | 79 | case 'recurring_amount': |
80 | - $frequency = getpaid_get_subscription_period_label( $subscription->get_period(), $subscription->get_frequency(), '' ); |
|
81 | - $amount = wpinv_price( $subscription->get_recurring_amount(), $subscription->get_parent_payment()->get_currency() ); |
|
82 | - echo wp_kses_post( strtolower( "<strong style='font-weight: 500;'>$amount</strong> / <span class='getpaid-item-recurring-period'>$frequency</span>" ) ); |
|
80 | + $frequency = getpaid_get_subscription_period_label($subscription->get_period(), $subscription->get_frequency(), ''); |
|
81 | + $amount = wpinv_price($subscription->get_recurring_amount(), $subscription->get_parent_payment()->get_currency()); |
|
82 | + echo wp_kses_post(strtolower("<strong style='font-weight: 500;'>$amount</strong> / <span class='getpaid-item-recurring-period'>$frequency</span>")); |
|
83 | 83 | break; |
84 | 84 | |
85 | 85 | case 'item': |
86 | 86 | |
87 | - if ( empty( $subscription_group ) ) { |
|
88 | - echo wp_kses_post( WPInv_Subscriptions_List_Table::generate_item_markup( $subscription->get_product_id() ) ); |
|
87 | + if (empty($subscription_group)) { |
|
88 | + echo wp_kses_post(WPInv_Subscriptions_List_Table::generate_item_markup($subscription->get_product_id())); |
|
89 | 89 | } else { |
90 | - $markup = array_map( array( 'WPInv_Subscriptions_List_Table', 'generate_item_markup' ), array_keys( $subscription_group['items'] ) ); |
|
91 | - echo wp_kses_post( implode( ' | ', $markup ) ); |
|
90 | + $markup = array_map(array('WPInv_Subscriptions_List_Table', 'generate_item_markup'), array_keys($subscription_group['items'])); |
|
91 | + echo wp_kses_post(implode(' | ', $markup)); |
|
92 | 92 | } |
93 | 93 | |
94 | 94 | break; |
@@ -96,12 +96,12 @@ discard block |
||
96 | 96 | case 'payments': |
97 | 97 | |
98 | 98 | $max_activations = (int) $subscription->get_bill_times(); |
99 | - echo ( (int) $subscription->get_times_billed() ) . ' / ' . ( empty( $max_activations ) ? "∞" : (int) $max_activations ); |
|
99 | + echo ((int) $subscription->get_times_billed()) . ' / ' . (empty($max_activations) ? "∞" : (int) $max_activations); |
|
100 | 100 | |
101 | 101 | break; |
102 | 102 | |
103 | 103 | } |
104 | - do_action( "getpaid_render_single_subscription_column_$key", $subscription ); |
|
104 | + do_action("getpaid_render_single_subscription_column_$key", $subscription); |
|
105 | 105 | |
106 | 106 | ?> |
107 | 107 | </td> |
@@ -113,34 +113,34 @@ discard block |
||
113 | 113 | </tbody> |
114 | 114 | </table> |
115 | 115 | |
116 | -<?php if ( ! empty( $subscription_group ) ) : ?> |
|
117 | - <h2 class='mt-5 mb-1 h4'><?php _e( 'Subscription Items', 'invoicing' ); ?></h2> |
|
118 | - <?php getpaid_admin_subscription_item_details_metabox( $subscription ); ?> |
|
116 | +<?php if (!empty($subscription_group)) : ?> |
|
117 | + <h2 class='mt-5 mb-1 h4'><?php _e('Subscription Items', 'invoicing'); ?></h2> |
|
118 | + <?php getpaid_admin_subscription_item_details_metabox($subscription); ?> |
|
119 | 119 | <?php endif; ?> |
120 | 120 | |
121 | -<h2 class='mt-5 mb-1 h4'><?php _e( 'Related Invoices', 'invoicing' ); ?></h2> |
|
121 | +<h2 class='mt-5 mb-1 h4'><?php _e('Related Invoices', 'invoicing'); ?></h2> |
|
122 | 122 | |
123 | -<?php echo getpaid_admin_subscription_invoice_details_metabox( $subscription ); ?> |
|
123 | +<?php echo getpaid_admin_subscription_invoice_details_metabox($subscription); ?> |
|
124 | 124 | |
125 | -<?php if ( 1 < count( $subscription_groups ) ) : ?> |
|
126 | - <h2 class='mt-5 mb-1 h4'><?php _e( 'Related Subscriptions', 'invoicing' ); ?></h2> |
|
127 | - <?php getpaid_admin_subscription_related_subscriptions_metabox( $subscription ); ?> |
|
125 | +<?php if (1 < count($subscription_groups)) : ?> |
|
126 | + <h2 class='mt-5 mb-1 h4'><?php _e('Related Subscriptions', 'invoicing'); ?></h2> |
|
127 | + <?php getpaid_admin_subscription_related_subscriptions_metabox($subscription); ?> |
|
128 | 128 | <?php endif; ?> |
129 | 129 | |
130 | 130 | <span class="form-text"> |
131 | 131 | |
132 | 132 | <?php |
133 | - if ( $subscription->can_cancel() ) { |
|
133 | + if ($subscription->can_cancel()) { |
|
134 | 134 | printf( |
135 | 135 | '<a href="%s" class="btn btn-danger btn-sm" onclick="return confirm(\'%s\')">%s</a> ', |
136 | - esc_url( $subscription->get_cancel_url() ), |
|
137 | - esc_attr__( 'Are you sure you want to cancel this subscription?', 'invoicing' ), |
|
138 | - __( 'Cancel Subscription', 'invoicing' ) |
|
136 | + esc_url($subscription->get_cancel_url()), |
|
137 | + esc_attr__('Are you sure you want to cancel this subscription?', 'invoicing'), |
|
138 | + __('Cancel Subscription', 'invoicing') |
|
139 | 139 | ); |
140 | 140 | } |
141 | 141 | |
142 | - do_action( 'getpaid-single-subscription-page-actions', $subscription ); |
|
142 | + do_action('getpaid-single-subscription-page-actions', $subscription); |
|
143 | 143 | ?> |
144 | 144 | |
145 | - <a href="<?php echo esc_url( getpaid_get_tab_url( 'gp-subscriptions', get_permalink( (int) wpinv_get_option( 'invoice_subscription_page' ) ) ) ); ?>" class="btn btn-secondary btn-sm"><?php _e( 'Go Back', 'invoicing' ); ?></a> |
|
145 | + <a href="<?php echo esc_url(getpaid_get_tab_url('gp-subscriptions', get_permalink((int) wpinv_get_option('invoice_subscription_page')))); ?>" class="btn btn-secondary btn-sm"><?php _e('Go Back', 'invoicing'); ?></a> |
|
146 | 146 | </span> |
@@ -8,21 +8,21 @@ 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 | -<?php do_action( 'getpaid_invoice_before_line_items', $invoice ); ?> |
|
15 | +<?php do_action('getpaid_invoice_before_line_items', $invoice); ?> |
|
16 | 16 | |
17 | - <h2 class="mt-5 mb-1 h4"><?php echo sprintf( esc_html__( '%s Items', 'invoicing' ), esc_html( ucfirst( $invoice->get_invoice_quote_type() ) ) ); ?></h2> |
|
17 | + <h2 class="mt-5 mb-1 h4"><?php echo sprintf(esc_html__('%s Items', 'invoicing'), esc_html(ucfirst($invoice->get_invoice_quote_type()))); ?></h2> |
|
18 | 18 | <div class="getpaid-invoice-items mb-4 border"> |
19 | 19 | |
20 | 20 | |
21 | - <div class="getpaid-invoice-items-header <?php echo sanitize_html_class( $invoice->get_template() ); ?>"> |
|
21 | + <div class="getpaid-invoice-items-header <?php echo sanitize_html_class($invoice->get_template()); ?>"> |
|
22 | 22 | <div class="form-row"> |
23 | - <?php foreach ( $columns as $key => $label ) : ?> |
|
24 | - <div class="<?php echo 'name' == $key ? 'col-12 col-sm-6' : 'col-12 col-sm' ?> getpaid-invoice-line-item-col-<?php echo esc_attr( $key ); ?>"> |
|
25 | - <?php echo esc_html( $label ); ?> |
|
23 | + <?php foreach ($columns as $key => $label) : ?> |
|
24 | + <div class="<?php echo 'name' == $key ? 'col-12 col-sm-6' : 'col-12 col-sm' ?> getpaid-invoice-line-item-col-<?php echo esc_attr($key); ?>"> |
|
25 | + <?php echo esc_html($label); ?> |
|
26 | 26 | </div> |
27 | 27 | <?php endforeach; ?> |
28 | 28 | </div> |
@@ -32,20 +32,20 @@ discard block |
||
32 | 32 | <?php |
33 | 33 | |
34 | 34 | // Display the item totals. |
35 | - foreach ( $invoice->get_items() as $item ) { |
|
36 | - wpinv_get_template( 'invoice/line-item.php', compact( 'invoice', 'item', 'columns' ) ); |
|
35 | + foreach ($invoice->get_items() as $item) { |
|
36 | + wpinv_get_template('invoice/line-item.php', compact('invoice', 'item', 'columns')); |
|
37 | 37 | } |
38 | 38 | |
39 | 39 | // Display the fee totals. |
40 | - foreach ( $invoice->get_fees() as $fee ) { |
|
41 | - wpinv_get_template( 'invoice/fee-item.php', compact( 'invoice', 'fee', 'columns' ) ); |
|
40 | + foreach ($invoice->get_fees() as $fee) { |
|
41 | + wpinv_get_template('invoice/fee-item.php', compact('invoice', 'fee', 'columns')); |
|
42 | 42 | } |
43 | 43 | |
44 | 44 | // Display the cart totals. |
45 | - wpinv_get_template( 'invoice/line-totals.php', compact( 'invoice' ) ); |
|
45 | + wpinv_get_template('invoice/line-totals.php', compact('invoice')); |
|
46 | 46 | |
47 | 47 | ?> |
48 | 48 | |
49 | 49 | </div> |
50 | 50 | |
51 | -<?php do_action( 'getpaid_invoice_after_line_items', $invoice ); ?> |
|
51 | +<?php do_action('getpaid_invoice_after_line_items', $invoice); ?> |