| @@ -91,9 +91,9 @@ | ||
| 91 | 91 | ); |
| 92 | 92 | }; |
| 93 | 93 | |
| 94 | 94 | if (action == 'delete') { |
| 95 | - let msg = __('You are about to delete %1 user(s). Are you sure you want to proceed?', userCountSent); | |
| 95 | + let msg = MainWP.I18n.t('You are about to delete %1 user(s). Are you sure you want to proceed?', userCountSent); | |
| 96 | 96 | mainwp_confirm(msg, _callback); |
| 97 | 97 | return; |
| 98 | 98 | } |
| 99 | 99 | |
| @@ -106,9 +106,9 @@ | ||
| 106 | 106 | let tmp = jQuery("input[name='user[]']:checked"); |
| 107 | 107 | userCountSent = tmp.length; |
| 108 | 108 | |
| 109 | 109 | if (userCountSent == 0) { |
| 110 | - errors.push(__('Please search and select users.')); | |
| 110 | + errors.push(MainWP.I18n.t('Please search and select users.')); | |
| 111 | 111 | } |
| 112 | 112 | |
| 113 | 113 | if (errors.length > 0) { |
| 114 | 114 | jQuery('#mainwp_update_password_error').html(errors.join('<br />')); |
| @@ -257,9 +257,9 @@ | ||
| 257 | 257 | jQuery("input[name='selected_sites[]']:checked").each(function () { |
| 258 | 258 | selected_sites.push(jQuery(this).val()); |
| 259 | 259 | }); |
| 260 | 260 | if (selected_sites.length == 0) { |
| 261 | - errors.push(__('Please select at least one website or group or clients.')); | |
| 261 | + errors.push(MainWP.I18n.t('Please select at least one website or group or clients.')); | |
| 262 | 262 | } |
| 263 | 263 | } else if (jQuery('input[name="select_by"]').val() == 'client') { |
| 264 | 264 | jQuery("input[name='selected_clients[]']:checked").each(function () { |
| 265 | 265 | selected_clients.push(jQuery(this).val()); |
| @@ -264,9 +264,9 @@ | ||
| 264 | 264 | jQuery("input[name='selected_clients[]']:checked").each(function () { |
| 265 | 265 | selected_clients.push(jQuery(this).val()); |
| 266 | 266 | }); |
| 267 | 267 | if (selected_clients.length == 0) { |
| 268 | - errors.push(__('Please select at least one website or group or clients.')); | |
| 268 | + errors.push(MainWP.I18n.t('Please select at least one website or group or clients.')); | |
| 269 | 269 | } |
| 270 | 270 | } else { |
| 271 | 271 | jQuery("input[name='selected_groups[]']:checked").each(function () { |
| 272 | 272 | selected_groups.push(jQuery(this).val()); |
| @@ -271,9 +271,9 @@ | ||
| 271 | 271 | jQuery("input[name='selected_groups[]']:checked").each(function () { |
| 272 | 272 | selected_groups.push(jQuery(this).val()); |
| 273 | 273 | }); |
| 274 | 274 | if (selected_groups.length == 0) { |
| 275 | - errors.push(__('Please select at least one website or group or clients.')); | |
| 275 | + errors.push(MainWP.I18n.t('Please select at least one website or group or clients.')); | |
| 276 | 276 | } |
| 277 | 277 | } |
| 278 | 278 | |
| 279 | 279 | let role = ""; |
| @@ -372,10 +372,10 @@ | ||
| 372 | 372 | |
| 373 | 373 | jQuery('#import_user_btn_import').on('click', function () { |
| 374 | 374 | if (import_user_stop_by_user) { |
| 375 | 375 | import_user_stop_by_user = false; |
| 376 | - jQuery('#import_user_import_logging .log').append(__('Continue import.') + "\n"); | |
| 377 | - jQuery('#import_user_btn_import').val(__('Pause')); | |
| 376 | + jQuery('#import_user_import_logging .log').append(MainWP.I18n.t('Continue import.') + "\n"); | |
| 377 | + jQuery('#import_user_btn_import').val(MainWP.I18n.t('Pause')); | |
| 378 | 378 | jQuery('#MainWPBulkUploadUserLoading').show(); |
| 379 | 379 | if (import_user_count_create_fails > 0) { |
| 380 | 380 | jQuery('#import_user_btn_save_csv').attr("style", 'display:inline-block;'); //Enable |
| 381 | 381 | } |
| @@ -382,9 +382,9 @@ | ||
| 382 | 382 | mainwp_import_users_next(); |
| 383 | 383 | } else { |
| 384 | 384 | import_user_stop_by_user = true; |
| 385 | 385 | jQuery('#import_user_import_logging .log').append(_('Paused import by user.') + "\n"); |
| 386 | - jQuery('#import_user_btn_import').val(__('Continue')); | |
| 386 | + jQuery('#import_user_btn_import').val(MainWP.I18n.t('Continue')); | |
| 387 | 387 | jQuery('#MainWPBulkUploadUserLoading').hide(); |
| 388 | 388 | if (import_user_count_create_fails > 0) { |
| 389 | 389 | jQuery('#import_user_btn_save_csv').attr("style", 'display:inline-block;'); //Enable |
| 390 | 390 | } |
| @@ -409,9 +409,9 @@ | ||
| 409 | 409 | |
| 410 | 410 | |
| 411 | 411 | globalThis.mainwp_bulkupload_users = function () { |
| 412 | 412 | if (jQuery('#import_user_file_bulkupload').val() == '') { |
| 413 | - feedback('mainwp-message-zone', __('Please enter CSV file for upload.'), 'yellow'); | |
| 413 | + feedback('mainwp-message-zone', MainWP.I18n.t('Please enter CSV file for upload.'), 'yellow'); | |
| 414 | 414 | jQuery('#import_user_file_bulkupload').parent().parent().addClass('form-invalid'); |
| 415 | 415 | } else { |
| 416 | 416 | jQuery('#createuser').submit(); |
| 417 | 417 | } |
| @@ -421,8 +421,12 @@ | ||
| 421 | 421 | |
| 422 | 422 | if (import_user_stop_by_user) |
| 423 | 423 | return; |
| 424 | 424 | |
| 425 | + if (!jQuery('[id^="user_import_csv_line_"]').length) { | |
| 426 | + return; | |
| 427 | + } | |
| 428 | + | |
| 425 | 429 | import_user_current_line_number++; |
| 426 | 430 | |
| 427 | 431 | if (import_user_current_line_number > import_user_total_import) { |
| 428 | 432 | mainwp_import_users_finished(); |
| @@ -439,9 +443,9 @@ | ||
| 439 | 443 | try { |
| 440 | 444 | decoded_data = JSON.parse(import_data); |
| 441 | 445 | } catch { |
| 442 | 446 | decoded_data = false; |
| 443 | - errors.push(__('Invalid import data.')); | |
| 447 | + errors.push(MainWP.I18n.t('Invalid import data.')); | |
| 444 | 448 | } |
| 445 | 449 | |
| 446 | 450 | if (decoded_data) { |
| 447 | 451 | jQuery('#import_user_import_logging .log').append('[' + import_user_current_line_number + '] ' + original_line + '\n'); |
| @@ -494,22 +498,22 @@ | ||
| 494 | 498 | val_data.select_groups = decoded_data.select_groups == undefined ? '' : decoded_data.select_groups; |
| 495 | 499 | val_data.select_by = ''; |
| 496 | 500 | |
| 497 | 501 | if (val_data.user_login == '') { |
| 498 | - errors.push(__('Please enter a username.')); | |
| 502 | + errors.push(MainWP.I18n.t('Please enter a username.')); | |
| 499 | 503 | } |
| 500 | 504 | |
| 501 | 505 | if (val_data.email == '') { |
| 502 | - errors.push(__('Please enter an email.')); | |
| 506 | + errors.push(MainWP.I18n.t('Please enter an email.')); | |
| 503 | 507 | } |
| 504 | 508 | |
| 505 | 509 | if (val_data.pass1 == '') { |
| 506 | - errors.push(__('Please enter a password.')); | |
| 510 | + errors.push(MainWP.I18n.t('Please enter a password.')); | |
| 507 | 511 | } |
| 508 | 512 | |
| 509 | 513 | let allowed_roles = ['subscriber', 'administrator', 'editor', 'author', 'contributor']; |
| 510 | 514 | if (jQuery.inArray(val_data.role, allowed_roles) == -1) { |
| 511 | - errors.push(__('Please select a data role.')); | |
| 515 | + errors.push(MainWP.I18n.t('Please select a data role.')); | |
| 512 | 516 | } |
| 513 | 517 | |
| 514 | 518 | if (val_data.select_sites == '') { |
| 515 | 519 | |
| @@ -514,9 +518,9 @@ | ||
| 514 | 518 | if (val_data.select_sites == '') { |
| 515 | 519 | |
| 516 | 520 | let selected_groups = val_data.select_groups.split(';'); |
| 517 | 521 | if (selected_groups.length == 0) { |
| 518 | - errors.push(__('Please select websites or groups to add a user.')); | |
| 522 | + errors.push(MainWP.I18n.t('Please select websites or groups to add a user.')); | |
| 519 | 523 | } else { |
| 520 | 524 | val_data.select_groups = selected_groups; |
| 521 | 525 | val_data.select_by = 'group'; |
| 522 | 526 | } |
| @@ -522,9 +526,9 @@ | ||
| 522 | 526 | } |
| 523 | 527 | } else { |
| 524 | 528 | let selected_sites = val_data.select_sites.split(';'); |
| 525 | 529 | if (selected_sites.length == 0) { |
| 526 | - errors.push(__('Please select websites or groups to add a user.')); | |
| 530 | + errors.push(MainWP.I18n.t('Please select websites or groups to add a user.')); | |
| 527 | 531 | } else { |
| 528 | 532 | val_data.select_sites = selected_sites; |
| 529 | 533 | val_data.select_by = 'site'; |
| 530 | 534 | } |
| @@ -561,9 +565,9 @@ | ||
| 561 | 565 | |
| 562 | 566 | let mainwp_import_users_finished = function () { |
| 563 | 567 | jQuery('#import_user_btn_import').val('Finished').attr('disabled', 'true'); |
| 564 | 568 | jQuery('#MainWPBulkUploadUserLoading').hide(); |
| 565 | - jQuery('#import_user_import_logging .log').append('\n' + __('Number of users to import: %1 Created users: %2 Failed: %3', import_user_total_import, import_user_count_created_users, import_user_count_create_fails) + '\n'); | |
| 569 | + jQuery('#import_user_import_logging .log').append('\n' + MainWP.I18n.t('Number of users to import: %1 Created users: %2 Failed: %3', import_user_total_import, import_user_count_created_users, import_user_count_create_fails) + '\n'); | |
| 566 | 570 | if (import_user_count_create_fails > 0) { |
| 567 | 571 | jQuery('#import_user_btn_save_csv').attr("style", 'display:inline-block;'); //Enable |
| 568 | 572 | } |
| 569 | 573 | jQuery('#import_user_import_logging').scrollTop(jQuery('#import_user_import_logging .log').height()); |