Advanced Database Cleaner - Version 3.1.0

Version Description

  • 16/06/2022 =
  • Fix: fixing the error 'Fatal error: Can't use function return value in write context'
  • Fix: fixing the Warning: count(): Parameter must be an array or an object that implements Countable
  • Tweak: correcting of some typos and grammar
  • Tweak: deleting some useless data from "overview & settings" tab
  • Tweak: enhancing the CSS code, the plugin is responsive now and can be used in small screens
  • Tweak: enhancing some blocks of PHP code
  • New: adding delete filter for custom cleanup elements in general cleanup tab
  • Info: since we have changed a lot of CSS code, please refresh your browser cache or click "Ctrl + F5"
  • Info: great feature will be added to the next version
Download this release

Release Info

Developer symptote
Plugin Icon 128x128 Advanced Database Cleaner
Version 3.1.0
Comparing to
See all releases

Code changes from version 3.0.4 to 3.1.0

Files changed (48) hide show
  1. README.txt +13 -2
  2. advanced-db-cleaner.php +519 -181
  3. css/admin.css +1257 -683
  4. images/add_schedule.svg +0 -6
  5. images/alarm-clock.svg +1 -1
  6. images/check_ok.svg +0 -4
  7. images/db_clean.svg +1 -1
  8. images/double_check.svg +4 -0
  9. images/edit_schedule.svg +0 -4
  10. images/go_back.svg +0 -2
  11. images/green_clock.svg +1 -1
  12. images/grey_clock.svg +3 -3
  13. images/help.svg +1 -2
  14. images/information.svg +1 -32
  15. images/information2.svg +1 -2
  16. images/information_orange.svg +24 -0
  17. images/nothing_to_see.svg +1 -1
  18. images/premium.svg +1 -1
  19. images/see.svg +1 -2
  20. images/switch-off.svg +1 -1
  21. images/switch-on.svg +1 -1
  22. images/warning.svg +1 -1
  23. includes/class_clean_cron.php +263 -121
  24. includes/class_clean_options.php +266 -116
  25. includes/class_clean_tables.php +380 -170
  26. includes/class_general_cleanup.php +97 -70
  27. includes/clean_db.php +33 -26
  28. includes/custom-clean-view/class_clean_comment.php +14 -7
  29. includes/custom-clean-view/class_clean_meta_comment_post_user_term.php +18 -9
  30. includes/custom-clean-view/class_clean_relationships.php +25 -18
  31. includes/custom-clean-view/class_clean_revision_draft_trash.php +15 -8
  32. includes/custom-clean-view/class_clean_transient.php +23 -30
  33. includes/custom-clean-view/header_page_custom_clean.php +117 -43
  34. includes/custom-clean-view/page_custom_clean.php +1 -1
  35. includes/custom-schedule-view/class_add_cleanup_schedule.php +243 -174
  36. includes/custom-schedule-view/class_add_optimize_schedule.php +179 -116
  37. includes/custom-schedule-view/class_edit_cleanup_schedule.php +267 -191
  38. includes/custom-schedule-view/class_edit_optimize_schedule.php +214 -151
  39. includes/edit_item_categorization.php +132 -0
  40. includes/functions.php +216 -137
  41. includes/header_page_filter.php +246 -123
  42. includes/license/ADBC_EDD_SL_Plugin_Updater.php +1 -1
  43. includes/license/adbc-edd-sample-plugin.php +67 -55
  44. includes/overview_settings.php +98 -59
  45. includes/premium_page.php +93 -33
  46. includes/sidebar.php +22 -12
  47. js/admin.js +246 -48
  48. languages/advanced-database-cleaner.pot +1 -1
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: 6.0
8
- Stable tag: 3.0.4
9
  License: GPLv2 or later
10
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
11
 
@@ -63,7 +63,7 @@ If you have been using WordPress for a while, then you should think absolutely a
63
 
64
  = By using the ADC plugin, you will =
65
 
66
- * <strong>Get and overview:</strong> The plugin will help you get an overview of what is happening in your database. It will report all unused/orphaned items that should be cleaned, it will give you the number of tables/options/tasks you have, etc. This way, you can control your database if anything goes wrong
67
 
68
  * <strong>Save time:</strong> You can specify what items should be cleaned/optimized/repaired, what is the number of days' data to keep and the cleanup/optimization/reparation frequency. The plugin will then automate the process to run automatically based on your settings
69
 
@@ -140,6 +140,17 @@ This section describes how to install the plugin. In general, there are 3 ways t
140
 
141
  == Changelog ==
142
 
 
 
 
 
 
 
 
 
 
 
 
143
  = 3.0.4 - 21/01/2022 =
144
  - Tweak: Enhancing the security of the plugin
145
  - Tweak: Testing the plugin with latest versions of WP
5
  Requires at least: 3.1.0
6
  Requires PHP: 5.0
7
  Tested up to: 6.0
8
+ Stable tag: 3.1.0
9
  License: GPLv2 or later
10
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
11
 
63
 
64
  = By using the ADC plugin, you will =
65
 
66
+ * <strong>Get an overview:</strong> The plugin will help you get an overview of what is happening in your database. It will report all unused/orphaned items that should be cleaned, it will give you the number of tables/options/tasks you have, etc. This way, you can control your database if anything goes wrong
67
 
68
  * <strong>Save time:</strong> You can specify what items should be cleaned/optimized/repaired, what is the number of days' data to keep and the cleanup/optimization/reparation frequency. The plugin will then automate the process to run automatically based on your settings
69
 
140
 
141
  == Changelog ==
142
 
143
+ = 3.1.0 - 16/06/2022 =
144
+ - Fix: fixing the error 'Fatal error: Can't use function return value in write context'
145
+ - Fix: fixing the Warning: count(): Parameter must be an array or an object that implements Countable
146
+ - Tweak: correcting of some typos and grammar
147
+ - Tweak: deleting some useless data from "overview & settings" tab
148
+ - Tweak: enhancing the CSS code, the plugin is responsive now and can be used in small screens
149
+ - Tweak: enhancing some blocks of PHP code
150
+ - New: adding “delete filter” for custom cleanup elements in “general cleanup” tab
151
+ - Info: since we have changed a lot of CSS code, please refresh your browser cache or click "Ctrl + F5"
152
+ - Info: great feature will be added to the next version
153
+
154
  = 3.0.4 - 21/01/2022 =
155
  - Tweak: Enhancing the security of the plugin
156
  - Tweak: Testing the plugin with latest versions of WP
advanced-db-cleaner.php CHANGED
@@ -1,11 +1,10 @@
1
  <?php
2
- if (!defined('ABSPATH')) return;
3
- if (!is_main_site()) return;
4
  /*
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.4
9
  Author: Younes JFR.
10
  Author URI: https://www.sigmaplugin.com
11
  Contributors: symptote
@@ -15,117 +14,204 @@ License: GPLv2 or later
15
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
16
  */
17
 
18
- /***************************************************************************************************************
19
- * Require WordPress List Table Administration API
20
- * yyy: Test validity of WP_List_Table class after each release of WP Since this class is marked as private by WP
21
- * http://codex.wordpress.org/Class_Reference/WP_List_Table
22
- ***************************************************************************************************************/
23
- if(!class_exists('WP_List_Table')){
24
- require_once(ABSPATH . 'wp-admin/includes/class-wp-list-table.php');
 
 
25
  }
26
 
27
  class ADBC_Advanced_DB_Cleaner {
28
 
29
- public function __construct(){
30
 
31
- // Define common constants that should be modified in each version
32
- if(!defined("ADBC_PLUGIN_VERSION")) define("ADBC_PLUGIN_VERSION", "3.0.4");
 
33
 
34
- // Prevent conflicts between free and pro, load text-domain and check if should update settings after upgrade
35
- add_action('plugins_loaded', array($this, 'plugins_loaded'));
36
 
37
  // Load CSS and JS
38
- add_action('admin_enqueue_scripts', array($this, 'aDBc_load_styles_and_scripts'));
39
 
40
  // Add some schedules
41
- add_filter('cron_schedules', array($this, 'aDBc_additional_schedules'));
42
 
43
  // Add actions for scheduled events
44
- add_action('aDBc_optimize_scheduler', 'aDBc_optimize_scheduled_tables');
45
- add_action('aDBc_clean_scheduler', 'aDBc_clean_scheduled_elements');
46
 
47
  // Register activation, deactivation and uninstall hooks of the plugin
48
- register_activation_hook (__FILE__, array($this, 'aDBc_activate_plugin'));
49
- register_deactivation_hook (__FILE__, array($this, 'aDBc_deactivate_plugin'));
50
- register_uninstall_hook (__FILE__, array('ADBC_Advanced_DB_Cleaner', 'aDBc_uninstall'));
51
 
52
  // Add admin notice to rate plugin
53
- add_action('admin_notices', array($this, 'aDBc_rate_notice'));
54
- add_action('admin_init', array($this, 'aDBc_ignore_notice'));
 
55
 
56
  // Update settings if changed by users
57
  $this->aDBc_update_settings();
 
58
  }
59
 
60
  // Do this on plugins loded : prevent conflict between free and pro, load text-domain and check if we should update settings in DB
61
- public function plugins_loaded(){
62
 
63
  // Prevent conflicts between free and pro versions and between old pro and new pro
64
- if(!function_exists('deactivate_plugins')) include_once(ABSPATH.'wp-admin/includes/plugin.php');
65
- // Test if the user want to activate the pro version and he has the free version activated
66
- if(is_plugin_active('advanced-database-cleaner-pro/advanced-db-cleaner.php') && is_plugin_active(
67
- 'advanced-database-cleaner/advanced-db-cleaner.php')){
68
- // Deactivate the free version in silent mode without calling its deactivation function in order to keep scheduled tasks for pro
69
- deactivate_plugins('advanced-database-cleaner/advanced-db-cleaner.php', true);
70
- add_action('admin_notices', array($this, 'aDBc_conflict_notice_free'));
 
 
 
71
  return;
72
  }
73
- // Test if the user want to activate the pro version and he has the old pro version activated
74
- if(is_plugin_active('advanced-database-cleaner-pro/advanced-db-cleaner.php') && is_plugin_active(
75
- 'advanced-db-cleaner/advanced-db-cleaner.php')){
76
- // Deactivate the old pro version in silent mode without calling its deactivation function in order to keep scheduled tasks for pro
77
- deactivate_plugins('advanced-db-cleaner/advanced-db-cleaner.php', true);
78
- add_action('admin_notices', array($this, 'aDBc_conflict_notice_old_pro'));
 
 
 
79
  return;
80
  }
81
 
82
  /********************************************************************
83
  * Include functions and specific elements for pro version
84
  ********************************************************************/
 
85
  include_once 'includes/functions.php';
86
 
 
87
 
88
- /**************************************************************************************************************
89
- *
 
 
 
 
 
 
 
 
 
 
 
 
 
90
  * Define other variables (we switch all "\" to "/" in paths)
91
- *
92
- **************************************************************************************************************/
93
 
94
- if(!defined("ADBC_PLUGIN_DIR_PATH")) define("ADBC_PLUGIN_DIR_PATH", plugins_url('' , __FILE__));
95
 
96
  // Main Plugin file
97
- if(!defined("ADBC_MAIN_PLUGIN_FILE_PATH")) define("ADBC_MAIN_PLUGIN_FILE_PATH", str_replace('\\' ,'/', __FILE__ ));
98
 
99
  // ABSPATH without trailing slash
100
- if(!defined("ADBC_ABSPATH")) define("ADBC_ABSPATH", rtrim(str_replace('\\' ,'/', ABSPATH), "/"));
101
 
102
  // WP Content directory
103
- if(!defined("WP_CONTENT_DIR")) define("WP_CONTENT_DIR", ABSPATH . 'wp-content');
104
- if(!defined("ADBC_WP_CONTENT_DIR_PATH")) define("ADBC_WP_CONTENT_DIR_PATH", str_replace('\\' ,'/', WP_CONTENT_DIR));
 
105
 
106
  // WP Plugin directory path & name
107
- if(!defined("WP_PLUGIN_DIR")) define("WP_PLUGIN_DIR", WP_CONTENT_DIR . '/plugins');
108
- if(!defined("ADBC_WP_PLUGINS_DIR_PATH")) define("ADBC_WP_PLUGINS_DIR_PATH", str_replace('\\' ,'/', WP_PLUGIN_DIR));
109
 
110
- // MU Must have plugin path & name (MU plugins are no longer used only by Mulsite but all wordpress installations)
111
- if(!defined("WPMU_PLUGIN_DIR")) define("WPMU_PLUGIN_DIR", WP_CONTENT_DIR . '/mu-plugins');
112
- if(!defined("ADBC_WPMU_PLUGIN_DIR_PATH")) define("ADBC_WPMU_PLUGIN_DIR_PATH", str_replace('\\' ,'/', WPMU_PLUGIN_DIR));
 
 
 
113
 
114
  // WP Uploads directory & name
115
  $aDBc_upload_dir = wp_upload_dir();
116
- if(!defined("ADBC_UPLOAD_DIR_PATH")) define("ADBC_UPLOAD_DIR_PATH", str_replace('\\' ,'/', $aDBc_upload_dir['basedir']));
117
 
118
- // Max execution time
119
- if(!defined("ADBC_ORIGINAL_TIMEOUT")) define("ADBC_ORIGINAL_TIMEOUT", ini_get('max_execution_time'));
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
120
 
121
  // Add 'Database Cleaner' to Wordpress menu
 
122
  add_action('admin_menu', array($this, 'aDBc_add_admin_menu'));
123
 
124
  // Load text-domain
 
125
  load_plugin_textdomain('advanced-database-cleaner', false, dirname(plugin_basename(__FILE__)) . '/languages');
126
 
127
  // If plugin get updated, make changes to old version
128
- $this->aDBc_update_plugin_check();
 
129
 
130
  }
131
 
@@ -139,7 +225,7 @@ class ADBC_Advanced_DB_Cleaner {
139
  echo '<div class="error"><p>';
140
  _e('The old pro of Advanced DB Cleaner has been de-activated since the new pro version is active.', 'advanced-database-cleaner');
141
  echo "</p></div>";
142
- }
143
 
144
  // Add 'Database Cleaner' to Wordpress menu
145
  function aDBc_add_admin_menu(){
@@ -156,7 +242,7 @@ class ADBC_Advanced_DB_Cleaner {
156
  }
157
  // In case the settings has been deleted by accident, create left menu
158
  if(empty($aDBc_settings['left_menu']) && empty($aDBc_settings['menu_under_tools'])){
159
- $aDBc_left_menu = add_menu_page('Advanced DB Cleaner', 'WP DB Cleaner', 'manage_options', 'advanced_db_cleaner', array($this, 'aDBc_main_page_callback'), $icon_svg, '80.01123');
160
  }
161
  }
162
 
@@ -169,29 +255,36 @@ class ADBC_Advanced_DB_Cleaner {
169
  return;
170
  }
171
 
172
- wp_enqueue_style('aDBc_css', ADBC_PLUGIN_DIR_PATH . '/css/admin.css');
173
- wp_enqueue_script('aDBc_js', ADBC_PLUGIN_DIR_PATH . '/js/admin.js');
174
 
175
- wp_enqueue_style('sweet2_css', ADBC_PLUGIN_DIR_PATH . '/css/sweetalert2.min.css');
176
- wp_enqueue_script('sweet2_js', ADBC_PLUGIN_DIR_PATH . '/js/sweetalert2.min.js');
177
 
178
  // The wp_localize_script allows us to output the ajax_url path for our script to use.
179
  wp_localize_script('aDBc_js', 'aDBc_ajax_obj', array(
180
 
181
- 'ajaxurl' => admin_url('admin-ajax.php'),
182
  'images_path' => ADBC_PLUGIN_DIR_PATH . "/images/",
183
- 'sentence_scanning' => __('Scanning ...', 'advanced-database-cleaner'),
184
- 'unexpected_error' => __('Unexpected error! Please refresh the page and try again!', 'advanced-database-cleaner'),
185
- 'select_action' => __('Please select an action!', 'advanced-database-cleaner'),
186
- 'no_items_selected' => __('No items selected!', 'advanced-database-cleaner'),
187
- 'clean_items_warning' => __('You are about to clean some of your unused data. This operation is irreversible!', 'advanced-database-cleaner'),
188
- 'empty_tables_warning' => __('You are about to empty some of your tables. This operation is irreversible!', 'advanced-database-cleaner'),
189
- 'are_you_sure' => __('Are you sure?', 'advanced-database-cleaner'),
190
- 'make_db_backup_first' => __('Don\'t forget to make a backup of your database first!', 'advanced-database-cleaner'),
191
- 'cancel' => __('Cancel', 'advanced-database-cleaner'),
192
- 'Continue' => __('Continue', 'advanced-database-cleaner')
193
-
194
- ));
 
 
 
 
 
 
 
195
  //wp_enqueue_script('jquery');
196
  wp_enqueue_script('jquery-ui-dialog');
197
  wp_enqueue_style('wp-jquery-ui-dialog');
@@ -239,7 +332,7 @@ class ADBC_Advanced_DB_Cleaner {
239
  // Clear all schedules and update options in DB
240
  // Clear clean tasks
241
  $aDBc_clean_schedules = get_option('aDBc_clean_schedule');
242
- $aDBc_clean_schedules = is_array($aDBc_clean_schedules) ? $aDBc_clean_schedules : array();
243
  foreach($aDBc_clean_schedules as $task_name => $task_info){
244
  wp_clear_scheduled_hook('aDBc_clean_scheduler', array($task_name));
245
  // Set active to no in DB
@@ -260,22 +353,97 @@ class ADBC_Advanced_DB_Cleaner {
260
  }
261
 
262
  // Register UNINSTALL hook
263
- public static function aDBc_uninstall(){
 
 
 
 
 
 
264
 
265
- // Keep these ones in case they still in DB from older version < 3.0.0
266
- delete_option('aDBc_options_status');
267
- delete_option('aDBc_tables_status');
268
- delete_option('aDBc_tasks_status');
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
269
 
270
  // Options below are used by both free and pro version
271
  // Test if both version are installed to prevent deleting options
272
- if((file_exists(WP_PLUGIN_DIR . "/advanced-database-cleaner-pro") && file_exists(WP_PLUGIN_DIR . "/advanced-database-cleaner")) ||
273
- (file_exists(WPMU_PLUGIN_DIR . "/advanced-database-cleaner-pro") && file_exists(WPMU_PLUGIN_DIR . "/advanced-database-cleaner"))){
 
 
 
 
 
 
274
  // Do nothing in this case because we want to keep settings for the remaining version of the plugin
275
- }else{
276
- delete_option('aDBc_optimize_schedule');
277
- delete_option('aDBc_clean_schedule');
278
- delete_option('aDBc_settings');
 
 
 
279
  }
280
  }
281
 
@@ -286,7 +454,7 @@ class ADBC_Advanced_DB_Cleaner {
286
  if(empty($settings['plugin_version'])){
287
 
288
  // If settings is not empty, this means that the users had already installed ADBC plugin
289
- // if empty($settings['plugin_version']) => the user will update to or will install the version >= 3.0.0 for the first time
290
 
291
  // Before starting the update, make all previous plugin options to autoload "no"
292
  $options_array = array('aDBc_optimize_schedule', 'aDBc_clean_schedule', 'aDBc_settings', 'aDBc_edd_license_key', 'aDBc_edd_license_status');
@@ -365,7 +533,7 @@ class ADBC_Advanced_DB_Cleaner {
365
  foreach($item_info as $item){
366
  $columns = explode(":", $item);
367
  // A customer reported that the colon is not supported as separator in searching and all options with colon are not categorized!
368
- // == 5 means that the option does not contain a colon. Process only these cases since intems with >=5 are by default uncategorized
369
  if(count($columns) == 5){
370
  fwrite($myfile, $item."\n");
371
  }
@@ -391,11 +559,63 @@ class ADBC_Advanced_DB_Cleaner {
391
  restore_current_blog();
392
  }
393
  }
394
- }else{
395
- // If plugin_version is not empty, should we update the plugin version in DB?
396
- if($settings['plugin_version'] != ADBC_PLUGIN_VERSION){
 
 
 
 
 
 
397
  $settings['plugin_version'] = ADBC_PLUGIN_VERSION;
398
- update_option('aDBc_settings', $settings, "no");
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
399
  }
400
  }
401
  }
@@ -423,11 +643,25 @@ class ADBC_Advanced_DB_Cleaner {
423
  }
424
  }
425
  function aDBc_ignore_notice(){
 
426
  if(isset($_GET['adbc-ignore-notice']) && $_GET['adbc-ignore-notice'] == "0"){
427
  $settings = get_option('aDBc_settings');
428
  $settings['ignore_rating'] = "yes";
429
  update_option('aDBc_settings', $settings, "no");
430
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
431
  }
432
 
433
  // Update settings when saved in "overview & settings" tab. Test also to disable premium notice if closed by users
@@ -443,165 +677,269 @@ class ADBC_Advanced_DB_Cleaner {
443
  $aDBc_settings['left_menu'] = "1";
444
  }
445
 
446
- $aDBc_settings['hide_premium_tab'] = isset($_POST['aDBc_hide_premium_tab']) ? "1" : "0";
 
 
 
 
447
 
448
  // Update settings in DB
449
- update_option('aDBc_settings', $aDBc_settings, "no");
450
  }
 
 
451
  /********************************************************************
452
- * Update premium notice for lost licenses
453
  ********************************************************************/
454
- if(isset($_GET['ignore-premium-notice']) && $_GET['ignore-premium-notice'] == "yes"){
455
- $aDBc_settings['ignore_premium'] = "yes";
456
- update_option('aDBc_settings', $aDBc_settings, "no");
 
 
457
  }
458
 
 
459
  }
460
 
461
  // The admin page of the plugin
462
- function aDBc_main_page_callback(){ ?>
 
 
 
 
463
  <div class="wrap">
464
 
465
- <div>
466
- <table width="100%" cellspacing="0">
467
- <tr style="background:#fff;border:0px solid #eee;">
468
-
469
- <td style="padding:10px 10px 10px 20px">
470
- <img style="width:50px" src="<?php echo ADBC_PLUGIN_DIR_PATH; ?>/images/icon-128x128.png"/>
471
- </td>
472
-
473
- <td width="100%">
474
- <div style="background:#fff;padding:10px;margin-bottom:10px;">
475
-
476
- <?php $aDBc_plugin_title = "Advanced DB Cleaner '" . ADBC_PLUGIN_VERSION . "'"; ?>
477
-
478
- <div style="font-size: 20px;font-weight: 400;margin-bottom:10px"><?php echo $aDBc_plugin_title; ?></div>
479
- <div style="border-top:1px dashed #eee;padding-top:4px">
480
- <span class="aDBc-row-text"><?php _e('By', 'advanced-database-cleaner'); ?></span>
481
- <a class="aDBc-sidebar-link" href="https://profiles.wordpress.org/symptote/" target="_blank">Younes JFR.</a>
482
- &nbsp;|&nbsp;
483
- <span class="aDBc-row-text"><?php _e('Need help?', 'advanced-database-cleaner'); ?></span>
484
- <a class="aDBc-sidebar-link" href="http://sigmaplugin.com/contact" target="_blank"><?php _e('Contact me', 'advanced-database-cleaner'); ?></a>
485
- </div>
486
- </div>
487
- </td>
488
-
489
- <td style="text-align:center">
490
- <div style="background:#fff;padding:10px;margin-bottom:10px;">
491
- <a class="aDBc-sidebar-link" href="http://sigmaplugin.com/contact" target="_blank">
492
- <img style="width:50px" src="<?php echo ADBC_PLUGIN_DIR_PATH; ?>/images/help.svg"/>
493
- <br/>
494
- <span><?php _e('Support', 'advanced-database-cleaner'); ?></span>
495
- </a>
496
- </div>
497
- </td>
498
- </tr>
499
- </table>
500
- </div>
501
 
502
- <h1 style="font-size:10px"></h1>
503
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
504
  <?php
505
- // zzz
506
- $activate_license = __('Please activate your license key to get lifetime automatic updates and support.', 'advanced-database-cleaner');
507
- $activate_now = __('Activate now', 'advanced-database-cleaner');
508
 
 
 
 
 
 
 
 
 
509
  global $aDBc_settings;
510
 
511
- // This is a notice for premium users who will lose pro version when upgrading to 3.0.0 from an old version
512
- if(!empty($aDBc_settings['ignore_premium']) && $aDBc_settings['ignore_premium'] == "no"){
 
513
 
514
  $aDBc_new_URI = $_SERVER['REQUEST_URI'];
515
- $aDBc_new_URI = add_query_arg('ignore-premium-notice', 'yes', $aDBc_new_URI); ?>
516
 
517
  <div id="aDBc_main_msg" class="aDBc-premium-lost-msg">
 
518
  <span style="float:left;margin-bottom:20px"><?php _e('Important notice to premium users!', 'advanced-database-cleaner'); ?></span>
 
519
  <a style="text-decoration:none;float:right" href="<?php echo $aDBc_new_URI ?>">
520
  <span class="dashicons-dismiss dashicons"></span>
521
  </a>
 
522
  <p style="font-size:13px;clear:both">
523
- <?php _e('You will probably lose the pro version after this upgrade (This is due to a conflict between the free and pro versions which is now solved). If it is the case, please follow these <a target ="_blank" href="https://sigmaplugin.com/blog/restore-pro-version-after-upgrade-to-3-0-0">steps to restore your pro version</a> with all new features. Thank you :)', 'advanced-database-cleaner'); ?>
 
 
 
 
 
 
524
  <br/>
525
- <span style="font-size:12px;color:#999"><?php _e('If you are not a premium user, please kindly just close this message since you are not concerned by this issue!', 'advanced-database-cleaner'); ?></span>
 
 
 
 
 
 
 
 
 
526
  </p>
527
  </div>
528
- <?php
529
  }
 
 
 
 
 
 
 
 
 
530
  ?>
531
 
532
- <div class="aDBc-margin-r-300">
 
533
  <div class="aDBc-tab-box">
 
534
  <?php
535
- $aDBc_tabs = array('general' => __('General clean-up', 'advanced-database-cleaner'),
536
- 'tables' => __('Tables', 'advanced-database-cleaner'),
537
- 'options' => __('Options', 'advanced-database-cleaner'),
538
- 'cron' => __('Cron jobs', 'advanced-database-cleaner'),
539
- 'overview' => __('Overview & settings', 'advanced-database-cleaner'),
540
- 'premium' => __('Premium', 'advanced-database-cleaner')
541
- );
542
-
543
- // if the user choosed to hide the premium tab, then hide it
544
- if(!empty($aDBc_settings['hide_premium_tab']) && $aDBc_settings['hide_premium_tab'] == "1"){
545
- unset($aDBc_tabs['premium']);
546
- }
547
-
548
- $aDBc_dashicons_css = array('general' => 'dashicons-format-aside dashicons',
549
- 'tables' => 'dashicons-grid-view dashicons',
550
- 'options' => 'dashicons-forms dashicons',
551
- 'cron' => 'dashicons-backup dashicons',
552
- 'overview' => 'dashicons-admin-settings dashicons',
553
- 'premium' => 'dashicons-awards dashicons'
554
- );
555
-
556
- $current_tab = isset($_GET['aDBc_tab']) ? $_GET['aDBc_tab'] : 'general';
557
-
558
- echo '<h2 class="nav-tab-wrapper">';
 
 
 
 
 
 
 
 
 
 
 
 
 
 
559
  foreach($aDBc_tabs as $tab => $name){
560
  $class = ($tab == $current_tab) ? ' nav-tab-active' : '';
561
  $link = "?page=advanced_db_cleaner&aDBc_tab=$tab";
562
  if($tab == "tables" || $tab == "options" || $tab == "cron"){
563
  $link .= '&aDBc_cat=all';
564
  }
565
- echo "<a class='nav-tab$class' href='$link'><span class='$aDBc_dashicons_css[$tab]'></span> $name</a>";
566
  }
567
- echo '</h2>';
568
 
569
  echo '<div class="aDBc-tab-box-div">';
570
- switch ($current_tab){
 
 
571
  case 'general' :
 
572
  include_once 'includes/clean_db.php';
573
  break;
 
574
  case 'tables' :
 
575
  include_once 'includes/optimize_db.php';
576
  break;
 
577
  case 'options' :
 
578
  include_once 'includes/class_clean_options.php';
579
  break;
 
580
  case 'cron' :
 
581
  include_once 'includes/class_clean_cron.php';
582
  break;
 
583
  case 'overview' :
 
584
  include_once 'includes/overview_settings.php';
585
  break;
 
586
  case 'premium' :
 
587
  include_once 'includes/premium_page.php';
588
  break;
 
 
 
 
589
  }
 
590
  echo '</div>';
 
591
  ?>
592
  </div>
593
 
594
- <!-- sidebar -->
595
- <div class="aDBc-sidebar"><?php include_once 'includes/sidebar.php'; ?></div>
 
 
 
 
 
 
 
596
 
597
  </div>
598
  </div>
599
- <?php
600
- }
601
- }
602
-
603
 
 
604
 
 
 
605
 
606
  // Get instance
607
- new ADBC_Advanced_DB_Cleaner();
1
  <?php
2
+
 
3
  /*
4
  Plugin Name: Advanced Database Cleaner
5
  Plugin URI: https://sigmaplugin.com/downloads/wordpress-advanced-database-cleaner
6
  Description: Clean database by deleting unused data such as 'old revisions', 'old drafts', 'orphan options', etc. Optimize database and more.
7
+ Version: 3.1.0
8
  Author: Younes JFR.
9
  Author URI: https://www.sigmaplugin.com
10
  Contributors: symptote
14
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
15
  */
16
 
17
+ // Don't load directly
18
+ if ( ! defined( 'ABSPATH' ) ) return;
19
+ if ( ! is_main_site() ) return;
20
+
21
+ // Require WordPress List Table Administration API
22
+ if ( ! class_exists( 'WP_List_Table' ) ) {
23
+
24
+ require_once( ABSPATH . 'wp-admin/includes/class-wp-list-table.php' );
25
+
26
  }
27
 
28
  class ADBC_Advanced_DB_Cleaner {
29
 
30
+ public function __construct() {
31
 
32
+ // Define constants that should be modified in each version
33
+ if( ! defined( "ADBC_PLUGIN_VERSION" ) ) define( "ADBC_PLUGIN_VERSION", "3.1.0" );
34
+ if( ! defined( "ADBC_PLUGIN_PLAN" ) ) define( "ADBC_PLUGIN_PLAN", "free" );
35
 
36
+ // Prevent conflicts between free and pro, load text-domain and check if we should update settings after upgrade
37
+ add_action( 'plugins_loaded', array( $this, 'plugins_loaded' ) );
38
 
39
  // Load CSS and JS
40
+ add_action( 'admin_enqueue_scripts', array( $this, 'aDBc_load_styles_and_scripts' ) );
41
 
42
  // Add some schedules
43
+ add_filter( 'cron_schedules', array( $this, 'aDBc_additional_schedules' ) );
44
 
45
  // Add actions for scheduled events
46
+ add_action( 'aDBc_optimize_scheduler', 'aDBc_optimize_scheduled_tables' );
47
+ add_action( 'aDBc_clean_scheduler', 'aDBc_clean_scheduled_elements' );
48
 
49
  // Register activation, deactivation and uninstall hooks of the plugin
50
+ register_activation_hook ( __FILE__, array( $this, 'aDBc_activate_plugin' ) );
51
+ register_deactivation_hook ( __FILE__, array( $this, 'aDBc_deactivate_plugin' ) );
52
+ register_uninstall_hook ( __FILE__, array( 'ADBC_Advanced_DB_Cleaner', 'aDBc_uninstall' ) );
53
 
54
  // Add admin notice to rate plugin
55
+ add_action( 'admin_notices', array( $this, 'aDBc_rate_notice' ) );
56
+ // Ignore admin notice if needed + ignore double check if needed
57
+ add_action( 'admin_init', array( $this, 'aDBc_ignore_notice' ) );
58
 
59
  // Update settings if changed by users
60
  $this->aDBc_update_settings();
61
+
62
  }
63
 
64
  // Do this on plugins loded : prevent conflict between free and pro, load text-domain and check if we should update settings in DB
65
+ public function plugins_loaded() {
66
 
67
  // Prevent conflicts between free and pro versions and between old pro and new pro
68
+ if ( ! function_exists( 'deactivate_plugins' ) ) include_once( ABSPATH . 'wp-admin/includes/plugin.php' );
69
+
70
+ // Test if the user wants to activate the pro but the free is activated
71
+ if ( is_plugin_active( 'advanced-database-cleaner-pro/advanced-db-cleaner.php' ) &&
72
+ is_plugin_active( 'advanced-database-cleaner/advanced-db-cleaner.php' ) ) {
73
+
74
+ // Deactivate the free version in silent mode to keep scheduled tasks for pro
75
+ deactivate_plugins( 'advanced-database-cleaner/advanced-db-cleaner.php', true );
76
+ add_action( 'admin_notices', array( $this, 'aDBc_conflict_notice_free' ) );
77
+
78
  return;
79
  }
80
+
81
+ // Test if the user wants to activate the pro version but he has the old pro activated
82
+ if ( is_plugin_active( 'advanced-database-cleaner-pro/advanced-db-cleaner.php' ) &&
83
+ is_plugin_active( 'advanced-db-cleaner/advanced-db-cleaner.php' ) ) {
84
+
85
+ // Deactivate the old pro in silent mode to keep scheduled tasks for pro
86
+ deactivate_plugins( 'advanced-db-cleaner/advanced-db-cleaner.php', true );
87
+ add_action( 'admin_notices', array( $this, 'aDBc_conflict_notice_old_pro' ) );
88
+
89
  return;
90
  }
91
 
92
  /********************************************************************
93
  * Include functions and specific elements for pro version
94
  ********************************************************************/
95
+
96
  include_once 'includes/functions.php';
97
 
98
+ // In pro, include these as well
99
 
100
+ if ( ADBC_PLUGIN_PLAN == "pro" ) {
101
+
102
+ include_once 'includes/functions_pro.php';
103
+
104
+ register_shutdown_function( 'aDBc_shutdown_due_to_timeout' );
105
+
106
+ include_once 'includes/license/adbc-edd-sample-plugin.php';
107
+
108
+ add_action( 'wp_ajax_aDBc_new_run_search_for_items', 'aDBc_new_run_search_for_items' );
109
+ add_action( 'wp_ajax_aDBc_get_progress_bar_width', 'aDBc_get_progress_bar_width' );
110
+ add_action( 'wp_ajax_aDBc_double_check_items', 'aDBc_double_check_items' );
111
+ add_action( 'wp_ajax_aDBc_stop_search', 'aDBc_stop_search' );
112
+ }
113
+
114
+ /********************************************************************
115
  * Define other variables (we switch all "\" to "/" in paths)
116
+ ********************************************************************/
 
117
 
118
+ if ( ! defined( "ADBC_PLUGIN_DIR_PATH" ) ) define( "ADBC_PLUGIN_DIR_PATH", plugins_url( '' , __FILE__ ) );
119
 
120
  // Main Plugin file
121
+ if ( ! defined( "ADBC_MAIN_PLUGIN_FILE_PATH" ) ) define( "ADBC_MAIN_PLUGIN_FILE_PATH", str_replace( '\\' ,'/', __FILE__ ) );
122
 
123
  // ABSPATH without trailing slash
124
+ if ( ! defined( "ADBC_ABSPATH" ) ) define( "ADBC_ABSPATH", rtrim( str_replace( '\\' ,'/', ABSPATH ), "/" ) );
125
 
126
  // WP Content directory
127
+ if ( ! defined( "WP_CONTENT_DIR" ) ) define( "WP_CONTENT_DIR", ABSPATH . 'wp-content' );
128
+
129
+ if ( ! defined( "ADBC_WP_CONTENT_DIR_PATH" ) ) define( "ADBC_WP_CONTENT_DIR_PATH", str_replace( '\\' ,'/', WP_CONTENT_DIR ) );
130
 
131
  // WP Plugin directory path & name
132
+ if ( ! defined( "WP_PLUGIN_DIR" ) ) define( "WP_PLUGIN_DIR", WP_CONTENT_DIR . '/plugins' );
 
133
 
134
+ if ( ! defined( "ADBC_WP_PLUGINS_DIR_PATH" ) ) define( "ADBC_WP_PLUGINS_DIR_PATH", str_replace( '\\' ,'/', WP_PLUGIN_DIR ) );
135
+
136
+ // MU Must have plugin path & name
137
+ if ( ! defined( "WPMU_PLUGIN_DIR" ) ) define( "WPMU_PLUGIN_DIR", WP_CONTENT_DIR . '/mu-plugins' );
138
+
139
+ if ( ! defined( "ADBC_WPMU_PLUGIN_DIR_PATH" ) ) define( "ADBC_WPMU_PLUGIN_DIR_PATH", str_replace( '\\' ,'/', WPMU_PLUGIN_DIR ) );
140
 
141
  // WP Uploads directory & name
142
  $aDBc_upload_dir = wp_upload_dir();
 
143
 
144
+ if ( ! defined( "ADBC_UPLOAD_DIR_PATH" ) ) define( "ADBC_UPLOAD_DIR_PATH", str_replace( '\\' ,'/', $aDBc_upload_dir['basedir'] ) );
145
+
146
+ /**************************************************************************************************************
147
+ *
148
+ * In pro, define & create adbc upload folder or rename existing one by adding security code for versions < 3.1.0
149
+ * In version >= 3.0.0 of ADBC, we are using files to store scan data instead of database
150
+ * In version >= 3.1.0, we've added a unique security code to the end of the folder
151
+ *
152
+ **************************************************************************************************************/
153
+
154
+ if ( ADBC_PLUGIN_PLAN == "pro" ) {
155
+
156
+ $aDBc_security_folder_code = get_option( 'aDBc_security_folder_code' );
157
+
158
+ // If the security code does not exist, generate a new one
159
+ if ( empty( $aDBc_security_folder_code ) ) {
160
+
161
+ $permitted_chars = '00112233445566778899abcdefghijklmnopqrstuvwxyz';
162
+ $aDBc_security_folder_code = substr( str_shuffle( $permitted_chars ), 0, 12 );
163
+ update_option( 'aDBc_security_folder_code', $aDBc_security_folder_code, "no" );
164
+
165
+ }
166
+
167
+ // Define ADBC upload folder name with the security code
168
+ if ( ! defined( "ADBC_UPLOAD_DIR_PATH_TO_ADBC" ) ) {
169
+
170
+ define( "ADBC_UPLOAD_DIR_PATH_TO_ADBC", ADBC_UPLOAD_DIR_PATH . '/adbc_uploads_' . $aDBc_security_folder_code );
171
+
172
+ }
173
+
174
+ // Test of the old folder "/adbc_uploads" exists. If so, rename it by adding new security code
175
+ if ( file_exists( ADBC_UPLOAD_DIR_PATH . '/adbc_uploads' ) ) {
176
+
177
+ rename( ADBC_UPLOAD_DIR_PATH . '/adbc_uploads', ADBC_UPLOAD_DIR_PATH . '/adbc_uploads_' . $aDBc_security_folder_code );
178
+
179
+ } else {
180
+
181
+ // Create the new folder with the security code
182
+ if ( ! file_exists( ADBC_UPLOAD_DIR_PATH_TO_ADBC ) ) {
183
+
184
+ aDBc_create_folder_plus_index_file( ADBC_UPLOAD_DIR_PATH_TO_ADBC );
185
+
186
+ }
187
+ }
188
+ }
189
+
190
+ // Define & increase timeout
191
+
192
+ if ( ! defined( "ADBC_ORIGINAL_TIMEOUT" ) ) {
193
+
194
+ define( "ADBC_ORIGINAL_TIMEOUT", ini_get( 'max_execution_time' ) );
195
+
196
+ }
197
+
198
+ if ( ADBC_PLUGIN_PLAN == "pro" && function_exists( 'set_time_limit' ) && ADBC_ORIGINAL_TIMEOUT < 300 ) {
199
+
200
+ @set_time_limit( 300 );
201
+
202
+ }
203
 
204
  // Add 'Database Cleaner' to Wordpress menu
205
+
206
  add_action('admin_menu', array($this, 'aDBc_add_admin_menu'));
207
 
208
  // Load text-domain
209
+
210
  load_plugin_textdomain('advanced-database-cleaner', false, dirname(plugin_basename(__FILE__)) . '/languages');
211
 
212
  // If plugin get updated, make changes to old version
213
+
214
+ $this->aDBc_update_plugin_check();
215
 
216
  }
217
 
225
  echo '<div class="error"><p>';
226
  _e('The old pro of Advanced DB Cleaner has been de-activated since the new pro version is active.', 'advanced-database-cleaner');
227
  echo "</p></div>";
228
+ }
229
 
230
  // Add 'Database Cleaner' to Wordpress menu
231
  function aDBc_add_admin_menu(){
242
  }
243
  // In case the settings has been deleted by accident, create left menu
244
  if(empty($aDBc_settings['left_menu']) && empty($aDBc_settings['menu_under_tools'])){
245
+ $aDBc_left_menu = add_menu_page('Advanced DB Cleaner', 'WP DB Cleaner', 'manage_options', 'advanced_db_cleaner', array($this, 'aDBc_main_page_callback'), $icon_svg, '80.01123');
246
  }
247
  }
248
 
255
  return;
256
  }
257
 
258
+ wp_enqueue_style('aDBc_css', ADBC_PLUGIN_DIR_PATH . '/css/admin.css');
259
+ wp_enqueue_style('aDBc_sweet2_css', ADBC_PLUGIN_DIR_PATH . '/css/sweetalert2.min.css');
260
 
261
+ wp_enqueue_script('aDBc_js', ADBC_PLUGIN_DIR_PATH . '/js/admin.js');
262
+ wp_enqueue_script('aDBc_sweet2_js', ADBC_PLUGIN_DIR_PATH . '/js/sweetalert2.min.js');
263
 
264
  // The wp_localize_script allows us to output the ajax_url path for our script to use.
265
  wp_localize_script('aDBc_js', 'aDBc_ajax_obj', array(
266
 
267
+ 'ajaxurl' => admin_url( 'admin-ajax.php' ),
268
  'images_path' => ADBC_PLUGIN_DIR_PATH . "/images/",
269
+ 'sentence_scanning' => __( 'Scanning ...', 'advanced-database-cleaner' ),
270
+ 'all_items' => __( 'All items', 'advanced-database-cleaner' ),
271
+ 'all_items2' => __( 'Scan all items', 'advanced-database-cleaner' ),
272
+ 'uncategorized' => __( 'Uncategorized', 'advanced-database-cleaner' ),
273
+ 'scan_time_depends' => __( 'The scan time depends on your DB size and number of files', 'advanced-database-cleaner' ),
274
+ 'scan_all_only' => __( 'The scan will process all uncategorized items, continue?', 'advanced-database-cleaner' ),
275
+ 'scan_all_or_u' => __( 'Do you want to scan all items or only uncategorized ones?', 'advanced-database-cleaner' ),
276
+ 'unexpected_error' => __( 'Unexpected error! Please refresh the page and try again!', 'advanced-database-cleaner' ),
277
+ 'select_action' => __( 'Please select an action!', 'advanced-database-cleaner' ),
278
+ 'no_items_selected' => __( 'No items selected!', 'advanced-database-cleaner' ),
279
+ 'clean_items_warning' => __( 'You are about to clean some of your unused data. This operation is irreversible!', 'advanced-database-cleaner' ),
280
+ 'empty_tables_warning' => __( 'You are about to empty some of your tables. This operation is irreversible!', 'advanced-database-cleaner' ),
281
+ 'are_you_sure' => __( 'Are you sure?', 'advanced-database-cleaner' ),
282
+ 'make_db_backup_first' => __( 'Don\'t forget to make a backup of your database first!', 'advanced-database-cleaner' ),
283
+ 'cancel' => __( 'Cancel', 'advanced-database-cleaner' ),
284
+ 'Continue' => __( 'Continue', 'advanced-database-cleaner' )
285
+
286
+ ));
287
+
288
  //wp_enqueue_script('jquery');
289
  wp_enqueue_script('jquery-ui-dialog');
290
  wp_enqueue_style('wp-jquery-ui-dialog');
332
  // Clear all schedules and update options in DB
333
  // Clear clean tasks
334
  $aDBc_clean_schedules = get_option('aDBc_clean_schedule');
335
+ $aDBc_clean_schedules = is_array($aDBc_clean_schedules) ? $aDBc_clean_schedules : array();
336
  foreach($aDBc_clean_schedules as $task_name => $task_info){
337
  wp_clear_scheduled_hook('aDBc_clean_scheduler', array($task_name));
338
  // Set active to no in DB
353
  }
354
 
355
  // Register UNINSTALL hook
356
+ public static function aDBc_uninstall() {
357
+
358
+ // Delete these ones in case they still in DB from older version < 3.0.0
359
+
360
+ delete_option( 'aDBc_options_status' );
361
+ delete_option( 'aDBc_tables_status' );
362
+ delete_option( 'aDBc_tasks_status' );
363
 
364
+ // Delete these options in pro
365
+
366
+ if ( ADBC_PLUGIN_PLAN == "pro" ) {
367
+
368
+ // These options should not exist after the scan. Make sure to clean them just in case
369
+
370
+ $array_items = array( 'options', 'tables', 'tasks' );
371
+
372
+ foreach ( $array_items as $item ) {
373
+
374
+ delete_option( 'aDBc_temp_last_iteration_' . $item );
375
+ delete_option( 'aDBc_temp_still_searching_' . $item );
376
+ delete_option( 'aDBc_temp_last_item_line_' . $item );
377
+ delete_option( 'aDBc_temp_last_file_line_' . $item );
378
+ delete_option( 'aDBc_last_search_ok_' . $item );
379
+ delete_option( 'aDBc_temp_total_files_' . $item );
380
+ delete_option( 'aDBc_temp_maybe_scores_' . $item );
381
+
382
+ }
383
+
384
+ // Delete folder containing scan results
385
+
386
+ $aDBc_security_code = get_option( 'aDBc_security_folder_code' );
387
+ $aDBc_upload_dir = wp_upload_dir();
388
+ $aDBc_upload_dir = str_replace( '\\' ,'/', $aDBc_upload_dir['basedir'] ) . '/adbc_uploads_' . $aDBc_security_code;
389
+
390
+ if(file_exists($aDBc_upload_dir)){
391
+ $dir = opendir($aDBc_upload_dir);
392
+ while(($file = readdir($dir)) !== false){
393
+ if ($file != '.' && $file != '..'){
394
+ unlink($aDBc_upload_dir . "/" . $file);
395
+ }
396
+ }
397
+ closedir($dir);
398
+ rmdir($aDBc_upload_dir);
399
+ }
400
+
401
+ // Just in case the old folder (in versions < 3.1.0) have not been cleaned for any reason, try to clean it
402
+ $aDBc_upload_dir = wp_upload_dir();
403
+ $aDBc_upload_dir = str_replace('\\' ,'/', $aDBc_upload_dir['basedir']) . '/adbc_uploads';
404
+ if(file_exists($aDBc_upload_dir)){
405
+ $dir = opendir($aDBc_upload_dir);
406
+ while(($file = readdir($dir)) !== false){
407
+ if ($file != '.' && $file != '..'){
408
+ unlink($aDBc_upload_dir . "/" . $file);
409
+ }
410
+ }
411
+ closedir($dir);
412
+ rmdir($aDBc_upload_dir);
413
+ }
414
+
415
+ // Delete security code option
416
+ delete_option('aDBc_security_folder_code');
417
+ // Delete license options
418
+ delete_option('aDBc_edd_license_key');
419
+ delete_option('aDBc_edd_license_status');
420
+
421
+ // Uninstall the license key? Maybe no need for deactivating the license!
422
+ // if(!function_exists('aDBc_edd_deactivate_license_after_uninstall')){
423
+ // include_once 'includes/license/adbc-edd-sample-plugin.php';
424
+ // }
425
+ // aDBc_edd_deactivate_license_after_uninstall();
426
+
427
+ }
428
 
429
  // Options below are used by both free and pro version
430
  // Test if both version are installed to prevent deleting options
431
+ if ( ( file_exists( WP_PLUGIN_DIR . "/advanced-database-cleaner-pro") &&
432
+ file_exists( WP_PLUGIN_DIR . "/advanced-database-cleaner" )
433
+ ) ||
434
+ ( file_exists( WPMU_PLUGIN_DIR . "/advanced-database-cleaner-pro" ) &&
435
+ file_exists( WPMU_PLUGIN_DIR . "/advanced-database-cleaner" )
436
+ )
437
+ ) {
438
+
439
  // Do nothing in this case because we want to keep settings for the remaining version of the plugin
440
+
441
+ } else {
442
+
443
+ delete_option( 'aDBc_optimize_schedule' );
444
+ delete_option( 'aDBc_clean_schedule' );
445
+ delete_option( 'aDBc_settings' );
446
+
447
  }
448
  }
449
 
454
  if(empty($settings['plugin_version'])){
455
 
456
  // If settings is not empty, this means that the users had already installed ADBC plugin
457
+ // if empty($settings['plugin_version']) => the user will update to or will install the version >= 3.0.0 for the first time, because in previous verions, this option "plugin_version" does not exist
458
 
459
  // Before starting the update, make all previous plugin options to autoload "no"
460
  $options_array = array('aDBc_optimize_schedule', 'aDBc_clean_schedule', 'aDBc_settings', 'aDBc_edd_license_key', 'aDBc_edd_license_status');
533
  foreach($item_info as $item){
534
  $columns = explode(":", $item);
535
  // A customer reported that the colon is not supported as separator in searching and all options with colon are not categorized!
536
+ // == 5 means that the option does not contain a colon. Process only these cases since items with >=5 are by default uncategorized
537
  if(count($columns) == 5){
538
  fwrite($myfile, $item."\n");
539
  }
559
  restore_current_blog();
560
  }
561
  }
562
+
563
+ } else {
564
+
565
+ // If plugin_version is not empty, we update the plugin version in DB
566
+
567
+ if ( $settings['plugin_version'] != ADBC_PLUGIN_VERSION ) {
568
+
569
+ // We update the plugin version in DB
570
+
571
  $settings['plugin_version'] = ADBC_PLUGIN_VERSION;
572
+ update_option( 'aDBc_settings', $settings, "no" );
573
+
574
+ // In pro, from V 3.1.2, we deleted some options and files
575
+
576
+ if ( ADBC_PLUGIN_PLAN == "pro" ) {
577
+
578
+ $array_items = array( 'options', 'tables', 'tasks' );
579
+
580
+ foreach ( $array_items as $item ) {
581
+
582
+ // This option is not used anymore from V 3.2.1
583
+
584
+ delete_option( 'aDBc_temp_still_searching_' . $item );
585
+
586
+ // Delete any temp option after each release
587
+
588
+ delete_option('aDBc_temp_last_iteration_' . $item);
589
+ delete_option('aDBc_temp_last_item_line_' . $item);
590
+ delete_option('aDBc_temp_last_file_line_' . $item);
591
+ delete_option('aDBc_last_search_ok_' . $item);
592
+ delete_option('aDBc_temp_total_files_' . $item);
593
+ delete_option("aDBc_temp_maybe_scores_" . $item);
594
+
595
+ // From V 3.2.1, some temp files should not exist after the scan
596
+
597
+ if(file_exists(ADBC_UPLOAD_DIR_PATH_TO_ADBC . "/timeout_" . $item . ".txt"))
598
+ unlink(ADBC_UPLOAD_DIR_PATH_TO_ADBC . "/timeout_" . $item . ".txt");
599
+
600
+ if(file_exists(ADBC_UPLOAD_DIR_PATH_TO_ADBC . "/maybe_scores_" . $item . ".txt"))
601
+ unlink(ADBC_UPLOAD_DIR_PATH_TO_ADBC . "/maybe_scores_" . $item . ".txt");
602
+
603
+ if(file_exists(ADBC_UPLOAD_DIR_PATH_TO_ADBC . "/total_items_" . $item . ".txt"))
604
+ unlink(ADBC_UPLOAD_DIR_PATH_TO_ADBC . "/total_items_" . $item . ".txt");
605
+
606
+ if(file_exists(ADBC_UPLOAD_DIR_PATH_TO_ADBC . "/progress_items_" . $item . ".txt"))
607
+ unlink(ADBC_UPLOAD_DIR_PATH_TO_ADBC . "/progress_items_" . $item . ".txt");
608
+
609
+ if(file_exists(ADBC_UPLOAD_DIR_PATH_TO_ADBC . "/" . $item . "_to_categorize.txt"))
610
+ unlink(ADBC_UPLOAD_DIR_PATH_TO_ADBC . "/" . $item . "_to_categorize.txt");
611
+
612
+ }
613
+
614
+ // From v 3.1.2, the "all_files_paths.txt" should not be present after the scan
615
+ if ( file_exists( ADBC_UPLOAD_DIR_PATH_TO_ADBC . "/all_files_paths.txt" ) )
616
+ unlink( ADBC_UPLOAD_DIR_PATH_TO_ADBC . "/all_files_paths.txt" );
617
+
618
+ }
619
  }
620
  }
621
  }
643
  }
644
  }
645
  function aDBc_ignore_notice(){
646
+ // Disable rating notice
647
  if(isset($_GET['adbc-ignore-notice']) && $_GET['adbc-ignore-notice'] == "0"){
648
  $settings = get_option('aDBc_settings');
649
  $settings['ignore_rating'] = "yes";
650
  update_option('aDBc_settings', $settings, "no");
651
  }
652
+
653
+ // In pro, hide double check message
654
+ if ( ADBC_PLUGIN_PLAN == "pro" ) {
655
+ if(isset($_GET['ignore-double-check-tables'])){
656
+ delete_option('aDBc_last_search_ok_tables');
657
+ }
658
+ if(isset($_GET['ignore-double-check-options'])){
659
+ delete_option('aDBc_last_search_ok_options');
660
+ }
661
+ if(isset($_GET['ignore-double-check-tasks'])){
662
+ delete_option('aDBc_last_search_ok_tasks');
663
+ }
664
+ }
665
  }
666
 
667
  // Update settings when saved in "overview & settings" tab. Test also to disable premium notice if closed by users
677
  $aDBc_settings['left_menu'] = "1";
678
  }
679
 
680
+ if ( ADBC_PLUGIN_PLAN == "free" ) {
681
+
682
+ $aDBc_settings['hide_premium_tab'] = isset( $_POST['aDBc_hide_premium_tab'] ) ? "1" : "0";
683
+
684
+ }
685
 
686
  // Update settings in DB
687
+ update_option( 'aDBc_settings', $aDBc_settings, "no" );
688
  }
689
+
690
+
691
  /********************************************************************
692
+ * In free, update premium notice for lost licenses
693
  ********************************************************************/
694
+ if ( ADBC_PLUGIN_PLAN == "free" ) {
695
+ if(isset($_GET['ignore-premium-notice']) && $_GET['ignore-premium-notice'] == "yes"){
696
+ $aDBc_settings['ignore_premium'] = "yes";
697
+ update_option('aDBc_settings', $aDBc_settings, "no");
698
+ }
699
  }
700
 
701
+
702
  }
703
 
704
  // The admin page of the plugin
705
+
706
+ function aDBc_main_page_callback() {
707
+
708
+ ?>
709
+
710
  <div class="wrap">
711
 
712
+ <div class="aDBc-header-wrap">
713
+ <img class="aDBc-header-logo" src="<?php echo ADBC_PLUGIN_DIR_PATH; ?>/images/icon-128x128.png"/>
714
+
715
+ <div class="aDBc-float-left">
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
716
 
717
+ <div class="aDBc-header-title">
718
 
719
+ <?php
720
+
721
+ $aDBc_pro = "";
722
+
723
+ if ( ADBC_PLUGIN_PLAN == "pro" ) {
724
+
725
+ $aDBc_pro = " <b>PRO</b>";
726
+
727
+ }
728
+
729
+ echo "Advanced DB Cleaner" . $aDBc_pro . " <span class='aDBc-font-13'>" . ADBC_PLUGIN_VERSION . "</span>";
730
+
731
+ ?>
732
+
733
+ </div>
734
+
735
+ <div class="aDBc-header-meta">
736
+ <span class="aDBc-header-by">
737
+ <span><?php _e('By', 'advanced-database-cleaner'); ?></span>
738
+ <a class="aDBc-link" href="https://profiles.wordpress.org/symptote/" target="_blank">
739
+ Younes JFR.
740
+ </a>
741
+ </span>
742
+ |
743
+ <span class="aDBc-header-need-help-ls">
744
+ <span><?php _e('Need help?', 'advanced-database-cleaner'); ?></span>
745
+ <a class="aDBc-link" href="https://sigmaplugin.com/contact" target="_blank">
746
+ <?php _e('Contact me', 'advanced-database-cleaner'); ?>
747
+ </a>
748
+ </span>
749
+ <span class="aDBc-header-need-help-ss">
750
+ <a class="aDBc-link" href="https://sigmaplugin.com/contact" target="_blank">
751
+ <?php _e('Support', 'advanced-database-cleaner'); ?>
752
+ </a>
753
+ </span>
754
+ </div>
755
+ </div>
756
+
757
+ <div class="aDBc-header-support">
758
+ <a class="aDBc-link" href="https://sigmaplugin.com/contact" target="_blank">
759
+ <img class="aDBc-header-help-svg" src="<?php echo ADBC_PLUGIN_DIR_PATH; ?>/images/help.svg"/>
760
+ <br/>
761
+ <?php _e('Support', 'advanced-database-cleaner'); ?>
762
+ </a>
763
+ </div>
764
+ </div>
765
+
766
+ <h2></h2>
767
+
768
  <?php
 
 
 
769
 
770
+ if ( ADBC_PLUGIN_PLAN == "pro" && ! aDBc_edd_is_license_activated() ) {
771
+
772
+ echo '<div class="aDBc-please-activate-msg notice is-dismissible"><p>';
773
+ echo __( 'Please activate your license key to get lifetime automatic updates and support.', 'advanced-database-cleaner' );
774
+ echo ' <a href="?page=advanced_db_cleaner&aDBc_tab=license">' . __( 'Activate now', 'advanced-database-cleaner' ) . "</a>";
775
+ echo '</p></div>';
776
+ }
777
+ // zzz
778
  global $aDBc_settings;
779
 
780
+ // Notice to users who will lose their pro after upgrading to 3.0.0 from an old version
781
+
782
+ if ( ADBC_PLUGIN_PLAN == "free" && ! empty( $aDBc_settings['ignore_premium'] ) && $aDBc_settings['ignore_premium'] == "no" ) {
783
 
784
  $aDBc_new_URI = $_SERVER['REQUEST_URI'];
785
+ $aDBc_new_URI = add_query_arg( 'ignore-premium-notice', 'yes', $aDBc_new_URI ); ?>
786
 
787
  <div id="aDBc_main_msg" class="aDBc-premium-lost-msg">
788
+
789
  <span style="float:left;margin-bottom:20px"><?php _e('Important notice to premium users!', 'advanced-database-cleaner'); ?></span>
790
+
791
  <a style="text-decoration:none;float:right" href="<?php echo $aDBc_new_URI ?>">
792
  <span class="dashicons-dismiss dashicons"></span>
793
  </a>
794
+
795
  <p style="font-size:13px;clear:both">
796
+
797
+ <?php
798
+
799
+ _e('You will probably lose the pro version after this upgrade (This is due to a conflict between the free and pro versions which is now solved). If it is the case, please follow these <a target ="_blank" href="https://sigmaplugin.com/blog/restore-pro-version-after-upgrade-to-3-0-0">steps to restore your pro version</a> with all new features. Thank you :)', 'advanced-database-cleaner');
800
+
801
+ ?>
802
+
803
  <br/>
804
+
805
+ <span style="font-size:12px;color:#999">
806
+
807
+ <?php
808
+
809
+ _e('If you are not a premium user, please kindly just close this message since you are not concerned by this issue!', 'advanced-database-cleaner');
810
+
811
+ ?>
812
+
813
+ </span>
814
  </p>
815
  </div>
816
+ <?php
817
  }
818
+
819
+ $main_content_style = "";
820
+
821
+ if ( ADBC_PLUGIN_PLAN == "free" ) {
822
+
823
+ $main_content_style = "aDBc-main-content";
824
+
825
+ }
826
+
827
  ?>
828
 
829
+ <div class="<?php echo $main_content_style; ?>">
830
+
831
  <div class="aDBc-tab-box">
832
+
833
  <?php
834
+
835
+ $aDBc_tabs = array( 'general' => __( 'General clean-up', 'advanced-database-cleaner' ),
836
+ 'tables' => __( 'Tables', 'advanced-database-cleaner' ),
837
+ 'options' => __( 'Options', 'advanced-database-cleaner' ),
838
+ 'cron' => __( 'Cron jobs', 'advanced-database-cleaner' ),
839
+ 'overview' => __( 'Overview & settings', 'advanced-database-cleaner' ),
840
+ 'premium' => __( 'Premium', 'advanced-database-cleaner' ),
841
+ 'license' => __( 'License', 'advanced-database-cleaner' )
842
+ );
843
+
844
+ // Hide premium tab in pro + In free, test if the the user choosed to hide the premium tab
845
+ if ( ADBC_PLUGIN_PLAN == "pro" ||
846
+ ( ADBC_PLUGIN_PLAN == "free" && ! empty( $aDBc_settings['hide_premium_tab'] ) && $aDBc_settings['hide_premium_tab'] == "1" )
847
+ ) {
848
+
849
+ unset( $aDBc_tabs['premium'] );
850
+
851
+ }
852
+
853
+ // Hide license in free
854
+ if ( ADBC_PLUGIN_PLAN == "free" ) {
855
+
856
+ unset( $aDBc_tabs['license'] );
857
+
858
+ }
859
+
860
+ $aDBc_dashicons_css = array('general' => 'dashicons-format-aside dashicons',
861
+ 'tables' => 'dashicons-grid-view dashicons',
862
+ 'options' => 'dashicons-forms dashicons',
863
+ 'cron' => 'dashicons-backup dashicons',
864
+ 'overview' => 'dashicons-admin-settings dashicons',
865
+ 'premium' => 'dashicons-awards dashicons',
866
+ 'license' => 'dashicons-admin-network dashicons'
867
+ );
868
+
869
+ $current_tab = isset( $_GET['aDBc_tab'] ) ? $_GET['aDBc_tab'] : 'general';
870
+
871
+ echo '<ul class="nav-tab-wrapper">';
872
  foreach($aDBc_tabs as $tab => $name){
873
  $class = ($tab == $current_tab) ? ' nav-tab-active' : '';
874
  $link = "?page=advanced_db_cleaner&aDBc_tab=$tab";
875
  if($tab == "tables" || $tab == "options" || $tab == "cron"){
876
  $link .= '&aDBc_cat=all';
877
  }
878
+ echo "<li><a class='nav-tab$class' href='$link'><span class='$aDBc_dashicons_css[$tab]'></span> $name</a></li>";
879
  }
880
+ echo '</ul>';
881
 
882
  echo '<div class="aDBc-tab-box-div">';
883
+
884
+ switch ( $current_tab ) {
885
+
886
  case 'general' :
887
+
888
  include_once 'includes/clean_db.php';
889
  break;
890
+
891
  case 'tables' :
892
+
893
  include_once 'includes/optimize_db.php';
894
  break;
895
+
896
  case 'options' :
897
+
898
  include_once 'includes/class_clean_options.php';
899
  break;
900
+
901
  case 'cron' :
902
+
903
  include_once 'includes/class_clean_cron.php';
904
  break;
905
+
906
  case 'overview' :
907
+
908
  include_once 'includes/overview_settings.php';
909
  break;
910
+
911
  case 'premium' :
912
+
913
  include_once 'includes/premium_page.php';
914
  break;
915
+
916
+ case 'license' :
917
+ aDBc_edd_license_page();
918
+ break;
919
  }
920
+
921
  echo '</div>';
922
+
923
  ?>
924
  </div>
925
 
926
+ <?php
927
+
928
+ if ( ADBC_PLUGIN_PLAN == "free" ) {
929
+
930
+ include_once 'includes/sidebar.php';
931
+
932
+ }
933
+
934
+ ?>
935
 
936
  </div>
937
  </div>
 
 
 
 
938
 
939
+ <?php
940
 
941
+ }
942
+ }
943
 
944
  // Get instance
945
+ new ADBC_Advanced_DB_Cleaner();
css/admin.css CHANGED
@@ -1,213 +1,300 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  /*---------------------------------------------------------------------------------------------
2
- *
3
- * Global styles
4
- *
5
  *---------------------------------------------------------------------------------------------*/
6
- html {
7
- overflow-y: scroll;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
8
  }
9
- .aDBc-premium-lost-msg{
 
 
 
 
 
10
  border-left: 5px solid orange !important;
11
  background: #fff !important;
12
  padding: 20px !important;
 
13
  }
14
- .aDBc-premium-lost-msg > span{
 
15
  font-size: 17px;
16
  font-family: arial;
17
  color: orange;
18
  font-weight: bold;
19
  }
20
 
21
- .aDBc-content-max-width{
22
- max-width: 840px;
23
- }
24
- .aDBc-margin-r-300 {
25
- margin-top: 10px;
26
- margin-right: 260px;
27
- }
28
- .aDBc-margin-t-10 {
29
- margin-top: 10px;
30
- }
31
- .aDBc-margin-t-20 {
32
- margin-top: 20px;
33
  }
34
- .aDBc-margin-b-20 {
35
- margin-bottom: 20px;
 
 
 
 
 
36
  }
37
- .aDBc-margin-l-3 {
38
- margin-left: 3px !important;
 
 
 
 
 
 
39
  }
40
- .aDBc-clear-both{
41
- clear: both;
 
 
 
42
  }
43
- .aDBc-float-left{
 
 
 
 
 
44
  float: left;
 
 
45
  }
46
- .aDBc-float-right{
47
- float: right;
48
- }
49
- /*#aDBc-please-wait{
50
- display: none;
51
- height: 34px !important;
52
- margin-bottom: 40px;
53
- /*color: #999;
54
- font-family: verdana;
55
- font-size: 11px;
56
- text-align: center;
57
  }
58
- .aDBc-loading-gif{
59
- height: 45px;
60
- width: 50px;
61
- background: url("../images/spinner.gif") no-repeat;
62
- background-position: 50% 0% !important;
63
- text-align: center;
64
- /*margin: -20px 0px 0px 0px;
65
- }*/
66
- .aDBc-category-counts{
67
- float: right;
68
- /*background: #f9f9f9;*/
69
- padding: 0px;
70
- text-align: left;
71
- border-radius: 4px;
72
- -moz-border-radius: 4px;
73
- -webkit-border-radius: 4px;
74
  }
75
- .aDBc-category-counts a:hover{
76
- padding-bottom: 1px;
77
- border-bottom: 1px solid #ccc;
 
 
 
 
 
78
  }
79
- .aDBc-category-counts-links {
80
- text-decoration: none !important;
 
 
 
 
 
81
  }
82
- .aDBc-selected-category{
83
- /*padding-bottom: 6px; */
84
- font-weight: bold;
85
  font-size: 13px;
 
 
 
 
 
 
86
  }
87
- .aDBc-category-separator{
88
- color: #999;
89
- margin-left: 4px;
90
- margin-right: 4px
91
- }
92
- .aDBc-run-new-search,.aDBc-run-new-search:disabled{
93
- height: 34px !important;
94
- min-width: 145px !important;
95
- background-image: url("../images/search-icon.svg");
96
- background-repeat: no-repeat !important;
97
- background-position: 8px 50% !important;
98
- padding-left: 38px !important;
99
- text-align: left;
100
-
101
- background-color: #0085ba;
102
- border-color: #0073aa #006799 #006799;
103
- box-shadow: 0 1px 0 #006799;
104
- color: #fff;
105
- text-shadow: 0 -1px 1px #006799, 1px 0 1px #006799, 0 1px 1px #006799, -1px 0 1px #006799;
106
-
107
- display: inline-block;
108
- text-decoration: none;
109
- font-size: 13px;
110
- line-height: 26px;
111
- height: 28px;
112
- margin: 0;
113
-
114
- cursor: pointer;
115
- border-width: 1px;
116
- border-style: solid;
117
- -webkit-appearance: none;
118
- border-radius: 3px;
119
- white-space: nowrap;
120
- box-sizing: border-box;
121
- }
122
- .aDBc-run-new-search:hover{
123
- background-color: #178DBD;
124
  }
125
 
126
- input:disabled {
127
- background-color: #0085ba;
128
- border-color: rgba(222,222,222,.75);
129
- box-shadow: inset 0 1px 2px rgba(0,0,0,.04);
130
- color: #e9e9e9;
131
- cursor: default;
132
  }
133
-
134
- /*.aDBc-continue-new-search{
135
- height: 34px !important;
136
- min-width: 175px !important;
137
- background-image: url("../images/arrows.png") !important;
138
- background-repeat: no-repeat !important;
139
- background-position: 8px 50% !important;
140
- padding-left: 35px !important;
141
- text-align: left;
142
- }*/
143
- .aDBc-category-color{
144
- padding: 0px 5px;
145
- margin-right: 5px;
146
- border-radius: 2px;
147
- -moz-border-radius: 2px;
148
- -webkit-border-radius: 2px;
149
- display: inline-block;
150
- height: 10px
151
  }
152
- .aDBc-left-content{
153
- float: left;
154
- width: 600px;
155
- margin-right: 25px
 
 
156
  }
157
- .aDBc-text-status-db{
 
 
 
 
 
158
  font-family: verdana;
159
  font-size: 12px;
160
  }
161
- .aDBc-schedule-text{
162
- /*font-weight: bold;*/
163
  padding: 5px 0px 0px 0px;
164
  font-family: verdana;
165
  font-size: 12px;
166
-
167
  }
168
- .aDBc-schedule-hook-box{
 
169
  background: #fff;
170
  margin-top: 20px;
171
- border-radius: 5px;
172
  text-align: left;
173
  padding: 5px;
174
  border: 1px dashed #999;
175
  color: black;
176
  vertical-align: middle;
177
- border:1px solid #f1f1f1;border-radius:2px;box-shadow:0 0 10px #ccc;
178
-
 
179
  }
180
- .aDBc-schedule-on-off{
 
181
  vertical-align: middle;
182
  width: 30px;
183
  }
184
- .aDBc-schedule-box{
185
- border-top: 1px dashed #000;
186
- margin-top: 5px;
187
- }
188
- .aDBc-custom-clean-text{
189
- font-size: 15px;
190
- margin-top: 10px;
191
- margin-bottom: 45px;
192
- color: #0992CC;
193
- /*background: #fff6e5;
194
- padding: 10px;*/
195
- border-radius: 5px;
196
- -moz-border-radius: 5px;
197
- -webkit-border-radius: 5px;
198
 
 
 
 
 
 
 
 
199
  }
200
- .aDBc-custom-clean-text > div{
201
- text-align: center;
 
 
202
  }
203
- .aDBc-caution{
204
- font-size: 11px;
205
- color: red;
206
- margin-left: 26px;
207
- margin-top: 0px;
208
  }
209
 
210
- .aDBc-submit-link{
211
  background: none !important;
212
  border: none !important;
213
  text-decoration: none !important;
@@ -217,671 +304,932 @@ input:disabled {
217
  color: #0073aa;
218
  }
219
 
220
- .aDBc-edit-schedule{
221
- border-radius: 4px;
222
- font-size: 11px;
223
- background: #f0f5fa;
224
- padding: 2px 4px;
 
 
 
 
 
 
225
  float: right;
226
- margin-top: 4px;
 
 
 
 
227
  }
228
 
 
 
 
 
 
229
 
230
  /*---------------------------------------------------------------------------------------------
231
- *
232
- * These styles override those of WordPress
233
- *
234
  *---------------------------------------------------------------------------------------------*/
235
- .widefat {
236
- border-spacing: 1px;
237
- }
238
- .widefat > thead {
239
- background: #f1f1f1;
 
 
 
 
 
 
 
 
 
240
  }
241
- .widefat thead tr th{
242
- color: #666;
 
 
 
 
243
  }
244
- .widefat td, .widefat th {
245
- border-bottom: 1px solid #f1f1f1;
246
- border-right: 1px solid #f1f1f1;
247
- overflow: visible !important;
248
  }
249
- .widefat th {
250
- font-weight: bold !important;
251
- font-size: 13px !important;
 
 
 
252
  }
253
- .widefat > tbody > tr:hover {
254
- background-color: #f9f9f9;
 
 
 
 
255
  }
256
- .widefat > tbody > tr > td{
257
- vertical-align: middle !important;
258
- padding: 8px 10px !important;
 
 
 
 
259
  }
260
- .widefat td, .widefat td ol, .widefat td p, .widefat td ul {
261
- line-height: 1.5em !important;
 
 
262
  }
263
- .widefat tbody th.check-column, .widefat tfoot td.check-column, .widefat thead td.check-column {
264
- padding: 9px 0 5px 3px !important;
 
 
265
  }
266
- .widefat th input, .widefat thead td input{
267
- margin: 1px 0 0 8px !important;
 
 
 
 
 
 
268
  }
269
- /* This style is used by WP tables (WP_List_Table class) for columns, it is not used directly in the code */
270
- .column-site_id{
271
- width: 60px;
 
272
  }
273
- .column-o_table_prefix{
274
- width: 12%;
275
- }
276
- .column-o_table_name{
277
- /*width: 27%;*/
278
- }
279
- .column-o_table_name{
280
- /*width: 27%;*/
281
- }
282
- .column-post_id{
283
- width: 10%;
284
- }
285
- .column-post_title{
286
- width: 30%;
287
  }
288
- .column-post_content{
289
- width: 30%;
 
 
290
  }
291
- .column-post_date{
292
- width: 18%;
 
 
 
 
 
 
 
293
  }
294
 
295
- .column-comment_id{
296
- width: 15%;
 
 
297
  }
298
 
299
- .column-comment_author{
300
- width: 20%;
 
 
301
  }
302
- .column-comment_content{
303
- width: 45%;
 
 
 
 
 
 
 
 
304
  }
305
 
306
- .column-comment_date{
307
- width: 18%;
 
 
 
 
 
 
 
 
308
  }
309
 
310
- .column-meta_id{
311
- width: 20%;
 
 
 
 
312
  }
313
- .column-meta_key{
314
- width: 40%;
 
 
 
 
 
 
 
 
315
  }
316
- .column-meta_value{
317
- width: 40%;
 
 
 
 
 
318
  }
319
 
320
- .column-transient_id{
321
- width: 15%;
 
 
322
  }
323
- .column-transient_name{
324
- width: 30%;
 
 
 
 
 
 
325
  }
326
- .column-transient_content{
327
- width: 30%;
 
 
 
 
 
328
  }
329
- .column-transient_timeout{
330
- width: 20%;
 
331
  }
332
- .column-transient_autoload{
333
- width: 15%;
 
 
334
  }
335
 
336
- .column-lost_space{
337
- border-right: 0 none !important;
338
- width: 15%;
 
339
  }
340
- .column-option_value{
341
- width: 22% !important;
 
 
342
  }
343
- .column-option_size{
344
- width: 10% !important;
 
 
345
  }
346
- .column-option_autoload{
347
- width: 12% !important;
 
 
 
348
  }
349
- .column-option_belongs_to{
350
- width: 25% !important;
 
351
  }
352
- .column-hook_name{
353
- width: 27%;
 
354
  }
355
- .column-arguments{
356
- width: 18%;
 
 
 
357
  }
358
- .column-next_run{
359
- width: 30%;
360
- font-size: 12px !important;
 
 
361
  }
362
- .column-hook_belongs_to{
363
- width: 23%;
 
364
  }
365
- .column-table_prefix{
366
- /*width: 7%;*/
 
 
 
367
  }
368
- .column-table_name{
369
- /*width: 100%;*/
370
  }
371
- .column-table_rows{
372
- width: 68px !important;
 
 
 
373
  }
374
- .column-table_size{
375
- width: 78px !important;
376
- font-size: 12px !important;
377
  }
378
- .column-table_belongs_to{
379
- width: 170px !important;
380
- font-size: 13px !important;
381
- border-right: 0 none !important;
382
  }
383
- .column-table_lost{
384
- /*width: 50px;
385
- font-size: 12px !important;*/
 
 
 
 
386
  }
387
- .column-view{
388
- width: 45px;
 
389
  text-align: center !important;
390
  }
391
- .column-count{
392
- width: 42px;
 
393
  text-align: center !important;
394
  }
395
- .column-scheduled{
396
- width: 88px;
 
397
  text-align: center !important;
398
  }
399
- .column-keep{
 
 
400
  border-right: 0 none !important;
401
- width: 80px;
402
  text-align: center !important;
403
  }
404
- .column-draft_id, .column-revision_id, .column-comment_id, .column-commentmeta_id, .column-postmeta_id, .column-object_id{
405
- width: 65px;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
406
  }
407
- .column-urer_term_id{
408
- width: 70px;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
409
  }
410
- .column-draft_date, .column-revision_date{
411
- width: 125px;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
412
  }
413
- .column-commentmeta_meta_key,
414
- .column-postmeta_meta_key{
415
- width: 225px;
 
 
 
 
416
  }
417
- .column-commentmeta_meta_value{
418
- font-size: 12px !important;
 
419
  }
420
- .column-dash_feed_option_id{
421
- width: 10%;
 
422
  }
423
- .column-dash_feed_autoload{
424
- width: 12%;
 
 
425
  }
426
 
427
- /* To hide tfoot from tables used in the plugin */
428
- .widefat tfoot {
429
- display: none;
 
 
 
 
 
430
  }
431
- /* To add a space between pagination and the head of tables */
432
- .tablenav {
433
- margin: 8px 0 12px !important;
 
 
434
  }
435
- /* To color rows of tables in white */
436
- .alternate, .striped > tbody > *:nth-child(2n), ul.striped > *:nth-child(2n) {
437
- background-color: #fff;
 
 
438
  }
439
- .alternate, .striped > tbody > *:nth-child(2n+1), ul.striped > *:nth-child(2n+1) {
440
- background-color: #fefefe;
 
 
 
 
 
 
 
 
 
 
 
441
  }
442
- /* For paginations of tables */
443
- .tablenav-pages-navspan {
444
- border-radius: 5px;
445
- -moz-border-radius: 5px;
446
- -webkit-border-radius: 5px;
447
  }
448
- .tablenav .tablenav-pages a, .tablenav-pages-navspan {
449
- border-radius: 5px;
450
- -moz-border-radius: 5px;
451
- -webkit-border-radius: 5px;
 
452
  }
453
- .tablenav-pages .current-page {
454
- border-radius: 5px;
455
- -moz-border-radius: 5px;
456
- -webkit-border-radius: 5px;
 
 
 
 
 
 
 
 
 
 
 
457
  }
458
- .displaying-num{
459
- /*display: none !important;*/
 
 
 
 
460
  }
461
- /* For tabs */
462
- h2.nav-tab-wrapper {
463
- border-bottom: 0px !important;
464
- padding-bottom: 0 !important;
465
- padding-left: 0px !important;
466
- }
467
- h2 .nav-tab {
468
- font-size: 13px;
469
- line-height: 20px;
470
- font-weight: normal;
471
- padding: 10px 10px !important;
472
- border-radius: 5px 5px 0 0;
473
- -moz-border-radius: 5px 5px 0 0;
474
- -webkit-border-radius: 5px 5px 0 0;
475
  }
476
- .nav-tab-active, .nav-tab-active:hover {
477
- background: #fff;
478
- font-weight: bold !important;
479
- border-bottom: 0px;
480
- color: #000;
481
- border-top: 2px solid #1a9ac9;
482
- color: #0073aa;
483
-
484
  }
485
- /*---------------------------------------------------------------------------------------------
486
- *
487
- * Tabs
488
- *
489
- *---------------------------------------------------------------------------------------------*/
490
- .aDBc-tab-box {
491
- float: left;
492
- width: 100%;
493
  }
494
- .aDBc-tab-box-div {
495
- min-height: 400px;
496
- background: #fff;
497
- border: 1px solid #ccc;
498
- padding: 40px 20px 20px 20px;
499
- border-radius: 0 5px 5px 5px;
500
- -moz-border-radius: 0 5px 5px 5px;
501
- -webkit-border-radius: 0 5px 5px 5px;
502
  }
503
 
504
- /*---------------------------------------------------------------------------------------------
505
- *
506
- * Sidebar
507
- *
508
- *---------------------------------------------------------------------------------------------*/
509
- .aDBc-sidebar {
510
  float: right;
511
- /*border: 1px solid #ccc;*/
512
- /*background: #fff;*/
513
- margin-right: -260px;
514
- margin-top: 42px;
515
- width: 240px;
516
- border-radius: 2px;
517
- -moz-border-radius: 2px;
518
- -webkit-border-radius: 2px;
519
  }
520
- .aDBc-sidebar > div{
521
- /*padding: 15px;*/
 
 
 
 
522
  }
523
- .aDBc-sidebar h2{
524
- font-size: 16px;
525
- text-align: center;
526
- color: #888;
527
- line-height: 24px;
 
528
  }
529
- .aDBc-grey-row{
530
- height: 20px;
531
- background-color: #f9f9f9;
 
 
 
 
 
 
 
 
 
 
532
  }
533
- .aDBc-white-row{
534
- height: 20px;
 
 
 
535
  }
536
- .aDBc-row-text{
537
- font-size: 13px;
538
- color: #555;
 
539
  }
540
- .aDBc-sidebar-link{
541
- text-decoration: none;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
542
  }
543
- /*.aDBc-support-us{
544
- background: url("../images/rate.png") no-repeat center right;
545
- width: 88px;
546
- height: 18px;
547
- margin-top: 0px;
548
- }*/
549
-
550
- #aDBc-upgrade { background-color: #23282d; padding: 15px; }
551
- #aDBc-upgrade h1 { font-size: 22px; font-weight: bold; color: #fff; text-align: center; }
552
- #aDBc-upgrade ul { font-size: 14px; margin-left: 30px; }
553
- #aDBc-upgrade a { display: block; width: 100%; height: 100%; text-decoration: none; color: #fff; }
554
- #aDBc-upgrade img { width: 110px; height: auto; display: block; margin: 0 auto; }
555
- #aDBc-upgrade ul li { margin: 5px 0 10px 0; }
556
- #aDBc-upgrade ul li span { margin-left: -31px; font-size: 26px; margin-right: 6px; }
557
-
558
- #aDBc-upgrade-form { background-color: #fff; padding: 20px; }
559
- #aDBc-upgrade-form h1 { margin-top: 0; padding: 0; font-weight: bold; color: #444; }
560
- #aDBc-upgrade-form input[type="text"], input[type="email"] { width: 90%; margin-bottom: 10px; }
561
- #aDBc-upgrade-form .aDBc_submit_name { color: #666; }
562
- #aDBc-upgrade-form .aDBc_unsubscribe { color: #a5a5a5; }
563
 
564
  /*---------------------------------------------------------------------------------------------
565
- *
566
- * Box messages
567
- *
568
  *---------------------------------------------------------------------------------------------*/
569
- .aDBc-box-warning-orphan {
570
- background: #fff5cc url("../images/alert.svg") no-repeat scroll 8px 50%;
571
- /*border-bottom: 1px dashed orange;*/
572
- color: #404040;
573
- padding: 10px 10px 10px 40px;
574
- margin-top: 10px;
575
- margin-bottom: 25px;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
576
  }
577
- .aDBc-box-warning {
578
- background: #fff5cc url("../images/alert_delete.svg") no-repeat scroll 8px 50%;
579
- /*border-bottom: 1px dashed orange;*/
580
- color: #404040;
581
- padding: 10px 10px 10px 70px;
582
- margin-top: 10px;
583
- margin-bottom: 25px;
584
  }
585
- .aDBc-box-info {
586
- background: #f0f5fa url("../images/info.svg") no-repeat scroll 8px 50%;
587
- /*border-bottom: 1px dashed #ccc;*/
588
- color: #404040;
589
- padding: 10px 10px 10px 40px;
590
- margin-top: 10px;
591
- margin-bottom: 25px;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
592
  }
593
- .aDBc-right-box{
594
- float: left;
595
- width: 190px;
596
- margin-bottom: 5px;
597
- margin-top: 49px;
598
- font-size: 12px;
599
- color: #888;
600
  }
601
- .aDBc-right-box > div{
602
- padding: 20px 10px;
 
 
 
 
 
 
 
 
 
 
603
  width: 100%;
604
- border: 1px solid #eee;
605
- background: #f9f9f9;
606
- border-radius: 1px;
607
- -moz-border-radius: 1px;
608
- -webkit-border-radius: 1px;
609
  }
610
- .aDBc-jquery-dialog{
611
- padding:20px;
612
- display:none;
 
 
 
 
 
 
 
 
 
 
 
613
  }
614
 
615
  /*---------------------------------------------------------------------------------------------
616
- *
617
- * Tool tip for content
618
- *
619
  *---------------------------------------------------------------------------------------------*/
620
- span.aDBc-tooltips {
621
- position: relative;
622
- display: inline;
623
- cursor: pointer;
624
- color: #000;
625
- border-bottom:1px dotted orange;
626
-
627
- }
628
- span.aDBc-tooltips span {
629
- position: absolute;
630
- color: #666666;
631
- background: #FFFFE0;
632
- font-size: 13px;
633
- font-weight: normal;
634
- padding: 10px;
635
- visibility: hidden;
636
- width: 300px;
637
- border: 1px solid #006799;
638
- border-radius: 4px;
639
- -moz-border-radius: 4px;
640
- -webkit-border-radius: 4px;
641
- }
642
- span.aDBc-tooltips span:after {
643
- content: '';
644
- position: absolute;
645
- top: 18px;
646
- right: 100%;
647
- margin-top: -8px;
648
- width: 0;
649
- height: 0;
650
- border-right: 8px solid #006799;
651
- border-top: 8px solid transparent;
652
- border-bottom: 8px solid transparent;
653
- }
654
- span:hover.aDBc-tooltips span {
655
- visibility: visible;
656
- left: 100%;
657
- top: 50%;
658
- margin-top: -15.5px;
659
- margin-left: 5px;
660
- z-index: 999;
661
- }
662
 
663
- /*---------------------------------------------------------------------------------------------
664
- *
665
- * Tool tip for headers info
666
- *
667
- *---------------------------------------------------------------------------------------------*/
668
- span.aDBc-tooltips-headers {
669
- position: relative;
670
- display: inline;
671
- cursor: pointer;
672
- color: #000;
673
- }
674
- span.aDBc-tooltips-headers span {
675
- position: absolute;
676
- text-align: left;
677
- line-height: 22px;
678
- color: #fff;
679
- background: #222;
680
- opacity: 1 !important;
681
- font-size: 13px;
682
- font-weight: normal;
683
- padding: 10px;
684
- visibility: hidden;
685
- width: 240px;
686
- border: 1px solid #222;
687
- border-radius: 4px;
688
- -moz-border-radius: 4px;
689
- -webkit-border-radius: 4px;
690
  }
691
- span.aDBc-tooltips-headers span:after {
692
- content: '';
693
- position: absolute;
694
- top: 18px;
695
- right: 100%;
696
- margin-top: -8px;
697
- width: 0;
698
- height: 0;
699
- border-right: 8px solid #222;
700
- border-top: 8px solid transparent;
701
- border-bottom: 8px solid transparent;
702
  }
703
- span:hover.aDBc-tooltips-headers span {
704
- visibility: visible;
705
- left: 100%;
706
- top: 50%;
707
- margin-top: -15.5px;
708
- margin-left: 8px;
709
- z-index: 999;
710
  }
711
- .aDBc-info-image {
712
- width: 15px;
713
- vertical-align: middle;
714
- margin-left: 2px;
 
 
 
 
 
715
  }
716
 
717
- /*---------------------------------------------------------------------------------------------
718
- *
719
- * Premium page style
720
- *
721
- *---------------------------------------------------------------------------------------------*/
722
- .aDBc-please-activate-msg{
723
- border-left: 5px solid orange !important;
724
- background: #fff;
725
- padding: 1px 20px;
726
  }
727
- .aDBc-vertical-box{
728
- float: left;
729
- background: #f9f9f9;
730
- width: 28%;
731
- margin:5px 15px;
732
- min-height: 350px;
733
  }
734
- .aDBc-vertical-box > a{
735
- text-decoration: none;
 
 
 
736
  }
737
 
738
  /*---------------------------------------------------------------------------------------------
739
- *
740
- * Overview & settings page
741
- *
742
  *---------------------------------------------------------------------------------------------*/
743
- .aDBc-overview-box{
 
744
  float: left;
745
  margin: 15px 20px 20px 10px;
746
  width: 45%;
747
  background: #fff;
748
  }
749
- .aDBc-overview-box-head{
750
- text-align: center;
751
- color: #fff;
752
- font-size: 14px;
753
- font-weight: bold;
754
- padding: 7px 0px;
755
- background: #69ADE2;
756
- border: 1px solid #e1e1e1;
757
- margin-bottom: 20px;
758
  }
759
- .aDBc-overview-box-line{
760
- margin-left: 15px;
 
 
 
 
 
 
 
761
  }
762
- .aDBc-overview-box-line > li{
763
- line-height: 32px;
 
764
  margin-bottom: 20px;
765
  padding: 0px 10px;
 
766
  }
767
- .aDBc-overview-text-left{
768
- float: left;
769
- background: url("../images/check_ok.svg") no-repeat left center;
770
- padding-left: 30px;
771
- width: 180px;
772
- }
773
- .aDBc-overview-text-left-warning{
774
  float: left;
775
- background: url("../images/alert.svg") no-repeat left center;
776
- padding-left: 30px;
777
- width: 180px;
778
  }
779
- .aDBc-overview-text-right{
780
- float: left;
 
 
781
  }
782
- .aDBc-overview-setting-desc{
 
783
  padding-left: 24px;
784
  color: #999;
785
  line-height: 20px;
786
  }
787
- .aDBc-save-settings-button{
788
- margin-left: 18px !important;
 
 
 
 
 
 
 
789
  height: 30px !important;
790
  padding: 1px 20px !important;
791
  margin-top: 10px !important;
792
  }
793
 
794
- .aDBc_info_icon {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
795
  margin-right: 8px;
796
- vertical-align: middle;
797
- padding-right:14px;
798
- background: url("../images/information.svg") no-repeat left center;
799
  }
800
 
801
- .aDBc_info_titles {
802
- vertical-align: middle;
803
- background: url("../images/information2.svg") no-repeat left center;
804
- padding:0px 5px;
805
- vertical-align: middle;
806
- margin-left: 4px;
807
  }
808
 
809
- .aDBc_keep_button {
810
- width: 35px;
811
- padding: 0px !important;
812
- font-size: 12px !important;
813
- height: 25px !important;
814
  }
815
 
816
- .aDBc_keep_input {
817
- width: 35px;
 
818
  font-size: 13px;
819
- height: 28px;
820
- border: 1px solid #e5e5e5;
821
- text-align: center;
822
- border-radius: 2px;
823
- -moz-border-radius: 2px;
824
- -webkit-border-radius: 2px;
825
- box-shadow:0 0 10px #f1f1f1;
826
- display: none;
827
  }
828
 
829
- .aDBc_keep_link{
830
- cursor: pointer;
 
 
831
  }
832
 
833
- .aDBc_keep_cancel_link {
834
- font-size: 12px;
835
- cursor: pointer;
836
- display: none;
 
 
 
 
 
 
837
  }
838
 
839
- /* Progress bar */
840
- #aDBc_progress_container{
841
- margin-top: 5px;
842
- display: none;
843
- }
844
- .aDBc_progress-bar {
845
- float: left;
846
- width: 0;
847
- height: 100%;
848
- font-size: 12px;
849
- line-height: 20px;
850
- color: #fff;
851
- text-align: center;
852
- background-color: #337ab7;
853
- -webkit-transition: width 1s ease;
854
- -o-transition: width 1s ease;
855
- transition: width 1s ease;
856
  }
857
 
858
  /*---------------------------------------------------------------------------------------------
859
- *
860
  * Premium page style
861
- *
862
  *---------------------------------------------------------------------------------------------*/
863
- .aDBc-upgrade-msg{
864
- border-left: 6px solid #D091BE !important;
865
- background: #FFFFD4;
866
- padding: 1px 8px;
867
- margin-bottom: 20px;
868
- }
869
- .aDBc-check-list{
870
- background: url("../images/check_ok.svg") no-repeat;
871
- padding-left: 20px;
872
- margin-left: 20px;
873
- }
874
- .aDBc-vertical-box{
875
  float: left;
876
  background: #f9f9f9;
877
  width: 28%;
878
  margin:5px 15px;
879
  min-height: 350px;
880
  }
881
- .aDBc-vertical-box > a{
882
- text-decoration: none;
 
 
 
883
  }
884
- .aDBc-vertical-box-head{
 
885
  color: #fff;
886
  font-size: 15px;
887
  font-weight: bold;
@@ -890,37 +1238,263 @@ span:hover.aDBc-tooltips-headers span {
890
  background: #69ADE2;
891
  border-radius: 8px;
892
  }
893
- .aDBc-vertical-box-line1{
 
894
  text-align: center;
895
  margin-top: 20px;
896
  }
897
- .aDBc-vertical-box-line2{
 
898
  text-align: center;
899
  margin-top: 50px;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
900
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
901
  /*---------------------------------------------------------------------------------------------
902
  * Tooltip for upgrade to premium
903
  *---------------------------------------------------------------------------------------------*/
904
- .aDBc_premium_tooltip {
905
- position: relative;
906
- display: inline-block;
907
- }
908
-
909
- .aDBc_premium_tooltip .aDBc_premium_tooltiptext {
910
- visibility: hidden;
911
- background-color: #fff;
912
- text-align: center;
913
- color: #444;
914
- padding: 6px 0;
915
- border: 1px solid orange;
916
- top: 100%;
917
- left: 50%;
918
- margin-left: -72px;
919
- /* Position the tooltip */
920
- position: absolute;
921
- z-index: 1;
922
- }
923
-
924
- .aDBc_premium_tooltip:hover .aDBc_premium_tooltiptext {
925
  visibility: visible;
926
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ html {
3
+ overflow-y: scroll;
4
+ }
5
+
6
+ input:disabled {
7
+ background-color: #0085ba;
8
+ border-color: rgba(222,222,222,.75);
9
+ box-shadow: inset 0 1px 2px rgba(0,0,0,.04);
10
+ color: #e9e9e9;
11
+ cursor: default;
12
+ }
13
+
14
+ .aDBc-content-max-width {max-width: 960px}
15
+
16
+ .aDBc-link {text-decoration: none}
17
+
18
+ .aDBc-clear-both {clear: both}
19
+
20
+ .aDBc-float-left {float: left}
21
+
22
+ .aDBc-float-right {float: right}
23
+
24
+ .aDBc-vertical-align-m {vertical-align: middle !important}
25
+
26
+ .aDBc-margin-t-10 {margin-top: 10px}
27
+
28
+ .aDBc-margin-t-20 {margin-top: 20px}
29
+
30
+ .aDBc-margin-t-30 {margin-top: 30px}
31
+
32
+ .aDBc-padding-20 {padding: 20px}
33
+
34
+ .aDBc-font-13 {font-size: 13px}
35
+
36
+ .aDBc-bold {font-weight: bold}
37
+
38
+ .aDBc-please-activate-msg {
39
+ border-left: 5px solid orange !important;
40
+ background: #fff;
41
+ padding: 1px 20px;
42
+ }
43
+
44
  /*---------------------------------------------------------------------------------------------
45
+ * Header
 
 
46
  *---------------------------------------------------------------------------------------------*/
47
+
48
+ .aDBc-header-wrap {
49
+ margin-bottom: 25px;
50
+ background: #fff;
51
+ border: 1px solid #e5e5e5;
52
+ border-radius: 6px;
53
+ min-height: 55px;
54
+ padding: 25px 20px;
55
+ }
56
+
57
+ .aDBc-header-logo {
58
+ float: left;
59
+ margin: 0px 20px 0px 0px;
60
+ width: 50px;
61
+ }
62
+
63
+ @media screen and (max-width: 375px) {
64
+ .aDBc-header-logo {display: none}
65
+ }
66
+
67
+ .aDBc-header-help-svg {width: 40px}
68
+
69
+ .aDBc-header-title {
70
+ font-size: 20px;
71
+ font-weight: 400;
72
+ margin-bottom: 6px;
73
+ }
74
+
75
+ @media screen and (max-width: 470px) {
76
+ .aDBc-header-title {font-size: 15px}
77
+ }
78
+
79
+ .aDBc-header-meta {
80
+ border-top: 1px dashed #eee;
81
+ padding-top: 3px;
82
+ }
83
+
84
+ .aDBc-header-need-help-ss {display: none}
85
+
86
+ @media screen and (max-width: 420px) {
87
+ .aDBc-header-need-help-ss {display: inline}
88
+ .aDBc-header-need-help-ls {display: none}
89
+ }
90
+
91
+ .aDBc-header-by {margin-right: 5px}
92
+
93
+ .aDBc-header-by span {
94
+ color: #555;
95
+ }
96
+
97
+ .aDBc-header-need-help-ls, .aDBc-header-need-help-ss {margin-left: 5px}
98
+
99
+ .aDBc-header-need-help-ls span {
100
+ color: #555;
101
+ }
102
+
103
+ .aDBc-header-support {
104
+ float: right;
105
+ text-align: center;
106
+ }
107
+
108
+ @media screen and (max-width: 540px) {
109
+ .aDBc-header-support {display: none}
110
  }
111
+
112
+ /*---------------------------------------------------------------------------------------------
113
+ * Premium lost message
114
+ *---------------------------------------------------------------------------------------------*/
115
+
116
+ .aDBc-premium-lost-msg {
117
  border-left: 5px solid orange !important;
118
  background: #fff !important;
119
  padding: 20px !important;
120
+ margin-bottom: 20px !important;
121
  }
122
+
123
+ .aDBc-premium-lost-msg > span {
124
  font-size: 17px;
125
  font-family: arial;
126
  color: orange;
127
  font-weight: bold;
128
  }
129
 
130
+ /*---------------------------------------------------------------------------------------------
131
+ * Tabs menus
132
+ *---------------------------------------------------------------------------------------------*/
133
+
134
+ .aDBc-tab-box {
135
+ float: left;
136
+ width: 100%;
 
 
 
 
 
137
  }
138
+
139
+ .aDBc-tab-box-div {
140
+ min-height: 400px;
141
+ background: #fff;
142
+ border: 1px solid #ccc;
143
+ padding: 40px 20px 20px 20px;
144
+ border-radius: 0 5px 5px 5px;
145
  }
146
+
147
+ /*---------------------------------------------------------------------------------------------
148
+ * Main content for all tabs
149
+ *---------------------------------------------------------------------------------------------*/
150
+
151
+ .aDBc-main-content {
152
+ margin-top: 10px;
153
+ margin-right: 260px;
154
  }
155
+
156
+ @media screen and (max-width: 1200px) {
157
+ .aDBc-main-content {
158
+ margin-right: 0px;
159
+ }
160
  }
161
+
162
+ /*---------------------------------------------------------------------------------------------
163
+ * "General cleanup", "Schedules" pages & "Tables" tabs sections
164
+ *---------------------------------------------------------------------------------------------*/
165
+
166
+ .aDBc-left-content {
167
  float: left;
168
+ max-width: 723px;
169
+ margin-right: 25px;
170
  }
171
+
172
+ @media screen and (max-width: 1200px) {
173
+ .aDBc-left-content {
174
+ max-width: 100%;
175
+ margin-right: 0px;
176
+ }
 
 
 
 
 
177
  }
178
+
179
+ .aDBc-right-box {
180
+ float: left;
181
+ width: 190px;
182
+ margin-bottom: 5px;
183
+ margin-top: 48px;
184
+ font-size: 12px;
185
+ color: #888;
 
 
 
 
 
 
 
 
186
  }
187
+
188
+ .aDBc-right-box-content {
189
+ padding: 20px 10px;
190
+ margin-bottom: 10px;
191
+ width: 100%;
192
+ border: 1px solid #eee;
193
+ background: #f9f9f9;
194
+ border-radius: 1px;
195
  }
196
+
197
+ /*---------------------------------------------------------------------------------------------
198
+ * "General cleanup" tab
199
+ *---------------------------------------------------------------------------------------------*/
200
+
201
+ .aDBc-keep-link {
202
+ cursor: pointer;
203
  }
204
+
205
+ .aDBc-keep-input {
206
+ width: 35px;
207
  font-size: 13px;
208
+ height: 28px;
209
+ border: 1px solid #e5e5e5;
210
+ text-align: center;
211
+ border-radius: 2px;
212
+ box-shadow: 0 0 10px #f1f1f1;
213
+ display: none;
214
  }
215
+
216
+ .aDBc-keep-button {
217
+ width: 35px;
218
+ padding: 0px !important;
219
+ font-size: 12px !important;
220
+ height: 25px !important;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
221
  }
222
 
223
+ .aDBc-keep-cancel-link {
224
+ font-size: 12px;
225
+ cursor: pointer;
226
+ display: none;
 
 
227
  }
228
+
229
+ .aDBc-scheduled-in-row {
230
+ background: #f1f5f5;
231
+ color: #000;
232
+ border-radius: 4px;
233
+ padding: 3px;
234
+ margin: 2px;
 
 
 
 
 
 
 
 
 
 
 
235
  }
236
+
237
+ .aDBc-info-icon {
238
+ margin-right: 8px;
239
+ vertical-align: middle;
240
+ padding-right: 14px;
241
+ background: url("../images/information.svg") no-repeat left center;
242
  }
243
+
244
+ /*---------------------------------------------------------------------------------------------
245
+ * Styles for the right box in "General cleanup" and "Tables" tabs
246
+ *---------------------------------------------------------------------------------------------*/
247
+
248
+ .aDBc-text-status-db {
249
  font-family: verdana;
250
  font-size: 12px;
251
  }
252
+
253
+ .aDBc-schedule-text {
254
  padding: 5px 0px 0px 0px;
255
  font-family: verdana;
256
  font-size: 12px;
257
+
258
  }
259
+
260
+ .aDBc-schedule-hook-box {
261
  background: #fff;
262
  margin-top: 20px;
 
263
  text-align: left;
264
  padding: 5px;
265
  border: 1px dashed #999;
266
  color: black;
267
  vertical-align: middle;
268
+ border: 1px solid #f1f1f1;
269
+ border-radius: 3px;
270
+ box-shadow: 0 0 10px #ccc;
271
  }
272
+
273
+ .aDBc-schedule-on-off {
274
  vertical-align: middle;
275
  width: 30px;
276
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
277
 
278
+ .aDBc-edit-delete-schedule {
279
+ border-radius: 4px;
280
+ font-size: 11px;
281
+ background: #f0f5fa;
282
+ padding: 2px 4px;
283
+ float: right;
284
+ margin-top: 4px;
285
  }
286
+
287
+ .aDBc-edit-schedule-link {
288
+ text-decoration: none;
289
+ margin-right: 3px;
290
  }
291
+
292
+ .aDBc-delete-schedule-link {
293
+ float: right;
294
+ margin-left: 3px;
 
295
  }
296
 
297
+ .aDBc-submit-link {
298
  background: none !important;
299
  border: none !important;
300
  text-decoration: none !important;
304
  color: #0073aa;
305
  }
306
 
307
+ .aDBc-add-new-schedule {
308
+ text-align: center !important;
309
+ margin-top: 20px !important;
310
+ width: 100% !important;
311
+ }
312
+
313
+ /*---------------------------------------------------------------------------------------------
314
+ * Styles for custom cleanup pages in "general cleanup"
315
+ *---------------------------------------------------------------------------------------------*/
316
+
317
+ .aDBc-custom-clean-text {
318
  float: right;
319
+ font-size: 15px;
320
+ margin-top: 10px;
321
+ margin-bottom: 30px;
322
+ color: #0992CC;
323
+ border-radius: 5px;
324
  }
325
 
326
+ .aDBc-custom-total {
327
+ background: #ffe4b5;
328
+ border-radius: 6px;
329
+ padding: 1px 6px;
330
+ }
331
 
332
  /*---------------------------------------------------------------------------------------------
333
+ * Custom schedule page view (add/edit)
 
 
334
  *---------------------------------------------------------------------------------------------*/
335
+
336
+ .aDBc-schedule-title {
337
+ float: right;
338
+ border: 1px solid #f0f0f0;
339
+ box-shadow: 0 0 10px #eee;
340
+ border-radius: 5px;
341
+ text-align: center;
342
+ width: 195px;
343
+ background: #fff;
344
+ padding: 10px;
345
+ font-size: 16px;
346
+ margin-top: 15px;
347
+ margin-bottom: 25px;
348
+ color: #0992CC;
349
  }
350
+
351
+ @media screen and (max-width: 450px) {
352
+ .aDBc-schedule-title {
353
+ clear: both;
354
+ float: left;
355
+ }
356
  }
357
+
358
+ .aDBc-schedule-dashicon {
359
+ color: #00C6FF !important;
360
+ margin-right: 6px !important;
361
  }
362
+
363
+ .aDBc-back-dashicon {
364
+ font-size: 30px !important;
365
+ margin-right: 14px !important;
366
+ margin-top: -1px !important;
367
+ color: #48BDF3 !important;
368
  }
369
+
370
+ .aDBc-schedule-table-elements {
371
+ float: left;
372
+ max-width: 460px;
373
+ margin-right: 25px;
374
+ margin-top: 8px;
375
  }
376
+
377
+ .aDBc-schedule-tables-box-info {
378
+ margin-top: 49px;
379
+ background: #f0f5fa;
380
+ line-height: 22px;
381
+ border-radius: 4px;
382
+ border: 0px solid #eee;
383
  }
384
+
385
+ /* hide number of items */
386
+ .aDBc-schedule-table-elements .tablenav .one-page .displaying-num {
387
+ display: none !important;
388
  }
389
+
390
+ .aDBc-schedule-info-container {
391
+ border-top: 1px dashed #ccc;
392
+ margin-top: 20px;
393
  }
394
+
395
+ .aDBc-schedule-input-field {
396
+ width: 100%;
397
+ margin-top: 6px;
398
+ margin-bottom: 15px;
399
+ height: 30px;
400
+ border-radius: 5px;
401
+ box-shadow: 0 0 10px #e0e0e0;
402
  }
403
+
404
+ .aDBc-schedule-input-field:disabled {
405
+ background-color: #e9e9e9 !important;
406
+ color: #000 !important;
407
  }
408
+
409
+ .aDBc-schedule-radio-container {
410
+ margin-top: 6px;
411
+ margin-bottom: 15px;
412
+ text-align: left;
413
+ background: #fff;
414
+ padding: 5px;
415
+ box-shadow: 0 0 10px #e0e0e0;
416
+ border-radius: 5px;
 
 
 
 
 
417
  }
418
+
419
+ .aDBc-schedule-save-btn-div {
420
+ width: 100%;
421
+ margin-top: 20px;
422
  }
423
+
424
+ /*---------------------------------------------------------------------------------------------
425
+ * Tables tab
426
+ *---------------------------------------------------------------------------------------------*/
427
+
428
+ .aDBc-lost-space {
429
+ color: red;
430
+ font-size: 12px;
431
+ font-weight: 500;
432
  }
433
 
434
+ .aDBc-corrupted {
435
+ color: red;
436
+ font-size: 12px;
437
+ font-weight: 500;
438
  }
439
 
440
+ .aDBc-to-repair-section {
441
+ padding-top: 10px;
442
+ margin-top: 10px;
443
+ border-top: 1px dashed grey;
444
  }
445
+
446
+ /*---------------------------------------------------------------------------------------------
447
+ * Cron jobs (tasks) tab
448
+ *---------------------------------------------------------------------------------------------*/
449
+
450
+ .aDBc-arguments {
451
+ background: #f5f5f5;
452
+ padding: 2px;
453
+ border-radius: 4px;
454
+ border: 1px solid #e1e1e1;
455
  }
456
 
457
+ /*---------------------------------------------------------------------------------------------
458
+ * Box messages for tabls, options & tasks
459
+ *---------------------------------------------------------------------------------------------*/
460
+
461
+ .aDBc-box-warning-orphan {
462
+ background: #fff5cc url("../images/alert.svg") no-repeat scroll 8px 50%;
463
+ color: #404040;
464
+ padding: 10px 10px 10px 40px;
465
+ margin-top: 10px;
466
+ margin-bottom: 25px;
467
  }
468
 
469
+ .aDBc-box-info {
470
+ background: #f0f5fa url("../images/info.svg") no-repeat scroll 8px 50%;
471
+ color: #404040;
472
+ padding: 10px 10px 10px 40px;
473
+ margin-top: 10px;
474
+ margin-bottom: 25px;
475
  }
476
+
477
+ /*---------------------------------------------------------------------------------------------
478
+ * Override WordPress styles
479
+ *---------------------------------------------------------------------------------------------*/
480
+
481
+ /* For plugin main tabs */
482
+
483
+ .nav-tab-wrapper {
484
+ border-bottom: 0px !important;
485
+ padding: 0 !important;
486
  }
487
+
488
+ .nav-tab {
489
+ font-size: 13px !important;
490
+ line-height: 20px !important;
491
+ font-weight: normal !important;
492
+ padding: 10px 10px !important;
493
+ border-radius: 5px 5px 0 0 !important;
494
  }
495
 
496
+ @media screen and (max-width: 800px) {
497
+ .nav-tab {
498
+ margin-top: 5px !important;
499
+ }
500
  }
501
+
502
+ .nav-tab-active, .nav-tab-active:hover {
503
+ background: #fff !important;
504
+ font-weight: bold !important;
505
+ border-bottom: 0px !important;
506
+ color: #000 !important;
507
+ border-top: 2px solid #1a9ac9 !important;
508
+ color: #0073aa !important;
509
  }
510
+
511
+ /* For WP tables */
512
+
513
+ .widefat {
514
+ border-spacing: 1px !important;
515
+ border: 1px solid #e5e5e5 !important;
516
+ border-radius: 2px !important;
517
  }
518
+
519
+ .widefat > thead {
520
+ background: #f3f3f3 !important;
521
  }
522
+
523
+ .widefat thead td.check-column {
524
+ padding: 10px 3px 5px 3px !important;
525
+ border-bottom: 1px solid #e5e5e5 !important;
526
  }
527
 
528
+ @media screen and (max-width: 782px) {
529
+ .widefat thead td.check-column {
530
+ padding: 6px 1px 5px 4px !important;
531
+ }
532
  }
533
+
534
+ .widefat thead tr th {
535
+ color: #555 !important;
536
+ border-bottom: 1px solid #e5e5e5 !important;
537
  }
538
+
539
+ .widefat th {
540
+ font-weight: bold !important;
541
+ font-size: 13px !important;
542
  }
543
+
544
+ .widefat td, .widefat th {
545
+ border-bottom: 1px solid #f1f1f1 !important;
546
+ border-right: 1px solid #f1f1f1 !important;
547
+ overflow: visible !important;
548
  }
549
+
550
+ .widefat > tbody > tr:hover {
551
+ background-color: #f2f2f2 !important;
552
  }
553
+
554
+ .widefat tbody th.check-column {
555
+ padding: 10px 3px 5px 3px !important;
556
  }
557
+
558
+ @media screen and (max-width: 782px) {
559
+ .widefat tbody th.check-column {
560
+ padding: 4px 1px 4px 4px !important;
561
+ }
562
  }
563
+
564
+ @media screen and (max-width: 782px) {
565
+ .widefat th input, .widefat thead td input {
566
+ margin: 1px 0 0 1px !important;
567
+ }
568
  }
569
+
570
+ .widefat tfoot {
571
+ display: none !important;
572
  }
573
+
574
+ /* To color rows of tables in white */
575
+
576
+ .alternate, .striped > tbody > *:nth-child(2n), ul.striped > *:nth-child(2n) {
577
+ background-color: #fff !important;
578
  }
579
+ .alternate, .striped > tbody > *:nth-child(2n+1), ul.striped > *:nth-child(2n+1) {
580
+ background-color: #fff !important;
581
  }
582
+
583
+ /* For paginations of tables */
584
+
585
+ .tablenav-pages-navspan {
586
+ border-radius: 4px !important;
587
  }
588
+
589
+ .tablenav .tablenav-pages a, .tablenav-pages-navspan {
590
+ border-radius: 4px !important;
591
  }
592
+
593
+ .tablenav-pages .current-page {
594
+ border-radius: 4px !important;
 
595
  }
596
+
597
+ /* Override slyes by WP_List_Table class for columns */
598
+
599
+ /* "General cleanup" tab columns */
600
+
601
+ .column-element_to_clean {
602
+ width: 41%;
603
  }
604
+
605
+ .column-count {
606
+ width: 12%;
607
  text-align: center !important;
608
  }
609
+
610
+ .column-view {
611
+ width: 12%;
612
  text-align: center !important;
613
  }
614
+
615
+ .column-scheduled {
616
+ width: 15%;
617
  text-align: center !important;
618
  }
619
+
620
+ .column-keep {
621
+ width: 20%;
622
  border-right: 0 none !important;
 
623
  text-align: center !important;
624
  }
625
+
626
+ /* Custom cleanup columns for : revisions, auto-drafts and trash posts */
627
+
628
+ .column-post_id {width: 10%}
629
+
630
+ .column-post_title {width: 34%}
631
+
632
+ .column-post_content {width: 34%}
633
+
634
+ .column-post_date {width: 22%}
635
+
636
+ /* Custom cleanup columns for : Pending comments, Spam Comments, Trash comments, Pingbacks and Trackbacks */
637
+
638
+ .column-comment_id {width: 10%}
639
+
640
+ .column-comment_author {width: 30%}
641
+
642
+ .column-comment_content {width: 38%}
643
+
644
+ .column-comment_date {width: 22%}
645
+
646
+ /* Custom cleanup columns for : Orphaned post meta, Orphaned comment meta, Orphaned user meta, Orphaned term meta */
647
+
648
+ .column-meta_id {width: 20%}
649
+
650
+ .column-meta_key {width: 40%}
651
+
652
+ .column-meta_value {width: 40%}
653
+
654
+ /* Custom cleanup columns for : Orphaned relationships */
655
+
656
+ .column-object_id {width: 20%}
657
+
658
+ .column-term_taxonomy_id {width: 40%}
659
+
660
+ .column-term_order {width: 40%}
661
+
662
+ /* Custom cleanup columns for : Transients */
663
+
664
+ .column-transient_id {width: 12%}
665
+
666
+ .column-transient_name {width: 30%}
667
+
668
+ .column-transient_content {width: 25%}
669
+
670
+ .column-transient_timeout {width: 20%}
671
+
672
+ .column-transient_autoload {width: 13%}
673
+
674
+ /* "Tables" tab columns */
675
+
676
+ .column-table_name {width: 44%}
677
+
678
+ .column-table_rows {width: 14%}
679
+
680
+ .column-table_size {
681
+ width: 14%;
682
+ font-size: 12px !important;
683
  }
684
+
685
+ .column-table_belongs_to {width: 28%}
686
+
687
+ /* "Options" tab columns */
688
+
689
+ .column-option_name {width: 31%}
690
+
691
+ .column-option_value {width: 22%}
692
+
693
+ .column-option_size {width: 10%}
694
+
695
+ .column-option_autoload {width: 12%}
696
+
697
+ .column-option_belongs_to {width: 25%}
698
+
699
+ /* "Tasks" tab columns */
700
+
701
+ .column-hook_name {width: 27%}
702
+
703
+ .column-arguments {width: 20%}
704
+
705
+ .column-next_run {
706
+ width: 30%;
707
+ font-size: 12px !important;
708
  }
709
+
710
+ .column-hook_belongs_to {width: 23%}
711
+
712
+ /* MU site_id column */
713
+
714
+ .column-site_id {width: 60px}
715
+
716
+ /*---------------------------------------------------------------------------------------------
717
+ * Items categories counts css for "tables", "options" and "tasks" tabs
718
+ *---------------------------------------------------------------------------------------------*/
719
+
720
+ .aDBc-category-counts {
721
+ float: right;
722
+ background: #f5f5f5;
723
+ padding: 8px;
724
+ border: 1px solid #eee;
725
+ text-align: left;
726
+ border-radius: 4px;
727
  }
728
+
729
+ @media screen and (max-width: 830px) {
730
+ .aDBc-category-counts {
731
+ clear: both;
732
+ float: left;
733
+ margin-top: 20px;
734
+ }
735
  }
736
+
737
+ .aDBc-category-counts-links {
738
+ text-decoration: none !important;
739
  }
740
+
741
+ .aDBc-category-counts-links:hover {
742
+ border-bottom: 1px dashed #999;
743
  }
744
+
745
+ .aDBc-selected-category {
746
+ font-weight: bold;
747
+ font-size: 13px;
748
  }
749
 
750
+ .aDBc-category-total {
751
+ background: #fff;
752
+ border: 1px solid #eee;
753
+ color: #fff;
754
+ padding: 1px 5px;
755
+ margin-top: 8px;
756
+ border-radius: 4px;
757
+ min-width: 50px;
758
  }
759
+
760
+ .aDBc-category-span {
761
+ text-align: center;
762
+ margin-left: 6px;
763
+ margin-right: 6px;
764
  }
765
+
766
+ @media screen and (max-width: 830px) {
767
+ .aDBc-category-span {
768
+ margin-bottom: 20px;
769
+ }
770
  }
771
+
772
+ /*---------------------------------------------------------------------------------------------
773
+ * Filter section
774
+ *---------------------------------------------------------------------------------------------*/
775
+
776
+ .aDBc-filter-container {
777
+ float: right;
778
+ margin-top: 30px;
779
+ margin-bottom: 30px;
780
+ width: 100%;
781
+ background: #f7f7f7;
782
+ border: 1px solid #f2f2f2;
783
+ border-radius: 2px;
784
  }
785
+
786
+ .aDBc-filter-section {
787
+ float: left;
788
+ padding: 12px 12px;
 
789
  }
790
+
791
+ @media screen and (max-width: 820px) {
792
+ .aDBc-filter-section {
793
+ clear: both;
794
+ }
795
  }
796
+
797
+ .aDBc-filter-search-input {
798
+ float: left;
799
+ line-height: 2 !important;
800
+ font-size: 13px !important;
801
+ width: 130px !important;
802
+ min-height: 30px !important;
803
+ height: 30px !important;
804
+ margin-right: 4px;
805
+ padding-top: 1px !important;
806
+ padding-left: 6px !important;
807
+ margin-top: 0px !important;
808
+ border: 1px solid #ccc !important;
809
+ border-radius: 4px !important;
810
+ box-shadow: none !important;
811
  }
812
+
813
+ @media screen and (max-width: 500px) {
814
+ .aDBc-filter-search-input {
815
+ width: 100% !important;
816
+ margin-right: 0px;
817
+ }
818
  }
819
+
820
+ .aDBc-filter-dropdown-menu {
821
+ line-height: 2 !important;
822
+ font-size: 13px !important;
823
+ min-height: 30px !important;
824
+ height: 30px !important;
825
+ margin-top: 0px !important;
826
+ margin-left: 0px !important;
827
+ padding-top: 1px !important;
828
+ padding-left: 6px !important;
829
+ border: 1px solid #ccc !important;
830
+ border-radius: 4px !important;
831
+ box-shadow: none !important;
 
832
  }
833
+
834
+ @media screen and (max-width: 500px) {
835
+ .aDBc-filter-dropdown-menu {
836
+ width: 100% !important;
837
+ margin-top: 5px !important;
838
+ margin-left: 0px;
839
+ }
 
840
  }
841
+
842
+ .aDBc-filter-botton {
843
+ float: left;
844
+ height: 30px !important;
845
+ width: 50px !important;
846
+ margin-top: 0px !important;
 
 
847
  }
848
+
849
+ @media screen and (max-width: 500px) {
850
+ .aDBc-filter-botton {
851
+ clear: both;
852
+ margin-top: 5px !important;
853
+ }
 
 
854
  }
855
 
856
+ .aDBc-items-per-page {
 
 
 
 
 
857
  float: right;
858
+ padding: 12px 12px;
 
 
 
 
 
 
 
859
  }
860
+
861
+ @media screen and (max-width: 820px) {
862
+ .aDBc-items-per-page {
863
+ float: left;
864
+ clear: both;
865
+ }
866
  }
867
+
868
+ .aDBc-items-per-page-label {
869
+ float: left;
870
+ padding-top: 5px;
871
+ padding-right: 8px;
872
+ font-size: 13px;
873
  }
874
+
875
+ .aDBc-items-per-page-input {
876
+ float: left;
877
+ font-size: 13px !important;
878
+ width: 60px !important;
879
+ min-height: 30px !important;
880
+ height: 30px !important;
881
+ margin-right: 4px;
882
+ margin-top: 0px !important;
883
+ padding-left: 6px !important;
884
+ border: 1px solid #ccc !important;
885
+ border-radius: 4px !important;
886
+ box-shadow: none !important;
887
  }
888
+
889
+ .aDBc-show-botton {
890
+ float: left;
891
+ height: 30px !important;
892
+ margin-top: 0px !important;
893
  }
894
+
895
+ .aDBc-delete-custom-filter {
896
+ clear: both;
897
+ padding: 5px 0px 8px 14px;
898
  }
899
+
900
+ /* custom filter for custom cleanup */
901
+
902
+ .aDBc-custom-filter-radio-section {
903
+ float: left;
904
+ background: #fff;
905
+ padding: 6px;
906
+ margin-right: 6px;
907
+ border: 1px solid #eee;
908
+ border-radius: 4px;
909
+ box-shadow: 0 0 10px #f1f1f1;
910
+ }
911
+
912
+ @media screen and (max-width: 820px) {
913
+ .aDBc-custom-filter-radio-section {
914
+ padding: 4px;
915
+ }
916
+ }
917
+
918
+ /* In free, filter not available */
919
+
920
+ .aDBc-filter-pro-only {
921
+ pointer-events: none;
922
+ opacity: 0.5;
923
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
924
 
925
  /*---------------------------------------------------------------------------------------------
926
+ * Run search, double check
 
 
927
  *---------------------------------------------------------------------------------------------*/
928
+
929
+ .aDBc-run-new-search, .aDBc-run-new-search:disabled {
930
+ height: 34px !important;
931
+ min-width: 145px !important;
932
+ background-color: #0085ba;
933
+ background-image: url("../images/search-icon.svg");
934
+ background-repeat: no-repeat !important;
935
+ background-position: 8px 50% !important;
936
+ padding-left: 38px !important;
937
+ text-align: left;
938
+ border-color: #0073aa #006799 #006799;
939
+ box-shadow: 0 1px 0 #006799;
940
+ color: #fff;
941
+ text-shadow: 0 -1px 1px #006799, 1px 0 1px #006799, 0 1px 1px #006799, -1px 0 1px #006799;
942
+ display: inline-block;
943
+ text-decoration: none;
944
+ font-size: 13px;
945
+ line-height: 26px;
946
+ margin: 0;
947
+ cursor: pointer;
948
+ border-width: 1px;
949
+ border-style: solid;
950
+ -webkit-appearance: none;
951
+ border-radius: 3px;
952
+ white-space: nowrap;
953
+ box-sizing: border-box;
954
  }
955
+
956
+ .aDBc-run-new-search:hover {
957
+ background-color: #178DBD;
 
 
 
 
958
  }
959
+
960
+ .aDBc-double-check {
961
+ height: 34px !important;
962
+ min-width: 145px !important;
963
+ background-color: #0085ba;
964
+ background-image: url("../images/double_check.svg");
965
+ background-repeat: no-repeat !important;
966
+ background-position: 8px 50% !important;
967
+ padding-left: 38px !important;
968
+ text-align: left;
969
+ border-color: #0073aa #006799 #006799;
970
+ box-shadow: 0 1px 0 #006799;
971
+ color: #fff;
972
+ text-shadow: 0 -1px 1px #006799, 1px 0 1px #006799, 0 1px 1px #006799, -1px 0 1px #006799;
973
+ display: inline-block;
974
+ text-decoration: none;
975
+ font-size: 13px;
976
+ line-height: 26px;
977
+ margin: 0;
978
+ cursor: pointer;
979
+ border-width: 1px;
980
+ border-style: solid;
981
+ -webkit-appearance: none;
982
+ border-radius: 3px;
983
+ white-space: nowrap;
984
+ box-sizing: border-box;
985
  }
986
+
987
+ .aDBc-double-check:hover {
988
+ background-color: #178DBD;
 
 
 
 
989
  }
990
+
991
+ /*---------------------------------------------------------------------------------------------
992
+ * Scan progress bar
993
+ *---------------------------------------------------------------------------------------------*/
994
+
995
+ #aDBc-progress-container {
996
+ margin-top: 20px;
997
+ display: none;
998
+ }
999
+
1000
+ .aDBc-progress-background {
1001
+ background: #eee;
1002
  width: 100%;
1003
+ height: 25px;
1004
+ border-radius: 2px;
 
 
 
1005
  }
1006
+
1007
+ .aDBc-progress-bar {
1008
+ float: left;
1009
+ width: 0;
1010
+ height: 100%;
1011
+ font-size: 12px;
1012
+ line-height: 25px;
1013
+ color: #fff;
1014
+ text-align: center;
1015
+ background-color: #0570bc;
1016
+ -webkit-transition: width 1s ease;
1017
+ -o-transition: width 1s ease;
1018
+ transition: width 1s ease;
1019
+ border-radius: 2px;
1020
  }
1021
 
1022
  /*---------------------------------------------------------------------------------------------
1023
+ * Edit categorization
 
 
1024
  *---------------------------------------------------------------------------------------------*/
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1025
 
1026
+ .aDBc-edit-correction-title {
1027
+ text-align: center;
1028
+ margin-top: 10px;
1029
+ padding: 8px;
1030
+ background: #f0f5fa;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1031
  }
1032
+
1033
+ .aDBc-correction-item {
1034
+ float: left;
1035
+ background: #fff;
1036
+ border: 1px dashed #999;
1037
+ border-radius: 15px;
1038
+ padding: 6px;
1039
+ margin-right: 4px;
1040
+ margin-bottom: 4px;
1041
+ line-height:20px;
 
1042
  }
1043
+
1044
+ .aDBc-correction-new-wrapper {
1045
+ background: #ffa5002e;
1046
+ padding: 10px;
1047
+ margin-top: 30px;
 
 
1048
  }
1049
+
1050
+ .aDBc-correction-belongs-to {
1051
+ font-size: 14px;
1052
+ max-width: 250px;
1053
+ font-size: 14px !important;
1054
+ height: 30px;
1055
+ border: 1px solid #ccc;
1056
+ border-radius: 2px;
1057
+ margin-top: 10px;
1058
  }
1059
 
1060
+ @media screen and (max-width: 400px) {
1061
+ .aDBc-correction-belongs-to {
1062
+ max-width: 140px;
1063
+ }
 
 
 
 
 
1064
  }
1065
+
1066
+ .aDBc-correction-btns-div {
1067
+ margin-top: 60px;
1068
+ margin-bottom: 100px;
 
 
1069
  }
1070
+
1071
+ .aDBc-correction-btn {
1072
+ width: 80px !important;
1073
+ height: 30px !important;
1074
+ margin-right: 20px !important;
1075
  }
1076
 
1077
  /*---------------------------------------------------------------------------------------------
1078
+ * Overview & settings tab
 
 
1079
  *---------------------------------------------------------------------------------------------*/
1080
+
1081
+ .aDBc-overview-box {
1082
  float: left;
1083
  margin: 15px 20px 20px 10px;
1084
  width: 45%;
1085
  background: #fff;
1086
  }
1087
+
1088
+ @media screen and (max-width: 930px) {
1089
+ .aDBc-overview-box {
1090
+ width: 100%;
1091
+ }
 
 
 
 
1092
  }
1093
+
1094
+ .aDBc-overview-box-head {
1095
+ color: #000;
1096
+ font-size: 14px;
1097
+ font-weight: bold;
1098
+ padding: 8px 15px;
1099
+ background: #f5f5f5;
1100
+ margin-bottom: 20px;
1101
+ border-bottom: 1px solid #aeaeae;
1102
  }
1103
+
1104
+ .aDBc-overview-box > ul > li {
1105
+ line-height: 38px;
1106
  margin-bottom: 20px;
1107
  padding: 0px 10px;
1108
+ clear: both;
1109
  }
1110
+
1111
+ .aDBc-overview-text-left {
 
 
 
 
 
1112
  float: left;
1113
+ width: 200px;
 
 
1114
  }
1115
+
1116
+ .aDBc-overview-dashicon {
1117
+ color: #25C1EE;
1118
+ vertical-align: middle !important;
1119
  }
1120
+
1121
+ .aDBc-overview-setting-desc {
1122
  padding-left: 24px;
1123
  color: #999;
1124
  line-height: 20px;
1125
  }
1126
+
1127
+ @media screen and (max-width: 782px) {
1128
+ .aDBc-overview-setting-desc {
1129
+ padding-left: 32px;
1130
+ }
1131
+ }
1132
+
1133
+ .aDBc-save-settings {
1134
+ margin-left: 24px !important;
1135
  height: 30px !important;
1136
  padding: 1px 20px !important;
1137
  margin-top: 10px !important;
1138
  }
1139
 
1140
+ /*---------------------------------------------------------------------------------------------
1141
+ * License tab
1142
+ *---------------------------------------------------------------------------------------------*/
1143
+
1144
+ .aDBc-license-label {
1145
+ float: left;
1146
+ width: 125px;
1147
+ margin-top: 5px;
1148
+ }
1149
+
1150
+ @media screen and (max-width: 690px) {
1151
+ .aDBc-license-label {
1152
+ width: 100%;
1153
+ margin-bottom: 5px;
1154
+ }
1155
+ }
1156
+
1157
+ .aDBc-license-key-input {
1158
+ float: left;
1159
+ width: 290px;
1160
+ height: 32px;
1161
+ font-size: 15px;
1162
+ border-radius: 4px;
1163
  margin-right: 8px;
 
 
 
1164
  }
1165
 
1166
+ @media screen and (max-width: 690px) {
1167
+ .aDBc-license-key-input {
1168
+ margin-bottom: 5px;
1169
+ width: calc(100% - 5px);
1170
+ }
 
1171
  }
1172
 
1173
+ .aDBc-license-submit {
1174
+ height: 32px !important;
1175
+ vertical-align: middle;
 
 
1176
  }
1177
 
1178
+ .aDBc-license-inactive {
1179
+ float: left;
1180
+ color: red;
1181
  font-size: 13px;
1182
+ background: #f9f9f9;
1183
+ padding: 4px 8px;
1184
+ margin-right: 8px;
1185
+ vertical-align: middle;
1186
+ border: 1px solid red;
1187
+ border-radius: 4px;
 
 
1188
  }
1189
 
1190
+ @media screen and (max-width: 690px) {
1191
+ .aDBc-license-inactive {
1192
+ margin-bottom: 5px;
1193
+ }
1194
  }
1195
 
1196
+ .aDBc-license-active {
1197
+ float: left;
1198
+ color: green;
1199
+ font-size: 13px;
1200
+ background: #f5f5f5;
1201
+ padding: 4px 8px;
1202
+ margin-right: 8px;
1203
+ vertical-align: middle;
1204
+ border: 1px solid green;
1205
+ border-radius: 4px;
1206
  }
1207
 
1208
+ @media screen and (max-width: 690px) {
1209
+ .aDBc-license-active {
1210
+ margin-bottom: 5px;
1211
+ }
 
 
 
 
 
 
 
 
 
 
 
 
 
1212
  }
1213
 
1214
  /*---------------------------------------------------------------------------------------------
 
1215
  * Premium page style
 
1216
  *---------------------------------------------------------------------------------------------*/
1217
+
1218
+ .aDBc-vertical-box {
 
 
 
 
 
 
 
 
 
 
1219
  float: left;
1220
  background: #f9f9f9;
1221
  width: 28%;
1222
  margin:5px 15px;
1223
  min-height: 350px;
1224
  }
1225
+
1226
+ @media screen and (max-width: 1024px) {
1227
+ .aDBc-vertical-box {
1228
+ width: 94%;
1229
+ }
1230
  }
1231
+
1232
+ div.aDBc-vertical-box > div:first-child {
1233
  color: #fff;
1234
  font-size: 15px;
1235
  font-weight: bold;
1238
  background: #69ADE2;
1239
  border-radius: 8px;
1240
  }
1241
+
1242
+ div.aDBc-vertical-box > div:nth-child(2) {
1243
  text-align: center;
1244
  margin-top: 20px;
1245
  }
1246
+
1247
+ div.aDBc-vertical-box > div:nth-child(3) {
1248
  text-align: center;
1249
  margin-top: 50px;
1250
+ margin-bottom: 20px;
1251
+ }
1252
+
1253
+ .aDBc-vertical-box a {
1254
+ text-decoration: none;
1255
+ color: white;
1256
+ }
1257
+
1258
+ .aDBc-premium-img {
1259
+ width: 80px;
1260
+ }
1261
+
1262
+ .aDBc-vertical-box ul li {
1263
+ padding-left: 20px;
1264
+ margin-left: 20px;
1265
+ }
1266
+
1267
+ @media screen and (max-width: 1024px) {
1268
+ .aDBc-vertical-box ul li {
1269
+ padding-left: 0px;
1270
+ margin-left: 0px;
1271
+ text-align: center;
1272
+ }
1273
+ }
1274
+
1275
+ .aDBc-vertical-box ul li span {
1276
+ color: #84bc00;
1277
+ }
1278
+
1279
+ .aDBc-purchase-btn {
1280
+ text-align: center;
1281
+ margin-top: 60px;
1282
+ }
1283
+
1284
+ .aDBc-purchase-btn img {
1285
+ width: 70%;
1286
+ max-width: 200px;
1287
+ }
1288
+
1289
+ /*---------------------------------------------------------------------------------------------
1290
+ * Sidebar
1291
+ *---------------------------------------------------------------------------------------------*/
1292
+
1293
+ .aDBc-sidebar {
1294
+ float: right;
1295
+ margin-right: -260px;
1296
+ margin-top: 48px;
1297
+ width: 240px;
1298
+ }
1299
+
1300
+ @media screen and (max-width: 1200px) {
1301
+ .aDBc-sidebar {
1302
+ clear: both;
1303
+ float: left;
1304
+ margin-right: 0px;
1305
+ }
1306
+ }
1307
+
1308
+ .aDBc-upgrade {
1309
+ background-color: #23282d;
1310
+ padding: 15px;
1311
+ border-radius: 6px;
1312
+ }
1313
+
1314
+ .aDBc-upgrade a {
1315
+ text-decoration: none;
1316
+ color: #fff;
1317
+ }
1318
+
1319
+ .aDBc-upgrade img {
1320
+ display: block;
1321
+ width: 80px;
1322
+ height: auto;
1323
+ margin: 0 auto;
1324
+ }
1325
+
1326
+ .aDBc-upgrade h3 {
1327
+ font-size: 22px;
1328
+ font-weight: bold;
1329
+ color: #fff;
1330
+ text-align: center;
1331
+ padding-top: 20px;
1332
+ padding-bottom: 5px;
1333
+ }
1334
+
1335
+ .aDBc-upgrade ul {
1336
+ font-size: 14px;
1337
+ margin-left: 30px;
1338
+ }
1339
+
1340
+ .aDBc-upgrade ul li {
1341
+ margin: 5px 0 10px 0;
1342
+ }
1343
+
1344
+ .aDBc-upgrade ul li span {
1345
+ margin-left: -31px;
1346
+ font-size: 24px;
1347
+ margin-right: 6px;
1348
+ vertical-align: text-bottom;
1349
  }
1350
+
1351
+ .aDBc-upgrade div {
1352
+ text-align: center;
1353
+ border-top: 1px dashed #888;
1354
+ padding: 10px;
1355
+ color :#999;
1356
+ }
1357
+
1358
+ /*---------------------------------------------------------------------------------------------
1359
+ * Sweetalert override
1360
+ *---------------------------------------------------------------------------------------------*/
1361
+
1362
+ .swal2-icon.swal2-question {
1363
+ border-color: #e2e2e2 !important;
1364
+ color: #0085ba !important;
1365
+ }
1366
+
1367
  /*---------------------------------------------------------------------------------------------
1368
  * Tooltip for upgrade to premium
1369
  *---------------------------------------------------------------------------------------------*/
1370
+
1371
+ .aDBc-premium-tooltip {
1372
+ position: relative;
1373
+ display: inline-block;
1374
+ }
1375
+
1376
+ .aDBc-premium-tooltip .aDBc-premium-tooltiptext {
1377
+ visibility: hidden;
1378
+ background-color: #fff;
1379
+ text-align: center;
1380
+ color: #444;
1381
+ padding: 6px 0;
1382
+ border: 1px solid orange;
1383
+ top: 100%;
1384
+ left: 50%;
1385
+ margin-left: -72px;
1386
+ position: absolute;
1387
+ z-index: 1;
1388
+ }
1389
+
1390
+ .aDBc-premium-tooltip:hover .aDBc-premium-tooltiptext {
1391
  visibility: visible;
1392
+ }
1393
+
1394
+ /*---------------------------------------------------------------------------------------------
1395
+ * Tooltip for content
1396
+ *---------------------------------------------------------------------------------------------*/
1397
+
1398
+ span.aDBc-tooltips {
1399
+ position: relative;
1400
+ display: inline;
1401
+ cursor: pointer;
1402
+ color: #000;
1403
+ border-bottom:1px dotted orange;
1404
+ }
1405
+
1406
+ span.aDBc-tooltips span {
1407
+ position: absolute;
1408
+ color: #666666;
1409
+ background: #FFFFE0;
1410
+ font-size: 13px;
1411
+ font-weight: normal;
1412
+ padding: 10px;
1413
+ visibility: hidden;
1414
+ width: 300px;
1415
+ border: 1px solid #006799;
1416
+ border-radius: 4px;
1417
+ }
1418
+
1419
+ span.aDBc-tooltips span:after {
1420
+ content: '';
1421
+ position: absolute;
1422
+ top: 18px;
1423
+ right: 100%;
1424
+ margin-top: -8px;
1425
+ width: 0;
1426
+ height: 0;
1427
+ border-right: 8px solid #006799;
1428
+ border-top: 8px solid transparent;
1429
+ border-bottom: 8px solid transparent;
1430
+ }
1431
+
1432
+ span:hover.aDBc-tooltips span {
1433
+ visibility: visible;
1434
+ left: 100%;
1435
+ top: 50%;
1436
+ margin-top: -15.5px;
1437
+ margin-left: 5px;
1438
+ z-index: 999;
1439
+ }
1440
+
1441
+ /*---------------------------------------------------------------------------------------------
1442
+ * Tooltip for tables heads info
1443
+ *---------------------------------------------------------------------------------------------*/
1444
+
1445
+ span.aDBc-tooltips-headers {
1446
+ position: relative;
1447
+ display: inline;
1448
+ cursor: pointer;
1449
+ color: #000;
1450
+ }
1451
+
1452
+ span.aDBc-tooltips-headers span {
1453
+ position: absolute;
1454
+ text-align: left;
1455
+ line-height: 22px;
1456
+ color: #fff;
1457
+ background: #222;
1458
+ opacity: 1 !important;
1459
+ font-size: 13px;
1460
+ font-weight: normal;
1461
+ padding: 10px;
1462
+ visibility: hidden;
1463
+ width: 240px;
1464
+ border: 1px solid #222;
1465
+ border-radius: 4px;
1466
+ }
1467
+
1468
+ @media screen and (max-width: 1190px) {
1469
+ span.aDBc-tooltips-headers span {
1470
+ width: 80px;
1471
+ }
1472
+ }
1473
+
1474
+ span.aDBc-tooltips-headers span:after {
1475
+ content: '';
1476
+ position: absolute;
1477
+ top: 18px;
1478
+ right: 100%;
1479
+ margin-top: -8px;
1480
+ width: 0;
1481
+ height: 0;
1482
+ border-right: 8px solid #222;
1483
+ border-top: 8px solid transparent;
1484
+ border-bottom: 8px solid transparent;
1485
+ }
1486
+
1487
+ span:hover.aDBc-tooltips-headers span {
1488
+ visibility: visible;
1489
+ left: 100%;
1490
+ top: 50%;
1491
+ margin-top: -15.5px;
1492
+ margin-left: 8px;
1493
+ z-index: 999;
1494
+ }
1495
+
1496
+ .aDBc-info-image {
1497
+ width: 15px;
1498
+ vertical-align: middle;
1499
+ margin-left: 2px;
1500
+ }
images/add_schedule.svg DELETED
@@ -1,6 +0,0 @@
1
- <?xml version="1.0"?>
2
- <svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" id="Capa_1" x="0px" y="0px" width="512px" height="512px" viewBox="0 0 511.398 511.398" style="enable-background:new 0 0 511.398 511.398;" xml:space="preserve" class=""><g><g>
3
- <g>
4
- <path d="M477.549,182.379H329.018V33.847c0-18.69-15.154-33.844-33.844-33.844H216.22c-18.69,0-33.844,15.153-33.844,33.844 v148.526H33.844C15.153,182.373,0,197.526,0,216.216v78.966c0,18.691,15.153,33.844,33.844,33.844h148.532v148.527 c0,18.689,15.153,33.842,33.844,33.842h78.96c18.691,0,33.844-15.152,33.844-33.842V329.026h148.533 c18.689,0,33.842-15.152,33.842-33.844v-78.966C511.393,197.526,496.246,182.379,477.549,182.379z" data-original="#000000" class="active-path" data-old_color="#00A8FF" fill="#00C6FF"/>
5
- </g>
6
- </g></g> </svg>
 
 
 
 
 
 
images/alarm-clock.svg CHANGED
@@ -1,5 +1,5 @@
1
  <?xml version="1.0"?>
2
- <svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" id="Capa_1" x="0px" y="0px" viewBox="0 0 57.157 57.157" style="enable-background:new 0 0 57.157 57.157;" xml:space="preserve" width="512px" height="512px" class=""><g><circle style="fill:#FFFFFF" cx="28.578" cy="29.157" r="26" data-original="#E0E1E2" class="active-path" data-old_color="#ffffff"/><circle style="fill:#FFFFFF;" cx="28.578" cy="29.157" r="15" data-original="#FFFFFF" class=""/><path style="fill:#424A60;" d="M12.578,57.157c-0.256,0-0.512-0.098-0.707-0.293c-0.391-0.391-0.391-1.023,0-1.414l3.933-3.933 c0.391-0.391,1.023-0.391,1.414,0s0.391,1.023,0,1.414l-3.933,3.933C13.09,57.059,12.834,57.157,12.578,57.157z" data-original="#424A60" class=""/><path style="fill:#424A60;" d="M44.578,57.157c-0.256,0-0.512-0.098-0.707-0.293l-3.963-3.963c-0.391-0.391-0.391-1.023,0-1.414 s1.023-0.391,1.414,0l3.963,3.963c0.391,0.391,0.391,1.023,0,1.414C45.09,57.059,44.834,57.157,44.578,57.157z" data-original="#424A60" class=""/><path style="fill:#F6F9F6" d="M46.672,11.371c-0.256,0-0.512-0.098-0.707-0.293c-0.391-0.391-0.391-1.023,0-1.414l3-3 c0.391-0.391,1.023-0.391,1.414,0s0.391,1.023,0,1.414l-3,3C47.183,11.274,46.927,11.371,46.672,11.371z" data-original="#C7CAC7" class="" data-old_color="#F0F7F0"/><path style="fill:#F6F9F6" d="M10.485,11.371c-0.256,0-0.512-0.098-0.707-0.293l-3-3c-0.391-0.391-0.391-1.023,0-1.414 s1.023-0.391,1.414,0l3,3c0.391,0.391,0.391,1.023,0,1.414C10.997,11.274,10.741,11.371,10.485,11.371z" data-original="#C7CAC7" class="" data-old_color="#F0F7F0"/><path style="fill:#26B99A;" d="M28.578,57.157c-15.439,0-28-12.561-28-28s12.561-28,28-28s28,12.561,28,28 S44.018,57.157,28.578,57.157z M28.578,5.157c-13.234,0-24,10.767-24,24s10.766,24,24,24s24-10.767,24-24S41.812,5.157,28.578,5.157 z" data-original="#26B99A" class=""/><g>
3
  <path style="fill:#26B99A;" d="M28.578,6.036c-0.552,0-1,0.447-1,1v1c0,0.553,0.448,1,1,1s1-0.447,1-1v-1 C29.578,6.483,29.131,6.036,28.578,6.036z" data-original="#26B99A" class=""/>
4
  <path style="fill:#26B99A;" d="M28.578,49.036c-0.552,0-1,0.447-1,1v1c0,0.553,0.448,1,1,1s1-0.447,1-1v-1 C29.578,49.483,29.131,49.036,28.578,49.036z" data-original="#26B99A" class=""/>
5
  <path style="fill:#26B99A;" d="M50.578,28.036h-1c-0.552,0-1,0.447-1,1s0.448,1,1,1h1c0.552,0,1-0.447,1-1 S51.131,28.036,50.578,28.036z" data-original="#26B99A" class=""/>
1
  <?xml version="1.0"?>
2
+ <svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" id="Capa_1" x="0px" y="0px" viewBox="0 0 57.157 57.157" style="enable-background:new 0 0 57.157 57.157;" xml:space="preserve" width="60px" height="60px" class=""><g><circle style="fill:#FFFFFF" cx="28.578" cy="29.157" r="26" data-original="#E0E1E2" class="active-path" data-old_color="#ffffff"/><circle style="fill:#FFFFFF;" cx="28.578" cy="29.157" r="15" data-original="#FFFFFF" class=""/><path style="fill:#424A60;" d="M12.578,57.157c-0.256,0-0.512-0.098-0.707-0.293c-0.391-0.391-0.391-1.023,0-1.414l3.933-3.933 c0.391-0.391,1.023-0.391,1.414,0s0.391,1.023,0,1.414l-3.933,3.933C13.09,57.059,12.834,57.157,12.578,57.157z" data-original="#424A60" class=""/><path style="fill:#424A60;" d="M44.578,57.157c-0.256,0-0.512-0.098-0.707-0.293l-3.963-3.963c-0.391-0.391-0.391-1.023,0-1.414 s1.023-0.391,1.414,0l3.963,3.963c0.391,0.391,0.391,1.023,0,1.414C45.09,57.059,44.834,57.157,44.578,57.157z" data-original="#424A60" class=""/><path style="fill:#F6F9F6" d="M46.672,11.371c-0.256,0-0.512-0.098-0.707-0.293c-0.391-0.391-0.391-1.023,0-1.414l3-3 c0.391-0.391,1.023-0.391,1.414,0s0.391,1.023,0,1.414l-3,3C47.183,11.274,46.927,11.371,46.672,11.371z" data-original="#C7CAC7" class="" data-old_color="#F0F7F0"/><path style="fill:#F6F9F6" d="M10.485,11.371c-0.256,0-0.512-0.098-0.707-0.293l-3-3c-0.391-0.391-0.391-1.023,0-1.414 s1.023-0.391,1.414,0l3,3c0.391,0.391,0.391,1.023,0,1.414C10.997,11.274,10.741,11.371,10.485,11.371z" data-original="#C7CAC7" class="" data-old_color="#F0F7F0"/><path style="fill:#26B99A;" d="M28.578,57.157c-15.439,0-28-12.561-28-28s12.561-28,28-28s28,12.561,28,28 S44.018,57.157,28.578,57.157z M28.578,5.157c-13.234,0-24,10.767-24,24s10.766,24,24,24s24-10.767,24-24S41.812,5.157,28.578,5.157 z" data-original="#26B99A" class=""/><g>
3
  <path style="fill:#26B99A;" d="M28.578,6.036c-0.552,0-1,0.447-1,1v1c0,0.553,0.448,1,1,1s1-0.447,1-1v-1 C29.578,6.483,29.131,6.036,28.578,6.036z" data-original="#26B99A" class=""/>
4
  <path style="fill:#26B99A;" d="M28.578,49.036c-0.552,0-1,0.447-1,1v1c0,0.553,0.448,1,1,1s1-0.447,1-1v-1 C29.578,49.483,29.131,49.036,28.578,49.036z" data-original="#26B99A" class=""/>
5
  <path style="fill:#26B99A;" d="M50.578,28.036h-1c-0.552,0-1,0.447-1,1s0.448,1,1,1h1c0.552,0,1-0.447,1-1 S51.131,28.036,50.578,28.036z" data-original="#26B99A" class=""/>
images/check_ok.svg DELETED
@@ -1,4 +0,0 @@
1
- <?xml version="1.0"?>
2
- <svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" id="Capa_1" x="0px" y="0px" width="15px" height="15px" viewBox="0 0 490.434 490.433" style="enable-background:new 0 0 490.434 490.433;" xml:space="preserve"><g><g>
3
- <path d="M472.003,58.36l-13.132-11.282c-21.798-18.732-54.554-16.644-73.799,4.697L165.39,295.359l-66.312-57.112 c-21.775-18.753-54.536-16.707-73.804,4.611l-11.611,12.848c-9.416,10.413-14.305,24.149-13.595,38.18 c0.717,14.023,6.973,27.188,17.402,36.6l121.553,111.311c10.524,9.883,24.628,15.037,39.044,14.272 c14.416-0.763,27.894-7.386,37.311-18.329l262.245-304.71c9.162-10.646,13.717-24.494,12.661-38.496 C489.229,80.522,482.655,67.512,472.003,58.36z" data-original="#000000" class="active-path" data-old_color="#000000" fill="#25C1EE"/>
4
- </g></g> </svg>
 
 
 
 
images/db_clean.svg CHANGED
@@ -1,2 +1,2 @@
1
  <?xml version="1.0"?>
2
- <svg xmlns="http://www.w3.org/2000/svg" height="512px" viewBox="0 0 512 512" width="512px" class="hovered-paths"><g><path d="m256 0c-141.164062 0-256 114.835938-256 256s114.835938 256 256 256 256-114.835938 256-256-114.835938-256-256-256zm0 0" fill="#2196f3" data-original="#2196F3" class="" data-old_color="#2196f3" style="fill:#FFFFFF"/><path d="m385.75 201.75-138.667969 138.664062c-4.160156 4.160157-9.621093 6.253907-15.082031 6.253907s-10.921875-2.09375-15.082031-6.253907l-69.332031-69.332031c-8.34375-8.339843-8.34375-21.824219 0-30.164062 8.339843-8.34375 21.820312-8.34375 30.164062 0l54.25 54.25 123.585938-123.582031c8.339843-8.34375 21.820312-8.34375 30.164062 0 8.339844 8.339843 8.339844 21.820312 0 30.164062zm0 0" fill="#fafafa" data-original="#FAFAFA" class="hovered-path active-path" style="fill:#44C3FF" data-old_color="#fafafa"/></g> </svg>
1
  <?xml version="1.0"?>
2
+ <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512" width="58px" height="58px" class="hovered-paths"><g><path d="m256 0c-141.164062 0-256 114.835938-256 256s114.835938 256 256 256 256-114.835938 256-256-114.835938-256-256-256zm0 0" fill="#2196f3" data-original="#2196F3" class="" data-old_color="#2196f3" style="fill:#FFFFFF"/><path d="m385.75 201.75-138.667969 138.664062c-4.160156 4.160157-9.621093 6.253907-15.082031 6.253907s-10.921875-2.09375-15.082031-6.253907l-69.332031-69.332031c-8.34375-8.339843-8.34375-21.824219 0-30.164062 8.339843-8.34375 21.820312-8.34375 30.164062 0l54.25 54.25 123.585938-123.582031c8.339843-8.34375 21.820312-8.34375 30.164062 0 8.339844 8.339843 8.339844 21.820312 0 30.164062zm0 0" fill="#fafafa" data-original="#FAFAFA" class="hovered-path active-path" style="fill:#44C3FF" data-old_color="#fafafa"/></g> </svg>
images/double_check.svg ADDED
@@ -0,0 +1,4 @@
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" id="Capa_1" x="0px" y="0px" viewBox="0 0 214.864 214.864" style="enable-background:new 0 0 214.864 214.864;" xml:space="preserve" width="25px" height="25px"><g><g>
3
+ <path d="M208.35,56.943c-8.703-8.7-22.864-8.702-31.567,0l-53.626,53.625l-3.414-3.414l18.644-18.644 c0.183-0.183,0.355-0.374,0.515-0.57c8.16-8.74,8.004-22.477-0.515-30.996c-4.216-4.217-9.82-6.538-15.783-6.538 s-11.567,2.321-15.784,6.537l-53.625,53.625l-15.091-15.09c-8.703-8.701-22.863-8.701-31.566,0C2.321,99.695,0,105.299,0,111.262 c0,5.844,2.241,11.334,6.299,15.52c0.08,0.087,0.153,0.179,0.238,0.263l30.835,30.835c0.013,0.013,0.023,0.028,0.037,0.041 c4.217,4.216,9.821,6.537,15.784,6.537c5.962,0,11.566-2.321,15.783-6.537l0.002-0.002l0,0l0,0l19.197-19.197l19.159,19.159 c0.013,0.013,0.023,0.028,0.037,0.041c4.217,4.216,9.821,6.537,15.783,6.537c5.963,0,11.567-2.321,15.784-6.537L208.35,88.51 c0.183-0.183,0.355-0.374,0.515-0.57C217.025,79.2,216.869,65.463,208.35,56.943z M17.144,106.086 c2.854-2.853,7.499-2.854,10.354,0l20.394,20.394c0.183,0.183,0.374,0.354,0.57,0.515c1.375,1.121,3.055,1.682,4.734,1.682 s3.359-0.561,4.734-1.682c0.196-0.16,0.387-0.332,0.57-0.515l58.929-58.929c1.383-1.383,3.221-2.145,5.177-2.145 c1.955,0,3.793,0.761,5.176,2.145c2.854,2.854,2.854,7.498,0,10.353l-69.408,69.409c-1.383,1.383-3.221,2.145-5.176,2.145 c-1.956,0-3.794-0.762-5.177-2.145l-30.874-30.874c-0.002-0.002-0.004-0.003-0.005-0.005c-1.38-1.382-2.139-3.218-2.139-5.171 C15,109.306,15.762,107.468,17.144,106.086z M109.135,117.762l8.717,8.717c1.465,1.464,3.384,2.196,5.304,2.196 c1.919,0,3.839-0.732,5.304-2.196l58.93-58.929c2.854-2.856,7.499-2.854,10.353,0c2.854,2.854,2.854,7.498,0,10.353l-69.409,69.409 c-1.383,1.383-3.221,2.145-5.177,2.145c-1.955,0-3.793-0.762-5.176-2.145l-19.197-19.198L109.135,117.762z" data-original="#1D1D1B" class="active-path" data-old_color="#1D1D1B" fill="#FFFFFF"/>
4
+ </g></g> </svg>
images/edit_schedule.svg DELETED
@@ -1,4 +0,0 @@
1
- <?xml version="1.0"?>
2
- <svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" id="Capa_1" x="0px" y="0px" width="512px" height="512px" viewBox="0 0 485.219 485.22" style="enable-background:new 0 0 485.219 485.22;" xml:space="preserve" class=""><g><g>
3
- <path d="M467.476,146.438l-21.445,21.455L317.35,39.23l21.445-21.457c23.689-23.692,62.104-23.692,85.795,0l42.886,42.897 C491.133,84.349,491.133,122.748,467.476,146.438z M167.233,403.748c-5.922,5.922-5.922,15.513,0,21.436 c5.925,5.955,15.521,5.955,21.443,0L424.59,189.335l-21.469-21.457L167.233,403.748z M60,296.54c-5.925,5.927-5.925,15.514,0,21.44 c5.922,5.923,15.518,5.923,21.443,0L317.35,82.113L295.914,60.67L60,296.54z M338.767,103.54L102.881,339.421 c-11.845,11.822-11.815,31.041,0,42.886c11.85,11.846,31.038,11.901,42.914-0.032l235.886-235.837L338.767,103.54z M145.734,446.572c-7.253-7.262-10.749-16.465-12.05-25.948c-3.083,0.476-6.188,0.919-9.36,0.919 c-16.202,0-31.419-6.333-42.881-17.795c-11.462-11.491-17.77-26.687-17.77-42.887c0-2.954,0.443-5.833,0.859-8.703 c-9.803-1.335-18.864-5.629-25.972-12.737c-0.682-0.677-0.917-1.596-1.538-2.338L0,485.216l147.748-36.986 C147.097,447.637,146.36,447.193,145.734,446.572z" data-original="#000000" class="active-path" data-old_color="#00BFFF" fill="#00C6FF"/>
4
- </g></g> </svg>
 
 
 
 
images/go_back.svg DELETED
@@ -1,2 +0,0 @@
1
- <?xml version="1.0"?>
2
- <svg xmlns="http://www.w3.org/2000/svg" id="Layer_1" enable-background="new 0 0 511.34 511.34" height="512px" viewBox="0 0 511.34 511.34" width="512px" class=""><g><path d="m175.974 49.719-170.67 192c-7.073 7.957-7.073 19.947 0 27.904l170.67 192c12.788 14.386 36.695 5.326 36.695-13.952v-384c.001-19.248-23.885-28.36-36.695-13.952z" fill="#fff3e4" data-original="#FFF3E4" class="active-path" data-old_color="#fff3e4" style="fill:#9EE0FF"/><path d="m383.67 181.341h-64.33v-117.67c0-19.248-23.886-28.36-36.695-13.952l-170.67 192c-7.073 7.957-7.073 19.947 0 27.904l170.67 192c12.782 14.378 36.695 5.286 36.695-13.952v-117.67h64.33c35.106 0 59.151 14.841 73.508 45.37 11.712 24.905 12.16 50.896 12.163 51.09.065 11.456 9.328 20.88 21.06 20.88 11.574-.033 20.94-9.426 20.94-21v-117.34c-.001-70.391-57.274-127.66-127.671-127.66z" fill="#ffebd2" data-original="#FFEBD2" class="" data-old_color="#ffebd2" style="fill:#48BDF3"/></g> </svg>
 
 
images/green_clock.svg CHANGED
@@ -1,5 +1,5 @@
1
  <?xml version="1.0"?>
2
- <svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" id="Capa_1" x="0px" y="0px" width="512px" height="512px" viewBox="0 0 97.16 97.16" style="enable-background:new 0 0 97.16 97.16;" xml:space="preserve"><g><g>
3
  <g>
4
  <path d="M48.58,0C21.793,0,0,21.793,0,48.58s21.793,48.58,48.58,48.58s48.58-21.793,48.58-48.58S75.367,0,48.58,0z M48.58,86.823 c-21.087,0-38.244-17.155-38.244-38.243S27.493,10.337,48.58,10.337S86.824,27.492,86.824,48.58S69.667,86.823,48.58,86.823z" data-original="#000000" class="active-path" data-old_color="#000000" fill="#1CD60A"/>
5
  <path d="M73.898,47.08H52.066V20.83c0-2.209-1.791-4-4-4c-2.209,0-4,1.791-4,4v30.25c0,2.209,1.791,4,4,4h25.832 c2.209,0,4-1.791,4-4S76.107,47.08,73.898,47.08z" data-original="#000000" class="active-path" data-old_color="#000000" fill="#1CD60A"/>
1
  <?xml version="1.0"?>
2
+ <svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" id="Capa_1" x="0px" y="0px" width="20px" height="20px" viewBox="0 0 97.16 97.16" style="enable-background:new 0 0 97.16 97.16;" xml:space="preserve"><g><g>
3
  <g>
4
  <path d="M48.58,0C21.793,0,0,21.793,0,48.58s21.793,48.58,48.58,48.58s48.58-21.793,48.58-48.58S75.367,0,48.58,0z M48.58,86.823 c-21.087,0-38.244-17.155-38.244-38.243S27.493,10.337,48.58,10.337S86.824,27.492,86.824,48.58S69.667,86.823,48.58,86.823z" data-original="#000000" class="active-path" data-old_color="#000000" fill="#1CD60A"/>
5
  <path d="M73.898,47.08H52.066V20.83c0-2.209-1.791-4-4-4c-2.209,0-4,1.791-4,4v30.25c0,2.209,1.791,4,4,4h25.832 c2.209,0,4-1.791,4-4S76.107,47.08,73.898,47.08z" data-original="#000000" class="active-path" data-old_color="#000000" fill="#1CD60A"/>
images/grey_clock.svg CHANGED
@@ -1,7 +1,7 @@
1
  <?xml version="1.0"?>
2
- <svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" id="Capa_1" x="0px" y="0px" width="512px" height="512px" viewBox="0 0 97.16 97.16" style="enable-background:new 0 0 97.16 97.16;" xml:space="preserve"><g><g>
3
  <g>
4
- <path d="M48.58,0C21.793,0,0,21.793,0,48.58s21.793,48.58,48.58,48.58s48.58-21.793,48.58-48.58S75.367,0,48.58,0z M48.58,86.823 c-21.087,0-38.244-17.155-38.244-38.243S27.493,10.337,48.58,10.337S86.824,27.492,86.824,48.58S69.667,86.823,48.58,86.823z" data-original="#000000" class="active-path" data-old_color="#000000" fill="#eee"/>
5
- <path d="M73.898,47.08H52.066V20.83c0-2.209-1.791-4-4-4c-2.209,0-4,1.791-4,4v30.25c0,2.209,1.791,4,4,4h25.832 c2.209,0,4-1.791,4-4S76.107,47.08,73.898,47.08z" data-original="#000000" class="active-path" data-old_color="#000000" fill="#eee"/>
6
  </g>
7
  </g></g> </svg>
1
  <?xml version="1.0"?>
2
+ <svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" id="Capa_1" x="0px" y="0px" width="20px" height="20px" viewBox="0 0 97.16 97.16" style="enable-background:new 0 0 97.16 97.16;" xml:space="preserve"><g><g>
3
  <g>
4
+ <path d="M48.58,0C21.793,0,0,21.793,0,48.58s21.793,48.58,48.58,48.58s48.58-21.793,48.58-48.58S75.367,0,48.58,0z M48.58,86.823 c-21.087,0-38.244-17.155-38.244-38.243S27.493,10.337,48.58,10.337S86.824,27.492,86.824,48.58S69.667,86.823,48.58,86.823z" data-original="#000000" class="active-path" data-old_color="#000000" fill="#ccc"/>
5
+ <path d="M73.898,47.08H52.066V20.83c0-2.209-1.791-4-4-4c-2.209,0-4,1.791-4,4v30.25c0,2.209,1.791,4,4,4h25.832 c2.209,0,4-1.791,4-4S76.107,47.08,73.898,47.08z" data-original="#000000" class="active-path" data-old_color="#000000" fill="#ccc"/>
6
  </g>
7
  </g></g> </svg>
images/help.svg CHANGED
@@ -1,7 +1,6 @@
1
  <?xml version="1.0" encoding="iso-8859-1"?>
2
  <!-- Generator: Adobe Illustrator 19.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
3
- <svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
4
- viewBox="0 0 504.124 504.124" style="enable-background:new 0 0 504.124 504.124;" xml:space="preserve">
5
  <path style="fill:#E4E7E7;" d="M441.108,244.578l-1.182-16.148l10.24-10.24c45.292-45.292,45.292-119.335,0-164.234
6
  c-45.292-45.292-118.942-45.292-164.234,0l-10.24,10.24c-5.12-0.788-10.634-1.182-16.148-1.182l17.723-17.723
7
  c50.018-50.018,131.545-50.412,181.563,0c50.018,50.018,50.018,131.545,0,181.563C458.831,226.855,441.108,244.578,441.108,244.578z
1
  <?xml version="1.0" encoding="iso-8859-1"?>
2
  <!-- Generator: Adobe Illustrator 19.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
3
+ <svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" width="40px" height="40px" viewBox="0 0 504.124 504.124" style="enable-background:new 0 0 504.124 504.124;" xml:space="preserve">
 
4
  <path style="fill:#E4E7E7;" d="M441.108,244.578l-1.182-16.148l10.24-10.24c45.292-45.292,45.292-119.335,0-164.234
5
  c-45.292-45.292-118.942-45.292-164.234,0l-10.24,10.24c-5.12-0.788-10.634-1.182-16.148-1.182l17.723-17.723
6
  c50.018-50.018,131.545-50.412,181.563,0c50.018,50.018,50.018,131.545,0,181.563C458.831,226.855,441.108,244.578,441.108,244.578z
images/information.svg CHANGED
@@ -1,7 +1,6 @@
1
  <?xml version="1.0" encoding="iso-8859-1"?>
2
  <!-- Generator: Adobe Illustrator 19.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
3
- <svg version="1.1" id="Capa_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
4
- viewBox="0 0 437.6 437.6" style="enable-background:new 0 0 437.6 437.6;" xml:space="preserve">
5
  <g>
6
  <g>
7
  <g>
@@ -21,34 +20,4 @@
21
  </g>
22
  </g>
23
  </g>
24
- <g>
25
- </g>
26
- <g>
27
- </g>
28
- <g>
29
- </g>
30
- <g>
31
- </g>
32
- <g>
33
- </g>
34
- <g>
35
- </g>
36
- <g>
37
- </g>
38
- <g>
39
- </g>
40
- <g>
41
- </g>
42
- <g>
43
- </g>
44
- <g>
45
- </g>
46
- <g>
47
- </g>
48
- <g>
49
- </g>
50
- <g>
51
- </g>
52
- <g>
53
- </g>
54
  </svg>
1
  <?xml version="1.0" encoding="iso-8859-1"?>
2
  <!-- Generator: Adobe Illustrator 19.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
3
+ <svg version="1.1" id="Capa_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" width="17px" height="17px" viewBox="0 0 437.6 437.6" style="enable-background:new 0 0 437.6 437.6;" xml:space="preserve">
 
4
  <g>
5
  <g>
6
  <g>
20
  </g>
21
  </g>
22
  </g>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
23
  </svg>
images/information2.svg CHANGED
@@ -1,7 +1,6 @@
1
  <?xml version="1.0" encoding="iso-8859-1"?>
2
  <!-- Generator: Adobe Illustrator 19.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
3
- <svg version="1.1" id="Capa_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
4
- viewBox="0 0 512 512" style="enable-background:new 0 0 512 512;" xml:space="preserve">
5
  <g>
6
  <g>
7
  <g>
1
  <?xml version="1.0" encoding="iso-8859-1"?>
2
  <!-- Generator: Adobe Illustrator 19.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
3
+ <svg version="1.1" id="Capa_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" width="15px" height="15px" viewBox="0 0 512 512" style="enable-background:new 0 0 512 512;" xml:space="preserve">
 
4
  <g>
5
  <g>
6
  <g>
images/information_orange.svg ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0" encoding="iso-8859-1"?>
2
+ <!-- Generator: Adobe Illustrator 19.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
3
+ <svg version="1.1" id="Capa_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
4
+ viewBox="0 0 437.6 437.6" style="enable-background:new 0 0 437.6 437.6;" xml:space="preserve">
5
+ <g>
6
+ <g>
7
+ <g>
8
+ <path d="M194,142.8c0.8,1.6,1.6,3.2,2.4,4.4c0.8,1.2,2,2.4,2.8,3.6c1.2,1.2,2.4,2.4,4,3.6c1.2,0.8,2.8,2,4.8,2.4
9
+ c1.6,0.8,3.2,1.2,5.2,1.6c2,0.4,3.6,0.4,5.2,0.4c1.6,0,3.6,0,5.2-0.4c1.6-0.4,3.2-0.8,4.4-1.6h0.4c1.6-0.8,3.2-1.6,4.8-2.8
10
+ c1.2-0.8,2.4-2,3.6-3.2l0.4-0.4c1.2-1.2,2-2.4,2.8-3.6s1.6-2.4,2-4c0-0.4,0-0.4,0.4-0.8c0.8-1.6,1.2-3.6,1.6-5.2
11
+ c0.4-1.6,0.4-3.6,0.4-5.2s0-3.6-0.4-5.2c-0.4-1.6-0.8-3.2-1.6-5.2c-1.2-2.8-2.8-5.2-4.8-7.2c-0.4-0.4-0.4-0.4-0.8-0.8
12
+ c-1.2-1.2-2.4-2-4-3.2c-1.6-0.8-2.8-1.6-4.4-2.4c-1.6-0.8-3.2-1.2-4.8-1.6c-2-0.4-3.6-0.4-5.2-0.4c-1.6,0-3.6,0-5.2,0.4
13
+ c-1.6,0.4-3.2,0.8-4.8,1.6H208c-1.6,0.8-3.2,1.6-4.4,2.4c-1.6,1.2-2.8,2-4,3.2c-1.2,1.2-2.4,2.4-3.2,3.6
14
+ c-0.8,1.2-1.6,2.8-2.4,4.4c-0.8,1.6-1.2,3.2-1.6,4.8c-0.4,2-0.4,3.6-0.4,5.2c0,1.6,0,3.6,0.4,5.2
15
+ C192.8,139.6,193.6,141.2,194,142.8z" fill="#E97F31"/>
16
+ <path d="M249.6,289.2h-9.2v-98c0-5.6-4.4-10.4-10.4-10.4h-42c-5.6,0-10.4,4.4-10.4,10.4v21.6c0,5.6,4.4,10.4,10.4,10.4h8.4v66.4
17
+ H188c-5.6,0-10.4,4.4-10.4,10.4v21.6c0,5.6,4.4,10.4,10.4,10.4h61.6c5.6,0,10.4-4.4,10.4-10.4V300
18
+ C260,294,255.2,289.2,249.6,289.2z" fill="#E97F31"/>
19
+ <path d="M218.8,0C98,0,0,98,0,218.8s98,218.8,218.8,218.8s218.8-98,218.8-218.8S339.6,0,218.8,0z M218.8,408.8
20
+ c-104.8,0-190-85.2-190-190s85.2-190,190-190s190,85.2,190,190S323.6,408.8,218.8,408.8z" fill="#E97F31"/>
21
+ </g>
22
+ </g>
23
+ </g>
24
+ </svg>
images/nothing_to_see.svg CHANGED
@@ -1,4 +1,4 @@
1
  <?xml version="1.0"?>
2
- <svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" id="Capa_1" x="0px" y="0px" viewBox="0 0 488.85 488.85" style="enable-background:new 0 0 488.85 488.85;" xml:space="preserve" width="512px" height="512px" class=""><g><g>
3
  <path d="M244.425,98.725c-93.4,0-178.1,51.1-240.6,134.1c-5.1,6.8-5.1,16.3,0,23.1c62.5,83.1,147.2,134.2,240.6,134.2 s178.1-51.1,240.6-134.1c5.1-6.8,5.1-16.3,0-23.1C422.525,149.825,337.825,98.725,244.425,98.725z M251.125,347.025 c-62,3.9-113.2-47.2-109.3-109.3c3.2-51.2,44.7-92.7,95.9-95.9c62-3.9,113.2,47.2,109.3,109.3 C343.725,302.225,302.225,343.725,251.125,347.025z M248.025,299.625c-33.4,2.1-61-25.4-58.8-58.8c1.7-27.6,24.1-49.9,51.7-51.7 c33.4-2.1,61,25.4,58.8,58.8C297.925,275.625,275.525,297.925,248.025,299.625z" data-original="#000000" class="active-path" data-old_color="#000000" fill="#D2D2D2"/>
4
  </g></g> </svg>
1
  <?xml version="1.0"?>
2
+ <svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" id="Capa_1" x="0px" y="0px" viewBox="0 0 488.85 488.85" style="enable-background:new 0 0 488.85 488.85;" xml:space="preserve" width="20px" height="20px" class=""><g><g>
3
  <path d="M244.425,98.725c-93.4,0-178.1,51.1-240.6,134.1c-5.1,6.8-5.1,16.3,0,23.1c62.5,83.1,147.2,134.2,240.6,134.2 s178.1-51.1,240.6-134.1c5.1-6.8,5.1-16.3,0-23.1C422.525,149.825,337.825,98.725,244.425,98.725z M251.125,347.025 c-62,3.9-113.2-47.2-109.3-109.3c3.2-51.2,44.7-92.7,95.9-95.9c62-3.9,113.2,47.2,109.3,109.3 C343.725,302.225,302.225,343.725,251.125,347.025z M248.025,299.625c-33.4,2.1-61-25.4-58.8-58.8c1.7-27.6,24.1-49.9,51.7-51.7 c33.4-2.1,61,25.4,58.8,58.8C297.925,275.625,275.525,297.925,248.025,299.625z" data-original="#000000" class="active-path" data-old_color="#000000" fill="#D2D2D2"/>
4
  </g></g> </svg>
images/premium.svg CHANGED
@@ -1 +1 @@
1
- <svg height="512pt" viewBox="0 0 512 512.0002" width="512pt" xmlns="http://www.w3.org/2000/svg"><path d="m301.636719 170c3.066406 0 6.117187-.953125 8.683593-2.820312 4.351563-3.160157 6.640626-8.441407 5.972657-13.78125l-5.394531-43.144532 29.726562-31.734375c3.679688-3.929687 4.929688-9.542969 3.265625-14.664062-1.664063-5.117188-5.976563-8.921875-11.261719-9.9375l-42.699218-8.203125-20.996094-38.078125c-2.597656-4.710938-7.554688-7.636719-12.933594-7.636719-5.382812 0-10.335938 2.925781-12.933594 7.636719l-20.996094 38.078125-42.703124 8.203125c-5.28125 1.011719-9.597657 4.820312-11.261719 9.9375-1.660157 5.121093-.410157 10.734375 3.269531 14.664062l29.726562 31.734375-5.394531 43.144532c-.671875 5.339843 1.617188 10.621093 5.972657 13.78125 4.351562 3.164062 10.078124 3.710937 14.953124 1.421874l39.367188-18.460937 39.367188 18.460937c2 .9375 4.140624 1.398438 6.269531 1.398438zm0 0" fill="#ffa000"/><path d="m343.890625 63.855469c-1.660156-5.117188-5.976563-8.925781-11.257813-9.9375l-42.703124-8.203125-20.996094-38.078125c-2.597656-4.710938-7.554688-7.636719-12.933594-7.636719v150.140625l39.367188 18.460937c1.996093.9375 4.136718 1.398438 6.269531 1.398438 3.066406 0 6.117187-.953125 8.683593-2.820312 4.351563-3.160157 6.640626-8.441407 5.972657-13.78125l-5.394531-43.144532 29.726562-31.734375c3.679688-3.929687 4.929688-9.546875 3.265625-14.664062zm0 0" fill="#ee8700"/><path d="m511.277344 213.855469c-1.664063-5.117188-5.976563-8.925781-11.261719-9.941407l-42.703125-8.203124-20.996094-38.078126c-2.597656-4.710937-7.550781-7.636718-12.933594-7.636718-5.378906 0-10.335937 2.925781-12.933593 7.636718l-20.996094 38.078126-42.699219 8.203124c-5.285156 1.015626-9.597656 4.824219-11.261718 9.941407-1.664063 5.117187-.410157 10.730469 3.265624 14.660156l29.726563 31.734375-5.394531 43.148438c-.667969 5.339843 1.621094 10.617187 5.972656 13.777343 4.351562 3.164063 10.078125 3.710938 14.953125 1.425781l39.367187-18.464843 39.371094 18.464843c1.996094.9375 4.136719 1.398438 6.265625 1.398438 3.070313 0 6.117188-.957031 8.683594-2.820312 4.351563-3.164063 6.640625-8.441407 5.972656-13.78125l-5.394531-43.144532 29.726562-31.738281c3.679688-3.925781 4.933594-9.542969 3.269532-14.660156zm0 0" fill="#ee8700"/><path d="m229.246094 395.914062-42.699219-8.199218-20.996094-38.078125c-2.597656-4.710938-7.554687-7.640625-12.933593-7.640625-5.382813 0-10.335938 2.929687-12.933594 7.640625l-20.996094 38.078125-42.703125 8.199218c-5.285156 1.015626-9.597656 4.824219-11.261719 9.941407-1.660156 5.117187-.410156 10.734375 3.269532 14.660156l29.722656 31.734375-5.394532 43.148438c-.667968 5.339843 1.621094 10.617187 5.976563 13.78125 4.351563 3.160156 10.078125 3.710937 14.949219 1.421874l39.371094-18.464843 39.367187 18.464843c1.996094.9375 4.136719 1.398438 6.269531 1.398438 3.066406 0 6.113282-.957031 8.679688-2.820312 4.355468-3.164063 6.644531-8.441407 5.976562-13.78125l-5.398437-43.148438 29.726562-31.734375c3.679688-3.925781 4.929688-9.542969 3.269531-14.660156-1.660156-5.117188-5.976562-8.925781-11.261718-9.941407zm0 0" fill="#ffa000"/><path d="m436.015625 395.914062-42.703125-8.199218-20.996094-38.078125c-2.597656-4.710938-7.550781-7.640625-12.933594-7.640625-5.378906 0-10.332031 2.929687-12.933593 7.640625l-20.996094 38.078125-42.699219 8.199218c-5.285156 1.015626-9.597656 4.824219-11.261718 9.941407-1.664063 5.117187-.410157 10.734375 3.265624 14.660156l29.726563 31.734375-5.394531 43.148438c-.667969 5.339843 1.621094 10.617187 5.972656 13.78125 4.351562 3.160156 10.078125 3.710937 14.953125 1.421874l39.367187-18.464843 39.371094 18.464843c1.996094.9375 4.136719 1.398438 6.265625 1.398438 3.070313 0 6.117188-.957031 8.683594-2.820312 4.351563-3.164063 6.640625-8.441407 5.972656-13.78125l-5.394531-43.148438 29.726562-31.734375c3.679688-3.925781 4.929688-9.542969 3.265626-14.660156-1.660157-5.117188-5.972657-8.925781-11.257813-9.941407zm0 0" fill="#ee8700"/><path d="m127.984375 318.601562c1.996094.9375 4.136719 1.398438 6.269531 1.398438 3.066406 0 6.113282-.957031 8.683594-2.820312 4.351562-3.164063 6.640625-8.441407 5.972656-13.78125l-5.394531-43.144532 29.722656-31.738281c3.679688-3.925781 4.933594-9.542969 3.269531-14.660156-1.664062-5.117188-5.976562-8.925781-11.261718-9.941407l-42.703125-8.199218-20.996094-38.078125c-2.597656-4.710938-7.550781-7.640625-12.933594-7.640625-5.378906 0-10.335937 2.929687-12.933593 7.640625l-20.992188 38.074219-42.703125 8.203124c-5.285156 1.015626-9.597656 4.824219-11.261719 9.941407-1.660156 5.117187-.410156 10.730469 3.265625 14.660156l29.726563 31.734375-5.394532 43.148438c-.667968 5.339843 1.621094 10.617187 5.972657 13.777343 4.351562 3.164063 10.082031 3.710938 14.953125 1.425781l39.371094-18.464843zm0 0" fill="#ffa000"/></svg>
1
+ <svg height="80pt" viewBox="0 0 512 512.0002" width="80pt" xmlns="http://www.w3.org/2000/svg"><path d="m301.636719 170c3.066406 0 6.117187-.953125 8.683593-2.820312 4.351563-3.160157 6.640626-8.441407 5.972657-13.78125l-5.394531-43.144532 29.726562-31.734375c3.679688-3.929687 4.929688-9.542969 3.265625-14.664062-1.664063-5.117188-5.976563-8.921875-11.261719-9.9375l-42.699218-8.203125-20.996094-38.078125c-2.597656-4.710938-7.554688-7.636719-12.933594-7.636719-5.382812 0-10.335938 2.925781-12.933594 7.636719l-20.996094 38.078125-42.703124 8.203125c-5.28125 1.011719-9.597657 4.820312-11.261719 9.9375-1.660157 5.121093-.410157 10.734375 3.269531 14.664062l29.726562 31.734375-5.394531 43.144532c-.671875 5.339843 1.617188 10.621093 5.972657 13.78125 4.351562 3.164062 10.078124 3.710937 14.953124 1.421874l39.367188-18.460937 39.367188 18.460937c2 .9375 4.140624 1.398438 6.269531 1.398438zm0 0" fill="#ffa000"/><path d="m343.890625 63.855469c-1.660156-5.117188-5.976563-8.925781-11.257813-9.9375l-42.703124-8.203125-20.996094-38.078125c-2.597656-4.710938-7.554688-7.636719-12.933594-7.636719v150.140625l39.367188 18.460937c1.996093.9375 4.136718 1.398438 6.269531 1.398438 3.066406 0 6.117187-.953125 8.683593-2.820312 4.351563-3.160157 6.640626-8.441407 5.972657-13.78125l-5.394531-43.144532 29.726562-31.734375c3.679688-3.929687 4.929688-9.546875 3.265625-14.664062zm0 0" fill="#ee8700"/><path d="m511.277344 213.855469c-1.664063-5.117188-5.976563-8.925781-11.261719-9.941407l-42.703125-8.203124-20.996094-38.078126c-2.597656-4.710937-7.550781-7.636718-12.933594-7.636718-5.378906 0-10.335937 2.925781-12.933593 7.636718l-20.996094 38.078126-42.699219 8.203124c-5.285156 1.015626-9.597656 4.824219-11.261718 9.941407-1.664063 5.117187-.410157 10.730469 3.265624 14.660156l29.726563 31.734375-5.394531 43.148438c-.667969 5.339843 1.621094 10.617187 5.972656 13.777343 4.351562 3.164063 10.078125 3.710938 14.953125 1.425781l39.367187-18.464843 39.371094 18.464843c1.996094.9375 4.136719 1.398438 6.265625 1.398438 3.070313 0 6.117188-.957031 8.683594-2.820312 4.351563-3.164063 6.640625-8.441407 5.972656-13.78125l-5.394531-43.144532 29.726562-31.738281c3.679688-3.925781 4.933594-9.542969 3.269532-14.660156zm0 0" fill="#ee8700"/><path d="m229.246094 395.914062-42.699219-8.199218-20.996094-38.078125c-2.597656-4.710938-7.554687-7.640625-12.933593-7.640625-5.382813 0-10.335938 2.929687-12.933594 7.640625l-20.996094 38.078125-42.703125 8.199218c-5.285156 1.015626-9.597656 4.824219-11.261719 9.941407-1.660156 5.117187-.410156 10.734375 3.269532 14.660156l29.722656 31.734375-5.394532 43.148438c-.667968 5.339843 1.621094 10.617187 5.976563 13.78125 4.351563 3.160156 10.078125 3.710937 14.949219 1.421874l39.371094-18.464843 39.367187 18.464843c1.996094.9375 4.136719 1.398438 6.269531 1.398438 3.066406 0 6.113282-.957031 8.679688-2.820312 4.355468-3.164063 6.644531-8.441407 5.976562-13.78125l-5.398437-43.148438 29.726562-31.734375c3.679688-3.925781 4.929688-9.542969 3.269531-14.660156-1.660156-5.117188-5.976562-8.925781-11.261718-9.941407zm0 0" fill="#ffa000"/><path d="m436.015625 395.914062-42.703125-8.199218-20.996094-38.078125c-2.597656-4.710938-7.550781-7.640625-12.933594-7.640625-5.378906 0-10.332031 2.929687-12.933593 7.640625l-20.996094 38.078125-42.699219 8.199218c-5.285156 1.015626-9.597656 4.824219-11.261718 9.941407-1.664063 5.117187-.410157 10.734375 3.265624 14.660156l29.726563 31.734375-5.394531 43.148438c-.667969 5.339843 1.621094 10.617187 5.972656 13.78125 4.351562 3.160156 10.078125 3.710937 14.953125 1.421874l39.367187-18.464843 39.371094 18.464843c1.996094.9375 4.136719 1.398438 6.265625 1.398438 3.070313 0 6.117188-.957031 8.683594-2.820312 4.351563-3.164063 6.640625-8.441407 5.972656-13.78125l-5.394531-43.148438 29.726562-31.734375c3.679688-3.925781 4.929688-9.542969 3.265626-14.660156-1.660157-5.117188-5.972657-8.925781-11.257813-9.941407zm0 0" fill="#ee8700"/><path d="m127.984375 318.601562c1.996094.9375 4.136719 1.398438 6.269531 1.398438 3.066406 0 6.113282-.957031 8.683594-2.820312 4.351562-3.164063 6.640625-8.441407 5.972656-13.78125l-5.394531-43.144532 29.722656-31.738281c3.679688-3.925781 4.933594-9.542969 3.269531-14.660156-1.664062-5.117188-5.976562-8.925781-11.261718-9.941407l-42.703125-8.199218-20.996094-38.078125c-2.597656-4.710938-7.550781-7.640625-12.933594-7.640625-5.378906 0-10.335937 2.929687-12.933593 7.640625l-20.992188 38.074219-42.703125 8.203124c-5.285156 1.015626-9.597656 4.824219-11.261719 9.941407-1.660156 5.117187-.410156 10.730469 3.265625 14.660156l29.726563 31.734375-5.394532 43.148438c-.667968 5.339843 1.621094 10.617187 5.972657 13.777343 4.351562 3.164063 10.082031 3.710938 14.953125 1.425781l39.371094-18.464843zm0 0" fill="#ffa000"/></svg>
images/see.svg CHANGED
@@ -1,7 +1,6 @@
1
  <?xml version="1.0" encoding="iso-8859-1"?>
2
  <!-- Generator: Adobe Illustrator 19.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
3
- <svg version="1.1" id="Capa_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
4
- viewBox="0 0 488.85 488.85" style="enable-background:new 0 0 488.85 488.85;" xml:space="preserve">
5
  <g>
6
  <path d="M244.425,98.725c-93.4,0-178.1,51.1-240.6,134.1c-5.1,6.8-5.1,16.3,0,23.1c62.5,83.1,147.2,134.2,240.6,134.2
7
  s178.1-51.1,240.6-134.1c5.1-6.8,5.1-16.3,0-23.1C422.525,149.825,337.825,98.725,244.425,98.725z M251.125,347.025
1
  <?xml version="1.0" encoding="iso-8859-1"?>
2
  <!-- Generator: Adobe Illustrator 19.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
3
+ <svg version="1.1" id="Capa_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" width="20px" height="20px" viewBox="0 0 488.85 488.85" style="enable-background:new 0 0 488.85 488.85;" xml:space="preserve">
 
4
  <g>
5
  <path d="M244.425,98.725c-93.4,0-178.1,51.1-240.6,134.1c-5.1,6.8-5.1,16.3,0,23.1c62.5,83.1,147.2,134.2,240.6,134.2
6
  s178.1-51.1,240.6-134.1c5.1-6.8,5.1-16.3,0-23.1C422.525,149.825,337.825,98.725,244.425,98.725z M251.125,347.025
images/switch-off.svg CHANGED
@@ -1,5 +1,5 @@
1
  <?xml version="1.0"?>
2
- <svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" id="Capa_1" x="0px" y="0px" viewBox="0 0 512 512" style="enable-background:new 0 0 512 512;" xml:space="preserve" width="512px" height="512px" class=""><g><path style="fill:#F3F3F3" d="M373.333,117.333H138.667C62.083,117.333,0,179.417,0,256s62.083,138.667,138.667,138.667h234.667 C449.917,394.667,512,332.583,512,256S449.917,117.333,373.333,117.333z" data-original="#CFD8DC" class="active-path" data-old_color="#F2F2F2"/><circle style="fill:#F44336;" cx="138.667" cy="256" r="96" data-original="#F44336"/><g>
3
  <path style="fill:#455A64" d="M288,309.333c-17.673,0-32-14.327-32-32v-42.667c0-17.673,14.327-32,32-32c17.673,0,32,14.327,32,32 v42.667C320,295.006,305.673,309.333,288,309.333z M288,224c-5.891,0-10.667,4.776-10.667,10.667v42.667 c0,5.891,4.776,10.667,10.667,10.667c5.891,0,10.667-4.776,10.667-10.667v-42.667C298.667,228.776,293.891,224,288,224z" data-original="#455A64" class=""/>
4
  <path style="fill:#455A64" d="M352,309.333c-5.891,0-10.667-4.776-10.667-10.667v-85.333c0-5.891,4.776-10.667,10.667-10.667h32 c5.891,0,10.667,4.776,10.667,10.667c0,5.891-4.776,10.667-10.667,10.667h-21.333v74.667 C362.667,304.558,357.891,309.333,352,309.333z" data-original="#455A64" class=""/>
5
  <path style="fill:#455A64" d="M373.333,266.667H352c-5.891,0-10.667-4.776-10.667-10.667c0-5.891,4.776-10.667,10.667-10.667 h21.333c5.891,0,10.667,4.776,10.667,10.667C384,261.891,379.224,266.667,373.333,266.667z" data-original="#455A64" class=""/>
1
  <?xml version="1.0"?>
2
+ <svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" id="Capa_1" x="0px" y="0px" viewBox="0 0 512 512" style="enable-background:new 0 0 512 512;" xml:space="preserve" width="30px" height="30px" class=""><g><path style="fill:#F3F3F3" d="M373.333,117.333H138.667C62.083,117.333,0,179.417,0,256s62.083,138.667,138.667,138.667h234.667 C449.917,394.667,512,332.583,512,256S449.917,117.333,373.333,117.333z" data-original="#CFD8DC" class="active-path" data-old_color="#F2F2F2"/><circle style="fill:#F44336;" cx="138.667" cy="256" r="96" data-original="#F44336"/><g>
3
  <path style="fill:#455A64" d="M288,309.333c-17.673,0-32-14.327-32-32v-42.667c0-17.673,14.327-32,32-32c17.673,0,32,14.327,32,32 v42.667C320,295.006,305.673,309.333,288,309.333z M288,224c-5.891,0-10.667,4.776-10.667,10.667v42.667 c0,5.891,4.776,10.667,10.667,10.667c5.891,0,10.667-4.776,10.667-10.667v-42.667C298.667,228.776,293.891,224,288,224z" data-original="#455A64" class=""/>
4
  <path style="fill:#455A64" d="M352,309.333c-5.891,0-10.667-4.776-10.667-10.667v-85.333c0-5.891,4.776-10.667,10.667-10.667h32 c5.891,0,10.667,4.776,10.667,10.667c0,5.891-4.776,10.667-10.667,10.667h-21.333v74.667 C362.667,304.558,357.891,309.333,352,309.333z" data-original="#455A64" class=""/>
5
  <path style="fill:#455A64" d="M373.333,266.667H352c-5.891,0-10.667-4.776-10.667-10.667c0-5.891,4.776-10.667,10.667-10.667 h21.333c5.891,0,10.667,4.776,10.667,10.667C384,261.891,379.224,266.667,373.333,266.667z" data-original="#455A64" class=""/>
images/switch-on.svg CHANGED
@@ -1,5 +1,5 @@
1
  <?xml version="1.0"?>
2
- <svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" id="Capa_1" x="0px" y="0px" viewBox="0 0 512 512" style="enable-background:new 0 0 512 512;" xml:space="preserve" width="512px" height="512px" class=""><g><path style="fill:#F3F3F3" d="M373.333,117.333H138.667C62.083,117.333,0,179.417,0,256s62.083,138.667,138.667,138.667h234.667 C449.917,394.667,512,332.583,512,256S449.917,117.333,373.333,117.333z" data-original="#CFD8DC" class="active-path" data-old_color="#f3f3f3"/><circle style="fill:#4CAF50;" cx="373.333" cy="256" r="96" data-original="#4CAF50"/><g>
3
  <path style="fill:#455A64" d="M117.333,309.333c-17.673,0-32-14.327-32-32v-42.667c0-17.673,14.327-32,32-32s32,14.327,32,32 v42.667C149.333,295.006,135.006,309.333,117.333,309.333z M117.333,224c-5.891,0-10.667,4.776-10.667,10.667v42.667 c0,5.891,4.776,10.667,10.667,10.667S128,283.224,128,277.333v-42.667C128,228.776,123.224,224,117.333,224z" data-original="#455A64" class=""/>
4
  <path style="fill:#455A64" d="M224,309.333c-4.037,0-7.728-2.279-9.536-5.888L192,258.517v40.149 c0,5.891-4.776,10.667-10.667,10.667c-5.891,0-10.667-4.776-10.667-10.667v-85.333c0.006-4.941,3.405-9.232,8.213-10.368 c4.819-1.186,9.812,1.151,11.989,5.611l22.464,44.907v-40.149c0-5.891,4.776-10.667,10.667-10.667 c5.891,0,10.667,4.776,10.667,10.667v85.333c-0.006,4.941-3.405,9.232-8.213,10.368C225.651,309.237,224.827,309.337,224,309.333z" data-original="#455A64" class=""/>
5
  </g></g> </svg>
1
  <?xml version="1.0"?>
2
+ <svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" id="Capa_1" x="0px" y="0px" viewBox="0 0 512 512" style="enable-background:new 0 0 512 512;" xml:space="preserve" width="30px" height="30px" class=""><g><path style="fill:#F3F3F3" d="M373.333,117.333H138.667C62.083,117.333,0,179.417,0,256s62.083,138.667,138.667,138.667h234.667 C449.917,394.667,512,332.583,512,256S449.917,117.333,373.333,117.333z" data-original="#CFD8DC" class="active-path" data-old_color="#f3f3f3"/><circle style="fill:#4CAF50;" cx="373.333" cy="256" r="96" data-original="#4CAF50"/><g>
3
  <path style="fill:#455A64" d="M117.333,309.333c-17.673,0-32-14.327-32-32v-42.667c0-17.673,14.327-32,32-32s32,14.327,32,32 v42.667C149.333,295.006,135.006,309.333,117.333,309.333z M117.333,224c-5.891,0-10.667,4.776-10.667,10.667v42.667 c0,5.891,4.776,10.667,10.667,10.667S128,283.224,128,277.333v-42.667C128,228.776,123.224,224,117.333,224z" data-original="#455A64" class=""/>
4
  <path style="fill:#455A64" d="M224,309.333c-4.037,0-7.728-2.279-9.536-5.888L192,258.517v40.149 c0,5.891-4.776,10.667-10.667,10.667c-5.891,0-10.667-4.776-10.667-10.667v-85.333c0.006-4.941,3.405-9.232,8.213-10.368 c4.819-1.186,9.812,1.151,11.989,5.611l22.464,44.907v-40.149c0-5.891,4.776-10.667,10.667-10.667 c5.891,0,10.667,4.776,10.667,10.667v85.333c-0.006,4.941-3.405,9.232-8.213,10.368C225.651,309.237,224.827,309.337,224,309.333z" data-original="#455A64" class=""/>
5
  </g></g> </svg>
images/warning.svg CHANGED
@@ -1,2 +1,2 @@
1
  <?xml version="1.0"?>
2
- <svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" id="Capa_1" x="0px" y="0px" viewBox="0 0 60 60" style="enable-background:new 0 0 60 60;" xml:space="preserve" width="512px" height="512px"><g><path style="fill:none;stroke:#DC9628;stroke-width:2;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:10;" d="M34,12 V8c0-2.209-1.791-4-4-4s-4,1.791-4,4v4.072"/><path style="fill:#EEAF4B;" d="M16.491,50.638c10.701,1.847,16.658,1.847,27.36,0L53.341,49l0,0c-4.685-4.657-7.317-10.415-7.317-17 v-9c0.038-6.047-3.957-10.478-7.946-12.301c-4.999-2.285-10.815-2.294-15.806,0.008C18.319,12.53,14.038,16.958,14,23v9 c0,6.585-2.315,12.343-7,17l0,0L16.491,50.638z" data-original="#EEAF4B"/><path style="fill:#FBD490;" d="M19,25.991c-0.002,0-0.004,0-0.006,0c-0.552-0.004-0.997-0.454-0.994-1.006 c0.03-4.682,3.752-7.643,5.948-8.654c3.849-1.775,8.594-1.772,12.469-0.002c0.502,0.229,0.723,0.822,0.494,1.325 c-0.229,0.502-0.822,0.724-1.326,0.493c-3.354-1.533-7.469-1.537-10.799,0c-1.767,0.814-4.762,3.173-4.785,6.85 C19.997,25.547,19.549,25.991,19,25.991z" data-original="#FBD490"/><path style="fill:#DC9628;" d="M21.906,51.46C23.35,54.728,26.508,57,30.183,57c3.676,0,6.834-2.273,8.278-5.543 C32.533,52.209,27.83,52.21,21.906,51.46z" data-original="#DC9628"/><path style="fill:#F2ECBF;" d="M4.095,39.967c-0.256,0-0.512-0.098-0.707-0.293C1.203,37.489,0,34.58,0,31.483 c0-3.098,1.203-6.006,3.388-8.19c0.391-0.391,1.023-0.391,1.414,0s0.391,1.023,0,1.414C2.995,26.514,2,28.92,2,31.483 c0,2.563,0.995,4.969,2.802,6.776c0.391,0.391,0.391,1.023,0,1.414C4.606,39.869,4.351,39.967,4.095,39.967z" data-original="#F2ECBF" class="active-path"/><path style="fill:#F2ECBF;" d="M8.305,37.69c-0.256,0-0.512-0.098-0.707-0.293c-3.337-3.337-3.337-8.768,0-12.104 c0.391-0.391,1.023-0.391,1.414,0s0.391,1.023,0,1.414c-2.558,2.558-2.558,6.719,0,9.276c0.391,0.391,0.391,1.023,0,1.414 C8.817,37.593,8.561,37.69,8.305,37.69z" data-original="#F2ECBF" class="active-path"/><path style="fill:#F2ECBF;" d="M55.905,39.967c-0.256,0-0.512-0.098-0.707-0.293c-0.391-0.391-0.391-1.023,0-1.414 C57.005,36.452,58,34.046,58,31.483c0-2.563-0.995-4.97-2.802-6.776c-0.391-0.391-0.391-1.023,0-1.414s1.023-0.391,1.414,0 C58.797,25.478,60,28.386,60,31.483c0,3.097-1.203,6.006-3.388,8.19C56.417,39.869,56.161,39.967,55.905,39.967z" data-original="#F2ECBF" class="active-path"/><path style="fill:#F2ECBF;" d="M51.695,37.69c-0.256,0-0.512-0.098-0.707-0.293c-0.391-0.391-0.391-1.023,0-1.414 c2.558-2.558,2.558-6.719,0-9.276c-0.391-0.391-0.391-1.023,0-1.414s1.023-0.391,1.414,0c3.337,3.337,3.337,8.768,0,12.104 C52.207,37.593,51.951,37.69,51.695,37.69z" data-original="#F2ECBF" class="active-path"/></g> </svg>
1
  <?xml version="1.0"?>
2
+ <svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" id="Capa_1" x="0px" y="0px" viewBox="0 0 60 60" style="enable-background:new 0 0 60 60;" xml:space="preserve" width="55px" height="55px"><g><path style="fill:none;stroke:#DC9628;stroke-width:2;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:10;" d="M34,12 V8c0-2.209-1.791-4-4-4s-4,1.791-4,4v4.072"/><path style="fill:#EEAF4B;" d="M16.491,50.638c10.701,1.847,16.658,1.847,27.36,0L53.341,49l0,0c-4.685-4.657-7.317-10.415-7.317-17 v-9c0.038-6.047-3.957-10.478-7.946-12.301c-4.999-2.285-10.815-2.294-15.806,0.008C18.319,12.53,14.038,16.958,14,23v9 c0,6.585-2.315,12.343-7,17l0,0L16.491,50.638z" data-original="#EEAF4B"/><path style="fill:#FBD490;" d="M19,25.991c-0.002,0-0.004,0-0.006,0c-0.552-0.004-0.997-0.454-0.994-1.006 c0.03-4.682,3.752-7.643,5.948-8.654c3.849-1.775,8.594-1.772,12.469-0.002c0.502,0.229,0.723,0.822,0.494,1.325 c-0.229,0.502-0.822,0.724-1.326,0.493c-3.354-1.533-7.469-1.537-10.799,0c-1.767,0.814-4.762,3.173-4.785,6.85 C19.997,25.547,19.549,25.991,19,25.991z" data-original="#FBD490"/><path style="fill:#DC9628;" d="M21.906,51.46C23.35,54.728,26.508,57,30.183,57c3.676,0,6.834-2.273,8.278-5.543 C32.533,52.209,27.83,52.21,21.906,51.46z" data-original="#DC9628"/><path style="fill:#F2ECBF;" d="M4.095,39.967c-0.256,0-0.512-0.098-0.707-0.293C1.203,37.489,0,34.58,0,31.483 c0-3.098,1.203-6.006,3.388-8.19c0.391-0.391,1.023-0.391,1.414,0s0.391,1.023,0,1.414C2.995,26.514,2,28.92,2,31.483 c0,2.563,0.995,4.969,2.802,6.776c0.391,0.391,0.391,1.023,0,1.414C4.606,39.869,4.351,39.967,4.095,39.967z" data-original="#F2ECBF" class="active-path"/><path style="fill:#F2ECBF;" d="M8.305,37.69c-0.256,0-0.512-0.098-0.707-0.293c-3.337-3.337-3.337-8.768,0-12.104 c0.391-0.391,1.023-0.391,1.414,0s0.391,1.023,0,1.414c-2.558,2.558-2.558,6.719,0,9.276c0.391,0.391,0.391,1.023,0,1.414 C8.817,37.593,8.561,37.69,8.305,37.69z" data-original="#F2ECBF" class="active-path"/><path style="fill:#F2ECBF;" d="M55.905,39.967c-0.256,0-0.512-0.098-0.707-0.293c-0.391-0.391-0.391-1.023,0-1.414 C57.005,36.452,58,34.046,58,31.483c0-2.563-0.995-4.97-2.802-6.776c-0.391-0.391-0.391-1.023,0-1.414s1.023-0.391,1.414,0 C58.797,25.478,60,28.386,60,31.483c0,3.097-1.203,6.006-3.388,8.19C56.417,39.869,56.161,39.967,55.905,39.967z" data-original="#F2ECBF" class="active-path"/><path style="fill:#F2ECBF;" d="M51.695,37.69c-0.256,0-0.512-0.098-0.707-0.293c-0.391-0.391-0.391-1.023,0-1.414 c2.558-2.558,2.558-6.719,0-9.276c-0.391-0.391-0.391-1.023,0-1.414s1.023-0.391,1.414,0c3.337,3.337,3.337,8.768,0,12.104 C52.207,37.593,51.951,37.69,51.695,37.69z" data-original="#F2ECBF" class="active-path"/></g> </svg>
includes/class_clean_cron.php CHANGED
@@ -24,37 +24,67 @@ class ADBC_Tasks_List extends WP_List_Table {
24
  private $aDBc_search_has_finished_msg = "";
25
 
26
  // Holds msg that will be shown if folder adbc_uploads cannot be created by the plugin (This is verified after clicking on scan button)
27
- private $aDBc_permission_adbc_folder_msg = "";
28
 
29
- function __construct(){
30
 
31
- parent::__construct(array(
32
- 'singular' => __('Task', 'advanced-database-cleaner'), //singular name of the listed records
33
- 'plural' => __('Tasks', 'advanced-database-cleaner'), //plural name of the listed records
34
- 'ajax' => false //does this table support ajax?
35
- ));
36
 
37
  $this->aDBc_prepare_and_count_tasks();
38
  $this->aDBc_print_page_content();
39
  }
40
 
41
- /** Prepare tasks to display and count tasks for each category */
42
- function aDBc_prepare_and_count_tasks(){
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
43
 
44
- // Verify if the search has finished to let user know about it and invite it to double check against our server
45
- $search_finished = get_option("aDBc_last_search_ok_tasks");
46
- if(!empty($search_finished)){
47
- $this->aDBc_search_has_finished_msg = __('The process of scanning has finished with success!','advanced-database-cleaner');
48
- // Once we display success msg, we delete that option to not be loaded
49
- delete_option("aDBc_last_search_ok_tasks");
50
  }
51
 
52
- // Verify if the adbc_uploads cannot be created
53
- $adbc_folder_permission = get_option("aDBc_permission_adbc_folder_needed");
54
- if(!empty($adbc_folder_permission)){
55
- $this->aDBc_permission_adbc_folder_msg = sprintf(__('The plugin needs to create the following directory "%1$s" to save the scan results but this was not possible automatically. Please create that directory manually and set correct permissions so it can be writable by the plugin.','advanced-database-cleaner'), ADBC_UPLOAD_DIR_PATH_TO_ADBC);
56
- // Once we display the msg, we delete that option from DB
57
- delete_option("aDBc_permission_adbc_folder_needed");
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
58
  }
59
 
60
  // Process bulk action if any before preparing tasks to display
@@ -67,7 +97,7 @@ class ADBC_Tasks_List extends WP_List_Table {
67
  $this->aDBc_which_button_to_show,
68
  array(),
69
  array(),
70
- $this->array_belongs_to_counts,
71
  $this->aDBc_message,
72
  $this->aDBc_class_message,
73
  "tasks"
@@ -78,27 +108,31 @@ class ADBC_Tasks_List extends WP_List_Table {
78
  }
79
 
80
  /** WP: Get columns */
81
- function get_columns(){
 
82
  $aDBc_belongs_to_toolip = "<span class='aDBc-tooltips-headers'>
83
  <img class='aDBc-info-image' src='". ADBC_PLUGIN_DIR_PATH . '/images/information2.svg' . "'/>
84
- <span>" . __('Indicates the creator of the task: either a plugin, a theme or WordPress itself. If not sure about the creator, an estimation (%) will be displayed. The higher the percentage is, the more likely that the task belongs to that creator.','advanced-database-cleaner') ." </span>
85
- </span>";
86
  $columns = array(
87
  'cb' => '<input type="checkbox" />',
88
- 'hook_name' => __('Hook name','advanced-database-cleaner'),
89
- 'arguments' => __('Arguments','advanced-database-cleaner'),
90
- 'next_run' => __('Next run - Frequency','advanced-database-cleaner'),
91
- 'site_id' => __('Site','advanced-database-cleaner'),
92
- 'hook_belongs_to' => __('Belongs to','advanced-database-cleaner') . $aDBc_belongs_to_toolip
93
  );
 
94
  return $columns;
95
  }
96
 
97
  function get_sortable_columns() {
98
 
99
  $sortable_columns = array(
100
- 'hook_name' => array('hook_name',false),
101
- 'site_id' => array('site_id',false)
 
 
102
  );
103
 
104
  return $sortable_columns;
@@ -113,9 +147,9 @@ class ADBC_Tasks_List extends WP_List_Table {
113
  $per_page = 50;
114
  if(!empty($_GET['per_page'])){
115
  $per_page = absint($_GET['per_page']);
116
- }
117
  $current_page = $this->get_pagenum();
118
- // Prepare sequence of options to display
119
  $display_data = array_slice($this->aDBc_tasks_to_display,(($current_page-1) * $per_page), $per_page);
120
  $this->set_pagination_args( array(
121
  'total_items' => count($this->aDBc_tasks_to_display),
@@ -132,17 +166,17 @@ class ADBC_Tasks_List extends WP_List_Table {
132
  }else{
133
  return array('site_id');
134
  }
135
- }
136
 
137
  /** WP: Column default */
138
  function column_default($item, $column_name){
139
  switch($column_name){
140
  case 'arguments':
141
  if($item[$column_name] == "none"){
142
- return "<span style='color:#888'>".__('None', 'advanced-database-cleaner')."</span>";
143
  }else{
144
  $unserialized_args = unserialize($item[$column_name]);
145
- return "<span style='background:#eee;padding:2px;border-radius:2px'>" . implode(" / ", $unserialized_args) . "</span>";
146
  }
147
  break;
148
  case 'hook_name':
@@ -162,37 +196,56 @@ class ADBC_Tasks_List extends WP_List_Table {
162
 
163
  /** WP: Get bulk actions */
164
  function get_bulk_actions() {
 
165
  $actions = array(
166
- 'delete' => __('Delete','advanced-database-cleaner')
 
 
167
  );
 
 
 
 
 
 
 
 
168
  return $actions;
169
  }
170
 
171
  /** WP: Message to display when no items found */
172
  function no_items() {
 
173
  _e('No tasks found!','advanced-database-cleaner');
 
174
  }
175
 
176
  /** WP: Process bulk actions */
177
  public function process_bulk_action() {
 
178
  // security check!
179
- if (isset($_POST['_wpnonce']) && !empty($_POST['_wpnonce'])){
180
- $nonce = filter_input(INPUT_POST, '_wpnonce', FILTER_SANITIZE_STRING);
181
- $action = 'bulk-' . $this->_args['plural'];
182
- if (!wp_verify_nonce( $nonce, $action))
183
- wp_die('Security check failed!');
184
- }else{
185
- // If $_POST['_wpnonce'] is not set, return
 
 
 
186
  return;
187
  }
188
 
189
  // Check role
190
  if(!current_user_can('administrator'))
191
- wp_die('Security check failed!');
192
 
193
  $action = $this->current_action();
194
 
195
  if($action == 'delete'){
 
 
196
  // If the user wants to clean the tasks he/she selected
197
  if(isset($_POST['aDBc_elements_to_process'])){
198
  if(function_exists('is_multisite') && is_multisite()){
@@ -213,8 +266,9 @@ class ADBC_Tasks_List extends WP_List_Table {
213
  switch_to_blog($site_id);
214
  foreach($tasks_info as $task) {
215
  $aDBc_cron_info = explode("|", $task, 4);
 
216
  $hook = sanitize_text_field($aDBc_cron_info[1]);
217
- // We delete some characters we believe they should not appear in the name: & < > = # ( ) [ ] { } ? " '
218
  $hook = preg_replace("/[&<>=#\(\)\[\]\{\}\?\"\' ]/", '', $hook);
219
  $timestamp = sanitize_html_class($aDBc_cron_info[2]);
220
  $args = sanitize_text_field($aDBc_cron_info[3]);
@@ -230,17 +284,17 @@ class ADBC_Tasks_List extends WP_List_Table {
230
  aDBc_update_task_in_db_after_delete(sanitize_html_class($args[0]), "aDBc_clean_schedule");
231
  }else if($hook == "aDBc_optimize_scheduler"){
232
  aDBc_update_task_in_db_after_delete(sanitize_html_class($args[0]), "aDBc_optimize_schedule");
233
- }
234
  }
235
  }
236
  }
237
  restore_current_blog();
238
  }
239
  }else{
240
- foreach($_POST['aDBc_elements_to_process'] as $task){
241
  $aDBc_cron_info = explode("|", $task, 4);
242
  $hook = sanitize_text_field($aDBc_cron_info[1]);
243
- // We delete some characters we believe they should not appear in the name: & < > = # ( ) [ ] { } ? " '
244
  $hook = preg_replace("/[&<>=#\(\)\[\]\{\}\?\"\' ]/", '', $hook);
245
  $timestamp = sanitize_html_class($aDBc_cron_info[2]);
246
  $args = sanitize_text_field($aDBc_cron_info[3]);
@@ -264,7 +318,23 @@ class ADBC_Tasks_List extends WP_List_Table {
264
  // Update the message to show to the user
265
  $this->aDBc_message = __('Selected scheduled tasks cleaned successfully!', 'advanced-database-cleaner');
266
  }
267
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
268
  }
269
 
270
  /** Print the page content */
@@ -274,18 +344,8 @@ class ADBC_Tasks_List extends WP_List_Table {
274
  echo '<div id="aDBc_message" class="' . $this->aDBc_class_message . ' notice is-dismissible"><p>' . $this->aDBc_message . '</p></div>';
275
  }
276
 
277
- // Verify if the ajax call is still searching in background to prevent enabling the button
278
- $still_searching = get_option("aDBc_temp_still_searching_tasks");
279
- if(!empty($still_searching)){
280
- // This means that the ajax call is still searching
281
- $aDBc_still_searching_msg = __('The process of categorization is still scanning tasks in background. Maybe you have reloaded the page before it finishes the scan. The scan will stop automatically after scanning all items or after timeout.','advanced-database-cleaner');
282
- echo '<div class="error notice is-dismissible"><p>' . $aDBc_still_searching_msg . '</p></div>';
283
- }
284
-
285
- // If the search has finished, show a msg to users
286
- if(!empty($this->aDBc_search_has_finished_msg)){
287
- echo '<div class="updated notice is-dismissible"><p>' . $this->aDBc_search_has_finished_msg . '</p></div>';
288
- }
289
 
290
  // If the folder adbc_uploads cannot be created, show a msg to users
291
  if(!empty($this->aDBc_permission_adbc_folder_msg)){
@@ -295,88 +355,168 @@ class ADBC_Tasks_List extends WP_List_Table {
295
  ?>
296
  <div class="aDBc-content-max-width">
297
 
298
- <?php
299
- // zzz
300
- $msg1 = __('Tasks below seem to be orphan! However, please delete only those you are sure to be orphan!','advanced-database-cleaner');
301
- $msg2 = __('Some of your tasks are not categorized yet! Please click on the button below to categorize them!','advanced-database-cleaner');
302
- ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
303
 
304
  <div class="aDBc-clear-both" style="margin-top:15px"></div>
305
 
306
  <!-- Code for "run new search" button + Show loading image -->
307
- <div style="float:left;">
308
- <?php
309
- if($this->aDBc_which_button_to_show == "new_search" ){
310
- $aDBc_search_text = __('Scan tasks','advanced-database-cleaner');
311
- }else{
312
- $aDBc_search_text = __('Continue scannig ...','advanced-database-cleaner');
 
313
  }
314
  ?>
315
 
316
- <!-- This hidden input is used by ajax to know which item type we are dealing with -->
317
  <input type="hidden" id="aDBc_item_type" value="tasks"/>
318
- <?php
319
- // These hidden inputs are used by ajax to see if we should execute scanning process automatically by ajax after reloading a page
 
320
  $iteration = get_option("aDBc_temp_last_iteration_tasks");
321
  ?>
322
- <input type="hidden" id="aDBc_still_searching" value="<?php echo $still_searching; ?>"/>
323
  <input type="hidden" id="aDBc_iteration" value="<?php echo $iteration; ?>"/>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
324
 
325
- <div class="aDBc_premium_tooltip">
326
- <input id="aDBc_new_search_button" type="submit" class="aDBc-run-new-search" value="<?php echo $aDBc_search_text; ?>" name="aDBc_new_search_button" style="opacity:0.5" disabled/>
327
- <span style="width:380px" class="aDBc_premium_tooltiptext"><?php _e('Please <a href="?page=advanced_db_cleaner&aDBc_tab=premium">upgrade</a> to Pro to categorize and detect orphaned tasks','advanced-database-cleaner') ?></span>
328
- </div>
329
 
330
  </div>
331
 
332
- <!-- Print numbers of tasks found in each category -->
333
  <div class="aDBc-category-counts">
 
334
  <?php
 
335
  $aDBc_new_URI = $_SERVER['REQUEST_URI'];
336
- // Remove the paged parameter to start always from the first page when selecting a new category of tables
337
- $aDBc_new_URI = remove_query_arg('paged', $aDBc_new_URI);
338
- $iterations = 0;
339
- foreach($this->aDBc_tasks_categories_info as $abreviation => $category_info){
340
- $iterations++;
341
- $aDBc_new_URI = add_query_arg('aDBc_cat', $abreviation, $aDBc_new_URI);?>
342
- <span class="<?php echo $abreviation == $_GET['aDBc_cat'] ? 'aDBc-selected-category' : ''?>" style="<?php echo $abreviation == $_GET['aDBc_cat'] ? 'border-bottom: 1px solid ' . $category_info['color'] : '' ?>">
343
-
344
- <?php
345
- if($abreviation == "all"|| $abreviation == "u"){
346
- $aDBc_link_style = "color:" . $category_info['color'];
347
- $aDBc_category_info_count = "(". $category_info['count'] . ")";
348
- }else{
349
- $aDBc_link_style = "color:" . $category_info['color'] . ";cursor:default;pointer-events:none";
350
- $aDBc_category_info_count = "(*)";
351
- $aDBc_new_URI = "";
352
- }
353
- ?>
354
 
355
- <span class="aDBc_premium_tooltip">
356
- <a href="<?php echo $aDBc_new_URI; ?>" class="aDBc-category-counts-links" style="<?php echo $aDBc_link_style ; ?>">
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
357
  <span><?php echo $category_info['name']; ?></span>
358
- <span><?php echo $aDBc_category_info_count ;?></span>
359
  </a>
360
- <?php if($abreviation != "all" && $abreviation != "u"){ ?>
361
- <span style="width:150px" class="aDBc_premium_tooltiptext"><?php _e('Available in Pro version!','advanced-database-cleaner') ?></span>
362
- <?php } ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
363
  </span>
364
 
365
  </span>
366
- <?php
367
- if($iterations < 6){
368
- echo '<span class="aDBc-category-separator">|</span>';
369
- }
370
- }?>
371
- </div>
372
 
373
  <div class="aDBc-clear-both"></div>
374
 
375
- <div id="aDBc_progress_container">
376
- <div style="background:#ccc;width:100%;height:20px">
377
- <div id="aDBc-progress-bar" class="aDBc_progress-bar"></div>
 
378
  </div>
379
- <div id="aDBc-response_container"></div>
 
 
 
 
 
 
 
 
380
  </div>
381
 
382
  <?php include_once 'header_page_filter.php'; ?>
@@ -384,18 +524,20 @@ class ADBC_Tasks_List extends WP_List_Table {
384
  <div class="aDBc-clear-both"></div>
385
 
386
  <form id="aDBc_form" action="" method="post">
 
387
  <?php
388
- // Print the tasks
389
  $this->display();
390
  ?>
391
- </form>
392
 
 
 
 
 
393
  </div>
394
-
395
  <?php
396
  }
397
  }
398
 
399
  new ADBC_Tasks_List();
400
 
401
- ?>
24
  private $aDBc_search_has_finished_msg = "";
25
 
26
  // Holds msg that will be shown if folder adbc_uploads cannot be created by the plugin (This is verified after clicking on scan button)
27
+ private $aDBc_permission_adbc_folder_msg = "";
28
 
29
+ function __construct() {
30
 
31
+ parent::__construct( array(
32
+ 'singular' => __( 'Task', 'advanced-database-cleaner' ),
33
+ 'plural' => __( 'Tasks', 'advanced-database-cleaner' ),
34
+ 'ajax' => false
35
+ ) );
36
 
37
  $this->aDBc_prepare_and_count_tasks();
38
  $this->aDBc_print_page_content();
39
  }
40
 
41
+ /** Prepare items */
42
+ function aDBc_prepare_and_count_tasks() {
43
+
44
+ if ( ADBC_PLUGIN_PLAN == "pro" ) {
45
+
46
+ // If the search has finished, show a msg success to users + button to double check results against our server database
47
+ $this->aDBc_search_has_finished_msg = aDBc_get_msg_double_check( "tasks" );
48
+
49
+ // Verify if the adbc_uploads cannot be created
50
+ $adbc_folder_permission = get_option( "aDBc_permission_adbc_folder_needed" );
51
+
52
+ if ( ! empty( $adbc_folder_permission ) ) {
53
+
54
+ $this->aDBc_permission_adbc_folder_msg = sprintf( __( 'The plugin needs to create the following directory "%1$s" to save the scan results but this was not possible automatically. Please create that directory manually and set correct permissions so it can be writable by the plugin.','advanced-database-cleaner' ), ADBC_UPLOAD_DIR_PATH_TO_ADBC );
55
+
56
+ // Once we display the msg, we delete that option from DB
57
+ delete_option( "aDBc_permission_adbc_folder_needed" );
58
+
59
+ }
60
 
 
 
 
 
 
 
61
  }
62
 
63
+ // Verify if the user wants to edit the categorization of a task. This block test comes from edit_item_categorization.php
64
+ if ( ADBC_PLUGIN_PLAN == "pro" ) {
65
+
66
+ if ( isset( $_POST['aDBc_cancel'] ) ) {
67
+
68
+ // If the user cancels the edit, remove the temp file
69
+ if ( file_exists( ADBC_UPLOAD_DIR_PATH_TO_ADBC . "/tasks_manually_correction_temp.txt" ) )
70
+ unlink( ADBC_UPLOAD_DIR_PATH_TO_ADBC . "/tasks_manually_correction_temp.txt" );
71
+
72
+ } else if ( isset( $_POST['aDBc_correct'] ) ) {
73
+
74
+ // Get the new belongs to of items
75
+ $new_belongs_to = $_POST['new_belongs_to'];
76
+
77
+ // Get value of checkbox to see if user wants to send correction to the server
78
+ if ( isset( $_POST['aDBc_send_correction_to_server'] ) ) {
79
+ $this->aDBc_message = aDBc_edit_categorization_of_items( "tasks", $new_belongs_to, 1 );
80
+ } else {
81
+ $this->aDBc_message = aDBc_edit_categorization_of_items( "tasks", $new_belongs_to, 0 );
82
+ }
83
+
84
+ // Remove the temp file
85
+ if ( file_exists( ADBC_UPLOAD_DIR_PATH_TO_ADBC . "/tasks_manually_correction_temp.txt" ) )
86
+ unlink( ADBC_UPLOAD_DIR_PATH_TO_ADBC . "/tasks_manually_correction_temp.txt" );
87
+ }
88
  }
89
 
90
  // Process bulk action if any before preparing tasks to display
97
  $this->aDBc_which_button_to_show,
98
  array(),
99
  array(),
100
+ $this->array_belongs_to_counts,
101
  $this->aDBc_message,
102
  $this->aDBc_class_message,
103
  "tasks"
108
  }
109
 
110
  /** WP: Get columns */
111
+ function get_columns() {
112
+
113
  $aDBc_belongs_to_toolip = "<span class='aDBc-tooltips-headers'>
114
  <img class='aDBc-info-image' src='". ADBC_PLUGIN_DIR_PATH . '/images/information2.svg' . "'/>
115
+ <span>" . __( 'Indicates the creator of the task: either a plugin, a theme or WordPress itself. If not sure about the creator, an estimation (%) will be displayed. The higher the percentage is, the more likely that the task belongs to that creator.','advanced-database-cleaner' ) ." </span>
116
+ </span>";
117
  $columns = array(
118
  'cb' => '<input type="checkbox" />',
119
+ 'hook_name' => __( 'Hook name','advanced-database-cleaner' ),
120
+ 'arguments' => __( 'Arguments','advanced-database-cleaner' ),
121
+ 'next_run' => __( 'Next run - Frequency','advanced-database-cleaner' ),
122
+ 'site_id' => __( 'Site','advanced-database-cleaner' ),
123
+ 'hook_belongs_to' => __( 'Belongs to','advanced-database-cleaner' ) . $aDBc_belongs_to_toolip
124
  );
125
+
126
  return $columns;
127
  }
128
 
129
  function get_sortable_columns() {
130
 
131
  $sortable_columns = array(
132
+
133
+ 'hook_name' => array( 'hook_name', false ),
134
+ 'site_id' => array( 'site_id', false )
135
+
136
  );
137
 
138
  return $sortable_columns;
147
  $per_page = 50;
148
  if(!empty($_GET['per_page'])){
149
  $per_page = absint($_GET['per_page']);
150
+ }
151
  $current_page = $this->get_pagenum();
152
+ // Prepare sequence of tasks to display
153
  $display_data = array_slice($this->aDBc_tasks_to_display,(($current_page-1) * $per_page), $per_page);
154
  $this->set_pagination_args( array(
155
  'total_items' => count($this->aDBc_tasks_to_display),
166
  }else{
167
  return array('site_id');
168
  }
169
+ }
170
 
171
  /** WP: Column default */
172
  function column_default($item, $column_name){
173
  switch($column_name){
174
  case 'arguments':
175
  if($item[$column_name] == "none"){
176
+ return "<span>" . __('None', 'advanced-database-cleaner') . "</span>";
177
  }else{
178
  $unserialized_args = unserialize($item[$column_name]);
179
+ return "<span class='aDBc-arguments'>" . implode(" / ", $unserialized_args) . "</span>";
180
  }
181
  break;
182
  case 'hook_name':
196
 
197
  /** WP: Get bulk actions */
198
  function get_bulk_actions() {
199
+
200
  $actions = array(
201
+ 'scan_selected' => __( 'Scan selected tasks','advanced-database-cleaner' ),
202
+ 'edit_categorization' => __( 'Edit categorization','advanced-database-cleaner' ),
203
+ 'delete' => __( 'Delete','advanced-database-cleaner' )
204
  );
205
+
206
+ if ( ADBC_PLUGIN_PLAN == "free" ) {
207
+
208
+ unset( $actions['scan_selected'] );
209
+ unset( $actions['edit_categorization'] );
210
+
211
+ }
212
+
213
  return $actions;
214
  }
215
 
216
  /** WP: Message to display when no items found */
217
  function no_items() {
218
+
219
  _e('No tasks found!','advanced-database-cleaner');
220
+
221
  }
222
 
223
  /** WP: Process bulk actions */
224
  public function process_bulk_action() {
225
+
226
  // security check!
227
+ if ( isset( $_POST['_wpnonce'] ) && !empty( $_POST['_wpnonce'] ) ) {
228
+
229
+ $nonce = filter_input( INPUT_POST, '_wpnonce', FILTER_SANITIZE_STRING );
230
+ $action = 'bulk-' . $this->_args['plural'];
231
+
232
+ if ( !wp_verify_nonce( $nonce, $action ) )
233
+ wp_die( 'Security check failed!' );
234
+
235
+ } else {
236
+
237
  return;
238
  }
239
 
240
  // Check role
241
  if(!current_user_can('administrator'))
242
+ wp_die('Security check failed!');
243
 
244
  $action = $this->current_action();
245
 
246
  if($action == 'delete'){
247
+
248
+ // xxx Have a look at the remark with the code 16230-code in Trello
249
  // If the user wants to clean the tasks he/she selected
250
  if(isset($_POST['aDBc_elements_to_process'])){
251
  if(function_exists('is_multisite') && is_multisite()){
266
  switch_to_blog($site_id);
267
  foreach($tasks_info as $task) {
268
  $aDBc_cron_info = explode("|", $task, 4);
269
+
270
  $hook = sanitize_text_field($aDBc_cron_info[1]);
271
+ // We delete some characters we believe they should not appear in the name: & < > = # ( ) [ ] { } ? " '
272
  $hook = preg_replace("/[&<>=#\(\)\[\]\{\}\?\"\' ]/", '', $hook);
273
  $timestamp = sanitize_html_class($aDBc_cron_info[2]);
274
  $args = sanitize_text_field($aDBc_cron_info[3]);
284
  aDBc_update_task_in_db_after_delete(sanitize_html_class($args[0]), "aDBc_clean_schedule");
285
  }else if($hook == "aDBc_optimize_scheduler"){
286
  aDBc_update_task_in_db_after_delete(sanitize_html_class($args[0]), "aDBc_optimize_schedule");
287
+ }
288
  }
289
  }
290
  }
291
  restore_current_blog();
292
  }
293
  }else{
294
+ foreach($_POST['aDBc_elements_to_process'] as $task) {
295
  $aDBc_cron_info = explode("|", $task, 4);
296
  $hook = sanitize_text_field($aDBc_cron_info[1]);
297
+ // We delete some characters we believe they should not appear in the name: & < > = # ( ) [ ] { } ? " '
298
  $hook = preg_replace("/[&<>=#\(\)\[\]\{\}\?\"\' ]/", '', $hook);
299
  $timestamp = sanitize_html_class($aDBc_cron_info[2]);
300
  $args = sanitize_text_field($aDBc_cron_info[3]);
318
  // Update the message to show to the user
319
  $this->aDBc_message = __('Selected scheduled tasks cleaned successfully!', 'advanced-database-cleaner');
320
  }
321
+ }else if($action == 'edit_categorization'){
322
+ // If the user wants to edit categorization of the tasks he/she selected
323
+ if(isset($_POST['aDBc_elements_to_process'])){
324
+ // Create a temp file containing tasks names to change categorization for
325
+ $aDBc_path_items = @fopen(ADBC_UPLOAD_DIR_PATH_TO_ADBC . "/tasks_manually_correction_temp.txt", "w");
326
+ if($aDBc_path_items){
327
+ foreach($_POST['aDBc_elements_to_process'] as $task) {
328
+ $task_info = explode("|", $task);
329
+ $hook = sanitize_text_field($task_info[1]);
330
+ // We delete some characters we believe they should not appear in the name: & < > = # ( ) [ ] { } ? " '
331
+ $hook = preg_replace("/[&<>=#\(\)\[\]\{\}\?\"\' ]/", '', $hook);
332
+ fwrite($aDBc_path_items, $hook . "\n");
333
+ }
334
+ fclose($aDBc_path_items);
335
+ }
336
+ }
337
+ }
338
  }
339
 
340
  /** Print the page content */
344
  echo '<div id="aDBc_message" class="' . $this->aDBc_class_message . ' notice is-dismissible"><p>' . $this->aDBc_message . '</p></div>';
345
  }
346
 
347
+ // If the search has finished, show a msg success to users + button to double check results against our server database
348
+ echo $this->aDBc_search_has_finished_msg;
 
 
 
 
 
 
 
 
 
 
349
 
350
  // If the folder adbc_uploads cannot be created, show a msg to users
351
  if(!empty($this->aDBc_permission_adbc_folder_msg)){
355
  ?>
356
  <div class="aDBc-content-max-width">
357
 
358
+ <?php
359
+
360
+ // If tasks_manually_correction_temp.txt exist, this means that user want to edit categorization
361
+
362
+ if ( ADBC_PLUGIN_PLAN == "pro" && file_exists( ADBC_UPLOAD_DIR_PATH_TO_ADBC . '/tasks_manually_correction_temp.txt' ) ) {
363
+
364
+ include_once 'edit_item_categorization.php';
365
+
366
+ } else {
367
+
368
+ // If not, we print the tasks normally
369
+ // Print a notice/warning according to each type of tasks
370
+ if ( ADBC_PLUGIN_PLAN == "pro" ) {
371
+
372
+ if($_GET['aDBc_cat'] == 'o' && $this->aDBc_tasks_categories_info['o']['count'] > 0){
373
+ echo '<div class="aDBc-box-warning-orphan">' . __('Tasks below seem to be orphan! However, please delete only those you are sure to be orphan!','advanced-database-cleaner') . '</div>';
374
+ }else if(($_GET['aDBc_cat'] == 'all' || $_GET['aDBc_cat'] == 'u') && $this->aDBc_tasks_categories_info['u']['count'] > 0){
375
+ echo '<div class="aDBc-box-info">' . __('Some of your tasks are not categorized yet! Please click on the button below to categorize them!','advanced-database-cleaner') . '</div>';
376
+ }
377
+
378
+ }
379
+
380
+ ?>
381
 
382
  <div class="aDBc-clear-both" style="margin-top:15px"></div>
383
 
384
  <!-- Code for "run new search" button + Show loading image -->
385
+ <div style="float:left">
386
+
387
+ <?php
388
+ if ( $this->aDBc_which_button_to_show == "new_search" ) {
389
+ $aDBc_search_text = __( 'Scan tasks', 'advanced-database-cleaner' );
390
+ } else {
391
+ $aDBc_search_text = __( 'Continue scannig ...', 'advanced-database-cleaner' );
392
  }
393
  ?>
394
 
395
+ <!-- Hidden input used by ajax to know which item type we are dealing with -->
396
  <input type="hidden" id="aDBc_item_type" value="tasks"/>
397
+
398
+ <?php
399
+ // These hidden inputs are used by ajax to see if we should execute the scan automatically after reloading a page
400
  $iteration = get_option("aDBc_temp_last_iteration_tasks");
401
  ?>
 
402
  <input type="hidden" id="aDBc_iteration" value="<?php echo $iteration; ?>"/>
403
+ <input type="hidden" id="aDBc_count_uncategorized" value="<?php echo $this->aDBc_tasks_categories_info['u']['count']; ?>"/>
404
+ <input type="hidden" id="aDBc_count_all_items" value="<?php echo $this->aDBc_tasks_categories_info['all']['count']; ?>"/>
405
+
406
+ <?php
407
+
408
+ if ( ADBC_PLUGIN_PLAN == "pro" ) {
409
+
410
+ ?>
411
+
412
+ <input id="aDBc_new_search_button" type="submit" class="aDBc-run-new-search" value="<?php echo $aDBc_search_text; ?>" name="aDBc_new_search_button" />
413
+
414
+ <?php
415
+
416
+ } else {
417
+
418
+ ?>
419
+
420
+ <div class="aDBc-premium-tooltip">
421
+
422
+ <input id="aDBc_new_search_button" type="submit" class="aDBc-run-new-search" value="<?php echo $aDBc_search_text; ?>" name="aDBc_new_search_button" style="opacity:0.5" disabled />
423
+
424
+ <span style="width:390px" class="aDBc-premium-tooltiptext">
425
+
426
+ <?php _e('Please <a href="?page=advanced_db_cleaner&aDBc_tab=premium">upgrade</a> to Pro to categorize and detect orphaned tasks','advanced-database-cleaner') ?>
427
+
428
+ </span>
429
+
430
+ </div>
431
+
432
+ <?php
433
+ }
434
+ ?>
435
 
 
 
 
 
436
 
437
  </div>
438
 
439
+ <!-- Print numbers of items found in each category -->
440
  <div class="aDBc-category-counts">
441
+
442
  <?php
443
+
444
  $aDBc_new_URI = $_SERVER['REQUEST_URI'];
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
445
 
446
+ // Remove the paged parameter to start always from the first page when selecting a new category
447
+ $aDBc_new_URI = remove_query_arg( 'paged', $aDBc_new_URI );
448
+
449
+ foreach ( $this->aDBc_tasks_categories_info as $abreviation => $category_info ) {
450
+
451
+ $aDBc_new_URI = add_query_arg( 'aDBc_cat', $abreviation, $aDBc_new_URI );
452
+ $selected_color = $abreviation == $_GET['aDBc_cat'] ? $category_info['color'] : '#eee';
453
+ $aDBc_link_style = "color:" . $category_info['color'];
454
+ $aDBc_count = $category_info['count'];
455
+
456
+ if ( ADBC_PLUGIN_PLAN == "free" && $abreviation != "all" && $abreviation != "u" ) {
457
+
458
+ $aDBc_new_URI = "";
459
+ $aDBc_link_style = $aDBc_link_style . ";cursor:default;pointer-events:none";
460
+ $aDBc_count = "-";
461
+
462
+ }
463
+
464
+ ?>
465
+ <span class="<?php echo $abreviation == $_GET['aDBc_cat'] ? 'aDBc-selected-category' : ''?>">
466
+
467
+ <span class="aDBc-premium-tooltip aDBc-category-span">
468
+
469
+ <a href="<?php echo $aDBc_new_URI ?>" class="aDBc-category-counts-links" style="<?php echo $aDBc_link_style ?>">
470
+
471
  <span><?php echo $category_info['name']; ?></span>
472
+
473
  </a>
474
+
475
+ <div class="aDBc-category-total" style="border:1px solid <?php echo $selected_color ?>; border-bottom:3px solid <?php echo $selected_color ?>;">
476
+
477
+ <span style="color:#000"><?php echo $aDBc_count ?></span>
478
+
479
+ </div>
480
+
481
+ <?php
482
+ if ( ADBC_PLUGIN_PLAN == "free" && $abreviation != "all" && $abreviation != "u" ) {
483
+ ?>
484
+
485
+ <span style="width:150px" class="aDBc-premium-tooltiptext">
486
+
487
+ <?php _e( 'Available in Pro version!', 'advanced-database-cleaner' ); ?>
488
+
489
+ </span>
490
+
491
+ <?php
492
+ }
493
+ ?>
494
+
495
  </span>
496
 
497
  </span>
498
+
499
+ <?php
500
+ }
501
+ ?>
502
+ </div>
 
503
 
504
  <div class="aDBc-clear-both"></div>
505
 
506
+ <div id="aDBc-progress-container">
507
+
508
+ <div class="aDBc-progress-background">
509
+ <div id="aDBc-progress-bar" class="aDBc-progress-bar"></div>
510
  </div>
511
+
512
+ <a id="aDBc_stop_scan" href="#" style="color:red">
513
+ <?php _e('Stop the scan','advanced-database-cleaner') ?>
514
+ </a>
515
+
516
+ <span id="aDBc_stopping_msg" style="display:none">
517
+ <?php _e('Stopping...','advanced-database-cleaner') ?>
518
+ </span>
519
+
520
  </div>
521
 
522
  <?php include_once 'header_page_filter.php'; ?>
524
  <div class="aDBc-clear-both"></div>
525
 
526
  <form id="aDBc_form" action="" method="post">
527
+
528
  <?php
 
529
  $this->display();
530
  ?>
 
531
 
532
+ </form>
533
+ <?php
534
+ }
535
+ ?>
536
  </div>
 
537
  <?php
538
  }
539
  }
540
 
541
  new ADBC_Tasks_List();
542
 
543
+ ?>
includes/class_clean_options.php CHANGED
@@ -16,7 +16,7 @@ class ADBC_Options_List extends WP_List_Table {
16
 
17
  /** Should we display "run search" or "continue search" button (after a timeout failed). Default is "run search" */
18
  private $aDBc_which_button_to_show = "new_search";
19
-
20
  // This array contains belongs_to info about plugins and themes
21
  private $array_belongs_to_counts = array();
22
 
@@ -24,37 +24,67 @@ class ADBC_Options_List extends WP_List_Table {
24
  private $aDBc_search_has_finished_msg = "";
25
 
26
  // Holds msg that will be shown if folder adbc_uploads cannot be created by the plugin (This is verified after clicking on scan button)
27
- private $aDBc_permission_adbc_folder_msg = "";
28
 
29
  function __construct(){
30
 
31
  parent::__construct(array(
32
- 'singular' => __('Option', 'advanced-database-cleaner'), //singular name of the listed records
33
- 'plural' => __('Options', 'advanced-database-cleaner'), //plural name of the listed records
34
- 'ajax' => false //does this table support ajax?
35
  ));
36
 
37
  $this->aDBc_prepare_and_count_options();
38
  $this->aDBc_print_page_content();
39
  }
40
 
41
- /** Prepare options to display and count options for each category */
42
- function aDBc_prepare_and_count_options(){
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
43
 
44
- // Verify if the search has finished to let user know about it and invite it to double check against our server
45
- $search_finished = get_option("aDBc_last_search_ok_options");
46
- if(!empty($search_finished)){
47
- $this->aDBc_search_has_finished_msg = __('The process of scanning has finished with success!','advanced-database-cleaner');
48
- // Once we display success msg, we delete that option to not be loaded
49
- delete_option("aDBc_last_search_ok_options");
50
  }
51
 
52
- // Verify if the adbc_uploads cannot be created
53
- $adbc_folder_permission = get_option("aDBc_permission_adbc_folder_needed");
54
- if(!empty($adbc_folder_permission)){
55
- $this->aDBc_permission_adbc_folder_msg = sprintf(__('The plugin needs to create the following directory "%1$s" to save the scan results but this was not possible automatically. Please create that directory manually and set correct permissions so it can be writable by the plugin.','advanced-database-cleaner'), ADBC_UPLOAD_DIR_PATH_TO_ADBC);
56
- // Once we display the msg, we delete that option from DB
57
- delete_option("aDBc_permission_adbc_folder_needed");
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
58
  }
59
 
60
  // Process bulk action if any before preparing options to display
@@ -84,10 +114,10 @@ class ADBC_Options_List extends WP_List_Table {
84
  <span>" . __('Indicates the creator of the option: either a plugin, a theme or WordPress itself. If not sure about the creator, an estimation (%) will be displayed. The higher the percentage is, the more likely that the option belongs to that creator.','advanced-database-cleaner') ." </span>
85
  </span>";
86
 
87
- $aDBc_option_size_toolip = "<span class='aDBc-tooltips-headers' style='position: absolute;margin-left:15px'>
88
  <img class='aDBc-info-image' src='". ADBC_PLUGIN_DIR_PATH . '/images/information2.svg' . "'/>
89
  <span>" . __('The size is in Bits! This is an estimation, not a precise value!','advanced-database-cleaner') ." </span>
90
- </span>";
91
 
92
  $columns = array(
93
  'cb' => '<input type="checkbox" />',
@@ -122,7 +152,7 @@ class ADBC_Options_List extends WP_List_Table {
122
  $per_page = 50;
123
  if(!empty($_GET['per_page'])){
124
  $per_page = absint($_GET['per_page']);
125
- }
126
  $current_page = $this->get_pagenum();
127
  // Prepare sequence of options to display
128
  $display_data = array_slice($this->aDBc_options_to_display,(($current_page-1) * $per_page), $per_page);
@@ -141,7 +171,7 @@ class ADBC_Options_List extends WP_List_Table {
141
  }else{
142
  return array('site_id');
143
  }
144
- }
145
 
146
  /** WP: Column default */
147
  function column_default($item, $column_name){
@@ -165,29 +195,46 @@ class ADBC_Options_List extends WP_List_Table {
165
 
166
  /** WP: Get bulk actions */
167
  function get_bulk_actions() {
 
168
  $actions = array(
169
- 'delete' => __('Delete','advanced-database-cleaner'),
170
- 'autoload_yes' => __('Set autoload to yes','advanced-database-cleaner'),
171
- 'autoload_no' => __('Set autoload to no','advanced-database-cleaner')
 
 
172
  );
 
 
 
 
 
 
 
 
173
  return $actions;
174
  }
175
 
176
  /** WP: Message to display when no items found */
177
  function no_items() {
178
- _e('No options found!','advanced-database-cleaner');
 
 
179
  }
180
 
181
  /** WP: Process bulk actions */
182
  public function process_bulk_action() {
 
183
  // security check!
184
- if (isset($_POST['_wpnonce']) && !empty($_POST['_wpnonce'])){
185
- $nonce = filter_input(INPUT_POST, '_wpnonce', FILTER_SANITIZE_STRING);
 
186
  $action = 'bulk-' . $this->_args['plural'];
187
- if (!wp_verify_nonce( $nonce, $action))
188
- wp_die('Security check failed!');
189
- }else{
190
- // If $_POST['_wpnonce'] is not set, return
 
 
191
  return;
192
  }
193
 
@@ -211,7 +258,7 @@ class ADBC_Options_List extends WP_List_Table {
211
  if(empty($options_to_delete[$site_id])){
212
  $options_to_delete[$site_id] = array();
213
  }
214
- // We delete some characters we believe they should not appear in the name: & < > = # ( ) [ ] { } ? " '
215
  $option_name = preg_replace("/[&<>=#\(\)\[\]\{\}\?\"\' ]/", '', $option_name);
216
  array_push($options_to_delete[$site_id], $option_name);
217
  }
@@ -228,7 +275,7 @@ class ADBC_Options_List extends WP_List_Table {
228
  foreach($_POST['aDBc_elements_to_process'] as $option) {
229
  $aDBc_option_info = explode("|", $option);
230
  $option_name = sanitize_text_field($aDBc_option_info[1]);
231
- // We delete some characters we believe they should not appear in the name: & < > = # ( ) [ ] { } ? " '
232
  $option_name = preg_replace("/[&<>=#\(\)\[\]\{\}\?\"\' ]/", '', $option_name);
233
  delete_option($option_name);
234
  }
@@ -245,7 +292,7 @@ class ADBC_Options_List extends WP_List_Table {
245
  }
246
 
247
  // If the user wants to change autoload to yes for selected options
248
- // 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?
249
  if(isset($_POST['aDBc_elements_to_process'])){
250
  $additional_msg = "";
251
  if(function_exists('is_multisite') && is_multisite()){
@@ -254,38 +301,47 @@ class ADBC_Options_List extends WP_List_Table {
254
  foreach($_POST['aDBc_elements_to_process'] as $option){
255
  $option_info = explode("|", $option);
256
  $site_id = sanitize_html_class($option_info[0]);
257
- $option_name = sanitize_text_field($option_info[1]);
258
  if(is_numeric($site_id)){
259
  if(empty($options_to_process[$site_id])){
260
  $options_to_process[$site_id] = array();
261
  }
262
- // We delete some characters we believe they should not appear in the name: & < > = # ( ) [ ] { } ? " '
263
  $option_name = preg_replace("/[&<>=#\(\)\[\]\{\}\?\"\' ]/", '', $option_name);
264
  array_push($options_to_process[$site_id], $option_name);
265
  }
266
  }
 
267
  // Change autoload
268
- foreach($options_to_process as $site_id => $options){
269
- switch_to_blog($site_id);
270
- foreach($options as $option){
271
- // In adbc-edd-sample-plugin, EDD deletes aDBc_edd_license_status if aDBc_edd_license_key has been changed
272
- // This means that we should not change its value to prevent this to happen
273
- if($option != "aDBc_edd_license_key"){
274
- $options_value = get_option($option);
275
- update_option($option, "xyz");
276
- update_option($option, $options_value, $autoload_value);
277
- }else{
278
- $additional_msg = "<span style='color:orange'>" . __('For technical concerns, the option aDBc_edd_license_key cannot be changed!', 'advanced-database-cleaner') . "</span>";
 
 
 
 
 
 
279
  }
280
  }
 
281
  restore_current_blog();
282
  }
 
283
  }else{
284
  foreach($_POST['aDBc_elements_to_process'] as $option) {
285
  $aDBc_option_info = explode("|", $option);
286
  $option_name = sanitize_text_field($aDBc_option_info[1]);
287
- // We delete some characters we believe they should not appear in the name: & < > = # ( ) [ ] { } ? " '
288
- $option_name = preg_replace("/[&<>=#\(\)\[\]\{\}\?\"\' ]/", '', $option_name);
289
  // In adbc-edd-sample-plugin, EDD deletes aDBc_edd_license_status if aDBc_edd_license_key has been changed
290
  // This means that we should not change its value to prevent this to happen
291
  if($option_name != "aDBc_edd_license_key"){
@@ -302,6 +358,22 @@ class ADBC_Options_List extends WP_List_Table {
302
  // Update the message to show to the user
303
  $this->aDBc_message = __('Autoload value successfully changed!', 'advanced-database-cleaner') . " " . $additional_msg;
304
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
305
  }
306
  }
307
 
@@ -311,104 +383,180 @@ class ADBC_Options_List extends WP_List_Table {
311
  if($this->aDBc_message != ""){
312
  echo '<div id="aDBc_message" class="' . $this->aDBc_class_message . ' notice is-dismissible"><p>' . $this->aDBc_message . '</p></div>';
313
  }
314
-
315
- // Verify if the ajax call is still searching in background to prevent enabling the button
316
- $still_searching = get_option("aDBc_temp_still_searching_options");
317
- if(!empty($still_searching)){
318
- // This means that the ajax call is still searching
319
- $aDBc_still_searching_msg = __('The process of categorization is still scanning options in background. Maybe you have reloaded the page before it finishes the scan. The scan will stop automatically after scanning all items or after timeout.','advanced-database-cleaner');
320
- echo '<div class="error notice is-dismissible"><p>' . $aDBc_still_searching_msg . '</p></div>';
321
- }
322
 
323
- // If the search has finished, show a msg to users
324
- if(!empty($this->aDBc_search_has_finished_msg)){
325
- echo '<div class="updated notice is-dismissible"><p>' . $this->aDBc_search_has_finished_msg . '</p></div>';
326
- }
327
 
328
  // If the folder adbc_uploads cannot be created, show a msg to users
329
  if(!empty($this->aDBc_permission_adbc_folder_msg)){
330
  echo '<div class="error notice is-dismissible"><p>' . $this->aDBc_permission_adbc_folder_msg . '</p></div>';
331
- }
332
 
333
  ?>
334
  <div class="aDBc-content-max-width">
335
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
336
  <div class="aDBc-clear-both" style="margin-top:15px"></div>
337
 
338
  <!-- Code for "run new search" button + Show loading image -->
339
- <div style="float:left;">
340
- <?php
341
- if($this->aDBc_which_button_to_show == "new_search" ){
342
- $aDBc_search_text = __('Scan options','advanced-database-cleaner');
343
- }else{
344
- $aDBc_search_text = __('Continue scannig ...','advanced-database-cleaner');
 
345
  }
346
  ?>
347
 
348
- <!-- This hidden input is used by ajax to know which item type we are dealing with -->
349
  <input type="hidden" id="aDBc_item_type" value="options"/>
350
- <?php
351
- // These hidden inputs are used by ajax to see if we should execute scanning process automatically by ajax after reloading a page
 
352
  $iteration = get_option("aDBc_temp_last_iteration_options");
353
  ?>
354
- <input type="hidden" id="aDBc_still_searching" value="<?php echo $still_searching; ?>"/>
355
  <input type="hidden" id="aDBc_iteration" value="<?php echo $iteration; ?>"/>
 
 
356
 
357
- <div class="aDBc_premium_tooltip">
358
- <input id="aDBc_new_search_button" type="submit" class="aDBc-run-new-search" value="<?php echo $aDBc_search_text; ?>" name="aDBc_new_search_button" style="opacity:0.5" disabled/>
359
- <span style="width:390px" class="aDBc_premium_tooltiptext"><?php _e('Please <a href="?page=advanced_db_cleaner&aDBc_tab=premium">upgrade</a> to Pro to categorize and detect orphaned options','advanced-database-cleaner') ?></span>
360
- </div>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
361
 
362
  </div>
363
 
364
- <!-- Print numbers of options found in each category -->
365
  <div class="aDBc-category-counts">
 
366
  <?php
 
367
  $aDBc_new_URI = $_SERVER['REQUEST_URI'];
368
- // Remove the paged parameter to start always from the first page when selecting a new category of tables
369
- $aDBc_new_URI = remove_query_arg('paged', $aDBc_new_URI);
370
- $iterations = 0;
371
- foreach($this->aDBc_options_categories_info as $abreviation => $category_info){
372
- $iterations++;
373
- $aDBc_new_URI = add_query_arg('aDBc_cat', $abreviation, $aDBc_new_URI);?>
374
- <span class="<?php echo $abreviation == $_GET['aDBc_cat'] ? 'aDBc-selected-category' : ''?>" style="<?php echo $abreviation == $_GET['aDBc_cat'] ? 'border-bottom: 1px solid ' . $category_info['color'] : '' ?>">
375
-
376
- <?php
377
- if($abreviation == "all"|| $abreviation == "u"){
378
- $aDBc_link_style = "color:" . $category_info['color'];
379
- $aDBc_category_info_count = "(". $category_info['count'] . ")";
380
- }else{
381
- $aDBc_link_style = "color:" . $category_info['color'] . ";cursor:default;pointer-events:none";
382
- $aDBc_category_info_count = "(*)";
383
- $aDBc_new_URI = "";
384
- }
385
- ?>
386
 
387
- <span class="aDBc_premium_tooltip">
388
- <a href="<?php echo $aDBc_new_URI; ?>" class="aDBc-category-counts-links" style="<?php echo $aDBc_link_style ; ?>">
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
389
  <span><?php echo $category_info['name']; ?></span>
390
- <span><?php echo $aDBc_category_info_count ;?></span>
391
  </a>
392
- <?php if($abreviation != "all" && $abreviation != "u"){ ?>
393
- <span style="width:150px" class="aDBc_premium_tooltiptext"><?php _e('Available in Pro version!','advanced-database-cleaner') ?></span>
394
- <?php } ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
395
  </span>
396
 
397
  </span>
398
- <?php
399
- if($iterations < 6){
400
- echo '<span class="aDBc-category-separator">|</span>';
401
- }
402
- }?>
403
  </div>
404
 
405
  <div class="aDBc-clear-both"></div>
406
 
407
- <div id="aDBc_progress_container">
408
- <div style="background:#ccc;width:100%;height:20px">
409
- <div id="aDBc-progress-bar" class="aDBc_progress-bar"></div>
 
410
  </div>
411
- <div id="aDBc-response_container"></div>
 
 
 
 
 
 
 
 
412
  </div>
413
 
414
  <?php include_once 'header_page_filter.php'; ?>
@@ -416,18 +564,20 @@ class ADBC_Options_List extends WP_List_Table {
416
  <div class="aDBc-clear-both"></div>
417
 
418
  <form id="aDBc_form" action="" method="post">
 
419
  <?php
420
- // Print the options
421
  $this->display();
422
  ?>
423
- </form>
424
 
 
 
 
 
425
  </div>
426
-
427
  <?php
428
  }
429
  }
430
 
431
  new ADBC_Options_List();
432
 
433
- ?>
16
 
17
  /** Should we display "run search" or "continue search" button (after a timeout failed). Default is "run search" */
18
  private $aDBc_which_button_to_show = "new_search";
19
+
20
  // This array contains belongs_to info about plugins and themes
21
  private $array_belongs_to_counts = array();
22
 
24
  private $aDBc_search_has_finished_msg = "";
25
 
26
  // Holds msg that will be shown if folder adbc_uploads cannot be created by the plugin (This is verified after clicking on scan button)
27
+ private $aDBc_permission_adbc_folder_msg = "";
28
 
29
  function __construct(){
30
 
31
  parent::__construct(array(
32
+ 'singular' => __('Option', 'advanced-database-cleaner'),
33
+ 'plural' => __('Options', 'advanced-database-cleaner'),
34
+ 'ajax' => false
35
  ));
36
 
37
  $this->aDBc_prepare_and_count_options();
38
  $this->aDBc_print_page_content();
39
  }
40
 
41
+ /** Prepare items */
42
+ function aDBc_prepare_and_count_options() {
43
+
44
+ if ( ADBC_PLUGIN_PLAN == "pro" ) {
45
+
46
+ // If the search has finished, show a msg success to users + button to double check results against our server database
47
+ $this->aDBc_search_has_finished_msg = aDBc_get_msg_double_check( "options" );
48
+
49
+ // Verify if the adbc_uploads cannot be created
50
+ $adbc_folder_permission = get_option( "aDBc_permission_adbc_folder_needed" );
51
+
52
+ if ( ! empty( $adbc_folder_permission ) ) {
53
+
54
+ $this->aDBc_permission_adbc_folder_msg = sprintf( __( 'The plugin needs to create the following directory "%1$s" to save the scan results but this was not possible automatically. Please create that directory manually and set correct permissions so it can be writable by the plugin.','advanced-database-cleaner' ), ADBC_UPLOAD_DIR_PATH_TO_ADBC );
55
+
56
+ // Once we display the msg, we delete that option from DB
57
+ delete_option( "aDBc_permission_adbc_folder_needed" );
58
+
59
+ }
60
 
 
 
 
 
 
 
61
  }
62
 
63
+ // Verify if the user wants to edit the categorization of an option. This block test comes from edit_item_categorization.php
64
+ if ( ADBC_PLUGIN_PLAN == "pro" ) {
65
+
66
+ if ( isset( $_POST['aDBc_cancel'] ) ) {
67
+
68
+ // If the user cancels the edit, remove the temp file
69
+ if ( file_exists( ADBC_UPLOAD_DIR_PATH_TO_ADBC . "/options_manually_correction_temp.txt" ) )
70
+ unlink( ADBC_UPLOAD_DIR_PATH_TO_ADBC . "/options_manually_correction_temp.txt" );
71
+
72
+ } else if ( isset( $_POST['aDBc_correct'] ) ) {
73
+
74
+ // Get the new belongs to of items
75
+ $new_belongs_to = $_POST['new_belongs_to'];
76
+
77
+ // Get value of checkbox to see if user wants to send correction to the server
78
+ if ( isset( $_POST['aDBc_send_correction_to_server'] ) ) {
79
+ $this->aDBc_message = aDBc_edit_categorization_of_items( "options", $new_belongs_to, 1 );
80
+ } else {
81
+ $this->aDBc_message = aDBc_edit_categorization_of_items( "options", $new_belongs_to, 0 );
82
+ }
83
+
84
+ // Remove the temp file
85
+ if ( file_exists( ADBC_UPLOAD_DIR_PATH_TO_ADBC . "/options_manually_correction_temp.txt" ) )
86
+ unlink( ADBC_UPLOAD_DIR_PATH_TO_ADBC . "/options_manually_correction_temp.txt" );
87
+ }
88
  }
89
 
90
  // Process bulk action if any before preparing options to display
114
  <span>" . __('Indicates the creator of the option: either a plugin, a theme or WordPress itself. If not sure about the creator, an estimation (%) will be displayed. The higher the percentage is, the more likely that the option belongs to that creator.','advanced-database-cleaner') ." </span>
115
  </span>";
116
 
117
+ $aDBc_option_size_toolip = "<span class='aDBc-tooltips-headers' style='position:absolute;margin-left:15px'>
118
  <img class='aDBc-info-image' src='". ADBC_PLUGIN_DIR_PATH . '/images/information2.svg' . "'/>
119
  <span>" . __('The size is in Bits! This is an estimation, not a precise value!','advanced-database-cleaner') ." </span>
120
+ </span>";
121
 
122
  $columns = array(
123
  'cb' => '<input type="checkbox" />',
152
  $per_page = 50;
153
  if(!empty($_GET['per_page'])){
154
  $per_page = absint($_GET['per_page']);
155
+ }
156
  $current_page = $this->get_pagenum();
157
  // Prepare sequence of options to display
158
  $display_data = array_slice($this->aDBc_options_to_display,(($current_page-1) * $per_page), $per_page);
171
  }else{
172
  return array('site_id');
173
  }
174
+ }
175
 
176
  /** WP: Column default */
177
  function column_default($item, $column_name){
195
 
196
  /** WP: Get bulk actions */
197
  function get_bulk_actions() {
198
+
199
  $actions = array(
200
+ 'scan_selected' => __( 'Scan selected options','advanced-database-cleaner' ),
201
+ 'edit_categorization' => __( 'Edit categorization','advanced-database-cleaner' ),
202
+ 'autoload_yes' => __( 'Set autoload to yes','advanced-database-cleaner' ),
203
+ 'autoload_no' => __( 'Set autoload to no','advanced-database-cleaner' ),
204
+ 'delete' => __( 'Delete','advanced-database-cleaner' )
205
  );
206
+
207
+ if ( ADBC_PLUGIN_PLAN == "free" ) {
208
+
209
+ unset( $actions['scan_selected'] );
210
+ unset( $actions['edit_categorization'] );
211
+
212
+ }
213
+
214
  return $actions;
215
  }
216
 
217
  /** WP: Message to display when no items found */
218
  function no_items() {
219
+
220
+ _e( 'No options found!', 'advanced-database-cleaner' );
221
+
222
  }
223
 
224
  /** WP: Process bulk actions */
225
  public function process_bulk_action() {
226
+
227
  // security check!
228
+ if ( isset( $_POST['_wpnonce'] ) && !empty( $_POST['_wpnonce'] ) ) {
229
+
230
+ $nonce = filter_input( INPUT_POST, '_wpnonce', FILTER_SANITIZE_STRING );
231
  $action = 'bulk-' . $this->_args['plural'];
232
+
233
+ if ( !wp_verify_nonce( $nonce, $action ) )
234
+ wp_die( 'Security check failed!' );
235
+
236
+ } else {
237
+
238
  return;
239
  }
240
 
258
  if(empty($options_to_delete[$site_id])){
259
  $options_to_delete[$site_id] = array();
260
  }
261
+ // We delete some characters we believe they should not appear in the name: & < > = # ( ) [ ] { } ? " '
262
  $option_name = preg_replace("/[&<>=#\(\)\[\]\{\}\?\"\' ]/", '', $option_name);
263
  array_push($options_to_delete[$site_id], $option_name);
264
  }
275
  foreach($_POST['aDBc_elements_to_process'] as $option) {
276
  $aDBc_option_info = explode("|", $option);
277
  $option_name = sanitize_text_field($aDBc_option_info[1]);
278
+ // We delete some characters we believe they should not appear in the name: & < > = # ( ) [ ] { } ? " '
279
  $option_name = preg_replace("/[&<>=#\(\)\[\]\{\}\?\"\' ]/", '', $option_name);
280
  delete_option($option_name);
281
  }
292
  }
293
 
294
  // If the user wants to change autoload to yes for selected options
295
+ // xxx, 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?
296
  if(isset($_POST['aDBc_elements_to_process'])){
297
  $additional_msg = "";
298
  if(function_exists('is_multisite') && is_multisite()){
301
  foreach($_POST['aDBc_elements_to_process'] as $option){
302
  $option_info = explode("|", $option);
303
  $site_id = sanitize_html_class($option_info[0]);
304
+ $option_name = sanitize_text_field($option_info[1]);
305
  if(is_numeric($site_id)){
306
  if(empty($options_to_process[$site_id])){
307
  $options_to_process[$site_id] = array();
308
  }
309
+ // We delete some characters we believe they should not appear in the name: & < > = # ( ) [ ] { } ? " '
310
  $option_name = preg_replace("/[&<>=#\(\)\[\]\{\}\?\"\' ]/", '', $option_name);
311
  array_push($options_to_process[$site_id], $option_name);
312
  }
313
  }
314
+
315
  // Change autoload
316
+ foreach ( $options_to_process as $site_id => $options ) {
317
+
318
+ switch_to_blog( $site_id );
319
+
320
+ foreach ( $options as $option ) {
321
+
322
+ // EDD will delete 'aDBc_edd_license_status' if 'aDBc_edd_license_key' changed. Prevent this!
323
+ if ( $option != "aDBc_edd_license_key" ) {
324
+
325
+ $options_value = get_option( $option );
326
+ update_option( $option, "xyz" );
327
+ update_option( $option, $options_value, $autoload_value );
328
+
329
+ } else {
330
+
331
+ $additional_msg = "<span style='color:orange'>" . __( 'For technical concerns, the option aDBc_edd_license_key cannot be changed!', 'advanced-database-cleaner' ) . "</span>";
332
+
333
  }
334
  }
335
+
336
  restore_current_blog();
337
  }
338
+
339
  }else{
340
  foreach($_POST['aDBc_elements_to_process'] as $option) {
341
  $aDBc_option_info = explode("|", $option);
342
  $option_name = sanitize_text_field($aDBc_option_info[1]);
343
+ // We delete some characters we believe they should not appear in the name: & < > = # ( ) [ ] { } ? " '
344
+ $option_name = preg_replace("/[&<>=#\(\)\[\]\{\}\?\"\' ]/", '', $option_name);
345
  // In adbc-edd-sample-plugin, EDD deletes aDBc_edd_license_status if aDBc_edd_license_key has been changed
346
  // This means that we should not change its value to prevent this to happen
347
  if($option_name != "aDBc_edd_license_key"){
358
  // Update the message to show to the user
359
  $this->aDBc_message = __('Autoload value successfully changed!', 'advanced-database-cleaner') . " " . $additional_msg;
360
  }
361
+ }else if($action == 'edit_categorization'){
362
+ // If the user wants to edit categorization of the options he/she selected
363
+ if(isset($_POST['aDBc_elements_to_process'])){
364
+ // Create a temp file containing options names to change categorization for
365
+ $aDBc_path_items = @fopen(ADBC_UPLOAD_DIR_PATH_TO_ADBC . "/options_manually_correction_temp.txt", "w");
366
+ if($aDBc_path_items){
367
+ foreach($_POST['aDBc_elements_to_process'] as $option){
368
+ $option_info = explode("|", $option);
369
+ $option_name = sanitize_text_field($option_info[1]);
370
+ // We delete some characters we believe they should not appear in the name: & < > = # ( ) [ ] { } ? " '
371
+ $option_name = preg_replace("/[&<>=#\(\)\[\]\{\}\?\"\' ]/", '', $option_name);
372
+ fwrite($aDBc_path_items, $option_name . "\n");
373
+ }
374
+ fclose($aDBc_path_items);
375
+ }
376
+ }
377
  }
378
  }
379
 
383
  if($this->aDBc_message != ""){
384
  echo '<div id="aDBc_message" class="' . $this->aDBc_class_message . ' notice is-dismissible"><p>' . $this->aDBc_message . '</p></div>';
385
  }
 
 
 
 
 
 
 
 
386
 
387
+ // If the search has finished, show a msg success to users + button to double check results against our server database
388
+ echo $this->aDBc_search_has_finished_msg;
 
 
389
 
390
  // If the folder adbc_uploads cannot be created, show a msg to users
391
  if(!empty($this->aDBc_permission_adbc_folder_msg)){
392
  echo '<div class="error notice is-dismissible"><p>' . $this->aDBc_permission_adbc_folder_msg . '</p></div>';
393
+ }
394
 
395
  ?>
396
  <div class="aDBc-content-max-width">
397
 
398
+ <?php
399
+
400
+ // If options_manually_correction_temp.txt exist, this means that user want to edit categorization
401
+
402
+ if ( ADBC_PLUGIN_PLAN == "pro" && file_exists( ADBC_UPLOAD_DIR_PATH_TO_ADBC . '/options_manually_correction_temp.txt' ) ) {
403
+
404
+ include_once 'edit_item_categorization.php';
405
+
406
+ } else {
407
+
408
+ // If not, we print the options normally
409
+ // Print a notice/warning according to each type of options
410
+ if ( ADBC_PLUGIN_PLAN == "pro" ) {
411
+
412
+ if($_GET['aDBc_cat'] == 'o' && $this->aDBc_options_categories_info['o']['count'] > 0){
413
+ echo '<div class="aDBc-box-warning-orphan">' . __('Options below seem to be orphan! However, please delete only those you are sure to be orphan!','advanced-database-cleaner') . '</div>';
414
+ }else if(($_GET['aDBc_cat'] == 'all' || $_GET['aDBc_cat'] == 'u') && $this->aDBc_options_categories_info['u']['count'] > 0){
415
+ echo '<div class="aDBc-box-info">' . __('Some of your options are not categorized yet! Please click on the button below to categorize them!','advanced-database-cleaner') . '</div>';
416
+ }
417
+
418
+ }
419
+
420
+ ?>
421
+
422
  <div class="aDBc-clear-both" style="margin-top:15px"></div>
423
 
424
  <!-- Code for "run new search" button + Show loading image -->
425
+ <div style="float:left">
426
+
427
+ <?php
428
+ if ( $this->aDBc_which_button_to_show == "new_search" ) {
429
+ $aDBc_search_text = __( 'Scan options', 'advanced-database-cleaner' );
430
+ } else {
431
+ $aDBc_search_text = __( 'Continue scannig ...', 'advanced-database-cleaner' );
432
  }
433
  ?>
434
 
435
+ <!-- Hidden input used by ajax to know which item type we are dealing with -->
436
  <input type="hidden" id="aDBc_item_type" value="options"/>
437
+
438
+ <?php
439
+ // These hidden inputs are used by ajax to see if we should execute the scan automatically after reloading a page
440
  $iteration = get_option("aDBc_temp_last_iteration_options");
441
  ?>
 
442
  <input type="hidden" id="aDBc_iteration" value="<?php echo $iteration; ?>"/>
443
+ <input type="hidden" id="aDBc_count_uncategorized" value="<?php echo $this->aDBc_options_categories_info['u']['count']; ?>"/>
444
+ <input type="hidden" id="aDBc_count_all_items" value="<?php echo $this->aDBc_options_categories_info['all']['count']; ?>"/>
445
 
446
+ <?php
447
+
448
+ if ( ADBC_PLUGIN_PLAN == "pro" ) {
449
+
450
+ ?>
451
+
452
+ <input id="aDBc_new_search_button" type="submit" class="aDBc-run-new-search" value="<?php echo $aDBc_search_text; ?>" name="aDBc_new_search_button" />
453
+
454
+ <?php
455
+
456
+ } else {
457
+
458
+ ?>
459
+
460
+ <div class="aDBc-premium-tooltip">
461
+
462
+ <input id="aDBc_new_search_button" type="submit" class="aDBc-run-new-search" value="<?php echo $aDBc_search_text; ?>" name="aDBc_new_search_button" style="opacity:0.5" disabled />
463
+
464
+ <span style="width:390px" class="aDBc-premium-tooltiptext">
465
+
466
+ <?php _e('Please <a href="?page=advanced_db_cleaner&aDBc_tab=premium">upgrade</a> to Pro to categorize and detect orphaned options','advanced-database-cleaner') ?>
467
+
468
+ </span>
469
+
470
+ </div>
471
+
472
+ <?php
473
+ }
474
+ ?>
475
 
476
  </div>
477
 
478
+ <!-- Print numbers of items found in each category -->
479
  <div class="aDBc-category-counts">
480
+
481
  <?php
482
+
483
  $aDBc_new_URI = $_SERVER['REQUEST_URI'];
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
484
 
485
+ // Remove the paged parameter to start always from the first page when selecting a new category
486
+ $aDBc_new_URI = remove_query_arg( 'paged', $aDBc_new_URI );
487
+
488
+ foreach ( $this->aDBc_options_categories_info as $abreviation => $category_info ) {
489
+
490
+ $aDBc_new_URI = add_query_arg( 'aDBc_cat', $abreviation, $aDBc_new_URI );
491
+ $selected_color = $abreviation == $_GET['aDBc_cat'] ? $category_info['color'] : '#eee';
492
+ $aDBc_link_style = "color:" . $category_info['color'];
493
+ $aDBc_count = $category_info['count'];
494
+
495
+ if ( ADBC_PLUGIN_PLAN == "free" && $abreviation != "all" && $abreviation != "u" ) {
496
+
497
+ $aDBc_new_URI = "";
498
+ $aDBc_link_style = $aDBc_link_style . ";cursor:default;pointer-events:none";
499
+ $aDBc_count = "-";
500
+
501
+ }
502
+
503
+ ?>
504
+ <span class="<?php echo $abreviation == $_GET['aDBc_cat'] ? 'aDBc-selected-category' : ''?>">
505
+
506
+ <span class="aDBc-premium-tooltip aDBc-category-span">
507
+
508
+ <a href="<?php echo $aDBc_new_URI ?>" class="aDBc-category-counts-links" style="<?php echo $aDBc_link_style ?>">
509
+
510
  <span><?php echo $category_info['name']; ?></span>
511
+
512
  </a>
513
+
514
+ <div class="aDBc-category-total" style="border:1px solid <?php echo $selected_color ?>; border-bottom:3px solid <?php echo $selected_color ?>;">
515
+
516
+ <span style="color:#000"><?php echo $aDBc_count ?></span>
517
+
518
+ </div>
519
+
520
+ <?php
521
+ if ( ADBC_PLUGIN_PLAN == "free" && $abreviation != "all" && $abreviation != "u" ) {
522
+ ?>
523
+
524
+ <span style="width:150px" class="aDBc-premium-tooltiptext">
525
+
526
+ <?php _e( 'Available in Pro version!', 'advanced-database-cleaner' ); ?>
527
+
528
+ </span>
529
+
530
+ <?php
531
+ }
532
+ ?>
533
+
534
  </span>
535
 
536
  </span>
537
+
538
+ <?php
539
+ }
540
+ ?>
541
+
542
  </div>
543
 
544
  <div class="aDBc-clear-both"></div>
545
 
546
+ <div id="aDBc-progress-container">
547
+
548
+ <div class="aDBc-progress-background">
549
+ <div id="aDBc-progress-bar" class="aDBc-progress-bar"></div>
550
  </div>
551
+
552
+ <a id="aDBc_stop_scan" href="#" style="color:red">
553
+ <?php _e('Stop the scan','advanced-database-cleaner') ?>
554
+ </a>
555
+
556
+ <span id="aDBc_stopping_msg" style="display:none">
557
+ <?php _e('Stopping...','advanced-database-cleaner') ?>
558
+ </span>
559
+
560
  </div>
561
 
562
  <?php include_once 'header_page_filter.php'; ?>
564
  <div class="aDBc-clear-both"></div>
565
 
566
  <form id="aDBc_form" action="" method="post">
567
+
568
  <?php
 
569
  $this->display();
570
  ?>
 
571
 
572
+ </form>
573
+ <?php
574
+ }
575
+ ?>
576
  </div>
 
577
  <?php
578
  }
579
  }
580
 
581
  new ADBC_Options_List();
582
 
583
+ ?>
includes/class_clean_tables.php CHANGED
@@ -31,37 +31,40 @@ class ADBC_Tables_List extends WP_List_Table {
31
  private $aDBc_search_has_finished_msg = "";
32
 
33
  // Holds msg that will be shown if folder adbc_uploads cannot be created by the plugin (This is verified after clicking on scan button)
34
- private $aDBc_permission_adbc_folder_msg = "";
35
 
36
  function __construct(){
37
 
38
  parent::__construct(array(
39
- 'singular' => __('Table', 'advanced-database-cleaner'), //singular name of the listed records
40
- 'plural' => __('Tables', 'advanced-database-cleaner'), //plural name of the listed records
41
- 'ajax' => false //does this table support ajax?
42
  ));
43
 
44
  $this->aDBc_prepare_and_count_tables();
45
  $this->aDBc_print_page_content();
46
  }
47
 
48
- /** Prepare tables to display and count tables for each category */
49
- function aDBc_prepare_and_count_tables(){
50
 
51
- // Verify if the search has finished to let user know about it and invite it to double check against our server
52
- $search_finished = get_option("aDBc_last_search_ok_tables");
53
- if(!empty($search_finished)){
54
- $this->aDBc_search_has_finished_msg = __('The process of scanning has finished with success!','advanced-database-cleaner');
55
- // Once we display success msg, we delete that option to not be loaded
56
- delete_option("aDBc_last_search_ok_tables");
57
- }
 
 
 
 
 
 
 
 
 
58
 
59
- // Verify if the adbc_uploads cannot be created
60
- $adbc_folder_permission = get_option("aDBc_permission_adbc_folder_needed");
61
- if(!empty($adbc_folder_permission)){
62
- $this->aDBc_permission_adbc_folder_msg = sprintf(__('The plugin needs to create the following directory "%1$s" to save the scan results but this was not possible automatically. Please create that directory manually and set correct permissions so it can be writable by the plugin.','advanced-database-cleaner'), ADBC_UPLOAD_DIR_PATH_TO_ADBC);
63
- // Once we display the msg, we delete that option from DB
64
- delete_option("aDBc_permission_adbc_folder_needed");
65
  }
66
 
67
  // Test if user wants to delete a scheduled task
@@ -83,6 +86,33 @@ class ADBC_Tables_List extends WP_List_Table {
83
  $this->aDBc_message = __('The clean-up schedule deleted successfully!', 'advanced-database-cleaner');
84
  }
85
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
86
  // Process bulk action if any before preparing tables to display
87
  $this->process_bulk_action();
88
 
@@ -153,11 +183,11 @@ class ADBC_Tables_List extends WP_List_Table {
153
  $aDBc_belongs_to_toolip = "<span class='aDBc-tooltips-headers'>
154
  <img class='aDBc-info-image' src='". ADBC_PLUGIN_DIR_PATH . '/images/information2.svg' . "'/>
155
  <span>" . __('Indicates the creator of the table: either a plugin, a theme or WordPress itself. If not sure about the creator, an estimation (%) will be displayed. The higher the percentage is, the more likely that the table belongs to that creator.','advanced-database-cleaner') ." </span>
156
- </span>";
157
  $columns = array(
158
  'cb' => '<input type="checkbox" />',
159
- 'table_prefix' => __('Prefix','advanced-database-cleaner'),
160
  'table_name' => __('Table name','advanced-database-cleaner'),
 
161
  'table_rows' => __('Rows','advanced-database-cleaner'),
162
  'table_size' => __('Size','advanced-database-cleaner'),
163
  'table_lost' => __('Lost','advanced-database-cleaner'),
@@ -170,15 +200,17 @@ class ADBC_Tables_List extends WP_List_Table {
170
  function get_sortable_columns() {
171
 
172
  $sortable_columns = array(
173
- 'table_name' => array('table_name',false),
174
- 'table_rows' => array('table_rows',false),
175
- 'table_size' => array('table_size',false),
176
- 'site_id' => array('site_id',false)
 
 
177
  );
178
 
179
  return $sortable_columns;
180
- }
181
-
182
  /** WP: Prepare items to display */
183
  function prepare_items() {
184
  $columns = $this->get_columns();
@@ -200,66 +232,112 @@ class ADBC_Tables_List extends WP_List_Table {
200
  }
201
 
202
  /** WP: Get columns that should be hidden */
203
- function get_hidden_columns(){
 
204
  // If MU, nothing to hide, else hide Side ID column
205
- if(function_exists('is_multisite') && is_multisite()){
206
- return array('table_prefix','table_lost');
207
- }else{
208
- return array('table_prefix','table_lost', 'site_id');
 
 
 
 
209
  }
210
  }
211
 
212
  /** WP: Column default */
213
- function column_default($item, $column_name){
214
- switch($column_name){
 
 
215
  case 'table_name':
 
216
  $prefix_and_name = $item['table_prefix'] . $item[$column_name];
217
- $return_name = "<span style='font-weight:bold;'>" . $item['table_prefix'] . "</span>" . $item[$column_name] ;
218
- if($item['table_lost'] > 0 && in_array($prefix_and_name, $this->aDBc_tables_name_to_optimize)){
219
- $lost = aDBc_get_size_from_bytes($item['table_lost']);
220
- $return_name .= "<br/><span style='color:red;font-size:12px'><b>".__('Lost space','advanced-database-cleaner')."</b></span><span style='font-size:12px'> : " . $lost . "</span> <span style='color:grey'> (" . __('to optimize','advanced-database-cleaner') . ")</span>";
 
 
 
 
 
 
 
 
221
  }
222
- if(in_array($prefix_and_name, $this->aDBc_tables_name_to_repair)){
223
- $return_name .= "<br/><span style='color:red;font-size:12px'><b>".__('Corrupted!','advanced-database-cleaner')."</b></span><span style='color:grey'> (" . __('to repair','advanced-database-cleaner') . ")</span>";
 
 
 
 
 
224
  }
 
225
  return $return_name;
226
  break;
 
227
  case 'table_size':
228
- return aDBc_get_size_from_bytes($item['table_size']);
 
229
  break;
 
230
  case 'table_lost':
231
- return aDBc_get_size_from_bytes($item['table_lost']);
 
232
  break;
233
- case 'table_prefix':
 
234
  case 'table_rows':
235
  case 'site_id':
236
  case 'table_belongs_to':
 
237
  return $item[$column_name];
 
238
  default:
239
- return print_r($item, true) ; //Show the whole array for troubleshooting purposes
 
 
240
  }
241
  }
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 */
249
  function get_bulk_actions() {
250
 
251
  $actions = array(
252
- 'optimize' => __('Optimize','advanced-database-cleaner'),
253
- 'repair' => __('Repair','advanced-database-cleaner'),
254
- 'empty' => __('Empty rows','advanced-database-cleaner'),
255
- 'delete' => __('Delete','advanced-database-cleaner')
 
 
256
  );
 
 
 
 
 
 
 
 
257
  return $actions;
 
258
  }
259
 
260
  /** WP: Message to display when no items found */
261
  function no_items() {
262
- _e('No tables found!','advanced-database-cleaner');
 
 
263
  }
264
 
265
  /** WP: Process bulk actions */
@@ -292,13 +370,21 @@ class ADBC_Tables_List extends WP_List_Table {
292
  $table_info = explode("|", $table);
293
  $table_prefix = sanitize_html_class($table_info[0]);
294
  $table_name = sanitize_text_field($table_info[1]);
295
- // We delete some characters we believe they should not appear in the name: & < > = # ( ) [ ] { } ? " '
296
- $table_name = preg_replace("/[&<>=#\(\)\[\]\{\}\?\"\' ]/", '', $table_name);
297
  if($wpdb->query("DROP TABLE " . $table_prefix . $table_name)){
298
  array_push($names_deleted, $table_name);
299
  }
300
  }
301
 
 
 
 
 
 
 
 
 
302
  // Update the message to show to the user
303
  $this->aDBc_message = __('Selected tables cleaned successfully!', 'advanced-database-cleaner');
304
  }
@@ -310,7 +396,7 @@ class ADBC_Tables_List extends WP_List_Table {
310
  $table_info = explode("|", $table);
311
  $table_prefix = sanitize_html_class($table_info[0]);
312
  $table_name = sanitize_text_field($table_info[1]);
313
- // We delete some characters we believe they should not appear in the name: & < > = # ( ) [ ] { } ? " '
314
  $table_name = preg_replace("/[&<>=#\(\)\[\]\{\}\?\"\' ]/", '', $table_name);
315
  $wpdb->query("OPTIMIZE TABLE " . $table_prefix . $table_name);
316
  }
@@ -325,7 +411,7 @@ class ADBC_Tables_List extends WP_List_Table {
325
  $table_info = explode("|", $table);
326
  $table_prefix = sanitize_html_class($table_info[0]);
327
  $table_name = sanitize_text_field($table_info[1]);
328
- // We delete some characters we believe they should not appear in the name: & < > = # ( ) [ ] { } ? " '
329
  $table_name = preg_replace("/[&<>=#\(\)\[\]\{\}\?\"\' ]/", '', $table_name);
330
  $wpdb->query("TRUNCATE TABLE " . $table_prefix . $table_name);
331
  }
@@ -341,7 +427,7 @@ class ADBC_Tables_List extends WP_List_Table {
341
  $table_info = explode("|", $table);
342
  $table_prefix = sanitize_html_class($table_info[0]);
343
  $table_name = sanitize_text_field($table_info[1]);
344
- // We delete some characters we believe they should not appear in the name: & < > = # ( ) [ ] { } ? " '
345
  $table_name = preg_replace("/[&<>=#\(\)\[\]\{\}\?\"\' ]/", '', $table_name);
346
  $query_result = $wpdb->get_results("REPAIR TABLE " . $table_prefix . $table_name);
347
  foreach($query_result as $row){
@@ -360,7 +446,23 @@ class ADBC_Tables_List extends WP_List_Table {
360
  $this->aDBc_message = __('Some of your tables cannot be repaired!', 'advanced-database-cleaner');
361
  }
362
  }
363
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
364
  }
365
 
366
  /** Print the page content */
@@ -370,18 +472,8 @@ class ADBC_Tables_List extends WP_List_Table {
370
  echo '<div id="aDBc_message" class="' . $this->aDBc_class_message . ' notice is-dismissible"><p>' . $this->aDBc_message . '</p></div>';
371
  }
372
 
373
- // Verify if the ajax call is still searching in background to prevent enabling the button
374
- $still_searching = get_option("aDBc_temp_still_searching_tables");
375
- if(!empty($still_searching)){
376
- // This means that the ajax call is still searching
377
- $aDBc_still_searching_msg = __('The process of categorization is still scanning tables in background. Maybe you have reloaded the page before it finishes the scan. The scan will stop automatically after scanning all items or after timeout.','advanced-database-cleaner');
378
- echo '<div class="error notice is-dismissible"><p>' . $aDBc_still_searching_msg . '</p></div>';
379
- }
380
-
381
- // If the search has finished, show a msg to users
382
- if(!empty($this->aDBc_search_has_finished_msg)){
383
- echo '<div class="updated notice is-dismissible"><p>' . $this->aDBc_search_has_finished_msg . '</p></div>';
384
- }
385
 
386
  // If the folder adbc_uploads cannot be created, show a msg to users
387
  if(!empty($this->aDBc_permission_adbc_folder_msg)){
@@ -391,155 +483,268 @@ class ADBC_Tables_List extends WP_List_Table {
391
  ?>
392
  <div class="aDBc-content-max-width">
393
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
394
  <div class="aDBc-clear-both" style="margin-top:15px"></div>
395
 
396
  <!-- Code for "run new search" button + Show loading image -->
397
- <div style="float:left;">
398
- <?php
399
- if($this->aDBc_which_button_to_show == "new_search" ){
400
- $aDBc_search_text = __('Scan tables','advanced-database-cleaner');
401
- }else{
402
- $aDBc_search_text = __('Continue scannig ...','advanced-database-cleaner');
 
403
  }
404
  ?>
405
 
406
- <!-- This hidden input is used by ajax to know which item type we are dealing with -->
407
  <input type="hidden" id="aDBc_item_type" value="tables"/>
408
- <?php
409
- // These hidden inputs are used by ajax to see if we should execute scanning process automatically by ajax after reloading a page
 
410
  $iteration = get_option("aDBc_temp_last_iteration_tables");
411
  ?>
412
- <input type="hidden" id="aDBc_still_searching" value="<?php echo $still_searching; ?>"/>
413
  <input type="hidden" id="aDBc_iteration" value="<?php echo $iteration; ?>"/>
 
 
414
 
415
- <div class="aDBc_premium_tooltip">
416
- <input id="aDBc_new_search_button" type="submit" class="aDBc-run-new-search" value="<?php echo $aDBc_search_text; ?>" name="aDBc_new_search_button" style="opacity:0.5" disabled/>
417
- <span style="width:390px" class="aDBc_premium_tooltiptext"><?php _e('Please <a href="?page=advanced_db_cleaner&aDBc_tab=premium">upgrade</a> to Pro to categorize and detect orphaned tables','advanced-database-cleaner') ?></span>
418
- </div>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
419
 
420
  </div>
421
 
422
- <!-- Print numbers of tables found in each category -->
423
  <div class="aDBc-category-counts">
 
424
  <?php
 
425
  $aDBc_new_URI = $_SERVER['REQUEST_URI'];
426
- // Remove the paged parameter to start always from the first page when selecting a new category of tables
427
- $aDBc_new_URI = remove_query_arg('paged', $aDBc_new_URI);
428
- $iterations = 0;
429
- foreach($this->aDBc_tables_categories_info as $abreviation => $category_info){
430
- $iterations++;
431
- $aDBc_new_URI = add_query_arg('aDBc_cat', $abreviation, $aDBc_new_URI);?>
432
- <span class="<?php echo $abreviation == $_GET['aDBc_cat'] ? 'aDBc-selected-category' : ''?>" style="<?php echo $abreviation == $_GET['aDBc_cat'] ? 'border-bottom: 1px solid ' . $category_info['color'] : '' ?>">
433
-
434
- <?php
435
- if($abreviation == "all"|| $abreviation == "u"){
436
- $aDBc_link_style = "color:" . $category_info['color'];
437
- $aDBc_category_info_count = "(". $category_info['count'] . ")";
438
- }else{
439
- $aDBc_link_style = "color:" . $category_info['color'] . ";cursor:default;pointer-events:none";
440
- $aDBc_category_info_count = "(*)";
441
- $aDBc_new_URI = "";
442
- }
443
- ?>
444
 
445
- <span class="aDBc_premium_tooltip">
446
- <a href="<?php echo $aDBc_new_URI; ?>" class="aDBc-category-counts-links" style="<?php echo $aDBc_link_style ; ?>">
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
447
  <span><?php echo $category_info['name']; ?></span>
448
- <span><?php echo $aDBc_category_info_count ;?></span>
449
  </a>
450
- <?php if($abreviation != "all" && $abreviation != "u"){ ?>
451
- <span style="width:150px" class="aDBc_premium_tooltiptext"><?php _e('Available in Pro version!','advanced-database-cleaner') ?></span>
452
- <?php } ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
453
  </span>
454
 
455
  </span>
456
- <?php
457
- if($iterations < 6){
458
- echo '<span class="aDBc-category-separator">|</span>';
459
- }
460
- }?>
461
  </div>
462
 
463
  <div class="aDBc-clear-both"></div>
464
 
465
- <div id="aDBc_progress_container">
466
- <div style="background:#ccc;width:100%;height:20px">
467
- <div id="aDBc-progress-bar" class="aDBc_progress-bar"></div>
 
468
  </div>
469
- <div id="aDBc-response_container"></div>
 
 
 
 
 
 
 
 
470
  </div>
471
 
472
  <?php include_once 'header_page_filter.php'; ?>
473
 
474
  <div class="aDBc-clear-both"></div>
475
 
476
- <form id="aDBc_form" action="" method="post">
477
  <div class="aDBc-left-content">
478
  <?php
479
- // Print the tables
480
  $this->display();
481
  ?>
482
  </div>
483
  </form>
484
 
485
- <div class="aDBc-right-box">
486
- <div style="text-align:center">
487
- <?php if($this->aDBc_total_tables_to_optimize == 0 && $this->aDBc_total_tables_to_repair == 0){ ?>
 
 
 
 
 
 
488
  <img width="58px" src="<?php echo ADBC_PLUGIN_DIR_PATH . '/images/db_clean.svg'?>"/>
489
- <div class="aDBc-text-status-db"><?php _e('Your database is optimized!','advanced-database-cleaner'); ?></div>
490
- <?php } else {
491
-
492
- // Add link to numbers of tables that should be optimized
493
- $aDBc_new_URI = $_SERVER['REQUEST_URI'];
494
- $aDBc_new_URI = remove_query_arg(array('paged', 's', 'belongs_to'), $aDBc_new_URI);
495
- $aDBc_new_URI = add_query_arg('t_type', 'optimize', $aDBc_new_URI);
496
- $aDBc_new_URI = add_query_arg('aDBc_cat', 'all', $aDBc_new_URI);
497
- ?>
498
 
 
 
 
 
 
499
  <img width="55px" src="<?php echo ADBC_PLUGIN_DIR_PATH . '/images/warning.svg'?>"/>
500
 
501
- <?php if($this->aDBc_total_tables_to_optimize > 0){ ?>
 
 
 
 
 
502
  <div class="aDBc-text-status-db">
503
- <b><a href="<?php echo $aDBc_new_URI; ?>"><?php echo $this->aDBc_total_tables_to_optimize; ?></a></b> <?php _e('table(s) should be optimized!','advanced-database-cleaner'); ?>
 
504
  </div>
 
505
  <div>
506
- <?php
507
- $aDBc_table_size = aDBc_get_size_from_bytes($this->aDBc_total_lost);
508
- echo __('You can save around','advanced-database-cleaner') . " : " . $aDBc_table_size;
509
- ?>
510
  </div>
511
- <?php } ?>
512
 
513
- <?php if($this->aDBc_total_tables_to_repair > 0){
514
- $aDBc_new_URI = add_query_arg('t_type', 'repair', $aDBc_new_URI);
 
 
 
 
 
 
515
  ?>
516
- <div class="aDBc-text-status-db" style="<?php echo $this->aDBc_total_tables_to_optimize > 0 ? 'padding-top:10px;margin-top:10px;border-top:1px dashed grey' : ''; ?>">
517
- <b><a href="<?php echo $aDBc_new_URI; ?>"><?php echo $this->aDBc_total_tables_to_repair; ?></a></b> <?php _e('table(s) should be repaired!','advanced-database-cleaner'); ?>
 
518
  </div>
519
- <?php } ?>
520
 
521
- <?php } ?>
 
 
 
 
522
  </div>
523
 
524
- <div class="aDBc-schedule-box" style="text-align:center">
525
 
526
- <img width="60px" src="<?php echo ADBC_PLUGIN_DIR_PATH . '/images/alarm-clock.svg'?>"/>
 
527
 
528
- <?php
529
- $aDBc_schedules = get_option('aDBc_optimize_schedule');
530
- $aDBc_schedules = is_array($aDBc_schedules) ? $aDBc_schedules : array();
 
 
 
 
 
 
531
 
532
- // Count schedules available
533
- $count_schedules = count($aDBc_schedules);
534
- echo "<div class='aDBc-schedule-text'><b>" . $count_schedules ."</b> " .__('optimize schedule(s) set','advanced-database-cleaner') . "</div>";
535
 
536
- foreach($aDBc_schedules as $hook_name => $hook_params){
537
  echo "<div class='aDBc-schedule-hook-box'>";
538
- echo "<b>".__('Name','advanced-database-cleaner') . "</b> : " . $hook_name;
539
  echo "</br>";
540
 
541
  // We convert hook name to a string because the arg maybe only a digit!
542
- $timestamp = wp_next_scheduled("aDBc_optimize_scheduler", array($hook_name . ''));
543
  if($timestamp){
544
  $next_run = get_date_from_gmt(date('Y-m-d H:i:s', $timestamp), 'M j, Y - H:i');
545
  }else{
@@ -571,7 +776,7 @@ class ADBC_Tables_List extends WP_List_Table {
571
  break;
572
  case "monthly" :
573
  $repeat = __('Monthly','advanced-database-cleaner');
574
- break;
575
  }
576
 
577
  echo "<b>".__('Frequency','advanced-database-cleaner') . "</b> : " . $repeat . "</br>";
@@ -584,16 +789,20 @@ class ADBC_Tables_List extends WP_List_Table {
584
 
585
  ?>
586
 
587
- <span class="aDBc-edit-schedule">
588
- <a href="<?php echo $aDBc_new_URI ?>" style="text-decoration:none;margin-right:3px">
589
- <?php _e('Edit','advanced-database-cleaner') ?>
590
- </a> |
591
- <form action="" method="post" style="float:right;margin-left:3px">
 
 
592
  <input type="hidden" name="aDBc_delete_schedule" value="<?php echo $hook_name ?>" />
593
  <input class="aDBc-submit-link" type="submit" value="<?php _e('Delete','advanced-database-cleaner') ?>" />
594
  <?php wp_nonce_field('delete_optimize_schedule_nonce', 'delete_optimize_schedule_nonce') ?>
595
  </form>
 
596
  </span>
 
597
  </div>
598
  <?php
599
 
@@ -601,24 +810,25 @@ class ADBC_Tables_List extends WP_List_Table {
601
 
602
  $aDBc_new_URI = $_SERVER['REQUEST_URI'];
603
  $aDBc_new_URI = add_query_arg('aDBc_view', 'add_optimize_schedule', $aDBc_new_URI);
604
- ?>
605
 
606
- <a href="<?php echo $aDBc_new_URI ?>" id="aDBc_add_schedule" style="margin-top:20px;width:100%" class="button-primary">
607
- <?php _e('Add new schedule','advanced-database-cleaner'); ?>
608
- </a>
609
 
610
  </div>
611
 
612
- </div>
613
 
614
  <div class="aDBc-clear-both"></div>
615
-
616
- </div>
617
-
 
618
  <?php
619
  }
620
  }
621
 
622
  new ADBC_Tables_List();
623
 
624
- ?>
31
  private $aDBc_search_has_finished_msg = "";
32
 
33
  // Holds msg that will be shown if folder adbc_uploads cannot be created by the plugin (This is verified after clicking on scan button)
34
+ private $aDBc_permission_adbc_folder_msg = "";
35
 
36
  function __construct(){
37
 
38
  parent::__construct(array(
39
+ 'singular' => __('Table', 'advanced-database-cleaner'),
40
+ 'plural' => __('Tables', 'advanced-database-cleaner'),
41
+ 'ajax' => false
42
  ));
43
 
44
  $this->aDBc_prepare_and_count_tables();
45
  $this->aDBc_print_page_content();
46
  }
47
 
48
+ /** Prepare items */
49
+ function aDBc_prepare_and_count_tables() {
50
 
51
+ if ( ADBC_PLUGIN_PLAN == "pro" ) {
52
+
53
+ // If the search has finished, show a msg success to users + button to double check results against our server database
54
+ $this->aDBc_search_has_finished_msg = aDBc_get_msg_double_check( "tables" );
55
+
56
+ // Verify if the adbc_uploads cannot be created
57
+ $adbc_folder_permission = get_option( "aDBc_permission_adbc_folder_needed" );
58
+
59
+ if ( ! empty( $adbc_folder_permission ) ) {
60
+
61
+ $this->aDBc_permission_adbc_folder_msg = sprintf( __( 'The plugin needs to create the following directory "%1$s" to save the scan results but this was not possible automatically. Please create that directory manually and set correct permissions so it can be writable by the plugin.','advanced-database-cleaner' ), ADBC_UPLOAD_DIR_PATH_TO_ADBC );
62
+
63
+ // Once we display the msg, we delete that option from DB
64
+ delete_option( "aDBc_permission_adbc_folder_needed" );
65
+
66
+ }
67
 
 
 
 
 
 
 
68
  }
69
 
70
  // Test if user wants to delete a scheduled task
86
  $this->aDBc_message = __('The clean-up schedule deleted successfully!', 'advanced-database-cleaner');
87
  }
88
 
89
+ // Verify if the user wants to edit the categorization of a table. This block test comes from edit_item_categorization.php
90
+ if ( ADBC_PLUGIN_PLAN == "pro" ) {
91
+
92
+ if ( isset( $_POST['aDBc_cancel'] ) ) {
93
+
94
+ // If the user cancels the edit, remove the temp file
95
+ if ( file_exists( ADBC_UPLOAD_DIR_PATH_TO_ADBC . "/tables_manually_correction_temp.txt" ) )
96
+ unlink( ADBC_UPLOAD_DIR_PATH_TO_ADBC . "/tables_manually_correction_temp.txt" );
97
+
98
+ } else if ( isset( $_POST['aDBc_correct'] ) ) {
99
+
100
+ // Get the new belongs to of items
101
+ $new_belongs_to = $_POST['new_belongs_to'];
102
+
103
+ // Get value of checkbox to see if user wants to send correction to the server
104
+ if ( isset( $_POST['aDBc_send_correction_to_server'] ) ) {
105
+ $this->aDBc_message = aDBc_edit_categorization_of_items( "tables", $new_belongs_to, 1 );
106
+ } else {
107
+ $this->aDBc_message = aDBc_edit_categorization_of_items( "tables", $new_belongs_to, 0 );
108
+ }
109
+
110
+ // Remove the temp file
111
+ if ( file_exists( ADBC_UPLOAD_DIR_PATH_TO_ADBC . "/tables_manually_correction_temp.txt" ) )
112
+ unlink( ADBC_UPLOAD_DIR_PATH_TO_ADBC . "/tables_manually_correction_temp.txt" );
113
+ }
114
+ }
115
+
116
  // Process bulk action if any before preparing tables to display
117
  $this->process_bulk_action();
118
 
183
  $aDBc_belongs_to_toolip = "<span class='aDBc-tooltips-headers'>
184
  <img class='aDBc-info-image' src='". ADBC_PLUGIN_DIR_PATH . '/images/information2.svg' . "'/>
185
  <span>" . __('Indicates the creator of the table: either a plugin, a theme or WordPress itself. If not sure about the creator, an estimation (%) will be displayed. The higher the percentage is, the more likely that the table belongs to that creator.','advanced-database-cleaner') ." </span>
186
+ </span>";
187
  $columns = array(
188
  'cb' => '<input type="checkbox" />',
 
189
  'table_name' => __('Table name','advanced-database-cleaner'),
190
+ 'table_prefix' => __('Prefix','advanced-database-cleaner'),
191
  'table_rows' => __('Rows','advanced-database-cleaner'),
192
  'table_size' => __('Size','advanced-database-cleaner'),
193
  'table_lost' => __('Lost','advanced-database-cleaner'),
200
  function get_sortable_columns() {
201
 
202
  $sortable_columns = array(
203
+
204
+ 'table_name' => array( 'table_name', false ),
205
+ 'table_rows' => array( 'table_rows', false ),
206
+ 'table_size' => array( 'table_size', false ),
207
+ 'site_id' => array( 'site_id', false )
208
+
209
  );
210
 
211
  return $sortable_columns;
212
+ }
213
+
214
  /** WP: Prepare items to display */
215
  function prepare_items() {
216
  $columns = $this->get_columns();
232
  }
233
 
234
  /** WP: Get columns that should be hidden */
235
+ function get_hidden_columns() {
236
+
237
  // If MU, nothing to hide, else hide Side ID column
238
+ if ( function_exists( 'is_multisite' ) && is_multisite() ) {
239
+
240
+ return array( 'table_prefix', 'table_lost' );
241
+
242
+ } else {
243
+
244
+ return array( 'table_prefix', 'table_lost', 'site_id' );
245
+
246
  }
247
  }
248
 
249
  /** WP: Column default */
250
+ function column_default( $item, $column_name ) {
251
+
252
+ switch ( $column_name ) {
253
+
254
  case 'table_name':
255
+
256
  $prefix_and_name = $item['table_prefix'] . $item[$column_name];
257
+
258
+ $return_name = "<span class='aDBc-bold'>" . $item['table_prefix'] . "</span>" . $item[$column_name];
259
+
260
+ if ( $item['table_lost'] > 0 && in_array( $prefix_and_name, $this->aDBc_tables_name_to_optimize ) ) {
261
+
262
+ $lost = aDBc_get_size_from_bytes( $item['table_lost'] );
263
+
264
+ $return_name .= "<br/>";
265
+ $return_name .= "<span class='aDBc-lost-space'>" . __( 'Lost space', 'advanced-database-cleaner' ) . "</span>";
266
+ $return_name .= "<span style='font-size:12px'> : " . $lost . "</span>";
267
+ $return_name .= "<span style='color:grey'> (" . __( 'to optimize', 'advanced-database-cleaner' ) . ")</span>";
268
+
269
  }
270
+
271
+ if ( in_array( $prefix_and_name, $this->aDBc_tables_name_to_repair ) ) {
272
+
273
+ $return_name .= "<br/>";
274
+ $return_name .= "<span class='aDBc-corrupted'>" . __( 'Corrupted!', 'advanced-database-cleaner' ) . "</span>";
275
+ $return_name .= "<span style='color:grey'> (" . __( 'to repair', 'advanced-database-cleaner' ) . ")</span>";
276
+
277
  }
278
+
279
  return $return_name;
280
  break;
281
+
282
  case 'table_size':
283
+
284
+ return aDBc_get_size_from_bytes( $item['table_size'] );
285
  break;
286
+
287
  case 'table_lost':
288
+
289
+ return aDBc_get_size_from_bytes( $item['table_lost'] );
290
  break;
291
+
292
+ case 'table_prefix':
293
  case 'table_rows':
294
  case 'site_id':
295
  case 'table_belongs_to':
296
+
297
  return $item[$column_name];
298
+
299
  default:
300
+
301
+ return print_r( $item, true ) ; //Show the whole array for troubleshooting purposes
302
+
303
  }
304
  }
305
 
306
  /** WP: Column cb for check box */
307
+ function column_cb( $item ) {
308
+
309
+ return sprintf( '<input type="checkbox" name="aDBc_elements_to_process[]" value="%s" />', $item['table_prefix'] . "|" . $item['table_name'] );
310
+
311
  }
312
 
313
  /** WP: Get bulk actions */
314
  function get_bulk_actions() {
315
 
316
  $actions = array(
317
+ 'scan_selected' => __( 'Scan selected tables', 'advanced-database-cleaner' ),
318
+ 'edit_categorization' => __( 'Edit categorization', 'advanced-database-cleaner' ),
319
+ 'optimize' => __( 'Optimize', 'advanced-database-cleaner' ),
320
+ 'repair' => __( 'Repair', 'advanced-database-cleaner' ),
321
+ 'empty' => __( 'Empty rows', 'advanced-database-cleaner' ),
322
+ 'delete' => __( 'Delete', 'advanced-database-cleaner' )
323
  );
324
+
325
+ if ( ADBC_PLUGIN_PLAN == "free" ) {
326
+
327
+ unset( $actions['scan_selected'] );
328
+ unset( $actions['edit_categorization'] );
329
+
330
+ }
331
+
332
  return $actions;
333
+
334
  }
335
 
336
  /** WP: Message to display when no items found */
337
  function no_items() {
338
+
339
+ _e( 'No tables found!', 'advanced-database-cleaner' );
340
+
341
  }
342
 
343
  /** WP: Process bulk actions */
370
  $table_info = explode("|", $table);
371
  $table_prefix = sanitize_html_class($table_info[0]);
372
  $table_name = sanitize_text_field($table_info[1]);
373
+ // We delete some characters we believe they should not appear in the name: & < > = # ( ) [ ] { } ? " '
374
+ $table_name = preg_replace("/[&<>=#\(\)\[\]\{\}\?\"\' ]/", '', $table_name);
375
  if($wpdb->query("DROP TABLE " . $table_prefix . $table_name)){
376
  array_push($names_deleted, $table_name);
377
  }
378
  }
379
 
380
+ // After deleting tables, delete names also from file categorization
381
+ // xxx (should I add this as well to options & crons?)
382
+ if ( ADBC_PLUGIN_PLAN == "pro" ) {
383
+
384
+ aDBc_refresh_categorization_file_after_delete($names_deleted, 'tables');
385
+
386
+ }
387
+
388
  // Update the message to show to the user
389
  $this->aDBc_message = __('Selected tables cleaned successfully!', 'advanced-database-cleaner');
390
  }
396
  $table_info = explode("|", $table);
397
  $table_prefix = sanitize_html_class($table_info[0]);
398
  $table_name = sanitize_text_field($table_info[1]);
399
+ // We delete some characters we believe they should not appear in the name: & < > = # ( ) [ ] { } ? " '
400
  $table_name = preg_replace("/[&<>=#\(\)\[\]\{\}\?\"\' ]/", '', $table_name);
401
  $wpdb->query("OPTIMIZE TABLE " . $table_prefix . $table_name);
402
  }
411
  $table_info = explode("|", $table);
412
  $table_prefix = sanitize_html_class($table_info[0]);
413
  $table_name = sanitize_text_field($table_info[1]);
414
+ // We delete some characters we believe they should not appear in the name: & < > = # ( ) [ ] { } ? " '
415
  $table_name = preg_replace("/[&<>=#\(\)\[\]\{\}\?\"\' ]/", '', $table_name);
416
  $wpdb->query("TRUNCATE TABLE " . $table_prefix . $table_name);
417
  }
427
  $table_info = explode("|", $table);
428
  $table_prefix = sanitize_html_class($table_info[0]);
429
  $table_name = sanitize_text_field($table_info[1]);
430
+ // We delete some characters we believe they should not appear in the name: & < > = # ( ) [ ] { } ? " '
431
  $table_name = preg_replace("/[&<>=#\(\)\[\]\{\}\?\"\' ]/", '', $table_name);
432
  $query_result = $wpdb->get_results("REPAIR TABLE " . $table_prefix . $table_name);
433
  foreach($query_result as $row){
446
  $this->aDBc_message = __('Some of your tables cannot be repaired!', 'advanced-database-cleaner');
447
  }
448
  }
449
+ }else if($action == 'edit_categorization'){
450
+ // If the user wants to edit categorization of the tables he/she selected
451
+ if(isset($_POST['aDBc_elements_to_process'])){
452
+ // Create a temp file containing tables names to change categorization for
453
+ $aDBc_path_items = @fopen(ADBC_UPLOAD_DIR_PATH_TO_ADBC . "/tables_manually_correction_temp.txt", "w");
454
+ if($aDBc_path_items){
455
+ foreach($_POST['aDBc_elements_to_process'] as $table) {
456
+ $table_info = explode("|", $table);
457
+ $table_name = sanitize_text_field($table_info[1]);
458
+ // We delete some characters we believe they should not appear in the name: & < > = # ( ) [ ] { } ? " '
459
+ $table_name = preg_replace("/[&<>=#\(\)\[\]\{\}\?\"\' ]/", '', $table_name);
460
+ fwrite($aDBc_path_items, $table_name . "\n");
461
+ }
462
+ fclose($aDBc_path_items);
463
+ }
464
+ }
465
+ }
466
  }
467
 
468
  /** Print the page content */
472
  echo '<div id="aDBc_message" class="' . $this->aDBc_class_message . ' notice is-dismissible"><p>' . $this->aDBc_message . '</p></div>';
473
  }
474
 
475
+ // If the search has finished, show a msg success to users + button to double check results against our server database
476
+ echo $this->aDBc_search_has_finished_msg;
 
 
 
 
 
 
 
 
 
 
477
 
478
  // If the folder adbc_uploads cannot be created, show a msg to users
479
  if(!empty($this->aDBc_permission_adbc_folder_msg)){
483
  ?>
484
  <div class="aDBc-content-max-width">
485
 
486
+ <?php
487
+
488
+ // If tables_manually_correction_temp.txt exist, this means that user want to edit categorization.
489
+
490
+ if ( ADBC_PLUGIN_PLAN == "pro" && file_exists( ADBC_UPLOAD_DIR_PATH_TO_ADBC . '/tables_manually_correction_temp.txt' ) ) {
491
+
492
+ include_once 'edit_item_categorization.php';
493
+
494
+ } else {
495
+
496
+ // If not, we print the tables normally
497
+ // Print a notice/warning according to each type of tables
498
+ if ( ADBC_PLUGIN_PLAN == "pro" ) {
499
+
500
+ if($_GET['aDBc_cat'] == 'o' && $this->aDBc_tables_categories_info['o']['count'] > 0){
501
+ echo '<div class="aDBc-box-warning-orphan">' . __('Tables below seem to be orphan! However, please delete only those you are sure to be orphan!','advanced-database-cleaner') . '</div>';
502
+ }else if(($_GET['aDBc_cat'] == 'all' || $_GET['aDBc_cat'] == 'u') && $this->aDBc_tables_categories_info['u']['count'] > 0){
503
+ echo '<div class="aDBc-box-info">' . __('Some of your tables are not categorized yet! Please click on the button below to categorize them!','advanced-database-cleaner') . '</div>';
504
+ }
505
+
506
+ }
507
+
508
+ ?>
509
+
510
  <div class="aDBc-clear-both" style="margin-top:15px"></div>
511
 
512
  <!-- Code for "run new search" button + Show loading image -->
513
+ <div style="float:left">
514
+
515
+ <?php
516
+ if ( $this->aDBc_which_button_to_show == "new_search" ) {
517
+ $aDBc_search_text = __( 'Scan tables', 'advanced-database-cleaner' );
518
+ } else {
519
+ $aDBc_search_text = __( 'Continue scannig ...', 'advanced-database-cleaner' );
520
  }
521
  ?>
522
 
523
+ <!-- Hidden input used by ajax to know which item type we are dealing with -->
524
  <input type="hidden" id="aDBc_item_type" value="tables"/>
525
+
526
+ <?php
527
+ // These hidden inputs are used by ajax to see if we should execute scanning automatically after reloading a page
528
  $iteration = get_option("aDBc_temp_last_iteration_tables");
529
  ?>
 
530
  <input type="hidden" id="aDBc_iteration" value="<?php echo $iteration; ?>"/>
531
+ <input type="hidden" id="aDBc_count_uncategorized" value="<?php echo $this->aDBc_tables_categories_info['u']['count']; ?>"/>
532
+ <input type="hidden" id="aDBc_count_all_items" value="<?php echo $this->aDBc_tables_categories_info['all']['count']; ?>"/>
533
 
534
+ <?php
535
+
536
+ if ( ADBC_PLUGIN_PLAN == "pro" ) {
537
+
538
+ ?>
539
+
540
+ <input id="aDBc_new_search_button" type="submit" class="aDBc-run-new-search" value="<?php echo $aDBc_search_text; ?>" name="aDBc_new_search_button" />
541
+
542
+ <?php
543
+
544
+ } else {
545
+
546
+ ?>
547
+
548
+ <div class="aDBc-premium-tooltip">
549
+
550
+ <input id="aDBc_new_search_button" type="submit" class="aDBc-run-new-search" value="<?php echo $aDBc_search_text; ?>" name="aDBc_new_search_button" style="opacity:0.5" disabled />
551
+
552
+ <span style="width:390px" class="aDBc-premium-tooltiptext">
553
+
554
+ <?php _e('Please <a href="?page=advanced_db_cleaner&aDBc_tab=premium">upgrade</a> to Pro to categorize and detect orphaned tables','advanced-database-cleaner') ?>
555
+
556
+ </span>
557
+
558
+ </div>
559
+
560
+ <?php
561
+ }
562
+ ?>
563
 
564
  </div>
565
 
566
+ <!-- Print numbers of items found in each category -->
567
  <div class="aDBc-category-counts">
568
+
569
  <?php
570
+
571
  $aDBc_new_URI = $_SERVER['REQUEST_URI'];
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
572
 
573
+ // Remove the paged parameter to start always from the first page when selecting a new category
574
+ $aDBc_new_URI = remove_query_arg( 'paged', $aDBc_new_URI );
575
+
576
+ foreach ( $this->aDBc_tables_categories_info as $abreviation => $category_info ) {
577
+
578
+ $aDBc_new_URI = add_query_arg( 'aDBc_cat', $abreviation, $aDBc_new_URI );
579
+ $selected_color = $abreviation == $_GET['aDBc_cat'] ? $category_info['color'] : '#eee';
580
+ $aDBc_link_style = "color:" . $category_info['color'];
581
+ $aDBc_count = $category_info['count'];
582
+
583
+ if ( ADBC_PLUGIN_PLAN == "free" && $abreviation != "all" && $abreviation != "u" ) {
584
+
585
+ $aDBc_new_URI = "";
586
+ $aDBc_link_style = $aDBc_link_style . ";cursor:default;pointer-events:none";
587
+ $aDBc_count = "-";
588
+
589
+ }
590
+
591
+ ?>
592
+ <span class="<?php echo $abreviation == $_GET['aDBc_cat'] ? 'aDBc-selected-category' : ''?>">
593
+
594
+ <span class="aDBc-premium-tooltip aDBc-category-span">
595
+
596
+ <a href="<?php echo $aDBc_new_URI ?>" class="aDBc-category-counts-links" style="<?php echo $aDBc_link_style ?>">
597
+
598
  <span><?php echo $category_info['name']; ?></span>
599
+
600
  </a>
601
+
602
+ <div class="aDBc-category-total" style="border:1px solid <?php echo $selected_color ?>; border-bottom:3px solid <?php echo $selected_color ?>;">
603
+
604
+ <span style="color:#000"><?php echo $aDBc_count ?></span>
605
+
606
+ </div>
607
+
608
+ <?php
609
+ if ( ADBC_PLUGIN_PLAN == "free" && $abreviation != "all" && $abreviation != "u" ) {
610
+ ?>
611
+
612
+ <span style="width:150px" class="aDBc-premium-tooltiptext">
613
+
614
+ <?php _e( 'Available in Pro version!', 'advanced-database-cleaner' ); ?>
615
+
616
+ </span>
617
+
618
+ <?php
619
+ }
620
+ ?>
621
+
622
  </span>
623
 
624
  </span>
625
+
626
+ <?php
627
+ }
628
+ ?>
629
+
630
  </div>
631
 
632
  <div class="aDBc-clear-both"></div>
633
 
634
+ <div id="aDBc-progress-container">
635
+
636
+ <div class="aDBc-progress-background">
637
+ <div id="aDBc-progress-bar" class="aDBc-progress-bar"></div>
638
  </div>
639
+
640
+ <a id="aDBc_stop_scan" href="#" style="color:red">
641
+ <?php _e('Stop the scan','advanced-database-cleaner') ?>
642
+ </a>
643
+
644
+ <span id="aDBc_stopping_msg" style="display:none">
645
+ <?php _e('Stopping...','advanced-database-cleaner') ?>
646
+ </span>
647
+
648
  </div>
649
 
650
  <?php include_once 'header_page_filter.php'; ?>
651
 
652
  <div class="aDBc-clear-both"></div>
653
 
654
+ <form id="aDBc_form" action="" method="post">
655
  <div class="aDBc-left-content">
656
  <?php
 
657
  $this->display();
658
  ?>
659
  </div>
660
  </form>
661
 
662
+ <div class="aDBc-right-box">
663
+
664
+ <div class="aDBc-right-box-content" style="text-align:center">
665
+
666
+ <?php
667
+
668
+ if ( $this->aDBc_total_tables_to_optimize == 0 && $this->aDBc_total_tables_to_repair == 0 ) {
669
+
670
+ ?>
671
  <img width="58px" src="<?php echo ADBC_PLUGIN_DIR_PATH . '/images/db_clean.svg'?>"/>
672
+ <div class="aDBc-text-status-db"><?php _e( 'Your database is optimized!', 'advanced-database-cleaner' ); ?></div>
673
+
674
+ <?php
675
+
676
+ } else {
 
 
 
 
677
 
678
+ // Add link to numbers of tables that should be optimized/repaired
679
+ $aDBc_new_URI = $_SERVER['REQUEST_URI'];
680
+ $aDBc_new_URI = remove_query_arg( array( 'paged', 's', 'belongs_to' ), $aDBc_new_URI );
681
+ $aDBc_new_URI = add_query_arg( 'aDBc_cat', 'all', $aDBc_new_URI );
682
+ ?>
683
  <img width="55px" src="<?php echo ADBC_PLUGIN_DIR_PATH . '/images/warning.svg'?>"/>
684
 
685
+ <?php
686
+ if ( $this->aDBc_total_tables_to_optimize > 0 ) {
687
+
688
+ $aDBc_new_URI = add_query_arg( 't_type', 'optimize', $aDBc_new_URI );
689
+
690
+ ?>
691
  <div class="aDBc-text-status-db">
692
+ <b><a href="<?php echo $aDBc_new_URI; ?>"><?php echo $this->aDBc_total_tables_to_optimize; ?></a></b>
693
+ <?php _e( 'table(s) should be optimized!', 'advanced-database-cleaner' ); ?>
694
  </div>
695
+
696
  <div>
697
+ <?php
698
+ $aDBc_table_size = aDBc_get_size_from_bytes( $this->aDBc_total_lost );
699
+ echo __( 'You can save around', 'advanced-database-cleaner' ) . " : " . $aDBc_table_size;
700
+ ?>
701
  </div>
 
702
 
703
+ <?php
704
+ }
705
+
706
+ if ( $this->aDBc_total_tables_to_repair > 0 ) {
707
+
708
+ $aDBc_new_URI = add_query_arg( 't_type', 'repair', $aDBc_new_URI );
709
+ $to_repair_css = $this->aDBc_total_tables_to_optimize > 0 ? "aDBc-to-repair-section" : "";
710
+
711
  ?>
712
+ <div class="aDBc-text-status-db <?php echo $to_repair_css; ?>">
713
+ <b><a href="<?php echo $aDBc_new_URI; ?>"><?php echo $this->aDBc_total_tables_to_repair; ?></a></b>
714
+ <?php _e( 'table(s) should be repaired!', 'advanced-database-cleaner' ); ?>
715
  </div>
 
716
 
717
+ <?php
718
+ }
719
+ }
720
+ ?>
721
+
722
  </div>
723
 
724
+ <div class="aDBc-right-box-content">
725
 
726
+ <div style="text-align:center">
727
+ <img width="60px" src="<?php echo ADBC_PLUGIN_DIR_PATH . '/images/alarm-clock.svg'?>"/>
728
 
729
+ <?php
730
+ $aDBc_schedules = get_option( 'aDBc_optimize_schedule' );
731
+ $aDBc_schedules = is_array( $aDBc_schedules ) ? $aDBc_schedules : array();
732
+
733
+ // Count schedules available
734
+ $count_schedules = count( $aDBc_schedules );
735
+ echo "<div class='aDBc-schedule-text'><b>" . $count_schedules ."</b> " .__('optimize schedule(s) set','advanced-database-cleaner') . "</div>";
736
+ ?>
737
+ </div>
738
 
739
+ <?php
740
+ foreach ( $aDBc_schedules as $hook_name => $hook_params ) {
 
741
 
 
742
  echo "<div class='aDBc-schedule-hook-box'>";
743
+ echo "<b>" . __( 'Name', 'advanced-database-cleaner' ) . "</b> : " . $hook_name;
744
  echo "</br>";
745
 
746
  // We convert hook name to a string because the arg maybe only a digit!
747
+ $timestamp = wp_next_scheduled( "aDBc_optimize_scheduler", array( $hook_name . '' ) );
748
  if($timestamp){
749
  $next_run = get_date_from_gmt(date('Y-m-d H:i:s', $timestamp), 'M j, Y - H:i');
750
  }else{
776
  break;
777
  case "monthly" :
778
  $repeat = __('Monthly','advanced-database-cleaner');
779
+ break;
780
  }
781
 
782
  echo "<b>".__('Frequency','advanced-database-cleaner') . "</b> : " . $repeat . "</br>";
789
 
790
  ?>
791
 
792
+ <span class="aDBc-edit-delete-schedule">
793
+
794
+ <a href="<?php echo $aDBc_new_URI ?>" class="aDBc-edit-schedule-link">
795
+ <?php _e( 'Edit', 'advanced-database-cleaner' ); ?>
796
+ </a>
797
+ |
798
+ <form action="" method="post" class="aDBc-delete-schedule-link">
799
  <input type="hidden" name="aDBc_delete_schedule" value="<?php echo $hook_name ?>" />
800
  <input class="aDBc-submit-link" type="submit" value="<?php _e('Delete','advanced-database-cleaner') ?>" />
801
  <?php wp_nonce_field('delete_optimize_schedule_nonce', 'delete_optimize_schedule_nonce') ?>
802
  </form>
803
+
804
  </span>
805
+
806
  </div>
807
  <?php
808
 
810
 
811
  $aDBc_new_URI = $_SERVER['REQUEST_URI'];
812
  $aDBc_new_URI = add_query_arg('aDBc_view', 'add_optimize_schedule', $aDBc_new_URI);
813
+ ?>
814
 
815
+ <a href="<?php echo $aDBc_new_URI ?>" id="aDBc_add_schedule" class="button-primary aDBc-add-new-schedule">
816
+ <?php _e('Add new schedule','advanced-database-cleaner'); ?>
817
+ </a>
818
 
819
  </div>
820
 
821
+ </div>
822
 
823
  <div class="aDBc-clear-both"></div>
824
+ <?php
825
+ }
826
+ ?>
827
+ </div>
828
  <?php
829
  }
830
  }
831
 
832
  new ADBC_Tables_List();
833
 
834
+ ?>
includes/class_general_cleanup.php CHANGED
@@ -1,21 +1,24 @@
1
  <?php
 
 
 
2
  class ADBC_Clean_DB_List extends WP_List_Table {
3
 
4
- private $aDBc_message = "";
5
- private $aDBc_class_message = "updated";
6
- private $aDBc_elements_to_display = array();
7
- private $aDBc_total_elements_to_clean = 0;
8
 
9
  /**
10
  * Constructor
11
  */
12
  function __construct(){
13
-
14
  parent::__construct(array(
15
  'singular' => __('Element', 'advanced-database-cleaner'), //singular name of the listed records
16
  'plural' => __('Elements', 'advanced-database-cleaner'), //plural name of the listed records
17
  'ajax' => false //does this table support ajax?
18
- ));
19
 
20
  $this->aDBc_prepare_elements_to_clean();
21
  $this->aDBc_print_page_content();
@@ -56,12 +59,12 @@ class ADBC_Clean_DB_List extends WP_List_Table {
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'];
@@ -88,9 +91,9 @@ class ADBC_Clean_DB_List extends WP_List_Table {
88
  $aDBc_schedules = is_array($aDBc_schedules) ? $aDBc_schedules : array();
89
 
90
  foreach($aDBc_unused_elements as $element_type => $element_info){
91
- // Count total unused elements. DO not take into account transient with expiration and not expiring transients because they are not intended to be cleaned
92
- if($element_type != "transients-with-expiration" && $element_type != "transients-with-no-expiration")
93
- $this->aDBc_total_elements_to_clean += $element_info['count'];
94
 
95
  // If the item is scheduled, show green image, otherwise show grey one. Select also the text to show next green image
96
  $scheduled_img_name = "grey_clock.svg";
@@ -99,21 +102,18 @@ class ADBC_Clean_DB_List extends WP_List_Table {
99
  $lits_of_elements = $hook_params['elements_to_clean'];
100
  if(in_array ($element_type, $lits_of_elements)){
101
  $scheduled_img_name = "green_clock.svg";
102
- $item_scheduled_in .= "<div style='background:#f1f5f5;color:#000;border-radius:4px;padding:1px;margin:2px'>" . $hook_name . "</div>";
103
  }
104
  }
105
  if(empty($item_scheduled_in)){
106
- $aDBc_scheduled = "<img style='width:20px' alt='-' src='".ADBC_PLUGIN_DIR_PATH . "/images/" . $scheduled_img_name . "'/>";
107
  }else{
108
  $aDBc_scheduled = "<span class='aDBc-tooltips-headers'>
109
- <img class='aDBc-info-image' style='width:20px' alt='-' src='".ADBC_PLUGIN_DIR_PATH . "/images/" . $scheduled_img_name . "'/><span style='width:190px'>" . __('Scheduled in:','advanced-database-cleaner') . $item_scheduled_in . "</span></span>";
110
  }
111
 
112
  if($element_info['count'] > 0){
113
  $color = "red";
114
- if($element_type == "transients-with-expiration" || $element_type == "transients-with-no-expiration"){
115
- $color = "#999";
116
- }
117
  $aDBc_count = "<font color='$color' style='font-weight:bold'>" . $element_info['count'] . "</font>";
118
  $aDBc_new_URI = add_query_arg('aDBc_view', $element_type, $aDBc_new_URI);
119
  $aDBc_see = "<a href='$aDBc_new_URI'><img width='20px' alt='view' src='".ADBC_PLUGIN_DIR_PATH . '/images/see.svg'."'/></a>";
@@ -134,37 +134,37 @@ class ADBC_Clean_DB_List extends WP_List_Table {
134
  }
135
  }
136
  // If the item can have keep_last, then prepare it, otherwise echo N/A
137
- if($element_type == "revision" ||
138
- $element_type == "auto-draft" ||
139
- $element_type == "trash-posts" ||
140
- $element_type == "moderated-comments" ||
141
- $element_type == "spam-comments" ||
142
- $element_type == "trash-comments" ||
143
- $element_type == "pingbacks" ||
144
  $element_type == "trackbacks"){
145
 
146
  $save_button = __('Save','advanced-database-cleaner');
147
 
148
- $keep_info = "<span id='aDBc_keep_label_$element_type'>" . $keep_number . " " . __('days','advanced-database-cleaner') . " | </span>" . "<a id='aDBc_edit_keep_$element_type' class='aDBc_keep_link'>Edit</a>";
149
 
150
  $keep_info .= "<form action='' method='post'>
151
  <input type='hidden' name='aDBc_item_keep_to_edit' value='$element_type'>
152
- <input id='aDBc_keep_input_$element_type' class='aDBc_keep_input' name='aDBc_keep_input' value='$keep_number'/>
153
- <input id='aDBc_keep_button_$element_type' class='aDBc_keep_button button-primary' type='submit' value='$save_button' style='display: none;'/>
154
- <a id='aDBc_keep_cancel_$element_type' class='aDBc_keep_cancel_link'> " . __('Cancel','advanced-database-cleaner') . "</a></form>";
155
  }else{
156
  $keep_info = __('N/A','advanced-database-cleaner') ;
157
  }
158
-
159
-
160
- if($element_type == "revision"){
161
 
162
  }else if($element_type == "revision"){
163
  $keep_info = __('N/A','advanced-database-cleaner') ;
164
- }
165
 
166
  array_push($this->aDBc_elements_to_display, array(
167
- 'element_to_clean' => "<a href='". $element_info['URL_blog'] ."' target='_blank' class='aDBc_info_icon'>&nbsp;</a>" . $element_info['name'],
168
  'count' => $aDBc_count,
169
  'view' => $aDBc_see,
170
  'scheduled' => $aDBc_scheduled,
@@ -178,17 +178,17 @@ class ADBC_Clean_DB_List extends WP_List_Table {
178
  }
179
 
180
  /** WP: Get columns */
181
- function get_columns(){
182
 
183
  $aDBc_scheduled_toolip = "<span class='aDBc-tooltips-headers'>
184
  <img class='aDBc-info-image' src='". ADBC_PLUGIN_DIR_PATH . '/images/information2.svg' . "'/>
185
  <span>" . __('Indicates if you have selected the item to be cleaned automatically on a scheduled task. A green image indicates that the item is scheduled while a grey image indicated the opposite.','advanced-database-cleaner') ." </span>
186
  </span>";
187
-
188
  $aDBc_keep_last_toolip = "<span class='aDBc-tooltips-headers'>
189
  <img class='aDBc-info-image' src='". ADBC_PLUGIN_DIR_PATH . '/images/information2.svg' . "'/>
190
  <span>" . __('Keep the last x days’ data from being displayed, and therefore from being cleaned. The plugin will always show only data older than the number of days you have specified.','advanced-database-cleaner') ." </span>
191
- </span>";
192
 
193
  $columns = array(
194
  'cb' => '<input type="checkbox" />',
@@ -222,13 +222,13 @@ class ADBC_Clean_DB_List extends WP_List_Table {
222
  /** WP: Get columns that should be hidden */
223
  function get_hidden_columns(){
224
  return array('type');
225
- }
226
 
227
  /** WP: Column default */
228
  function column_default($item, $column_name){
229
  switch($column_name){
230
  case 'element_to_clean':
231
- case 'count':
232
  case 'view':
233
  case 'scheduled':
234
  case 'keep':
@@ -312,46 +312,68 @@ class ADBC_Clean_DB_List extends WP_List_Table {
312
  // Print the elements to clean
313
  $this->display();
314
  ?>
 
315
  </form>
316
  </div>
317
  <div class="aDBc-right-box">
318
 
319
- <div style="text-align:center">
320
- <?php if($this->aDBc_total_elements_to_clean == 0){ ?>
 
 
 
 
 
321
  <img width="58px" src="<?php echo ADBC_PLUGIN_DIR_PATH . '/images/db_clean.svg'?>"/>
322
- <div class="aDBc-text-status-db"><?php _e('Your database is clean!','advanced-database-cleaner'); ?></div>
323
- <?php } else { ?>
 
 
 
 
 
324
  <img width="55px" src="<?php echo ADBC_PLUGIN_DIR_PATH . '/images/warning.svg'?>"/>
325
- <div class="aDBc-text-status-db"><b><?php echo $this->aDBc_total_elements_to_clean; ?></b> <?php _e('Element(s) can be cleaned!','advanced-database-cleaner'); ?></div>
326
- <?php } ?>
 
 
 
 
 
 
327
  </div>
328
 
329
- <div class="aDBc-schedule-box" style="text-align:center">
330
 
331
- <img width="60px" src="<?php echo ADBC_PLUGIN_DIR_PATH . '/images/alarm-clock.svg'?>"/>
 
332
 
333
- <?php
334
- $aDBc_schedules = get_option('aDBc_clean_schedule');
335
- $aDBc_schedules = is_array($aDBc_schedules) ? $aDBc_schedules : array();
336
 
337
- // Count schedules available
338
- $count_schedules = count($aDBc_schedules);
339
- echo "<div class='aDBc-schedule-text'><b>" . $count_schedules ."</b> " .__('Cleanup schedule(s) set','advanced-database-cleaner') . "</div>";
 
 
 
 
 
340
 
341
- foreach($aDBc_schedules as $hook_name => $hook_params){
342
  echo "<div class='aDBc-schedule-hook-box'>";
343
- echo "<b>".__('Name','advanced-database-cleaner') . "</b> : " . $hook_name;
344
  echo "</br>";
345
 
346
  // We convert hook name to a string because the arg maybe only a digit!
347
- $timestamp = wp_next_scheduled("aDBc_clean_scheduler", array($hook_name . ''));
348
  if($timestamp){
349
  $next_run = get_date_from_gmt(date('Y-m-d H:i:s', $timestamp), 'M j, Y - H:i');
350
  }else{
351
  $next_run = "---";
352
  }
353
  echo "<b>".__('Next run','advanced-database-cleaner') . "</b> : " . $next_run . "</br>";
354
-
355
  $repeat = $hook_params['repeat'];
356
  switch($repeat){
357
  case "once" :
@@ -371,7 +393,7 @@ class ADBC_Clean_DB_List extends WP_List_Table {
371
  break;
372
  case "monthly" :
373
  $repeat = __('Monthly','advanced-database-cleaner');
374
- break;
375
  }
376
 
377
  echo "<b>".__('Frequency','advanced-database-cleaner') . "</b> : " . $repeat . "</br>";
@@ -386,32 +408,37 @@ class ADBC_Clean_DB_List extends WP_List_Table {
386
 
387
  ?>
388
 
389
- <span style="border-radius: 4px;font-size:11px;background:#f0f5fa;padding:2px 4px;float:right;margin-top:4px">
390
- <a href="<?php echo $aDBc_new_URI ?>" style="text-decoration:none;margin-right:3px">
391
- <?php _e('Edit','advanced-database-cleaner') ?>
392
- </a> |
393
- <form action="" method="post" style="float:right;margin-left:3px">
 
 
394
  <input type="hidden" name="aDBc_delete_schedule" value="<?php echo $hook_name ?>" />
395
- <input class="aDBc-submit-link" type="submit" value="<?php _e('Delete','advanced-database-cleaner') ?>" />
396
  <?php wp_nonce_field('delete_cleanup_schedule_nonce', 'delete_cleanup_schedule_nonce') ?>
397
  </form>
 
398
  </span>
399
- </div>
400
 
 
401
  <?php
402
 
403
  }
404
 
405
  $aDBc_new_URI = $_SERVER['REQUEST_URI'];
406
  $aDBc_new_URI = add_query_arg('aDBc_view', 'add_cleanup_schedule', $aDBc_new_URI);
407
- ?>
408
 
409
- <a href="<?php echo $aDBc_new_URI ?>" id="aDBc_add_schedule" style="margin-top:20px;width:100%" class="button-primary">
410
- <?php _e('Add new schedule','advanced-database-cleaner'); ?>
411
- </a>
412
 
413
  </div>
414
- </div>
 
 
415
  <div class="aDBc-clear-both"></div>
416
  </div>
417
 
@@ -420,4 +447,4 @@ class ADBC_Clean_DB_List extends WP_List_Table {
420
  }
421
 
422
  new ADBC_Clean_DB_List();
423
- ?>
1
  <?php
2
+
3
+ // Style ok, code not yet
4
+
5
  class ADBC_Clean_DB_List extends WP_List_Table {
6
 
7
+ private $aDBc_message = "";
8
+ private $aDBc_class_message = "updated";
9
+ private $aDBc_elements_to_display = array();
10
+ private $aDBc_total_elements_to_clean = 0;
11
 
12
  /**
13
  * Constructor
14
  */
15
  function __construct(){
16
+
17
  parent::__construct(array(
18
  'singular' => __('Element', 'advanced-database-cleaner'), //singular name of the listed records
19
  'plural' => __('Elements', 'advanced-database-cleaner'), //plural name of the listed records
20
  'ajax' => false //does this table support ajax?
21
+ ));
22
 
23
  $this->aDBc_prepare_elements_to_clean();
24
  $this->aDBc_print_page_content();
59
  $keep_value = $settings['keep_last'];
60
  $keep_value[$sanitized_item_keep_to_edit] = intval($sanitized_keep_input);
61
  }
62
+ $settings['keep_last'] = $keep_value;
63
  update_option('aDBc_settings', $settings, "no");
64
 
65
  // Test if the items belongs to a scheduled task. If so, show msg differently
66
  $aDBc_schedules = get_option('aDBc_clean_schedule');
67
+ $aDBc_schedules = is_array($aDBc_schedules) ? $aDBc_schedules : array();
68
  $msg_keep_last = __("The 'keep last' value saved successfully!", "advanced-database-cleaner");
69
  foreach($aDBc_schedules as $hook_name => $hook_params){
70
  $lits_of_elements = $hook_params['elements_to_clean'];
91
  $aDBc_schedules = is_array($aDBc_schedules) ? $aDBc_schedules : array();
92
 
93
  foreach($aDBc_unused_elements as $element_type => $element_info){
94
+
95
+ // Count total unused elements
96
+ $this->aDBc_total_elements_to_clean += $element_info['count'];
97
 
98
  // If the item is scheduled, show green image, otherwise show grey one. Select also the text to show next green image
99
  $scheduled_img_name = "grey_clock.svg";
102
  $lits_of_elements = $hook_params['elements_to_clean'];
103
  if(in_array ($element_type, $lits_of_elements)){
104
  $scheduled_img_name = "green_clock.svg";
105
+ $item_scheduled_in .= "<div class='aDBc-scheduled-in-row'>" . $hook_name . "</div>";
106
  }
107
  }
108
  if(empty($item_scheduled_in)){
109
+ $aDBc_scheduled = "<img style='width:17px' alt='-' src='".ADBC_PLUGIN_DIR_PATH . "/images/" . $scheduled_img_name . "'/>";
110
  }else{
111
  $aDBc_scheduled = "<span class='aDBc-tooltips-headers'>
112
+ <img class='aDBc-info-image' style='width:17px' alt='-' src='".ADBC_PLUGIN_DIR_PATH . "/images/" . $scheduled_img_name . "'/><span style='width:190px'>" . __('Scheduled in:','advanced-database-cleaner') . $item_scheduled_in . "</span></span>";
113
  }
114
 
115
  if($element_info['count'] > 0){
116
  $color = "red";
 
 
 
117
  $aDBc_count = "<font color='$color' style='font-weight:bold'>" . $element_info['count'] . "</font>";
118
  $aDBc_new_URI = add_query_arg('aDBc_view', $element_type, $aDBc_new_URI);
119
  $aDBc_see = "<a href='$aDBc_new_URI'><img width='20px' alt='view' src='".ADBC_PLUGIN_DIR_PATH . '/images/see.svg'."'/></a>";
134
  }
135
  }
136
  // If the item can have keep_last, then prepare it, otherwise echo N/A
137
+ if($element_type == "revision" ||
138
+ $element_type == "auto-draft" ||
139
+ $element_type == "trash-posts" ||
140
+ $element_type == "moderated-comments" ||
141
+ $element_type == "spam-comments" ||
142
+ $element_type == "trash-comments" ||
143
+ $element_type == "pingbacks" ||
144
  $element_type == "trackbacks"){
145
 
146
  $save_button = __('Save','advanced-database-cleaner');
147
 
148
+ $keep_info = "<span id='aDBc_keep_label_$element_type'>" . $keep_number . " " . __('days','advanced-database-cleaner') . " | </span>" . "<a id='aDBc_edit_keep_$element_type' class='aDBc-keep-link'>Edit</a>";
149
 
150
  $keep_info .= "<form action='' method='post'>
151
  <input type='hidden' name='aDBc_item_keep_to_edit' value='$element_type'>
152
+ <input id='aDBc_keep_input_$element_type' class='aDBc-keep-input' name='aDBc_keep_input' value='$keep_number'/>
153
+ <input id='aDBc_keep_button_$element_type' class='aDBc-keep-button button-primary' type='submit' value='$save_button' style='display:none'/>
154
+ <a id='aDBc_keep_cancel_$element_type' class='aDBc-keep-cancel-link'> " . __('Cancel','advanced-database-cleaner') . "</a></form>";
155
  }else{
156
  $keep_info = __('N/A','advanced-database-cleaner') ;
157
  }
158
+
159
+
160
+ if($element_type == "revision"){
161
 
162
  }else if($element_type == "revision"){
163
  $keep_info = __('N/A','advanced-database-cleaner') ;
164
+ }
165
 
166
  array_push($this->aDBc_elements_to_display, array(
167
+ 'element_to_clean' => "<a href='". $element_info['URL_blog'] ."' target='_blank' class='aDBc-info-icon'>&nbsp;</a>" . $element_info['name'],
168
  'count' => $aDBc_count,
169
  'view' => $aDBc_see,
170
  'scheduled' => $aDBc_scheduled,
178
  }
179
 
180
  /** WP: Get columns */
181
+ function get_columns() {
182
 
183
  $aDBc_scheduled_toolip = "<span class='aDBc-tooltips-headers'>
184
  <img class='aDBc-info-image' src='". ADBC_PLUGIN_DIR_PATH . '/images/information2.svg' . "'/>
185
  <span>" . __('Indicates if you have selected the item to be cleaned automatically on a scheduled task. A green image indicates that the item is scheduled while a grey image indicated the opposite.','advanced-database-cleaner') ." </span>
186
  </span>";
187
+
188
  $aDBc_keep_last_toolip = "<span class='aDBc-tooltips-headers'>
189
  <img class='aDBc-info-image' src='". ADBC_PLUGIN_DIR_PATH . '/images/information2.svg' . "'/>
190
  <span>" . __('Keep the last x days’ data from being displayed, and therefore from being cleaned. The plugin will always show only data older than the number of days you have specified.','advanced-database-cleaner') ." </span>
191
+ </span>";
192
 
193
  $columns = array(
194
  'cb' => '<input type="checkbox" />',
222
  /** WP: Get columns that should be hidden */
223
  function get_hidden_columns(){
224
  return array('type');
225
+ }
226
 
227
  /** WP: Column default */
228
  function column_default($item, $column_name){
229
  switch($column_name){
230
  case 'element_to_clean':
231
+ case 'count':
232
  case 'view':
233
  case 'scheduled':
234
  case 'keep':
312
  // Print the elements to clean
313
  $this->display();
314
  ?>
315
+
316
  </form>
317
  </div>
318
  <div class="aDBc-right-box">
319
 
320
+ <div class="aDBc-right-box-content" style="text-align:center">
321
+
322
+ <?php
323
+
324
+ if ( $this->aDBc_total_elements_to_clean == 0 ) {
325
+
326
+ ?>
327
  <img width="58px" src="<?php echo ADBC_PLUGIN_DIR_PATH . '/images/db_clean.svg'?>"/>
328
+ <div class="aDBc-text-status-db"><?php _e( 'Your database is clean!', 'advanced-database-cleaner' ); ?></div>
329
+
330
+ <?php
331
+
332
+ } else {
333
+
334
+ ?>
335
  <img width="55px" src="<?php echo ADBC_PLUGIN_DIR_PATH . '/images/warning.svg'?>"/>
336
+ <div class="aDBc-text-status-db">
337
+ <b><?php echo $this->aDBc_total_elements_to_clean; ?></b> <?php _e('Element(s) can be cleaned!','advanced-database-cleaner'); ?>
338
+ </div>
339
+
340
+ <?php
341
+ }
342
+ ?>
343
+
344
  </div>
345
 
346
+ <div class="aDBc-right-box-content">
347
 
348
+ <div style="text-align:center">
349
+ <img width="60px" src="<?php echo ADBC_PLUGIN_DIR_PATH . '/images/alarm-clock.svg'?>"/>
350
 
351
+ <?php
352
+ $aDBc_schedules = get_option( 'aDBc_clean_schedule' );
353
+ $aDBc_schedules = is_array( $aDBc_schedules ) ? $aDBc_schedules : array();
354
 
355
+ // Count schedules available
356
+ $count_schedules = count( $aDBc_schedules );
357
+ echo "<div class='aDBc-schedule-text'><b>" . $count_schedules ."</b> " .__('Cleanup schedule(s) set','advanced-database-cleaner') . "</div>";
358
+ ?>
359
+ </div>
360
+
361
+ <?php
362
+ foreach ( $aDBc_schedules as $hook_name => $hook_params ) {
363
 
 
364
  echo "<div class='aDBc-schedule-hook-box'>";
365
+ echo "<b>" . __( 'Name', 'advanced-database-cleaner' ) . "</b> : " . $hook_name;
366
  echo "</br>";
367
 
368
  // We convert hook name to a string because the arg maybe only a digit!
369
+ $timestamp = wp_next_scheduled( "aDBc_clean_scheduler", array( $hook_name . '' ) );
370
  if($timestamp){
371
  $next_run = get_date_from_gmt(date('Y-m-d H:i:s', $timestamp), 'M j, Y - H:i');
372
  }else{
373
  $next_run = "---";
374
  }
375
  echo "<b>".__('Next run','advanced-database-cleaner') . "</b> : " . $next_run . "</br>";
376
+
377
  $repeat = $hook_params['repeat'];
378
  switch($repeat){
379
  case "once" :
393
  break;
394
  case "monthly" :
395
  $repeat = __('Monthly','advanced-database-cleaner');
396
+ break;
397
  }
398
 
399
  echo "<b>".__('Frequency','advanced-database-cleaner') . "</b> : " . $repeat . "</br>";
408
 
409
  ?>
410
 
411
+ <span class="aDBc-edit-delete-schedule">
412
+
413
+ <a href="<?php echo $aDBc_new_URI ?>" class="aDBc-edit-schedule-link">
414
+ <?php _e( 'Edit', 'advanced-database-cleaner' ); ?>
415
+ </a>
416
+ |
417
+ <form action="" method="post" class="aDBc-delete-schedule-link">
418
  <input type="hidden" name="aDBc_delete_schedule" value="<?php echo $hook_name ?>" />
419
+ <input class="aDBc-submit-link" type="submit" value="<?php _e('Delete','advanced-database-cleaner') ?>" />
420
  <?php wp_nonce_field('delete_cleanup_schedule_nonce', 'delete_cleanup_schedule_nonce') ?>
421
  </form>
422
+
423
  </span>
 
424
 
425
+ </div>
426
  <?php
427
 
428
  }
429
 
430
  $aDBc_new_URI = $_SERVER['REQUEST_URI'];
431
  $aDBc_new_URI = add_query_arg('aDBc_view', 'add_cleanup_schedule', $aDBc_new_URI);
432
+ ?>
433
 
434
+ <a href="<?php echo $aDBc_new_URI ?>" id="aDBc_add_schedule" class="button-primary aDBc-add-new-schedule">
435
+ <?php _e('Add new schedule','advanced-database-cleaner'); ?>
436
+ </a>
437
 
438
  </div>
439
+
440
+ </div>
441
+
442
  <div class="aDBc-clear-both"></div>
443
  </div>
444
 
447
  }
448
 
449
  new ADBC_Clean_DB_List();
450
+ ?>
includes/clean_db.php CHANGED
@@ -1,60 +1,67 @@
1
  <?php
2
 
3
- if(isset($_GET['aDBc_view'])){
4
 
5
  // If the user wants to perform custom cleaning
6
 
7
- if($_GET['aDBc_view'] == "revision" ||
8
- $_GET['aDBc_view'] == "auto-draft" ||
9
- $_GET['aDBc_view'] == "trash-posts"){
10
 
11
  include_once 'custom-clean-view/class_clean_revision_draft_trash.php';
12
- new ADBC_Clean_Revision_Trash_Draft($_GET['aDBc_view']);
13
 
14
- }else if($_GET['aDBc_view'] == "moderated-comments" ||
15
- $_GET['aDBc_view'] == "spam-comments" ||
16
- $_GET['aDBc_view'] == "trash-comments" ||
17
- $_GET['aDBc_view'] == "pingbacks" ||
18
- $_GET['aDBc_view'] == "trackbacks"){
 
 
19
 
20
  include_once 'custom-clean-view/class_clean_comment.php';
21
- new ADBC_Clean_Comment($_GET['aDBc_view']);
22
 
23
- }else if($_GET['aDBc_view'] == "orphan-postmeta" ||
24
- $_GET['aDBc_view'] == "orphan-commentmeta" ||
25
- $_GET['aDBc_view'] == "orphan-usermeta" ||
26
- $_GET['aDBc_view'] == "orphan-termmeta"){
 
 
27
 
28
  include_once 'custom-clean-view/class_clean_meta_comment_post_user_term.php';
29
- new ADBC_Clean_Meta_Comment_Post_User_Term($_GET['aDBc_view']);
30
 
31
- }else if($_GET['aDBc_view'] == "orphan-relationships"){
 
 
32
 
33
  include_once 'custom-clean-view/class_clean_relationships.php';
 
34
  new ADBC_Clean_Relationship();
35
 
36
- }else if($_GET['aDBc_view'] == "expired-transients" ||
37
- $_GET['aDBc_view'] == "transients-with-expiration" ||
38
- $_GET['aDBc_view'] == "transients-with-no-expiration"){
39
 
40
  include_once 'custom-clean-view/class_clean_transient.php';
41
- new ADBC_Clean_Transient($_GET['aDBc_view']);
42
 
43
- }else if($_GET['aDBc_view'] == "add_cleanup_schedule"){
 
 
44
 
45
  include_once 'custom-schedule-view/class_add_cleanup_schedule.php';
46
- new ADBC_SCHEDULE_CLEANUP($_GET['aDBc_view']);
47
 
48
- }else if($_GET['aDBc_view'] == "edit_cleanup_schedule"){
 
 
49
 
50
  include_once 'custom-schedule-view/class_edit_cleanup_schedule.php';
 
51
  new EDIT_SCHEDULE_CLEANUP($_GET['aDBc_view']);
52
 
53
  }
54
 
55
- }else{
56
- // Else return the general clean-up page
 
57
  include_once 'class_general_cleanup.php';
 
58
  }
59
 
60
  ?>
1
  <?php
2
 
3
+ if ( isset( $_GET['aDBc_view'] ) ) {
4
 
5
  // If the user wants to perform custom cleaning
6
 
7
+ if ( $_GET['aDBc_view'] == "revision" ||
8
+ $_GET['aDBc_view'] == "auto-draft" ||
9
+ $_GET['aDBc_view'] == "trash-posts" ) {
10
 
11
  include_once 'custom-clean-view/class_clean_revision_draft_trash.php';
 
12
 
13
+ new ADBC_Clean_Revision_Trash_Draft( $_GET['aDBc_view'] );
14
+
15
+ } else if ( $_GET['aDBc_view'] == "moderated-comments" ||
16
+ $_GET['aDBc_view'] == "spam-comments" ||
17
+ $_GET['aDBc_view'] == "trash-comments" ||
18
+ $_GET['aDBc_view'] == "pingbacks" ||
19
+ $_GET['aDBc_view'] == "trackbacks" ) {
20
 
21
  include_once 'custom-clean-view/class_clean_comment.php';
 
22
 
23
+ new ADBC_Clean_Comment( $_GET['aDBc_view'] );
24
+
25
+ } else if ( $_GET['aDBc_view'] == "orphan-postmeta" ||
26
+ $_GET['aDBc_view'] == "orphan-commentmeta" ||
27
+ $_GET['aDBc_view'] == "orphan-usermeta" ||
28
+ $_GET['aDBc_view'] == "orphan-termmeta" ) {
29
 
30
  include_once 'custom-clean-view/class_clean_meta_comment_post_user_term.php';
 
31
 
32
+ new ADBC_Clean_Meta_Comment_Post_User_Term( $_GET['aDBc_view'] );
33
+
34
+ } else if ( $_GET['aDBc_view'] == "orphan-relationships" ) {
35
 
36
  include_once 'custom-clean-view/class_clean_relationships.php';
37
+
38
  new ADBC_Clean_Relationship();
39
 
40
+ } else if ( $_GET['aDBc_view'] == "expired-transients" ) {
 
 
41
 
42
  include_once 'custom-clean-view/class_clean_transient.php';
 
43
 
44
+ new ADBC_Clean_Transient( $_GET['aDBc_view'] );
45
+
46
+ } else if ( $_GET['aDBc_view'] == "add_cleanup_schedule" ) {
47
 
48
  include_once 'custom-schedule-view/class_add_cleanup_schedule.php';
 
49
 
50
+ new ADBC_SCHEDULE_CLEANUP( $_GET['aDBc_view'] );
51
+
52
+ } else if ( $_GET['aDBc_view'] == "edit_cleanup_schedule" ) {
53
 
54
  include_once 'custom-schedule-view/class_edit_cleanup_schedule.php';
55
+
56
  new EDIT_SCHEDULE_CLEANUP($_GET['aDBc_view']);
57
 
58
  }
59
 
60
+ } else {
61
+
62
+ // Else, return the general clean-up page
63
  include_once 'class_general_cleanup.php';
64
+
65
  }
66
 
67
  ?>
includes/custom-clean-view/class_clean_comment.php CHANGED
@@ -7,7 +7,7 @@ class ADBC_Clean_Comment extends WP_List_Table {
7
  private $aDBc_elements_to_display = array();
8
  private $aDBc_type_to_clean = "";
9
  private $aDBc_plural_title = "";
10
- private $aDBc_column_comment_name = "";
11
  private $aDBc_sql_get_elements = "";
12
  private $aDBc_custom_sql_args = "";
13
  private $aDBc_search_sql_arg = "";
@@ -68,13 +68,20 @@ class ADBC_Clean_Comment extends WP_List_Table {
68
  }
69
 
70
  // Prepare additional sql args if any: per page, LIMIT, OFFSET, etc.
71
- $this->aDBc_order_by_sql_arg = aDBc_get_order_by_sql_arg("comment_ID");
 
 
 
 
 
 
 
72
  $this->aDBc_limit_offset_sql_arg = aDBc_get_limit_offset_sql_args();
73
 
74
  parent::__construct(array(
75
- 'singular' => $aDBc_singular, //singular name of the listed records
76
- 'plural' => $this->aDBc_plural_title, //plural name of the listed records
77
- 'ajax' => false //does this table support ajax?
78
  ));
79
 
80
  $this->aDBc_prepare_elements_to_clean();
@@ -192,7 +199,7 @@ class ADBC_Clean_Comment extends WP_List_Table {
192
  return array('site_id');
193
  }
194
  }
195
-
196
  function get_sortable_columns() {
197
 
198
  $sortable_columns = array(
@@ -205,7 +212,7 @@ class ADBC_Clean_Comment extends WP_List_Table {
205
  }else{
206
  return $sortable_columns;
207
  }
208
- }
209
 
210
  /** WP: Prepare items to display */
211
  function prepare_items() {
7
  private $aDBc_elements_to_display = array();
8
  private $aDBc_type_to_clean = "";
9
  private $aDBc_plural_title = "";
10
+ private $aDBc_column_comment_name = "";
11
  private $aDBc_sql_get_elements = "";
12
  private $aDBc_custom_sql_args = "";
13
  private $aDBc_search_sql_arg = "";
68
  }
69
 
70
  // Prepare additional sql args if any: per page, LIMIT, OFFSET, etc.
71
+
72
+ if ( ADBC_PLUGIN_PLAN == "pro" ) {
73
+
74
+ $this->aDBc_search_sql_arg = aDBc_get_search_sql_arg( "comment_author", "comment_content" );
75
+
76
+ }
77
+
78
+ $this->aDBc_order_by_sql_arg = aDBc_get_order_by_sql_arg( "comment_ID" );
79
  $this->aDBc_limit_offset_sql_arg = aDBc_get_limit_offset_sql_args();
80
 
81
  parent::__construct(array(
82
+ 'singular' => $aDBc_singular,
83
+ 'plural' => $this->aDBc_plural_title,
84
+ 'ajax' => false
85
  ));
86
 
87
  $this->aDBc_prepare_elements_to_clean();
199
  return array('site_id');
200
  }
201
  }
202
+
203
  function get_sortable_columns() {
204
 
205
  $sortable_columns = array(
212
  }else{
213
  return $sortable_columns;
214
  }
215
+ }
216
 
217
  /** WP: Prepare items to display */
218
  function prepare_items() {
includes/custom-clean-view/class_clean_meta_comment_post_user_term.php CHANGED
@@ -1,5 +1,7 @@
1
  <?php
2
- /** Used to view comment meta and post meta */
 
 
3
  class ADBC_Clean_Meta_Comment_Post_User_Term extends WP_List_Table {
4
 
5
  private $aDBc_message = "";
@@ -7,9 +9,9 @@ class ADBC_Clean_Meta_Comment_Post_User_Term extends WP_List_Table {
7
  private $aDBc_elements_to_display = array();
8
  private $aDBc_type_to_clean = "";
9
  private $aDBc_plural_title = "";
10
- private $aDBc_column_meta_name = "";
11
  private $aDBc_sql_get_elements = "";
12
- private $aDBc_custom_sql_args = "";
13
  private $aDBc_search_sql_arg = "";
14
  private $aDBc_order_by_sql_arg = "";
15
  private $aDBc_limit_offset_sql_arg = "";
@@ -59,13 +61,20 @@ class ADBC_Clean_Meta_Comment_Post_User_Term extends WP_List_Table {
59
  }
60
 
61
  // Prepare additional sql args if any: per page, LIMIT, OFFSET, etc.
62
- $this->aDBc_order_by_sql_arg = aDBc_get_order_by_sql_arg($this->aDBc_metaid_or_umetaid);
 
 
 
 
 
 
 
63
  $this->aDBc_limit_offset_sql_arg = aDBc_get_limit_offset_sql_args();
64
 
65
  parent::__construct(array(
66
- 'singular' => $aDBc_singular, //singular name of the listed records
67
- 'plural' => $this->aDBc_plural_title, //plural name of the listed records
68
- 'ajax' => false //does this table support ajax?
69
  ));
70
 
71
  $this->aDBc_prepare_elements_to_clean();
@@ -77,7 +86,7 @@ class ADBC_Clean_Meta_Comment_Post_User_Term extends WP_List_Table {
77
 
78
  global $wpdb;
79
 
80
- // Process bulk action if any before preparing meta to clean
81
  $this->process_bulk_action();
82
 
83
  // Get all elements (for the table usermeta, only one table exists for MU, do not switch over blogs for it)
@@ -159,7 +168,7 @@ class ADBC_Clean_Meta_Comment_Post_User_Term extends WP_List_Table {
159
  switch($column_name){
160
  case 'meta_id':
161
  case 'meta_key':
162
- case 'meta_value':
163
  case 'site_id':
164
  return $item[$column_name];
165
  default:
1
  <?php
2
+
3
+ /** View comment meta and post meta */
4
+
5
  class ADBC_Clean_Meta_Comment_Post_User_Term extends WP_List_Table {
6
 
7
  private $aDBc_message = "";
9
  private $aDBc_elements_to_display = array();
10
  private $aDBc_type_to_clean = "";
11
  private $aDBc_plural_title = "";
12
+ private $aDBc_column_meta_name = "";
13
  private $aDBc_sql_get_elements = "";
14
+ private $aDBc_custom_sql_args = "";
15
  private $aDBc_search_sql_arg = "";
16
  private $aDBc_order_by_sql_arg = "";
17
  private $aDBc_limit_offset_sql_arg = "";
61
  }
62
 
63
  // Prepare additional sql args if any: per page, LIMIT, OFFSET, etc.
64
+
65
+ if ( ADBC_PLUGIN_PLAN == "pro" ) {
66
+
67
+ $this->aDBc_search_sql_arg = aDBc_get_search_sql_arg( "meta_key", "meta_value" );
68
+
69
+ }
70
+
71
+ $this->aDBc_order_by_sql_arg = aDBc_get_order_by_sql_arg( $this->aDBc_metaid_or_umetaid );
72
  $this->aDBc_limit_offset_sql_arg = aDBc_get_limit_offset_sql_args();
73
 
74
  parent::__construct(array(
75
+ 'singular' => $aDBc_singular,
76
+ 'plural' => $this->aDBc_plural_title,
77
+ 'ajax' => false
78
  ));
79
 
80
  $this->aDBc_prepare_elements_to_clean();
86
 
87
  global $wpdb;
88
 
89
+ // Process bulk action if any before preparing elements to clean
90
  $this->process_bulk_action();
91
 
92
  // Get all elements (for the table usermeta, only one table exists for MU, do not switch over blogs for it)
168
  switch($column_name){
169
  case 'meta_id':
170
  case 'meta_key':
171
+ case 'meta_value':
172
  case 'site_id':
173
  return $item[$column_name];
174
  default:
includes/custom-clean-view/class_clean_relationships.php CHANGED
@@ -2,17 +2,17 @@
2
 
3
  class ADBC_Clean_Relationship extends WP_List_Table {
4
 
5
- private $aDBc_message = "";
6
- private $aDBc_class_message = "updated";
7
- private $aDBc_elements_to_display = array();
8
- private $aDBc_type_to_clean = "";
9
- private $aDBc_plural_title = "";
10
- private $aDBc_column_meta_name = "";
11
- private $aDBc_sql_get_elements = "";
12
- private $aDBc_search_sql_arg = "";
13
- private $aDBc_order_by_sql_arg = "";
14
- private $aDBc_limit_offset_sql_arg = "";
15
- private $aDBc_delete_from_table = "";
16
 
17
  /**
18
  * Constructor
@@ -22,28 +22,35 @@ class ADBC_Clean_Relationship extends WP_List_Table {
22
  $this->aDBc_plural_title = __('Orphaned Relationships', 'advanced-database-cleaner');
23
 
24
  // Prepare additional sql args if any: per page, LIMIT, OFFSET, etc.
25
- $this->aDBc_order_by_sql_arg = aDBc_get_order_by_sql_arg("object_id");
 
 
 
 
 
 
 
26
  $this->aDBc_limit_offset_sql_arg = aDBc_get_limit_offset_sql_args();
27
 
28
  parent::__construct(array(
29
- 'singular' => __('Orphaned Relationship', 'advanced-database-cleaner'), //singular name of the listed records
30
- 'plural' => $this->aDBc_plural_title, //plural name of the listed records
31
- 'ajax' => false //does this table support ajax?
32
  ));
33
 
34
  $this->aDBc_prepare_elements_to_clean();
35
  $this->aDBc_print_page_content();
36
  }
37
 
38
- /** Prepare elements to display */
39
  function aDBc_prepare_elements_to_clean(){
40
 
41
  global $wpdb;
42
 
43
- // Process bulk action if any before preparing relationships to clean
44
  $this->process_bulk_action();
45
 
46
- // Get all relationships
47
  if(function_exists('is_multisite') && is_multisite()){
48
  $blogs_ids = $wpdb->get_col("SELECT blog_id FROM $wpdb->blogs");
49
  foreach($blogs_ids as $blog_id){
2
 
3
  class ADBC_Clean_Relationship extends WP_List_Table {
4
 
5
+ private $aDBc_message = "";
6
+ private $aDBc_class_message = "updated";
7
+ private $aDBc_elements_to_display = array();
8
+ private $aDBc_type_to_clean = "";
9
+ private $aDBc_plural_title = "";
10
+ private $aDBc_column_meta_name = "";
11
+ private $aDBc_sql_get_elements = "";
12
+ private $aDBc_search_sql_arg = "";
13
+ private $aDBc_order_by_sql_arg = "";
14
+ private $aDBc_limit_offset_sql_arg = "";
15
+ private $aDBc_delete_from_table = "";
16
 
17
  /**
18
  * Constructor
22
  $this->aDBc_plural_title = __('Orphaned Relationships', 'advanced-database-cleaner');
23
 
24
  // Prepare additional sql args if any: per page, LIMIT, OFFSET, etc.
25
+
26
+ if ( ADBC_PLUGIN_PLAN == "pro" ) {
27
+
28
+ $this->aDBc_search_sql_arg = aDBc_get_search_sql_arg( "term_taxonomy_id", "term_order" );
29
+
30
+ }
31
+
32
+ $this->aDBc_order_by_sql_arg = aDBc_get_order_by_sql_arg( "object_id" );
33
  $this->aDBc_limit_offset_sql_arg = aDBc_get_limit_offset_sql_args();
34
 
35
  parent::__construct(array(
36
+ 'singular' => __( 'Orphaned Relationship', 'advanced-database-cleaner' ),
37
+ 'plural' => $this->aDBc_plural_title,
38
+ 'ajax' => false
39
  ));
40
 
41
  $this->aDBc_prepare_elements_to_clean();
42
  $this->aDBc_print_page_content();
43
  }
44
 
45
+ /** Prepare elements to display */
46
  function aDBc_prepare_elements_to_clean(){
47
 
48
  global $wpdb;
49
 
50
+ // Process bulk action if any before preparing elements to clean
51
  $this->process_bulk_action();
52
 
53
+ // Get all elements to clean
54
  if(function_exists('is_multisite') && is_multisite()){
55
  $blogs_ids = $wpdb->get_col("SELECT blog_id FROM $wpdb->blogs");
56
  foreach($blogs_ids as $blog_id){
includes/custom-clean-view/class_clean_revision_draft_trash.php CHANGED
@@ -50,13 +50,20 @@ class ADBC_Clean_Revision_Trash_Draft extends WP_List_Table {
50
  }
51
 
52
  // Prepare additional sql args if any: per page, LIMIT, OFFSET, etc.
53
- $this->aDBc_order_by_sql_arg = aDBc_get_order_by_sql_arg("ID");
 
 
 
 
 
 
 
54
  $this->aDBc_limit_offset_sql_arg = aDBc_get_limit_offset_sql_args();
55
 
56
  parent::__construct(array(
57
- 'singular' => $aDBc_singular, //singular name of the listed records
58
- 'plural' => $this->aDBc_plural_title, //plural name of the listed records
59
- 'ajax' => false //does this table support ajax?
60
  ));
61
 
62
  $this->aDBc_prepare_elements_to_clean();
@@ -68,10 +75,10 @@ class ADBC_Clean_Revision_Trash_Draft extends WP_List_Table {
68
 
69
  global $wpdb;
70
 
71
- // Process bulk action if any before preparing posts to clean
72
  $this->process_bulk_action();
73
 
74
- // Get all concerned posts
75
  if(function_exists('is_multisite') && is_multisite()){
76
  $blogs_ids = $wpdb->get_col("SELECT blog_id FROM $wpdb->blogs");
77
  foreach($blogs_ids as $blog_id){
@@ -117,7 +124,7 @@ class ADBC_Clean_Revision_Trash_Draft extends WP_List_Table {
117
  array_push($this->aDBc_elements_to_display, array(
118
  'post_id' => $aDBc_element->ID,
119
  'post_title' => $post_title,
120
- 'post_content' => $post_content,
121
  'post_date' => $aDBc_element->post_date,
122
  'site_id' => $blog_id
123
  )
@@ -135,7 +142,7 @@ class ADBC_Clean_Revision_Trash_Draft extends WP_List_Table {
135
  }
136
  return "";
137
  }
138
-
139
  /** WP: Get columns */
140
  function get_columns(){
141
  $columns = array(
50
  }
51
 
52
  // Prepare additional sql args if any: per page, LIMIT, OFFSET, etc.
53
+
54
+ if ( ADBC_PLUGIN_PLAN == "pro" ) {
55
+
56
+ $this->aDBc_search_sql_arg = aDBc_get_search_sql_arg( "post_title", "post_content" );
57
+
58
+ }
59
+
60
+ $this->aDBc_order_by_sql_arg = aDBc_get_order_by_sql_arg( "ID" );
61
  $this->aDBc_limit_offset_sql_arg = aDBc_get_limit_offset_sql_args();
62
 
63
  parent::__construct(array(
64
+ 'singular' => $aDBc_singular,
65
+ 'plural' => $this->aDBc_plural_title,
66
+ 'ajax' => false
67
  ));
68
 
69
  $this->aDBc_prepare_elements_to_clean();
75
 
76
  global $wpdb;
77
 
78
+ // Process bulk action if any before preparing elements to clean
79
  $this->process_bulk_action();
80
 
81
+ // Get all elements to clean
82
  if(function_exists('is_multisite') && is_multisite()){
83
  $blogs_ids = $wpdb->get_col("SELECT blog_id FROM $wpdb->blogs");
84
  foreach($blogs_ids as $blog_id){
124
  array_push($this->aDBc_elements_to_display, array(
125
  'post_id' => $aDBc_element->ID,
126
  'post_title' => $post_title,
127
+ 'post_content' => $post_content, //xxx add if empty, replace by 'Empty' to prevent responsive issues in WP table
128
  'post_date' => $aDBc_element->post_date,
129
  'site_id' => $blog_id
130
  )
142
  }
143
  return "";
144
  }
145
+
146
  /** WP: Get columns */
147
  function get_columns(){
148
  $columns = array(
includes/custom-clean-view/class_clean_transient.php CHANGED
@@ -8,7 +8,7 @@ class ADBC_Clean_Transient extends WP_List_Table {
8
  private $aDBc_type_to_clean = "";
9
  private $aDBc_plural_title = "";
10
  private $aDBc_sql_get_transients = "";
11
- private $aDBc_custom_sql_args = "";
12
  private $aDBc_search_sql_arg = "";
13
  private $aDBc_order_by_sql_arg = "";
14
  private $aDBc_limit_offset_sql_arg = "";
@@ -17,34 +17,30 @@ class ADBC_Clean_Transient extends WP_List_Table {
17
  */
18
  function __construct($element_type){
19
 
20
- $aDBc_singular = __('Transient', 'advanced-database-cleaner');
21
- $this->aDBc_plural_title = __('Transients', 'advanced-database-cleaner');
22
-
23
  if($element_type == "expired-transients"){
24
 
25
- $this->aDBc_type_to_clean = "expired-transients";
26
- $this->aDBc_custom_sql_args = " AND b.option_value < UNIX_TIMESTAMP()";
 
 
27
 
28
- }else if($element_type == "transients-with-expiration"){
29
 
30
- $this->aDBc_type_to_clean = "transients-with-expiration";
31
- $this->aDBc_custom_sql_args = " AND b.option_value > UNIX_TIMESTAMP()";
32
 
33
- }else if($element_type == "transients-with-no-expiration"){
34
 
35
- $this->aDBc_type_to_clean = "transients-with-no-expiration";
36
- $this->aDBc_custom_sql_args = " AND b.option_value is NULL";
37
 
38
  }
39
 
40
- // Prepare additional sql args if any: per page, LIMIT, OFFSET, etc.
41
- $this->aDBc_order_by_sql_arg = aDBc_get_order_by_sql_arg("a.option_id");
42
- $this->aDBc_limit_offset_sql_arg = aDBc_get_limit_offset_sql_args();
43
 
44
  parent::__construct(array(
45
- 'singular' => $aDBc_singular, //singular name of the listed records
46
- 'plural' => $this->aDBc_plural_title, //plural name of the listed records
47
- 'ajax' => true //does this table support ajax?
48
  ));
49
 
50
  $this->aDBc_prepare_elements_to_clean();
@@ -56,9 +52,10 @@ class ADBC_Clean_Transient extends WP_List_Table {
56
 
57
  global $wpdb;
58
 
59
- // Process bulk action if any before preparing feeds to clean
60
  $this->process_bulk_action();
61
 
 
62
  if(function_exists('is_multisite') && is_multisite()){
63
  $blogs_ids = $wpdb->get_col("SELECT blog_id FROM $wpdb->blogs");
64
  foreach($blogs_ids as $blog_id){
@@ -83,7 +80,7 @@ class ADBC_Clean_Transient extends WP_List_Table {
83
  global $wpdb;
84
 
85
  // Get all dashboard transients
86
- $this->aDBc_sql_get_transients = "SELECT a.option_id, a.option_name, a.option_value as option_content, a.autoload, b.option_value as option_timeout FROM $wpdb->options a LEFT JOIN $wpdb->options b ON b.option_name =
87
  CONCAT(
88
  CASE WHEN a.option_name LIKE '_site_transient_%'
89
  THEN '_site_transient_timeout_'
@@ -97,7 +94,7 @@ class ADBC_Clean_Transient extends WP_List_Table {
97
  END
98
  ) + 1)
99
  )
100
- WHERE (a.option_name LIKE '_transient_%' OR a.option_name LIKE '_site_transient_%') AND a.option_name NOT LIKE '%_transient_timeout_%'"
101
  . $this->aDBc_custom_sql_args
102
  . $this->aDBc_search_sql_arg
103
  . $this->aDBc_order_by_sql_arg
@@ -111,16 +108,12 @@ class ADBC_Clean_Transient extends WP_List_Table {
111
  foreach($aDBc_all_transient_feed as $aDBc_transient){
112
 
113
  // Get timeout of transient
114
- switch($this->aDBc_type_to_clean){
115
- case "expired-transients" :
116
- $transient_timeout = __('Expired','advanced-database-cleaner');
117
- break;
118
- case "transients-with-expiration" :
119
- $transient_timeout = human_time_diff($time_now, $aDBc_transient->option_timeout);
120
- break;
121
- case "transients-with-no-expiration" :
122
- $transient_timeout = __('Does not expire','advanced-database-cleaner');
123
  break;
 
124
  }
125
 
126
  // Get transient content
8
  private $aDBc_type_to_clean = "";
9
  private $aDBc_plural_title = "";
10
  private $aDBc_sql_get_transients = "";
11
+ private $aDBc_custom_sql_args = "";
12
  private $aDBc_search_sql_arg = "";
13
  private $aDBc_order_by_sql_arg = "";
14
  private $aDBc_limit_offset_sql_arg = "";
17
  */
18
  function __construct($element_type){
19
 
 
 
 
20
  if($element_type == "expired-transients"){
21
 
22
+ $this->aDBc_type_to_clean = "expired-transients";
23
+ $aDBc_singular = __('Expired transient', 'advanced-database-cleaner');
24
+ $this->aDBc_plural_title = __('Expired transients', 'advanced-database-cleaner');
25
+ $this->aDBc_custom_sql_args = " AND b.option_value < UNIX_TIMESTAMP()";
26
 
27
+ }
28
 
29
+ // Prepare additional sql args if any: per page, LIMIT, OFFSET, etc.
 
30
 
31
+ if ( ADBC_PLUGIN_PLAN == "pro" ) {
32
 
33
+ $this->aDBc_search_sql_arg = aDBc_get_search_sql_arg( "a.option_name", "a.option_value" );
 
34
 
35
  }
36
 
37
+ $this->aDBc_order_by_sql_arg = aDBc_get_order_by_sql_arg( "a.option_id" );
38
+ $this->aDBc_limit_offset_sql_arg = aDBc_get_limit_offset_sql_args();
 
39
 
40
  parent::__construct(array(
41
+ 'singular' => $aDBc_singular,
42
+ 'plural' => $this->aDBc_plural_title,
43
+ 'ajax' => false
44
  ));
45
 
46
  $this->aDBc_prepare_elements_to_clean();
52
 
53
  global $wpdb;
54
 
55
+ // Process bulk action if any before preparing elements to clean
56
  $this->process_bulk_action();
57
 
58
+ // Get all elements to clean
59
  if(function_exists('is_multisite') && is_multisite()){
60
  $blogs_ids = $wpdb->get_col("SELECT blog_id FROM $wpdb->blogs");
61
  foreach($blogs_ids as $blog_id){
80
  global $wpdb;
81
 
82
  // Get all dashboard transients
83
+ $this->aDBc_sql_get_transients = "SELECT a.option_id, a.option_name, a.option_value as option_content, a.autoload, b.option_value as option_timeout FROM $wpdb->options a LEFT JOIN $wpdb->options b ON b.option_name =
84
  CONCAT(
85
  CASE WHEN a.option_name LIKE '_site_transient_%'
86
  THEN '_site_transient_timeout_'
94
  END
95
  ) + 1)
96
  )
97
+ WHERE (a.option_name LIKE '_transient_%' OR a.option_name LIKE '_site_transient_%') AND a.option_name NOT LIKE '%_transient_timeout_%'"
98
  . $this->aDBc_custom_sql_args
99
  . $this->aDBc_search_sql_arg
100
  . $this->aDBc_order_by_sql_arg
108
  foreach($aDBc_all_transient_feed as $aDBc_transient){
109
 
110
  // Get timeout of transient
111
+ switch ( $this->aDBc_type_to_clean ) {
112
+
113
+ case "expired-transients" :
114
+ $transient_timeout = __( 'Expired', 'advanced-database-cleaner' );
 
 
 
 
 
115
  break;
116
+
117
  }
118
 
119
  // Get transient content
includes/custom-clean-view/header_page_custom_clean.php CHANGED
@@ -1,86 +1,160 @@
 
 
1
  <div class="aDBc-float-left aDBc-margin-t-10">
2
- <a href="?page=advanced_db_cleaner&aDBc_tab=general">
3
- <img width="40px" src="<?php echo ADBC_PLUGIN_DIR_PATH . '/images/go_back.svg'?>"/>
 
 
 
 
 
4
  </a>
 
5
  </div>
6
 
7
  <div>
8
 
9
- <div class="aDBc-float-right aDBc-custom-clean-text">
10
- <div>
11
- <?php echo __('Custom cleaning of','advanced-database-cleaner') . " : <strong>" . $this->aDBc_plural_title . "</strong> - " . __('Total Found','advanced-database-cleaner') . " : <b><span style='background:#ffe4b5;border-radius:8px;padding:2px 6px'>" . count($this->aDBc_elements_to_display) . "</span></b>"; ?>
12
- </div>
 
 
 
 
13
 
14
  </div>
15
 
16
- <div style="clear:both;margin-bottom:25px;width:100%;background:#f9f9f9" class="aDBc-float-right">
17
 
18
- <div style="float:left;padding:8px;height:30px">
19
 
20
- <span class="aDBc_premium_tooltip">
21
 
22
- <form style="float:left;pointer-events:none;opacity:0.5" method="get">
23
 
24
- <?php
 
 
 
 
 
 
 
 
 
 
 
 
25
  // Generate current parameters in URL
26
- foreach($_GET as $name => $value){
27
- if($name != "s" && $name != "in" && $name != "paged"){
28
- $name = esc_attr(sanitize_text_field($name));
29
- $value = esc_attr(sanitize_text_field($value));
 
 
30
  echo "<input type='hidden' name='$name' value='$value'/>";
 
31
  }
32
  }
 
33
  // Return paged to page 1
34
- echo "<input type='hidden' name='paged' value='1'/>";
35
  ?>
36
 
37
- <fieldset style="padding-right:5px;float:left">
38
- <input style="font-size:13px;width:140px;height:30px;border:1px solid #e5e5e5;border-radius:2px;box-shadow:0 0 10px #f1f1f1;" type="search" placeholder="<?php _e('Search for','advanced-database-cleaner') ?>" name="s" value="<?php echo empty($_GET['s']) ? '' : esc_attr($_GET['s']); ?>"/>
39
- </fieldset>
40
-
41
- <fieldset style="border:1px solid #f1f1f1;border-radius:2px;box-shadow:0 0 10px #f1f1f1;padding:6px;float:left">
42
- <span style="padding:2px 10px 2px 5px;"><?php _e('Search in','advanced-database-cleaner') ?></span>
43
- <input type="radio" name="in" value="key" checked <?php echo (empty($_GET['in']) || (!empty($_GET['in']) && $_GET['in'] == "key")) ? 'checked' : ''; ?>><?php _e('Name','advanced-database-cleaner') ?> &nbsp;
44
- <input type="radio" name="in" value="value" <?php echo (!empty($_GET['in']) && $_GET['in'] == "value") ? 'checked' : ''; ?>><?php _e('Value','advanced-database-cleaner') ?>
45
- </fieldset>
46
- <span style="padding-left:5px;float:left">
47
- <input style="float:left;height:30px;margin-top:0px" type="submit" class="button-secondary" value="<?php _e('Filter','advanced-database-cleaner') ?>"/>
48
- </span>
 
 
 
 
 
 
49
 
50
  </form>
51
 
52
- <span style="width:150px" class="aDBc_premium_tooltiptext"><?php _e('Available in Pro version!','advanced-database-cleaner') ?></span>
 
 
 
 
 
 
 
 
 
 
 
 
53
 
54
  </span>
 
55
  </div>
56
 
57
- <div style="float:right;padding:8px;height:30px;margin-left:20px">
 
58
 
59
- <form style="float:left" method="get">
60
 
61
- <?php
62
  // Generate current parameters in URL
63
- foreach($_GET as $name => $value){
64
- if($name != "per_page" && $name != "paged"){
65
- $name = esc_attr(sanitize_text_field($name));
66
- $value = esc_attr(sanitize_text_field($value));
 
 
67
  echo "<input type='hidden' name='$name' value='$value'/>";
 
68
  }
69
  }
 
70
  // Return paged to page 1
71
  echo "<input type='hidden' name='paged' value='1'/>";
72
  ?>
73
 
74
- <span style="padding-right:8px;float:left;font-size:13px;padding-top:6px"><?php _e('Items per page','advanced-database-cleaner') ?></span>
75
- <span style="padding-right:5px;float:left">
 
76
 
77
- <input type="number" style="font-size:13px;width:55px;height:30px;border:1px solid #e5e5e5;border-radius:2px;box-shadow:0 0 10px #f1f1f1;" id="revisions-search-input" name="per_page" value="<?php echo empty($_GET['per_page']) ? '50' : esc_attr($_GET['per_page']); ?>"/>
78
- </span>
 
79
 
80
- <span style="float:left">
81
- <input style="float:left;height:30px;" type="submit" class="button-secondary" value="<?php _e('Show','advanced-database-cleaner') ?>"/>
82
- </span>
83
  </form>
 
84
  </div>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
85
  </div>
 
86
  </div>
1
+ <!-- style et code ok -->
2
+
3
  <div class="aDBc-float-left aDBc-margin-t-10">
4
+
5
+ <a href="?page=advanced_db_cleaner&aDBc_tab=general" style="text-decoration:none">
6
+
7
+ <span class="dashicons dashicons-controls-back aDBc-back-dashicon"></span>
8
+
9
+ <span style="vertical-align:middle"><?php echo __( 'Return', 'advanced-database-cleaner' ); ?></span>
10
+
11
  </a>
12
+
13
  </div>
14
 
15
  <div>
16
 
17
+ <div class="aDBc-custom-clean-text">
18
+
19
+ <?php
20
+ echo __( 'Custom cleanup of', 'advanced-database-cleaner' ) . " ";
21
+ echo "<strong>" . $this->aDBc_plural_title . "</strong> - ";
22
+ echo __( 'Total Found', 'advanced-database-cleaner' ) . " : ";
23
+ echo "<b><span class='aDBc-custom-total'>" . count( $this->aDBc_elements_to_display ) . "</span></b>";
24
+ ?>
25
 
26
  </div>
27
 
28
+ <div class="aDBc-filter-container">
29
 
30
+ <div class="aDBc-filter-section">
31
 
32
+ <span class="aDBc-premium-tooltip">
33
 
34
+ <?php
35
 
36
+ $free_style = "";
37
+
38
+ if ( ADBC_PLUGIN_PLAN == "free" ) {
39
+
40
+ $free_style = "aDBc-filter-pro-only";
41
+
42
+ }
43
+
44
+ ?>
45
+
46
+ <form class="<?php echo $free_style; ?>" method="get">
47
+
48
+ <?php
49
  // Generate current parameters in URL
50
+ foreach ( $_GET as $name => $value ) {
51
+
52
+ if ( $name != "s" && $name != "in" && $name != "paged" ) {
53
+
54
+ $name = esc_attr( sanitize_text_field( $name ) );
55
+ $value = esc_attr( sanitize_text_field( $value ) );
56
  echo "<input type='hidden' name='$name' value='$value'/>";
57
+
58
  }
59
  }
60
+
61
  // Return paged to page 1
62
+ echo "<input type='hidden' name='paged' value='1'/>";
63
  ?>
64
 
65
+ <input class="aDBc-filter-search-input" type="search" placeholder="<?php _e( 'Search for', 'advanced-database-cleaner' ); ?>" name="s" value="<?php echo empty( $_GET['s'] ) ? '' : esc_attr( $_GET['s'] ); ?>"/>
66
+
67
+ <div class="aDBc-custom-filter-radio-section">
68
+
69
+ <span style="padding:0px 10px"><?php _e( 'Search in', 'advanced-database-cleaner' ); ?></span>
70
+
71
+ <?php
72
+ $in_checked = empty( $_GET['in'] ) || ( ! empty( $_GET['in'] ) && $_GET['in'] == "key" ) ? 'checked' : '';
73
+ $value_checked = ! empty( $_GET['in'] ) && $_GET['in'] == "value" ? 'checked' : '';
74
+ ?>
75
+
76
+ <input type="radio" name="in" value="key" checked <?php echo $in_checked; ?>><?php _e( 'Name', 'advanced-database-cleaner' ); ?> &nbsp;
77
+
78
+ <input type="radio" name="in" value="value" <?php echo $value_checked; ?>><?php _e( 'Value', 'advanced-database-cleaner' ); ?>
79
+
80
+ </div>
81
+
82
+ <input class="button-secondary aDBc-filter-botton" type="submit" value="<?php _e( 'Filter', 'advanced-database-cleaner' ); ?>"/>
83
 
84
  </form>
85
 
86
+ <?php
87
+ if ( ADBC_PLUGIN_PLAN == "free" ) {
88
+ ?>
89
+
90
+ <span style="width:150px" class="aDBc-premium-tooltiptext">
91
+
92
+ <?php _e( 'Available in Pro version!', 'advanced-database-cleaner' ); ?>
93
+
94
+ </span>
95
+
96
+ <?php
97
+ }
98
+ ?>
99
 
100
  </span>
101
+
102
  </div>
103
 
104
+ <!-- Items per page -->
105
+ <div class="aDBc-items-per-page">
106
 
107
+ <form method="get">
108
 
109
+ <?php
110
  // Generate current parameters in URL
111
+ foreach ( $_GET as $name => $value ) {
112
+
113
+ if ( $name != "per_page" && $name != "paged" ) {
114
+
115
+ $name = esc_attr( sanitize_text_field( $name ) );
116
+ $value = esc_attr( sanitize_text_field( $value ) );
117
  echo "<input type='hidden' name='$name' value='$value'/>";
118
+
119
  }
120
  }
121
+
122
  // Return paged to page 1
123
  echo "<input type='hidden' name='paged' value='1'/>";
124
  ?>
125
 
126
+ <span class="aDBc-items-per-page-label">
127
+ <?php _e( 'Items per page', 'advanced-database-cleaner' ); ?>
128
+ </span>
129
 
130
+ <input name="per_page" class="aDBc-items-per-page-input" type="number" value="<?php echo empty( $_GET['per_page'] ) ? '50' : esc_attr( $_GET['per_page'] ); ?>"/>
131
+
132
+ <input type="submit" class="button-secondary aDBc-show-botton" value="<?php _e( 'Show', 'advanced-database-cleaner' ); ?>"/>
133
 
 
 
 
134
  </form>
135
+
136
  </div>
137
+
138
+ <?php
139
+ if ( ( ! empty( $_GET['s'] ) && trim( $_GET['s'] ) != "" ) ||
140
+ ! empty( $_GET['in'] )
141
+ ) {
142
+
143
+ // Remove args to delete custom filter
144
+ $aDBc_new_URI = $_SERVER['REQUEST_URI'];
145
+ $aDBc_new_URI = remove_query_arg( array( 's', 'in' ), $aDBc_new_URI );
146
+ ?>
147
+
148
+ <div class="aDBc-delete-custom-filter">
149
+ <a style="color:red" href="<?php echo $aDBc_new_URI; ?>">
150
+ <?php _e( 'Delete custom filter', 'advanced-database-cleaner' ); ?>
151
+ </a>
152
+ </div>
153
+
154
+ <?php
155
+ }
156
+ ?>
157
+
158
  </div>
159
+
160
  </div>
includes/custom-clean-view/page_custom_clean.php CHANGED
@@ -19,4 +19,4 @@ if($this->aDBc_message != ""){
19
  ?>
20
  </form>
21
  </div>
22
- </div>
19
  ?>
20
  </form>
21
  </div>
22
+ </div>
includes/custom-schedule-view/class_add_cleanup_schedule.php CHANGED
@@ -1,321 +1,390 @@
1
  <?php
 
 
 
2
  class ADBC_SCHEDULE_CLEANUP extends WP_List_Table {
3
 
4
- private $aDBc_message = "";
5
- private $aDBc_class_message = "updated";
6
- private $aDBc_elements_to_display = array();
7
- private $aDBc_total_elements_to_clean = 0;
8
 
9
  /**
10
  * Constructor
11
  */
12
- function __construct(){
13
-
14
- parent::__construct(array(
15
- 'singular' => __('Element', 'advanced-database-cleaner'), //singular name of the listed records
16
- 'plural' => __('Elements', 'advanced-database-cleaner'), //plural name of the listed records
17
- 'ajax' => false //does this table support ajax?
18
- ));
 
 
19
 
20
  $this->aDBc_prepare_elements_to_clean();
21
  $this->aDBc_print_page_content();
22
  }
23
 
24
  /** Prepare elements to display */
25
- function aDBc_prepare_elements_to_clean(){
26
 
27
  // Test if user wants to save the scheduled task
28
- if(isset($_POST['aDBc_schedule_name'])){
29
 
30
  //Quick nonce security check!
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
 
38
  // Test if the name is used by other schedules.
39
- $clean_schedule_setting = get_option('aDBc_clean_schedule');
40
- $clean_schedule_setting = is_array($clean_schedule_setting) ? $clean_schedule_setting : array();
41
 
42
- $optimize_schedule_setting = get_option('aDBc_optimize_schedule');
43
- $optimize_schedule_setting = is_array($optimize_schedule_setting) ? $optimize_schedule_setting : array();
44
 
45
- if(!array_key_exists($_POST['aDBc_schedule_name'], $clean_schedule_setting) &&
46
- !array_key_exists($_POST['aDBc_schedule_name'], $optimize_schedule_setting)){
47
 
48
- if(!empty($_POST['aDBc_date'])){
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
-
70
- if($_POST['aDBc_status'] == "1"){
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{
78
- $this->aDBc_message = __('The clean-up schedule saved successfully but it is inactive!', 'advanced-database-cleaner');
79
- }
80
 
81
- }else{
 
 
 
 
 
82
  $this->aDBc_class_message = "error";
83
- $this->aDBc_message = __('Please specify a valide time!', 'advanced-database-cleaner');
84
  }
85
- }else{
86
  $this->aDBc_class_message = "error";
87
- $this->aDBc_message = __('Please specify a valide date!', 'advanced-database-cleaner');
88
  }
89
- }else{
90
  $this->aDBc_class_message = "error";
91
- $this->aDBc_message = __('The name you have specified is already used by another schedule! Please change it!', 'advanced-database-cleaner');
92
  }
93
- }else{
94
  $this->aDBc_class_message = "error";
95
- $this->aDBc_message = __('Please change the name! Only letters, numbers and underscores are allowed!', 'advanced-database-cleaner');
96
  }
97
- }else{
98
  $this->aDBc_class_message = "error";
99
- $this->aDBc_message = __('Please give a name to your schedule!', 'advanced-database-cleaner');
100
  }
101
- }else{
102
  $this->aDBc_class_message = "error";
103
- $this->aDBc_message = __('Please select at least one item to include in the schedule from the table below!', 'advanced-database-cleaner');
104
  }
105
-
106
  }
107
-
108
- // yyy should this $wpdb be cleaned?
109
- global $wpdb;
110
 
111
  // Get all unused elements
112
  $aDBc_unused_elements = aDBc_return_array_all_elements_to_clean();
113
 
114
  // Get settings from DB
115
- $settings = get_option('aDBc_settings');
116
 
117
- foreach($aDBc_unused_elements as $element_type => $element_name){
118
 
119
  // Get "keep_last" option. This option is added in ADBC version 3.0, so test if it is not empty before using it
120
- if(empty($settings['keep_last'])){
 
121
  $keep_number = '0';
122
- }else{
 
 
123
  $keep_setting = $settings['keep_last'];
124
- if(empty($keep_setting[$element_type])){
 
125
  $keep_number = '0';
126
- }else{
127
  $keep_number = $keep_setting[$element_type];
128
  }
129
  }
 
130
  // If the item can have keep_last, then prepare it, otherwise echo N/A
131
- if($element_type == "revision" ||
132
- $element_type == "auto-draft" ||
133
- $element_type == "trash-posts" ||
134
- $element_type == "moderated-comments" ||
135
- $element_type == "spam-comments" ||
136
- $element_type == "trash-comments" ||
137
- $element_type == "pingbacks" ||
138
- $element_type == "trackbacks"){
139
-
140
- $keep_info = "<span>" . $keep_number . " " . __('days','advanced-database-cleaner');
141
- }else{
142
- $keep_info = __('N/A','advanced-database-cleaner') ;
 
 
 
143
  }
144
 
145
- array_push($this->aDBc_elements_to_display, array(
146
- 'element_to_schedule' => "<a href='" . $element_name['URL_blog'] . "' target='_blank' class='aDBc_info_icon'>&nbsp;</a>" . $element_name['name'],
147
- 'keep' => $keep_info,
148
- 'type' => $element_type
149
  )
150
  );
151
  }
 
152
  // Call WP prepare_items function
153
  $this->prepare_items();
154
  }
155
 
156
  /** WP: Get columns */
157
- function get_columns(){
158
 
159
  $aDBc_keep_last_toolip = "<span class='aDBc-tooltips-headers'>
160
  <img class='aDBc-info-image' src='". ADBC_PLUGIN_DIR_PATH . '/images/information2.svg' . "'/>
161
- <span>" . __('Only data that is older than the number you have specified will be cleaned based on you schedule parameters. To change this value, click on "go back" button.','advanced-database-cleaner') ." </span>
162
- </span>";
163
 
164
  $columns = array(
165
- 'cb' => '<input type="checkbox" />',
166
- 'element_to_schedule' => __('Elements to include in the schedule','advanced-database-cleaner'),
167
- 'keep' => __('Keep last','advanced-database-cleaner') . $aDBc_keep_last_toolip,
168
- 'type' => 'Type'
169
  );
 
170
  return $columns;
171
  }
172
 
173
  /** WP: Prepare items to display */
174
  function prepare_items() {
175
- $columns = $this->get_columns();
176
- $hidden = $this->get_hidden_columns();
177
- $sortable = array();
178
- $this->_column_headers = array($columns, $hidden, $sortable);
179
- $per_page = 50;
180
- $current_page = $this->get_pagenum();
 
 
181
  // Prepare sequence of elements to display
182
- $display_data = array_slice($this->aDBc_elements_to_display,(($current_page-1) * $per_page), $per_page);
 
183
  $this->set_pagination_args( array(
184
- 'total_items' => count($this->aDBc_elements_to_display),
185
  'per_page' => $per_page
186
  ));
 
187
  $this->items = $display_data;
188
  }
189
 
190
  /** WP: Get columns that should be hidden */
191
- function get_hidden_columns(){
192
- return array('type');
193
- }
 
 
194
 
195
  /** WP: Column default */
196
- function column_default($item, $column_name){
197
- switch($column_name){
 
 
198
  case 'element_to_schedule':
199
  case 'keep':
200
  case 'type':
201
  return $item[$column_name];
202
  default:
203
- return print_r($item, true) ; //Show the whole array for troubleshooting purposes
 
204
  }
205
  }
206
 
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 */
219
  function get_bulk_actions() {
 
220
  return array();
 
221
  }
222
 
223
  /** WP: Message to display when no items found */
224
  function no_items() {
225
- _e('Your database is clean!','advanced-database-cleaner');
 
 
226
  }
227
 
228
 
229
  /** Print the page content */
230
- function aDBc_print_page_content(){
 
231
  // Print a message if any
232
- if($this->aDBc_message != ""){
 
233
  echo '<div id="aDBc_message" class="' . $this->aDBc_class_message . ' notice is-dismissible"><p>' . $this->aDBc_message . '</p></div>';
 
234
  }
235
  ?>
236
- <div style="width:636px">
237
-
238
- <div>
239
- <div class="aDBc-float-left aDBc-margin-t-10">
240
- <a href="?page=advanced_db_cleaner&aDBc_tab=general">
241
- <img width="40px" src="<?php echo ADBC_PLUGIN_DIR_PATH . '/images/go_back.svg'?>"/>
242
- </a>
243
- </div>
244
- <div class="aDBc-float-right" style="border:1px solid #f0f0f0;box-shadow:0 0 10px #eee;border-radius:5px;text-align:center;width:190px;background:#fff;padding:10px;font-size:16px;margin-top: 15px;margin-bottom: 15px;color: #0992CC;">
245
- <img style="margin-right:10px;vertical-align:middle" width="15px" src="<?php echo ADBC_PLUGIN_DIR_PATH . '/images/add_schedule.svg'?>"/>
246
- <?php echo __('Add cleanup schedule','advanced-database-cleaner') ; ?>
247
- </div>
 
248
  </div>
249
-
250
- <div class="aDBc-clear-both"></div>
251
- <form id="aDBc_form" action="" method="post">
252
 
253
- <div style="float: left;width: 400px;margin-right: 25px">
254
- <?php
255
- // Print the elements to clean
256
- $this->display();
257
- ?>
 
258
  </div>
259
 
260
- <div class="aDBc-right-box">
261
-
262
- <div style="text-align:center">
263
-
264
- <img width="60px" src="<?php echo ADBC_PLUGIN_DIR_PATH . '/images/alarm-clock.svg'?>"/>
265
- <br/><br/>
266
-
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
 
316
- <?php wp_nonce_field('add_cleanup_schedule_nonce', 'add_cleanup_schedule_nonce'); ?>
317
 
318
- </form>
319
  <div class="aDBc-clear-both"></div>
320
  </div>
321
 
1
  <?php
2
+
3
+ // style et code ok
4
+
5
  class ADBC_SCHEDULE_CLEANUP extends WP_List_Table {
6
 
7
+ private $aDBc_message = "";
8
+ private $aDBc_class_message = "updated";
9
+ private $aDBc_elements_to_display = array();
10
+ private $aDBc_total_elements_to_clean = 0;
11
 
12
  /**
13
  * Constructor
14
  */
15
+ function __construct() {
16
+
17
+ parent::__construct( array(
18
+
19
+ 'singular' => __( 'Element', 'advanced-database-cleaner' ),
20
+ 'plural' => __( 'Elements', 'advanced-database-cleaner' ),
21
+ 'ajax' => false
22
+
23
+ ));
24
 
25
  $this->aDBc_prepare_elements_to_clean();
26
  $this->aDBc_print_page_content();
27
  }
28
 
29
  /** Prepare elements to display */
30
+ function aDBc_prepare_elements_to_clean() {
31
 
32
  // Test if user wants to save the scheduled task
33
+ if ( isset( $_POST['aDBc_schedule_name'] ) ) {
34
 
35
  //Quick nonce security check!
36
+ if ( ! check_admin_referer( 'add_cleanup_schedule_nonce', 'add_cleanup_schedule_nonce' ) )
37
  return; //get out if we didn't click the save_schedule button
38
 
39
+ if ( ! empty( $_POST['aDBc_elements_to_process'] ) ) {
40
+
41
+ $trim_schedule_name = trim( $_POST['aDBc_schedule_name'] );
42
+
43
+ if ( ! empty( $trim_schedule_name ) ) {
44
+
45
+ if ( preg_match( '/^[a-zA-Z0-9_]+$/', $_POST['aDBc_schedule_name'] ) ) {
46
 
47
  // Test if the name is used by other schedules.
48
+ $clean_schedule_setting = get_option( 'aDBc_clean_schedule' );
49
+ $clean_schedule_setting = is_array( $clean_schedule_setting ) ? $clean_schedule_setting : array();
50
 
51
+ $optimize_schedule_setting = get_option( 'aDBc_optimize_schedule' );
52
+ $optimize_schedule_setting = is_array( $optimize_schedule_setting ) ? $optimize_schedule_setting : array();
53
 
54
+ if ( ! array_key_exists( $_POST['aDBc_schedule_name'], $clean_schedule_setting ) &&
55
+ ! array_key_exists( $_POST['aDBc_schedule_name'], $optimize_schedule_setting ) ) {
56
 
57
+ if ( ! empty( $_POST['aDBc_date'] ) ) {
58
+
59
+ if ( ! empty( $_POST['aDBc_time'] ) ) {
60
 
61
  // We will create the new schedule
62
  $sanitized_elements_to_process = array();
63
+ foreach ( $_POST['aDBc_elements_to_process'] as $element ) {
64
+ array_push( $sanitized_elements_to_process, sanitize_html_class( $element ) );
65
  }
66
 
67
  $new_schedule_params['elements_to_clean'] = $sanitized_elements_to_process;
68
+ $new_schedule_params['repeat'] = sanitize_html_class( $_POST['aDBc_schedule_repeat'] );
69
+ $new_schedule_params['start_date'] = preg_replace( "/[^0-9-]/", '', $_POST['aDBc_date'] );
70
+ $new_schedule_params['start_time'] = preg_replace( "/[^0-9:]/", '', $_POST['aDBc_time'] );
71
+ $new_schedule_params['active'] = sanitize_html_class( $_POST['aDBc_status'] );
72
  $clean_schedule_setting[$_POST['aDBc_schedule_name']] = $new_schedule_params;
73
+
74
+ update_option( 'aDBc_clean_schedule', $clean_schedule_setting, "no" );
75
+
76
+ list( $year, $month, $day ) = explode( '-', preg_replace( "/[^0-9-]/", '', $_POST['aDBc_date'] ) );
77
+ list( $hours, $minutes ) = explode( ':', preg_replace( "/[^0-9:]/", '', $_POST['aDBc_time'] ) );
78
+
79
+ $seconds = "0";
80
+ $timestamp = mktime( $hours, $minutes, $seconds, $month, $day, $year );
81
+
82
+ if ( $_POST['aDBc_status'] == "1" ) {
83
+
84
+ if ( $_POST['aDBc_schedule_repeat'] == "once" ) {
85
+ wp_schedule_single_event( $timestamp, "aDBc_clean_scheduler", array( $_POST['aDBc_schedule_name'] ) );
86
+ } else {
87
+ wp_schedule_event( $timestamp, sanitize_html_class( $_POST['aDBc_schedule_repeat'] ), "aDBc_clean_scheduler", array( $_POST['aDBc_schedule_name'] ) );
88
  }
 
 
 
 
89
 
90
+ $this->aDBc_message = __( 'The clean-up schedule saved successfully!', 'advanced-database-cleaner' );
91
+
92
+ } else {
93
+ $this->aDBc_message = __( 'The clean-up schedule saved successfully but it is inactive!', 'advanced-database-cleaner' );
94
+ }
95
+ } else {
96
  $this->aDBc_class_message = "error";
97
+ $this->aDBc_message = __( 'Please specify a valide time!', 'advanced-database-cleaner' );
98
  }
99
+ } else {
100
  $this->aDBc_class_message = "error";
101
+ $this->aDBc_message = __( 'Please specify a valide date!', 'advanced-database-cleaner' );
102
  }
103
+ } else {
104
  $this->aDBc_class_message = "error";
105
+ $this->aDBc_message = __( 'The name you have specified is already used by another schedule! Please change it!', 'advanced-database-cleaner' );
106
  }
107
+ } else {
108
  $this->aDBc_class_message = "error";
109
+ $this->aDBc_message = __( 'Please change the name! Only letters, numbers and underscores are allowed!', 'advanced-database-cleaner' );
110
  }
111
+ } else {
112
  $this->aDBc_class_message = "error";
113
+ $this->aDBc_message = __( 'Please give a name to your schedule!', 'advanced-database-cleaner' );
114
  }
115
+ } else {
116
  $this->aDBc_class_message = "error";
117
+ $this->aDBc_message = __( 'Please select at least one item to include in the schedule from the table below!', 'advanced-database-cleaner' );
118
  }
 
119
  }
 
 
 
120
 
121
  // Get all unused elements
122
  $aDBc_unused_elements = aDBc_return_array_all_elements_to_clean();
123
 
124
  // Get settings from DB
125
+ $settings = get_option( 'aDBc_settings' );
126
 
127
+ foreach ( $aDBc_unused_elements as $element_type => $element_name ) {
128
 
129
  // Get "keep_last" option. This option is added in ADBC version 3.0, so test if it is not empty before using it
130
+ if ( empty( $settings['keep_last'] ) ) {
131
+
132
  $keep_number = '0';
133
+
134
+ } else {
135
+
136
  $keep_setting = $settings['keep_last'];
137
+
138
+ if ( empty( $keep_setting[$element_type] ) ) {
139
  $keep_number = '0';
140
+ } else {
141
  $keep_number = $keep_setting[$element_type];
142
  }
143
  }
144
+
145
  // If the item can have keep_last, then prepare it, otherwise echo N/A
146
+ if ( $element_type == "revision" ||
147
+ $element_type == "auto-draft" ||
148
+ $element_type == "trash-posts" ||
149
+ $element_type == "moderated-comments" ||
150
+ $element_type == "spam-comments" ||
151
+ $element_type == "trash-comments" ||
152
+ $element_type == "pingbacks" ||
153
+ $element_type == "trackbacks") {
154
+
155
+ $keep_info = "<span>" . $keep_number . " " . __( 'days', 'advanced-database-cleaner' );
156
+
157
+ } else {
158
+
159
+ $keep_info = __( 'N/A', 'advanced-database-cleaner' );
160
+
161
  }
162
 
163
+ array_push( $this->aDBc_elements_to_display, array(
164
+ 'element_to_schedule' => "<a href='" . $element_name['URL_blog'] . "' target='_blank' class='aDBc-info-icon'>&nbsp;</a>" . $element_name['name'],
165
+ 'keep' => $keep_info,
166
+ 'type' => $element_type
167
  )
168
  );
169
  }
170
+
171
  // Call WP prepare_items function
172
  $this->prepare_items();
173
  }
174
 
175
  /** WP: Get columns */
176
+ function get_columns() {
177
 
178
  $aDBc_keep_last_toolip = "<span class='aDBc-tooltips-headers'>
179
  <img class='aDBc-info-image' src='". ADBC_PLUGIN_DIR_PATH . '/images/information2.svg' . "'/>
180
+ <span>" . __( 'Only data that is older than the number you have specified will be cleaned based on you schedule parameters. To change this value, click on "go back" button.', 'advanced-database-cleaner' ) ." </span>
181
+ </span>";
182
 
183
  $columns = array(
184
+ 'cb' => '<input type="checkbox" />',
185
+ 'element_to_schedule' => __( 'Elements to include in the schedule', 'advanced-database-cleaner' ),
186
+ 'keep' => __( 'Keep last', 'advanced-database-cleaner' ) . $aDBc_keep_last_toolip,
187
+ 'type' => 'Type'
188
  );
189
+
190
  return $columns;
191
  }
192
 
193
  /** WP: Prepare items to display */
194
  function prepare_items() {
195
+
196
+ $columns = $this->get_columns();
197
+ $hidden = $this->get_hidden_columns();
198
+ $sortable = array();
199
+ $this->_column_headers = array( $columns, $hidden, $sortable );
200
+ $per_page = 50;
201
+ $current_page = $this->get_pagenum();
202
+
203
  // Prepare sequence of elements to display
204
+ $display_data = array_slice( $this->aDBc_elements_to_display, ( ( $current_page-1 ) * $per_page ), $per_page );
205
+
206
  $this->set_pagination_args( array(
207
+ 'total_items' => count( $this->aDBc_elements_to_display ),
208
  'per_page' => $per_page
209
  ));
210
+
211
  $this->items = $display_data;
212
  }
213
 
214
  /** WP: Get columns that should be hidden */
215
+ function get_hidden_columns() {
216
+
217
+ return array( 'type' );
218
+
219
+ }
220
 
221
  /** WP: Column default */
222
+ function column_default( $item, $column_name ) {
223
+
224
+ switch ( $column_name ) {
225
+
226
  case 'element_to_schedule':
227
  case 'keep':
228
  case 'type':
229
  return $item[$column_name];
230
  default:
231
+ return print_r( $item, true ) ; //Show the whole array for troubleshooting purposes
232
+
233
  }
234
  }
235
 
236
  /** WP: Column cb for check box */
237
+ function column_cb( $item ) {
238
+
239
  $checked = "";
240
+
241
+ if ( isset( $_POST['aDBc_elements_to_process'] ) ) {
242
+
243
+ if ( in_array( $item['type'], $_POST['aDBc_elements_to_process'] ) ) {
244
  $checked = "checked";
245
  }
246
+
247
  }
248
+ return sprintf( '<input type="checkbox" name="aDBc_elements_to_process[]" value="%s"' . $checked . '/>', $item['type'] );
249
+
250
  }
251
 
252
  /** WP: Get bulk actions */
253
  function get_bulk_actions() {
254
+
255
  return array();
256
+
257
  }
258
 
259
  /** WP: Message to display when no items found */
260
  function no_items() {
261
+
262
+ _e( 'Your database is clean!', 'advanced-database-cleaner' );
263
+
264
  }
265
 
266
 
267
  /** Print the page content */
268
+ function aDBc_print_page_content() {
269
+
270
  // Print a message if any
271
+ if ( $this->aDBc_message != "" ) {
272
+
273
  echo '<div id="aDBc_message" class="' . $this->aDBc_class_message . ' notice is-dismissible"><p>' . $this->aDBc_message . '</p></div>';
274
+
275
  }
276
  ?>
277
+
278
+ <div style="max-width:700px">
279
+
280
+ <div class="aDBc-float-left aDBc-margin-t-10">
281
+
282
+ <a href="?page=advanced_db_cleaner&aDBc_tab=general" style="text-decoration:none">
283
+
284
+ <span class="dashicons dashicons-controls-back aDBc-back-dashicon"></span>
285
+
286
+ <span style="vertical-align:middle"><?php echo __( 'Return', 'advanced-database-cleaner' ); ?></span>
287
+
288
+ </a>
289
+
290
  </div>
 
 
 
291
 
292
+ <div class="aDBc-schedule-title">
293
+
294
+ <span class="dashicons dashicons-plus aDBc-schedule-dashicon"></span>
295
+
296
+ <?php echo __( 'Add cleanup schedule', 'advanced-database-cleaner' ); ?>
297
+
298
  </div>
299
 
300
+ <div class="aDBc-clear-both"></div>
301
+
302
+ <form id="aDBc_form" action="" method="post">
303
+
304
+ <!-- Print the elements to clean -->
305
+ <div class="aDBc-schedule-table-elements">
306
+
307
+ <?php $this->display(); ?>
308
+
309
+ </div>
310
+
311
+ <div class="aDBc-right-box">
312
+
313
+ <div class="aDBc-right-box-content">
314
+
315
+ <div style="text-align:center">
316
+ <img width="60px" src="<?php echo ADBC_PLUGIN_DIR_PATH . '/images/alarm-clock.svg' ?>"/>
317
+ </div>
318
+
319
+ <div id="add_schedule" class="aDBc-schedule-info-container">
320
+
321
+ <div class="aDBc-margin-t-10"></div>
322
+
323
+ <div><?php _e( 'Schedule name', 'advanced-database-cleaner' ); ?></div>
324
+
325
+ <input name="aDBc_schedule_name" class="aDBc-schedule-input-field" type="text" value="<?php echo isset( $_POST['aDBc_schedule_name'] ) ? esc_attr( $_POST['aDBc_schedule_name'] ) : "" ?>" maxlength="25">
326
+
327
+ <div><?php _e( 'Frequency of execution', 'advanced-database-cleaner' ); ?></div>
328
+
329
+ <select name="aDBc_schedule_repeat" class="aDBc-schedule-input-field">
330
+
331
+ <?php
332
+ $schedules_repeat = array( 'once' => __( 'Once', 'advanced-database-cleaner' ),
333
+ 'hourly' => __( 'Hourly', 'advanced-database-cleaner' ),
334
+ 'twicedaily' => __( 'Twice a day', 'advanced-database-cleaner' ),
335
+ 'daily' => __( 'Daily', 'advanced-database-cleaner' ),
336
+ 'weekly' => __( 'Weekly', 'advanced-database-cleaner' ),
337
+ 'monthly' => __( 'Monthly', 'advanced-database-cleaner' )
338
+ );
339
+
340
+ foreach ( $schedules_repeat as $code_repeat => $name_repeat ) {
341
+
342
+ if ( isset( $_POST['aDBc_schedule_repeat'] ) && $_POST['aDBc_schedule_repeat'] == $code_repeat ) {
343
  echo "<option value='$code_repeat' selected='selected'>$name_repeat</option>";
344
+ } else {
345
  echo "<option value='$code_repeat'>$name_repeat</option>";
346
  }
347
+
348
  }
349
+ ?>
350
+
351
  </select>
352
 
353
+ <div><?php _e( 'Start date', 'advanced-database-cleaner' ); ?></div>
354
+
355
+ <input name="aDBc_date" class="aDBc-schedule-input-field" type="date" value="<?php echo isset( $_POST['aDBc_date'] ) ? esc_attr( $_POST['aDBc_date'] ) : date( "Y-m-d" ); ?>" min="<?php echo date( "Y-m-d" ); ?>">
356
+
357
+ <div><?php _e( 'Start time (GMT)', 'advanced-database-cleaner' ); ?></div>
358
+
359
+ <input name="aDBc_time" class="aDBc-schedule-input-field" type="time" value="<?php echo isset( $_POST['aDBc_time'] ) ? esc_attr( $_POST['aDBc_time'] ) : date( "H:i", time() ); ?>">
360
 
361
+ <div><?php _e( 'Schedule status', 'advanced-database-cleaner' ); ?></div>
 
362
 
363
+ <div class="aDBc-schedule-radio-container">
364
 
365
+ <input name="aDBc_status" type="radio" value="1" checked>
366
+
367
+ <span style="margin-right:20px"><?php _e( 'Active', 'advanced-database-cleaner' ); ?></span>
368
+
369
+ <input name="aDBc_status" type="radio" value="0" <?php echo ( isset( $_POST['aDBc_status'] ) && $_POST['aDBc_status'] == "0" ) ? 'checked' : ''; ?>>
370
+
371
+ <?php _e( 'Inactive', 'advanced-database-cleaner' ); ?>
372
 
 
 
373
  </div>
374
 
375
+ <div class="aDBc-schedule-save-btn-div">
376
+
377
+ <input class="button-primary" type="submit" value="<?php _e( 'Save the schedule', 'advanced-database-cleaner' ); ?>" style="width:100%"/>
378
+
379
  </div>
380
 
381
  </div>
382
+ </div>
383
  </div>
 
384
 
385
+ <?php wp_nonce_field( 'add_cleanup_schedule_nonce', 'add_cleanup_schedule_nonce' ); ?>
386
 
387
+ </form>
388
  <div class="aDBc-clear-both"></div>
389
  </div>
390
 
includes/custom-schedule-view/class_add_optimize_schedule.php CHANGED
@@ -1,201 +1,264 @@
1
  <?php
 
 
 
2
  class ADBC_SCHEDULE_OPTIMIZE {
3
 
4
- private $aDBc_message = "";
5
  private $aDBc_class_message = "updated";
6
 
7
  /**
8
  * Constructor
9
  */
10
- function __construct(){
11
 
12
  $this->aDBc_prepare_elements_to_clean();
13
  $this->aDBc_print_page_content();
14
  }
15
 
16
  /** Prepare elements to display */
17
- function aDBc_prepare_elements_to_clean(){
18
 
19
  // Test if user wants to save the scheduled task
20
- if(isset($_POST['aDBc_schedule_name'])){
21
 
22
  //Quick nonce security check!
23
- if(!check_admin_referer('add_optimize_schedule_nonce', 'add_optimize_schedule_nonce'))
24
  return; //get out if we didn't click the save_schedule button
25
 
26
- if(!empty(trim($_POST['aDBc_schedule_name']))){
27
- if(preg_match('/^[a-zA-Z0-9_]+$/',$_POST['aDBc_schedule_name'])){
 
 
 
28
 
29
  // Test if the name is used by other schedules.
30
- $clean_schedule_setting = get_option('aDBc_clean_schedule');
31
- $clean_schedule_setting = is_array($clean_schedule_setting) ? $clean_schedule_setting : array();
 
 
 
32
 
33
- $optimize_schedule_setting = get_option('aDBc_optimize_schedule');
34
- $optimize_schedule_setting = is_array($optimize_schedule_setting) ? $optimize_schedule_setting : array();
35
 
36
- if(!array_key_exists($_POST['aDBc_schedule_name'], $clean_schedule_setting) &&
37
- !array_key_exists($_POST['aDBc_schedule_name'], $optimize_schedule_setting)){
38
 
39
- if(!empty($_POST['aDBc_date'])){
40
- if(!empty($_POST['aDBc_time'])){
41
 
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
 
66
- if($_POST['aDBc_status'] == "1"){
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{
74
- $this->aDBc_message = __('The clean-up schedule saved successfully but it is inactive!', 'advanced-database-cleaner');
 
 
75
  }
76
- }else{
77
  $this->aDBc_class_message = "error";
78
- $this->aDBc_message = __('Please choose at least one operation to perform!', 'advanced-database-cleaner');
79
  }
80
- }else{
81
  $this->aDBc_class_message = "error";
82
- $this->aDBc_message = __('Please specify a valide time!', 'advanced-database-cleaner');
83
  }
84
- }else{
85
  $this->aDBc_class_message = "error";
86
- $this->aDBc_message = __('Please specify a valide date!', 'advanced-database-cleaner');
87
  }
88
- }else{
89
  $this->aDBc_class_message = "error";
90
- $this->aDBc_message = __('The name you have specified is already used by another schedule! Please change it!', 'advanced-database-cleaner');
91
  }
92
- }else{
93
  $this->aDBc_class_message = "error";
94
- $this->aDBc_message = __('Please change the name! Only letters, numbers and underscores are allowed!', 'advanced-database-cleaner');
95
  }
96
- }else{
97
  $this->aDBc_class_message = "error";
98
- $this->aDBc_message = __('Please give a name to your schedule!', 'advanced-database-cleaner');
99
  }
100
  }
101
  }
102
 
103
  /** Print the page content */
104
- function aDBc_print_page_content(){
 
105
  // Print a message if any
106
- if($this->aDBc_message != ""){
 
107
  echo '<div id="aDBc_message" class="' . $this->aDBc_class_message . ' notice is-dismissible"><p>' . $this->aDBc_message . '</p></div>';
 
108
  }
109
  ?>
110
- <div style="width:636px">
111
 
112
- <div>
113
- <div class="aDBc-float-left aDBc-margin-t-10">
114
- <a href="?page=advanced_db_cleaner&aDBc_tab=tables&aDBc_cat=all">
115
- <img width="40px" src="<?php echo ADBC_PLUGIN_DIR_PATH . '/images/go_back.svg'?>"/>
116
- </a>
117
- </div>
118
- <div class="aDBc-float-right" style="border:1px solid #f0f0f0;box-shadow:0 0 10px #eee;border-radius:5px;text-align:center;width:198px;background:#fff;padding:10px 5px;font-size:16px;margin-top: 15px;margin-bottom: 15px;color: #0992CC;">
119
- <img style="margin-right:10px;vertical-align:middle" width="15px" src="<?php echo ADBC_PLUGIN_DIR_PATH . '/images/add_schedule.svg'?>"/>
120
- <?php echo __('Add optimize schedule','advanced-database-cleaner') ; ?>
121
- </div>
 
 
122
  </div>
123
 
124
- <div class="aDBc-clear-both"></div>
125
-
126
- <form id="aDBc_form" action="" method="post">
127
-
128
- <div style="float:left;width:400px;margin-right: 25px;background:#f0f5fa;margin-top:49px;padding-top:50px;height:100px;text-align:center;border-radius:4px;border:1px solid #eee">
129
- <?php echo __('By default, all your database tables will be optimized and/or repaired (if needed) according to your schedule settings','advanced-database-cleaner') ; ?>
130
  </div>
131
 
132
- <div class="aDBc-right-box">
133
-
134
- <div style="text-align:center">
135
-
136
- <img width="60px" src="<?php echo ADBC_PLUGIN_DIR_PATH . '/images/alarm-clock.svg'?>"/>
137
- <br/><br/>
138
-
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>
178
 
179
- <div style="text-align:left"><?php _e('Schedule status','advanced-database-cleaner');?></div>
180
- <div style="margin-top:2px;text-align:left;background:#fff;padding:5px;box-shadow:0 0 10px #e0e0e0;border-radius:5px">
181
- <input type="radio" name="aDBc_status" value="1" checked>
182
- <span style="margin-right:35px"><?php _e('Active','advanced-database-cleaner');?></span>
183
-
184
- <input type="radio" name="aDBc_status" value="0" <?php echo (isset($_POST['aDBc_status']) && $_POST['aDBc_status'] == "0") ? 'checked' : ''; ?>>
185
- <?php _e('Inactive','advanced-database-cleaner');?>
 
 
 
 
 
186
  </div>
187
 
188
- <div style="width:100%;margin-top:20px">
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
 
196
- <?php wp_nonce_field('add_optimize_schedule_nonce', 'add_optimize_schedule_nonce'); ?>
197
 
198
- </form>
199
  <div class="aDBc-clear-both"></div>
200
  </div>
201
 
1
  <?php
2
+
3
+ // style et code ok
4
+
5
  class ADBC_SCHEDULE_OPTIMIZE {
6
 
7
+ private $aDBc_message = "";
8
  private $aDBc_class_message = "updated";
9
 
10
  /**
11
  * Constructor
12
  */
13
+ function __construct() {
14
 
15
  $this->aDBc_prepare_elements_to_clean();
16
  $this->aDBc_print_page_content();
17
  }
18
 
19
  /** Prepare elements to display */
20
+ function aDBc_prepare_elements_to_clean() {
21
 
22
  // Test if user wants to save the scheduled task
23
+ if ( isset( $_POST['aDBc_schedule_name'] ) ) {
24
 
25
  //Quick nonce security check!
26
+ if ( ! check_admin_referer( 'add_optimize_schedule_nonce', 'add_optimize_schedule_nonce' ) )
27
  return; //get out if we didn't click the save_schedule button
28
 
29
+ $trim_schedule_name = trim( $_POST['aDBc_schedule_name'] );
30
+
31
+ if ( ! empty( $trim_schedule_name ) ) {
32
+
33
+ if ( preg_match( '/^[a-zA-Z0-9_]+$/', $_POST['aDBc_schedule_name'] ) ) {
34
 
35
  // Test if the name is used by other schedules.
36
+ $clean_schedule_setting = get_option( 'aDBc_clean_schedule' );
37
+ $clean_schedule_setting = is_array( $clean_schedule_setting ) ? $clean_schedule_setting : array();
38
+
39
+ $optimize_schedule_setting = get_option( 'aDBc_optimize_schedule' );
40
+ $optimize_schedule_setting = is_array( $optimize_schedule_setting ) ? $optimize_schedule_setting : array();
41
 
42
+ if ( ! array_key_exists( $_POST['aDBc_schedule_name'], $clean_schedule_setting ) &&
43
+ ! array_key_exists( $_POST['aDBc_schedule_name'], $optimize_schedule_setting ) ) {
44
 
45
+ if ( ! empty( $_POST['aDBc_date'] ) ) {
 
46
 
47
+ if ( ! empty( $_POST['aDBc_time'] ) ) {
 
48
 
49
+ if ( ! empty( $_POST['aDBc_operation1'] ) || ! empty( $_POST['aDBc_operation2'] ) ) {
50
 
51
  // We will create the new schedule
52
+ $new_schedule_params['repeat'] = sanitize_html_class( $_POST['aDBc_schedule_repeat'] );
53
+ $new_schedule_params['start_date'] = preg_replace( "/[^0-9-]/", '', $_POST['aDBc_date'] );
54
+ $new_schedule_params['start_time'] = preg_replace( "/[^0-9:]/", '', $_POST['aDBc_time'] );
55
 
56
  // Prepare operations to perform
57
  $operations = array();
 
 
 
 
 
58
 
59
+ if ( ! empty( $_POST['aDBc_operation1'] ) )
60
+
61
+ array_push( $operations, sanitize_html_class( $_POST['aDBc_operation1'] ) );
62
+
63
+ if ( ! empty( $_POST['aDBc_operation2'] ) )
64
+
65
+ array_push( $operations, sanitize_html_class( $_POST['aDBc_operation2'] ) );
66
+
67
+ $new_schedule_params['operations'] = $operations;
68
+ $new_schedule_params['active'] = sanitize_html_class( $_POST['aDBc_status'] );
69
+
70
  $optimize_schedule_setting[$_POST['aDBc_schedule_name']] = $new_schedule_params;
 
71
 
72
+ update_option( 'aDBc_optimize_schedule', $optimize_schedule_setting, "no" );
73
+
74
+ list( $year, $month, $day ) = explode( '-', preg_replace( "/[^0-9-]/", '', $_POST['aDBc_date'] ) );
75
+ list( $hours, $minutes ) = explode( ':', preg_replace( "/[^0-9:]/", '', $_POST['aDBc_time'] ) );
76
+
77
  $seconds = "0";
78
+ $timestamp = mktime( $hours, $minutes, $seconds, $month, $day, $year );
79
+
80
+ if ( $_POST['aDBc_status'] == "1" ) {
81
 
82
+ if ( $_POST['aDBc_schedule_repeat'] == "once" ) {
83
+ wp_schedule_single_event( $timestamp, "aDBc_optimize_scheduler", array( $_POST['aDBc_schedule_name'] ) );
84
+ } else {
85
+ wp_schedule_event( $timestamp, sanitize_html_class( $_POST['aDBc_schedule_repeat'] ), "aDBc_optimize_scheduler", array( $_POST['aDBc_schedule_name'] ) );
 
86
  }
87
+
88
+ $this->aDBc_message = __( 'The clean-up schedule saved successfully!', 'advanced-database-cleaner' );
89
+
90
+ } else {
91
+ $this->aDBc_message = __( 'The clean-up schedule saved successfully but it is inactive!', 'advanced-database-cleaner' );
92
  }
93
+ } else {
94
  $this->aDBc_class_message = "error";
95
+ $this->aDBc_message = __( 'Please choose at least one operation to perform!', 'advanced-database-cleaner' );
96
  }
97
+ } else {
98
  $this->aDBc_class_message = "error";
99
+ $this->aDBc_message = __( 'Please specify a valide time!', 'advanced-database-cleaner' );
100
  }
101
+ } else {
102
  $this->aDBc_class_message = "error";
103
+ $this->aDBc_message = __( 'Please specify a valide date!', 'advanced-database-cleaner' );
104
  }
105
+ } else {
106
  $this->aDBc_class_message = "error";
107
+ $this->aDBc_message = __( 'The name you have specified is already used by another schedule! Please change it!', 'advanced-database-cleaner' );
108
  }
109
+ } else {
110
  $this->aDBc_class_message = "error";
111
+ $this->aDBc_message = __( 'Please change the name! Only letters, numbers and underscores are allowed!', 'advanced-database-cleaner' );
112
  }
113
+ } else {
114
  $this->aDBc_class_message = "error";
115
+ $this->aDBc_message = __( 'Please give a name to your schedule!', 'advanced-database-cleaner' );
116
  }
117
  }
118
  }
119
 
120
  /** Print the page content */
121
+ function aDBc_print_page_content() {
122
+
123
  // Print a message if any
124
+ if ( $this->aDBc_message != "" ) {
125
+
126
  echo '<div id="aDBc_message" class="' . $this->aDBc_class_message . ' notice is-dismissible"><p>' . $this->aDBc_message . '</p></div>';
127
+
128
  }
129
  ?>
 
130
 
131
+ <div style="max-width:700px">
132
+
133
+ <div class="aDBc-float-left aDBc-margin-t-10">
134
+
135
+ <a href="?page=advanced_db_cleaner&aDBc_tab=tables&aDBc_cat=all" style="text-decoration:none">
136
+
137
+ <span class="dashicons dashicons-controls-back aDBc-back-dashicon"></span>
138
+
139
+ <span style="vertical-align:middle"><?php echo __( 'Return', 'advanced-database-cleaner' ); ?></span>
140
+
141
+ </a>
142
+
143
  </div>
144
 
145
+ <div class="aDBc-schedule-title">
146
+
147
+ <span class="dashicons dashicons-plus aDBc-schedule-dashicon"></span>
148
+
149
+ <?php echo __( 'Add optimize schedule', 'advanced-database-cleaner' ); ?>
150
+
151
  </div>
152
 
153
+ <div class="aDBc-clear-both"></div>
154
+
155
+ <form id="aDBc_form" action="" method="post">
156
+
157
+ <!-- Print box info for tables that will be optimized -->
158
+ <div class="aDBc-schedule-table-elements aDBc-schedule-tables-box-info">
159
+ <div style="padding:40px 20px">
160
+ <?php echo __( 'By default, all your database tables will be optimized and/or repaired (if needed) according to your schedule settings', 'advanced-database-cleaner' ); ?>
161
+ </div>
162
+ </div>
163
+
164
+ <div class="aDBc-right-box">
165
+
166
+ <div class="aDBc-right-box-content">
167
+
168
+ <div style="text-align:center">
169
+ <img width="60px" src="<?php echo ADBC_PLUGIN_DIR_PATH . '/images/alarm-clock.svg' ?>"/>
170
+ </div>
171
+
172
+ <div id="add_schedule" class="aDBc-schedule-info-container">
173
+
174
+ <div class="aDBc-margin-t-10"></div>
175
+
176
+ <div><?php _e( 'Schedule name', 'advanced-database-cleaner' ); ?></div>
177
+
178
+ <input name="aDBc_schedule_name" class="aDBc-schedule-input-field" type="text" value="<?php echo isset( $_POST['aDBc_schedule_name'] ) ? esc_attr( $_POST['aDBc_schedule_name'] ) : "" ?>" maxlength="25">
179
+
180
+ <div><?php _e( 'Frequency of execution', 'advanced-database-cleaner' ); ?></div>
181
+
182
+ <select name="aDBc_schedule_repeat" class="aDBc-schedule-input-field">
183
+
184
+ <?php
185
+ $schedules_repeat = array( 'once' => __( 'Once', 'advanced-database-cleaner' ),
186
+ 'hourly' => __( 'Hourly', 'advanced-database-cleaner' ),
187
+ 'twicedaily' => __( 'Twice a day', 'advanced-database-cleaner' ),
188
+ 'daily' => __( 'Daily', 'advanced-database-cleaner' ),
189
+ 'weekly' => __( 'Weekly', 'advanced-database-cleaner' ),
190
+ 'monthly' => __( 'Monthly', 'advanced-database-cleaner' )
191
+ );
192
+
193
+ foreach ( $schedules_repeat as $code_repeat => $name_repeat ) {
194
+
195
+ if ( isset( $_POST['aDBc_schedule_repeat'] ) && $_POST['aDBc_schedule_repeat'] == $code_repeat ) {
196
  echo "<option value='$code_repeat' selected='selected'>$name_repeat</option>";
197
+ } else {
198
  echo "<option value='$code_repeat'>$name_repeat</option>";
199
  }
200
+
201
  }
202
+ ?>
203
+
204
  </select>
205
 
206
+ <div><?php _e( 'Start date', 'advanced-database-cleaner' ); ?></div>
207
+
208
+ <input name="aDBc_date" class="aDBc-schedule-input-field" type="date" value="<?php echo isset( $_POST['aDBc_date'] ) ? esc_attr( $_POST['aDBc_date'] ) : date( "Y-m-d" ); ?>" min="<?php echo date( "Y-m-d" ); ?>">
209
+
210
+ <div><?php _e( 'Start time (GMT)', 'advanced-database-cleaner' ); ?></div>
211
 
212
+ <input name="aDBc_time" class="aDBc-schedule-input-field" type="time" value="<?php echo isset( $_POST['aDBc_time'] ) ? esc_attr( $_POST['aDBc_time'] ) : date( "H:i", time() ); ?>">
 
213
 
214
+ <div><?php _e( 'Perform operations', 'advanced-database-cleaner' ); ?></div>
215
+
216
+ <div class="aDBc-schedule-radio-container">
217
+
218
+ <?php
219
+
220
+ $optimize_checked = ( isset( $_POST['aDBc_operation1'] ) && $_POST['aDBc_operation1'] == "optimize" ) ? 'checked' : '';
221
+ $repair_checked = ( isset( $_POST['aDBc_operation2'] ) && $_POST['aDBc_operation2'] == "repair" ) ? 'checked' : '';
222
+
223
+ ?>
224
+
225
+ <input name="aDBc_operation1" type="checkbox" value="optimize" <?php echo $optimize_checked; ?>>
226
+
227
+ <span style="margin-right:20px"><?php _e( 'Optimize', 'advanced-database-cleaner' ); ?></span>
228
+
229
+ <input name="aDBc_operation2" type="checkbox" value="repair" <?php echo $repair_checked; ?>>
230
+
231
+ <?php _e( 'Repair', 'advanced-database-cleaner' ); ?>
232
 
 
 
233
  </div>
234
 
235
+ <div><?php _e( 'Schedule status', 'advanced-database-cleaner' ); ?></div>
236
+
237
+ <div class="aDBc-schedule-radio-container">
238
+
239
+ <input name="aDBc_status" type="radio" value="1" checked>
240
+
241
+ <span style="margin-right:20px"><?php _e( 'Active', 'advanced-database-cleaner' ); ?></span>
242
+
243
+ <input name="aDBc_status" type="radio" value="0" <?php echo ( isset( $_POST['aDBc_status'] ) && $_POST['aDBc_status'] == "0" ) ? 'checked' : ''; ?>>
244
+
245
+ <?php _e( 'Inactive', 'advanced-database-cleaner' ); ?>
246
+
247
  </div>
248
 
249
+ <div class="aDBc-schedule-save-btn-div">
250
+
251
+ <input class="button-primary" type="submit" value="<?php _e( 'Save the schedule', 'advanced-database-cleaner' ); ?>" style="width:100%"/>
252
+
253
  </div>
254
 
255
  </div>
256
+ </div>
257
  </div>
 
258
 
259
+ <?php wp_nonce_field( 'add_optimize_schedule_nonce', 'add_optimize_schedule_nonce' ); ?>
260
 
261
+ </form>
262
  <div class="aDBc-clear-both"></div>
263
  </div>
264
 
includes/custom-schedule-view/class_edit_cleanup_schedule.php CHANGED
@@ -1,370 +1,446 @@
1
  <?php
 
 
 
2
  class EDIT_SCHEDULE_CLEANUP extends WP_List_Table {
3
 
4
- private $aDBc_message = "";
5
- private $aDBc_class_message = "updated";
6
- private $aDBc_elements_to_display = array();
7
- private $aDBc_total_elements_to_clean = 0;
8
 
9
  /**
10
  * Constructor
11
  */
12
- function __construct(){
13
-
14
- parent::__construct(array(
15
- 'singular' => __('Element', 'advanced-database-cleaner'), //singular name of the listed records
16
- 'plural' => __('Elements', 'advanced-database-cleaner'), //plural name of the listed records
17
- 'ajax' => false //does this table support ajax?
18
- ));
 
 
19
 
20
  $this->aDBc_prepare_elements_to_clean();
21
  $this->aDBc_print_page_content();
22
  }
23
 
24
  /** Prepare elements to display */
25
- function aDBc_prepare_elements_to_clean(){
26
 
27
  // Test if user wants to save the edited scheduled task
28
- if(isset($_POST['aDBc_schedule_name'])){
29
 
30
  //Quick nonce security check!
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
 
38
  // Test if the name is used by other schedules.
39
- $clean_schedule_setting = get_option('aDBc_clean_schedule');
40
- $clean_schedule_setting = is_array($clean_schedule_setting) ? $clean_schedule_setting : array();
 
 
 
41
 
42
- $optimize_schedule_setting = get_option('aDBc_optimize_schedule');
43
- $optimize_schedule_setting = is_array($optimize_schedule_setting) ? $optimize_schedule_setting : array();
 
 
 
44
 
45
- if($_POST['aDBc_schedule_name'] == $_GET['hook_name'] ||
46
- ($_POST['aDBc_schedule_name'] != $_GET['hook_name'] &&
47
- !array_key_exists($_POST['aDBc_schedule_name'], $clean_schedule_setting) &&
48
- !array_key_exists($_POST['aDBc_schedule_name'], $optimize_schedule_setting))){
49
 
50
- if(!empty($_POST['aDBc_date'])){
51
- if(!empty($_POST['aDBc_time'])){
52
 
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
 
74
  // Clear scheduled event
75
- wp_clear_scheduled_hook('aDBc_clean_scheduler', array($_POST['aDBc_schedule_name'].''));
 
 
76
 
77
- if($_POST['aDBc_status'] == "1"){
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{
85
- $this->aDBc_message = __('The clean-up schedule saved successfully but it is inactive!', 'advanced-database-cleaner');
 
 
86
  }
87
- }else{
88
  $this->aDBc_class_message = "error";
89
- $this->aDBc_message = __('Please specify a valide time!', 'advanced-database-cleaner');
90
  }
91
- }else{
92
  $this->aDBc_class_message = "error";
93
- $this->aDBc_message = __('Please specify a valide date!', 'advanced-database-cleaner');
94
  }
95
- }else{
96
  $this->aDBc_class_message = "error";
97
- $this->aDBc_message = __('The name you have specified is already used by another schedule! Please change it!', 'advanced-database-cleaner');
98
  }
99
- }else{
100
  $this->aDBc_class_message = "error";
101
- $this->aDBc_message = __('Please change the name! Only letters, numbers and underscores are allowed!', 'advanced-database-cleaner');
102
  }
103
- }else{
104
  $this->aDBc_class_message = "error";
105
- $this->aDBc_message = __('Please give a name to your schedule!', 'advanced-database-cleaner');
106
  }
107
- }else{
108
  $this->aDBc_class_message = "error";
109
- $this->aDBc_message = __('Please select at least one item to include in the schedule from the table below!', 'advanced-database-cleaner');
110
  }
111
-
112
  }
113
- // yyy should this $wpdb be cleaned?
114
- global $wpdb;
115
 
116
  // Get all unused elements
117
  $aDBc_unused_elements = aDBc_return_array_all_elements_to_clean();
118
 
119
  // Get settings from DB
120
- $settings = get_option('aDBc_settings');
121
 
122
- foreach($aDBc_unused_elements as $element_type => $element_name){
123
 
124
  // Get "keep_last" option. This option is added in ADBC version 3.0, so test if it is not empty before using it
125
- if(empty($settings['keep_last'])){
 
126
  $keep_number = '0';
127
- }else{
 
 
128
  $keep_setting = $settings['keep_last'];
129
- if(empty($keep_setting[$element_type])){
 
130
  $keep_number = '0';
131
- }else{
132
  $keep_number = $keep_setting[$element_type];
133
  }
134
  }
135
  // If the item can have keep_last, then prepare it, otherwise echo N/A
136
- if($element_type == "revision" ||
137
- $element_type == "auto-draft" ||
138
- $element_type == "trash-posts" ||
139
- $element_type == "moderated-comments" ||
140
- $element_type == "spam-comments" ||
141
- $element_type == "trash-comments" ||
142
- $element_type == "pingbacks" ||
143
- $element_type == "trackbacks"){
144
-
145
- $keep_info = "<span>" . $keep_number . " " . __('days','advanced-database-cleaner');
146
- }else{
147
- $keep_info = __('N/A','advanced-database-cleaner') ;
 
 
 
148
  }
149
 
150
- array_push($this->aDBc_elements_to_display, array(
151
- 'element_to_schedule' => "<a href='" . $element_name['URL_blog'] . "' target='_blank' class='aDBc_info_icon'>&nbsp;</a>" . $element_name['name'],
152
- 'keep' => $keep_info,
153
- 'type' => $element_type
154
  )
155
  );
156
  }
 
157
  // Call WP prepare_items function
158
  $this->prepare_items();
159
  }
160
 
161
  /** WP: Get columns */
162
- function get_columns(){
163
 
164
  $aDBc_keep_last_toolip = "<span class='aDBc-tooltips-headers'>
165
  <img class='aDBc-info-image' src='". ADBC_PLUGIN_DIR_PATH . '/images/information2.svg' . "'/>
166
- <span>" . __('Only data that is older than the number you have specified will be cleaned based on you schedule parameters. To change this value, click on "go back" button.','advanced-database-cleaner') ." </span>
167
- </span>";
168
 
169
  $columns = array(
170
  'cb' => '<input type="checkbox" />',
171
- 'element_to_schedule' => __('Elements to include in the schedule','advanced-database-cleaner'),
172
- 'keep' => __('Keep last','advanced-database-cleaner') . $aDBc_keep_last_toolip,
173
  'type' => 'Type'
174
  );
 
175
  return $columns;
176
  }
177
 
178
  /** WP: Prepare items to display */
179
  function prepare_items() {
180
- $columns = $this->get_columns();
181
- $hidden = $this->get_hidden_columns();
182
- $sortable = array();
183
- $this->_column_headers = array($columns, $hidden, $sortable);
184
- $per_page = 50;
185
- $current_page = $this->get_pagenum();
 
 
186
  // Prepare sequence of elements to display
187
- $display_data = array_slice($this->aDBc_elements_to_display,(($current_page-1) * $per_page), $per_page);
 
188
  $this->set_pagination_args( array(
189
- 'total_items' => count($this->aDBc_elements_to_display),
190
  'per_page' => $per_page
191
  ));
 
192
  $this->items = $display_data;
193
  }
194
 
195
  /** WP: Get columns that should be hidden */
196
- function get_hidden_columns(){
197
- return array('type');
198
- }
 
 
199
 
200
  /** WP: Column default */
201
- function column_default($item, $column_name){
202
- switch($column_name){
 
 
203
  case 'element_to_schedule':
204
  case 'keep':
205
  case 'type':
206
  return $item[$column_name];
207
  default:
208
- return print_r($item, true) ; //Show the whole array for troubleshooting purposes
 
209
  }
210
  }
211
 
212
  /** WP: Column cb for check box */
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
 
227
- if(in_array($item['type'], $schedule_elements_to_clean)){
228
  $checked = "checked";
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 */
236
  function get_bulk_actions() {
 
237
  return array();
 
238
  }
239
 
240
  /** WP: Message to display when no items found */
241
  function no_items() {
242
- _e('Your database is clean!','advanced-database-cleaner');
 
 
243
  }
244
 
245
 
246
  /** Print the page content */
247
- function aDBc_print_page_content(){
 
248
  // Print a message if any
249
- if($this->aDBc_message != ""){
 
250
  echo '<div id="aDBc_message" class="' . $this->aDBc_class_message . ' notice is-dismissible"><p>' . $this->aDBc_message . '</p></div>';
 
251
  }
252
  ?>
253
- <div style="width:636px">
254
 
255
- <div>
256
- <div class="aDBc-float-left aDBc-margin-t-10">
257
- <a href="?page=advanced_db_cleaner&aDBc_tab=general">
258
- <img width="40px" src="<?php echo ADBC_PLUGIN_DIR_PATH . '/images/go_back.svg'?>"/>
259
- </a>
260
- </div>
261
- <div class="aDBc-float-right" style="border:1px solid #f0f0f0;box-shadow:0 0 10px #eee;border-radius:5px;text-align:center;width:190px;background:#fff;padding:10px;font-size:16px;margin-top: 15px;margin-bottom: 25px;color: #0992CC;">
262
- <img style="margin-right:10px" width="15px" src="<?php echo ADBC_PLUGIN_DIR_PATH . '/images/edit_schedule.svg'?>"/>
263
- <?php echo __('Edit cleanup schedule','advanced-database-cleaner') ; ?>
264
- </div>
 
 
 
 
 
 
 
 
 
 
265
  </div>
266
 
267
  <div class="aDBc-clear-both"></div>
268
- <form id="aDBc_form" action="" method="post">
269
- <div style="float: left;width: 400px;margin-right: 25px">
 
 
 
 
 
 
 
 
270
  <?php
271
- // Print the elements to clean
272
- $this->display();
273
- ?>
274
- </div>
 
 
 
 
 
 
 
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">
 
 
 
 
308
 
309
- <div style="text-align:center">
310
 
311
- <img width="60px" src="<?php echo ADBC_PLUGIN_DIR_PATH . '/images/alarm-clock.svg'?>"/>
312
- <br/><br/>
313
 
314
- <div id="add_schedule" style="border-top:1px dashed #ccc">
315
- <br/>
316
 
317
- <div style="text-align:left"><?php _e('Schedule name','advanced-database-cleaner');?></div>
318
- <input style="width:100%;margin-bottom:10px;height:30px;border-radius:5px;box-shadow:0 0 10px #e0e0e0;background-color: #ccc !important;color: #000 !important;" type="text" name="aDBc_schedule_name_x" placeholder="Schedule name" value="<?php echo $hook_name; ?>" maxlength="25" disabled>
319
  <input type="hidden" name="aDBc_schedule_name" value="<?php echo $hook_name; ?>" maxlength="25">
320
-
321
- <div style="text-align:left"><?php _e('Frequency of execution','advanced-database-cleaner');?></div>
322
- <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">
323
- <?php
324
- $schedules_repeat = array('once' => __('Once','advanced-database-cleaner'),
325
- 'hourly' => __('Hourly','advanced-database-cleaner'),
326
- 'twicedaily' => __('Twice a day','advanced-database-cleaner'),
327
- 'daily' => __('Daily','advanced-database-cleaner'),
328
- 'weekly' => __('Weekly','advanced-database-cleaner'),
329
- 'monthly' => __('Monthly','advanced-database-cleaner'));
330
-
331
- foreach($schedules_repeat as $code_repeat => $name_repeat){
332
- if($code_repeat == $schedule_repeat){
 
 
 
 
333
  echo "<option value='$code_repeat' selected='selected'>$name_repeat</option>";
334
- }else{
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>
342
- <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 $schedule_date; ?>" min="<?php echo date("Y-m-d"); ?>">
 
 
 
 
 
343
 
344
- <div style="text-align:left"><?php _e('Start time (GMT)','advanced-database-cleaner');?></div>
345
- <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 $schedule_time; ?>">
346
 
347
- <div style="text-align:left"><?php _e('Schedule status','advanced-database-cleaner');?></div>
348
 
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>
356
 
357
- <div style="width:100%;margin-top:20px">
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
 
365
- <?php wp_nonce_field('edit_cleanup_schedule_nonce', 'edit_cleanup_schedule_nonce'); ?>
366
 
367
- </form>
368
  <div class="aDBc-clear-both"></div>
369
  </div>
370
 
1
  <?php
2
+
3
+ // style et code ok
4
+
5
  class EDIT_SCHEDULE_CLEANUP extends WP_List_Table {
6
 
7
+ private $aDBc_message = "";
8
+ private $aDBc_class_message = "updated";
9
+ private $aDBc_elements_to_display = array();
10
+ private $aDBc_total_elements_to_clean = 0;
11
 
12
  /**
13
  * Constructor
14
  */
15
+ function __construct() {
16
+
17
+ parent::__construct( array(
18
+
19
+ 'singular' => __( 'Element', 'advanced-database-cleaner' ),
20
+ 'plural' => __( 'Elements', 'advanced-database-cleaner' ),
21
+ 'ajax' => false
22
+
23
+ ));
24
 
25
  $this->aDBc_prepare_elements_to_clean();
26
  $this->aDBc_print_page_content();
27
  }
28
 
29
  /** Prepare elements to display */
30
+ function aDBc_prepare_elements_to_clean() {
31
 
32
  // Test if user wants to save the edited scheduled task
33
+ if ( isset( $_POST['aDBc_schedule_name'] ) ) {
34
 
35
  //Quick nonce security check!
36
+ if ( ! check_admin_referer( 'edit_cleanup_schedule_nonce', 'edit_cleanup_schedule_nonce' ) )
37
  return; //get out if we didn't click the save_schedule button
38
+
39
+ if ( ! empty( $_POST['aDBc_elements_to_process'] ) ) {
40
+
41
+ $trim_schedule_name = trim( $_POST['aDBc_schedule_name'] );
42
+
43
+ if ( ! empty( $trim_schedule_name ) ) {
44
+
45
+ if ( preg_match( '/^[a-zA-Z0-9_]+$/', $_POST['aDBc_schedule_name'] ) ) {
46
 
47
  // Test if the name is used by other schedules.
48
+ $clean_schedule_setting = get_option( 'aDBc_clean_schedule' );
49
+ $clean_schedule_setting = is_array( $clean_schedule_setting ) ? $clean_schedule_setting : array();
50
+
51
+ $optimize_schedule_setting = get_option( 'aDBc_optimize_schedule' );
52
+ $optimize_schedule_setting = is_array( $optimize_schedule_setting ) ? $optimize_schedule_setting : array();
53
 
54
+ if ( $_POST['aDBc_schedule_name'] == $_GET['hook_name'] ||
55
+ ( $_POST['aDBc_schedule_name'] != $_GET['hook_name'] &&
56
+ ! array_key_exists( $_POST['aDBc_schedule_name'], $clean_schedule_setting ) &&
57
+ ! array_key_exists( $_POST['aDBc_schedule_name'], $optimize_schedule_setting ) )
58
+ ) {
59
 
60
+ if ( ! empty( $_POST['aDBc_date'] ) ) {
 
 
 
61
 
62
+ if ( ! empty( $_POST['aDBc_time'] ) ) {
 
63
 
64
  // Delete the old schedule and replace it with the new
65
 
66
  // We will create the new schedule
67
  $sanitized_elements_to_process = array();
68
+
69
+ foreach ( $_POST['aDBc_elements_to_process'] as $element ) {
70
+ array_push( $sanitized_elements_to_process, sanitize_html_class( $element ) );
71
  }
72
 
73
  $new_schedule_params['elements_to_clean'] = $sanitized_elements_to_process;
74
+ $new_schedule_params['repeat'] = sanitize_html_class( $_POST['aDBc_schedule_repeat'] );
75
+ $new_schedule_params['start_date'] = preg_replace( "/[^0-9-]/", '', $_POST['aDBc_date'] );
76
+ $new_schedule_params['start_time'] = preg_replace( "/[^0-9:]/", '', $_POST['aDBc_time'] );
77
+ $new_schedule_params['active'] = sanitize_html_class( $_POST['aDBc_status'] );
78
  $clean_schedule_setting[$_POST['aDBc_schedule_name']] = $new_schedule_params;
 
79
 
80
+ update_option( 'aDBc_clean_schedule', $clean_schedule_setting, "no" );
81
+
82
+ list( $year, $month, $day ) = explode( '-', preg_replace( "/[^0-9-]/", '', $_POST['aDBc_date'] ) );
83
+ list( $hours, $minutes ) = explode( ':', preg_replace( "/[^0-9:]/", '', $_POST['aDBc_time'] ) );
84
+
85
+ $seconds = "0";
86
+ $timestamp = mktime( $hours, $minutes, $seconds, $month, $day, $year );
87
 
88
  // Clear scheduled event
89
+ wp_clear_scheduled_hook( 'aDBc_clean_scheduler', array( $_POST['aDBc_schedule_name'] . '' ) );
90
+
91
+ if ( $_POST['aDBc_status'] == "1" ) {
92
 
93
+ if ( $_POST['aDBc_schedule_repeat'] == "once" ) {
94
+ wp_schedule_single_event( $timestamp, "aDBc_clean_scheduler", array( $_POST['aDBc_schedule_name'] ) );
95
+ } else {
96
+ wp_schedule_event( $timestamp, sanitize_html_class( $_POST['aDBc_schedule_repeat'] ), "aDBc_clean_scheduler", array( $_POST['aDBc_schedule_name'] ) );
 
97
  }
98
+
99
+ $this->aDBc_message = __( 'The clean-up schedule saved successfully!', 'advanced-database-cleaner' );
100
+
101
+ } else {
102
+ $this->aDBc_message = __( 'The clean-up schedule saved successfully but it is inactive!', 'advanced-database-cleaner' );
103
  }
104
+ } else {
105
  $this->aDBc_class_message = "error";
106
+ $this->aDBc_message = __( 'Please specify a valide time!', 'advanced-database-cleaner' );
107
  }
108
+ } else {
109
  $this->aDBc_class_message = "error";
110
+ $this->aDBc_message = __( 'Please specify a valide date!', 'advanced-database-cleaner' );
111
  }
112
+ } else {
113
  $this->aDBc_class_message = "error";
114
+ $this->aDBc_message = __( 'The name you have specified is already used by another schedule! Please change it!', 'advanced-database-cleaner' );
115
  }
116
+ } else {
117
  $this->aDBc_class_message = "error";
118
+ $this->aDBc_message = __( 'Please change the name! Only letters, numbers and underscores are allowed!', 'advanced-database-cleaner' );
119
  }
120
+ } else {
121
  $this->aDBc_class_message = "error";
122
+ $this->aDBc_message = __( 'Please give a name to your schedule!', 'advanced-database-cleaner' );
123
  }
124
+ } else {
125
  $this->aDBc_class_message = "error";
126
+ $this->aDBc_message = __( 'Please select at least one item to include in the schedule from the table below!', 'advanced-database-cleaner' );
127
  }
 
128
  }
 
 
129
 
130
  // Get all unused elements
131
  $aDBc_unused_elements = aDBc_return_array_all_elements_to_clean();
132
 
133
  // Get settings from DB
134
+ $settings = get_option( 'aDBc_settings' );
135
 
136
+ foreach ( $aDBc_unused_elements as $element_type => $element_name ) {
137
 
138
  // Get "keep_last" option. This option is added in ADBC version 3.0, so test if it is not empty before using it
139
+ if ( empty( $settings['keep_last'] ) ) {
140
+
141
  $keep_number = '0';
142
+
143
+ } else {
144
+
145
  $keep_setting = $settings['keep_last'];
146
+
147
+ if ( empty( $keep_setting[$element_type] ) ) {
148
  $keep_number = '0';
149
+ } else {
150
  $keep_number = $keep_setting[$element_type];
151
  }
152
  }
153
  // If the item can have keep_last, then prepare it, otherwise echo N/A
154
+ if ( $element_type == "revision" ||
155
+ $element_type == "auto-draft" ||
156
+ $element_type == "trash-posts" ||
157
+ $element_type == "moderated-comments" ||
158
+ $element_type == "spam-comments" ||
159
+ $element_type == "trash-comments" ||
160
+ $element_type == "pingbacks" ||
161
+ $element_type == "trackbacks") {
162
+
163
+ $keep_info = "<span>" . $keep_number . " " . __( 'days', 'advanced-database-cleaner' );
164
+
165
+ } else {
166
+
167
+ $keep_info = __( 'N/A', 'advanced-database-cleaner' );
168
+
169
  }
170
 
171
+ array_push( $this->aDBc_elements_to_display, array(
172
+ 'element_to_schedule' => "<a href='" . $element_name['URL_blog'] . "' target='_blank' class='aDBc-info-icon'>&nbsp;</a>" . $element_name['name'],
173
+ 'keep' => $keep_info,
174
+ 'type' => $element_type
175
  )
176
  );
177
  }
178
+
179
  // Call WP prepare_items function
180
  $this->prepare_items();
181
  }
182
 
183
  /** WP: Get columns */
184
+ function get_columns() {
185
 
186
  $aDBc_keep_last_toolip = "<span class='aDBc-tooltips-headers'>
187
  <img class='aDBc-info-image' src='". ADBC_PLUGIN_DIR_PATH . '/images/information2.svg' . "'/>
188
+ <span>" . __( 'Only data that is older than the number you have specified will be cleaned based on you schedule parameters. To change this value, click on "go back" button.', 'advanced-database-cleaner' ) ." </span>
189
+ </span>";
190
 
191
  $columns = array(
192
  'cb' => '<input type="checkbox" />',
193
+ 'element_to_schedule' => __( 'Elements to include in the schedule', 'advanced-database-cleaner' ),
194
+ 'keep' => __( 'Keep last', 'advanced-database-cleaner' ) . $aDBc_keep_last_toolip,
195
  'type' => 'Type'
196
  );
197
+
198
  return $columns;
199
  }
200
 
201
  /** WP: Prepare items to display */
202
  function prepare_items() {
203
+
204
+ $columns = $this->get_columns();
205
+ $hidden = $this->get_hidden_columns();
206
+ $sortable = array();
207
+ $this->_column_headers = array( $columns, $hidden, $sortable );
208
+ $per_page = 50;
209
+ $current_page = $this->get_pagenum();
210
+
211
  // Prepare sequence of elements to display
212
+ $display_data = array_slice( $this->aDBc_elements_to_display, ( ( $current_page-1 ) * $per_page ), $per_page );
213
+
214
  $this->set_pagination_args( array(
215
+ 'total_items' => count( $this->aDBc_elements_to_display ),
216
  'per_page' => $per_page
217
  ));
218
+
219
  $this->items = $display_data;
220
  }
221
 
222
  /** WP: Get columns that should be hidden */
223
+ function get_hidden_columns() {
224
+
225
+ return array( 'type' );
226
+
227
+ }
228
 
229
  /** WP: Column default */
230
+ function column_default( $item, $column_name ) {
231
+
232
+ switch ( $column_name ) {
233
+
234
  case 'element_to_schedule':
235
  case 'keep':
236
  case 'type':
237
  return $item[$column_name];
238
  default:
239
+ return print_r( $item, true ) ; //Show the whole array for troubleshooting purposes
240
+
241
  }
242
  }
243
 
244
  /** WP: Column cb for check box */
245
+ function column_cb( $item ) {
246
+
247
  $checked = "";
248
 
249
+ if ( isset( $_POST['aDBc_schedule_name'] ) && ! empty( $_POST['aDBc_elements_to_process'] ) ) {
250
+
251
+ if ( in_array( $item['type'], $_POST['aDBc_elements_to_process'] ) ) {
252
  $checked = "checked";
253
  }
254
+
255
+ } else {
256
 
257
  $schedule_settings = get_option('aDBc_clean_schedule');
258
  $schedule_params = $schedule_settings[sanitize_html_class($_GET['hook_name'])];
259
  $schedule_elements_to_clean = $schedule_params['elements_to_clean'];
260
  $schedule_elements_to_clean = is_array($schedule_elements_to_clean) ? $schedule_elements_to_clean : array();
261
 
262
+ if ( in_array($item['type'], $schedule_elements_to_clean ) ) {
263
  $checked = "checked";
264
  }
265
  }
266
 
267
+ return sprintf( '<input type="checkbox" name="aDBc_elements_to_process[]" value="%s"' . $checked . '/>', $item['type'] );
268
  }
269
 
270
  /** WP: Get bulk actions */
271
  function get_bulk_actions() {
272
+
273
  return array();
274
+
275
  }
276
 
277
  /** WP: Message to display when no items found */
278
  function no_items() {
279
+
280
+ _e( 'Your database is clean!', 'advanced-database-cleaner' );
281
+
282
  }
283
 
284
 
285
  /** Print the page content */
286
+ function aDBc_print_page_content() {
287
+
288
  // Print a message if any
289
+ if ( $this->aDBc_message != "" ) {
290
+
291
  echo '<div id="aDBc_message" class="' . $this->aDBc_class_message . ' notice is-dismissible"><p>' . $this->aDBc_message . '</p></div>';
292
+
293
  }
294
  ?>
 
295
 
296
+ <div style="max-width:700px">
297
+
298
+ <div class="aDBc-float-left aDBc-margin-t-10">
299
+
300
+ <a href="?page=advanced_db_cleaner&aDBc_tab=general" style="text-decoration:none">
301
+
302
+ <span class="dashicons dashicons-controls-back aDBc-back-dashicon"></span>
303
+
304
+ <span style="vertical-align:middle"><?php echo __( 'Return', 'advanced-database-cleaner' ); ?></span>
305
+
306
+ </a>
307
+
308
+ </div>
309
+
310
+ <div class="aDBc-schedule-title">
311
+
312
+ <span class="dashicons dashicons-edit aDBc-schedule-dashicon"></span>
313
+
314
+ <?php echo __( 'Edit cleanup schedule', 'advanced-database-cleaner' ); ?>
315
+
316
  </div>
317
 
318
  <div class="aDBc-clear-both"></div>
319
+
320
+ <form id="aDBc_form" action="" method="post">
321
+
322
+ <!-- Print the elements to clean -->
323
+ <div class="aDBc-schedule-table-elements">
324
+
325
+ <?php $this->display(); ?>
326
+
327
+ </div>
328
+
329
  <?php
330
+ // Prepare info of the original schedule to fill it into inputs...
331
+
332
+ if ( isset( $_POST['aDBc_schedule_name'] ) ) {
333
+
334
+ $hook_name = sanitize_html_class( $_POST['aDBc_schedule_name'] );
335
+ $schedule_repeat = sanitize_html_class( $_POST['aDBc_schedule_repeat'] );
336
+ $schedule_date = preg_replace( "/[^0-9-]/", '', $_POST['aDBc_date'] );
337
+ $schedule_time = preg_replace( "/[^0-9:]/", '', $_POST['aDBc_time'] );
338
+ $schedule_status = sanitize_html_class( $_POST['aDBc_status'] );
339
+
340
+ } else {
341
 
342
+ $schedule_settings = get_option( 'aDBc_clean_schedule' );
343
+ $schedule_params = $schedule_settings[sanitize_html_class( $_GET['hook_name'] )];
344
 
345
+ $hook_name = sanitize_html_class( $_GET['hook_name'] );
346
+ $schedule_repeat = $schedule_params['repeat'];
347
+ $timestamp = wp_next_scheduled( "aDBc_clean_scheduler", array( sanitize_html_class( $_GET['hook_name'] ) . '' ) );
348
 
349
+ if ( $timestamp ) {
 
 
 
 
350
 
351
+ $schedule_date = date( "Y-m-d", $timestamp );
352
+ $schedule_time = date( "H:i", $timestamp );
353
 
354
+ } else {
 
355
 
356
+ $schedule_date = date( "Y-m-d" );
357
+ $schedule_time = date( "H:i", time() );
358
+
359
+ }
360
+
361
+ $schedule_status = $schedule_params['active'];
 
 
 
362
  }
363
+ ?>
364
+
365
+ <div class="aDBc-right-box">
366
 
367
+ <div class="aDBc-right-box-content">
368
 
369
+ <div style="text-align:center">
370
+ <img width="60px" src="<?php echo ADBC_PLUGIN_DIR_PATH . '/images/alarm-clock.svg' ?>"/>
371
+ </div>
372
+
373
+ <div id="add_schedule" class="aDBc-schedule-info-container">
374
 
375
+ <div class="aDBc-margin-t-10"></div>
376
 
377
+ <div><?php _e( 'Schedule name', 'advanced-database-cleaner' ); ?></div>
 
378
 
379
+ <input class="aDBc-schedule-input-field" type="text" value="<?php echo $hook_name; ?>" maxlength="25" disabled>
 
380
 
 
 
381
  <input type="hidden" name="aDBc_schedule_name" value="<?php echo $hook_name; ?>" maxlength="25">
382
+
383
+ <div><?php _e( 'Frequency of execution', 'advanced-database-cleaner' ); ?></div>
384
+
385
+ <select name="aDBc_schedule_repeat" class="aDBc-schedule-input-field">
386
+
387
+ <?php
388
+ $schedules_repeat = array( 'once' => __( 'Once', 'advanced-database-cleaner' ),
389
+ 'hourly' => __( 'Hourly', 'advanced-database-cleaner' ),
390
+ 'twicedaily' => __( 'Twice a day', 'advanced-database-cleaner' ),
391
+ 'daily' => __( 'Daily', 'advanced-database-cleaner' ),
392
+ 'weekly' => __( 'Weekly', 'advanced-database-cleaner' ),
393
+ 'monthly' => __( 'Monthly', 'advanced-database-cleaner' )
394
+ );
395
+
396
+ foreach ( $schedules_repeat as $code_repeat => $name_repeat ) {
397
+
398
+ if ( $code_repeat == $schedule_repeat ) {
399
  echo "<option value='$code_repeat' selected='selected'>$name_repeat</option>";
400
+ } else {
401
  echo "<option value='$code_repeat'>$name_repeat</option>";
402
  }
403
+
404
  }
405
+ ?>
406
+
407
  </select>
408
 
409
+ <div><?php _e( 'Start date', 'advanced-database-cleaner' ); ?></div>
410
+
411
+ <input name="aDBc_date" class="aDBc-schedule-input-field" type="date" value="<?php echo $schedule_date; ?>" min="<?php echo date( "Y-m-d" ); ?>">
412
+
413
+ <div><?php _e( 'Start time (GMT)', 'advanced-database-cleaner' ); ?></div>
414
+
415
+ <input name="aDBc_time" class="aDBc-schedule-input-field" type="time" value="<?php echo $schedule_time; ?>">
416
 
417
+ <div><?php _e( 'Schedule status', 'advanced-database-cleaner' ); ?></div>
 
418
 
419
+ <div class="aDBc-schedule-radio-container">
420
 
421
+ <input name="aDBc_status" type="radio" value="1" checked>
422
+
423
+ <span style="margin-right:20px"><?php _e( 'Active', 'advanced-database-cleaner' ); ?></span>
424
+
425
+ <input name="aDBc_status" type="radio" value="0" <?php echo $schedule_status == "0" ? 'checked' : ''; ?>>
426
+
427
+ <?php _e( 'Inactive', 'advanced-database-cleaner' ); ?>
428
 
 
 
429
  </div>
430
 
431
+ <div class="aDBc-schedule-save-btn-div">
432
+
433
+ <input class="button-primary" type="submit" value="<?php _e( 'Save the schedule', 'advanced-database-cleaner' ); ?>" style="width:100%"/>
434
+
435
  </div>
436
 
437
  </div>
438
+ </div>
439
  </div>
 
440
 
441
+ <?php wp_nonce_field( 'edit_cleanup_schedule_nonce', 'edit_cleanup_schedule_nonce' ); ?>
442
 
443
+ </form>
444
  <div class="aDBc-clear-both"></div>
445
  </div>
446
 
includes/custom-schedule-view/class_edit_optimize_schedule.php CHANGED
@@ -1,245 +1,308 @@
1
  <?php
 
 
 
2
  class EDIT_SCHEDULE_OPTIMIZE extends WP_List_Table {
3
 
4
- private $aDBc_message = "";
5
  private $aDBc_class_message = "updated";
6
 
7
  /**
8
  * Constructor
9
  */
10
- function __construct(){
11
 
12
  $this->aDBc_prepare_elements_to_clean();
13
  $this->aDBc_print_page_content();
14
  }
15
 
16
  /** Prepare elements to display */
17
- function aDBc_prepare_elements_to_clean(){
18
 
19
  // Test if user wants to save the edited scheduled task
20
- if(isset($_POST['aDBc_schedule_name'])){
21
 
22
  //Quick nonce security check!
23
- if(!check_admin_referer('edit_optimize_schedule_nonce', 'edit_optimize_schedule_nonce'))
24
  return; //get out if we didn't click the save_schedule button
25
 
26
- if(!empty(trim($_POST['aDBc_schedule_name']))){
27
- if(preg_match('/^[a-zA-Z0-9_]+$/',$_POST['aDBc_schedule_name'])){
 
 
 
28
 
29
  // Test if the name is used by other schedules.
30
- $clean_schedule_setting = get_option('aDBc_clean_schedule');
31
- $clean_schedule_setting = is_array($clean_schedule_setting) ? $clean_schedule_setting : array();
 
 
 
32
 
33
- $optimize_schedule_setting = get_option('aDBc_optimize_schedule');
34
- $optimize_schedule_setting = is_array($optimize_schedule_setting) ? $optimize_schedule_setting : array();
 
 
 
35
 
36
- if($_POST['aDBc_schedule_name'] == $_GET['hook_name'] ||
37
- ($_POST['aDBc_schedule_name'] != $_GET['hook_name'] &&
38
- !array_key_exists($_POST['aDBc_schedule_name'], $clean_schedule_setting) &&
39
- !array_key_exists($_POST['aDBc_schedule_name'], $optimize_schedule_setting))){
40
 
41
- if(!empty($_POST['aDBc_date'])){
42
- if(!empty($_POST['aDBc_time'])){
43
 
44
- if(!empty($_POST['aDBc_operation1']) || !empty($_POST['aDBc_operation2'])){
45
 
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
 
70
  // Clear scheduled event
71
- wp_clear_scheduled_hook('aDBc_optimize_scheduler', array($_POST['aDBc_schedule_name'].''));
 
 
72
 
73
- if($_POST['aDBc_status'] == "1"){
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');
86
  }
87
- }else{
88
  $this->aDBc_class_message = "error";
89
- $this->aDBc_message = __('Please specify a valide time!', 'advanced-database-cleaner');
90
  }
91
- }else{
92
  $this->aDBc_class_message = "error";
93
- $this->aDBc_message = __('Please specify a valide date!', 'advanced-database-cleaner');
94
  }
95
- }else{
96
  $this->aDBc_class_message = "error";
97
- $this->aDBc_message = __('The name you have specified is already used by another schedule! Please change it!', 'advanced-database-cleaner');
98
  }
99
- }else{
100
  $this->aDBc_class_message = "error";
101
- $this->aDBc_message = __('Please change the name! Only letters, numbers and underscores are allowed!', 'advanced-database-cleaner');
102
  }
103
- }else{
104
  $this->aDBc_class_message = "error";
105
- $this->aDBc_message = __('Please give a name to your schedule!', 'advanced-database-cleaner');
106
  }
107
  }
108
  }
109
 
110
  /** Print the page content */
111
- function aDBc_print_page_content(){
 
112
  // Print a message if any
113
- if($this->aDBc_message != ""){
 
114
  echo '<div id="aDBc_message" class="' . $this->aDBc_class_message . ' notice is-dismissible"><p>' . $this->aDBc_message . '</p></div>';
 
115
  }
116
  ?>
117
- <div style="width:636px">
118
-
119
- <div>
120
- <div class="aDBc-float-left aDBc-margin-t-10">
121
- <a href="?page=advanced_db_cleaner&aDBc_tab=tables&aDBc_cat=all">
122
- <img width="40px" src="<?php echo ADBC_PLUGIN_DIR_PATH . '/images/go_back.svg'?>"/>
123
- </a>
124
- </div>
125
- <div class="aDBc-float-right" style="border:1px solid #f0f0f0;box-shadow:0 0 10px #eee;border-radius:5px;text-align:center;width:190px;background:#fff;padding:10px;font-size:16px;margin-top: 15px;margin-bottom: 25px;color: #0992CC;">
126
- <img style="margin-right:10px" width="15px" src="<?php echo ADBC_PLUGIN_DIR_PATH . '/images/edit_schedule.svg'?>"/>
127
- <?php echo __('Edit cleanup schedule','advanced-database-cleaner') ; ?>
128
- </div>
 
129
  </div>
130
-
131
- <div class="aDBc-clear-both"></div>
132
- <form id="aDBc_form" action="" method="post">
133
- <div style="float:left;width:400px;margin-right: 25px;background:#f0f5fa;margin-top:49px;padding-top:50px;height:100px;text-align:center;border-radius:4px;border:1px solid #eee">
134
- <?php echo __('By default, all your database tables will be optimized (if needed) according to your schedule settings','advanced-database-cleaner') ; ?>
 
 
135
  </div>
136
 
137
- <?php
138
- // Prepare info of the original schedule to fill it into inputs...
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' : '';
167
- $operation2 = in_array('repair', $schedule_params['operations']) ? 'repair' : '';
168
 
169
- $schedule_status = $schedule_params['active'];
170
- }
171
-
172
- ?>
173
-
174
- <div class="aDBc-right-box">
 
175
 
176
- <div style="text-align:center">
177
 
178
- <img width="60px" src="<?php echo ADBC_PLUGIN_DIR_PATH . '/images/alarm-clock.svg'?>"/>
179
- <br/><br/>
 
180
 
181
- <div id="add_schedule" style="border-top:1px dashed #ccc">
182
- <br/>
183
- <div style="text-align:left"><?php _e('Schedule name','advanced-database-cleaner');?></div>
184
- <input style="width:100%;margin-bottom:10px;height:30px;border-radius:5px;box-shadow:0 0 10px #e0e0e0;background-color: #ccc !important;color: #000 !important;" type="text" name="aDBc_schedule_name_x" placeholder="Schedule name" value="<?php echo $hook_name; ?>" maxlength="25" disabled>
185
  <input type="hidden" name="aDBc_schedule_name" value="<?php echo $hook_name; ?>" maxlength="25">
186
-
187
- <div style="text-align:left"><?php _e('Frequency of execution','advanced-database-cleaner');?></div>
188
- <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">
189
- <?php
190
- $schedules_repeat = array('once' => __('Once','advanced-database-cleaner'),
191
- 'hourly' => __('Hourly','advanced-database-cleaner'),
192
- 'twicedaily' => __('Twice a day','advanced-database-cleaner'),
193
- 'daily' => __('Daily','advanced-database-cleaner'),
194
- 'weekly' => __('Weekly','advanced-database-cleaner'),
195
- 'monthly' => __('Monthly','advanced-database-cleaner'));
196
-
197
- foreach($schedules_repeat as $code_repeat => $name_repeat){
198
- if($code_repeat == $schedule_repeat){
 
 
 
 
199
  echo "<option value='$code_repeat' selected='selected'>$name_repeat</option>";
200
- }else{
201
  echo "<option value='$code_repeat'>$name_repeat</option>";
202
  }
 
203
  }
204
- ?>
 
205
  </select>
206
 
207
- <div style="text-align:left"><?php _e('Start date','advanced-database-cleaner');?></div>
208
- <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 $schedule_date; ?>" min="<?php echo date("Y-m-d"); ?>">
 
 
 
 
 
 
 
 
 
 
 
 
 
209
 
210
- <div style="text-align:left"><?php _e('Start time (GMT)','advanced-database-cleaner');?></div>
211
- <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 $schedule_time; ?>">
 
212
 
213
- <div style="text-align:left"><?php _e('Perform operations','advanced-database-cleaner');?></div>
214
- <div style="margin-bottom:10px;margin-top:2px;text-align:left;background:#fff;padding:5px;box-shadow:0 0 10px #e0e0e0;border-radius:5px">
215
- <input type="checkbox" name="aDBc_operation1" value="optimize" <?php echo $operation1 == "optimize" ? 'checked' : ''; ?>>
216
- <span style="margin-right:20px"><?php _e('Optimize','advanced-database-cleaner');?></span>
217
-
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>
227
-
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
 
240
- <?php wp_nonce_field('edit_optimize_schedule_nonce', 'edit_optimize_schedule_nonce'); ?>
241
 
242
- </form>
243
  <div class="aDBc-clear-both"></div>
244
  </div>
245
 
1
  <?php
2
+
3
+ // style et code ok
4
+
5
  class EDIT_SCHEDULE_OPTIMIZE extends WP_List_Table {
6
 
7
+ private $aDBc_message = "";
8
  private $aDBc_class_message = "updated";
9
 
10
  /**
11
  * Constructor
12
  */
13
+ function __construct() {
14
 
15
  $this->aDBc_prepare_elements_to_clean();
16
  $this->aDBc_print_page_content();
17
  }
18
 
19
  /** Prepare elements to display */
20
+ function aDBc_prepare_elements_to_clean() {
21
 
22
  // Test if user wants to save the edited scheduled task
23
+ if ( isset( $_POST['aDBc_schedule_name'] ) ) {
24
 
25
  //Quick nonce security check!
26
+ if ( ! check_admin_referer( 'edit_optimize_schedule_nonce', 'edit_optimize_schedule_nonce' ) )
27
  return; //get out if we didn't click the save_schedule button
28
 
29
+ $trim_schedule_name = trim( $_POST['aDBc_schedule_name'] );
30
+
31
+ if ( ! empty( $trim_schedule_name ) ) {
32
+
33
+ if ( preg_match( '/^[a-zA-Z0-9_]+$/', $_POST['aDBc_schedule_name'] ) ) {
34
 
35
  // Test if the name is used by other schedules.
36
+ $clean_schedule_setting = get_option( 'aDBc_clean_schedule' );
37
+ $clean_schedule_setting = is_array( $clean_schedule_setting ) ? $clean_schedule_setting : array();
38
+
39
+ $optimize_schedule_setting = get_option( 'aDBc_optimize_schedule' );
40
+ $optimize_schedule_setting = is_array( $optimize_schedule_setting ) ? $optimize_schedule_setting : array();
41
 
42
+ if ( $_POST['aDBc_schedule_name'] == $_GET['hook_name'] ||
43
+ ( $_POST['aDBc_schedule_name'] != $_GET['hook_name'] &&
44
+ ! array_key_exists( $_POST['aDBc_schedule_name'], $clean_schedule_setting ) &&
45
+ ! array_key_exists( $_POST['aDBc_schedule_name'], $optimize_schedule_setting ) )
46
+ ) {
47
 
48
+ if ( ! empty( $_POST['aDBc_date'] ) ) {
 
 
 
49
 
50
+ if ( ! empty( $_POST['aDBc_time'] ) ) {
 
51
 
52
+ if ( ! empty( $_POST['aDBc_operation1'] ) || ! empty( $_POST['aDBc_operation2'] ) ) {
53
 
54
  // Delete the old schedule and replace it with the new
55
 
56
  // We will create the new schedule
57
+ $new_schedule_params['repeat'] = sanitize_html_class( $_POST['aDBc_schedule_repeat'] );
58
+ $new_schedule_params['start_date'] = preg_replace( "/[^0-9-]/", '', $_POST['aDBc_date'] );
59
+ $new_schedule_params['start_time'] = preg_replace( "/[^0-9:]/", '', $_POST['aDBc_time'] );
60
 
61
  // Prepare operations to perform
62
  $operations = array();
 
 
 
 
 
63
 
64
+ if ( ! empty( $_POST['aDBc_operation1'] ) )
65
+
66
+ array_push( $operations, sanitize_html_class( $_POST['aDBc_operation1'] ) );
67
+
68
+ if ( ! empty( $_POST['aDBc_operation2'] ) )
69
+
70
+ array_push( $operations, sanitize_html_class( $_POST['aDBc_operation2'] ) );
71
+
72
+ $new_schedule_params['operations'] = $operations;
73
+ $new_schedule_params['active'] = sanitize_html_class( $_POST['aDBc_status'] );
74
+
75
  $optimize_schedule_setting[$_POST['aDBc_schedule_name']] = $new_schedule_params;
 
76
 
77
+ update_option( 'aDBc_optimize_schedule', $optimize_schedule_setting, "no" );
78
+
79
+ list( $year, $month, $day ) = explode( '-', preg_replace( "/[^0-9-]/", '', $_POST['aDBc_date'] ) );
80
+ list( $hours, $minutes ) = explode( ':', preg_replace( "/[^0-9:]/", '', $_POST['aDBc_time'] ) );
81
+
82
  $seconds = "0";
83
+ $timestamp = mktime( $hours, $minutes, $seconds, $month, $day, $year );
84
 
85
  // Clear scheduled event
86
+ wp_clear_scheduled_hook( 'aDBc_optimize_scheduler', array( $_POST['aDBc_schedule_name'] . '') );
87
+
88
+ if ( $_POST['aDBc_status'] == "1" ) {
89
 
90
+ if ( $_POST['aDBc_schedule_repeat'] == "once" ) {
91
+ wp_schedule_single_event( $timestamp, "aDBc_optimize_scheduler", array( $_POST['aDBc_schedule_name'] ) );
92
+ } else {
93
+ wp_schedule_event( $timestamp, sanitize_html_class( $_POST['aDBc_schedule_repeat'] ), "aDBc_optimize_scheduler", array( $_POST['aDBc_schedule_name'] ) );
 
94
  }
95
+
96
+ $this->aDBc_message = __( 'The clean-up schedule saved successfully!', 'advanced-database-cleaner' );
97
+
98
+ } else {
99
+ $this->aDBc_message = __( 'The clean-up schedule saved successfully but it is inactive!', 'advanced-database-cleaner' );
100
  }
101
+ } else {
102
  $this->aDBc_class_message = "error";
103
+ $this->aDBc_message = __( 'Please choose at least one operation to perform!', 'advanced-database-cleaner' );
104
  }
105
+ } else {
106
  $this->aDBc_class_message = "error";
107
+ $this->aDBc_message = __( 'Please specify a valide time!', 'advanced-database-cleaner' );
108
  }
109
+ } else {
110
  $this->aDBc_class_message = "error";
111
+ $this->aDBc_message = __( 'Please specify a valide date!', 'advanced-database-cleaner' );
112
  }
113
+ } else {
114
  $this->aDBc_class_message = "error";
115
+ $this->aDBc_message = __( 'The name you have specified is already used by another schedule! Please change it!', 'advanced-database-cleaner' );
116
  }
117
+ } else {
118
  $this->aDBc_class_message = "error";
119
+ $this->aDBc_message = __( 'Please change the name! Only letters, numbers and underscores are allowed!', 'advanced-database-cleaner' );
120
  }
121
+ } else {
122
  $this->aDBc_class_message = "error";
123
+ $this->aDBc_message = __( 'Please give a name to your schedule!', 'advanced-database-cleaner' );
124
  }
125
  }
126
  }
127
 
128
  /** Print the page content */
129
+ function aDBc_print_page_content() {
130
+
131
  // Print a message if any
132
+ if ( $this->aDBc_message != "" ) {
133
+
134
  echo '<div id="aDBc_message" class="' . $this->aDBc_class_message . ' notice is-dismissible"><p>' . $this->aDBc_message . '</p></div>';
135
+
136
  }
137
  ?>
138
+
139
+ <div style="max-width:700px">
140
+
141
+ <div class="aDBc-float-left aDBc-margin-t-10">
142
+
143
+ <a href="?page=advanced_db_cleaner&aDBc_tab=tables&aDBc_cat=all" style="text-decoration:none">
144
+
145
+ <span class="dashicons dashicons-controls-back aDBc-back-dashicon"></span>
146
+
147
+ <span style="vertical-align:middle"><?php echo __( 'Return', 'advanced-database-cleaner' ); ?></span>
148
+
149
+ </a>
150
+
151
  </div>
152
+
153
+ <div class="aDBc-schedule-title">
154
+
155
+ <span class="dashicons dashicons-plus aDBc-schedule-dashicon"></span>
156
+
157
+ <?php echo __( 'Edit cleanup schedule', 'advanced-database-cleaner' ); ?>
158
+
159
  </div>
160
 
161
+ <div class="aDBc-clear-both"></div>
162
+
163
+ <form id="aDBc_form" action="" method="post">
164
+
165
+ <!-- Print box info for tables that will be optimized -->
166
+ <div class="aDBc-schedule-table-elements aDBc-schedule-tables-box-info">
167
+ <div style="padding:40px 20px">
168
+ <?php echo __( 'By default, all your database tables will be optimized and/or repaired (if needed) according to your schedule settings', 'advanced-database-cleaner' ); ?>
169
+ </div>
170
+ </div>
171
+
172
+ <?php
173
+ // Prepare info of the original schedule to fill it into inputs...
174
+
175
+ if ( isset( $_POST['aDBc_schedule_name'] ) ) {
176
+
177
+ $hook_name = sanitize_html_class( $_POST['aDBc_schedule_name'] );
178
+ $schedule_repeat = sanitize_html_class( $_POST['aDBc_schedule_repeat'] );
179
+ $schedule_date = preg_replace( "/[^0-9-]/", '', $_POST['aDBc_date'] );
180
+ $schedule_time = preg_replace( "/[^0-9:]/", '', $_POST['aDBc_time'] );
181
+ $operation1 = isset( $_POST['aDBc_operation1'] ) ? sanitize_html_class( $_POST['aDBc_operation1'] ) : "";
182
+ $operation2 = isset( $_POST['aDBc_operation2'] ) ? sanitize_html_class( $_POST['aDBc_operation2'] ) : "";
183
+ $schedule_status = sanitize_html_class( $_POST['aDBc_status'] );
184
+
185
+ } else {
186
+
187
+ $schedule_settings = get_option( 'aDBc_optimize_schedule' );
188
+ $schedule_params = $schedule_settings[sanitize_html_class( $_GET['hook_name'] )];
189
+
190
+ $hook_name = sanitize_html_class( $_GET['hook_name'] );
191
+ $schedule_repeat = $schedule_params['repeat'];
192
+ $timestamp = wp_next_scheduled( "aDBc_optimize_scheduler", array( sanitize_html_class( $_GET['hook_name'] ) . '' ) );
193
+
194
+ if ( $timestamp ) {
195
+
196
+ $schedule_date = date( "Y-m-d", $timestamp );
197
+ $schedule_time = date( "H:i", $timestamp );
198
+
199
+ } else {
200
+
201
+ $schedule_date = date( "Y-m-d" );
202
+ $schedule_time = date( "H:i", time() );
203
+
204
+ }
205
+
206
+ $operation1 = in_array( 'optimize', $schedule_params['operations'] ) ? 'optimize' : '';
207
+ $operation2 = in_array( 'repair', $schedule_params['operations'] ) ? 'repair' : '';
208
+
209
+ $schedule_status = $schedule_params['active'];
210
  }
211
+ ?>
212
 
213
+ <div class="aDBc-right-box">
 
214
 
215
+ <div class="aDBc-right-box-content">
216
+
217
+ <div style="text-align:center">
218
+ <img width="60px" src="<?php echo ADBC_PLUGIN_DIR_PATH . '/images/alarm-clock.svg' ?>"/>
219
+ </div>
220
+
221
+ <div id="add_schedule" class="aDBc-schedule-info-container">
222
 
223
+ <div class="aDBc-margin-t-10"></div>
224
 
225
+ <div><?php _e( 'Schedule name', 'advanced-database-cleaner' ); ?></div>
226
+
227
+ <input class="aDBc-schedule-input-field" type="text" value="<?php echo $hook_name; ?>" maxlength="25" disabled>
228
 
 
 
 
 
229
  <input type="hidden" name="aDBc_schedule_name" value="<?php echo $hook_name; ?>" maxlength="25">
230
+
231
+ <div><?php _e( 'Frequency of execution', 'advanced-database-cleaner' ); ?></div>
232
+
233
+ <select name="aDBc_schedule_repeat" class="aDBc-schedule-input-field">
234
+
235
+ <?php
236
+ $schedules_repeat = array( 'once' => __( 'Once', 'advanced-database-cleaner' ),
237
+ 'hourly' => __( 'Hourly', 'advanced-database-cleaner' ),
238
+ 'twicedaily' => __( 'Twice a day', 'advanced-database-cleaner' ),
239
+ 'daily' => __( 'Daily', 'advanced-database-cleaner' ),
240
+ 'weekly' => __( 'Weekly', 'advanced-database-cleaner' ),
241
+ 'monthly' => __( 'Monthly', 'advanced-database-cleaner' )
242
+ );
243
+
244
+ foreach ( $schedules_repeat as $code_repeat => $name_repeat ) {
245
+
246
+ if ( $code_repeat == $schedule_repeat ) {
247
  echo "<option value='$code_repeat' selected='selected'>$name_repeat</option>";
248
+ } else {
249
  echo "<option value='$code_repeat'>$name_repeat</option>";
250
  }
251
+
252
  }
253
+ ?>
254
+
255
  </select>
256
 
257
+ <div><?php _e( 'Start date', 'advanced-database-cleaner' ); ?></div>
258
+
259
+ <input name="aDBc_date" class="aDBc-schedule-input-field" type="date" value="<?php echo $schedule_date; ?>" min="<?php echo date( "Y-m-d" ); ?>">
260
+
261
+ <div><?php _e( 'Start time (GMT)', 'advanced-database-cleaner' ); ?></div>
262
+
263
+ <input name="aDBc_time" class="aDBc-schedule-input-field" type="time" value="<?php echo $schedule_time; ?>">
264
+
265
+ <div><?php _e( 'Perform operations', 'advanced-database-cleaner' ); ?></div>
266
+
267
+ <div class="aDBc-schedule-radio-container">
268
+
269
+ <input name="aDBc_operation1" type="checkbox" value="optimize" <?php echo $operation1 == "optimize" ? 'checked' : ''; ?>>
270
+
271
+ <span style="margin-right:20px"><?php _e( 'Optimize', 'advanced-database-cleaner' ); ?></span>
272
 
273
+ <input name="aDBc_operation2" type="checkbox" value="repair" <?php echo $operation2 == "repair" ? 'checked' : ''; ?>>
274
+
275
+ <?php _e( 'Repair', 'advanced-database-cleaner' ); ?>
276
 
 
 
 
 
 
 
 
277
  </div>
278
 
279
+ <div><?php _e( 'Schedule status', 'advanced-database-cleaner' ); ?></div>
280
+
281
+ <div class="aDBc-schedule-radio-container">
282
+
283
+ <input name="aDBc_status" type="radio" value="1" checked>
284
+
285
+ <span style="margin-right:20px"><?php _e( 'Active', 'advanced-database-cleaner' ); ?></span>
286
+
287
+ <input name="aDBc_status" type="radio" value="0" <?php echo $schedule_status == "0" ? 'checked' : ''; ?>>
288
+
289
+ <?php _e( 'Inactive', 'advanced-database-cleaner' ); ?>
290
 
 
 
 
 
 
 
291
  </div>
292
 
293
+ <div class="aDBc-schedule-save-btn-div">
294
+
295
+ <input class="button-primary" type="submit" value="<?php _e( 'Save the schedule', 'advanced-database-cleaner' ); ?>" style="width:100%"/>
296
+
297
  </div>
298
 
299
  </div>
300
+ </div>
301
  </div>
 
302
 
303
+ <?php wp_nonce_field( 'edit_optimize_schedule_nonce', 'edit_optimize_schedule_nonce' ); ?>
304
 
305
+ </form>
306
  <div class="aDBc-clear-both"></div>
307
  </div>
308
 
includes/edit_item_categorization.php ADDED
@@ -0,0 +1,132 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ <!-- style et code ok -->
3
+
4
+ <div style="max-width:700px">
5
+
6
+ <form id="aDBc_form" action="" method="post">
7
+
8
+ <div class="aDBc-edit-correction-title">
9
+
10
+ <?php echo __( 'Manual correction of the categorization', 'advanced-database-cleaner' ); ?>
11
+
12
+ </div>
13
+
14
+ <?php
15
+
16
+ // Get the current tab
17
+ $item_type = $_GET['aDBc_tab'];
18
+
19
+ // We change the cron tab name to tasks. No problem with tables and options
20
+ if ( $item_type == "cron" ) {
21
+
22
+ $item_type = "tasks";
23
+
24
+ }
25
+
26
+ // Open the file in which the items to edit have been saved
27
+ $path_items = @fopen( ADBC_UPLOAD_DIR_PATH_TO_ADBC . "/" . $item_type . "_manually_correction_temp.txt", "r" );
28
+
29
+ if ( $path_items ) {
30
+
31
+ echo "<div style='margin-top:30px'>";
32
+ $items_to_correct_array = array();
33
+
34
+ while ( ( $item = fgets( $path_items ) ) !== false ) {
35
+
36
+ $item = trim( $item );
37
+
38
+ if ( ! empty( $item ) ) {
39
+
40
+ array_push( $items_to_correct_array, $item );
41
+ echo "<span class='aDBc-correction-item'>" . $item . "</span>";
42
+
43
+ }
44
+ }
45
+
46
+ echo "</div>";
47
+ fclose( $path_items );
48
+ }
49
+ ?>
50
+
51
+ <div class="aDBc-clear-both"></div>
52
+
53
+ <div class="aDBc-correction-new-wrapper">
54
+
55
+ <div>
56
+
57
+ <?php
58
+ if ( $item_type == "tables" ) {
59
+
60
+ echo __( 'The tables above belong to:', 'advanced-database-cleaner' );
61
+
62
+ } elseif ( $item_type == "options" ) {
63
+
64
+ echo __( 'The options above belong to:', 'advanced-database-cleaner' );
65
+
66
+ } elseif ( $item_type == "tasks" ) {
67
+
68
+ echo __( 'The cron tasks above belong to:', 'advanced-database-cleaner' );
69
+
70
+ }
71
+ ?>
72
+
73
+ </div>
74
+
75
+ <?php
76
+ $plugins_folders_names = aDBc_get_plugins_folder_names();
77
+ $themes_folders_names = aDBc_get_themes_folder_names();
78
+ ?>
79
+
80
+ <select name="new_belongs_to" class="aDBc-correction-belongs-to">
81
+
82
+ <optgroup label="<?php echo __( 'Plugins', 'advanced-database-cleaner' ); ?>">
83
+
84
+ <?php
85
+ foreach ( $plugins_folders_names as $plugin ) {
86
+ echo "<option value='$plugin|p'>" . $plugin . "</option>";
87
+ }
88
+ ?>
89
+
90
+ </optgroup>
91
+
92
+ <optgroup label="<?php echo __( 'Themes', 'advanced-database-cleaner' ); ?>">
93
+
94
+ <?php
95
+ foreach ( $themes_folders_names as $theme ) {
96
+ echo "<option value='$theme|t'>" . $theme . "</option>";
97
+ }
98
+ ?>
99
+
100
+ </optgroup>
101
+
102
+ </select>
103
+
104
+ </div>
105
+
106
+ <!--<div style="margin-top:15px">
107
+ <div>
108
+ <input type="checkbox" name="aDBc_send_correction_to_server"/>
109
+ <span id="send_manual_correction_to_server">
110
+ <?php //_e("Send this correction to the plugin server? (by sending this correction, you benefit from others' corrections)","advanced-database-cleaner") ?>
111
+ </span>
112
+ </div>-->
113
+ <!-- xxx I should add link to read more -->
114
+ <!--<div style="color:grey;margin-left:25px;">
115
+ <?php //echo __("No sensitive info is sent","advanced-database-cleaner") . " <a href='#'>[" . __("Read more here", "advanced-database-cleaner") . "]</a>"; ?>
116
+ </div>
117
+
118
+ </div>-->
119
+
120
+ <div class="aDBc-clear-both"></div>
121
+
122
+ <div class="aDBc-correction-btns-div">
123
+
124
+ <input name="aDBc_correct" class="button-primary aDBc-correction-btn" type="submit" value="<?php _e( 'Save', 'advanced-database-cleaner' ); ?>"/>
125
+
126
+ <input name="aDBc_cancel" class="button-secondary aDBc-correction-btn" type="submit" value="<?php _e( 'Cancel', 'advanced-database-cleaner' ); ?>"/>
127
+
128
+ </div>
129
+
130
+ </form>
131
+
132
+ </div>
includes/functions.php CHANGED
@@ -108,7 +108,7 @@ function aDBc_clean_elements_type($type){
108
  case "trash-posts":
109
  $trash_post_date = aDBc_get_keep_last_sql_arg('trash-posts','post_modified');
110
  $wpdb->query("DELETE FROM $wpdb->posts WHERE post_status = 'trash'" . $trash_post_date);
111
- break;
112
  case "moderated-comments":
113
  $moderated_comment_date = aDBc_get_keep_last_sql_arg('moderated-comments','comment_date');
114
  $wpdb->query("DELETE FROM $wpdb->comments WHERE comment_approved = '0'" . $moderated_comment_date);
@@ -128,7 +128,7 @@ function aDBc_clean_elements_type($type){
128
  case "trackbacks":
129
  $trackback_date = aDBc_get_keep_last_sql_arg('trackbacks','comment_date');
130
  $wpdb->query("DELETE FROM $wpdb->comments WHERE comment_type = 'trackback'" . $trackback_date);
131
- break;
132
  case "orphan-postmeta":
133
  $wpdb->query("DELETE pm FROM $wpdb->postmeta pm LEFT JOIN $wpdb->posts wp ON wp.ID = pm.post_id WHERE wp.ID IS NULL");
134
  break;
@@ -148,14 +148,6 @@ function aDBc_clean_elements_type($type){
148
  $type_arg = " AND b.option_value < UNIX_TIMESTAMP()";
149
  aDBc_clean_all_transients($type_arg);
150
  break;
151
- //case "transients-with-expiration":
152
- // $type_arg = " AND b.option_value > UNIX_TIMESTAMP()";
153
- // aDBc_clean_all_transients($type_arg);
154
- // break;
155
- //case "transients-with-no-expiration":
156
- // $type_arg = " AND b.option_value is NULL";
157
- // aDBc_clean_all_transients($type_arg);
158
- // break;
159
  }
160
  }
161
 
@@ -164,7 +156,7 @@ function aDBc_clean_all_transients($type_arg){
164
 
165
  global $wpdb;
166
 
167
- $aDBc_transients = $wpdb->get_results("SELECT a.option_name, b.option_value FROM $wpdb->options a LEFT JOIN $wpdb->options b ON b.option_name =
168
  CONCAT(
169
  CASE WHEN a.option_name LIKE '_site_transient_%'
170
  THEN '_site_transient_timeout_'
@@ -202,7 +194,7 @@ function aDBc_clean_scheduled_elements($schedule_name){
202
 
203
  $schedule_params = $schedule_settings[$schedule_name];
204
  $elements_to_clean = $schedule_params['elements_to_clean'];
205
-
206
  if(function_exists('is_multisite') && is_multisite()){
207
  $blogs_ids = $wpdb->get_col("SELECT blog_id FROM $wpdb->blogs");
208
  foreach($blogs_ids as $blog_id){
@@ -302,19 +294,19 @@ function aDBc_return_array_all_elements_to_clean(){
302
  $aDBc_unused["auto-draft"]['URL_blog'] = "https://sigmaplugin.com/blog/what-are-wordpress-auto-drafts-and-how-to-clean-them";
303
  $aDBc_unused["trash-posts"]['name'] = __('Trashed posts','advanced-database-cleaner');
304
  $aDBc_unused["trash-posts"]['URL_blog'] = "https://sigmaplugin.com/blog/what-are-wordpress-trash-posts-and-how-to-clean-them";
305
-
306
  $aDBc_unused["moderated-comments"]['name'] = __('Pending comments','advanced-database-cleaner');
307
  $aDBc_unused["moderated-comments"]['URL_blog'] = "https://sigmaplugin.com/blog/what-are-wordpress-pending-comments-and-how-to-clean-them";
308
  $aDBc_unused["spam-comments"]['name'] = __('Spam comments','advanced-database-cleaner');
309
  $aDBc_unused["spam-comments"]['URL_blog'] = "https://sigmaplugin.com/blog/what-are-wordpress-spam-comments-and-how-to-clean-them";
310
  $aDBc_unused["trash-comments"]['name'] = __('Trashed comments','advanced-database-cleaner');
311
  $aDBc_unused["trash-comments"]['URL_blog'] = "https://sigmaplugin.com/blog/what-are-wordpress-trash-comments-and-how-to-clean-them";
312
-
313
  $aDBc_unused["pingbacks"]['name'] = __('Pingbacks','advanced-database-cleaner');
314
  $aDBc_unused["pingbacks"]['URL_blog'] = "https://sigmaplugin.com/blog/what-are-wordpress-pingbacks-and-how-to-clean-them";
315
  $aDBc_unused["trackbacks"]['name'] = __('Trackbacks','advanced-database-cleaner');
316
  $aDBc_unused["trackbacks"]['URL_blog'] = "https://sigmaplugin.com/blog/what-are-wordpress-trackbacks-and-how-to-clean-them";
317
-
318
  $aDBc_unused["orphan-postmeta"]['name'] = __('Orphaned post meta','advanced-database-cleaner');
319
  $aDBc_unused["orphan-postmeta"]['URL_blog'] = "https://sigmaplugin.com/blog/what-are-wordpress-orphan-posts-meta-and-how-to-clean-them";
320
  $aDBc_unused["orphan-commentmeta"]['name'] = __('Orphaned comment meta','advanced-database-cleaner');
@@ -323,25 +315,13 @@ function aDBc_return_array_all_elements_to_clean(){
323
  $aDBc_unused["orphan-usermeta"]['URL_blog'] = "https://sigmaplugin.com/blog/what-are-wordpress-orphaned-user-meta-and-how-to-clean-them";
324
  $aDBc_unused["orphan-termmeta"]['name'] = __('Orphaned term meta','advanced-database-cleaner');
325
  $aDBc_unused["orphan-termmeta"]['URL_blog'] = "https://sigmaplugin.com/blog/what-are-wordpress-orphaned-term-meta-and-how-to-clean-them";
326
-
327
  $aDBc_unused["orphan-relationships"]['name'] = __('Orphaned relationships','advanced-database-cleaner');
328
  $aDBc_unused["orphan-relationships"]['URL_blog'] = "https://sigmaplugin.com/blog/what-are-wordpress-orphan-relationships-and-how-to-clean-them";
329
 
330
  $aDBc_unused["expired-transients"]['name'] = __("Expired transients","advanced-database-cleaner");
331
  $aDBc_unused["expired-transients"]['URL_blog'] = "https://sigmaplugin.com/blog/what-are-wordpress-transients";
332
-
333
-
334
- /*$aDBc_transient_toolip = "<span class='aDBc-tooltips-headers'>
335
- <img style='width:12px' class='aDBc-info-image' src='". ADBC_PLUGIN_DIR_PATH . '/images/information2.svg' . "'/>
336
- <span>" . __('Do not clean these items unless you know what you are doing!','advanced-database-cleaner') ." </span>
337
- </span>";
338
-
339
- $aDBc_unused["transients-with-expiration"]['name'] = __("Transients with an expiration","advanced-database-cleaner") . "<br><span class='aDBc-caution'>" . __("Use with caution!","advanced-database-cleaner") . "</span>" . $aDBc_transient_toolip;
340
- $aDBc_unused["transients-with-expiration"]['URL_blog'] = "https://sigmaplugin.com/blog/what-are-wordpress-transients";
341
-
342
- $aDBc_unused["transients-with-no-expiration"]['name'] = __("Transients with no expiration","advanced-database-cleaner") . "<br><span class='aDBc-caution'>" . __("Use with caution!","advanced-database-cleaner") . "</span>" . $aDBc_transient_toolip;
343
- $aDBc_unused["transients-with-no-expiration"]['URL_blog'] = "https://sigmaplugin.com/blog/what-are-wordpress-transients";*/
344
-
345
  return $aDBc_unused;
346
 
347
  }
@@ -361,7 +341,7 @@ function aDBc_count_all_elements_to_clean(){
361
  $blogs_ids = $wpdb->get_col("SELECT blog_id FROM $wpdb->blogs");
362
  foreach($blogs_ids as $blog_id){
363
  switch_to_blog($blog_id);
364
- aDBc_count_elements_to_clean($aDBc_unused);
365
  restore_current_blog();
366
  }
367
  }else{
@@ -404,25 +384,14 @@ function aDBc_count_elements_to_clean(&$aDBc_unused){
404
  if(is_main_site()){
405
  $aDBc_unused["orphan-usermeta"]['count'] += $wpdb->get_var("SELECT COUNT(umeta_id) FROM $wpdb->usermeta WHERE user_id NOT IN (SELECT ID FROM $wpdb->users)");
406
  }
407
-
408
  $aDBc_unused["orphan-termmeta"]['count'] += $wpdb->get_var("SELECT COUNT(meta_id) FROM $wpdb->termmeta WHERE term_id NOT IN (SELECT term_id FROM $wpdb->terms)");
409
 
410
  $aDBc_unused["orphan-relationships"]['count'] += $wpdb->get_var("SELECT COUNT(object_id) FROM $wpdb->term_relationships WHERE term_taxonomy_id=1 AND object_id NOT IN (SELECT ID FROM $wpdb->posts)");
411
 
412
- // Section for transients
413
- //$all_transients_names = $wpdb->get_col("SELECT option_name FROM $wpdb->options where (option_name LIKE '_transient_%' OR option_name LIKE '_site_transient_%') AND option_name NOT LIKE '_transient_timeout_%' AND option_name NOT LIKE '_site_transient_timeout_%'");
414
-
415
  $expired_transient_names = $wpdb->get_col("SELECT REPLACE(option_name, '_timeout', '') FROM $wpdb->options where (option_name LIKE '_transient_timeout_%' OR option_name LIKE '_site_transient_timeout_%') AND option_value < UNIX_TIMESTAMP()");
416
 
417
- //$transient_with_expiration_names = $wpdb->get_col("SELECT REPLACE(option_name, '_timeout', '') FROM $wpdb->options where option_value > UNIX_TIMESTAMP() AND (option_name LIKE '_transient_timeout_%' OR option_name LIKE '_site_transient_timeout_%')");
418
-
419
- // Get transients with no expiration
420
- //$transients_with_no_expiration = array_diff($all_transients_names, $expired_transient_names, $transient_with_expiration_names);
421
-
422
  $aDBc_unused["expired-transients"]['count'] += count($expired_transient_names);
423
- //$aDBc_unused["transients-with-expiration"]['count'] += count($transient_with_expiration_names);
424
- //$aDBc_unused["transients-with-no-expiration"]['count'] += count($transients_with_no_expiration);
425
- // End of transients section
426
 
427
  }
428
 
@@ -466,7 +435,7 @@ function aDBc_filter_results_in_all_items_array_free(&$aDBc_all_items, $aDBc_tab
466
  }
467
  }
468
  }
469
- }
470
 
471
  }else{
472
 
@@ -481,7 +450,7 @@ function aDBc_filter_results_in_all_items_array_free(&$aDBc_all_items, $aDBc_tab
481
  $array_names = $aDBc_tables_name_to_optimize;
482
  }else{
483
  $array_names = $aDBc_tables_name_to_repair;
484
- }
485
  }
486
 
487
  foreach($aDBc_all_items as $item_name => $item_info){
@@ -556,54 +525,96 @@ function aDBc_prepare_items_to_display(
556
  break;
557
  }
558
 
559
- $aDBc_saved_items_file = "";
560
- // xxx change this later, no need for this test in the free verion. Moreover, ADBC_UPLOAD_DIR_PATH_TO_ADBC is not defined here
561
- /*if(file_exists(ADBC_UPLOAD_DIR_PATH_TO_ADBC . "/" . $items_type . ".txt")){
562
- $aDBc_saved_items_file = fopen(ADBC_UPLOAD_DIR_PATH_TO_ADBC . "/" . $items_type . ".txt", "r");
563
- }*/
564
-
565
- // Affect type and belongs_to to items.
566
- if ($aDBc_saved_items_file) {
567
- while(($item = fgets($aDBc_saved_items_file)) !== false) {
568
- $columns = explode(":", trim($item));
569
- // We replace +=+ by : because names that contain : have been transformed to +=+ to prevent problems with split based on :
570
- $item_name = str_replace("+=+", ":", $columns[0]);
571
- // Prevent adding an item that was cleaned (maybe by other plugins) but not updated in file
572
- if(array_key_exists($item_name, $aDBc_all_items) && empty($aDBc_all_items[$item_name]['belongs_to'])) {
573
-
574
- $aDBc_all_items[$item_name]['belongs_to'] = $columns[1];
575
- $aDBc_all_items[$item_name]['type'] = $columns[2];
576
-
577
- // Add this belongs_to to array for display in dropdown filter
578
- $belongs_to_value = explode("(", $columns[1], 2);
579
- $belongs_to_value = trim($belongs_to_value[0]);
580
- $belongs_to_value = str_replace(" ", "-", $belongs_to_value);
581
- if($items_type == "tasks"){
582
- if(!array_key_exists($belongs_to_value, $array_belongs_to_counts)){
583
- $array_belongs_to_counts[$belongs_to_value]['type'] = $columns[2];
584
- foreach($aDBc_all_items[$item_name]['sites'] as $site => $info){
585
- $array_belongs_to_counts[$belongs_to_value]['count'] = count($aDBc_all_items[$item_name]['sites'][$site]['args']);
586
- }
 
 
 
 
 
587
  }else{
588
- foreach($aDBc_all_items[$item_name]['sites'] as $site => $info){
589
- $array_belongs_to_counts[$belongs_to_value]['count'] += count($aDBc_all_items[$item_name]['sites'][$site]['args']);
 
 
 
 
 
 
590
  }
591
  }
592
- }else{
593
- if(!array_key_exists($belongs_to_value, $array_belongs_to_counts)){
594
- $array_belongs_to_counts[$belongs_to_value]['type'] = $columns[2];
595
- $array_belongs_to_counts[$belongs_to_value]['count'] = count($aDBc_all_items[$item_name]['sites']);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
596
  }else{
597
- $array_belongs_to_counts[$belongs_to_value]['count'] += count($aDBc_all_items[$item_name]['sites']);
 
 
 
 
 
598
  }
599
  }
600
  }
 
601
  }
602
- fclose($aDBc_saved_items_file);
603
  }
604
 
605
  // Filter results according to users choices and args
606
- aDBc_filter_results_in_all_items_array_free($aDBc_all_items, $aDBc_tables_name_to_optimize, $aDBc_tables_name_to_repair);
 
 
 
 
 
 
 
 
 
607
 
608
  // Put 'u' type to all uncategorized items and count all items
609
  foreach($aDBc_all_items as $item_name => $item_info){
@@ -631,76 +642,115 @@ function aDBc_prepare_items_to_display(
631
  }
632
 
633
  // Prepare items to display
634
- $aDBc_not_categorized_toolip = "<span class='aDBc-tooltips-headers'>
635
- <img class='aDBc-info-image' src='". ADBC_PLUGIN_DIR_PATH . '/images/information2.svg' . "'/>
636
- <span>" . __('This item is not categorized yet! Please click on scan button above to categorize it.','advanced-database-cleaner') ." </span>
637
- </span>";
638
- foreach($aDBc_all_items as $item_name => $item_info){
639
 
640
- if($_GET['aDBc_cat'] != "all" && $item_info['type'] != $_GET['aDBc_cat']){
 
 
 
 
 
 
 
 
 
 
 
 
 
641
  continue;
642
  }
643
 
644
- switch($item_info['type']){
 
645
  case 'u' :
646
- $belongs_to_without_html = __('Available in Pro version!', 'advanced-database-cleaner');
647
- $belongs_to = '<span style="color:#999">' . $belongs_to_without_html . '</span>';
 
 
 
 
 
 
 
 
 
 
648
  break;
 
649
  case 'o' :
650
- $belongs_to_without_html = __('Orphan!', 'advanced-database-cleaner');
 
651
  $belongs_to = '<span style="color:#E97F31">' . $belongs_to_without_html . '</span>';
652
  break;
 
653
  case 'w' :
654
- $belongs_to_without_html = __('Wordpress core', 'advanced-database-cleaner');
 
655
  $belongs_to = '<span style="color:#D091BE">' . $belongs_to_without_html;
656
  // Add percent % if any
657
- $belongs_to .= $item_info['belongs_to'] == "w" ? "" : " ".$item_info['belongs_to'];
658
  $belongs_to .= '</span>';
659
  break;
 
660
  case 'p' :
 
661
  $belongs_to_without_html = $item_info['belongs_to'];
662
  $belongs_to = '<span style="color:#00BAFF">' . $belongs_to_without_html . '</span>';
663
  break;
 
664
  case 't' :
 
665
  $belongs_to_without_html = $item_info['belongs_to'];
666
  $belongs_to = '<span style="color:#45C966">' . $belongs_to_without_html . '</span>';
667
  break;
668
  }
669
- foreach($item_info['sites'] as $site_id => $site_item_info){
670
- switch($items_type){
 
 
 
671
  case 'tasks' :
672
- foreach($site_item_info['args'] as $args_info){
673
- array_push($items_to_display, array(
674
- 'hook_name' => $item_name,
675
- 'arguments' => $args_info['arguments'],
676
- 'site_id' => $site_id,
677
- 'next_run' => $args_info['next_run'] . ' - ' . $args_info['frequency'],
678
- 'timestamp' => $args_info['timestamp'],
679
- 'hook_belongs_to' => $belongs_to
680
- ));
 
 
681
  }
 
682
  break;
 
683
  case 'options' :
684
- array_push($items_to_display, array(
685
- 'option_name' => $item_name,
686
- 'option_value' => $site_item_info['value'],
687
- 'option_autoload' => $site_item_info['autoload'],
688
- 'option_size' => $site_item_info['size'],
689
- 'site_id' => $site_id,
690
- 'option_belongs_to' => $belongs_to
691
- ));
 
 
692
  break;
 
693
  case 'tables' :
694
- array_push($items_to_display, array(
695
- 'table_name' => $item_name,
696
- 'table_prefix' => $site_item_info['prefix'],
697
- 'table_full_name' => $site_item_info['prefix'].$item_name,
698
- 'table_rows' => $site_item_info['rows'],
699
- 'table_size' => $site_item_info['size'],
700
- 'table_lost' => $site_item_info['lost'],
701
- 'site_id' => $site_id,
702
- 'table_belongs_to' => $belongs_to
703
- ));
 
 
704
  break;
705
  }
706
  }
@@ -780,7 +830,7 @@ function aDBc_add_options(&$aDBc_all_options, $blog_id){
780
  foreach($aDBc_options_in_db as $option){
781
  // If the option has not been added yet, add it and initiate its info
782
  if(empty($aDBc_all_options[$option->option_name])){
783
- $aDBc_all_options[$option->option_name] = array('belongs_to' => '', 'maybe_belongs_to' => '', 'type' => '', 'sites' => array());
784
  }
785
 
786
  // Add info of the option according to the current site
@@ -875,14 +925,14 @@ function aDBc_get_all_tables() {
875
  // Add table information to the global array
876
  // If the table has not been added yet, add it and initiate its info
877
  if(empty($aDBc_all_tables[$aDBc_table_name_without_prefix])){
878
- $aDBc_all_tables[$aDBc_table_name_without_prefix] = array('belongs_to' => '', 'maybe_belongs_to' => '', 'type' => '', 'sites' => array());
879
  }
880
  // Add info of the task according to the current site
881
  $aDBc_all_tables[$aDBc_table_name_without_prefix]['sites'][$aDBc_table_site] = array('prefix' => $aDBc_table_prefix,
882
  'rows' => $aDBc_tables_rows_sizes[$table_name]['rows'],
883
  'size' => $aDBc_tables_rows_sizes[$table_name]['size'],
884
  'lost' => $aDBc_tables_rows_sizes[$table_name]['lost'],
885
- );
886
  }
887
  return $aDBc_all_tables;
888
  }
@@ -943,7 +993,7 @@ function aDBc_add_scheduled_tasks(&$aDBc_all_tasks, $blog_id) {
943
  // If the task has not been added yet, add it and initiate its info
944
  if(empty($aDBc_all_tasks[$hook])){
945
 
946
- $aDBc_all_tasks[$hook] = array('belongs_to' => '', 'maybe_belongs_to' => '', 'type' => '', 'sites' => array());
947
 
948
  }
949
 
@@ -1003,26 +1053,30 @@ function aDBc_create_folder_plus_index_file($folder) {
1003
  // }
1004
  }
1005
 
1006
- /**************************************************************************************************
1007
  * Delete folder with its content
1008
  *************************************************************************************************/
1009
- function aDBc_delete_folder_with_content($path){
1010
 
1011
- if(!file_exists($path))
1012
  return;
1013
- $dir = opendir($path);
1014
- while(($file = readdir($dir)) !== false){
1015
- if ($file != '.' && $file != '..'){
1016
- unlink($path . "/" . $file);
 
 
 
1017
  }
1018
  }
1019
- closedir($dir);
 
1020
  rmdir( $path );
1021
 
1022
  }
1023
 
1024
- /**************************************************************************************************
1025
- * Uupdate task in db after being deleted
1026
  *************************************************************************************************/
1027
  function aDBc_update_task_in_db_after_delete($arg_name, $db_option_name){
1028
 
@@ -1273,7 +1327,7 @@ function aDBc_get_core_options() {
1273
  'user_roles',
1274
  'widget_nav_menu',
1275
  );
1276
-
1277
  // Before doing anything, we add some special options to the WP core options array
1278
  // The 'user_roles' option is added in Multi-site as $prefix.'user_roles'. So for each site we should add this options in that format
1279
  if(function_exists('is_multisite') && is_multisite()){
@@ -1287,4 +1341,29 @@ function aDBc_get_core_options() {
1287
  return $aDBc_wp_core_options;
1288
  }
1289
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1290
  ?>
108
  case "trash-posts":
109
  $trash_post_date = aDBc_get_keep_last_sql_arg('trash-posts','post_modified');
110
  $wpdb->query("DELETE FROM $wpdb->posts WHERE post_status = 'trash'" . $trash_post_date);
111
+ break;
112
  case "moderated-comments":
113
  $moderated_comment_date = aDBc_get_keep_last_sql_arg('moderated-comments','comment_date');
114
  $wpdb->query("DELETE FROM $wpdb->comments WHERE comment_approved = '0'" . $moderated_comment_date);
128
  case "trackbacks":
129
  $trackback_date = aDBc_get_keep_last_sql_arg('trackbacks','comment_date');
130
  $wpdb->query("DELETE FROM $wpdb->comments WHERE comment_type = 'trackback'" . $trackback_date);
131
+ break;
132
  case "orphan-postmeta":
133
  $wpdb->query("DELETE pm FROM $wpdb->postmeta pm LEFT JOIN $wpdb->posts wp ON wp.ID = pm.post_id WHERE wp.ID IS NULL");
134
  break;
148
  $type_arg = " AND b.option_value < UNIX_TIMESTAMP()";
149
  aDBc_clean_all_transients($type_arg);
150
  break;
 
 
 
 
 
 
 
 
151
  }
152
  }
153
 
156
 
157
  global $wpdb;
158
 
159
+ $aDBc_transients = $wpdb->get_results("SELECT a.option_name, b.option_value FROM $wpdb->options a LEFT JOIN $wpdb->options b ON b.option_name =
160
  CONCAT(
161
  CASE WHEN a.option_name LIKE '_site_transient_%'
162
  THEN '_site_transient_timeout_'
194
 
195
  $schedule_params = $schedule_settings[$schedule_name];
196
  $elements_to_clean = $schedule_params['elements_to_clean'];
197
+
198
  if(function_exists('is_multisite') && is_multisite()){
199
  $blogs_ids = $wpdb->get_col("SELECT blog_id FROM $wpdb->blogs");
200
  foreach($blogs_ids as $blog_id){
294
  $aDBc_unused["auto-draft"]['URL_blog'] = "https://sigmaplugin.com/blog/what-are-wordpress-auto-drafts-and-how-to-clean-them";
295
  $aDBc_unused["trash-posts"]['name'] = __('Trashed posts','advanced-database-cleaner');
296
  $aDBc_unused["trash-posts"]['URL_blog'] = "https://sigmaplugin.com/blog/what-are-wordpress-trash-posts-and-how-to-clean-them";
297
+
298
  $aDBc_unused["moderated-comments"]['name'] = __('Pending comments','advanced-database-cleaner');
299
  $aDBc_unused["moderated-comments"]['URL_blog'] = "https://sigmaplugin.com/blog/what-are-wordpress-pending-comments-and-how-to-clean-them";
300
  $aDBc_unused["spam-comments"]['name'] = __('Spam comments','advanced-database-cleaner');
301
  $aDBc_unused["spam-comments"]['URL_blog'] = "https://sigmaplugin.com/blog/what-are-wordpress-spam-comments-and-how-to-clean-them";
302
  $aDBc_unused["trash-comments"]['name'] = __('Trashed comments','advanced-database-cleaner');
303
  $aDBc_unused["trash-comments"]['URL_blog'] = "https://sigmaplugin.com/blog/what-are-wordpress-trash-comments-and-how-to-clean-them";
304
+
305
  $aDBc_unused["pingbacks"]['name'] = __('Pingbacks','advanced-database-cleaner');
306
  $aDBc_unused["pingbacks"]['URL_blog'] = "https://sigmaplugin.com/blog/what-are-wordpress-pingbacks-and-how-to-clean-them";
307
  $aDBc_unused["trackbacks"]['name'] = __('Trackbacks','advanced-database-cleaner');
308
  $aDBc_unused["trackbacks"]['URL_blog'] = "https://sigmaplugin.com/blog/what-are-wordpress-trackbacks-and-how-to-clean-them";
309
+
310
  $aDBc_unused["orphan-postmeta"]['name'] = __('Orphaned post meta','advanced-database-cleaner');
311
  $aDBc_unused["orphan-postmeta"]['URL_blog'] = "https://sigmaplugin.com/blog/what-are-wordpress-orphan-posts-meta-and-how-to-clean-them";
312
  $aDBc_unused["orphan-commentmeta"]['name'] = __('Orphaned comment meta','advanced-database-cleaner');
315
  $aDBc_unused["orphan-usermeta"]['URL_blog'] = "https://sigmaplugin.com/blog/what-are-wordpress-orphaned-user-meta-and-how-to-clean-them";
316
  $aDBc_unused["orphan-termmeta"]['name'] = __('Orphaned term meta','advanced-database-cleaner');
317
  $aDBc_unused["orphan-termmeta"]['URL_blog'] = "https://sigmaplugin.com/blog/what-are-wordpress-orphaned-term-meta-and-how-to-clean-them";
318
+
319
  $aDBc_unused["orphan-relationships"]['name'] = __('Orphaned relationships','advanced-database-cleaner');
320
  $aDBc_unused["orphan-relationships"]['URL_blog'] = "https://sigmaplugin.com/blog/what-are-wordpress-orphan-relationships-and-how-to-clean-them";
321
 
322
  $aDBc_unused["expired-transients"]['name'] = __("Expired transients","advanced-database-cleaner");
323
  $aDBc_unused["expired-transients"]['URL_blog'] = "https://sigmaplugin.com/blog/what-are-wordpress-transients";
324
+
 
 
 
 
 
 
 
 
 
 
 
 
325
  return $aDBc_unused;
326
 
327
  }
341
  $blogs_ids = $wpdb->get_col("SELECT blog_id FROM $wpdb->blogs");
342
  foreach($blogs_ids as $blog_id){
343
  switch_to_blog($blog_id);
344
+ aDBc_count_elements_to_clean($aDBc_unused);
345
  restore_current_blog();
346
  }
347
  }else{
384
  if(is_main_site()){
385
  $aDBc_unused["orphan-usermeta"]['count'] += $wpdb->get_var("SELECT COUNT(umeta_id) FROM $wpdb->usermeta WHERE user_id NOT IN (SELECT ID FROM $wpdb->users)");
386
  }
387
+
388
  $aDBc_unused["orphan-termmeta"]['count'] += $wpdb->get_var("SELECT COUNT(meta_id) FROM $wpdb->termmeta WHERE term_id NOT IN (SELECT term_id FROM $wpdb->terms)");
389
 
390
  $aDBc_unused["orphan-relationships"]['count'] += $wpdb->get_var("SELECT COUNT(object_id) FROM $wpdb->term_relationships WHERE term_taxonomy_id=1 AND object_id NOT IN (SELECT ID FROM $wpdb->posts)");
391
 
 
 
 
392
  $expired_transient_names = $wpdb->get_col("SELECT REPLACE(option_name, '_timeout', '') FROM $wpdb->options where (option_name LIKE '_transient_timeout_%' OR option_name LIKE '_site_transient_timeout_%') AND option_value < UNIX_TIMESTAMP()");
393
 
 
 
 
 
 
394
  $aDBc_unused["expired-transients"]['count'] += count($expired_transient_names);
 
 
 
395
 
396
  }
397
 
435
  }
436
  }
437
  }
438
+ }
439
 
440
  }else{
441
 
450
  $array_names = $aDBc_tables_name_to_optimize;
451
  }else{
452
  $array_names = $aDBc_tables_name_to_repair;
453
+ }
454
  }
455
 
456
  foreach($aDBc_all_items as $item_name => $item_info){
525
  break;
526
  }
527
 
528
+
529
+ if ( ADBC_PLUGIN_PLAN == "pro" ) {
530
+
531
+ $aDBc_saved_items_file = "";
532
+ if(file_exists(ADBC_UPLOAD_DIR_PATH_TO_ADBC . "/" . $items_type . ".txt")){
533
+ $aDBc_saved_items_file = fopen(ADBC_UPLOAD_DIR_PATH_TO_ADBC . "/" . $items_type . ".txt", "r");
534
+ }
535
+
536
+ $aDBc_manually_corrected_items_path = ADBC_UPLOAD_DIR_PATH_TO_ADBC . "/" . $items_type . "_corrected_manually.txt";
537
+
538
+ // Prepare an array containing user manually corrected results
539
+ $aDBc_user_corrections = array();
540
+ if(file_exists($aDBc_manually_corrected_items_path)){
541
+ $aDBc_user_corrections = json_decode(trim(file_get_contents($aDBc_manually_corrected_items_path)), true);
542
+ }
543
+
544
+ // Affect type and belongs_to to items.
545
+ if($aDBc_saved_items_file) {
546
+ while(($item = fgets($aDBc_saved_items_file)) !== false) {
547
+ $columns = explode(":", trim($item), 4);
548
+ // We replace +=+ by : because names that contain : have been transformed to +=+ to prevent problems with split based on :
549
+ $item_name = str_replace("+=+", ":", $columns[0]);
550
+ // Prevent adding an item that was cleaned (maybe by other plugins) but not updated in file
551
+ if(array_key_exists($item_name, $aDBc_all_items) && empty($aDBc_all_items[$item_name]['belongs_to'])) {
552
+
553
+ // If needed, we correct items that users have corrected manually
554
+ if(!empty($aDBc_user_corrections[$item_name])){
555
+ // If we are here, this means that the user has provided a correction to this item, we apply it
556
+ $correction_by_user = $aDBc_user_corrections[$item_name];
557
+ $correction_by_user = explode(":", $correction_by_user);
558
+
559
+ $aDBc_all_items[$item_name]['belongs_to'] = $correction_by_user[0];
560
+ $aDBc_all_items[$item_name]['type'] = $correction_by_user[1];
561
  }else{
562
+ // By default, affect the plugin scan results to items
563
+ $aDBc_all_items[$item_name]['belongs_to'] = $columns[1];
564
+ $aDBc_all_items[$item_name]['type'] = $columns[2];
565
+
566
+ // xxx verify if we should display info about orphaned items to which plugins/theme they may belong after double check
567
+ // This information is stored in $columns[3] of each line
568
+ if(!empty($columns[3])){
569
+ //$aDBc_all_items[$item_name]['corrections_info'] = aDBc_get_correction_info_for_orphaned_items($columns[3]);
570
  }
571
  }
572
+
573
+ // Add this belongs_to to array for display in dropdown filter
574
+ // Get only the first part in belongs_to with %
575
+ $belongs_to_value = $aDBc_all_items[$item_name]['belongs_to'];
576
+ $belongs_to_value = explode("(", $belongs_to_value, 2);
577
+ $belongs_to_value = trim($belongs_to_value[0]);
578
+ $belongs_to_value = str_replace(" ", "-", $belongs_to_value);
579
+ // Get the type
580
+ $belongs_to_type = $aDBc_all_items[$item_name]['type'];
581
+
582
+ if($items_type == "tasks"){
583
+ if(!array_key_exists($belongs_to_value, $array_belongs_to_counts)){
584
+ $array_belongs_to_counts[$belongs_to_value]['type'] = $belongs_to_type;
585
+ foreach($aDBc_all_items[$item_name]['sites'] as $site => $info){
586
+ $array_belongs_to_counts[$belongs_to_value]['count'] = count($aDBc_all_items[$item_name]['sites'][$site]['args']);
587
+ }
588
+ }else{
589
+ foreach($aDBc_all_items[$item_name]['sites'] as $site => $info){
590
+ $array_belongs_to_counts[$belongs_to_value]['count'] += count($aDBc_all_items[$item_name]['sites'][$site]['args']);
591
+ }
592
+ }
593
  }else{
594
+ if(!array_key_exists($belongs_to_value, $array_belongs_to_counts)){
595
+ $array_belongs_to_counts[$belongs_to_value]['type'] = $belongs_to_type;
596
+ $array_belongs_to_counts[$belongs_to_value]['count'] = count($aDBc_all_items[$item_name]['sites']);
597
+ }else{
598
+ $array_belongs_to_counts[$belongs_to_value]['count'] += count($aDBc_all_items[$item_name]['sites']);
599
+ }
600
  }
601
  }
602
  }
603
+ fclose($aDBc_saved_items_file);
604
  }
 
605
  }
606
 
607
  // Filter results according to users choices and args
608
+
609
+ if ( ADBC_PLUGIN_PLAN == "pro" ) {
610
+
611
+ aDBc_filter_results_in_all_items_array( $aDBc_all_items, $aDBc_tables_name_to_optimize, $aDBc_tables_name_to_repair );
612
+
613
+ } elseif ( ADBC_PLUGIN_PLAN == "free" ) {
614
+
615
+ aDBc_filter_results_in_all_items_array_free( $aDBc_all_items, $aDBc_tables_name_to_optimize, $aDBc_tables_name_to_repair );
616
+
617
+ }
618
 
619
  // Put 'u' type to all uncategorized items and count all items
620
  foreach($aDBc_all_items as $item_name => $item_info){
642
  }
643
 
644
  // Prepare items to display
 
 
 
 
 
645
 
646
+ $aDBc_not_categorized_toolip = "";
647
+
648
+ if ( ADBC_PLUGIN_PLAN == "pro" ) {
649
+
650
+ $aDBc_not_categorized_toolip = "<span class='aDBc-tooltips-headers'>
651
+ <img class='aDBc-info-image' src='". ADBC_PLUGIN_DIR_PATH . '/images/information2.svg' . "'/>
652
+ <span>" . __('This item is not categorized yet! Please click on scan button above to categorize it.','advanced-database-cleaner') ." </span>
653
+ </span>";
654
+
655
+ }
656
+
657
+ foreach ( $aDBc_all_items as $item_name => $item_info ) {
658
+
659
+ if ( $_GET['aDBc_cat'] != "all" && $item_info['type'] != $_GET['aDBc_cat'] ) {
660
  continue;
661
  }
662
 
663
+ switch ( $item_info['type'] ) {
664
+
665
  case 'u' :
666
+
667
+ if ( ADBC_PLUGIN_PLAN == "pro" ) {
668
+
669
+ $belongs_to_without_html = __( 'Uncategorized!', 'advanced-database-cleaner' );
670
+
671
+ } else {
672
+
673
+ $belongs_to_without_html = __('Available in Pro version!', 'advanced-database-cleaner');
674
+
675
+ }
676
+
677
+ $belongs_to = '<span style="color:#999">' . $belongs_to_without_html . '</span>' . $aDBc_not_categorized_toolip;
678
  break;
679
+
680
  case 'o' :
681
+
682
+ $belongs_to_without_html = __( 'Orphan!', 'advanced-database-cleaner' );
683
  $belongs_to = '<span style="color:#E97F31">' . $belongs_to_without_html . '</span>';
684
  break;
685
+
686
  case 'w' :
687
+
688
+ $belongs_to_without_html = __( 'Wordpress core', 'advanced-database-cleaner' );
689
  $belongs_to = '<span style="color:#D091BE">' . $belongs_to_without_html;
690
  // Add percent % if any
691
+ $belongs_to .= $item_info['belongs_to'] == "w" ? "" : " " . $item_info['belongs_to'];
692
  $belongs_to .= '</span>';
693
  break;
694
+
695
  case 'p' :
696
+
697
  $belongs_to_without_html = $item_info['belongs_to'];
698
  $belongs_to = '<span style="color:#00BAFF">' . $belongs_to_without_html . '</span>';
699
  break;
700
+
701
  case 't' :
702
+
703
  $belongs_to_without_html = $item_info['belongs_to'];
704
  $belongs_to = '<span style="color:#45C966">' . $belongs_to_without_html . '</span>';
705
  break;
706
  }
707
+
708
+ foreach ( $item_info['sites'] as $site_id => $site_item_info ) {
709
+
710
+ switch ( $items_type ) {
711
+
712
  case 'tasks' :
713
+
714
+ foreach ( $site_item_info['args'] as $args_info ) {
715
+
716
+ array_push( $items_to_display, array(
717
+ 'hook_name' => $item_name,
718
+ 'arguments' => $args_info['arguments'],
719
+ 'site_id' => $site_id,
720
+ 'next_run' => $args_info['next_run'] . ' - ' . $args_info['frequency'],
721
+ 'timestamp' => $args_info['timestamp'],
722
+ 'hook_belongs_to' => $belongs_to . $item_info['corrections_info']
723
+ ) );
724
  }
725
+
726
  break;
727
+
728
  case 'options' :
729
+
730
+ array_push( $items_to_display, array(
731
+ 'option_name' => $item_name,
732
+ 'option_value' => $site_item_info['value'],
733
+ 'option_autoload' => $site_item_info['autoload'],
734
+ 'option_size' => $site_item_info['size'],
735
+ 'site_id' => $site_id,
736
+ 'option_belongs_to' => $belongs_to . $item_info['corrections_info']
737
+ ) );
738
+
739
  break;
740
+
741
  case 'tables' :
742
+
743
+ array_push( $items_to_display, array(
744
+ 'table_name' => $item_name,
745
+ 'table_prefix' => $site_item_info['prefix'],
746
+ 'table_full_name' => $site_item_info['prefix'].$item_name,
747
+ 'table_rows' => $site_item_info['rows'],
748
+ 'table_size' => $site_item_info['size'],
749
+ 'table_lost' => $site_item_info['lost'],
750
+ 'site_id' => $site_id,
751
+ 'table_belongs_to' => $belongs_to . $item_info['corrections_info']
752
+ ) );
753
+
754
  break;
755
  }
756
  }
830
  foreach($aDBc_options_in_db as $option){
831
  // If the option has not been added yet, add it and initiate its info
832
  if(empty($aDBc_all_options[$option->option_name])){
833
+ $aDBc_all_options[$option->option_name] = array('belongs_to' => '', 'maybe_belongs_to' => '', 'corrections_info' => '', 'type' => '', 'sites' => array());
834
  }
835
 
836
  // Add info of the option according to the current site
925
  // Add table information to the global array
926
  // If the table has not been added yet, add it and initiate its info
927
  if(empty($aDBc_all_tables[$aDBc_table_name_without_prefix])){
928
+ $aDBc_all_tables[$aDBc_table_name_without_prefix] = array('belongs_to' => '', 'maybe_belongs_to' => '', 'corrections_info' => '', 'type' => '', 'sites' => array());
929
  }
930
  // Add info of the task according to the current site
931
  $aDBc_all_tables[$aDBc_table_name_without_prefix]['sites'][$aDBc_table_site] = array('prefix' => $aDBc_table_prefix,
932
  'rows' => $aDBc_tables_rows_sizes[$table_name]['rows'],
933
  'size' => $aDBc_tables_rows_sizes[$table_name]['size'],
934
  'lost' => $aDBc_tables_rows_sizes[$table_name]['lost'],
935
+ );
936
  }
937
  return $aDBc_all_tables;
938
  }
993
  // If the task has not been added yet, add it and initiate its info
994
  if(empty($aDBc_all_tasks[$hook])){
995
 
996
+ $aDBc_all_tasks[$hook] = array('belongs_to' => '', 'maybe_belongs_to' => '', 'corrections_info' => '', 'type' => '', 'sites' => array());
997
 
998
  }
999
 
1053
  // }
1054
  }
1055
 
1056
+ /**************************************************************************************************
1057
  * Delete folder with its content
1058
  *************************************************************************************************/
1059
+ function aDBc_delete_folder_with_content( $path ) {
1060
 
1061
+ if ( ! file_exists( $path ) )
1062
  return;
1063
+
1064
+ $dir = opendir( $path );
1065
+
1066
+ while ( ( $file = readdir( $dir ) ) !== false ) {
1067
+
1068
+ if ( $file != '.' && $file != '..' ) {
1069
+ unlink( $path . "/" . $file );
1070
  }
1071
  }
1072
+
1073
+ closedir( $dir );
1074
  rmdir( $path );
1075
 
1076
  }
1077
 
1078
+ /**************************************************************************************************
1079
+ * Update task in db after being deleted
1080
  *************************************************************************************************/
1081
  function aDBc_update_task_in_db_after_delete($arg_name, $db_option_name){
1082
 
1327
  'user_roles',
1328
  'widget_nav_menu',
1329
  );
1330
+
1331
  // Before doing anything, we add some special options to the WP core options array
1332
  // The 'user_roles' option is added in Multi-site as $prefix.'user_roles'. So for each site we should add this options in that format
1333
  if(function_exists('is_multisite') && is_multisite()){
1341
  return $aDBc_wp_core_options;
1342
  }
1343
 
1344
+
1345
+ /***********************************************************************************
1346
+ * Get All options and tasks used by the ADBC plugin
1347
+ ***********************************************************************************/
1348
+ function aDBc_get_ADBC_options_and_tasks_names() {
1349
+
1350
+ // yyy: Always make sure to keep this list up to date and put here only valid options after scan not temp ones that will be deleted
1351
+
1352
+ $aDBc_names = array(
1353
+ // Active options
1354
+ 'aDBc_settings',
1355
+ 'aDBc_security_folder_code',
1356
+ 'aDBc_edd_license_key',
1357
+ 'aDBc_edd_license_status',
1358
+ // Scheduled tasks
1359
+ 'aDBc_optimize_schedule',
1360
+ 'aDBc_clean_schedule',
1361
+ 'aDBc_last_search_ok_tables',
1362
+ 'aDBc_last_search_ok_options',
1363
+ 'aDBc_last_search_ok_tasks'
1364
+ );
1365
+
1366
+ return $aDBc_names;
1367
+ }
1368
+
1369
  ?>
includes/header_page_filter.php CHANGED
@@ -1,168 +1,291 @@
 
 
1
 
2
- <div style="margin-top:30px;">
3
 
4
- <div style="clear:both;margin-bottom:25px;width:100%;background:#f9f9f9" class="aDBc-float-right">
5
 
6
- <div style="float:left;padding:8px;height:30px">
7
 
8
- <span class="aDBc_premium_tooltip">
9
 
10
- <form method="get" style="pointer-events:none;opacity:0.5">
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
11
 
12
- <?php
13
- // Generate current parameters in URL
14
- foreach($_GET as $name => $value){
15
- if($name != "s" && $name != "paged" && $name != "aDBc_cat"){
16
- $name = esc_attr(sanitize_text_field($name));
17
- $value = esc_attr(sanitize_text_field($value));
18
- echo "<input type='hidden' name='$name' value='$value'/>";
19
- }
20
  }
21
- // Return always paged to page 1
22
- echo "<input type='hidden' name='paged' value='1'/>";
23
- // Return always aDBc_cat to all after filter
24
- echo "<input type='hidden' name='aDBc_cat' value='all'/>";
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
25
  ?>
26
 
27
- <fieldset style="padding-right:5px;float:left">
28
- <input style="font-size:13px;width:120px;height:30px;border:1px solid #e5e5e5;border-radius:2px;box-shadow:0 0 10px #f1f1f1;" type="search" placeholder="<?php _e('Search for','advanced-database-cleaner') ?>" name="s" value="<?php echo empty($_GET['s']) ? '' : esc_attr($_GET['s']); ?>"/>
29
- </fieldset>
30
 
31
- <fieldset style="float:left;">
32
 
33
-
34
- <?php
35
- // Show this select only for tables
36
- if(isset($_GET['aDBc_tab']) && $_GET['aDBc_tab'] == 'tables'){ ?>
37
- <select name="t_type" style="font-size:13px;width:100px;height:30px;border:1px solid #e5e5e5;border-radius:2px;box-shadow:0 0 10px #f1f1f1;">
38
- <option value="all" <?php echo (isset($_GET['t_type']) && $_GET['t_type'] == 'all') ? "selected='selected'" : ""; ?>><?php _e('All tables','advanced-database-cleaner') ?></option>
39
- <option value="optimize" <?php echo (isset($_GET['t_type']) && $_GET['t_type'] == 'optimize') ? "selected='selected'" : ""; ?>><?php echo __('To optimize','advanced-database-cleaner') . " (" . count($this->aDBc_tables_name_to_optimize) . ")" ?></option>
40
- <option value="repair" <?php echo (isset($_GET['t_type']) && $_GET['t_type'] == 'repair') ? "selected='selected'" : ""; ?>><?php echo __('To repair','advanced-database-cleaner') . " (" . count($this->aDBc_tables_name_to_repair) . ")" ?></option>
41
- </select>
42
- <?php } ?>
43
-
44
- <?php
45
- // Show autoload only for options
46
- if(isset($_GET['aDBc_tab']) && $_GET['aDBc_tab'] == 'options'){ ?>
47
- <select name="autoload" style="font-size:13px;width:100px;height:30px;border:1px solid #e5e5e5;border-radius:2px;box-shadow:0 0 10px #f1f1f1;">
48
- <option value="all" <?php echo (isset($_GET['autoload']) && $_GET['autoload'] == 'all') ? "selected='selected'" : ""; ?>><?php _e('Autoload','advanced-database-cleaner') ?></option>
49
- <option value="yes" <?php echo (isset($_GET['autoload']) && $_GET['autoload'] == 'yes') ? "selected='selected'" : ""; ?>><?php echo __('Yes','advanced-database-cleaner') ?></option>
50
- <option value="no" <?php echo (isset($_GET['autoload']) && $_GET['autoload'] == 'no') ? "selected='selected'" : ""; ?>><?php echo __('No','advanced-database-cleaner') ?></option>
51
- </select>
52
- <?php } ?>
53
-
54
- <select name="belongs_to" style="font-size:13px;width:135px;height:30px;border:1px solid #e5e5e5;border-radius:2px;box-shadow:0 0 10px #f1f1f1;">
55
- <option value="all"><?php _e('All "belongs to"','advanced-database-cleaner') ?></option>
56
- <?php
57
- $total_plugins = 0;
58
- $total_themes = 0;
59
- foreach($this->array_belongs_to_counts as $name => $info){
60
- if($info['type'] == "p"){
61
- $total_plugins++;
62
- }else if($info['type'] == "t"){
63
- $total_themes++;
64
- }
65
- }
66
- ?>
67
- <optgroup label="<?php echo __('Plugins','advanced-database-cleaner') . " (" . $total_plugins . ")" ?>">
68
- <?php
69
 
70
- foreach($this->array_belongs_to_counts as $name => $info){
71
- if($info['type'] == "p"){
72
- $selected = isset($_GET['belongs_to']) && $_GET['belongs_to'] == $name ? "selected='selected'" : "";
73
- echo "<option value='$name'" . $selected . ">" . $name . " (" . $info['count'] .")" . "</option>";
74
 
75
- }
76
- }
 
 
77
  ?>
78
- </optgroup>
79
- <optgroup label="<?php echo __('Themes','advanced-database-cleaner') . " (" . $total_themes . ")" ?>">
80
- <?php
81
- foreach($this->array_belongs_to_counts as $name => $info){
82
- if($info['type'] == "t"){
83
- $selected = isset($_GET['belongs_to']) && $_GET['belongs_to'] == $name ? "selected='selected'" : "";
84
- echo "<option value='$name'" . $selected . ">" . $name . " (" . $info['count'] .")" . "</option>";
85
- }
86
- }
87
  ?>
88
- </optgroup>
 
 
89
  </select>
90
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
91
  <?php
92
- if(function_exists('is_multisite') && is_multisite()){
93
- echo "<select name='site' style='font-size:13px;width:75px;height:30px;border:1px solid #e5e5e5;border-radius:2px;box-shadow:0 0 10px #f1f1f1;'>";
94
- echo "<option value=''>" . __('All sites','advanced-database-cleaner') . "</option>";
95
 
96
- global $wpdb;
97
- $blogs_ids = $wpdb->get_col("SELECT blog_id FROM $wpdb->blogs");
98
- foreach($blogs_ids as $blog_id){
99
- $blog_details = get_blog_details($blog_id);
100
- $selected = (isset($_GET['site']) && $_GET['site'] == $blog_id) ? "selected='selected'" : "";
101
- echo "<option value='$blog_id'". $selected .">" . __('Site','advanced-database-cleaner') . " ". $blog_id . " | " . $blog_details->blogname . "</option>";
102
- }
 
 
 
103
 
104
- echo "</select>";
 
 
105
 
106
  }
107
  ?>
108
 
109
- </fieldset>
110
 
111
- <span style="padding-left:5px;float:left">
112
- <input style="float:left;height:30px;width:50px;margin-top:0px" class="button-secondary" type="submit" value="<?php _e('Filter','advanced-database-cleaner') ?>"/>
113
- </span>
114
 
115
- </form>
116
 
117
- <span style="width:150px" class="aDBc_premium_tooltiptext"><?php _e('Available in Pro version!','advanced-database-cleaner') ?></span>
118
 
119
- </span>
120
- </div>
121
 
122
- <div style="float:right;padding:8px;height:30px">
 
 
123
 
124
- <form method="get">
125
 
126
- <?php
127
- // Generate current parameters in URL
128
- foreach($_GET as $name => $value){
129
- if($name != "per_page" && $name != "paged"){
130
- $name = esc_attr(sanitize_text_field($name));
131
- $value = esc_attr(sanitize_text_field($value));
132
- echo "<input type='hidden' name='$name' value='$value'/>";
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
133
  }
134
- }
135
- // Return paged to page 1
136
- echo "<input type='hidden' name='paged' value='1'/>";
137
- ?>
138
 
139
- <span style="padding-right:8px;float:left;font-size:13px;padding-top:5px"><?php _e('Items per page','advanced-database-cleaner') ?></span>
140
- <span style="padding-right:5px;float:left">
141
 
142
- <input type="number" style="font-size:13px;width:55px;height:30px;border:1px solid #e5e5e5;border-radius:2px;box-shadow:0 0 10px #f1f1f1;" id="revisions-search-input" name="per_page" value="<?php echo empty($_GET['per_page']) ? '50' : esc_attr($_GET['per_page']); ?>"/>
143
- </span>
144
 
145
- <span style="float:left">
146
- <input style="float:left;height:30px;" type="submit" class="button-secondary" value="<?php _e('Show','advanced-database-cleaner') ?>"/>
147
- </span>
148
  </form>
149
- </div>
150
 
151
- <?php
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
152
 
153
- if((!empty($_GET['s']) && trim($_GET['s']) != "") || !empty($_GET['t_type']) || !empty($_GET['belongs_to']) || !empty($_GET['site'])){
 
 
 
 
 
 
 
 
 
 
 
154
 
155
- $aDBc_new_URI = $_SERVER['REQUEST_URI'];
156
- // Remove args to delete custom filter
157
- $aDBc_new_URI = remove_query_arg(array('s', 't_type', 'belongs_to', 'site', 'autoload'), $aDBc_new_URI);
158
- $aDBc_new_URI = add_query_arg('aDBc_cat', 'all', $aDBc_new_URI);
159
  ?>
160
 
161
- <div style="clear:both;padding:5px 0px 8px 8px;">
162
- <a style="color:red" href="<?php echo $aDBc_new_URI; ?>"><?php _e('Delete custom filter','advanced-database-cleaner') ?></a>
163
- </div>
 
 
164
 
165
- <?php } ?>
 
 
166
 
167
  </div>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
168
  </div>
1
+ <!-- style et code ok -->
2
+ <div class="aDBc-filter-container">
3
 
4
+ <div class="aDBc-filter-section">
5
 
6
+ <span class="aDBc-premium-tooltip">
7
 
8
+ <?php
9
 
10
+ $free_style = "";
11
 
12
+ if ( ADBC_PLUGIN_PLAN == "free" ) {
13
+
14
+ $free_style = "aDBc-filter-pro-only";
15
+
16
+ }
17
+
18
+ ?>
19
+
20
+ <form class="<?php echo $free_style; ?>" method="get">
21
+
22
+ <?php
23
+ // Generate current parameters in URL
24
+ foreach ( $_GET as $name => $value ) {
25
+
26
+ if ( $name != "s" && $name != "paged" && $name != "aDBc_cat" ) {
27
+
28
+ $name = esc_attr( sanitize_text_field( $name ) );
29
+ $value = esc_attr( sanitize_text_field( $value ) );
30
+ echo "<input type='hidden' name='$name' value='$value'/>";
31
 
 
 
 
 
 
 
 
 
32
  }
33
+ }
34
+
35
+ // Return paged to "1" and aDBc_cat to "all" after each filter
36
+ echo "<input type='hidden' name='paged' value='1'/>";
37
+ echo "<input type='hidden' name='aDBc_cat' value='all'/>";
38
+ ?>
39
+
40
+ <div style="float:left;margin-right:4px">
41
+
42
+ <input class="aDBc-filter-search-input" type="search" placeholder="<?php _e( 'Search for', 'advanced-database-cleaner' ); ?>" name="s" value="<?php echo empty( $_GET['s'] ) ? '' : esc_attr( $_GET['s'] ); ?>"/>
43
+
44
+ <?php
45
+
46
+ // Show this filter tables type only for tables
47
+ if ( isset( $_GET['aDBc_tab'] ) && $_GET['aDBc_tab'] == 'tables' ) {
48
+
49
+ $all_selected = ( isset( $_GET['t_type'] ) && $_GET['t_type'] == 'all' ) ? "selected='selected'" : "";
50
+ $optimize_selected = ( isset( $_GET['t_type'] ) && $_GET['t_type'] == 'optimize' ) ? "selected='selected'" : "";
51
+ $repair_selected = ( isset( $_GET['t_type'] ) && $_GET['t_type'] == 'repair' ) ? "selected='selected'" : "";
52
+
53
  ?>
54
 
55
+ <select name="t_type" class="aDBc-filter-dropdown-menu" style="width:100px">
 
 
56
 
57
+ <option value="all" <?php echo $all_selected; ?>>
58
 
59
+ <?php _e( 'All tables', 'advanced-database-cleaner' ) ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
60
 
61
+ </option>
 
 
 
62
 
63
+ <option value="optimize" <?php echo $optimize_selected; ?>>
64
+
65
+ <?php
66
+ echo __( 'To optimize', 'advanced-database-cleaner' ) . " (" . count( $this->aDBc_tables_name_to_optimize ) . ")"
67
  ?>
68
+
69
+ </option>
70
+
71
+ <option value="repair" <?php echo $repair_selected; ?>>
72
+
73
+ <?php
74
+ echo __( 'To repair', 'advanced-database-cleaner' ) . " (" . count( $this->aDBc_tables_name_to_repair ) . ")"
 
 
75
  ?>
76
+
77
+ </option>
78
+
79
  </select>
80
 
81
+ <?php
82
+
83
+ }
84
+
85
+ // Show autoload only for options
86
+ if ( isset( $_GET['aDBc_tab'] ) && $_GET['aDBc_tab'] == 'options' ) {
87
+
88
+ $all_autoload = ( isset( $_GET['autoload'] ) && $_GET['autoload'] == 'all' ) ? "selected='selected'" : "";
89
+ $autoload_yes = ( isset( $_GET['autoload'] ) && $_GET['autoload'] == 'yes' ) ? "selected='selected'" : "";
90
+ $autoload_no = ( isset( $_GET['autoload'] ) && $_GET['autoload'] == 'no' ) ? "selected='selected'" : "";
91
+
92
+ ?>
93
+
94
+ <select name="autoload" class="aDBc-filter-dropdown-menu" style="width:100px">
95
+
96
+ <option value="all" <?php echo $all_autoload; ?>>
97
+
98
+ <?php _e( 'Autoload', 'advanced-database-cleaner' ); ?>
99
+
100
+ </option>
101
+
102
+ <option value="yes" <?php echo $autoload_yes; ?>>
103
+
104
+ <?php echo __( 'Yes', 'advanced-database-cleaner' ); ?>
105
+
106
+ </option>
107
+
108
+ <option value="no" <?php echo $autoload_no; ?>>
109
+
110
+ <?php echo __( 'No', 'advanced-database-cleaner' ); ?>
111
+
112
+ </option>
113
+
114
+ </select>
115
+
116
+ <?php
117
+ }
118
+ ?>
119
+
120
+ <select name="belongs_to" class="aDBc-filter-dropdown-menu" style="width:135px">
121
+
122
+ <option value="all">
123
+ <?php _e( 'All "belongs to"', 'advanced-database-cleaner' ); ?>
124
+ </option>
125
+
126
  <?php
 
 
 
127
 
128
+ $total_plugins = 0;
129
+ $total_themes = 0;
130
+
131
+ foreach ( $this->array_belongs_to_counts as $name => $info ) {
132
+
133
+ if ( $info['type'] == "p" ) {
134
+
135
+ $total_plugins++;
136
+
137
+ } elseif ( $info['type'] == "t" ) {
138
 
139
+ $total_themes++;
140
+
141
+ }
142
 
143
  }
144
  ?>
145
 
146
+ <optgroup label="<?php echo __( 'Plugins', 'advanced-database-cleaner' ) . " (" . $total_plugins . ")" ?>">
147
 
148
+ <?php
149
+ foreach ( $this->array_belongs_to_counts as $name => $info ) {
 
150
 
151
+ if ( $info['type'] == "p" ) {
152
 
153
+ $selected = isset( $_GET['belongs_to'] ) && $_GET['belongs_to'] == $name ? "selected='selected'" : "";
154
 
155
+ echo "<option value='$name'" . $selected . ">" . $name . " (" . $info['count'] .")" . "</option>";
 
156
 
157
+ }
158
+ }
159
+ ?>
160
 
161
+ </optgroup>
162
 
163
+ <optgroup label="<?php echo __( 'Themes', 'advanced-database-cleaner' ) . " (" . $total_themes . ")" ?>">
164
+
165
+ <?php
166
+ foreach ( $this->array_belongs_to_counts as $name => $info ) {
167
+
168
+ if ( $info['type'] == "t" ) {
169
+
170
+ $selected = isset( $_GET['belongs_to'] ) && $_GET['belongs_to'] == $name ? "selected='selected'" : "";
171
+
172
+ echo "<option value='$name'" . $selected . ">" . $name . " (" . $info['count'] .")" . "</option>";
173
+
174
+ }
175
+
176
+ }
177
+ ?>
178
+
179
+ </optgroup>
180
+
181
+ </select>
182
+
183
+ <?php
184
+ if ( function_exists( 'is_multisite' ) && is_multisite() ){
185
+ ?>
186
+ <select name="site" class="aDBc-filter-dropdown-menu" style="width:85px">
187
+
188
+ <option value=""> <?php _e( 'All sites', 'advanced-database-cleaner' ); ?> </option>
189
+
190
+ <?php
191
+ global $wpdb;
192
+ $blogs_ids = $wpdb->get_col( "SELECT blog_id FROM $wpdb->blogs" );
193
+
194
+ foreach ( $blogs_ids as $blog_id ) {
195
+
196
+ $blog_details = get_blog_details( $blog_id );
197
+
198
+ $selected = ( isset( $_GET['site'] ) && $_GET['site'] == $blog_id ) ? "selected='selected'" : "";
199
+
200
+ echo "<option value='$blog_id'". $selected .">" . __( 'Site', 'advanced-database-cleaner' ) . " ". $blog_id . " | " . $blog_details->blogname . "</option>";
201
+
202
+ }
203
+ ?>
204
+
205
+ </select>
206
+
207
+ <?php
208
  }
209
+ ?>
 
 
 
210
 
211
+ </div>
 
212
 
213
+ <input class="button-secondary aDBc-filter-botton" type="submit" value="<?php _e( 'Filter', 'advanced-database-cleaner' ); ?>"/>
 
214
 
 
 
 
215
  </form>
 
216
 
217
+ <?php
218
+ if ( ADBC_PLUGIN_PLAN == "free" ) {
219
+ ?>
220
+
221
+ <span style="width:150px" class="aDBc-premium-tooltiptext">
222
+
223
+ <?php _e( 'Available in Pro version!', 'advanced-database-cleaner' ); ?>
224
+
225
+ </span>
226
+
227
+ <?php
228
+ }
229
+ ?>
230
+
231
+ </span>
232
+ </div>
233
+
234
+ <!-- Items per page -->
235
+ <div class="aDBc-items-per-page">
236
+
237
+ <form method="get">
238
 
239
+ <?php
240
+ // Generate current parameters in URL
241
+ foreach ( $_GET as $name => $value ) {
242
+
243
+ if ( $name != "per_page" && $name != "paged" ) {
244
+
245
+ $name = esc_attr( sanitize_text_field( $name ) );
246
+ $value = esc_attr( sanitize_text_field( $value ) );
247
+ echo "<input type='hidden' name='$name' value='$value'/>";
248
+
249
+ }
250
+ }
251
 
252
+ // Return paged to page 1
253
+ echo "<input type='hidden' name='paged' value='1'/>";
 
 
254
  ?>
255
 
256
+ <span class="aDBc-items-per-page-label">
257
+ <?php _e( 'Items per page', 'advanced-database-cleaner' ); ?>
258
+ </span>
259
+
260
+ <input name="per_page" class="aDBc-items-per-page-input" type="number" value="<?php echo empty( $_GET['per_page'] ) ? '50' : esc_attr( $_GET['per_page'] ); ?>"/>
261
 
262
+ <input type="submit" class="button-secondary aDBc-show-botton" value="<?php _e( 'Show', 'advanced-database-cleaner' ); ?>"/>
263
+
264
+ </form>
265
 
266
  </div>
267
+
268
+ <?php
269
+ if ( ( ! empty( $_GET['s'] ) && trim( $_GET['s'] ) != "" ) ||
270
+ ! empty( $_GET['t_type'] ) ||
271
+ ! empty( $_GET['belongs_to'] ) ||
272
+ ! empty( $_GET['site'] )
273
+ ) {
274
+
275
+ // Remove args to delete custom filter
276
+ $aDBc_new_URI = $_SERVER['REQUEST_URI'];
277
+ $aDBc_new_URI = remove_query_arg( array( 's', 't_type', 'belongs_to', 'site', 'autoload' ), $aDBc_new_URI );
278
+ $aDBc_new_URI = add_query_arg( 'aDBc_cat', 'all', $aDBc_new_URI );
279
+ ?>
280
+
281
+ <div class="aDBc-delete-custom-filter">
282
+ <a style="color:red" href="<?php echo $aDBc_new_URI; ?>">
283
+ <?php _e( 'Delete custom filter', 'advanced-database-cleaner' ); ?>
284
+ </a>
285
+ </div>
286
+
287
+ <?php
288
+ }
289
+ ?>
290
+
291
  </div>
includes/license/ADBC_EDD_SL_Plugin_Updater.php CHANGED
@@ -516,7 +516,7 @@ class ADBC_EDD_SL_Plugin_Updater {
516
  }
517
 
518
  if( ! empty( $version_info ) && isset( $version_info->sections['changelog'] ) ) {
519
- echo '<div style="background:#fff;padding:10px;">' . $version_info->sections['changelog'] . '</div>';
520
  }
521
 
522
  exit;
516
  }
517
 
518
  if( ! empty( $version_info ) && isset( $version_info->sections['changelog'] ) ) {
519
+ echo '<div style="background:#fff;padding:10px">' . $version_info->sections['changelog'] . '</div>';
520
  }
521
 
522
  exit;
includes/license/adbc-edd-sample-plugin.php CHANGED
@@ -16,16 +16,16 @@ License URI: http://www.gnu.org/licenses/gpl-2.0.html
16
  ***************************************************************************************************************************/
17
 
18
  // this is the URL our updater / license checker pings. This should be the URL of the site with EDD installed
19
- define( 'ADBC_EDD_STORE_URL', 'https://sigmaplugin.com' ); // you should use your own CONSTANT name, and be sure to replace it throughout this file
20
 
21
  // the download ID for the product in Easy Digital Downloads
22
- define( 'ADBC_EDD_ITEM_ID', 10); // you should use your own CONSTANT name, and be sure to replace it throughout this file
23
 
24
  // the name of your product. This should match the download name in EDD exactly
25
- define( 'ADBC_EDD_ITEM_NAME', 'WordPress Advanced Database Cleaner' ); // you should use your own CONSTANT name, and be sure to replace it in this file
26
 
27
  // The name of the settings page for the license input to be displayed
28
- define( 'ADBC_EDD_PLUGIN_LICENSE_PAGE', 'advanced_db_cleaner&aDBc_tab=license' );
29
 
30
  if(!class_exists('ADBC_EDD_SL_Plugin_Updater')){
31
  // load our custom updater
@@ -38,12 +38,12 @@ function aDBc_edd_sl_plugin_updater(){
38
  $license_key = trim(get_option('aDBc_edd_license_key'));
39
 
40
  // setup the updater
41
- $edd_updater = new ADBC_EDD_SL_Plugin_Updater( ADBC_EDD_STORE_URL, ADBC_MAIN_PLUGIN_FILE_PATH, array(
42
  'version' => ADBC_PLUGIN_VERSION, // current version number
43
  'license' => $license_key, // license key (used get_option above to retrieve from DB)
44
  'item_id' => ADBC_EDD_ITEM_ID, // ID of the product
45
  'item_name' => ADBC_EDD_ITEM_NAME, // name of the product
46
- 'author' => 'Younes JFR.', // author of this plugin
47
  'beta' => false,
48
  )
49
  );
@@ -52,72 +52,84 @@ function aDBc_edd_sl_plugin_updater(){
52
  add_action('admin_init', 'aDBc_edd_sl_plugin_updater', 0);
53
 
54
  /**************************************************************************
55
- * the code below is just a standard options page. Substitute with your own.
56
  **************************************************************************/
57
- function aDBc_edd_license_page() {
58
- $license = get_option( 'aDBc_edd_license_key' );
59
- $status = get_option( 'aDBc_edd_license_status' );
60
- // When the user activates the license, hide it by stars like passwords
61
- if(!empty(trim($license)) && $status !== false && $status == 'valid'){
62
- $license_key_hidden = substr(trim($license), 0, 4) . "************************" . substr(trim($license), -4);
63
- }else{
64
- $license_key_hidden = esc_attr($license);
 
 
65
  }
66
  ?>
67
  <form method="post" action="options.php">
68
 
69
  <?php settings_fields('aDBc_edd_license'); ?>
70
 
71
- <table style="font-size:15px;text-align:left;" cellspacing="20px">
72
- <tr>
73
- <td>
74
- <b><?php _e('Enter your license key', 'advanced-database-cleaner'); ?></b>
75
- </td>
76
- <td>
77
- <input id="aDBc_edd_license_key" name="aDBc_edd_license_key" type="text" class="regular-text" value="<?php echo $license_key_hidden; ?>" />
78
- </td>
79
- <td>
80
- <input type="submit" name="submit" id="submit" class="button button-primary" value="<?php _e('Save new license key', 'advanced-database-cleaner'); ?>" />
81
- <?php //submit_button(); ?>
82
- </td>
83
- </tr>
84
-
85
- <?php if(false !== $license){ ?>
86
- <tr>
87
- <td>
88
- <b><?php _e('Activate license', 'advanced-database-cleaner'); ?></b>
89
- </td>
90
- <td>
91
-
92
- <?php if( $status !== false && $status == 'valid' ) { ?>
93
- <span style="color:green;font-size:13px; background:#eee;padding:4px 8px;vertical-align:middle;border:1px solid #f1f1f1"><b><?php _e('Active', 'advanced-database-cleaner'); ?></b></span>
94
- <?php wp_nonce_field( 'aDBc_edd_nonce', 'aDBc_edd_nonce' ); ?>
95
- <input style="vertical-align:middle" type="submit" class="button-secondary" name="aDBc_edd_license_deactivate" value="<?php _e('Deactivate license', 'advanced-database-cleaner'); ?>"/>
96
- <?php } else { ?>
97
- <span style="color:red;font-size:13px; background:#f9f9f9;padding:4px 8px;vertical-align:middle;border:1px solid #f1f1f1"><b><?php _e('Inactive', 'advanced-database-cleaner'); ?></b></span>
 
 
 
 
 
 
 
 
 
 
 
98
  <?php wp_nonce_field( 'aDBc_edd_nonce', 'aDBc_edd_nonce' ); ?>
99
- <input style="vertical-align:middle" type="submit" class="button-secondary" name="aDBc_edd_license_activate" value="<?php _e('Activate license', 'advanced-database-cleaner'); ?>"/>
100
- <?php } ?>
101
 
102
- </td>
103
- </tr>
104
- <?php } ?>
105
- </table>
106
 
 
 
 
 
107
  </form>
108
  <?php
109
  }
110
 
111
- function aDBc_edd_register_option() {
112
  // creates our settings in the options table
113
  register_setting('aDBc_edd_license', 'aDBc_edd_license_key', 'aDBc_edd_sanitize_license');
114
  }
115
  add_action('admin_init', 'aDBc_edd_register_option');
116
 
117
- function aDBc_edd_sanitize_license( $new ) {
118
- $old = get_option( 'aDBc_edd_license_key' );
119
- if( $old && $old != $new ) {
120
- delete_option( 'aDBc_edd_license_status' ); // new license has been entered, so must reactivate
121
  }
122
  return $new;
123
  }
@@ -126,7 +138,7 @@ function aDBc_edd_sanitize_license( $new ) {
126
  * this illustrates how to activate a license key
127
  ************************************************/
128
 
129
- function aDBc_edd_activate_license() {
130
 
131
  // listen for our activate button to be clicked
132
  if( isset( $_POST['aDBc_edd_license_activate'] ) ) {
@@ -316,7 +328,7 @@ function aDBc_edd_deactivate_license_after_uninstall() {
316
  }
317
 
318
  /*********************************************************************************************
319
- * this illustrates how to check if a license key is still valid the updater does this for you,
320
  * so this is only needed if you want to do something custom
321
  *********************************************************************************************/
322
  function aDBc_edd_check_license(){
16
  ***************************************************************************************************************************/
17
 
18
  // this is the URL our updater / license checker pings. This should be the URL of the site with EDD installed
19
+ define('ADBC_EDD_STORE_URL', 'https://sigmaplugin.com'); // you should use your own CONSTANT name, and be sure to replace it throughout this file
20
 
21
  // the download ID for the product in Easy Digital Downloads
22
+ define('ADBC_EDD_ITEM_ID', 10); // you should use your own CONSTANT name, and be sure to replace it throughout this file
23
 
24
  // the name of your product. This should match the download name in EDD exactly
25
+ define('ADBC_EDD_ITEM_NAME', 'WordPress Advanced Database Cleaner'); // you should use your own CONSTANT name, and be sure to replace it in this file
26
 
27
  // The name of the settings page for the license input to be displayed
28
+ define('ADBC_EDD_PLUGIN_LICENSE_PAGE', 'advanced_db_cleaner&aDBc_tab=license');
29
 
30
  if(!class_exists('ADBC_EDD_SL_Plugin_Updater')){
31
  // load our custom updater
38
  $license_key = trim(get_option('aDBc_edd_license_key'));
39
 
40
  // setup the updater
41
+ $edd_updater = new ADBC_EDD_SL_Plugin_Updater(ADBC_EDD_STORE_URL, ADBC_MAIN_PLUGIN_FILE_PATH, array(
42
  'version' => ADBC_PLUGIN_VERSION, // current version number
43
  'license' => $license_key, // license key (used get_option above to retrieve from DB)
44
  'item_id' => ADBC_EDD_ITEM_ID, // ID of the product
45
  'item_name' => ADBC_EDD_ITEM_NAME, // name of the product
46
+ 'author' => 'Younes JFR.', // author of this plugin
47
  'beta' => false,
48
  )
49
  );
52
  add_action('admin_init', 'aDBc_edd_sl_plugin_updater', 0);
53
 
54
  /**************************************************************************
55
+ * The code below is just a standard options page. Substitute with your own.
56
  **************************************************************************/
57
+ function aDBc_edd_license_page(){
58
+
59
+ $license = get_option('aDBc_edd_license_key');
60
+ $status = get_option('aDBc_edd_license_status');
61
+
62
+ // Hide license after activation
63
+ if ( ! empty( $license ) && $status !== false && $status == 'valid' ) {
64
+ $license_key_hidden = substr( $license, 0, 4 ) . "************************" . substr( $license, -4 );
65
+ } else {
66
+ $license_key_hidden = esc_attr( $license );
67
  }
68
  ?>
69
  <form method="post" action="options.php">
70
 
71
  <?php settings_fields('aDBc_edd_license'); ?>
72
 
73
+ <div class="aDBc-content-max-width aDBc-padding-20">
74
+
75
+ <div>
76
+
77
+ <span class="aDBc-license-label"><?php _e('Your license key', 'advanced-database-cleaner'); ?></span>
78
+
79
+ <input id="aDBc_edd_license_key" class="aDBc-license-key-input" name="aDBc_edd_license_key" type="text" value="<?php echo $license_key_hidden; ?>" />
80
+
81
+ <input id="submit" class="button button-primary aDBc-license-submit" name="submit" type="submit" value="<?php _e('Save license', 'advanced-database-cleaner'); ?>" />
82
+
83
+ </div>
84
+
85
+ <?php
86
+ if (false !== $license ) {
87
+ ?>
88
+
89
+ <div class="aDBc-margin-t-30">
90
+
91
+ <?php
92
+ if ( $status !== false && $status == 'valid' ) {
93
+ $license_status_class = "aDBc-license-active";
94
+ $license_status = __( 'Active', 'advanced-database-cleaner' );
95
+ $button_name = "aDBc_edd_license_deactivate";
96
+ $button_value = __( 'Deactivate license', 'advanced-database-cleaner' );
97
+ } else {
98
+ $license_status_class = "aDBc-license-inactive";
99
+ $license_status = __( 'Inactive', 'advanced-database-cleaner' );
100
+ $button_name = "aDBc_edd_license_activate";
101
+ $button_value = __( 'Activate license', 'advanced-database-cleaner' );
102
+ }
103
+ ?>
104
+
105
+ <span class="aDBc-license-label"></span>
106
+
107
+ <span class="<?php echo $license_status_class ?>"><b><?php echo $license_status ?></b></span>
108
+
109
+ <input type="submit" class="button-secondary aDBc-vertical-align-m" name="<?php echo $button_name ?>" value="<?php echo $button_value ?>"/>
110
+
111
  <?php wp_nonce_field( 'aDBc_edd_nonce', 'aDBc_edd_nonce' ); ?>
 
 
112
 
113
+ </div>
 
 
 
114
 
115
+ <?php
116
+ }
117
+ ?>
118
+ </div>
119
  </form>
120
  <?php
121
  }
122
 
123
+ function aDBc_edd_register_option(){
124
  // creates our settings in the options table
125
  register_setting('aDBc_edd_license', 'aDBc_edd_license_key', 'aDBc_edd_sanitize_license');
126
  }
127
  add_action('admin_init', 'aDBc_edd_register_option');
128
 
129
+ function aDBc_edd_sanitize_license($new){
130
+ $old = get_option('aDBc_edd_license_key');
131
+ if($old && $old != $new){
132
+ delete_option('aDBc_edd_license_status'); // new license has been entered, so must reactivate
133
  }
134
  return $new;
135
  }
138
  * this illustrates how to activate a license key
139
  ************************************************/
140
 
141
+ function aDBc_edd_activate_license(){
142
 
143
  // listen for our activate button to be clicked
144
  if( isset( $_POST['aDBc_edd_license_activate'] ) ) {
328
  }
329
 
330
  /*********************************************************************************************
331
+ * this illustrates how to check if a license key is still valid the updater does this for you,
332
  * so this is only needed if you want to do something custom
333
  *********************************************************************************************/
334
  function aDBc_edd_check_license(){
includes/overview_settings.php CHANGED
@@ -1,38 +1,36 @@
1
  <?php
 
2
  global $wpdb, $wp_version;
 
3
  // DB size
4
  $aDBc_db_size = $wpdb->get_var("SELECT sum(round(((data_length + index_length) / 1024), 2)) FROM information_schema.tables WHERE table_schema = '" . DB_NAME . "'");
 
5
  if($aDBc_db_size >= 1024){
6
  $aDBc_db_size = round(($aDBc_db_size / 1024), 2) . " MB";
7
  }else{
8
  $aDBc_db_size = round($aDBc_db_size, 2) . " KB";
9
  }
10
- // Total unused data
11
- $aDBc_unused_elements = aDBc_count_all_elements_to_clean();
12
- $aDBc_total_unused = 0;
13
- foreach($aDBc_unused_elements as $element_type => $element_info){
14
- // Count total unused elements. DO not take into account transient with expiration and not expiring transients because they are not intended to be cleaned
15
- if($element_type != "transients-with-expiration" && $element_type != "transients-with-no-expiration")
16
- $aDBc_total_unused += $element_info['count'];
17
- }
18
  // Total tables
19
  $aDBc_total_tables = $wpdb->get_var("SELECT count(*) FROM information_schema.tables WHERE table_schema = '" . DB_NAME . "'");
 
20
  // Total options
21
  if(function_exists('is_multisite') && is_multisite()){
22
-
23
  $aDBc_options_toolip = "<span class='aDBc-tooltips-headers'>
24
  <img class='aDBc-info-image' src='". ADBC_PLUGIN_DIR_PATH . '/images/information2.svg' . "'/>
25
  <span>" . __('Indicates the total number of rows in your option tables of all your network sites, including transients...','advanced-database-cleaner') ." </span>
26
- </span>";
27
-
28
  }else{
29
-
30
  $aDBc_options_toolip = "<span class='aDBc-tooltips-headers'>
31
  <img class='aDBc-info-image' src='". ADBC_PLUGIN_DIR_PATH . '/images/information2.svg' . "'/>
32
  <span>" . __('Indicates the total number of rows in your options table, including transients...','advanced-database-cleaner') ." </span>
33
- </span>";
34
-
35
  }
 
36
  // Total options
37
  $aDBc_total_options = 0;
38
  if(function_exists('is_multisite') && is_multisite()){
@@ -63,9 +61,6 @@ if(function_exists('is_multisite') && is_multisite()){
63
  }
64
  }
65
 
66
- // Total tables to optimize
67
- $aDBc_tables_to_optimize = $wpdb->get_var("SELECT count(*) FROM information_schema.tables WHERE table_schema = '" . DB_NAME . "' and Engine <> 'InnoDB' and data_free > 0");
68
-
69
  // Is MU?
70
  if(function_exists('is_multisite') && is_multisite()){
71
  $aDBc_is_mu = __('Yes', 'advanced-database-cleaner');
@@ -90,64 +85,95 @@ if(isset($_POST['save_settings'])){
90
  <div class="aDBc-content-max-width">
91
  <div class="aDBc-overview-box">
92
  <div class="aDBc-overview-box-head"><?php _e('Overview', 'advanced-database-cleaner'); ?></div>
93
- <ul class="aDBc-overview-box-line">
94
- <li>
95
- <div class="aDBc-overview-text-left"><?php _e('WP Version', 'advanced-database-cleaner'); ?> :</div>
96
- <div class="aDBc-overview-text-right"><?php echo $wp_version; ?></div>
97
- </li>
98
- <li>
99
- <div class="aDBc-overview-text-left"><?php _e('Database size', 'advanced-database-cleaner'); ?> :</div>
100
- <div class="aDBc-overview-text-right"><?php echo $aDBc_db_size; ?></div>
101
- </li>
102
  <li>
103
- <div class="<?php echo $aDBc_total_unused > 0 ? 'aDBc-overview-text-left-warning' : 'aDBc-overview-text-left'; ?>"><?php _e('Total unused data', 'advanced-database-cleaner'); ?> :</div>
104
- <div class="aDBc-overview-text-right"><?php echo $aDBc_total_unused; ?></div>
 
 
 
105
  </li>
 
106
  <li>
107
- <div class="aDBc-overview-text-left"><?php _e('Total tables', 'advanced-database-cleaner'); ?> :</div>
108
- <div class="aDBc-overview-text-right"><?php echo $aDBc_total_tables; ?></div>
 
 
 
109
  </li>
 
110
  <li>
111
- <div class="<?php echo $aDBc_tables_to_optimize > 0 ? 'aDBc-overview-text-left-warning' : 'aDBc-overview-text-left'; ?>"><?php _e('Tables to optimize', 'advanced-database-cleaner'); ?> :</div>
112
- <div class="aDBc-overview-text-right"><?php echo $aDBc_tables_to_optimize; ?></div>
 
 
 
113
  </li>
 
114
  <li>
115
- <div class="aDBc-overview-text-left"><?php echo __('Total options', 'advanced-database-cleaner') . $aDBc_options_toolip; ?> : </div>
116
- <div class="aDBc-overview-text-right"><?php echo $aDBc_total_options; ?></div>
 
 
 
117
  </li>
 
118
  <li>
119
- <div class="aDBc-overview-text-left"><?php _e('Total cron tasks', 'advanced-database-cleaner'); ?> :</div>
120
- <div class="aDBc-overview-text-right"><?php echo $aDBc_total_tasks; ?></div>
 
 
 
121
  </li>
 
122
  <li>
123
- <div class="aDBc-overview-text-left"><?php _e('WP multisite Enabled ?', 'advanced-database-cleaner'); ?></div>
124
- <div class="aDBc-overview-text-right"><?php echo $aDBc_is_mu; ?></div>
 
 
 
125
  </li>
 
126
  <li>
127
- <div class="aDBc-overview-text-left"><?php _e('Number of sites', 'advanced-database-cleaner'); ?> :</div>
128
- <div class="aDBc-overview-text-right"><?php echo $aDBc_number_sites; ?></div>
 
 
 
129
  </li>
 
130
  <li>
131
- <div class="aDBc-overview-text-left"><?php _e('Script Max timeout', 'advanced-database-cleaner'); ?> :</div>
132
- <div class="aDBc-overview-text-right"><?php echo ADBC_ORIGINAL_TIMEOUT . " ". __('seconds', 'advanced-database-cleaner'); ?></div>
 
 
 
133
  </li>
 
134
  <li>
135
- <div class="aDBc-overview-text-left"><?php _e('Local time', 'advanced-database-cleaner'); ?> :</div>
136
- <div class="aDBc-overview-text-right"><?php echo date_i18n('Y-m-d H:i:s'); ?></div>
 
 
 
137
  </li>
 
138
  </ul>
139
  </div>
140
 
141
  <div class="aDBc-overview-box">
142
- <div class="aDBc-overview-box-head"><?php _e('Settings', 'advanced-database-cleaner'); ?></div>
 
143
 
144
  <form action="" method="post">
145
- <ul class="aDBc-overview-box-line" style="margin-left:0px">
146
 
147
- <li style="background:#f9f9f9;margin-bottom:0px;padding:10px">
148
 
149
- <?php
150
- if((!empty($aDBc_settings['left_menu']) && $aDBc_settings['left_menu'] == '1') ||
 
 
151
  (empty($aDBc_settings['left_menu']) && empty($aDBc_settings['menu_under_tools']))){
152
  $aDBc_checked = "checked='checked'";
153
  }else{
@@ -162,7 +188,7 @@ if(isset($_POST['save_settings'])){
162
  </div>
163
  </li>
164
 
165
- <li style="background:#f9f9f9;margin-top:0px;padding:10px">
166
  <input type="checkbox" name="aDBc_menu_under_tools" <?php echo (!empty($aDBc_settings['menu_under_tools']) && $aDBc_settings['menu_under_tools'] == '1') ? "checked='checked'" : ""?>/>
167
  <?php _e('Show plugin menu under tools', 'advanced-database-cleaner'); ?>
168
  <div class="aDBc-overview-setting-desc">
@@ -170,17 +196,30 @@ if(isset($_POST['save_settings'])){
170
  </div>
171
  </li>
172
 
173
- <li>
174
- <input type="checkbox" name="aDBc_hide_premium_tab" <?php echo (!empty($aDBc_settings['hide_premium_tab']) && $aDBc_settings['hide_premium_tab']) == '1' ? "checked='checked'" : ""?>/>
175
- <?php _e('Hide premium tab', 'advanced-database-cleaner'); ?>
176
- <div class="aDBc-overview-setting-desc">
177
- <?php _e('If checked, it will hide the above premium tab', 'advanced-database-cleaner'); ?>
178
- </div>
179
- </li>
 
 
 
 
 
 
 
 
180
 
181
  </ul>
182
- <input name="save_settings" type="submit" class="button-primary aDBc-save-settings-button" value="<?php _e('Save settings','advanced-database-cleaner'); ?>" />
 
 
183
  </form>
 
184
  </div>
 
185
  <div class="aDBc-clear-both"></div>
186
- </div>
 
1
  <?php
2
+
3
  global $wpdb, $wp_version;
4
+
5
  // DB size
6
  $aDBc_db_size = $wpdb->get_var("SELECT sum(round(((data_length + index_length) / 1024), 2)) FROM information_schema.tables WHERE table_schema = '" . DB_NAME . "'");
7
+
8
  if($aDBc_db_size >= 1024){
9
  $aDBc_db_size = round(($aDBc_db_size / 1024), 2) . " MB";
10
  }else{
11
  $aDBc_db_size = round($aDBc_db_size, 2) . " KB";
12
  }
13
+
 
 
 
 
 
 
 
14
  // Total tables
15
  $aDBc_total_tables = $wpdb->get_var("SELECT count(*) FROM information_schema.tables WHERE table_schema = '" . DB_NAME . "'");
16
+
17
  // Total options
18
  if(function_exists('is_multisite') && is_multisite()){
19
+
20
  $aDBc_options_toolip = "<span class='aDBc-tooltips-headers'>
21
  <img class='aDBc-info-image' src='". ADBC_PLUGIN_DIR_PATH . '/images/information2.svg' . "'/>
22
  <span>" . __('Indicates the total number of rows in your option tables of all your network sites, including transients...','advanced-database-cleaner') ." </span>
23
+ </span>";
24
+
25
  }else{
26
+
27
  $aDBc_options_toolip = "<span class='aDBc-tooltips-headers'>
28
  <img class='aDBc-info-image' src='". ADBC_PLUGIN_DIR_PATH . '/images/information2.svg' . "'/>
29
  <span>" . __('Indicates the total number of rows in your options table, including transients...','advanced-database-cleaner') ." </span>
30
+ </span>";
31
+
32
  }
33
+
34
  // Total options
35
  $aDBc_total_options = 0;
36
  if(function_exists('is_multisite') && is_multisite()){
61
  }
62
  }
63
 
 
 
 
64
  // Is MU?
65
  if(function_exists('is_multisite') && is_multisite()){
66
  $aDBc_is_mu = __('Yes', 'advanced-database-cleaner');
85
  <div class="aDBc-content-max-width">
86
  <div class="aDBc-overview-box">
87
  <div class="aDBc-overview-box-head"><?php _e('Overview', 'advanced-database-cleaner'); ?></div>
88
+ <ul>
89
+
 
 
 
 
 
 
 
90
  <li>
91
+ <div class="aDBc-overview-text-left">
92
+ <span class="dashicons dashicons-yes aDBc-overview-dashicon"></span>
93
+ <?php _e('WP Version', 'advanced-database-cleaner'); ?> :
94
+ </div>
95
+ <div class="aDBc-float-left"><?php echo $wp_version ?></div>
96
  </li>
97
+
98
  <li>
99
+ <div class="aDBc-overview-text-left">
100
+ <span class="dashicons dashicons-yes aDBc-overview-dashicon"></span>
101
+ <?php _e('Database size', 'advanced-database-cleaner'); ?> :
102
+ </div>
103
+ <div class="aDBc-float-left"><?php echo $aDBc_db_size ?></div>
104
  </li>
105
+
106
  <li>
107
+ <div class="aDBc-overview-text-left">
108
+ <span class="dashicons dashicons-yes aDBc-overview-dashicon"></span>
109
+ <?php _e('Total tables', 'advanced-database-cleaner'); ?> :
110
+ </div>
111
+ <div class="aDBc-float-left"><?php echo $aDBc_total_tables ?></div>
112
  </li>
113
+
114
  <li>
115
+ <div class="aDBc-overview-text-left">
116
+ <span class="dashicons dashicons-yes aDBc-overview-dashicon"></span>
117
+ <?php echo __('Total options', 'advanced-database-cleaner') . $aDBc_options_toolip ?> :
118
+ </div>
119
+ <div class="aDBc-float-left"><?php echo $aDBc_total_options ?></div>
120
  </li>
121
+
122
  <li>
123
+ <div class="aDBc-overview-text-left">
124
+ <span class="dashicons dashicons-yes aDBc-overview-dashicon"></span>
125
+ <?php _e('Total cron tasks', 'advanced-database-cleaner'); ?> :
126
+ </div>
127
+ <div class="aDBc-float-left"><?php echo $aDBc_total_tasks ?></div>
128
  </li>
129
+
130
  <li>
131
+ <div class="aDBc-overview-text-left">
132
+ <span class="dashicons dashicons-yes aDBc-overview-dashicon"></span>
133
+ <?php _e('WP multisite Enabled ?', 'advanced-database-cleaner'); ?>
134
+ </div>
135
+ <div class="aDBc-float-left"><?php echo $aDBc_is_mu ?></div>
136
  </li>
137
+
138
  <li>
139
+ <div class="aDBc-overview-text-left">
140
+ <span class="dashicons dashicons-yes aDBc-overview-dashicon"></span>
141
+ <?php _e('Number of sites', 'advanced-database-cleaner'); ?> :
142
+ </div>
143
+ <div class="aDBc-float-left"><?php echo $aDBc_number_sites ?></div>
144
  </li>
145
+
146
  <li>
147
+ <div class="aDBc-overview-text-left">
148
+ <span class="dashicons dashicons-yes aDBc-overview-dashicon"></span>
149
+ <?php _e('Script Max timeout', 'advanced-database-cleaner'); ?> :
150
+ </div>
151
+ <div class="aDBc-float-left"><?php echo ADBC_ORIGINAL_TIMEOUT . " ". __('seconds', 'advanced-database-cleaner') ?></div>
152
  </li>
153
+
154
  <li>
155
+ <div class="aDBc-overview-text-left">
156
+ <span class="dashicons dashicons-yes aDBc-overview-dashicon"></span>
157
+ <?php _e('Local time', 'advanced-database-cleaner'); ?> :
158
+ </div>
159
+ <div class="aDBc-float-left"><?php echo date_i18n('Y-m-d H:i:s') ?></div>
160
  </li>
161
+
162
  </ul>
163
  </div>
164
 
165
  <div class="aDBc-overview-box">
166
+
167
+ <div class="aDBc-overview-box-head"><?php _e('Settings', 'advanced-database-cleaner') ?></div>
168
 
169
  <form action="" method="post">
 
170
 
171
+ <ul>
172
 
173
+ <li style="padding-top:10px;padding-bottom:20px">
174
+
175
+ <?php
176
+ if((!empty($aDBc_settings['left_menu']) && $aDBc_settings['left_menu'] == '1') ||
177
  (empty($aDBc_settings['left_menu']) && empty($aDBc_settings['menu_under_tools']))){
178
  $aDBc_checked = "checked='checked'";
179
  }else{
188
  </div>
189
  </li>
190
 
191
+ <li style="padding-bottom:10px">
192
  <input type="checkbox" name="aDBc_menu_under_tools" <?php echo (!empty($aDBc_settings['menu_under_tools']) && $aDBc_settings['menu_under_tools'] == '1') ? "checked='checked'" : ""?>/>
193
  <?php _e('Show plugin menu under tools', 'advanced-database-cleaner'); ?>
194
  <div class="aDBc-overview-setting-desc">
196
  </div>
197
  </li>
198
 
199
+ <?php
200
+ if ( ADBC_PLUGIN_PLAN == "free" ) {
201
+ ?>
202
+
203
+ <li>
204
+ <input type="checkbox" name="aDBc_hide_premium_tab" <?php echo (!empty($aDBc_settings['hide_premium_tab']) && $aDBc_settings['hide_premium_tab']) == '1' ? "checked='checked'" : ""?>/>
205
+ <?php _e('Hide premium tab', 'advanced-database-cleaner'); ?>
206
+ <div class="aDBc-overview-setting-desc">
207
+ <?php _e('If checked, it will hide the above premium tab', 'advanced-database-cleaner'); ?>
208
+ </div>
209
+ </li>
210
+
211
+ <?php
212
+ }
213
+ ?>
214
 
215
  </ul>
216
+
217
+ <input name="save_settings" type="submit" class="button-primary aDBc-save-settings" value="<?php _e('Save settings','advanced-database-cleaner'); ?>" />
218
+
219
  </form>
220
+
221
  </div>
222
+
223
  <div class="aDBc-clear-both"></div>
224
+
225
+ </div>
includes/premium_page.php CHANGED
@@ -1,49 +1,109 @@
1
- <div class="aDBc-content-max-width" style="margin-top:10px">
 
 
 
2
  <div class="aDBc-vertical-box">
3
- <div class="aDBc-vertical-box-head"><?php _e('Need more features ?', 'advanced-database-cleaner'); ?></div>
4
- <div class="aDBc-vertical-box-line1"><?php _e('Find more advanced features!', 'advanced-database-cleaner'); ?></div>
5
- <div class="aDBc-vertical-box-line2">
6
- <img src="<?php echo ADBC_PLUGIN_DIR_PATH . '/images/features.png'?>"/>
7
- </div>
8
- <div class="aDBc-margin-t-20">
 
 
 
9
  <ul>
10
- <li class="aDBc-check-list"><?php _e('Filter & search specific items', 'advanced-database-cleaner'); ?></li>
11
- <li class="aDBc-check-list"><?php _e('Detect orphaned options', 'advanced-database-cleaner'); ?></li>
12
- <li class="aDBc-check-list"><?php _e('Detect orphaned tables', 'advanced-database-cleaner'); ?></li>
13
- <li class="aDBc-check-list"><?php _e('Detect orphaned cron tasks', 'advanced-database-cleaner'); ?></li>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
14
  </ul>
 
15
  </div>
 
16
  </div>
17
 
18
  <div class="aDBc-vertical-box">
19
- <div class="aDBc-vertical-box-head"><?php _e('Need support as well ?', 'advanced-database-cleaner'); ?></div>
20
- <div class="aDBc-vertical-box-line1"><?php _e('We are available to support you!', 'advanced-database-cleaner'); ?></div>
21
- <div class="aDBc-vertical-box-line2">
22
- <img src="<?php echo ADBC_PLUGIN_DIR_PATH . '/images/help.png'?>"/>
23
- </div>
24
- <div class="aDBc-margin-t-20">
 
 
 
25
  <ul>
26
- <li class="aDBc-check-list"><?php _e('Get quick support', 'advanced-database-cleaner'); ?></li>
27
- <li class="aDBc-check-list"><?php _e('Get technical support', 'advanced-database-cleaner'); ?></li>
28
- <li class="aDBc-check-list"><?php _e('No additional fees', 'advanced-database-cleaner'); ?></li>
29
- <li class="aDBc-check-list"><?php _e('Great support service!', 'advanced-database-cleaner'); ?></li>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
30
  </ul>
 
31
  </div>
 
32
  </div>
33
 
34
  <div class="aDBc-vertical-box">
35
- <a href="https://sigmaplugin.com/downloads/wordpress-advanced-database-cleaner" target="_blank">
36
- <div class="aDBc-vertical-box-head"><?php _e('Buy now!', 'advanced-database-cleaner'); ?></div>
37
- </a>
38
- <div class="aDBc-vertical-box-line1"><?php _e('Buy now and get all pro features!', 'advanced-database-cleaner'); ?></div>
39
- <a href="https://sigmaplugin.com/downloads/wordpress-advanced-database-cleaner" target="_blank">
40
- <div class="aDBc-vertical-box-line2">
41
- <img src="<?php echo ADBC_PLUGIN_DIR_PATH . '/images/premium_ok.png'?>"/>
42
- </div>
43
- <div class="aDBc-vertical-box-line2">
44
- <img src="<?php echo ADBC_PLUGIN_DIR_PATH . '/images/order_now.png'?>"/>
45
- </div>
46
- </a>
 
 
 
 
 
 
 
 
 
 
 
 
 
47
  </div>
48
 
49
  <div class="aDBc-clear-both"></div>
1
+ <!-- style et code ok -->
2
+
3
+ <div class="aDBc-content-max-width aDBc-margin-t-20">
4
+
5
  <div class="aDBc-vertical-box">
6
+
7
+ <div><?php _e( 'Need more features ?', 'advanced-database-cleaner' ); ?></div>
8
+
9
+ <div><?php _e( 'Find more advanced features!', 'advanced-database-cleaner' ); ?></div>
10
+
11
+ <div><img class="aDBc-premium-img" src="<?php echo ADBC_PLUGIN_DIR_PATH . '/images/features.png'?>"/></div>
12
+
13
+ <div>
14
+
15
  <ul>
16
+
17
+ <li>
18
+ <span class="dashicons dashicons-yes"></span>
19
+ <?php _e( 'Filter & search specific items', 'advanced-database-cleaner' ); ?>
20
+ </li>
21
+
22
+ <li>
23
+ <span class="dashicons dashicons-yes"></span>
24
+ <?php _e( 'Detect orphaned options', 'advanced-database-cleaner' ); ?>
25
+ </li>
26
+
27
+ <li>
28
+ <span class="dashicons dashicons-yes"></span>
29
+ <?php _e( 'Detect orphaned tables', 'advanced-database-cleaner' ); ?>
30
+ </li>
31
+
32
+ <li>
33
+ <span class="dashicons dashicons-yes"></span>
34
+ <?php _e( 'Detect orphaned cron tasks', 'advanced-database-cleaner' ); ?>
35
+ </li>
36
+
37
  </ul>
38
+
39
  </div>
40
+
41
  </div>
42
 
43
  <div class="aDBc-vertical-box">
44
+
45
+ <div><?php _e( 'Need support as well ?', 'advanced-database-cleaner' ); ?></div>
46
+
47
+ <div><?php _e( 'We are available to support you!', 'advanced-database-cleaner' ); ?></div>
48
+
49
+ <div><img class="aDBc-premium-img" src="<?php echo ADBC_PLUGIN_DIR_PATH . '/images/help.png'?>"/></div>
50
+
51
+ <div>
52
+
53
  <ul>
54
+
55
+ <li>
56
+ <span class="dashicons dashicons-yes"></span>
57
+ <?php _e( 'Get quick support', 'advanced-database-cleaner' ); ?>
58
+ </li>
59
+
60
+ <li>
61
+ <span class="dashicons dashicons-yes"></span>
62
+ <?php _e( 'Get technical support', 'advanced-database-cleaner' ); ?>
63
+ </li>
64
+
65
+ <li>
66
+ <span class="dashicons dashicons-yes"></span>
67
+ <?php _e( 'No additional fees', 'advanced-database-cleaner' ); ?>
68
+ </li>
69
+
70
+ <li>
71
+ <span class="dashicons dashicons-yes"></span>
72
+ <?php _e( 'Great support service!', 'advanced-database-cleaner' ); ?>
73
+ </li>
74
+
75
  </ul>
76
+
77
  </div>
78
+
79
  </div>
80
 
81
  <div class="aDBc-vertical-box">
82
+
83
+ <?php
84
+ $product_url = "https://sigmaplugin.com/downloads/wordpress-advanced-database-cleaner";
85
+ ?>
86
+
87
+ <div>
88
+ <a href="<?php echo $product_url; ?>" target="_blank"><?php _e( 'Buy now!', 'advanced-database-cleaner' ); ?></a>
89
+ </div>
90
+
91
+ <div><?php _e( 'Buy now and get all pro features!', 'advanced-database-cleaner' ); ?></div>
92
+
93
+ <div>
94
+ <a href="<?php echo $product_url; ?>" target="_blank">
95
+ <img class="aDBc-premium-img" src="<?php echo ADBC_PLUGIN_DIR_PATH . '/images/premium_ok.png'?>"/>
96
+ </a>
97
+ </div>
98
+
99
+ <div>
100
+ <a href="<?php echo $product_url; ?>" target="_blank">
101
+ <div class="aDBc-purchase-btn">
102
+ <img src="<?php echo ADBC_PLUGIN_DIR_PATH . '/images/order_now.png'?>"/>
103
+ </div>
104
+ </a>
105
+ </div>
106
+
107
  </div>
108
 
109
  <div class="aDBc-clear-both"></div>
includes/sidebar.php CHANGED
@@ -1,23 +1,33 @@
1
- <div style="margin-top:10px">
 
2
 
3
- <div id="aDBc-upgrade">
4
 
5
  <a target="_blank" href="https://sigmaplugin.com/downloads/wordpress-advanced-database-cleaner">
6
 
7
- <img style="width:80px" src="<?php echo ADBC_PLUGIN_DIR_PATH; ?>/images/premium.svg" />
8
 
9
- <h1 style="padding-top:20px;padding-bottom:5px"><?php _e('Upgrade to Pro', 'advanced-database-cleaner'); ?></h1>
10
 
11
  <ul>
12
- <li><span class="dashicons dashicons-yes"></span> <?php _e('Filter & search specific items', 'advanced-database-cleaner'); ?></li>
13
- <li><span class="dashicons dashicons-yes"></span> <?php _e('Detect orphaned options', 'advanced-database-cleaner'); ?></li>
14
- <li><span class="dashicons dashicons-yes"></span> <?php _e('Detect orphaned tables', 'advanced-database-cleaner'); ?></li>
15
- <li><span class="dashicons dashicons-yes"></span> <?php _e('Detect orphaned cron tasks', 'advanced-database-cleaner'); ?></li>
16
- <li><span class="dashicons dashicons-yes"></span> <?php _e('Premium & technical support', 'advanced-database-cleaner'); ?></li>
 
 
 
 
 
 
17
  </ul>
18
-
19
-
20
- <div style="text-align:center;border-top:1px dashed #ccc;padding:10px;color:#999"><?php echo __('The price will increase soon! Buy now at lower price!', 'advanced-database-cleaner' ); ?></div>
 
 
 
21
 
22
  </a>
23
 
1
+ <!-- style et code ok -->
2
+ <div class="aDBc-sidebar">
3
 
4
+ <div class="aDBc-upgrade">
5
 
6
  <a target="_blank" href="https://sigmaplugin.com/downloads/wordpress-advanced-database-cleaner">
7
 
8
+ <img src="<?php echo ADBC_PLUGIN_DIR_PATH; ?>/images/premium.svg" />
9
 
10
+ <h3><?php _e( 'Upgrade to Pro', 'advanced-database-cleaner' ); ?></h3>
11
 
12
  <ul>
13
+
14
+ <li><span class="dashicons dashicons-yes"></span> <?php _e( 'Filter & search specific items', 'advanced-database-cleaner' ); ?></li>
15
+
16
+ <li><span class="dashicons dashicons-yes"></span> <?php _e( 'Detect orphaned options', 'advanced-database-cleaner' ); ?></li>
17
+
18
+ <li><span class="dashicons dashicons-yes"></span> <?php _e( 'Detect orphaned tables', 'advanced-database-cleaner' ); ?></li>
19
+
20
+ <li><span class="dashicons dashicons-yes"></span> <?php _e( 'Detect orphaned cron tasks', 'advanced-database-cleaner' ); ?></li>
21
+
22
+ <li><span class="dashicons dashicons-yes"></span> <?php _e( 'Premium & technical support', 'advanced-database-cleaner' ); ?></li>
23
+
24
  </ul>
25
+
26
+ <div>
27
+
28
+ <?php echo __( 'The price will increase soon! Buy now at lower price!', 'advanced-database-cleaner' ); ?>
29
+
30
+ </div>
31
 
32
  </a>
33
 
js/admin.js CHANGED
@@ -18,16 +18,144 @@ jQuery(document).ready(function(){
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
@@ -71,7 +199,7 @@ jQuery(document).ready(function(){
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();
@@ -85,65 +213,135 @@ jQuery(document).ready(function(){
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");
142
- jQuery('.aDBc_keep_link').css("color", "#eee");
143
 
144
  });
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];
@@ -155,9 +353,9 @@ jQuery(document).ready(function(){
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");
160
- jQuery('.aDBc_keep_link').css("color", "");
161
 
162
  });
163
 
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
+ // Get items type from hidden input in the page
24
+ var aDBc_item_type = jQuery("#aDBc_item_type").attr('value');
25
+
26
+ if(aDBc_item_type == "tables" || aDBc_item_type == "options" || aDBc_item_type == "tasks"){
27
+ var iteration = jQuery("#aDBc_iteration").attr('value');
28
+ // After reload page, check if we should call ajax processing, if so, proceed even before clicking "continue" btn after timeout
29
+ if(iteration != ""){
30
+ // Since we continue scan, not need to send parameters
31
+ startOrContinueScan("", "");
32
+ }
33
+ }
34
+
35
+ jQuery('#aDBc_new_search_button').on('click', function(e){
36
+
37
+ e.preventDefault();
38
+
39
+ // Get counts of all items and uncategorized from hidden inputs
40
+ var aDBc_count_all_items = jQuery("#aDBc_count_all_items").attr('value');
41
+ var aDBc_count_uncategorized = jQuery("#aDBc_count_uncategorized").attr('value');
42
+
43
+ // Choose what to show in the dialog box according to the number of items to scan
44
+ if(aDBc_count_uncategorized == 0 || aDBc_count_uncategorized == aDBc_count_all_items){
45
+ var aDBc_text = aDBc_ajax_obj.scan_all_only;
46
+ var aDBc_scan = aDBc_ajax_obj.all_items2;
47
+ }else{
48
+ var aDBc_text = aDBc_ajax_obj.scan_all_or_u;
49
+ var aDBc_scan = aDBc_ajax_obj.all_items;
50
+ }
51
+
52
+ Swal.fire({
53
+ text : aDBc_text,
54
+ footer : '<font size="2px" color="grey">' + aDBc_ajax_obj.scan_time_depends + '</font>',
55
+ icon : "question",
56
+ showCloseButton : true,
57
+ showCancelButton : true,
58
+
59
+ confirmButtonText : aDBc_scan + ' (' + aDBc_count_all_items + ')',
60
+ confirmButtonColor : '#0085ba',
61
+
62
+ cancelButtonText : aDBc_ajax_obj.uncategorized + ' (' + aDBc_count_uncategorized + ')',
63
+ cancelButtonColor : '#555',
64
+
65
+ // Test if aDBc_count_uncategorized == 0 or aDBc_count_uncategorized == aDBc_count_all_items, disable uncategorized button
66
+ onOpen: () => {
67
+ if(aDBc_count_uncategorized == 0 || aDBc_count_uncategorized == aDBc_count_all_items){
68
+ jQuery('.swal2-cancel').hide();
69
+ }
70
+ }
71
+
72
+ }).then((result) => {
73
+ // If the user clicked on "confirm" which is "All items"
74
+ if(result.value){
75
+
76
+ startOrContinueScan("scan_all", "");
77
+
78
+ }else if(result.dismiss === Swal.DismissReason.cancel){
79
+
80
+ startOrContinueScan("scan_uncategorized", "");
81
+
82
+ }
83
+ })
84
+
85
+ return false;
86
  });
87
 
88
+ // This function starts/continue a scan, only one of the two parameters will have a value, the other one will be empty
89
+ // If aDBc_scan_type not empty => the user wants to scan all items or uncategorized ones
90
+ // if aDBc_items_to_scan not empty => the user want to scan specific selected items
91
+ // If both empty => the scan should continue
92
+ function startOrContinueScan(aDBc_scan_type, aDBc_items_to_scan){
93
+
94
+ // Disable all buttons ont the page to prevent clicking on them + Change scan button
95
+ jQuery('#aDBc_new_search_button').attr("value", aDBc_ajax_obj.sentence_scanning);
96
+ jQuery('#aDBc_new_search_button').css('background-image', 'url(' + aDBc_ajax_obj.images_path + 'loading20px.svg)');
97
+ jQuery('#aDBc_new_search_button').attr("disabled", true);
98
+
99
+ // Show progress bar
100
+ jQuery('#aDBc-progress-container').show();
101
+ jQuery('#aDBc-progress-bar').html("0%");
102
+
103
+ jQuery.ajax({
104
+ type : "post",
105
+ url: aDBc_ajax_obj.ajaxurl,
106
+ cache: false,
107
+ data: {
108
+ 'action' : 'aDBc_new_run_search_for_items',
109
+ 'aDBc_item_type' : aDBc_item_type,
110
+ 'aDBc_scan_type' : aDBc_scan_type,
111
+ 'aDBc_items_to_scan' : aDBc_items_to_scan
112
+ },
113
+ success: function(result) {
114
+
115
+ jQuery('#aDBc-progress-bar').html("100 %");
116
+ jQuery('#aDBc-progress-bar').css("width", "100%");
117
+
118
+ },
119
+ complete: function(){
120
+ // wait for 1 sec then reload the page.
121
+ setTimeout(function(){location.reload();}, 1000);
122
+ }
123
+ });
124
+ setTimeout(getProgress, 500);
125
+
126
+ }
127
+
128
+ function getProgress(){
129
+
130
+ jQuery.ajax({
131
+ type : "post",
132
+ url: aDBc_ajax_obj.ajaxurl,
133
+ data: {
134
+ 'action': 'aDBc_get_progress_bar_width'
135
+ },
136
+ dataType : 'json',
137
+ success: function(result) {
138
+ var current = result['aDBc_progress'];
139
+ var total = result['aDBc_total_items'];
140
+ // xxx to delete console log
141
+ // console.log(result);
142
+ if(total > 0){
143
+ jQuery('#aDBc-progress-bar').html(parseInt(current * (100/total)) + "%");
144
+ jQuery('#aDBc-progress-bar').css("width", parseInt(current * (100/total)) + "%");
145
+ }
146
+ setTimeout(getProgress, 2000);
147
+ }
148
+ });
149
+ }
150
+
151
+ // Scan specific selected items
152
  jQuery('#doaction, #doaction2').on('click', function(e){
153
 
154
  // Get action from the clicked button
155
  if(this.id == 'doaction'){
156
+ var aDBc_action = jQuery("#bulk-action-selector-top").val();
157
  }else if(this.id == 'doaction2'){
158
+ var aDBc_action = jQuery('#bulk-action-selector-bottom').val();
159
  }
160
 
161
  // Get values of top_action and bottom action
199
  jQuery('input[name="aDBc_elements_to_process[]"]:checked').each(function(){aDBc_elements_to_process.push(this.value);});
200
 
201
  // If no items selected, show error message
202
+ if(aDBc_elements_to_process.length === 0){
203
 
204
  // Prevent doaction button from its default behaviour
205
  e.preventDefault();
213
 
214
  }else{
215
 
216
+ // Test if the user has selected "scan_selected" action
217
+ if(aDBc_action == "scan_selected"){
218
 
219
+ // Prevent doaction button from its default behaviour if the action is "scan_selected"
 
 
 
 
 
 
 
 
220
  e.preventDefault();
221
 
222
+ // Disable all buttons ont the page to prevent clicking on them + Change scan button
223
+ jQuery("#doaction").attr("disabled", true);
224
+ jQuery("#doaction2").attr("disabled", true);
225
+
226
+ startOrContinueScan("", aDBc_elements_to_process);
227
+
228
+ }else{
229
+
230
+ // The default warning msg to show is
231
+ var message_to_show = aDBc_ajax_obj.clean_items_warning;
232
+
233
+ // If 'empty' action is selected for tables, override the warning msg
234
+ if(aDBc_action == 'empty'){
235
+ var message_to_show = aDBc_ajax_obj.empty_tables_warning;
236
+ }
237
+
238
+ // We show the warning box msg only when actions such as: delete, clean, empty... are selected
239
+ if(aDBc_action == 'delete' || aDBc_action == 'clean' || aDBc_action == 'empty'){
240
+
241
+ // Prevent doaction button from its default behaviour
242
+ e.preventDefault();
243
+
244
+ Swal.fire({
245
+ title : '<font size="4px">' + aDBc_ajax_obj.are_you_sure + '</font>',
246
+ text : message_to_show,
247
+ footer : '<font size="3px" color="red"><b>' + aDBc_ajax_obj.make_db_backup_first + '</b></font>',
248
+ imageUrl : aDBc_ajax_obj.images_path + 'alert_delete.svg',
249
+ imageWidth : 60,
250
+ imageHeight : 60,
251
+ showCancelButton : true,
252
+ showCloseButton : true,
253
+ cancelButtonText : aDBc_ajax_obj.cancel,
254
+ cancelButtonColor : '#555',
255
+ confirmButtonText : aDBc_ajax_obj.Continue,
256
+ confirmButtonColor : '#0085ba',
257
+ focusCancel : true,
258
+ }).then((result) => {
259
+ // If the user clicked on "confirm", submit the form
260
+ if(result.value){
261
+ jQuery("#aDBc_form").submit();
262
+ }
263
+ })
264
+ }
265
  }
266
  }
267
  }
268
  });
269
 
270
+ // Perform double check of items against server database to enhance accuracy
271
+ /*jQuery('#aDBc_double_check').on('click', function(e){
272
+
273
+ var me = jQuery(this);
274
+ e.preventDefault();
275
+
276
+ me.css('background-image', 'url(' + aDBc_ajax_obj.images_path + 'loading20px.svg)');
277
+ me.attr("disabled", true);
278
+ jQuery('#aDBc_double_check_sentence').show();
279
+ jQuery('#aDBc_double_check_ignore_link').hide();
280
+
281
+ jQuery.ajax({
282
+ type : "post",
283
+ url: aDBc_ajax_obj.ajaxurl,
284
+ cache: false,
285
+ data: {
286
+ 'action': 'aDBc_double_check_items',
287
+ 'aDBc_item_type': aDBc_item_type,
288
+ // xxx Add nonce
289
+ },
290
+ success: function(result) {
291
+
292
+ },
293
+ complete: function(){
294
+ // wait for 1 sec then reload the page
295
+ setTimeout(function(){location.reload();}, 1000);
296
+
297
+ }
298
+ });
299
+ return false;
300
+ });*/
301
+
302
+ // Stop the scan
303
+ jQuery('#aDBc_stop_scan').on('click', function(e){
304
+
305
+ e.preventDefault();
306
+ jQuery('#aDBc_stop_scan').hide();
307
+ jQuery('#aDBc_stopping_msg').show();
308
+
309
+ jQuery.ajax({
310
+ type : "post",
311
+ url: aDBc_ajax_obj.ajaxurl,
312
+ cache: false,
313
+ data: {
314
+ 'action': 'aDBc_stop_search',
315
+ 'aDBc_item_type': aDBc_item_type
316
+ },
317
+ success: function(result) {
318
+ },
319
+ complete: function(){
320
+ }
321
+ });
322
+ //xxx return false;
323
+ });
324
+
325
  // Actions to do when the user clicks on 'Edit' link to change the 'Keep last' value
326
+ jQuery('.aDBc-keep-link').click(function(event){
327
 
328
  var idelement = (event.target.id).split("_");
329
  var itemname = idelement[idelement.length-1];
330
 
331
+ jQuery("#aDBc_edit_keep_" + itemname).hide();
332
+ jQuery("#aDBc_keep_label_" + itemname).hide();
333
 
334
+ jQuery('#aDBc_keep_input_' + itemname).show();
335
+ jQuery('#aDBc_keep_button_' + itemname).show();
336
+ jQuery('#aDBc_keep_cancel_' + itemname).show();
337
 
338
+ jQuery('.aDBc-keep-link').css("pointer-events", "none");
339
+ jQuery('.aDBc-keep-link').css("cursor", "default");
340
+ jQuery('.aDBc-keep-link').css("color", "#eee");
341
 
342
  });
343
 
344
+ jQuery('.aDBc-keep-cancel-link').click(function(event){
345
 
346
  var idelement = (event.target.id).split("_");
347
  var itemname = idelement[idelement.length-1];
353
  jQuery("#aDBc_edit_keep_" + itemname).show();
354
  jQuery("#aDBc_keep_label_" + itemname).show();
355
 
356
+ jQuery('.aDBc-keep-link').css("pointer-events", "");
357
+ jQuery('.aDBc-keep-link').css("cursor", "pointer");
358
+ jQuery('.aDBc-keep-link').css("color", "");
359
 
360
  });
361
 
languages/advanced-database-cleaner.pot CHANGED
@@ -1235,7 +1235,7 @@ msgid ""
1235
  msgstr ""
1236
 
1237
  #: includes/functions.php:572
1238
- msgid "Uncategorised!"
1239
  msgstr ""
1240
 
1241
  #: includes/functions.php:577
1235
  msgstr ""
1236
 
1237
  #: includes/functions.php:572
1238
+ msgid "Uncategorized!"
1239
  msgstr ""
1240
 
1241
  #: includes/functions.php:577