@@ -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 | } |
@@ -7,7 +7,7 @@ discard block |
||
7 | 7 | * |
8 | 8 | */ |
9 | 9 | |
10 | -if ( ! defined( 'ABSPATH' ) ) { |
|
10 | +if (!defined('ABSPATH')) { |
|
11 | 11 | exit; // Exit if accessed directly |
12 | 12 | } |
13 | 13 | |
@@ -21,59 +21,59 @@ discard block |
||
21 | 21 | * |
22 | 22 | * @param WP_Post $post |
23 | 23 | */ |
24 | - public static function output( $post ) { |
|
24 | + public static function output($post) { |
|
25 | 25 | global $aui_bs5; |
26 | 26 | |
27 | 27 | // Prepare the item. |
28 | - $item = new WPInv_Item( $post ); |
|
28 | + $item = new WPInv_Item($post); |
|
29 | 29 | |
30 | 30 | // Nonce field. |
31 | - wp_nonce_field( 'getpaid_meta_nonce', 'getpaid_meta_nonce' ); |
|
31 | + wp_nonce_field('getpaid_meta_nonce', 'getpaid_meta_nonce'); |
|
32 | 32 | |
33 | 33 | // Set the currency position. |
34 | 34 | $position = wpinv_currency_position(); |
35 | 35 | |
36 | - if ( $position == 'left_space' ) { |
|
36 | + if ($position == 'left_space') { |
|
37 | 37 | $position = 'left'; |
38 | 38 | } |
39 | 39 | |
40 | - if ( $position == 'right_space' ) { |
|
40 | + if ($position == 'right_space') { |
|
41 | 41 | $position = 'right'; |
42 | 42 | } |
43 | 43 | |
44 | 44 | ?> |
45 | - <input type="hidden" id="_wpi_current_type" value="<?php echo esc_attr( $item->get_type( 'edit' ) ); ?>" /> |
|
45 | + <input type="hidden" id="_wpi_current_type" value="<?php echo esc_attr($item->get_type('edit')); ?>" /> |
|
46 | 46 | <style>#poststuff .input-group-text,#poststuff .form-control{border-color:#7e8993}.bsui label.col-sm-3.col-form-label{font-weight:600}.form-check input[type="checkbox"]:checked::before{content:none}</style> |
47 | 47 | <div class='bsui' style='max-width:650px;'><div class="pt-3"> |
48 | - <?php do_action( 'wpinv_item_details_metabox_before_price', $item ); ?> |
|
48 | + <?php do_action('wpinv_item_details_metabox_before_price', $item); ?> |
|
49 | 49 | <div class="form-group mb-3 row"> |
50 | - <label class="col-sm-3 col-form-label" for="wpinv_item_price"><span><?php esc_html_e( 'Item Price', 'invoicing' ); ?></span></label> |
|
50 | + <label class="col-sm-3 col-form-label" for="wpinv_item_price"><span><?php esc_html_e('Item Price', 'invoicing'); ?></span></label> |
|
51 | 51 | <div class="col-sm-8"> |
52 | 52 | <div class="row"> |
53 | 53 | <div class="col-sm-4 getpaid-price-input"> |
54 | 54 | <div class="mb-3 input-group input-group-sm"> |
55 | - <?php if ( 'left' == $position ) : ?> |
|
56 | - <?php if ( empty( $aui_bs5 ) ) : ?> |
|
55 | + <?php if ('left' == $position) : ?> |
|
56 | + <?php if (empty($aui_bs5)) : ?> |
|
57 | 57 | <div class="input-group-prepend"> |
58 | - <span class="input-group-text"><?php echo wp_kses_post( wpinv_currency_symbol() ); ?></span> |
|
58 | + <span class="input-group-text"><?php echo wp_kses_post(wpinv_currency_symbol()); ?></span> |
|
59 | 59 | </div> |
60 | 60 | <?php else : ?> |
61 | 61 | <span class="input-group-text"> |
62 | - <?php echo wp_kses_post( wpinv_currency_symbol() ); ?> |
|
62 | + <?php echo wp_kses_post(wpinv_currency_symbol()); ?> |
|
63 | 63 | </span> |
64 | 64 | <?php endif; ?> |
65 | 65 | <?php endif; ?> |
66 | 66 | |
67 | - <input type="text" name="wpinv_item_price" id="wpinv_item_price" value="<?php echo esc_attr( getpaid_unstandardize_amount( $item->get_price( 'edit' ) ) ); ?>" placeholder="<?php echo esc_attr( wpinv_sanitize_amount( 0 ) ); ?>" class="form-control"> |
|
67 | + <input type="text" name="wpinv_item_price" id="wpinv_item_price" value="<?php echo esc_attr(getpaid_unstandardize_amount($item->get_price('edit'))); ?>" placeholder="<?php echo esc_attr(wpinv_sanitize_amount(0)); ?>" class="form-control"> |
|
68 | 68 | |
69 | - <?php if ( 'left' != $position ) : ?> |
|
70 | - <?php if ( empty( $aui_bs5 ) ) : ?> |
|
69 | + <?php if ('left' != $position) : ?> |
|
70 | + <?php if (empty($aui_bs5)) : ?> |
|
71 | 71 | <div class="input-group-append"> |
72 | - <span class="input-group-text"><?php echo wp_kses_post( wpinv_currency_symbol() ); ?></span> |
|
72 | + <span class="input-group-text"><?php echo wp_kses_post(wpinv_currency_symbol()); ?></span> |
|
73 | 73 | </div> |
74 | 74 | <?php else : ?> |
75 | 75 | <span class="input-group-text"> |
76 | - <?php echo wp_kses_post( wpinv_currency_symbol() ); ?> |
|
76 | + <?php echo wp_kses_post(wpinv_currency_symbol()); ?> |
|
77 | 77 | </span> |
78 | 78 | <?php endif; ?> |
79 | 79 | <?php endif; ?> |
@@ -81,12 +81,12 @@ discard block |
||
81 | 81 | </div> |
82 | 82 | <div class="col-sm-4 wpinv_show_if_recurring"> |
83 | 83 | <div class="mb-3 input-group input-group-sm"> |
84 | - <?php if ( empty( $aui_bs5 ) ) : ?> |
|
85 | - <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> |
|
84 | + <?php if (empty($aui_bs5)) : ?> |
|
85 | + <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 | 86 | <?php else : ?> |
87 | - <span class="input-group-text ps-0 pe-2 border-0"><?php esc_html_e( 'every' ); ?></span> |
|
87 | + <span class="input-group-text ps-0 pe-2 border-0"><?php esc_html_e('every'); ?></span> |
|
88 | 88 | <?php endif; ?> |
89 | - <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"> |
|
89 | + <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 | 90 | </div> |
91 | 91 | </div> |
92 | 92 | <div class="col-sm-4 wpinv_show_if_recurring"> |
@@ -95,16 +95,16 @@ discard block |
||
95 | 95 | array( |
96 | 96 | 'id' => 'wpinv_recurring_period', |
97 | 97 | 'name' => 'wpinv_recurring_period', |
98 | - 'label' => __( 'Period', 'invoicing' ), |
|
99 | - 'placeholder' => __( 'Select Period', 'invoicing' ), |
|
100 | - 'value' => $item->get_recurring_period( 'edit' ), |
|
98 | + 'label' => __('Period', 'invoicing'), |
|
99 | + 'placeholder' => __('Select Period', 'invoicing'), |
|
100 | + 'value' => $item->get_recurring_period('edit'), |
|
101 | 101 | 'data-allow-clear' => 'false', |
102 | - 'class' => ( $aui_bs5 ? 'form-select-sm' : 'custom-select-sm' ), |
|
102 | + 'class' => ($aui_bs5 ? 'form-select-sm' : 'custom-select-sm'), |
|
103 | 103 | 'options' => array( |
104 | - 'D' => __( 'day(s)', 'invoicing' ), |
|
105 | - 'W' => __( 'week(s)', 'invoicing' ), |
|
106 | - 'M' => __( 'month(s)', 'invoicing' ), |
|
107 | - 'Y' => __( 'year(s)', 'invoicing' ), |
|
104 | + 'D' => __('day(s)', 'invoicing'), |
|
105 | + 'W' => __('week(s)', 'invoicing'), |
|
106 | + 'M' => __('month(s)', 'invoicing'), |
|
107 | + 'Y' => __('year(s)', 'invoicing'), |
|
108 | 108 | ), |
109 | 109 | ), |
110 | 110 | true |
@@ -117,9 +117,9 @@ discard block |
||
117 | 117 | <?php |
118 | 118 | |
119 | 119 | // Dynamic pricing. |
120 | - if ( $item->supports_dynamic_pricing() ) { |
|
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 | 124 | // NYP toggle. |
125 | 125 | aui()->input( |
@@ -127,7 +127,7 @@ discard block |
||
127 | 127 | 'id' => 'wpinv_name_your_price', |
128 | 128 | 'name' => 'wpinv_name_your_price', |
129 | 129 | 'type' => 'checkbox', |
130 | - 'label' => apply_filters( 'wpinv_name_your_price_toggle_text', __( 'Let customers name their price', 'invoicing' ) ), |
|
130 | + 'label' => apply_filters('wpinv_name_your_price_toggle_text', __('Let customers name their price', 'invoicing')), |
|
131 | 131 | 'value' => '1', |
132 | 132 | 'checked' => $item->user_can_set_their_price(), |
133 | 133 | 'no_wrap' => true, |
@@ -136,18 +136,18 @@ discard block |
||
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 | |
143 | 143 | // Subscriptions. |
144 | - do_action( 'wpinv_item_details_metabox_before_subscription_checkbox', $item ); |
|
144 | + do_action('wpinv_item_details_metabox_before_subscription_checkbox', $item); |
|
145 | 145 | aui()->input( |
146 | 146 | array( |
147 | 147 | 'id' => 'wpinv_is_recurring', |
148 | 148 | 'name' => 'wpinv_is_recurring', |
149 | 149 | 'type' => 'checkbox', |
150 | - 'label' => apply_filters( 'wpinv_is_recurring_toggle_text', __( 'Charge customers a recurring amount for this item', 'invoicing' ) ), |
|
150 | + 'label' => apply_filters('wpinv_is_recurring_toggle_text', __('Charge customers a recurring amount for this item', 'invoicing')), |
|
151 | 151 | 'value' => '1', |
152 | 152 | 'checked' => $item->is_recurring(), |
153 | 153 | 'no_wrap' => true, |
@@ -155,53 +155,53 @@ discard block |
||
155 | 155 | ), |
156 | 156 | true |
157 | 157 | ); |
158 | - do_action( 'wpinv_item_details_metabox_subscription_checkbox', $item ); |
|
158 | + do_action('wpinv_item_details_metabox_subscription_checkbox', $item); |
|
159 | 159 | |
160 | 160 | ?> |
161 | 161 | <div class="wpinv_show_if_recurring"> |
162 | - <em><?php echo wp_kses_post( wpinv_get_recurring_gateways_text() ); ?></em> |
|
162 | + <em><?php echo wp_kses_post(wpinv_get_recurring_gateways_text()); ?></em> |
|
163 | 163 | </div> |
164 | 164 | </div> |
165 | 165 | </div> |
166 | 166 | </div> |
167 | 167 | <div class="col-sm-1 pt-2 pl-0"> |
168 | - <span class="wpi-help-tip dashicons dashicons-editor-help wpinv_show_if_recurring" title="<?php esc_attr_e( 'Set the subscription price, billing interval and period.', 'invoicing' ); ?>"></span> |
|
168 | + <span class="wpi-help-tip dashicons dashicons-editor-help wpinv_show_if_recurring" title="<?php esc_attr_e('Set the subscription price, billing interval and period.', 'invoicing'); ?>"></span> |
|
169 | 169 | </div> |
170 | 170 | </div> |
171 | - <?php do_action( 'wpinv_item_details_metabox_after_price', $item ); ?> |
|
171 | + <?php do_action('wpinv_item_details_metabox_after_price', $item); ?> |
|
172 | 172 | |
173 | - <?php if ( $item->supports_dynamic_pricing() ) : ?> |
|
174 | - <?php do_action( 'wpinv_item_details_metabox_before_minimum_price', $item ); ?> |
|
173 | + <?php if ($item->supports_dynamic_pricing()) : ?> |
|
174 | + <?php do_action('wpinv_item_details_metabox_before_minimum_price', $item); ?> |
|
175 | 175 | <div class="wpinv_show_if_dynamic wpinv_minimum_price"> |
176 | 176 | |
177 | 177 | <div class="form-group mb-3 row"> |
178 | 178 | <label for="wpinv_minimum_price" class="col-sm-3 col-form-label"> |
179 | - <?php esc_html_e( 'Minimum Price', 'invoicing' ); ?> |
|
179 | + <?php esc_html_e('Minimum Price', 'invoicing'); ?> |
|
180 | 180 | </label> |
181 | 181 | <div class="col-sm-8"> |
182 | 182 | <div class="input-group input-group-sm"> |
183 | - <?php if ( 'left' == $position ) : ?> |
|
184 | - <?php if ( empty( $aui_bs5 ) ) : ?> |
|
183 | + <?php if ('left' == $position) : ?> |
|
184 | + <?php if (empty($aui_bs5)) : ?> |
|
185 | 185 | <div class="input-group-prepend"> |
186 | - <span class="input-group-text"><?php echo wp_kses_post( wpinv_currency_symbol() ); ?></span> |
|
186 | + <span class="input-group-text"><?php echo wp_kses_post(wpinv_currency_symbol()); ?></span> |
|
187 | 187 | </div> |
188 | 188 | <?php else : ?> |
189 | 189 | <span class="input-group-text"> |
190 | - <?php echo wp_kses_post( wpinv_currency_symbol() ); ?> |
|
190 | + <?php echo wp_kses_post(wpinv_currency_symbol()); ?> |
|
191 | 191 | </span> |
192 | 192 | <?php endif; ?> |
193 | 193 | <?php endif; ?> |
194 | 194 | |
195 | - <input type="text" name="wpinv_minimum_price" id="wpinv_minimum_price" value="<?php echo esc_attr( getpaid_unstandardize_amount( $item->get_minimum_price( 'edit' ) ) ); ?>" placeholder="<?php echo esc_attr( wpinv_sanitize_amount( 0 ) ); ?>" class="form-control"> |
|
195 | + <input type="text" name="wpinv_minimum_price" id="wpinv_minimum_price" value="<?php echo esc_attr(getpaid_unstandardize_amount($item->get_minimum_price('edit'))); ?>" placeholder="<?php echo esc_attr(wpinv_sanitize_amount(0)); ?>" class="form-control"> |
|
196 | 196 | |
197 | - <?php if ( 'left' != $position ) : ?> |
|
198 | - <?php if ( empty( $aui_bs5 ) ) : ?> |
|
197 | + <?php if ('left' != $position) : ?> |
|
198 | + <?php if (empty($aui_bs5)) : ?> |
|
199 | 199 | <div class="input-group-append"> |
200 | - <span class="input-group-text"><?php echo wp_kses_post( wpinv_currency_symbol() ); ?></span> |
|
200 | + <span class="input-group-text"><?php echo wp_kses_post(wpinv_currency_symbol()); ?></span> |
|
201 | 201 | </div> |
202 | 202 | <?php else : ?> |
203 | 203 | <span class="input-group-text"> |
204 | - <?php echo wp_kses_post( wpinv_currency_symbol() ); ?> |
|
204 | + <?php echo wp_kses_post(wpinv_currency_symbol()); ?> |
|
205 | 205 | </span> |
206 | 206 | <?php endif; ?> |
207 | 207 | <?php endif; ?> |
@@ -209,45 +209,45 @@ discard block |
||
209 | 209 | </div> |
210 | 210 | |
211 | 211 | <div class="col-sm-1 pt-2 pl-0"> |
212 | - <span class="wpi-help-tip dashicons dashicons-editor-help" title="<?php esc_attr_e( 'Enter the minimum amount that users are allowed to set', 'invoicing' ); ?>"></span> |
|
212 | + <span class="wpi-help-tip dashicons dashicons-editor-help" title="<?php esc_attr_e('Enter the minimum amount that users are allowed to set', 'invoicing'); ?>"></span> |
|
213 | 213 | </div> |
214 | 214 | </div> |
215 | 215 | |
216 | 216 | </div> |
217 | - <?php do_action( 'wpinv_item_details_metabox_minimum_price', $item ); ?> |
|
217 | + <?php do_action('wpinv_item_details_metabox_minimum_price', $item); ?> |
|
218 | 218 | <?php endif; ?> |
219 | 219 | |
220 | - <?php do_action( 'wpinv_item_details_metabox_before_maximum_renewals', $item ); ?> |
|
220 | + <?php do_action('wpinv_item_details_metabox_before_maximum_renewals', $item); ?> |
|
221 | 221 | <div class="wpinv_show_if_recurring wpinv_maximum_renewals"> |
222 | 222 | |
223 | 223 | <div class="form-group mb-3 row"> |
224 | 224 | <label for="wpinv_recurring_limit" class="col-sm-3 col-form-label"> |
225 | - <?php esc_html_e( 'Maximum Renewals', 'invoicing' ); ?> |
|
225 | + <?php esc_html_e('Maximum Renewals', 'invoicing'); ?> |
|
226 | 226 | </label> |
227 | 227 | <div class="col-sm-8"> |
228 | - <input type="number" value="<?php echo esc_attr( $item->get_recurring_limit( 'edit' ) ); ?>" placeholder="0" name="wpinv_recurring_limit" id="wpinv_recurring_limit" class="form-control form-control-sm" /> |
|
228 | + <input type="number" value="<?php echo esc_attr($item->get_recurring_limit('edit')); ?>" placeholder="0" name="wpinv_recurring_limit" id="wpinv_recurring_limit" class="form-control form-control-sm" /> |
|
229 | 229 | </div> |
230 | 230 | <div class="col-sm-1 pt-2 pl-0"> |
231 | - <span class="wpi-help-tip dashicons dashicons-editor-help" title="<?php esc_attr_e( 'Leave empty if you want the subscription to renew until it is cancelled.', 'invoicing' ); ?>"></span> |
|
231 | + <span class="wpi-help-tip dashicons dashicons-editor-help" title="<?php esc_attr_e('Leave empty if you want the subscription to renew until it is cancelled.', 'invoicing'); ?>"></span> |
|
232 | 232 | </div> |
233 | 233 | </div> |
234 | 234 | |
235 | 235 | </div> |
236 | - <?php do_action( 'wpinv_item_details_metabox_maximum_renewals', $item ); ?> |
|
236 | + <?php do_action('wpinv_item_details_metabox_maximum_renewals', $item); ?> |
|
237 | 237 | |
238 | - <?php do_action( 'wpinv_item_details_metabox_before_free_trial', $item ); ?> |
|
238 | + <?php do_action('wpinv_item_details_metabox_before_free_trial', $item); ?> |
|
239 | 239 | <div class="wpinv_show_if_recurring wpinv_free_trial"> |
240 | 240 | |
241 | 241 | <div class="form-group mb-3 row"> |
242 | - <label class="col-sm-3 col-form-label" for="wpinv_trial_interval"><?php defined( 'GETPAID_PAID_TRIALS_VERSION' ) ? esc_html_e( 'Free/Paid Trial', 'invoicing' ) : esc_html_e( 'Free Trial', 'invoicing' ); ?></label> |
|
242 | + <label class="col-sm-3 col-form-label" for="wpinv_trial_interval"><?php defined('GETPAID_PAID_TRIALS_VERSION') ? esc_html_e('Free/Paid Trial', 'invoicing') : esc_html_e('Free Trial', 'invoicing'); ?></label> |
|
243 | 243 | |
244 | 244 | <div class="col-sm-8"> |
245 | 245 | <div class="row"> |
246 | 246 | <div class="col-sm-6"> |
247 | - <?php $value = $item->has_free_trial() ? $item->get_trial_interval( 'edit' ) : 0; ?> |
|
247 | + <?php $value = $item->has_free_trial() ? $item->get_trial_interval('edit') : 0; ?> |
|
248 | 248 | |
249 | 249 | <div> |
250 | - <input type="number" name="wpinv_trial_interval" placeholder="0" id="wpinv_trial_interval" value="<?php echo esc_attr( $value ); ?>" class="form-control form-control-sm"> |
|
250 | + <input type="number" name="wpinv_trial_interval" placeholder="0" id="wpinv_trial_interval" value="<?php echo esc_attr($value); ?>" class="form-control form-control-sm"> |
|
251 | 251 | </div> |
252 | 252 | </div> |
253 | 253 | <div class="col-sm-6"> |
@@ -256,17 +256,17 @@ discard block |
||
256 | 256 | array( |
257 | 257 | 'id' => 'wpinv_trial_period', |
258 | 258 | 'name' => 'wpinv_trial_period', |
259 | - 'label' => __( 'Trial Period', 'invoicing' ), |
|
260 | - 'placeholder' => __( 'Trial Period', 'invoicing' ), |
|
261 | - 'value' => $item->get_trial_period( 'edit' ), |
|
259 | + 'label' => __('Trial Period', 'invoicing'), |
|
260 | + 'placeholder' => __('Trial Period', 'invoicing'), |
|
261 | + 'value' => $item->get_trial_period('edit'), |
|
262 | 262 | 'data-allow-clear' => 'false', |
263 | 263 | 'no_wrap' => true, |
264 | - 'class' => ( $aui_bs5 ? 'form-select-sm' : 'custom-select-sm' ), |
|
264 | + 'class' => ($aui_bs5 ? 'form-select-sm' : 'custom-select-sm'), |
|
265 | 265 | 'options' => array( |
266 | - 'D' => __( 'day(s)', 'invoicing' ), |
|
267 | - 'W' => __( 'week(s)', 'invoicing' ), |
|
268 | - 'M' => __( 'month(s)', 'invoicing' ), |
|
269 | - 'Y' => __( 'year(s)', 'invoicing' ), |
|
266 | + 'D' => __('day(s)', 'invoicing'), |
|
267 | + 'W' => __('week(s)', 'invoicing'), |
|
268 | + 'M' => __('month(s)', 'invoicing'), |
|
269 | + 'Y' => __('year(s)', 'invoicing'), |
|
270 | 270 | ), |
271 | 271 | ), |
272 | 272 | true |
@@ -278,15 +278,15 @@ discard block |
||
278 | 278 | </div> |
279 | 279 | |
280 | 280 | <div class="col-sm-1 pt-2 pl-0"> |
281 | - <span class="wpi-help-tip dashicons dashicons-editor-help" title="<?php esc_attr_e( 'An optional period of time to wait before charging the first recurring payment.', 'invoicing' ); ?>"></span> |
|
281 | + <span class="wpi-help-tip dashicons dashicons-editor-help" title="<?php esc_attr_e('An optional period of time to wait before charging the first recurring payment.', 'invoicing'); ?>"></span> |
|
282 | 282 | </div> |
283 | 283 | |
284 | 284 | </div> |
285 | 285 | |
286 | 286 | </div> |
287 | - <?php do_action( 'wpinv_item_details_metabox__free_trial', $item ); ?> |
|
287 | + <?php do_action('wpinv_item_details_metabox__free_trial', $item); ?> |
|
288 | 288 | |
289 | - <?php do_action( 'wpinv_item_details_metabox_item_details', $item ); ?> |
|
289 | + <?php do_action('wpinv_item_details_metabox_item_details', $item); ?> |
|
290 | 290 | </div> |
291 | 291 | </div> |
292 | 292 | <?php |
@@ -297,31 +297,31 @@ discard block |
||
297 | 297 | * |
298 | 298 | * @param int $post_id |
299 | 299 | */ |
300 | - public static function save( $post_id ) { |
|
300 | + public static function save($post_id) { |
|
301 | 301 | |
302 | 302 | // Prepare the item. |
303 | - $item = new WPInv_Item( $post_id ); |
|
303 | + $item = new WPInv_Item($post_id); |
|
304 | 304 | |
305 | 305 | // Load new data. |
306 | 306 | $item->set_props( |
307 | 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 | - '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, |
|
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 | + '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 | 321 | ) |
322 | 322 | ); |
323 | 323 | |
324 | 324 | $item->save(); |
325 | - do_action( 'getpaid_item_metabox_save', $post_id, $item ); |
|
325 | + do_action('getpaid_item_metabox_save', $post_id, $item); |
|
326 | 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; ?> |