@@ -8,7 +8,7 @@ discard block |
||
8 | 8 | */ |
9 | 9 | |
10 | 10 | if ( ! defined( 'ABSPATH' ) ) { |
11 | - exit; // Exit if accessed directly |
|
11 | + exit; // Exit if accessed directly |
|
12 | 12 | } |
13 | 13 | |
14 | 14 | /** |
@@ -17,12 +17,12 @@ discard block |
||
17 | 17 | class GetPaid_Meta_Box_Item_Details { |
18 | 18 | |
19 | 19 | /** |
20 | - * Output the metabox. |
|
21 | - * |
|
22 | - * @param WP_Post $post |
|
23 | - */ |
|
20 | + * Output the metabox. |
|
21 | + * |
|
22 | + * @param WP_Post $post |
|
23 | + */ |
|
24 | 24 | public static function output( $post ) { |
25 | - global $aui_bs5; |
|
25 | + global $aui_bs5; |
|
26 | 26 | |
27 | 27 | // Prepare the item. |
28 | 28 | $item = new WPInv_Item( $post ); |
@@ -119,24 +119,24 @@ discard block |
||
119 | 119 | // Dynamic pricing. |
120 | 120 | if ( $item->supports_dynamic_pricing() ) { |
121 | 121 | |
122 | - do_action( 'wpinv_item_details_metabox_before_dynamic_pricing_checkbox', $item ); |
|
122 | + do_action( 'wpinv_item_details_metabox_before_dynamic_pricing_checkbox', $item ); |
|
123 | 123 | |
124 | - // NYP toggle. |
|
125 | - aui()->input( |
|
124 | + // NYP toggle. |
|
125 | + aui()->input( |
|
126 | 126 | array( |
127 | - 'id' => 'wpinv_name_your_price', |
|
128 | - 'name' => 'wpinv_name_your_price', |
|
129 | - 'type' => 'checkbox', |
|
130 | - 'label' => apply_filters( 'wpinv_name_your_price_toggle_text', __( 'Let customers name their price', 'invoicing' ) ), |
|
131 | - 'value' => '1', |
|
132 | - 'checked' => $item->user_can_set_their_price(), |
|
133 | - 'no_wrap' => true, |
|
134 | - 'switch' => 'sm', |
|
127 | + 'id' => 'wpinv_name_your_price', |
|
128 | + 'name' => 'wpinv_name_your_price', |
|
129 | + 'type' => 'checkbox', |
|
130 | + 'label' => apply_filters( 'wpinv_name_your_price_toggle_text', __( 'Let customers name their price', 'invoicing' ) ), |
|
131 | + 'value' => '1', |
|
132 | + 'checked' => $item->user_can_set_their_price(), |
|
133 | + 'no_wrap' => true, |
|
134 | + 'switch' => 'sm', |
|
135 | 135 | ), |
136 | 136 | true |
137 | 137 | ); |
138 | 138 | |
139 | - do_action( 'wpinv_item_details_metabox_dynamic_pricing_checkbox', $item ); |
|
139 | + do_action( 'wpinv_item_details_metabox_dynamic_pricing_checkbox', $item ); |
|
140 | 140 | |
141 | 141 | } |
142 | 142 | |
@@ -151,7 +151,7 @@ discard block |
||
151 | 151 | 'value' => '1', |
152 | 152 | 'checked' => $item->is_recurring(), |
153 | 153 | 'no_wrap' => true, |
154 | - 'switch' => 'sm', |
|
154 | + 'switch' => 'sm', |
|
155 | 155 | ), |
156 | 156 | true |
157 | 157 | ); |
@@ -293,35 +293,35 @@ discard block |
||
293 | 293 | } |
294 | 294 | |
295 | 295 | /** |
296 | - * Save meta box data. |
|
297 | - * |
|
298 | - * @param int $post_id |
|
299 | - */ |
|
300 | - public static function save( $post_id ) { |
|
296 | + * Save meta box data. |
|
297 | + * |
|
298 | + * @param int $post_id |
|
299 | + */ |
|
300 | + public static function save( $post_id ) { |
|
301 | 301 | |
302 | 302 | // Prepare the item. |
303 | 303 | $item = new WPInv_Item( $post_id ); |
304 | 304 | |
305 | 305 | // Load new data. |
306 | 306 | $item->set_props( |
307 | - array( |
|
308 | - 'price' => isset( $_POST['wpinv_item_price'] ) ? getpaid_standardize_amount( $_POST['wpinv_item_price'] ) : null, |
|
309 | - 'vat_rule' => isset( $_POST['wpinv_vat_rules'] ) ? wpinv_clean( $_POST['wpinv_vat_rules'] ) : null, |
|
310 | - 'vat_class' => isset( $_POST['wpinv_vat_class'] ) ? wpinv_clean( $_POST['wpinv_vat_class'] ) : null, |
|
311 | - 'type' => isset( $_POST['wpinv_item_type'] ) ? wpinv_clean( $_POST['wpinv_item_type'] ) : null, |
|
312 | - 'is_dynamic_pricing' => ! empty( $_POST['wpinv_name_your_price'] ), |
|
307 | + array( |
|
308 | + 'price' => isset( $_POST['wpinv_item_price'] ) ? getpaid_standardize_amount( $_POST['wpinv_item_price'] ) : null, |
|
309 | + 'vat_rule' => isset( $_POST['wpinv_vat_rules'] ) ? wpinv_clean( $_POST['wpinv_vat_rules'] ) : null, |
|
310 | + 'vat_class' => isset( $_POST['wpinv_vat_class'] ) ? wpinv_clean( $_POST['wpinv_vat_class'] ) : null, |
|
311 | + 'type' => isset( $_POST['wpinv_item_type'] ) ? wpinv_clean( $_POST['wpinv_item_type'] ) : null, |
|
312 | + 'is_dynamic_pricing' => ! empty( $_POST['wpinv_name_your_price'] ), |
|
313 | 313 | 'minimum_price' => isset( $_POST['wpinv_minimum_price'] ) ? getpaid_standardize_amount( $_POST['wpinv_minimum_price'] ) : null, |
314 | - 'is_recurring' => ! empty( $_POST['wpinv_is_recurring'] ), |
|
315 | - 'recurring_period' => isset( $_POST['wpinv_recurring_period'] ) ? wpinv_clean( $_POST['wpinv_recurring_period'] ) : null, |
|
316 | - 'recurring_interval' => isset( $_POST['wpinv_recurring_interval'] ) ? (int) $_POST['wpinv_recurring_interval'] : 1, |
|
317 | - 'recurring_limit' => isset( $_POST['wpinv_recurring_limit'] ) ? (int) $_POST['wpinv_recurring_limit'] : null, |
|
318 | - 'is_free_trial' => isset( $_POST['wpinv_trial_interval'] ) ? ( 0 != (int) $_POST['wpinv_trial_interval'] ) : null, |
|
319 | - 'trial_period' => isset( $_POST['wpinv_trial_period'] ) ? wpinv_clean( $_POST['wpinv_trial_period'] ) : null, |
|
320 | - 'trial_interval' => isset( $_POST['wpinv_trial_interval'] ) ? (int) $_POST['wpinv_trial_interval'] : null, |
|
321 | - ) |
|
314 | + 'is_recurring' => ! empty( $_POST['wpinv_is_recurring'] ), |
|
315 | + 'recurring_period' => isset( $_POST['wpinv_recurring_period'] ) ? wpinv_clean( $_POST['wpinv_recurring_period'] ) : null, |
|
316 | + 'recurring_interval' => isset( $_POST['wpinv_recurring_interval'] ) ? (int) $_POST['wpinv_recurring_interval'] : 1, |
|
317 | + 'recurring_limit' => isset( $_POST['wpinv_recurring_limit'] ) ? (int) $_POST['wpinv_recurring_limit'] : null, |
|
318 | + 'is_free_trial' => isset( $_POST['wpinv_trial_interval'] ) ? ( 0 != (int) $_POST['wpinv_trial_interval'] ) : null, |
|
319 | + 'trial_period' => isset( $_POST['wpinv_trial_period'] ) ? wpinv_clean( $_POST['wpinv_trial_period'] ) : null, |
|
320 | + 'trial_interval' => isset( $_POST['wpinv_trial_interval'] ) ? (int) $_POST['wpinv_trial_interval'] : null, |
|
321 | + ) |
|
322 | 322 | ); |
323 | 323 | |
324 | - $item->save(); |
|
325 | - do_action( 'getpaid_item_metabox_save', $post_id, $item ); |
|
326 | - } |
|
324 | + $item->save(); |
|
325 | + do_action( 'getpaid_item_metabox_save', $post_id, $item ); |
|
326 | + } |
|
327 | 327 | } |
@@ -57,9 +57,12 @@ discard block |
||
57 | 57 | <div class="input-group-prepend"> |
58 | 58 | <span class="input-group-text"><?php echo wp_kses_post( wpinv_currency_symbol() ); ?></span> |
59 | 59 | </div> |
60 | - <?php else : ?> |
|
60 | + <?php else { |
|
61 | + : ?> |
|
61 | 62 | <span class="input-group-text"> |
62 | - <?php echo wp_kses_post( wpinv_currency_symbol() ); ?> |
|
63 | + <?php echo wp_kses_post( wpinv_currency_symbol() ); |
|
64 | +} |
|
65 | +?> |
|
63 | 66 | </span> |
64 | 67 | <?php endif; ?> |
65 | 68 | <?php endif; ?> |
@@ -71,9 +74,12 @@ discard block |
||
71 | 74 | <div class="input-group-append"> |
72 | 75 | <span class="input-group-text"><?php echo wp_kses_post( wpinv_currency_symbol() ); ?></span> |
73 | 76 | </div> |
74 | - <?php else : ?> |
|
77 | + <?php else { |
|
78 | + : ?> |
|
75 | 79 | <span class="input-group-text"> |
76 | - <?php echo wp_kses_post( wpinv_currency_symbol() ); ?> |
|
80 | + <?php echo wp_kses_post( wpinv_currency_symbol() ); |
|
81 | +} |
|
82 | +?> |
|
77 | 83 | </span> |
78 | 84 | <?php endif; ?> |
79 | 85 | <?php endif; ?> |
@@ -83,8 +89,11 @@ discard block |
||
83 | 89 | <div class="mb-3 input-group input-group-sm"> |
84 | 90 | <?php if ( empty( $aui_bs5 ) ) : ?> |
85 | 91 | <div class="input-group-prepend"><span class="input-group-text pl-0 pr-2 border-0 bg-transparent"><?php esc_html_e( 'every' ); ?></span></div> |
86 | - <?php else : ?> |
|
87 | - <span class="input-group-text ps-0 pe-2 border-0"><?php esc_html_e( 'every' ); ?></span> |
|
92 | + <?php else { |
|
93 | + : ?> |
|
94 | + <span class="input-group-text ps-0 pe-2 border-0"><?php esc_html_e( 'every' ); |
|
95 | +} |
|
96 | +?></span> |
|
88 | 97 | <?php endif; ?> |
89 | 98 | <input type="number" name="wpinv_recurring_interval" id="wpinv_recurring_interval" value="<?php echo esc_attr( $item->get_recurring_interval( 'edit' ) ); ?>" placeholder="1" class="form-control rounded-1 rounded-sm"> |
90 | 99 | </div> |
@@ -185,9 +194,12 @@ discard block |
||
185 | 194 | <div class="input-group-prepend"> |
186 | 195 | <span class="input-group-text"><?php echo wp_kses_post( wpinv_currency_symbol() ); ?></span> |
187 | 196 | </div> |
188 | - <?php else : ?> |
|
197 | + <?php else { |
|
198 | + : ?> |
|
189 | 199 | <span class="input-group-text"> |
190 | - <?php echo wp_kses_post( wpinv_currency_symbol() ); ?> |
|
200 | + <?php echo wp_kses_post( wpinv_currency_symbol() ); |
|
201 | +} |
|
202 | +?> |
|
191 | 203 | </span> |
192 | 204 | <?php endif; ?> |
193 | 205 | <?php endif; ?> |
@@ -199,9 +211,12 @@ discard block |
||
199 | 211 | <div class="input-group-append"> |
200 | 212 | <span class="input-group-text"><?php echo wp_kses_post( wpinv_currency_symbol() ); ?></span> |
201 | 213 | </div> |
202 | - <?php else : ?> |
|
214 | + <?php else { |
|
215 | + : ?> |
|
203 | 216 | <span class="input-group-text"> |
204 | - <?php echo wp_kses_post( wpinv_currency_symbol() ); ?> |
|
217 | + <?php echo wp_kses_post( wpinv_currency_symbol() ); |
|
218 | +} |
|
219 | +?> |
|
205 | 220 | </span> |
206 | 221 | <?php endif; ?> |
207 | 222 | <?php endif; ?> |