PluginProbe
UsersWP – Front-end login form, User Registration, User Profile & Members Directory plugin for WP / 1.2.11
UsersWP – Front-end login form, User Registration, User Profile & Members Directory plugin for WP v1.2.11
1.2.74 1.2.73 1.2.72 1.2.71 1.2.70 1.2.69 1.2.68 1.2.67 1.2.66 1.2.65 1.2.64 1.2.63 trunk 1.0.10 1.0.11 1.0.12 1.0.13 1.0.14 1.0.15 1.0.16 1.0.17 1.0.18 1.0.19 1.0.20 1.0.21 All 174 releases
← All changes | includes/class-forms.php +1093 -1391 1.2.651.2.11 View file →
@@ -102,27 +102,26 @@
102 102 $processed = true;
103 103 }
104 104
105 105 if ( $processed ) {
106 +
106 107 if ( is_wp_error( $errors ) ) {
107 - aui()->alert(
108 - array(
109 - 'type' => 'error',
110 - 'content' => wp_kses_post( $errors->get_error_message() )
111 - ),
112 - true
113 - );
114 - } else if ( $redirect ) {
108 + echo aui()->alert( array( // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
109 + 'type' => 'error',
110 + 'class' => 'text-center',
111 + 'content' => wp_kses_post( $errors->get_error_message() )
112 + ) );
113 + } else {
114 + if ( $redirect ) {
115 115 wp_safe_redirect( $redirect );
116 116 exit();
117 - } else {
118 - aui()->alert(
119 - array(
117 + } else {
118 + echo aui()->alert( array( // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
120 119 'type' => 'success',
120 + 'class' => 'text-center',
121 121 'content' => wp_kses_post( $message )
122 - ),
123 - true
124 - );
122 + ) );
123 + }
125 124 }
126 125 }
127 126
128 127 if ( $type ) {
@@ -131,8 +130,9 @@
131 130 $uwp_notices[] = ob_get_contents();
132 131 }
133 132
134 133 ob_end_clean();
134 +
135 135 }
136 136
137 137 /**
138 138 * Processes avatar and banner uploads form submission.
@@ -172,14 +172,14 @@
172 172
173 173 $url = add_query_arg(
174 174 array(
175 175 'uwp_crop' => $result[ 'uwp_' . $type . '_file' ],
176 - 'type' => $type,
176 + 'type' => $type
177 177 ),
178 - $profile_url
179 - );
178 + $profile_url );
180 179
181 180 return $url;
181 +
182 182 }
183 183
184 184 /**
185 185 * Processes avatar and banner uploads image crop.
@@ -195,49 +195,40 @@
195 195 * @since 1.0.0
196 196 */
197 197 public function process_image_crop( $data = array(), $type = 'avatar', $unlink_prev_img = false ) {
198 198 global $wpdb;
199 -
200 199 if ( ! is_user_logged_in() ) {
201 200 return false;
202 201 }
203 202
204 - if ( empty( $_POST['uwp_crop_nonce'] ) || ! wp_verify_nonce( $_POST['uwp_crop_nonce'], 'uwp_crop_nonce_' . $type ) ) {
203 + if ( empty( $_POST['uwp_crop_nonce'] ) || !wp_verify_nonce( $_POST['uwp_crop_nonce'], 'uwp_crop_nonce_'.$type ) ) {
205 204 return;
206 205 }
207 206
208 - $image_url = ! empty( $data['uwp_crop'] ) ? esc_url( $data['uwp_crop'] ) : '';
209 -
210 - if ( empty( $image_url ) ) {
211 - return new WP_Error( 'empty_image', __( 'Upload valid image.', 'userswp' ) );
212 - }
213 -
214 - // Ensure we have a valid URL with an allowed meme type.
215 - $image_url = $this->normalize_url( $image_url );
216 -
217 - $content_url = str_replace( array( 'https://', 'http://' ) , '', untrailingslashit( WP_CONTENT_URL ) );
218 - $_image_url = str_replace( array( 'https://', 'http://' ), '', $image_url );
219 - if ( strpos( $_image_url, $content_url ) !== 0 ) {
220 - return new WP_Error( 'invalid_image', __( 'Invalid image url.', 'userswp' ) );
221 - }
222 -
223 - $filetype = wp_check_filetype( $image_url );
224 -
225 - if ( empty( $filetype['ext'] ) ) {
226 - return new WP_Error( 'invalid_image', __( 'Invalid image type.', 'userswp' ) );
227 - }
228 -
229 207 // If is current user's profile (profile.php)
230 208 if ( is_admin() && defined( 'IS_PROFILE_PAGE' ) && IS_PROFILE_PAGE ) {
231 209 $user_id = get_current_user_id();
232 210 // If is another user's profile page
233 - } elseif ( is_admin() && current_user_can( 'manage_options' ) && ! empty( $_GET['user_id'] ) && is_numeric( $_GET['user_id'] ) ) {
234 - $user_id = absint( $_GET['user_id'] );
211 + } elseif ( is_admin() && current_user_can( 'manage_options' ) && ! empty( $_GET['user_id'] ) && is_numeric( $_GET['user_id'] ) ) {
212 + $user_id = absint($_GET['user_id']);
235 213 // Otherwise something is wrong.
236 214 } else {
237 215 $user_id = get_current_user_id();
238 216 }
239 217
218 + // Ensure we have a valid URL with an allowed meme type.
219 + $image_url = $this->normalize_url( esc_url( $data['uwp_crop'] ) );
220 + $filetype = wp_check_filetype( $image_url );
221 +
222 + $errors = new WP_Error();
223 + if ( empty( $image_url ) || empty( $filetype['ext'] ) ) {
224 + $errors->add( 'something_wrong', __( 'Something went wrong. Please contact site admin.', 'userswp' ) );
225 + }
226 +
227 + if ( $errors->has_errors() ) {
228 + return $errors;
229 + }
230 +
240 231 // Retrieve current thumbnail.
241 232 $current_field = 'avatar' === $type ? 'avatar_thumb' : 'banner_thumb';
242 233 $current_thumbnail = $this->normalize_url( uwp_get_usermeta( $user_id, $current_field, '' ) );
243 234 $thumb_postfix = '_uwp_' . $type . '_thumb';
@@ -246,9 +237,9 @@
246 237 if ( $type == 'avatar' ) {
247 238 $avatar_size = uwp_get_upload_image_size();
248 239 $full_width = $avatar_size['width'];
249 240 } else {
250 - $banner_size = uwp_get_upload_image_size( 'banner' );
241 + $banner_size = uwp_get_upload_image_size('banner');
251 242 $full_width = $banner_size['width'];
252 243 }
253 244
254 245 add_filter( 'upload_dir', 'uwp_handle_multisite_profile_image', 10, 1 );
@@ -260,14 +251,13 @@
260 251 $ext = $filetype['ext']; // to get extension
261 252 $name = sanitize_file_name( pathinfo( $image_path, PATHINFO_FILENAME ) ); //file name without extension
262 253 $thumb_image_name = $name . $thumb_postfix . '.' . $ext;
263 254 $thumb_image_location = str_replace( $name . '.' . $ext, $thumb_image_name, $image_path );
264 -
265 255 //Get the new coordinates to crop the image.
266 - $x = $data['uwpx'];
267 - $y = $data['uwpy'];
268 - $w = $data['uwpw'];
269 - $h = $data['uwph'];
256 + $x = $data["x"];
257 + $y = $data["y"];
258 + $w = $data["w"];
259 + $h = $data["h"];
270 260 //Scale the image based on cropped width setting
271 261 $scale = $full_width / $w;
272 262 //$scale = 1; // no scaling
273 263
@@ -273,12 +263,12 @@
273 263
274 264 // check we are not editing another user file
275 265 $db_value = trailingslashit( $uploads['subdir'] ) . $thumb_image_name;
276 266 $meta_table = get_usermeta_table_prefix() . 'uwp_usermeta';
277 - $file_exists = $wpdb->get_var( $wpdb->prepare( "SELECT user_id FROM {$meta_table} WHERE ( `avatar_thumb` = %s OR `banner_thumb` = %s ) ", $db_value, $db_value ) ); // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching
267 + $file_exists = $wpdb->get_var($wpdb->prepare("SELECT user_id FROM {$meta_table} WHERE ( `avatar_thumb` = %s OR `banner_thumb` = %s ) ", $db_value, $db_value)); // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching
278 268
279 269 // if file already exists then we should not be cropping it.
280 - if ( $file_exists ) {
270 + if( $file_exists ){
281 271 wp_die( esc_html__( 'Something went wrong. Please contact site admin.', 'userswp' ), 403 );
282 272 }
283 273
284 274 $cropped = uwp_resizeThumbnailImage( $thumb_image_location, $image_path, $x, $y, $w, $h, $scale );
@@ -319,8 +309,9 @@
319 309 $redirect_url = uwp_build_profile_tab_url( $user_id );
320 310 }
321 311
322 312 return $redirect_url;
313 +
323 314 }
324 315
325 316 /**
326 317 * Normalizes a URL.
@@ -327,11 +318,8 @@
327 318 *
328 319 */
329 320 public function normalize_url( $url ) {
330 321
331 - if ( empty( $url ) ) {
332 - return '';
333 - }
334 322 // Normalize.
335 323 $url = wp_normalize_path( $url );
336 324
337 325 // Remove query vars.
@@ -360,20 +348,22 @@
360 348 if ( ! is_user_logged_in() ) {
361 349 return false;
362 350 }
363 351
352 + if ( empty( $_POST['uwp_reset_nonce'] ) || !wp_verify_nonce( $_POST['uwp_reset_nonce'], 'uwp_reset_nonce_'.$type ) ) {
353 + return;
354 + }
355 +
364 356 if ( is_admin() && defined( 'IS_PROFILE_PAGE' ) && IS_PROFILE_PAGE ) {
365 357 $user_id = get_current_user_id();
366 - } elseif ( is_admin() && current_user_can( 'manage_options' ) && ! empty( $_GET['user_id'] ) && is_numeric( $_GET['user_id'] ) ) {
367 - $user_id = absint( $_GET['user_id'] );
358 + // If is another user's profile page
359 + } elseif ( is_admin() && ! empty( $_GET['user_id'] ) && is_numeric( $_GET['user_id'] ) ) {
360 + $user_id = absint($_GET['user_id']);
361 + // Otherwise something is wrong.
368 362 } else {
369 363 $user_id = get_current_user_id();
370 364 }
371 365
372 - if ( empty( $_POST['uwp_reset_nonce'] ) || ! wp_verify_nonce( $_POST['uwp_reset_nonce'], 'uwp_reset_nonce_' . $type . '_' . $user_id ) ) {
373 - return;
374 - }
375 -
376 366 $errors = new WP_Error();
377 367 if ( empty( $user_id ) ) {
378 368 $errors->add( 'something_wrong', __( 'Something went wrong. Please try again.', 'userswp' ) );
379 369 }
@@ -416,12 +406,12 @@
416 406 * @since 1.0.0
417 407 */
418 408 public function output_dashboard_links( $options ) {
419 409 if ( ! empty( $options ) ) {
420 - $class = uwp_get_option( 'design_style', 'bootstrap' ) == 'bootstrap' ? 'form-control' : 'aui-select2';
410 + $class = uwp_get_option( "design_style", 'bootstrap' ) == 'bootstrap' ? 'form-control' : 'aui-select2';
421 411 echo '<select class="' . esc_attr( $class ) . '" onchange="window.location = jQuery(this).val();">';
422 412 $this->output_options( $options );
423 - echo '</select>';
413 + echo "</select>";
424 414 }
425 415 }
426 416
427 417 /**
@@ -438,16 +428,18 @@
438 428 foreach ( $options as $key => $link ) {
439 429
440 430 if ( ! isset( $link['text'] ) && isset( $link[0] ) && is_array( $link[0] ) ) {
441 431 $this->output_options( $link );
442 - } elseif ( ! empty( $link['optgroup'] ) && $link['optgroup'] == 'open' ) {
432 + } else {
433 + if ( ! empty( $link['optgroup'] ) && $link['optgroup'] == 'open' ) {
443 434 echo "<optgroup label='" . esc_attr( $link['text'] ) . "'>";
444 435 } elseif ( ! empty( $link['optgroup'] ) && $link['optgroup'] == 'close' ) {
445 - echo '</optgroup>';
436 + echo "</optgroup>";
446 437 } elseif ( ! empty( $link['text'] ) ) {
447 - echo '<option value="' . ( ! empty( $link['url'] ) ? esc_url( $link['url'] ) : '' ) . '"' . selected( ! empty( $link['selected'] ), true, false ) . ( ! empty( $link['disabled'] ) ? ' disabled' : '' ) . '' . ( ! empty( $link['display_none'] ) ? ' style="display:none;"' : '' ) . '>';
448 - echo esc_attr__( $link['text'], 'userswp' );
449 - echo '</option>';
438 + echo '<option value="' . ( ! empty( $link['url'] ) ? esc_url( $link['url'] ) : '' ) . '"' . selected( ! empty( $link['selected'] ), true, false ) . ( ! empty( $link['disabled'] ) ? ' disabled' : '' ) . '' . ( ! empty( $link['display_none'] ) ? ' style="display:none;"' : '' ) . '>';
439 + echo esc_attr__( $link['text'], 'userswp' );
440 + echo "</option>";
441 + }
450 442 }
451 443 }
452 444 }
453 445 }
@@ -474,14 +466,18 @@
474 466 if ( $key == $type ) {
475 467 echo wp_kses_post( $val );
476 468 }
477 469 }
478 - } elseif ( ! empty( $notice ) ) {
470 + } else {
471 + if ( ! empty( $notice ) ) {
479 472 echo wp_kses_post( $notice );
473 + }
480 474 }
481 - }
482 - }
483 475
476 + }
477 +
478 + }
479 +
484 480 if ( $type == 'change' ) {
485 481 $user_id = get_current_user_id();
486 482 $password_nag = get_user_option( 'default_password_nag', $user_id );
487 483
@@ -491,24 +487,20 @@
491 487
492 488 if ( isset( $_GET['uwp_remove_nag'] ) && $_GET['uwp_remove_nag'] == 'yes' ) {
493 489 delete_user_meta( $user_id, 'default_password_nag' );
494 490 $message = sprintf( __( 'We have removed the system generated password warning for you. From this point forward you can continue to access our site as usual. To go to home page, <a href="%s">click here</a>.', 'userswp' ), home_url( '/' ) );
495 - echo aui()->alert(
496 - array( // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
491 + echo aui()->alert( array( // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
497 492 'class' => 'text-center',
498 493 'type' => 'success',
499 - 'content' => wp_kses_post( $message ),
500 - )
501 - );
494 + 'content' => wp_kses_post( $message )
495 + ) );
502 496 } else {
503 497 $message = sprintf( __( '<strong>Warning</strong>: It seems like you are using a system generated password. Please change the password in this page. If this is not a problem for you, you can remove this warning by <a href="%s">clicking here</a>.', 'userswp' ), $remove_nag_url );
504 - echo aui()->alert(
505 - array( // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
498 + echo aui()->alert( array( // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
506 499 'class' => 'text-center',
507 500 'type' => 'warning',
508 - 'content' => wp_kses_post( $message ),
509 - )
510 - );
501 + 'content' => wp_kses_post( $message )
502 + ) );
511 503 }
512 504 }
513 505 }
514 506 }
@@ -533,23 +525,16 @@
533 525 if ( isset( $data['uwp_register_hp'] ) && '' != $data['uwp_register_hp'] ) {
534 526 wp_die( esc_html__( 'No spam please!', 'userswp' ) );
535 527 }
536 528
537 - $form_id = 1;
538 -
539 - if ( ! empty( $data['uwp_register_form_id'] ) ) {
540 - $form_id = (int) $data['uwp_register_form_id'];
541 - }
542 -
543 - if ( ! isset( $data['uwp_register_nonce'] ) || ! wp_verify_nonce( $data['uwp_register_nonce'], 'uwp-register-nonce-' . $form_id ) ) {
544 - $message = aui()->alert(
545 - array(
529 + if ( ! isset( $data['uwp_register_nonce'] ) || ! wp_verify_nonce( $data['uwp_register_nonce'], 'uwp-register-nonce' ) ) {
530 + $message = aui()->alert( array(
546 531 'type' => 'error',
547 - 'content' => __( 'Security verification failed. Try again.', 'userswp' ),
548 - )
532 + 'content' => __( 'Security verification failed. Try again.', 'userswp' )
533 + )
549 534 );
550 535 if ( wp_doing_ajax() ) {
551 - wp_send_json_error( array( 'message' => $message ) );
536 + wp_send_json_error( array( 'message' => $message) );
552 537 } else {
553 538 $uwp_notices[] = array( 'register' => $message );
554 539
555 540 return;
@@ -557,16 +542,15 @@
557 542 }
558 543
559 544 $hash = substr( hash( 'SHA256', AUTH_KEY . site_url() ), 0, 25 );
560 545 if ( empty( $data['uwp_register_hash'] ) || $hash != $data['uwp_register_hash'] ) {
561 - $message = aui()->alert(
562 - array(
546 + $message = aui()->alert( array(
563 547 'type' => 'error',
564 - 'content' => __( 'Security hash failed. Try again.', 'userswp' ),
565 - )
548 + 'content' => __( 'Security hash failed. Try again.', 'userswp' )
549 + )
566 550 );
567 551 if ( wp_doing_ajax() ) {
568 - wp_send_json_error( array( 'message' => $message ) );
552 + wp_send_json_error( array( 'message' => $message) );
569 553 } else {
570 554 $uwp_notices[] = array( 'register' => $message );
571 555
572 556 return;
@@ -573,16 +557,15 @@
573 557 }
574 558 }
575 559
576 560 if ( ! get_option( 'users_can_register' ) ) {
577 - $message = aui()->alert(
578 - array(
561 + $message = aui()->alert( array(
579 562 'type' => 'error',
580 - 'content' => __( 'User registration is currently not allowed. Please check settings of your site.', 'userswp' ),
581 - )
563 + 'content' => __( 'User registration is currently not allowed. Please check settings of your site.', 'userswp' )
564 + )
582 565 );
583 566 if ( wp_doing_ajax() ) {
584 - wp_send_json_error( array( 'message' => $message ) );
567 + wp_send_json_error( array( 'message' => $message) );
585 568 } else {
586 569 $uwp_notices[] = array( 'register' => $message );
587 570
588 571 return;
@@ -599,16 +582,15 @@
599 582
600 583 $result = apply_filters( 'uwp_validate_result', $result, 'register', $data );
601 584
602 585 if ( is_wp_error( $result ) ) {
603 - $message = aui()->alert(
604 - array(
586 + $message = aui()->alert( array(
605 587 'type' => 'error',
606 - 'content' => $result->get_error_message(),
607 - )
588 + 'content' => $result->get_error_message()
589 + )
608 590 );
609 591 if ( wp_doing_ajax() ) {
610 - wp_send_json_error( array( 'message' => $message ) );
592 + wp_send_json_error( array( 'message' => $message) );
611 593 } else {
612 594 $uwp_notices[] = array( 'register' => $message );
613 595
614 596 return;
@@ -617,16 +599,15 @@
617 599
618 600 $uploads_result = $file_obj->validate_uploads( $files, 'register' );
619 601
620 602 if ( is_wp_error( $uploads_result ) ) {
621 - $message = aui()->alert(
622 - array(
603 + $message = aui()->alert( array(
623 604 'type' => 'error',
624 - 'content' => $uploads_result->get_error_message(),
625 - )
605 + 'content' => $uploads_result->get_error_message()
606 + )
626 607 );
627 608 if ( wp_doing_ajax() ) {
628 - wp_send_json_error( array( 'message' => $message ) );
609 + wp_send_json_error( array( 'message' => $message) );
629 610 } else {
630 611 $uwp_notices[] = array( 'register' => $message );
631 612
632 613 return;
@@ -645,14 +626,14 @@
645 626 $this->generated_password = $password;
646 627 $generated_password = true;
647 628 }
648 629
649 - $first_name = '';
630 + $first_name = "";
650 631 if ( isset( $result['first_name'] ) && ! empty( $result['first_name'] ) ) {
651 632 $first_name = $result['first_name'];
652 633 }
653 634
654 - $last_name = '';
635 + $last_name = "";
655 636 if ( isset( $result['last_name'] ) && ! empty( $result['last_name'] ) ) {
656 637 $last_name = $result['last_name'];
657 638 }
658 639
@@ -657,15 +638,17 @@
657 638 }
658 639
659 640 if ( isset( $result['display_name'] ) && ! empty( $result['display_name'] ) ) {
660 641 $display_name = $result['display_name'];
661 - } elseif ( ! empty( $first_name ) || ! empty( $last_name ) ) {
642 + } else {
643 + if ( ! empty( $first_name ) || ! empty( $last_name ) ) {
662 644 $display_name = $first_name . ' ' . $last_name;
663 645 } else {
664 - $display_name = ! empty( $result['username'] ) ? $result['username'] : '';
646 + $display_name = ! empty( $result['username'] ) ? $result['username'] : '';
647 + }
665 648 }
666 649
667 - $user_url = '';
650 + $user_url = "";
668 651 if ( isset( $result['user_url'] ) && ! empty( $result['user_url'] ) ) {
669 652 $user_url = esc_url_raw( $result['user_url'] );
670 653 }
671 654
@@ -687,22 +670,23 @@
687 670 if ( ! ( validate_username( $user_login ) && ! username_exists( $user_login ) ) ) {
688 671 $user_login = $email;
689 672 }
690 673 }
691 - } elseif ( ! validate_username( $user_login ) ) {
692 - $message = aui()->alert(
693 - array(
674 + } else {
675 + if ( ! validate_username( $user_login ) ) {
676 + $message = aui()->alert( array(
694 677 'type' => 'error',
695 - 'content' => __( 'Sorry, that username is not allowed.', 'userswp' ),
696 - )
678 + 'content' => __( 'Sorry, that username is not allowed.', 'userswp' )
679 + )
697 680 );
698 681 if ( wp_doing_ajax() ) {
699 - wp_send_json_error( array( 'message' => $message ) );
682 + wp_send_json_error( array( 'message' => $message) );
700 683 } else {
701 - $uwp_notices[] = array( 'register' => $message );
684 + $uwp_notices[] = array( 'register' => $message );
702 685
703 - return;
686 + return;
704 687 }
688 + }
705 689 }
706 690
707 691 $args = array(
708 692 'user_login' => sanitize_user( $user_login ),
@@ -710,38 +694,21 @@
710 694 'user_pass' => $password,
711 695 'display_name' => sanitize_text_field( $display_name ),
712 696 'first_name' => esc_attr( $first_name ),
713 697 'last_name' => esc_attr( $last_name ),
714 - 'user_url' => esc_url_raw( $user_url ),
698 + 'user_url' => esc_url_raw($user_url),
715 699 );
716 700
717 - // Set user role by form.
718 - $user_role = uwp_get_register_form_by( $form_id, 'user_role' );
719 -
720 - if ( ! empty( $user_role ) ) {
721 - $user_roles = uwp_get_user_roles();
722 - $chosen_role = strtolower( $user_role );
723 -
724 - if ( ! empty( $user_roles ) ) {
725 - $wp_roles = wp_roles();
726 -
727 - if ( $wp_roles->is_role( $chosen_role ) && in_array( $chosen_role, array_keys( $user_roles ) ) ) {
728 - $args['role'] = $chosen_role;
729 - }
730 - }
731 - }
732 -
733 701 $user_id = wp_insert_user( $args );
734 702
735 703 if ( is_wp_error( $user_id ) ) {
736 - $message = aui()->alert(
737 - array(
704 + $message = aui()->alert( array(
738 705 'type' => 'error',
739 - 'content' => $user_id->get_error_message(),
740 - )
706 + 'content' => $user_id->get_error_message()
707 + )
741 708 );
742 709 if ( wp_doing_ajax() ) {
743 - wp_send_json_error( array( 'message' => $message ) );
710 + wp_send_json_error( array( 'message' => $message) );
744 711 } else {
745 712 $uwp_notices[] = array( 'register' => $message );
746 713
747 714 return;
@@ -749,26 +716,43 @@
749 716 }
750 717
751 718 $result = apply_filters( 'uwp_before_extra_fields_save', $result, 'register', $user_id );
752 719
753 - // Save user form id.
754 - if ( ! empty( $data['uwp_register_form_id'] ) ) {
720 + $form_id = 1;
721 +
722 + if ( isset( $data['uwp_register_form_id'] ) && ! empty( $data['uwp_register_form_id'] ) ) {
755 723 update_user_meta( $user_id, '_uwp_register_form_id', (int) $data['uwp_register_form_id'] );
724 + $form_id = (int) $data['uwp_register_form_id'];
756 725 }
757 726
727 + $user_role = uwp_get_register_form_by($form_id, 'user_role');
728 +
729 + if ( isset( $user_role ) && ! empty( $user_role ) ) {
730 + $user_roles = uwp_get_user_roles();
731 + $chosen_role = strtolower( $user_role );
732 + if ( ! empty( $user_roles ) ) {
733 + $wp_roles = wp_roles();
734 + if ( $wp_roles->is_role( $chosen_role ) && in_array( $chosen_role, array_keys( $user_roles ) ) ) {
735 + $new_user = get_userdata( $user_id );
736 + if($new_user){
737 + $new_user->set_role( $chosen_role );
738 + }
739 + }
740 + }
741 + }
742 +
758 743 $save_result = $this->save_user_extra_fields( $user_id, $result, 'register' );
759 744
760 745 $save_result = apply_filters( 'uwp_after_extra_fields_save', $save_result, $result, 'register', $user_id );
761 746
762 747 if ( is_wp_error( $save_result ) ) {
763 - $message = aui()->alert(
764 - array(
748 + $message = aui()->alert( array(
765 749 'type' => 'error',
766 - 'content' => $save_result->get_error_message(),
767 - )
750 + 'content' => $save_result->get_error_message()
751 + )
768 752 );
769 753 if ( wp_doing_ajax() ) {
770 - wp_send_json_error( array( 'message' => $message ) );
754 + wp_send_json_error( array( 'message' => $message) );
771 755 } else {
772 756 $uwp_notices[] = array( 'register' => $message );
773 757
774 758 return;
@@ -775,16 +759,15 @@
775 759 }
776 760 }
777 761
778 762 if ( ! $save_result ) {
779 - $message = aui()->alert(
780 - array(
763 + $message = aui()->alert( array(
781 764 'type' => 'error',
782 - 'content' => __( 'Something went wrong. Please contact site admin.', 'userswp' ),
783 - )
765 + 'content' => __( 'Something went wrong. Please contact site admin.', 'userswp' )
766 + )
784 767 );
785 768 if ( wp_doing_ajax() ) {
786 - wp_send_json_error( array( 'message' => $message ) );
769 + wp_send_json_error( array( 'message' => $message) );
787 770 } else {
788 771 $uwp_notices[] = array( 'register' => $message );
789 772
790 773 return;
@@ -802,21 +785,21 @@
802 785
803 786 do_action( 'uwp_after_custom_fields_save', 'register', $data, $result, $user_id );
804 787
805 788 // Unset post data to empty the form on submit
806 - $excluded_post_data = apply_filters( 'uwp_register_excluded_post_reset_fields', array( 'uwp_register_nonce' ) );
807 - foreach ( $data as $key => $value ) {
808 - if ( isset( $key ) && ! in_array( $key, $excluded_post_data ) ) {
809 - unset( $_POST[ $key ] );
789 + $excluded_post_data = apply_filters('uwp_register_excluded_post_reset_fields', array('uwp_register_nonce'));
790 + foreach($data as $key=>$value){
791 + if(isset($key) && !in_array($key, $excluded_post_data)){
792 + unset($_POST[$key]);
810 793 }
811 794 }
812 795
813 - $reg_action = uwp_get_register_form_by( $form_id, 'reg_action' );
814 - if ( ! $reg_action ) {
796 + $reg_action = uwp_get_register_form_by($form_id, 'reg_action');
797 + if(!$reg_action){
815 798 $reg_action = uwp_get_option( 'uwp_registration_action', false );
816 799 }
817 800
818 - $form_fields = apply_filters( 'uwp_send_mail_form_fields', '', 'register', $user_id );
801 + $form_fields = apply_filters( 'uwp_send_mail_form_fields', "", 'register', $user_id );
819 802
820 803 if ( $reg_action == 'require_email_activation' && ! $generated_password ) {
821 804
822 805 $user_data = get_userdata( $user_id );
@@ -823,9 +806,9 @@
823 806 $activation_link = uwp_get_activation_link( $user_id );
824 807
825 808 $message = __( 'To activate your account, visit the following address:', 'userswp' ) . "\r\n\r\n";
826 809
827 - $message .= "<a href='" . esc_url_raw( $activation_link ) . "' target='_blank'>" . esc_url_raw( $activation_link ) . '</a>' . "\r\n";
810 + $message .= "<a href='" . esc_url_raw( $activation_link ) . "' target='_blank'>" . esc_url_raw( $activation_link ) . "</a>" . "\r\n";
828 811
829 812 $activate_message = '<p><b>' . __( 'Please activate your account :', 'userswp' ) . '</b></p><p>' . $message . '</p>';
830 813
831 814 $activate_message = apply_filters( 'uwp_activation_mail_message', $activate_message, $user_id );
@@ -837,20 +820,22 @@
837 820 );
838 821
839 822 UsersWP_Mails::send( $user_data->user_email, 'registration_activate', $email_vars );
840 823
841 - } elseif ( $reg_action != 'require_admin_review' ) {
824 + } else {
842 825
826 + if ( $reg_action != 'require_admin_review' ) {
827 +
843 828 $user_data = get_userdata( $user_id );
844 829
845 830 if ( isset( $this->generated_password ) && ! empty( $this->generated_password ) ) {
846 - if ( ! uwp_get_option( 'change_disable_password_nag' ) ) {
847 - update_user_meta( $user_id, 'default_password_nag', true ); //Set up the Password change nag.
831 + if ( ! uwp_get_option( 'change_disable_password_nag' ) ) {
832 + update_user_meta( $user_id, 'default_password_nag', true ); //Set up the Password change nag.
848 833 }
849 - $message_pass = $this->generated_password;
850 - $this->generated_password = false;
834 + $message_pass = $this->generated_password;
835 + $this->generated_password = false;
851 836 } else {
852 - $message_pass = __( 'Password you entered during registration.', 'userswp' );
837 + $message_pass = __( "Password you entered during registration.", 'userswp' );
853 838 }
854 839
855 840 $message = '<p><b>' . __( 'Your login Information :', 'userswp' ) . '</b></p>
856 841 <p>' . __( 'Username:', 'userswp' ) . ' ' . $user_data->user_login . '</p>
@@ -864,20 +849,20 @@
864 849 'form_fields' => $form_fields,
865 850 );
866 851
867 852 UsersWP_Mails::send( $user_data->user_email, 'registration_success', $email_vars );
853 + }
868 854 }
869 855
870 856 $error_code = $errors->get_error_code();
871 857 if ( ! empty( $error_code ) ) {
872 - $message = aui()->alert(
873 - array(
858 + $message = aui()->alert( array(
874 859 'type' => 'error',
875 - 'content' => $result->get_error_message(),
876 - )
860 + 'content' => $result->get_error_message()
861 + )
877 862 );
878 863 if ( wp_doing_ajax() ) {
879 - wp_send_json_error( array( 'message' => $message ) );
864 + wp_send_json_error( array( 'message' => $message) );
880 865 } else {
881 866 $uwp_notices[] = array( 'register' => $message );
882 867 return;
883 868 }
@@ -908,22 +893,21 @@
908 893 $res = wp_signon(
909 894 array(
910 895 'user_login' => $user_login,
911 896 'user_password' => $password,
912 - 'remember' => false,
897 + 'remember' => false
913 898 )
914 899 );
915 900
916 901 if ( is_wp_error( $res ) ) {
917 - $message = aui()->alert(
918 - array(
902 + $message = aui()->alert( array(
919 903 'type' => 'error',
920 - 'content' => $res->get_error_message(),
921 - )
904 + 'content' => $res->get_error_message()
905 + )
922 906 );
923 -
907 +
924 908 if ( wp_doing_ajax() ) {
925 - wp_send_json_error( array( 'message' => $message ) );
909 + wp_send_json_error( array( 'message' => $message) );
926 910 } else {
927 911 $uwp_notices[] = array( 'register' => $message );
928 912 }
929 913 } else {
@@ -930,13 +914,12 @@
930 914 $redirect_to = $this->get_register_redirect_url( $data, $user_id );
931 915 do_action( 'uwp_after_process_register', $result, $user_id );
932 916
933 917 if ( wp_doing_ajax() ) {
934 - $message = aui()->alert(
935 - array(
918 + $message = aui()->alert( array(
936 919 'type' => 'success',
937 - 'content' => __( 'Account registered successfully. Redirecting...', 'userswp' ),
938 - )
920 + 'content' => __( 'Account registered successfully. Redirecting...', 'userswp' )
921 + )
939 922 );
940 923 $response = array(
941 924 'message' => $message,
942 925 'redirect' => $redirect_to,
@@ -958,13 +941,12 @@
958 941 ),
959 942 $resend_link
960 943 );
961 944
962 - $message = aui()->alert(
963 - array(
945 + $message = aui()->alert( array(
964 946 'type' => 'success',
965 - 'content' => sprintf( __( 'An email has been sent to your registered email address. Please click the activation link to proceed. <a href="%s">Resend</a>.', 'userswp' ), $resend_link ),
966 - )
947 + 'content' => sprintf( __( 'An email has been sent to your registered email address. Please click the activation link to proceed. %sResend%s.', 'userswp' ), '<a href="' . $resend_link . '"">', '</a>' )
948 + )
967 949 );
968 950
969 951 } elseif ( $reg_action == 'require_admin_review' && defined( 'UWP_MOD_VERSION' ) ) {
970 952
@@ -971,13 +953,12 @@
971 953 update_user_meta( $user_id, 'uwp_mod', '1' );
972 954
973 955 do_action( 'uwp_require_admin_review', $user_id, $result );
974 956
975 - $message = aui()->alert(
976 - array(
957 + $message = aui()->alert( array(
977 958 'type' => 'success',
978 - 'content' => __( 'Your account is under moderation. We will email you once its approved.', 'userswp' ),
979 - )
959 + 'content' => __( 'Your account is under moderation. We will email you once its approved.', 'userswp' )
960 + )
980 961 );
981 962 } else {
982 963
983 964 $login_page_url = wp_login_url();
@@ -982,18 +963,17 @@
982 963
983 964 $login_page_url = wp_login_url();
984 965
985 966 if ( $generated_password ) {
986 - $msg = sprintf( __( 'Account registered successfully. A password has been generated and mailed to your registered Email ID. Please login %1$shere%2$s.', 'userswp' ), '<a href="' . $login_page_url . '">', '</a>' );
967 + $msg = sprintf( __( 'Account registered successfully. A password has been generated and mailed to your registered Email ID. Please login %shere%s.', 'userswp' ), '<a href="' . $login_page_url . '">', '</a>' );
987 968 } else {
988 - $msg = sprintf( __( 'Account registered successfully. Please login %1$shere%2$s', 'userswp' ), '<a href="' . $login_page_url . '">', '</a>' );
969 + $msg = sprintf( __( 'Account registered successfully. Please login %shere%s', 'userswp' ), '<a href="' . $login_page_url . '">', '</a>' );
989 970 }
990 971
991 - $message = aui()->alert(
992 - array(
972 + $message = aui()->alert( array(
993 973 'type' => 'success',
994 - 'content' => $msg,
995 - )
974 + 'content' => $msg
975 + )
996 976 );
997 977 }
998 978
999 979 do_action( 'uwp_after_process_register', $result, $user_id );
@@ -998,17 +978,19 @@
998 978
999 979 do_action( 'uwp_after_process_register', $result, $user_id );
1000 980
1001 981 if ( wp_doing_ajax() ) {
1002 - wp_send_json_success( array( 'message' => $message ) );
982 + wp_send_json_success( array( 'message' => $message) );
1003 983 } else {
1004 984 $uwp_notices[] = array( 'register' => $message );
1005 985 }
986 +
1006 987 }
1007 988
1008 989 if ( wp_doing_ajax() ) {
1009 990 wp_send_json_error();
1010 991 } // if we got this far there is a problem
992 +
1011 993 }
1012 994
1013 995 /**
1014 996 * Saves UsersWP related user custom fields.
@@ -1032,8 +1014,9 @@
1032 1014 if ( $type == 'login' || $type == 'forgot' ) {
1033 1015 return true;
1034 1016 }
1035 1017
1018 +
1036 1019 if ( $type == 'account' || $type == 'register' ) {
1037 1020 if ( isset( $data['password'] ) ) {
1038 1021 unset( $data['password'] );
1039 1022 }
@@ -1052,10 +1035,10 @@
1052 1035 // no extra fields. so just return
1053 1036 return true;
1054 1037 } else {
1055 1038 foreach ( $data as $key => $value ) {
1056 - if ( 'uwp_language' == $key ) {
1057 - update_user_meta( $user_id, 'locale', $value );
1039 + if('uwp_language' == $key){
1040 + update_user_meta($user_id, 'locale', $value);
1058 1041 }
1059 1042 uwp_update_usermeta( $user_id, $key, $value );
1060 1043 }
1061 1044
@@ -1070,13 +1053,13 @@
1070 1053
1071 1054 $redirect_page_id = $custom_url = '';
1072 1055 if ( isset( $data['uwp_register_form_id'] ) && ! empty( $data['uwp_register_form_id'] ) ) {
1073 1056 $form_id = (int) $data['uwp_register_form_id'];
1074 - $redirect_page_id = uwp_get_register_form_by( $form_id, 'redirect_to' );
1075 - $custom_url = uwp_get_register_form_by( $form_id, 'custom_url' );
1057 + $redirect_page_id = uwp_get_register_form_by($form_id, 'redirect_to');
1058 + $custom_url = uwp_get_register_form_by($form_id, 'custom_url');
1076 1059 }
1077 1060
1078 - if ( ! $redirect_page_id ) {
1061 + if(!$redirect_page_id){
1079 1062 $redirect_page_id = uwp_get_option( 'register_redirect_to', '' );
1080 1063 $custom_url = uwp_get_option( 'register_redirect_custom_url' );
1081 1064 }
1082 1065
@@ -1106,8 +1089,9 @@
1106 1089 $redirect_to = apply_filters( 'registration_redirect', $redirect_to );
1107 1090 }
1108 1091
1109 1092 return apply_filters( 'uwp_register_redirect', $redirect_to, $redirect_page_id, $data );
1093 +
1110 1094 }
1111 1095
1112 1096 /**
1113 1097 * Processes login form submission.
@@ -1124,16 +1108,15 @@
1124 1108 return;
1125 1109 }
1126 1110
1127 1111 if ( ! isset( $data['uwp_login_nonce'] ) || ! wp_verify_nonce( $data['uwp_login_nonce'], 'uwp-login-nonce' ) ) {
1128 - $message = aui()->alert(
1129 - array(
1112 + $message = aui()->alert( array(
1130 1113 'type' => 'error',
1131 - 'content' => __( 'Security verification failed. Try again.', 'userswp' ),
1132 - )
1114 + 'content' => __( 'Security verification failed. Try again.', 'userswp' )
1115 + )
1133 1116 );
1134 1117 if ( wp_doing_ajax() ) {
1135 - wp_send_json_error( array( 'message' => $message ) );
1118 + wp_send_json_error( array( 'message' => $message) );
1136 1119 } else {
1137 1120 return;
1138 1121 }
1139 1122 }
@@ -1146,16 +1129,15 @@
1146 1129
1147 1130 $result = apply_filters( 'uwp_validate_result', $result, 'login', $data );
1148 1131
1149 1132 if ( is_wp_error( $result ) ) {
1150 - $message = aui()->alert(
1151 - array(
1133 + $message = aui()->alert( array(
1152 1134 'type' => 'error',
1153 - 'content' => $result->get_error_message(),
1154 - )
1135 + 'content' => $result->get_error_message()
1136 + )
1155 1137 );
1156 1138 if ( wp_doing_ajax() ) {
1157 - wp_send_json_error( array( 'message' => $message ) );
1139 + wp_send_json_error( array( 'message' => $message) );
1158 1140 } else {
1159 1141 $uwp_notices[] = array( 'login' => $message );
1160 1142
1161 1143 return;
@@ -1180,9 +1162,9 @@
1180 1162 $user = wp_signon(
1181 1163 array(
1182 1164 'user_login' => $result['username'],
1183 1165 'user_password' => $result['password'],
1184 - 'remember' => $remember_me,
1166 + 'remember' => $remember_me
1185 1167 )
1186 1168 );
1187 1169
1188 1170 add_action( 'authenticate', 'gglcptch_login_check', 21, 1 );
@@ -1191,35 +1173,28 @@
1191 1173
1192 1174 $two_fa = $this->check_2fa( $user );
1193 1175 if ( isset( $two_fa ) && ! empty( $two_fa ) ) {
1194 1176 if ( is_wp_error( $two_fa ) ) {
1195 - $message = aui()->alert(
1196 - array(
1177 + $message = aui()->alert( array(
1197 1178 'type' => 'error',
1198 - 'content' => $two_fa->get_error_message(),
1199 - )
1179 + 'content' => $two_fa->get_error_message()
1180 + )
1200 1181 );
1201 - wp_send_json_error( array( 'message' => $message ) );
1182 + wp_send_json_error( array( 'message' => $message) );
1202 1183 } else {
1203 - wp_send_json_success(
1204 - array(
1205 - 'html' => $two_fa,
1206 - 'is_2fa' => true,
1207 - )
1208 - );
1184 + wp_send_json_success( array( 'html' => $two_fa, 'is_2fa' => true ) );
1209 1185 }
1210 1186 }
1211 1187 }
1212 1188
1213 1189 if ( is_wp_error( $user ) ) {
1214 - $message = aui()->alert(
1215 - array(
1190 + $message = aui()->alert( array(
1216 1191 'type' => 'error',
1217 - 'content' => $user->get_error_message(),
1218 - )
1192 + 'content' => $user->get_error_message()
1193 + )
1219 1194 );
1220 1195 if ( wp_doing_ajax() ) {
1221 - wp_send_json_error( array( 'message' => $message ) );
1196 + wp_send_json_error( array( 'message' => $message) );
1222 1197 } else {
1223 1198 $uwp_notices[] = array( 'login' => $message );
1224 1199
1225 1200 return;
@@ -1225,31 +1200,27 @@
1225 1200 return;
1226 1201 }
1227 1202 } else {
1228 1203 do_action( 'uwp_after_process_login', $data );
1229 - $message = aui()->alert(
1230 - array(
1204 + $message = aui()->alert( array(
1231 1205 'type' => 'success',
1232 - 'content' => __( 'Login successful. Redirecting...', 'userswp' ),
1233 - )
1206 + 'content' => __( 'Login successful. Redirecting...', 'userswp' )
1207 + )
1234 1208 );
1235 1209 if ( wp_doing_ajax() ) {
1236 1210 $redirect_to = '';
1237 - if ( 1 == uwp_get_option( 'login_modal_enable_redirect' ) ) {
1211 + if(1 == uwp_get_option('login_modal_enable_redirect')){
1238 1212 $redirect_to = $this->get_login_redirect_url( $data, $user );
1239 1213 }
1240 - wp_send_json_success(
1241 - array(
1242 - 'message' => $message,
1243 - 'redirect' => $redirect_to,
1244 - )
1245 - );
1214 + wp_send_json_success( array( 'message' => $message, 'redirect' => $redirect_to ) );
1246 1215 } else {
1247 1216 $redirect_to = $this->get_login_redirect_url( $data, $user );
1248 1217 wp_safe_redirect( $redirect_to );
1249 1218 exit();
1250 1219 }
1251 -}
1220 +
1221 + }
1222 +
1252 1223 }
1253 1224
1254 1225 public function check_2fa( $user ) {
1255 1226 if ( 1 == uwp_get_option( 'disable_wp_2fa' ) ) {
@@ -1285,13 +1256,13 @@
1285 1256 ?>
1286 1257
1287 1258 <div class="uwp-2fa-methods-wrap">
1288 1259 <form name="validate_2fa_form" id="validate_2fa_form" class="validate_2fa_form" action="" method="post"
1289 - autocomplete="off">
1260 + autocomplete="off">
1290 1261 <input type="hidden" name="provider" id="provider" value="<?php echo esc_attr( $provider ); ?>"/>
1291 1262 <input type="hidden" name="uwp-auth-id" id="uwp-auth-id" value="<?php echo esc_attr( $user->ID ); ?>"/>
1292 1263 <input type="hidden" name="wp-auth-nonce" id="wp-auth-nonce"
1293 - value="<?php echo esc_attr( $login_nonce['key'] ); ?>"/>
1264 + value="<?php echo esc_attr( $login_nonce['key'] ); ?>"/>
1294 1265 <?php
1295 1266
1296 1267 // Check to see what provider is set and give the relevant authentication page.
1297 1268 if ( 'totp' === $provider ) {
@@ -1298,10 +1269,9 @@
1298 1269 ?>
1299 1270 <p><?php esc_html_e( 'Please enter the authentication code from your 2FA authentication app below to login:', 'userswp' ); ?></p>
1300 1271 <?php
1301 1272
1302 - echo aui()->input(
1303 - array( // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
1273 + echo aui()->input( array( // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
1304 1274 'type' => 'tel',
1305 1275 'id' => 'authcode',
1306 1276 'name' => 'authcode',
1307 1277 'placeholder' => esc_attr__( 'Authentication Code', 'userswp' ),
@@ -1306,20 +1276,17 @@
1306 1276 'name' => 'authcode',
1307 1277 'placeholder' => esc_attr__( 'Authentication Code', 'userswp' ),
1308 1278 'value' => '',
1309 1279 'label' => esc_html__( 'Authentication Code', 'userswp' ),
1310 - )
1311 - );
1280 + ) );
1312 1281
1313 - echo aui()->button(
1314 - array( // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
1282 + echo aui()->button( array( // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
1315 1283 'type' => 'submit',
1316 1284 'class' => 'btn btn-primary btn-block text-uppercase uwp-2fa-submit',
1317 1285 'name' => 'submit',
1318 1286 'icon' => '',
1319 1287 'content' => esc_html__( 'Log In', 'userswp' ),
1320 - )
1321 - );
1288 + ) );
1322 1289
1323 1290 } elseif ( 'email' === $provider ) {
1324 1291 $has_token = \WP2FA\Authenticator\Authentication::user_has_token( $user->ID );
1325 1292 if ( empty( $has_token ) || ! $has_token ) {
@@ -1327,10 +1294,9 @@
1327 1294 }
1328 1295 ?>
1329 1296 <p><?php esc_html_e( 'Please enter the 2FA verification code sent to your email address to login:', 'userswp' ); ?></p>
1330 1297 <?php
1331 - echo aui()->input(
1332 - array( // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
1298 + echo aui()->input( array( // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
1333 1299 'type' => 'tel',
1334 1300 'id' => 'authcode',
1335 1301 'name' => 'wp-2fa-email-code',
1336 1302 'placeholder' => esc_attr__( 'Verification Code', 'userswp' ),
@@ -1335,34 +1301,26 @@
1335 1301 'name' => 'wp-2fa-email-code',
1336 1302 'placeholder' => esc_attr__( 'Verification Code', 'userswp' ),
1337 1303 'value' => '',
1338 1304 'label' => esc_html__( 'Verification Code', 'userswp' ),
1339 - 'extra_attributes' => array(
1340 - 'size' => 20,
1341 - 'pattern' => '[0-9]*',
1342 - ),
1343 - )
1344 - );
1305 + 'extra_attributes' => array( 'size' => 20, 'pattern' => "[0-9]*" ),
1306 + ) );
1345 1307
1346 - echo aui()->button(
1347 - array( // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
1308 + echo aui()->button( array( // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
1348 1309 'type' => 'submit',
1349 1310 'class' => 'btn btn-primary text-uppercase uwp-2fa-submit',
1350 1311 'name' => 'submit',
1351 1312 'icon' => '',
1352 1313 'content' => esc_html__( 'Log In', 'userswp' ),
1353 - )
1354 - );
1314 + ) );
1355 1315
1356 - echo aui()->button(
1357 - array( // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
1316 + echo aui()->button( array( // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
1358 1317 'type' => 'button',
1359 1318 'class' => 'btn btn-secondary text-uppercase uwp-2fa-email-resend',
1360 1319 'name' => 'wp-2fa-email-code-resend',
1361 1320 'icon' => '',
1362 1321 'content' => esc_html__( 'Resend Code', 'userswp' ),
1363 - )
1364 - );
1322 + ) );
1365 1323
1366 1324 }
1367 1325 ?>
1368 1326 </form>
@@ -1373,18 +1331,17 @@
1373 1331 if ( isset( $codes_remaining ) && $codes_remaining > 0 ) {
1374 1332 ?>
1375 1333 <div class="uwp-2fa-methods-wrap" style="display:none;">
1376 1334 <form name="validate_2fa_backup_codes_form" id="validate_2fa_backup_codes_form"
1377 - class="validate_2fa_backup_codes_form" action="" method="post" autocomplete="off">
1335 + class="validate_2fa_backup_codes_form" action="" method="post" autocomplete="off">
1378 1336 <input type="hidden" name="provider" id="provider" value="backup_codes"/>
1379 1337 <input type="hidden" name="uwp-auth-id" id="uwp-auth-id"
1380 - value="<?php echo esc_attr( $user->ID ); ?>"/>
1338 + value="<?php echo esc_attr( $user->ID ); ?>"/>
1381 1339 <input type="hidden" name="wp-auth-nonce" id="wp-auth-nonce"
1382 - value="<?php echo esc_attr( $login_nonce['key'] ); ?>"/>
1340 + value="<?php echo esc_attr( $login_nonce['key'] ); ?>"/>
1383 1341 <div class="uwp-backup-fields">
1384 1342 <?php
1385 - echo aui()->input(
1386 - array( // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
1343 + echo aui()->input( array( // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
1387 1344 'type' => 'tel',
1388 1345 'id' => 'authcode',
1389 1346 'name' => 'wp-2fa-backup-code',
1390 1347 'placeholder' => esc_attr__( 'Enter backup code', 'userswp' ),
@@ -1389,24 +1346,18 @@
1389 1346 'name' => 'wp-2fa-backup-code',
1390 1347 'placeholder' => esc_attr__( 'Enter backup code', 'userswp' ),
1391 1348 'value' => '',
1392 1349 'label' => esc_html__( 'Backup Code', 'userswp' ),
1393 - 'extra_attributes' => array(
1394 - 'size' => 20,
1395 - 'pattern' => '[0-9]*',
1396 - ),
1397 - )
1398 - );
1350 + 'extra_attributes' => array( 'size' => 20, 'pattern' => "[0-9]*" ),
1351 + ) );
1399 1352
1400 - echo aui()->button(
1401 - array( // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
1353 + echo aui()->button( array( // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
1402 1354 'type' => 'submit',
1403 1355 'class' => 'btn btn-primary btn-block text-uppercase uwp-2fa-submit',
1404 1356 'name' => 'submit',
1405 1357 'icon' => '',
1406 1358 'content' => esc_html__( 'Log In', 'userswp' ),
1407 - )
1408 - );
1359 + ) );
1409 1360 ?>
1410 1361 </div>
1411 1362 </form>
1412 1363 </div>
@@ -1434,16 +1385,15 @@
1434 1385
1435 1386 $auth_id = (int) $_POST['uwp-auth-id'];
1436 1387 $user = get_userdata( $auth_id );
1437 1388 if ( ! $user ) {
1438 - $message = aui()->alert(
1439 - array(
1389 + $message = aui()->alert( array(
1440 1390 'type' => 'error',
1441 - 'content' => __( 'Invalid user data. Please try again.', 'userswp' ),
1442 - )
1391 + 'content' => __( 'Invalid user data. Please try again.', 'userswp' )
1392 + )
1443 1393 );
1444 1394
1445 - wp_send_json_error( array( 'message' => $message ) );
1395 + wp_send_json_error( array( 'message' => $message) );
1446 1396 }
1447 1397
1448 1398 global $wp2fa;
1449 1399
@@ -1449,16 +1399,15 @@
1449 1399
1450 1400 $nonce = ( isset( $_POST['wp-auth-nonce'] ) ) ? sanitize_textarea_field( wp_unslash( $_POST['wp-auth-nonce'] ) ) : '';
1451 1401 if ( true !== \WP2FA\Authenticator\Login::verify_login_nonce( $user->ID, $nonce ) ) {
1452 1402
1453 - $message = aui()->alert(
1454 - array(
1403 + $message = aui()->alert( array(
1455 1404 'type' => 'error',
1456 - 'content' => __( 'Invalid request! Please try again.', 'userswp' ),
1457 - )
1405 + 'content' => __( 'Invalid request! Please try again.', 'userswp' )
1406 + )
1458 1407 );
1459 1408
1460 - wp_send_json_error( array( 'message' => $message ) );
1409 + wp_send_json_error( array( 'message' => $message) );
1461 1410 }
1462 1411
1463 1412 if ( isset( $_POST['provider'] ) ) {
1464 1413 $provider = sanitize_textarea_field( wp_unslash( $_POST['provider'] ) );
@@ -1481,16 +1430,15 @@
1481 1430 if ( 'totp' === $provider && true !== \WP2FA\Authenticator\Login::validate_totp_authentication( $user ) ) {
1482 1431
1483 1432 do_action( 'wp_login_failed', $user->user_login );
1484 1433
1485 - $message = aui()->alert(
1486 - array(
1434 + $message = aui()->alert( array(
1487 1435 'type' => 'error',
1488 - 'content' => __( 'Invalid verification code.', 'userswp' ),
1489 - )
1436 + 'content' => __( 'Invalid verification code.', 'userswp' )
1437 + )
1490 1438 );
1491 1439
1492 - wp_send_json_error( array( 'message' => $message ) );
1440 + wp_send_json_error( array( 'message' => $message) );
1493 1441 }
1494 1442
1495 1443 // Validate Email.
1496 1444 if ( 'email' === $provider && true !== \WP2FA\Authenticator\Login::validate_email_authentication( $user ) ) {
@@ -1497,25 +1445,23 @@
1497 1445
1498 1446 do_action( 'wp_login_failed', $user->user_login );
1499 1447
1500 1448 if ( isset( $_REQUEST['wp-2fa-email-code-resend'] ) && 1 == $_REQUEST['wp-2fa-email-code-resend'] ) {
1501 - $message = aui()->alert(
1502 - array(
1449 + $message = aui()->alert( array(
1503 1450 'type' => 'info',
1504 - 'content' => __( 'A new code has been sent.', 'userswp' ),
1505 - )
1451 + 'content' => __( 'A new code has been sent.', 'userswp' )
1452 + )
1506 1453 );
1507 1454
1508 - wp_send_json_error( array( 'message' => $message ) );
1455 + wp_send_json_error( array( 'message' => $message) );
1509 1456 } else {
1510 - $message = aui()->alert(
1511 - array(
1457 + $message = aui()->alert( array(
1512 1458 'type' => 'error',
1513 - 'content' => __( 'Invalid verification code.', 'userswp' ),
1514 - )
1459 + 'content' => __( 'Invalid verification code.', 'userswp' )
1460 + )
1515 1461 );
1516 1462
1517 - wp_send_json_error( array( 'message' => $message ) );
1463 + wp_send_json_error( array( 'message' => $message) );
1518 1464 }
1519 1465 }
1520 1466
1521 1467 // Backup Codes.
@@ -1522,16 +1468,15 @@
1522 1468 if ( 'backup_codes' === $provider && true !== \WP2FA\Authenticator\Login::validate_backup_codes( $user ) ) {
1523 1469
1524 1470 do_action( 'wp_login_failed', $user->user_login );
1525 1471
1526 - $message = aui()->alert(
1527 - array(
1472 + $message = aui()->alert( array(
1528 1473 'type' => 'error',
1529 - 'content' => __( 'Invalid backup code.', 'userswp' ),
1530 - )
1474 + 'content' => __( 'Invalid backup code.', 'userswp' )
1475 + )
1531 1476 );
1532 1477
1533 - wp_send_json_error( array( 'message' => $message ) );
1478 + wp_send_json_error( array( 'message' => $message) );
1534 1479 }
1535 1480
1536 1481 \WP2FA\Authenticator\Login::delete_login_nonce( $user->ID );
1537 1482
@@ -1544,16 +1489,15 @@
1544 1489 wp_set_auth_cookie( $user->ID, $rememberme );
1545 1490
1546 1491 do_action( 'two_factor_user_authenticated', $user );
1547 1492
1548 - $message = aui()->alert(
1549 - array(
1493 + $message = aui()->alert( array(
1550 1494 'type' => 'success',
1551 - 'content' => __( 'Validation successful. Redirecting...', 'userswp' ),
1552 - )
1495 + 'content' => __( 'Validation successful. Redirecting...', 'userswp' )
1496 + )
1553 1497 );
1554 1498
1555 - wp_send_json_success( array( 'message' => $message ) );
1499 + wp_send_json_success( array( 'message' => $message) );
1556 1500 }
1557 1501
1558 1502 public function get_login_redirect_url( $data, $user ) {
1559 1503 if ( is_int( $user ) ) {
@@ -1562,15 +1506,17 @@
1562 1506
1563 1507 $redirect_page_id = uwp_get_option( 'login_redirect_to', - 1 );
1564 1508 $custom_url = uwp_get_option( 'login_redirect_custom_url' );
1565 1509
1566 - if ( $user && isset( $user->roles[0] ) ) {
1510 + if($user && isset($user->roles[0])){
1567 1511 $user_role = $user->roles[0];
1568 - $redirect_page_id = uwp_get_option( 'login_redirect_to_' . $user_role, $redirect_page_id );
1569 - $custom_url = uwp_get_option( 'login_redirect_custom_url_' . $user_role );
1512 + $redirect_page_id = uwp_get_option( 'login_redirect_to_'.$user_role, $redirect_page_id );
1513 + $custom_url = uwp_get_option( 'login_redirect_custom_url_'.$user_role );
1570 1514 }
1571 1515
1572 - if ( isset( $_REQUEST['redirect_to'] ) && ! empty( $_REQUEST['redirect_to'] ) ) {
1516 + if ( $user && $user->has_cap( 'manage_options' ) ) {
1517 + $redirect_to = admin_url();
1518 + } elseif ( isset( $_REQUEST['redirect_to'] ) && ! empty( $_REQUEST['redirect_to'] ) ) {
1573 1519 $redirect_to = esc_url_raw( $_REQUEST['redirect_to'] );
1574 1520 } elseif ( isset( $data['redirect_to'] ) && ! empty( $data['redirect_to'] ) ) {
1575 1521 $redirect_to = esc_url_raw( $data['redirect_to'] );
1576 1522 } elseif ( isset( $redirect_page_id ) && (int) $redirect_page_id > 0 ) {
@@ -1582,9 +1528,9 @@
1582 1528 }
1583 1529 $redirect_to = get_permalink( $redirect_page_id );
1584 1530 } elseif ( isset( $redirect_page_id ) && (int) $redirect_page_id == - 1 && wp_get_referer() ) {
1585 1531 $redirect_to = esc_url( wp_get_referer() );
1586 - } elseif ( isset( $redirect_page_id ) && (int) $redirect_page_id == - 2 && ! empty( $custom_url ) ) {
1532 + } elseif ( isset( $redirect_page_id ) && (int) $redirect_page_id == - 2 && !empty($custom_url) ) {
1587 1533 $redirect_to = $custom_url;
1588 1534 } else {
1589 1535 $redirect_to = home_url( '/' );
1590 1536 $redirect_to = apply_filters( 'login_redirect', $redirect_to, '', $user );
@@ -1590,8 +1536,9 @@
1590 1536 $redirect_to = apply_filters( 'login_redirect', $redirect_to, '', $user );
1591 1537 }
1592 1538
1593 1539 return apply_filters( 'uwp_login_redirect', $redirect_to, $redirect_page_id, $data, $user );
1540 +
1594 1541 }
1595 1542
1596 1543 /**
1597 1544 * Processes forgot password form submission.
@@ -1608,13 +1555,12 @@
1608 1555 return;
1609 1556 }
1610 1557
1611 1558 if ( ! isset( $data['uwp_forgot_nonce'] ) || ! wp_verify_nonce( $data['uwp_forgot_nonce'], 'uwp-forgot-nonce' ) ) {
1612 - $message = aui()->alert(
1613 - array(
1559 + $message = aui()->alert( array(
1614 1560 'type' => 'error',
1615 - 'content' => __( 'Security verification failed. Try again.', 'userswp' ),
1616 - )
1561 + 'content' => __( 'Security verification failed. Try again.', 'userswp' )
1562 + )
1617 1563 );
1618 1564 if ( wp_doing_ajax() ) {
1619 1565 wp_send_json_error( $message );
1620 1566 } else {
@@ -1630,13 +1576,12 @@
1630 1576
1631 1577 $result = apply_filters( 'uwp_validate_result', $result, 'forgot', $data );
1632 1578
1633 1579 if ( is_wp_error( $result ) ) {
1634 - $message = aui()->alert(
1635 - array(
1580 + $message = aui()->alert( array(
1636 1581 'type' => 'error',
1637 - 'content' => $result->get_error_message(),
1638 - )
1582 + 'content' => $result->get_error_message()
1583 + )
1639 1584 );
1640 1585 if ( wp_doing_ajax() ) {
1641 1586 wp_send_json_error( $message );
1642 1587 } else {
@@ -1647,19 +1592,17 @@
1647 1592 }
1648 1593
1649 1594 do_action( 'uwp_after_validate', $result, 'forgot', $data );
1650 1595
1596 +
1651 1597 $user_data = get_user_by( 'email', $data['email'] );
1652 1598
1653 1599 // if no user we fake it and bail
1654 1600 if ( ! $user_data ) {
1655 - $args = apply_filters(
1656 - 'uwp_forgot_error_message',
1657 - array(
1658 - 'type' => 'error',
1659 - 'content' => __( 'Invalid email or user doesn\'t exists.', 'userswp' ),
1660 - )
1661 - );
1601 + $args = apply_filters('uwp_forgot_error_message', array(
1602 + 'type' => 'error',
1603 + 'content' => __( 'Invalid email or user doesn\'t exists.', 'userswp' )
1604 + ));
1662 1605
1663 1606 $message = aui()->alert( $args );
1664 1607 if ( wp_doing_ajax() ) {
1665 1608 wp_send_json_success( $message );
@@ -1672,27 +1615,18 @@
1672 1615
1673 1616 // make sure user account is active before account reset
1674 1617 $mod_value = get_user_meta( $user_data->ID, 'uwp_mod', true );
1675 1618 if ( $mod_value == 'email_unconfirmed' ) {
1676 - $resend_link = uwp_get_forgot_page_url();
1677 - $resend_link = add_query_arg(
1678 - array(
1679 - 'user_id' => $user_data->ID,
1680 - 'action' => 'uwp_resend',
1681 - '_nonce' => wp_create_nonce('uwp_resend'),
1682 - ),
1683 - $resend_link
1684 - );
1685 - $message = aui()->alert(
1686 - array(
1619 + $message = aui()->alert( array(
1687 1620 'type' => 'error',
1688 - 'content' => sprintf(__('Your account is not activated yet. Please activate your account first. <a href="%s">Resend</a>.', 'userswp'), $resend_link),
1689 - )
1621 + 'content' => __( 'Your account is not activated yet. Please activate your account first.', 'userswp' )
1622 + )
1690 1623 );
1691 1624 if ( wp_doing_ajax() ) {
1692 1625 wp_send_json_error( $message );
1693 1626 } else {
1694 1627 $uwp_notices[] = array( 'forgot' => $message );
1628 +
1695 1629 return;
1696 1630 }
1697 1631 }
1698 1632
@@ -1701,9 +1635,9 @@
1701 1635 $allow = apply_filters( 'allow_password_reset', true, $user_data->ID );
1702 1636
1703 1637 if ( ! $allow ) {
1704 1638 return false;
1705 - } elseif ( is_wp_error( $allow ) ) {
1639 + } else if ( is_wp_error( $allow ) ) {
1706 1640 return false;
1707 1641 }
1708 1642
1709 1643 $as_password = apply_filters( 'uwp_forgot_message_as_password', false );
@@ -1717,10 +1651,10 @@
1717 1651 if ( ! uwp_get_option( 'change_disable_password_nag' ) ) {
1718 1652 update_user_meta( $user_data->ID, 'default_password_nag', true ); //Set up the Password change nag.
1719 1653 }
1720 1654 $message = '<p><b>' . __( 'Your login Information :', 'userswp' ) . '</b></p>';
1721 - $message .= '<p>' . sprintf( __( 'Username: %s', 'userswp' ), $user_data->user_login ) . '</p>';
1722 - $message .= '<p>' . sprintf( __( 'Password: %s', 'userswp' ), $new_pass ) . '</p>';
1655 + $message .= '<p>' . sprintf( __( 'Username: %s', 'userswp' ), $user_data->user_login ) . "</p>";
1656 + $message .= '<p>' . sprintf( __( 'Password: %s', 'userswp' ), $new_pass ) . "</p>";
1723 1657
1724 1658 } else {
1725 1659 $key = wp_generate_password( 20, false );
1726 1660 do_action( 'retrieve_password_key', $user_data->user_login, $key );
@@ -1729,27 +1663,24 @@
1729 1663 require_once ABSPATH . 'wp-includes/class-phpass.php';
1730 1664 $wp_hasher = new PasswordHash( 8, true );
1731 1665 }
1732 1666 $hashed = $wp_hasher->HashPassword( $key );
1733 - $wpdb->update( $wpdb->users, array( 'user_activation_key' => time() . ':' . $hashed ), array( 'user_login' => $user_data->user_login ) ); // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching
1734 - $message = '<p>' . __( 'You have requested to reset your password for the following account:', 'userswp' ) . '</p>';
1735 - $message .= home_url( '/' ) . '</p>';
1736 - $message .= '<p>' . sprintf( __( 'Username: %s', 'userswp' ), $user_data->user_login ) . '</p>';
1737 - $message .= '<p>' . __( 'If this was by mistake, just ignore this email and nothing will happen.', 'userswp' ) . '</p>';
1738 - $message .= '<p>' . __( 'To reset your password, click the following link and follow the instructions.', 'userswp' ) . '</p>';
1667 + $wpdb->update( $wpdb->users, array( 'user_activation_key' => time() . ":" . $hashed ), array( 'user_login' => $user_data->user_login ) ); // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching
1668 + $message = '<p>' . __( 'You have requested to reset your password for the following account:', 'userswp' ) . "</p>";
1669 + $message .= home_url( '/' ) . "</p>";
1670 + $message .= '<p>' . sprintf( __( 'Username: %s', 'userswp' ), $user_data->user_login ) . "</p>";
1671 + $message .= '<p>' . __( 'If this was by mistake, just ignore this email and nothing will happen.', 'userswp' ) . "</p>";
1672 + $message .= '<p>' . __( 'To reset your password, click the following link and follow the instructions.', 'userswp' ) . "</p>";
1739 1673 $reset_page = uwp_get_page_id( 'reset_page', false );
1740 1674 if ( $reset_page ) {
1741 - $reset_link = add_query_arg(
1742 - array(
1743 - 'key' => $key,
1744 - 'login' => rawurlencode( $user_data->user_login ),
1745 - ),
1746 - get_permalink( $reset_page )
1747 - );
1748 - $message .= "<a href='" . $reset_link . "' target='_blank'>" . $reset_link . '</a>' . "\r\n";
1675 + $reset_link = add_query_arg( array(
1676 + 'key' => $key,
1677 + 'login' => rawurlencode( $user_data->user_login ),
1678 + ), get_permalink( $reset_page ) );
1679 + $message .= "<a href='" . $reset_link . "' target='_blank'>" . $reset_link . "</a>" . "\r\n";
1749 1680 } else {
1750 1681 $reset_link = home_url( "reset?key=$key&login=" . rawurlencode( $user_data->user_login ), 'login' );
1751 - $message .= "<a href='" . $reset_link . "' target='_blank'>" . $reset_link . '</a>' . "\r\n";
1682 + $message .= "<a href='" . $reset_link . "' target='_blank'>" . $reset_link . "</a>" . "\r\n";
1752 1683 }
1753 1684 $message = apply_filters( 'uwp_forgot_password_message', $message, $user_data, $reset_link );
1754 1685 }
1755 1686
@@ -1764,13 +1695,12 @@
1764 1695 UsersWP_Mails::send( $user_data->user_email, 'forgot_password', $email_vars );
1765 1696
1766 1697 do_action( 'uwp_after_process_forgot', $data );
1767 1698
1768 - $message = aui()->alert(
1769 - array(
1699 + $message = aui()->alert( array(
1770 1700 'type' => 'success',
1771 - 'content' => apply_filters( 'uwp_change_password_success_message', __( 'Please check your email.', 'userswp' ), $data ),
1772 - )
1701 + 'content' => apply_filters( 'uwp_change_password_success_message', __( 'Please check your email.', 'userswp' ), $data )
1702 + )
1773 1703 );
1774 1704 if ( wp_doing_ajax() ) {
1775 1705 wp_send_json_success( $message );
1776 1706 } else {
@@ -1807,13 +1737,12 @@
1807 1737
1808 1738 $result = apply_filters( 'uwp_validate_result', $result, 'change', $data );
1809 1739
1810 1740 if ( is_wp_error( $result ) ) {
1811 - $message = aui()->alert(
1812 - array(
1741 + $message = aui()->alert( array(
1813 1742 'type' => 'error',
1814 - 'content' => $result->get_error_message(),
1815 - )
1743 + 'content' => $result->get_error_message()
1744 + )
1816 1745 );
1817 1746 $uwp_notices[] = array( $notice_type => $message );
1818 1747
1819 1748 return;
@@ -1823,13 +1752,12 @@
1823 1752
1824 1753 $user_data = get_user_by( 'id', get_current_user_id() );
1825 1754
1826 1755 if ( ! $user_data ) {
1827 - $message = aui()->alert(
1828 - array(
1756 + $message = aui()->alert( array(
1829 1757 'type' => 'error',
1830 - 'content' => $user_data->get_error_message(),
1831 - )
1758 + 'content' => $user_data->get_error_message()
1759 + )
1832 1760 );
1833 1761 $uwp_notices[] = array( $notice_type => $message );
1834 1762
1835 1763 return;
@@ -1847,15 +1775,14 @@
1847 1775 if ( $password_nag ) {
1848 1776 delete_user_meta( $user_data->ID, 'default_password_nag' );
1849 1777 }
1850 1778
1851 - delete_user_meta( $user_data->ID, 'is_uwp_social_login_no_password' );
1779 + delete_user_meta($user_data->ID, 'is_uwp_social_login_no_password');
1852 1780
1853 - $message = aui()->alert(
1854 - array(
1855 - 'type' => 'success',
1856 - 'content' => apply_filters( 'uwp_change_password_success_message', __( 'Password changed successfully.', 'userswp' ), $data ),
1857 - )
1781 + $message = aui()->alert( array(
1782 + 'type' => 'success',
1783 + 'content' => apply_filters( 'uwp_change_password_success_message', __( 'Password changed successfully.', 'userswp' ), $data )
1784 + )
1858 1785 );
1859 1786
1860 1787 $uwp_notices[] = array( $notice_type => $message );
1861 1788
@@ -1892,13 +1819,12 @@
1892 1819
1893 1820 $result = apply_filters( 'uwp_validate_result', $result, 'reset', $data );
1894 1821
1895 1822 if ( is_wp_error( $result ) ) {
1896 - $message = aui()->alert(
1897 - array(
1823 + $message = aui()->alert( array(
1898 1824 'type' => 'error',
1899 - 'content' => $result->get_error_message(),
1900 - )
1825 + 'content' => $result->get_error_message()
1826 + )
1901 1827 );
1902 1828 $uwp_notices[] = array( 'reset' => $message );
1903 1829
1904 1830 return;
@@ -1910,13 +1836,12 @@
1910 1836 $key = sanitize_text_field( $data['uwp_reset_key'] );
1911 1837
1912 1838 $user = get_user_by( 'login', $login );
1913 1839 if ( ! $user ) {
1914 - $message = aui()->alert(
1915 - array(
1840 + $message = aui()->alert( array(
1916 1841 'type' => 'error',
1917 - 'content' => __( 'Invalid username.', 'userswp' ),
1918 - )
1842 + 'content' => __( 'Invalid username.', 'userswp' )
1843 + )
1919 1844 );
1920 1845 $uwp_notices[] = array( 'reset' => $message );
1921 1846
1922 1847 return;
@@ -1926,14 +1851,13 @@
1926 1851
1927 1852 $user_data = check_password_reset_key( $key, $login );
1928 1853
1929 1854 if ( is_wp_error( $user_data ) ) {
1930 - $error = apply_filters( 'uwp_reset_password_error_message', $user_data->get_error_message(), $user_data );
1931 - $message = aui()->alert(
1932 - array(
1855 + $error = apply_filters('uwp_reset_password_error_message', $user_data->get_error_message(), $user_data);
1856 + $message = aui()->alert( array(
1933 1857 'type' => 'error',
1934 - 'content' => $error,
1935 - )
1858 + 'content' => $error
1859 + )
1936 1860 );
1937 1861 $uwp_notices[] = array( 'reset' => $message );
1938 1862
1939 1863 return;
@@ -1949,13 +1873,12 @@
1949 1873
1950 1874 $login_page_url = uwp_get_login_page_url();
1951 1875 $message = sprintf( __( 'Password updated successfully. Please <a href="%s">login</a> with your new password.', 'userswp' ), $login_page_url );
1952 1876 $message = apply_filters( 'uwp_reset_password_success_message', $message, $data );
1953 - $message = aui()->alert(
1954 - array(
1877 + $message = aui()->alert( array(
1955 1878 'type' => 'success',
1956 - 'content' => $message,
1957 - )
1879 + 'content' => $message
1880 + )
1958 1881 );
1959 1882 $uwp_notices[] = array( 'reset' => $message );
1960 1883
1961 1884 do_action( 'uwp_after_process_reset', $data );
@@ -1990,13 +1913,12 @@
1990 1913
1991 1914 $result = apply_filters( 'uwp_validate_result', $result, 'account', $data );
1992 1915
1993 1916 if ( is_wp_error( $result ) ) {
1994 - $message = aui()->alert(
1995 - array(
1917 + $message = aui()->alert( array(
1996 1918 'type' => 'error',
1997 - 'content' => $result->get_error_message(),
1998 - )
1919 + 'content' => $result->get_error_message()
1920 + )
1999 1921 );
2000 1922 $uwp_notices[] = array( 'account' => $message );
2001 1923
2002 1924 return;
@@ -2004,13 +1926,12 @@
2004 1926
2005 1927 $uploads_result = $file_obj->validate_uploads( $files, 'account' );
2006 1928
2007 1929 if ( is_wp_error( $uploads_result ) ) {
2008 - $message = aui()->alert(
2009 - array(
1930 + $message = aui()->alert( array(
2010 1931 'type' => 'error',
2011 - 'content' => $uploads_result->get_error_message(),
2012 - )
1932 + 'content' => $uploads_result->get_error_message()
1933 + )
2013 1934 );
2014 1935 $uwp_notices[] = array( 'account' => $message );
2015 1936
2016 1937 return;
@@ -2026,10 +1947,11 @@
2026 1947 }
2027 1948
2028 1949 $result = array_merge( $result, $uploads_result );
2029 1950
1951 +
2030 1952 $args = array(
2031 - 'ID' => get_current_user_id(),
1953 + 'ID' => get_current_user_id()
2032 1954 );
2033 1955
2034 1956 if ( isset( $result['first_name'] ) && isset( $result['last_name'] ) ) {
2035 1957 $args['display_name'] = $result['first_name'] . ' ' . $result['last_name'];
@@ -2057,13 +1979,12 @@
2057 1979
2058 1980 $user_id = wp_update_user( $args );
2059 1981
2060 1982 if ( is_wp_error( $user_id ) ) {
2061 - $message = aui()->alert(
2062 - array(
1983 + $message = aui()->alert( array(
2063 1984 'type' => 'error',
2064 - 'content' => sprintf( __( '%s', 'userswp' ), $user_id->get_error_message() ),
2065 - )
1985 + 'content' => sprintf( __( '%s', 'userswp' ), $user_id->get_error_message() )
1986 + )
2066 1987 );
2067 1988 $uwp_notices[] = array( 'account' => $message );
2068 1989
2069 1990 return;
@@ -2071,13 +1992,12 @@
2071 1992
2072 1993 $res = $this->save_user_extra_fields( $user_id, $result, 'account' );
2073 1994
2074 1995 if ( ! $res ) {
2075 - $message = aui()->alert(
2076 - array(
1996 + $message = aui()->alert( array(
2077 1997 'type' => 'error',
2078 - 'content' => __( 'Something went wrong. Please contact site admin.', 'userswp' ),
2079 - )
1998 + 'content' => __( 'Something went wrong. Please contact site admin.', 'userswp' )
1999 + )
2080 2000 );
2081 2001 $uwp_notices[] = array( 'account' => $message );
2082 2002
2083 2003 return;
@@ -2093,22 +2013,21 @@
2093 2013 }
2094 2014
2095 2015 $user_data = get_userdata( $user_id );
2096 2016
2097 - $form_fields = apply_filters( 'uwp_send_mail_form_fields', '', 'account', $user_id );
2017 + $form_fields = apply_filters( 'uwp_send_mail_form_fields', "", 'account', $user_id );
2098 2018
2099 - if ( isset( $result['email'] ) && $user_data->user_email !== trim( $result['email'] ) ) {
2019 + if ( isset( $result['email'] ) && $user_data->user_email !== trim($result['email']) ) {
2100 2020
2101 - if ( email_exists( trim( $result['email'] ) ) ) {
2102 - $message = aui()->alert(
2103 - array(
2104 - 'type' => 'error',
2105 - 'content' => __( 'This email is already registered, please choose another one.', 'userswp' ),
2106 - )
2107 - );
2021 + if(email_exists(trim($result['email']))){
2022 + $message = aui()->alert( array(
2023 + 'type' => 'error',
2024 + 'content' => __( 'This email is already registered, please choose another one.', 'userswp' )
2025 + )
2026 + );
2108 2027
2109 - $uwp_notices[] = array( 'account' => $message );
2110 - return;
2028 + $uwp_notices[] = array( 'account' => $message );
2029 + return;
2111 2030
2112 2031 }
2113 2032
2114 2033 $hash = md5( $result['email'] . time() . wp_rand() );
@@ -2116,22 +2035,22 @@
2116 2035 'hash' => $hash,
2117 2036 'newemail' => $result['email'],
2118 2037 );
2119 2038
2120 - update_user_meta( get_current_user_id(), 'uwp_update_email_hash', $new_admin_email );
2039 + update_user_meta(get_current_user_id(), 'uwp_update_email_hash', $new_admin_email);
2121 2040
2122 2041 $new_email_link = add_query_arg(
2123 2042 array(
2124 2043 'uwp_new_email' => 'yes',
2125 - 'key' => $hash,
2126 - 'login' => $user_data->user_login,
2044 + 'key' => $hash,
2045 + 'login' => $user_data->user_login
2127 2046 ),
2128 2047 uwp_get_account_page_url()
2129 2048 );
2130 2049
2131 2050 $email_vars = array(
2132 - 'user_id' => $user_id,
2133 - 'new_email' => $result['email'],
2051 + 'user_id' => $user_id,
2052 + 'new_email' => $result['email'],
2134 2053 'new_email_link' => esc_url( $new_email_link ),
2135 2054 );
2136 2055
2137 2056 UsersWP_Mails::send( $result['email'], 'account_new_email_activation', $email_vars );
@@ -2136,13 +2055,12 @@
2136 2055
2137 2056 UsersWP_Mails::send( $result['email'], 'account_new_email_activation', $email_vars );
2138 2057
2139 2058 $message = apply_filters( 'uwp_account_pending_new_email_activation_message', __( 'Account updated successfully. The new address will become active once you confirm via activation link sent to your new email.', 'userswp' ), $data );
2140 - $message = aui()->alert(
2141 - array(
2059 + $message = aui()->alert( array(
2142 2060 'type' => 'success',
2143 - 'content' => $message,
2144 - )
2061 + 'content' => $message
2062 + )
2145 2063 );
2146 2064
2147 2065 $uwp_notices[] = array( 'account' => $message );
2148 2066
@@ -2154,13 +2072,12 @@
2154 2072
2155 2073 UsersWP_Mails::send( $user_data->user_email, 'account_update', $email_vars );
2156 2074
2157 2075 $message = apply_filters( 'uwp_account_update_success_message', __( 'Account updated successfully.', 'userswp' ), $data );
2158 - $message = aui()->alert(
2159 - array(
2076 + $message = aui()->alert( array(
2160 2077 'type' => 'success',
2161 - 'content' => $message,
2162 - )
2078 + 'content' => $message
2079 + )
2163 2080 );
2164 2081
2165 2082 $uwp_notices[] = array( 'account' => $message );
2166 2083 }
@@ -2165,8 +2082,9 @@
2165 2082 $uwp_notices[] = array( 'account' => $message );
2166 2083 }
2167 2084
2168 2085 do_action( 'uwp_after_process_account', $data, $user_id );
2086 +
2169 2087 }
2170 2088
2171 2089 /**
2172 2090 * Modifies the forms field in email based on the form type.
@@ -2181,11 +2099,11 @@
2181 2099 *
2182 2100 */
2183 2101 public function init_mail_form_fields( $form_fields, $type, $user_id ) {
2184 2102 switch ( $type ) {
2185 - case 'register':
2103 + case "register":
2186 2104 $form_id = get_user_meta( $user_id, '_uwp_register_form_id', true );
2187 - $fields = get_register_form_fields( $form_id );
2105 + $fields = get_register_form_fields($form_id);
2188 2106 $user_data = get_userdata( $user_id );
2189 2107 if ( ! empty( $fields ) && is_array( $fields ) ) {
2190 2108 $form_fields = '<p><b>' . __( 'User Information:', 'userswp' ) . '</b></p>';
2191 2109 $excluded = uwp_get_excluded_fields();
@@ -2207,14 +2125,14 @@
2207 2125 $field_value = uwp_maybe_serialize( $field->htmlvar_name, $field_value );
2208 2126 }
2209 2127
2210 2128 if ( isset( $field->site_title ) && ! empty( $field_value ) ) {
2211 - $form_fields .= '<p><b>' . __( wp_unslash( $field->site_title ), 'userswp' ) . '</b>:&nbsp;' . $field_value . '</p>';
2129 + $form_fields .= '<p><b>' . __( $field->site_title, 'userswp' ) . '</b>:&nbsp;' . $field_value . '</p>';
2212 2130 }
2213 2131 }
2214 2132 }
2215 2133 break;
2216 - case 'account':
2134 + case "account":
2217 2135 $fields = get_account_form_fields();
2218 2136 $user_data = get_userdata( $user_id );
2219 2137 if ( ! empty( $fields ) && is_array( $fields ) ) {
2220 2138 $form_fields = '<p><b>' . __( 'User Information:', 'userswp' ) . '</b></p>';
@@ -2236,9 +2154,9 @@
2236 2154 $field_value = uwp_maybe_serialize( $field->htmlvar_name, $field_value );
2237 2155 }
2238 2156
2239 2157 if ( isset( $field->site_title ) && ! empty( $field_value ) ) {
2240 - $form_fields .= '<p><b>' . __( wp_unslash( $field->site_title ), 'userswp' ) . '</b>:&nbsp;' . $field_value . '</p>';
2158 + $form_fields .= '<p><b>' . __( $field->site_title, 'userswp' ) . '</b>:&nbsp;' . $field_value . '</p>';
2241 2159 }
2242 2160 }
2243 2161 }
2244 2162 break;
@@ -2255,81 +2173,46 @@
2255 2173 * @package userswp
2256 2174 * @since 1.0.0
2257 2175 */
2258 2176 public function upload_file_remove() {
2259 - global $wpdb;
2260 -
2261 2177 check_ajax_referer( 'uwp_basic_nonce', 'security' );
2262 2178
2263 - // Check user logged in.
2264 - if ( ! is_user_logged_in() ) {
2265 - $message = aui()->alert( array( 'type' => 'error', 'content' => __( 'Access denied!', 'userswp' ) ) );
2266 - wp_send_json_error( array( 'message' => $message ) );
2267 - }
2268 -
2179 + $htmlvar = esc_sql( strip_tags( $_POST['htmlvar'] ) );
2269 2180 $user_id = ! empty( $_POST['uid'] ) ? absint( $_POST['uid'] ) : 0;
2270 - $htmlvar = ! empty( $_POST['htmlvar'] ) ? sanitize_key( $_POST['htmlvar'] ) : '';
2271 2181
2272 - if ( empty( $user_id ) || empty( $htmlvar ) ) {
2273 - $message = aui()->alert( array( 'type' => 'error', 'content' => __( 'Invalid data!', 'userswp' ) ) );
2274 - wp_send_json_error( array( 'message' => $message ) );
2182 + if ( empty( $user_id ) ) {
2183 + wp_die( -1 );
2275 2184 }
2276 2185
2277 - // Validate the user / admin.
2278 - if ( ! ( $user_id == (int) get_current_user_id() || current_user_can( 'manage_options' ) ) ) {
2279 - $message = aui()->alert( array( 'type' => 'error', 'content' => __( 'Invalid access!', 'userswp' ) ) );
2280 - wp_send_json_error( array( 'message' => $message ) );
2186 + if ( ! ( is_user_logged_in() && ( $user_id == (int) get_current_user_id() || current_user_can( 'manage_options' ) ) ) ) {
2187 + wp_send_json_error( __( 'Invalid access!', 'userswp' ) );
2281 2188 }
2282 2189
2283 - if ( $htmlvar == 'banner_thumb' ) {
2284 - $field_key = 'banner';
2190 + // Remove file
2191 + if ( $htmlvar == "banner_thumb" ) {
2192 + $file = uwp_get_usermeta( $user_id, 'banner_thumb' );
2285 2193 $type = 'banner';
2286 - } else if ( $htmlvar == 'avatar_thumb' ) {
2287 - $field_key = 'avatar';
2194 + } else if ( $htmlvar == "avatar_thumb" ) {
2195 + $file = uwp_get_usermeta( $user_id, 'avatar_thumb' );
2288 2196 $type = 'avatar';
2289 2197 } else {
2290 - $field_key = $htmlvar;
2198 + $file = '';
2291 2199 $type = '';
2292 2200 }
2293 2201
2294 - $field = $wpdb->get_row( $wpdb->prepare( "SELECT * FROM " . uwp_get_table_prefix() . "uwp_form_fields WHERE htmlvar_name = %s LIMIT 1", $field_key ) );
2295 -
2296 - // Check field exists.
2297 - if ( empty( $field ) ) {
2298 - $message = aui()->alert( array( 'type' => 'error', 'content' => __( 'Invalid field!', 'userswp' ) ) );
2299 - wp_send_json_error( array( 'message' => $message ) );
2300 - }
2301 -
2302 - // Validate field access.
2303 - if ( ! empty( $field->for_admin_use ) && ! current_user_can( 'manage_options' ) ) {
2304 - $message = aui()->alert( array( 'type' => 'error', 'content' => __( 'You are not allowed to perform this action!', 'userswp' ) ) );
2305 - wp_send_json_error( array( 'message' => $message ) );
2306 - }
2307 -
2308 - if ( ! in_array( $field->field_type, array( 'file', 'image' ) ) ) {
2309 - $message = aui()->alert( array( 'type' => 'error', 'content' => __( 'Invalid field type!', 'userswp' ) ) );
2310 - wp_send_json_error( array( 'message' => $message ) );
2311 - }
2312 -
2313 - $value = uwp_get_usermeta( $user_id, $htmlvar );
2314 -
2315 2202 uwp_update_usermeta( $user_id, $htmlvar, '' );
2316 2203
2317 - if ( $value ) {
2204 + if ( $file ) {
2318 2205 $uploads = wp_upload_dir();
2319 2206 $upload_path = $uploads['basedir'];
2320 - $unlink_file = untrailingslashit( $upload_path ) . '/' . ltrim( $value, '/' );
2207 + $unlink_file = untrailingslashit( $upload_path ) . '/' . ltrim( $file, '/' );
2321 2208
2322 2209 if ( is_file( $unlink_file ) && file_exists( $unlink_file ) ) {
2323 2210 @unlink( $unlink_file );
2211 + $unlink_ori_file = str_replace( '_uwp_' . $type . '_thumb' . '.', '.', $unlink_file );
2324 2212
2325 - // For avatar/banner, also remove the original (non-thumb) file.
2326 - if ( $type ) {
2327 - $unlink_ori_file = str_replace( '_uwp_' . $type . '_thumb' . '.', '.', $unlink_file );
2328 -
2329 - if ( is_file( $unlink_ori_file ) && file_exists( $unlink_ori_file ) ) {
2330 - @unlink( $unlink_ori_file );
2331 - }
2213 + if ( is_file( $unlink_ori_file ) && file_exists( $unlink_ori_file ) ) {
2214 + @unlink( $unlink_ori_file );
2332 2215 }
2333 2216 }
2334 2217 }
2335 2218
@@ -2360,15 +2243,15 @@
2360 2243
2361 2244 // If no html then we run the standard output.
2362 2245 if ( empty( $html ) ) {
2363 2246
2364 - $design_style = uwp_get_option( 'design_style', 'bootstrap' );
2365 - $bs_form_group = $design_style ? 'form-group mb-3' : '';
2366 - $bs_sr_only = $design_style ? 'sr-only' : '';
2367 - $bs_form_control = $design_style ? 'form-control' : '';
2247 + $design_style = uwp_get_option( "design_style", "bootstrap" );
2248 + $bs_form_group = $design_style ? "form-group mb-3" : "";
2249 + $bs_sr_only = $design_style ? "sr-only" : "";
2250 + $bs_form_control = $design_style ? "form-control" : "";
2368 2251 $extra_attributes = array();
2369 - $required_msg = ( ! empty( $field->is_required ) && $field->required_msg != '') ? __( stripslashes( $field->required_msg ), 'userswp' ) : '';
2370 - $validation_text = ! empty( $field->validation_msg ) ? __( stripslashes( $field->validation_msg ), 'userswp' ) : '';
2252 + $required_msg = (!empty( $field->is_required ) && $field->required_msg != '') ? __( $field->required_msg, 'userswp' ) : '';
2253 + $validation_text = !empty($field->validation_msg) ? __($field->validation_msg, 'userswp') : '';
2371 2254
2372 2255 ob_start(); // Start buffering;
2373 2256
2374 2257 $extra_fields = unserialize( $field->extra_fields );
@@ -2379,8 +2262,9 @@
2379 2262
2380 2263 $date_format = $extra_fields['date_format'];
2381 2264 $jquery_date_format = $date_format;
2382 2265
2266 +
2383 2267 // check if we need to change the format or not
2384 2268 $date_format_len = strlen( str_replace( ' ', '', $date_format ) );
2385 2269 if ( $date_format_len > 5 ) {// if greater then 5 then it's the old style format.
2386 2270
@@ -2416,24 +2300,24 @@
2416 2300 $required = ! empty( $field->is_required ) ? ' <span class="text-danger">*</span>' : '';
2417 2301
2418 2302 echo aui()->input( // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
2419 2303 array(
2420 - 'id' => esc_attr( $field->htmlvar_name ),
2421 - 'name' => esc_attr( $field->htmlvar_name ),
2422 - 'required' => ! empty( $field->is_required ) ? true : false,
2423 - 'label' => wp_kses_post( $site_title . $required ),
2424 - 'label_show' => true,
2425 - 'label_type' => 'hidden',
2426 - 'type' => 'datepicker',
2427 - 'title' => esc_html( $site_title ),
2428 - 'placeholder' => esc_attr( uwp_get_field_placeholder( $field ) ),
2429 - 'class' => '',
2430 - 'wrap_class' => isset( $field->css_class ) ? esc_attr( $field->css_class ) : '',
2431 - 'value' => esc_attr( $value ),
2432 - 'help_text' => wp_kses_post( uwp_get_field_description( $field ) ),
2433 - 'validation_text' => $validation_text != '' ? esc_attr( $validation_text ) : esc_attr( $required_msg ),
2304 + 'id' => esc_attr( $field->htmlvar_name ),
2305 + 'name' => esc_attr( $field->htmlvar_name ),
2306 + 'required' => ! empty( $field->is_required ) ? true : false,
2307 + 'label' => wp_kses_post( $site_title . $required ),
2308 + 'label_show' => true,
2309 + 'label_type' => 'hidden',
2310 + 'type' => 'datepicker',
2311 + 'title' => esc_html( $site_title ),
2312 + 'placeholder' => esc_attr( uwp_get_field_placeholder( $field ) ),
2313 + 'class' => '',
2314 + 'wrap_class' => isset( $field->css_class ) ? esc_attr( $field->css_class ) : '',
2315 + 'value' => esc_attr( $value ),
2316 + 'help_text' => wp_kses_post( uwp_get_field_description( $field ) ),
2317 + 'validation_text' => $validation_text != '' ? esc_attr( $validation_text ) : esc_attr( $required_msg ),
2434 2318 'validation_pattern' => ! empty( $field->validation_pattern ) ? esc_attr( wp_unslash( $field->validation_pattern ) ) : '',
2435 - 'extra_attributes' => $extra_attributes, // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
2319 + 'extra_attributes' => $extra_attributes // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
2436 2320 )
2437 2321 );
2438 2322 } else {
2439 2323 ?>
@@ -2439,23 +2323,21 @@
2439 2323 ?>
2440 2324 <script type="text/javascript">
2441 2325
2442 2326 jQuery(function () {
2443 - jQuery("#<?php echo esc_attr( $field->htmlvar_name ); ?>").datepicker({
2327 + jQuery("#<?php echo esc_attr( $field->htmlvar_name );?>").datepicker({
2444 2328 changeMonth: true, changeYear: true
2445 - <?php
2446 - if ( $field->htmlvar_name == 'dob' ) {
2329 + <?php if ( $field->htmlvar_name == 'dob' ) {
2447 2330 echo ", yearRange: '1900:+0'";
2448 2331 } else {
2449 - echo ", yearRange: '1900:2050'";
2450 - }
2451 - ?>
2332 + echo ", yearRange: '1900:2050'";
2333 + }?>
2452 2334 <?php echo apply_filters( "uwp_datepicker_extra_{$field->htmlvar_name}", '' ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>});
2453 2335
2454 2336 jQuery("#<?php echo esc_attr( $field->htmlvar_name ); ?>").datepicker("option", "dateFormat", '<?php echo esc_attr( $jquery_date_format ); ?>');
2455 2337
2456 - <?php if ( ! empty( $value ) ) { ?>
2457 - var parsedDate = jQuery.datepicker.parseDate('yy-mm-dd', '<?php echo esc_attr( $value ); ?>');
2338 + <?php if(! empty( $value )){?>
2339 + var parsedDate = jQuery.datepicker.parseDate('yy-mm-dd', '<?php echo esc_attr( $value );?>');
2458 2340 jQuery("#<?php echo esc_attr( $field->htmlvar_name ); ?>").datepicker("setDate", parsedDate);
2459 2341 <?php } ?>
2460 2342
2461 2343 });
@@ -2461,46 +2343,37 @@
2461 2343 });
2462 2344
2463 2345 </script>
2464 2346 <div id="<?php echo esc_attr( $field->htmlvar_name ); ?>_row"
2465 - class="
2466 - <?php
2467 - if ( $field->is_required ) {
2468 - echo 'required_field';
2469 - }
2470 - ?>
2471 - clearfix uwp_clear <?php echo esc_attr( $bs_form_group ); ?>">
2347 + class="<?php if ( $field->is_required ) {
2348 + echo 'required_field';
2349 + } ?> clearfix uwp_clear <?php echo esc_attr( $bs_form_group ); ?>">
2472 2350
2473 2351 <?php
2474 2352
2475 - if ( ! is_admin() ) {
2476 - ?>
2353 + if ( ! is_admin() ) { ?>
2477 2354 <label class="<?php echo esc_attr( $bs_sr_only ); ?>">
2478 2355 <?php echo ( trim( $site_title ) ) ? esc_html( $site_title ) : '&nbsp;'; ?>
2479 - <?php
2480 - if ( $field->is_required ) {
2356 + <?php if ( $field->is_required ) {
2481 2357 echo '<span>*</span>';
2482 - }
2483 - ?>
2358 + } ?>
2484 2359 </label>
2485 2360 <?php } ?>
2486 2361
2487 2362 <input name="<?php echo esc_attr( $field->htmlvar_name ); ?>"
2488 - id="<?php echo esc_attr( $field->htmlvar_name ); ?>"
2489 - placeholder="<?php echo esc_attr( uwp_get_field_placeholder( $field ) ); ?>"
2490 - title="<?php echo esc_attr( $site_title ); ?>"
2491 - type="text"
2492 - <?php
2493 - if ( $field->is_required == 1 ) {
2363 + id="<?php echo esc_attr( $field->htmlvar_name ); ?>"
2364 + placeholder="<?php echo esc_attr( uwp_get_field_placeholder( $field ) ); ?>"
2365 + title="<?php echo esc_attr( $site_title ); ?>"
2366 + type="text"
2367 + <?php if ( $field->is_required == 1 ) {
2494 2368 echo 'required="required"';
2495 - }
2496 - ?>
2497 - value="<?php echo esc_attr( $value ); ?>"
2498 - class="uwp_textfield <?php echo esc_attr( $bs_form_control ); ?>"/>
2369 + } ?>
2370 + value="<?php echo esc_attr( $value ); ?>"
2371 + class="uwp_textfield <?php echo esc_attr( $bs_form_control ); ?>"/>
2499 2372
2500 2373 <span class="uwp_message_note"><?php echo wp_kses_post( uwp_get_field_description( $field ) ); ?></span>
2501 2374 <?php if ( $field->is_required ) { ?>
2502 - <span class="uwp_message_error invalid-feedback"><?php echo esc_html__( stripslashes( $field->required_msg ), 'userswp' ); ?></span>
2375 + <span class="uwp_message_error invalid-feedback"><?php echo esc_html__( $field->required_msg, 'userswp' ); ?></span>
2503 2376 <?php } ?>
2504 2377 </div>
2505 2378
2506 2379 <?php
@@ -2534,14 +2407,14 @@
2534 2407
2535 2408 // If no html then we run the standard output.
2536 2409 if ( empty( $html ) ) {
2537 2410
2538 - $design_style = uwp_get_option( 'design_style', 'bootstrap' );
2539 - $bs_form_group = $design_style ? 'form-group mb-3' : '';
2540 - $bs_sr_only = $design_style ? 'sr-only' : '';
2541 - $bs_form_control = $design_style ? 'form-control bg-white' : '';
2542 - $required_msg = ( ! empty( $field->is_required ) && $field->required_msg != '') ? __( stripslashes( $field->required_msg ), 'userswp' ) : '';
2543 - $validation_text = ! empty( $field->validation_msg ) ? __( stripslashes( $field->validation_msg ), 'userswp' ) : '';
2411 + $design_style = uwp_get_option( "design_style", "bootstrap" );
2412 + $bs_form_group = $design_style ? "form-group mb-3" : "";
2413 + $bs_sr_only = $design_style ? "sr-only" : "";
2414 + $bs_form_control = $design_style ? "form-control bg-white" : "";
2415 + $required_msg = (!empty( $field->is_required ) && $field->required_msg != '') ? __( $field->required_msg, 'userswp' ) : '';
2416 + $validation_text = !empty($field->validation_msg) ? __($field->validation_msg, 'userswp') : '';
2544 2417
2545 2418 ob_start(); // Start buffering;
2546 2419
2547 2420 if ( $value != '' ) {
@@ -2559,25 +2432,25 @@
2559 2432 $required = ! empty( $field->is_required ) ? ' <span class="text-danger">*</span>' : '';
2560 2433
2561 2434 echo aui()->input( // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
2562 2435 array(
2563 - 'id' => esc_attr( $field->htmlvar_name ),
2564 - 'name' => esc_attr( $field->htmlvar_name ),
2565 - 'required' => ! empty( $field->is_required ) ? true : false,
2566 - 'label' => wp_kses_post( $site_title . $required ),
2567 - 'label_show' => true,
2568 - 'label_type' => esc_attr( $label_type ),
2569 - 'type' => 'timepicker',
2570 - 'title' => esc_html( $site_title ),
2571 - 'placeholder' => esc_attr( uwp_get_field_placeholder( $field ) ),
2572 - 'class' => '',
2573 - 'wrap_class' => isset( $field->css_class ) ? esc_attr( $field->css_class ) : '',
2574 - 'value' => esc_attr( $value ),
2575 - 'help_text' => wp_kses_post( uwp_get_field_description( $field ) ),
2576 - 'validation_text' => $validation_text != '' ? esc_attr( $validation_text ) : esc_attr( $required_msg ),
2436 + 'id' => esc_attr( $field->htmlvar_name ),
2437 + 'name' => esc_attr( $field->htmlvar_name ),
2438 + 'required' => ! empty( $field->is_required ) ? true : false,
2439 + 'label' => wp_kses_post( $site_title . $required ),
2440 + 'label_show' => true,
2441 + 'label_type' => esc_attr( $label_type ),
2442 + 'type' => 'timepicker',
2443 + 'title' => esc_html( $site_title ),
2444 + 'placeholder' => esc_attr( uwp_get_field_placeholder( $field ) ),
2445 + 'class' => '',
2446 + 'wrap_class' => isset( $field->css_class ) ? esc_attr( $field->css_class ) : '',
2447 + 'value' => esc_attr( $value ),
2448 + 'help_text' => wp_kses_post( uwp_get_field_description( $field ) ),
2449 + 'validation_text' => $validation_text != '' ? esc_attr( $validation_text ) : esc_attr( $required_msg ),
2577 2450 'validation_pattern' => ! empty( $field->validation_pattern ) ? esc_attr( wp_unslash( $field->validation_pattern ) ) : '',
2578 - 'extra_attributes' => $extra_attributes, // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
2579 - 'input_group_right' => '<div class="input-group-text px-2 bg-transparent border-0x" onclick="jQuery(this).parent().parent().find(\'input\').val(\'\');"><i class="fas fa-times uwp-search-input-label-clear text-muted c-pointer" title="' . esc_attr__( 'Clear field', 'userswp' ) . '" ></i></div>',
2451 + 'extra_attributes' => $extra_attributes, // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
2452 + 'input_group_right' => '<div class="input-group-text px-2 bg-transparent border-0x" onclick="jQuery(this).parent().parent().find(\'input\').val(\'\');"><i class="fas fa-times uwp-search-input-label-clear text-muted c-pointer" title="' . esc_attr__( 'Clear field', 'uwp-search' ) . '" ></i></div>',
2580 2453 )
2581 2454 );
2582 2455 } else {
2583 2456 ?>
@@ -2589,40 +2462,33 @@
2589 2462 });
2590 2463 });
2591 2464 </script>
2592 2465 <div id="<?php echo esc_attr( $field->htmlvar_name ); ?>_row"
2593 - class="
2594 - <?php
2595 - if ( $field->is_required ) {
2596 - echo 'required_field';
2597 - }
2598 - ?>
2599 - clearfix uwp_clear <?php echo esc_attr( $bs_form_group ); ?>">
2466 + class="<?php if ( $field->is_required ) {
2467 + echo 'required_field';
2468 + } ?> clearfix uwp_clear <?php echo esc_attr( $bs_form_group ); ?>">
2600 2469
2601 2470 <?php
2602 2471 $site_title = uwp_get_form_label( $field );
2603 - if ( ! is_admin() ) {
2604 - ?>
2472 + if ( ! is_admin() ) { ?>
2605 2473 <label class="<?php echo esc_attr( $bs_sr_only ); ?>">
2606 2474 <?php echo ( trim( $site_title ) ) ? esc_html( $site_title ) : '&nbsp;'; ?>
2607 - <?php
2608 - if ( $field->is_required ) {
2475 + <?php if ( $field->is_required ) {
2609 2476 echo '<span>*</span>';
2610 - }
2611 - ?>
2477 + } ?>
2612 2478 </label>
2613 2479 <?php } ?>
2614 2480
2615 2481 <input readonly="readonly" name="<?php echo esc_attr( $field->htmlvar_name ); ?>"
2616 - id="<?php echo esc_attr( $field->htmlvar_name ); ?>"
2617 - value="<?php echo esc_attr( $value ); ?>"
2618 - placeholder="<?php echo esc_attr( uwp_get_field_placeholder( $field ) ); ?>"
2619 - type="text"
2620 - class="uwp_textfield <?php echo esc_attr( $bs_form_control ); ?>"/>
2482 + id="<?php echo esc_attr( $field->htmlvar_name ); ?>"
2483 + value="<?php echo esc_attr( $value ); ?>"
2484 + placeholder="<?php echo esc_attr( uwp_get_field_placeholder( $field ) ); ?>"
2485 + type="text"
2486 + class="uwp_textfield <?php echo esc_attr( $bs_form_control ); ?>"/>
2621 2487
2622 2488 <span class="uwp_message_note"><?php echo wp_kses_post( uwp_get_field_description( $field ) ); ?></span>
2623 2489 <?php if ( $field->is_required ) { ?>
2624 - <span class="uwp_message_error invalid-feedback"><?php echo esc_html__( stripslashes( $field->required_msg ), 'userswp' ); ?></span>
2490 + <span class="uwp_message_error invalid-feedback"><?php echo esc_html__( $field->required_msg, 'userswp' ); ?></span>
2625 2491 <?php } ?>
2626 2492 </div>
2627 2493 <?php
2628 2494 }
@@ -2659,14 +2525,14 @@
2659 2525
2660 2526 // If no html then we run the standard output.
2661 2527 if ( empty( $html ) ) {
2662 2528
2663 - $design_style = uwp_get_option( 'design_style', 'bootstrap' );
2664 - $bs_form_group = $design_style ? 'form-group mb-3' : '';
2665 - $bs_sr_only = $design_style ? 'sr-only' : '';
2666 - $bs_form_control = $design_style ? 'form-control' : '';
2667 - $required_msg = ( ! empty( $field->is_required ) && $field->required_msg != '') ? __( stripslashes( $field->required_msg ), 'userswp' ) : '';
2668 - $validation_text = ! empty( $field->validation_msg ) ? __( stripslashes( $field->validation_msg ), 'userswp' ) : '';
2529 + $design_style = uwp_get_option( "design_style", "bootstrap" );
2530 + $bs_form_group = $design_style ? "form-group mb-3" : "";
2531 + $bs_sr_only = $design_style ? "sr-only" : "";
2532 + $bs_form_control = $design_style ? "form-control" : "";
2533 + $required_msg = (!empty( $field->is_required ) && $field->required_msg != '') ? __( $field->required_msg, 'userswp' ) : '';
2534 + $validation_text = !empty($field->validation_msg) ? __($field->validation_msg, 'userswp') : '';
2669 2535
2670 2536 ob_start(); // Start buffering;
2671 2537 $option_values_arr = uwp_string_values_to_options( $field->option_values, true );
2672 2538 $site_title = uwp_get_form_label( $field );
@@ -2675,46 +2541,37 @@
2675 2541 if ( $design_style ) {
2676 2542
2677 2543 $required = ! empty( $field->is_required ) ? ' <span class="text-danger">*</span>' : '';
2678 2544
2679 - echo aui()->select(
2680 - array( // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
2681 - 'id' => esc_attr( $field->htmlvar_name ),
2682 - 'name' => esc_attr( $field->htmlvar_name ),
2683 - 'placeholder' => esc_attr( uwp_get_field_placeholder( $field ) ),
2684 - 'title' => esc_html( $site_title ),
2685 - 'value' => esc_attr( $value ),
2686 - 'required' => (bool) $field->is_required,
2687 - 'validation_text' => $validation_text != '' ? esc_attr( $validation_text ) : esc_attr( $required_msg ),
2545 + echo aui()->select( array( // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
2546 + 'id' => esc_attr( $field->htmlvar_name ),
2547 + 'name' => esc_attr( $field->htmlvar_name ),
2548 + 'placeholder' => esc_attr( uwp_get_field_placeholder( $field ) ),
2549 + 'title' => esc_html( $site_title ),
2550 + 'value' => esc_attr( $value ),
2551 + 'required' => (bool) $field->is_required,
2552 + 'validation_text' => $validation_text != '' ? esc_attr( $validation_text ) : esc_attr( $required_msg ),
2688 2553 'validation_pattern' => ! empty( $field->validation_pattern ) ? esc_attr( wp_unslash( $field->validation_pattern ) ) : '',
2689 - 'help_text' => wp_kses_post( uwp_get_field_description( $field ) ),
2690 - 'label' => wp_kses_post( $site_title . $required ),
2691 - 'options' => $option_values_arr, // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
2692 - 'select2' => true,
2693 - 'wrap_class' => isset( $field->css_class ) ? esc_attr( $field->css_class ) : '',
2694 - )
2695 - );
2554 + 'help_text' => wp_kses_post( uwp_get_field_description( $field ) ),
2555 + 'label' => wp_kses_post( $site_title . $required ),
2556 + 'options' => $option_values_arr, // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
2557 + 'select2' => true,
2558 + 'wrap_class' => isset( $field->css_class ) ? esc_attr( $field->css_class ) : '',
2559 + ) );
2696 2560 } else {
2697 2561 ?>
2698 2562 <div id="<?php echo esc_attr( $field->htmlvar_name ); ?>_row"
2699 - class="
2700 - <?php
2701 - if ( $field->is_required ) {
2702 - echo 'required_field';
2703 - }
2704 - ?>
2705 - uwp_clear <?php echo esc_attr( $bs_form_group ); ?>">
2563 + class="<?php if ( $field->is_required ) {
2564 + echo 'required_field';
2565 + } ?> uwp_clear <?php echo esc_attr( $bs_form_group ); ?>">
2706 2566
2707 2567 <?php
2708 - if ( ! is_admin() ) {
2709 - ?>
2568 + if ( ! is_admin() ) { ?>
2710 2569 <label class="<?php echo esc_attr( $bs_sr_only ); ?>">
2711 2570 <?php echo ( trim( $site_title ) ) ? esc_html( $site_title ) : '&nbsp;'; ?>
2712 - <?php
2713 - if ( $field->is_required ) {
2571 + <?php if ( $field->is_required ) {
2714 2572 echo '<span>*</span>';
2715 - }
2716 - ?>
2573 + } ?>
2717 2574 </label>
2718 2575 <?php } ?>
2719 2576
2720 2577 <?php
@@ -2743,9 +2600,9 @@
2743 2600 ><?php echo $select_options; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>
2744 2601 </select>
2745 2602 <span class="uwp_message_note"><?php echo wp_kses_post( uwp_get_field_description( $field ) ); ?></span>
2746 2603 <?php if ( $field->is_required ) { ?>
2747 - <span class="uwp_message_error invalid-feedback"><?php echo esc_html__( stripslashes( $field->required_msg ), 'userswp' ); ?></span>
2604 + <span class="uwp_message_error invalid-feedback"><?php echo esc_html__( $field->required_msg, 'userswp' ); ?></span>
2748 2605 <?php } ?>
2749 2606 </div>
2750 2607
2751 2608 <?php
@@ -2777,14 +2634,14 @@
2777 2634 }
2778 2635
2779 2636 if ( empty( $html ) ) {
2780 2637
2781 - $design_style = uwp_get_option( 'design_style', 'bootstrap' );
2782 - $bs_form_group = $design_style ? 'form-group mb-3' : '';
2783 - $bs_sr_only = $design_style ? 'sr-only' : '';
2784 - $bs_form_control = $design_style ? 'form-control' : '';
2785 - $required_msg = ( ! empty( $field->is_required ) && $field->required_msg != '') ? __( stripslashes( $field->required_msg ), 'userswp' ) : '';
2786 - $validation_text = ! empty( $field->validation_msg ) ? __( stripslashes( $field->validation_msg ), 'userswp' ) : '';
2638 + $design_style = uwp_get_option( "design_style", "bootstrap" );
2639 + $bs_form_group = $design_style ? "form-group mb-3" : "";
2640 + $bs_sr_only = $design_style ? "sr-only" : "";
2641 + $bs_form_control = $design_style ? "form-control" : "";
2642 + $required_msg = (!empty( $field->is_required ) && $field->required_msg != '') ? __( $field->required_msg, 'userswp' ) : '';
2643 + $validation_text = !empty($field->validation_msg) ? __($field->validation_msg, 'userswp') : '';
2787 2644
2788 2645 ob_start(); // Start buffering;
2789 2646
2790 2647 $multi_display = 'select';
@@ -2793,9 +2650,9 @@
2793 2650 }
2794 2651
2795 2652 $option_values_arr = uwp_string_values_to_options( $field->option_values, true );
2796 2653 $site_title = uwp_get_form_label( $field );
2797 - $value = is_array( $value ) ? $value : esc_attr( $value );
2654 + $value = is_array($value) ? $value : esc_attr($value);
2798 2655
2799 2656 // bootstrap
2800 2657 if ( $design_style ) {
2801 2658
@@ -2800,47 +2657,38 @@
2800 2657 if ( $design_style ) {
2801 2658
2802 2659 $required = ! empty( $field->is_required ) ? ' <span class="text-danger">*</span>' : '';
2803 2660
2804 - echo aui()->select(
2805 - array( // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
2806 - 'id' => esc_attr( $field->htmlvar_name ),
2807 - 'name' => esc_attr( $field->htmlvar_name ),
2808 - 'placeholder' => esc_attr( uwp_get_field_placeholder( $field ) ),
2809 - 'title' => esc_html( $site_title ),
2810 - 'value' => $value,
2811 - 'required' => (bool) $field->is_required,
2812 - 'validation_text' => $validation_text != '' ? esc_attr( $validation_text ) : esc_attr( $required_msg ),
2661 + echo aui()->select( array( // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
2662 + 'id' => esc_attr( $field->htmlvar_name ),
2663 + 'name' => esc_attr( $field->htmlvar_name ),
2664 + 'placeholder' => esc_attr( uwp_get_field_placeholder( $field ) ),
2665 + 'title' => esc_html( $site_title ),
2666 + 'value' => $value,
2667 + 'required' => (bool) $field->is_required,
2668 + 'validation_text' => $validation_text != '' ? esc_attr( $validation_text ) : esc_attr( $required_msg ),
2813 2669 'validation_pattern' => ! empty( $field->validation_pattern ) ? esc_attr( wp_unslash( $field->validation_pattern ) ) : '',
2814 - 'help_text' => wp_kses_post( uwp_get_field_description( $field ) ),
2815 - 'label' => wp_kses_post( $site_title . $required ),
2816 - 'options' => $option_values_arr, // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
2817 - 'select2' => true,
2818 - 'multiple' => true,
2819 - 'wrap_class' => isset( $field->css_class ) ? esc_attr( $field->css_class ) : '',
2820 - )
2821 - );
2670 + 'help_text' => wp_kses_post( uwp_get_field_description( $field ) ),
2671 + 'label' => wp_kses_post( $site_title . $required ),
2672 + 'options' => $option_values_arr, // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
2673 + 'select2' => true,
2674 + 'multiple' => true,
2675 + 'wrap_class' => isset( $field->css_class ) ? esc_attr( $field->css_class ) : '',
2676 + ) );
2822 2677 } else {
2823 2678 ?>
2824 2679 <div id="<?php echo esc_attr( $field->htmlvar_name ); ?>_row"
2825 - class="
2826 - <?php
2827 - if ( $field->is_required ) {
2828 - echo 'required_field';
2829 - }
2830 - ?>
2831 - uwp_clear <?php echo esc_attr( $bs_form_group ); ?>">
2680 + class="<?php if ( $field->is_required ) {
2681 + echo 'required_field';
2682 + } ?> uwp_clear <?php echo esc_attr( $bs_form_group ); ?>">
2832 2683
2833 2684 <?php
2834 - if ( ! is_admin() ) {
2835 - ?>
2685 + if ( ! is_admin() ) { ?>
2836 2686 <label class="<?php echo esc_attr( $bs_sr_only ); ?>">
2837 2687 <?php echo ( trim( $site_title ) ) ? esc_html( $site_title ) : '&nbsp;'; ?>
2838 - <?php
2839 - if ( $field->is_required ) {
2688 + <?php if ( $field->is_required ) {
2840 2689 echo '<span>*</span>';
2841 - }
2842 - ?>
2690 + } ?>
2843 2691 </label>
2844 2692 <?php } ?>
2845 2693
2846 2694 <input type="hidden" name="<?php echo esc_attr( $field->htmlvar_name ); ?>" value=""/>
@@ -2853,65 +2701,62 @@
2853 2701 class="aui-select2 <?php echo esc_attr( $bs_form_control ); ?>"
2854 2702 >
2855 2703 <?php
2856 2704 } else {
2857 - ?>
2705 + ?>
2858 2706 <ul class="uwp_multi_choice">
2859 - <?php
2707 + <?php
2860 2708 }
2861 2709
2862 2710 $option_values_arr = uwp_string_values_to_options( $field->option_values, true );
2863 2711 $select_options = '';
2864 2712 if ( ! empty( $option_values_arr ) ) {
2865 - foreach ( $option_values_arr as $option_row ) {
2866 - if ( isset( $option_row['optgroup'] ) && ( $option_row['optgroup'] == 'start' || $option_row['optgroup'] == 'end' ) ) {
2867 - $option_label = isset( $option_row['label'] ) ? $option_row['label'] : '';
2713 + foreach ( $option_values_arr as $option_row ) {
2714 + if ( isset( $option_row['optgroup'] ) && ( $option_row['optgroup'] == 'start' || $option_row['optgroup'] == 'end' ) ) {
2715 + $option_label = isset( $option_row['label'] ) ? $option_row['label'] : '';
2868 2716
2869 - if ( $multi_display == 'select' ) {
2870 - $select_options .= $option_row['optgroup'] == 'start' ? '<optgroup label="' . esc_attr( $option_label ) . '">' : '</optgroup>';
2871 - } else {
2872 - $select_options .= $option_row['optgroup'] == 'start' ? '<li>' . $option_label . '</li>' : '';
2873 - }
2874 - } else {
2875 - $option_label = isset( $option_row['label'] ) ? $option_row['label'] : '';
2876 - $option_value = isset( $option_row['value'] ) ? $option_row['value'] : '';
2877 - $selected = $option_value == $value ? 'selected="selected"' : '';
2878 - $checked = '';
2717 + if ( $multi_display == 'select' ) {
2718 + $select_options .= $option_row['optgroup'] == 'start' ? '<optgroup label="' . esc_attr( $option_label ) . '">' : '</optgroup>';
2719 + } else {
2720 + $select_options .= $option_row['optgroup'] == 'start' ? '<li>' . $option_label . '</li>' : '';
2721 + }
2722 + } else {
2723 + $option_label = isset( $option_row['label'] ) ? $option_row['label'] : '';
2724 + $option_value = isset( $option_row['value'] ) ? $option_row['value'] : '';
2725 + $selected = $option_value == $value ? 'selected="selected"' : '';
2726 + $checked = '';
2879 2727
2880 - if ( ( ! is_array( $value ) && trim( $value ) != '' ) || ( is_array( $value ) && ! empty( $value ) ) ) {
2881 - if ( ! is_array( $value ) ) {
2882 - $value_array = explode( ',', $value );
2883 - } else {
2884 - $value_array = $value;
2885 - }
2728 + if ( ( ! is_array( $value ) && trim( $value ) != '' ) || ( is_array( $value ) && ! empty( $value ) ) ) {
2729 + if ( ! is_array( $value ) ) {
2730 + $value_array = explode( ',', $value );
2731 + } else {
2732 + $value_array = $value;
2733 + }
2886 2734
2887 - if ( is_array( $value_array ) ) {
2888 - if ( in_array( $option_value, $value_array ) ) {
2889 - $selected = 'selected="selected"';
2890 - $checked = 'checked="checked"';
2735 + if ( is_array( $value_array ) ) {
2736 + if ( in_array( $option_value, $value_array ) ) {
2737 + $selected = 'selected="selected"';
2738 + $checked = 'checked="checked"';
2739 + }
2740 + }
2891 2741 }
2742 +
2743 + if ( $multi_display == 'select' ) {
2744 + $select_options .= '<option value="' . esc_attr( $option_value ) . '" ' . $selected . '>' . $option_label . '</option>';
2745 + } else {
2746 + $select_options .= '<li><input name="' . $field->name . '[]" ' . $checked . ' value="' . esc_attr( $option_value ) . '" class="uwp-' . $multi_display . '" type="' . $multi_display . '" />&nbsp;' . $option_label . ' </li>';
2747 + }
2892 2748 }
2893 2749 }
2894 -
2895 - if ( $multi_display == 'select' ) {
2896 - $select_options .= '<option value="' . esc_attr( $option_value ) . '" ' . $selected . '>' . $option_label . '</option>';
2897 - } else {
2898 - $select_options .= '<li><input name="' . $field->name . '[]" ' . $checked . ' value="' . esc_attr( $option_value ) . '" class="uwp-' . $multi_display . '" type="' . $multi_display . '" />&nbsp;' . $option_label . ' </li>';
2899 - }
2900 2750 }
2901 - }
2902 - }
2903 2751 echo $select_options; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
2904 2752
2905 - if ( $multi_display == 'select' ) {
2906 -
2907 - ?>
2908 - </select></div>
2753 + if ( $multi_display == 'select' ) { ?></select></div>
2909 2754 <?php } else { ?>
2910 2755 </ul>
2911 2756 <?php } ?>
2912 2757 <?php if ( $field->is_required ) { ?>
2913 - <span class="uwp_message_error invalid-feedback"><?php echo esc_html__( stripslashes( $field->required_msg ), 'userswp' ); ?></span>
2758 + <span class="uwp_message_error invalid-feedback"><?php echo esc_html__( $field->required_msg, 'userswp' ); ?></span>
2914 2759 <?php } ?>
2915 2760 </div>
2916 2761 <?php
2917 2762 }
@@ -2945,45 +2790,38 @@
2945 2790
2946 2791 // If no html then we run the standard output.
2947 2792 if ( empty( $html ) ) {
2948 2793
2949 - $design_style = uwp_get_option( 'design_style', 'bootstrap' );
2794 + $design_style = uwp_get_option( "design_style", "bootstrap" );
2950 2795 $wrap_class = isset( $field->css_class ) ? $field->css_class : '';
2951 - $bs_form_group = $design_style ? 'form-group mb-3' : '';
2952 - $bs_sr_only = $design_style ? 'sr-only' : '';
2953 - $bs_form_control = $design_style ? 'form-control' : '';
2796 + $bs_form_group = $design_style ? "form-group mb-3" : "";
2797 + $bs_sr_only = $design_style ? "sr-only" : "";
2798 + $bs_form_control = $design_style ? "form-control" : "";
2954 2799
2955 2800 ob_start(); // Start buffering;
2956 2801
2957 2802 ?>
2958 2803 <div id="<?php echo esc_attr( $field->htmlvar_name ); ?>_row"
2959 - class="
2960 - <?php
2961 - if ( $field->is_required ) {
2962 - echo 'required_field';
2963 - }
2964 - ?>
2965 - uwp_form_<?php echo esc_attr( $field->field_type ); ?>_row uwp_clear <?php echo esc_attr( $bs_form_group . $wrap_class ); ?>">
2804 + class="<?php if ( $field->is_required ) {
2805 + echo 'required_field';
2806 + } ?> uwp_form_<?php echo esc_attr( $field->field_type ); ?>_row uwp_clear <?php echo esc_attr( $bs_form_group . $wrap_class ); ?>">
2966 2807
2967 2808 <?php
2968 2809 $site_title = uwp_get_form_label( $field );
2969 - if ( ! is_admin() && ! wp_doing_ajax() ) {
2970 - ?>
2810 + if ( ! is_admin() && !wp_doing_ajax() ) { ?>
2971 2811 <label class="<?php echo esc_attr( $bs_sr_only ); ?>">
2972 2812 <?php echo ( trim( $site_title ) ) ? esc_html( $site_title ) : '&nbsp;'; ?>
2973 - <?php
2974 - if ( $field->is_required ) {
2813 + <?php if ( $field->is_required ) {
2975 2814 echo ' <span class="text-danger">*</span>';
2976 - }
2977 - ?>
2815 + } ?>
2978 2816 </label>
2979 2817 <?php } ?>
2980 2818
2981 2819 <?php echo $file_obj->file_upload_preview( $field, $value ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>
2982 2820 <input name="<?php echo esc_attr( $field->htmlvar_name ); ?>"
2983 - class="<?php echo esc_attr( $field->css_class ); ?> <?php echo esc_attr( $bs_form_control ); ?>"
2984 - placeholder="<?php echo esc_attr( uwp_get_field_placeholder( $field ) ); ?>"
2985 - title="<?php echo esc_attr( $site_title ); ?>"
2821 + class="<?php echo esc_attr( $field->css_class ); ?> <?php echo esc_attr( $bs_form_control ); ?>"
2822 + placeholder="<?php echo esc_attr( uwp_get_field_placeholder( $field ) ); ?>"
2823 + title="<?php echo esc_attr( $site_title ); ?>"
2986 2824 <?php
2987 2825 if ( $field->is_required == 1 ) {
2988 2826 echo 'data-is-required="1"';
2989 2827 }
@@ -2990,12 +2828,12 @@
2990 2828 if ( $field->is_required == 1 && ! $value ) {
2991 2829 echo 'required="required"';
2992 2830 }
2993 2831 ?>
2994 - type="<?php echo esc_attr( $field->field_type ); ?>">
2832 + type="<?php echo esc_attr( $field->field_type ); ?>">
2995 2833 <span class="uwp_message_note"><?php echo wp_kses_post( uwp_get_field_description( $field ) ); ?></span>
2996 2834 <?php if ( $field->is_required ) { ?>
2997 - <span class="uwp_message_error invalid-feedback"><?php echo esc_html__( stripslashes( $field->required_msg ), 'userswp' ); ?></span>
2835 + <span class="uwp_message_error invalid-feedback"><?php echo esc_html__( $field->required_msg, 'userswp' ); ?></span>
2998 2836 <?php } ?>
2999 2837 </div>
3000 2838
3001 2839 <?php
@@ -3027,18 +2865,18 @@
3027 2865
3028 2866 // If no html then we run the standard output.
3029 2867 if ( empty( $html ) ) {
3030 2868
3031 - $design_style = uwp_get_option( 'design_style', 'bootstrap' );
3032 - $bs_form_group = $design_style ? 'form-group mb-3 form-check' : '';
3033 - $bs_sr_only = $design_style ? 'form-check-label' : '';
3034 - $bs_form_control = $design_style ? 'form-check-input' : '';
2869 + $design_style = uwp_get_option( "design_style", "bootstrap" );
2870 + $bs_form_group = $design_style ? "form-group mb-3 form-check" : "";
2871 + $bs_sr_only = $design_style ? "form-check-label" : "";
2872 + $bs_form_control = $design_style ? "form-check-input" : "";
3035 2873
3036 2874 ob_start(); // Start buffering;
3037 2875 $site_title = uwp_get_form_label( $field );
3038 2876
3039 - $design_style = uwp_get_option( 'design_style', 'bootstrap' );
3040 - $id = wp_doing_ajax() ? $field->htmlvar_name . '_ajax' : $field->htmlvar_name;
2877 + $design_style = uwp_get_option( "design_style", "bootstrap" );
2878 + $id = wp_doing_ajax() ? $field->htmlvar_name . "_ajax" : $field->htmlvar_name;
3041 2879
3042 2880 $checked = $value == '1' ? true : false;
3043 2881
3044 2882 // bootstrap
@@ -3048,20 +2886,20 @@
3048 2886 echo '<input type="hidden" name="' . esc_attr( $field->htmlvar_name ) . '" id="checkbox_' . esc_attr( $id ) . '" value="0"/>';
3049 2887
3050 2888 echo aui()->input( // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
3051 2889 array(
3052 - 'id' => esc_attr( $id ),
3053 - 'name' => esc_attr( $field->htmlvar_name ),
3054 - 'type' => 'checkbox',
3055 - 'value' => '1',
3056 - 'title' => esc_html( $site_title ),
3057 - 'label' => wp_kses_post( $site_title . $required ),
3058 - 'label_show' => true,
3059 - 'required' => ! empty( $field->is_required ) ? true : false,
3060 - 'checked' => (bool) $checked,
3061 - 'wrap_class' => isset( $field->css_class ) ? esc_attr( $field->css_class ) : '',
3062 - 'help_text' => wp_kses_post( uwp_get_field_description( $field ) ),
3063 - 'validation_text' => ! empty( $field->is_required ) ? esc_attr__( stripslashes( $field->required_msg ), 'userswp' ) : '',
2890 + 'id' => esc_attr( $id ),
2891 + 'name' => esc_attr( $field->htmlvar_name ),
2892 + 'type' => "checkbox",
2893 + 'value' => '1',
2894 + 'title' => esc_html( $site_title ),
2895 + 'label' => wp_kses_post( $site_title . $required ),
2896 + 'label_show' => true,
2897 + 'required' => ! empty( $field->is_required ) ? true : false,
2898 + 'checked' => (bool) $checked,
2899 + 'wrap_class' => isset( $field->css_class ) ? esc_attr( $field->css_class ) : '',
2900 + 'help_text' => wp_kses_post( uwp_get_field_description( $field ) ),
2901 + 'validation_text' => ! empty( $field->is_required ) ? esc_attr__( $field->required_msg, 'userswp' ) : '',
3064 2902 )
3065 2903 );
3066 2904
3067 2905 } else {
@@ -3066,44 +2904,36 @@
3066 2904
3067 2905 } else {
3068 2906 ?>
3069 2907 <div id="<?php echo esc_attr( $field->htmlvar_name ); ?>_row"
3070 - class="
3071 - <?php
3072 - if ( $field->is_required ) {
3073 - echo 'required_field';
3074 - }
3075 - ?>
3076 - uwp_form_<?php echo esc_attr( $field->field_type ); ?>_row uwp_clear <?php echo esc_attr( $bs_form_group ); ?>">
3077 - <?php if ( ! empty( $design_style ) ) { ?>
2908 + class="<?php if ( $field->is_required ) {
2909 + echo 'required_field';
2910 + } ?> uwp_form_<?php echo esc_attr( $field->field_type ); ?>_row uwp_clear <?php echo esc_attr( $bs_form_group ); ?>">
2911 + <?php if ( ! empty( $design_style ) ){ ?>
3078 2912 <label class="<?php echo esc_attr( $bs_sr_only ); ?>">
3079 2913 <?php } ?>
3080 2914 <input type="hidden" name="<?php echo esc_attr( $field->htmlvar_name ); ?>" value="0"/>
3081 2915 <input name="<?php echo esc_attr( $field->htmlvar_name ); ?>"
3082 - class="<?php echo esc_attr( $field->css_class ); ?> <?php echo esc_attr( $bs_form_control ); ?>"
3083 - placeholder="<?php echo esc_attr( uwp_get_field_placeholder( $field ) ); ?>"
3084 - title="<?php echo esc_attr( $site_title ); ?>"
3085 - <?php
3086 - if ( $field->is_required == 1 ) {
2916 + class="<?php echo esc_attr( $field->css_class ); ?> <?php echo esc_attr( $bs_form_control ); ?>"
2917 + placeholder="<?php echo esc_attr( uwp_get_field_placeholder( $field ) ); ?>"
2918 + title="<?php echo esc_attr( $site_title ); ?>"
2919 + <?php if ( $field->is_required == 1 ) {
3087 2920 echo 'required="required"';
3088 - }
3089 - ?>
3090 - <?php
3091 - if ( $value == '1' ) {
2921 + } ?>
2922 + <?php if ( $value == '1' ) {
3092 2923 echo 'checked="checked"';
3093 - }
3094 - ?>
3095 - type="<?php echo esc_attr( $field->field_type ); ?>"
3096 - value="1">
2924 + } ?>
2925 + type="<?php echo esc_attr( $field->field_type ); ?>"
2926 + value="1">
3097 2927 <?php
3098 2928 echo ( trim( $site_title ) ) ? esc_html( $site_title ) : '&nbsp;';
3099 2929 ?>
3100 - <?php if ( ! empty( $design_style ) ) { ?>
2930 + <?php if ( ! empty( $design_style ) ){ ?>
3101 2931 </label>
3102 2932 <?php } ?>
3103 2933 <span class="uwp_message_note"><?php echo wp_kses_post( uwp_get_field_description( $field ) ); ?></span>
3104 2934 <?php if ( $field->is_required ) { ?>
3105 - <span class="uwp_message_error invalid-feedback"><?php echo esc_html__( stripslashes( $field->required_msg ), 'userswp' ); ?></span>
2935 + <span class="uwp_message_error invalid-feedback"><?php echo esc_html__( $field->required_msg, 'userswp' ); ?></span>
3106 2936 <?php } ?>
3107 2937 </div>
3108 2938
3109 2939 <?php
@@ -3139,13 +2969,13 @@
3139 2969
3140 2970 // If no html then we run the standard output.
3141 2971 if ( empty( $html ) ) {
3142 2972
3143 - $design_style = uwp_get_option( 'design_style', 'bootstrap' );
3144 - $bs_form_group = $design_style ? 'form-group mb-3 form-check-inline' : '';
3145 - $bs_sr_only = $design_style ? 'sr-only' : '';
3146 - $bs_label_class = $design_style ? 'form-check-label' : '';
3147 - $bs_form_control = $design_style ? 'form-check-input' : '';
2973 + $design_style = uwp_get_option( "design_style", "bootstrap" );
2974 + $bs_form_group = $design_style ? "form-group mb-3 form-check-inline" : "";
2975 + $bs_sr_only = $design_style ? "sr-only" : "";
2976 + $bs_label_class = $design_style ? "form-check-label" : "";
2977 + $bs_form_control = $design_style ? "form-check-input" : "";
3148 2978
3149 2979 ob_start(); // Start buffering;
3150 2980
3151 2981 if ( $design_style ) {
@@ -3165,16 +2995,16 @@
3165 2995 echo aui()->radio( // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
3166 2996 array(
3167 2997 'id' => esc_attr( $field->htmlvar_name ),
3168 2998 'name' => esc_attr( $field->htmlvar_name ),
3169 - 'type' => 'radio',
2999 + 'type' => "radio",
3170 3000 'title' => esc_html( $site_title ),
3171 - 'label' => is_admin() && ! wp_doing_ajax() ? '' : wp_kses_post( $site_title . $required ),
3001 + 'label' => is_admin() && !wp_doing_ajax() ? '' : wp_kses_post( $site_title . $required ),
3172 3002 'label_type' => 'top',
3173 3003 'class' => '',
3174 3004 'wrap_class' => isset( $field->css_class ) ? esc_attr( $field->css_class ) : '',
3175 3005 'value' => esc_attr( $value ),
3176 - 'options' => $option_values, // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
3006 + 'options' => $option_values // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
3177 3007 )
3178 3008 );
3179 3009
3180 3010 } else {
@@ -3180,32 +3010,24 @@
3180 3010 } else {
3181 3011
3182 3012 ?>
3183 3013 <div id="<?php echo esc_attr( $field->htmlvar_name ); ?>_row"
3184 - class="
3185 - <?php
3186 - if ( $field->is_required ) {
3187 - echo 'required_field';
3188 - }
3189 - ?>
3190 - uwp_form_<?php echo esc_attr( $field->field_type ); ?>_row uwp_clear <?php echo esc_attr( $bs_form_group ); ?>">
3014 + class="<?php if ( $field->is_required ) {
3015 + echo 'required_field';
3016 + } ?> uwp_form_<?php echo esc_attr( $field->field_type ); ?>_row uwp_clear <?php echo esc_attr( $bs_form_group ); ?>">
3191 3017
3192 3018 <?php
3193 3019 $site_title = uwp_get_form_label( $field );
3194 - if ( ! is_admin() ) {
3195 - ?>
3020 + if ( ! is_admin() ) { ?>
3196 3021 <label class="<?php echo esc_attr( $bs_sr_only ); ?>">
3197 3022 <?php echo ( trim( $site_title ) ) ? esc_html( $site_title ) : '&nbsp;'; ?>
3198 - <?php
3199 - if ( $field->is_required ) {
3023 + <?php if ( $field->is_required ) {
3200 3024 echo '<span>*</span>';
3201 - }
3202 - ?>
3025 + } ?>
3203 3026 </label>
3204 3027 <?php } ?>
3205 3028
3206 - <?php
3207 - if ( $field->option_values ) {
3029 + <?php if ( $field->option_values ) {
3208 3030 $option_values = uwp_string_values_to_options( $field->option_values, true );
3209 3031
3210 3032 if ( ! empty( $option_values ) ) {
3211 3033 $count = 0;
@@ -3210,13 +3032,13 @@
3210 3032 if ( ! empty( $option_values ) ) {
3211 3033 $count = 0;
3212 3034 foreach ( $option_values as $option_value ) {
3213 3035 if ( empty( $option_value['optgroup'] ) ) {
3214 - ++$count;
3036 + $count ++;
3215 3037 if ( $count == 1 ) {
3216 - $class = 'uwp-radio-first';
3038 + $class = "uwp-radio-first";
3217 3039 } else {
3218 - $class = '';
3040 + $class = "";
3219 3041 }
3220 3042 ?>
3221 3043 <?php if ( ! empty( $design_style ) ) { ?>
3222 3044 <label class="<?php echo esc_attr( $bs_label_class ); ?>">
@@ -3223,18 +3045,16 @@
3223 3045 <?php } else { ?>
3224 3046 <span class="uwp-radios <?php echo esc_attr( $class ); ?>">
3225 3047 <?php } ?>
3226 3048 <input name="<?php echo esc_attr( $field->htmlvar_name ); ?>"
3227 - id="<?php echo esc_attr( $field->htmlvar_name ); ?>"
3228 - title="<?php echo esc_attr( $option_value['label'] ); ?>"
3049 + id="<?php echo esc_attr( $field->htmlvar_name ); ?>"
3050 + title="<?php echo esc_attr( $option_value['label'] ); ?>"
3229 3051 <?php checked( $value, $option_value['value'] ); ?>
3230 - <?php
3231 - if ( $field->is_required == 1 ) {
3052 + <?php if ( $field->is_required == 1 ) {
3232 3053 echo 'required="required"';
3233 - }
3234 - ?>
3235 - value="<?php echo esc_attr( $option_value['value'] ); ?>"
3236 - class="uwp-radio <?php echo esc_attr( $bs_form_control ); ?>" type="radio"/>
3054 + } ?>
3055 + value="<?php echo esc_attr( $option_value['value'] ); ?>"
3056 + class="uwp-radio <?php echo esc_attr( $bs_form_control ); ?>" type="radio"/>
3237 3057 <?php echo esc_html( $option_value['label'] ); ?>
3238 3058 <?php if ( ! empty( $design_style ) ) { ?>
3239 3059 </label>
3240 3060 <?php } else { ?>
@@ -3247,9 +3067,9 @@
3247 3067 }
3248 3068 ?>
3249 3069 <span class="uwp_message_note"><?php echo wp_kses_post( uwp_get_field_description( $field ) ); ?></span>
3250 3070 <?php if ( $field->is_required ) { ?>
3251 - <span class="uwp_message_error invalid-feedback"><?php echo esc_html__( stripslashes( $field->required_msg ), 'userswp' ); ?></span>
3071 + <span class="uwp_message_error invalid-feedback"><?php echo esc_html__( $field->required_msg, 'userswp' ); ?></span>
3252 3072 <?php } ?>
3253 3073 </div>
3254 3074 <?php
3255 3075 }
@@ -3292,140 +3112,125 @@
3292 3112 $type = 'number';
3293 3113 } elseif ( isset( $field->data_type ) && $field->data_type == 'FLOAT' ) {
3294 3114 $dp = $field->decimal_point;
3295 3115 switch ( $dp ) {
3296 - case '1':
3297 - $step = '0.1';
3116 + case "1":
3117 + $step = "0.1";
3298 3118 break;
3299 - case '2':
3300 - $step = '0.01';
3119 + case "2":
3120 + $step = "0.01";
3301 3121 break;
3302 - case '3':
3303 - $step = '0.001';
3122 + case "3":
3123 + $step = "0.001";
3304 3124 break;
3305 - case '4':
3306 - $step = '0.0001';
3125 + case "4":
3126 + $step = "0.0001";
3307 3127 break;
3308 - case '5':
3309 - $step = '0.00001';
3128 + case "5":
3129 + $step = "0.00001";
3310 3130 break;
3311 - case '6':
3312 - $step = '0.000001';
3131 + case "6":
3132 + $step = "0.000001";
3313 3133 break;
3314 - case '7':
3315 - $step = '0.0000001';
3134 + case "7":
3135 + $step = "0.0000001";
3316 3136 break;
3317 - case '8':
3318 - $step = '0.00000001';
3137 + case "8":
3138 + $step = "0.00000001";
3319 3139 break;
3320 - case '9':
3321 - $step = '0.000000001';
3140 + case "9":
3141 + $step = "0.000000001";
3322 3142 break;
3323 - case '10':
3324 - $step = '0.0000000001';
3143 + case "10":
3144 + $step = "0.0000000001";
3325 3145 break;
3326 3146 default:
3327 - $step = '0.01';
3147 + $step = "0.01";
3328 3148 break;
3329 3149 }
3330 3150 $type = 'number';
3331 3151 }
3332 3152
3153 +
3333 3154 $site_title = uwp_get_form_label( $field );
3334 3155 $placeholder = uwp_get_field_placeholder( $field );
3335 3156 $manual_label = apply_filters( 'uwp_login_username_label_manual', true );
3336 3157 if ( $manual_label
3337 - && isset( $field->form_type )
3338 - && $field->form_type == 'login'
3339 - && $field->htmlvar_name == 'username' ) {
3340 - $site_title = __( 'Username or Email', 'userswp' );
3158 + && isset( $field->form_type )
3159 + && $field->form_type == 'login'
3160 + && $field->htmlvar_name == 'username' ) {
3161 + $site_title = __( "Username or Email", 'userswp' );
3341 3162 $required = ! empty( $field->is_required ) ? ' *' : '';
3342 3163 $placeholder = $site_title . $required;
3343 3164 $placeholder = apply_filters( 'uwp_get_field_placeholder', stripslashes( $placeholder ), $field );
3344 3165 }
3345 3166
3346 - $design_style = uwp_get_option( 'design_style', 'bootstrap' );
3347 - $bs_form_group = $design_style ? 'form-group mb-3' : '';
3348 - $bs_sr_only = $design_style ? 'sr-only' : '';
3349 - $bs_form_control = $design_style ? 'form-control' : '';
3167 + $design_style = uwp_get_option( "design_style", "bootstrap" );
3168 + $bs_form_group = $design_style ? "form-group mb-3" : "";
3169 + $bs_sr_only = $design_style ? "sr-only" : "";
3170 + $bs_form_control = $design_style ? "form-control" : "";
3350 3171
3351 - $required_msg = ( ! empty( $field->is_required ) && $field->required_msg != '') ? __( stripslashes( $field->required_msg ), 'userswp' ) : '';
3352 - $validation_text = ! empty( $field->validation_msg ) ? __( stripslashes( $field->validation_msg ), 'userswp' ) : '';
3172 + $required_msg = (!empty( $field->is_required ) && $field->required_msg != '') ? __( $field->required_msg, 'userswp' ) : '';
3173 + $validation_text = !empty($field->validation_msg) ? __($field->validation_msg, 'userswp') : '';
3353 3174
3354 3175 // bootstrap
3355 3176 if ( $design_style ) {
3356 3177 $required = ! empty( $field->is_required ) ? ' <span class="text-danger">*</span>' : '';
3357 3178
3358 - echo aui()->input(
3359 - array( // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
3360 - 'type' => esc_attr( $type ),
3361 - 'id' => esc_attr( $field->htmlvar_name ),
3362 - 'name' => esc_attr( $field->htmlvar_name ),
3363 - 'placeholder' => esc_attr( $placeholder ),
3364 - 'title' => esc_html( $site_title ),
3365 - 'value' => esc_attr( wp_unslash( $value ) ),
3366 - 'required' => (bool) $field->is_required,
3367 - 'validation_text' => $validation_text != '' ? esc_attr( $validation_text ) : esc_attr( $required_msg ),
3179 + echo aui()->input( array( // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
3180 + 'type' => esc_attr( $type ),
3181 + 'id' => esc_attr( $field->htmlvar_name ),
3182 + 'name' => esc_attr( $field->htmlvar_name ),
3183 + 'placeholder' => esc_attr( $placeholder ),
3184 + 'title' => esc_html( $site_title ),
3185 + 'value' => esc_attr( wp_unslash( $value ) ),
3186 + 'required' => (bool) $field->is_required,
3187 + 'validation_text' => $validation_text != '' ? esc_attr( $validation_text ) : esc_attr( $required_msg ),
3368 3188 'validation_pattern' => ! empty( $field->validation_pattern ) ? esc_attr( wp_unslash( $field->validation_pattern ) ) : '',
3369 - 'help_text' => wp_kses_post( uwp_get_field_description( $field ) ),
3370 - 'label' => is_admin() && ! wp_doing_ajax() ? '' : wp_kses_post( $site_title . $required ),
3371 - 'step' => esc_attr( $step ),
3372 - 'wrap_class' => isset( $field->css_class ) ? esc_attr( $field->css_class ) : '',
3373 - )
3374 - );
3189 + 'help_text' => wp_kses_post( uwp_get_field_description( $field ) ),
3190 + 'label' => is_admin() && !wp_doing_ajax() ? '' : wp_kses_post( $site_title . $required ),
3191 + 'step' => esc_attr( $step ),
3192 + 'wrap_class' => isset( $field->css_class ) ? esc_attr( $field->css_class ) : '',
3193 + ) );
3375 3194 } else {
3376 3195 ?>
3377 - <div id="<?php echo esc_attr( $field->htmlvar_name ); ?>_row" class="
3378 - <?php
3379 - if ( $field->is_required ) {
3380 - echo 'required_field';
3381 - }
3382 - ?>
3383 - uwp_form_<?php echo esc_attr( $field->field_type ); ?>_row uwp_clear <?php echo esc_attr( $bs_form_group ); ?>">
3196 + <div id="<?php echo esc_attr( $field->htmlvar_name ); ?>_row" class="<?php if ( $field->is_required ) {
3197 + echo 'required_field';
3198 + } ?> uwp_form_<?php echo esc_attr( $field->field_type ); ?>_row uwp_clear <?php echo esc_attr( $bs_form_group ); ?>">
3384 3199 <?php
3385 3200
3386 - if ( ! is_admin() ) {
3387 - ?>
3201 + if ( ! is_admin() ) { ?>
3388 3202 <label class="<?php echo esc_attr( $bs_sr_only ); ?>">
3389 3203 <?php echo ( trim( $site_title ) ) ? esc_html( $site_title ) : '&nbsp;'; ?>
3390 - <?php
3391 - if ( $field->is_required ) {
3204 + <?php if ( $field->is_required ) {
3392 3205 echo '<span>*</span>';
3393 - }
3394 - ?>
3206 + } ?>
3395 3207 </label>
3396 - <?php
3397 - }
3208 + <?php }
3398 3209 ?>
3399 3210
3400 3211 <input name="<?php echo esc_attr( $field->htmlvar_name ); ?>"
3401 - class="<?php echo esc_attr( $field->css_class ); ?> uwp_textfield <?php echo esc_attr( $bs_form_control ); ?>"
3402 - id="<?php echo esc_attr( $field->htmlvar_name ); ?>"
3403 - placeholder="<?php echo esc_attr( uwp_get_field_placeholder( $field ) ); ?>"
3404 - value="<?php echo esc_attr( stripslashes( $value ) ); ?>"
3405 - title="<?php echo esc_attr( $site_title ); ?>"
3406 - oninvalid="this.setCustomValidity('<?php esc_attr_e( stripslashes( $field->required_msg ), 'userswp' ); ?>')"
3407 - oninput="setCustomValidity('')"
3408 - <?php
3409 - if ( $field->is_required == 1 ) {
3212 + class="<?php echo esc_attr( $field->css_class ); ?> uwp_textfield <?php echo esc_attr( $bs_form_control ); ?>"
3213 + id="<?php echo esc_attr( $field->htmlvar_name ); ?>"
3214 + placeholder="<?php echo esc_attr( uwp_get_field_placeholder( $field ) ); ?>"
3215 + value="<?php echo esc_attr( stripslashes( $value ) ); ?>"
3216 + title="<?php echo esc_attr( $site_title ); ?>"
3217 + oninvalid="this.setCustomValidity('<?php esc_attr_e( $field->required_msg, 'userswp' ); ?>')"
3218 + oninput="setCustomValidity('')"
3219 + <?php if ( $field->is_required == 1 ) {
3410 3220 echo 'required="required"';
3411 - }
3412 - ?>
3413 - <?php
3414 - if ( $field->for_admin_use == 1 ) {
3221 + } ?>
3222 + <?php if ( $field->for_admin_use == 1 ) {
3415 3223 echo 'readonly="readonly"';
3416 - }
3417 - ?>
3418 - type="<?php echo esc_attr( $type ); ?>"
3419 - <?php
3420 - if ( $step ) {
3224 + } ?>
3225 + type="<?php echo esc_attr( $type ); ?>"
3226 + <?php if ( $step ) {
3421 3227 echo 'step="' . esc_attr( $step ) . '"';
3422 - }
3423 - ?>
3228 + } ?>
3424 3229 />
3425 3230 <span class="uwp_message_note"><?php echo wp_kses_post( uwp_get_field_description( $field ) ); ?></span>
3426 3231 <?php if ( $field->is_required ) { ?>
3427 - <span class="uwp_message_error invalid-feedback"><?php echo esc_html__( stripslashes( $field->required_msg ), 'userswp' ); ?></span>
3232 + <span class="uwp_message_error invalid-feedback"><?php echo esc_html__( $field->required_msg, 'userswp' ); ?></span>
3428 3233 <?php } ?>
3429 3234 </div>
3430 3235
3431 3236
@@ -3459,12 +3264,12 @@
3459 3264
3460 3265 // If no html then we run the standard output.
3461 3266 if ( empty( $html ) ) {
3462 3267
3463 - $design_style = uwp_get_option( 'design_style', 'bootstrap' );
3464 - $bs_form_group = $design_style ? 'form-group mb-3' : '';
3465 - $bs_sr_only = $design_style ? 'sr-only' : '';
3466 - $bs_form_control = $design_style ? 'form-control' : '';
3268 + $design_style = uwp_get_option( "design_style", "bootstrap" );
3269 + $bs_form_group = $design_style ? "form-group mb-3" : "";
3270 + $bs_sr_only = $design_style ? "sr-only" : "";
3271 + $bs_form_control = $design_style ? "form-control" : "";
3467 3272 $site_title = uwp_get_form_label( $field );
3468 3273
3469 3274 ob_start(); // Start buffering;
3470 3275
@@ -3471,10 +3276,9 @@
3471 3276 // bootstrap
3472 3277 if ( $design_style ) {
3473 3278 $required = ! empty( $field->is_required ) ? ' <span class="text-danger">*</span>' : '';
3474 3279
3475 - echo aui()->textarea(
3476 - array( // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
3280 + echo aui()->textarea( array( // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
3477 3281 'id' => esc_attr( $field->htmlvar_name ),
3478 3282 'name' => esc_attr( $field->htmlvar_name ),
3479 3283 'placeholder' => esc_attr( uwp_get_field_placeholder( $field ) ),
3480 3284 'title' => esc_html( $site_title ),
@@ -3479,57 +3283,47 @@
3479 3283 'placeholder' => esc_attr( uwp_get_field_placeholder( $field ) ),
3480 3284 'title' => esc_html( $site_title ),
3481 3285 'value' => wp_kses_post( stripslashes( $value ) ),
3482 3286 'required' => (bool) $field->is_required,
3483 - 'validation_text' => ! empty( $field->is_required ) ? esc_attr__( stripslashes( $field->required_msg ), 'userswp' ) : '',
3287 + 'validation_text' => ! empty( $field->is_required ) ? esc_attr__( $field->required_msg, 'userswp' ) : '',
3484 3288 'help_text' => wp_kses_post( uwp_get_field_description( $field ) ),
3485 - 'label' => is_admin() && ! wp_doing_ajax() ? '' : wp_kses_post( $site_title . $required ),
3289 + 'label' => is_admin() && !wp_doing_ajax() ? '' : wp_kses_post( $site_title . $required ),
3486 3290 'rows' => '4',
3487 3291 'wrap_class' => isset( $field->css_class ) ? esc_attr( $field->css_class ) : '',
3488 - )
3489 - );
3292 + ) );
3490 3293 } else {
3491 3294 ?>
3492 3295
3493 3296 <div id="<?php echo esc_attr( $field->htmlvar_name ); ?>_row"
3494 - class="
3495 - <?php
3496 - if ( $field->is_required ) {
3497 - echo 'required_field';
3498 - }
3499 - ?>
3500 - uwp_form_<?php echo esc_attr( $field->field_type ); ?>_row uwp_clear <?php echo esc_attr( $bs_form_group ); ?>">
3297 + class="<?php if ( $field->is_required ) {
3298 + echo 'required_field';
3299 + } ?> uwp_form_<?php echo esc_attr( $field->field_type ); ?>_row uwp_clear <?php echo esc_attr( $bs_form_group ); ?>">
3501 3300
3502 3301 <?php
3503 3302
3504 - if ( ! is_admin() ) {
3505 - ?>
3303 + if ( ! is_admin() ) { ?>
3506 3304 <label class="<?php echo esc_attr( $bs_sr_only ); ?>">
3507 3305 <?php echo ( trim( $site_title ) ) ? esc_html( $site_title ) : '&nbsp;'; ?>
3508 - <?php
3509 - if ( $field->is_required ) {
3306 + <?php if ( $field->is_required ) {
3510 3307 echo '<span>*</span>';
3511 - }
3512 - ?>
3308 + } ?>
3513 3309 </label>
3514 3310 <?php } ?>
3515 3311
3516 3312 <textarea name="<?php echo esc_attr( $field->htmlvar_name ); ?>"
3517 - class="<?php echo esc_attr( $field->css_class ); ?> <?php echo esc_attr( $bs_form_control ); ?>"
3518 - placeholder="<?php echo esc_attr( uwp_get_field_placeholder( $field ) ); ?>"
3519 - title="<?php echo esc_attr( $site_title ); ?>"
3520 - oninvalid="this.setCustomValidity('<?php esc_attr_e( stripslashes( $field->required_msg ), 'userswp' ); ?>')"
3521 - oninput="setCustomValidity('')"
3522 - <?php
3523 - if ( $field->is_required == 1 ) {
3313 + class="<?php echo esc_attr( $field->css_class ); ?> <?php echo esc_attr( $bs_form_control ); ?>"
3314 + placeholder="<?php echo esc_attr( uwp_get_field_placeholder( $field ) ); ?>"
3315 + title="<?php echo esc_attr( $site_title ); ?>"
3316 + oninvalid="this.setCustomValidity('<?php esc_attr_e( $field->required_msg, 'userswp' ); ?>')"
3317 + oninput="setCustomValidity('')"
3318 + <?php if ( $field->is_required == 1 ) {
3524 3319 echo 'required="required"';
3525 - }
3526 - ?>
3527 - type="<?php echo esc_attr( $field->field_type ); ?>"
3528 - rows="4"><?php echo wp_kses_post( stripslashes( $value ) ); ?></textarea>
3320 + } ?>
3321 + type="<?php echo esc_attr( $field->field_type ); ?>"
3322 + rows="4"><?php echo wp_kses_post( stripslashes( $value ) ); ?></textarea>
3529 3323 <span class="uwp_message_note"><?php echo wp_kses_post( uwp_get_field_description( $field ) ); ?></span>
3530 3324 <?php if ( $field->is_required ) { ?>
3531 - <span class="uwp_message_error invalid-feedback"><?php echo esc_html__( stripslashes( $field->required_msg ), 'userswp' ); ?></span>
3325 + <span class="uwp_message_error invalid-feedback"><?php echo esc_html__( $field->required_msg, 'userswp' ); ?></span>
3532 3326 <?php } ?>
3533 3327 </div>
3534 3328
3535 3329 <?php
@@ -3550,11 +3344,11 @@
3550 3344 if ( empty( $html ) ) {
3551 3345
3552 3346 ob_start();
3553 3347
3554 - $design_style = uwp_get_option( 'design_style', 'bootstrap' );
3555 - $bs_form_group = $design_style ? 'form-group mb-3' : '';
3556 - $bs_sr_only = $design_style ? 'sr-only' : '';
3348 + $design_style = uwp_get_option( "design_style", "bootstrap" );
3349 + $bs_form_group = $design_style ? "form-group mb-3" : "";
3350 + $bs_sr_only = $design_style ? "sr-only" : "";
3557 3351 $site_title = uwp_get_form_label( $field );
3558 3352
3559 3353 $content = stripslashes( $value );
3560 3354 $editor_id = $field->htmlvar_name;
@@ -3563,54 +3357,45 @@
3563 3357 'media_buttons' => false,
3564 3358 'quicktags' => false,
3565 3359 );
3566 3360
3567 - $required_msg = ( ! empty( $field->is_required ) && $field->required_msg != '') ? __( stripslashes( $field->required_msg ), 'userswp' ) : '';
3568 - $validation_text = ! empty( $field->validation_msg ) ? __( stripslashes( $field->validation_msg ), 'userswp' ) : '';
3361 + $required_msg = (!empty( $field->is_required ) && $field->required_msg != '') ? __( $field->required_msg, 'userswp' ) : '';
3362 + $validation_text = !empty($field->validation_msg) ? __($field->validation_msg, 'userswp') : '';
3569 3363
3570 3364 // bootstrap
3571 3365 if ( $design_style ) {
3572 3366 $required = ! empty( $field->is_required ) ? ' <span class="text-danger">*</span>' : '';
3573 3367
3574 - echo aui()->textarea(
3575 - array( // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
3576 - 'id' => esc_attr( $field->htmlvar_name ),
3577 - 'name' => esc_attr( $field->htmlvar_name ),
3578 - 'placeholder' => esc_attr( uwp_get_field_placeholder( $field ) ),
3579 - 'title' => esc_html( $site_title ),
3580 - 'value' => wp_kses_post( stripslashes( $value ) ),
3581 - 'required' => (bool) $field->is_required,
3582 - 'validation_text' => $validation_text != '' ? esc_attr( $validation_text ) : esc_attr( $required_msg ),
3368 + echo aui()->textarea( array( // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
3369 + 'id' => esc_attr( $field->htmlvar_name ),
3370 + 'name' => esc_attr( $field->htmlvar_name ),
3371 + 'placeholder' => esc_attr( uwp_get_field_placeholder( $field ) ),
3372 + 'title' => esc_html( $site_title ),
3373 + 'value' => wp_kses_post( stripslashes( $value ) ),
3374 + 'required' => (bool) $field->is_required,
3375 + 'validation_text' => $validation_text != '' ? esc_attr( $validation_text ) : esc_attr( $required_msg ),
3583 3376 'validation_pattern' => ! empty( $field->validation_pattern ) ? esc_attr( wp_unslash( $field->validation_pattern ) ) : '',
3584 - 'help_text' => wp_kses_post( uwp_get_field_description( $field ) ),
3585 - 'label' => is_admin() && ! wp_doing_ajax() ? '' : wp_kses_post( $site_title . $required ),
3586 - 'rows' => 5,
3587 - 'wysiwyg' => true,
3588 - 'wrap_class' => isset( $field->css_class ) ? esc_attr( $field->css_class ) : '',
3589 - )
3590 - );
3377 + 'help_text' => wp_kses_post( uwp_get_field_description( $field ) ),
3378 + 'label' => is_admin() && !wp_doing_ajax() ? '' : wp_kses_post( $site_title . $required ),
3379 + 'rows' => 5,
3380 + 'wysiwyg' => true,
3381 + 'wrap_class' => isset( $field->css_class ) ? esc_attr( $field->css_class ) : '',
3382 + ) );
3591 3383 } else {
3592 3384 ?>
3593 3385 <div id="<?php echo esc_attr( $field->htmlvar_name ); ?>_row"
3594 - class="
3595 - <?php
3596 - if ( $field->is_required ) {
3597 - echo 'required_field';
3598 - }
3599 - ?>
3600 - uwp_form_<?php echo esc_attr( $field->field_type ); ?>_row uwp_clear <?php echo esc_attr( $bs_form_group ); ?>">
3386 + class="<?php if ( $field->is_required ) {
3387 + echo 'required_field';
3388 + } ?> uwp_form_<?php echo esc_attr( $field->field_type ); ?>_row uwp_clear <?php echo esc_attr( $bs_form_group ); ?>">
3601 3389
3602 3390 <?php
3603 3391
3604 - if ( ! is_admin() ) {
3605 - ?>
3392 + if ( ! is_admin() ) { ?>
3606 3393 <label class="<?php echo esc_attr( $bs_sr_only ); ?>">
3607 3394 <?php echo ( trim( $site_title ) ) ? esc_html( $site_title ) : '&nbsp;'; ?>
3608 - <?php
3609 - if ( $field->is_required ) {
3395 + <?php if ( $field->is_required ) {
3610 3396 echo '<span>*</span>';
3611 - }
3612 - ?>
3397 + } ?>
3613 3398 </label>
3614 3399 <?php } ?>
3615 3400
3616 3401 <?php wp_editor( $content, $editor_id, $args ); ?>
@@ -3616,9 +3401,9 @@
3616 3401 <?php wp_editor( $content, $editor_id, $args ); ?>
3617 3402
3618 3403 <span class="uwp_message_note"><?php echo wp_kses_post( uwp_get_field_description( $field ) ); ?></span>
3619 3404 <?php if ( $field->is_required ) { ?>
3620 - <span class="uwp_message_error invalid-feedback"><?php echo esc_html__( stripslashes( $field->required_msg ), 'userswp' ); ?></span>
3405 + <span class="uwp_message_error invalid-feedback"><?php echo esc_html__( $field->required_msg, 'userswp' ); ?></span>
3621 3406 <?php } ?>
3622 3407 </div>
3623 3408 <?php
3624 3409 }
@@ -3654,14 +3439,11 @@
3654 3439 $site_title = uwp_get_form_label( $field );
3655 3440 ?>
3656 3441 <h3 class="uwp_input_fieldset <?php echo esc_attr( $field->css_class ); ?>">
3657 3442 <?php echo esc_html( $site_title ); ?>
3658 - <?php
3659 - if ( $field->help_text != '' ) {
3443 + <?php if ( $field->help_text != '' ) {
3660 3444 echo '<small>( ' . wp_kses_post( $field->help_text ) . ' )</small>';
3661 - }
3662 - ?>
3663 - </h3>
3445 + } ?></h3>
3664 3446 <?php
3665 3447 $html = ob_get_clean();
3666 3448 }
3667 3449
@@ -3682,8 +3464,9 @@
3682 3464 * @since 1.0.0
3683 3465 */
3684 3466 public function form_input_url( $html, $field, $value, $form_type ) {
3685 3467
3468 +
3686 3469 // Check if there is a custom field specific filter.
3687 3470 if ( has_filter( "uwp_form_input_url_{$field->htmlvar_name}" ) ) {
3688 3471 $html = apply_filters( "uwp_form_input_url_{$field->htmlvar_name}", $html, $field, $value, $form_type );
3689 3472 }
@@ -3690,84 +3473,70 @@
3690 3473
3691 3474 // If no html then we run the standard output.
3692 3475 if ( empty( $html ) ) {
3693 3476
3694 - $design_style = uwp_get_option( 'design_style', 'bootstrap' );
3695 - $bs_form_group = $design_style ? 'form-group mb-3' : '';
3696 - $bs_sr_only = $design_style ? 'sr-only' : '';
3697 - $bs_form_control = $design_style ? 'form-control' : '';
3477 + $design_style = uwp_get_option( "design_style", "bootstrap" );
3478 + $bs_form_group = $design_style ? "form-group mb-3" : "";
3479 + $bs_sr_only = $design_style ? "sr-only" : "";
3480 + $bs_form_control = $design_style ? "form-control" : "";
3698 3481
3699 3482 ob_start(); // Start buffering;
3700 3483 $site_title = uwp_get_form_label( $field );
3701 - $required_msg = ( ! empty( $field->is_required ) && $field->required_msg != '') ? __( stripslashes( $field->required_msg ), 'userswp' ) : __( 'Please enter a valid URL including https://', 'userswp' );
3702 - $validation_text = ! empty( $field->validation_msg ) ? __( stripslashes( $field->validation_msg ), 'userswp' ) : '';
3484 + $required_msg = (!empty( $field->is_required ) && $field->required_msg != '') ? __( $field->required_msg, 'userswp' ) : __( 'Please enter a valid URL including https://', 'userswp' );
3485 + $validation_text = !empty($field->validation_msg) ? __($field->validation_msg, 'userswp') : '';
3703 3486
3704 3487 // bootstrap
3705 3488 if ( $design_style ) {
3706 3489 $required = ! empty( $field->is_required ) ? ' <span class="text-danger">*</span>' : '';
3707 3490
3708 - echo aui()->input(
3709 - array( // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
3710 - 'type' => 'url',
3711 - 'id' => esc_attr( $field->htmlvar_name ),
3712 - 'name' => esc_attr( $field->htmlvar_name ),
3713 - 'placeholder' => esc_attr( uwp_get_field_placeholder( $field ) ),
3714 - 'title' => esc_html( $site_title ),
3715 - 'value' => esc_attr( $value ),
3716 - 'required' => (bool) $field->is_required,
3717 - 'validation_text' => $validation_text != '' ? esc_attr( $validation_text ) : esc_attr( $required_msg ),
3491 + echo aui()->input( array( // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
3492 + 'type' => 'url',
3493 + 'id' => esc_attr( $field->htmlvar_name ),
3494 + 'name' => esc_attr( $field->htmlvar_name ),
3495 + 'placeholder' => esc_attr( uwp_get_field_placeholder( $field ) ),
3496 + 'title' => esc_html( $site_title ),
3497 + 'value' => esc_attr( $value ),
3498 + 'required' => (bool) $field->is_required,
3499 + 'validation_text' => $validation_text != '' ? esc_attr( $validation_text ) : esc_attr( $required_msg ),
3718 3500 'validation_pattern' => ! empty( $field->validation_pattern ) ? esc_attr( wp_unslash( $field->validation_pattern ) ) : '',
3719 - 'help_text' => wp_kses_post( uwp_get_field_description( $field ) ),
3720 - 'label' => is_admin() && ! wp_doing_ajax() ? '' : wp_kses_post( $site_title . $required ),
3721 - 'wrap_class' => isset( $field->css_class ) ? esc_attr( $field->css_class ) : '',
3722 - )
3723 - );
3501 + 'help_text' => wp_kses_post( uwp_get_field_description( $field ) ),
3502 + 'label' => is_admin() && !wp_doing_ajax() ? '' : wp_kses_post( $site_title . $required ),
3503 + 'wrap_class' => isset( $field->css_class ) ? esc_attr( $field->css_class ) : '',
3504 + ) );
3724 3505 } else {
3725 3506 ?>
3726 3507 <div id="<?php echo esc_attr( $field->htmlvar_name ); ?>_row"
3727 - class="
3728 - <?php
3729 - if ( $field->is_required ) {
3730 - echo 'required_field';
3731 - }
3732 - ?>
3733 - uwp_form_<?php echo esc_attr( $field->field_type ); ?>_row uwp_clear <?php echo esc_attr( $bs_form_group ); ?>">
3508 + class="<?php if ( $field->is_required ) {
3509 + echo 'required_field';
3510 + } ?> uwp_form_<?php echo esc_attr( $field->field_type ); ?>_row uwp_clear <?php echo esc_attr( $bs_form_group ); ?>">
3734 3511
3735 3512 <?php
3736 - if ( ! is_admin() ) {
3737 - ?>
3513 + if ( ! is_admin() ) { ?>
3738 3514 <label class="<?php echo esc_attr( $bs_sr_only ); ?>">
3739 3515 <?php echo ( trim( $site_title ) ) ? esc_html( $site_title ) : '&nbsp;'; ?>
3740 - <?php
3741 - if ( $field->is_required ) {
3516 + <?php if ( $field->is_required ) {
3742 3517 echo '<span>*</span>';
3743 - }
3744 - ?>
3518 + } ?>
3745 3519 </label>
3746 3520 <?php } ?>
3747 3521
3748 3522 <input name="<?php echo esc_attr( $field->htmlvar_name ); ?>"
3749 - class="
3750 - <?php
3751 - //echo $field->css_class;
3752 - ?>
3753 - uwp_textfield <?php echo esc_attr( $bs_form_control ); ?>"
3754 - id="<?php echo esc_attr( $field->htmlvar_name ); ?>"
3755 - placeholder="<?php echo esc_attr( uwp_get_field_placeholder( $field ) ); ?>"
3756 - value="<?php echo esc_attr( stripslashes( $value ) ); ?>"
3757 - title="<?php echo esc_attr( $site_title ); ?>"
3758 - <?php
3759 - if ( $field->is_required == 1 ) {
3523 + class="<?php //echo $field->css_class;
3524 + ?> uwp_textfield <?php echo esc_attr( $bs_form_control ); ?>"
3525 + id="<?php echo esc_attr( $field->htmlvar_name ); ?>"
3526 + placeholder="<?php echo esc_attr( uwp_get_field_placeholder( $field ) ); ?>"
3527 + value="<?php echo esc_attr( stripslashes( $value ) ); ?>"
3528 + title="<?php echo esc_attr( $site_title ); ?>"
3529 + <?php if ( $field->is_required == 1 ) {
3760 3530 echo 'required="required"';
3761 - }
3762 - ?>
3763 - type="url"
3764 - oninvalid="setCustomValidity('<?php esc_attr_e( 'Please enter a valid URL including http://', 'userswp' ); ?>')"
3765 - onchange="try{setCustomValidity('')}catch(e){}"
3531 + } ?>
3532 + type="url"
3533 + oninvalid="setCustomValidity('<?php esc_attr_e( 'Please enter a valid URL including http://', 'userswp' ); ?>')"
3534 + onchange="try{setCustomValidity('')}catch(e){}"
3766 3535 />
3767 3536 <span class="uwp_message_note"><?php echo wp_kses_post( uwp_get_field_description( $field ) ); ?></span>
3768 3537 <?php if ( $field->is_required ) { ?>
3769 - <span class="uwp_message_error invalid-feedback"><?php echo esc_html__( stripslashes( $field->required_msg ), 'userswp' ); ?></span>
3538 + <span class="uwp_message_error invalid-feedback"><?php echo esc_html__( $field->required_msg, 'userswp' ); ?></span>
3770 3539 <?php } ?>
3771 3540 </div>
3772 3541
3773 3542 <?php
@@ -3793,8 +3562,9 @@
3793 3562 * @since 1.0.0
3794 3563 */
3795 3564 public function form_input_email( $html, $field, $value, $form_type ) {
3796 3565
3566 +
3797 3567 // Check if there is a custom field specific filter.
3798 3568 if ( has_filter( "uwp_form_input_email_{$field->htmlvar_name}" ) ) {
3799 3569 $html = apply_filters( "uwp_form_input_email_{$field->htmlvar_name}", $html, $field, $value, $form_type );
3800 3570 }
@@ -3801,77 +3571,66 @@
3801 3571
3802 3572 // If no html then we run the standard output.
3803 3573 if ( empty( $html ) ) {
3804 3574
3805 - $design_style = uwp_get_option( 'design_style', 'bootstrap' );
3806 - $bs_form_group = $design_style ? 'form-group mb-3' : '';
3807 - $bs_sr_only = $design_style ? 'sr-only' : '';
3808 - $bs_form_control = $design_style ? 'form-control' : '';
3575 + $design_style = uwp_get_option( "design_style", "bootstrap" );
3576 + $bs_form_group = $design_style ? "form-group mb-3" : "";
3577 + $bs_sr_only = $design_style ? "sr-only" : "";
3578 + $bs_form_control = $design_style ? "form-control" : "";
3809 3579
3810 3580 ob_start(); // Start buffering;
3811 3581 $site_title = uwp_get_form_label( $field );
3812 - $required_msg = ( ! empty( $field->is_required ) && $field->required_msg != '') ? __( stripslashes( $field->required_msg ), 'userswp' ) : '';
3813 - $validation_text = ! empty( $field->validation_msg ) ? __( stripslashes( $field->validation_msg ), 'userswp' ) : '';
3582 + $required_msg = (!empty( $field->is_required ) && $field->required_msg != '') ? __( $field->required_msg, 'userswp' ) : '';
3583 + $validation_text = !empty($field->validation_msg) ? __($field->validation_msg, 'userswp') : '';
3814 3584
3815 3585 if ( $design_style ) {
3816 3586 $required = ! empty( $field->is_required ) ? ' <span class="text-danger">*</span>' : '';
3817 3587
3818 - echo aui()->input(
3819 - array( // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
3820 - 'type' => 'email',
3821 - 'id' => esc_attr( $field->htmlvar_name ),
3822 - 'name' => esc_attr( $field->htmlvar_name ),
3823 - 'placeholder' => esc_attr( uwp_get_field_placeholder( $field ) ),
3824 - 'title' => esc_html( $site_title ),
3825 - 'value' => esc_attr( wp_unslash( $value ) ),
3826 - 'required' => (bool) $field->is_required,
3827 - 'validation_text' => $validation_text != '' ? esc_attr( $validation_text ) : esc_attr( $required_msg ),
3588 + echo aui()->input( array( // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
3589 + 'type' => 'email',
3590 + 'id' => esc_attr( $field->htmlvar_name ),
3591 + 'name' => esc_attr( $field->htmlvar_name ),
3592 + 'placeholder' => esc_attr( uwp_get_field_placeholder( $field ) ),
3593 + 'title' => esc_html( $site_title ),
3594 + 'value' => esc_attr( wp_unslash( $value ) ),
3595 + 'required' => (bool) $field->is_required,
3596 + 'validation_text' => $validation_text != '' ? esc_attr( $validation_text ) : esc_attr( $required_msg ),
3828 3597 'validation_pattern' => ! empty( $field->validation_pattern ) ? esc_attr( wp_unslash( $field->validation_pattern ) ) : '',
3829 - 'help_text' => wp_kses_post( uwp_get_field_description( $field ) ),
3830 - 'label' => is_admin() && ! wp_doing_ajax() ? '' : wp_kses_post( $site_title . $required ),
3831 - 'wrap_class' => isset( $field->css_class ) ? esc_attr( $field->css_class ) : '',
3832 - )
3833 - );
3598 + 'help_text' => wp_kses_post( uwp_get_field_description( $field ) ),
3599 + 'label' => is_admin() && !wp_doing_ajax() ? '' : wp_kses_post( $site_title . $required ),
3600 + 'wrap_class' => isset( $field->css_class ) ? esc_attr( $field->css_class ) : '',
3601 + ) );
3834 3602 } else {
3835 3603 ?>
3836 3604 <div id="<?php echo esc_attr( $field->htmlvar_name ); ?>_row"
3837 - class="
3838 - <?php
3839 - if ( $field->is_required ) {
3840 - echo 'required_field';
3841 - }
3842 - ?>
3843 - uwp_form_<?php echo esc_attr( $field->field_type ); ?>_row uwp_clear <?php echo esc_attr( $bs_form_group ); ?>">
3605 + class="<?php if ( $field->is_required ) {
3606 + echo 'required_field';
3607 + } ?> uwp_form_<?php echo esc_attr( $field->field_type ); ?>_row uwp_clear <?php echo esc_attr( $bs_form_group ); ?>">
3844 3608
3845 3609 <?php
3846 - if ( ! is_admin() ) {
3847 - ?>
3610 + if ( ! is_admin() ) { ?>
3848 3611 <label class="<?php echo esc_attr( $bs_sr_only ); ?>">
3849 3612 <?php echo ( trim( $site_title ) ) ? esc_html( $site_title ) : '&nbsp;'; ?>
3850 - <?php
3851 - if ( $field->is_required ) {
3613 + <?php if ( $field->is_required ) {
3852 3614 echo '<span>*</span>';
3853 - }
3854 - ?>
3615 + } ?>
3855 3616 </label>
3856 3617 <?php } ?>
3857 3618
3858 3619 <input name="<?php echo esc_attr( $field->htmlvar_name ); ?>"
3859 - class="<?php echo esc_attr( $field->css_class ); ?> uwp_textfield <?php echo esc_attr( $bs_form_control ); ?>"
3860 - id="<?php echo esc_attr( $field->htmlvar_name ); ?>"
3861 - placeholder="<?php echo esc_attr( uwp_get_field_placeholder( $field ) ); ?>"
3862 - value="<?php echo esc_attr( stripslashes( $value ) ); ?>"
3863 - title="<?php echo esc_attr( $site_title ); ?>"
3864 - <?php
3865 - if ( $field->is_required == 1 ) {
3620 + class="<?php echo esc_attr( $field->css_class ); ?> uwp_textfield <?php echo esc_attr( $bs_form_control ); ?>"
3621 + id="<?php echo esc_attr( $field->htmlvar_name ); ?>"
3622 + placeholder="<?php echo esc_attr( uwp_get_field_placeholder( $field ) ); ?>"
3623 + value="<?php echo esc_attr( stripslashes( $value ) ); ?>"
3624 + title="<?php echo esc_attr( $site_title ); ?>"
3625 + <?php if ( $field->is_required == 1 ) {
3866 3626 echo 'required="required"';
3867 - }
3868 - ?>
3869 - type="email"
3627 + } ?>
3628 + type="email"
3870 3629 />
3871 3630 <span class="uwp_message_note"><?php echo wp_kses_post( uwp_get_field_description( $field ) ); ?></span>
3872 3631 <?php if ( $field->is_required ) { ?>
3873 - <span class="uwp_message_error invalid-feedback"><?php echo esc_html__( stripslashes( $field->required_msg ), 'userswp' ); ?></span>
3632 + <span class="uwp_message_error invalid-feedback"><?php echo esc_html__( $field->required_msg, 'userswp' ); ?></span>
3874 3633 <?php } ?>
3875 3634 </div>
3876 3635
3877 3636
@@ -3902,8 +3661,9 @@
3902 3661 * @since 1.0.0
3903 3662 */
3904 3663 public function form_input_password( $html, $field, $value, $form_type ) {
3905 3664
3665 +
3906 3666 // Check if there is a custom field specific filter.
3907 3667 if ( has_filter( "uwp_form_input_password_{$field->htmlvar_name}" ) ) {
3908 3668 $html = apply_filters( "uwp_form_input_password_{$field->htmlvar_name}", $html, $field, $value, $form_type );
3909 3669 }
@@ -3910,12 +3670,12 @@
3910 3670
3911 3671 // If no html then we run the standard output.
3912 3672 if ( empty( $html ) ) {
3913 3673
3914 - $design_style = uwp_get_option( 'design_style', 'bootstrap' );
3915 - $bs_form_group = $design_style ? 'form-group mb-3' : '';
3916 - $bs_sr_only = $design_style ? 'sr-only' : '';
3917 - $bs_form_control = $design_style ? 'form-control' : '';
3674 + $design_style = uwp_get_option( "design_style", "bootstrap" );
3675 + $bs_form_group = $design_style ? "form-group mb-3" : "";
3676 + $bs_sr_only = $design_style ? "sr-only" : "";
3677 + $bs_form_control = $design_style ? "form-control" : "";
3918 3678
3919 3679 ob_start(); // Start buffering;
3920 3680 $site_title = uwp_get_form_label( $field );
3921 3681
@@ -3920,66 +3680,55 @@
3920 3680 $site_title = uwp_get_form_label( $field );
3921 3681
3922 3682 if ( $design_style ) {
3923 3683 $required = ! empty( $field->is_required ) ? ' <span class="text-danger">*</span>' : '';
3924 - $required_msg = ( ! empty( $field->required_msg ) && $field->required_msg != '') ? __( stripslashes( $field->required_msg ), 'userswp' ) : '';
3925 - $validation_text = ! empty( $field->validation_msg ) ? __( stripslashes( $field->validation_msg ), 'userswp' ) : '';
3926 - $wrap_class = isset( $field->css_class ) ? $field->css_class . ' uwp-password-wrap' : 'uwp-password-wrap';
3684 + $required_msg = (!empty( $field->required_msg ) && $field->required_msg != '') ? __( $field->required_msg, 'userswp' ) : '';
3685 + $validation_text = !empty($field->validation_msg) ? __($field->validation_msg, 'userswp') : '';
3686 + $wrap_class = isset( $field->css_class ) ? $field->css_class.' uwp-password-wrap' : 'uwp-password-wrap';
3927 3687
3928 - echo aui()->input(
3929 - array( // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
3930 - 'type' => 'password',
3931 - 'id' => esc_attr( $field->htmlvar_name ),
3932 - 'name' => esc_attr( $field->htmlvar_name ),
3933 - 'placeholder' => esc_attr( uwp_get_field_placeholder( $field ) ),
3934 - 'title' => esc_html( $site_title ),
3935 - 'value' => esc_attr( $value ),
3936 - 'required' => (bool) $field->is_required,
3937 - 'validation_text' => $validation_text != '' ? esc_attr( $validation_text ) : esc_attr( $required_msg ),
3688 + echo aui()->input( array( // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
3689 + 'type' => 'password',
3690 + 'id' => esc_attr( $field->htmlvar_name ),
3691 + 'name' => esc_attr( $field->htmlvar_name ),
3692 + 'placeholder' => esc_attr( uwp_get_field_placeholder( $field ) ),
3693 + 'title' => esc_html( $site_title ),
3694 + 'value' => esc_attr( $value ),
3695 + 'required' => (bool) $field->is_required,
3696 + 'validation_text' => $validation_text != '' ? esc_attr( $validation_text ) : esc_attr( $required_msg ),
3938 3697 'validation_pattern' => ! empty( $field->validation_pattern ) ? esc_attr( wp_unslash( $field->validation_pattern ) ) : '',
3939 - 'help_text' => wp_kses_post( uwp_get_field_description( $field ) ),
3940 - 'label' => is_admin() && ! wp_doing_ajax() ? '' : wp_kses_post( $site_title . $required ),
3941 - 'wrap_class' => esc_attr( $wrap_class ),
3942 - )
3943 - );
3698 + 'help_text' => wp_kses_post( uwp_get_field_description( $field ) ),
3699 + 'label' => is_admin() && !wp_doing_ajax() ? '' : wp_kses_post( $site_title . $required ),
3700 + 'wrap_class' => esc_attr( $wrap_class ),
3701 + ) );
3944 3702 } else {
3945 3703 ?>
3946 - <div id="<?php echo esc_attr( $field->htmlvar_name ); ?>_row" class="
3947 - <?php
3948 - if ( $field->is_required ) {
3949 - echo 'required_field';
3950 - }
3951 - ?>
3952 - uwp_form_<?php echo esc_attr( $field->field_type ); ?>_row uwp_clear <?php echo esc_attr( $bs_form_group ); ?>">
3704 + <div id="<?php echo esc_attr( $field->htmlvar_name ); ?>_row" class="<?php if ( $field->is_required ) {
3705 + echo 'required_field';
3706 + } ?> uwp_form_<?php echo esc_attr( $field->field_type ); ?>_row uwp_clear <?php echo esc_attr( $bs_form_group ); ?>">
3953 3707 <?php
3954 - if ( ! is_admin() ) {
3955 - ?>
3708 + if ( ! is_admin() ) { ?>
3956 3709 <label class="<?php echo esc_attr( $bs_sr_only ); ?>">
3957 3710 <?php echo ( trim( $site_title ) ) ? esc_html( $site_title ) : '&nbsp;'; ?>
3958 - <?php
3959 - if ( $field->is_required ) {
3711 + <?php if ( $field->is_required ) {
3960 3712 echo '<span>*</span>';
3961 - }
3962 - ?>
3713 + } ?>
3963 3714 </label>
3964 3715 <?php } ?>
3965 3716
3966 3717 <input name="<?php echo esc_attr( $field->htmlvar_name ); ?>"
3967 - class="<?php echo esc_attr( $field->css_class ); ?> uwp_textfield <?php echo esc_attr( $bs_form_control ); ?>"
3968 - id="<?php echo esc_attr( $field->htmlvar_name ); ?>"
3969 - placeholder="<?php echo esc_attr( uwp_get_field_placeholder( $field ) ); ?>"
3970 - value="<?php echo esc_attr( stripslashes( $value ) ); ?>"
3971 - title="<?php echo esc_attr( $site_title ); ?>"
3972 - <?php
3973 - if ( $field->is_required == 1 ) {
3718 + class="<?php echo esc_attr( $field->css_class ); ?> uwp_textfield <?php echo esc_attr( $bs_form_control ); ?>"
3719 + id="<?php echo esc_attr( $field->htmlvar_name ); ?>"
3720 + placeholder="<?php echo esc_attr( uwp_get_field_placeholder( $field ) ); ?>"
3721 + value="<?php echo esc_attr( stripslashes( $value ) ); ?>"
3722 + title="<?php echo esc_attr( $site_title ); ?>"
3723 + <?php if ( $field->is_required == 1 ) {
3974 3724 echo 'required="required"';
3975 - }
3976 - ?>
3977 - type="password"
3725 + } ?>
3726 + type="password"
3978 3727 />
3979 3728 <span class="uwp_message_note"><?php echo wp_kses_post( uwp_get_field_description( $field ) ); ?></span>
3980 3729 <?php if ( $field->is_required ) { ?>
3981 - <span class="uwp_message_error invalid-feedback"><?php echo esc_html__( stripslashes( $field->required_msg ), 'userswp' ); ?></span>
3730 + <span class="uwp_message_error invalid-feedback"><?php echo esc_html__( $field->required_msg, 'userswp' ); ?></span>
3982 3731 <?php } ?>
3983 3732 </div>
3984 3733
3985 3734
@@ -4009,74 +3758,61 @@
4009 3758 *
4010 3759 */
4011 3760 public function form_input_phone( $html, $field, $value, $form_type ) {
4012 3761 if ( empty( $html ) ) {
4013 - $design_style = uwp_get_option( 'design_style', 'bootstrap' );
4014 - $bs_form_group = $design_style ? 'form-group mb-3' : '';
4015 - $bs_sr_only = $design_style ? 'sr-only' : '';
4016 - $bs_form_control = $design_style ? 'form-control' : '';
3762 + $design_style = uwp_get_option( "design_style", "bootstrap" );
3763 + $bs_form_group = $design_style ? "form-group mb-3" : "";
3764 + $bs_sr_only = $design_style ? "sr-only" : "";
3765 + $bs_form_control = $design_style ? "form-control" : "";
4017 3766 ob_start(); // Start buffering;
4018 3767 $site_title = uwp_get_form_label( $field );
4019 - $required_msg = ( ! empty( $field->is_required ) && $field->required_msg != '') ? __( stripslashes( $field->required_msg ), 'userswp' ) : '';
4020 - $validation_text = ! empty( $field->validation_msg ) ? __( stripslashes( $field->validation_msg ), 'userswp' ) : '';
3768 + $required_msg = (!empty( $field->is_required ) && $field->required_msg != '') ? __( $field->required_msg, 'userswp' ) : '';
3769 + $validation_text = !empty($field->validation_msg) ? __($field->validation_msg, 'userswp') : '';
4021 3770
4022 3771 if ( $design_style ) {
4023 3772 $required = ! empty( $field->is_required ) ? ' <span class="text-danger">*</span>' : '';
4024 3773
4025 - echo aui()->input(
4026 - array( // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
4027 - 'type' => 'tel',
4028 - 'id' => esc_attr( $field->htmlvar_name ),
4029 - 'name' => esc_attr( $field->htmlvar_name ),
4030 - 'placeholder' => esc_attr( uwp_get_field_placeholder( $field ) ),
4031 - 'title' => esc_html( $site_title ),
4032 - 'value' => esc_attr( $value ),
4033 - 'required' => (bool) $field->is_required,
4034 - 'help_text' => wp_kses_post( uwp_get_field_description( $field ) ),
4035 - 'label' => is_admin() && ! wp_doing_ajax() ? '' : wp_kses_post( $site_title . $required ),
4036 - 'wrap_class' => isset( $field->css_class ) ? esc_attr( $field->css_class ) : '',
4037 - 'validation_text' => $validation_text != '' ? esc_attr( $validation_text ) : esc_attr( $required_msg ),
4038 - 'validation_pattern' => ! empty( $field->validation_pattern ) ? esc_attr( wp_unslash( $field->validation_pattern ) ) : '',
4039 - )
4040 - );
3774 + echo aui()->input( array( // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
3775 + 'type' => 'tel',
3776 + 'id' => esc_attr( $field->htmlvar_name ),
3777 + 'name' => esc_attr( $field->htmlvar_name ),
3778 + 'placeholder' => esc_attr( uwp_get_field_placeholder( $field ) ),
3779 + 'title' => esc_html( $site_title ),
3780 + 'value' => esc_attr( $value ),
3781 + 'required' => (bool) $field->is_required,
3782 + 'help_text' => wp_kses_post( uwp_get_field_description( $field ) ),
3783 + 'label' => is_admin() && !wp_doing_ajax() ? '' : wp_kses_post( $site_title . $required ),
3784 + 'wrap_class' => isset( $field->css_class ) ? esc_attr( $field->css_class ) : '',
3785 + 'validation_text' => $validation_text != '' ? esc_attr( $validation_text ) : esc_attr( $required_msg ),
3786 + 'validation_pattern' => ! empty( $field->validation_pattern ) ? esc_attr( wp_unslash($field->validation_pattern) ) : '',
3787 + ) );
4041 3788 } else {
4042 3789 ?>
4043 3790 <div id="<?php echo esc_attr( $field->htmlvar_name ); ?>_row"
4044 - class="
4045 - <?php
4046 - if ( $field->is_required ) {
4047 - echo 'required_field';
4048 - }
4049 - ?>
4050 - clearfix uwp_clear <?php echo esc_attr( $bs_form_group ); ?>">
3791 + class="<?php if ( $field->is_required ) {
3792 + echo 'required_field';
3793 + } ?> clearfix uwp_clear <?php echo esc_attr( $bs_form_group ); ?>">
4051 3794 <?php
4052 - if ( ! is_admin() ) {
4053 - ?>
3795 + if ( ! is_admin() ) { ?>
4054 3796 <label class="<?php echo esc_attr( $bs_sr_only ); ?>">
4055 3797 <?php echo ( trim( $site_title ) ) ? esc_html( $site_title ) : '&nbsp;'; ?>
4056 - <?php
4057 - if ( $field->is_required ) {
3798 + <?php if ( $field->is_required ) {
4058 3799 echo '<span>*</span>';
4059 - }
4060 - ?>
3800 + } ?>
4061 3801 </label>
4062 3802 <?php } ?>
4063 3803 <input name="<?php echo esc_attr( $field->htmlvar_name ); ?>"
4064 - class="<?php echo esc_attr( $field->css_class ); ?> <?php echo esc_attr( $bs_form_control ); ?>"
4065 - placeholder="<?php echo esc_attr( uwp_get_field_placeholder( $field ) ); ?>"
4066 - title="<?php echo esc_attr( $site_title ); ?>"
4067 - <?php
4068 - if ( $field->for_admin_use == 1 ) {
3804 + class="<?php echo esc_attr( $field->css_class ); ?> <?php echo esc_attr( $bs_form_control ); ?>"
3805 + placeholder="<?php echo esc_attr( uwp_get_field_placeholder( $field ) ); ?>"
3806 + title="<?php echo esc_attr( $site_title ); ?>"
3807 + <?php if ( $field->for_admin_use == 1 ) {
4069 3808 echo 'readonly="readonly"';
4070 - }
4071 - ?>
4072 - <?php
4073 - if ( $field->is_required == 1 ) {
3809 + } ?>
3810 + <?php if ( $field->is_required == 1 ) {
4074 3811 echo 'required="required"';
4075 - }
4076 - ?>
4077 - type="tel"
4078 - value="<?php echo esc_html( $value ); ?>">
3812 + } ?>
3813 + type="tel"
3814 + value="<?php echo esc_html( $value ); ?>">
4079 3815 </div>
4080 3816 <?php
4081 3817 }
4082 3818 $html = ob_get_clean();
@@ -4086,22 +3822,22 @@
4086 3822 }
4087 3823
4088 3824 public function form_input_register_gdpr( $html, $field, $value, $form_type ) {
4089 3825
4090 - $form_id = isset( $field->form_id ) ? (int) $field->form_id : 1;
4091 - $reg_gdpr = uwp_get_register_form_by( $form_id, 'gdpr_page' );
4092 - if ( empty( $reg_gdpr ) ) {
3826 + $form_id = isset($field->form_id) ? (int) $field->form_id : 1;
3827 + $reg_gdpr = uwp_get_register_form_by($form_id, 'gdpr_page');
3828 + if(empty($reg_gdpr)){
4093 3829 $reg_gdpr = uwp_get_option( 'register_gdpr_page', false );
4094 3830 }
4095 3831
4096 3832 if ( ! empty( $reg_gdpr ) ) {
4097 3833
4098 - $design_style = uwp_get_option( 'design_style', 'bootstrap' );
4099 - $bs_form_group = $design_style ? 'form-group mb-3 form-check' : '';
4100 - $bs_form_control = $design_style ? 'form-check-input' : '';
3834 + $design_style = uwp_get_option( "design_style", "bootstrap" );
3835 + $bs_form_group = $design_style ? "form-group mb-3 form-check" : "";
3836 + $bs_form_control = $design_style ? "form-check-input" : "";
4101 3837 $site_title = uwp_get_form_label( $field );
4102 3838 $field->htmlvar_name = 'register_gdpr';
4103 - $id = wp_doing_ajax() ? $field->htmlvar_name . '_ajax' : $field->htmlvar_name;
3839 + $id = wp_doing_ajax() ? $field->htmlvar_name . "_ajax" : $field->htmlvar_name;
4104 3840
4105 3841 $gdpr_page = get_permalink( $reg_gdpr );
4106 3842 $link_start = '<a href="' . esc_url( $gdpr_page ) . '" target="_blank">';
4107 3843 $link_end = '</a>';
@@ -4107,9 +3843,9 @@
4107 3843 $link_end = '</a>';
4108 3844 $field_desc = uwp_get_field_description( $field, '' );
4109 3845 $field_desc = str_replace( '%%link_start%%', $link_start, $field_desc );
4110 3846 $field_desc = str_replace( '%%link_end%%', $link_end, $field_desc );
4111 - $content = $field_desc ? $field_desc : sprintf( __( 'By using this form I agree to the storage and handling of my data by this website. View our %1$s %2$s %3$s.', 'userswp' ), '<a href="' . esc_url( $gdpr_page ) . '" target="_blank">', $site_title, '</a>' );
3847 + $content = $field_desc ? $field_desc : sprintf( __( 'By using this form I agree to the storage and handling of my data by this website. View our %s %s %s.', 'userswp' ), '<a href="' . esc_url( $gdpr_page ) . '" target="_blank">', $site_title, '</a>' );
4112 3848 $checked = $value == '1' ? true : false;
4113 3849
4114 3850 ob_start(); // Start buffering;
4115 3851
@@ -4119,19 +3855,19 @@
4119 3855 echo '<input type="hidden" name="' . esc_attr( $field->htmlvar_name ) . '" id="checkbox_' . esc_attr( $id ) . '" value="0"/>';
4120 3856
4121 3857 echo aui()->input( // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
4122 3858 array(
4123 - 'id' => esc_attr( $id ),
4124 - 'name' => esc_attr( $field->htmlvar_name ),
4125 - 'type' => 'checkbox',
4126 - 'value' => '1',
4127 - 'title' => esc_html( $site_title ),
4128 - 'label' => wp_kses_post( $content . $required ),
4129 - 'label_show' => true,
4130 - 'required' => ! empty( $field->is_required ) ? true : false,
4131 - 'checked' => (bool) $checked,
4132 - 'wrap_class' => isset( $field->css_class ) ? esc_attr( $field->css_class ) : '',
4133 - 'validation_text' => ! empty( $field->is_required ) ? esc_attr__( stripslashes( $field->required_msg ), 'userswp' ) : '',
3859 + 'id' => esc_attr( $id ),
3860 + 'name' => esc_attr( $field->htmlvar_name ),
3861 + 'type' => "checkbox",
3862 + 'value' => '1',
3863 + 'title' => esc_html( $site_title ),
3864 + 'label' => wp_kses_post( $content . $required ),
3865 + 'label_show' => true,
3866 + 'required' => ! empty( $field->is_required ) ? true : false,
3867 + 'checked' => (bool) $checked,
3868 + 'wrap_class' => isset( $field->css_class ) ? esc_attr( $field->css_class ) : '',
3869 + 'validation_text' => ! empty( $field->is_required ) ? esc_attr__( $field->required_msg, 'userswp' ) : '',
4134 3870 )
4135 3871 );
4136 3872
4137 3873 } else {
@@ -4136,33 +3872,27 @@
4136 3872
4137 3873 } else {
4138 3874 ?>
4139 3875 <div id="<?php echo esc_attr( $field->htmlvar_name ); ?>_row"
4140 - class="
4141 - <?php
4142 - if ( $field->is_required ) {
4143 - echo 'required_field';
4144 - }
4145 - ?>
4146 - uwp_form_<?php echo esc_attr( $field->field_type ); ?>_row uwp_clear <?php echo esc_attr( $bs_form_group ); ?>">
3876 + class="<?php if ( $field->is_required ) {
3877 + echo 'required_field';
3878 + } ?> uwp_form_<?php echo esc_attr( $field->field_type ); ?>_row uwp_clear <?php echo esc_attr( $bs_form_group ); ?>">
4147 3879 <input type="hidden" name="<?php echo esc_attr( $field->htmlvar_name ); ?>" value="0"/>
4148 3880 <input name="<?php echo esc_attr( $field->htmlvar_name ); ?>"
4149 - class="<?php echo esc_attr( $field->css_class ); ?> <?php echo esc_attr( $bs_form_control ); ?>"
4150 - placeholder="<?php echo esc_attr( uwp_get_field_placeholder( $field ) ); ?>"
4151 - title="<?php echo esc_attr( $site_title ); ?>"
4152 - <?php
4153 - if ( $value == '1' ) {
3881 + class="<?php echo esc_attr( $field->css_class ); ?> <?php echo esc_attr( $bs_form_control ); ?>"
3882 + placeholder="<?php echo esc_attr( uwp_get_field_placeholder( $field ) ); ?>"
3883 + title="<?php echo esc_attr( $site_title ); ?>"
3884 + <?php if ( $value == '1' ) {
4154 3885 echo 'checked="checked"';
4155 - }
4156 - ?>
4157 - type="<?php echo esc_attr( $field->field_type ); ?>"
4158 - value="1">
3886 + } ?>
3887 + type="<?php echo esc_attr( $field->field_type ); ?>"
3888 + value="1">
4159 3889 <?php
4160 3890 echo ( trim( $content ) ) ? wp_kses_post( $content ) : '&nbsp;';
4161 3891 ?>
4162 3892 <span class="uwp_message_note"><?php echo wp_kses_post( uwp_get_field_description( $field ) ); ?></span>
4163 3893 <?php if ( $field->is_required ) { ?>
4164 - <span class="uwp_message_error invalid-feedback"><?php echo esc_html__( stripslashes( $field->required_msg ), 'userswp' ); ?></span>
3894 + <span class="uwp_message_error invalid-feedback"><?php echo esc_html__( $field->required_msg, 'userswp' ); ?></span>
4165 3895 <?php } ?>
4166 3896 </div>
4167 3897
4168 3898 <?php
@@ -4178,19 +3908,19 @@
4178 3908 }
4179 3909
4180 3910 public function form_input_register_tos( $html, $field, $value, $form_type ) {
4181 3911
4182 - $form_id = isset( $field->form_id ) ? (int) $field->form_id : 1;
4183 - $reg_tos = uwp_get_register_form_by( $form_id, 'tos_page' );
4184 - if ( empty( $reg_tos ) ) {
3912 + $form_id = isset($field->form_id) ? (int) $field->form_id : 1;
3913 + $reg_tos = uwp_get_register_form_by($form_id, 'tos_page');
3914 + if(empty($reg_tos)){
4185 3915 $reg_tos = uwp_get_option( 'register_terms_page', false );
4186 3916 }
4187 3917
4188 3918 if ( ! empty( $reg_tos ) ) {
4189 3919
4190 - $design_style = uwp_get_option( 'design_style', 'bootstrap' );
4191 - $bs_form_group = $design_style ? 'form-group mb-3 form-check' : '';
4192 - $bs_form_control = $design_style ? 'form-check-input' : '';
3920 + $design_style = uwp_get_option( "design_style", "bootstrap" );
3921 + $bs_form_group = $design_style ? "form-group mb-3 form-check" : "";
3922 + $bs_form_control = $design_style ? "form-check-input" : "";
4193 3923
4194 3924 $site_title = uwp_get_form_label( $field );
4195 3925 $terms_page = get_permalink( $reg_tos );
4196 3926 $link_start = '<a href="' . esc_url( $terms_page ) . '" target="_blank">';
@@ -4198,11 +3928,11 @@
4198 3928 $field_desc = uwp_get_field_description( $field, '' );
4199 3929 $field_desc = str_replace( '%%link_start%%', $link_start, $field_desc );
4200 3930 $field_desc = str_replace( '%%link_end%%', $link_end, $field_desc );
4201 3931 $field->htmlvar_name = 'register_tos';
4202 - $id = wp_doing_ajax() ? $field->htmlvar_name . '_ajax' : $field->htmlvar_name;
3932 + $id = wp_doing_ajax() ? $field->htmlvar_name . "_ajax" : $field->htmlvar_name;
4203 3933
4204 - $content = $field_desc ? $field_desc : sprintf( __( 'I accept the %1$s %2$s %3$s.', 'userswp' ), '<a href="' . esc_url( $terms_page ) . '" target="_blank">', $site_title, '</a>' );
3934 + $content = $field_desc ? $field_desc : sprintf( __( 'I accept the %s %s %s.', 'userswp' ), '<a href="' . esc_url( $terms_page ) . '" target="_blank">', $site_title, '</a>' );
4205 3935 $checked = $value == '1' ? true : false;
4206 3936
4207 3937 ob_start();
4208 3938
@@ -4211,19 +3941,19 @@
4211 3941 echo '<input type="hidden" name="' . esc_attr( $field->htmlvar_name ) . '" id="checkbox_' . esc_attr( $id ) . '" value="0"/>';
4212 3942
4213 3943 echo aui()->input( // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
4214 3944 array(
4215 - 'id' => esc_attr( $id ),
4216 - 'name' => esc_attr( $field->htmlvar_name ),
4217 - 'type' => 'checkbox',
4218 - 'value' => '1',
4219 - 'title' => esc_html( $site_title ),
4220 - 'label' => wp_kses_post( $content . $required ),
4221 - 'label_show' => true,
4222 - 'required' => ! empty( $field->is_required ) ? true : false,
4223 - 'checked' => (bool) $checked,
4224 - 'wrap_class' => isset( $field->css_class ) ? esc_attr( $field->css_class ) : '',
4225 - 'validation_text' => ! empty( $field->is_required ) ? esc_attr__( stripslashes( $field->required_msg ), 'userswp' ) : '',
3945 + 'id' => esc_attr( $id ),
3946 + 'name' => esc_attr( $field->htmlvar_name ),
3947 + 'type' => "checkbox",
3948 + 'value' => '1',
3949 + 'title' => esc_html( $site_title ),
3950 + 'label' => wp_kses_post( $content . $required ),
3951 + 'label_show' => true,
3952 + 'required' => ! empty( $field->is_required ) ? true : false,
3953 + 'checked' => (bool) $checked,
3954 + 'wrap_class' => isset( $field->css_class ) ? esc_attr( $field->css_class ) : '',
3955 + 'validation_text' => ! empty( $field->is_required ) ? esc_attr__( $field->required_msg, 'userswp' ) : '',
4226 3956 )
4227 3957 );
4228 3958
4229 3959 } else {
@@ -4228,33 +3958,27 @@
4228 3958
4229 3959 } else {
4230 3960 ?>
4231 3961 <div id="<?php echo esc_attr( $field->htmlvar_name ); ?>_row"
4232 - class="
4233 - <?php
4234 - if ( $field->is_required ) {
4235 - echo 'required_field';
4236 - }
4237 - ?>
4238 - uwp_form_<?php echo esc_attr( $field->field_type ); ?>_row uwp_clear <?php echo esc_attr( $bs_form_group ); ?>">
3962 + class="<?php if ( $field->is_required ) {
3963 + echo 'required_field';
3964 + } ?> uwp_form_<?php echo esc_attr( $field->field_type ); ?>_row uwp_clear <?php echo esc_attr( $bs_form_group ); ?>">
4239 3965 <input type="hidden" name="<?php echo esc_attr( $field->htmlvar_name ); ?>" value="0"/>
4240 3966 <input name="<?php echo esc_attr( $field->htmlvar_name ); ?>"
4241 - class="<?php echo esc_attr( $field->css_class ); ?> <?php echo esc_attr( $bs_form_control ); ?>"
4242 - placeholder="<?php echo esc_attr( uwp_get_field_placeholder( $field ) ); ?>"
4243 - title="<?php echo esc_attr( $site_title ); ?>"
4244 - <?php
4245 - if ( $value == '1' ) {
3967 + class="<?php echo esc_attr( $field->css_class ); ?> <?php echo esc_attr( $bs_form_control ); ?>"
3968 + placeholder="<?php echo esc_attr( uwp_get_field_placeholder( $field ) ); ?>"
3969 + title="<?php echo esc_attr( $site_title ); ?>"
3970 + <?php if ( $value == '1' ) {
4246 3971 echo 'checked="checked"';
4247 - }
4248 - ?>
4249 - type="<?php echo esc_attr( $field->field_type ); ?>"
4250 - value="1">
3972 + } ?>
3973 + type="<?php echo esc_attr( $field->field_type ); ?>"
3974 + value="1">
4251 3975 <?php
4252 3976 echo ( trim( $content ) ) ? wp_kses_post( $content ) : '&nbsp;';
4253 3977 ?>
4254 3978 <span class="uwp_message_note"><?php echo wp_kses_post( uwp_get_field_description( $field ) ); ?></span>
4255 3979 <?php if ( $field->is_required ) { ?>
4256 - <span class="uwp_message_error invalid-feedback"><?php echo esc_html__( stripslashes( $field->required_msg ), 'userswp' ); ?></span>
3980 + <span class="uwp_message_error invalid-feedback"><?php echo esc_html__( $field->required_msg, 'userswp' ); ?></span>
4257 3981 <?php } ?>
4258 3982 </div>
4259 3983
4260 3984 <?php
@@ -4280,9 +4004,9 @@
4280 4004 */
4281 4005 function add_multipart_to_admin_edit_form() {
4282 4006 global $wpdb;
4283 4007 $table_name = uwp_get_table_prefix() . 'uwp_form_fields';
4284 - $fields = $wpdb->get_results( 'SELECT * FROM ' . $table_name . " WHERE form_type = 'account' AND field_type = 'file' AND is_default = '0' ORDER BY sort_order ASC" ); // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching
4008 + $fields = $wpdb->get_results( "SELECT * FROM " . $table_name . " WHERE form_type = 'account' AND field_type = 'file' AND is_default = '0' ORDER BY sort_order ASC" ); // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching
4285 4009 if ( $fields ) {
4286 4010 echo 'enctype="multipart/form-data"';
4287 4011 }
4288 4012 }
@@ -4301,12 +4025,12 @@
4301 4025 global $wpdb;
4302 4026 $file_obj = new UsersWP_Files();
4303 4027 $table_name = uwp_get_table_prefix() . 'uwp_form_fields';
4304 4028 //Normal fields
4305 - $fields = $wpdb->get_results( 'SELECT * FROM ' . $table_name . " WHERE form_type = 'account' AND field_type != 'file' AND field_type != 'fieldset' ORDER BY sort_order ASC" ); // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching
4029 + $fields = $wpdb->get_results( "SELECT * FROM " . $table_name . " WHERE form_type = 'account' AND field_type != 'file' AND field_type != 'fieldset' ORDER BY sort_order ASC" ); // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching
4306 4030 if ( $fields ) {
4307 - if ( isset( $_POST['locale'] ) ) {
4308 - $_POST['uwp_language'] = sanitize_text_field( $_POST['locale'] );
4031 + if(isset($_POST['locale'])){
4032 + $_POST['uwp_language'] = sanitize_text_field($_POST['locale']);
4309 4033 }
4310 4034 $result = uwp_validate_fields( $_POST, 'account', $fields );
4311 4035 if ( is_wp_error( $result ) ) {
4312 4036 die( wp_kses_post( $result->get_error_message() ) );
@@ -4312,13 +4036,15 @@
4312 4036 die( wp_kses_post( $result->get_error_message() ) );
4313 4037 }
4314 4038 if ( isset( $result['display_name'] ) && ! empty( $result['display_name'] ) ) {
4315 4039 $display_name = $result['display_name'];
4316 - } elseif ( ! empty( $first_name ) || ! empty( $last_name ) ) {
4040 + } else {
4041 + if ( ! empty( $first_name ) || ! empty( $last_name ) ) {
4317 4042 $display_name = $result['first_name'] . ' ' . $result['last_name'];
4318 4043 } else {
4319 - $user_info = get_userdata( $user_id );
4320 - $display_name = $user_info->user_login;
4044 + $user_info = get_userdata( $user_id );
4045 + $display_name = $user_info->user_login;
4046 + }
4321 4047 }
4322 4048 $result['display_name'] = $display_name;
4323 4049 if ( ! is_wp_error( $result ) ) {
4324 4050 foreach ( $fields as $field ) {
@@ -4330,14 +4056,14 @@
4330 4056 }
4331 4057 }
4332 4058
4333 4059 //File fields
4334 - $fields = $wpdb->get_results( 'SELECT * FROM ' . $table_name . " WHERE form_type = 'account' AND field_type = 'file' AND is_default = '0' ORDER BY sort_order ASC" ); // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching
4060 + $fields = $wpdb->get_results( "SELECT * FROM " . $table_name . " WHERE form_type = 'account' AND field_type = 'file' AND is_default = '0' ORDER BY sort_order ASC" ); // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching
4335 4061 if ( $fields ) {
4336 4062 $result = $file_obj->validate_uploads( $_FILES, 'account', true, $fields );
4337 4063 if ( ! is_wp_error( $result ) ) {
4338 4064 foreach ( $fields as $field ) {
4339 - $value = isset( $result[ $field->htmlvar_name ] ) ? $result[ $field->htmlvar_name ] : '';
4065 + $value = $result[ $field->htmlvar_name ];
4340 4066 if ( $value == '0' || ! empty( $value ) ) {
4341 4067 uwp_update_usermeta( $user_id, $field->htmlvar_name, $value );
4342 4068 }
4343 4069 }
@@ -4362,29 +4088,27 @@
4362 4088
4363 4089 // If no html then we run the standard output.
4364 4090 if ( empty( $html ) ) {
4365 4091
4366 - $design_style = uwp_get_option( 'design_style', 'bootstrap' );
4367 - $bs_form_group = $design_style ? 'form-group m-0' : ''; // country wrapper div added by JS adds margin so we remove ours
4368 - $bs_sr_only = $design_style ? 'sr-only' : '';
4369 - $bs_form_control = $design_style ? 'form-control' : '';
4092 + $design_style = uwp_get_option( "design_style", "bootstrap" );
4093 + $bs_form_group = $design_style ? "form-group m-0" : ""; // country wrapper div added by JS adds marginso we remove ours
4094 + $bs_sr_only = $design_style ? "sr-only" : "";
4095 + $bs_form_control = $design_style ? "form-control" : "";
4370 4096
4371 4097 ob_start(); // Start buffering;
4372 4098 ?>
4373 - <div id="<?php echo esc_attr( $field->htmlvar_name ); ?>_row" class="<?php echo ( $field->is_required ? 'required_field' : '' ); ?> uwp_clear <?php echo esc_attr( $bs_form_group . ' ' . $field->css_class ); ?>">
4099 + <div id="<?php echo esc_attr( $field->htmlvar_name ); ?>_row" class="<?php echo ( $field->is_required ? 'required_field' : '' ); ?> uwp_clear <?php echo esc_attr( $bs_form_group. ' ' . $field->css_class ); ?>">
4374 4100
4375 4101 <?php
4376 4102 $site_title = uwp_get_form_label( $field );
4377 4103
4378 - if ( ! is_admin() && ! wp_doing_ajax() ) {
4104 + if ( ! is_admin() && !wp_doing_ajax() ) {
4379 4105 ?>
4380 4106 <label class="<?php echo esc_attr( $bs_sr_only ); ?>">
4381 4107 <?php echo ( trim( $site_title ) ) ? esc_html( $site_title ) : '&nbsp;'; ?>
4382 - <?php
4383 - if ( $field->is_required ) {
4108 + <?php if ( $field->is_required ) {
4384 4109 echo '<span class="text-danger">*</span>';
4385 - }
4386 - ?>
4110 + } ?>
4387 4111 </label>
4388 4112 <?php
4389 4113 }
4390 4114 // if value empty set the default
@@ -4406,9 +4130,9 @@
4406 4130 <input type="hidden" id="<?php echo esc_attr( $htmlvar_name ); ?>_code" name="<?php echo esc_attr( $field->htmlvar_name ); ?>"/>
4407 4131 <script>jQuery(function(){jQuery("#<?php echo esc_js( $htmlvar_name ); ?>").countrySelect(<?php echo wp_json_encode( json_decode( $select_country_options ) ); ?>);});</script>
4408 4132 <span class="uwp_message_note"><?php echo wp_kses_post( uwp_get_field_description( $field ) ); ?></span>
4409 4133 <?php if ( $field->is_required ) { ?>
4410 - <span class="uwp_message_error invalid-feedback"><?php echo esc_html__( stripslashes( $field->required_msg ), 'userswp' ); ?></span>
4134 + <span class="uwp_message_error invalid-feedback"><?php echo esc_html__( $field->required_msg, 'userswp' ); ?></span>
4411 4135 <?php } ?>
4412 4136 </div>
4413 4137 <?php
4414 4138 $html = ob_get_clean();
@@ -4434,38 +4158,31 @@
4434 4158
4435 4159 // If no html then we run the standard output.
4436 4160 if ( empty( $html ) ) {
4437 4161
4438 - $design_style = uwp_get_option( 'design_style', 'bootstrap' );
4439 - $bs_form_group = $design_style ? 'form-group m-0' : '';
4440 - $bs_sr_only = $design_style ? 'sr-only' : '';
4441 - $bs_form_control = $design_style ? 'form-control' : '';
4442 - $required_msg = ( ! empty( $field->is_required ) && $field->required_msg != '') ? __( stripslashes( $field->required_msg ), 'userswp' ) : '';
4443 - $validation_text = ! empty( $field->validation_msg ) ? __( stripslashes( $field->validation_msg ), 'userswp' ) : '';
4162 + $design_style = uwp_get_option( "design_style", "bootstrap" );
4163 + $bs_form_group = $design_style ? "form-group m-0" : "";
4164 + $bs_sr_only = $design_style ? "sr-only" : "";
4165 + $bs_form_control = $design_style ? "form-control" : "";
4166 + $required_msg = (!empty( $field->is_required ) && $field->required_msg != '') ? __( $field->required_msg, 'userswp' ) : '';
4167 + $validation_text = !empty($field->validation_msg) ? __($field->validation_msg, 'userswp') : '';
4444 4168
4445 4169 ob_start(); // Start buffering;
4446 4170
4447 4171 ?>
4448 - <div id="<?php echo esc_attr( $field->htmlvar_name ); ?>_row"
4449 - class="
4450 - <?php
4451 - if ( $field->is_required ) {
4452 - echo 'required_field';
4453 - }
4454 - ?>
4455 - uwp_clear <?php echo esc_attr( $bs_form_group . ' ' . $field->css_class ); ?>">
4172 + <div id="<?php echo esc_attr($field->htmlvar_name); ?>_row"
4173 + class="<?php if ( $field->is_required ) {
4174 + echo 'required_field';
4175 + } ?> uwp_clear <?php echo esc_attr( $bs_form_group. ' '.$field->css_class ); ?>">
4456 4176
4457 4177 <?php
4458 4178 $site_title = uwp_get_form_label( $field );
4459 - if ( ! is_admin() && ! wp_doing_ajax() ) {
4460 - ?>
4179 + if ( ! is_admin() && !wp_doing_ajax() ) { ?>
4461 4180 <label class="<?php echo esc_attr( $bs_sr_only ); ?>">
4462 4181 <?php echo ( trim( $site_title ) ) ? esc_html( $site_title ) : '&nbsp;'; ?>
4463 - <?php
4464 - if ( $field->is_required ) {
4182 + <?php if ( $field->is_required ) {
4465 4183 echo '<span class="text-danger">*</span>';
4466 - }
4467 - ?>
4184 + } ?>
4468 4185 </label>
4469 4186 <?php } ?>
4470 4187
4471 4188 <?php
@@ -4480,43 +4197,41 @@
4480 4197
4481 4198 require_once ABSPATH . 'wp-admin/includes/translation-install.php';
4482 4199 $translations = wp_get_available_translations();
4483 4200 $available_languages = get_available_languages();
4484 - $languages = array( 'site-default' => __( 'Site Default', 'userswp' ) );
4201 + $languages = array('site-default' => __( 'Site Default', 'userswp' ));
4485 4202
4486 4203 foreach ( $available_languages as $locale ) {
4487 4204 if ( isset( $translations[ $locale ] ) ) {
4488 4205 $translation = $translations[ $locale ];
4489 - $languages[ $translation['language'] ] = $translation['native_name'];
4206 + $languages[$translation['language']] = $translation['native_name'];
4490 4207
4491 4208 // Remove installed language from available translations.
4492 4209 unset( $translations[ $locale ] );
4493 4210 } else {
4494 - $languages[ $locale ] = $translation[ $locale ];
4211 + $languages[$locale] = $translation[$locale];
4495 4212 }
4496 4213 }
4497 4214
4498 4215 if ( $design_style ) {
4499 4216
4500 - $required = ! empty( $field->is_required ) ? ' <span class="text-danger">*</span>' : '';
4217 + $required = ! empty( $field->is_required ) ? ' <span class="text-danger">*</span>' : '';
4501 4218
4502 - echo aui()->select(
4503 - array( // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
4504 - 'id' => esc_attr( $field->htmlvar_name ),
4505 - 'name' => esc_attr( $field->htmlvar_name ),
4506 - 'placeholder' => esc_attr( uwp_get_field_placeholder( $field ) ),
4507 - 'title' => esc_attr( $site_title ),
4508 - 'value' => esc_attr( $value ),
4509 - 'required' => (bool) $field->is_required,
4510 - 'validation_text' => $validation_text != '' ? esc_attr( $validation_text ) : esc_attr( $required_msg ),
4511 - 'validation_pattern' => ! empty( $field->validation_pattern ) ? esc_attr( wp_unslash( $field->validation_pattern ) ) : '',
4512 - 'help_text' => wp_kses_post( uwp_get_field_description( $field ) ),
4513 - 'label' => wp_kses_post( $site_title . $required ),
4514 - 'options' => $languages, // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
4515 - 'select2' => true,
4516 - 'wrap_class' => isset( $field->css_class ) ? esc_attr( $field->css_class ) : '',
4517 - )
4518 - );
4219 + echo aui()->select( array( // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
4220 + 'id' => esc_attr( $field->htmlvar_name ),
4221 + 'name' => esc_attr( $field->htmlvar_name ),
4222 + 'placeholder' => esc_attr( uwp_get_field_placeholder( $field ) ),
4223 + 'title' => esc_attr( $site_title ),
4224 + 'value' => esc_attr( $value ),
4225 + 'required' => (bool) $field->is_required,
4226 + 'validation_text' => $validation_text != '' ? esc_attr( $validation_text ) : esc_attr( $required_msg ),
4227 + 'validation_pattern' => ! empty( $field->validation_pattern ) ? esc_attr( wp_unslash( $field->validation_pattern ) ) : '',
4228 + 'help_text' => wp_kses_post( uwp_get_field_description( $field ) ),
4229 + 'label' => wp_kses_post( $site_title . $required ),
4230 + 'options' => $languages, // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
4231 + 'select2' => true,
4232 + 'wrap_class' => isset( $field->css_class ) ? esc_attr( $field->css_class ) : '',
4233 + ) );
4519 4234 } else {
4520 4235 ?>
4521 4236 <select name="<?php echo esc_attr( $field->htmlvar_name ); ?>" id="<?php echo esc_attr( $field->htmlvar_name ); ?>"
4522 4237 class="uwp_textfield aui-select2 <?php echo esc_attr( $bs_form_control ); ?>"
@@ -4524,14 +4239,14 @@
4524 4239 data-placeholder="<?php echo esc_attr( uwp_get_field_placeholder( $field ) ); ?>"
4525 4240 ><?php echo $select_options; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>
4526 4241 </select>
4527 4242 <span class="uwp_message_note"><?php echo wp_kses_post( uwp_get_field_description( $field ) ); ?></span>
4528 - <?php if ( $field->is_required ) { ?>
4529 - <span class="uwp_message_error invalid-feedback"><?php echo esc_html__( stripslashes( $field->required_msg ), 'userswp' ); ?></span>
4530 - <?php
4531 - }
4243 + <?php if ( $field->is_required ) { ?>
4244 + <span class="uwp_message_error invalid-feedback"><?php echo esc_html__( $field->required_msg, 'userswp' ); ?></span>
4245 + <?php }
4532 4246 }
4533 4247
4248 +
4534 4249 $html = ob_get_clean();
4535 4250 }
4536 4251
4537 4252 return $html;
@@ -4560,58 +4275,53 @@
4560 4275
4561 4276 $enable_confirm_password_field = isset( $extra['confirm_password'] ) ? $extra['confirm_password'] : '0';
4562 4277 if ( $enable_confirm_password_field == '1' ) {
4563 4278
4564 - $design_style = uwp_get_option( 'design_style', 'bootstrap' );
4565 - $bs_form_group = $design_style ? 'form-group mb-3' : '';
4566 - $bs_sr_only = $design_style ? 'sr-only' : '';
4567 - $bs_form_control = $design_style ? 'form-control' : '';
4568 - $site_title = $placeholder = __( 'Confirm Password', 'userswp' );
4279 + $design_style = uwp_get_option( "design_style", "bootstrap" );
4280 + $bs_form_group = $design_style ? "form-group mb-3" : "";
4281 + $bs_sr_only = $design_style ? "sr-only" : "";
4282 + $bs_form_control = $design_style ? "form-control" : "";
4283 + $site_title = $placeholder = __( "Confirm Password", 'userswp' );
4569 4284 $required = '';
4570 4285 if ( isset( $field->is_required ) && ! empty( $field->is_required ) ) {
4571 4286 $placeholder .= ' *';
4572 4287 $required = ' <span class="text-danger">*</span>';
4573 4288 }
4574 - $required_msg = ( ! empty( $field->is_required ) && $field->required_msg != '') ? __( stripslashes( $field->required_msg ), 'userswp' ) : '';
4575 - $validation_text = ! empty( $field->validation_msg ) ? __( stripslashes( $field->validation_msg ), 'userswp' ) : '';
4576 - $wrap_class = isset( $field->css_class ) ? $field->css_class . ' uwp-password-wrap' : 'uwp-password-wrap';
4289 + $required_msg = (!empty( $field->is_required ) && $field->required_msg != '') ? __( $field->required_msg, 'userswp' ) : '';
4290 + $validation_text = !empty($field->validation_msg) ? __($field->validation_msg, 'userswp') : '';
4291 + $wrap_class = isset( $field->css_class ) ? $field->css_class.' uwp-password-wrap' : 'uwp-password-wrap';
4577 4292
4578 4293 ob_start(); // Start buffering;
4579 4294
4580 4295 if ( $design_style ) {
4581 4296
4582 - echo aui()->input(
4583 - array( // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
4584 - 'type' => 'password',
4585 - 'id' => 'confirm_password',
4586 - 'name' => 'confirm_password',
4587 - 'placeholder' => esc_attr( $placeholder ),
4588 - 'title' => esc_attr( $site_title ),
4589 - 'value' => esc_attr( $value ),
4590 - 'required' => (bool) $field->is_required,
4591 - 'help_text' => wp_kses_post( uwp_get_field_description( $field ) ),
4592 - 'label' => is_admin() && ! wp_doing_ajax() ? '' : wp_kses_post( $site_title . $required ),
4593 - 'validation_text' => $validation_text != '' ? esc_attr( $validation_text ) : esc_attr( $required_msg ),
4297 + echo aui()->input( array( // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
4298 + 'type' => 'password',
4299 + 'id' => 'confirm_password',
4300 + 'name' => 'confirm_password',
4301 + 'placeholder' => esc_attr( $placeholder ),
4302 + 'title' => esc_attr( $site_title ),
4303 + 'value' => esc_attr( $value ),
4304 + 'required' => (bool) $field->is_required,
4305 + 'help_text' => wp_kses_post( uwp_get_field_description( $field ) ),
4306 + 'label' => is_admin() && ! wp_doing_ajax() ? '' : wp_kses_post( $site_title . $required ),
4307 + 'validation_text' => $validation_text != '' ? esc_attr( $validation_text ) : esc_attr( $required_msg ),
4594 4308 'validation_pattern' => ! empty( $field->validation_pattern ) ? esc_attr( wp_unslash( $field->validation_pattern ) ) : '',
4595 - 'wrap_class' => esc_attr( $wrap_class ),
4596 - )
4597 - );
4309 + 'wrap_class' => esc_attr( $wrap_class ),
4310 + ) );
4598 4311 } else {
4599 4312 ?>
4600 4313 <div id="uwp_account_confirm_password_row"
4601 - class="<?php echo 'required_field'; ?> uwp_form_password_row uwp_clear <?php echo esc_attr( $bs_form_group ); ?>">
4314 + class="<?php echo 'required_field'; ?> uwp_form_password_row uwp_clear <?php echo esc_attr( $bs_form_group ); ?>">
4602 4315
4603 4316 <?php
4604 4317
4605 - if ( ! is_admin() ) {
4606 - ?>
4318 + if ( ! is_admin() ) { ?>
4607 4319 <label class="<?php echo esc_attr( $bs_sr_only ); ?>">
4608 4320 <?php echo ( trim( $site_title ) ) ? esc_html( $site_title ) : '&nbsp;'; ?>
4609 - <?php
4610 - if ( $field->is_required ) {
4321 + <?php if ( $field->is_required ) {
4611 4322 echo '<span>*</span>';
4612 - }
4613 - ?>
4323 + } ?>
4614 4324 </label>
4615 4325 <?php } ?>
4616 4326 <input name="confirm_password" class="uwp_textfield <?php echo esc_attr( $bs_form_control ); ?>" id="uwp_account_confirm_password" placeholder="<?php echo esc_attr( $placeholder ); ?>" value="" title="<?php echo esc_attr( $site_title ); ?>" <?php echo 'required="required"'; ?> type="password"/>
4617 4327 </div>
@@ -4648,15 +4358,15 @@
4648 4358 }
4649 4359 $enable_confirm_email_field = isset( $extra['confirm_email'] ) ? $extra['confirm_email'] : '0';
4650 4360 if ( $enable_confirm_email_field == '1' ) {
4651 4361
4652 - $design_style = uwp_get_option( 'design_style', 'bootstrap' );
4653 - $bs_form_group = $design_style ? 'form-group mb-3' : '';
4654 - $bs_sr_only = $design_style ? 'sr-only' : '';
4655 - $bs_form_control = $design_style ? 'form-control' : '';
4656 - $site_title = __( 'Confirm Email', 'userswp' );
4657 - $required_msg = ( ! empty( $field->is_required ) && $field->required_msg != '') ? __( stripslashes( $field->required_msg ), 'userswp' ) : '';
4658 - $validation_text = ! empty( $field->validation_msg ) ? __( stripslashes( $field->validation_msg ), 'userswp' ) : '';
4362 + $design_style = uwp_get_option( "design_style", "bootstrap" );
4363 + $bs_form_group = $design_style ? "form-group mb-3" : "";
4364 + $bs_sr_only = $design_style ? "sr-only" : "";
4365 + $bs_form_control = $design_style ? "form-control" : "";
4366 + $site_title = __( "Confirm Email", 'userswp' );
4367 + $required_msg = (!empty( $field->is_required ) && $field->required_msg != '') ? __( $field->required_msg, 'userswp' ) : '';
4368 + $validation_text = !empty($field->validation_msg) ? __($field->validation_msg, 'userswp') : '';
4659 4369
4660 4370 ob_start();
4661 4371
4662 4372 if ( $design_style ) {
@@ -4661,50 +4371,45 @@
4661 4371
4662 4372 if ( $design_style ) {
4663 4373 $required = ! empty( $field->is_required ) ? ' <span class="text-danger">*</span>' : '';
4664 4374
4665 - echo aui()->input(
4666 - array( // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
4667 - 'type' => 'email',
4668 - 'id' => esc_attr( $field->htmlvar_name ),
4669 - 'name' => 'confirm_email',
4670 - 'placeholder' => esc_attr( $site_title ),
4671 - 'title' => esc_attr( $site_title ),
4672 - 'value' => esc_attr( $value ),
4673 - 'required' => (bool) $field->is_required,
4674 - 'help_text' => wp_kses_post( uwp_get_field_description( $field ) ),
4675 - 'label' => is_admin() && ! wp_doing_ajax() ? '' : wp_kses_post( $site_title . $required ),
4676 - 'validation_text' => $validation_text != '' ? esc_attr( $validation_text ) : esc_attr( $required_msg ),
4375 + echo aui()->input( array( // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
4376 + 'type' => 'email',
4377 + 'id' => esc_attr( $field->htmlvar_name ),
4378 + 'name' => 'confirm_email',
4379 + 'placeholder' => esc_attr( $site_title ),
4380 + 'title' => esc_attr( $site_title ),
4381 + 'value' => esc_attr( $value ),
4382 + 'required' => (bool) $field->is_required,
4383 + 'help_text' => wp_kses_post( uwp_get_field_description( $field ) ),
4384 + 'label' => is_admin() && ! wp_doing_ajax() ? '' : wp_kses_post( $site_title . $required ),
4385 + 'validation_text' => $validation_text != '' ? esc_attr( $validation_text ) : esc_attr( $required_msg ),
4677 4386 'validation_pattern' => ! empty( $field->validation_pattern ) ? esc_attr( wp_unslash( $field->validation_pattern ) ) : '',
4678 - )
4679 - );
4387 + ) );
4680 4388 } else {
4681 4389 ?>
4682 4390 <div id="uwp_account_confirm_email_row"
4683 - class="<?php echo 'required_field'; ?> uwp_form_email_row uwp_clear <?php echo esc_attr( $bs_form_group ); ?>">
4391 + class="<?php echo 'required_field'; ?> uwp_form_email_row uwp_clear <?php echo esc_attr( $bs_form_group ); ?>">
4684 4392
4685 4393 <?php
4686 4394
4687 - if ( ! is_admin() ) {
4688 - ?>
4395 + if ( ! is_admin() ) { ?>
4689 4396 <label class="<?php echo esc_attr( $bs_sr_only ); ?>">
4690 4397 <?php echo ( trim( $site_title ) ) ? esc_attr( $site_title ) : '&nbsp;'; ?>
4691 - <?php
4692 - if ( $field->is_required ) {
4398 + <?php if ( $field->is_required ) {
4693 4399 echo '<span>*</span>';
4694 - }
4695 - ?>
4400 + } ?>
4696 4401 </label>
4697 4402 <?php } ?>
4698 4403
4699 4404 <input name="confirm_email"
4700 - class="uwp_textfield <?php echo esc_attr( $bs_form_control ); ?>"
4701 - id="uwp_account_confirm_email"
4702 - placeholder="<?php echo esc_attr( $site_title ); ?>"
4703 - value=""
4704 - title="<?php echo esc_attr( $site_title ); ?>"
4405 + class="uwp_textfield <?php echo esc_attr( $bs_form_control ); ?>"
4406 + id="uwp_account_confirm_email"
4407 + placeholder="<?php echo esc_attr( $site_title ); ?>"
4408 + value=""
4409 + title="<?php echo esc_attr( $site_title ); ?>"
4705 4410 <?php echo 'required="required"'; ?>
4706 - type="email"
4411 + type="email"
4707 4412 />
4708 4413 </div>
4709 4414 <?php
4710 4415 }
@@ -4755,10 +4460,12 @@
4755 4460 if ( $field_value == 'no' ) {
4756 4461 if ( ! in_array( $field_name, $public_fields ) ) {
4757 4462 $public_fields[] = $field_name;
4758 4463 }
4759 - } elseif ( ( $field_name = array_search( $field_name, $public_fields ) ) !== false ) {
4464 + } else {
4465 + if ( ( $field_name = array_search( $field_name, $public_fields ) ) !== false ) {
4760 4466 unset( $public_fields[ $field_name ] );
4467 + }
4761 4468 }
4762 4469 }
4763 4470
4764 4471 $value = implode( ',', $public_fields );
@@ -4766,9 +4473,9 @@
4766 4473 }
4767 4474
4768 4475 // Save tabs privacy settings
4769 4476 $tabs_table_name = uwp_get_table_prefix() . 'uwp_profile_tabs';
4770 - $tabs = $wpdb->get_results( $wpdb->prepare( 'SELECT * FROM ' . $tabs_table_name . ' WHERE form_type=%s AND user_decided = 1 ORDER BY sort_order ASC', 'profile-tabs' ) ); // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching
4477 + $tabs = $wpdb->get_results( $wpdb->prepare( "SELECT * FROM " . $tabs_table_name . " WHERE form_type=%s AND user_decided = 1 ORDER BY sort_order ASC", 'profile-tabs' ) ); // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching
4771 4478
4772 4479 if ( $tabs ) {
4773 4480 $public_fields = maybe_unserialize( $user_meta_info->tabs_privacy );
4774 4481 $do_tabs_update = false;
@@ -4784,10 +4491,11 @@
4784 4491 } else {
4785 4492 $public_fields[ $field_name ] = $field_value;
4786 4493 }
4787 4494 }
4788 -}
4789 4495
4496 + }
4497 +
4790 4498 if ( $do_tabs_update ) {
4791 4499 uwp_update_usermeta( $user_id, 'tabs_privacy', maybe_serialize( $public_fields ) );
4792 4500 }
4793 4501 }
@@ -4808,13 +4516,12 @@
4808 4516 }
4809 4517 }
4810 4518
4811 4519 $message = apply_filters( 'uwp_privacy_update_success_message', __( 'Privacy settings updated successfully.', 'userswp' ) );
4812 - $message = aui()->alert(
4813 - array(
4520 + $message = aui()->alert( array(
4814 4521 'type' => 'success',
4815 - 'content' => $message,
4816 - )
4522 + 'content' => $message
4523 + )
4817 4524 );
4818 4525 $uwp_notices[] = array( 'account' => $message );
4819 4526
4820 4527 }
@@ -4830,18 +4537,18 @@
4830 4537 // add the modal error container
4831 4538 add_action( 'uwp_template_display_notices', array( $this, 'modal_error_container' ) );
4832 4539
4833 4540 $args = array(
4834 - 'form_title' => __( 'Login', 'userswp' ),
4541 + 'form_title' => __('Login','userswp'),
4835 4542 );
4836 4543
4837 4544 // get the form
4838 4545 ob_start();
4839 - uwp_get_template( 'bootstrap/login.php', $args );
4546 + uwp_get_template( "bootstrap/login.php", $args );
4840 4547 $form = ob_get_clean();
4841 4548
4842 4549 // bs5
4843 - if ( function_exists( 'aui_bs_convert_sd_output' ) ) {
4550 + if( function_exists('aui_bs_convert_sd_output')){
4844 4551 $form = aui_bs_convert_sd_output( $form );
4845 4552 }
4846 4553 // send ajax response
4847 4554 wp_send_json_success( $form );
@@ -4863,19 +4570,16 @@
4863 4570 }
4864 4571
4865 4572 // do we need country code script in ajax?
4866 4573 $country_field = false;
4867 - $lightbox_forms = uwp_get_option( 'register_modal_form', 1 );
4868 4574
4869 - if ( isset( $_POST['form_id'] ) && ! empty( $_POST['form_id'] ) ) {
4575 + if(isset($_POST['form_id']) && !empty($_POST['form_id'])){
4870 4576 $form_id = (int)$_POST['form_id'];
4871 - } elseif ( is_array( $lightbox_forms ) && count( $lightbox_forms ) > 0 ) {
4872 - $form_id = reset( $lightbox_forms );
4873 4577 } else {
4874 4578 $form_id = 1;
4875 4579 }
4876 4580
4877 - $fields = get_register_form_fields( $form_id );
4581 + $fields = get_register_form_fields($form_id);
4878 4582 if ( ! empty( $fields ) ) {
4879 4583 foreach ( $fields as $field ) {
4880 4584 if ( $field->field_type_key == 'country' || $field->field_type_key == 'uwp_country' ) {
4881 4585 $country_field = true;
@@ -4887,22 +4591,23 @@
4887 4591
4888 4592 // maybe add country code JS
4889 4593 if ( $country_field ) {
4890 4594 $country_data = uwp_get_country_data();
4891 - echo '<script>var uwp_country_data = ' . json_encode( $country_data ) . '</script>';
4595 + echo "<script>var uwp_country_data = " . json_encode( $country_data ) . "</script>";
4892 4596 echo "<script type='text/javascript' src='" . esc_url( USERSWP_PLUGIN_URL ) . 'assets/js/countrySelect.min.js' . "' ></script>";
4893 4597 }
4894 4598
4895 - $args = array( 'form_title' => '' );
4896 - if ( $form_id > 0 ) {
4599 + $args = array('form_title' => '');
4600 + if($form_id > 0){
4897 4601 $args['id'] = $form_id;
4898 4602 }
4899 4603
4900 - $args['limit'] = $lightbox_forms;
4604 + $args['limit'] = uwp_get_option('register_modal_form', 1);
4901 4605
4902 4606 // get template
4903 - uwp_get_template( 'bootstrap/register.php', $args );
4607 + uwp_get_template( "bootstrap/register.php", $args );
4904 4608
4609 +
4905 4610 // only show the JS if NOT doing a block render
4906 4611 if ( isset( $_REQUEST['action'] ) && $_REQUEST['action'] != 'super_duper_output_shortcode' ) {
4907 4612 // load scripts
4908 4613 $wp_scripts->do_item( 'zxcvbn-async' );
@@ -4928,13 +4633,13 @@
4928 4633 function (event) {
4929 4634 var $form = $(this).closest('form');
4930 4635 if( ! $form.hasClass('uwp-login-form') ) {
4931 4636 uwp_checkPasswordStrength(
4932 - $form.find('input[name=password]'),
4933 - $form.find('input[name=confirm_password]'),
4934 - $form.find('#uwp-password-strength'),
4935 - $form.find('button[type="submit"], input[type="submit"]'),
4936 - ['black', 'listed', 'word']
4637 + $('input[name=password]', $form), // First password field
4638 + $('input[name=confirm_password]', $form), // Second password field
4639 + $('#uwp-password-strength', $form), // Strength meter
4640 + $('input[type=submit]', $form), // Submit button
4641 + ['black', 'listed', 'word'] // Blacklisted words
4937 4642 );
4938 4643 }
4939 4644 }
4940 4645 );
@@ -4944,9 +4649,9 @@
4944 4649 }
4945 4650 $form = ob_get_clean();
4946 4651
4947 4652 // bs5
4948 - if ( function_exists( 'aui_bs_convert_sd_output' ) ) {
4653 + if( function_exists('aui_bs_convert_sd_output')){
4949 4654 $form = aui_bs_convert_sd_output( $form );
4950 4655 }
4951 4656
4952 4657 // send ajax response
@@ -4961,19 +4666,16 @@
4961 4666 public function ajax_forgot_password_form() {
4962 4667
4963 4668 // add the modal error container
4964 4669 add_action( 'uwp_template_display_notices', array( $this, 'modal_error_container' ) );
4965 - $args = array(
4966 - 'form_title' => '',
4967 - 'css_class' => ''
4968 - );
4670 +
4969 4671 // get the form
4970 4672 ob_start();
4971 - uwp_get_template( 'bootstrap/forgot.php', $args );
4673 + uwp_get_template( "bootstrap/forgot.php" );
4972 4674 $form = ob_get_clean();
4973 4675
4974 4676 // bs5
4975 - if ( function_exists( 'aui_bs_convert_sd_output' ) ) {
4677 + if( function_exists('aui_bs_convert_sd_output')){
4976 4678 $form = aui_bs_convert_sd_output( $form );
4977 4679 }
4978 4680
4979 4681 // send ajax response
@@ -4996,5 +4698,5 @@
4996 4698 $html = ! empty( $field->default_value ) ? $field->default_value : ' ';
4997 4699
4998 4700 return $html;
4999 4701 }
5000 -}
4702 +}