PluginProbe
MainWP Dashboard: Self-hosted WordPress Management for Agencies / 6.2.2
MainWP Dashboard: Self-hosted WordPress Management for Agencies v6.2.2
6.2.2 6.2.1 6.2 6.1.8 6.1.7 6.1.6 6.1.5 6.1.4 6.1.3 6.1.2 6.1.1 6.1 6.0.12 6.0.11 4.6.0.1 5.0 5.0.1 5.0.2 5.0.3 5.0.3.1 5.0.3.2 5.1 5.1.1 5.2 5.2.1 All 155 releases
← All changes | assets/js/mainwp.js +584 -466 6.0.12 → 6.2.2 View file →
@@ -8,20 +8,20 @@
8 8 if (jQuery('.mainwp-ui-page').length) {
9 9 jQuery('.mainwp-popup-tooltip').popup()
10 10 }
11 11
12 - jQuery(document).on('click', '#mainwp-help-menu-item, #mainwp-help-menu-item-mobile', function () {
13 - jQuery('#mainwp-help-modal').modal({
14 - inverted: true,
15 - blurring: false,
16 - closable: false,
17 - onShow: function() {
18 - jQuery('#mainwp-help-modal').parent('.ui.dimmer').removeClass('dimmer');
19 - jQuery('#mainwp-help-modal').css({
20 - 'top':(jQuery(globalThis).height() - jQuery('#mainwp-help-modal').outerHeight()) / 2 + 'px',
21 - 'left':(jQuery(globalThis).width() - jQuery('#mainwp-help-modal').outerWidth()) / 2 + 'px'
22 - });
23 - },
12 + jQuery(document).on('click', '#mainwp-help-menu-item, #mainwp-help-menu-item-mobile', function () {
13 + jQuery('#mainwp-help-modal').modal({
14 + inverted: true,
15 + blurring: false,
16 + closable: false,
17 + onShow: function () {
18 + jQuery('#mainwp-help-modal').parent('.ui.dimmer').removeClass('dimmer');
19 + jQuery('#mainwp-help-modal').css({
20 + 'top': (jQuery(globalThis).height() - jQuery('#mainwp-help-modal').outerHeight()) / 2 + 'px',
21 + 'left': (jQuery(globalThis).width() - jQuery('#mainwp-help-modal').outerWidth()) / 2 + 'px'
22 + });
23 + },
24 24
25 25 }).modal('show').draggable().resizable({
26 26 handles: "n, e, s, w, ne, nw, se, sw", // Allows resizing from all edges
27 27 minWidth: 300, // Set minimum width
@@ -90,36 +90,111 @@
90 90 });
91 91
92 92 let mainwp_get_remove_calback = function (side_id) {
93 93 return function () {
94 - feedback('mainwp-message-zone', '<i class="notched circle loading icon"></i> ' + __('Removing the site. Please wait...', 'mainwp'), '');
94 + feedback('mainwp-message-zone', '<i class="notched circle loading icon"></i> ' + MainWP.I18n.t('Removing the site. Please wait...'), '');
95 95 let data = mainwp_secure_data({
96 96 action: 'mainwp_removesite',
97 97 id: side_id
98 98 });
99 99
100 - jQuery.post(ajaxurl, data, function (response) {
100 + jQuery.ajax({
101 + url: ajaxurl,
102 + data: data,
103 + timeout: 180000, // 3 minutes. Slightly longer than the PHP server timeout (2 minutes).
104 + method: 'POST',
105 + success: function (response) {
101 106
102 - let error = false;
107 + const removed_site = response?.removed_site ?? false;
108 + let msg_not_removed = MainWP.I18n.t('Site could not be removed. Please reload the page and try again.');
103 109
104 - if (response.error != undefined) {
105 - error = response.error;
106 - } else if (response.result == 'SUCCESS') {
107 - feedback('mainwp-message-zone', __('The site has been removed and the MainWP Child plugin has been disabled. You will be redirected to the Sites page right away.', 'mainwp'), 'green');
108 - } else if (response.result == 'NOSITE') {
109 - feedback('mainwp-message-zone', __('Site could not be removed. Please reload the page and try again.', 'mainwp'), 'red');
110 - error = true;
111 - } else {
112 - feedback('mainwp-message-zone', __('The site has been removed. Please make sure that the MainWP Child plugin has been deactivated properly. You will be redirected to the Sites page right away.', 'mainwp'), 'green');
113 - }
110 + let error_msg = '';
114 111
115 - if (!error) {
112 + if (typeof response?.error === 'string' && response.error.trim() !== '') {
113 + error_msg = MainWP.I18n.t('Details:') + ' ' + response.error;
114 + msg_not_removed += ' ' + error_msg;
115 + }
116 +
117 + if (response?.undefined_error) {
118 + if (!removed_site) {
119 + feedback(
120 + 'mainwp-message-zone',
121 + msg_not_removed,
122 + 'red'
123 + );
124 + return;
125 + }
126 + feedback(
127 + 'mainwp-message-zone',
128 + MainWP.I18n.t('The site has been removed. Please make sure that the MainWP Child plugin has been deactivated properly. You will be redirected to the Sites page right away.'),
129 + 'red'
130 + );
131 + } else if (!removed_site) {
132 + feedback(
133 + 'mainwp-message-zone',
134 + msg_not_removed,
135 + 'red'
136 + );
137 + return;
138 + } else if (response?.error) {
139 + let message = MainWP.I18n.t('The site has been removed. Please make sure that the MainWP Child plugin has been deactivated properly. You will be redirected to the Sites page right away.');
140 + if (error_msg) {
141 + message += ' ' + error_msg;
142 + }
143 + feedback('mainwp-message-zone', message, 'red');
144 + } else {
145 + switch (response?.result) {
146 + case 'SUCCESS':
147 + feedback(
148 + 'mainwp-message-zone',
149 + MainWP.I18n.t('The site has been removed and the MainWP Child plugin has been disabled. You will be redirected to the Sites page right away.'),
150 + 'green'
151 + );
152 + break;
153 + case 'REMOVED': // for demo sites.
154 + feedback(
155 + 'mainwp-message-zone',
156 + MainWP.I18n.t('The site has been removed. You will be redirected to the Sites page right away.'),
157 + 'green'
158 + );
159 + break;
160 + case 'NOSITE':
161 + feedback(
162 + 'mainwp-message-zone',
163 + msg_not_removed,
164 + 'red'
165 + );
166 + return;
167 + default:
168 + feedback(
169 + 'mainwp-message-zone',
170 + MainWP.I18n.t('The site has been removed. Please make sure that the MainWP Child plugin has been deactivated properly. You will be redirected to the Sites page right away.'),
171 + 'green'
172 + );
173 + }
174 + }
116 175 setTimeout(function () {
117 176 mainwp_forceReload('admin.php?page=managesites');
118 177 }, 3000);
119 - }
178 + },
179 + error: function (xhr, textStatus) {
180 + if (textStatus === 'timeout') {
181 + feedback(
182 + 'mainwp-message-zone',
183 + MainWP.I18n.t('The request timed out. Please make sure that the MainWP Child plugin has been deactivated properly.'),
184 + 'red'
185 + );
186 + return;
187 + }
120 188
121 - }, 'json');
189 + feedback(
190 + 'mainwp-message-zone',
191 + MainWP.I18n.t('An unexpected error occurred. Please reload the page and try again.'),
192 + 'red'
193 + );
194 + },
195 + dataType: 'json'
196 + });
122 197 }
123 198
124 199 }
125 200
@@ -129,9 +204,9 @@
129 204 } else if (msg_html === '' || msg_html === undefined) {
130 205 jQuery(zone_selector).html('');
131 206 }
132 207
133 - if ( colors !== undefined && colors != '') {
208 + if (colors !== undefined && colors != '') {
134 209 jQuery(zone_selector).removeClass('green yellow red');
135 210 jQuery(zone_selector).addClass(colors);
136 211 } else if (colors === '' || colors === undefined) {
137 212 jQuery(zone_selector).removeClass('green yellow red');
@@ -278,10 +353,10 @@
278 353 return false;
279 354 });
280 355 jQuery(document).on('click', '.mainwp-plugin-delete', function () {
281 356 let name = jQuery(this).closest('.row-manage-item').attr('plugin-title');
282 - let confirmMsg = __('You are about to delete the %1?', name);
283 - mainwp_confirm(confirmMsg, () =>{
357 + let confirmMsg = MainWP.I18n.t('You are about to delete the %1?', name);
358 + mainwp_confirm(confirmMsg, () => {
284 359 pluginAction(jQuery(this), 'delete');
285 360 });
286 361 return false;
287 362 });
@@ -311,9 +386,9 @@
311 386 return false;
312 387 });
313 388 jQuery(document).on('click', '.mainwp-theme-delete', function () {
314 389 let name = jQuery(this).closest('.row-manage-item').children('.themeName').val();
315 - let confirmMsg = __('You are about to delete the %1?', name);
390 + let confirmMsg = MainWP.I18n.t('You are about to delete the %1?', name);
316 391 mainwp_confirm(confirmMsg, () => {
317 392 themeAction(jQuery(this), 'delete');
318 393 });
319 394 return false;
@@ -434,14 +509,14 @@
434 509 console.log(e);
435 510 return false; // it is not or invalid json.
436 511 }
437 512 }
438 - return __('MainWP Child plugin not detected or could not be reached! Ensure the MainWP Child plugin is installed and activated on the child site, and there are no security rules blocking requests. If you continue experiencing this issue, check the MainWP Community for help.');
513 + return MainWP.I18n.t('MainWP Child plugin not detected or could not be reached! Ensure the MainWP Child plugin is installed and activated on the child site, and there are no security rules blocking requests. If you continue experiencing this issue, check the MainWP Community for help.');
439 514 }
440 515
441 516 globalThis.mainwp_get_reconnect_error = function (response, siteId) { // NOSONAR - complexity.
442 517 if ('reconnect_failed' === response) {
443 - return __('Reconnect failed. Please try again from the %1Site Settings page%2.', '<a href="admin.php?page=managesites&id=' + siteId + '">', '</a>');
518 + return MainWP.I18n.t('Reconnect failed. Please try again from the %1Site Settings page%2.', '<a href="admin.php?page=managesites&id=' + siteId + '">', '</a>');
444 519 } else {
445 520 return response;
446 521 }
447 522 }
@@ -712,9 +787,9 @@
712 787 }
713 788 }
714 789 }
715 790 } catch {
716 - result = '<i class="exclamation circle icon"></i> ' + __('Undefined error!');
791 + result = '<i class="exclamation circle icon"></i> ' + MainWP.I18n.t('Undefined error!');
717 792 }
718 793 }
719 794 if (result != '') {
720 795 //show error!
@@ -723,11 +798,11 @@
723 798
724 799 globalThis.updatesoverview_bulk_check_abandoned = function (which) {
725 800 let confirmMsg;
726 801 if ('plugin' == which) {
727 - confirmMsg = __("You are about to check abandoned plugins on the sites?");
802 + confirmMsg = MainWP.I18n.t("You are about to check abandoned plugins on the sites?");
728 803 } else {
729 - confirmMsg = __("You are about to check abandoned themes on the sites?");
804 + confirmMsg = MainWP.I18n.t("You are about to check abandoned themes on the sites?");
730 805 }
731 806 mainwp_confirm(confirmMsg, function () { mainwp_managesites_bulk_check_abandoned('all', which); });
732 807 }
733 808
@@ -770,9 +845,9 @@
770 845 }
771 846 let initData = {
772 847 progressMax: nrOfWebsites,
773 848 title: 'Check abandoned ' + ('plugin' == which ? 'plugins' : 'themes'),
774 - statusText: __('started'),
849 + statusText: MainWP.I18n.t('started'),
775 850 callback: function () {
776 851 mainwpVars.bulkManageSitesTaskRunning = false;
777 852 mainwp_forceReload();
778 853 }
@@ -843,9 +918,9 @@
843 918 * MainWP UI.
844 919 */
845 920 jQuery(function () {
846 921 jQuery('#reset-overview-settings').on('click', function () {
847 - mainwp_confirm(__('Are you sure?'), function () {
922 + mainwp_confirm(MainWP.I18n.t('Are you sure?'), function () {
848 923 let which_set = jQuery('input[name=reset_overview_which_settings]').val();
849 924 if ('sidebar_settings' == which_set) {
850 925 jQuery('#mainwp_sidebarPosition').dropdown('set selected', 1);
851 926 } else if ('overview_settings' == which_set) {
@@ -904,15 +979,15 @@
904 979 globalSync = false;
905 980 }
906 981
907 982 for (let id of allWebsiteIds) {
908 - dashboard_update_site_status(id, '<span data-inverted="" data-position="left center" data-tooltip="' + __('Pending', 'mainwp') + '"><i class="clock outline icon"></i></span>');
983 + dashboard_update_site_status(id, '<span data-inverted="" data-position="left center" data-tooltip="' + MainWP.I18n.t('Pending') + '"><i class="clock outline icon"></i></span>');
909 984 }
910 985
911 986 let nrOfWebsites = allWebsiteIds.length;
912 987
913 988 mainwpPopup('#mainwp-sync-sites-modal').init({
914 - title: (pAction == 'checknow' ? __('Check Now') : __('Data Synchronization')),
989 + title: (pAction == 'checknow' ? MainWP.I18n.t('Check Now') : MainWP.I18n.t('Data Synchronization')),
915 990 progressMax: nrOfWebsites,
916 991 statusText: (pAction == 'checknow' ? 'checked' : 'synced'),
917 992 callback: function () {
918 993 mainwpVars.bulkTaskRunning = false;
@@ -1087,9 +1162,9 @@
1087 1162
1088 1163 globalThis.dashboard_update_site_status_legacy = function (siteId, newStatus, isSuccess) {
1089 1164 jQuery('.sync-site-status[siteid="' + siteId + '"]').html(newStatus);
1090 1165 // Move successfully synced site to the bottom of the sync list
1091 - if ( isSuccess !== undefined && isSuccess) {
1166 + if (isSuccess !== undefined && isSuccess) {
1092 1167 let row = jQuery('.sync-site-status[siteid="' + siteId + '"]').closest('.item');
1093 1168 jQuery(row).insertAfter(jQuery("#sync-sites-status .item").not('.disconnected-site').last());
1094 1169 }
1095 1170 };
@@ -1168,11 +1243,11 @@
1168 1243 mainwpVars.currentThreads++;
1169 1244 mainwpVars.websitesLeft--;
1170 1245 let websiteId = mainwpVars.websitesToUpdate[mainwpVars.currentWebsite++];
1171 1246 if ('checknow' == pAction) {
1172 - dashboard_update_site_status(websiteId, '<span data-inverted="" data-position="left center" data-tooltip="' + __('Checking uptime status...', 'mainwp') + '"><i class="sync alternate loading icon"></i></span>');
1247 + dashboard_update_site_status(websiteId, '<span data-inverted="" data-position="left center" data-tooltip="' + MainWP.I18n.t('Checking uptime status...') + '"><i class="sync alternate loading icon"></i></span>');
1173 1248 } else {
1174 - dashboard_update_site_status(websiteId, '<span data-inverted="" data-position="left center" data-tooltip="' + __('Syncing data...', 'mainwp') + '"><i class="sync alternate loading icon"></i></span>');
1249 + dashboard_update_site_status(websiteId, '<span data-inverted="" data-position="left center" data-tooltip="' + MainWP.I18n.t('Syncing data...') + '"><i class="sync alternate loading icon"></i></span>');
1175 1250 }
1176 1251
1177 1252 let data = mainwp_secure_data({
1178 1253 action: ('checknow' == pAction ? 'mainwp_checksites' : 'mainwp_syncsites'),
@@ -1196,9 +1271,9 @@
1196 1271 if (response.error) {
1197 1272 let extErr = response.error;
1198 1273 dashboard_update_site_status(pWebsiteId, '<span data-inverted="" data-position="left center" data-tooltip="' + extErr + '"><i class="exclamation red icon"></i></span>');
1199 1274 } else {
1200 - dashboard_update_site_status(websiteId, '<span data-inverted="" data-position="left center" data-tooltip="' + __('Synchronization process completed successfully.', 'mainwp') + '"><i class="check green icon"></i></span>', true);
1275 + dashboard_update_site_status(websiteId, '<span data-inverted="" data-position="left center" data-tooltip="' + MainWP.I18n.t('Synchronization process completed successfully.') + '"><i class="check green icon"></i></span>', true);
1201 1276 }
1202 1277 dashboard_update_done(pAction);
1203 1278 }
1204 1279 }(websiteId, action),
@@ -1204,9 +1279,9 @@
1204 1279 }(websiteId, action),
1205 1280 error: function (pWebsiteId, pData, pErrors, pAction) {
1206 1281 return function () {
1207 1282 if (pErrors > 5) {
1208 - dashboard_update_site_status(pWebsiteId, '<span data-inverted="" data-position="left center" data-tooltip="' + __('Process timed out. Please try again.', 'mainwp') + '"><i class="exclamation yellow icon"></i></span>');
1283 + dashboard_update_site_status(pWebsiteId, '<span data-inverted="" data-position="left center" data-tooltip="' + MainWP.I18n.t('Process timed out. Please try again.') + '"><i class="exclamation yellow icon"></i></span>');
1209 1284 dashboard_update_done(pAction);
1210 1285 } else {
1211 1286 pErrors++;
1212 1287 dashboard_update_next_int(pWebsiteId, pData, pErrors, pAction);
@@ -1235,9 +1310,9 @@
1235 1310 let mainwp_delete_nonmainwp_data_next = function () {
1236 1311 mainwpVars.currentThreads++;
1237 1312 mainwpVars.websitesLeft--;
1238 1313 let websiteId = mainwpVars.websitesToUpdate[mainwpVars.currentWebsite++];
1239 - dashboard_update_site_status(websiteId, '<span data-inverted="" data-position="left center" data-tooltip="' + __('Deleting...', 'mainwp') + '"><i class="sync alternate loading icon"></i></span>');
1314 + dashboard_update_site_status(websiteId, '<span data-inverted="" data-position="left center" data-tooltip="' + MainWP.I18n.t('Deleting...') + '"><i class="sync alternate loading icon"></i></span>');
1240 1315 let data = mainwp_secure_data({
1241 1316 action: 'mainwp_delete_non_mainwp_actions',
1242 1317 wp_id: websiteId,
1243 1318 });
@@ -1254,9 +1329,9 @@
1254 1329 if (response.error) {
1255 1330 let extErr = response.error;
1256 1331 dashboard_update_site_status(pWebsiteId, '<span data-inverted="" data-position="left center" data-tooltip="' + extErr + '"><i class="exclamation red icon"></i></span>');
1257 1332 } else {
1258 - dashboard_update_site_status(websiteId, '<span data-inverted="" data-position="left center" data-tooltip="' + __('Process completed successfully.', 'mainwp') + '"><i class="check green icon"></i></span>', true);
1333 + dashboard_update_site_status(websiteId, '<span data-inverted="" data-position="left center" data-tooltip="' + MainWP.I18n.t('Process completed successfully.') + '"><i class="check green icon"></i></span>', true);
1259 1334 }
1260 1335 mainwp_delete_nonmainwp_data_done();
1261 1336 }
1262 1337 }(websiteId),
@@ -1262,9 +1337,9 @@
1262 1337 }(websiteId),
1263 1338 error: function (pWebsiteId, pData, pErrors) {
1264 1339 return function () {
1265 1340 if (pErrors > 5) {
1266 - dashboard_update_site_status(pWebsiteId, '<span data-inverted="" data-position="left center" data-tooltip="' + __('Process timed out. Please try again.', 'mainwp') + '"><i class="exclamation yellow icon"></i></span>');
1341 + dashboard_update_site_status(pWebsiteId, '<span data-inverted="" data-position="left center" data-tooltip="' + MainWP.I18n.t('Process timed out. Please try again.') + '"><i class="exclamation yellow icon"></i></span>');
1267 1342 mainwp_delete_nonmainwp_data_done();
1268 1343 } else {
1269 1344 pErrors++;
1270 1345 mainwp_delete_nonmainwp_data_next_int(pWebsiteId, pData, pErrors);
@@ -1316,11 +1391,11 @@
1316 1391
1317 1392 let nrOfWebsites = allWebsiteIds.length;
1318 1393
1319 1394 mainwpPopup('#mainwp-sync-sites-modal').init({
1320 - title: __('Disconnect All Sites'),
1395 + title: MainWP.I18n.t('Disconnect All Sites'),
1321 1396 progressMax: nrOfWebsites,
1322 - statusText: __('disconnected'),
1397 + statusText: MainWP.I18n.t('disconnected'),
1323 1398 callback: function () {
1324 1399 mainwp_forceReload();
1325 1400 }
1326 1401 });
@@ -1382,9 +1457,9 @@
1382 1457 dashboard_update_site_status(pWebsiteId, response.error + '<i class="exclamation red icon"></i>');
1383 1458 } else if (response?.result == 'success') {
1384 1459 dashboard_update_site_status(websiteId, '<i class="check green icon"></i>', true);
1385 1460 } else {
1386 - dashboard_update_site_status(pWebsiteId, __('Undefined error!') + ' <i class="exclamation red icon"></i>');
1461 + dashboard_update_site_status(pWebsiteId, MainWP.I18n.t('Undefined error!') + ' <i class="exclamation red icon"></i>');
1387 1462 }
1388 1463 mainwp_tool_disconnect_sites_done();
1389 1464 }
1390 1465 }(websiteId),
@@ -1390,9 +1465,9 @@
1390 1465 }(websiteId),
1391 1466 error: function (pWebsiteId, pData, pErrors) {
1392 1467 return function () {
1393 1468 if (pErrors > 5) {
1394 - dashboard_update_site_status(pWebsiteId, '<span data-inverted="" data-position="left center" data-tooltip="' + __('Process timed out. Please try again.', 'mainwp') + '"><i class="exclamation yellow icon"></i></span>');
1469 + dashboard_update_site_status(pWebsiteId, '<span data-inverted="" data-position="left center" data-tooltip="' + MainWP.I18n.t('Process timed out. Please try again.') + '"><i class="exclamation yellow icon"></i></span>');
1395 1470 mainwp_tool_disconnect_sites_done();
1396 1471 } else {
1397 1472 pErrors++;
1398 1473 mainwp_tool_disconnect_sites_next_int(pWebsiteId, pData, pErrors);
@@ -1423,12 +1498,14 @@
1423 1498 jQuery('.mainwp-backup-full-exclude').hide();
1424 1499 });
1425 1500 jQuery('.mainwp-checkbox-showhide-elements').on('click', function () {
1426 1501 let hiel = $(this).attr('hide-parent');
1427 - // support multi hide values.
1428 - hiel.split(';').forEach( (hi) => {
1429 - mainwp_showhide_elements(hi, $(this).find('input').is(':checked'));
1430 - });
1502 + if (hiel !== undefined && hiel !== '') {
1503 + // support multi hide values.
1504 + hiel.split(';').forEach((hi) => {
1505 + mainwp_showhide_elements(hi, $(this).find('input').is(':checked'));
1506 + });
1507 + }
1431 1508 let hideEvent = $(this).attr('fire-event-parent') ?? '';
1432 1509 if (hideEvent != '') {
1433 1510 // to sure click events finished.
1434 1511 setTimeout(function () {
@@ -1532,9 +1609,9 @@
1532 1609 mainwp_managesites_cards_reconnect(jQuery(this));
1533 1610 return false;
1534 1611 });
1535 1612
1536 - jQuery('.mainwp-updates-overview-reconnect-site').on('click', function () {
1613 + jQuery(document).on('click', '.mainwp-updates-overview-reconnect-site', function () {
1537 1614 mainwp_site_overview_reconnect(jQuery(this));
1538 1615 return false;
1539 1616 });
1540 1617
@@ -1743,9 +1820,9 @@
1743 1820 if (!valid_input) {
1744 1821 return;
1745 1822 }
1746 1823
1747 - feedback('mainwp-message-zone', __('Adding the site to your MainWP Dashboard. Please wait...'), 'green');
1824 + feedback('mainwp-message-zone', MainWP.I18n.t('Adding the site to your MainWP Dashboard. Please wait...'), 'green');
1748 1825
1749 1826 jQuery('#mainwp_managesites_add').attr('disabled', 'true'); //disable button to add..
1750 1827
1751 1828 //Check if valid user & rulewp is installed?
@@ -1779,9 +1856,9 @@
1779 1856 }
1780 1857
1781 1858 url = url.replaceAll('"', '&quot;');
1782 1859
1783 - let show_resp = __('Click %1here%2 to see response from the child site.', '<a href="javascript:void(0)" class="mainwp-show-response">', '</a>');
1860 + let show_resp = MainWP.I18n.t('Click %1here%2 to see response from the child site.', '<a href="javascript:void(0)" class="mainwp-show-response">', '</a>');
1784 1861
1785 1862 let resp_data = res_things.resp_data ? res_things.resp_data : '';
1786 1863 if ('0' == resp_data) {
1787 1864 resp_data = '';
@@ -1788,16 +1865,16 @@
1788 1865 }
1789 1866 jQuery('#mainwp-response-data-container').attr('resp-data', resp_data);
1790 1867
1791 1868 if (response == 'HTTPERROR') {
1792 - errors.push(__('This site can not be reached! Please use the Test Connection feature and see if the positive response will be returned. For additional help, please review this <a href="https://docs.mainwp.com/troubleshooting/potential-issues/">Knowledgebase document</a>, and if you still have issues, please let us know in the <a href="https://managers.mainwp.com/c/community-support/5">MainWP Community</a>.')); // NOSONAR - noopener - open safe.
1869 + errors.push(MainWP.I18n.t('This site can not be reached! Please use the Test Connection feature and see if the positive response will be returned. For additional help, please review this <a href="https://docs.mainwp.com/troubleshooting/potential-issues/">Knowledgebase document</a>, and if you still have issues, please let us know in the <a href="https://managers.mainwp.com/c/community-support/5">MainWP Community</a>.')); // NOSONAR - noopener - open safe.
1793 1870 } else if (response == 'NOMAINWP') {
1794 1871 errors.push(mainwp_js_get_error_not_detected_connect());
1795 1872 } else if (response.substring(0, 5) == 'ERROR') {
1796 1873 if (response.length == 5) {
1797 - errors.push(__('Undefined error occurred. Please try again. If the issue does not resolve, please review this <a href="https://docs.mainwp.com/troubleshooting/potential-issues/">Knowledgebase document</a>, and if you still have issues, please let us know in the <a href="https://managers.mainwp.com/c/community-support/5">MainWP Community</a>.')); // NOSONAR - noopener - open safe.
1874 + errors.push(MainWP.I18n.t('Undefined error occurred. Please try again. If the issue does not resolve, please review this <a href="https://docs.mainwp.com/troubleshooting/potential-issues/">Knowledgebase document</a>, and if you still have issues, please let us know in the <a href="https://managers.mainwp.com/c/community-support/5">MainWP Community</a>.')); // NOSONAR - noopener - open safe.
1798 1875 } else {
1799 - errors.push(__('Error detected: ') + response.substring(6));
1876 + errors.push(MainWP.I18n.t('Error detected: ') + response.substring(6));
1800 1877 }
1801 1878 } else if (response == 'OK') {
1802 1879 jQuery('#mainwp_managesites_add').attr('disabled', 'true'); //Disable add button
1803 1880
@@ -1915,12 +1992,12 @@
1915 1992
1916 1993 let errors = [];
1917 1994
1918 1995 if (jQuery('#mainwp_managesites_add_wpname').val().trim() == '') {
1919 - errors.push(__('Please enter a name for the website.'));
1996 + errors.push(MainWP.I18n.t('Please enter a name for the website.'));
1920 1997 }
1921 1998 if (jQuery('#mainwp_managesites_add_wpurl').val().trim() == '') {
1922 - errors.push(__('Please enter a valid URL for your site.'));
1999 + errors.push(MainWP.I18n.t('Please enter a valid URL for your site.'));
1923 2000 } else {
1924 2001 let url = jQuery('#mainwp_managesites_add_wpurl').val().trim();
1925 2002 if (!url.endsWith('/')) {
1926 2003 url += '/';
@@ -1928,13 +2005,13 @@
1928 2005
1929 2006 jQuery('#mainwp_managesites_add_wpurl').val(url);
1930 2007
1931 2008 if (!isUrl(jQuery('#mainwp_managesites_add_wpurl_protocol').val() + '://' + jQuery('#mainwp_managesites_add_wpurl').val())) {
1932 - errors.push(__('Please enter a valid URL for your site.'));
2009 + errors.push(MainWP.I18n.t('Please enter a valid URL for your site.'));
1933 2010 }
1934 2011 }
1935 2012 if (jQuery('#mainwp_managesites_add_wpadmin').val().trim() == '') {
1936 - errors.push(__('Please enter a username of the website administrator.'));
2013 + errors.push(MainWP.I18n.t('Please enter a username of the website administrator.'));
1937 2014 }
1938 2015
1939 2016 if (errors.length > 0) {
1940 2017 feedback('mainwp-message-zone', errors.join('<br />'), 'yellow');
@@ -1990,18 +2067,18 @@
1990 2067 selected_by: 'site',
1991 2068 };
1992 2069
1993 2070 workingEl.show();
1994 - statusEl.html(__('Preparing for installation...'));
2071 + statusEl.html(MainWP.I18n.t('Preparing for installation...'));
1995 2072
1996 2073 jQuery.post(ajaxurl, data, function (response) {
1997 2074 workingEl.hide();
1998 2075 if (response?.sites[pSiteId] === undefined) {
1999 2076 statusEl.css('color', 'red');
2000 - statusEl.html(__('Error while preparing the installation. Please, try again.'));
2077 + statusEl.html(MainWP.I18n.t('Error while preparing the installation. Please, try again.'));
2001 2078 bulkInstallCurrentThreads--;
2002 2079 } else {
2003 - statusEl.html(__('Installing...'));
2080 + statusEl.html(MainWP.I18n.t('Installing...'));
2004 2081 let data = mainwp_secure_data({
2005 2082 action: 'mainwp_ext_performinstallplugintheme',
2006 2083 type: 'plugin',
2007 2084 url: response.url,
@@ -2015,9 +2092,9 @@
2015 2092 let apply_settings = false;
2016 2093 let syc_msg = '';
2017 2094 let _success = false;
2018 2095 if ((response?.ok[pSiteId] != undefined)) {
2019 - syc_msg = __('Installation successful!');
2096 + syc_msg = MainWP.I18n.t('Installation successful!');
2020 2097 statusEl.html(syc_msg);
2021 2098 apply_settings = pPluginToInstall.find(".sync-options input[type='checkbox']:checked").length > 0;
2022 2099 if (apply_settings) {
2023 2100 mainwp_extension_apply_plugin_settings(pPluginToInstall, pSiteId, false);
@@ -2023,13 +2100,13 @@
2023 2100 mainwp_extension_apply_plugin_settings(pPluginToInstall, pSiteId, false);
2024 2101 }
2025 2102 _success = true;
2026 2103 } else if (response?.errors[pSiteId] === undefined) {
2027 - syc_msg = __('Installation failed!');
2104 + syc_msg = MainWP.I18n.t('Installation failed!');
2028 2105 statusEl.html(syc_msg);
2029 2106 statusEl.css('color', 'red');
2030 2107 } else {
2031 - syc_msg = __('Installation failed!') + ': ' + response.errors[pSiteId][1];
2108 + syc_msg = MainWP.I18n.t('Installation failed!') + ': ' + response.errors[pSiteId][1];
2032 2109 statusEl.html(syc_msg);
2033 2110 statusEl.css('color', 'red');
2034 2111 }
2035 2112
@@ -2063,9 +2140,9 @@
2063 2140 siteId: pSiteId
2064 2141 });
2065 2142
2066 2143 workingEl.show();
2067 - statusEl.html(__('Applying settings...'));
2144 + statusEl.html(MainWP.I18n.t('Applying settings...'));
2068 2145 jQuery.post(ajaxurl, data, function (response) { // NOSONAR - complex.
2069 2146 workingEl.hide();
2070 2147 let syc_msg = '';
2071 2148 let _success = false;
@@ -2074,15 +2151,15 @@
2074 2151 let msg = '';
2075 2152 if (response.message != undefined) {
2076 2153 msg = ' ' + response.message;
2077 2154 }
2078 - statusEl.html(__('Applying settings successful!') + msg);
2079 - syc_msg = __('Successful');
2155 + statusEl.html(MainWP.I18n.t('Applying settings successful!') + msg);
2156 + syc_msg = MainWP.I18n.t('Successful');
2080 2157 _success = true
2081 2158 } else if (response.error === undefined) {
2082 - statusEl.html(__('Applying settings failed!'));
2159 + statusEl.html(MainWP.I18n.t('Applying settings failed!'));
2083 2160 statusEl.css('color', 'red');
2084 - syc_msg = __('failed');
2161 + syc_msg = MainWP.I18n.t('failed');
2085 2162 } else {
2086 2163 statusEl.html(response.error);
2087 2164 statusEl.css('color', 'red');
2088 2165 syc_msg = response.error;
@@ -2087,11 +2164,11 @@
2087 2164 statusEl.css('color', 'red');
2088 2165 syc_msg = response.error;
2089 2166 }
2090 2167 } else {
2091 - statusEl.html(__('Undefined error!'));
2168 + statusEl.html(MainWP.I18n.t('Undefined error!'));
2092 2169 statusEl.css('color', 'red');
2093 - syc_msg = __('failed');
2170 + syc_msg = MainWP.I18n.t('failed');
2094 2171 }
2095 2172
2096 2173 if (syc_msg != '') {
2097 2174 if (_success)
@@ -2098,11 +2175,11 @@
2098 2175 syc_msg = '<span style="color:#0073aa">' + syc_msg + '!</span>';
2099 2176 else
2100 2177 syc_msg = '<span style="color:red">' + syc_msg + '!</span>';
2101 2178 if (pGlobal) {
2102 - syc_msg = __('Apply global %1 options', pPluginToInstall.attr('ext_name')) + ' ' + syc_msg;
2179 + syc_msg = MainWP.I18n.t('Apply global %1 options', pPluginToInstall.attr('ext_name')) + ' ' + syc_msg;
2103 2180 } else {
2104 - syc_msg = __('Apply %1 settings', pPluginToInstall.find('.sync-install-plugin').attr('plugin_name')) + ' ' + syc_msg;
2181 + syc_msg = MainWP.I18n.t('Apply %1 settings', pPluginToInstall.find('.sync-install-plugin').attr('plugin_name')) + ' ' + syc_msg;
2105 2182 }
2106 2183 jQuery('#mainwp-message-zone').append('<br/>' + syc_msg);
2107 2184 }
2108 2185 bulkInstallCurrentThreads--;
@@ -2115,9 +2192,9 @@
2115 2192
2116 2193 let errors = [];
2117 2194
2118 2195 if (jQuery('#mainwp_managesites_add_wpurl').val().trim() == '') {
2119 - errors.push(__('Please enter a valid URL for your site.'));
2196 + errors.push(MainWP.I18n.t('Please enter a valid URL for your site.'));
2120 2197 } else {
2121 2198 let clean_url = jQuery('#mainwp_managesites_add_wpurl').val().trim();
2122 2199 let protocol = jQuery('#mainwp_managesites_add_wpurl_protocol').val();
2123 2200 let url = protocol + '://' + clean_url;
@@ -2125,9 +2202,9 @@
2125 2202 url += '/';
2126 2203 }
2127 2204
2128 2205 if (!isUrl(url)) {
2129 - errors.push(__('Please enter a valid URL for your site'));
2206 + errors.push(MainWP.I18n.t('Please enter a valid URL for your site'));
2130 2207 }
2131 2208 }
2132 2209
2133 2210 if (errors.length > 0) {
@@ -2162,33 +2239,33 @@
2162 2239 if (response.error) {
2163 2240 if (response.httpCode) {
2164 2241 jQuery('#mainwp-test-connection-modal .content #mainwp-test-connection-result').show();
2165 2242 jQuery('#mainwp-test-connection-modal .content #mainwp-test-connection-result i').addClass('red times');
2166 - jQuery('#mainwp-test-connection-modal .content #mainwp-test-connection-result .content span').html(__('Connection failed!'));
2167 - jQuery('#mainwp-test-connection-modal .content #mainwp-test-connection-result .content .sub.header').html(__('URL:') + ' ' + response.host + ' - ' + __('HTTP-code:') + ' ' + response.httpCode + (response.httpCodeString ? ' (' + response.httpCodeString + ')' : '') + ' - ' + __('Error message: ') + ' ' + response.error);
2243 + jQuery('#mainwp-test-connection-modal .content #mainwp-test-connection-result .content span').html(MainWP.I18n.t('Connection failed!'));
2244 + jQuery('#mainwp-test-connection-modal .content #mainwp-test-connection-result .content .sub.header').html(MainWP.I18n.t('URL:') + ' ' + response.host + ' - ' + MainWP.I18n.t('HTTP-code:') + ' ' + response.httpCode + (response.httpCodeString ? ' (' + response.httpCodeString + ')' : '') + ' - ' + MainWP.I18n.t('Error message: ') + ' ' + response.error);
2168 2245 } else {
2169 2246 jQuery('#mainwp-test-connection-modal .content #mainwp-test-connection-result').show();
2170 2247 jQuery('#mainwp-test-connection-modal .content #mainwp-test-connection-result i').addClass('red times');
2171 - jQuery('#mainwp-test-connection-modal .content #mainwp-test-connection-result .content span').html(__('Connection test failed.'));
2172 - jQuery('#mainwp-test-connection-modal .content #mainwp-test-connection-result .content .sub.header').html(__('Error message:') + ' ' + response.error);
2248 + jQuery('#mainwp-test-connection-modal .content #mainwp-test-connection-result .content span').html(MainWP.I18n.t('Connection test failed.'));
2249 + jQuery('#mainwp-test-connection-modal .content #mainwp-test-connection-result .content .sub.header').html(MainWP.I18n.t('Error message:') + ' ' + response.error);
2173 2250 }
2174 2251 } else if (response.httpCode) {
2175 2252 if (response.httpCode == '200') {
2176 2253 jQuery('#mainwp-test-connection-modal .content #mainwp-test-connection-result').show();
2177 2254 jQuery('#mainwp-test-connection-modal .content #mainwp-test-connection-result i').addClass('green check');
2178 - jQuery('#mainwp-test-connection-modal .content #mainwp-test-connection-result .content span').html(__('Connection successful!'));
2179 - jQuery('#mainwp-test-connection-modal .content #mainwp-test-connection-result .content .sub.header').html(__('URL:') + ' ' + response.host + (response.ip === undefined ? '' : ' (IP: ' + response.ip + ')') + ' - ' + __('Received HTTP-code') + ' ' + response.httpCode + (response.httpCodeString ? ' (' + response.httpCodeString + ')' : ''));
2255 + jQuery('#mainwp-test-connection-modal .content #mainwp-test-connection-result .content span').html(MainWP.I18n.t('Connection successful!'));
2256 + jQuery('#mainwp-test-connection-modal .content #mainwp-test-connection-result .content .sub.header').html(MainWP.I18n.t('URL:') + ' ' + response.host + (response.ip === undefined ? '' : ' (IP: ' + response.ip + ')') + ' - ' + MainWP.I18n.t('Received HTTP-code') + ' ' + response.httpCode + (response.httpCodeString ? ' (' + response.httpCodeString + ')' : ''));
2180 2257 } else {
2181 2258 jQuery('#mainwp-test-connection-modal .content #mainwp-test-connection-result').show();
2182 2259 jQuery('#mainwp-test-connection-modal .content #mainwp-test-connection-result i').addClass('red times');
2183 - jQuery('#mainwp-test-connection-modal .content #mainwp-test-connection-result .content span').html(__('Connection test failed.'));
2184 - jQuery('#mainwp-test-connection-modal .content #mainwp-test-connection-result .content .sub.header').html(__('URL:') + ' ' + response.host + (response.ip === undefined ? '' : ' (IP: ' + response.ip + ')') + ' - ' + __('Received HTTP-code:') + ' ' + response.httpCode + (response.httpCodeString ? ' (' + response.httpCodeString + ')' : ''));
2260 + jQuery('#mainwp-test-connection-modal .content #mainwp-test-connection-result .content span').html(MainWP.I18n.t('Connection test failed.'));
2261 + jQuery('#mainwp-test-connection-modal .content #mainwp-test-connection-result .content .sub.header').html(MainWP.I18n.t('URL:') + ' ' + response.host + (response.ip === undefined ? '' : ' (IP: ' + response.ip + ')') + ' - ' + MainWP.I18n.t('Received HTTP-code:') + ' ' + response.httpCode + (response.httpCodeString ? ' (' + response.httpCodeString + ')' : ''));
2185 2262 }
2186 2263 } else {
2187 2264 jQuery('#mainwp-test-connection-modal .content #mainwp-test-connection-result').show('');
2188 2265 jQuery('#mainwp-test-connection-modal .content #mainwp-test-connection-result i').addClass('red times');
2189 - jQuery('#mainwp-test-connection-modal .content #mainwp-test-connection-result .content span').html(__('Connection test failed.'));
2190 - jQuery('#mainwp-test-connection-modal .content #mainwp-test-connection-result .content .sub.header').html(__('Invalid response from the server, please try again.'));
2266 + jQuery('#mainwp-test-connection-modal .content #mainwp-test-connection-result .content span').html(MainWP.I18n.t('Connection test failed.'));
2267 + jQuery('#mainwp-test-connection-modal .content #mainwp-test-connection-result .content .sub.header').html(MainWP.I18n.t('Invalid response from the server, please try again.'));
2191 2268 }
2192 2269 }, 'json');
2193 2270 }
2194 2271 };
@@ -2228,33 +2305,33 @@
2228 2305 if (response.error) {
2229 2306 if (response.httpCode) {
2230 2307 jQuery('#mainwp-test-connection-modal .content #mainwp-test-connection-result').show();
2231 2308 jQuery('#mainwp-test-connection-modal .content #mainwp-test-connection-result i').addClass('red times');
2232 - jQuery('#mainwp-test-connection-modal .content #mainwp-test-connection-result .content span').html(__('Connection failed!'));
2233 - jQuery('#mainwp-test-connection-modal .content #mainwp-test-connection-result .content .sub.header').html(__('URL:') + ' ' + response.host + ' - ' + __('HTTP-code:') + ' ' + response.httpCode + (response.httpCodeString ? ' (' + response.httpCodeString + ')' : '') + ' - ' + __('Error message: ') + ' ' + response.error);
2309 + jQuery('#mainwp-test-connection-modal .content #mainwp-test-connection-result .content span').html(MainWP.I18n.t('Connection failed!'));
2310 + jQuery('#mainwp-test-connection-modal .content #mainwp-test-connection-result .content .sub.header').html(MainWP.I18n.t('URL:') + ' ' + response.host + ' - ' + MainWP.I18n.t('HTTP-code:') + ' ' + response.httpCode + (response.httpCodeString ? ' (' + response.httpCodeString + ')' : '') + ' - ' + MainWP.I18n.t('Error message: ') + ' ' + response.error);
2234 2311 } else {
2235 2312 jQuery('#mainwp-test-connection-modal .content #mainwp-test-connection-result').show();
2236 2313 jQuery('#mainwp-test-connection-modal .content #mainwp-test-connection-result i').addClass('red times');
2237 - jQuery('#mainwp-test-connection-modal .content #mainwp-test-connection-result .content span').html(__('Connection test failed.'));
2238 - jQuery('#mainwp-test-connection-modal .content #mainwp-test-connection-result .content .sub.header').html(__('Error message:') + ' ' + response.error);
2314 + jQuery('#mainwp-test-connection-modal .content #mainwp-test-connection-result .content span').html(MainWP.I18n.t('Connection test failed.'));
2315 + jQuery('#mainwp-test-connection-modal .content #mainwp-test-connection-result .content .sub.header').html(MainWP.I18n.t('Error message:') + ' ' + response.error);
2239 2316 }
2240 2317 } else if (response.httpCode) {
2241 2318 if (response.httpCode == '200') {
2242 2319 jQuery('#mainwp-test-connection-modal .content #mainwp-test-connection-result').show();
2243 2320 jQuery('#mainwp-test-connection-modal .content #mainwp-test-connection-result i').addClass('green check');
2244 - jQuery('#mainwp-test-connection-modal .content #mainwp-test-connection-result .content span').html(__('Connection successful!'));
2245 - jQuery('#mainwp-test-connection-modal .content #mainwp-test-connection-result .content .sub.header').html(__('URL:') + ' ' + response.host + (response.ip === undefined ? '' : ' (IP: ' + response.ip + ')') + ' - ' + __('Received HTTP-code') + ' ' + response.httpCode + (response.httpCodeString ? ' (' + response.httpCodeString + ')' : ''));
2321 + jQuery('#mainwp-test-connection-modal .content #mainwp-test-connection-result .content span').html(MainWP.I18n.t('Connection successful!'));
2322 + jQuery('#mainwp-test-connection-modal .content #mainwp-test-connection-result .content .sub.header').html(MainWP.I18n.t('URL:') + ' ' + response.host + (response.ip === undefined ? '' : ' (IP: ' + response.ip + ')') + ' - ' + MainWP.I18n.t('Received HTTP-code') + ' ' + response.httpCode + (response.httpCodeString ? ' (' + response.httpCodeString + ')' : ''));
2246 2323 } else {
2247 2324 jQuery('#mainwp-test-connection-modal .content #mainwp-test-connection-result').show();
2248 2325 jQuery('#mainwp-test-connection-modal .content #mainwp-test-connection-result i').addClass('red times');
2249 - jQuery('#mainwp-test-connection-modal .content #mainwp-test-connection-result .content span').html(__('Connection test failed.'));
2250 - jQuery('#mainwp-test-connection-modal .content #mainwp-test-connection-result .content .sub.header').html(__('URL:') + ' ' + response.host + (response.ip === undefined ? '' : ' (IP: ' + response.ip + ')') + ' - ' + __('Received HTTP-code:') + ' ' + response.httpCode + (response.httpCodeString ? ' (' + response.httpCodeString + ')' : ''));
2326 + jQuery('#mainwp-test-connection-modal .content #mainwp-test-connection-result .content span').html(MainWP.I18n.t('Connection test failed.'));
2327 + jQuery('#mainwp-test-connection-modal .content #mainwp-test-connection-result .content .sub.header').html(MainWP.I18n.t('URL:') + ' ' + response.host + (response.ip === undefined ? '' : ' (IP: ' + response.ip + ')') + ' - ' + MainWP.I18n.t('Received HTTP-code:') + ' ' + response.httpCode + (response.httpCodeString ? ' (' + response.httpCodeString + ')' : ''));
2251 2328 }
2252 2329 } else {
2253 2330 jQuery('#mainwp-test-connection-modal .content #mainwp-test-connection-result').show('');
2254 2331 jQuery('#mainwp-test-connection-modal .content #mainwp-test-connection-result i').addClass('red times');
2255 - jQuery('#mainwp-test-connection-modal .content #mainwp-test-connection-result .content span').html(__('Connection test failed.'));
2256 - jQuery('#mainwp-test-connection-modal .content #mainwp-test-connection-result .content .sub.header').html(__('Invalid response from the server, please try again.'));
2332 + jQuery('#mainwp-test-connection-modal .content #mainwp-test-connection-result .content span').html(MainWP.I18n.t('Connection test failed.'));
2333 + jQuery('#mainwp-test-connection-modal .content #mainwp-test-connection-result .content .sub.header').html(MainWP.I18n.t('Invalid response from the server, please try again.'));
2257 2334 }
2258 2335 }, 'json');
2259 2336 };
2260 2337
@@ -2263,9 +2340,9 @@
2263 2340
2264 2341 let name = jQuery(obj).attr('site-name');
2265 2342 let id = jQuery(obj).attr('site-id');
2266 2343
2267 - let msg = __('Are you sure you want to remove', 'mainwp') + ' ' + name + ' ' + __('from your MainWP Dashboard?', 'mainwp');
2344 + let msg = MainWP.I18n.t('Are you sure you want to remove') + ' ' + name + ' ' + MainWP.I18n.t('from your MainWP Dashboard?');
2268 2345
2269 2346 mainwp_confirm(msg, function () {
2270 2347 jQuery('tr#child-site-' + id).html('<td colspan="999"><i class="notched circle loading icon"></i> ' + 'Removing and deactivating the MainWP Child plugin! Please wait...' + '</td>');
2271 2348 let data = mainwp_secure_data({
@@ -2282,13 +2359,13 @@
2282 2359
2283 2360 if (response.error != undefined) {
2284 2361 error = response.error;
2285 2362 } else if (response.result == 'SUCCESS') {
2286 - result = '<i class="close icon"></i>' + __('The site has been removed and the MainWP Child plugin has been disabled.');
2363 + result = '<i class="close icon"></i>' + MainWP.I18n.t('The site has been removed and the MainWP Child plugin has been disabled.');
2287 2364 } else if (response.result == 'NOSITE') {
2288 - error = '<i class="close icon"></i>' + __('The requested site has not been found.');
2365 + error = '<i class="close icon"></i>' + MainWP.I18n.t('The requested site has not been found.');
2289 2366 } else {
2290 - result = '<i class="close icon"></i>' + __('The site has been removed. Please make sure that the MainWP Child plugin has been deactivated properly.');
2367 + result = '<i class="close icon"></i>' + MainWP.I18n.t('The site has been removed. Please make sure that the MainWP Child plugin has been deactivated properly.');
2291 2368 }
2292 2369
2293 2370 if (error != '') {
2294 2371 feedback('mainwp-message-zone', error, 'red');
@@ -2333,8 +2410,21 @@
2333 2410 jQuery(document).on('click', '#mainwp_managesites_edit_test', function () {
2334 2411 mainwp_managesites_edit_test();
2335 2412 });
2336 2413
2414 + // Use detected URL (Edit Site Page): set the protocol and www selectors to the child-reported address; no autosave.
2415 + jQuery(document).on('click', '#mainwp_managesites_edit_use_detected', function () {
2416 + let scheme = jQuery(this).attr('data-scheme');
2417 + let with_www = jQuery(this).attr('data-www');
2418 + if (scheme === 'http' || scheme === 'https') {
2419 + jQuery('#mainwp_managesites_edit_siteurl_protocol').dropdown('set selected', scheme);
2420 + }
2421 + if (with_www === 'www' || with_www === 'none-www') {
2422 + jQuery('#mainwp-edit-site-edit-url-www').dropdown('set selected', with_www);
2423 + }
2424 + return false;
2425 + });
2426 +
2337 2427 // Handle submit add multi website
2338 2428 jQuery(document).on('click', '#mainwp_managesites_add_multi_site', function () {
2339 2429 let error_messages = [];
2340 2430 let has_table_data = false;
@@ -2356,19 +2446,19 @@
2356 2446
2357 2447 /**
2358 2448 * Add new user
2359 2449 */
2360 - function mainwp_gen_passsword(len = 24) {
2450 +function mainwp_gen_passsword(len = 24) {
2361 2451 const chars = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789!@#$%^&*()_+{}[]<>?';
2362 2452 const arr = new Uint32Array(len);
2363 2453 crypto.getRandomValues(arr);
2364 2454 return Array.from(arr, x => chars[x % chars.length]).join('');
2365 - }
2455 +}
2366 2456
2367 - jQuery('.mainwp-generate-password-button').on('click', function (e) {
2457 +jQuery('.mainwp-generate-password-button').on('click', function (e) {
2368 2458 e.preventDefault();
2369 2459 jQuery('#createuser #password, #mainwp-update-admin-password-form #password').val(mainwp_gen_passsword(24)).trigger('change');
2370 - });
2460 +});
2371 2461
2372 2462 jQuery(function () {
2373 2463 jQuery(document).on('click', '#bulk_add_createuser', function () {
2374 2464 mainwp_createuser();
@@ -2380,19 +2470,19 @@
2380 2470
2381 2471 let mainwp_createuser = function () {
2382 2472 let cont = true;
2383 2473 if (jQuery('#user_login').val() == '') {
2384 - feedback('mainwp-message-zone', __('Username field is required! Please enter a username.'), 'yellow');
2474 + feedback('mainwp-message-zone', MainWP.I18n.t('Username field is required! Please enter a username.'), 'yellow');
2385 2475 cont = false;
2386 2476 }
2387 2477
2388 2478 if (jQuery('#email').val() == '') {
2389 - feedback('mainwp-message-zone', __('E-mail field is required! Please enter an email address.'), 'yellow');
2479 + feedback('mainwp-message-zone', MainWP.I18n.t('E-mail field is required! Please enter an email address.'), 'yellow');
2390 2480 cont = false;
2391 2481 }
2392 2482
2393 2483 if (jQuery('#password').val() == '') {
2394 - feedback('mainwp-message-zone', __('Password field is required! Please enter the wanted password or generate a random one.'), 'yellow');
2484 + feedback('mainwp-message-zone', MainWP.I18n.t('Password field is required! Please enter the wanted password or generate a random one.'), 'yellow');
2395 2485 cont = false;
2396 2486 }
2397 2487
2398 2488 let selected_sites = [];
@@ -2403,9 +2493,9 @@
2403 2493 jQuery("input[name='selected_sites[]']:checked").each(function () {
2404 2494 selected_sites.push(jQuery(this).val());
2405 2495 });
2406 2496 if (selected_sites.length == 0) {
2407 - feedback('mainwp-message-zone', __('Please select at least one website or group or client.'), 'yellow');
2497 + feedback('mainwp-message-zone', MainWP.I18n.t('Please select at least one website or group or client.'), 'yellow');
2408 2498 cont = false;
2409 2499 }
2410 2500 } else if (jQuery('input[name="select_by"]').val() == 'client') {
2411 2501 jQuery("input[name='selected_clients[]']:checked").each(function () {
@@ -2411,9 +2501,9 @@
2411 2501 jQuery("input[name='selected_clients[]']:checked").each(function () {
2412 2502 selected_clients.push(jQuery(this).val());
2413 2503 });
2414 2504 if (selected_clients.length == 0) {
2415 - feedback('mainwp-message-zone', __('Please select at least one website or group or client.'), 'yellow');
2505 + feedback('mainwp-message-zone', MainWP.I18n.t('Please select at least one website or group or client.'), 'yellow');
2416 2506 cont = false;
2417 2507 }
2418 2508 } else {
2419 2509 jQuery("input[name='selected_groups[]']:checked").each(function () {
@@ -2419,15 +2509,15 @@
2419 2509 jQuery("input[name='selected_groups[]']:checked").each(function () {
2420 2510 selected_groups.push(jQuery(this).val());
2421 2511 });
2422 2512 if (selected_groups.length == 0) {
2423 - feedback('mainwp-message-zone', __('Please select at least one website or group or client.'), 'yellow');
2513 + feedback('mainwp-message-zone', MainWP.I18n.t('Please select at least one website or group or client.'), 'yellow');
2424 2514 cont = false;
2425 2515 }
2426 2516 }
2427 2517
2428 2518 if (cont) {
2429 - mainwp_set_message_zone('#mainwp-message-zone', '<i class="notched circle loading icon"></i> ' + __('Creating the user. Please wait...'), '', true);
2519 + mainwp_set_message_zone('#mainwp-message-zone', '<i class="notched circle loading icon"></i> ' + MainWP.I18n.t('Creating the user. Please wait...'), '', true);
2430 2520 jQuery('#bulk_add_createuser').attr('disabled', 'disabled');
2431 2521 const is_send_password = jQuery('#send_password').is(':checked') ? 1 : 0;
2432 2522 //Add user via ajax!!
2433 2523 let data = mainwp_secure_data({
@@ -2467,11 +2557,11 @@
2467 2557 }
2468 2558 }
2469 2559 } else {
2470 2560 jQuery('#mainwp-add-new-user-form').append(response);
2471 - jQuery('#mainwp-creating-new-user-modal').modal( {
2561 + jQuery('#mainwp-creating-new-user-modal').modal({
2472 2562 closable: false,
2473 - } ).modal( 'show' );
2563 + }).modal('show');
2474 2564 }
2475 2565 });
2476 2566 }
2477 2567 };
@@ -2517,9 +2607,9 @@
2517 2607 let act = jQuery(this).attr('bulk-action');
2518 2608 if (act == 'install') {
2519 2609 let selected = jQuery("input[type='radio'][name='install-plugin']:checked");
2520 2610 if (selected.length == 0) {
2521 - feedback('mainwp-message-zone', __('Please select plugin to install files.'), 'yellow');
2611 + feedback('mainwp-message-zone', MainWP.I18n.t('Please select plugin to install files.'), 'yellow');
2522 2612 } else {
2523 2613 let selectedId = /^install-([^-]*)-(.*)$/.exec(selected.attr('id'));
2524 2614 if (selectedId) {
2525 2615 mainwp_install_bulk('plugin', selectedId[2], selected.attr('plugin-name'));
@@ -2536,9 +2626,9 @@
2536 2626 let act = jQuery(this).attr('bulk-action');
2537 2627 if (act == 'install') {
2538 2628 let selected = jQuery("input[type='radio'][name='install-theme']:checked");
2539 2629 if (selected.length == 0) {
2540 - feedback('mainwp-message-zone', __('Please select theme to install files.'), 'yellow');
2630 + feedback('mainwp-message-zone', MainWP.I18n.t('Please select theme to install files.'), 'yellow');
2541 2631 } else {
2542 2632 let selectedId = /^install-([^-]*)-(.*)$/.exec(selected.attr('id'));
2543 2633 if (selectedId)
2544 2634 mainwp_install_bulk('theme', selectedId[2], selected.attr('theme-name'));
@@ -2591,9 +2681,9 @@
2591 2681 selected_sites.push(jQuery(this).val());
2592 2682 });
2593 2683
2594 2684 if (selected_sites.length == 0) {
2595 - feedback('mainwp-message-zone', __('Please select at least one website or a group or client.', 'mainwp'), 'yellow');
2685 + feedback('mainwp-message-zone', MainWP.I18n.t('Please select at least one website or a group or client.'), 'yellow');
2596 2686 return;
2597 2687 }
2598 2688
2599 2689 data['selected_sites[]'] = selected_sites;
@@ -2606,9 +2696,9 @@
2606 2696 selected_clients.push(jQuery(this).val());
2607 2697 });
2608 2698
2609 2699 if (selected_clients.length == 0) {
2610 - feedback('mainwp-message-zone', __('Please select at least one website or a group or client.', 'mainwp'), 'yellow');
2700 + feedback('mainwp-message-zone', MainWP.I18n.t('Please select at least one website or a group or client.'), 'yellow');
2611 2701 return;
2612 2702 }
2613 2703
2614 2704 data['selected_clients[]'] = selected_clients;
@@ -2620,9 +2710,9 @@
2620 2710 selected_groups.push(jQuery(this).val());
2621 2711 });
2622 2712
2623 2713 if (selected_groups.length == 0) {
2624 - feedback('mainwp-message-zone', __('Please select at least one website or a group or client.', 'mainwp'), 'yellow');
2714 + feedback('mainwp-message-zone', MainWP.I18n.t('Please select at least one website or a group or client.'), 'yellow');
2625 2715 return;
2626 2716 }
2627 2717
2628 2718 data['selected_groups[]'] = selected_groups;
@@ -2641,10 +2731,10 @@
2641 2731 let site = response.sites[siteId];
2642 2732 installQueueContent +=
2643 2733 '<div class="siteBulkInstall item" siteid="' + siteId + '" status="queue">' +
2644 2734 '<div class="right floated content">' +
2645 - '<span class="queue" data-inverted="" data-position="left center" data-tooltip="' + __('Queued') + '"><i class="clock outline icon"></i></span>' +
2646 - '<span class="progress" data-inverted="" data-position="left center" data-tooltip="' + __('Installing...') + '" style="display:none"><i class="notched circle loading icon"></i></span>' +
2735 + '<span class="queue" data-inverted="" data-position="left center" data-tooltip="' + MainWP.I18n.t('Queued') + '"><i class="clock outline icon"></i></span>' +
2736 + '<span class="progress" data-inverted="" data-position="left center" data-tooltip="' + MainWP.I18n.t('Installing...') + '" style="display:none"><i class="notched circle loading icon"></i></span>' +
2647 2737 '<span class="status"></span>' +
2648 2738 '</div>' +
2649 2739 '<div class="content">' + mainwp_links_visit_site_and_admin('', siteId) + ' ' + '<a href="' + site['url'] + '">' + site.name.replace(/\\(.)/g, '$1') + '</a></div>' + // NOSONAR - no safe replaceAll alternative.
2650 2740 '</div>';
@@ -2740,9 +2830,9 @@
2740 2830 if (response.error != undefined) {
2741 2831 statusEl.html(response.error);
2742 2832 statusEl.css('color', 'red');
2743 2833 } else if (response?.ok[siteToInstall.attr('siteid')]) {
2744 - statusEl.html('<span data-inverted="" data-position="left center" data-tooltip="' + __('Installation completed successfully.', 'mainwp') + '"><i class="check green icon"></i></span>');
2834 + statusEl.html('<span data-inverted="" data-position="left center" data-tooltip="' + MainWP.I18n.t('Installation completed successfully.') + '"><i class="check green icon"></i></span>');
2745 2835 if (installResults.installed_sites == undefined) {
2746 2836 installResults.installed_sites = [];
2747 2837 }
2748 2838 installResults.installed_sites.push(siteToInstall.attr('siteid'));
@@ -2748,9 +2838,9 @@
2748 2838 installResults.installed_sites.push(siteToInstall.attr('siteid'));
2749 2839 } else if (response?.errors[siteToInstall.attr('siteid')]) {
2750 2840 _error = response.errors[siteToInstall.attr('siteid')][1];
2751 2841 } else {
2752 - _error = __('Undefined error occurred. Please try again.', 'mainwp');
2842 + _error = MainWP.I18n.t('Undefined error occurred. Please try again.');
2753 2843 }
2754 2844
2755 2845 if (_error !== '') {
2756 2846 statusEl.html('<span data-inverted="" data-position="left center" data-tooltip="' + _error + '"><i class="times red icon"></i></span>');
@@ -2759,9 +2849,9 @@
2759 2849 bulkInstallCurrentThreads--;
2760 2850 bulkInstallDone++;
2761 2851
2762 2852 jQuery('#plugintheme-installation-progress-modal .mainwp-modal-progress').progress('set progress', bulkInstallDone);
2763 - jQuery('#plugintheme-installation-progress-modal .mainwp-modal-progress').find('.label').html(bulkInstallDone + '/' + mainwpVars.bulkInstallTotal + ' ' + __('Installed'));
2853 + jQuery('#plugintheme-installation-progress-modal .mainwp-modal-progress').find('.label').html(bulkInstallDone + '/' + mainwpVars.bulkInstallTotal + ' ' + MainWP.I18n.t('Installed'));
2764 2854 mainwp_install_bulk_start_next(type, url, activatePlugin, overwrite, slug, installResults);
2765 2855 }
2766 2856 }(type, url, activatePlugin, overwrite, siteToInstall), 'json');
2767 2857 };
@@ -2771,27 +2861,27 @@
2771 2861 let msg = '';
2772 2862 if (mainwpParams.installedBulkSettingsManager && mainwpParams.installedBulkSettingsManager == 1) {
2773 2863 if (type == 'plugin') {
2774 2864 if (total == 1)
2775 - msg = __('Would you like to use the Bulk Settings Manager with this plugin? Check out the %1Documentation%2.', '<a href="https://docs.mainwp.com/add-ons/administrative/bulk-settings-manager-extension" target="_blank">', '</a>'); // NOSONAR - noopener - open safe.
2865 + msg = MainWP.I18n.t('Would you like to use the Bulk Settings Manager with this plugin? Check out the %1Documentation%2.', '<a href="https://docs.mainwp.com/add-ons/administrative/bulk-settings-manager-extension" target="_blank">', '</a>'); // NOSONAR - noopener - open safe.
2776 2866 else
2777 - msg = __('Would you like to use the Bulk Settings Manager with these plugins? Check out the %1Documentation%2.', '<a href="https://docs.mainwp.com/add-ons/administrative/bulk-settings-manager-extension" target="_blank">', '</a>'); // NOSONAR - noopener - open safe.
2867 + msg = MainWP.I18n.t('Would you like to use the Bulk Settings Manager with these plugins? Check out the %1Documentation%2.', '<a href="https://docs.mainwp.com/add-ons/administrative/bulk-settings-manager-extension" target="_blank">', '</a>'); // NOSONAR - noopener - open safe.
2778 2868 } else if (type == 'theme') {
2779 2869 if (total == 1)
2780 - msg = __('Would you like to use the Bulk Settings Manager with this theme? Check out the %1Documentation%2.', '<a href="https://docs.mainwp.com/add-ons/administrative/bulk-settings-manager-extension" target="_blank">', '</a>'); // NOSONAR - noopener - open safe.
2870 + msg = MainWP.I18n.t('Would you like to use the Bulk Settings Manager with this theme? Check out the %1Documentation%2.', '<a href="https://docs.mainwp.com/add-ons/administrative/bulk-settings-manager-extension" target="_blank">', '</a>'); // NOSONAR - noopener - open safe.
2781 2871 else
2782 - msg = __('Would you like to use the Bulk Settings Manager with these themes? Check out the %1Documentation%2.', '<a href="https://docs.mainwp.com/add-ons/administrative/bulk-settings-manager-extension" target="_blank">', '</a>'); // NOSONAR - noopener - open safe.
2872 + msg = MainWP.I18n.t('Would you like to use the Bulk Settings Manager with these themes? Check out the %1Documentation%2.', '<a href="https://docs.mainwp.com/add-ons/administrative/bulk-settings-manager-extension" target="_blank">', '</a>'); // NOSONAR - noopener - open safe.
2783 2873 }
2784 2874 } else if (type == 'plugin') {
2785 2875 if (total == 1)
2786 - msg = __('Did you know with the %1 you can control the settings of this plugin directly from your MainWP Dashboard?', '<a href="https://mainwp.com/add-on/bulk-settings-manager/" target="_blank">Bulk Settings Extension</a>'); // NOSONAR - noopener - open safe.
2876 + msg = MainWP.I18n.t('Did you know with the %1 you can control the settings of this plugin directly from your MainWP Dashboard?', '<a href="https://mainwp.com/add-on/bulk-settings-manager/" target="_blank">Bulk Settings Extension</a>'); // NOSONAR - noopener - open safe.
2787 2877 else
2788 - msg = __('Did you know with the %1 you can control the settings of these plugins directly from your MainWP Dashboard?', '<a href="https://mainwp.com/add-on/bulk-settings-manager/" target="_blank">Bulk Settings Extension</a>'); // NOSONAR - noopener - open safe.
2878 + msg = MainWP.I18n.t('Did you know with the %1 you can control the settings of these plugins directly from your MainWP Dashboard?', '<a href="https://mainwp.com/add-on/bulk-settings-manager/" target="_blank">Bulk Settings Extension</a>'); // NOSONAR - noopener - open safe.
2789 2879 } else if (type == 'theme') {
2790 2880 if (total == 1)
2791 - msg = __('Did you know with the %1 you can control the settings of this theme directly from your MainWP Dashboard?', '<a href="https://mainwp.com/add-on/bulk-settings-manager/" target="_blank">Bulk Settings Extension</a>'); // NOSONAR - noopener - open safe.
2881 + msg = MainWP.I18n.t('Did you know with the %1 you can control the settings of this theme directly from your MainWP Dashboard?', '<a href="https://mainwp.com/add-on/bulk-settings-manager/" target="_blank">Bulk Settings Extension</a>'); // NOSONAR - noopener - open safe.
2792 2882 else
2793 - msg = __('Did you know with the %1 you can control the settings of these themes directly from your MainWP Dashboard?', '<a href="https://mainwp.com/add-on/bulk-settings-manager/" target="_blank">Bulk Settings Extension</a>'); // NOSONAR - noopener - open safe.
2883 + msg = MainWP.I18n.t('Did you know with the %1 you can control the settings of these themes directly from your MainWP Dashboard?', '<a href="https://mainwp.com/add-on/bulk-settings-manager/" target="_blank">Bulk Settings Extension</a>'); // NOSONAR - noopener - open safe.
2794 2884 }
2795 2885 return msg;
2796 2886 }
2797 2887
@@ -2821,11 +2911,11 @@
2821 2911 });
2822 2912
2823 2913 if (files.length == 0) {
2824 2914 if (type == 'plugin') {
2825 - feedback('mainwp-message-zone', __('Please upload at least one plugin to install.', 'mainwp'), 'yellow');
2915 + feedback('mainwp-message-zone', MainWP.I18n.t('Please upload at least one plugin to install.'), 'yellow');
2826 2916 } else {
2827 - feedback('mainwp-message-zone', __('Please upload at least one theme to install.', 'mainwp'), 'yellow');
2917 + feedback('mainwp-message-zone', MainWP.I18n.t('Please upload at least one theme to install.'), 'yellow');
2828 2918 }
2829 2919 return;
2830 2920 }
2831 2921
@@ -2843,9 +2933,9 @@
2843 2933 selected_sites.push(jQuery(this).val());
2844 2934 });
2845 2935
2846 2936 if (selected_sites.length == 0) {
2847 - feedback('mainwp-message-zone', __('Please select at least one website or a group or client.', 'mainwp'), 'yellow');
2937 + feedback('mainwp-message-zone', MainWP.I18n.t('Please select at least one website or a group or client.'), 'yellow');
2848 2938 return;
2849 2939 }
2850 2940 data['selected_sites[]'] = selected_sites;
2851 2941 } else if (jQuery('input[name="select_by"]').val() == 'client') {
@@ -2854,9 +2944,9 @@
2854 2944 selected_clients.push(jQuery(this).val());
2855 2945 });
2856 2946
2857 2947 if (selected_clients.length == 0) {
2858 - feedback('mainwp-message-zone', __('Please select at least one website or a group or client.', 'mainwp'), 'yellow');
2948 + feedback('mainwp-message-zone', MainWP.I18n.t('Please select at least one website or a group or client.'), 'yellow');
2859 2949 return;
2860 2950 }
2861 2951 data['selected_clients[]'] = selected_clients;
2862 2952 } else {
@@ -2864,9 +2954,9 @@
2864 2954 jQuery("input[name='selected_groups[]']:checked").each(function () {
2865 2955 selected_groups.push(jQuery(this).val());
2866 2956 });
2867 2957 if (selected_groups.length == 0) {
2868 - feedback('mainwp-message-zone', __('Please select at least one website or a group or client.', 'mainwp'), 'yellow');
2958 + feedback('mainwp-message-zone', MainWP.I18n.t('Please select at least one website or a group or client.'), 'yellow');
2869 2959 return;
2870 2960 }
2871 2961 data['selected_groups[]'] = selected_groups;
2872 2962 }
@@ -2888,10 +2978,10 @@
2888 2978
2889 2979 installQueue +=
2890 2980 '<div class="siteBulkInstall item" siteid="' + siteId + '" status="queue">' +
2891 2981 '<div class="right floated content">' +
2892 - '<span class="queue" data-inverted="" data-position="left center" data-tooltip="' + __('Queued', 'mainwp') + '"><i class="clock outline icon"></i></span>' +
2893 - '<span class="progress" data-inverted="" data-position="left center" data-tooltip="' + __('Installing...', 'mainwp') + '" style="display:none"><i class="notched circle loading icon"></i></span>' +
2982 + '<span class="queue" data-inverted="" data-position="left center" data-tooltip="' + MainWP.I18n.t('Queued') + '"><i class="clock outline icon"></i></span>' +
2983 + '<span class="progress" data-inverted="" data-position="left center" data-tooltip="' + MainWP.I18n.t('Installing...') + '" style="display:none"><i class="notched circle loading icon"></i></span>' +
2894 2984 '<span class="status"></span>' +
2895 2985 '</div>' +
2896 2986 '<div class="content">' + mainwp_links_visit_site_and_admin('', siteId) + ' ' + '<a href="' + site['url'] + '">' + site.name.replace(/\\(.)/g, '$1') + '</a></div>' + // NOSONAR - no safe replaceAll alternative.
2897 2987 '<div class="installation-entries"></div>' +
@@ -2969,9 +3059,9 @@
2969 3059 if (cost_tracker_items.length > 0) {
2970 3060 jQuery('.mainwp-cost-tracker-assistant-add-buttons-wrapper').html('');
2971 3061 let multiAddTo = cost_tracker_items.length > 1 ? 1 : 0;
2972 3062 cost_tracker_items.forEach(item => {
2973 - jQuery('.mainwp-cost-tracker-assistant-add-buttons-wrapper').append('<a href="javascript:void(0)" item-type="' + item.type + '" item-slug="' + item.slug + '" cost-id="' + item.cost_id + '" item-name="' + item.name + '" installed-sites="' + item.sites_ids.join(',') + '" multi-add-to="' + multiAddTo + '" class="ui mini button mainwp-cost-tracker-assistant-add-to-cost-tracker-button">' + ((item.cost_id != undefined && item.cost_id > 0) ? __('Edit Cost Tracker') + ' (' + item.name + ')' : __('Add to Cost Tracker') + ' (' + item.name + ')') + '</a>');
3063 + jQuery('.mainwp-cost-tracker-assistant-add-buttons-wrapper').append('<a href="javascript:void(0)" item-type="' + item.type + '" item-slug="' + item.slug + '" cost-id="' + item.cost_id + '" item-name="' + item.name + '" installed-sites="' + item.sites_ids.join(',') + '" multi-add-to="' + multiAddTo + '" class="ui mini button mainwp-cost-tracker-assistant-add-to-cost-tracker-button">' + ((item.cost_id != undefined && item.cost_id > 0) ? MainWP.I18n.t('Edit Cost Tracker') + ' (' + item.name + ')' : MainWP.I18n.t('Add to Cost Tracker') + ' (' + item.name + ')') + '</a>');
2974 3064 });
2975 3065 }
2976 3066 }
2977 3067 }
@@ -3030,11 +3120,11 @@
3030 3120 jQuery('div[siteId="' + siteid + '"] .installation-entries').html(results);
3031 3121 if (response.cost_tracker_installed_info != undefined) { // to support add to cost tracker pro.
3032 3122 jQuery('div[siteId="' + siteid + '"] .installation-entries').after(response.cost_tracker_installed_info);
3033 3123 }
3034 - statusEl.html('<span data-inverted="" data-position="left center" data-tooltip="' + __('Installation completed successfully.', 'mainwp') + '"><i class="check green icon"></i></span>');
3124 + statusEl.html('<span data-inverted="" data-position="left center" data-tooltip="' + MainWP.I18n.t('Installation completed successfully.') + '"><i class="check green icon"></i></span>');
3035 3125 } else if (response?.errors[siteid] === undefined) {
3036 - statusEl.html('<span data-inverted="" data-position="left center" data-tooltip="' + __('Undefined error occurred. Please try again.', 'mainwp') + '"><i class="times red icon"></i></span>');
3126 + statusEl.html('<span data-inverted="" data-position="left center" data-tooltip="' + MainWP.I18n.t('Undefined error occurred. Please try again.') + '"><i class="times red icon"></i></span>');
3037 3127 } else {
3038 3128 statusEl.html('<span data-inverted="" data-position="left center" data-tooltip="' + response.errors[siteid][1] + '"><i class="times red icon"></i></span>');
3039 3129 }
3040 3130
@@ -3040,9 +3130,9 @@
3040 3130
3041 3131 bulkInstallCurrentThreads--;
3042 3132 bulkInstallDone++;
3043 3133 jQuery('#plugintheme-installation-progress-modal .mainwp-modal-progress').progress('set progress', bulkInstallDone);
3044 - jQuery('#plugintheme-installation-progress-modal .mainwp-modal-progress').find('.label').html(bulkInstallDone + '/' + mainwpVars.bulkInstallTotal + ' ' + __('Installed'));
3134 + jQuery('#plugintheme-installation-progress-modal .mainwp-modal-progress').find('.label').html(bulkInstallDone + '/' + mainwpVars.bulkInstallTotal + ' ' + MainWP.I18n.t('Installed'));
3045 3135 mainwp_upload_bulk_start_next(type, urls, activatePlugin, overwrite);
3046 3136 }
3047 3137 }(type, urls, activatePlugin, overwrite, siteToInstall), 'json');
3048 3138 };
@@ -3068,9 +3158,9 @@
3068 3158 }
3069 3159
3070 3160 $('#mainwp-plugin-details-modal')
3071 3161 .modal({
3072 - onHide: function () {},
3162 + onHide: function () { },
3073 3163 onShow: () => {
3074 3164 $('#mainwp-plugin-details-modal')
3075 3165 .find('.ui.embed')
3076 3166 .embed({
@@ -3096,29 +3186,29 @@
3096 3186 let themeChangesLoadData = {};
3097 3187
3098 3188 jQuery(function ($) {
3099 3189
3100 - $(document).on('click', '.mainwp-show-history', function (e) {
3190 + $(document).on('click', '.mainwp-show-history', function (e) {
3101 3191
3102 - e.preventDefault();
3103 - e.stopPropagation();
3192 + e.preventDefault();
3193 + e.stopPropagation();
3104 3194
3105 - const view = $(this).attr('history-view');
3106 - let parent = false;
3107 - let type = 'plugin'; // default.
3108 - let title = '';
3109 - let info = '';
3110 - let name = '';
3111 - let slug = '';
3112 - let siteId = 0;
3195 + const view = $(this).attr('history-view');
3196 + let parent = false;
3197 + let type = 'plugin'; // default.
3198 + let title = '';
3199 + let info = '';
3200 + let name = '';
3201 + let slug = '';
3202 + let siteId = 0;
3113 3203
3114 - switch (view) {
3204 + switch (view) {
3115 3205 case 'update-plugins-individual':
3116 3206 parent = $(this).closest('.plugins-bulk-updates');
3117 3207 siteId = $(parent).attr('site_id');
3118 3208 info = $(parent).attr('site_name') + ' (' + $(parent).attr('site_url') + ') ' + $(parent).attr('tz-info');
3119 3209 title = $(this).closest('tr').attr('plugin_name');
3120 - slug = decodeURIComponent( $(this).closest('tr').attr('plugin_slug') );
3210 + slug = decodeURIComponent($(this).closest('tr').attr('plugin_slug'));
3121 3211 name = $(this).closest('tr').attr('plugin_name');
3122 3212 break;
3123 3213 case 'update-themes-individual':
3124 3214 parent = $(this).closest('.themes-bulk-updates');
@@ -3128,111 +3218,111 @@
3128 3218 slug = $(this).closest('tr').attr('theme_slug');
3129 3219 name = $(this).closest('tr').attr('theme_name');
3130 3220 type = 'theme';
3131 3221 break;
3132 - case 'manage-plugins-per-sites':
3133 - case 'manage-plugins-per-items':
3134 - parent = $(this).closest('.mainwp-manage-plugin-item-website');
3135 - title = $(parent).attr('plugin-name');
3136 - info = $(parent).attr('site-name') + ' (' + $(parent).attr('site-url') + ') ' + $(parent).attr('tz-info');
3137 - slug = decodeURIComponent($(parent).attr('plugin-slug'));
3138 - siteId = $(parent).attr('site-id');
3139 - break;
3140 - case 'manage-themes-per-sites':
3141 - case 'manage-themes-per-items':
3142 - parent = $(this).closest('.mainwp-manage-theme-item-website');
3143 - title = $(parent).attr('theme-name');
3144 - name = $(parent).attr('theme-name');
3145 - info = $(parent).attr('site-name') + ' (' + $(parent).attr('site-url') + ') ' + $(parent).attr('tz-info');
3146 - slug = decodeURIComponent($(parent).attr('theme-slug'));
3147 - siteId = $(parent).attr('site-id');
3148 - type = 'theme';
3149 - break;
3150 - case 'widget-plugins':
3151 - parent = $(this).closest('.row-manage-item');
3152 - title = $(parent).attr('plugin-name');
3153 - info = $('#mainwp-widget-active-plugins').attr('site-info');
3154 - slug = $(parent).attr('plugin-slug');
3155 - siteId = $('#mainwp-widget-active-plugins').attr('site-id');
3156 - break;
3157 - case 'widget-themes':
3158 - parent = $(this).closest('.row-manage-item');
3159 - title = $(parent).find('.themeName').val();
3160 - info = $('#mainwp-widget-inactive-themes').attr('site-info');
3161 - slug = $(parent).find('.themeSlug').val();
3162 - name = $(parent).find('.themeName').val();
3163 - siteId = $('#mainwp-widget-inactive-themes').attr('site-id');
3164 - type = 'theme';
3165 - break;
3166 - case 'update-plugin-per-item':
3167 - parent = $(this).closest('tr');
3168 - siteId = $(parent).attr('site_id');
3169 - info = $(parent).attr('site_name') + ' (' + $(parent).attr('site_url') + ') ' + $(parent).attr('tz-info');
3170 - title = $(parent).attr('plugin_name');
3171 - slug = decodeURIComponent($(parent).attr('plugin_slug'));
3172 - break;
3173 - case 'update-theme-per-item':
3174 - parent = $(this).closest('tr');
3175 - siteId = $(parent).attr('site_id');
3176 - info = $(parent).attr('site_name') + ' (' + decodeURIComponent( $(parent).attr('site_url') ) + ') ' + $(parent).attr('tz-info');
3177 - title = $(parent).attr('theme_name');
3178 - name = $(parent).attr('theme_name');
3179 - slug = decodeURIComponent($(parent).attr('theme_slug'));
3180 - type = 'theme';
3181 - break;
3182 - case 'update-plugin-per-site': // NOSONAR - same as above.
3183 - parent = $(this).closest('.plugins-bulk-updates');
3184 - siteId = $(parent).attr('site_id');
3185 - info = $(parent).attr('site_name') + ' (' + $(parent).attr('site_url') + ') ' + $(parent).attr('tz-info');
3186 - title = $(this).closest('tr').attr('plugin_name');
3187 - slug = decodeURIComponent( $(this).closest('tr').attr('plugin_slug') );
3188 - name = $(this).closest('tr').attr('plugin_name');
3189 - break;
3190 - case 'update-theme-per-site': // NOSONAR - same above.
3191 - parent = $(this).closest('.themes-bulk-updates');
3192 - siteId = $(parent).attr('site_id');
3193 - info = $(parent).attr('site_name') + ' (' + $(parent).attr('site_url') + ') ' + $(parent).attr('tz-info');
3194 - title = $(this).closest('tr').attr('theme_name');
3195 - slug = $(this).closest('tr').attr('theme_slug');
3196 - name = $(this).closest('tr').attr('theme_name');
3197 - type = 'theme';
3198 - break;
3199 - case 'update-plugin-per-tag':
3200 - parent = $(this).closest('.plugins-bulk-updates');
3201 - siteId = $(parent).attr('site_id');
3202 - info = $(parent).attr('site_name') + ' (' + $(parent).attr('site_url') + ') ' + $(parent).attr('tz-info');
3203 - title = $(this).closest('tr').attr('plugin_name');
3204 - slug = decodeURIComponent($(this).closest('tr').attr('plugin_slug'));
3205 - break;
3206 - case 'update-theme-per-tag':
3207 - parent = $(this).closest('.themes-bulk-updates');
3208 - siteId = $(parent).attr('site_id');
3209 - info = $(parent).attr('site_name') + ' (' + $(parent).attr('site_url') + ') ' + $(parent).attr('tz-info');
3210 - title = $(this).closest('tr').attr('theme_name');
3211 - name = $(this).closest('tr').attr('theme_name');
3212 - slug = $(this).closest('tr').attr('theme_slug');
3213 - type = 'theme';
3214 - break;
3215 - }
3222 + case 'manage-plugins-per-sites':
3223 + case 'manage-plugins-per-items':
3224 + parent = $(this).closest('.mainwp-manage-plugin-item-website');
3225 + title = $(parent).attr('plugin-name');
3226 + info = $(parent).attr('site-name') + ' (' + $(parent).attr('site-url') + ') ' + $(parent).attr('tz-info');
3227 + slug = decodeURIComponent($(parent).attr('plugin-slug'));
3228 + siteId = $(parent).attr('site-id');
3229 + break;
3230 + case 'manage-themes-per-sites':
3231 + case 'manage-themes-per-items':
3232 + parent = $(this).closest('.mainwp-manage-theme-item-website');
3233 + title = $(parent).attr('theme-name');
3234 + name = $(parent).attr('theme-name');
3235 + info = $(parent).attr('site-name') + ' (' + $(parent).attr('site-url') + ') ' + $(parent).attr('tz-info');
3236 + slug = decodeURIComponent($(parent).attr('theme-slug'));
3237 + siteId = $(parent).attr('site-id');
3238 + type = 'theme';
3239 + break;
3240 + case 'widget-plugins':
3241 + parent = $(this).closest('.row-manage-item');
3242 + title = $(parent).attr('plugin-name');
3243 + info = $('#mainwp-widget-active-plugins').attr('site-info');
3244 + slug = $(parent).attr('plugin-slug');
3245 + siteId = $('#mainwp-widget-active-plugins').attr('site-id');
3246 + break;
3247 + case 'widget-themes':
3248 + parent = $(this).closest('.row-manage-item');
3249 + title = $(parent).find('.themeName').val();
3250 + info = $('#mainwp-widget-inactive-themes').attr('site-info');
3251 + slug = $(parent).find('.themeSlug').val();
3252 + name = $(parent).find('.themeName').val();
3253 + siteId = $('#mainwp-widget-inactive-themes').attr('site-id');
3254 + type = 'theme';
3255 + break;
3256 + case 'update-plugin-per-item':
3257 + parent = $(this).closest('tr');
3258 + siteId = $(parent).attr('site_id');
3259 + info = $(parent).attr('site_name') + ' (' + $(parent).attr('site_url') + ') ' + $(parent).attr('tz-info');
3260 + title = $(parent).attr('plugin_name');
3261 + slug = decodeURIComponent($(parent).attr('plugin_slug'));
3262 + break;
3263 + case 'update-theme-per-item':
3264 + parent = $(this).closest('tr');
3265 + siteId = $(parent).attr('site_id');
3266 + info = $(parent).attr('site_name') + ' (' + decodeURIComponent($(parent).attr('site_url')) + ') ' + $(parent).attr('tz-info');
3267 + title = $(parent).attr('theme_name');
3268 + name = $(parent).attr('theme_name');
3269 + slug = decodeURIComponent($(parent).attr('theme_slug'));
3270 + type = 'theme';
3271 + break;
3272 + case 'update-plugin-per-site': // NOSONAR - same as above.
3273 + parent = $(this).closest('.plugins-bulk-updates');
3274 + siteId = $(parent).attr('site_id');
3275 + info = $(parent).attr('site_name') + ' (' + $(parent).attr('site_url') + ') ' + $(parent).attr('tz-info');
3276 + title = $(this).closest('tr').attr('plugin_name');
3277 + slug = decodeURIComponent($(this).closest('tr').attr('plugin_slug'));
3278 + name = $(this).closest('tr').attr('plugin_name');
3279 + break;
3280 + case 'update-theme-per-site': // NOSONAR - same above.
3281 + parent = $(this).closest('.themes-bulk-updates');
3282 + siteId = $(parent).attr('site_id');
3283 + info = $(parent).attr('site_name') + ' (' + $(parent).attr('site_url') + ') ' + $(parent).attr('tz-info');
3284 + title = $(this).closest('tr').attr('theme_name');
3285 + slug = $(this).closest('tr').attr('theme_slug');
3286 + name = $(this).closest('tr').attr('theme_name');
3287 + type = 'theme';
3288 + break;
3289 + case 'update-plugin-per-tag':
3290 + parent = $(this).closest('.plugins-bulk-updates');
3291 + siteId = $(parent).attr('site_id');
3292 + info = $(parent).attr('site_name') + ' (' + $(parent).attr('site_url') + ') ' + $(parent).attr('tz-info');
3293 + title = $(this).closest('tr').attr('plugin_name');
3294 + slug = decodeURIComponent($(this).closest('tr').attr('plugin_slug'));
3295 + break;
3296 + case 'update-theme-per-tag':
3297 + parent = $(this).closest('.themes-bulk-updates');
3298 + siteId = $(parent).attr('site_id');
3299 + info = $(parent).attr('site_name') + ' (' + $(parent).attr('site_url') + ') ' + $(parent).attr('tz-info');
3300 + title = $(this).closest('tr').attr('theme_name');
3301 + name = $(this).closest('tr').attr('theme_name');
3302 + slug = $(this).closest('tr').attr('theme_slug');
3303 + type = 'theme';
3304 + break;
3305 + }
3216 3306
3217 - if (type === 'plugin') {
3218 - pluginChangesLoadData = mainwp_secure_data({
3219 - action: 'mainwp_changes_logs_get_item_changes',
3220 - type: 'plugin',
3221 - slug: slug,
3222 - siteId: siteId,
3223 - from_date: '' // current date.
3224 - });
3225 - } else if (type === 'theme') {
3226 - themeChangesLoadData = mainwp_secure_data({
3227 - action: 'mainwp_changes_logs_get_item_changes',
3228 - type: 'theme',
3229 - slug: slug,
3230 - siteId: siteId,
3231 - name: name,
3232 - from_date: '' // current date.
3233 - });
3234 - }
3307 + if (type === 'plugin') {
3308 + pluginChangesLoadData = mainwp_secure_data({
3309 + action: 'mainwp_changes_logs_get_item_changes',
3310 + type: 'plugin',
3311 + slug: slug,
3312 + siteId: siteId,
3313 + from_date: '' // current date.
3314 + });
3315 + } else if (type === 'theme') {
3316 + themeChangesLoadData = mainwp_secure_data({
3317 + action: 'mainwp_changes_logs_get_item_changes',
3318 + type: 'theme',
3319 + slug: slug,
3320 + siteId: siteId,
3321 + name: name,
3322 + from_date: '' // current date.
3323 + });
3324 + }
3235 3325
3236 3326 $('#mainwp-plugin-theme-history-changes-modal').modal({
3237 3327 onHide: function () {
3238 3328 },
@@ -3244,21 +3334,21 @@
3244 3334 }).modal('show');
3245 3335 });
3246 3336 });
3247 3337
3248 -let mainwp_changes_history_box_init = function ( type, title, info ) {
3338 +let mainwp_changes_history_box_init = function (type, title, info) {
3249 3339 const hd = jQuery('#mainwp-plugin-theme-history-changes-modal > div.header');
3250 - hd.find('.main-text').text(title + ' ' + __('History')); // safe for escape.
3340 + hd.find('.main-text').text(title + ' ' + MainWP.I18n.t('History')); // safe for escape.
3251 3341 hd.find('.sub.header').text(info).show();
3252 3342 jQuery('#mainwp-plugin-theme-history-changes-modal').attr('history-type', type);
3253 3343 jQuery('#mainwp-plugin-theme-history-changes-modal').find('.scrolling.content').html('');
3254 3344 }
3255 3345
3256 -let mainwp_item_changes_load = function ( btnObj, load_more_date = '' ) {
3346 +let mainwp_item_changes_load = function (btnObj, load_more_date = '') {
3257 3347
3258 3348 let md = jQuery('#mainwp-plugin-theme-history-changes-modal');
3259 3349 let parentContent = false;
3260 - if(btnObj){
3350 + if (btnObj) {
3261 3351 parentContent = jQuery(btnObj).closest('.ui.accordion').find('.ui.content');
3262 3352 } else {
3263 3353 parentContent = jQuery(md).find('.scrolling.content')
3264 3354 }
@@ -3269,12 +3359,12 @@
3269 3359 const type = jQuery(md).attr('history-type');
3270 3360 let load_more = false;
3271 3361
3272 3362 // set load date if provided
3273 - if(typeof load_more_date === 'string' && load_more_date !== ''){
3274 - if('theme' === type){
3363 + if (typeof load_more_date === 'string' && load_more_date !== '') {
3364 + if ('theme' === type) {
3275 3365 themeChangesLoadData.from_date = load_more_date;
3276 - }else{
3366 + } else {
3277 3367 pluginChangesLoadData.from_date = load_more_date;
3278 3368 }
3279 3369 load_more = true;
3280 3370 }
@@ -3284,19 +3374,19 @@
3284 3374
3285 3375 jQuery.post(ajaxurl, data, function (response) { // NOSONAR - complex.
3286 3376 jQuery(md).find('.history-actions-loading').remove();
3287 3377 if (response?.error) {
3288 - if(parentContent){
3378 + if (parentContent) {
3289 3379 let err_content = '<div class="ui message red">' + response.error + '</div>';
3290 3380 jQuery(parentContent).html(err_content);
3291 3381 }
3292 3382 } else if (response?.list) {
3293 3383 if (response.list.length == 0) {
3294 - let msg = __('This plugin has no recorded activity in Dashboard Insights.') ;
3295 - if('theme' === type){
3296 - msg = __('This theme has no recorded activity in Dashboard Insights.') ;
3384 + let msg = MainWP.I18n.t('This plugin has no recorded activity in Dashboard Insights.');
3385 + if ('theme' === type) {
3386 + msg = MainWP.I18n.t('This theme has no recorded activity in Dashboard Insights.');
3297 3387 }
3298 - if(parentContent){
3388 + if (parentContent) {
3299 3389 let msg_content = '<div class="ui info message">' + msg + '</div>';
3300 3390 jQuery(parentContent).html(msg_content);
3301 3391 }
3302 3392 } else {
@@ -3311,9 +3401,9 @@
3311 3401 <i class="dropdown icon"></i>
3312 3402 ${dt}
3313 3403 </div>
3314 3404 <div class="six wide column right aligned">
3315 - <button type="button" class="ui circular blue mini button mainwp-day-history-switch-view">` + __('Day History') + `</button> <button class="ui basic mini button actions-count1">${records.length} ` + __('Actions') + `</button>
3405 + <button type="button" class="ui circular blue mini button mainwp-day-history-switch-view">` + MainWP.I18n.t('Day History') + `</button> <button class="ui basic mini button actions-count1">${records.length} ` + MainWP.I18n.t('Actions') + `</button>
3316 3406 </div>
3317 3407 </div>
3318 3408 </div>
3319 3409 </div>
@@ -3322,9 +3412,9 @@
3322 3412 content += `<div class="item" log-id="${record.details.log_id}">
3323 3413 <div class="ui grid">
3324 3414 <div class="eight wide column middle aligned">
3325 3415 <i class="` + get_icon_history_event(record.details.action) + ` icon"></i>
3326 - <span class="ui text ` + get_color_changes_event(record.details.action) + `">${record.details.event}</span> ` + __('by') + ` <strong>${record.details.author_name}</strong> ` + __('from') + `
3416 + <span class="ui text ` + get_color_changes_event(record.details.action) + `">${record.details.event}</span> ` + MainWP.I18n.t('by') + ` <strong>${record.details.author_name}</strong> ` + MainWP.I18n.t('from') + `
3327 3417 <strong>${record.details.source}</strong>
3328 3418 </div>
3329 3419 <div class="six wide column middle aligned">
3330 3420 ` + (record.details?.old_version && record.details?.version ? record.details.old_version + '&rarr;' + record.details.version : '') + `
@@ -3351,9 +3441,9 @@
3351 3441 name_title = response.name_title;
3352 3442 }
3353 3443
3354 3444 if (name_title != '') {
3355 - jQuery(md).find('.ui.header .main-text').text(name_title + ' ' + __('History'));
3445 + jQuery(md).find('.ui.header .main-text').text(name_title + ' ' + MainWP.I18n.t('History'));
3356 3446 }
3357 3447
3358 3448 if (load_more) {
3359 3449 jQuery(md).find('.scrolling.content').append(accordWrapper);
@@ -3360,11 +3450,11 @@
3360 3450 } else {
3361 3451 jQuery(md).find('.scrolling.content').html(accordWrapper);
3362 3452 }
3363 3453
3364 - jQuery('#change-history-according-wrapper .ui.accordion').accordion({exclusive: true});
3454 + jQuery('#change-history-according-wrapper .ui.accordion').accordion({ exclusive: true });
3365 3455
3366 - jQuery('.mainwp-day-history-switch-view').off('click.accordionFix').on('click.accordionFix', function(e){
3456 + jQuery('.mainwp-day-history-switch-view').off('click.accordionFix').on('click.accordionFix', function (e) {
3367 3457 e.preventDefault();
3368 3458 e.stopPropagation(); // now it runs before ancestor handlers
3369 3459 dayHistory_SwitchViewHandler(this);
3370 3460 return false;
@@ -3370,23 +3460,23 @@
3370 3460 return false;
3371 3461 });
3372 3462 }
3373 3463
3374 - if ( response?.onward_date ) {
3464 + if (response?.onward_date) {
3375 3465 jQuery(md).find('.actions .col-left').html('Data available from ' + response.onward_date + ' onward.');
3376 3466 }
3377 - if ( response?.more_date ) {
3378 - jQuery(md).find('.actions .col-right').html('<a href="javascript:void(0);" onclick="mainwp_item_changes_load(false,\'' + ( response.more_date ?? get_local_date_string() ) + '\');return false;">' + __('Load More') + '</a>');
3467 + if (response?.more_date) {
3468 + jQuery(md).find('.actions .col-right').html('<a href="javascript:void(0);" onclick="mainwp_item_changes_load(false,\'' + (response.more_date ?? get_local_date_string()) + '\');return false;">' + MainWP.I18n.t('Load More') + '</a>');
3379 3469 }
3380 3470 }
3381 - } else if(parentContent){
3382 - let err_content = '<div class="ui message red">' + __('Undefined error occurred. Please try again.') + '</div>';
3471 + } else if (parentContent) {
3472 + let err_content = '<div class="ui message red">' + MainWP.I18n.t('Undefined error occurred. Please try again.') + '</div>';
3383 3473 jQuery(parentContent).html(err_content);
3384 3474 }
3385 3475 }, 'json');
3386 3476 }
3387 3477
3388 -let get_icon_history_event = function( act ){
3478 +let get_icon_history_event = function (act) {
3389 3479 let icon = '';
3390 3480
3391 3481 if (act === 'delete' || act === 'deleted') {
3392 3482 icon = 'trash red';
@@ -3404,16 +3494,16 @@
3404 3494
3405 3495 return icon;
3406 3496 }
3407 3497
3408 -let get_color_changes_event = function( act ){
3498 +let get_color_changes_event = function (act) {
3409 3499 const actColorMap = {
3410 - red: ['deleted','removed','revoked','delete','deactivated','disabled','suspended','deactivate'],
3411 - orange: ['updated','modified','update'],
3500 + red: ['deleted', 'removed', 'revoked', 'delete', 'deactivated', 'disabled', 'suspended', 'deactivate'],
3501 + orange: ['updated', 'modified', 'update'],
3412 3502 grey: ['opened'],
3413 - blue: ['logged-in','logged-out'],
3414 - teal: ['sync','installed','install','uploaded'],
3415 - green: ['activated','activate','created','published','enabled','added']
3503 + blue: ['logged-in', 'logged-out'],
3504 + teal: ['sync', 'installed', 'install', 'uploaded'],
3505 + green: ['activated', 'activate', 'created', 'published', 'enabled', 'added']
3416 3506 };
3417 3507
3418 3508 let color = '';
3419 3509
@@ -3457,16 +3547,16 @@
3457 3547 if (response.error != undefined) {
3458 3548 dayContent.append('<div class="ui message red changes-history-status">' + response.error + '</div>');
3459 3549 } else if (response?.list) {
3460 3550 if (response.list.length == 0) {
3461 - let msg = __('This plugin has no recorded activity in Dashboard Insights.');
3551 + let msg = MainWP.I18n.t('This plugin has no recorded activity in Dashboard Insights.');
3462 3552 if ('theme' === type && '' === dt) {
3463 - msg = __('This theme has no recorded activity in Dashboard Insights.');
3553 + msg = MainWP.I18n.t('This theme has no recorded activity in Dashboard Insights.');
3464 3554 } else if ('' !== dt) {
3465 3555 if ('plugin' === type) {
3466 - msg = __('No history changes found for the plugin on this day.');
3556 + msg = MainWP.I18n.t('No history changes found for the plugin on this day.');
3467 3557 } else {
3468 - msg = __('No history changes found for the theme on this day.');
3558 + msg = MainWP.I18n.t('No history changes found for the theme on this day.');
3469 3559 }
3470 3560 }
3471 3561 dayContent.append('<div class="ui message changes-history-status">' + msg + '</div>');
3472 3562 } else {
@@ -3482,9 +3572,9 @@
3482 3572 <i class="dropdown icon"></i>
3483 3573 ${name}
3484 3574 </div>
3485 3575 <div class="six wide column right aligned">
3486 - <button type="button" class="ui circular blue mini button mainwp-list-history-switch-view">` + ( 'plugin' === type ? __('Plugin History') : __('Theme History') ) + `</button> <button class="ui basic mini button ">${records.length} ` + __('Actions') + `</button>
3576 + <button type="button" class="ui circular blue mini button mainwp-list-history-switch-view">` + ('plugin' === type ? MainWP.I18n.t('Plugin History') : MainWP.I18n.t('Theme History')) + `</button> <button class="ui basic mini button ">${records.length} ` + MainWP.I18n.t('Actions') + `</button>
3487 3577 </div>
3488 3578 </div>
3489 3579 </div>
3490 3580 </div>
@@ -3493,9 +3583,9 @@
3493 3583 content += `<div class="item" log-id="${record.details.log_id}">
3494 3584 <div class="ui grid">
3495 3585 <div class="eight wide column middle aligned">
3496 3586 <i class="` + get_icon_history_event(record.details.action) + ` icon"></i>
3497 - <span class="ui text ` + get_color_changes_event(record.details.action) + `">${record.details.event}</span> ` + __('by') + ` <strong>${record.details.author_name}</strong> ` + __('from') + `
3587 + <span class="ui text ` + get_color_changes_event(record.details.action) + `">${record.details.event}</span> ` + MainWP.I18n.t('by') + ` <strong>${record.details.author_name}</strong> ` + MainWP.I18n.t('from') + `
3498 3588 <strong>${record.details.source}</strong>
3499 3589 </div>
3500 3590 <div class="six wide column middle aligned">
3501 3591 ` + (record.details?.old_version && record.details?.version ? record.details.old_version + '&rarr;' + record.details.version : '') + `
@@ -3511,17 +3601,17 @@
3511 3601 </div>`;
3512 3602 });
3513 3603
3514 3604 if ('' !== content) {
3515 - jQuery(md).find('.ui.header .main-text').text(his_date + ' ' + __('History'));
3605 + jQuery(md).find('.ui.header .main-text').text(his_date + ' ' + MainWP.I18n.t('History'));
3516 3606 let accordWrapper = jQuery("<div>", {
3517 3607 id: "change-history-according-wrapper",
3518 3608 html: content
3519 3609 });
3520 3610 jQuery(md).find('.scrolling.content').html(accordWrapper);
3521 - jQuery('#change-history-according-wrapper .ui.accordion').accordion({exclusive: true});
3611 + jQuery('#change-history-according-wrapper .ui.accordion').accordion({ exclusive: true });
3522 3612
3523 - jQuery('.mainwp-list-history-switch-view').off('click.accordionFix2').on('click.accordionFix2', function(e){
3613 + jQuery('.mainwp-list-history-switch-view').off('click.accordionFix2').on('click.accordionFix2', function (e) {
3524 3614 e.preventDefault();
3525 3615 e.stopPropagation(); // now it runs before ancestor handlers
3526 3616 listHistory_SwitchViewHandler(this);
3527 3617 return false;
@@ -3528,9 +3618,9 @@
3528 3618 });
3529 3619 }
3530 3620 }
3531 3621 } else {
3532 - dayContent.html('<div class="ui message red changes-history-status">' + __('Undefined error occurred. Please try again.') + '</div>');
3622 + dayContent.html('<div class="ui message red changes-history-status">' + MainWP.I18n.t('Undefined error occurred. Please try again.') + '</div>');
3533 3623 }
3534 3624 }, 'json');
3535 3625
3536 3626 return false;
@@ -3547,19 +3637,19 @@
3547 3637
3548 3638 let md = jQuery('#mainwp-plugin-theme-history-changes-modal');
3549 3639 const type = jQuery(md).attr('history-type');
3550 3640
3551 - if('theme' === type){
3641 + if ('theme' === type) {
3552 3642 themeChangesLoadData.slug = jQuery(parent).data('slug');
3553 3643 themeChangesLoadData.name = jQuery(parent).data('name');
3554 3644 themeChangesLoadData.siteId = jQuery(parent).data('siteid');
3555 3645 themeChangesLoadData.from_date = '';
3556 - }else{
3646 + } else {
3557 3647 pluginChangesLoadData.slug = jQuery(parent).data('slug');;
3558 3648 pluginChangesLoadData.siteId = jQuery(parent).data('siteid');;
3559 3649 pluginChangesLoadData.from_date = '';
3560 3650 }
3561 - mainwp_item_changes_load( btn );
3651 + mainwp_item_changes_load(btn);
3562 3652 }
3563 3653
3564 3654
3565 3655 /**
@@ -3569,9 +3659,9 @@
3569 3659
3570 3660 globalThis.mainwp_install_check_plugin_prepare = function (slug) {
3571 3661 let selected = jQuery("input[name='install_checker[]']:checked");
3572 3662 if (selected.length == 0) {
3573 - feedback('mainwp-message-zone-install', __('Please select website to install plugin.'), 'yellow');
3663 + feedback('mainwp-message-zone-install', MainWP.I18n.t('Please select website to install plugin.'), 'yellow');
3574 3664 return;
3575 3665 } else {
3576 3666 selected.each(function () {
3577 3667 jQuery(this).closest('.siteBulkInstall').attr('status', 'queue');
@@ -3621,19 +3711,19 @@
3621 3711 if (response.error != undefined) {
3622 3712 statusEl.html(response.error);
3623 3713 statusEl.css('color', 'red');
3624 3714 } else if (response?.ok[siteToInstall.attr('siteid')]) {
3625 - statusEl.html('<span data-inverted="" data-position="left center" data-tooltip="' + __('Installation completed successfully.', 'mainwp') + '"><i class="check green icon"></i></span>');
3715 + statusEl.html('<span data-inverted="" data-position="left center" data-tooltip="' + MainWP.I18n.t('Installation completed successfully.') + '"><i class="check green icon"></i></span>');
3626 3716 } else if (response?.errors[siteToInstall.attr('siteid')]) {
3627 3717 statusEl.html('<span data-inverted="" data-position="left center" data-tooltip="' + response.errors[siteToInstall.attr('siteid')][1] + '"><i class="times red icon"></i></span>');
3628 3718 } else {
3629 - statusEl.html('<span data-inverted="" data-position="left center" data-tooltip="' + __('Undefined error occurred. Please try again.', 'mainwp') + '"><i class="times red icon"></i></span>');
3719 + statusEl.html('<span data-inverted="" data-position="left center" data-tooltip="' + MainWP.I18n.t('Undefined error occurred. Please try again.') + '"><i class="times red icon"></i></span>');
3630 3720 }
3631 3721
3632 3722 bulkInstallCurrentThreads--;
3633 3723 bulkInstallDone++;
3634 3724 jQuery('#plugintheme-installation-progress-modal .mainwp-modal-progress').progress('set progress', bulkInstallDone);
3635 - jQuery('#plugintheme-installation-progress-modal .mainwp-modal-progress').find('.label').html(bulkInstallDone + '/' + mainwpVars.bulkInstallTotal + ' ' + __('Installed'));
3725 + jQuery('#plugintheme-installation-progress-modal .mainwp-modal-progress').find('.label').html(bulkInstallDone + '/' + mainwpVars.bulkInstallTotal + ' ' + MainWP.I18n.t('Installed'));
3636 3726 mainwp_install_check_plugin_start_next(url);
3637 3727 }
3638 3728 }(url, siteToInstall), 'json');
3639 3729 };
@@ -3718,9 +3808,9 @@
3718 3808
3719 3809 jQuery(document).on('click', '.mainwp-edit-site-note', function () {
3720 3810 let id = jQuery(this).attr('id').substring(13);
3721 3811 let note = jQuery('#mainwp-notes-' + id + '-note').html();
3722 - jQuery('#mainwp-notes-html').html(note == '' ? __('No saved notes. Click the Edit button to edit site notes.') : note);
3812 + jQuery('#mainwp-notes-html').html(note == '' ? MainWP.I18n.t('No saved notes. Click the Edit button to edit site notes.') : note);
3723 3813 jQuery('#mainwp-notes-note').val(note);
3724 3814 jQuery('#mainwp-notes-websiteid').val(id);
3725 3815 jQuery('#mainwp-which-note').val('site'); // to fix conflict.
3726 3816 mainwp_notes_show();
@@ -3775,21 +3865,21 @@
3775 3865 websiteid: normalid,
3776 3866 note: newnote
3777 3867 });
3778 3868
3779 - jQuery('#mainwp-notes-status').html('<i class="notched circle loading icon"></i> ' + __('Saving note. Please wait...')).show();
3869 + jQuery('#mainwp-notes-status').html('<i class="notched circle loading icon"></i> ' + MainWP.I18n.t('Saving note. Please wait...')).show();
3780 3870
3781 3871 jQuery.post(ajaxurl, data, function (response) {
3782 3872 if (response.error != undefined) {
3783 3873 jQuery('#mainwp-notes-status').html(response.error).addClass('red');
3784 3874 } else if (response.result == 'SUCCESS') {
3785 - jQuery('#mainwp-notes-status').html(__('Note saved successfully.')).addClass('green');
3875 + jQuery('#mainwp-notes-status').html(MainWP.I18n.t('Note saved successfully.')).addClass('green');
3786 3876 if (jQuery('#mainwp-notes-' + normalid + '-note').length > 0) {
3787 3877 jQuery('#mainwp-notes-' + normalid + '-note').html(response?.esc_note_content ?? '');
3788 3878 jQuery('#mainwp-notes-html').html(response?.esc_note_content ?? '');
3789 3879 }
3790 3880 } else {
3791 - jQuery('#mainwp-notes-status').html(__('Undefined error occured while saving your note!')).addClass('red');
3881 + jQuery('#mainwp-notes-status').html(MainWP.I18n.t('Undefined error occurred while saving your note!')).addClass('red');
3792 3882 }
3793 3883 }, 'json');
3794 3884
3795 3885 setTimeout(function () {
@@ -3804,9 +3894,9 @@
3804 3894 };
3805 3895
3806 3896 globalThis.getErrorMessage = function (pError, msgOnly) { // NOSONAR - complex.
3807 3897 if (pError.message == 'HTTPERROR') {
3808 - return __('HTTP error') + '! ' + pError.extra;
3898 + return MainWP.I18n.t('HTTP error') + '! ' + pError.extra;
3809 3899 } else if (pError.message == 'NOMAINWP' || pError == 'NOMAINWP') {
3810 3900 return mainwp_js_get_error_not_detected_connect();
3811 3901 } else if (pError.message == 'ERROR') {
3812 3902 return 'ERROR' + ((pError.extra != '') && (pError.extra != undefined) ? ': ' + pError.extra : '');
@@ -3814,9 +3904,9 @@
3814 3904 let extrMsg = (pError.extra != '') && (pError.extra != undefined) ? pError.extra : '';
3815 3905 if (msgOnly != undefined && msgOnly && extrMsg != '') {
3816 3906 return extrMsg;
3817 3907 } else {
3818 - return __('ERROR on the child site') + ': ' + extrMsg;
3908 + return MainWP.I18n.t('ERROR on the child site') + ': ' + extrMsg;
3819 3909 }
3820 3910
3821 3911 } else if (pError.message != undefined && pError.message != '') {
3822 3912 return pError.message;
@@ -3829,10 +3919,10 @@
3829 3919 let msg = '';
3830 3920 let msgUI = '<i class="red times icon"></i>';
3831 3921
3832 3922 if (repError.errorCode != undefined && repError.errorCode == 'SUSPENDED_SITE') {
3833 - msg = __('Suspended site.');
3834 - msgUI = '<span data-inverted="" data-position="left center" data-tooltip="' + __('Suspended site.') + '"><i class="pause yellow icon"></i></span>';
3923 + msg = MainWP.I18n.t('Suspended site.');
3924 + msgUI = '<span data-inverted="" data-position="left center" data-tooltip="' + MainWP.I18n.t('Suspended site.') + '"><i class="pause yellow icon"></i></span>';
3835 3925 }
3836 3926
3837 3927 if (repError.errorCode != undefined && repError.errorCode == 'MAINWP_NOTICE') {
3838 3928 if (repError.message != undefined) {
@@ -3897,22 +3987,45 @@
3897 3987 return (this.length !== 0);
3898 3988 };
3899 3989
3900 3990
3901 -function __(text, _var1, _var2, _var3) {
3902 - if (text == undefined || text == '')
3991 +globalThis.MainWP = globalThis.MainWP || {};
3992 +globalThis.MainWP.I18n = globalThis.MainWP.I18n || {};
3993 +
3994 +MainWP.I18n.t = function (text, ...args) {
3995 + if (!text) {
3903 3996 return text;
3904 - let strippedText = text.replaceAll(/\W/g, '_');
3997 + }
3905 3998
3906 - if (strippedText == '')
3907 - return text.replace('%1', _var1).replace('%2', _var2).replace('%3', _var3);
3999 + // Replace non-alphanumeric characters (including Unicode/accented characters) with '_'
4000 + const strippedText = text.replace(/[^\p{L}\p{N}_]/gu, '_');
3908 4001
3909 - if (mainwpTranslations == undefined)
3910 - return text.replace('%1', _var1).replace('%2', _var2).replace('%3', _var3);
3911 - if (mainwpTranslations[strippedText] == undefined)
3912 - return text.replace('%1', _var1).replace('%2', _var2).replace('%3', _var3);
4002 + let translated = text;
3913 4003
3914 - return mainwpTranslations[strippedText].replace('%1', _var1).replace('%2', _var2).replace('%3', _var3);
4004 + if (
4005 + strippedText &&
4006 + typeof mainwpTranslations !== 'undefined' &&
4007 + mainwpTranslations[strippedText] !== undefined
4008 + ) {
4009 + translated = mainwpTranslations[strippedText];
4010 + }
4011 +
4012 + if (args.length === 0) {
4013 + return translated;
4014 + }
4015 +
4016 + // Single-pass replacement to avoid placeholder collision issues
4017 + return translated.replace(/%(\d+)/g, (match, index) => {
4018 + const argIdx = parseInt(index, 10) - 1;
4019 + return args[argIdx] !== undefined ? args[argIdx] : match;
4020 + });
4021 +};
4022 +
4023 +// Deprecated. Remove in a future release.
4024 +if (typeof globalThis.__ !== 'function') {
4025 + globalThis.__ = function (text, ...args) {
4026 + return globalThis.MainWP.I18n.t(text, ...args);
4027 + };
3915 4028 }
3916 4029
3917 4030 globalThis.mainwp_secure_data = function (data, includeDts) {
3918 4031 if (data['action'] == undefined)
@@ -4064,9 +4177,9 @@
4064 4177 let o = i.toString();
4065 4178 if (!s) {
4066 4179 s = '0';
4067 4180 }
4068 - while (o.length < Number.parseInt(l)) {
4181 + while (o.length < Number.parseInt(l)) {
4069 4182 // empty
4070 4183 if (w == 'undefined') {
4071 4184 o = s + o;
4072 4185 } else {
@@ -4133,13 +4246,18 @@
4133 4246
4134 4247 // Hide after installtion notices (PHP version, Trust MainWP Child, Multisite Warning and OpenSSL warning)
4135 4248 jQuery(document).on('click', '.mainwp-notice-dismiss', function () {
4136 4249 let notice_id = jQuery(this).attr('notice-id');
4250 + let shortterm = jQuery(this).attr('shortterm-notice');
4251 +
4137 4252 jQuery(this).closest('.ui.message').fadeOut("slow");
4138 4253 let data = {
4139 4254 action: 'mainwp_notice_status_update'
4140 4255 };
4141 4256 data['notice_id'] = notice_id;
4257 + if(shortterm === '1'){
4258 + data['short_term'] = 1;
4259 + }
4142 4260 jQuery.post(ajaxurl, mainwp_secure_data(data), function () { });
4143 4261 return false;
4144 4262 });
4145 4263
@@ -4148,9 +4266,9 @@
4148 4266 let data = {
4149 4267 action: 'mainwp_notice_status_update'
4150 4268 };
4151 4269 data['notice_id'] = notice_id;
4152 - if ( time_set !== undefined ) {
4270 + if (time_set !== undefined) {
4153 4271 data['time_set'] = time_set ? 1 : 0;
4154 4272 }
4155 4273 jQuery.post(ajaxurl, mainwp_secure_data(data), function () {
4156 4274 });
@@ -4284,14 +4402,14 @@
4284 4402 $('#mainwp_sites_changes_bulk_dismiss_selected_btn').on('click', function () {
4285 4403 if (jQuery('#mainwp-module-log-records-body-table tr').find('input[type="checkbox"]:checked').length == 0) {
4286 4404 return;
4287 4405 }
4288 - let confirmMsg = __("You are about to dismiss the selected changes?");
4406 + let confirmMsg = MainWP.I18n.t("You are about to dismiss the selected changes?");
4289 4407 mainwp_confirm(confirmMsg, function () { mainwp_sites_changes_actions_bulk_action('dismiss-selected'); });
4290 4408 });
4291 4409
4292 4410 $('#mainwp_sites_changes_bulk_dismiss_all_btn').on('click', function () {
4293 - let confirmMsg = __("You are about to dismiss all changes?");
4411 + let confirmMsg = MainWP.I18n.t("You are about to dismiss all changes?");
4294 4412 mainwp_confirm(confirmMsg, function () { mainwp_sites_changes_actions_bulk_action('dismiss-all'); });
4295 4413 });
4296 4414
4297 4415 // Trigger the bulk actions
@@ -4298,9 +4416,9 @@
4298 4416 $('#mainwp_widget_sites_changes_bulk_dismiss_selected_btn').on('click', function () {
4299 4417 if (jQuery('#mainwp-module-log-records-body-table tr').find('input[type="checkbox"]:checked').length == 0) {
4300 4418 return;
4301 4419 }
4302 - let confirmMsg = __("You are about to dismiss the selected changes?");
4420 + let confirmMsg = MainWP.I18n.t("You are about to dismiss the selected changes?");
4303 4421 mainwp_confirm(confirmMsg, function () { mainwp_sites_changes_actions_bulk_action('dismiss-selected', 'widget'); });
4304 4422 });
4305 4423
4306 4424 $(document).on('click', '.insights-actions-row-dismiss', function () {
@@ -4334,9 +4452,9 @@
4334 4452 })
4335 4453
4336 4454 let mainwp_insights_row_actions_dismiss = function (obj) {
4337 4455 let row = jQuery(obj).closest('tr');
4338 - let confirmMsg = __("You are about to dismiss the selected change?");
4456 + let confirmMsg = MainWP.I18n.t("You are about to dismiss the selected change?");
4339 4457
4340 4458 const renderMessage = (icon, message) => {
4341 4459 row.html(
4342 4460 '<td></td><td colspan="999"><i class="' +
@@ -4777,14 +4895,14 @@
4777 4895 });
4778 4896
4779 4897 // Force Dashboard to reestablish connection by destroying sessions - Part 1
4780 4898 let mainwp_force_destroy_sessions = function () {
4781 - let confirmMsg = __('Are you sure you want to force your MainWP Dashboard to reconnect with your child sites?');
4899 + let confirmMsg = MainWP.I18n.t('Are you sure you want to force your MainWP Dashboard to reconnect with your child sites?');
4782 4900 mainwp_confirm(confirmMsg, function () {
4783 4901 mainwp_force_destroy_sessions_websites = jQuery('.dashboard_wp_id[error-status=0]').map(function (indx, el) {
4784 4902 return jQuery(el).val();
4785 4903 });
4786 - mainwpPopup('#mainwp-sync-sites-modal').setTitle(__('Re-establish Connection')); // popup displayed.
4904 + mainwpPopup('#mainwp-sync-sites-modal').setTitle(MainWP.I18n.t('Re-establish Connection')); // popup displayed.
4787 4905 mainwpPopup('#mainwp-sync-sites-modal').init({ progressMax: mainwp_force_destroy_sessions_websites.length });
4788 4906 mainwp_force_destroy_sessions_part_2(0);
4789 4907 });
4790 4908 };
@@ -4815,9 +4933,9 @@
4815 4933 } else if ('success' in response) {
4816 4934 mainwp_force_destroy_sessions_successed += 1;
4817 4935 dashboard_update_site_status(website_id, '<i class="check green icon"></i>', true);
4818 4936 } else {
4819 - dashboard_update_site_status(website_id, '<span data-inverted="" data-position="left center" data-tooltip="' + __('Process timed out. Please try again.', 'mainwp') + '">');
4937 + dashboard_update_site_status(website_id, '<span data-inverted="" data-position="left center" data-tooltip="' + MainWP.I18n.t('Process timed out. Please try again.') + '">');
4820 4938 }
4821 4939 }, 'json').fail(function () {
4822 4940 let counter = id + 1;
4823 4941 mainwp_force_destroy_sessions_part_2(counter);
@@ -4849,9 +4967,9 @@
4849 4967 let mainwp_import_demo_data_action = function (obj) {
4850 4968 let confirmation = "Are you sure you want to import demo content into your MainWP Dashboard?";
4851 4969 let msg_import = (jQuery(obj).attr('page-import') == 'qsw-import') ? '&message=qsw-import' : '';
4852 4970 mainwp_confirm(confirmation, function () {
4853 - feedback('mainwp-message-zone', '<i class="notched circle loading icon"></i> ' + __('Importing. Please wait...', 'mainwp'), '');
4971 + feedback('mainwp-message-zone', '<i class="notched circle loading icon"></i> ' + MainWP.I18n.t('Importing. Please wait...'), '');
4854 4972 let data = mainwp_secure_data({
4855 4973 action: 'mainwp_import_demo_data',
4856 4974 });
4857 4975
@@ -4857,12 +4975,12 @@
4857 4975
4858 4976 jQuery.post(ajaxurl, data, function (response) {
4859 4977 let error = false;
4860 4978 if (response.count === undefined) {
4861 - error = true;
4862 - feedback('mainwp-message-zone', __('Undefined error. Please try again.', 'mainwp'), 'green');
4979 + error = true;
4980 + feedback('mainwp-message-zone', MainWP.I18n.t('Undefined error. Please try again.'), 'green');
4863 4981 } else {
4864 - feedback('mainwp-message-zone', __('The demo content has been imported into your MainWP Dashboard.', 'mainwp'), 'green');
4982 + feedback('mainwp-message-zone', MainWP.I18n.t('The demo content has been imported into your MainWP Dashboard.'), 'green');
4865 4983 }
4866 4984
4867 4985 if (!error) {
4868 4986 setTimeout(function () {
@@ -4875,9 +4993,9 @@
4875 4993
4876 4994 let mainwp_remove_demo_data_action = function () {
4877 4995 let confirmation = "Are you sure you want to delete demo content from your MainWP Dashboard?";
4878 4996 mainwp_confirm(confirmation, function () {
4879 - feedback('mainwp-message-zone', '<i class="notched circle loading icon"></i> ' + __('Deleting. Please wait...', 'mainwp'), '');
4997 + feedback('mainwp-message-zone', '<i class="notched circle loading icon"></i> ' + MainWP.I18n.t('Deleting. Please wait...'), '');
4880 4998 let data = mainwp_secure_data({
4881 4999 action: 'mainwp_delete_demo_data',
4882 5000 });
4883 5001 jQuery.post(ajaxurl, data, function (response) {
@@ -4883,11 +5001,11 @@
4883 5001 jQuery.post(ajaxurl, data, function (response) {
4884 5002 let error = false;
4885 5003 if (response.success === undefined) {
4886 5004 error = true;
4887 - feedback('mainwp-message-zone', __('Undefined error. Please try again.', 'mainwp'), 'green');
5005 + feedback('mainwp-message-zone', MainWP.I18n.t('Undefined error. Please try again.'), 'green');
4888 5006 } else {
4889 - feedback('mainwp-message-zone', __('The demo content has been deleted from your MainWP Dashboard.', 'mainwp'), 'green');
5007 + feedback('mainwp-message-zone', MainWP.I18n.t('The demo content has been deleted from your MainWP Dashboard.'), 'green');
4890 5008 }
4891 5009
4892 5010 if (!error) {
4893 5011 setTimeout(function () {
@@ -4942,9 +5060,9 @@
4942 5060 jQuery("input[name='selected_sites[]']:checked").each(function () {
4943 5061 selected_sites.push(jQuery(this).val());
4944 5062 });
4945 5063 if (selected_sites.length == 0) {
4946 - errors.push(__('Please select at least one website to start.'));
5064 + errors.push(MainWP.I18n.t('Please select at least one website to start.'));
4947 5065 }
4948 5066
4949 5067 if (errors.length > 0) {
4950 5068 mainwp_set_message_zone('#mainwp-message-zone-modal', errors.join('<br />'), 'yellow');
@@ -4952,9 +5070,9 @@
4952 5070 } else {
4953 5071 mainwp_set_message_zone('#mainwp-message-zone-modal');
4954 5072 }
4955 5073
4956 - let confirmation = __("This process will create a new OpenSSL Key Pair on your MainWP Dashboard and Set the new Public Key to your Child site(s). Are you sure you want to proceed?");
5074 + let confirmation = MainWP.I18n.t("This process will create a new OpenSSL Key Pair on your MainWP Dashboard and Set the new Public Key to your Child site(s). Are you sure you want to proceed?");
4957 5075
4958 5076 mainwp_confirm(confirmation, function () {
4959 5077 jQuery(objBtn).attr('disabled', true);
4960 5078
@@ -4960,9 +5078,9 @@
4960 5078
4961 5079 jQuery('#mainwp-tool-renew-connect-modal .mainwp-select-sites-wrapper').hide();
4962 5080
4963 5081 let statusEl = jQuery('#mainwp-message-zone-modal');
4964 - statusEl.html('<i class="notched circle loading icon"></i> ' + __('Please wait...'));
5082 + statusEl.html('<i class="notched circle loading icon"></i> ' + MainWP.I18n.t('Please wait...'));
4965 5083 statusEl.show();
4966 5084
4967 5085 let data = mainwp_secure_data({
4968 5086 action: 'mainwp_prepare_renew_connections',
@@ -4990,9 +5108,9 @@
4990 5108 }
4991 5109
4992 5110 if (undefError) {
4993 5111 statusEl.addClass('red');
4994 - statusEl.html(__('Undefined error occurred. Please try again.')).fadeIn();
5112 + statusEl.html(MainWP.I18n.t('Undefined error occurred. Please try again.')).fadeIn();
4995 5113 }
4996 5114 }, 'json');
4997 5115 }, false, false, true);
4998 5116 }
@@ -5018,22 +5136,22 @@
5018 5136 action: 'mainwp_renew_connections',
5019 5137 siteid: siteId
5020 5138 });
5021 5139
5022 - connection_renew_status(siteId, '<span data-inverted="" data-position="left center" data-tooltip="' + __('Processing...', 'mainwp') + '"><i class="sync alternate loading icon"></i></span>');
5140 + connection_renew_status(siteId, '<span data-inverted="" data-position="left center" data-tooltip="' + MainWP.I18n.t('Processing...') + '"><i class="sync alternate loading icon"></i></span>');
5023 5141 jQuery.post(ajaxurl, data, function (response) {
5024 5142 if (response.error) {
5025 5143 connection_renew_status(siteId, '<span data-inverted="" data-position="left center" data-tooltip="' + response.error + '"><i class="times red icon"></i></span>');
5026 5144 } else if (response.result == 'success') {
5027 - connection_renew_status(siteId, '<span data-inverted="" data-position="left center" data-tooltip="' + __('Renew connnection process completed successfully.', 'mainwp') + '"><i class="check green icon"></i></span>');
5145 + connection_renew_status(siteId, '<span data-inverted="" data-position="left center" data-tooltip="' + MainWP.I18n.t('Renew connnection process completed successfully.') + '"><i class="check green icon"></i></span>');
5028 5146 } else {
5029 - connection_renew_status(siteId, '<span data-inverted="" data-position="left center" data-tooltip="' + __('Undefined error.') + '"><i class="times red icon"></i></span>');
5147 + connection_renew_status(siteId, '<span data-inverted="" data-position="left center" data-tooltip="' + MainWP.I18n.t('Undefined error.') + '"><i class="times red icon"></i></span>');
5030 5148
5031 5149 }
5032 5150 bulkInstallCurrentThreads--;
5033 5151 bulkInstallDone++;
5034 5152 jQuery('#mainwp-tool-renew-connect-modal .mainwp-modal-progress').progress('set progress', bulkInstallDone);
5035 - jQuery('#mainwp-tool-renew-connect-modal .mainwp-modal-progress').find('.label').html(bulkInstallDone + '/' + mainwpVars.bulkInstallTotal + ' ' + __('Processed'));
5153 + jQuery('#mainwp-tool-renew-connect-modal .mainwp-modal-progress').find('.label').html(bulkInstallDone + '/' + mainwpVars.bulkInstallTotal + ' ' + MainWP.I18n.t('Processed'));
5036 5154 mainwp_tool_renew_connections_start_next();
5037 5155 }, 'json');
5038 5156 }
5039 5157
@@ -5165,9 +5283,9 @@
5165 5283 me = $('.settings-field-indicator-wrapper.custom-payment-methods');
5166 5284 }
5167 5285 }
5168 5286
5169 - if(me === undefined) {
5287 + if (me === undefined) {
5170 5288 mainwp_settings_fields_value_on_change(this, val);
5171 5289 } else {
5172 5290 mainwp_settings_fields_value_on_change(me, val);
5173 5291 }
@@ -5206,15 +5324,15 @@
5206 5324 if (!globalThis.mainwpSegmentModalUiHandle) {
5207 5325 globalThis.mainwpSegmentModalUiHandle = (function () {
5208 5326 let _instance = {
5209 5327 loadingStatus: function () {
5210 - $('#mainwp-common-filter-edit-segment-status').html('<i class="notched circle loading icon"></i> ' + __('Loading segments. Please wait...')).show();
5328 + $('#mainwp-common-filter-edit-segment-status').html('<i class="notched circle loading icon"></i> ' + MainWP.I18n.t('Loading segments. Please wait...')).show();
5211 5329 },
5212 5330 savingStatus: function () {
5213 - $('#mainwp-common-filter-edit-segment-status').html('<i class="notched circle loading icon"></i> ' + __('Saving segment. Please wait...')).show();
5331 + $('#mainwp-common-filter-edit-segment-status').html('<i class="notched circle loading icon"></i> ' + MainWP.I18n.t('Saving segment. Please wait...')).show();
5214 5332 },
5215 5333 deletingStatus: function () {
5216 - $('#mainwp-common-filter-edit-segment-status').html('<i class="notched circle loading icon"></i> ' + __('Deleting segment. Please wait...')).show();
5334 + $('#mainwp-common-filter-edit-segment-status').html('<i class="notched circle loading icon"></i> ' + MainWP.I18n.t('Deleting segment. Please wait...')).show();
5217 5335
5218 5336 },
5219 5337 showStatus: function (status, addClass) {
5220 5338 if (addClass) {
@@ -5225,9 +5343,9 @@
5225 5343 hideSegmentStatus: function () {
5226 5344 $('#mainwp-common-filter-edit-segment-status').removeClass('red green').hide();
5227 5345 },
5228 5346 showSegment: function (btnObj) {
5229 - jQuery('#mainwp-common-filter-segment-modal > div.header').html(__('Save Segment'));
5347 + jQuery('#mainwp-common-filter-segment-modal > div.header').html(MainWP.I18n.t('Save Segment'));
5230 5348 jQuery('#mainwp-common-filter-segment-edit-fields').show();
5231 5349 jQuery('#mainwp-common-filter-edit-segment-save').show();
5232 5350 jQuery('#mainwp-common-filter-segment-select-fields').hide();
5233 5351 jQuery('#mainwp-common-filter-select-segment-choose-button').hide();
@@ -5238,9 +5356,9 @@
5238 5356 },
5239 5357 loadSegment: function (loadCallback) {
5240 5358 jQuery('#mainwp-common-filter-segment-edit-fields').hide();
5241 5359 jQuery('#mainwp-common-filter-edit-segment-save').hide();
5242 - jQuery('#mainwp-common-filter-segment-modal > div.header').html(__('Load Segment'));
5360 + jQuery('#mainwp-common-filter-segment-modal > div.header').html(MainWP.I18n.t('Load Segment'));
5243 5361 jQuery('#mainwp-common-filter-segment-select-fields').show();
5244 5362 jQuery('#mainwp-common-filter-select-segment-choose-button').show();
5245 5363 jQuery('#mainwp-common-filter-select-segment-delete-button').show();
5246 5364 this.hideSegmentStatus();
@@ -5294,9 +5412,9 @@
5294 5412 wgids: JSON.stringify(wgIds),
5295 5413 item_id: item_id,
5296 5414 page_widget: page_widget
5297 5415 };
5298 - jQuery.post(ajaxurl, mainwp_secure_data(postVars), function () {});
5416 + jQuery.post(ajaxurl, mainwp_secure_data(postVars), function () { });
5299 5417 }
5300 5418
5301 5419 globalThis.mainwp_init_ui_calendar = ($selectors) => {
5302 5420 jQuery($selectors).calendar({
@@ -5346,12 +5464,12 @@
5346 5464
5347 5465 $(document).on('click', '#delete_uptime_monitor_btn', function () {
5348 5466 let is_sub = $('#monitor_edit_is_sub_url')?.val();
5349 5467
5350 - let confirmation = __("Are you sure you want to delete this uptime monitor?");
5468 + let confirmation = MainWP.I18n.t("Are you sure you want to delete this uptime monitor?");
5351 5469
5352 5470 if (is_sub) {
5353 - confirmation = __("Are you sure you want to delete this uptime sub-page monitor?");
5471 + confirmation = MainWP.I18n.t("Are you sure you want to delete this uptime sub-page monitor?");
5354 5472 }
5355 5473
5356 5474 mainwp_confirm(confirmation, () => {
5357 5475 let wpid = $('#mainwp_edit_monitor_site_id').val();
@@ -5362,9 +5480,9 @@
5362 5480 });
5363 5481
5364 5482 let mainwp_uptime_monitoring_remove = function (wpid, moid) {
5365 5483
5366 - feedback('mainwp-message-zone', '<i class="notched circle loading icon"></i> ' + __('Removing Uptime Monitor...'), 'green');
5484 + feedback('mainwp-message-zone', '<i class="notched circle loading icon"></i> ' + MainWP.I18n.t('Removing Uptime Monitor...'), 'green');
5367 5485
5368 5486 let data = mainwp_secure_data({
5369 5487 action: 'mainwp_uptime_monitoring_remove_monitor',
5370 5488 wpid: wpid,
@@ -5372,9 +5490,9 @@
5372 5490 });
5373 5491
5374 5492 jQuery.post(ajaxurl, data, function (response) {
5375 5493 if (response?.success) {
5376 - feedback('mainwp-message-zone', __('Monitor have been removed.'), 'green');
5494 + feedback('mainwp-message-zone', MainWP.I18n.t('Monitor have been removed.'), 'green');
5377 5495 setTimeout(function () {
5378 5496 mainwp_forceReload('admin.php?page=managesites&id=' + wpid);
5379 5497 }, 2000);
5380 5498
@@ -5380,9 +5498,9 @@
5380 5498
5381 5499 } else if (response?.error) {
5382 5500 feedback('mainwp-message-zone', response.error, 'red');
5383 5501 } else {
5384 - feedback('mainwp-message-zone', __('Undefined error. Please try again.'), 'red');
5502 + feedback('mainwp-message-zone', MainWP.I18n.t('Undefined error. Please try again.'), 'red');
5385 5503 }
5386 5504 }, 'json');
5387 5505 return false;
5388 5506 };
@@ -5387,9 +5505,9 @@
5387 5505 return false;
5388 5506 };
5389 5507
5390 5508 $(document).on('click', '#increase-connection-security-btn', function () {
5391 - feedback('mainwp-message-zone', '<i class="notched circle loading icon"></i> ' + __('Encryption in progress! Securing your OpenSSL private keys, this may take a few moments. Please wait until completed.'), 'green');
5509 + feedback('mainwp-message-zone', '<i class="notched circle loading icon"></i> ' + MainWP.I18n.t('Encryption in progress! Securing your OpenSSL private keys, this may take a few moments. Please wait until completed.'), 'green');
5392 5510 let data = mainwp_secure_data({
5393 5511 action: 'mainwp_increase_connection_security',
5394 5512 });
5395 5513 jQuery.post(ajaxurl, data, function (response) {
@@ -5400,16 +5518,16 @@
5400 5518
5401 5519 } else if (response?.error) {
5402 5520 feedback('mainwp-message-zone', response.error, 'red');
5403 5521 } else {
5404 - feedback('mainwp-message-zone', __('Undefined error. Please try again.'), 'red');
5522 + feedback('mainwp-message-zone', MainWP.I18n.t('Undefined error. Please try again.'), 'red');
5405 5523 }
5406 5524 }, 'json');
5407 5525 return false;
5408 5526 });
5409 5527 jQuery('#module-update-logs-db-requirement').on('click', function () {
5410 - let msg = __('Are you sure?');
5411 - mainwp_confirm(msg, () => {
5528 + let msg = MainWP.I18n.t('Are you sure?');
5529 + mainwp_confirm(msg, () => {
5412 5530 jQuery(this).closest('.ui.message').fadeOut();
5413 5531 mainwp_module_logs_start_update_dismissed_db();
5414 5532 });
5415 5533 return false;
@@ -5434,11 +5552,11 @@
5434 5552 let data = mainwp_secure_data({
5435 5553 action: 'mainwp_module_log_update_dismissed_db',
5436 5554 });
5437 5555 if (logs_update_db_cancelled) {
5438 - mainwp_set_message_zone('#module-log-update-dissmised-logs-running', '<i class="close icon"></i>' + __("User cancelled the 'Sites Changes' database update process."), 'green');
5556 + mainwp_set_message_zone('#module-log-update-dissmised-logs-running', '<i class="close icon"></i>' + MainWP.I18n.t("User cancelled the 'Sites Changes' database update process."), 'green');
5439 5557 } else {
5440 - mainwp_set_message_zone('#module-log-update-dissmised-logs-running', '<i class="ui active inline loader tiny"></i> ' + __('Updating the \'Sites Changes\' database. Click %1here%2 to cancel.', '<a href="javascript:void(0);" id="module-update-logs-db-cancel">', '</a>'), 'green');
5558 + mainwp_set_message_zone('#module-log-update-dissmised-logs-running', '<i class="ui active inline loader tiny"></i> ' + MainWP.I18n.t('Updating the \'Sites Changes\' database. Click %1here%2 to cancel.', '<a href="javascript:void(0);" id="module-update-logs-db-cancel">', '</a>'), 'green');
5441 5559 }
5442 5560 jQuery.post(ajaxurl, data, function (response) {
5443 5561 let status = response?.status ?? '';
5444 5562 if (response.error) {
@@ -5443,9 +5561,9 @@
5443 5561 let status = response?.status ?? '';
5444 5562 if (response.error) {
5445 5563 mainwp_set_message_zone('#module-log-update-dissmised-logs-running', '<i class="close icon"></i>' + response.error, 'red');
5446 5564 } else if (status === 'finished') {
5447 - mainwp_set_message_zone('#module-log-update-dissmised-logs-running', '<i class="close icon"></i>' + __('Logs records has been updated successfully.'), 'green');
5565 + mainwp_set_message_zone('#module-log-update-dissmised-logs-running', '<i class="close icon"></i>' + MainWP.I18n.t('Logs records has been updated successfully.'), 'green');
5448 5566 } else if (status === 'running' && !logs_update_db_cancelled) {
5449 5567 setTimeout(function () {
5450 5568 mainwp_module_logs_start_update_dismissed_db();
5451 5569 }, 500);
@@ -5481,126 +5599,126 @@
5481 5599 globalThis.location.href = url;
5482 5600 }
5483 5601
5484 5602 class TablePersistentState {
5485 - constructor(table, options = {}) {
5486 - if (!table || !(table instanceof HTMLElement)) {
5487 - throw new Error('TablePersistentState requires a table element');
5488 - }
5603 + constructor(table, options = {}) {
5604 + if (!table || !(table instanceof HTMLElement)) {
5605 + throw new Error('TablePersistentState requires a table element');
5606 + }
5489 5607
5490 - this.table = table;
5491 - this.tableId = table.id;
5492 - this.headers = table.querySelectorAll(
5493 - options.headerSelector || '.handle-cols-sorting'
5494 - );
5608 + this.table = table;
5609 + this.tableId = table.id;
5610 + this.headers = table.querySelectorAll(
5611 + options.headerSelector || '.handle-cols-sorting'
5612 + );
5495 5613
5496 - this.options = {
5497 - storage: options.storage !== false, // default true
5498 - storagePrefix: options.storagePrefix || 'mainwp_tables_sort_state',
5499 - onPersist: options.onPersist || null,
5500 - defaultSort: options.defaultSort || null, // column, direction
5501 - };
5614 + this.options = {
5615 + storage: options.storage !== false, // default true
5616 + storagePrefix: options.storagePrefix || 'mainwp_tables_sort_state',
5617 + onPersist: options.onPersist || null,
5618 + defaultSort: options.defaultSort || null, // column, direction
5619 + };
5502 5620
5503 - this.init();
5504 - }
5621 + this.init();
5622 + }
5505 5623
5506 - /* ---------- Storage ---------- */
5624 + /* ---------- Storage ---------- */
5507 5625
5508 - get storageKey() {
5509 - return `${this.options.storagePrefix}:${this.tableId}`;
5510 - }
5626 + get storageKey() {
5627 + return `${this.options.storagePrefix}:${this.tableId}`;
5628 + }
5511 5629
5512 - saveState(column, direction) {
5513 - if (!this.options.storage || !this.tableId) return;
5630 + saveState(column, direction) {
5631 + if (!this.options.storage || !this.tableId) return;
5514 5632
5515 - localStorage.setItem(
5516 - this.storageKey,
5517 - JSON.stringify({ column, direction })
5518 - );
5519 - }
5633 + localStorage.setItem(
5634 + this.storageKey,
5635 + JSON.stringify({ column, direction })
5636 + );
5637 + }
5520 5638
5521 - loadState() {
5522 - if (!this.options.storage || !this.tableId) return null;
5639 + loadState() {
5640 + if (!this.options.storage || !this.tableId) return null;
5523 5641
5524 - try {
5525 - return JSON.parse(localStorage.getItem(this.storageKey));
5526 - } catch {
5527 - return null;
5642 + try {
5643 + return JSON.parse(localStorage.getItem(this.storageKey));
5644 + } catch {
5645 + return null;
5646 + }
5528 5647 }
5529 - }
5530 5648
5531 - /* ---------- UI helpers ---------- */
5649 + /* ---------- UI helpers ---------- */
5532 5650
5533 - clearIndicators() {
5534 - this.headers.forEach(th => {
5535 - th.classList.remove('sorted-asc', 'sorted-desc');
5536 - th.removeAttribute('aria-sort');
5537 - });
5538 - }
5651 + clearIndicators() {
5652 + this.headers.forEach(th => {
5653 + th.classList.remove('sorted-asc', 'sorted-desc');
5654 + th.removeAttribute('aria-sort');
5655 + });
5656 + }
5539 5657
5540 - applyIndicator(th, direction) {
5541 - th.classList.add(direction === 'asc' ? 'sorted-asc' : 'sorted-desc');
5542 - th.setAttribute('aria-sort', direction);
5543 - }
5658 + applyIndicator(th, direction) {
5659 + th.classList.add(direction === 'asc' ? 'sorted-asc' : 'sorted-desc');
5660 + th.setAttribute('aria-sort', direction);
5661 + }
5544 5662
5545 - toggleDirection(current) {
5546 - return current === 'asc' ? 'desc' : 'asc';
5547 - }
5663 + toggleDirection(current) {
5664 + return current === 'asc' ? 'desc' : 'asc';
5665 + }
5548 5666
5549 - /* ---------- Sorting flow ---------- */
5667 + /* ---------- Sorting flow ---------- */
5550 5668
5551 - persistState(column, direction, th = null, persist = true, isrestore = false ) {
5552 - if (th) {
5553 - this.clearIndicators();
5554 - this.applyIndicator(th, direction);
5555 - }
5669 + persistState(column, direction, th = null, persist = true, isrestore = false) {
5670 + if (th) {
5671 + this.clearIndicators();
5672 + this.applyIndicator(th, direction);
5673 + }
5556 5674
5557 - if (persist) {
5558 - this.saveState(column, direction);
5559 - }
5675 + if (persist) {
5676 + this.saveState(column, direction);
5677 + }
5560 5678
5561 - if (typeof this.options.onPersist === 'function') {
5562 - this.options.onPersist({
5563 - table: this.table,
5564 - column,
5565 - direction,
5566 - isrestore
5567 - });
5679 + if (typeof this.options.onPersist === 'function') {
5680 + this.options.onPersist({
5681 + table: this.table,
5682 + column,
5683 + direction,
5684 + isrestore
5685 + });
5686 + }
5568 5687 }
5569 - }
5570 5688
5571 - /* ---------- Init ---------- */
5689 + /* ---------- Init ---------- */
5572 5690
5573 - restore() {
5574 - const saved = this.loadState() || this.options.defaultSort;
5575 - if (!saved) return;
5691 + restore() {
5692 + const saved = this.loadState() || this.options.defaultSort;
5693 + if (!saved) return;
5576 5694
5577 - const th = this.table.querySelector(
5578 - `[data-key="${saved.column}"]`
5579 - );
5695 + const th = this.table.querySelector(
5696 + `[data-key="${saved.column}"]`
5697 + );
5580 5698
5581 - if (th) {
5582 - this.persistState(saved.column, saved.direction, th, false, true );
5699 + if (th) {
5700 + this.persistState(saved.column, saved.direction, th, false, true);
5701 + }
5583 5702 }
5584 - }
5585 5703
5586 - bindEvents() {
5587 - this.headers.forEach(th => {
5588 - th.addEventListener('click', () => {
5589 - const column = th.dataset.key;
5590 - const isAsc = th.classList.contains('sorted-asc');
5591 - const direction = this.toggleDirection(isAsc ? 'asc' : 'desc');
5704 + bindEvents() {
5705 + this.headers.forEach(th => {
5706 + th.addEventListener('click', () => {
5707 + const column = th.dataset.key;
5708 + const isAsc = th.classList.contains('sorted-asc');
5709 + const direction = this.toggleDirection(isAsc ? 'asc' : 'desc');
5592 5710
5593 - this.persistState(column, direction, th);
5594 - });
5595 - });
5596 - }
5711 + this.persistState(column, direction, th);
5712 + });
5713 + });
5714 + }
5597 5715
5598 - init() {
5599 - if (!this.tableId && this.options.storage) {
5600 - console.warn('TablePersistentState: table has no id, storage disabled');
5716 + init() {
5717 + if (!this.tableId && this.options.storage) {
5718 + console.warn('TablePersistentState: table has no id, storage disabled');
5719 + }
5720 +
5721 + this.restore();
5722 + this.bindEvents();
5601 5723 }
5602 -
5603 - this.restore();
5604 - this.bindEvents();
5605 - }
5606 5724 }