@@ -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 | /** |
@@ -61,9 +61,9 @@ discard block |
||
61 | 61 | * @return bool Whether the current user has the given capability. |
62 | 62 | */ |
63 | 63 | function wpinv_current_user_can( $capability, $args = array() ) { |
64 | - $can = wpinv_current_user_can_manage_invoicing(); |
|
64 | + $can = wpinv_current_user_can_manage_invoicing(); |
|
65 | 65 | |
66 | - return apply_filters( 'getpaid_current_user_can', $can, $capability, $args ); |
|
66 | + return apply_filters( 'getpaid_current_user_can', $can, $capability, $args ); |
|
67 | 67 | } |
68 | 68 | |
69 | 69 | /** |
@@ -77,10 +77,10 @@ discard block |
||
77 | 77 | // Prepare user values. |
78 | 78 | $prefix = preg_replace( '/\s+/', '', $prefix ); |
79 | 79 | $prefix = empty( $prefix ) ? $email : $prefix; |
80 | - $args = array( |
|
81 | - 'user_login' => wpinv_generate_user_name( $prefix ), |
|
82 | - 'user_pass' => wp_generate_password(), |
|
83 | - 'user_email' => $email, |
|
80 | + $args = array( |
|
81 | + 'user_login' => wpinv_generate_user_name( $prefix ), |
|
82 | + 'user_pass' => wp_generate_password(), |
|
83 | + 'user_email' => $email, |
|
84 | 84 | 'role' => 'subscriber', |
85 | 85 | ); |
86 | 86 | |
@@ -97,16 +97,16 @@ discard block |
||
97 | 97 | function wpinv_generate_user_name( $prefix = '' ) { |
98 | 98 | |
99 | 99 | // If prefix is an email, retrieve the part before the email. |
100 | - $prefix = strtok( $prefix, '@' ); |
|
100 | + $prefix = strtok( $prefix, '@' ); |
|
101 | 101 | $prefix = trim( $prefix, '.' ); |
102 | 102 | |
103 | - // Sanitize the username. |
|
104 | - $prefix = sanitize_user( $prefix, true ); |
|
103 | + // Sanitize the username. |
|
104 | + $prefix = sanitize_user( $prefix, true ); |
|
105 | 105 | |
106 | - $illegal_logins = (array) apply_filters( 'illegal_user_logins', array() ); |
|
107 | - if ( empty( $prefix ) || in_array( strtolower( $prefix ), array_map( 'strtolower', $illegal_logins ), true ) ) { |
|
108 | - $prefix = 'gtp_' . zeroise( wp_rand( 0, 9999 ), 4 ); |
|
109 | - } |
|
106 | + $illegal_logins = (array) apply_filters( 'illegal_user_logins', array() ); |
|
107 | + if ( empty( $prefix ) || in_array( strtolower( $prefix ), array_map( 'strtolower', $illegal_logins ), true ) ) { |
|
108 | + $prefix = 'gtp_' . zeroise( wp_rand( 0, 9999 ), 4 ); |
|
109 | + } |
|
110 | 110 | |
111 | 111 | $username = $prefix; |
112 | 112 | $postfix = 2; |
@@ -235,43 +235,43 @@ discard block |
||
235 | 235 | |
236 | 236 | foreach ( getpaid_user_address_fields() as $key => $label ) { |
237 | 237 | |
238 | - // Display the country. |
|
239 | - if ( 'country' == $key ) { |
|
240 | - |
|
241 | - aui()->select( |
|
242 | - array( |
|
243 | - 'options' => wpinv_get_country_list(), |
|
244 | - 'name' => 'getpaid_address[' . esc_attr( $key ) . ']', |
|
245 | - 'id' => 'wpinv-' . sanitize_html_class( $key ), |
|
246 | - 'value' => sanitize_text_field( getpaid_get_user_address_field( get_current_user_id(), $key ) ), |
|
247 | - 'placeholder' => $label, |
|
248 | - 'label' => wp_kses_post( $label ), |
|
249 | - 'label_type' => 'vertical', |
|
250 | - 'class' => 'getpaid-address-field', |
|
238 | + // Display the country. |
|
239 | + if ( 'country' == $key ) { |
|
240 | + |
|
241 | + aui()->select( |
|
242 | + array( |
|
243 | + 'options' => wpinv_get_country_list(), |
|
244 | + 'name' => 'getpaid_address[' . esc_attr( $key ) . ']', |
|
245 | + 'id' => 'wpinv-' . sanitize_html_class( $key ), |
|
246 | + 'value' => sanitize_text_field( getpaid_get_user_address_field( get_current_user_id(), $key ) ), |
|
247 | + 'placeholder' => $label, |
|
248 | + 'label' => wp_kses_post( $label ), |
|
249 | + 'label_type' => 'vertical', |
|
250 | + 'class' => 'getpaid-address-field', |
|
251 | 251 | ), |
252 | 252 | true |
253 | - ); |
|
254 | - |
|
255 | - } |
|
256 | - |
|
257 | - // Display the state. |
|
258 | - elseif ( 'state' == $key ) { |
|
259 | - |
|
260 | - getpaid_get_states_select_markup( |
|
261 | - getpaid_get_user_address_field( get_current_user_id(), 'country' ), |
|
262 | - getpaid_get_user_address_field( get_current_user_id(), 'state' ), |
|
263 | - $label, |
|
264 | - $label, |
|
265 | - '', |
|
266 | - false, |
|
267 | - '', |
|
268 | - 'getpaid_address[' . esc_attr( $key ) . ']', |
|
253 | + ); |
|
254 | + |
|
255 | + } |
|
256 | + |
|
257 | + // Display the state. |
|
258 | + elseif ( 'state' == $key ) { |
|
259 | + |
|
260 | + getpaid_get_states_select_markup( |
|
261 | + getpaid_get_user_address_field( get_current_user_id(), 'country' ), |
|
262 | + getpaid_get_user_address_field( get_current_user_id(), 'state' ), |
|
263 | + $label, |
|
264 | + $label, |
|
265 | + '', |
|
266 | + false, |
|
267 | + '', |
|
268 | + 'getpaid_address[' . esc_attr( $key ) . ']', |
|
269 | 269 | true |
270 | - ); |
|
270 | + ); |
|
271 | 271 | |
272 | 272 | } else { |
273 | 273 | |
274 | - aui()->input( |
|
274 | + aui()->input( |
|
275 | 275 | array( |
276 | 276 | 'name' => 'getpaid_address[' . esc_attr( $key ) . ']', |
277 | 277 | 'id' => 'wpinv-' . sanitize_html_class( $key ), |
@@ -283,7 +283,7 @@ discard block |
||
283 | 283 | 'class' => 'getpaid-address-field', |
284 | 284 | ), |
285 | 285 | true |
286 | - ); |
|
286 | + ); |
|
287 | 287 | |
288 | 288 | } |
289 | 289 | } |
@@ -422,7 +422,7 @@ discard block |
||
422 | 422 | function getpaid_allowed_html() { |
423 | 423 | $allowed_html = wp_kses_allowed_html( 'post' ); |
424 | 424 | |
425 | - // form fields |
|
425 | + // form fields |
|
426 | 426 | $allowed_html['form'] = array( |
427 | 427 | 'action' => true, |
428 | 428 | 'accept' => true, |
@@ -434,12 +434,12 @@ discard block |
||
434 | 434 | ); |
435 | 435 | |
436 | 436 | // - input |
437 | - $allowed_html['input'] = array( |
|
438 | - 'class' => array(), |
|
439 | - 'id' => array(), |
|
440 | - 'name' => array(), |
|
441 | - 'value' => array(), |
|
442 | - 'type' => array(), |
|
437 | + $allowed_html['input'] = array( |
|
438 | + 'class' => array(), |
|
439 | + 'id' => array(), |
|
440 | + 'name' => array(), |
|
441 | + 'value' => array(), |
|
442 | + 'type' => array(), |
|
443 | 443 | 'placeholder' => array(), |
444 | 444 | 'autocomplete' => array(), |
445 | 445 | 'autofocus' => array(), |
@@ -453,33 +453,33 @@ discard block |
||
453 | 453 | 'max' => array(), |
454 | 454 | 'step' => array(), |
455 | 455 | 'size' => array(), |
456 | - ); |
|
456 | + ); |
|
457 | 457 | |
458 | 458 | // - input |
459 | - $allowed_html['textarea'] = array( |
|
460 | - 'class' => array(), |
|
461 | - 'id' => array(), |
|
462 | - 'name' => array(), |
|
463 | - 'value' => array(), |
|
464 | - ); |
|
465 | - |
|
466 | - // select |
|
467 | - $allowed_html['select'] = array( |
|
468 | - 'class' => array(), |
|
469 | - 'id' => array(), |
|
470 | - 'name' => array(), |
|
459 | + $allowed_html['textarea'] = array( |
|
460 | + 'class' => array(), |
|
461 | + 'id' => array(), |
|
462 | + 'name' => array(), |
|
463 | + 'value' => array(), |
|
464 | + ); |
|
465 | + |
|
466 | + // select |
|
467 | + $allowed_html['select'] = array( |
|
468 | + 'class' => array(), |
|
469 | + 'id' => array(), |
|
470 | + 'name' => array(), |
|
471 | 471 | 'autocomplete' => array(), |
472 | 472 | 'multiple' => array(), |
473 | - ); |
|
473 | + ); |
|
474 | 474 | |
475 | - // select options |
|
476 | - $allowed_html['option'] = array( |
|
477 | - 'selected' => array(), |
|
475 | + // select options |
|
476 | + $allowed_html['option'] = array( |
|
477 | + 'selected' => array(), |
|
478 | 478 | 'disabled' => array(), |
479 | 479 | 'value' => array(), |
480 | - ); |
|
480 | + ); |
|
481 | 481 | |
482 | - return $allowed_html; |
|
482 | + return $allowed_html; |
|
483 | 483 | |
484 | 484 | } |
485 | 485 |