← All changes
|
modules/api-backups/assets/js/module-api-backups-manager.js
+868
-658
5.0.3
→
6.2.2
View file →
| @@ -9,9 +9,9 @@ | ||
| 9 | 9 | */ |
| 10 | 10 | |
| 11 | 11 | /* eslint complexity: ["error", 100] */ |
| 12 | 12 | |
| 13 | -jQuery(document).ready(function () { | |
| 13 | +jQuery(function(){ | |
| 14 | 14 | |
| 15 | 15 | /******************************************************** |
| 16 | 16 | * Ajax Event Hooks. |
| 17 | 17 | */ |
| @@ -20,35 +20,35 @@ | ||
| 20 | 20 | * CloudWays Ajax Hooks |
| 21 | 21 | */ |
| 22 | 22 | |
| 23 | 23 | // Trigger action_backup. |
| 24 | - jQuery('.mainwp_3rd_party_api_cloudways_action_backup').on('click', function (event) { | |
| 25 | - cloudways_action_backup(this, event); | |
| 24 | + jQuery('.mainwp_3rd_party_api_cloudways_action_backup').on('click', function () { | |
| 25 | + cloudways_action_backup(this); | |
| 26 | 26 | }); |
| 27 | 27 | |
| 28 | 28 | // Trigger action_backup. |
| 29 | - jQuery('#mainwp_3rd_party_api_cloudways_action_individual_create_backup').on('click', function (event) { | |
| 30 | - cloudways_action_backup(this, event); | |
| 29 | + jQuery('#mainwp_3rd_party_api_cloudways_action_individual_create_backup').on('click', function () { | |
| 30 | + cloudways_action_backup(this); | |
| 31 | 31 | }); |
| 32 | 32 | |
| 33 | 33 | // Trigger action_update_ids. |
| 34 | - jQuery('.mainwp_3rd_party_api_cloudways_action_update_ids').on('click', function (event) { | |
| 35 | - cloudways_action_update_ids(this, event); | |
| 34 | + jQuery('.mainwp_3rd_party_api_cloudways_action_update_ids').on('click', function () { | |
| 35 | + cloudways_action_update_ids(this); | |
| 36 | 36 | }); |
| 37 | 37 | |
| 38 | 38 | //Trigger action_refresh_available_backups. |
| 39 | - jQuery('#mainwp_3rd_party_api_cloudways_action_refresh_available_backups').on('click', function (event) { | |
| 40 | - cloudways_action_refresh_available_backups(this, event); | |
| 39 | + jQuery('#mainwp_3rd_party_api_cloudways_action_refresh_available_backups').on('click', function () { | |
| 40 | + cloudways_action_refresh_available_backups(this); | |
| 41 | 41 | }); |
| 42 | 42 | |
| 43 | 43 | // Trigger action_restore_backup. |
| 44 | - jQuery(document).on('click', '.mainwp_3rd_party_api_cloudways_action_restore_backup', function (event) { | |
| 45 | - cloudways_action_restore_backup(this, event); | |
| 44 | + jQuery(document).on('click', '.mainwp_3rd_party_api_cloudways_action_restore_backup', function () { | |
| 45 | + cloudways_action_restore_backup(this); | |
| 46 | 46 | }); |
| 47 | 47 | |
| 48 | 48 | // Trigger action_delete_backup. This will delete the 24hr restore point allowing for a new restoration to be created. |
| 49 | - jQuery('#mainwp_3rd_party_api_cloudways_action_delete_backup').on('click', function (event) { | |
| 50 | - cloudways_action_delete_backup(this, event); | |
| 49 | + jQuery('#mainwp_3rd_party_api_cloudways_action_delete_backup').on('click', function () { | |
| 50 | + cloudways_action_delete_backup(this); | |
| 51 | 51 | }); |
| 52 | 52 | |
| 53 | 53 | /** |
| 54 | 54 | * Vultr Ajax Hooks |
| @@ -54,35 +54,35 @@ | ||
| 54 | 54 | * Vultr Ajax Hooks |
| 55 | 55 | */ |
| 56 | 56 | |
| 57 | 57 | // Trigger action_backup. |
| 58 | - jQuery('.mainwp_3rd_party_api_vultr_action_backup').on('click', function (event) { | |
| 59 | - vultr_action_create_snapshot(this, event); | |
| 58 | + jQuery('.mainwp_3rd_party_api_vultr_action_backup').on('click', function () { | |
| 59 | + vultr_action_create_snapshot(this); | |
| 60 | 60 | }); |
| 61 | 61 | |
| 62 | 62 | // Trigger action_backup. |
| 63 | - jQuery('#mainwp_3rd_party_api_vultr_action_individual_create_backup').on('click', function (event) { | |
| 64 | - vultr_action_create_snapshot(this, event); | |
| 63 | + jQuery('#mainwp_3rd_party_api_vultr_action_individual_create_backup').on('click', function () { | |
| 64 | + vultr_action_create_snapshot(this); | |
| 65 | 65 | }); |
| 66 | 66 | |
| 67 | 67 | // Trigger action_update_ids. |
| 68 | - jQuery('.mainwp_3rd_party_api_vultr_action_update_ids').on('click', function (event) { | |
| 69 | - vultr_action_update_ids(this, event); | |
| 68 | + jQuery('.mainwp_3rd_party_api_vultr_action_update_ids').on('click', function () { | |
| 69 | + vultr_action_update_ids(this); | |
| 70 | 70 | }); |
| 71 | 71 | |
| 72 | 72 | //Trigger action_refresh_available_backups. |
| 73 | - jQuery('#mainwp_3rd_party_api_vultr_action_refresh_available_backups').on('click', function (event) { | |
| 74 | - vultr_action_refresh_available_backups(this, event); | |
| 73 | + jQuery('#mainwp_3rd_party_api_vultr_action_refresh_available_backups').on('click', function () { | |
| 74 | + vultr_action_refresh_available_backups(this); | |
| 75 | 75 | }); |
| 76 | 76 | |
| 77 | 77 | // Trigger action_restore_backup. |
| 78 | - jQuery(document).on('click', '.mainwp_3rd_party_api_vultr_action_restore_backup', function (event) { | |
| 79 | - vultr_action_restore_backup(this, event); | |
| 78 | + jQuery(document).on('click', '.mainwp_3rd_party_api_vultr_action_restore_backup', function () { | |
| 79 | + vultr_action_restore_backup(this); | |
| 80 | 80 | }); |
| 81 | 81 | |
| 82 | 82 | // Trigger action_delete_backup. |
| 83 | - jQuery(document).on('click', '.mainwp_3rd_party_api_vultr_action_delete_backup', function (event) { | |
| 84 | - vultr_action_delete_backup(this, event); | |
| 83 | + jQuery(document).on('click', '.mainwp_3rd_party_api_vultr_action_delete_backup', function () { | |
| 84 | + vultr_action_delete_backup(this); | |
| 85 | 85 | }); |
| 86 | 86 | |
| 87 | 87 | /** |
| 88 | 88 | * GridPane Ajax Hooks |
| @@ -88,35 +88,35 @@ | ||
| 88 | 88 | * GridPane Ajax Hooks |
| 89 | 89 | */ |
| 90 | 90 | |
| 91 | 91 | // Trigger action_backup. |
| 92 | - jQuery('.mainwp_3rd_party_api_gridpane_action_backup').on('click', function (event) { | |
| 93 | - gridpane_action_create_backup(this, event); | |
| 92 | + jQuery('.mainwp_3rd_party_api_gridpane_action_backup').on('click', function () { | |
| 93 | + gridpane_action_create_backup(this); | |
| 94 | 94 | }); |
| 95 | 95 | |
| 96 | 96 | // Trigger action_backup. |
| 97 | - jQuery('#mainwp_3rd_party_api_gridpane_action_individual_create_backup').on('click', function (event) { | |
| 98 | - gridpane_action_create_backup(this, event); | |
| 97 | + jQuery('#mainwp_3rd_party_api_gridpane_action_individual_create_backup').on('click', function () { | |
| 98 | + gridpane_action_create_backup(this); | |
| 99 | 99 | }); |
| 100 | 100 | |
| 101 | 101 | // Trigger action_update_ids. |
| 102 | - jQuery('.mainwp_3rd_party_api_gridpane_action_update_ids').on('click', function (event) { | |
| 103 | - gridpane_action_update_ids(this, event); | |
| 102 | + jQuery('.mainwp_3rd_party_api_gridpane_action_update_ids').on('click', function () { | |
| 103 | + gridpane_action_update_ids(this); | |
| 104 | 104 | }); |
| 105 | 105 | |
| 106 | 106 | // Trigger action_refresh_available_backups. |
| 107 | - jQuery('#mainwp_3rd_party_api_gridpane_action_refresh_available_backups').on('click', function (event) { | |
| 108 | - gridpane_action_refresh_available_backups(this, event); | |
| 107 | + jQuery('#mainwp_3rd_party_api_gridpane_action_refresh_available_backups').on('click', function () { | |
| 108 | + gridpane_action_refresh_available_backups(this); | |
| 109 | 109 | }); |
| 110 | 110 | |
| 111 | 111 | // Trigger action_restore_backup. |
| 112 | - jQuery(document).on('click', '.mainwp_3rd_party_api_gridpane_action_restore_backup', function (event) { | |
| 113 | - gridpane_action_restore_backup(this, event); | |
| 112 | + jQuery(document).on('click', '.mainwp_3rd_party_api_gridpane_action_restore_backup', function () { | |
| 113 | + gridpane_action_restore_backup(this); | |
| 114 | 114 | }); |
| 115 | 115 | |
| 116 | 116 | // Trigger action_delete_backup. |
| 117 | - jQuery(document).on('click', '.mainwp_3rd_party_api_gridpane_action_delete_backup', function (event) { | |
| 118 | - gridpane_action_delete_backup(this, event); | |
| 117 | + jQuery(document).on('click', '.mainwp_3rd_party_api_gridpane_action_delete_backup', function () { | |
| 118 | + gridpane_action_delete_backup(this); | |
| 119 | 119 | }); |
| 120 | 120 | |
| 121 | 121 | /** |
| 122 | 122 | * Linode Ajax Hooks |
| @@ -122,37 +122,37 @@ | ||
| 122 | 122 | * Linode Ajax Hooks |
| 123 | 123 | */ |
| 124 | 124 | |
| 125 | 125 | // Trigger action_backup. |
| 126 | - jQuery('.mainwp_3rd_party_api_linode_action_backup').on('click', function (event) { | |
| 127 | - linode_action_create_backup(this, event); | |
| 126 | + jQuery('.mainwp_3rd_party_api_linode_action_backup').on('click', function () { | |
| 127 | + linode_action_create_backup(this); | |
| 128 | 128 | }); |
| 129 | 129 | |
| 130 | 130 | // Trigger action_backup. |
| 131 | - jQuery('#mainwp_3rd_party_api_linode_action_individual_create_backup').on('click', function (event) { | |
| 132 | - linode_action_create_backup(this, event); | |
| 131 | + jQuery('#mainwp_3rd_party_api_linode_action_individual_create_backup').on('click', function () { | |
| 132 | + linode_action_create_backup(this); | |
| 133 | 133 | }); |
| 134 | 134 | |
| 135 | 135 | //Trigger action_update_ids. |
| 136 | - jQuery('.mainwp_3rd_party_api_linode_action_update_ids').on('click', function (event) { | |
| 137 | - linode_action_update_ids(this, event); | |
| 136 | + jQuery('.mainwp_3rd_party_api_linode_action_update_ids').on('click', function () { | |
| 137 | + linode_action_update_ids(this); | |
| 138 | 138 | }); |
| 139 | 139 | |
| 140 | 140 | // Trigger action_refresh_available_backups. |
| 141 | - jQuery('#mainwp_3rd_party_api_linode_action_refresh_available_backups').on('click', function (event) { | |
| 142 | - linode_action_refresh_available_backups(this, event); | |
| 141 | + jQuery('#mainwp_3rd_party_api_linode_action_refresh_available_backups').on('click', function () { | |
| 142 | + linode_action_refresh_available_backups(this); | |
| 143 | 143 | }); |
| 144 | 144 | |
| 145 | 145 | // Trigger action_restore_backup. |
| 146 | - jQuery(document).on('click', '.mainwp_3rd_party_api_linode_action_restore_backup', function (event) { | |
| 147 | - linode_action_restore_backup(this, event); | |
| 146 | + jQuery(document).on('click', '.mainwp_3rd_party_api_linode_action_restore_backup', function () { | |
| 147 | + linode_action_restore_backup(this); | |
| 148 | 148 | }); |
| 149 | 149 | |
| 150 | 150 | // Trigger action_delete_backup. |
| 151 | - jQuery('#mainwp_3rd_party_api_linode_action_cancel_backups').on('click', function (event) { | |
| 152 | - var confirmMsg = __('Are you sure you want to Disable and Delete all existing backups from this Linode?'); | |
| 151 | + jQuery('#mainwp_3rd_party_api_linode_action_cancel_backups').on('click', function () { | |
| 152 | + let confirmMsg = MainWP.I18n.t('Are you sure you want to Disable and Delete all existing backups from this Linode?'); | |
| 153 | 153 | mainwp_confirm(confirmMsg, function () { |
| 154 | - linode_action_cancel_backups(this, event); | |
| 154 | + linode_action_cancel_backups(this); | |
| 155 | 155 | }); |
| 156 | 156 | }); |
| 157 | 157 | |
| 158 | 158 | /** |
| @@ -159,35 +159,35 @@ | ||
| 159 | 159 | * digitalocean Ajax Hooks |
| 160 | 160 | */ |
| 161 | 161 | |
| 162 | 162 | //Trigger action_update_ids. |
| 163 | - jQuery('.mainwp_3rd_party_api_digitalocean_action_update_ids').on('click', function (event) { | |
| 164 | - digitalocean_action_update_ids(this, event); | |
| 163 | + jQuery('.mainwp_3rd_party_api_digitalocean_action_update_ids').on('click', function () { | |
| 164 | + digitalocean_action_update_ids(this); | |
| 165 | 165 | }); |
| 166 | 166 | |
| 167 | 167 | // Trigger action_create_backup. |
| 168 | - jQuery('.mainwp_3rd_party_api_digitalocean_action_backup').on('click', function (event) { | |
| 169 | - digitalocean_action_create_backup(this, event); | |
| 168 | + jQuery('.mainwp_3rd_party_api_digitalocean_action_backup').on('click', function () { | |
| 169 | + digitalocean_action_create_backup(this); | |
| 170 | 170 | }); |
| 171 | 171 | |
| 172 | 172 | // Trigger action_individual_create_backup. |
| 173 | - jQuery('#mainwp_3rd_party_api_digitalocean_action_individual_create_backup').on('click', function (event) { | |
| 174 | - digitalocean_action_create_backup(this, event); | |
| 173 | + jQuery('#mainwp_3rd_party_api_digitalocean_action_individual_create_backup').on('click', function () { | |
| 174 | + digitalocean_action_create_backup(this); | |
| 175 | 175 | }); |
| 176 | 176 | |
| 177 | 177 | // Trigger action_refresh_available_backups. |
| 178 | - jQuery('#mainwp_3rd_party_api_digitalocean_action_refresh_available_backups').on('click', function (event) { | |
| 179 | - digitalocean_action_refresh_available_backups(this, event); | |
| 178 | + jQuery('#mainwp_3rd_party_api_digitalocean_action_refresh_available_backups').on('click', function () { | |
| 179 | + digitalocean_action_refresh_available_backups(this); | |
| 180 | 180 | }); |
| 181 | 181 | |
| 182 | 182 | // Trigger action_delete_backup. |
| 183 | - jQuery(document).on('click', '.mainwp_3rd_party_api_digitalocean_action_delete_backup', function (event) { | |
| 184 | - digitalocean_action_delete_backup(this, event); | |
| 183 | + jQuery(document).on('click', '.mainwp_3rd_party_api_digitalocean_action_delete_backup', function () { | |
| 184 | + digitalocean_action_delete_backup(this); | |
| 185 | 185 | }); |
| 186 | 186 | |
| 187 | 187 | // Trigger action_restore_backup. |
| 188 | - jQuery(document).on('click', '.mainwp_3rd_party_api_digitalocean_action_restore_backup', function (event) { | |
| 189 | - digitalocean_action_restore_backup(this, event); | |
| 188 | + jQuery(document).on('click', '.mainwp_3rd_party_api_digitalocean_action_restore_backup', function () { | |
| 189 | + digitalocean_action_restore_backup(this); | |
| 190 | 190 | }); |
| 191 | 191 | |
| 192 | 192 | /** |
| 193 | 193 | * CPanel Ajax Hooks |
| @@ -193,81 +193,80 @@ | ||
| 193 | 193 | * CPanel Ajax Hooks |
| 194 | 194 | */ |
| 195 | 195 | |
| 196 | 196 | // Trigger action_refresh_available_backups. |
| 197 | - jQuery('#mainwp_3rd_party_api_cpanel_action_refresh_available_backups').on('click', function (event) { | |
| 198 | - cpanel_action_refresh_available_backups(this, event); | |
| 197 | + jQuery('#mainwp_3rd_party_api_cpanel_action_refresh_available_backups').on('click', function () { | |
| 198 | + cpanel_action_refresh_available_backups(this); | |
| 199 | 199 | }); |
| 200 | 200 | |
| 201 | 201 | // Trigger action_restore_backup. |
| 202 | - jQuery(document).on('click', '.mainwp_3rd_party_api_cpanel_action_restore_backup', function (event) { | |
| 203 | - var confirmMsg = __('Are you sure you want to Restore this backup?'); | |
| 202 | + jQuery(document).on('click', '.mainwp_3rd_party_api_cpanel_action_restore_backup', function () { | |
| 203 | + let confirmMsg = MainWP.I18n.t('Are you sure you want to Restore this backup?'); | |
| 204 | 204 | mainwp_confirm(confirmMsg, function () { |
| 205 | - cPanel_action_restore_backup(this, event); | |
| 205 | + cPanel_action_restore_backup(this); | |
| 206 | 206 | }); |
| 207 | 207 | }); |
| 208 | 208 | |
| 209 | 209 | // Trigger action_restore_database_backup. |
| 210 | - jQuery(document).on('click', '.mainwp_3rd_party_api_cpanel_action_restore_database_backup', function (event) { | |
| 211 | - var confirmMsg = __('Are you sure you want to Restore this backup?'); | |
| 212 | - var btObj = this; | |
| 213 | - mainwp_confirm(confirmMsg, function () { | |
| 214 | - cpanel_action_restore_database_backup(btObj, event); | |
| 210 | + jQuery(document).on('click', '.mainwp_3rd_party_api_cpanel_action_restore_database_backup', function () { | |
| 211 | + let confirmMsg = MainWP.I18n.t('Are you sure you want to Restore this backup?'); | |
| 212 | + mainwp_confirm(confirmMsg, () => { | |
| 213 | + cpanel_action_restore_database_backup(this); | |
| 215 | 214 | }); |
| 216 | 215 | }); |
| 217 | 216 | |
| 218 | 217 | // Trigger action_restore_manual_backup. |
| 219 | - jQuery(document).on('click', '.mainwp_3rd_party_api_cpanel_action_restore_manual_backup', function (event) { | |
| 220 | - var confirmMsg = __('Are you sure you want to Restore this backup?'); | |
| 218 | + jQuery(document).on('click', '.mainwp_3rd_party_api_cpanel_action_restore_manual_backup', function () { | |
| 219 | + let confirmMsg = MainWP.I18n.t('Are you sure you want to Restore this backup?'); | |
| 221 | 220 | mainwp_confirm(confirmMsg, function () { |
| 222 | - cpanel_action_restore_manual_backup(this, event); | |
| 221 | + cpanel_action_restore_manual_backup(); | |
| 223 | 222 | }); |
| 224 | 223 | }); |
| 225 | 224 | |
| 226 | 225 | // Trigger action_backup. |
| 227 | - jQuery('#mainwp_3rd_party_api_cpanel_action_individual_create_backup').on('click', function (event) { | |
| 228 | - cpanel_action_create_backup(this, event); | |
| 226 | + jQuery('#mainwp_3rd_party_api_cpanel_action_individual_create_backup').on('click', function () { | |
| 227 | + cpanel_action_create_backup(this); | |
| 229 | 228 | }); |
| 230 | 229 | |
| 231 | 230 | // Trigger action_create_wptk_backup. |
| 232 | - jQuery('#mainwp_3rd_party_api_cpanel_action_create_wptk_backup').on('click', function (event) { | |
| 233 | - cpanel_action_create_wptk_backup(this, event); | |
| 231 | + jQuery('#mainwp_3rd_party_api_cpanel_action_create_wptk_backup').on('click', function () { | |
| 232 | + cpanel_action_create_wptk_backup(this); | |
| 234 | 233 | }); |
| 235 | 234 | |
| 236 | 235 | // Trigger action_backup for bulk backups. |
| 237 | - jQuery('.mainwp_3rd_party_api_cpanel_action_full_backup').on('click', function (event) { | |
| 238 | - cpanel_action_create_full_backup(this, event); | |
| 236 | + jQuery('.mainwp_3rd_party_api_cpanel_action_full_backup').on('click', function () { | |
| 237 | + cpanel_action_create_full_backup(this); | |
| 239 | 238 | }); |
| 240 | 239 | |
| 241 | 240 | // Trigger action_database_backup. |
| 242 | - jQuery('#mainwp_3rd_party_api_cpanel_action_create_database_backup').on('click', function (event) { | |
| 243 | - cpanel_action_create_database_backup(this, event); | |
| 241 | + jQuery('#mainwp_3rd_party_api_cpanel_action_create_database_backup').on('click', function () { | |
| 242 | + cpanel_action_create_database_backup(this); | |
| 244 | 243 | }); |
| 245 | 244 | |
| 246 | 245 | // Trigger action_backup for full backups. Database & Files. |
| 247 | - jQuery('#mainwp_3rd_party_api_cpanel_action_create_full_backup').on('click', function (event) { | |
| 248 | - cpanel_action_create_full_backup(this, event); | |
| 246 | + jQuery('#mainwp_3rd_party_api_cpanel_action_create_full_backup').on('click', function () { | |
| 247 | + cpanel_action_create_full_backup(this); | |
| 249 | 248 | }); |
| 250 | 249 | |
| 251 | 250 | // Trigger action_restore_wptk_backup. |
| 252 | - jQuery('.mainwp_3rd_party_api_cpanel_action_restore_wptk_backup').on('click', function (event) { | |
| 253 | - var confirmMsg = __('Are you sure you want to Restore this backup?'); | |
| 251 | + jQuery('.mainwp_3rd_party_api_cpanel_action_restore_wptk_backup').on('click', function () { | |
| 252 | + let confirmMsg = MainWP.I18n.t('Are you sure you want to Restore this backup?'); | |
| 254 | 253 | mainwp_confirm(confirmMsg, function () { |
| 255 | - cpanel_action_restore_wptk_backup(this, event); | |
| 254 | + cpanel_action_restore_wptk_backup(this); | |
| 256 | 255 | }); |
| 257 | 256 | }); |
| 258 | 257 | |
| 259 | 258 | // Trigger action_delete_wptk_backup. |
| 260 | - jQuery('.mainwp_3rd_party_api_cpanel_action_delete_wptk_backup').on('click', function (event) { | |
| 261 | - var confirmMsg = __('Are you sure you want to Delete this backup?'); | |
| 259 | + jQuery('.mainwp_3rd_party_api_cpanel_action_delete_wptk_backup').on('click', function () { | |
| 260 | + let confirmMsg = MainWP.I18n.t('Are you sure you want to Delete this backup?'); | |
| 262 | 261 | mainwp_confirm(confirmMsg, function () { |
| 263 | - cpanel_action_delete_wptk_backup(this, event); | |
| 262 | + cpanel_action_delete_wptk_backup(this); | |
| 264 | 263 | }); |
| 265 | 264 | }); |
| 266 | 265 | |
| 267 | 266 | // Trigger action_download_wptk_backup |
| 268 | - jQuery('.mainwp_3rd_party_api_cpanel_action_download_wptk_backup').on('click', function (event) { | |
| 269 | - cpanel_action_download_wptk_backup(this, event); | |
| 267 | + jQuery('.mainwp_3rd_party_api_cpanel_action_download_wptk_backup').on('click', function () { | |
| 268 | + cpanel_action_download_wptk_backup(); | |
| 270 | 269 | }); |
| 271 | 270 | |
| 272 | 271 | /** |
| 273 | 272 | * Plesk Ajax Hooks |
| @@ -273,41 +272,81 @@ | ||
| 273 | 272 | * Plesk Ajax Hooks |
| 274 | 273 | */ |
| 275 | 274 | |
| 276 | 275 | // Trigger action_refresh_available_backups. |
| 277 | - jQuery('#mainwp_3rd_party_api_plesk_action_refresh_available_backups').on('click', function (event) { | |
| 278 | - plesk_action_refresh_available_backups(this, event); | |
| 276 | + jQuery('#mainwp_3rd_party_api_plesk_action_refresh_available_backups').on('click', function () { | |
| 277 | + plesk_action_refresh_available_backups(this); | |
| 279 | 278 | }); |
| 280 | 279 | |
| 281 | 280 | //Trigger action_backup. |
| 282 | - jQuery('#mainwp_3rd_party_api_plesk_action_individual_create_backup').on('click', function (event) { | |
| 283 | - plesk_action_create_backup(this, event); | |
| 281 | + jQuery('#mainwp_3rd_party_api_plesk_action_individual_create_backup').on('click', function () { | |
| 282 | + plesk_action_create_backup(this); | |
| 284 | 283 | }); |
| 285 | 284 | |
| 286 | 285 | // Trigger action_backup. ( bulk ) |
| 287 | - jQuery('.mainwp_3rd_party_api_plesk_action_backup ').on('click', function (event) { | |
| 288 | - plesk_action_create_backup(this, event); | |
| 286 | + jQuery('.mainwp_3rd_party_api_plesk_action_backup ').on('click', function () { | |
| 287 | + plesk_action_create_backup(this); | |
| 289 | 288 | }); |
| 290 | 289 | |
| 291 | 290 | // Trigger action_restore_backup. |
| 292 | - jQuery(document).on('click', '.mainwp_3rd_party_api_plesk_action_restore_backup', function (event) { | |
| 293 | - var confirmMsg = __('Are you sure you want to Restore this backup?'); | |
| 291 | + jQuery(document).on('click', '.mainwp_3rd_party_api_plesk_action_restore_backup', function () { | |
| 292 | + let confirmMsg = MainWP.I18n.t('Are you sure you want to Restore this backup?'); | |
| 294 | 293 | mainwp_confirm(confirmMsg, function () { |
| 295 | - plesk_action_restore_backup(this, event); | |
| 294 | + plesk_action_restore_backup(); | |
| 296 | 295 | }); |
| 297 | 296 | }); |
| 298 | 297 | |
| 299 | 298 | // Trigger action_delete_backup. |
| 300 | - jQuery(document).on('click', '.mainwp_3rd_party_api_plesk_action_delete_backup', function (event) { | |
| 301 | - var confirmMsg = __('Are you sure you want to Delete this backup?'); | |
| 299 | + jQuery(document).on('click', '.mainwp_3rd_party_api_plesk_action_delete_backup', function () { | |
| 300 | + let confirmMsg = MainWP.I18n.t('Are you sure you want to Delete this backup?'); | |
| 302 | 301 | mainwp_confirm(confirmMsg, function () { |
| 303 | - plesk_action_delete_backup(this, event); | |
| 302 | + plesk_action_delete_backup(); | |
| 304 | 303 | }); |
| 305 | 304 | }); |
| 306 | 305 | |
| 306 | + /** | |
| 307 | + * Kinsta Ajax Hooks | |
| 308 | + */ | |
| 309 | + // Trigger action_refresh_available_backups. | |
| 310 | + jQuery('#mainwp_3rd_party_api_kinsta_action_refresh_available_backups').on('click', function () { | |
| 311 | + kinsta_action_refresh_available_backups(this); | |
| 312 | + }); | |
| 313 | + | |
| 314 | + //Trigger action_backup. | |
| 315 | + jQuery('#mainwp_3rd_party_api_kinsta_action_individual_create_backup').on('click', function () { | |
| 316 | + kinsta_action_create_backup(this); | |
| 317 | + }); | |
| 318 | + | |
| 319 | + // Trigger Bulk action_create_backup. | |
| 320 | + jQuery('.mainwp_3rd_party_api_kinsta_action_backup').on('click', function () { | |
| 321 | + kinsta_action_create_backup(this); | |
| 322 | + }); | |
| 323 | + | |
| 324 | + // Trigger action_delete_backup. | |
| 325 | + jQuery('.mainwp_3rd_party_api_kinsta_action_delete_backup').on('click', function () { | |
| 326 | + let confirmMsg = MainWP.I18n.t('Are you sure you want to Delete this backup?'); | |
| 327 | + let backupId = jQuery(this).attr('backup_id'); | |
| 328 | + mainwp_confirm(confirmMsg, function () { | |
| 329 | + kinsta_action_delete_backup(this, backupId); | |
| 330 | + }); | |
| 331 | + }); | |
| 332 | + | |
| 333 | + // Trigger action_restore_backup. | |
| 334 | + jQuery('.mainwp_3rd_party_api_kinsta_action_restore_backup').on('click', function () { | |
| 335 | + let confirmMsg = MainWP.I18n.t('Are you sure you want to Restore this backup?'); | |
| 336 | + let backupId = jQuery(this).attr('backup_id'); | |
| 337 | + mainwp_confirm(confirmMsg, function () { | |
| 338 | + kinsta_action_restore_backup(this, backupId); | |
| 339 | + }); | |
| 340 | + }); | |
| 341 | + | |
| 342 | + /** | |
| 343 | + * Global Bulk Action: backup selected sites. | |
| 344 | + */ | |
| 345 | + | |
| 307 | 346 | // Trigger action_backup_selected_sites. |
| 308 | - jQuery('#action_backup_selected_sites').on('click', function (event) { | |
| 309 | - action_backup_selected_sites(this, event); | |
| 347 | + jQuery('#action_backup_selected_sites').on('click', function () { | |
| 348 | + action_backup_selected_sites(this); | |
| 310 | 349 | }); |
| 311 | 350 | |
| 312 | 351 | /******************************************************** |
| 313 | 352 | * Fomantic-ui Tabs Event Hooks. |
| @@ -329,10 +368,10 @@ | ||
| 329 | 368 | */ |
| 330 | 369 | jQuery('#mainwp_api_cpanel_backup_tabs .item').tab(); |
| 331 | 370 | |
| 332 | 371 | // Trigger action_check_tab. Handle the click event on the TAB Buttons. |
| 333 | - jQuery('#mainwp_api_cpanel_backup_tabs .item').on('click', function (event) { | |
| 334 | - action_check_tab(this, event); | |
| 372 | + jQuery('#mainwp_api_cpanel_backup_tabs .item').on('click', function () { | |
| 373 | + action_check_tab(); | |
| 335 | 374 | }); |
| 336 | 375 | |
| 337 | 376 | /** |
| 338 | 377 | * Handle switching TAB Buttons. |
| @@ -337,9 +376,9 @@ | ||
| 337 | 376 | /** |
| 338 | 377 | * Handle switching TAB Buttons. |
| 339 | 378 | * Check if cPanel or Plesk is selected TAB when page loads & display the correct content. |
| 340 | 379 | */ |
| 341 | - var ref_this = jQuery('#mainwp_api_cpanel_backup_tabs div.active'); | |
| 380 | + let ref_this = jQuery('#mainwp_api_cpanel_backup_tabs div.active'); | |
| 342 | 381 | if (ref_this.data('tab') === 'cpanel-native') { |
| 343 | 382 | jQuery('#mainwp_3rd_party_api_cpanel_action_create_full_backup').show(); |
| 344 | 383 | jQuery('#mainwp_3rd_party_api_cpanel_action_create_wptk_backup').hide(); |
| 345 | 384 | } else if (ref_this.data('tab') === 'cpanel-wp-toolkit') { |
| @@ -356,9 +395,9 @@ | ||
| 356 | 395 | * |
| 357 | 396 | * This function is called when the "Backup Selected Sites" button is clicked. |
| 358 | 397 | * mainwp_api_backups_do_backups() is defined in assets/js/mainwp-api-backups.js. |
| 359 | 398 | */ |
| 360 | -action_backup_selected_sites = function (pObj) { | |
| 399 | +let action_backup_selected_sites = function (pObj) { | |
| 361 | 400 | mainwp_api_backups_do_backups(pObj); |
| 362 | 401 | } |
| 363 | 402 | |
| 364 | 403 | /** |
| @@ -364,11 +403,11 @@ | ||
| 364 | 403 | /** |
| 365 | 404 | * Handle switching TAB Action Buttons on Individual Cpanel Backups page. |
| 366 | 405 | * Check if cPanel or Plesk is selected TAB when TAB is clicked & display the correct content. |
| 367 | 406 | */ |
| 368 | -action_check_tab = function () { | |
| 407 | +let action_check_tab = function () { | |
| 369 | 408 | |
| 370 | - var ref_this = jQuery('#mainwp_api_cpanel_backup_tabs div.active'); | |
| 409 | + let ref_this = jQuery('#mainwp_api_cpanel_backup_tabs div.active'); | |
| 371 | 410 | if (ref_this.data('tab') === 'cpanel-native') { |
| 372 | 411 | jQuery('#mainwp_3rd_party_api_cpanel_action_create_full_backup').show(); |
| 373 | 412 | jQuery('#mainwp_3rd_party_api_cpanel_action_create_wptk_backup').hide(); |
| 374 | 413 | } else if (ref_this.data('tab') === 'cpanel-wp-toolkit') { |
| @@ -376,27 +415,31 @@ | ||
| 376 | 415 | jQuery('#mainwp_3rd_party_api_cpanel_action_create_wptk_backup').show(); |
| 377 | 416 | } |
| 378 | 417 | } |
| 379 | 418 | |
| 419 | +let module_api_backups_prepare_working_status = function(button){ | |
| 420 | + jQuery(button).html('<i class="notched circle loading icon"></i>'); | |
| 421 | +} | |
| 422 | + | |
| 380 | 423 | /******************************************************** |
| 381 | 424 | * Cloudways Functions. |
| 382 | 425 | */ |
| 383 | 426 | |
| 384 | 427 | // Create Backup. |
| 385 | -cloudways_action_backup = function (pObj) { | |
| 428 | +let cloudways_action_backup = function (pObj) { | |
| 386 | 429 | |
| 387 | 430 | jQuery(pObj).attr('disabled', 'true'); |
| 388 | - var button = jQuery(pObj).closest('td'); | |
| 389 | - var lastBackup = jQuery(pObj).closest('td').prev(); | |
| 390 | - var websiteId = jQuery(pObj).attr('website_id'); | |
| 431 | + let button = jQuery(pObj).closest('td'); | |
| 432 | + let lastBackup = jQuery(pObj).closest('td').prev(); | |
| 433 | + let websiteId = jQuery(pObj).attr('website_id'); | |
| 391 | 434 | |
| 392 | - var data = mainwp_secure_data({ | |
| 435 | + let data = mainwp_secure_data({ | |
| 393 | 436 | action: 'cloudways_action_backup', |
| 394 | 437 | website_id: websiteId, |
| 395 | 438 | backup_api: 'cloudways' |
| 396 | 439 | }); |
| 397 | 440 | |
| 398 | - jQuery(button).html('<i class="notched circle loading icon"></i>'); | |
| 441 | + module_api_backups_prepare_working_status(button); | |
| 399 | 442 | jQuery(lastBackup).html('Requesting Backup...'); |
| 400 | 443 | |
| 401 | 444 | jQuery.post(ajaxurl, data, function (response) { |
| 402 | 445 | response = jQuery.trim(response); |
| @@ -402,29 +445,29 @@ | ||
| 402 | 445 | response = jQuery.trim(response); |
| 403 | 446 | |
| 404 | 447 | if (response === 'true') { |
| 405 | 448 | |
| 406 | - // Show message. | |
| 407 | - jQuery('#mainwp-api-backups-message-zone').addClass('green').show(); | |
| 408 | - jQuery('#mainwp-api-backups-message-zone .content .message') | |
| 409 | - .html( 'A backup has been requested. Please allow some time for the backup to complete, then Refresh Available Backups.') | |
| 410 | - ; | |
| 449 | + // Show message. | |
| 450 | + jQuery('#mainwp-api-backups-message-zone').addClass('green').show(); | |
| 451 | + jQuery('#mainwp-api-backups-message-zone .content .message') | |
| 452 | + .html( 'A backup has been requested. Please allow some time for the backup to complete, then Refresh Available Backups.') | |
| 453 | + ; | |
| 411 | 454 | |
| 412 | - setTimeout(function () { | |
| 413 | - location.reload(); | |
| 414 | - }, 5000); | |
| 455 | + setTimeout(function () { | |
| 456 | + mainwp_forceReload(); | |
| 457 | + }, 5000); | |
| 415 | 458 | |
| 416 | 459 | } else { |
| 417 | 460 | |
| 418 | - // Show message. | |
| 419 | - jQuery('#mainwp-api-backups-message-zone').addClass('red').show(); | |
| 420 | - jQuery('#mainwp-api-backups-message-zone .content .message') | |
| 421 | - .html('There was an issue while requesting your backup. Please check that your ID and API Key are correct.') | |
| 422 | - ; | |
| 461 | + // Show message. | |
| 462 | + jQuery('#mainwp-api-backups-message-zone').addClass('red').show(); | |
| 463 | + jQuery('#mainwp-api-backups-message-zone .content .message') | |
| 464 | + .html('There was an issue while requesting your backup. Please check that your ID and API Key are correct.') | |
| 465 | + ; | |
| 423 | 466 | |
| 424 | - setTimeout(function () { | |
| 425 | - location.reload(); | |
| 426 | - }, 5000); | |
| 467 | + setTimeout(function () { | |
| 468 | + mainwp_forceReload(); | |
| 469 | + }, 5000); | |
| 427 | 470 | |
| 428 | 471 | } |
| 429 | 472 | }); |
| 430 | 473 | |
| @@ -430,18 +473,18 @@ | ||
| 430 | 473 | |
| 431 | 474 | }; |
| 432 | 475 | |
| 433 | 476 | // Assign Apps to Child Sites. |
| 434 | -cloudways_action_update_ids = function (pObj) { | |
| 477 | +let cloudways_action_update_ids = function (pObj) { | |
| 435 | 478 | |
| 436 | 479 | jQuery(pObj).attr('disabled', 'true'); |
| 437 | - var button = jQuery(pObj).closest('td'); | |
| 480 | + let button = jQuery(pObj).closest('td'); | |
| 438 | 481 | |
| 439 | - var data = mainwp_secure_data({ | |
| 482 | + let data = mainwp_secure_data({ | |
| 440 | 483 | action: 'cloudways_action_update_ids' |
| 441 | 484 | }); |
| 442 | 485 | |
| 443 | - jQuery(button).html('<i class="notched circle loading icon"></i>'); | |
| 486 | + module_api_backups_prepare_working_status(button); | |
| 444 | 487 | |
| 445 | 488 | jQuery.post(ajaxurl, data, function (response) { |
| 446 | 489 | response = jQuery.trim(response); |
| 447 | 490 | |
| @@ -455,11 +498,11 @@ | ||
| 455 | 498 | }; |
| 456 | 499 | |
| 457 | 500 | |
| 458 | 501 | // Refresh Available Backup. |
| 459 | -cloudways_action_refresh_available_backups = function (pObj) { | |
| 502 | +let cloudways_action_refresh_available_backups = function (pObj) { | |
| 460 | 503 | |
| 461 | - var websiteId = jQuery(pObj).attr('website_id'); | |
| 504 | + let websiteId = jQuery(pObj).attr('website_id'); | |
| 462 | 505 | |
| 463 | 506 | // Start button animation. |
| 464 | 507 | jQuery(pObj).addClass('disabled loading'); |
| 465 | 508 | |
| @@ -465,9 +508,9 @@ | ||
| 465 | 508 | |
| 466 | 509 | // Prepare the data to send. |
| 467 | 510 | // The "action" is the name of the action hook to trigger. |
| 468 | 511 | // Anything else is data that we want to pass to the PHP function. |
| 469 | - var data = mainwp_secure_data({ | |
| 512 | + let data = mainwp_secure_data({ | |
| 470 | 513 | action: 'cloudways_action_refresh_available_backups', |
| 471 | 514 | website_id: websiteId, |
| 472 | 515 | backup_api: 'cloudways' |
| 473 | 516 | }); |
| @@ -480,13 +523,13 @@ | ||
| 480 | 523 | response = jQuery.trim(response); |
| 481 | 524 | |
| 482 | 525 | if (response === 'true') { |
| 483 | 526 | |
| 484 | - // Show message. | |
| 485 | - jQuery('#mainwp-api-backups-message-zone').addClass('green').show(); | |
| 486 | - jQuery('#mainwp-api-backups-message-zone .content .message') | |
| 487 | - .html( 'Available backups have been refreshed.' ) | |
| 488 | - ; | |
| 527 | + // Show message. | |
| 528 | + jQuery('#mainwp-api-backups-message-zone').addClass('green').show(); | |
| 529 | + jQuery('#mainwp-api-backups-message-zone .content .message') | |
| 530 | + .html( 'Available backups have been refreshed.' ) | |
| 531 | + ; | |
| 489 | 532 | |
| 490 | 533 | // Stop button animation. |
| 491 | 534 | jQuery(pObj).removeClass('disabled loading'); |
| 492 | 535 | |
| @@ -493,13 +536,13 @@ | ||
| 493 | 536 | setInterval('location.reload()', 7000); // Using .reload() method. |
| 494 | 537 | |
| 495 | 538 | } else { |
| 496 | 539 | |
| 497 | - // Show message. | |
| 498 | - jQuery('#mainwp-api-backups-message-zone').addClass('red').show(); | |
| 499 | - jQuery('#mainwp-api-backups-message-zone .content .message') | |
| 500 | - .html( 'There was an issue while refreshing available backups.' ) | |
| 501 | - ; | |
| 540 | + // Show message. | |
| 541 | + jQuery('#mainwp-api-backups-message-zone').addClass('red').show(); | |
| 542 | + jQuery('#mainwp-api-backups-message-zone .content .message') | |
| 543 | + .html( 'There was an issue while refreshing available backups.' ) | |
| 544 | + ; | |
| 502 | 545 | |
| 503 | 546 | // Stop button animation. |
| 504 | 547 | jQuery(pObj).removeClass('disabled loading'); |
| 505 | 548 | |
| @@ -507,14 +550,14 @@ | ||
| 507 | 550 | }, 'json'); |
| 508 | 551 | }; |
| 509 | 552 | |
| 510 | 553 | // Restore backups. |
| 511 | -cloudways_action_restore_backup = function (pObj) { | |
| 512 | - var button = jQuery(pObj); | |
| 513 | - var websiteId = jQuery(pObj).attr('website_id'); | |
| 514 | - var backupDate = jQuery(pObj).attr('backup_date'); | |
| 554 | +let cloudways_action_restore_backup = function (pObj) { | |
| 555 | + let button = jQuery(pObj); | |
| 556 | + let websiteId = jQuery(pObj).attr('website_id'); | |
| 557 | + let backupDate = jQuery(pObj).attr('backup_date'); | |
| 515 | 558 | |
| 516 | - var data = mainwp_secure_data({ | |
| 559 | + let data = mainwp_secure_data({ | |
| 517 | 560 | action: 'cloudways_action_restore_backup', |
| 518 | 561 | website_id: websiteId, |
| 519 | 562 | backup_date: backupDate, |
| 520 | 563 | backup_api: 'cloudways' |
| @@ -520,9 +563,9 @@ | ||
| 520 | 563 | backup_api: 'cloudways' |
| 521 | 564 | }); |
| 522 | 565 | |
| 523 | 566 | // Start button animation. |
| 524 | - jQuery(button).html('<i class="notched circle loading icon"></i>'); | |
| 567 | + module_api_backups_prepare_working_status(button); | |
| 525 | 568 | |
| 526 | 569 | jQuery.post(ajaxurl, data, function (response) { |
| 527 | 570 | response = jQuery.trim(response); |
| 528 | 571 | |
| @@ -527,13 +570,13 @@ | ||
| 527 | 570 | response = jQuery.trim(response); |
| 528 | 571 | |
| 529 | 572 | if (response === 'true') { |
| 530 | 573 | |
| 531 | - // Show message. | |
| 532 | - jQuery('#mainwp-api-backups-message-zone').addClass('green').show(); | |
| 533 | - jQuery('#mainwp-api-backups-message-zone .content .message') | |
| 534 | - .html( 'Your application is in the process of restoring. This will take a few minuets...' ) | |
| 535 | - ; | |
| 574 | + // Show message. | |
| 575 | + jQuery('#mainwp-api-backups-message-zone').addClass('green').show(); | |
| 576 | + jQuery('#mainwp-api-backups-message-zone .content .message') | |
| 577 | + .html( 'Your application is in the process of restoring. This will take a few minuets...' ) | |
| 578 | + ; | |
| 536 | 579 | |
| 537 | 580 | // Stop button animation. |
| 538 | 581 | jQuery(button).html('<i class="undo icon"></i>'); |
| 539 | 582 | |
| @@ -538,13 +581,13 @@ | ||
| 538 | 581 | jQuery(button).html('<i class="undo icon"></i>'); |
| 539 | 582 | |
| 540 | 583 | } else { |
| 541 | 584 | |
| 542 | - // Show message. | |
| 543 | - jQuery('#mainwp-api-backups-message-zone').addClass('red').show(); | |
| 544 | - jQuery('#mainwp-api-backups-message-zone .content .message') | |
| 545 | - .html( 'There was an issue while attempting to restore your application...' ) | |
| 546 | - ; | |
| 585 | + // Show message. | |
| 586 | + jQuery('#mainwp-api-backups-message-zone').addClass('red').show(); | |
| 587 | + jQuery('#mainwp-api-backups-message-zone .content .message') | |
| 588 | + .html( 'There was an issue while attempting to restore your application...' ) | |
| 589 | + ; | |
| 547 | 590 | |
| 548 | 591 | // Stop button animation. |
| 549 | 592 | jQuery(button).html('<i class="undo icon"></i>'); |
| 550 | 593 | |
| @@ -552,16 +595,16 @@ | ||
| 552 | 595 | }); |
| 553 | 596 | }; |
| 554 | 597 | |
| 555 | 598 | // Delete backups. |
| 556 | -cloudways_action_delete_backup = function (pObj) { | |
| 599 | +let cloudways_action_delete_backup = function (pObj) { | |
| 557 | 600 | |
| 558 | 601 | jQuery(pObj).attr('disabled', 'true'); |
| 559 | - var button = jQuery(pObj).closest('td'); | |
| 602 | + let button = jQuery(pObj).closest('td'); | |
| 560 | 603 | |
| 561 | - var websiteId = jQuery(pObj).attr('website_id'); | |
| 604 | + let websiteId = jQuery(pObj).attr('website_id'); | |
| 562 | 605 | |
| 563 | - var data = mainwp_secure_data({ | |
| 606 | + let data = mainwp_secure_data({ | |
| 564 | 607 | action: 'cloudways_action_delete_backup', |
| 565 | 608 | website_id: websiteId, |
| 566 | 609 | backup_api: 'cloudways' |
| 567 | 610 | }); |
| @@ -574,13 +617,13 @@ | ||
| 574 | 617 | response = jQuery.trim(response); |
| 575 | 618 | |
| 576 | 619 | if (response === 'true') { |
| 577 | 620 | |
| 578 | - // Show message. | |
| 579 | - jQuery('#mainwp-api-backups-message-zone').addClass('green').show(); | |
| 580 | - jQuery('#mainwp-api-backups-message-zone .content .message') | |
| 581 | - .html( 'The local backups done before last restore have been deleted.' ) | |
| 582 | - ; | |
| 621 | + // Show message. | |
| 622 | + jQuery('#mainwp-api-backups-message-zone').addClass('green').show(); | |
| 623 | + jQuery('#mainwp-api-backups-message-zone .content .message') | |
| 624 | + .html( 'The local backups done before last restore have been deleted.' ) | |
| 625 | + ; | |
| 583 | 626 | |
| 584 | 627 | // Stop button animation. |
| 585 | 628 | jQuery(button).find('i.loading').css({ 'display': 'none' }); |
| 586 | 629 | jQuery(button).find('div').removeClass('hidden'); |
| @@ -586,13 +629,13 @@ | ||
| 586 | 629 | jQuery(button).find('div').removeClass('hidden'); |
| 587 | 630 | |
| 588 | 631 | } else { |
| 589 | 632 | |
| 590 | - // Show message. | |
| 591 | - jQuery('#mainwp-api-backups-message-zone').addClass('red').show(); | |
| 592 | - jQuery('#mainwp-api-backups-message-zone .content .message') | |
| 593 | - .html( 'There was an issue while deleting your backups.' ) | |
| 594 | - ; | |
| 633 | + // Show message. | |
| 634 | + jQuery('#mainwp-api-backups-message-zone').addClass('red').show(); | |
| 635 | + jQuery('#mainwp-api-backups-message-zone .content .message') | |
| 636 | + .html( 'There was an issue while deleting your backups.' ) | |
| 637 | + ; | |
| 595 | 638 | |
| 596 | 639 | // Stop button animation. |
| 597 | 640 | jQuery(button).find('i.loading').css({ 'display': 'none' }); |
| 598 | 641 | jQuery(button).find('div').removeClass('hidden'); |
| @@ -605,13 +648,13 @@ | ||
| 605 | 648 | * Vultr Functions. |
| 606 | 649 | */ |
| 607 | 650 | |
| 608 | 651 | // Assign Instances to Child Sites. |
| 609 | -vultr_action_update_ids = function (pObj) { | |
| 652 | +let vultr_action_update_ids = function (pObj) { | |
| 610 | 653 | jQuery(pObj).attr('disabled', 'true'); |
| 611 | - var button = jQuery(pObj).closest('td'); | |
| 654 | + let button = jQuery(pObj).closest('td'); | |
| 612 | 655 | |
| 613 | - var data = mainwp_secure_data({ | |
| 656 | + let data = mainwp_secure_data({ | |
| 614 | 657 | action: 'vultr_action_update_ids' |
| 615 | 658 | }); |
| 616 | 659 | |
| 617 | 660 | // Start button animation. |
| @@ -622,13 +665,13 @@ | ||
| 622 | 665 | response = jQuery.trim(response); |
| 623 | 666 | |
| 624 | 667 | if (response === 'true') { |
| 625 | 668 | |
| 626 | - // Show message. | |
| 627 | - jQuery('#mainwp-api-backups-message-zone').addClass('green').show(); | |
| 628 | - jQuery('#mainwp-api-backups-message-zone .content .message') | |
| 629 | - .html('Backup Stats have been refreshed.') | |
| 630 | - ; | |
| 669 | + // Show message. | |
| 670 | + jQuery('#mainwp-api-backups-message-zone').addClass('green').show(); | |
| 671 | + jQuery('#mainwp-api-backups-message-zone .content .message') | |
| 672 | + .html('Backup Stats have been refreshed.') | |
| 673 | + ; | |
| 631 | 674 | |
| 632 | 675 | // Stop button animation. |
| 633 | 676 | jQuery(button).find('i.loading').css({ 'display': 'none' }); |
| 634 | 677 | jQuery(button).find('div').removeClass('hidden'); |
| @@ -634,13 +677,13 @@ | ||
| 634 | 677 | jQuery(button).find('div').removeClass('hidden'); |
| 635 | 678 | |
| 636 | 679 | } else { |
| 637 | 680 | |
| 638 | - // Show message. | |
| 639 | - jQuery('#mainwp-api-backups-message-zone').addClass('red').show(); | |
| 640 | - jQuery('#mainwp-api-backups-message-zone .content .message') | |
| 641 | - .html( 'There was an issue refreshing the Backup Stats.' ) | |
| 642 | - ; | |
| 681 | + // Show message. | |
| 682 | + jQuery('#mainwp-api-backups-message-zone').addClass('red').show(); | |
| 683 | + jQuery('#mainwp-api-backups-message-zone .content .message') | |
| 684 | + .html( 'There was an issue refreshing the Backup Stats.' ) | |
| 685 | + ; | |
| 643 | 686 | |
| 644 | 687 | // Stop button animation. |
| 645 | 688 | jQuery(button).find('i.loading').css({ 'display': 'none' }); |
| 646 | 689 | jQuery(button).find('div').removeClass('hidden'); |
| @@ -649,22 +692,22 @@ | ||
| 649 | 692 | }); |
| 650 | 693 | }; |
| 651 | 694 | |
| 652 | 695 | // Create Backup. |
| 653 | -vultr_action_create_snapshot = function (pObj) { | |
| 696 | +let vultr_action_create_snapshot = function (pObj) { | |
| 654 | 697 | |
| 655 | 698 | jQuery(pObj).attr('disabled', 'true'); |
| 656 | - var button = jQuery(pObj).closest('td'); | |
| 657 | - var lastBackup = jQuery(pObj).closest('td').prev(); | |
| 658 | - var websiteId = jQuery(pObj).attr('website_id'); | |
| 699 | + let button = jQuery(pObj).closest('td'); | |
| 700 | + let lastBackup = jQuery(pObj).closest('td').prev(); | |
| 701 | + let websiteId = jQuery(pObj).attr('website_id'); | |
| 659 | 702 | |
| 660 | - var data = mainwp_secure_data({ | |
| 703 | + let data = mainwp_secure_data({ | |
| 661 | 704 | action: 'vultr_action_create_snapshot', |
| 662 | 705 | website_id: websiteId, |
| 663 | 706 | backup_api: 'vultr' |
| 664 | 707 | }); |
| 665 | 708 | |
| 666 | - jQuery(button).html('<i class="notched circle loading icon"></i>'); | |
| 709 | + module_api_backups_prepare_working_status(button); | |
| 667 | 710 | jQuery(lastBackup).html('Requesting Backup...'); |
| 668 | 711 | |
| 669 | 712 | jQuery.post(ajaxurl, data, function (response) { |
| 670 | 713 | response = jQuery.trim(response); |
| @@ -669,26 +712,26 @@ | ||
| 669 | 712 | jQuery.post(ajaxurl, data, function (response) { |
| 670 | 713 | response = jQuery.trim(response); |
| 671 | 714 | if (response === 'true') { |
| 672 | 715 | |
| 673 | - // Show message. | |
| 674 | - jQuery('#mainwp-api-backups-message-zone').addClass('green').show(); | |
| 675 | - jQuery('#mainwp-api-backups-message-zone .content .message') | |
| 676 | - .html('A backup has been requested.'); | |
| 677 | - setTimeout(function () { | |
| 678 | - location.reload(); | |
| 679 | - }, 5000); | |
| 716 | + // Show message. | |
| 717 | + jQuery('#mainwp-api-backups-message-zone').addClass('green').show(); | |
| 718 | + jQuery('#mainwp-api-backups-message-zone .content .message') | |
| 719 | + .html('A backup has been requested.'); | |
| 720 | + setTimeout(function () { | |
| 721 | + mainwp_forceReload(); | |
| 722 | + }, 5000); | |
| 680 | 723 | |
| 681 | 724 | } else { |
| 682 | - var err_message = '' !== response ? response : 'There was an issue while requesting your backup. Please check that your ID and API Key are correct.'; | |
| 725 | + let err_message = '' !== response ? response : 'There was an issue while requesting your backup. Please check that your ID and API Key are correct.'; | |
| 683 | 726 | |
| 684 | - // Show message. | |
| 685 | - jQuery('#mainwp-api-backups-message-zone').addClass('red').show(); | |
| 686 | - jQuery('#mainwp-api-backups-message-zone .content .message') | |
| 687 | - .html( err_message ); | |
| 688 | - setTimeout(function () { | |
| 689 | - location.reload(); | |
| 690 | - }, 5000); | |
| 727 | + // Show message. | |
| 728 | + jQuery('#mainwp-api-backups-message-zone').addClass('red').show(); | |
| 729 | + jQuery('#mainwp-api-backups-message-zone .content .message') | |
| 730 | + .html( err_message ); | |
| 731 | + setTimeout(function () { | |
| 732 | + mainwp_forceReload(); | |
| 733 | + }, 5000); | |
| 691 | 734 | |
| 692 | 735 | } |
| 693 | 736 | }); |
| 694 | 737 | }; |
| @@ -693,13 +736,13 @@ | ||
| 693 | 736 | }); |
| 694 | 737 | }; |
| 695 | 738 | |
| 696 | 739 | // Refresh Available Backup. |
| 697 | -vultr_action_refresh_available_backups = function (pObj) { | |
| 740 | +let vultr_action_refresh_available_backups = function (pObj) { | |
| 698 | 741 | |
| 699 | - var websiteId = jQuery(pObj).attr('website_id'); | |
| 742 | + let websiteId = jQuery(pObj).attr('website_id'); | |
| 700 | 743 | |
| 701 | - var data = mainwp_secure_data({ | |
| 744 | + let data = mainwp_secure_data({ | |
| 702 | 745 | action: 'vultr_action_refresh_available_backups', |
| 703 | 746 | website_id: websiteId, |
| 704 | 747 | backup_api: 'vultr' |
| 705 | 748 | }); |
| @@ -711,13 +754,13 @@ | ||
| 711 | 754 | response = jQuery.trim(response); |
| 712 | 755 | |
| 713 | 756 | if (response === 'true') { |
| 714 | 757 | |
| 715 | - // Show message. | |
| 716 | - jQuery('#mainwp-api-backups-message-zone').addClass('green').show(); | |
| 717 | - jQuery('#mainwp-api-backups-message-zone .content .message') | |
| 718 | - .html('Available backups have been refreshed.') | |
| 719 | - ; | |
| 758 | + // Show message. | |
| 759 | + jQuery('#mainwp-api-backups-message-zone').addClass('green').show(); | |
| 760 | + jQuery('#mainwp-api-backups-message-zone .content .message') | |
| 761 | + .html('Available backups have been refreshed.') | |
| 762 | + ; | |
| 720 | 763 | |
| 721 | 764 | // Stop button animation. |
| 722 | 765 | jQuery(pObj).removeClass('disabled loading'); |
| 723 | 766 | |
| @@ -724,13 +767,13 @@ | ||
| 724 | 767 | setInterval('location.reload()', 7000); // Using .reload() method. |
| 725 | 768 | |
| 726 | 769 | } else { |
| 727 | 770 | |
| 728 | - // Show message. | |
| 729 | - jQuery('#mainwp-api-backups-message-zone').addClass('red').show(); | |
| 730 | - jQuery('#mainwp-api-backups-message-zone .content .message') | |
| 731 | - .html('There was an issue while refreshing available backups.' ) | |
| 732 | - ; | |
| 771 | + // Show message. | |
| 772 | + jQuery('#mainwp-api-backups-message-zone').addClass('red').show(); | |
| 773 | + jQuery('#mainwp-api-backups-message-zone .content .message') | |
| 774 | + .html('There was an issue while refreshing available backups.' ) | |
| 775 | + ; | |
| 733 | 776 | |
| 734 | 777 | // Stop button animation. |
| 735 | 778 | jQuery(pObj).removeClass('disabled loading'); |
| 736 | 779 | |
| @@ -737,15 +780,15 @@ | ||
| 737 | 780 | } |
| 738 | 781 | }); |
| 739 | 782 | }; |
| 740 | 783 | // Restore Backup. |
| 741 | -vultr_action_restore_backup = function (pObj) { | |
| 784 | +let vultr_action_restore_backup = function (pObj) { | |
| 742 | 785 | |
| 743 | - var button = jQuery(pObj); | |
| 744 | - var websiteId = jQuery(pObj).attr('website_id'); | |
| 745 | - var snapshotID = jQuery(pObj).attr('snapshot_id'); | |
| 786 | + let button = jQuery(pObj); | |
| 787 | + let websiteId = jQuery(pObj).attr('website_id'); | |
| 788 | + let snapshotID = jQuery(pObj).attr('snapshot_id'); | |
| 746 | 789 | |
| 747 | - var data = mainwp_secure_data({ | |
| 790 | + let data = mainwp_secure_data({ | |
| 748 | 791 | action: 'vultr_action_restore_backup', |
| 749 | 792 | website_id: websiteId, |
| 750 | 793 | backup_api: 'vultr', |
| 751 | 794 | snapshot_id: snapshotID |
| @@ -751,9 +794,9 @@ | ||
| 751 | 794 | snapshot_id: snapshotID |
| 752 | 795 | }); |
| 753 | 796 | |
| 754 | 797 | // Start button animation. |
| 755 | - jQuery(button).html('<i class="notched circle loading icon"></i>'); | |
| 798 | + module_api_backups_prepare_working_status(button); | |
| 756 | 799 | |
| 757 | 800 | jQuery.post(ajaxurl, data, function (response) { |
| 758 | 801 | response = jQuery.trim(response); |
| 759 | 802 | |
| @@ -758,13 +801,13 @@ | ||
| 758 | 801 | response = jQuery.trim(response); |
| 759 | 802 | |
| 760 | 803 | if (response === 'true') { |
| 761 | 804 | |
| 762 | - // Show message. | |
| 763 | - jQuery('#mainwp-api-backups-message-zone').addClass('green').show(); | |
| 764 | - jQuery('#mainwp-api-backups-message-zone .content .message') | |
| 765 | - .html('Backup restoration process has begun. Please wait a few moments and then check the site.') | |
| 766 | - ; | |
| 805 | + // Show message. | |
| 806 | + jQuery('#mainwp-api-backups-message-zone').addClass('green').show(); | |
| 807 | + jQuery('#mainwp-api-backups-message-zone .content .message') | |
| 808 | + .html('Backup restoration process has begun. Please wait a few moments and then check the site.') | |
| 809 | + ; | |
| 767 | 810 | |
| 768 | 811 | // Stop button animation. |
| 769 | 812 | jQuery(button).html('<i class="undo icon"></i>'); |
| 770 | 813 | |
| @@ -769,13 +812,13 @@ | ||
| 769 | 812 | jQuery(button).html('<i class="undo icon"></i>'); |
| 770 | 813 | |
| 771 | 814 | } else { |
| 772 | 815 | |
| 773 | - // Show message. | |
| 774 | - jQuery('#mainwp-api-backups-message-zone').addClass('red').show(); | |
| 775 | - jQuery('#mainwp-api-backups-message-zone .content .message') | |
| 776 | - .html('There was an issue while restoring your backup.') | |
| 777 | - ; | |
| 816 | + // Show message. | |
| 817 | + jQuery('#mainwp-api-backups-message-zone').addClass('red').show(); | |
| 818 | + jQuery('#mainwp-api-backups-message-zone .content .message') | |
| 819 | + .html('There was an issue while restoring your backup.') | |
| 820 | + ; | |
| 778 | 821 | |
| 779 | 822 | // Stop button animation. |
| 780 | 823 | jQuery(button).html('<i class="undo icon"></i>'); |
| 781 | 824 | |
| @@ -784,15 +827,15 @@ | ||
| 784 | 827 | }; |
| 785 | 828 | |
| 786 | 829 | |
| 787 | 830 | // Delete Backup. |
| 788 | -vultr_action_delete_backup = function (pObj) { | |
| 831 | +let vultr_action_delete_backup = function (pObj) { | |
| 789 | 832 | |
| 790 | - var button = jQuery(pObj); | |
| 791 | - var websiteId = jQuery(pObj).attr('website_id'); | |
| 792 | - var snapshotID = jQuery(pObj).attr('snapshot_id'); | |
| 833 | + let button = jQuery(pObj); | |
| 834 | + let websiteId = jQuery(pObj).attr('website_id'); | |
| 835 | + let snapshotID = jQuery(pObj).attr('snapshot_id'); | |
| 793 | 836 | |
| 794 | - var data = mainwp_secure_data({ | |
| 837 | + let data = mainwp_secure_data({ | |
| 795 | 838 | action: 'vultr_action_delete_backup', |
| 796 | 839 | website_id: websiteId, |
| 797 | 840 | backup_api: 'vultr', |
| 798 | 841 | snapshot_id: snapshotID |
| @@ -798,9 +841,9 @@ | ||
| 798 | 841 | snapshot_id: snapshotID |
| 799 | 842 | }); |
| 800 | 843 | |
| 801 | 844 | // Start button animation. |
| 802 | - jQuery(button).html('<i class="notched circle loading icon"></i>'); | |
| 845 | + module_api_backups_prepare_working_status(button); | |
| 803 | 846 | |
| 804 | 847 | jQuery.post(ajaxurl, data, function (response) { |
| 805 | 848 | response = jQuery.trim(response); |
| 806 | 849 | |
| @@ -805,13 +848,13 @@ | ||
| 805 | 848 | response = jQuery.trim(response); |
| 806 | 849 | |
| 807 | 850 | if (response === 'true') { |
| 808 | 851 | |
| 809 | - // Show message. | |
| 810 | - jQuery('#mainwp-api-backups-message-zone').addClass('green').show(); | |
| 811 | - jQuery('#mainwp-api-backups-message-zone .content .message') | |
| 812 | - .html('The selected backup has been deleted.') | |
| 813 | - ; | |
| 852 | + // Show message. | |
| 853 | + jQuery('#mainwp-api-backups-message-zone').addClass('green').show(); | |
| 854 | + jQuery('#mainwp-api-backups-message-zone .content .message') | |
| 855 | + .html('The selected backup has been deleted.') | |
| 856 | + ; | |
| 814 | 857 | |
| 815 | 858 | // Stop button animation. |
| 816 | 859 | jQuery(button).html('<i class="undo icon"></i>'); |
| 817 | 860 | |
| @@ -816,13 +859,13 @@ | ||
| 816 | 859 | jQuery(button).html('<i class="undo icon"></i>'); |
| 817 | 860 | |
| 818 | 861 | } else { |
| 819 | 862 | |
| 820 | - // Show message. | |
| 821 | - jQuery('#mainwp-api-backups-message-zone').addClass('red').show(); | |
| 822 | - jQuery('#mainwp-api-backups-message-zone .content .message') | |
| 823 | - .html('There was an issue while deleting the selected backup.') | |
| 824 | - ; | |
| 863 | + // Show message. | |
| 864 | + jQuery('#mainwp-api-backups-message-zone').addClass('red').show(); | |
| 865 | + jQuery('#mainwp-api-backups-message-zone .content .message') | |
| 866 | + .html('There was an issue while deleting the selected backup.') | |
| 867 | + ; | |
| 825 | 868 | |
| 826 | 869 | // Stop button animation. |
| 827 | 870 | jQuery(button).html('<i class="undo icon"></i>'); |
| 828 | 871 | |
| @@ -835,17 +878,17 @@ | ||
| 835 | 878 | * Gridpane Functions. |
| 836 | 879 | */ |
| 837 | 880 | |
| 838 | 881 | // Assign Site ID's to Child Sites. |
| 839 | -gridpane_action_update_ids = function (pObj) { | |
| 882 | +let gridpane_action_update_ids = function (pObj) { | |
| 840 | 883 | jQuery(pObj).attr('disabled', 'true'); |
| 841 | - var button = jQuery(pObj).closest('td'); | |
| 884 | + let button = jQuery(pObj).closest('td'); | |
| 842 | 885 | |
| 843 | - var data = mainwp_secure_data({ | |
| 886 | + let data = mainwp_secure_data({ | |
| 844 | 887 | action: 'gridpane_action_update_ids' |
| 845 | 888 | }); |
| 846 | 889 | |
| 847 | - jQuery(button).html('<i class="notched circle loading icon"></i>'); | |
| 890 | + module_api_backups_prepare_working_status(button); | |
| 848 | 891 | |
| 849 | 892 | jQuery.post(ajaxurl, data, function (response) { |
| 850 | 893 | response = jQuery.trim(response); |
| 851 | 894 | |
| @@ -858,22 +901,22 @@ | ||
| 858 | 901 | }); |
| 859 | 902 | }; |
| 860 | 903 | |
| 861 | 904 | // Create Backup. |
| 862 | -gridpane_action_create_backup = function (pObj) { | |
| 905 | +let gridpane_action_create_backup = function (pObj) { | |
| 863 | 906 | |
| 864 | 907 | jQuery(pObj).attr('disabled', 'true'); |
| 865 | - var button = jQuery(pObj).closest('td'); | |
| 866 | - var lastBackup = jQuery(pObj).closest('td').prev(); | |
| 867 | - var websiteId = jQuery(pObj).attr('website_id'); | |
| 908 | + let button = jQuery(pObj).closest('td'); | |
| 909 | + let lastBackup = jQuery(pObj).closest('td').prev(); | |
| 910 | + let websiteId = jQuery(pObj).attr('website_id'); | |
| 868 | 911 | |
| 869 | - var data = mainwp_secure_data({ | |
| 912 | + let data = mainwp_secure_data({ | |
| 870 | 913 | action: 'gridpane_action_create_backup', |
| 871 | 914 | website_id: websiteId, |
| 872 | 915 | backup_api: 'gridpane' |
| 873 | 916 | }); |
| 874 | 917 | |
| 875 | - jQuery(button).html('<i class="notched circle loading icon"></i>'); | |
| 918 | + module_api_backups_prepare_working_status(button); | |
| 876 | 919 | |
| 877 | 920 | jQuery(lastBackup).html('Requesting Backup...'); |
| 878 | 921 | |
| 879 | 922 | jQuery.post(ajaxurl, data, function (response) { |
| @@ -880,28 +923,28 @@ | ||
| 880 | 923 | response = jQuery.trim(response); |
| 881 | 924 | |
| 882 | 925 | if (response === 'true') { |
| 883 | 926 | |
| 884 | - // Show message. | |
| 885 | - jQuery('#mainwp-api-backups-message-zone').addClass('green').show(); | |
| 886 | - jQuery('#mainwp-api-backups-message-zone .content .message') | |
| 887 | - .html('A backup has been requested.') | |
| 888 | - ; | |
| 927 | + // Show message. | |
| 928 | + jQuery('#mainwp-api-backups-message-zone').addClass('green').show(); | |
| 929 | + jQuery('#mainwp-api-backups-message-zone .content .message') | |
| 930 | + .html('A backup has been requested.') | |
| 931 | + ; | |
| 889 | 932 | |
| 890 | 933 | setTimeout(function () { |
| 891 | - location.reload(); | |
| 934 | + mainwp_forceReload(); | |
| 892 | 935 | }, 5000); |
| 893 | 936 | |
| 894 | 937 | } else { |
| 895 | 938 | |
| 896 | - // Show message. | |
| 897 | - jQuery('#mainwp-api-backups-message-zone').addClass('red').show(); | |
| 898 | - jQuery('#mainwp-api-backups-message-zone .content .message') | |
| 899 | - .html('There was an issue while requesting your backup. Please check that your ID and API Key are correct.' ) | |
| 900 | - ; | |
| 939 | + // Show message. | |
| 940 | + jQuery('#mainwp-api-backups-message-zone').addClass('red').show(); | |
| 941 | + jQuery('#mainwp-api-backups-message-zone .content .message') | |
| 942 | + .html('There was an issue while requesting your backup. Please check that your ID and API Key are correct.' ) | |
| 943 | + ; | |
| 901 | 944 | |
| 902 | 945 | setTimeout(function () { |
| 903 | - location.reload(); | |
| 946 | + mainwp_forceReload(); | |
| 904 | 947 | }, 5000); |
| 905 | 948 | |
| 906 | 949 | } |
| 907 | 950 | }); |
| @@ -907,13 +950,13 @@ | ||
| 907 | 950 | }); |
| 908 | 951 | }; |
| 909 | 952 | |
| 910 | 953 | // Refresh Available Backup. |
| 911 | -gridpane_action_refresh_available_backups = function (pObj) { | |
| 954 | +let gridpane_action_refresh_available_backups = function (pObj) { | |
| 912 | 955 | |
| 913 | - var websiteId = jQuery(pObj).attr('website_id'); | |
| 956 | + let websiteId = jQuery(pObj).attr('website_id'); | |
| 914 | 957 | |
| 915 | - var data = mainwp_secure_data({ | |
| 958 | + let data = mainwp_secure_data({ | |
| 916 | 959 | action: 'gridpane_action_refresh_available_backups', |
| 917 | 960 | website_id: websiteId, |
| 918 | 961 | backup_api: 'gridpane' |
| 919 | 962 | }); |
| @@ -925,13 +968,13 @@ | ||
| 925 | 968 | response = jQuery.trim(response); |
| 926 | 969 | |
| 927 | 970 | if (response === 'true') { |
| 928 | 971 | |
| 929 | - // Show message. | |
| 930 | - jQuery('#mainwp-api-backups-message-zone').addClass('green').show(); | |
| 931 | - jQuery('#mainwp-api-backups-message-zone .content .message') | |
| 932 | - .html('Available backups have been refreshed.') | |
| 933 | - ; | |
| 972 | + // Show message. | |
| 973 | + jQuery('#mainwp-api-backups-message-zone').addClass('green').show(); | |
| 974 | + jQuery('#mainwp-api-backups-message-zone .content .message') | |
| 975 | + .html('Available backups have been refreshed.') | |
| 976 | + ; | |
| 934 | 977 | |
| 935 | 978 | // Stop button animation. |
| 936 | 979 | jQuery(pObj).removeClass('disabled loading'); |
| 937 | 980 | |
| @@ -938,13 +981,13 @@ | ||
| 938 | 981 | setInterval('location.reload()', 7000); // Using .reload() method. |
| 939 | 982 | |
| 940 | 983 | } else { |
| 941 | 984 | |
| 942 | - // Show message. | |
| 943 | - jQuery('#mainwp-api-backups-message-zone').addClass('red').show(); | |
| 944 | - jQuery('#mainwp-api-backups-message-zone .content .message') | |
| 945 | - .html('There was an issue while refreshing available backups.' ) | |
| 946 | - ; | |
| 985 | + // Show message. | |
| 986 | + jQuery('#mainwp-api-backups-message-zone').addClass('red').show(); | |
| 987 | + jQuery('#mainwp-api-backups-message-zone .content .message') | |
| 988 | + .html('There was an issue while refreshing available backups.' ) | |
| 989 | + ; | |
| 947 | 990 | |
| 948 | 991 | // Stop button animation. |
| 949 | 992 | jQuery(pObj).removeClass('disabled loading'); |
| 950 | 993 | |
| @@ -952,16 +995,16 @@ | ||
| 952 | 995 | }); |
| 953 | 996 | }; |
| 954 | 997 | |
| 955 | 998 | // Restore Backup. |
| 956 | -gridpane_action_restore_backup = function (pObj) { | |
| 999 | +let gridpane_action_restore_backup = function (pObj) { | |
| 957 | 1000 | |
| 958 | - var button = jQuery(pObj); | |
| 959 | - var websiteId = jQuery(pObj).attr('website_id'); | |
| 960 | - var backupType = jQuery(pObj).attr('backup_type'); | |
| 961 | - var backupName = jQuery(pObj).attr('backup_name'); | |
| 1001 | + let button = jQuery(pObj); | |
| 1002 | + let websiteId = jQuery(pObj).attr('website_id'); | |
| 1003 | + let backupType = jQuery(pObj).attr('backup_type'); | |
| 1004 | + let backupName = jQuery(pObj).attr('backup_name'); | |
| 962 | 1005 | |
| 963 | - var data = mainwp_secure_data({ | |
| 1006 | + let data = mainwp_secure_data({ | |
| 964 | 1007 | action: 'gridpane_action_restore_backup', |
| 965 | 1008 | website_id: websiteId, |
| 966 | 1009 | backup_api: 'gridpane', |
| 967 | 1010 | backup_type: backupType, |
| @@ -968,9 +1011,9 @@ | ||
| 968 | 1011 | backup_name: backupName |
| 969 | 1012 | }); |
| 970 | 1013 | |
| 971 | 1014 | // Start button animation. |
| 972 | - jQuery(button).html('<i class="notched circle loading icon"></i>'); | |
| 1015 | + module_api_backups_prepare_working_status(button); | |
| 973 | 1016 | |
| 974 | 1017 | jQuery.post(ajaxurl, data, function (response) { |
| 975 | 1018 | response = jQuery.trim(response); |
| 976 | 1019 | |
| @@ -975,13 +1018,13 @@ | ||
| 975 | 1018 | response = jQuery.trim(response); |
| 976 | 1019 | |
| 977 | 1020 | if (response === 'true') { |
| 978 | 1021 | |
| 979 | - // Show message. | |
| 980 | - jQuery('#mainwp-api-backups-message-zone').addClass('green').show(); | |
| 981 | - jQuery('#mainwp-api-backups-message-zone .content .message') | |
| 982 | - .html('Backup restoration has begun. Please wait a few moments and then check the site.') | |
| 983 | - ; | |
| 1022 | + // Show message. | |
| 1023 | + jQuery('#mainwp-api-backups-message-zone').addClass('green').show(); | |
| 1024 | + jQuery('#mainwp-api-backups-message-zone .content .message') | |
| 1025 | + .html('Backup restoration has begun. Please wait a few moments and then check the site.') | |
| 1026 | + ; | |
| 984 | 1027 | |
| 985 | 1028 | // Stop button animation. |
| 986 | 1029 | jQuery(button).html('<i class="undo icon"></i>'); |
| 987 | 1030 | |
| @@ -986,13 +1029,13 @@ | ||
| 986 | 1029 | jQuery(button).html('<i class="undo icon"></i>'); |
| 987 | 1030 | |
| 988 | 1031 | } else { |
| 989 | 1032 | |
| 990 | - // Show message. | |
| 991 | - jQuery('#mainwp-api-backups-message-zone').addClass('red').show(); | |
| 992 | - jQuery('#mainwp-api-backups-message-zone .content .message') | |
| 993 | - .html('There was an issue while restoring your backup.' ) | |
| 994 | - ; | |
| 1033 | + // Show message. | |
| 1034 | + jQuery('#mainwp-api-backups-message-zone').addClass('red').show(); | |
| 1035 | + jQuery('#mainwp-api-backups-message-zone .content .message') | |
| 1036 | + .html('There was an issue while restoring your backup.' ) | |
| 1037 | + ; | |
| 995 | 1038 | |
| 996 | 1039 | // Stop button animation. |
| 997 | 1040 | jQuery(button).html('<i class="undo icon"></i>'); |
| 998 | 1041 | |
| @@ -1000,17 +1043,17 @@ | ||
| 1000 | 1043 | }); |
| 1001 | 1044 | }; |
| 1002 | 1045 | |
| 1003 | 1046 | // Delete Backup. |
| 1004 | -gridpane_action_delete_backup = function (pObj) { | |
| 1047 | +let gridpane_action_delete_backup = function (pObj) { | |
| 1005 | 1048 | |
| 1006 | - var button = jQuery(pObj); | |
| 1049 | + let button = jQuery(pObj); | |
| 1007 | 1050 | |
| 1008 | - var websiteId = jQuery(pObj).attr('website_id'); | |
| 1009 | - var backupType = jQuery(pObj).attr('backup_type'); | |
| 1010 | - var backupName = jQuery(pObj).attr('backup_name'); | |
| 1051 | + let websiteId = jQuery(pObj).attr('website_id'); | |
| 1052 | + let backupType = jQuery(pObj).attr('backup_type'); | |
| 1053 | + let backupName = jQuery(pObj).attr('backup_name'); | |
| 1011 | 1054 | |
| 1012 | - var data = mainwp_secure_data({ | |
| 1055 | + let data = mainwp_secure_data({ | |
| 1013 | 1056 | action: 'gridpane_action_delete_backup', |
| 1014 | 1057 | website_id: websiteId, |
| 1015 | 1058 | backup_api: 'gridpane', |
| 1016 | 1059 | backup_type: backupType, |
| @@ -1017,9 +1060,9 @@ | ||
| 1017 | 1060 | backup_name: backupName |
| 1018 | 1061 | }); |
| 1019 | 1062 | |
| 1020 | 1063 | // Start button animation. |
| 1021 | - jQuery(button).html('<i class="notched circle loading icon"></i>'); | |
| 1064 | + module_api_backups_prepare_working_status(button); | |
| 1022 | 1065 | |
| 1023 | 1066 | jQuery.post(ajaxurl, data, function (response) { |
| 1024 | 1067 | response = jQuery.trim(response); |
| 1025 | 1068 | |
| @@ -1024,13 +1067,13 @@ | ||
| 1024 | 1067 | response = jQuery.trim(response); |
| 1025 | 1068 | |
| 1026 | 1069 | if (response === 'true') { |
| 1027 | 1070 | |
| 1028 | - // Show message. | |
| 1029 | - jQuery('#mainwp-api-backups-message-zone').addClass('green').show(); | |
| 1030 | - jQuery('#mainwp-api-backups-message-zone .content .message') | |
| 1031 | - .html('The selected backup has been deleted.') | |
| 1032 | - ; | |
| 1071 | + // Show message. | |
| 1072 | + jQuery('#mainwp-api-backups-message-zone').addClass('green').show(); | |
| 1073 | + jQuery('#mainwp-api-backups-message-zone .content .message') | |
| 1074 | + .html('The selected backup has been deleted.') | |
| 1075 | + ; | |
| 1033 | 1076 | |
| 1034 | 1077 | // Stop button animation. |
| 1035 | 1078 | jQuery(button).html('<i class="trash icon"></i>'); |
| 1036 | 1079 | |
| @@ -1035,13 +1078,13 @@ | ||
| 1035 | 1078 | jQuery(button).html('<i class="trash icon"></i>'); |
| 1036 | 1079 | |
| 1037 | 1080 | } else { |
| 1038 | 1081 | |
| 1039 | - // Show message. | |
| 1040 | - jQuery('#mainwp-api-backups-message-zone').addClass('red').show(); | |
| 1041 | - jQuery('#mainwp-api-backups-message-zone .content .message') | |
| 1042 | - .html('There was an issue while deleting the selected backup.') | |
| 1043 | - ; | |
| 1082 | + // Show message. | |
| 1083 | + jQuery('#mainwp-api-backups-message-zone').addClass('red').show(); | |
| 1084 | + jQuery('#mainwp-api-backups-message-zone .content .message') | |
| 1085 | + .html('There was an issue while deleting the selected backup.') | |
| 1086 | + ; | |
| 1044 | 1087 | |
| 1045 | 1088 | // Stop button animation. |
| 1046 | 1089 | jQuery(button).html('<i class="trash icon"></i>'); |
| 1047 | 1090 | |
| @@ -1053,17 +1096,17 @@ | ||
| 1053 | 1096 | * Linode Functions. |
| 1054 | 1097 | */ |
| 1055 | 1098 | |
| 1056 | 1099 | // Assign Site ID's to Child Sites. |
| 1057 | -linode_action_update_ids = function (pObj) { | |
| 1100 | +let linode_action_update_ids = function (pObj) { | |
| 1058 | 1101 | jQuery(pObj).attr('disabled', 'true'); |
| 1059 | - var button = jQuery(pObj).closest('td'); | |
| 1102 | + let button = jQuery(pObj).closest('td'); | |
| 1060 | 1103 | |
| 1061 | - var data = mainwp_secure_data({ | |
| 1104 | + let data = mainwp_secure_data({ | |
| 1062 | 1105 | action: 'linode_action_update_ids' |
| 1063 | 1106 | }); |
| 1064 | 1107 | |
| 1065 | - jQuery(button).html('<i class="notched circle loading icon"></i>'); | |
| 1108 | + module_api_backups_prepare_working_status(button); | |
| 1066 | 1109 | |
| 1067 | 1110 | jQuery.post(ajaxurl, data, function (response) { |
| 1068 | 1111 | response = jQuery.trim(response); |
| 1069 | 1112 | |
| @@ -1075,22 +1118,22 @@ | ||
| 1075 | 1118 | }); |
| 1076 | 1119 | }; |
| 1077 | 1120 | |
| 1078 | 1121 | // Create Backup. |
| 1079 | -linode_action_create_backup = function (pObj) { | |
| 1122 | +let linode_action_create_backup = function (pObj) { | |
| 1080 | 1123 | |
| 1081 | 1124 | jQuery(pObj).attr('disabled', 'true'); |
| 1082 | - var button = jQuery(pObj).closest('td'); | |
| 1083 | - var lastBackup = jQuery(pObj).closest('td').prev(); | |
| 1084 | - var websiteId = jQuery(pObj).attr('website_id'); | |
| 1125 | + let button = jQuery(pObj).closest('td'); | |
| 1126 | + let lastBackup = jQuery(pObj).closest('td').prev(); | |
| 1127 | + let websiteId = jQuery(pObj).attr('website_id'); | |
| 1085 | 1128 | |
| 1086 | - var data = mainwp_secure_data({ | |
| 1129 | + let data = mainwp_secure_data({ | |
| 1087 | 1130 | action: 'linode_action_create_backup', |
| 1088 | 1131 | website_id: websiteId, |
| 1089 | 1132 | backup_api: 'linode' |
| 1090 | 1133 | }); |
| 1091 | 1134 | |
| 1092 | - jQuery(button).html('<i class="notched circle loading icon"></i>'); | |
| 1135 | + module_api_backups_prepare_working_status(button); | |
| 1093 | 1136 | |
| 1094 | 1137 | jQuery(lastBackup).html('Requesting Backup...'); |
| 1095 | 1138 | |
| 1096 | 1139 | jQuery.post(ajaxurl, data, function (response) { |
| @@ -1097,28 +1140,28 @@ | ||
| 1097 | 1140 | response = jQuery.trim(response); |
| 1098 | 1141 | |
| 1099 | 1142 | if (response === 'true') { |
| 1100 | 1143 | |
| 1101 | - // Show message. | |
| 1102 | - jQuery('#mainwp-api-backups-message-zone').addClass('green').show(); | |
| 1103 | - jQuery('#mainwp-api-backups-message-zone .content .message') | |
| 1104 | - .html('A backup has been requested.') | |
| 1105 | - ; | |
| 1144 | + // Show message. | |
| 1145 | + jQuery('#mainwp-api-backups-message-zone').addClass('green').show(); | |
| 1146 | + jQuery('#mainwp-api-backups-message-zone .content .message') | |
| 1147 | + .html('A backup has been requested.') | |
| 1148 | + ; | |
| 1106 | 1149 | |
| 1107 | 1150 | setTimeout(function () { |
| 1108 | - location.reload(); | |
| 1151 | + mainwp_forceReload(); | |
| 1109 | 1152 | }, 5000); |
| 1110 | 1153 | |
| 1111 | 1154 | } else { |
| 1112 | 1155 | |
| 1113 | - // Show message. | |
| 1114 | - jQuery('#mainwp-api-backups-message-zone').addClass('red').show(); | |
| 1115 | - jQuery('#mainwp-api-backups-message-zone .content .message') | |
| 1116 | - .html('There was an issue while requesting your backup. Please check that your backups are enabled & ID\'s are correct.') | |
| 1117 | - ; | |
| 1156 | + // Show message. | |
| 1157 | + jQuery('#mainwp-api-backups-message-zone').addClass('red').show(); | |
| 1158 | + jQuery('#mainwp-api-backups-message-zone .content .message') | |
| 1159 | + .html('There was an issue while requesting your backup. Please check that your backups are enabled & ID\'s are correct.') | |
| 1160 | + ; | |
| 1118 | 1161 | |
| 1119 | 1162 | setTimeout(function () { |
| 1120 | - location.reload(); | |
| 1163 | + mainwp_forceReload(); | |
| 1121 | 1164 | }, 5000); |
| 1122 | 1165 | } |
| 1123 | 1166 | }); |
| 1124 | 1167 | }; |
| @@ -1123,13 +1166,13 @@ | ||
| 1123 | 1166 | }); |
| 1124 | 1167 | }; |
| 1125 | 1168 | |
| 1126 | 1169 | // Refresh Available Backup. |
| 1127 | -linode_action_refresh_available_backups = function (pObj) { | |
| 1170 | +let linode_action_refresh_available_backups = function (pObj) { | |
| 1128 | 1171 | |
| 1129 | - var websiteId = jQuery(pObj).attr('website_id'); | |
| 1172 | + let websiteId = jQuery(pObj).attr('website_id'); | |
| 1130 | 1173 | |
| 1131 | - var data = mainwp_secure_data({ | |
| 1174 | + let data = mainwp_secure_data({ | |
| 1132 | 1175 | action: 'linode_action_refresh_available_backups', |
| 1133 | 1176 | website_id: websiteId, |
| 1134 | 1177 | backup_api: 'linode' |
| 1135 | 1178 | }); |
| @@ -1141,13 +1184,13 @@ | ||
| 1141 | 1184 | response = jQuery.trim(response); |
| 1142 | 1185 | |
| 1143 | 1186 | if (response === 'true') { |
| 1144 | 1187 | |
| 1145 | - // Show message. | |
| 1146 | - jQuery('#mainwp-api-backups-message-zone').addClass('green').show(); | |
| 1147 | - jQuery('#mainwp-api-backups-message-zone .content .message') | |
| 1148 | - .html('Available backups have been refreshed.') | |
| 1149 | - ; | |
| 1188 | + // Show message. | |
| 1189 | + jQuery('#mainwp-api-backups-message-zone').addClass('green').show(); | |
| 1190 | + jQuery('#mainwp-api-backups-message-zone .content .message') | |
| 1191 | + .html('Available backups have been refreshed.') | |
| 1192 | + ; | |
| 1150 | 1193 | |
| 1151 | 1194 | // Stop button animation. |
| 1152 | 1195 | jQuery(pObj).removeClass('disabled loading'); |
| 1153 | 1196 | |
| @@ -1154,13 +1197,13 @@ | ||
| 1154 | 1197 | setInterval('location.reload()', 7000); // Using .reload() method. |
| 1155 | 1198 | |
| 1156 | 1199 | } else { |
| 1157 | 1200 | |
| 1158 | - // Show message. | |
| 1159 | - jQuery('#mainwp-api-backups-message-zone').addClass('red').show(); | |
| 1160 | - jQuery('#mainwp-api-backups-message-zone .content .message') | |
| 1161 | - .html('There was an issue while refreshing available backups.') | |
| 1162 | - ; | |
| 1201 | + // Show message. | |
| 1202 | + jQuery('#mainwp-api-backups-message-zone').addClass('red').show(); | |
| 1203 | + jQuery('#mainwp-api-backups-message-zone .content .message') | |
| 1204 | + .html('There was an issue while refreshing available backups.') | |
| 1205 | + ; | |
| 1163 | 1206 | |
| 1164 | 1207 | // Stop button animation. |
| 1165 | 1208 | jQuery(pObj).removeClass('disabled loading'); |
| 1166 | 1209 | |
| @@ -1168,17 +1211,17 @@ | ||
| 1168 | 1211 | }); |
| 1169 | 1212 | }; |
| 1170 | 1213 | |
| 1171 | 1214 | // restore Backup. |
| 1172 | -linode_action_restore_backup = function (pObj) { | |
| 1215 | +let linode_action_restore_backup = function (pObj) { | |
| 1173 | 1216 | |
| 1174 | 1217 | jQuery(pObj).attr('disabled', 'true'); |
| 1175 | - var button = jQuery(pObj).closest('td'); | |
| 1176 | - var backupStatus = jQuery(pObj).closest('td').prev(); | |
| 1177 | - var websiteId = jQuery(pObj).attr('website_id'); | |
| 1178 | - var backupId = jQuery(pObj).attr('backup_id'); | |
| 1218 | + let button = jQuery(pObj).closest('td'); | |
| 1219 | + let backupStatus = jQuery(pObj).closest('td').prev(); | |
| 1220 | + let websiteId = jQuery(pObj).attr('website_id'); | |
| 1221 | + let backupId = jQuery(pObj).attr('backup_id'); | |
| 1179 | 1222 | |
| 1180 | - var data = mainwp_secure_data({ | |
| 1223 | + let data = mainwp_secure_data({ | |
| 1181 | 1224 | action: 'linode_action_restore_backup', |
| 1182 | 1225 | website_id: websiteId, |
| 1183 | 1226 | backup_api: 'linode', |
| 1184 | 1227 | backup_id: backupId |
| @@ -1184,9 +1227,9 @@ | ||
| 1184 | 1227 | backup_id: backupId |
| 1185 | 1228 | }); |
| 1186 | 1229 | |
| 1187 | 1230 | // Start button animation. |
| 1188 | - jQuery(button).html('<i class="notched circle loading icon"></i>'); | |
| 1231 | + module_api_backups_prepare_working_status(button); | |
| 1189 | 1232 | jQuery(backupStatus).html('Restoring Backup...'); |
| 1190 | 1233 | |
| 1191 | 1234 | jQuery.post(ajaxurl, data, function (response) { |
| 1192 | 1235 | response = jQuery.trim(response); |
| @@ -1192,13 +1235,13 @@ | ||
| 1192 | 1235 | response = jQuery.trim(response); |
| 1193 | 1236 | |
| 1194 | 1237 | if (response === 'true') { |
| 1195 | 1238 | |
| 1196 | - // Show message. | |
| 1197 | - jQuery('#mainwp-api-backups-message-zone').addClass('green').show(); | |
| 1198 | - jQuery('#mainwp-api-backups-message-zone .content .message') | |
| 1199 | - .html('The backup restoration was successful. Please check your Linode Server Status...') | |
| 1200 | - ; | |
| 1239 | + // Show message. | |
| 1240 | + jQuery('#mainwp-api-backups-message-zone').addClass('green').show(); | |
| 1241 | + jQuery('#mainwp-api-backups-message-zone .content .message') | |
| 1242 | + .html('The backup restoration was successful. Please check your Linode Server Status...') | |
| 1243 | + ; | |
| 1201 | 1244 | |
| 1202 | 1245 | jQuery(backupStatus).html('Rebooting Server...'); |
| 1203 | 1246 | setInterval('location.reload()', 7000);// Using .reload() method. |
| 1204 | 1247 | |
| @@ -1203,13 +1246,13 @@ | ||
| 1203 | 1246 | setInterval('location.reload()', 7000);// Using .reload() method. |
| 1204 | 1247 | |
| 1205 | 1248 | } else { |
| 1206 | 1249 | |
| 1207 | - // Show message. | |
| 1208 | - jQuery('#mainwp-api-backups-message-zone').addClass('red').show(); | |
| 1209 | - jQuery('#mainwp-api-backups-message-zone .content .message') | |
| 1210 | - .html('There was an issue while restoring your backup.') | |
| 1211 | - ; | |
| 1250 | + // Show message. | |
| 1251 | + jQuery('#mainwp-api-backups-message-zone').addClass('red').show(); | |
| 1252 | + jQuery('#mainwp-api-backups-message-zone .content .message') | |
| 1253 | + .html('There was an issue while restoring your backup.') | |
| 1254 | + ; | |
| 1212 | 1255 | |
| 1213 | 1256 | // Stop button animation. |
| 1214 | 1257 | setInterval('location.reload()', 7000); // Using .reload() method. |
| 1215 | 1258 | |
| @@ -1217,13 +1260,13 @@ | ||
| 1217 | 1260 | }); |
| 1218 | 1261 | }; |
| 1219 | 1262 | |
| 1220 | 1263 | // Cancel Backup. |
| 1221 | -linode_action_cancel_backups = function (pObj) { | |
| 1264 | +let linode_action_cancel_backups = function (pObj) { | |
| 1222 | 1265 | |
| 1223 | - var websiteId = jQuery(pObj).attr('website_id'); | |
| 1266 | + let websiteId = jQuery(pObj).attr('website_id'); | |
| 1224 | 1267 | |
| 1225 | - var data = mainwp_secure_data({ | |
| 1268 | + let data = mainwp_secure_data({ | |
| 1226 | 1269 | action: 'linode_action_cancel_backups', |
| 1227 | 1270 | website_id: websiteId, |
| 1228 | 1271 | backup_api: 'linode' |
| 1229 | 1272 | }); |
| @@ -1235,13 +1278,13 @@ | ||
| 1235 | 1278 | response = jQuery.trim(response); |
| 1236 | 1279 | |
| 1237 | 1280 | if (response === 'true') { |
| 1238 | 1281 | |
| 1239 | - // Show message. | |
| 1240 | - jQuery('#mainwp-api-backups-message-zone').addClass('green').show(); | |
| 1241 | - jQuery('#mainwp-api-backups-message-zone .content .message') | |
| 1242 | - .html('The backups associated with this Linode have been removed.') | |
| 1243 | - ; | |
| 1282 | + // Show message. | |
| 1283 | + jQuery('#mainwp-api-backups-message-zone').addClass('green').show(); | |
| 1284 | + jQuery('#mainwp-api-backups-message-zone .content .message') | |
| 1285 | + .html('The backups associated with this Linode have been removed.') | |
| 1286 | + ; | |
| 1244 | 1287 | |
| 1245 | 1288 | // Stop button animation. |
| 1246 | 1289 | jQuery(pObj).removeClass('disabled loading'); |
| 1247 | 1290 | |
| @@ -1246,13 +1289,13 @@ | ||
| 1246 | 1289 | jQuery(pObj).removeClass('disabled loading'); |
| 1247 | 1290 | |
| 1248 | 1291 | } else { |
| 1249 | 1292 | |
| 1250 | - // Show message. | |
| 1251 | - jQuery('#mainwp-api-backups-message-zone').addClass('red').show(); | |
| 1252 | - jQuery('#mainwp-api-backups-message-zone .content .message') | |
| 1253 | - .html('There was an issue while canceling your backup.') | |
| 1254 | - ; | |
| 1293 | + // Show message. | |
| 1294 | + jQuery('#mainwp-api-backups-message-zone').addClass('red').show(); | |
| 1295 | + jQuery('#mainwp-api-backups-message-zone .content .message') | |
| 1296 | + .html('There was an issue while canceling your backup.') | |
| 1297 | + ; | |
| 1255 | 1298 | |
| 1256 | 1299 | // Stop button animation. |
| 1257 | 1300 | jQuery(pObj).removeClass('disabled loading'); |
| 1258 | 1301 | |
| @@ -1264,17 +1307,17 @@ | ||
| 1264 | 1307 | * Digital Ocean Functions. |
| 1265 | 1308 | */ |
| 1266 | 1309 | |
| 1267 | 1310 | // Assign Site ID's to Child Sites. |
| 1268 | -digitalocean_action_update_ids = function (pObj) { | |
| 1311 | +let digitalocean_action_update_ids = function (pObj) { | |
| 1269 | 1312 | jQuery(pObj).attr('disabled', 'true'); |
| 1270 | - var button = jQuery(pObj).closest('td'); | |
| 1313 | + let button = jQuery(pObj).closest('td'); | |
| 1271 | 1314 | |
| 1272 | - var data = mainwp_secure_data({ | |
| 1315 | + let data = mainwp_secure_data({ | |
| 1273 | 1316 | action: 'digitalocean_action_update_ids' |
| 1274 | 1317 | }); |
| 1275 | 1318 | |
| 1276 | - jQuery(button).html('<i class="notched circle loading icon"></i>'); | |
| 1319 | + module_api_backups_prepare_working_status(button); | |
| 1277 | 1320 | |
| 1278 | 1321 | jQuery.post(ajaxurl, data, function (response) { |
| 1279 | 1322 | response = jQuery.trim(response); |
| 1280 | 1323 | |
| @@ -1287,22 +1330,21 @@ | ||
| 1287 | 1330 | }); |
| 1288 | 1331 | }; |
| 1289 | 1332 | |
| 1290 | 1333 | // Create Backup. |
| 1291 | -digitalocean_action_create_backup = function (pObj) { | |
| 1292 | - | |
| 1334 | +let digitalocean_action_create_backup = function (pObj) { | |
| 1293 | 1335 | jQuery(pObj).attr('disabled', 'true'); |
| 1294 | - var button = jQuery(pObj).closest('td'); | |
| 1295 | - var lastBackup = jQuery(pObj).closest('td').prev(); | |
| 1296 | - var websiteId = jQuery(pObj).attr('website_id'); | |
| 1336 | + let button = jQuery(pObj).closest('td'); | |
| 1337 | + let lastBackup = jQuery(pObj).closest('td').prev(); | |
| 1338 | + let websiteId = jQuery(pObj).attr('website_id'); | |
| 1297 | 1339 | |
| 1298 | - var data = mainwp_secure_data({ | |
| 1340 | + let data = mainwp_secure_data({ | |
| 1299 | 1341 | action: 'digitalocean_action_create_backup', |
| 1300 | 1342 | website_id: websiteId, |
| 1301 | 1343 | backup_api: 'digitalocean' |
| 1302 | 1344 | }); |
| 1303 | 1345 | |
| 1304 | - jQuery(button).html('<i class="notched circle loading icon"></i>'); | |
| 1346 | + module_api_backups_prepare_working_status(button); | |
| 1305 | 1347 | |
| 1306 | 1348 | jQuery(lastBackup).html('Requesting Backup...'); |
| 1307 | 1349 | |
| 1308 | 1350 | jQuery.post(ajaxurl, data, function (response) { |
| @@ -1309,27 +1351,27 @@ | ||
| 1309 | 1351 | response = jQuery.trim(response); |
| 1310 | 1352 | |
| 1311 | 1353 | if (response === 'true') { |
| 1312 | 1354 | |
| 1313 | - // Show message. | |
| 1314 | - jQuery('#mainwp-api-backups-message-zone').addClass('green').show(); | |
| 1315 | - jQuery('#mainwp-api-backups-message-zone .content .message') | |
| 1316 | - .html('A backup has been requested.') | |
| 1317 | - ; | |
| 1355 | + // Show message. | |
| 1356 | + jQuery('#mainwp-api-backups-message-zone').addClass('green').show(); | |
| 1357 | + jQuery('#mainwp-api-backups-message-zone .content .message') | |
| 1358 | + .html('A backup has been requested.') | |
| 1359 | + ; | |
| 1318 | 1360 | |
| 1319 | 1361 | setTimeout(function () { |
| 1320 | - location.reload(); | |
| 1362 | + mainwp_forceReload(); | |
| 1321 | 1363 | }, 5000); |
| 1322 | 1364 | } else { |
| 1323 | 1365 | |
| 1324 | - // Show message. | |
| 1325 | - jQuery('#mainwp-api-backups-message-zone').addClass('red').show(); | |
| 1326 | - jQuery('#mainwp-api-backups-message-zone .content .message') | |
| 1327 | - .html('There was an issue while requesting your backup. Please check that your ID and API Key are correct.') | |
| 1328 | - ; | |
| 1366 | + // Show message. | |
| 1367 | + jQuery('#mainwp-api-backups-message-zone').addClass('red').show(); | |
| 1368 | + jQuery('#mainwp-api-backups-message-zone .content .message') | |
| 1369 | + .html('There was an issue while requesting your backup. Please check that your ID and API Key are correct.') | |
| 1370 | + ; | |
| 1329 | 1371 | |
| 1330 | 1372 | setTimeout(function () { |
| 1331 | - location.reload(); | |
| 1373 | + mainwp_forceReload(); | |
| 1332 | 1374 | }, 5000); |
| 1333 | 1375 | } |
| 1334 | 1376 | }); |
| 1335 | 1377 | }; |
| @@ -1334,13 +1376,13 @@ | ||
| 1334 | 1376 | }); |
| 1335 | 1377 | }; |
| 1336 | 1378 | |
| 1337 | 1379 | // Refresh Available Backups. |
| 1338 | -digitalocean_action_refresh_available_backups = function (pObj) { | |
| 1380 | +let digitalocean_action_refresh_available_backups = function (pObj) { | |
| 1339 | 1381 | |
| 1340 | - var websiteId = jQuery(pObj).attr('website_id'); | |
| 1382 | + let websiteId = jQuery(pObj).attr('website_id'); | |
| 1341 | 1383 | |
| 1342 | - var data = mainwp_secure_data({ | |
| 1384 | + let data = mainwp_secure_data({ | |
| 1343 | 1385 | action: 'digitalocean_action_refresh_available_backups', |
| 1344 | 1386 | website_id: websiteId, |
| 1345 | 1387 | backup_api: 'digitalocean' |
| 1346 | 1388 | }); |
| @@ -1352,13 +1394,13 @@ | ||
| 1352 | 1394 | response = jQuery.trim(response); |
| 1353 | 1395 | |
| 1354 | 1396 | if (response === 'true') { |
| 1355 | 1397 | |
| 1356 | - // Show message. | |
| 1357 | - jQuery('#mainwp-api-backups-message-zone').addClass('green').show(); | |
| 1358 | - jQuery('#mainwp-api-backups-message-zone .content .message') | |
| 1359 | - .html('Available backups have been refreshed.') | |
| 1360 | - ; | |
| 1398 | + // Show message. | |
| 1399 | + jQuery('#mainwp-api-backups-message-zone').addClass('green').show(); | |
| 1400 | + jQuery('#mainwp-api-backups-message-zone .content .message') | |
| 1401 | + .html('Available backups have been refreshed.') | |
| 1402 | + ; | |
| 1361 | 1403 | |
| 1362 | 1404 | // Stop button animation. |
| 1363 | 1405 | jQuery(pObj).removeClass('disabled loading'); |
| 1364 | 1406 | |
| @@ -1365,13 +1407,13 @@ | ||
| 1365 | 1407 | setInterval('location.reload()', 7000);// Using .reload() method. |
| 1366 | 1408 | |
| 1367 | 1409 | } else { |
| 1368 | 1410 | |
| 1369 | - // Show message. | |
| 1370 | - jQuery('#mainwp-api-backups-message-zone').addClass('red').show(); | |
| 1371 | - jQuery('#mainwp-api-backups-message-zone .content .message') | |
| 1372 | - .html('There was an issue while refreshing available backups.') | |
| 1373 | - ; | |
| 1411 | + // Show message. | |
| 1412 | + jQuery('#mainwp-api-backups-message-zone').addClass('red').show(); | |
| 1413 | + jQuery('#mainwp-api-backups-message-zone .content .message') | |
| 1414 | + .html('There was an issue while refreshing available backups.') | |
| 1415 | + ; | |
| 1374 | 1416 | |
| 1375 | 1417 | // Stop button animation. |
| 1376 | 1418 | jQuery(pObj).removeClass('disabled loading'); |
| 1377 | 1419 | |
| @@ -1379,16 +1421,16 @@ | ||
| 1379 | 1421 | }); |
| 1380 | 1422 | }; |
| 1381 | 1423 | |
| 1382 | 1424 | // restore Backup. |
| 1383 | -digitalocean_action_restore_backup = function (pObj) { | |
| 1425 | +let digitalocean_action_restore_backup = function (pObj) { | |
| 1384 | 1426 | |
| 1385 | - var button = jQuery(pObj); | |
| 1386 | - var lastBackup = jQuery(pObj).closest('td').prev(); | |
| 1387 | - var websiteId = jQuery(pObj).attr('website_id'); | |
| 1388 | - var snapshotId = jQuery(pObj).attr('snapshot_id'); | |
| 1427 | + let button = jQuery(pObj); | |
| 1428 | + let lastBackup = jQuery(pObj).closest('td').prev(); | |
| 1429 | + let websiteId = jQuery(pObj).attr('website_id'); | |
| 1430 | + let snapshotId = jQuery(pObj).attr('snapshot_id'); | |
| 1389 | 1431 | |
| 1390 | - var data = mainwp_secure_data({ | |
| 1432 | + let data = mainwp_secure_data({ | |
| 1391 | 1433 | action: 'digitalocean_action_restore_backup', |
| 1392 | 1434 | website_id: websiteId, |
| 1393 | 1435 | backup_api: 'digitalocean', |
| 1394 | 1436 | snapshot_id: snapshotId |
| @@ -1394,9 +1436,9 @@ | ||
| 1394 | 1436 | snapshot_id: snapshotId |
| 1395 | 1437 | }); |
| 1396 | 1438 | |
| 1397 | 1439 | // Start button animation. |
| 1398 | - jQuery(button).html('<i class="notched circle loading icon"></i>'); | |
| 1440 | + module_api_backups_prepare_working_status(button); | |
| 1399 | 1441 | |
| 1400 | 1442 | jQuery.post(ajaxurl, data, function (response) { |
| 1401 | 1443 | response = jQuery.trim(response); |
| 1402 | 1444 | |
| @@ -1403,13 +1445,13 @@ | ||
| 1403 | 1445 | jQuery(lastBackup).html(''); |
| 1404 | 1446 | |
| 1405 | 1447 | if (response === 'true') { |
| 1406 | 1448 | |
| 1407 | - // Show message. | |
| 1408 | - jQuery('#mainwp-api-backups-message-zone').addClass('green').show(); | |
| 1409 | - jQuery('#mainwp-api-backups-message-zone .content .message') | |
| 1410 | - .html('Backup restoration has begun. Please wait a few moments and then check the site.') | |
| 1411 | - ; | |
| 1449 | + // Show message. | |
| 1450 | + jQuery('#mainwp-api-backups-message-zone').addClass('green').show(); | |
| 1451 | + jQuery('#mainwp-api-backups-message-zone .content .message') | |
| 1452 | + .html('Backup restoration has begun. Please wait a few moments and then check the site.') | |
| 1453 | + ; | |
| 1412 | 1454 | |
| 1413 | 1455 | // Stop button animation. |
| 1414 | 1456 | jQuery(button).html('<i class="undo icon"></i>'); |
| 1415 | 1457 | |
| @@ -1414,13 +1456,13 @@ | ||
| 1414 | 1456 | jQuery(button).html('<i class="undo icon"></i>'); |
| 1415 | 1457 | |
| 1416 | 1458 | } else { |
| 1417 | 1459 | |
| 1418 | - // Show message. | |
| 1419 | - jQuery('#mainwp-api-backups-message-zone').addClass('red').show(); | |
| 1420 | - jQuery('#mainwp-api-backups-message-zone .content .message') | |
| 1421 | - .html('There was an issue while restoring your backup.') | |
| 1422 | - ; | |
| 1460 | + // Show message. | |
| 1461 | + jQuery('#mainwp-api-backups-message-zone').addClass('red').show(); | |
| 1462 | + jQuery('#mainwp-api-backups-message-zone .content .message') | |
| 1463 | + .html('There was an issue while restoring your backup.') | |
| 1464 | + ; | |
| 1423 | 1465 | |
| 1424 | 1466 | // Stop button animation. |
| 1425 | 1467 | jQuery(button).html('<i class="undo icon"></i>'); |
| 1426 | 1468 | } |
| @@ -1428,21 +1470,21 @@ | ||
| 1428 | 1470 | }); |
| 1429 | 1471 | }; |
| 1430 | 1472 | |
| 1431 | 1473 | // Delete Backup. |
| 1432 | -digitalocean_action_delete_backup = function (pObj) { | |
| 1474 | +let digitalocean_action_delete_backup = function (pObj) { | |
| 1433 | 1475 | |
| 1434 | - var button = jQuery(pObj); | |
| 1476 | + let button = jQuery(pObj); | |
| 1435 | 1477 | |
| 1436 | - var snapshotId = jQuery(pObj).attr('snapshot_id'); | |
| 1478 | + let snapshotId = jQuery(pObj).attr('snapshot_id'); | |
| 1437 | 1479 | |
| 1438 | - var data = mainwp_secure_data({ | |
| 1480 | + let data = mainwp_secure_data({ | |
| 1439 | 1481 | action: 'digitalocean_action_delete_backup', |
| 1440 | 1482 | snapshot_id: snapshotId |
| 1441 | 1483 | }); |
| 1442 | 1484 | |
| 1443 | 1485 | // Start button animation. |
| 1444 | - jQuery(button).html('<i class="notched circle loading icon"></i>'); | |
| 1486 | + module_api_backups_prepare_working_status(button); | |
| 1445 | 1487 | |
| 1446 | 1488 | jQuery.post(ajaxurl, data, function (response) { |
| 1447 | 1489 | response = jQuery.trim(response); |
| 1448 | 1490 | |
| @@ -1447,13 +1489,13 @@ | ||
| 1447 | 1489 | response = jQuery.trim(response); |
| 1448 | 1490 | |
| 1449 | 1491 | if (response === 'true') { |
| 1450 | 1492 | |
| 1451 | - // Show message. | |
| 1452 | - jQuery('#mainwp-api-backups-message-zone').addClass('green').show(); | |
| 1453 | - jQuery('#mainwp-api-backups-message-zone .content .message') | |
| 1454 | - .html('The selected backup has been deleted.') | |
| 1455 | - ; | |
| 1493 | + // Show message. | |
| 1494 | + jQuery('#mainwp-api-backups-message-zone').addClass('green').show(); | |
| 1495 | + jQuery('#mainwp-api-backups-message-zone .content .message') | |
| 1496 | + .html('The selected backup has been deleted.') | |
| 1497 | + ; | |
| 1456 | 1498 | |
| 1457 | 1499 | // Stop button animation. |
| 1458 | 1500 | jQuery(button).html('<i class="trash icon"></i>'); |
| 1459 | 1501 | |
| @@ -1458,13 +1500,13 @@ | ||
| 1458 | 1500 | jQuery(button).html('<i class="trash icon"></i>'); |
| 1459 | 1501 | |
| 1460 | 1502 | } else { |
| 1461 | 1503 | |
| 1462 | - // Show message. | |
| 1463 | - jQuery('#mainwp-api-backups-message-zone').addClass('red').show(); | |
| 1464 | - jQuery('#mainwp-api-backups-message-zone .content .message') | |
| 1465 | - .html('There was an issue while deleting the selected backup.') | |
| 1466 | - ; | |
| 1504 | + // Show message. | |
| 1505 | + jQuery('#mainwp-api-backups-message-zone').addClass('red').show(); | |
| 1506 | + jQuery('#mainwp-api-backups-message-zone .content .message') | |
| 1507 | + .html('There was an issue while deleting the selected backup.') | |
| 1508 | + ; | |
| 1467 | 1509 | |
| 1468 | 1510 | // Stop button animation. |
| 1469 | 1511 | jQuery(button).html('<i class="trash icon"></i>'); |
| 1470 | 1512 | |
| @@ -1475,17 +1517,17 @@ | ||
| 1475 | 1517 | /******************************************************** |
| 1476 | 1518 | * Cpanel Functions. |
| 1477 | 1519 | */ |
| 1478 | 1520 | |
| 1479 | -cpanel_action_create_wptk_backup = function (pObj) { | |
| 1521 | +let cpanel_action_create_wptk_backup = function (pObj) { | |
| 1480 | 1522 | |
| 1481 | - var websiteId = jQuery(pObj).attr('website_id'); | |
| 1523 | + let websiteId = jQuery(pObj).attr('website_id'); | |
| 1482 | 1524 | |
| 1483 | - var data = mainwp_secure_data({ | |
| 1525 | + let data = mainwp_secure_data({ | |
| 1484 | 1526 | action: 'cpanel_action_create_wptk_backup', |
| 1485 | 1527 | website_id: websiteId, |
| 1486 | 1528 | backup_api: 'cpanel', |
| 1487 | - backup: 'true' | |
| 1529 | + backup: 'true' | |
| 1488 | 1530 | }); |
| 1489 | 1531 | |
| 1490 | 1532 | // Start button animation. |
| 1491 | 1533 | jQuery(pObj).addClass('disabled loading'); |
| @@ -1494,12 +1536,12 @@ | ||
| 1494 | 1536 | response = jQuery.trim(response); |
| 1495 | 1537 | |
| 1496 | 1538 | if (response === 'true') { |
| 1497 | 1539 | |
| 1498 | - // Show message. | |
| 1499 | - jQuery('#mainwp-api-backups-message-zone').addClass('green').show(); | |
| 1500 | - jQuery('#mainwp-api-backups-message-zone .content .message') | |
| 1501 | - .html( 'A backup has been requested. Please allow some time for the backup to complete, then Refresh Available Backups.'); | |
| 1540 | + // Show message. | |
| 1541 | + jQuery('#mainwp-api-backups-message-zone').addClass('green').show(); | |
| 1542 | + jQuery('#mainwp-api-backups-message-zone .content .message') | |
| 1543 | + .html( 'A backup has been requested. Please allow some time for the backup to complete, then Refresh Available Backups.'); | |
| 1502 | 1544 | |
| 1503 | 1545 | // Stop button animation. |
| 1504 | 1546 | jQuery(pObj).removeClass('disabled loading'); |
| 1505 | 1547 | |
| @@ -1504,13 +1546,13 @@ | ||
| 1504 | 1546 | jQuery(pObj).removeClass('disabled loading'); |
| 1505 | 1547 | |
| 1506 | 1548 | } else { |
| 1507 | 1549 | |
| 1508 | - // Show message. | |
| 1509 | - jQuery('#mainwp-api-backups-message-zone').addClass('red').show(); | |
| 1510 | - jQuery('#mainwp-api-backups-message-zone .content .message') | |
| 1511 | - .html( response ) | |
| 1512 | - ; | |
| 1550 | + // Show message. | |
| 1551 | + jQuery('#mainwp-api-backups-message-zone').addClass('red').show(); | |
| 1552 | + jQuery('#mainwp-api-backups-message-zone .content .message') | |
| 1553 | + .html( response ) | |
| 1554 | + ; | |
| 1513 | 1555 | |
| 1514 | 1556 | // Stop button animation. |
| 1515 | 1557 | jQuery(pObj).removeClass('disabled loading'); |
| 1516 | 1558 | |
| @@ -1519,17 +1561,17 @@ | ||
| 1519 | 1561 | }; |
| 1520 | 1562 | |
| 1521 | 1563 | // restore Backup. |
| 1522 | 1564 | |
| 1523 | -cpanel_action_restore_wptk_backup = function (pObj) { | |
| 1565 | +let cpanel_action_restore_wptk_backup = function (pObj) { | |
| 1524 | 1566 | |
| 1525 | 1567 | // Disable link. |
| 1526 | 1568 | jQuery(pObj).attr('disabled', 'true'); |
| 1527 | 1569 | |
| 1528 | - var backupName = jQuery('.mainwp_3rd_party_api_cpanel_action_restore_wptk_backup').attr('backup_name'); | |
| 1529 | - var websiteId = jQuery('.mainwp_3rd_party_api_cpanel_action_restore_wptk_backup').attr('website_id'); | |
| 1570 | + let backupName = jQuery('.mainwp_3rd_party_api_cpanel_action_restore_wptk_backup').attr('backup_name'); | |
| 1571 | + let websiteId = jQuery('.mainwp_3rd_party_api_cpanel_action_restore_wptk_backup').attr('website_id'); | |
| 1530 | 1572 | |
| 1531 | - var data = mainwp_secure_data({ | |
| 1573 | + let data = mainwp_secure_data({ | |
| 1532 | 1574 | action: 'cpanel_action_restore_wptk_backup', |
| 1533 | 1575 | website_id: websiteId, |
| 1534 | 1576 | backup_api: 'cpanel', |
| 1535 | 1577 | backup_name: backupName, |
| @@ -1542,13 +1584,13 @@ | ||
| 1542 | 1584 | response = jQuery.trim(response); |
| 1543 | 1585 | |
| 1544 | 1586 | if (response === 'true') { |
| 1545 | 1587 | |
| 1546 | - // Show message. | |
| 1547 | - jQuery('#mainwp-api-backups-message-zone').addClass('green').show(); | |
| 1548 | - jQuery('#mainwp-api-backups-message-zone .content .message') | |
| 1549 | - .html('The backup restoration process has finished. Please wait a few moments and then check the site.') | |
| 1550 | - ; | |
| 1588 | + // Show message. | |
| 1589 | + jQuery('#mainwp-api-backups-message-zone').addClass('green').show(); | |
| 1590 | + jQuery('#mainwp-api-backups-message-zone .content .message') | |
| 1591 | + .html('The backup restoration process has finished. Please wait a few moments and then check the site.') | |
| 1592 | + ; | |
| 1551 | 1593 | |
| 1552 | 1594 | // Stop button animation. ( Using class so ALL buttons are animated not just the one clicked ). |
| 1553 | 1595 | jQuery('.mainwp_3rd_party_api_cpanel_action_restore_wptk_backup').removeClass('disabled loading'); |
| 1554 | 1596 | |
| @@ -1553,13 +1595,13 @@ | ||
| 1553 | 1595 | jQuery('.mainwp_3rd_party_api_cpanel_action_restore_wptk_backup').removeClass('disabled loading'); |
| 1554 | 1596 | |
| 1555 | 1597 | } else { |
| 1556 | 1598 | |
| 1557 | - // Show message. | |
| 1558 | - jQuery('#mainwp-api-backups-message-zone').addClass('red').show(); | |
| 1559 | - jQuery('#mainwp-api-backups-message-zone .content .message') | |
| 1560 | - .html('There was an issue while restoring your backup.') | |
| 1561 | - ; | |
| 1599 | + // Show message. | |
| 1600 | + jQuery('#mainwp-api-backups-message-zone').addClass('red').show(); | |
| 1601 | + jQuery('#mainwp-api-backups-message-zone .content .message') | |
| 1602 | + .html('There was an issue while restoring your backup.') | |
| 1603 | + ; | |
| 1562 | 1604 | |
| 1563 | 1605 | // Stop button animation. ( Using class so ALL buttons are animated not just the one clicked ). |
| 1564 | 1606 | jQuery('.mainwp_3rd_party_api_cpanel_action_restore_wptk_backup').removeClass('disabled loading'); |
| 1565 | 1607 | |
| @@ -1567,17 +1609,17 @@ | ||
| 1567 | 1609 | }); |
| 1568 | 1610 | }; |
| 1569 | 1611 | |
| 1570 | 1612 | // Delete Backup. |
| 1571 | -cpanel_action_delete_wptk_backup = function (pObj) { | |
| 1613 | +let cpanel_action_delete_wptk_backup = function (pObj) { | |
| 1572 | 1614 | |
| 1573 | 1615 | // Disable link. |
| 1574 | 1616 | jQuery(pObj).attr('disabled', 'true'); |
| 1575 | 1617 | |
| 1576 | - var backupName = jQuery('.mainwp_3rd_party_api_cpanel_action_delete_wptk_backup').attr('backup_name'); | |
| 1577 | - var websiteId = jQuery('.mainwp_3rd_party_api_cpanel_action_delete_wptk_backup').attr('website_id'); | |
| 1618 | + let backupName = jQuery('.mainwp_3rd_party_api_cpanel_action_delete_wptk_backup').attr('backup_name'); | |
| 1619 | + let websiteId = jQuery('.mainwp_3rd_party_api_cpanel_action_delete_wptk_backup').attr('website_id'); | |
| 1578 | 1620 | |
| 1579 | - var data = mainwp_secure_data({ | |
| 1621 | + let data = mainwp_secure_data({ | |
| 1580 | 1622 | action: 'cpanel_action_delete_wptk_backup', |
| 1581 | 1623 | website_id: websiteId, |
| 1582 | 1624 | backup_api: 'cpanel', |
| 1583 | 1625 | backup_name: backupName, |
| @@ -1590,13 +1632,13 @@ | ||
| 1590 | 1632 | response = jQuery.trim(response); |
| 1591 | 1633 | |
| 1592 | 1634 | if (response === 'true') { |
| 1593 | 1635 | |
| 1594 | - // Show message. | |
| 1595 | - jQuery('#mainwp-api-backups-message-zone').addClass('green').show(); | |
| 1596 | - jQuery('#mainwp-api-backups-message-zone .content .message') | |
| 1597 | - .html('The selected backup has been deleted.') | |
| 1598 | - ; | |
| 1636 | + // Show message. | |
| 1637 | + jQuery('#mainwp-api-backups-message-zone').addClass('green').show(); | |
| 1638 | + jQuery('#mainwp-api-backups-message-zone .content .message') | |
| 1639 | + .html('The selected backup has been deleted.') | |
| 1640 | + ; | |
| 1599 | 1641 | |
| 1600 | 1642 | // Stop button animation. ( Using class so ALL buttons are animated not just the one clicked ). |
| 1601 | 1643 | jQuery('.mainwp_3rd_party_api_cpanel_action_delete_wptk_backup').removeClass('disabled loading'); |
| 1602 | 1644 | |
| @@ -1601,13 +1643,13 @@ | ||
| 1601 | 1643 | jQuery('.mainwp_3rd_party_api_cpanel_action_delete_wptk_backup').removeClass('disabled loading'); |
| 1602 | 1644 | |
| 1603 | 1645 | } else { |
| 1604 | 1646 | |
| 1605 | - // Show message. | |
| 1606 | - jQuery('#mainwp-api-backups-message-zone').addClass('red').show(); | |
| 1607 | - jQuery('#mainwp-api-backups-message-zone .content .message') | |
| 1608 | - .html('There was an issue while deleting your backup.') | |
| 1609 | - ; | |
| 1647 | + // Show message. | |
| 1648 | + jQuery('#mainwp-api-backups-message-zone').addClass('red').show(); | |
| 1649 | + jQuery('#mainwp-api-backups-message-zone .content .message') | |
| 1650 | + .html('There was an issue while deleting your backup.') | |
| 1651 | + ; | |
| 1610 | 1652 | |
| 1611 | 1653 | // Stop button animation. ( Using class so ALL buttons are animated not just the one clicked ). |
| 1612 | 1654 | jQuery('.mainwp_3rd_party_api_cpanel_action_delete_wptk_backup').removeClass('disabled loading'); |
| 1613 | 1655 | |
| @@ -1615,20 +1657,20 @@ | ||
| 1615 | 1657 | }); |
| 1616 | 1658 | }; |
| 1617 | 1659 | |
| 1618 | 1660 | // Download Backup. |
| 1619 | -cpanel_action_download_wptk_backup = function () { | |
| 1661 | +let cpanel_action_download_wptk_backup = function () { | |
| 1620 | 1662 | |
| 1621 | - var href = jQuery('.mainwp_3rd_party_api_cpanel_action_download_wptk_backup').attr('href'); | |
| 1663 | + let href = jQuery('.mainwp_3rd_party_api_cpanel_action_download_wptk_backup').attr('href'); | |
| 1622 | 1664 | window.open(href, '_blank'); |
| 1623 | 1665 | |
| 1624 | 1666 | }; |
| 1625 | 1667 | |
| 1626 | -cpanel_action_create_backup = function (pObj) { | |
| 1668 | +let cpanel_action_create_backup = function (pObj) { | |
| 1627 | 1669 | |
| 1628 | - var websiteId = jQuery(pObj).attr('website_id'); | |
| 1670 | + let websiteId = jQuery(pObj).attr('website_id'); | |
| 1629 | 1671 | |
| 1630 | - var data = mainwp_secure_data({ | |
| 1672 | + let data = mainwp_secure_data({ | |
| 1631 | 1673 | action: 'cpanel_action_create_manual_backup', |
| 1632 | 1674 | website_id: websiteId, |
| 1633 | 1675 | backup_api: 'cpanel' |
| 1634 | 1676 | }); |
| @@ -1640,13 +1682,13 @@ | ||
| 1640 | 1682 | response = jQuery.trim(response); |
| 1641 | 1683 | |
| 1642 | 1684 | if (response === 'true') { |
| 1643 | 1685 | |
| 1644 | - // Show message. | |
| 1645 | - jQuery('#mainwp-api-backups-message-zone').addClass('green').show(); | |
| 1646 | - jQuery('#mainwp-api-backups-message-zone .content .message') | |
| 1647 | - .html('A backup has been requested.') | |
| 1648 | - ; | |
| 1686 | + // Show message. | |
| 1687 | + jQuery('#mainwp-api-backups-message-zone').addClass('green').show(); | |
| 1688 | + jQuery('#mainwp-api-backups-message-zone .content .message') | |
| 1689 | + .html('A backup has been requested.') | |
| 1690 | + ; | |
| 1649 | 1691 | |
| 1650 | 1692 | // Stop button animation. |
| 1651 | 1693 | jQuery(pObj).removeClass('disabled loading'); |
| 1652 | 1694 | |
| @@ -1651,13 +1693,13 @@ | ||
| 1651 | 1693 | jQuery(pObj).removeClass('disabled loading'); |
| 1652 | 1694 | |
| 1653 | 1695 | } else { |
| 1654 | 1696 | |
| 1655 | - // Show message. | |
| 1656 | - jQuery('#mainwp-api-backups-message-zone').addClass('red').show(); | |
| 1657 | - jQuery('#mainwp-api-backups-message-zone .content .message') | |
| 1658 | - .html( response ) | |
| 1659 | - ; | |
| 1697 | + // Show message. | |
| 1698 | + jQuery('#mainwp-api-backups-message-zone').addClass('red').show(); | |
| 1699 | + jQuery('#mainwp-api-backups-message-zone .content .message') | |
| 1700 | + .html( response ) | |
| 1701 | + ; | |
| 1660 | 1702 | |
| 1661 | 1703 | // Stop button animation. |
| 1662 | 1704 | jQuery(pObj).removeClass('disabled loading'); |
| 1663 | 1705 | |
| @@ -1665,13 +1707,13 @@ | ||
| 1665 | 1707 | }); |
| 1666 | 1708 | }; |
| 1667 | 1709 | |
| 1668 | 1710 | // Refresh Available Backups. |
| 1669 | -cpanel_action_refresh_available_backups = function (pObj) { | |
| 1711 | +let cpanel_action_refresh_available_backups = function (pObj) { | |
| 1670 | 1712 | |
| 1671 | - var websiteId = jQuery(pObj).attr('website_id'); | |
| 1713 | + let websiteId = jQuery(pObj).attr('website_id'); | |
| 1672 | 1714 | |
| 1673 | - var data = mainwp_secure_data({ | |
| 1715 | + let data = mainwp_secure_data({ | |
| 1674 | 1716 | action: 'cpanel_action_refresh_available_backups', |
| 1675 | 1717 | website_id: websiteId, |
| 1676 | 1718 | backup_api: 'cPanel' |
| 1677 | 1719 | }); |
| @@ -1683,13 +1725,13 @@ | ||
| 1683 | 1725 | response = jQuery.trim(response); |
| 1684 | 1726 | |
| 1685 | 1727 | if (response === 'true') { |
| 1686 | 1728 | |
| 1687 | - // Show message. | |
| 1688 | - jQuery('#mainwp-api-backups-message-zone').addClass('green').show(); | |
| 1689 | - jQuery('#mainwp-api-backups-message-zone .content .message') | |
| 1690 | - .html('Available backups have been refreshed.') | |
| 1691 | - ; | |
| 1729 | + // Show message. | |
| 1730 | + jQuery('#mainwp-api-backups-message-zone').addClass('green').show(); | |
| 1731 | + jQuery('#mainwp-api-backups-message-zone .content .message') | |
| 1732 | + .html('Available backups have been refreshed.') | |
| 1733 | + ; | |
| 1692 | 1734 | |
| 1693 | 1735 | // Stop button animation. |
| 1694 | 1736 | jQuery(pObj).removeClass('disabled loading'); |
| 1695 | 1737 | |
| @@ -1696,13 +1738,13 @@ | ||
| 1696 | 1738 | setInterval('location.reload()', 7000); // Using .reload() method. |
| 1697 | 1739 | |
| 1698 | 1740 | } else { |
| 1699 | 1741 | |
| 1700 | - // Show message. | |
| 1701 | - jQuery('#mainwp-api-backups-message-zone').addClass('red').show(); | |
| 1702 | - jQuery('#mainwp-api-backups-message-zone .content .message') | |
| 1703 | - .html('There was an issue while refreshing available backups.') | |
| 1704 | - ; | |
| 1742 | + // Show message. | |
| 1743 | + jQuery('#mainwp-api-backups-message-zone').addClass('red').show(); | |
| 1744 | + jQuery('#mainwp-api-backups-message-zone .content .message') | |
| 1745 | + .html('There was an issue while refreshing available backups.') | |
| 1746 | + ; | |
| 1705 | 1747 | |
| 1706 | 1748 | // Stop button animation. |
| 1707 | 1749 | jQuery(pObj).removeClass('disabled loading'); |
| 1708 | 1750 | |
| @@ -1710,18 +1752,18 @@ | ||
| 1710 | 1752 | }); |
| 1711 | 1753 | }; |
| 1712 | 1754 | |
| 1713 | 1755 | // restore Backup. |
| 1714 | -cPanel_action_restore_backup = function (pObj) { | |
| 1756 | +let cPanel_action_restore_backup = function (pObj) { | |
| 1715 | 1757 | |
| 1716 | 1758 | // Disable link. |
| 1717 | 1759 | jQuery(pObj).attr('disabled', 'true'); |
| 1718 | 1760 | |
| 1719 | - var websiteId = jQuery('#cpanel_automatic_backup_button').attr('website_id'); | |
| 1720 | - var backupID = jQuery('#cpanel_automatic_backup_button').attr('backup_name'); | |
| 1721 | - var backupPath = jQuery('#cpanel_automatic_backup_button').attr('backup_path'); | |
| 1761 | + let websiteId = jQuery('#cpanel_automatic_backup_button').attr('website_id'); | |
| 1762 | + let backupID = jQuery('#cpanel_automatic_backup_button').attr('backup_name'); | |
| 1763 | + let backupPath = jQuery('#cpanel_automatic_backup_button').attr('backup_path'); | |
| 1722 | 1764 | |
| 1723 | - var data = mainwp_secure_data({ | |
| 1765 | + let data = mainwp_secure_data({ | |
| 1724 | 1766 | action: 'cpanel_action_restore_backup', |
| 1725 | 1767 | website_id: websiteId, |
| 1726 | 1768 | backup_api: 'cpanel', |
| 1727 | 1769 | backup_id: backupID, |
| @@ -1735,13 +1777,13 @@ | ||
| 1735 | 1777 | response = jQuery.trim(response); |
| 1736 | 1778 | |
| 1737 | 1779 | if (response === 'true') { |
| 1738 | 1780 | |
| 1739 | - // Show message. | |
| 1740 | - jQuery('#mainwp-api-backups-message-zone').addClass('green').show(); | |
| 1741 | - jQuery('#mainwp-api-backups-message-zone .content .message') | |
| 1742 | - .html('The backup restoration process has finished. Please wait a few moments and then check the site.') | |
| 1743 | - ; | |
| 1781 | + // Show message. | |
| 1782 | + jQuery('#mainwp-api-backups-message-zone').addClass('green').show(); | |
| 1783 | + jQuery('#mainwp-api-backups-message-zone .content .message') | |
| 1784 | + .html('The backup restoration process has finished. Please wait a few moments and then check the site.') | |
| 1785 | + ; | |
| 1744 | 1786 | |
| 1745 | 1787 | // Stop button animation. ( Using class so ALL buttons are animated not just the one clicked ). |
| 1746 | 1788 | jQuery('.mainwp_3rd_party_api_cpanel_action_restore_backup button').removeClass('disabled loading'); |
| 1747 | 1789 | |
| @@ -1746,13 +1788,13 @@ | ||
| 1746 | 1788 | jQuery('.mainwp_3rd_party_api_cpanel_action_restore_backup button').removeClass('disabled loading'); |
| 1747 | 1789 | |
| 1748 | 1790 | } else { |
| 1749 | 1791 | |
| 1750 | - // Show message. | |
| 1751 | - jQuery('#mainwp-api-backups-message-zone').addClass('red').show(); | |
| 1752 | - jQuery('#mainwp-api-backups-message-zone .content .message') | |
| 1753 | - .html('There was an issue while restoring your backup.') | |
| 1754 | - ; | |
| 1792 | + // Show message. | |
| 1793 | + jQuery('#mainwp-api-backups-message-zone').addClass('red').show(); | |
| 1794 | + jQuery('#mainwp-api-backups-message-zone .content .message') | |
| 1795 | + .html('There was an issue while restoring your backup.') | |
| 1796 | + ; | |
| 1755 | 1797 | |
| 1756 | 1798 | // Stop button animation. ( Using class so ALL buttons are animated not just the one clicked ). |
| 1757 | 1799 | jQuery('.mainwp_3rd_party_api_cpanel_action_restore_backup button').removeClass('disabled loading'); |
| 1758 | 1800 | |
| @@ -1760,15 +1802,15 @@ | ||
| 1760 | 1802 | }); |
| 1761 | 1803 | }; |
| 1762 | 1804 | |
| 1763 | 1805 | // restore Backup. |
| 1764 | -cpanel_action_restore_database_backup = function (btObj) { | |
| 1806 | +let cpanel_action_restore_database_backup = function (btObj) { | |
| 1765 | 1807 | |
| 1766 | - var websiteId = jQuery(btObj).attr('website_id'); | |
| 1767 | - var backupID = jQuery(btObj).attr('backup_name'); | |
| 1768 | - var backupPath = jQuery(btObj).attr('backup_path'); | |
| 1808 | + let websiteId = jQuery(btObj).attr('website_id'); | |
| 1809 | + let backupID = jQuery(btObj).attr('backup_name'); | |
| 1810 | + let backupPath = jQuery(btObj).attr('backup_path'); | |
| 1769 | 1811 | |
| 1770 | - var data = mainwp_secure_data({ | |
| 1812 | + let data = mainwp_secure_data({ | |
| 1771 | 1813 | action: 'cpanel_action_restore_database_backup', |
| 1772 | 1814 | website_id: websiteId, |
| 1773 | 1815 | backup_api: 'cpanel', |
| 1774 | 1816 | backup_id: backupID, |
| @@ -1782,13 +1824,13 @@ | ||
| 1782 | 1824 | response = jQuery.trim(response); |
| 1783 | 1825 | |
| 1784 | 1826 | if (response === 'true') { |
| 1785 | 1827 | |
| 1786 | - // Show message. | |
| 1787 | - jQuery('#mainwp-api-backups-message-zone').addClass('green').show(); | |
| 1788 | - jQuery('#mainwp-api-backups-message-zone .content .message') | |
| 1789 | - .html('The backup restoration process has finished. Please wait a few moments and then check the site.') | |
| 1790 | - ; | |
| 1828 | + // Show message. | |
| 1829 | + jQuery('#mainwp-api-backups-message-zone').addClass('green').show(); | |
| 1830 | + jQuery('#mainwp-api-backups-message-zone .content .message') | |
| 1831 | + .html('The backup restoration process has finished. Please wait a few moments and then check the site.') | |
| 1832 | + ; | |
| 1791 | 1833 | |
| 1792 | 1834 | // Stop button animation. ( Using class so ALL buttons are animated not just the one clicked ). |
| 1793 | 1835 | jQuery('.mainwp_3rd_party_api_cpanel_action_restore_database_backup button').removeClass('disabled loading'); |
| 1794 | 1836 | |
| @@ -1793,13 +1835,13 @@ | ||
| 1793 | 1835 | jQuery('.mainwp_3rd_party_api_cpanel_action_restore_database_backup button').removeClass('disabled loading'); |
| 1794 | 1836 | |
| 1795 | 1837 | } else { |
| 1796 | 1838 | |
| 1797 | - // Show message. | |
| 1798 | - jQuery('#mainwp-api-backups-message-zone').addClass('red').show(); | |
| 1799 | - jQuery('#mainwp-api-backups-message-zone .content .message') | |
| 1800 | - .html('There was an issue while restoring your backup.') | |
| 1801 | - ; | |
| 1839 | + // Show message. | |
| 1840 | + jQuery('#mainwp-api-backups-message-zone').addClass('red').show(); | |
| 1841 | + jQuery('#mainwp-api-backups-message-zone .content .message') | |
| 1842 | + .html('There was an issue while restoring your backup.') | |
| 1843 | + ; | |
| 1802 | 1844 | |
| 1803 | 1845 | // Stop button animation. ( Using class so ALL buttons are animated not just the one clicked ). |
| 1804 | 1846 | jQuery('.mainwp_3rd_party_api_cpanel_action_restore_database_backup button').removeClass('disabled loading'); |
| 1805 | 1847 | |
| @@ -1807,15 +1849,15 @@ | ||
| 1807 | 1849 | }); |
| 1808 | 1850 | }; |
| 1809 | 1851 | |
| 1810 | 1852 | // restore Backup. |
| 1811 | -cpanel_action_restore_manual_backup = function () { | |
| 1853 | +let cpanel_action_restore_manual_backup = function () { | |
| 1812 | 1854 | |
| 1813 | - var websiteId = jQuery('#cpanel_automatic_backup_button').attr('website_id'); | |
| 1814 | - var backupID = jQuery('#database_backup_button').attr('backup_name'); | |
| 1815 | - var backupPath = jQuery('#database_backup_button').attr('backup_path'); | |
| 1855 | + let websiteId = jQuery('#cpanel_automatic_backup_button').attr('website_id'); | |
| 1856 | + let backupID = jQuery('#database_backup_button').attr('backup_name'); | |
| 1857 | + let backupPath = jQuery('#database_backup_button').attr('backup_path'); | |
| 1816 | 1858 | |
| 1817 | - var data = mainwp_secure_data({ | |
| 1859 | + let data = mainwp_secure_data({ | |
| 1818 | 1860 | action: 'cpanel_action_restore_manual_backup', |
| 1819 | 1861 | website_id: websiteId, |
| 1820 | 1862 | backup_api: 'cpanel', |
| 1821 | 1863 | backup_id: backupID, |
| @@ -1829,13 +1871,13 @@ | ||
| 1829 | 1871 | response = jQuery.trim(response); |
| 1830 | 1872 | |
| 1831 | 1873 | if (response === 'true') { |
| 1832 | 1874 | |
| 1833 | - // Show message. | |
| 1834 | - jQuery('#mainwp-api-backups-message-zone').addClass('green').show(); | |
| 1835 | - jQuery('#mainwp-api-backups-message-zone .content .message') | |
| 1836 | - .html('The backup restoration process has finished. Please wait a few moments and then check the site.') | |
| 1837 | - ; | |
| 1875 | + // Show message. | |
| 1876 | + jQuery('#mainwp-api-backups-message-zone').addClass('green').show(); | |
| 1877 | + jQuery('#mainwp-api-backups-message-zone .content .message') | |
| 1878 | + .html('The backup restoration process has finished. Please wait a few moments and then check the site.') | |
| 1879 | + ; | |
| 1838 | 1880 | |
| 1839 | 1881 | // Stop button animation. ( Using class so ALL buttons are animated not just the one clicked ). |
| 1840 | 1882 | jQuery('.mainwp_3rd_party_api_cpanel_action_restore_manual_backup button').removeClass('disabled loading'); |
| 1841 | 1883 | |
| @@ -1840,13 +1882,13 @@ | ||
| 1840 | 1882 | jQuery('.mainwp_3rd_party_api_cpanel_action_restore_manual_backup button').removeClass('disabled loading'); |
| 1841 | 1883 | |
| 1842 | 1884 | } else { |
| 1843 | 1885 | |
| 1844 | - // Show message. | |
| 1845 | - jQuery('#mainwp-api-backups-message-zone').addClass('red').show(); | |
| 1846 | - jQuery('#mainwp-api-backups-message-zone .content .message') | |
| 1847 | - .html('There was an issue while restoring your backup.') | |
| 1848 | - ; | |
| 1886 | + // Show message. | |
| 1887 | + jQuery('#mainwp-api-backups-message-zone').addClass('red').show(); | |
| 1888 | + jQuery('#mainwp-api-backups-message-zone .content .message') | |
| 1889 | + .html('There was an issue while restoring your backup.') | |
| 1890 | + ; | |
| 1849 | 1891 | |
| 1850 | 1892 | // Stop button animation. ( Using class so ALL buttons are animated not just the one clicked ). |
| 1851 | 1893 | jQuery('.mainwp_3rd_party_api_cpanel_action_restore_database_backup button').removeClass('disabled loading'); |
| 1852 | 1894 | |
| @@ -1853,15 +1895,15 @@ | ||
| 1853 | 1895 | } |
| 1854 | 1896 | }); |
| 1855 | 1897 | }; |
| 1856 | 1898 | |
| 1857 | -cpanel_action_create_database_backup = function (pObj) { | |
| 1899 | +let cpanel_action_create_database_backup = function (pObj) { | |
| 1858 | 1900 | |
| 1859 | 1901 | // Grab the website ID. |
| 1860 | - var websiteId = jQuery(pObj).attr('website_id'); | |
| 1902 | + let websiteId = jQuery(pObj).attr('website_id'); | |
| 1861 | 1903 | |
| 1862 | 1904 | // Build the data object. |
| 1863 | - var data = mainwp_secure_data({ | |
| 1905 | + let data = mainwp_secure_data({ | |
| 1864 | 1906 | action: 'cpanel_action_create_database_backup', |
| 1865 | 1907 | website_id: websiteId, |
| 1866 | 1908 | }); |
| 1867 | 1909 | |
| @@ -1874,13 +1916,13 @@ | ||
| 1874 | 1916 | |
| 1875 | 1917 | // Check & return the response. |
| 1876 | 1918 | if (response === 'true') { |
| 1877 | 1919 | |
| 1878 | - // Show message. | |
| 1879 | - jQuery('#mainwp-api-backups-message-zone').addClass('green').show(); | |
| 1880 | - jQuery('#mainwp-api-backups-message-zone .content .message') | |
| 1881 | - .html('The current database backup has finished. Please wait a few moments and then Refresh Available Backups.') | |
| 1882 | - ; | |
| 1920 | + // Show message. | |
| 1921 | + jQuery('#mainwp-api-backups-message-zone').addClass('green').show(); | |
| 1922 | + jQuery('#mainwp-api-backups-message-zone .content .message') | |
| 1923 | + .html('The current database backup has finished. Please wait a few moments and then Refresh Available Backups.') | |
| 1924 | + ; | |
| 1883 | 1925 | |
| 1884 | 1926 | // Start button animation. |
| 1885 | 1927 | jQuery(pObj).removeClass('disabled loading'); |
| 1886 | 1928 | |
| @@ -1885,13 +1927,13 @@ | ||
| 1885 | 1927 | jQuery(pObj).removeClass('disabled loading'); |
| 1886 | 1928 | |
| 1887 | 1929 | } else { |
| 1888 | 1930 | |
| 1889 | - // Show message. | |
| 1890 | - jQuery('#mainwp-api-backups-message-zone').addClass('red').show(); | |
| 1891 | - jQuery('#mainwp-api-backups-message-zone .content .message') | |
| 1892 | - .html('There was an issue while creating your backup.') | |
| 1893 | - ; | |
| 1931 | + // Show message. | |
| 1932 | + jQuery('#mainwp-api-backups-message-zone').addClass('red').show(); | |
| 1933 | + jQuery('#mainwp-api-backups-message-zone .content .message') | |
| 1934 | + .html('There was an issue while creating your backup.') | |
| 1935 | + ; | |
| 1894 | 1936 | |
| 1895 | 1937 | // Start button animation. |
| 1896 | 1938 | jQuery(pObj).removeClass('disabled loading'); |
| 1897 | 1939 | |
| @@ -1898,19 +1940,19 @@ | ||
| 1898 | 1940 | } |
| 1899 | 1941 | }); |
| 1900 | 1942 | } |
| 1901 | 1943 | |
| 1902 | -cpanel_action_create_full_backup = function (pObj) { | |
| 1944 | +let cpanel_action_create_full_backup = function (pObj) { | |
| 1903 | 1945 | |
| 1904 | 1946 | // Grab the website ID. |
| 1905 | - var websiteId = jQuery(pObj).attr('website_id'); | |
| 1947 | + let websiteId = jQuery(pObj).attr('website_id'); | |
| 1906 | 1948 | |
| 1907 | 1949 | // Build the data object. |
| 1908 | - var data = mainwp_secure_data({ | |
| 1950 | + let data = mainwp_secure_data({ | |
| 1909 | 1951 | action: 'cpanel_action_create_full_backup', |
| 1910 | 1952 | website_id: websiteId, |
| 1911 | 1953 | backup_api: 'cpanel', |
| 1912 | - backup: 'true' | |
| 1954 | + backup: 'true' | |
| 1913 | 1955 | }); |
| 1914 | 1956 | |
| 1915 | 1957 | |
| 1916 | 1958 | // Start button animation. |
| @@ -1922,13 +1964,13 @@ | ||
| 1922 | 1964 | |
| 1923 | 1965 | // Check & return the response. |
| 1924 | 1966 | if (response === 'true') { |
| 1925 | 1967 | |
| 1926 | - // Show message. | |
| 1927 | - jQuery('#mainwp-api-backups-message-zone').addClass('green').show(); | |
| 1928 | - jQuery('#mainwp-api-backups-message-zone .content .message') | |
| 1929 | - .html('The current File & Database backup has finished. Please wait a few moments and then Refresh Available Backups.') | |
| 1930 | - ; | |
| 1968 | + // Show message. | |
| 1969 | + jQuery('#mainwp-api-backups-message-zone').addClass('green').show(); | |
| 1970 | + jQuery('#mainwp-api-backups-message-zone .content .message') | |
| 1971 | + .html('The current File & Database backup has finished. Please wait a few moments and then Refresh Available Backups.') | |
| 1972 | + ; | |
| 1931 | 1973 | |
| 1932 | 1974 | // Start button animation. |
| 1933 | 1975 | jQuery(pObj).removeClass('disabled loading'); |
| 1934 | 1976 | |
| @@ -1933,13 +1975,13 @@ | ||
| 1933 | 1975 | jQuery(pObj).removeClass('disabled loading'); |
| 1934 | 1976 | |
| 1935 | 1977 | } else { |
| 1936 | 1978 | |
| 1937 | - // Show message. | |
| 1938 | - jQuery('#mainwp-api-backups-message-zone').addClass('red').show(); | |
| 1939 | - jQuery('#mainwp-api-backups-message-zone .content .message') | |
| 1940 | - .html('There was an issue while creating your backups.') | |
| 1941 | - ; | |
| 1979 | + // Show message. | |
| 1980 | + jQuery('#mainwp-api-backups-message-zone').addClass('red').show(); | |
| 1981 | + jQuery('#mainwp-api-backups-message-zone .content .message') | |
| 1982 | + .html('There was an issue while creating your backups.') | |
| 1983 | + ; | |
| 1942 | 1984 | |
| 1943 | 1985 | // Start button animation. |
| 1944 | 1986 | jQuery(pObj).removeClass('disabled loading'); |
| 1945 | 1987 | |
| @@ -1951,13 +1993,13 @@ | ||
| 1951 | 1993 | * Plesk Functions. |
| 1952 | 1994 | */ |
| 1953 | 1995 | |
| 1954 | 1996 | // Refresh Available Backups. |
| 1955 | -plesk_action_refresh_available_backups = function (pObj) { | |
| 1997 | +let plesk_action_refresh_available_backups = function (pObj) { | |
| 1956 | 1998 | |
| 1957 | - var websiteId = jQuery(pObj).attr('website_id'); | |
| 1999 | + let websiteId = jQuery(pObj).attr('website_id'); | |
| 1958 | 2000 | |
| 1959 | - var data = mainwp_secure_data({ | |
| 2001 | + let data = mainwp_secure_data({ | |
| 1960 | 2002 | action: 'plesk_action_refresh_available_backups', |
| 1961 | 2003 | website_id: websiteId, |
| 1962 | 2004 | backup_api: 'Plesk' |
| 1963 | 2005 | }); |
| @@ -1969,13 +2011,13 @@ | ||
| 1969 | 2011 | response = jQuery.trim(response); |
| 1970 | 2012 | |
| 1971 | 2013 | if (response === 'true') { |
| 1972 | 2014 | |
| 1973 | - // Show message. | |
| 1974 | - jQuery('#mainwp-api-backups-message-zone').addClass('green').show(); | |
| 1975 | - jQuery('#mainwp-api-backups-message-zone .content .message') | |
| 1976 | - .html('Available backups have been refreshed.') | |
| 1977 | - ; | |
| 2015 | + // Show message. | |
| 2016 | + jQuery('#mainwp-api-backups-message-zone').addClass('green').show(); | |
| 2017 | + jQuery('#mainwp-api-backups-message-zone .content .message') | |
| 2018 | + .html('Available backups have been refreshed.') | |
| 2019 | + ; | |
| 1978 | 2020 | |
| 1979 | 2021 | // Stop button animation. |
| 1980 | 2022 | jQuery(pObj).removeClass('disabled loading'); |
| 1981 | 2023 | |
| @@ -1982,13 +2024,13 @@ | ||
| 1982 | 2024 | setInterval('location.reload()', 7000);// Using .reload() method. |
| 1983 | 2025 | |
| 1984 | 2026 | } else { |
| 1985 | 2027 | |
| 1986 | - // Show message. | |
| 1987 | - jQuery('#mainwp-api-backups-message-zone').addClass('red').show(); | |
| 1988 | - jQuery('#mainwp-api-backups-message-zone .content .message') | |
| 1989 | - .html('There was an issue while refreshing available backups.') | |
| 1990 | - ; | |
| 2028 | + // Show message. | |
| 2029 | + jQuery('#mainwp-api-backups-message-zone').addClass('red').show(); | |
| 2030 | + jQuery('#mainwp-api-backups-message-zone .content .message') | |
| 2031 | + .html('There was an issue while refreshing available backups.') | |
| 2032 | + ; | |
| 1991 | 2033 | |
| 1992 | 2034 | // Stop button animation. |
| 1993 | 2035 | jQuery(pObj).removeClass('disabled loading'); |
| 1994 | 2036 | |
| @@ -1995,13 +2037,13 @@ | ||
| 1995 | 2037 | } |
| 1996 | 2038 | }); |
| 1997 | 2039 | }; |
| 1998 | 2040 | |
| 1999 | -plesk_action_create_backup = function (pObj) { | |
| 2041 | +let plesk_action_create_backup = function (pObj) { | |
| 2000 | 2042 | |
| 2001 | - var websiteId = jQuery(pObj).attr('website_id'); | |
| 2043 | + let websiteId = jQuery(pObj).attr('website_id'); | |
| 2002 | 2044 | |
| 2003 | - var data = mainwp_secure_data({ | |
| 2045 | + let data = mainwp_secure_data({ | |
| 2004 | 2046 | action: 'plesk_action_create_backup', |
| 2005 | 2047 | website_id: websiteId, |
| 2006 | 2048 | backup_api: 'plesk' |
| 2007 | 2049 | }); |
| @@ -2013,13 +2055,13 @@ | ||
| 2013 | 2055 | response = jQuery.trim(response); |
| 2014 | 2056 | |
| 2015 | 2057 | if (response === 'true') { |
| 2016 | 2058 | |
| 2017 | - // Show message. | |
| 2018 | - jQuery('#mainwp-api-backups-message-zone').addClass('green').show(); | |
| 2019 | - jQuery('#mainwp-api-backups-message-zone .content .message') | |
| 2020 | - .html('A backup has been requested.') | |
| 2021 | - ; | |
| 2059 | + // Show message. | |
| 2060 | + jQuery('#mainwp-api-backups-message-zone').addClass('green').show(); | |
| 2061 | + jQuery('#mainwp-api-backups-message-zone .content .message') | |
| 2062 | + .html('A backup has been requested.') | |
| 2063 | + ; | |
| 2022 | 2064 | |
| 2023 | 2065 | // Stop button animation. |
| 2024 | 2066 | jQuery(pObj).removeClass('disabled loading'); |
| 2025 | 2067 | |
| @@ -2024,13 +2066,13 @@ | ||
| 2024 | 2066 | jQuery(pObj).removeClass('disabled loading'); |
| 2025 | 2067 | |
| 2026 | 2068 | } else { |
| 2027 | 2069 | |
| 2028 | - // Show message. | |
| 2029 | - jQuery('#mainwp-api-backups-message-zone').addClass('red').show(); | |
| 2030 | - jQuery('#mainwp-api-backups-message-zone .content .message') | |
| 2031 | - .html( response ) | |
| 2032 | - ; | |
| 2070 | + // Show message. | |
| 2071 | + jQuery('#mainwp-api-backups-message-zone').addClass('red').show(); | |
| 2072 | + jQuery('#mainwp-api-backups-message-zone .content .message') | |
| 2073 | + .html( response ) | |
| 2074 | + ; | |
| 2033 | 2075 | |
| 2034 | 2076 | // Stop button animation. |
| 2035 | 2077 | jQuery(pObj).removeClass('disabled loading'); |
| 2036 | 2078 | |
| @@ -2038,18 +2080,15 @@ | ||
| 2038 | 2080 | }); |
| 2039 | 2081 | }; |
| 2040 | 2082 | |
| 2041 | 2083 | // Restore backups. |
| 2042 | -plesk_action_restore_backup = function () { | |
| 2084 | +let plesk_action_restore_backup = function () { | |
| 2085 | + let button = jQuery('.mainwp_3rd_party_api_plesk_action_restore_backup').closest('td'); | |
| 2086 | + let installationId = jQuery('.mainwp_3rd_party_api_plesk_action_restore_backup').attr('installation_id'); | |
| 2087 | + let backupName = jQuery('.mainwp_3rd_party_api_plesk_action_restore_backup').attr('backup_name'); | |
| 2088 | + let websiteId = jQuery('.mainwp_3rd_party_api_plesk_action_restore_backup').attr('website_id'); | |
| 2043 | 2089 | |
| 2044 | - //jQuery('.mainwp_3rd_party_api_plesk_action_restore_backup').attr('disabled', 'true'); | |
| 2045 | - var button = jQuery('.mainwp_3rd_party_api_plesk_action_restore_backup').closest('td'); | |
| 2046 | - | |
| 2047 | - var installationId = jQuery('.mainwp_3rd_party_api_plesk_action_restore_backup').attr('installation_id'); | |
| 2048 | - var backupName = jQuery('.mainwp_3rd_party_api_plesk_action_restore_backup').attr('backup_name'); | |
| 2049 | - var websiteId = jQuery('.mainwp_3rd_party_api_plesk_action_restore_backup').attr('website_id'); | |
| 2050 | - | |
| 2051 | - var data = mainwp_secure_data({ | |
| 2090 | + let data = mainwp_secure_data({ | |
| 2052 | 2091 | action: 'plesk_action_restore_backup', |
| 2053 | 2092 | installation_id: installationId, |
| 2054 | 2093 | backup_name: backupName, |
| 2055 | 2094 | website_id: websiteId, |
| @@ -2063,13 +2102,13 @@ | ||
| 2063 | 2102 | response = jQuery.trim(response); |
| 2064 | 2103 | |
| 2065 | 2104 | if (response === 'true') { |
| 2066 | 2105 | |
| 2067 | - // Show message. | |
| 2068 | - jQuery('#mainwp-api-backups-message-zone').addClass('green').show(); | |
| 2069 | - jQuery('#mainwp-api-backups-message-zone .content .message') | |
| 2070 | - .html('Your application is in the process of restoring. This will take a few minuets...') | |
| 2071 | - ; | |
| 2106 | + // Show message. | |
| 2107 | + jQuery('#mainwp-api-backups-message-zone').addClass('green').show(); | |
| 2108 | + jQuery('#mainwp-api-backups-message-zone .content .message') | |
| 2109 | + .html('Your application is in the process of restoring. This will take a few minuets...') | |
| 2110 | + ; | |
| 2072 | 2111 | |
| 2073 | 2112 | // Stop button animation. |
| 2074 | 2113 | jQuery(button).removeClass('disabled loading'); |
| 2075 | 2114 | |
| @@ -2074,13 +2113,13 @@ | ||
| 2074 | 2113 | jQuery(button).removeClass('disabled loading'); |
| 2075 | 2114 | |
| 2076 | 2115 | } else { |
| 2077 | 2116 | |
| 2078 | - // Show message. | |
| 2079 | - jQuery('#mainwp-api-backups-message-zone').addClass('red').show(); | |
| 2080 | - jQuery('#mainwp-api-backups-message-zone .content .message') | |
| 2081 | - .html('There was an issue while attempting to restore your application...') | |
| 2082 | - ; | |
| 2117 | + // Show message. | |
| 2118 | + jQuery('#mainwp-api-backups-message-zone').addClass('red').show(); | |
| 2119 | + jQuery('#mainwp-api-backups-message-zone .content .message') | |
| 2120 | + .html('There was an issue while attempting to restore your application...') | |
| 2121 | + ; | |
| 2083 | 2122 | |
| 2084 | 2123 | // Stop button animation. |
| 2085 | 2124 | jQuery(button).removeClass('disabled loading'); |
| 2086 | 2125 | } |
| @@ -2087,17 +2126,17 @@ | ||
| 2087 | 2126 | }); |
| 2088 | 2127 | }; |
| 2089 | 2128 | |
| 2090 | 2129 | // Delete backups. |
| 2091 | -plesk_action_delete_backup = function () { | |
| 2130 | +let plesk_action_delete_backup = function () { | |
| 2092 | 2131 | jQuery('.mainwp_3rd_party_api_plesk_action_delete_backup').attr('disabled', 'true'); |
| 2093 | - var button = jQuery('.mainwp_3rd_party_api_plesk_action_delete_backup').closest('td'); | |
| 2132 | + let button = jQuery('.mainwp_3rd_party_api_plesk_action_delete_backup').closest('td'); | |
| 2094 | 2133 | |
| 2095 | - var installationId = jQuery('.mainwp_3rd_party_api_plesk_action_delete_backup').attr('installation_id'); | |
| 2096 | - var backupName = jQuery('.mainwp_3rd_party_api_plesk_action_delete_backup').attr('backup_name'); | |
| 2097 | - var websiteId = jQuery('.mainwp_3rd_party_api_plesk_action_delete_backup').attr('website_id'); | |
| 2134 | + let installationId = jQuery('.mainwp_3rd_party_api_plesk_action_delete_backup').attr('installation_id'); | |
| 2135 | + let backupName = jQuery('.mainwp_3rd_party_api_plesk_action_delete_backup').attr('backup_name'); | |
| 2136 | + let websiteId = jQuery('.mainwp_3rd_party_api_plesk_action_delete_backup').attr('website_id'); | |
| 2098 | 2137 | |
| 2099 | - var data = mainwp_secure_data({ | |
| 2138 | + let data = mainwp_secure_data({ | |
| 2100 | 2139 | action: 'plesk_action_delete_backup', |
| 2101 | 2140 | installation_id: installationId, |
| 2102 | 2141 | backup_name: backupName, |
| 2103 | 2142 | website_id: websiteId, |
| @@ -2112,17 +2151,148 @@ | ||
| 2112 | 2151 | response = jQuery.trim(response); |
| 2113 | 2152 | |
| 2114 | 2153 | if (response === 'true') { |
| 2115 | 2154 | |
| 2155 | + // Show message. | |
| 2156 | + jQuery('#mainwp-api-backups-message-zone').addClass('green').show(); | |
| 2157 | + jQuery('#mainwp-api-backups-message-zone .content .message') | |
| 2158 | + .html('The selected backup has been deleted.') | |
| 2159 | + ; | |
| 2160 | + | |
| 2161 | + setInterval('location.reload()', 5000); // Using .reload() method. | |
| 2162 | + | |
| 2163 | + } else { | |
| 2164 | + | |
| 2165 | + // Show message. | |
| 2166 | + jQuery('#mainwp-api-backups-message-zone').addClass('red').show(); | |
| 2167 | + jQuery('#mainwp-api-backups-message-zone .content .message') | |
| 2168 | + .html('There was an issue while deleting your backup.') | |
| 2169 | + ; | |
| 2170 | + | |
| 2171 | + setInterval('location.reload()', 5000); // Using .reload() method. | |
| 2172 | + | |
| 2173 | + } | |
| 2174 | + }); | |
| 2175 | +}; | |
| 2176 | + | |
| 2177 | +/******************************************************** | |
| 2178 | + * Kinsta Functions. | |
| 2179 | + */ | |
| 2180 | + | |
| 2181 | +// Refresh Available Backups. | |
| 2182 | +let kinsta_action_refresh_available_backups = function (pObj) { | |
| 2183 | + | |
| 2184 | + let websiteId = jQuery(pObj).attr('website_id'); | |
| 2185 | + | |
| 2186 | + let data = mainwp_secure_data({ | |
| 2187 | + action: 'kinsta_action_refresh_available_backups', | |
| 2188 | + website_id: websiteId, | |
| 2189 | + backup_api: 'Kinsta' | |
| 2190 | + }); | |
| 2191 | + | |
| 2192 | + // Start button animation. | |
| 2193 | + jQuery(pObj).addClass('disabled loading'); | |
| 2194 | + | |
| 2195 | + jQuery.post(ajaxurl, data, function (response) { | |
| 2196 | + response = jQuery.trim(response); | |
| 2197 | + | |
| 2198 | + if (response === 'true') { | |
| 2199 | + | |
| 2116 | 2200 | // Show message. |
| 2117 | 2201 | jQuery('#mainwp-api-backups-message-zone').addClass('green').show(); |
| 2118 | 2202 | jQuery('#mainwp-api-backups-message-zone .content .message') |
| 2203 | + .html('Available backups have been refreshed.') | |
| 2204 | + ; | |
| 2205 | + | |
| 2206 | + // Stop button animation. | |
| 2207 | + jQuery(pObj).removeClass('disabled loading'); | |
| 2208 | + | |
| 2209 | + setInterval('location.reload()', 7000);// Using .reload() method. | |
| 2210 | + | |
| 2211 | + } else { | |
| 2212 | + | |
| 2213 | + // Show message. | |
| 2214 | + jQuery('#mainwp-api-backups-message-zone').addClass('red').show(); | |
| 2215 | + jQuery('#mainwp-api-backups-message-zone .content .message') | |
| 2216 | + .html('There was an issue while refreshing available backups.') | |
| 2217 | + ; | |
| 2218 | + | |
| 2219 | + // Stop button animation. | |
| 2220 | + jQuery(pObj).removeClass('disabled loading'); | |
| 2221 | + | |
| 2222 | + } | |
| 2223 | + }); | |
| 2224 | +}; | |
| 2225 | + | |
| 2226 | +// Create Manual Backup. | |
| 2227 | +let kinsta_action_create_backup = function (pObj) { | |
| 2228 | + | |
| 2229 | + let websiteId = jQuery(pObj).attr('website_id'); | |
| 2230 | + | |
| 2231 | + let data = mainwp_secure_data({ | |
| 2232 | + action: 'kinsta_action_create_backup', | |
| 2233 | + website_id: websiteId, | |
| 2234 | + backup_api: 'kinsta' | |
| 2235 | + }); | |
| 2236 | + | |
| 2237 | + // Start button animation. | |
| 2238 | + jQuery(pObj).addClass('disabled loading'); | |
| 2239 | + | |
| 2240 | + jQuery.post(ajaxurl, data, function (response) { | |
| 2241 | + response = jQuery.trim(response); | |
| 2242 | + | |
| 2243 | + if (response === 'true') { | |
| 2244 | + | |
| 2245 | + // Show message. | |
| 2246 | + jQuery('#mainwp-api-backups-message-zone').addClass('green').show(); | |
| 2247 | + jQuery('#mainwp-api-backups-message-zone .content .message') | |
| 2248 | + .html('A backup has been requested.') | |
| 2249 | + ; | |
| 2250 | + | |
| 2251 | + // Stop button animation. | |
| 2252 | + jQuery(pObj).removeClass('disabled loading'); | |
| 2253 | + | |
| 2254 | + } else { | |
| 2255 | + | |
| 2256 | + // Show message. | |
| 2257 | + jQuery('#mainwp-api-backups-message-zone').addClass('red').show(); | |
| 2258 | + jQuery('#mainwp-api-backups-message-zone .content .message') | |
| 2259 | + .html( response ) | |
| 2260 | + ; | |
| 2261 | + | |
| 2262 | + // Stop button animation. | |
| 2263 | + jQuery(pObj).removeClass('disabled loading'); | |
| 2264 | + | |
| 2265 | + } | |
| 2266 | + }); | |
| 2267 | +}; | |
| 2268 | + | |
| 2269 | +// Delete Manual Backup. | |
| 2270 | +let kinsta_action_delete_backup = function (pObj, backupId) { | |
| 2271 | + let websiteId = jQuery('.mainwp_3rd_party_api_kinsta_action_delete_backup ').attr('website_id'); | |
| 2272 | + let data = mainwp_secure_data({ | |
| 2273 | + action: 'kinsta_action_delete_backup', | |
| 2274 | + backup_id: backupId, | |
| 2275 | + website_id: websiteId, | |
| 2276 | + backup_api: 'kinsta' | |
| 2277 | + }); | |
| 2278 | + | |
| 2279 | + // Start button animation. | |
| 2280 | + jQuery(pObj).addClass('disabled loading'); | |
| 2281 | + | |
| 2282 | + jQuery.post(ajaxurl, data, function (response) { | |
| 2283 | + response = jQuery.trim(response); | |
| 2284 | + if (response === 'true') { | |
| 2285 | + | |
| 2286 | + // Show message. | |
| 2287 | + jQuery('#mainwp-api-backups-message-zone').addClass('green').show(); | |
| 2288 | + jQuery('#mainwp-api-backups-message-zone .content .message') | |
| 2119 | 2289 | .html('The selected backup has been deleted.') |
| 2120 | 2290 | ; |
| 2121 | 2291 | |
| 2122 | 2292 | setInterval('location.reload()', 5000); // Using .reload() method. |
| 2123 | 2293 | |
| 2124 | - } else { | |
| 2294 | + } else { | |
| 2125 | 2295 | |
| 2126 | 2296 | // Show message. |
| 2127 | 2297 | jQuery('#mainwp-api-backups-message-zone').addClass('red').show(); |
| 2128 | 2298 | jQuery('#mainwp-api-backups-message-zone .content .message') |
| @@ -2130,9 +2300,49 @@ | ||
| 2130 | 2300 | ; |
| 2131 | 2301 | |
| 2132 | 2302 | setInterval('location.reload()', 5000); // Using .reload() method. |
| 2133 | 2303 | |
| 2134 | - } | |
| 2135 | - }); | |
| 2304 | + } | |
| 2305 | + }); | |
| 2136 | 2306 | }; |
| 2137 | 2307 | |
| 2308 | +// Delete Manual Backup. | |
| 2309 | +let kinsta_action_restore_backup = function (pObj, backupId) { | |
| 2138 | 2310 | |
| 2311 | + let websiteId = jQuery('.mainwp_3rd_party_api_kinsta_action_restore_backup').attr('website_id'); | |
| 2312 | + | |
| 2313 | + let data = mainwp_secure_data({ | |
| 2314 | + action: 'kinsta_action_restore_backup', | |
| 2315 | + backup_id: backupId, | |
| 2316 | + backup_api: 'kinsta', | |
| 2317 | + website_id: websiteId | |
| 2318 | + }); | |
| 2319 | + | |
| 2320 | + // Start button animation. | |
| 2321 | + jQuery(pObj).addClass('disabled loading'); | |
| 2322 | + | |
| 2323 | + jQuery.post(ajaxurl, data, function (response) { | |
| 2324 | + response = jQuery.trim(response); | |
| 2325 | + if (response === 'true') { | |
| 2326 | + | |
| 2327 | + // Show message. | |
| 2328 | + jQuery('#mainwp-api-backups-message-zone').addClass('green').show(); | |
| 2329 | + jQuery('#mainwp-api-backups-message-zone .content .message') | |
| 2330 | + .html('Your application is in the process of restoring. This will take a few minuets...') | |
| 2331 | + ; | |
| 2332 | + | |
| 2333 | + // Stop button animation. | |
| 2334 | + jQuery(button).removeClass('disabled loading'); | |
| 2335 | + | |
| 2336 | + } else { | |
| 2337 | + | |
| 2338 | + // Show message. | |
| 2339 | + jQuery('#mainwp-api-backups-message-zone').addClass('red').show(); | |
| 2340 | + jQuery('#mainwp-api-backups-message-zone .content .message') | |
| 2341 | + .html('There was an issue while attempting to restore your application...') | |
| 2342 | + ; | |
| 2343 | + | |
| 2344 | + // Stop button animation. | |
| 2345 | + jQuery(button).removeClass('disabled loading'); | |
| 2346 | + } | |
| 2347 | + }); | |
| 2348 | +}; | |