Advanced Database Cleaner - Version 3.0.0

Version Description

Known issues have been fixed in both free and pro versions (timeout error, activation, scheduled tasks...) New features have been added (new items to cleanup, filter & sort items...) Readme.txt file updated.

Download this release

Release Info

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

Code changes from version 2.0.0 to 3.0.0

Files changed (75) hide show
  1. LICENSE.txt +85 -0
  2. README.txt +171 -62
  3. advanced-db-cleaner.php +687 -252
  4. css/admin.css +510 -152
  5. images/add_schedule.svg +6 -0
  6. images/alarm-clock.svg +11 -0
  7. images/alert.svg +1 -0
  8. images/alert_delete.svg +1 -0
  9. images/check_ok.png +0 -0
  10. images/check_ok.svg +4 -0
  11. images/db_clean.png +0 -0
  12. images/db_clean.svg +2 -0
  13. images/db_not_clean.png +0 -0
  14. images/donate.gif +0 -0
  15. images/edit_schedule.svg +4 -0
  16. images/go_back.png +0 -0
  17. images/go_back.svg +2 -0
  18. images/green_clock.svg +7 -0
  19. images/grey_clock.svg +7 -0
  20. images/help.svg +70 -0
  21. images/icon-128x128.png +0 -0
  22. images/info.png +0 -0
  23. images/info.svg +4 -0
  24. images/information.svg +54 -0
  25. images/information2.svg +48 -0
  26. images/loading20px.svg +1 -0
  27. images/loading_img.gif +0 -0
  28. images/nothing_to_see.png +0 -0
  29. images/nothing_to_see.svg +4 -0
  30. images/notice.png +0 -0
  31. images/premium.svg +1 -0
  32. images/rate.png +0 -0
  33. images/search-icon.png +0 -0
  34. images/search-icon.svg +6 -0
  35. images/see.png +0 -0
  36. images/see.svg +12 -0
  37. images/small_warning.png +0 -0
  38. images/switch-off.svg +8 -0
  39. images/switch-on.svg +5 -0
  40. images/warning.png +0 -0
  41. images/warning.svg +2 -0
  42. includes/class_clean_cron.php +237 -83
  43. includes/class_clean_options.php +260 -77
  44. includes/class_clean_tables.php +479 -75
  45. includes/class_general_cleanup.php +243 -68
  46. includes/class_optimize_tables.php +0 -294
  47. includes/clean_db.php +44 -15
  48. includes/custom-clean-view/class_clean_comment.php +195 -39
  49. includes/custom-clean-view/class_clean_commentmeta.php +0 -136
  50. includes/custom-clean-view/class_clean_dashboard_transient_feed.php +0 -136
  51. includes/custom-clean-view/class_clean_draft_trash.php +0 -150
  52. includes/custom-clean-view/class_clean_meta_comment_post_user_term.php +291 -0
  53. includes/custom-clean-view/class_clean_postmeta.php +0 -136
  54. includes/custom-clean-view/class_clean_relationships.php +145 -42
  55. includes/custom-clean-view/class_clean_revision.php +0 -136
  56. includes/custom-clean-view/class_clean_revision_draft_trash.php +285 -0
  57. includes/custom-clean-view/class_clean_transient.php +318 -0
  58. includes/custom-clean-view/header_page_custom_clean.php +90 -0
  59. includes/custom-clean-view/page_custom_clean.php +35 -0
  60. includes/custom-schedule-view/class_add_cleanup_schedule.php +328 -0
  61. includes/custom-schedule-view/class_add_optimize_schedule.php +211 -0
  62. includes/custom-schedule-view/class_edit_cleanup_schedule.php +371 -0
  63. includes/custom-schedule-view/class_edit_optimize_schedule.php +257 -0
  64. includes/functions.php +1010 -119
  65. includes/header_page_filter.php +173 -0
  66. includes/license/ADBC_EDD_SL_Plugin_Updater.php +572 -0
  67. includes/license/adbc-edd-sample-plugin.php +379 -0
  68. includes/optimize_db.php +22 -0
  69. includes/overview_settings.php +79 -25
  70. includes/premium_page.php +7 -7
  71. includes/sidebar.php +34 -39
  72. index.php +1 -1
  73. js/admin.js +173 -5
  74. languages/advanced-database-cleaner.pot +1565 -0
  75. languages/advanced-db-cleaner.pot +0 -881
LICENSE.txt ADDED
@@ -0,0 +1,85 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ GNU GENERAL PUBLIC LICENSE
2
+ Version 2, June 1991
3
+
4
+ Copyright (C) 1989, 1991 Free Software Foundation, Inc.
5
+ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
6
+
7
+ Everyone is permitted to copy and distribute verbatim copies
8
+ of this license document, but changing it is not allowed.
9
+
10
+ Preamble
11
+
12
+ The licenses for most software are designed to take away your freedom to share and change it. By contrast, the GNU General Public License is intended to guarantee your freedom to share and change free software--to make sure the software is free for all its users. This General Public License applies to most of the Free Software Foundation's software and to any other program whose authors commit to using it. (Some other Free Software Foundation software is covered by the GNU Lesser General Public License instead.) You can apply it to your programs, too.
13
+
14
+ When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for this service if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs; and that you know you can do these things.
15
+
16
+ To protect your rights, we need to make restrictions that forbid anyone to deny you these rights or to ask you to surrender the rights. These restrictions translate to certain responsibilities for you if you distribute copies of the software, or if you modify it.
17
+
18
+ For example, if you distribute copies of such a program, whether gratis or for a fee, you must give the recipients all the rights that you have. You must make sure that they, too, receive or can get the source code. And you must show them these terms so they know their rights.
19
+
20
+ We protect your rights with two steps: (1) copyright the software, and (2) offer you this license which gives you legal permission to copy, distribute and/or modify the software.
21
+
22
+ Also, for each author's protection and ours, we want to make certain that everyone understands that there is no warranty for this free software. If the software is modified by someone else and passed on, we want its recipients to know that what they have is not the original, so that any problems introduced by others will not reflect on the original authors' reputations.
23
+
24
+ Finally, any free program is threatened constantly by software patents. We wish to avoid the danger that redistributors of a free program will individually obtain patent licenses, in effect making the program proprietary. To prevent this, we have made it clear that any patent must be licensed for everyone's free use or not licensed at all.
25
+
26
+ The precise terms and conditions for copying, distribution and modification follow.
27
+ TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
28
+
29
+ 0. This License applies to any program or other work which contains a notice placed by the copyright holder saying it may be distributed under the terms of this General Public License. The "Program", below, refers to any such program or work, and a "work based on the Program" means either the Program or any derivative work under copyright law: that is to say, a work containing the Program or a portion of it, either verbatim or with modifications and/or translated into another language. (Hereinafter, translation is included without limitation in the term "modification".) Each licensee is addressed as "you".
30
+
31
+ Activities other than copying, distribution and modification are not covered by this License; they are outside its scope. The act of running the Program is not restricted, and the output from the Program is covered only if its contents constitute a work based on the Program (independent of having been made by running the Program). Whether that is true depends on what the Program does.
32
+
33
+ 1. You may copy and distribute verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice and disclaimer of warranty; keep intact all the notices that refer to this License and to the absence of any warranty; and give any other recipients of the Program a copy of this License along with the Program.
34
+
35
+ You may charge a fee for the physical act of transferring a copy, and you may at your option offer warranty protection in exchange for a fee.
36
+
37
+ 2. You may modify your copy or copies of the Program or any portion of it, thus forming a work based on the Program, and copy and distribute such modifications or work under the terms of Section 1 above, provided that you also meet all of these conditions:
38
+
39
+ a) You must cause the modified files to carry prominent notices stating that you changed the files and the date of any change.
40
+ b) You must cause any work that you distribute or publish, that in whole or in part contains or is derived from the Program or any part thereof, to be licensed as a whole at no charge to all third parties under the terms of this License.
41
+ c) If the modified program normally reads commands interactively when run, you must cause it, when started running for such interactive use in the most ordinary way, to print or display an announcement including an appropriate copyright notice and a notice that there is no warranty (or else, saying that you provide a warranty) and that users may redistribute the program under these conditions, and telling the user how to view a copy of this License. (Exception: if the Program itself is interactive but does not normally print such an announcement, your work based on the Program is not required to print an announcement.)
42
+
43
+ These requirements apply to the modified work as a whole. If identifiable sections of that work are not derived from the Program, and can be reasonably considered independent and separate works in themselves, then this License, and its terms, do not apply to those sections when you distribute them as separate works. But when you distribute the same sections as part of a whole which is a work based on the Program, the distribution of the whole must be on the terms of this License, whose permissions for other licensees extend to the entire whole, and thus to each and every part regardless of who wrote it.
44
+
45
+ Thus, it is not the intent of this section to claim rights or contest your rights to work written entirely by you; rather, the intent is to exercise the right to control the distribution of derivative or collective works based on the Program.
46
+
47
+ In addition, mere aggregation of another work not based on the Program with the Program (or with a work based on the Program) on a volume of a storage or distribution medium does not bring the other work under the scope of this License.
48
+
49
+ 3. You may copy and distribute the Program (or a work based on it, under Section 2) in object code or executable form under the terms of Sections 1 and 2 above provided that you also do one of the following:
50
+
51
+ a) Accompany it with the complete corresponding machine-readable source code, which must be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or,
52
+ b) Accompany it with a written offer, valid for at least three years, to give any third party, for a charge no more than your cost of physically performing source distribution, a complete machine-readable copy of the corresponding source code, to be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or,
53
+ c) Accompany it with the information you received as to the offer to distribute corresponding source code. (This alternative is allowed only for noncommercial distribution and only if you received the program in object code or executable form with such an offer, in accord with Subsection b above.)
54
+
55
+ The source code for a work means the preferred form of the work for making modifications to it. For an executable work, complete source code means all the source code for all modules it contains, plus any associated interface definition files, plus the scripts used to control compilation and installation of the executable. However, as a special exception, the source code distributed need not include anything that is normally distributed (in either source or binary form) with the major components (compiler, kernel, and so on) of the operating system on which the executable runs, unless that component itself accompanies the executable.
56
+
57
+ If distribution of executable or object code is made by offering access to copy from a designated place, then offering equivalent access to copy the source code from the same place counts as distribution of the source code, even though third parties are not compelled to copy the source along with the object code.
58
+
59
+ 4. You may not copy, modify, sublicense, or distribute the Program except as expressly provided under this License. Any attempt otherwise to copy, modify, sublicense or distribute the Program is void, and will automatically terminate your rights under this License. However, parties who have received copies, or rights, from you under this License will not have their licenses terminated so long as such parties remain in full compliance.
60
+
61
+ 5. You are not required to accept this License, since you have not signed it. However, nothing else grants you permission to modify or distribute the Program or its derivative works. These actions are prohibited by law if you do not accept this License. Therefore, by modifying or distributing the Program (or any work based on the Program), you indicate your acceptance of this License to do so, and all its terms and conditions for copying, distributing or modifying the Program or works based on it.
62
+
63
+ 6. Each time you redistribute the Program (or any work based on the Program), the recipient automatically receives a license from the original licensor to copy, distribute or modify the Program subject to these terms and conditions. You may not impose any further restrictions on the recipients' exercise of the rights granted herein. You are not responsible for enforcing compliance by third parties to this License.
64
+
65
+ 7. If, as a consequence of a court judgment or allegation of patent infringement or for any other reason (not limited to patent issues), conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot distribute so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not distribute the Program at all. For example, if a patent license would not permit royalty-free redistribution of the Program by all those who receive copies directly or indirectly through you, then the only way you could satisfy both it and this License would be to refrain entirely from distribution of the Program.
66
+
67
+ If any portion of this section is held invalid or unenforceable under any particular circumstance, the balance of the section is intended to apply and the section as a whole is intended to apply in other circumstances.
68
+
69
+ It is not the purpose of this section to induce you to infringe any patents or other property right claims or to contest validity of any such claims; this section has the sole purpose of protecting the integrity of the free software distribution system, which is implemented by public license practices. Many people have made generous contributions to the wide range of software distributed through that system in reliance on consistent application of that system; it is up to the author/donor to decide if he or she is willing to distribute software through any other system and a licensee cannot impose that choice.
70
+
71
+ This section is intended to make thoroughly clear what is believed to be a consequence of the rest of this License.
72
+
73
+ 8. If the distribution and/or use of the Program is restricted in certain countries either by patents or by copyrighted interfaces, the original copyright holder who places the Program under this License may add an explicit geographical distribution limitation excluding those countries, so that distribution is permitted only in or among countries not thus excluded. In such case, this License incorporates the limitation as if written in the body of this License.
74
+
75
+ 9. The Free Software Foundation may publish revised and/or new versions of the General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns.
76
+
77
+ Each version is given a distinguishing version number. If the Program specifies a version number of this License which applies to it and "any later version", you have the option of following the terms and conditions either of that version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of this License, you may choose any version ever published by the Free Software Foundation.
78
+
79
+ 10. If you wish to incorporate parts of the Program into other free programs whose distribution conditions are different, write to the author to ask for permission. For software which is copyrighted by the Free Software Foundation, write to the Free Software Foundation; we sometimes make exceptions for this. Our decision will be guided by the two goals of preserving the free status of all derivatives of our free software and of promoting the sharing and reuse of software generally.
80
+
81
+ NO WARRANTY
82
+
83
+ 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
84
+
85
+ 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
README.txt CHANGED
@@ -1,86 +1,181 @@
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
 
57
- This section describes how to install the plugin and get it working.
 
 
 
 
 
 
 
58
 
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
@@ -88,7 +183,7 @@ This section describes how to install the plugin and get it working.
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
@@ -160,6 +255,9 @@ This section describes how to install the plugin and get it working.
160
 
161
  == Upgrade Notice ==
162
 
 
 
 
163
  = 2.0.0 =
164
  New release.
165
 
@@ -169,59 +267,70 @@ New release.
169
  As you use WordPress, your database accumulates a lot of extra data such as revisions, spam comments, trashed comments, etc. Removing this unnecessary data will reduce your database size, speeds up your backup process and speeds up your site also.
170
 
171
  = Is it safe to clean my database? =
172
- Yes, it is. We do not run any code that can break down your site or delete your posts, pages, comments, etc. However, we advise you to make a database backup before cleaning. It is always better to be safe than sorry.
173
 
174
  = What does mean "Optimize my database"? =
175
  Optimizing your database will reclaim unused space in your tables, which will reduce storage space and improve efficiency when accessing tables. Optimizing the database can sometimes significantly improve performance, particularly on sites that receive a lot of traffic or have a large amount of content. Optimizing your database is absolutely safe.
176
 
177
  = Is it safe to clean the cron (scheduled tasks)? =
178
- A scheduled task enables plugins to execute some actions at specified times, without having to manually execute code at that time. Wordpress itself uses some scheduled tasks to perform some regular actions. However, some scheduled tasks may not be removed even if the responsible plugins are deleted from your wordpress installation. As you know, not all plugins care about the housekeeping of your wordpress. Hence, deleting these unnecessary tasks may help in cleaning your site. It should be noted that cleaning scheduled tasks is safe as long as you know what tasks to clean. If your are not sure, it is better to not clean any task.
179
 
180
  = What does mean "Revision"? What sql code is used to clean it? =
181
  WordPress stores a record (called "revision") of each saved draft or published update. This system allows you to see what changes were made in each post and page over time. However, this can lead to a lot of unnecessary overhead in your WordPress database, which consumes a lot of space. The sql query used by the plugin to clean all revisions is:
182
  `DELETE FROM posts WHERE post_type = 'revision'`
183
 
184
- = What does mean "Draft"? What sql code is used to clean it? =
185
- WordPress allows you to save a post or a page without having to publish it immediately. This way you can work on it as much as you want and publish it only when it is ready. This is called a Draft. Over time, you could have multiple drafts that you will never publish and hence you can clean them. The sql query used by the plugin to clean all drafts is:
186
- `DELETE FROM posts WHERE post_status = 'draft'`
187
-
188
  = What does mean "Auto-draft"? What sql code is used to clean it? =
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? =
197
- It is a comment that you (or a plugin) have marked as a spam. The sql query used by the plugin to clean all spam comments is:
198
  `DELETE FROM comments WHERE comment_approved = 'spam'`
199
 
200
  = What does mean "Trash comment"? What sql code is used to clean it? =
201
  A trash comment is a comment that you have deleted from your Wordpress and have been moved to the trash. A trash comment is not visible in your site and should be deleted forever. The sql query used by the plugin to clean all trash comments is:
202
  `DELETE FROM comments WHERE comment_approved = 'trash'`
203
 
 
 
 
 
 
 
 
 
204
  = What does mean "Orphan post meta"? What sql code is used to clean it? =
205
- The post meta data is the information you provide to viewers about each post. This information usually includes the author of the post, when it was written (or posted), and how the author categorized that particular post. In some cases, some post meta data information become orphan and do not belong to any post. They are then called "orphan postmeta" and should be cleaned since they are not useful. The sql query used by the plugin to clean all orphan postmeta is:
206
  `DELETE pm FROM postmeta pm LEFT JOIN posts wp ON wp.ID = pm.post_id WHERE wp.ID IS NULL`
207
 
208
  = What does mean "Orphan comment meta"? What sql code is used to clean it? =
209
  The same as "Orphan post meta" with the exception that "orphan comment meta" concern comments and not posts. The sql query used by the plugin to clean all orphan comment meta is:
210
  `DELETE FROM commentmeta WHERE comment_id NOT IN (SELECT comment_id FROM comments)`
211
 
 
 
 
 
 
 
 
 
212
  = What does mean "Orphan relationships"? What sql code is used to clean it? =
213
  Sometimes the wp_term_relationships table becomes bloated with many orphaned relationships. This happens particularly often if you’re using your site not as a blog but as some other type of content site where posts are deleted periodically. Over time, you could get thousands of term relationships for posts that no longer exist which consumes a lot of database space. The sql query used by the plugin to clean all orphan relationships is:
214
  `DELETE FROM term_relationships WHERE term_taxonomy_id=1 AND object_id NOT IN (SELECT id FROM posts)`
215
 
216
- = What does mean "Dashboard transient feed"? What sql code is used to clean it? =
217
- Transient are a way for storing cached data temporarily in your database by given it a name and a timeframe after which it will expire and be deleted. The sql query used by the plugin to clean dashboard transient feed is:
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.
1
  === Advanced Database Cleaner ===
2
  Contributors: symptote
3
  Donate Link: https://www.sigmaplugin.com/donation
4
+ Tags: clean, clean up, cleanup, database, optimize, performance, speed, optimizing, clean-up, orphan, orphaned, tables, options
5
  Requires at least: 3.1.0
6
+ Requires PHP: 5.0
7
+ Tested up to: 5.4
8
+ Stable tag: 3.0.0
9
  License: GPLv2 or later
10
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
11
 
12
+ Clean database by deleting orphaned data such as 'revisions', 'expired transients', optimize database and more...
13
 
14
  == Description ==
 
15
 
16
+ Clean up database by deleting orphaned items such as 'old revisions', 'spam comments', optimize database and more...
17
+
18
+ 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 makes your site sluggish and bloated such as old revisions, orphaned post meta, spam comments, etc. You should clean-up this unnecessary data to reduce your database size and improve website speed and performance. In addition, you will have quicker database backup since the file of your backup will be smaller.
19
 
20
  'Advanced Database Cleaner' is a must-have plugin that allows you to clean database, optimize database and more.
21
 
22
  = Main Features =
23
+
24
  * Delete old revisions of posts and pages
 
25
  * Delete old auto drafts
26
+ * Delete trash posts
27
  * Delete pending comments
28
  * Delete spam comments
29
  * Delete trash comments
30
+ * Delete pingbacks
31
+ * Delete trackbacks
32
+ * Delete orphan post metadata
33
+ * Delete orphan comment metadata
34
+ * Delete orphan user metadata
35
+ * Delete orphan term metadata
36
  * Delete orphan relationships
37
+ * Delete expired transients
38
+ * Display and view orphaned information before making a database clean-up so you can be sure about what you are going to clean-up
39
+ * Search & filter all items based on their names or values
40
+ * Keep last x days' data from being cleaned: clean only data older than the number of days you have specified
41
+ * Schedule database clean up to run automatically
42
+ * Create as many scheduled cleanup tasks as you need and specify what items should be cleaned by the scheduled task
43
+ * Scheduled tasks can be executed based on several frequencies: Once, hourly, twice a day, daily, weekly or monthly
44
+ * Display database tables information such as the number of rows, table size, etc.
45
+ * Optimize database tables (The plugin will notify you if any tables require optimization)
46
+ * Repair corrupted database tables or damaged ones (The plugin will notify you if any tables are corrupted or damaged)
47
+ * Schedule database optimization and/or reparation to run automatically and specify what tables should be optimized and/or repaired
48
+ * Empty database tables rows
49
+ * Clean and delete database tables
50
+ * Display options list
51
+ * Display options information such as option name, option value, option size, option autoload
52
+ * Clean and delete options
53
+ * Set options autoload to no / yes
54
+ * Display active cron tasks list (scheduled tasks) with their information such as arguments, next run, etc.
55
+ * Clean and delete scheduled tasks
56
+ * User-friendly and simple to use
57
+
58
+ = Multisite Support =
59
+
60
+ * The plugin is compatible with Multisite installations
61
+ * 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
62
+ * You can clean up all sites from one place (the main site). You can also specify specific sites you want to cleanup
63
+
64
+ = By using the ADC plugin, you will =
65
+
66
+ * <strong>Get and overview:</strong> The plugin will help you get an overview of what is happening in your database. It will report all unused/orphaned items that should be cleaned, it will give you the number of tables/options/tasks you have, etc. This way, you can control your database if anything goes wrong
67
+
68
+ * <strong>Save time:</strong> You can specify what items should be cleaned/optimized/repaired, what is the number of days' data to keep and the cleanup/optimization/reparation frequency. The plugin will then automate the process to run automatically based on your settings
69
+
70
+ * <strong>Save space:</strong> By deleting unused/orphaned items, you will save space in your database and make quicker backups since the file of your backup will be smaller
71
 
72
  = Pro Features (<a href="https://sigmaplugin.com/downloads/wordpress-advanced-database-cleaner">Official website</a>) =
73
+ 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:
74
 
75
+ * Classify options according to their "creator". They can be either: plugins options, themes options or WP core options
76
+ * Detect and delete orphan options. Your 'wp_options' table may be full of orphaned options and therefore can impact the performance of loading data from it, which may lead to a slow website. Clean up orphaned options is then important
77
+ * Classify tables according to their "creator". They can be either: plugins tables, themes tables or WP core tables
78
+ * Detect and delete orphan tables. As for options, you may also have some orphaned tables that were created by plugins/themes you are not using anymore. Clean up orphaned tables will decrease the size of your database
 
79
  * Classify all cron tasks (cron jobs) according to their "creator". They can be either: plugins cron tasks, themes cron tasks or WP core tasks
80
+ * Detect and delete orphan cron jobs. After you uninstall a plugin/theme, some of its cron tasks may still be active making WordPress calling unknown functions. using the pro version, you can detect and clean orphaned tasks
81
+ * Search & filter options, filter tables and filter cron tasks based on several criteria such as the "name", "creator", "value", etc.
82
+ * Get premium support: we will provide quick support as well as any technical answers to help you clean up your database efficiently
83
 
84
+ = Translations =
85
+
86
+ You are welcome to contribute to the plugin translation via the [WordPress translation website](https://translate.wordpress.org/projects/wp-plugins/advanced-database-cleaner).
87
 
88
  == Installation ==
89
 
90
+ This section describes how to install the plugin. In general, there are 3 ways to install this plugin like any other WordPress plugin.
91
+
92
+ = 1. Via WordPress dashboard =
93
+
94
+ * Click on 'Add New' in the plugins dashboard
95
+ * Search for 'advanced-database-cleaner'
96
+ * Click 'Install Now' button
97
+ * Activate the plugin from the same page or from the Plugins dashboard
98
 
99
+ = 2. Via uploading the plugin to WordPress dashboard =
 
 
 
100
 
101
+ * Download the plugin to your computer from (https://wordpress.org/plugins/advanced-database-cleaner/)
102
+ * Click on 'Add New' in the plugins dashboard
103
+ * Click on 'Upload Plugin' button
104
+ * Select the zip file of the plugin that you have downloaded to your computer before
105
+ * Click 'Install Now'
106
+ * Activate the plugin from the Plugins dashboard
107
+
108
+ = 3. Via FTP =
109
+
110
+ * Download the plugin to your computer from (https://wordpress.org/plugins/advanced-database-cleaner/)
111
+ * Unzip the zip file, which will extract the 'advanced-database-cleaner-3.0.0' directory
112
+ * Upload the 'advanced-database-cleaner' directory (included inside the extracted folder) to the /wp-content/plugins/ directory in your web space
113
+ * Activate the plugin from the Plugins dashboard
114
+
115
+ = For Multisite installation =
116
+
117
+ * Log in to your primary site and go to "My Sites" &raquo; "Network Admin" &raquo; "Plugins"
118
+ * Install the plugin following one of the above ways
119
+ * Network activate the plugin (Note that only the main site can have access to the plugin)
120
+
121
+ = Where the plugin menu will be displayed? =
122
+
123
+ * The plugin page can be accessed via "Dashboard" &raquo; "Tools" &raquo; "WP DB Cleaner" or via the left menu "WP DB Cleaner" (You can change this via the plugin settings)
124
 
125
  == Screenshots ==
126
 
127
+ 1. Database with items to clean
128
+ 2. View items before cleaning them (case of revisions)
129
+ 3. Cleanup scheduled task
130
+ 4. Tables overview (scan of tables is available in PRO)
131
+ 5. Tables optimization/repair scheduled task
132
+ 6. Options overview (scan of options is available in PRO)
133
+ 7. Scheduled tasks overview (scan of tasks is available in PRO)
134
+ 8. Overview and settings page
 
135
 
136
  == Changelog ==
137
 
138
+ = 3.0.0 - 05/12/2019 =
139
+ * IMPORTANT NOTICE FOR PRO USERS: After you upgrade to 3.0.0 from an old version, you will notice that WordPress has deactivated the plugin due to an error: 'Plugin file does not exist'. This is because we have renamed the pro plugin folder name from "advanced-db-cleaner" to "advanced-database-cleaner-pro", causing the WordPress to not being able to find the old one and therefore deactivating the plugin. Just activate it again. It doesn’t break anything. Once you activate the plugin again it will continue working normally without any issues. You will also probably lose the pro version after this upgrade (This is due to a conflict between the free and pro versions which is now solved). If it is the case, please follow these steps to restore your pro version with all new features: (https://sigmaplugin.com/blog/restore-pro-version-after-upgrade-to-3-0-0)
140
+
141
+ * COMPATIBILITY: The plugin is tested with WordPress 5.3
142
+ * CHANGE: Some changes to readme.txt file
143
+ * REMOVE: Drafts are not cleaned anymore in 3.0.0 since many users have reported that drafts are useful for them
144
+ * New: You can now clean up new items: pingbacks, trackbacks, orphaned user meta, orphaned term meta, expired transients
145
+ * New: The plugin icon in the left side menu has been changed to white color
146
+ * New: Change text-domain to 'advanced-database-cleaner'
147
+ * New: Enhancements to the look and feel of the plugin
148
+ * New: The sidebar has been changed for the free version and deleted in the pro version
149
+ * New: For options, we have added the option size column and two new actions: Set autoload to no / yes
150
+ * New: For tables, we have added two actions: Empty tables and repair tables
151
+ * New: You can now order and sort all items
152
+ * New: You can change the number of items per page
153
+ * New: You can keep last x days' data from being cleaned and clean only data older than the number of days you have specified
154
+ * New: You can specify elements to cleanup in a scheduled task. You can also create as many scheduled tasks as you need
155
+ * New: Add information to each line of unused data in 'General clean-up' tab to let users know more about each item they will clean
156
+ * New: Display/view items before cleaning them (in 'General cleanup' tab) is now in the free version
157
+ * New: Add a new setting to hide the "premium" tab in the free version
158
+ * Fix: Repair some strings with correct text domain
159
+ * Fix: Some tasks with arguments can't be cleaned. This is fixed now
160
+ * Fix: Some tasks with the same hook name and different arguments were not displayed. This is fixed now
161
+ * Fix: In some previous versions, tables were not shown for some users. This has been fixed
162
+ * PERFORMANCE: All images used by the plugin are now in SVG format
163
+ * PERFORMANCE: Restructuring the whole code for better performance
164
+ * SECURITY: add some _wpnonce to forms
165
+ * New (PRO): Add "Pro" to the title of the pro version to distinguish between the free and the pro versions
166
+ * New (PRO): You can now search and filter all elements: options, tables, tasks, etc. based on several criteria
167
+ * New (PRO): Add progress bar when searching for orphan items to show remaining items to process
168
+ * New (PRO): Add a category called "uncategorized" to let users see items that have not been categorized yet
169
+ * Fix (PRO): The activation issue is now fixed
170
+ * Fix (PRO): The scan of orphaned items generated timeout errors for big databases, we use now ajax to solve this
171
+ * Fix (PRO): A conflict between the free and the pro versions is now solved
172
+ * PERFORMANCE (PRO): We are now using an enhanced new update class provided by EDD plugin
173
+ * PERFORMANCE (PRO): Set autoload to no in all options used by the plugin
174
+ * PERFORMANCE (PRO): The plugin does not store scan results in DB anymore. We use files instead
175
+ * SECURITY (PRO): The license is now hidden after activation for security reasons
176
+ * WEBSITE (PRO): You can now view your purchase history, downloads, generate an invoice, upgrade your license, etc. [Read more](https://sigmaplugin.com/blog/how-to-get-access-to-my-account-and-downloads)
177
+ * WEBSITE (PRO): Enhancements of the [plugin premium page](https://sigmaplugin.com/downloads/wordpress-advanced-database-cleaner)
178
+
179
  = 2.0.0 =
180
  * Some changes to readme.txt file
181
  * Changing the way the plugin can be translated
183
  * Correcting some displaying texts
184
  * Big change in styles
185
  * Restructuring the whole code for better performance
186
+ * Creation of the plugin main page: (https://sigmaplugin.com/downloads/wordpress-advanced-database-cleaner)
187
  * Adding language translation support
188
  * Correct the time zone offset for the scheduled tasks
189
  * Skipping InnoDB tables while optimizing
255
 
256
  == Upgrade Notice ==
257
 
258
+ = 3.0.0 =
259
+ Known issues have been fixed in both free and pro versions (timeout error, activation, scheduled tasks...) New features have been added (new items to cleanup, filter & sort items...) Readme.txt file updated.
260
+
261
  = 2.0.0 =
262
  New release.
263
 
267
  As you use WordPress, your database accumulates a lot of extra data such as revisions, spam comments, trashed comments, etc. Removing this unnecessary data will reduce your database size, speeds up your backup process and speeds up your site also.
268
 
269
  = Is it safe to clean my database? =
270
+ Yes, it is. We do not run any code that can break down your site or delete your posts, pages, comments, etc. However, make sure to always back up your database before any cleanup. This is not optional; it is required! It is always better to be safe than sorry!
271
 
272
  = What does mean "Optimize my database"? =
273
  Optimizing your database will reclaim unused space in your tables, which will reduce storage space and improve efficiency when accessing tables. Optimizing the database can sometimes significantly improve performance, particularly on sites that receive a lot of traffic or have a large amount of content. Optimizing your database is absolutely safe.
274
 
275
  = Is it safe to clean the cron (scheduled tasks)? =
276
+ A scheduled task enables plugins to execute some actions at specified times, without having to manually execute code at that time. Wordpress itself uses some scheduled tasks to perform some regular actions. However, some scheduled tasks may not be removed even if the responsible plugins are deleted from your WordPress installation. As you know, not all plugins care about the housekeeping of your WordPress. Hence, deleting these unnecessary tasks may help in cleaning your site. It should be noted that cleaning scheduled tasks is safe as long as you know what tasks to clean. If you are not sure, it is better to not clean any task.
277
 
278
  = What does mean "Revision"? What sql code is used to clean it? =
279
  WordPress stores a record (called "revision") of each saved draft or published update. This system allows you to see what changes were made in each post and page over time. However, this can lead to a lot of unnecessary overhead in your WordPress database, which consumes a lot of space. The sql query used by the plugin to clean all revisions is:
280
  `DELETE FROM posts WHERE post_type = 'revision'`
281
 
 
 
 
 
282
  = What does mean "Auto-draft"? What sql code is used to clean it? =
283
  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:
284
  `DELETE FROM posts WHERE post_status = 'auto-draft'`
285
 
286
  = What does mean "Pending comment"? What sql code is used to clean it? =
287
+ Pending comments are comments published by users and which are waiting 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:
288
  `DELETE FROM comments WHERE comment_approved = '0'`
289
 
290
  = What does mean "Spam comment"? What sql code is used to clean it? =
291
+ It is a comment that you (or a plugin) have marked as spam. The sql query used by the plugin to clean all spam comments is:
292
  `DELETE FROM comments WHERE comment_approved = 'spam'`
293
 
294
  = What does mean "Trash comment"? What sql code is used to clean it? =
295
  A trash comment is a comment that you have deleted from your Wordpress and have been moved to the trash. A trash comment is not visible in your site and should be deleted forever. The sql query used by the plugin to clean all trash comments is:
296
  `DELETE FROM comments WHERE comment_approved = 'trash'`
297
 
298
+ = What does mean "trackback"? What sql code is used to clean it? =
299
+ Trackbacks allows you to notify other websites owners that you have linked to their article on your website. These trackbacks can be used to send huge amounts of spam. Spammers use them to get their links posted on as many sites as possible. That is why they should be deactivated/cleaned if you do not use them. The sql query used by the plugin to clean trackbacks is:
300
+ `DELETE FROM comments WHERE comment_type = 'trackback'`
301
+
302
+ = What does mean "pingback"? What sql code is used to clean it? =
303
+ Pingbacks allow you to notify other websites owners that you have linked to their article on your website. Pingbacks were designed to solve some of the problems that people saw with trackbacks. Although there are some minor technical differences, a trackback is basically the same things as a pingback. These pingbacks can be used to send huge amounts of spam. Spammers use them to get their links posted on as many sites as possible. That is why they should be deactivated/cleaned if you do not use them. The sql query used by the plugin to clean pingbacks is:
304
+ `DELETE FROM comments WHERE comment_type = 'pingback'`
305
+
306
  = What does mean "Orphan post meta"? What sql code is used to clean it? =
307
+ The post meta data is the information you provide to viewers about each post. This information usually includes the author of the post, when it was written (or posted), and how the author categorized that particular post. In some cases, some post meta data information becomes orphan and does not belong to any post. They are then called "orphan postmeta" and should be cleaned since they are not useful. The sql query used by the plugin to clean all orphan postmeta is:
308
  `DELETE pm FROM postmeta pm LEFT JOIN posts wp ON wp.ID = pm.post_id WHERE wp.ID IS NULL`
309
 
310
  = What does mean "Orphan comment meta"? What sql code is used to clean it? =
311
  The same as "Orphan post meta" with the exception that "orphan comment meta" concern comments and not posts. The sql query used by the plugin to clean all orphan comment meta is:
312
  `DELETE FROM commentmeta WHERE comment_id NOT IN (SELECT comment_id FROM comments)`
313
 
314
+ = What does mean "Orphan user meta"? What sql code is used to clean it? =
315
+ The user meta data is the information you provide to viewers about each user. This information usually includes additional data that is not stored in the users table of WordPress. In some cases, some user meta data information becomes orphaned and does not belong to any user. They are then called "orphaned usermeta" and should be cleaned since they are not useful. The sql query used by the plugin to clean all orphan comment meta is:
316
+ `DELETE FROM usermeta WHERE user_id NOT IN (SELECT ID FROM users)`
317
+
318
+ = What does mean "Orphan term meta"? What sql code is used to clean it? =
319
+ The term meta data is the information that is provided for each taxonomy term. This information usually includes additional data that is not stored in the terms table of WordPress. In some cases, some term meta data information becomes orphaned and does not belong to any taxonomy term. They are then called "orphaned termmeta" and should be cleaned since they are not useful. The sql query used by the plugin to clean all orphan comment meta is:
320
+ `DELETE FROM termmeta WHERE term_id NOT IN (SELECT term_id FROM terms)`
321
+
322
  = What does mean "Orphan relationships"? What sql code is used to clean it? =
323
  Sometimes the wp_term_relationships table becomes bloated with many orphaned relationships. This happens particularly often if you’re using your site not as a blog but as some other type of content site where posts are deleted periodically. Over time, you could get thousands of term relationships for posts that no longer exist which consumes a lot of database space. The sql query used by the plugin to clean all orphan relationships is:
324
  `DELETE FROM term_relationships WHERE term_taxonomy_id=1 AND object_id NOT IN (SELECT id FROM posts)`
325
 
326
+ = What does mean "expired transient"? =
327
+ Transients are a way of storing cached data in the WordPress DB temporarily by giving it a name and a time frame after which it will expire and be deleted. This helps improve WordPress performance and speed up your website while reducing the overall server load. Expired transients are transients that are expired and still exist in the database. These ones can be safely cleaned. Transients housekeeping is now part of WordPress core, as of version 4.9, so no need to clean up them manually unless you have specific needs.
 
328
 
329
  = Is this plugin compatible with multisite? =
330
+ 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 has the right to perform such operation. Your database is precious!
331
 
332
  = Is this plugin compatible with SharDB, HyperDB or Multi-DB? =
333
+ Actually the plugin is not supposed to be compatible with SharDB, HyperDB or Multi-DB. We will try to make it compatible in the coming releases.
334
 
335
  = Does this plugin cleans itself after the uninstall? =
336
  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
@@ -5,7 +5,7 @@ if (!is_main_site()) return;
5
  Plugin Name: Advanced Database Cleaner
6
  Plugin URI: https://sigmaplugin.com/downloads/wordpress-advanced-database-cleaner
7
  Description: Clean database by deleting unused data such as 'old revisions', 'old drafts', 'orphan options', etc. Optimize database and more.
8
- Version: 2.0.0
9
  Author: Younes JFR.
10
  Author URI: https://www.sigmaplugin.com
11
  Contributors: symptote
@@ -15,286 +15,721 @@ 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);
206
  delete_option('aDBc_optimize_schedule');
207
  delete_option('aDBc_clean_schedule');
208
- wp_clear_scheduled_hook('aDBc_optimize_scheduler');
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
- ?>
 
 
 
5
  Plugin Name: Advanced Database Cleaner
6
  Plugin URI: https://sigmaplugin.com/downloads/wordpress-advanced-database-cleaner
7
  Description: Clean database by deleting unused data such as 'old revisions', 'old drafts', 'orphan options', etc. Optimize database and more.
8
+ Version: 3.0.0
9
  Author: Younes JFR.
10
  Author URI: https://www.sigmaplugin.com
11
  Contributors: symptote
15
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
16
  */
17
 
18
+ /***************************************************************************************************************
19
  * Require WordPress List Table Administration API
20
+ * yyy: Test validity of WP_List_Table class after each release of WP Since this class is marked as private by WP
21
+ * http://codex.wordpress.org/Class_Reference/WP_List_Table
22
+ ***************************************************************************************************************/
23
+ if(!class_exists('WP_List_Table')){
24
+ require_once(ABSPATH . 'wp-admin/includes/class-wp-list-table.php');
 
 
 
 
 
 
 
25
  }
26
 
27
+ class ADBC_Advanced_DB_Cleaner {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
28
 
29
+ public function __construct(){
30
+
31
+ // Define common constants that should be modified in each version
32
+ if(!defined("ADBC_PLUGIN_F_TYPE")) define("ADBC_PLUGIN_F_TYPE", "free");
33
+ if(!defined("ADBC_PLUGIN_VERSION")) define("ADBC_PLUGIN_VERSION", "3.0.0");
34
+
35
+ // Prevent conflicts between free and pro, load text-domain and check if should update settings after upgrade
36
+ add_action('plugins_loaded', array($this, 'plugins_loaded'));
37
+
38
+ // Load CSS and JS
39
+ add_action('admin_enqueue_scripts', array($this, 'aDBc_load_styles_and_scripts'));
40
+
41
+ // Add some schedules
42
+ add_filter('cron_schedules', array($this, 'aDBc_additional_schedules'));
43
+
44
+ // Add actions for scheduled events
45
+ add_action('aDBc_optimize_scheduler', 'aDBc_optimize_scheduled_tables');
46
+ add_action('aDBc_clean_scheduler', 'aDBc_clean_scheduled_elements');
47
+
48
+ // Register activation, deactivation and uninstall hooks of the plugin
49
+ register_activation_hook (__FILE__, array($this, 'aDBc_activate_plugin'));
50
+ register_deactivation_hook (__FILE__, array($this, 'aDBc_deactivate_plugin'));
51
+ register_uninstall_hook (__FILE__, array('ADBC_Advanced_DB_Cleaner', 'aDBc_uninstall'));
52
+
53
+ // Add admin notice to rate plugin
54
+ add_action('admin_notices', array($this, 'aDBc_rate_notice'));
55
+ add_action('admin_init', array($this, 'aDBc_ignore_notice'));
56
 
57
+ // Update settings if changed by users
58
+ $this->aDBc_update_settings();
 
 
 
 
 
 
 
 
59
  }
 
 
60
 
61
+ // Do this on plugins loded : prevent conflict between free and pro, load text-domain and check if we should update settings in DB
62
+ public function plugins_loaded(){
63
+
64
+ // Prevent conflicts between free and pro versions and between old pro and new pro
65
+ if(!function_exists('deactivate_plugins')) include_once(ABSPATH.'wp-admin/includes/plugin.php');
66
+ // Test if the user want to activate the pro version and he has the free version activated
67
+ if(is_plugin_active('advanced-database-cleaner-pro/advanced-db-cleaner.php') && is_plugin_active(
68
+ 'advanced-database-cleaner/advanced-db-cleaner.php')){
69
+ // Deactivate the free version in silent mode without calling its deactivation function in order to keep scheduled tasks for pro
70
+ deactivate_plugins('advanced-database-cleaner/advanced-db-cleaner.php', true);
71
+ add_action('admin_notices', array($this, 'aDBc_conflict_notice_free'));
72
+ return;
73
+ }
74
+ // Test if the user want to activate the pro version and he has the old pro version activated
75
+ if(is_plugin_active('advanced-database-cleaner-pro/advanced-db-cleaner.php') && is_plugin_active(
76
+ 'advanced-db-cleaner/advanced-db-cleaner.php')){
77
+ // Deactivate the old pro version in silent mode without calling its deactivation function in order to keep scheduled tasks for pro
78
+ deactivate_plugins('advanced-db-cleaner/advanced-db-cleaner.php', true);
79
+ add_action('admin_notices', array($this, 'aDBc_conflict_notice_old_pro'));
80
+ return;
81
+ }
82
+
83
+ /********************************************************************
84
+ * Include functions and specific elements for pro version
85
+ ********************************************************************/
86
+ include_once 'includes/functions.php';
87
+ if(ADBC_PLUGIN_F_TYPE == "pro"){
88
+
89
+ // Include pro functions
90
+ include_once 'includes/functions_pro.php';
91
+
92
+ // In pro, register as well function for timeout
93
+ register_shutdown_function('aDBc_shutdown_due_to_timeout');
94
+
95
+ // Load license (Load only in pro version)
96
+ include_once 'includes/license/adbc-edd-sample-plugin.php';
97
+
98
+ // Add actions for searching and progress bar in pro
99
+ add_action('wp_ajax_aDBc_new_run_search_for_items', 'aDBc_new_run_search_for_items');
100
+ add_action('wp_ajax_aDBc_get_progress_bar_width', 'aDBc_get_progress_bar_width');
101
+
102
+ }
103
+
104
+ /**************************************************************************************************************
105
+ *
106
+ * Define other variables (we switch all "\" to "/" in paths)
107
+ *
108
+ **************************************************************************************************************/
109
+
110
+ if(!defined("ADBC_PLUGIN_DIR_PATH")) define("ADBC_PLUGIN_DIR_PATH", plugins_url('' , __FILE__));
111
+
112
+ // Main Plugin file
113
+ if(!defined("ADBC_MAIN_PLUGIN_FILE_PATH")) define("ADBC_MAIN_PLUGIN_FILE_PATH", str_replace('\\' ,'/', __FILE__ ));
114
+
115
+ // ABSPATH without trailing slash
116
+ if(!defined("ADBC_ABSPATH")) define("ADBC_ABSPATH", rtrim(str_replace('\\' ,'/', ABSPATH), "/"));
117
+
118
+ // WP Content directory
119
+ if(!defined("WP_CONTENT_DIR")) define("WP_CONTENT_DIR", ABSPATH . 'wp-content');
120
+ if(!defined("ADBC_WP_CONTENT_DIR_PATH")) define("ADBC_WP_CONTENT_DIR_PATH", str_replace('\\' ,'/', WP_CONTENT_DIR));
121
+
122
+ // WP Plugin directory path & name
123
+ if(!defined("WP_PLUGIN_DIR")) define("WP_PLUGIN_DIR", WP_CONTENT_DIR . '/plugins');
124
+ if(!defined("ADBC_WP_PLUGINS_DIR_PATH")) define("ADBC_WP_PLUGINS_DIR_PATH", str_replace('\\' ,'/', WP_PLUGIN_DIR));
125
+
126
+ // MU Must have plugin path & name (MU plugins are no longer used only by Mulsite but all wordpress installations)
127
+ if(!defined("WPMU_PLUGIN_DIR")) define("WPMU_PLUGIN_DIR", WP_CONTENT_DIR . '/mu-plugins');
128
+ if(!defined("ADBC_WPMU_PLUGIN_DIR_PATH")) define("ADBC_WPMU_PLUGIN_DIR_PATH", str_replace('\\' ,'/', WPMU_PLUGIN_DIR));
129
+
130
+ // WP Uploads directory & name
131
+ $aDBc_upload_dir = wp_upload_dir();
132
+ if(!defined("ADBC_UPLOAD_DIR_PATH")) define("ADBC_UPLOAD_DIR_PATH", str_replace('\\' ,'/', $aDBc_upload_dir['basedir']));
133
+
134
+ /**************************************************************************************************************
135
+ *
136
+ * Define & create adbc upload folder or rename existing one by adding security code for versions < 3.1.0
137
+ * In version >= 3.0.0 of ADBC, we will use files to store data instead of database
138
+ * In version >= 3.1.0, we've added a unique security code to the end of the folder to prevent third parties accesssing files directly via URL
139
+ *
140
+ **************************************************************************************************************/
141
+
142
+ if(ADBC_PLUGIN_F_TYPE == "pro"){
143
+
144
+ $aDBc_security_folder_code = get_option('aDBc_security_folder_code');
145
+
146
+ // If the security code does not exist, generate a new one and add it to the DB
147
+ if(empty($aDBc_security_folder_code)){
148
+
149
+ $permitted_chars = '00112233445566778899abcdefghijklmnopqrstuvwxyz';
150
+ $aDBc_security_folder_code = substr(str_shuffle($permitted_chars), 0, 12);
151
+ update_option('aDBc_security_folder_code', $aDBc_security_folder_code, "no");
152
+ }
153
+
154
+ // Define ADBC upload folder name with the security code
155
+ if(!defined("ADBC_UPLOAD_DIR_PATH_TO_ADBC")) define("ADBC_UPLOAD_DIR_PATH_TO_ADBC", ADBC_UPLOAD_DIR_PATH . '/adbc_uploads_' . $aDBc_security_folder_code);
156
+
157
+ // First, test of the old folder "/adbc_uploads" exists. If so, rename it by adding new security code
158
+ if(file_exists(ADBC_UPLOAD_DIR_PATH . '/adbc_uploads')){
159
+
160
+ rename(ADBC_UPLOAD_DIR_PATH . '/adbc_uploads', ADBC_UPLOAD_DIR_PATH . '/adbc_uploads_' . $aDBc_security_folder_code);
161
+
162
+ }else {
163
+ // If the old folder does not exist, then add the folder with security code
164
+ if(!file_exists(ADBC_UPLOAD_DIR_PATH_TO_ADBC)){
165
+ aDBc_create_folder_plus_index_file(ADBC_UPLOAD_DIR_PATH_TO_ADBC);
166
+ }
167
+ }
168
+
169
+ }
170
+
171
+ /**************************************************************************************************************
172
+ *
173
+ * Try to increase the timeout of the server to 300 to prevent timeout errors and multiple loads while searching
174
+ *
175
+ **************************************************************************************************************/
176
+
177
+ if(!defined("ADBC_ORIGINAL_TIMEOUT")) define("ADBC_ORIGINAL_TIMEOUT", ini_get('max_execution_time'));
178
+ if(ADBC_PLUGIN_F_TYPE == "pro"){
179
+ if(function_exists('set_time_limit') && ADBC_ORIGINAL_TIMEOUT < 300){
180
+ @set_time_limit(300);
181
+ }
182
+ }
183
+
184
+ // Add 'Database Cleaner' to Wordpress menu
185
+ add_action('admin_menu', array($this, 'aDBc_add_admin_menu'));
186
+
187
+ // Load text-domain
188
+ load_plugin_textdomain('advanced-database-cleaner', false, dirname(plugin_basename(__FILE__)) . '/languages');
189
+
190
+ // If plugin get updated, make changes to old version
191
+ $this->aDBc_update_plugin_check();
192
+
193
  }
 
 
 
 
 
 
194
 
195
+ // Show notice if conflict detected between free and pro version when installed together
196
+ function aDBc_conflict_notice_free(){
197
+ echo '<div class="error"><p>';
198
+ _e('The free version of Advanced DB Cleaner has been de-activated since the pro version is active.', 'advanced-database-cleaner');
199
+ echo "</p></div>";
200
+ }
201
+ function aDBc_conflict_notice_old_pro(){
202
+ echo '<div class="error"><p>';
203
+ _e('The old pro of Advanced DB Cleaner has been de-activated since the new pro version is active.', 'advanced-database-cleaner');
204
+ echo "</p></div>";
205
+ }
206
+
207
+ // Add 'Database Cleaner' to Wordpress menu
208
+ function aDBc_add_admin_menu(){
209
+
210
+ global $aDBc_settings, $aDBc_left_menu, $aDBc_tool_submenu;
 
 
 
 
211
 
212
+ $icon_svg = 'data:image/svg+xml;base64,' . base64_encode('<svg width="20" height="20" viewBox="0 0 1792 1792" xmlns="http://www.w3.org/2000/svg"><path fill="#a0a5aa" d="M896 768q237 0 443-43t325-127v170q0 69-103 128t-280 93.5-385 34.5-385-34.5-280-93.5-103-128v-170q119 84 325 127t443 43zm0 768q237 0 443-43t325-127v170q0 69-103 128t-280 93.5-385 34.5-385-34.5-280-93.5-103-128v-170q119 84 325 127t443 43zm0-384q237 0 443-43t325-127v170q0 69-103 128t-280 93.5-385 34.5-385-34.5-280-93.5-103-128v-170q119 84 325 127t443 43zm0-1152q208 0 385 34.5t280 93.5 103 128v128q0 69-103 128t-280 93.5-385 34.5-385-34.5-280-93.5-103-128v-128q0-69 103-128t280-93.5 385-34.5z"/></svg>');
213
+
214
+ if(!empty($aDBc_settings['left_menu']) && $aDBc_settings['left_menu'] == "1"){
215
+ $aDBc_left_menu = add_menu_page('Advanced DB Cleaner', 'WP DB Cleaner', 'manage_options', 'advanced_db_cleaner', array($this, 'aDBc_main_page_callback'), $icon_svg, '80.01123');
216
+ }
217
+ if(!empty($aDBc_settings['menu_under_tools']) && $aDBc_settings['menu_under_tools'] == "1"){
218
+ $aDBc_tool_submenu = add_submenu_page('tools.php', 'Advanced DB Cleaner', 'WP DB Cleaner', 'manage_options', 'advanced_db_cleaner', array($this, 'aDBc_main_page_callback'));
219
+ }
220
+ // In case the settings has been deleted by accident, create left menu
221
+ if(empty($aDBc_settings['left_menu']) && empty($aDBc_settings['menu_under_tools'])){
222
+ $aDBc_left_menu = add_menu_page('Advanced DB Cleaner', 'WP DB Cleaner', 'manage_options', 'advanced_db_cleaner', array($this, 'aDBc_main_page_callback'), $icon_svg, '80.01123');
223
+ }
 
 
 
224
  }
225
 
226
+ // Load CSS and JS
227
+ function aDBc_load_styles_and_scripts($hook){
228
+
229
+ // Enqueue our js and css in the plugin pages only
230
+ global $aDBc_left_menu, $aDBc_tool_submenu;
231
+ if($hook != $aDBc_left_menu && $hook != $aDBc_tool_submenu){
232
+ return;
233
+ }
234
+
235
+ wp_enqueue_style('aDBc_css', ADBC_PLUGIN_DIR_PATH . '/css/admin.css');
236
+ wp_enqueue_script('aDBc_js', ADBC_PLUGIN_DIR_PATH . '/js/admin.js');
237
+
238
+ // The wp_localize_script allows us to output the ajax_url path for our script to use.
239
+ wp_localize_script('aDBc_js', 'aDBc_ajax_obj', array(
240
+ 'ajaxurl' => admin_url('admin-ajax.php'),
241
+ 'images_path' => ADBC_PLUGIN_DIR_PATH . "/images/",
242
+ 'sentence_scanning' => __('Scanning ...', 'advanced-database-cleaner')
243
+ ));
244
+ //wp_enqueue_script('jquery');
245
+ wp_enqueue_script('jquery-ui-dialog');
246
+ wp_enqueue_style('wp-jquery-ui-dialog');
247
  }
248
 
249
+ /******************************************************************************************
250
+ * Add some schedules
251
+ * Get more info here: http://codex.wordpress.org/Plugin_API/Filter_Reference/cron_schedules
252
+ ******************************************************************************************/
253
+ function aDBc_additional_schedules($schedules){
254
+ // hourly, daily and twicedaily are default schedules in WP, we will add weekly and monthly
255
+ // Add weekly schedule
256
+ $schedules['weekly'] = array(
257
+ 'interval' => 604800,
258
+ 'display' => __('Once weekly', 'advanced-database-cleaner')
259
+ );
260
+ // Add monthly schedule
261
+ $schedules['monthly'] = array(
262
+ 'interval' => 2635200,
263
+ 'display' => __('Once monthly', 'advanced-database-cleaner')
264
+ );
265
+ return $schedules;
266
  }
267
 
268
+ // Register activation of the plugin
269
+ function aDBc_activate_plugin(){
270
+ // Add default settings if not exists for normal installation
271
+ $settings = get_option('aDBc_settings');
272
+ if(empty($settings)){
273
+ $settings['left_menu'] = "1";
274
+ $settings['menu_under_tools'] = "1";
275
+ $settings['plugin_version'] = ADBC_PLUGIN_VERSION;
276
+ $settings['installed_on'] = date("Y/m/d");
277
+ update_option('aDBc_settings', $settings, "no");
 
 
 
278
  }
279
+ }
 
280
 
281
+ // Register deactivation hook
282
+ function aDBc_deactivate_plugin($network_wide){
283
+
284
+ // Clean these in case there are any remining tasks from older versions < 3.0.0. Those tasks were without arguments
285
+ wp_clear_scheduled_hook('aDBc_optimize_scheduler');
286
+ wp_clear_scheduled_hook('aDBc_clean_scheduler');
287
+
288
+ // Clear all schedules and update options in DB
289
+ // Clear clean tasks
290
+ $aDBc_clean_schedules = get_option('aDBc_clean_schedule');
291
+ $aDBc_clean_schedules = is_array($aDBc_clean_schedules) ? $aDBc_clean_schedules : array();
292
+ foreach($aDBc_clean_schedules as $task_name => $task_info){
293
+ wp_clear_scheduled_hook('aDBc_clean_scheduler', array($task_name));
294
+ // Set active to no in DB
295
+ $task_info['active'] = 0;
296
+ $aDBc_clean_schedules[$task_name] = $task_info;
297
+ update_option('aDBc_clean_schedule', $aDBc_clean_schedules, "no");
298
+ }
299
+ // Clear optimize tasks
300
+ $aDBc_optimize_schedules = get_option('aDBc_optimize_schedule');
301
+ $aDBc_optimize_schedules = is_array($aDBc_optimize_schedules) ? $aDBc_optimize_schedules : array();
302
+ foreach($aDBc_optimize_schedules as $task_name => $task_info){
303
+ wp_clear_scheduled_hook('aDBc_optimize_scheduler', array($task_name));
304
+ // Set active to no in DB
305
+ $task_info['active'] = 0;
306
+ $aDBc_optimize_schedules[$task_name] = $task_info;
307
+ update_option('aDBc_optimize_schedule', $aDBc_optimize_schedules, "no");
308
+ }
309
+ }
310
+
311
+ // Register UNINSTALL hook
312
+ public static function aDBc_uninstall(){
313
+
314
+ // Keep these ones in case they still in DB from older version < 3.0.0
315
+ delete_option('aDBc_options_status');
316
+ delete_option('aDBc_tables_status');
317
+ delete_option('aDBc_tasks_status');
318
+
319
+ // These options are temp and should not exist after finishing the search of oprhans. We make sure to clean them just in case
320
+ $array_items = array('options','tables','tasks');
321
+ foreach($array_items as $item){
322
+ delete_option('aDBc_temp_last_iteration_' . $item);
323
+ delete_option('aDBc_temp_still_searching_' . $item);
324
+ delete_option('aDBc_temp_last_item_line_' . $item);
325
+ delete_option('aDBc_temp_last_file_line_' . $item);
326
+ delete_option('aDBc_last_search_ok_') . $item;
327
+ }
328
+
329
+ // if we are in pro version, clean these ones
330
+ if(ADBC_PLUGIN_F_TYPE == "pro"){
331
+
332
+ // Get security code
333
+ $aDBc_security_folder_code = get_option('aDBc_security_folder_code');
334
+
335
+ // Delete folder containing search results having the security code
336
+ $aDBc_upload_dir = wp_upload_dir();
337
+ $aDBc_upload_dir = str_replace('\\' ,'/', $aDBc_upload_dir['basedir']) . '/adbc_uploads_' . $aDBc_security_folder_code;
338
+ if(file_exists($aDBc_upload_dir)){
339
+ $dir = opendir($aDBc_upload_dir);
340
+ while(($file = readdir($dir)) !== false){
341
+ if ($file != '.' && $file != '..'){
342
+ unlink($aDBc_upload_dir . "/" . $file);
343
+ }
344
+ }
345
+ closedir($dir);
346
+ rmdir($aDBc_upload_dir);
347
+ }
348
+
349
+ // Just in case the old folder (in versions < 3.1.0) have not been cleaned for any reason, try to clean it
350
+ $aDBc_upload_dir = wp_upload_dir();
351
+ $aDBc_upload_dir = str_replace('\\' ,'/', $aDBc_upload_dir['basedir']) . '/adbc_uploads';
352
+ if(file_exists($aDBc_upload_dir)){
353
+ $dir = opendir($aDBc_upload_dir);
354
+ while(($file = readdir($dir)) !== false){
355
+ if ($file != '.' && $file != '..'){
356
+ unlink($aDBc_upload_dir . "/" . $file);
357
+ }
358
+ }
359
+ closedir($dir);
360
+ rmdir($aDBc_upload_dir);
361
+ }
362
+
363
+ // Delete security code option
364
+ delete_option('aDBc_security_folder_code');
365
+ // Delete license options
366
+ delete_option('aDBc_edd_license_key');
367
+ delete_option('aDBc_edd_license_status');
368
+ // Uninstall the license key? Maybe no need for deactivating the license!
369
+ // if(!function_exists('aDBc_edd_deactivate_license_after_uninstall')){
370
+ // include_once 'includes/license/adbc-edd-sample-plugin.php';
371
+ // }
372
+ // aDBc_edd_deactivate_license_after_uninstall();
373
+ }
374
 
375
+ // Options below are used by both free and pro version
376
+ // Test if both version are installed to prevent deleting options
377
+ if((file_exists(WP_PLUGIN_DIR . "/advanced-database-cleaner-pro") && file_exists(WP_PLUGIN_DIR . "/advanced-database-cleaner")) ||
378
+ (file_exists(WPMU_PLUGIN_DIR . "/advanced-database-cleaner-pro") && file_exists(WPMU_PLUGIN_DIR . "/advanced-database-cleaner"))){
379
+ // Do nothing in this case because we want to keep settings for the remaining version of the plugin
380
+ }else{
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
381
  delete_option('aDBc_optimize_schedule');
382
  delete_option('aDBc_clean_schedule');
383
+ delete_option('aDBc_settings');
 
 
384
  }
385
  }
 
386
 
387
+ // If plugin get updated, make changes to old version
388
+ function aDBc_update_plugin_check(){
389
+ $settings = get_option('aDBc_settings');
390
+ if(!empty($settings)){
391
+ if(empty($settings['plugin_version'])){
392
+
393
+ // If settings is not empty, this means that the users had already installed ADBC plugin
394
+ // if empty($settings['plugin_version']) => the user will update to or will install the version >= 3.0.0 for the first time
395
+
396
+ // Before starting the update, make all previous plugin options to autoload "no"
397
+ $options_array = array('aDBc_optimize_schedule', 'aDBc_clean_schedule', 'aDBc_settings', 'aDBc_edd_license_key', 'aDBc_edd_license_status');
398
+ foreach($options_array as $option_name){
399
+ $options_value = get_option($option_name);
400
+ if(!empty($options_value)){
401
+ update_option($option_name, "xyz");
402
+ update_option($option_name, $options_value, "no");
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
403
  }
 
404
  }
405
+
406
+ // Proceed to update routine. First, add some options
407
+ $settings['ignore_premium'] = "no";
408
+ $settings['plugin_version'] = ADBC_PLUGIN_VERSION;
409
+ $settings['installed_on'] = date("Y/m/d");
410
+ // Delete some unused options
411
+ unset($settings['top_main_msg']);
412
+ unset($settings['tables_cleanup_warning']);
413
+ update_option('aDBc_settings', $settings, "no");
414
+
415
+ // If there are any scheduled cleanup tasks, change corresponding structure in DB to meet the new version
416
+ if($timestamp = wp_next_scheduled('aDBc_clean_scheduler')){
417
+ // Prepare new structure
418
+ // Since in version <= 3.0.0 the schedule cleans all elements, we will add only those elements not new introduced ones
419
+ $new_schedule_params['elements_to_clean'] = array('revision','auto-draft','trash-posts','moderated-comments','spam-comments','trash-comments','orphan-postmeta','orphan-commentmeta','orphan-relationships');
420
+ $repeat = get_option('aDBc_clean_schedule');
421
+ $repeat = empty($repeat) ? 'weekly' : $repeat;
422
+ $new_schedule_params['repeat'] = $repeat;
423
+ $date = date('Y-m-d', $timestamp) . "";
424
+ $time = date('H:i', $timestamp) . "";
425
+ $new_schedule_params['start_date'] = $date;
426
+ $new_schedule_params['start_time'] = $time;
427
+ $new_schedule_params['active'] = "1";
428
+ $clean_schedule_setting['cleanup_schedule'] = $new_schedule_params;
429
+ update_option('aDBc_clean_schedule', $clean_schedule_setting, "no");
430
+ // Reschedule the event with arg name
431
+ wp_clear_scheduled_hook('aDBc_clean_scheduler');
432
+ wp_schedule_event($timestamp, $repeat, "aDBc_clean_scheduler", array('cleanup_schedule'));
433
+ }else{
434
+ // If no scheduled task, delete any remining option in DB
435
+ delete_option('aDBc_clean_schedule');
436
  }
437
+
438
+ // If there are any optimize cleanup tasks, change corresponding structure in DB to meet the new version
439
+ if($timestamp = wp_next_scheduled('aDBc_optimize_scheduler')){
440
+ // Prepare new structure
441
+ $repeat = get_option('aDBc_optimize_schedule');
442
+ $repeat = empty($repeat) ? 'weekly' : $repeat;
443
+ $new_schedule_params['repeat'] = $repeat;
444
+ $date = date('Y-m-d', $timestamp) . "";
445
+ $time = date('H:i', $timestamp) . "";
446
+ $new_schedule_params['start_date'] = $date;
447
+ $new_schedule_params['start_time'] = $time;
448
+ // Prepare operations to perform. Since in versions < 3.0.0 there were no repair, add only optimize to keep users settings
449
+ $operations = array('optimize');
450
+ $new_schedule_params['operations'] = $operations;
451
+ $new_schedule_params['active'] = "1";
452
+ $optimize_schedule_setting['optimize_schedule'] = $new_schedule_params;
453
+ update_option('aDBc_optimize_schedule', $optimize_schedule_setting, "no");
454
+ // Reschedule the event with arg name
455
+ wp_clear_scheduled_hook('aDBc_optimize_scheduler');
456
+ wp_schedule_event($timestamp, $repeat, "aDBc_optimize_scheduler", array('optimize_schedule'));
457
+ }else{
458
+ // If no scheduled task, delete any remining option in DB
459
+ delete_option('aDBc_optimize_schedule');
460
+ }
461
+
462
+ // Change categorization of tables, options, tasks from database to files
463
+ $types_array = array('tables', 'options', 'tasks');
464
+ foreach($types_array as $type){
465
+ $aDBc_items = get_option("aDBc_" . $type . "_status");
466
+ $aDBc_items_status = empty($aDBc_items['items_status']) ? "" : $aDBc_items['items_status'];
467
+ if(!empty($aDBc_items_status)){
468
+ $item_info = explode(",", $aDBc_items_status);
469
+ $myfile = fopen(ADBC_UPLOAD_DIR_PATH_TO_ADBC . "/" . $type . ".txt", "a");
470
+ foreach($item_info as $item){
471
+ $columns = explode(":", $item);
472
+ // A customer reported that the colon is not supported as separator in searching and all options with colon are not categorized!
473
+ // == 5 means that the option does not contain a colon. Process only these cases since intems with >=5 are by default uncategorized
474
+ if(count($columns) == 5){
475
+ fwrite($myfile, $item."\n");
476
+ }
477
+ }
478
+ fclose($myfile);
479
+ }
480
+ // Delete options in DB that store searching status since they are not used anymore in version >= 3.0.0
481
+ delete_option("aDBc_" . $type . "_status");
482
+ }
483
+
484
+ // 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
485
+ if(function_exists('is_multisite') && is_multisite()){
486
+ global $wpdb;
487
+ $blogs_ids = $wpdb->get_col("SELECT blog_id FROM $wpdb->blogs");
488
+ foreach($blogs_ids as $blog_id){
489
+ switch_to_blog($blog_id);
490
+ if(!is_main_site()){
491
+ delete_option('aDBc_optimize_schedule');
492
+ delete_option('aDBc_clean_schedule');
493
+ wp_clear_scheduled_hook('aDBc_optimize_scheduler');
494
+ wp_clear_scheduled_hook('aDBc_clean_scheduler');
495
+ }
496
+ restore_current_blog();
497
+ }
498
+ }
499
+ }else{
500
+ // If plugin_version is not empty, should we update the plugin version in DB?
501
+ if($settings['plugin_version'] != ADBC_PLUGIN_VERSION){
502
+ $settings['plugin_version'] = ADBC_PLUGIN_VERSION;
503
+ update_option('aDBc_settings', $settings, "no");
504
+ }
505
+ }
506
+ }
507
+ }
508
+
509
+ // Add admin notice to rate plugin
510
+ function aDBc_rate_notice(){
511
+ $settings = get_option('aDBc_settings');
512
+ if(!empty($settings['installed_on'])){
513
+ $ignore_rating = empty($settings['ignore_rating']) ? "" : $settings['ignore_rating'];
514
+ if($ignore_rating != "yes"){
515
+ $date1 = $settings['installed_on'];
516
+ $date2 = date("Y/m/d");
517
+ $diff = abs(strtotime($date2) - strtotime($date1));
518
+ $days = floor($diff / (60*60*24));
519
+ if($days >= 7){
520
+ $aDBc_new_URI = $_SERVER['REQUEST_URI'];
521
+ $aDBc_new_URI = add_query_arg('adbc-ignore-notice', '0', $aDBc_new_URI);
522
+ echo '<div class="updated"><p>';
523
+ printf(__('Awesome! You have been using <a href="admin.php?page=advanced_db_cleaner">Advanced DB Cleaner</a> for more than 1 week. Would you mind taking a few seconds to give it a 5-star rating on WordPress? Thank you in advance :) <a href="%2$s" target="_blank">Ok, you deserved it</a> | <a href="%1$s">I already did</a> | <a href="%1$s">No, not good enough</a>', 'advanced-database-cleaner'), $aDBc_new_URI,
524
+ 'https://wordpress.org/support/plugin/advanced-database-cleaner/reviews/?filter=5');
525
+ echo "</p></div>";
526
+ }
527
+ }
528
+ }
529
+ }
530
+ function aDBc_ignore_notice(){
531
+ if(isset($_GET['adbc-ignore-notice']) && $_GET['adbc-ignore-notice'] == "0"){
532
+ $settings = get_option('aDBc_settings');
533
+ $settings['ignore_rating'] = "yes";
534
+ update_option('aDBc_settings', $settings, "no");
535
+ }
536
+ }
537
+
538
+ // Update settings when saved in "overview & settings" tab. Test also to disable premium notice if closed by users
539
+ function aDBc_update_settings(){
540
+
541
+ global $aDBc_settings;
542
+ $aDBc_settings = get_option('aDBc_settings');
543
+ if(isset($_POST['save_settings'])){
544
+ $aDBc_settings['left_menu'] = isset($_POST['aDBc_left_menu']) ? "1" : "0";
545
+ $aDBc_settings['menu_under_tools'] = isset($_POST['aDBc_menu_under_tools']) ? "1" : "0";
546
+ // In case the user does not select any of menu positions, we force the menu under tools to be shown
547
+ if(!isset($_POST['aDBc_left_menu']) && !isset($_POST['aDBc_menu_under_tools'])){
548
+ $aDBc_settings['left_menu'] = "1";
549
+ }
550
+ if(ADBC_PLUGIN_F_TYPE == "free"){
551
+ $aDBc_settings['hide_premium_tab'] = isset($_POST['aDBc_hide_premium_tab']) ? "1" : "0";
552
+ }
553
+ // Update settings in DB
554
+ update_option('aDBc_settings', $aDBc_settings, "no");
555
+ }
556
+ /********************************************************************
557
+ * Update premium notice for lost licenses
558
+ ********************************************************************/
559
+ if(isset($_GET['ignore-premium-notice']) && $_GET['ignore-premium-notice'] == "yes"){
560
+ $aDBc_settings['ignore_premium'] = "yes";
561
+ update_option('aDBc_settings', $aDBc_settings, "no");
562
+ }
563
+
564
+ }
565
+
566
+ // The admin page of the plugin
567
+ function aDBc_main_page_callback(){ ?>
568
+ <div class="wrap">
569
+
570
+ <div>
571
+ <table width="100%" cellspacing="0">
572
+ <tr style="background:#fff;border:0px solid #eee;">
573
+
574
+ <td style="padding:10px 10px 10px 20px">
575
+ <img style="width:50px" src="<?php echo ADBC_PLUGIN_DIR_PATH; ?>/images/icon-128x128.png"/>
576
+ </td>
577
+
578
+ <td width="100%">
579
+ <div style="background:#fff;padding:10px;margin-bottom:10px;">
580
+ <?php
581
+ if(ADBC_PLUGIN_F_TYPE == 'free'){
582
+ $aDBc_plugin_title = "Advanced DB Cleaner '" . ADBC_PLUGIN_VERSION . "'";
583
+ }else{
584
+ $aDBc_plugin_title = "Advanced DB Cleaner <b>PRO</b> '" . ADBC_PLUGIN_VERSION . "'";
585
+ }
586
+ ?>
587
+ <div style="font-size: 20px;font-weight: 400;margin-bottom:10px"><?php echo $aDBc_plugin_title; ?></div>
588
+ <div style="border-top:1px dashed #eee;padding-top:4px">
589
+ <span class="aDBc-row-text"><?php _e('By', 'advanced-database-cleaner'); ?></span>
590
+ <a class="aDBc-sidebar-link" href="https://profiles.wordpress.org/symptote/" target="_blank">Younes JFR.</a>
591
+ &nbsp;|&nbsp;
592
+ <span class="aDBc-row-text"><?php _e('Need help?', 'advanced-database-cleaner'); ?></span>
593
+ <a class="aDBc-sidebar-link" href="http://sigmaplugin.com/contact" target="_blank"><?php _e('Contact me', 'advanced-database-cleaner'); ?></a>
594
+ </div>
595
+ </div>
596
+ </td>
597
+
598
+ <td style="text-align:center">
599
+ <div style="background:#fff;padding:10px;margin-bottom:10px;">
600
+ <a class="aDBc-sidebar-link" href="http://sigmaplugin.com/contact" target="_blank">
601
+ <img style="width:50px" src="<?php echo ADBC_PLUGIN_DIR_PATH; ?>/images/help.svg"/>
602
+ <br/>
603
+ <span><?php _e('Support', 'advanced-database-cleaner'); ?></span>
604
+ </a>
605
+ </div>
606
+ </td>
607
+ </tr>
608
+ </table>
609
+ </div>
610
+
611
+ <h1 style="font-size:10px"></h1>
612
+
613
+ <?php
614
+ if(ADBC_PLUGIN_F_TYPE == 'pro' && !aDBc_edd_is_license_activated()){
615
+ echo '<div class="aDBc-please-activate-msg notice is-dismissible"><p>' . __('Please activate your license key to get lifetime automatic updates and support.', 'advanced-database-cleaner') . " <a href='?page=advanced_db_cleaner&aDBc_tab=license'>" . __('Activate now', 'advanced-database-cleaner') . "</a>" . '</p></div>';
616
+ }
617
+ global $aDBc_settings;
618
+
619
+ // This is a notice for premium users who will lose pro version when upgrading to 3.0.0 from an old version
620
+ if(ADBC_PLUGIN_F_TYPE == 'free' && !empty($aDBc_settings['ignore_premium']) && $aDBc_settings['ignore_premium'] == "no"){
621
+
622
+ $aDBc_new_URI = $_SERVER['REQUEST_URI'];
623
+ $aDBc_new_URI = add_query_arg('ignore-premium-notice', 'yes', $aDBc_new_URI);
624
+
625
+ ?>
626
+ <div id="aDBc_main_msg" class="aDBc-premium-lost-msg">
627
+ <span style="float:left;margin-bottom:20px"><?php _e('Important notice to premium users!', 'advanced-database-cleaner'); ?></span>
628
+ <a style="text-decoration:none;float:right" href="<?php echo $aDBc_new_URI ?>">
629
+ <span class="dashicons-dismiss dashicons"></span>
630
+ </a>
631
+ <p style="font-size:13px;clear:both">
632
+ <?php _e('You will probably lose the pro version after this upgrade (This is due to a conflict between the free and pro versions which is now solved). If it is the case, please follow these <a target ="_blank" href="https://sigmaplugin.com/blog/restore-pro-version-after-upgrade-to-3-0-0">steps to restore your pro version</a> with all new features. Thank you :)', 'advanced-database-cleaner'); ?>
633
+ <br/>
634
+ <span style="font-size:12px;color:#999"><?php _e('If you are not a premium user, please kindly just close this message since you are not concerned by this issue!', 'advanced-database-cleaner'); ?></span>
635
+ </p>
636
+ </div>
637
+ <?php
638
+ }
639
+
640
+ if(ADBC_PLUGIN_F_TYPE == 'free'){
641
+ $aDBc_margin_class = "aDBc-margin-r-300";
642
+ }else{
643
+ $aDBc_margin_class = "";
644
+ }
645
+
646
+ ?>
647
+ <div class="<?php echo $aDBc_margin_class; ?>">
648
+ <div class="aDBc-tab-box">
649
+ <?php
650
+ $aDBc_tabs = array('general' => __('General clean-up', 'advanced-database-cleaner'),
651
+ 'tables' => __('Tables', 'advanced-database-cleaner'),
652
+ 'options' => __('Options', 'advanced-database-cleaner'),
653
+ 'cron' => __('Cron jobs', 'advanced-database-cleaner'),
654
+ 'overview' => __('Overview & settings', 'advanced-database-cleaner'),
655
+ 'premium' => __('Premium', 'advanced-database-cleaner'),
656
+ 'license' => __('License', 'advanced-database-cleaner')
657
+ );
658
+
659
+ // If we are in free version or if the user choosed to hide the premium tab, then hide it
660
+ // Also hide license tab
661
+ if(ADBC_PLUGIN_F_TYPE == "pro" || (!empty($aDBc_settings['hide_premium_tab']) && $aDBc_settings['hide_premium_tab'] == "1")){
662
+ unset($aDBc_tabs['premium']);
663
+ }
664
+
665
+ // If we are in free version, hide license tab
666
+ if(ADBC_PLUGIN_F_TYPE == "free"){
667
+ unset($aDBc_tabs['license']);
668
+ }
669
+
670
+ $aDBc_dashicons_css = array('general' => 'dashicons-format-aside dashicons',
671
+ 'tables' => 'dashicons-grid-view dashicons',
672
+ 'options' => 'dashicons-forms dashicons',
673
+ 'cron' => 'dashicons-backup dashicons',
674
+ 'overview' => 'dashicons-admin-settings dashicons',
675
+ 'premium' => 'dashicons-awards dashicons',
676
+ 'license' => 'dashicons-admin-network dashicons',
677
+ );
678
+
679
+ $current_tab = isset($_GET['aDBc_tab']) ? $_GET['aDBc_tab'] : 'general';
680
+
681
+ echo '<h2 class="nav-tab-wrapper">';
682
+ foreach($aDBc_tabs as $tab => $name){
683
+ $class = ($tab == $current_tab) ? ' nav-tab-active' : '';
684
+ $link = "?page=advanced_db_cleaner&aDBc_tab=$tab";
685
+ if($tab == "tables" || $tab == "options" || $tab == "cron"){
686
+ $link .= '&aDBc_cat=all';
687
+ }
688
+ echo "<a class='nav-tab$class' href='$link'><span class='$aDBc_dashicons_css[$tab]'></span> $name</a>";
689
+ }
690
+ echo '</h2>';
691
+
692
+ echo '<div class="aDBc-tab-box-div">';
693
+ switch ($current_tab){
694
+ case 'general' :
695
+ include_once 'includes/clean_db.php';
696
+ break;
697
+ case 'tables' :
698
+ include_once 'includes/optimize_db.php';
699
+ break;
700
+ case 'options' :
701
+ include_once 'includes/class_clean_options.php';
702
+ break;
703
+ case 'cron' :
704
+ include_once 'includes/class_clean_cron.php';
705
+ break;
706
+ case 'overview' :
707
+ include_once 'includes/overview_settings.php';
708
+ break;
709
+ case 'premium' :
710
+ include_once 'includes/premium_page.php';
711
+ break;
712
+ case 'license' :
713
+ aDBc_edd_license_page();
714
+ break;
715
+ }
716
+ echo '</div>';
717
+ ?>
718
+ </div>
719
+
720
+ <!-- In pro version, don't show sidebar -->
721
+ <?php if(ADBC_PLUGIN_F_TYPE == "free"){ ?>
722
+ <div class="aDBc-sidebar"><?php include_once 'includes/sidebar.php'; ?></div>
723
+ <?php } ?>
724
+
725
  </div>
 
726
  </div>
727
+ <?php
728
+ }
729
  }
730
 
 
 
 
 
 
 
731
 
732
+
733
+
734
+ // Get instance
735
+ new ADBC_Advanced_DB_Cleaner();
css/admin.css CHANGED
@@ -6,23 +6,28 @@
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
  }
@@ -41,51 +46,100 @@ html {
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;
@@ -97,39 +151,89 @@ html {
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;
@@ -149,6 +253,10 @@ html {
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
  }
@@ -160,7 +268,7 @@ html {
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%;
@@ -171,83 +279,140 @@ html {
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;
@@ -258,6 +423,7 @@ html {
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;
@@ -290,7 +456,7 @@ html {
290
  -webkit-border-radius: 5px;
291
  }
292
  .displaying-num{
293
- display: none !important;
294
  }
295
  /* For tabs */
296
  h2.nav-tab-wrapper {
@@ -300,20 +466,21 @@ h2.nav-tab-wrapper {
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
  *
@@ -328,7 +495,7 @@ h2 .nav-tab {
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;
@@ -341,17 +508,17 @@ h2 .nav-tab {
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;
@@ -359,16 +526,6 @@ h2 .nav-tab {
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;
@@ -383,45 +540,73 @@ h2 .nav-tab {
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;
@@ -429,61 +614,115 @@ h2 .nav-tab {
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;
@@ -495,23 +734,6 @@ a:hover.aDBc-tooltips span {
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
  *
@@ -539,16 +761,18 @@ a:hover.aDBc-tooltips span {
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
  }
@@ -565,4 +789,138 @@ a:hover.aDBc-tooltips span {
565
  height: 30px !important;
566
  padding: 1px 20px !important;
567
  margin-top: 10px !important;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
568
  }
6
  html {
7
  overflow-y: scroll;
8
  }
9
+ .aDBc-premium-lost-msg{
10
+ border-left: 5px solid orange !important;
11
  background: #fff !important;
12
  padding: 20px !important;
13
  }
14
+ .aDBc-premium-lost-msg > span{
15
+ font-size: 17px;
16
+ font-family: arial;
17
+ color: orange;
18
  font-weight: bold;
19
  }
20
+
21
+ .aDBc-content-max-width{
22
  max-width: 840px;
23
  }
24
  .aDBc-margin-r-300 {
25
  margin-top: 10px;
26
  margin-right: 260px;
27
  }
28
+ .aDBc-margin-t-10 {
29
+ margin-top: 10px;
30
+ }
31
  .aDBc-margin-t-20 {
32
  margin-top: 20px;
33
  }
46
  .aDBc-float-right{
47
  float: right;
48
  }
49
+ /*#aDBc-please-wait{
50
  display: none;
51
  height: 34px !important;
52
  margin-bottom: 40px;
53
+ /*color: #999;
54
  font-family: verdana;
55
  font-size: 11px;
56
  text-align: center;
57
  }
58
  .aDBc-loading-gif{
59
  height: 45px;
60
+ width: 50px;
61
+ background: url("../images/spinner.gif") no-repeat;
62
  background-position: 50% 0% !important;
63
  text-align: center;
64
+ /*margin: -20px 0px 0px 0px;
65
+ }*/
66
  .aDBc-category-counts{
67
+ float: right;
68
+ /*background: #f9f9f9;*/
69
+ padding: 0px;
70
+ text-align: left;
71
+ border-radius: 4px;
72
+ -moz-border-radius: 4px;
73
+ -webkit-border-radius: 4px;
74
  }
75
  .aDBc-category-counts a:hover{
76
+ padding-bottom: 1px;
77
  border-bottom: 1px solid #ccc;
78
  }
79
  .aDBc-category-counts-links {
80
  text-decoration: none !important;
81
  }
82
  .aDBc-selected-category{
83
+ /*padding-bottom: 6px; */
84
  font-weight: bold;
85
+ font-size: 13px;
86
  }
87
  .aDBc-category-separator{
88
  color: #999;
89
+ margin-left: 4px;
90
+ margin-right: 4px
91
  }
92
+ .aDBc-run-new-search,.aDBc-run-new-search:disabled{
93
  height: 34px !important;
94
+ min-width: 145px !important;
95
+ background-image: url("../images/search-icon.svg");
96
  background-repeat: no-repeat !important;
97
  background-position: 8px 50% !important;
98
+ padding-left: 38px !important;
99
+ text-align: left;
100
+
101
+ background-color: #0085ba;
102
+ border-color: #0073aa #006799 #006799;
103
+ box-shadow: 0 1px 0 #006799;
104
+ color: #fff;
105
+ text-shadow: 0 -1px 1px #006799, 1px 0 1px #006799, 0 1px 1px #006799, -1px 0 1px #006799;
106
+
107
+ display: inline-block;
108
+ text-decoration: none;
109
+ font-size: 13px;
110
+ line-height: 26px;
111
+ height: 28px;
112
+ margin: 0;
113
+
114
+ cursor: pointer;
115
+ border-width: 1px;
116
+ border-style: solid;
117
+ -webkit-appearance: none;
118
+ border-radius: 3px;
119
+ white-space: nowrap;
120
+ box-sizing: border-box;
121
+ }
122
+ .aDBc-run-new-search:hover{
123
+ background-color: #178DBD;
124
  }
125
+
126
+ input:disabled {
127
+ background-color: #0085ba;
128
+ border-color: rgba(222,222,222,.75);
129
+ box-shadow: inset 0 1px 2px rgba(0,0,0,.04);
130
+ color: #e9e9e9;
131
+ cursor: default;
132
+ }
133
+
134
+ /*.aDBc-continue-new-search{
135
+ height: 34px !important;
136
+ min-width: 175px !important;
137
+ background-image: url("../images/arrows.png") !important;
138
+ background-repeat: no-repeat !important;
139
+ background-position: 8px 50% !important;
140
+ padding-left: 35px !important;
141
+ text-align: left;
142
+ }*/
143
  .aDBc-category-color{
144
  padding: 0px 5px;
145
  margin-right: 5px;
151
  }
152
  .aDBc-left-content{
153
  float: left;
154
+ width: 600px;
155
  margin-right: 25px
156
  }
157
  .aDBc-text-status-db{
158
  font-family: verdana;
159
+ font-size: 12px;
160
  }
161
  .aDBc-schedule-text{
162
+ /*font-weight: bold;*/
163
+ padding: 5px 0px 0px 0px;
164
+ font-family: verdana;
165
+ font-size: 12px;
166
+
167
  }
168
+ .aDBc-schedule-hook-box{
169
+ background: #fff;
170
+ margin-top: 20px;
171
+ border-radius: 5px;
172
+ text-align: left;
173
+ padding: 5px;
174
+ border: 1px dashed #999;
175
+ color: black;
176
+ vertical-align: middle;
177
+ border:1px solid #f1f1f1;border-radius:2px;box-shadow:0 0 10px #ccc;
178
+
179
+ }
180
+ .aDBc-schedule-on-off{
181
+ vertical-align: middle;
182
+ width: 30px;
183
  }
184
  .aDBc-schedule-box{
185
+ border-top: 1px dashed #000;
186
+ margin-top: 5px;
187
  }
188
  .aDBc-custom-clean-text{
189
  font-size: 15px;
190
+ margin-top: 10px;
191
+ margin-bottom: 45px;
192
  color: #0992CC;
193
+ /*background: #fff6e5;
194
+ padding: 10px;*/
195
+ border-radius: 5px;
196
+ -moz-border-radius: 5px;
197
+ -webkit-border-radius: 5px;
198
+
199
+ }
200
+ .aDBc-custom-clean-text > div{
201
+ text-align: center;
202
  }
203
+ .aDBc-caution{
204
+ font-size: 11px;
205
+ color: red;
206
+ margin-left: 26px;
207
+ margin-top: 0px;
208
+ }
209
+
210
+ .aDBc-submit-link{
211
+ background: none !important;
212
+ border: none !important;
213
+ text-decoration: none !important;
214
+ font-size: 11px !important;
215
+ padding: 0 !important;
216
+ cursor: pointer !important;
217
+ color: #0073aa;
218
+ }
219
+
220
+ .aDBc-edit-schedule{
221
+ border-radius: 4px;
222
+ font-size: 11px;
223
+ background: #f0f5fa;
224
+ padding: 2px 4px;
225
+ float: right;
226
+ margin-top: 4px;
227
+ }
228
+
229
+
230
  /*---------------------------------------------------------------------------------------------
231
  *
232
  * These styles override those of WordPress
233
  *
234
  *---------------------------------------------------------------------------------------------*/
235
  .widefat {
236
+ border-spacing: 1px;
237
  }
238
  .widefat > thead {
239
  background: #f1f1f1;
253
  .widefat > tbody > tr:hover {
254
  background-color: #f9f9f9;
255
  }
256
+ .widefat > tbody > tr > td{
257
+ vertical-align: middle !important;
258
+ padding: 8px 10px !important;
259
+ }
260
  .widefat td, .widefat td ol, .widefat td p, .widefat td ul {
261
  line-height: 1.5em !important;
262
  }
268
  }
269
  /* This style is used by WP tables (WP_List_Table class) for columns, it is not used directly in the code */
270
  .column-site_id{
271
+ width: 60px;
272
  }
273
  .column-o_table_prefix{
274
  width: 12%;
279
  .column-o_table_name{
280
  /*width: 27%;*/
281
  }
282
+ .column-post_id{
283
+ width: 10%;
284
+ }
285
+ .column-post_title{
286
+ width: 30%;
287
+ }
288
+ .column-post_content{
289
+ width: 30%;
290
+ }
291
+ .column-post_date{
292
+ width: 18%;
293
+ }
294
+
295
+ .column-comment_id{
296
+ width: 15%;
297
+ }
298
+
299
+ .column-comment_author{
300
+ width: 20%;
301
+ }
302
+ .column-comment_content{
303
+ width: 45%;
304
+ }
305
+
306
+ .column-comment_date{
307
+ width: 18%;
308
+ }
309
+
310
+ .column-meta_id{
311
+ width: 20%;
312
+ }
313
+ .column-meta_key{
314
+ width: 40%;
315
+ }
316
+ .column-meta_value{
317
+ width: 40%;
318
+ }
319
+
320
+ .column-transient_id{
321
+ width: 15%;
322
+ }
323
+ .column-transient_name{
324
+ width: 30%;
325
+ }
326
+ .column-transient_content{
327
+ width: 30%;
328
+ }
329
+ .column-transient_timeout{
330
+ width: 20%;
331
+ }
332
+ .column-transient_autoload{
333
+ width: 15%;
334
+ }
335
+
336
  .column-lost_space{
337
  border-right: 0 none !important;
338
  width: 15%;
339
  }
340
  .column-option_value{
341
+ width: 22% !important;
342
+ }
343
+ .column-option_size{
344
+ width: 10% !important;
345
  }
346
  .column-option_autoload{
347
+ width: 12% !important;
348
  }
349
  .column-option_belongs_to{
350
+ width: 25% !important;
351
  }
352
  .column-hook_name{
353
+ width: 27%;
354
+ }
355
+ .column-arguments{
356
+ width: 18%;
357
  }
358
  .column-next_run{
359
  width: 30%;
360
  font-size: 12px !important;
361
  }
362
  .column-hook_belongs_to{
363
+ width: 23%;
364
  }
365
  .column-table_prefix{
366
+ /*width: 7%;*/
367
  }
368
  .column-table_name{
369
  /*width: 100%;*/
370
  }
371
  .column-table_rows{
372
+ width: 68px !important;
373
  }
374
  .column-table_size{
375
+ width: 78px !important;
376
+ font-size: 12px !important;
377
  }
378
  .column-table_belongs_to{
379
+ width: 170px !important;
380
  font-size: 13px !important;
381
  border-right: 0 none !important;
382
  }
383
+ .column-table_lost{
384
+ /*width: 50px;
385
+ font-size: 12px !important;*/
 
386
  }
387
+ .column-view{
388
+ width: 45px;
389
+ text-align: center !important;
390
  }
391
  .column-count{
392
+ width: 42px;
393
+ text-align: center !important;
 
 
 
 
394
  }
395
+ .column-scheduled{
396
+ width: 88px;
397
+ text-align: center !important;
398
  }
399
+ .column-keep{
400
+ border-right: 0 none !important;
401
+ width: 80px;
402
+ text-align: center !important;
403
  }
404
+ .column-draft_id, .column-revision_id, .column-comment_id, .column-commentmeta_id, .column-postmeta_id, .column-object_id{
405
+ width: 65px;
406
  }
407
+ .column-urer_term_id{
408
+ width: 70px;
409
  }
410
+ .column-draft_date, .column-revision_date{
411
+ width: 125px;
 
412
  }
413
  .column-commentmeta_meta_key,
414
  .column-postmeta_meta_key{
415
+ width: 225px;
416
  }
417
  .column-commentmeta_meta_value{
418
  font-size: 12px !important;
423
  .column-dash_feed_autoload{
424
  width: 12%;
425
  }
426
+
427
  /* To hide tfoot from tables used in the plugin */
428
  .widefat tfoot {
429
  display: none;
456
  -webkit-border-radius: 5px;
457
  }
458
  .displaying-num{
459
+ /*display: none !important;*/
460
  }
461
  /* For tabs */
462
  h2.nav-tab-wrapper {
466
  }
467
  h2 .nav-tab {
468
  font-size: 13px;
469
+ line-height: 20px;
470
  font-weight: normal;
471
+ padding: 10px 10px !important;
472
  border-radius: 5px 5px 0 0;
473
  -moz-border-radius: 5px 5px 0 0;
474
  -webkit-border-radius: 5px 5px 0 0;
475
  }
476
  .nav-tab-active, .nav-tab-active:hover {
477
  background: #fff;
478
+ font-weight: bold !important;
479
  border-bottom: 0px;
480
  color: #000;
481
  border-top: 2px solid #1a9ac9;
482
+ color: #0073aa;
483
+
484
  }
485
  /*---------------------------------------------------------------------------------------------
486
  *
495
  min-height: 400px;
496
  background: #fff;
497
  border: 1px solid #ccc;
498
+ padding: 40px 20px 20px 20px;
499
  border-radius: 0 5px 5px 5px;
500
  -moz-border-radius: 0 5px 5px 5px;
501
  -webkit-border-radius: 0 5px 5px 5px;
508
  *---------------------------------------------------------------------------------------------*/
509
  .aDBc-sidebar {
510
  float: right;
511
+ /*border: 1px solid #ccc;*/
512
+ /*background: #fff;*/
513
  margin-right: -260px;
514
  margin-top: 42px;
515
  width: 240px;
516
+ border-radius: 2px;
517
+ -moz-border-radius: 2px;
518
+ -webkit-border-radius: 2px;
519
  }
520
  .aDBc-sidebar > div{
521
+ /*padding: 15px;*/
522
  }
523
  .aDBc-sidebar h2{
524
  font-size: 16px;
526
  color: #888;
527
  line-height: 24px;
528
  }
 
 
 
 
 
 
 
 
 
 
529
  .aDBc-grey-row{
530
  height: 20px;
531
  background-color: #f9f9f9;
540
  .aDBc-sidebar-link{
541
  text-decoration: none;
542
  }
543
+ /*.aDBc-support-us{
544
  background: url("../images/rate.png") no-repeat center right;
545
  width: 88px;
546
  height: 18px;
547
  margin-top: 0px;
548
+ }*/
549
+
550
+ #aDBc-upgrade { background-color: #23282d; padding: 15px; }
551
+ #aDBc-upgrade h1 { font-size: 22px; font-weight: bold; color: #fff; text-align: center; }
552
+ #aDBc-upgrade ul { font-size: 14px; margin-left: 30px; }
553
+ #aDBc-upgrade a { display: block; width: 100%; height: 100%; text-decoration: none; color: #fff; }
554
+ #aDBc-upgrade img { width: 110px; height: auto; display: block; margin: 0 auto; }
555
+ #aDBc-upgrade ul li { margin: 5px 0 10px 0; }
556
+ #aDBc-upgrade ul li span { margin-left: -31px; font-size: 26px; margin-right: 6px; }
557
+
558
+ #aDBc-upgrade-form { background-color: #fff; padding: 20px; }
559
+ #aDBc-upgrade-form h1 { margin-top: 0; padding: 0; font-weight: bold; color: #444; }
560
+ #aDBc-upgrade-form input[type="text"], input[type="email"] { width: 90%; margin-bottom: 10px; }
561
+ #aDBc-upgrade-form .aDBc_submit_name { color: #666; }
562
+ #aDBc-upgrade-form .aDBc_unsubscribe { color: #a5a5a5; }
563
 
564
  /*---------------------------------------------------------------------------------------------
565
  *
566
  * Box messages
567
  *
568
  *---------------------------------------------------------------------------------------------*/
569
+ .aDBc-box-warning-orphan {
570
+ background: #fff5cc url("../images/alert.svg") no-repeat scroll 8px 50%;
571
  /*border-bottom: 1px dashed orange;*/
572
  color: #404040;
573
  padding: 10px 10px 10px 40px;
574
+ margin-top: 10px;
575
+ margin-bottom: 25px;
576
+ }
577
+ .aDBc-box-warning {
578
+ background: #fff5cc url("../images/alert_delete.svg") no-repeat scroll 8px 50%;
579
+ /*border-bottom: 1px dashed orange;*/
580
+ color: #404040;
581
+ padding: 10px 10px 10px 70px;
582
+ margin-top: 10px;
583
+ margin-bottom: 25px;
584
  }
585
  .aDBc-box-info {
586
+ background: #f0f5fa url("../images/info.svg") no-repeat scroll 8px 50%;
587
+ /*border-bottom: 1px dashed #ccc;*/
588
  color: #404040;
589
  padding: 10px 10px 10px 40px;
590
+ margin-top: 10px;
591
+ margin-bottom: 25px;
592
  }
593
  .aDBc-right-box{
594
+ float: left;
595
+ width: 190px;
596
  margin-bottom: 5px;
597
  margin-top: 49px;
 
 
 
 
 
598
  font-size: 12px;
599
  color: #888;
600
  }
601
+ .aDBc-right-box > div{
602
+ padding: 20px 10px;
603
+ width: 100%;
604
+ border: 1px solid #eee;
605
+ background: #f9f9f9;
606
+ border-radius: 1px;
607
+ -moz-border-radius: 1px;
608
+ -webkit-border-radius: 1px;
609
+ }
610
  .aDBc-jquery-dialog{
611
  padding:20px;
612
  display:none;
614
 
615
  /*---------------------------------------------------------------------------------------------
616
  *
617
+ * Tool tip for content
618
+ *
619
+ *---------------------------------------------------------------------------------------------*/
620
+ span.aDBc-tooltips {
621
+ position: relative;
622
+ display: inline;
623
+ cursor: pointer;
624
+ color: #000;
625
+ border-bottom:1px dotted orange;
626
+
627
+ }
628
+ span.aDBc-tooltips span {
629
+ position: absolute;
630
+ color: #666666;
631
+ background: #FFFFE0;
632
+ font-size: 13px;
633
+ font-weight: normal;
634
+ padding: 10px;
635
+ visibility: hidden;
636
+ width: 300px;
637
+ border: 1px solid #006799;
638
+ border-radius: 4px;
639
+ -moz-border-radius: 4px;
640
+ -webkit-border-radius: 4px;
641
+ }
642
+ span.aDBc-tooltips span:after {
643
+ content: '';
644
+ position: absolute;
645
+ top: 18px;
646
+ right: 100%;
647
+ margin-top: -8px;
648
+ width: 0;
649
+ height: 0;
650
+ border-right: 8px solid #006799;
651
+ border-top: 8px solid transparent;
652
+ border-bottom: 8px solid transparent;
653
+ }
654
+ span:hover.aDBc-tooltips span {
655
+ visibility: visible;
656
+ left: 100%;
657
+ top: 50%;
658
+ margin-top: -15.5px;
659
+ margin-left: 5px;
660
+ z-index: 999;
661
+ }
662
+
663
+ /*---------------------------------------------------------------------------------------------
664
+ *
665
+ * Tool tip for headers info
666
  *
667
  *---------------------------------------------------------------------------------------------*/
668
+ span.aDBc-tooltips-headers {
669
  position: relative;
670
  display: inline;
671
  cursor: pointer;
672
+ color: #000;
673
  }
674
+ span.aDBc-tooltips-headers span {
675
  position: absolute;
676
+ text-align: left;
677
+ line-height: 22px;
678
  color: #fff;
679
+ background: #222;
680
+ opacity: 1 !important;
681
+ font-size: 13px;
682
  font-weight: normal;
683
+ padding: 10px;
684
  visibility: hidden;
685
+ width: 240px;
686
+ border: 1px solid #222;
687
+ border-radius: 4px;
688
+ -moz-border-radius: 4px;
689
+ -webkit-border-radius: 4px;
690
  }
691
+ span.aDBc-tooltips-headers span:after {
692
  content: '';
693
  position: absolute;
694
  top: 18px;
695
  right: 100%;
696
  margin-top: -8px;
697
+ width: 0;
698
+ height: 0;
699
+ border-right: 8px solid #222;
700
  border-top: 8px solid transparent;
701
  border-bottom: 8px solid transparent;
702
  }
703
+ span:hover.aDBc-tooltips-headers span {
704
  visibility: visible;
 
705
  left: 100%;
706
  top: 50%;
707
+ margin-top: -15.5px;
708
+ margin-left: 8px;
709
  z-index: 999;
710
  }
711
+ .aDBc-info-image {
712
+ width: 15px;
713
+ vertical-align: middle;
714
+ margin-left: 2px;
715
+ }
716
 
717
  /*---------------------------------------------------------------------------------------------
718
  *
719
  * Premium page style
720
  *
721
  *---------------------------------------------------------------------------------------------*/
722
+ .aDBc-please-activate-msg{
723
+ border-left: 5px solid orange !important;
724
+ background: #fff;
725
+ padding: 1px 20px;
 
 
 
 
 
 
726
  }
727
  .aDBc-vertical-box{
728
  float: left;
734
  .aDBc-vertical-box > a{
735
  text-decoration: none;
736
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
737
 
738
  /*---------------------------------------------------------------------------------------------
739
  *
761
  }
762
  .aDBc-overview-box-line > li{
763
  line-height: 32px;
764
+ margin-bottom: 20px;
765
+ padding: 0px 10px;
766
  }
767
  .aDBc-overview-text-left{
768
  float: left;
769
+ background: url("../images/check_ok.svg") no-repeat left center;
770
  padding-left: 30px;
771
  width: 180px;
772
  }
773
  .aDBc-overview-text-left-warning{
774
  float: left;
775
+ background: url("../images/alert.svg") no-repeat left center;
776
  padding-left: 30px;
777
  width: 180px;
778
  }
789
  height: 30px !important;
790
  padding: 1px 20px !important;
791
  margin-top: 10px !important;
792
+ }
793
+
794
+ .aDBc_info_icon {
795
+ margin-right: 8px;
796
+ vertical-align: middle;
797
+ padding-right:14px;
798
+ background: url("../images/information.svg") no-repeat left center;
799
+ }
800
+
801
+ .aDBc_info_titles {
802
+ vertical-align: middle;
803
+ background: url("../images/information2.svg") no-repeat left center;
804
+ padding:0px 5px;
805
+ vertical-align: middle;
806
+ margin-left: 4px;
807
+ }
808
+
809
+ .aDBc_keep_button {
810
+ width: 35px;
811
+ padding: 0px !important;
812
+ font-size: 12px !important;
813
+ height: 25px !important;
814
+ }
815
+
816
+ .aDBc_keep_input {
817
+ width: 35px;
818
+ font-size: 13px;
819
+ height: 28px;
820
+ border: 1px solid #e5e5e5;
821
+ text-align: center;
822
+ border-radius: 2px;
823
+ -moz-border-radius: 2px;
824
+ -webkit-border-radius: 2px;
825
+ box-shadow:0 0 10px #f1f1f1;
826
+ display: none;
827
+ }
828
+
829
+ .aDBc_keep_link{
830
+ cursor: pointer;
831
+ }
832
+
833
+ .aDBc_keep_cancel_link {
834
+ font-size: 12px;
835
+ cursor: pointer;
836
+ display: none;
837
+ }
838
+
839
+ /* Progress bar */
840
+ #aDBc_progress_container{
841
+ margin-top: 5px;
842
+ display: none;
843
+ }
844
+ .aDBc_progress-bar {
845
+ float: left;
846
+ width: 0;
847
+ height: 100%;
848
+ font-size: 12px;
849
+ line-height: 20px;
850
+ color: #fff;
851
+ text-align: center;
852
+ background-color: #337ab7;
853
+ -webkit-transition: width 1s ease;
854
+ -o-transition: width 1s ease;
855
+ transition: width 1s ease;
856
+ }
857
+
858
+ /*---------------------------------------------------------------------------------------------
859
+ *
860
+ * Premium page style
861
+ *
862
+ *---------------------------------------------------------------------------------------------*/
863
+ .aDBc-upgrade-msg{
864
+ border-left: 6px solid #D091BE !important;
865
+ background: #FFFFD4;
866
+ padding: 1px 8px;
867
+ margin-bottom: 20px;
868
+ }
869
+ .aDBc-check-list{
870
+ background: url("../images/check_ok.svg") no-repeat;
871
+ padding-left: 20px;
872
+ margin-left: 20px;
873
+ }
874
+ .aDBc-vertical-box{
875
+ float: left;
876
+ background: #f9f9f9;
877
+ width: 28%;
878
+ margin:5px 15px;
879
+ min-height: 350px;
880
+ }
881
+ .aDBc-vertical-box > a{
882
+ text-decoration: none;
883
+ }
884
+ .aDBc-vertical-box-head{
885
+ color: #fff;
886
+ font-size: 15px;
887
+ font-weight: bold;
888
+ text-align: center;
889
+ padding: 12px;
890
+ background: #69ADE2;
891
+ border-radius: 8px;
892
+ }
893
+ .aDBc-vertical-box-line1{
894
+ text-align: center;
895
+ margin-top: 20px;
896
+ }
897
+ .aDBc-vertical-box-line2{
898
+ text-align: center;
899
+ margin-top: 50px;
900
+ }
901
+ /*---------------------------------------------------------------------------------------------
902
+ * Tooltip for upgrade to premium
903
+ *---------------------------------------------------------------------------------------------*/
904
+ .aDBc_premium_tooltip {
905
+ position: relative;
906
+ display: inline-block;
907
+ }
908
+
909
+ .aDBc_premium_tooltip .aDBc_premium_tooltiptext {
910
+ visibility: hidden;
911
+ background-color: #fff;
912
+ text-align: center;
913
+ color: #444;
914
+ padding: 6px 0;
915
+ border: 1px solid orange;
916
+ top: 100%;
917
+ left: 50%;
918
+ margin-left: -72px;
919
+ /* Position the tooltip */
920
+ position: absolute;
921
+ z-index: 1;
922
+ }
923
+
924
+ .aDBc_premium_tooltip:hover .aDBc_premium_tooltiptext {
925
+ visibility: visible;
926
  }
images/add_schedule.svg ADDED
@@ -0,0 +1,6 @@
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" id="Capa_1" x="0px" y="0px" width="512px" height="512px" viewBox="0 0 511.398 511.398" style="enable-background:new 0 0 511.398 511.398;" xml:space="preserve" class=""><g><g>
3
+ <g>
4
+ <path d="M477.549,182.379H329.018V33.847c0-18.69-15.154-33.844-33.844-33.844H216.22c-18.69,0-33.844,15.153-33.844,33.844 v148.526H33.844C15.153,182.373,0,197.526,0,216.216v78.966c0,18.691,15.153,33.844,33.844,33.844h148.532v148.527 c0,18.689,15.153,33.842,33.844,33.842h78.96c18.691,0,33.844-15.152,33.844-33.842V329.026h148.533 c18.689,0,33.842-15.152,33.842-33.844v-78.966C511.393,197.526,496.246,182.379,477.549,182.379z" data-original="#000000" class="active-path" data-old_color="#00A8FF" fill="#00C6FF"/>
5
+ </g>
6
+ </g></g> </svg>
images/alarm-clock.svg ADDED
@@ -0,0 +1,11 @@
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" id="Capa_1" x="0px" y="0px" viewBox="0 0 57.157 57.157" style="enable-background:new 0 0 57.157 57.157;" xml:space="preserve" width="512px" height="512px" class=""><g><circle style="fill:#FFFFFF" cx="28.578" cy="29.157" r="26" data-original="#E0E1E2" class="active-path" data-old_color="#ffffff"/><circle style="fill:#FFFFFF;" cx="28.578" cy="29.157" r="15" data-original="#FFFFFF" class=""/><path style="fill:#424A60;" d="M12.578,57.157c-0.256,0-0.512-0.098-0.707-0.293c-0.391-0.391-0.391-1.023,0-1.414l3.933-3.933 c0.391-0.391,1.023-0.391,1.414,0s0.391,1.023,0,1.414l-3.933,3.933C13.09,57.059,12.834,57.157,12.578,57.157z" data-original="#424A60" class=""/><path style="fill:#424A60;" d="M44.578,57.157c-0.256,0-0.512-0.098-0.707-0.293l-3.963-3.963c-0.391-0.391-0.391-1.023,0-1.414 s1.023-0.391,1.414,0l3.963,3.963c0.391,0.391,0.391,1.023,0,1.414C45.09,57.059,44.834,57.157,44.578,57.157z" data-original="#424A60" class=""/><path style="fill:#F6F9F6" d="M46.672,11.371c-0.256,0-0.512-0.098-0.707-0.293c-0.391-0.391-0.391-1.023,0-1.414l3-3 c0.391-0.391,1.023-0.391,1.414,0s0.391,1.023,0,1.414l-3,3C47.183,11.274,46.927,11.371,46.672,11.371z" data-original="#C7CAC7" class="" data-old_color="#F0F7F0"/><path style="fill:#F6F9F6" d="M10.485,11.371c-0.256,0-0.512-0.098-0.707-0.293l-3-3c-0.391-0.391-0.391-1.023,0-1.414 s1.023-0.391,1.414,0l3,3c0.391,0.391,0.391,1.023,0,1.414C10.997,11.274,10.741,11.371,10.485,11.371z" data-original="#C7CAC7" class="" data-old_color="#F0F7F0"/><path style="fill:#26B99A;" d="M28.578,57.157c-15.439,0-28-12.561-28-28s12.561-28,28-28s28,12.561,28,28 S44.018,57.157,28.578,57.157z M28.578,5.157c-13.234,0-24,10.767-24,24s10.766,24,24,24s24-10.767,24-24S41.812,5.157,28.578,5.157 z" data-original="#26B99A" class=""/><g>
3
+ <path style="fill:#26B99A;" d="M28.578,6.036c-0.552,0-1,0.447-1,1v1c0,0.553,0.448,1,1,1s1-0.447,1-1v-1 C29.578,6.483,29.131,6.036,28.578,6.036z" data-original="#26B99A" class=""/>
4
+ <path style="fill:#26B99A;" d="M28.578,49.036c-0.552,0-1,0.447-1,1v1c0,0.553,0.448,1,1,1s1-0.447,1-1v-1 C29.578,49.483,29.131,49.036,28.578,49.036z" data-original="#26B99A" class=""/>
5
+ <path style="fill:#26B99A;" d="M50.578,28.036h-1c-0.552,0-1,0.447-1,1s0.448,1,1,1h1c0.552,0,1-0.447,1-1 S51.131,28.036,50.578,28.036z" data-original="#26B99A" class=""/>
6
+ <path style="fill:#26B99A;" d="M7.578,28.036h-1c-0.552,0-1,0.447-1,1s0.448,1,1,1h1c0.552,0,1-0.447,1-1 S8.131,28.036,7.578,28.036z" data-original="#26B99A" class=""/>
7
+ <path style="fill:#26B99A;" d="M43.427,12.772l-0.707,0.707c-0.391,0.391-0.391,1.023,0,1.414c0.195,0.195,0.451,0.293,0.707,0.293 s0.512-0.098,0.707-0.293l0.707-0.707c0.391-0.391,0.391-1.023,0-1.414S43.818,12.381,43.427,12.772z" data-original="#26B99A" class=""/>
8
+ <path style="fill:#26B99A;" d="M13.022,43.178l-0.707,0.707c-0.391,0.391-0.391,1.023,0,1.414c0.195,0.195,0.451,0.293,0.707,0.293 s0.512-0.098,0.707-0.293l0.707-0.707c0.391-0.391,0.391-1.023,0-1.414S13.413,42.788,13.022,43.178z" data-original="#26B99A" class=""/>
9
+ <path style="fill:#26B99A;" d="M44.134,43.178c-0.391-0.391-1.023-0.391-1.414,0s-0.391,1.023,0,1.414l0.707,0.707 c0.195,0.195,0.451,0.293,0.707,0.293s0.512-0.098,0.707-0.293c0.391-0.391,0.391-1.023,0-1.414L44.134,43.178z" data-original="#26B99A" class=""/>
10
+ <path style="fill:#26B99A;" d="M13.729,12.772c-0.391-0.391-1.023-0.391-1.414,0s-0.391,1.023,0,1.414l0.707,0.707 c0.195,0.195,0.451,0.293,0.707,0.293s0.512-0.098,0.707-0.293c0.391-0.391,0.391-1.023,0-1.414L13.729,12.772z" data-original="#26B99A" class=""/>
11
+ </g><path style="fill:#424A60;" d="M39.578,30.157h-8c-0.552,0-1-0.447-1-1s0.448-1,1-1h8c0.552,0,1,0.447,1,1 S40.131,30.157,39.578,30.157z" data-original="#424A60" class=""/><path style="fill:#424A60;" d="M28.578,27.157c-0.552,0-1-0.447-1-1v-11c0-0.553,0.448-1,1-1s1,0.447,1,1v11 C29.578,26.709,29.131,27.157,28.578,27.157z" data-original="#424A60" class=""/><path style="fill:#424A60;" d="M28.578,33.157c-2.206,0-4-1.794-4-4s1.794-4,4-4s4,1.794,4,4S30.784,33.157,28.578,33.157z M28.578,27.157c-1.103,0-2,0.897-2,2s0.897,2,2,2s2-0.897,2-2S29.681,27.157,28.578,27.157z" data-original="#424A60" class=""/><path style="fill:#F8FBFB" d="M54.493,2.086c2.781,2.781,2.781,7.29,0,10.071L44.421,2.086C47.203-0.695,51.711-0.695,54.493,2.086 z" data-original="#E7ECED" class="" data-old_color="#EDF4F4"/><path style="fill:#F8FBFB" d="M2.664,2.086c-2.781,2.781-2.781,7.29,0,10.071L12.735,2.086C9.954-0.695,5.445-0.695,2.664,2.086z" data-original="#E7ECED" class="" data-old_color="#EDF4F4"/></g> </svg>
images/alert.svg ADDED
@@ -0,0 +1 @@
 
1
+ <svg height="13pt" viewBox="0 0 512 512.92258" width="13pt" xmlns="http://www.w3.org/2000/svg"><path d="m433.347656 512.921875h-352.898437c-27.71875-.003906-53.460938-14.355469-68.039063-37.9375-14.574218-23.578125-15.902344-53.023437-3.511718-77.820313l176.433593-352.914062c13.542969-27.117188 41.253907-44.25 71.566407-44.25s58.023437 17.132812 71.566406 44.25l176.433594 352.914062c12.390624 24.796876 11.0625 54.242188-3.511719 77.820313-14.574219 23.582031-40.320313 37.933594-68.039063 37.9375zm0 0" fill="#ff7761"/><g fill="#fff"><path d="m256.898438 128.203125c8.835937 0 16 7.164063 16 16v192c0 8.835937-7.164063 16-16 16-8.835938 0-16-7.164063-16-16v-192c0-8.835937 7.164062-16 16-16zm0 0"/><path d="m240.898438 384.203125h32v32h-32zm0 0"/></g></svg>
images/alert_delete.svg ADDED
@@ -0,0 +1 @@
 
1
+ <svg height="35pt" viewBox="0 0 512 512.92258" width="35pt" xmlns="http://www.w3.org/2000/svg"><path d="m433.347656 512.921875h-352.898437c-27.71875-.003906-53.460938-14.355469-68.039063-37.9375-14.574218-23.578125-15.902344-53.023437-3.511718-77.820313l176.433593-352.914062c13.542969-27.117188 41.253907-44.25 71.566407-44.25s58.023437 17.132812 71.566406 44.25l176.433594 352.914062c12.390624 24.796876 11.0625 54.242188-3.511719 77.820313-14.574219 23.582031-40.320313 37.933594-68.039063 37.9375zm0 0" fill="#ff7761"/><g fill="#fff"><path d="m256.898438 128.203125c8.835937 0 16 7.164063 16 16v192c0 8.835937-7.164063 16-16 16-8.835938 0-16-7.164063-16-16v-192c0-8.835937 7.164062-16 16-16zm0 0"/><path d="m240.898438 384.203125h32v32h-32zm0 0"/></g></svg>
images/check_ok.png DELETED
Binary file
images/check_ok.svg ADDED
@@ -0,0 +1,4 @@
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" id="Capa_1" x="0px" y="0px" width="15px" height="15px" viewBox="0 0 490.434 490.433" style="enable-background:new 0 0 490.434 490.433;" xml:space="preserve"><g><g>
3
+ <path d="M472.003,58.36l-13.132-11.282c-21.798-18.732-54.554-16.644-73.799,4.697L165.39,295.359l-66.312-57.112 c-21.775-18.753-54.536-16.707-73.804,4.611l-11.611,12.848c-9.416,10.413-14.305,24.149-13.595,38.18 c0.717,14.023,6.973,27.188,17.402,36.6l121.553,111.311c10.524,9.883,24.628,15.037,39.044,14.272 c14.416-0.763,27.894-7.386,37.311-18.329l262.245-304.71c9.162-10.646,13.717-24.494,12.661-38.496 C489.229,80.522,482.655,67.512,472.003,58.36z" data-original="#000000" class="active-path" data-old_color="#000000" fill="#25C1EE"/>
4
+ </g></g> </svg>
images/db_clean.png DELETED
Binary file
images/db_clean.svg ADDED
@@ -0,0 +1,2 @@
 
 
1
+ <?xml version="1.0"?>
2
+ <svg xmlns="http://www.w3.org/2000/svg" height="512px" viewBox="0 0 512 512" width="512px" class="hovered-paths"><g><path d="m256 0c-141.164062 0-256 114.835938-256 256s114.835938 256 256 256 256-114.835938 256-256-114.835938-256-256-256zm0 0" fill="#2196f3" data-original="#2196F3" class="" data-old_color="#2196f3" style="fill:#FFFFFF"/><path d="m385.75 201.75-138.667969 138.664062c-4.160156 4.160157-9.621093 6.253907-15.082031 6.253907s-10.921875-2.09375-15.082031-6.253907l-69.332031-69.332031c-8.34375-8.339843-8.34375-21.824219 0-30.164062 8.339843-8.34375 21.820312-8.34375 30.164062 0l54.25 54.25 123.585938-123.582031c8.339843-8.34375 21.820312-8.34375 30.164062 0 8.339844 8.339843 8.339844 21.820312 0 30.164062zm0 0" fill="#fafafa" data-original="#FAFAFA" class="hovered-path active-path" style="fill:#44C3FF" data-old_color="#fafafa"/></g> </svg>
images/db_not_clean.png DELETED
Binary file
images/donate.gif DELETED
Binary file
images/edit_schedule.svg ADDED
@@ -0,0 +1,4 @@
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" id="Capa_1" x="0px" y="0px" width="512px" height="512px" viewBox="0 0 485.219 485.22" style="enable-background:new 0 0 485.219 485.22;" xml:space="preserve" class=""><g><g>
3
+ <path d="M467.476,146.438l-21.445,21.455L317.35,39.23l21.445-21.457c23.689-23.692,62.104-23.692,85.795,0l42.886,42.897 C491.133,84.349,491.133,122.748,467.476,146.438z M167.233,403.748c-5.922,5.922-5.922,15.513,0,21.436 c5.925,5.955,15.521,5.955,21.443,0L424.59,189.335l-21.469-21.457L167.233,403.748z M60,296.54c-5.925,5.927-5.925,15.514,0,21.44 c5.922,5.923,15.518,5.923,21.443,0L317.35,82.113L295.914,60.67L60,296.54z M338.767,103.54L102.881,339.421 c-11.845,11.822-11.815,31.041,0,42.886c11.85,11.846,31.038,11.901,42.914-0.032l235.886-235.837L338.767,103.54z M145.734,446.572c-7.253-7.262-10.749-16.465-12.05-25.948c-3.083,0.476-6.188,0.919-9.36,0.919 c-16.202,0-31.419-6.333-42.881-17.795c-11.462-11.491-17.77-26.687-17.77-42.887c0-2.954,0.443-5.833,0.859-8.703 c-9.803-1.335-18.864-5.629-25.972-12.737c-0.682-0.677-0.917-1.596-1.538-2.338L0,485.216l147.748-36.986 C147.097,447.637,146.36,447.193,145.734,446.572z" data-original="#000000" class="active-path" data-old_color="#00BFFF" fill="#00C6FF"/>
4
+ </g></g> </svg>
images/go_back.png DELETED
Binary file
images/go_back.svg ADDED
@@ -0,0 +1,2 @@
 
 
1
+ <?xml version="1.0"?>
2
+ <svg xmlns="http://www.w3.org/2000/svg" id="Layer_1" enable-background="new 0 0 511.34 511.34" height="512px" viewBox="0 0 511.34 511.34" width="512px" class=""><g><path d="m175.974 49.719-170.67 192c-7.073 7.957-7.073 19.947 0 27.904l170.67 192c12.788 14.386 36.695 5.326 36.695-13.952v-384c.001-19.248-23.885-28.36-36.695-13.952z" fill="#fff3e4" data-original="#FFF3E4" class="active-path" data-old_color="#fff3e4" style="fill:#9EE0FF"/><path d="m383.67 181.341h-64.33v-117.67c0-19.248-23.886-28.36-36.695-13.952l-170.67 192c-7.073 7.957-7.073 19.947 0 27.904l170.67 192c12.782 14.378 36.695 5.286 36.695-13.952v-117.67h64.33c35.106 0 59.151 14.841 73.508 45.37 11.712 24.905 12.16 50.896 12.163 51.09.065 11.456 9.328 20.88 21.06 20.88 11.574-.033 20.94-9.426 20.94-21v-117.34c-.001-70.391-57.274-127.66-127.671-127.66z" fill="#ffebd2" data-original="#FFEBD2" class="" data-old_color="#ffebd2" style="fill:#48BDF3"/></g> </svg>
images/green_clock.svg ADDED
@@ -0,0 +1,7 @@
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" id="Capa_1" x="0px" y="0px" width="512px" height="512px" viewBox="0 0 97.16 97.16" style="enable-background:new 0 0 97.16 97.16;" xml:space="preserve"><g><g>
3
+ <g>
4
+ <path d="M48.58,0C21.793,0,0,21.793,0,48.58s21.793,48.58,48.58,48.58s48.58-21.793,48.58-48.58S75.367,0,48.58,0z M48.58,86.823 c-21.087,0-38.244-17.155-38.244-38.243S27.493,10.337,48.58,10.337S86.824,27.492,86.824,48.58S69.667,86.823,48.58,86.823z" data-original="#000000" class="active-path" data-old_color="#000000" fill="#1CD60A"/>
5
+ <path d="M73.898,47.08H52.066V20.83c0-2.209-1.791-4-4-4c-2.209,0-4,1.791-4,4v30.25c0,2.209,1.791,4,4,4h25.832 c2.209,0,4-1.791,4-4S76.107,47.08,73.898,47.08z" data-original="#000000" class="active-path" data-old_color="#000000" fill="#1CD60A"/>
6
+ </g>
7
+ </g></g> </svg>
images/grey_clock.svg ADDED
@@ -0,0 +1,7 @@
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" id="Capa_1" x="0px" y="0px" width="512px" height="512px" viewBox="0 0 97.16 97.16" style="enable-background:new 0 0 97.16 97.16;" xml:space="preserve"><g><g>
3
+ <g>
4
+ <path d="M48.58,0C21.793,0,0,21.793,0,48.58s21.793,48.58,48.58,48.58s48.58-21.793,48.58-48.58S75.367,0,48.58,0z M48.58,86.823 c-21.087,0-38.244-17.155-38.244-38.243S27.493,10.337,48.58,10.337S86.824,27.492,86.824,48.58S69.667,86.823,48.58,86.823z" data-original="#000000" class="active-path" data-old_color="#000000" fill="#eee"/>
5
+ <path d="M73.898,47.08H52.066V20.83c0-2.209-1.791-4-4-4c-2.209,0-4,1.791-4,4v30.25c0,2.209,1.791,4,4,4h25.832 c2.209,0,4-1.791,4-4S76.107,47.08,73.898,47.08z" data-original="#000000" class="active-path" data-old_color="#000000" fill="#eee"/>
6
+ </g>
7
+ </g></g> </svg>
images/help.svg ADDED
@@ -0,0 +1,70 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0" encoding="iso-8859-1"?>
2
+ <!-- Generator: Adobe Illustrator 19.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
3
+ <svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
4
+ viewBox="0 0 504.124 504.124" style="enable-background:new 0 0 504.124 504.124;" xml:space="preserve">
5
+ <path style="fill:#E4E7E7;" d="M441.108,244.578l-1.182-16.148l10.24-10.24c45.292-45.292,45.292-119.335,0-164.234
6
+ c-45.292-45.292-118.942-45.292-164.234,0l-10.24,10.24c-5.12-0.788-10.634-1.182-16.148-1.182l17.723-17.723
7
+ c50.018-50.018,131.545-50.412,181.563,0c50.018,50.018,50.018,131.545,0,181.563C458.831,226.855,441.108,244.578,441.108,244.578z
8
+ M228.825,64.591l-10.24-10.24c-45.292-45.292-119.335-45.292-164.234,0c-45.686,44.898-45.686,118.942,0,164.234l10.24,10.24
9
+ c-0.788,5.12-1.182,10.634-1.182,16.148L45.686,227.25c-50.018-50.018-50.412-131.545,0-181.563
10
+ c50.018-50.018,131.545-50.018,181.563,0l17.723,17.723C239.458,63.409,233.945,63.803,228.825,64.591z M63.015,259.545
11
+ l1.182,16.148l-10.24,10.24C8.665,331.225,8.665,405.268,53.563,450.166c45.292,45.292,118.942,45.292,164.234,0l10.24-10.24
12
+ c5.12,0.788,10.634,1.182,16.148,1.182l-17.723,17.723c-50.018,50.018-131.545,50.412-181.563,0.394S-5.12,327.68,45.292,277.661
13
+ L63.015,259.545z M275.298,439.532l10.24,10.24c45.292,45.292,119.335,45.292,164.234,0c45.292-45.292,45.292-118.942-0.394-164.234
14
+ l-10.24-10.24c0.788-5.12,1.182-10.634,1.182-16.148l17.723,17.723c50.018,50.018,50.412,131.545,0.394,181.563
15
+ s-131.545,50.018-181.563-0.394l-17.723-17.723C264.665,440.714,270.178,440.32,275.298,439.532z"/>
16
+ <path style="fill:#E2574C;" d="M252.062,0C113.034,0,0,113.034,0,252.062s112.64,252.062,252.062,252.062
17
+ c139.028,0,252.062-113.034,252.062-252.062S391.089,0,252.062,0z M252.062,378.092c-69.711,0-126.031-56.32-126.031-126.031
18
+ s56.32-126.031,126.031-126.031s126.031,56.32,126.031,126.031S321.772,378.092,252.062,378.092z"/>
19
+ <path style="fill:#D95449;" d="M252.062,95.705c-86.252,0-156.357,70.105-156.357,156.357s70.105,156.357,156.357,156.357
20
+ s156.357-70.105,156.357-156.357S338.314,95.705,252.062,95.705z M252.062,378.092c-69.711,0-126.031-56.32-126.031-126.031
21
+ s56.32-126.031,126.031-126.031s126.031,56.32,126.031,126.031S321.772,378.092,252.062,378.092z"/>
22
+ <path style="fill:#E5685E;" d="M252.062,35.446c-119.729,0-216.615,96.886-216.615,216.615s96.886,216.615,216.615,216.615
23
+ s216.615-96.886,216.615-216.615S371.791,35.446,252.062,35.446z M252.062,452.923c-111.065,0-200.862-89.797-200.862-200.862
24
+ S140.997,51.2,252.062,51.2s200.862,89.797,200.862,200.862S363.126,452.923,252.062,452.923z"/>
25
+ <path style="fill:#EFEFEF;" d="M193.378,363.52c-22.843-11.815-41.354-30.72-53.169-53.169l-90.978,91.372
26
+ c14.966,20.086,32.689,38.203,53.169,53.169L193.378,363.52z M310.351,140.209c22.843,11.815,41.354,30.326,53.169,53.169
27
+ l91.372-90.978c-14.966-20.086-33.083-38.203-53.169-53.169L310.351,140.209z M49.231,102.4l90.978,90.978
28
+ c11.815-22.843,30.326-41.354,53.169-53.169L102.4,49.231C82.314,64.197,64.197,82.314,49.231,102.4z M454.892,401.723
29
+ l-90.978-90.978c-11.815,22.843-30.326,41.354-53.169,53.169l90.978,90.978C421.809,439.926,439.926,421.809,454.892,401.723z"/>
30
+ <path style="fill:#E6E6E6;" d="M332.8,118.154l-22.055,22.055c22.843,11.815,41.354,30.326,53.169,53.169l22.055-22.055
31
+ C372.578,149.662,354.462,131.151,332.8,118.154z M140.209,310.351L118.154,332.8c12.997,21.662,31.508,39.778,53.169,53.169
32
+ l22.055-22.055C170.929,351.705,152.418,333.194,140.209,310.351z M310.745,363.914l22.055,22.055
33
+ c21.662-12.997,39.778-31.508,53.169-53.169l-22.055-22.055C351.705,333.194,333.194,351.705,310.745,363.914z M193.772,140.603
34
+ l-22.449-22.449c-21.662,13.391-39.778,31.508-53.169,53.169l22.055,22.055C152.418,170.929,170.929,152.418,193.772,140.603z"/>
35
+ <path style="fill:#F1F1F1;" d="M85.858,365.095l-11.422,11.422c14.572,20.48,32.295,38.597,53.169,53.169l11.422-11.422
36
+ C118.154,403.692,100.037,385.969,85.858,365.095z M418.265,365.095c-14.178,20.874-32.295,38.991-53.169,53.169l11.422,11.422
37
+ c20.48-14.572,38.597-32.689,53.169-53.169L418.265,365.095z M85.858,139.028c14.178-20.874,32.295-38.991,53.169-53.169L128,74.831
38
+ C107.52,89.403,89.403,107.52,74.831,128L85.858,139.028z M418.265,139.028l11.422-11.422
39
+ c-14.572-20.48-32.689-38.597-53.169-53.169l-11.422,11.422C385.969,100.037,403.692,118.154,418.265,139.028z"/>
40
+ <g>
41
+ </g>
42
+ <g>
43
+ </g>
44
+ <g>
45
+ </g>
46
+ <g>
47
+ </g>
48
+ <g>
49
+ </g>
50
+ <g>
51
+ </g>
52
+ <g>
53
+ </g>
54
+ <g>
55
+ </g>
56
+ <g>
57
+ </g>
58
+ <g>
59
+ </g>
60
+ <g>
61
+ </g>
62
+ <g>
63
+ </g>
64
+ <g>
65
+ </g>
66
+ <g>
67
+ </g>
68
+ <g>
69
+ </g>
70
+ </svg>
images/icon-128x128.png ADDED
Binary file
images/info.png DELETED
Binary file
images/info.svg ADDED
@@ -0,0 +1,4 @@
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" id="Capa_1" x="0px" y="0px" viewBox="0 0 23.625 23.625" style="enable-background:new 0 0 23.625 23.625;" xml:space="preserve" width="20px" height="20px" class=""><g><g>
3
+ <path d="M11.812,0C5.289,0,0,5.289,0,11.812s5.289,11.813,11.812,11.813s11.813-5.29,11.813-11.813 S18.335,0,11.812,0z M14.271,18.307c-0.608,0.24-1.092,0.422-1.455,0.548c-0.362,0.126-0.783,0.189-1.262,0.189 c-0.736,0-1.309-0.18-1.717-0.539s-0.611-0.814-0.611-1.367c0-0.215,0.015-0.435,0.045-0.659c0.031-0.224,0.08-0.476,0.147-0.759 l0.761-2.688c0.067-0.258,0.125-0.503,0.171-0.731c0.046-0.23,0.068-0.441,0.068-0.633c0-0.342-0.071-0.582-0.212-0.717 c-0.143-0.135-0.412-0.201-0.813-0.201c-0.196,0-0.398,0.029-0.605,0.09c-0.205,0.063-0.383,0.12-0.529,0.176l0.201-0.828 c0.498-0.203,0.975-0.377,1.43-0.521c0.455-0.146,0.885-0.218,1.29-0.218c0.731,0,1.295,0.178,1.692,0.53 c0.395,0.353,0.594,0.812,0.594,1.376c0,0.117-0.014,0.323-0.041,0.617c-0.027,0.295-0.078,0.564-0.152,0.811l-0.757,2.68 c-0.062,0.215-0.117,0.461-0.167,0.736c-0.049,0.275-0.073,0.485-0.073,0.626c0,0.356,0.079,0.599,0.239,0.728 c0.158,0.129,0.435,0.194,0.827,0.194c0.185,0,0.392-0.033,0.626-0.097c0.232-0.064,0.4-0.121,0.506-0.17L14.271,18.307z M14.137,7.429c-0.353,0.328-0.778,0.492-1.275,0.492c-0.496,0-0.924-0.164-1.28-0.492c-0.354-0.328-0.533-0.727-0.533-1.193 c0-0.465,0.18-0.865,0.533-1.196c0.356-0.332,0.784-0.497,1.28-0.497c0.497,0,0.923,0.165,1.275,0.497 c0.353,0.331,0.53,0.731,0.53,1.196C14.667,6.703,14.49,7.101,14.137,7.429z" data-original="#030104" class="active-path" data-old_color="#030104" fill="#0CBDF0"/>
4
+ </g></g> </svg>
images/information.svg ADDED
@@ -0,0 +1,54 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0" encoding="iso-8859-1"?>
2
+ <!-- Generator: Adobe Illustrator 19.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
3
+ <svg version="1.1" id="Capa_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
4
+ viewBox="0 0 437.6 437.6" style="enable-background:new 0 0 437.6 437.6;" xml:space="preserve">
5
+ <g>
6
+ <g>
7
+ <g>
8
+ <path d="M194,142.8c0.8,1.6,1.6,3.2,2.4,4.4c0.8,1.2,2,2.4,2.8,3.6c1.2,1.2,2.4,2.4,4,3.6c1.2,0.8,2.8,2,4.8,2.4
9
+ c1.6,0.8,3.2,1.2,5.2,1.6c2,0.4,3.6,0.4,5.2,0.4c1.6,0,3.6,0,5.2-0.4c1.6-0.4,3.2-0.8,4.4-1.6h0.4c1.6-0.8,3.2-1.6,4.8-2.8
10
+ c1.2-0.8,2.4-2,3.6-3.2l0.4-0.4c1.2-1.2,2-2.4,2.8-3.6s1.6-2.4,2-4c0-0.4,0-0.4,0.4-0.8c0.8-1.6,1.2-3.6,1.6-5.2
11
+ c0.4-1.6,0.4-3.6,0.4-5.2s0-3.6-0.4-5.2c-0.4-1.6-0.8-3.2-1.6-5.2c-1.2-2.8-2.8-5.2-4.8-7.2c-0.4-0.4-0.4-0.4-0.8-0.8
12
+ c-1.2-1.2-2.4-2-4-3.2c-1.6-0.8-2.8-1.6-4.4-2.4c-1.6-0.8-3.2-1.2-4.8-1.6c-2-0.4-3.6-0.4-5.2-0.4c-1.6,0-3.6,0-5.2,0.4
13
+ c-1.6,0.4-3.2,0.8-4.8,1.6H208c-1.6,0.8-3.2,1.6-4.4,2.4c-1.6,1.2-2.8,2-4,3.2c-1.2,1.2-2.4,2.4-3.2,3.6
14
+ c-0.8,1.2-1.6,2.8-2.4,4.4c-0.8,1.6-1.2,3.2-1.6,4.8c-0.4,2-0.4,3.6-0.4,5.2c0,1.6,0,3.6,0.4,5.2
15
+ C192.8,139.6,193.6,141.2,194,142.8z"/>
16
+ <path d="M249.6,289.2h-9.2v-98c0-5.6-4.4-10.4-10.4-10.4h-42c-5.6,0-10.4,4.4-10.4,10.4v21.6c0,5.6,4.4,10.4,10.4,10.4h8.4v66.4
17
+ H188c-5.6,0-10.4,4.4-10.4,10.4v21.6c0,5.6,4.4,10.4,10.4,10.4h61.6c5.6,0,10.4-4.4,10.4-10.4V300
18
+ C260,294,255.2,289.2,249.6,289.2z"/>
19
+ <path d="M218.8,0C98,0,0,98,0,218.8s98,218.8,218.8,218.8s218.8-98,218.8-218.8S339.6,0,218.8,0z M218.8,408.8
20
+ c-104.8,0-190-85.2-190-190s85.2-190,190-190s190,85.2,190,190S323.6,408.8,218.8,408.8z"/>
21
+ </g>
22
+ </g>
23
+ </g>
24
+ <g>
25
+ </g>
26
+ <g>
27
+ </g>
28
+ <g>
29
+ </g>
30
+ <g>
31
+ </g>
32
+ <g>
33
+ </g>
34
+ <g>
35
+ </g>
36
+ <g>
37
+ </g>
38
+ <g>
39
+ </g>
40
+ <g>
41
+ </g>
42
+ <g>
43
+ </g>
44
+ <g>
45
+ </g>
46
+ <g>
47
+ </g>
48
+ <g>
49
+ </g>
50
+ <g>
51
+ </g>
52
+ <g>
53
+ </g>
54
+ </svg>
images/information2.svg ADDED
@@ -0,0 +1,48 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0" encoding="iso-8859-1"?>
2
+ <!-- Generator: Adobe Illustrator 19.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
3
+ <svg version="1.1" id="Capa_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
4
+ viewBox="0 0 512 512" style="enable-background:new 0 0 512 512;" xml:space="preserve">
5
+ <g>
6
+ <g>
7
+ <g>
8
+ <circle cx="256" cy="378.5" r="25"/>
9
+ <path d="M256,0C114.516,0,0,114.497,0,256c0,141.484,114.497,256,256,256c141.484,0,256-114.497,256-256
10
+ C512,114.516,397.503,0,256,0z M256,472c-119.377,0-216-96.607-216-216c0-119.377,96.607-216,216-216
11
+ c119.377,0,216,96.607,216,216C472,375.377,375.393,472,256,472z"/>
12
+ <path d="M256,128.5c-44.112,0-80,35.888-80,80c0,11.046,8.954,20,20,20s20-8.954,20-20c0-22.056,17.944-40,40-40
13
+ c22.056,0,40,17.944,40,40c0,22.056-17.944,40-40,40c-11.046,0-20,8.954-20,20v50c0,11.046,8.954,20,20,20
14
+ c11.046,0,20-8.954,20-20v-32.531c34.466-8.903,60-40.26,60-77.469C336,164.388,300.112,128.5,256,128.5z"/>
15
+ </g>
16
+ </g>
17
+ </g>
18
+ <g>
19
+ </g>
20
+ <g>
21
+ </g>
22
+ <g>
23
+ </g>
24
+ <g>
25
+ </g>
26
+ <g>
27
+ </g>
28
+ <g>
29
+ </g>
30
+ <g>
31
+ </g>
32
+ <g>
33
+ </g>
34
+ <g>
35
+ </g>
36
+ <g>
37
+ </g>
38
+ <g>
39
+ </g>
40
+ <g>
41
+ </g>
42
+ <g>
43
+ </g>
44
+ <g>
45
+ </g>
46
+ <g>
47
+ </g>
48
+ </svg>
images/loading20px.svg ADDED
@@ -0,0 +1 @@
 
1
+ <svg width="26px" height="26px" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100" preserveAspectRatio="xMidYMid" class="lds-disk" style="background: none;"><g transform="translate(50,50)"><g ng-attr-transform="scale({{config.scale}})" transform="scale(0.7)"><circle cx="0" cy="0" r="50" ng-attr-fill="{{config.c1}}" fill="rgba(0%,0%,0%,0.436)"></circle><circle cx="0" ng-attr-cy="{{config.cy}}" ng-attr-r="{{config.r}}" ng-attr-fill="{{config.c2}}" cy="-27" r="18" fill="#ffffff" transform="rotate(289.484)"><animateTransform attributeName="transform" type="rotate" calcMode="linear" values="0 0 0;360 0 0" keyTimes="0;1" dur="0.6s" begin="0s" repeatCount="indefinite"></animateTransform></circle></g></g></svg>
images/loading_img.gif DELETED
Binary file
images/nothing_to_see.png DELETED
Binary file
images/nothing_to_see.svg ADDED
@@ -0,0 +1,4 @@
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" id="Capa_1" x="0px" y="0px" viewBox="0 0 488.85 488.85" style="enable-background:new 0 0 488.85 488.85;" xml:space="preserve" width="512px" height="512px" class=""><g><g>
3
+ <path d="M244.425,98.725c-93.4,0-178.1,51.1-240.6,134.1c-5.1,6.8-5.1,16.3,0,23.1c62.5,83.1,147.2,134.2,240.6,134.2 s178.1-51.1,240.6-134.1c5.1-6.8,5.1-16.3,0-23.1C422.525,149.825,337.825,98.725,244.425,98.725z M251.125,347.025 c-62,3.9-113.2-47.2-109.3-109.3c3.2-51.2,44.7-92.7,95.9-95.9c62-3.9,113.2,47.2,109.3,109.3 C343.725,302.225,302.225,343.725,251.125,347.025z M248.025,299.625c-33.4,2.1-61-25.4-58.8-58.8c1.7-27.6,24.1-49.9,51.7-51.7 c33.4-2.1,61,25.4,58.8,58.8C297.925,275.625,275.525,297.925,248.025,299.625z" data-original="#000000" class="active-path" data-old_color="#000000" fill="#D2D2D2"/>
4
+ </g></g> </svg>
images/notice.png DELETED
Binary file
images/premium.svg ADDED
@@ -0,0 +1 @@
 
1
+ <svg height="512pt" viewBox="0 0 512 512.0002" width="512pt" xmlns="http://www.w3.org/2000/svg"><path d="m301.636719 170c3.066406 0 6.117187-.953125 8.683593-2.820312 4.351563-3.160157 6.640626-8.441407 5.972657-13.78125l-5.394531-43.144532 29.726562-31.734375c3.679688-3.929687 4.929688-9.542969 3.265625-14.664062-1.664063-5.117188-5.976563-8.921875-11.261719-9.9375l-42.699218-8.203125-20.996094-38.078125c-2.597656-4.710938-7.554688-7.636719-12.933594-7.636719-5.382812 0-10.335938 2.925781-12.933594 7.636719l-20.996094 38.078125-42.703124 8.203125c-5.28125 1.011719-9.597657 4.820312-11.261719 9.9375-1.660157 5.121093-.410157 10.734375 3.269531 14.664062l29.726562 31.734375-5.394531 43.144532c-.671875 5.339843 1.617188 10.621093 5.972657 13.78125 4.351562 3.164062 10.078124 3.710937 14.953124 1.421874l39.367188-18.460937 39.367188 18.460937c2 .9375 4.140624 1.398438 6.269531 1.398438zm0 0" fill="#ffa000"/><path d="m343.890625 63.855469c-1.660156-5.117188-5.976563-8.925781-11.257813-9.9375l-42.703124-8.203125-20.996094-38.078125c-2.597656-4.710938-7.554688-7.636719-12.933594-7.636719v150.140625l39.367188 18.460937c1.996093.9375 4.136718 1.398438 6.269531 1.398438 3.066406 0 6.117187-.953125 8.683593-2.820312 4.351563-3.160157 6.640626-8.441407 5.972657-13.78125l-5.394531-43.144532 29.726562-31.734375c3.679688-3.929687 4.929688-9.546875 3.265625-14.664062zm0 0" fill="#ee8700"/><path d="m511.277344 213.855469c-1.664063-5.117188-5.976563-8.925781-11.261719-9.941407l-42.703125-8.203124-20.996094-38.078126c-2.597656-4.710937-7.550781-7.636718-12.933594-7.636718-5.378906 0-10.335937 2.925781-12.933593 7.636718l-20.996094 38.078126-42.699219 8.203124c-5.285156 1.015626-9.597656 4.824219-11.261718 9.941407-1.664063 5.117187-.410157 10.730469 3.265624 14.660156l29.726563 31.734375-5.394531 43.148438c-.667969 5.339843 1.621094 10.617187 5.972656 13.777343 4.351562 3.164063 10.078125 3.710938 14.953125 1.425781l39.367187-18.464843 39.371094 18.464843c1.996094.9375 4.136719 1.398438 6.265625 1.398438 3.070313 0 6.117188-.957031 8.683594-2.820312 4.351563-3.164063 6.640625-8.441407 5.972656-13.78125l-5.394531-43.144532 29.726562-31.738281c3.679688-3.925781 4.933594-9.542969 3.269532-14.660156zm0 0" fill="#ee8700"/><path d="m229.246094 395.914062-42.699219-8.199218-20.996094-38.078125c-2.597656-4.710938-7.554687-7.640625-12.933593-7.640625-5.382813 0-10.335938 2.929687-12.933594 7.640625l-20.996094 38.078125-42.703125 8.199218c-5.285156 1.015626-9.597656 4.824219-11.261719 9.941407-1.660156 5.117187-.410156 10.734375 3.269532 14.660156l29.722656 31.734375-5.394532 43.148438c-.667968 5.339843 1.621094 10.617187 5.976563 13.78125 4.351563 3.160156 10.078125 3.710937 14.949219 1.421874l39.371094-18.464843 39.367187 18.464843c1.996094.9375 4.136719 1.398438 6.269531 1.398438 3.066406 0 6.113282-.957031 8.679688-2.820312 4.355468-3.164063 6.644531-8.441407 5.976562-13.78125l-5.398437-43.148438 29.726562-31.734375c3.679688-3.925781 4.929688-9.542969 3.269531-14.660156-1.660156-5.117188-5.976562-8.925781-11.261718-9.941407zm0 0" fill="#ffa000"/><path d="m436.015625 395.914062-42.703125-8.199218-20.996094-38.078125c-2.597656-4.710938-7.550781-7.640625-12.933594-7.640625-5.378906 0-10.332031 2.929687-12.933593 7.640625l-20.996094 38.078125-42.699219 8.199218c-5.285156 1.015626-9.597656 4.824219-11.261718 9.941407-1.664063 5.117187-.410157 10.734375 3.265624 14.660156l29.726563 31.734375-5.394531 43.148438c-.667969 5.339843 1.621094 10.617187 5.972656 13.78125 4.351562 3.160156 10.078125 3.710937 14.953125 1.421874l39.367187-18.464843 39.371094 18.464843c1.996094.9375 4.136719 1.398438 6.265625 1.398438 3.070313 0 6.117188-.957031 8.683594-2.820312 4.351563-3.164063 6.640625-8.441407 5.972656-13.78125l-5.394531-43.148438 29.726562-31.734375c3.679688-3.925781 4.929688-9.542969 3.265626-14.660156-1.660157-5.117188-5.972657-8.925781-11.257813-9.941407zm0 0" fill="#ee8700"/><path d="m127.984375 318.601562c1.996094.9375 4.136719 1.398438 6.269531 1.398438 3.066406 0 6.113282-.957031 8.683594-2.820312 4.351562-3.164063 6.640625-8.441407 5.972656-13.78125l-5.394531-43.144532 29.722656-31.738281c3.679688-3.925781 4.933594-9.542969 3.269531-14.660156-1.664062-5.117188-5.976562-8.925781-11.261718-9.941407l-42.703125-8.199218-20.996094-38.078125c-2.597656-4.710938-7.550781-7.640625-12.933594-7.640625-5.378906 0-10.335937 2.929687-12.933593 7.640625l-20.992188 38.074219-42.703125 8.203124c-5.285156 1.015626-9.597656 4.824219-11.261719 9.941407-1.660156 5.117187-.410156 10.730469 3.265625 14.660156l29.726563 31.734375-5.394532 43.148438c-.667968 5.339843 1.621094 10.617187 5.972657 13.777343 4.351562 3.164063 10.082031 3.710938 14.953125 1.425781l39.371094-18.464843zm0 0" fill="#ffa000"/></svg>
images/rate.png DELETED
Binary file
images/search-icon.png DELETED
Binary file
images/search-icon.svg ADDED
@@ -0,0 +1,6 @@
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" id="Capa_1" x="0px" y="0px" width="20px" height="20px" viewBox="0 0 446.25 446.25" style="enable-background:new 0 0 446.25 446.25;" xml:space="preserve" class=""><g><g>
3
+ <g id="search">
4
+ <path d="M318.75,280.5h-20.4l-7.649-7.65c25.5-28.05,40.8-66.3,40.8-107.1C331.5,73.95,257.55,0,165.75,0S0,73.95,0,165.75 S73.95,331.5,165.75,331.5c40.8,0,79.05-15.3,107.1-40.8l7.65,7.649v20.4L408,446.25L446.25,408L318.75,280.5z M165.75,280.5 C102,280.5,51,229.5,51,165.75S102,51,165.75,51S280.5,102,280.5,165.75S229.5,280.5,165.75,280.5z" data-original="#000000" class="active-path" data-old_color="#000000" fill="#FFFFFF"/>
5
+ </g>
6
+ </g></g> </svg>
images/see.png DELETED
Binary file
images/see.svg ADDED
@@ -0,0 +1,12 @@
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0" encoding="iso-8859-1"?>
2
+ <!-- Generator: Adobe Illustrator 19.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
3
+ <svg version="1.1" id="Capa_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
4
+ viewBox="0 0 488.85 488.85" style="enable-background:new 0 0 488.85 488.85;" xml:space="preserve">
5
+ <g>
6
+ <path d="M244.425,98.725c-93.4,0-178.1,51.1-240.6,134.1c-5.1,6.8-5.1,16.3,0,23.1c62.5,83.1,147.2,134.2,240.6,134.2
7
+ s178.1-51.1,240.6-134.1c5.1-6.8,5.1-16.3,0-23.1C422.525,149.825,337.825,98.725,244.425,98.725z M251.125,347.025
8
+ c-62,3.9-113.2-47.2-109.3-109.3c3.2-51.2,44.7-92.7,95.9-95.9c62-3.9,113.2,47.2,109.3,109.3
9
+ C343.725,302.225,302.225,343.725,251.125,347.025z M248.025,299.625c-33.4,2.1-61-25.4-58.8-58.8c1.7-27.6,24.1-49.9,51.7-51.7
10
+ c33.4-2.1,61,25.4,58.8,58.8C297.925,275.625,275.525,297.925,248.025,299.625z"/>
11
+ </g>
12
+ </svg>
images/small_warning.png DELETED
Binary file
images/switch-off.svg ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" id="Capa_1" x="0px" y="0px" viewBox="0 0 512 512" style="enable-background:new 0 0 512 512;" xml:space="preserve" width="512px" height="512px" class=""><g><path style="fill:#F3F3F3" d="M373.333,117.333H138.667C62.083,117.333,0,179.417,0,256s62.083,138.667,138.667,138.667h234.667 C449.917,394.667,512,332.583,512,256S449.917,117.333,373.333,117.333z" data-original="#CFD8DC" class="active-path" data-old_color="#F2F2F2"/><circle style="fill:#F44336;" cx="138.667" cy="256" r="96" data-original="#F44336"/><g>
3
+ <path style="fill:#455A64" d="M288,309.333c-17.673,0-32-14.327-32-32v-42.667c0-17.673,14.327-32,32-32c17.673,0,32,14.327,32,32 v42.667C320,295.006,305.673,309.333,288,309.333z M288,224c-5.891,0-10.667,4.776-10.667,10.667v42.667 c0,5.891,4.776,10.667,10.667,10.667c5.891,0,10.667-4.776,10.667-10.667v-42.667C298.667,228.776,293.891,224,288,224z" data-original="#455A64" class=""/>
4
+ <path style="fill:#455A64" d="M352,309.333c-5.891,0-10.667-4.776-10.667-10.667v-85.333c0-5.891,4.776-10.667,10.667-10.667h32 c5.891,0,10.667,4.776,10.667,10.667c0,5.891-4.776,10.667-10.667,10.667h-21.333v74.667 C362.667,304.558,357.891,309.333,352,309.333z" data-original="#455A64" class=""/>
5
+ <path style="fill:#455A64" d="M373.333,266.667H352c-5.891,0-10.667-4.776-10.667-10.667c0-5.891,4.776-10.667,10.667-10.667 h21.333c5.891,0,10.667,4.776,10.667,10.667C384,261.891,379.224,266.667,373.333,266.667z" data-original="#455A64" class=""/>
6
+ <path style="fill:#455A64" d="M416,309.333c-5.891,0-10.667-4.776-10.667-10.667v-85.333c0-5.891,4.776-10.667,10.667-10.667h32 c5.891,0,10.667,4.776,10.667,10.667c0,5.891-4.776,10.667-10.667,10.667h-21.333v74.667 C426.667,304.558,421.891,309.333,416,309.333z" data-original="#455A64" class=""/>
7
+ <path style="fill:#455A64" d="M437.333,266.667H416c-5.891,0-10.667-4.776-10.667-10.667c0-5.891,4.776-10.667,10.667-10.667 h21.333c5.891,0,10.667,4.776,10.667,10.667C448,261.891,443.224,266.667,437.333,266.667z" data-original="#455A64" class=""/>
8
+ </g></g> </svg>
images/switch-on.svg ADDED
@@ -0,0 +1,5 @@
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" id="Capa_1" x="0px" y="0px" viewBox="0 0 512 512" style="enable-background:new 0 0 512 512;" xml:space="preserve" width="512px" height="512px" class=""><g><path style="fill:#F3F3F3" d="M373.333,117.333H138.667C62.083,117.333,0,179.417,0,256s62.083,138.667,138.667,138.667h234.667 C449.917,394.667,512,332.583,512,256S449.917,117.333,373.333,117.333z" data-original="#CFD8DC" class="active-path" data-old_color="#f3f3f3"/><circle style="fill:#4CAF50;" cx="373.333" cy="256" r="96" data-original="#4CAF50"/><g>
3
+ <path style="fill:#455A64" d="M117.333,309.333c-17.673,0-32-14.327-32-32v-42.667c0-17.673,14.327-32,32-32s32,14.327,32,32 v42.667C149.333,295.006,135.006,309.333,117.333,309.333z M117.333,224c-5.891,0-10.667,4.776-10.667,10.667v42.667 c0,5.891,4.776,10.667,10.667,10.667S128,283.224,128,277.333v-42.667C128,228.776,123.224,224,117.333,224z" data-original="#455A64" class=""/>
4
+ <path style="fill:#455A64" d="M224,309.333c-4.037,0-7.728-2.279-9.536-5.888L192,258.517v40.149 c0,5.891-4.776,10.667-10.667,10.667c-5.891,0-10.667-4.776-10.667-10.667v-85.333c0.006-4.941,3.405-9.232,8.213-10.368 c4.819-1.186,9.812,1.151,11.989,5.611l22.464,44.907v-40.149c0-5.891,4.776-10.667,10.667-10.667 c5.891,0,10.667,4.776,10.667,10.667v85.333c-0.006,4.941-3.405,9.232-8.213,10.368C225.651,309.237,224.827,309.337,224,309.333z" data-original="#455A64" class=""/>
5
+ </g></g> </svg>
images/warning.png DELETED
Binary file
images/warning.svg ADDED
@@ -0,0 +1,2 @@
 
 
1
+ <?xml version="1.0"?>
2
+ <svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" id="Capa_1" x="0px" y="0px" viewBox="0 0 60 60" style="enable-background:new 0 0 60 60;" xml:space="preserve" width="512px" height="512px"><g><path style="fill:none;stroke:#DC9628;stroke-width:2;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:10;" d="M34,12 V8c0-2.209-1.791-4-4-4s-4,1.791-4,4v4.072"/><path style="fill:#EEAF4B;" d="M16.491,50.638c10.701,1.847,16.658,1.847,27.36,0L53.341,49l0,0c-4.685-4.657-7.317-10.415-7.317-17 v-9c0.038-6.047-3.957-10.478-7.946-12.301c-4.999-2.285-10.815-2.294-15.806,0.008C18.319,12.53,14.038,16.958,14,23v9 c0,6.585-2.315,12.343-7,17l0,0L16.491,50.638z" data-original="#EEAF4B"/><path style="fill:#FBD490;" d="M19,25.991c-0.002,0-0.004,0-0.006,0c-0.552-0.004-0.997-0.454-0.994-1.006 c0.03-4.682,3.752-7.643,5.948-8.654c3.849-1.775,8.594-1.772,12.469-0.002c0.502,0.229,0.723,0.822,0.494,1.325 c-0.229,0.502-0.822,0.724-1.326,0.493c-3.354-1.533-7.469-1.537-10.799,0c-1.767,0.814-4.762,3.173-4.785,6.85 C19.997,25.547,19.549,25.991,19,25.991z" data-original="#FBD490"/><path style="fill:#DC9628;" d="M21.906,51.46C23.35,54.728,26.508,57,30.183,57c3.676,0,6.834-2.273,8.278-5.543 C32.533,52.209,27.83,52.21,21.906,51.46z" data-original="#DC9628"/><path style="fill:#F2ECBF;" d="M4.095,39.967c-0.256,0-0.512-0.098-0.707-0.293C1.203,37.489,0,34.58,0,31.483 c0-3.098,1.203-6.006,3.388-8.19c0.391-0.391,1.023-0.391,1.414,0s0.391,1.023,0,1.414C2.995,26.514,2,28.92,2,31.483 c0,2.563,0.995,4.969,2.802,6.776c0.391,0.391,0.391,1.023,0,1.414C4.606,39.869,4.351,39.967,4.095,39.967z" data-original="#F2ECBF" class="active-path"/><path style="fill:#F2ECBF;" d="M8.305,37.69c-0.256,0-0.512-0.098-0.707-0.293c-3.337-3.337-3.337-8.768,0-12.104 c0.391-0.391,1.023-0.391,1.414,0s0.391,1.023,0,1.414c-2.558,2.558-2.558,6.719,0,9.276c0.391,0.391,0.391,1.023,0,1.414 C8.817,37.593,8.561,37.69,8.305,37.69z" data-original="#F2ECBF" class="active-path"/><path style="fill:#F2ECBF;" d="M55.905,39.967c-0.256,0-0.512-0.098-0.707-0.293c-0.391-0.391-0.391-1.023,0-1.414 C57.005,36.452,58,34.046,58,31.483c0-2.563-0.995-4.97-2.802-6.776c-0.391-0.391-0.391-1.023,0-1.414s1.023-0.391,1.414,0 C58.797,25.478,60,28.386,60,31.483c0,3.097-1.203,6.006-3.388,8.19C56.417,39.869,56.161,39.967,55.905,39.967z" data-original="#F2ECBF" class="active-path"/><path style="fill:#F2ECBF;" d="M51.695,37.69c-0.256,0-0.512-0.098-0.707-0.293c-0.391-0.391-0.391-1.023,0-1.414 c2.558-2.558,2.558-6.719,0-9.276c-0.391-0.391-0.391-1.023,0-1.414s1.023-0.391,1.414,0c3.337,3.337,3.337,8.768,0,12.104 C52.207,37.593,51.951,37.69,51.695,37.69z" data-original="#F2ECBF" class="active-path"/></g> </svg>
includes/class_clean_cron.php CHANGED
@@ -14,17 +14,26 @@ class ADBC_Tasks_List extends WP_List_Table {
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
  }
@@ -32,13 +41,37 @@ class ADBC_Tasks_List extends WP_List_Table {
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();
@@ -46,27 +79,41 @@ class ADBC_Tasks_List extends WP_List_Table {
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);
@@ -90,6 +137,14 @@ class ADBC_Tasks_List extends WP_List_Table {
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':
@@ -102,7 +157,7 @@ class ADBC_Tasks_List extends WP_List_Table {
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 */
@@ -115,11 +170,7 @@ class ADBC_Tasks_List extends WP_List_Table {
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 */
@@ -140,24 +191,55 @@ class ADBC_Tasks_List extends WP_List_Table {
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
@@ -172,77 +254,149 @@ class ADBC_Tasks_List extends WP_List_Table {
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>
14
  /** Holds counts + info of tasks categories */
15
  private $aDBc_tasks_categories_info = array();
16
 
17
+ /** Should we display "run search" or "continue search" button (after a timeout failed). Default is "run search" */
18
+ private $aDBc_which_button_to_show = "new_search";
19
+
20
+ // This array contains belongs_to info about plugins and themes
21
+ private $array_belongs_to_counts = array();
22
+
23
+ // Holds msg that will be shown if the scan has finished with success
24
+ private $aDBc_search_has_finished_msg = "";
25
+
26
+ // Holds msg that will be shown if folder adbc_uploads cannot be created by the plugin (This is verified after clicking on scan button)
27
+ private $aDBc_permission_adbc_folder_msg = "";
28
+
29
  function __construct(){
30
+
31
  parent::__construct(array(
32
+ 'singular' => __('Task', 'advanced-database-cleaner'), //singular name of the listed records
33
  'plural' => __('Tasks', 'advanced-database-cleaner'), //plural name of the listed records
34
+ 'ajax' => false //does this table support ajax?
35
  ));
36
+
 
 
 
 
37
  $this->aDBc_prepare_and_count_tasks();
38
  $this->aDBc_print_page_content();
39
  }
41
  /** Prepare tasks to display and count tasks for each category */
42
  function aDBc_prepare_and_count_tasks(){
43
 
44
+ // Verify if the search has finished to let user know about it and invite it to double check against our server
45
+ $search_finished = get_option("aDBc_last_search_ok_tasks");
46
+ if(!empty($search_finished)){
47
+ $this->aDBc_search_has_finished_msg = __('The process of scanning has finished with success!','advanced-database-cleaner');
48
+ // Once we display success msg, we delete that option to not be loaded
49
+ delete_option("aDBc_last_search_ok_tasks");
50
+ }
51
+
52
+ // Verify if the adbc_uploads cannot be created
53
+ $adbc_folder_permission = get_option("aDBc_permission_adbc_folder_needed");
54
+ if(!empty($adbc_folder_permission)){
55
+ $this->aDBc_permission_adbc_folder_msg = sprintf(__('The plugin needs to create the following directory "%1$s" to save the scan results but this was not possible automatically. Please create that directory manually and set correct permissions so it can be writable by the plugin.','advanced-database-cleaner'), ADBC_UPLOAD_DIR_PATH_TO_ADBC);
56
+ // Once we display the msg, we delete that option from DB
57
+ delete_option("aDBc_permission_adbc_folder_needed");
58
  }
59
 
60
+ // Process bulk action if any before preparing tasks to display
61
+ $this->process_bulk_action();
62
+
63
  // Prepare data
64
+ aDBc_prepare_items_to_display(
65
+ $this->aDBc_tasks_to_display,
66
+ $this->aDBc_tasks_categories_info,
67
+ $this->aDBc_which_button_to_show,
68
+ array(),
69
+ array(),
70
+ $this->array_belongs_to_counts,
71
+ $this->aDBc_message,
72
+ $this->aDBc_class_message,
73
+ "tasks"
74
+ );
75
 
76
  // Call WP prepare_items function
77
  $this->prepare_items();
79
 
80
  /** WP: Get columns */
81
  function get_columns(){
82
+ $aDBc_belongs_to_toolip = "<span class='aDBc-tooltips-headers'>
83
+ <img class='aDBc-info-image' src='". ADBC_PLUGIN_DIR_PATH . '/images/information2.svg' . "'/>
84
+ <span>" . __('Indicates the creator of the task: either a plugin, a theme or WordPress itself. If not sure about the creator, an estimation (%) will be displayed. The higher the percentage is, the more likely that the task belongs to that creator.','advanced-database-cleaner') ." </span>
85
+ </span>";
86
  $columns = array(
87
+ 'cb' => '<input type="checkbox" />',
88
+ 'hook_name' => __('Hook name','advanced-database-cleaner'),
89
+ 'arguments' => __('Arguments','advanced-database-cleaner'),
90
+ 'next_run' => __('Next run - Frequency','advanced-database-cleaner'),
91
+ 'site_id' => __('Site','advanced-database-cleaner'),
92
  'hook_belongs_to' => __('Belongs to','advanced-database-cleaner') . $aDBc_belongs_to_toolip
93
  );
94
  return $columns;
95
  }
96
 
97
+ function get_sortable_columns() {
98
+
99
+ $sortable_columns = array(
100
+ 'hook_name' => array('hook_name',false),
101
+ 'site_id' => array('site_id',false)
102
+ );
103
+
104
+ return $sortable_columns;
105
+ }
106
+
107
  /** WP: Prepare items to display */
108
  function prepare_items() {
109
+ $columns = $this->get_columns();
110
+ $hidden = $this->get_hidden_columns();
111
+ $sortable = $this->get_sortable_columns();
112
+ $this->_column_headers = array($columns, $hidden, $sortable);
113
+ $per_page = 50;
114
+ if(!empty($_GET['per_page'])){
115
+ $per_page = absint($_GET['per_page']);
116
+ }
117
  $current_page = $this->get_pagenum();
118
  // Prepare sequence of options to display
119
  $display_data = array_slice($this->aDBc_tasks_to_display,(($current_page-1) * $per_page), $per_page);
137
  /** WP: Column default */
138
  function column_default($item, $column_name){
139
  switch($column_name){
140
+ case 'arguments':
141
+ if($item[$column_name] == "none"){
142
+ return "<span style='color:#888'>".__('None', 'advanced-database-cleaner')."</span>";
143
+ }else{
144
+ $unserialized_args = unserialize($item[$column_name]);
145
+ return "<span style='background:#eee;padding:2px;border-radius:2px'>" . implode(" / ", $unserialized_args) . "</span>";
146
+ }
147
+ break;
148
  case 'hook_name':
149
  case 'next_run':
150
  case 'site_id':
157
 
158
  /** WP: Column cb for check box */
159
  function column_cb($item) {
160
+ return sprintf("<input type='checkbox' name='aDBc_tasks_to_delete[]' value='%s' />", $item['site_id']."|".$item['hook_name']."|".$item['timestamp']."|".$item['arguments']);
161
  }
162
 
163
  /** WP: Get bulk actions */
170
 
171
  /** WP: Message to display when no items found */
172
  function no_items() {
173
+ _e('No tasks found!','advanced-database-cleaner');
 
 
 
 
174
  }
175
 
176
  /** WP: Process bulk actions */
191
  // Prepare tasks to delete in organized array to minimize switching from blogs
192
  $tasks_to_delete = array();
193
  foreach($_POST['aDBc_tasks_to_delete'] as $task){
194
+ $task_info = explode("|", $task, 2);
195
  if(empty($tasks_to_delete[$task_info[0]])){
196
  $tasks_to_delete[$task_info[0]] = array();
197
  }
198
+ array_push($tasks_to_delete[$task_info[0]], $task);
199
  }
200
  // Delete tasks
201
+ foreach($tasks_to_delete as $site_id => $tasks_info){
202
  switch_to_blog($site_id);
203
+ foreach($tasks_info as $task) {
204
+ $aDBc_cron_info = explode("|", $task, 4);
205
+ $hook = $aDBc_cron_info[1];
206
+ $timestamp = $aDBc_cron_info[2];
207
+ $args = $aDBc_cron_info[3];
208
+ if($args == "none"){
209
+ wp_unschedule_event($timestamp, $hook);
210
+ }else{
211
+ $args = unserialize(stripslashes($aDBc_cron_info[3]));
212
+ wp_unschedule_event($timestamp, $hook, $args);
213
+ // Check if the user has deleted a task beloging to this plugin. If so, update his data in DB to inactive
214
+ // A task of ADBC cannot be without an arg, not necessary to add this check to "none" args
215
+ if($hook == "aDBc_clean_scheduler"){
216
+ aDBc_update_task_in_db_after_delete($args[0], "aDBc_clean_schedule");
217
+ }else if($hook == "aDBc_optimize_scheduler"){
218
+ aDBc_update_task_in_db_after_delete($args[0], "aDBc_optimize_schedule");
219
+ }
220
+ }
221
  }
222
  restore_current_blog();
223
  }
224
  }else{
225
  foreach($_POST['aDBc_tasks_to_delete'] as $task) {
226
+ $aDBc_cron_info = explode("|", $task, 4);
227
+ $hook = $aDBc_cron_info[1];
228
+ $timestamp = $aDBc_cron_info[2];
229
+ $args = $aDBc_cron_info[3];
230
+ if($args == "none"){
231
+ wp_unschedule_event($timestamp, $hook);
232
+ }else{
233
+ $args = unserialize(stripslashes($aDBc_cron_info[3]));
234
+ wp_unschedule_event($timestamp, $hook, $args);
235
+ // Check if the user has deleted a task beloging to this plugin. If so, update his data in DB to inactive
236
+ // A task of ADBC cannot be without an arg, not necessary to add this check to "none" args
237
+ if($hook == "aDBc_clean_scheduler"){
238
+ aDBc_update_task_in_db_after_delete($args[0], "aDBc_clean_schedule");
239
+ }else if($hook == "aDBc_optimize_scheduler"){
240
+ aDBc_update_task_in_db_after_delete($args[0], "aDBc_optimize_schedule");
241
+ }
242
+ }
243
  }
244
  }
245
  // Update the message to show to the user
254
  if($this->aDBc_message != ""){
255
  echo '<div id="aDBc_message" class="' . $this->aDBc_class_message . ' notice is-dismissible"><p>' . $this->aDBc_message . '</p></div>';
256
  }
257
+
258
+ // Verify if the ajax call is still searching in background to prevent enabling the button
259
+ $still_searching = get_option("aDBc_temp_still_searching_tasks");
260
+ if(!empty($still_searching)){
261
+ // This means that the ajax call is still searching
262
+ $aDBc_still_searching_msg = __('The process of categorization is still scanning tasks in background. Maybe you have reloaded the page before it finishes the scan. The scan will stop automatically after scanning all items or after timeout.','advanced-database-cleaner');
263
+ echo '<div class="error notice is-dismissible"><p>' . $aDBc_still_searching_msg . '</p></div>';
264
+ }
265
+
266
+ // If the search has finished, show a msg to users
267
+ if(!empty($this->aDBc_search_has_finished_msg)){
268
+ echo '<div class="updated notice is-dismissible"><p>' . $this->aDBc_search_has_finished_msg . '</p></div>';
269
+ }
270
+
271
+ // If the folder adbc_uploads cannot be created, show a msg to users
272
+ if(!empty($this->aDBc_permission_adbc_folder_msg)){
273
+ echo '<div class="error notice is-dismissible"><p>' . $this->aDBc_permission_adbc_folder_msg . '</p></div>';
274
+ }
275
+
276
  ?>
277
  <div class="aDBc-content-max-width">
278
+
279
+ <!-- Print a notice/warning according to each type of tasks -->
280
+ <?php
281
+ if(ADBC_PLUGIN_F_TYPE == "pro"){
282
+ if($_GET['aDBc_cat'] == 'o' && $this->aDBc_options_categories_info['o']['count'] > 0){
283
+ echo '<div class="aDBc-box-warning-orphan">' . __('Tasks below seem to be orphan! However, please delete only those you are sure to be orphan!','advanced-database-cleaner') . '</div>';
284
+ }else if(($_GET['aDBc_cat'] == 'all' || $_GET['aDBc_cat'] == 'u') && $this->aDBc_tasks_categories_info['u']['count'] > 0){
285
+ echo '<div class="aDBc-box-info">' . __('Some of your tasks are not categorized yet! Please click on the button below to categorize them!','advanced-database-cleaner') . '</div>';
286
+ }
287
+ }
288
+ ?>
289
+
290
+ <div class="aDBc-clear-both" style="margin-top:15px"></div>
291
+
292
+ <!-- Code for "run new search" button + Show loading image -->
293
+ <div style="float:left;">
294
+ <?php
295
+ if($this->aDBc_which_button_to_show == "new_search" ){
296
+ $aDBc_search_text = __('Scan tasks','advanced-database-cleaner');
297
+ }else{
298
+ $aDBc_search_text = __('Continue scannig ...','advanced-database-cleaner');
299
+ }
300
  ?>
301
+
302
+ <!-- This hidden input is used by ajax to know which item type we are dealing with -->
303
+ <input type="hidden" id="aDBc_item_type" value="tasks"/>
304
+ <?php
305
+ // These hidden inputs are used by ajax to see if we should execute scanning process automatically by ajax after reloading a page
306
+ $iteration = get_option("aDBc_temp_last_iteration_tasks");
307
+ ?>
308
+ <input type="hidden" id="aDBc_still_searching" value="<?php echo $still_searching; ?>"/>
309
+ <input type="hidden" id="aDBc_iteration" value="<?php echo $iteration; ?>"/>
310
+
311
+ <?php
312
+ if(ADBC_PLUGIN_F_TYPE == "free"){
313
+ ?>
314
+ <div class="aDBc_premium_tooltip">
315
+ <input id="aDBc_new_search_button" type="submit" class="aDBc-run-new-search" value="<?php echo $aDBc_search_text; ?>" name="aDBc_new_search_button" style="opacity:0.5" disabled/>
316
+ <span style="width:380px" class="aDBc_premium_tooltiptext"><?php _e('Please <a href="?page=advanced_db_cleaner&aDBc_tab=premium">upgrade</a> to Pro to categorize and detect orphaned tasks','advanced-database-cleaner') ?></span>
 
 
 
317
  </div>
318
+ <?php
319
+ }else { ?>
320
 
321
+ <input id="aDBc_new_search_button" type="submit" class="aDBc-run-new-search" value="<?php echo $aDBc_search_text; ?>" name="aDBc_new_search_button" />
322
 
323
+ <?php
324
+ }
325
+ ?>
326
+
327
+ </div>
328
+
329
+ <!-- Print numbers of tasks found in each category -->
330
+ <div class="aDBc-category-counts">
331
+ <?php
332
+ $aDBc_new_URI = $_SERVER['REQUEST_URI'];
333
+ // Remove the paged parameter to start always from the first page when selecting a new category of tables
334
+ $aDBc_new_URI = remove_query_arg('paged', $aDBc_new_URI);
335
+ $iterations = 0;
336
+ foreach($this->aDBc_tasks_categories_info as $abreviation => $category_info){
337
+ $iterations++;
338
+ $aDBc_new_URI = add_query_arg('aDBc_cat', $abreviation, $aDBc_new_URI);?>
339
+ <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'] : '' ?>">
340
 
 
 
341
  <?php
342
+ if(ADBC_PLUGIN_F_TYPE == "pro" || $abreviation == "all"|| $abreviation == "u"){
343
+ $aDBc_link_style = "color:" . $category_info['color'];
344
+ $aDBc_category_info_count = "(". $category_info['count'] . ")";
345
+ }else{
346
+ $aDBc_link_style = "color:" . $category_info['color'] . ";cursor:default;pointer-events:none";
347
+ $aDBc_category_info_count = "(*)";
348
+ $aDBc_new_URI = "";
349
+ }
350
  ?>
 
 
351
 
352
+ <span class="aDBc_premium_tooltip">
353
+ <a href="<?php echo $aDBc_new_URI; ?>" class="aDBc-category-counts-links" style="<?php echo $aDBc_link_style ; ?>">
354
+ <span><?php echo $category_info['name']; ?></span>
355
+ <span><?php echo $aDBc_category_info_count ;?></span>
356
+ </a>
357
+ <?php if(ADBC_PLUGIN_F_TYPE == "free" && $abreviation != "all" && $abreviation != "u"){ ?>
358
+ <span style="width:150px" class="aDBc_premium_tooltiptext"><?php _e('Available in Pro version!','advanced-database-cleaner') ?></span>
359
+ <?php } ?>
360
+ </span>
361
 
362
+ </span>
363
+ <?php
364
+ if($iterations < 6){
365
+ echo '<span class="aDBc-category-separator">|</span>';
366
+ }
367
+ }?>
368
+ </div>
369
 
370
+ <div class="aDBc-clear-both"></div>
371
+
372
+ <div id="aDBc_progress_container">
373
+ <div style="background:#ccc;width:100%;height:20px">
374
+ <div id="aDBc-progress-bar" class="aDBc_progress-bar"></div>
375
+ </div>
376
+ <div id="aDBc-response_container"></div>
377
+ </div>
378
+
379
+ <?php include_once 'header_page_filter.php'; ?>
380
+
381
+ <div class="aDBc-clear-both"></div>
382
 
383
+ <form id="aDBc_form" action="" method="post">
384
+ <?php
385
  // Print the tasks
386
  $this->display();
 
387
  ?>
388
  </form>
389
+
390
  </div>
391
  <div id="aDBc_dialog1" title="<?php _e('Cleaning...','advanced-database-cleaner'); ?>" class="aDBc-jquery-dialog">
392
  <p class="aDBc-box-warning">
393
+ <?php echo __('You are about to clean some of your scheduled tasks. This operation is irreversible!','advanced-database-cleaner') . "<span style='color:red'> " . __('Don\'t forget to make a backup of your database first.','advanced-database-cleaner') . "</span>" ; ?>
394
  </p>
395
  <p>
396
  <?php _e('Are you sure to continue?','advanced-database-cleaner'); ?>
397
  </p>
398
  </div>
399
+ <div id="aDBc_dialogx" title="<?php _e('Action required','advanced-database-cleaner'); ?>" class="aDBc-jquery-dialog">
400
  <p class="aDBc-box-info">
401
  <?php _e('Please select an action!','advanced-database-cleaner'); ?>
402
  </p>
includes/class_clean_options.php CHANGED
@@ -14,17 +14,26 @@ class ADBC_Options_List extends WP_List_Table {
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
  }
@@ -32,13 +41,37 @@ class ADBC_Options_List extends WP_List_Table {
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();
@@ -46,28 +79,50 @@ class ADBC_Options_List extends WP_List_Table {
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);
@@ -93,6 +148,7 @@ class ADBC_Options_List extends WP_List_Table {
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':
@@ -104,24 +160,22 @@ class ADBC_Options_List extends WP_List_Table {
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 */
@@ -137,11 +191,11 @@ class ADBC_Options_List extends WP_List_Table {
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();
@@ -157,7 +211,7 @@ class ADBC_Options_List extends WP_List_Table {
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
  }
@@ -165,7 +219,64 @@ class ADBC_Options_List extends WP_List_Table {
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 */
@@ -174,77 +285,149 @@ class ADBC_Options_List extends WP_List_Table {
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>
14
  /** Holds counts + info of options categories */
15
  private $aDBc_options_categories_info = array();
16
 
17
+ /** Should we display "run search" or "continue search" button (after a timeout failed). Default is "run search" */
18
+ private $aDBc_which_button_to_show = "new_search";
19
+
20
+ // This array contains belongs_to info about plugins and themes
21
+ private $array_belongs_to_counts = array();
22
+
23
+ // Holds msg that will be shown if the scan has finished with success
24
+ private $aDBc_search_has_finished_msg = "";
25
+
26
+ // Holds msg that will be shown if folder adbc_uploads cannot be created by the plugin (This is verified after clicking on scan button)
27
+ private $aDBc_permission_adbc_folder_msg = "";
28
+
29
  function __construct(){
30
+
31
  parent::__construct(array(
32
  'singular' => __('Option', 'advanced-database-cleaner'), //singular name of the listed records
33
  'plural' => __('Options', 'advanced-database-cleaner'), //plural name of the listed records
34
+ 'ajax' => false //does this table support ajax?
35
  ));
36
+
 
 
 
 
37
  $this->aDBc_prepare_and_count_options();
38
  $this->aDBc_print_page_content();
39
  }
41
  /** Prepare options to display and count options for each category */
42
  function aDBc_prepare_and_count_options(){
43
 
44
+ // Verify if the search has finished to let user know about it and invite it to double check against our server
45
+ $search_finished = get_option("aDBc_last_search_ok_options");
46
+ if(!empty($search_finished)){
47
+ $this->aDBc_search_has_finished_msg = __('The process of scanning has finished with success!','advanced-database-cleaner');
48
+ // Once we display success msg, we delete that option to not be loaded
49
+ delete_option("aDBc_last_search_ok_options");
50
+ }
51
+
52
+ // Verify if the adbc_uploads cannot be created
53
+ $adbc_folder_permission = get_option("aDBc_permission_adbc_folder_needed");
54
+ if(!empty($adbc_folder_permission)){
55
+ $this->aDBc_permission_adbc_folder_msg = sprintf(__('The plugin needs to create the following directory "%1$s" to save the scan results but this was not possible automatically. Please create that directory manually and set correct permissions so it can be writable by the plugin.','advanced-database-cleaner'), ADBC_UPLOAD_DIR_PATH_TO_ADBC);
56
+ // Once we display the msg, we delete that option from DB
57
+ delete_option("aDBc_permission_adbc_folder_needed");
58
  }
59
 
60
+ // Process bulk action if any before preparing options to display
61
+ $this->process_bulk_action();
62
+
63
  // Prepare data
64
+ aDBc_prepare_items_to_display(
65
+ $this->aDBc_options_to_display,
66
+ $this->aDBc_options_categories_info,
67
+ $this->aDBc_which_button_to_show,
68
+ array(),
69
+ array(),
70
+ $this->array_belongs_to_counts,
71
+ $this->aDBc_message,
72
+ $this->aDBc_class_message,
73
+ "options"
74
+ );
75
 
76
  // Call WP prepare_items function
77
  $this->prepare_items();
79
 
80
  /** WP: Get columns */
81
  function get_columns(){
82
+ $aDBc_belongs_to_toolip = "<span class='aDBc-tooltips-headers'>
83
+ <img class='aDBc-info-image' src='". ADBC_PLUGIN_DIR_PATH . '/images/information2.svg' . "'/>
84
+ <span>" . __('Indicates the creator of the option: either a plugin, a theme or WordPress itself. If not sure about the creator, an estimation (%) will be displayed. The higher the percentage is, the more likely that the option belongs to that creator.','advanced-database-cleaner') ." </span>
85
+ </span>";
86
+
87
+ $aDBc_option_size_toolip = "<span class='aDBc-tooltips-headers' style='position: absolute;margin-left:15px'>
88
+ <img class='aDBc-info-image' src='". ADBC_PLUGIN_DIR_PATH . '/images/information2.svg' . "'/>
89
+ <span>" . __('The size is in Bits! This is an estimation, not a precise value!','advanced-database-cleaner') ." </span>
90
+ </span>";
91
+
92
  $columns = array(
93
  'cb' => '<input type="checkbox" />',
94
  'option_name' => __('Option name','advanced-database-cleaner'),
95
  'option_value' => __('Value','advanced-database-cleaner'),
96
+ 'option_size' => __('Size','advanced-database-cleaner') . $aDBc_option_size_toolip,
97
  'option_autoload' => __('Autoload','advanced-database-cleaner'),
98
+ 'site_id' => __('Site','advanced-database-cleaner'),
99
  'option_belongs_to' => __('Belongs to','advanced-database-cleaner') . $aDBc_belongs_to_toolip
100
  );
101
  return $columns;
102
  }
103
 
104
+ function get_sortable_columns() {
105
+
106
+ $sortable_columns = array(
107
+ 'option_name' => array('option_name',false),
108
+ 'option_size' => array('option_size',false),
109
+ 'option_autoload' => array('option_autoload',false),
110
+ 'site_id' => array('site_id',false)
111
+ );
112
+
113
+ return $sortable_columns;
114
+ }
115
+
116
  /** WP: Prepare items to display */
117
  function prepare_items() {
118
+ $columns = $this->get_columns();
119
+ $hidden = $this->get_hidden_columns();
120
+ $sortable = $this->get_sortable_columns();
121
+ $this->_column_headers = array($columns, $hidden, $sortable);
122
+ $per_page = 50;
123
+ if(!empty($_GET['per_page'])){
124
+ $per_page = absint($_GET['per_page']);
125
+ }
126
  $current_page = $this->get_pagenum();
127
  // Prepare sequence of options to display
128
  $display_data = array_slice($this->aDBc_options_to_display,(($current_page-1) * $per_page), $per_page);
148
  switch($column_name){
149
  case 'option_name':
150
  case 'option_value':
151
+ case 'option_size':
152
  case 'option_autoload':
153
  case 'site_id':
154
  case 'option_belongs_to':
160
 
161
  /** WP: Column cb for check box */
162
  function column_cb($item) {
163
+ return sprintf('<input type="checkbox" name="aDBc_options_to_process[]" value="%s" />', $item['site_id']."|".$item['option_name']);
164
  }
165
 
166
  /** WP: Get bulk actions */
167
  function get_bulk_actions() {
168
  $actions = array(
169
+ 'delete' => __('Delete','advanced-database-cleaner'),
170
+ 'autoload_yes' => __('Set autoload to yes','advanced-database-cleaner'),
171
+ 'autoload_no' => __('Set autoload to no','advanced-database-cleaner')
172
  );
173
  return $actions;
174
  }
175
 
176
  /** WP: Message to display when no items found */
177
  function no_items() {
178
+ _e('No options found!','advanced-database-cleaner');
 
 
 
 
179
  }
180
 
181
  /** WP: Process bulk actions */
191
 
192
  if($action == 'delete'){
193
  // If the user wants to clean the options he/she selected
194
+ if(isset($_POST['aDBc_options_to_process'])){
195
  if(function_exists('is_multisite') && is_multisite()){
196
  // Prepare options to delete in organized array to minimize switching from blogs
197
  $options_to_delete = array();
198
+ foreach($_POST['aDBc_options_to_process'] as $option){
199
  $option_info = explode("|", $option);
200
  if(empty($options_to_delete[$option_info[0]])){
201
  $options_to_delete[$option_info[0]] = array();
211
  restore_current_blog();
212
  }
213
  }else{
214
+ foreach($_POST['aDBc_options_to_process'] as $option) {
215
  $aDBc_option_info = explode("|", $option);
216
  delete_option($aDBc_option_info[1]);
217
  }
219
  // Update the message to show to the user
220
  $this->aDBc_message = __('Selected options cleaned successfully!', 'advanced-database-cleaner');
221
  }
222
+ }else if($action == 'autoload_yes' || $action == 'autoload_no'){
223
+
224
+ if($action == 'autoload_yes'){
225
+ $autoload_value = "yes";
226
+ }else{
227
+ $autoload_value = "no";
228
+ }
229
+
230
+ // If the user wants to change autoload to yes for selected options
231
+ // yyy, changing autoload using update_option works only on WP 4.2 and newer. Should I set minimum required wp to 4.2 in my plugin header?
232
+ if(isset($_POST['aDBc_options_to_process'])){
233
+ $additional_msg = "";
234
+ if(function_exists('is_multisite') && is_multisite()){
235
+ // Prepare options to process in organized array to minimize switching from blogs
236
+ $options_to_process = array();
237
+ foreach($_POST['aDBc_options_to_process'] as $option){
238
+ $option_info = explode("|", $option);
239
+ if(empty($options_to_process[$option_info[0]])){
240
+ $options_to_process[$option_info[0]] = array();
241
+ }
242
+ array_push($options_to_process[$option_info[0]], $option_info[1]);
243
+ }
244
+ // Change autoload
245
+ foreach($options_to_process as $site_id => $options){
246
+ switch_to_blog($site_id);
247
+ foreach($options as $option){
248
+ // In adbc-edd-sample-plugin, EDD deletes aDBc_edd_license_status if aDBc_edd_license_key has been changed
249
+ // This means that we should not change its value to prevent this to happen
250
+ if($option != "aDBc_edd_license_key"){
251
+ $options_value = get_option($option);
252
+ update_option($option, "xyz");
253
+ update_option($option, $options_value, $autoload_value);
254
+ }else{
255
+ $additional_msg = "<span style='color:orange'>" . __('For technical concerns, the option aDBc_edd_license_key cannot be changed!', 'advanced-database-cleaner') . "</span>";
256
+ }
257
+ }
258
+ restore_current_blog();
259
+ }
260
+ }else{
261
+ foreach($_POST['aDBc_options_to_process'] as $option) {
262
+ $aDBc_option_info = explode("|", $option);
263
+ // In adbc-edd-sample-plugin, EDD deletes aDBc_edd_license_status if aDBc_edd_license_key has been changed
264
+ // This means that we should not change its value to prevent this to happen
265
+ if($aDBc_option_info[1] != "aDBc_edd_license_key"){
266
+ $options_value = get_option($aDBc_option_info[1]);
267
+ // Wordpress does not allow to change to autoload if the value have not been changed as well
268
+ // We should change the value to something such as xyz, then change it back again to its original value
269
+ update_option($aDBc_option_info[1], "xyz");
270
+ update_option($aDBc_option_info[1], $options_value, $autoload_value);
271
+ }else{
272
+ $additional_msg = "<span style='color:orange'>" . __('For technical concerns, the option aDBc_edd_license_key cannot be changed!', 'advanced-database-cleaner') . "</span>";
273
+ }
274
+ }
275
+ }
276
+ // Update the message to show to the user
277
+ $this->aDBc_message = __('Autoload value successfully changed!', 'advanced-database-cleaner') . " " . $additional_msg;
278
+ }
279
+ }
280
  }
281
 
282
  /** Print the page content */
285
  if($this->aDBc_message != ""){
286
  echo '<div id="aDBc_message" class="' . $this->aDBc_class_message . ' notice is-dismissible"><p>' . $this->aDBc_message . '</p></div>';
287
  }
288
+
289
+ // Verify if the ajax call is still searching in background to prevent enabling the button
290
+ $still_searching = get_option("aDBc_temp_still_searching_options");
291
+ if(!empty($still_searching)){
292
+ // This means that the ajax call is still searching
293
+ $aDBc_still_searching_msg = __('The process of categorization is still scanning options in background. Maybe you have reloaded the page before it finishes the scan. The scan will stop automatically after scanning all items or after timeout.','advanced-database-cleaner');
294
+ echo '<div class="error notice is-dismissible"><p>' . $aDBc_still_searching_msg . '</p></div>';
295
+ }
296
+
297
+ // If the search has finished, show a msg to users
298
+ if(!empty($this->aDBc_search_has_finished_msg)){
299
+ echo '<div class="updated notice is-dismissible"><p>' . $this->aDBc_search_has_finished_msg . '</p></div>';
300
+ }
301
+
302
+ // If the folder adbc_uploads cannot be created, show a msg to users
303
+ if(!empty($this->aDBc_permission_adbc_folder_msg)){
304
+ echo '<div class="error notice is-dismissible"><p>' . $this->aDBc_permission_adbc_folder_msg . '</p></div>';
305
+ }
306
+
307
  ?>
308
  <div class="aDBc-content-max-width">
309
+
310
+ <!-- Print a notice/warning according to each type of options -->
311
+ <?php
312
+ if(ADBC_PLUGIN_F_TYPE == "pro"){
313
+ if($_GET['aDBc_cat'] == 'o' && $this->aDBc_options_categories_info['o']['count'] > 0){
314
+ echo '<div class="aDBc-box-warning-orphan">' . __('Options below seem to be orphan! However, please delete only those you are sure to be orphan!','advanced-database-cleaner') . '</div>';
315
+ }else if(($_GET['aDBc_cat'] == 'all' || $_GET['aDBc_cat'] == 'u') && $this->aDBc_options_categories_info['u']['count'] > 0){
316
+ echo '<div class="aDBc-box-info">' . __('Some of your options are not categorized yet! Please click on the button below to categorize them!','advanced-database-cleaner') . '</div>';
317
+ }
318
+ }
319
+ ?>
320
+
321
+ <div class="aDBc-clear-both" style="margin-top:15px"></div>
322
+
323
+ <!-- Code for "run new search" button + Show loading image -->
324
+ <div style="float:left;">
325
+ <?php
326
+ if($this->aDBc_which_button_to_show == "new_search" ){
327
+ $aDBc_search_text = __('Scan options','advanced-database-cleaner');
328
+ }else{
329
+ $aDBc_search_text = __('Continue scannig ...','advanced-database-cleaner');
330
+ }
331
  ?>
332
+
333
+ <!-- This hidden input is used by ajax to know which item type we are dealing with -->
334
+ <input type="hidden" id="aDBc_item_type" value="options"/>
335
+ <?php
336
+ // These hidden inputs are used by ajax to see if we should execute scanning process automatically by ajax after reloading a page
337
+ $iteration = get_option("aDBc_temp_last_iteration_options");
338
+ ?>
339
+ <input type="hidden" id="aDBc_still_searching" value="<?php echo $still_searching; ?>"/>
340
+ <input type="hidden" id="aDBc_iteration" value="<?php echo $iteration; ?>"/>
341
+
342
+ <?php
343
+ if(ADBC_PLUGIN_F_TYPE == "free"){
344
+ ?>
345
+ <div class="aDBc_premium_tooltip">
346
+ <input id="aDBc_new_search_button" type="submit" class="aDBc-run-new-search" value="<?php echo $aDBc_search_text; ?>" name="aDBc_new_search_button" style="opacity:0.5" disabled/>
347
+ <span style="width:390px" class="aDBc_premium_tooltiptext"><?php _e('Please <a href="?page=advanced_db_cleaner&aDBc_tab=premium">upgrade</a> to Pro to categorize and detect orphaned options','advanced-database-cleaner') ?></span>
 
 
 
348
  </div>
349
+ <?php
350
+ }else { ?>
351
 
352
+ <input id="aDBc_new_search_button" type="submit" class="aDBc-run-new-search" value="<?php echo $aDBc_search_text; ?>" name="aDBc_new_search_button" />
353
+
354
+ <?php
355
+ }
356
+ ?>
357
+
358
+ </div>
359
 
360
+ <!-- Print numbers of options found in each category -->
361
+ <div class="aDBc-category-counts">
362
+ <?php
363
+ $aDBc_new_URI = $_SERVER['REQUEST_URI'];
364
+ // Remove the paged parameter to start always from the first page when selecting a new category of tables
365
+ $aDBc_new_URI = remove_query_arg('paged', $aDBc_new_URI);
366
+ $iterations = 0;
367
+ foreach($this->aDBc_options_categories_info as $abreviation => $category_info){
368
+ $iterations++;
369
+ $aDBc_new_URI = add_query_arg('aDBc_cat', $abreviation, $aDBc_new_URI);?>
370
+ <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'] : '' ?>">
371
 
 
 
372
  <?php
373
+ if(ADBC_PLUGIN_F_TYPE == "pro" || $abreviation == "all"|| $abreviation == "u"){
374
+ $aDBc_link_style = "color:" . $category_info['color'];
375
+ $aDBc_category_info_count = "(". $category_info['count'] . ")";
376
+ }else{
377
+ $aDBc_link_style = "color:" . $category_info['color'] . ";cursor:default;pointer-events:none";
378
+ $aDBc_category_info_count = "(*)";
379
+ $aDBc_new_URI = "";
380
+ }
381
  ?>
 
 
382
 
383
+ <span class="aDBc_premium_tooltip">
384
+ <a href="<?php echo $aDBc_new_URI; ?>" class="aDBc-category-counts-links" style="<?php echo $aDBc_link_style ; ?>">
385
+ <span><?php echo $category_info['name']; ?></span>
386
+ <span><?php echo $aDBc_category_info_count ;?></span>
387
+ </a>
388
+ <?php if(ADBC_PLUGIN_F_TYPE == "free" && $abreviation != "all" && $abreviation != "u"){ ?>
389
+ <span style="width:150px" class="aDBc_premium_tooltiptext"><?php _e('Available in Pro version!','advanced-database-cleaner') ?></span>
390
+ <?php } ?>
391
+ </span>
392
 
393
+ </span>
394
+ <?php
395
+ if($iterations < 6){
396
+ echo '<span class="aDBc-category-separator">|</span>';
397
+ }
398
+ }?>
399
+ </div>
400
 
401
+ <div class="aDBc-clear-both"></div>
402
+
403
+ <div id="aDBc_progress_container">
404
+ <div style="background:#ccc;width:100%;height:20px">
405
+ <div id="aDBc-progress-bar" class="aDBc_progress-bar"></div>
406
+ </div>
407
+ <div id="aDBc-response_container"></div>
408
+ </div>
409
+
410
+ <?php include_once 'header_page_filter.php'; ?>
411
 
412
+ <div class="aDBc-clear-both"></div>
413
+
414
+ <form id="aDBc_form" action="" method="post">
415
+ <?php
416
  // Print the options
417
  $this->display();
 
418
  ?>
419
  </form>
420
+
421
  </div>
422
  <div id="aDBc_dialog1" title="<?php _e('Cleaning...','advanced-database-cleaner'); ?>" class="aDBc-jquery-dialog">
423
  <p class="aDBc-box-warning">
424
+ <?php echo __('You are about to clean some of your options. This operation is irreversible!','advanced-database-cleaner') . "<span style='color:red'> " . __('Don\'t forget to make a backup of your database first.','advanced-database-cleaner') . "</span>" ; ?>
425
  </p>
426
  <p>
427
  <?php _e('Are you sure to continue?','advanced-database-cleaner'); ?>
428
  </p>
429
  </div>
430
+ <div id="aDBc_dialogx" title="<?php _e('Action required','advanced-database-cleaner'); ?>" class="aDBc-jquery-dialog">
431
  <p class="aDBc-box-info">
432
  <?php _e('Please select an action!','advanced-database-cleaner'); ?>
433
  </p>
includes/class_clean_tables.php CHANGED
@@ -14,17 +14,33 @@ class ADBC_Tables_List extends WP_List_Table {
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
  }
@@ -32,13 +48,100 @@ class ADBC_Tables_List extends WP_List_Table {
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();
@@ -46,29 +149,45 @@ class ADBC_Tables_List extends WP_List_Table {
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);
@@ -83,19 +202,35 @@ class ADBC_Tables_List extends WP_List_Table {
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];
@@ -111,7 +246,11 @@ class ADBC_Tables_List extends WP_List_Table {
111
 
112
  /** WP: Get bulk actions */
113
  function get_bulk_actions() {
 
114
  $actions = array(
 
 
 
115
  'delete' => __('Delete','advanced-database-cleaner')
116
  );
117
  return $actions;
@@ -119,11 +258,7 @@ class ADBC_Tables_List extends WP_List_Table {
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 */
@@ -137,6 +272,9 @@ class ADBC_Tables_List extends WP_List_Table {
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'])){
@@ -144,10 +282,62 @@ class ADBC_Tables_List extends WP_List_Table {
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
 
@@ -157,79 +347,293 @@ class ADBC_Tables_List extends WP_List_Table {
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
14
  /** Holds counts + info of tables categories */
15
  private $aDBc_tables_categories_info = array();
16
 
17
+ /** Should we display "run search" or "continue search" button (after a timeout failed). Default is "run search" */
18
+ private $aDBc_which_button_to_show = "new_search";
19
+
20
+ private $aDBc_total_tables_to_optimize = 0;
21
+ private $aDBc_total_lost = 0;
22
+ private $aDBc_tables_name_to_optimize = array();
23
+
24
+ private $aDBc_total_tables_to_repair = 0;
25
+ private $aDBc_tables_name_to_repair = array();
26
+
27
+ // This array contains belongs_to info about plugins and themes
28
+ private $array_belongs_to_counts = array();
29
+
30
+ // Holds msg that will be shown if the scan has finished with success
31
+ private $aDBc_search_has_finished_msg = "";
32
+
33
+ // Holds msg that will be shown if folder adbc_uploads cannot be created by the plugin (This is verified after clicking on scan button)
34
+ private $aDBc_permission_adbc_folder_msg = "";
35
+
36
  function __construct(){
37
+
38
  parent::__construct(array(
39
  'singular' => __('Table', 'advanced-database-cleaner'), //singular name of the listed records
40
+ 'plural' => __('Tables', 'advanced-database-cleaner'), //plural name of the listed records
41
+ 'ajax' => false //does this table support ajax?
42
  ));
43
+
 
 
 
 
44
  $this->aDBc_prepare_and_count_tables();
45
  $this->aDBc_print_page_content();
46
  }
48
  /** Prepare tables to display and count tables for each category */
49
  function aDBc_prepare_and_count_tables(){
50
 
51
+ // Verify if the search has finished to let user know about it and invite it to double check against our server
52
+ $search_finished = get_option("aDBc_last_search_ok_tables");
53
+ if(!empty($search_finished)){
54
+ $this->aDBc_search_has_finished_msg = __('The process of scanning has finished with success!','advanced-database-cleaner');
55
+ // Once we display success msg, we delete that option to not be loaded
56
+ delete_option("aDBc_last_search_ok_tables");
57
+ }
58
+
59
+ // Verify if the adbc_uploads cannot be created
60
+ $adbc_folder_permission = get_option("aDBc_permission_adbc_folder_needed");
61
+ if(!empty($adbc_folder_permission)){
62
+ $this->aDBc_permission_adbc_folder_msg = sprintf(__('The plugin needs to create the following directory "%1$s" to save the scan results but this was not possible automatically. Please create that directory manually and set correct permissions so it can be writable by the plugin.','advanced-database-cleaner'), ADBC_UPLOAD_DIR_PATH_TO_ADBC);
63
+ // Once we display the msg, we delete that option from DB
64
+ delete_option("aDBc_permission_adbc_folder_needed");
65
+ }
66
+
67
+ // Test if user wants to delete a scheduled task
68
+ if(isset($_POST['aDBc_delete_schedule'])){
69
+
70
+ //Quick nonce security check!
71
+ if(!check_admin_referer('delete_optimize_schedule_nonce', 'delete_optimize_schedule_nonce'))
72
+ return; //get out if we didn't click the delete link
73
+
74
+ // We delete the schedule
75
+ wp_clear_scheduled_hook('aDBc_optimize_scheduler', array($_POST['aDBc_delete_schedule']));
76
+
77
+ // We delete the item from database
78
+ $aDBc_schedules = get_option('aDBc_optimize_schedule');
79
+ unset($aDBc_schedules[$_POST['aDBc_delete_schedule']]);
80
+ update_option('aDBc_optimize_schedule', $aDBc_schedules, "no");
81
+
82
+ $this->aDBc_message = __('The clean-up schedule deleted successfully!', 'advanced-database-cleaner');
83
+ }
84
+
85
  // Process bulk action if any before preparing tables to display
86
+ $this->process_bulk_action();
87
+
88
+ // Get the names of all tables that should be optimized and count them to print it in the right side of the page
89
+ global $wpdb;
90
+ $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");
91
+ $this->aDBc_total_tables_to_optimize = count($aDBc_tables_to_optimize);
92
+ foreach($aDBc_tables_to_optimize as $table){
93
+
94
+ // Get table name
95
+ $table_name = "";
96
+ // This test to prevent issues in MySQL 8 where tables are not shown
97
+ // MySQL 5 uses $table->table_name while MySQL 8 uses $table->TABLE_NAME
98
+ if(array_key_exists("table_name", $table)){
99
+ $table_name = $table->table_name;
100
+ }else if(array_key_exists("TABLE_NAME", $table)){
101
+ $table_name = $table->TABLE_NAME;
102
+ }
103
+
104
+ array_push($this->aDBc_tables_name_to_optimize, $table_name);
105
+ $this->aDBc_total_lost += $table->data_free;
106
+ }
107
+
108
+ // Get the names of all tables that should be repaired and count them to print it in the right side of the page
109
+ $aDBc_tables_maybe_repair = $wpdb->get_results("SELECT table_name FROM information_schema.tables WHERE table_schema = '" . DB_NAME ."' and Engine IN ('CSV', 'MyISAM', 'ARCHIVE')");
110
+ foreach($aDBc_tables_maybe_repair as $table){
111
+
112
+ // Get table name
113
+ $table_name = "";
114
+ // This test to prevent issues in MySQL 8 where tables are not shown
115
+ // MySQL 5 uses $table->table_name while MySQL 8 uses $table->TABLE_NAME
116
+ if(array_key_exists("table_name", $table)){
117
+ $table_name = $table->table_name;
118
+ }else if(array_key_exists("TABLE_NAME", $table)){
119
+ $table_name = $table->TABLE_NAME;
120
+ }
121
+
122
+ $query_result = $wpdb->get_results("CHECK TABLE " . $table_name);
123
+ foreach($query_result as $row){
124
+ if($row->Msg_type == 'error'){
125
+ if(preg_match('/corrupt/i', $row->Msg_text)){
126
+ array_push($this->aDBc_tables_name_to_repair, $table_name);
127
+ }
128
+ }
129
+ }
130
  }
131
+ $this->aDBc_total_tables_to_repair = count($this->aDBc_tables_name_to_repair);
132
 
133
  // Prepare data
134
+ aDBc_prepare_items_to_display(
135
+ $this->aDBc_tables_to_display,
136
+ $this->aDBc_tables_categories_info,
137
+ $this->aDBc_which_button_to_show,
138
+ $this->aDBc_tables_name_to_optimize,
139
+ $this->aDBc_tables_name_to_repair,
140
+ $this->array_belongs_to_counts,
141
+ $this->aDBc_message,
142
+ $this->aDBc_class_message,
143
+ "tables"
144
+ );
145
 
146
  // Call WP prepare_items function
147
  $this->prepare_items();
149
 
150
  /** WP: Get columns */
151
  function get_columns(){
152
+ $aDBc_belongs_to_toolip = "<span class='aDBc-tooltips-headers'>
153
+ <img class='aDBc-info-image' src='". ADBC_PLUGIN_DIR_PATH . '/images/information2.svg' . "'/>
154
+ <span>" . __('Indicates the creator of the table: either a plugin, a theme or WordPress itself. If not sure about the creator, an estimation (%) will be displayed. The higher the percentage is, the more likely that the table belongs to that creator.','advanced-database-cleaner') ." </span>
155
+ </span>";
156
  $columns = array(
157
  'cb' => '<input type="checkbox" />',
158
  'table_prefix' => __('Prefix','advanced-database-cleaner'),
159
  'table_name' => __('Table name','advanced-database-cleaner'),
160
  'table_rows' => __('Rows','advanced-database-cleaner'),
161
  'table_size' => __('Size','advanced-database-cleaner'),
162
+ 'table_lost' => __('Lost','advanced-database-cleaner'),
163
+ 'site_id' => __('Site','advanced-database-cleaner'),
164
  'table_belongs_to' => __('Belongs to','advanced-database-cleaner') . $aDBc_belongs_to_toolip
165
  );
166
  return $columns;
167
  }
168
 
169
+ function get_sortable_columns() {
170
+
171
+ $sortable_columns = array(
172
+ 'table_name' => array('table_name',false),
173
+ 'table_rows' => array('table_rows',false),
174
+ 'table_size' => array('table_size',false),
175
+ 'site_id' => array('site_id',false)
176
+ );
177
+
178
+ return $sortable_columns;
179
+ }
180
+
181
  /** WP: Prepare items to display */
182
  function prepare_items() {
183
+ $columns = $this->get_columns();
184
+ $hidden = $this->get_hidden_columns();
185
+ $sortable = $this->get_sortable_columns();
186
+ $this->_column_headers = array($columns, $hidden, $sortable);
187
+ $per_page = 50;
188
+ if(!empty($_GET['per_page'])){
189
+ $per_page = absint($_GET['per_page']);
190
+ }
191
  $current_page = $this->get_pagenum();
192
  // Prepare sequence of tables to display
193
  $display_data = array_slice($this->aDBc_tables_to_display,(($current_page-1) * $per_page), $per_page);
202
  function get_hidden_columns(){
203
  // If MU, nothing to hide, else hide Side ID column
204
  if(function_exists('is_multisite') && is_multisite()){
205
+ return array('table_prefix','table_lost');
206
  }else{
207
+ return array('table_prefix','table_lost', 'site_id');
208
  }
209
  }
210
 
211
  /** WP: Column default */
212
  function column_default($item, $column_name){
213
  switch($column_name){
 
214
  case 'table_name':
215
+ $prefix_and_name = $item['table_prefix'] . $item[$column_name];
216
+ $return_name = "<span style='font-weight:bold;'>" . $item['table_prefix'] . "</span>" . $item[$column_name] ;
217
+ if($item['table_lost'] > 0 && in_array($prefix_and_name, $this->aDBc_tables_name_to_optimize)){
218
+ $lost = aDBc_get_size_from_bytes($item['table_lost']);
219
+ $return_name .= "<br/><span style='color:red;font-size:12px'><b>".__('Lost space','advanced-database-cleaner')."</b></span><span style='font-size:12px'> : " . $lost . "</span> <span style='color:grey'> (" . __('to optimize','advanced-database-cleaner') . ")</span>";
220
+ }
221
+ if(in_array($prefix_and_name, $this->aDBc_tables_name_to_repair)){
222
+ $return_name .= "<br/><span style='color:red;font-size:12px'><b>".__('Corrupted!','advanced-database-cleaner')."</b></span><span style='color:grey'> (" . __('to repair','advanced-database-cleaner') . ")</span>";
223
+ }
224
+ return $return_name;
225
+ break;
226
  case 'table_size':
227
+ return aDBc_get_size_from_bytes($item['table_size']);
228
+ break;
229
+ case 'table_lost':
230
+ return aDBc_get_size_from_bytes($item['table_lost']);
231
+ break;
232
+ case 'table_prefix':
233
+ case 'table_rows':
234
  case 'site_id':
235
  case 'table_belongs_to':
236
  return $item[$column_name];
246
 
247
  /** WP: Get bulk actions */
248
  function get_bulk_actions() {
249
+
250
  $actions = array(
251
+ 'optimize' => __('Optimize','advanced-database-cleaner'),
252
+ 'repair' => __('Repair','advanced-database-cleaner'),
253
+ 'empty' => __('Empty rows','advanced-database-cleaner'),
254
  'delete' => __('Delete','advanced-database-cleaner')
255
  );
256
  return $actions;
258
 
259
  /** WP: Message to display when no items found */
260
  function no_items() {
261
+ _e('No tables found!','advanced-database-cleaner');
 
 
 
 
262
  }
263
 
264
  /** WP: Process bulk actions */
272
  }
273
  $action = $this->current_action();
274
 
275
+ // Prepare an array containing names of tables deleted
276
+ $names_deleted = array();
277
+
278
  if($action == 'delete'){
279
  // If the user wants to clean the tables he/she selected
280
  if(isset($_POST['aDBc_tables_to_delete'])){
282
  foreach($_POST['aDBc_tables_to_delete'] as $table) {
283
  $table_info = explode("|", $table);
284
  $wpdb->query("DROP TABLE " . $table_info[0].$table_info[1]);
285
+ array_push($names_deleted, $table_info[1]);
286
+ }
287
+ // After deleting tables, delete names also from file categorization
288
+ if(ADBC_PLUGIN_F_TYPE == "pro"){
289
+ aDBc_refresh_categorization_file_after_delete($names_deleted, 'tables');
290
  }
291
+
292
  // Update the message to show to the user
293
  $this->aDBc_message = __('Selected tables cleaned successfully!', 'advanced-database-cleaner');
294
  }
295
+ }else if($action == 'optimize'){
296
+ // If the user wants to optimize the tables he/she selected
297
+ if(isset($_POST['aDBc_tables_to_delete'])){
298
+ global $wpdb;
299
+ foreach($_POST['aDBc_tables_to_delete'] as $table) {
300
+ $table_info = explode("|", $table);
301
+ $wpdb->query("OPTIMIZE TABLE " . $table_info[0].$table_info[1]);
302
+ }
303
+ // Update the message to show to the user
304
+ $this->aDBc_message = __('Selected tables optimized successfully!', 'advanced-database-cleaner');
305
+ }
306
+ }else if($action == 'empty'){
307
+ // If the user wants to empty the tables he/she selected
308
+ if(isset($_POST['aDBc_tables_to_delete'])){
309
+ global $wpdb;
310
+ foreach($_POST['aDBc_tables_to_delete'] as $table) {
311
+ $table_info = explode("|", $table);
312
+ $wpdb->query("TRUNCATE TABLE " . $table_info[0].$table_info[1]);
313
+ }
314
+ // Update the message to show to the user
315
+ $this->aDBc_message = __('Selected tables emptied successfully!', 'advanced-database-cleaner');
316
+ }
317
+ }else if($action == 'repair'){
318
+ // If the user wants to repair the tables he/she selected
319
+ if(isset($_POST['aDBc_tables_to_delete'])){
320
+ global $wpdb;
321
+ $cannot_repair = 0;
322
+ foreach($_POST['aDBc_tables_to_delete'] as $table) {
323
+ $table_info = explode("|", $table);
324
+ $query_result = $wpdb->get_results("REPAIR TABLE " . $table_info[0].$table_info[1]);
325
+ foreach($query_result as $row){
326
+ if($row->Msg_type == 'error'){
327
+ if(preg_match('/corrupt/i', $row->Msg_text)){
328
+ $cannot_repair++;
329
+ }
330
+ }
331
+ }
332
+ }
333
+ // Update the message to show to the user
334
+ if($cannot_repair == 0){
335
+ $this->aDBc_message = __('Selected tables repaired successfully!', 'advanced-database-cleaner');
336
+ }else{
337
+ $this->aDBc_class_message = "error";
338
+ $this->aDBc_message = __('Some of your tables cannot be repaired!', 'advanced-database-cleaner');
339
+ }
340
+ }
341
  }
342
  }
343
 
347
  if($this->aDBc_message != ""){
348
  echo '<div id="aDBc_message" class="' . $this->aDBc_class_message . ' notice is-dismissible"><p>' . $this->aDBc_message . '</p></div>';
349
  }
350
+
351
+ // Verify if the ajax call is still searching in background to prevent enabling the button
352
+ $still_searching = get_option("aDBc_temp_still_searching_tables");
353
+ if(!empty($still_searching)){
354
+ // This means that the ajax call is still searching
355
+ $aDBc_still_searching_msg = __('The process of categorization is still scanning tables in background. Maybe you have reloaded the page before it finishes the scan. The scan will stop automatically after scanning all items or after timeout.','advanced-database-cleaner');
356
+ echo '<div class="error notice is-dismissible"><p>' . $aDBc_still_searching_msg . '</p></div>';
357
+ }
358
+
359
+ // If the search has finished, show a msg to users
360
+ if(!empty($this->aDBc_search_has_finished_msg)){
361
+ echo '<div class="updated notice is-dismissible"><p>' . $this->aDBc_search_has_finished_msg . '</p></div>';
362
+ }
363
+
364
+ // If the folder adbc_uploads cannot be created, show a msg to users
365
+ if(!empty($this->aDBc_permission_adbc_folder_msg)){
366
+ echo '<div class="error notice is-dismissible"><p>' . $this->aDBc_permission_adbc_folder_msg . '</p></div>';
367
+ }
368
+
369
  ?>
370
  <div class="aDBc-content-max-width">
371
+
372
+ <!-- Print a notice/warning according to each type of tables -->
373
+ <?php
374
+ if(ADBC_PLUGIN_F_TYPE == "pro"){
375
+ if($_GET['aDBc_cat'] == 'o' && $this->aDBc_tables_categories_info['o']['count'] > 0){
376
+ echo '<div class="aDBc-box-warning-orphan">' . __('Tables below seem to be orphan! However, please delete only those you are sure to be orphan!','advanced-database-cleaner') . '</div>';
377
+ }else if(($_GET['aDBc_cat'] == 'all' || $_GET['aDBc_cat'] == 'u') && $this->aDBc_tables_categories_info['u']['count'] > 0){
378
+ echo '<div class="aDBc-box-info">' . __('Some of your tables are not categorized yet! Please click on the button below to categorize them!','advanced-database-cleaner') . '</div>';
379
+ }
380
+ }
381
+ ?>
382
+
383
+ <div class="aDBc-clear-both" style="margin-top:15px"></div>
384
+
385
+ <!-- Code for "run new search" button + Show loading image -->
386
+ <div style="float:left;">
387
+ <?php
388
+ if($this->aDBc_which_button_to_show == "new_search" ){
389
+ $aDBc_search_text = __('Scan tables','advanced-database-cleaner');
390
+ }else{
391
+ $aDBc_search_text = __('Continue scannig ...','advanced-database-cleaner');
392
+ }
393
+ ?>
394
+
395
+ <!-- This hidden input is used by ajax to know which item type we are dealing with -->
396
+ <input type="hidden" id="aDBc_item_type" value="tables"/>
397
+ <?php
398
+ // These hidden inputs are used by ajax to see if we should execute scanning process automatically by ajax after reloading a page
399
+ $iteration = get_option("aDBc_temp_last_iteration_tables");
400
+ ?>
401
+ <input type="hidden" id="aDBc_still_searching" value="<?php echo $still_searching; ?>"/>
402
+ <input type="hidden" id="aDBc_iteration" value="<?php echo $iteration; ?>"/>
403
+
404
+ <?php
405
+ if(ADBC_PLUGIN_F_TYPE == "free"){
406
+ ?>
407
+ <div class="aDBc_premium_tooltip">
408
+ <input id="aDBc_new_search_button" type="submit" class="aDBc-run-new-search" value="<?php echo $aDBc_search_text; ?>" name="aDBc_new_search_button" style="opacity:0.5" disabled/>
409
+ <span style="width:390px" class="aDBc_premium_tooltiptext"><?php _e('Please <a href="?page=advanced_db_cleaner&aDBc_tab=premium">upgrade</a> to Pro to categorize and detect orphaned tables','advanced-database-cleaner') ?></span>
410
+ </div>
411
+ <?php
412
+ }else { ?>
413
+
414
+ <input id="aDBc_new_search_button" type="submit" class="aDBc-run-new-search" value="<?php echo $aDBc_search_text; ?>" name="aDBc_new_search_button" />
415
+
416
+ <?php
417
+ }
418
+ ?>
419
+
420
+ </div>
421
+
422
+ <!-- Print numbers of tables found in each category -->
423
+ <div class="aDBc-category-counts">
424
  <?php
425
  $aDBc_new_URI = $_SERVER['REQUEST_URI'];
426
  // Remove the paged parameter to start always from the first page when selecting a new category of tables
427
  $aDBc_new_URI = remove_query_arg('paged', $aDBc_new_URI);
428
+ $iterations = 0;
429
+ foreach($this->aDBc_tables_categories_info as $abreviation => $category_info){
430
+ $iterations++;
431
+ $aDBc_new_URI = add_query_arg('aDBc_cat', $abreviation, $aDBc_new_URI);?>
432
+ <span class="<?php echo $abreviation == $_GET['aDBc_cat'] ? 'aDBc-selected-category' : ''?>" style="<?php echo $abreviation == $_GET['aDBc_cat'] ? 'border-bottom: 1px solid ' . $category_info['color'] : '' ?>">
433
+
434
+ <?php
435
+ if(ADBC_PLUGIN_F_TYPE == "pro" || $abreviation == "all"|| $abreviation == "u"){
436
+ $aDBc_link_style = "color:" . $category_info['color'];
437
+ $aDBc_category_info_count = "(". $category_info['count'] . ")";
438
+ }else{
439
+ $aDBc_link_style = "color:" . $category_info['color'] . ";cursor:default;pointer-events:none";
440
+ $aDBc_category_info_count = "(*)";
441
+ $aDBc_new_URI = "";
 
 
 
 
442
  }
443
+ ?>
444
+
445
+ <span class="aDBc_premium_tooltip">
446
+ <a href="<?php echo $aDBc_new_URI; ?>" class="aDBc-category-counts-links" style="<?php echo $aDBc_link_style ; ?>">
447
+ <span><?php echo $category_info['name']; ?></span>
448
+ <span><?php echo $aDBc_category_info_count ;?></span>
449
+ </a>
450
+ <?php if(ADBC_PLUGIN_F_TYPE == "free" && $abreviation != "all" && $abreviation != "u"){ ?>
451
+ <span style="width:150px" class="aDBc_premium_tooltiptext"><?php _e('Available in Pro version!','advanced-database-cleaner') ?></span>
452
+ <?php } ?>
453
+ </span>
454
+
455
+ </span>
456
+ <?php
457
+ if($iterations < 6){
458
+ echo '<span class="aDBc-category-separator">|</span>';
459
+ }
460
+ }?>
461
+ </div>
462
+
463
+ <div class="aDBc-clear-both"></div>
464
+
465
+ <div id="aDBc_progress_container">
466
+ <div style="background:#ccc;width:100%;height:20px">
467
+ <div id="aDBc-progress-bar" class="aDBc_progress-bar"></div>
468
  </div>
469
+ <div id="aDBc-response_container"></div>
470
+ </div>
471
 
472
+ <?php include_once 'header_page_filter.php'; ?>
473
 
474
+ <div class="aDBc-clear-both"></div>
 
 
475
 
476
+ <form id="aDBc_form" action="" method="post">
477
+ <div class="aDBc-left-content">
478
+ <?php
479
+ // Print the tables
480
+ $this->display();
481
+ ?>
482
+ </div>
483
+ </form>
484
+
485
+ <div class="aDBc-right-box">
486
+ <div style="text-align:center">
487
+ <?php if($this->aDBc_total_tables_to_optimize == 0 && $this->aDBc_total_tables_to_repair == 0){ ?>
488
+ <img width="58px" src="<?php echo ADBC_PLUGIN_DIR_PATH . '/images/db_clean.svg'?>"/>
489
+ <div class="aDBc-text-status-db"><?php _e('Your database is optimized!','advanced-database-cleaner'); ?></div>
490
+ <?php } else {
491
+
492
+ // Add link to numbers of tables that should be optimized
493
+ $aDBc_new_URI = $_SERVER['REQUEST_URI'];
494
+ $aDBc_new_URI = remove_query_arg(array('paged', 's', 'belongs_to'), $aDBc_new_URI);
495
+ $aDBc_new_URI = add_query_arg('t_type', 'optimize', $aDBc_new_URI);
496
+ $aDBc_new_URI = add_query_arg('aDBc_cat', 'all', $aDBc_new_URI);
497
+ ?>
498
+
499
+ <img width="55px" src="<?php echo ADBC_PLUGIN_DIR_PATH . '/images/warning.svg'?>"/>
500
+
501
+ <?php if($this->aDBc_total_tables_to_optimize > 0){ ?>
502
+ <div class="aDBc-text-status-db">
503
+ <b><a href="<?php echo $aDBc_new_URI; ?>"><?php echo $this->aDBc_total_tables_to_optimize; ?></a></b> <?php _e('table(s) should be optimized!','advanced-database-cleaner'); ?>
504
+ </div>
505
+ <div>
506
+ <?php
507
+ $aDBc_table_size = aDBc_get_size_from_bytes($this->aDBc_total_lost);
508
+ echo __('You can save around','advanced-database-cleaner') . " : " . $aDBc_table_size;
509
+ ?>
510
+ </div>
511
+ <?php } ?>
512
+
513
+ <?php if($this->aDBc_total_tables_to_repair > 0){
514
+ $aDBc_new_URI = add_query_arg('t_type', 'repair', $aDBc_new_URI);
515
  ?>
516
+ <div class="aDBc-text-status-db" style="<?php echo $this->aDBc_total_tables_to_optimize > 0 ? 'padding-top:10px;margin-top:10px;border-top:1px dashed grey' : ''; ?>">
517
+ <b><a href="<?php echo $aDBc_new_URI; ?>"><?php echo $this->aDBc_total_tables_to_repair; ?></a></b> <?php _e('table(s) should be repaired!','advanced-database-cleaner'); ?>
518
+ </div>
519
+ <?php } ?>
520
+
521
+ <?php } ?>
522
  </div>
523
 
524
+ <div class="aDBc-schedule-box" style="text-align:center">
525
 
526
+ <img width="60px" src="<?php echo ADBC_PLUGIN_DIR_PATH . '/images/alarm-clock.svg'?>"/>
 
 
 
 
527
 
528
+ <?php
529
+ $aDBc_schedules = get_option('aDBc_optimize_schedule');
530
+ $aDBc_schedules = is_array($aDBc_schedules) ? $aDBc_schedules : array();
531
 
532
+ // Count schedules available
533
+ $count_schedules = count($aDBc_schedules);
534
+ echo "<div class='aDBc-schedule-text'><b>" . $count_schedules ."</b> " .__('optimize schedule(s) set','advanced-database-cleaner') . "</div>";
535
+
536
+ foreach($aDBc_schedules as $hook_name => $hook_params){
537
+ echo "<div class='aDBc-schedule-hook-box'>";
538
+ echo "<b>".__('Name','advanced-database-cleaner') . "</b> : " . $hook_name;
539
+ echo "</br>";
540
+
541
+ // We convert hook name to a string because the arg maybe only a digit!
542
+ $timestamp = wp_next_scheduled("aDBc_optimize_scheduler", array($hook_name . ''));
543
+ if($timestamp){
544
+ $next_run = get_date_from_gmt(date('Y-m-d H:i:s', $timestamp), 'M j, Y - H:i');
545
+ }else{
546
+ $next_run = "---";
547
+ }
548
+ echo "<b>".__('Next run','advanced-database-cleaner') . "</b> : " . $next_run . "</br>";
549
+
550
+ $operation1 = in_array('optimize', $hook_params['operations']) ? __('Optimize','advanced-database-cleaner') : '';
551
+ $operation2 = in_array('repair', $hook_params['operations']) ? __('Repair','advanced-database-cleaner') : '';
552
+ $plus = !empty($operation1) && !empty($operation2) ? " + " : "";
553
+ echo "<b>".__('Perform','advanced-database-cleaner') . "</b> : " . $operation1 . $plus . $operation2 . "</br>";
554
+
555
+ $repeat = $hook_params['repeat'];
556
+ switch($repeat){
557
+ case "once" :
558
+ $repeat = __('Once','advanced-database-cleaner');
559
+ break;
560
+ case "hourly" :
561
+ $repeat = __('Hourly','advanced-database-cleaner');
562
+ break;
563
+ case "twicedaily" :
564
+ $repeat = __('Twice a day','advanced-database-cleaner');
565
+ break;
566
+ case "daily" :
567
+ $repeat = __('Daily','advanced-database-cleaner');
568
+ break;
569
+ case "weekly" :
570
+ $repeat = __('Weekly','advanced-database-cleaner');
571
+ break;
572
+ case "monthly" :
573
+ $repeat = __('Monthly','advanced-database-cleaner');
574
+ break;
575
+ }
576
+
577
+ echo "<b>".__('Frequency','advanced-database-cleaner') . "</b> : " . $repeat . "</br>";
578
+
579
+ echo $hook_params['active'] == "1" ? "<img class='aDBc-schedule-on-off' src='". ADBC_PLUGIN_DIR_PATH . "/images/switch-on.svg" . "'/>" : "<img class='aDBc-schedule-on-off' src='". ADBC_PLUGIN_DIR_PATH . "/images/switch-off.svg" . "'/>";
580
+
581
+ $aDBc_new_URI = $_SERVER['REQUEST_URI'];
582
+ $aDBc_new_URI = add_query_arg('aDBc_view', 'edit_optimize_schedule', $aDBc_new_URI);
583
+ $aDBc_new_URI = add_query_arg('hook_name', $hook_name, $aDBc_new_URI);
584
+
585
+ ?>
586
+
587
+ <span class="aDBc-edit-schedule">
588
+ <a href="<?php echo $aDBc_new_URI ?>" style="text-decoration:none;margin-right:3px">
589
+ <?php _e('Edit','advanced-database-cleaner') ?>
590
+ </a> |
591
+ <form action="" method="post" style="float:right;margin-left:3px">
592
+ <input type="hidden" name="aDBc_delete_schedule" value="<?php echo $hook_name ?>" />
593
+ <input class="aDBc-submit-link" type="submit" value="<?php _e('Delete','advanced-database-cleaner') ?>" />
594
+ <?php wp_nonce_field('delete_optimize_schedule_nonce', 'delete_optimize_schedule_nonce') ?>
595
+ </form>
596
+ </span>
597
+ </div>
598
+ <?php
599
+
600
+ }
601
+
602
+ $aDBc_new_URI = $_SERVER['REQUEST_URI'];
603
+ $aDBc_new_URI = add_query_arg('aDBc_view', 'add_optimize_schedule', $aDBc_new_URI);
604
+ ?>
605
+
606
+ <a href="<?php echo $aDBc_new_URI ?>" id="aDBc_add_schedule" style="margin-top:20px;width:100%" class="button-primary">
607
+ <?php _e('Add new schedule','advanced-database-cleaner'); ?>
608
+ </a>
609
+
610
+ </div>
611
+
612
+ </div>
613
+
614
+ <div class="aDBc-clear-both"></div>
615
 
 
 
616
  </div>
617
+
618
  <div id="aDBc_dialog1" title="<?php _e('Cleaning...','advanced-database-cleaner'); ?>" class="aDBc-jquery-dialog">
619
  <p class="aDBc-box-warning">
620
+ <?php echo __('You are about to delete some of your tables. This operation is irreversible!','advanced-database-cleaner') . "<span style='color:red'> " . __('Don\'t forget to make a backup of your database first.','advanced-database-cleaner') . "</span>" ; ?>
621
  </p>
622
  <p>
623
  <?php _e('Are you sure to continue?','advanced-database-cleaner'); ?>
624
  </p>
625
  </div>
626
+ <div id="aDBc_dialog2" title="<?php _e('Cleaning...','advanced-database-cleaner'); ?>" class="aDBc-jquery-dialog">
627
+ <p class="aDBc-box-warning">
628
+ <?php echo __('You are about to empty some of your tables. This operation is irreversible!','advanced-database-cleaner') . "<span style='color:red'> " . __('Don\'t forget to make a backup of your database first.','advanced-database-cleaner') . "</span>" ; ?>
629
+ </p>
630
+ <p>
631
+ <?php _e('Are you sure to continue?','advanced-database-cleaner'); ?>
632
+ </p>
633
+ </div>
634
+ <div id="aDBc_dialogx" title="<?php _e('Action required','advanced-database-cleaner'); ?>" class="aDBc-jquery-dialog">
635
  <p class="aDBc-box-info">
636
+ <?php _e('Please choose an action!','advanced-database-cleaner'); ?>
637
  </p>
638
  </div>
639
  <?php
includes/class_general_cleanup.php CHANGED
@@ -10,23 +10,12 @@ class ADBC_Clean_DB_List extends WP_List_Table {
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();
@@ -34,27 +23,149 @@ class ADBC_Clean_DB_List extends WP_List_Table {
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
  );
@@ -65,11 +176,24 @@ class ADBC_Clean_DB_List extends WP_List_Table {
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;
@@ -103,6 +227,8 @@ class ADBC_Clean_DB_List extends WP_List_Table {
103
  case 'element_to_clean':
104
  case 'count':
105
  case 'view':
 
 
106
  case 'type':
107
  return $item[$column_name];
108
  default:
@@ -112,7 +238,7 @@ class ADBC_Clean_DB_List extends WP_List_Table {
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 */
@@ -141,6 +267,7 @@ class ADBC_Clean_DB_List extends WP_List_Table {
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);
@@ -161,6 +288,7 @@ class ADBC_Clean_DB_List extends WP_List_Table {
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();
@@ -168,72 +296,119 @@ class ADBC_Clean_DB_List extends WP_List_Table {
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
  }
10
  * Constructor
11
  */
12
  function __construct(){
13
+
14
  parent::__construct(array(
15
  'singular' => __('Element', 'advanced-database-cleaner'), //singular name of the listed records
16
  'plural' => __('Elements', 'advanced-database-cleaner'), //plural name of the listed records
17
  'ajax' => false //does this table support ajax?
18
+ ));
 
 
 
 
 
 
 
 
 
 
 
19
 
20
  $this->aDBc_prepare_elements_to_clean();
21
  $this->aDBc_print_page_content();
23
 
24
  /** Prepare elements to display */
25
  function aDBc_prepare_elements_to_clean(){
26
+
27
+ // Test if user wants to delete a scheduled task
28
+ if(isset($_POST['aDBc_delete_schedule'])){
29
+
30
+ //Quick nonce security check!
31
+ if(!check_admin_referer('delete_cleanup_schedule_nonce', 'delete_cleanup_schedule_nonce'))
32
+ return; //get out if we didn't click the delete link
33
+
34
+ // We delete the schedule
35
+ wp_clear_scheduled_hook('aDBc_clean_scheduler', array($_POST['aDBc_delete_schedule']));
36
+
37
+ // We delete the item from database
38
+ $aDBc_schedules = get_option('aDBc_clean_schedule');
39
+ unset($aDBc_schedules[$_POST['aDBc_delete_schedule']]);
40
+ update_option('aDBc_clean_schedule', $aDBc_schedules, "no");
41
+
42
+ $this->aDBc_message = __('The clean-up schedule deleted successfully!', 'advanced-database-cleaner');
43
+ }
44
+
45
+ // Test if user wants to edit keep_last column for an item
46
+ if(isset($_POST['aDBc_keep_input'])){
47
+ $settings = get_option('aDBc_settings');
48
+ if(empty($settings['keep_last'])){
49
+ $keep_value = array($_POST['aDBc_item_keep_to_edit'] => intval($_POST['aDBc_keep_input']));
50
+ }else{
51
+ $keep_value = $settings['keep_last'];
52
+ $keep_value[$_POST['aDBc_item_keep_to_edit']] = intval($_POST['aDBc_keep_input']);
53
+ }
54
+ $settings['keep_last'] = $keep_value;
55
+ update_option('aDBc_settings', $settings, "no");
56
+
57
+ // Test if the items belongs to a scheduled task. If so, show msg differently
58
+ $aDBc_schedules = get_option('aDBc_clean_schedule');
59
+ $aDBc_schedules = is_array($aDBc_schedules) ? $aDBc_schedules : array();
60
+ $msg_keep_last = __("The 'keep last' value saved successfully!", "advanced-database-cleaner");
61
+ foreach($aDBc_schedules as $hook_name => $hook_params){
62
+ $lits_of_elements = $hook_params['elements_to_clean'];
63
+ if(in_array ($_POST['aDBc_item_keep_to_edit'], $lits_of_elements)){
64
+ $msg_keep_last = __("The 'keep last' value saved successfully!", "advanced-database-cleaner") . " <span style='color:orange'>" . __("Please keep in mind that this will change the value of 'keep last' of your corresponding scheduled tasks as well!", "advanced-database-cleaner") . "</span>";
65
+ break;
66
+ }
67
+ }
68
+
69
+ $this->aDBc_message = $msg_keep_last;
70
+ }
71
+ // yyy should this $wpdb be cleaned?
72
  global $wpdb;
73
+
74
  // Process bulk action if any before preparing elements to clean
75
+ $this->process_bulk_action();
76
+
77
  // Get all unused elements
78
  $aDBc_unused_elements = aDBc_count_all_elements_to_clean();
79
  $aDBc_new_URI = $_SERVER['REQUEST_URI'];
80
+
81
+ // Get settings from DB
82
+ $settings = get_option('aDBc_settings');
83
+
84
+ $aDBc_schedules = get_option('aDBc_clean_schedule');
85
+ $aDBc_schedules = is_array($aDBc_schedules) ? $aDBc_schedules : array();
86
+
87
  foreach($aDBc_unused_elements as $element_type => $element_info){
88
+ // Count total unused elements. DO not take into account transient with expiration and not expiring transients because they are not intended to be cleaned
89
+ if($element_type != "transients-with-expiration" && $element_type != "transients-with-no-expiration")
90
+ $this->aDBc_total_elements_to_clean += $element_info['count'];
91
+
92
+ // If the item is scheduled, show green image, otherwise show grey one. Select also the text to show next green image
93
+ $scheduled_img_name = "grey_clock.svg";
94
+ $item_scheduled_in = "";
95
+ foreach($aDBc_schedules as $hook_name => $hook_params){
96
+ $lits_of_elements = $hook_params['elements_to_clean'];
97
+ if(in_array ($element_type, $lits_of_elements)){
98
+ $scheduled_img_name = "green_clock.svg";
99
+ $item_scheduled_in .= "<div style='background:#f1f5f5;color:#000;border-radius:4px;padding:1px;margin:2px'>" . $hook_name . "</div>";
100
+ }
101
+ }
102
+ if(empty($item_scheduled_in)){
103
+ $aDBc_scheduled = "<img style='width:20px' alt='-' src='".ADBC_PLUGIN_DIR_PATH . "/images/" . $scheduled_img_name . "'/>";
104
+ }else{
105
+ $aDBc_scheduled = "<span class='aDBc-tooltips-headers'>
106
+ <img class='aDBc-info-image' style='width:20px' alt='-' src='".ADBC_PLUGIN_DIR_PATH . "/images/" . $scheduled_img_name . "'/><span style='width:190px'>" . __('Scheduled in:','advanced-database-cleaner') . $item_scheduled_in . "</span></span>";
107
+ }
108
+
109
  if($element_info['count'] > 0){
110
+ $color = "red";
111
+ if($element_type == "transients-with-expiration" || $element_type == "transients-with-no-expiration"){
112
+ $color = "#999";
113
+ }
114
+ $aDBc_count = "<font color='$color' style='font-weight:bold'>" . $element_info['count'] . "</font>";
115
  $aDBc_new_URI = add_query_arg('aDBc_view', $element_type, $aDBc_new_URI);
116
+ $aDBc_see = "<a href='$aDBc_new_URI'><img width='20px' alt='view' src='".ADBC_PLUGIN_DIR_PATH . '/images/see.svg'."'/></a>";
117
+ }else{
118
+ $aDBc_count = "<font color='#ccc' style='font-weight:bold'>0</font>";
119
+ $aDBc_see = "<img width='20px' alt='-' src='".ADBC_PLUGIN_DIR_PATH . '/images/nothing_to_see.svg'."'/>";
120
+ }
121
+
122
+ // Get "keep_last" option. This option is added in ADBC version 3.0, so test if it is not empty before using it
123
+ if(empty($settings['keep_last'])){
124
+ $keep_number = '0';
125
  }else{
126
+ $keep_setting = $settings['keep_last'];
127
+ if(empty($keep_setting[$element_type])){
128
+ $keep_number = '0';
129
+ }else{
130
+ $keep_number = $keep_setting[$element_type];
131
+ }
132
  }
133
+ // If the item can have keep_last, then prepare it, otherwise echo N/A
134
+ if($element_type == "revision" ||
135
+ $element_type == "auto-draft" ||
136
+ $element_type == "trash-posts" ||
137
+ $element_type == "moderated-comments" ||
138
+ $element_type == "spam-comments" ||
139
+ $element_type == "trash-comments" ||
140
+ $element_type == "pingbacks" ||
141
+ $element_type == "trackbacks"){
142
+
143
+ $save_button = __('Save','advanced-database-cleaner');
144
+
145
+ $keep_info = "<span id='aDBc_keep_label_$element_type'>" . $keep_number . " " . __('days','advanced-database-cleaner') . " | </span>" . "<a id='aDBc_edit_keep_$element_type' class='aDBc_keep_link'>Edit</a>";
146
+
147
+ $keep_info .= "<form action='' method='post'>
148
+ <input type='hidden' name='aDBc_item_keep_to_edit' value='$element_type'>
149
+ <input id='aDBc_keep_input_$element_type' class='aDBc_keep_input' name='aDBc_keep_input' value='$keep_number'/>
150
+ <input id='aDBc_keep_button_$element_type' class='aDBc_keep_button button-primary' type='submit' value='$save_button' style='display: none;'/>
151
+ <a id='aDBc_keep_cancel_$element_type' class='aDBc_keep_cancel_link'> " . __('Cancel','advanced-database-cleaner') . "</a></form>";
152
+ }else{
153
+ $keep_info = __('N/A','advanced-database-cleaner') ;
154
+ }
155
+
156
+
157
+ if($element_type == "revision"){
158
+
159
+ }else if($element_type == "revision"){
160
+ $keep_info = __('N/A','advanced-database-cleaner') ;
161
+ }
162
+
163
  array_push($this->aDBc_elements_to_display, array(
164
+ 'element_to_clean' => "<a href='". $element_info['URL_blog'] ."' target='_blank' class='aDBc_info_icon'>&nbsp;</a>" . $element_info['name'],
165
  'count' => $aDBc_count,
166
  'view' => $aDBc_see,
167
+ 'scheduled' => $aDBc_scheduled,
168
+ 'keep' => $keep_info,
169
  'type' => $element_type
170
  )
171
  );
176
 
177
  /** WP: Get columns */
178
  function get_columns(){
179
+
180
+ $aDBc_scheduled_toolip = "<span class='aDBc-tooltips-headers'>
181
+ <img class='aDBc-info-image' src='". ADBC_PLUGIN_DIR_PATH . '/images/information2.svg' . "'/>
182
+ <span>" . __('Indicates if you have selected the item to be cleaned automatically on a scheduled task. A green image indicates that the item is scheduled while a grey image indicated the opposite.','advanced-database-cleaner') ." </span>
183
+ </span>";
184
+
185
+ $aDBc_keep_last_toolip = "<span class='aDBc-tooltips-headers'>
186
+ <img class='aDBc-info-image' src='". ADBC_PLUGIN_DIR_PATH . '/images/information2.svg' . "'/>
187
+ <span>" . __('Keep the last x days’ data from being displayed, and therefore from being cleaned. The plugin will always show only data older than the number of days you have specified.','advanced-database-cleaner') ." </span>
188
+ </span>";
189
+
190
  $columns = array(
191
  'cb' => '<input type="checkbox" />',
192
+ 'element_to_clean' => __('Elements to clean','advanced-database-cleaner'),
193
  'count' => __('Count','advanced-database-cleaner'),
194
  'view' => __('View','advanced-database-cleaner'),
195
+ 'scheduled' => __('Scheduled','advanced-database-cleaner') . $aDBc_scheduled_toolip,
196
+ 'keep' => __('Keep last','advanced-database-cleaner') . $aDBc_keep_last_toolip,
197
  'type' => 'Type'
198
  );
199
  return $columns;
227
  case 'element_to_clean':
228
  case 'count':
229
  case 'view':
230
+ case 'scheduled':
231
+ case 'keep':
232
  case 'type':
233
  return $item[$column_name];
234
  default:
238
 
239
  /** WP: Column cb for check box */
240
  function column_cb($item) {
241
+ return sprintf('<input id="checkbox_%s" type="checkbox" name="aDBc_elements_to_clean[]" value="%s" />', $item['type'], $item['type']);
242
  }
243
 
244
  /** WP: Get bulk actions */
267
  if($action == 'clean'){
268
  // If the user wants to clean the elements he/she selected
269
  if(isset($_POST['aDBc_elements_to_clean'])){
270
+ // yyy should this $wpdb be cleaned?
271
  global $wpdb;
272
  foreach($_POST['aDBc_elements_to_clean'] as $element) {
273
  aDBc_clean_all_elements_type($element);
288
  <div class="aDBc-content-max-width">
289
  <div class="aDBc-left-content">
290
  <form id="aDBc_form" action="" method="post">
291
+
292
  <?php
293
  // Print the elements to clean
294
  $this->display();
296
  </form>
297
  </div>
298
  <div class="aDBc-right-box">
299
+
300
  <div style="text-align:center">
301
  <?php if($this->aDBc_total_elements_to_clean == 0){ ?>
302
+ <img width="58px" src="<?php echo ADBC_PLUGIN_DIR_PATH . '/images/db_clean.svg'?>"/>
303
  <div class="aDBc-text-status-db"><?php _e('Your database is clean!','advanced-database-cleaner'); ?></div>
304
  <?php } else { ?>
305
+ <img width="55px" src="<?php echo ADBC_PLUGIN_DIR_PATH . '/images/warning.svg'?>"/>
306
+ <div class="aDBc-text-status-db"><b><?php echo $this->aDBc_total_elements_to_clean; ?></b> <?php _e('Element(s) can be cleaned!','advanced-database-cleaner'); ?></div>
307
  <?php } ?>
308
  </div>
309
+
310
+ <div class="aDBc-schedule-box" style="text-align:center">
311
+
312
+ <img width="60px" src="<?php echo ADBC_PLUGIN_DIR_PATH . '/images/alarm-clock.svg'?>"/>
313
+
314
+ <?php
315
+ $aDBc_schedules = get_option('aDBc_clean_schedule');
316
+ $aDBc_schedules = is_array($aDBc_schedules) ? $aDBc_schedules : array();
317
+
318
+ // Count schedules available
319
+ $count_schedules = count($aDBc_schedules);
320
+ echo "<div class='aDBc-schedule-text'><b>" . $count_schedules ."</b> " .__('Cleanup schedule(s) set','advanced-database-cleaner') . "</div>";
321
+
322
+ foreach($aDBc_schedules as $hook_name => $hook_params){
323
+ echo "<div class='aDBc-schedule-hook-box'>";
324
+ echo "<b>".__('Name','advanced-database-cleaner') . "</b> : " . $hook_name;
325
+ echo "</br>";
326
+
327
+ // We convert hook name to a string because the arg maybe only a digit!
328
+ $timestamp = wp_next_scheduled("aDBc_clean_scheduler", array($hook_name . ''));
329
+ if($timestamp){
330
+ $next_run = get_date_from_gmt(date('Y-m-d H:i:s', $timestamp), 'M j, Y - H:i');
331
+ }else{
332
+ $next_run = "---";
333
+ }
334
+ echo "<b>".__('Next run','advanced-database-cleaner') . "</b> : " . $next_run . "</br>";
335
+
336
+ $repeat = $hook_params['repeat'];
337
+ switch($repeat){
338
+ case "once" :
339
+ $repeat = __('Once','advanced-database-cleaner');
340
+ break;
341
+ case "hourly" :
342
+ $repeat = __('Hourly','advanced-database-cleaner');
343
+ break;
344
+ case "twicedaily" :
345
+ $repeat = __('Twice a day','advanced-database-cleaner');
346
+ break;
347
+ case "daily" :
348
+ $repeat = __('Daily','advanced-database-cleaner');
349
+ break;
350
+ case "weekly" :
351
+ $repeat = __('Weekly','advanced-database-cleaner');
352
+ break;
353
+ case "monthly" :
354
+ $repeat = __('Monthly','advanced-database-cleaner');
355
+ break;
356
+ }
357
+
358
+ echo "<b>".__('Frequency','advanced-database-cleaner') . "</b> : " . $repeat . "</br>";
359
+
360
+ echo "<b>".__('Items to clean','advanced-database-cleaner') . " : </b>" . count($hook_params['elements_to_clean'])."</br>";
361
+
362
+ echo $hook_params['active'] == "1" ? "<img class='aDBc-schedule-on-off' src='". ADBC_PLUGIN_DIR_PATH . "/images/switch-on.svg" . "'/>" : "<img class='aDBc-schedule-on-off' src='". ADBC_PLUGIN_DIR_PATH . "/images/switch-off.svg" . "'/>";
363
+
364
+ $aDBc_new_URI = $_SERVER['REQUEST_URI'];
365
+ $aDBc_new_URI = add_query_arg('aDBc_view', 'edit_cleanup_schedule', $aDBc_new_URI);
366
+ $aDBc_new_URI = add_query_arg('hook_name', $hook_name, $aDBc_new_URI);
367
+
368
+ ?>
369
+
370
+ <span style="border-radius: 4px;font-size:11px;background:#f0f5fa;padding:2px 4px;float:right;margin-top:4px">
371
+ <a href="<?php echo $aDBc_new_URI ?>" style="text-decoration:none;margin-right:3px">
372
+ <?php _e('Edit','advanced-database-cleaner') ?>
373
+ </a> |
374
+ <form action="" method="post" style="float:right;margin-left:3px">
375
+ <input type="hidden" name="aDBc_delete_schedule" value="<?php echo $hook_name ?>" />
376
+ <input class="aDBc-submit-link" type="submit" value="<?php _e('Delete','advanced-database-cleaner') ?>" />
377
+ <?php wp_nonce_field('delete_cleanup_schedule_nonce', 'delete_cleanup_schedule_nonce') ?>
378
+ </form>
379
  </span>
380
+ </div>
381
+
382
+ <?php
383
+
384
+ }
385
+
386
+ $aDBc_new_URI = $_SERVER['REQUEST_URI'];
387
+ $aDBc_new_URI = add_query_arg('aDBc_view', 'add_cleanup_schedule', $aDBc_new_URI);
388
+ ?>
389
+
390
+ <a href="<?php echo $aDBc_new_URI ?>" id="aDBc_add_schedule" style="margin-top:20px;width:100%" class="button-primary">
391
+ <?php _e('Add new schedule','advanced-database-cleaner'); ?>
392
+ </a>
393
+
394
  </div>
395
  </div>
396
  <div class="aDBc-clear-both"></div>
397
  </div>
398
  <div id="aDBc_dialog1" title="<?php _e('Cleaning...','advanced-database-cleaner'); ?>" class="aDBc-jquery-dialog">
399
  <p class="aDBc-box-warning">
400
+ <?php echo __('You are about to clean some of your unused data. This operation is irreversible!','advanced-database-cleaner') . "<span style='color:red'> " . __('Don\'t forget to make a backup of your database first.','advanced-database-cleaner') . "</span>" ; ?>
401
  </p>
402
  <p>
403
  <?php _e('Are you sure to continue?','advanced-database-cleaner'); ?>
404
  </p>
405
  </div>
406
+ <div id="aDBc_dialogx" title="<?php _e('Action required','advanced-database-cleaner'); ?>" class="aDBc-jquery-dialog">
407
  <p class="aDBc-box-info">
408
  <?php _e('Please select an action!','advanced-database-cleaner'); ?>
409
  </p>
410
+ </div>
411
+
412
  <?php
413
  }
414
  }
includes/class_optimize_tables.php DELETED
@@ -1,294 +0,0 @@
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_db.php CHANGED
@@ -1,28 +1,57 @@
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';
1
  <?php
2
 
 
3
  if(isset($_GET['aDBc_view'])){
4
+
5
+ // If the user wants to perform custom cleaning
6
+
7
+ if($_GET['aDBc_view'] == "revision" ||
8
+ $_GET['aDBc_view'] == "auto-draft" ||
9
+ $_GET['aDBc_view'] == "trash-posts"){
10
+
11
+ include_once 'custom-clean-view/class_clean_revision_draft_trash.php';
12
+ new ADBC_Clean_Revision_Trash_Draft($_GET['aDBc_view']);
13
+
14
  }else if($_GET['aDBc_view'] == "moderated-comments" ||
15
  $_GET['aDBc_view'] == "spam-comments" ||
16
+ $_GET['aDBc_view'] == "trash-comments" ||
17
+ $_GET['aDBc_view'] == "pingbacks" ||
18
+ $_GET['aDBc_view'] == "trackbacks"){
19
+
20
  include_once 'custom-clean-view/class_clean_comment.php';
21
  new ADBC_Clean_Comment($_GET['aDBc_view']);
22
+
23
+ }else if($_GET['aDBc_view'] == "orphan-postmeta" ||
24
+ $_GET['aDBc_view'] == "orphan-commentmeta" ||
25
+ $_GET['aDBc_view'] == "orphan-usermeta" ||
26
+ $_GET['aDBc_view'] == "orphan-termmeta"){
27
+
28
+ include_once 'custom-clean-view/class_clean_meta_comment_post_user_term.php';
29
+ new ADBC_Clean_Meta_Comment_Post_User_Term($_GET['aDBc_view']);
30
+
31
  }else if($_GET['aDBc_view'] == "orphan-relationships"){
32
+
33
  include_once 'custom-clean-view/class_clean_relationships.php';
34
+ new ADBC_Clean_Relationship();
35
+
36
+ }else if($_GET['aDBc_view'] == "expired-transients" ||
37
+ $_GET['aDBc_view'] == "transients-with-expiration" ||
38
+ $_GET['aDBc_view'] == "transients-with-no-expiration"){
39
+
40
+ include_once 'custom-clean-view/class_clean_transient.php';
41
+ new ADBC_Clean_Transient($_GET['aDBc_view']);
42
+
43
+ }else if($_GET['aDBc_view'] == "add_cleanup_schedule"){
44
+
45
+ include_once 'custom-schedule-view/class_add_cleanup_schedule.php';
46
+ new ADBC_SCHEDULE_CLEANUP($_GET['aDBc_view']);
47
+
48
+ }else if($_GET['aDBc_view'] == "edit_cleanup_schedule"){
49
+
50
+ include_once 'custom-schedule-view/class_edit_cleanup_schedule.php';
51
+ new EDIT_SCHEDULE_CLEANUP($_GET['aDBc_view']);
52
+
53
  }
54
+
55
  }else{
56
  // Else return the general clean-up page
57
  include_once 'class_general_cleanup.php';
includes/custom-clean-view/class_clean_comment.php CHANGED
@@ -1,34 +1,83 @@
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();
@@ -37,18 +86,86 @@ class ADBC_Clean_Comment extends WP_List_Table {
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
  );
@@ -78,14 +195,33 @@ class ADBC_Clean_Comment extends WP_List_Table {
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);
@@ -111,38 +247,58 @@ class ADBC_Clean_Comment extends WP_List_Table {
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
  ?>
1
  <?php
2
+ /** Used to view Pending comments, Spam Comments, Trash comments, Pingbacks and Trackbacks */
3
  class ADBC_Clean_Comment extends WP_List_Table {
4
 
5
  private $aDBc_message = "";
6
+ private $aDBc_class_message = "updated";
7
  private $aDBc_elements_to_display = array();
8
+ private $aDBc_type_to_clean = "";
9
  private $aDBc_plural_title = "";
10
+ private $aDBc_column_comment_name = "";
11
+ private $aDBc_sql_get_elements = "";
12
+ private $aDBc_custom_sql_args = "";
13
+ private $aDBc_search_sql_arg = "";
14
+ private $aDBc_order_by_sql_arg = "";
15
+ private $aDBc_limit_offset_sql_arg = "";
16
+ private $aDBc_keep_last_sql_arg = "";
17
 
18
  /**
19
  * Constructor
20
  */
21
  function __construct($element_type){
22
 
 
 
 
23
  if($element_type == "moderated-comments"){
24
+
25
+ $this->aDBc_type_to_clean = "0";
26
+ $aDBc_singular = __('Pending comment', 'advanced-database-cleaner');
27
+ $this->aDBc_plural_title = __('Pending comments', 'advanced-database-cleaner');
28
+ $this->aDBc_column_comment_name = __('Comment content', 'advanced-database-cleaner');
29
+ $this->aDBc_custom_sql_args = " comment_approved = '0'";
30
+ $this->aDBc_keep_last_sql_arg = $this->aDBc_get_keep_last_sql_arg('moderated-comments');
31
+
32
  }else if($element_type == "spam-comments"){
33
+
34
+ $this->aDBc_type_to_clean = "spam";
35
+ $aDBc_singular = __('Spam comment', 'advanced-database-cleaner');
36
+ $this->aDBc_plural_title = __('Spam comments', 'advanced-database-cleaner');
37
+ $this->aDBc_column_comment_name = __('Comment content', 'advanced-database-cleaner');
38
+ $this->aDBc_custom_sql_args = " comment_approved = 'spam'";
39
+ $this->aDBc_keep_last_sql_arg = $this->aDBc_get_keep_last_sql_arg('spam-comments');
40
+
41
  }else if($element_type == "trash-comments"){
42
+
43
+ $this->aDBc_type_to_clean = "trash";
44
+ $aDBc_singular = __('Trash comment', 'advanced-database-cleaner');
45
+ $this->aDBc_plural_title = __('Trash comments', 'advanced-database-cleaner');
46
+ $this->aDBc_column_comment_name = __('Comment content', 'advanced-database-cleaner');
47
+ $this->aDBc_custom_sql_args = " comment_approved = 'trash'";
48
+ $this->aDBc_keep_last_sql_arg = $this->aDBc_get_keep_last_sql_arg('trash-comments');
49
+
50
+ }else if($element_type == "pingbacks"){
51
+
52
+ $this->aDBc_type_to_clean = "pingback";
53
+ $aDBc_singular = __('Pingback', 'advanced-database-cleaner');
54
+ $this->aDBc_plural_title = __('Pingbacks', 'advanced-database-cleaner');
55
+ $this->aDBc_column_comment_name = __('Pingback content', 'advanced-database-cleaner');
56
+ $this->aDBc_custom_sql_args = " comment_type = 'pingback'";
57
+ $this->aDBc_keep_last_sql_arg = $this->aDBc_get_keep_last_sql_arg('pingbacks');
58
+
59
+ }else if($element_type == "trackbacks"){
60
+
61
+ $this->aDBc_type_to_clean = "trackback";
62
+ $aDBc_singular = __('Trackback', 'advanced-database-cleaner');
63
+ $this->aDBc_plural_title = __('Trackbacks', 'advanced-database-cleaner');
64
+ $this->aDBc_column_comment_name = __('Trackback content', 'advanced-database-cleaner');
65
+ $this->aDBc_custom_sql_args = " comment_type = 'trackback'";
66
+ $this->aDBc_keep_last_sql_arg = $this->aDBc_get_keep_last_sql_arg('trackbacks');
67
+
68
+ }
69
+
70
+ // Prepare additional sql args if any: per page, LIMIT, OFFSET, etc.
71
+ if(ADBC_PLUGIN_F_TYPE == "pro"){
72
+ $this->aDBc_search_sql_arg = aDBc_get_search_sql_arg("comment_author", "comment_content");
73
  }
74
+ $this->aDBc_order_by_sql_arg = aDBc_get_order_by_sql_arg("comment_ID");
75
+ $this->aDBc_limit_offset_sql_arg = aDBc_get_limit_offset_sql_args();
76
 
77
  parent::__construct(array(
78
+ 'singular' => $aDBc_singular, //singular name of the listed records
79
  'plural' => $this->aDBc_plural_title, //plural name of the listed records
80
+ 'ajax' => false //does this table support ajax?
81
  ));
82
 
83
  $this->aDBc_prepare_elements_to_clean();
86
 
87
  /** Prepare elements to display */
88
  function aDBc_prepare_elements_to_clean(){
89
+
90
+ global $wpdb;
91
+
92
+ // Process bulk action if any before preparing elements to clean
93
+ $this->process_bulk_action();
94
+
95
+ // Get all elements to clean
96
+ if(function_exists('is_multisite') && is_multisite()){
97
+ $blogs_ids = $wpdb->get_col("SELECT blog_id FROM $wpdb->blogs");
98
+ foreach($blogs_ids as $blog_id){
99
+
100
+ switch_to_blog($blog_id);
101
+
102
+ $this->aDBc_fill_array_elements_to_clean($blog_id);
103
+
104
+ restore_current_blog();
105
+ }
106
+ }else{
107
+
108
+ $this->aDBc_fill_array_elements_to_clean("1");
109
+ }
110
  // Call WP prepare_items function
111
  $this->prepare_items();
112
  }
113
 
114
+ /** Fill array elements to display */
115
+ function aDBc_fill_array_elements_to_clean($blog_id){
116
+
117
+ global $wpdb;
118
+
119
+ // Get all elements query
120
+ $this->aDBc_sql_get_elements = "SELECT comment_ID, comment_author, comment_content, comment_date FROM $wpdb->comments WHERE"
121
+ . $this->aDBc_custom_sql_args
122
+ . $this->aDBc_keep_last_sql_arg
123
+ . $this->aDBc_search_sql_arg
124
+ . $this->aDBc_order_by_sql_arg
125
+ //. $this->aDBc_limit_offset_sql_arg
126
+ ;
127
+
128
+ $aDBc_all_elements = $wpdb->get_results($this->aDBc_sql_get_elements);
129
+
130
+ foreach($aDBc_all_elements as $aDBc_element){
131
+
132
+ // Get author name
133
+ $author_name = aDBc_create_tooltip_for_long_string($aDBc_element->comment_author, 16);
134
+
135
+ // Get comment content
136
+ $comment_content = aDBc_create_tooltip_for_long_string($aDBc_element->comment_content, 60);
137
+
138
+ array_push($this->aDBc_elements_to_display, array(
139
+ 'comment_id' => $aDBc_element->comment_ID,
140
+ 'comment_author' => $author_name,
141
+ 'comment_content' => $comment_content,
142
+ 'comment_date' => $aDBc_element->comment_date,
143
+ 'site_id' => $blog_id
144
+ )
145
+ );
146
+
147
+ }
148
+ }
149
+
150
+ /** Prepare keep_last element if any **/
151
+ function aDBc_get_keep_last_sql_arg($element_type){
152
+ $settings = get_option('aDBc_settings');
153
+ if(!empty($settings['keep_last'])){
154
+ $keep_setting = $settings['keep_last'];
155
+ if(!empty($keep_setting[$element_type]))
156
+ return " and comment_date < NOW() - INTERVAL " . $keep_setting[$element_type] . " DAY";
157
+ }
158
+ return "";
159
+ }
160
+
161
  /** WP: Get columns */
162
  function get_columns(){
163
+
164
  $columns = array(
165
  'cb' => '<input type="checkbox" />',
166
  'comment_id' => __('ID','advanced-database-cleaner'),
167
  'comment_author' => __('Author','advanced-database-cleaner'),
168
+ 'comment_content' => $this->aDBc_column_comment_name,
169
  'comment_date' => __('Date','advanced-database-cleaner'),
170
  'site_id' => __('Site id','advanced-database-cleaner')
171
  );
195
  return array('site_id');
196
  }
197
  }
198
+
199
+ function get_sortable_columns() {
200
+
201
+ $sortable_columns = array(
202
+ 'comment_id' => array('comment_ID',false),
203
+ 'comment_author' => array('comment_author',false)
204
+ );
205
+ // Since order_by works directly with sql request, we will not order_by in mutlisite since it will not work
206
+ if(function_exists('is_multisite') && is_multisite()){
207
+ return array();
208
+ }else{
209
+ return $sortable_columns;
210
+ }
211
+ }
212
 
213
  /** WP: Prepare items to display */
214
  function prepare_items() {
215
  $columns = $this->get_columns();
216
  $hidden = $this->get_hidden_columns();
217
+ $sortable = $this->get_sortable_columns();
218
  $this->_column_headers = array($columns, $hidden, $sortable);
219
+
220
  $per_page = 50;
221
+ if(!empty($_GET['per_page'])){
222
+ $per_page = absint($_GET['per_page']);
223
+ }
224
+
225
  $current_page = $this->get_pagenum();
226
  // Prepare sequence of elements to display
227
  $display_data = array_slice($this->aDBc_elements_to_display,(($current_page-1) * $per_page), $per_page);
247
 
248
  /** WP: Message to display when no items found */
249
  function no_items() {
250
+ _e('No elements found!','advanced-database-cleaner');
251
  }
252
 
253
  /** WP: Process bulk actions */
254
  public function process_bulk_action() {
255
+ // security check!
256
+ if (isset($_POST['_wpnonce']) && !empty($_POST['_wpnonce'])){
257
+ $nonce = filter_input(INPUT_POST, '_wpnonce', FILTER_SANITIZE_STRING);
258
+ $action = 'bulk-' . $this->_args['plural'];
259
+ if (!wp_verify_nonce( $nonce, $action))
260
+ wp_die('Security check failed!');
261
+ }
262
+ $action = $this->current_action();
263
+ if($action == 'clean'){
264
+ // If the user wants to clean the elements he/she selected
265
+ if(isset($_POST['aDBc_elements_to_clean'])){
266
+ if(function_exists('is_multisite') && is_multisite()){
267
+ // Prepare elements to delete
268
+ $elements_to_delete = array();
269
+ foreach($_POST['aDBc_elements_to_clean'] as $element){
270
+ $element_info = explode("|", $element);
271
+ if(empty($elements_to_delete[$element_info[0]])){
272
+ $elements_to_delete[$element_info[0]] = array();
273
+ }
274
+ array_push($elements_to_delete[$element_info[0]], $element_info[1]);
275
+ }
276
+ // Delete elements
277
+ foreach($elements_to_delete as $site_id => $elements_ids){
278
+ switch_to_blog($site_id);
279
+ global $wpdb;
280
+ foreach($elements_ids as $id_comment) {
281
+ $wpdb->query("DELETE FROM $wpdb->comments WHERE comment_ID = $id_comment");
282
+ }
283
+ restore_current_blog();
284
+ }
285
+ }else{
286
+ global $wpdb;
287
+ foreach($_POST['aDBc_elements_to_clean'] as $element) {
288
+ $element_info = explode("|", $element);
289
+ $wpdb->query("DELETE FROM $wpdb->comments WHERE comment_ID = " . $element_info[1]);
290
+ }
291
+ }
292
+ // Update the message to show to the user
293
+ $this->aDBc_message = __("Selected '$this->aDBc_plural_title' successfully cleaned!", 'advanced-database-cleaner');
294
+ }
295
+ }
296
  }
297
 
298
  /** Print the page content */
299
  function aDBc_print_page_content(){
300
+
301
+ include_once 'page_custom_clean.php';
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
302
  }
303
  }
304
  ?>
includes/custom-clean-view/class_clean_commentmeta.php DELETED
@@ -1,136 +0,0 @@
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 DELETED
@@ -1,136 +0,0 @@
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 DELETED
@@ -1,150 +0,0 @@
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_meta_comment_post_user_term.php ADDED
@@ -0,0 +1,291 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /** Used to view comment meta and post meta */
3
+ class ADBC_Clean_Meta_Comment_Post_User_Term extends WP_List_Table {
4
+
5
+ private $aDBc_message = "";
6
+ private $aDBc_class_message = "updated";
7
+ private $aDBc_elements_to_display = array();
8
+ private $aDBc_type_to_clean = "";
9
+ private $aDBc_plural_title = "";
10
+ private $aDBc_column_meta_name = "";
11
+ private $aDBc_sql_get_elements = "";
12
+ private $aDBc_custom_sql_args = "";
13
+ private $aDBc_search_sql_arg = "";
14
+ private $aDBc_order_by_sql_arg = "";
15
+ private $aDBc_limit_offset_sql_arg = "";
16
+ private $aDBc_delete_from_table = "";
17
+ private $aDBc_metaid_or_umetaid = "";
18
+
19
+ /**
20
+ * Constructor
21
+ */
22
+ function __construct($element_type){
23
+
24
+ if($element_type == "orphan-commentmeta"){
25
+
26
+ $this->aDBc_type_to_clean = "orphan-commentmeta";
27
+ $aDBc_singular = __('Orphaned comment meta', 'advanced-database-cleaner');
28
+ $this->aDBc_plural_title = __('Orphaned comments meta', 'advanced-database-cleaner');
29
+ $this->aDBc_column_meta_name = __('Comment meta key', 'advanced-database-cleaner');
30
+ $this->aDBc_delete_from_table = "commentmeta";
31
+ $this->aDBc_metaid_or_umetaid = "meta_id";
32
+
33
+ }else if($element_type == "orphan-postmeta"){
34
+
35
+ $this->aDBc_type_to_clean = "orphan-postmeta";
36
+ $aDBc_singular = __('Orphaned post meta', 'advanced-database-cleaner');
37
+ $this->aDBc_plural_title = __('Orphaned posts meta', 'advanced-database-cleaner');
38
+ $this->aDBc_column_meta_name = __('Post meta key', 'advanced-database-cleaner');
39
+ $this->aDBc_delete_from_table = "postmeta";
40
+ $this->aDBc_metaid_or_umetaid = "meta_id";
41
+
42
+ }else if($element_type == "orphan-usermeta"){
43
+
44
+ $this->aDBc_type_to_clean = "orphan-usermeta";
45
+ $aDBc_singular = __('Orphaned User Meta', 'advanced-database-cleaner');
46
+ $this->aDBc_plural_title = __('Orphaned Users Meta', 'advanced-database-cleaner');
47
+ $this->aDBc_column_meta_name = __('User meta key', 'advanced-database-cleaner');
48
+ $this->aDBc_delete_from_table = "usermeta";
49
+ $this->aDBc_metaid_or_umetaid = "umeta_id";
50
+
51
+ }else if($element_type == "orphan-termmeta"){
52
+
53
+ $this->aDBc_type_to_clean = "orphan-termmeta";
54
+ $aDBc_singular = __('Orphaned Term Meta', 'advanced-database-cleaner');
55
+ $this->aDBc_plural_title = __('Orphaned Terms Meta', 'advanced-database-cleaner');
56
+ $this->aDBc_column_meta_name = __('Term meta key', 'advanced-database-cleaner');
57
+ $this->aDBc_delete_from_table = "termmeta";
58
+ $this->aDBc_metaid_or_umetaid = "meta_id";
59
+ }
60
+
61
+ // Prepare additional sql args if any: per page, LIMIT, OFFSET, etc.
62
+ if(ADBC_PLUGIN_F_TYPE == "pro"){
63
+ $this->aDBc_search_sql_arg = aDBc_get_search_sql_arg("meta_key", "meta_value");
64
+ }
65
+ $this->aDBc_order_by_sql_arg = aDBc_get_order_by_sql_arg($this->aDBc_metaid_or_umetaid);
66
+ $this->aDBc_limit_offset_sql_arg = aDBc_get_limit_offset_sql_args();
67
+
68
+ parent::__construct(array(
69
+ 'singular' => $aDBc_singular, //singular name of the listed records
70
+ 'plural' => $this->aDBc_plural_title, //plural name of the listed records
71
+ 'ajax' => false //does this table support ajax?
72
+ ));
73
+
74
+ $this->aDBc_prepare_elements_to_clean();
75
+ $this->aDBc_print_page_content();
76
+ }
77
+
78
+ /** Prepare elements to display */
79
+ function aDBc_prepare_elements_to_clean(){
80
+
81
+ global $wpdb;
82
+
83
+ // Process bulk action if any before preparing meta to clean
84
+ $this->process_bulk_action();
85
+
86
+ // Get all elements (for the table usermeta, only one table exists for MU, do not switch over blogs for it)
87
+ if(function_exists('is_multisite') && is_multisite() && $this->aDBc_type_to_clean != "orphan-usermeta"){
88
+ $blogs_ids = $wpdb->get_col("SELECT blog_id FROM $wpdb->blogs");
89
+ foreach($blogs_ids as $blog_id){
90
+
91
+ switch_to_blog($blog_id);
92
+
93
+ $this->aDBc_fill_array_elements_to_clean($blog_id);
94
+
95
+ restore_current_blog();
96
+ }
97
+ }else{
98
+
99
+ $this->aDBc_fill_array_elements_to_clean("1");
100
+ }
101
+ // Call WP prepare_items function
102
+ $this->prepare_items();
103
+ }
104
+
105
+ /** Fill array elements to display */
106
+ function aDBc_fill_array_elements_to_clean($blog_id){
107
+
108
+ global $wpdb;
109
+
110
+ if($this->aDBc_type_to_clean == "orphan-commentmeta"){
111
+ $this->aDBc_custom_sql_args = "SELECT meta_id, meta_key, meta_value FROM $wpdb->commentmeta WHERE comment_id NOT IN (SELECT comment_id FROM $wpdb->comments)";
112
+ }else if($this->aDBc_type_to_clean == "orphan-postmeta"){
113
+ $this->aDBc_custom_sql_args = "SELECT meta_id, meta_key, meta_value FROM $wpdb->postmeta pm LEFT JOIN $wpdb->posts wp ON wp.ID = pm.post_id WHERE wp.ID IS NULL";
114
+ }else if($this->aDBc_type_to_clean == "orphan-usermeta"){
115
+ $this->aDBc_custom_sql_args = "SELECT umeta_id, meta_key, meta_value FROM $wpdb->usermeta WHERE user_id NOT IN (SELECT ID FROM $wpdb->users)";
116
+ }else if($this->aDBc_type_to_clean == "orphan-termmeta"){
117
+ $this->aDBc_custom_sql_args = "SELECT meta_id, meta_key, meta_value FROM $wpdb->termmeta WHERE term_id NOT IN (SELECT term_id FROM $wpdb->terms)";
118
+ }
119
+
120
+ // Get all elements query
121
+ $this->aDBc_sql_get_elements = $this->aDBc_custom_sql_args
122
+ . $this->aDBc_search_sql_arg
123
+ . $this->aDBc_order_by_sql_arg
124
+ //. $this->aDBc_limit_offset_sql_arg
125
+ ;
126
+
127
+ $aDBc_all_elements = $wpdb->get_results($this->aDBc_sql_get_elements);
128
+
129
+ foreach($aDBc_all_elements as $aDBc_element){
130
+
131
+ // Get meta key
132
+ $meta_key = aDBc_create_tooltip_for_long_string($aDBc_element->meta_key, 28);
133
+
134
+ // Get meta value
135
+ $meta_value = aDBc_create_tooltip_for_long_string($aDBc_element->meta_value, 95);
136
+
137
+ array_push($this->aDBc_elements_to_display, array(
138
+ 'meta_id' => ($this->aDBc_metaid_or_umetaid == 'meta_id' ? $aDBc_element->meta_id : $aDBc_element->umeta_id),
139
+ 'meta_key' => $meta_key,
140
+ 'meta_value' => $meta_value,
141
+ 'site_id' => $blog_id
142
+ )
143
+ );
144
+
145
+ }
146
+ }
147
+
148
+ /** WP: Get columns */
149
+ function get_columns(){
150
+ $columns = array(
151
+ 'cb' => '<input type="checkbox" />',
152
+ 'meta_id' => __('ID','advanced-database-cleaner'),
153
+ 'meta_key' => $this->aDBc_column_meta_name,
154
+ 'meta_value' => __('Meta value','advanced-database-cleaner'),
155
+ 'site_id' => __('Site id','advanced-database-cleaner')
156
+ );
157
+ return $columns;
158
+ }
159
+
160
+ /** WP: Column default */
161
+ function column_default($item, $column_name){
162
+ switch($column_name){
163
+ case 'meta_id':
164
+ case 'meta_key':
165
+ case 'meta_value':
166
+ case 'site_id':
167
+ return $item[$column_name];
168
+ default:
169
+ return print_r($item, true) ; //Show the whole array for troubleshooting purposes
170
+ }
171
+ }
172
+
173
+ /** WP: Get columns that should be hidden */
174
+ function get_hidden_columns(){
175
+ // If MU, nothing to hide, else hide Side ID column
176
+ if(function_exists('is_multisite') && is_multisite()){
177
+ return array();
178
+ }else{
179
+ return array('site_id');
180
+ }
181
+ }
182
+
183
+ function get_sortable_columns() {
184
+
185
+ $sortable_columns = array(
186
+ 'meta_id' => array($this->aDBc_metaid_or_umetaid, false),
187
+ 'meta_key' => array('meta_key', false)
188
+ );
189
+ // Since order_by works directly with sql request, we will not order_by in mutlisite since it will not work
190
+ if(function_exists('is_multisite') && is_multisite()){
191
+ return array();
192
+ }else{
193
+ return $sortable_columns;
194
+ }
195
+ }
196
+
197
+ /** WP: Prepare items to display */
198
+ function prepare_items() {
199
+ $columns = $this->get_columns();
200
+ $hidden = $this->get_hidden_columns();
201
+ $sortable = $this->get_sortable_columns();
202
+ $this->_column_headers = array($columns, $hidden, $sortable);
203
+
204
+ $per_page = 50;
205
+ if(!empty($_GET['per_page'])){
206
+ $per_page = absint($_GET['per_page']);
207
+ }
208
+
209
+ $current_page = $this->get_pagenum();
210
+ // Prepare sequence of elements to display
211
+ $display_data = array_slice($this->aDBc_elements_to_display,(($current_page-1) * $per_page), $per_page);
212
+ $this->set_pagination_args( array(
213
+ 'total_items' => count($this->aDBc_elements_to_display),
214
+ 'per_page' => $per_page
215
+ ));
216
+ $this->items = $display_data;
217
+ }
218
+
219
+ /** WP: Column cb for check box */
220
+ function column_cb($item) {
221
+ return sprintf('<input type="checkbox" name="aDBc_meta_to_clean[]" value="%s" />', $item['site_id']."|".$item['meta_id']);
222
+ }
223
+
224
+ /** WP: Get bulk actions */
225
+ function get_bulk_actions() {
226
+ $actions = array(
227
+ 'clean' => __('Clean','advanced-database-cleaner')
228
+ );
229
+ return $actions;
230
+ }
231
+
232
+ /** WP: Message to display when no items found */
233
+ function no_items() {
234
+ _e('No elements found!','advanced-database-cleaner');
235
+ }
236
+
237
+ /** WP: Process bulk actions */
238
+ public function process_bulk_action() {
239
+ // security check!
240
+ if (isset($_POST['_wpnonce']) && !empty($_POST['_wpnonce'])){
241
+ $nonce = filter_input(INPUT_POST, '_wpnonce', FILTER_SANITIZE_STRING);
242
+ $action = 'bulk-' . $this->_args['plural'];
243
+ if (!wp_verify_nonce( $nonce, $action))
244
+ wp_die('Security check failed!');
245
+ }
246
+ $action = $this->current_action();
247
+ if($action == 'clean'){
248
+ // If the user wants to clean the elements he/she selected
249
+ if(isset($_POST['aDBc_meta_to_clean'])){
250
+ if(function_exists('is_multisite') && is_multisite()){
251
+ // Prepare meta to delete
252
+ $meta_to_delete = array();
253
+ foreach($_POST['aDBc_meta_to_clean'] as $meta){
254
+ $meta_info = explode("|", $meta);
255
+ if(empty($meta_to_delete[$meta_info[0]])){
256
+ $meta_to_delete[$meta_info[0]] = array();
257
+ }
258
+ array_push($meta_to_delete[$meta_info[0]], $meta_info[1]);
259
+ }
260
+ // Delete meta
261
+ foreach($meta_to_delete as $site_id => $meta_ids){
262
+ switch_to_blog($site_id);
263
+ global $wpdb;
264
+ foreach($meta_ids as $id_meta) {
265
+ $table_name = $wpdb->prefix . $this->aDBc_delete_from_table;
266
+ $wpdb->query("DELETE FROM $table_name WHERE $this->aDBc_metaid_or_umetaid = $id_meta");
267
+ }
268
+ restore_current_blog();
269
+ }
270
+ }else{
271
+ global $wpdb;
272
+ $table_name = $wpdb->prefix . $this->aDBc_delete_from_table;
273
+ foreach($_POST['aDBc_meta_to_clean'] as $meta) {
274
+ $meta_info = explode("|", $meta);
275
+ $wpdb->query("DELETE FROM $table_name WHERE $this->aDBc_metaid_or_umetaid = " . $meta_info[1]);
276
+ }
277
+ }
278
+ // Update the message to show to the user
279
+ $this->aDBc_message = __("Selected '$this->aDBc_plural_title' successfully cleaned!", "advanced-database-cleaner");
280
+ }
281
+ }
282
+ }
283
+
284
+ /** Print the page content */
285
+ function aDBc_print_page_content(){
286
+
287
+ include_once 'page_custom_clean.php';
288
+ }
289
+ }
290
+
291
+ ?>
includes/custom-clean-view/class_clean_postmeta.php DELETED
@@ -1,136 +0,0 @@
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 CHANGED
@@ -3,41 +3,105 @@
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
  }
@@ -48,7 +112,7 @@ class ADBC_Clean_Relationship extends WP_List_Table {
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
@@ -61,22 +125,42 @@ class ADBC_Clean_Relationship extends WP_List_Table {
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;
@@ -84,7 +168,7 @@ class ADBC_Clean_Relationship extends WP_List_Table {
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 */
@@ -97,40 +181,59 @@ class ADBC_Clean_Relationship extends WP_List_Table {
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
  ?>
3
  class ADBC_Clean_Relationship extends WP_List_Table {
4
 
5
  private $aDBc_message = "";
6
+ private $aDBc_class_message = "updated";
7
+ private $aDBc_elements_to_display = array();
8
+ private $aDBc_type_to_clean = "";
9
+ private $aDBc_plural_title = "";
10
+ private $aDBc_column_meta_name = "";
11
+ private $aDBc_sql_get_elements = "";
12
+ private $aDBc_search_sql_arg = "";
13
+ private $aDBc_order_by_sql_arg = "";
14
+ private $aDBc_limit_offset_sql_arg = "";
15
+ private $aDBc_delete_from_table = "";
16
 
17
  /**
18
  * Constructor
19
  */
20
  function __construct(){
21
 
22
+ $this->aDBc_plural_title = __('Orphaned Relationships', 'advanced-database-cleaner');
23
+
24
+ // Prepare additional sql args if any: per page, LIMIT, OFFSET, etc.
25
+ if(ADBC_PLUGIN_F_TYPE == "pro"){
26
+ $this->aDBc_search_sql_arg = aDBc_get_search_sql_arg("term_taxonomy_id", "term_order");
27
+ }
28
+ $this->aDBc_order_by_sql_arg = aDBc_get_order_by_sql_arg("object_id");
29
+ $this->aDBc_limit_offset_sql_arg = aDBc_get_limit_offset_sql_args();
30
 
31
  parent::__construct(array(
32
+ 'singular' => __('Orphaned Relationship', 'advanced-database-cleaner'), //singular name of the listed records
33
+ 'plural' => $this->aDBc_plural_title, //plural name of the listed records
34
+ 'ajax' => false //does this table support ajax?
35
  ));
36
 
37
+ $this->aDBc_prepare_elements_to_clean();
38
  $this->aDBc_print_page_content();
39
  }
40
 
41
  /** Prepare elements to display */
42
+ function aDBc_prepare_elements_to_clean(){
43
+
44
+ global $wpdb;
45
+
46
+ // Process bulk action if any before preparing relationships to clean
47
+ $this->process_bulk_action();
48
+
49
+ // Get all relationships
50
+ if(function_exists('is_multisite') && is_multisite()){
51
+ $blogs_ids = $wpdb->get_col("SELECT blog_id FROM $wpdb->blogs");
52
+ foreach($blogs_ids as $blog_id){
53
+
54
+ switch_to_blog($blog_id);
55
+
56
+ $this->aDBc_fill_array_elements_to_clean($blog_id);
57
+
58
+ restore_current_blog();
59
+
60
+ }
61
+ }else{
62
+
63
+ $this->aDBc_fill_array_elements_to_clean("1");
64
+
65
+ }
66
  // Call WP prepare_items function
67
  $this->prepare_items();
68
  }
69
 
70
+ /** Fill array elements to display */
71
+ function aDBc_fill_array_elements_to_clean($blog_id){
72
+
73
+ global $wpdb;
74
+
75
+ // Get all elements query
76
+ $this->aDBc_sql_get_elements = "SELECT * from $wpdb->term_relationships WHERE term_taxonomy_id=1 AND object_id NOT IN (SELECT id FROM $wpdb->posts)"
77
+ . $this->aDBc_search_sql_arg
78
+ . $this->aDBc_order_by_sql_arg
79
+ //. $this->aDBc_limit_offset_sql_arg
80
+ ;
81
+
82
+ $aDBc_all_elements = $wpdb->get_results($this->aDBc_sql_get_elements);
83
+
84
+ foreach($aDBc_all_elements as $aDBc_element){
85
+
86
+ array_push($this->aDBc_elements_to_display, array(
87
+ 'object_id' => $aDBc_element->object_id,
88
+ 'term_taxonomy_id' => $aDBc_element->term_taxonomy_id,
89
+ 'term_order' => $aDBc_element->term_order,
90
+ 'site_id' => $blog_id
91
+ )
92
+ );
93
+
94
+ }
95
+ }
96
+
97
  /** WP: Get columns */
98
  function get_columns(){
99
  $columns = array(
100
  'cb' => '<input type="checkbox" />',
101
+ 'object_id' => __('ID','advanced-database-cleaner'),
102
  'term_taxonomy_id' => __('Term taxonomy id','advanced-database-cleaner'),
103
  'term_order' => __('Term order','advanced-database-cleaner'),
104
+ 'site_id' => __('Site id','advanced-database-cleaner')
105
  );
106
  return $columns;
107
  }
112
  case 'object_id':
113
  case 'term_taxonomy_id':
114
  case 'term_order':
115
+ case 'site_id':
116
  return $item[$column_name];
117
  default:
118
  return print_r($item, true) ; //Show the whole array for troubleshooting purposes
125
  if(function_exists('is_multisite') && is_multisite()){
126
  return array();
127
  }else{
128
+ return array('site_id');
129
  }
130
  }
131
 
132
+ function get_sortable_columns() {
133
+
134
+ $sortable_columns = array(
135
+ 'object_id' => array('object_id',false),
136
+ 'term_taxonomy_id' => array('term_taxonomy_id',false),
137
+ 'term_order' => array('term_order',false)
138
+ );
139
+ // Since order_by works directly with sql request, we will not order_by in mutlisite since it will not work
140
+ if(function_exists('is_multisite') && is_multisite()){
141
+ return array();
142
+ }else{
143
+ return $sortable_columns;
144
+ }
145
+ }
146
+
147
  /** WP: Prepare items to display */
148
  function prepare_items() {
149
  $columns = $this->get_columns();
150
  $hidden = $this->get_hidden_columns();
151
+ $sortable = $this->get_sortable_columns();
152
  $this->_column_headers = array($columns, $hidden, $sortable);
153
+
154
  $per_page = 50;
155
+ if(!empty($_GET['per_page'])){
156
+ $per_page = absint($_GET['per_page']);
157
+ }
158
+
159
  $current_page = $this->get_pagenum();
160
  // Prepare sequence of elements to display
161
+ $display_data = array_slice($this->aDBc_elements_to_display,(($current_page-1) * $per_page), $per_page);
162
  $this->set_pagination_args( array(
163
+ 'total_items' => count($this->aDBc_elements_to_display),
164
  'per_page' => $per_page
165
  ));
166
  $this->items = $display_data;
168
 
169
  /** WP: Column cb for check box */
170
  function column_cb($item) {
171
+ return sprintf('<input type="checkbox" name="aDBc_relationships_to_clean[]" value="%s" />', $item['site_id']."|".$item['object_id']);
172
  }
173
 
174
  /** WP: Get bulk actions */
181
 
182
  /** WP: Message to display when no items found */
183
  function no_items() {
184
+ _e('No elements found!','advanced-database-cleaner');
185
  }
186
 
187
  /** WP: Process bulk actions */
188
  public function process_bulk_action() {
189
+ // security check!
190
+ if (isset($_POST['_wpnonce']) && !empty($_POST['_wpnonce'])){
191
+ $nonce = filter_input(INPUT_POST, '_wpnonce', FILTER_SANITIZE_STRING);
192
+ $action = 'bulk-' . $this->_args['plural'];
193
+ if (!wp_verify_nonce( $nonce, $action))
194
+ wp_die('Security check failed!');
195
+ }
196
+ $action = $this->current_action();
197
+ if($action == 'clean'){
198
+ // If the user wants to clean the elements he/she selected
199
+ if(isset($_POST['aDBc_relationships_to_clean'])){
200
+ if(function_exists('is_multisite') && is_multisite()){
201
+ // Prepare relationships to delete
202
+ $relationships_to_delete = array();
203
+ foreach($_POST['aDBc_relationships_to_clean'] as $relationship){
204
+ $relationship_info = explode("|", $relationship);
205
+ if(empty($relationships_to_delete[$relationship_info[0]])){
206
+ $relationships_to_delete[$relationship_info[0]] = array();
207
+ }
208
+ array_push($relationships_to_delete[$relationship_info[0]], $relationship_info[1]);
209
+ }
210
+ // Delete relationships
211
+ foreach($relationships_to_delete as $site_id => $object_ids){
212
+ switch_to_blog($site_id);
213
+ global $wpdb;
214
+ foreach($object_ids as $object_id) {
215
+ $wpdb->query("DELETE FROM $wpdb->term_relationships WHERE term_taxonomy_id=1 AND object_id = $object_id");
216
+ }
217
+ restore_current_blog();
218
+ }
219
+ }else{
220
+ global $wpdb;
221
+ foreach($_POST['aDBc_relationships_to_clean'] as $relationship) {
222
+ $relationship_info = explode("|", $relationship);
223
+ $wpdb->query("DELETE FROM $wpdb->term_relationships WHERE term_taxonomy_id=1 AND object_id = " . $relationship_info[1]);
224
+ }
225
+ }
226
+ // Update the message to show to the user
227
+ $this->aDBc_message = __("Selected 'Orphaned relationships' successfully cleaned!", "advanced-database-cleaner");
228
+ }
229
+ }
230
  }
231
 
232
  /** Print the page content */
233
  function aDBc_print_page_content(){
234
+
235
+ include_once 'page_custom_clean.php';
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
236
  }
237
  }
238
 
 
239
  ?>
includes/custom-clean-view/class_clean_revision.php DELETED
@@ -1,136 +0,0 @@
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/custom-clean-view/class_clean_revision_draft_trash.php ADDED
@@ -0,0 +1,285 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /** Used to view revisions, auto-drafts and trash posts */
3
+ class ADBC_Clean_Revision_Trash_Draft extends WP_List_Table {
4
+
5
+ private $aDBc_message = "";
6
+ private $aDBc_class_message = "updated";
7
+ private $aDBc_elements_to_display = array();
8
+ private $aDBc_type_to_clean = "";
9
+ private $aDBc_plural_title = "";
10
+ private $aDBc_column_post_name_title = "";
11
+ private $aDBc_sql_get_elements = "";
12
+ private $aDBc_custom_sql_args = "";
13
+ private $aDBc_search_sql_arg = "";
14
+ private $aDBc_order_by_sql_arg = "";
15
+ private $aDBc_limit_offset_sql_arg = "";
16
+ private $aDBc_keep_last_sql_arg = "";
17
+
18
+ /**
19
+ * Constructor
20
+ */
21
+ function __construct($element_type){
22
+
23
+ if($element_type == "auto-draft"){
24
+
25
+ $this->aDBc_type_to_clean = "auto-draft";
26
+ $aDBc_singular = __('Auto draft', 'advanced-database-cleaner');
27
+ $this->aDBc_plural_title = __('Auto drafts', 'advanced-database-cleaner');
28
+ $this->aDBc_column_post_name_title = __('Auto draft title', 'advanced-database-cleaner');
29
+ $this->aDBc_custom_sql_args = " post_status = 'auto-draft'";
30
+ $this->aDBc_keep_last_sql_arg = $this->aDBc_get_keep_last_sql_arg('auto-draft');
31
+
32
+ }else if($element_type == "trash-posts"){
33
+
34
+ $this->aDBc_type_to_clean = "trash";
35
+ $aDBc_singular = __('Trash post', 'advanced-database-cleaner');
36
+ $this->aDBc_plural_title = __('Trash posts', 'advanced-database-cleaner');
37
+ $this->aDBc_column_post_name_title = __('Trash post title', 'advanced-database-cleaner');
38
+ $this->aDBc_custom_sql_args = " post_status = 'trash'";
39
+ $this->aDBc_keep_last_sql_arg = $this->aDBc_get_keep_last_sql_arg('trash-posts');
40
+
41
+ }else if($element_type == "revision"){
42
+
43
+ $this->aDBc_type_to_clean = "revision";
44
+ $aDBc_singular = __('Revision', 'advanced-database-cleaner');
45
+ $this->aDBc_plural_title = __('Revisions', 'advanced-database-cleaner');
46
+ $this->aDBc_column_post_name_title = __('Revision title', 'advanced-database-cleaner');
47
+ $this->aDBc_custom_sql_args = " post_type = 'revision'";
48
+ $this->aDBc_keep_last_sql_arg = $this->aDBc_get_keep_last_sql_arg('revision');
49
+
50
+ }
51
+
52
+ // Prepare additional sql args if any: per page, LIMIT, OFFSET, etc.
53
+ if(ADBC_PLUGIN_F_TYPE == "pro"){
54
+ $this->aDBc_search_sql_arg = aDBc_get_search_sql_arg("post_title", "post_content");
55
+ }
56
+ $this->aDBc_order_by_sql_arg = aDBc_get_order_by_sql_arg("ID");
57
+ $this->aDBc_limit_offset_sql_arg = aDBc_get_limit_offset_sql_args();
58
+
59
+ parent::__construct(array(
60
+ 'singular' => $aDBc_singular, //singular name of the listed records
61
+ 'plural' => $this->aDBc_plural_title, //plural name of the listed records
62
+ 'ajax' => false //does this table support ajax?
63
+ ));
64
+
65
+ $this->aDBc_prepare_elements_to_clean();
66
+ $this->aDBc_print_page_content();
67
+ }
68
+
69
+ /** Prepare elements to display */
70
+ function aDBc_prepare_elements_to_clean(){
71
+
72
+ global $wpdb;
73
+
74
+ // Process bulk action if any before preparing posts to clean
75
+ $this->process_bulk_action();
76
+
77
+ // Get all concerned posts
78
+ if(function_exists('is_multisite') && is_multisite()){
79
+ $blogs_ids = $wpdb->get_col("SELECT blog_id FROM $wpdb->blogs");
80
+ foreach($blogs_ids as $blog_id){
81
+
82
+ switch_to_blog($blog_id);
83
+
84
+ $this->aDBc_fill_array_elements_to_clean($blog_id);
85
+
86
+ restore_current_blog();
87
+ }
88
+ }else{
89
+
90
+ $this->aDBc_fill_array_elements_to_clean("1");
91
+ }
92
+ // Call WP prepare_items function
93
+ $this->prepare_items();
94
+ }
95
+
96
+ /** Fill array elements to display */
97
+ function aDBc_fill_array_elements_to_clean($blog_id){
98
+
99
+ global $wpdb;
100
+
101
+ // Get all elements query
102
+ $this->aDBc_sql_get_elements = "SELECT ID, post_title, post_date, post_content FROM $wpdb->posts WHERE"
103
+ . $this->aDBc_custom_sql_args
104
+ . $this->aDBc_keep_last_sql_arg
105
+ . $this->aDBc_search_sql_arg
106
+ . $this->aDBc_order_by_sql_arg
107
+ //. $this->aDBc_limit_offset_sql_arg
108
+ ;
109
+
110
+ $aDBc_all_elements = $wpdb->get_results($this->aDBc_sql_get_elements);
111
+
112
+ foreach($aDBc_all_elements as $aDBc_element){
113
+
114
+ // Susbstr post title
115
+ $post_title = aDBc_create_tooltip_for_long_string($aDBc_element->post_title, 35);
116
+
117
+ // Get content
118
+ $post_content = aDBc_create_tooltip_for_long_string($aDBc_element->post_content, 35);
119
+
120
+ array_push($this->aDBc_elements_to_display, array(
121
+ 'post_id' => $aDBc_element->ID,
122
+ 'post_title' => $post_title,
123
+ 'post_content' => $post_content,
124
+ 'post_date' => $aDBc_element->post_date,
125
+ 'site_id' => $blog_id
126
+ )
127
+ );
128
+ }
129
+ }
130
+
131
+ /** Prepare keep_last element if any **/
132
+ function aDBc_get_keep_last_sql_arg($element_type){
133
+ $settings = get_option('aDBc_settings');
134
+ if(!empty($settings['keep_last'])){
135
+ $keep_setting = $settings['keep_last'];
136
+ if(!empty($keep_setting[$element_type]))
137
+ return " and post_modified < NOW() - INTERVAL " . $keep_setting[$element_type] . " DAY";
138
+ }
139
+ return "";
140
+ }
141
+
142
+ /** WP: Get columns */
143
+ function get_columns(){
144
+ $columns = array(
145
+ 'cb' => '<input type="checkbox" />',
146
+ 'post_id' => __('ID','advanced-database-cleaner'),
147
+ 'post_title' => $this->aDBc_column_post_name_title,
148
+ 'post_content' => __('Content','advanced-database-cleaner'),
149
+ 'post_date' => __('Date','advanced-database-cleaner'),
150
+ 'site_id' => __('Site id','advanced-database-cleaner')
151
+ );
152
+ return $columns;
153
+ }
154
+
155
+ /** WP: Column default */
156
+ function column_default($item, $column_name){
157
+ switch($column_name){
158
+ case 'post_id':
159
+ case 'post_title':
160
+ case 'post_content':
161
+ case 'post_date':
162
+ case 'site_id':
163
+ return $item[$column_name];
164
+ default:
165
+ return print_r($item, true) ; //Show the whole array for troubleshooting purposes
166
+ }
167
+ }
168
+
169
+ /** WP: Get columns that should be hidden */
170
+ function get_hidden_columns(){
171
+ // If MU, nothing to hide, else hide Side ID column
172
+ if(function_exists('is_multisite') && is_multisite()){
173
+ return array();
174
+ }else{
175
+ return array('site_id');
176
+ }
177
+ }
178
+
179
+ function get_sortable_columns() {
180
+
181
+ $sortable_columns = array(
182
+ 'post_id' => array('ID',false), //true means it's already sorted
183
+ 'post_title' => array('post_title',false),
184
+ 'post_date' => array('post_date',false)
185
+ );
186
+ // Since order_by works directly with sql request, we will not order_by in mutlisite since it will not work
187
+ if(function_exists('is_multisite') && is_multisite()){
188
+ return array();
189
+ }else{
190
+ return $sortable_columns;
191
+ }
192
+ }
193
+
194
+ /** WP: Prepare items to display */
195
+ function prepare_items() {
196
+ $columns = $this->get_columns();
197
+ $hidden = $this->get_hidden_columns();
198
+ $sortable = $this->get_sortable_columns();
199
+ $this->_column_headers = array($columns, $hidden, $sortable);
200
+
201
+ $per_page = 50;
202
+ if(!empty($_GET['per_page'])){
203
+ $per_page = absint($_GET['per_page']);
204
+ }
205
+
206
+ $current_page = $this->get_pagenum();
207
+ // Prepare sequence of elements to display
208
+ $display_data = array_slice($this->aDBc_elements_to_display,(($current_page-1) * $per_page), $per_page);
209
+ $this->set_pagination_args( array(
210
+ 'total_items' => count($this->aDBc_elements_to_display),
211
+ 'per_page' => $per_page
212
+ ));
213
+ $this->items = $display_data;
214
+ }
215
+
216
+ /** WP: Column cb for check box */
217
+ function column_cb($item) {
218
+ return sprintf('<input type="checkbox" name="aDBc_posts_to_clean[]" value="%s" />', $item['site_id']."|".$item['post_id']);
219
+ }
220
+
221
+ /** WP: Get bulk actions */
222
+ function get_bulk_actions() {
223
+ $actions = array(
224
+ 'clean' => __('Clean','advanced-database-cleaner')
225
+ );
226
+ return $actions;
227
+ }
228
+
229
+ /** WP: Message to display when no items found */
230
+ function no_items() {
231
+ _e('No elements found!','advanced-database-cleaner');
232
+ }
233
+
234
+ /** WP: Process bulk actions */
235
+ public function process_bulk_action() {
236
+ // security check!
237
+ if (isset($_POST['_wpnonce']) && !empty($_POST['_wpnonce'])){
238
+ $nonce = filter_input(INPUT_POST, '_wpnonce', FILTER_SANITIZE_STRING);
239
+ $action = 'bulk-' . $this->_args['plural'];
240
+ if (!wp_verify_nonce( $nonce, $action))
241
+ wp_die('Security check failed!');
242
+ }
243
+ $action = $this->current_action();
244
+ if($action == 'clean'){
245
+ // If the user wants to clean the elements he/she selected
246
+ if(isset($_POST['aDBc_posts_to_clean'])){
247
+ if(function_exists('is_multisite') && is_multisite()){
248
+ // Prepare posts to delete
249
+ $posts_to_delete = array();
250
+ foreach($_POST['aDBc_posts_to_clean'] as $post){
251
+ $post_info = explode("|", $post);
252
+ if(empty($posts_to_delete[$post_info[0]])){
253
+ $posts_to_delete[$post_info[0]] = array();
254
+ }
255
+ array_push($posts_to_delete[$post_info[0]], $post_info[1]);
256
+ }
257
+ // Delete posts
258
+ foreach($posts_to_delete as $site_id => $posts_ids){
259
+ switch_to_blog($site_id);
260
+ global $wpdb;
261
+ foreach($posts_ids as $id_post) {
262
+ $wpdb->query("DELETE FROM $wpdb->posts WHERE ID = $id_post");
263
+ }
264
+ restore_current_blog();
265
+ }
266
+ }else{
267
+ global $wpdb;
268
+ foreach($_POST['aDBc_posts_to_clean'] as $post) {
269
+ $post_info = explode("|", $post);
270
+ $wpdb->query("DELETE FROM $wpdb->posts WHERE ID = " . $post_info[1]);
271
+ }
272
+ }
273
+ // Update the message to show to the user
274
+ $this->aDBc_message = __("Selected '$this->aDBc_plural_title' successfully cleaned!", "advanced-database-cleaner");
275
+ }
276
+ }
277
+ }
278
+
279
+ /** Print the page content */
280
+ function aDBc_print_page_content(){
281
+
282
+ include_once 'page_custom_clean.php';
283
+ }
284
+ }
285
+ ?>
includes/custom-clean-view/class_clean_transient.php ADDED
@@ -0,0 +1,318 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class ADBC_Clean_Transient extends WP_List_Table {
4
+
5
+ private $aDBc_message = "";
6
+ private $aDBc_class_message = "updated";
7
+ private $aDBc_elements_to_display = array();
8
+ private $aDBc_type_to_clean = "";
9
+ private $aDBc_plural_title = "";
10
+ private $aDBc_sql_get_transients = "";
11
+ private $aDBc_custom_sql_args = "";
12
+ private $aDBc_search_sql_arg = "";
13
+ private $aDBc_order_by_sql_arg = "";
14
+ private $aDBc_limit_offset_sql_arg = "";
15
+ /**
16
+ * Constructor
17
+ */
18
+ function __construct($element_type){
19
+
20
+ $aDBc_singular = __('Transient', 'advanced-database-cleaner');
21
+ $this->aDBc_plural_title = __('Transients', 'advanced-database-cleaner');
22
+
23
+ if($element_type == "expired-transients"){
24
+
25
+ $this->aDBc_type_to_clean = "expired-transients";
26
+ $this->aDBc_custom_sql_args = " AND b.option_value < UNIX_TIMESTAMP()";
27
+
28
+ }else if($element_type == "transients-with-expiration"){
29
+
30
+ $this->aDBc_type_to_clean = "transients-with-expiration";
31
+ $this->aDBc_custom_sql_args = " AND b.option_value > UNIX_TIMESTAMP()";
32
+
33
+ }else if($element_type == "transients-with-no-expiration"){
34
+
35
+ $this->aDBc_type_to_clean = "transients-with-no-expiration";
36
+ $this->aDBc_custom_sql_args = " AND b.option_value is NULL";
37
+
38
+ }
39
+
40
+ // Prepare additional sql args if any: per page, LIMIT, OFFSET, etc.
41
+ if(ADBC_PLUGIN_F_TYPE == "pro"){
42
+ $this->aDBc_search_sql_arg = aDBc_get_search_sql_arg("a.option_name", "a.option_value");
43
+ }
44
+ $this->aDBc_order_by_sql_arg = aDBc_get_order_by_sql_arg("a.option_id");
45
+ $this->aDBc_limit_offset_sql_arg = aDBc_get_limit_offset_sql_args();
46
+
47
+ parent::__construct(array(
48
+ 'singular' => $aDBc_singular, //singular name of the listed records
49
+ 'plural' => $this->aDBc_plural_title, //plural name of the listed records
50
+ 'ajax' => true //does this table support ajax?
51
+ ));
52
+
53
+ $this->aDBc_prepare_elements_to_clean();
54
+ $this->aDBc_print_page_content();
55
+ }
56
+
57
+ /** Prepare elements to display */
58
+ function aDBc_prepare_elements_to_clean(){
59
+
60
+ global $wpdb;
61
+
62
+ // Process bulk action if any before preparing feeds to clean
63
+ $this->process_bulk_action();
64
+
65
+ if(function_exists('is_multisite') && is_multisite()){
66
+ $blogs_ids = $wpdb->get_col("SELECT blog_id FROM $wpdb->blogs");
67
+ foreach($blogs_ids as $blog_id){
68
+
69
+ switch_to_blog($blog_id);
70
+
71
+ $this->aDBc_fill_array_elements_to_clean($blog_id);
72
+
73
+ restore_current_blog();
74
+ }
75
+ }else{
76
+
77
+ $this->aDBc_fill_array_elements_to_clean("1");
78
+ }
79
+ // Call WP prepare_items function
80
+ $this->prepare_items();
81
+ }
82
+
83
+ /** Fill array elements to display */
84
+ function aDBc_fill_array_elements_to_clean($blog_id){
85
+
86
+ global $wpdb;
87
+
88
+ // Get all dashboard transients
89
+ $this->aDBc_sql_get_transients = "SELECT a.option_id, a.option_name, a.option_value as option_content, a.autoload, b.option_value as option_timeout FROM $wpdb->options a LEFT JOIN $wpdb->options b ON b.option_name =
90
+ CONCAT(
91
+ CASE WHEN a.option_name LIKE '_site_transient_%'
92
+ THEN '_site_transient_timeout_'
93
+ ELSE '_transient_timeout_'
94
+ END
95
+ ,
96
+ SUBSTRING(a.option_name, CHAR_LENGTH(
97
+ CASE WHEN a.option_name LIKE '_site_transient_%'
98
+ THEN '_site_transient_'
99
+ ELSE '_transient_'
100
+ END
101
+ ) + 1)
102
+ )
103
+ WHERE (a.option_name LIKE '_transient_%' OR a.option_name LIKE '_site_transient_%') AND a.option_name NOT LIKE '%_transient_timeout_%'"
104
+ . $this->aDBc_custom_sql_args
105
+ . $this->aDBc_search_sql_arg
106
+ . $this->aDBc_order_by_sql_arg
107
+ //. $this->aDBc_limit_offset_sql_arg
108
+ ;
109
+
110
+ $time_now = time();
111
+
112
+ $aDBc_all_transient_feed = $wpdb->get_results($this->aDBc_sql_get_transients);
113
+
114
+ foreach($aDBc_all_transient_feed as $aDBc_transient){
115
+
116
+ // Get timeout of transient
117
+ switch($this->aDBc_type_to_clean){
118
+ case "expired-transients" :
119
+ $transient_timeout = __('Expired','advanced-database-cleaner');
120
+ break;
121
+ case "transients-with-expiration" :
122
+ $transient_timeout = human_time_diff($time_now, $aDBc_transient->option_timeout);
123
+ break;
124
+ case "transients-with-no-expiration" :
125
+ $transient_timeout = __('Does not expire','advanced-database-cleaner');
126
+ break;
127
+ }
128
+
129
+ // Get transient content
130
+ $transient_content = maybe_unserialize($aDBc_transient->option_content);
131
+ if(is_array($transient_content)){
132
+ $transient_content = "<i>Array</i>";
133
+ }elseif(gettype($transient_content) == 'object'){
134
+ $transient_content = "<i>Object</i>";
135
+ }else{
136
+ $transient_content = aDBc_create_tooltip_for_long_string($aDBc_transient->option_content, 35);
137
+ }
138
+
139
+ // Susbst transient name
140
+ $transient_name = aDBc_create_tooltip_for_long_string($aDBc_transient->option_name, 35);
141
+
142
+ array_push($this->aDBc_elements_to_display, array(
143
+ 'transient_id' => $aDBc_transient->option_id,
144
+ 'transient_name' => $transient_name,
145
+ 'transient_content' => $transient_content,
146
+ 'transient_timeout' => $transient_timeout,
147
+ 'transient_autoload' => $aDBc_transient->autoload,
148
+ 'site_id' => $blog_id
149
+ )
150
+ );
151
+ }
152
+ }
153
+
154
+ /** WP: Get columns */
155
+ function get_columns(){
156
+ $columns = array(
157
+ 'cb' => '<input type="checkbox" />',
158
+ 'transient_id' => __('ID','advanced-database-cleaner'),
159
+ 'transient_name' => __('Transient name','advanced-database-cleaner'),
160
+ 'transient_content' => __('Value','advanced-database-cleaner'),
161
+ 'transient_timeout' => __('Expires In','advanced-database-cleaner'),
162
+ 'transient_autoload' => __('Autoload','advanced-database-cleaner'),
163
+ 'site_id' => __('Site id','advanced-database-cleaner')
164
+ );
165
+ return $columns;
166
+ }
167
+
168
+ /** WP: Column default */
169
+ function column_default($item, $column_name){
170
+ switch($column_name){
171
+ case 'transient_id':
172
+ case 'transient_name':
173
+ case 'transient_content':
174
+ case 'transient_timeout':
175
+ case 'transient_autoload':
176
+ case 'site_id':
177
+ return $item[$column_name];
178
+ default:
179
+ return print_r($item, true) ; //Show the whole array for troubleshooting purposes
180
+ }
181
+ }
182
+
183
+ /** WP: Get columns that should be hidden */
184
+ function get_hidden_columns(){
185
+ // If MU, nothing to hide, else hide Side ID column
186
+ if(function_exists('is_multisite') && is_multisite()){
187
+ return array();
188
+ }else{
189
+ return array('site_id');
190
+ }
191
+ }
192
+
193
+ function get_sortable_columns() {
194
+
195
+ $sortable_columns = array(
196
+ 'transient_id' => array('a.option_id', false), //true means it's already sorted
197
+ 'transient_name' => array('a.option_name', false)
198
+ );
199
+ // Since order_by works directly with sql request, we will not order_by in mutlisite since it will not work
200
+ if(function_exists('is_multisite') && is_multisite()){
201
+ return array();
202
+ }else{
203
+ return $sortable_columns;
204
+ }
205
+ }
206
+
207
+ /** WP: Prepare items to display */
208
+ function prepare_items() {
209
+ $columns = $this->get_columns();
210
+ $hidden = $this->get_hidden_columns();
211
+ $sortable = $this->get_sortable_columns();
212
+ $this->_column_headers = array($columns, $hidden, $sortable);
213
+
214
+ $per_page = 50;
215
+ if(!empty($_GET['per_page'])){
216
+ $per_page = absint($_GET['per_page']);
217
+ }
218
+
219
+ $current_page = $this->get_pagenum();
220
+ // Prepare sequence of elements to display
221
+ $display_data = array_slice($this->aDBc_elements_to_display,(($current_page-1) * $per_page), $per_page);
222
+ $this->set_pagination_args( array(
223
+ 'total_items' => count($this->aDBc_elements_to_display),
224
+ 'per_page' => $per_page
225
+ ));
226
+ $this->items = $display_data;
227
+ }
228
+
229
+ /** WP: Column cb for check box */
230
+ function column_cb($item) {
231
+ return sprintf('<input type="checkbox" name="aDBc_feed_to_clean[]" value="%s" />', $item['site_id']."|".$item['transient_id']);
232
+ }
233
+
234
+ /** WP: Get bulk actions */
235
+ function get_bulk_actions() {
236
+ $actions = array(
237
+ 'clean' => __('Clean','advanced-database-cleaner')
238
+ );
239
+ return $actions;
240
+ }
241
+
242
+ /** WP: Message to display when no items found */
243
+ function no_items() {
244
+ _e('No elements found!','advanced-database-cleaner');
245
+ }
246
+
247
+ /** WP: Process bulk actions */
248
+ public function process_bulk_action() {
249
+ // security check!
250
+ if (isset($_POST['_wpnonce']) && !empty($_POST['_wpnonce'])){
251
+ $nonce = filter_input(INPUT_POST, '_wpnonce', FILTER_SANITIZE_STRING);
252
+ $action = 'bulk-' . $this->_args['plural'];
253
+ if (!wp_verify_nonce( $nonce, $action))
254
+ wp_die('Security check failed!');
255
+ }
256
+ $action = $this->current_action();
257
+ if($action == 'clean'){
258
+ // If the user wants to clean the elements he/she selected
259
+ if(isset($_POST['aDBc_feed_to_clean'])){
260
+ if(function_exists('is_multisite') && is_multisite()){
261
+ // Prepare feeds to delete
262
+ $feeds_to_delete = array();
263
+ foreach($_POST['aDBc_feed_to_clean'] as $aDBc_feed){
264
+ $feed_info = explode("|", $aDBc_feed);
265
+ if(empty($feeds_to_delete[$feed_info[0]])){
266
+ $feeds_to_delete[$feed_info[0]] = array();
267
+ }
268
+ array_push($feeds_to_delete[$feed_info[0]], $feed_info[1]);
269
+ }
270
+ // Delete feeds
271
+ foreach($feeds_to_delete as $site_id => $feed_ids){
272
+ switch_to_blog($site_id);
273
+ global $wpdb;
274
+ $names_to_delete = $wpdb->get_col("select option_name from $wpdb->options WHERE option_id IN (" . implode(',',$feed_ids) . ")");
275
+ foreach($names_to_delete as $transient_name){
276
+ $site_wide = (strpos($transient_name, '_site_transient') !== false);
277
+ $name = str_replace($site_wide ? '_site_transient_' : '_transient_', '', $transient_name);
278
+ if(false !== $site_wide){
279
+ delete_site_transient($name);
280
+ }else{
281
+ delete_transient($name);
282
+ }
283
+ }
284
+
285
+ restore_current_blog();
286
+ }
287
+ }else{
288
+ global $wpdb;
289
+ $ids_to_delete = array();
290
+ foreach($_POST['aDBc_feed_to_clean'] as $aDBc_feed) {
291
+ $feed_info = explode("|", $aDBc_feed);
292
+ array_push($ids_to_delete, $feed_info[1]);
293
+ }
294
+
295
+ $names_to_delete = $wpdb->get_col("select option_name from $wpdb->options WHERE option_id IN (" . implode(',',$ids_to_delete) . ")");
296
+ foreach($names_to_delete as $transient_name){
297
+ $site_wide = (strpos($transient_name, '_site_transient') !== false);
298
+ $name = str_replace($site_wide ? '_site_transient_' : '_transient_', '', $transient_name);
299
+ if(false !== $site_wide){
300
+ delete_site_transient($name);
301
+ }else{
302
+ delete_transient($name);
303
+ }
304
+ }
305
+ }
306
+ // Update the message to show to the user
307
+ $this->aDBc_message = __("Selected 'Transients' successfully cleaned!", "advanced-database-cleaner");
308
+ }
309
+ }
310
+ }
311
+
312
+ /** Print the page content */
313
+ function aDBc_print_page_content(){
314
+
315
+ include_once 'page_custom_clean.php';
316
+ }
317
+ }
318
+ ?>
includes/custom-clean-view/header_page_custom_clean.php ADDED
@@ -0,0 +1,90 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <div class="aDBc-float-left aDBc-margin-t-10">
2
+ <a href="?page=advanced_db_cleaner&aDBc_tab=general">
3
+ <img width="40px" src="<?php echo ADBC_PLUGIN_DIR_PATH . '/images/go_back.svg'?>"/>
4
+ </a>
5
+ </div>
6
+
7
+ <div>
8
+ <div class="aDBc-float-right aDBc-custom-clean-text">
9
+ <div>
10
+ <?php echo __('Custom cleaning of','advanced-database-cleaner') . " : <strong>" . $this->aDBc_plural_title . "</strong> - " . __('Total Found','advanced-database-cleaner') . " : <b><span style='background:#ffe4b5;border-radius:8px;padding:2px 6px'>" . count($this->aDBc_elements_to_display) . "</span></b>"; ?>
11
+ </div>
12
+
13
+ </div>
14
+
15
+ <div style="clear:both;margin-bottom:25px;width:100%;background:#f9f9f9" class="aDBc-float-right">
16
+
17
+ <?php
18
+ if(ADBC_PLUGIN_F_TYPE == "free"){
19
+ $aDBc_form_style = "pointer-events:none;opacity:0.5";
20
+
21
+ }else{
22
+ $aDBc_form_style = "";
23
+ }
24
+ ?>
25
+
26
+ <div style="float:left;padding:8px;height:30px">
27
+
28
+ <span class="aDBc_premium_tooltip">
29
+
30
+ <form style="float:left;<?php echo $aDBc_form_style ?>" method="get">
31
+
32
+ <?php
33
+ // Generate current parameters in URL
34
+ foreach($_GET as $name => $value){
35
+ if($name != "s" && $name != "in" && $name != "paged")
36
+ echo "<input type='hidden' name='$name' value='$value'/>";
37
+ }
38
+ // Return paged to page 1
39
+ echo "<input type='hidden' name='paged' value='1'/>";
40
+ ?>
41
+
42
+ <fieldset style="padding-right:5px;float:left">
43
+ <input style="font-size:13px;width:140px;height:30px;border:1px solid #e5e5e5;border-radius:2px;box-shadow:0 0 10px #f1f1f1;" type="search" placeholder="<?php _e('Search for','advanced-database-cleaner') ?>" name="s" value="<?php echo empty($_GET['s']) ? '' : esc_attr($_GET['s']); ?>"/>
44
+ </fieldset>
45
+
46
+ <fieldset style="border:1px solid #f1f1f1;border-radius:2px;box-shadow:0 0 10px #f1f1f1;padding:6px;float:left">
47
+ <span style="padding:2px 10px 2px 5px;"><?php _e('Search in','advanced-database-cleaner') ?></span>
48
+ <input type="radio" name="in" value="key" checked <?php echo (empty($_GET['in']) || (!empty($_GET['in']) && $_GET['in'] == "key")) ? 'checked' : ''; ?>><?php _e('Name','advanced-database-cleaner') ?> &nbsp;
49
+ <input type="radio" name="in" value="value" <?php echo (!empty($_GET['in']) && $_GET['in'] == "value") ? 'checked' : ''; ?>><?php _e('Value','advanced-database-cleaner') ?>
50
+ </fieldset>
51
+ <span style="padding-left:5px;float:left">
52
+ <input style="float:left;height:30px;margin-top:0px" type="submit" class="button-secondary" value="<?php _e('Filter','advanced-database-cleaner') ?>"/>
53
+ </span>
54
+
55
+ </form>
56
+
57
+ <?php if(ADBC_PLUGIN_F_TYPE == "free"){ ?>
58
+ <span style="width:150px" class="aDBc_premium_tooltiptext"><?php _e('Available in Pro version!','advanced-database-cleaner') ?></span>
59
+ <?php } ?>
60
+
61
+ </span>
62
+ </div>
63
+
64
+ <div style="float:right;padding:8px;height:30px;margin-left:20px">
65
+
66
+ <form style="float:left" method="get">
67
+
68
+ <?php
69
+ // Generate current parameters in URL
70
+ foreach($_GET as $name => $value){
71
+ if($name != "per_page" && $name != "paged")
72
+ echo "<input type='hidden' name='$name' value='$value'/>";
73
+ }
74
+ // Return paged to page 1
75
+ echo "<input type='hidden' name='paged' value='1'/>";
76
+ ?>
77
+
78
+ <span style="padding-right:8px;float:left;font-size:13px;padding-top:6px"><?php _e('Items per page','advanced-database-cleaner') ?></span>
79
+ <span style="padding-right:5px;float:left">
80
+
81
+ <input type="number" style="font-size:13px;width:55px;height:30px;border:1px solid #e5e5e5;border-radius:2px;box-shadow:0 0 10px #f1f1f1;" id="revisions-search-input" name="per_page" value="<?php echo empty($_GET['per_page']) ? '50' : esc_attr($_GET['per_page']); ?>"/>
82
+ </span>
83
+
84
+ <span style="float:left">
85
+ <input style="float:left;height:30px;" type="submit" class="button-secondary" value="<?php _e('Show','advanced-database-cleaner') ?>"/>
86
+ </span>
87
+ </form>
88
+ </div>
89
+ </div>
90
+ </div>
includes/custom-clean-view/page_custom_clean.php ADDED
@@ -0,0 +1,35 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ // Print a message if any
4
+ if($this->aDBc_message != ""){
5
+ echo '<div id="aDBc_message" class="' . $this->aDBc_class_message . ' notice is-dismissible"><p>' . $this->aDBc_message . '</p></div>';
6
+ }
7
+
8
+ ?>
9
+
10
+ <div class="aDBc-content-max-width">
11
+
12
+ <?php include_once 'header_page_custom_clean.php'; ?>
13
+
14
+ <div>
15
+ <form id="aDBc_form" action="" method="post">
16
+ <?php
17
+ // Print the elements to clean
18
+ $this->display();
19
+ ?>
20
+ </form>
21
+ </div>
22
+ </div>
23
+ <div id="aDBc_dialog1" title="<?php _e("Cleaning '$this->aDBc_plural_title'","advanced-database-cleaner"); ?>" class="aDBc-jquery-dialog">
24
+ <p class="aDBc-box-warning">
25
+ <?php echo __("You are about to clean some of your $this->aDBc_plural_title. This operation is irreversible!","advanced-database-cleaner") . "<span style='color:red'> " . __('Don\'t forget to make a backup of your database first.','advanced-database-cleaner') . "</span>" ; ?>
26
+ </p>
27
+ <p>
28
+ <?php _e('Are you sure to continue?','advanced-database-cleaner'); ?>
29
+ </p>
30
+ </div>
31
+ <div id="aDBc_dialogx" title="<?php _e('Action required','advanced-database-cleaner'); ?>" class="aDBc-jquery-dialog">
32
+ <p class="aDBc-box-info">
33
+ <?php _e('Please select an action!','advanced-database-cleaner'); ?>
34
+ </p>
35
+ </div>
includes/custom-schedule-view/class_add_cleanup_schedule.php ADDED
@@ -0,0 +1,328 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class ADBC_SCHEDULE_CLEANUP extends WP_List_Table {
3
+
4
+ private $aDBc_message = "";
5
+ private $aDBc_class_message = "updated";
6
+ private $aDBc_elements_to_display = array();
7
+ private $aDBc_total_elements_to_clean = 0;
8
+
9
+ /**
10
+ * Constructor
11
+ */
12
+ function __construct(){
13
+
14
+ parent::__construct(array(
15
+ 'singular' => __('Element', 'advanced-database-cleaner'), //singular name of the listed records
16
+ 'plural' => __('Elements', 'advanced-database-cleaner'), //plural name of the listed records
17
+ 'ajax' => false //does this table support ajax?
18
+ ));
19
+
20
+ $this->aDBc_prepare_elements_to_clean();
21
+ $this->aDBc_print_page_content();
22
+ }
23
+
24
+ /** Prepare elements to display */
25
+ function aDBc_prepare_elements_to_clean(){
26
+
27
+ // Test if user wants to save the scheduled task
28
+ if(isset($_POST['aDBc_schedule_name'])){
29
+
30
+ //Quick nonce security check!
31
+ if(!check_admin_referer('add_cleanup_schedule_nonce', 'add_cleanup_schedule_nonce'))
32
+ return; //get out if we didn't click the save_schedule button
33
+
34
+ if(!empty($_POST['aDBc_elements_to_clean'])){
35
+ if(!empty(trim($_POST['aDBc_schedule_name']))){
36
+ if(preg_match('/^[a-zA-Z0-9_]+$/',$_POST['aDBc_schedule_name'])){
37
+
38
+ // Test if the name is used by other schedules.
39
+ $clean_schedule_setting = get_option('aDBc_clean_schedule');
40
+ $clean_schedule_setting = is_array($clean_schedule_setting) ? $clean_schedule_setting : array();
41
+
42
+ $optimize_schedule_setting = get_option('aDBc_optimize_schedule');
43
+ $optimize_schedule_setting = is_array($optimize_schedule_setting) ? $optimize_schedule_setting : array();
44
+
45
+ if(!array_key_exists($_POST['aDBc_schedule_name'], $clean_schedule_setting) &&
46
+ !array_key_exists($_POST['aDBc_schedule_name'], $optimize_schedule_setting)){
47
+
48
+ if(!empty($_POST['aDBc_date'])){
49
+ if(!empty($_POST['aDBc_time'])){
50
+
51
+ // We will create the new schedule
52
+ $new_schedule_params['elements_to_clean'] = $_POST['aDBc_elements_to_clean'];
53
+ $new_schedule_params['repeat'] = $_POST['aDBc_schedule_repeat'];
54
+ $new_schedule_params['start_date'] = $_POST['aDBc_date'];
55
+ $new_schedule_params['start_time'] = $_POST['aDBc_time'];
56
+ $new_schedule_params['active'] = $_POST['aDBc_status'];
57
+ $clean_schedule_setting[$_POST['aDBc_schedule_name']] = $new_schedule_params;
58
+ update_option('aDBc_clean_schedule', $clean_schedule_setting, "no");
59
+
60
+ list($year, $month, $day) = explode('-', $_POST['aDBc_date']);
61
+ list($hours, $minutes) = explode(':', $_POST['aDBc_time']);
62
+ $seconds = "0";
63
+ $timestamp = mktime($hours, $minutes, $seconds, $month, $day, $year);
64
+
65
+ if($_POST['aDBc_status'] == "1"){
66
+ if($_POST['aDBc_schedule_repeat'] == "once"){
67
+ wp_schedule_single_event($timestamp, "aDBc_clean_scheduler", array($_POST['aDBc_schedule_name']));
68
+ }else{
69
+ wp_schedule_event($timestamp, $_POST['aDBc_schedule_repeat'], "aDBc_clean_scheduler", array($_POST['aDBc_schedule_name']));
70
+ }
71
+ $this->aDBc_message = __('The clean-up schedule saved successfully!', 'advanced-database-cleaner');
72
+ }else{
73
+ $this->aDBc_message = __('The clean-up schedule saved successfully but it is inactive!', 'advanced-database-cleaner');
74
+ }
75
+
76
+ }else{
77
+ $this->aDBc_class_message = "error";
78
+ $this->aDBc_message = __('Please specify a valide time!', 'advanced-database-cleaner');
79
+ }
80
+ }else{
81
+ $this->aDBc_class_message = "error";
82
+ $this->aDBc_message = __('Please specify a valide date!', 'advanced-database-cleaner');
83
+ }
84
+ }else{
85
+ $this->aDBc_class_message = "error";
86
+ $this->aDBc_message = __('The name you have specified is already used by another schedule! Please change it!', 'advanced-database-cleaner');
87
+ }
88
+ }else{
89
+ $this->aDBc_class_message = "error";
90
+ $this->aDBc_message = __('Please change the name! Only letters, numbers and underscores are allowed!', 'advanced-database-cleaner');
91
+ }
92
+ }else{
93
+ $this->aDBc_class_message = "error";
94
+ $this->aDBc_message = __('Please give a name to your schedule!', 'advanced-database-cleaner');
95
+ }
96
+ }else{
97
+ $this->aDBc_class_message = "error";
98
+ $this->aDBc_message = __('Please select at least one item to include in the schedule from the table below!', 'advanced-database-cleaner');
99
+ }
100
+
101
+ }
102
+
103
+ // yyy should this $wpdb be cleaned?
104
+ global $wpdb;
105
+
106
+ // Get all unused elements
107
+ $aDBc_unused_elements = aDBc_return_array_all_elements_to_clean();
108
+
109
+ // Get settings from DB
110
+ $settings = get_option('aDBc_settings');
111
+
112
+ foreach($aDBc_unused_elements as $element_type => $element_name){
113
+
114
+ // Get "keep_last" option. This option is added in ADBC version 3.0, so test if it is not empty before using it
115
+ if(empty($settings['keep_last'])){
116
+ $keep_number = '0';
117
+ }else{
118
+ $keep_setting = $settings['keep_last'];
119
+ if(empty($keep_setting[$element_type])){
120
+ $keep_number = '0';
121
+ }else{
122
+ $keep_number = $keep_setting[$element_type];
123
+ }
124
+ }
125
+ // If the item can have keep_last, then prepare it, otherwise echo N/A
126
+ if($element_type == "revision" ||
127
+ $element_type == "auto-draft" ||
128
+ $element_type == "trash-posts" ||
129
+ $element_type == "moderated-comments" ||
130
+ $element_type == "spam-comments" ||
131
+ $element_type == "trash-comments" ||
132
+ $element_type == "pingbacks" ||
133
+ $element_type == "trackbacks"){
134
+
135
+ $keep_info = "<span>" . $keep_number . " " . __('days','advanced-database-cleaner');
136
+ }else{
137
+ $keep_info = __('N/A','advanced-database-cleaner') ;
138
+ }
139
+
140
+ array_push($this->aDBc_elements_to_display, array(
141
+ 'element_to_schedule' => "<a href='" . $element_name['URL_blog'] . "' target='_blank' class='aDBc_info_icon'>&nbsp;</a>" . $element_name['name'],
142
+ 'keep' => $keep_info,
143
+ 'type' => $element_type
144
+ )
145
+ );
146
+ }
147
+ // Call WP prepare_items function
148
+ $this->prepare_items();
149
+ }
150
+
151
+ /** WP: Get columns */
152
+ function get_columns(){
153
+
154
+ $aDBc_keep_last_toolip = "<span class='aDBc-tooltips-headers'>
155
+ <img class='aDBc-info-image' src='". ADBC_PLUGIN_DIR_PATH . '/images/information2.svg' . "'/>
156
+ <span>" . __('Only data that is older than the number you have specified will be cleaned based on you schedule parameters. To change this value, click on "go back" button.','advanced-database-cleaner') ." </span>
157
+ </span>";
158
+
159
+ $columns = array(
160
+ 'cb' => '<input type="checkbox" />',
161
+ 'element_to_schedule' => __('Elements to include in the schedule','advanced-database-cleaner'),
162
+ 'keep' => __('Keep last','advanced-database-cleaner') . $aDBc_keep_last_toolip,
163
+ 'type' => 'Type'
164
+ );
165
+ return $columns;
166
+ }
167
+
168
+ /** WP: Prepare items to display */
169
+ function prepare_items() {
170
+ $columns = $this->get_columns();
171
+ $hidden = $this->get_hidden_columns();
172
+ $sortable = array();
173
+ $this->_column_headers = array($columns, $hidden, $sortable);
174
+ $per_page = 50;
175
+ $current_page = $this->get_pagenum();
176
+ // Prepare sequence of elements to display
177
+ $display_data = array_slice($this->aDBc_elements_to_display,(($current_page-1) * $per_page), $per_page);
178
+ $this->set_pagination_args( array(
179
+ 'total_items' => count($this->aDBc_elements_to_display),
180
+ 'per_page' => $per_page
181
+ ));
182
+ $this->items = $display_data;
183
+ }
184
+
185
+ /** WP: Get columns that should be hidden */
186
+ function get_hidden_columns(){
187
+ return array('type');
188
+ }
189
+
190
+ /** WP: Column default */
191
+ function column_default($item, $column_name){
192
+ switch($column_name){
193
+ case 'element_to_schedule':
194
+ case 'keep':
195
+ case 'type':
196
+ return $item[$column_name];
197
+ default:
198
+ return print_r($item, true) ; //Show the whole array for troubleshooting purposes
199
+ }
200
+ }
201
+
202
+ /** WP: Column cb for check box */
203
+ function column_cb($item) {
204
+ $checked = "";
205
+ if(isset($_POST['aDBc_elements_to_clean'])){
206
+ if(in_array($item['type'], $_POST['aDBc_elements_to_clean'])){
207
+ $checked = "checked";
208
+ }
209
+ }
210
+ return sprintf('<input type="checkbox" name="aDBc_elements_to_clean[]" value="%s"' . $checked . '/>', $item['type']);
211
+ }
212
+
213
+ /** WP: Get bulk actions */
214
+ function get_bulk_actions() {
215
+ return array();
216
+ }
217
+
218
+ /** WP: Message to display when no items found */
219
+ function no_items() {
220
+ _e('Your database is clean!','advanced-database-cleaner');
221
+ }
222
+
223
+
224
+ /** Print the page content */
225
+ function aDBc_print_page_content(){
226
+ // Print a message if any
227
+ if($this->aDBc_message != ""){
228
+ echo '<div id="aDBc_message" class="' . $this->aDBc_class_message . ' notice is-dismissible"><p>' . $this->aDBc_message . '</p></div>';
229
+ }
230
+ ?>
231
+ <div style="width:636px">
232
+
233
+ <div>
234
+ <div class="aDBc-float-left aDBc-margin-t-10">
235
+ <a href="?page=advanced_db_cleaner&aDBc_tab=general">
236
+ <img width="40px" src="<?php echo ADBC_PLUGIN_DIR_PATH . '/images/go_back.svg'?>"/>
237
+ </a>
238
+ </div>
239
+ <div class="aDBc-float-right" style="border:1px solid #f0f0f0;box-shadow:0 0 10px #eee;border-radius:5px;text-align:center;width:190px;background:#fff;padding:10px;font-size:16px;margin-top: 15px;margin-bottom: 15px;color: #0992CC;">
240
+ <img style="margin-right:10px;vertical-align:middle" width="15px" src="<?php echo ADBC_PLUGIN_DIR_PATH . '/images/add_schedule.svg'?>"/>
241
+ <?php echo __('Add cleanup schedule','advanced-database-cleaner') ; ?>
242
+ </div>
243
+ </div>
244
+
245
+ <div class="aDBc-clear-both"></div>
246
+ <form id="aDBc_form" action="" method="post">
247
+
248
+ <div style="float: left;width: 400px;margin-right: 25px">
249
+ <?php
250
+ // Print the elements to clean
251
+ $this->display();
252
+ ?>
253
+ </div>
254
+
255
+ <div class="aDBc-right-box">
256
+
257
+ <div style="text-align:center">
258
+
259
+ <img width="60px" src="<?php echo ADBC_PLUGIN_DIR_PATH . '/images/alarm-clock.svg'?>"/>
260
+ <br/><br/>
261
+
262
+ <div id="add_schedule" style="border-top:1px dashed #ccc">
263
+ <br/>
264
+ <div style="text-align:left"><?php _e('Name your schedule','advanced-database-cleaner');?></div>
265
+ <input style="width:100%;margin-bottom:10px;height:30px;border-radius:5px;box-shadow:0 0 10px #e0e0e0" type="text" name="aDBc_schedule_name" placeholder="Schedule name" value="<?php echo isset($_POST['aDBc_schedule_name']) ? $_POST['aDBc_schedule_name'] : ""?>" maxlength="25">
266
+
267
+ <div style="text-align:left"><?php _e('Frequency of execution','advanced-database-cleaner');?></div>
268
+ <select style="width:100%;margin-bottom:10px;height:30px;border-radius:5px;box-shadow:0 0 10px #e0e0e0" class="aDBc-schedule-select" name="aDBc_schedule_repeat">
269
+
270
+ <option value="once" <?php echo isset($_POST['aDBc_schedule_repeat']) && $_POST['aDBc_schedule_repeat'] == "once" ? "selected='selected'" : "" ?>>
271
+ <?php _e('Once','advanced-database-cleaner');?>
272
+ </option>
273
+
274
+ <option value="hourly" <?php echo isset($_POST['aDBc_schedule_repeat']) && $_POST['aDBc_schedule_repeat'] == "hourly" ? "selected='selected'" : "" ?>>
275
+ <?php _e('Hourly','advanced-database-cleaner');?>
276
+ </option>
277
+ <option value="twicedaily" <?php echo isset($_POST['aDBc_schedule_repeat']) && $_POST['aDBc_schedule_repeat'] == "twicedaily" ? "selected='selected'" : "" ?>>
278
+ <?php _e('Twice a day','advanced-database-cleaner');?>
279
+ </option>
280
+ <option value="daily" <?php echo isset($_POST['aDBc_schedule_repeat']) && $_POST['aDBc_schedule_repeat'] == "daily" ? "selected='selected'" : "" ?>>
281
+ <?php _e('Daily','advanced-database-cleaner');?>
282
+ </option>
283
+ <option value="weekly" <?php echo isset($_POST['aDBc_schedule_repeat']) && $_POST['aDBc_schedule_repeat'] == "weekly" ? "selected='selected'" : "" ?>>
284
+ <?php _e('Weekly','advanced-database-cleaner');?>
285
+ </option>
286
+ <option value="monthly" <?php echo isset($_POST['aDBc_schedule_repeat']) && $_POST['aDBc_schedule_repeat'] == "monthly" ? "selected='selected'" : "" ?>>
287
+ <?php _e('Monthly','advanced-database-cleaner');?>
288
+ </option>
289
+ </select>
290
+
291
+ <div style="text-align:left"><?php _e('Start date','advanced-database-cleaner');?></div>
292
+ <input style="width:100%;margin-bottom:10px;height:30px;border-radius:5px;box-shadow:0 0 10px #e0e0e0" type="date" name="aDBc_date" placeholder="" value="<?php echo isset($_POST['aDBc_date']) ? $_POST['aDBc_date'] : date("Y-m-d"); ?>" min="<?php echo date("Y-m-d"); ?>">
293
+
294
+ <div style="text-align:left"><?php _e('Start time (GMT)','advanced-database-cleaner');?></div>
295
+ <input style="width:100%;margin-bottom:10px;height:30px;border-radius:5px;box-shadow:0 0 10px #e0e0e0" type="time" name="aDBc_time" value="<?php echo isset($_POST['aDBc_time']) ? $_POST['aDBc_time'] : date("H:i", time()); ?>">
296
+
297
+
298
+ <div style="text-align:left"><?php _e('Schedule status','advanced-database-cleaner');?></div>
299
+
300
+ <div style="margin-top:2px;text-align:left;background:#fff;padding:5px;box-shadow:0 0 10px #e0e0e0;border-radius:5px">
301
+ <input type="radio" name="aDBc_status" value="1" checked>
302
+ <span style="margin-right:20px"><?php _e('Active','advanced-database-cleaner');?></span>
303
+
304
+ <input type="radio" name="aDBc_status" value="0" <?php echo (isset($_POST['aDBc_status']) && $_POST['aDBc_status'] == "0") ? 'checked' : ''; ?>>
305
+ <?php _e('Inactive','advanced-database-cleaner');?>
306
+ </div>
307
+
308
+ <div style="width:100%;margin-top:20px">
309
+ <input class="button-primary" type="submit" value="<?php _e('Save the schedule','advanced-database-cleaner'); ?>" style="width:100%;"/>
310
+ </div>
311
+
312
+ </div>
313
+
314
+ </div>
315
+ </div>
316
+
317
+ <?php wp_nonce_field('add_cleanup_schedule_nonce', 'add_cleanup_schedule_nonce'); ?>
318
+
319
+ </form>
320
+ <div class="aDBc-clear-both"></div>
321
+ </div>
322
+
323
+ <?php
324
+
325
+ }
326
+ }
327
+
328
+ ?>
includes/custom-schedule-view/class_add_optimize_schedule.php ADDED
@@ -0,0 +1,211 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class ADBC_SCHEDULE_OPTIMIZE {
3
+
4
+ private $aDBc_message = "";
5
+ private $aDBc_class_message = "updated";
6
+
7
+ /**
8
+ * Constructor
9
+ */
10
+ function __construct(){
11
+
12
+ $this->aDBc_prepare_elements_to_clean();
13
+ $this->aDBc_print_page_content();
14
+ }
15
+
16
+ /** Prepare elements to display */
17
+ function aDBc_prepare_elements_to_clean(){
18
+
19
+ // Test if user wants to save the scheduled task
20
+ if(isset($_POST['aDBc_schedule_name'])){
21
+
22
+ //Quick nonce security check!
23
+ if(!check_admin_referer('add_optimize_schedule_nonce', 'add_optimize_schedule_nonce'))
24
+ return; //get out if we didn't click the save_schedule button
25
+
26
+ if(!empty(trim($_POST['aDBc_schedule_name']))){
27
+ if(preg_match('/^[a-zA-Z0-9_]+$/',$_POST['aDBc_schedule_name'])){
28
+
29
+ // Test if the name is used by other schedules.
30
+ $clean_schedule_setting = get_option('aDBc_clean_schedule');
31
+ $clean_schedule_setting = is_array($clean_schedule_setting) ? $clean_schedule_setting : array();
32
+
33
+ $optimize_schedule_setting = get_option('aDBc_optimize_schedule');
34
+ $optimize_schedule_setting = is_array($optimize_schedule_setting) ? $optimize_schedule_setting : array();
35
+
36
+ if(!array_key_exists($_POST['aDBc_schedule_name'], $clean_schedule_setting) &&
37
+ !array_key_exists($_POST['aDBc_schedule_name'], $optimize_schedule_setting)){
38
+
39
+ if(!empty($_POST['aDBc_date'])){
40
+ if(!empty($_POST['aDBc_time'])){
41
+
42
+ if(!empty($_POST['aDBc_operation1']) || !empty($_POST['aDBc_operation2'])){
43
+
44
+ // We will create the new schedule
45
+ $new_schedule_params['repeat'] = $_POST['aDBc_schedule_repeat'];
46
+ $new_schedule_params['start_date'] = $_POST['aDBc_date'];
47
+ $new_schedule_params['start_time'] = $_POST['aDBc_time'];
48
+
49
+ // Prepare operations to perform
50
+ $operations = array();
51
+ if(!empty($_POST['aDBc_operation1']))
52
+ array_push($operations, $_POST['aDBc_operation1']);
53
+ if(!empty($_POST['aDBc_operation2']))
54
+ array_push($operations, $_POST['aDBc_operation2']);
55
+ $new_schedule_params['operations'] = $operations;
56
+
57
+ $new_schedule_params['active'] = $_POST['aDBc_status'];
58
+ $optimize_schedule_setting[$_POST['aDBc_schedule_name']] = $new_schedule_params;
59
+ update_option('aDBc_optimize_schedule', $optimize_schedule_setting, "no");
60
+
61
+ list($year, $month, $day) = explode('-', $_POST['aDBc_date']);
62
+ list($hours, $minutes) = explode(':', $_POST['aDBc_time']);
63
+ $seconds = "0";
64
+ $timestamp = mktime($hours, $minutes, $seconds, $month, $day, $year);
65
+
66
+ if($_POST['aDBc_status'] == "1"){
67
+ if($_POST['aDBc_schedule_repeat'] == "once"){
68
+ wp_schedule_single_event($timestamp, "aDBc_optimize_scheduler", array($_POST['aDBc_schedule_name']));
69
+ }else{
70
+ wp_schedule_event($timestamp, $_POST['aDBc_schedule_repeat'], "aDBc_optimize_scheduler", array($_POST['aDBc_schedule_name']));
71
+ }
72
+ $this->aDBc_message = __('The clean-up schedule saved successfully!', 'advanced-database-cleaner');
73
+ }else{
74
+ $this->aDBc_message = __('The clean-up schedule saved successfully but it is inactive!', 'advanced-database-cleaner');
75
+ }
76
+ }else{
77
+ $this->aDBc_class_message = "error";
78
+ $this->aDBc_message = __('Please choose at least one operation to perform!', 'advanced-database-cleaner');
79
+ }
80
+ }else{
81
+ $this->aDBc_class_message = "error";
82
+ $this->aDBc_message = __('Please specify a valide time!', 'advanced-database-cleaner');
83
+ }
84
+ }else{
85
+ $this->aDBc_class_message = "error";
86
+ $this->aDBc_message = __('Please specify a valide date!', 'advanced-database-cleaner');
87
+ }
88
+ }else{
89
+ $this->aDBc_class_message = "error";
90
+ $this->aDBc_message = __('The name you have specified is already used by another schedule! Please change it!', 'advanced-database-cleaner');
91
+ }
92
+ }else{
93
+ $this->aDBc_class_message = "error";
94
+ $this->aDBc_message = __('Please change the name! Only letters, numbers and underscores are allowed!', 'advanced-database-cleaner');
95
+ }
96
+ }else{
97
+ $this->aDBc_class_message = "error";
98
+ $this->aDBc_message = __('Please give a name to your schedule!', 'advanced-database-cleaner');
99
+ }
100
+ }
101
+ }
102
+
103
+ /** Print the page content */
104
+ function aDBc_print_page_content(){
105
+ // Print a message if any
106
+ if($this->aDBc_message != ""){
107
+ echo '<div id="aDBc_message" class="' . $this->aDBc_class_message . ' notice is-dismissible"><p>' . $this->aDBc_message . '</p></div>';
108
+ }
109
+ ?>
110
+ <div style="width:636px">
111
+
112
+ <div>
113
+ <div class="aDBc-float-left aDBc-margin-t-10">
114
+ <a href="?page=advanced_db_cleaner&aDBc_tab=tables&aDBc_cat=all">
115
+ <img width="40px" src="<?php echo ADBC_PLUGIN_DIR_PATH . '/images/go_back.svg'?>"/>
116
+ </a>
117
+ </div>
118
+ <div class="aDBc-float-right" style="border:1px solid #f0f0f0;box-shadow:0 0 10px #eee;border-radius:5px;text-align:center;width:198px;background:#fff;padding:10px 5px;font-size:16px;margin-top: 15px;margin-bottom: 15px;color: #0992CC;">
119
+ <img style="margin-right:10px;vertical-align:middle" width="15px" src="<?php echo ADBC_PLUGIN_DIR_PATH . '/images/add_schedule.svg'?>"/>
120
+ <?php echo __('Add optimize schedule','advanced-database-cleaner') ; ?>
121
+ </div>
122
+ </div>
123
+
124
+ <div class="aDBc-clear-both"></div>
125
+
126
+ <form id="aDBc_form" action="" method="post">
127
+
128
+ <div style="float:left;width:400px;margin-right: 25px;background:#f0f5fa;margin-top:49px;padding-top:50px;height:100px;text-align:center;border-radius:4px;border:1px solid #eee">
129
+ <?php echo __('By default, all your database tables will be optimized and/or repaired (if needed) according to your schedule settings','advanced-database-cleaner') ; ?>
130
+ </div>
131
+
132
+ <div class="aDBc-right-box">
133
+
134
+ <div style="text-align:center">
135
+
136
+ <img width="60px" src="<?php echo ADBC_PLUGIN_DIR_PATH . '/images/alarm-clock.svg'?>"/>
137
+ <br/><br/>
138
+
139
+ <div id="add_schedule" style="border-top:1px dashed #ccc">
140
+ <br/>
141
+ <div style="text-align:left"><?php _e('Name your schedule','advanced-database-cleaner');?></div>
142
+ <input style="width:100%;margin-bottom:10px;height:30px;border-radius:5px;box-shadow:0 0 10px #e0e0e0" type="text" name="aDBc_schedule_name" placeholder="Schedule name" value="<?php echo isset($_POST['aDBc_schedule_name']) ? $_POST['aDBc_schedule_name'] : ""?>" maxlength="25">
143
+
144
+ <div style="text-align:left"><?php _e('Frequency of execution','advanced-database-cleaner');?></div>
145
+ <select style="width:100%;margin-bottom:10px;height:30px;border-radius:5px;box-shadow:0 0 10px #e0e0e0" class="aDBc-schedule-select" name="aDBc_schedule_repeat">
146
+
147
+ <option value="once" <?php echo isset($_POST['aDBc_schedule_repeat']) && $_POST['aDBc_schedule_repeat'] == "once" ? "selected='selected'" : "" ?>>
148
+ <?php _e('Once','advanced-database-cleaner');?>
149
+ </option>
150
+
151
+ <option value="hourly" <?php echo isset($_POST['aDBc_schedule_repeat']) && $_POST['aDBc_schedule_repeat'] == "hourly" ? "selected='selected'" : "" ?>>
152
+ <?php _e('Hourly','advanced-database-cleaner');?>
153
+ </option>
154
+ <option value="twicedaily" <?php echo isset($_POST['aDBc_schedule_repeat']) && $_POST['aDBc_schedule_repeat'] == "twicedaily" ? "selected='selected'" : "" ?>>
155
+ <?php _e('Twice a day','advanced-database-cleaner');?>
156
+ </option>
157
+ <option value="daily" <?php echo isset($_POST['aDBc_schedule_repeat']) && $_POST['aDBc_schedule_repeat'] == "daily" ? "selected='selected'" : "" ?>>
158
+ <?php _e('Daily','advanced-database-cleaner');?>
159
+ </option>
160
+ <option value="weekly" <?php echo isset($_POST['aDBc_schedule_repeat']) && $_POST['aDBc_schedule_repeat'] == "weekly" ? "selected='selected'" : "" ?>>
161
+ <?php _e('Weekly','advanced-database-cleaner');?>
162
+ </option>
163
+ <option value="monthly" <?php echo isset($_POST['aDBc_schedule_repeat']) && $_POST['aDBc_schedule_repeat'] == "monthly" ? "selected='selected'" : "" ?>>
164
+ <?php _e('Monthly','advanced-database-cleaner');?>
165
+ </option>
166
+ </select>
167
+
168
+ <div style="text-align:left"><?php _e('Start date','advanced-database-cleaner');?></div>
169
+ <input style="width:100%;margin-bottom:10px;height:30px;border-radius:5px;box-shadow:0 0 10px #e0e0e0" type="date" name="aDBc_date" placeholder="" value="<?php echo isset($_POST['aDBc_date']) ? $_POST['aDBc_date'] : date("Y-m-d"); ?>" min="<?php echo date("Y-m-d"); ?>">
170
+
171
+ <div style="text-align:left"><?php _e('Start time (GMT)','advanced-database-cleaner');?></div>
172
+ <input style="width:100%;margin-bottom:10px;height:30px;border-radius:5px;box-shadow:0 0 10px #e0e0e0" type="time" name="aDBc_time" value="<?php echo isset($_POST['aDBc_time']) ? $_POST['aDBc_time'] : date("H:i", time()); ?>">
173
+
174
+ <div style="text-align:left"><?php _e('Perform operations','advanced-database-cleaner');?></div>
175
+ <div style="margin-bottom:10px;margin-top:2px;text-align:left;background:#fff;padding:5px;box-shadow:0 0 10px #e0e0e0;border-radius:5px">
176
+ <input type="checkbox" name="aDBc_operation1" value="optimize" <?php echo (isset($_POST['aDBc_operation1']) && $_POST['aDBc_operation1'] == "optimize") ? 'checked' : ''; ?>>
177
+ <span style="margin-right:20px"><?php _e('Optimize','advanced-database-cleaner');?></span>
178
+
179
+ <input type="checkbox" name="aDBc_operation2" value="repair" <?php echo (isset($_POST['aDBc_operation2']) && $_POST['aDBc_operation2'] == "repair") ? 'checked' : ''; ?>>
180
+ <?php _e('Repair','advanced-database-cleaner');?>
181
+ </div>
182
+
183
+ <div style="text-align:left"><?php _e('Schedule status','advanced-database-cleaner');?></div>
184
+ <div style="margin-top:2px;text-align:left;background:#fff;padding:5px;box-shadow:0 0 10px #e0e0e0;border-radius:5px">
185
+ <input type="radio" name="aDBc_status" value="1" checked>
186
+ <span style="margin-right:35px"><?php _e('Active','advanced-database-cleaner');?></span>
187
+
188
+ <input type="radio" name="aDBc_status" value="0" <?php echo (isset($_POST['aDBc_status']) && $_POST['aDBc_status'] == "0") ? 'checked' : ''; ?>>
189
+ <?php _e('Inactive','advanced-database-cleaner');?>
190
+ </div>
191
+
192
+ <div style="width:100%;margin-top:20px">
193
+ <input class="button-primary" type="submit" value="<?php _e('Save the schedule','advanced-database-cleaner'); ?>" style="width:100%;"/>
194
+ </div>
195
+
196
+ </div>
197
+
198
+ </div>
199
+ </div>
200
+
201
+ <?php wp_nonce_field('add_optimize_schedule_nonce', 'add_optimize_schedule_nonce'); ?>
202
+
203
+ </form>
204
+ <div class="aDBc-clear-both"></div>
205
+ </div>
206
+
207
+ <?php
208
+ }
209
+ }
210
+
211
+ ?>
includes/custom-schedule-view/class_edit_cleanup_schedule.php ADDED
@@ -0,0 +1,371 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class EDIT_SCHEDULE_CLEANUP extends WP_List_Table {
3
+
4
+ private $aDBc_message = "";
5
+ private $aDBc_class_message = "updated";
6
+ private $aDBc_elements_to_display = array();
7
+ private $aDBc_total_elements_to_clean = 0;
8
+
9
+ /**
10
+ * Constructor
11
+ */
12
+ function __construct(){
13
+
14
+ parent::__construct(array(
15
+ 'singular' => __('Element', 'advanced-database-cleaner'), //singular name of the listed records
16
+ 'plural' => __('Elements', 'advanced-database-cleaner'), //plural name of the listed records
17
+ 'ajax' => false //does this table support ajax?
18
+ ));
19
+
20
+ $this->aDBc_prepare_elements_to_clean();
21
+ $this->aDBc_print_page_content();
22
+ }
23
+
24
+ /** Prepare elements to display */
25
+ function aDBc_prepare_elements_to_clean(){
26
+
27
+ // Test if user wants to save the edited scheduled task
28
+ if(isset($_POST['aDBc_schedule_name'])){
29
+
30
+ //Quick nonce security check!
31
+ if(!check_admin_referer('edit_cleanup_schedule_nonce', 'edit_cleanup_schedule_nonce'))
32
+ return; //get out if we didn't click the save_schedule button
33
+
34
+ if(!empty($_POST['aDBc_elements_to_clean'])){
35
+ if(!empty(trim($_POST['aDBc_schedule_name']))){
36
+ if(preg_match('/^[a-zA-Z0-9_]+$/',$_POST['aDBc_schedule_name'])){
37
+
38
+ // Test if the name is used by other schedules.
39
+ $clean_schedule_setting = get_option('aDBc_clean_schedule');
40
+ $clean_schedule_setting = is_array($clean_schedule_setting) ? $clean_schedule_setting : array();
41
+
42
+ $optimize_schedule_setting = get_option('aDBc_optimize_schedule');
43
+ $optimize_schedule_setting = is_array($optimize_schedule_setting) ? $optimize_schedule_setting : array();
44
+
45
+ if($_POST['aDBc_schedule_name'] == $_GET['hook_name'] ||
46
+ ($_POST['aDBc_schedule_name'] != $_GET['hook_name'] &&
47
+ !array_key_exists($_POST['aDBc_schedule_name'], $clean_schedule_setting) &&
48
+ !array_key_exists($_POST['aDBc_schedule_name'], $optimize_schedule_setting))){
49
+
50
+ if(!empty($_POST['aDBc_date'])){
51
+ if(!empty($_POST['aDBc_time'])){
52
+
53
+ // Delete the old schedule and replace it with the new
54
+
55
+ // We will create the new schedule
56
+ $new_schedule_params['elements_to_clean'] = $_POST['aDBc_elements_to_clean'];
57
+ $new_schedule_params['repeat'] = $_POST['aDBc_schedule_repeat'];
58
+ $new_schedule_params['start_date'] = $_POST['aDBc_date'];
59
+ $new_schedule_params['start_time'] = $_POST['aDBc_time'];
60
+ $new_schedule_params['active'] = $_POST['aDBc_status'];
61
+ $clean_schedule_setting[$_POST['aDBc_schedule_name']] = $new_schedule_params;
62
+ update_option('aDBc_clean_schedule', $clean_schedule_setting, "no");
63
+
64
+ list($year, $month, $day) = explode('-', $_POST['aDBc_date']);
65
+ list($hours, $minutes) = explode(':', $_POST['aDBc_time']);
66
+ $seconds = "0";
67
+ $timestamp = mktime($hours, $minutes, $seconds, $month, $day, $year);
68
+
69
+ // Clear scheduled event
70
+ wp_clear_scheduled_hook('aDBc_clean_scheduler', array($_POST['aDBc_schedule_name'].''));
71
+
72
+ if($_POST['aDBc_status'] == "1"){
73
+ if($_POST['aDBc_schedule_repeat'] == "once"){
74
+ wp_schedule_single_event($timestamp, "aDBc_clean_scheduler", array($_POST['aDBc_schedule_name']));
75
+ }else{
76
+ wp_schedule_event($timestamp, $_POST['aDBc_schedule_repeat'], "aDBc_clean_scheduler", array($_POST['aDBc_schedule_name']));
77
+ }
78
+ $this->aDBc_message = __('The clean-up schedule saved successfully!', 'advanced-database-cleaner');
79
+ }else{
80
+ $this->aDBc_message = __('The clean-up schedule saved successfully but it is inactive!', 'advanced-database-cleaner');
81
+ }
82
+ }else{
83
+ $this->aDBc_class_message = "error";
84
+ $this->aDBc_message = __('Please specify a valide time!', 'advanced-database-cleaner');
85
+ }
86
+ }else{
87
+ $this->aDBc_class_message = "error";
88
+ $this->aDBc_message = __('Please specify a valide date!', 'advanced-database-cleaner');
89
+ }
90
+ }else{
91
+ $this->aDBc_class_message = "error";
92
+ $this->aDBc_message = __('The name you have specified is already used by another schedule! Please change it!', 'advanced-database-cleaner');
93
+ }
94
+ }else{
95
+ $this->aDBc_class_message = "error";
96
+ $this->aDBc_message = __('Please change the name! Only letters, numbers and underscores are allowed!', 'advanced-database-cleaner');
97
+ }
98
+ }else{
99
+ $this->aDBc_class_message = "error";
100
+ $this->aDBc_message = __('Please give a name to your schedule!', 'advanced-database-cleaner');
101
+ }
102
+ }else{
103
+ $this->aDBc_class_message = "error";
104
+ $this->aDBc_message = __('Please select at least one item to include in the schedule from the table below!', 'advanced-database-cleaner');
105
+ }
106
+
107
+ }
108
+ // yyy should this $wpdb be cleaned?
109
+ global $wpdb;
110
+
111
+ // Get all unused elements
112
+ $aDBc_unused_elements = aDBc_return_array_all_elements_to_clean();
113
+
114
+ // Get settings from DB
115
+ $settings = get_option('aDBc_settings');
116
+
117
+ foreach($aDBc_unused_elements as $element_type => $element_name){
118
+
119
+ // Get "keep_last" option. This option is added in ADBC version 3.0, so test if it is not empty before using it
120
+ if(empty($settings['keep_last'])){
121
+ $keep_number = '0';
122
+ }else{
123
+ $keep_setting = $settings['keep_last'];
124
+ if(empty($keep_setting[$element_type])){
125
+ $keep_number = '0';
126
+ }else{
127
+ $keep_number = $keep_setting[$element_type];
128
+ }
129
+ }
130
+ // If the item can have keep_last, then prepare it, otherwise echo N/A
131
+ if($element_type == "revision" ||
132
+ $element_type == "auto-draft" ||
133
+ $element_type == "trash-posts" ||
134
+ $element_type == "moderated-comments" ||
135
+ $element_type == "spam-comments" ||
136
+ $element_type == "trash-comments" ||
137
+ $element_type == "pingbacks" ||
138
+ $element_type == "trackbacks"){
139
+
140
+ $keep_info = "<span>" . $keep_number . " " . __('days','advanced-database-cleaner');
141
+ }else{
142
+ $keep_info = __('N/A','advanced-database-cleaner') ;
143
+ }
144
+
145
+ array_push($this->aDBc_elements_to_display, array(
146
+ 'element_to_schedule' => "<a href='" . $element_name['URL_blog'] . "' target='_blank' class='aDBc_info_icon'>&nbsp;</a>" . $element_name['name'],
147
+ 'keep' => $keep_info,
148
+ 'type' => $element_type
149
+ )
150
+ );
151
+ }
152
+ // Call WP prepare_items function
153
+ $this->prepare_items();
154
+ }
155
+
156
+ /** WP: Get columns */
157
+ function get_columns(){
158
+
159
+ $aDBc_keep_last_toolip = "<span class='aDBc-tooltips-headers'>
160
+ <img class='aDBc-info-image' src='". ADBC_PLUGIN_DIR_PATH . '/images/information2.svg' . "'/>
161
+ <span>" . __('Only data that is older than the number you have specified will be cleaned based on you schedule parameters. To change this value, click on "go back" button.','advanced-database-cleaner') ." </span>
162
+ </span>";
163
+
164
+ $columns = array(
165
+ 'cb' => '<input type="checkbox" />',
166
+ 'element_to_schedule' => __('Elements to include in the schedule','advanced-database-cleaner'),
167
+ 'keep' => __('Keep last','advanced-database-cleaner') . $aDBc_keep_last_toolip,
168
+ 'type' => 'Type'
169
+ );
170
+ return $columns;
171
+ }
172
+
173
+ /** WP: Prepare items to display */
174
+ function prepare_items() {
175
+ $columns = $this->get_columns();
176
+ $hidden = $this->get_hidden_columns();
177
+ $sortable = array();
178
+ $this->_column_headers = array($columns, $hidden, $sortable);
179
+ $per_page = 50;
180
+ $current_page = $this->get_pagenum();
181
+ // Prepare sequence of elements to display
182
+ $display_data = array_slice($this->aDBc_elements_to_display,(($current_page-1) * $per_page), $per_page);
183
+ $this->set_pagination_args( array(
184
+ 'total_items' => count($this->aDBc_elements_to_display),
185
+ 'per_page' => $per_page
186
+ ));
187
+ $this->items = $display_data;
188
+ }
189
+
190
+ /** WP: Get columns that should be hidden */
191
+ function get_hidden_columns(){
192
+ return array('type');
193
+ }
194
+
195
+ /** WP: Column default */
196
+ function column_default($item, $column_name){
197
+ switch($column_name){
198
+ case 'element_to_schedule':
199
+ case 'keep':
200
+ case 'type':
201
+ return $item[$column_name];
202
+ default:
203
+ return print_r($item, true) ; //Show the whole array for troubleshooting purposes
204
+ }
205
+ }
206
+
207
+ /** WP: Column cb for check box */
208
+ function column_cb($item) {
209
+ $checked = "";
210
+
211
+ if(isset($_POST['aDBc_schedule_name'])){
212
+ if(in_array($item['type'], $_POST['aDBc_elements_to_clean'])){
213
+ $checked = "checked";
214
+ }
215
+ }else{
216
+
217
+ $schedule_settings = get_option('aDBc_clean_schedule');
218
+ $schedule_params = $schedule_settings[$_GET['hook_name']];
219
+ $schedule_elements_to_clean = $schedule_params['elements_to_clean'];
220
+ $schedule_elements_to_clean = is_array($schedule_elements_to_clean) ? $schedule_elements_to_clean : array();
221
+
222
+ if(in_array($item['type'], $schedule_elements_to_clean)){
223
+ $checked = "checked";
224
+ }
225
+ }
226
+
227
+ return sprintf('<input type="checkbox" name="aDBc_elements_to_clean[]" value="%s"' . $checked . '/>', $item['type']);
228
+ }
229
+
230
+ /** WP: Get bulk actions */
231
+ function get_bulk_actions() {
232
+ return array();
233
+ }
234
+
235
+ /** WP: Message to display when no items found */
236
+ function no_items() {
237
+ _e('Your database is clean!','advanced-database-cleaner');
238
+ }
239
+
240
+
241
+ /** Print the page content */
242
+ function aDBc_print_page_content(){
243
+ // Print a message if any
244
+ if($this->aDBc_message != ""){
245
+ echo '<div id="aDBc_message" class="' . $this->aDBc_class_message . ' notice is-dismissible"><p>' . $this->aDBc_message . '</p></div>';
246
+ }
247
+ ?>
248
+ <div style="width:636px">
249
+
250
+ <div>
251
+ <div class="aDBc-float-left aDBc-margin-t-10">
252
+ <a href="?page=advanced_db_cleaner&aDBc_tab=general">
253
+ <img width="40px" src="<?php echo ADBC_PLUGIN_DIR_PATH . '/images/go_back.svg'?>"/>
254
+ </a>
255
+ </div>
256
+ <div class="aDBc-float-right" style="border:1px solid #f0f0f0;box-shadow:0 0 10px #eee;border-radius:5px;text-align:center;width:190px;background:#fff;padding:10px;font-size:16px;margin-top: 15px;margin-bottom: 25px;color: #0992CC;">
257
+ <img style="margin-right:10px" width="15px" src="<?php echo ADBC_PLUGIN_DIR_PATH . '/images/edit_schedule.svg'?>"/>
258
+ <?php echo __('Edit cleanup schedule','advanced-database-cleaner') ; ?>
259
+ </div>
260
+ </div>
261
+
262
+ <div class="aDBc-clear-both"></div>
263
+ <form id="aDBc_form" action="" method="post">
264
+ <div style="float: left;width: 400px;margin-right: 25px">
265
+ <?php
266
+ // Print the elements to clean
267
+ $this->display();
268
+ ?>
269
+ </div>
270
+
271
+ <?php
272
+ // Prepare info of the original schedule to fill it into inputs...
273
+
274
+ if(isset($_POST['aDBc_schedule_name'])){
275
+
276
+ $hook_name = $_POST['aDBc_schedule_name'];
277
+ $schedule_repeat = $_POST['aDBc_schedule_repeat'];
278
+ $schedule_date = $_POST['aDBc_date'];
279
+ $schedule_time = $_POST['aDBc_time'];
280
+ $schedule_status = $_POST['aDBc_status'];
281
+
282
+ }else{
283
+
284
+ $schedule_settings = get_option('aDBc_clean_schedule');
285
+ $schedule_params = $schedule_settings[$_GET['hook_name']];
286
+
287
+ $hook_name = $_GET['hook_name'];
288
+ $schedule_repeat = $schedule_params['repeat'];
289
+ $timestamp = wp_next_scheduled("aDBc_clean_scheduler", array($_GET['hook_name'] . ''));
290
+ if($timestamp){
291
+ $schedule_date = date("Y-m-d", $timestamp);
292
+ $schedule_time = date("H:i", $timestamp);
293
+ }else{
294
+ $schedule_date = date("Y-m-d");
295
+ $schedule_time = date("H:i", time());
296
+ }
297
+ $schedule_status = $schedule_params['active'];
298
+ }
299
+
300
+ ?>
301
+
302
+ <div class="aDBc-right-box">
303
+
304
+ <div style="text-align:center">
305
+
306
+ <img width="60px" src="<?php echo ADBC_PLUGIN_DIR_PATH . '/images/alarm-clock.svg'?>"/>
307
+ <br/><br/>
308
+
309
+ <div id="add_schedule" style="border-top:1px dashed #ccc">
310
+ <br/>
311
+
312
+ <div style="text-align:left"><?php _e('Schedule name','advanced-database-cleaner');?></div>
313
+ <input style="width:100%;margin-bottom:10px;height:30px;border-radius:5px;box-shadow:0 0 10px #e0e0e0;background-color: #ccc !important;color: #000 !important;" type="text" name="aDBc_schedule_name_x" placeholder="Schedule name" value="<?php echo $hook_name; ?>" maxlength="25" disabled>
314
+ <input type="hidden" name="aDBc_schedule_name" value="<?php echo $hook_name; ?>" maxlength="25">
315
+
316
+ <div style="text-align:left"><?php _e('Frequency of execution','advanced-database-cleaner');?></div>
317
+ <select style="width:100%;margin-bottom:10px;height:30px;border-radius:5px;box-shadow:0 0 10px #e0e0e0" class="aDBc-schedule-select" name="aDBc_schedule_repeat">
318
+ <?php
319
+ $schedules_repeat = array('once' => __('Once','advanced-database-cleaner'),
320
+ 'hourly' => __('Hourly','advanced-database-cleaner'),
321
+ 'twicedaily' => __('Twice a day','advanced-database-cleaner'),
322
+ 'daily' => __('Daily','advanced-database-cleaner'),
323
+ 'weekly' => __('Weekly','advanced-database-cleaner'),
324
+ 'monthly' => __('Monthly','advanced-database-cleaner'));
325
+
326
+ foreach($schedules_repeat as $code_repeat => $name_repeat){
327
+ if($code_repeat == $schedule_repeat){
328
+ echo "<option value='$code_repeat' selected='selected'>$name_repeat</option>";
329
+ }else{
330
+ echo "<option value='$code_repeat'>$name_repeat</option>";
331
+ }
332
+ }
333
+ ?>
334
+ </select>
335
+
336
+ <div style="text-align:left"><?php _e('Start date','advanced-database-cleaner');?></div>
337
+ <input style="width:100%;margin-bottom:10px;height:30px;border-radius:5px;box-shadow:0 0 10px #e0e0e0" type="date" name="aDBc_date" placeholder="" value="<?php echo $schedule_date; ?>" min="<?php echo date("Y-m-d"); ?>">
338
+
339
+ <div style="text-align:left"><?php _e('Start time (GMT)','advanced-database-cleaner');?></div>
340
+ <input style="width:100%;margin-bottom:10px;height:30px;border-radius:5px;box-shadow:0 0 10px #e0e0e0" type="time" name="aDBc_time" value="<?php echo $schedule_time; ?>">
341
+
342
+ <div style="text-align:left"><?php _e('Schedule status','advanced-database-cleaner');?></div>
343
+
344
+ <div style="margin-top:2px;text-align:left;background:#fff;padding:5px;box-shadow:0 0 10px #e0e0e0;border-radius:5px">
345
+ <input type="radio" name="aDBc_status" value="1" checked>
346
+ <span style="margin-right:20px"><?php _e('Active','advanced-database-cleaner');?></span>
347
+
348
+ <input type="radio" name="aDBc_status" value="0" <?php echo $schedule_status == "0" ? 'checked' : ''; ?>>
349
+ <?php _e('Inactive','advanced-database-cleaner');?>
350
+ </div>
351
+
352
+ <div style="width:100%;margin-top:20px">
353
+ <input class="button-primary" type="submit" value="<?php _e('Save the schedule','advanced-database-cleaner'); ?>" style="width:100%;"/>
354
+ </div>
355
+
356
+ </div>
357
+
358
+ </div>
359
+ </div>
360
+
361
+ <?php wp_nonce_field('edit_cleanup_schedule_nonce', 'edit_cleanup_schedule_nonce'); ?>
362
+
363
+ </form>
364
+ <div class="aDBc-clear-both"></div>
365
+ </div>
366
+
367
+ <?php
368
+ }
369
+ }
370
+
371
+ ?>
includes/custom-schedule-view/class_edit_optimize_schedule.php ADDED
@@ -0,0 +1,257 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class EDIT_SCHEDULE_OPTIMIZE extends WP_List_Table {
3
+
4
+ private $aDBc_message = "";
5
+ private $aDBc_class_message = "updated";
6
+
7
+ /**
8
+ * Constructor
9
+ */
10
+ function __construct(){
11
+
12
+ $this->aDBc_prepare_elements_to_clean();
13
+ $this->aDBc_print_page_content();
14
+ }
15
+
16
+ /** Prepare elements to display */
17
+ function aDBc_prepare_elements_to_clean(){
18
+
19
+ // Test if user wants to save the edited scheduled task
20
+ if(isset($_POST['aDBc_schedule_name'])){
21
+
22
+ //Quick nonce security check!
23
+ if(!check_admin_referer('edit_optimize_schedule_nonce', 'edit_optimize_schedule_nonce'))
24
+ return; //get out if we didn't click the save_schedule button
25
+
26
+ if(!empty(trim($_POST['aDBc_schedule_name']))){
27
+ if(preg_match('/^[a-zA-Z0-9_]+$/',$_POST['aDBc_schedule_name'])){
28
+
29
+ // Test if the name is used by other schedules.
30
+ $clean_schedule_setting = get_option('aDBc_clean_schedule');
31
+ $clean_schedule_setting = is_array($clean_schedule_setting) ? $clean_schedule_setting : array();
32
+
33
+ $optimize_schedule_setting = get_option('aDBc_optimize_schedule');
34
+ $optimize_schedule_setting = is_array($optimize_schedule_setting) ? $optimize_schedule_setting : array();
35
+
36
+ if($_POST['aDBc_schedule_name'] == $_GET['hook_name'] ||
37
+ ($_POST['aDBc_schedule_name'] != $_GET['hook_name'] &&
38
+ !array_key_exists($_POST['aDBc_schedule_name'], $clean_schedule_setting) &&
39
+ !array_key_exists($_POST['aDBc_schedule_name'], $optimize_schedule_setting))){
40
+
41
+ if(!empty($_POST['aDBc_date'])){
42
+ if(!empty($_POST['aDBc_time'])){
43
+
44
+ if(!empty($_POST['aDBc_operation1']) || !empty($_POST['aDBc_operation2'])){
45
+
46
+ // Delete the old schedule and replace it with the new
47
+
48
+ // We will create the new schedule
49
+ $new_schedule_params['repeat'] = $_POST['aDBc_schedule_repeat'];
50
+ $new_schedule_params['start_date'] = $_POST['aDBc_date'];
51
+ $new_schedule_params['start_time'] = $_POST['aDBc_time'];
52
+
53
+ // Prepare operations to perform
54
+ $operations = array();
55
+ if(!empty($_POST['aDBc_operation1']))
56
+ array_push($operations, $_POST['aDBc_operation1']);
57
+ if(!empty($_POST['aDBc_operation2']))
58
+ array_push($operations, $_POST['aDBc_operation2']);
59
+ $new_schedule_params['operations'] = $operations;
60
+
61
+ $new_schedule_params['active'] = $_POST['aDBc_status'];
62
+ $optimize_schedule_setting[$_POST['aDBc_schedule_name']] = $new_schedule_params;
63
+ update_option('aDBc_optimize_schedule', $optimize_schedule_setting, "no");
64
+
65
+ list($year, $month, $day) = explode('-', $_POST['aDBc_date']);
66
+ list($hours, $minutes) = explode(':', $_POST['aDBc_time']);
67
+ $seconds = "0";
68
+ $timestamp = mktime($hours, $minutes, $seconds, $month, $day, $year);
69
+
70
+ // Clear scheduled event
71
+ wp_clear_scheduled_hook('aDBc_optimize_scheduler', array($_POST['aDBc_schedule_name'].''));
72
+
73
+ if($_POST['aDBc_status'] == "1"){
74
+ if($_POST['aDBc_schedule_repeat'] == "once"){
75
+ wp_schedule_single_event($timestamp, "aDBc_optimize_scheduler", array($_POST['aDBc_schedule_name']));
76
+ }else{
77
+ wp_schedule_event($timestamp, $_POST['aDBc_schedule_repeat'], "aDBc_optimize_scheduler", array($_POST['aDBc_schedule_name']));
78
+ }
79
+ $this->aDBc_message = __('The clean-up schedule saved successfully!', 'advanced-database-cleaner');
80
+ }else{
81
+ $this->aDBc_message = __('The clean-up schedule saved successfully but it is inactive!', 'advanced-database-cleaner');
82
+ }
83
+
84
+ }else{
85
+ $this->aDBc_class_message = "error";
86
+ $this->aDBc_message = __('Please choose at least one operation to perform!', 'advanced-database-cleaner');
87
+ }
88
+ }else{
89
+ $this->aDBc_class_message = "error";
90
+ $this->aDBc_message = __('Please specify a valide time!', 'advanced-database-cleaner');
91
+ }
92
+ }else{
93
+ $this->aDBc_class_message = "error";
94
+ $this->aDBc_message = __('Please specify a valide date!', 'advanced-database-cleaner');
95
+ }
96
+ }else{
97
+ $this->aDBc_class_message = "error";
98
+ $this->aDBc_message = __('The name you have specified is already used by another schedule! Please change it!', 'advanced-database-cleaner');
99
+ }
100
+ }else{
101
+ $this->aDBc_class_message = "error";
102
+ $this->aDBc_message = __('Please change the name! Only letters, numbers and underscores are allowed!', 'advanced-database-cleaner');
103
+ }
104
+ }else{
105
+ $this->aDBc_class_message = "error";
106
+ $this->aDBc_message = __('Please give a name to your schedule!', 'advanced-database-cleaner');
107
+ }
108
+ }
109
+ // yyy should this $wpdb be cleaned ?
110
+ global $wpdb;
111
+
112
+ }
113
+
114
+ /** Print the page content */
115
+ function aDBc_print_page_content(){
116
+ // Print a message if any
117
+ if($this->aDBc_message != ""){
118
+ echo '<div id="aDBc_message" class="' . $this->aDBc_class_message . ' notice is-dismissible"><p>' . $this->aDBc_message . '</p></div>';
119
+ }
120
+ ?>
121
+ <div style="width:636px">
122
+
123
+ <div>
124
+ <div class="aDBc-float-left aDBc-margin-t-10">
125
+ <a href="?page=advanced_db_cleaner&aDBc_tab=tables&aDBc_cat=all">
126
+ <img width="40px" src="<?php echo ADBC_PLUGIN_DIR_PATH . '/images/go_back.svg'?>"/>
127
+ </a>
128
+ </div>
129
+ <div class="aDBc-float-right" style="border:1px solid #f0f0f0;box-shadow:0 0 10px #eee;border-radius:5px;text-align:center;width:190px;background:#fff;padding:10px;font-size:16px;margin-top: 15px;margin-bottom: 25px;color: #0992CC;">
130
+ <img style="margin-right:10px" width="15px" src="<?php echo ADBC_PLUGIN_DIR_PATH . '/images/edit_schedule.svg'?>"/>
131
+ <?php echo __('Edit cleanup schedule','advanced-database-cleaner') ; ?>
132
+ </div>
133
+ </div>
134
+
135
+ <div class="aDBc-clear-both"></div>
136
+ <form id="aDBc_form" action="" method="post">
137
+ <div style="float:left;width:400px;margin-right: 25px;background:#f0f5fa;margin-top:49px;padding-top:50px;height:100px;text-align:center;border-radius:4px;border:1px solid #eee">
138
+ <?php echo __('By default, all your database tables will be optimized (if needed) according to your schedule settings','advanced-database-cleaner') ; ?>
139
+ </div>
140
+
141
+ <?php
142
+ // Prepare info of the original schedule to fill it into inputs...
143
+
144
+ if(isset($_POST['aDBc_schedule_name'])){
145
+
146
+ $hook_name = $_POST['aDBc_schedule_name'];
147
+ $schedule_repeat = $_POST['aDBc_schedule_repeat'];
148
+ $schedule_date = $_POST['aDBc_date'];
149
+ $schedule_time = $_POST['aDBc_time'];
150
+ $operation1 = $_POST['aDBc_operation1'];
151
+ $operation2 = $_POST['aDBc_operation2'];
152
+ $schedule_status = $_POST['aDBc_status'];
153
+
154
+ }else{
155
+
156
+ $schedule_settings = get_option('aDBc_optimize_schedule');
157
+ $schedule_params = $schedule_settings[$_GET['hook_name']];
158
+
159
+ $hook_name = $_GET['hook_name'];
160
+ $schedule_repeat = $schedule_params['repeat'];
161
+ $timestamp = wp_next_scheduled("aDBc_optimize_scheduler", array($_GET['hook_name'] . ''));
162
+ if($timestamp){
163
+ $schedule_date = date("Y-m-d", $timestamp);
164
+ $schedule_time = date("H:i", $timestamp);
165
+ }else{
166
+ $schedule_date = date("Y-m-d");
167
+ $schedule_time = date("H:i", time());
168
+ }
169
+
170
+ $operation1 = in_array('optimize', $schedule_params['operations']) ? 'optimize' : '';
171
+ $operation2 = in_array('repair', $schedule_params['operations']) ? 'repair' : '';
172
+
173
+ $schedule_status = $schedule_params['active'];
174
+ }
175
+
176
+ ?>
177
+
178
+ <div class="aDBc-right-box">
179
+
180
+ <div style="text-align:center">
181
+
182
+ <img width="60px" src="<?php echo ADBC_PLUGIN_DIR_PATH . '/images/alarm-clock.svg'?>"/>
183
+ <br/><br/>
184
+
185
+ <div id="add_schedule" style="border-top:1px dashed #ccc">
186
+ <br/>
187
+ <div style="text-align:left"><?php _e('Schedule name','advanced-database-cleaner');?></div>
188
+ <input style="width:100%;margin-bottom:10px;height:30px;border-radius:5px;box-shadow:0 0 10px #e0e0e0;background-color: #ccc !important;color: #000 !important;" type="text" name="aDBc_schedule_name_x" placeholder="Schedule name" value="<?php echo $hook_name; ?>" maxlength="25" disabled>
189
+ <input type="hidden" name="aDBc_schedule_name" value="<?php echo $hook_name; ?>" maxlength="25">
190
+
191
+ <div style="text-align:left"><?php _e('Frequency of execution','advanced-database-cleaner');?></div>
192
+ <select style="width:100%;margin-bottom:10px;height:30px;border-radius:5px;box-shadow:0 0 10px #e0e0e0" class="aDBc-schedule-select" name="aDBc_schedule_repeat">
193
+ <?php
194
+ $schedules_repeat = array('once' => __('Once','advanced-database-cleaner'),
195
+ 'hourly' => __('Hourly','advanced-database-cleaner'),
196
+ 'twicedaily' => __('Twice a day','advanced-database-cleaner'),
197
+ 'daily' => __('Daily','advanced-database-cleaner'),
198
+ 'weekly' => __('Weekly','advanced-database-cleaner'),
199
+ 'monthly' => __('Monthly','advanced-database-cleaner'));
200
+
201
+ foreach($schedules_repeat as $code_repeat => $name_repeat){
202
+ if($code_repeat == $schedule_repeat){
203
+ echo "<option value='$code_repeat' selected='selected'>$name_repeat</option>";
204
+ }else{
205
+ echo "<option value='$code_repeat'>$name_repeat</option>";
206
+ }
207
+ }
208
+ ?>
209
+ </select>
210
+
211
+ <div style="text-align:left"><?php _e('Start date','advanced-database-cleaner');?></div>
212
+ <input style="width:100%;margin-bottom:10px;height:30px;border-radius:5px;box-shadow:0 0 10px #e0e0e0" type="date" name="aDBc_date" placeholder="" value="<?php echo $schedule_date; ?>" min="<?php echo date("Y-m-d"); ?>">
213
+
214
+ <div style="text-align:left"><?php _e('Start time (GMT)','advanced-database-cleaner');?></div>
215
+ <input style="width:100%;margin-bottom:10px;height:30px;border-radius:5px;box-shadow:0 0 10px #e0e0e0" type="time" name="aDBc_time" value="<?php echo $schedule_time; ?>">
216
+
217
+ <div style="text-align:left"><?php _e('Perform operations','advanced-database-cleaner');?></div>
218
+ <div style="margin-bottom:10px;margin-top:2px;text-align:left;background:#fff;padding:5px;box-shadow:0 0 10px #e0e0e0;border-radius:5px">
219
+ <input type="checkbox" name="aDBc_operation1" value="optimize" <?php echo $operation1 == "optimize" ? 'checked' : ''; ?>>
220
+ <span style="margin-right:20px"><?php _e('Optimize','advanced-database-cleaner');?></span>
221
+
222
+ <input type="checkbox" name="aDBc_operation2" value="repair" <?php echo $operation2 == "repair" ? 'checked' : ''; ?>>
223
+ <?php _e('Repair','advanced-database-cleaner');?>
224
+ </div>
225
+
226
+ <div style="text-align:left"><?php _e('Schedule status','advanced-database-cleaner');?></div>
227
+
228
+ <div style="margin-top:2px;text-align:left;background:#fff;padding:5px;box-shadow:0 0 10px #e0e0e0;border-radius:5px">
229
+ <input type="radio" name="aDBc_status" value="1" checked>
230
+ <span style="margin-right:20px"><?php _e('Active','advanced-database-cleaner');?></span>
231
+
232
+ <input type="radio" name="aDBc_status" value="0" <?php echo $schedule_status == "0" ? 'checked' : ''; ?>>
233
+ <?php _e('Inactive','advanced-database-cleaner');?>
234
+ </div>
235
+
236
+ <div style="width:100%;margin-top:20px">
237
+ <input class="button-primary" type="submit" value="<?php _e('Save the schedule','advanced-database-cleaner'); ?>" style="width:100%;"/>
238
+ </div>
239
+
240
+
241
+
242
+ </div>
243
+
244
+ </div>
245
+ </div>
246
+
247
+ <?php wp_nonce_field('edit_optimize_schedule_nonce', 'edit_optimize_schedule_nonce'); ?>
248
+
249
+ </form>
250
+ <div class="aDBc-clear-both"></div>
251
+ </div>
252
+
253
+ <?php
254
+ }
255
+ }
256
+
257
+ ?>
includes/functions.php CHANGED
@@ -1,4 +1,81 @@
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;
@@ -16,29 +93,42 @@ function aDBc_clean_all_elements_type($type){
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;
@@ -48,63 +138,225 @@ function aDBc_clean_elements_type($type){
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){
@@ -120,28 +372,133 @@ function aDBc_count_all_elements_to_clean(){
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
  /***********************************************************************************
@@ -151,83 +508,254 @@ function aDBc_optimize_tables(){
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
  /***********************************************************************************
@@ -254,20 +782,22 @@ function aDBc_get_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
 
@@ -279,14 +809,16 @@ function aDBc_add_options(&$aDBc_all_options, $blog_id) {
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
@@ -305,17 +837,28 @@ function aDBc_get_all_tables() {
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){
@@ -324,7 +867,7 @@ function aDBc_get_all_tables() {
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 = "";
@@ -334,19 +877,20 @@ function aDBc_get_all_tables() {
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;
@@ -390,19 +934,366 @@ function aDBc_add_scheduled_tasks(&$aDBc_all_tasks, $blog_id) {
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
  ?>
1
  <?php
2
+ /** If we are in MU, define the main blog ID. This will be usefull to call get_option correctly when we switch between blogs */
3
+ /** Used mainly in aDBc_get_keep_last_sql_arg() */
4
+ if(function_exists('is_multisite') && is_multisite()){
5
+ if(!defined("ADBC_MAIN_SITE_ID")) define("ADBC_MAIN_SITE_ID", get_current_blog_id());
6
+ }
7
+
8
+ /** Reduces the value of the string in parameter according to max lenght then create a tooltip for it */
9
+ function aDBc_create_tooltip_for_long_string($string_value, $max_characters){
10
+ $new_name = esc_html($string_value);
11
+ if(strlen($new_name) > $max_characters){
12
+ $new_name = trim(substr($new_name, 0, $max_characters));
13
+ $new_name = $new_name . " <span class='aDBc-tooltips'>" . "..." . "<span>" . esc_html($string_value) . "</span></span>";
14
+ }
15
+ return $new_name;
16
+ }
17
+
18
+ /** Reduces the value of the string in parameter according to max lenght then create a tooltip for it */
19
+ function aDBc_create_tooltip_by_replace($string_value, $max_characters, $tooltip_content){
20
+ $new_name = $string_value;
21
+ if(strlen($new_name) > $max_characters){
22
+ $new_name = substr($new_name, 0, $max_characters) . " ...";
23
+ }
24
+ $new_name = "<span class='aDBc-tooltips'>" . esc_html($new_name) . "<span>" . esc_html($tooltip_content) . "</span></span>";
25
+ return $new_name;
26
+ }
27
+
28
+ /** Reduces the value of the option value according to max lenght then create a tooltip for it */
29
+ function aDBc_create_tooltip_for_option_value($string_value, $max_characters){
30
+
31
+ $option_content = maybe_unserialize($string_value);
32
+ if(is_array($option_content)){
33
+ $new_name = "<i>Array</i>" . " <span class='aDBc-tooltips'>" . "..." . "<span>" . esc_html($string_value) . "</span></span>";
34
+ }else if(gettype($option_content) == 'object'){
35
+ $new_name = "<i>Object</i>" . " <span class='aDBc-tooltips'>" . "..." . "<span>" . esc_html($string_value) . "</span></span>";
36
+ }else{
37
+ $new_name = esc_html($string_value);
38
+ if(strlen($new_name) > $max_characters){
39
+ $new_name = trim(substr($new_name, 0, $max_characters));
40
+ $new_name = $new_name . " <span class='aDBc-tooltips'>" . "..." . "<span>" . esc_html($string_value) . "</span></span>";
41
+ }
42
+ }
43
+ return $new_name;
44
+ }
45
+
46
+ function aDBc_get_order_by_sql_arg($default_order_by){
47
+
48
+ // Prepare ORDER BY and ORDER
49
+ $order_by = " ORDER BY " . $default_order_by . " ASC";
50
+ if(!empty($_GET['orderby'])){
51
+ $order_by = " ORDER BY " . esc_sql($_GET['orderby']);
52
+ $order_by .= empty($_GET['order']) ? " ASC" : " " . esc_sql($_GET['order']);
53
+ }
54
+
55
+ return $order_by;
56
+ }
57
+
58
+ function aDBc_get_limit_offset_sql_args(){
59
+
60
+ // Identify current page for WP_List_Table
61
+ $page_number = 1;
62
+ if(!empty($_GET['paged'])){
63
+ $page_number = absint($_GET['paged']);
64
+ }
65
+
66
+ // Identify items per page to display
67
+ $per_page = 50;
68
+ if(!empty($_GET['per_page'])){
69
+ $per_page = absint($_GET['per_page']);
70
+ }
71
+
72
+ // Prepare LIMIT and OFFSET
73
+ $offset = ($page_number - 1) * $per_page;
74
+ $limit_offset = " LIMIT $offset,$per_page";
75
+
76
+ return $limit_offset;
77
+ }
78
+
79
  /** Cleans all elements in the current site and in MU according to the selected type */
80
  function aDBc_clean_all_elements_type($type){
81
  global $wpdb;
93
 
94
  /** Cleans all elements in the current site according to the selected type */
95
  function aDBc_clean_elements_type($type){
96
+
97
  global $wpdb;
98
+
99
  switch($type){
100
  case "revision":
101
+ $revision_date = aDBc_get_keep_last_sql_arg('revision','post_modified');
102
+ $wpdb->query("DELETE FROM $wpdb->posts WHERE post_type = 'revision'" . $revision_date);
 
 
103
  break;
104
  case "auto-draft":
105
+ $auto_draft_date = aDBc_get_keep_last_sql_arg('auto-draft','post_modified');
106
+ $wpdb->query("DELETE FROM $wpdb->posts WHERE post_status = 'auto-draft'" . $auto_draft_date);
107
  break;
108
  case "trash-posts":
109
+ $trash_post_date = aDBc_get_keep_last_sql_arg('trash-posts','post_modified');
110
+ $wpdb->query("DELETE FROM $wpdb->posts WHERE post_status = 'trash'" . $trash_post_date);
111
  break;
112
  case "moderated-comments":
113
+ $moderated_comment_date = aDBc_get_keep_last_sql_arg('moderated-comments','comment_date');
114
+ $wpdb->query("DELETE FROM $wpdb->comments WHERE comment_approved = '0'" . $moderated_comment_date);
115
  break;
116
  case "spam-comments":
117
+ $spam_comment_date = aDBc_get_keep_last_sql_arg('spam-comments','comment_date');
118
+ $wpdb->query("DELETE FROM $wpdb->comments WHERE comment_approved = 'spam'" . $spam_comment_date);
119
  break;
120
  case "trash-comments":
121
+ $trash_comment_date = aDBc_get_keep_last_sql_arg('trash-comments','comment_date');
122
+ $wpdb->query("DELETE FROM $wpdb->comments WHERE comment_approved = 'trash'" . $trash_comment_date);
123
+ break;
124
+ case "pingbacks":
125
+ $pingback_date = aDBc_get_keep_last_sql_arg('pingbacks','comment_date');
126
+ $wpdb->query("DELETE FROM $wpdb->comments WHERE comment_type = 'pingback'" . $pingback_date);
127
  break;
128
+ case "trackbacks":
129
+ $trackback_date = aDBc_get_keep_last_sql_arg('trackbacks','comment_date');
130
+ $wpdb->query("DELETE FROM $wpdb->comments WHERE comment_type = 'trackback'" . $trackback_date);
131
+ break;
132
  case "orphan-postmeta":
133
  $wpdb->query("DELETE pm FROM $wpdb->postmeta pm LEFT JOIN $wpdb->posts wp ON wp.ID = pm.post_id WHERE wp.ID IS NULL");
134
  break;
138
  case "orphan-relationships":
139
  $wpdb->query("DELETE FROM $wpdb->term_relationships WHERE term_taxonomy_id=1 AND object_id NOT IN (SELECT id FROM $wpdb->posts)");
140
  break;
141
+ case "orphan-usermeta":
142
+ $wpdb->query("DELETE FROM $wpdb->usermeta WHERE user_id NOT IN (SELECT ID FROM $wpdb->users)");
143
  break;
144
+ case "orphan-termmeta":
145
+ $wpdb->query("DELETE FROM $wpdb->termmeta WHERE term_id NOT IN (SELECT term_id FROM $wpdb->terms)");
146
+ break;
147
+ case "expired-transients":
148
+ $type_arg = " AND b.option_value < UNIX_TIMESTAMP()";
149
+ aDBc_clean_all_transients($type_arg);
150
+ break;
151
+ //case "transients-with-expiration":
152
+ // $type_arg = " AND b.option_value > UNIX_TIMESTAMP()";
153
+ // aDBc_clean_all_transients($type_arg);
154
+ // break;
155
+ //case "transients-with-no-expiration":
156
+ // $type_arg = " AND b.option_value is NULL";
157
+ // aDBc_clean_all_transients($type_arg);
158
+ // break;
159
  }
160
  }
161
 
162
+ /** Cleans transients based on the type specified in parameter */
163
+ function aDBc_clean_all_transients($type_arg){
164
+
165
  global $wpdb;
166
+
167
+ $aDBc_transients = $wpdb->get_results("SELECT a.option_name, b.option_value FROM $wpdb->options a LEFT JOIN $wpdb->options b ON b.option_name =
168
+ CONCAT(
169
+ CASE WHEN a.option_name LIKE '_site_transient_%'
170
+ THEN '_site_transient_timeout_'
171
+ ELSE '_transient_timeout_'
172
+ END
173
+ ,
174
+ SUBSTRING(a.option_name, CHAR_LENGTH(
175
+ CASE WHEN a.option_name LIKE '_site_transient_%'
176
+ THEN '_site_transient_'
177
+ ELSE '_transient_'
178
+ END
179
+ ) + 1)
180
+ )
181
+ WHERE (a.option_name LIKE '_transient_%' OR a.option_name LIKE '_site_transient_%') AND a.option_name NOT LIKE '%_transient_timeout_%'" . $type_arg);
182
+
183
+ foreach($aDBc_transients as $transient){
184
+ $site_wide = (strpos($transient->option_name, '_site_transient') !== false);
185
+ $name = str_replace($site_wide ? '_site_transient_' : '_transient_', '', $transient->option_name);
186
+ if(false !== $site_wide){
187
+ delete_site_transient($name);
188
+ }else{
189
+ delete_transient($name);
190
  }
 
 
191
  }
192
  }
193
 
194
+ /** Cleans scheduled elements in the current site and in MU (used by the scheduler) */
195
+ function aDBc_clean_scheduled_elements($schedule_name){
196
+
197
  global $wpdb;
198
+
199
+ $schedule_settings = get_option('aDBc_clean_schedule');
200
+
201
+ if(is_array($schedule_settings) && array_key_exists($schedule_name, $schedule_settings)){
202
+
203
+ $schedule_params = $schedule_settings[$schedule_name];
204
+ $elements_to_clean = $schedule_params['elements_to_clean'];
205
+
206
+ if(function_exists('is_multisite') && is_multisite()){
207
+ $blogs_ids = $wpdb->get_col("SELECT blog_id FROM $wpdb->blogs");
208
+ foreach($blogs_ids as $blog_id){
209
+ switch_to_blog($blog_id);
210
+ foreach($elements_to_clean as $type){
211
+ aDBc_clean_elements_type($type);
212
+ }
213
+ restore_current_blog();
214
+ }
215
+ }else{
216
+ foreach($elements_to_clean as $type){
217
+ aDBc_clean_elements_type($type);
218
+ }
219
+ }
220
+
221
+ // After clean up, verify if the caller is a "ONCE" schedule, if so, change its settings in DB to inactive...
222
+ if($schedule_params['repeat'] == "once"){
223
+ $schedule_params['active'] = "0";
224
+ $schedule_settings[$schedule_name] = $schedule_params;
225
+ update_option('aDBc_clean_schedule', $schedule_settings, "no");
226
+ }
227
+ }
228
  }
229
 
230
+ /** Optimizes/repairs all tables having lost space or that should be repaired (used by the scheduler) */
231
+ function aDBc_optimize_scheduled_tables($schedule_name){
232
+
233
+ global $wpdb;
234
+
235
+ $schedule_settings = get_option('aDBc_optimize_schedule');
236
+
237
+ if(is_array($schedule_settings) && array_key_exists($schedule_name, $schedule_settings)){
238
+
239
+ $schedule_params = $schedule_settings[$schedule_name];
240
+ $operations = $schedule_params['operations'];
241
+
242
+ // Perform optimize operation
243
+ if(in_array("optimize", $operations)){
244
+ $result = $wpdb->get_results("SELECT table_name FROM information_schema.tables WHERE table_schema = '" . DB_NAME ."' and Engine <> 'InnoDB' and data_free > 0");
245
+ foreach($result as $table){
246
+
247
+ // Get table name
248
+ $table_name = "";
249
+ // This test to prevent issues in MySQL 8 where tables are not shown
250
+ // MySQL 5 uses $table->table_name while MySQL 8 uses $table->TABLE_NAME
251
+ if(array_key_exists("table_name", $table)){
252
+ $table_name = $table->table_name;
253
+ }else if(array_key_exists("TABLE_NAME", $table)){
254
+ $table_name = $table->TABLE_NAME;
255
+ }
256
+
257
+ $wpdb->query("OPTIMIZE TABLE " . $table_name);
258
+ }
259
+ }
260
+
261
+ // Perfom repair operation
262
+ if(in_array("repair", $operations)){
263
+ $result = $wpdb->get_results("SELECT table_name FROM information_schema.tables WHERE table_schema = '" . DB_NAME ."' and Engine IN ('CSV', 'MyISAM', 'ARCHIVE')");
264
+ foreach($result as $table){
265
+
266
+ // Get table name
267
+ $table_name = "";
268
+ // This test to prevent issues in MySQL 8 where tables are not shown
269
+ // MySQL 5 uses $table->table_name while MySQL 8 uses $table->TABLE_NAME
270
+ if(array_key_exists("table_name", $table)){
271
+ $table_name = $table->table_name;
272
+ }else if(array_key_exists("TABLE_NAME", $table)){
273
+ $table_name = $table->TABLE_NAME;
274
+ }
275
+
276
+ $query_result = $wpdb->get_results("CHECK TABLE " . $table_name);
277
+ foreach($query_result as $row){
278
+ if($row->Msg_type == 'error'){
279
+ if(preg_match('/corrupt/i', $row->Msg_text)){
280
+ $wpdb->query("REPAIR TABLE " . $table_name);
281
+ }
282
+ }
283
+ }
284
+ }
285
+ }
286
+
287
+ // After optimization/repair, verify if the caller is a "ONCE" schedule, if so, change its settings in DB to inactive...
288
+ if($schedule_params['repeat'] == "once"){
289
+ $schedule_params['active'] = "0";
290
+ $schedule_settings[$schedule_name] = $schedule_params;
291
+ update_option('aDBc_optimize_schedule', $schedule_settings, "no");
292
+ }
293
+ }
294
+ }
295
+
296
+ /** Returns an array containing all elements in general cleanup tab with their names used in the code */
297
+ function aDBc_return_array_all_elements_to_clean(){
298
+
299
+ $aDBc_unused["revision"]['name'] = __('Revisions','advanced-database-cleaner');
300
+ $aDBc_unused["revision"]['URL_blog'] = "https://sigmaplugin.com/blog/what-are-wordpress-revisions-and-how-to-clean-them";
301
+ $aDBc_unused["auto-draft"]['name'] = __('Auto drafts','advanced-database-cleaner');
302
+ $aDBc_unused["auto-draft"]['URL_blog'] = "https://sigmaplugin.com/blog/what-are-wordpress-auto-drafts-and-how-to-clean-them";
303
+ $aDBc_unused["trash-posts"]['name'] = __('Trashed posts','advanced-database-cleaner');
304
+ $aDBc_unused["trash-posts"]['URL_blog'] = "https://sigmaplugin.com/blog/what-are-wordpress-trash-posts-and-how-to-clean-them";
305
+
306
+ $aDBc_unused["moderated-comments"]['name'] = __('Pending comments','advanced-database-cleaner');
307
+ $aDBc_unused["moderated-comments"]['URL_blog'] = "https://sigmaplugin.com/blog/what-are-wordpress-pending-comments-and-how-to-clean-them";
308
+ $aDBc_unused["spam-comments"]['name'] = __('Spam comments','advanced-database-cleaner');
309
+ $aDBc_unused["spam-comments"]['URL_blog'] = "https://sigmaplugin.com/blog/what-are-wordpress-spam-comments-and-how-to-clean-them";
310
+ $aDBc_unused["trash-comments"]['name'] = __('Trashed comments','advanced-database-cleaner');
311
+ $aDBc_unused["trash-comments"]['URL_blog'] = "https://sigmaplugin.com/blog/what-are-wordpress-trash-comments-and-how-to-clean-them";
312
+
313
+ $aDBc_unused["pingbacks"]['name'] = __('Pingbacks','advanced-database-cleaner');
314
+ $aDBc_unused["pingbacks"]['URL_blog'] = "https://sigmaplugin.com/blog/what-are-wordpress-pingbacks-and-how-to-clean-them";
315
+ $aDBc_unused["trackbacks"]['name'] = __('Trackbacks','advanced-database-cleaner');
316
+ $aDBc_unused["trackbacks"]['URL_blog'] = "https://sigmaplugin.com/blog/what-are-wordpress-trackbacks-and-how-to-clean-them";
317
+
318
+ $aDBc_unused["orphan-postmeta"]['name'] = __('Orphaned post meta','advanced-database-cleaner');
319
+ $aDBc_unused["orphan-postmeta"]['URL_blog'] = "https://sigmaplugin.com/blog/what-are-wordpress-orphan-posts-meta-and-how-to-clean-them";
320
+ $aDBc_unused["orphan-commentmeta"]['name'] = __('Orphaned comment meta','advanced-database-cleaner');
321
+ $aDBc_unused["orphan-commentmeta"]['URL_blog'] = "https://sigmaplugin.com/blog/what-are-wordpress-orphan-comments-meta-and-how-to-clean-them";
322
+ $aDBc_unused["orphan-usermeta"]['name'] = __('Orphaned user meta','advanced-database-cleaner');
323
+ $aDBc_unused["orphan-usermeta"]['URL_blog'] = "https://sigmaplugin.com/blog/what-are-wordpress-orphaned-user-meta-and-how-to-clean-them";
324
+ $aDBc_unused["orphan-termmeta"]['name'] = __('Orphaned term meta','advanced-database-cleaner');
325
+ $aDBc_unused["orphan-termmeta"]['URL_blog'] = "https://sigmaplugin.com/blog/what-are-wordpress-orphaned-term-meta-and-how-to-clean-them";
326
+
327
+ $aDBc_unused["orphan-relationships"]['name'] = __('Orphaned relationships','advanced-database-cleaner');
328
+ $aDBc_unused["orphan-relationships"]['URL_blog'] = "https://sigmaplugin.com/blog/what-are-wordpress-orphan-relationships-and-how-to-clean-them";
329
+
330
+ $aDBc_unused["expired-transients"]['name'] = __("Expired transients","advanced-database-cleaner");
331
+ $aDBc_unused["expired-transients"]['URL_blog'] = "https://sigmaplugin.com/blog/what-are-wordpress-transients";
332
+
333
+
334
+ /*$aDBc_transient_toolip = "<span class='aDBc-tooltips-headers'>
335
+ <img style='width:12px' class='aDBc-info-image' src='". ADBC_PLUGIN_DIR_PATH . '/images/information2.svg' . "'/>
336
+ <span>" . __('Do not clean these items unless you know what you are doing!','advanced-database-cleaner') ." </span>
337
+ </span>";
338
+
339
+ $aDBc_unused["transients-with-expiration"]['name'] = __("Transients with an expiration","advanced-database-cleaner") . "<br><span class='aDBc-caution'>" . __("Use with caution!","advanced-database-cleaner") . "</span>" . $aDBc_transient_toolip;
340
+ $aDBc_unused["transients-with-expiration"]['URL_blog'] = "https://sigmaplugin.com/blog/what-are-wordpress-transients";
341
+
342
+ $aDBc_unused["transients-with-no-expiration"]['name'] = __("Transients with no expiration","advanced-database-cleaner") . "<br><span class='aDBc-caution'>" . __("Use with caution!","advanced-database-cleaner") . "</span>" . $aDBc_transient_toolip;
343
+ $aDBc_unused["transients-with-no-expiration"]['URL_blog'] = "https://sigmaplugin.com/blog/what-are-wordpress-transients";*/
344
+
345
+ return $aDBc_unused;
346
+
347
+ }
348
 
349
  /** Counts all elements to clean (in the current site or MU) */
350
  function aDBc_count_all_elements_to_clean(){
351
  global $wpdb;
352
+ $aDBc_unused = aDBc_return_array_all_elements_to_clean();
353
+
 
 
 
 
 
 
 
 
 
354
  // Initialize counts to 0
355
  foreach($aDBc_unused as $aDBc_type => $element_info){
356
  $aDBc_unused[$aDBc_type]['count'] = 0;
357
  }
358
 
359
+ //(for the table usermeta, only one table exists for MU, do not witch over blogs for it)
360
  if(function_exists('is_multisite') && is_multisite()){
361
  $blogs_ids = $wpdb->get_col("SELECT blog_id FROM $wpdb->blogs");
362
  foreach($blogs_ids as $blog_id){
372
 
373
  /** Counts elements to clean in the current site */
374
  function aDBc_count_elements_to_clean(&$aDBc_unused){
375
+
376
  global $wpdb;
377
+
378
+ // Test if there are any keep_last options to count only elements with date < keep_lat to add it to the query
379
+ $revision_date = aDBc_get_keep_last_sql_arg('revision','post_modified');
380
+ $auto_draft_date = aDBc_get_keep_last_sql_arg('auto-draft','post_modified');
381
+ $trash_post_date = aDBc_get_keep_last_sql_arg('trash-posts','post_modified');
382
+ $moderated_comment_date = aDBc_get_keep_last_sql_arg('moderated-comments','comment_date');
383
+ $spam_comment_date = aDBc_get_keep_last_sql_arg('spam-comments','comment_date');
384
+ $trash_comment_date = aDBc_get_keep_last_sql_arg('trash-comments','comment_date');
385
+ $pingback_date = aDBc_get_keep_last_sql_arg('pingbacks','comment_date');
386
+ $trackback_date = aDBc_get_keep_last_sql_arg('trackbacks','comment_date');
387
+
388
+ // Execute count queries
389
+ $aDBc_unused["revision"]['count'] += $wpdb->get_var("SELECT COUNT(ID) FROM $wpdb->posts WHERE post_type = 'revision'" . $revision_date);
390
+ $aDBc_unused["auto-draft"]['count'] += $wpdb->get_var("SELECT COUNT(ID) FROM $wpdb->posts WHERE post_status = 'auto-draft'" . $auto_draft_date);
391
+ $aDBc_unused["trash-posts"]['count'] += $wpdb->get_var("SELECT COUNT(ID) FROM $wpdb->posts WHERE post_status = 'trash'" . $trash_post_date);
392
+
393
+ $aDBc_unused["moderated-comments"]['count'] += $wpdb->get_var("SELECT COUNT(comment_ID) FROM $wpdb->comments WHERE comment_approved = '0'" . $moderated_comment_date);
394
+ $aDBc_unused["spam-comments"]['count'] += $wpdb->get_var("SELECT COUNT(comment_ID) FROM $wpdb->comments WHERE comment_approved = 'spam'" . $spam_comment_date);
395
+ $aDBc_unused["trash-comments"]['count'] += $wpdb->get_var("SELECT COUNT(comment_ID) FROM $wpdb->comments WHERE comment_approved = 'trash'" . $trash_comment_date);
396
+ $aDBc_unused["pingbacks"]['count'] += $wpdb->get_var("SELECT COUNT(comment_ID) FROM $wpdb->comments WHERE comment_type = 'pingback'" . $pingback_date);
397
+ $aDBc_unused["trackbacks"]['count'] += $wpdb->get_var("SELECT COUNT(comment_ID) FROM $wpdb->comments WHERE comment_type = 'trackback'" . $trackback_date);
398
+
399
+ $aDBc_unused["orphan-postmeta"]['count'] += $wpdb->get_var("SELECT COUNT(meta_id) FROM $wpdb->postmeta pm LEFT JOIN $wpdb->posts wp ON wp.ID = pm.post_id WHERE wp.ID IS NULL");
400
+
401
+ $aDBc_unused["orphan-commentmeta"]['count'] += $wpdb->get_var("SELECT COUNT(meta_id) FROM $wpdb->commentmeta WHERE comment_id NOT IN (SELECT comment_id FROM $wpdb->comments)");
402
+
403
+ // for the table usermeta, only one table exists for MU, do not switch over blogs for it. Get count only in main site
404
+ if(is_main_site()){
405
+ $aDBc_unused["orphan-usermeta"]['count'] += $wpdb->get_var("SELECT COUNT(umeta_id) FROM $wpdb->usermeta WHERE user_id NOT IN (SELECT ID FROM $wpdb->users)");
406
+ }
407
+
408
+ $aDBc_unused["orphan-termmeta"]['count'] += $wpdb->get_var("SELECT COUNT(meta_id) FROM $wpdb->termmeta WHERE term_id NOT IN (SELECT term_id FROM $wpdb->terms)");
409
+
410
+ $aDBc_unused["orphan-relationships"]['count'] += $wpdb->get_var("SELECT COUNT(object_id) FROM $wpdb->term_relationships WHERE term_taxonomy_id=1 AND object_id NOT IN (SELECT ID FROM $wpdb->posts)");
411
+
412
+ // Section for transients
413
+ //$all_transients_names = $wpdb->get_col("SELECT option_name FROM $wpdb->options where (option_name LIKE '_transient_%' OR option_name LIKE '_site_transient_%') AND option_name NOT LIKE '_transient_timeout_%' AND option_name NOT LIKE '_site_transient_timeout_%'");
414
+
415
+ $expired_transient_names = $wpdb->get_col("SELECT REPLACE(option_name, '_timeout', '') FROM $wpdb->options where (option_name LIKE '_transient_timeout_%' OR option_name LIKE '_site_transient_timeout_%') AND option_value < UNIX_TIMESTAMP()");
416
+
417
+ //$transient_with_expiration_names = $wpdb->get_col("SELECT REPLACE(option_name, '_timeout', '') FROM $wpdb->options where option_value > UNIX_TIMESTAMP() AND (option_name LIKE '_transient_timeout_%' OR option_name LIKE '_site_transient_timeout_%')");
418
+
419
+ // Get transients with no expiration
420
+ //$transients_with_no_expiration = array_diff($all_transients_names, $expired_transient_names, $transient_with_expiration_names);
421
+
422
+ $aDBc_unused["expired-transients"]['count'] += count($expired_transient_names);
423
+ //$aDBc_unused["transients-with-expiration"]['count'] += count($transient_with_expiration_names);
424
+ //$aDBc_unused["transients-with-no-expiration"]['count'] += count($transients_with_no_expiration);
425
+ // End of transients section
426
+
427
  }
428
 
429
+ /** Prepare keep_last element if any **/
430
+ function aDBc_get_keep_last_sql_arg($element_type, $column_name){
431
+
432
+ // If we are in MU, we shoul call settings from the main site since here in are inside switch_blog and therefore calling get_option will lead to calling the current blog options
433
+ if(function_exists('is_multisite') && is_multisite()){
434
+ $settings = get_blog_option(ADBC_MAIN_SITE_ID, 'aDBc_settings');
435
+ }else{
436
+ $settings = get_option('aDBc_settings');
437
+ }
438
+ if(!empty($settings['keep_last'])){
439
+ $keep_setting = $settings['keep_last'];
440
+ if(!empty($keep_setting[$element_type]))
441
+ return " and $column_name < NOW() - INTERVAL " . $keep_setting[$element_type] . " DAY";
442
  }
443
+ return "";
444
+ }
445
+
446
+ /**************************************************************************************************
447
+ * This function filters the array containing results according to users args for the free versions.
448
+ * Mainly for tables to optimize and repair
449
+ **************************************************************************************************/
450
+ function aDBc_filter_results_in_all_items_array_free(&$aDBc_all_items, $aDBc_tables_name_to_optimize, $aDBc_tables_name_to_repair){
451
+
452
+ if(function_exists('is_multisite') && is_multisite()){
453
+
454
+ // Filter according to tables types (to optimize, to repair...)
455
+ if(!empty($_GET['t_type']) && $_GET['t_type'] != "all"){
456
+ $type = esc_sql($_GET['t_type']);
457
+ if($type == 'optimize'){
458
+ $array_names = $aDBc_tables_name_to_optimize;
459
+ }else{
460
+ $array_names = $aDBc_tables_name_to_repair;
461
+ }
462
+ foreach($aDBc_all_items as $item_name => $item_info){
463
+ foreach($item_info['sites'] as $site_id => $site_item_info){
464
+ if(!in_array($site_item_info['prefix'] . $item_name, $array_names)){
465
+ unset($aDBc_all_items[$item_name]['sites'][$site_id]);
466
+ }
467
+ }
468
+ }
469
+ }
470
+
471
+ }else{
472
+
473
+ // Prepare an array containing names of items to delete
474
+ $names_to_delete = array();
475
+
476
+ // Filter according to tables types (to optimize, to repair...)
477
+ $filter_on_t_type = !empty($_GET['t_type']) && $_GET['t_type'] != "all";
478
+ if($filter_on_t_type){
479
+ $type = esc_sql($_GET['t_type']);
480
+ if($type == "optimize"){
481
+ $array_names = $aDBc_tables_name_to_optimize;
482
+ }else{
483
+ $array_names = $aDBc_tables_name_to_repair;
484
+ }
485
+ }
486
+
487
+ foreach($aDBc_all_items as $item_name => $item_info){
488
+ if($filter_on_t_type){
489
+ if(!in_array($item_info['sites'][1]['prefix'] . $item_name, $array_names)){
490
+ array_push($names_to_delete, $item_name);
491
+ }
492
+ }
493
+ }
494
+
495
+ // Loop over the names to delete and delete them for the array
496
+ foreach($names_to_delete as $name){
497
+ unset($aDBc_all_items[$name]);
498
+ }
499
+
500
+ }
501
+
502
  }
503
 
504
  /***********************************************************************************
508
  ***********************************************************************************/
509
 
510
  /** Prepares items (options, tables or tasks) to display + message*/
511
+ function aDBc_prepare_items_to_display(
512
+ &$items_to_display,
513
+ &$aDBc_items_categories_info,
514
+ &$aDBc_which_button_to_show,
515
+ $aDBc_tables_name_to_optimize,
516
+ $aDBc_tables_name_to_repair,
517
+ &$array_belongs_to_counts,
518
+ &$aDBc_message,
519
+ &$aDBc_class_message,
520
+ $items_type){
521
 
522
  // Prepare categories info
523
  switch($items_type){
524
  case 'tasks' :
525
  $aDBc_all_items = aDBc_get_all_scheduled_tasks();
526
+ //$aDBc_saved_items = get_option("aDBc_tasks_status");
527
+ $aDBc_saved_items_file = @fopen(ADBC_UPLOAD_DIR_PATH_TO_ADBC . "/tasks.txt", "r");
528
  $aDBc_items_categories_info = array(
529
+ 'all' => array('name' => __('All', 'advanced-database-cleaner'), 'color' => '#4E515B', 'count' => 0),
530
+ 'u' => array('name' => __('Uncategorized', 'advanced-database-cleaner'), 'color' => 'grey', 'count' => 0),
531
+ 'o' => array('name' => __('Orphans','advanced-database-cleaner'), 'color' => '#E97F31', 'count' => 0),
532
+ 'p' => array('name' => __('Plugins tasks', 'advanced-database-cleaner'), 'color' => '#00BAFF', 'count' => 0),
533
+ 't' => array('name' => __('Themes tasks', 'advanced-database-cleaner'), 'color' => '#45C966', 'count' => 0),
534
+ 'w' => array('name' => __('WP tasks', 'advanced-database-cleaner'), 'color' => '#D091BE', 'count' => 0)
535
  );
536
  break;
537
  case 'options' :
538
  $aDBc_all_items = aDBc_get_all_options();
539
+ //$aDBc_saved_items = get_option("aDBc_options_status");
540
+ $aDBc_saved_items_file = @fopen(ADBC_UPLOAD_DIR_PATH_TO_ADBC . "/options.txt", "r");
541
  $aDBc_items_categories_info = array(
542
+ 'all' => array('name' => __('All', 'advanced-database-cleaner'), 'color' => '#4E515B', 'count' => 0),
543
+ 'u' => array('name' => __('Uncategorized', 'advanced-database-cleaner'), 'color' => 'grey', 'count' => 0),
544
+ 'o' => array('name' => __('Orphans','advanced-database-cleaner'), 'color' => '#E97F31', 'count' => 0),
545
+ 'p' => array('name' => __('Plugins options', 'advanced-database-cleaner'),'color' => '#00BAFF', 'count' => 0),
546
+ 't' => array('name' => __('Themes options', 'advanced-database-cleaner'), 'color' => '#45C966', 'count' => 0),
547
+ 'w' => array('name' => __('WP options', 'advanced-database-cleaner'), 'color' => '#D091BE', 'count' => 0)
548
  );
549
  break;
550
  case 'tables' :
551
  $aDBc_all_items = aDBc_get_all_tables();
552
+ //$aDBc_saved_items = get_option("aDBc_tables_status");
553
+ $aDBc_saved_items_file = @fopen(ADBC_UPLOAD_DIR_PATH_TO_ADBC . "/tables.txt", "r");
554
  $aDBc_items_categories_info = array(
555
+ 'all' => array('name' => __('All', 'advanced-database-cleaner'), 'color' => '#4E515B', 'count' => 0),
556
+ 'u' => array('name' => __('Uncategorized', 'advanced-database-cleaner'), 'color' => 'grey', 'count' => 0),
557
+ 'o' => array('name' => __('Orphans','advanced-database-cleaner'), 'color' => '#E97F31', 'count' => 0),
558
+ 'p' => array('name' => __('Plugins tables', 'advanced-database-cleaner'), 'color' => '#00BAFF', 'count' => 0),
559
+ 't' => array('name' => __('Themes tables', 'advanced-database-cleaner'), 'color' => '#45C966', 'count' => 0),
560
+ 'w' => array('name' => __('WP tables', 'advanced-database-cleaner'), 'color' => '#D091BE', 'count' => 0)
561
  );
562
  break;
563
  }
564
 
565
+ // Affect type and belongs_to to items.
566
+ if ($aDBc_saved_items_file) {
567
+ while(($item = fgets($aDBc_saved_items_file)) !== false) {
568
+ $columns = explode(":", trim($item));
569
+ // We replace +=+ by : because names that contain : have been transformed to +=+ to prevent problems with split based on :
570
+ $item_name = str_replace("+=+", ":", $columns[0]);
571
+ // Prevent adding an item that was cleaned (maybe by other plugins) but not updated in file
572
+ if(array_key_exists($item_name, $aDBc_all_items) && empty($aDBc_all_items[$item_name]['belongs_to'])) {
573
+
574
+ $aDBc_all_items[$item_name]['belongs_to'] = $columns[1];
575
+ $aDBc_all_items[$item_name]['type'] = $columns[2];
576
+
577
+ // Add this belongs_to to array for display in dropdown filter
578
+ $belongs_to_value = explode("(", $columns[1], 2);
579
+ $belongs_to_value = trim($belongs_to_value[0]);
580
+ $belongs_to_value = str_replace(" ", "-", $belongs_to_value);
581
+ if($items_type == "tasks"){
582
+ if(!array_key_exists($belongs_to_value, $array_belongs_to_counts)){
583
+ $array_belongs_to_counts[$belongs_to_value]['type'] = $columns[2];
584
+ foreach($aDBc_all_items[$item_name]['sites'] as $site => $info){
585
+ $array_belongs_to_counts[$belongs_to_value]['count'] = count($aDBc_all_items[$item_name]['sites'][$site]['args']);
586
+ }
587
+ }else{
588
+ foreach($aDBc_all_items[$item_name]['sites'] as $site => $info){
589
+ $array_belongs_to_counts[$belongs_to_value]['count'] += count($aDBc_all_items[$item_name]['sites'][$site]['args']);
590
+ }
591
+ }
592
+ }else{
593
+ if(!array_key_exists($belongs_to_value, $array_belongs_to_counts)){
594
+ $array_belongs_to_counts[$belongs_to_value]['type'] = $columns[2];
595
+ $array_belongs_to_counts[$belongs_to_value]['count'] = count($aDBc_all_items[$item_name]['sites']);
596
+ }else{
597
+ $array_belongs_to_counts[$belongs_to_value]['count'] += count($aDBc_all_items[$item_name]['sites']);
598
+ }
599
+ }
600
+ }
601
+ }
602
+ fclose($aDBc_saved_items_file);
603
+ }
604
+
605
+ // Filter results according to users choices and args
606
+ if(ADBC_PLUGIN_F_TYPE == "pro"){
607
+ aDBc_filter_results_in_all_items_array($aDBc_all_items, $aDBc_tables_name_to_optimize, $aDBc_tables_name_to_repair);
608
+ }else{
609
+ aDBc_filter_results_in_all_items_array_free($aDBc_all_items, $aDBc_tables_name_to_optimize, $aDBc_tables_name_to_repair);
610
+ }
611
+
612
+ // Put 'u' type to all uncategorized items and count all items
613
+ foreach($aDBc_all_items as $item_name => $item_info){
614
+ // Counting items differ from tasks to options and tables
615
+ // For tasks, we will counts numbers of args in array, while for options/tables, we will count number of sites
616
+ if($items_type == "tasks"){
617
+ foreach($item_info['sites'] as $site => $info){
618
+ $aDBc_items_categories_info['all']['count'] += count($item_info['sites'][$site]['args']);
619
+ if(empty($item_info['type'])){
620
+ $aDBc_all_items[$item_name]['type'] = 'u';
621
+ $aDBc_items_categories_info['u']['count'] += count($item_info['sites'][$site]['args']);
622
+ }else{
623
+ $aDBc_items_categories_info[$item_info['type']]['count'] += count($item_info['sites'][$site]['args']);
624
+ }
625
+ }
626
+ }else{
627
+ $aDBc_items_categories_info['all']['count'] += count($item_info['sites']);
628
+ if(empty($item_info['type'])){
629
+ $aDBc_all_items[$item_name]['type'] = 'u';
630
+ $aDBc_items_categories_info['u']['count'] += count($item_info['sites']);
631
+ }else{
632
+ $aDBc_items_categories_info[$item_info['type']]['count'] += count($item_info['sites']);
633
+ }
634
+ }
635
+ }
636
+
637
  // Prepare items to display
638
+ $aDBc_not_categorized_toolip = "<span class='aDBc-tooltips-headers'>
639
+ <img class='aDBc-info-image' src='". ADBC_PLUGIN_DIR_PATH . '/images/information2.svg' . "'/>
640
+ <span>" . __('This item is not categorized yet! Please click on scan button above to categorize it.','advanced-database-cleaner') ." </span>
641
+ </span>";
642
  foreach($aDBc_all_items as $item_name => $item_info){
643
 
644
+ if($_GET['aDBc_cat'] != "all" && $item_info['type'] != $_GET['aDBc_cat']){
 
645
  continue;
646
  }
647
 
648
+ switch($item_info['type']){
649
+ case 'u' :
650
+ if(ADBC_PLUGIN_F_TYPE == "free"){
651
+ $belongs_to_without_html = __('Available in Pro version!', 'advanced-database-cleaner');
652
+ $belongs_to = '<span style="color:#999">' . $belongs_to_without_html . '</span>';
653
+ }else{
654
+ $belongs_to_without_html = __('Uncategorised!', 'advanced-database-cleaner');
655
+ $belongs_to = '<span style="color:#999">' . $belongs_to_without_html . '</span>' . $aDBc_not_categorized_toolip;
656
+ }
657
+ break;
658
+ case 'o' :
659
+ $belongs_to_without_html = __('Orphan!', 'advanced-database-cleaner');
660
+ $belongs_to = '<span style="color:#E97F31">' . $belongs_to_without_html . '</span>';
661
+ break;
662
+ case 'w' :
663
+ $belongs_to_without_html = __('Wordpress core', 'advanced-database-cleaner');
664
+ $belongs_to = '<span style="color:#D091BE">' . $belongs_to_without_html;
665
+ // Add percent % if any
666
+ $belongs_to .= $item_info['belongs_to'] == "w" ? "" : " ".$item_info['belongs_to'];
667
+ $belongs_to .= '</span>';
668
+ break;
669
+ case 'p' :
670
+ $belongs_to_without_html = $item_info['belongs_to'];
671
+ $belongs_to = '<span style="color:#00BAFF">' . $belongs_to_without_html . '</span>';
672
+ break;
673
+ case 't' :
674
+ $belongs_to_without_html = $item_info['belongs_to'];
675
+ $belongs_to = '<span style="color:#45C966">' . $belongs_to_without_html . '</span>';
676
+ break;
677
+ }
678
  foreach($item_info['sites'] as $site_id => $site_item_info){
679
  switch($items_type){
680
  case 'tasks' :
681
+ foreach($site_item_info['args'] as $args_info){
682
+ array_push($items_to_display, array(
683
+ 'hook_name' => $item_name,
684
+ 'arguments' => $args_info['arguments'],
685
+ 'site_id' => $site_id,
686
+ 'next_run' => $args_info['next_run'] . ' - ' . $args_info['frequency'],
687
+ 'timestamp' => $args_info['timestamp'],
688
+ 'hook_belongs_to' => $belongs_to
689
+ ));
690
+ }
691
  break;
692
  case 'options' :
693
  array_push($items_to_display, array(
694
+ 'option_name' => $item_name,
695
+ 'option_value' => $site_item_info['value'],
696
+ 'option_autoload' => $site_item_info['autoload'],
697
+ 'option_size' => $site_item_info['size'],
698
+ 'site_id' => $site_id,
699
+ 'option_belongs_to' => $belongs_to
700
  ));
701
  break;
702
  case 'tables' :
703
  array_push($items_to_display, array(
704
+ 'table_name' => $item_name,
705
+ 'table_prefix' => $site_item_info['prefix'],
706
+ 'table_full_name' => $site_item_info['prefix'].$item_name,
707
+ 'table_rows' => $site_item_info['rows'],
708
+ 'table_size' => $site_item_info['size'],
709
+ 'table_lost' => $site_item_info['lost'],
710
+ 'site_id' => $site_id,
711
+ 'table_belongs_to' => $belongs_to
712
  ));
713
  break;
714
  }
715
  }
716
  }
717
+
718
+ // Sort items if necessary
719
+ if(!empty($_GET['orderby'])){
720
+ $order_by = esc_sql($_GET['orderby']);
721
+ $order = empty($_GET['order']) ? "asc" : esc_sql($_GET['order']);
722
+
723
+ if($order_by == "table_name"){
724
+ $order_by = "table_full_name";
725
+ }
726
+
727
+ $elements = array();
728
+ foreach($items_to_display as $items){
729
+ $elements[] = $items[$order_by];
730
+ }
731
+
732
+ if($order_by == "table_size" || $order_by == "option_size" || $order_by == "site_id"){
733
+ if($order == "asc"){
734
+ array_multisort($elements, SORT_ASC, $items_to_display, SORT_NUMERIC);
735
+ }else{
736
+ array_multisort($elements, SORT_DESC, $items_to_display, SORT_NUMERIC);
737
+ }
738
+ }else{
739
+ if($order == "asc"){
740
+ array_multisort($elements, SORT_ASC, $items_to_display, SORT_REGULAR);
741
+ }else{
742
+ array_multisort($elements, SORT_DESC, $items_to_display, SORT_REGULAR);
743
+ }
744
+ }
745
+ }
746
+
747
+ // Select which button to show, is it "new search" or "continue search"?
748
+ // If $aDBc_saved_items['last_file_path'] contains a path, then we conclude that the last search has failed => display "continue searching" button
749
+ $new_search = get_option("aDBc_temp_last_iteration_".$items_type);
750
+ if(empty($new_search)){
751
+ $aDBc_which_button_to_show = "new_search";
752
+ }else{
753
+ $aDBc_which_button_to_show = "continue_search";
754
+ $aDBc_message .= '<font color="black">';
755
+ $aDBc_message .= __('This page will reload several times during this scan!', 'advanced-database-cleaner');
756
+ $aDBc_message .= '</font>';
757
+ $aDBc_class_message = "notice-info";
758
+ }
759
  }
760
 
761
  /***********************************************************************************
782
  }
783
 
784
  /** Prepares options for one single site (Used by aDBc_get_all_options() function) */
785
+ function aDBc_add_options(&$aDBc_all_options, $blog_id){
786
  global $wpdb;
787
  // Get the list of all options from the current WP database
788
  $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%'");
789
  foreach($aDBc_options_in_db as $option){
790
  // If the option has not been added yet, add it and initiate its info
791
  if(empty($aDBc_all_options[$option->option_name])){
792
+ $aDBc_all_options[$option->option_name] = array('belongs_to' => '', 'maybe_belongs_to' => '', 'type' => '', 'sites' => array());
793
  }
794
+
795
  // Add info of the option according to the current site
796
  $aDBc_all_options[$option->option_name]['sites'][$blog_id] = array(
797
+ 'value' => aDBc_create_tooltip_for_option_value($option->option_value, 17),
798
+ 'size' => mb_strlen($option->option_value),
799
  'autoload' => $option->autoload
800
+ );
801
  }
802
  }
803
 
809
 
810
  /** Prepares all tables for all sites (if any) in a multidimensional array */
811
  function aDBc_get_all_tables() {
812
+
813
  global $wpdb;
814
+
815
  // First, prepare an array containing rows and sizes of tables
816
  $aDBc_tables_rows_sizes = array();
817
  $aDBc_result = $wpdb->get_results('SHOW TABLE STATUS FROM `'.DB_NAME.'`');
818
  foreach($aDBc_result as $aDBc_row){
819
+ $aDBc_table_size = $aDBc_row->Data_length + $aDBc_row->Index_length;
820
+ $aDBc_table_lost = $aDBc_row->Data_free;
821
+ $aDBc_tables_rows_sizes[$aDBc_row->Name] = array('rows' => $aDBc_row->Rows, 'size' => $aDBc_table_size, 'lost' => $aDBc_table_lost);
822
  }
823
 
824
  // Prepare ana array to hold all info about tables
837
  $aDBc_all_tables_names = $wpdb->get_results("SELECT table_name FROM information_schema.tables WHERE table_schema = '" . DB_NAME . "'");
838
 
839
  foreach($aDBc_all_tables_names as $aDBc_table){
840
+
841
+ // Get table name
842
+ $table_name = "";
843
+ // This test to prevent issues in MySQL 8 where tables are not shown
844
+ // MySQL 5 uses $aDBc_table->table_name while MySQL 8 uses $aDBc_table->TABLE_NAME
845
+ if(array_key_exists("table_name", $aDBc_table)){
846
+ $table_name = $aDBc_table->table_name;
847
+ }else if(array_key_exists("TABLE_NAME", $aDBc_table)){
848
+ $table_name = $aDBc_table->TABLE_NAME;
849
+ }
850
+
851
  // Holds the possible prefixes found for the current table
852
  $aDBc_found_prefixes = array();
853
  // Test if the table name starts with a valid prefix
854
  foreach($aDBc_prefix_list as $prefix => $site_id){
855
+ if(substr($table_name, 0, strlen($prefix)) === $prefix){
856
  $aDBc_found_prefixes[$prefix] = $site_id;
857
  }
858
  }
859
  // If the table do not start with any valid prefix, we add it as it is
860
  if(count($aDBc_found_prefixes) == 0){
861
+ $aDBc_table_name_without_prefix = $table_name;
862
  $aDBc_table_prefix = "";
863
  $aDBc_table_site = "1";
864
  }else if(count($aDBc_found_prefixes) == 1){
867
  reset($aDBc_found_prefixes);
868
  $aDBc_table_prefix = key($aDBc_found_prefixes);
869
  $aDBc_table_site = current($aDBc_found_prefixes);
870
+ $aDBc_table_name_without_prefix = substr($table_name, strlen($aDBc_table_prefix));
871
  }else{
872
  // If the number of possible prefixes found >= 2, we choose the longest prefix as valid one
873
  $aDBc_table_prefix = "";
877
  if(strlen($aDBc_prefix) >= strlen($aDBc_table_prefix)){
878
  $aDBc_table_prefix = $aDBc_prefix;
879
  $aDBc_table_site = $aDBc_site;
880
+ $aDBc_table_name_without_prefix = substr($table_name, strlen($aDBc_table_prefix));
881
  }
882
  }
883
  }
884
  // Add table information to the global array
885
  // If the table has not been added yet, add it and initiate its info
886
  if(empty($aDBc_all_tables[$aDBc_table_name_without_prefix])){
887
+ $aDBc_all_tables[$aDBc_table_name_without_prefix] = array('belongs_to' => '', 'maybe_belongs_to' => '', 'type' => '', 'sites' => array());
888
  }
889
  // Add info of the task according to the current site
890
+ $aDBc_all_tables[$aDBc_table_name_without_prefix]['sites'][$aDBc_table_site] = array('prefix' => $aDBc_table_prefix,
891
+ 'rows' => $aDBc_tables_rows_sizes[$table_name]['rows'],
892
+ 'size' => $aDBc_tables_rows_sizes[$table_name]['size'],
893
+ 'lost' => $aDBc_tables_rows_sizes[$table_name]['lost'],
894
  );
895
  }
896
  return $aDBc_all_tables;
934
  $aDBc_frequency = __('Unknown!', 'advanced-database-cleaner');
935
  }
936
  }else{
937
+ $aDBc_frequency = __('Single event', 'advanced-database-cleaner');
938
+ }
939
+ // Get arguments
940
+ $aDBc_args_array = array();
941
+ if(!empty($event['args'])){
942
+ $aDBc_args = $event['args'];
943
+ foreach( (array) $aDBc_args as $id => $arg){
944
+ array_push($aDBc_args_array, $arg);
945
+ }
946
+ }
947
+ if(empty($aDBc_args_array)){
948
+ $args_string = "none";
949
+ }else{
950
+ $args_string = serialize($aDBc_args_array);
951
  }
952
  // If the task has not been added yet, add it and initiate its info
953
  if(empty($aDBc_all_tasks[$hook])){
954
+
955
+ $aDBc_all_tasks[$hook] = array('belongs_to' => '', 'maybe_belongs_to' => '', 'type' => '', 'sites' => array());
956
+
957
+ }
958
+
959
+ // Initialize args array
960
+ if(empty($aDBc_all_tasks[$hook]['sites'][$blog_id]['args'])){
961
+ $aDBc_all_tasks[$hook]['sites'][$blog_id]['args'] = array();
962
  }
 
 
 
963
 
964
+ array_push($aDBc_all_tasks[$hook]['sites'][$blog_id]['args'], array('frequency' => $aDBc_frequency,
965
+ 'next_run' => get_date_from_gmt(@date('Y-m-d H:i:s', $timestamp), 'M j, Y @ H:i:s'),
966
+ 'timestamp' => $timestamp,
967
+ 'arguments' => $args_string));
968
  }
969
  }
970
  }
971
  }
972
 
973
+
974
+ /***********************************************************************************
975
+ * Transfrom bytes to corresponding best size system: KB, MB or GB
976
+ ***********************************************************************************/
977
+ function aDBc_get_size_from_bytes($bytes) {
978
+ $size = $bytes / 1024;
979
+ if($size >= 1024){
980
+ $size = $size / 1024;
981
+ if($size >= 1024){
982
+ $size = $size / 1024;
983
+ $size = round($size, 1) . " GB";
984
+ }else{
985
+ $size = round($size, 1) . " MB";
986
+ }
987
+ }else{
988
+ $size = round($size, 1) . " KB";
989
+ }
990
+ return $size;
991
+ }
992
+
993
+ /***********************************************************************************
994
+ * Create the folder plus an index.php for silence is golden
995
+ ***********************************************************************************/
996
+ function aDBc_create_folder_plus_index_file($folder) {
997
+
998
+ wp_mkdir_p($folder);
999
+
1000
+ // Create index file
1001
+ $myfile = fopen($folder . '/index.php', "w");
1002
+ if($myfile){
1003
+ fwrite($myfile, "<?php\n// Silence is golden.");
1004
+ fclose($myfile);
1005
+ }
1006
+
1007
+ // Create htaccess file
1008
+ // $myfile = fopen($folder . '/.htaccess', "w");
1009
+ // if($myfile){
1010
+ // fwrite($myfile, "Deny from all");
1011
+ // fclose($myfile);
1012
+ // }
1013
+ }
1014
+
1015
+ /**************************************************************************************************
1016
+ * Delete folder with its content
1017
+ *************************************************************************************************/
1018
+ function aDBc_delete_folder_with_content($path){
1019
+
1020
+ if(!file_exists($path))
1021
+ return;
1022
+ $dir = opendir($path);
1023
+ while(($file = readdir($dir)) !== false){
1024
+ if ($file != '.' && $file != '..'){
1025
+ unlink($path . "/" . $file);
1026
+ }
1027
+ }
1028
+ closedir($dir);
1029
+ rmdir( $path );
1030
+
1031
+ }
1032
+
1033
+ /**************************************************************************************************
1034
+ * Uupdate task in db after being deleted
1035
+ *************************************************************************************************/
1036
+ function aDBc_update_task_in_db_after_delete($arg_name, $db_option_name){
1037
+
1038
+ $clean_schedule_setting = get_option($db_option_name);
1039
+ // We will proceed only if settings are an array
1040
+ if(is_array($clean_schedule_setting)){
1041
+ $schedule = $clean_schedule_setting[$arg_name];
1042
+ $schedule['active'] = "0";
1043
+ $clean_schedule_setting[$arg_name] = $schedule;
1044
+ update_option($db_option_name, $clean_schedule_setting, "no");
1045
+ }
1046
+
1047
+ }
1048
+
1049
+ /***********************************************************************************
1050
+ * Get core tables that are categorized by default
1051
+ ***********************************************************************************/
1052
+ function aDBc_get_core_tables() {
1053
+
1054
+ /*
1055
+ * yyy: WP core tables
1056
+ * Found in wp-admin/includes/schema.php and wp-admin/includes/upgrade.php
1057
+ * After each release of WP, this list should be updated to add new tables if necessary (to minimize searches in files).
1058
+ */
1059
+ $aDBc_wp_core_tables = array(
1060
+ 'terms',
1061
+ 'term_taxonomy',
1062
+ 'term_relationships',
1063
+ 'commentmeta',
1064
+ 'comments',
1065
+ 'links',
1066
+ 'options',
1067
+ 'postmeta',
1068
+ 'posts',
1069
+ 'users',
1070
+ 'usermeta',
1071
+ // Since 3.0 in wp-admin/includes/upgrade.php
1072
+ 'sitecategories',
1073
+ // Since 4.4
1074
+ 'termmeta'
1075
+ );
1076
+
1077
+ // If MU, add tables of MU
1078
+ if(function_exists('is_multisite') && is_multisite()){
1079
+ array_push($aDBc_wp_core_tables, 'blogs');
1080
+ array_push($aDBc_wp_core_tables, 'blog_versions');
1081
+ array_push($aDBc_wp_core_tables, 'blogmeta');
1082
+ array_push($aDBc_wp_core_tables, 'registration_log');
1083
+ array_push($aDBc_wp_core_tables, 'site');
1084
+ array_push($aDBc_wp_core_tables, 'sitemeta');
1085
+ array_push($aDBc_wp_core_tables, 'signups');
1086
+ }
1087
+
1088
+ return $aDBc_wp_core_tables;
1089
+ }
1090
+
1091
+ /***********************************************************************************
1092
+ * Get core tasks that are categorized by default
1093
+ ***********************************************************************************/
1094
+ function aDBc_get_core_tasks() {
1095
+
1096
+ /*
1097
+ * yyy: WP core tasks
1098
+ * After each release of WP, this list should be updated to add new tasks if necessary (to minimize searches in files).
1099
+ */
1100
+ $aDBc_wp_core_tasks = array(
1101
+ 'wp_version_check',
1102
+ 'wp_update_plugins',
1103
+ 'wp_update_themes',
1104
+ 'wp_maybe_auto_update',
1105
+ 'wp_scheduled_auto_draft_delete',
1106
+ 'wp_scheduled_delete',
1107
+ 'update_network_counts',
1108
+ 'delete_expired_transients',
1109
+ 'wp_privacy_delete_old_export_files',
1110
+ 'recovery_mode_clean_expired_keys'
1111
+ );
1112
+
1113
+ return $aDBc_wp_core_tasks;
1114
+ }
1115
+
1116
+ /***********************************************************************************
1117
+ * Get core options that are categorized by default
1118
+ ***********************************************************************************/
1119
+ function aDBc_get_core_options() {
1120
+
1121
+ /*
1122
+ * yyy: WP core options
1123
+ * Found in wp-admin/includes/schema.php
1124
+ * After each release of WP, this list should be updated to add new options if necessary (to minimize searches in files).
1125
+ */
1126
+ $aDBc_wp_core_options = array(
1127
+ 'siteurl',
1128
+ 'home',
1129
+ 'blogname',
1130
+ 'blogdescription',
1131
+ 'users_can_register',
1132
+ 'admin_email',
1133
+ 'start_of_week',
1134
+ 'use_balanceTags',
1135
+ 'use_smilies',
1136
+ 'require_name_email',
1137
+ 'comments_notify',
1138
+ 'posts_per_rss',
1139
+ 'rss_use_excerpt',
1140
+ 'mailserver_url',
1141
+ 'mailserver_login',
1142
+ 'mailserver_pass',
1143
+ 'mailserver_port',
1144
+ 'default_category',
1145
+ 'default_comment_status',
1146
+ 'default_ping_status',
1147
+ 'default_pingback_flag',
1148
+ 'posts_per_page',
1149
+ 'date_format',
1150
+ 'time_format',
1151
+ 'links_updated_date_format',
1152
+ 'comment_moderation',
1153
+ 'moderation_notify',
1154
+ 'permalink_structure',
1155
+ 'gzipcompression',
1156
+ 'hack_file',
1157
+ 'blog_charset',
1158
+ 'moderation_keys',
1159
+ 'active_plugins',
1160
+ 'category_base',
1161
+ 'ping_sites',
1162
+ 'advanced_edit',
1163
+ 'comment_max_links',
1164
+ 'gmt_offset',
1165
+ // 1.5
1166
+ 'default_email_category',
1167
+ 'recently_edited',
1168
+ 'template',
1169
+ 'stylesheet',
1170
+ 'comment_whitelist',
1171
+ 'blacklist_keys',
1172
+ 'comment_registration',
1173
+ 'html_type',
1174
+ // 1.5.1
1175
+ 'use_trackback',
1176
+ // 2.0
1177
+ 'default_role',
1178
+ 'db_version',
1179
+ // 2.0.1
1180
+ 'uploads_use_yearmonth_folders',
1181
+ 'upload_path',
1182
+ // 2.1
1183
+ 'blog_public',
1184
+ 'default_link_category',
1185
+ 'show_on_front',
1186
+ // 2.2
1187
+ 'tag_base',
1188
+ // 2.5
1189
+ 'show_avatars',
1190
+ 'avatar_rating',
1191
+ 'upload_url_path',
1192
+ 'thumbnail_size_w',
1193
+ 'thumbnail_size_h',
1194
+ 'thumbnail_crop',
1195
+ 'medium_size_w',
1196
+ 'medium_size_h',
1197
+ // 2.6
1198
+ 'avatar_default',
1199
+ // 2.7
1200
+ 'large_size_w',
1201
+ 'large_size_h',
1202
+ 'image_default_link_type',
1203
+ 'image_default_size',
1204
+ 'image_default_align',
1205
+ 'close_comments_for_old_posts',
1206
+ 'close_comments_days_old',
1207
+ 'thread_comments',
1208
+ 'thread_comments_depth',
1209
+ 'page_comments',
1210
+ 'comments_per_page',
1211
+ 'default_comments_page',
1212
+ 'comment_order',
1213
+ 'sticky_posts',
1214
+ 'widget_categories',
1215
+ 'widget_text',
1216
+ 'widget_rss',
1217
+ 'uninstall_plugins',
1218
+ // 2.8
1219
+ 'timezone_string',
1220
+ // 3.0
1221
+ 'page_for_posts',
1222
+ 'page_on_front',
1223
+ // 3.1
1224
+ 'default_post_format',
1225
+ // 3.5
1226
+ 'link_manager_enabled',
1227
+ // 4.3.0
1228
+ 'finished_splitting_shared_terms',
1229
+ 'site_icon',
1230
+ // 4.4.0
1231
+ 'medium_large_size_w',
1232
+ 'medium_large_size_h',
1233
+ // 4.9.6
1234
+ 'wp_page_for_privacy_policy',
1235
+ // 4.9.8
1236
+ 'show_comments_cookies_opt_in',
1237
+ // Deleted from new versions
1238
+ 'blodotgsping_url', 'bodyterminator', 'emailtestonly', 'phoneemail_separator', 'smilies_directory',
1239
+ 'subjectprefix', 'use_bbcode', 'use_blodotgsping', 'use_phoneemail', 'use_quicktags', 'use_weblogsping',
1240
+ 'weblogs_cache_file', 'use_preview', 'use_htmltrans', 'smilies_directory', 'fileupload_allowedusers',
1241
+ 'use_phoneemail', 'default_post_status', 'default_post_category', 'archive_mode', 'time_difference',
1242
+ 'links_minadminlevel', 'links_use_adminlevels', 'links_rating_type', 'links_rating_char',
1243
+ 'links_rating_ignore_zero', 'links_rating_single_image', 'links_rating_image0', 'links_rating_image1',
1244
+ 'links_rating_image2', 'links_rating_image3', 'links_rating_image4', 'links_rating_image5',
1245
+ 'links_rating_image6', 'links_rating_image7', 'links_rating_image8', 'links_rating_image9',
1246
+ 'links_recently_updated_time', 'links_recently_updated_prepend', 'links_recently_updated_append',
1247
+ 'weblogs_cacheminutes', 'comment_allowed_tags', 'search_engine_friendly_urls', 'default_geourl_lat',
1248
+ 'default_geourl_lon', 'use_default_geourl', 'weblogs_xml_url', 'new_users_can_blog', '_wpnonce',
1249
+ '_wp_http_referer', 'Update', 'action', 'rich_editing', 'autosave_interval', 'deactivated_plugins',
1250
+ 'can_compress_scripts', 'page_uris', 'update_core', 'update_plugins', 'update_themes', 'doing_cron',
1251
+ 'random_seed', 'rss_excerpt_length', 'secret', 'use_linksupdate', 'default_comment_status_page',
1252
+ 'wporg_popular_tags', 'what_to_show', 'rss_language', 'language', 'enable_xmlrpc', 'enable_app',
1253
+ 'embed_autourls', 'default_post_edit_rows',
1254
+ //Found in wp-admin/includes/upgrade.php
1255
+ 'widget_search',
1256
+ 'widget_recent-posts',
1257
+ 'widget_recent-comments',
1258
+ 'widget_archives',
1259
+ 'widget_meta',
1260
+ 'sidebars_widgets',
1261
+ // Found in wp-admin/includes/schema.php but not with the above list
1262
+ 'initial_db_version',
1263
+ 'WPLANG',
1264
+ // Found in wp-admin/includes/class-wp-plugins-list-table.php
1265
+ 'recently_activated',
1266
+ // Found in wp-admin/network/site-info.php
1267
+ 'rewrite_rules',
1268
+ // Found in wp-admin/network.php
1269
+ 'auth_key',
1270
+ 'auth_salt',
1271
+ 'logged_in_key',
1272
+ 'logged_in_salt',
1273
+ 'nonce_key',
1274
+ 'nonce_salt',
1275
+ // Found in wp-includes/theme.php
1276
+ 'theme_switched',
1277
+ // Found in wp-includes/class-wp-customize-manager.php
1278
+ 'current_theme',
1279
+ // Found in wp-includes/cron.php
1280
+ 'cron',
1281
+ // Unknown : To verify
1282
+ 'user_roles',
1283
+ 'widget_nav_menu',
1284
+ );
1285
+
1286
+ // Before doing anything, we add some special options to the WP core options array
1287
+ // The 'user_roles' option is added in Multi-site as $prefix.'user_roles'. So for each site we should add this options in that format
1288
+ if(function_exists('is_multisite') && is_multisite()){
1289
+ global $wpdb;
1290
+ $blogs_ids = $wpdb->get_col("SELECT blog_id FROM $wpdb->blogs");
1291
+ foreach($blogs_ids as $blog_id){
1292
+ array_push($aDBc_wp_core_options, $wpdb->get_blog_prefix($blog_id).'user_roles');
1293
+ }
1294
+ }
1295
+
1296
+ return $aDBc_wp_core_options;
1297
+ }
1298
+
1299
  ?>
includes/header_page_filter.php ADDED
@@ -0,0 +1,173 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ <div style="margin-top:30px;">
3
+
4
+ <div style="clear:both;margin-bottom:25px;width:100%;background:#f9f9f9" class="aDBc-float-right">
5
+
6
+ <?php
7
+ if(ADBC_PLUGIN_F_TYPE == "free"){
8
+ $aDBc_form_style = "pointer-events:none;opacity:0.5";
9
+
10
+ }else{
11
+ $aDBc_form_style = "";
12
+ }
13
+ ?>
14
+
15
+ <div style="float:left;padding:8px;height:30px">
16
+
17
+ <span class="aDBc_premium_tooltip">
18
+
19
+ <form method="get" style="<?php echo $aDBc_form_style ?>">
20
+
21
+ <?php
22
+ // Generate current parameters in URL
23
+ foreach($_GET as $name => $value){
24
+ if($name != "s" && $name != "paged" && $name != "aDBc_cat")
25
+ echo "<input type='hidden' name='$name' value='$value'/>";
26
+ }
27
+ // Return always paged to page 1
28
+ echo "<input type='hidden' name='paged' value='1'/>";
29
+ // Return always aDBc_cat to all after filter
30
+ echo "<input type='hidden' name='aDBc_cat' value='all'/>";
31
+ ?>
32
+
33
+ <fieldset style="padding-right:5px;float:left">
34
+ <input style="font-size:13px;width:120px;height:30px;border:1px solid #e5e5e5;border-radius:2px;box-shadow:0 0 10px #f1f1f1;" type="search" placeholder="<?php _e('Search for','advanced-database-cleaner') ?>" name="s" value="<?php echo empty($_GET['s']) ? '' : esc_attr($_GET['s']); ?>"/>
35
+ </fieldset>
36
+
37
+ <fieldset style="float:left;">
38
+
39
+
40
+ <?php
41
+ // Show this select only for tables
42
+ if(isset($_GET['aDBc_tab']) && $_GET['aDBc_tab'] == 'tables'){ ?>
43
+ <select name="t_type" style="font-size:13px;width:100px;height:30px;border:1px solid #e5e5e5;border-radius:2px;box-shadow:0 0 10px #f1f1f1;">
44
+ <option value="all" <?php echo (isset($_GET['t_type']) && $_GET['t_type'] == 'all') ? "selected='selected'" : ""; ?>><?php _e('All tables','advanced-database-cleaner') ?></option>
45
+ <option value="optimize" <?php echo (isset($_GET['t_type']) && $_GET['t_type'] == 'optimize') ? "selected='selected'" : ""; ?>><?php echo __('To optimize','advanced-database-cleaner') . " (" . count($this->aDBc_tables_name_to_optimize) . ")" ?></option>
46
+ <option value="repair" <?php echo (isset($_GET['t_type']) && $_GET['t_type'] == 'repair') ? "selected='selected'" : ""; ?>><?php echo __('To repair','advanced-database-cleaner') . " (" . count($this->aDBc_tables_name_to_repair) . ")" ?></option>
47
+ </select>
48
+ <?php } ?>
49
+
50
+ <?php
51
+ // Show autoload only for options
52
+ if(isset($_GET['aDBc_tab']) && $_GET['aDBc_tab'] == 'options'){ ?>
53
+ <select name="autoload" style="font-size:13px;width:100px;height:30px;border:1px solid #e5e5e5;border-radius:2px;box-shadow:0 0 10px #f1f1f1;">
54
+ <option value="all" <?php echo (isset($_GET['autoload']) && $_GET['autoload'] == 'all') ? "selected='selected'" : ""; ?>><?php _e('Autoload','advanced-database-cleaner') ?></option>
55
+ <option value="yes" <?php echo (isset($_GET['autoload']) && $_GET['autoload'] == 'yes') ? "selected='selected'" : ""; ?>><?php echo __('Yes','advanced-database-cleaner') ?></option>
56
+ <option value="no" <?php echo (isset($_GET['autoload']) && $_GET['autoload'] == 'no') ? "selected='selected'" : ""; ?>><?php echo __('No','advanced-database-cleaner') ?></option>
57
+ </select>
58
+ <?php } ?>
59
+
60
+ <select name="belongs_to" style="font-size:13px;width:135px;height:30px;border:1px solid #e5e5e5;border-radius:2px;box-shadow:0 0 10px #f1f1f1;">
61
+ <option value="all"><?php _e('All "belongs to"','advanced-database-cleaner') ?></option>
62
+ <?php
63
+ $total_plugins = 0;
64
+ $total_themes = 0;
65
+ foreach($this->array_belongs_to_counts as $name => $info){
66
+ if($info['type'] == "p"){
67
+ $total_plugins++;
68
+ }else if($info['type'] == "t"){
69
+ $total_themes++;
70
+ }
71
+ }
72
+ ?>
73
+ <optgroup label="<?php echo __('Plugins','advanced-database-cleaner') . " (" . $total_plugins . ")" ?>">
74
+ <?php
75
+
76
+ foreach($this->array_belongs_to_counts as $name => $info){
77
+ if($info['type'] == "p"){
78
+ $selected = isset($_GET['belongs_to']) && $_GET['belongs_to'] == $name ? "selected='selected'" : "";
79
+ echo "<option value='$name'" . $selected . ">" . $name . " (" . $info['count'] .")" . "</option>";
80
+
81
+ }
82
+ }
83
+ ?>
84
+ </optgroup>
85
+ <optgroup label="<?php echo __('Themes','advanced-database-cleaner') . " (" . $total_themes . ")" ?>">
86
+ <?php
87
+ foreach($this->array_belongs_to_counts as $name => $info){
88
+ if($info['type'] == "t"){
89
+ $selected = isset($_GET['belongs_to']) && $_GET['belongs_to'] == $name ? "selected='selected'" : "";
90
+ echo "<option value='$name'" . $selected . ">" . $name . " (" . $info['count'] .")" . "</option>";
91
+ }
92
+ }
93
+ ?>
94
+ </optgroup>
95
+ </select>
96
+
97
+ <?php
98
+ if(function_exists('is_multisite') && is_multisite()){
99
+ echo "<select name='site' style='font-size:13px;width:75px;height:30px;border:1px solid #e5e5e5;border-radius:2px;box-shadow:0 0 10px #f1f1f1;'>";
100
+ echo "<option value=''>" . __('All sites','advanced-database-cleaner') . "</option>";
101
+
102
+ global $wpdb;
103
+ $blogs_ids = $wpdb->get_col("SELECT blog_id FROM $wpdb->blogs");
104
+ foreach($blogs_ids as $blog_id){
105
+ $blog_details = get_blog_details($blog_id);
106
+ $selected = (isset($_GET['site']) && $_GET['site'] == $blog_id) ? "selected='selected'" : "";
107
+ echo "<option value='$blog_id'". $selected .">" . __('Site','advanced-database-cleaner') . " ". $blog_id . " | " . $blog_details->blogname . "</option>";
108
+ }
109
+
110
+ echo "</select>";
111
+
112
+ }
113
+ ?>
114
+
115
+ </fieldset>
116
+
117
+ <span style="padding-left:5px;float:left">
118
+ <input style="float:left;height:30px;width:50px;margin-top:0px" class="button-secondary" type="submit" value="<?php _e('Filter','advanced-database-cleaner') ?>"/>
119
+ </span>
120
+
121
+ </form>
122
+
123
+ <?php if(ADBC_PLUGIN_F_TYPE == "free"){ ?>
124
+ <span style="width:150px" class="aDBc_premium_tooltiptext"><?php _e('Available in Pro version!','advanced-database-cleaner') ?></span>
125
+ <?php } ?>
126
+
127
+ </span>
128
+ </div>
129
+
130
+ <div style="float:right;padding:8px;height:30px">
131
+
132
+ <form method="get">
133
+
134
+ <?php
135
+ // Generate current parameters in URL
136
+ foreach($_GET as $name => $value){
137
+ if($name != "per_page" && $name != "paged")
138
+ echo "<input type='hidden' name='$name' value='$value'/>";
139
+ }
140
+ // Return paged to page 1
141
+ echo "<input type='hidden' name='paged' value='1'/>";
142
+ ?>
143
+
144
+ <span style="padding-right:8px;float:left;font-size:13px;padding-top:5px"><?php _e('Items per page','advanced-database-cleaner') ?></span>
145
+ <span style="padding-right:5px;float:left">
146
+
147
+ <input type="number" style="font-size:13px;width:55px;height:30px;border:1px solid #e5e5e5;border-radius:2px;box-shadow:0 0 10px #f1f1f1;" id="revisions-search-input" name="per_page" value="<?php echo empty($_GET['per_page']) ? '50' : esc_attr($_GET['per_page']); ?>"/>
148
+ </span>
149
+
150
+ <span style="float:left">
151
+ <input style="float:left;height:30px;" type="submit" class="button-secondary" value="<?php _e('Show','advanced-database-cleaner') ?>"/>
152
+ </span>
153
+ </form>
154
+ </div>
155
+
156
+ <?php
157
+
158
+ if((!empty($_GET['s']) && trim($_GET['s']) != "") || !empty($_GET['t_type']) || !empty($_GET['belongs_to']) || !empty($_GET['site'])){
159
+
160
+ $aDBc_new_URI = $_SERVER['REQUEST_URI'];
161
+ // Remove args to delete custom filter
162
+ $aDBc_new_URI = remove_query_arg(array('s', 't_type', 'belongs_to', 'site', 'autoload'), $aDBc_new_URI);
163
+ $aDBc_new_URI = add_query_arg('aDBc_cat', 'all', $aDBc_new_URI);
164
+ ?>
165
+
166
+ <div style="clear:both;padding:5px 0px 8px 8px;">
167
+ <a style="color:red" href="<?php echo $aDBc_new_URI; ?>"><?php _e('Delete custom filter','advanced-database-cleaner') ?></a>
168
+ </div>
169
+
170
+ <?php } ?>
171
+
172
+ </div>
173
+ </div>
includes/license/ADBC_EDD_SL_Plugin_Updater.php ADDED
@@ -0,0 +1,572 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ // Exit if accessed directly
4
+ if ( ! defined( 'ABSPATH' ) ) exit;
5
+
6
+ /**
7
+ * Allows plugins to use their own update API.
8
+ *
9
+ * @author Easy Digital Downloads
10
+ * @version 1.6.18
11
+ */
12
+ class ADBC_EDD_SL_Plugin_Updater {
13
+
14
+ private $api_url = '';
15
+ private $api_data = array();
16
+ private $name = '';
17
+ private $slug = '';
18
+ private $version = '';
19
+ private $wp_override = false;
20
+ private $cache_key = '';
21
+
22
+ private $health_check_timeout = 5;
23
+
24
+ /**
25
+ * Class constructor.
26
+ *
27
+ * @uses plugin_basename()
28
+ * @uses hook()
29
+ *
30
+ * @param string $_api_url The URL pointing to the custom API endpoint.
31
+ * @param string $_plugin_file Path to the plugin file.
32
+ * @param array $_api_data Optional data to send with API calls.
33
+ */
34
+ public function __construct( $_api_url, $_plugin_file, $_api_data = null ) {
35
+
36
+ global $edd_plugin_data;
37
+
38
+ $this->api_url = trailingslashit( $_api_url );
39
+ $this->api_data = $_api_data;
40
+ $this->name = plugin_basename( $_plugin_file );
41
+ $this->slug = basename( $_plugin_file, '.php' );
42
+ $this->version = $_api_data['version'];
43
+ $this->wp_override = isset( $_api_data['wp_override'] ) ? (bool) $_api_data['wp_override'] : false;
44
+ $this->beta = ! empty( $this->api_data['beta'] ) ? true : false;
45
+ $this->cache_key = 'edd_sl_' . md5( serialize( $this->slug . $this->api_data['license'] . $this->beta ) );
46
+
47
+ $edd_plugin_data[ $this->slug ] = $this->api_data;
48
+
49
+ /**
50
+ * Fires after the $edd_plugin_data is setup.
51
+ *
52
+ * @since x.x.x
53
+ *
54
+ * @param array $edd_plugin_data Array of EDD SL plugin data.
55
+ */
56
+ do_action( 'post_edd_sl_plugin_updater_setup', $edd_plugin_data );
57
+
58
+ // Set up hooks.
59
+ $this->init();
60
+
61
+ }
62
+
63
+ /**
64
+ * Set up WordPress filters to hook into WP's update process.
65
+ *
66
+ * @uses add_filter()
67
+ *
68
+ * @return void
69
+ */
70
+ public function init() {
71
+
72
+ add_filter( 'pre_set_site_transient_update_plugins', array( $this, 'check_update' ) );
73
+ add_filter( 'plugins_api', array( $this, 'plugins_api_filter' ), 10, 3 );
74
+ remove_action( 'after_plugin_row_' . $this->name, 'wp_plugin_update_row', 10 );
75
+ add_action( 'after_plugin_row_' . $this->name, array( $this, 'show_update_notification' ), 10, 2 );
76
+ add_action( 'admin_init', array( $this, 'show_changelog' ) );
77
+
78
+ }
79
+
80
+ /**
81
+ * Check for Updates at the defined API endpoint and modify the update array.
82
+ *
83
+ * This function dives into the update API just when WordPress creates its update array,
84
+ * then adds a custom API call and injects the custom plugin data retrieved from the API.
85
+ * It is reassembled from parts of the native WordPress plugin update code.
86
+ * See wp-includes/update.php line 121 for the original wp_update_plugins() function.
87
+ *
88
+ * @uses api_request()
89
+ *
90
+ * @param array $_transient_data Update array build by WordPress.
91
+ * @return array Modified update array with custom plugin data.
92
+ */
93
+ public function check_update( $_transient_data ) {
94
+
95
+ global $pagenow;
96
+
97
+ if ( ! is_object( $_transient_data ) ) {
98
+ $_transient_data = new stdClass;
99
+ }
100
+
101
+ if ( 'plugins.php' == $pagenow && is_multisite() ) {
102
+ return $_transient_data;
103
+ }
104
+
105
+ if ( ! empty( $_transient_data->response ) && ! empty( $_transient_data->response[ $this->name ] ) && false === $this->wp_override ) {
106
+ return $_transient_data;
107
+ }
108
+
109
+ $version_info = $this->get_cached_version_info();
110
+
111
+ if ( false === $version_info ) {
112
+ $version_info = $this->api_request( 'plugin_latest_version', array( 'slug' => $this->slug, 'beta' => $this->beta ) );
113
+
114
+ $this->set_version_info_cache( $version_info );
115
+
116
+ }
117
+
118
+ if ( false !== $version_info && is_object( $version_info ) && isset( $version_info->new_version ) ) {
119
+
120
+ if ( version_compare( $this->version, $version_info->new_version, '<' ) ) {
121
+
122
+ $_transient_data->response[ $this->name ] = $version_info;
123
+
124
+ // Make sure the plugin property is set to the plugin's name/location. See issue 1463 on Software Licensing's GitHub repo.
125
+ $_transient_data->response[ $this->name ]->plugin = $this->name;
126
+
127
+ }
128
+
129
+ $_transient_data->last_checked = time();
130
+ $_transient_data->checked[ $this->name ] = $this->version;
131
+
132
+ }
133
+
134
+ return $_transient_data;
135
+ }
136
+
137
+ /**
138
+ * show update nofication row -- needed for multisite subsites, because WP won't tell you otherwise!
139
+ *
140
+ * @param string $file
141
+ * @param array $plugin
142
+ */
143
+ public function show_update_notification( $file, $plugin ) {
144
+
145
+ if ( is_network_admin() ) {
146
+ return;
147
+ }
148
+
149
+ if( ! current_user_can( 'update_plugins' ) ) {
150
+ return;
151
+ }
152
+
153
+ if( ! is_multisite() ) {
154
+ return;
155
+ }
156
+
157
+ if ( $this->name != $file ) {
158
+ return;
159
+ }
160
+
161
+ // Remove our filter on the site transient
162
+ remove_filter( 'pre_set_site_transient_update_plugins', array( $this, 'check_update' ), 10 );
163
+
164
+ $update_cache = get_site_transient( 'update_plugins' );
165
+
166
+ $update_cache = is_object( $update_cache ) ? $update_cache : new stdClass();
167
+
168
+ if ( empty( $update_cache->response ) || empty( $update_cache->response[ $this->name ] ) ) {
169
+
170
+ $version_info = $this->get_cached_version_info();
171
+
172
+ if ( false === $version_info ) {
173
+ $version_info = $this->api_request( 'plugin_latest_version', array( 'slug' => $this->slug, 'beta' => $this->beta ) );
174
+
175
+ // Since we disabled our filter for the transient, we aren't running our object conversion on banners, sections, or icons. Do this now:
176
+ if ( isset( $version_info->banners ) && ! is_array( $version_info->banners ) ) {
177
+ $version_info->banners = $this->convert_object_to_array( $version_info->banners );
178
+ }
179
+
180
+ if ( isset( $version_info->sections ) && ! is_array( $version_info->sections ) ) {
181
+ $version_info->sections = $this->convert_object_to_array( $version_info->sections );
182
+ }
183
+
184
+ if ( isset( $version_info->icons ) && ! is_array( $version_info->icons ) ) {
185
+ $version_info->icons = $this->convert_object_to_array( $version_info->icons );
186
+ }
187
+
188
+ $this->set_version_info_cache( $version_info );
189
+ }
190
+
191
+ if ( ! is_object( $version_info ) ) {
192
+ return;
193
+ }
194
+
195
+ if ( version_compare( $this->version, $version_info->new_version, '<' ) ) {
196
+
197
+ $update_cache->response[ $this->name ] = $version_info;
198
+
199
+ }
200
+
201
+ $update_cache->last_checked = time();
202
+ $update_cache->checked[ $this->name ] = $this->version;
203
+
204
+ set_site_transient( 'update_plugins', $update_cache );
205
+
206
+ } else {
207
+
208
+ $version_info = $update_cache->response[ $this->name ];
209
+
210
+ }
211
+
212
+ // Restore our filter
213
+ add_filter( 'pre_set_site_transient_update_plugins', array( $this, 'check_update' ) );
214
+
215
+ if ( ! empty( $update_cache->response[ $this->name ] ) && version_compare( $this->version, $version_info->new_version, '<' ) ) {
216
+
217
+ // build a plugin list row, with update notification
218
+ $wp_list_table = _get_list_table( 'WP_Plugins_List_Table' );
219
+ # <tr class="plugin-update-tr"><td colspan="' . $wp_list_table->get_column_count() . '" class="plugin-update colspanchange">
220
+ echo '<tr class="plugin-update-tr" id="' . $this->slug . '-update" data-slug="' . $this->slug . '" data-plugin="' . $this->slug . '/' . $file . '">';
221
+ echo '<td colspan="3" class="plugin-update colspanchange">';
222
+ echo '<div class="update-message notice inline notice-warning notice-alt">';
223
+
224
+ $changelog_link = self_admin_url( 'index.php?edd_sl_action=view_plugin_changelog&plugin=' . $this->name . '&slug=' . $this->slug . '&TB_iframe=true&width=772&height=911' );
225
+
226
+ if ( empty( $version_info->download_link ) ) {
227
+ printf(
228
+ __( 'There is a new version of %1$s available. %2$sView version %3$s details%4$s.', 'advanced-database-cleaner' ),
229
+ esc_html( $version_info->name ),
230
+ '<a target="_blank" class="thickbox" href="' . esc_url( $changelog_link ) . '">',
231
+ esc_html( $version_info->new_version ),
232
+ '</a>'
233
+ );
234
+ } else {
235
+ printf(
236
+ __( 'There is a new version of %1$s available. %2$sView version %3$s details%4$s or %5$supdate now%6$s.', 'advanced-database-cleaner' ),
237
+ esc_html( $version_info->name ),
238
+ '<a target="_blank" class="thickbox" href="' . esc_url( $changelog_link ) . '">',
239
+ esc_html( $version_info->new_version ),
240
+ '</a>',
241
+ '<a href="' . esc_url( wp_nonce_url( self_admin_url( 'update.php?action=upgrade-plugin&plugin=' ) . $this->name, 'upgrade-plugin_' . $this->name ) ) .'">',
242
+ '</a>'
243
+ );
244
+ }
245
+
246
+ do_action( "in_plugin_update_message-{$file}", $plugin, $version_info );
247
+
248
+ echo '</div></td></tr>';
249
+ }
250
+ }
251
+
252
+ /**
253
+ * Updates information on the "View version x.x details" page with custom data.
254
+ *
255
+ * @uses api_request()
256
+ *
257
+ * @param mixed $_data
258
+ * @param string $_action
259
+ * @param object $_args
260
+ * @return object $_data
261
+ */
262
+ public function plugins_api_filter( $_data, $_action = '', $_args = null ) {
263
+
264
+ if ( $_action != 'plugin_information' ) {
265
+
266
+ return $_data;
267
+
268
+ }
269
+
270
+ if ( ! isset( $_args->slug ) || ( $_args->slug != $this->slug ) ) {
271
+
272
+ return $_data;
273
+
274
+ }
275
+
276
+ $to_send = array(
277
+ 'slug' => $this->slug,
278
+ 'is_ssl' => is_ssl(),
279
+ 'fields' => array(
280
+ 'banners' => array(),
281
+ 'reviews' => false,
282
+ 'icons' => array(),
283
+ )
284
+ );
285
+
286
+ $cache_key = 'edd_api_request_' . md5( serialize( $this->slug . $this->api_data['license'] . $this->beta ) );
287
+
288
+ // Get the transient where we store the api request for this plugin for 24 hours
289
+ $edd_api_request_transient = $this->get_cached_version_info( $cache_key );
290
+
291
+ //If we have no transient-saved value, run the API, set a fresh transient with the API value, and return that value too right now.
292
+ if ( empty( $edd_api_request_transient ) ) {
293
+
294
+ $api_response = $this->api_request( 'plugin_information', $to_send );
295
+
296
+ // Expires in 3 hours
297
+ $this->set_version_info_cache( $api_response, $cache_key );
298
+
299
+ if ( false !== $api_response ) {
300
+ $_data = $api_response;
301
+ }
302
+
303
+ } else {
304
+ $_data = $edd_api_request_transient;
305
+ }
306
+
307
+ // Convert sections into an associative array, since we're getting an object, but Core expects an array.
308
+ if ( isset( $_data->sections ) && ! is_array( $_data->sections ) ) {
309
+ $_data->sections = $this->convert_object_to_array( $_data->sections );
310
+ }
311
+
312
+ // Convert banners into an associative array, since we're getting an object, but Core expects an array.
313
+ if ( isset( $_data->banners ) && ! is_array( $_data->banners ) ) {
314
+ $_data->banners = $this->convert_object_to_array( $_data->banners );
315
+ }
316
+
317
+ // Convert icons into an associative array, since we're getting an object, but Core expects an array.
318
+ if ( isset( $_data->icons ) && ! is_array( $_data->icons ) ) {
319
+ $_data->icons = $this->convert_object_to_array( $_data->icons );
320
+ }
321
+
322
+ if( ! isset( $_data->plugin ) ) {
323
+ $_data->plugin = $this->name;
324
+ }
325
+
326
+ return $_data;
327
+ }
328
+
329
+ /**
330
+ * Convert some objects to arrays when injecting data into the update API
331
+ *
332
+ * Some data like sections, banners, and icons are expected to be an associative array, however due to the JSON
333
+ * decoding, they are objects. This method allows us to pass in the object and return an associative array.
334
+ *
335
+ * @since 3.6.5
336
+ *
337
+ * @param stdClass $data
338
+ *
339
+ * @return array
340
+ */
341
+ private function convert_object_to_array( $data ) {
342
+ $new_data = array();
343
+ foreach ( $data as $key => $value ) {
344
+ $new_data[ $key ] = $value;
345
+ }
346
+
347
+ return $new_data;
348
+ }
349
+
350
+ /**
351
+ * Disable SSL verification in order to prevent download update failures
352
+ *
353
+ * @param array $args
354
+ * @param string $url
355
+ * @return object $array
356
+ */
357
+ public function http_request_args( $args, $url ) {
358
+
359
+ $verify_ssl = $this->verify_ssl();
360
+ if ( strpos( $url, 'https://' ) !== false && strpos( $url, 'edd_action=package_download' ) ) {
361
+ $args['sslverify'] = $verify_ssl;
362
+ }
363
+ return $args;
364
+
365
+ }
366
+
367
+ /**
368
+ * Calls the API and, if successfull, returns the object delivered by the API.
369
+ *
370
+ * @uses get_bloginfo()
371
+ * @uses wp_remote_post()
372
+ * @uses is_wp_error()
373
+ *
374
+ * @param string $_action The requested action.
375
+ * @param array $_data Parameters for the API action.
376
+ * @return false|object
377
+ */
378
+ private function api_request( $_action, $_data ) {
379
+
380
+ global $wp_version, $edd_plugin_url_available;
381
+
382
+ $verify_ssl = $this->verify_ssl();
383
+
384
+ // Do a quick status check on this domain if we haven't already checked it.
385
+ $store_hash = md5( $this->api_url );
386
+ if ( ! is_array( $edd_plugin_url_available ) || ! isset( $edd_plugin_url_available[ $store_hash ] ) ) {
387
+ $test_url_parts = parse_url( $this->api_url );
388
+
389
+ $scheme = ! empty( $test_url_parts['scheme'] ) ? $test_url_parts['scheme'] : 'http';
390
+ $host = ! empty( $test_url_parts['host'] ) ? $test_url_parts['host'] : '';
391
+ $port = ! empty( $test_url_parts['port'] ) ? ':' . $test_url_parts['port'] : '';
392
+
393
+ if ( empty( $host ) ) {
394
+ $edd_plugin_url_available[ $store_hash ] = false;
395
+ } else {
396
+ $test_url = $scheme . '://' . $host . $port;
397
+ $response = wp_remote_get( $test_url, array( 'timeout' => $this->health_check_timeout, 'sslverify' => $verify_ssl ) );
398
+ $edd_plugin_url_available[ $store_hash ] = is_wp_error( $response ) ? false : true;
399
+ }
400
+ }
401
+
402
+ if ( false === $edd_plugin_url_available[ $store_hash ] ) {
403
+ return;
404
+ }
405
+
406
+ $data = array_merge( $this->api_data, $_data );
407
+
408
+ if ( $data['slug'] != $this->slug ) {
409
+ return;
410
+ }
411
+
412
+ if( $this->api_url == trailingslashit ( home_url() ) ) {
413
+ return false; // Don't allow a plugin to ping itself
414
+ }
415
+
416
+ $api_params = array(
417
+ 'edd_action' => 'get_version',
418
+ 'license' => ! empty( $data['license'] ) ? $data['license'] : '',
419
+ 'item_name' => isset( $data['item_name'] ) ? $data['item_name'] : false,
420
+ 'item_id' => isset( $data['item_id'] ) ? $data['item_id'] : false,
421
+ 'version' => isset( $data['version'] ) ? $data['version'] : false,
422
+ 'slug' => $data['slug'],
423
+ 'author' => $data['author'],
424
+ 'url' => home_url(),
425
+ 'beta' => ! empty( $data['beta'] ),
426
+ );
427
+
428
+ $request = wp_remote_post( $this->api_url, array( 'timeout' => 15, 'sslverify' => $verify_ssl, 'body' => $api_params ) );
429
+
430
+ if ( ! is_wp_error( $request ) ) {
431
+ $request = json_decode( wp_remote_retrieve_body( $request ) );
432
+ }
433
+
434
+ if ( $request && isset( $request->sections ) ) {
435
+ $request->sections = maybe_unserialize( $request->sections );
436
+ } else {
437
+ $request = false;
438
+ }
439
+
440
+ if ( $request && isset( $request->banners ) ) {
441
+ $request->banners = maybe_unserialize( $request->banners );
442
+ }
443
+
444
+ if ( $request && isset( $request->icons ) ) {
445
+ $request->icons = maybe_unserialize( $request->icons );
446
+ }
447
+
448
+ if( ! empty( $request->sections ) ) {
449
+ foreach( $request->sections as $key => $section ) {
450
+ $request->$key = (array) $section;
451
+ }
452
+ }
453
+
454
+ return $request;
455
+ }
456
+
457
+ public function show_changelog() {
458
+
459
+ global $edd_plugin_data;
460
+
461
+ if( empty( $_REQUEST['edd_sl_action'] ) || 'view_plugin_changelog' != $_REQUEST['edd_sl_action'] ) {
462
+ return;
463
+ }
464
+
465
+ if( empty( $_REQUEST['plugin'] ) ) {
466
+ return;
467
+ }
468
+
469
+ if( empty( $_REQUEST['slug'] ) ) {
470
+ return;
471
+ }
472
+
473
+ if( ! current_user_can( 'update_plugins' ) ) {
474
+ wp_die( __( 'You do not have permission to install plugin updates', 'advanced-database-cleaner' ), __( 'Error', 'advanced-database-cleaner' ), array( 'response' => 403 ) );
475
+ }
476
+
477
+ $data = $edd_plugin_data[ $_REQUEST['slug'] ];
478
+ $beta = ! empty( $data['beta'] ) ? true : false;
479
+ $cache_key = md5( 'edd_plugin_' . sanitize_key( $_REQUEST['plugin'] ) . '_' . $beta . '_version_info' );
480
+ $version_info = $this->get_cached_version_info( $cache_key );
481
+
482
+ if( false === $version_info ) {
483
+
484
+ $api_params = array(
485
+ 'edd_action' => 'get_version',
486
+ 'item_name' => isset( $data['item_name'] ) ? $data['item_name'] : false,
487
+ 'item_id' => isset( $data['item_id'] ) ? $data['item_id'] : false,
488
+ 'slug' => $_REQUEST['slug'],
489
+ 'author' => $data['author'],
490
+ 'url' => home_url(),
491
+ 'beta' => ! empty( $data['beta'] )
492
+ );
493
+
494
+ $verify_ssl = $this->verify_ssl();
495
+ $request = wp_remote_post( $this->api_url, array( 'timeout' => 15, 'sslverify' => $verify_ssl, 'body' => $api_params ) );
496
+
497
+ if ( ! is_wp_error( $request ) ) {
498
+ $version_info = json_decode( wp_remote_retrieve_body( $request ) );
499
+ }
500
+
501
+
502
+ if ( ! empty( $version_info ) && isset( $version_info->sections ) ) {
503
+ $version_info->sections = maybe_unserialize( $version_info->sections );
504
+ } else {
505
+ $version_info = false;
506
+ }
507
+
508
+ if( ! empty( $version_info ) ) {
509
+ foreach( $version_info->sections as $key => $section ) {
510
+ $version_info->$key = (array) $section;
511
+ }
512
+ }
513
+
514
+ $this->set_version_info_cache( $version_info, $cache_key );
515
+
516
+ }
517
+
518
+ if( ! empty( $version_info ) && isset( $version_info->sections['changelog'] ) ) {
519
+ echo '<div style="background:#fff;padding:10px;">' . $version_info->sections['changelog'] . '</div>';
520
+ }
521
+
522
+ exit;
523
+ }
524
+
525
+ public function get_cached_version_info( $cache_key = '' ) {
526
+
527
+ if( empty( $cache_key ) ) {
528
+ $cache_key = $this->cache_key;
529
+ }
530
+
531
+ $cache = get_option( $cache_key );
532
+
533
+ if( empty( $cache['timeout'] ) || time() > $cache['timeout'] ) {
534
+ return false; // Cache is expired
535
+ }
536
+
537
+ // We need to turn the icons into an array, thanks to WP Core forcing these into an object at some point.
538
+ $cache['value'] = json_decode( $cache['value'] );
539
+ if ( ! empty( $cache['value']->icons ) ) {
540
+ $cache['value']->icons = (array) $cache['value']->icons;
541
+ }
542
+
543
+ return $cache['value'];
544
+
545
+ }
546
+
547
+ public function set_version_info_cache( $value = '', $cache_key = '' ) {
548
+
549
+ if( empty( $cache_key ) ) {
550
+ $cache_key = $this->cache_key;
551
+ }
552
+
553
+ $data = array(
554
+ 'timeout' => strtotime( '+3 hours', time() ),
555
+ 'value' => json_encode( $value )
556
+ );
557
+
558
+ update_option( $cache_key, $data, 'no' );
559
+
560
+ }
561
+
562
+ /**
563
+ * Returns if the SSL of the store should be verified.
564
+ *
565
+ * @since 1.6.13
566
+ * @return bool
567
+ */
568
+ private function verify_ssl() {
569
+ return (bool) apply_filters( 'edd_sl_api_request_verify_ssl', true, $this );
570
+ }
571
+
572
+ }
includes/license/adbc-edd-sample-plugin.php ADDED
@@ -0,0 +1,379 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /*
4
+ Plugin Name: Sample Plugin
5
+ Plugin URI: http://pippinsplugins.com/
6
+ Description: Illustrates how to include an updater in your plugin for EDD Software Licensing
7
+ Author: Pippin Williamson
8
+ Author URI: http://pippinsplugins.com
9
+ Version: 1.0
10
+ License: GNU General Public License v2.0 or later
11
+ License URI: http://www.gnu.org/licenses/gpl-2.0.html
12
+ */
13
+
14
+ /***************************************************************************************************************************
15
+ * For further details please visit http://docs.easydigitaldownloads.com/article/383-automatic-upgrades-for-wordpress-plugins
16
+ ***************************************************************************************************************************/
17
+
18
+ // this is the URL our updater / license checker pings. This should be the URL of the site with EDD installed
19
+ define( 'ADBC_EDD_STORE_URL', 'https://sigmaplugin.com' ); // you should use your own CONSTANT name, and be sure to replace it throughout this file
20
+
21
+ // the download ID for the product in Easy Digital Downloads
22
+ define( 'ADBC_EDD_ITEM_ID', 10); // you should use your own CONSTANT name, and be sure to replace it throughout this file
23
+
24
+ // the name of your product. This should match the download name in EDD exactly
25
+ define( 'ADBC_EDD_ITEM_NAME', 'WordPress Advanced Database Cleaner' ); // you should use your own CONSTANT name, and be sure to replace it in this file
26
+
27
+ // The name of the settings page for the license input to be displayed
28
+ define( 'ADBC_EDD_PLUGIN_LICENSE_PAGE', 'advanced_db_cleaner&aDBc_tab=license' );
29
+
30
+ if(!class_exists('ADBC_EDD_SL_Plugin_Updater')){
31
+ // load our custom updater
32
+ include(dirname(__FILE__) . '/ADBC_EDD_SL_Plugin_Updater.php');
33
+ }
34
+
35
+ function aDBc_edd_sl_plugin_updater(){
36
+
37
+ // retrieve our license key from the DB
38
+ $license_key = trim(get_option('aDBc_edd_license_key'));
39
+
40
+ // setup the updater
41
+ $edd_updater = new ADBC_EDD_SL_Plugin_Updater( ADBC_EDD_STORE_URL, ADBC_MAIN_PLUGIN_FILE_PATH, array(
42
+ 'version' => ADBC_PLUGIN_VERSION, // current version number
43
+ 'license' => $license_key, // license key (used get_option above to retrieve from DB)
44
+ 'item_id' => ADBC_EDD_ITEM_ID, // ID of the product
45
+ 'item_name' => ADBC_EDD_ITEM_NAME, // name of the product
46
+ 'author' => 'Younes JFR.', // author of this plugin
47
+ 'beta' => false,
48
+ )
49
+ );
50
+
51
+ }
52
+ add_action('admin_init', 'aDBc_edd_sl_plugin_updater', 0);
53
+
54
+ /**************************************************************************
55
+ * the code below is just a standard options page. Substitute with your own.
56
+ **************************************************************************/
57
+ function aDBc_edd_license_page() {
58
+ $license = get_option( 'aDBc_edd_license_key' );
59
+ $status = get_option( 'aDBc_edd_license_status' );
60
+ // When the user activates the license, hide it by stars like passwords
61
+ if(!empty(trim($license)) && $status !== false && $status == 'valid'){
62
+ $license_key_hidden = substr(trim($license), 0, 4) . "************************" . substr(trim($license), -4);
63
+ }else{
64
+ $license_key_hidden = esc_attr($license);
65
+ }
66
+ ?>
67
+ <form method="post" action="options.php">
68
+
69
+ <?php settings_fields('aDBc_edd_license'); ?>
70
+
71
+ <table style="font-size:15px;text-align:left;" cellspacing="20px">
72
+ <tr>
73
+ <td>
74
+ <b><?php _e('Enter your license key', 'advanced-database-cleaner'); ?></b>
75
+ </td>
76
+ <td>
77
+ <input id="aDBc_edd_license_key" name="aDBc_edd_license_key" type="text" class="regular-text" value="<?php echo $license_key_hidden; ?>" />
78
+ </td>
79
+ <td>
80
+ <input type="submit" name="submit" id="submit" class="button button-primary" value="<?php _e('Save new license key', 'advanced-database-cleaner'); ?>" />
81
+ <?php //submit_button(); ?>
82
+ </td>
83
+ </tr>
84
+
85
+ <?php if(false !== $license){ ?>
86
+ <tr>
87
+ <td>
88
+ <b><?php _e('Activate license', 'advanced-database-cleaner'); ?></b>
89
+ </td>
90
+ <td>
91
+
92
+ <?php if( $status !== false && $status == 'valid' ) { ?>
93
+ <span style="color:green;font-size:13px; background:#eee;padding:4px 8px;vertical-align:middle;border:1px solid #f1f1f1"><b><?php _e('Active', 'advanced-database-cleaner'); ?></b></span>
94
+ <?php wp_nonce_field( 'aDBc_edd_nonce', 'aDBc_edd_nonce' ); ?>
95
+ <input style="vertical-align:middle" type="submit" class="button-secondary" name="aDBc_edd_license_deactivate" value="<?php _e('Deactivate license', 'advanced-database-cleaner'); ?>"/>
96
+ <?php } else { ?>
97
+ <span style="color:red;font-size:13px; background:#f9f9f9;padding:4px 8px;vertical-align:middle;border:1px solid #f1f1f1"><b><?php _e('Inactive', 'advanced-database-cleaner'); ?></b></span>
98
+ <?php wp_nonce_field( 'aDBc_edd_nonce', 'aDBc_edd_nonce' ); ?>
99
+ <input style="vertical-align:middle" type="submit" class="button-secondary" name="aDBc_edd_license_activate" value="<?php _e('Activate license', 'advanced-database-cleaner'); ?>"/>
100
+ <?php } ?>
101
+
102
+ </td>
103
+ </tr>
104
+ <?php } ?>
105
+ </table>
106
+
107
+ </form>
108
+ <?php
109
+ }
110
+
111
+ function aDBc_edd_register_option() {
112
+ // creates our settings in the options table
113
+ register_setting('aDBc_edd_license', 'aDBc_edd_license_key', 'aDBc_edd_sanitize_license');
114
+ }
115
+ add_action('admin_init', 'aDBc_edd_register_option');
116
+
117
+ function aDBc_edd_sanitize_license( $new ) {
118
+ $old = get_option( 'aDBc_edd_license_key' );
119
+ if( $old && $old != $new ) {
120
+ delete_option( 'aDBc_edd_license_status' ); // new license has been entered, so must reactivate
121
+ }
122
+ return $new;
123
+ }
124
+
125
+ /************************************************
126
+ * this illustrates how to activate a license key
127
+ ************************************************/
128
+
129
+ function aDBc_edd_activate_license() {
130
+
131
+ // listen for our activate button to be clicked
132
+ if( isset( $_POST['aDBc_edd_license_activate'] ) ) {
133
+
134
+ // run a quick security check
135
+ if( ! check_admin_referer( 'aDBc_edd_nonce', 'aDBc_edd_nonce' ) )
136
+ return; // get out if we didn't click the Activate button
137
+
138
+ // retrieve the license from the database
139
+ $license = trim( get_option( 'aDBc_edd_license_key' ) );
140
+
141
+
142
+ // data to send in our API request
143
+ $api_params = array(
144
+ 'edd_action' => 'activate_license',
145
+ 'license' => $license,
146
+ 'item_id' => ADBC_EDD_ITEM_ID,
147
+ 'item_name' => urlencode( ADBC_EDD_ITEM_NAME ), // the name of our product in EDD
148
+ 'url' => home_url()
149
+ );
150
+
151
+ // Call the custom API.
152
+ $response = wp_remote_post( ADBC_EDD_STORE_URL, array( 'timeout' => 15, 'sslverify' => false, 'body' => $api_params ) );
153
+
154
+ // make sure the response came back okay
155
+ if ( is_wp_error( $response ) || 200 !== wp_remote_retrieve_response_code( $response ) ) {
156
+
157
+ if ( is_wp_error( $response ) ) {
158
+ $message = $response->get_error_message();
159
+ } else {
160
+ $message = __('An error occurred, please try again.', 'advanced-database-cleaner');
161
+ }
162
+
163
+ } else {
164
+
165
+ $license_data = json_decode( wp_remote_retrieve_body( $response ) );
166
+
167
+ if ( false === $license_data->success ) {
168
+
169
+ switch( $license_data->error ) {
170
+
171
+ case 'expired' :
172
+
173
+ $message = sprintf(
174
+ __('Your license key expired on %s.', 'advanced-database-cleaner'),
175
+ date_i18n( get_option( 'date_format' ), strtotime( $license_data->expires, current_time( 'timestamp' ) ) )
176
+ );
177
+ break;
178
+
179
+ case 'disabled' :
180
+ case 'revoked' :
181
+
182
+ $message = __('Your license key has been disabled.', 'advanced-database-cleaner');
183
+ break;
184
+
185
+ case 'missing' :
186
+
187
+ $message = __('Invalid license key', 'advanced-database-cleaner');
188
+ break;
189
+
190
+ case 'invalid' :
191
+ case 'site_inactive' :
192
+
193
+ $message = __('Your license is not active for this URL.', 'advanced-database-cleaner');
194
+ break;
195
+
196
+ case 'item_name_mismatch' :
197
+
198
+ $message = sprintf( __('This appears to be an invalid license key for %s.', 'advanced-database-cleaner'), ADBC_EDD_ITEM_NAME);
199
+ break;
200
+
201
+ case 'no_activations_left':
202
+
203
+ $message = __('Your license key has reached its activation limit.', 'advanced-database-cleaner');
204
+ break;
205
+
206
+ default :
207
+
208
+ $message = __('An error occurred, please try again.', 'advanced-database-cleaner');
209
+ break;
210
+ }
211
+
212
+ }
213
+
214
+ }
215
+
216
+ // Check if anything passed on a message constituting a failure
217
+ if ( ! empty( $message ) ) {
218
+ $base_url = admin_url( 'admin.php?page=' . ADBC_EDD_PLUGIN_LICENSE_PAGE );
219
+ $redirect = add_query_arg( array( 'sl_activation' => 'false', 'message' => urlencode( $message ) ), $base_url );
220
+
221
+ wp_redirect( $redirect );
222
+ exit();
223
+ }
224
+
225
+ // $license_data->license will be either "valid" or "invalid"
226
+
227
+ update_option('aDBc_edd_license_status', $license_data->license);
228
+ wp_redirect(admin_url('admin.php?page=' . ADBC_EDD_PLUGIN_LICENSE_PAGE));
229
+ exit();
230
+ }
231
+ }
232
+ add_action('admin_init', 'aDBc_edd_activate_license');
233
+
234
+
235
+ /***********************************************
236
+ * Illustrates how to deactivate a license key.
237
+ * This will decrease the site count
238
+ ***********************************************/
239
+
240
+ function aDBc_edd_deactivate_license() {
241
+
242
+ // listen for our activate button to be clicked
243
+ if( isset( $_POST['aDBc_edd_license_deactivate'] ) ) {
244
+
245
+ // run a quick security check
246
+ if( ! check_admin_referer( 'aDBc_edd_nonce', 'aDBc_edd_nonce' ) )
247
+ return; // get out if we didn't click the Activate button
248
+
249
+ // retrieve the license from the database
250
+ $license = trim( get_option( 'aDBc_edd_license_key' ) );
251
+
252
+ // data to send in our API request
253
+ $api_params = array(
254
+ 'edd_action' => 'deactivate_license',
255
+ 'license' => $license,
256
+ 'item_id' => ADBC_EDD_ITEM_ID,
257
+ 'item_name' => urlencode( ADBC_EDD_ITEM_NAME ), // the name of our product in EDD
258
+ 'url' => home_url()
259
+ );
260
+
261
+ // Call the custom API.
262
+ $response = wp_remote_post( ADBC_EDD_STORE_URL, array( 'timeout' => 15, 'sslverify' => false, 'body' => $api_params ) );
263
+
264
+ // make sure the response came back okay
265
+ if ( is_wp_error( $response ) || 200 !== wp_remote_retrieve_response_code( $response ) ) {
266
+
267
+ if ( is_wp_error( $response ) ) {
268
+ $message = $response->get_error_message();
269
+ } else {
270
+ $message = __('An error occurred, please try again.', 'advanced-database-cleaner');
271
+ }
272
+
273
+ $base_url = admin_url( 'admin.php?page=' . ADBC_EDD_PLUGIN_LICENSE_PAGE );
274
+ $redirect = add_query_arg( array( 'sl_activation' => 'false', 'message' => urlencode( $message ) ), $base_url );
275
+
276
+ wp_redirect( $redirect );
277
+ exit();
278
+ }
279
+
280
+ // decode the license data
281
+ $license_data = json_decode( wp_remote_retrieve_body( $response ) );
282
+
283
+ // $license_data->license will be either "deactivated" or "failed"
284
+ if( $license_data->license == 'deactivated' ) {
285
+ delete_option( 'aDBc_edd_license_status' );
286
+ delete_option( 'aDBc_edd_license_key' );
287
+ }
288
+
289
+ wp_redirect( admin_url( 'admin.php?page=' . ADBC_EDD_PLUGIN_LICENSE_PAGE ) );
290
+ exit();
291
+
292
+ }
293
+ }
294
+ add_action('admin_init', 'aDBc_edd_deactivate_license');
295
+
296
+ /***********************************************
297
+ * Deactivate a license key after uninstall.
298
+ * This will descrease the site count
299
+ ***********************************************/
300
+ function aDBc_edd_deactivate_license_after_uninstall() {
301
+
302
+ // retrieve the license from the database
303
+ $license = trim( get_option( 'aDBc_edd_license_key' ) );
304
+
305
+ // data to send in our API request
306
+ $api_params = array(
307
+ 'edd_action'=> 'deactivate_license',
308
+ 'license' => $license,
309
+ 'item_id' => ADBC_EDD_ITEM_ID,
310
+ 'item_name' => urlencode( ADBC_EDD_ITEM_NAME ), // the name of our product in EDD
311
+ 'url' => home_url()
312
+ );
313
+
314
+ // Call the custom API.
315
+ $response = wp_remote_post( ADBC_EDD_STORE_URL, array( 'timeout' => 15, 'sslverify' => false, 'body' => $api_params ) );
316
+ }
317
+
318
+ /*********************************************************************************************
319
+ * this illustrates how to check if a license key is still valid the updater does this for you,
320
+ * so this is only needed if you want to do something custom
321
+ *********************************************************************************************/
322
+ function aDBc_edd_check_license(){
323
+ global $wp_version;
324
+ $license = trim(get_option('aDBc_edd_license_key'));
325
+ $api_params = array(
326
+ 'edd_action' => 'check_license',
327
+ 'license' => $license,
328
+ 'item_id' => ADBC_EDD_ITEM_ID,
329
+ 'item_name' => urlencode( ADBC_EDD_ITEM_NAME ),
330
+ 'url' => home_url()
331
+ );
332
+ // Call the custom API.
333
+ $response = wp_remote_post(ADBC_EDD_STORE_URL, array('timeout' => 15, 'sslverify' => false, 'body' => $api_params));
334
+ if(is_wp_error($response))
335
+ return false;
336
+ $license_data = json_decode(wp_remote_retrieve_body($response));
337
+ if($license_data->license == 'valid'){
338
+ echo 'valid'; exit;
339
+ // this license is still valid
340
+ }else{
341
+ echo 'invalid'; exit;
342
+ // this license is no longer valid
343
+ }
344
+ }
345
+
346
+ /********************************************************************************************************
347
+ * This is a means of catching errors from the activation method above and displaying it to the customer
348
+ *******************************************************************************************************/
349
+ function aDBc_edd_admin_notices(){
350
+ if(isset($_GET['sl_activation']) && ! empty($_GET['message'])){
351
+ switch($_GET['sl_activation']){
352
+ case 'false':
353
+ $message = urldecode($_GET['message']);
354
+ ?>
355
+ <div class="error">
356
+ <p><?php echo $message; ?></p>
357
+ </div>
358
+ <?php
359
+ break;
360
+ case 'true':
361
+ default:
362
+ // Developers can put a custom success message here for when activation is successful if they way.
363
+ break;
364
+ }
365
+ }
366
+ }
367
+ add_action('admin_notices', 'aDBc_edd_admin_notices');
368
+
369
+ /*****************************************************************************************
370
+ * Check if a license is activated
371
+ *****************************************************************************************/
372
+ function aDBc_edd_is_license_activated(){
373
+ $license_status = trim( get_option( 'aDBc_edd_license_status'));
374
+ if($license_status == 'valid'){
375
+ return true;
376
+ }else{
377
+ return false;
378
+ }
379
+ }
includes/optimize_db.php ADDED
@@ -0,0 +1,22 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ if(isset($_GET['aDBc_view'])){
4
+
5
+ if($_GET['aDBc_view'] == "add_optimize_schedule"){
6
+
7
+ include_once 'custom-schedule-view/class_add_optimize_schedule.php';
8
+ new ADBC_SCHEDULE_OPTIMIZE();
9
+
10
+ }else if($_GET['aDBc_view'] == "edit_optimize_schedule"){
11
+
12
+ include_once 'custom-schedule-view/class_edit_optimize_schedule.php';
13
+ new EDIT_SCHEDULE_OPTIMIZE();
14
+
15
+ }
16
+
17
+ }else{
18
+ // Else return the general clean-up page
19
+ include_once 'class_clean_tables.php';
20
+ }
21
+
22
+ ?>
includes/overview_settings.php CHANGED
@@ -11,41 +11,61 @@ if($aDBc_db_size >= 1024){
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');
@@ -58,8 +78,13 @@ if(function_exists('is_multisite') && is_multisite()){
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">
@@ -104,7 +129,7 @@ if(isset($_POST['save_settings'])){
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>
@@ -115,22 +140,51 @@ if(isset($_POST['save_settings'])){
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>
11
  $aDBc_unused_elements = aDBc_count_all_elements_to_clean();
12
  $aDBc_total_unused = 0;
13
  foreach($aDBc_unused_elements as $element_type => $element_info){
14
+ // Count total unused elements. DO not take into account transient with expiration and not expiring transients because they are not intended to be cleaned
15
+ if($element_type != "transients-with-expiration" && $element_type != "transients-with-no-expiration")
16
+ $aDBc_total_unused += $element_info['count'];
17
  }
18
  // Total tables
19
  $aDBc_total_tables = $wpdb->get_var("SELECT count(*) FROM information_schema.tables WHERE table_schema = '" . DB_NAME . "'");
20
  // Total options
21
  if(function_exists('is_multisite') && is_multisite()){
22
+
23
+ $aDBc_options_toolip = "<span class='aDBc-tooltips-headers'>
24
+ <img class='aDBc-info-image' src='". ADBC_PLUGIN_DIR_PATH . '/images/information2.svg' . "'/>
25
+ <span>" . __('Indicates the total number of rows in your option tables of all your network sites, including transients...','advanced-database-cleaner') ." </span>
26
+ </span>";
27
+
28
  }else{
29
+
30
+ $aDBc_options_toolip = "<span class='aDBc-tooltips-headers'>
31
+ <img class='aDBc-info-image' src='". ADBC_PLUGIN_DIR_PATH . '/images/information2.svg' . "'/>
32
+ <span>" . __('Indicates the total number of rows in your options table, including transients...','advanced-database-cleaner') ." </span>
33
+ </span>";
34
+
35
  }
36
+ // Total options
37
  $aDBc_total_options = 0;
38
  if(function_exists('is_multisite') && is_multisite()){
39
  $blogs_ids = $wpdb->get_col("SELECT blog_id FROM $wpdb->blogs");
40
  foreach($blogs_ids as $blog_id){
41
  switch_to_blog($blog_id);
42
+ global $wpdb;
43
+ $aDBc_total_options += $wpdb->get_var("SELECT count(*) FROM $wpdb->options");
44
  restore_current_blog();
45
  }
46
  }else{
47
+ // Count total options
48
  $aDBc_total_options = $wpdb->get_var("SELECT count(*) FROM $wpdb->options");
49
  }
50
+
 
51
  // Total scheduled tasks
52
  $aDBc_all_tasks = aDBc_get_all_scheduled_tasks();
53
  $aDBc_total_tasks = 0;
54
+ if(function_exists('is_multisite') && is_multisite()){
55
+ foreach($aDBc_all_tasks as $hook => $task_info){
56
+ foreach($task_info['sites'] as $site => $info){
57
+ $aDBc_total_tasks += count($task_info['sites'][$site]['args']);
58
+ }
59
+ }
60
+ }else{
61
+ foreach($aDBc_all_tasks as $hook => $task_info){
62
+ $aDBc_total_tasks += count($task_info['sites'][1]['args']);
63
+ }
64
  }
65
+
66
+ // Total tables to optimize
67
+ $aDBc_tables_to_optimize = $wpdb->get_var("SELECT count(*) FROM information_schema.tables WHERE table_schema = '" . DB_NAME . "' and Engine <> 'InnoDB' and data_free > 0");
68
+
69
  // Is MU?
70
  if(function_exists('is_multisite') && is_multisite()){
71
  $aDBc_is_mu = __('Yes', 'advanced-database-cleaner');
78
  // Get settings
79
  global $aDBc_settings;
80
  if(isset($_POST['save_settings'])){
81
+ if(isset($_POST['aDBc_left_menu']) || isset($_POST['aDBc_menu_under_tools'])){
82
+ echo '<div id="aDBc_message" class="updated notice is-dismissible"><p>' . __('Settings saved successfully!', 'advanced-database-cleaner') . '</p></div>';
83
+ }else{
84
+ echo '<div id="aDBc_message" class="updated notice is-dismissible"><p>' . __('Settings saved successfully! The default position of the plugin menu is the left side of the admin panel', 'advanced-database-cleaner') . '</p></div>';
85
+ }
86
  }
87
+
88
  ?>
89
 
90
  <div class="aDBc-content-max-width">
129
  </li>
130
  <li>
131
  <div class="aDBc-overview-text-left"><?php _e('Script Max timeout', 'advanced-database-cleaner'); ?> :</div>
132
+ <div class="aDBc-overview-text-right"><?php echo ADBC_ORIGINAL_TIMEOUT . " ". __('seconds', 'advanced-database-cleaner'); ?></div>
133
  </li>
134
  <li>
135
  <div class="aDBc-overview-text-left"><?php _e('Local time', 'advanced-database-cleaner'); ?> :</div>
140
 
141
  <div class="aDBc-overview-box">
142
  <div class="aDBc-overview-box-head"><?php _e('Settings', 'advanced-database-cleaner'); ?></div>
143
+
144
  <form action="" method="post">
145
+ <ul class="aDBc-overview-box-line" style="margin-left:0px">
146
+
147
+ <li style="background:#f9f9f9;margin-bottom:0px;padding:10px">
148
+
149
+ <?php
150
+ if((!empty($aDBc_settings['left_menu']) && $aDBc_settings['left_menu'] == '1') ||
151
+ (empty($aDBc_settings['left_menu']) && empty($aDBc_settings['menu_under_tools']))){
152
+ $aDBc_checked = "checked='checked'";
153
+ }else{
154
+ $aDBc_checked = "";
155
+ }
156
+ ?>
157
+
158
+ <input type="checkbox" name="aDBc_left_menu" <?php echo $aDBc_checked ?>/>
159
  <?php _e('Show plugin left menu', 'advanced-database-cleaner'); ?>
160
  <div class="aDBc-overview-setting-desc">
161
+ <?php _e('Displays a menu at the left side of your WP admin', 'advanced-database-cleaner'); ?>
162
  </div>
163
  </li>
164
+
165
+ <li style="background:#f9f9f9;margin-top:0px;padding:10px">
166
+ <input type="checkbox" name="aDBc_menu_under_tools" <?php echo (!empty($aDBc_settings['menu_under_tools']) && $aDBc_settings['menu_under_tools'] == '1') ? "checked='checked'" : ""?>/>
167
+ <?php _e('Show plugin menu under tools', 'advanced-database-cleaner'); ?>
168
  <div class="aDBc-overview-setting-desc">
169
+ <?php _e('Displays a menu under "tools" menu', 'advanced-database-cleaner'); ?>
170
  </div>
171
+ </li>
172
+
173
+ <?php
174
+ if(ADBC_PLUGIN_F_TYPE == "free"){
175
+ ?>
176
+ <li>
177
+ <input type="checkbox" name="aDBc_hide_premium_tab" <?php echo (!empty($aDBc_settings['hide_premium_tab']) && $aDBc_settings['hide_premium_tab']) == '1' ? "checked='checked'" : ""?>/>
178
+ <?php _e('Hide premium tab', 'advanced-database-cleaner'); ?>
179
+ <div class="aDBc-overview-setting-desc">
180
+ <?php _e('If checked, it will hide the above premium tab', 'advanced-database-cleaner'); ?>
181
+ </div>
182
+ </li>
183
+
184
+ <?php
185
+ }
186
+ ?>
187
+
188
  </ul>
189
  <input name="save_settings" type="submit" class="button-primary aDBc-save-settings-button" value="<?php _e('Save settings','advanced-database-cleaner'); ?>" />
190
  </form>
includes/premium_page.php CHANGED
@@ -7,10 +7,10 @@
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>
@@ -23,10 +23,10 @@
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>
@@ -35,7 +35,7 @@
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'?>"/>
7
  </div>
8
  <div class="aDBc-margin-t-20">
9
  <ul>
10
+ <li class="aDBc-check-list"><?php _e('Filter & search specific items', 'advanced-database-cleaner'); ?></li>
11
+ <li class="aDBc-check-list"><?php _e('Detect orphaned options', 'advanced-database-cleaner'); ?></li>
12
+ <li class="aDBc-check-list"><?php _e('Detect orphaned tables', 'advanced-database-cleaner'); ?></li>
13
+ <li class="aDBc-check-list"><?php _e('Detect orphaned cron tasks', 'advanced-database-cleaner'); ?></li>
14
  </ul>
15
  </div>
16
  </div>
23
  </div>
24
  <div class="aDBc-margin-t-20">
25
  <ul>
26
+ <li class="aDBc-check-list"><?php _e('Get quick support', 'advanced-database-cleaner'); ?></li>
27
  <li class="aDBc-check-list"><?php _e('Get technical support', 'advanced-database-cleaner'); ?></li>
28
  <li class="aDBc-check-list"><?php _e('No additional fees', 'advanced-database-cleaner'); ?></li>
29
+ <li class="aDBc-check-list"><?php _e('Great support service!', 'advanced-database-cleaner'); ?></li>
30
  </ul>
31
  </div>
32
  </div>
35
  <a href="https://sigmaplugin.com/downloads/wordpress-advanced-database-cleaner" target="_blank">
36
  <div class="aDBc-vertical-box-head"><?php _e('Buy now!', 'advanced-database-cleaner'); ?></div>
37
  </a>
38
+ <div class="aDBc-vertical-box-line1"><?php _e('Buy now and get all pro features!', 'advanced-database-cleaner'); ?></div>
39
  <a href="https://sigmaplugin.com/downloads/wordpress-advanced-database-cleaner" target="_blank">
40
  <div class="aDBc-vertical-box-line2">
41
  <img src="<?php echo ADBC_PLUGIN_DIR_PATH . '/images/premium_ok.png'?>"/>
includes/sidebar.php CHANGED
@@ -1,42 +1,37 @@
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>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
 
 
 
 
 
 
 
 
 
 
 
2
 
3
+ <?php
4
+ if(ADBC_PLUGIN_F_TYPE == "free"){
5
+ ?>
6
+
7
+ <div style="margin-top:10px">
8
+
9
+ <div id="aDBc-upgrade">
10
+
11
+ <a target="_blank" href="https://sigmaplugin.com/downloads/wordpress-advanced-database-cleaner">
12
+
13
+ <img style="width:80px" src="<?php echo ADBC_PLUGIN_DIR_PATH; ?>/images/premium.svg" />
14
+
15
+ <h1 style="padding-top:20px;padding-bottom:5px"><?php _e('Upgrade to Pro', 'advanced-database-cleaner'); ?></h1>
16
+
17
+ <ul>
18
+ <li><span class="dashicons dashicons-yes"></span> <?php _e('Filter & search specific items', 'advanced-database-cleaner'); ?></li>
19
+ <li><span class="dashicons dashicons-yes"></span> <?php _e('Detect orphaned options', 'advanced-database-cleaner'); ?></li>
20
+ <li><span class="dashicons dashicons-yes"></span> <?php _e('Detect orphaned tables', 'advanced-database-cleaner'); ?></li>
21
+ <li><span class="dashicons dashicons-yes"></span> <?php _e('Detect orphaned cron tasks', 'advanced-database-cleaner'); ?></li>
22
+ <li><span class="dashicons dashicons-yes"></span> <?php _e('Premium & technical support', 'advanced-database-cleaner'); ?></li>
23
+ </ul>
24
+
25
+
26
+ <div style="text-align:center;border-top:1px dashed #ccc;padding:10px;color:#999"><?php echo __('The price will increase soon! Buy now at lower price!', 'advanced-database-cleaner' ); ?></div>
27
+
28
+ </a>
29
+
30
+ </div>
31
+
32
  </div>
33
+
34
+ <?php
35
+ }
36
+ ?>
37
+
index.php CHANGED
@@ -1,3 +1,3 @@
1
  <?php
2
- #Silence is golden
3
  ?>
1
  <?php
2
+ #Silence is golden.
3
  ?>
js/admin.js CHANGED
@@ -1,13 +1,157 @@
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");
@@ -26,7 +170,25 @@ jQuery(function($) {
26
  }
27
  }
28
  });
29
- var $select_action = $("#aDBc_dialog2");
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
30
  $select_action.dialog({
31
  'dialogClass' : 'wp-dialog',
32
  'modal' : true,
@@ -45,6 +207,9 @@ jQuery(function($) {
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');
@@ -56,6 +221,9 @@ jQuery(function($) {
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');
1
  jQuery(document).ready(function(){
2
 
3
+ var aDBc_item_type = jQuery("#aDBc_item_type").attr('value');
4
+
5
+ if(aDBc_item_type == "tables" || aDBc_item_type == "options" || aDBc_item_type == "tasks"){
6
+
7
+ var still_searching = jQuery("#aDBc_still_searching").attr('value');
8
+ var iteration = jQuery("#aDBc_iteration").attr('value');
9
+
10
+ // When we load a page, test if ajax is still processing in background. If so, disable button
11
+ if(still_searching == "yes"){
12
+ jQuery('#aDBc_new_search_button').attr("value", aDBc_ajax_obj.sentence_scanning);
13
+ jQuery('#aDBc_new_search_button').css('background-image', 'url(' + aDBc_ajax_obj.images_path + 'loading20px.svg)');
14
+ jQuery('#aDBc_new_search_button').attr("disabled", true);
15
+ }
16
+
17
+ // After reload page, check if we should call ajax processing, if so, proceed even before clicking the button to continue after timeout
18
+ if(still_searching == "" && iteration != ""){
19
+
20
+ jQuery('#aDBc_new_search_button').attr("value", aDBc_ajax_obj.sentence_scanning);
21
+ jQuery('#aDBc_new_search_button').css('background-image', 'url(' + aDBc_ajax_obj.images_path + 'loading20px.svg)');
22
+ jQuery('#aDBc_new_search_button').attr("disabled", true);
23
+ jQuery('#aDBc_progress_container').show();
24
+
25
+ jQuery.ajax({
26
+ type : "post",
27
+ url: aDBc_ajax_obj.ajaxurl,
28
+ cache: false,
29
+ data: {
30
+ 'action': 'aDBc_new_run_search_for_items',
31
+ 'aDBc_item_type': aDBc_item_type
32
+ },
33
+ success: function(result) {
34
+
35
+ },
36
+ complete: function(){
37
+ // wait for 1 sec then reload the page.
38
+ setTimeout(function(){
39
+ location.reload();
40
+ }, 1000);
41
+ }
42
+ });
43
+ setTimeout(getProgress, 500);
44
+ }
45
+
46
+ }
47
+
48
+ jQuery('#aDBc_new_search_button').on('click', function(e){
49
+
50
+ var me = jQuery(this);
51
+ e.preventDefault();
52
+
53
+ me.attr("value", aDBc_ajax_obj.sentence_scanning);
54
+ me.css('background-image', 'url(' + aDBc_ajax_obj.images_path + 'loading20px.svg)');
55
+ me.attr("disabled", true);
56
+ jQuery('#aDBc-progress-bar').html("0%");
57
+ jQuery('#aDBc_progress_container').show();
58
+
59
+ var aDBc_item_type = jQuery("#aDBc_item_type").attr('value');
60
+
61
+ jQuery.ajax({
62
+ type : "post",
63
+ url: aDBc_ajax_obj.ajaxurl,
64
+ cache: false,
65
+ data: {
66
+ 'action': 'aDBc_new_run_search_for_items',
67
+ 'aDBc_item_type': aDBc_item_type
68
+ },
69
+ success: function(result) {
70
+
71
+ jQuery('#aDBc-progress-bar').html("100 %");
72
+ jQuery('#aDBc-progress-bar').css("width", "100%");
73
+
74
+ },
75
+ complete: function(){
76
+ // wait for 1 sec then reload the page.
77
+ setTimeout(function(){
78
+ location.reload();
79
+ }, 1000);
80
+
81
+ }
82
+ });
83
+ setTimeout(getProgress, 500);
84
+ return false;
85
+ });
86
+
87
+ function getProgress(){
88
+
89
+ var aDBc_item_type = jQuery("#aDBc_item_type").attr('value');
90
+
91
+ jQuery.ajax({
92
+ type : "post",
93
+ url: aDBc_ajax_obj.ajaxurl,
94
+ data: {
95
+ 'action': 'aDBc_get_progress_bar_width',
96
+ 'aDBc_item_type': aDBc_item_type
97
+ },
98
+ dataType : 'json',
99
+ success: function(result) {
100
+ var current = result['aDBc_progress'];
101
+ var total = result['aDBc_total_items'];
102
+ var stop = result['aDBc_stop'];
103
+ if(stop == false){
104
+ // xxx to delete console log
105
+ // console.log(result);
106
+ if(current > 0 && total > 0){
107
+ jQuery('#aDBc-progress-bar').html(parseInt(current * (100/total)) + "%");
108
+ jQuery('#aDBc-progress-bar').css("width", parseInt(current * (100/total)) + "%");
109
+ }
110
+ setTimeout(getProgress, 1000);
111
+ }
112
+ }
113
+ });
114
+ }
115
+
116
+ jQuery('.aDBc_keep_link').click(function(event){
117
+
118
+ var idelement = (event.target.id).split("_");
119
+ var itemname = idelement[idelement.length-1];
120
+
121
+ jQuery("#aDBc_edit_keep_"+itemname).hide();
122
+ jQuery("#aDBc_keep_label_"+itemname).hide();
123
+
124
+ jQuery('#aDBc_keep_input_'+itemname).show();
125
+ jQuery('#aDBc_keep_button_'+itemname).show();
126
+ jQuery('#aDBc_keep_cancel_'+itemname).show();
127
+
128
+ jQuery('.aDBc_keep_link').css("pointer-events", "none");
129
+ jQuery('.aDBc_keep_link').css("cursor", "default");
130
+ jQuery('.aDBc_keep_link').css("color", "#eee");
131
+
132
+ });
133
+
134
+ jQuery('.aDBc_keep_cancel_link').click(function(event){
135
+
136
+ var idelement = (event.target.id).split("_");
137
+ var itemname = idelement[idelement.length-1];
138
+
139
+ jQuery('#aDBc_keep_input_'+itemname).hide();
140
+ jQuery('#aDBc_keep_button_'+itemname).hide();
141
+ jQuery('#aDBc_keep_cancel_'+itemname).hide();
142
+
143
+ jQuery("#aDBc_edit_keep_"+itemname).show();
144
+ jQuery("#aDBc_keep_label_"+itemname).show();
145
+
146
+ jQuery('.aDBc_keep_link').css("pointer-events", "");
147
+ jQuery('.aDBc_keep_link').css("cursor", "pointer");
148
+ jQuery('.aDBc_keep_link').css("color", "");
149
+
150
  });
151
 
152
  });
153
 
154
+
155
  jQuery(function($) {
156
 
157
  var $delete_warning = $("#aDBc_dialog1");
170
  }
171
  }
172
  });
173
+
174
+ var $empty_warning = $("#aDBc_dialog2");
175
+ $empty_warning.dialog({
176
+ 'dialogClass' : 'wp-dialog',
177
+ 'modal' : true,
178
+ 'width' : 500,
179
+ 'autoOpen' : false,
180
+ 'closeOnEscape' : true,
181
+ 'buttons' : {
182
+ "Close": function() {
183
+ $(this).dialog('close');
184
+ },
185
+ "Continue": function() {
186
+ $('form[id="aDBc_form"]').submit();
187
+ }
188
+ }
189
+ });
190
+
191
+ var $select_action = $("#aDBc_dialogx");
192
  $select_action.dialog({
193
  'dialogClass' : 'wp-dialog',
194
  'modal' : true,
207
  if($bulk_action == 'delete' || $bulk_action == 'clean'){
208
  event.preventDefault();
209
  $delete_warning.dialog('open');
210
+ }else if($bulk_action == 'empty'){
211
+ event.preventDefault();
212
+ $empty_warning.dialog('open');
213
  }else if($bulk_action == '-1'){
214
  event.preventDefault();
215
  $select_action.dialog('open');
221
  if($bulk_action == 'delete' || $bulk_action == 'clean'){
222
  event.preventDefault();
223
  $delete_warning.dialog('open');
224
+ }else if($bulk_action == 'empty'){
225
+ event.preventDefault();
226
+ $empty_warning.dialog('open');
227
  }else if($bulk_action == '-1'){
228
  event.preventDefault();
229
  $select_action.dialog('open');
languages/advanced-database-cleaner.pot ADDED
@@ -0,0 +1,1565 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #, fuzzy
2
+ msgid ""
3
+ msgstr ""
4
+ "Plural-Forms: nplurals=INTEGER; plural=EXPRESSION;\n"
5
+ "Project-Id-Version: Advanced Database Cleaner PRO\n"
6
+ "POT-Creation-Date: 2019-11-05 19:41+0100\n"
7
+ "PO-Revision-Date: 2019-11-05 19:40+0100\n"
8
+ "Last-Translator: \n"
9
+ "Language-Team: \n"
10
+ "MIME-Version: 1.0\n"
11
+ "Content-Type: text/plain; charset=UTF-8\n"
12
+ "Content-Transfer-Encoding: 8bit\n"
13
+ "X-Generator: Poedit 2.2.4\n"
14
+ "X-Poedit-Basepath: ..\n"
15
+ "X-Poedit-Flags-xgettext: --add-comments=translators:\n"
16
+ "X-Poedit-WPHeader: advanced-db-cleaner.php\n"
17
+ "X-Poedit-SourceCharset: UTF-8\n"
18
+ "X-Poedit-KeywordsList: __;_e;_n:1,2;_x:1,2c;_ex:1,2c;_nx:4c,1,2;esc_attr__;"
19
+ "esc_attr_e;esc_attr_x:1,2c;esc_html__;esc_html_e;esc_html_x:1,2c;_n_noop:1,2;"
20
+ "_nx_noop:3c,1,2;__ngettext_noop:1,2\n"
21
+ "X-Poedit-SearchPath-0: .\n"
22
+ "X-Poedit-SearchPathExcluded-0: *.min.js\n"
23
+
24
+ #: advanced-db-cleaner.php:159
25
+ msgid ""
26
+ "The free version of Advanced DB Cleaner has been de-activated since the pro "
27
+ "version is active."
28
+ msgstr ""
29
+
30
+ #: advanced-db-cleaner.php:164
31
+ msgid ""
32
+ "The old pro of Advanced DB Cleaner has been de-activated since the new pro "
33
+ "version is active."
34
+ msgstr ""
35
+
36
+ #: advanced-db-cleaner.php:203
37
+ msgid "Scanning ..."
38
+ msgstr ""
39
+
40
+ #: advanced-db-cleaner.php:219
41
+ msgid "Once weekly"
42
+ msgstr ""
43
+
44
+ #: advanced-db-cleaner.php:224
45
+ msgid "Once monthly"
46
+ msgstr ""
47
+
48
+ #: advanced-db-cleaner.php:459
49
+ #, php-format
50
+ msgid ""
51
+ "Awesome! You have been using <a href=\"admin.php?page=advanced_db_cleaner"
52
+ "\">Advanced DB Cleaner</a> for more than 1 week. Would you mind taking a few "
53
+ "seconds to give it a 5-star rating on WordPress? Thank you in advance :) <a "
54
+ "href=\"%2$s\" target=\"_blank\">Ok, you deserved it</a> | <a href=\"%1$s\">I "
55
+ "already did</a> | <a href=\"%1$s\">No, not good enough</a>"
56
+ msgstr ""
57
+
58
+ #: advanced-db-cleaner.php:525
59
+ msgid "By"
60
+ msgstr ""
61
+
62
+ #: advanced-db-cleaner.php:528
63
+ msgid "Need help?"
64
+ msgstr ""
65
+
66
+ #: advanced-db-cleaner.php:529
67
+ msgid "Contact me"
68
+ msgstr ""
69
+
70
+ #: advanced-db-cleaner.php:539
71
+ msgid "Support"
72
+ msgstr ""
73
+
74
+ #: advanced-db-cleaner.php:551
75
+ msgid ""
76
+ "Please activate your license key to get lifetime automatic updates and "
77
+ "support."
78
+ msgstr ""
79
+
80
+ #: advanced-db-cleaner.php:551
81
+ msgid "Activate now"
82
+ msgstr ""
83
+
84
+ #: advanced-db-cleaner.php:563
85
+ msgid "Important notice to premium users!"
86
+ msgstr ""
87
+
88
+ #: advanced-db-cleaner.php:568
89
+ msgid ""
90
+ "You will probably lose the pro version after this upgrade (This is due to a "
91
+ "conflict between the free and pro versions which is now solved). If it is "
92
+ "the case, please follow these <a target =\"_blank\" href=\"https://"
93
+ "sigmaplugin.com/blog/restore-pro-version-after-upgrade-to-3-0-0\">steps to "
94
+ "restore your pro version</a> with all new features. Thank you :)"
95
+ msgstr ""
96
+
97
+ #: advanced-db-cleaner.php:570
98
+ msgid ""
99
+ "If you are not a premium user, please kindly just close this message since "
100
+ "you are not concerned by this issue!"
101
+ msgstr ""
102
+
103
+ #: advanced-db-cleaner.php:586
104
+ msgid "General clean-up"
105
+ msgstr ""
106
+
107
+ #: advanced-db-cleaner.php:587 includes/class_clean_tables.php:40
108
+ msgid "Tables"
109
+ msgstr ""
110
+
111
+ #: advanced-db-cleaner.php:588 includes/class_clean_options.php:33
112
+ msgid "Options"
113
+ msgstr ""
114
+
115
+ #: advanced-db-cleaner.php:589
116
+ msgid "Cron jobs"
117
+ msgstr ""
118
+
119
+ #: advanced-db-cleaner.php:590
120
+ msgid "Overview & settings"
121
+ msgstr ""
122
+
123
+ #: advanced-db-cleaner.php:591
124
+ msgid "Premium"
125
+ msgstr ""
126
+
127
+ #: advanced-db-cleaner.php:592
128
+ msgid "License"
129
+ msgstr ""
130
+
131
+ #: includes/class_clean_cron.php:32
132
+ msgid "Task"
133
+ msgstr ""
134
+
135
+ #: includes/class_clean_cron.php:33
136
+ msgid "Tasks"
137
+ msgstr ""
138
+
139
+ #: includes/class_clean_cron.php:47 includes/class_clean_options.php:47
140
+ #: includes/class_clean_tables.php:54
141
+ msgid "The process of scanning has finished with success!"
142
+ msgstr ""
143
+
144
+ #: includes/class_clean_cron.php:55 includes/class_clean_options.php:55
145
+ #: includes/class_clean_tables.php:62
146
+ #, php-format
147
+ msgid ""
148
+ "The plugin needs to create the following directory \"%1$s\" to save the scan "
149
+ "results but this was not possible automatically. Please create that "
150
+ "directory manually and set correct permissions so it can be writable by the "
151
+ "plugin."
152
+ msgstr ""
153
+
154
+ #: includes/class_clean_cron.php:84
155
+ msgid ""
156
+ "Indicates the creator of the task: either a plugin, a theme or WordPress "
157
+ "itself. If not sure about the creator, an estimation (%) will be displayed. "
158
+ "The higher the percentage is, the more likely that the task belongs to that "
159
+ "creator."
160
+ msgstr ""
161
+
162
+ #: includes/class_clean_cron.php:88
163
+ msgid "Hook name"
164
+ msgstr ""
165
+
166
+ #: includes/class_clean_cron.php:89
167
+ msgid "Arguments"
168
+ msgstr ""
169
+
170
+ #: includes/class_clean_cron.php:90
171
+ msgid "Next run - Frequency"
172
+ msgstr ""
173
+
174
+ #: includes/class_clean_cron.php:91 includes/class_clean_options.php:98
175
+ #: includes/class_clean_tables.php:141 includes/header_page_filter.php:107
176
+ msgid "Site"
177
+ msgstr ""
178
+
179
+ #: includes/class_clean_cron.php:92 includes/class_clean_options.php:99
180
+ #: includes/class_clean_tables.php:142
181
+ msgid "Belongs to"
182
+ msgstr ""
183
+
184
+ #: includes/class_clean_cron.php:142
185
+ msgid "None"
186
+ msgstr ""
187
+
188
+ #: includes/class_clean_cron.php:166 includes/class_clean_options.php:169
189
+ #: includes/class_clean_tables.php:232 includes/class_clean_tables.php:571
190
+ #: includes/class_general_cleanup.php:376
191
+ msgid "Delete"
192
+ msgstr ""
193
+
194
+ #: includes/class_clean_cron.php:173
195
+ msgid "No tasks found!"
196
+ msgstr ""
197
+
198
+ #: includes/class_clean_cron.php:246
199
+ msgid "Selected scheduled tasks cleaned successfully!"
200
+ msgstr ""
201
+
202
+ #: includes/class_clean_cron.php:262
203
+ msgid ""
204
+ "The process of categorization is still scanning tasks in background. Maybe "
205
+ "you have reloaded the page before it finishes the scan. The scan will stop "
206
+ "automatically after scanning all items or after timeout."
207
+ msgstr ""
208
+
209
+ #: includes/class_clean_cron.php:283
210
+ msgid ""
211
+ "Tasks below seem to be orphan! However, please delete only those you are "
212
+ "sure to be orphan!"
213
+ msgstr ""
214
+
215
+ #: includes/class_clean_cron.php:285
216
+ msgid ""
217
+ "Some of your tasks are not categorized yet! Please click on the button below "
218
+ "to categorize them!"
219
+ msgstr ""
220
+
221
+ #: includes/class_clean_cron.php:296
222
+ msgid "Scan tasks"
223
+ msgstr ""
224
+
225
+ #: includes/class_clean_cron.php:298 includes/class_clean_options.php:329
226
+ #: includes/class_clean_tables.php:369
227
+ msgid "Continue scannig ..."
228
+ msgstr ""
229
+
230
+ #: includes/class_clean_cron.php:316
231
+ msgid ""
232
+ "Please <a href=\"?page=advanced_db_cleaner&aDBc_tab=premium\">upgrade</a> to "
233
+ "Pro to categorize and detect orphaned tasks"
234
+ msgstr ""
235
+
236
+ #: includes/class_clean_cron.php:358 includes/class_clean_options.php:389
237
+ #: includes/class_clean_tables.php:429
238
+ #: includes/custom-clean-view/header_page_custom_clean.php:58
239
+ #: includes/functions.php:569 includes/header_page_filter.php:124
240
+ msgid "Available in Pro version!"
241
+ msgstr ""
242
+
243
+ #: includes/class_clean_cron.php:391 includes/class_clean_options.php:422
244
+ #: includes/class_clean_tables.php:596 includes/class_clean_tables.php:604
245
+ #: includes/class_general_cleanup.php:398
246
+ msgid "Cleaning..."
247
+ msgstr ""
248
+
249
+ #: includes/class_clean_cron.php:393
250
+ msgid ""
251
+ "You are about to clean some of your scheduled tasks. This operation is "
252
+ "irreversible!"
253
+ msgstr ""
254
+
255
+ #: includes/class_clean_cron.php:393 includes/class_clean_options.php:424
256
+ #: includes/class_clean_tables.php:598 includes/class_clean_tables.php:606
257
+ #: includes/class_general_cleanup.php:400
258
+ #: includes/custom-clean-view/page_custom_clean.php:25
259
+ msgid "Don't forget to make a backup of your database first."
260
+ msgstr ""
261
+
262
+ #: includes/class_clean_cron.php:396 includes/class_clean_options.php:427
263
+ #: includes/class_clean_tables.php:601 includes/class_clean_tables.php:609
264
+ #: includes/class_general_cleanup.php:403
265
+ #: includes/custom-clean-view/page_custom_clean.php:28
266
+ msgid "Are you sure to continue?"
267
+ msgstr ""
268
+
269
+ #: includes/class_clean_cron.php:399 includes/class_clean_options.php:430
270
+ #: includes/class_clean_tables.php:612 includes/class_general_cleanup.php:406
271
+ #: includes/custom-clean-view/page_custom_clean.php:31
272
+ msgid "Action required"
273
+ msgstr ""
274
+
275
+ #: includes/class_clean_cron.php:401 includes/class_clean_options.php:432
276
+ #: includes/class_general_cleanup.php:408
277
+ #: includes/custom-clean-view/page_custom_clean.php:33
278
+ msgid "Please select an action!"
279
+ msgstr ""
280
+
281
+ #: includes/class_clean_options.php:32
282
+ msgid "Option"
283
+ msgstr ""
284
+
285
+ #: includes/class_clean_options.php:84
286
+ msgid ""
287
+ "Indicates the creator of the option: either a plugin, a theme or WordPress "
288
+ "itself. If not sure about the creator, an estimation (%) will be displayed. "
289
+ "The higher the percentage is, the more likely that the option belongs to "
290
+ "that creator."
291
+ msgstr ""
292
+
293
+ #: includes/class_clean_options.php:89
294
+ msgid "The size is in Bits! This is an estimation, not a precise value!"
295
+ msgstr ""
296
+
297
+ #: includes/class_clean_options.php:94
298
+ msgid "Option name"
299
+ msgstr ""
300
+
301
+ #: includes/class_clean_options.php:95
302
+ #: includes/custom-clean-view/class_clean_transient.php:160
303
+ #: includes/custom-clean-view/header_page_custom_clean.php:49
304
+ msgid "Value"
305
+ msgstr ""
306
+
307
+ #: includes/class_clean_options.php:96 includes/class_clean_tables.php:139
308
+ msgid "Size"
309
+ msgstr ""
310
+
311
+ #: includes/class_clean_options.php:97
312
+ #: includes/custom-clean-view/class_clean_transient.php:162
313
+ #: includes/header_page_filter.php:54
314
+ msgid "Autoload"
315
+ msgstr ""
316
+
317
+ #: includes/class_clean_options.php:170
318
+ msgid "Set autoload to yes"
319
+ msgstr ""
320
+
321
+ #: includes/class_clean_options.php:171
322
+ msgid "Set autoload to no"
323
+ msgstr ""
324
+
325
+ #: includes/class_clean_options.php:178
326
+ msgid "No options found!"
327
+ msgstr ""
328
+
329
+ #: includes/class_clean_options.php:220
330
+ msgid "Selected options cleaned successfully!"
331
+ msgstr ""
332
+
333
+ #: includes/class_clean_options.php:255 includes/class_clean_options.php:272
334
+ msgid ""
335
+ "For technical concerns, the option aDBc_edd_license_key cannot be changed!"
336
+ msgstr ""
337
+
338
+ #: includes/class_clean_options.php:277
339
+ msgid "Autoload value successfully changed!"
340
+ msgstr ""
341
+
342
+ #: includes/class_clean_options.php:293
343
+ msgid ""
344
+ "The process of categorization is still scanning options in background. Maybe "
345
+ "you have reloaded the page before it finishes the scan. The scan will stop "
346
+ "automatically after scanning all items or after timeout."
347
+ msgstr ""
348
+
349
+ #: includes/class_clean_options.php:314
350
+ msgid ""
351
+ "Options below seem to be orphan! However, please delete only those you are "
352
+ "sure to be orphan!"
353
+ msgstr ""
354
+
355
+ #: includes/class_clean_options.php:316
356
+ msgid ""
357
+ "Some of your options are not categorized yet! Please click on the button "
358
+ "below to categorize them!"
359
+ msgstr ""
360
+
361
+ #: includes/class_clean_options.php:327
362
+ msgid "Scan options"
363
+ msgstr ""
364
+
365
+ #: includes/class_clean_options.php:347
366
+ msgid ""
367
+ "Please <a href=\"?page=advanced_db_cleaner&aDBc_tab=premium\">upgrade</a> to "
368
+ "Pro to categorize and detect orphaned options"
369
+ msgstr ""
370
+
371
+ #: includes/class_clean_options.php:424
372
+ msgid ""
373
+ "You are about to clean some of your options. This operation is irreversible!"
374
+ msgstr ""
375
+
376
+ #: includes/class_clean_tables.php:39
377
+ msgid "Table"
378
+ msgstr ""
379
+
380
+ #: includes/class_clean_tables.php:82 includes/class_general_cleanup.php:42
381
+ msgid "The clean-up schedule deleted successfully!"
382
+ msgstr ""
383
+
384
+ #: includes/class_clean_tables.php:132
385
+ msgid ""
386
+ "Indicates the creator of the table: either a plugin, a theme or WordPress "
387
+ "itself. If not sure about the creator, an estimation (%) will be displayed. "
388
+ "The higher the percentage is, the more likely that the table belongs to that "
389
+ "creator."
390
+ msgstr ""
391
+
392
+ #: includes/class_clean_tables.php:136
393
+ msgid "Prefix"
394
+ msgstr ""
395
+
396
+ #: includes/class_clean_tables.php:137
397
+ msgid "Table name"
398
+ msgstr ""
399
+
400
+ #: includes/class_clean_tables.php:138
401
+ msgid "Rows"
402
+ msgstr ""
403
+
404
+ #: includes/class_clean_tables.php:140
405
+ msgid "Lost"
406
+ msgstr ""
407
+
408
+ #: includes/class_clean_tables.php:197
409
+ msgid "Lost space"
410
+ msgstr ""
411
+
412
+ #: includes/class_clean_tables.php:197
413
+ msgid "to optimize"
414
+ msgstr ""
415
+
416
+ #: includes/class_clean_tables.php:200
417
+ msgid "Corrupted!"
418
+ msgstr ""
419
+
420
+ #: includes/class_clean_tables.php:200
421
+ msgid "to repair"
422
+ msgstr ""
423
+
424
+ #: includes/class_clean_tables.php:229 includes/class_clean_tables.php:528
425
+ #: includes/custom-schedule-view/class_add_optimize_schedule.php:177
426
+ #: includes/custom-schedule-view/class_edit_optimize_schedule.php:220
427
+ msgid "Optimize"
428
+ msgstr ""
429
+
430
+ #: includes/class_clean_tables.php:230 includes/class_clean_tables.php:529
431
+ #: includes/custom-schedule-view/class_add_optimize_schedule.php:180
432
+ #: includes/custom-schedule-view/class_edit_optimize_schedule.php:223
433
+ msgid "Repair"
434
+ msgstr ""
435
+
436
+ #: includes/class_clean_tables.php:231
437
+ msgid "Empty rows"
438
+ msgstr ""
439
+
440
+ #: includes/class_clean_tables.php:239
441
+ msgid "No tables found!"
442
+ msgstr ""
443
+
444
+ #: includes/class_clean_tables.php:271
445
+ msgid "Selected tables cleaned successfully!"
446
+ msgstr ""
447
+
448
+ #: includes/class_clean_tables.php:282
449
+ msgid "Selected tables optimized successfully!"
450
+ msgstr ""
451
+
452
+ #: includes/class_clean_tables.php:293
453
+ msgid "Selected tables emptied successfully!"
454
+ msgstr ""
455
+
456
+ #: includes/class_clean_tables.php:313
457
+ msgid "Selected tables repaired successfully!"
458
+ msgstr ""
459
+
460
+ #: includes/class_clean_tables.php:316
461
+ msgid "Some of your tables cannot be repaired!"
462
+ msgstr ""
463
+
464
+ #: includes/class_clean_tables.php:333
465
+ msgid ""
466
+ "The process of categorization is still scanning tables in background. Maybe "
467
+ "you have reloaded the page before it finishes the scan. The scan will stop "
468
+ "automatically after scanning all items or after timeout."
469
+ msgstr ""
470
+
471
+ #: includes/class_clean_tables.php:354
472
+ msgid ""
473
+ "Tables below seem to be orphan! However, please delete only those you are "
474
+ "sure to be orphan!"
475
+ msgstr ""
476
+
477
+ #: includes/class_clean_tables.php:356
478
+ msgid ""
479
+ "Some of your tables are not categorized yet! Please click on the button "
480
+ "below to categorize them!"
481
+ msgstr ""
482
+
483
+ #: includes/class_clean_tables.php:367
484
+ msgid "Scan tables"
485
+ msgstr ""
486
+
487
+ #: includes/class_clean_tables.php:387
488
+ msgid ""
489
+ "Please <a href=\"?page=advanced_db_cleaner&aDBc_tab=premium\">upgrade</a> to "
490
+ "Pro to categorize and detect orphaned tables"
491
+ msgstr ""
492
+
493
+ #: includes/class_clean_tables.php:467
494
+ msgid "Your database is optimized!"
495
+ msgstr ""
496
+
497
+ #: includes/class_clean_tables.php:481
498
+ msgid "table(s) should be optimized!"
499
+ msgstr ""
500
+
501
+ #: includes/class_clean_tables.php:486
502
+ msgid "You can save around"
503
+ msgstr ""
504
+
505
+ #: includes/class_clean_tables.php:495
506
+ msgid "table(s) should be repaired!"
507
+ msgstr ""
508
+
509
+ #: includes/class_clean_tables.php:512
510
+ msgid "optimize schedule(s) set"
511
+ msgstr ""
512
+
513
+ #: includes/class_clean_tables.php:516 includes/class_general_cleanup.php:324
514
+ #: includes/custom-clean-view/header_page_custom_clean.php:48
515
+ msgid "Name"
516
+ msgstr ""
517
+
518
+ #: includes/class_clean_tables.php:526 includes/class_general_cleanup.php:334
519
+ msgid "Next run"
520
+ msgstr ""
521
+
522
+ #: includes/class_clean_tables.php:531
523
+ msgid "Perform"
524
+ msgstr ""
525
+
526
+ #: includes/class_clean_tables.php:536 includes/class_general_cleanup.php:339
527
+ #: includes/custom-schedule-view/class_add_cleanup_schedule.php:271
528
+ #: includes/custom-schedule-view/class_add_optimize_schedule.php:148
529
+ #: includes/custom-schedule-view/class_edit_cleanup_schedule.php:319
530
+ #: includes/custom-schedule-view/class_edit_optimize_schedule.php:194
531
+ msgid "Once"
532
+ msgstr ""
533
+
534
+ #: includes/class_clean_tables.php:539 includes/class_general_cleanup.php:342
535
+ #: includes/custom-schedule-view/class_add_cleanup_schedule.php:275
536
+ #: includes/custom-schedule-view/class_add_optimize_schedule.php:152
537
+ #: includes/custom-schedule-view/class_edit_cleanup_schedule.php:320
538
+ #: includes/custom-schedule-view/class_edit_optimize_schedule.php:195
539
+ msgid "Hourly"
540
+ msgstr ""
541
+
542
+ #: includes/class_clean_tables.php:542 includes/class_general_cleanup.php:345
543
+ #: includes/custom-schedule-view/class_add_cleanup_schedule.php:278
544
+ #: includes/custom-schedule-view/class_add_optimize_schedule.php:155
545
+ #: includes/custom-schedule-view/class_edit_cleanup_schedule.php:321
546
+ #: includes/custom-schedule-view/class_edit_optimize_schedule.php:196
547
+ msgid "Twice a day"
548
+ msgstr ""
549
+
550
+ #: includes/class_clean_tables.php:545 includes/class_general_cleanup.php:348
551
+ #: includes/custom-schedule-view/class_add_cleanup_schedule.php:281
552
+ #: includes/custom-schedule-view/class_add_optimize_schedule.php:158
553
+ #: includes/custom-schedule-view/class_edit_cleanup_schedule.php:322
554
+ #: includes/custom-schedule-view/class_edit_optimize_schedule.php:197
555
+ msgid "Daily"
556
+ msgstr ""
557
+
558
+ #: includes/class_clean_tables.php:548 includes/class_general_cleanup.php:351
559
+ #: includes/custom-schedule-view/class_add_cleanup_schedule.php:284
560
+ #: includes/custom-schedule-view/class_add_optimize_schedule.php:161
561
+ #: includes/custom-schedule-view/class_edit_cleanup_schedule.php:323
562
+ #: includes/custom-schedule-view/class_edit_optimize_schedule.php:198
563
+ msgid "Weekly"
564
+ msgstr ""
565
+
566
+ #: includes/class_clean_tables.php:551 includes/class_general_cleanup.php:354
567
+ #: includes/custom-schedule-view/class_add_cleanup_schedule.php:287
568
+ #: includes/custom-schedule-view/class_add_optimize_schedule.php:164
569
+ #: includes/custom-schedule-view/class_edit_cleanup_schedule.php:324
570
+ #: includes/custom-schedule-view/class_edit_optimize_schedule.php:199
571
+ msgid "Monthly"
572
+ msgstr ""
573
+
574
+ #: includes/class_clean_tables.php:555 includes/class_general_cleanup.php:358
575
+ msgid "Frequency"
576
+ msgstr ""
577
+
578
+ #: includes/class_clean_tables.php:567 includes/class_general_cleanup.php:372
579
+ msgid "Edit"
580
+ msgstr ""
581
+
582
+ #: includes/class_clean_tables.php:585 includes/class_general_cleanup.php:391
583
+ msgid "Add new schedule"
584
+ msgstr ""
585
+
586
+ #: includes/class_clean_tables.php:598
587
+ msgid ""
588
+ "You are about to delete some of your tables. This operation is irreversible!"
589
+ msgstr ""
590
+
591
+ #: includes/class_clean_tables.php:606
592
+ msgid ""
593
+ "You are about to empty some of your tables. This operation is irreversible!"
594
+ msgstr ""
595
+
596
+ #: includes/class_clean_tables.php:614
597
+ msgid "Please choose an action!"
598
+ msgstr ""
599
+
600
+ #: includes/class_general_cleanup.php:15
601
+ #: includes/custom-schedule-view/class_add_cleanup_schedule.php:15
602
+ #: includes/custom-schedule-view/class_edit_cleanup_schedule.php:15
603
+ msgid "Element"
604
+ msgstr ""
605
+
606
+ #: includes/class_general_cleanup.php:16
607
+ #: includes/custom-schedule-view/class_add_cleanup_schedule.php:16
608
+ #: includes/custom-schedule-view/class_edit_cleanup_schedule.php:16
609
+ msgid "Elements"
610
+ msgstr ""
611
+
612
+ #: includes/class_general_cleanup.php:60 includes/class_general_cleanup.php:64
613
+ msgid "The 'keep last' value saved successfully!"
614
+ msgstr ""
615
+
616
+ #: includes/class_general_cleanup.php:64
617
+ msgid ""
618
+ "Please keep in mind that this will change the value of 'keep last' of your "
619
+ "corresponding scheduled tasks as well!"
620
+ msgstr ""
621
+
622
+ #: includes/class_general_cleanup.php:106
623
+ msgid "Scheduled in:"
624
+ msgstr ""
625
+
626
+ #: includes/class_general_cleanup.php:143
627
+ msgid "Save"
628
+ msgstr ""
629
+
630
+ #: includes/class_general_cleanup.php:145
631
+ #: includes/custom-schedule-view/class_add_cleanup_schedule.php:135
632
+ #: includes/custom-schedule-view/class_edit_cleanup_schedule.php:140
633
+ msgid "days"
634
+ msgstr ""
635
+
636
+ #: includes/class_general_cleanup.php:151
637
+ msgid "Cancel"
638
+ msgstr ""
639
+
640
+ #: includes/class_general_cleanup.php:153
641
+ #: includes/class_general_cleanup.php:160
642
+ #: includes/custom-schedule-view/class_add_cleanup_schedule.php:137
643
+ #: includes/custom-schedule-view/class_edit_cleanup_schedule.php:142
644
+ msgid "N/A"
645
+ msgstr ""
646
+
647
+ #: includes/class_general_cleanup.php:182
648
+ msgid ""
649
+ "Indicates if you have selected the item to be cleaned automatically on a "
650
+ "scheduled task. A green image indicates that the item is scheduled while a "
651
+ "grey image indicated the opposite."
652
+ msgstr ""
653
+
654
+ #: includes/class_general_cleanup.php:187
655
+ msgid ""
656
+ "Keep the last x days’ data from being displayed, and therefore from being "
657
+ "cleaned. The plugin will always show only data older than the number of days "
658
+ "you have specified."
659
+ msgstr ""
660
+
661
+ #: includes/class_general_cleanup.php:192
662
+ msgid "Elements to clean"
663
+ msgstr ""
664
+
665
+ #: includes/class_general_cleanup.php:193
666
+ msgid "Count"
667
+ msgstr ""
668
+
669
+ #: includes/class_general_cleanup.php:194
670
+ msgid "View"
671
+ msgstr ""
672
+
673
+ #: includes/class_general_cleanup.php:195
674
+ msgid "Scheduled"
675
+ msgstr ""
676
+
677
+ #: includes/class_general_cleanup.php:196
678
+ #: includes/custom-schedule-view/class_add_cleanup_schedule.php:162
679
+ #: includes/custom-schedule-view/class_edit_cleanup_schedule.php:167
680
+ msgid "Keep last"
681
+ msgstr ""
682
+
683
+ #: includes/class_general_cleanup.php:247
684
+ #: includes/custom-clean-view/class_clean_comment.php:243
685
+ #: includes/custom-clean-view/class_clean_meta_comment_post_user_term.php:227
686
+ #: includes/custom-clean-view/class_clean_relationships.php:177
687
+ #: includes/custom-clean-view/class_clean_revision_draft_trash.php:224
688
+ #: includes/custom-clean-view/class_clean_transient.php:237
689
+ msgid "Clean"
690
+ msgstr ""
691
+
692
+ #: includes/class_general_cleanup.php:254
693
+ #: includes/class_general_cleanup.php:303
694
+ #: includes/custom-schedule-view/class_add_cleanup_schedule.php:220
695
+ #: includes/custom-schedule-view/class_edit_cleanup_schedule.php:237
696
+ msgid "Your database is clean!"
697
+ msgstr ""
698
+
699
+ #: includes/class_general_cleanup.php:276
700
+ msgid "Selected elements successfully cleaned!"
701
+ msgstr ""
702
+
703
+ #: includes/class_general_cleanup.php:306
704
+ msgid "Element(s) can be cleaned!"
705
+ msgstr ""
706
+
707
+ #: includes/class_general_cleanup.php:320
708
+ msgid "Cleanup schedule(s) set"
709
+ msgstr ""
710
+
711
+ #: includes/class_general_cleanup.php:360
712
+ msgid "Items to clean"
713
+ msgstr ""
714
+
715
+ #: includes/class_general_cleanup.php:400
716
+ msgid ""
717
+ "You are about to clean some of your unused data. This operation is "
718
+ "irreversible!"
719
+ msgstr ""
720
+
721
+ #: includes/custom-clean-view/class_clean_comment.php:26
722
+ msgid "Pending comment"
723
+ msgstr ""
724
+
725
+ #: includes/custom-clean-view/class_clean_comment.php:27
726
+ #: includes/functions.php:284
727
+ msgid "Pending comments"
728
+ msgstr ""
729
+
730
+ #: includes/custom-clean-view/class_clean_comment.php:28
731
+ #: includes/custom-clean-view/class_clean_comment.php:37
732
+ #: includes/custom-clean-view/class_clean_comment.php:46
733
+ msgid "Comment content"
734
+ msgstr ""
735
+
736
+ #: includes/custom-clean-view/class_clean_comment.php:35
737
+ msgid "Spam comment"
738
+ msgstr ""
739
+
740
+ #: includes/custom-clean-view/class_clean_comment.php:36
741
+ #: includes/functions.php:286
742
+ msgid "Spam comments"
743
+ msgstr ""
744
+
745
+ #: includes/custom-clean-view/class_clean_comment.php:44
746
+ msgid "Trash comment"
747
+ msgstr ""
748
+
749
+ #: includes/custom-clean-view/class_clean_comment.php:45
750
+ msgid "Trash comments"
751
+ msgstr ""
752
+
753
+ #: includes/custom-clean-view/class_clean_comment.php:53
754
+ msgid "Pingback"
755
+ msgstr ""
756
+
757
+ #: includes/custom-clean-view/class_clean_comment.php:54
758
+ #: includes/functions.php:291
759
+ msgid "Pingbacks"
760
+ msgstr ""
761
+
762
+ #: includes/custom-clean-view/class_clean_comment.php:55
763
+ msgid "Pingback content"
764
+ msgstr ""
765
+
766
+ #: includes/custom-clean-view/class_clean_comment.php:62
767
+ msgid "Trackback"
768
+ msgstr ""
769
+
770
+ #: includes/custom-clean-view/class_clean_comment.php:63
771
+ #: includes/functions.php:293
772
+ msgid "Trackbacks"
773
+ msgstr ""
774
+
775
+ #: includes/custom-clean-view/class_clean_comment.php:64
776
+ msgid "Trackback content"
777
+ msgstr ""
778
+
779
+ #: includes/custom-clean-view/class_clean_comment.php:166
780
+ #: includes/custom-clean-view/class_clean_meta_comment_post_user_term.php:152
781
+ #: includes/custom-clean-view/class_clean_relationships.php:101
782
+ #: includes/custom-clean-view/class_clean_revision_draft_trash.php:146
783
+ #: includes/custom-clean-view/class_clean_transient.php:158
784
+ msgid "ID"
785
+ msgstr ""
786
+
787
+ #: includes/custom-clean-view/class_clean_comment.php:167
788
+ msgid "Author"
789
+ msgstr ""
790
+
791
+ #: includes/custom-clean-view/class_clean_comment.php:169
792
+ #: includes/custom-clean-view/class_clean_revision_draft_trash.php:149
793
+ msgid "Date"
794
+ msgstr ""
795
+
796
+ #: includes/custom-clean-view/class_clean_comment.php:170
797
+ #: includes/custom-clean-view/class_clean_meta_comment_post_user_term.php:155
798
+ #: includes/custom-clean-view/class_clean_relationships.php:104
799
+ #: includes/custom-clean-view/class_clean_revision_draft_trash.php:150
800
+ #: includes/custom-clean-view/class_clean_transient.php:163
801
+ msgid "Site id"
802
+ msgstr ""
803
+
804
+ #: includes/custom-clean-view/class_clean_comment.php:250
805
+ #: includes/custom-clean-view/class_clean_meta_comment_post_user_term.php:234
806
+ #: includes/custom-clean-view/class_clean_relationships.php:184
807
+ #: includes/custom-clean-view/class_clean_revision_draft_trash.php:231
808
+ #: includes/custom-clean-view/class_clean_transient.php:244
809
+ msgid "No elements found!"
810
+ msgstr ""
811
+
812
+ #: includes/custom-clean-view/class_clean_meta_comment_post_user_term.php:27
813
+ #: includes/functions.php:298
814
+ msgid "Orphaned comment meta"
815
+ msgstr ""
816
+
817
+ #: includes/custom-clean-view/class_clean_meta_comment_post_user_term.php:28
818
+ msgid "Orphaned comments meta"
819
+ msgstr ""
820
+
821
+ #: includes/custom-clean-view/class_clean_meta_comment_post_user_term.php:29
822
+ msgid "Comment meta key"
823
+ msgstr ""
824
+
825
+ #: includes/custom-clean-view/class_clean_meta_comment_post_user_term.php:36
826
+ #: includes/functions.php:296
827
+ msgid "Orphaned post meta"
828
+ msgstr ""
829
+
830
+ #: includes/custom-clean-view/class_clean_meta_comment_post_user_term.php:37
831
+ msgid "Orphaned posts meta"
832
+ msgstr ""
833
+
834
+ #: includes/custom-clean-view/class_clean_meta_comment_post_user_term.php:38
835
+ msgid "Post meta key"
836
+ msgstr ""
837
+
838
+ #: includes/custom-clean-view/class_clean_meta_comment_post_user_term.php:45
839
+ msgid "Orphaned User Meta"
840
+ msgstr ""
841
+
842
+ #: includes/custom-clean-view/class_clean_meta_comment_post_user_term.php:46
843
+ msgid "Orphaned Users Meta"
844
+ msgstr ""
845
+
846
+ #: includes/custom-clean-view/class_clean_meta_comment_post_user_term.php:47
847
+ msgid "User meta key"
848
+ msgstr ""
849
+
850
+ #: includes/custom-clean-view/class_clean_meta_comment_post_user_term.php:54
851
+ msgid "Orphaned Term Meta"
852
+ msgstr ""
853
+
854
+ #: includes/custom-clean-view/class_clean_meta_comment_post_user_term.php:55
855
+ msgid "Orphaned Terms Meta"
856
+ msgstr ""
857
+
858
+ #: includes/custom-clean-view/class_clean_meta_comment_post_user_term.php:56
859
+ msgid "Term meta key"
860
+ msgstr ""
861
+
862
+ #: includes/custom-clean-view/class_clean_meta_comment_post_user_term.php:154
863
+ msgid "Meta value"
864
+ msgstr ""
865
+
866
+ #: includes/custom-clean-view/class_clean_relationships.php:22
867
+ msgid "Orphaned Relationships"
868
+ msgstr ""
869
+
870
+ #: includes/custom-clean-view/class_clean_relationships.php:32
871
+ msgid "Orphaned Relationship"
872
+ msgstr ""
873
+
874
+ #: includes/custom-clean-view/class_clean_relationships.php:102
875
+ msgid "Term taxonomy id"
876
+ msgstr ""
877
+
878
+ #: includes/custom-clean-view/class_clean_relationships.php:103
879
+ msgid "Term order"
880
+ msgstr ""
881
+
882
+ #: includes/custom-clean-view/class_clean_relationships.php:227
883
+ msgid "Selected 'Orphaned relationships' successfully cleaned!"
884
+ msgstr ""
885
+
886
+ #: includes/custom-clean-view/class_clean_revision_draft_trash.php:26
887
+ msgid "Auto draft"
888
+ msgstr ""
889
+
890
+ #: includes/custom-clean-view/class_clean_revision_draft_trash.php:27
891
+ #: includes/functions.php:279
892
+ msgid "Auto drafts"
893
+ msgstr ""
894
+
895
+ #: includes/custom-clean-view/class_clean_revision_draft_trash.php:28
896
+ msgid "Auto draft title"
897
+ msgstr ""
898
+
899
+ #: includes/custom-clean-view/class_clean_revision_draft_trash.php:35
900
+ msgid "Trash post"
901
+ msgstr ""
902
+
903
+ #: includes/custom-clean-view/class_clean_revision_draft_trash.php:36
904
+ msgid "Trash posts"
905
+ msgstr ""
906
+
907
+ #: includes/custom-clean-view/class_clean_revision_draft_trash.php:37
908
+ msgid "Trash post title"
909
+ msgstr ""
910
+
911
+ #: includes/custom-clean-view/class_clean_revision_draft_trash.php:44
912
+ msgid "Revision"
913
+ msgstr ""
914
+
915
+ #: includes/custom-clean-view/class_clean_revision_draft_trash.php:45
916
+ #: includes/functions.php:277
917
+ msgid "Revisions"
918
+ msgstr ""
919
+
920
+ #: includes/custom-clean-view/class_clean_revision_draft_trash.php:46
921
+ msgid "Revision title"
922
+ msgstr ""
923
+
924
+ #: includes/custom-clean-view/class_clean_revision_draft_trash.php:148
925
+ msgid "Content"
926
+ msgstr ""
927
+
928
+ #: includes/custom-clean-view/class_clean_transient.php:20
929
+ msgid "Transient"
930
+ msgstr ""
931
+
932
+ #: includes/custom-clean-view/class_clean_transient.php:21
933
+ msgid "Transients"
934
+ msgstr ""
935
+
936
+ #: includes/custom-clean-view/class_clean_transient.php:119
937
+ msgid "Expired"
938
+ msgstr ""
939
+
940
+ #: includes/custom-clean-view/class_clean_transient.php:125
941
+ msgid "Does not expire"
942
+ msgstr ""
943
+
944
+ #: includes/custom-clean-view/class_clean_transient.php:159
945
+ msgid "Transient name"
946
+ msgstr ""
947
+
948
+ #: includes/custom-clean-view/class_clean_transient.php:161
949
+ msgid "Expires In"
950
+ msgstr ""
951
+
952
+ #: includes/custom-clean-view/class_clean_transient.php:307
953
+ msgid "Selected 'Transients' successfully cleaned!"
954
+ msgstr ""
955
+
956
+ #: includes/custom-clean-view/header_page_custom_clean.php:10
957
+ msgid "Custom cleaning of"
958
+ msgstr ""
959
+
960
+ #: includes/custom-clean-view/header_page_custom_clean.php:10
961
+ msgid "Total Found"
962
+ msgstr ""
963
+
964
+ #: includes/custom-clean-view/header_page_custom_clean.php:43
965
+ #: includes/header_page_filter.php:34
966
+ msgid "Search for"
967
+ msgstr ""
968
+
969
+ #: includes/custom-clean-view/header_page_custom_clean.php:47
970
+ msgid "Search in"
971
+ msgstr ""
972
+
973
+ #: includes/custom-clean-view/header_page_custom_clean.php:52
974
+ #: includes/header_page_filter.php:118
975
+ msgid "Filter"
976
+ msgstr ""
977
+
978
+ #: includes/custom-clean-view/header_page_custom_clean.php:78
979
+ #: includes/header_page_filter.php:144
980
+ msgid "Items per page"
981
+ msgstr ""
982
+
983
+ #: includes/custom-clean-view/header_page_custom_clean.php:85
984
+ #: includes/header_page_filter.php:151
985
+ msgid "Show"
986
+ msgstr ""
987
+
988
+ #: includes/custom-schedule-view/class_add_cleanup_schedule.php:71
989
+ #: includes/custom-schedule-view/class_add_optimize_schedule.php:72
990
+ #: includes/custom-schedule-view/class_edit_cleanup_schedule.php:78
991
+ #: includes/custom-schedule-view/class_edit_optimize_schedule.php:79
992
+ msgid "The clean-up schedule saved successfully!"
993
+ msgstr ""
994
+
995
+ #: includes/custom-schedule-view/class_add_cleanup_schedule.php:73
996
+ #: includes/custom-schedule-view/class_add_optimize_schedule.php:74
997
+ #: includes/custom-schedule-view/class_edit_cleanup_schedule.php:80
998
+ #: includes/custom-schedule-view/class_edit_optimize_schedule.php:81
999
+ msgid "The clean-up schedule saved successfully but it is inactive!"
1000
+ msgstr ""
1001
+
1002
+ #: includes/custom-schedule-view/class_add_cleanup_schedule.php:78
1003
+ #: includes/custom-schedule-view/class_add_optimize_schedule.php:82
1004
+ #: includes/custom-schedule-view/class_edit_cleanup_schedule.php:84
1005
+ #: includes/custom-schedule-view/class_edit_optimize_schedule.php:90
1006
+ msgid "Please specify a valide time!"
1007
+ msgstr ""
1008
+
1009
+ #: includes/custom-schedule-view/class_add_cleanup_schedule.php:82
1010
+ #: includes/custom-schedule-view/class_add_optimize_schedule.php:86
1011
+ #: includes/custom-schedule-view/class_edit_cleanup_schedule.php:88
1012
+ #: includes/custom-schedule-view/class_edit_optimize_schedule.php:94
1013
+ msgid "Please specify a valide date!"
1014
+ msgstr ""
1015
+
1016
+ #: includes/custom-schedule-view/class_add_cleanup_schedule.php:86
1017
+ #: includes/custom-schedule-view/class_add_optimize_schedule.php:90
1018
+ #: includes/custom-schedule-view/class_edit_cleanup_schedule.php:92
1019
+ #: includes/custom-schedule-view/class_edit_optimize_schedule.php:98
1020
+ msgid ""
1021
+ "The name you have specified is already used by another schedule! Please "
1022
+ "change it!"
1023
+ msgstr ""
1024
+
1025
+ #: includes/custom-schedule-view/class_add_cleanup_schedule.php:90
1026
+ #: includes/custom-schedule-view/class_add_optimize_schedule.php:94
1027
+ #: includes/custom-schedule-view/class_edit_cleanup_schedule.php:96
1028
+ #: includes/custom-schedule-view/class_edit_optimize_schedule.php:102
1029
+ msgid ""
1030
+ "Please change the name! Only letters, numbers and underscores are allowed!"
1031
+ msgstr ""
1032
+
1033
+ #: includes/custom-schedule-view/class_add_cleanup_schedule.php:94
1034
+ #: includes/custom-schedule-view/class_add_optimize_schedule.php:98
1035
+ #: includes/custom-schedule-view/class_edit_cleanup_schedule.php:100
1036
+ #: includes/custom-schedule-view/class_edit_optimize_schedule.php:106
1037
+ msgid "Please give a name to your schedule!"
1038
+ msgstr ""
1039
+
1040
+ #: includes/custom-schedule-view/class_add_cleanup_schedule.php:98
1041
+ #: includes/custom-schedule-view/class_edit_cleanup_schedule.php:104
1042
+ msgid ""
1043
+ "Please select at least one item to include in the schedule from the table "
1044
+ "below!"
1045
+ msgstr ""
1046
+
1047
+ #: includes/custom-schedule-view/class_add_cleanup_schedule.php:156
1048
+ #: includes/custom-schedule-view/class_edit_cleanup_schedule.php:161
1049
+ msgid ""
1050
+ "Only data that is older than the number you have specified will be cleaned "
1051
+ "based on you schedule parameters. To change this value, click on \"go back\" "
1052
+ "button."
1053
+ msgstr ""
1054
+
1055
+ #: includes/custom-schedule-view/class_add_cleanup_schedule.php:161
1056
+ #: includes/custom-schedule-view/class_edit_cleanup_schedule.php:166
1057
+ msgid "Elements to include in the schedule"
1058
+ msgstr ""
1059
+
1060
+ #: includes/custom-schedule-view/class_add_cleanup_schedule.php:241
1061
+ msgid "Add cleanup schedule"
1062
+ msgstr ""
1063
+
1064
+ #: includes/custom-schedule-view/class_add_cleanup_schedule.php:264
1065
+ #: includes/custom-schedule-view/class_add_optimize_schedule.php:141
1066
+ msgid "Name your schedule"
1067
+ msgstr ""
1068
+
1069
+ #: includes/custom-schedule-view/class_add_cleanup_schedule.php:267
1070
+ #: includes/custom-schedule-view/class_add_optimize_schedule.php:144
1071
+ #: includes/custom-schedule-view/class_edit_cleanup_schedule.php:316
1072
+ #: includes/custom-schedule-view/class_edit_optimize_schedule.php:191
1073
+ msgid "Frequency of execution"
1074
+ msgstr ""
1075
+
1076
+ #: includes/custom-schedule-view/class_add_cleanup_schedule.php:291
1077
+ #: includes/custom-schedule-view/class_add_optimize_schedule.php:168
1078
+ #: includes/custom-schedule-view/class_edit_cleanup_schedule.php:336
1079
+ #: includes/custom-schedule-view/class_edit_optimize_schedule.php:211
1080
+ msgid "Start date"
1081
+ msgstr ""
1082
+
1083
+ #: includes/custom-schedule-view/class_add_cleanup_schedule.php:294
1084
+ #: includes/custom-schedule-view/class_add_optimize_schedule.php:171
1085
+ #: includes/custom-schedule-view/class_edit_cleanup_schedule.php:339
1086
+ #: includes/custom-schedule-view/class_edit_optimize_schedule.php:214
1087
+ msgid "Start time (GMT)"
1088
+ msgstr ""
1089
+
1090
+ #: includes/custom-schedule-view/class_add_cleanup_schedule.php:298
1091
+ #: includes/custom-schedule-view/class_add_optimize_schedule.php:183
1092
+ #: includes/custom-schedule-view/class_edit_cleanup_schedule.php:342
1093
+ #: includes/custom-schedule-view/class_edit_optimize_schedule.php:226
1094
+ msgid "Schedule status"
1095
+ msgstr ""
1096
+
1097
+ #: includes/custom-schedule-view/class_add_cleanup_schedule.php:302
1098
+ #: includes/custom-schedule-view/class_add_optimize_schedule.php:186
1099
+ #: includes/custom-schedule-view/class_edit_cleanup_schedule.php:346
1100
+ #: includes/custom-schedule-view/class_edit_optimize_schedule.php:230
1101
+ #: includes/license/adbc-edd-sample-plugin.php:93
1102
+ msgid "Active"
1103
+ msgstr ""
1104
+
1105
+ #: includes/custom-schedule-view/class_add_cleanup_schedule.php:305
1106
+ #: includes/custom-schedule-view/class_add_optimize_schedule.php:189
1107
+ #: includes/custom-schedule-view/class_edit_cleanup_schedule.php:349
1108
+ #: includes/custom-schedule-view/class_edit_optimize_schedule.php:233
1109
+ #: includes/license/adbc-edd-sample-plugin.php:97
1110
+ msgid "Inactive"
1111
+ msgstr ""
1112
+
1113
+ #: includes/custom-schedule-view/class_add_cleanup_schedule.php:309
1114
+ #: includes/custom-schedule-view/class_add_optimize_schedule.php:193
1115
+ #: includes/custom-schedule-view/class_edit_cleanup_schedule.php:353
1116
+ #: includes/custom-schedule-view/class_edit_optimize_schedule.php:237
1117
+ msgid "Save the schedule"
1118
+ msgstr ""
1119
+
1120
+ #: includes/custom-schedule-view/class_add_optimize_schedule.php:78
1121
+ #: includes/custom-schedule-view/class_edit_optimize_schedule.php:86
1122
+ msgid "Please choose at least one operation to perform!"
1123
+ msgstr ""
1124
+
1125
+ #: includes/custom-schedule-view/class_add_optimize_schedule.php:120
1126
+ msgid "Add optimize schedule"
1127
+ msgstr ""
1128
+
1129
+ #: includes/custom-schedule-view/class_add_optimize_schedule.php:129
1130
+ msgid ""
1131
+ "By default, all your database tables will be optimized and/or repaired (if "
1132
+ "needed) according to your schedule settings"
1133
+ msgstr ""
1134
+
1135
+ #: includes/custom-schedule-view/class_add_optimize_schedule.php:174
1136
+ #: includes/custom-schedule-view/class_edit_optimize_schedule.php:217
1137
+ msgid "Perform operations"
1138
+ msgstr ""
1139
+
1140
+ #: includes/custom-schedule-view/class_edit_cleanup_schedule.php:258
1141
+ #: includes/custom-schedule-view/class_edit_optimize_schedule.php:131
1142
+ msgid "Edit cleanup schedule"
1143
+ msgstr ""
1144
+
1145
+ #: includes/custom-schedule-view/class_edit_cleanup_schedule.php:312
1146
+ #: includes/custom-schedule-view/class_edit_optimize_schedule.php:187
1147
+ msgid "Schedule name"
1148
+ msgstr ""
1149
+
1150
+ #: includes/custom-schedule-view/class_edit_optimize_schedule.php:138
1151
+ msgid ""
1152
+ "By default, all your database tables will be optimized (if needed) according "
1153
+ "to your schedule settings"
1154
+ msgstr ""
1155
+
1156
+ #: includes/functions.php:281
1157
+ msgid "Trashed posts"
1158
+ msgstr ""
1159
+
1160
+ #: includes/functions.php:288
1161
+ msgid "Trashed comments"
1162
+ msgstr ""
1163
+
1164
+ #: includes/functions.php:300
1165
+ msgid "Orphaned user meta"
1166
+ msgstr ""
1167
+
1168
+ #: includes/functions.php:302
1169
+ msgid "Orphaned term meta"
1170
+ msgstr ""
1171
+
1172
+ #: includes/functions.php:305
1173
+ msgid "Orphaned relationships"
1174
+ msgstr ""
1175
+
1176
+ #: includes/functions.php:308
1177
+ msgid "Expired transients"
1178
+ msgstr ""
1179
+
1180
+ #: includes/functions.php:449 includes/functions.php:462
1181
+ #: includes/functions.php:475
1182
+ msgid "All"
1183
+ msgstr ""
1184
+
1185
+ #: includes/functions.php:450 includes/functions.php:463
1186
+ #: includes/functions.php:476
1187
+ msgid "Uncategorized"
1188
+ msgstr ""
1189
+
1190
+ #: includes/functions.php:451 includes/functions.php:464
1191
+ #: includes/functions.php:477
1192
+ msgid "Orphans"
1193
+ msgstr ""
1194
+
1195
+ #: includes/functions.php:452
1196
+ msgid "Plugins tasks"
1197
+ msgstr ""
1198
+
1199
+ #: includes/functions.php:453
1200
+ msgid "Themes tasks"
1201
+ msgstr ""
1202
+
1203
+ #: includes/functions.php:454
1204
+ msgid "WP tasks"
1205
+ msgstr ""
1206
+
1207
+ #: includes/functions.php:465
1208
+ msgid "Plugins options"
1209
+ msgstr ""
1210
+
1211
+ #: includes/functions.php:466
1212
+ msgid "Themes options"
1213
+ msgstr ""
1214
+
1215
+ #: includes/functions.php:467
1216
+ msgid "WP options"
1217
+ msgstr ""
1218
+
1219
+ #: includes/functions.php:478
1220
+ msgid "Plugins tables"
1221
+ msgstr ""
1222
+
1223
+ #: includes/functions.php:479
1224
+ msgid "Themes tables"
1225
+ msgstr ""
1226
+
1227
+ #: includes/functions.php:480
1228
+ msgid "WP tables"
1229
+ msgstr ""
1230
+
1231
+ #: includes/functions.php:558
1232
+ msgid ""
1233
+ "This item is not categorized yet! Please click on scan button above to "
1234
+ "categorize it."
1235
+ msgstr ""
1236
+
1237
+ #: includes/functions.php:572
1238
+ msgid "Uncategorised!"
1239
+ msgstr ""
1240
+
1241
+ #: includes/functions.php:577
1242
+ msgid "Orphan!"
1243
+ msgstr ""
1244
+
1245
+ #: includes/functions.php:581
1246
+ msgid "Wordpress core"
1247
+ msgstr ""
1248
+
1249
+ #: includes/functions.php:673
1250
+ msgid "This page will reload several times during this scan!"
1251
+ msgstr ""
1252
+
1253
+ #: includes/functions.php:841
1254
+ msgid "Unknown!"
1255
+ msgstr ""
1256
+
1257
+ #: includes/functions.php:844
1258
+ msgid "Single event"
1259
+ msgstr ""
1260
+
1261
+ #: includes/header_page_filter.php:44
1262
+ msgid "All tables"
1263
+ msgstr ""
1264
+
1265
+ #: includes/header_page_filter.php:45
1266
+ msgid "To optimize"
1267
+ msgstr ""
1268
+
1269
+ #: includes/header_page_filter.php:46
1270
+ msgid "To repair"
1271
+ msgstr ""
1272
+
1273
+ #: includes/header_page_filter.php:55 includes/overview_settings.php:71
1274
+ msgid "Yes"
1275
+ msgstr ""
1276
+
1277
+ #: includes/header_page_filter.php:56 includes/overview_settings.php:74
1278
+ msgid "No"
1279
+ msgstr ""
1280
+
1281
+ #: includes/header_page_filter.php:61
1282
+ msgid "All \"belongs to\""
1283
+ msgstr ""
1284
+
1285
+ #: includes/header_page_filter.php:73
1286
+ msgid "Plugins"
1287
+ msgstr ""
1288
+
1289
+ #: includes/header_page_filter.php:85
1290
+ msgid "Themes"
1291
+ msgstr ""
1292
+
1293
+ #: includes/header_page_filter.php:100
1294
+ msgid "All sites"
1295
+ msgstr ""
1296
+
1297
+ #: includes/header_page_filter.php:167
1298
+ msgid "Delete custom filter"
1299
+ msgstr ""
1300
+
1301
+ #: includes/license/ADBC_EDD_SL_Plugin_Updater.php:228
1302
+ #, php-format
1303
+ msgid ""
1304
+ "There is a new version of %1$s available. %2$sView version %3$s details%4$s."
1305
+ msgstr ""
1306
+
1307
+ #: includes/license/ADBC_EDD_SL_Plugin_Updater.php:236
1308
+ #, php-format
1309
+ msgid ""
1310
+ "There is a new version of %1$s available. %2$sView version %3$s details%4$s "
1311
+ "or %5$supdate now%6$s."
1312
+ msgstr ""
1313
+
1314
+ #: includes/license/ADBC_EDD_SL_Plugin_Updater.php:474
1315
+ msgid "You do not have permission to install plugin updates"
1316
+ msgstr ""
1317
+
1318
+ #: includes/license/ADBC_EDD_SL_Plugin_Updater.php:474
1319
+ msgid "Error"
1320
+ msgstr ""
1321
+
1322
+ #: includes/license/adbc-edd-sample-plugin.php:74
1323
+ msgid "Enter your license key"
1324
+ msgstr ""
1325
+
1326
+ #: includes/license/adbc-edd-sample-plugin.php:80
1327
+ msgid "Save new license key"
1328
+ msgstr ""
1329
+
1330
+ #: includes/license/adbc-edd-sample-plugin.php:88
1331
+ #: includes/license/adbc-edd-sample-plugin.php:99
1332
+ msgid "Activate license"
1333
+ msgstr ""
1334
+
1335
+ #: includes/license/adbc-edd-sample-plugin.php:95
1336
+ msgid "Deactivate license"
1337
+ msgstr ""
1338
+
1339
+ #: includes/license/adbc-edd-sample-plugin.php:160
1340
+ #: includes/license/adbc-edd-sample-plugin.php:208
1341
+ #: includes/license/adbc-edd-sample-plugin.php:270
1342
+ msgid "An error occurred, please try again."
1343
+ msgstr ""
1344
+
1345
+ #: includes/license/adbc-edd-sample-plugin.php:174
1346
+ #, php-format
1347
+ msgid "Your license key expired on %s."
1348
+ msgstr ""
1349
+
1350
+ #: includes/license/adbc-edd-sample-plugin.php:182
1351
+ msgid "Your license key has been disabled."
1352
+ msgstr ""
1353
+
1354
+ #: includes/license/adbc-edd-sample-plugin.php:187
1355
+ msgid "Invalid license key"
1356
+ msgstr ""
1357
+
1358
+ #: includes/license/adbc-edd-sample-plugin.php:193
1359
+ msgid "Your license is not active for this URL."
1360
+ msgstr ""
1361
+
1362
+ #: includes/license/adbc-edd-sample-plugin.php:198
1363
+ #, php-format
1364
+ msgid "This appears to be an invalid license key for %s."
1365
+ msgstr ""
1366
+
1367
+ #: includes/license/adbc-edd-sample-plugin.php:203
1368
+ msgid "Your license key has reached its activation limit."
1369
+ msgstr ""
1370
+
1371
+ #: includes/overview_settings.php:25
1372
+ msgid ""
1373
+ "Indicates the total number of rows in your option tables of all your network "
1374
+ "sites, including transients..."
1375
+ msgstr ""
1376
+
1377
+ #: includes/overview_settings.php:32
1378
+ msgid ""
1379
+ "Indicates the total number of rows in your options table, including "
1380
+ "transients..."
1381
+ msgstr ""
1382
+
1383
+ #: includes/overview_settings.php:82
1384
+ msgid "Settings saved successfully!"
1385
+ msgstr ""
1386
+
1387
+ #: includes/overview_settings.php:84
1388
+ msgid ""
1389
+ "Settings saved successfully! The default position of the plugin menu is the "
1390
+ "left side of the admin panel"
1391
+ msgstr ""
1392
+
1393
+ #: includes/overview_settings.php:92
1394
+ msgid "Overview"
1395
+ msgstr ""
1396
+
1397
+ #: includes/overview_settings.php:95
1398
+ msgid "WP Version"
1399
+ msgstr ""
1400
+
1401
+ #: includes/overview_settings.php:99
1402
+ msgid "Database size"
1403
+ msgstr ""
1404
+
1405
+ #: includes/overview_settings.php:103
1406
+ msgid "Total unused data"
1407
+ msgstr ""
1408
+
1409
+ #: includes/overview_settings.php:107
1410
+ msgid "Total tables"
1411
+ msgstr ""
1412
+
1413
+ #: includes/overview_settings.php:111
1414
+ msgid "Tables to optimize"
1415
+ msgstr ""
1416
+
1417
+ #: includes/overview_settings.php:115
1418
+ msgid "Total options"
1419
+ msgstr ""
1420
+
1421
+ #: includes/overview_settings.php:119
1422
+ msgid "Total cron tasks"
1423
+ msgstr ""
1424
+
1425
+ #: includes/overview_settings.php:123
1426
+ msgid "WP multisite Enabled ?"
1427
+ msgstr ""
1428
+
1429
+ #: includes/overview_settings.php:127
1430
+ msgid "Number of sites"
1431
+ msgstr ""
1432
+
1433
+ #: includes/overview_settings.php:131
1434
+ msgid "Script Max timeout"
1435
+ msgstr ""
1436
+
1437
+ #: includes/overview_settings.php:132
1438
+ msgid "seconds"
1439
+ msgstr ""
1440
+
1441
+ #: includes/overview_settings.php:135
1442
+ msgid "Local time"
1443
+ msgstr ""
1444
+
1445
+ #: includes/overview_settings.php:142
1446
+ msgid "Settings"
1447
+ msgstr ""
1448
+
1449
+ #: includes/overview_settings.php:159
1450
+ msgid "Show plugin left menu"
1451
+ msgstr ""
1452
+
1453
+ #: includes/overview_settings.php:161
1454
+ msgid "Displays a menu at the left side of your WP admin"
1455
+ msgstr ""
1456
+
1457
+ #: includes/overview_settings.php:167
1458
+ msgid "Show plugin menu under tools"
1459
+ msgstr ""
1460
+
1461
+ #: includes/overview_settings.php:169
1462
+ msgid "Displays a menu under \"tools\" menu"
1463
+ msgstr ""
1464
+
1465
+ #: includes/overview_settings.php:178
1466
+ msgid "Hide premium tab"
1467
+ msgstr ""
1468
+
1469
+ #: includes/overview_settings.php:180
1470
+ msgid "If checked, it will hide the above premium tab"
1471
+ msgstr ""
1472
+
1473
+ #: includes/overview_settings.php:189
1474
+ msgid "Save settings"
1475
+ msgstr ""
1476
+
1477
+ #: includes/premium_page.php:3
1478
+ msgid "Need more features ?"
1479
+ msgstr ""
1480
+
1481
+ #: includes/premium_page.php:4
1482
+ msgid "Find more advanced features!"
1483
+ msgstr ""
1484
+
1485
+ #: includes/premium_page.php:10 includes/sidebar.php:18
1486
+ msgid "Filter & search specific items"
1487
+ msgstr ""
1488
+
1489
+ #: includes/premium_page.php:11 includes/sidebar.php:19
1490
+ msgid "Detect orphaned options"
1491
+ msgstr ""
1492
+
1493
+ #: includes/premium_page.php:12 includes/sidebar.php:20
1494
+ msgid "Detect orphaned tables"
1495
+ msgstr ""
1496
+
1497
+ #: includes/premium_page.php:13 includes/sidebar.php:21
1498
+ msgid "Detect orphaned cron tasks"
1499
+ msgstr ""
1500
+
1501
+ #: includes/premium_page.php:19
1502
+ msgid "Need support as well ?"
1503
+ msgstr ""
1504
+
1505
+ #: includes/premium_page.php:20
1506
+ msgid "We are available to support you!"
1507
+ msgstr ""
1508
+
1509
+ #: includes/premium_page.php:26
1510
+ msgid "Get quick support"
1511
+ msgstr ""
1512
+
1513
+ #: includes/premium_page.php:27
1514
+ msgid "Get technical support"
1515
+ msgstr ""
1516
+
1517
+ #: includes/premium_page.php:28
1518
+ msgid "No additional fees"
1519
+ msgstr ""
1520
+
1521
+ #: includes/premium_page.php:29
1522
+ msgid "Great support service!"
1523
+ msgstr ""
1524
+
1525
+ #: includes/premium_page.php:36
1526
+ msgid "Buy now!"
1527
+ msgstr ""
1528
+
1529
+ #: includes/premium_page.php:38
1530
+ msgid "Buy now and get all pro features!"
1531
+ msgstr ""
1532
+
1533
+ #: includes/sidebar.php:15
1534
+ msgid "Upgrade to Pro"
1535
+ msgstr ""
1536
+
1537
+ #: includes/sidebar.php:22
1538
+ msgid "Premium & technical support"
1539
+ msgstr ""
1540
+
1541
+ #: includes/sidebar.php:26
1542
+ msgid "The price will increase soon! Buy now at lower price!"
1543
+ msgstr ""
1544
+
1545
+ #. Plugin Name of the plugin/theme
1546
+ msgid "Advanced Database Cleaner PRO"
1547
+ msgstr ""
1548
+
1549
+ #. Plugin URI of the plugin/theme
1550
+ msgid "https://sigmaplugin.com/downloads/wordpress-advanced-database-cleaner"
1551
+ msgstr ""
1552
+
1553
+ #. Description of the plugin/theme
1554
+ msgid ""
1555
+ "Clean database by deleting unused data such as 'old revisions', 'old "
1556
+ "drafts', 'orphan options', etc. Optimize database and more."
1557
+ msgstr ""
1558
+
1559
+ #. Author of the plugin/theme
1560
+ msgid "Younes JFR."
1561
+ msgstr ""
1562
+
1563
+ #. Author URI of the plugin/theme
1564
+ msgid "https://www.sigmaplugin.com"
1565
+ msgstr ""
languages/advanced-db-cleaner.pot DELETED
@@ -1,881 +0,0 @@
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 ""