Advanced Database Cleaner - Version 1.2.3

Version Description

  • Some optimizations and style modifications
  • New feature: Adding the scheduler. You can now schedule the clean-up and optimization of your database.
Download this release

Release Info

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

Code changes from version 1.2.2 to 1.2.3

README.txt CHANGED
@@ -1,10 +1,10 @@
1
  === Advanced Database Cleaner ===
2
  Contributors: symptote
3
  Donate Link: https://www.paypal.com/us/cgi-bin/webscr?cmd=_flow&SESSION=Azq_P8u-Dy9AZSB3bmJFsrGWImHWiCoHtSE8KuC2SNdGQpreQxG8dl2tVZK&dispatch=5885d80a13c0db1f8e263663d3faee8d0b9dcb01a9b6dc564e45f62871326a5e
4
- Tags: plugin, plugins, plugin wordpress, wordpress, database cleaner, clean database, database clean, database, clean, cleaner, delete orphan data, orphan data, delete revisions, revision, delete draft, draft, delete trash, trash, delete spam, spam, delete auto drfat, 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
5
  Requires at least: 2.7
6
  Tested up to: 4.3
7
- Stable tag: 1.2.2
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -23,6 +23,7 @@ Advanced Database Cleaner is a must-have plugin that cleans your WP database by:
23
  <br><br>
24
  * It cleans your database by one click.<br>
25
  * The settings page allows you choose what data should be cleaned.<br>
 
26
  * It is a must-have plugin to keep your database clean.<br>
27
 
28
  == Installation ==
@@ -41,6 +42,10 @@ This section describes how to install the plugin and get it working.
41
 
42
  == Changelog ==
43
 
 
 
 
 
44
  = 1.2.2 =
45
  * Some optimizations and style modifications
46
 
1
  === Advanced Database Cleaner ===
2
  Contributors: symptote
3
  Donate Link: https://www.paypal.com/us/cgi-bin/webscr?cmd=_flow&SESSION=Azq_P8u-Dy9AZSB3bmJFsrGWImHWiCoHtSE8KuC2SNdGQpreQxG8dl2tVZK&dispatch=5885d80a13c0db1f8e263663d3faee8d0b9dcb01a9b6dc564e45f62871326a5e
4
+ Tags: plugin, plugins, plugin wordpress, wordpress, database cleaner, clean database, database clean, database, clean, cleaner, delete orphan data, orphan data, delete revisions, revision, delete draft, draft, delete trash, trash, delete spam, spam, delete auto drfat, 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, schedule, scheduler, schedule clean-up, schedule optimize
5
  Requires at least: 2.7
6
  Tested up to: 4.3
7
+ Stable tag: 1.2.3
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
23
  <br><br>
24
  * It cleans your database by one click.<br>
25
  * The settings page allows you choose what data should be cleaned.<br>
26
+ * You can schedule the clean-up and optimization of your database.<br>
27
  * It is a must-have plugin to keep your database clean.<br>
28
 
29
  == Installation ==
42
 
43
  == Changelog ==
44
 
45
+ = 1.2.3 =
46
+ * Some optimizations and style modifications
47
+ * New feature: Adding the scheduler. You can now schedule the clean-up and optimization of your database.
48
+
49
  = 1.2.2 =
50
  * Some optimizations and style modifications
51
 
advanced-db-cleaner-admin.php DELETED
@@ -1,85 +0,0 @@
1
- <?php
2
- add_action('admin_init', 'adv_db_cleaner_register_styles' );
3
- add_action('admin_menu', 'adv_db_cleaner_add_admin_menu');
4
- /* --- Add 'DB Cleaner' to Wordpress settings menu ---------- */
5
- function adv_db_cleaner_add_admin_menu() {
6
- $hook_adv_db_cleaner = add_options_page('Advanced DB Cleaner Options', 'Database Cleaner','manage_options', __FILE__, 'adv_db_cleaner_page');
7
- add_action('admin_print_styles-' . $hook_adv_db_cleaner, 'adv_db_cleaner_enqueue_styles');
8
- }
9
- /* --- Register stylesheet ---------------------------------- */
10
- function adv_db_cleaner_register_styles() {
11
- wp_register_style('adv_db_cleaner_css', plugins_url() .'/'. dirname(plugin_basename(__FILE__)) . '/css/style.css');
12
- }
13
- /* --- Enqueue stylesheet ----------------------------------- */
14
- function adv_db_cleaner_enqueue_styles() {
15
- wp_enqueue_style( 'adv_db_cleaner_css' );
16
- }
17
- /* --- The admin page content ------------------------------- */
18
- function adv_db_cleaner_page(){
19
- ?>
20
- <div class="wrap">
21
- <h2>Advanced DB Cleaner</h2>
22
- <?php
23
- // If one of the forms is sent, then process data and print results
24
- $adv_db_cleaner_message = '';
25
- $adv_db_cleaner_message_class = 'updated settings-error notice is-dismissible';
26
- if(isset($_POST['adbc_post_type'])){
27
- foreach($_POST['adbc_post_type'] as $adbc_type) {
28
- adv_db_cleaner($adbc_type);
29
- }
30
- $adv_db_cleaner_message = __('Database cleaned successfully!', 'advanced-db-cleaner');
31
- }elseif(isset($_POST['aDBc_optimize_form'])){
32
- adv_db_cleaner_optimize();
33
- $adv_db_cleaner_message = __('Database optimized successfully!', 'advanced-db-cleaner');
34
- }elseif(isset($_POST['aDBc_reset_form'])){
35
- if($_POST['aDBc_reset_comfirmation'] == 'reset'){
36
- adv_db_cleaner_reset();
37
- }else{
38
- $adv_db_cleaner_message = __('Please type the word "reset" correctly in the text box below.', 'advanced-db-cleaner');
39
- $adv_db_cleaner_message_class = 'error';
40
- }
41
- }
42
- // Print message
43
- if($adv_db_cleaner_message != ''){
44
- echo '<div id="adbc_message" class="'. $adv_db_cleaner_message_class .'"><p><strong>' . $adv_db_cleaner_message . '</strong></p></div>';
45
- }
46
- ?>
47
- <div class="marginRight300">
48
- <div class="tabBox">
49
- <?php
50
- $aDBc_tab_list = array(
51
- array("id"=>"aDBc-clean", "title"=>__('Clean Database', 'advanced-db-cleaner')),
52
- array("id"=>"aDBc-optimize", "title"=>__('Optimize Database', 'advanced-db-cleaner')),
53
- array("id"=>"aDBc-reset", "title"=>__('Reset Database', 'advanced-db-cleaner'))
54
- );
55
- foreach ($aDBc_tab_list as $key => $value){
56
- $checked = "";
57
- if((!isset($_POST["aDBc_clean_form"]) && !isset($_POST["aDBc_optimize_form"]) && !isset($_POST["aDBc_reset_form"]) && $value["id"] == "aDBc-clean")
58
- || (isset($_POST["aDBc_optimize_form"]) && $value["id"] == "aDBc-optimize")
59
- || (isset($_POST["aDBc_clean_form"]) && $value["id"] == "aDBc-clean")
60
- || (isset($_POST["aDBc_reset_form"]) && $value["id"] == "aDBc-reset")){
61
- $checked = 'checked = "checked"';
62
- }
63
- echo '<input '.$checked.' type="radio" id="'.$value["id"].'" name="tabGroup1">'."\n";
64
- echo '<label for="'.$value["id"].'">'.$value["title"].'</label>'."\n";
65
- }
66
- ?>
67
- <div class="tab1">
68
- <?php include_once 'includes/clean-db.php'; ?>
69
- </div>
70
- <div class="tab2">
71
- <?php include_once 'includes/optimize-db.php'; ?>
72
- </div>
73
- <div class="tab3">
74
- <?php include_once 'includes/reset-db.php'; ?>
75
- </div>
76
- </div>
77
- <div class="aDBcSidebar">
78
- <?php include_once 'includes/sidebar.php'; ?>
79
- </div>
80
- </div>
81
- </div>
82
- <?php
83
- }
84
- include_once 'includes/functions.php';
85
- ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
advanced-db-cleaner.php CHANGED
@@ -2,7 +2,7 @@
2
  /*
3
  Plugin Name: Advanced Database Cleaner
4
  Description: Clean up your database by deleting unused data such as 'draft', Optimize your database or reset it to its initial state.
5
- Version: 1.2.2
6
  Author: Younes JFR.
7
  Contributors: symptote
8
  Text Domain: advanced-db-cleaner
@@ -11,17 +11,188 @@ License: GPLv2 or later
11
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
12
  */
13
 
 
 
14
  defined( 'ABSPATH' ) or die( 'No script kiddies please!' );
15
 
 
 
 
16
  add_filter('plugin_action_links_' . plugin_basename(__FILE__), 'db_cleaner_add_action_links');
17
-
18
- // Add 'settings' link under the plugin name in plugins page
19
  function db_cleaner_add_action_links($links){
20
- $adc_settings_link = '<a href = "options-general.php?page=' . dirname(plugin_basename(__FILE__)) . '/advanced-db-cleaner-admin.php">' . __('Settings', 'advanced-db-cleaner') . '</a>';
21
  array_unshift($links, $adc_settings_link);
22
  return $links;
23
  }
24
 
25
- if(is_admin()){require_once('advanced-db-cleaner-admin.php');}
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
26
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
27
  ?>
2
  /*
3
  Plugin Name: Advanced Database Cleaner
4
  Description: Clean up your database by deleting unused data such as 'draft', Optimize your database or reset it to its initial state.
5
+ Version: 1.2.3
6
  Author: Younes JFR.
7
  Contributors: symptote
8
  Text Domain: advanced-db-cleaner
11
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
12
  */
13
 
14
+ /*******************************************************************/
15
+
16
  defined( 'ABSPATH' ) or die( 'No script kiddies please!' );
17
 
18
+ /********************************************************************
19
+ * Add 'settings' link under the plugin name in plugins page
20
+ ********************************************************************/
21
  add_filter('plugin_action_links_' . plugin_basename(__FILE__), 'db_cleaner_add_action_links');
 
 
22
  function db_cleaner_add_action_links($links){
23
+ $adc_settings_link = '<a href = "options-general.php?page=' . dirname(plugin_basename(__FILE__)) . '/advanced-db-cleaner.php">' . __('Settings', 'advanced-db-cleaner') . '</a>';
24
  array_unshift($links, $adc_settings_link);
25
  return $links;
26
  }
27
 
28
+ /********************************************************************
29
+ * Add 'Database Cleaner' to Wordpress settings menu
30
+ ********************************************************************/
31
+ add_action('admin_menu', 'adv_db_cleaner_add_admin_menu');
32
+ function adv_db_cleaner_add_admin_menu() {
33
+ $hook_adv_db_cleaner = add_options_page('Advanced DB Cleaner Options', 'Database Cleaner','manage_options', __FILE__, 'adv_db_cleaner_page');
34
+ add_action('admin_print_styles-' . $hook_adv_db_cleaner, 'adv_db_cleaner_enqueue_styles');
35
+ }
36
+
37
+ /********************************************************************
38
+ * Register stylesheet
39
+ ********************************************************************/
40
+ add_action('admin_init', 'adv_db_cleaner_register_styles' );
41
+ function adv_db_cleaner_register_styles() {
42
+ wp_register_style('adv_db_cleaner_css', plugins_url() .'/'. dirname(plugin_basename(__FILE__)) . '/css/style.css');
43
+ }
44
+
45
+ /********************************************************************
46
+ * nqueue stylesheet
47
+ ********************************************************************/
48
+ function adv_db_cleaner_enqueue_styles() {
49
+ wp_enqueue_style( 'adv_db_cleaner_css' );
50
+ }
51
+
52
+ /******************************************************************************************
53
+ * The scheduler
54
+ * Get more info here: http://codex.wordpress.org/Plugin_API/Filter_Reference/cron_schedules
55
+ ******************************************************************************************/
56
+ add_filter('cron_schedules', 'aDBc_additional_schedules');
57
+ function aDBc_additional_schedules($schedules){
58
+ // Add weekly schedule
59
+ $schedules['weekly'] = array(
60
+ 'interval' => 604800,
61
+ 'display' => __('Once Weekly')
62
+ );
63
+ // Add monthly schedule
64
+ $schedules['monthly'] = array(
65
+ 'interval' => 2635200,
66
+ 'display' => __('Once a month')
67
+ );
68
+ return $schedules;
69
+ }
70
+
71
+ // (RE)-schedule tasks after (RE)-activation or update of the plugin
72
+ register_activation_hook(__FILE__, 'aDBc_activate_plugin');
73
+ add_action('aDBc_optimize_scheduler', 'adv_db_cleaner_optimize');
74
+ add_action('aDBc_clean_scheduler', 'aDBc_cleanAll');
75
+ function aDBc_activate_plugin(){
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
+ }
87
+
88
+ // Clear current scheduled tasks (if any) when deactivated
89
+ register_deactivation_hook(__FILE__, 'aDBc_deactivate_plugin' );
90
+ function aDBc_deactivate_plugin(){
91
+ wp_clear_scheduled_hook('aDBc_optimize_scheduler');
92
+ wp_clear_scheduled_hook('aDBc_clean_scheduler');
93
+ }
94
+
95
+ register_uninstall_hook(__FILE__, 'aDBc_uninstall');
96
+ function aDBc_uninstall(){
97
+ delete_option('aDBc_optimize_schedule');
98
+ delete_option('aDBc_clean_schedule');
99
+ wp_clear_scheduled_hook('aDBc_optimize_scheduler');
100
+ wp_clear_scheduled_hook('aDBc_clean_scheduler');
101
+ }
102
 
103
+ /***************************************************************
104
+ *
105
+ * The admin page content
106
+ *
107
+ ***************************************************************/
108
+ function adv_db_cleaner_page(){
109
+ ?>
110
+ <div class="wrap">
111
+ <h2>Advanced DB Cleaner</h2>
112
+ <?php
113
+ // If one of the forms is sent, then process data and print results
114
+ $adv_db_cleaner_message = '';
115
+ $adv_db_cleaner_message_class = 'updated settings-error notice is-dismissible';
116
+ if(isset($_POST['adbc_post_type'])){
117
+ foreach($_POST['adbc_post_type'] as $adbc_type) {
118
+ adv_db_cleaner($adbc_type);
119
+ }
120
+ $adv_db_cleaner_message = __('Database cleaned successfully!', 'advanced-db-cleaner');
121
+ }elseif(isset($_POST['aDBc_optimize_form'])){
122
+ adv_db_cleaner_optimize();
123
+ $adv_db_cleaner_message = __('Database optimized successfully!', 'advanced-db-cleaner');
124
+ }elseif(isset($_POST['aDBc_reset_form'])){
125
+ if($_POST['aDBc_reset_comfirmation'] == 'reset'){
126
+ adv_db_cleaner_reset();
127
+ }else{
128
+ $adv_db_cleaner_message = __('Please type the word "reset" correctly in the text box below.', 'advanced-db-cleaner');
129
+ $adv_db_cleaner_message_class = 'error';
130
+ }
131
+ }elseif(isset($_POST['aDBc_optimize_schedule_form'])){
132
+ wp_clear_scheduled_hook('aDBc_optimize_scheduler');
133
+ if($_POST['aDBc_optimize_schedule'] == 'no_schedule'){
134
+ delete_option('aDBc_optimize_schedule');
135
+ }else{
136
+ update_option('aDBc_optimize_schedule', $_POST['aDBc_optimize_schedule']);
137
+ wp_schedule_event(time()+60, $_POST['aDBc_optimize_schedule'], 'aDBc_optimize_scheduler');
138
+ }
139
+ $adv_db_cleaner_message = __('The optimization schedule is saved successfully!', 'advanced-db-cleaner');
140
+ }elseif(isset($_POST['aDBc_clean_schedule_form'])){
141
+ wp_clear_scheduled_hook('aDBc_clean_scheduler');
142
+ if($_POST['aDBc_clean_schedule'] == 'no_schedule'){
143
+ delete_option('aDBc_clean_schedule');
144
+ }else{
145
+ update_option('aDBc_clean_schedule', $_POST['aDBc_clean_schedule']);
146
+ wp_schedule_event(time()+60, $_POST['aDBc_clean_schedule'], 'aDBc_clean_scheduler');
147
+ }
148
+ $adv_db_cleaner_message = __('The clean-up schedule is saved successfully!', 'advanced-db-cleaner');
149
+ }
150
+ // Print message
151
+ if($adv_db_cleaner_message != ''){
152
+ echo '<div id="adbc_message" class="'. $adv_db_cleaner_message_class .'"><p><strong>' . $adv_db_cleaner_message . '</strong></p></div>';
153
+ }
154
+ ?>
155
+ <div class="marginRight300">
156
+ <div class="tabBox">
157
+ <?php
158
+ $aDBc_tab_list = array(
159
+ array("id"=>"aDBc-clean", "title"=>__('Clean Database', 'advanced-db-cleaner')),
160
+ array("id"=>"aDBc-optimize", "title"=>__('Optimize Database', 'advanced-db-cleaner')),
161
+ array("id"=>"aDBc-reset", "title"=>__('Reset Database', 'advanced-db-cleaner'))
162
+ );
163
+ foreach ($aDBc_tab_list as $key => $value){
164
+ $checked = "";
165
+ if($value["id"] == "aDBc-clean"
166
+ || (isset($_POST["aDBc_optimize_form"]) && $value["id"] == "aDBc-optimize")
167
+ || (isset($_POST["aDBc_optimize_schedule_form"]) && $value["id"] == "aDBc-optimize")
168
+ || (isset($_POST["aDBc_reset_form"]) && $value["id"] == "aDBc-reset")){
169
+ $checked = 'checked = "checked"';
170
+ }
171
+ echo '<input '.$checked.' type="radio" id="'.$value["id"].'" name="tabGroup1">'."\n";
172
+ echo '<label for="'.$value["id"].'">'.$value["title"].'</label>'."\n";
173
+ }
174
+ ?>
175
+ <div class="tab1">
176
+ <?php include_once 'includes/clean-db.php'; ?>
177
+ </div>
178
+ <div class="tab2">
179
+ <?php include_once 'includes/optimize-db.php'; ?>
180
+ </div>
181
+ <div class="tab3">
182
+ <?php include_once 'includes/reset-db.php'; ?>
183
+ </div>
184
+ </div>
185
+ <div class="aDBcSidebar">
186
+ <?php include_once 'includes/sidebar.php'; ?>
187
+ </div>
188
+ </div>
189
+ </div>
190
+ <?php
191
+ }
192
+ /***************************************************************
193
+ *
194
+ * Get functions
195
+ *
196
+ ***************************************************************/
197
+ include_once 'includes/functions.php';
198
  ?>
css/style.css CHANGED
@@ -165,15 +165,24 @@ input[type=checkbox] {
165
  margin-top: 20px;
166
  }
167
 
168
- /* boxes in tab to inform users about the current option */
169
- .box-notice{
 
170
  border-radius: 5px;
171
  -moz-border-radius: 5px;
172
  -webkit-border-radius: 5px;
173
- border: 1px solid #eee;
174
- margin-top:40px;
175
- padding:10px;
176
- background:#F4F4F4;
 
 
 
 
 
 
 
 
177
  width:300px;
178
  font-size: 12px;
179
  text-align:justify;
@@ -183,10 +192,15 @@ input[type=checkbox] {
183
  /* For Data already cleaned */
184
  .already-cleaned{
185
  float: left;
186
- background:#c4c4c4;
187
  padding:2px 6px 2px 6px;
188
  border-radius: 8px;
189
- color: #fff;
190
  margin: 2px;
191
  font-size: 11px;
 
 
 
 
 
192
  }
165
  margin-top: 20px;
166
  }
167
 
168
+ /* Top info box */
169
+ .aDBC-topBoxInfo {
170
+ clear:both;
171
  border-radius: 5px;
172
  -moz-border-radius: 5px;
173
  -webkit-border-radius: 5px;
174
+ background: #F0F5FA url("../images/info.png") no-repeat scroll 8px 50%;
175
+ color: #888;
176
+ margin-bottom: 25px;
177
+ padding: 10px 10px 10px 40px;
178
+ max-width: 730px;
179
+ }
180
+
181
+ /* boxes in tab to inform users about the current option */
182
+ .aDBCRightBox{
183
+ padding:20px 0px 20px 0px;
184
+ margin-bottom:5px;
185
+ background:#fff;
186
  width:300px;
187
  font-size: 12px;
188
  text-align:justify;
192
  /* For Data already cleaned */
193
  .already-cleaned{
194
  float: left;
195
+ background:#f4f4f4;
196
  padding:2px 6px 2px 6px;
197
  border-radius: 8px;
198
+ color: #999;
199
  margin: 2px;
200
  font-size: 11px;
201
+ }
202
+
203
+ /* Support us like image */
204
+ .aDBC-supportUs{
205
+ background: url("../images/support.png") no-repeat top right;
206
  }
images/db_clean.png CHANGED
Binary file
images/db_not_clean.png CHANGED
Binary file
images/info.png CHANGED
Binary file
images/support.png ADDED
Binary file
images/warning.png CHANGED
Binary file
includes/clean-db.php CHANGED
@@ -3,20 +3,20 @@
3
  $aDBc_count_unused = adv_db_cleaner_count();
4
  ?>
5
  <div class="marginTop20">
6
- <div style="float: left; margin-right:30px; margin-bottom:40px">
7
  <form action="" method="post">
8
- <table class="widefat" style="width: 400px; border: 0px; box-shadow: 0 1px 0px #ccc;">
9
  <thead style="background:#f0f5fa; border-bottom:1px solid dashed">
10
  <tr>
11
- <th scope="col" style="font-size:13px; border-bottom: 1px dashed #ccc; border-top: 1px solid #eee"><?php _e('Elements to clean','advanced-db-cleaner'); ?></th>
12
- <th scope="col" style="text-align: right; width: 80px; font-size:13px; border-bottom: 1px dashed #ccc; border-top: 1px solid #eee"><?php _e('Count','advanced-db-cleaner'); ?></th>
13
- <th scope="col" style="text-align: right; width: 80px; font-size:13px; border-bottom: 1px dashed #ccc; border-top: 1px solid #eee"><?php _e('Select','advanced-db-cleaner'); ?></th>
14
  </tr>
15
  </thead>
16
  <tbody id="the-list">
17
  <?php
18
  if($aDBc_count_unused["total"] == 0){ ?>
19
- <tr class="alternate">
20
  <td class="column-name" style="color: #999"><?php _e('Nothing to do!','advanced-db-cleaner'); ?></td>
21
  <td class="column-name"></td>
22
  <td class="column-name"></td>
@@ -24,7 +24,7 @@ $aDBc_count_unused = adv_db_cleaner_count();
24
  <?php
25
  } else {
26
  if($aDBc_count_unused["revision"] > 0){ ?>
27
- <tr class="alternate">
28
  <td class="column-name"><?php _e('Revision','advanced-db-cleaner'); ?></td>
29
  <td class="column-name aDBcCount"><?php echo $aDBc_count_unused["revision"]; ?></td>
30
  <td class="column-name">
@@ -37,7 +37,7 @@ $aDBc_count_unused = adv_db_cleaner_count();
37
  <?php
38
  }
39
  if($aDBc_count_unused["draft"] > 0){ ?>
40
- <tr class="alternate">
41
  <td class="column-name"><?php _e('Draft','advanced-db-cleaner'); ?></td>
42
  <td class="column-name aDBcCount"><?php echo $aDBc_count_unused["draft"]; ?></td>
43
  <td class="column-name">
@@ -50,7 +50,7 @@ $aDBc_count_unused = adv_db_cleaner_count();
50
  <?php
51
  }
52
  if($aDBc_count_unused["autodraft"] > 0){ ?>
53
- <tr class="alternate">
54
  <td class="column-name"><?php _e('Auto Draft','advanced-db-cleaner'); ?></td>
55
  <td class="column-name aDBcCount"><?php echo $aDBc_count_unused["autodraft"]; ?></td>
56
  <td class="column-name">
@@ -63,7 +63,7 @@ $aDBc_count_unused = adv_db_cleaner_count();
63
  <?php
64
  }
65
  if($aDBc_count_unused["moderated"] > 0){ ?>
66
- <tr class="alternate">
67
  <td class="column-name"><?php _e('Moderated Comments','advanced-db-cleaner'); ?></td>
68
  <td class="column-name aDBcCount"><?php echo $aDBc_count_unused["moderated"]; ?></td>
69
  <td class="column-name">
@@ -76,7 +76,7 @@ $aDBc_count_unused = adv_db_cleaner_count();
76
  <?php
77
  }
78
  if($aDBc_count_unused["spam"] > 0){ ?>
79
- <tr class="alternate">
80
  <td class="column-name"><?php _e('Spam Comments','advanced-db-cleaner'); ?></td>
81
  <td class="column-name aDBcCount"><?php echo $aDBc_count_unused["spam"]; ?></td>
82
  <td class="column-name">
@@ -89,7 +89,7 @@ $aDBc_count_unused = adv_db_cleaner_count();
89
  <?php
90
  }
91
  if($aDBc_count_unused["trash"] > 0){ ?>
92
- <tr class="alternate">
93
  <td class="column-name"><?php _e('Trash Comments','advanced-db-cleaner'); ?></td>
94
  <td class="column-name aDBcCount"><?php echo $aDBc_count_unused["trash"]; ?></td>
95
  <td class="column-name">
@@ -103,7 +103,7 @@ $aDBc_count_unused = adv_db_cleaner_count();
103
  }
104
 
105
  if($aDBc_count_unused["postmeta"] > 0){ ?>
106
- <tr class="alternate">
107
  <td class="column-name"><?php _e('Orphan Postmeta','advanced-db-cleaner'); ?></td>
108
  <td class="column-name aDBcCount"><?php echo $aDBc_count_unused["postmeta"]; ?></td>
109
  <td class="column-name">
@@ -116,7 +116,7 @@ $aDBc_count_unused = adv_db_cleaner_count();
116
  <?php
117
  }
118
  if($aDBc_count_unused["commentmeta"] > 0){ ?>
119
- <tr class="alternate">
120
  <td class="column-name"><?php _e('Orphan Commentmeta','advanced-db-cleaner'); ?></td>
121
  <td class="column-name aDBcCount"><?php echo $aDBc_count_unused["commentmeta"]; ?></td>
122
  <td class="column-name">
@@ -129,7 +129,7 @@ $aDBc_count_unused = adv_db_cleaner_count();
129
  <?php
130
  }
131
  if($aDBc_count_unused["relationships"] > 0){ ?>
132
- <tr class="alternate">
133
  <td class="column-name"><?php _e('Orphan Relationships','advanced-db-cleaner'); ?></td>
134
  <td class="column-name aDBcCount"><?php echo $aDBc_count_unused["relationships"]; ?></td>
135
  <td class="column-name">
@@ -142,7 +142,7 @@ $aDBc_count_unused = adv_db_cleaner_count();
142
  <?php
143
  }
144
  if($aDBc_count_unused["feed"] > 0){ ?>
145
- <tr class="alternate">
146
  <td class="column-name"><?php _e('Dashboard Transient Feed','advanced-db-cleaner'); ?></td>
147
  <td class="column-name aDBcCount"><?php echo $aDBc_count_unused["feed"]; ?></td>
148
  <td class="column-name">
@@ -158,9 +158,9 @@ $aDBc_count_unused = adv_db_cleaner_count();
158
  </tbody>
159
  <tfoot style="background:#f0f5fa">
160
  <tr>
161
- <th scope="col" style="font-size:13px; border-top: 1px dashed #ccc"><?php _e('Total','advanced-db-cleaner'); ?></th>
162
- <th scope="col" class="aDBcCount" style="border-top: 1px dashed #ccc"><b><?php echo $aDBc_count_unused["total"]; ?></b></th>
163
- <th scope="col" style="border-top: 1px dashed #ccc"></th>
164
  </tr>
165
  </tfoot>
166
  </table>
@@ -170,19 +170,52 @@ $aDBc_count_unused = adv_db_cleaner_count();
170
  </p>
171
  </form>
172
  </div>
173
- <div style="float:left; padding-left:20px; border-left: 1px dashed #ccc; ">
174
- <div style="text-align:center;">
175
  <?php if($aDBc_count_unused["total"] == 0){ ?>
176
  <img src="<?php echo plugins_url() .'/'. dirname(dirname(plugin_basename(__FILE__))) . '/images/db_clean.png'?>"/>
177
  <div style="font-color:#ccc; color: #999; font-family: tahoma">Your database is clean!</div>
178
  <?php } else { ?>
179
  <img src="<?php echo plugins_url() .'/'. dirname(dirname(plugin_basename(__FILE__))) . '/images/db_not_clean.png'?>"/>
180
- <div style="font-color:#ccc; color: #999; font-family: tahoma"><b><?php echo $aDBc_count_unused["total"]; ?></b> element(s) <br/>should be cleaned!</div>
181
  <?php } ?>
182
  </div>
183
- <div class="box-notice">
184
- Cleaning your database helps you saving space by removing unused data. The plugin has detected that the following items are already cleaned:
185
- <div style="margin-top:15px">
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
186
  <?php
187
  if($aDBc_count_unused["revision"] == 0)
188
  echo "<div class='already-cleaned'>". __('Revision','advanced-db-cleaner') ."</div>";
@@ -206,11 +239,6 @@ $aDBc_count_unused = adv_db_cleaner_count();
206
  echo "<div class='already-cleaned'>". __('Dashboard Transient Feed','advanced-db-cleaner') ."</div>";
207
  ?>
208
  <div style="clear:both"></div>
209
- </div>
210
  </div>
211
  </div>
212
- </div>
213
- <?php
214
- //Once we have displayed counts, delete the array to optimize usage of memory.
215
- unset($aDBc_count_unused);
216
- ?>
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
  <form action="" method="post">
8
+ <table class="widefat" style="width: 400px; border: 1px solid #eee; border-radius: 5px; -moz-border-radius: 5px; -webkit-border-radius: 5px; box-shadow: 0 0px 0px #ccc;">
9
  <thead style="background:#f0f5fa; border-bottom:1px solid dashed">
10
  <tr>
11
+ <th scope="col" style="font-size:13px; color:#222; border-bottom: 0px;"><?php _e('Elements to clean','advanced-db-cleaner'); ?></th>
12
+ <th scope="col" style="text-align: right; color:#222; width: 80px; font-size:13px; border-bottom: 0px"><?php _e('Count','advanced-db-cleaner'); ?></th>
13
+ <th scope="col" style="text-align: right; color:#222; width: 80px; font-size:13px; border-bottom: 0px"><?php _e('Select','advanced-db-cleaner'); ?></th>
14
  </tr>
15
  </thead>
16
  <tbody id="the-list">
17
  <?php
18
  if($aDBc_count_unused["total"] == 0){ ?>
19
+ <tr class="">
20
  <td class="column-name" style="color: #999"><?php _e('Nothing to do!','advanced-db-cleaner'); ?></td>
21
  <td class="column-name"></td>
22
  <td class="column-name"></td>
24
  <?php
25
  } else {
26
  if($aDBc_count_unused["revision"] > 0){ ?>
27
+ <tr class="">
28
  <td class="column-name"><?php _e('Revision','advanced-db-cleaner'); ?></td>
29
  <td class="column-name aDBcCount"><?php echo $aDBc_count_unused["revision"]; ?></td>
30
  <td class="column-name">
37
  <?php
38
  }
39
  if($aDBc_count_unused["draft"] > 0){ ?>
40
+ <tr class="">
41
  <td class="column-name"><?php _e('Draft','advanced-db-cleaner'); ?></td>
42
  <td class="column-name aDBcCount"><?php echo $aDBc_count_unused["draft"]; ?></td>
43
  <td class="column-name">
50
  <?php
51
  }
52
  if($aDBc_count_unused["autodraft"] > 0){ ?>
53
+ <tr class="">
54
  <td class="column-name"><?php _e('Auto Draft','advanced-db-cleaner'); ?></td>
55
  <td class="column-name aDBcCount"><?php echo $aDBc_count_unused["autodraft"]; ?></td>
56
  <td class="column-name">
63
  <?php
64
  }
65
  if($aDBc_count_unused["moderated"] > 0){ ?>
66
+ <tr class="">
67
  <td class="column-name"><?php _e('Moderated Comments','advanced-db-cleaner'); ?></td>
68
  <td class="column-name aDBcCount"><?php echo $aDBc_count_unused["moderated"]; ?></td>
69
  <td class="column-name">
76
  <?php
77
  }
78
  if($aDBc_count_unused["spam"] > 0){ ?>
79
+ <tr class="">
80
  <td class="column-name"><?php _e('Spam Comments','advanced-db-cleaner'); ?></td>
81
  <td class="column-name aDBcCount"><?php echo $aDBc_count_unused["spam"]; ?></td>
82
  <td class="column-name">
89
  <?php
90
  }
91
  if($aDBc_count_unused["trash"] > 0){ ?>
92
+ <tr class="">
93
  <td class="column-name"><?php _e('Trash Comments','advanced-db-cleaner'); ?></td>
94
  <td class="column-name aDBcCount"><?php echo $aDBc_count_unused["trash"]; ?></td>
95
  <td class="column-name">
103
  }
104
 
105
  if($aDBc_count_unused["postmeta"] > 0){ ?>
106
+ <tr class="">
107
  <td class="column-name"><?php _e('Orphan Postmeta','advanced-db-cleaner'); ?></td>
108
  <td class="column-name aDBcCount"><?php echo $aDBc_count_unused["postmeta"]; ?></td>
109
  <td class="column-name">
116
  <?php
117
  }
118
  if($aDBc_count_unused["commentmeta"] > 0){ ?>
119
+ <tr class="">
120
  <td class="column-name"><?php _e('Orphan Commentmeta','advanced-db-cleaner'); ?></td>
121
  <td class="column-name aDBcCount"><?php echo $aDBc_count_unused["commentmeta"]; ?></td>
122
  <td class="column-name">
129
  <?php
130
  }
131
  if($aDBc_count_unused["relationships"] > 0){ ?>
132
+ <tr class="">
133
  <td class="column-name"><?php _e('Orphan Relationships','advanced-db-cleaner'); ?></td>
134
  <td class="column-name aDBcCount"><?php echo $aDBc_count_unused["relationships"]; ?></td>
135
  <td class="column-name">
142
  <?php
143
  }
144
  if($aDBc_count_unused["feed"] > 0){ ?>
145
+ <tr class="">
146
  <td class="column-name"><?php _e('Dashboard Transient Feed','advanced-db-cleaner'); ?></td>
147
  <td class="column-name aDBcCount"><?php echo $aDBc_count_unused["feed"]; ?></td>
148
  <td class="column-name">
158
  </tbody>
159
  <tfoot style="background:#f0f5fa">
160
  <tr>
161
+ <th scope="col" style="font-size:13px; font-weight:bold; color:#444; border-top: 0px"><?php _e('Total','advanced-db-cleaner'); ?></th>
162
+ <th scope="col" class="aDBcCount" style="border-top: 0px; font-weight:bold; color:#444;"><b><?php echo $aDBc_count_unused["total"]; ?></b></th>
163
+ <th scope="col" style="border-top: 0px"></th>
164
  </tr>
165
  </tfoot>
166
  </table>
170
  </p>
171
  </form>
172
  </div>
173
+ <div style="float:left; padding-left:25px; border-left: 1px dashed #ccc; ">
174
+ <div style="text-align:center; margin-bottom: 30px">
175
  <?php if($aDBc_count_unused["total"] == 0){ ?>
176
  <img src="<?php echo plugins_url() .'/'. dirname(dirname(plugin_basename(__FILE__))) . '/images/db_clean.png'?>"/>
177
  <div style="font-color:#ccc; color: #999; font-family: tahoma">Your database is clean!</div>
178
  <?php } else { ?>
179
  <img src="<?php echo plugins_url() .'/'. dirname(dirname(plugin_basename(__FILE__))) . '/images/db_not_clean.png'?>"/>
180
+ <div style="font-color:#ccc; color: #999; font-family: tahoma"><b><?php echo $aDBc_count_unused["total"]; ?></b> element(s) should be cleaned!</div>
181
  <?php } ?>
182
  </div>
183
+
184
+ <div class="aDBCRightBox" style="border-bottom: 1px solid #eee">
185
+ <div style="font-weight: bold; padding-bottom:12px; color:#111; font-size:13px">&nbsp;Schedule</div>
186
+ <form action="" method="post">
187
+ <select style="height:30px; font-size:13px; width: 240px" name="aDBc_clean_schedule" id="aDBc_clean_schedule">
188
+ <option value="no_schedule" <?php echo get_option('aDBc_clean_schedule') == 'no_schedule' ? 'selected="selected"' : ''; ?>>
189
+ <?php _e('Not scheduled','advanced-db-cleaner');?>
190
+ </option>
191
+ <option value="hourly" <?php echo get_option('aDBc_clean_schedule') == 'hourly' ? 'selected="selected"' : ''; ?>>
192
+ <?php _e('Run clean-up hourly','advanced-db-cleaner');?>
193
+ </option>
194
+ <option value="twicedaily" <?php echo get_option('aDBc_clean_schedule') == 'twicedaily' ? 'selected="selected"' : ''; ?>>
195
+ <?php _e('Run clean-up twice a day','advanced-db-cleaner');?>
196
+ </option>
197
+ <option value="daily" <?php echo get_option('aDBc_clean_schedule') == 'daily' ? 'selected="selected"' : ''; ?>>
198
+ <?php _e('Run clean-up daily','advanced-db-cleaner');?>
199
+ </option>
200
+ <option value="weekly" <?php echo get_option('aDBc_clean_schedule') == 'weekly' ? 'selected="selected"' : ''; ?>>
201
+ <?php _e('Run clean-up weekly','advanced-db-cleaner');?>
202
+ </option>
203
+ <option value="monthly" <?php echo get_option('aDBc_clean_schedule') == 'monthly' ? 'selected="selected"' : ''; ?>>
204
+ <?php _e('Run clean-up monthly','advanced-db-cleaner');?>
205
+ </option>
206
+ </select>
207
+ <input type="hidden" name="aDBc_clean_schedule_form" value="" />
208
+ <input style="height:30px" type="submit" class="button-primary" value="<?php _e('Save','advanced-db-cleaner'); ?>" />
209
+ </form>
210
+ <div style="padding-top:15px; color:#111;">&nbsp;Next run: <span style="color: green"><?php echo wp_next_scheduled('aDBc_clean_scheduler') == true ? date('Y/m/d H:i:s', wp_next_scheduled('aDBc_clean_scheduler')) : 'Not set'; ?></span></div>
211
+ </div>
212
+
213
+ <div class="aDBCRightBox">
214
+ <div style="font-weight: bold; padding-bottom:5px; color:#111; font-size:13px">&nbsp;Please note that</div>
215
+ <ul style="list-style: disc outside none; padding:0px 10px 0px 10px">
216
+ <li>Cleaning your database helps you saving space by removing unused data.</li>
217
+ <li>The following items are already cleaned:</li>
218
+ </ul>
219
  <?php
220
  if($aDBc_count_unused["revision"] == 0)
221
  echo "<div class='already-cleaned'>". __('Revision','advanced-db-cleaner') ."</div>";
239
  echo "<div class='already-cleaned'>". __('Dashboard Transient Feed','advanced-db-cleaner') ."</div>";
240
  ?>
241
  <div style="clear:both"></div>
 
242
  </div>
243
  </div>
244
+ </div>
 
 
 
 
includes/functions.php CHANGED
@@ -47,6 +47,21 @@ function adv_db_cleaner($type){
47
  }
48
  }
49
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
50
  function adv_db_cleaner_count(){
51
  global $wpdb;
52
  $aDBc_count_total_unused = 0;
47
  }
48
  }
49
 
50
+ function aDBc_cleanAll(){
51
+ global $wpdb;
52
+ $wpdb->query("DELETE FROM $wpdb->posts WHERE post_type = 'revision'");
53
+ $wpdb->query("DELETE FROM $wpdb->posts WHERE post_status = 'draft'");
54
+ $wpdb->query("DELETE FROM $wpdb->posts WHERE post_status = 'auto-draft'");
55
+ $wpdb->query("DELETE FROM $wpdb->comments WHERE comment_approved = '0'");
56
+ $wpdb->query("DELETE FROM $wpdb->comments WHERE comment_approved = 'spam'");
57
+ $wpdb->query("DELETE FROM $wpdb->comments WHERE comment_approved = 'trash'");
58
+ //$adbc_sql = "DELETE FROM $wpdb->postmeta WHERE NOT EXISTS ( SELECT * FROM $wpdb->posts WHERE $wpdb->postmeta.post_id = $wpdb->posts.ID )";
59
+ $wpdb->query("DELETE pm FROM $wpdb->postmeta pm LEFT JOIN $wpdb->posts wp ON wp.ID = pm.post_id WHERE wp.ID IS NULL");
60
+ $wpdb->query("DELETE FROM $wpdb->commentmeta WHERE comment_id NOT IN (SELECT comment_id FROM $wpdb->comments)");
61
+ $wpdb->query("DELETE FROM $wpdb->term_relationships WHERE term_taxonomy_id=1 AND object_id NOT IN (SELECT id FROM $wpdb->posts)");
62
+ $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_%'");
63
+ }
64
+
65
  function adv_db_cleaner_count(){
66
  global $wpdb;
67
  $aDBc_count_total_unused = 0;
includes/optimize-db.php CHANGED
@@ -1,11 +1,11 @@
1
  <div class="marginTop20">
2
- <div style="float: left; margin-right:30px; margin-bottom:40px">
3
  <form action="" method="post">
4
- <table class="widefat" style="width: 400px; border: 0px; box-shadow: 0 1px 0px #ccc;">
5
  <thead style="background:#f0f5fa; border-bottom:1px solid dashed">
6
  <tr>
7
- <th scope="col" style="font-size:13px; border-bottom: 1px dashed #ccc; border-top: 1px solid #eee"><?php _e('Tables to optimize','advanced-db-cleaner'); ?></th>
8
- <th scope="col" style="text-align: right; width: 80px; font-size:13px; border-bottom: 1px dashed #ccc; border-top: 1px solid #eee"><?php _e('Lost space','advanced-db-cleaner'); ?></th>
9
  </tr>
10
  </thead>
11
  <tbody id="the-list">
@@ -20,15 +20,15 @@
20
  if($row->Data_free > 0){
21
  $total_tables_to_optimize += 1;
22
  $total_lost += $row->Data_free;
23
- echo "<tr class='alternate'>
24
  <td class='column-name'>". $row->Name ."</td>
25
  <td class='column-name' style='text-align:right'>". $row->Data_free . ' o' ."</td>
26
  </tr>\n";
27
  }
28
  }
29
-
30
  if($total_lost == 0){
31
- echo "<tr class='alternate'>
32
  <td class='column-name' style='color: #999'>". __('Nothing to do!','advanced-db-cleaner') ."</td>
33
  <td class='column-name'></td></tr>";
34
  }
@@ -36,8 +36,8 @@
36
  </tbody>
37
  <tfoot style="background:#f0f5fa">
38
  <tr>
39
- <th scope="col" style="font-size:13px; border-top: 1px dashed #ccc"><?php _e('Total','advanced-db-cleaner'); ?></th>
40
- <th scope="col" class="aDBcCount" style="border-top: 1px dashed #ccc"><b><?php echo $total_lost .'</b> o'; ?></th>
41
  </tr>
42
  </tfoot>
43
  </table>
@@ -47,21 +47,52 @@
47
  </p>
48
  </form>
49
  </div>
50
- <div style="float:left; padding-left:20px; border-left: 1px dashed #ccc; ">
51
- <div style="text-align:center;">
52
  <?php if($total_lost == 0){ ?>
53
  <img src="<?php echo plugins_url() .'/'. dirname(dirname(plugin_basename(__FILE__))) . '/images/db_clean.png'?>"/>
54
  <div style="font-color:#ccc; color: #999; font-family: tahoma">Your database is optimized!</div>
55
  <?php } else { ?>
56
  <img src="<?php echo plugins_url() .'/'. dirname(dirname(plugin_basename(__FILE__))) . '/images/db_not_clean.png'?>"/>
57
- <div style="font-color:#ccc; color: #999; font-family: tahoma"><b><?php echo $total_tables_to_optimize; ?></b> table(s) <br/>should be optimized!</div>
58
  <?php } ?>
59
  </div>
60
- <div class="box-notice">
61
- <ul style="list-style: square outside none; padding:0px 10px 0px 10px">
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
62
  <li>"Optimizing" reduces storage space and improves efficiency when accessing your tables.</li>
63
  <li>Except tables listed in the table above, all your other tables are already optimized.</li>
64
- <li>Please note that is not necessary to run the optimization frequently, just do it from time to time.</li>
65
  </ul>
66
  </div>
67
  </div>
1
  <div class="marginTop20">
2
+ <div style="float: left; margin-right:25px; margin-bottom:40px">
3
  <form action="" method="post">
4
+ <table class="widefat" style="width: 400px; border: 1px solid #eee; border-radius: 5px; -moz-border-radius: 5px; -webkit-border-radius: 5px; box-shadow: 0 0px 0px #ccc;">
5
  <thead style="background:#f0f5fa; border-bottom:1px solid dashed">
6
  <tr>
7
+ <th scope="col" style="font-size:13px; color:#222; border-bottom: 0px;"><?php _e('Tables to optimize','advanced-db-cleaner'); ?></th>
8
+ <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>
9
  </tr>
10
  </thead>
11
  <tbody id="the-list">
20
  if($row->Data_free > 0){
21
  $total_tables_to_optimize += 1;
22
  $total_lost += $row->Data_free;
23
+ echo "<tr class=''>
24
  <td class='column-name'>". $row->Name ."</td>
25
  <td class='column-name' style='text-align:right'>". $row->Data_free . ' o' ."</td>
26
  </tr>\n";
27
  }
28
  }
29
+
30
  if($total_lost == 0){
31
+ echo "<tr class=''>
32
  <td class='column-name' style='color: #999'>". __('Nothing to do!','advanced-db-cleaner') ."</td>
33
  <td class='column-name'></td></tr>";
34
  }
36
  </tbody>
37
  <tfoot style="background:#f0f5fa">
38
  <tr>
39
+ <th scope="col" style="font-size:13px; font-weight:bold; color:#444; border-top: 0px"><?php _e('Total','advanced-db-cleaner'); ?></th>
40
+ <th scope="col" class="aDBcCount" style="border-top: 0px"><b><?php echo $total_lost .'</b> o'; ?></th>
41
  </tr>
42
  </tfoot>
43
  </table>
47
  </p>
48
  </form>
49
  </div>
50
+ <div style="float:left; padding-left:25px; border-left: 1px dashed #ccc; ">
51
+ <div style="text-align:center; margin-bottom: 30px">
52
  <?php if($total_lost == 0){ ?>
53
  <img src="<?php echo plugins_url() .'/'. dirname(dirname(plugin_basename(__FILE__))) . '/images/db_clean.png'?>"/>
54
  <div style="font-color:#ccc; color: #999; font-family: tahoma">Your database is optimized!</div>
55
  <?php } else { ?>
56
  <img src="<?php echo plugins_url() .'/'. dirname(dirname(plugin_basename(__FILE__))) . '/images/db_not_clean.png'?>"/>
57
+ <div style="font-color:#ccc; color: #999; font-family: tahoma"><b><?php echo $total_tables_to_optimize; ?></b> table(s) should be optimized!</div>
58
  <?php } ?>
59
  </div>
60
+
61
+ <div class="aDBCRightBox" style="border-bottom: 1px solid #eee">
62
+ <div style="font-weight: bold; padding-bottom:12px; color:#111; font-size:13px">&nbsp;Schedule</div>
63
+ <form action="" method="post">
64
+ <select style="height:30px; width: 240px; font-size:13px" name="aDBc_optimize_schedule" id="aDBc_optimize_schedule">
65
+ <option value="no_schedule" <?php echo get_option('aDBc_optimize_schedule') == 'no_schedule' ? 'selected="selected"' : ''; ?>>
66
+ <?php _e('Not scheduled','advanced-db-cleaner');?>
67
+ </option>
68
+ <option value="hourly" <?php echo get_option('aDBc_optimize_schedule') == 'hourly' ? 'selected="selected"' : ''; ?>>
69
+ <?php _e('Run optimization hourly','advanced-db-cleaner');?>
70
+ </option>
71
+ <option value="twicedaily" <?php echo get_option('aDBc_optimize_schedule') == 'twicedaily' ? 'selected="selected"' : ''; ?>>
72
+ <?php _e('Run optimization twice a day','advanced-db-cleaner');?>
73
+ </option>
74
+ <option value="daily" <?php echo get_option('aDBc_optimize_schedule') == 'daily' ? 'selected="selected"' : ''; ?>>
75
+ <?php _e('Run optimization daily','advanced-db-cleaner');?>
76
+ </option>
77
+ <option value="weekly" <?php echo get_option('aDBc_optimize_schedule') == 'weekly' ? 'selected="selected"' : ''; ?>>
78
+ <?php _e('Run optimization weekly','advanced-db-cleaner');?>
79
+ </option>
80
+ <option value="monthly" <?php echo get_option('aDBc_optimize_schedule') == 'monthly' ? 'selected="selected"' : ''; ?>>
81
+ <?php _e('Run optimization monthly','advanced-db-cleaner');?>
82
+ </option>
83
+ </select>
84
+ <input type="hidden" name="aDBc_optimize_schedule_form" value="" />
85
+ <input style="height:30px" type="submit" class="button-primary" value="<?php _e('Save','advanced-db-cleaner'); ?>" />
86
+ </form>
87
+ <div style="padding-top:15px; color:#111">&nbsp;Next run: <span style="color: green"><?php echo wp_next_scheduled('aDBc_optimize_scheduler') == true ? date('Y/m/d H:i:s', wp_next_scheduled('aDBc_optimize_scheduler')) : 'Not set'; ?></span></div>
88
+ </div>
89
+
90
+ <div class="aDBCRightBox">
91
+ <div style="font-weight: bold; padding-bottom:5px; color:#111; font-size:13px">&nbsp;Please note that</div>
92
+ <ul style="list-style: disc outside none; padding:0px 10px 0px 10px">
93
  <li>"Optimizing" reduces storage space and improves efficiency when accessing your tables.</li>
94
  <li>Except tables listed in the table above, all your other tables are already optimized.</li>
95
+ <li>It is not necessary to run the optimization frequently, just do it from time to time.</li>
96
  </ul>
97
  </div>
98
  </div>
includes/reset-db.php CHANGED
@@ -29,4 +29,4 @@ if (!isset($aDBc_admin->user_login ) || $aDBc_admin->user_level < 10 ){
29
  <p class="submit">
30
  <input type="submit" class="button-primary" value="Reset database" style="width: 130px; height: 50px; text-align:center; font-weight:bold"/>
31
  </p>
32
- </form>
29
  <p class="submit">
30
  <input type="submit" class="button-primary" value="Reset database" style="width: 130px; height: 50px; text-align:center; font-weight:bold"/>
31
  </p>
32
+ </form>
includes/sidebar.php CHANGED
@@ -1,6 +1,6 @@
1
  <div>
2
  <center><h2>Advanced Database Cleaner</h2></center>
3
- <!--<p>See what is new in <a href="#">version 4.3.9</a></p>-->
4
 
5
  <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>
6
  <p style="text-align:right"><?php _e('Thank you!', 'advanced-db-cleaner'); ?></p>
@@ -18,8 +18,26 @@
18
  <img alt="" border="0" src="https://www.paypalobjects.com/fr_XC/i/scr/pixel.gif" width="1" height="1">
19
  </form>
20
  </center>
 
 
 
 
 
 
 
 
 
21
 
 
 
 
 
 
 
 
 
22
  </div>
23
- <div style="background: #1A9AC9; border-top: 1px solid #ccc; text-align: center; color: #fff">
 
24
  &copy; <?php echo date("Y") . " " . __('Created by', 'advanced-db-cleaner') . " <b>Younes JFR</b>"; ?>
25
  </div>
1
  <div>
2
  <center><h2>Advanced Database Cleaner</h2></center>
3
+ <!--<p>See what is new in <a href="#">version 1.2.2</a></p>-->
4
 
5
  <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>
6
  <p style="text-align:right"><?php _e('Thank you!', 'advanced-db-cleaner'); ?></p>
18
  <img alt="" border="0" src="https://www.paypalobjects.com/fr_XC/i/scr/pixel.gif" width="1" height="1">
19
  </form>
20
  </center>
21
+ </div>
22
+
23
+ <div style="height: 35px; background-color:#f9f9f9;">
24
+ <a style="text-decoration: none" href="https://wordpress.org/support/view/plugin-reviews/advanced-database-cleaner#postform">
25
+ <div class="aDBC-supportUs" style="width:250px; height:35px; padding-top:10px">
26
+ <span style="font-size: 13px; color:#777"><?php echo __('Please support us', 'advanced-db-cleaner'); ?></span>
27
+ </div>
28
+ </a>
29
+ </div>
30
 
31
+ <div style="text-align:center; height: 20px; clear:both;">
32
+ <div style="float:left">
33
+ <span style="font-size: 13px; color:#777"><?php echo __('Having any issues?', 'advanced-db-cleaner'); ?></span>
34
+
35
+ </div>
36
+ <div style="float:right">
37
+ <a style="text-decoration: none" href="https://wordpress.org/support/plugin/advanced-database-cleaner"><?php echo __('Create a ticket', 'advanced-db-cleaner'); ?></a>
38
+ </div>
39
  </div>
40
+
41
+ <div style="text-align: center; color: #000; font-size:12px; border-top:1px dashed #ccc">
42
  &copy; <?php echo date("Y") . " " . __('Created by', 'advanced-db-cleaner') . " <b>Younes JFR</b>"; ?>
43
  </div>
screenshot-1.png CHANGED
Binary file
screenshot-2.png CHANGED
Binary file
screenshot-3.png CHANGED
Binary file
screenshot-4.png CHANGED
Binary file