Advanced Database Cleaner - Version 2.0.0

Version Description

  • Some changes to readme.txt file
  • Changing the way the plugin can be translated
  • Correcting __() to some texts
  • Correcting some displaying texts
  • Big change in styles
  • Restructuring the whole code for better performance
  • Creation of the plugin main page: https://sigmaplugin.com/downloads/wordpress-advanced-database-cleaner
  • Adding language translation support
  • Correct the time zone offset for the scheduled tasks
  • Skipping InnoDB tables while optimizing
  • Change size of lost tables data from 'o' to 'KB'
  • Main menu is now under 'Tools' not 'settings'
  • Adding separate left menu (can be disabled)
  • Adding overview page with some useful information
  • Adding settings page
  • "Reset database" is now in a separate plugin (please view our plugins page)
  • Multisite: now only the main site can clean the network
  • New feature: Display/view items before cleaning them (Pro)
  • New feature: view and clean options
  • New feature: Detect orphan options, plugins options, themes options and WP options (Pro)
  • New feature: view and clean cron (scheduled tasks)
  • New feature: Detect orphan tasks, plugins tasks, themes tasks and WP tasks (Pro)
  • New feature: view and clean database tables
  • New feature: Detect orphan tables, plugins tables, themes tables and WP tables (Pro)
Download this release

Release Info

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

Code changes from version 1.3.7 to 2.0.0

Files changed (43) hide show
  1. README.txt +86 -32
  2. advanced-db-cleaner.php +225 -185
  3. css/admin.css +568 -0
  4. css/style.css +0 -227
  5. images/about.png +0 -0
  6. images/check_ok.png +0 -0
  7. images/db_clean.png +0 -0
  8. images/db_not_clean.png +0 -0
  9. images/features.png +0 -0
  10. images/go_back.png +0 -0
  11. images/help.png +0 -0
  12. images/loading_img.gif +0 -0
  13. images/menu-icon.png +0 -0
  14. images/nothing_to_see.png +0 -0
  15. images/notice.png +0 -0
  16. images/order_now.png +0 -0
  17. images/premium_ok.png +0 -0
  18. images/search-icon.png +0 -0
  19. images/see.png +0 -0
  20. images/small_warning.png +0 -0
  21. includes/class_clean_cron.php +256 -0
  22. includes/class_clean_options.php +258 -0
  23. includes/class_clean_tables.php +241 -0
  24. includes/class_general_cleanup.php +242 -0
  25. includes/class_optimize_tables.php +294 -0
  26. includes/clean-cron.php +0 -122
  27. includes/clean-db.php +0 -283
  28. includes/clean_db.php +31 -0
  29. includes/custom-clean-view/class_clean_comment.php +148 -0
  30. includes/custom-clean-view/class_clean_commentmeta.php +136 -0
  31. includes/custom-clean-view/class_clean_dashboard_transient_feed.php +136 -0
  32. includes/custom-clean-view/class_clean_draft_trash.php +150 -0
  33. includes/custom-clean-view/class_clean_postmeta.php +136 -0
  34. includes/custom-clean-view/class_clean_relationships.php +136 -0
  35. includes/custom-clean-view/class_clean_revision.php +136 -0
  36. includes/functions.php +356 -190
  37. includes/optimize-db.php +0 -123
  38. includes/overview_settings.php +139 -0
  39. includes/premium_page.php +51 -0
  40. includes/reset-db.php +0 -39
  41. includes/sidebar.php +30 -24
  42. js/admin.js +65 -0
  43. languages/advanced-db-cleaner.pot +881 -0
README.txt CHANGED
@@ -1,37 +1,56 @@
1
  === Advanced Database Cleaner ===
2
  Contributors: symptote
3
- Donate Link: http://www.sigmaplugin.com/donation
4
- Tags: plugin, plugin wordpress, database cleaner, clean database, database clean, database, clean, clean-up, clean up, cleanup, cleaner, delete orphan data, orphan data, delete revisions, delete revision, revision, delete draft, draft, delete trash, delete trash posts, trash post, trash, delete spam, spam, delete auto draft, auto draft, delete postmeta, postmeta, delete commentmeta, commentmeta, delete relationships, relationships, delete transient feed, transient feed, optimize database, database optimize, database optimizer, optimize, optimizer, reset database, database reset, reset, admin, widget, schedule, scheduler, schedule clean-up, schedule optimize, multisite, multi-site, network, cron, cron job, clean cron, clean scheduled tasks, view cron, view cron job, view scheduled tasks
5
- Requires at least: 3.0.0
6
- Tested up to: 4.4
7
- Stable tag: 1.3.7
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
11
- Clean up your database by deleting unused data such as revisions, optimize your database, or reset it to its initial state, etc.
12
 
13
  == Description ==
 
14
 
15
- If you have been using WordPress for a while, then you should think absolutely about a clean up. Indeed, your database may be full of garbage that make your site sluggish and bloated, such as: revisions, drafts, spam comments, etc. You should clean this unnecessary data to reduce the size of your database and improve efficiency when accessing tables. In addition, your backup files will be quicker and smaller.
16
 
17
- 'Advanced Database Cleaner' is a must-have plugin that cleans and optimizes your WordPress database.
18
 
19
  = Main Features =
20
- * Removes unused data such as "revision", "draft", "auto draft", "trash posts", "moderated comments", "spam comments", "trash comments", "orphan postmeta", "orphan commentmeta", "orphan relationships", "dashboard transient feed"
21
- * Optimizes the database and improves its efficiency
22
- * View and clean cron (scheduled tasks)
23
- * Resets your database back to its original state
24
- * Allows you choose what data should be cleaned
25
- * Schedules the clean-up of database to run automatically
26
- * Schedules the optimization of database to run automatically
 
 
 
 
 
 
 
 
 
 
 
27
  * Supports multisite installation
28
 
 
 
 
 
 
 
 
 
 
 
 
29
  = Multisite Support =
30
- * The plugin supports multisite wordpress installations
31
- * 'Network Activate' the plugin or activate it in each site separately
32
- * The main site can clean and optimize all tables for all sites in the network
33
- * Other sites in the network can only clean and optimize their own tables
34
- * The reset of the database can be executed from the main site only
35
 
36
  == Installation ==
37
 
@@ -40,24 +59,54 @@ This section describes how to install the plugin and get it working.
40
  = Single site installation =
41
  * After extraction, upload the Plugin to your `/wp-content/plugins/` directory
42
  * Go to "Dashboard" » "Plugins" and choose 'Activate'
43
- * The plugin page can be accessed via "Dashboard" » "Settings" » "Database Cleaner"
44
 
45
  = Multisite installation =
46
  * Login to your primary site and go to "My Sites" » "Network Admin" » "Plugins"
47
  * Install the plugin as usual for multisite
48
- * 'Network Activate' the plugin in "My Sites" » "Network Admin" » "Plugins" or let each site activate it separately
 
49
 
50
  == Screenshots ==
51
 
52
- 1. Example of database not cleaned
53
- 2. Example of cleaned database
54
- 3. Example of tables not optimized
55
- 4. Example of optimized tables
56
- 5. "View & clean scheduled tasks" admin page screenshot
57
- 6. "Reset database" admin page screenshot
 
 
 
58
 
59
  == Changelog ==
60
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
61
  = 1.3.7 =
62
  * Adding "clean trash-posts"
63
  * Updating FAQ
@@ -109,6 +158,11 @@ This section describes how to install the plugin and get it working.
109
  = 1.0.0 =
110
  * First release: Hello world!
111
 
 
 
 
 
 
112
  == Frequently Asked Questions ==
113
 
114
  = What does mean "clean my database"? =
@@ -135,8 +189,8 @@ WordPress allows you to save a post or a page without having to publish it immed
135
  Wordpress automatically saves your post/page while you are editing it. This is called an auto-draft. If you don't hit the publish/update button, then the post/page will be saved as auto-draft and any modification to your post/page will not be visible in your public site. Over time, you could have multiple auto-drafts that you will never publish and hence you can clean them. The sql query used by the plugin to clean all auto-drafts is:
136
  `DELETE FROM posts WHERE post_status = 'auto-draft'`
137
 
138
- = What does mean "Moderated comment"? What sql code is used to clean it? =
139
- Moderated comments are comments published by users and which are awaiting for your approval before appearing in your site. In some cases, you will have to clean all these comments. The sql query used by the plugin to clean all moderated comments is:
140
  `DELETE FROM comments WHERE comment_approved = '0'`
141
 
142
  = What does mean "Spam comment"? What sql code is used to clean it? =
@@ -164,10 +218,10 @@ Transient are a way for storing cached data temporarily in your database by give
164
  `DELETE FROM options WHERE option_name LIKE '_site_transient_browser_%' OR option_name LIKE '_site_transient_timeout_browser_%' OR option_name LIKE '_transient_feed_%' OR option_name LIKE '_transient_timeout_feed_%'`
165
 
166
  = Is this plugin compatible with multisite? =
167
- Yes, it is compatible with multisite.
168
 
169
  = Is this plugin compatible with SharDB, HyperDB or Multi-DB? =
170
  Actually the plugin is not supposed to be compatible with SharDB, HyperDB or Multi-DB. We will try to make it compatible in coming releases.
171
 
172
  = Does this plugin cleans itself after the uninstall? =
173
- Yes, the plugin cleans itself and removes any data used to store its settings.
1
  === Advanced Database Cleaner ===
2
  Contributors: symptote
3
+ Donate Link: https://www.sigmaplugin.com/donation
4
+ Tags: clean, clean up, cleanup, database, optimize
5
+ Requires at least: 3.1.0
6
+ Tested up to: 4.9
7
+ Stable tag: 2.0.0
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
11
+ Clean database by deleting orphaned data such as 'revisions', 'transients', optimize database and more...
12
 
13
  == Description ==
14
+ Clean up database by deleting orphaned items such as 'old revisions', 'old drafts', optimize database and more...
15
 
16
+ If you have been using WordPress for a while, then you should think absolutely about a database cleanup. Indeed, your database may be full of garbage that make your site sluggish and bloated such as old revisions, old drafts, spammed comments, etc. You should clean-up this unnecessary data to reduce your database size and improve website speed. In addition, you will have quicker database backup since the file of your backup will be smaller.
17
 
18
+ 'Advanced Database Cleaner' is a must-have plugin that allows you to clean database, optimize database and more.
19
 
20
  = Main Features =
21
+ * Cleanup database includes:
22
+ * Delete old revisions of posts and pages
23
+ * Delete old drafts of posts and pages
24
+ * Delete old auto drafts
25
+ * Delete pending comments
26
+ * Delete spam comments
27
+ * Delete trash comments
28
+ * Delete orphan postmeta
29
+ * Delete orphan commentmeta
30
+ * Delete orphan relationships
31
+ * Delete orphan dashboard transient feeds
32
+ * You can choose what items to clean-up
33
+ * You can schedule your database clean up to run automatically
34
+ * Optimize database and improve website speed
35
+ * You can schedule your database optimization to run automatically
36
+ * View and clean cron tasks (scheduled tasks)
37
+ * View and clean tables
38
+ * View and clean options
39
  * Supports multisite installation
40
 
41
+ = Pro Features (<a href="https://sigmaplugin.com/downloads/wordpress-advanced-database-cleaner">Official website</a>) =
42
+ Do you know that even after deleting a plugin/theme from your WordPress website, some of its leftovers may remain in your database? Such as orphan options, orphan tables and orphan cron tasks. As you may know, not all plugins/themes care about the housekeeping of your WordPress database. As long as you are removing plugins/themes, leftovers will be accumulated in your database and will influence your website performance. The Pro version of Advanced Database Cleaner will help you remove all those leftovers and perform a deep database clean up. In the pro version you can:
43
+
44
+ * Display and view unused items before making a database clean up
45
+ * Classify database options according to their "creator". They can be either: plugins options, themes options or WP core options
46
+ * Detect and delete orphan options
47
+ * Classify database tables according to their "creator". They can be either: plugins tables, themes tables or WP core tables
48
+ * Detect and delete orphan tables
49
+ * Classify all cron tasks (cron jobs) according to their "creator". They can be either: plugins cron tasks, themes cron tasks or WP core tasks
50
+ * Detect and delete orphan cron tasks
51
+
52
  = Multisite Support =
53
+ * Only the main site can view, clean and optimize the whole network. Other sites in the network cannot perform these tasks. We have opted for this philosophy because we are sure that your DB is precious and only the super administrator can perform such actions.
 
 
 
 
54
 
55
  == Installation ==
56
 
59
  = Single site installation =
60
  * After extraction, upload the Plugin to your `/wp-content/plugins/` directory
61
  * Go to "Dashboard" &raquo; "Plugins" and choose 'Activate'
62
+ * The plugin page can be accessed via "Dashboard" &raquo; "Tools" &raquo; "WP DB Cleaner" or via the left menu "WP DB Cleaner"
63
 
64
  = Multisite installation =
65
  * Login to your primary site and go to "My Sites" &raquo; "Network Admin" &raquo; "Plugins"
66
  * Install the plugin as usual for multisite
67
+ * Network activate the plugin
68
+ * Only the main site can have access to the plugin
69
 
70
  == Screenshots ==
71
 
72
+ 1. Example of database with items to clean
73
+ 2. View items before cleaning them (case of auto-draft)
74
+ 3. Example of clean database
75
+ 4. Example of tables that should be optimized
76
+ 5. Example of optimize database
77
+ 6. View and clean tables. You can also detect orphan tables, plugins tables, themes tables and WP tables (Pro version)
78
+ 7. View and clean options. You can also detect orphan options, plugins options, themes options and WP options (Pro version)
79
+ 8. View and clean scheduled tasks. You can also detect orphan tasks, plugins tasks, themes tasks and WP tasks (Pro version)
80
+ 9. Overview and settings page
81
 
82
  == Changelog ==
83
 
84
+ = 2.0.0 =
85
+ * Some changes to readme.txt file
86
+ * Changing the way the plugin can be translated
87
+ * Correcting __() to some texts
88
+ * Correcting some displaying texts
89
+ * Big change in styles
90
+ * Restructuring the whole code for better performance
91
+ * Creation of the plugin main page: https://sigmaplugin.com/downloads/wordpress-advanced-database-cleaner
92
+ * Adding language translation support
93
+ * Correct the time zone offset for the scheduled tasks
94
+ * Skipping InnoDB tables while optimizing
95
+ * Change size of lost tables data from 'o' to 'KB'
96
+ * Main menu is now under 'Tools' not 'settings'
97
+ * Adding separate left menu (can be disabled)
98
+ * Adding overview page with some useful information
99
+ * Adding settings page
100
+ * "Reset database" is now in a separate plugin (please view our plugins page)
101
+ * Multisite: now only the main site can clean the network
102
+ * New feature: Display/view items before cleaning them (Pro)
103
+ * New feature: view and clean options
104
+ * New feature: Detect orphan options, plugins options, themes options and WP options (Pro)
105
+ * New feature: view and clean cron (scheduled tasks)
106
+ * New feature: Detect orphan tasks, plugins tasks, themes tasks and WP tasks (Pro)
107
+ * New feature: view and clean database tables
108
+ * New feature: Detect orphan tables, plugins tables, themes tables and WP tables (Pro)
109
+
110
  = 1.3.7 =
111
  * Adding "clean trash-posts"
112
  * Updating FAQ
158
  = 1.0.0 =
159
  * First release: Hello world!
160
 
161
+ == Upgrade Notice ==
162
+
163
+ = 2.0.0 =
164
+ New release.
165
+
166
  == Frequently Asked Questions ==
167
 
168
  = What does mean "clean my database"? =
189
  Wordpress automatically saves your post/page while you are editing it. This is called an auto-draft. If you don't hit the publish/update button, then the post/page will be saved as auto-draft and any modification to your post/page will not be visible in your public site. Over time, you could have multiple auto-drafts that you will never publish and hence you can clean them. The sql query used by the plugin to clean all auto-drafts is:
190
  `DELETE FROM posts WHERE post_status = 'auto-draft'`
191
 
192
+ = What does mean "Pending comment"? What sql code is used to clean it? =
193
+ Pending comments are comments published by users and which are awaiting for your approval before appearing in your site. In some cases, you will have to clean all these comments. The sql query used by the plugin to clean all pending comments is:
194
  `DELETE FROM comments WHERE comment_approved = '0'`
195
 
196
  = What does mean "Spam comment"? What sql code is used to clean it? =
218
  `DELETE FROM options WHERE option_name LIKE '_site_transient_browser_%' OR option_name LIKE '_site_transient_timeout_browser_%' OR option_name LIKE '_transient_feed_%' OR option_name LIKE '_transient_timeout_feed_%'`
219
 
220
  = Is this plugin compatible with multisite? =
221
+ Yes, it is compatible with multisite. It should be noted that only the main site in the network can clean the database and orphan items of all the network. We prevent other sites to clean your DB since we believe that only the super administrator have the right to perform such operation. Your database is precious!
222
 
223
  = Is this plugin compatible with SharDB, HyperDB or Multi-DB? =
224
  Actually the plugin is not supposed to be compatible with SharDB, HyperDB or Multi-DB. We will try to make it compatible in coming releases.
225
 
226
  = Does this plugin cleans itself after the uninstall? =
227
+ We do clean-up of your WordPress site, it will be a shame if the plugin does not clean itself after an uninstall! Of course yes, the plugin cleans itself and removes any data used to store its settings once uninstalled.
advanced-db-cleaner.php CHANGED
@@ -1,127 +1,205 @@
1
  <?php
2
- defined( 'ABSPATH' ) or die( 'No direct access allowed' );
3
-
4
  /*
5
  Plugin Name: Advanced Database Cleaner
6
- Description: Clean up your database by deleting unused data such as revisions, optimize your database, or reset it to its initial state, etc.
7
- Version: 1.3.7
 
8
  Author: Younes JFR.
 
9
  Contributors: symptote
10
- Text Domain: advanced-db-cleaner
11
- Domain Path: /languages
12
  License: GPLv2 or later
13
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
14
  */
15
 
16
- /** Define common variables */
17
- if (!defined("ADB_CLEANER_PLUGIN_VERSION")) define("ADB_CLEANER_PLUGIN_VERSION", "1.3.7");
18
- if (!defined("ADB_CLEANER_PLUGIN_BASENAME")) define("ADB_CLEANER_PLUGIN_BASENAME", plugin_basename(__FILE__));
19
- if (!defined("ADB_CLEANER_PLUGIN_DIR")) define("ADB_CLEANER_PLUGIN_DIR", plugins_url() .'/'. dirname(plugin_basename(__FILE__)));
 
 
 
 
 
 
 
 
 
 
 
20
 
21
- /** Add 'settings' link under the plugin name in plugins page */
22
- add_filter('plugin_action_links_' . ADB_CLEANER_PLUGIN_BASENAME, 'db_cleaner_add_action_links');
23
- function db_cleaner_add_action_links($links){
24
- $adc_settings_link = '<a href = "options-general.php?page=' . ADB_CLEANER_PLUGIN_BASENAME . '">' . __('Settings', 'advanced-db-cleaner') . '</a>';
25
- array_unshift($links, $adc_settings_link);
26
- return $links;
 
 
 
 
 
 
 
 
 
 
 
27
  }
28
 
29
- /** Add 'Database Cleaner' to Wordpress settings menu */
30
- add_action('admin_menu', 'adv_db_cleaner_add_admin_menu');
31
- function adv_db_cleaner_add_admin_menu() {
32
- $hook_adv_db_cleaner = add_options_page('Advanced DB Cleaner Options', 'Database Cleaner','manage_options', __FILE__, 'adv_db_cleaner_page');
33
- add_action('admin_print_styles-' . $hook_adv_db_cleaner, 'adv_db_cleaner_enqueue_styles');
 
 
 
 
 
 
 
 
34
  }
35
 
36
- /** Register stylesheet */
37
- add_action('admin_init', 'adv_db_cleaner_register_styles' );
38
- function adv_db_cleaner_register_styles() {
39
- wp_register_style('adv_db_cleaner_css', ADB_CLEANER_PLUGIN_DIR . '/css/style.css');
 
 
 
 
 
 
 
 
40
  }
41
 
42
- /** Enqueue stylesheet */
43
- function adv_db_cleaner_enqueue_styles() {
44
- wp_enqueue_style( 'adv_db_cleaner_css' );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
45
  }
46
 
47
  /******************************************************************************************
 
48
  * The scheduler
49
  * Get more info here: http://codex.wordpress.org/Plugin_API/Filter_Reference/cron_schedules
 
50
  ******************************************************************************************/
51
  add_filter('cron_schedules', 'aDBc_additional_schedules');
52
  function aDBc_additional_schedules($schedules){
53
  // Add weekly schedule
54
  $schedules['weekly'] = array(
55
  'interval' => 604800,
56
- 'display' => __('Once Weekly')
57
  );
58
  // Add monthly schedule
59
  $schedules['monthly'] = array(
60
  'interval' => 2635200,
61
- 'display' => __('Once a month')
62
  );
63
  return $schedules;
64
  }
65
 
66
- /** (RE)-schedule tasks after (RE)-activation or update of the plugin */
 
 
 
 
67
  register_activation_hook(__FILE__, 'aDBc_activate_plugin');
68
- add_action('aDBc_optimize_scheduler', 'adv_db_cleaner_optimize');
69
- add_action('aDBc_clean_scheduler', 'aDBc_cleanAll');
70
- function aDBc_activate_plugin($network_wide){
71
- global $wpdb;
72
- if(function_exists('is_multisite') && is_multisite() && $network_wide){
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
73
  $blogs_ids = $wpdb->get_col("SELECT blog_id FROM $wpdb->blogs");
74
  foreach($blogs_ids as $blog_id){
75
  switch_to_blog($blog_id);
76
- $aDBc_optimize_schedule = get_option('aDBc_optimize_schedule');
77
- if($aDBc_optimize_schedule && $aDBc_optimize_schedule != 'no_schedule'){
78
- if(!wp_next_scheduled('aDBc_optimize_scheduler'))
79
- wp_schedule_event(time()+60, $aDBc_optimize_schedule, 'aDBc_optimize_scheduler');
80
- }
81
- $aDBc_clean_schedule = get_option('aDBc_clean_schedule');
82
- if($aDBc_clean_schedule && $aDBc_clean_schedule != 'no_schedule'){
83
- if(!wp_next_scheduled('aDBc_clean_scheduler'))
84
- wp_schedule_event(time()+60, $aDBc_clean_schedule, 'aDBc_clean_scheduler');
85
  }
86
  restore_current_blog();
87
  }
88
- }else{
89
- $aDBc_optimize_schedule = get_option('aDBc_optimize_schedule');
90
- if($aDBc_optimize_schedule && $aDBc_optimize_schedule != 'no_schedule'){
91
- if(!wp_next_scheduled('aDBc_optimize_scheduler'))
92
- wp_schedule_event(time()+60, $aDBc_optimize_schedule, 'aDBc_optimize_scheduler');
93
- }
94
- $aDBc_clean_schedule = get_option('aDBc_clean_schedule');
95
- if($aDBc_clean_schedule && $aDBc_clean_schedule != 'no_schedule'){
96
- if(!wp_next_scheduled('aDBc_clean_scheduler'))
97
- wp_schedule_event(time()+60, $aDBc_clean_schedule, 'aDBc_clean_scheduler');
98
- }
99
- }
100
  }
101
 
102
- /** Clear current scheduled tasks (if any) when deactivated */
103
- register_deactivation_hook(__FILE__, 'aDBc_deactivate_plugin' );
 
 
 
 
104
  function aDBc_deactivate_plugin($network_wide){
105
- global $wpdb;
106
- if(function_exists('is_multisite') && is_multisite() && $network_wide){
107
- $blogs_ids = $wpdb->get_col("SELECT blog_id FROM $wpdb->blogs");
108
- foreach($blogs_ids as $blog_id){
109
- switch_to_blog($blog_id);
110
- wp_clear_scheduled_hook('aDBc_optimize_scheduler');
111
- wp_clear_scheduled_hook('aDBc_clean_scheduler');
112
- restore_current_blog();
113
- }
114
- }else{
115
- wp_clear_scheduled_hook('aDBc_optimize_scheduler');
116
- wp_clear_scheduled_hook('aDBc_clean_scheduler');
117
- }
118
  }
119
 
120
- /** Clear scheduled tasks + options if UNINSTALL */
 
 
 
 
121
  register_uninstall_hook(__FILE__, 'aDBc_uninstall');
122
  function aDBc_uninstall(){
123
- global $wpdb;
 
 
 
 
 
 
 
 
 
 
124
  if(function_exists('is_multisite') && is_multisite()){
 
125
  $blogs_ids = $wpdb->get_col("SELECT blog_id FROM $wpdb->blogs");
126
  foreach($blogs_ids as $blog_id){
127
  switch_to_blog($blog_id);
@@ -131,130 +209,92 @@ function aDBc_uninstall(){
131
  wp_clear_scheduled_hook('aDBc_clean_scheduler');
132
  restore_current_blog();
133
  }
134
- }else{
135
- delete_option('aDBc_optimize_schedule');
136
- delete_option('aDBc_clean_schedule');
137
- wp_clear_scheduled_hook('aDBc_optimize_scheduler');
138
- wp_clear_scheduled_hook('aDBc_clean_scheduler');
139
  }
140
  }
141
 
142
- /** The admin page content */
143
- function adv_db_cleaner_page(){
144
- ?>
 
 
 
145
  <div class="wrap">
146
- <h2>Advanced DB Cleaner</h2>
147
  <?php
148
- // If one of the forms is sent, then process data and print results
149
- $adv_db_cleaner_message = '';
150
- $adv_db_cleaner_message_class = 'updated settings-error notice is-dismissible';
151
- if(isset($_POST['adbc_post_type'])){
152
- foreach($_POST['adbc_post_type'] as $adbc_type) {
153
- adv_db_cleaner($adbc_type);
154
- }
155
- $adv_db_cleaner_message = __('Database cleaned successfully!', 'advanced-db-cleaner');
156
- }elseif(isset($_POST['aDBc_optimize_form'])){
157
- adv_db_cleaner_optimize();
158
- $adv_db_cleaner_message = __('Database optimized successfully!', 'advanced-db-cleaner');
159
- }elseif(isset($_POST['aDBc_reset_form'])){
160
- if($_POST['aDBc_reset_comfirmation'] == 'reset'){
161
- adv_db_cleaner_reset();
162
- }else{
163
- $adv_db_cleaner_message = __('Please type the word "reset" correctly in the text box below.', 'advanced-db-cleaner');
164
- $adv_db_cleaner_message_class = 'error';
165
- }
166
- }elseif(isset($_POST['aDBc_optimize_schedule_form'])){
167
- wp_clear_scheduled_hook('aDBc_optimize_scheduler');
168
- if($_POST['aDBc_optimize_schedule'] == 'no_schedule'){
169
- delete_option('aDBc_optimize_schedule');
170
- }else{
171
- update_option('aDBc_optimize_schedule', $_POST['aDBc_optimize_schedule']);
172
- wp_schedule_event(time()+60, $_POST['aDBc_optimize_schedule'], 'aDBc_optimize_scheduler');
173
- }
174
- $adv_db_cleaner_message = __('The optimization schedule is saved successfully!', 'advanced-db-cleaner');
175
- }elseif(isset($_POST['aDBc_clean_schedule_form'])){
176
- wp_clear_scheduled_hook('aDBc_clean_scheduler');
177
- if($_POST['aDBc_clean_schedule'] == 'no_schedule'){
178
- delete_option('aDBc_clean_schedule');
179
- }else{
180
- update_option('aDBc_clean_schedule', $_POST['aDBc_clean_schedule']);
181
- wp_schedule_event(time()+60, $_POST['aDBc_clean_schedule'], 'aDBc_clean_scheduler');
182
- }
183
- $adv_db_cleaner_message = __('The clean-up schedule is saved successfully!', 'advanced-db-cleaner');
184
- }elseif(isset($_POST['adbc_cron_hooks'])){
185
- //Clean cron (scheduled tasks)
186
- if(function_exists('is_multisite') && is_multisite() && is_main_site()){
187
- foreach($_POST['adbc_cron_hooks'] as $adbc_cron_hook) {
188
- // Get the id of the blog and the hook name
189
- $adbc_blog_id_and_hook = explode("|", $adbc_cron_hook);
190
- switch_to_blog($adbc_blog_id_and_hook[0]);
191
- wp_clear_scheduled_hook($adbc_blog_id_and_hook[1]);
192
- restore_current_blog();
193
- }
194
- }else{
195
- foreach($_POST['adbc_cron_hooks'] as $adbc_cron_hook) {
196
- wp_clear_scheduled_hook($adbc_cron_hook);
197
- }
198
- }
199
- $adv_db_cleaner_message = __('Cron(s) cleaned successfully!', 'advanced-db-cleaner');
200
- }
201
- // Print message
202
- if($adv_db_cleaner_message != ''){
203
- echo '<div id="adbc_message" class="'. $adv_db_cleaner_message_class .'"><p><strong>' . $adv_db_cleaner_message . '</strong></p></div>';
204
- }
205
- ?>
206
- <div class="marginRight300">
207
- <div class="tabBox">
208
  <?php
209
- $aDBc_tab_list = array(
210
- array("id"=>"aDBc-clean", "title"=>__('Clean Database', 'advanced-db-cleaner')),
211
- array("id"=>"aDBc-optimize","title"=>__('Optimize Database', 'advanced-db-cleaner')),
212
- array("id"=>"aDBc-cron", "title"=>__('Clean Cron', 'advanced-db-cleaner')),
213
- array("id"=>"aDBc-reset", "title"=>__('Reset Database', 'advanced-db-cleaner'))
 
 
214
  );
215
- foreach ($aDBc_tab_list as $key => $value){
216
- $checked = "";
217
- if($value["id"] == "aDBc-clean"
218
- || (isset($_POST["aDBc_optimize_form"]) && $value["id"] == "aDBc-optimize")
219
- || (isset($_POST["aDBc_optimize_schedule_form"]) && $value["id"] == "aDBc-optimize")
220
- || (isset($_POST["aDBc_clean_cron_form"]) && $value["id"] == "aDBc-cron")
221
- || (isset($_POST["aDBc_reset_form"]) && $value["id"] == "aDBc-reset")
222
- ){
223
- $checked = 'checked = "checked"';
224
- }
225
- echo '<input '.$checked.' type="radio" id="'.$value["id"].'" name="tabGroup1">'."\n";
226
- echo '<label for="'.$value["id"].'">'.$value["title"].'</label>'."\n";
227
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
228
  ?>
229
- <div class="tab1">
230
- <?php include_once 'includes/clean-db.php'; ?>
231
- </div>
232
- <div class="tab2">
233
- <?php include_once 'includes/optimize-db.php'; ?>
234
- </div>
235
- <div class="tab3">
236
- <?php include_once 'includes/clean-cron.php'; ?>
237
- </div>
238
- <div class="tab4">
239
- <?php
240
- if(is_main_site()){
241
- include_once 'includes/reset-db.php';
242
- }else{
243
- echo "<div style='text-align:center; padding-top:100px; color:#777'>";
244
- _e('Sorry! The reset can be executed from the main site in your Network only!', 'advanced-db-cleaner');
245
- echo "</div>";
246
- }
247
- ?>
248
- </div>
249
- </div>
250
- <div class="aDBcSidebar">
251
- <?php include_once 'includes/sidebar.php'; ?>
252
  </div>
 
253
  </div>
254
  </div>
255
- <?php
256
  }
257
 
258
- /** Get functions */
 
 
 
 
259
  include_once 'includes/functions.php';
 
260
  ?>
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: 2.0.0
9
  Author: Younes JFR.
10
+ Author URI: https://www.sigmaplugin.com
11
  Contributors: symptote
12
+ Text Domain: advanced-database-cleaner
13
+ Domain Path: /languages/
14
  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
+ * xxx: Test validity of WP_List_Table class after each release of WP.
21
+ * Notice from Wordpress.org:
22
+ * Since this class is marked as private, developers should use this only at their own risk as this class is
23
+ * subject to change in future WordPress releases. Any developers using this class are strongly encouraged to
24
+ * test their plugins with all WordPress beta/RC releases to maintain compatibility.
25
+ ********************************************************************/
26
+ if(!class_exists('WP_List_Table')) {
27
+ if(file_exists(ABSPATH . 'wp-admin/includes/class-wp-list-table.php')){
28
+ require_once(ABSPATH . 'wp-admin/includes/class-wp-list-table.php');
29
+ }else{
30
+ return;
31
+ }
32
+ }
33
 
34
+ /********************************************************************
35
+ *
36
+ * Define common constants
37
+ *
38
+ ********************************************************************/
39
+ if (!defined("ADBC_PLUGIN_VERSION")) define("ADBC_PLUGIN_VERSION", "2.0.0");
40
+ if (!defined("ADBC_PLUGIN_DIR_PATH")) define("ADBC_PLUGIN_DIR_PATH", plugins_url('' , __FILE__));
41
+
42
+ /********************************************************************
43
+ *
44
+ * load language
45
+ *
46
+ ********************************************************************/
47
+ add_action('plugins_loaded', 'aDBc_load_textdomain');
48
+ function aDBc_load_textdomain() {
49
+ // load_plugin_textdomain('advanced-database-cleaner', false, plugin_basename(dirname(__FILE__)) . '/languages');
50
+ load_plugin_textdomain( 'advanced-database-cleaner' );
51
  }
52
 
53
+ /********************************************************************
54
+ *
55
+ * Get settings
56
+ *
57
+ ********************************************************************/
58
+ global $aDBc_settings;
59
+ $aDBc_settings = get_option('aDBc_settings');
60
+ // Test if settings are updated
61
+ if(isset($_POST['save_settings'])){
62
+ $aDBc_settings['left_menu'] = isset($_POST['aDBc_left_menu']) ? "1" : "0";
63
+ $aDBc_settings['top_main_msg'] = isset($_POST['aDBc_top_main_msg']) ? "1" : "0";
64
+ // Update settings in DB
65
+ update_option( 'aDBc_settings', $aDBc_settings );
66
  }
67
 
68
+ /********************************************************************
69
+ *
70
+ * Add 'Database Cleaner' to Wordpress menu
71
+ *
72
+ ********************************************************************/
73
+ add_action('admin_menu', 'aDBc_add_admin_menu');
74
+ function aDBc_add_admin_menu() {
75
+ global $aDBc_settings, $aDBc_left_menu, $aDBc_tool_submenu;
76
+ if($aDBc_settings['left_menu'] == "1"){
77
+ $aDBc_left_menu = add_menu_page('Advanced DB Cleaner', 'WP DB Cleaner', 'manage_options', 'advanced_db_cleaner', 'aDBc_main_page_callback', ADBC_PLUGIN_DIR_PATH.'/images/menu-icon.png', '80.01123');
78
+ }
79
+ $aDBc_tool_submenu = add_submenu_page('tools.php', 'Advanced DB Cleaner', 'WP DB Cleaner', 'manage_options', 'advanced_db_cleaner', 'aDBc_main_page_callback');
80
  }
81
 
82
+ /********************************************************************
83
+ *
84
+ * Load CSS and JS
85
+ *
86
+ ********************************************************************/
87
+ add_action('admin_enqueue_scripts', 'aDBc_load_styles_and_scripts');
88
+ function aDBc_load_styles_and_scripts($hook) {
89
+ // Enqueue our js and css in the plugin pages only
90
+ global $aDBc_left_menu, $aDBc_tool_submenu;
91
+ if($hook != $aDBc_left_menu && $hook != $aDBc_tool_submenu){
92
+ return;
93
+ }
94
+ wp_enqueue_style('aDBc_css', ADBC_PLUGIN_DIR_PATH . '/css/admin.css');
95
+ wp_enqueue_script('aDBc_js', ADBC_PLUGIN_DIR_PATH . '/js/admin.js');
96
+ //wp_enqueue_script('jquery');
97
+ wp_enqueue_script('jquery-ui-dialog');
98
+ wp_enqueue_style('wp-jquery-ui-dialog');
99
  }
100
 
101
  /******************************************************************************************
102
+ *
103
  * The scheduler
104
  * Get more info here: http://codex.wordpress.org/Plugin_API/Filter_Reference/cron_schedules
105
+ *
106
  ******************************************************************************************/
107
  add_filter('cron_schedules', 'aDBc_additional_schedules');
108
  function aDBc_additional_schedules($schedules){
109
  // Add weekly schedule
110
  $schedules['weekly'] = array(
111
  'interval' => 604800,
112
+ 'display' => __('Once weekly', 'advanced-database-cleaner')
113
  );
114
  // Add monthly schedule
115
  $schedules['monthly'] = array(
116
  'interval' => 2635200,
117
+ 'display' => __('Once monthly', 'advanced-database-cleaner')
118
  );
119
  return $schedules;
120
  }
121
 
122
+ /********************************************************************
123
+ *
124
+ * (RE)-schedule tasks after (RE)-activation or update of the plugin
125
+ *
126
+ ********************************************************************/
127
  register_activation_hook(__FILE__, 'aDBc_activate_plugin');
128
+ add_action('aDBc_optimize_scheduler', 'aDBc_optimize_tables');
129
+ add_action('aDBc_clean_scheduler', 'aDBc_clean_all_elements');
130
+ function aDBc_activate_plugin(){
131
+
132
+ // Add scheduled task for optimization if option exists
133
+ $aDBc_optimize_schedule = get_option('aDBc_optimize_schedule');
134
+ if($aDBc_optimize_schedule && $aDBc_optimize_schedule != 'no_schedule'){
135
+ if(!wp_next_scheduled('aDBc_optimize_scheduler'))
136
+ wp_schedule_event(time()+60, $aDBc_optimize_schedule, 'aDBc_optimize_scheduler');
137
+ }
138
+
139
+ // Add scheduled task for clean-up if option exists
140
+ $aDBc_clean_schedule = get_option('aDBc_clean_schedule');
141
+ if($aDBc_clean_schedule && $aDBc_clean_schedule != 'no_schedule'){
142
+ if(!wp_next_scheduled('aDBc_clean_scheduler'))
143
+ wp_schedule_event(time()+60, $aDBc_clean_schedule, 'aDBc_clean_scheduler');
144
+ }
145
+
146
+ // Add default settings if not exists
147
+ $aDBc_settings = get_option('aDBc_settings');
148
+ if(empty($aDBc_settings)){
149
+ $aDBc_settings['left_menu'] = "1";
150
+ $aDBc_settings['top_main_msg'] = "1";
151
+ $aDBc_settings['tables_cleanup_warning'] = "1";
152
+ update_option('aDBc_settings', $aDBc_settings);
153
+ }
154
+
155
+ // When activating version >= 2.0.0, delete all options and tasks created by older versions in MU sites since only the main site can clean the network now
156
+ if(function_exists('is_multisite') && is_multisite()){
157
+ global $wpdb;
158
  $blogs_ids = $wpdb->get_col("SELECT blog_id FROM $wpdb->blogs");
159
  foreach($blogs_ids as $blog_id){
160
  switch_to_blog($blog_id);
161
+ if(!is_main_site()){
162
+ delete_option('aDBc_optimize_schedule');
163
+ delete_option('aDBc_clean_schedule');
164
+ wp_clear_scheduled_hook('aDBc_optimize_scheduler');
165
+ wp_clear_scheduled_hook('aDBc_clean_scheduler');
 
 
 
 
166
  }
167
  restore_current_blog();
168
  }
169
+ }
 
 
 
 
 
 
 
 
 
 
 
170
  }
171
 
172
+ /********************************************************************
173
+ *
174
+ * Clear current scheduled tasks (if any) when deactivated
175
+ *
176
+ ********************************************************************/
177
+ register_deactivation_hook(__FILE__, 'aDBc_deactivate_plugin');
178
  function aDBc_deactivate_plugin($network_wide){
179
+ wp_clear_scheduled_hook('aDBc_optimize_scheduler');
180
+ wp_clear_scheduled_hook('aDBc_clean_scheduler');
 
 
 
 
 
 
 
 
 
 
 
181
  }
182
 
183
+ /********************************************************************
184
+ *
185
+ * Clear scheduled tasks + options if UNINSTALL
186
+ *
187
+ ********************************************************************/
188
  register_uninstall_hook(__FILE__, 'aDBc_uninstall');
189
  function aDBc_uninstall(){
190
+
191
+ // Delete options
192
+ delete_option('aDBc_optimize_schedule');
193
+ delete_option('aDBc_clean_schedule');
194
+ delete_option('aDBc_settings');
195
+
196
+ // Clear scheduled tasks
197
+ wp_clear_scheduled_hook('aDBc_optimize_scheduler');
198
+ wp_clear_scheduled_hook('aDBc_clean_scheduler');
199
+
200
+ // Testing for MU is useful to delete options and tasks created by older versions of the plugin ( < 2.0.0 ) in network sites
201
  if(function_exists('is_multisite') && is_multisite()){
202
+ global $wpdb;
203
  $blogs_ids = $wpdb->get_col("SELECT blog_id FROM $wpdb->blogs");
204
  foreach($blogs_ids as $blog_id){
205
  switch_to_blog($blog_id);
209
  wp_clear_scheduled_hook('aDBc_clean_scheduler');
210
  restore_current_blog();
211
  }
 
 
 
 
 
212
  }
213
  }
214
 
215
+ /********************************************************************
216
+ *
217
+ * The admin page of the plugin
218
+ *
219
+ ********************************************************************/
220
+ function aDBc_main_page_callback(){ ?>
221
  <div class="wrap">
222
+ <h2>Advanced Database Cleaner</h2>
223
  <?php
224
+ global $aDBc_settings;
225
+ if($aDBc_settings['top_main_msg'] == "1"){ ?>
226
+ <div id="aDBc_main_msg" class="updated aDBc-top-main-msg">
227
+ <span><?php _e('Welcome!', 'advanced-database-cleaner'); ?></span>
228
+ <p style="font-size:15px">
229
+ <?php _e('Before doing any clean-up, please make sure to always backup your database first.', 'advanced-database-cleaner'); ?>
230
+ <br/>
231
+ <span style="font-size:12px;color:#999"><?php _e('Once you read and understand this message, you can disable it from settings Tab.', 'advanced-database-cleaner'); ?></span>
232
+ </p>
233
+ </div>
234
+ <?php } ?>
235
+ <div class="aDBc-margin-r-300">
236
+ <div class="aDBc-tab-box">
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
237
  <?php
238
+ $aDBc_tabs = array('general' => __('General clean-up', 'advanced-database-cleaner'),
239
+ 'optimize' => __('Optimize', 'advanced-database-cleaner'),
240
+ 'tables' => __('Tables', 'advanced-database-cleaner'),
241
+ 'options' => __('Options', 'advanced-database-cleaner'),
242
+ 'cron' => __('Scheduled tasks', 'advanced-database-cleaner'),
243
+ 'overview' => __('Overview & Settings', 'advanced-database-cleaner'),
244
+ 'premium' => __('Premium', 'advanced-database-cleaner')
245
  );
246
+
247
+ $current_tab = isset($_GET['aDBc_tab']) ? $_GET['aDBc_tab'] : 'general';
248
+
249
+ echo '<h2 class="nav-tab-wrapper">';
250
+ foreach($aDBc_tabs as $tab => $name){
251
+ $class = ($tab == $current_tab) ? ' nav-tab-active' : '';
252
+ $link = "?page=advanced_db_cleaner&aDBc_tab=$tab";
253
+ if($tab == "tables" || $tab == "options" || $tab == "cron"){
254
+ $link .= '&aDBc_cat=all';
 
 
 
255
  }
256
+ echo "<a class='nav-tab$class' href='$link'>$name</a>";
257
+ }
258
+ echo '</h2>';
259
+
260
+ echo '<div class="aDBc-tab-box-div">';
261
+ switch ($current_tab){
262
+ case 'general' :
263
+ include_once 'includes/clean_db.php';
264
+ break;
265
+ case 'optimize' :
266
+ include_once 'includes/class_optimize_tables.php';
267
+ break;
268
+ case 'tables' :
269
+ include_once 'includes/class_clean_tables.php';
270
+ break;
271
+ case 'options' :
272
+ include_once 'includes/class_clean_options.php';
273
+ break;
274
+ case 'cron' :
275
+ include_once 'includes/class_clean_cron.php';
276
+ break;
277
+ case 'overview' :
278
+ include_once 'includes/overview_settings.php';
279
+ break;
280
+ case 'premium' :
281
+ include_once 'includes/premium_page.php';
282
+ break;
283
+ }
284
+ echo '</div>';
285
  ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
286
  </div>
287
+ <div class="aDBc-sidebar"><?php include_once 'includes/sidebar.php'; ?></div>
288
  </div>
289
  </div>
290
+ <?php
291
  }
292
 
293
+ /***************************************************************
294
+ *
295
+ * Get functions
296
+ *
297
+ ***************************************************************/
298
  include_once 'includes/functions.php';
299
+
300
  ?>
css/admin.css ADDED
@@ -0,0 +1,568 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*---------------------------------------------------------------------------------------------
2
+ *
3
+ * Global styles
4
+ *
5
+ *---------------------------------------------------------------------------------------------*/
6
+ html {
7
+ overflow-y: scroll;
8
+ }
9
+ .aDBc-top-main-msg {
10
+ border-left: 5px solid pink !important;
11
+ background: #fff !important;
12
+ padding: 20px !important;
13
+ }
14
+ .aDBc-top-main-msg > span {
15
+ font-size: 16px;
16
+ color: #2E6E9E;
17
+ font-weight: bold;
18
+ }
19
+ .aDBc-content-max-width {
20
+ max-width: 840px;
21
+ }
22
+ .aDBc-margin-r-300 {
23
+ margin-top: 10px;
24
+ margin-right: 260px;
25
+ }
26
+ .aDBc-margin-t-20 {
27
+ margin-top: 20px;
28
+ }
29
+ .aDBc-margin-b-20 {
30
+ margin-bottom: 20px;
31
+ }
32
+ .aDBc-margin-l-3 {
33
+ margin-left: 3px !important;
34
+ }
35
+ .aDBc-clear-both{
36
+ clear: both;
37
+ }
38
+ .aDBc-float-left{
39
+ float: left;
40
+ }
41
+ .aDBc-float-right{
42
+ float: right;
43
+ }
44
+ #aDBc-please-wait{
45
+ display: none;
46
+ height: 34px !important;
47
+ margin-bottom: 40px;
48
+ color: #999;
49
+ font-family: verdana;
50
+ font-size: 11px;
51
+ text-align: center;
52
+ }
53
+ .aDBc-loading-gif{
54
+ height: 45px;
55
+ background: url("../images/loading_img.gif") no-repeat;
56
+ background-position: 50% 0% !important;
57
+ text-align: center;
58
+ margin: -20px 0px 0px 0px;
59
+ }
60
+ .aDBc-category-counts{
61
+ background: #fefefe;
62
+ padding: 10px 0px 20px 0px;
63
+ text-align: center;
64
+ }
65
+ .aDBc-category-counts a:hover{
66
+ padding-bottom: 6px;
67
+ border-bottom: 1px solid #ccc;
68
+ }
69
+ .aDBc-category-counts-links {
70
+ text-decoration: none !important;
71
+ }
72
+ .aDBc-selected-category{
73
+ padding-bottom: 6px;
74
+ font-weight: bold;
75
+ }
76
+ .aDBc-category-separator{
77
+ color: #999;
78
+ padding-left: 10px;
79
+ padding-right: 10px
80
+ }
81
+ .aDBc-run-new-search{
82
+ height: 34px !important;
83
+ min-width: 175px !important;
84
+ background-image: url("../images/search-icon.png") !important;
85
+ background-repeat: no-repeat !important;
86
+ background-position: 8px 50% !important;
87
+ padding-left: 30px !important;
88
+ }
89
+ .aDBc-category-color{
90
+ padding: 0px 5px;
91
+ margin-right: 5px;
92
+ border-radius: 2px;
93
+ -moz-border-radius: 2px;
94
+ -webkit-border-radius: 2px;
95
+ display: inline-block;
96
+ height: 10px
97
+ }
98
+ .aDBc-left-content{
99
+ float: left;
100
+ width: 500px;
101
+ margin-right: 25px
102
+ }
103
+ .aDBc-text-status-db{
104
+ font-family: verdana;
105
+ font-size: 11px;
106
+ }
107
+ .aDBc-schedule-text{
108
+ font-weight: bold;
109
+ padding: 20px 0px 10px 0px;
110
+ font-size: 13px;
111
+ }
112
+ .aDBc-schedule-select{
113
+ width: 200px;
114
+ font-size:13px;
115
+ }
116
+ .aDBc-schedule-box{
117
+ border-top: 1px dashed #e1e1e1;
118
+ margin-top: 30px;
119
+ }
120
+ .aDBc-custom-clean-text{
121
+ font-size: 15px;
122
+ margin-top: 15px;
123
+ margin-bottom: 20px;
124
+ color: #0992CC;
125
+ }
126
+ /*---------------------------------------------------------------------------------------------
127
+ *
128
+ * These styles override those of WordPress
129
+ *
130
+ *---------------------------------------------------------------------------------------------*/
131
+ .widefat {
132
+ border-spacing: 1px;
133
+ }
134
+ .widefat > thead {
135
+ background: #f1f1f1;
136
+ }
137
+ .widefat thead tr th{
138
+ color: #666;
139
+ }
140
+ .widefat td, .widefat th {
141
+ border-bottom: 1px solid #f1f1f1;
142
+ border-right: 1px solid #f1f1f1;
143
+ overflow: visible !important;
144
+ }
145
+ .widefat th {
146
+ font-weight: bold !important;
147
+ font-size: 13px !important;
148
+ }
149
+ .widefat > tbody > tr:hover {
150
+ background-color: #f9f9f9;
151
+ }
152
+ .widefat td, .widefat td ol, .widefat td p, .widefat td ul {
153
+ line-height: 1.5em !important;
154
+ }
155
+ .widefat tbody th.check-column, .widefat tfoot td.check-column, .widefat thead td.check-column {
156
+ padding: 9px 0 5px 3px !important;
157
+ }
158
+ .widefat th input, .widefat thead td input{
159
+ margin: 1px 0 0 8px !important;
160
+ }
161
+ /* This style is used by WP tables (WP_List_Table class) for columns, it is not used directly in the code */
162
+ .column-site_id{
163
+ width: 40px;
164
+ }
165
+ .column-o_table_prefix{
166
+ width: 12%;
167
+ }
168
+ .column-o_table_name{
169
+ /*width: 27%;*/
170
+ }
171
+ .column-o_table_name{
172
+ /*width: 27%;*/
173
+ }
174
+ .column-lost_space{
175
+ border-right: 0 none !important;
176
+ width: 15%;
177
+ }
178
+ .column-option_value{
179
+ width: 27%;
180
+ }
181
+ .column-option_autoload{
182
+ width: 8%;
183
+ }
184
+ .column-option_belongs_to{
185
+ width: 25%;
186
+ }
187
+ .column-hook_name{
188
+ width: 30%;
189
+ }
190
+ .column-next_run{
191
+ width: 30%;
192
+ font-size: 12px !important;
193
+ }
194
+ .column-hook_belongs_to{
195
+ /*width: 32%;*/
196
+ }
197
+ .column-table_prefix{
198
+ width: 7%;
199
+ }
200
+ .column-table_name{
201
+ /*width: 100%;*/
202
+ }
203
+ .column-table_rows{
204
+ width: 7%;
205
+ }
206
+ .column-table_size{
207
+ width: 10%;
208
+ }
209
+ .column-table_belongs_to{
210
+ width: 24%;
211
+ font-size: 13px !important;
212
+ border-right: 0 none !important;
213
+ }
214
+ .column-view{
215
+ border-right: 0 none !important;
216
+ width: 20%;
217
+ text-align: center;
218
+ }
219
+ #view,
220
+ #count{
221
+ text-align: center;
222
+ }
223
+ .column-count{
224
+ width: 20%;
225
+ text-align: center;
226
+ }
227
+ .column-draft_id,
228
+ .column-revision_id{
229
+ width: 8%;
230
+ }
231
+ .column-draft_date,
232
+ .column-revision_date{
233
+ width: 20%;
234
+ }
235
+ .column-comment_id{
236
+ width: 6%;
237
+ }
238
+ .column-comment_author{
239
+ width: 14%;
240
+ }
241
+ .column-comment_date{
242
+ width: 18%;
243
+ }
244
+ .column-commentmeta_id,
245
+ .column-postmeta_id{
246
+ width: 6%;
247
+ }
248
+ .column-commentmeta_meta_key,
249
+ .column-postmeta_meta_key{
250
+ width: 22%;
251
+ }
252
+ .column-commentmeta_meta_value{
253
+ font-size: 12px !important;
254
+ }
255
+ .column-dash_feed_option_id{
256
+ width: 10%;
257
+ }
258
+ .column-dash_feed_autoload{
259
+ width: 12%;
260
+ }
261
+ /* To hide tfoot from tables used in the plugin */
262
+ .widefat tfoot {
263
+ display: none;
264
+ }
265
+ /* To add a space between pagination and the head of tables */
266
+ .tablenav {
267
+ margin: 8px 0 12px !important;
268
+ }
269
+ /* To color rows of tables in white */
270
+ .alternate, .striped > tbody > *:nth-child(2n), ul.striped > *:nth-child(2n) {
271
+ background-color: #fff;
272
+ }
273
+ .alternate, .striped > tbody > *:nth-child(2n+1), ul.striped > *:nth-child(2n+1) {
274
+ background-color: #fefefe;
275
+ }
276
+ /* For paginations of tables */
277
+ .tablenav-pages-navspan {
278
+ border-radius: 5px;
279
+ -moz-border-radius: 5px;
280
+ -webkit-border-radius: 5px;
281
+ }
282
+ .tablenav .tablenav-pages a, .tablenav-pages-navspan {
283
+ border-radius: 5px;
284
+ -moz-border-radius: 5px;
285
+ -webkit-border-radius: 5px;
286
+ }
287
+ .tablenav-pages .current-page {
288
+ border-radius: 5px;
289
+ -moz-border-radius: 5px;
290
+ -webkit-border-radius: 5px;
291
+ }
292
+ .displaying-num{
293
+ display: none !important;
294
+ }
295
+ /* For tabs */
296
+ h2.nav-tab-wrapper {
297
+ border-bottom: 0px !important;
298
+ padding-bottom: 0 !important;
299
+ padding-left: 0px !important;
300
+ }
301
+ h2 .nav-tab {
302
+ font-size: 13px;
303
+ line-height: 24px;
304
+ font-weight: normal;
305
+ padding: 4px 10px !important;
306
+ border-radius: 5px 5px 0 0;
307
+ -moz-border-radius: 5px 5px 0 0;
308
+ -webkit-border-radius: 5px 5px 0 0;
309
+ }
310
+ .nav-tab-active, .nav-tab-active:hover {
311
+ background: #fff;
312
+ font-weight: bold !important;
313
+ border-bottom: 0px;
314
+ color: #000;
315
+ border-top: 2px solid #1a9ac9;
316
+ color: #0073aa;
317
+ }
318
+ /*---------------------------------------------------------------------------------------------
319
+ *
320
+ * Tabs
321
+ *
322
+ *---------------------------------------------------------------------------------------------*/
323
+ .aDBc-tab-box {
324
+ float: left;
325
+ width: 100%;
326
+ }
327
+ .aDBc-tab-box-div {
328
+ min-height: 400px;
329
+ background: #fff;
330
+ border: 1px solid #ccc;
331
+ padding: 30px 20px 20px 20px;
332
+ border-radius: 0 5px 5px 5px;
333
+ -moz-border-radius: 0 5px 5px 5px;
334
+ -webkit-border-radius: 0 5px 5px 5px;
335
+ }
336
+
337
+ /*---------------------------------------------------------------------------------------------
338
+ *
339
+ * Sidebar
340
+ *
341
+ *---------------------------------------------------------------------------------------------*/
342
+ .aDBc-sidebar {
343
+ float: right;
344
+ border: 1px solid #ccc;
345
+ background: #fff;
346
+ margin-right: -260px;
347
+ margin-top: 42px;
348
+ width: 240px;
349
+ border-radius: 5px 5px 0 0;
350
+ -moz-border-radius: 5px 5px 0 0;
351
+ -webkit-border-radius: 5px 5px 0 0;
352
+ }
353
+ .aDBc-sidebar > div{
354
+ padding: 15px;
355
+ }
356
+ .aDBc-sidebar h2{
357
+ font-size: 16px;
358
+ text-align: center;
359
+ color: #888;
360
+ line-height: 24px;
361
+ }
362
+ .aDBc-donation-text{
363
+ text-align:center;
364
+ color: #555
365
+ }
366
+ .aDBc-donation-gif{
367
+ background: url("../images/donate.gif") no-repeat;
368
+ width: 92px;
369
+ height: 26px;
370
+ margin: auto;
371
+ }
372
+ .aDBc-grey-row{
373
+ height: 20px;
374
+ background-color: #f9f9f9;
375
+ }
376
+ .aDBc-white-row{
377
+ height: 20px;
378
+ }
379
+ .aDBc-row-text{
380
+ font-size: 13px;
381
+ color: #555;
382
+ }
383
+ .aDBc-sidebar-link{
384
+ text-decoration: none;
385
+ }
386
+ .aDBc-support-us{
387
+ background: url("../images/rate.png") no-repeat center right;
388
+ width: 88px;
389
+ height: 18px;
390
+ margin-top: 0px;
391
+ }
392
+
393
+ /*---------------------------------------------------------------------------------------------
394
+ *
395
+ * Box messages
396
+ *
397
+ *---------------------------------------------------------------------------------------------*/
398
+ .aDBc-box-warning {
399
+ background: #fff5cc url("../images/warning.png") no-repeat scroll 8px 50%;
400
+ /*border-bottom: 1px dashed orange;*/
401
+ color: #404040;
402
+ padding: 10px 10px 10px 40px;
403
+ margin-bottom: 20px;
404
+ }
405
+ .aDBc-box-info {
406
+ background: #f0f5fa url("../images/info.png") no-repeat scroll 8px 50%;
407
+ border-bottom: 1px dashed #ccc;
408
+ color: #404040;
409
+ padding: 10px 10px 10px 40px;
410
+ margin-bottom: 20px;
411
+ }
412
+ .aDBc-right-box{
413
+ float:left;
414
+ padding: 20px 20px 20px 20px;
415
+ margin-bottom: 5px;
416
+ margin-top: 49px;
417
+ border: 1px solid #eee;
418
+ background: #f9f9f9;
419
+ border-radius: 4px;
420
+ -moz-border-radius: 4px;
421
+ -webkit-border-radius: 4px;
422
+ font-size: 12px;
423
+ color: #888;
424
+ }
425
+ .aDBc-jquery-dialog{
426
+ padding:20px;
427
+ display:none;
428
+ }
429
+
430
+ /*---------------------------------------------------------------------------------------------
431
+ *
432
+ * Tool tip
433
+ *
434
+ *---------------------------------------------------------------------------------------------*/
435
+ a.aDBc-tooltips {
436
+ position: relative;
437
+ display: inline;
438
+ cursor: pointer;
439
+ }
440
+ a.aDBc-tooltips span {
441
+ position: absolute;
442
+ color: #fff;
443
+ background: #333;
444
+ font-size: 12px;
445
+ font-weight: normal;
446
+ padding: 8px;
447
+ visibility: hidden;
448
+ width: 200px;
449
+ text-shadow: 0 0px 0 rgba(255, 255, 255, 0.8);
450
+ }
451
+ a.aDBc-tooltips span:after {
452
+ content: '';
453
+ position: absolute;
454
+ top: 18px;
455
+ right: 100%;
456
+ margin-top: -8px;
457
+ width: 0; height: 0;
458
+ border-right: 8px solid #333;
459
+ border-top: 8px solid transparent;
460
+ border-bottom: 8px solid transparent;
461
+ }
462
+ a:hover.aDBc-tooltips span {
463
+ visibility: visible;
464
+ opacity: 0.9;
465
+ left: 100%;
466
+ top: 50%;
467
+ margin-top: -20.5px;
468
+ margin-left: 15px;
469
+ z-index: 999;
470
+ }
471
+
472
+ /*---------------------------------------------------------------------------------------------
473
+ *
474
+ * Premium page style
475
+ *
476
+ *---------------------------------------------------------------------------------------------*/
477
+ .aDBc-upgrade-msg{
478
+ border-left: 6px solid #D091BE !important;
479
+ background: #FFFFD4;
480
+ padding: 1px 8px;
481
+ margin-bottom: 20px;
482
+ }
483
+ .aDBc-check-list{
484
+ background: url("../images/check_ok.png") no-repeat;
485
+ padding-left: 20px;
486
+ margin-left: 20px;
487
+ }
488
+ .aDBc-vertical-box{
489
+ float: left;
490
+ background: #f9f9f9;
491
+ width: 28%;
492
+ margin:5px 15px;
493
+ min-height: 350px;
494
+ }
495
+ .aDBc-vertical-box > a{
496
+ text-decoration: none;
497
+ }
498
+ .aDBc-vertical-box-head{
499
+ color: #fff;
500
+ font-size: 15px;
501
+ font-weight: bold;
502
+ text-align: center;
503
+ padding: 12px;
504
+ background: #69ADE2;
505
+ border-radius: 8px;
506
+ }
507
+ .aDBc-vertical-box-line1{
508
+ text-align: center;
509
+ margin-top: 20px;
510
+ }
511
+ .aDBc-vertical-box-line2{
512
+ text-align: center;
513
+ margin-top: 50px;
514
+ }
515
+
516
+ /*---------------------------------------------------------------------------------------------
517
+ *
518
+ * Overview & settings page
519
+ *
520
+ *---------------------------------------------------------------------------------------------*/
521
+ .aDBc-overview-box{
522
+ float: left;
523
+ margin: 15px 20px 20px 10px;
524
+ width: 45%;
525
+ background: #fff;
526
+ }
527
+ .aDBc-overview-box-head{
528
+ text-align: center;
529
+ color: #fff;
530
+ font-size: 14px;
531
+ font-weight: bold;
532
+ padding: 7px 0px;
533
+ background: #69ADE2;
534
+ border: 1px solid #e1e1e1;
535
+ margin-bottom: 20px;
536
+ }
537
+ .aDBc-overview-box-line{
538
+ margin-left: 15px;
539
+ }
540
+ .aDBc-overview-box-line > li{
541
+ line-height: 32px;
542
+ }
543
+ .aDBc-overview-text-left{
544
+ float: left;
545
+ background: url("../images/check_ok.png") no-repeat left center;
546
+ padding-left: 30px;
547
+ width: 180px;
548
+ }
549
+ .aDBc-overview-text-left-warning{
550
+ float: left;
551
+ background: url("../images/small_warning.png") no-repeat left center;
552
+ padding-left: 30px;
553
+ width: 180px;
554
+ }
555
+ .aDBc-overview-text-right{
556
+ float: left;
557
+ }
558
+ .aDBc-overview-setting-desc{
559
+ padding-left: 24px;
560
+ color: #999;
561
+ line-height: 20px;
562
+ }
563
+ .aDBc-save-settings-button{
564
+ margin-left: 18px !important;
565
+ height: 30px !important;
566
+ padding: 1px 20px !important;
567
+ margin-top: 10px !important;
568
+ }
css/style.css DELETED
@@ -1,227 +0,0 @@
1
- /* ---------------------*/
2
- /* --- Global styles ---*/
3
- /* ---------------------*/
4
- .marginRight300 {
5
- margin-right: 300px;
6
- }
7
- .marginTop20 {
8
- margin-top: 20px;
9
- }
10
- /* For Data already cleaned */
11
- .already-cleaned{
12
- float: left;
13
- background:#f4f4f4;
14
- padding:2px 6px 2px 6px;
15
- border-radius: 8px;
16
- color: #999;
17
- margin: 2px;
18
- font-size: 11px;
19
- }
20
- /* ---------------------*/
21
- /* ----- Tabs style ----*/
22
- /* ---------------------*/
23
- .tabBox {
24
- border-radius: 4px;
25
- margin: 10px 0 40px 0;
26
- float: left;
27
- width: 100%;
28
- }
29
- .tabBox > input[type="radio"] {
30
- position: absolute;
31
- left:-100px;
32
- top:-100px;
33
- }
34
- .tabBox > input[type="radio"] + label {
35
- display: inline-block;
36
- border: 1px solid #DEDBD1;
37
- border-radius: 5px 5px 0 0;
38
- -moz-border-radius: 5px 5px 0 0;
39
- -webkit-border-radius: 5px 5px 0 0;
40
- border-bottom: 0;
41
- padding: 6px 10px;
42
- background-color:#ddd;
43
- color: #111;
44
- font-size: 13px;
45
- }
46
- .tabBox > input[type="radio"]:checked + label {
47
- background-color:white;
48
- font-weight: bold;
49
- margin-bottom: -1px;
50
- color: #0073aa;
51
- border-top: 1px solid #1A9AC9;
52
- }
53
- .tabBox > div {
54
- display: none;
55
- border: 1px solid #DEDBD1;
56
- background-color: white;
57
- padding: 10px 20px 10px 20px;
58
- height: auto;
59
- overflow: auto;
60
- margin-top: -1px;
61
- border-radius: 0 5px 5px 5px;
62
- -moz-border-radius: 0 5px 5px 5px;
63
- -webkit-border-radius: 0 5px 5px 5px;
64
- }
65
- #aDBc-clean:checked ~ .tab1, #aDBc-optimize:checked ~ .tab2, #aDBc-cron:checked ~ .tab3, #aDBc-reset:checked ~ .tab4{
66
- display: block;
67
- min-height: 400px;
68
- }
69
- /* ---------------------------------*/
70
- /* ----- "Clean DB" tabs styles ----*/
71
- /* ---------------------------------*/
72
- /* Style for count numbers */
73
- .aDBcCount {
74
- text-align: right !important;
75
- color: #666 !important;
76
- }
77
- /* Style for check box */
78
- input[type=checkbox] {
79
- visibility: hidden;
80
- }
81
- /* Checkbox style */
82
- .squaredFour {
83
- position: relative;
84
- text-align: center;
85
- }
86
- .squaredFour label {
87
- cursor: pointer;
88
- position: absolute;
89
- width: 16px;
90
- height: 16px;
91
- top: 0;
92
- border-radius: 4px;
93
- border: 1px solid #999;
94
- background: #fcfff4;
95
- }
96
- .squaredFour label:after {
97
- -ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=0)";
98
- filter: alpha(opacity=0);
99
- opacity: 0;
100
- content: '';
101
- position: absolute;
102
- width: 7px;
103
- height: 4px;
104
- background: transparent;
105
- top: 4px;
106
- left: 4px;
107
- border: 2px solid #71ADE1;
108
- border-top: none;
109
- border-right: none;
110
- -webkit-transform: rotate(-45deg);
111
- -moz-transform: rotate(-45deg);
112
- -o-transform: rotate(-45deg);
113
- -ms-transform: rotate(-45deg);
114
- transform: rotate(-45deg);
115
- }
116
- .squaredFour label:hover::after {
117
- -ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=30)";
118
- filter: alpha(opacity=30);
119
- opacity: 0.3;
120
- }
121
- .squaredFour input[type=checkbox]:checked + label:after {
122
- -ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=100)";
123
- filter: alpha(opacity=100);
124
- opacity: 1;
125
- }
126
- /* ---------------------------------*/
127
- /* ------------ Sidebar ------------*/
128
- /* ---------------------------------*/
129
- .aDBcSidebar {
130
- float:right;
131
- border: 1px solid #ccc;
132
- background: #fff;
133
- margin-right: -300px;
134
- margin-top:44px;
135
- width: 280px;
136
- border-radius: 5px 5px 0 0;
137
- -moz-border-radius: 5px 5px 0 0;
138
- -webkit-border-radius: 5px 5px 0 0;
139
- }
140
- .aDBcSidebar > div{
141
- padding: 15px;
142
- }
143
- .aDBcSidebar h2{
144
- font-size:20px;
145
- }
146
- .aDBC-supportUs{
147
- background: url("../images/rate.png") no-repeat center right;
148
- }
149
- /* ---------------------------------*/
150
- /* ------------- Boxes -------------*/
151
- /* ---------------------------------*/
152
- .box-warning {
153
- border-radius: 5px;
154
- -moz-border-radius: 5px;
155
- -webkit-border-radius: 5px;
156
- background: #fff5cc url("../images/warning.png") no-repeat scroll 8px 50%;
157
- border-color: #f2dd8c;
158
- color: #404040;
159
- padding: 10px 10px 10px 50px;
160
- margin-top: 20px;
161
- }
162
- .box-info {
163
- border-radius: 5px;
164
- -moz-border-radius: 5px;
165
- -webkit-border-radius: 5px;
166
- background: #e1f1ff url("../images/info.png") no-repeat scroll 8px 50%;
167
- border-color: #a3d4ff;
168
- color: #404040;
169
- padding: 10px 10px 10px 60px;
170
- margin-top: 20px;
171
- }
172
- .aDBC-topBoxInfo {
173
- clear:both;
174
- border-radius: 5px;
175
- -moz-border-radius: 5px;
176
- -webkit-border-radius: 5px;
177
- background: #F0F5FA url("../images/info.png") no-repeat scroll 8px 50%;
178
- color: #888;
179
- margin-bottom: 25px;
180
- padding: 10px 10px 10px 40px;
181
- max-width: 730px;
182
- }
183
- .aDBCRightBox{
184
- padding:20px 0px 20px 0px;
185
- margin-bottom:5px;
186
- background:#fff;
187
- width:300px;
188
- font-size: 12px;
189
- text-align:justify;
190
- color: #888;
191
- }
192
- /* ---------------------------------*/
193
- /* ------------ Tooltip ------------*/
194
- /* ---------------------------------*/
195
- a.tooltips {
196
- position: relative;
197
- display: inline;
198
- }
199
- a.tooltips span {
200
- position: absolute;
201
- width:400px;
202
- color: #f2f2f2;
203
- background: #000000;
204
- padding:10px;
205
- visibility: hidden;
206
- border-radius: 5px;
207
- }
208
- a.tooltips span:after {
209
- content: '';
210
- position: absolute;
211
- top: 18px;
212
- right: 100%;
213
- margin-top: -8px;
214
- width: 0; height: 0;
215
- border-right: 8px solid #000000;
216
- border-top: 8px solid transparent;
217
- border-bottom: 8px solid transparent;
218
- }
219
- a:hover.tooltips span {
220
- visibility: visible;
221
- opacity: 0.9;
222
- left: 100%;
223
- top: 50%;
224
- margin-top: -20.5px;
225
- margin-left: 15px;
226
- z-index: 999;
227
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
images/about.png DELETED
Binary file
images/check_ok.png ADDED
Binary file
images/db_clean.png CHANGED
Binary file
images/db_not_clean.png CHANGED
Binary file
images/features.png ADDED
Binary file
images/go_back.png ADDED
Binary file
images/help.png ADDED
Binary file
images/loading_img.gif ADDED
Binary file
images/menu-icon.png ADDED
Binary file
images/nothing_to_see.png ADDED
Binary file
images/notice.png ADDED
Binary file
images/order_now.png ADDED
Binary file
images/premium_ok.png ADDED
Binary file
images/search-icon.png ADDED
Binary file
images/see.png ADDED
Binary file
images/small_warning.png ADDED
Binary file
includes/class_clean_cron.php ADDED
@@ -0,0 +1,256 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class ADBC_Tasks_List extends WP_List_Table {
4
+
5
+ /** Holds the message to be displayed if any */
6
+ private $aDBc_message = "";
7
+
8
+ /** Holds the class for the message : updated or error. Default is updated */
9
+ private $aDBc_class_message = "updated";
10
+
11
+ /** Holds tasks that will be displayed */
12
+ private $aDBc_tasks_to_display = array();
13
+
14
+ /** Holds counts + info of tasks categories */
15
+ private $aDBc_tasks_categories_info = array();
16
+
17
+ function __construct(){
18
+ parent::__construct(array(
19
+ 'singular' => __('Task', 'advanced-database-cleaner'), //singular name of the listed records
20
+ 'plural' => __('Tasks', 'advanced-database-cleaner'), //plural name of the listed records
21
+ 'ajax' => false //does this table support ajax?
22
+ ));
23
+ if(isset($_POST['aDBc_new_search_button']) && $_GET['aDBc_cat'] == "all"){
24
+ $this->aDBc_message = __('This feature is available in Pro version only.', 'advanced-database-cleaner');
25
+ $this->aDBc_message .= " <a href='?page=advanced_db_cleaner&aDBc_tab=premium'>" . __('Please upgrade to pro version', 'advanced-database-cleaner') . "</a>";
26
+ $this->aDBc_class_message = "aDBc-upgrade-msg";
27
+ }
28
+ $this->aDBc_prepare_and_count_tasks();
29
+ $this->aDBc_print_page_content();
30
+ }
31
+
32
+ /** Prepare tasks to display and count tasks for each category */
33
+ function aDBc_prepare_and_count_tasks(){
34
+
35
+ // Process bulk action if any before preparing tasks to display
36
+ if(!isset($_POST['aDBc_new_search_button'])){
37
+ $this->process_bulk_action();
38
+ }
39
+
40
+ // Prepare data
41
+ aDBc_prepare_items_to_display($this->aDBc_tasks_to_display, $this->aDBc_tasks_categories_info, "tasks");
42
+
43
+ // Call WP prepare_items function
44
+ $this->prepare_items();
45
+ }
46
+
47
+ /** WP: Get columns */
48
+ function get_columns(){
49
+ $aDBc_belongs_to_toolip = "<a class='aDBc-tooltips'>
50
+ <img class='aDBc-margin-l-3' src='". ADBC_PLUGIN_DIR_PATH . '/images/notice.png' . "'/>
51
+ <span>" . __('Indicates the creator of the cron task. It can be a plugin name, a theme name or WordPress itself.','advanced-database-cleaner') ." </span>
52
+ </a>";
53
+ $columns = array(
54
+ 'cb' => '<input type="checkbox" />',
55
+ 'hook_name' => __('Hook name','advanced-database-cleaner'),
56
+ 'next_run' => __('Next run - Frequency','advanced-database-cleaner'),
57
+ 'site_id' => __('Site id','advanced-database-cleaner'),
58
+ 'hook_belongs_to' => __('Belongs to','advanced-database-cleaner') . $aDBc_belongs_to_toolip
59
+ );
60
+ return $columns;
61
+ }
62
+
63
+ /** WP: Prepare items to display */
64
+ function prepare_items() {
65
+ $columns = $this->get_columns();
66
+ $hidden = $this->get_hidden_columns();
67
+ $sortable = array();
68
+ $this->_column_headers = array($columns, $hidden, $sortable);
69
+ $per_page = 50;
70
+ $current_page = $this->get_pagenum();
71
+ // Prepare sequence of options to display
72
+ $display_data = array_slice($this->aDBc_tasks_to_display,(($current_page-1) * $per_page), $per_page);
73
+ $this->set_pagination_args( array(
74
+ 'total_items' => count($this->aDBc_tasks_to_display),
75
+ 'per_page' => $per_page
76
+ ));
77
+ $this->items = $display_data;
78
+ }
79
+
80
+ /** WP: Get columns that should be hidden */
81
+ function get_hidden_columns(){
82
+ // If MU, nothing to hide, else hide Side ID column
83
+ if(function_exists('is_multisite') && is_multisite()){
84
+ return array();
85
+ }else{
86
+ return array('site_id');
87
+ }
88
+ }
89
+
90
+ /** WP: Column default */
91
+ function column_default($item, $column_name){
92
+ switch($column_name){
93
+ case 'hook_name':
94
+ case 'next_run':
95
+ case 'site_id':
96
+ case 'hook_belongs_to':
97
+ return $item[$column_name];
98
+ default:
99
+ return print_r($item, true) ; //Show the whole array for troubleshooting purposes
100
+ }
101
+ }
102
+
103
+ /** WP: Column cb for check box */
104
+ function column_cb($item) {
105
+ return sprintf('<input type="checkbox" name="aDBc_tasks_to_delete[]" value="%s" />', $item['site_id']."|".$item['hook_name']);
106
+ }
107
+
108
+ /** WP: Get bulk actions */
109
+ function get_bulk_actions() {
110
+ $actions = array(
111
+ 'delete' => __('Delete','advanced-database-cleaner')
112
+ );
113
+ return $actions;
114
+ }
115
+
116
+ /** WP: Message to display when no items found */
117
+ function no_items() {
118
+ if($_GET['aDBc_cat'] == "all"){
119
+ _e('No tasks found!','advanced-database-cleaner');
120
+ }else{
121
+ _e('Available in Pro version!', 'advanced-database-cleaner');
122
+ }
123
+ }
124
+
125
+ /** WP: Process bulk actions */
126
+ public function process_bulk_action() {
127
+ // security check!
128
+ if (isset($_POST['_wpnonce']) && !empty($_POST['_wpnonce'])){
129
+ $nonce = filter_input(INPUT_POST, '_wpnonce', FILTER_SANITIZE_STRING);
130
+ $action = 'bulk-' . $this->_args['plural'];
131
+ if (!wp_verify_nonce( $nonce, $action))
132
+ wp_die('Security check failed!');
133
+ }
134
+ $action = $this->current_action();
135
+
136
+ if($action == 'delete'){
137
+ // If the user wants to clean the tasks he/she selected
138
+ if(isset($_POST['aDBc_tasks_to_delete'])){
139
+ if(function_exists('is_multisite') && is_multisite()){
140
+ // Prepare tasks to delete in organized array to minimize switching from blogs
141
+ $tasks_to_delete = array();
142
+ foreach($_POST['aDBc_tasks_to_delete'] as $task){
143
+ $task_info = explode("|", $task);
144
+ if(empty($tasks_to_delete[$task_info[0]])){
145
+ $tasks_to_delete[$task_info[0]] = array();
146
+ }
147
+ array_push($tasks_to_delete[$task_info[0]], $task_info[1]);
148
+ }
149
+ // Delete tasks
150
+ foreach($tasks_to_delete as $site_id => $tasks){
151
+ switch_to_blog($site_id);
152
+ foreach($tasks as $task) {
153
+ wp_clear_scheduled_hook($task);
154
+ }
155
+ restore_current_blog();
156
+ }
157
+ }else{
158
+ foreach($_POST['aDBc_tasks_to_delete'] as $task) {
159
+ $aDBc_cron_info = explode("|", $task);
160
+ wp_clear_scheduled_hook($aDBc_cron_info[1]);
161
+ }
162
+ }
163
+ // Update the message to show to the user
164
+ $this->aDBc_message = __('Selected scheduled tasks cleaned successfully!', 'advanced-database-cleaner');
165
+ }
166
+ }
167
+ }
168
+
169
+ /** Print the page content */
170
+ function aDBc_print_page_content(){
171
+ // Print a message if any
172
+ if($this->aDBc_message != ""){
173
+ echo '<div id="aDBc_message" class="' . $this->aDBc_class_message . ' notice is-dismissible"><p>' . $this->aDBc_message . '</p></div>';
174
+ }
175
+ ?>
176
+ <div class="aDBc-content-max-width">
177
+ <form id="aDBc_form" action="" method="post">
178
+ <?php
179
+ $aDBc_new_URI = $_SERVER['REQUEST_URI'];
180
+ // Remove the paged parameter to start always from the first page when selecting a new category of tasks
181
+ $aDBc_new_URI = remove_query_arg('paged', $aDBc_new_URI);
182
+ ?>
183
+ <!-- Print numbers of tasks found in each category -->
184
+ <div class="aDBc-category-counts">
185
+ <?php
186
+ $iterations = 0;
187
+ foreach($this->aDBc_tasks_categories_info as $abreviation => $category_info){
188
+ $iterations++;
189
+ $aDBc_new_URI = add_query_arg('aDBc_cat', $abreviation, $aDBc_new_URI);?>
190
+ <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'] : '' ?> ">
191
+ <a href="<?php echo $aDBc_new_URI; ?>" class="aDBc-category-counts-links" style="color:<?php echo $category_info['color']; ?>">
192
+ <span class="aDBc-category-color" style="background: <?php echo $category_info['color']; ?>"></span>
193
+ <span><?php echo $category_info['name']; ?> : </span>
194
+ <span><?php echo $category_info['count'];?></span>
195
+ </a>
196
+ </span>
197
+ <?php
198
+ if($iterations < 5){
199
+ echo '<span class="aDBc-category-separator"></span>';
200
+ }
201
+ }?>
202
+ </div>
203
+
204
+ <div class="aDBc-clear-both"></div>
205
+
206
+ <!-- Code for "run new search" button + Show loading image -->
207
+ <div class="aDBc-margin-t-20">
208
+ <input id="aDBc_new_search_button" type="submit" class="button-primary aDBc-run-new-search" value="<?php _e('Detect orphan tasks','advanced-database-cleaner'); ?>" name="aDBc_new_search_button"/>
209
+
210
+ <div id="aDBc-please-wait">
211
+ <div class="aDBc-loading-gif"></div>
212
+ <?php
213
+ //_e('Searching...Please wait! If your browser stops loading without refreshing, please refresh this page.','advanced-database-cleaner');
214
+ _e('Please wait!','advanced-database-cleaner');
215
+ ?>
216
+ </div>
217
+ </div>
218
+
219
+ <div class="aDBc-clear-both aDBc-margin-b-20"></div>
220
+
221
+ <!-- Print a notice/warning according to each type of tasks -->
222
+ <?php
223
+ if($_GET['aDBc_cat'] == 'all' && $this->aDBc_tasks_categories_info['all']['count'] > 0){
224
+ echo '<div class="aDBc-box-warning">' . __('Below the list of all your scheduled tasks. Please do not delete any task unless you really know what you are doing!','advanced-database-cleaner') . '</div>';
225
+ }
226
+
227
+ if($_GET['aDBc_cat'] != 'all'){
228
+ echo '<div class="aDBc-upgrade-msg notice is-dismissible"><p>' . __('This feature is available in Pro version only.', 'advanced-database-cleaner') . ' <a href="?page=advanced_db_cleaner&aDBc_tab=premium">' . __('Please upgrade to pro version', 'advanced-database-cleaner') . "</a>" . '</p></div>';
229
+ }
230
+
231
+ // Print the tasks
232
+ $this->display();
233
+
234
+ ?>
235
+ </form>
236
+ </div>
237
+ <div id="aDBc_dialog1" title="<?php _e('Cleaning...','advanced-database-cleaner'); ?>" class="aDBc-jquery-dialog">
238
+ <p class="aDBc-box-warning">
239
+ <?php _e('You are about to clean some of your scheduled tasks. This operation is irreversible. Don\'t forget to make a backup first.','advanced-database-cleaner'); ?>
240
+ </p>
241
+ <p>
242
+ <?php _e('Are you sure to continue?','advanced-database-cleaner'); ?>
243
+ </p>
244
+ </div>
245
+ <div id="aDBc_dialog2" title="<?php _e('Action required','advanced-database-cleaner'); ?>" class="aDBc-jquery-dialog">
246
+ <p class="aDBc-box-info">
247
+ <?php _e('Please select an action!','advanced-database-cleaner'); ?>
248
+ </p>
249
+ </div>
250
+ <?php
251
+ }
252
+ }
253
+
254
+ new ADBC_Tasks_List();
255
+
256
+ ?>
includes/class_clean_options.php ADDED
@@ -0,0 +1,258 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class ADBC_Options_List extends WP_List_Table {
4
+
5
+ /** Holds the message to be displayed if any */
6
+ private $aDBc_message = "";
7
+
8
+ /** Holds the class for the message : updated or error. Default is updated */
9
+ private $aDBc_class_message = "updated";
10
+
11
+ /** Holds options that will be displayed */
12
+ private $aDBc_options_to_display = array();
13
+
14
+ /** Holds counts + info of options categories */
15
+ private $aDBc_options_categories_info = array();
16
+
17
+ function __construct(){
18
+ parent::__construct(array(
19
+ 'singular' => __('Option', 'advanced-database-cleaner'), //singular name of the listed records
20
+ 'plural' => __('Options', 'advanced-database-cleaner'), //plural name of the listed records
21
+ 'ajax' => false //does this table support ajax?
22
+ ));
23
+ if(isset($_POST['aDBc_new_search_button']) && $_GET['aDBc_cat'] == "all"){
24
+ $this->aDBc_message = __('This feature is available in Pro version only.', 'advanced-database-cleaner');
25
+ $this->aDBc_message .= " <a href='?page=advanced_db_cleaner&aDBc_tab=premium'>" . __('Please upgrade to pro version', 'advanced-database-cleaner') . "</a>";
26
+ $this->aDBc_class_message = "aDBc-upgrade-msg";
27
+ }
28
+ $this->aDBc_prepare_and_count_options();
29
+ $this->aDBc_print_page_content();
30
+ }
31
+
32
+ /** Prepare options to display and count options for each category */
33
+ function aDBc_prepare_and_count_options(){
34
+
35
+ // Process bulk action if any before preparing options to display
36
+ if(!isset($_POST['aDBc_new_search_button'])){
37
+ $this->process_bulk_action();
38
+ }
39
+
40
+ // Prepare data
41
+ aDBc_prepare_items_to_display($this->aDBc_options_to_display, $this->aDBc_options_categories_info, "options");
42
+
43
+ // Call WP prepare_items function
44
+ $this->prepare_items();
45
+ }
46
+
47
+ /** WP: Get columns */
48
+ function get_columns(){
49
+ $aDBc_belongs_to_toolip = "<a class='aDBc-tooltips'>
50
+ <img class='aDBc-margin-l-3' src='". ADBC_PLUGIN_DIR_PATH . '/images/notice.png' . "'/>
51
+ <span>" . __('Indicates the creator of the option. It can be a plugin name, a theme name or WordPress itself.','advanced-database-cleaner') ." </span>
52
+ </a>";
53
+ $columns = array(
54
+ 'cb' => '<input type="checkbox" />',
55
+ 'option_name' => __('Option name','advanced-database-cleaner'),
56
+ 'option_value' => __('Value','advanced-database-cleaner'),
57
+ 'option_autoload' => __('Autoload','advanced-database-cleaner'),
58
+ 'site_id' => __('Site id','advanced-database-cleaner'),
59
+ 'option_belongs_to' => __('Belongs to','advanced-database-cleaner') . $aDBc_belongs_to_toolip
60
+ );
61
+ return $columns;
62
+ }
63
+
64
+ /** WP: Prepare items to display */
65
+ function prepare_items() {
66
+ $columns = $this->get_columns();
67
+ $hidden = $this->get_hidden_columns();
68
+ $sortable = array();
69
+ $this->_column_headers = array($columns, $hidden, $sortable);
70
+ $per_page = 50;
71
+ $current_page = $this->get_pagenum();
72
+ // Prepare sequence of options to display
73
+ $display_data = array_slice($this->aDBc_options_to_display,(($current_page-1) * $per_page), $per_page);
74
+ $this->set_pagination_args( array(
75
+ 'total_items' => count($this->aDBc_options_to_display),
76
+ 'per_page' => $per_page
77
+ ));
78
+ $this->items = $display_data;
79
+ }
80
+
81
+ /** WP: Get columns that should be hidden */
82
+ function get_hidden_columns(){
83
+ // If MU, nothing to hide, else hide Side ID column
84
+ if(function_exists('is_multisite') && is_multisite()){
85
+ return array();
86
+ }else{
87
+ return array('site_id');
88
+ }
89
+ }
90
+
91
+ /** WP: Column default */
92
+ function column_default($item, $column_name){
93
+ switch($column_name){
94
+ case 'option_name':
95
+ case 'option_value':
96
+ case 'option_autoload':
97
+ case 'site_id':
98
+ case 'option_belongs_to':
99
+ return $item[$column_name];
100
+ default:
101
+ return print_r($item, true) ; //Show the whole array for troubleshooting purposes
102
+ }
103
+ }
104
+
105
+ /** WP: Column cb for check box */
106
+ function column_cb($item) {
107
+ return sprintf('<input type="checkbox" name="aDBc_options_to_delete[]" value="%s" />', $item['site_id']."|".$item['option_name']);
108
+ }
109
+
110
+ /** WP: Get bulk actions */
111
+ function get_bulk_actions() {
112
+ $actions = array(
113
+ 'delete' => __('Delete','advanced-database-cleaner')
114
+ );
115
+ return $actions;
116
+ }
117
+
118
+ /** WP: Message to display when no items found */
119
+ function no_items() {
120
+ if($_GET['aDBc_cat'] == "all"){
121
+ _e('No tasks found!','advanced-database-cleaner');
122
+ }else{
123
+ _e('Available in Pro version!', 'advanced-database-cleaner');
124
+ }
125
+ }
126
+
127
+ /** WP: Process bulk actions */
128
+ public function process_bulk_action() {
129
+ // security check!
130
+ if (isset($_POST['_wpnonce']) && !empty($_POST['_wpnonce'])){
131
+ $nonce = filter_input(INPUT_POST, '_wpnonce', FILTER_SANITIZE_STRING);
132
+ $action = 'bulk-' . $this->_args['plural'];
133
+ if (!wp_verify_nonce( $nonce, $action))
134
+ wp_die('Security check failed!');
135
+ }
136
+ $action = $this->current_action();
137
+
138
+ if($action == 'delete'){
139
+ // If the user wants to clean the options he/she selected
140
+ if(isset($_POST['aDBc_options_to_delete'])){
141
+ if(function_exists('is_multisite') && is_multisite()){
142
+ // Prepare options to delete in organized array to minimize switching from blogs
143
+ $options_to_delete = array();
144
+ foreach($_POST['aDBc_options_to_delete'] as $option){
145
+ $option_info = explode("|", $option);
146
+ if(empty($options_to_delete[$option_info[0]])){
147
+ $options_to_delete[$option_info[0]] = array();
148
+ }
149
+ array_push($options_to_delete[$option_info[0]], $option_info[1]);
150
+ }
151
+ // Delete options
152
+ foreach($options_to_delete as $site_id => $options){
153
+ switch_to_blog($site_id);
154
+ foreach($options as $option) {
155
+ delete_option($option);
156
+ }
157
+ restore_current_blog();
158
+ }
159
+ }else{
160
+ foreach($_POST['aDBc_options_to_delete'] as $option) {
161
+ $aDBc_option_info = explode("|", $option);
162
+ delete_option($aDBc_option_info[1]);
163
+ }
164
+ }
165
+ // Update the message to show to the user
166
+ $this->aDBc_message = __('Selected options cleaned successfully!', 'advanced-database-cleaner');
167
+ }
168
+ }
169
+ }
170
+
171
+ /** Print the page content */
172
+ function aDBc_print_page_content(){
173
+ // Print a message if any
174
+ if($this->aDBc_message != ""){
175
+ echo '<div id="aDBc_message" class="' . $this->aDBc_class_message . ' notice is-dismissible"><p>' . $this->aDBc_message . '</p></div>';
176
+ }
177
+ ?>
178
+ <div class="aDBc-content-max-width">
179
+ <form id="aDBc_form" action="" method="post">
180
+ <?php
181
+ $aDBc_new_URI = $_SERVER['REQUEST_URI'];
182
+ // Remove the paged parameter to start always from the first page when selecting a new category of options
183
+ $aDBc_new_URI = remove_query_arg('paged', $aDBc_new_URI);
184
+ ?>
185
+ <!-- Print numbers of options found in each category -->
186
+ <div class="aDBc-category-counts">
187
+ <?php
188
+ $iterations = 0;
189
+ foreach($this->aDBc_options_categories_info as $abreviation => $category_info){
190
+ $iterations++;
191
+ $aDBc_new_URI = add_query_arg('aDBc_cat', $abreviation, $aDBc_new_URI);?>
192
+ <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'] : '' ?> ">
193
+ <a href="<?php echo $aDBc_new_URI; ?>" class="aDBc-category-counts-links" style="color:<?php echo $category_info['color']; ?>">
194
+ <span class="aDBc-category-color" style="background: <?php echo $category_info['color']; ?>"></span>
195
+ <span><?php echo $category_info['name']; ?> : </span>
196
+ <span><?php echo $category_info['count'];?></span>
197
+ </a>
198
+ </span>
199
+ <?php
200
+ if($iterations < 5){
201
+ echo '<span class="aDBc-category-separator"></span>';
202
+ }
203
+ }?>
204
+ </div>
205
+
206
+ <div class="aDBc-clear-both"></div>
207
+
208
+ <!-- Code for "run new search" button + Show loading image -->
209
+ <div class="aDBc-margin-t-20">
210
+ <input id="aDBc_new_search_button" type="submit" class="button-primary aDBc-run-new-search" value="<?php _e('Detect orphan options','advanced-database-cleaner'); ?>" name="aDBc_new_search_button"/>
211
+
212
+ <div id="aDBc-please-wait">
213
+ <div class="aDBc-loading-gif"></div>
214
+ <?php
215
+ //_e('Searching...Please wait! If your browser stops loading without refreshing, please refresh this page.','advanced-database-cleaner');
216
+ _e('Please wait!','advanced-database-cleaner');
217
+ ?>
218
+ </div>
219
+ </div>
220
+
221
+ <div class="aDBc-clear-both aDBc-margin-b-20"></div>
222
+
223
+ <!-- Print a notice/warning according to each type of options -->
224
+ <?php
225
+ if($_GET['aDBc_cat'] == 'all' && $this->aDBc_options_categories_info['all']['count'] > 0){
226
+ echo '<div class="aDBc-box-warning">' . __('Below the list of all your options. Please do not delete any option unless you really know what you are doing!','advanced-database-cleaner') . '</div>';
227
+ }
228
+
229
+ if($_GET['aDBc_cat'] != 'all'){
230
+ echo '<div class="aDBc-upgrade-msg notice is-dismissible"><p>' . __('This feature is available in Pro version only.', 'advanced-database-cleaner') . ' <a href="?page=advanced_db_cleaner&aDBc_tab=premium">' . __('Please upgrade to pro version', 'advanced-database-cleaner') . "</a>" . '</p></div>';
231
+ }
232
+
233
+ // Print the options
234
+ $this->display();
235
+
236
+ ?>
237
+ </form>
238
+ </div>
239
+ <div id="aDBc_dialog1" title="<?php _e('Cleaning...','advanced-database-cleaner'); ?>" class="aDBc-jquery-dialog">
240
+ <p class="aDBc-box-warning">
241
+ <?php _e('You are about to clean some of your options. This operation is irreversible. Don\'t forget to make a backup first.','advanced-database-cleaner'); ?>
242
+ </p>
243
+ <p>
244
+ <?php _e('Are you sure to continue?','advanced-database-cleaner'); ?>
245
+ </p>
246
+ </div>
247
+ <div id="aDBc_dialog2" title="<?php _e('Action required','advanced-database-cleaner'); ?>" class="aDBc-jquery-dialog">
248
+ <p class="aDBc-box-info">
249
+ <?php _e('Please select an action!','advanced-database-cleaner'); ?>
250
+ </p>
251
+ </div>
252
+ <?php
253
+ }
254
+ }
255
+
256
+ new ADBC_Options_List();
257
+
258
+ ?>
includes/class_clean_tables.php ADDED
@@ -0,0 +1,241 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class ADBC_Tables_List extends WP_List_Table {
4
+
5
+ /** Holds the message to be displayed if any */
6
+ private $aDBc_message = "";
7
+
8
+ /** Holds the class for the message : updated or error. Default is updated */
9
+ private $aDBc_class_message = "updated";
10
+
11
+ /** Holds tables that will be displayed */
12
+ private $aDBc_tables_to_display = array();
13
+
14
+ /** Holds counts + info of tables categories */
15
+ private $aDBc_tables_categories_info = array();
16
+
17
+ function __construct(){
18
+ parent::__construct(array(
19
+ 'singular' => __('Table', 'advanced-database-cleaner'), //singular name of the listed records
20
+ 'plural' => __('Tables', 'advanced-database-cleaner'), //plural name of the listed records
21
+ 'ajax' => false //does this table support ajax?
22
+ ));
23
+ if(isset($_POST['aDBc_new_search_button']) && $_GET['aDBc_cat'] == "all"){
24
+ $this->aDBc_message = __('This feature is available in Pro version only.', 'advanced-database-cleaner');
25
+ $this->aDBc_message .= " <a href='?page=advanced_db_cleaner&aDBc_tab=premium'>" . __('Please upgrade to pro version', 'advanced-database-cleaner') . "</a>";
26
+ $this->aDBc_class_message = "aDBc-upgrade-msg";
27
+ }
28
+ $this->aDBc_prepare_and_count_tables();
29
+ $this->aDBc_print_page_content();
30
+ }
31
+
32
+ /** Prepare tables to display and count tables for each category */
33
+ function aDBc_prepare_and_count_tables(){
34
+
35
+ // Process bulk action if any before preparing tables to display
36
+ if(!isset($_POST['aDBc_new_search_button'])){
37
+ $this->process_bulk_action();
38
+ }
39
+
40
+ // Prepare data
41
+ aDBc_prepare_items_to_display($this->aDBc_tables_to_display, $this->aDBc_tables_categories_info, "tables");
42
+
43
+ // Call WP prepare_items function
44
+ $this->prepare_items();
45
+ }
46
+
47
+ /** WP: Get columns */
48
+ function get_columns(){
49
+ $aDBc_belongs_to_toolip = "<a class='aDBc-tooltips'>
50
+ <img class='aDBc-margin-l-3' src='". ADBC_PLUGIN_DIR_PATH . '/images/notice.png' . "'/>
51
+ <span>" . __('Indicates the creator of the table. It can be a plugin name, a theme name or WordPress itself.','advanced-database-cleaner') ." </span>
52
+ </a>";
53
+ $columns = array(
54
+ 'cb' => '<input type="checkbox" />',
55
+ 'table_prefix' => __('Prefix','advanced-database-cleaner'),
56
+ 'table_name' => __('Table name','advanced-database-cleaner'),
57
+ 'table_rows' => __('Rows','advanced-database-cleaner'),
58
+ 'table_size' => __('Size','advanced-database-cleaner'),
59
+ 'site_id' => __('Site id','advanced-database-cleaner'),
60
+ 'table_belongs_to' => __('Belongs to','advanced-database-cleaner') . $aDBc_belongs_to_toolip
61
+ );
62
+ return $columns;
63
+ }
64
+
65
+ /** WP: Prepare items to display */
66
+ function prepare_items() {
67
+ $columns = $this->get_columns();
68
+ $hidden = $this->get_hidden_columns();
69
+ $sortable = array();
70
+ $this->_column_headers = array($columns, $hidden, $sortable);
71
+ $per_page = 50;
72
+ $current_page = $this->get_pagenum();
73
+ // Prepare sequence of tables to display
74
+ $display_data = array_slice($this->aDBc_tables_to_display,(($current_page-1) * $per_page), $per_page);
75
+ $this->set_pagination_args( array(
76
+ 'total_items' => count($this->aDBc_tables_to_display),
77
+ 'per_page' => $per_page
78
+ ));
79
+ $this->items = $display_data;
80
+ }
81
+
82
+ /** WP: Get columns that should be hidden */
83
+ function get_hidden_columns(){
84
+ // If MU, nothing to hide, else hide Side ID column
85
+ if(function_exists('is_multisite') && is_multisite()){
86
+ return array();
87
+ }else{
88
+ return array('site_id');
89
+ }
90
+ }
91
+
92
+ /** WP: Column default */
93
+ function column_default($item, $column_name){
94
+ switch($column_name){
95
+ case 'table_prefix':
96
+ case 'table_name':
97
+ case 'table_rows':
98
+ case 'table_size':
99
+ case 'site_id':
100
+ case 'table_belongs_to':
101
+ return $item[$column_name];
102
+ default:
103
+ return print_r($item, true) ; //Show the whole array for troubleshooting purposes
104
+ }
105
+ }
106
+
107
+ /** WP: Column cb for check box */
108
+ function column_cb($item) {
109
+ return sprintf('<input type="checkbox" name="aDBc_tables_to_delete[]" value="%s" />', $item['table_prefix']."|".$item['table_name']);
110
+ }
111
+
112
+ /** WP: Get bulk actions */
113
+ function get_bulk_actions() {
114
+ $actions = array(
115
+ 'delete' => __('Delete','advanced-database-cleaner')
116
+ );
117
+ return $actions;
118
+ }
119
+
120
+ /** WP: Message to display when no items found */
121
+ function no_items() {
122
+ if($_GET['aDBc_cat'] == "all"){
123
+ _e('No tasks found!','advanced-database-cleaner');
124
+ }else{
125
+ _e('Available in Pro version!', 'advanced-database-cleaner');
126
+ }
127
+ }
128
+
129
+ /** WP: Process bulk actions */
130
+ public function process_bulk_action() {
131
+ // security check!
132
+ if (isset($_POST['_wpnonce']) && !empty($_POST['_wpnonce'])){
133
+ $nonce = filter_input(INPUT_POST, '_wpnonce', FILTER_SANITIZE_STRING);
134
+ $action = 'bulk-' . $this->_args['plural'];
135
+ if (!wp_verify_nonce( $nonce, $action))
136
+ wp_die('Security check failed!');
137
+ }
138
+ $action = $this->current_action();
139
+
140
+ if($action == 'delete'){
141
+ // If the user wants to clean the tables he/she selected
142
+ if(isset($_POST['aDBc_tables_to_delete'])){
143
+ global $wpdb;
144
+ foreach($_POST['aDBc_tables_to_delete'] as $table) {
145
+ $table_info = explode("|", $table);
146
+ $wpdb->query("DROP TABLE " . $table_info[0].$table_info[1]);
147
+ }
148
+ // Update the message to show to the user
149
+ $this->aDBc_message = __('Selected tables cleaned successfully!', 'advanced-database-cleaner');
150
+ }
151
+ }
152
+ }
153
+
154
+ /** Print the page content */
155
+ function aDBc_print_page_content(){
156
+ // Print a message if any
157
+ if($this->aDBc_message != ""){
158
+ echo '<div id="aDBc_message" class="' . $this->aDBc_class_message . ' notice is-dismissible"><p>' . $this->aDBc_message . '</p></div>';
159
+ }
160
+ ?>
161
+ <div class="aDBc-content-max-width">
162
+ <form id="aDBc_form" action="" method="post">
163
+ <?php
164
+ $aDBc_new_URI = $_SERVER['REQUEST_URI'];
165
+ // Remove the paged parameter to start always from the first page when selecting a new category of tables
166
+ $aDBc_new_URI = remove_query_arg('paged', $aDBc_new_URI);
167
+ ?>
168
+ <!-- Print numbers of tables found in each category -->
169
+ <div class="aDBc-category-counts">
170
+ <?php
171
+ $iterations = 0;
172
+ foreach($this->aDBc_tables_categories_info as $abreviation => $category_info){
173
+ $iterations++;
174
+ $aDBc_new_URI = add_query_arg('aDBc_cat', $abreviation, $aDBc_new_URI);?>
175
+ <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'] : '' ?> ">
176
+ <a href="<?php echo $aDBc_new_URI; ?>" class="aDBc-category-counts-links" style="color:<?php echo $category_info['color']; ?>">
177
+ <span class="aDBc-category-color" style="background: <?php echo $category_info['color']; ?>"></span>
178
+ <span><?php echo $category_info['name']; ?> : </span>
179
+ <span><?php echo $category_info['count'];?></span>
180
+ </a>
181
+ </span>
182
+ <?php
183
+ if($iterations < 5){
184
+ echo '<span class="aDBc-category-separator"></span>';
185
+ }
186
+ }?>
187
+ </div>
188
+
189
+ <div class="aDBc-clear-both"></div>
190
+
191
+ <!-- Code for "run new search" button + Show loading image -->
192
+ <div class="aDBc-margin-t-20">
193
+ <input id="aDBc_new_search_button" type="submit" class="button-primary aDBc-run-new-search" value="<?php _e('Detect orphan tables','advanced-database-cleaner'); ?>" name="aDBc_new_search_button"/>
194
+
195
+ <div id="aDBc-please-wait">
196
+ <div class="aDBc-loading-gif"></div>
197
+ <?php
198
+ //_e('Searching...Please wait! If your browser stops loading without refreshing, please refresh this page.','advanced-database-cleaner');
199
+ _e('Please wait!','advanced-database-cleaner');
200
+ ?>
201
+ </div>
202
+ </div>
203
+
204
+ <div class="aDBc-clear-both aDBc-margin-b-20"></div>
205
+
206
+ <!-- Print a notice/warning according to each type of tables -->
207
+ <?php
208
+ if($_GET['aDBc_cat'] == 'all' && $this->aDBc_tables_categories_info['all']['count'] > 0){
209
+ echo '<div class="aDBc-box-warning">' . __('Below the list of all your tables. Please do not delete any table unless you really know what you are doing!','advanced-database-cleaner') . '</div>';
210
+ }
211
+
212
+ if($_GET['aDBc_cat'] != 'all'){
213
+ echo '<div class="aDBc-upgrade-msg notice is-dismissible"><p>' . __('This feature is available in Pro version only.', 'advanced-database-cleaner') . ' <a href="?page=advanced_db_cleaner&aDBc_tab=premium">' . __('Please upgrade to pro version', 'advanced-database-cleaner') . "</a>" . '</p></div>';
214
+ }
215
+
216
+ // Print the tables
217
+ $this->display();
218
+
219
+ ?>
220
+ </form>
221
+ </div>
222
+ <div id="aDBc_dialog1" title="<?php _e('Cleaning...','advanced-database-cleaner'); ?>" class="aDBc-jquery-dialog">
223
+ <p class="aDBc-box-warning">
224
+ <?php _e('You are about to clean some of your tables. This operation is irreversible. Don\'t forget to make a backup first.','advanced-database-cleaner'); ?>
225
+ </p>
226
+ <p>
227
+ <?php _e('Are you sure to continue?','advanced-database-cleaner'); ?>
228
+ </p>
229
+ </div>
230
+ <div id="aDBc_dialog2" title="<?php _e('Action required','advanced-database-cleaner'); ?>" class="aDBc-jquery-dialog">
231
+ <p class="aDBc-box-info">
232
+ <?php _e('Please select an action!','advanced-database-cleaner'); ?>
233
+ </p>
234
+ </div>
235
+ <?php
236
+ }
237
+ }
238
+
239
+ new ADBC_Tables_List();
240
+
241
+ ?>
includes/class_general_cleanup.php ADDED
@@ -0,0 +1,242 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
+ if(isset($_POST['aDBc_save_schedule'])){
21
+ wp_clear_scheduled_hook('aDBc_clean_scheduler');
22
+ if($_POST['aDBc_clean_schedule'] == 'no_schedule'){
23
+ delete_option('aDBc_clean_schedule');
24
+ }else{
25
+ update_option('aDBc_clean_schedule', $_POST['aDBc_clean_schedule']);
26
+ wp_schedule_event(time()+60, $_POST['aDBc_clean_schedule'], 'aDBc_clean_scheduler');
27
+ }
28
+ $this->aDBc_message = __('The clean-up schedule saved successfully!', 'advanced-database-cleaner');
29
+ }
30
+
31
+ $this->aDBc_prepare_elements_to_clean();
32
+ $this->aDBc_print_page_content();
33
+ }
34
+
35
+ /** Prepare elements to display */
36
+ function aDBc_prepare_elements_to_clean(){
37
+ global $wpdb;
38
+ // Process bulk action if any before preparing elements to clean
39
+ $this->process_bulk_action();
40
+ // Get all unused elements
41
+ $aDBc_unused_elements = aDBc_count_all_elements_to_clean();
42
+ $aDBc_new_URI = $_SERVER['REQUEST_URI'];
43
+ foreach($aDBc_unused_elements as $element_type => $element_info){
44
+ // Count total unused elements
45
+ $this->aDBc_total_elements_to_clean += $element_info['count'];
46
+ if($element_info['count'] > 0){
47
+ $aDBc_count = $element_info['count'];
48
+ $aDBc_new_URI = add_query_arg('aDBc_view', $element_type, $aDBc_new_URI);
49
+ $aDBc_see = "<a href='$aDBc_new_URI'><img alt='view' src='".ADBC_PLUGIN_DIR_PATH . '/images/see.png'."'/></a>";
50
+ }else{
51
+ $aDBc_count = "<img src='".ADBC_PLUGIN_DIR_PATH . '/images/check_ok.png'."'/>";
52
+ $aDBc_see = "<img alt='-' src='".ADBC_PLUGIN_DIR_PATH . '/images/nothing_to_see.png'."'/>";
53
+ }
54
+ array_push($this->aDBc_elements_to_display, array(
55
+ 'element_to_clean' => $element_info['name'],
56
+ 'count' => $aDBc_count,
57
+ 'view' => $aDBc_see,
58
+ 'type' => $element_type
59
+ )
60
+ );
61
+ }
62
+ // Call WP prepare_items function
63
+ $this->prepare_items();
64
+ }
65
+
66
+ /** WP: Get columns */
67
+ function get_columns(){
68
+ $columns = array(
69
+ 'cb' => '<input type="checkbox" />',
70
+ 'element_to_clean' => __('Element to clean','advanced-database-cleaner'),
71
+ 'count' => __('Count','advanced-database-cleaner'),
72
+ 'view' => __('View','advanced-database-cleaner'),
73
+ 'type' => 'Type'
74
+ );
75
+ return $columns;
76
+ }
77
+
78
+ /** WP: Prepare items to display */
79
+ function prepare_items() {
80
+ $columns = $this->get_columns();
81
+ $hidden = $this->get_hidden_columns();
82
+ $sortable = array();
83
+ $this->_column_headers = array($columns, $hidden, $sortable);
84
+ $per_page = 50;
85
+ $current_page = $this->get_pagenum();
86
+ // Prepare sequence of elements to display
87
+ $display_data = array_slice($this->aDBc_elements_to_display,(($current_page-1) * $per_page), $per_page);
88
+ $this->set_pagination_args( array(
89
+ 'total_items' => count($this->aDBc_elements_to_display),
90
+ 'per_page' => $per_page
91
+ ));
92
+ $this->items = $display_data;
93
+ }
94
+
95
+ /** WP: Get columns that should be hidden */
96
+ function get_hidden_columns(){
97
+ return array('type');
98
+ }
99
+
100
+ /** WP: Column default */
101
+ function column_default($item, $column_name){
102
+ switch($column_name){
103
+ case 'element_to_clean':
104
+ case 'count':
105
+ case 'view':
106
+ case 'type':
107
+ return $item[$column_name];
108
+ default:
109
+ return print_r($item, true) ; //Show the whole array for troubleshooting purposes
110
+ }
111
+ }
112
+
113
+ /** WP: Column cb for check box */
114
+ function column_cb($item) {
115
+ return sprintf('<input type="checkbox" name="aDBc_elements_to_clean[]" value="%s" />', $item['type']);
116
+ }
117
+
118
+ /** WP: Get bulk actions */
119
+ function get_bulk_actions() {
120
+ $actions = array(
121
+ 'clean' => __('Clean','advanced-database-cleaner')
122
+ );
123
+ return $actions;
124
+ }
125
+
126
+ /** WP: Message to display when no items found */
127
+ function no_items() {
128
+ _e('Your database is clean!','advanced-database-cleaner');
129
+ }
130
+
131
+ /** WP: Process bulk actions */
132
+ public function process_bulk_action() {
133
+ // security check!
134
+ if (isset($_POST['_wpnonce']) && !empty($_POST['_wpnonce'])){
135
+ $nonce = filter_input(INPUT_POST, '_wpnonce', FILTER_SANITIZE_STRING);
136
+ $action = 'bulk-' . $this->_args['plural'];
137
+ if (!wp_verify_nonce( $nonce, $action))
138
+ wp_die('Security check failed!');
139
+ }
140
+ $action = $this->current_action();
141
+ if($action == 'clean'){
142
+ // If the user wants to clean the elements he/she selected
143
+ if(isset($_POST['aDBc_elements_to_clean'])){
144
+ global $wpdb;
145
+ foreach($_POST['aDBc_elements_to_clean'] as $element) {
146
+ aDBc_clean_all_elements_type($element);
147
+ }
148
+ // Update the message to show to the user
149
+ $this->aDBc_message = __('Selected elements successfully cleaned!', 'advanced-database-cleaner');
150
+ }
151
+ }
152
+ }
153
+
154
+ /** Print the page content */
155
+ function aDBc_print_page_content(){
156
+ // Print a message if any
157
+ if($this->aDBc_message != ""){
158
+ echo '<div id="aDBc_message" class="' . $this->aDBc_class_message . ' notice is-dismissible"><p>' . $this->aDBc_message . '</p></div>';
159
+ }
160
+ ?>
161
+ <div class="aDBc-content-max-width">
162
+ <div class="aDBc-left-content">
163
+ <form id="aDBc_form" action="" method="post">
164
+ <?php
165
+ // Print the elements to clean
166
+ $this->display();
167
+ ?>
168
+ </form>
169
+ </div>
170
+ <div class="aDBc-right-box">
171
+ <div style="text-align:center">
172
+ <?php if($this->aDBc_total_elements_to_clean == 0){ ?>
173
+ <img src="<?php echo ADBC_PLUGIN_DIR_PATH . '/images/db_clean.png'?>"/>
174
+ <div class="aDBc-text-status-db"><?php _e('Your database is clean!','advanced-database-cleaner'); ?></div>
175
+ <?php } else { ?>
176
+ <img src="<?php echo ADBC_PLUGIN_DIR_PATH . '/images/db_not_clean.png'?>"/>
177
+ <div class="aDBc-text-status-db"><b><?php echo $this->aDBc_total_elements_to_clean; ?></b> <?php _e('element(s) should be cleaned!','advanced-database-cleaner'); ?></div>
178
+ <?php } ?>
179
+ </div>
180
+ <div class="aDBc-schedule-box">
181
+ <div class="aDBc-schedule-text">&nbsp;<?php _e('Schedule','advanced-database-cleaner'); ?></div>
182
+ <form action="" method="post">
183
+ <select class="aDBc-schedule-select" name="aDBc_clean_schedule">
184
+ <?php
185
+ $aDBc_schedule = get_option('aDBc_clean_schedule');
186
+ ?>
187
+ <option value="no_schedule" <?php echo $aDBc_schedule == 'no_schedule' ? 'selected="selected"' : ''; ?>>
188
+ <?php _e('Not scheduled','advanced-database-cleaner');?>
189
+ </option>
190
+ <option value="hourly" <?php echo $aDBc_schedule == 'hourly' ? 'selected="selected"' : ''; ?>>
191
+ <?php _e('Run clean-up hourly','advanced-database-cleaner');?>
192
+ </option>
193
+ <option value="twicedaily" <?php echo $aDBc_schedule == 'twicedaily' ? 'selected="selected"' : ''; ?>>
194
+ <?php _e('Run clean-up twice a day','advanced-database-cleaner');?>
195
+ </option>
196
+ <option value="daily" <?php echo $aDBc_schedule == 'daily' ? 'selected="selected"' : ''; ?>>
197
+ <?php _e('Run clean-up daily','advanced-database-cleaner');?>
198
+ </option>
199
+ <option value="weekly" <?php echo $aDBc_schedule == 'weekly' ? 'selected="selected"' : ''; ?>>
200
+ <?php _e('Run clean-up weekly','advanced-database-cleaner');?>
201
+ </option>
202
+ <option value="monthly" <?php echo $aDBc_schedule == 'monthly' ? 'selected="selected"' : ''; ?>>
203
+ <?php _e('Run clean-up monthly','advanced-database-cleaner');?>
204
+ </option>
205
+ </select>
206
+ <input name="aDBc_save_schedule" type="submit" class="button-primary" value="<?php _e('Save','advanced-database-cleaner'); ?>" />
207
+ </form>
208
+ <div style="padding-top:10px">
209
+ &nbsp;<?php _e('Next run:','advanced-database-cleaner'); ?>
210
+ <span style="color:green">
211
+ <?php
212
+ if(wp_next_scheduled('aDBc_clean_scheduler')){
213
+ echo get_date_from_gmt(date('Y-m-d H:i:s', wp_next_scheduled('aDBc_clean_scheduler')), 'M j, Y - H:i:s');
214
+ }else{
215
+ echo _e('not set','advanced-database-cleaner');
216
+ }
217
+ ?>
218
+ </span>
219
+ </div>
220
+ </div>
221
+ </div>
222
+ <div class="aDBc-clear-both"></div>
223
+ </div>
224
+ <div id="aDBc_dialog1" title="<?php _e('Cleaning...','advanced-database-cleaner'); ?>" class="aDBc-jquery-dialog">
225
+ <p class="aDBc-box-warning">
226
+ <?php _e('You are about to clean some of your unused data. This operation is irreversible. Don\'t forget to make a backup first.','advanced-database-cleaner'); ?>
227
+ </p>
228
+ <p>
229
+ <?php _e('Are you sure to continue?','advanced-database-cleaner'); ?>
230
+ </p>
231
+ </div>
232
+ <div id="aDBc_dialog2" title="<?php _e('Action required','advanced-database-cleaner'); ?>" class="aDBc-jquery-dialog">
233
+ <p class="aDBc-box-info">
234
+ <?php _e('Please select an action!','advanced-database-cleaner'); ?>
235
+ </p>
236
+ </div>
237
+ <?php
238
+ }
239
+ }
240
+
241
+ new ADBC_Clean_DB_List();
242
+ ?>
includes/class_optimize_tables.php ADDED
@@ -0,0 +1,294 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class ADBC_Tables_To_Optimize_List extends WP_List_Table {
4
+
5
+ private $aDBc_message = "";
6
+ private $aDBc_class_message = "updated";
7
+ private $aDBc_tables_to_display = array();
8
+ private $aDBc_total_lost = 0;
9
+ private $aDBc_total_tables_to_optimize = 0;
10
+
11
+ /**
12
+ * Constructor
13
+ */
14
+ function __construct(){
15
+
16
+ parent::__construct(array(
17
+ 'singular' => __('Table', 'advanced-database-cleaner'), //singular name of the listed records
18
+ 'plural' => __('Tables', 'advanced-database-cleaner'), //plural name of the listed records
19
+ 'ajax' => false //does this table support ajax?
20
+ ));
21
+
22
+ if(isset($_POST['aDBc_save_schedule'])){
23
+ wp_clear_scheduled_hook('aDBc_optimize_scheduler');
24
+ if($_POST['aDBc_optimize_schedule'] == 'no_schedule'){
25
+ delete_option('aDBc_optimize_schedule');
26
+ }else{
27
+ update_option('aDBc_optimize_schedule', $_POST['aDBc_optimize_schedule']);
28
+ wp_schedule_event(time()+60, $_POST['aDBc_optimize_schedule'], 'aDBc_optimize_scheduler');
29
+ }
30
+ $this->aDBc_message = __('The optimization schedule saved successfully!', 'advanced-database-cleaner');
31
+ }
32
+
33
+ $this->aDBc_prepare_tables_to_optimize();
34
+ $this->aDBc_print_page_content();
35
+ }
36
+
37
+ /** Prepare tasks to display and count tasks for each category */
38
+ function aDBc_prepare_tables_to_optimize(){
39
+
40
+ global $wpdb;
41
+
42
+ // Process bulk action if any before preparing tables to optimize
43
+ $this->process_bulk_action();
44
+
45
+ $aDBc_prefix_list = array();
46
+ // If is Multisite then we retrieve the list of all prefixes
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){
50
+ $aDBc_prefix_list[$wpdb->get_blog_prefix($blog_id)] = $blog_id;
51
+ }
52
+ }else{
53
+ $aDBc_prefix_list[$wpdb->prefix] = "1";
54
+ }
55
+
56
+ // Get the names of all tables that should be optimized
57
+ $aDBc_tables_to_optimize = $wpdb->get_results("SELECT table_name, data_free FROM information_schema.tables WHERE table_schema = '" . DB_NAME ."' and Engine <> 'InnoDB' and data_free > 0");
58
+
59
+ $aDBc_all_tables_info = array();
60
+ foreach($aDBc_tables_to_optimize as $table){
61
+ $this->aDBc_total_lost += number_format(($table->data_free / 1024), 2);
62
+ $aDBc_all_tables_info[$table->table_name]['lost_space'] = number_format(($table->data_free / 1024), 2, ",", "");
63
+ }
64
+
65
+ $this->aDBc_total_tables_to_optimize = count($aDBc_all_tables_info);
66
+
67
+ foreach($aDBc_all_tables_info as $aDBc_table => $info){
68
+ // Holds the possible prefixes found for the current table
69
+ $aDBc_found_prefixes = array();
70
+ // Test if the table name starts with a valid prefix
71
+ foreach($aDBc_prefix_list as $prefix => $blog_id){
72
+ if(substr($aDBc_table, 0, strlen($prefix)) === $prefix){
73
+ array_push($aDBc_found_prefixes, $prefix);
74
+ }
75
+ }
76
+ // If the table do not start with any valid prefix, we add it as it is
77
+ $count_found_prefixes = count($aDBc_found_prefixes);
78
+ if($count_found_prefixes == 0){
79
+ $aDBc_all_tables_info[$aDBc_table]['table_prefix'] = "";
80
+ $aDBc_all_tables_info[$aDBc_table]['table_name'] = $aDBc_table;
81
+ $aDBc_all_tables_info[$aDBc_table]['site_id'] = "-";
82
+ }else if($count_found_prefixes == 1){
83
+ $aDBc_all_tables_info[$aDBc_table]['table_prefix'] = $aDBc_found_prefixes[0];
84
+ $aDBc_all_tables_info[$aDBc_table]['table_name'] = substr($aDBc_table, strlen($aDBc_found_prefixes[0]));
85
+ $aDBc_all_tables_info[$aDBc_table]['site_id'] = $aDBc_prefix_list[$aDBc_found_prefixes[0]];
86
+ }else{
87
+ // If the number of possible prefixes found >= 2, we delete the longest prefix
88
+ $aDBc_longest_prefix = "";
89
+ foreach($aDBc_found_prefixes as $aDBc_prefix){
90
+ if(strlen($aDBc_prefix) > strlen($aDBc_longest_prefix)){
91
+ $aDBc_longest_prefix = $aDBc_prefix;
92
+ }
93
+ }
94
+ $aDBc_all_tables_info[$aDBc_table]['table_prefix'] = $aDBc_longest_prefix;
95
+ $aDBc_all_tables_info[$aDBc_table]['table_name'] = substr($aDBc_table, strlen($aDBc_longest_prefix));
96
+ $aDBc_all_tables_info[$aDBc_table]['site_id'] = $aDBc_prefix_list[$aDBc_longest_prefix];
97
+ }
98
+ }
99
+
100
+ foreach($aDBc_all_tables_info as $table_name => $table_info){
101
+ array_push($this->aDBc_tables_to_display, array(
102
+ 'o_table_prefix' => $table_info['table_prefix'],
103
+ 'o_table_name' => $table_info['table_name'],
104
+ 'site_id' => $table_info['site_id'],
105
+ 'lost_space' => $table_info['lost_space']
106
+ )
107
+ );
108
+ }
109
+
110
+ // Call WP prepare_items function
111
+ $this->prepare_items();
112
+ }
113
+
114
+ /** WP: Get columns */
115
+ function get_columns(){
116
+ $aDBc_lost_toolip = "<a style='line-height: 18px' class='aDBc-tooltips'>
117
+ <img class='aDBc-margin-l-3' src='". ADBC_PLUGIN_DIR_PATH . '/images/notice.png' . "'/>
118
+ <span>" . __('Indicates the total lost space in the table','advanced-database-cleaner') ." </span>
119
+ </a>";
120
+ $columns = array(
121
+ 'cb' => '<input type="checkbox" />',
122
+ 'o_table_prefix' => __('Prefix','advanced-database-cleaner'),
123
+ 'o_table_name' => __('Table name','advanced-database-cleaner'),
124
+ 'site_id' => __('Site id','advanced-database-cleaner'),
125
+ 'lost_space' => __('Lost','advanced-database-cleaner') . $aDBc_lost_toolip
126
+ );
127
+ return $columns;
128
+ }
129
+
130
+ /** WP: Prepare items to display */
131
+ function prepare_items() {
132
+ $columns = $this->get_columns();
133
+ $hidden = $this->get_hidden_columns();
134
+ $sortable = array();
135
+ $this->_column_headers = array($columns, $hidden, $sortable);
136
+ $per_page = 50;
137
+ $current_page = $this->get_pagenum();
138
+ // Prepare sequence of tables to display
139
+ $display_data = array_slice($this->aDBc_tables_to_display,(($current_page-1) * $per_page), $per_page);
140
+ $this->set_pagination_args( array(
141
+ 'total_items' => count($this->aDBc_tables_to_display),
142
+ 'per_page' => $per_page
143
+ ));
144
+ $this->items = $display_data;
145
+ }
146
+
147
+ /** WP: Get columns that should be hidden */
148
+ function get_hidden_columns(){
149
+ // If MU, nothing to hide, else hide Side ID column
150
+ if(function_exists('is_multisite') && is_multisite()){
151
+ return array();
152
+ }else{
153
+ return array('site_id');
154
+ }
155
+ }
156
+
157
+ /** WP: Column default */
158
+ function column_default($item, $column_name){
159
+ switch($column_name){
160
+ case 'lost_space':
161
+ return $item[$column_name] . ' KB';
162
+ case 'o_table_prefix':
163
+ case 'o_table_name':
164
+ case 'site_id':
165
+ return $item[$column_name];
166
+ default:
167
+ return print_r($item, true) ; //Show the whole array for troubleshooting purposes
168
+ }
169
+ }
170
+
171
+ /** WP: Column cb for check box */
172
+ function column_cb($item) {
173
+ return sprintf('<input type="checkbox" name="aDBc_tables_to_optimize[]" value="%s" />', $item['o_table_prefix'].$item['o_table_name']);
174
+ }
175
+
176
+ /** WP: Get bulk actions */
177
+ function get_bulk_actions() {
178
+ $actions = array(
179
+ 'optimize' => __('Optimize','advanced-database-cleaner')
180
+ );
181
+ return $actions;
182
+ }
183
+
184
+ /** WP: Message to display when no items found */
185
+ function no_items() {
186
+ _e('All tables are optimized!','advanced-database-cleaner');
187
+ }
188
+
189
+ /** WP: Process bulk actions */
190
+ public function process_bulk_action() {
191
+ // security check!
192
+ if (isset($_POST['_wpnonce']) && !empty($_POST['_wpnonce'])){
193
+ $nonce = filter_input(INPUT_POST, '_wpnonce', FILTER_SANITIZE_STRING);
194
+ $action = 'bulk-' . $this->_args['plural'];
195
+ if (!wp_verify_nonce( $nonce, $action))
196
+ wp_die('Security check failed!');
197
+ }
198
+ $action = $this->current_action();
199
+ if($action == 'optimize'){
200
+ // If the user wants to optimize tables he/she selected
201
+ if(isset($_POST['aDBc_tables_to_optimize'])){
202
+ global $wpdb;
203
+ foreach($_POST['aDBc_tables_to_optimize'] as $table) {
204
+ $wpdb->query('OPTIMIZE TABLE '.$table);
205
+ }
206
+ // Update the message to show to the user
207
+ $this->aDBc_message = __('Selected tables successfully optimized!', 'advanced-database-cleaner');
208
+ }
209
+ }
210
+ }
211
+
212
+ /** Print the page content */
213
+ function aDBc_print_page_content(){
214
+ // Print a message if any
215
+ if($this->aDBc_message != ""){
216
+ echo '<div id="aDBc_message" class="' . $this->aDBc_class_message . ' notice is-dismissible"><p>' . $this->aDBc_message . '</p></div>';
217
+ }
218
+ ?>
219
+ <div class="aDBc-content-max-width">
220
+ <div class="aDBc-left-content">
221
+ <form id="aDBc_form" action="" method="post">
222
+ <?php
223
+ // Print the tasks
224
+ $this->display();
225
+ ?>
226
+ </form>
227
+ </div>
228
+ <div class="aDBc-right-box">
229
+ <div style="text-align:center">
230
+ <?php if($this->aDBc_total_tables_to_optimize == 0){ ?>
231
+ <img src="<?php echo ADBC_PLUGIN_DIR_PATH . '/images/db_clean.png'?>"/>
232
+ <div class="aDBc-text-status-db"><?php _e('Your database is optimized!','advanced-database-cleaner'); ?></div>
233
+ <?php } else { ?>
234
+ <img src="<?php echo ADBC_PLUGIN_DIR_PATH . '/images/db_not_clean.png'?>"/>
235
+ <div class="aDBc-text-status-db"><b><?php echo $this->aDBc_total_tables_to_optimize; ?></b> <?php _e('table(s) should be optimized!','advanced-database-cleaner'); ?></div>
236
+ <?php } ?>
237
+ </div>
238
+
239
+ <div class="aDBc-schedule-box">
240
+ <div class="aDBc-schedule-text">&nbsp;<?php _e('Schedule','advanced-database-cleaner'); ?></div>
241
+ <form action="" method="post">
242
+ <select class="aDBc-schedule-select" name="aDBc_optimize_schedule">
243
+ <?php
244
+ $aDBc_schedule = get_option('aDBc_optimize_schedule');
245
+ ?>
246
+ <option value="no_schedule" <?php echo $aDBc_schedule == 'no_schedule' ? 'selected="selected"' : ''; ?>>
247
+ <?php _e('Not scheduled','advanced-database-cleaner');?>
248
+ </option>
249
+ <option value="hourly" <?php echo $aDBc_schedule == 'hourly' ? 'selected="selected"' : ''; ?>>
250
+ <?php _e('Run optimization hourly','advanced-database-cleaner');?>
251
+ </option>
252
+ <option value="twicedaily" <?php echo $aDBc_schedule == 'twicedaily' ? 'selected="selected"' : ''; ?>>
253
+ <?php _e('Run optimization twice a day','advanced-database-cleaner');?>
254
+ </option>
255
+ <option value="daily" <?php echo $aDBc_schedule == 'daily' ? 'selected="selected"' : ''; ?>>
256
+ <?php _e('Run optimization daily','advanced-database-cleaner');?>
257
+ </option>
258
+ <option value="weekly" <?php echo $aDBc_schedule == 'weekly' ? 'selected="selected"' : ''; ?>>
259
+ <?php _e('Run optimization weekly','advanced-database-cleaner');?>
260
+ </option>
261
+ <option value="monthly" <?php echo $aDBc_schedule == 'monthly' ? 'selected="selected"' : ''; ?>>
262
+ <?php _e('Run optimization monthly','advanced-database-cleaner');?>
263
+ </option>
264
+ </select>
265
+ <input name="aDBc_save_schedule" type="submit" class="button-primary" value="<?php _e('Save','advanced-database-cleaner'); ?>" />
266
+ </form>
267
+ <div style="padding-top:10px">
268
+ &nbsp;<?php _e('Next run:','advanced-database-cleaner'); ?>
269
+ <span style="color:green">
270
+ <?php
271
+ if(wp_next_scheduled('aDBc_optimize_scheduler')){
272
+ echo get_date_from_gmt(date('Y-m-d H:i:s', wp_next_scheduled('aDBc_optimize_scheduler')), 'M j, Y - H:i:s');
273
+ }else{
274
+ echo _e('not set','advanced-database-cleaner');
275
+ }
276
+ ?>
277
+ </span>
278
+ </div>
279
+ </div>
280
+ </div>
281
+ <div class="aDBc-clear-both"></div>
282
+ </div>
283
+ <div id="aDBc_dialog2" title="<?php _e('Action required','advanced-database-cleaner'); ?>" class="aDBc-jquery-dialog">
284
+ <p class="aDBc-box-info">
285
+ <?php _e('Please select an action!','advanced-database-cleaner'); ?>
286
+ </p>
287
+ </div>
288
+ <?php
289
+ }
290
+ }
291
+
292
+ new ADBC_Tables_To_Optimize_List();
293
+
294
+ ?>
includes/clean-cron.php DELETED
@@ -1,122 +0,0 @@
1
- <div class="marginTop20">
2
- <div style="float: left; margin-right:25px; margin-bottom:40px">
3
- <form action="" method="post">
4
- <?php if(function_exists('is_multisite') && is_multisite() && is_main_site()){ ?>
5
- <div style="margin-bottom:15px;">
6
- <a class="tooltips" href="#">
7
- <img src="<?php echo ADB_CLEANER_PLUGIN_DIR . '/images/about.png'?>"/>
8
- <span>
9
- <?php _e('The plugin has detected that you use a multisite installation. This is your main site from which you can manage all scheduled tasks in all sites of your network. Other sites can manage their own scheduled tasks only.', 'advanced-db-cleaner'); ?>
10
- </span>
11
- </a>
12
- </div>
13
- <?php } ?>
14
- <table class="widefat" style="width: 800px; border: 1px solid #eee; box-shadow: 0 0px 0px #ccc;">
15
- <thead style="background:#f0f5fa; border-bottom:1px solid dashed">
16
- <tr>
17
- <th scope="col" style="color:#222; font-size:13px; border-bottom: 0px"><?php _e('Hook name', 'advanced-db-cleaner'); ?></th>
18
- <?php if(function_exists('is_multisite') && is_multisite() && is_main_site()){ ?>
19
- <th scope="col" style="color:#222; font-size:13px; border-bottom: 0px"><?php _e('Blog id', 'advanced-db-cleaner'); ?></th>
20
- <?php } ?>
21
- <th scope="col" style="color:#222; font-size:13px; border-bottom: 0px"><?php _e('Frequency', 'advanced-db-cleaner'); ?></th>
22
- <th scope="col" style="font-size:13px; color:#222; border-bottom: 0px;"><?php _e('Next run', 'advanced-db-cleaner'); ?></th>
23
- <th scope="col" style="font-size:13px; color:#222; border-bottom: 0px;"><?php _e('UTC', 'advanced-db-cleaner'); ?></th>
24
- <th scope="col" style="text-align:center; color:#222; width: 40px; font-size:13px; border-bottom: 0px"><?php _e('Select','advanced-db-cleaner'); ?></th>
25
- </tr>
26
- </thead>
27
- <tbody>
28
- <?php
29
- if(function_exists('is_multisite') && is_multisite() && is_main_site()){
30
- $blogs_ids = $wpdb->get_col("SELECT blog_id FROM $wpdb->blogs");
31
- foreach($blogs_ids as $blog_id){
32
- switch_to_blog($blog_id);
33
- // Fetch tasks for all blogs
34
- $cron = _get_cron_array();
35
- $schedules = wp_get_schedules();
36
- $date_format = 'M j, Y @ H:i:s';
37
- foreach ( $cron as $timestamp => $cronhooks ) {
38
- foreach ( (array) $cronhooks as $hook => $events ) {
39
- foreach ( (array) $events as $key => $event ) {
40
- $cron[ $timestamp ][ $hook ][ $key ][ 'date' ] = get_date_from_gmt(date('Y-m-d H:i:s', $timestamp ), $date_format);
41
- }
42
- }
43
- }
44
- foreach ( $cron as $timestamp => $cronhooks ) {
45
- foreach ( (array) $cronhooks as $hook => $events ) {
46
- foreach ( (array) $events as $event ) { ?>
47
- <tr>
48
- <td><?php echo $hook; ?></td>
49
- <td><?php echo $blog_id; ?></td>
50
- <td>
51
- <?php
52
- if ( $event[ 'schedule' ] ) {
53
- echo $schedules [ $event[ 'schedule' ] ][ 'display' ];
54
- } else {
55
- ?><em><?php _e('One-off event', 'advanced-db-cleaner'); ?></em><?php
56
- }
57
- ?>
58
- </td>
59
- <td><?php echo $event[ 'date' ]; ?></td>
60
- <td><?php echo $timestamp; ?></td>
61
- <td class="column-name">
62
- <div class="squaredFour" style="text-align:left; ">
63
- <input id="aDBc_<?php echo $blog_id. '|' . $hook; ?>" type="checkbox" name="adbc_cron_hooks[]" value="<?php echo $blog_id. '|' . $hook; ?>" />
64
- <label for="aDBc_<?php echo $blog_id. '|' . $hook; ?>"></label>
65
- </div>
66
- </td>
67
- </tr>
68
- <?php }
69
- }
70
- }
71
- // Switch back to original blog
72
- restore_current_blog();
73
- }
74
- }else{
75
- // Fetch tasks for single blog
76
- $cron = _get_cron_array();
77
- $schedules = wp_get_schedules();
78
- $date_format = 'M j, Y @ H:i:s';
79
- foreach ( (array) $cron as $timestamp => $cronhooks ) {
80
- foreach ( (array) $cronhooks as $hook => $events ) {
81
- foreach ( (array) $events as $key => $event ) {
82
- $cron[ $timestamp ][ $hook ][ $key ][ 'date' ] = get_date_from_gmt(date('Y-m-d H:i:s', $timestamp ), $date_format);
83
- }
84
- }
85
- }
86
- foreach ( (array) $cron as $timestamp => $cronhooks ) {
87
- foreach ( (array) $cronhooks as $hook => $events ) {
88
- foreach ( (array) $events as $event ) { ?>
89
- <tr>
90
- <td><?php echo $hook; ?></td>
91
- <td>
92
- <?php
93
- if ( $event[ 'schedule' ] ) {
94
- echo $schedules [ $event[ 'schedule' ] ][ 'display' ];
95
- } else {
96
- ?><em><?php _e('One-off event', 'advanced-db-cleaner'); ?></em><?php
97
- }
98
- ?>
99
- </td>
100
- <td><?php echo $event[ 'date' ]; ?></td>
101
- <td><?php echo $timestamp; ?></td>
102
- <td class="column-name">
103
- <div class="squaredFour" style="text-align:left; ">
104
- <input id="aDBc_<?php echo $hook; ?>" type="checkbox" name="adbc_cron_hooks[]" value="<?php echo $hook; ?>" />
105
- <label for="aDBc_<?php echo $hook; ?>"></label>
106
- </div>
107
- </td>
108
- </tr>
109
- <?php }
110
- }
111
- }
112
- }
113
- ?>
114
- </tbody>
115
- </table>
116
- <p>
117
- <input type="hidden" name="aDBc_clean_cron_form" value="" />
118
- <input type="submit" class="button-primary" value="<?php _e('Clean selected schedules','advanced-db-cleaner'); ?>" />
119
- </p>
120
- </form>
121
- </div>
122
- </div>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
includes/clean-db.php DELETED
@@ -1,283 +0,0 @@
1
- <?php
2
- /* Get the totals of unused data */
3
- $aDBc_count_unused = adv_db_cleaner_count();
4
- ?>
5
- <div class="marginTop20">
6
- <div style="float: left; margin-right:25px; margin-bottom:40px">
7
- <?php if(function_exists('is_multisite') && is_multisite() && is_main_site()){ ?>
8
- <div style="margin-bottom:15px;">
9
- <a class="tooltips" href="#">
10
- <img src="<?php echo ADB_CLEANER_PLUGIN_DIR . '/images/about.png'?>"/>
11
- <span>
12
- <?php
13
- _e('The plugin has detected that you use a multisite installation. This is your main site from which you can clean all tables of all sites in your network. Other sites can clean their own tables only.', 'advanced-db-cleaner');
14
- ?>
15
- </span>
16
- </a>
17
- </div>
18
- <?php } ?>
19
- <form action="" method="post">
20
- <table class="widefat" style="width: 400px; border: 1px solid #eee; box-shadow: 0 0px 0px #ccc;">
21
- <thead style="background:#f0f5fa; border-bottom:1px solid dashed">
22
- <tr>
23
- <th scope="col" style="font-size:13px; color:#222; border-bottom: 0px;"><?php _e('Elements to clean','advanced-db-cleaner'); ?></th>
24
- <th scope="col" style="text-align: right; color:#222; width: 80px; font-size:13px; border-bottom: 0px"><?php _e('Count','advanced-db-cleaner'); ?></th>
25
- <th scope="col" style="text-align: right; color:#222; width: 80px; font-size:13px; border-bottom: 0px"><?php _e('Select','advanced-db-cleaner'); ?></th>
26
- </tr>
27
- </thead>
28
- <tbody id="the-list">
29
- <?php
30
- if($aDBc_count_unused["total"] == 0){ ?>
31
- <tr class="">
32
- <td class="column-name" style="color: #999"><?php _e('Nothing to do!','advanced-db-cleaner'); ?></td>
33
- <td class="column-name"></td>
34
- <td class="column-name"></td>
35
- </tr>
36
- <?php
37
- } else {
38
- if($aDBc_count_unused["revision"] > 0){ ?>
39
- <tr class="">
40
- <td class="column-name"><?php _e('Revision','advanced-db-cleaner'); ?></td>
41
- <td class="column-name aDBcCount"><?php echo $aDBc_count_unused["revision"]; ?></td>
42
- <td class="column-name">
43
- <div class="squaredFour">
44
- <input id="aDBc_check1" type="checkbox" name="adbc_post_type[]" value="revision" />
45
- <label for="aDBc_check1"></label>
46
- </div>
47
- </td>
48
- </tr>
49
- <?php
50
- }
51
- if($aDBc_count_unused["draft"] > 0){ ?>
52
- <tr class="">
53
- <td class="column-name"><?php _e('Draft','advanced-db-cleaner'); ?></td>
54
- <td class="column-name aDBcCount"><?php echo $aDBc_count_unused["draft"]; ?></td>
55
- <td class="column-name">
56
- <div class="squaredFour">
57
- <input id="aDBc_check2" type="checkbox" name="adbc_post_type[]" value="draft" />
58
- <label for="aDBc_check2"></label>
59
- </div>
60
- </td>
61
- </tr>
62
- <?php
63
- }
64
- if($aDBc_count_unused["autodraft"] > 0){ ?>
65
- <tr class="">
66
- <td class="column-name"><?php _e('Auto Draft','advanced-db-cleaner'); ?></td>
67
- <td class="column-name aDBcCount"><?php echo $aDBc_count_unused["autodraft"]; ?></td>
68
- <td class="column-name">
69
- <div class="squaredFour">
70
- <input id="aDBc_check3" type="checkbox" name="adbc_post_type[]" value="autodraft" />
71
- <label for="aDBc_check3"></label>
72
- </div>
73
- </td>
74
- </tr>
75
- <?php
76
- }
77
- if($aDBc_count_unused["trashposts"] > 0){ ?>
78
- <tr class="">
79
- <td class="column-name"><?php _e('Trash posts','advanced-db-cleaner'); ?></td>
80
- <td class="column-name aDBcCount"><?php echo $aDBc_count_unused["trashposts"]; ?></td>
81
- <td class="column-name">
82
- <div class="squaredFour">
83
- <input id="aDBc_check_trashposts" type="checkbox" name="adbc_post_type[]" value="trash-posts" />
84
- <label for="aDBc_check_trashposts"></label>
85
- </div>
86
- </td>
87
- </tr>
88
- <?php
89
- }
90
- if($aDBc_count_unused["moderated"] > 0){ ?>
91
- <tr class="">
92
- <td class="column-name"><?php _e('Moderated Comments','advanced-db-cleaner'); ?></td>
93
- <td class="column-name aDBcCount"><?php echo $aDBc_count_unused["moderated"]; ?></td>
94
- <td class="column-name">
95
- <div class="squaredFour">
96
- <input id="aDBc_check4" type="checkbox" name="adbc_post_type[]" value="moderated" />
97
- <label for="aDBc_check4"></label>
98
- </div>
99
- </td>
100
- </tr>
101
- <?php
102
- }
103
- if($aDBc_count_unused["spam"] > 0){ ?>
104
- <tr class="">
105
- <td class="column-name"><?php _e('Spam Comments','advanced-db-cleaner'); ?></td>
106
- <td class="column-name aDBcCount"><?php echo $aDBc_count_unused["spam"]; ?></td>
107
- <td class="column-name">
108
- <div class="squaredFour">
109
- <input id="aDBc_check5" type="checkbox" name="adbc_post_type[]" value="spam" />
110
- <label for="aDBc_check5"></label>
111
- </div>
112
- </td>
113
- </tr>
114
- <?php
115
- }
116
- if($aDBc_count_unused["trash"] > 0){ ?>
117
- <tr class="">
118
- <td class="column-name"><?php _e('Trash Comments','advanced-db-cleaner'); ?></td>
119
- <td class="column-name aDBcCount"><?php echo $aDBc_count_unused["trash"]; ?></td>
120
- <td class="column-name">
121
- <div class="squaredFour">
122
- <input id="aDBc_check6" type="checkbox" name="adbc_post_type[]" value="trash" />
123
- <label for="aDBc_check6"></label>
124
- </div>
125
- </td>
126
- </tr>
127
- <?php
128
- }
129
-
130
- if($aDBc_count_unused["postmeta"] > 0){ ?>
131
- <tr class="">
132
- <td class="column-name"><?php _e('Orphan Postmeta','advanced-db-cleaner'); ?></td>
133
- <td class="column-name aDBcCount"><?php echo $aDBc_count_unused["postmeta"]; ?></td>
134
- <td class="column-name">
135
- <div class="squaredFour">
136
- <input id="aDBc_check7" type="checkbox" name="adbc_post_type[]" value="postmeta" />
137
- <label for="aDBc_check7"></label>
138
- </div>
139
- </td>
140
- </tr>
141
- <?php
142
- }
143
- if($aDBc_count_unused["commentmeta"] > 0){ ?>
144
- <tr class="">
145
- <td class="column-name"><?php _e('Orphan Commentmeta','advanced-db-cleaner'); ?></td>
146
- <td class="column-name aDBcCount"><?php echo $aDBc_count_unused["commentmeta"]; ?></td>
147
- <td class="column-name">
148
- <div class="squaredFour">
149
- <input id="aDBc_check8" type="checkbox" name="adbc_post_type[]" value="commentmeta" />
150
- <label for="aDBc_check8"></label>
151
- </div>
152
- </td>
153
- </tr>
154
- <?php
155
- }
156
- if($aDBc_count_unused["relationships"] > 0){ ?>
157
- <tr class="">
158
- <td class="column-name"><?php _e('Orphan Relationships','advanced-db-cleaner'); ?></td>
159
- <td class="column-name aDBcCount"><?php echo $aDBc_count_unused["relationships"]; ?></td>
160
- <td class="column-name">
161
- <div class="squaredFour">
162
- <input id="aDBc_check9" type="checkbox" name="adbc_post_type[]" value="relationships" />
163
- <label for="aDBc_check9"></label>
164
- </div>
165
- </td>
166
- </tr>
167
- <?php
168
- }
169
- if($aDBc_count_unused["feed"] > 0){ ?>
170
- <tr class="">
171
- <td class="column-name"><?php _e('Dashboard Transient Feed','advanced-db-cleaner'); ?></td>
172
- <td class="column-name aDBcCount"><?php echo $aDBc_count_unused["feed"]; ?></td>
173
- <td class="column-name">
174
- <div class="squaredFour">
175
- <input id="aDBc_check10" type="checkbox" name="adbc_post_type[]" value="feed" />
176
- <label for="aDBc_check10"></label>
177
- </div>
178
- </td>
179
- </tr>
180
- <?php
181
- }
182
- } ?>
183
- </tbody>
184
- <tfoot style="background:#f0f5fa">
185
- <tr>
186
- <th scope="col" style="font-size:13px; font-weight:bold; color:#444; border-top: 0px"><?php _e('Total','advanced-db-cleaner'); ?></th>
187
- <th scope="col" class="aDBcCount" style="border-top: 0px; font-weight:bold; color:#444;"><b><?php echo $aDBc_count_unused["total"]; ?></b></th>
188
- <th scope="col" style="border-top: 0px"></th>
189
- </tr>
190
- </tfoot>
191
- </table>
192
- <p>
193
- <input type="hidden" name="aDBc_clean_form" value="" />
194
- <input type="submit" class="button-primary" value="<?php _e('Clean selected items','advanced-db-cleaner'); ?>" <?php echo $aDBc_count_unused["total"] == 0 ? 'disabled' : ''; ?> />
195
- </p>
196
- </form>
197
- </div>
198
- <div style="float:left; padding-left:25px; border-left: 1px dashed #ccc; ">
199
- <div style="text-align:center; margin-bottom: 30px">
200
- <?php if($aDBc_count_unused["total"] == 0){ ?>
201
- <img src="<?php echo ADB_CLEANER_PLUGIN_DIR . '/images/db_clean.png'?>"/>
202
- <div style="font-color:#ccc; color: #999; font-family: tahoma"><?php _e('Your database is clean!','advanced-db-cleaner'); ?></div>
203
- <?php } else { ?>
204
- <img src="<?php echo ADB_CLEANER_PLUGIN_DIR . '/images/db_not_clean.png'?>"/>
205
- <div style="font-color:#ccc; color: #999; font-family: tahoma"><b><?php echo $aDBc_count_unused["total"]; ?></b> <?php _e('element(s) should be cleaned!','advanced-db-cleaner'); ?></div>
206
- <?php } ?>
207
- </div>
208
-
209
- <div class="aDBCRightBox" style="border-bottom: 1px solid #eee">
210
- <div style="font-weight: bold; padding-bottom:12px; color:#111; font-size:13px">&nbsp;<?php _e('Schedule','advanced-db-cleaner'); ?></div>
211
- <form action="" method="post">
212
- <select style="height:30px; font-size:13px; width: 240px" name="aDBc_clean_schedule" id="aDBc_clean_schedule">
213
- <option value="no_schedule" <?php echo get_option('aDBc_clean_schedule') == 'no_schedule' ? 'selected="selected"' : ''; ?>>
214
- <?php _e('Not scheduled','advanced-db-cleaner');?>
215
- </option>
216
- <option value="hourly" <?php echo get_option('aDBc_clean_schedule') == 'hourly' ? 'selected="selected"' : ''; ?>>
217
- <?php _e('Run clean-up hourly','advanced-db-cleaner');?>
218
- </option>
219
- <option value="twicedaily" <?php echo get_option('aDBc_clean_schedule') == 'twicedaily' ? 'selected="selected"' : ''; ?>>
220
- <?php _e('Run clean-up twice a day','advanced-db-cleaner');?>
221
- </option>
222
- <option value="daily" <?php echo get_option('aDBc_clean_schedule') == 'daily' ? 'selected="selected"' : ''; ?>>
223
- <?php _e('Run clean-up daily','advanced-db-cleaner');?>
224
- </option>
225
- <option value="weekly" <?php echo get_option('aDBc_clean_schedule') == 'weekly' ? 'selected="selected"' : ''; ?>>
226
- <?php _e('Run clean-up weekly','advanced-db-cleaner');?>
227
- </option>
228
- <option value="monthly" <?php echo get_option('aDBc_clean_schedule') == 'monthly' ? 'selected="selected"' : ''; ?>>
229
- <?php _e('Run clean-up monthly','advanced-db-cleaner');?>
230
- </option>
231
- </select>
232
- <input type="hidden" name="aDBc_clean_schedule_form" value="" />
233
- <input style="height:30px" type="submit" class="button-primary" value="<?php _e('Save','advanced-db-cleaner'); ?>" />
234
- </form>
235
- <div style="padding-top:15px; color:#111;">
236
- <?php _e('Next run:','advanced-db-cleaner'); ?>
237
- <span style="color: green">
238
- <?php
239
- if(wp_next_scheduled('aDBc_clean_scheduler')){
240
- $date_format = 'M j, Y @ H:i:s';
241
- echo get_date_from_gmt(date('Y-m-d H:i:s', wp_next_scheduled('aDBc_clean_scheduler')), $date_format);
242
- }else{
243
- echo 'Not set';
244
- }
245
- ?>
246
- </span>
247
- </div>
248
- </div>
249
-
250
- <div class="aDBCRightBox">
251
- <div style="font-weight: bold; padding-bottom:5px; color:#111; font-size:13px">&nbsp;<?php _e('Please note that','advanced-db-cleaner'); ?></div>
252
- <ul style="list-style: disc outside none; padding:0px 10px 0px 10px">
253
- <li><?php _e('Cleaning your database helps you saving space by removing unused data.','advanced-db-cleaner'); ?></li>
254
- <li><?php _e('The following items are already cleaned:','advanced-db-cleaner'); ?></li>
255
- </ul>
256
- <?php
257
- if($aDBc_count_unused["revision"] == 0)
258
- echo "<div class='already-cleaned'>". __('Revision','advanced-db-cleaner') ."</div>";
259
- if($aDBc_count_unused["draft"] == 0)
260
- echo "<div class='already-cleaned'>". __('Draft','advanced-db-cleaner') ."</div>";
261
- if($aDBc_count_unused["autodraft"] == 0)
262
- echo "<div class='already-cleaned'>". __('Auto Draft','advanced-db-cleaner') ."</div>";
263
- if($aDBc_count_unused["trashposts"] == 0)
264
- echo "<div class='already-cleaned'>". __('Trash posts','advanced-db-cleaner') ."</div>";
265
- if($aDBc_count_unused["postmeta"] == 0)
266
- echo "<div class='already-cleaned'>". __('Postmeta','advanced-db-cleaner') ."</div>";
267
- if($aDBc_count_unused["moderated"] == 0)
268
- echo "<div class='already-cleaned'>". __('Moderated Comments','advanced-db-cleaner') ."</div>";
269
- if($aDBc_count_unused["spam"] == 0)
270
- echo "<div class='already-cleaned'>". __('Spam Comments','advanced-db-cleaner') ."</div>";
271
- if($aDBc_count_unused["trash"] == 0)
272
- echo "<div class='already-cleaned'>". __('Trash Comments','advanced-db-cleaner') ."</div>";
273
- if($aDBc_count_unused["commentmeta"] == 0)
274
- echo "<div class='already-cleaned'>". __('Commentmeta','advanced-db-cleaner') ."</div>";
275
- if($aDBc_count_unused["relationships"] == 0)
276
- echo "<div class='already-cleaned'>". __('Relationships','advanced-db-cleaner') ."</div>";
277
- if($aDBc_count_unused["feed"] == 0)
278
- echo "<div class='already-cleaned'>". __('Dashboard Transient Feed','advanced-db-cleaner') ."</div>";
279
- ?>
280
- <div style="clear:both"></div>
281
- </div>
282
- </div>
283
- </div>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
includes/clean_db.php ADDED
@@ -0,0 +1,31 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ // If the user wants to perform custom cleaning
4
+ if(isset($_GET['aDBc_view'])){
5
+ if($_GET['aDBc_view'] == "revision"){
6
+ include_once 'custom-clean-view/class_clean_revision.php';
7
+ }else if($_GET['aDBc_view'] == "draft" ||
8
+ $_GET['aDBc_view'] == "auto-draft" ||
9
+ $_GET['aDBc_view'] == "trash-posts"){
10
+ include_once 'custom-clean-view/class_clean_draft_trash.php';
11
+ new ADBC_Clean_Draft($_GET['aDBc_view']);
12
+ }else if($_GET['aDBc_view'] == "moderated-comments" ||
13
+ $_GET['aDBc_view'] == "spam-comments" ||
14
+ $_GET['aDBc_view'] == "trash-comments"){
15
+ include_once 'custom-clean-view/class_clean_comment.php';
16
+ new ADBC_Clean_Comment($_GET['aDBc_view']);
17
+ }else if($_GET['aDBc_view'] == "orphan-postmeta"){
18
+ include_once 'custom-clean-view/class_clean_postmeta.php';
19
+ }else if($_GET['aDBc_view'] == "orphan-commentmeta"){
20
+ include_once 'custom-clean-view/class_clean_commentmeta.php';
21
+ }else if($_GET['aDBc_view'] == "orphan-relationships"){
22
+ include_once 'custom-clean-view/class_clean_relationships.php';
23
+ }else if($_GET['aDBc_view'] == "dashboard-transient-feed"){
24
+ include_once 'custom-clean-view/class_clean_dashboard_transient_feed.php';
25
+ }
26
+ }else{
27
+ // Else return the general clean-up page
28
+ include_once 'class_general_cleanup.php';
29
+ }
30
+
31
+ ?>
includes/custom-clean-view/class_clean_comment.php ADDED
@@ -0,0 +1,148 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /** Used to view Pending comments, Spam Comments and Trash comments */
3
+ class ADBC_Clean_Comment extends WP_List_Table {
4
+
5
+ private $aDBc_message = "";
6
+ private $aDBc_elements_to_display = array();
7
+ private $aDBc_plural_title = "";
8
+
9
+ /**
10
+ * Constructor
11
+ */
12
+ function __construct($element_type){
13
+
14
+ $this->aDBc_message = __('This feature is available in Pro version only.', 'advanced-database-cleaner');
15
+ $this->aDBc_message .= " <a href='?page=advanced_db_cleaner&aDBc_tab=premium'>" . __('Please upgrade to pro version', 'advanced-database-cleaner') . "</a>";
16
+
17
+ if($element_type == "moderated-comments"){
18
+ $aDBc_singular = __('Pending comment', 'advanced-database-cleaner');
19
+ $this->aDBc_plural_title = __('Pending comments', 'advanced-database-cleaner');
20
+ }else if($element_type == "spam-comments"){
21
+ $aDBc_singular = __('Spam comment', 'advanced-database-cleaner');
22
+ $this->aDBc_plural_title = __('Spam comments', 'advanced-database-cleaner');
23
+ }else if($element_type == "trash-comments"){
24
+ $aDBc_singular = __('Trash comment', 'advanced-database-cleaner');
25
+ $this->aDBc_plural_title = __('Trash comments', 'advanced-database-cleaner');
26
+ }
27
+
28
+ parent::__construct(array(
29
+ 'singular' => $aDBc_singular, //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
+ // Nothing to do!
41
+ // Call WP prepare_items function
42
+ $this->prepare_items();
43
+ }
44
+
45
+ /** WP: Get columns */
46
+ function get_columns(){
47
+ $columns = array(
48
+ 'cb' => '<input type="checkbox" />',
49
+ 'comment_id' => __('ID','advanced-database-cleaner'),
50
+ 'comment_author' => __('Author','advanced-database-cleaner'),
51
+ 'comment_content' => __('Content','advanced-database-cleaner'),
52
+ 'comment_date' => __('Date','advanced-database-cleaner'),
53
+ 'site_id' => __('Site id','advanced-database-cleaner')
54
+ );
55
+ return $columns;
56
+ }
57
+
58
+ /** WP: Column default */
59
+ function column_default($item, $column_name){
60
+ switch($column_name){
61
+ case 'comment_id':
62
+ case 'comment_author':
63
+ case 'comment_content':
64
+ case 'comment_date':
65
+ case 'site_id':
66
+ return $item[$column_name];
67
+ default:
68
+ return print_r($item, true) ; //Show the whole array for troubleshooting purposes
69
+ }
70
+ }
71
+
72
+ /** WP: Get columns that should be hidden */
73
+ function get_hidden_columns(){
74
+ // If MU, nothing to hide, else hide Side ID column
75
+ if(function_exists('is_multisite') && is_multisite()){
76
+ return array();
77
+ }else{
78
+ return array('site_id');
79
+ }
80
+ }
81
+
82
+ /** WP: Prepare items to display */
83
+ function prepare_items() {
84
+ $columns = $this->get_columns();
85
+ $hidden = $this->get_hidden_columns();
86
+ $sortable = array();
87
+ $this->_column_headers = array($columns, $hidden, $sortable);
88
+ $per_page = 50;
89
+ $current_page = $this->get_pagenum();
90
+ // Prepare sequence of elements to display
91
+ $display_data = array_slice($this->aDBc_elements_to_display,(($current_page-1) * $per_page), $per_page);
92
+ $this->set_pagination_args( array(
93
+ 'total_items' => count($this->aDBc_elements_to_display),
94
+ 'per_page' => $per_page
95
+ ));
96
+ $this->items = $display_data;
97
+ }
98
+
99
+ /** WP: Column cb for check box */
100
+ function column_cb($item) {
101
+ return sprintf('<input type="checkbox" name="aDBc_elements_to_clean[]" value="%s" />', $item['site_id']."|".$item['comment_id']);
102
+ }
103
+
104
+ /** WP: Get bulk actions */
105
+ function get_bulk_actions() {
106
+ $actions = array(
107
+ 'clean' => __('Clean','advanced-database-cleaner')
108
+ );
109
+ return $actions;
110
+ }
111
+
112
+ /** WP: Message to display when no items found */
113
+ function no_items() {
114
+ _e('Available in Pro version!', 'advanced-database-cleaner');
115
+ }
116
+
117
+ /** WP: Process bulk actions */
118
+ public function process_bulk_action() {
119
+ // Nothing to do!
120
+ }
121
+
122
+ /** Print the page content */
123
+ function aDBc_print_page_content(){
124
+ // Print message
125
+ echo '<div id="aDBc_message" class="aDBc-upgrade-msg notice is-dismissible"><p>' . $this->aDBc_message . '</p></div>';
126
+ ?>
127
+ <div class="aDBc-content-max-width">
128
+ <div class="aDBc-float-left">
129
+ <a style="text-decoration: none" href="?page=advanced_db_cleaner&aDBc_tab=general">
130
+ <img src="<?php echo ADBC_PLUGIN_DIR_PATH . '/images/go_back.png'?>"/>
131
+ </a>
132
+ </div>
133
+ <div class="aDBc-float-right aDBc-custom-clean-text">
134
+ <?php echo __('Custom cleaning : ','advanced-database-cleaner') . '<b>' . $this->aDBc_plural_title . '</b>'; ?>
135
+ </div>
136
+ <div>
137
+ <form id="aDBc_form" action="" method="post">
138
+ <?php
139
+ // Print the elements to clean
140
+ $this->display();
141
+ ?>
142
+ </form>
143
+ </div>
144
+ </div>
145
+ <?php
146
+ }
147
+ }
148
+ ?>
includes/custom-clean-view/class_clean_commentmeta.php ADDED
@@ -0,0 +1,136 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class ADBC_Clean_Commentmeta extends WP_List_Table {
4
+
5
+ private $aDBc_message = "";
6
+ private $aDBc_commentmeta_to_display = array();
7
+
8
+ /**
9
+ * Constructor
10
+ */
11
+ function __construct(){
12
+
13
+ $this->aDBc_message = __('This feature is available in Pro version only.', 'advanced-database-cleaner');
14
+ $this->aDBc_message .= " <a href='?page=advanced_db_cleaner&aDBc_tab=premium'>" . __('Please upgrade to pro version', 'advanced-database-cleaner') . "</a>";
15
+
16
+ parent::__construct(array(
17
+ 'singular' => __('Comment meta', 'advanced-database-cleaner'), //singular name of the listed records
18
+ 'plural' => __('Comments meta', 'advanced-database-cleaner'), //plural name of the listed records
19
+ 'ajax' => false //does this table support ajax?
20
+ ));
21
+
22
+ $this->aDBc_prepare_commentmeta_to_clean();
23
+ $this->aDBc_print_page_content();
24
+ }
25
+
26
+ /** Prepare elements to display */
27
+ function aDBc_prepare_commentmeta_to_clean(){
28
+ // Nothing to do!
29
+ // Call WP prepare_items function
30
+ $this->prepare_items();
31
+ }
32
+
33
+ /** WP: Get columns */
34
+ function get_columns(){
35
+ $columns = array(
36
+ 'cb' => '<input type="checkbox" />',
37
+ 'commentmeta_id' => __('Meta id','advanced-database-cleaner'),
38
+ 'commentmeta_meta_key' => __('Comment meta key','advanced-database-cleaner'),
39
+ 'commentmeta_meta_value' => __('Meta value','advanced-database-cleaner'),
40
+ 'site_id' => __('Site id','advanced-database-cleaner')
41
+ );
42
+ return $columns;
43
+ }
44
+
45
+ /** WP: Column default */
46
+ function column_default($item, $column_name){
47
+ switch($column_name){
48
+ case 'commentmeta_id':
49
+ case 'commentmeta_meta_key':
50
+ case 'commentmeta_meta_value':
51
+ case 'site_id':
52
+ return $item[$column_name];
53
+ default:
54
+ return print_r($item, true) ; //Show the whole array for troubleshooting purposes
55
+ }
56
+ }
57
+
58
+ /** WP: Get columns that should be hidden */
59
+ function get_hidden_columns(){
60
+ // If MU, nothing to hide, else hide Side ID column
61
+ if(function_exists('is_multisite') && is_multisite()){
62
+ return array();
63
+ }else{
64
+ return array('site_id');
65
+ }
66
+ }
67
+
68
+ /** WP: Prepare items to display */
69
+ function prepare_items() {
70
+ $columns = $this->get_columns();
71
+ $hidden = $this->get_hidden_columns();
72
+ $sortable = array();
73
+ $this->_column_headers = array($columns, $hidden, $sortable);
74
+ $per_page = 50;
75
+ $current_page = $this->get_pagenum();
76
+ // Prepare sequence of elements to display
77
+ $display_data = array_slice($this->aDBc_commentmeta_to_display,(($current_page-1) * $per_page), $per_page);
78
+ $this->set_pagination_args( array(
79
+ 'total_items' => count($this->aDBc_commentmeta_to_display),
80
+ 'per_page' => $per_page
81
+ ));
82
+ $this->items = $display_data;
83
+ }
84
+
85
+ /** WP: Column cb for check box */
86
+ function column_cb($item) {
87
+ return sprintf('<input type="checkbox" name="aDBc_commentmeta_to_clean[]" value="%s" />', $item['site_id']."|".$item['commentmeta_id']);
88
+ }
89
+
90
+ /** WP: Get bulk actions */
91
+ function get_bulk_actions() {
92
+ $actions = array(
93
+ 'clean' => __('Clean','advanced-database-cleaner')
94
+ );
95
+ return $actions;
96
+ }
97
+
98
+ /** WP: Message to display when no items found */
99
+ function no_items() {
100
+ _e('Available in Pro version!', 'advanced-database-cleaner');
101
+ }
102
+
103
+ /** WP: Process bulk actions */
104
+ public function process_bulk_action() {
105
+ // Nothing to do!
106
+ }
107
+
108
+ /** Print the page content */
109
+ function aDBc_print_page_content(){
110
+ // Print message
111
+ echo '<div id="aDBc_message" class="aDBc-upgrade-msg notice is-dismissible"><p>' . $this->aDBc_message . '</p></div>';
112
+ ?>
113
+ <div class="aDBc-content-max-width">
114
+ <div class="aDBc-float-left">
115
+ <a style="text-decoration: none" href="?page=advanced_db_cleaner&aDBc_tab=general">
116
+ <img src="<?php echo ADBC_PLUGIN_DIR_PATH . '/images/go_back.png'?>"/>
117
+ </a>
118
+ </div>
119
+ <div class="aDBc-float-right aDBc-custom-clean-text">
120
+ <?php echo __('Custom cleaning : <b>Orphan commentmeta</b>','advanced-database-cleaner'); ?>
121
+ </div>
122
+ <div>
123
+ <form id="aDBc_form" action="" method="post">
124
+ <?php
125
+ // Print the elements to clean
126
+ $this->display();
127
+ ?>
128
+ </form>
129
+ </div>
130
+ </div>
131
+ <?php
132
+ }
133
+ }
134
+
135
+ new ADBC_Clean_Commentmeta();
136
+ ?>
includes/custom-clean-view/class_clean_dashboard_transient_feed.php ADDED
@@ -0,0 +1,136 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class ADBC_Clean_Dashboard_Transient_Feed extends WP_List_Table {
4
+
5
+ private $aDBc_message = "";
6
+ private $aDBc_elements_to_display = array();
7
+
8
+ /**
9
+ * Constructor
10
+ */
11
+ function __construct(){
12
+
13
+ $this->aDBc_message = __('This feature is available in Pro version only.', 'advanced-database-cleaner');
14
+ $this->aDBc_message .= " <a href='?page=advanced_db_cleaner&aDBc_tab=premium'>" . __('Please upgrade to pro version', 'advanced-database-cleaner') . "</a>";
15
+
16
+ parent::__construct(array(
17
+ 'singular' => __('Dashboard transient feed', 'advanced-database-cleaner'), //singular name of the listed records
18
+ 'plural' => __('Dashboard transients feed', 'advanced-database-cleaner'), //plural name of the listed records
19
+ 'ajax' => false //does this table support ajax?
20
+ ));
21
+
22
+ $this->aDBc_prepare_elements_to_clean();
23
+ $this->aDBc_print_page_content();
24
+ }
25
+
26
+ /** Prepare elements to display */
27
+ function aDBc_prepare_elements_to_clean(){
28
+ // Nothing to do!
29
+ // Call WP prepare_items function
30
+ $this->prepare_items();
31
+ }
32
+
33
+ /** WP: Get columns */
34
+ function get_columns(){
35
+ $columns = array(
36
+ 'cb' => '<input type="checkbox" />',
37
+ 'dash_feed_option_id' => __('Feed id','advanced-database-cleaner'),
38
+ 'dash_feed_option_name' => __('Feed name','advanced-database-cleaner'),
39
+ 'dash_feed_autoload' => __('Autoload','advanced-database-cleaner'),
40
+ 'site_id' => __('Site id','advanced-database-cleaner')
41
+ );
42
+ return $columns;
43
+ }
44
+
45
+ /** WP: Column default */
46
+ function column_default($item, $column_name){
47
+ switch($column_name){
48
+ case 'dash_feed_option_id':
49
+ case 'dash_feed_option_name':
50
+ case 'dash_feed_autoload':
51
+ case 'site_id':
52
+ return $item[$column_name];
53
+ default:
54
+ return print_r($item, true) ; //Show the whole array for troubleshooting purposes
55
+ }
56
+ }
57
+
58
+ /** WP: Get columns that should be hidden */
59
+ function get_hidden_columns(){
60
+ // If MU, nothing to hide, else hide Side ID column
61
+ if(function_exists('is_multisite') && is_multisite()){
62
+ return array();
63
+ }else{
64
+ return array('site_id');
65
+ }
66
+ }
67
+
68
+ /** WP: Prepare items to display */
69
+ function prepare_items() {
70
+ $columns = $this->get_columns();
71
+ $hidden = $this->get_hidden_columns();
72
+ $sortable = array();
73
+ $this->_column_headers = array($columns, $hidden, $sortable);
74
+ $per_page = 50;
75
+ $current_page = $this->get_pagenum();
76
+ // Prepare sequence of elements to display
77
+ $display_data = array_slice($this->aDBc_elements_to_display,(($current_page-1) * $per_page), $per_page);
78
+ $this->set_pagination_args( array(
79
+ 'total_items' => count($this->aDBc_elements_to_display),
80
+ 'per_page' => $per_page
81
+ ));
82
+ $this->items = $display_data;
83
+ }
84
+
85
+ /** WP: Column cb for check box */
86
+ function column_cb($item) {
87
+ return sprintf('<input type="checkbox" name="aDBc_feed_to_clean[]" value="%s" />', $item['site_id']."|".$item['dash_feed_option_id']);
88
+ }
89
+
90
+ /** WP: Get bulk actions */
91
+ function get_bulk_actions() {
92
+ $actions = array(
93
+ 'clean' => __('Clean','advanced-database-cleaner')
94
+ );
95
+ return $actions;
96
+ }
97
+
98
+ /** WP: Message to display when no items found */
99
+ function no_items() {
100
+ _e('Available in Pro version!', 'advanced-database-cleaner');
101
+ }
102
+
103
+ /** WP: Process bulk actions */
104
+ public function process_bulk_action() {
105
+ // Nothing to do!
106
+ }
107
+
108
+ /** Print the page content */
109
+ function aDBc_print_page_content(){
110
+ // Print message
111
+ echo '<div id="aDBc_message" class="aDBc-upgrade-msg notice is-dismissible"><p>' . $this->aDBc_message . '</p></div>';
112
+ ?>
113
+ <div class="aDBc-content-max-width">
114
+ <div class="aDBc-float-left">
115
+ <a style="text-decoration: none" href="?page=advanced_db_cleaner&aDBc_tab=general">
116
+ <img src="<?php echo ADBC_PLUGIN_DIR_PATH . '/images/go_back.png'?>"/>
117
+ </a>
118
+ </div>
119
+ <div class="aDBc-float-right aDBc-custom-clean-text">
120
+ <?php echo __('Custom cleaning : <b>Dashboard transient feed</b>','advanced-database-cleaner'); ?>
121
+ </div>
122
+ <div>
123
+ <form id="aDBc_form" action="" method="post">
124
+ <?php
125
+ // Print the elements to clean
126
+ $this->display();
127
+ ?>
128
+ </form>
129
+ </div>
130
+ </div>
131
+ <?php
132
+ }
133
+ }
134
+
135
+ new ADBC_Clean_Dashboard_Transient_Feed();
136
+ ?>
includes/custom-clean-view/class_clean_draft_trash.php ADDED
@@ -0,0 +1,150 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /** Used to view drafts, auto-drafts and trash posts */
3
+ class ADBC_Clean_Draft extends WP_List_Table {
4
+
5
+ private $aDBc_message = "";
6
+ private $aDBc_elements_to_display = array();
7
+ private $aDBc_plural_title = "";
8
+ private $aDBc_column_post_name_title = "";
9
+
10
+ /**
11
+ * Constructor
12
+ */
13
+ function __construct($element_type){
14
+
15
+ $this->aDBc_message = __('This feature is available in Pro version only.', 'advanced-database-cleaner');
16
+ $this->aDBc_message .= " <a href='?page=advanced_db_cleaner&aDBc_tab=premium'>" . __('Please upgrade to pro version', 'advanced-database-cleaner') . "</a>";
17
+
18
+ if($element_type == "draft"){
19
+ $aDBc_singular = __('Draft', 'advanced-database-cleaner');
20
+ $this->aDBc_plural_title = __('Drafts', 'advanced-database-cleaner');
21
+ $this->aDBc_column_post_name_title = __('Draft title', 'advanced-database-cleaner');
22
+ }else if($element_type == "auto-draft"){
23
+ $aDBc_singular = __('Auto draft', 'advanced-database-cleaner');
24
+ $this->aDBc_plural_title = __('Auto drafts', 'advanced-database-cleaner');
25
+ $this->aDBc_column_post_name_title = __('Auto draft title', 'advanced-database-cleaner');
26
+ }else if($element_type == "trash-posts"){
27
+ $aDBc_singular = __('Trash post', 'advanced-database-cleaner');
28
+ $this->aDBc_plural_title = __('Trash posts', 'advanced-database-cleaner');
29
+ $this->aDBc_column_post_name_title = __('Trash post title', 'advanced-database-cleaner');
30
+ }
31
+
32
+ parent::__construct(array(
33
+ 'singular' => $aDBc_singular, //singular name of the listed records
34
+ 'plural' => $this->aDBc_plural_title, //plural name of the listed records
35
+ 'ajax' => false //does this table support ajax?
36
+ ));
37
+
38
+ $this->aDBc_prepare_elements_to_clean();
39
+ $this->aDBc_print_page_content();
40
+ }
41
+
42
+ /** Prepare elements to display */
43
+ function aDBc_prepare_elements_to_clean(){
44
+ // Nothing to do!
45
+ // Call WP prepare_items function
46
+ $this->prepare_items();
47
+ }
48
+
49
+ /** WP: Get columns */
50
+ function get_columns(){
51
+ $columns = array(
52
+ 'cb' => '<input type="checkbox" />',
53
+ 'draft_id' => __('ID','advanced-database-cleaner'),
54
+ 'draft_title' => $this->aDBc_column_post_name_title,
55
+ 'draft_date' => __('Date','advanced-database-cleaner'),
56
+ 'site_id' => __('Site id','advanced-database-cleaner')
57
+ );
58
+ return $columns;
59
+ }
60
+
61
+ /** WP: Column default */
62
+ function column_default($item, $column_name){
63
+ switch($column_name){
64
+ case 'draft_id':
65
+ case 'draft_title':
66
+ case 'draft_date':
67
+ case 'site_id':
68
+ return $item[$column_name];
69
+ default:
70
+ return print_r($item, true) ; //Show the whole array for troubleshooting purposes
71
+ }
72
+ }
73
+
74
+ /** WP: Get columns that should be hidden */
75
+ function get_hidden_columns(){
76
+ // If MU, nothing to hide, else hide Side ID column
77
+ if(function_exists('is_multisite') && is_multisite()){
78
+ return array();
79
+ }else{
80
+ return array('site_id');
81
+ }
82
+ }
83
+
84
+ /** WP: Prepare items to display */
85
+ function prepare_items() {
86
+ $columns = $this->get_columns();
87
+ $hidden = $this->get_hidden_columns();
88
+ $sortable = array();
89
+ $this->_column_headers = array($columns, $hidden, $sortable);
90
+ $per_page = 50;
91
+ $current_page = $this->get_pagenum();
92
+ // Prepare sequence of elements to display
93
+ $display_data = array_slice($this->aDBc_elements_to_display,(($current_page-1) * $per_page), $per_page);
94
+ $this->set_pagination_args( array(
95
+ 'total_items' => count($this->aDBc_elements_to_display),
96
+ 'per_page' => $per_page
97
+ ));
98
+ $this->items = $display_data;
99
+ }
100
+
101
+ /** WP: Column cb for check box */
102
+ function column_cb($item) {
103
+ return sprintf('<input type="checkbox" name="aDBc_elements_to_clean[]" value="%s" />', $item['site_id']."|".$item['draft_id']);
104
+ }
105
+
106
+ /** WP: Get bulk actions */
107
+ function get_bulk_actions() {
108
+ $actions = array(
109
+ 'clean' => __('Clean','advanced-database-cleaner')
110
+ );
111
+ return $actions;
112
+ }
113
+
114
+ /** WP: Message to display when no items found */
115
+ function no_items() {
116
+ _e('Available in Pro version!', 'advanced-database-cleaner');
117
+ }
118
+
119
+ /** WP: Process bulk actions */
120
+ public function process_bulk_action() {
121
+ // Nothing to do!
122
+ }
123
+
124
+ /** Print the page content */
125
+ function aDBc_print_page_content(){
126
+ // Print message
127
+ echo '<div id="aDBc_message" class="aDBc-upgrade-msg notice is-dismissible"><p>' . $this->aDBc_message . '</p></div>';
128
+ ?>
129
+ <div class="aDBc-content-max-width">
130
+ <div class="aDBc-float-left">
131
+ <a style="text-decoration: none" href="?page=advanced_db_cleaner&aDBc_tab=general">
132
+ <img src="<?php echo ADBC_PLUGIN_DIR_PATH . '/images/go_back.png'?>"/>
133
+ </a>
134
+ </div>
135
+ <div class="aDBc-float-right aDBc-custom-clean-text">
136
+ <?php echo __('Custom cleaning : ','advanced-database-cleaner') . '<b>' . $this->aDBc_plural_title . '</b>'; ?>
137
+ </div>
138
+ <div>
139
+ <form id="aDBc_form" action="" method="post">
140
+ <?php
141
+ // Print the elements to clean
142
+ $this->display();
143
+ ?>
144
+ </form>
145
+ </div>
146
+ </div>
147
+ <?php
148
+ }
149
+ }
150
+ ?>
includes/custom-clean-view/class_clean_postmeta.php ADDED
@@ -0,0 +1,136 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class ADBC_Clean_Postmeta extends WP_List_Table {
4
+
5
+ private $aDBc_message = "";
6
+ private $aDBc_postmeta_to_display = array();
7
+
8
+ /**
9
+ * Constructor
10
+ */
11
+ function __construct(){
12
+
13
+ $this->aDBc_message = __('This feature is available in Pro version only.', 'advanced-database-cleaner');
14
+ $this->aDBc_message .= " <a href='?page=advanced_db_cleaner&aDBc_tab=premium'>" . __('Please upgrade to pro version', 'advanced-database-cleaner') . "</a>";
15
+
16
+ parent::__construct(array(
17
+ 'singular' => __('Post meta', 'advanced-database-cleaner'), //singular name of the listed records
18
+ 'plural' => __('Posts meta', 'advanced-database-cleaner'), //plural name of the listed records
19
+ 'ajax' => false //does this table support ajax?
20
+ ));
21
+
22
+ $this->aDBc_prepare_postmeta_to_clean();
23
+ $this->aDBc_print_page_content();
24
+ }
25
+
26
+ /** Prepare elements to display */
27
+ function aDBc_prepare_postmeta_to_clean(){
28
+ // Nothing to do!
29
+ // Call WP prepare_items function
30
+ $this->prepare_items();
31
+ }
32
+
33
+ /** WP: Get columns */
34
+ function get_columns(){
35
+ $columns = array(
36
+ 'cb' => '<input type="checkbox" />',
37
+ 'postmeta_id' => __('Meta id','advanced-database-cleaner'),
38
+ 'postmeta_meta_key' => __('Post meta key','advanced-database-cleaner'),
39
+ 'postmeta_meta_value' => __('Meta value','advanced-database-cleaner'),
40
+ 'site_id' => __('Site id','advanced-database-cleaner')
41
+ );
42
+ return $columns;
43
+ }
44
+
45
+ /** WP: Column default */
46
+ function column_default($item, $column_name){
47
+ switch($column_name){
48
+ case 'postmeta_id':
49
+ case 'postmeta_meta_key':
50
+ case 'postmeta_meta_value':
51
+ case 'site_id':
52
+ return $item[$column_name];
53
+ default:
54
+ return print_r($item, true) ; //Show the whole array for troubleshooting purposes
55
+ }
56
+ }
57
+
58
+ /** WP: Get columns that should be hidden */
59
+ function get_hidden_columns(){
60
+ // If MU, nothing to hide, else hide Side ID column
61
+ if(function_exists('is_multisite') && is_multisite()){
62
+ return array();
63
+ }else{
64
+ return array('site_id');
65
+ }
66
+ }
67
+
68
+ /** WP: Prepare items to display */
69
+ function prepare_items() {
70
+ $columns = $this->get_columns();
71
+ $hidden = $this->get_hidden_columns();
72
+ $sortable = array();
73
+ $this->_column_headers = array($columns, $hidden, $sortable);
74
+ $per_page = 50;
75
+ $current_page = $this->get_pagenum();
76
+ // Prepare sequence of elements to display
77
+ $display_data = array_slice($this->aDBc_postmeta_to_display,(($current_page-1) * $per_page), $per_page);
78
+ $this->set_pagination_args( array(
79
+ 'total_items' => count($this->aDBc_postmeta_to_display),
80
+ 'per_page' => $per_page
81
+ ));
82
+ $this->items = $display_data;
83
+ }
84
+
85
+ /** WP: Column cb for check box */
86
+ function column_cb($item) {
87
+ return sprintf('<input type="checkbox" name="aDBc_postmeta_to_clean[]" value="%s" />', $item['site_id']."|".$item['postmeta_id']);
88
+ }
89
+
90
+ /** WP: Get bulk actions */
91
+ function get_bulk_actions() {
92
+ $actions = array(
93
+ 'clean' => __('Clean','advanced-database-cleaner')
94
+ );
95
+ return $actions;
96
+ }
97
+
98
+ /** WP: Message to display when no items found */
99
+ function no_items() {
100
+ _e('Available in Pro version!', 'advanced-database-cleaner');
101
+ }
102
+
103
+ /** WP: Process bulk actions */
104
+ public function process_bulk_action() {
105
+ // Nothing to do!
106
+ }
107
+
108
+ /** Print the page content */
109
+ function aDBc_print_page_content(){
110
+ // Print message
111
+ echo '<div id="aDBc_message" class="aDBc-upgrade-msg notice is-dismissible"><p>' . $this->aDBc_message . '</p></div>';
112
+ ?>
113
+ <div class="aDBc-content-max-width">
114
+ <div class="aDBc-float-left">
115
+ <a style="text-decoration: none" href="?page=advanced_db_cleaner&aDBc_tab=general">
116
+ <img src="<?php echo ADBC_PLUGIN_DIR_PATH . '/images/go_back.png'?>"/>
117
+ </a>
118
+ </div>
119
+ <div class="aDBc-float-right aDBc-custom-clean-text">
120
+ <?php echo __('Custom cleaning : <b>Orphan postmeta</b>','advanced-database-cleaner'); ?>
121
+ </div>
122
+ <div>
123
+ <form id="aDBc_form" action="" method="post">
124
+ <?php
125
+ // Print the elements to clean
126
+ $this->display();
127
+ ?>
128
+ </form>
129
+ </div>
130
+ </div>
131
+ <?php
132
+ }
133
+ }
134
+
135
+ new ADBC_Clean_Postmeta();
136
+ ?>
includes/custom-clean-view/class_clean_relationships.php ADDED
@@ -0,0 +1,136 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class ADBC_Clean_Relationship extends WP_List_Table {
4
+
5
+ private $aDBc_message = "";
6
+ private $aDBc_relationships_to_display = array();
7
+
8
+ /**
9
+ * Constructor
10
+ */
11
+ function __construct(){
12
+
13
+ $this->aDBc_message = __('This feature is available in Pro version only.', 'advanced-database-cleaner');
14
+ $this->aDBc_message .= " <a href='?page=advanced_db_cleaner&aDBc_tab=premium'>" . __('Please upgrade to pro version', 'advanced-database-cleaner') . "</a>";
15
+
16
+ parent::__construct(array(
17
+ 'singular' => __('Relationship', 'advanced-database-cleaner'), //singular name of the listed records
18
+ 'plural' => __('Relationships', 'advanced-database-cleaner'), //plural name of the listed records
19
+ 'ajax' => false //does this table support ajax?
20
+ ));
21
+
22
+ $this->aDBc_prepare_relationships_to_clean();
23
+ $this->aDBc_print_page_content();
24
+ }
25
+
26
+ /** Prepare elements to display */
27
+ function aDBc_prepare_relationships_to_clean(){
28
+ // Nothing to do!
29
+ // Call WP prepare_items function
30
+ $this->prepare_items();
31
+ }
32
+
33
+ /** WP: Get columns */
34
+ function get_columns(){
35
+ $columns = array(
36
+ 'cb' => '<input type="checkbox" />',
37
+ 'object_id' => __('Object id','advanced-database-cleaner'),
38
+ 'term_taxonomy_id' => __('Term taxonomy id','advanced-database-cleaner'),
39
+ 'term_order' => __('Term order','advanced-database-cleaner'),
40
+ 'term_site_id' => __('Site id','advanced-database-cleaner')
41
+ );
42
+ return $columns;
43
+ }
44
+
45
+ /** WP: Column default */
46
+ function column_default($item, $column_name){
47
+ switch($column_name){
48
+ case 'object_id':
49
+ case 'term_taxonomy_id':
50
+ case 'term_order':
51
+ case 'term_site_id':
52
+ return $item[$column_name];
53
+ default:
54
+ return print_r($item, true) ; //Show the whole array for troubleshooting purposes
55
+ }
56
+ }
57
+
58
+ /** WP: Get columns that should be hidden */
59
+ function get_hidden_columns(){
60
+ // If MU, nothing to hide, else hide Side ID column
61
+ if(function_exists('is_multisite') && is_multisite()){
62
+ return array();
63
+ }else{
64
+ return array('term_site_id');
65
+ }
66
+ }
67
+
68
+ /** WP: Prepare items to display */
69
+ function prepare_items() {
70
+ $columns = $this->get_columns();
71
+ $hidden = $this->get_hidden_columns();
72
+ $sortable = array();
73
+ $this->_column_headers = array($columns, $hidden, $sortable);
74
+ $per_page = 50;
75
+ $current_page = $this->get_pagenum();
76
+ // Prepare sequence of elements to display
77
+ $display_data = array_slice($this->aDBc_relationships_to_display,(($current_page-1) * $per_page), $per_page);
78
+ $this->set_pagination_args( array(
79
+ 'total_items' => count($this->aDBc_relationships_to_display),
80
+ 'per_page' => $per_page
81
+ ));
82
+ $this->items = $display_data;
83
+ }
84
+
85
+ /** WP: Column cb for check box */
86
+ function column_cb($item) {
87
+ return sprintf('<input type="checkbox" name="aDBc_relationships_to_clean[]" value="%s" />', $item['term_site_id']."|".$item['object_id']);
88
+ }
89
+
90
+ /** WP: Get bulk actions */
91
+ function get_bulk_actions() {
92
+ $actions = array(
93
+ 'clean' => __('Clean','advanced-database-cleaner')
94
+ );
95
+ return $actions;
96
+ }
97
+
98
+ /** WP: Message to display when no items found */
99
+ function no_items() {
100
+ _e('Available in Pro version!', 'advanced-database-cleaner');
101
+ }
102
+
103
+ /** WP: Process bulk actions */
104
+ public function process_bulk_action() {
105
+ // Nothing to do!
106
+ }
107
+
108
+ /** Print the page content */
109
+ function aDBc_print_page_content(){
110
+ // Print message
111
+ echo '<div id="aDBc_message" class="aDBc-upgrade-msg notice is-dismissible"><p>' . $this->aDBc_message . '</p></div>';
112
+ ?>
113
+ <div class="aDBc-content-max-width">
114
+ <div class="aDBc-float-left">
115
+ <a style="text-decoration: none" href="?page=advanced_db_cleaner&aDBc_tab=general">
116
+ <img src="<?php echo ADBC_PLUGIN_DIR_PATH . '/images/go_back.png'?>"/>
117
+ </a>
118
+ </div>
119
+ <div class="aDBc-float-right aDBc-custom-clean-text">
120
+ <?php echo __('Custom cleaning : <b>Orphan relationships</b>','advanced-database-cleaner'); ?>
121
+ </div>
122
+ <div>
123
+ <form id="aDBc_form" action="" method="post">
124
+ <?php
125
+ // Print the elements to clean
126
+ $this->display();
127
+ ?>
128
+ </form>
129
+ </div>
130
+ </div>
131
+ <?php
132
+ }
133
+ }
134
+
135
+ new ADBC_Clean_Relationship();
136
+ ?>
includes/custom-clean-view/class_clean_revision.php ADDED
@@ -0,0 +1,136 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class ADBC_Clean_Revision extends WP_List_Table {
4
+
5
+ private $aDBc_message = "";
6
+ private $aDBc_revisions_to_display = array();
7
+
8
+ /**
9
+ * Constructor
10
+ */
11
+ function __construct(){
12
+
13
+ $this->aDBc_message = __('This feature is available in Pro version only.', 'advanced-database-cleaner');
14
+ $this->aDBc_message .= " <a href='?page=advanced_db_cleaner&aDBc_tab=premium'>" . __('Please upgrade to pro version', 'advanced-database-cleaner') . "</a>";
15
+
16
+ parent::__construct(array(
17
+ 'singular' => __('Revision', 'advanced-database-cleaner'), //singular name of the listed records
18
+ 'plural' => __('Revisions', 'advanced-database-cleaner'), //plural name of the listed records
19
+ 'ajax' => false //does this table support ajax?
20
+ ));
21
+
22
+ $this->aDBc_prepare_revisions_to_clean();
23
+ $this->aDBc_print_page_content();
24
+ }
25
+
26
+ /** Prepare elements to display */
27
+ function aDBc_prepare_revisions_to_clean(){
28
+ // Nothing to do
29
+ // Call WP prepare_items function
30
+ $this->prepare_items();
31
+ }
32
+
33
+ /** WP: Get columns */
34
+ function get_columns(){
35
+ $columns = array(
36
+ 'cb' => '<input type="checkbox" />',
37
+ 'revision_id' => __('ID','advanced-database-cleaner'),
38
+ 'revision_title' => __('Revision title','advanced-database-cleaner'),
39
+ 'revision_date' => __('Date','advanced-database-cleaner'),
40
+ 'site_id' => __('Site id','advanced-database-cleaner')
41
+ );
42
+ return $columns;
43
+ }
44
+
45
+ /** WP: Column default */
46
+ function column_default($item, $column_name){
47
+ switch($column_name){
48
+ case 'revision_id':
49
+ case 'revision_title':
50
+ case 'revision_date':
51
+ case 'site_id':
52
+ return $item[$column_name];
53
+ default:
54
+ return print_r($item, true) ; //Show the whole array for troubleshooting purposes
55
+ }
56
+ }
57
+
58
+ /** WP: Get columns that should be hidden */
59
+ function get_hidden_columns(){
60
+ // If MU, nothing to hide, else hide Side ID column
61
+ if(function_exists('is_multisite') && is_multisite()){
62
+ return array();
63
+ }else{
64
+ return array('site_id');
65
+ }
66
+ }
67
+
68
+ /** WP: Prepare items to display */
69
+ function prepare_items() {
70
+ $columns = $this->get_columns();
71
+ $hidden = $this->get_hidden_columns();
72
+ $sortable = array();
73
+ $this->_column_headers = array($columns, $hidden, $sortable);
74
+ $per_page = 50;
75
+ $current_page = $this->get_pagenum();
76
+ // Prepare sequence of elements to display
77
+ $display_data = array_slice($this->aDBc_revisions_to_display,(($current_page-1) * $per_page), $per_page);
78
+ $this->set_pagination_args( array(
79
+ 'total_items' => count($this->aDBc_revisions_to_display),
80
+ 'per_page' => $per_page
81
+ ));
82
+ $this->items = $display_data;
83
+ }
84
+
85
+ /** WP: Column cb for check box */
86
+ function column_cb($item) {
87
+ return sprintf('<input type="checkbox" name="aDBc_revisions_to_clean[]" value="%s" />', $item['site_id']."|".$item['revision_id']);
88
+ }
89
+
90
+ /** WP: Get bulk actions */
91
+ function get_bulk_actions() {
92
+ $actions = array(
93
+ 'clean' => __('Clean','advanced-database-cleaner')
94
+ );
95
+ return $actions;
96
+ }
97
+
98
+ /** WP: Message to display when no items found */
99
+ function no_items() {
100
+ _e('Available in Pro version!', 'advanced-database-cleaner');
101
+ }
102
+
103
+ /** WP: Process bulk actions */
104
+ public function process_bulk_action() {
105
+ // Nothing to do!
106
+ }
107
+
108
+ /** Print the page content */
109
+ function aDBc_print_page_content(){
110
+ // Print message
111
+ echo '<div id="aDBc_message" class="aDBc-upgrade-msg notice is-dismissible"><p>' . $this->aDBc_message . '</p></div>';
112
+ ?>
113
+ <div class="aDBc-content-max-width">
114
+ <div class="aDBc-float-left">
115
+ <a style="text-decoration: none" href="?page=advanced_db_cleaner&aDBc_tab=general">
116
+ <img src="<?php echo ADBC_PLUGIN_DIR_PATH . '/images/go_back.png'?>"/>
117
+ </a>
118
+ </div>
119
+ <div class="aDBc-float-right aDBc-custom-clean-text">
120
+ <?php echo __('Custom cleaning : <b>Revisions</b>','advanced-database-cleaner'); ?>
121
+ </div>
122
+ <div>
123
+ <form id="aDBc_form" action="" method="post">
124
+ <?php
125
+ // Print the elements to clean
126
+ $this->display();
127
+ ?>
128
+ </form>
129
+ </div>
130
+ </div>
131
+ <?php
132
+ }
133
+ }
134
+
135
+ new ADBC_Clean_Revision();
136
+ ?>
includes/functions.php CHANGED
@@ -1,242 +1,408 @@
1
  <?php
2
- //This function is used to clean a specific unused element type from the database
3
- function adv_db_cleaner($type){
4
  global $wpdb;
5
- // If we are in multi-site installation and in main site then we should process all elements in all tables
6
- if(function_exists('is_multisite') && is_multisite() && is_main_site()){
7
  $blogs_ids = $wpdb->get_col("SELECT blog_id FROM $wpdb->blogs");
8
  foreach($blogs_ids as $blog_id){
9
  switch_to_blog($blog_id);
10
- switch($type){
11
- case "revision":
12
- $wpdb->query("DELETE FROM $wpdb->posts WHERE post_type = 'revision'");
13
- $wpdb->query("DELETE pm FROM $wpdb->postmeta pm LEFT JOIN $wpdb->posts wp ON wp.ID = pm.post_id WHERE wp.ID IS NULL");
14
- $wpdb->query("DELETE FROM $wpdb->term_relationships WHERE term_taxonomy_id=1 AND object_id NOT IN (SELECT id FROM $wpdb->posts)");
15
- break;
16
- case "draft":
17
- $wpdb->query("DELETE FROM $wpdb->posts WHERE post_status = 'draft'");
18
- $wpdb->query("DELETE pm FROM $wpdb->postmeta pm LEFT JOIN $wpdb->posts wp ON wp.ID = pm.post_id WHERE wp.ID IS NULL");
19
- $wpdb->query("DELETE FROM $wpdb->term_relationships WHERE term_taxonomy_id=1 AND object_id NOT IN (SELECT id FROM $wpdb->posts)");
20
- break;
21
- case "autodraft":
22
- $wpdb->query("DELETE FROM $wpdb->posts WHERE post_status = 'auto-draft'");
23
- $wpdb->query("DELETE pm FROM $wpdb->postmeta pm LEFT JOIN $wpdb->posts wp ON wp.ID = pm.post_id WHERE wp.ID IS NULL");
24
- $wpdb->query("DELETE FROM $wpdb->term_relationships WHERE term_taxonomy_id=1 AND object_id NOT IN (SELECT id FROM $wpdb->posts)");
25
- break;
26
- case "trash-posts":
27
- $wpdb->query("DELETE FROM $wpdb->posts WHERE post_status = 'trash'");
28
- $wpdb->query("DELETE pm FROM $wpdb->postmeta pm LEFT JOIN $wpdb->posts wp ON wp.ID = pm.post_id WHERE wp.ID IS NULL");
29
- $wpdb->query("DELETE FROM $wpdb->term_relationships WHERE term_taxonomy_id=1 AND object_id NOT IN (SELECT id FROM $wpdb->posts)");
30
- break;
31
- case "moderated":
32
- $wpdb->query("DELETE FROM $wpdb->comments WHERE comment_approved = '0'");
33
- $wpdb->query("DELETE FROM $wpdb->commentmeta WHERE comment_id NOT IN (SELECT comment_id FROM $wpdb->comments)");
34
- break;
35
- case "spam":
36
- $wpdb->query("DELETE FROM $wpdb->comments WHERE comment_approved = 'spam'");
37
- $wpdb->query("DELETE FROM $wpdb->commentmeta WHERE comment_id NOT IN (SELECT comment_id FROM $wpdb->comments)");
38
- break;
39
- case "trash":
40
- $wpdb->query("DELETE FROM $wpdb->comments WHERE comment_approved = 'trash'");
41
- $wpdb->query("DELETE FROM $wpdb->commentmeta WHERE comment_id NOT IN (SELECT comment_id FROM $wpdb->comments)");
42
- break;
43
- case "postmeta":
44
- $wpdb->query("DELETE pm FROM $wpdb->postmeta pm LEFT JOIN $wpdb->posts wp ON wp.ID = pm.post_id WHERE wp.ID IS NULL");
45
- break;
46
- case "commentmeta":
47
- $wpdb->query("DELETE FROM $wpdb->commentmeta WHERE comment_id NOT IN (SELECT comment_id FROM $wpdb->comments)");
48
- break;
49
- case "relationships":
50
- $wpdb->query("DELETE FROM $wpdb->term_relationships WHERE term_taxonomy_id=1 AND object_id NOT IN (SELECT id FROM $wpdb->posts)");
51
- break;
52
- case "feed":
53
- $wpdb->query("DELETE FROM $wpdb->options WHERE option_name LIKE '_site_transient_browser_%' OR option_name LIKE '_site_transient_timeout_browser_%' OR option_name LIKE '_transient_feed_%' OR option_name LIKE '_transient_timeout_feed_%'");
54
- break;
55
- }
56
  restore_current_blog();
57
  }
58
  }else{
59
- // If we are in single site installation or in multi-site but not in main site, then we should process only current tables
60
- switch($type){
61
- case "revision":
62
- $wpdb->query("DELETE FROM $wpdb->posts WHERE post_type = 'revision'");
63
- $wpdb->query("DELETE pm FROM $wpdb->postmeta pm LEFT JOIN $wpdb->posts wp ON wp.ID = pm.post_id WHERE wp.ID IS NULL");
64
- $wpdb->query("DELETE FROM $wpdb->term_relationships WHERE term_taxonomy_id=1 AND object_id NOT IN (SELECT id FROM $wpdb->posts)");
65
- break;
66
- case "draft":
67
- $wpdb->query("DELETE FROM $wpdb->posts WHERE post_status = 'draft'");
68
- $wpdb->query("DELETE pm FROM $wpdb->postmeta pm LEFT JOIN $wpdb->posts wp ON wp.ID = pm.post_id WHERE wp.ID IS NULL");
69
- $wpdb->query("DELETE FROM $wpdb->term_relationships WHERE term_taxonomy_id=1 AND object_id NOT IN (SELECT id FROM $wpdb->posts)");
70
- break;
71
- case "autodraft":
72
- $wpdb->query("DELETE FROM $wpdb->posts WHERE post_status = 'auto-draft'");
73
- $wpdb->query("DELETE pm FROM $wpdb->postmeta pm LEFT JOIN $wpdb->posts wp ON wp.ID = pm.post_id WHERE wp.ID IS NULL");
74
- $wpdb->query("DELETE FROM $wpdb->term_relationships WHERE term_taxonomy_id=1 AND object_id NOT IN (SELECT id FROM $wpdb->posts)");
75
- break;
76
- case "trash-posts":
77
- $wpdb->query("DELETE FROM $wpdb->posts WHERE post_status = 'trash'");
78
- $wpdb->query("DELETE pm FROM $wpdb->postmeta pm LEFT JOIN $wpdb->posts wp ON wp.ID = pm.post_id WHERE wp.ID IS NULL");
79
- $wpdb->query("DELETE FROM $wpdb->term_relationships WHERE term_taxonomy_id=1 AND object_id NOT IN (SELECT id FROM $wpdb->posts)");
80
- break;
81
- case "moderated":
82
- $wpdb->query("DELETE FROM $wpdb->comments WHERE comment_approved = '0'");
83
- $wpdb->query("DELETE FROM $wpdb->commentmeta WHERE comment_id NOT IN (SELECT comment_id FROM $wpdb->comments)");
84
- break;
85
- case "spam":
86
- $wpdb->query("DELETE FROM $wpdb->comments WHERE comment_approved = 'spam'");
87
- $wpdb->query("DELETE FROM $wpdb->commentmeta WHERE comment_id NOT IN (SELECT comment_id FROM $wpdb->comments)");
88
- break;
89
- case "trash":
90
- $wpdb->query("DELETE FROM $wpdb->comments WHERE comment_approved = 'trash'");
91
- $wpdb->query("DELETE FROM $wpdb->commentmeta WHERE comment_id NOT IN (SELECT comment_id FROM $wpdb->comments)");
92
- break;
93
- case "postmeta":
94
- $wpdb->query("DELETE pm FROM $wpdb->postmeta pm LEFT JOIN $wpdb->posts wp ON wp.ID = pm.post_id WHERE wp.ID IS NULL");
95
- break;
96
- case "commentmeta":
97
- $wpdb->query("DELETE FROM $wpdb->commentmeta WHERE comment_id NOT IN (SELECT comment_id FROM $wpdb->comments)");
98
- break;
99
- case "relationships":
100
- $wpdb->query("DELETE FROM $wpdb->term_relationships WHERE term_taxonomy_id=1 AND object_id NOT IN (SELECT id FROM $wpdb->posts)");
101
- break;
102
- case "feed":
103
- $wpdb->query("DELETE FROM $wpdb->options WHERE option_name LIKE '_site_transient_browser_%' OR option_name LIKE '_site_transient_timeout_browser_%' OR option_name LIKE '_transient_feed_%' OR option_name LIKE '_transient_timeout_feed_%'");
104
- break;
105
- }
106
  }
107
  }
108
 
109
- // This function is used by the scheduler to clean all elements
110
- function aDBc_cleanAll(){
111
  global $wpdb;
112
- // If we are in multi-site installation and in main site then we should process all elements in all tables
113
- if(function_exists('is_multisite') && is_multisite() && is_main_site()){
114
- $blogs_ids = $wpdb->get_col("SELECT blog_id FROM $wpdb->blogs");
115
- foreach($blogs_ids as $blog_id){
116
- switch_to_blog($blog_id);
117
  $wpdb->query("DELETE FROM $wpdb->posts WHERE post_type = 'revision'");
 
 
118
  $wpdb->query("DELETE FROM $wpdb->posts WHERE post_status = 'draft'");
 
 
119
  $wpdb->query("DELETE FROM $wpdb->posts WHERE post_status = 'auto-draft'");
 
 
120
  $wpdb->query("DELETE FROM $wpdb->posts WHERE post_status = 'trash'");
 
 
121
  $wpdb->query("DELETE FROM $wpdb->comments WHERE comment_approved = '0'");
 
 
122
  $wpdb->query("DELETE FROM $wpdb->comments WHERE comment_approved = 'spam'");
 
 
123
  $wpdb->query("DELETE FROM $wpdb->comments WHERE comment_approved = 'trash'");
 
 
124
  $wpdb->query("DELETE pm FROM $wpdb->postmeta pm LEFT JOIN $wpdb->posts wp ON wp.ID = pm.post_id WHERE wp.ID IS NULL");
 
 
125
  $wpdb->query("DELETE FROM $wpdb->commentmeta WHERE comment_id NOT IN (SELECT comment_id FROM $wpdb->comments)");
 
 
126
  $wpdb->query("DELETE FROM $wpdb->term_relationships WHERE term_taxonomy_id=1 AND object_id NOT IN (SELECT id FROM $wpdb->posts)");
 
 
127
  $wpdb->query("DELETE FROM $wpdb->options WHERE option_name LIKE '_site_transient_browser_%' OR option_name LIKE '_site_transient_timeout_browser_%' OR option_name LIKE '_transient_feed_%' OR option_name LIKE '_transient_timeout_feed_%'");
 
 
 
 
 
 
 
 
 
 
 
 
128
  restore_current_blog();
129
  }
130
  }else{
131
- // If we are in single site installation or in multi-site but not in main site, then we should process only current tables
132
- $wpdb->query("DELETE FROM $wpdb->posts WHERE post_type = 'revision'");
133
- $wpdb->query("DELETE FROM $wpdb->posts WHERE post_status = 'draft'");
134
- $wpdb->query("DELETE FROM $wpdb->posts WHERE post_status = 'auto-draft'");
135
- $wpdb->query("DELETE FROM $wpdb->posts WHERE post_status = 'trash'");
136
- $wpdb->query("DELETE FROM $wpdb->comments WHERE comment_approved = '0'");
137
- $wpdb->query("DELETE FROM $wpdb->comments WHERE comment_approved = 'spam'");
138
- $wpdb->query("DELETE FROM $wpdb->comments WHERE comment_approved = 'trash'");
139
- $wpdb->query("DELETE pm FROM $wpdb->postmeta pm LEFT JOIN $wpdb->posts wp ON wp.ID = pm.post_id WHERE wp.ID IS NULL");
140
- $wpdb->query("DELETE FROM $wpdb->commentmeta WHERE comment_id NOT IN (SELECT comment_id FROM $wpdb->comments)");
141
- $wpdb->query("DELETE FROM $wpdb->term_relationships WHERE term_taxonomy_id=1 AND object_id NOT IN (SELECT id FROM $wpdb->posts)");
142
- $wpdb->query("DELETE FROM $wpdb->options WHERE option_name LIKE '_site_transient_browser_%' OR option_name LIKE '_site_transient_timeout_browser_%' OR option_name LIKE '_transient_feed_%' OR option_name LIKE '_transient_timeout_feed_%'");
143
  }
144
  }
145
 
146
- // This function is used to count unused elements
147
- function adv_db_cleaner_count(){
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
148
  global $wpdb;
149
- // If we are in multi-site installation and in main site then we should process all elements in all tables
150
- if(function_exists('is_multisite') && is_multisite() && is_main_site()){
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
151
  $blogs_ids = $wpdb->get_col("SELECT blog_id FROM $wpdb->blogs");
152
  foreach($blogs_ids as $blog_id){
153
  switch_to_blog($blog_id);
154
- $aDBc_count_unused["revision"] += $wpdb->get_var("SELECT COUNT(*) FROM $wpdb->posts WHERE post_type = 'revision'");
155
- $aDBc_count_unused["draft"] += $wpdb->get_var("SELECT COUNT(*) FROM $wpdb->posts WHERE post_status = 'draft'");
156
- $aDBc_count_unused["autodraft"] += $wpdb->get_var("SELECT COUNT(*) FROM $wpdb->posts WHERE post_status = 'auto-draft'");
157
- $aDBc_count_unused["trashposts"] += $wpdb->get_var("SELECT COUNT(*) FROM $wpdb->posts WHERE post_status = 'trash'");
158
- $aDBc_count_unused["moderated"] += $wpdb->get_var("SELECT COUNT(*) FROM $wpdb->comments WHERE comment_approved = '0'");
159
- $aDBc_count_unused["spam"] += $wpdb->get_var("SELECT COUNT(*) FROM $wpdb->comments WHERE comment_approved = 'spam'");
160
- $aDBc_count_unused["trash"] += $wpdb->get_var("SELECT COUNT(*) FROM $wpdb->comments WHERE comment_approved = 'trash'");
161
- $aDBc_count_unused["postmeta"] += $wpdb->get_var("SELECT COUNT(*) FROM $wpdb->postmeta pm LEFT JOIN $wpdb->posts wp ON wp.ID = pm.post_id WHERE wp.ID IS NULL");
162
- $aDBc_count_unused["commentmeta"] += $wpdb->get_var("SELECT COUNT(*) FROM $wpdb->commentmeta WHERE comment_id NOT IN (SELECT comment_id FROM $wpdb->comments)");
163
- $aDBc_count_unused["relationships"] += $wpdb->get_var("SELECT COUNT(*) FROM $wpdb->term_relationships WHERE term_taxonomy_id=1 AND object_id NOT IN (SELECT id FROM $wpdb->posts)");
164
- $aDBc_count_unused["feed"] += $wpdb->get_var("SELECT COUNT(*) FROM $wpdb->options WHERE option_name LIKE '_site_transient_browser_%' OR option_name LIKE '_site_transient_timeout_browser_%' OR option_name LIKE '_transient_feed_%' OR option_name LIKE '_transient_timeout_feed_%'");
165
  restore_current_blog();
166
  }
167
- $aDBc_count_unused["total"] = $aDBc_count_unused["revision"] + $aDBc_count_unused["draft"] + $aDBc_count_unused["autodraft"] + $aDBc_count_unused["trashposts"] + $aDBc_count_unused["moderated"] + $aDBc_count_unused["spam"] + $aDBc_count_unused["trash"] + $aDBc_count_unused["postmeta"] + $aDBc_count_unused["commentmeta"] + $aDBc_count_unused["relationships"] + $aDBc_count_unused["feed"];
168
  }else{
169
- // If we are in single site installation or in multi-site but not in main site, then we should process only current tables
170
- $aDBc_count_unused["revision"] = $wpdb->get_var("SELECT COUNT(*) FROM $wpdb->posts WHERE post_type = 'revision'");
171
- $aDBc_count_unused["draft"] = $wpdb->get_var("SELECT COUNT(*) FROM $wpdb->posts WHERE post_status = 'draft'");
172
- $aDBc_count_unused["autodraft"] = $wpdb->get_var("SELECT COUNT(*) FROM $wpdb->posts WHERE post_status = 'auto-draft'");
173
- $aDBc_count_unused["trashposts"] = $wpdb->get_var("SELECT COUNT(*) FROM $wpdb->posts WHERE post_status = 'trash'");
174
- $aDBc_count_unused["moderated"] = $wpdb->get_var("SELECT COUNT(*) FROM $wpdb->comments WHERE comment_approved = '0'");
175
- $aDBc_count_unused["spam"] = $wpdb->get_var("SELECT COUNT(*) FROM $wpdb->comments WHERE comment_approved = 'spam'");
176
- $aDBc_count_unused["trash"] = $wpdb->get_var("SELECT COUNT(*) FROM $wpdb->comments WHERE comment_approved = 'trash'");
177
- $aDBc_count_unused["postmeta"] = $wpdb->get_var("SELECT COUNT(*) FROM $wpdb->postmeta pm LEFT JOIN $wpdb->posts wp ON wp.ID = pm.post_id WHERE wp.ID IS NULL");
178
- $aDBc_count_unused["commentmeta"] = $wpdb->get_var("SELECT COUNT(*) FROM $wpdb->commentmeta WHERE comment_id NOT IN (SELECT comment_id FROM $wpdb->comments)");
179
- $aDBc_count_unused["relationships"] = $wpdb->get_var("SELECT COUNT(*) FROM $wpdb->term_relationships WHERE term_taxonomy_id=1 AND object_id NOT IN (SELECT id FROM $wpdb->posts)");
180
- $aDBc_count_unused["feed"] = $wpdb->get_var("SELECT COUNT(*) FROM $wpdb->options WHERE option_name LIKE '_site_transient_browser_%' OR option_name LIKE '_site_transient_timeout_browser_%' OR option_name LIKE '_transient_feed_%' OR option_name LIKE '_transient_timeout_feed_%'");
181
- $aDBc_count_unused["total"] = $aDBc_count_unused["revision"] + $aDBc_count_unused["draft"] + $aDBc_count_unused["autodraft"] + $aDBc_count_unused["trashposts"] + $aDBc_count_unused["moderated"] + $aDBc_count_unused["spam"] + $aDBc_count_unused["trash"] + $aDBc_count_unused["postmeta"] + $aDBc_count_unused["commentmeta"] + $aDBc_count_unused["relationships"] + $aDBc_count_unused["feed"];
182
  }
183
- return $aDBc_count_unused;
184
  }
185
 
186
- // This function optimizes tables containing lost space (data_free > 0)
187
- function adv_db_cleaner_optimize(){
188
  global $wpdb;
189
- $prefix = str_replace( '_', '\_', $wpdb->prefix );
190
- $adbc_sql = "SELECT table_name, data_free FROM information_schema.tables WHERE table_schema = '".DB_NAME."' and Engine <> 'InnoDB' and data_free > 0";
191
- if(!is_main_site()){
192
- $adbc_sql = $adbc_sql . " and table_name LIKE '{$prefix}%'";
193
- }
 
 
 
 
 
 
 
 
 
 
 
 
194
  $result = $wpdb->get_results($adbc_sql);
195
  foreach($result as $row){
196
- $adbc_sql = 'OPTIMIZE TABLE '.$row->table_name;
197
- $wpdb->query($adbc_sql);
198
  }
199
  }
200
 
201
- // This function resets the database to its initial state like a fresh installation
202
- function adv_db_cleaner_reset(){
203
- require_once( ABSPATH . '/wp-admin/includes/upgrade.php' );
204
- global $current_user, $wpdb;
205
- $blogname = get_option( 'blogname' );
206
- $admin_email = get_option( 'admin_email' );
207
- $blog_public = get_option( 'blog_public' );
208
- if ( $current_user->user_login != 'admin' ){
209
- $user = get_user_by( 'login', 'admin' );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
210
  }
211
- if ( empty( $user->user_level ) || $user->user_level < 10 ){
212
- $user = $current_user;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
213
  }
214
- $prefix = str_replace( '_', '\_', $wpdb->prefix );
215
- $tables = $wpdb->get_col( "SHOW TABLES LIKE '{$prefix}%'" );
216
- foreach ( $tables as $table ) {
217
- $wpdb->query( "DROP TABLE $table" );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
218
  }
219
- // Install wordpress
220
- $result = wp_install( $blogname, $user->user_login, $user->user_email, $blog_public);
221
- extract( $result, EXTR_SKIP );
222
- // Set user password
223
- $query = $wpdb->prepare( "UPDATE $wpdb->users SET user_pass = %s, user_activation_key = '' WHERE ID = %d", $user->user_pass, $user_id );
224
- $wpdb->query( $query );
225
- // Test for functions
226
- $get_user_meta = function_exists( 'get_user_meta' ) ? 'get_user_meta' : 'get_usermeta';
227
- $update_user_meta = function_exists( 'update_user_meta' ) ? 'update_user_meta' : 'update_usermeta';
228
- // Say to wordpress that we will not use generated password
229
- if ( $get_user_meta( $user_id, 'default_password_nag' ) ){
230
- $update_user_meta( $user_id, 'default_password_nag', false );
 
 
 
 
 
 
231
  }
232
- if ( $get_user_meta( $user_id, $wpdb->prefix . 'default_password_nag' ) ){
233
- $update_user_meta( $user_id, $wpdb->prefix . 'default_password_nag', false );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
234
  }
235
- // Clear all cookies associated with authentication
236
- wp_clear_auth_cookie();
237
- // Set the authentication cookies based User ID
238
- wp_set_auth_cookie( $user_id );
239
- // Redirect user to admin pannel
240
- wp_redirect( admin_url());
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
241
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
242
  ?>
1
  <?php
2
+ /** Cleans all elements in the current site and in MU according to the selected type */
3
+ function aDBc_clean_all_elements_type($type){
4
  global $wpdb;
5
+ if(function_exists('is_multisite') && is_multisite()){
 
6
  $blogs_ids = $wpdb->get_col("SELECT blog_id FROM $wpdb->blogs");
7
  foreach($blogs_ids as $blog_id){
8
  switch_to_blog($blog_id);
9
+ aDBc_clean_elements_type($type);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
10
  restore_current_blog();
11
  }
12
  }else{
13
+ aDBc_clean_elements_type($type);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
14
  }
15
  }
16
 
17
+ /** Cleans all elements in the current site according to the selected type */
18
+ function aDBc_clean_elements_type($type){
19
  global $wpdb;
20
+ switch($type){
21
+ case "revision":
 
 
 
22
  $wpdb->query("DELETE FROM $wpdb->posts WHERE post_type = 'revision'");
23
+ break;
24
+ case "draft":
25
  $wpdb->query("DELETE FROM $wpdb->posts WHERE post_status = 'draft'");
26
+ break;
27
+ case "auto-draft":
28
  $wpdb->query("DELETE FROM $wpdb->posts WHERE post_status = 'auto-draft'");
29
+ break;
30
+ case "trash-posts":
31
  $wpdb->query("DELETE FROM $wpdb->posts WHERE post_status = 'trash'");
32
+ break;
33
+ case "moderated-comments":
34
  $wpdb->query("DELETE FROM $wpdb->comments WHERE comment_approved = '0'");
35
+ break;
36
+ case "spam-comments":
37
  $wpdb->query("DELETE FROM $wpdb->comments WHERE comment_approved = 'spam'");
38
+ break;
39
+ case "trash-comments":
40
  $wpdb->query("DELETE FROM $wpdb->comments WHERE comment_approved = 'trash'");
41
+ break;
42
+ case "orphan-postmeta":
43
  $wpdb->query("DELETE pm FROM $wpdb->postmeta pm LEFT JOIN $wpdb->posts wp ON wp.ID = pm.post_id WHERE wp.ID IS NULL");
44
+ break;
45
+ case "orphan-commentmeta":
46
  $wpdb->query("DELETE FROM $wpdb->commentmeta WHERE comment_id NOT IN (SELECT comment_id FROM $wpdb->comments)");
47
+ break;
48
+ case "orphan-relationships":
49
  $wpdb->query("DELETE FROM $wpdb->term_relationships WHERE term_taxonomy_id=1 AND object_id NOT IN (SELECT id FROM $wpdb->posts)");
50
+ break;
51
+ case "dashboard-transient-feed":
52
  $wpdb->query("DELETE FROM $wpdb->options WHERE option_name LIKE '_site_transient_browser_%' OR option_name LIKE '_site_transient_timeout_browser_%' OR option_name LIKE '_transient_feed_%' OR option_name LIKE '_transient_timeout_feed_%'");
53
+ break;
54
+ }
55
+ }
56
+
57
+ /** Cleans all elements in the current site and in MU (used by the scheduler) */
58
+ function aDBc_clean_all_elements(){
59
+ global $wpdb;
60
+ if(function_exists('is_multisite') && is_multisite()){
61
+ $blogs_ids = $wpdb->get_col("SELECT blog_id FROM $wpdb->blogs");
62
+ foreach($blogs_ids as $blog_id){
63
+ switch_to_blog($blog_id);
64
+ aDBc_clean_elements();
65
  restore_current_blog();
66
  }
67
  }else{
68
+ aDBc_clean_elements();
 
 
 
 
 
 
 
 
 
 
 
69
  }
70
  }
71
 
72
+ /** Cleans all elements in the current site */
73
+ function aDBc_clean_elements(){
74
+ global $wpdb;
75
+ $wpdb->query("DELETE FROM $wpdb->posts WHERE post_type = 'revision'");
76
+ $wpdb->query("DELETE FROM $wpdb->posts WHERE post_status = 'draft'");
77
+ $wpdb->query("DELETE FROM $wpdb->posts WHERE post_status = 'auto-draft'");
78
+ $wpdb->query("DELETE FROM $wpdb->posts WHERE post_status = 'trash'");
79
+ $wpdb->query("DELETE FROM $wpdb->comments WHERE comment_approved = '0'");
80
+ $wpdb->query("DELETE FROM $wpdb->comments WHERE comment_approved = 'spam'");
81
+ $wpdb->query("DELETE FROM $wpdb->comments WHERE comment_approved = 'trash'");
82
+ $wpdb->query("DELETE pm FROM $wpdb->postmeta pm LEFT JOIN $wpdb->posts wp ON wp.ID = pm.post_id WHERE wp.ID IS NULL");
83
+ $wpdb->query("DELETE FROM $wpdb->commentmeta WHERE comment_id NOT IN (SELECT comment_id FROM $wpdb->comments)");
84
+ $wpdb->query("DELETE FROM $wpdb->term_relationships WHERE term_taxonomy_id=1 AND object_id NOT IN (SELECT id FROM $wpdb->posts)");
85
+ $wpdb->query("DELETE FROM $wpdb->options WHERE option_name LIKE '_site_transient_browser_%' OR option_name LIKE '_site_transient_timeout_browser_%' OR option_name LIKE '_transient_feed_%' OR option_name LIKE '_transient_timeout_feed_%'");
86
+ }
87
+
88
+
89
+ /** Counts all elements to clean (in the current site or MU) */
90
+ function aDBc_count_all_elements_to_clean(){
91
  global $wpdb;
92
+ $aDBc_unused["revision"]['name'] = __('Revisions','advanced-database-cleaner');
93
+ $aDBc_unused["draft"]['name'] = __('Drafts','advanced-database-cleaner');
94
+ $aDBc_unused["auto-draft"]['name'] = __('Auto Drafts','advanced-database-cleaner');
95
+ $aDBc_unused["trash-posts"]['name'] = __('Trash posts','advanced-database-cleaner');
96
+ $aDBc_unused["moderated-comments"]['name'] = __('Pending comments','advanced-database-cleaner');
97
+ $aDBc_unused["spam-comments"]['name'] = __('Spam Comments','advanced-database-cleaner');
98
+ $aDBc_unused["trash-comments"]['name'] = __('Trash comments','advanced-database-cleaner');
99
+ $aDBc_unused["orphan-postmeta"]['name'] = __('Orphan Postmeta','advanced-database-cleaner');
100
+ $aDBc_unused["orphan-commentmeta"]['name'] = __('Orphan Commentmeta','advanced-database-cleaner');
101
+ $aDBc_unused["orphan-relationships"]['name'] = __('Orphan Relationships','advanced-database-cleaner');
102
+ $aDBc_unused["dashboard-transient-feed"]['name'] = __('Dashboard Transient Feed','advanced-database-cleaner');
103
+ // Initialize counts to 0
104
+ foreach($aDBc_unused as $aDBc_type => $element_info){
105
+ $aDBc_unused[$aDBc_type]['count'] = 0;
106
+ }
107
+
108
+ if(function_exists('is_multisite') && is_multisite()){
109
  $blogs_ids = $wpdb->get_col("SELECT blog_id FROM $wpdb->blogs");
110
  foreach($blogs_ids as $blog_id){
111
  switch_to_blog($blog_id);
112
+ aDBc_count_elements_to_clean($aDBc_unused);
 
 
 
 
 
 
 
 
 
 
113
  restore_current_blog();
114
  }
 
115
  }else{
116
+ aDBc_count_elements_to_clean($aDBc_unused);
 
 
 
 
 
 
 
 
 
 
 
 
117
  }
118
+ return $aDBc_unused;
119
  }
120
 
121
+ /** Counts elements to clean in the current site */
122
+ function aDBc_count_elements_to_clean(&$aDBc_unused){
123
  global $wpdb;
124
+ $aDBc_unused["revision"]['count'] += $wpdb->get_var("SELECT COUNT(*) FROM $wpdb->posts WHERE post_type = 'revision'");
125
+ $aDBc_unused["draft"]['count'] += $wpdb->get_var("SELECT COUNT(*) FROM $wpdb->posts WHERE post_status = 'draft'");
126
+ $aDBc_unused["auto-draft"]['count'] += $wpdb->get_var("SELECT COUNT(*) FROM $wpdb->posts WHERE post_status = 'auto-draft'");
127
+ $aDBc_unused["trash-posts"]['count'] += $wpdb->get_var("SELECT COUNT(*) FROM $wpdb->posts WHERE post_status = 'trash'");
128
+ $aDBc_unused["moderated-comments"]['count'] += $wpdb->get_var("SELECT COUNT(*) FROM $wpdb->comments WHERE comment_approved = '0'");
129
+ $aDBc_unused["spam-comments"]['count'] += $wpdb->get_var("SELECT COUNT(*) FROM $wpdb->comments WHERE comment_approved = 'spam'");
130
+ $aDBc_unused["trash-comments"]['count'] += $wpdb->get_var("SELECT COUNT(*) FROM $wpdb->comments WHERE comment_approved = 'trash'");
131
+ $aDBc_unused["orphan-postmeta"]['count'] += $wpdb->get_var("SELECT COUNT(*) FROM $wpdb->postmeta pm LEFT JOIN $wpdb->posts wp ON wp.ID = pm.post_id WHERE wp.ID IS NULL");
132
+ $aDBc_unused["orphan-commentmeta"]['count'] += $wpdb->get_var("SELECT COUNT(*) FROM $wpdb->commentmeta WHERE comment_id NOT IN (SELECT comment_id FROM $wpdb->comments)");
133
+ $aDBc_unused["orphan-relationships"]['count'] += $wpdb->get_var("SELECT COUNT(*) FROM $wpdb->term_relationships WHERE term_taxonomy_id=1 AND object_id NOT IN (SELECT id FROM $wpdb->posts)");
134
+ $aDBc_unused["dashboard-transient-feed"]['count'] += $wpdb->get_var("SELECT COUNT(*) FROM $wpdb->options WHERE option_name LIKE '_site_transient_browser_%' OR option_name LIKE '_site_transient_timeout_browser_%' OR option_name LIKE '_transient_feed_%' OR option_name LIKE '_transient_timeout_feed_%'");
135
+ }
136
+
137
+ /** Optimizes all tables having lost space (data_free > 0). Used by the scheduled task */
138
+ function aDBc_optimize_tables(){
139
+ global $wpdb;
140
+ $adbc_sql = "SELECT table_name, data_free FROM information_schema.tables WHERE table_schema = '" . DB_NAME ."' and Engine <> 'InnoDB' and data_free > 0";
141
  $result = $wpdb->get_results($adbc_sql);
142
  foreach($result as $row){
143
+ $wpdb->query('OPTIMIZE TABLE ' . $row->table_name);
 
144
  }
145
  }
146
 
147
+ /***********************************************************************************
148
+ *
149
+ * Common function to: options, tables and scheduled tasks processes
150
+ *
151
+ ***********************************************************************************/
152
+
153
+ /** Prepares items (options, tables or tasks) to display + message*/
154
+ function aDBc_prepare_items_to_display(&$items_to_display, &$aDBc_items_categories_info, $items_type){
155
+
156
+ // Prepare categories info
157
+ switch($items_type){
158
+ case 'tasks' :
159
+ $aDBc_all_items = aDBc_get_all_scheduled_tasks();
160
+ $aDBc_items_categories_info = array(
161
+ 'all' => array('name' => __('All tasks', 'advanced-database-cleaner'), 'color' => '#4E515B', 'count' => 0),
162
+ 'o' => array('name' => __('Orphan tasks','advanced-database-cleaner'), 'color' => '#E97F31', 'count' => "--"),
163
+ 'p' => array('name' => __('Plugins tasks', 'advanced-database-cleaner'), 'color' => '#00BAFF', 'count' => "--"),
164
+ 't' => array('name' => __('Themes tasks', 'advanced-database-cleaner'), 'color' => '#45C966', 'count' => "--"),
165
+ 'w' => array('name' => __('WP tasks', 'advanced-database-cleaner'), 'color' => '#D091BE', 'count' => "--")
166
+ );
167
+ break;
168
+ case 'options' :
169
+ $aDBc_all_items = aDBc_get_all_options();
170
+ $aDBc_items_categories_info = array(
171
+ 'all' => array('name' => __('All options', 'advanced-database-cleaner'), 'color' => '#4E515B', 'count' => 0),
172
+ 'o' => array('name' => __('Orphan options','advanced-database-cleaner'), 'color' => '#E97F31', 'count' => "--"),
173
+ 'p' => array('name' => __('Plugins options', 'advanced-database-cleaner'),'color' => '#00BAFF', 'count' => "--"),
174
+ 't' => array('name' => __('Themes options', 'advanced-database-cleaner'), 'color' => '#45C966', 'count' => "--"),
175
+ 'w' => array('name' => __('WP options', 'advanced-database-cleaner'), 'color' => '#D091BE', 'count' => "--")
176
+ );
177
+ break;
178
+ case 'tables' :
179
+ $aDBc_all_items = aDBc_get_all_tables();
180
+ $aDBc_items_categories_info = array(
181
+ 'all' => array('name' => __('All tables', 'advanced-database-cleaner'), 'color' => '#4E515B', 'count' => 0),
182
+ 'o' => array('name' => __('Orphan tables','advanced-database-cleaner'), 'color' => '#E97F31', 'count' => "--"),
183
+ 'p' => array('name' => __('Plugins tables', 'advanced-database-cleaner'), 'color' => '#00BAFF', 'count' => "--"),
184
+ 't' => array('name' => __('Themes tables', 'advanced-database-cleaner'), 'color' => '#45C966', 'count' => "--"),
185
+ 'w' => array('name' => __('WP tables', 'advanced-database-cleaner'), 'color' => '#D091BE', 'count' => "--")
186
+ );
187
+ break;
188
  }
189
+
190
+ // Prepare items to display
191
+ $belongs_to = '<span style="color:#cecece">' . __('Available in Pro version!', 'advanced-database-cleaner') . '</span>';
192
+ foreach($aDBc_all_items as $item_name => $item_info){
193
+
194
+ $aDBc_items_categories_info['all']['count'] += count($item_info['sites']);
195
+ if($_GET['aDBc_cat'] != "all"){
196
+ continue;
197
+ }
198
+
199
+ foreach($item_info['sites'] as $site_id => $site_item_info){
200
+ switch($items_type){
201
+ case 'tasks' :
202
+ array_push($items_to_display, array(
203
+ 'hook_name' => $item_name,
204
+ 'site_id' => $site_id,
205
+ 'next_run' => $site_item_info['next_run'] . ' - ' . $site_item_info['frequency'],
206
+ 'hook_belongs_to' => $belongs_to
207
+ ));
208
+ break;
209
+ case 'options' :
210
+ array_push($items_to_display, array(
211
+ 'option_name' => $item_name,
212
+ 'option_value' => htmlspecialchars($site_item_info['value'], ENT_QUOTES),
213
+ 'option_autoload' => $site_item_info['autoload'],
214
+ 'site_id' => $site_id,
215
+ 'option_belongs_to' => $belongs_to
216
+ ));
217
+ break;
218
+ case 'tables' :
219
+ array_push($items_to_display, array(
220
+ 'table_name' => $item_name,
221
+ 'table_prefix' => $site_item_info['prefix'],
222
+ 'table_rows' => $site_item_info['rows'],
223
+ 'table_size' => $site_item_info['size'],
224
+ 'site_id' => $site_id,
225
+ 'table_belongs_to' => $belongs_to
226
+ ));
227
+ break;
228
+ }
229
+ }
230
  }
231
+ }
232
+
233
+ /***********************************************************************************
234
+ *
235
+ * Function proper to options processes
236
+ *
237
+ ***********************************************************************************/
238
+
239
+ /** Prepares all options for all sites (if any) in a multidimensional array */
240
+ function aDBc_get_all_options() {
241
+ $aDBc_all_options = array();
242
+ global $wpdb;
243
+ if(function_exists('is_multisite') && is_multisite()){
244
+ $blogs_ids = $wpdb->get_col("SELECT blog_id FROM $wpdb->blogs");
245
+ foreach($blogs_ids as $blog_id){
246
+ switch_to_blog($blog_id);
247
+ aDBc_add_options($aDBc_all_options, $blog_id);
248
+ restore_current_blog();
249
+ }
250
+ }else{
251
+ aDBc_add_options($aDBc_all_options, "1");
252
  }
253
+ return $aDBc_all_options;
254
+ }
255
+
256
+ /** Prepares options for one single site (Used by aDBc_get_all_options() function) */
257
+ function aDBc_add_options(&$aDBc_all_options, $blog_id) {
258
+ global $wpdb;
259
+ // Get the list of all options from the current WP database
260
+ $aDBc_options_in_db = $wpdb->get_results("SELECT option_name, option_value, autoload FROM $wpdb->options WHERE option_name NOT LIKE '%transient%' and option_name NOT LIKE '%session%expire%'");
261
+ foreach($aDBc_options_in_db as $option){
262
+ // If the option has not been added yet, add it and initiate its info
263
+ if(empty($aDBc_all_options[$option->option_name])){
264
+ $aDBc_all_options[$option->option_name] = array('belongs_to' => '', 'sites' => array());
265
+ }
266
+ // Add info of the option according to the current site
267
+ $aDBc_all_options[$option->option_name]['sites'][$blog_id] = array(
268
+ 'value' => strlen($option->option_value) > 30 ? substr($option->option_value, 0, 30) . " ..." : $option->option_value,
269
+ 'autoload' => $option->autoload
270
+ );
271
  }
272
+ }
273
+
274
+ /***********************************************************************************
275
+ *
276
+ * Function proper to tables processes
277
+ *
278
+ ***********************************************************************************/
279
+
280
+ /** Prepares all tables for all sites (if any) in a multidimensional array */
281
+ function aDBc_get_all_tables() {
282
+ global $wpdb;
283
+ // First, prepare an array containing rows and sizes of tables
284
+ $aDBc_tables_rows_sizes = array();
285
+ $aDBc_result = $wpdb->get_results('SHOW TABLE STATUS FROM `'.DB_NAME.'`');
286
+ foreach($aDBc_result as $aDBc_row){
287
+ $aDBc_table_size = ($aDBc_row->Data_length + $aDBc_row->Index_length) / 1024;
288
+ $aDBc_table_size = round($aDBc_table_size, 1) . " KB";
289
+ $aDBc_tables_rows_sizes[$aDBc_row->Name] = array('rows' => $aDBc_row->Rows, 'size' => $aDBc_table_size);
290
  }
291
+
292
+ // Prepare ana array to hold all info about tables
293
+ $aDBc_all_tables = array();
294
+ $aDBc_prefix_list = array();
295
+ // If is Multisite then we retrieve the list of all prefixes
296
+ if(function_exists('is_multisite') && is_multisite()){
297
+ $blogs_ids = $wpdb->get_col("SELECT blog_id FROM $wpdb->blogs");
298
+ foreach($blogs_ids as $blog_id){
299
+ $aDBc_prefix_list[$wpdb->get_blog_prefix($blog_id)] = $blog_id;
300
+ }
301
+ }else{
302
+ $aDBc_prefix_list[$wpdb->prefix] = "1";
303
+ }
304
+ // Get the names of all tables in the database
305
+ $aDBc_all_tables_names = $wpdb->get_results("SELECT table_name FROM information_schema.tables WHERE table_schema = '" . DB_NAME . "'");
306
+
307
+ foreach($aDBc_all_tables_names as $aDBc_table){
308
+ // Holds the possible prefixes found for the current table
309
+ $aDBc_found_prefixes = array();
310
+ // Test if the table name starts with a valid prefix
311
+ foreach($aDBc_prefix_list as $prefix => $site_id){
312
+ if(substr($aDBc_table->table_name, 0, strlen($prefix)) === $prefix){
313
+ $aDBc_found_prefixes[$prefix] = $site_id;
314
+ }
315
+ }
316
+ // If the table do not start with any valid prefix, we add it as it is
317
+ if(count($aDBc_found_prefixes) == 0){
318
+ $aDBc_table_name_without_prefix = $aDBc_table->table_name;
319
+ $aDBc_table_prefix = "";
320
+ $aDBc_table_site = "1";
321
+ }else if(count($aDBc_found_prefixes) == 1){
322
+ // If the number of possible prefixes found is 1, we add the table name with its data
323
+ // Get the first element in $aDBc_found_prefixes
324
+ reset($aDBc_found_prefixes);
325
+ $aDBc_table_prefix = key($aDBc_found_prefixes);
326
+ $aDBc_table_site = current($aDBc_found_prefixes);
327
+ $aDBc_table_name_without_prefix = substr($aDBc_table->table_name, strlen($aDBc_table_prefix));
328
+ }else{
329
+ // If the number of possible prefixes found >= 2, we choose the longest prefix as valid one
330
+ $aDBc_table_prefix = "";
331
+ $aDBc_table_site = "";
332
+ $aDBc_table_name_without_prefix = "";
333
+ foreach($aDBc_found_prefixes as $aDBc_prefix => $aDBc_site){
334
+ if(strlen($aDBc_prefix) >= strlen($aDBc_table_prefix)){
335
+ $aDBc_table_prefix = $aDBc_prefix;
336
+ $aDBc_table_site = $aDBc_site;
337
+ $aDBc_table_name_without_prefix = substr($aDBc_table->table_name, strlen($aDBc_table_prefix));
338
+ }
339
+ }
340
+ }
341
+ // Add table information to the global array
342
+ // If the table has not been added yet, add it and initiate its info
343
+ if(empty($aDBc_all_tables[$aDBc_table_name_without_prefix])){
344
+ $aDBc_all_tables[$aDBc_table_name_without_prefix] = array('belongs_to' => '', 'sites' => array());
345
+ }
346
+ // Add info of the task according to the current site
347
+ $aDBc_all_tables[$aDBc_table_name_without_prefix]['sites'][$aDBc_table_site] = array('prefix' => $aDBc_table_prefix,
348
+ 'rows' => $aDBc_tables_rows_sizes[$aDBc_table->table_name]['rows'],
349
+ 'size' => $aDBc_tables_rows_sizes[$aDBc_table->table_name]['size'],
350
+ );
351
+ }
352
+ return $aDBc_all_tables;
353
+ }
354
+
355
+ /***********************************************************************************
356
+ *
357
+ * Function proper to scheduled tasks processes
358
+ *
359
+ ***********************************************************************************/
360
+
361
+ /** Prepares all scheduled tasks for all sites (if any) in a multidimensional array */
362
+ function aDBc_get_all_scheduled_tasks() {
363
+ $aDBc_all_tasks = array();
364
+ if(function_exists('is_multisite') && is_multisite()){
365
+ global $wpdb;
366
+ $blogs_ids = $wpdb->get_col("SELECT blog_id FROM $wpdb->blogs");
367
+ foreach($blogs_ids as $blog_id){
368
+ switch_to_blog($blog_id);
369
+ aDBc_add_scheduled_tasks($aDBc_all_tasks, $blog_id);
370
+ restore_current_blog();
371
+ }
372
+ }else{
373
+ aDBc_add_scheduled_tasks($aDBc_all_tasks, "1");
374
+ }
375
+ return $aDBc_all_tasks;
376
  }
377
+
378
+ /** Prepares scheduled tasks for one single site (Used by aDBc_get_all_scheduled_tasks() function) */
379
+ function aDBc_add_scheduled_tasks(&$aDBc_all_tasks, $blog_id) {
380
+ $cron = _get_cron_array();
381
+ $schedules = wp_get_schedules();
382
+ foreach((array) $cron as $timestamp => $cronhooks){
383
+ foreach( (array) $cronhooks as $hook => $events){
384
+ foreach( (array) $events as $event){
385
+ // If the frequency exist
386
+ if($event['schedule']){
387
+ if(!empty($schedules[$event['schedule']])){
388
+ $aDBc_frequency = $schedules[$event['schedule']]['display'];
389
+ }else{
390
+ $aDBc_frequency = __('Unknown!', 'advanced-database-cleaner');
391
+ }
392
+ }else{
393
+ $aDBc_frequency = "<em>" . __('One-off event', 'advanced-database-cleaner') ."</em>";
394
+ }
395
+ // If the task has not been added yet, add it and initiate its info
396
+ if(empty($aDBc_all_tasks[$hook])){
397
+ $aDBc_all_tasks[$hook] = array('belongs_to' => '', 'sites' => array());
398
+ }
399
+ // Add info of the task according to the current site
400
+ $aDBc_all_tasks[$hook]['sites'][$blog_id] = array('frequency' => $aDBc_frequency,
401
+ 'next_run' => get_date_from_gmt(date('Y-m-d H:i:s', $timestamp), 'M j, Y @ H:i:s'));
402
+
403
+ }
404
+ }
405
+ }
406
+ }
407
+
408
  ?>
includes/optimize-db.php DELETED
@@ -1,123 +0,0 @@
1
- <div class="marginTop20">
2
- <div style="float: left; margin-right:25px; margin-bottom:40px">
3
- <form action="" method="post">
4
- <?php if(function_exists('is_multisite') && is_multisite() && is_main_site()){ ?>
5
- <div style="margin-bottom:15px;">
6
- <a class="tooltips" href="#">
7
- <img src="<?php echo ADB_CLEANER_PLUGIN_DIR . '/images/about.png'?>"/>
8
- <span>
9
- <?php
10
- _e('The plugin has detected that you use a multisite installation. This is your main site from which you can optimize all tables of all sites in your network. Other sites can optimize their own tables only.','advanced-db-cleaner');
11
- ?>
12
- </span>
13
- </a>
14
- </div>
15
- <?php } ?>
16
- <table class="widefat" style="width: 400px; border: 1px solid #eee; box-shadow: 0 0px 0px #ccc;">
17
- <thead style="background:#f0f5fa; border-bottom:1px solid dashed">
18
- <tr>
19
- <th scope="col" style="font-size:13px; color:#222; border-bottom: 0px;"><?php _e('Tables to optimize','advanced-db-cleaner'); ?></th>
20
- <th scope="col" style="text-align: right; color:#222; width: 80px; font-size:13px; border-bottom: 0px;"><?php _e('Lost space','advanced-db-cleaner'); ?></th>
21
- </tr>
22
- </thead>
23
- <tbody id="the-list">
24
- <?php
25
- global $wpdb;
26
- $total_tables_to_optimize = 0;
27
- $total_lost = 0;
28
- $prefix = str_replace( '_', '\_', $wpdb->prefix );
29
- $adbc_sql = "SELECT table_name, data_free FROM information_schema.tables WHERE table_schema = '".DB_NAME."' and Engine <> 'InnoDB' and data_free > 0";
30
- if(!is_main_site()){
31
- $adbc_sql = $adbc_sql . " and table_name LIKE '{$prefix}%'";
32
- }
33
- $result = $wpdb->get_results($adbc_sql);
34
- foreach($result as $row){
35
- $total_tables_to_optimize += 1;
36
- $total_lost += $row->data_free;
37
- echo "<tr class=''>
38
- <td class='column-name'>". $row->table_name ."</td>
39
- <td class='column-name' style='text-align:right'>". $row->data_free . ' o' ."</td>
40
- </tr>\n";
41
- }
42
- if($total_lost == 0){
43
- echo "<tr class=''>
44
- <td class='column-name' style='color: #999'>". __('All tables are optimized!','advanced-db-cleaner') ."</td>
45
- <td class='column-name'></td></tr>";
46
- }
47
- ?>
48
- </tbody>
49
- <tfoot style="background:#f0f5fa">
50
- <tr>
51
- <th scope="col" style="font-size:13px; font-weight:bold; color:#444; border-top: 0px"><?php _e('Total','advanced-db-cleaner'); ?></th>
52
- <th scope="col" class="aDBcCount" style="border-top: 0px"><b><?php echo $total_lost .'</b> o'; ?></th>
53
- </tr>
54
- </tfoot>
55
- </table>
56
- <p>
57
- <input type="hidden" name="aDBc_optimize_form" value="" />
58
- <input type="submit" class="button-primary" value="<?php _e('Optimize tables','advanced-db-cleaner'); ?>" <?php echo $total_lost == 0 ? 'disabled' : ''; ?> />
59
- </p>
60
- </form>
61
- </div>
62
- <div style="float:left; padding-left:25px; border-left: 1px dashed #ccc; ">
63
- <div style="text-align:center; margin-bottom: 30px">
64
- <?php if($total_lost == 0){ ?>
65
- <img src="<?php echo ADB_CLEANER_PLUGIN_DIR . '/images/db_clean.png'?>"/>
66
- <div style="font-color:#ccc; color: #999; font-family: tahoma"><?php _e('Your database is optimized!','advanced-db-cleaner'); ?></div>
67
- <?php } else { ?>
68
- <img src="<?php echo ADB_CLEANER_PLUGIN_DIR . '/images/db_not_clean.png'?>"/>
69
- <div style="font-color:#ccc; color: #999; font-family: tahoma"><b><?php echo $total_tables_to_optimize; ?></b> <?php _e('table(s) should be optimized!','advanced-db-cleaner'); ?></div>
70
- <?php } ?>
71
- </div>
72
-
73
- <div class="aDBCRightBox" style="border-bottom: 1px solid #eee">
74
- <div style="font-weight: bold; padding-bottom:12px; color:#111; font-size:13px">&nbsp;<?php _e('Schedule','advanced-db-cleaner'); ?></div>
75
- <form action="" method="post">
76
- <select style="height:30px; width: 240px; font-size:13px" name="aDBc_optimize_schedule" id="aDBc_optimize_schedule">
77
- <option value="no_schedule" <?php echo get_option('aDBc_optimize_schedule') == 'no_schedule' ? 'selected="selected"' : ''; ?>>
78
- <?php _e('Not scheduled','advanced-db-cleaner');?>
79
- </option>
80
- <option value="hourly" <?php echo get_option('aDBc_optimize_schedule') == 'hourly' ? 'selected="selected"' : ''; ?>>
81
- <?php _e('Run optimization hourly','advanced-db-cleaner');?>
82
- </option>
83
- <option value="twicedaily" <?php echo get_option('aDBc_optimize_schedule') == 'twicedaily' ? 'selected="selected"' : ''; ?>>
84
- <?php _e('Run optimization twice a day','advanced-db-cleaner');?>
85
- </option>
86
- <option value="daily" <?php echo get_option('aDBc_optimize_schedule') == 'daily' ? 'selected="selected"' : ''; ?>>
87
- <?php _e('Run optimization daily','advanced-db-cleaner');?>
88
- </option>
89
- <option value="weekly" <?php echo get_option('aDBc_optimize_schedule') == 'weekly' ? 'selected="selected"' : ''; ?>>
90
- <?php _e('Run optimization weekly','advanced-db-cleaner');?>
91
- </option>
92
- <option value="monthly" <?php echo get_option('aDBc_optimize_schedule') == 'monthly' ? 'selected="selected"' : ''; ?>>
93
- <?php _e('Run optimization monthly','advanced-db-cleaner');?>
94
- </option>
95
- </select>
96
- <input type="hidden" name="aDBc_optimize_schedule_form" value="" />
97
- <input style="height:30px" type="submit" class="button-primary" value="<?php _e('Save','advanced-db-cleaner'); ?>" />
98
- </form>
99
- <div style="padding-top:15px; color:#111;">
100
- <?php _e('Next run:','advanced-db-cleaner'); ?>
101
- <span style="color: green">
102
- <?php
103
- if(wp_next_scheduled('aDBc_optimize_scheduler')){
104
- $date_format = 'M j, Y @ H:i:s';
105
- echo get_date_from_gmt(date('Y-m-d H:i:s', wp_next_scheduled('aDBc_optimize_scheduler')), $date_format);
106
- }else{
107
- echo 'Not set';
108
- }
109
- ?>
110
- </span>
111
- </div>
112
- </div>
113
-
114
- <div class="aDBCRightBox">
115
- <div style="font-weight: bold; padding-bottom:5px; color:#111; font-size:13px">&nbsp;<?php _e('Please note that','advanced-db-cleaner'); ?></div>
116
- <ul style="list-style: disc outside none; padding:0px 10px 0px 10px">
117
- <li><?php _e('"Optimizing" reduces storage space and improves efficiency when accessing your tables.','advanced-db-cleaner'); ?></li>
118
- <li><?php _e('Except tables listed in the table above, all your other tables are already optimized.','advanced-db-cleaner'); ?></li>
119
- <li><?php _e('It is not necessary to run the optimization frequently, just do it from time to time.','advanced-db-cleaner'); ?></li>
120
- </ul>
121
- </div>
122
- </div>
123
- </div>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
includes/overview_settings.php ADDED
@@ -0,0 +1,139 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
+ $aDBc_total_unused += $element_info['count'];
15
+ }
16
+ // Total tables
17
+ $aDBc_total_tables = $wpdb->get_var("SELECT count(*) FROM information_schema.tables WHERE table_schema = '" . DB_NAME . "'");
18
+ // Total options
19
+ if(function_exists('is_multisite') && is_multisite()){
20
+ $aDBc_options_toolip = "<a style='line-height: 18px' class='aDBc-tooltips'>
21
+ <img class='aDBc-margin-l-3' src='". ADBC_PLUGIN_DIR_PATH . '/images/notice.png' . "'/>
22
+ <span>" . __('Indicates the total number of rows in your option tables of all your network sites, including transients...','advanced-database-cleaner') ." </span>
23
+ </a>";
24
+ }else{
25
+ $aDBc_options_toolip = "<a style='line-height: 18px' class='aDBc-tooltips'>
26
+ <img class='aDBc-margin-l-3' src='". ADBC_PLUGIN_DIR_PATH . '/images/notice.png' . "'/>
27
+ <span>" . __('Indicates the total number of rows in your option table, including transients...','advanced-database-cleaner') ." </span>
28
+ </a>";
29
+ }
30
+ $aDBc_total_options = 0;
31
+ if(function_exists('is_multisite') && is_multisite()){
32
+ $blogs_ids = $wpdb->get_col("SELECT blog_id FROM $wpdb->blogs");
33
+ foreach($blogs_ids as $blog_id){
34
+ switch_to_blog($blog_id);
35
+ $aDBc_total_options += $wpdb->get_var("SELECT count(*) FROM $wpdb->options");
36
+ restore_current_blog();
37
+ }
38
+ }else{
39
+ $aDBc_total_options = $wpdb->get_var("SELECT count(*) FROM $wpdb->options");
40
+ }
41
+ // Total tables to optimize
42
+ $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");
43
+ // Total scheduled tasks
44
+ $aDBc_all_tasks = aDBc_get_all_scheduled_tasks();
45
+ $aDBc_total_tasks = 0;
46
+ foreach($aDBc_all_tasks as $hook => $task_info){
47
+ $aDBc_total_tasks += count($task_info['sites']);
48
+ }
49
+ // Is MU?
50
+ if(function_exists('is_multisite') && is_multisite()){
51
+ $aDBc_is_mu = __('Yes', 'advanced-database-cleaner');
52
+ $aDBc_number_sites = $wpdb->get_var("SELECT count(*) FROM $wpdb->blogs");
53
+ }else{
54
+ $aDBc_is_mu = __('No', 'advanced-database-cleaner');
55
+ $aDBc_number_sites = "1";
56
+ }
57
+
58
+ // Get settings
59
+ global $aDBc_settings;
60
+ if(isset($_POST['save_settings'])){
61
+ echo '<div id="aDBc_message" class="updated notice is-dismissible"><p>' . __('Settings saved successfully!', 'advanced-database-cleaner') . '</p></div>';
62
+ }
63
+ ?>
64
+
65
+ <div class="aDBc-content-max-width">
66
+ <div class="aDBc-overview-box">
67
+ <div class="aDBc-overview-box-head"><?php _e('Overview', 'advanced-database-cleaner'); ?></div>
68
+ <ul class="aDBc-overview-box-line">
69
+ <li>
70
+ <div class="aDBc-overview-text-left"><?php _e('WP Version', 'advanced-database-cleaner'); ?> :</div>
71
+ <div class="aDBc-overview-text-right"><?php echo $wp_version; ?></div>
72
+ </li>
73
+ <li>
74
+ <div class="aDBc-overview-text-left"><?php _e('Database size', 'advanced-database-cleaner'); ?> :</div>
75
+ <div class="aDBc-overview-text-right"><?php echo $aDBc_db_size; ?></div>
76
+ </li>
77
+ <li>
78
+ <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>
79
+ <div class="aDBc-overview-text-right"><?php echo $aDBc_total_unused; ?></div>
80
+ </li>
81
+ <li>
82
+ <div class="aDBc-overview-text-left"><?php _e('Total tables', 'advanced-database-cleaner'); ?> :</div>
83
+ <div class="aDBc-overview-text-right"><?php echo $aDBc_total_tables; ?></div>
84
+ </li>
85
+ <li>
86
+ <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>
87
+ <div class="aDBc-overview-text-right"><?php echo $aDBc_tables_to_optimize; ?></div>
88
+ </li>
89
+ <li>
90
+ <div class="aDBc-overview-text-left"><?php echo __('Total options', 'advanced-database-cleaner') . $aDBc_options_toolip; ?> : </div>
91
+ <div class="aDBc-overview-text-right"><?php echo $aDBc_total_options; ?></div>
92
+ </li>
93
+ <li>
94
+ <div class="aDBc-overview-text-left"><?php _e('Total cron tasks', 'advanced-database-cleaner'); ?> :</div>
95
+ <div class="aDBc-overview-text-right"><?php echo $aDBc_total_tasks; ?></div>
96
+ </li>
97
+ <li>
98
+ <div class="aDBc-overview-text-left"><?php _e('WP multisite Enabled ?', 'advanced-database-cleaner'); ?></div>
99
+ <div class="aDBc-overview-text-right"><?php echo $aDBc_is_mu; ?></div>
100
+ </li>
101
+ <li>
102
+ <div class="aDBc-overview-text-left"><?php _e('Number of sites', 'advanced-database-cleaner'); ?> :</div>
103
+ <div class="aDBc-overview-text-right"><?php echo $aDBc_number_sites; ?></div>
104
+ </li>
105
+ <li>
106
+ <div class="aDBc-overview-text-left"><?php _e('Script Max timeout', 'advanced-database-cleaner'); ?> :</div>
107
+ <div class="aDBc-overview-text-right"><?php echo ini_get('max_execution_time') . " ". __('seconds', 'advanced-database-cleaner'); ?></div>
108
+ </li>
109
+ <li>
110
+ <div class="aDBc-overview-text-left"><?php _e('Local time', 'advanced-database-cleaner'); ?> :</div>
111
+ <div class="aDBc-overview-text-right"><?php echo date_i18n('Y-m-d H:i:s'); ?></div>
112
+ </li>
113
+ </ul>
114
+ </div>
115
+
116
+ <div class="aDBc-overview-box">
117
+ <div class="aDBc-overview-box-head"><?php _e('Settings', 'advanced-database-cleaner'); ?></div>
118
+ <form action="" method="post">
119
+ <ul class="aDBc-overview-box-line">
120
+ <li>
121
+ <input type="checkbox" name="aDBc_left_menu" <?php echo $aDBc_settings['left_menu'] == '1' ? "checked='checked'" : ""?>/>
122
+ <?php _e('Show plugin left menu', 'advanced-database-cleaner'); ?>
123
+ <div class="aDBc-overview-setting-desc">
124
+ <?php _e('Displays a menu at the left bar of your WP admin', 'advanced-database-cleaner'); ?>
125
+ </div>
126
+ </li>
127
+ <li>
128
+ <input type="checkbox" name="aDBc_top_main_msg" <?php echo $aDBc_settings['top_main_msg'] == '1' ? "checked='checked'" : ""?>/>
129
+ <?php _e('Show welcome message', 'advanced-database-cleaner'); ?>
130
+ <div class="aDBc-overview-setting-desc">
131
+ <?php _e('Reminds you to make a backup of your database', 'advanced-database-cleaner'); ?>
132
+ </div>
133
+ </li>
134
+ </ul>
135
+ <input name="save_settings" type="submit" class="button-primary aDBc-save-settings-button" value="<?php _e('Save settings','advanced-database-cleaner'); ?>" />
136
+ </form>
137
+ </div>
138
+ <div class="aDBc-clear-both"></div>
139
+ </div>
includes/premium_page.php ADDED
@@ -0,0 +1,51 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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('View items before cleaning', 'advanced-database-cleaner'); ?></li>
11
+ <li class="aDBc-check-list"><?php _e('Detect orphan options', 'advanced-database-cleaner'); ?></li>
12
+ <li class="aDBc-check-list"><?php _e('Detect orphan tables', 'advanced-database-cleaner'); ?></li>
13
+ <li class="aDBc-check-list"><?php _e('Detect orphan 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 lifetime 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 one time, get lifetime updates!', '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>
50
+
51
+ </div>
includes/reset-db.php DELETED
@@ -1,39 +0,0 @@
1
- <?php
2
- global $current_user;
3
- $aDBc_admin = get_user_by( 'login', 'admin' );
4
- $aDBc_admin_exists = 1;
5
- if (!isset($aDBc_admin->user_login ) || $aDBc_admin->user_level < 10 ){
6
- $aDBc_admin_exists = 0;
7
- }
8
- ?>
9
-
10
- <div class="box-warning">
11
- <span style="color: #EA823A; font-weight:bold"><?php _e('WARNING:','advanced-db-cleaner'); ?></span>
12
- <?php _e('The reset makes a fresh installation of your database. Therefore, ANY data in your database will be lost. This option is used primarily by developers who are testing their websites and who do not want to install wordpress after each test. Please do not use this option if you want to keep your posts and pages.','advanced-db-cleaner'); ?>
13
-
14
- </div>
15
-
16
- <div class="box-info">
17
- <ul style="list-style: disc outside none;">
18
- <li><?php _e('The reset does not delete or modify any of your plugins files or server files.','advanced-db-cleaner'); ?></li>
19
- <li><?php _e('All your plugins will be deactivated (including this one). You should activate them manually after the reset.','advanced-db-cleaner'); ?></li>
20
- <?php if ($aDBc_admin_exists) { ?>
21
- <li><?php _e('The "<strong>admin</strong>" user exists and will be recreated with its <strong>current password</strong>.','advanced-db-cleaner'); ?></li>
22
- <?php } else {?>
23
- <li><?php _e('The "admin" user does not exist.','advanced-db-cleaner'); ?> <?php _e('The user','advanced-db-cleaner'); ?> '<strong><?php echo esc_html( $current_user->user_login ); ?></strong>' <?php _e('will be recreated with its current password with user level 10.','advanced-db-cleaner'); ?></li>
24
- <?php } ?>
25
- <li><?php _e('After the reset, you will be redirected to the admin login page.','advanced-db-cleaner'); ?></li>
26
- </ul>
27
- </div>
28
-
29
- <h3 style="color:#32373c; padding-top: 10px"><?php _e('Reset database','advanced-db-cleaner'); ?></h3>
30
-
31
- <p><?php _e('Type "<strong>reset</strong>" in the confirmation field below to confirm the reset and then click the reset button.','advanced-db-cleaner'); ?></p>
32
-
33
- <form id="wordpress_reset_form" action="" method="post">
34
- <input type="hidden" name="aDBc_reset_form" value="" />
35
- <input type="text" name="aDBc_reset_comfirmation" value="" />
36
- <p class="submit">
37
- <input type="submit" class="button-primary" value="Reset database" style="width: 130px; height: 50px; text-align:center; font-weight:bold"/>
38
- </p>
39
- </form>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
includes/sidebar.php CHANGED
@@ -1,36 +1,42 @@
1
  <div>
2
- <center><h2 style="color:#999; font-size:18px; line-height:26px; font-weight:normal">Advanced Database<br/> Cleaner <?php echo ADB_CLEANER_PLUGIN_VERSION; ?></h2></center>
3
- <p style="text-align: justify"><?php _e('If you love this plugin and would like to make a donation, then you\'re awesome.', 'advanced-db-cleaner'); ?></p>
4
- <p style="text-align:right"><?php _e('Thank you!', 'advanced-db-cleaner'); ?></p>
5
- <center>
6
- <a href="http://www.sigmaplugin.com/donation" target="_blank">
7
- <img src="https://www.paypalobjects.com/en_US/i/btn/btn_donate_LG.gif"/>
8
- </a>
9
- </center>
10
  </div>
11
 
12
- <div style="height: 20px; background-color:#f9f9f9;">
13
- <a style="text-decoration: none" href="https://wordpress.org/support/view/plugin-reviews/advanced-database-cleaner#postform">
14
- <div class="aDBC-supportUs" style="width:250px; height:20px">
15
- <span style="font-size: 13px; color:#777"><?php _e('Please rate us', 'advanced-db-cleaner'); ?></span>
16
- </div>
17
- </a>
 
 
 
 
 
18
  </div>
19
 
20
- <div style="height: 20px; clear:both;">
21
- <div style="float:left">
22
- <span style="font-size: 13px; color:#777"><?php _e('Having issues?', 'advanced-db-cleaner'); ?></span>
23
  </div>
24
- <div style="float:right">
25
- <a style="text-decoration: none" href="https://wordpress.org/support/plugin/advanced-database-cleaner"><?php _e('Create a ticket', 'advanced-db-cleaner'); ?></a>
 
 
26
  </div>
27
  </div>
28
 
29
- <div style=" background-color:#f9f9f9; height: 20px; clear:both;">
30
- <div style="float:left">
31
- <span style="font-size: 13px; color:#777"><?php _e('Developed by:', 'advanced-db-cleaner'); ?></span>
32
  </div>
33
- <div style="float:right">
34
- <a style="text-decoration: none" href="http://www.wpdatabasecleaner.com" target="_blank">{ Younes JFR. }</a>
 
 
35
  </div>
36
  </div>
1
  <div>
2
+ <h2>Advanced Database Cleaner <?php echo ADBC_PLUGIN_VERSION; ?></h2>
3
+ <p class="aDBc-donation-text"><?php _e('By making a donation, you help me supporting this plugin!', 'advanced-database-cleaner'); ?></p>
4
+ <br/><a href="https://www.sigmaplugin.com/donation" target="_blank">
5
+ <p class="aDBc-donation-gif"></p>
6
+ </a>
 
 
 
7
  </div>
8
 
9
+ <br/>
10
+
11
+ <div class="aDBc-grey-row">
12
+ <div class="aDBc-float-left">
13
+ <span class="aDBc-row-text"><?php _e('Please rate us', 'advanced-database-cleaner'); ?></span>
14
+ </div>
15
+ <div class="aDBc-float-right">
16
+ <a href="https://wordpress.org/support/view/plugin-reviews/advanced-database-cleaner#postform" target="_blank">
17
+ <p class="aDBc-support-us"></p>
18
+ </a>
19
+ </div>
20
  </div>
21
 
22
+ <div class="aDBc-white-row">
23
+ <div class="aDBc-float-left">
24
+ <span class="aDBc-row-text"><?php _e('Having issues?', 'advanced-database-cleaner'); ?></span>
25
  </div>
26
+ <div class="aDBc-float-right">
27
+ <a class="aDBc-sidebar-link" href="https://wordpress.org/support/plugin/advanced-database-cleaner" target="_blank">
28
+ <?php echo __('Create a ticket', 'advanced-database-cleaner'); ?>
29
+ </a>
30
  </div>
31
  </div>
32
 
33
+ <div class="aDBc-grey-row">
34
+ <div class="aDBc-float-left">
35
+ <span class="aDBc-row-text"><?php _e('Developed by:', 'advanced-database-cleaner'); ?></span>
36
  </div>
37
+ <div class="aDBc-float-right">
38
+ <a class="aDBc-sidebar-link" href="https://www.sigmaplugin.com" target="_blank">
39
+ - SigmaPlugin -
40
+ </a>
41
  </div>
42
  </div>
js/admin.js ADDED
@@ -0,0 +1,65 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ jQuery(document).ready(function(){
2
+
3
+ // hide the loading gif and message loading for options ...
4
+ jQuery('#aDBc_new_search_button').click(function(){
5
+ jQuery("#aDBc_new_search_button").hide();
6
+ jQuery('#aDBc-please-wait').css("display", "block");
7
+ });
8
+
9
+ });
10
+
11
+ jQuery(function($) {
12
+
13
+ var $delete_warning = $("#aDBc_dialog1");
14
+ $delete_warning.dialog({
15
+ 'dialogClass' : 'wp-dialog',
16
+ 'modal' : true,
17
+ 'width' : 500,
18
+ 'autoOpen' : false,
19
+ 'closeOnEscape' : true,
20
+ 'buttons' : {
21
+ "Close": function() {
22
+ $(this).dialog('close');
23
+ },
24
+ "Continue": function() {
25
+ $('form[id="aDBc_form"]').submit();
26
+ }
27
+ }
28
+ });
29
+ var $select_action = $("#aDBc_dialog2");
30
+ $select_action.dialog({
31
+ 'dialogClass' : 'wp-dialog',
32
+ 'modal' : true,
33
+ 'width' : 300,
34
+ 'autoOpen' : false,
35
+ 'closeOnEscape' : true,
36
+ 'buttons' : {
37
+ "Close": function() {
38
+ $(this).dialog('close');
39
+ }
40
+ }
41
+ });
42
+
43
+ $("#doaction").click(function(event) {
44
+ var $bulk_action = $('#bulk-action-selector-top').attr('value');
45
+ if($bulk_action == 'delete' || $bulk_action == 'clean'){
46
+ event.preventDefault();
47
+ $delete_warning.dialog('open');
48
+ }else if($bulk_action == '-1'){
49
+ event.preventDefault();
50
+ $select_action.dialog('open');
51
+ }
52
+ });
53
+
54
+ $("#doaction2").click(function(event) {
55
+ var $bulk_action = $('#bulk-action-selector-bottom').attr('value');
56
+ if($bulk_action == 'delete' || $bulk_action == 'clean'){
57
+ event.preventDefault();
58
+ $delete_warning.dialog('open');
59
+ }else if($bulk_action == '-1'){
60
+ event.preventDefault();
61
+ $select_action.dialog('open');
62
+ }
63
+ });
64
+
65
+ });
languages/advanced-db-cleaner.pot ADDED
@@ -0,0 +1,881 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ msgid ""
2
+ msgstr ""
3
+ "Project-Id-Version: Advanced Database Cleaner 2.0.0\n"
4
+ "POT-Creation-Date: 2016-03-16 00:31+0000\n"
5
+ "PO-Revision-Date: 2016-03-16 00:32+0000\n"
6
+ "Last-Translator: \n"
7
+ "Language-Team: \n"
8
+ "Language: en\n"
9
+ "MIME-Version: 1.0\n"
10
+ "Content-Type: text/plain; charset=UTF-8\n"
11
+ "Content-Transfer-Encoding: 8bit\n"
12
+ "X-Generator: Poedit 1.8.7\n"
13
+ "X-Poedit-Basepath: ..\n"
14
+ "Plural-Forms: nplurals=2; plural=(n != 1);\n"
15
+ "X-Poedit-KeywordsList: __;_e\n"
16
+ "X-Poedit-SearchPath-0: .\n"
17
+
18
+ #: advanced-db-cleaner.php:111
19
+ msgid "Once weekly"
20
+ msgstr ""
21
+
22
+ #: advanced-db-cleaner.php:116
23
+ msgid "Once monthly"
24
+ msgstr ""
25
+
26
+ #: advanced-db-cleaner.php:225
27
+ msgid "Welcome!"
28
+ msgstr ""
29
+
30
+ #: advanced-db-cleaner.php:227
31
+ msgid ""
32
+ "Before doing any clean-up, please make sure to always backup your database "
33
+ "first."
34
+ msgstr ""
35
+
36
+ #: advanced-db-cleaner.php:229
37
+ msgid ""
38
+ "Once you read and understand this message, you can disable it from settings "
39
+ "Tab."
40
+ msgstr ""
41
+
42
+ #: advanced-db-cleaner.php:236
43
+ msgid "General clean-up"
44
+ msgstr ""
45
+
46
+ #: advanced-db-cleaner.php:237 includes/class_optimize_tables.php:179
47
+ msgid "Optimize"
48
+ msgstr ""
49
+
50
+ #: advanced-db-cleaner.php:238 includes/class_clean_tables.php:20
51
+ #: includes/class_optimize_tables.php:18
52
+ msgid "Tables"
53
+ msgstr ""
54
+
55
+ #: advanced-db-cleaner.php:239 includes/class_clean_options.php:20
56
+ msgid "Options"
57
+ msgstr ""
58
+
59
+ #: advanced-db-cleaner.php:240
60
+ msgid "Scheduled tasks"
61
+ msgstr ""
62
+
63
+ #: advanced-db-cleaner.php:241
64
+ msgid "Overview & Settings"
65
+ msgstr ""
66
+
67
+ #: advanced-db-cleaner.php:242
68
+ msgid "Premium"
69
+ msgstr ""
70
+
71
+ #: includes/class_clean_cron.php:19
72
+ msgid "Task"
73
+ msgstr ""
74
+
75
+ #: includes/class_clean_cron.php:20
76
+ msgid "Tasks"
77
+ msgstr ""
78
+
79
+ #: includes/class_clean_cron.php:24 includes/class_clean_cron.php:228
80
+ #: includes/class_clean_options.php:24 includes/class_clean_options.php:230
81
+ #: includes/class_clean_tables.php:24 includes/class_clean_tables.php:213
82
+ #: includes/custom-clean-view/class_clean_comment.php:14
83
+ #: includes/custom-clean-view/class_clean_commentmeta.php:13
84
+ #: includes/custom-clean-view/class_clean_dashboard_transient_feed.php:13
85
+ #: includes/custom-clean-view/class_clean_draft_trash.php:15
86
+ #: includes/custom-clean-view/class_clean_postmeta.php:13
87
+ #: includes/custom-clean-view/class_clean_relationships.php:13
88
+ #: includes/custom-clean-view/class_clean_revision.php:13
89
+ msgid "This feature is available in Pro version only."
90
+ msgstr ""
91
+
92
+ #: includes/class_clean_cron.php:25 includes/class_clean_cron.php:228
93
+ #: includes/class_clean_options.php:25 includes/class_clean_options.php:230
94
+ #: includes/class_clean_tables.php:25 includes/class_clean_tables.php:213
95
+ #: includes/custom-clean-view/class_clean_comment.php:15
96
+ #: includes/custom-clean-view/class_clean_commentmeta.php:14
97
+ #: includes/custom-clean-view/class_clean_dashboard_transient_feed.php:14
98
+ #: includes/custom-clean-view/class_clean_draft_trash.php:16
99
+ #: includes/custom-clean-view/class_clean_postmeta.php:14
100
+ #: includes/custom-clean-view/class_clean_relationships.php:14
101
+ #: includes/custom-clean-view/class_clean_revision.php:14
102
+ msgid "Please upgrade to pro version"
103
+ msgstr ""
104
+
105
+ #: includes/class_clean_cron.php:51 includes/class_clean_options.php:51
106
+ #: includes/class_clean_tables.php:51
107
+ msgid ""
108
+ "Indicates the creator of the option. It can be a plugin name, a theme name "
109
+ "or WordPress itself."
110
+ msgstr ""
111
+
112
+ #: includes/class_clean_cron.php:55
113
+ msgid "Hook name"
114
+ msgstr ""
115
+
116
+ #: includes/class_clean_cron.php:56
117
+ msgid "Next run - Frequency"
118
+ msgstr ""
119
+
120
+ #: includes/class_clean_cron.php:57 includes/class_clean_options.php:58
121
+ #: includes/class_clean_tables.php:59 includes/class_optimize_tables.php:124
122
+ #: includes/custom-clean-view/class_clean_comment.php:53
123
+ #: includes/custom-clean-view/class_clean_commentmeta.php:40
124
+ #: includes/custom-clean-view/class_clean_dashboard_transient_feed.php:40
125
+ #: includes/custom-clean-view/class_clean_draft_trash.php:56
126
+ #: includes/custom-clean-view/class_clean_postmeta.php:40
127
+ #: includes/custom-clean-view/class_clean_relationships.php:40
128
+ #: includes/custom-clean-view/class_clean_revision.php:40
129
+ msgid "Site id"
130
+ msgstr ""
131
+
132
+ #: includes/class_clean_cron.php:58 includes/class_clean_options.php:59
133
+ #: includes/class_clean_tables.php:60
134
+ msgid "Belongs to"
135
+ msgstr ""
136
+
137
+ #: includes/class_clean_cron.php:111 includes/class_clean_options.php:113
138
+ #: includes/class_clean_tables.php:115
139
+ msgid "Delete"
140
+ msgstr ""
141
+
142
+ #: includes/class_clean_cron.php:119 includes/class_clean_options.php:121
143
+ #: includes/class_clean_tables.php:123
144
+ msgid "No tasks found!"
145
+ msgstr ""
146
+
147
+ #: includes/class_clean_cron.php:121 includes/class_clean_options.php:123
148
+ #: includes/class_clean_tables.php:125
149
+ #: includes/custom-clean-view/class_clean_comment.php:114
150
+ #: includes/custom-clean-view/class_clean_commentmeta.php:100
151
+ #: includes/custom-clean-view/class_clean_dashboard_transient_feed.php:100
152
+ #: includes/custom-clean-view/class_clean_draft_trash.php:116
153
+ #: includes/custom-clean-view/class_clean_postmeta.php:100
154
+ #: includes/custom-clean-view/class_clean_relationships.php:100
155
+ #: includes/custom-clean-view/class_clean_revision.php:100
156
+ #: includes/functions.php:191
157
+ msgid "Available in Pro version!"
158
+ msgstr ""
159
+
160
+ #: includes/class_clean_cron.php:164
161
+ msgid "Selected scheduled tasks cleaned successfully!"
162
+ msgstr ""
163
+
164
+ #: includes/class_clean_cron.php:208
165
+ msgid "Detect orphan tasks"
166
+ msgstr ""
167
+
168
+ #: includes/class_clean_cron.php:214 includes/class_clean_options.php:216
169
+ #: includes/class_clean_tables.php:199
170
+ msgid "Please wait!"
171
+ msgstr ""
172
+
173
+ #: includes/class_clean_cron.php:224
174
+ msgid ""
175
+ "Below the list of all your scheduled tasks. Please do not delete any task "
176
+ "unless you really know what you are doing!"
177
+ msgstr ""
178
+
179
+ #: includes/class_clean_cron.php:237 includes/class_clean_options.php:239
180
+ #: includes/class_clean_tables.php:222 includes/class_general_cleanup.php:224
181
+ msgid "Cleaning..."
182
+ msgstr ""
183
+
184
+ #: includes/class_clean_cron.php:239
185
+ msgid ""
186
+ "You are about to clean some of your scheduled tasks. This operation is "
187
+ "irreversible. Don't forget to make a backup first."
188
+ msgstr ""
189
+
190
+ #: includes/class_clean_cron.php:242 includes/class_clean_options.php:244
191
+ #: includes/class_clean_tables.php:227 includes/class_general_cleanup.php:229
192
+ msgid "Are you sure to continue?"
193
+ msgstr ""
194
+
195
+ #: includes/class_clean_cron.php:245 includes/class_clean_options.php:247
196
+ #: includes/class_clean_tables.php:230 includes/class_general_cleanup.php:232
197
+ #: includes/class_optimize_tables.php:283
198
+ msgid "Action required"
199
+ msgstr ""
200
+
201
+ #: includes/class_clean_cron.php:247 includes/class_clean_options.php:249
202
+ #: includes/class_clean_tables.php:232 includes/class_general_cleanup.php:234
203
+ #: includes/class_optimize_tables.php:285
204
+ msgid "Please select an action!"
205
+ msgstr ""
206
+
207
+ #: includes/class_clean_options.php:19
208
+ msgid "Option"
209
+ msgstr ""
210
+
211
+ #: includes/class_clean_options.php:55
212
+ msgid "Option name"
213
+ msgstr ""
214
+
215
+ #: includes/class_clean_options.php:56
216
+ msgid "Value"
217
+ msgstr ""
218
+
219
+ #: includes/class_clean_options.php:57
220
+ #: includes/custom-clean-view/class_clean_dashboard_transient_feed.php:39
221
+ msgid "Autoload"
222
+ msgstr ""
223
+
224
+ #: includes/class_clean_options.php:166
225
+ msgid "Selected options cleaned successfully!"
226
+ msgstr ""
227
+
228
+ #: includes/class_clean_options.php:210 includes/premium_page.php:11
229
+ msgid "Detect orphan options"
230
+ msgstr ""
231
+
232
+ #: includes/class_clean_options.php:226
233
+ msgid ""
234
+ "Below the list of all your options. Please do not delete any option unless "
235
+ "you really know what you are doing!"
236
+ msgstr ""
237
+
238
+ #: includes/class_clean_options.php:241
239
+ msgid ""
240
+ "You are about to clean some of your options. This operation is irreversible. "
241
+ "Don't forget to make a backup first."
242
+ msgstr ""
243
+
244
+ #: includes/class_clean_tables.php:19 includes/class_optimize_tables.php:17
245
+ msgid "Table"
246
+ msgstr ""
247
+
248
+ #: includes/class_clean_tables.php:55 includes/class_optimize_tables.php:122
249
+ msgid "Prefix"
250
+ msgstr ""
251
+
252
+ #: includes/class_clean_tables.php:56 includes/class_optimize_tables.php:123
253
+ msgid "Table name"
254
+ msgstr ""
255
+
256
+ #: includes/class_clean_tables.php:57
257
+ msgid "Rows"
258
+ msgstr ""
259
+
260
+ #: includes/class_clean_tables.php:58
261
+ msgid "Size"
262
+ msgstr ""
263
+
264
+ #: includes/class_clean_tables.php:149
265
+ msgid "Selected tables cleaned successfully!"
266
+ msgstr ""
267
+
268
+ #: includes/class_clean_tables.php:193 includes/premium_page.php:12
269
+ msgid "Detect orphan tables"
270
+ msgstr ""
271
+
272
+ #: includes/class_clean_tables.php:209
273
+ msgid ""
274
+ "Below the list of all your tables. Please do not delete any table unless you "
275
+ "really know what you are doing!"
276
+ msgstr ""
277
+
278
+ #: includes/class_clean_tables.php:224
279
+ msgid ""
280
+ "You are about to clean some of your tables. This operation is irreversible. "
281
+ "Don't forget to make a backup first."
282
+ msgstr ""
283
+
284
+ #: includes/class_general_cleanup.php:15
285
+ msgid "Element"
286
+ msgstr ""
287
+
288
+ #: includes/class_general_cleanup.php:16
289
+ msgid "Elements"
290
+ msgstr ""
291
+
292
+ #: includes/class_general_cleanup.php:28
293
+ msgid "The clean-up schedule saved successfully!"
294
+ msgstr ""
295
+
296
+ #: includes/class_general_cleanup.php:70
297
+ msgid "Element to clean"
298
+ msgstr ""
299
+
300
+ #: includes/class_general_cleanup.php:71
301
+ msgid "Count"
302
+ msgstr ""
303
+
304
+ #: includes/class_general_cleanup.php:72
305
+ msgid "View"
306
+ msgstr ""
307
+
308
+ #: includes/class_general_cleanup.php:121
309
+ #: includes/custom-clean-view/class_clean_comment.php:107
310
+ #: includes/custom-clean-view/class_clean_commentmeta.php:93
311
+ #: includes/custom-clean-view/class_clean_dashboard_transient_feed.php:93
312
+ #: includes/custom-clean-view/class_clean_draft_trash.php:109
313
+ #: includes/custom-clean-view/class_clean_postmeta.php:93
314
+ #: includes/custom-clean-view/class_clean_relationships.php:93
315
+ #: includes/custom-clean-view/class_clean_revision.php:93
316
+ msgid "Clean"
317
+ msgstr ""
318
+
319
+ #: includes/class_general_cleanup.php:128
320
+ #: includes/class_general_cleanup.php:174
321
+ msgid "Your database is clean!"
322
+ msgstr ""
323
+
324
+ #: includes/class_general_cleanup.php:149
325
+ msgid "Selected elements successfully cleaned!"
326
+ msgstr ""
327
+
328
+ #: includes/class_general_cleanup.php:177
329
+ msgid "element(s) should be cleaned!"
330
+ msgstr ""
331
+
332
+ #: includes/class_general_cleanup.php:181
333
+ #: includes/class_optimize_tables.php:240
334
+ msgid "Schedule"
335
+ msgstr ""
336
+
337
+ #: includes/class_general_cleanup.php:188
338
+ #: includes/class_optimize_tables.php:247
339
+ msgid "Not scheduled"
340
+ msgstr ""
341
+
342
+ #: includes/class_general_cleanup.php:191
343
+ msgid "Run clean-up hourly"
344
+ msgstr ""
345
+
346
+ #: includes/class_general_cleanup.php:194
347
+ msgid "Run clean-up twice a day"
348
+ msgstr ""
349
+
350
+ #: includes/class_general_cleanup.php:197
351
+ msgid "Run clean-up daily"
352
+ msgstr ""
353
+
354
+ #: includes/class_general_cleanup.php:200
355
+ msgid "Run clean-up weekly"
356
+ msgstr ""
357
+
358
+ #: includes/class_general_cleanup.php:203
359
+ msgid "Run clean-up monthly"
360
+ msgstr ""
361
+
362
+ #: includes/class_general_cleanup.php:206
363
+ #: includes/class_optimize_tables.php:265
364
+ msgid "Save"
365
+ msgstr ""
366
+
367
+ #: includes/class_general_cleanup.php:209
368
+ #: includes/class_optimize_tables.php:268
369
+ msgid "Next run:"
370
+ msgstr ""
371
+
372
+ #: includes/class_general_cleanup.php:215
373
+ #: includes/class_optimize_tables.php:274
374
+ msgid "not set"
375
+ msgstr ""
376
+
377
+ #: includes/class_general_cleanup.php:226
378
+ msgid ""
379
+ "You are about to clean some of your unused data. This operation is "
380
+ "irreversible. Don't forget to make a backup first."
381
+ msgstr ""
382
+
383
+ #: includes/class_optimize_tables.php:30
384
+ msgid "The optimization schedule saved successfully!"
385
+ msgstr ""
386
+
387
+ #: includes/class_optimize_tables.php:118
388
+ msgid "Indicates the total lost space in the table"
389
+ msgstr ""
390
+
391
+ #: includes/class_optimize_tables.php:125
392
+ msgid "Lost"
393
+ msgstr ""
394
+
395
+ #: includes/class_optimize_tables.php:186
396
+ msgid "All tables are optimized!"
397
+ msgstr ""
398
+
399
+ #: includes/class_optimize_tables.php:207
400
+ msgid "Selected tables successfully optimized!"
401
+ msgstr ""
402
+
403
+ #: includes/class_optimize_tables.php:232
404
+ msgid "Your database is optimized!"
405
+ msgstr ""
406
+
407
+ #: includes/class_optimize_tables.php:235
408
+ msgid "table(s) should be optimized!"
409
+ msgstr ""
410
+
411
+ #: includes/class_optimize_tables.php:250
412
+ msgid "Run optimization hourly"
413
+ msgstr ""
414
+
415
+ #: includes/class_optimize_tables.php:253
416
+ msgid "Run optimization twice a day"
417
+ msgstr ""
418
+
419
+ #: includes/class_optimize_tables.php:256
420
+ msgid "Run optimization daily"
421
+ msgstr ""
422
+
423
+ #: includes/class_optimize_tables.php:259
424
+ msgid "Run optimization weekly"
425
+ msgstr ""
426
+
427
+ #: includes/class_optimize_tables.php:262
428
+ msgid "Run optimization monthly"
429
+ msgstr ""
430
+
431
+ #: includes/custom-clean-view/class_clean_comment.php:18
432
+ msgid "Pending comment"
433
+ msgstr ""
434
+
435
+ #: includes/custom-clean-view/class_clean_comment.php:19
436
+ #: includes/functions.php:96
437
+ msgid "Pending comments"
438
+ msgstr ""
439
+
440
+ #: includes/custom-clean-view/class_clean_comment.php:21
441
+ msgid "Spam comment"
442
+ msgstr ""
443
+
444
+ #: includes/custom-clean-view/class_clean_comment.php:22
445
+ msgid "Spam comments"
446
+ msgstr ""
447
+
448
+ #: includes/custom-clean-view/class_clean_comment.php:24
449
+ msgid "Trash comment"
450
+ msgstr ""
451
+
452
+ #: includes/custom-clean-view/class_clean_comment.php:25
453
+ #: includes/functions.php:98
454
+ msgid "Trash comments"
455
+ msgstr ""
456
+
457
+ #: includes/custom-clean-view/class_clean_comment.php:49
458
+ #: includes/custom-clean-view/class_clean_draft_trash.php:53
459
+ #: includes/custom-clean-view/class_clean_revision.php:37
460
+ msgid "ID"
461
+ msgstr ""
462
+
463
+ #: includes/custom-clean-view/class_clean_comment.php:50
464
+ msgid "Author"
465
+ msgstr ""
466
+
467
+ #: includes/custom-clean-view/class_clean_comment.php:51
468
+ msgid "Content"
469
+ msgstr ""
470
+
471
+ #: includes/custom-clean-view/class_clean_comment.php:52
472
+ #: includes/custom-clean-view/class_clean_draft_trash.php:55
473
+ #: includes/custom-clean-view/class_clean_revision.php:39
474
+ msgid "Date"
475
+ msgstr ""
476
+
477
+ #: includes/custom-clean-view/class_clean_comment.php:134
478
+ #: includes/custom-clean-view/class_clean_draft_trash.php:136
479
+ msgid "Custom cleaning : "
480
+ msgstr ""
481
+
482
+ #: includes/custom-clean-view/class_clean_commentmeta.php:17
483
+ msgid "Comment meta"
484
+ msgstr ""
485
+
486
+ #: includes/custom-clean-view/class_clean_commentmeta.php:18
487
+ msgid "Comments meta"
488
+ msgstr ""
489
+
490
+ #: includes/custom-clean-view/class_clean_commentmeta.php:37
491
+ #: includes/custom-clean-view/class_clean_postmeta.php:37
492
+ msgid "Meta id"
493
+ msgstr ""
494
+
495
+ #: includes/custom-clean-view/class_clean_commentmeta.php:38
496
+ msgid "Comment meta key"
497
+ msgstr ""
498
+
499
+ #: includes/custom-clean-view/class_clean_commentmeta.php:39
500
+ #: includes/custom-clean-view/class_clean_postmeta.php:39
501
+ msgid "Meta value"
502
+ msgstr ""
503
+
504
+ #: includes/custom-clean-view/class_clean_commentmeta.php:120
505
+ msgid "Custom cleaning : <b>Orphan commentmeta</b>"
506
+ msgstr ""
507
+
508
+ #: includes/custom-clean-view/class_clean_dashboard_transient_feed.php:17
509
+ msgid "Dashboard transient feed"
510
+ msgstr ""
511
+
512
+ #: includes/custom-clean-view/class_clean_dashboard_transient_feed.php:18
513
+ msgid "Dashboard transients feed"
514
+ msgstr ""
515
+
516
+ #: includes/custom-clean-view/class_clean_dashboard_transient_feed.php:37
517
+ msgid "Feed id"
518
+ msgstr ""
519
+
520
+ #: includes/custom-clean-view/class_clean_dashboard_transient_feed.php:38
521
+ msgid "Feed name"
522
+ msgstr ""
523
+
524
+ #: includes/custom-clean-view/class_clean_dashboard_transient_feed.php:120
525
+ msgid "Custom cleaning : <b>Dashboard transient feed</b>"
526
+ msgstr ""
527
+
528
+ #: includes/custom-clean-view/class_clean_draft_trash.php:19
529
+ msgid "Draft"
530
+ msgstr ""
531
+
532
+ #: includes/custom-clean-view/class_clean_draft_trash.php:20
533
+ #: includes/functions.php:93
534
+ msgid "Drafts"
535
+ msgstr ""
536
+
537
+ #: includes/custom-clean-view/class_clean_draft_trash.php:21
538
+ msgid "Draft title"
539
+ msgstr ""
540
+
541
+ #: includes/custom-clean-view/class_clean_draft_trash.php:23
542
+ msgid "Auto draft"
543
+ msgstr ""
544
+
545
+ #: includes/custom-clean-view/class_clean_draft_trash.php:24
546
+ msgid "Auto drafts"
547
+ msgstr ""
548
+
549
+ #: includes/custom-clean-view/class_clean_draft_trash.php:25
550
+ msgid "Auto draft title"
551
+ msgstr ""
552
+
553
+ #: includes/custom-clean-view/class_clean_draft_trash.php:27
554
+ msgid "Trash post"
555
+ msgstr ""
556
+
557
+ #: includes/custom-clean-view/class_clean_draft_trash.php:28
558
+ #: includes/functions.php:95
559
+ msgid "Trash posts"
560
+ msgstr ""
561
+
562
+ #: includes/custom-clean-view/class_clean_draft_trash.php:29
563
+ msgid "Trash post title"
564
+ msgstr ""
565
+
566
+ #: includes/custom-clean-view/class_clean_postmeta.php:17
567
+ msgid "Post meta"
568
+ msgstr ""
569
+
570
+ #: includes/custom-clean-view/class_clean_postmeta.php:18
571
+ msgid "Posts meta"
572
+ msgstr ""
573
+
574
+ #: includes/custom-clean-view/class_clean_postmeta.php:38
575
+ msgid "Post meta key"
576
+ msgstr ""
577
+
578
+ #: includes/custom-clean-view/class_clean_postmeta.php:120
579
+ msgid "Custom cleaning : <b>Orphan postmeta</b>"
580
+ msgstr ""
581
+
582
+ #: includes/custom-clean-view/class_clean_relationships.php:17
583
+ msgid "Relationship"
584
+ msgstr ""
585
+
586
+ #: includes/custom-clean-view/class_clean_relationships.php:18
587
+ msgid "Relationships"
588
+ msgstr ""
589
+
590
+ #: includes/custom-clean-view/class_clean_relationships.php:37
591
+ msgid "Object id"
592
+ msgstr ""
593
+
594
+ #: includes/custom-clean-view/class_clean_relationships.php:38
595
+ msgid "Term taxonomy id"
596
+ msgstr ""
597
+
598
+ #: includes/custom-clean-view/class_clean_relationships.php:39
599
+ msgid "Term order"
600
+ msgstr ""
601
+
602
+ #: includes/custom-clean-view/class_clean_relationships.php:120
603
+ msgid "Custom cleaning : <b>Orphan relationships</b>"
604
+ msgstr ""
605
+
606
+ #: includes/custom-clean-view/class_clean_revision.php:17
607
+ msgid "Revision"
608
+ msgstr ""
609
+
610
+ #: includes/custom-clean-view/class_clean_revision.php:18
611
+ #: includes/functions.php:92
612
+ msgid "Revisions"
613
+ msgstr ""
614
+
615
+ #: includes/custom-clean-view/class_clean_revision.php:38
616
+ msgid "Revision title"
617
+ msgstr ""
618
+
619
+ #: includes/custom-clean-view/class_clean_revision.php:120
620
+ msgid "Custom cleaning : <b>Revisions</b>"
621
+ msgstr ""
622
+
623
+ #: includes/functions.php:94
624
+ msgid "Auto Drafts"
625
+ msgstr ""
626
+
627
+ #: includes/functions.php:97
628
+ msgid "Spam Comments"
629
+ msgstr ""
630
+
631
+ #: includes/functions.php:99
632
+ msgid "Orphan Postmeta"
633
+ msgstr ""
634
+
635
+ #: includes/functions.php:100
636
+ msgid "Orphan Commentmeta"
637
+ msgstr ""
638
+
639
+ #: includes/functions.php:101
640
+ msgid "Orphan Relationships"
641
+ msgstr ""
642
+
643
+ #: includes/functions.php:102
644
+ msgid "Dashboard Transient Feed"
645
+ msgstr ""
646
+
647
+ #: includes/functions.php:161
648
+ msgid "All tasks"
649
+ msgstr ""
650
+
651
+ #: includes/functions.php:162
652
+ msgid "Orphan tasks"
653
+ msgstr ""
654
+
655
+ #: includes/functions.php:163
656
+ msgid "Plugins tasks"
657
+ msgstr ""
658
+
659
+ #: includes/functions.php:164
660
+ msgid "Themes tasks"
661
+ msgstr ""
662
+
663
+ #: includes/functions.php:165
664
+ msgid "WP tasks"
665
+ msgstr ""
666
+
667
+ #: includes/functions.php:171
668
+ msgid "All options"
669
+ msgstr ""
670
+
671
+ #: includes/functions.php:172
672
+ msgid "Orphan options"
673
+ msgstr ""
674
+
675
+ #: includes/functions.php:173
676
+ msgid "Plugins options"
677
+ msgstr ""
678
+
679
+ #: includes/functions.php:174
680
+ msgid "Themes options"
681
+ msgstr ""
682
+
683
+ #: includes/functions.php:175
684
+ msgid "WP options"
685
+ msgstr ""
686
+
687
+ #: includes/functions.php:181
688
+ msgid "All tables"
689
+ msgstr ""
690
+
691
+ #: includes/functions.php:182
692
+ msgid "Orphan tables"
693
+ msgstr ""
694
+
695
+ #: includes/functions.php:183
696
+ msgid "Plugins tables"
697
+ msgstr ""
698
+
699
+ #: includes/functions.php:184
700
+ msgid "Themes tables"
701
+ msgstr ""
702
+
703
+ #: includes/functions.php:185
704
+ msgid "WP tables"
705
+ msgstr ""
706
+
707
+ #: includes/functions.php:390
708
+ msgid "Unknown!"
709
+ msgstr ""
710
+
711
+ #: includes/functions.php:393
712
+ msgid "One-off event"
713
+ msgstr ""
714
+
715
+ #: includes/overview_settings.php:22
716
+ msgid ""
717
+ "Indicates the total number of rows in your option tables of all your network "
718
+ "sites, including transients..."
719
+ msgstr ""
720
+
721
+ #: includes/overview_settings.php:27
722
+ msgid ""
723
+ "Indicates the total number of rows in your option table, including "
724
+ "transients..."
725
+ msgstr ""
726
+
727
+ #: includes/overview_settings.php:51
728
+ msgid "Yes"
729
+ msgstr ""
730
+
731
+ #: includes/overview_settings.php:54
732
+ msgid "No"
733
+ msgstr ""
734
+
735
+ #: includes/overview_settings.php:61
736
+ msgid "Settings saved successfully!"
737
+ msgstr ""
738
+
739
+ #: includes/overview_settings.php:67
740
+ msgid "Overview"
741
+ msgstr ""
742
+
743
+ #: includes/overview_settings.php:70
744
+ msgid "WP Version"
745
+ msgstr ""
746
+
747
+ #: includes/overview_settings.php:74
748
+ msgid "Database size"
749
+ msgstr ""
750
+
751
+ #: includes/overview_settings.php:78
752
+ msgid "Total unused data"
753
+ msgstr ""
754
+
755
+ #: includes/overview_settings.php:82
756
+ msgid "Total tables"
757
+ msgstr ""
758
+
759
+ #: includes/overview_settings.php:86
760
+ msgid "Tables to optimize"
761
+ msgstr ""
762
+
763
+ #: includes/overview_settings.php:90
764
+ msgid "Total options"
765
+ msgstr ""
766
+
767
+ #: includes/overview_settings.php:94
768
+ msgid "Total cron tasks"
769
+ msgstr ""
770
+
771
+ #: includes/overview_settings.php:98
772
+ msgid "WP multisite Enabled ?"
773
+ msgstr ""
774
+
775
+ #: includes/overview_settings.php:102
776
+ msgid "Number of sites"
777
+ msgstr ""
778
+
779
+ #: includes/overview_settings.php:106
780
+ msgid "Script Max timeout"
781
+ msgstr ""
782
+
783
+ #: includes/overview_settings.php:107
784
+ msgid "seconds"
785
+ msgstr ""
786
+
787
+ #: includes/overview_settings.php:110
788
+ msgid "Local time"
789
+ msgstr ""
790
+
791
+ #: includes/overview_settings.php:117
792
+ msgid "Settings"
793
+ msgstr ""
794
+
795
+ #: includes/overview_settings.php:122
796
+ msgid "Show plugin left menu"
797
+ msgstr ""
798
+
799
+ #: includes/overview_settings.php:124
800
+ msgid "Displays a menu at the left bar of your WP admin"
801
+ msgstr ""
802
+
803
+ #: includes/overview_settings.php:129
804
+ msgid "Show welcome message"
805
+ msgstr ""
806
+
807
+ #: includes/overview_settings.php:131
808
+ msgid "Reminds you to make a backup of your database"
809
+ msgstr ""
810
+
811
+ #: includes/overview_settings.php:135
812
+ msgid "Save settings"
813
+ msgstr ""
814
+
815
+ #: includes/premium_page.php:3
816
+ msgid "Need more features ?"
817
+ msgstr ""
818
+
819
+ #: includes/premium_page.php:4
820
+ msgid "Find more advanced features!"
821
+ msgstr ""
822
+
823
+ #: includes/premium_page.php:10
824
+ msgid "View items before cleaning"
825
+ msgstr ""
826
+
827
+ #: includes/premium_page.php:13
828
+ msgid "Detect orphan cron tasks"
829
+ msgstr ""
830
+
831
+ #: includes/premium_page.php:19
832
+ msgid "Need support as well ?"
833
+ msgstr ""
834
+
835
+ #: includes/premium_page.php:20
836
+ msgid "We are available to support you!"
837
+ msgstr ""
838
+
839
+ #: includes/premium_page.php:26
840
+ msgid "Get lifetime support"
841
+ msgstr ""
842
+
843
+ #: includes/premium_page.php:27
844
+ msgid "Get technical support"
845
+ msgstr ""
846
+
847
+ #: includes/premium_page.php:28
848
+ msgid "No additional fees"
849
+ msgstr ""
850
+
851
+ #: includes/premium_page.php:29
852
+ msgid "Great support service"
853
+ msgstr ""
854
+
855
+ #: includes/premium_page.php:36
856
+ msgid "Buy now!"
857
+ msgstr ""
858
+
859
+ #: includes/premium_page.php:38
860
+ msgid "Buy one time, get lifetime updates!"
861
+ msgstr ""
862
+
863
+ #: includes/sidebar.php:3
864
+ msgid "By making a donation, you help me supporting this plugin!"
865
+ msgstr ""
866
+
867
+ #: includes/sidebar.php:13
868
+ msgid "Please rate us"
869
+ msgstr ""
870
+
871
+ #: includes/sidebar.php:24
872
+ msgid "Having issues?"
873
+ msgstr ""
874
+
875
+ #: includes/sidebar.php:28
876
+ msgid "Create a ticket"
877
+ msgstr ""
878
+
879
+ #: includes/sidebar.php:35
880
+ msgid "Developed by:"
881
+ msgstr ""