@@ -34,11 +34,11 @@ discard block |
||
34 | 34 | */ |
35 | 35 | function wpinv_get_capability( $capalibilty = 'manage_invoicing' ) { |
36 | 36 | |
37 | - if ( current_user_can( 'manage_options' ) ) { |
|
38 | - return 'manage_options'; |
|
39 | - }; |
|
37 | + if ( current_user_can( 'manage_options' ) ) { |
|
38 | + return 'manage_options'; |
|
39 | + }; |
|
40 | 40 | |
41 | - return $capalibilty; |
|
41 | + return $capalibilty; |
|
42 | 42 | } |
43 | 43 | |
44 | 44 | /** |
@@ -62,10 +62,10 @@ discard block |
||
62 | 62 | // Prepare user values. |
63 | 63 | $prefix = preg_replace( '/\s+/', '', $prefix ); |
64 | 64 | $prefix = empty( $prefix ) ? $email : $prefix; |
65 | - $args = array( |
|
66 | - 'user_login' => wpinv_generate_user_name( $prefix ), |
|
67 | - 'user_pass' => wp_generate_password(), |
|
68 | - 'user_email' => $email, |
|
65 | + $args = array( |
|
66 | + 'user_login' => wpinv_generate_user_name( $prefix ), |
|
67 | + 'user_pass' => wp_generate_password(), |
|
68 | + 'user_email' => $email, |
|
69 | 69 | 'role' => 'subscriber', |
70 | 70 | ); |
71 | 71 | |
@@ -82,15 +82,15 @@ discard block |
||
82 | 82 | function wpinv_generate_user_name( $prefix = '' ) { |
83 | 83 | |
84 | 84 | // If prefix is an email, retrieve the part before the email. |
85 | - $prefix = strtok( $prefix, '@' ); |
|
85 | + $prefix = strtok( $prefix, '@' ); |
|
86 | 86 | |
87 | - // Sanitize the username. |
|
88 | - $prefix = sanitize_user( $prefix, true ); |
|
87 | + // Sanitize the username. |
|
88 | + $prefix = sanitize_user( $prefix, true ); |
|
89 | 89 | |
90 | - $illegal_logins = (array) apply_filters( 'illegal_user_logins', array() ); |
|
91 | - if ( empty( $prefix ) || in_array( strtolower( $prefix ), array_map( 'strtolower', $illegal_logins ), true ) ) { |
|
92 | - $prefix = 'gtp_' . zeroise( wp_rand( 0, 9999 ), 4 ); |
|
93 | - } |
|
90 | + $illegal_logins = (array) apply_filters( 'illegal_user_logins', array() ); |
|
91 | + if ( empty( $prefix ) || in_array( strtolower( $prefix ), array_map( 'strtolower', $illegal_logins ), true ) ) { |
|
92 | + $prefix = 'gtp_' . zeroise( wp_rand( 0, 9999 ), 4 ); |
|
93 | + } |
|
94 | 94 | |
95 | 95 | $username = $prefix; |
96 | 96 | $postfix = 2; |
@@ -6,7 +6,7 @@ discard block |
||
6 | 6 | * @package GetPaid |
7 | 7 | */ |
8 | 8 | |
9 | -defined( 'ABSPATH' ) || exit; |
|
9 | +defined('ABSPATH') || exit; |
|
10 | 10 | |
11 | 11 | /** |
12 | 12 | * Generates a users select dropdown. |
@@ -16,13 +16,13 @@ discard block |
||
16 | 16 | * @param array $args |
17 | 17 | * @see wp_dropdown_users |
18 | 18 | */ |
19 | -function wpinv_dropdown_users( $args = '' ) { |
|
19 | +function wpinv_dropdown_users($args = '') { |
|
20 | 20 | |
21 | - if ( is_array( $args ) && ! empty( $args['show'] ) && 'display_name_with_email' == $args['show'] ) { |
|
21 | + if (is_array($args) && !empty($args['show']) && 'display_name_with_email' == $args['show']) { |
|
22 | 22 | $args['show'] = 'display_name_with_login'; |
23 | 23 | } |
24 | 24 | |
25 | - return wp_dropdown_users( $args ); |
|
25 | + return wp_dropdown_users($args); |
|
26 | 26 | } |
27 | 27 | |
28 | 28 | /** |
@@ -32,9 +32,9 @@ discard block |
||
32 | 32 | * @return string capability to check against |
33 | 33 | * @param string $capalibilty Optional. The alternative capability to check against. |
34 | 34 | */ |
35 | -function wpinv_get_capability( $capalibilty = 'manage_invoicing' ) { |
|
35 | +function wpinv_get_capability($capalibilty = 'manage_invoicing') { |
|
36 | 36 | |
37 | - if ( current_user_can( 'manage_options' ) ) { |
|
37 | + if (current_user_can('manage_options')) { |
|
38 | 38 | return 'manage_options'; |
39 | 39 | }; |
40 | 40 | |
@@ -48,7 +48,7 @@ discard block |
||
48 | 48 | * @return bool |
49 | 49 | */ |
50 | 50 | function wpinv_current_user_can_manage_invoicing() { |
51 | - return current_user_can( wpinv_get_capability() ); |
|
51 | + return current_user_can(wpinv_get_capability()); |
|
52 | 52 | } |
53 | 53 | |
54 | 54 | /** |
@@ -57,19 +57,19 @@ discard block |
||
57 | 57 | * @since 1.0.19 |
58 | 58 | * @return int|WP_Error |
59 | 59 | */ |
60 | -function wpinv_create_user( $email, $prefix = '' ) { |
|
60 | +function wpinv_create_user($email, $prefix = '') { |
|
61 | 61 | |
62 | 62 | // Prepare user values. |
63 | - $prefix = preg_replace( '/\s+/', '', $prefix ); |
|
64 | - $prefix = empty( $prefix ) ? $email : $prefix; |
|
65 | - $args = array( |
|
66 | - 'user_login' => wpinv_generate_user_name( $prefix ), |
|
63 | + $prefix = preg_replace('/\s+/', '', $prefix); |
|
64 | + $prefix = empty($prefix) ? $email : $prefix; |
|
65 | + $args = array( |
|
66 | + 'user_login' => wpinv_generate_user_name($prefix), |
|
67 | 67 | 'user_pass' => wp_generate_password(), |
68 | 68 | 'user_email' => $email, |
69 | 69 | 'role' => 'subscriber', |
70 | 70 | ); |
71 | 71 | |
72 | - return wp_insert_user( $args ); |
|
72 | + return wp_insert_user($args); |
|
73 | 73 | |
74 | 74 | } |
75 | 75 | |
@@ -79,25 +79,25 @@ discard block |
||
79 | 79 | * @since 1.0.19 |
80 | 80 | * @return bool|WP_User |
81 | 81 | */ |
82 | -function wpinv_generate_user_name( $prefix = '' ) { |
|
82 | +function wpinv_generate_user_name($prefix = '') { |
|
83 | 83 | |
84 | 84 | // If prefix is an email, retrieve the part before the email. |
85 | - $prefix = strtok( $prefix, '@' ); |
|
85 | + $prefix = strtok($prefix, '@'); |
|
86 | 86 | |
87 | 87 | // Sanitize the username. |
88 | - $prefix = sanitize_user( $prefix, true ); |
|
88 | + $prefix = sanitize_user($prefix, true); |
|
89 | 89 | |
90 | - $illegal_logins = (array) apply_filters( 'illegal_user_logins', array() ); |
|
91 | - if ( empty( $prefix ) || in_array( strtolower( $prefix ), array_map( 'strtolower', $illegal_logins ), true ) ) { |
|
92 | - $prefix = 'gtp_' . zeroise( wp_rand( 0, 9999 ), 4 ); |
|
90 | + $illegal_logins = (array) apply_filters('illegal_user_logins', array()); |
|
91 | + if (empty($prefix) || in_array(strtolower($prefix), array_map('strtolower', $illegal_logins), true)) { |
|
92 | + $prefix = 'gtp_' . zeroise(wp_rand(0, 9999), 4); |
|
93 | 93 | } |
94 | 94 | |
95 | 95 | $username = $prefix; |
96 | 96 | $postfix = 2; |
97 | 97 | |
98 | - while ( username_exists( $username ) ) { |
|
98 | + while (username_exists($username)) { |
|
99 | 99 | $username = $prefix + $postfix; |
100 | - $postfix ++; |
|
100 | + $postfix++; |
|
101 | 101 | } |
102 | 102 | |
103 | 103 | return $username; |
@@ -114,26 +114,26 @@ discard block |
||
114 | 114 | $tabs = array( |
115 | 115 | |
116 | 116 | 'gp-edit-address' => array( |
117 | - 'label' => __( 'Billing Address', 'invoicing' ), |
|
117 | + 'label' => __('Billing Address', 'invoicing'), |
|
118 | 118 | 'callback' => 'getpaid_display_address_edit_tab', |
119 | 119 | 'icon' => 'fas fa-credit-card', |
120 | 120 | ), |
121 | 121 | |
122 | 122 | 'gp-invoices' => array( |
123 | - 'label' => __( 'Invoices', 'invoicing' ), // Name of the tab. |
|
123 | + 'label' => __('Invoices', 'invoicing'), // Name of the tab. |
|
124 | 124 | 'content' => '[wpinv_history]', // Content of the tab. Or specify "callback" to provide a callback instead. |
125 | 125 | 'icon' => 'fas fa-file-invoice', // Shown on some profile plugins. |
126 | 126 | ), |
127 | 127 | |
128 | 128 | 'gp-subscriptions' => array( |
129 | - 'label' => __( 'Subscriptions', 'invoicing' ), |
|
129 | + 'label' => __('Subscriptions', 'invoicing'), |
|
130 | 130 | 'content' => '[wpinv_subscriptions]', |
131 | 131 | 'icon' => 'fas fa-redo', |
132 | 132 | ), |
133 | 133 | |
134 | 134 | ); |
135 | 135 | |
136 | - return apply_filters( 'getpaid_user_content_tabs', $tabs ); |
|
136 | + return apply_filters('getpaid_user_content_tabs', $tabs); |
|
137 | 137 | } |
138 | 138 | |
139 | 139 | /** |
@@ -143,19 +143,19 @@ discard block |
||
143 | 143 | * @param array $tab |
144 | 144 | * @return array |
145 | 145 | */ |
146 | -function getpaid_prepare_user_content_tab( $tab ) { |
|
146 | +function getpaid_prepare_user_content_tab($tab) { |
|
147 | 147 | |
148 | - if ( ! empty( $tab['callback'] ) ) { |
|
149 | - return call_user_func( $tab['callback'] ); |
|
148 | + if (!empty($tab['callback'])) { |
|
149 | + return call_user_func($tab['callback']); |
|
150 | 150 | } |
151 | 151 | |
152 | - if ( ! empty( $tab['content'] ) ) { |
|
153 | - return convert_smilies( capital_P_dangit( wp_filter_content_tags( do_shortcode( shortcode_unautop( wpautop( wptexturize( do_blocks( $tab['content'] ) ) ) ) ) ) ) ); |
|
152 | + if (!empty($tab['content'])) { |
|
153 | + return convert_smilies(capital_P_dangit(wp_filter_content_tags(do_shortcode(shortcode_unautop(wpautop(wptexturize(do_blocks($tab['content'])))))))); |
|
154 | 154 | } |
155 | 155 | |
156 | 156 | $notice = aui()->alert( |
157 | 157 | array( |
158 | - 'content' => __( 'This tab has no content or content callback.', 'invoicing' ), |
|
158 | + 'content' => __('This tab has no content or content callback.', 'invoicing'), |
|
159 | 159 | 'type' => 'error', |
160 | 160 | ) |
161 | 161 | ); |
@@ -171,14 +171,14 @@ discard block |
||
171 | 171 | * @param string $default |
172 | 172 | * @return array |
173 | 173 | */ |
174 | -function getpaid_get_tab_url( $tab, $default ) { |
|
174 | +function getpaid_get_tab_url($tab, $default) { |
|
175 | 175 | global $getpaid_tab_url; |
176 | 176 | |
177 | - if ( empty( $getpaid_tab_url ) ) { |
|
177 | + if (empty($getpaid_tab_url)) { |
|
178 | 178 | return $default; |
179 | 179 | } |
180 | 180 | |
181 | - return sprintf( $getpaid_tab_url, $tab ); |
|
181 | + return sprintf($getpaid_tab_url, $tab); |
|
182 | 182 | |
183 | 183 | } |
184 | 184 | |
@@ -198,19 +198,19 @@ discard block |
||
198 | 198 | |
199 | 199 | <?php |
200 | 200 | |
201 | - foreach ( getpaid_user_address_fields() as $key => $label ) { |
|
201 | + foreach (getpaid_user_address_fields() as $key => $label) { |
|
202 | 202 | |
203 | 203 | // Display the country. |
204 | - if ( 'country' == $key ) { |
|
204 | + if ('country' == $key) { |
|
205 | 205 | |
206 | 206 | echo aui()->select( |
207 | 207 | array( |
208 | 208 | 'options' => wpinv_get_country_list(), |
209 | - 'name' => esc_attr( $key ), |
|
210 | - 'id' => 'wpinv-' . sanitize_html_class( $key ), |
|
211 | - 'value' => sanitize_text_field( getpaid_get_user_address_field( get_current_user_id(), $key ) ), |
|
209 | + 'name' => esc_attr($key), |
|
210 | + 'id' => 'wpinv-' . sanitize_html_class($key), |
|
211 | + 'value' => sanitize_text_field(getpaid_get_user_address_field(get_current_user_id(), $key)), |
|
212 | 212 | 'placeholder' => $label, |
213 | - 'label' => wp_kses_post( $label ), |
|
213 | + 'label' => wp_kses_post($label), |
|
214 | 214 | 'label_type' => 'vertical', |
215 | 215 | 'class' => 'getpaid-address-field', |
216 | 216 | ) |
@@ -219,11 +219,11 @@ discard block |
||
219 | 219 | } |
220 | 220 | |
221 | 221 | // Display the state. |
222 | - else if ( 'state' == $key ) { |
|
222 | + else if ('state' == $key) { |
|
223 | 223 | |
224 | - echo getpaid_get_states_select_markup ( |
|
225 | - getpaid_get_user_address_field( get_current_user_id(), 'country' ), |
|
226 | - getpaid_get_user_address_field( get_current_user_id(), 'state' ), |
|
224 | + echo getpaid_get_states_select_markup( |
|
225 | + getpaid_get_user_address_field(get_current_user_id(), 'country'), |
|
226 | + getpaid_get_user_address_field(get_current_user_id(), 'state'), |
|
227 | 227 | $label, |
228 | 228 | $label, |
229 | 229 | '', |
@@ -236,13 +236,13 @@ discard block |
||
236 | 236 | |
237 | 237 | echo aui()->input( |
238 | 238 | array( |
239 | - 'name' => esc_attr( $key ), |
|
240 | - 'id' => 'wpinv-' . sanitize_html_class( $key ), |
|
239 | + 'name' => esc_attr($key), |
|
240 | + 'id' => 'wpinv-' . sanitize_html_class($key), |
|
241 | 241 | 'placeholder' => $label, |
242 | - 'label' => wp_kses_post( $label ), |
|
242 | + 'label' => wp_kses_post($label), |
|
243 | 243 | 'label_type' => 'vertical', |
244 | 244 | 'type' => 'text', |
245 | - 'value' => sanitize_text_field( getpaid_get_user_address_field( get_current_user_id(), $key ) ), |
|
245 | + 'value' => sanitize_text_field(getpaid_get_user_address_field(get_current_user_id(), $key)), |
|
246 | 246 | 'class' => 'getpaid-address-field', |
247 | 247 | ) |
248 | 248 | ); |
@@ -251,21 +251,21 @@ discard block |
||
251 | 251 | |
252 | 252 | } |
253 | 253 | |
254 | - do_action( 'getpaid_display_address_edit_tab' ); |
|
254 | + do_action('getpaid_display_address_edit_tab'); |
|
255 | 255 | |
256 | 256 | echo aui()->input( |
257 | 257 | array( |
258 | 258 | 'name' => 'getpaid_profile_edit_submit_button', |
259 | 259 | 'id' => 'getpaid_profile_edit_submit_button', |
260 | - 'value' => __( 'Save Address', 'invoicing' ), |
|
261 | - 'help_text' => __( 'New invoices will use this address as the billing address.', 'invoicing' ), |
|
260 | + 'value' => __('Save Address', 'invoicing'), |
|
261 | + 'help_text' => __('New invoices will use this address as the billing address.', 'invoicing'), |
|
262 | 262 | 'type' => 'submit', |
263 | 263 | 'class' => 'btn btn-primary btn-block submit-button', |
264 | 264 | ) |
265 | 265 | ); |
266 | 266 | |
267 | - wp_nonce_field( 'getpaid-nonce', 'getpaid-nonce' ); |
|
268 | - getpaid_hidden_field( 'getpaid-action', 'edit_billing_details' ); |
|
267 | + wp_nonce_field('getpaid-nonce', 'getpaid-nonce'); |
|
268 | + getpaid_hidden_field('getpaid-action', 'edit_billing_details'); |
|
269 | 269 | ?> |
270 | 270 | |
271 | 271 | </form> |
@@ -282,20 +282,20 @@ discard block |
||
282 | 282 | * @since 2.1.4 |
283 | 283 | * @param array $data |
284 | 284 | */ |
285 | -function getpaid_save_address_edit_tab( $data ) { |
|
285 | +function getpaid_save_address_edit_tab($data) { |
|
286 | 286 | |
287 | - foreach ( array_keys( getpaid_user_address_fields() ) as $field ) { |
|
287 | + foreach (array_keys(getpaid_user_address_fields()) as $field) { |
|
288 | 288 | |
289 | - if ( isset( $data[ $field ] ) ) { |
|
290 | - $value = sanitize_text_field( $data[ $field ] ); |
|
291 | - update_user_meta( get_current_user_id(), '_wpinv_' . $field, $value ); |
|
289 | + if (isset($data[$field])) { |
|
290 | + $value = sanitize_text_field($data[$field]); |
|
291 | + update_user_meta(get_current_user_id(), '_wpinv_' . $field, $value); |
|
292 | 292 | } |
293 | 293 | |
294 | - wpinv_set_error( 'address_updated', __( 'You billing address has been updated', 'invoicing' ), 'success'); |
|
294 | + wpinv_set_error('address_updated', __('You billing address has been updated', 'invoicing'), 'success'); |
|
295 | 295 | } |
296 | 296 | |
297 | 297 | } |
298 | -add_action( 'getpaid_authenticated_action_edit_billing_details', 'getpaid_save_address_edit_tab' ); |
|
298 | +add_action('getpaid_authenticated_action_edit_billing_details', 'getpaid_save_address_edit_tab'); |
|
299 | 299 | |
300 | 300 | |
301 | 301 | /* |
@@ -313,27 +313,27 @@ discard block |
||
313 | 313 | * @param array $tabs |
314 | 314 | * @return array |
315 | 315 | */ |
316 | -function getpaid_filter_userswp_account_tabs( $tabs ) { |
|
316 | +function getpaid_filter_userswp_account_tabs($tabs) { |
|
317 | 317 | |
318 | 318 | // Abort if the integration is inactive. |
319 | - if ( ! getpaid_is_userswp_integration_active() ) { |
|
319 | + if (!getpaid_is_userswp_integration_active()) { |
|
320 | 320 | return $tabs; |
321 | 321 | } |
322 | 322 | |
323 | - $new_tabs = array(); |
|
323 | + $new_tabs = array(); |
|
324 | 324 | |
325 | - foreach ( getpaid_get_user_content_tabs() as $slug => $tab ) { |
|
325 | + foreach (getpaid_get_user_content_tabs() as $slug => $tab) { |
|
326 | 326 | |
327 | - $new_tabs[ $slug ] = array( |
|
328 | - 'title' => $tab[ 'label'], |
|
329 | - 'icon' => $tab[ 'icon'], |
|
327 | + $new_tabs[$slug] = array( |
|
328 | + 'title' => $tab['label'], |
|
329 | + 'icon' => $tab['icon'], |
|
330 | 330 | ); |
331 | 331 | |
332 | 332 | } |
333 | 333 | |
334 | - return array_merge( $tabs, $new_tabs ); |
|
334 | + return array_merge($tabs, $new_tabs); |
|
335 | 335 | } |
336 | -add_filter( 'uwp_account_available_tabs', 'getpaid_filter_userswp_account_tabs' ); |
|
336 | +add_filter('uwp_account_available_tabs', 'getpaid_filter_userswp_account_tabs'); |
|
337 | 337 | |
338 | 338 | /** |
339 | 339 | * Display our UsersWP account tabs. |
@@ -342,18 +342,18 @@ discard block |
||
342 | 342 | * @param array $tabs |
343 | 343 | * @return array |
344 | 344 | */ |
345 | -function getpaid_display_userswp_account_tabs( $tab ) { |
|
345 | +function getpaid_display_userswp_account_tabs($tab) { |
|
346 | 346 | global $getpaid_tab_url; |
347 | 347 | |
348 | 348 | $our_tabs = getpaid_get_user_content_tabs(); |
349 | 349 | |
350 | - if ( getpaid_is_userswp_integration_active() && isset( $our_tabs[ $tab ] ) ) { |
|
351 | - $getpaid_tab_url = add_query_arg( 'type', '%s', uwp_get_account_page_url() ); |
|
352 | - echo getpaid_prepare_user_content_tab( $our_tabs[ $tab ] ); |
|
350 | + if (getpaid_is_userswp_integration_active() && isset($our_tabs[$tab])) { |
|
351 | + $getpaid_tab_url = add_query_arg('type', '%s', uwp_get_account_page_url()); |
|
352 | + echo getpaid_prepare_user_content_tab($our_tabs[$tab]); |
|
353 | 353 | } |
354 | 354 | |
355 | 355 | } |
356 | -add_action( 'uwp_account_form_display', 'getpaid_display_userswp_account_tabs' ); |
|
356 | +add_action('uwp_account_form_display', 'getpaid_display_userswp_account_tabs'); |
|
357 | 357 | |
358 | 358 | |
359 | 359 | /** |
@@ -364,17 +364,17 @@ discard block |
||
364 | 364 | * @param string $tab Current tab. |
365 | 365 | * @return string Title. |
366 | 366 | */ |
367 | -function getpaid_filter_userswp_account_title( $title, $tab ) { |
|
367 | +function getpaid_filter_userswp_account_title($title, $tab) { |
|
368 | 368 | |
369 | - $our_tabs = getpaid_get_user_content_tabs(); |
|
369 | + $our_tabs = getpaid_get_user_content_tabs(); |
|
370 | 370 | |
371 | - if ( getpaid_is_userswp_integration_active() && isset( $our_tabs[ $tab ] ) ) { |
|
372 | - return $our_tabs[ $tab ]['label']; |
|
371 | + if (getpaid_is_userswp_integration_active() && isset($our_tabs[$tab])) { |
|
372 | + return $our_tabs[$tab]['label']; |
|
373 | 373 | } |
374 | 374 | |
375 | 375 | return $title; |
376 | 376 | } |
377 | -add_filter( 'uwp_account_page_title', 'getpaid_filter_userswp_account_title', 10, 2 ); |
|
377 | +add_filter('uwp_account_page_title', 'getpaid_filter_userswp_account_title', 10, 2); |
|
378 | 378 | |
379 | 379 | /** |
380 | 380 | * Registers the UsersWP integration settings. |
@@ -383,26 +383,26 @@ discard block |
||
383 | 383 | * @param array $settings An array of integration settings. |
384 | 384 | * @return array |
385 | 385 | */ |
386 | -function getpaid_register_userswp_settings( $settings ) { |
|
386 | +function getpaid_register_userswp_settings($settings) { |
|
387 | 387 | |
388 | - if ( defined( 'USERSWP_PLUGIN_FILE' ) ) { |
|
388 | + if (defined('USERSWP_PLUGIN_FILE')) { |
|
389 | 389 | |
390 | 390 | $settings[] = array( |
391 | 391 | |
392 | 392 | 'id' => 'userswp', |
393 | - 'label' => __( 'UsersWP', 'invoicing' ), |
|
393 | + 'label' => __('UsersWP', 'invoicing'), |
|
394 | 394 | 'settings' => array( |
395 | 395 | |
396 | 396 | 'userswp_settings' => array( |
397 | 397 | 'id' => 'userswp_settings', |
398 | - 'name' => '<h3>' . __( 'UsersWP', 'invoicing' ) . '</h3>', |
|
398 | + 'name' => '<h3>' . __('UsersWP', 'invoicing') . '</h3>', |
|
399 | 399 | 'type' => 'header', |
400 | 400 | ), |
401 | 401 | |
402 | 402 | 'enable_userswp' => array( |
403 | 403 | 'id' => 'enable_userswp', |
404 | - 'name' => __( 'Enable Integration', 'invoicing' ), |
|
405 | - 'desc' => __( 'Display GetPaid items on UsersWP account page.', 'invoicing' ), |
|
404 | + 'name' => __('Enable Integration', 'invoicing'), |
|
405 | + 'desc' => __('Display GetPaid items on UsersWP account page.', 'invoicing'), |
|
406 | 406 | 'type' => 'checkbox', |
407 | 407 | 'std' => 1, |
408 | 408 | ) |
@@ -415,7 +415,7 @@ discard block |
||
415 | 415 | |
416 | 416 | return $settings; |
417 | 417 | } |
418 | -add_filter( 'getpaid_integration_settings', 'getpaid_register_userswp_settings' ); |
|
418 | +add_filter('getpaid_integration_settings', 'getpaid_register_userswp_settings'); |
|
419 | 419 | |
420 | 420 | /** |
421 | 421 | * Checks if the integration is enabled. |
@@ -424,6 +424,6 @@ discard block |
||
424 | 424 | * @return bool |
425 | 425 | */ |
426 | 426 | function getpaid_is_userswp_integration_active() { |
427 | - $enabled = wpinv_get_option( 'enable_userswp', 1 ); |
|
428 | - return defined( 'USERSWP_PLUGIN_FILE' ) && ! empty( $enabled ); |
|
427 | + $enabled = wpinv_get_option('enable_userswp', 1); |
|
428 | + return defined('USERSWP_PLUGIN_FILE') && !empty($enabled); |
|
429 | 429 | } |