@@ -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,10 +17,10 @@ discard block |
||
17 | 17 | class GetPaid_Meta_Box_Discount_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 | 25 | |
26 | 26 | // Prepare the discount. |
@@ -368,34 +368,34 @@ discard block |
||
368 | 368 | } |
369 | 369 | |
370 | 370 | /** |
371 | - * Save meta box data. |
|
372 | - * |
|
373 | - * @param int $post_id |
|
374 | - */ |
|
375 | - public static function save( $post_id ) { |
|
371 | + * Save meta box data. |
|
372 | + * |
|
373 | + * @param int $post_id |
|
374 | + */ |
|
375 | + public static function save( $post_id ) { |
|
376 | 376 | |
377 | 377 | // Prepare the discount. |
378 | 378 | $discount = new WPInv_Discount( $post_id ); |
379 | 379 | |
380 | 380 | // Load new data. |
381 | 381 | $discount->set_props( |
382 | - array( |
|
383 | - 'code' => isset( $_POST['wpinv_discount_code'] ) ? $_POST['wpinv_discount_code'] : null, |
|
384 | - 'amount' => isset( $_POST['wpinv_discount_amount'] ) ? $_POST['wpinv_discount_amount'] : null, |
|
385 | - 'start' => isset( $_POST['wpinv_discount_start'] ) ? wpinv_clean( $_POST['wpinv_discount_start'] ) : null, |
|
386 | - 'expiration' => isset( $_POST['wpinv_discount_expiration'] ) ? wpinv_clean( $_POST['wpinv_discount_expiration'] ) : null, |
|
387 | - 'is_single_use' => isset( $_POST['wpinv_discount_single_use'] ), |
|
382 | + array( |
|
383 | + 'code' => isset( $_POST['wpinv_discount_code'] ) ? $_POST['wpinv_discount_code'] : null, |
|
384 | + 'amount' => isset( $_POST['wpinv_discount_amount'] ) ? $_POST['wpinv_discount_amount'] : null, |
|
385 | + 'start' => isset( $_POST['wpinv_discount_start'] ) ? wpinv_clean( $_POST['wpinv_discount_start'] ) : null, |
|
386 | + 'expiration' => isset( $_POST['wpinv_discount_expiration'] ) ? wpinv_clean( $_POST['wpinv_discount_expiration'] ) : null, |
|
387 | + 'is_single_use' => isset( $_POST['wpinv_discount_single_use'] ), |
|
388 | 388 | 'type' => isset( $_POST['wpinv_discount_type'] ) ? $_POST['wpinv_discount_type'] : null, |
389 | - 'is_recurring' => isset( $_POST['wpinv_discount_recurring'] ), |
|
390 | - 'items' => isset( $_POST['wpinv_discount_items'] ) ? $_POST['wpinv_discount_items'] : null, |
|
391 | - 'excluded_items' => isset( $_POST['wpinv_discount_excluded_items'] ) ? $_POST['wpinv_discount_excluded_items'] : null, |
|
392 | - 'max_uses' => isset( $_POST['wpinv_discount_max_uses'] ) ? $_POST['wpinv_discount_max_uses'] : null, |
|
393 | - 'min_total' => isset( $_POST['wpinv_discount_min_total'] ) ? $_POST['wpinv_discount_min_total'] : null, |
|
394 | - 'max_total' => isset( $_POST['wpinv_discount_max_total'] ) ? $_POST['wpinv_discount_max_total'] : null, |
|
395 | - ) |
|
389 | + 'is_recurring' => isset( $_POST['wpinv_discount_recurring'] ), |
|
390 | + 'items' => isset( $_POST['wpinv_discount_items'] ) ? $_POST['wpinv_discount_items'] : null, |
|
391 | + 'excluded_items' => isset( $_POST['wpinv_discount_excluded_items'] ) ? $_POST['wpinv_discount_excluded_items'] : null, |
|
392 | + 'max_uses' => isset( $_POST['wpinv_discount_max_uses'] ) ? $_POST['wpinv_discount_max_uses'] : null, |
|
393 | + 'min_total' => isset( $_POST['wpinv_discount_min_total'] ) ? $_POST['wpinv_discount_min_total'] : null, |
|
394 | + 'max_total' => isset( $_POST['wpinv_discount_max_total'] ) ? $_POST['wpinv_discount_max_total'] : null, |
|
395 | + ) |
|
396 | 396 | ); |
397 | 397 | |
398 | - $discount->save(); |
|
399 | - do_action( 'getpaid_discount_metabox_save', $post_id, $discount ); |
|
400 | - } |
|
398 | + $discount->save(); |
|
399 | + do_action( 'getpaid_discount_metabox_save', $post_id, $discount ); |
|
400 | + } |
|
401 | 401 | } |
@@ -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,24 +21,24 @@ 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 discount. |
27 | - $discount = new WPInv_Discount( $post ); |
|
27 | + $discount = new WPInv_Discount($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 | - do_action( 'wpinv_discount_form_top', $discount ); |
|
32 | + do_action('wpinv_discount_form_top', $discount); |
|
33 | 33 | |
34 | 34 | // Set the currency position. |
35 | 35 | $position = wpinv_currency_position(); |
36 | 36 | |
37 | - if ( $position == 'left_space' ) { |
|
37 | + if ($position == 'left_space') { |
|
38 | 38 | $position = 'left'; |
39 | 39 | } |
40 | 40 | |
41 | - if ( $position == 'right_space' ) { |
|
41 | + if ($position == 'right_space') { |
|
42 | 42 | $position = 'right'; |
43 | 43 | } |
44 | 44 | |
@@ -52,66 +52,66 @@ discard block |
||
52 | 52 | </style> |
53 | 53 | <div class='bsui' style='max-width: 600px;padding-top: 10px;'> |
54 | 54 | |
55 | - <?php do_action( 'wpinv_discount_form_first', $discount ); ?> |
|
55 | + <?php do_action('wpinv_discount_form_first', $discount); ?> |
|
56 | 56 | |
57 | - <?php do_action( 'wpinv_discount_form_before_code', $discount ); ?> |
|
57 | + <?php do_action('wpinv_discount_form_before_code', $discount); ?> |
|
58 | 58 | <div class="form-group row"> |
59 | 59 | <label for="wpinv_discount_code" class="col-sm-3 col-form-label"> |
60 | - <?php _e( 'Discount Code', 'invoicing' );?> |
|
60 | + <?php _e('Discount Code', 'invoicing'); ?> |
|
61 | 61 | </label> |
62 | 62 | <div class="col-sm-8"> |
63 | 63 | <div class="row"> |
64 | 64 | <div class="col-sm-12 form-group"> |
65 | - <input type="text" value="<?php echo esc_attr( $discount->get_code( 'edit' ) ); ?>" placeholder="SUMMER_SALE" name="wpinv_discount_code" id="wpinv_discount_code" style="width: 100%;" /> |
|
65 | + <input type="text" value="<?php echo esc_attr($discount->get_code('edit')); ?>" placeholder="SUMMER_SALE" name="wpinv_discount_code" id="wpinv_discount_code" style="width: 100%;" /> |
|
66 | 66 | </div> |
67 | 67 | <div class="col-sm-12"> |
68 | 68 | <?php |
69 | - do_action( 'wpinv_discount_form_before_single_use', $discount ); |
|
69 | + do_action('wpinv_discount_form_before_single_use', $discount); |
|
70 | 70 | |
71 | 71 | echo aui()->input( |
72 | 72 | array( |
73 | 73 | 'id' => 'wpinv_discount_single_use', |
74 | 74 | 'name' => 'wpinv_discount_single_use', |
75 | 75 | 'type' => 'checkbox', |
76 | - 'label' => __( 'Each customer can only use this discount once', 'invoicing' ), |
|
76 | + 'label' => __('Each customer can only use this discount once', 'invoicing'), |
|
77 | 77 | 'value' => '1', |
78 | 78 | 'checked' => $discount->is_single_use(), |
79 | 79 | ) |
80 | 80 | ); |
81 | 81 | |
82 | - do_action( 'wpinv_discount_form_single_use', $discount ); |
|
82 | + do_action('wpinv_discount_form_single_use', $discount); |
|
83 | 83 | ?> |
84 | 84 | </div> |
85 | 85 | <div class="col-sm-12"> |
86 | 86 | <?php |
87 | - do_action( 'wpinv_discount_form_before_recurring', $discount ); |
|
87 | + do_action('wpinv_discount_form_before_recurring', $discount); |
|
88 | 88 | |
89 | 89 | echo aui()->input( |
90 | 90 | array( |
91 | 91 | 'id' => 'wpinv_discount_recurring', |
92 | 92 | 'name' => 'wpinv_discount_recurring', |
93 | 93 | 'type' => 'checkbox', |
94 | - 'label' => __( 'Apply this discount to all recurring payments for subscriptions', 'invoicing' ), |
|
94 | + 'label' => __('Apply this discount to all recurring payments for subscriptions', 'invoicing'), |
|
95 | 95 | 'value' => '1', |
96 | 96 | 'checked' => $discount->is_recurring(), |
97 | 97 | ) |
98 | 98 | ); |
99 | 99 | |
100 | - do_action( 'wpinv_discount_form_recurring', $discount ); |
|
100 | + do_action('wpinv_discount_form_recurring', $discount); |
|
101 | 101 | ?> |
102 | 102 | </div> |
103 | 103 | </div> |
104 | 104 | </div> |
105 | 105 | <div class="col-sm-1 pt-2 pl-0"> |
106 | - <span class="wpi-help-tip dashicons dashicons-editor-help" title="<?php esc_attr_e( 'Enter a discount code such as 10OFF.', 'invoicing' ); ?>"></span> |
|
106 | + <span class="wpi-help-tip dashicons dashicons-editor-help" title="<?php esc_attr_e('Enter a discount code such as 10OFF.', 'invoicing'); ?>"></span> |
|
107 | 107 | </div> |
108 | 108 | </div> |
109 | - <?php do_action( 'wpinv_discount_form_code', $discount ); ?> |
|
109 | + <?php do_action('wpinv_discount_form_code', $discount); ?> |
|
110 | 110 | |
111 | - <?php do_action( 'wpinv_discount_form_before_type', $discount ); ?> |
|
111 | + <?php do_action('wpinv_discount_form_before_type', $discount); ?> |
|
112 | 112 | <div class="form-group row"> |
113 | 113 | <label for="wpinv_discount_type" class="col-sm-3 col-form-label"> |
114 | - <?php _e( 'Discount Type', 'invoicing' );?> |
|
114 | + <?php _e('Discount Type', 'invoicing'); ?> |
|
115 | 115 | </label> |
116 | 116 | <div class="col-sm-8"> |
117 | 117 | <?php |
@@ -119,9 +119,9 @@ discard block |
||
119 | 119 | array( |
120 | 120 | 'id' => 'wpinv_discount_type', |
121 | 121 | 'name' => 'wpinv_discount_type', |
122 | - 'label' => __( 'Discount Type', 'invoicing' ), |
|
123 | - 'placeholder' => __( 'Select Discount Type', 'invoicing' ), |
|
124 | - 'value' => $discount->get_type( 'edit' ), |
|
122 | + 'label' => __('Discount Type', 'invoicing'), |
|
123 | + 'placeholder' => __('Select Discount Type', 'invoicing'), |
|
124 | + 'value' => $discount->get_type('edit'), |
|
125 | 125 | 'select2' => true, |
126 | 126 | 'data-allow-clear' => 'false', |
127 | 127 | 'options' => wpinv_get_discount_types() |
@@ -130,19 +130,19 @@ discard block |
||
130 | 130 | ?> |
131 | 131 | </div> |
132 | 132 | <div class="col-sm-1 pt-2 pl-0"> |
133 | - <span class="wpi-help-tip dashicons dashicons-editor-help" title="<?php esc_attr_e( 'Discount type.', 'invoicing' ); ?>"></span> |
|
133 | + <span class="wpi-help-tip dashicons dashicons-editor-help" title="<?php esc_attr_e('Discount type.', 'invoicing'); ?>"></span> |
|
134 | 134 | </div> |
135 | 135 | </div> |
136 | - <?php do_action( 'wpinv_discount_form_type', $discount ); ?> |
|
136 | + <?php do_action('wpinv_discount_form_type', $discount); ?> |
|
137 | 137 | |
138 | - <?php do_action( 'wpinv_discount_form_before_amount', $discount ); ?> |
|
139 | - <div class="form-group row <?php echo esc_attr( $discount->get_type( 'edit' ) ); ?>" id="wpinv_discount_amount_wrap"> |
|
138 | + <?php do_action('wpinv_discount_form_before_amount', $discount); ?> |
|
139 | + <div class="form-group row <?php echo esc_attr($discount->get_type('edit')); ?>" id="wpinv_discount_amount_wrap"> |
|
140 | 140 | <label for="wpinv_discount_amount" class="col-sm-3 col-form-label"> |
141 | - <?php _e( 'Discount Amount', 'invoicing' );?> |
|
141 | + <?php _e('Discount Amount', 'invoicing'); ?> |
|
142 | 142 | </label> |
143 | 143 | <div class="col-sm-8"> |
144 | 144 | <div class="input-group input-group-sm"> |
145 | - <?php if( 'left' == $position ) : ?> |
|
145 | + <?php if ('left' == $position) : ?> |
|
146 | 146 | <div class="input-group-prepend left wpinv-if-flat"> |
147 | 147 | <span class="input-group-text"> |
148 | 148 | <?php echo wpinv_currency_symbol(); ?> |
@@ -150,9 +150,9 @@ discard block |
||
150 | 150 | </div> |
151 | 151 | <?php endif; ?> |
152 | 152 | |
153 | - <input type="text" name="wpinv_discount_amount" id="wpinv_discount_amount" value="<?php echo esc_attr( $discount->get_amount( 'edit' ) ); ?>" placeholder="0" class="form-control"> |
|
153 | + <input type="text" name="wpinv_discount_amount" id="wpinv_discount_amount" value="<?php echo esc_attr($discount->get_amount('edit')); ?>" placeholder="0" class="form-control"> |
|
154 | 154 | |
155 | - <?php if( 'right' == $position ) : ?> |
|
155 | + <?php if ('right' == $position) : ?> |
|
156 | 156 | <div class="input-group-prepend left wpinv-if-flat"> |
157 | 157 | <span class="input-group-text"> |
158 | 158 | <?php echo wpinv_currency_symbol(); ?> |
@@ -165,15 +165,15 @@ discard block |
||
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" title="<?php esc_attr_e( 'Enter the discount value. Ex: 10', 'invoicing' ); ?>"></span> |
|
168 | + <span class="wpi-help-tip dashicons dashicons-editor-help" title="<?php esc_attr_e('Enter the discount value. Ex: 10', 'invoicing'); ?>"></span> |
|
169 | 169 | </div> |
170 | 170 | </div> |
171 | - <?php do_action( 'wpinv_discount_form_amount', $discount ); ?> |
|
171 | + <?php do_action('wpinv_discount_form_amount', $discount); ?> |
|
172 | 172 | |
173 | - <?php do_action( 'wpinv_discount_form_before_items', $discount ); ?> |
|
173 | + <?php do_action('wpinv_discount_form_before_items', $discount); ?> |
|
174 | 174 | <div class="form-group row"> |
175 | 175 | <label for="wpinv_discount_items" class="col-sm-3 col-form-label"> |
176 | - <?php _e( 'Items', 'invoicing' );?> |
|
176 | + <?php _e('Items', 'invoicing'); ?> |
|
177 | 177 | </label> |
178 | 178 | <div class="col-sm-8"> |
179 | 179 | <?php |
@@ -181,9 +181,9 @@ discard block |
||
181 | 181 | array( |
182 | 182 | 'id' => 'wpinv_discount_items', |
183 | 183 | 'name' => 'wpinv_discount_items', |
184 | - 'label' => __( 'Items', 'invoicing' ), |
|
185 | - 'placeholder' => __( 'Select Items', 'invoicing' ), |
|
186 | - 'value' => $discount->get_items( 'edit' ), |
|
184 | + 'label' => __('Items', 'invoicing'), |
|
185 | + 'placeholder' => __('Select Items', 'invoicing'), |
|
186 | + 'value' => $discount->get_items('edit'), |
|
187 | 187 | 'select2' => true, |
188 | 188 | 'multiple' => true, |
189 | 189 | 'data-allow-clear' => 'false', |
@@ -193,15 +193,15 @@ discard block |
||
193 | 193 | ?> |
194 | 194 | </div> |
195 | 195 | <div class="col-sm-1 pt-2 pl-0"> |
196 | - <span class="wpi-help-tip dashicons dashicons-editor-help" title="<?php esc_attr_e( 'Select the items that are allowed to use this discount or leave blank to use this discount all items.', 'invoicing' ); ?>"></span> |
|
196 | + <span class="wpi-help-tip dashicons dashicons-editor-help" title="<?php esc_attr_e('Select the items that are allowed to use this discount or leave blank to use this discount all items.', 'invoicing'); ?>"></span> |
|
197 | 197 | </div> |
198 | 198 | </div> |
199 | - <?php do_action( 'wpinv_discount_form_items', $discount ); ?> |
|
199 | + <?php do_action('wpinv_discount_form_items', $discount); ?> |
|
200 | 200 | |
201 | - <?php do_action( 'wpinv_discount_form_before_excluded_items', $discount ); ?> |
|
201 | + <?php do_action('wpinv_discount_form_before_excluded_items', $discount); ?> |
|
202 | 202 | <div class="form-group row"> |
203 | 203 | <label for="wpinv_discount_excluded_items" class="col-sm-3 col-form-label"> |
204 | - <?php _e( 'Excluded Items', 'invoicing' );?> |
|
204 | + <?php _e('Excluded Items', 'invoicing'); ?> |
|
205 | 205 | </label> |
206 | 206 | <div class="col-sm-8"> |
207 | 207 | <?php |
@@ -209,9 +209,9 @@ discard block |
||
209 | 209 | array( |
210 | 210 | 'id' => 'wpinv_discount_excluded_items', |
211 | 211 | 'name' => 'wpinv_discount_excluded_items', |
212 | - 'label' => __( 'Excluded Items', 'invoicing' ), |
|
213 | - 'placeholder' => __( 'Select Items', 'invoicing' ), |
|
214 | - 'value' => $discount->get_excluded_items( 'edit' ), |
|
212 | + 'label' => __('Excluded Items', 'invoicing'), |
|
213 | + 'placeholder' => __('Select Items', 'invoicing'), |
|
214 | + 'value' => $discount->get_excluded_items('edit'), |
|
215 | 215 | 'select2' => true, |
216 | 216 | 'multiple' => true, |
217 | 217 | 'data-allow-clear' => 'false', |
@@ -221,15 +221,15 @@ discard block |
||
221 | 221 | ?> |
222 | 222 | </div> |
223 | 223 | <div class="col-sm-1 pt-2 pl-0"> |
224 | - <span class="wpi-help-tip dashicons dashicons-editor-help" title="<?php esc_attr_e( 'Select all the items that are not allowed to use this discount.', 'invoicing' ); ?>"></span> |
|
224 | + <span class="wpi-help-tip dashicons dashicons-editor-help" title="<?php esc_attr_e('Select all the items that are not allowed to use this discount.', 'invoicing'); ?>"></span> |
|
225 | 225 | </div> |
226 | 226 | </div> |
227 | - <?php do_action( 'wpinv_discount_form_excluded_items', $discount ); ?> |
|
227 | + <?php do_action('wpinv_discount_form_excluded_items', $discount); ?> |
|
228 | 228 | |
229 | - <?php do_action( 'wpinv_discount_form_before_start', $discount ); ?> |
|
229 | + <?php do_action('wpinv_discount_form_before_start', $discount); ?> |
|
230 | 230 | <div class="form-group row"> |
231 | 231 | <label for="wpinv_discount_start" class="col-sm-3 col-form-label"> |
232 | - <?php _e( 'Start Date', 'invoicing' );?> |
|
232 | + <?php _e('Start Date', 'invoicing'); ?> |
|
233 | 233 | </label> |
234 | 234 | <div class="col-sm-8"> |
235 | 235 | <?php |
@@ -238,10 +238,10 @@ discard block |
||
238 | 238 | 'type' => 'datepicker', |
239 | 239 | 'id' => 'wpinv_discount_start', |
240 | 240 | 'name' => 'wpinv_discount_start', |
241 | - 'label' => __( 'Start Date', 'invoicing' ), |
|
241 | + 'label' => __('Start Date', 'invoicing'), |
|
242 | 242 | 'placeholder' => 'YYYY-MM-DD 00:00', |
243 | 243 | 'class' => 'form-control-sm', |
244 | - 'value' => $discount->get_start_date( 'edit' ), |
|
244 | + 'value' => $discount->get_start_date('edit'), |
|
245 | 245 | 'extra_attributes' => array( |
246 | 246 | 'data-enable-time' => 'true', |
247 | 247 | 'data-time_24hr' => 'true', |
@@ -252,15 +252,15 @@ discard block |
||
252 | 252 | ?> |
253 | 253 | </div> |
254 | 254 | <div class="col-sm-1 pt-2 pl-0"> |
255 | - <span class="wpi-help-tip dashicons dashicons-editor-help" title="<?php esc_attr_e( 'For no start date, leave blank. If entered, the discount can only be used after or on this date.', 'invoicing' ); ?>"></span> |
|
255 | + <span class="wpi-help-tip dashicons dashicons-editor-help" title="<?php esc_attr_e('For no start date, leave blank. If entered, the discount can only be used after or on this date.', 'invoicing'); ?>"></span> |
|
256 | 256 | </div> |
257 | 257 | </div> |
258 | - <?php do_action( 'wpinv_discount_form_start', $discount ); ?> |
|
258 | + <?php do_action('wpinv_discount_form_start', $discount); ?> |
|
259 | 259 | |
260 | - <?php do_action( 'wpinv_discount_form_before_expiration', $discount ); ?> |
|
260 | + <?php do_action('wpinv_discount_form_before_expiration', $discount); ?> |
|
261 | 261 | <div class="form-group row"> |
262 | 262 | <label for="wpinv_discount_expiration" class="col-sm-3 col-form-label"> |
263 | - <?php _e( 'Expiration Date', 'invoicing' );?> |
|
263 | + <?php _e('Expiration Date', 'invoicing'); ?> |
|
264 | 264 | </label> |
265 | 265 | <div class="col-sm-8"> |
266 | 266 | <?php |
@@ -269,10 +269,10 @@ discard block |
||
269 | 269 | 'type' => 'datepicker', |
270 | 270 | 'id' => 'wpinv_discount_expiration', |
271 | 271 | 'name' => 'wpinv_discount_expiration', |
272 | - 'label' => __( 'Expiration Date', 'invoicing' ), |
|
272 | + 'label' => __('Expiration Date', 'invoicing'), |
|
273 | 273 | 'placeholder' => 'YYYY-MM-DD 00:00', |
274 | 274 | 'class' => 'form-control-sm', |
275 | - 'value' => $discount->get_end_date( 'edit' ), |
|
275 | + 'value' => $discount->get_end_date('edit'), |
|
276 | 276 | 'extra_attributes' => array( |
277 | 277 | 'data-enable-time' => 'true', |
278 | 278 | 'data-time_24hr' => 'true', |
@@ -285,27 +285,27 @@ discard block |
||
285 | 285 | ?> |
286 | 286 | </div> |
287 | 287 | <div class="col-sm-1 pt-2 pl-0"> |
288 | - <span class="wpi-help-tip dashicons dashicons-editor-help" title="<?php esc_attr_e( 'Optionally set the date after which the discount will expire.', 'invoicing' ); ?>"></span> |
|
288 | + <span class="wpi-help-tip dashicons dashicons-editor-help" title="<?php esc_attr_e('Optionally set the date after which the discount will expire.', 'invoicing'); ?>"></span> |
|
289 | 289 | </div> |
290 | 290 | </div> |
291 | - <?php do_action( 'wpinv_discount_form_expiration', $discount ); ?> |
|
291 | + <?php do_action('wpinv_discount_form_expiration', $discount); ?> |
|
292 | 292 | |
293 | - <?php do_action( 'wpinv_discount_form_before_min_total', $discount ); ?> |
|
293 | + <?php do_action('wpinv_discount_form_before_min_total', $discount); ?> |
|
294 | 294 | <div class="form-group row"> |
295 | 295 | <label for="wpinv_discount_min_total" class="col-sm-3 col-form-label"> |
296 | - <?php _e( 'Minimum Amount', 'invoicing' );?> |
|
296 | + <?php _e('Minimum Amount', 'invoicing'); ?> |
|
297 | 297 | </label> |
298 | 298 | <div class="col-sm-8"> |
299 | 299 | <div class="input-group input-group-sm"> |
300 | - <?php if( 'left' == $position ) : ?> |
|
300 | + <?php if ('left' == $position) : ?> |
|
301 | 301 | <div class="input-group-prepend"> |
302 | 302 | <span class="input-group-text"><?php echo wpinv_currency_symbol(); ?></span> |
303 | 303 | </div> |
304 | 304 | <?php endif; ?> |
305 | 305 | |
306 | - <input type="text" name="wpinv_discount_min_total" id="wpinv_discount_min_total" value="<?php echo esc_attr( $discount->get_minimum_total( 'edit' ) ); ?>" placeholder="<?php esc_attr_e( 'No minimum', 'invoicing' ); ?>" class="form-control"> |
|
306 | + <input type="text" name="wpinv_discount_min_total" id="wpinv_discount_min_total" value="<?php echo esc_attr($discount->get_minimum_total('edit')); ?>" placeholder="<?php esc_attr_e('No minimum', 'invoicing'); ?>" class="form-control"> |
|
307 | 307 | |
308 | - <?php if( 'left' != $position ) : ?> |
|
308 | + <?php if ('left' != $position) : ?> |
|
309 | 309 | <div class="input-group-append"> |
310 | 310 | <span class="input-group-text"><?php echo wpinv_currency_symbol(); ?></span> |
311 | 311 | </div> |
@@ -313,27 +313,27 @@ discard block |
||
313 | 313 | </div> |
314 | 314 | </div> |
315 | 315 | <div class="col-sm-1 pt-2 pl-0"> |
316 | - <span class="wpi-help-tip dashicons dashicons-editor-help" title="<?php esc_attr_e( 'Optionally set the minimum amount (including taxes) required to use this discount.', 'invoicing' ); ?>"></span> |
|
316 | + <span class="wpi-help-tip dashicons dashicons-editor-help" title="<?php esc_attr_e('Optionally set the minimum amount (including taxes) required to use this discount.', 'invoicing'); ?>"></span> |
|
317 | 317 | </div> |
318 | 318 | </div> |
319 | - <?php do_action( 'wpinv_discount_form_min_total', $discount ); ?> |
|
319 | + <?php do_action('wpinv_discount_form_min_total', $discount); ?> |
|
320 | 320 | |
321 | - <?php do_action( 'wpinv_discount_form_before_max_total', $discount ); ?> |
|
321 | + <?php do_action('wpinv_discount_form_before_max_total', $discount); ?> |
|
322 | 322 | <div class="form-group row"> |
323 | 323 | <label for="wpinv_discount_max_total" class="col-sm-3 col-form-label"> |
324 | - <?php _e( 'Maximum Amount', 'invoicing' );?> |
|
324 | + <?php _e('Maximum Amount', 'invoicing'); ?> |
|
325 | 325 | </label> |
326 | 326 | <div class="col-sm-8"> |
327 | 327 | <div class="input-group input-group-sm"> |
328 | - <?php if( 'left' == $position ) : ?> |
|
328 | + <?php if ('left' == $position) : ?> |
|
329 | 329 | <div class="input-group-prepend"> |
330 | 330 | <span class="input-group-text"><?php echo wpinv_currency_symbol(); ?></span> |
331 | 331 | </div> |
332 | 332 | <?php endif; ?> |
333 | 333 | |
334 | - <input type="text" name="wpinv_discount_max_total" id="wpinv_discount_max_total" value="<?php echo esc_attr( $discount->get_maximum_total( 'edit' ) ); ?>" placeholder="<?php esc_attr_e( 'No maximum', 'invoicing' ); ?>" class="form-control"> |
|
334 | + <input type="text" name="wpinv_discount_max_total" id="wpinv_discount_max_total" value="<?php echo esc_attr($discount->get_maximum_total('edit')); ?>" placeholder="<?php esc_attr_e('No maximum', 'invoicing'); ?>" class="form-control"> |
|
335 | 335 | |
336 | - <?php if( 'left' != $position ) : ?> |
|
336 | + <?php if ('left' != $position) : ?> |
|
337 | 337 | <div class="input-group-append"> |
338 | 338 | <span class="input-group-text"><?php echo wpinv_currency_symbol(); ?></span> |
339 | 339 | </div> |
@@ -341,30 +341,30 @@ discard block |
||
341 | 341 | </div> |
342 | 342 | </div> |
343 | 343 | <div class="col-sm-1 pt-2 pl-0"> |
344 | - <span class="wpi-help-tip dashicons dashicons-editor-help" title="<?php esc_attr_e( 'Optionally set the maximum amount (including taxes) allowed when using this discount.', 'invoicing' ); ?>"></span> |
|
344 | + <span class="wpi-help-tip dashicons dashicons-editor-help" title="<?php esc_attr_e('Optionally set the maximum amount (including taxes) allowed when using this discount.', 'invoicing'); ?>"></span> |
|
345 | 345 | </div> |
346 | 346 | </div> |
347 | - <?php do_action( 'wpinv_discount_form_before_max_total', $discount ); ?> |
|
347 | + <?php do_action('wpinv_discount_form_before_max_total', $discount); ?> |
|
348 | 348 | |
349 | - <?php do_action( 'wpinv_discount_form_before_max_uses', $discount ); ?> |
|
349 | + <?php do_action('wpinv_discount_form_before_max_uses', $discount); ?> |
|
350 | 350 | <div class="form-group row"> |
351 | 351 | <label for="wpinv_discount_max_uses" class="col-sm-3 col-form-label"> |
352 | - <?php _e( 'Maximum Uses', 'invoicing' );?> |
|
352 | + <?php _e('Maximum Uses', 'invoicing'); ?> |
|
353 | 353 | </label> |
354 | 354 | <div class="col-sm-8"> |
355 | - <input type="text" value="<?php echo esc_attr( $discount->get_max_uses( 'edit' ) ); ?>" placeholder="<?php esc_attr_e( 'Unlimited', 'invoicing' ); ?>" name="wpinv_discount_max_uses" id="wpinv_discount_max_uses" style="width: 100%;" /> |
|
355 | + <input type="text" value="<?php echo esc_attr($discount->get_max_uses('edit')); ?>" placeholder="<?php esc_attr_e('Unlimited', 'invoicing'); ?>" name="wpinv_discount_max_uses" id="wpinv_discount_max_uses" style="width: 100%;" /> |
|
356 | 356 | </div> |
357 | 357 | <div class="col-sm-1 pt-2 pl-0"> |
358 | - <span class="wpi-help-tip dashicons dashicons-editor-help" title="<?php esc_attr_e( 'Optionally set the maximum number of times that this discount code can be used.', 'invoicing' ); ?>"></span> |
|
358 | + <span class="wpi-help-tip dashicons dashicons-editor-help" title="<?php esc_attr_e('Optionally set the maximum number of times that this discount code can be used.', 'invoicing'); ?>"></span> |
|
359 | 359 | </div> |
360 | 360 | </div> |
361 | - <?php do_action( 'wpinv_discount_form_max_uses', $discount ); ?> |
|
361 | + <?php do_action('wpinv_discount_form_max_uses', $discount); ?> |
|
362 | 362 | |
363 | - <?php do_action( 'wpinv_discount_form_last', $discount ); ?> |
|
363 | + <?php do_action('wpinv_discount_form_last', $discount); ?> |
|
364 | 364 | |
365 | 365 | </div> |
366 | 366 | <?php |
367 | - do_action( 'wpinv_discount_form_bottom', $post ); |
|
367 | + do_action('wpinv_discount_form_bottom', $post); |
|
368 | 368 | } |
369 | 369 | |
370 | 370 | /** |
@@ -372,30 +372,30 @@ discard block |
||
372 | 372 | * |
373 | 373 | * @param int $post_id |
374 | 374 | */ |
375 | - public static function save( $post_id ) { |
|
375 | + public static function save($post_id) { |
|
376 | 376 | |
377 | 377 | // Prepare the discount. |
378 | - $discount = new WPInv_Discount( $post_id ); |
|
378 | + $discount = new WPInv_Discount($post_id); |
|
379 | 379 | |
380 | 380 | // Load new data. |
381 | 381 | $discount->set_props( |
382 | 382 | array( |
383 | - 'code' => isset( $_POST['wpinv_discount_code'] ) ? $_POST['wpinv_discount_code'] : null, |
|
384 | - 'amount' => isset( $_POST['wpinv_discount_amount'] ) ? $_POST['wpinv_discount_amount'] : null, |
|
385 | - 'start' => isset( $_POST['wpinv_discount_start'] ) ? wpinv_clean( $_POST['wpinv_discount_start'] ) : null, |
|
386 | - 'expiration' => isset( $_POST['wpinv_discount_expiration'] ) ? wpinv_clean( $_POST['wpinv_discount_expiration'] ) : null, |
|
387 | - 'is_single_use' => isset( $_POST['wpinv_discount_single_use'] ), |
|
388 | - 'type' => isset( $_POST['wpinv_discount_type'] ) ? $_POST['wpinv_discount_type'] : null, |
|
389 | - 'is_recurring' => isset( $_POST['wpinv_discount_recurring'] ), |
|
390 | - 'items' => isset( $_POST['wpinv_discount_items'] ) ? $_POST['wpinv_discount_items'] : null, |
|
391 | - 'excluded_items' => isset( $_POST['wpinv_discount_excluded_items'] ) ? $_POST['wpinv_discount_excluded_items'] : null, |
|
392 | - 'max_uses' => isset( $_POST['wpinv_discount_max_uses'] ) ? $_POST['wpinv_discount_max_uses'] : null, |
|
393 | - 'min_total' => isset( $_POST['wpinv_discount_min_total'] ) ? $_POST['wpinv_discount_min_total'] : null, |
|
394 | - 'max_total' => isset( $_POST['wpinv_discount_max_total'] ) ? $_POST['wpinv_discount_max_total'] : null, |
|
383 | + 'code' => isset($_POST['wpinv_discount_code']) ? $_POST['wpinv_discount_code'] : null, |
|
384 | + 'amount' => isset($_POST['wpinv_discount_amount']) ? $_POST['wpinv_discount_amount'] : null, |
|
385 | + 'start' => isset($_POST['wpinv_discount_start']) ? wpinv_clean($_POST['wpinv_discount_start']) : null, |
|
386 | + 'expiration' => isset($_POST['wpinv_discount_expiration']) ? wpinv_clean($_POST['wpinv_discount_expiration']) : null, |
|
387 | + 'is_single_use' => isset($_POST['wpinv_discount_single_use']), |
|
388 | + 'type' => isset($_POST['wpinv_discount_type']) ? $_POST['wpinv_discount_type'] : null, |
|
389 | + 'is_recurring' => isset($_POST['wpinv_discount_recurring']), |
|
390 | + 'items' => isset($_POST['wpinv_discount_items']) ? $_POST['wpinv_discount_items'] : null, |
|
391 | + 'excluded_items' => isset($_POST['wpinv_discount_excluded_items']) ? $_POST['wpinv_discount_excluded_items'] : null, |
|
392 | + 'max_uses' => isset($_POST['wpinv_discount_max_uses']) ? $_POST['wpinv_discount_max_uses'] : null, |
|
393 | + 'min_total' => isset($_POST['wpinv_discount_min_total']) ? $_POST['wpinv_discount_min_total'] : null, |
|
394 | + 'max_total' => isset($_POST['wpinv_discount_max_total']) ? $_POST['wpinv_discount_max_total'] : null, |
|
395 | 395 | ) |
396 | 396 | ); |
397 | 397 | |
398 | 398 | $discount->save(); |
399 | - do_action( 'getpaid_discount_metabox_save', $post_id, $discount ); |
|
399 | + do_action('getpaid_discount_metabox_save', $post_id, $discount); |
|
400 | 400 | } |
401 | 401 | } |
@@ -1,39 +1,39 @@ |
||
1 | 1 | <?php |
2 | 2 | // MUST have WordPress. |
3 | -if ( !defined( 'WPINC' ) ) { |
|
4 | - exit( 'Do NOT access this file directly: ' . basename( __FILE__ ) ); |
|
3 | +if (!defined('WPINC')) { |
|
4 | + exit('Do NOT access this file directly: ' . basename(__FILE__)); |
|
5 | 5 | } |
6 | 6 | |
7 | 7 | class WPInv_Meta_Box_Notes { |
8 | - public static function output( $post ) { |
|
8 | + public static function output($post) { |
|
9 | 9 | global $post; |
10 | 10 | |
11 | - $notes = wpinv_get_invoice_notes( $post->ID ); |
|
11 | + $notes = wpinv_get_invoice_notes($post->ID); |
|
12 | 12 | |
13 | 13 | echo '<ul class="invoice_notes">'; |
14 | 14 | |
15 | - if ( $notes ) { |
|
16 | - foreach( $notes as $note ) { |
|
17 | - wpinv_get_invoice_note_line_item( $note ); |
|
15 | + if ($notes) { |
|
16 | + foreach ($notes as $note) { |
|
17 | + wpinv_get_invoice_note_line_item($note); |
|
18 | 18 | } |
19 | 19 | |
20 | 20 | } else { |
21 | - echo '<li>' . __( 'There are no notes yet.', 'invoicing' ) . '</li>'; |
|
21 | + echo '<li>' . __('There are no notes yet.', 'invoicing') . '</li>'; |
|
22 | 22 | } |
23 | 23 | |
24 | 24 | echo '</ul>'; |
25 | 25 | ?> |
26 | 26 | <div class="add_note"> |
27 | - <h4><?php _e( 'Add note', 'invoicing' ); ?></h4> |
|
27 | + <h4><?php _e('Add note', 'invoicing'); ?></h4> |
|
28 | 28 | <p> |
29 | 29 | <textarea type="text" name="invoice_note" id="add_invoice_note" class="input-text" cols="20" rows="5"></textarea> |
30 | 30 | </p> |
31 | 31 | <p> |
32 | 32 | <select name="invoice_note_type" id="invoice_note_type" class="regular-text"> |
33 | - <option value=""><?php _e( 'Private note', 'invoicing' ); ?></option> |
|
34 | - <option value="customer"><?php _e( 'Note to customer', 'invoicing' ); ?></option> |
|
33 | + <option value=""><?php _e('Private note', 'invoicing'); ?></option> |
|
34 | + <option value="customer"><?php _e('Note to customer', 'invoicing'); ?></option> |
|
35 | 35 | </select> |
36 | - <a href="#" class="add_note button"><?php _e( 'Add', 'invoicing' ); ?></a> <span class="description"><?php _e( 'Add a note for your reference, or add a customer note (the user will be notified).', 'invoicing' ); ?></span> |
|
36 | + <a href="#" class="add_note button"><?php _e('Add', 'invoicing'); ?></a> <span class="description"><?php _e('Add a note for your reference, or add a customer note (the user will be notified).', 'invoicing'); ?></span> |
|
37 | 37 | </p> |
38 | 38 | </div> |
39 | 39 | <?php |
@@ -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,10 +17,10 @@ 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 | 25 | |
26 | 26 | // Prepare the item. |
@@ -289,35 +289,35 @@ discard block |
||
289 | 289 | } |
290 | 290 | |
291 | 291 | /** |
292 | - * Save meta box data. |
|
293 | - * |
|
294 | - * @param int $post_id |
|
295 | - */ |
|
296 | - public static function save( $post_id ) { |
|
292 | + * Save meta box data. |
|
293 | + * |
|
294 | + * @param int $post_id |
|
295 | + */ |
|
296 | + public static function save( $post_id ) { |
|
297 | 297 | |
298 | 298 | // Prepare the item. |
299 | 299 | $item = new WPInv_Item( $post_id ); |
300 | 300 | |
301 | 301 | // Load new data. |
302 | 302 | $item->set_props( |
303 | - array( |
|
304 | - 'price' => isset( $_POST['wpinv_item_price'] ) ? (float) $_POST['wpinv_item_price'] : null, |
|
305 | - 'vat_rule' => isset( $_POST['wpinv_vat_rules'] ) ? wpinv_clean( $_POST['wpinv_vat_rules'] ) : null, |
|
306 | - 'vat_class' => isset( $_POST['wpinv_vat_class'] ) ? wpinv_clean( $_POST['wpinv_vat_class'] ) : null, |
|
307 | - 'type' => isset( $_POST['wpinv_item_type'] ) ? wpinv_clean( $_POST['wpinv_item_type'] ) : null, |
|
308 | - 'is_dynamic_pricing' => isset( $_POST['wpinv_name_your_price'] ), |
|
303 | + array( |
|
304 | + 'price' => isset( $_POST['wpinv_item_price'] ) ? (float) $_POST['wpinv_item_price'] : null, |
|
305 | + 'vat_rule' => isset( $_POST['wpinv_vat_rules'] ) ? wpinv_clean( $_POST['wpinv_vat_rules'] ) : null, |
|
306 | + 'vat_class' => isset( $_POST['wpinv_vat_class'] ) ? wpinv_clean( $_POST['wpinv_vat_class'] ) : null, |
|
307 | + 'type' => isset( $_POST['wpinv_item_type'] ) ? wpinv_clean( $_POST['wpinv_item_type'] ) : null, |
|
308 | + 'is_dynamic_pricing' => isset( $_POST['wpinv_name_your_price'] ), |
|
309 | 309 | 'minimum_price' => isset( $_POST['wpinv_minimum_price'] ) ? (float) $_POST['wpinv_minimum_price'] : null, |
310 | - 'is_recurring' => isset( $_POST['wpinv_is_recurring'] ), |
|
311 | - 'recurring_period' => isset( $_POST['wpinv_recurring_period'] ) ? wpinv_clean( $_POST['wpinv_recurring_period'] ) : null, |
|
312 | - 'recurring_interval' => isset( $_POST['wpinv_recurring_interval'] ) ? (int) $_POST['wpinv_recurring_interval'] : null, |
|
313 | - 'recurring_limit' => isset( $_POST['wpinv_recurring_limit'] ) ? (int) $_POST['wpinv_recurring_limit'] : null, |
|
314 | - 'is_free_trial' => isset( $_POST['wpinv_trial_interval'] ) ? ( 0 != (int) $_POST['wpinv_trial_interval'] ) : null, |
|
315 | - 'trial_period' => isset( $_POST['wpinv_trial_period'] ) ? wpinv_clean( $_POST['wpinv_trial_period'] ) : null, |
|
316 | - 'trial_interval' => isset( $_POST['wpinv_trial_interval'] ) ? (int) $_POST['wpinv_trial_interval'] : null, |
|
317 | - ) |
|
310 | + 'is_recurring' => isset( $_POST['wpinv_is_recurring'] ), |
|
311 | + 'recurring_period' => isset( $_POST['wpinv_recurring_period'] ) ? wpinv_clean( $_POST['wpinv_recurring_period'] ) : null, |
|
312 | + 'recurring_interval' => isset( $_POST['wpinv_recurring_interval'] ) ? (int) $_POST['wpinv_recurring_interval'] : null, |
|
313 | + 'recurring_limit' => isset( $_POST['wpinv_recurring_limit'] ) ? (int) $_POST['wpinv_recurring_limit'] : null, |
|
314 | + 'is_free_trial' => isset( $_POST['wpinv_trial_interval'] ) ? ( 0 != (int) $_POST['wpinv_trial_interval'] ) : null, |
|
315 | + 'trial_period' => isset( $_POST['wpinv_trial_period'] ) ? wpinv_clean( $_POST['wpinv_trial_period'] ) : null, |
|
316 | + 'trial_interval' => isset( $_POST['wpinv_trial_interval'] ) ? (int) $_POST['wpinv_trial_interval'] : null, |
|
317 | + ) |
|
318 | 318 | ); |
319 | 319 | |
320 | - $item->save(); |
|
321 | - do_action( 'getpaid_item_metabox_save', $post_id, $item ); |
|
322 | - } |
|
320 | + $item->save(); |
|
321 | + do_action( 'getpaid_item_metabox_save', $post_id, $item ); |
|
322 | + } |
|
323 | 323 | } |
@@ -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 | <input type="hidden" id="_wpi_is_editable" value="<?php echo (int) $item->is_editable(); ?>" /> |
46 | 46 | <style> |
47 | 47 | #poststuff .input-group-text, |
@@ -51,21 +51,21 @@ discard block |
||
51 | 51 | </style> |
52 | 52 | <div class='bsui' style='max-width: 600px;padding-top: 10px; max-width: 820px;'> |
53 | 53 | |
54 | - <?php do_action( 'wpinv_item_details_metabox_before_price', $item ); ?> |
|
54 | + <?php do_action('wpinv_item_details_metabox_before_price', $item); ?> |
|
55 | 55 | <div class="form-group row"> |
56 | - <label class="col-sm-3 col-form-label" for="wpinv_item_price"><span><?php _e( 'Item Price', 'invoicing' )?></span></label> |
|
56 | + <label class="col-sm-3 col-form-label" for="wpinv_item_price"><span><?php _e('Item Price', 'invoicing')?></span></label> |
|
57 | 57 | <div class="col-sm-8"> |
58 | 58 | <div class="row"> |
59 | 59 | <div class="col-sm-4 getpaid-price-input"> |
60 | 60 | <div class="input-group input-group-sm"> |
61 | - <?php if( 'left' == $position ) : ?> |
|
61 | + <?php if ('left' == $position) : ?> |
|
62 | 62 | <div class="input-group-prepend"> |
63 | 63 | <span class="input-group-text" id="wpinv_item_price_symbol"><?php echo wpinv_currency_symbol(); ?></span> |
64 | 64 | </div> |
65 | 65 | <?php endif; ?> |
66 | - <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"> |
|
66 | + <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"> |
|
67 | 67 | |
68 | - <?php if( 'left' != $position ) : ?> |
|
68 | + <?php if ('left' != $position) : ?> |
|
69 | 69 | <div class="input-group-append"> |
70 | 70 | <span class="input-group-text" id="wpinv_item_price_symbol"><?php echo wpinv_currency_symbol(); ?></span> |
71 | 71 | </div> |
@@ -79,25 +79,25 @@ discard block |
||
79 | 79 | array( |
80 | 80 | 'id' => 'wpinv_recurring_interval', |
81 | 81 | 'name' => 'wpinv_recurring_interval', |
82 | - 'label' => __( 'Interval', 'invoicing' ), |
|
83 | - 'placeholder' => __( 'Select Interval', 'invoicing' ), |
|
84 | - 'value' => $item->get_recurring_interval( 'edit' ), |
|
82 | + 'label' => __('Interval', 'invoicing'), |
|
83 | + 'placeholder' => __('Select Interval', 'invoicing'), |
|
84 | + 'value' => $item->get_recurring_interval('edit'), |
|
85 | 85 | 'select2' => true, |
86 | 86 | 'data-allow-clear' => 'false', |
87 | 87 | 'options' => array( |
88 | - '1' => __( 'every', 'invoicing' ), |
|
89 | - '2' => __( 'every 2nd', 'invoicing' ), |
|
90 | - '3' => __( 'every 3rd', 'invoicing' ), |
|
91 | - '4' => __( 'every 4th', 'invoicing' ), |
|
92 | - '5' => __( 'every 5th', 'invoicing' ), |
|
93 | - '6' => __( 'every 6th', 'invoicing' ), |
|
94 | - '8' => __( 'every 8th', 'invoicing' ), |
|
95 | - '9' => __( 'every 9th', 'invoicing' ), |
|
96 | - '10' => __( 'every 10th', 'invoicing' ), |
|
97 | - '11' => __( 'every 11th', 'invoicing' ), |
|
98 | - '12' => __( 'every 12th', 'invoicing' ), |
|
99 | - '13' => __( 'every 13th', 'invoicing' ), |
|
100 | - '14' => __( 'every 14th', 'invoicing' ), |
|
88 | + '1' => __('every', 'invoicing'), |
|
89 | + '2' => __('every 2nd', 'invoicing'), |
|
90 | + '3' => __('every 3rd', 'invoicing'), |
|
91 | + '4' => __('every 4th', 'invoicing'), |
|
92 | + '5' => __('every 5th', 'invoicing'), |
|
93 | + '6' => __('every 6th', 'invoicing'), |
|
94 | + '8' => __('every 8th', 'invoicing'), |
|
95 | + '9' => __('every 9th', 'invoicing'), |
|
96 | + '10' => __('every 10th', 'invoicing'), |
|
97 | + '11' => __('every 11th', 'invoicing'), |
|
98 | + '12' => __('every 12th', 'invoicing'), |
|
99 | + '13' => __('every 13th', 'invoicing'), |
|
100 | + '14' => __('every 14th', 'invoicing'), |
|
101 | 101 | ) |
102 | 102 | ) |
103 | 103 | ); |
@@ -109,16 +109,16 @@ discard block |
||
109 | 109 | array( |
110 | 110 | 'id' => 'wpinv_recurring_period', |
111 | 111 | 'name' => 'wpinv_recurring_period', |
112 | - 'label' => __( 'Period', 'invoicing' ), |
|
113 | - 'placeholder' => __( 'Select Period', 'invoicing' ), |
|
114 | - 'value' => $item->get_recurring_period( 'edit' ), |
|
112 | + 'label' => __('Period', 'invoicing'), |
|
113 | + 'placeholder' => __('Select Period', 'invoicing'), |
|
114 | + 'value' => $item->get_recurring_period('edit'), |
|
115 | 115 | 'select2' => true, |
116 | 116 | 'data-allow-clear' => 'false', |
117 | 117 | 'options' => array( |
118 | - 'D' => __( 'day', 'invoicing' ), |
|
119 | - 'W' => __( 'week', 'invoicing' ), |
|
120 | - 'M' => __( 'month', 'invoicing' ), |
|
121 | - 'Y' => __( 'year', 'invoicing' ), |
|
118 | + 'D' => __('day', 'invoicing'), |
|
119 | + 'W' => __('week', 'invoicing'), |
|
120 | + 'M' => __('month', 'invoicing'), |
|
121 | + 'Y' => __('year', 'invoicing'), |
|
122 | 122 | ) |
123 | 123 | ) |
124 | 124 | ); |
@@ -130,9 +130,9 @@ discard block |
||
130 | 130 | <?php |
131 | 131 | |
132 | 132 | // Dynamic pricing. |
133 | - if( $item->supports_dynamic_pricing() ) { |
|
133 | + if ($item->supports_dynamic_pricing()) { |
|
134 | 134 | |
135 | - do_action( 'wpinv_item_details_metabox_before_dynamic_pricing_checkbox', $item ); |
|
135 | + do_action('wpinv_item_details_metabox_before_dynamic_pricing_checkbox', $item); |
|
136 | 136 | |
137 | 137 | // NYP toggle. |
138 | 138 | echo aui()->input( |
@@ -140,31 +140,31 @@ discard block |
||
140 | 140 | 'id' => 'wpinv_name_your_price', |
141 | 141 | 'name' => 'wpinv_name_your_price', |
142 | 142 | 'type' => 'checkbox', |
143 | - 'label' => apply_filters( 'wpinv_name_your_price_toggle_text', __( 'Let customers name their price', 'invoicing' ) ), |
|
143 | + 'label' => apply_filters('wpinv_name_your_price_toggle_text', __('Let customers name their price', 'invoicing')), |
|
144 | 144 | 'value' => '1', |
145 | 145 | 'checked' => $item->user_can_set_their_price(), |
146 | 146 | 'no_wrap' => true, |
147 | 147 | ) |
148 | 148 | ); |
149 | 149 | |
150 | - do_action( 'wpinv_item_details_metabox_dynamic_pricing_checkbox', $item ); |
|
150 | + do_action('wpinv_item_details_metabox_dynamic_pricing_checkbox', $item); |
|
151 | 151 | |
152 | 152 | } |
153 | 153 | |
154 | 154 | // Subscriptions. |
155 | - do_action( 'wpinv_item_details_metabox_before_subscription_checkbox', $item ); |
|
155 | + do_action('wpinv_item_details_metabox_before_subscription_checkbox', $item); |
|
156 | 156 | echo aui()->input( |
157 | 157 | array( |
158 | 158 | 'id' => 'wpinv_is_recurring', |
159 | 159 | 'name' => 'wpinv_is_recurring', |
160 | 160 | 'type' => 'checkbox', |
161 | - 'label' => apply_filters( 'wpinv_is_recurring_toggle_text', __( 'Charge customers a recurring amount for this item', 'invoicing' ) ), |
|
161 | + 'label' => apply_filters('wpinv_is_recurring_toggle_text', __('Charge customers a recurring amount for this item', 'invoicing')), |
|
162 | 162 | 'value' => '1', |
163 | 163 | 'checked' => $item->is_recurring(), |
164 | 164 | 'no_wrap' => true, |
165 | 165 | ) |
166 | 166 | ); |
167 | - do_action( 'wpinv_item_details_metabox_subscription_checkbox', $item ); |
|
167 | + do_action('wpinv_item_details_metabox_subscription_checkbox', $item); |
|
168 | 168 | |
169 | 169 | ?> |
170 | 170 | <div class="wpinv_show_if_recurring"> |
@@ -174,30 +174,30 @@ discard block |
||
174 | 174 | </div> |
175 | 175 | </div> |
176 | 176 | <div class="col-sm-1 pt-2 pl-0"> |
177 | - <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> |
|
177 | + <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> |
|
178 | 178 | </div> |
179 | 179 | </div> |
180 | - <?php do_action( 'wpinv_item_details_metabox_after_price', $item ); ?> |
|
180 | + <?php do_action('wpinv_item_details_metabox_after_price', $item); ?> |
|
181 | 181 | |
182 | - <?php if( $item->supports_dynamic_pricing() ) : ?> |
|
183 | - <?php do_action( 'wpinv_item_details_metabox_before_minimum_price', $item ); ?> |
|
182 | + <?php if ($item->supports_dynamic_pricing()) : ?> |
|
183 | + <?php do_action('wpinv_item_details_metabox_before_minimum_price', $item); ?> |
|
184 | 184 | <div class="wpinv_show_if_dynamic wpinv_minimum_price"> |
185 | 185 | |
186 | 186 | <div class="form-group row"> |
187 | 187 | <label for="wpinv_minimum_price" class="col-sm-3 col-form-label"> |
188 | - <?php _e( 'Minimum Price', 'invoicing' );?> |
|
188 | + <?php _e('Minimum Price', 'invoicing'); ?> |
|
189 | 189 | </label> |
190 | 190 | <div class="col-sm-8"> |
191 | 191 | <div class="input-group input-group-sm"> |
192 | - <?php if( 'left' == $position ) : ?> |
|
192 | + <?php if ('left' == $position) : ?> |
|
193 | 193 | <div class="input-group-prepend"> |
194 | 194 | <span class="input-group-text" id="wpinv_item_minimum_price_symbol"><?php echo wpinv_currency_symbol(); ?></span> |
195 | 195 | </div> |
196 | 196 | <?php endif; ?> |
197 | 197 | |
198 | - <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"> |
|
198 | + <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"> |
|
199 | 199 | |
200 | - <?php if( 'left' != $position ) : ?> |
|
200 | + <?php if ('left' != $position) : ?> |
|
201 | 201 | <div class="input-group-append"> |
202 | 202 | <span class="input-group-text" id="wpinv_item_minimum_price_symbol"><?php echo wpinv_currency_symbol(); ?></span> |
203 | 203 | </div> |
@@ -206,45 +206,45 @@ discard block |
||
206 | 206 | </div> |
207 | 207 | |
208 | 208 | <div class="col-sm-1 pt-2 pl-0"> |
209 | - <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> |
|
209 | + <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> |
|
210 | 210 | </div> |
211 | 211 | </div> |
212 | 212 | |
213 | 213 | </div> |
214 | - <?php do_action( 'wpinv_item_details_metabox_minimum_price', $item ); ?> |
|
214 | + <?php do_action('wpinv_item_details_metabox_minimum_price', $item); ?> |
|
215 | 215 | <?php endif; ?> |
216 | 216 | |
217 | - <?php do_action( 'wpinv_item_details_metabox_before_maximum_renewals', $item ); ?> |
|
217 | + <?php do_action('wpinv_item_details_metabox_before_maximum_renewals', $item); ?> |
|
218 | 218 | <div class="wpinv_show_if_recurring wpinv_maximum_renewals"> |
219 | 219 | |
220 | 220 | <div class="form-group row"> |
221 | 221 | <label for="wpinv_recurring_limit" class="col-sm-3 col-form-label"> |
222 | - <?php _e( 'Maximum Renewals', 'invoicing' );?> |
|
222 | + <?php _e('Maximum Renewals', 'invoicing'); ?> |
|
223 | 223 | </label> |
224 | 224 | <div class="col-sm-8"> |
225 | - <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%;" /> |
|
225 | + <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%;" /> |
|
226 | 226 | </div> |
227 | 227 | <div class="col-sm-1 pt-2 pl-0"> |
228 | - <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> |
|
228 | + <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> |
|
229 | 229 | </div> |
230 | 230 | </div> |
231 | 231 | |
232 | 232 | </div> |
233 | - <?php do_action( 'wpinv_item_details_metabox_maximum_renewals', $item ); ?> |
|
233 | + <?php do_action('wpinv_item_details_metabox_maximum_renewals', $item); ?> |
|
234 | 234 | |
235 | - <?php do_action( 'wpinv_item_details_metabox_before_free_trial', $item ); ?> |
|
235 | + <?php do_action('wpinv_item_details_metabox_before_free_trial', $item); ?> |
|
236 | 236 | <div class="wpinv_show_if_recurring wpinv_free_trial"> |
237 | 237 | |
238 | 238 | <div class="form-group row"> |
239 | - <label class="col-sm-3 col-form-label" for="wpinv_trial_interval"><?php _e( 'Free Trial', 'invoicing' )?></label> |
|
239 | + <label class="col-sm-3 col-form-label" for="wpinv_trial_interval"><?php _e('Free Trial', 'invoicing')?></label> |
|
240 | 240 | |
241 | 241 | <div class="col-sm-8"> |
242 | 242 | <div class="row"> |
243 | 243 | <div class="col-sm-6"> |
244 | - <?php $value = $item->has_free_trial() ? $item->get_trial_interval( 'edit' ) : 0;?> |
|
244 | + <?php $value = $item->has_free_trial() ? $item->get_trial_interval('edit') : 0; ?> |
|
245 | 245 | |
246 | 246 | <div> |
247 | - <input type="number" name="wpinv_trial_interval" style="width: 100%;" placeholder="0" id="wpinv_trial_interval" value="<?php echo esc_attr( $value ); ?>" > |
|
247 | + <input type="number" name="wpinv_trial_interval" style="width: 100%;" placeholder="0" id="wpinv_trial_interval" value="<?php echo esc_attr($value); ?>" > |
|
248 | 248 | </div> |
249 | 249 | </div> |
250 | 250 | <div class="col-sm-6"> |
@@ -253,17 +253,17 @@ discard block |
||
253 | 253 | array( |
254 | 254 | 'id' => 'wpinv_trial_period', |
255 | 255 | 'name' => 'wpinv_trial_period', |
256 | - 'label' => __( 'Trial Period', 'invoicing' ), |
|
257 | - 'placeholder' => __( 'Trial Period', 'invoicing' ), |
|
258 | - 'value' => $item->get_recurring_period( 'edit' ), |
|
256 | + 'label' => __('Trial Period', 'invoicing'), |
|
257 | + 'placeholder' => __('Trial Period', 'invoicing'), |
|
258 | + 'value' => $item->get_recurring_period('edit'), |
|
259 | 259 | 'select2' => true, |
260 | 260 | 'data-allow-clear' => 'false', |
261 | 261 | 'no_wrap' => true, |
262 | 262 | 'options' => array( |
263 | - 'D' => __( 'day(s)', 'invoicing' ), |
|
264 | - 'W' => __( 'week(s)', 'invoicing' ), |
|
265 | - 'M' => __( 'month(s)', 'invoicing' ), |
|
266 | - 'Y' => __( 'year(s)', 'invoicing' ), |
|
263 | + 'D' => __('day(s)', 'invoicing'), |
|
264 | + 'W' => __('week(s)', 'invoicing'), |
|
265 | + 'M' => __('month(s)', 'invoicing'), |
|
266 | + 'Y' => __('year(s)', 'invoicing'), |
|
267 | 267 | ) |
268 | 268 | ) |
269 | 269 | ); |
@@ -274,15 +274,15 @@ discard block |
||
274 | 274 | </div> |
275 | 275 | |
276 | 276 | <div class="col-sm-1 pt-2 pl-0"> |
277 | - <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> |
|
277 | + <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> |
|
278 | 278 | </div> |
279 | 279 | |
280 | 280 | </div> |
281 | 281 | |
282 | 282 | </div> |
283 | - <?php do_action( 'wpinv_item_details_metabox__free_trial', $item ); ?> |
|
283 | + <?php do_action('wpinv_item_details_metabox__free_trial', $item); ?> |
|
284 | 284 | |
285 | - <?php do_action( 'wpinv_item_details_metabox_item_details', $item ); ?> |
|
285 | + <?php do_action('wpinv_item_details_metabox_item_details', $item); ?> |
|
286 | 286 | </div> |
287 | 287 | <?php |
288 | 288 | |
@@ -293,31 +293,31 @@ discard block |
||
293 | 293 | * |
294 | 294 | * @param int $post_id |
295 | 295 | */ |
296 | - public static function save( $post_id ) { |
|
296 | + public static function save($post_id) { |
|
297 | 297 | |
298 | 298 | // Prepare the item. |
299 | - $item = new WPInv_Item( $post_id ); |
|
299 | + $item = new WPInv_Item($post_id); |
|
300 | 300 | |
301 | 301 | // Load new data. |
302 | 302 | $item->set_props( |
303 | 303 | array( |
304 | - 'price' => isset( $_POST['wpinv_item_price'] ) ? (float) $_POST['wpinv_item_price'] : null, |
|
305 | - 'vat_rule' => isset( $_POST['wpinv_vat_rules'] ) ? wpinv_clean( $_POST['wpinv_vat_rules'] ) : null, |
|
306 | - 'vat_class' => isset( $_POST['wpinv_vat_class'] ) ? wpinv_clean( $_POST['wpinv_vat_class'] ) : null, |
|
307 | - 'type' => isset( $_POST['wpinv_item_type'] ) ? wpinv_clean( $_POST['wpinv_item_type'] ) : null, |
|
308 | - 'is_dynamic_pricing' => isset( $_POST['wpinv_name_your_price'] ), |
|
309 | - 'minimum_price' => isset( $_POST['wpinv_minimum_price'] ) ? (float) $_POST['wpinv_minimum_price'] : null, |
|
310 | - 'is_recurring' => isset( $_POST['wpinv_is_recurring'] ), |
|
311 | - 'recurring_period' => isset( $_POST['wpinv_recurring_period'] ) ? wpinv_clean( $_POST['wpinv_recurring_period'] ) : null, |
|
312 | - 'recurring_interval' => isset( $_POST['wpinv_recurring_interval'] ) ? (int) $_POST['wpinv_recurring_interval'] : null, |
|
313 | - 'recurring_limit' => isset( $_POST['wpinv_recurring_limit'] ) ? (int) $_POST['wpinv_recurring_limit'] : null, |
|
314 | - 'is_free_trial' => isset( $_POST['wpinv_trial_interval'] ) ? ( 0 != (int) $_POST['wpinv_trial_interval'] ) : null, |
|
315 | - 'trial_period' => isset( $_POST['wpinv_trial_period'] ) ? wpinv_clean( $_POST['wpinv_trial_period'] ) : null, |
|
316 | - 'trial_interval' => isset( $_POST['wpinv_trial_interval'] ) ? (int) $_POST['wpinv_trial_interval'] : null, |
|
304 | + 'price' => isset($_POST['wpinv_item_price']) ? (float) $_POST['wpinv_item_price'] : null, |
|
305 | + 'vat_rule' => isset($_POST['wpinv_vat_rules']) ? wpinv_clean($_POST['wpinv_vat_rules']) : null, |
|
306 | + 'vat_class' => isset($_POST['wpinv_vat_class']) ? wpinv_clean($_POST['wpinv_vat_class']) : null, |
|
307 | + 'type' => isset($_POST['wpinv_item_type']) ? wpinv_clean($_POST['wpinv_item_type']) : null, |
|
308 | + 'is_dynamic_pricing' => isset($_POST['wpinv_name_your_price']), |
|
309 | + 'minimum_price' => isset($_POST['wpinv_minimum_price']) ? (float) $_POST['wpinv_minimum_price'] : null, |
|
310 | + 'is_recurring' => isset($_POST['wpinv_is_recurring']), |
|
311 | + 'recurring_period' => isset($_POST['wpinv_recurring_period']) ? wpinv_clean($_POST['wpinv_recurring_period']) : null, |
|
312 | + 'recurring_interval' => isset($_POST['wpinv_recurring_interval']) ? (int) $_POST['wpinv_recurring_interval'] : null, |
|
313 | + 'recurring_limit' => isset($_POST['wpinv_recurring_limit']) ? (int) $_POST['wpinv_recurring_limit'] : null, |
|
314 | + 'is_free_trial' => isset($_POST['wpinv_trial_interval']) ? (0 != (int) $_POST['wpinv_trial_interval']) : null, |
|
315 | + 'trial_period' => isset($_POST['wpinv_trial_period']) ? wpinv_clean($_POST['wpinv_trial_period']) : null, |
|
316 | + 'trial_interval' => isset($_POST['wpinv_trial_interval']) ? (int) $_POST['wpinv_trial_interval'] : null, |
|
317 | 317 | ) |
318 | 318 | ); |
319 | 319 | |
320 | 320 | $item->save(); |
321 | - do_action( 'getpaid_item_metabox_save', $post_id, $item ); |
|
321 | + do_action('getpaid_item_metabox_save', $post_id, $item); |
|
322 | 322 | } |
323 | 323 | } |
@@ -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,10 +17,10 @@ discard block |
||
17 | 17 | class GetPaid_Meta_Box_Invoice_Address { |
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 | 25 | |
26 | 26 | // Prepare the invoice. |
@@ -300,18 +300,18 @@ discard block |
||
300 | 300 | } |
301 | 301 | |
302 | 302 | /** |
303 | - * Save meta box data. |
|
304 | - * |
|
305 | - * @param int $post_id |
|
306 | - */ |
|
307 | - public static function save( $post_id ) { |
|
303 | + * Save meta box data. |
|
304 | + * |
|
305 | + * @param int $post_id |
|
306 | + */ |
|
307 | + public static function save( $post_id ) { |
|
308 | 308 | |
309 | 309 | // Prepare the invoice. |
310 | 310 | $invoice = new WPInv_Invoice( $post_id ); |
311 | 311 | |
312 | 312 | // Load new data. |
313 | 313 | $invoice->set_props( |
314 | - array( |
|
314 | + array( |
|
315 | 315 | 'template' => isset( $_POST['wpinv_template'] ) ? wpinv_clean( $_POST['wpinv_template'] ) : null, |
316 | 316 | 'email_cc' => isset( $_POST['wpinv_cc'] ) ? wpinv_clean( $_POST['wpinv_cc'] ) : null, |
317 | 317 | 'disable_taxes' => isset( $_POST['disable_taxes'] ), |
@@ -332,7 +332,7 @@ discard block |
||
332 | 332 | 'due_date' => isset( $_POST['wpinv_due_date'] ) ? wpinv_clean( $_POST['wpinv_due_date'] ) : null, |
333 | 333 | 'number' => isset( $_POST['wpinv_number'] ) ? wpinv_clean( $_POST['wpinv_number'] ) : null, |
334 | 334 | 'status' => isset( $_POST['wpinv_status'] ) ? wpinv_clean( $_POST['wpinv_status'] ) : null, |
335 | - ) |
|
335 | + ) |
|
336 | 336 | ); |
337 | 337 | |
338 | 338 | // Recalculate totals. |
@@ -362,6 +362,6 @@ discard block |
||
362 | 362 | } |
363 | 363 | |
364 | 364 | // Fires after an invoice is saved. |
365 | - do_action( 'wpinv_invoice_metabox_saved', $invoice ); |
|
366 | - } |
|
365 | + do_action( 'wpinv_invoice_metabox_saved', $invoice ); |
|
366 | + } |
|
367 | 367 | } |
@@ -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,12 +21,12 @@ 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 invoice. |
27 | - $invoice = new WPInv_Invoice( $post ); |
|
27 | + $invoice = new WPInv_Invoice($post); |
|
28 | 28 | |
29 | - wp_nonce_field( 'getpaid_meta_nonce', 'getpaid_meta_nonce' ); |
|
29 | + wp_nonce_field('getpaid_meta_nonce', 'getpaid_meta_nonce'); |
|
30 | 30 | |
31 | 31 | ?> |
32 | 32 | |
@@ -42,13 +42,13 @@ discard block |
||
42 | 42 | <div class="col-12 col-sm-6"> |
43 | 43 | <div id="getpaid-invoice-user-id-wrapper" class="form-group"> |
44 | 44 | <div> |
45 | - <label for="post_author_override"><?php _e( 'Customer', 'invoicing' );?></label> |
|
45 | + <label for="post_author_override"><?php _e('Customer', 'invoicing'); ?></label> |
|
46 | 46 | </div> |
47 | 47 | <?php |
48 | 48 | wpinv_dropdown_users( |
49 | 49 | array( |
50 | 50 | 'name' => 'post_author_override', |
51 | - 'selected' => $invoice->get_id() ? $invoice->get_user_id( 'edit' ) : get_current_user_id(), |
|
51 | + 'selected' => $invoice->get_id() ? $invoice->get_user_id('edit') : get_current_user_id(), |
|
52 | 52 | 'include_selected' => true, |
53 | 53 | 'show' => 'display_name_with_email', |
54 | 54 | 'orderby' => 'user_email', |
@@ -66,7 +66,7 @@ discard block |
||
66 | 66 | 'type' => 'text', |
67 | 67 | 'id' => 'getpaid-invoice-new-user-email', |
68 | 68 | 'name' => 'wpinv_email', |
69 | - 'label' => __( 'Email', 'invoicing' ) . '<span class="required">*</span>', |
|
69 | + 'label' => __('Email', 'invoicing') . '<span class="required">*</span>', |
|
70 | 70 | 'label_type' => 'vertical', |
71 | 71 | 'placeholder' => '[email protected]', |
72 | 72 | 'class' => 'form-control-sm', |
@@ -76,18 +76,18 @@ discard block |
||
76 | 76 | </div> |
77 | 77 | </div> |
78 | 78 | <div class="col-12 col-sm-6 form-group mt-sm-4"> |
79 | - <?php if ( ! $invoice->is_paid() && ! $invoice->is_refunded() ) : ?> |
|
79 | + <?php if (!$invoice->is_paid() && !$invoice->is_refunded()) : ?> |
|
80 | 80 | <a id="getpaid-invoice-fill-user-details" class="button button-small button-secondary" href="javascript:void(0)"> |
81 | 81 | <i aria-hidden="true" class="fa fa-refresh"></i> |
82 | - <?php _e( 'Fill User Details', 'invoicing' );?> |
|
82 | + <?php _e('Fill User Details', 'invoicing'); ?> |
|
83 | 83 | </a> |
84 | 84 | <a id="getpaid-invoice-create-new-user-button" class="button button-small button-secondary" href="javascript:void(0)"> |
85 | 85 | <i aria-hidden="true" class="fa fa-plus"></i> |
86 | - <?php _e( 'Add New User', 'invoicing' );?> |
|
86 | + <?php _e('Add New User', 'invoicing'); ?> |
|
87 | 87 | </a> |
88 | 88 | <a id="getpaid-invoice-cancel-create-new-user" class="button button-small button-secondary d-none" href="javascript:void(0)"> |
89 | 89 | <i aria-hidden="true" class="fa fa-close"></i> |
90 | - <?php _e( 'Cancel', 'invoicing' );?> |
|
90 | + <?php _e('Cancel', 'invoicing'); ?> |
|
91 | 91 | </a> |
92 | 92 | <?php endif; ?> |
93 | 93 | </div> |
@@ -100,11 +100,11 @@ discard block |
||
100 | 100 | 'type' => 'text', |
101 | 101 | 'id' => 'wpinv_first_name', |
102 | 102 | 'name' => 'wpinv_first_name', |
103 | - 'label' => __( 'First Name', 'invoicing' ), |
|
103 | + 'label' => __('First Name', 'invoicing'), |
|
104 | 104 | 'label_type' => 'vertical', |
105 | 105 | 'placeholder' => 'Jane', |
106 | 106 | 'class' => 'form-control-sm', |
107 | - 'value' => $invoice->get_first_name( 'edit' ), |
|
107 | + 'value' => $invoice->get_first_name('edit'), |
|
108 | 108 | ) |
109 | 109 | ); |
110 | 110 | ?> |
@@ -116,11 +116,11 @@ discard block |
||
116 | 116 | 'type' => 'text', |
117 | 117 | 'id' => 'wpinv_last_name', |
118 | 118 | 'name' => 'wpinv_last_name', |
119 | - 'label' => __( 'Last Name', 'invoicing' ), |
|
119 | + 'label' => __('Last Name', 'invoicing'), |
|
120 | 120 | 'label_type' => 'vertical', |
121 | 121 | 'placeholder' => 'Doe', |
122 | 122 | 'class' => 'form-control-sm', |
123 | - 'value' => $invoice->get_last_name( 'edit' ), |
|
123 | + 'value' => $invoice->get_last_name('edit'), |
|
124 | 124 | ) |
125 | 125 | ); |
126 | 126 | ?> |
@@ -135,11 +135,11 @@ discard block |
||
135 | 135 | 'type' => 'text', |
136 | 136 | 'id' => 'wpinv_company', |
137 | 137 | 'name' => 'wpinv_company', |
138 | - 'label' => __( 'Company', 'invoicing' ), |
|
138 | + 'label' => __('Company', 'invoicing'), |
|
139 | 139 | 'label_type' => 'vertical', |
140 | 140 | 'placeholder' => 'Acme Corporation', |
141 | 141 | 'class' => 'form-control-sm', |
142 | - 'value' => $invoice->get_company( 'edit' ), |
|
142 | + 'value' => $invoice->get_company('edit'), |
|
143 | 143 | ) |
144 | 144 | ); |
145 | 145 | ?> |
@@ -151,11 +151,11 @@ discard block |
||
151 | 151 | 'type' => 'text', |
152 | 152 | 'id' => 'wpinv_vat_number', |
153 | 153 | 'name' => 'wpinv_vat_number', |
154 | - 'label' => __( 'Vat Number', 'invoicing' ), |
|
154 | + 'label' => __('Vat Number', 'invoicing'), |
|
155 | 155 | 'label_type' => 'vertical', |
156 | 156 | 'placeholder' => '1234567890', |
157 | 157 | 'class' => 'form-control-sm', |
158 | - 'value' => $invoice->get_vat_number( 'edit' ), |
|
158 | + 'value' => $invoice->get_vat_number('edit'), |
|
159 | 159 | ) |
160 | 160 | ); |
161 | 161 | ?> |
@@ -170,11 +170,11 @@ discard block |
||
170 | 170 | 'type' => 'text', |
171 | 171 | 'id' => 'wpinv_address', |
172 | 172 | 'name' => 'wpinv_address', |
173 | - 'label' => __( 'Address', 'invoicing' ), |
|
173 | + 'label' => __('Address', 'invoicing'), |
|
174 | 174 | 'label_type' => 'vertical', |
175 | 175 | 'placeholder' => 'Blekersdijk 295', |
176 | 176 | 'class' => 'form-control-sm', |
177 | - 'value' => $invoice->get_address( 'edit' ), |
|
177 | + 'value' => $invoice->get_address('edit'), |
|
178 | 178 | ) |
179 | 179 | ); |
180 | 180 | ?> |
@@ -186,11 +186,11 @@ discard block |
||
186 | 186 | 'type' => 'text', |
187 | 187 | 'id' => 'wpinv_city', |
188 | 188 | 'name' => 'wpinv_city', |
189 | - 'label' => __( 'City', 'invoicing' ), |
|
189 | + 'label' => __('City', 'invoicing'), |
|
190 | 190 | 'label_type' => 'vertical', |
191 | 191 | 'placeholder' => 'Dolembreux', |
192 | 192 | 'class' => 'form-control-sm', |
193 | - 'value' => $invoice->get_vat_number( 'edit' ), |
|
193 | + 'value' => $invoice->get_vat_number('edit'), |
|
194 | 194 | ) |
195 | 195 | ); |
196 | 196 | ?> |
@@ -204,11 +204,11 @@ discard block |
||
204 | 204 | array( |
205 | 205 | 'id' => 'wpinv_country', |
206 | 206 | 'name' => 'wpinv_country', |
207 | - 'label' => __( 'Country', 'invoicing' ), |
|
207 | + 'label' => __('Country', 'invoicing'), |
|
208 | 208 | 'label_type' => 'vertical', |
209 | - 'placeholder' => __( 'Choose a country', 'invoicing' ), |
|
209 | + 'placeholder' => __('Choose a country', 'invoicing'), |
|
210 | 210 | 'class' => 'form-control-sm', |
211 | - 'value' => $invoice->get_country( 'edit' ), |
|
211 | + 'value' => $invoice->get_country('edit'), |
|
212 | 212 | 'options' => wpinv_get_country_list(), |
213 | 213 | 'data-allow-clear' => 'false', |
214 | 214 | 'select2' => true, |
@@ -219,20 +219,20 @@ discard block |
||
219 | 219 | <div class="col-12 col-sm-6"> |
220 | 220 | <?php |
221 | 221 | |
222 | - $states = wpinv_get_country_states( $invoice->get_country( 'edit' ) ); |
|
222 | + $states = wpinv_get_country_states($invoice->get_country('edit')); |
|
223 | 223 | |
224 | - if ( empty( $states ) ) { |
|
224 | + if (empty($states)) { |
|
225 | 225 | |
226 | 226 | echo aui()->input( |
227 | 227 | array( |
228 | 228 | 'type' => 'text', |
229 | 229 | 'id' => 'wpinv_state', |
230 | 230 | 'name' => 'wpinv_state', |
231 | - 'label' => __( 'State', 'invoicing' ), |
|
231 | + 'label' => __('State', 'invoicing'), |
|
232 | 232 | 'label_type' => 'vertical', |
233 | 233 | 'placeholder' => 'Liège', |
234 | 234 | 'class' => 'form-control-sm', |
235 | - 'value' => $invoice->get_state( 'edit' ), |
|
235 | + 'value' => $invoice->get_state('edit'), |
|
236 | 236 | ) |
237 | 237 | ); |
238 | 238 | |
@@ -242,11 +242,11 @@ discard block |
||
242 | 242 | array( |
243 | 243 | 'id' => 'wpinv_state', |
244 | 244 | 'name' => 'wpinv_state', |
245 | - 'label' => __( 'State', 'invoicing' ), |
|
245 | + 'label' => __('State', 'invoicing'), |
|
246 | 246 | 'label_type' => 'vertical', |
247 | - 'placeholder' => __( 'Select a state', 'invoicing' ), |
|
247 | + 'placeholder' => __('Select a state', 'invoicing'), |
|
248 | 248 | 'class' => 'form-control-sm', |
249 | - 'value' => $invoice->get_state( 'edit' ), |
|
249 | + 'value' => $invoice->get_state('edit'), |
|
250 | 250 | 'options' => $states, |
251 | 251 | 'data-allow-clear' => 'false', |
252 | 252 | 'select2' => true, |
@@ -267,11 +267,11 @@ discard block |
||
267 | 267 | 'type' => 'text', |
268 | 268 | 'id' => 'wpinv_zip', |
269 | 269 | 'name' => 'wpinv_zip', |
270 | - 'label' => __( 'Zip / Postal Code', 'invoicing' ), |
|
270 | + 'label' => __('Zip / Postal Code', 'invoicing'), |
|
271 | 271 | 'label_type' => 'vertical', |
272 | 272 | 'placeholder' => '4140', |
273 | 273 | 'class' => 'form-control-sm', |
274 | - 'value' => $invoice->get_zip( 'edit' ), |
|
274 | + 'value' => $invoice->get_zip('edit'), |
|
275 | 275 | ) |
276 | 276 | ); |
277 | 277 | ?> |
@@ -283,11 +283,11 @@ discard block |
||
283 | 283 | 'type' => 'text', |
284 | 284 | 'id' => 'wpinv_phone', |
285 | 285 | 'name' => 'wpinv_phone', |
286 | - 'label' => __( 'Phone', 'invoicing' ), |
|
286 | + 'label' => __('Phone', 'invoicing'), |
|
287 | 287 | 'label_type' => 'vertical', |
288 | 288 | 'placeholder' => '0493 18 45822', |
289 | 289 | 'class' => 'form-control-sm', |
290 | - 'value' => $invoice->get_phone( 'edit' ), |
|
290 | + 'value' => $invoice->get_phone('edit'), |
|
291 | 291 | ) |
292 | 292 | ); |
293 | 293 | ?> |
@@ -304,34 +304,34 @@ discard block |
||
304 | 304 | * |
305 | 305 | * @param int $post_id |
306 | 306 | */ |
307 | - public static function save( $post_id ) { |
|
307 | + public static function save($post_id) { |
|
308 | 308 | |
309 | 309 | // Prepare the invoice. |
310 | - $invoice = new WPInv_Invoice( $post_id ); |
|
310 | + $invoice = new WPInv_Invoice($post_id); |
|
311 | 311 | |
312 | 312 | // Load new data. |
313 | 313 | $invoice->set_props( |
314 | 314 | array( |
315 | - 'template' => isset( $_POST['wpinv_template'] ) ? wpinv_clean( $_POST['wpinv_template'] ) : null, |
|
316 | - 'email_cc' => isset( $_POST['wpinv_cc'] ) ? wpinv_clean( $_POST['wpinv_cc'] ) : null, |
|
317 | - 'disable_taxes' => isset( $_POST['disable_taxes'] ), |
|
318 | - 'currency' => isset( $_POST['wpinv_currency'] ) ? wpinv_clean( $_POST['wpinv_currency'] ) : null, |
|
319 | - 'gateway' => isset( $_POST['wpinv_gateway'] ) ? wpinv_clean( $_POST['wpinv_gateway'] ) : null, |
|
320 | - 'address' => isset( $_POST['wpinv_address'] ) ? wpinv_clean( $_POST['wpinv_address'] ) : null, |
|
321 | - 'vat_number' => isset( $_POST['wpinv_vat_number'] ) ? wpinv_clean( $_POST['wpinv_vat_number'] ) : null, |
|
322 | - 'company' => isset( $_POST['wpinv_company'] ) ? wpinv_clean( $_POST['wpinv_company'] ) : null, |
|
323 | - 'zip' => isset( $_POST['wpinv_zip'] ) ? wpinv_clean( $_POST['wpinv_zip'] ) : null, |
|
324 | - 'state' => isset( $_POST['wpinv_state'] ) ? wpinv_clean( $_POST['wpinv_state'] ) : null, |
|
325 | - 'city' => isset( $_POST['wpinv_city'] ) ? wpinv_clean( $_POST['wpinv_city'] ) : null, |
|
326 | - 'country' => isset( $_POST['wpinv_country'] ) ? wpinv_clean( $_POST['wpinv_country'] ) : null, |
|
327 | - 'phone' => isset( $_POST['wpinv_phone'] ) ? wpinv_clean( $_POST['wpinv_phone'] ) : null, |
|
328 | - 'first_name' => isset( $_POST['wpinv_first_name'] ) ? wpinv_clean( $_POST['wpinv_first_name'] ) : null, |
|
329 | - 'last_name' => isset( $_POST['wpinv_last_name'] ) ? wpinv_clean( $_POST['wpinv_last_name'] ) : null, |
|
330 | - 'author' => isset( $_POST['post_author_override'] ) ? wpinv_clean( $_POST['post_author_override'] ) : null, |
|
331 | - 'date_created' => isset( $_POST['date_created'] ) ? wpinv_clean( $_POST['date_created'] ) : null, |
|
332 | - 'due_date' => isset( $_POST['wpinv_due_date'] ) ? wpinv_clean( $_POST['wpinv_due_date'] ) : null, |
|
333 | - 'number' => isset( $_POST['wpinv_number'] ) ? wpinv_clean( $_POST['wpinv_number'] ) : null, |
|
334 | - 'status' => isset( $_POST['wpinv_status'] ) ? wpinv_clean( $_POST['wpinv_status'] ) : null, |
|
315 | + 'template' => isset($_POST['wpinv_template']) ? wpinv_clean($_POST['wpinv_template']) : null, |
|
316 | + 'email_cc' => isset($_POST['wpinv_cc']) ? wpinv_clean($_POST['wpinv_cc']) : null, |
|
317 | + 'disable_taxes' => isset($_POST['disable_taxes']), |
|
318 | + 'currency' => isset($_POST['wpinv_currency']) ? wpinv_clean($_POST['wpinv_currency']) : null, |
|
319 | + 'gateway' => isset($_POST['wpinv_gateway']) ? wpinv_clean($_POST['wpinv_gateway']) : null, |
|
320 | + 'address' => isset($_POST['wpinv_address']) ? wpinv_clean($_POST['wpinv_address']) : null, |
|
321 | + 'vat_number' => isset($_POST['wpinv_vat_number']) ? wpinv_clean($_POST['wpinv_vat_number']) : null, |
|
322 | + 'company' => isset($_POST['wpinv_company']) ? wpinv_clean($_POST['wpinv_company']) : null, |
|
323 | + 'zip' => isset($_POST['wpinv_zip']) ? wpinv_clean($_POST['wpinv_zip']) : null, |
|
324 | + 'state' => isset($_POST['wpinv_state']) ? wpinv_clean($_POST['wpinv_state']) : null, |
|
325 | + 'city' => isset($_POST['wpinv_city']) ? wpinv_clean($_POST['wpinv_city']) : null, |
|
326 | + 'country' => isset($_POST['wpinv_country']) ? wpinv_clean($_POST['wpinv_country']) : null, |
|
327 | + 'phone' => isset($_POST['wpinv_phone']) ? wpinv_clean($_POST['wpinv_phone']) : null, |
|
328 | + 'first_name' => isset($_POST['wpinv_first_name']) ? wpinv_clean($_POST['wpinv_first_name']) : null, |
|
329 | + 'last_name' => isset($_POST['wpinv_last_name']) ? wpinv_clean($_POST['wpinv_last_name']) : null, |
|
330 | + 'author' => isset($_POST['post_author_override']) ? wpinv_clean($_POST['post_author_override']) : null, |
|
331 | + 'date_created' => isset($_POST['date_created']) ? wpinv_clean($_POST['date_created']) : null, |
|
332 | + 'due_date' => isset($_POST['wpinv_due_date']) ? wpinv_clean($_POST['wpinv_due_date']) : null, |
|
333 | + 'number' => isset($_POST['wpinv_number']) ? wpinv_clean($_POST['wpinv_number']) : null, |
|
334 | + 'status' => isset($_POST['wpinv_status']) ? wpinv_clean($_POST['wpinv_status']) : null, |
|
335 | 335 | ) |
336 | 336 | ); |
337 | 337 | |
@@ -339,17 +339,17 @@ discard block |
||
339 | 339 | $invoice->recalculate_total(); |
340 | 340 | |
341 | 341 | // If we're creating a new user... |
342 | - if ( ! empty( $_POST['wpinv_new_user'] ) && is_email( $_POST['wpinv_email'] ) ) { |
|
342 | + if (!empty($_POST['wpinv_new_user']) && is_email($_POST['wpinv_email'])) { |
|
343 | 343 | |
344 | 344 | // Attempt to create the user. |
345 | - $user = wpinv_create_user( sanitize_email( $_POST['wpinv_email'] ) ); |
|
345 | + $user = wpinv_create_user(sanitize_email($_POST['wpinv_email'])); |
|
346 | 346 | |
347 | 347 | |
348 | 348 | // If successful, update the invoice author. |
349 | - if ( is_numeric( $user ) ) { |
|
350 | - $invoice->set_author( $user ); |
|
349 | + if (is_numeric($user)) { |
|
350 | + $invoice->set_author($user); |
|
351 | 351 | } else { |
352 | - wpinv_error_log( $user->get_error_message(), __( 'Invoice add new user', 'invoicing' ), __FILE__, __LINE__ ); |
|
352 | + wpinv_error_log($user->get_error_message(), __('Invoice add new user', 'invoicing'), __FILE__, __LINE__); |
|
353 | 353 | } |
354 | 354 | } |
355 | 355 | |
@@ -357,11 +357,11 @@ discard block |
||
357 | 357 | $invoice->save(); |
358 | 358 | |
359 | 359 | // (Maybe) send new user notification. |
360 | - if ( ! empty( $user ) && is_numeric( $user ) && apply_filters( 'getpaid_send_new_user_notification', true ) ) { |
|
361 | - wp_send_new_user_notifications( $user, 'user' ); |
|
360 | + if (!empty($user) && is_numeric($user) && apply_filters('getpaid_send_new_user_notification', true)) { |
|
361 | + wp_send_new_user_notifications($user, 'user'); |
|
362 | 362 | } |
363 | 363 | |
364 | 364 | // Fires after an invoice is saved. |
365 | - do_action( 'wpinv_invoice_metabox_saved', $invoice ); |
|
365 | + do_action('wpinv_invoice_metabox_saved', $invoice); |
|
366 | 366 | } |
367 | 367 | } |
@@ -56,69 +56,69 @@ |
||
56 | 56 | } |
57 | 57 | |
58 | 58 | function wpinv_admin_messages() { |
59 | - global $wpinv_options, $pagenow, $post; |
|
59 | + global $wpinv_options, $pagenow, $post; |
|
60 | 60 | |
61 | - if ( isset( $_GET['wpinv-message'] ) && 'discount_added' == $_GET['wpinv-message'] && wpinv_current_user_can_manage_invoicing() ) { |
|
62 | - add_settings_error( 'wpinv-notices', 'wpinv-discount-added', __( 'Discount code added.', 'invoicing' ), 'updated' ); |
|
63 | - } |
|
61 | + if ( isset( $_GET['wpinv-message'] ) && 'discount_added' == $_GET['wpinv-message'] && wpinv_current_user_can_manage_invoicing() ) { |
|
62 | + add_settings_error( 'wpinv-notices', 'wpinv-discount-added', __( 'Discount code added.', 'invoicing' ), 'updated' ); |
|
63 | + } |
|
64 | 64 | |
65 | - if ( isset( $_GET['wpinv-message'] ) && 'discount_add_failed' == $_GET['wpinv-message'] && wpinv_current_user_can_manage_invoicing() ) { |
|
66 | - add_settings_error( 'wpinv-notices', 'wpinv-discount-add-fail', __( 'There was a problem adding your discount code, please try again.', 'invoicing' ), 'error' ); |
|
67 | - } |
|
65 | + if ( isset( $_GET['wpinv-message'] ) && 'discount_add_failed' == $_GET['wpinv-message'] && wpinv_current_user_can_manage_invoicing() ) { |
|
66 | + add_settings_error( 'wpinv-notices', 'wpinv-discount-add-fail', __( 'There was a problem adding your discount code, please try again.', 'invoicing' ), 'error' ); |
|
67 | + } |
|
68 | 68 | |
69 | - if ( isset( $_GET['wpinv-message'] ) && 'discount_exists' == $_GET['wpinv-message'] && wpinv_current_user_can_manage_invoicing() ) { |
|
70 | - add_settings_error( 'wpinv-notices', 'wpinv-discount-exists', __( 'A discount with that code already exists, please use a different code.', 'invoicing' ), 'error' ); |
|
71 | - } |
|
69 | + if ( isset( $_GET['wpinv-message'] ) && 'discount_exists' == $_GET['wpinv-message'] && wpinv_current_user_can_manage_invoicing() ) { |
|
70 | + add_settings_error( 'wpinv-notices', 'wpinv-discount-exists', __( 'A discount with that code already exists, please use a different code.', 'invoicing' ), 'error' ); |
|
71 | + } |
|
72 | 72 | |
73 | - if ( isset( $_GET['wpinv-message'] ) && 'discount_updated' == $_GET['wpinv-message'] && wpinv_current_user_can_manage_invoicing() ) { |
|
74 | - add_settings_error( 'wpinv-notices', 'wpinv-discount-updated', __( 'Discount code updated.', 'invoicing' ), 'updated' ); |
|
75 | - } |
|
73 | + if ( isset( $_GET['wpinv-message'] ) && 'discount_updated' == $_GET['wpinv-message'] && wpinv_current_user_can_manage_invoicing() ) { |
|
74 | + add_settings_error( 'wpinv-notices', 'wpinv-discount-updated', __( 'Discount code updated.', 'invoicing' ), 'updated' ); |
|
75 | + } |
|
76 | 76 | |
77 | - if ( isset( $_GET['wpinv-message'] ) && 'discount_update_failed' == $_GET['wpinv-message'] && wpinv_current_user_can_manage_invoicing() ) { |
|
78 | - add_settings_error( 'wpinv-notices', 'wpinv-discount-updated-fail', __( 'There was a problem updating your discount code, please try again.', 'invoicing' ), 'error' ); |
|
79 | - } |
|
77 | + if ( isset( $_GET['wpinv-message'] ) && 'discount_update_failed' == $_GET['wpinv-message'] && wpinv_current_user_can_manage_invoicing() ) { |
|
78 | + add_settings_error( 'wpinv-notices', 'wpinv-discount-updated-fail', __( 'There was a problem updating your discount code, please try again.', 'invoicing' ), 'error' ); |
|
79 | + } |
|
80 | 80 | |
81 | - if ( isset( $_GET['wpinv-message'] ) && 'invoice_deleted' == $_GET['wpinv-message'] && wpinv_current_user_can_manage_invoicing() ) { |
|
82 | - add_settings_error( 'wpinv-notices', 'wpinv-deleted', __( 'The invoice has been deleted.', 'invoicing' ), 'updated' ); |
|
83 | - } |
|
81 | + if ( isset( $_GET['wpinv-message'] ) && 'invoice_deleted' == $_GET['wpinv-message'] && wpinv_current_user_can_manage_invoicing() ) { |
|
82 | + add_settings_error( 'wpinv-notices', 'wpinv-deleted', __( 'The invoice has been deleted.', 'invoicing' ), 'updated' ); |
|
83 | + } |
|
84 | 84 | |
85 | - if ( isset( $_GET['wpinv-message'] ) && 'email_disabled' == $_GET['wpinv-message'] && wpinv_current_user_can_manage_invoicing() ) { |
|
86 | - add_settings_error( 'wpinv-notices', 'wpinv-sent-fail', __( 'Email notification is disabled. Please check settings.', 'invoicing' ), 'error' ); |
|
87 | - } |
|
85 | + if ( isset( $_GET['wpinv-message'] ) && 'email_disabled' == $_GET['wpinv-message'] && wpinv_current_user_can_manage_invoicing() ) { |
|
86 | + add_settings_error( 'wpinv-notices', 'wpinv-sent-fail', __( 'Email notification is disabled. Please check settings.', 'invoicing' ), 'error' ); |
|
87 | + } |
|
88 | 88 | |
89 | - if ( isset( $_GET['wpinv-message'] ) && 'email_sent' == $_GET['wpinv-message'] && wpinv_current_user_can_manage_invoicing() ) { |
|
90 | - add_settings_error( 'wpinv-notices', 'wpinv-sent', __( 'The email has been sent to customer.', 'invoicing' ), 'updated' ); |
|
89 | + if ( isset( $_GET['wpinv-message'] ) && 'email_sent' == $_GET['wpinv-message'] && wpinv_current_user_can_manage_invoicing() ) { |
|
90 | + add_settings_error( 'wpinv-notices', 'wpinv-sent', __( 'The email has been sent to customer.', 'invoicing' ), 'updated' ); |
|
91 | 91 | } |
92 | 92 | |
93 | 93 | if ( isset( $_GET['wpinv-message'] ) && 'email_fail' == $_GET['wpinv-message'] && wpinv_current_user_can_manage_invoicing() ) { |
94 | - add_settings_error( 'wpinv-notices', 'wpinv-sent-fail', __( 'Fail to send email to the customer.', 'invoicing' ), 'error' ); |
|
94 | + add_settings_error( 'wpinv-notices', 'wpinv-sent-fail', __( 'Fail to send email to the customer.', 'invoicing' ), 'error' ); |
|
95 | 95 | } |
96 | 96 | |
97 | 97 | if ( isset( $_GET['wpinv-message'] ) && 'invoice-note-deleted' == $_GET['wpinv-message'] && wpinv_current_user_can_manage_invoicing() ) { |
98 | 98 | add_settings_error( 'wpinv-notices', 'wpinv-note-deleted', __( 'The invoice note has been deleted.', 'invoicing' ), 'updated' ); |
99 | 99 | } |
100 | 100 | |
101 | - if ( isset( $_GET['wpinv-message'] ) && 'settings-imported' == $_GET['wpinv-message'] && wpinv_current_user_can_manage_invoicing() ) { |
|
102 | - add_settings_error( 'wpinv-notices', 'wpinv-settings-imported', __( 'The settings have been imported.', 'invoicing' ), 'updated' ); |
|
103 | - } |
|
101 | + if ( isset( $_GET['wpinv-message'] ) && 'settings-imported' == $_GET['wpinv-message'] && wpinv_current_user_can_manage_invoicing() ) { |
|
102 | + add_settings_error( 'wpinv-notices', 'wpinv-settings-imported', __( 'The settings have been imported.', 'invoicing' ), 'updated' ); |
|
103 | + } |
|
104 | 104 | |
105 | - if ( isset( $_GET['wpinv-message'] ) && 'note-added' == $_GET['wpinv-message'] && wpinv_current_user_can_manage_invoicing() ) { |
|
106 | - add_settings_error( 'wpinv-notices', 'wpinv-note-added', __( 'The invoice note has been added successfully.', 'invoicing' ), 'updated' ); |
|
107 | - } |
|
105 | + if ( isset( $_GET['wpinv-message'] ) && 'note-added' == $_GET['wpinv-message'] && wpinv_current_user_can_manage_invoicing() ) { |
|
106 | + add_settings_error( 'wpinv-notices', 'wpinv-note-added', __( 'The invoice note has been added successfully.', 'invoicing' ), 'updated' ); |
|
107 | + } |
|
108 | 108 | |
109 | - if ( isset( $_GET['wpinv-message'] ) && 'invoice-updated' == $_GET['wpinv-message'] && wpinv_current_user_can_manage_invoicing() ) { |
|
110 | - add_settings_error( 'wpinv-notices', 'wpinv-updated', __( 'The invoice has been successfully updated.', 'invoicing' ), 'updated' ); |
|
111 | - } |
|
109 | + if ( isset( $_GET['wpinv-message'] ) && 'invoice-updated' == $_GET['wpinv-message'] && wpinv_current_user_can_manage_invoicing() ) { |
|
110 | + add_settings_error( 'wpinv-notices', 'wpinv-updated', __( 'The invoice has been successfully updated.', 'invoicing' ), 'updated' ); |
|
111 | + } |
|
112 | 112 | |
113 | - if ( $pagenow == 'post.php' && !empty( $post->post_type ) && $post->post_type == 'wpi_item' && !wpinv_item_is_editable( $post ) ) { |
|
114 | - $message = apply_filters( 'wpinv_item_non_editable_message', __( 'This item in not editable.', 'invoicing' ), $post->ID ); |
|
113 | + if ( $pagenow == 'post.php' && !empty( $post->post_type ) && $post->post_type == 'wpi_item' && !wpinv_item_is_editable( $post ) ) { |
|
114 | + $message = apply_filters( 'wpinv_item_non_editable_message', __( 'This item in not editable.', 'invoicing' ), $post->ID ); |
|
115 | 115 | |
116 | - if ( !empty( $message ) ) { |
|
117 | - add_settings_error( 'wpinv-notices', 'wpinv-edit-n', $message, 'updated' ); |
|
118 | - } |
|
119 | - } |
|
116 | + if ( !empty( $message ) ) { |
|
117 | + add_settings_error( 'wpinv-notices', 'wpinv-edit-n', $message, 'updated' ); |
|
118 | + } |
|
119 | + } |
|
120 | 120 | |
121 | - settings_errors( 'wpinv-notices' ); |
|
121 | + settings_errors( 'wpinv-notices' ); |
|
122 | 122 | } |
123 | 123 | add_action( 'admin_notices', 'wpinv_admin_messages' ); |
124 | 124 |
@@ -7,127 +7,127 @@ discard block |
||
7 | 7 | */ |
8 | 8 | |
9 | 9 | // MUST have WordPress. |
10 | -if ( !defined( 'WPINC' ) ) { |
|
11 | - exit( 'Do NOT access this file directly: ' . basename( __FILE__ ) ); |
|
10 | +if (!defined('WPINC')) { |
|
11 | + exit('Do NOT access this file directly: ' . basename(__FILE__)); |
|
12 | 12 | } |
13 | 13 | |
14 | -function wpinv_bulk_actions( $actions ) { |
|
15 | - if ( isset( $actions['edit'] ) ) { |
|
16 | - unset( $actions['edit'] ); |
|
14 | +function wpinv_bulk_actions($actions) { |
|
15 | + if (isset($actions['edit'])) { |
|
16 | + unset($actions['edit']); |
|
17 | 17 | } |
18 | 18 | |
19 | 19 | return $actions; |
20 | 20 | } |
21 | -add_filter( 'bulk_actions-edit-wpi_invoice', 'wpinv_bulk_actions' ); |
|
22 | -add_filter( 'bulk_actions-edit-wpi_item', 'wpinv_bulk_actions' ); |
|
21 | +add_filter('bulk_actions-edit-wpi_invoice', 'wpinv_bulk_actions'); |
|
22 | +add_filter('bulk_actions-edit-wpi_item', 'wpinv_bulk_actions'); |
|
23 | 23 | |
24 | -function wpinv_admin_post_id( $id = 0 ) { |
|
24 | +function wpinv_admin_post_id($id = 0) { |
|
25 | 25 | global $post; |
26 | 26 | |
27 | - if ( isset( $id ) && ! empty( $id ) ) { |
|
28 | - return (int)$id; |
|
29 | - } else if ( get_the_ID() ) { |
|
27 | + if (isset($id) && !empty($id)) { |
|
28 | + return (int) $id; |
|
29 | + } else if (get_the_ID()) { |
|
30 | 30 | return (int) get_the_ID(); |
31 | - } else if ( isset( $post->ID ) && !empty( $post->ID ) ) { |
|
31 | + } else if (isset($post->ID) && !empty($post->ID)) { |
|
32 | 32 | return (int) $post->ID; |
33 | - } else if ( isset( $_GET['post'] ) && !empty( $_GET['post'] ) ) { |
|
33 | + } else if (isset($_GET['post']) && !empty($_GET['post'])) { |
|
34 | 34 | return (int) $_GET['post']; |
35 | - } else if ( isset( $_GET['id'] ) && !empty( $_GET['id'] ) ) { |
|
35 | + } else if (isset($_GET['id']) && !empty($_GET['id'])) { |
|
36 | 36 | return (int) $_GET['id']; |
37 | - } else if ( isset( $_POST['id'] ) && !empty( $_POST['id'] ) ) { |
|
37 | + } else if (isset($_POST['id']) && !empty($_POST['id'])) { |
|
38 | 38 | return (int) $_POST['id']; |
39 | 39 | } |
40 | 40 | |
41 | 41 | return null; |
42 | 42 | } |
43 | 43 | |
44 | -function wpinv_admin_post_type( $id = 0 ) { |
|
45 | - if ( !$id ) { |
|
44 | +function wpinv_admin_post_type($id = 0) { |
|
45 | + if (!$id) { |
|
46 | 46 | $id = wpinv_admin_post_id(); |
47 | 47 | } |
48 | 48 | |
49 | - $type = get_post_type( $id ); |
|
49 | + $type = get_post_type($id); |
|
50 | 50 | |
51 | - if ( !$type ) { |
|
52 | - $type = isset( $_GET['post_type'] ) && !empty( $_GET['post_type'] ) ? $_GET['post_type'] : null; |
|
51 | + if (!$type) { |
|
52 | + $type = isset($_GET['post_type']) && !empty($_GET['post_type']) ? $_GET['post_type'] : null; |
|
53 | 53 | } |
54 | 54 | |
55 | - return apply_filters( 'wpinv_admin_post_type', $type, $id ); |
|
55 | + return apply_filters('wpinv_admin_post_type', $type, $id); |
|
56 | 56 | } |
57 | 57 | |
58 | 58 | function wpinv_admin_messages() { |
59 | 59 | global $wpinv_options, $pagenow, $post; |
60 | 60 | |
61 | - if ( isset( $_GET['wpinv-message'] ) && 'discount_added' == $_GET['wpinv-message'] && wpinv_current_user_can_manage_invoicing() ) { |
|
62 | - add_settings_error( 'wpinv-notices', 'wpinv-discount-added', __( 'Discount code added.', 'invoicing' ), 'updated' ); |
|
61 | + if (isset($_GET['wpinv-message']) && 'discount_added' == $_GET['wpinv-message'] && wpinv_current_user_can_manage_invoicing()) { |
|
62 | + add_settings_error('wpinv-notices', 'wpinv-discount-added', __('Discount code added.', 'invoicing'), 'updated'); |
|
63 | 63 | } |
64 | 64 | |
65 | - if ( isset( $_GET['wpinv-message'] ) && 'discount_add_failed' == $_GET['wpinv-message'] && wpinv_current_user_can_manage_invoicing() ) { |
|
66 | - add_settings_error( 'wpinv-notices', 'wpinv-discount-add-fail', __( 'There was a problem adding your discount code, please try again.', 'invoicing' ), 'error' ); |
|
65 | + if (isset($_GET['wpinv-message']) && 'discount_add_failed' == $_GET['wpinv-message'] && wpinv_current_user_can_manage_invoicing()) { |
|
66 | + add_settings_error('wpinv-notices', 'wpinv-discount-add-fail', __('There was a problem adding your discount code, please try again.', 'invoicing'), 'error'); |
|
67 | 67 | } |
68 | 68 | |
69 | - if ( isset( $_GET['wpinv-message'] ) && 'discount_exists' == $_GET['wpinv-message'] && wpinv_current_user_can_manage_invoicing() ) { |
|
70 | - add_settings_error( 'wpinv-notices', 'wpinv-discount-exists', __( 'A discount with that code already exists, please use a different code.', 'invoicing' ), 'error' ); |
|
69 | + if (isset($_GET['wpinv-message']) && 'discount_exists' == $_GET['wpinv-message'] && wpinv_current_user_can_manage_invoicing()) { |
|
70 | + add_settings_error('wpinv-notices', 'wpinv-discount-exists', __('A discount with that code already exists, please use a different code.', 'invoicing'), 'error'); |
|
71 | 71 | } |
72 | 72 | |
73 | - if ( isset( $_GET['wpinv-message'] ) && 'discount_updated' == $_GET['wpinv-message'] && wpinv_current_user_can_manage_invoicing() ) { |
|
74 | - add_settings_error( 'wpinv-notices', 'wpinv-discount-updated', __( 'Discount code updated.', 'invoicing' ), 'updated' ); |
|
73 | + if (isset($_GET['wpinv-message']) && 'discount_updated' == $_GET['wpinv-message'] && wpinv_current_user_can_manage_invoicing()) { |
|
74 | + add_settings_error('wpinv-notices', 'wpinv-discount-updated', __('Discount code updated.', 'invoicing'), 'updated'); |
|
75 | 75 | } |
76 | 76 | |
77 | - if ( isset( $_GET['wpinv-message'] ) && 'discount_update_failed' == $_GET['wpinv-message'] && wpinv_current_user_can_manage_invoicing() ) { |
|
78 | - add_settings_error( 'wpinv-notices', 'wpinv-discount-updated-fail', __( 'There was a problem updating your discount code, please try again.', 'invoicing' ), 'error' ); |
|
77 | + if (isset($_GET['wpinv-message']) && 'discount_update_failed' == $_GET['wpinv-message'] && wpinv_current_user_can_manage_invoicing()) { |
|
78 | + add_settings_error('wpinv-notices', 'wpinv-discount-updated-fail', __('There was a problem updating your discount code, please try again.', 'invoicing'), 'error'); |
|
79 | 79 | } |
80 | 80 | |
81 | - if ( isset( $_GET['wpinv-message'] ) && 'invoice_deleted' == $_GET['wpinv-message'] && wpinv_current_user_can_manage_invoicing() ) { |
|
82 | - add_settings_error( 'wpinv-notices', 'wpinv-deleted', __( 'The invoice has been deleted.', 'invoicing' ), 'updated' ); |
|
81 | + if (isset($_GET['wpinv-message']) && 'invoice_deleted' == $_GET['wpinv-message'] && wpinv_current_user_can_manage_invoicing()) { |
|
82 | + add_settings_error('wpinv-notices', 'wpinv-deleted', __('The invoice has been deleted.', 'invoicing'), 'updated'); |
|
83 | 83 | } |
84 | 84 | |
85 | - if ( isset( $_GET['wpinv-message'] ) && 'email_disabled' == $_GET['wpinv-message'] && wpinv_current_user_can_manage_invoicing() ) { |
|
86 | - add_settings_error( 'wpinv-notices', 'wpinv-sent-fail', __( 'Email notification is disabled. Please check settings.', 'invoicing' ), 'error' ); |
|
85 | + if (isset($_GET['wpinv-message']) && 'email_disabled' == $_GET['wpinv-message'] && wpinv_current_user_can_manage_invoicing()) { |
|
86 | + add_settings_error('wpinv-notices', 'wpinv-sent-fail', __('Email notification is disabled. Please check settings.', 'invoicing'), 'error'); |
|
87 | 87 | } |
88 | 88 | |
89 | - if ( isset( $_GET['wpinv-message'] ) && 'email_sent' == $_GET['wpinv-message'] && wpinv_current_user_can_manage_invoicing() ) { |
|
90 | - add_settings_error( 'wpinv-notices', 'wpinv-sent', __( 'The email has been sent to customer.', 'invoicing' ), 'updated' ); |
|
89 | + if (isset($_GET['wpinv-message']) && 'email_sent' == $_GET['wpinv-message'] && wpinv_current_user_can_manage_invoicing()) { |
|
90 | + add_settings_error('wpinv-notices', 'wpinv-sent', __('The email has been sent to customer.', 'invoicing'), 'updated'); |
|
91 | 91 | } |
92 | 92 | |
93 | - if ( isset( $_GET['wpinv-message'] ) && 'email_fail' == $_GET['wpinv-message'] && wpinv_current_user_can_manage_invoicing() ) { |
|
94 | - add_settings_error( 'wpinv-notices', 'wpinv-sent-fail', __( 'Fail to send email to the customer.', 'invoicing' ), 'error' ); |
|
93 | + if (isset($_GET['wpinv-message']) && 'email_fail' == $_GET['wpinv-message'] && wpinv_current_user_can_manage_invoicing()) { |
|
94 | + add_settings_error('wpinv-notices', 'wpinv-sent-fail', __('Fail to send email to the customer.', 'invoicing'), 'error'); |
|
95 | 95 | } |
96 | 96 | |
97 | - if ( isset( $_GET['wpinv-message'] ) && 'invoice-note-deleted' == $_GET['wpinv-message'] && wpinv_current_user_can_manage_invoicing() ) { |
|
98 | - add_settings_error( 'wpinv-notices', 'wpinv-note-deleted', __( 'The invoice note has been deleted.', 'invoicing' ), 'updated' ); |
|
97 | + if (isset($_GET['wpinv-message']) && 'invoice-note-deleted' == $_GET['wpinv-message'] && wpinv_current_user_can_manage_invoicing()) { |
|
98 | + add_settings_error('wpinv-notices', 'wpinv-note-deleted', __('The invoice note has been deleted.', 'invoicing'), 'updated'); |
|
99 | 99 | } |
100 | 100 | |
101 | - if ( isset( $_GET['wpinv-message'] ) && 'settings-imported' == $_GET['wpinv-message'] && wpinv_current_user_can_manage_invoicing() ) { |
|
102 | - add_settings_error( 'wpinv-notices', 'wpinv-settings-imported', __( 'The settings have been imported.', 'invoicing' ), 'updated' ); |
|
101 | + if (isset($_GET['wpinv-message']) && 'settings-imported' == $_GET['wpinv-message'] && wpinv_current_user_can_manage_invoicing()) { |
|
102 | + add_settings_error('wpinv-notices', 'wpinv-settings-imported', __('The settings have been imported.', 'invoicing'), 'updated'); |
|
103 | 103 | } |
104 | 104 | |
105 | - if ( isset( $_GET['wpinv-message'] ) && 'note-added' == $_GET['wpinv-message'] && wpinv_current_user_can_manage_invoicing() ) { |
|
106 | - add_settings_error( 'wpinv-notices', 'wpinv-note-added', __( 'The invoice note has been added successfully.', 'invoicing' ), 'updated' ); |
|
105 | + if (isset($_GET['wpinv-message']) && 'note-added' == $_GET['wpinv-message'] && wpinv_current_user_can_manage_invoicing()) { |
|
106 | + add_settings_error('wpinv-notices', 'wpinv-note-added', __('The invoice note has been added successfully.', 'invoicing'), 'updated'); |
|
107 | 107 | } |
108 | 108 | |
109 | - if ( isset( $_GET['wpinv-message'] ) && 'invoice-updated' == $_GET['wpinv-message'] && wpinv_current_user_can_manage_invoicing() ) { |
|
110 | - add_settings_error( 'wpinv-notices', 'wpinv-updated', __( 'The invoice has been successfully updated.', 'invoicing' ), 'updated' ); |
|
109 | + if (isset($_GET['wpinv-message']) && 'invoice-updated' == $_GET['wpinv-message'] && wpinv_current_user_can_manage_invoicing()) { |
|
110 | + add_settings_error('wpinv-notices', 'wpinv-updated', __('The invoice has been successfully updated.', 'invoicing'), 'updated'); |
|
111 | 111 | } |
112 | 112 | |
113 | - if ( $pagenow == 'post.php' && !empty( $post->post_type ) && $post->post_type == 'wpi_item' && !wpinv_item_is_editable( $post ) ) { |
|
114 | - $message = apply_filters( 'wpinv_item_non_editable_message', __( 'This item in not editable.', 'invoicing' ), $post->ID ); |
|
113 | + if ($pagenow == 'post.php' && !empty($post->post_type) && $post->post_type == 'wpi_item' && !wpinv_item_is_editable($post)) { |
|
114 | + $message = apply_filters('wpinv_item_non_editable_message', __('This item in not editable.', 'invoicing'), $post->ID); |
|
115 | 115 | |
116 | - if ( !empty( $message ) ) { |
|
117 | - add_settings_error( 'wpinv-notices', 'wpinv-edit-n', $message, 'updated' ); |
|
116 | + if (!empty($message)) { |
|
117 | + add_settings_error('wpinv-notices', 'wpinv-edit-n', $message, 'updated'); |
|
118 | 118 | } |
119 | 119 | } |
120 | 120 | |
121 | - settings_errors( 'wpinv-notices' ); |
|
121 | + settings_errors('wpinv-notices'); |
|
122 | 122 | } |
123 | -add_action( 'admin_notices', 'wpinv_admin_messages' ); |
|
123 | +add_action('admin_notices', 'wpinv_admin_messages'); |
|
124 | 124 | |
125 | -add_action( 'admin_init', 'wpinv_show_test_payment_gateway_notice' ); |
|
126 | -function wpinv_show_test_payment_gateway_notice(){ |
|
127 | - add_action( 'admin_notices', 'wpinv_test_payment_gateway_messages' ); |
|
125 | +add_action('admin_init', 'wpinv_show_test_payment_gateway_notice'); |
|
126 | +function wpinv_show_test_payment_gateway_notice() { |
|
127 | + add_action('admin_notices', 'wpinv_test_payment_gateway_messages'); |
|
128 | 128 | } |
129 | 129 | |
130 | -function wpinv_test_payment_gateway_messages(){ |
|
130 | +function wpinv_test_payment_gateway_messages() { |
|
131 | 131 | $gateways = wpinv_get_enabled_payment_gateways(); |
132 | 132 | $name = array(); $test_gateways = ''; |
133 | 133 | if ($gateways) { |
@@ -138,9 +138,9 @@ discard block |
||
138 | 138 | } |
139 | 139 | $test_gateways = implode(', ', $name); |
140 | 140 | } |
141 | - if(isset($test_gateways) && !empty($test_gateways)){ |
|
141 | + if (isset($test_gateways) && !empty($test_gateways)) { |
|
142 | 142 | $link = admin_url('admin.php?page=wpinv-settings&tab=gateways'); |
143 | - $notice = wp_sprintf( __('<strong>Important:</strong> Payment Gateway(s) %s are in testing mode and will not receive real payments. Go to <a href="%s"> Gateway Settings</a>.', 'invoicing'), $test_gateways, $link ); |
|
143 | + $notice = wp_sprintf(__('<strong>Important:</strong> Payment Gateway(s) %s are in testing mode and will not receive real payments. Go to <a href="%s"> Gateway Settings</a>.', 'invoicing'), $test_gateways, $link); |
|
144 | 144 | ?> |
145 | 145 | <div class="notice notice-warning is-dismissible"> |
146 | 146 | <p><?php echo $notice; ?></p> |
@@ -149,16 +149,16 @@ discard block |
||
149 | 149 | } |
150 | 150 | } |
151 | 151 | |
152 | -function wpinv_send_invoice_after_save( $invoice ) { |
|
153 | - if ( empty( $_POST['wpi_save_send'] ) ) { |
|
152 | +function wpinv_send_invoice_after_save($invoice) { |
|
153 | + if (empty($_POST['wpi_save_send'])) { |
|
154 | 154 | return; |
155 | 155 | } |
156 | 156 | |
157 | - if ( !empty( $invoice->ID ) && !empty( $invoice->post_type ) && 'wpi_invoice' == $invoice->post_type ) { |
|
158 | - wpinv_user_invoice_notification( $invoice->ID ); |
|
157 | + if (!empty($invoice->ID) && !empty($invoice->post_type) && 'wpi_invoice' == $invoice->post_type) { |
|
158 | + wpinv_user_invoice_notification($invoice->ID); |
|
159 | 159 | } |
160 | 160 | } |
161 | -add_action( 'wpinv_invoice_metabox_saved', 'wpinv_send_invoice_after_save', 100, 1 ); |
|
161 | +add_action('wpinv_invoice_metabox_saved', 'wpinv_send_invoice_after_save', 100, 1); |
|
162 | 162 | |
163 | 163 | |
164 | 164 | add_action('admin_init', 'admin_init_example_type'); |
@@ -169,7 +169,7 @@ discard block |
||
169 | 169 | function admin_init_example_type() { |
170 | 170 | global $typenow; |
171 | 171 | |
172 | - if ($typenow === 'wpi_invoice' || $typenow === 'wpi_quote' ) { |
|
172 | + if ($typenow === 'wpi_invoice' || $typenow === 'wpi_quote') { |
|
173 | 173 | add_filter('posts_search', 'posts_search_example_type', 10, 2); |
174 | 174 | } |
175 | 175 | } |
@@ -184,9 +184,9 @@ discard block |
||
184 | 184 | global $wpdb; |
185 | 185 | |
186 | 186 | if ($query->is_main_query() && !empty($query->query['s'])) { |
187 | - $conditions_str = "{$wpdb->posts}.post_author IN ( SELECT ID FROM {$wpdb->users} WHERE user_email LIKE '%" . esc_sql( $query->query['s'] ) . "%' )"; |
|
188 | - if ( ! empty( $search ) ) { |
|
189 | - $search = preg_replace( '/^ AND /', '', $search ); |
|
187 | + $conditions_str = "{$wpdb->posts}.post_author IN ( SELECT ID FROM {$wpdb->users} WHERE user_email LIKE '%" . esc_sql($query->query['s']) . "%' )"; |
|
188 | + if (!empty($search)) { |
|
189 | + $search = preg_replace('/^ AND /', '', $search); |
|
190 | 190 | $search = " AND ( {$search} OR ( {$conditions_str} ) )"; |
191 | 191 | } else { |
192 | 192 | $search = " AND ( {$conditions_str} )"; |
@@ -196,9 +196,9 @@ discard block |
||
196 | 196 | return $search; |
197 | 197 | } |
198 | 198 | |
199 | -add_action( 'admin_init', 'wpinv_reset_invoice_count' ); |
|
200 | -function wpinv_reset_invoice_count(){ |
|
201 | - if(isset($_GET['reset_invoice_count']) && 1 == $_GET['reset_invoice_count'] && isset($_GET['_nonce']) && wp_verify_nonce($_GET['_nonce'], 'reset_invoice_count')) { |
|
199 | +add_action('admin_init', 'wpinv_reset_invoice_count'); |
|
200 | +function wpinv_reset_invoice_count() { |
|
201 | + if (isset($_GET['reset_invoice_count']) && 1 == $_GET['reset_invoice_count'] && isset($_GET['_nonce']) && wp_verify_nonce($_GET['_nonce'], 'reset_invoice_count')) { |
|
202 | 202 | wpinv_update_option('invoice_sequence_start', 1); |
203 | 203 | delete_option('wpinv_last_invoice_number'); |
204 | 204 | $url = add_query_arg(array('reset_invoice_done' => 1)); |
@@ -209,8 +209,8 @@ discard block |
||
209 | 209 | } |
210 | 210 | |
211 | 211 | add_action('admin_notices', 'wpinv_invoice_count_reset_message'); |
212 | -function wpinv_invoice_count_reset_message(){ |
|
213 | - if(isset($_GET['reset_invoice_done']) && 1 == $_GET['reset_invoice_done']) { |
|
212 | +function wpinv_invoice_count_reset_message() { |
|
213 | + if (isset($_GET['reset_invoice_done']) && 1 == $_GET['reset_invoice_done']) { |
|
214 | 214 | $notice = __('Invoice number sequence reset successfully.', 'invoicing'); |
215 | 215 | ?> |
216 | 216 | <div class="notice notice-success is-dismissible"> |
@@ -7,7 +7,7 @@ discard block |
||
7 | 7 | * @version 1.0.19 |
8 | 8 | */ |
9 | 9 | |
10 | -defined( 'ABSPATH' ) || exit; |
|
10 | +defined('ABSPATH') || exit; |
|
11 | 11 | |
12 | 12 | ?> |
13 | 13 | |
@@ -18,22 +18,22 @@ discard block |
||
18 | 18 | <?php |
19 | 19 | |
20 | 20 | // Fires when printing the header. |
21 | - do_action( 'getpaid_invoice_header', $invoice ); |
|
21 | + do_action('getpaid_invoice_header', $invoice); |
|
22 | 22 | |
23 | 23 | // Print the opening wrapper. |
24 | 24 | echo '<div class="container bg-white border mt-4 mb-4 p-4 position-relative flex-grow-1">'; |
25 | 25 | |
26 | 26 | // Fires when printing the invoice details. |
27 | - do_action( 'getpaid_invoice_details', $invoice ); |
|
27 | + do_action('getpaid_invoice_details', $invoice); |
|
28 | 28 | |
29 | 29 | // Fires when printing the invoice line items. |
30 | - do_action( 'getpaid_invoice_line_items', $invoice ); |
|
30 | + do_action('getpaid_invoice_line_items', $invoice); |
|
31 | 31 | |
32 | 32 | // Print the closing wrapper. |
33 | 33 | echo '</div>'; |
34 | 34 | |
35 | 35 | // Fires when printing the invoice footer. |
36 | - do_action( 'getpaid_invoice_footer', $invoice ); |
|
36 | + do_action('getpaid_invoice_footer', $invoice); |
|
37 | 37 | |
38 | 38 | ?> |
39 | 39 |
@@ -7,16 +7,16 @@ discard block |
||
7 | 7 | * @version 1.0.19 |
8 | 8 | */ |
9 | 9 | |
10 | -defined( 'ABSPATH' ) || exit; |
|
10 | +defined('ABSPATH') || exit; |
|
11 | 11 | |
12 | 12 | ?> |
13 | 13 | |
14 | 14 | <div class="border-top pt-4 bg-white"> |
15 | 15 | <div class="container pr-0 pl-0"> |
16 | 16 | |
17 | - <?php if ( $term_text = wpinv_get_terms_text() ) : ?> |
|
17 | + <?php if ($term_text = wpinv_get_terms_text()) : ?> |
|
18 | 18 | <div class="terms-text"> |
19 | - <?php echo wpautop( $term_text ); ?> |
|
19 | + <?php echo wpautop($term_text); ?> |
|
20 | 20 | </div> |
21 | 21 | <?php endif; ?> |
22 | 22 | |
@@ -25,7 +25,7 @@ discard block |
||
25 | 25 | </div> |
26 | 26 | |
27 | 27 | <div class="print-only"> |
28 | - <?php _e( 'Page ', 'invoicing' ) ?> {PAGENO}/{nbpg} |
|
28 | + <?php _e('Page ', 'invoicing') ?> {PAGENO}/{nbpg} |
|
29 | 29 | </div> |
30 | 30 | |
31 | 31 | </div> |
@@ -7,18 +7,18 @@ discard block |
||
7 | 7 | * @version 1.0.19 |
8 | 8 | */ |
9 | 9 | |
10 | -defined( 'ABSPATH' ) || exit; |
|
10 | +defined('ABSPATH') || exit; |
|
11 | 11 | |
12 | -$watermark = wpinv_watermark( $invoice->get_id() ) |
|
12 | +$watermark = wpinv_watermark($invoice->get_id()) |
|
13 | 13 | |
14 | 14 | ?> |
15 | 15 | |
16 | - <?php do_action( 'getpaid_before_invoice_details_top', $invoice ); ?> |
|
16 | + <?php do_action('getpaid_before_invoice_details_top', $invoice); ?> |
|
17 | 17 | |
18 | - <?php if ( ! empty( $watermark ) ) : ?> |
|
18 | + <?php if (!empty($watermark)) : ?> |
|
19 | 19 | |
20 | 20 | <div class="getpaid-watermark no-print"> |
21 | - <p><?php echo sanitize_text_field( $watermark ) ?></p> |
|
21 | + <p><?php echo sanitize_text_field($watermark) ?></p> |
|
22 | 22 | </div> |
23 | 23 | |
24 | 24 | <?php endif; ?> |
@@ -26,15 +26,15 @@ discard block |
||
26 | 26 | <div class="getpaid-invoice-details-top mt-3 mb-3"> |
27 | 27 | <div class="row"> |
28 | 28 | <div class="col-12 col-sm-6 text-left"> |
29 | - <?php do_action( 'getpaid_invoice_details_top_left', $invoice ); ?> |
|
29 | + <?php do_action('getpaid_invoice_details_top_left', $invoice); ?> |
|
30 | 30 | </div> |
31 | 31 | |
32 | 32 | <div class="col-12 col-sm-6 text-right"> |
33 | - <?php do_action( 'getpaid_invoice_details_top_right', $invoice ); ?> |
|
33 | + <?php do_action('getpaid_invoice_details_top_right', $invoice); ?> |
|
34 | 34 | </div> |
35 | 35 | </div> |
36 | 36 | </div> |
37 | 37 | |
38 | - <?php do_action( 'getpaid_after_invoice_details_top', $invoice ); ?> |
|
38 | + <?php do_action('getpaid_after_invoice_details_top', $invoice); ?> |
|
39 | 39 | |
40 | 40 | <?php |
@@ -7,10 +7,10 @@ discard block |
||
7 | 7 | * @version 1.0.19 |
8 | 8 | */ |
9 | 9 | |
10 | -defined( 'ABSPATH' ) || exit; |
|
10 | +defined('ABSPATH') || exit; |
|
11 | 11 | |
12 | -$invoice = new WPInv_Invoice( $invoice ); |
|
13 | -$address_row = wpinv_get_invoice_address_markup( $invoice->get_user_info() ); |
|
12 | +$invoice = new WPInv_Invoice($invoice); |
|
13 | +$address_row = wpinv_get_invoice_address_markup($invoice->get_user_info()); |
|
14 | 14 | $phone = $invoice->get_phone(); |
15 | 15 | $email = $invoice->get_email(); |
16 | 16 | |
@@ -21,36 +21,36 @@ discard block |
||
21 | 21 | |
22 | 22 | |
23 | 23 | <div class="invoice-billing-address-label col-2"> |
24 | - <strong><?php _e( 'To:', 'invoicing' ) ?></strong> |
|
24 | + <strong><?php _e('To:', 'invoicing') ?></strong> |
|
25 | 25 | </div> |
26 | 26 | |
27 | 27 | |
28 | 28 | <div class="invoice-billing-address-value col-10"> |
29 | 29 | |
30 | - <?php do_action( 'getpaid_billing_address_top' ); ?> |
|
30 | + <?php do_action('getpaid_billing_address_top'); ?> |
|
31 | 31 | |
32 | - <?php if ( ! empty( $address_row ) ) : ?> |
|
32 | + <?php if (!empty($address_row)) : ?> |
|
33 | 33 | <div class="billing-address"> |
34 | 34 | <?php echo $address_row; ?> |
35 | 35 | </div> |
36 | 36 | <?php endif; ?> |
37 | 37 | |
38 | 38 | |
39 | - <?php if ( ! empty( $phone ) ) : ?> |
|
39 | + <?php if (!empty($phone)) : ?> |
|
40 | 40 | <div class="billing-phone"> |
41 | - <?php echo wp_sprintf( __( 'Phone: %s', 'invoicing' ), esc_html( $phone ) ); ?> |
|
41 | + <?php echo wp_sprintf(__('Phone: %s', 'invoicing'), esc_html($phone)); ?> |
|
42 | 42 | </div> |
43 | 43 | <?php endif; ?> |
44 | 44 | |
45 | 45 | |
46 | - <?php if ( ! empty( $email ) ) : ?> |
|
46 | + <?php if (!empty($email)) : ?> |
|
47 | 47 | <div class="billing-email"> |
48 | - <?php echo wp_sprintf( __( 'Email: %s', 'invoicing' ), sanitize_email( $email ) ); ?> |
|
48 | + <?php echo wp_sprintf(__('Email: %s', 'invoicing'), sanitize_email($email)); ?> |
|
49 | 49 | </div> |
50 | 50 | <?php endif; ?> |
51 | 51 | |
52 | 52 | |
53 | - <?php do_action( 'getpaid_billing_address_bottom' ); ?> |
|
53 | + <?php do_action('getpaid_billing_address_bottom'); ?> |
|
54 | 54 | |
55 | 55 | </div> |
56 | 56 |