@@ -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,27 +21,27 @@ 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 | |
26 | 26 | // Prepare the item. |
27 | - $item = new WPInv_Item( $post ); |
|
27 | + $item = new WPInv_Item($post); |
|
28 | 28 | |
29 | 29 | // Nonce field. |
30 | - wp_nonce_field( 'getpaid_meta_nonce', 'getpaid_meta_nonce' ); |
|
30 | + wp_nonce_field('getpaid_meta_nonce', 'getpaid_meta_nonce'); |
|
31 | 31 | |
32 | 32 | // Set the currency position. |
33 | 33 | $position = wpinv_currency_position(); |
34 | 34 | |
35 | - if ( $position == 'left_space' ) { |
|
35 | + if ($position == 'left_space') { |
|
36 | 36 | $position = 'left'; |
37 | 37 | } |
38 | 38 | |
39 | - if ( $position == 'right_space' ) { |
|
39 | + if ($position == 'right_space') { |
|
40 | 40 | $position = 'right'; |
41 | 41 | } |
42 | 42 | |
43 | 43 | ?> |
44 | - <input type="hidden" id="_wpi_current_type" value="<?php echo esc_attr( $item->get_type( 'edit' ) ); ?>" /> |
|
44 | + <input type="hidden" id="_wpi_current_type" value="<?php echo esc_attr($item->get_type('edit')); ?>" /> |
|
45 | 45 | <style> |
46 | 46 | #poststuff .input-group-text, |
47 | 47 | #poststuff .form-control { |
@@ -55,21 +55,21 @@ discard block |
||
55 | 55 | </style> |
56 | 56 | <div class='bsui' style='max-width: 600px;padding-top: 10px;'> |
57 | 57 | |
58 | - <?php do_action( 'wpinv_item_details_metabox_before_price', $item ); ?> |
|
58 | + <?php do_action('wpinv_item_details_metabox_before_price', $item); ?> |
|
59 | 59 | <div class="form-group row"> |
60 | - <label class="col-sm-3 col-form-label" for="wpinv_item_price"><span><?php _e( 'Item Price', 'invoicing' )?></span></label> |
|
60 | + <label class="col-sm-3 col-form-label" for="wpinv_item_price"><span><?php _e('Item Price', 'invoicing')?></span></label> |
|
61 | 61 | <div class="col-sm-8"> |
62 | 62 | <div class="row"> |
63 | 63 | <div class="col-sm-4 getpaid-price-input"> |
64 | 64 | <div class="input-group input-group-sm"> |
65 | - <?php if( 'left' == $position ) : ?> |
|
65 | + <?php if ('left' == $position) : ?> |
|
66 | 66 | <div class="input-group-prepend"> |
67 | 67 | <span class="input-group-text" id="wpinv_item_price_symbol"><?php echo wpinv_currency_symbol(); ?></span> |
68 | 68 | </div> |
69 | 69 | <?php endif; ?> |
70 | - <input type="text" name="wpinv_item_price" id="wpinv_item_price" value="<?php echo esc_attr( $item->get_price( 'edit' ) ); ?>" placeholder="<?php echo esc_attr( wpinv_sanitize_amount( 0 ) ); ?>" class="form-control"> |
|
70 | + <input type="text" name="wpinv_item_price" id="wpinv_item_price" value="<?php echo esc_attr($item->get_price('edit')); ?>" placeholder="<?php echo esc_attr(wpinv_sanitize_amount(0)); ?>" class="form-control"> |
|
71 | 71 | |
72 | - <?php if( 'left' != $position ) : ?> |
|
72 | + <?php if ('left' != $position) : ?> |
|
73 | 73 | <div class="input-group-append"> |
74 | 74 | <span class="input-group-text" id="wpinv_item_price_symbol"><?php echo wpinv_currency_symbol(); ?></span> |
75 | 75 | </div> |
@@ -83,25 +83,25 @@ discard block |
||
83 | 83 | array( |
84 | 84 | 'id' => 'wpinv_recurring_interval', |
85 | 85 | 'name' => 'wpinv_recurring_interval', |
86 | - 'label' => __( 'Interval', 'invoicing' ), |
|
87 | - 'placeholder' => __( 'Select Interval', 'invoicing' ), |
|
88 | - 'value' => $item->get_recurring_interval( 'edit' ), |
|
86 | + 'label' => __('Interval', 'invoicing'), |
|
87 | + 'placeholder' => __('Select Interval', 'invoicing'), |
|
88 | + 'value' => $item->get_recurring_interval('edit'), |
|
89 | 89 | 'select2' => true, |
90 | 90 | 'data-allow-clear' => 'false', |
91 | 91 | 'options' => array( |
92 | - '1' => __( 'every', 'invoicing' ), |
|
93 | - '2' => __( 'every 2nd', 'invoicing' ), |
|
94 | - '3' => __( 'every 3rd', 'invoicing' ), |
|
95 | - '4' => __( 'every 4th', 'invoicing' ), |
|
96 | - '5' => __( 'every 5th', 'invoicing' ), |
|
97 | - '6' => __( 'every 6th', 'invoicing' ), |
|
98 | - '8' => __( 'every 8th', 'invoicing' ), |
|
99 | - '9' => __( 'every 9th', 'invoicing' ), |
|
100 | - '10' => __( 'every 10th', 'invoicing' ), |
|
101 | - '11' => __( 'every 11th', 'invoicing' ), |
|
102 | - '12' => __( 'every 12th', 'invoicing' ), |
|
103 | - '13' => __( 'every 13th', 'invoicing' ), |
|
104 | - '14' => __( 'every 14th', 'invoicing' ), |
|
92 | + '1' => __('every', 'invoicing'), |
|
93 | + '2' => __('every 2nd', 'invoicing'), |
|
94 | + '3' => __('every 3rd', 'invoicing'), |
|
95 | + '4' => __('every 4th', 'invoicing'), |
|
96 | + '5' => __('every 5th', 'invoicing'), |
|
97 | + '6' => __('every 6th', 'invoicing'), |
|
98 | + '8' => __('every 8th', 'invoicing'), |
|
99 | + '9' => __('every 9th', 'invoicing'), |
|
100 | + '10' => __('every 10th', 'invoicing'), |
|
101 | + '11' => __('every 11th', 'invoicing'), |
|
102 | + '12' => __('every 12th', 'invoicing'), |
|
103 | + '13' => __('every 13th', 'invoicing'), |
|
104 | + '14' => __('every 14th', 'invoicing'), |
|
105 | 105 | ) |
106 | 106 | ) |
107 | 107 | ); |
@@ -113,16 +113,16 @@ discard block |
||
113 | 113 | array( |
114 | 114 | 'id' => 'wpinv_recurring_period', |
115 | 115 | 'name' => 'wpinv_recurring_period', |
116 | - 'label' => __( 'Period', 'invoicing' ), |
|
117 | - 'placeholder' => __( 'Select Period', 'invoicing' ), |
|
118 | - 'value' => $item->get_recurring_period( 'edit' ), |
|
116 | + 'label' => __('Period', 'invoicing'), |
|
117 | + 'placeholder' => __('Select Period', 'invoicing'), |
|
118 | + 'value' => $item->get_recurring_period('edit'), |
|
119 | 119 | 'select2' => true, |
120 | 120 | 'data-allow-clear' => 'false', |
121 | 121 | 'options' => array( |
122 | - 'D' => __( 'day', 'invoicing' ), |
|
123 | - 'W' => __( 'week', 'invoicing' ), |
|
124 | - 'M' => __( 'month', 'invoicing' ), |
|
125 | - 'Y' => __( 'year', 'invoicing' ), |
|
122 | + 'D' => __('day', 'invoicing'), |
|
123 | + 'W' => __('week', 'invoicing'), |
|
124 | + 'M' => __('month', 'invoicing'), |
|
125 | + 'Y' => __('year', 'invoicing'), |
|
126 | 126 | ) |
127 | 127 | ) |
128 | 128 | ); |
@@ -134,9 +134,9 @@ discard block |
||
134 | 134 | <?php |
135 | 135 | |
136 | 136 | // Dynamic pricing. |
137 | - if( $item->supports_dynamic_pricing() ) { |
|
137 | + if ($item->supports_dynamic_pricing()) { |
|
138 | 138 | |
139 | - do_action( 'wpinv_item_details_metabox_before_dynamic_pricing_checkbox', $item ); |
|
139 | + do_action('wpinv_item_details_metabox_before_dynamic_pricing_checkbox', $item); |
|
140 | 140 | |
141 | 141 | // NYP toggle. |
142 | 142 | echo aui()->input( |
@@ -144,31 +144,31 @@ discard block |
||
144 | 144 | 'id' => 'wpinv_name_your_price', |
145 | 145 | 'name' => 'wpinv_name_your_price', |
146 | 146 | 'type' => 'checkbox', |
147 | - 'label' => apply_filters( 'wpinv_name_your_price_toggle_text', __( 'Let customers name their price', 'invoicing' ) ), |
|
147 | + 'label' => apply_filters('wpinv_name_your_price_toggle_text', __('Let customers name their price', 'invoicing')), |
|
148 | 148 | 'value' => '1', |
149 | 149 | 'checked' => $item->user_can_set_their_price(), |
150 | 150 | 'no_wrap' => true, |
151 | 151 | ) |
152 | 152 | ); |
153 | 153 | |
154 | - do_action( 'wpinv_item_details_metabox_dynamic_pricing_checkbox', $item ); |
|
154 | + do_action('wpinv_item_details_metabox_dynamic_pricing_checkbox', $item); |
|
155 | 155 | |
156 | 156 | } |
157 | 157 | |
158 | 158 | // Subscriptions. |
159 | - do_action( 'wpinv_item_details_metabox_before_subscription_checkbox', $item ); |
|
159 | + do_action('wpinv_item_details_metabox_before_subscription_checkbox', $item); |
|
160 | 160 | echo aui()->input( |
161 | 161 | array( |
162 | 162 | 'id' => 'wpinv_is_recurring', |
163 | 163 | 'name' => 'wpinv_is_recurring', |
164 | 164 | 'type' => 'checkbox', |
165 | - 'label' => apply_filters( 'wpinv_is_recurring_toggle_text', __( 'Charge customers a recurring amount for this item', 'invoicing' ) ), |
|
165 | + 'label' => apply_filters('wpinv_is_recurring_toggle_text', __('Charge customers a recurring amount for this item', 'invoicing')), |
|
166 | 166 | 'value' => '1', |
167 | 167 | 'checked' => $item->is_recurring(), |
168 | 168 | 'no_wrap' => true, |
169 | 169 | ) |
170 | 170 | ); |
171 | - do_action( 'wpinv_item_details_metabox_subscription_checkbox', $item ); |
|
171 | + do_action('wpinv_item_details_metabox_subscription_checkbox', $item); |
|
172 | 172 | |
173 | 173 | ?> |
174 | 174 | <div class="wpinv_show_if_recurring"> |
@@ -178,30 +178,30 @@ discard block |
||
178 | 178 | </div> |
179 | 179 | </div> |
180 | 180 | <div class="col-sm-1 pt-2 pl-0"> |
181 | - <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> |
|
181 | + <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> |
|
182 | 182 | </div> |
183 | 183 | </div> |
184 | - <?php do_action( 'wpinv_item_details_metabox_after_price', $item ); ?> |
|
184 | + <?php do_action('wpinv_item_details_metabox_after_price', $item); ?> |
|
185 | 185 | |
186 | - <?php if( $item->supports_dynamic_pricing() ) : ?> |
|
187 | - <?php do_action( 'wpinv_item_details_metabox_before_minimum_price', $item ); ?> |
|
186 | + <?php if ($item->supports_dynamic_pricing()) : ?> |
|
187 | + <?php do_action('wpinv_item_details_metabox_before_minimum_price', $item); ?> |
|
188 | 188 | <div class="wpinv_show_if_dynamic wpinv_minimum_price"> |
189 | 189 | |
190 | 190 | <div class="form-group row"> |
191 | 191 | <label for="wpinv_minimum_price" class="col-sm-3 col-form-label"> |
192 | - <?php _e( 'Minimum Price', 'invoicing' );?> |
|
192 | + <?php _e('Minimum Price', 'invoicing'); ?> |
|
193 | 193 | </label> |
194 | 194 | <div class="col-sm-8"> |
195 | 195 | <div class="input-group input-group-sm"> |
196 | - <?php if( 'left' == $position ) : ?> |
|
196 | + <?php if ('left' == $position) : ?> |
|
197 | 197 | <div class="input-group-prepend"> |
198 | 198 | <span class="input-group-text" id="wpinv_item_minimum_price_symbol"><?php echo wpinv_currency_symbol(); ?></span> |
199 | 199 | </div> |
200 | 200 | <?php endif; ?> |
201 | 201 | |
202 | - <input type="text" name="wpinv_minimum_price" id="wpinv_minimum_price" value="<?php echo esc_attr( $item->get_minimum_price( 'edit' ) ); ?>" placeholder="<?php echo esc_attr( wpinv_sanitize_amount( 0 ) ); ?>" class="form-control"> |
|
202 | + <input type="text" name="wpinv_minimum_price" id="wpinv_minimum_price" value="<?php echo esc_attr($item->get_minimum_price('edit')); ?>" placeholder="<?php echo esc_attr(wpinv_sanitize_amount(0)); ?>" class="form-control"> |
|
203 | 203 | |
204 | - <?php if( 'left' != $position ) : ?> |
|
204 | + <?php if ('left' != $position) : ?> |
|
205 | 205 | <div class="input-group-append"> |
206 | 206 | <span class="input-group-text" id="wpinv_item_minimum_price_symbol"><?php echo wpinv_currency_symbol(); ?></span> |
207 | 207 | </div> |
@@ -210,45 +210,45 @@ discard block |
||
210 | 210 | </div> |
211 | 211 | |
212 | 212 | <div class="col-sm-1 pt-2 pl-0"> |
213 | - <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 | + <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> |
|
214 | 214 | </div> |
215 | 215 | </div> |
216 | 216 | |
217 | 217 | </div> |
218 | - <?php do_action( 'wpinv_item_details_metabox_minimum_price', $item ); ?> |
|
218 | + <?php do_action('wpinv_item_details_metabox_minimum_price', $item); ?> |
|
219 | 219 | <?php endif; ?> |
220 | 220 | |
221 | - <?php do_action( 'wpinv_item_details_metabox_before_maximum_renewals', $item ); ?> |
|
221 | + <?php do_action('wpinv_item_details_metabox_before_maximum_renewals', $item); ?> |
|
222 | 222 | <div class="wpinv_show_if_recurring wpinv_maximum_renewals"> |
223 | 223 | |
224 | 224 | <div class="form-group row"> |
225 | 225 | <label for="wpinv_recurring_limit" class="col-sm-3 col-form-label"> |
226 | - <?php _e( 'Maximum Renewals', 'invoicing' );?> |
|
226 | + <?php _e('Maximum Renewals', 'invoicing'); ?> |
|
227 | 227 | </label> |
228 | 228 | <div class="col-sm-8"> |
229 | - <input type="number" value="<?php echo esc_attr( $item->get_recurring_limit( 'edit' ) ); ?>" placeholder="0" name="wpinv_recurring_limit" id="wpinv_recurring_limit" style="width: 100%;" /> |
|
229 | + <input type="number" value="<?php echo esc_attr($item->get_recurring_limit('edit')); ?>" placeholder="0" name="wpinv_recurring_limit" id="wpinv_recurring_limit" style="width: 100%;" /> |
|
230 | 230 | </div> |
231 | 231 | <div class="col-sm-1 pt-2 pl-0"> |
232 | - <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 | + <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> |
|
233 | 233 | </div> |
234 | 234 | </div> |
235 | 235 | |
236 | 236 | </div> |
237 | - <?php do_action( 'wpinv_item_details_metabox_maximum_renewals', $item ); ?> |
|
237 | + <?php do_action('wpinv_item_details_metabox_maximum_renewals', $item); ?> |
|
238 | 238 | |
239 | - <?php do_action( 'wpinv_item_details_metabox_before_free_trial', $item ); ?> |
|
239 | + <?php do_action('wpinv_item_details_metabox_before_free_trial', $item); ?> |
|
240 | 240 | <div class="wpinv_show_if_recurring wpinv_free_trial"> |
241 | 241 | |
242 | 242 | <div class="form-group row"> |
243 | - <label class="col-sm-3 col-form-label" for="wpinv_trial_interval"><?php _e( 'Free Trial', 'invoicing' )?></label> |
|
243 | + <label class="col-sm-3 col-form-label" for="wpinv_trial_interval"><?php _e('Free Trial', 'invoicing')?></label> |
|
244 | 244 | |
245 | 245 | <div class="col-sm-8"> |
246 | 246 | <div class="row"> |
247 | 247 | <div class="col-sm-6"> |
248 | - <?php $value = $item->has_free_trial() ? $item->get_trial_interval( 'edit' ) : 0;?> |
|
248 | + <?php $value = $item->has_free_trial() ? $item->get_trial_interval('edit') : 0; ?> |
|
249 | 249 | |
250 | 250 | <div> |
251 | - <input type="number" name="wpinv_trial_interval" style="width: 100%;" placeholder="0" id="wpinv_trial_interval" value="<?php echo esc_attr( $value ); ?>" > |
|
251 | + <input type="number" name="wpinv_trial_interval" style="width: 100%;" placeholder="0" id="wpinv_trial_interval" value="<?php echo esc_attr($value); ?>" > |
|
252 | 252 | </div> |
253 | 253 | </div> |
254 | 254 | <div class="col-sm-6"> |
@@ -257,17 +257,17 @@ discard block |
||
257 | 257 | array( |
258 | 258 | 'id' => 'wpinv_trial_period', |
259 | 259 | 'name' => 'wpinv_trial_period', |
260 | - 'label' => __( 'Trial Period', 'invoicing' ), |
|
261 | - 'placeholder' => __( 'Trial Period', 'invoicing' ), |
|
262 | - 'value' => $item->get_trial_period( 'edit' ), |
|
260 | + 'label' => __('Trial Period', 'invoicing'), |
|
261 | + 'placeholder' => __('Trial Period', 'invoicing'), |
|
262 | + 'value' => $item->get_trial_period('edit'), |
|
263 | 263 | 'select2' => true, |
264 | 264 | 'data-allow-clear' => 'false', |
265 | 265 | 'no_wrap' => true, |
266 | 266 | 'options' => array( |
267 | - 'D' => __( 'day(s)', 'invoicing' ), |
|
268 | - 'W' => __( 'week(s)', 'invoicing' ), |
|
269 | - 'M' => __( 'month(s)', 'invoicing' ), |
|
270 | - 'Y' => __( 'year(s)', 'invoicing' ), |
|
267 | + 'D' => __('day(s)', 'invoicing'), |
|
268 | + 'W' => __('week(s)', 'invoicing'), |
|
269 | + 'M' => __('month(s)', 'invoicing'), |
|
270 | + 'Y' => __('year(s)', 'invoicing'), |
|
271 | 271 | ) |
272 | 272 | ) |
273 | 273 | ); |
@@ -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 | <?php |
292 | 292 | |
@@ -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'] ) ? (float) $_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' => isset( $_POST['wpinv_name_your_price'] ), |
|
313 | - 'minimum_price' => isset( $_POST['wpinv_minimum_price'] ) ? (float) $_POST['wpinv_minimum_price'] : null, |
|
314 | - 'is_recurring' => isset( $_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'] : null, |
|
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']) ? (float) $_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' => isset($_POST['wpinv_name_your_price']), |
|
313 | + 'minimum_price' => isset($_POST['wpinv_minimum_price']) ? (float) $_POST['wpinv_minimum_price'] : null, |
|
314 | + 'is_recurring' => isset($_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'] : null, |
|
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 | } |
@@ -19,16 +19,16 @@ discard block |
||
19 | 19 | |
20 | 20 | // Define constants. |
21 | 21 | if ( ! defined( 'WPINV_PLUGIN_FILE' ) ) { |
22 | - define( 'WPINV_PLUGIN_FILE', __FILE__ ); |
|
22 | + define( 'WPINV_PLUGIN_FILE', __FILE__ ); |
|
23 | 23 | } |
24 | 24 | |
25 | 25 | if ( ! defined( 'WPINV_VERSION' ) ) { |
26 | - define( 'WPINV_VERSION', '2.0.7' ); |
|
26 | + define( 'WPINV_VERSION', '2.0.7' ); |
|
27 | 27 | } |
28 | 28 | |
29 | 29 | // Include the main Invoicing class. |
30 | 30 | if ( ! class_exists( 'WPInv_Plugin', false ) ) { |
31 | - require_once plugin_dir_path( WPINV_PLUGIN_FILE ) . 'includes/class-wpinv.php'; |
|
31 | + require_once plugin_dir_path( WPINV_PLUGIN_FILE ) . 'includes/class-wpinv.php'; |
|
32 | 32 | } |
33 | 33 | |
34 | 34 | /** |
@@ -43,7 +43,7 @@ discard block |
||
43 | 43 | $GLOBALS['invoicing'] = new WPInv_Plugin(); |
44 | 44 | } |
45 | 45 | |
46 | - return $GLOBALS['invoicing']; |
|
46 | + return $GLOBALS['invoicing']; |
|
47 | 47 | } |
48 | 48 | |
49 | 49 | /** |
@@ -15,20 +15,20 @@ discard block |
||
15 | 15 | * @package GetPaid |
16 | 16 | */ |
17 | 17 | |
18 | -defined( 'ABSPATH' ) || exit; |
|
18 | +defined('ABSPATH') || exit; |
|
19 | 19 | |
20 | 20 | // Define constants. |
21 | -if ( ! defined( 'WPINV_PLUGIN_FILE' ) ) { |
|
22 | - define( 'WPINV_PLUGIN_FILE', __FILE__ ); |
|
21 | +if (!defined('WPINV_PLUGIN_FILE')) { |
|
22 | + define('WPINV_PLUGIN_FILE', __FILE__); |
|
23 | 23 | } |
24 | 24 | |
25 | -if ( ! defined( 'WPINV_VERSION' ) ) { |
|
26 | - define( 'WPINV_VERSION', '2.0.7' ); |
|
25 | +if (!defined('WPINV_VERSION')) { |
|
26 | + define('WPINV_VERSION', '2.0.7'); |
|
27 | 27 | } |
28 | 28 | |
29 | 29 | // Include the main Invoicing class. |
30 | -if ( ! class_exists( 'WPInv_Plugin', false ) ) { |
|
31 | - require_once plugin_dir_path( WPINV_PLUGIN_FILE ) . 'includes/class-wpinv.php'; |
|
30 | +if (!class_exists('WPInv_Plugin', false)) { |
|
31 | + require_once plugin_dir_path(WPINV_PLUGIN_FILE) . 'includes/class-wpinv.php'; |
|
32 | 32 | } |
33 | 33 | |
34 | 34 | /** |
@@ -39,7 +39,7 @@ discard block |
||
39 | 39 | */ |
40 | 40 | function getpaid() { |
41 | 41 | |
42 | - if ( empty( $GLOBALS['invoicing'] ) ) { |
|
42 | + if (empty($GLOBALS['invoicing'])) { |
|
43 | 43 | $GLOBALS['invoicing'] = new WPInv_Plugin(); |
44 | 44 | } |
45 | 45 | |
@@ -54,4 +54,4 @@ discard block |
||
54 | 54 | } |
55 | 55 | |
56 | 56 | // Kickstart the plugin. |
57 | -add_action( 'plugins_loaded', 'getpaid', -100 ); |
|
57 | +add_action('plugins_loaded', 'getpaid', -100); |