From 1f3ebdcdd0bc89d28bed560b592f3141a1e6d6df Mon Sep 17 00:00:00 2001 From: Mykyta Synelnikov Date: Fri, 11 Aug 2023 11:57:43 +0300 Subject: [PATCH] - reviewed #1275; - fixed #1274; --- assets/js/um-modal.js | 56 +++++++++++----------- includes/admin/assets/js/um-admin-modal.js | 2 +- includes/um-short-functions.php | 17 +------ 3 files changed, 31 insertions(+), 44 deletions(-) diff --git a/assets/js/um-modal.js b/assets/js/um-modal.js index 01e6fb4b..5708f467 100644 --- a/assets/js/um-modal.js +++ b/assets/js/um-modal.js @@ -1,10 +1,10 @@ jQuery(document).ready(function() { - + jQuery(document).on('click', '.um-popup-overlay', function(){ remove_Modal(); }); - + jQuery(document).on('click', '.um-modal-overlay, a[data-action="um_remove_modal"]', function(){ um_remove_modal(); }); @@ -13,7 +13,7 @@ jQuery(document).ready(function() { e.preventDefault(); return false; }); - + jQuery(document).on('click', '.um-modal .um-single-file-preview a.cancel', function(e){ e.preventDefault(); @@ -37,10 +37,10 @@ jQuery(document).ready(function() { um_modal_responsive(); } }); - + return false; }); - + jQuery(document).on('click', '.um-modal .um-single-image-preview a.cancel', function(e){ e.preventDefault(); @@ -67,30 +67,30 @@ jQuery(document).ready(function() { um_modal_responsive(); } }); - + return false; }); - + jQuery(document).on('click', '.um-finish-upload.file:not(.disabled)', function(){ - + var key = jQuery(this).attr('data-key'); - + var preview = jQuery(this).parents('.um-modal-body').find('.um-single-file-preview').html(); - + um_remove_modal(); - + jQuery('.um-single-file-preview[data-key='+key+']').fadeIn().html( preview ); var file = jQuery('.um-field[data-key='+key+']').find('.um-single-fileinfo a').data('file'); - + jQuery('.um-single-file-preview[data-key='+key+']').parents('.um-field').find('.um-btn-auto-width').html( jQuery(this).attr('data-change') ); - + jQuery('.um-single-file-preview[data-key='+key+']').parents('.um-field').find('input[type="hidden"]').val( file ); - + }); jQuery(document).on('click', '.um-finish-upload.image:not(.disabled)', function(){ - + var elem = jQuery(this); var key = jQuery(this).attr('data-key'); var img_c = jQuery(this).parents('.um-modal-body').find('.um-single-image-preview'); @@ -112,7 +112,7 @@ jQuery(document).ready(function() { } if ( coord ) { - + jQuery(this).html( jQuery(this).attr('data-processing') ).addClass('disabled'); jQuery.ajax({ @@ -157,23 +157,23 @@ jQuery(document).ready(function() { } }); - + } else { d = new Date(); jQuery('.um-single-image-preview[data-key='+key+']').fadeIn().find('img').attr('src', src + "?"+d.getTime()); - + um_remove_modal(); - + jQuery('.um-single-image-preview[data-key='+key+']').parents('.um-field').find('.um-btn-auto-width').html( elem.attr('data-change') ); - + jQuery('.um-single-image-preview[data-key='+key+']').parents('.um-field').find('input[type=hidden]').val( file ); - + } }); - + jQuery(document.body).on('click', 'a[data-modal^="um_"], span[data-modal^="um_"]', function(e){ var modal_id = jQuery(this).attr('data-modal'); @@ -183,19 +183,19 @@ jQuery(document).ready(function() { if ( jQuery(this).data('modal-size') ) { size = jQuery(this).data('modal-size'); } - + if ( jQuery(this).data('modal-copy') ) { - + jQuery('#' + modal_id).html( jQuery(this).parents('.um-field').find('.um-modal-hidden-content').html() ); - + if ( jQuery(this).parents('.um-profile-photo').attr('data-user_id') ) { jQuery('#' + modal_id).attr('data-user_id', jQuery(this).parents('.um-profile-photo').attr('data-user_id') ); } - + if ( jQuery(this).parents('.um-cover').attr('data-ratio') ) { jQuery('#' + modal_id).attr('data-ratio', jQuery(this).parents('.um-cover').attr('data-ratio') ); } - + if ( jQuery(this).parents('.um-cover').attr('data-user_id') ) { jQuery('#' + modal_id).attr('data-user_id', jQuery(this).parents('.um-cover').attr('data-user_id') ); } @@ -209,4 +209,4 @@ jQuery(document).ready(function() { um_new_modal( modal_id, size ); }); -}); \ No newline at end of file +}); diff --git a/includes/admin/assets/js/um-admin-modal.js b/includes/admin/assets/js/um-admin-modal.js index ead883f7..7b1717b0 100644 --- a/includes/admin/assets/js/um-admin-modal.js +++ b/includes/admin/assets/js/um-admin-modal.js @@ -234,7 +234,7 @@ jQuery(document).ready(function() { /** disable link **/ - jQuery(document.body).on('click', '.um-admin-builder a, .um-admin-modal a', function(e){ + jQuery(document.body).on('click', '.um-admin-builder a, .um-admin-modal a:not(.um-preview-upload)', function(e){ e.preventDefault(); return false; }); diff --git a/includes/um-short-functions.php b/includes/um-short-functions.php index 6c1e3538..5aac9dd3 100644 --- a/includes/um-short-functions.php +++ b/includes/um-short-functions.php @@ -709,7 +709,7 @@ function um_user_submitted_registration_formatted( $style = false ) { UM()->fields()->get_fields = $fields; foreach ( $fields as $key => $array ) { - if ( isset( $array['type'] ) && $array['type'] == 'row' ) { + if ( isset( $array['type'] ) && 'row' === $array['type'] ) { $rows[ $key ] = $array; unset( UM()->fields()->get_fields[ $key ] ); // not needed now } @@ -747,7 +747,6 @@ function um_user_submitted_registration_formatted( $style = false ) { $cols_num = $col_split[ $c ]; // sub row fields - $subrow_fields = null; $subrow_fields = UM()->fields()->get_fields_in_subrow( $row_fields, $c ); if ( is_array( $subrow_fields ) ) { @@ -766,7 +765,6 @@ function um_user_submitted_registration_formatted( $style = false ) { $output .= um_user_submited_display( $key, $data['title'] ); } } - } elseif ( $cols_num == 2 ) { $col1_fields = UM()->fields()->get_fields_in_column( $subrow_fields, 1 ); @@ -782,7 +780,6 @@ function um_user_submitted_registration_formatted( $style = false ) { $output .= um_user_submited_display( $key, $data['title'] ); } } - } else { $col1_fields = UM()->fields()->get_fields_in_column( $subrow_fields, 1 ); @@ -805,29 +802,19 @@ function um_user_submitted_registration_formatted( $style = false ) { $output .= um_user_submited_display( $key, $data['title'] ); } } - } - } - } - } - - } // endfor - } } - if ( $style ) { $output .= ''; } - return $output; - } /** @@ -882,7 +869,7 @@ function um_user_submited_display( $k, $title, $data = array(), $style = true ) } if ( ! empty( $filedata['original_name'] ) ) { - $v = '' . esc_html( $filedata['original_name'] ) . ''; + $v = '' . esc_html( $filedata['original_name'] ) . ''; } else { $v = $baseurl . um_user( 'ID' ) . '/' . $file; }