Version Description
- 01/09/2020 =
- Fix: fixing an issue in the general cleanup tab preventing users from deleting orphaned items
- Tweak: we are now using SweetAlert for all popup boxes
- Tweak: enhancing the JavaScript code
- Tweak: enhancing some blocks of code
- Tweak: enhancing the security of the plugin
Download this release
Release Info
Developer | symptote |
Plugin | Advanced Database Cleaner |
Version | 3.0.2 |
Comparing to | |
See all releases |
Code changes from version 3.0.1 to 3.0.2
- README.txt +8 -1
- advanced-db-cleaner.php +19 -5
- css/sweetalert2.min.css +6 -0
- includes/class_clean_cron.php +47 -48
- includes/class_clean_options.php +41 -35
- includes/class_clean_tables.php +40 -43
- includes/class_general_cleanup.php +26 -29
- includes/custom-clean-view/class_clean_comment.php +17 -9
- includes/custom-clean-view/class_clean_meta_comment_post_user_term.php +18 -10
- includes/custom-clean-view/class_clean_relationships.php +18 -10
- includes/custom-clean-view/class_clean_revision_draft_trash.php +19 -11
- includes/custom-clean-view/class_clean_transient.php +18 -10
- includes/custom-clean-view/page_custom_clean.php +1 -14
- includes/custom-schedule-view/class_add_cleanup_schedule.php +41 -42
- includes/custom-schedule-view/class_add_optimize_schedule.php +31 -36
- includes/custom-schedule-view/class_edit_cleanup_schedule.php +40 -36
- includes/custom-schedule-view/class_edit_optimize_schedule.php +29 -36
- includes/functions.php +1 -1
- js/admin.js +129 -198
- js/sweetalert2.min.js +6 -0
README.txt
CHANGED
@@ -5,7 +5,7 @@ Tags: clean, clean up, cleanup, database, optimize, performance, speed, optimizi
|
|
5 |
Requires at least: 3.1.0
|
6 |
Requires PHP: 5.0
|
7 |
Tested up to: 5.5
|
8 |
-
Stable tag: 3.0.
|
9 |
License: GPLv2 or later
|
10 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
11 |
|
@@ -135,6 +135,13 @@ This section describes how to install the plugin. In general, there are 3 ways t
|
|
135 |
|
136 |
== Changelog ==
|
137 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
138 |
= 3.0.1 - 26/08/2020 =
|
139 |
- Fix: some calls in the JS file has been corrected
|
140 |
- Fix: the warning "Deprecated: array_key_exists()" is now solved
|
5 |
Requires at least: 3.1.0
|
6 |
Requires PHP: 5.0
|
7 |
Tested up to: 5.5
|
8 |
+
Stable tag: 3.0.2
|
9 |
License: GPLv2 or later
|
10 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
11 |
|
135 |
|
136 |
== Changelog ==
|
137 |
|
138 |
+
= 3.0.2 - 01/09/2020 =
|
139 |
+
- Fix: fixing an issue in the general cleanup tab preventing users from deleting orphaned items
|
140 |
+
- Tweak: we are now using SweetAlert for all popup boxes
|
141 |
+
- Tweak: enhancing the JavaScript code
|
142 |
+
- Tweak: enhancing some blocks of code
|
143 |
+
- Tweak: enhancing the security of the plugin
|
144 |
+
|
145 |
= 3.0.1 - 26/08/2020 =
|
146 |
- Fix: some calls in the JS file has been corrected
|
147 |
- Fix: the warning "Deprecated: array_key_exists()" is now solved
|
advanced-db-cleaner.php
CHANGED
@@ -5,7 +5,7 @@ if (!is_main_site()) return;
|
|
5 |
Plugin Name: Advanced Database Cleaner
|
6 |
Plugin URI: https://sigmaplugin.com/downloads/wordpress-advanced-database-cleaner
|
7 |
Description: Clean database by deleting unused data such as 'old revisions', 'old drafts', 'orphan options', etc. Optimize database and more.
|
8 |
-
Version: 3.0.
|
9 |
Author: Younes JFR.
|
10 |
Author URI: https://www.sigmaplugin.com
|
11 |
Contributors: symptote
|
@@ -30,7 +30,7 @@ class ADBC_Advanced_DB_Cleaner {
|
|
30 |
|
31 |
// Define common constants that should be modified in each version
|
32 |
if(!defined("ADBC_PLUGIN_F_TYPE")) define("ADBC_PLUGIN_F_TYPE", "free");
|
33 |
-
if(!defined("ADBC_PLUGIN_VERSION")) define("ADBC_PLUGIN_VERSION", "3.0.
|
34 |
|
35 |
// Prevent conflicts between free and pro, load text-domain and check if should update settings after upgrade
|
36 |
add_action('plugins_loaded', array($this, 'plugins_loaded'));
|
@@ -235,11 +235,25 @@ class ADBC_Advanced_DB_Cleaner {
|
|
235 |
wp_enqueue_style('aDBc_css', ADBC_PLUGIN_DIR_PATH . '/css/admin.css');
|
236 |
wp_enqueue_script('aDBc_js', ADBC_PLUGIN_DIR_PATH . '/js/admin.js');
|
237 |
|
|
|
|
|
|
|
238 |
// The wp_localize_script allows us to output the ajax_url path for our script to use.
|
239 |
wp_localize_script('aDBc_js', 'aDBc_ajax_obj', array(
|
240 |
-
|
241 |
-
|
242 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
243 |
));
|
244 |
//wp_enqueue_script('jquery');
|
245 |
wp_enqueue_script('jquery-ui-dialog');
|
5 |
Plugin Name: Advanced Database Cleaner
|
6 |
Plugin URI: https://sigmaplugin.com/downloads/wordpress-advanced-database-cleaner
|
7 |
Description: Clean database by deleting unused data such as 'old revisions', 'old drafts', 'orphan options', etc. Optimize database and more.
|
8 |
+
Version: 3.0.2
|
9 |
Author: Younes JFR.
|
10 |
Author URI: https://www.sigmaplugin.com
|
11 |
Contributors: symptote
|
30 |
|
31 |
// Define common constants that should be modified in each version
|
32 |
if(!defined("ADBC_PLUGIN_F_TYPE")) define("ADBC_PLUGIN_F_TYPE", "free");
|
33 |
+
if(!defined("ADBC_PLUGIN_VERSION")) define("ADBC_PLUGIN_VERSION", "3.0.2");
|
34 |
|
35 |
// Prevent conflicts between free and pro, load text-domain and check if should update settings after upgrade
|
36 |
add_action('plugins_loaded', array($this, 'plugins_loaded'));
|
235 |
wp_enqueue_style('aDBc_css', ADBC_PLUGIN_DIR_PATH . '/css/admin.css');
|
236 |
wp_enqueue_script('aDBc_js', ADBC_PLUGIN_DIR_PATH . '/js/admin.js');
|
237 |
|
238 |
+
wp_enqueue_style('sweet2_css', ADBC_PLUGIN_DIR_PATH . '/css/sweetalert2.min.css');
|
239 |
+
wp_enqueue_script('sweet2_js', ADBC_PLUGIN_DIR_PATH . '/js/sweetalert2.min.js');
|
240 |
+
|
241 |
// The wp_localize_script allows us to output the ajax_url path for our script to use.
|
242 |
wp_localize_script('aDBc_js', 'aDBc_ajax_obj', array(
|
243 |
+
|
244 |
+
'ajaxurl' => admin_url('admin-ajax.php'),
|
245 |
+
'images_path' => ADBC_PLUGIN_DIR_PATH . "/images/",
|
246 |
+
'sentence_scanning' => __('Scanning ...', 'advanced-database-cleaner'),
|
247 |
+
'unexpected_error' => __('Unexpected error! Please refresh the page and try again!', 'advanced-database-cleaner'),
|
248 |
+
'select_action' => __('Please select an action!', 'advanced-database-cleaner'),
|
249 |
+
'no_items_selected' => __('No items selected!', 'advanced-database-cleaner'),
|
250 |
+
'clean_items_warning' => __('You are about to clean some of your unused data. This operation is irreversible!', 'advanced-database-cleaner'),
|
251 |
+
'empty_tables_warning' => __('You are about to empty some of your tables. This operation is irreversible!', 'advanced-database-cleaner'),
|
252 |
+
'are_you_sure' => __('Are you sure?', 'advanced-database-cleaner'),
|
253 |
+
'make_db_backup_first' => __('Don\'t forget to make a backup of your database first!', 'advanced-database-cleaner'),
|
254 |
+
'cancel' => __('Cancel', 'advanced-database-cleaner'),
|
255 |
+
'Continue' => __('Continue', 'advanced-database-cleaner')
|
256 |
+
|
257 |
));
|
258 |
//wp_enqueue_script('jquery');
|
259 |
wp_enqueue_script('jquery-ui-dialog');
|
css/sweetalert2.min.css
ADDED
@@ -0,0 +1,6 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
/******************************************
|
2 |
+
SweetAlert2
|
3 |
+
https://github.com/sweetalert2/sweetalert2
|
4 |
+
MIT License
|
5 |
+
*******************************************/
|
6 |
+
.swal2-popup.swal2-toast{flex-direction:row;align-items:center;width:auto;padding:.625em;overflow-y:hidden;background:#fff;box-shadow:0 0 .625em #d9d9d9}.swal2-popup.swal2-toast .swal2-header{flex-direction:row}.swal2-popup.swal2-toast .swal2-title{flex-grow:1;justify-content:flex-start;margin:0 .6em;font-size:1em}.swal2-popup.swal2-toast .swal2-footer{margin:.5em 0 0;padding:.5em 0 0;font-size:.8em}.swal2-popup.swal2-toast .swal2-close{position:static;width:.8em;height:.8em;line-height:.8}.swal2-popup.swal2-toast .swal2-content{justify-content:flex-start;font-size:1em}.swal2-popup.swal2-toast .swal2-icon{width:2em;min-width:2em;height:2em;margin:0}.swal2-popup.swal2-toast .swal2-icon .swal2-icon-content{display:flex;align-items:center;font-size:1.8em;font-weight:700}@media all and (-ms-high-contrast:none),(-ms-high-contrast:active){.swal2-popup.swal2-toast .swal2-icon .swal2-icon-content{font-size:.25em}}.swal2-popup.swal2-toast .swal2-icon.swal2-success .swal2-success-ring{width:2em;height:2em}.swal2-popup.swal2-toast .swal2-icon.swal2-error [class^=swal2-x-mark-line]{top:.875em;width:1.375em}.swal2-popup.swal2-toast .swal2-icon.swal2-error [class^=swal2-x-mark-line][class$=left]{left:.3125em}.swal2-popup.swal2-toast .swal2-icon.swal2-error [class^=swal2-x-mark-line][class$=right]{right:.3125em}.swal2-popup.swal2-toast .swal2-actions{flex-basis:auto!important;width:auto;height:auto;margin:0 .3125em}.swal2-popup.swal2-toast .swal2-styled{margin:0 .3125em;padding:.3125em .625em;font-size:1em}.swal2-popup.swal2-toast .swal2-styled:focus{box-shadow:0 0 0 1px #fff,0 0 0 3px rgba(50,100,150,.4)}.swal2-popup.swal2-toast .swal2-success{border-color:#a5dc86}.swal2-popup.swal2-toast .swal2-success [class^=swal2-success-circular-line]{position:absolute;width:1.6em;height:3em;transform:rotate(45deg);border-radius:50%}.swal2-popup.swal2-toast .swal2-success [class^=swal2-success-circular-line][class$=left]{top:-.8em;left:-.5em;transform:rotate(-45deg);transform-origin:2em 2em;border-radius:4em 0 0 4em}.swal2-popup.swal2-toast .swal2-success [class^=swal2-success-circular-line][class$=right]{top:-.25em;left:.9375em;transform-origin:0 1.5em;border-radius:0 4em 4em 0}.swal2-popup.swal2-toast .swal2-success .swal2-success-ring{width:2em;height:2em}.swal2-popup.swal2-toast .swal2-success .swal2-success-fix{top:0;left:.4375em;width:.4375em;height:2.6875em}.swal2-popup.swal2-toast .swal2-success [class^=swal2-success-line]{height:.3125em}.swal2-popup.swal2-toast .swal2-success [class^=swal2-success-line][class$=tip]{top:1.125em;left:.1875em;width:.75em}.swal2-popup.swal2-toast .swal2-success [class^=swal2-success-line][class$=long]{top:.9375em;right:.1875em;width:1.375em}.swal2-popup.swal2-toast .swal2-success.swal2-icon-show .swal2-success-line-tip{-webkit-animation:swal2-toast-animate-success-line-tip .75s;animation:swal2-toast-animate-success-line-tip .75s}.swal2-popup.swal2-toast .swal2-success.swal2-icon-show .swal2-success-line-long{-webkit-animation:swal2-toast-animate-success-line-long .75s;animation:swal2-toast-animate-success-line-long .75s}.swal2-popup.swal2-toast.swal2-show{-webkit-animation:swal2-toast-show .5s;animation:swal2-toast-show .5s}.swal2-popup.swal2-toast.swal2-hide{-webkit-animation:swal2-toast-hide .1s forwards;animation:swal2-toast-hide .1s forwards}.swal2-container{display:flex;position:fixed;z-index:1060;top:0;right:0;bottom:0;left:0;flex-direction:row;align-items:center;justify-content:center;padding:.625em;overflow-x:hidden;transition:background-color .1s;-webkit-overflow-scrolling:touch}.swal2-container.swal2-backdrop-show,.swal2-container.swal2-noanimation{background:rgba(0,0,0,.4)}.swal2-container.swal2-backdrop-hide{background:0 0!important}.swal2-container.swal2-top{align-items:flex-start}.swal2-container.swal2-top-left,.swal2-container.swal2-top-start{align-items:flex-start;justify-content:flex-start}.swal2-container.swal2-top-end,.swal2-container.swal2-top-right{align-items:flex-start;justify-content:flex-end}.swal2-container.swal2-center{align-items:center}.swal2-container.swal2-center-left,.swal2-container.swal2-center-start{align-items:center;justify-content:flex-start}.swal2-container.swal2-center-end,.swal2-container.swal2-center-right{align-items:center;justify-content:flex-end}.swal2-container.swal2-bottom{align-items:flex-end}.swal2-container.swal2-bottom-left,.swal2-container.swal2-bottom-start{align-items:flex-end;justify-content:flex-start}.swal2-container.swal2-bottom-end,.swal2-container.swal2-bottom-right{align-items:flex-end;justify-content:flex-end}.swal2-container.swal2-bottom-end>:first-child,.swal2-container.swal2-bottom-left>:first-child,.swal2-container.swal2-bottom-right>:first-child,.swal2-container.swal2-bottom-start>:first-child,.swal2-container.swal2-bottom>:first-child{margin-top:auto}.swal2-container.swal2-grow-fullscreen>.swal2-modal{display:flex!important;flex:1;align-self:stretch;justify-content:center}.swal2-container.swal2-grow-row>.swal2-modal{display:flex!important;flex:1;align-content:center;justify-content:center}.swal2-container.swal2-grow-column{flex:1;flex-direction:column}.swal2-container.swal2-grow-column.swal2-bottom,.swal2-container.swal2-grow-column.swal2-center,.swal2-container.swal2-grow-column.swal2-top{align-items:center}.swal2-container.swal2-grow-column.swal2-bottom-left,.swal2-container.swal2-grow-column.swal2-bottom-start,.swal2-container.swal2-grow-column.swal2-center-left,.swal2-container.swal2-grow-column.swal2-center-start,.swal2-container.swal2-grow-column.swal2-top-left,.swal2-container.swal2-grow-column.swal2-top-start{align-items:flex-start}.swal2-container.swal2-grow-column.swal2-bottom-end,.swal2-container.swal2-grow-column.swal2-bottom-right,.swal2-container.swal2-grow-column.swal2-center-end,.swal2-container.swal2-grow-column.swal2-center-right,.swal2-container.swal2-grow-column.swal2-top-end,.swal2-container.swal2-grow-column.swal2-top-right{align-items:flex-end}.swal2-container.swal2-grow-column>.swal2-modal{display:flex!important;flex:1;align-content:center;justify-content:center}.swal2-container.swal2-no-transition{transition:none!important}.swal2-container:not(.swal2-top):not(.swal2-top-start):not(.swal2-top-end):not(.swal2-top-left):not(.swal2-top-right):not(.swal2-center-start):not(.swal2-center-end):not(.swal2-center-left):not(.swal2-center-right):not(.swal2-bottom):not(.swal2-bottom-start):not(.swal2-bottom-end):not(.swal2-bottom-left):not(.swal2-bottom-right):not(.swal2-grow-fullscreen)>.swal2-modal{margin:auto}@media all and (-ms-high-contrast:none),(-ms-high-contrast:active){.swal2-container .swal2-modal{margin:0!important}}.swal2-popup{display:none;position:relative;box-sizing:border-box;flex-direction:column;justify-content:center;width:32em;max-width:100%;padding:1.25em;border:none;border-radius:.3125em;background:#fff;font-family:inherit;font-size:1rem}.swal2-popup:focus{outline:0}.swal2-popup.swal2-loading{overflow-y:hidden}.swal2-header{display:flex;flex-direction:column;align-items:center}.swal2-title{position:relative;max-width:100%;margin:0 0 .4em;padding:0;color:#595959;font-size:1.875em;font-weight:600;text-align:center;text-transform:none;word-wrap:break-word}.swal2-actions{display:flex;z-index:1;flex-wrap:wrap;align-items:center;justify-content:center;width:100%;margin:1.25em auto 0}.swal2-actions:not(.swal2-loading) .swal2-styled[disabled]{opacity:.4}.swal2-actions:not(.swal2-loading) .swal2-styled:hover{background-image:linear-gradient(rgba(0,0,0,.1),rgba(0,0,0,.1))}.swal2-actions:not(.swal2-loading) .swal2-styled:active{background-image:linear-gradient(rgba(0,0,0,.2),rgba(0,0,0,.2))}.swal2-actions.swal2-loading .swal2-styled.swal2-confirm{box-sizing:border-box;width:2.5em;height:2.5em;margin:.46875em;padding:0;-webkit-animation:swal2-rotate-loading 1.5s linear 0s infinite normal;animation:swal2-rotate-loading 1.5s linear 0s infinite normal;border:.25em solid transparent;border-radius:100%;border-color:transparent;background-color:transparent!important;color:transparent!important;cursor:default;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.swal2-actions.swal2-loading .swal2-styled.swal2-cancel{margin-right:30px;margin-left:30px}.swal2-actions.swal2-loading :not(.swal2-styled).swal2-confirm::after{content:"";display:inline-block;width:15px;height:15px;margin-left:5px;-webkit-animation:swal2-rotate-loading 1.5s linear 0s infinite normal;animation:swal2-rotate-loading 1.5s linear 0s infinite normal;border:3px solid #999;border-radius:50%;border-right-color:transparent;box-shadow:1px 1px 1px #fff}.swal2-styled{margin:.3125em;padding:.625em 2em;box-shadow:none;font-weight:500}.swal2-styled:not([disabled]){cursor:pointer}.swal2-styled.swal2-confirm{border:0;border-radius:.25em;background:initial;background-color:#3085d6;color:#fff;font-size:1.0625em}.swal2-styled.swal2-cancel{border:0;border-radius:.25em;background:initial;background-color:#aaa;color:#fff;font-size:1.0625em}.swal2-styled:focus{outline:0;box-shadow:0 0 0 1px #fff,0 0 0 3px rgba(50,100,150,.4)}.swal2-styled::-moz-focus-inner{border:0}.swal2-footer{justify-content:center;margin:1.25em 0 0;padding:1em 0 0;border-top:1px solid #eee;color:#545454;font-size:1em}.swal2-timer-progress-bar-container{position:absolute;right:0;bottom:0;left:0;height:.25em;overflow:hidden;border-bottom-right-radius:.3125em;border-bottom-left-radius:.3125em}.swal2-timer-progress-bar{width:100%;height:.25em;background:rgba(0,0,0,.2)}.swal2-image{max-width:100%;margin:1.25em auto}.swal2-close{position:absolute;z-index:2;top:0;right:0;align-items:center;justify-content:center;width:1.2em;height:1.2em;padding:0;overflow:hidden;transition:color .1s ease-out;border:none;border-radius:0;background:0 0;color:#ccc;font-family:serif;font-size:2.5em;line-height:1.2;cursor:pointer}.swal2-close:hover{transform:none;background:0 0;color:#f27474}.swal2-close::-moz-focus-inner{border:0}.swal2-content{z-index:1;justify-content:center;margin:0;padding:0;color:#545454;font-size:1.125em;font-weight:400;line-height:normal;text-align:center;word-wrap:break-word}.swal2-checkbox,.swal2-file,.swal2-input,.swal2-radio,.swal2-select,.swal2-textarea{margin:1em auto}.swal2-file,.swal2-input,.swal2-textarea{box-sizing:border-box;width:100%;transition:border-color .3s,box-shadow .3s;border:1px solid #d9d9d9;border-radius:.1875em;background:inherit;box-shadow:inset 0 1px 1px rgba(0,0,0,.06);color:inherit;font-size:1.125em}.swal2-file.swal2-inputerror,.swal2-input.swal2-inputerror,.swal2-textarea.swal2-inputerror{border-color:#f27474!important;box-shadow:0 0 2px #f27474!important}.swal2-file:focus,.swal2-input:focus,.swal2-textarea:focus{border:1px solid #b4dbed;outline:0;box-shadow:0 0 3px #c4e6f5}.swal2-file::-webkit-input-placeholder,.swal2-input::-webkit-input-placeholder,.swal2-textarea::-webkit-input-placeholder{color:#ccc}.swal2-file::-moz-placeholder,.swal2-input::-moz-placeholder,.swal2-textarea::-moz-placeholder{color:#ccc}.swal2-file:-ms-input-placeholder,.swal2-input:-ms-input-placeholder,.swal2-textarea:-ms-input-placeholder{color:#ccc}.swal2-file::-ms-input-placeholder,.swal2-input::-ms-input-placeholder,.swal2-textarea::-ms-input-placeholder{color:#ccc}.swal2-file::placeholder,.swal2-input::placeholder,.swal2-textarea::placeholder{color:#ccc}.swal2-range{margin:1em auto;background:#fff}.swal2-range input{width:80%}.swal2-range output{width:20%;color:inherit;font-weight:600;text-align:center}.swal2-range input,.swal2-range output{height:2.625em;padding:0;font-size:1.125em;line-height:2.625em}.swal2-input{height:2.625em;padding:0 .75em}.swal2-input[type=number]{max-width:10em}.swal2-file{background:inherit;font-size:1.125em}.swal2-textarea{height:6.75em;padding:.75em}.swal2-select{min-width:50%;max-width:100%;padding:.375em .625em;background:inherit;color:inherit;font-size:1.125em}.swal2-checkbox,.swal2-radio{align-items:center;justify-content:center;background:#fff;color:inherit}.swal2-checkbox label,.swal2-radio label{margin:0 .6em;font-size:1.125em}.swal2-checkbox input,.swal2-radio input{margin:0 .4em}.swal2-validation-message{display:none;align-items:center;justify-content:center;padding:.625em;overflow:hidden;background:#f0f0f0;color:#666;font-size:1em;font-weight:300}.swal2-validation-message::before{content:"!";display:inline-block;width:1.5em;min-width:1.5em;height:1.5em;margin:0 .625em;border-radius:50%;background-color:#f27474;color:#fff;font-weight:600;line-height:1.5em;text-align:center}.swal2-icon{position:relative;box-sizing:content-box;justify-content:center;width:5em;height:5em;margin:1.25em auto 1.875em;border:.25em solid transparent;border-radius:50%;font-family:inherit;line-height:5em;cursor:default;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.swal2-icon .swal2-icon-content{display:flex;align-items:center;font-size:3.75em}.swal2-icon.swal2-error{border-color:#f27474;color:#f27474}.swal2-icon.swal2-error .swal2-x-mark{position:relative;flex-grow:1}.swal2-icon.swal2-error [class^=swal2-x-mark-line]{display:block;position:absolute;top:2.3125em;width:2.9375em;height:.3125em;border-radius:.125em;background-color:#f27474}.swal2-icon.swal2-error [class^=swal2-x-mark-line][class$=left]{left:1.0625em;transform:rotate(45deg)}.swal2-icon.swal2-error [class^=swal2-x-mark-line][class$=right]{right:1em;transform:rotate(-45deg)}.swal2-icon.swal2-error.swal2-icon-show{-webkit-animation:swal2-animate-error-icon .5s;animation:swal2-animate-error-icon .5s}.swal2-icon.swal2-error.swal2-icon-show .swal2-x-mark{-webkit-animation:swal2-animate-error-x-mark .5s;animation:swal2-animate-error-x-mark .5s}.swal2-icon.swal2-warning{border-color:#facea8;color:#f8bb86}.swal2-icon.swal2-info{border-color:#9de0f6;color:#3fc3ee}.swal2-icon.swal2-question{border-color:#c9dae1;color:#87adbd}.swal2-icon.swal2-success{border-color:#a5dc86;color:#a5dc86}.swal2-icon.swal2-success [class^=swal2-success-circular-line]{position:absolute;width:3.75em;height:7.5em;transform:rotate(45deg);border-radius:50%}.swal2-icon.swal2-success [class^=swal2-success-circular-line][class$=left]{top:-.4375em;left:-2.0635em;transform:rotate(-45deg);transform-origin:3.75em 3.75em;border-radius:7.5em 0 0 7.5em}.swal2-icon.swal2-success [class^=swal2-success-circular-line][class$=right]{top:-.6875em;left:1.875em;transform:rotate(-45deg);transform-origin:0 3.75em;border-radius:0 7.5em 7.5em 0}.swal2-icon.swal2-success .swal2-success-ring{position:absolute;z-index:2;top:-.25em;left:-.25em;box-sizing:content-box;width:100%;height:100%;border:.25em solid rgba(165,220,134,.3);border-radius:50%}.swal2-icon.swal2-success .swal2-success-fix{position:absolute;z-index:1;top:.5em;left:1.625em;width:.4375em;height:5.625em;transform:rotate(-45deg)}.swal2-icon.swal2-success [class^=swal2-success-line]{display:block;position:absolute;z-index:2;height:.3125em;border-radius:.125em;background-color:#a5dc86}.swal2-icon.swal2-success [class^=swal2-success-line][class$=tip]{top:2.875em;left:.8125em;width:1.5625em;transform:rotate(45deg)}.swal2-icon.swal2-success [class^=swal2-success-line][class$=long]{top:2.375em;right:.5em;width:2.9375em;transform:rotate(-45deg)}.swal2-icon.swal2-success.swal2-icon-show .swal2-success-line-tip{-webkit-animation:swal2-animate-success-line-tip .75s;animation:swal2-animate-success-line-tip .75s}.swal2-icon.swal2-success.swal2-icon-show .swal2-success-line-long{-webkit-animation:swal2-animate-success-line-long .75s;animation:swal2-animate-success-line-long .75s}.swal2-icon.swal2-success.swal2-icon-show .swal2-success-circular-line-right{-webkit-animation:swal2-rotate-success-circular-line 4.25s ease-in;animation:swal2-rotate-success-circular-line 4.25s ease-in}.swal2-progress-steps{align-items:center;margin:0 0 1.25em;padding:0;background:inherit;font-weight:600}.swal2-progress-steps li{display:inline-block;position:relative}.swal2-progress-steps .swal2-progress-step{z-index:20;width:2em;height:2em;border-radius:2em;background:#3085d6;color:#fff;line-height:2em;text-align:center}.swal2-progress-steps .swal2-progress-step.swal2-active-progress-step{background:#3085d6}.swal2-progress-steps .swal2-progress-step.swal2-active-progress-step~.swal2-progress-step{background:#add8e6;color:#fff}.swal2-progress-steps .swal2-progress-step.swal2-active-progress-step~.swal2-progress-step-line{background:#add8e6}.swal2-progress-steps .swal2-progress-step-line{z-index:10;width:2.5em;height:.4em;margin:0 -1px;background:#3085d6}[class^=swal2]{-webkit-tap-highlight-color:transparent}.swal2-show{-webkit-animation:swal2-show .3s;animation:swal2-show .3s}.swal2-hide{-webkit-animation:swal2-hide .15s forwards;animation:swal2-hide .15s forwards}.swal2-noanimation{transition:none}.swal2-scrollbar-measure{position:absolute;top:-9999px;width:50px;height:50px;overflow:scroll}.swal2-rtl .swal2-close{right:auto;left:0}.swal2-rtl .swal2-timer-progress-bar{right:0;left:auto}@supports (-ms-accelerator:true){.swal2-range input{width:100%!important}.swal2-range output{display:none}}@media all and (-ms-high-contrast:none),(-ms-high-contrast:active){.swal2-range input{width:100%!important}.swal2-range output{display:none}}@-moz-document url-prefix(){.swal2-close:focus{outline:2px solid rgba(50,100,150,.4)}}@-webkit-keyframes swal2-toast-show{0%{transform:translateY(-.625em) rotateZ(2deg)}33%{transform:translateY(0) rotateZ(-2deg)}66%{transform:translateY(.3125em) rotateZ(2deg)}100%{transform:translateY(0) rotateZ(0)}}@keyframes swal2-toast-show{0%{transform:translateY(-.625em) rotateZ(2deg)}33%{transform:translateY(0) rotateZ(-2deg)}66%{transform:translateY(.3125em) rotateZ(2deg)}100%{transform:translateY(0) rotateZ(0)}}@-webkit-keyframes swal2-toast-hide{100%{transform:rotateZ(1deg);opacity:0}}@keyframes swal2-toast-hide{100%{transform:rotateZ(1deg);opacity:0}}@-webkit-keyframes swal2-toast-animate-success-line-tip{0%{top:.5625em;left:.0625em;width:0}54%{top:.125em;left:.125em;width:0}70%{top:.625em;left:-.25em;width:1.625em}84%{top:1.0625em;left:.75em;width:.5em}100%{top:1.125em;left:.1875em;width:.75em}}@keyframes swal2-toast-animate-success-line-tip{0%{top:.5625em;left:.0625em;width:0}54%{top:.125em;left:.125em;width:0}70%{top:.625em;left:-.25em;width:1.625em}84%{top:1.0625em;left:.75em;width:.5em}100%{top:1.125em;left:.1875em;width:.75em}}@-webkit-keyframes swal2-toast-animate-success-line-long{0%{top:1.625em;right:1.375em;width:0}65%{top:1.25em;right:.9375em;width:0}84%{top:.9375em;right:0;width:1.125em}100%{top:.9375em;right:.1875em;width:1.375em}}@keyframes swal2-toast-animate-success-line-long{0%{top:1.625em;right:1.375em;width:0}65%{top:1.25em;right:.9375em;width:0}84%{top:.9375em;right:0;width:1.125em}100%{top:.9375em;right:.1875em;width:1.375em}}@-webkit-keyframes swal2-show{0%{transform:scale(.7)}45%{transform:scale(1.05)}80%{transform:scale(.95)}100%{transform:scale(1)}}@keyframes swal2-show{0%{transform:scale(.7)}45%{transform:scale(1.05)}80%{transform:scale(.95)}100%{transform:scale(1)}}@-webkit-keyframes swal2-hide{0%{transform:scale(1);opacity:1}100%{transform:scale(.5);opacity:0}}@keyframes swal2-hide{0%{transform:scale(1);opacity:1}100%{transform:scale(.5);opacity:0}}@-webkit-keyframes swal2-animate-success-line-tip{0%{top:1.1875em;left:.0625em;width:0}54%{top:1.0625em;left:.125em;width:0}70%{top:2.1875em;left:-.375em;width:3.125em}84%{top:3em;left:1.3125em;width:1.0625em}100%{top:2.8125em;left:.8125em;width:1.5625em}}@keyframes swal2-animate-success-line-tip{0%{top:1.1875em;left:.0625em;width:0}54%{top:1.0625em;left:.125em;width:0}70%{top:2.1875em;left:-.375em;width:3.125em}84%{top:3em;left:1.3125em;width:1.0625em}100%{top:2.8125em;left:.8125em;width:1.5625em}}@-webkit-keyframes swal2-animate-success-line-long{0%{top:3.375em;right:2.875em;width:0}65%{top:3.375em;right:2.875em;width:0}84%{top:2.1875em;right:0;width:3.4375em}100%{top:2.375em;right:.5em;width:2.9375em}}@keyframes swal2-animate-success-line-long{0%{top:3.375em;right:2.875em;width:0}65%{top:3.375em;right:2.875em;width:0}84%{top:2.1875em;right:0;width:3.4375em}100%{top:2.375em;right:.5em;width:2.9375em}}@-webkit-keyframes swal2-rotate-success-circular-line{0%{transform:rotate(-45deg)}5%{transform:rotate(-45deg)}12%{transform:rotate(-405deg)}100%{transform:rotate(-405deg)}}@keyframes swal2-rotate-success-circular-line{0%{transform:rotate(-45deg)}5%{transform:rotate(-45deg)}12%{transform:rotate(-405deg)}100%{transform:rotate(-405deg)}}@-webkit-keyframes swal2-animate-error-x-mark{0%{margin-top:1.625em;transform:scale(.4);opacity:0}50%{margin-top:1.625em;transform:scale(.4);opacity:0}80%{margin-top:-.375em;transform:scale(1.15)}100%{margin-top:0;transform:scale(1);opacity:1}}@keyframes swal2-animate-error-x-mark{0%{margin-top:1.625em;transform:scale(.4);opacity:0}50%{margin-top:1.625em;transform:scale(.4);opacity:0}80%{margin-top:-.375em;transform:scale(1.15)}100%{margin-top:0;transform:scale(1);opacity:1}}@-webkit-keyframes swal2-animate-error-icon{0%{transform:rotateX(100deg);opacity:0}100%{transform:rotateX(0);opacity:1}}@keyframes swal2-animate-error-icon{0%{transform:rotateX(100deg);opacity:0}100%{transform:rotateX(0);opacity:1}}@-webkit-keyframes swal2-rotate-loading{0%{transform:rotate(0)}100%{transform:rotate(360deg)}}@keyframes swal2-rotate-loading{0%{transform:rotate(0)}100%{transform:rotate(360deg)}}body.swal2-shown:not(.swal2-no-backdrop):not(.swal2-toast-shown){overflow:hidden}body.swal2-height-auto{height:auto!important}body.swal2-no-backdrop .swal2-container{top:auto;right:auto;bottom:auto;left:auto;max-width:calc(100% - .625em * 2);background-color:transparent!important}body.swal2-no-backdrop .swal2-container>.swal2-modal{box-shadow:0 0 10px rgba(0,0,0,.4)}body.swal2-no-backdrop .swal2-container.swal2-top{top:0;left:50%;transform:translateX(-50%)}body.swal2-no-backdrop .swal2-container.swal2-top-left,body.swal2-no-backdrop .swal2-container.swal2-top-start{top:0;left:0}body.swal2-no-backdrop .swal2-container.swal2-top-end,body.swal2-no-backdrop .swal2-container.swal2-top-right{top:0;right:0}body.swal2-no-backdrop .swal2-container.swal2-center{top:50%;left:50%;transform:translate(-50%,-50%)}body.swal2-no-backdrop .swal2-container.swal2-center-left,body.swal2-no-backdrop .swal2-container.swal2-center-start{top:50%;left:0;transform:translateY(-50%)}body.swal2-no-backdrop .swal2-container.swal2-center-end,body.swal2-no-backdrop .swal2-container.swal2-center-right{top:50%;right:0;transform:translateY(-50%)}body.swal2-no-backdrop .swal2-container.swal2-bottom{bottom:0;left:50%;transform:translateX(-50%)}body.swal2-no-backdrop .swal2-container.swal2-bottom-left,body.swal2-no-backdrop .swal2-container.swal2-bottom-start{bottom:0;left:0}body.swal2-no-backdrop .swal2-container.swal2-bottom-end,body.swal2-no-backdrop .swal2-container.swal2-bottom-right{right:0;bottom:0}@media print{body.swal2-shown:not(.swal2-no-backdrop):not(.swal2-toast-shown){overflow-y:scroll!important}body.swal2-shown:not(.swal2-no-backdrop):not(.swal2-toast-shown)>[aria-hidden=true]{display:none}body.swal2-shown:not(.swal2-no-backdrop):not(.swal2-toast-shown) .swal2-container{position:static!important}}body.swal2-toast-shown .swal2-container{background-color:transparent}body.swal2-toast-shown .swal2-container.swal2-top{top:0;right:auto;bottom:auto;left:50%;transform:translateX(-50%)}body.swal2-toast-shown .swal2-container.swal2-top-end,body.swal2-toast-shown .swal2-container.swal2-top-right{top:0;right:0;bottom:auto;left:auto}body.swal2-toast-shown .swal2-container.swal2-top-left,body.swal2-toast-shown .swal2-container.swal2-top-start{top:0;right:auto;bottom:auto;left:0}body.swal2-toast-shown .swal2-container.swal2-center-left,body.swal2-toast-shown .swal2-container.swal2-center-start{top:50%;right:auto;bottom:auto;left:0;transform:translateY(-50%)}body.swal2-toast-shown .swal2-container.swal2-center{top:50%;right:auto;bottom:auto;left:50%;transform:translate(-50%,-50%)}body.swal2-toast-shown .swal2-container.swal2-center-end,body.swal2-toast-shown .swal2-container.swal2-center-right{top:50%;right:0;bottom:auto;left:auto;transform:translateY(-50%)}body.swal2-toast-shown .swal2-container.swal2-bottom-left,body.swal2-toast-shown .swal2-container.swal2-bottom-start{top:auto;right:auto;bottom:0;left:0}body.swal2-toast-shown .swal2-container.swal2-bottom{top:auto;right:auto;bottom:0;left:50%;transform:translateX(-50%)}body.swal2-toast-shown .swal2-container.swal2-bottom-end,body.swal2-toast-shown .swal2-container.swal2-bottom-right{top:auto;right:0;bottom:0;left:auto}body.swal2-toast-column .swal2-toast{flex-direction:column;align-items:stretch}body.swal2-toast-column .swal2-toast .swal2-actions{flex:1;align-self:stretch;height:2.2em;margin-top:.3125em}body.swal2-toast-column .swal2-toast .swal2-loading{justify-content:center}body.swal2-toast-column .swal2-toast .swal2-input{height:2em;margin:.3125em auto;font-size:1em}body.swal2-toast-column .swal2-toast .swal2-validation-message{font-size:1em}
|
includes/class_clean_cron.php
CHANGED
@@ -157,7 +157,7 @@ class ADBC_Tasks_List extends WP_List_Table {
|
|
157 |
|
158 |
/** WP: Column cb for check box */
|
159 |
function column_cb($item) {
|
160 |
-
return sprintf("<input type='checkbox' name='
|
161 |
}
|
162 |
|
163 |
/** WP: Get bulk actions */
|
@@ -186,58 +186,69 @@ class ADBC_Tasks_List extends WP_List_Table {
|
|
186 |
|
187 |
if($action == 'delete'){
|
188 |
// If the user wants to clean the tasks he/she selected
|
189 |
-
if(isset($_POST['
|
190 |
if(function_exists('is_multisite') && is_multisite()){
|
191 |
// Prepare tasks to delete in organized array to minimize switching from blogs
|
192 |
$tasks_to_delete = array();
|
193 |
-
foreach($_POST['
|
194 |
-
$task_info
|
195 |
-
|
196 |
-
|
|
|
|
|
|
|
|
|
197 |
}
|
198 |
-
array_push($tasks_to_delete[$task_info[0]], $task);
|
199 |
}
|
200 |
// Delete tasks
|
201 |
foreach($tasks_to_delete as $site_id => $tasks_info){
|
202 |
switch_to_blog($site_id);
|
203 |
foreach($tasks_info as $task) {
|
204 |
$aDBc_cron_info = explode("|", $task, 4);
|
205 |
-
$hook
|
206 |
-
|
207 |
-
$
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
208 |
if($args == "none"){
|
209 |
wp_unschedule_event($timestamp, $hook);
|
210 |
}else{
|
211 |
-
$args = unserialize(stripslashes($
|
212 |
wp_unschedule_event($timestamp, $hook, $args);
|
213 |
// Check if the user has deleted a task beloging to this plugin. If so, update his data in DB to inactive
|
214 |
// A task of ADBC cannot be without an arg, not necessary to add this check to "none" args
|
215 |
if($hook == "aDBc_clean_scheduler"){
|
216 |
-
aDBc_update_task_in_db_after_delete($args[0], "aDBc_clean_schedule");
|
217 |
}else if($hook == "aDBc_optimize_scheduler"){
|
218 |
-
aDBc_update_task_in_db_after_delete($args[0], "aDBc_optimize_schedule");
|
219 |
-
}
|
220 |
-
}
|
221 |
-
}
|
222 |
-
restore_current_blog();
|
223 |
-
}
|
224 |
-
}else{
|
225 |
-
foreach($_POST['aDBc_tasks_to_delete'] as $task) {
|
226 |
-
$aDBc_cron_info = explode("|", $task, 4);
|
227 |
-
$hook = $aDBc_cron_info[1];
|
228 |
-
$timestamp = $aDBc_cron_info[2];
|
229 |
-
$args = $aDBc_cron_info[3];
|
230 |
-
if($args == "none"){
|
231 |
-
wp_unschedule_event($timestamp, $hook);
|
232 |
-
}else{
|
233 |
-
$args = unserialize(stripslashes($aDBc_cron_info[3]));
|
234 |
-
wp_unschedule_event($timestamp, $hook, $args);
|
235 |
-
// Check if the user has deleted a task beloging to this plugin. If so, update his data in DB to inactive
|
236 |
-
// A task of ADBC cannot be without an arg, not necessary to add this check to "none" args
|
237 |
-
if($hook == "aDBc_clean_scheduler"){
|
238 |
-
aDBc_update_task_in_db_after_delete($args[0], "aDBc_clean_schedule");
|
239 |
-
}else if($hook == "aDBc_optimize_scheduler"){
|
240 |
-
aDBc_update_task_in_db_after_delete($args[0], "aDBc_optimize_schedule");
|
241 |
}
|
242 |
}
|
243 |
}
|
@@ -388,19 +399,7 @@ class ADBC_Tasks_List extends WP_List_Table {
|
|
388 |
</form>
|
389 |
|
390 |
</div>
|
391 |
-
|
392 |
-
<p class="aDBc-box-warning">
|
393 |
-
<?php echo __('You are about to clean some of your scheduled tasks. This operation is irreversible!','advanced-database-cleaner') . "<span style='color:red'> " . __('Don\'t forget to make a backup of your database first.','advanced-database-cleaner') . "</span>" ; ?>
|
394 |
-
</p>
|
395 |
-
<p>
|
396 |
-
<?php _e('Are you sure to continue?','advanced-database-cleaner'); ?>
|
397 |
-
</p>
|
398 |
-
</div>
|
399 |
-
<div id="aDBc_dialogx" title="<?php _e('Action required','advanced-database-cleaner'); ?>" class="aDBc-jquery-dialog">
|
400 |
-
<p class="aDBc-box-info">
|
401 |
-
<?php _e('Please select an action!','advanced-database-cleaner'); ?>
|
402 |
-
</p>
|
403 |
-
</div>
|
404 |
<?php
|
405 |
}
|
406 |
}
|
157 |
|
158 |
/** WP: Column cb for check box */
|
159 |
function column_cb($item) {
|
160 |
+
return sprintf("<input type='checkbox' name='aDBc_elements_to_process[]' value='%s' />", $item['site_id']."|".$item['hook_name']."|".$item['timestamp']."|".$item['arguments']);
|
161 |
}
|
162 |
|
163 |
/** WP: Get bulk actions */
|
186 |
|
187 |
if($action == 'delete'){
|
188 |
// If the user wants to clean the tasks he/she selected
|
189 |
+
if(isset($_POST['aDBc_elements_to_process'])){
|
190 |
if(function_exists('is_multisite') && is_multisite()){
|
191 |
// Prepare tasks to delete in organized array to minimize switching from blogs
|
192 |
$tasks_to_delete = array();
|
193 |
+
foreach($_POST['aDBc_elements_to_process'] as $task){
|
194 |
+
$task_info = explode("|", $task, 2);
|
195 |
+
$site_id = sanitize_html_class($task_info[0]);
|
196 |
+
if(is_numeric($site_id)){
|
197 |
+
if(empty($tasks_to_delete[$site_id])){
|
198 |
+
$tasks_to_delete[$site_id] = array();
|
199 |
+
}
|
200 |
+
array_push($tasks_to_delete[$site_id], $task);
|
201 |
}
|
|
|
202 |
}
|
203 |
// Delete tasks
|
204 |
foreach($tasks_to_delete as $site_id => $tasks_info){
|
205 |
switch_to_blog($site_id);
|
206 |
foreach($tasks_info as $task) {
|
207 |
$aDBc_cron_info = explode("|", $task, 4);
|
208 |
+
$hook = sanitize_text_field($aDBc_cron_info[1]);
|
209 |
+
// We delete some characters we believe they should not appear in the name: & < > = # ( ) [ ] { } ? " '
|
210 |
+
$hook = preg_replace("/[&<>=#\(\)\[\]\{\}\?\"\' ]/", '', $hook);
|
211 |
+
$timestamp = sanitize_html_class($aDBc_cron_info[2]);
|
212 |
+
$args = sanitize_text_field($aDBc_cron_info[3]);
|
213 |
+
if(is_numeric($timestamp)){
|
214 |
+
if($args == "none"){
|
215 |
+
wp_unschedule_event($timestamp, $hook);
|
216 |
+
}else{
|
217 |
+
$args = unserialize(stripslashes($args));
|
218 |
+
wp_unschedule_event($timestamp, $hook, $args);
|
219 |
+
// Check if the user has deleted a task beloging to this plugin. If so, update his data in DB to inactive
|
220 |
+
// A task of ADBC cannot be without an arg, not necessary to add this check to "none" args
|
221 |
+
if($hook == "aDBc_clean_scheduler"){
|
222 |
+
aDBc_update_task_in_db_after_delete(sanitize_html_class($args[0]), "aDBc_clean_schedule");
|
223 |
+
}else if($hook == "aDBc_optimize_scheduler"){
|
224 |
+
aDBc_update_task_in_db_after_delete(sanitize_html_class($args[0]), "aDBc_optimize_schedule");
|
225 |
+
}
|
226 |
+
}
|
227 |
+
}
|
228 |
+
}
|
229 |
+
restore_current_blog();
|
230 |
+
}
|
231 |
+
}else{
|
232 |
+
foreach($_POST['aDBc_elements_to_process'] as $task){
|
233 |
+
$aDBc_cron_info = explode("|", $task, 4);
|
234 |
+
$hook = sanitize_text_field($aDBc_cron_info[1]);
|
235 |
+
// We delete some characters we believe they should not appear in the name: & < > = # ( ) [ ] { } ? " '
|
236 |
+
$hook = preg_replace("/[&<>=#\(\)\[\]\{\}\?\"\' ]/", '', $hook);
|
237 |
+
$timestamp = sanitize_html_class($aDBc_cron_info[2]);
|
238 |
+
$args = sanitize_text_field($aDBc_cron_info[3]);
|
239 |
+
if(is_numeric($timestamp)){
|
240 |
if($args == "none"){
|
241 |
wp_unschedule_event($timestamp, $hook);
|
242 |
}else{
|
243 |
+
$args = unserialize(stripslashes($args));
|
244 |
wp_unschedule_event($timestamp, $hook, $args);
|
245 |
// Check if the user has deleted a task beloging to this plugin. If so, update his data in DB to inactive
|
246 |
// A task of ADBC cannot be without an arg, not necessary to add this check to "none" args
|
247 |
if($hook == "aDBc_clean_scheduler"){
|
248 |
+
aDBc_update_task_in_db_after_delete(sanitize_html_class($args[0]), "aDBc_clean_schedule");
|
249 |
}else if($hook == "aDBc_optimize_scheduler"){
|
250 |
+
aDBc_update_task_in_db_after_delete(sanitize_html_class($args[0]), "aDBc_optimize_schedule");
|
251 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
252 |
}
|
253 |
}
|
254 |
}
|
399 |
</form>
|
400 |
|
401 |
</div>
|
402 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
403 |
<?php
|
404 |
}
|
405 |
}
|
includes/class_clean_options.php
CHANGED
@@ -160,7 +160,7 @@ class ADBC_Options_List extends WP_List_Table {
|
|
160 |
|
161 |
/** WP: Column cb for check box */
|
162 |
function column_cb($item) {
|
163 |
-
return sprintf('<input type="checkbox" name="
|
164 |
}
|
165 |
|
166 |
/** WP: Get bulk actions */
|
@@ -191,16 +191,22 @@ class ADBC_Options_List extends WP_List_Table {
|
|
191 |
|
192 |
if($action == 'delete'){
|
193 |
// If the user wants to clean the options he/she selected
|
194 |
-
if(isset($_POST['
|
195 |
if(function_exists('is_multisite') && is_multisite()){
|
196 |
// Prepare options to delete in organized array to minimize switching from blogs
|
197 |
$options_to_delete = array();
|
198 |
-
foreach($_POST['
|
199 |
-
$option_info
|
200 |
-
|
201 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
202 |
}
|
203 |
-
array_push($options_to_delete[$option_info[0]], $option_info[1]);
|
204 |
}
|
205 |
// Delete options
|
206 |
foreach($options_to_delete as $site_id => $options){
|
@@ -211,9 +217,12 @@ class ADBC_Options_List extends WP_List_Table {
|
|
211 |
restore_current_blog();
|
212 |
}
|
213 |
}else{
|
214 |
-
foreach($_POST['
|
215 |
-
$aDBc_option_info
|
216 |
-
|
|
|
|
|
|
|
217 |
}
|
218 |
}
|
219 |
// Update the message to show to the user
|
@@ -229,17 +238,23 @@ class ADBC_Options_List extends WP_List_Table {
|
|
229 |
|
230 |
// If the user wants to change autoload to yes for selected options
|
231 |
// yyy, changing autoload using update_option works only on WP 4.2 and newer. Should I set minimum required wp to 4.2 in my plugin header?
|
232 |
-
if(isset($_POST['
|
233 |
$additional_msg = "";
|
234 |
if(function_exists('is_multisite') && is_multisite()){
|
235 |
// Prepare options to process in organized array to minimize switching from blogs
|
236 |
$options_to_process = array();
|
237 |
-
foreach($_POST['
|
238 |
-
$option_info
|
239 |
-
|
240 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
241 |
}
|
242 |
-
array_push($options_to_process[$option_info[0]], $option_info[1]);
|
243 |
}
|
244 |
// Change autoload
|
245 |
foreach($options_to_process as $site_id => $options){
|
@@ -258,16 +273,19 @@ class ADBC_Options_List extends WP_List_Table {
|
|
258 |
restore_current_blog();
|
259 |
}
|
260 |
}else{
|
261 |
-
foreach($_POST['
|
262 |
-
$aDBc_option_info
|
|
|
|
|
|
|
263 |
// In adbc-edd-sample-plugin, EDD deletes aDBc_edd_license_status if aDBc_edd_license_key has been changed
|
264 |
// This means that we should not change its value to prevent this to happen
|
265 |
-
if($
|
266 |
-
$options_value = get_option($
|
267 |
// Wordpress does not allow to change to autoload if the value have not been changed as well
|
268 |
// We should change the value to something such as xyz, then change it back again to its original value
|
269 |
-
update_option($
|
270 |
-
update_option($
|
271 |
}else{
|
272 |
$additional_msg = "<span style='color:orange'>" . __('For technical concerns, the option aDBc_edd_license_key cannot be changed!', 'advanced-database-cleaner') . "</span>";
|
273 |
}
|
@@ -419,19 +437,7 @@ class ADBC_Options_List extends WP_List_Table {
|
|
419 |
</form>
|
420 |
|
421 |
</div>
|
422 |
-
|
423 |
-
<p class="aDBc-box-warning">
|
424 |
-
<?php echo __('You are about to clean some of your options. This operation is irreversible!','advanced-database-cleaner') . "<span style='color:red'> " . __('Don\'t forget to make a backup of your database first.','advanced-database-cleaner') . "</span>" ; ?>
|
425 |
-
</p>
|
426 |
-
<p>
|
427 |
-
<?php _e('Are you sure to continue?','advanced-database-cleaner'); ?>
|
428 |
-
</p>
|
429 |
-
</div>
|
430 |
-
<div id="aDBc_dialogx" title="<?php _e('Action required','advanced-database-cleaner'); ?>" class="aDBc-jquery-dialog">
|
431 |
-
<p class="aDBc-box-info">
|
432 |
-
<?php _e('Please select an action!','advanced-database-cleaner'); ?>
|
433 |
-
</p>
|
434 |
-
</div>
|
435 |
<?php
|
436 |
}
|
437 |
}
|
160 |
|
161 |
/** WP: Column cb for check box */
|
162 |
function column_cb($item) {
|
163 |
+
return sprintf('<input type="checkbox" name="aDBc_elements_to_process[]" value="%s" />', $item['site_id']."|".$item['option_name']);
|
164 |
}
|
165 |
|
166 |
/** WP: Get bulk actions */
|
191 |
|
192 |
if($action == 'delete'){
|
193 |
// If the user wants to clean the options he/she selected
|
194 |
+
if(isset($_POST['aDBc_elements_to_process'])){
|
195 |
if(function_exists('is_multisite') && is_multisite()){
|
196 |
// Prepare options to delete in organized array to minimize switching from blogs
|
197 |
$options_to_delete = array();
|
198 |
+
foreach($_POST['aDBc_elements_to_process'] as $option){
|
199 |
+
$option_info = explode("|", $option);
|
200 |
+
$site_id = sanitize_html_class($option_info[0]);
|
201 |
+
$option_name = sanitize_text_field($option_info[1]);
|
202 |
+
if(is_numeric($site_id)){
|
203 |
+
if(empty($options_to_delete[$site_id])){
|
204 |
+
$options_to_delete[$site_id] = array();
|
205 |
+
}
|
206 |
+
// We delete some characters we believe they should not appear in the name: & < > = # ( ) [ ] { } ? " '
|
207 |
+
$option_name = preg_replace("/[&<>=#\(\)\[\]\{\}\?\"\' ]/", '', $option_name);
|
208 |
+
array_push($options_to_delete[$site_id], $option_name);
|
209 |
}
|
|
|
210 |
}
|
211 |
// Delete options
|
212 |
foreach($options_to_delete as $site_id => $options){
|
217 |
restore_current_blog();
|
218 |
}
|
219 |
}else{
|
220 |
+
foreach($_POST['aDBc_elements_to_process'] as $option) {
|
221 |
+
$aDBc_option_info = explode("|", $option);
|
222 |
+
$option_name = sanitize_text_field($aDBc_option_info[1]);
|
223 |
+
// We delete some characters we believe they should not appear in the name: & < > = # ( ) [ ] { } ? " '
|
224 |
+
$option_name = preg_replace("/[&<>=#\(\)\[\]\{\}\?\"\' ]/", '', $option_name);
|
225 |
+
delete_option($option_name);
|
226 |
}
|
227 |
}
|
228 |
// Update the message to show to the user
|
238 |
|
239 |
// If the user wants to change autoload to yes for selected options
|
240 |
// yyy, changing autoload using update_option works only on WP 4.2 and newer. Should I set minimum required wp to 4.2 in my plugin header?
|
241 |
+
if(isset($_POST['aDBc_elements_to_process'])){
|
242 |
$additional_msg = "";
|
243 |
if(function_exists('is_multisite') && is_multisite()){
|
244 |
// Prepare options to process in organized array to minimize switching from blogs
|
245 |
$options_to_process = array();
|
246 |
+
foreach($_POST['aDBc_elements_to_process'] as $option){
|
247 |
+
$option_info = explode("|", $option);
|
248 |
+
$site_id = sanitize_html_class($option_info[0]);
|
249 |
+
$option_name = sanitize_text_field($option_info[1]);
|
250 |
+
if(is_numeric($site_id)){
|
251 |
+
if(empty($options_to_process[$site_id])){
|
252 |
+
$options_to_process[$site_id] = array();
|
253 |
+
}
|
254 |
+
// We delete some characters we believe they should not appear in the name: & < > = # ( ) [ ] { } ? " '
|
255 |
+
$option_name = preg_replace("/[&<>=#\(\)\[\]\{\}\?\"\' ]/", '', $option_name);
|
256 |
+
array_push($options_to_process[$site_id], $option_name);
|
257 |
}
|
|
|
258 |
}
|
259 |
// Change autoload
|
260 |
foreach($options_to_process as $site_id => $options){
|
273 |
restore_current_blog();
|
274 |
}
|
275 |
}else{
|
276 |
+
foreach($_POST['aDBc_elements_to_process'] as $option) {
|
277 |
+
$aDBc_option_info = explode("|", $option);
|
278 |
+
$option_name = sanitize_text_field($aDBc_option_info[1]);
|
279 |
+
// We delete some characters we believe they should not appear in the name: & < > = # ( ) [ ] { } ? " '
|
280 |
+
$option_name = preg_replace("/[&<>=#\(\)\[\]\{\}\?\"\' ]/", '', $option_name);
|
281 |
// In adbc-edd-sample-plugin, EDD deletes aDBc_edd_license_status if aDBc_edd_license_key has been changed
|
282 |
// This means that we should not change its value to prevent this to happen
|
283 |
+
if($option_name != "aDBc_edd_license_key"){
|
284 |
+
$options_value = get_option($option_name);
|
285 |
// Wordpress does not allow to change to autoload if the value have not been changed as well
|
286 |
// We should change the value to something such as xyz, then change it back again to its original value
|
287 |
+
update_option($option_name, "xyz");
|
288 |
+
update_option($option_name, $options_value, $autoload_value);
|
289 |
}else{
|
290 |
$additional_msg = "<span style='color:orange'>" . __('For technical concerns, the option aDBc_edd_license_key cannot be changed!', 'advanced-database-cleaner') . "</span>";
|
291 |
}
|
437 |
</form>
|
438 |
|
439 |
</div>
|
440 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
441 |
<?php
|
442 |
}
|
443 |
}
|
includes/class_clean_tables.php
CHANGED
@@ -72,11 +72,12 @@ class ADBC_Tables_List extends WP_List_Table {
|
|
72 |
return; //get out if we didn't click the delete link
|
73 |
|
74 |
// We delete the schedule
|
75 |
-
|
|
|
76 |
|
77 |
// We delete the item from database
|
78 |
$aDBc_schedules = get_option('aDBc_optimize_schedule');
|
79 |
-
unset($aDBc_schedules[$
|
80 |
update_option('aDBc_optimize_schedule', $aDBc_schedules, "no");
|
81 |
|
82 |
$this->aDBc_message = __('The clean-up schedule deleted successfully!', 'advanced-database-cleaner');
|
@@ -241,7 +242,7 @@ class ADBC_Tables_List extends WP_List_Table {
|
|
241 |
|
242 |
/** WP: Column cb for check box */
|
243 |
function column_cb($item) {
|
244 |
-
return sprintf('<input type="checkbox" name="
|
245 |
}
|
246 |
|
247 |
/** WP: Get bulk actions */
|
@@ -277,12 +278,17 @@ class ADBC_Tables_List extends WP_List_Table {
|
|
277 |
|
278 |
if($action == 'delete'){
|
279 |
// If the user wants to clean the tables he/she selected
|
280 |
-
if(isset($_POST['
|
281 |
global $wpdb;
|
282 |
-
foreach($_POST['
|
283 |
-
$table_info
|
284 |
-
$
|
285 |
-
|
|
|
|
|
|
|
|
|
|
|
286 |
}
|
287 |
// After deleting tables, delete names also from file categorization
|
288 |
if(ADBC_PLUGIN_F_TYPE == "pro"){
|
@@ -294,34 +300,46 @@ class ADBC_Tables_List extends WP_List_Table {
|
|
294 |
}
|
295 |
}else if($action == 'optimize'){
|
296 |
// If the user wants to optimize the tables he/she selected
|
297 |
-
if(isset($_POST['
|
298 |
global $wpdb;
|
299 |
-
foreach($_POST['
|
300 |
-
$table_info
|
301 |
-
$
|
|
|
|
|
|
|
|
|
302 |
}
|
303 |
// Update the message to show to the user
|
304 |
$this->aDBc_message = __('Selected tables optimized successfully!', 'advanced-database-cleaner');
|
305 |
}
|
306 |
}else if($action == 'empty'){
|
307 |
// If the user wants to empty the tables he/she selected
|
308 |
-
if(isset($_POST['
|
309 |
global $wpdb;
|
310 |
-
foreach($_POST['
|
311 |
-
$table_info
|
312 |
-
$
|
|
|
|
|
|
|
|
|
313 |
}
|
314 |
// Update the message to show to the user
|
315 |
$this->aDBc_message = __('Selected tables emptied successfully!', 'advanced-database-cleaner');
|
316 |
}
|
317 |
}else if($action == 'repair'){
|
318 |
// If the user wants to repair the tables he/she selected
|
319 |
-
if(isset($_POST['
|
320 |
global $wpdb;
|
321 |
$cannot_repair = 0;
|
322 |
-
foreach($_POST['
|
323 |
-
$table_info
|
324 |
-
$
|
|
|
|
|
|
|
|
|
325 |
foreach($query_result as $row){
|
326 |
if($row->Msg_type == 'error'){
|
327 |
if(preg_match('/corrupt/i', $row->Msg_text)){
|
@@ -613,29 +631,8 @@ class ADBC_Tables_List extends WP_List_Table {
|
|
613 |
|
614 |
<div class="aDBc-clear-both"></div>
|
615 |
|
616 |
-
</div>
|
617 |
-
|
618 |
-
<div id="aDBc_dialog1" title="<?php _e('Cleaning...','advanced-database-cleaner'); ?>" class="aDBc-jquery-dialog">
|
619 |
-
<p class="aDBc-box-warning">
|
620 |
-
<?php echo __('You are about to delete some of your tables. This operation is irreversible!','advanced-database-cleaner') . "<span style='color:red'> " . __('Don\'t forget to make a backup of your database first.','advanced-database-cleaner') . "</span>" ; ?>
|
621 |
-
</p>
|
622 |
-
<p>
|
623 |
-
<?php _e('Are you sure to continue?','advanced-database-cleaner'); ?>
|
624 |
-
</p>
|
625 |
-
</div>
|
626 |
-
<div id="aDBc_dialog2" title="<?php _e('Cleaning...','advanced-database-cleaner'); ?>" class="aDBc-jquery-dialog">
|
627 |
-
<p class="aDBc-box-warning">
|
628 |
-
<?php echo __('You are about to empty some of your tables. This operation is irreversible!','advanced-database-cleaner') . "<span style='color:red'> " . __('Don\'t forget to make a backup of your database first.','advanced-database-cleaner') . "</span>" ; ?>
|
629 |
-
</p>
|
630 |
-
<p>
|
631 |
-
<?php _e('Are you sure to continue?','advanced-database-cleaner'); ?>
|
632 |
-
</p>
|
633 |
-
</div>
|
634 |
-
<div id="aDBc_dialogx" title="<?php _e('Action required','advanced-database-cleaner'); ?>" class="aDBc-jquery-dialog">
|
635 |
-
<p class="aDBc-box-info">
|
636 |
-
<?php _e('Please choose an action!','advanced-database-cleaner'); ?>
|
637 |
-
</p>
|
638 |
-
</div>
|
639 |
<?php
|
640 |
}
|
641 |
}
|
72 |
return; //get out if we didn't click the delete link
|
73 |
|
74 |
// We delete the schedule
|
75 |
+
$aDBc_sanitized_schedule_name = sanitize_html_class($_POST['aDBc_delete_schedule']);
|
76 |
+
wp_clear_scheduled_hook('aDBc_optimize_scheduler', array($aDBc_sanitized_schedule_name));
|
77 |
|
78 |
// We delete the item from database
|
79 |
$aDBc_schedules = get_option('aDBc_optimize_schedule');
|
80 |
+
unset($aDBc_schedules[$aDBc_sanitized_schedule_name]);
|
81 |
update_option('aDBc_optimize_schedule', $aDBc_schedules, "no");
|
82 |
|
83 |
$this->aDBc_message = __('The clean-up schedule deleted successfully!', 'advanced-database-cleaner');
|
242 |
|
243 |
/** WP: Column cb for check box */
|
244 |
function column_cb($item) {
|
245 |
+
return sprintf('<input type="checkbox" name="aDBc_elements_to_process[]" value="%s" />', $item['table_prefix']."|".$item['table_name']);
|
246 |
}
|
247 |
|
248 |
/** WP: Get bulk actions */
|
278 |
|
279 |
if($action == 'delete'){
|
280 |
// If the user wants to clean the tables he/she selected
|
281 |
+
if(isset($_POST['aDBc_elements_to_process'])){
|
282 |
global $wpdb;
|
283 |
+
foreach($_POST['aDBc_elements_to_process'] as $table){
|
284 |
+
$table_info = explode("|", $table);
|
285 |
+
$table_prefix = sanitize_html_class($table_info[0]);
|
286 |
+
$table_name = sanitize_text_field($table_info[1]);
|
287 |
+
// We delete some characters we believe they should not appear in the name: & < > = # ( ) [ ] { } ? " '
|
288 |
+
$table_name = preg_replace("/[&<>=#\(\)\[\]\{\}\?\"\' ]/", '', $table_name);
|
289 |
+
if($wpdb->query("DROP TABLE " . $table_prefix . $table_name)){
|
290 |
+
array_push($names_deleted, $table_name);
|
291 |
+
}
|
292 |
}
|
293 |
// After deleting tables, delete names also from file categorization
|
294 |
if(ADBC_PLUGIN_F_TYPE == "pro"){
|
300 |
}
|
301 |
}else if($action == 'optimize'){
|
302 |
// If the user wants to optimize the tables he/she selected
|
303 |
+
if(isset($_POST['aDBc_elements_to_process'])){
|
304 |
global $wpdb;
|
305 |
+
foreach($_POST['aDBc_elements_to_process'] as $table) {
|
306 |
+
$table_info = explode("|", $table);
|
307 |
+
$table_prefix = sanitize_html_class($table_info[0]);
|
308 |
+
$table_name = sanitize_text_field($table_info[1]);
|
309 |
+
// We delete some characters we believe they should not appear in the name: & < > = # ( ) [ ] { } ? " '
|
310 |
+
$table_name = preg_replace("/[&<>=#\(\)\[\]\{\}\?\"\' ]/", '', $table_name);
|
311 |
+
$wpdb->query("OPTIMIZE TABLE " . $table_prefix . $table_name);
|
312 |
}
|
313 |
// Update the message to show to the user
|
314 |
$this->aDBc_message = __('Selected tables optimized successfully!', 'advanced-database-cleaner');
|
315 |
}
|
316 |
}else if($action == 'empty'){
|
317 |
// If the user wants to empty the tables he/she selected
|
318 |
+
if(isset($_POST['aDBc_elements_to_process'])){
|
319 |
global $wpdb;
|
320 |
+
foreach($_POST['aDBc_elements_to_process'] as $table) {
|
321 |
+
$table_info = explode("|", $table);
|
322 |
+
$table_prefix = sanitize_html_class($table_info[0]);
|
323 |
+
$table_name = sanitize_text_field($table_info[1]);
|
324 |
+
// We delete some characters we believe they should not appear in the name: & < > = # ( ) [ ] { } ? " '
|
325 |
+
$table_name = preg_replace("/[&<>=#\(\)\[\]\{\}\?\"\' ]/", '', $table_name);
|
326 |
+
$wpdb->query("TRUNCATE TABLE " . $table_prefix . $table_name);
|
327 |
}
|
328 |
// Update the message to show to the user
|
329 |
$this->aDBc_message = __('Selected tables emptied successfully!', 'advanced-database-cleaner');
|
330 |
}
|
331 |
}else if($action == 'repair'){
|
332 |
// If the user wants to repair the tables he/she selected
|
333 |
+
if(isset($_POST['aDBc_elements_to_process'])){
|
334 |
global $wpdb;
|
335 |
$cannot_repair = 0;
|
336 |
+
foreach($_POST['aDBc_elements_to_process'] as $table) {
|
337 |
+
$table_info = explode("|", $table);
|
338 |
+
$table_prefix = sanitize_html_class($table_info[0]);
|
339 |
+
$table_name = sanitize_text_field($table_info[1]);
|
340 |
+
// We delete some characters we believe they should not appear in the name: & < > = # ( ) [ ] { } ? " '
|
341 |
+
$table_name = preg_replace("/[&<>=#\(\)\[\]\{\}\?\"\' ]/", '', $table_name);
|
342 |
+
$query_result = $wpdb->get_results("REPAIR TABLE " . $table_prefix . $table_name);
|
343 |
foreach($query_result as $row){
|
344 |
if($row->Msg_type == 'error'){
|
345 |
if(preg_match('/corrupt/i', $row->Msg_text)){
|
631 |
|
632 |
<div class="aDBc-clear-both"></div>
|
633 |
|
634 |
+
</div>
|
635 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
636 |
<?php
|
637 |
}
|
638 |
}
|
includes/class_general_cleanup.php
CHANGED
@@ -32,35 +32,40 @@ class ADBC_Clean_DB_List extends WP_List_Table {
|
|
32 |
return; //get out if we didn't click the delete link
|
33 |
|
34 |
// We delete the schedule
|
35 |
-
|
|
|
36 |
|
37 |
// We delete the item from database
|
38 |
$aDBc_schedules = get_option('aDBc_clean_schedule');
|
39 |
-
unset($aDBc_schedules[$
|
40 |
update_option('aDBc_clean_schedule', $aDBc_schedules, "no");
|
41 |
|
42 |
$this->aDBc_message = __('The clean-up schedule deleted successfully!', 'advanced-database-cleaner');
|
43 |
-
}
|
44 |
|
45 |
// Test if user wants to edit keep_last column for an item
|
46 |
if(isset($_POST['aDBc_keep_input'])){
|
47 |
-
|
|
|
|
|
|
|
|
|
48 |
if(empty($settings['keep_last'])){
|
49 |
-
$keep_value = array($
|
50 |
}else{
|
51 |
$keep_value = $settings['keep_last'];
|
52 |
-
$keep_value[$
|
53 |
}
|
54 |
$settings['keep_last'] = $keep_value;
|
55 |
update_option('aDBc_settings', $settings, "no");
|
56 |
-
|
57 |
// Test if the items belongs to a scheduled task. If so, show msg differently
|
58 |
$aDBc_schedules = get_option('aDBc_clean_schedule');
|
59 |
$aDBc_schedules = is_array($aDBc_schedules) ? $aDBc_schedules : array();
|
60 |
$msg_keep_last = __("The 'keep last' value saved successfully!", "advanced-database-cleaner");
|
61 |
foreach($aDBc_schedules as $hook_name => $hook_params){
|
62 |
$lits_of_elements = $hook_params['elements_to_clean'];
|
63 |
-
if(in_array
|
64 |
$msg_keep_last = __("The 'keep last' value saved successfully!", "advanced-database-cleaner") . " <span style='color:orange'>" . __("Please keep in mind that this will change the value of 'keep last' of your corresponding scheduled tasks as well!", "advanced-database-cleaner") . "</span>";
|
65 |
break;
|
66 |
}
|
@@ -68,8 +73,6 @@ class ADBC_Clean_DB_List extends WP_List_Table {
|
|
68 |
|
69 |
$this->aDBc_message = $msg_keep_last;
|
70 |
}
|
71 |
-
// yyy should this $wpdb be cleaned?
|
72 |
-
global $wpdb;
|
73 |
|
74 |
// Process bulk action if any before preparing elements to clean
|
75 |
$this->process_bulk_action();
|
@@ -238,7 +241,7 @@ class ADBC_Clean_DB_List extends WP_List_Table {
|
|
238 |
|
239 |
/** WP: Column cb for check box */
|
240 |
function column_cb($item) {
|
241 |
-
return sprintf('<input id="checkbox_%s" type="checkbox" name="
|
242 |
}
|
243 |
|
244 |
/** WP: Get bulk actions */
|
@@ -265,13 +268,20 @@ class ADBC_Clean_DB_List extends WP_List_Table {
|
|
265 |
}
|
266 |
$action = $this->current_action();
|
267 |
if($action == 'clean'){
|
|
|
268 |
// If the user wants to clean the elements he/she selected
|
269 |
-
if(isset($_POST['
|
270 |
-
|
271 |
-
|
272 |
-
|
273 |
-
|
|
|
|
|
|
|
|
|
|
|
274 |
}
|
|
|
275 |
// Update the message to show to the user
|
276 |
$this->aDBc_message = __('Selected elements successfully cleaned!', 'advanced-database-cleaner');
|
277 |
}
|
@@ -395,19 +405,6 @@ class ADBC_Clean_DB_List extends WP_List_Table {
|
|
395 |
</div>
|
396 |
<div class="aDBc-clear-both"></div>
|
397 |
</div>
|
398 |
-
<div id="aDBc_dialog1" title="<?php _e('Cleaning...','advanced-database-cleaner'); ?>" class="aDBc-jquery-dialog">
|
399 |
-
<p class="aDBc-box-warning">
|
400 |
-
<?php echo __('You are about to clean some of your unused data. This operation is irreversible!','advanced-database-cleaner') . "<span style='color:red'> " . __('Don\'t forget to make a backup of your database first.','advanced-database-cleaner') . "</span>" ; ?>
|
401 |
-
</p>
|
402 |
-
<p>
|
403 |
-
<?php _e('Are you sure to continue?','advanced-database-cleaner'); ?>
|
404 |
-
</p>
|
405 |
-
</div>
|
406 |
-
<div id="aDBc_dialogx" title="<?php _e('Action required','advanced-database-cleaner'); ?>" class="aDBc-jquery-dialog">
|
407 |
-
<p class="aDBc-box-info">
|
408 |
-
<?php _e('Please select an action!','advanced-database-cleaner'); ?>
|
409 |
-
</p>
|
410 |
-
</div>
|
411 |
|
412 |
<?php
|
413 |
}
|
32 |
return; //get out if we didn't click the delete link
|
33 |
|
34 |
// We delete the schedule
|
35 |
+
$aDBc_sanitized_schedule_name = sanitize_html_class($_POST['aDBc_delete_schedule']);
|
36 |
+
wp_clear_scheduled_hook('aDBc_clean_scheduler', array($aDBc_sanitized_schedule_name));
|
37 |
|
38 |
// We delete the item from database
|
39 |
$aDBc_schedules = get_option('aDBc_clean_schedule');
|
40 |
+
unset($aDBc_schedules[$aDBc_sanitized_schedule_name]);
|
41 |
update_option('aDBc_clean_schedule', $aDBc_schedules, "no");
|
42 |
|
43 |
$this->aDBc_message = __('The clean-up schedule deleted successfully!', 'advanced-database-cleaner');
|
44 |
+
}
|
45 |
|
46 |
// Test if user wants to edit keep_last column for an item
|
47 |
if(isset($_POST['aDBc_keep_input'])){
|
48 |
+
|
49 |
+
$sanitized_keep_input = sanitize_html_class($_POST['aDBc_keep_input']);
|
50 |
+
$sanitized_item_keep_to_edit = sanitize_html_class($_POST['aDBc_item_keep_to_edit']);
|
51 |
+
$settings = get_option('aDBc_settings');
|
52 |
+
|
53 |
if(empty($settings['keep_last'])){
|
54 |
+
$keep_value = array($sanitized_item_keep_to_edit => intval($sanitized_keep_input));
|
55 |
}else{
|
56 |
$keep_value = $settings['keep_last'];
|
57 |
+
$keep_value[$sanitized_item_keep_to_edit] = intval($sanitized_keep_input);
|
58 |
}
|
59 |
$settings['keep_last'] = $keep_value;
|
60 |
update_option('aDBc_settings', $settings, "no");
|
61 |
+
|
62 |
// Test if the items belongs to a scheduled task. If so, show msg differently
|
63 |
$aDBc_schedules = get_option('aDBc_clean_schedule');
|
64 |
$aDBc_schedules = is_array($aDBc_schedules) ? $aDBc_schedules : array();
|
65 |
$msg_keep_last = __("The 'keep last' value saved successfully!", "advanced-database-cleaner");
|
66 |
foreach($aDBc_schedules as $hook_name => $hook_params){
|
67 |
$lits_of_elements = $hook_params['elements_to_clean'];
|
68 |
+
if(in_array($sanitized_item_keep_to_edit, $lits_of_elements)){
|
69 |
$msg_keep_last = __("The 'keep last' value saved successfully!", "advanced-database-cleaner") . " <span style='color:orange'>" . __("Please keep in mind that this will change the value of 'keep last' of your corresponding scheduled tasks as well!", "advanced-database-cleaner") . "</span>";
|
70 |
break;
|
71 |
}
|
73 |
|
74 |
$this->aDBc_message = $msg_keep_last;
|
75 |
}
|
|
|
|
|
76 |
|
77 |
// Process bulk action if any before preparing elements to clean
|
78 |
$this->process_bulk_action();
|
241 |
|
242 |
/** WP: Column cb for check box */
|
243 |
function column_cb($item) {
|
244 |
+
return sprintf('<input id="checkbox_%s" type="checkbox" name="aDBc_elements_to_process[]" value="%s" />', $item['type'], $item['type']);
|
245 |
}
|
246 |
|
247 |
/** WP: Get bulk actions */
|
268 |
}
|
269 |
$action = $this->current_action();
|
270 |
if($action == 'clean'){
|
271 |
+
|
272 |
// If the user wants to clean the elements he/she selected
|
273 |
+
if(isset($_POST['aDBc_elements_to_process'])){
|
274 |
+
|
275 |
+
// Create an array containing allowed elements_types to clean for security
|
276 |
+
$aDBc_allowed_types = array("revision", "auto-draft", "trash-posts", "moderated-comments", "spam-comments", "trash-comments", "pingbacks", "trackbacks", "orphan-postmeta", "orphan-commentmeta", "orphan-relationships", "orphan-usermeta", "orphan-termmeta", "expired-transients");
|
277 |
+
|
278 |
+
foreach($_POST['aDBc_elements_to_process'] as $element){
|
279 |
+
$aDBc_sanitized_element = sanitize_html_class($element);
|
280 |
+
if(in_array($aDBc_sanitized_element, $aDBc_allowed_types)){
|
281 |
+
aDBc_clean_all_elements_type($aDBc_sanitized_element);
|
282 |
+
}
|
283 |
}
|
284 |
+
|
285 |
// Update the message to show to the user
|
286 |
$this->aDBc_message = __('Selected elements successfully cleaned!', 'advanced-database-cleaner');
|
287 |
}
|
405 |
</div>
|
406 |
<div class="aDBc-clear-both"></div>
|
407 |
</div>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
408 |
|
409 |
<?php
|
410 |
}
|
includes/custom-clean-view/class_clean_comment.php
CHANGED
@@ -234,7 +234,7 @@ class ADBC_Clean_Comment extends WP_List_Table {
|
|
234 |
|
235 |
/** WP: Column cb for check box */
|
236 |
function column_cb($item) {
|
237 |
-
return sprintf('<input type="checkbox" name="
|
238 |
}
|
239 |
|
240 |
/** WP: Get bulk actions */
|
@@ -262,16 +262,21 @@ class ADBC_Clean_Comment extends WP_List_Table {
|
|
262 |
$action = $this->current_action();
|
263 |
if($action == 'clean'){
|
264 |
// If the user wants to clean the elements he/she selected
|
265 |
-
if(isset($_POST['
|
266 |
if(function_exists('is_multisite') && is_multisite()){
|
267 |
// Prepare elements to delete
|
268 |
$elements_to_delete = array();
|
269 |
-
foreach($_POST['
|
270 |
-
$element_info
|
271 |
-
|
272 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
273 |
}
|
274 |
-
array_push($elements_to_delete[$element_info[0]], $element_info[1]);
|
275 |
}
|
276 |
// Delete elements
|
277 |
foreach($elements_to_delete as $site_id => $elements_ids){
|
@@ -284,9 +289,12 @@ class ADBC_Clean_Comment extends WP_List_Table {
|
|
284 |
}
|
285 |
}else{
|
286 |
global $wpdb;
|
287 |
-
foreach($_POST['
|
288 |
$element_info = explode("|", $element);
|
289 |
-
$
|
|
|
|
|
|
|
290 |
}
|
291 |
}
|
292 |
// Update the message to show to the user
|
234 |
|
235 |
/** WP: Column cb for check box */
|
236 |
function column_cb($item) {
|
237 |
+
return sprintf('<input type="checkbox" name="aDBc_elements_to_process[]" value="%s" />', $item['site_id']."|".$item['comment_id']);
|
238 |
}
|
239 |
|
240 |
/** WP: Get bulk actions */
|
262 |
$action = $this->current_action();
|
263 |
if($action == 'clean'){
|
264 |
// If the user wants to clean the elements he/she selected
|
265 |
+
if(isset($_POST['aDBc_elements_to_process'])){
|
266 |
if(function_exists('is_multisite') && is_multisite()){
|
267 |
// Prepare elements to delete
|
268 |
$elements_to_delete = array();
|
269 |
+
foreach($_POST['aDBc_elements_to_process'] as $element){
|
270 |
+
$element_info = explode("|", $element);
|
271 |
+
$sanitized_site_id = sanitize_html_class($element_info[0]);
|
272 |
+
$sanitized_item_id = sanitize_html_class($element_info[1]);
|
273 |
+
// For security, we only proceed if both parts are clean and are numbers
|
274 |
+
if(is_numeric($sanitized_site_id) && is_numeric($sanitized_item_id)){
|
275 |
+
if(empty($elements_to_delete[$sanitized_site_id])){
|
276 |
+
$elements_to_delete[$sanitized_site_id] = array();
|
277 |
+
}
|
278 |
+
array_push($elements_to_delete[$sanitized_site_id], $sanitized_item_id);
|
279 |
}
|
|
|
280 |
}
|
281 |
// Delete elements
|
282 |
foreach($elements_to_delete as $site_id => $elements_ids){
|
289 |
}
|
290 |
}else{
|
291 |
global $wpdb;
|
292 |
+
foreach($_POST['aDBc_elements_to_process'] as $element) {
|
293 |
$element_info = explode("|", $element);
|
294 |
+
$sanitized_id = sanitize_html_class($element_info[1]);
|
295 |
+
if(is_numeric($sanitized_id)){
|
296 |
+
$wpdb->query("DELETE FROM $wpdb->comments WHERE comment_ID = " . $sanitized_id);
|
297 |
+
}
|
298 |
}
|
299 |
}
|
300 |
// Update the message to show to the user
|
includes/custom-clean-view/class_clean_meta_comment_post_user_term.php
CHANGED
@@ -218,7 +218,7 @@ class ADBC_Clean_Meta_Comment_Post_User_Term extends WP_List_Table {
|
|
218 |
|
219 |
/** WP: Column cb for check box */
|
220 |
function column_cb($item) {
|
221 |
-
return sprintf('<input type="checkbox" name="
|
222 |
}
|
223 |
|
224 |
/** WP: Get bulk actions */
|
@@ -246,16 +246,21 @@ class ADBC_Clean_Meta_Comment_Post_User_Term extends WP_List_Table {
|
|
246 |
$action = $this->current_action();
|
247 |
if($action == 'clean'){
|
248 |
// If the user wants to clean the elements he/she selected
|
249 |
-
if(isset($_POST['
|
250 |
if(function_exists('is_multisite') && is_multisite()){
|
251 |
// Prepare meta to delete
|
252 |
$meta_to_delete = array();
|
253 |
-
foreach($_POST['
|
254 |
-
$meta_info
|
255 |
-
|
256 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
257 |
}
|
258 |
-
array_push($meta_to_delete[$meta_info[0]], $meta_info[1]);
|
259 |
}
|
260 |
// Delete meta
|
261 |
foreach($meta_to_delete as $site_id => $meta_ids){
|
@@ -270,9 +275,12 @@ class ADBC_Clean_Meta_Comment_Post_User_Term extends WP_List_Table {
|
|
270 |
}else{
|
271 |
global $wpdb;
|
272 |
$table_name = $wpdb->prefix . $this->aDBc_delete_from_table;
|
273 |
-
foreach($_POST['
|
274 |
-
$meta_info
|
275 |
-
$
|
|
|
|
|
|
|
276 |
}
|
277 |
}
|
278 |
// Update the message to show to the user
|
218 |
|
219 |
/** WP: Column cb for check box */
|
220 |
function column_cb($item) {
|
221 |
+
return sprintf('<input type="checkbox" name="aDBc_elements_to_process[]" value="%s" />', $item['site_id']."|".$item['meta_id']);
|
222 |
}
|
223 |
|
224 |
/** WP: Get bulk actions */
|
246 |
$action = $this->current_action();
|
247 |
if($action == 'clean'){
|
248 |
// If the user wants to clean the elements he/she selected
|
249 |
+
if(isset($_POST['aDBc_elements_to_process'])){
|
250 |
if(function_exists('is_multisite') && is_multisite()){
|
251 |
// Prepare meta to delete
|
252 |
$meta_to_delete = array();
|
253 |
+
foreach($_POST['aDBc_elements_to_process'] as $meta){
|
254 |
+
$meta_info = explode("|", $meta);
|
255 |
+
$sanitized_site_id = sanitize_html_class($meta_info[0]);
|
256 |
+
$sanitized_item_id = sanitize_html_class($meta_info[1]);
|
257 |
+
// For security, we only proceed if both parts are clean and are numbers
|
258 |
+
if(is_numeric($sanitized_site_id) && is_numeric($sanitized_item_id)){
|
259 |
+
if(empty($meta_to_delete[$sanitized_site_id])){
|
260 |
+
$meta_to_delete[$sanitized_site_id] = array();
|
261 |
+
}
|
262 |
+
array_push($meta_to_delete[$sanitized_site_id], $sanitized_item_id);
|
263 |
}
|
|
|
264 |
}
|
265 |
// Delete meta
|
266 |
foreach($meta_to_delete as $site_id => $meta_ids){
|
275 |
}else{
|
276 |
global $wpdb;
|
277 |
$table_name = $wpdb->prefix . $this->aDBc_delete_from_table;
|
278 |
+
foreach($_POST['aDBc_elements_to_process'] as $meta) {
|
279 |
+
$meta_info = explode("|", $meta);
|
280 |
+
$sanitized_id = sanitize_html_class($meta_info[1]);
|
281 |
+
if(is_numeric($sanitized_id)){
|
282 |
+
$wpdb->query("DELETE FROM $table_name WHERE $this->aDBc_metaid_or_umetaid = " . $sanitized_id);
|
283 |
+
}
|
284 |
}
|
285 |
}
|
286 |
// Update the message to show to the user
|
includes/custom-clean-view/class_clean_relationships.php
CHANGED
@@ -168,7 +168,7 @@ class ADBC_Clean_Relationship extends WP_List_Table {
|
|
168 |
|
169 |
/** WP: Column cb for check box */
|
170 |
function column_cb($item) {
|
171 |
-
return sprintf('<input type="checkbox" name="
|
172 |
}
|
173 |
|
174 |
/** WP: Get bulk actions */
|
@@ -196,16 +196,21 @@ class ADBC_Clean_Relationship extends WP_List_Table {
|
|
196 |
$action = $this->current_action();
|
197 |
if($action == 'clean'){
|
198 |
// If the user wants to clean the elements he/she selected
|
199 |
-
if(isset($_POST['
|
200 |
if(function_exists('is_multisite') && is_multisite()){
|
201 |
// Prepare relationships to delete
|
202 |
$relationships_to_delete = array();
|
203 |
-
foreach($_POST['
|
204 |
-
$relationship_info
|
205 |
-
|
206 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
207 |
}
|
208 |
-
array_push($relationships_to_delete[$relationship_info[0]], $relationship_info[1]);
|
209 |
}
|
210 |
// Delete relationships
|
211 |
foreach($relationships_to_delete as $site_id => $object_ids){
|
@@ -218,9 +223,12 @@ class ADBC_Clean_Relationship extends WP_List_Table {
|
|
218 |
}
|
219 |
}else{
|
220 |
global $wpdb;
|
221 |
-
foreach($_POST['
|
222 |
-
$relationship_info
|
223 |
-
$
|
|
|
|
|
|
|
224 |
}
|
225 |
}
|
226 |
// Update the message to show to the user
|
168 |
|
169 |
/** WP: Column cb for check box */
|
170 |
function column_cb($item) {
|
171 |
+
return sprintf('<input type="checkbox" name="aDBc_elements_to_process[]" value="%s" />', $item['site_id']."|".$item['object_id']);
|
172 |
}
|
173 |
|
174 |
/** WP: Get bulk actions */
|
196 |
$action = $this->current_action();
|
197 |
if($action == 'clean'){
|
198 |
// If the user wants to clean the elements he/she selected
|
199 |
+
if(isset($_POST['aDBc_elements_to_process'])){
|
200 |
if(function_exists('is_multisite') && is_multisite()){
|
201 |
// Prepare relationships to delete
|
202 |
$relationships_to_delete = array();
|
203 |
+
foreach($_POST['aDBc_elements_to_process'] as $relationship){
|
204 |
+
$relationship_info = explode("|", $relationship);
|
205 |
+
$sanitized_site_id = sanitize_html_class($relationship_info[0]);
|
206 |
+
$sanitized_item_id = sanitize_html_class($relationship_info[1]);
|
207 |
+
// For security, we only proceed if both parts are clean and are numbers
|
208 |
+
if(is_numeric($sanitized_site_id) && is_numeric($sanitized_item_id)){
|
209 |
+
if(empty($relationships_to_delete[$sanitized_site_id])){
|
210 |
+
$relationships_to_delete[$sanitized_site_id] = array();
|
211 |
+
}
|
212 |
+
array_push($relationships_to_delete[$sanitized_site_id], $sanitized_item_id);
|
213 |
}
|
|
|
214 |
}
|
215 |
// Delete relationships
|
216 |
foreach($relationships_to_delete as $site_id => $object_ids){
|
223 |
}
|
224 |
}else{
|
225 |
global $wpdb;
|
226 |
+
foreach($_POST['aDBc_elements_to_process'] as $relationship){
|
227 |
+
$relationship_info = explode("|", $relationship);
|
228 |
+
$sanitized_id = sanitize_html_class($relationship_info[1]);
|
229 |
+
if(is_numeric($sanitized_id)){
|
230 |
+
$wpdb->query("DELETE FROM $wpdb->term_relationships WHERE term_taxonomy_id=1 AND object_id = " . $sanitized_id);
|
231 |
+
}
|
232 |
}
|
233 |
}
|
234 |
// Update the message to show to the user
|
includes/custom-clean-view/class_clean_revision_draft_trash.php
CHANGED
@@ -51,7 +51,7 @@ class ADBC_Clean_Revision_Trash_Draft extends WP_List_Table {
|
|
51 |
|
52 |
// Prepare additional sql args if any: per page, LIMIT, OFFSET, etc.
|
53 |
if(ADBC_PLUGIN_F_TYPE == "pro"){
|
54 |
-
$this->aDBc_search_sql_arg
|
55 |
}
|
56 |
$this->aDBc_order_by_sql_arg = aDBc_get_order_by_sql_arg("ID");
|
57 |
$this->aDBc_limit_offset_sql_arg = aDBc_get_limit_offset_sql_args();
|
@@ -215,7 +215,7 @@ class ADBC_Clean_Revision_Trash_Draft extends WP_List_Table {
|
|
215 |
|
216 |
/** WP: Column cb for check box */
|
217 |
function column_cb($item) {
|
218 |
-
return sprintf('<input type="checkbox" name="
|
219 |
}
|
220 |
|
221 |
/** WP: Get bulk actions */
|
@@ -243,16 +243,21 @@ class ADBC_Clean_Revision_Trash_Draft extends WP_List_Table {
|
|
243 |
$action = $this->current_action();
|
244 |
if($action == 'clean'){
|
245 |
// If the user wants to clean the elements he/she selected
|
246 |
-
if(isset($_POST['
|
247 |
if(function_exists('is_multisite') && is_multisite()){
|
248 |
// Prepare posts to delete
|
249 |
$posts_to_delete = array();
|
250 |
-
foreach($_POST['
|
251 |
-
$post_info
|
252 |
-
|
253 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
254 |
}
|
255 |
-
array_push($posts_to_delete[$post_info[0]], $post_info[1]);
|
256 |
}
|
257 |
// Delete posts
|
258 |
foreach($posts_to_delete as $site_id => $posts_ids){
|
@@ -265,9 +270,12 @@ class ADBC_Clean_Revision_Trash_Draft extends WP_List_Table {
|
|
265 |
}
|
266 |
}else{
|
267 |
global $wpdb;
|
268 |
-
foreach($_POST['
|
269 |
-
$post_info
|
270 |
-
$
|
|
|
|
|
|
|
271 |
}
|
272 |
}
|
273 |
// Update the message to show to the user
|
51 |
|
52 |
// Prepare additional sql args if any: per page, LIMIT, OFFSET, etc.
|
53 |
if(ADBC_PLUGIN_F_TYPE == "pro"){
|
54 |
+
$this->aDBc_search_sql_arg = aDBc_get_search_sql_arg("post_title", "post_content");
|
55 |
}
|
56 |
$this->aDBc_order_by_sql_arg = aDBc_get_order_by_sql_arg("ID");
|
57 |
$this->aDBc_limit_offset_sql_arg = aDBc_get_limit_offset_sql_args();
|
215 |
|
216 |
/** WP: Column cb for check box */
|
217 |
function column_cb($item) {
|
218 |
+
return sprintf('<input type="checkbox" name="aDBc_elements_to_process[]" value="%s" />', $item['site_id']."|".$item['post_id']);
|
219 |
}
|
220 |
|
221 |
/** WP: Get bulk actions */
|
243 |
$action = $this->current_action();
|
244 |
if($action == 'clean'){
|
245 |
// If the user wants to clean the elements he/she selected
|
246 |
+
if(isset($_POST['aDBc_elements_to_process'])){
|
247 |
if(function_exists('is_multisite') && is_multisite()){
|
248 |
// Prepare posts to delete
|
249 |
$posts_to_delete = array();
|
250 |
+
foreach($_POST['aDBc_elements_to_process'] as $post){
|
251 |
+
$post_info = explode("|", $post);
|
252 |
+
$sanitized_site_id = sanitize_html_class($post_info[0]);
|
253 |
+
$sanitized_item_id = sanitize_html_class($post_info[1]);
|
254 |
+
// For security, we only proceed if both parts are clean and are numbers
|
255 |
+
if(is_numeric($sanitized_site_id) && is_numeric($sanitized_item_id)){
|
256 |
+
if(empty($posts_to_delete[$sanitized_site_id])){
|
257 |
+
$posts_to_delete[$sanitized_site_id] = array();
|
258 |
+
}
|
259 |
+
array_push($posts_to_delete[$sanitized_site_id], $sanitized_item_id);
|
260 |
}
|
|
|
261 |
}
|
262 |
// Delete posts
|
263 |
foreach($posts_to_delete as $site_id => $posts_ids){
|
270 |
}
|
271 |
}else{
|
272 |
global $wpdb;
|
273 |
+
foreach($_POST['aDBc_elements_to_process'] as $post){
|
274 |
+
$post_info = explode("|", $post);
|
275 |
+
$sanitized_id = sanitize_html_class($post_info[1]);
|
276 |
+
if(is_numeric($sanitized_id)){
|
277 |
+
$wpdb->query("DELETE FROM $wpdb->posts WHERE ID = " . $sanitized_id);
|
278 |
+
}
|
279 |
}
|
280 |
}
|
281 |
// Update the message to show to the user
|
includes/custom-clean-view/class_clean_transient.php
CHANGED
@@ -228,7 +228,7 @@ class ADBC_Clean_Transient extends WP_List_Table {
|
|
228 |
|
229 |
/** WP: Column cb for check box */
|
230 |
function column_cb($item) {
|
231 |
-
return sprintf('<input type="checkbox" name="
|
232 |
}
|
233 |
|
234 |
/** WP: Get bulk actions */
|
@@ -256,16 +256,21 @@ class ADBC_Clean_Transient extends WP_List_Table {
|
|
256 |
$action = $this->current_action();
|
257 |
if($action == 'clean'){
|
258 |
// If the user wants to clean the elements he/she selected
|
259 |
-
if(isset($_POST['
|
260 |
if(function_exists('is_multisite') && is_multisite()){
|
261 |
// Prepare feeds to delete
|
262 |
$feeds_to_delete = array();
|
263 |
-
foreach($_POST['
|
264 |
-
$feed_info
|
265 |
-
|
266 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
267 |
}
|
268 |
-
array_push($feeds_to_delete[$feed_info[0]], $feed_info[1]);
|
269 |
}
|
270 |
// Delete feeds
|
271 |
foreach($feeds_to_delete as $site_id => $feed_ids){
|
@@ -287,9 +292,12 @@ class ADBC_Clean_Transient extends WP_List_Table {
|
|
287 |
}else{
|
288 |
global $wpdb;
|
289 |
$ids_to_delete = array();
|
290 |
-
foreach($_POST['
|
291 |
-
$feed_info
|
292 |
-
|
|
|
|
|
|
|
293 |
}
|
294 |
|
295 |
$names_to_delete = $wpdb->get_col("select option_name from $wpdb->options WHERE option_id IN (" . implode(',',$ids_to_delete) . ")");
|
228 |
|
229 |
/** WP: Column cb for check box */
|
230 |
function column_cb($item) {
|
231 |
+
return sprintf('<input type="checkbox" name="aDBc_elements_to_process[]" value="%s" />', $item['site_id']."|".$item['transient_id']);
|
232 |
}
|
233 |
|
234 |
/** WP: Get bulk actions */
|
256 |
$action = $this->current_action();
|
257 |
if($action == 'clean'){
|
258 |
// If the user wants to clean the elements he/she selected
|
259 |
+
if(isset($_POST['aDBc_elements_to_process'])){
|
260 |
if(function_exists('is_multisite') && is_multisite()){
|
261 |
// Prepare feeds to delete
|
262 |
$feeds_to_delete = array();
|
263 |
+
foreach($_POST['aDBc_elements_to_process'] as $aDBc_feed){
|
264 |
+
$feed_info = explode("|", $aDBc_feed);
|
265 |
+
$sanitized_site_id = sanitize_html_class($feed_info[0]);
|
266 |
+
$sanitized_item_id = sanitize_html_class($feed_info[1]);
|
267 |
+
// For security, we only proceed if both parts are clean and are numbers
|
268 |
+
if(is_numeric($sanitized_site_id) && is_numeric($sanitized_item_id)){
|
269 |
+
if(empty($feeds_to_delete[$sanitized_site_id])){
|
270 |
+
$feeds_to_delete[$sanitized_site_id] = array();
|
271 |
+
}
|
272 |
+
array_push($feeds_to_delete[$sanitized_site_id], $sanitized_item_id);
|
273 |
}
|
|
|
274 |
}
|
275 |
// Delete feeds
|
276 |
foreach($feeds_to_delete as $site_id => $feed_ids){
|
292 |
}else{
|
293 |
global $wpdb;
|
294 |
$ids_to_delete = array();
|
295 |
+
foreach($_POST['aDBc_elements_to_process'] as $aDBc_feed){
|
296 |
+
$feed_info = explode("|", $aDBc_feed);
|
297 |
+
$sanitized_id = sanitize_html_class($feed_info[1]);
|
298 |
+
if(is_numeric($sanitized_id)){
|
299 |
+
array_push($ids_to_delete, $sanitized_id);
|
300 |
+
}
|
301 |
}
|
302 |
|
303 |
$names_to_delete = $wpdb->get_col("select option_name from $wpdb->options WHERE option_id IN (" . implode(',',$ids_to_delete) . ")");
|
includes/custom-clean-view/page_custom_clean.php
CHANGED
@@ -19,17 +19,4 @@ if($this->aDBc_message != ""){
|
|
19 |
?>
|
20 |
</form>
|
21 |
</div>
|
22 |
-
</div>
|
23 |
-
<div id="aDBc_dialog1" title="<?php _e("Cleaning '$this->aDBc_plural_title'","advanced-database-cleaner"); ?>" class="aDBc-jquery-dialog">
|
24 |
-
<p class="aDBc-box-warning">
|
25 |
-
<?php echo __("You are about to clean some of your $this->aDBc_plural_title. This operation is irreversible!","advanced-database-cleaner") . "<span style='color:red'> " . __('Don\'t forget to make a backup of your database first.','advanced-database-cleaner') . "</span>" ; ?>
|
26 |
-
</p>
|
27 |
-
<p>
|
28 |
-
<?php _e('Are you sure to continue?','advanced-database-cleaner'); ?>
|
29 |
-
</p>
|
30 |
-
</div>
|
31 |
-
<div id="aDBc_dialogx" title="<?php _e('Action required','advanced-database-cleaner'); ?>" class="aDBc-jquery-dialog">
|
32 |
-
<p class="aDBc-box-info">
|
33 |
-
<?php _e('Please select an action!','advanced-database-cleaner'); ?>
|
34 |
-
</p>
|
35 |
-
</div>
|
19 |
?>
|
20 |
</form>
|
21 |
</div>
|
22 |
+
</div>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
includes/custom-schedule-view/class_add_cleanup_schedule.php
CHANGED
@@ -31,7 +31,7 @@ class ADBC_SCHEDULE_CLEANUP extends WP_List_Table {
|
|
31 |
if(!check_admin_referer('add_cleanup_schedule_nonce', 'add_cleanup_schedule_nonce'))
|
32 |
return; //get out if we didn't click the save_schedule button
|
33 |
|
34 |
-
if(!empty($_POST['
|
35 |
if(!empty(trim($_POST['aDBc_schedule_name']))){
|
36 |
if(preg_match('/^[a-zA-Z0-9_]+$/',$_POST['aDBc_schedule_name'])){
|
37 |
|
@@ -49,16 +49,21 @@ class ADBC_SCHEDULE_CLEANUP extends WP_List_Table {
|
|
49 |
if(!empty($_POST['aDBc_time'])){
|
50 |
|
51 |
// We will create the new schedule
|
52 |
-
$
|
53 |
-
$
|
54 |
-
|
55 |
-
|
56 |
-
|
|
|
|
|
|
|
|
|
|
|
57 |
$clean_schedule_setting[$_POST['aDBc_schedule_name']] = $new_schedule_params;
|
58 |
update_option('aDBc_clean_schedule', $clean_schedule_setting, "no");
|
59 |
|
60 |
-
list($year, $month, $day)
|
61 |
-
list($hours, $minutes)
|
62 |
$seconds = "0";
|
63 |
$timestamp = mktime($hours, $minutes, $seconds, $month, $day, $year);
|
64 |
|
@@ -66,7 +71,7 @@ class ADBC_SCHEDULE_CLEANUP extends WP_List_Table {
|
|
66 |
if($_POST['aDBc_schedule_repeat'] == "once"){
|
67 |
wp_schedule_single_event($timestamp, "aDBc_clean_scheduler", array($_POST['aDBc_schedule_name']));
|
68 |
}else{
|
69 |
-
wp_schedule_event($timestamp, $_POST['aDBc_schedule_repeat'], "aDBc_clean_scheduler", array($_POST['aDBc_schedule_name']));
|
70 |
}
|
71 |
$this->aDBc_message = __('The clean-up schedule saved successfully!', 'advanced-database-cleaner');
|
72 |
}else{
|
@@ -202,12 +207,12 @@ class ADBC_SCHEDULE_CLEANUP extends WP_List_Table {
|
|
202 |
/** WP: Column cb for check box */
|
203 |
function column_cb($item) {
|
204 |
$checked = "";
|
205 |
-
if(isset($_POST['
|
206 |
-
if(in_array($item['type'], $_POST['
|
207 |
$checked = "checked";
|
208 |
}
|
209 |
}
|
210 |
-
return sprintf('<input type="checkbox" name="
|
211 |
}
|
212 |
|
213 |
/** WP: Get bulk actions */
|
@@ -262,55 +267,49 @@ class ADBC_SCHEDULE_CLEANUP extends WP_List_Table {
|
|
262 |
<div id="add_schedule" style="border-top:1px dashed #ccc">
|
263 |
<br/>
|
264 |
<div style="text-align:left"><?php _e('Name your schedule','advanced-database-cleaner');?></div>
|
265 |
-
<input style="width:100%;margin-bottom:10px;height:30px;border-radius:5px;box-shadow:0 0 10px #e0e0e0" type="text" name="aDBc_schedule_name" placeholder="Schedule name" value="<?php echo isset($_POST['aDBc_schedule_name']) ? $_POST['aDBc_schedule_name'] : ""?>" maxlength="25">
|
266 |
|
267 |
<div style="text-align:left"><?php _e('Frequency of execution','advanced-database-cleaner');?></div>
|
268 |
<select style="width:100%;margin-bottom:10px;height:30px;border-radius:5px;box-shadow:0 0 10px #e0e0e0" class="aDBc-schedule-select" name="aDBc_schedule_repeat">
|
269 |
-
|
270 |
-
|
271 |
-
|
272 |
-
|
273 |
-
|
274 |
-
|
275 |
-
|
276 |
-
|
277 |
-
|
278 |
-
|
279 |
-
|
280 |
-
|
281 |
-
|
282 |
-
|
283 |
-
|
284 |
-
|
285 |
-
</option>
|
286 |
-
<option value="monthly" <?php echo isset($_POST['aDBc_schedule_repeat']) && $_POST['aDBc_schedule_repeat'] == "monthly" ? "selected='selected'" : "" ?>>
|
287 |
-
<?php _e('Monthly','advanced-database-cleaner');?>
|
288 |
-
</option>
|
289 |
</select>
|
290 |
|
291 |
<div style="text-align:left"><?php _e('Start date','advanced-database-cleaner');?></div>
|
292 |
-
<input style="width:100%;margin-bottom:10px;height:30px;border-radius:5px;box-shadow:0 0 10px #e0e0e0" type="date" name="aDBc_date" placeholder="" value="<?php echo isset($_POST['aDBc_date']) ? $_POST['aDBc_date'] : date("Y-m-d"); ?>" min="<?php echo date("Y-m-d"); ?>">
|
293 |
-
|
294 |
<div style="text-align:left"><?php _e('Start time (GMT)','advanced-database-cleaner');?></div>
|
295 |
-
<input style="width:100%;margin-bottom:10px;height:30px;border-radius:5px;box-shadow:0 0 10px #e0e0e0" type="time" name="aDBc_time" value="<?php echo isset($_POST['aDBc_time']) ? $_POST['aDBc_time'] : date("H:i", time()); ?>">
|
296 |
-
|
297 |
|
298 |
<div style="text-align:left"><?php _e('Schedule status','advanced-database-cleaner');?></div>
|
299 |
-
|
300 |
<div style="margin-top:2px;text-align:left;background:#fff;padding:5px;box-shadow:0 0 10px #e0e0e0;border-radius:5px">
|
301 |
<input type="radio" name="aDBc_status" value="1" checked>
|
302 |
<span style="margin-right:20px"><?php _e('Active','advanced-database-cleaner');?></span>
|
303 |
-
|
304 |
<input type="radio" name="aDBc_status" value="0" <?php echo (isset($_POST['aDBc_status']) && $_POST['aDBc_status'] == "0") ? 'checked' : ''; ?>>
|
305 |
<?php _e('Inactive','advanced-database-cleaner');?>
|
306 |
</div>
|
307 |
-
|
308 |
<div style="width:100%;margin-top:20px">
|
309 |
<input class="button-primary" type="submit" value="<?php _e('Save the schedule','advanced-database-cleaner'); ?>" style="width:100%;"/>
|
310 |
</div>
|
311 |
-
|
312 |
-
</div>
|
313 |
|
|
|
314 |
</div>
|
315 |
</div>
|
316 |
|
31 |
if(!check_admin_referer('add_cleanup_schedule_nonce', 'add_cleanup_schedule_nonce'))
|
32 |
return; //get out if we didn't click the save_schedule button
|
33 |
|
34 |
+
if(!empty($_POST['aDBc_elements_to_process'])){
|
35 |
if(!empty(trim($_POST['aDBc_schedule_name']))){
|
36 |
if(preg_match('/^[a-zA-Z0-9_]+$/',$_POST['aDBc_schedule_name'])){
|
37 |
|
49 |
if(!empty($_POST['aDBc_time'])){
|
50 |
|
51 |
// We will create the new schedule
|
52 |
+
$sanitized_elements_to_process = array();
|
53 |
+
foreach($_POST['aDBc_elements_to_process'] as $element){
|
54 |
+
array_push($sanitized_elements_to_process, sanitize_html_class($element));
|
55 |
+
}
|
56 |
+
|
57 |
+
$new_schedule_params['elements_to_clean'] = $sanitized_elements_to_process;
|
58 |
+
$new_schedule_params['repeat'] = sanitize_html_class($_POST['aDBc_schedule_repeat']);
|
59 |
+
$new_schedule_params['start_date'] = preg_replace("/[^0-9-]/", '', $_POST['aDBc_date']);
|
60 |
+
$new_schedule_params['start_time'] = preg_replace("/[^0-9:]/", '', $_POST['aDBc_time']);
|
61 |
+
$new_schedule_params['active'] = sanitize_html_class($_POST['aDBc_status']);
|
62 |
$clean_schedule_setting[$_POST['aDBc_schedule_name']] = $new_schedule_params;
|
63 |
update_option('aDBc_clean_schedule', $clean_schedule_setting, "no");
|
64 |
|
65 |
+
list($year, $month, $day) = explode('-', preg_replace("/[^0-9-]/", '', $_POST['aDBc_date']));
|
66 |
+
list($hours, $minutes) = explode(':', preg_replace("/[^0-9:]/", '', $_POST['aDBc_time']));
|
67 |
$seconds = "0";
|
68 |
$timestamp = mktime($hours, $minutes, $seconds, $month, $day, $year);
|
69 |
|
71 |
if($_POST['aDBc_schedule_repeat'] == "once"){
|
72 |
wp_schedule_single_event($timestamp, "aDBc_clean_scheduler", array($_POST['aDBc_schedule_name']));
|
73 |
}else{
|
74 |
+
wp_schedule_event($timestamp, sanitize_html_class($_POST['aDBc_schedule_repeat']), "aDBc_clean_scheduler", array($_POST['aDBc_schedule_name']));
|
75 |
}
|
76 |
$this->aDBc_message = __('The clean-up schedule saved successfully!', 'advanced-database-cleaner');
|
77 |
}else{
|
207 |
/** WP: Column cb for check box */
|
208 |
function column_cb($item) {
|
209 |
$checked = "";
|
210 |
+
if(isset($_POST['aDBc_elements_to_process'])){
|
211 |
+
if(in_array($item['type'], $_POST['aDBc_elements_to_process'])){
|
212 |
$checked = "checked";
|
213 |
}
|
214 |
}
|
215 |
+
return sprintf('<input type="checkbox" name="aDBc_elements_to_process[]" value="%s"' . $checked . '/>', $item['type']);
|
216 |
}
|
217 |
|
218 |
/** WP: Get bulk actions */
|
267 |
<div id="add_schedule" style="border-top:1px dashed #ccc">
|
268 |
<br/>
|
269 |
<div style="text-align:left"><?php _e('Name your schedule','advanced-database-cleaner');?></div>
|
270 |
+
<input style="width:100%;margin-bottom:10px;height:30px;border-radius:5px;box-shadow:0 0 10px #e0e0e0" type="text" name="aDBc_schedule_name" placeholder="Schedule name" value="<?php echo isset($_POST['aDBc_schedule_name']) ? esc_attr($_POST['aDBc_schedule_name']) : ""?>" maxlength="25">
|
271 |
|
272 |
<div style="text-align:left"><?php _e('Frequency of execution','advanced-database-cleaner');?></div>
|
273 |
<select style="width:100%;margin-bottom:10px;height:30px;border-radius:5px;box-shadow:0 0 10px #e0e0e0" class="aDBc-schedule-select" name="aDBc_schedule_repeat">
|
274 |
+
<?php
|
275 |
+
$schedules_repeat = array('once' => __('Once','advanced-database-cleaner'),
|
276 |
+
'hourly' => __('Hourly','advanced-database-cleaner'),
|
277 |
+
'twicedaily' => __('Twice a day','advanced-database-cleaner'),
|
278 |
+
'daily' => __('Daily','advanced-database-cleaner'),
|
279 |
+
'weekly' => __('Weekly','advanced-database-cleaner'),
|
280 |
+
'monthly' => __('Monthly','advanced-database-cleaner'));
|
281 |
+
|
282 |
+
foreach($schedules_repeat as $code_repeat => $name_repeat){
|
283 |
+
if(isset($_POST['aDBc_schedule_repeat']) && $_POST['aDBc_schedule_repeat'] == $code_repeat){
|
284 |
+
echo "<option value='$code_repeat' selected='selected'>$name_repeat</option>";
|
285 |
+
}else{
|
286 |
+
echo "<option value='$code_repeat'>$name_repeat</option>";
|
287 |
+
}
|
288 |
+
}
|
289 |
+
?>
|
|
|
|
|
|
|
|
|
290 |
</select>
|
291 |
|
292 |
<div style="text-align:left"><?php _e('Start date','advanced-database-cleaner');?></div>
|
293 |
+
<input style="width:100%;margin-bottom:10px;height:30px;border-radius:5px;box-shadow:0 0 10px #e0e0e0" type="date" name="aDBc_date" placeholder="" value="<?php echo isset($_POST['aDBc_date']) ? esc_attr($_POST['aDBc_date']) : date("Y-m-d"); ?>" min="<?php echo date("Y-m-d"); ?>">
|
294 |
+
|
295 |
<div style="text-align:left"><?php _e('Start time (GMT)','advanced-database-cleaner');?></div>
|
296 |
+
<input style="width:100%;margin-bottom:10px;height:30px;border-radius:5px;box-shadow:0 0 10px #e0e0e0" type="time" name="aDBc_time" value="<?php echo isset($_POST['aDBc_time']) ? esc_attr($_POST['aDBc_time']) : date("H:i", time()); ?>">
|
|
|
297 |
|
298 |
<div style="text-align:left"><?php _e('Schedule status','advanced-database-cleaner');?></div>
|
299 |
+
|
300 |
<div style="margin-top:2px;text-align:left;background:#fff;padding:5px;box-shadow:0 0 10px #e0e0e0;border-radius:5px">
|
301 |
<input type="radio" name="aDBc_status" value="1" checked>
|
302 |
<span style="margin-right:20px"><?php _e('Active','advanced-database-cleaner');?></span>
|
303 |
+
|
304 |
<input type="radio" name="aDBc_status" value="0" <?php echo (isset($_POST['aDBc_status']) && $_POST['aDBc_status'] == "0") ? 'checked' : ''; ?>>
|
305 |
<?php _e('Inactive','advanced-database-cleaner');?>
|
306 |
</div>
|
307 |
+
|
308 |
<div style="width:100%;margin-top:20px">
|
309 |
<input class="button-primary" type="submit" value="<?php _e('Save the schedule','advanced-database-cleaner'); ?>" style="width:100%;"/>
|
310 |
</div>
|
|
|
|
|
311 |
|
312 |
+
</div>
|
313 |
</div>
|
314 |
</div>
|
315 |
|
includes/custom-schedule-view/class_add_optimize_schedule.php
CHANGED
@@ -42,24 +42,24 @@ class ADBC_SCHEDULE_OPTIMIZE {
|
|
42 |
if(!empty($_POST['aDBc_operation1']) || !empty($_POST['aDBc_operation2'])){
|
43 |
|
44 |
// We will create the new schedule
|
45 |
-
$new_schedule_params['repeat'] = $_POST['aDBc_schedule_repeat'];
|
46 |
-
$new_schedule_params['start_date'] = $_POST['aDBc_date'];
|
47 |
-
$new_schedule_params['start_time'] = $_POST['aDBc_time'];
|
48 |
|
49 |
// Prepare operations to perform
|
50 |
$operations = array();
|
51 |
if(!empty($_POST['aDBc_operation1']))
|
52 |
-
array_push($operations, $_POST['aDBc_operation1']);
|
53 |
if(!empty($_POST['aDBc_operation2']))
|
54 |
-
array_push($operations, $_POST['aDBc_operation2']);
|
55 |
$new_schedule_params['operations'] = $operations;
|
56 |
|
57 |
-
$new_schedule_params['active'] = $_POST['aDBc_status'];
|
58 |
$optimize_schedule_setting[$_POST['aDBc_schedule_name']] = $new_schedule_params;
|
59 |
update_option('aDBc_optimize_schedule', $optimize_schedule_setting, "no");
|
60 |
|
61 |
-
list($year, $month, $day)
|
62 |
-
list($hours, $minutes)
|
63 |
$seconds = "0";
|
64 |
$timestamp = mktime($hours, $minutes, $seconds, $month, $day, $year);
|
65 |
|
@@ -67,7 +67,7 @@ class ADBC_SCHEDULE_OPTIMIZE {
|
|
67 |
if($_POST['aDBc_schedule_repeat'] == "once"){
|
68 |
wp_schedule_single_event($timestamp, "aDBc_optimize_scheduler", array($_POST['aDBc_schedule_name']));
|
69 |
}else{
|
70 |
-
wp_schedule_event($timestamp, $_POST['aDBc_schedule_repeat'], "aDBc_optimize_scheduler", array($_POST['aDBc_schedule_name']));
|
71 |
}
|
72 |
$this->aDBc_message = __('The clean-up schedule saved successfully!', 'advanced-database-cleaner');
|
73 |
}else{
|
@@ -139,43 +139,39 @@ class ADBC_SCHEDULE_OPTIMIZE {
|
|
139 |
<div id="add_schedule" style="border-top:1px dashed #ccc">
|
140 |
<br/>
|
141 |
<div style="text-align:left"><?php _e('Name your schedule','advanced-database-cleaner');?></div>
|
142 |
-
<input style="width:100%;margin-bottom:10px;height:30px;border-radius:5px;box-shadow:0 0 10px #e0e0e0" type="text" name="aDBc_schedule_name" placeholder="Schedule name" value="<?php echo isset($_POST['aDBc_schedule_name']) ? $_POST['aDBc_schedule_name'] : ""?>" maxlength="25">
|
143 |
|
144 |
<div style="text-align:left"><?php _e('Frequency of execution','advanced-database-cleaner');?></div>
|
145 |
-
<select style="width:100%;margin-bottom:10px;height:30px;border-radius:5px;box-shadow:0 0 10px #e0e0e0" class="aDBc-schedule-select" name="aDBc_schedule_repeat">
|
146 |
-
|
147 |
-
|
148 |
-
|
149 |
-
|
150 |
-
|
151 |
-
|
152 |
-
|
153 |
-
|
154 |
-
|
155 |
-
|
156 |
-
|
157 |
-
|
158 |
-
|
159 |
-
|
160 |
-
|
161 |
-
|
162 |
-
</option>
|
163 |
-
<option value="monthly" <?php echo isset($_POST['aDBc_schedule_repeat']) && $_POST['aDBc_schedule_repeat'] == "monthly" ? "selected='selected'" : "" ?>>
|
164 |
-
<?php _e('Monthly','advanced-database-cleaner');?>
|
165 |
-
</option>
|
166 |
</select>
|
167 |
|
168 |
<div style="text-align:left"><?php _e('Start date','advanced-database-cleaner');?></div>
|
169 |
-
<input style="width:100%;margin-bottom:10px;height:30px;border-radius:5px;box-shadow:0 0 10px #e0e0e0" type="date" name="aDBc_date" placeholder="" value="<?php echo isset($_POST['aDBc_date']) ? $_POST['aDBc_date'] : date("Y-m-d"); ?>" min="<?php echo date("Y-m-d"); ?>">
|
170 |
|
171 |
<div style="text-align:left"><?php _e('Start time (GMT)','advanced-database-cleaner');?></div>
|
172 |
-
<input style="width:100%;margin-bottom:10px;height:30px;border-radius:5px;box-shadow:0 0 10px #e0e0e0" type="time" name="aDBc_time" value="<?php echo isset($_POST['aDBc_time']) ? $_POST['aDBc_time'] : date("H:i", time()); ?>">
|
173 |
|
174 |
<div style="text-align:left"><?php _e('Perform operations','advanced-database-cleaner');?></div>
|
175 |
<div style="margin-bottom:10px;margin-top:2px;text-align:left;background:#fff;padding:5px;box-shadow:0 0 10px #e0e0e0;border-radius:5px">
|
176 |
<input type="checkbox" name="aDBc_operation1" value="optimize" <?php echo (isset($_POST['aDBc_operation1']) && $_POST['aDBc_operation1'] == "optimize") ? 'checked' : ''; ?>>
|
177 |
<span style="margin-right:20px"><?php _e('Optimize','advanced-database-cleaner');?></span>
|
178 |
-
|
179 |
<input type="checkbox" name="aDBc_operation2" value="repair" <?php echo (isset($_POST['aDBc_operation2']) && $_POST['aDBc_operation2'] == "repair") ? 'checked' : ''; ?>>
|
180 |
<?php _e('Repair','advanced-database-cleaner');?>
|
181 |
</div>
|
@@ -193,8 +189,7 @@ class ADBC_SCHEDULE_OPTIMIZE {
|
|
193 |
<input class="button-primary" type="submit" value="<?php _e('Save the schedule','advanced-database-cleaner'); ?>" style="width:100%;"/>
|
194 |
</div>
|
195 |
|
196 |
-
</div>
|
197 |
-
|
198 |
</div>
|
199 |
</div>
|
200 |
|
42 |
if(!empty($_POST['aDBc_operation1']) || !empty($_POST['aDBc_operation2'])){
|
43 |
|
44 |
// We will create the new schedule
|
45 |
+
$new_schedule_params['repeat'] = sanitize_html_class($_POST['aDBc_schedule_repeat']);
|
46 |
+
$new_schedule_params['start_date'] = preg_replace("/[^0-9-]/", '', $_POST['aDBc_date']);
|
47 |
+
$new_schedule_params['start_time'] = preg_replace("/[^0-9:]/", '', $_POST['aDBc_time']);
|
48 |
|
49 |
// Prepare operations to perform
|
50 |
$operations = array();
|
51 |
if(!empty($_POST['aDBc_operation1']))
|
52 |
+
array_push($operations, sanitize_html_class($_POST['aDBc_operation1']));
|
53 |
if(!empty($_POST['aDBc_operation2']))
|
54 |
+
array_push($operations, sanitize_html_class($_POST['aDBc_operation2']));
|
55 |
$new_schedule_params['operations'] = $operations;
|
56 |
|
57 |
+
$new_schedule_params['active'] = sanitize_html_class($_POST['aDBc_status']);
|
58 |
$optimize_schedule_setting[$_POST['aDBc_schedule_name']] = $new_schedule_params;
|
59 |
update_option('aDBc_optimize_schedule', $optimize_schedule_setting, "no");
|
60 |
|
61 |
+
list($year, $month, $day) = explode('-', preg_replace("/[^0-9-]/", '', $_POST['aDBc_date']));
|
62 |
+
list($hours, $minutes) = explode(':', preg_replace("/[^0-9:]/", '', $_POST['aDBc_time']));
|
63 |
$seconds = "0";
|
64 |
$timestamp = mktime($hours, $minutes, $seconds, $month, $day, $year);
|
65 |
|
67 |
if($_POST['aDBc_schedule_repeat'] == "once"){
|
68 |
wp_schedule_single_event($timestamp, "aDBc_optimize_scheduler", array($_POST['aDBc_schedule_name']));
|
69 |
}else{
|
70 |
+
wp_schedule_event($timestamp, sanitize_html_class($_POST['aDBc_schedule_repeat']), "aDBc_optimize_scheduler", array($_POST['aDBc_schedule_name']));
|
71 |
}
|
72 |
$this->aDBc_message = __('The clean-up schedule saved successfully!', 'advanced-database-cleaner');
|
73 |
}else{
|
139 |
<div id="add_schedule" style="border-top:1px dashed #ccc">
|
140 |
<br/>
|
141 |
<div style="text-align:left"><?php _e('Name your schedule','advanced-database-cleaner');?></div>
|
142 |
+
<input style="width:100%;margin-bottom:10px;height:30px;border-radius:5px;box-shadow:0 0 10px #e0e0e0" type="text" name="aDBc_schedule_name" placeholder="Schedule name" value="<?php echo isset($_POST['aDBc_schedule_name']) ? esc_attr($_POST['aDBc_schedule_name']) : ""?>" maxlength="25">
|
143 |
|
144 |
<div style="text-align:left"><?php _e('Frequency of execution','advanced-database-cleaner');?></div>
|
145 |
+
<select style="width:100%;margin-bottom:10px;height:30px;border-radius:5px;box-shadow:0 0 10px #e0e0e0" class="aDBc-schedule-select" name="aDBc_schedule_repeat">
|
146 |
+
<?php
|
147 |
+
$schedules_repeat = array('once' => __('Once','advanced-database-cleaner'),
|
148 |
+
'hourly' => __('Hourly','advanced-database-cleaner'),
|
149 |
+
'twicedaily' => __('Twice a day','advanced-database-cleaner'),
|
150 |
+
'daily' => __('Daily','advanced-database-cleaner'),
|
151 |
+
'weekly' => __('Weekly','advanced-database-cleaner'),
|
152 |
+
'monthly' => __('Monthly','advanced-database-cleaner'));
|
153 |
+
|
154 |
+
foreach($schedules_repeat as $code_repeat => $name_repeat){
|
155 |
+
if(isset($_POST['aDBc_schedule_repeat']) && $_POST['aDBc_schedule_repeat'] == $code_repeat){
|
156 |
+
echo "<option value='$code_repeat' selected='selected'>$name_repeat</option>";
|
157 |
+
}else{
|
158 |
+
echo "<option value='$code_repeat'>$name_repeat</option>";
|
159 |
+
}
|
160 |
+
}
|
161 |
+
?>
|
|
|
|
|
|
|
|
|
162 |
</select>
|
163 |
|
164 |
<div style="text-align:left"><?php _e('Start date','advanced-database-cleaner');?></div>
|
165 |
+
<input style="width:100%;margin-bottom:10px;height:30px;border-radius:5px;box-shadow:0 0 10px #e0e0e0" type="date" name="aDBc_date" placeholder="" value="<?php echo isset($_POST['aDBc_date']) ? esc_attr($_POST['aDBc_date']) : date("Y-m-d"); ?>" min="<?php echo date("Y-m-d"); ?>">
|
166 |
|
167 |
<div style="text-align:left"><?php _e('Start time (GMT)','advanced-database-cleaner');?></div>
|
168 |
+
<input style="width:100%;margin-bottom:10px;height:30px;border-radius:5px;box-shadow:0 0 10px #e0e0e0" type="time" name="aDBc_time" value="<?php echo isset($_POST['aDBc_time']) ? esc_attr($_POST['aDBc_time']) : date("H:i", time()); ?>">
|
169 |
|
170 |
<div style="text-align:left"><?php _e('Perform operations','advanced-database-cleaner');?></div>
|
171 |
<div style="margin-bottom:10px;margin-top:2px;text-align:left;background:#fff;padding:5px;box-shadow:0 0 10px #e0e0e0;border-radius:5px">
|
172 |
<input type="checkbox" name="aDBc_operation1" value="optimize" <?php echo (isset($_POST['aDBc_operation1']) && $_POST['aDBc_operation1'] == "optimize") ? 'checked' : ''; ?>>
|
173 |
<span style="margin-right:20px"><?php _e('Optimize','advanced-database-cleaner');?></span>
|
174 |
+
|
175 |
<input type="checkbox" name="aDBc_operation2" value="repair" <?php echo (isset($_POST['aDBc_operation2']) && $_POST['aDBc_operation2'] == "repair") ? 'checked' : ''; ?>>
|
176 |
<?php _e('Repair','advanced-database-cleaner');?>
|
177 |
</div>
|
189 |
<input class="button-primary" type="submit" value="<?php _e('Save the schedule','advanced-database-cleaner'); ?>" style="width:100%;"/>
|
190 |
</div>
|
191 |
|
192 |
+
</div>
|
|
|
193 |
</div>
|
194 |
</div>
|
195 |
|
includes/custom-schedule-view/class_edit_cleanup_schedule.php
CHANGED
@@ -31,7 +31,7 @@ class EDIT_SCHEDULE_CLEANUP extends WP_List_Table {
|
|
31 |
if(!check_admin_referer('edit_cleanup_schedule_nonce', 'edit_cleanup_schedule_nonce'))
|
32 |
return; //get out if we didn't click the save_schedule button
|
33 |
|
34 |
-
if(!empty($_POST['
|
35 |
if(!empty(trim($_POST['aDBc_schedule_name']))){
|
36 |
if(preg_match('/^[a-zA-Z0-9_]+$/',$_POST['aDBc_schedule_name'])){
|
37 |
|
@@ -53,16 +53,21 @@ class EDIT_SCHEDULE_CLEANUP extends WP_List_Table {
|
|
53 |
// Delete the old schedule and replace it with the new
|
54 |
|
55 |
// We will create the new schedule
|
56 |
-
$
|
57 |
-
$
|
58 |
-
|
59 |
-
|
60 |
-
|
|
|
|
|
|
|
|
|
|
|
61 |
$clean_schedule_setting[$_POST['aDBc_schedule_name']] = $new_schedule_params;
|
62 |
update_option('aDBc_clean_schedule', $clean_schedule_setting, "no");
|
63 |
|
64 |
-
list($year, $month, $day)
|
65 |
-
list($hours, $minutes)
|
66 |
$seconds = "0";
|
67 |
$timestamp = mktime($hours, $minutes, $seconds, $month, $day, $year);
|
68 |
|
@@ -73,7 +78,7 @@ class EDIT_SCHEDULE_CLEANUP extends WP_List_Table {
|
|
73 |
if($_POST['aDBc_schedule_repeat'] == "once"){
|
74 |
wp_schedule_single_event($timestamp, "aDBc_clean_scheduler", array($_POST['aDBc_schedule_name']));
|
75 |
}else{
|
76 |
-
wp_schedule_event($timestamp, $_POST['aDBc_schedule_repeat'], "aDBc_clean_scheduler", array($_POST['aDBc_schedule_name']));
|
77 |
}
|
78 |
$this->aDBc_message = __('The clean-up schedule saved successfully!', 'advanced-database-cleaner');
|
79 |
}else{
|
@@ -208,14 +213,14 @@ class EDIT_SCHEDULE_CLEANUP extends WP_List_Table {
|
|
208 |
function column_cb($item) {
|
209 |
$checked = "";
|
210 |
|
211 |
-
if(isset($_POST['aDBc_schedule_name'])){
|
212 |
-
if(in_array($item['type'], $_POST['
|
213 |
$checked = "checked";
|
214 |
}
|
215 |
}else{
|
216 |
|
217 |
-
$schedule_settings
|
218 |
-
$schedule_params
|
219 |
$schedule_elements_to_clean = $schedule_params['elements_to_clean'];
|
220 |
$schedule_elements_to_clean = is_array($schedule_elements_to_clean) ? $schedule_elements_to_clean : array();
|
221 |
|
@@ -224,7 +229,7 @@ class EDIT_SCHEDULE_CLEANUP extends WP_List_Table {
|
|
224 |
}
|
225 |
}
|
226 |
|
227 |
-
return sprintf('<input type="checkbox" name="
|
228 |
}
|
229 |
|
230 |
/** WP: Get bulk actions */
|
@@ -270,33 +275,33 @@ class EDIT_SCHEDULE_CLEANUP extends WP_List_Table {
|
|
270 |
|
271 |
<?php
|
272 |
// Prepare info of the original schedule to fill it into inputs...
|
273 |
-
|
274 |
if(isset($_POST['aDBc_schedule_name'])){
|
275 |
-
|
276 |
-
$hook_name = $_POST['aDBc_schedule_name'];
|
277 |
-
$schedule_repeat = $_POST['aDBc_schedule_repeat'];
|
278 |
-
$schedule_date = $_POST['aDBc_date'];
|
279 |
-
$schedule_time = $_POST['aDBc_time'];
|
280 |
-
$schedule_status = $_POST['aDBc_status'];
|
281 |
-
|
282 |
}else{
|
283 |
|
284 |
-
$schedule_settings
|
285 |
-
$schedule_params
|
286 |
|
287 |
-
$hook_name
|
288 |
-
$schedule_repeat
|
289 |
-
$timestamp
|
290 |
if($timestamp){
|
291 |
-
$schedule_date
|
292 |
-
$schedule_time
|
293 |
}else{
|
294 |
-
$schedule_date
|
295 |
-
$schedule_time
|
296 |
}
|
297 |
$schedule_status = $schedule_params['active'];
|
298 |
}
|
299 |
-
|
300 |
?>
|
301 |
|
302 |
<div class="aDBc-right-box">
|
@@ -330,7 +335,7 @@ class EDIT_SCHEDULE_CLEANUP extends WP_List_Table {
|
|
330 |
echo "<option value='$code_repeat'>$name_repeat</option>";
|
331 |
}
|
332 |
}
|
333 |
-
?>
|
334 |
</select>
|
335 |
|
336 |
<div style="text-align:left"><?php _e('Start date','advanced-database-cleaner');?></div>
|
@@ -344,7 +349,7 @@ class EDIT_SCHEDULE_CLEANUP extends WP_List_Table {
|
|
344 |
<div style="margin-top:2px;text-align:left;background:#fff;padding:5px;box-shadow:0 0 10px #e0e0e0;border-radius:5px">
|
345 |
<input type="radio" name="aDBc_status" value="1" checked>
|
346 |
<span style="margin-right:20px"><?php _e('Active','advanced-database-cleaner');?></span>
|
347 |
-
|
348 |
<input type="radio" name="aDBc_status" value="0" <?php echo $schedule_status == "0" ? 'checked' : ''; ?>>
|
349 |
<?php _e('Inactive','advanced-database-cleaner');?>
|
350 |
</div>
|
@@ -353,8 +358,7 @@ class EDIT_SCHEDULE_CLEANUP extends WP_List_Table {
|
|
353 |
<input class="button-primary" type="submit" value="<?php _e('Save the schedule','advanced-database-cleaner'); ?>" style="width:100%;"/>
|
354 |
</div>
|
355 |
|
356 |
-
</div>
|
357 |
-
|
358 |
</div>
|
359 |
</div>
|
360 |
|
31 |
if(!check_admin_referer('edit_cleanup_schedule_nonce', 'edit_cleanup_schedule_nonce'))
|
32 |
return; //get out if we didn't click the save_schedule button
|
33 |
|
34 |
+
if(!empty($_POST['aDBc_elements_to_process'])){
|
35 |
if(!empty(trim($_POST['aDBc_schedule_name']))){
|
36 |
if(preg_match('/^[a-zA-Z0-9_]+$/',$_POST['aDBc_schedule_name'])){
|
37 |
|
53 |
// Delete the old schedule and replace it with the new
|
54 |
|
55 |
// We will create the new schedule
|
56 |
+
$sanitized_elements_to_process = array();
|
57 |
+
foreach($_POST['aDBc_elements_to_process'] as $element){
|
58 |
+
array_push($sanitized_elements_to_process, sanitize_html_class($element));
|
59 |
+
}
|
60 |
+
|
61 |
+
$new_schedule_params['elements_to_clean'] = $sanitized_elements_to_process;
|
62 |
+
$new_schedule_params['repeat'] = sanitize_html_class($_POST['aDBc_schedule_repeat']);
|
63 |
+
$new_schedule_params['start_date'] = preg_replace("/[^0-9-]/", '', $_POST['aDBc_date']);
|
64 |
+
$new_schedule_params['start_time'] = preg_replace("/[^0-9:]/", '', $_POST['aDBc_time']);
|
65 |
+
$new_schedule_params['active'] = sanitize_html_class($_POST['aDBc_status']);
|
66 |
$clean_schedule_setting[$_POST['aDBc_schedule_name']] = $new_schedule_params;
|
67 |
update_option('aDBc_clean_schedule', $clean_schedule_setting, "no");
|
68 |
|
69 |
+
list($year, $month, $day) = explode('-', preg_replace("/[^0-9-]/", '', $_POST['aDBc_date']));
|
70 |
+
list($hours, $minutes) = explode(':', preg_replace("/[^0-9:]/", '', $_POST['aDBc_time']));
|
71 |
$seconds = "0";
|
72 |
$timestamp = mktime($hours, $minutes, $seconds, $month, $day, $year);
|
73 |
|
78 |
if($_POST['aDBc_schedule_repeat'] == "once"){
|
79 |
wp_schedule_single_event($timestamp, "aDBc_clean_scheduler", array($_POST['aDBc_schedule_name']));
|
80 |
}else{
|
81 |
+
wp_schedule_event($timestamp, sanitize_html_class($_POST['aDBc_schedule_repeat']), "aDBc_clean_scheduler", array($_POST['aDBc_schedule_name']));
|
82 |
}
|
83 |
$this->aDBc_message = __('The clean-up schedule saved successfully!', 'advanced-database-cleaner');
|
84 |
}else{
|
213 |
function column_cb($item) {
|
214 |
$checked = "";
|
215 |
|
216 |
+
if(isset($_POST['aDBc_schedule_name']) && !empty($_POST['aDBc_elements_to_process'])){
|
217 |
+
if(in_array($item['type'], $_POST['aDBc_elements_to_process'])){
|
218 |
$checked = "checked";
|
219 |
}
|
220 |
}else{
|
221 |
|
222 |
+
$schedule_settings = get_option('aDBc_clean_schedule');
|
223 |
+
$schedule_params = $schedule_settings[sanitize_html_class($_GET['hook_name'])];
|
224 |
$schedule_elements_to_clean = $schedule_params['elements_to_clean'];
|
225 |
$schedule_elements_to_clean = is_array($schedule_elements_to_clean) ? $schedule_elements_to_clean : array();
|
226 |
|
229 |
}
|
230 |
}
|
231 |
|
232 |
+
return sprintf('<input type="checkbox" name="aDBc_elements_to_process[]" value="%s"' . $checked . '/>', $item['type']);
|
233 |
}
|
234 |
|
235 |
/** WP: Get bulk actions */
|
275 |
|
276 |
<?php
|
277 |
// Prepare info of the original schedule to fill it into inputs...
|
278 |
+
|
279 |
if(isset($_POST['aDBc_schedule_name'])){
|
280 |
+
|
281 |
+
$hook_name = sanitize_html_class($_POST['aDBc_schedule_name']);
|
282 |
+
$schedule_repeat = sanitize_html_class($_POST['aDBc_schedule_repeat']);
|
283 |
+
$schedule_date = preg_replace("/[^0-9-]/", '', $_POST['aDBc_date']);
|
284 |
+
$schedule_time = preg_replace("/[^0-9:]/", '', $_POST['aDBc_time']);
|
285 |
+
$schedule_status = sanitize_html_class($_POST['aDBc_status']);
|
286 |
+
|
287 |
}else{
|
288 |
|
289 |
+
$schedule_settings = get_option('aDBc_clean_schedule');
|
290 |
+
$schedule_params = $schedule_settings[sanitize_html_class($_GET['hook_name'])];
|
291 |
|
292 |
+
$hook_name = sanitize_html_class($_GET['hook_name']);
|
293 |
+
$schedule_repeat = $schedule_params['repeat'];
|
294 |
+
$timestamp = wp_next_scheduled("aDBc_clean_scheduler", array(sanitize_html_class($_GET['hook_name']) . ''));
|
295 |
if($timestamp){
|
296 |
+
$schedule_date = date("Y-m-d", $timestamp);
|
297 |
+
$schedule_time = date("H:i", $timestamp);
|
298 |
}else{
|
299 |
+
$schedule_date = date("Y-m-d");
|
300 |
+
$schedule_time = date("H:i", time());
|
301 |
}
|
302 |
$schedule_status = $schedule_params['active'];
|
303 |
}
|
304 |
+
|
305 |
?>
|
306 |
|
307 |
<div class="aDBc-right-box">
|
335 |
echo "<option value='$code_repeat'>$name_repeat</option>";
|
336 |
}
|
337 |
}
|
338 |
+
?>
|
339 |
</select>
|
340 |
|
341 |
<div style="text-align:left"><?php _e('Start date','advanced-database-cleaner');?></div>
|
349 |
<div style="margin-top:2px;text-align:left;background:#fff;padding:5px;box-shadow:0 0 10px #e0e0e0;border-radius:5px">
|
350 |
<input type="radio" name="aDBc_status" value="1" checked>
|
351 |
<span style="margin-right:20px"><?php _e('Active','advanced-database-cleaner');?></span>
|
352 |
+
|
353 |
<input type="radio" name="aDBc_status" value="0" <?php echo $schedule_status == "0" ? 'checked' : ''; ?>>
|
354 |
<?php _e('Inactive','advanced-database-cleaner');?>
|
355 |
</div>
|
358 |
<input class="button-primary" type="submit" value="<?php _e('Save the schedule','advanced-database-cleaner'); ?>" style="width:100%;"/>
|
359 |
</div>
|
360 |
|
361 |
+
</div>
|
|
|
362 |
</div>
|
363 |
</div>
|
364 |
|
includes/custom-schedule-view/class_edit_optimize_schedule.php
CHANGED
@@ -46,24 +46,24 @@ class EDIT_SCHEDULE_OPTIMIZE extends WP_List_Table {
|
|
46 |
// Delete the old schedule and replace it with the new
|
47 |
|
48 |
// We will create the new schedule
|
49 |
-
$new_schedule_params['repeat'] = $_POST['aDBc_schedule_repeat'];
|
50 |
-
$new_schedule_params['start_date'] = $_POST['aDBc_date'];
|
51 |
-
$new_schedule_params['start_time'] = $_POST['aDBc_time'];
|
52 |
|
53 |
// Prepare operations to perform
|
54 |
$operations = array();
|
55 |
if(!empty($_POST['aDBc_operation1']))
|
56 |
-
array_push($operations, $_POST['aDBc_operation1']);
|
57 |
if(!empty($_POST['aDBc_operation2']))
|
58 |
-
array_push($operations, $_POST['aDBc_operation2']);
|
59 |
$new_schedule_params['operations'] = $operations;
|
60 |
|
61 |
-
$new_schedule_params['active'] = $_POST['aDBc_status'];
|
62 |
$optimize_schedule_setting[$_POST['aDBc_schedule_name']] = $new_schedule_params;
|
63 |
update_option('aDBc_optimize_schedule', $optimize_schedule_setting, "no");
|
64 |
|
65 |
-
list($year, $month, $day)
|
66 |
-
list($hours, $minutes)
|
67 |
$seconds = "0";
|
68 |
$timestamp = mktime($hours, $minutes, $seconds, $month, $day, $year);
|
69 |
|
@@ -74,13 +74,12 @@ class EDIT_SCHEDULE_OPTIMIZE extends WP_List_Table {
|
|
74 |
if($_POST['aDBc_schedule_repeat'] == "once"){
|
75 |
wp_schedule_single_event($timestamp, "aDBc_optimize_scheduler", array($_POST['aDBc_schedule_name']));
|
76 |
}else{
|
77 |
-
wp_schedule_event($timestamp, $_POST['aDBc_schedule_repeat'], "aDBc_optimize_scheduler", array($_POST['aDBc_schedule_name']));
|
78 |
}
|
79 |
$this->aDBc_message = __('The clean-up schedule saved successfully!', 'advanced-database-cleaner');
|
80 |
}else{
|
81 |
$this->aDBc_message = __('The clean-up schedule saved successfully but it is inactive!', 'advanced-database-cleaner');
|
82 |
}
|
83 |
-
|
84 |
}else{
|
85 |
$this->aDBc_class_message = "error";
|
86 |
$this->aDBc_message = __('Please choose at least one operation to perform!', 'advanced-database-cleaner');
|
@@ -106,9 +105,6 @@ class EDIT_SCHEDULE_OPTIMIZE extends WP_List_Table {
|
|
106 |
$this->aDBc_message = __('Please give a name to your schedule!', 'advanced-database-cleaner');
|
107 |
}
|
108 |
}
|
109 |
-
// yyy should this $wpdb be cleaned ?
|
110 |
-
global $wpdb;
|
111 |
-
|
112 |
}
|
113 |
|
114 |
/** Print the page content */
|
@@ -143,28 +139,28 @@ class EDIT_SCHEDULE_OPTIMIZE extends WP_List_Table {
|
|
143 |
|
144 |
if(isset($_POST['aDBc_schedule_name'])){
|
145 |
|
146 |
-
$hook_name = $_POST['aDBc_schedule_name'];
|
147 |
-
$schedule_repeat = $_POST['aDBc_schedule_repeat'];
|
148 |
-
$schedule_date = $_POST['aDBc_date'];
|
149 |
-
$schedule_time = $_POST['aDBc_time'];
|
150 |
-
$operation1 = $_POST['aDBc_operation1'];
|
151 |
-
$operation2 = $_POST['aDBc_operation2'];
|
152 |
-
$schedule_status = $_POST['aDBc_status'];
|
153 |
|
154 |
}else{
|
155 |
|
156 |
-
$schedule_settings
|
157 |
-
$schedule_params
|
158 |
|
159 |
-
$hook_name
|
160 |
-
$schedule_repeat
|
161 |
-
$timestamp
|
162 |
if($timestamp){
|
163 |
-
$schedule_date
|
164 |
-
$schedule_time
|
165 |
}else{
|
166 |
-
$schedule_date
|
167 |
-
$schedule_time
|
168 |
}
|
169 |
|
170 |
$operation1 = in_array('optimize', $schedule_params['operations']) ? 'optimize' : '';
|
@@ -222,9 +218,9 @@ class EDIT_SCHEDULE_OPTIMIZE extends WP_List_Table {
|
|
222 |
<input type="checkbox" name="aDBc_operation2" value="repair" <?php echo $operation2 == "repair" ? 'checked' : ''; ?>>
|
223 |
<?php _e('Repair','advanced-database-cleaner');?>
|
224 |
</div>
|
225 |
-
|
226 |
<div style="text-align:left"><?php _e('Schedule status','advanced-database-cleaner');?></div>
|
227 |
-
|
228 |
<div style="margin-top:2px;text-align:left;background:#fff;padding:5px;box-shadow:0 0 10px #e0e0e0;border-radius:5px">
|
229 |
<input type="radio" name="aDBc_status" value="1" checked>
|
230 |
<span style="margin-right:20px"><?php _e('Active','advanced-database-cleaner');?></span>
|
@@ -232,15 +228,12 @@ class EDIT_SCHEDULE_OPTIMIZE extends WP_List_Table {
|
|
232 |
<input type="radio" name="aDBc_status" value="0" <?php echo $schedule_status == "0" ? 'checked' : ''; ?>>
|
233 |
<?php _e('Inactive','advanced-database-cleaner');?>
|
234 |
</div>
|
235 |
-
|
236 |
<div style="width:100%;margin-top:20px">
|
237 |
<input class="button-primary" type="submit" value="<?php _e('Save the schedule','advanced-database-cleaner'); ?>" style="width:100%;"/>
|
238 |
</div>
|
239 |
-
|
240 |
-
|
241 |
-
|
242 |
-
</div>
|
243 |
|
|
|
244 |
</div>
|
245 |
</div>
|
246 |
|
46 |
// Delete the old schedule and replace it with the new
|
47 |
|
48 |
// We will create the new schedule
|
49 |
+
$new_schedule_params['repeat'] = sanitize_html_class($_POST['aDBc_schedule_repeat']);
|
50 |
+
$new_schedule_params['start_date'] = preg_replace("/[^0-9-]/", '', $_POST['aDBc_date']);
|
51 |
+
$new_schedule_params['start_time'] = preg_replace("/[^0-9:]/", '', $_POST['aDBc_time']);
|
52 |
|
53 |
// Prepare operations to perform
|
54 |
$operations = array();
|
55 |
if(!empty($_POST['aDBc_operation1']))
|
56 |
+
array_push($operations, sanitize_html_class($_POST['aDBc_operation1']));
|
57 |
if(!empty($_POST['aDBc_operation2']))
|
58 |
+
array_push($operations, sanitize_html_class($_POST['aDBc_operation2']));
|
59 |
$new_schedule_params['operations'] = $operations;
|
60 |
|
61 |
+
$new_schedule_params['active'] = sanitize_html_class($_POST['aDBc_status']);
|
62 |
$optimize_schedule_setting[$_POST['aDBc_schedule_name']] = $new_schedule_params;
|
63 |
update_option('aDBc_optimize_schedule', $optimize_schedule_setting, "no");
|
64 |
|
65 |
+
list($year, $month, $day) = explode('-', preg_replace("/[^0-9-]/", '', $_POST['aDBc_date']));
|
66 |
+
list($hours, $minutes) = explode(':', preg_replace("/[^0-9:]/", '', $_POST['aDBc_time']));
|
67 |
$seconds = "0";
|
68 |
$timestamp = mktime($hours, $minutes, $seconds, $month, $day, $year);
|
69 |
|
74 |
if($_POST['aDBc_schedule_repeat'] == "once"){
|
75 |
wp_schedule_single_event($timestamp, "aDBc_optimize_scheduler", array($_POST['aDBc_schedule_name']));
|
76 |
}else{
|
77 |
+
wp_schedule_event($timestamp, sanitize_html_class($_POST['aDBc_schedule_repeat']), "aDBc_optimize_scheduler", array($_POST['aDBc_schedule_name']));
|
78 |
}
|
79 |
$this->aDBc_message = __('The clean-up schedule saved successfully!', 'advanced-database-cleaner');
|
80 |
}else{
|
81 |
$this->aDBc_message = __('The clean-up schedule saved successfully but it is inactive!', 'advanced-database-cleaner');
|
82 |
}
|
|
|
83 |
}else{
|
84 |
$this->aDBc_class_message = "error";
|
85 |
$this->aDBc_message = __('Please choose at least one operation to perform!', 'advanced-database-cleaner');
|
105 |
$this->aDBc_message = __('Please give a name to your schedule!', 'advanced-database-cleaner');
|
106 |
}
|
107 |
}
|
|
|
|
|
|
|
108 |
}
|
109 |
|
110 |
/** Print the page content */
|
139 |
|
140 |
if(isset($_POST['aDBc_schedule_name'])){
|
141 |
|
142 |
+
$hook_name = sanitize_html_class($_POST['aDBc_schedule_name']);
|
143 |
+
$schedule_repeat = sanitize_html_class($_POST['aDBc_schedule_repeat']);
|
144 |
+
$schedule_date = preg_replace("/[^0-9-]/", '', $_POST['aDBc_date']);
|
145 |
+
$schedule_time = preg_replace("/[^0-9:]/", '', $_POST['aDBc_time']);
|
146 |
+
$operation1 = isset($_POST['aDBc_operation1']) ? sanitize_html_class($_POST['aDBc_operation1']) : "";
|
147 |
+
$operation2 = isset($_POST['aDBc_operation2']) ? sanitize_html_class($_POST['aDBc_operation2']) : "";
|
148 |
+
$schedule_status = sanitize_html_class($_POST['aDBc_status']);
|
149 |
|
150 |
}else{
|
151 |
|
152 |
+
$schedule_settings = get_option('aDBc_optimize_schedule');
|
153 |
+
$schedule_params = $schedule_settings[sanitize_html_class($_GET['hook_name'])];
|
154 |
|
155 |
+
$hook_name = sanitize_html_class($_GET['hook_name']);
|
156 |
+
$schedule_repeat = $schedule_params['repeat'];
|
157 |
+
$timestamp = wp_next_scheduled("aDBc_optimize_scheduler", array(sanitize_html_class($_GET['hook_name']) . ''));
|
158 |
if($timestamp){
|
159 |
+
$schedule_date = date("Y-m-d", $timestamp);
|
160 |
+
$schedule_time = date("H:i", $timestamp);
|
161 |
}else{
|
162 |
+
$schedule_date = date("Y-m-d");
|
163 |
+
$schedule_time = date("H:i", time());
|
164 |
}
|
165 |
|
166 |
$operation1 = in_array('optimize', $schedule_params['operations']) ? 'optimize' : '';
|
218 |
<input type="checkbox" name="aDBc_operation2" value="repair" <?php echo $operation2 == "repair" ? 'checked' : ''; ?>>
|
219 |
<?php _e('Repair','advanced-database-cleaner');?>
|
220 |
</div>
|
221 |
+
|
222 |
<div style="text-align:left"><?php _e('Schedule status','advanced-database-cleaner');?></div>
|
223 |
+
|
224 |
<div style="margin-top:2px;text-align:left;background:#fff;padding:5px;box-shadow:0 0 10px #e0e0e0;border-radius:5px">
|
225 |
<input type="radio" name="aDBc_status" value="1" checked>
|
226 |
<span style="margin-right:20px"><?php _e('Active','advanced-database-cleaner');?></span>
|
228 |
<input type="radio" name="aDBc_status" value="0" <?php echo $schedule_status == "0" ? 'checked' : ''; ?>>
|
229 |
<?php _e('Inactive','advanced-database-cleaner');?>
|
230 |
</div>
|
231 |
+
|
232 |
<div style="width:100%;margin-top:20px">
|
233 |
<input class="button-primary" type="submit" value="<?php _e('Save the schedule','advanced-database-cleaner'); ?>" style="width:100%;"/>
|
234 |
</div>
|
|
|
|
|
|
|
|
|
235 |
|
236 |
+
</div>
|
237 |
</div>
|
238 |
</div>
|
239 |
|
includes/functions.php
CHANGED
@@ -254,7 +254,7 @@ function aDBc_optimize_scheduled_tables($schedule_name){
|
|
254 |
$table_name = $table->TABLE_NAME;
|
255 |
}
|
256 |
|
257 |
-
$wpdb->query("OPTIMIZE TABLE " . $table_name);
|
258 |
}
|
259 |
}
|
260 |
|
254 |
$table_name = $table->TABLE_NAME;
|
255 |
}
|
256 |
|
257 |
+
$wpdb->query("OPTIMIZE TABLE " . $table_name);
|
258 |
}
|
259 |
}
|
260 |
|
js/admin.js
CHANGED
@@ -1,129 +1,141 @@
|
|
1 |
jQuery(document).ready(function(){
|
2 |
|
3 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
4 |
|
5 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
6 |
|
7 |
-
|
8 |
-
|
9 |
|
10 |
-
//
|
11 |
-
if(
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
}
|
16 |
|
17 |
-
//
|
18 |
-
|
19 |
-
|
20 |
-
jQuery('#aDBc_new_search_button').attr("value", aDBc_ajax_obj.sentence_scanning);
|
21 |
-
jQuery('#aDBc_new_search_button').css('background-image', 'url(' + aDBc_ajax_obj.images_path + 'loading20px.svg)');
|
22 |
-
jQuery('#aDBc_new_search_button').attr("disabled", true);
|
23 |
-
jQuery('#aDBc_progress_container').show();
|
24 |
-
|
25 |
-
jQuery.ajax({
|
26 |
-
type : "post",
|
27 |
-
url: aDBc_ajax_obj.ajaxurl,
|
28 |
-
cache: false,
|
29 |
-
data: {
|
30 |
-
'action': 'aDBc_new_run_search_for_items',
|
31 |
-
'aDBc_item_type': aDBc_item_type
|
32 |
-
},
|
33 |
-
success: function(result) {
|
34 |
-
|
35 |
-
},
|
36 |
-
complete: function(){
|
37 |
-
// wait for 1 sec then reload the page.
|
38 |
-
setTimeout(function(){
|
39 |
-
location.reload();
|
40 |
-
}, 1000);
|
41 |
-
}
|
42 |
-
});
|
43 |
-
setTimeout(getProgress, 500);
|
44 |
-
}
|
45 |
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
-
},
|
75 |
-
complete: function(){
|
76 |
-
// wait for 1 sec then reload the page.
|
77 |
-
setTimeout(function(){
|
78 |
-
location.reload();
|
79 |
-
}, 1000);
|
80 |
-
|
81 |
-
}
|
82 |
-
});
|
83 |
-
setTimeout(getProgress, 500);
|
84 |
-
return false;
|
85 |
-
});
|
86 |
|
87 |
-
|
88 |
-
|
89 |
-
|
90 |
-
|
91 |
-
|
92 |
-
|
93 |
-
|
94 |
-
|
95 |
-
|
96 |
-
|
97 |
-
|
98 |
-
|
99 |
-
|
100 |
-
|
101 |
-
|
102 |
-
|
103 |
-
|
104 |
-
|
105 |
-
|
106 |
-
|
107 |
-
|
108 |
-
|
109 |
-
|
110 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
111 |
}
|
112 |
}
|
113 |
-
}
|
114 |
-
}
|
115 |
|
|
|
116 |
jQuery('.aDBc_keep_link').click(function(event){
|
117 |
|
118 |
-
var idelement
|
119 |
-
var itemname
|
120 |
|
121 |
-
jQuery("#aDBc_edit_keep_"+itemname).hide();
|
122 |
-
jQuery("#aDBc_keep_label_"+itemname).hide();
|
123 |
|
124 |
-
jQuery('#aDBc_keep_input_'+itemname).show();
|
125 |
-
jQuery('#aDBc_keep_button_'+itemname).show();
|
126 |
-
jQuery('#aDBc_keep_cancel_'+itemname).show();
|
127 |
|
128 |
jQuery('.aDBc_keep_link').css("pointer-events", "none");
|
129 |
jQuery('.aDBc_keep_link').css("cursor", "default");
|
@@ -133,15 +145,15 @@ jQuery(document).ready(function(){
|
|
133 |
|
134 |
jQuery('.aDBc_keep_cancel_link').click(function(event){
|
135 |
|
136 |
-
var idelement
|
137 |
-
var itemname
|
138 |
|
139 |
-
jQuery('#aDBc_keep_input_'+itemname).hide();
|
140 |
-
jQuery('#aDBc_keep_button_'+itemname).hide();
|
141 |
-
jQuery('#aDBc_keep_cancel_'+itemname).hide();
|
142 |
|
143 |
-
jQuery("#aDBc_edit_keep_"+itemname).show();
|
144 |
-
jQuery("#aDBc_keep_label_"+itemname).show();
|
145 |
|
146 |
jQuery('.aDBc_keep_link').css("pointer-events", "");
|
147 |
jQuery('.aDBc_keep_link').css("cursor", "pointer");
|
@@ -150,84 +162,3 @@ jQuery(document).ready(function(){
|
|
150 |
});
|
151 |
|
152 |
});
|
153 |
-
|
154 |
-
|
155 |
-
jQuery(function($) {
|
156 |
-
|
157 |
-
var $delete_warning = $("#aDBc_dialog1");
|
158 |
-
$delete_warning.dialog({
|
159 |
-
'dialogClass' : 'wp-dialog',
|
160 |
-
'modal' : true,
|
161 |
-
'width' : 500,
|
162 |
-
'autoOpen' : false,
|
163 |
-
'closeOnEscape' : true,
|
164 |
-
'buttons' : {
|
165 |
-
"Close": function() {
|
166 |
-
$(this).dialog('close');
|
167 |
-
},
|
168 |
-
"Continue": function() {
|
169 |
-
$('form[id="aDBc_form"]').submit();
|
170 |
-
}
|
171 |
-
}
|
172 |
-
});
|
173 |
-
|
174 |
-
var $empty_warning = $("#aDBc_dialog2");
|
175 |
-
$empty_warning.dialog({
|
176 |
-
'dialogClass' : 'wp-dialog',
|
177 |
-
'modal' : true,
|
178 |
-
'width' : 500,
|
179 |
-
'autoOpen' : false,
|
180 |
-
'closeOnEscape' : true,
|
181 |
-
'buttons' : {
|
182 |
-
"Close": function() {
|
183 |
-
$(this).dialog('close');
|
184 |
-
},
|
185 |
-
"Continue": function() {
|
186 |
-
$('form[id="aDBc_form"]').submit();
|
187 |
-
}
|
188 |
-
}
|
189 |
-
});
|
190 |
-
|
191 |
-
var $select_action = $("#aDBc_dialogx");
|
192 |
-
$select_action.dialog({
|
193 |
-
'dialogClass' : 'wp-dialog',
|
194 |
-
'modal' : true,
|
195 |
-
'width' : 300,
|
196 |
-
'autoOpen' : false,
|
197 |
-
'closeOnEscape' : true,
|
198 |
-
'buttons' : {
|
199 |
-
"Close": function() {
|
200 |
-
$(this).dialog('close');
|
201 |
-
}
|
202 |
-
}
|
203 |
-
});
|
204 |
-
|
205 |
-
$("#doaction").click(function(event) {
|
206 |
-
var $bulk_action = $('#bulk-action-selector-top').val();
|
207 |
-
if($bulk_action == 'delete' || $bulk_action == 'clean'){
|
208 |
-
event.preventDefault();
|
209 |
-
$delete_warning.dialog('open');
|
210 |
-
}else if($bulk_action == 'empty'){
|
211 |
-
event.preventDefault();
|
212 |
-
$empty_warning.dialog('open');
|
213 |
-
}else if($bulk_action == '-1'){
|
214 |
-
event.preventDefault();
|
215 |
-
$select_action.dialog('open');
|
216 |
-
}
|
217 |
-
});
|
218 |
-
|
219 |
-
$("#doaction2").click(function(event) {
|
220 |
-
var $bulk_action = $('#bulk-action-selector-bottom').val();
|
221 |
-
if($bulk_action == 'delete' || $bulk_action == 'clean'){
|
222 |
-
event.preventDefault();
|
223 |
-
$delete_warning.dialog('open');
|
224 |
-
}else if($bulk_action == 'empty'){
|
225 |
-
event.preventDefault();
|
226 |
-
$empty_warning.dialog('open');
|
227 |
-
}else if($bulk_action == '-1'){
|
228 |
-
event.preventDefault();
|
229 |
-
$select_action.dialog('open');
|
230 |
-
}
|
231 |
-
});
|
232 |
-
|
233 |
-
});
|
1 |
jQuery(document).ready(function(){
|
2 |
|
3 |
+
// Prevent submitting forms via Enter key to prevent any unexpected form submission
|
4 |
+
jQuery(window).keydown(function(event){
|
5 |
+
if(event.keyCode == 13) {
|
6 |
+
event.preventDefault();
|
7 |
+
return false;
|
8 |
+
}
|
9 |
+
});
|
10 |
|
11 |
+
// x10: After upgrading to WP 5.5, the button of #doaction2 at the button does not work anymore
|
12 |
+
// This is because when submitting the form below via 'jQuery("#aDBc_form").submit()', the form is sent without the action selected at bottom
|
13 |
+
// We make sure that both dropdowns have the same values so that the form is sent without issues
|
14 |
+
jQuery('#bulk-action-selector-bottom').on("change", function(e) {
|
15 |
+
var abdc_action = jQuery('#bulk-action-selector-bottom').val();
|
16 |
+
jQuery('#bulk-action-selector-top').val(abdc_action);
|
17 |
+
});
|
18 |
+
jQuery('#bulk-action-selector-top').on("change", function(e) {
|
19 |
+
var abdc_action = jQuery('#bulk-action-selector-top').val();
|
20 |
+
jQuery('#bulk-action-selector-bottom').val(abdc_action);
|
21 |
+
});
|
22 |
|
23 |
+
// When a user clicks on doaction or doaction2 button
|
24 |
+
jQuery('#doaction, #doaction2').on('click', function(e){
|
25 |
|
26 |
+
// Get action from the clicked button
|
27 |
+
if(this.id == 'doaction'){
|
28 |
+
var aDBc_action = jQuery("#bulk-action-selector-top").val();
|
29 |
+
}else if(this.id == 'doaction2'){
|
30 |
+
var aDBc_action = jQuery('#bulk-action-selector-bottom').val();
|
31 |
}
|
32 |
|
33 |
+
// Get values of top_action and bottom action
|
34 |
+
var abdc_top_action = jQuery('#bulk-action-selector-top').val();
|
35 |
+
var abdc_bottom_action = jQuery('#bulk-action-selector-bottom').val();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
36 |
|
37 |
+
// Before performing any action, test first if #bulk-action-selector-top and #bulk-action-selector-bottom have the same value as in x10 above
|
38 |
+
if(abdc_top_action != abdc_bottom_action){
|
39 |
+
|
40 |
+
// Prevent doaction button from its default behaviour
|
41 |
+
e.preventDefault();
|
42 |
+
|
43 |
+
// If values are different, show an error msg
|
44 |
+
Swal.fire({
|
45 |
+
icon : 'error',
|
46 |
+
confirmButtonColor : '#0085ba',
|
47 |
+
showCloseButton : true,
|
48 |
+
text : aDBc_ajax_obj.unexpected_error
|
49 |
+
})
|
50 |
+
|
51 |
+
// If no action selected
|
52 |
+
}else if(aDBc_action == "-1"){
|
53 |
+
|
54 |
+
// Prevent doaction button from its default behaviour
|
55 |
+
e.preventDefault();
|
56 |
+
|
57 |
+
// If no actions selected, show an error message
|
58 |
+
Swal.fire({
|
59 |
+
icon : 'error',
|
60 |
+
confirmButtonColor : '#0085ba',
|
61 |
+
showCloseButton : true,
|
62 |
+
text : aDBc_ajax_obj.select_action
|
63 |
+
})
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
64 |
|
65 |
+
}else{
|
66 |
+
|
67 |
+
// Test if the user has checked some items
|
68 |
+
var aDBc_elements_to_process = [];
|
69 |
+
|
70 |
+
// Get all selected items
|
71 |
+
jQuery('input[name="aDBc_elements_to_process[]"]:checked').each(function(){aDBc_elements_to_process.push(this.value);});
|
72 |
+
|
73 |
+
// If no items selected, show error message
|
74 |
+
if(aDBc_elements_to_process.length === 0) {
|
75 |
+
|
76 |
+
// Prevent doaction button from its default behaviour
|
77 |
+
e.preventDefault();
|
78 |
+
|
79 |
+
Swal.fire({
|
80 |
+
icon : 'error',
|
81 |
+
confirmButtonColor : '#0085ba',
|
82 |
+
showCloseButton : true,
|
83 |
+
text : aDBc_ajax_obj.no_items_selected
|
84 |
+
})
|
85 |
+
|
86 |
+
}else{
|
87 |
+
|
88 |
+
// The default warning msg to show is
|
89 |
+
var message_to_show = aDBc_ajax_obj.clean_items_warning;
|
90 |
+
|
91 |
+
// If 'empty' action is selected for tables, override the warning msg
|
92 |
+
if(aDBc_action == 'empty'){
|
93 |
+
var message_to_show = aDBc_ajax_obj.empty_tables_warning;
|
94 |
+
}
|
95 |
+
|
96 |
+
// We show the warning box msg only when actions such as: delete, clean, empty... are selected
|
97 |
+
if(aDBc_action == 'delete' || aDBc_action == 'clean' || aDBc_action == 'empty'){
|
98 |
+
|
99 |
+
// Prevent doaction button from its default behaviour
|
100 |
+
e.preventDefault();
|
101 |
+
|
102 |
+
Swal.fire({
|
103 |
+
title : '<font size="4px">' + aDBc_ajax_obj.are_you_sure + '</font>',
|
104 |
+
text : message_to_show,
|
105 |
+
footer : '<font size="3px" color="red"><b>' + aDBc_ajax_obj.make_db_backup_first + '</b></font>',
|
106 |
+
imageUrl : aDBc_ajax_obj.images_path + 'alert_delete.svg',
|
107 |
+
imageWidth : 60,
|
108 |
+
imageHeight : 60,
|
109 |
+
showCancelButton : true,
|
110 |
+
showCloseButton : true,
|
111 |
+
cancelButtonText : aDBc_ajax_obj.cancel,
|
112 |
+
cancelButtonColor : '#555',
|
113 |
+
confirmButtonText : aDBc_ajax_obj.Continue,
|
114 |
+
confirmButtonColor : '#0085ba',
|
115 |
+
focusCancel : true,
|
116 |
+
}).then((result) => {
|
117 |
+
// If the user clicked on "confirm", submit the form
|
118 |
+
if(result.value){
|
119 |
+
jQuery("#aDBc_form").submit();
|
120 |
+
}
|
121 |
+
})
|
122 |
}
|
123 |
}
|
124 |
+
}
|
125 |
+
});
|
126 |
|
127 |
+
// Actions to do when the user clicks on 'Edit' link to change the 'Keep last' value
|
128 |
jQuery('.aDBc_keep_link').click(function(event){
|
129 |
|
130 |
+
var idelement = (event.target.id).split("_");
|
131 |
+
var itemname = idelement[idelement.length-1];
|
132 |
|
133 |
+
jQuery("#aDBc_edit_keep_" + itemname).hide();
|
134 |
+
jQuery("#aDBc_keep_label_" + itemname).hide();
|
135 |
|
136 |
+
jQuery('#aDBc_keep_input_' + itemname).show();
|
137 |
+
jQuery('#aDBc_keep_button_' + itemname).show();
|
138 |
+
jQuery('#aDBc_keep_cancel_' + itemname).show();
|
139 |
|
140 |
jQuery('.aDBc_keep_link').css("pointer-events", "none");
|
141 |
jQuery('.aDBc_keep_link').css("cursor", "default");
|
145 |
|
146 |
jQuery('.aDBc_keep_cancel_link').click(function(event){
|
147 |
|
148 |
+
var idelement = (event.target.id).split("_");
|
149 |
+
var itemname = idelement[idelement.length-1];
|
150 |
|
151 |
+
jQuery('#aDBc_keep_input_' + itemname).hide();
|
152 |
+
jQuery('#aDBc_keep_button_' + itemname).hide();
|
153 |
+
jQuery('#aDBc_keep_cancel_' + itemname).hide();
|
154 |
|
155 |
+
jQuery("#aDBc_edit_keep_" + itemname).show();
|
156 |
+
jQuery("#aDBc_keep_label_" + itemname).show();
|
157 |
|
158 |
jQuery('.aDBc_keep_link').css("pointer-events", "");
|
159 |
jQuery('.aDBc_keep_link').css("cursor", "pointer");
|
162 |
});
|
163 |
|
164 |
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
js/sweetalert2.min.js
ADDED
@@ -0,0 +1,6 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
/*******************************************
|
2 |
+
Sweetalert2
|
3 |
+
https://github.com/Sweetalert2/Sweetalert2
|
4 |
+
MIT License
|
5 |
+
*******************************************/
|
6 |
+
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):(t=t||self).Sweetalert2=e()}(this,function(){"use strict";function r(t){return(r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function a(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function o(t,e){for(var n=0;n<e.length;n++){var o=e[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(t,o.key,o)}}function c(t,e,n){return e&&o(t.prototype,e),n&&o(t,n),t}function s(){return(s=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(t[o]=n[o])}return t}).apply(this,arguments)}function u(t){return(u=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}function l(t,e){return(l=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function d(){if("undefined"!=typeof Reflect&&Reflect.construct&&!Reflect.construct.sham){if("function"==typeof Proxy)return 1;try{return Date.prototype.toString.call(Reflect.construct(Date,[],function(){})),1}catch(t){return}}}function i(t,e,n){return(i=d()?Reflect.construct:function(t,e,n){var o=[null];o.push.apply(o,e);var i=new(Function.bind.apply(t,o));return n&&l(i,n.prototype),i}).apply(null,arguments)}function p(t,e){return!e||"object"!=typeof e&&"function"!=typeof e?function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t):e}function f(t,e,n){return(f="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(t,e,n){var o=function(t,e){for(;!Object.prototype.hasOwnProperty.call(t,e)&&null!==(t=u(t)););return t}(t,e);if(o){var i=Object.getOwnPropertyDescriptor(o,e);return i.get?i.get.call(n):i.value}})(t,e,n||t)}function m(e){return Object.keys(e).map(function(t){return e[t]})}function h(t){return Array.prototype.slice.call(t)}function v(t){console.error("".concat(D," ").concat(t))}function g(t,e){var n;n='"'.concat(t,'" is deprecated and will be removed in the next major release. Please use "').concat(e,'" instead.'),-1===U.indexOf(n)&&(U.push(n),N(n))}function b(t){return t&&Promise.resolve(t)===t}function y(t){return t instanceof Element||"object"===r(e=t)&&e.jquery;var e}function t(t){var e={};for(var n in t)e[t[n]]="swal2-"+t[n];return e}function w(t){var e=K();return e?e.querySelector(t):null}function e(t){return w(".".concat(t))}function n(){var t=Y();return h(t.querySelectorAll(".".concat(z.icon)))}function C(){var t=n().filter(function(t){return mt(t)});return t.length?t[0]:null}function k(){return e(z.title)}function x(){return e(z.content)}function P(){return e(z.image)}function A(){return e(z["progress-steps"])}function B(){return e(z["validation-message"])}function S(){return w(".".concat(z.actions," .").concat(z.confirm))}function E(){return w(".".concat(z.actions," .").concat(z.cancel))}function O(){return e(z.actions)}function T(){return e(z.header)}function L(){return e(z.footer)}function q(){return e(z["timer-progress-bar"])}function I(){return e(z.close)}function j(){var t=h(Y().querySelectorAll('[tabindex]:not([tabindex="-1"]):not([tabindex="0"])')).sort(function(t,e){return t=parseInt(t.getAttribute("tabindex")),(e=parseInt(e.getAttribute("tabindex")))<t?1:t<e?-1:0}),e=h(Y().querySelectorAll('\n a[href],\n area[href],\n input:not([disabled]),\n select:not([disabled]),\n textarea:not([disabled]),\n button:not([disabled]),\n iframe,\n object,\n embed,\n [tabindex="0"],\n [contenteditable],\n audio[controls],\n video[controls],\n summary\n')).filter(function(t){return"-1"!==t.getAttribute("tabindex")});return function(t){for(var e=[],n=0;n<t.length;n++)-1===e.indexOf(t[n])&&e.push(t[n]);return e}(t.concat(e)).filter(function(t){return mt(t)})}function M(){return!Z()&&!document.body.classList.contains(z["no-backdrop"])}function V(e,t){if(e.textContent="",t){var n=(new DOMParser).parseFromString(t,"text/html");h(n.querySelector("head").childNodes).forEach(function(t){e.appendChild(t)}),h(n.querySelector("body").childNodes).forEach(function(t){e.appendChild(t)})}}function R(t,e){if(e){for(var n=e.split(/\s+/),o=0;o<n.length;o++)if(!t.classList.contains(n[o]))return;return 1}}function H(t,e,n){var o,i;if(i=e,h((o=t).classList).forEach(function(t){-1===m(z).indexOf(t)&&-1===m(W).indexOf(t)&&-1===m(i.showClass).indexOf(t)&&o.classList.remove(t)}),e.customClass&&e.customClass[n]){if("string"!=typeof e.customClass[n]&&!e.customClass[n].forEach)return N("Invalid type of customClass.".concat(n,'! Expected string or iterable object, got "').concat(r(e.customClass[n]),'"'));dt(t,e.customClass[n])}}var D="SweetAlert2:",N=function(t){console.warn("".concat(D," ").concat(t))},U=[],_=function(t){return"function"==typeof t?t():t},F=Object.freeze({cancel:"cancel",backdrop:"backdrop",close:"close",esc:"esc",timer:"timer"}),z=t(["container","shown","height-auto","iosfix","popup","modal","no-backdrop","no-transition","toast","toast-shown","toast-column","show","hide","close","title","header","content","html-container","actions","confirm","cancel","footer","icon","icon-content","image","input","file","range","select","radio","checkbox","label","textarea","inputerror","validation-message","progress-steps","active-progress-step","progress-step","progress-step-line","loading","styled","top","top-start","top-end","top-left","top-right","center","center-start","center-end","center-left","center-right","bottom","bottom-start","bottom-end","bottom-left","bottom-right","grow-row","grow-column","grow-fullscreen","rtl","timer-progress-bar","timer-progress-bar-container","scrollbar-measure","icon-success","icon-warning","icon-info","icon-question","icon-error"]),W=t(["success","warning","info","question","error"]),K=function(){return document.body.querySelector(".".concat(z.container))},Y=function(){return e(z.popup)},Z=function(){return document.body.classList.contains(z["toast-shown"])},Q={previousBodyPadding:null};function $(t,e){if(!e)return null;switch(e){case"select":case"textarea":case"file":return ft(t,z[e]);case"checkbox":return t.querySelector(".".concat(z.checkbox," input"));case"radio":return t.querySelector(".".concat(z.radio," input:checked"))||t.querySelector(".".concat(z.radio," input:first-child"));case"range":return t.querySelector(".".concat(z.range," input"));default:return ft(t,z.input)}}function J(t){if(t.focus(),"file"!==t.type){var e=t.value;t.value="",t.value=e}}function X(t,e,n){t&&e&&("string"==typeof e&&(e=e.split(/\s+/).filter(Boolean)),e.forEach(function(e){t.forEach?t.forEach(function(t){n?t.classList.add(e):t.classList.remove(e)}):n?t.classList.add(e):t.classList.remove(e)}))}function G(t,e,n){n||0===parseInt(n)?t.style[e]="number"==typeof n?"".concat(n,"px"):n:t.style.removeProperty(e)}function tt(t,e){var n=1<arguments.length&&void 0!==e?e:"flex";t.style.opacity="",t.style.display=n}function et(t){t.style.opacity="",t.style.display="none"}function nt(t,e,n){e?tt(t,n):et(t)}function ot(t){return!!(t.scrollHeight>t.clientHeight)}function it(t){var e=window.getComputedStyle(t),n=parseFloat(e.getPropertyValue("animation-duration")||"0"),o=parseFloat(e.getPropertyValue("transition-duration")||"0");return 0<n||0<o}function rt(t,e){var n=1<arguments.length&&void 0!==e&&e,o=q();mt(o)&&(n&&(o.style.transition="none",o.style.width="100%"),setTimeout(function(){o.style.transition="width ".concat(t/1e3,"s linear"),o.style.width="0%"},10))}function at(){return"undefined"==typeof window||"undefined"==typeof document}function ct(t){nn.isVisible()&<!==t.target.value&&nn.resetValidationMessage(),lt=t.target.value}function st(t,e){t instanceof HTMLElement?e.appendChild(t):"object"===r(t)?vt(t,e):t&&V(e,t)}function ut(t,e){var n=O(),o=S(),i=E();e.showConfirmButton||e.showCancelButton||et(n),H(n,e,"actions"),wt(o,"confirm",e),wt(i,"cancel",e),e.buttonsStyling?function(t,e,n){dt([t,e],z.styled),n.confirmButtonColor&&(t.style.backgroundColor=n.confirmButtonColor);n.cancelButtonColor&&(e.style.backgroundColor=n.cancelButtonColor);var o=window.getComputedStyle(t).getPropertyValue("background-color");t.style.borderLeftColor=o,t.style.borderRightColor=o}(o,i,e):(pt([o,i],z.styled),o.style.backgroundColor=o.style.borderLeftColor=o.style.borderRightColor="",i.style.backgroundColor=i.style.borderLeftColor=i.style.borderRightColor=""),e.reverseButtons&&o.parentNode.insertBefore(i,o)}var lt,dt=function(t,e){X(t,e,!0)},pt=function(t,e){X(t,e,!1)},ft=function(t,e){for(var n=0;n<t.childNodes.length;n++)if(R(t.childNodes[n],e))return t.childNodes[n]},mt=function(t){return!(!t||!(t.offsetWidth||t.offsetHeight||t.getClientRects().length))},ht='\n <div aria-labelledby="'.concat(z.title,'" aria-describedby="').concat(z.content,'" class="').concat(z.popup,'" tabindex="-1">\n <div class="').concat(z.header,'">\n <ul class="').concat(z["progress-steps"],'"></ul>\n <div class="').concat(z.icon," ").concat(W.error,'"></div>\n <div class="').concat(z.icon," ").concat(W.question,'"></div>\n <div class="').concat(z.icon," ").concat(W.warning,'"></div>\n <div class="').concat(z.icon," ").concat(W.info,'"></div>\n <div class="').concat(z.icon," ").concat(W.success,'"></div>\n <img class="').concat(z.image,'" />\n <h2 class="').concat(z.title,'" id="').concat(z.title,'"></h2>\n <button type="button" class="').concat(z.close,'"></button>\n </div>\n <div class="').concat(z.content,'">\n <div id="').concat(z.content,'" class="').concat(z["html-container"],'"></div>\n <input class="').concat(z.input,'" />\n <input type="file" class="').concat(z.file,'" />\n <div class="').concat(z.range,'">\n <input type="range" />\n <output></output>\n </div>\n <select class="').concat(z.select,'"></select>\n <div class="').concat(z.radio,'"></div>\n <label for="').concat(z.checkbox,'" class="').concat(z.checkbox,'">\n <input type="checkbox" />\n <span class="').concat(z.label,'"></span>\n </label>\n <textarea class="').concat(z.textarea,'"></textarea>\n <div class="').concat(z["validation-message"],'" id="').concat(z["validation-message"],'"></div>\n </div>\n <div class="').concat(z.actions,'">\n <button type="button" class="').concat(z.confirm,'">OK</button>\n <button type="button" class="').concat(z.cancel,'">Cancel</button>\n </div>\n <div class="').concat(z.footer,'"></div>\n <div class="').concat(z["timer-progress-bar-container"],'">\n <div class="').concat(z["timer-progress-bar"],'"></div>\n </div>\n </div>\n').replace(/(^|\n)\s*/g,""),gt=function(t){var e,n=!!(e=K())&&(e.parentNode.removeChild(e),pt([document.documentElement,document.body],[z["no-backdrop"],z["toast-shown"],z["has-column"]]),!0);if(at())v("SweetAlert2 requires document to initialize");else{var o=document.createElement("div");o.className=z.container,n&&dt(o,z["no-transition"]),V(o,ht);var i,r,a,c,s,u,l,d,p,f,m,h,g="string"==typeof(i=t.target)?document.querySelector(i):i;g.appendChild(o),r=t,(a=Y()).setAttribute("role",r.toast?"alert":"dialog"),a.setAttribute("aria-live",r.toast?"polite":"assertive"),r.toast||a.setAttribute("aria-modal","true"),c=g,"rtl"===window.getComputedStyle(c).direction&&dt(K(),z.rtl),s=x(),u=ft(s,z.input),l=ft(s,z.file),d=s.querySelector(".".concat(z.range," input")),p=s.querySelector(".".concat(z.range," output")),f=ft(s,z.select),m=s.querySelector(".".concat(z.checkbox," input")),h=ft(s,z.textarea),u.oninput=ct,l.onchange=ct,f.onchange=ct,m.onchange=ct,h.oninput=ct,d.oninput=function(t){ct(t),p.value=d.value},d.onchange=function(t){ct(t),d.nextSibling.value=d.value}}},vt=function(t,e){t.jquery?bt(e,t):V(e,t.toString())},bt=function(t,e){if(t.textContent="",0 in e)for(var n=0;n in e;n++)t.appendChild(e[n].cloneNode(!0));else t.appendChild(e.cloneNode(!0))},yt=function(){if(at())return!1;var t=document.createElement("div"),e={WebkitAnimation:"webkitAnimationEnd",OAnimation:"oAnimationEnd oanimationend",animation:"animationend"};for(var n in e)if(Object.prototype.hasOwnProperty.call(e,n)&&void 0!==t.style[n])return e[n];return!1}();function wt(t,e,n){var o;nt(t,n["show".concat((o=e).charAt(0).toUpperCase()+o.slice(1),"Button")],"inline-block"),V(t,n["".concat(e,"ButtonText")]),t.setAttribute("aria-label",n["".concat(e,"ButtonAriaLabel")]),t.className=z[e],H(t,n,"".concat(e,"Button")),dt(t,n["".concat(e,"ButtonClass")])}function Ct(t,e){var n=K();if(n){var o,i,r,a;o=n,"string"==typeof(i=e.backdrop)?o.style.background=i:i||dt([document.documentElement,document.body],z["no-backdrop"]),!e.backdrop&&e.allowOutsideClick&&N('"allowOutsideClick" parameter requires `backdrop` parameter to be set to `true`'),r=n,(a=e.position)in z?dt(r,z[a]):(N('The "position" parameter is not valid, defaulting to "center"'),dt(r,z.center)),function(t,e){if(e&&"string"==typeof e){var n="grow-".concat(e);n in z&&dt(t,z[n])}}(n,e.grow),H(n,e,"container");var c=document.body.getAttribute("data-swal2-queue-step");c&&(n.setAttribute("data-queue-step",c),document.body.removeAttribute("data-swal2-queue-step"))}}function kt(t,e){t.placeholder&&!e.inputPlaceholder||(t.placeholder=e.inputPlaceholder)}var xt={promise:new WeakMap,innerParams:new WeakMap,domCache:new WeakMap},Pt=["input","file","range","select","radio","checkbox","textarea"],At=function(t){if(!Ot[t.input])return v('Unexpected type of input! Expected "text", "email", "password", "number", "tel", "select", "radio", "checkbox", "textarea", "file" or "url", got "'.concat(t.input,'"'));var e=Et(t.input),n=Ot[t.input](e,t);tt(n),setTimeout(function(){J(n)})},Bt=function(t,e){var n=$(x(),t);if(n)for(var o in!function(t){for(var e=0;e<t.attributes.length;e++){var n=t.attributes[e].name;-1===["type","value","style"].indexOf(n)&&t.removeAttribute(n)}}(n),e)"range"===t&&"placeholder"===o||n.setAttribute(o,e[o])},St=function(t){var e=Et(t.input);t.customClass&&dt(e,t.customClass.input)},Et=function(t){var e=z[t]?z[t]:z.input;return ft(x(),e)},Ot={};Ot.text=Ot.email=Ot.password=Ot.number=Ot.tel=Ot.url=function(t,e){return"string"==typeof e.inputValue||"number"==typeof e.inputValue?t.value=e.inputValue:b(e.inputValue)||N('Unexpected type of inputValue! Expected "string", "number" or "Promise", got "'.concat(r(e.inputValue),'"')),kt(t,e),t.type=e.input,t},Ot.file=function(t,e){return kt(t,e),t},Ot.range=function(t,e){var n=t.querySelector("input"),o=t.querySelector("output");return n.value=e.inputValue,n.type=e.input,o.value=e.inputValue,t},Ot.select=function(t,e){if(t.textContent="",e.inputPlaceholder){var n=document.createElement("option");V(n,e.inputPlaceholder),n.value="",n.disabled=!0,n.selected=!0,t.appendChild(n)}return t},Ot.radio=function(t){return t.textContent="",t},Ot.checkbox=function(t,e){var n=$(x(),"checkbox");n.value=1,n.id=z.checkbox,n.checked=Boolean(e.inputValue);var o=t.querySelector("span");return V(o,e.inputPlaceholder),t},Ot.textarea=function(e,t){if(e.value=t.inputValue,kt(e,t),"MutationObserver"in window){var n=parseInt(window.getComputedStyle(Y()).width),o=parseInt(window.getComputedStyle(Y()).paddingLeft)+parseInt(window.getComputedStyle(Y()).paddingRight);new MutationObserver(function(){var t=e.offsetWidth+o;Y().style.width=n<t?"".concat(t,"px"):null}).observe(e,{attributes:!0,attributeFilter:["style"]})}return e};function Tt(t,e){var n,o,i,r,a,c=x().querySelector("#".concat(z.content));e.html?(st(e.html,c),tt(c,"block")):e.text?(c.textContent=e.text,tt(c,"block")):et(c),n=t,o=e,i=x(),r=xt.innerParams.get(n),a=!r||o.input!==r.input,Pt.forEach(function(t){var e=z[t],n=ft(i,e);Bt(t,o.inputAttributes),n.className=e,a&&et(n)}),o.input&&(a&&At(o),St(o)),H(x(),e,"content")}function Lt(){return K()&&K().getAttribute("data-queue-step")}function qt(t,s){var u=A();if(!s.progressSteps||0===s.progressSteps.length)return et(u);tt(u),u.textContent="";var l=parseInt(void 0===s.currentProgressStep?Lt():s.currentProgressStep);l>=s.progressSteps.length&&N("Invalid currentProgressStep parameter, it should be less than progressSteps.length (currentProgressStep like JS arrays starts from 0)"),s.progressSteps.forEach(function(t,e){var n,o,i,r,a=(n=t,o=document.createElement("li"),dt(o,z["progress-step"]),V(o,n),o);if(u.appendChild(a),e===l&&dt(a,z["active-progress-step"]),e!==s.progressSteps.length-1){var c=(i=t,r=document.createElement("li"),dt(r,z["progress-step-line"]),i.progressStepsDistance&&(r.style.width=i.progressStepsDistance),r);u.appendChild(c)}})}function It(t,e){var n,o,i,r,a=T();H(a,e,"header"),qt(0,e),function(t,e){var n=xt.innerParams.get(t);if(n&&e.icon===n.icon&&C())H(C(),e,"icon");else if(Vt(),e.icon)if(-1!==Object.keys(W).indexOf(e.icon)){var o=w(".".concat(z.icon,".").concat(W[e.icon]));tt(o),Ht(o,e),Rt(),H(o,e,"icon"),dt(o,e.showClass.icon)}else v('Unknown icon! Expected "success", "error", "warning", "info" or "question", got "'.concat(e.icon,'"'))}(t,e),function(t){var e=P();if(!t.imageUrl)return et(e);tt(e),e.setAttribute("src",t.imageUrl),e.setAttribute("alt",t.imageAlt),G(e,"width",t.imageWidth),G(e,"height",t.imageHeight),e.className=z.image,H(e,t,"image")}(e),n=e,o=k(),nt(o,n.title||n.titleText),n.title&&st(n.title,o),n.titleText&&(o.innerText=n.titleText),H(o,n,"title"),i=e,r=I(),V(r,i.closeButtonHtml),H(r,i,"closeButton"),nt(r,i.showCloseButton),r.setAttribute("aria-label",i.closeButtonAriaLabel)}function jt(t,e){var n,o,i,r;n=e,o=Y(),G(o,"width",n.width),G(o,"padding",n.padding),n.background&&(o.style.background=n.background),Ut(o,n),Ct(0,e),It(t,e),Tt(t,e),ut(0,e),i=e,r=L(),nt(r,i.footer),i.footer&&st(i.footer,r),H(r,i,"footer"),"function"==typeof e.onRender&&e.onRender(Y())}function Mt(){return S()&&S().click()}var Vt=function(){for(var t=n(),e=0;e<t.length;e++)et(t[e])},Rt=function(){for(var t=Y(),e=window.getComputedStyle(t).getPropertyValue("background-color"),n=t.querySelectorAll("[class^=swal2-success-circular-line], .swal2-success-fix"),o=0;o<n.length;o++)n[o].style.backgroundColor=e},Ht=function(t,e){if(t.textContent="",e.iconHtml)V(t,Dt(e.iconHtml));else if("success"===e.icon)V(t,'\n <div class="swal2-success-circular-line-left"></div>\n <span class="swal2-success-line-tip"></span> <span class="swal2-success-line-long"></span>\n <div class="swal2-success-ring"></div> <div class="swal2-success-fix"></div>\n <div class="swal2-success-circular-line-right"></div>\n ');else if("error"===e.icon)V(t,'\n <span class="swal2-x-mark">\n <span class="swal2-x-mark-line-left"></span>\n <span class="swal2-x-mark-line-right"></span>\n </span>\n ');else{V(t,Dt({question:"?",warning:"!",info:"i"}[e.icon]))}},Dt=function(t){return'<div class="'.concat(z["icon-content"],'">').concat(t,"</div>")},Nt=[],Ut=function(t,e){t.className="".concat(z.popup," ").concat(mt(t)?e.showClass.popup:""),e.toast?(dt([document.documentElement,document.body],z["toast-shown"]),dt(t,z.toast)):dt(t,z.modal),H(t,e,"popup"),"string"==typeof e.customClass&&dt(t,e.customClass),e.icon&&dt(t,z["icon-".concat(e.icon)])};function _t(){var t=Y();t||nn.fire(),t=Y();var e=O(),n=S();tt(e),tt(n,"inline-block"),dt([t,e],z.loading),n.disabled=!0,t.setAttribute("data-loading",!0),t.setAttribute("aria-busy",!0),t.focus()}function Ft(){return new Promise(function(t){var e=window.scrollX,n=window.scrollY;Zt.restoreFocusTimeout=setTimeout(function(){Zt.previousActiveElement&&Zt.previousActiveElement.focus?(Zt.previousActiveElement.focus(),Zt.previousActiveElement=null):document.body&&document.body.focus(),t()},100),void 0!==e&&void 0!==n&&window.scrollTo(e,n)})}function zt(){if(Zt.timeout)return function(){var t=q(),e=parseInt(window.getComputedStyle(t).width);t.style.removeProperty("transition"),t.style.width="100%";var n=parseInt(window.getComputedStyle(t).width),o=parseInt(e/n*100);t.style.removeProperty("transition"),t.style.width="".concat(o,"%")}(),Zt.timeout.stop()}function Wt(){if(Zt.timeout){var t=Zt.timeout.start();return rt(t),t}}function Kt(t){return Object.prototype.hasOwnProperty.call(Qt,t)}function Yt(t){return Jt[t]}var Zt={},Qt={title:"",titleText:"",text:"",html:"",footer:"",icon:void 0,iconHtml:void 0,toast:!1,animation:!0,showClass:{popup:"swal2-show",backdrop:"swal2-backdrop-show",icon:"swal2-icon-show"},hideClass:{popup:"swal2-hide",backdrop:"swal2-backdrop-hide",icon:"swal2-icon-hide"},customClass:void 0,target:"body",backdrop:!0,heightAuto:!0,allowOutsideClick:!0,allowEscapeKey:!0,allowEnterKey:!0,stopKeydownPropagation:!0,keydownListenerCapture:!1,showConfirmButton:!0,showCancelButton:!1,preConfirm:void 0,confirmButtonText:"OK",confirmButtonAriaLabel:"",confirmButtonColor:void 0,cancelButtonText:"Cancel",cancelButtonAriaLabel:"",cancelButtonColor:void 0,buttonsStyling:!0,reverseButtons:!1,focusConfirm:!0,focusCancel:!1,showCloseButton:!1,closeButtonHtml:"×",closeButtonAriaLabel:"Close this dialog",showLoaderOnConfirm:!1,imageUrl:void 0,imageWidth:void 0,imageHeight:void 0,imageAlt:"",timer:void 0,timerProgressBar:!1,width:void 0,padding:void 0,background:void 0,input:void 0,inputPlaceholder:"",inputValue:"",inputOptions:{},inputAutoTrim:!0,inputAttributes:{},inputValidator:void 0,validationMessage:void 0,grow:!1,position:"center",progressSteps:[],currentProgressStep:void 0,progressStepsDistance:void 0,onBeforeOpen:void 0,onOpen:void 0,onRender:void 0,onClose:void 0,onAfterClose:void 0,onDestroy:void 0,scrollbarPadding:!0},$t=["title","titleText","text","html","icon","hideClass","customClass","allowOutsideClick","allowEscapeKey","showConfirmButton","showCancelButton","confirmButtonText","confirmButtonAriaLabel","confirmButtonColor","cancelButtonText","cancelButtonAriaLabel","cancelButtonColor","buttonsStyling","reverseButtons","imageUrl","imageWidth","imageHeight","imageAlt","progressSteps","currentProgressStep"],Jt={animation:'showClass" and "hideClass'},Xt=["allowOutsideClick","allowEnterKey","backdrop","focusConfirm","focusCancel","heightAuto","keydownListenerCapture"],Gt=Object.freeze({isValidParameter:Kt,isUpdatableParameter:function(t){return-1!==$t.indexOf(t)},isDeprecatedParameter:Yt,argsToParams:function(o){var i={};return"object"!==r(o[0])||y(o[0])?["title","html","icon"].forEach(function(t,e){var n=o[e];"string"==typeof n||y(n)?i[t]=n:void 0!==n&&v("Unexpected type of ".concat(t,'! Expected "string" or "Element", got ').concat(r(n)))}):s(i,o[0]),i},isVisible:function(){return mt(Y())},clickConfirm:Mt,clickCancel:function(){return E()&&E().click()},getContainer:K,getPopup:Y,getTitle:k,getContent:x,getHtmlContainer:function(){return e(z["html-container"])},getImage:P,getIcon:C,getIcons:n,getCloseButton:I,getActions:O,getConfirmButton:S,getCancelButton:E,getHeader:T,getFooter:L,getTimerProgressBar:q,getFocusableElements:j,getValidationMessage:B,isLoading:function(){return Y().hasAttribute("data-loading")},fire:function(){for(var t=arguments.length,e=new Array(t),n=0;n<t;n++)e[n]=arguments[n];return i(this,e)},mixin:function(i){return function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&l(t,e)}(n,t);var o,e=function(){var t,e=u(o);if(d()){var n=u(this).constructor;t=Reflect.construct(e,arguments,n)}else t=e.apply(this,arguments);return p(this,t)};function n(){return a(this,n),e.apply(this,arguments)}return c(o=n,[{key:"_main",value:function(t){return f(u(n.prototype),"_main",this).call(this,s({},i,t))}}]),n}(this)},queue:function(t){var r=this;Nt=t;function a(t,e){Nt=[],t(e)}var c=[];return new Promise(function(i){!function e(n,o){n<Nt.length?(document.body.setAttribute("data-swal2-queue-step",n),r.fire(Nt[n]).then(function(t){void 0!==t.value?(c.push(t.value),e(n+1,o)):a(i,{dismiss:t.dismiss})})):a(i,{value:c})}(0)})},getQueueStep:Lt,insertQueueStep:function(t,e){return e&&e<Nt.length?Nt.splice(e,0,t):Nt.push(t)},deleteQueueStep:function(t){void 0!==Nt[t]&&Nt.splice(t,1)},showLoading:_t,enableLoading:_t,getTimerLeft:function(){return Zt.timeout&&Zt.timeout.getTimerLeft()},stopTimer:zt,resumeTimer:Wt,toggleTimer:function(){var t=Zt.timeout;return t&&(t.running?zt:Wt)()},increaseTimer:function(t){if(Zt.timeout){var e=Zt.timeout.increase(t);return rt(e,!0),e}},isTimerRunning:function(){return Zt.timeout&&Zt.timeout.isRunning()}});function te(){var t=xt.innerParams.get(this);if(t){var e=xt.domCache.get(this);t.showConfirmButton||(et(e.confirmButton),t.showCancelButton||et(e.actions)),pt([e.popup,e.actions],z.loading),e.popup.removeAttribute("aria-busy"),e.popup.removeAttribute("data-loading"),e.confirmButton.disabled=!1,e.cancelButton.disabled=!1}}function ee(){null===Q.previousBodyPadding&&document.body.scrollHeight>window.innerHeight&&(Q.previousBodyPadding=parseInt(window.getComputedStyle(document.body).getPropertyValue("padding-right")),document.body.style.paddingRight="".concat(Q.previousBodyPadding+function(){var t=document.createElement("div");t.className=z["scrollbar-measure"],document.body.appendChild(t);var e=t.getBoundingClientRect().width-t.clientWidth;return document.body.removeChild(t),e}(),"px"))}function ne(){return!!window.MSInputMethodContext&&!!document.documentMode}function oe(){var t=K(),e=Y();t.style.removeProperty("align-items"),e.offsetTop<0&&(t.style.alignItems="flex-start")}var ie=function(){var e,t=K();t.ontouchstart=function(t){e=re(t.target)},t.ontouchmove=function(t){e&&(t.preventDefault(),t.stopPropagation())}},re=function(t){var e=K();return t===e||!(ot(e)||"INPUT"===t.tagName||ot(x())&&x().contains(t))},ae={swalPromiseResolve:new WeakMap};function ce(t,e,n,o){n?le(t,o):(Ft().then(function(){return le(t,o)}),Zt.keydownTarget.removeEventListener("keydown",Zt.keydownHandler,{capture:Zt.keydownListenerCapture}),Zt.keydownHandlerAdded=!1),e.parentNode&&!document.body.getAttribute("data-swal2-queue-step")&&e.parentNode.removeChild(e),M()&&(null!==Q.previousBodyPadding&&(document.body.style.paddingRight="".concat(Q.previousBodyPadding,"px"),Q.previousBodyPadding=null),function(){if(R(document.body,z.iosfix)){var t=parseInt(document.body.style.top,10);pt(document.body,z.iosfix),document.body.style.top="",document.body.scrollTop=-1*t}}(),"undefined"!=typeof window&&ne()&&window.removeEventListener("resize",oe),h(document.body.children).forEach(function(t){t.hasAttribute("data-previous-aria-hidden")?(t.setAttribute("aria-hidden",t.getAttribute("data-previous-aria-hidden")),t.removeAttribute("data-previous-aria-hidden")):t.removeAttribute("aria-hidden")})),pt([document.documentElement,document.body],[z.shown,z["height-auto"],z["no-backdrop"],z["toast-shown"],z["toast-column"]])}function se(t){var e=Y();if(e){var n=xt.innerParams.get(this);if(n&&!R(e,n.hideClass.popup)){var o=ae.swalPromiseResolve.get(this);pt(e,n.showClass.popup),dt(e,n.hideClass.popup);var i=K();pt(i,n.showClass.backdrop),dt(i,n.hideClass.backdrop),function(t,e,n){var o=K(),i=yt&&it(e),r=n.onClose,a=n.onAfterClose;if(r!==null&&typeof r==="function"){r(e)}if(i){ue(t,e,o,a)}else{ce(t,o,Z(),a)}}(this,e,n),o(t||{})}}}var ue=function(t,e,n,o){Zt.swalCloseEventFinishedCallback=ce.bind(null,t,n,Z(),o),e.addEventListener(yt,function(t){t.target===e&&(Zt.swalCloseEventFinishedCallback(),delete Zt.swalCloseEventFinishedCallback)})},le=function(t,e){setTimeout(function(){"function"==typeof e&&e(),t._destroy()})};function de(t,e,n){var o=xt.domCache.get(t);e.forEach(function(t){o[t].disabled=n})}function pe(t,e){if(!t)return!1;if("radio"===t.type)for(var n=t.parentNode.parentNode.querySelectorAll("input"),o=0;o<n.length;o++)n[o].disabled=e;else t.disabled=e}var fe=function(){function n(t,e){a(this,n),this.callback=t,this.remaining=e,this.running=!1,this.start()}return c(n,[{key:"start",value:function(){return this.running||(this.running=!0,this.started=new Date,this.id=setTimeout(this.callback,this.remaining)),this.remaining}},{key:"stop",value:function(){return this.running&&(this.running=!1,clearTimeout(this.id),this.remaining-=new Date-this.started),this.remaining}},{key:"increase",value:function(t){var e=this.running;return e&&this.stop(),this.remaining+=t,e&&this.start(),this.remaining}},{key:"getTimerLeft",value:function(){return this.running&&(this.stop(),this.start()),this.remaining}},{key:"isRunning",value:function(){return this.running}}]),n}(),me={email:function(t,e){return/^[a-zA-Z0-9.+_-]+@[a-zA-Z0-9.-]+\.[a-zA-Z0-9-]{2,24}$/.test(t)?Promise.resolve():Promise.resolve(e||"Invalid email address")},url:function(t,e){return/^https?:\/\/(www\.)?[-a-zA-Z0-9@:%._+~#=]{2,256}\.[a-z]{2,63}\b([-a-zA-Z0-9@:%_+.~#?&/=]*)$/.test(t)?Promise.resolve():Promise.resolve(e||"Invalid URL")}};function he(t){var e,n;(e=t).inputValidator||Object.keys(me).forEach(function(t){e.input===t&&(e.inputValidator=me[t])}),t.showLoaderOnConfirm&&!t.preConfirm&&N("showLoaderOnConfirm is set to true, but preConfirm is not defined.\nshowLoaderOnConfirm should be used together with preConfirm, see usage example:\nhttps://sweetalert2.github.io/#ajax-request"),t.animation=_(t.animation),(n=t).target&&("string"!=typeof n.target||document.querySelector(n.target))&&("string"==typeof n.target||n.target.appendChild)||(N('Target parameter is not valid, defaulting to "body"'),n.target="body"),"string"==typeof t.title&&(t.title=t.title.split("\n").join("<br />")),gt(t)}function ge(t){var e=K(),n=Y();"function"==typeof t.onBeforeOpen&&t.onBeforeOpen(n),Se(e,n,t),Ae(e,n),M()&&Be(e,t.scrollbarPadding),Z()||Zt.previousActiveElement||(Zt.previousActiveElement=document.activeElement),"function"==typeof t.onOpen&&setTimeout(function(){return t.onOpen(n)}),pt(e,z["no-transition"])}function ve(t){var e=Y();if(t.target===e){var n=K();e.removeEventListener(yt,ve),n.style.overflowY="auto"}}function be(t,e){"select"===e.input||"radio"===e.input?Le(t,e):-1!==["text","email","number","tel","textarea"].indexOf(e.input)&&b(e.inputValue)&&qe(t,e)}function ye(t,e){t.disableButtons(),e.input?Me(t,e):Ve(t,e,!0)}function we(t,e){t.disableButtons(),e(F.cancel)}function Ce(t,e){t.closePopup({value:e})}function ke(e,t,n,o){t.keydownTarget&&t.keydownHandlerAdded&&(t.keydownTarget.removeEventListener("keydown",t.keydownHandler,{capture:t.keydownListenerCapture}),t.keydownHandlerAdded=!1),n.toast||(t.keydownHandler=function(t){return De(e,t,o)},t.keydownTarget=n.keydownListenerCapture?window:Y(),t.keydownListenerCapture=n.keydownListenerCapture,t.keydownTarget.addEventListener("keydown",t.keydownHandler,{capture:t.keydownListenerCapture}),t.keydownHandlerAdded=!0)}function xe(t,e,n){var o=j(),i=0;if(i<o.length)return(e+=n)===o.length?e=0:-1===e&&(e=o.length-1),o[e].focus();Y().focus()}function Pe(t,e,n){xt.innerParams.get(t).toast?ze(t,e,n):(Ke(e),Ye(e),Ze(t,e,n))}var Ae=function(t,e){yt&&it(e)?(t.style.overflowY="hidden",e.addEventListener(yt,ve)):t.style.overflowY="auto"},Be=function(t,e){!function(){if((/iPad|iPhone|iPod/.test(navigator.userAgent)&&!window.MSStream||"MacIntel"===navigator.platform&&1<navigator.maxTouchPoints)&&!R(document.body,z.iosfix)){var t=document.body.scrollTop;document.body.style.top="".concat(-1*t,"px"),dt(document.body,z.iosfix),ie()}}(),"undefined"!=typeof window&&ne()&&(oe(),window.addEventListener("resize",oe)),h(document.body.children).forEach(function(t){t===K()||function(t,e){if("function"==typeof t.contains)return t.contains(e)}(t,K())||(t.hasAttribute("aria-hidden")&&t.setAttribute("data-previous-aria-hidden",t.getAttribute("aria-hidden")),t.setAttribute("aria-hidden","true"))}),e&&ee(),setTimeout(function(){t.scrollTop=0})},Se=function(t,e,n){dt(t,n.showClass.backdrop),tt(e),dt(e,n.showClass.popup),dt([document.documentElement,document.body],z.shown),n.heightAuto&&n.backdrop&&!n.toast&&dt([document.documentElement,document.body],z["height-auto"])},Ee=function(t){return t.checked?1:0},Oe=function(t){return t.checked?t.value:null},Te=function(t){return t.files.length?null!==t.getAttribute("multiple")?t.files:t.files[0]:null},Le=function(e,n){function o(t){return Ie[n.input](i,je(t),n)}var i=x();b(n.inputOptions)?(_t(),n.inputOptions.then(function(t){e.hideLoading(),o(t)})):"object"===r(n.inputOptions)?o(n.inputOptions):v("Unexpected type of inputOptions! Expected object, Map or Promise, got ".concat(r(n.inputOptions)))},qe=function(e,n){var o=e.getInput();et(o),n.inputValue.then(function(t){o.value="number"===n.input?parseFloat(t)||0:"".concat(t),tt(o),o.focus(),e.hideLoading()}).catch(function(t){v("Error in inputValue promise: ".concat(t)),o.value="",tt(o),o.focus(),e.hideLoading()})},Ie={select:function(t,e,i){var r=ft(t,z.select);e.forEach(function(t){var e=t[0],n=t[1],o=document.createElement("option");o.value=e,V(o,n),i.inputValue.toString()===e.toString()&&(o.selected=!0),r.appendChild(o)}),r.focus()},radio:function(t,e,a){var c=ft(t,z.radio);e.forEach(function(t){var e=t[0],n=t[1],o=document.createElement("input"),i=document.createElement("label");o.type="radio",o.name=z.radio,o.value=e,a.inputValue.toString()===e.toString()&&(o.checked=!0);var r=document.createElement("span");V(r,n),r.className=z.label,i.appendChild(o),i.appendChild(r),c.appendChild(i)});var n=c.querySelectorAll("input");n.length&&n[0].focus()}},je=function(e){var n=[];return"undefined"!=typeof Map&&e instanceof Map?e.forEach(function(t,e){n.push([e,t])}):Object.keys(e).forEach(function(t){n.push([t,e[t]])}),n},Me=function(e,n){var o=function(t,e){var n=t.getInput();if(!n)return null;switch(e.input){case"checkbox":return Ee(n);case"radio":return Oe(n);case"file":return Te(n);default:return e.inputAutoTrim?n.value.trim():n.value}}(e,n);n.inputValidator?(e.disableInput(),Promise.resolve().then(function(){return n.inputValidator(o,n.validationMessage)}).then(function(t){e.enableButtons(),e.enableInput(),t?e.showValidationMessage(t):Ve(e,n,o)})):e.getInput().checkValidity()?Ve(e,n,o):(e.enableButtons(),e.showValidationMessage(n.validationMessage))},Ve=function(e,t,n){(t.showLoaderOnConfirm&&_t(),t.preConfirm)?(e.resetValidationMessage(),Promise.resolve().then(function(){return t.preConfirm(n,t.validationMessage)}).then(function(t){mt(B())||!1===t?e.hideLoading():Ce(e,void 0===t?n:t)})):Ce(e,n)},Re=["ArrowLeft","ArrowRight","ArrowUp","ArrowDown","Left","Right","Up","Down"],He=["Escape","Esc"],De=function(t,e,n){var o=xt.innerParams.get(t);o.stopKeydownPropagation&&e.stopPropagation(),"Enter"===e.key?Ne(t,e,o):"Tab"===e.key?Ue(e,o):-1!==Re.indexOf(e.key)?_e():-1!==He.indexOf(e.key)&&Fe(e,o,n)},Ne=function(t,e,n){if(!e.isComposing&&e.target&&t.getInput()&&e.target.outerHTML===t.getInput().outerHTML){if(-1!==["textarea","file"].indexOf(n.input))return;Mt(),e.preventDefault()}},Ue=function(t){for(var e=t.target,n=j(),o=-1,i=0;i<n.length;i++)if(e===n[i]){o=i;break}t.shiftKey?xe(0,o,-1):xe(0,o,1),t.stopPropagation(),t.preventDefault()},_e=function(){var t=S(),e=E();document.activeElement===t&&mt(e)?e.focus():document.activeElement===e&&mt(t)&&t.focus()},Fe=function(t,e,n){_(e.allowEscapeKey)&&(t.preventDefault(),n(F.esc))},ze=function(e,t,n){t.popup.onclick=function(){var t=xt.innerParams.get(e);t.showConfirmButton||t.showCancelButton||t.showCloseButton||t.input||n(F.close)}},We=!1,Ke=function(e){e.popup.onmousedown=function(){e.container.onmouseup=function(t){e.container.onmouseup=void 0,t.target===e.container&&(We=!0)}}},Ye=function(e){e.container.onmousedown=function(){e.popup.onmouseup=function(t){e.popup.onmouseup=void 0,t.target!==e.popup&&!e.popup.contains(t.target)||(We=!0)}}},Ze=function(n,o,i){o.container.onclick=function(t){var e=xt.innerParams.get(n);We?We=!1:t.target===o.container&&_(e.allowOutsideClick)&&i(F.backdrop)}};var Qe=function(t,e,n){var o=q();et(o),e.timer&&(t.timeout=new fe(function(){n("timer"),delete t.timeout},e.timer),e.timerProgressBar&&(tt(o),setTimeout(function(){t.timeout.running&&rt(e.timer)})))},$e=function(t,e){if(!e.toast)return _(e.allowEnterKey)?e.focusCancel&&mt(t.cancelButton)?t.cancelButton.focus():e.focusConfirm&&mt(t.confirmButton)?t.confirmButton.focus():void xe(0,-1,1):Je()},Je=function(){document.activeElement&&"function"==typeof document.activeElement.blur&&document.activeElement.blur()};var Xe,Ge=function(t){for(var e in t)t[e]=new WeakMap},tn=Object.freeze({hideLoading:te,disableLoading:te,getInput:function(t){var e=xt.innerParams.get(t||this),n=xt.domCache.get(t||this);return n?$(n.content,e.input):null},close:se,closePopup:se,closeModal:se,closeToast:se,enableButtons:function(){de(this,["confirmButton","cancelButton"],!1)},disableButtons:function(){de(this,["confirmButton","cancelButton"],!0)},enableInput:function(){return pe(this.getInput(),!1)},disableInput:function(){return pe(this.getInput(),!0)},showValidationMessage:function(t){var e=xt.domCache.get(this);V(e.validationMessage,t);var n=window.getComputedStyle(e.popup);e.validationMessage.style.marginLeft="-".concat(n.getPropertyValue("padding-left")),e.validationMessage.style.marginRight="-".concat(n.getPropertyValue("padding-right")),tt(e.validationMessage);var o=this.getInput();o&&(o.setAttribute("aria-invalid",!0),o.setAttribute("aria-describedBy",z["validation-message"]),J(o),dt(o,z.inputerror))},resetValidationMessage:function(){var t=xt.domCache.get(this);t.validationMessage&&et(t.validationMessage);var e=this.getInput();e&&(e.removeAttribute("aria-invalid"),e.removeAttribute("aria-describedBy"),pt(e,z.inputerror))},getProgressSteps:function(){return xt.domCache.get(this).progressSteps},_main:function(t){!function(t){for(var e in t)Kt(i=e)||N('Unknown parameter "'.concat(i,'"')),t.toast&&(o=e,-1!==Xt.indexOf(o)&&N('The parameter "'.concat(o,'" is incompatible with toasts'))),Yt(n=e)&&g(n,Yt(n));var n,o,i}(t),Zt.currentInstance&&Zt.currentInstance._destroy(),Zt.currentInstance=this;var e=function(t){var e=s({},Qt.showClass,t.showClass),n=s({},Qt.hideClass,t.hideClass),o=s({},Qt,t);if(o.showClass=e,o.hideClass=n,t.animation===false){o.showClass={popup:"swal2-noanimation",backdrop:"swal2-noanimation"};o.hideClass={}}return o}(t);he(e),Object.freeze(e),Zt.timeout&&(Zt.timeout.stop(),delete Zt.timeout),clearTimeout(Zt.restoreFocusTimeout);var n=function(t){var e={popup:Y(),container:K(),content:x(),actions:O(),confirmButton:S(),cancelButton:E(),closeButton:I(),validationMessage:B(),progressSteps:A()};return xt.domCache.set(t,e),e}(this);return jt(this,e),xt.innerParams.set(this,e),function(n,o,i){return new Promise(function(t){var e=function t(e){n.closePopup({dismiss:e})};ae.swalPromiseResolve.set(n,t);o.confirmButton.onclick=function(){return ye(n,i)};o.cancelButton.onclick=function(){return we(n,e)};o.closeButton.onclick=function(){return e(F.close)};Pe(n,o,e);ke(n,Zt,i,e);if(i.toast&&(i.input||i.footer||i.showCloseButton)){dt(document.body,z["toast-column"])}else{pt(document.body,z["toast-column"])}be(n,i);ge(i);Qe(Zt,i,e);$e(o,i);setTimeout(function(){o.container.scrollTop=0})})}(this,n,e)},update:function(e){var t=Y(),n=xt.innerParams.get(this);if(!t||R(t,n.hideClass.popup))return N("You're trying to update the closed or closing popup, that won't work. Use the update() method in preConfirm parameter or show a new popup.");var o={};Object.keys(e).forEach(function(t){nn.isUpdatableParameter(t)?o[t]=e[t]:N('Invalid parameter to update: "'.concat(t,'". Updatable params are listed here: https://github.com/sweetalert2/sweetalert2/blob/master/src/utils/params.js'))});var i=s({},n,o);jt(this,i),xt.innerParams.set(this,i),Object.defineProperties(this,{params:{value:s({},this.params,e),writable:!1,enumerable:!0}})},_destroy:function(){var t=xt.domCache.get(this),e=xt.innerParams.get(this);e&&(t.popup&&Zt.swalCloseEventFinishedCallback&&(Zt.swalCloseEventFinishedCallback(),delete Zt.swalCloseEventFinishedCallback),Zt.deferDisposalTimer&&(clearTimeout(Zt.deferDisposalTimer),delete Zt.deferDisposalTimer),"function"==typeof e.onDestroy&&e.onDestroy(),delete this.params,delete Zt.keydownHandler,delete Zt.keydownTarget,Ge(xt),Ge(ae))}});function en(){if("undefined"!=typeof window){"undefined"==typeof Promise&&v("This package requires a Promise library, please include a shim to enable it in this browser (See: https://github.com/sweetalert2/sweetalert2/wiki/Migration-from-SweetAlert-to-SweetAlert2#1-ie-support)"),Xe=this;for(var t=arguments.length,e=new Array(t),n=0;n<t;n++)e[n]=arguments[n];var o=Object.freeze(this.constructor.argsToParams(e));Object.defineProperties(this,{params:{value:o,writable:!1,enumerable:!0,configurable:!0}});var i=this._main(this.params);xt.promise.set(this,i)}}en.prototype.then=function(t){return xt.promise.get(this).then(t)},en.prototype.finally=function(t){return xt.promise.get(this).finally(t)},s(en.prototype,tn),s(en,Gt),Object.keys(tn).forEach(function(t){en[t]=function(){if(Xe)return Xe[t].apply(Xe,arguments)}}),en.DismissReason=F,en.version="9.10.12";var nn=en;return nn.default=nn}),void 0!==this&&this.Sweetalert2&&(this.swal=this.sweetAlert=this.Swal=this.SweetAlert=this.Sweetalert2);
|