| @@ -35,9 +35,9 @@ | ||
| 35 | 35 | |
| 36 | 36 | if (e !== undefined) |
| 37 | 37 | e.preventDefault(); |
| 38 | 38 | |
| 39 | - jQuery('#wpbody-content').html('<div class="mainwp-loading"><img src="images/loading.gif" /> ' + __('Please wait...') + '</div>'); | |
| 39 | + jQuery('#wpbody-content').html('<div class="mainwp-loading"><img src="images/loading.gif" /> ' + MainWP.I18n.t('Please wait...') + '</div>'); | |
| 40 | 40 | if (jQuery(obj).hasClass('menu-top')) { |
| 41 | 41 | let top = jQuery(obj).closest('li.menu-top'); |
| 42 | 42 | jQuery('#adminmenu .current').removeClass('current').addClass('wp-not-current-submenu'); |
| 43 | 43 | jQuery('.wp-has-current-submenu').removeClass('wp-has-current-submenu').addClass('wp-not-current-submenu'); |
| @@ -472,9 +472,10 @@ | ||
| 472 | 472 | let popWrapper = jQuery('#categorychecklist .mainwp-html-popup'); |
| 473 | 473 | if( popWrapper.length > 0 ) { |
| 474 | 474 | jQuery(popWrapper).each( |
| 475 | 475 | function(){ |
| 476 | - mainwp_init_html_popup(this); | |
| 476 | + const popupContent = jQuery(this).attr('html-popup-content') ?? ''; | |
| 477 | + mainwp_init_html_popup(this, mainwp_escape_html(popupContent)); | |
| 477 | 478 | } |
| 478 | 479 | ); |
| 479 | 480 | } |
| 480 | 481 | |
| @@ -735,9 +736,9 @@ | ||
| 735 | 736 | let slug = jQuery(iconObj).attr('item-slug'); |
| 736 | 737 | |
| 737 | 738 | let deleteIcon = jQuery('#mainwp_delete_image_chk').is(':checked'); |
| 738 | 739 | |
| 739 | - let msg = __('Updating the icon. Please wait...'); | |
| 740 | + let msg = MainWP.I18n.t('Updating the icon. Please wait...'); | |
| 740 | 741 | mainwp_set_message_zone('#mainwp-message-zone-upload', '<i class="notched circle loading icon"></i> ' + msg, ''); |
| 741 | 742 | jQuery('#update_custom_icon_btn').attr('disabled', 'disabled'); |
| 742 | 743 | |
| 743 | 744 | //Add via ajax!! |
| @@ -758,19 +759,19 @@ | ||
| 758 | 759 | let msg = ''; |
| 759 | 760 | |
| 760 | 761 | if (type === 'plugin') { |
| 761 | 762 | if (jQuery('#mainwp-show-plugins').length > 0) { |
| 762 | - msg = __('Loading...'); | |
| 763 | + msg = MainWP.I18n.t('Loading...'); | |
| 763 | 764 | mainwp_fetch_plugins(); |
| 764 | 765 | } |
| 765 | 766 | } else if (jQuery('#mainwp_show_themes').length > 0) { |
| 766 | - msg = __('Loading...'); | |
| 767 | + msg = MainWP.I18n.t('Loading...'); | |
| 767 | 768 | mainwp_fetch_themes(); |
| 768 | 769 | } |
| 769 | 770 | if (msg === '') { |
| 770 | 771 | mainwp_set_message_zone('#mainwp-message-zone-upload'); |
| 771 | 772 | } else { |
| 772 | - mainwp_set_message_zone('#mainwp-message-zone-upload', '<i class="notched circle loading icon"></i> ' + __('Loading...'), ''); | |
| 773 | + mainwp_set_message_zone('#mainwp-message-zone-upload', '<i class="notched circle loading icon"></i> ' + MainWP.I18n.t('Loading...'), ''); | |
| 773 | 774 | } |
| 774 | 775 | setTimeout(function () { |
| 775 | 776 | mainwp_forceReload(); |
| 776 | 777 | }, 3000); |
| @@ -776,9 +777,9 @@ | ||
| 776 | 777 | }, 3000); |
| 777 | 778 | } else if (response.error) { |
| 778 | 779 | feedback('mainwp-message-zone-upload', response.error, 'red'); |
| 779 | 780 | } else { |
| 780 | - feedback('mainwp-message-zone-upload', __('Undefined error. Please try again.'), 'red'); | |
| 781 | + feedback('mainwp-message-zone-upload', MainWP.I18n.t('Undefined error. Please try again.'), 'red'); | |
| 781 | 782 | } |
| 782 | 783 | }, |
| 783 | 784 | error: function () { |
| 784 | 785 | }, |
| @@ -877,9 +878,9 @@ | ||
| 877 | 878 | }); |
| 878 | 879 | }; |
| 879 | 880 | |
| 880 | 881 | let mainwp_upload_custom_types_icon = function (iconObj, uploadAct, iconItemId, iconFileSlug, deleteIcon, callback_uploaded) { |
| 881 | - let msg = __('Updating the icon. Please wait...'); | |
| 882 | + let msg = MainWP.I18n.t('Updating the icon. Please wait...'); | |
| 882 | 883 | mainwp_set_message_zone('#mainwp-message-zone-upload', '<i class="notched circle loading icon"></i> ' + msg, ''); |
| 883 | 884 | jQuery('#update_custom_icon_btn').attr('disabled', 'disabled'); |
| 884 | 885 | |
| 885 | 886 | let upload_act = uploadAct !== undefined && uploadAct !== '' ? uploadAct : 'mainwp_upload_custom_types_icon'; |
| @@ -909,9 +910,9 @@ | ||
| 909 | 910 | } |
| 910 | 911 | } else if (response.error) { |
| 911 | 912 | feedback('mainwp-message-zone-upload', response.error, 'red'); |
| 912 | 913 | } else { |
| 913 | - feedback('mainwp-message-zone-upload', __('Undefined error. Please try again.'), 'red'); | |
| 914 | + feedback('mainwp-message-zone-upload', MainWP.I18n.t('Undefined error. Please try again.'), 'red'); | |
| 914 | 915 | } |
| 915 | 916 | }, |
| 916 | 917 | error: function () { |
| 917 | 918 | }, |
| @@ -1027,15 +1028,15 @@ | ||
| 1027 | 1028 | globalThis.mainwpUIHandleWidgetsLayout = (function () { |
| 1028 | 1029 | const statusElemId = '#mainwp-common-edit-widgets-layout-status'; |
| 1029 | 1030 | let _instance = { |
| 1030 | 1031 | loadingStatus: function () { |
| 1031 | - jQuery(statusElemId).html('<i class="notched circle loading icon"></i> ' + __('Loading layouts. Please wait...')).show(); | |
| 1032 | + jQuery(statusElemId).html('<i class="notched circle loading icon"></i> ' + MainWP.I18n.t('Loading layouts. Please wait...')).show(); | |
| 1032 | 1033 | }, |
| 1033 | 1034 | savingStatus: function () { |
| 1034 | - jQuery(statusElemId).html('<i class="notched circle loading icon"></i> ' + __('Saving layout. Please wait...')).show(); | |
| 1035 | + jQuery(statusElemId).html('<i class="notched circle loading icon"></i> ' + MainWP.I18n.t('Saving layout. Please wait...')).show(); | |
| 1035 | 1036 | }, |
| 1036 | 1037 | deletingStatus: function () { |
| 1037 | - jQuery(statusElemId).html('<i class="notched circle loading icon"></i> ' + __('Deleting layout. Please wait...')).show(); | |
| 1038 | + jQuery(statusElemId).html('<i class="notched circle loading icon"></i> ' + MainWP.I18n.t('Deleting layout. Please wait...')).show(); | |
| 1038 | 1039 | |
| 1039 | 1040 | }, |
| 1040 | 1041 | showWorkingStatus: function (status, addClass) { |
| 1041 | 1042 | if (addClass) { |
| @@ -1047,9 +1048,9 @@ | ||
| 1047 | 1048 | hideWorkingStatus: function () { |
| 1048 | 1049 | jQuery(statusElemId).removeClass('red green').hide(); |
| 1049 | 1050 | }, |
| 1050 | 1051 | showLayout: function (showBtn) { |
| 1051 | - jQuery('#mainwp-common-edit-widgets-layout-modal > div.header').html(__('Save Layout')); | |
| 1052 | + jQuery('#mainwp-common-edit-widgets-layout-modal > div.header').html(MainWP.I18n.t('Save Layout')); | |
| 1052 | 1053 | jQuery('#mainwp-common-edit-widgets-layout-edit-fields').show(); |
| 1053 | 1054 | jQuery('#mainwp-common-edit-widgets-layout-save-button').show(); |
| 1054 | 1055 | jQuery('#mainwp-common-layout-widgets-select-fields').hide(); |
| 1055 | 1056 | jQuery('#mainwp-common-edit-widgets-select-layout-button').hide(); |
| @@ -1066,9 +1067,9 @@ | ||
| 1066 | 1067 | }, |
| 1067 | 1068 | loadSegment: function (loadCallback) { |
| 1068 | 1069 | jQuery('#mainwp-common-edit-widgets-layout-edit-fields').hide(); |
| 1069 | 1070 | jQuery('#mainwp-common-edit-widgets-layout-save-button').hide(); |
| 1070 | - jQuery('#mainwp-common-edit-widgets-layout-modal > div.header').html(__('Load Layout')); | |
| 1071 | + jQuery('#mainwp-common-edit-widgets-layout-modal > div.header').html(MainWP.I18n.t('Load Layout')); | |
| 1071 | 1072 | jQuery('#mainwp-common-layout-widgets-select-fields').show(); |
| 1072 | 1073 | jQuery('#mainwp-common-edit-widgets-select-layout-button').show(); |
| 1073 | 1074 | jQuery('#mainwp-common-edit-widgets-layout-delete-button').show(); |
| 1074 | 1075 | this.hideWorkingStatus(); |
| @@ -1171,9 +1172,9 @@ | ||
| 1171 | 1172 | let data = mainwp_secure_data({ |
| 1172 | 1173 | action: 'mainwp_ui_load_widgets_layout', |
| 1173 | 1174 | settings_slug: jQuery('#mainwp-manage-widgets-load-saved-layout-button').attr('settings-slug') |
| 1174 | 1175 | }); |
| 1175 | - mainwpUIHandleWidgetsLayout.showWorkingStatus('<i class="notched circle loading icon"></i> ' + __('Loading layouts. Please wait...'), ''); | |
| 1176 | + mainwpUIHandleWidgetsLayout.showWorkingStatus('<i class="notched circle loading icon"></i> ' + MainWP.I18n.t('Loading layouts. Please wait...'), ''); | |
| 1176 | 1177 | jQuery.post(ajaxurl, data, function (response) { |
| 1177 | 1178 | if (response.error != undefined) { |
| 1178 | 1179 | mainwpUIHandleWidgetsLayout.showWorkingStatus(response.error, 'red'); |
| 1179 | 1180 | } else if (response.result) { |
| @@ -1180,9 +1181,9 @@ | ||
| 1180 | 1181 | mainwpUIHandleWidgetsLayout.showResults(response.result); |
| 1181 | 1182 | jQuery('#mainwp-common-edit-widgets-select-layout-button').addClass('disabled'); |
| 1182 | 1183 | jQuery('#mainwp-common-edit-widgets-layout-delete-button').addClass('disabled'); |
| 1183 | 1184 | } else { |
| 1184 | - mainwpUIHandleWidgetsLayout.showWorkingStatus(__('No saved layouts found.'), 'yellow'); | |
| 1185 | + mainwpUIHandleWidgetsLayout.showWorkingStatus(MainWP.I18n.t('No saved layouts found.'), 'yellow'); | |
| 1185 | 1186 | } |
| 1186 | 1187 | }, 'json'); |
| 1187 | 1188 | }; |
| 1188 | 1189 | |
| @@ -1224,9 +1225,9 @@ | ||
| 1224 | 1225 | |
| 1225 | 1226 | let seg_name = jQuery('#mainwp-common-edit-widgets-layout-name').val().trim(); |
| 1226 | 1227 | |
| 1227 | 1228 | if ('' == seg_name) { |
| 1228 | - mainwpUIHandleWidgetsLayout.showWorkingStatus(__('Please enter a layout name.'), 'yellow'); | |
| 1229 | + mainwpUIHandleWidgetsLayout.showWorkingStatus(MainWP.I18n.t('Please enter a layout name.'), 'yellow'); | |
| 1229 | 1230 | return false; |
| 1230 | 1231 | } |
| 1231 | 1232 | |
| 1232 | 1233 | let data = { |
| @@ -1234,15 +1235,15 @@ | ||
| 1234 | 1235 | seg_id: jQuery('#mainwp-manage-widgets-load-saved-layout-button').attr('selected-layout-id'), |
| 1235 | 1236 | settings_slug: jQuery('#mainwp-manage-widgets-load-saved-layout-button').attr('settings-slug') |
| 1236 | 1237 | }; |
| 1237 | 1238 | |
| 1238 | - mainwpUIHandleWidgetsLayout.showWorkingStatus('<i class="notched circle loading icon"></i> ' + __('Saving layout. Please wait...'), ''); | |
| 1239 | + mainwpUIHandleWidgetsLayout.showWorkingStatus('<i class="notched circle loading icon"></i> ' + MainWP.I18n.t('Saving layout. Please wait...'), ''); | |
| 1239 | 1240 | |
| 1240 | 1241 | mainwp_common_ui_widgets_save_layout('.grid-stack-item', data, function (response) { |
| 1241 | 1242 | if (response.error != undefined) { |
| 1242 | 1243 | mainwpUIHandleWidgetsLayout.showWorkingStatus(response.error, 'red'); |
| 1243 | 1244 | } else if (response.result == 'SUCCESS') { |
| 1244 | - mainwpUIHandleWidgetsLayout.showWorkingStatus(__('Layout saved successfully.'), 'green'); | |
| 1245 | + mainwpUIHandleWidgetsLayout.showWorkingStatus(MainWP.I18n.t('Layout saved successfully.'), 'green'); | |
| 1245 | 1246 | setTimeout(function () { |
| 1246 | 1247 | jQuery('#mainwp-common-edit-widgets-layout-status').fadeOut(300); |
| 1247 | 1248 | jQuery('#mainwp-common-edit-widgets-layout-modal').modal('hide'); |
| 1248 | 1249 | mainwp_forceReload(); |
| @@ -1247,9 +1248,9 @@ | ||
| 1247 | 1248 | jQuery('#mainwp-common-edit-widgets-layout-modal').modal('hide'); |
| 1248 | 1249 | mainwp_forceReload(); |
| 1249 | 1250 | }, 2000); |
| 1250 | 1251 | } else { |
| 1251 | - mainwpUIHandleWidgetsLayout.showWorkingStatus(__('An error occurred while saving the layout.'), 'red'); | |
| 1252 | + mainwpUIHandleWidgetsLayout.showWorkingStatus(MainWP.I18n.t('An error occurred while saving the layout.'), 'red'); | |
| 1252 | 1253 | } |
| 1253 | 1254 | }); |
| 1254 | 1255 | e.preventDefault(); |
| 1255 | 1256 | e.stopPropagation(); |
| @@ -1299,9 +1300,9 @@ | ||
| 1299 | 1300 | action: 'mainwp_ui_delete_widgets_layout', |
| 1300 | 1301 | seg_id: seg_id, |
| 1301 | 1302 | settings_slug: jQuery('#mainwp-manage-widgets-load-saved-layout-button').attr('settings-slug') |
| 1302 | 1303 | }); |
| 1303 | - mainwpUIHandleWidgetsLayout.showWorkingStatus('<i class="notched circle loading icon"></i> ' + __('Deleting layout. Please wait...'), ''); | |
| 1304 | + mainwpUIHandleWidgetsLayout.showWorkingStatus('<i class="notched circle loading icon"></i> ' + MainWP.I18n.t('Deleting layout. Please wait...'), ''); | |
| 1304 | 1305 | jQuery.post(ajaxurl, data, (response) => { |
| 1305 | 1306 | |
| 1306 | 1307 | $button.removeAttr('running'); |
| 1307 | 1308 | |
| @@ -1307,15 +1308,15 @@ | ||
| 1307 | 1308 | |
| 1308 | 1309 | if (response.error != undefined) { |
| 1309 | 1310 | mainwpUIHandleWidgetsLayout.showWorkingStatus(response.error, 'red'); |
| 1310 | 1311 | } else if (response.result == 'SUCCESS') { |
| 1311 | - mainwpUIHandleWidgetsLayout.showWorkingStatus(__('Layout deleted successfully.'), 'green'); | |
| 1312 | + mainwpUIHandleWidgetsLayout.showWorkingStatus(MainWP.I18n.t('Layout deleted successfully.'), 'green'); | |
| 1312 | 1313 | setTimeout(function () { |
| 1313 | 1314 | jQuery('#mainwp-common-edit-widgets-layout-status').fadeOut(300); |
| 1314 | 1315 | jQuery('#mainwp-common-edit-widgets-layout-modal').modal('hide'); |
| 1315 | 1316 | }, 2000); |
| 1316 | 1317 | } else { |
| 1317 | - mainwpUIHandleWidgetsLayout.showWorkingStatus(__('An error occurred while deleting the layout.'), 'red'); | |
| 1318 | + mainwpUIHandleWidgetsLayout.showWorkingStatus(MainWP.I18n.t('An error occurred while deleting the layout.'), 'red'); | |
| 1318 | 1319 | } |
| 1319 | 1320 | }, 'json'); |
| 1320 | 1321 | }); |
| 1321 | -} | |
| 1322 | +} | |