WP-Optimize - Version 2.1.1

Version Description

  • 28/Feb/2017 =

  • FEATURE: Added the ability to take a automatic backup with UpdraftPlus (https://updraftplus.com) before an optimization

  • FEATURE: When optimizing from the dashboard, tables are now optimized one by one, to reduce the scope for timeouts

  • FIX: Removal of sitemeta items from main site on multisite install was not proceeding

  • TWEAK: Adding premium bootstrapping to WP-Optimize for adding premium features in the future

  • TWEAK: A few wording tweaks, plus automatically refresh the page if the 'admin bar menu' option is changed

  • TWEAK: Introduce internal logging API

Download this release

Release Info

Developer DavidAnderson
Plugin Icon 128x128 WP-Optimize
Version 2.1.1
Comparing to
See all releases

Code changes from version 2.1.0 to 2.1.1

Files changed (41) hide show
  1. css/admin.css +1 -1
  2. css/admin.min.css +1 -1
  3. css/admin.min.css.map +1 -1
  4. includes/class-commands.php +22 -7
  5. includes/class-updraft-abstract-logger.php +64 -0
  6. includes/class-updraft-log-levels.php +42 -0
  7. includes/class-updraft-logger-interface.php +116 -0
  8. includes/class-updraft-logger.php +206 -0
  9. includes/class-updraft-php-logger.php +119 -0
  10. includes/class-updraft-simple-history-logger.php +120 -0
  11. includes/class-wp-optimization.php +16 -3
  12. includes/class-wp-optimize-options.php +42 -0
  13. includes/class-wp-optimizer.php +58 -16
  14. includes/updraft-notices.php +4 -0
  15. includes/wp-optimize-notices.php +2 -0
  16. js/wpadmin.js +154 -53
  17. js/wpadmin.min.js +1 -1
  18. languages/wp-optimize.pot +255 -172
  19. optimizations/autodraft.php +8 -6
  20. optimizations/commentmeta.php +4 -2
  21. optimizations/optimizetables.php +23 -53
  22. optimizations/orphandata.php +2 -1
  23. optimizations/pingbacks.php +5 -2
  24. optimizations/postmeta.php +2 -3
  25. optimizations/revisions.php +2 -1
  26. optimizations/spam.php +14 -8
  27. optimizations/trackbacks.php +4 -1
  28. optimizations/transient.php +3 -2
  29. optimizations/unapproved.php +4 -1
  30. readme.txt +16 -7
  31. templates/admin-page-header.php +10 -19
  32. templates/admin-settings.php +32 -3
  33. templates/may-also-like.php +7 -5
  34. templates/notices/horizontal-notice.php +10 -13
  35. templates/notices/thanks-for-using-main-dash.php +18 -11
  36. templates/optimizations-table.php +19 -5
  37. templates/optimize-table.php +54 -9
  38. templates/status-box-contents.php +7 -7
  39. templates/tables-body.php +13 -12
  40. templates/tables.php +15 -9
  41. wp-optimize.php +231 -32
css/admin.css CHANGED
@@ -73,7 +73,7 @@
73
  width: 100%; } }
74
 
75
  .wp-optimize-settings-clean-transient label, .wp-optimize-settings-clean-pingbacks label, .wp-optimize-settings-clean-trackbacks label, .wp-optimize-settings-clean-postmeta label, .wp-optimize-settings-clean-orphandata label, .wp-optimize-settings-clean-commentmeta label {
76
- color: red; }
77
 
78
  td.wp-optimize-settings-optimization-checkbox {
79
  width: 18px;
73
  width: 100%; } }
74
 
75
  .wp-optimize-settings-clean-transient label, .wp-optimize-settings-clean-pingbacks label, .wp-optimize-settings-clean-trackbacks label, .wp-optimize-settings-clean-postmeta label, .wp-optimize-settings-clean-orphandata label, .wp-optimize-settings-clean-commentmeta label {
76
+ color: #9B0000; }
77
 
78
  td.wp-optimize-settings-optimization-checkbox {
79
  width: 18px;
css/admin.min.css CHANGED
@@ -1,2 +1,2 @@
1
- .wpo_primary_big{padding:4px 6px !important;font-size:22px !important;min-height:34px;min-width:200px}.wpo_section{clear:both;padding:0;margin:0}.wp-optimize-settings{margin-bottom:16px}.wpo_col{display:block;float:left;margin:1% 0 1% 1%}.wpo_col:first-child{margin-left:0}.wpo_group:before,.wpo_group:after{content:"";display:table}.wpo_group:after{clear:both}.wpo_half_width{width:48%}.wpo_span_3_of_3{width:100%}.wpo_span_2_of_3{width:65.3%}.wpo_span_1_of_3{width:32.1%}.nav-tab-wrapper{margin:14px 0}@media screen and (min-width:549px){.show_on_default_sizes{display:block !important}.show_on_mobile_sizes{display:none !important}}@media screen and (max-width:548px){.show_on_default_sizes{display:none !important}.show_on_mobile_sizes{display:block !important}}@media screen and (max-width:768px){.wpo_col{margin:1% 0}.wpo_span_3_of_3{width:100%}.wpo_span_2_of_3{width:100%}.wpo_span_1_of_3{width:100%}.wpo_half_width{width:100%}}.wp-optimize-settings-clean-transient label,.wp-optimize-settings-clean-pingbacks label,.wp-optimize-settings-clean-trackbacks label,.wp-optimize-settings-clean-postmeta label,.wp-optimize-settings-clean-orphandata label,.wp-optimize-settings-clean-commentmeta label{color:red}td.wp-optimize-settings-optimization-checkbox{width:18px;padding-left:4px;padding-right:0}.wp-optimize-settings-optimization-checkbox input{margin:0;padding:0}#retention-period{width:60px}.wp-optimize-settings-optimization-info{font-size:80%;padding-left:32px;font-style:italic}.wp-optimize-settings input[type="checkbox"]{width:18px}img.addons{display:block;margin-left:auto;margin-right:auto;width:260px;height:220px}.wpo_spinner{width:18px;height:18px;padding-left:10px;display:none;position:relative;top:4px}#wp-optimize-auto-options{margin-left:28px}.display-none{display:none}#save_done{color:#d94f00;font-size:250%}.wp-optimize-settings-optimization-run-spinner{position:relative;top:2px}#wp_optimize_table_list_refresh{float:right}#wp_optimize_table_list_refresh:hover{cursor:pointer}
2
  /*# sourceMappingURL=admin.min.css.map */
1
+ .wpo_primary_big{padding:4px 6px !important;font-size:22px !important;min-height:34px;min-width:200px}.wpo_section{clear:both;padding:0;margin:0}.wp-optimize-settings{margin-bottom:16px}.wpo_col{display:block;float:left;margin:1% 0 1% 1%}.wpo_col:first-child{margin-left:0}.wpo_group:before,.wpo_group:after{content:"";display:table}.wpo_group:after{clear:both}.wpo_half_width{width:48%}.wpo_span_3_of_3{width:100%}.wpo_span_2_of_3{width:65.3%}.wpo_span_1_of_3{width:32.1%}.nav-tab-wrapper{margin:14px 0}@media screen and (min-width:549px){.show_on_default_sizes{display:block !important}.show_on_mobile_sizes{display:none !important}}@media screen and (max-width:548px){.show_on_default_sizes{display:none !important}.show_on_mobile_sizes{display:block !important}}@media screen and (max-width:768px){.wpo_col{margin:1% 0}.wpo_span_3_of_3{width:100%}.wpo_span_2_of_3{width:100%}.wpo_span_1_of_3{width:100%}.wpo_half_width{width:100%}}.wp-optimize-settings-clean-transient label,.wp-optimize-settings-clean-pingbacks label,.wp-optimize-settings-clean-trackbacks label,.wp-optimize-settings-clean-postmeta label,.wp-optimize-settings-clean-orphandata label,.wp-optimize-settings-clean-commentmeta label{color:#9b0000}td.wp-optimize-settings-optimization-checkbox{width:18px;padding-left:4px;padding-right:0}.wp-optimize-settings-optimization-checkbox input{margin:0;padding:0}#retention-period{width:60px}.wp-optimize-settings-optimization-info{font-size:80%;padding-left:32px;font-style:italic}.wp-optimize-settings input[type="checkbox"]{width:18px}img.addons{display:block;margin-left:auto;margin-right:auto;width:260px;height:220px}.wpo_spinner{width:18px;height:18px;padding-left:10px;display:none;position:relative;top:4px}#wp-optimize-auto-options{margin-left:28px}.display-none{display:none}#save_done{color:#d94f00;font-size:250%}.wp-optimize-settings-optimization-run-spinner{position:relative;top:2px}#wp_optimize_table_list_refresh{float:right}#wp_optimize_table_list_refresh:hover{cursor:pointer}
2
  /*# sourceMappingURL=admin.min.css.map */
css/admin.min.css.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["admin.css"],"names":[],"mappings":"AAAA,gBAAgB;AAChB,gBAAgB,CAAC;EAChB,OAAO,EAAE,kBAAmB;EAC5B,SAAS,EAAC,eAAgB;EAC1B,UAAU,EAAE,IAAK;EACjB,SAAS,EAAE,KAAM,GACjB;;AAED,gBAAgB;AAChB,YAAY,CAAC;EACZ,KAAK,EAAE,IAAK;EACZ,OAAO,EAAE,CAAE;EACX,MAAM,EAAE,CAAE,GACV;;AAED,qBAAqB,CAAC;EACrB,aAAa,EAAE,IAAK,GACpB;;AAED,oBAAoB;AACpB,QAAQ,CAAC;EACR,OAAO,EAAE,KAAM;EACf,KAAK,EAAE,IAAK;EACZ,MAAM,EAAE,UAAW,GACnB;;AACD,AAAQ,QAAA,YAAY,CAAC;EACpB,WAAW,EAAE,CAAE,GACf;;AAED,gBAAgB;AAChB,AAAU,UAAA,OAAO;AACjB,AAAU,UAAA,MAAM,CAAC;EAChB,OAAO,EAAE,EAAG;EACZ,OAAO,EAAE,KAAM,GACf;;AACD,AAAU,UAAA,MAAM,CAAC;EAChB,KAAK,EAAE,IAAK,GACZ;;AAED,eAAe,CAAC;EACf,KAAK,EAAE,GAAI,GACX;;AAED,qBAAqB;AACrB,gBAAgB,CAAC;EAChB,KAAK,EAAE,IAAK,GACZ;;AACD,gBAAgB,CAAC;EAChB,KAAK,EAAE,KAAM,GACb;;AACD,gBAAgB,CAAC;EAChB,KAAK,EAAE,KAAM,GACb;;AAED,gBAAgB,CAAC;EAChB,MAAM,EAAE,QAAS,GACjB;;AAED,MAAM,CAAN,MAAM,MAAM,SAAS,EAAE,KAAK;EAC3B,sBAAsB,CAAC;IACtB,OAAO,EAAE,gBAAiB,GAC1B;EACD,qBAAqB,CAAC;IACrB,OAAO,EAAE,eAAgB,GACzB;;AAGF,MAAM,CAAN,MAAM,MAAM,SAAS,EAAE,KAAK;EAC3B,sBAAsB,CAAC;IACtB,OAAO,EAAE,eAAgB,GACzB;EACD,qBAAqB,CAAC;IACrB,OAAO,EAAE,gBAAiB,GAC1B;;AAGF,MAAM,CAAN,MAAM,MAAM,SAAS,EAAE,KAAK;EAC3B,QAAQ,CAAC;IACR,MAAM,EAAE,IAAK,GACb;EACD,gBAAgB,CAAC;IAChB,KAAK,EAAE,IAAK,GACZ;EACD,gBAAgB,CAAC;IAChB,KAAK,EAAE,IAAK,GACZ;EACD,gBAAgB,CAAC;IAChB,KAAK,EAAE,IAAK,GACZ;EACD,eAAe,CAAC;IACf,KAAK,EAAE,IAAK,GACZ;;AAGF,AAAsC,qCAAD,CAAC,KAAK,EAAE,AAAsC,qCAAD,CAAC,KAAK,EAAE,AAAuC,sCAAD,CAAC,KAAK,EAAE,AAAqC,oCAAD,CAAC,KAAK,EAAE,AAAuC,sCAAD,CAAC,KAAK,EAAE,AAAwC,uCAAD,CAAC,KAAK,CAAC;EAC/Q,KAAK,EAAE,GAAI,GACX;;AAED,AAAE,EAAA,2CAA2C,CAAC;EAC7C,KAAK,EAAE,IAAK;EACZ,YAAY,EAAE,GAAI;EAClB,aAAa,EAAE,GAAI,GACnB;;AACD,AAA4C,2CAAD,CAAC,KAAK,CAAC;EACjD,MAAM,EAAE,GAAI;EACZ,OAAO,EAAE,GAAI,GACb;;AAED,iBAAiB,CAAC;EACjB,KAAK,EAAE,IAAK,GACZ;;AAED,uCAAuC,CAAC;EACvC,SAAS,EAAE,GAAI;EACf,YAAY,EAAE,IAAK;EACnB,UAAU,EAAE,MAAO,GACnB;;AAED,AAA2C,qBAAtB,CAAC,KAAK,CAAA,IAAC,CAAK,UAAL,AAAe,EAAE;EAC5C,KAAK,EAAE,IAAK,GACZ;;AAED,sCAAsC;AACtC,AAAG,GAAA,OAAO,CAAC;EACT,OAAO,EAAE,KAAM;EACf,WAAW,EAAE,IAAK;EAClB,YAAY,EAAE,IAAK;EACnB,KAAK,EAAE,KAAM;EACb,MAAM,EAAE,KAAM,GACf;;AAED,YAAY,CAAC;EACZ,KAAK,EAAE,IAAK;EACZ,MAAM,EAAE,IAAK;EACb,YAAY,EAAE,IAAK;EACnB,OAAO,EAAE,IAAK;EACd,QAAQ,EAAE,QAAS;EACnB,GAAG,EAAE,GAAI,GACT;;AAED,yBAAyB,CAAC;EACzB,WAAW,EAAE,IAAK,GAClB;;AAED,aAAa,CAAC;EACb,OAAO,EAAE,IAAK,GACd;;AAED,UAAU,CAAC;EACV,KAAK,EAAE,OAAQ;EACf,SAAS,EAAE,IAAK,GAChB;;AAED,8CAA8C,CAAC;EAC9C,QAAQ,EAAE,QAAS;EACnB,GAAG,EAAE,GAAI,GACT;;AAED,+BAA+B,CAAC;EAC/B,KAAK,EAAE,KAAM,GACb;;AACD,AAA+B,+BAAA,MAAM,CAAC;EACrC,MAAM,EAAE,OAAQ,GAChB","file":"admin.min.css","sourcesContent":["/* big button */\n.wpo_primary_big {\n\tpadding: 4px 6px !important;\n\tfont-size:22px !important;\n\tmin-height: 34px;\n\tmin-width: 200px;\n}\n\n/* SECTIONS */\n.wpo_section {\n\tclear: both;\n\tpadding: 0;\n\tmargin: 0;\n}\n\n.wp-optimize-settings {\n\tmargin-bottom: 16px;\n}\n\n/* COLUMN SETUP */\n.wpo_col {\n\tdisplay: block;\n\tfloat: left;\n\tmargin: 1% 0 1% 1%;\n}\n.wpo_col:first-child {\n\tmargin-left: 0;\n}\n\n/* GROUPING */\n.wpo_group:before,\n.wpo_group:after {\n\tcontent: \"\";\n\tdisplay: table;\n}\n.wpo_group:after {\n\tclear: both;\n}\n\n.wpo_half_width {\n\twidth: 48%;\n}\n\n/* GRID OF THREE */\n.wpo_span_3_of_3 {\n\twidth: 100%;\n}\n.wpo_span_2_of_3 {\n\twidth: 65.3%;\n}\n.wpo_span_1_of_3 {\n\twidth: 32.1%;\n}\n\n.nav-tab-wrapper {\n\tmargin: 14px 0px;\n}\n\n@media screen and (min-width: 549px) {\n\t.show_on_default_sizes {\n\t\tdisplay: block !important;\n\t}\n\t.show_on_mobile_sizes {\n\t\tdisplay: none !important;\n\t}\n}\n\n@media screen and (max-width: 548px) {\n\t.show_on_default_sizes {\n\t\tdisplay: none !important;\n\t}\n\t.show_on_mobile_sizes {\n\t\tdisplay: block !important;\n\t}\n}\n\n@media screen and (max-width: 768px) {\n\t.wpo_col {\n\t\tmargin: 1% 0;\n\t}\n\t.wpo_span_3_of_3 {\n\t\twidth: 100%;\n\t}\n\t.wpo_span_2_of_3 {\n\t\twidth: 100%;\n\t}\n\t.wpo_span_1_of_3 {\n\t\twidth: 100%;\n\t}\n\t.wpo_half_width {\n\t\twidth: 100%;\n\t}\n}\n\n.wp-optimize-settings-clean-transient label, .wp-optimize-settings-clean-pingbacks label, .wp-optimize-settings-clean-trackbacks label, .wp-optimize-settings-clean-postmeta label, .wp-optimize-settings-clean-orphandata label, .wp-optimize-settings-clean-commentmeta label {\n\tcolor: red;\n}\n\ntd.wp-optimize-settings-optimization-checkbox {\n\twidth: 18px;\n\tpadding-left: 4px;\n\tpadding-right: 0px;\n}\n.wp-optimize-settings-optimization-checkbox input {\n\tmargin: 0px;\n\tpadding: 0px;\n}\n\n#retention-period {\n\twidth: 60px;\n}\n\n.wp-optimize-settings-optimization-info {\n\tfont-size: 80%;\n\tpadding-left: 32px;\n\tfont-style: italic;\n}\n\n.wp-optimize-settings input[type=\"checkbox\"] {\n\twidth: 18px;\n}\n\n/* Added for the Image on Addons tab*/\nimg.addons {\n display: block;\n margin-left: auto;\n margin-right: auto;\n width: 260px;\n height: 220px;\n}\n\n.wpo_spinner {\n\twidth: 18px;\n\theight: 18px;\n\tpadding-left: 10px;\n\tdisplay: none;\n\tposition: relative;\n\ttop: 4px;\n}\n\n#wp-optimize-auto-options {\n\tmargin-left: 28px;\n}\n\n.display-none {\n\tdisplay: none;\n}\n\n#save_done {\n\tcolor: #d94f00;\n\tfont-size: 250%;\n}\n\n.wp-optimize-settings-optimization-run-spinner {\n\tposition: relative;\n\ttop: 2px;\n}\n\n#wp_optimize_table_list_refresh {\n\tfloat: right;\n}\n#wp_optimize_table_list_refresh:hover {\n\tcursor: pointer;\n}\n"]}
1
+ {"version":3,"sources":["admin.css"],"names":[],"mappings":"AAAA,gBAAgB;AAChB,gBAAgB,CAAC;EAChB,OAAO,EAAE,kBAAmB;EAC5B,SAAS,EAAC,eAAgB;EAC1B,UAAU,EAAE,IAAK;EACjB,SAAS,EAAE,KAAM,GACjB;;AAED,gBAAgB;AAChB,YAAY,CAAC;EACZ,KAAK,EAAE,IAAK;EACZ,OAAO,EAAE,CAAE;EACX,MAAM,EAAE,CAAE,GACV;;AAED,qBAAqB,CAAC;EACrB,aAAa,EAAE,IAAK,GACpB;;AAED,oBAAoB;AACpB,QAAQ,CAAC;EACR,OAAO,EAAE,KAAM;EACf,KAAK,EAAE,IAAK;EACZ,MAAM,EAAE,UAAW,GACnB;;AACD,AAAQ,QAAA,YAAY,CAAC;EACpB,WAAW,EAAE,CAAE,GACf;;AAED,gBAAgB;AAChB,AAAU,UAAA,OAAO;AACjB,AAAU,UAAA,MAAM,CAAC;EAChB,OAAO,EAAE,EAAG;EACZ,OAAO,EAAE,KAAM,GACf;;AACD,AAAU,UAAA,MAAM,CAAC;EAChB,KAAK,EAAE,IAAK,GACZ;;AAED,eAAe,CAAC;EACf,KAAK,EAAE,GAAI,GACX;;AAED,qBAAqB;AACrB,gBAAgB,CAAC;EAChB,KAAK,EAAE,IAAK,GACZ;;AACD,gBAAgB,CAAC;EAChB,KAAK,EAAE,KAAM,GACb;;AACD,gBAAgB,CAAC;EAChB,KAAK,EAAE,KAAM,GACb;;AAED,gBAAgB,CAAC;EAChB,MAAM,EAAE,QAAS,GACjB;;AAED,MAAM,CAAN,MAAM,MAAM,SAAS,EAAE,KAAK;EAC3B,sBAAsB,CAAC;IACtB,OAAO,EAAE,gBAAiB,GAC1B;EACD,qBAAqB,CAAC;IACrB,OAAO,EAAE,eAAgB,GACzB;;AAGF,MAAM,CAAN,MAAM,MAAM,SAAS,EAAE,KAAK;EAC3B,sBAAsB,CAAC;IACtB,OAAO,EAAE,eAAgB,GACzB;EACD,qBAAqB,CAAC;IACrB,OAAO,EAAE,gBAAiB,GAC1B;;AAGF,MAAM,CAAN,MAAM,MAAM,SAAS,EAAE,KAAK;EAC3B,QAAQ,CAAC;IACR,MAAM,EAAE,IAAK,GACb;EACD,gBAAgB,CAAC;IAChB,KAAK,EAAE,IAAK,GACZ;EACD,gBAAgB,CAAC;IAChB,KAAK,EAAE,IAAK,GACZ;EACD,gBAAgB,CAAC;IAChB,KAAK,EAAE,IAAK,GACZ;EACD,eAAe,CAAC;IACf,KAAK,EAAE,IAAK,GACZ;;AAGF,AAAsC,qCAAD,CAAC,KAAK,EAAE,AAAsC,qCAAD,CAAC,KAAK,EAAE,AAAuC,sCAAD,CAAC,KAAK,EAAE,AAAqC,oCAAD,CAAC,KAAK,EAAE,AAAuC,sCAAD,CAAC,KAAK,EAAE,AAAwC,uCAAD,CAAC,KAAK,CAAC;EAC/Q,KAAK,EAAE,OAAQ,GACf;;AAED,AAAE,EAAA,2CAA2C,CAAC;EAC7C,KAAK,EAAE,IAAK;EACZ,YAAY,EAAE,GAAI;EAClB,aAAa,EAAE,GAAI,GACnB;;AACD,AAA4C,2CAAD,CAAC,KAAK,CAAC;EACjD,MAAM,EAAE,GAAI;EACZ,OAAO,EAAE,GAAI,GACb;;AAED,iBAAiB,CAAC;EACjB,KAAK,EAAE,IAAK,GACZ;;AAED,uCAAuC,CAAC;EACvC,SAAS,EAAE,GAAI;EACf,YAAY,EAAE,IAAK;EACnB,UAAU,EAAE,MAAO,GACnB;;AAED,AAA2C,qBAAtB,CAAC,KAAK,CAAA,IAAC,CAAK,UAAL,AAAe,EAAE;EAC5C,KAAK,EAAE,IAAK,GACZ;;AAED,sCAAsC;AACtC,AAAG,GAAA,OAAO,CAAC;EACT,OAAO,EAAE,KAAM;EACf,WAAW,EAAE,IAAK;EAClB,YAAY,EAAE,IAAK;EACnB,KAAK,EAAE,KAAM;EACb,MAAM,EAAE,KAAM,GACf;;AAED,YAAY,CAAC;EACZ,KAAK,EAAE,IAAK;EACZ,MAAM,EAAE,IAAK;EACb,YAAY,EAAE,IAAK;EACnB,OAAO,EAAE,IAAK;EACd,QAAQ,EAAE,QAAS;EACnB,GAAG,EAAE,GAAI,GACT;;AAED,yBAAyB,CAAC;EACzB,WAAW,EAAE,IAAK,GAClB;;AAED,aAAa,CAAC;EACb,OAAO,EAAE,IAAK,GACd;;AAED,UAAU,CAAC;EACV,KAAK,EAAE,OAAQ;EACf,SAAS,EAAE,IAAK,GAChB;;AAED,8CAA8C,CAAC;EAC9C,QAAQ,EAAE,QAAS;EACnB,GAAG,EAAE,GAAI,GACT;;AAED,+BAA+B,CAAC;EAC/B,KAAK,EAAE,KAAM,GACb;;AACD,AAA+B,+BAAA,MAAM,CAAC;EACrC,MAAM,EAAE,OAAQ,GAChB","file":"admin.min.css","sourcesContent":["/* big button */\n.wpo_primary_big {\n\tpadding: 4px 6px !important;\n\tfont-size:22px !important;\n\tmin-height: 34px;\n\tmin-width: 200px;\n}\n\n/* SECTIONS */\n.wpo_section {\n\tclear: both;\n\tpadding: 0;\n\tmargin: 0;\n}\n\n.wp-optimize-settings {\n\tmargin-bottom: 16px;\n}\n\n/* COLUMN SETUP */\n.wpo_col {\n\tdisplay: block;\n\tfloat: left;\n\tmargin: 1% 0 1% 1%;\n}\n.wpo_col:first-child {\n\tmargin-left: 0;\n}\n\n/* GROUPING */\n.wpo_group:before,\n.wpo_group:after {\n\tcontent: \"\";\n\tdisplay: table;\n}\n.wpo_group:after {\n\tclear: both;\n}\n\n.wpo_half_width {\n\twidth: 48%;\n}\n\n/* GRID OF THREE */\n.wpo_span_3_of_3 {\n\twidth: 100%;\n}\n.wpo_span_2_of_3 {\n\twidth: 65.3%;\n}\n.wpo_span_1_of_3 {\n\twidth: 32.1%;\n}\n\n.nav-tab-wrapper {\n\tmargin: 14px 0px;\n}\n\n@media screen and (min-width: 549px) {\n\t.show_on_default_sizes {\n\t\tdisplay: block !important;\n\t}\n\t.show_on_mobile_sizes {\n\t\tdisplay: none !important;\n\t}\n}\n\n@media screen and (max-width: 548px) {\n\t.show_on_default_sizes {\n\t\tdisplay: none !important;\n\t}\n\t.show_on_mobile_sizes {\n\t\tdisplay: block !important;\n\t}\n}\n\n@media screen and (max-width: 768px) {\n\t.wpo_col {\n\t\tmargin: 1% 0;\n\t}\n\t.wpo_span_3_of_3 {\n\t\twidth: 100%;\n\t}\n\t.wpo_span_2_of_3 {\n\t\twidth: 100%;\n\t}\n\t.wpo_span_1_of_3 {\n\t\twidth: 100%;\n\t}\n\t.wpo_half_width {\n\t\twidth: 100%;\n\t}\n}\n\n.wp-optimize-settings-clean-transient label, .wp-optimize-settings-clean-pingbacks label, .wp-optimize-settings-clean-trackbacks label, .wp-optimize-settings-clean-postmeta label, .wp-optimize-settings-clean-orphandata label, .wp-optimize-settings-clean-commentmeta label {\n\tcolor: #9B0000;\n}\n\ntd.wp-optimize-settings-optimization-checkbox {\n\twidth: 18px;\n\tpadding-left: 4px;\n\tpadding-right: 0px;\n}\n.wp-optimize-settings-optimization-checkbox input {\n\tmargin: 0px;\n\tpadding: 0px;\n}\n\n#retention-period {\n\twidth: 60px;\n}\n\n.wp-optimize-settings-optimization-info {\n\tfont-size: 80%;\n\tpadding-left: 32px;\n\tfont-style: italic;\n}\n\n.wp-optimize-settings input[type=\"checkbox\"] {\n\twidth: 18px;\n}\n\n/* Added for the Image on Addons tab*/\nimg.addons {\n display: block;\n margin-left: auto;\n margin-right: auto;\n width: 260px;\n height: 220px;\n}\n\n.wpo_spinner {\n\twidth: 18px;\n\theight: 18px;\n\tpadding-left: 10px;\n\tdisplay: none;\n\tposition: relative;\n\ttop: 4px;\n}\n\n#wp-optimize-auto-options {\n\tmargin-left: 28px;\n}\n\n.display-none {\n\tdisplay: none;\n}\n\n#save_done {\n\tcolor: #d94f00;\n\tfont-size: 250%;\n}\n\n.wp-optimize-settings-optimization-run-spinner {\n\tposition: relative;\n\ttop: 2px;\n}\n\n#wp_optimize_table_list_refresh {\n\tfloat: right;\n}\n#wp_optimize_table_list_refresh:hover {\n\tcursor: pointer;\n}\n"]}
includes/class-commands.php CHANGED
@@ -38,7 +38,7 @@ class WP_Optimize_Commands {
38
  public function save_manual_run_optimization_options($sent_options) {
39
  return $this->options->save_sent_manual_run_optimization_options($sent_options);
40
  }
41
-
42
  public function get_status_box_contents() {
43
  return WP_Optimize()->include_template('status-box-contents.php', true, array('optimize_db' => false));
44
  }
@@ -58,12 +58,26 @@ class WP_Optimize_Commands {
58
  'status_box_contents' => $this->get_status_box_contents(),
59
  'optimizations_table' => $this->get_optimizations_table(),
60
  );
 
61
 
 
 
 
 
 
 
 
 
62
  }
63
 
64
- public function do_optimization($data) {
 
 
 
 
 
65
 
66
- if (!isset($data['optimization_id'])) {
67
 
68
  $results = array(
69
  'result' => false,
@@ -74,10 +88,11 @@ class WP_Optimize_Commands {
74
  );
75
 
76
  } else {
77
-
78
- $optimization_id = $data['optimization_id'];
79
-
80
- $optimization = $this->optimizer->get_optimization($optimization_id);
 
81
 
82
  $result = is_a($optimization, 'WP_Optimization') ? $optimization->do_optimization() : null;
83
 
38
  public function save_manual_run_optimization_options($sent_options) {
39
  return $this->options->save_sent_manual_run_optimization_options($sent_options);
40
  }
41
+
42
  public function get_status_box_contents() {
43
  return WP_Optimize()->include_template('status-box-contents.php', true, array('optimize_db' => false));
44
  }
58
  'status_box_contents' => $this->get_status_box_contents(),
59
  'optimizations_table' => $this->get_optimizations_table(),
60
  );
61
+ }
62
 
63
+ /**
64
+ * This sends the selected tick value over to the save function
65
+ * within class-wp-optimize-options.php
66
+ * @param Array $data an array of data that includes true or false for click option
67
+ * @return Array returns an message array
68
+ */
69
+ public function save_auto_backup_option($data) {
70
+ return array('save_auto_backup_option' => $this->options->save_auto_backup_option($data));
71
  }
72
 
73
+ /**
74
+ * Perform the requested optimization
75
+ *
76
+ * @param array $params - Should have keys 'optimization_id' and 'data'
77
+ */
78
+ public function do_optimization($params) {
79
 
80
+ if (!isset($params['optimization_id'])) {
81
 
82
  $results = array(
83
  'result' => false,
88
  );
89
 
90
  } else {
91
+
92
+ $optimization_id = $params['optimization_id'];
93
+ $data = isset($params['data']) ? $params['data'] : array();
94
+
95
+ $optimization = $this->optimizer->get_optimization($optimization_id, $data);
96
 
97
  $result = is_a($optimization, 'WP_Optimization') ? $optimization->do_optimization() : null;
98
 
includes/class-updraft-abstract-logger.php ADDED
@@ -0,0 +1,64 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ if (!defined('ABSPATH')) die('No direct access allowed');
4
+
5
+ if (class_exists('Updraft_Abstract_Logger')) return ;
6
+
7
+ /**
8
+ * Class Updraft_Abstract_Logger
9
+ */
10
+ abstract class Updraft_Abstract_Logger implements Updraft_Logger_Interface {
11
+
12
+ protected $enabled = true;
13
+
14
+ /**
15
+ * Updraft_Abstract_Logger constructor
16
+ */
17
+ public function __construct() {}
18
+
19
+ /**
20
+ * Returns true if logger is active
21
+ * @return bool
22
+ */
23
+ public function is_enabled() {
24
+ return $this->enabled;
25
+ }
26
+
27
+ /**
28
+ * Enable logger
29
+ */
30
+ public function enable() {
31
+ $this->enabled = true;
32
+ }
33
+
34
+ /**
35
+ * Disable logger
36
+ */
37
+ public function disable() {
38
+ $this->enabled = false;
39
+ }
40
+
41
+ /**
42
+ * Returns logger description
43
+ * @return mixed
44
+ */
45
+ abstract function get_description();
46
+
47
+ /**
48
+ * https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-3-logger-interface.md
49
+ * @param $message
50
+ * @param array $context
51
+ * @return string
52
+ */
53
+ protected function interpolate($message, array $context = array()) {
54
+ $replace = array();
55
+ foreach ($context as $key => $val) {
56
+ // check that the value can be casted to string
57
+ if (!is_array($val) && (!is_object($val) || method_exists($val, '__toString'))) {
58
+ $replace['{' . $key . '}'] = $val;
59
+ }
60
+ }
61
+ return strtr($message, $replace);
62
+ }
63
+
64
+ }
includes/class-updraft-log-levels.php ADDED
@@ -0,0 +1,42 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ if (!defined('ABSPATH')) die('No direct access allowed');
4
+
5
+ if (class_exists('Updraft_Log_Levels')) return ;
6
+
7
+ /**
8
+ * Class Updraft_Log_Levels
9
+ */
10
+ class Updraft_Log_Levels
11
+ {
12
+ const EMERGENCY = 'emergency';
13
+ const ALERT = 'alert';
14
+ const CRITICAL = 'critical';
15
+ const ERROR = 'error';
16
+ const WARNING = 'warning';
17
+ const NOTICE = 'notice';
18
+ const INFO = 'info';
19
+ const DEBUG = 'debug';
20
+
21
+ /**
22
+ * Return level text caption
23
+ * @param $level
24
+ * @return string
25
+ */
26
+ static public function toText($level) {
27
+ $text = array(
28
+ self::EMERGENCY => 'EMERGENCY',
29
+ self::ALERT => 'ALERT',
30
+ self::CRITICAL => 'CRITICAL',
31
+ self::ERROR => 'ERROR',
32
+ self::WARNING => 'WARNING',
33
+ self::NOTICE => 'NOTICE',
34
+ self::INFO => 'INFO',
35
+ self::DEBUG => 'DEBUG',
36
+ );
37
+
38
+ if (array_key_exists($level, $text)) return $text[$level];
39
+
40
+ return '';
41
+ }
42
+ }
includes/class-updraft-logger-interface.php ADDED
@@ -0,0 +1,116 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ if (!defined('ABSPATH')) die('No direct access allowed');
4
+
5
+ if (class_exists('Updraft_Logger_Interface')) return false;
6
+
7
+ /**
8
+ * Describes a logger instance
9
+ *
10
+ * The message MUST be a string or object implementing __toString().
11
+ *
12
+ * The message MAY contain placeholders in the form: {foo} where foo
13
+ * will be replaced by the context data in key "foo".
14
+ *
15
+ * The context array can contain arbitrary data, the only assumption that
16
+ * can be made by implementors is that if an Exception instance is given
17
+ * to produce a stack trace, it MUST be in a key named "exception".
18
+ *
19
+ * See https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-3-logger-interface.md
20
+ * for the full interface specification.
21
+ */
22
+ interface Updraft_Logger_Interface
23
+ {
24
+ /**
25
+ * System is unusable.
26
+ *
27
+ * @param string $message
28
+ * @param array $context
29
+ * @return null
30
+ */
31
+ public function emergency($message, array $context = array());
32
+
33
+ /**
34
+ * Action must be taken immediately.
35
+ *
36
+ * Example: Entire website down, database unavailable, etc. This should
37
+ * trigger the SMS alerts and wake you up.
38
+ *
39
+ * @param string $message
40
+ * @param array $context
41
+ * @return null
42
+ */
43
+ public function alert($message, array $context = array());
44
+
45
+ /**
46
+ * Critical conditions.
47
+ *
48
+ * Example: Application component unavailable, unexpected exception.
49
+ *
50
+ * @param string $message
51
+ * @param array $context
52
+ * @return null
53
+ */
54
+ public function critical($message, array $context = array());
55
+
56
+ /**
57
+ * Runtime errors that do not require immediate action but should typically
58
+ * be logged and monitored.
59
+ *
60
+ * @param string $message
61
+ * @param array $context
62
+ * @return null
63
+ */
64
+ public function error($message, array $context = array());
65
+
66
+ /**
67
+ * Exceptional occurrences that are not errors.
68
+ *
69
+ * Example: Use of deprecated APIs, poor use of an API, undesirable things
70
+ * that are not necessarily wrong.
71
+ *
72
+ * @param string $message
73
+ * @param array $context
74
+ * @return null
75
+ */
76
+ public function warning($message, array $context = array());
77
+
78
+ /**
79
+ * Normal but significant events.
80
+ *
81
+ * @param string $message
82
+ * @param array $context
83
+ * @return null
84
+ */
85
+ public function notice($message, array $context = array());
86
+
87
+ /**
88
+ * Interesting events.
89
+ *
90
+ * Example: User logs in, SQL logs.
91
+ *
92
+ * @param string $message
93
+ * @param array $context
94
+ * @return null
95
+ */
96
+ public function info($message, array $context = array());
97
+
98
+ /**
99
+ * Detailed debug information.
100
+ *
101
+ * @param string $message
102
+ * @param array $context
103
+ * @return null
104
+ */
105
+ public function debug($message, array $context = array());
106
+
107
+ /**
108
+ * Logs with an arbitrary level.
109
+ *
110
+ * @param mixed $level
111
+ * @param string $message
112
+ * @param array $context
113
+ * @return null
114
+ */
115
+ public function log($level, $message, array $context = array());
116
+ }
includes/class-updraft-logger.php ADDED
@@ -0,0 +1,206 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ if (!defined('ABSPATH')) die('No direct access allowed');
4
+
5
+ require_once('class-updraft-logger-interface.php');
6
+ require_once('class-updraft-log-levels.php');
7
+ require_once('class-updraft-abstract-logger.php');
8
+ require_once('class-updraft-logger.php');
9
+
10
+ if (class_exists('Updraft_Logger')) return ;
11
+
12
+ /**
13
+ * Class Updraft_Logger
14
+ */
15
+ class Updraft_Logger implements Updraft_Logger_Interface {
16
+ protected $_loggers = array();
17
+
18
+ /**
19
+ * Constructor method
20
+ * @param Updraft_Logger_Interface $logger
21
+ */
22
+ public function __construct(Updraft_Logger_Interface $logger = null) {
23
+ if (!is_null($logger)) $this->_loggers = array($logger);
24
+ }
25
+
26
+ /**
27
+ * Add logger to loggers list
28
+ * @param Updraft_Logger_Interface $logger
29
+ */
30
+ public function add_logger(Updraft_Logger_Interface $logger) {
31
+ $this->_loggers[] = $logger;
32
+ }
33
+
34
+ /**
35
+ * Return list of loggers
36
+ * @return array
37
+ */
38
+ public function get_loggers() {
39
+ return $this->_loggers;
40
+ }
41
+
42
+ /**
43
+ * System is unusable.
44
+ *
45
+ * @param string $message
46
+ * @param array $context
47
+ * @return null
48
+ */
49
+ public function emergency($message, array $context = array()) {
50
+
51
+ if (empty($this->_loggers)) return false;
52
+
53
+ foreach($this->_loggers as $logger) {
54
+ $logger->emergency($message, $context);
55
+ }
56
+
57
+ }
58
+
59
+ /**
60
+ * Action must be taken immediately.
61
+ *
62
+ * Example: Entire website down, database unavailable, etc. This should
63
+ * trigger the SMS alerts and wake you up.
64
+ *
65
+ * @param string $message
66
+ * @param array $context
67
+ * @return null
68
+ */
69
+ public function alert($message, array $context = array()) {
70
+
71
+ if (empty($this->_loggers)) return false;
72
+
73
+ foreach($this->_loggers as $logger) {
74
+ $logger->alert($message, $context);
75
+ }
76
+
77
+ }
78
+
79
+ /**
80
+ * Critical conditions.
81
+ *
82
+ * Example: Application component unavailable, unexpected exception.
83
+ *
84
+ * @param string $message
85
+ * @param array $context
86
+ * @return null
87
+ */
88
+ public function critical($message, array $context = array()) {
89
+
90
+ if (empty($this->_loggers)) return false;
91
+
92
+ foreach($this->_loggers as $logger) {
93
+ $logger->critical($message, $context);
94
+ }
95
+
96
+ }
97
+
98
+ /**
99
+ * Runtime errors that do not require immediate action but should typically
100
+ * be logged and monitored.
101
+ *
102
+ * @param string $message
103
+ * @param array $context
104
+ * @return null
105
+ */
106
+ public function error($message, array $context = array()) {
107
+
108
+ if (empty($this->_loggers)) return false;
109
+
110
+ foreach($this->_loggers as $logger) {
111
+ $logger->error($message, $context);
112
+ }
113
+
114
+ }
115
+
116
+ /**
117
+ * Exceptional occurrences that are not errors.
118
+ *
119
+ * Example: Use of deprecated APIs, poor use of an API, undesirable things
120
+ * that are not necessarily wrong.
121
+ *
122
+ * @param string $message
123
+ * @param array $context
124
+ * @return null
125
+ */
126
+ public function warning($message, array $context = array()) {
127
+
128
+ if (empty($this->_loggers)) return false;
129
+
130
+ foreach($this->_loggers as $logger) {
131
+ $logger->warning($message, $context);
132
+ }
133
+
134
+ }
135
+
136
+ /**
137
+ * Normal but significant events.
138
+ *
139
+ * @param string $message
140
+ * @param array $context
141
+ * @return null
142
+ */
143
+ public function notice($message, array $context = array()) {
144
+
145
+ if (empty($this->_loggers)) return false;
146
+
147
+ foreach($this->_loggers as $logger) {
148
+ $logger->notice($message, $context);
149
+ }
150
+
151
+ }
152
+
153
+ /**
154
+ * Interesting events.
155
+ *
156
+ * Example: User logs in, SQL logs.
157
+ *
158
+ * @param string $message
159
+ * @param array $context
160
+ * @return null
161
+ */
162
+ public function info($message, array $context = array()) {
163
+
164
+ if (empty($this->_loggers)) return false;
165
+
166
+ foreach($this->_loggers as $logger) {
167
+ $logger->info($message, $context);
168
+ }
169
+
170
+ }
171
+
172
+ /**
173
+ * Detailed debug information.
174
+ *
175
+ * @param string $message
176
+ * @param array $context
177
+ * @return null
178
+ */
179
+ public function debug($message, array $context = array()) {
180
+
181
+ if (empty($this->_loggers)) return false;
182
+
183
+ foreach($this->_loggers as &$logger) {
184
+ $logger->debug($message, $context);
185
+ }
186
+
187
+ }
188
+
189
+ /**
190
+ * Logs with an arbitrary level.
191
+ *
192
+ * @param mixed $level
193
+ * @param string $message
194
+ * @param array $context
195
+ * @return null
196
+ */
197
+ public function log($level, $message, array $context = array()) {
198
+
199
+ if (empty($this->_loggers)) return false;
200
+
201
+ foreach($this->_loggers as $logger) {
202
+ $logger->log($message, $context);
203
+ }
204
+
205
+ }
206
+ }
includes/class-updraft-php-logger.php ADDED
@@ -0,0 +1,119 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ if (!defined('ABSPATH')) die('No direct access allowed');
4
+
5
+ if (class_exists('Updraft_PHP_Logger')) return ;
6
+
7
+ /**
8
+ * Class Updraft_PHP_Logger
9
+ */
10
+ class Updraft_PHP_Logger extends Updraft_Abstract_Logger {
11
+
12
+ /**
13
+ * Updraft_PHP_Logger constructor
14
+ */
15
+ public function __construct() { }
16
+
17
+ /**
18
+ * Returns logger description
19
+ * @return string|void
20
+ */
21
+ public function get_description() {
22
+ return __('Log events into PHP error log', 'wp-optimize');
23
+ }
24
+
25
+ /**
26
+ * Emergency message
27
+ * @param string $message
28
+ * @param array $context
29
+ * @return null|void
30
+ */
31
+ public function emergency($message, array $context = array()) {
32
+ $this->log(Updraft_Log_Levels::EMERGENCY, $message, $context);
33
+ }
34
+
35
+ /**
36
+ * Alert message
37
+ * @param string $message
38
+ * @param array $context
39
+ * @return null|void
40
+ */
41
+ public function alert($message, array $context = array()) {
42
+ $this->log(Updraft_Log_Levels::ALERT, $message, $context);
43
+ }
44
+
45
+ /**
46
+ * Critical message
47
+ * @param string $message
48
+ * @param array $context
49
+ * @return null|void
50
+ */
51
+ public function critical($message, array $context = array()) {
52
+ $this->log(Updraft_Log_Levels::CRITICAL, $message, $context);
53
+ }
54
+
55
+ /**
56
+ * Error message
57
+ * @param string $message
58
+ * @param array $context
59
+ * @return null|void
60
+ */
61
+ public function error($message, array $context = array()) {
62
+ $this->log(Updraft_Log_Levels::ERROR, $message, $context);
63
+ }
64
+
65
+ /**
66
+ * Warning message
67
+ * @param string $message
68
+ * @param array $context
69
+ * @return null|void
70
+ */
71
+ public function warning($message, array $context = array()) {
72
+ $this->log(Updraft_Log_Levels::WARNING, $message, $context);
73
+ }
74
+
75
+ /**
76
+ * Notice message
77
+ * @param string $message
78
+ * @param array $context
79
+ * @return null|void
80
+ */
81
+ public function notice($message, array $context = array()) {
82
+ $this->log(Updraft_Log_Levels::NOTICE, $message, $context);
83
+ }
84
+
85
+ /**
86
+ * Info message
87
+ * @param string $message
88
+ * @param array $context
89
+ * @return null|void
90
+ */
91
+ public function info($message, array $context = array()) {
92
+ $this->log(Updraft_Log_Levels::INFO, $message, $context);
93
+ }
94
+
95
+ /**
96
+ * Debug message
97
+ * @param string $message
98
+ * @param array $context
99
+ * @return null|void
100
+ */
101
+ public function debug($message, array $context = array()) {
102
+ $this->log(Updraft_Log_Levels::DEBUG, $message, $context);
103
+ }
104
+
105
+ /**
106
+ * Log message with any level
107
+ * @param mixed $level
108
+ * @param string $message
109
+ * @param array $context
110
+ * @return null|void
111
+ */
112
+ public function log($level, $message, array $context = array()) {
113
+
114
+ if (!$this->is_enabled()) return false;
115
+
116
+ $message = '['.Updraft_Log_Levels::toText($level).'] : '.$this->interpolate($message, $context);
117
+ error_log($message);
118
+ }
119
+ }
includes/class-updraft-simple-history-logger.php ADDED
@@ -0,0 +1,120 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ if (!defined('ABSPATH')) die('No direct access allowed');
4
+
5
+ if (class_exists('Updraft_Simple_History_Logger')) return ;
6
+
7
+ /**
8
+ * Class Updraft_Simple_History_Logger
9
+ */
10
+ class Updraft_Simple_History_Logger extends Updraft_Abstract_Logger {
11
+
12
+ /**
13
+ * Updraft_Simple_History_Logger constructor
14
+ */
15
+ public function __construct() { }
16
+
17
+ /**
18
+ * Returns logger description
19
+ * @return string|void
20
+ */
21
+ public function get_description() {
22
+ return __('Log events into Simple History plugin', 'wp-optimize');
23
+ }
24
+
25
+ /**
26
+ * Emergency message
27
+ * @param string $message
28
+ * @param array $context
29
+ * @return null|void
30
+ */
31
+ public function emergency($message, array $context = array()) {
32
+ $this->log(Updraft_Log_Levels::EMERGENCY, $message, $context);
33
+ }
34
+
35
+ /**
36
+ * Alert message
37
+ * @param string $message
38
+ * @param array $context
39
+ * @return null|void
40
+ */
41
+ public function alert($message, array $context = array()) {
42
+ $this->log(Updraft_Log_Levels::ALERT, $message, $context);
43
+ }
44
+
45
+ /**
46
+ * Critical message
47
+ * @param string $message
48
+ * @param array $context
49
+ * @return null|void
50
+ */
51
+ public function critical($message, array $context = array()) {
52
+ $this->log(Updraft_Log_Levels::CRITICAL, $message, $context);
53
+ }
54
+
55
+ /**
56
+ * Error message
57
+ * @param string $message
58
+ * @param array $context
59
+ * @return null|void
60
+ */
61
+ public function error($message, array $context = array()) {
62
+ $this->log(Updraft_Log_Levels::ERROR, $message, $context);
63
+ }
64
+
65
+ /**
66
+ * Warning message
67
+ * @param string $message
68
+ * @param array $context
69
+ * @return null|void
70
+ */
71
+ public function warning($message, array $context = array()) {
72
+ $this->log(Updraft_Log_Levels::WARNING, $message, $context);
73
+ }
74
+
75
+ /**
76
+ * Notice message
77
+ * @param string $message
78
+ * @param array $context
79
+ * @return null|void
80
+ */
81
+ public function notice($message, array $context = array()) {
82
+ $this->log(Updraft_Log_Levels::NOTICE, $message, $context);
83
+ }
84
+
85
+ /**
86
+ * Info message
87
+ * @param string $message
88
+ * @param array $context
89
+ * @return null|void
90
+ */
91
+ public function info($message, array $context = array()) {
92
+ $this->log(Updraft_Log_Levels::INFO, $message, $context);
93
+ }
94
+
95
+ /**
96
+ * Debug message
97
+ * @param string $message
98
+ * @param array $context
99
+ * @return null|void
100
+ */
101
+ public function debug($message, array $context = array()) {
102
+ $this->log(Updraft_Log_Levels::DEBUG, $message, $context);
103
+ }
104
+
105
+ /**
106
+ * Log message with any level
107
+ * @param mixed $level
108
+ * @param string $message
109
+ * @param array $context
110
+ * @return null|void
111
+ */
112
+ public function log($level, $message, array $context = array()) {
113
+
114
+ if (!$this->is_enabled()) return false;
115
+
116
+ if (is_callable('SimpleLogger')) {
117
+ SimpleLogger()->log($level, $message, $context);
118
+ }
119
+ }
120
+ }
includes/class-wp-optimization.php CHANGED
@@ -7,11 +7,9 @@ if (!defined('WPO_VERSION')) die('No direct access allowed');
7
  abstract class WP_Optimization {
8
 
9
  // Ideally, these would all be the same. But, historically, some are not; hence, three separate IDs.
10
- // TODO: Make them all the same (will involve some options re-writing)
11
  public $id;
12
 
13
  protected $setting_id;
14
- // TODO: I suspect that dom_id can be changed + then removed fairly easily. Even if it is used for saving options (haven't checked), that can be re-written at save time.
15
  protected $dom_id;
16
  protected $auto_id;
17
 
@@ -24,6 +22,8 @@ abstract class WP_Optimization {
24
 
25
  protected $optimizer;
26
  protected $options;
 
 
27
 
28
  public $retention_enabled;
29
  public $retention_period;
@@ -49,20 +49,33 @@ abstract class WP_Optimization {
49
 
50
  abstract public function settings_label();
51
 
52
- public function __construct() {
53
  $class_name = get_class($this);
54
  // Remove the prefixed WP_Optimization_
55
  $this->id = substr($class_name, 16);
 
56
  $this->optimizer = WP_Optimize()->get_optimizer();
57
  $this->options = WP_Optimize()->get_options();
 
58
  global $wpdb;
59
  $this->wpdb = $wpdb;
60
  }
61
 
 
 
 
 
 
 
62
  public function do_optimization() {
63
  return $this->optimizer->do_optimization($this);
64
  }
65
 
 
 
 
 
 
66
  public function get_optimization_info() {
67
  return $this->optimizer->get_optimization_info($this);
68
  }
7
  abstract class WP_Optimization {
8
 
9
  // Ideally, these would all be the same. But, historically, some are not; hence, three separate IDs.
 
10
  public $id;
11
 
12
  protected $setting_id;
 
13
  protected $dom_id;
14
  protected $auto_id;
15
 
22
 
23
  protected $optimizer;
24
  protected $options;
25
+ protected $logger;
26
+ protected $data;
27
 
28
  public $retention_enabled;
29
  public $retention_period;
49
 
50
  abstract public function settings_label();
51
 
52
+ public function __construct($data) {
53
  $class_name = get_class($this);
54
  // Remove the prefixed WP_Optimization_
55
  $this->id = substr($class_name, 16);
56
+ $this->data = $data;
57
  $this->optimizer = WP_Optimize()->get_optimizer();
58
  $this->options = WP_Optimize()->get_options();
59
+ $this->logger = WP_Optimize()->get_logger();
60
  global $wpdb;
61
  $this->wpdb = $wpdb;
62
  }
63
 
64
+ /**
65
+ * This triggers the do_optimization function
66
+ * within class-wp-optimizer.php to kick off the optimizations.
67
+ * It also passed the data array from the wpadmin.js.
68
+ * @return [array] array of results that includes sql_commands, output and meta
69
+ */
70
  public function do_optimization() {
71
  return $this->optimizer->do_optimization($this);
72
  }
73
 
74
+ /**
75
+ * This gathers the optimization information to be displayed
76
+ * before triggering any optimizations
77
+ * @return [array] Returns an array of optimization information
78
+ */
79
  public function get_optimization_info() {
80
  return $this->optimizer->get_optimization_info($this);
81
  }
includes/class-wp-optimize-options.php CHANGED
@@ -51,6 +51,25 @@ class WP_Optimize_Options {
51
  public function get_main_settings() {
52
  return $this->get_option('settings');
53
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
54
 
55
  public function save_settings($settings) {
56
 
@@ -92,12 +111,27 @@ class WP_Optimize_Options {
92
  $this->update_option('retention-enabled', 'false');
93
  }
94
 
 
 
 
 
 
 
95
  if (!empty($settings['enable-admin-bar'])) {
96
  $this->update_option('enable-admin-menu', 'true');
97
  } else {
98
  $this->update_option('enable-admin-menu', 'false');
99
  }
 
 
 
100
 
 
 
 
 
 
 
101
  if (!empty($settings["enable-email"])) {
102
  // $this->update_option('enable-email', 'true');
103
  } else {
@@ -134,6 +168,14 @@ class WP_Optimize_Options {
134
 
135
  }
136
 
 
 
 
 
 
 
 
 
137
  $output['messages'][] = __('Settings updated.', 'wp-optimize');
138
 
139
  return $output;
51
  public function get_main_settings() {
52
  return $this->get_option('settings');
53
  }
54
+
55
+ /**
56
+ * This saves the tick box options for enabling auto backup
57
+ * @param Array $settings array of information with the state of the tick box selected
58
+ * @return Array Message array for being completed
59
+ */
60
+ public function save_auto_backup_option($settings) {
61
+ if (isset($settings['auto_backup']) && $settings['auto_backup'] == 'true') {
62
+ $this->update_option('enable-auto-backup', 'true');
63
+ } else {
64
+ $this->update_option('enable-auto-backup', 'false');
65
+ }
66
+
67
+ $output = array('messages' => array());
68
+
69
+ $output['messages'][] = __('Auto backup option updated.', 'wp-optimize');
70
+
71
+ return $output;
72
+ }
73
 
74
  public function save_settings($settings) {
75
 
111
  $this->update_option('retention-enabled', 'false');
112
  }
113
 
114
+ //Get saved admin menu value before check
115
+ $saved_admin_bar = $this->get_option('enable-admin-menu', 'false');
116
+
117
+ //set refresh of default false so it doesnt refresh after save
118
+ $output['refresh'] = false;
119
+
120
  if (!empty($settings['enable-admin-bar'])) {
121
  $this->update_option('enable-admin-menu', 'true');
122
  } else {
123
  $this->update_option('enable-admin-menu', 'false');
124
  }
125
+
126
+ // make sure inbound input is a string
127
+ $updated_admin_bar = $settings['enable-admin-bar'] ? 'true' : 'false';
128
 
129
+ //check if the value is refreshed
130
+ if ($saved_admin_bar != $updated_admin_bar) {
131
+ //set refresh to true as the values have changed
132
+ $output['refresh'] = true;
133
+ }
134
+
135
  if (!empty($settings["enable-email"])) {
136
  // $this->update_option('enable-email', 'true');
137
  } else {
168
 
169
  }
170
 
171
+ /** Save logging options */
172
+
173
+ $new_logging_options = isset($settings['wp-optimize-logging']) ? $settings['wp-optimize-logging'] : array();
174
+
175
+ if (!is_array($new_logging_options)) $new_logging_options = array();
176
+
177
+ $this->update_option('logging', $new_logging_options);
178
+
179
  $output['messages'][] = __('Settings updated.', 'wp-optimize');
180
 
181
  return $output;
includes/class-wp-optimizer.php CHANGED
@@ -71,7 +71,12 @@ class WP_Optimizer {
71
 
72
  }
73
 
74
- // This method returns an array of available optimisations. Each array key is an optimization ID, and the value is an object, as returned by get_optimization()
 
 
 
 
 
75
  public function get_optimizations() {
76
 
77
  $optimizations = $this->get_optimizations_list();
@@ -86,10 +91,14 @@ class WP_Optimizer {
86
 
87
  }
88
 
89
- // This method returns an object for a specific optimization
90
- // This will return a WP_Error if the requested optimization is not found
91
- public function get_optimization($which_optimization) {
92
-
 
 
 
 
93
  $optimization_class = apply_filters('wp_optimize_optimization_class', 'WP_Optimization_'.$which_optimization);
94
 
95
  if (!class_exists('WP_Optimization')) require_once(WPO_PLUGIN_MAIN_PATH.'/includes/class-wp-optimization.php');
@@ -108,17 +117,19 @@ class WP_Optimizer {
108
  }
109
  }
110
 
111
- $optimization = new $optimization_class($which_optimization);
112
 
113
  return $optimization;
114
 
115
  }
116
 
117
- // The method to call to perform an optimization.
118
- // $which_optimization can be either a (string)id, or a WP_Optimization object
119
- // Returns a result object
 
 
120
  public function do_optimization($which_optimization) {
121
-
122
  $optimization = (is_object($which_optimization) && is_a($which_optimization, 'WP_Optimization')) ? $which_optimization : $this->get_optimization($which_optimization);
123
 
124
  if (is_wp_error($optimization)) return $optimization;
@@ -138,8 +149,12 @@ class WP_Optimizer {
138
  return $results;
139
  }
140
 
141
- // The method to call to get information about an optimization. As with do_optimization, it is somewhat modelled after the template interface
142
- // $which_optimization can either be an ID (string), or a class (from get_optimization())
 
 
 
 
143
  public function get_optimization_info($which_optimization) {
144
 
145
  $optimization = (is_object($which_optimization) && is_a($which_optimization, 'WP_Optimization')) ? $which_optimization : $this->get_optimization($which_optimization);
@@ -153,7 +168,6 @@ class WP_Optimizer {
153
  return $optimization->get_results();
154
  }
155
 
156
-
157
  // $optimization_options: whether to do an optimization depends on what keys are set (legacy - can be changed hopefully)
158
  // Returns an array of result objects
159
  public function do_optimizations($optimization_options, $which_option = 'dom') {
@@ -176,8 +190,7 @@ class WP_Optimizer {
176
 
177
  // Try to reduce the chances of PHP self-terminating via reaching max_execution_time
178
  @set_time_limit($time_limit);
179
-
180
- $results[$optimization_id] = $this->do_optimization($optimization_id);
181
 
182
  }
183
 
@@ -231,6 +244,36 @@ class WP_Optimizer {
231
 
232
  return apply_filters('wp_optimize_get_tables', $table_status);
233
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
234
 
235
  /*
236
  * function enable_linkbacks()
@@ -286,7 +329,6 @@ class WP_Optimizer {
286
 
287
  $tablesstatus = $this->get_tables();
288
 
289
- $wp_optimize->log('Checking DB size .... ');
290
  foreach ($tablesstatus as $tablestatus) {
291
  $row_usage += $tablestatus->Rows;
292
  $data_usage += $tablestatus->Data_length;
71
 
72
  }
73
 
74
+ /**
75
+ * This method returns an array of available optimisations.
76
+ * Each array key is an optimization ID, and the value is an object,
77
+ * as returned by get_optimization()
78
+ * @return [array] array of optimizations
79
+ */
80
  public function get_optimizations() {
81
 
82
  $optimizations = $this->get_optimizations_list();
91
 
92
  }
93
 
94
+ /**
95
+ * This method returns an object for a specific optimization.
96
+ * @param string $which_optimization an optimization ID
97
+ * @param array $data an array of anny options $data
98
+ * @return array|WP_Error Will return the optimization, or a WP_Error object if it was not found
99
+ */
100
+ public function get_optimization($which_optimization, $data = array()) {
101
+
102
  $optimization_class = apply_filters('wp_optimize_optimization_class', 'WP_Optimization_'.$which_optimization);
103
 
104
  if (!class_exists('WP_Optimization')) require_once(WPO_PLUGIN_MAIN_PATH.'/includes/class-wp-optimization.php');
117
  }
118
  }
119
 
120
+ $optimization = new $optimization_class($data);
121
 
122
  return $optimization;
123
 
124
  }
125
 
126
+ /**
127
+ * The method to call to perform an optimization.
128
+ * @param string|object $which_optimization an optimization ID, or a WP_Optimization object
129
+ * @return [array] array of results from the optimization
130
+ */
131
  public function do_optimization($which_optimization) {
132
+
133
  $optimization = (is_object($which_optimization) && is_a($which_optimization, 'WP_Optimization')) ? $which_optimization : $this->get_optimization($which_optimization);
134
 
135
  if (is_wp_error($optimization)) return $optimization;
149
  return $results;
150
  }
151
 
152
+ /**
153
+ * The method to call to get information about an optimization.
154
+ * As with do_optimization, it is somewhat modelled after the template interface
155
+ * @param string|object $which_optimization an optimization ID, or a WP_Optimization object
156
+ * @return array returns the optimization information
157
+ */
158
  public function get_optimization_info($which_optimization) {
159
 
160
  $optimization = (is_object($which_optimization) && is_a($which_optimization, 'WP_Optimization')) ? $which_optimization : $this->get_optimization($which_optimization);
168
  return $optimization->get_results();
169
  }
170
 
 
171
  // $optimization_options: whether to do an optimization depends on what keys are set (legacy - can be changed hopefully)
172
  // Returns an array of result objects
173
  public function do_optimizations($optimization_options, $which_option = 'dom') {
190
 
191
  // Try to reduce the chances of PHP self-terminating via reaching max_execution_time
192
  @set_time_limit($time_limit);
193
+ $results[$optimization_id] = $this->do_optimization($optimization);
 
194
 
195
  }
196
 
244
 
245
  return apply_filters('wp_optimize_get_tables', $table_status);
246
  }
247
+
248
+ /**
249
+ * This function grabs a list of tables
250
+ * and information regarding each table and returns
251
+ * the results to optimizations-table.php and optimizationstable.php
252
+ * @return [array] an array of data such as table list, innodb info and data free
253
+ */
254
+ public function get_table_information() {
255
+ //get table information
256
+ $tablesstatus = $this->get_tables();
257
+
258
+ //set defaults
259
+ $table_information = array();
260
+ $table_information['total_gain'] = 0;
261
+ $table_information['inno_db_tables'] = 0;
262
+ $table_information['non_inno_db_tables'] = 0;
263
+ $table_information['table_list'] = '';
264
+
265
+ //make a list of tables to optimize
266
+ foreach($tablesstatus as $each_table) {
267
+ if ($each_table->Engine != 'InnoDB') {
268
+ $table_information['total_gain'] += $each_table->Data_free;
269
+ $table_information['table_list'] .= $each_table->Name.'|';
270
+ $table_information['non_inno_db_tables']++;
271
+ } else {
272
+ $table_information['inno_db_tables']++;
273
+ }
274
+ }
275
+ return $table_information;
276
+ }
277
 
278
  /*
279
  * function enable_linkbacks()
329
 
330
  $tablesstatus = $this->get_tables();
331
 
 
332
  foreach ($tablesstatus as $tablestatus) {
333
  $row_usage += $tablestatus->Rows;
334
  $data_usage += $tablestatus->Data_length;
includes/updraft-notices.php CHANGED
@@ -137,6 +137,10 @@ abstract class Updraft_Notices_1_0 {
137
  return false;
138
  }
139
 
 
 
 
 
140
  abstract protected function check_notice_dismissed($dismiss_time);
141
 
142
  }
137
  return false;
138
  }
139
 
140
+ public function get_affiliate_id() {
141
+ return $this->self_affiliate_id;
142
+ }
143
+
144
  abstract protected function check_notice_dismissed($dismiss_time);
145
 
146
  }
includes/wp-optimize-notices.php CHANGED
@@ -10,6 +10,8 @@ class WP_Optimize_Notices extends Updraft_Notices_1_0 {
10
 
11
  private $initialized = false;
12
 
 
 
13
  protected $notices_content = array();
14
 
15
  public static function instance() {
10
 
11
  private $initialized = false;
12
 
13
+ protected $self_affiliate_id = 216;
14
+
15
  protected $notices_content = array();
16
 
17
  public static function instance() {
js/wpadmin.js CHANGED
@@ -1,5 +1,64 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  jQuery(document).ready(function($) {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2
 
 
3
  var debug_level = 0;
4
  var queue = new Updraft_Queue();
5
 
@@ -21,45 +80,6 @@ jQuery(document).ready(function($) {
21
 
22
  $('#enable-schedule').change(function() { enable_or_disable_schedule_options(); });
23
 
24
- /**
25
- * Send an action over AJAX
26
- *
27
- * @param {string} action - the action to send
28
- * @param * data - data to send
29
- * @param Callback [callback] - will be called with the results
30
- * @param {boolean} [json_parse=true] - JSON parse the results
31
- */
32
- function send_command(action, data, callback, json_parse) {
33
-
34
- json_parse = ('undefined' === typeof json_parse) ? true : json_parse;
35
-
36
- var ajax_data = {
37
- action: 'wp_optimize_ajax',
38
- subaction: action,
39
- nonce: wp_optimize_ajax_nonce,
40
- data: data
41
- };
42
-
43
- jQuery.post(ajaxurl, ajax_data, function(response) {
44
-
45
- if (json_parse) {
46
- try {
47
- var resp = JSON.parse(response);
48
- } catch (e) {
49
- console.log(e);
50
- console.log(response);
51
- // TODO: Tell the user that it didn't work out
52
- return;
53
- }
54
- if ('undefined' !== typeof callback) callback(resp);
55
- } else {
56
- if ('undefined' !== typeof callback) callback(response);
57
- }
58
-
59
- });
60
-
61
- }
62
-
63
  /**
64
  * Temporarily show a dashboard notice, and then remove it. The HTML will be prepended to the .wrap.wp-optimize-wrap element.
65
  *
@@ -179,6 +199,14 @@ jQuery(document).ready(function($) {
179
  }
180
 
181
  var id = queue.peek();
 
 
 
 
 
 
 
 
182
 
183
  if ('undefined' === typeof id) {
184
  if (debug_level > 0) console.log("WP-Optimize: process_queue(): queue is apparently empty - exiting");
@@ -190,12 +218,12 @@ jQuery(document).ready(function($) {
190
 
191
  queue.dequeue();
192
 
193
- send_command('do_optimization', { optimization_id: id }, function(response) {
194
- console.log(response);
195
  $('#optimization_spinner_'+id).hide();
196
  $('#optimization_checkbox_'+id).show();
197
  $('.optimization_button_'+id).prop('disabled', false);
198
-
199
  if (response) {
200
  var total_output = '';
201
  for (var i = 0, len = response.errors.length; i < len; i++) {
@@ -217,10 +245,22 @@ jQuery(document).ready(function($) {
217
  if (response.hasOwnProperty('total_size')) {
218
  $('#optimize_current_db_size').html(response.total_size);
219
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
220
  }
221
-
222
  setTimeout(function() { queue.unlock(); process_queue(); }, 10);
223
-
224
  });
225
  }
226
 
@@ -240,10 +280,38 @@ jQuery(document).ready(function($) {
240
 
241
  $('#optimization_info_'+id).html('...');
242
 
243
- queue.enqueue(id);
244
-
245
- process_queue();
 
 
 
 
 
 
 
 
 
 
246
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
247
  }
248
 
249
  $('#wp-optimize-nav-tab-contents-optimize').on('click', 'button.wp-optimize-settings-optimization-run-button', function() {
@@ -256,11 +324,40 @@ jQuery(document).ready(function($) {
256
  });
257
 
258
  $('#wp-optimize-nav-tab-contents-optimize').on('click', '#wp-optimize', function(e) {
259
-
260
  e.preventDefault();
 
 
261
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
262
  $optimizations = $('#optimizations_list .optimization_checkbox:checked');
263
-
264
  $optimizations.sort(function(a, b) {
265
  // convert to IDs
266
  a = $(a).closest('.wp-optimize-settings').data('optimization_run_sort_order');
@@ -273,7 +370,7 @@ jQuery(document).ready(function($) {
273
  return 0;
274
  }
275
  });
276
-
277
  var optimization_options = {};
278
 
279
  $optimizations.each(function(index) {
@@ -288,8 +385,7 @@ jQuery(document).ready(function($) {
288
  });
289
 
290
  send_command('save_manual_run_optimization_options', optimization_options);
291
-
292
- });
293
 
294
  $('#wp_optimize_table_list_refresh').click(function() {
295
 
@@ -332,6 +428,11 @@ jQuery(document).ready(function($) {
332
  if (resp && resp.hasOwnProperty('optimizations_table')) {
333
  $('#optimizations_list').replaceWith(resp.optimizations_table);
334
  }
 
 
 
 
 
335
  });
336
 
337
  });
@@ -343,4 +444,4 @@ jQuery(document).ready(function($) {
343
  $('#wp_optimize_status_box').css('opacity', '1').find('.inside').html(resp);
344
  });
345
  });
346
- });
1
+ /**
2
+ * Send an action via admin-ajax.php
3
+ *
4
+ * @param {string} action - the action to send
5
+ * @param * data - data to send
6
+ * @param Callback [callback] - will be called with the results
7
+ * @param {boolean} [json_parse=true] - JSON parse the results
8
+ */
9
+ var wp_optimize_send_command_admin_ajax = function(action, data, callback, json_parse) {
10
+
11
+ json_parse = ('undefined' === typeof json_parse) ? true : json_parse;
12
+
13
+ var ajax_data = {
14
+ action: 'wp_optimize_ajax',
15
+ subaction: action,
16
+ nonce: wp_optimize_ajax_nonce,
17
+ data: data
18
+ };
19
+
20
+ jQuery.post(ajaxurl, ajax_data, function(response) {
21
+
22
+ if (json_parse) {
23
+ try {
24
+ var resp = JSON.parse(response);
25
+ } catch (e) {
26
+ console.log(e);
27
+ console.log(response);
28
+ alert(wpoptimize.error_unexpected_response);
29
+ return;
30
+ }
31
+ if ('undefined' !== typeof callback) callback(resp);
32
+ } else {
33
+ if ('undefined' !== typeof callback) callback(response);
34
+ }
35
+
36
+ });
37
+
38
+ }
39
+
40
  jQuery(document).ready(function($) {
41
+ WP_Optimize = WP_Optimize(wp_optimize_send_command_admin_ajax);
42
+ });
43
+
44
+ /**
45
+ * Function for sending communications
46
+ *
47
+ * @callable sendcommandCallable
48
+ * @param {string} action - the action to send
49
+ * @param * data - data to send
50
+ * @param Callback [callback] - will be called with the results
51
+ * @param {boolean} [json_parse=true] - JSON parse the results
52
+ */
53
+
54
+ /**
55
+ * Main WP_Optimize
56
+ *
57
+ * @param {sendcommandCallable} send_command - function for sending remote communications via
58
+ */
59
+ var WP_Optimize = function(send_command) {
60
 
61
+ var $ = jQuery;
62
  var debug_level = 0;
63
  var queue = new Updraft_Queue();
64
 
80
 
81
  $('#enable-schedule').change(function() { enable_or_disable_schedule_options(); });
82
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
83
  /**
84
  * Temporarily show a dashboard notice, and then remove it. The HTML will be prepended to the .wrap.wp-optimize-wrap element.
85
  *
199
  }
200
 
201
  var id = queue.peek();
202
+
203
+ //check to see if an object has been returned
204
+ if (typeof id == 'object') {
205
+ data = id;
206
+ id = id.optimization_id;
207
+ } else {
208
+ data = {};
209
+ }
210
 
211
  if ('undefined' === typeof id) {
212
  if (debug_level > 0) console.log("WP-Optimize: process_queue(): queue is apparently empty - exiting");
218
 
219
  queue.dequeue();
220
 
221
+ send_command('do_optimization', { optimization_id: id, data: data }, function(response) {
222
+
223
  $('#optimization_spinner_'+id).hide();
224
  $('#optimization_checkbox_'+id).show();
225
  $('.optimization_button_'+id).prop('disabled', false);
226
+
227
  if (response) {
228
  var total_output = '';
229
  for (var i = 0, len = response.errors.length; i < len; i++) {
245
  if (response.hasOwnProperty('total_size')) {
246
  $('#optimize_current_db_size').html(response.total_size);
247
  }
248
+
249
+ //Status check if optimizing tables
250
+ if (id == 'optimizetables' && data.optimization_table) {
251
+ if(queue.is_empty()){
252
+ $('#optimization_spinner_'+id).hide();
253
+ $('#optimization_checkbox_'+id).show();
254
+ $('.optimization_button_'+id).prop('disabled', false);
255
+ $('#optimization_info_'+id).html(wpoptimize.optimization_complete);
256
+ } else {
257
+ $('#optimization_checkbox_'+id).hide();
258
+ $('#optimization_spinner_'+id).show();
259
+ $('.optimization_button_'+id).prop('disabled', true);
260
+ }
261
+ }
262
  }
 
263
  setTimeout(function() { queue.unlock(); process_queue(); }, 10);
 
264
  });
265
  }
266
 
280
 
281
  $('#optimization_info_'+id).html('...');
282
 
283
+ //check if it is DB optimize
284
+ if ('optimizetables' == id) {
285
+ var optimization_tables = $('#wpoptimize_table_list #the-list tr');
286
+
287
+ //check if there are any tables to be optimized
288
+ $(optimization_tables).each(function(index) {
289
+ //get information from each td
290
+ var $table_information = $(this).find('td');
291
+
292
+ //get table type information
293
+ table_type = $table_information.eq(5).text();
294
+ table = $table_information.eq(1).text();
295
+ optimizable = $table_information.eq(5).data('optimizable');
296
 
297
+ //make sure the table isnt blank
298
+ if ('' != table){
299
+ //check if table is InnboDB as we do not want to optimize it
300
+ if ('1' == optimizable){
301
+ var data = {
302
+ optimization_id: id,
303
+ optimization_table: $table_information.eq(1).text(),
304
+ optimization_table_type: table_type,
305
+ };
306
+ queue.enqueue(data);
307
+ }
308
+ }
309
+ });
310
+ } else {
311
+ //for all other options
312
+ queue.enqueue(id);
313
+ }
314
+ process_queue();
315
  }
316
 
317
  $('#wp-optimize-nav-tab-contents-optimize').on('click', 'button.wp-optimize-settings-optimization-run-button', function() {
324
  });
325
 
326
  $('#wp-optimize-nav-tab-contents-optimize').on('click', '#wp-optimize', function(e) {
 
327
  e.preventDefault();
328
+
329
+ var auto_backup = false;
330
 
331
+ if ($('#enable-auto-backup').is(":checked")) {
332
+ auto_backup = true;
333
+ }
334
+
335
+ //save the click option
336
+ send_command('save_auto_backup_option', {'auto_backup': auto_backup});
337
+
338
+ //only run the backup if tick box is checked
339
+ if (auto_backup == true && typeof updraft_backupnow_inpage_go === 'function') {
340
+ updraft_backupnow_inpage_go(function () {
341
+ //close the backup dialogue
342
+ $('#updraft-backupnow-inpage-modal').dialog('close');
343
+
344
+ //run optimizations
345
+ run_optimization();
346
+ }, '', 'autobackup', null, 1, 0, 0);
347
+ } else {
348
+ //run optimizations
349
+ run_optimization();
350
+ }
351
+ });
352
+
353
+ /**
354
+ * Running the optimizations for the selected options
355
+ * @return {[type]} optimizations
356
+ */
357
+ function run_optimization() {
358
+
359
  $optimizations = $('#optimizations_list .optimization_checkbox:checked');
360
+
361
  $optimizations.sort(function(a, b) {
362
  // convert to IDs
363
  a = $(a).closest('.wp-optimize-settings').data('optimization_run_sort_order');
370
  return 0;
371
  }
372
  });
373
+
374
  var optimization_options = {};
375
 
376
  $optimizations.each(function(index) {
385
  });
386
 
387
  send_command('save_manual_run_optimization_options', optimization_options);
388
+ }
 
389
 
390
  $('#wp_optimize_table_list_refresh').click(function() {
391
 
428
  if (resp && resp.hasOwnProperty('optimizations_table')) {
429
  $('#optimizations_list').replaceWith(resp.optimizations_table);
430
  }
431
+
432
+ //need to refresh the page if enable-admin-menu tick state has changed
433
+ if (resp.save_results.refresh) {
434
+ location.reload();
435
+ }
436
  });
437
 
438
  });
444
  $('#wp_optimize_status_box').css('opacity', '1').find('.inside').html(resp);
445
  });
446
  });
447
+ };
js/wpadmin.min.js CHANGED
@@ -1 +1 @@
1
- jQuery(document).ready(function(t){function e(){var e=t("#enable-schedule").is(":checked");e?t("#wp-optimize-auto-options").css("opacity","1"):t("#wp-optimize-auto-options").css("opacity","0.5")}function i(t,e,i,o){o="undefined"==typeof o||o;var n={action:"wp_optimize_ajax",subaction:t,nonce:wp_optimize_ajax_nonce,data:e};jQuery.post(ajaxurl,n,function(t){if(o){try{var e=JSON.parse(t)}catch(n){return console.log(n),void console.log(t)}"undefined"!=typeof i&&i(e)}else"undefined"!=typeof i&&i(t)})}function o(e,i,o){i="undefined"==typeof i?"#wp-optimize-wrap":i,o="undefined"==typeof o?15:o,t(e).hide().prependTo(i).slideDown("slow").delay(1e3*o).slideUp("slow",function(){t(this).remove()})}function n(e,n){var s={type:e,enable:n?1:0};t("#"+e+"_spinner").show(),i("enable_or_disable_feature",s,function(i){if(t("#"+e+"_spinner").hide(),i&&i.hasOwnProperty("output"))for(var n=0,s=i.output.length;n<s;n++){var a='<div class="updated">'+i.output[n]+"</div>";o(a,"#actions-results-area")}})}function s(){var e=t("#wp-optimize-nav-tab-contents-settings form input[name!='action'], #wp-optimize-nav-tab-contents-settings form textarea, #wp-optimize-nav-tab-contents-settings form select").serialize();return t.each(t("#wp-optimize-nav-tab-contents-settings form input[type=checkbox]").filter(function(e){return 0==t(this).prop("checked")}),function(i,o){var n="0";e+="&"+t(o).attr("name")+"="+n}),e}function a(){if(!c.get_lock())return void(r>0&&console.log("WP-Optimize: process_queue(): queue is currently locked - exiting"));r>0&&console.log("WP-Optimize: process_queue(): got queue lock");var e=c.peek();return"undefined"==typeof e?(r>0&&console.log("WP-Optimize: process_queue(): queue is apparently empty - exiting"),void c.unlock()):(r>0&&console.log("WP-Optimize: process_queue(): processing item: "+e),c.dequeue(),void i("do_optimization",{optimization_id:e},function(i){if(console.log(i),t("#optimization_spinner_"+e).hide(),t("#optimization_checkbox_"+e).show(),t(".optimization_button_"+e).prop("disabled",!1),i){for(var o="",n=0,s=i.errors.length;n<s;n++)o+='<span class="error">'+i.errors[n]+"</span><br>";for(var n=0,s=i.messages.length;n<s;n++)o+=i.errors[n]+"<br>";for(var n=0,s=i.result.output.length;n<s;n++)o+=i.result.output[n]+"<br>";t("#optimization_info_"+e).html(o),i.hasOwnProperty("status_box_contents")&&t("#wp_optimize_status_box").css("opacity","1").find(".inside").html(i.status_box_contents),i.hasOwnProperty("table_list")&&t("#wpoptimize_table_list tbody").replaceWith(i.table_list),i.hasOwnProperty("total_size")&&t("#optimize_current_db_size").html(i.total_size)}setTimeout(function(){c.unlock(),a()},10)}))}function p(e){var i=t("#wp-optimize-nav-tab-contents-optimize .wp-optimize-settings-"+e);i||console.log("do_optimization: row corresponding to this optimization ("+e+") not found"),t("#optimization_checkbox_"+e).hide(),t("#optimization_spinner_"+e).show(),t(".optimization_button_"+e).prop("disabled",!0),t("#optimization_info_"+e).html("..."),c.enqueue(e),a()}var r=0,c=new Updraft_Queue;e(),t("#enable-schedule").change(function(){e()}),t("#wp-optimize-disable-enable-trackbacks-enable").click(function(){n("trackbacks",!0)}),t("#wp-optimize-disable-enable-trackbacks-disable").click(function(){n("trackbacks",!1)}),t("#wp-optimize-disable-enable-comments-enable").click(function(){n("comments",!0)}),t("#wp-optimize-disable-enable-comments-disable").click(function(){n("comments",!1)}),t("#wp-optimize-nav-tab-wrapper .nav-tab").click(function(e){var i=t(this).attr("id");if(i&&"wp-optimize-nav-tab-"==i.substring(0,20)){var i=i.substring(20);e.preventDefault(),t("#wp-optimize-nav-tab-wrapper .nav-tab:not(#wp-optimize-nav-tab-"+i+")").removeClass("nav-tab-active"),t(this).addClass("nav-tab-active"),t("#wp-optimize-wrap .wp-optimize-nav-tab-contents:not(#wp-optimize-nav-tab-contents-"+i+")").hide(),t("#wp-optimize-nav-tab-contents-"+i).show()}}),t("#wp-optimize-nav-tab-contents-optimize").on("click","button.wp-optimize-settings-optimization-run-button",function(){var e=t(this).closest(".wp-optimize-settings").data("optimization_id");return e?void p(e):void console.log("Optimization ID corresponding to pressed button not found")}),t("#wp-optimize-nav-tab-contents-optimize").on("click","#wp-optimize",function(e){e.preventDefault(),$optimizations=t("#optimizations_list .optimization_checkbox:checked"),$optimizations.sort(function(e,i){return e=t(e).closest(".wp-optimize-settings").data("optimization_run_sort_order"),i=t(i).closest(".wp-optimize-settings").data("optimization_run_sort_order"),e>i?1:e<i?-1:0});var o={};$optimizations.each(function(e){var i=t(this).closest(".wp-optimize-settings").data("optimization_id");return i?(o[i]={active:1},void p(i)):void console.log("Optimization ID corresponding to pressed button not found")}),i("save_manual_run_optimization_options",o)}),t("#wp_optimize_table_list_refresh").click(function(){t("#wpoptimize_table_list tbody").css("opacity","0.5"),i("get_table_list",!1,function(e){t("#wpoptimize_table_list tbody").css("opacity","1"),e.hasOwnProperty("table_list")&&t("#wpoptimize_table_list tbody").replaceWith(e.table_list),e.hasOwnProperty("total_size")&&t("#optimize_current_db_size").html(e.total_size)})}),t("#wp-optimize-settings-save").click(function(e){e.preventDefault(),t("#save_spinner").show();var n=s();i("save_settings",n,function(e){if(t("#save_spinner").hide(),t("#save_done").show().delay(5e3).fadeOut(),e&&e.hasOwnProperty("save_results")&&e.save_results&&e.save_results.hasOwnProperty("errors")){for(var i=0,n=e.save_results.errors.length;i<n;i++){var s='<div class="error">'+e.errors[i]+"</div>";o(s,"#wp-optimize-settings-save-results")}console.log(e.save_results.messages)}e&&e.hasOwnProperty("status_box_contents")&&t("#wp_optimize_status_box .inside").html(e.status_box_contents),e&&e.hasOwnProperty("optimizations_table")&&t("#optimizations_list").replaceWith(e.optimizations_table)})}),t("#wp_optimize_status_box").on("click","#wp_optimize_status_box_refresh",function(e){e.preventDefault(),t("#wp_optimize_status_box").css("opacity","0.5"),i("get_status_box_contents",null,function(e){t("#wp_optimize_status_box").css("opacity","1").find(".inside").html(e)})})});
1
+ var wp_optimize_send_command_admin_ajax=function(t,i,e,o){o="undefined"==typeof o||o;var n={action:"wp_optimize_ajax",subaction:t,nonce:wp_optimize_ajax_nonce,data:i};jQuery.post(ajaxurl,n,function(t){if(o){try{var i=JSON.parse(t)}catch(n){return console.log(n),console.log(t),void alert(wpoptimize.error_unexpected_response)}"undefined"!=typeof e&&e(i)}else"undefined"!=typeof e&&e(t)})};jQuery(document).ready(function(t){WP_Optimize=WP_Optimize(wp_optimize_send_command_admin_ajax)});var WP_Optimize=function(t){function i(){var t=r("#enable-schedule").is(":checked");t?r("#wp-optimize-auto-options").css("opacity","1"):r("#wp-optimize-auto-options").css("opacity","0.5")}function e(t,i,e){i="undefined"==typeof i?"#wp-optimize-wrap":i,e="undefined"==typeof e?15:e,r(t).hide().prependTo(i).slideDown("slow").delay(1e3*e).slideUp("slow",function(){r(this).remove()})}function o(i,o){var n={type:i,enable:o?1:0};r("#"+i+"_spinner").show(),t("enable_or_disable_feature",n,function(t){if(r("#"+i+"_spinner").hide(),t&&t.hasOwnProperty("output"))for(var o=0,n=t.output.length;o<n;o++){var a='<div class="updated">'+t.output[o]+"</div>";e(a,"#actions-results-area")}})}function n(){var t=r("#wp-optimize-nav-tab-contents-settings form input[name!='action'], #wp-optimize-nav-tab-contents-settings form textarea, #wp-optimize-nav-tab-contents-settings form select").serialize();return r.each(r("#wp-optimize-nav-tab-contents-settings form input[type=checkbox]").filter(function(t){return 0==r(this).prop("checked")}),function(i,e){var o="0";t+="&"+r(e).attr("name")+"="+o}),t}function a(){if(!_.get_lock())return void(c>0&&console.log("WP-Optimize: process_queue(): queue is currently locked - exiting"));c>0&&console.log("WP-Optimize: process_queue(): got queue lock");var i=_.peek();return"object"==typeof i?(data=i,i=i.optimization_id):data={},"undefined"==typeof i?(c>0&&console.log("WP-Optimize: process_queue(): queue is apparently empty - exiting"),void _.unlock()):(c>0&&console.log("WP-Optimize: process_queue(): processing item: "+i),_.dequeue(),void t("do_optimization",{optimization_id:i,data:data},function(t){if(r("#optimization_spinner_"+i).hide(),r("#optimization_checkbox_"+i).show(),r(".optimization_button_"+i).prop("disabled",!1),t){for(var e="",o=0,n=t.errors.length;o<n;o++)e+='<span class="error">'+t.errors[o]+"</span><br>";for(var o=0,n=t.messages.length;o<n;o++)e+=t.errors[o]+"<br>";for(var o=0,n=t.result.output.length;o<n;o++)e+=t.result.output[o]+"<br>";r("#optimization_info_"+i).html(e),t.hasOwnProperty("status_box_contents")&&r("#wp_optimize_status_box").css("opacity","1").find(".inside").html(t.status_box_contents),t.hasOwnProperty("table_list")&&r("#wpoptimize_table_list tbody").replaceWith(t.table_list),t.hasOwnProperty("total_size")&&r("#optimize_current_db_size").html(t.total_size),"optimizetables"==i&&data.optimization_table&&(_.is_empty()?(r("#optimization_spinner_"+i).hide(),r("#optimization_checkbox_"+i).show(),r(".optimization_button_"+i).prop("disabled",!1),r("#optimization_info_"+i).html(wpoptimize.optimization_complete)):(r("#optimization_checkbox_"+i).hide(),r("#optimization_spinner_"+i).show(),r(".optimization_button_"+i).prop("disabled",!0)))}setTimeout(function(){_.unlock(),a()},10)}))}function s(t){var i=r("#wp-optimize-nav-tab-contents-optimize .wp-optimize-settings-"+t);if(i||console.log("do_optimization: row corresponding to this optimization ("+t+") not found"),r("#optimization_checkbox_"+t).hide(),r("#optimization_spinner_"+t).show(),r(".optimization_button_"+t).prop("disabled",!0),r("#optimization_info_"+t).html("..."),"optimizetables"==t){var e=r("#wpoptimize_table_list #the-list tr");r(e).each(function(i){var e=r(this).find("td");if(table_type=e.eq(5).text(),table=e.eq(1).text(),optimizable=e.eq(5).data("optimizable"),""!=table&&"1"==optimizable){var o={optimization_id:t,optimization_table:e.eq(1).text(),optimization_table_type:table_type};_.enqueue(o)}})}else _.enqueue(t);a()}function p(){$optimizations=r("#optimizations_list .optimization_checkbox:checked"),$optimizations.sort(function(t,i){return t=r(t).closest(".wp-optimize-settings").data("optimization_run_sort_order"),i=r(i).closest(".wp-optimize-settings").data("optimization_run_sort_order"),t>i?1:t<i?-1:0});var i={};$optimizations.each(function(t){var e=r(this).closest(".wp-optimize-settings").data("optimization_id");return e?(i[e]={active:1},void s(e)):void console.log("Optimization ID corresponding to pressed button not found")}),t("save_manual_run_optimization_options",i)}var r=jQuery,c=0,_=new Updraft_Queue;i(),r("#enable-schedule").change(function(){i()}),r("#wp-optimize-disable-enable-trackbacks-enable").click(function(){o("trackbacks",!0)}),r("#wp-optimize-disable-enable-trackbacks-disable").click(function(){o("trackbacks",!1)}),r("#wp-optimize-disable-enable-comments-enable").click(function(){o("comments",!0)}),r("#wp-optimize-disable-enable-comments-disable").click(function(){o("comments",!1)}),r("#wp-optimize-nav-tab-wrapper .nav-tab").click(function(t){var i=r(this).attr("id");if(i&&"wp-optimize-nav-tab-"==i.substring(0,20)){var i=i.substring(20);t.preventDefault(),r("#wp-optimize-nav-tab-wrapper .nav-tab:not(#wp-optimize-nav-tab-"+i+")").removeClass("nav-tab-active"),r(this).addClass("nav-tab-active"),r("#wp-optimize-wrap .wp-optimize-nav-tab-contents:not(#wp-optimize-nav-tab-contents-"+i+")").hide(),r("#wp-optimize-nav-tab-contents-"+i).show()}}),r("#wp-optimize-nav-tab-contents-optimize").on("click","button.wp-optimize-settings-optimization-run-button",function(){var t=r(this).closest(".wp-optimize-settings").data("optimization_id");return t?void s(t):void console.log("Optimization ID corresponding to pressed button not found")}),r("#wp-optimize-nav-tab-contents-optimize").on("click","#wp-optimize",function(i){i.preventDefault();var e=!1;r("#enable-auto-backup").is(":checked")&&(e=!0),t("save_auto_backup_option",{auto_backup:e}),1==e&&"function"==typeof updraft_backupnow_inpage_go?updraft_backupnow_inpage_go(function(){r("#updraft-backupnow-inpage-modal").dialog("close"),p()},"","autobackup",null,1,0,0):p()}),r("#wp_optimize_table_list_refresh").click(function(){r("#wpoptimize_table_list tbody").css("opacity","0.5"),t("get_table_list",!1,function(t){r("#wpoptimize_table_list tbody").css("opacity","1"),t.hasOwnProperty("table_list")&&r("#wpoptimize_table_list tbody").replaceWith(t.table_list),t.hasOwnProperty("total_size")&&r("#optimize_current_db_size").html(t.total_size)})}),r("#wp-optimize-settings-save").click(function(i){i.preventDefault(),r("#save_spinner").show();var o=n();t("save_settings",o,function(t){if(r("#save_spinner").hide(),r("#save_done").show().delay(5e3).fadeOut(),t&&t.hasOwnProperty("save_results")&&t.save_results&&t.save_results.hasOwnProperty("errors")){for(var i=0,o=t.save_results.errors.length;i<o;i++){var n='<div class="error">'+t.errors[i]+"</div>";e(n,"#wp-optimize-settings-save-results")}console.log(t.save_results.messages)}t&&t.hasOwnProperty("status_box_contents")&&r("#wp_optimize_status_box .inside").html(t.status_box_contents),t&&t.hasOwnProperty("optimizations_table")&&r("#optimizations_list").replaceWith(t.optimizations_table),t.save_results.refresh&&location.reload()})}),r("#wp_optimize_status_box").on("click","#wp_optimize_status_box_refresh",function(i){i.preventDefault(),r("#wp_optimize_status_box").css("opacity","0.5"),t("get_status_box_contents",null,function(t){r("#wp_optimize_status_box").css("opacity","1").find(".inside").html(t)})})};
languages/wp-optimize.pot CHANGED
@@ -1,4 +1,4 @@
1
- # Copyright (C) 2016 wp-optimize
2
  # This file is distributed under the same license as the wp-optimize package.
3
  msgid ""
4
  msgstr ""
@@ -7,9 +7,9 @@ msgstr ""
7
  "MIME-Version: 1.0\n"
8
  "Content-Type: text/plain; charset=UTF-8\n"
9
  "Content-Transfer-Encoding: 8bit\n"
10
- "PO-Revision-Date: 2016-MO-DA HO:MI+ZONE\n"
11
  "Last-Translator: John Doe <mail@example.com>\n"
12
- "Language-Team: Team Team <mail@example.com>\n"
13
  "X-Poedit-Basepath: ..\n"
14
  "X-Poedit-SourceCharset: UTF-8\n"
15
  "X-Poedit-KeywordsList: __;_e;_n:1,2;_x:1,2c;_ex:1,2c;_nx:4c,1,2;esc_attr__;esc_attr_e;esc_attr_x:1,2c;esc_html__;esc_html_e;esc_html_x:1,2c;_n_noop:1,2;_nx_noop:3c,1,2;__ngettext_noop:1,2\n"
@@ -17,55 +17,67 @@ msgstr ""
17
  "X-Poedit-SearchPathExcluded-0: *.js\n"
18
  "Plural-Forms: nplurals=2; plural=(n != 1);\n"
19
 
20
- #: src/includes/class-commands.php:72
21
  msgid "No optimization was indicated."
22
  msgstr ""
23
 
24
- #: src/includes/class-wp-optimize-options.php:137
 
 
 
 
 
 
 
 
 
 
 
 
25
  msgid "Settings updated."
26
  msgstr ""
27
 
28
- #: src/includes/class-wp-optimizer.php:101, src/includes/class-wp-optimizer.php:107
29
  msgid "No such optimization"
30
  msgstr ""
31
 
32
- #: src/includes/class-wp-optimizer.php:341
33
  msgid "Comments have now been disabled on all current and previously published posts."
34
  msgstr ""
35
 
36
- #: src/includes/class-wp-optimizer.php:344
37
  msgid "Comments have now been enabled on all current and previously published posts."
38
  msgstr ""
39
 
40
- #: src/includes/class-wp-optimizer.php:351
41
  msgid "Trackbacks have now been disabled on all current and previously published posts."
42
  msgstr ""
43
 
44
- #: src/includes/class-wp-optimizer.php:355
45
  msgid "Trackbacks have now been enabled on all current and previously published posts."
46
  msgstr ""
47
 
48
- #: src/includes/wp-optimize-notices.php:29
49
  msgid "Make sure you backup as well as optimize your database"
50
  msgstr ""
51
 
52
- #: src/includes/wp-optimize-notices.php:30
53
  msgid "UpdraftPlus is the world's most trusted backup plugin from the owners of WP-Optimize"
54
  msgstr ""
55
 
56
- #: src/includes/wp-optimize-notices.php:40
57
  msgid "Introducing UpdraftCentral - from the team behind WP-Optimize"
58
  msgstr ""
59
 
60
- #: src/includes/wp-optimize-notices.php:41
61
  msgid "UpdraftCentral is a highly efficient way to manage, update and backup multiple websites from one place."
62
  msgstr ""
63
 
64
- #: src/includes/wp-optimize-notices.php:51
65
  msgid "Like WP-Optimize and can spare one minute?"
66
  msgstr ""
67
 
68
- #: src/includes/wp-optimize-notices.php:52
69
  msgid "Please help WP-Optimize by giving a positive review at wordpress.org."
70
  msgstr ""
71
 
@@ -75,42 +87,42 @@ msgid_plural "%d auto drafts deleted"
75
  msgstr[0] ""
76
  msgstr[1] ""
77
 
78
- #: src/optimizations/autodraft.php:43
79
  msgid "%d item removed from Trash"
80
  msgid_plural "%d items removed from Trash"
81
  msgstr[0] ""
82
  msgstr[1] ""
83
 
84
- #: src/optimizations/autodraft.php:57
85
  msgid "%d auto draft post in your database"
86
  msgid_plural "%d auto draft posts in your database"
87
  msgstr[0] ""
88
  msgstr[1] ""
89
 
90
- #: src/optimizations/autodraft.php:59
91
  msgid "No auto draft posts found"
92
  msgstr ""
93
 
94
- #: src/optimizations/autodraft.php:73
95
  msgid "%d trashed post in your database"
96
  msgid_plural "%d trashed posts in your database"
97
  msgstr[0] ""
98
  msgstr[1] ""
99
 
100
- #: src/optimizations/autodraft.php:75
101
  msgid "No trashed posts found"
102
  msgstr ""
103
 
104
- #: src/optimizations/autodraft.php:84
105
- msgid "Clean auto draft posts which are older than %d weeks"
106
  msgstr ""
107
 
108
- #: src/optimizations/autodraft.php:86
109
- msgid "Clean all auto draft posts and posts in trash"
110
  msgstr ""
111
 
112
- #: src/optimizations/autodraft.php:92
113
- msgid "Remove auto drafts"
114
  msgstr ""
115
 
116
  #: src/optimizations/commentmeta.php:17
@@ -119,23 +131,23 @@ msgid_plural "%d unused comment metadata items removed"
119
  msgstr[0] ""
120
  msgstr[1] ""
121
 
122
- #: src/optimizations/commentmeta.php:26
123
  msgid "%d unused akismet comment metadata item removed"
124
  msgid_plural "%d unused akismet comment metadata items removed"
125
  msgstr[0] ""
126
  msgstr[1] ""
127
 
128
- #: src/optimizations/commentmeta.php:38
129
  msgid "%d orphaned comment meta data in your database"
130
  msgid_plural "%d orphaned comment meta data in your database"
131
  msgstr[0] ""
132
  msgstr[1] ""
133
 
134
- #: src/optimizations/commentmeta.php:40
135
  msgid "No orphaned comment meta data in your database"
136
  msgstr ""
137
 
138
- #: src/optimizations/commentmeta.php:48, src/optimizations/commentmeta.php:52
139
  msgid "Clean comment meta data"
140
  msgstr ""
141
 
@@ -149,20 +161,23 @@ msgstr[1] ""
149
  msgid "Remove unused tags"
150
  msgstr ""
151
 
152
- #: src/optimizations/optimizetables.php:79
153
- msgctxt "%s is the database name"
154
- msgid "%s database optimized!"
155
  msgstr ""
156
 
157
- #: src/optimizations/optimizetables.php:83
158
  msgid "Total gain:"
159
  msgstr ""
160
 
161
- #: src/optimizations/optimizetables.php:87
162
- msgid "Tables using the InnoDB engine (%d) will not be optimized."
 
 
 
 
163
  msgstr ""
164
 
165
- #: src/optimizations/optimizetables.php:94, src/optimizations/optimizetables.php:98
166
  msgid "Optimize database tables"
167
  msgstr ""
168
 
@@ -172,17 +187,17 @@ msgid_plural "%d orphaned meta data deleted"
172
  msgstr[0] ""
173
  msgstr[1] ""
174
 
175
- #: src/optimizations/orphandata.php:28
176
  msgid "%d orphaned relationship data in your database"
177
  msgid_plural "%d orphaned relationship data in your database"
178
  msgstr[0] ""
179
  msgstr[1] ""
180
 
181
- #: src/optimizations/orphandata.php:30
182
  msgid "No orphaned relationship data in your database"
183
  msgstr ""
184
 
185
- #: src/optimizations/orphandata.php:37
186
  msgid "Clean orphaned relationship data"
187
  msgstr ""
188
 
@@ -192,41 +207,41 @@ msgid_plural "%d pingbacks deleted"
192
  msgstr[0] ""
193
  msgstr[1] ""
194
 
195
- #: src/optimizations/pingbacks.php:25
196
  msgid "%d Pingback found"
197
  msgid_plural "%d Pingbacks found"
198
  msgstr[0] ""
199
  msgstr[1] ""
200
 
201
- #: src/optimizations/pingbacks.php:27
202
  msgid "No pingbacks found"
203
  msgstr ""
204
 
205
- #: src/optimizations/pingbacks.php:34
206
  msgid "Remove pingbacks"
207
  msgstr ""
208
 
209
- #: src/optimizations/postmeta.php:20
210
  msgid "%d orphaned postmeta deleted"
211
  msgid_plural "%d orphaned postmeta deleted"
212
  msgstr[0] ""
213
  msgstr[1] ""
214
 
215
- #: src/optimizations/postmeta.php:32
216
  msgid "%d orphaned post meta data in your database"
217
  msgid_plural "%d orphaned postmeta in your database"
218
  msgstr[0] ""
219
  msgstr[1] ""
220
 
221
- #: src/optimizations/postmeta.php:34
222
  msgid "No orphaned post meta data in your database"
223
  msgstr ""
224
 
225
- #: src/optimizations/postmeta.php:42
226
  msgid "Clean post meta data"
227
  msgstr ""
228
 
229
- #: src/optimizations/postmeta.php:47
230
  msgid "Remove orphaned post meta"
231
  msgstr ""
232
 
@@ -236,25 +251,25 @@ msgid_plural "%d post revisions deleted"
236
  msgstr[0] ""
237
  msgstr[1] ""
238
 
239
- #: src/optimizations/revisions.php:43
240
  msgid "%d post revision in your database"
241
  msgid_plural "%d post revisions in your database"
242
  msgstr[0] ""
243
  msgstr[1] ""
244
 
245
- #: src/optimizations/revisions.php:45
246
  msgid "No post revisions found"
247
  msgstr ""
248
 
249
- #: src/optimizations/revisions.php:54
250
  msgid "Clean post revisions which are older than %d weeks"
251
  msgstr ""
252
 
253
- #: src/optimizations/revisions.php:56
254
  msgid "Clean all post revisions"
255
  msgstr ""
256
 
257
- #: src/optimizations/revisions.php:62
258
  msgid "Remove auto revisions"
259
  msgstr ""
260
 
@@ -264,46 +279,42 @@ msgid_plural "%d spam comments deleted"
264
  msgstr[0] ""
265
  msgstr[1] ""
266
 
267
- #: src/optimizations/spam.php:40
268
  msgid "%d comment removed from Trash"
269
  msgid_plural "%d comments removed from Trash"
270
  msgstr[0] ""
271
  msgstr[1] ""
272
 
273
- #: src/optimizations/spam.php:54
274
  msgid "%d spam comment found"
275
  msgid_plural "%d spam comments found"
276
  msgstr[0] ""
277
  msgstr[1] ""
278
 
279
- #: src/optimizations/spam.php:54, src/optimizations/spam.php:70, src/optimizations/unapproved.php:42
280
  msgid "Review"
281
  msgstr ""
282
 
283
- #: src/optimizations/spam.php:56
284
  msgid "No spam comments found"
285
  msgstr ""
286
 
287
- #: src/optimizations/spam.php:70
288
  msgid "%d trashed comment found"
289
  msgid_plural "%d trashed comments found"
290
  msgstr[0] ""
291
  msgstr[1] ""
292
 
293
- #: src/optimizations/spam.php:72
294
  msgid "No trashed comments found"
295
  msgstr ""
296
 
297
- #: src/optimizations/spam.php:82
298
- msgid "Remove spam comments which are older than %d weeks"
299
  msgstr ""
300
 
301
- #: src/optimizations/spam.php:84
302
- msgid "Remove spam comments and comments in trash"
303
- msgstr ""
304
-
305
- #: src/optimizations/spam.php:89
306
- msgid "Remove spam comments"
307
  msgstr ""
308
 
309
  #: src/optimizations/trackbacks.php:15
@@ -312,17 +323,17 @@ msgid_plural "%d trackbacks deleted"
312
  msgstr[0] ""
313
  msgstr[1] ""
314
 
315
- #: src/optimizations/trackbacks.php:25
316
  msgid "%d Trackback found"
317
  msgid_plural "%d Trackbacks found"
318
  msgstr[0] ""
319
  msgstr[1] ""
320
 
321
- #: src/optimizations/trackbacks.php:27
322
  msgid "No trackbacks found"
323
  msgstr ""
324
 
325
- #: src/optimizations/trackbacks.php:34
326
  msgid "Remove trackbacks"
327
  msgstr ""
328
 
@@ -338,17 +349,17 @@ msgid_plural "%d site-widetransient options deleted"
338
  msgstr[0] ""
339
  msgstr[1] ""
340
 
341
- #: src/optimizations/transient.php:116
342
  msgid "%d expired transient in your database"
343
  msgid_plural "%d expired transient in your database"
344
  msgstr[0] ""
345
  msgstr[1] ""
346
 
347
- #: src/optimizations/transient.php:118
348
  msgid "No transient options found"
349
  msgstr ""
350
 
351
- #: src/optimizations/transient.php:125, src/optimizations/transient.php:129
352
  msgid "Remove expired transient options"
353
  msgstr ""
354
 
@@ -358,53 +369,57 @@ msgid_plural "%d unapproved comments deleted"
358
  msgstr[0] ""
359
  msgstr[1] ""
360
 
361
- #: src/optimizations/unapproved.php:42
362
  msgid "%d unapproved comment found"
363
  msgid_plural "%d unapproved comments found"
364
  msgstr[0] ""
365
  msgstr[1] ""
366
 
367
- #: src/optimizations/unapproved.php:44
368
  msgid "No unapproved comments found"
369
  msgstr ""
370
 
371
- #: src/optimizations/unapproved.php:52
372
  msgid "Remove unapproved comments which are older than %d weeks"
373
  msgstr ""
374
 
375
- #: src/optimizations/unapproved.php:54, src/optimizations/unapproved.php:59
376
  msgid "Remove unapproved comments"
377
  msgstr ""
378
 
379
- #: src/templates/admin-page-header.php:20
380
  msgid "Home"
381
  msgstr ""
382
 
383
- #: src/templates/admin-page-header.php:24
 
 
 
 
384
  msgid "News"
385
  msgstr ""
386
 
387
- #: src/templates/admin-page-header.php:26, src/templates/notices/thanks-for-using-main-dash.php:13
388
  msgid "Twitter"
389
  msgstr ""
390
 
391
- #: src/templates/admin-page-header.php:28
392
  msgid "Support"
393
  msgstr ""
394
 
395
- #: src/templates/admin-page-header.php:30
396
  msgid "Newsletter sign-up"
397
  msgstr ""
398
 
399
- #: src/templates/admin-page-header.php:32
400
  msgid "Lead developer"
401
  msgstr ""
402
 
403
- #: src/templates/admin-page-header.php:36
404
  msgid "FAQs"
405
  msgstr ""
406
 
407
- #: src/templates/admin-page-header.php:38
408
  msgid "More plugins"
409
  msgstr ""
410
 
@@ -412,98 +427,122 @@ msgstr ""
412
  msgid "General settings"
413
  msgstr ""
414
 
415
- #: src/templates/admin-settings.php:22
 
 
 
 
416
  msgid "Keep last %s weeks data"
417
  msgstr ""
418
 
419
- #: src/templates/admin-settings.php:26
420
  msgid "This option will, where relevant, retain data from the chosen period, and remove any garbage data before that period."
421
  msgstr ""
422
 
423
- #: src/templates/admin-settings.php:26
424
  msgid "If the option is not active, then all garbage data will be removed."
425
  msgstr ""
426
 
427
- #: src/templates/admin-settings.php:26
428
  msgid "This will also affect Auto Clean-up process"
429
  msgstr ""
430
 
431
- #: src/templates/admin-settings.php:31
432
  msgid "Enable admin bar link"
433
  msgstr ""
434
 
435
- #: src/templates/admin-settings.php:34
436
  msgid "This option will put an WP-Optimize link on the top admin bar (default is off). Requires a second page refresh after saving the settings."
437
  msgstr ""
438
 
439
- #: src/templates/admin-settings.php:39
440
  msgid "Auto clean-up settings"
441
  msgstr ""
442
 
443
- #: src/templates/admin-settings.php:44
444
  msgid "Enable scheduled clean-up and optimization (Beta feature!)"
445
  msgstr ""
446
 
447
- #: src/templates/admin-settings.php:52
448
  msgid "Select schedule type (default is Weekly)"
449
  msgstr ""
450
 
451
- #: src/templates/admin-settings.php:57
452
  msgid "Daily"
453
  msgstr ""
454
 
455
- #: src/templates/admin-settings.php:58
456
  msgid "Weekly"
457
  msgstr ""
458
 
459
- #: src/templates/admin-settings.php:59
460
  msgid "Fortnightly"
461
  msgstr ""
462
 
463
- #: src/templates/admin-settings.php:60
464
  msgid "Monthly (approx. - every 30 days)"
465
  msgstr ""
466
 
467
- #: src/templates/admin-settings.php:105
468
  msgid "Enable email notification"
469
  msgstr ""
470
 
471
- #: src/templates/admin-settings.php:110
472
  msgid "Send email to"
473
  msgstr ""
474
 
475
- #: src/templates/admin-settings.php:121
 
 
 
 
476
  msgid "Save settings"
477
  msgstr ""
478
 
479
- #: src/templates/admin-settings.php:135
480
  msgid "Trackback/comments actions"
481
  msgstr ""
482
 
483
- #: src/templates/admin-settings.php:140
484
  msgid "Trackbacks"
485
  msgstr ""
486
 
487
- #: src/templates/admin-settings.php:143
488
  msgid "Use these buttons to enable or disable any future trackbacks on all your previously published posts."
489
  msgstr ""
490
 
491
- #: src/templates/admin-settings.php:146, src/templates/admin-settings.php:158
492
  msgid "Enable"
493
  msgstr ""
494
 
495
- #: src/templates/admin-settings.php:148, src/templates/admin-settings.php:160
496
  msgid "Disable"
497
  msgstr ""
498
 
499
- #: src/templates/admin-settings.php:154
500
  msgid "Comments"
501
  msgstr ""
502
 
503
- #: src/templates/admin-settings.php:156
504
  msgid "Use these buttons to enable or disable any future comments on all your previously published posts."
505
  msgstr ""
506
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
507
  #: src/templates/notices/horizontal-notice.php:6
508
  msgid "notice image"
509
  msgstr ""
@@ -512,27 +551,27 @@ msgstr ""
512
  msgid "Dismiss"
513
  msgstr ""
514
 
515
- #: src/templates/notices/horizontal-notice.php:36
516
  msgid "Get UpdraftCentral"
517
  msgstr ""
518
 
519
- #: src/templates/notices/horizontal-notice.php:38
520
  msgid "Review WP-Optimize"
521
  msgstr ""
522
 
523
- #: src/templates/notices/horizontal-notice.php:40
524
  msgid "Get UpdraftPlus"
525
  msgstr ""
526
 
527
- #: src/templates/notices/horizontal-notice.php:42
528
  msgid "Sign up"
529
  msgstr ""
530
 
531
- #: src/templates/notices/horizontal-notice.php:44
532
  msgid "Go there"
533
  msgstr ""
534
 
535
- #: src/templates/notices/thanks-for-using-main-dash.php:5, src/templates/notices/thanks-for-using-main-dash.php:41
536
  msgid "Dismiss (for %s months)"
537
  msgstr ""
538
 
@@ -540,70 +579,74 @@ msgstr ""
540
  msgid "Thank you for using WP-Optimize, the world's most trusted WP optimization plugin!"
541
  msgstr ""
542
 
543
- #: src/templates/notices/thanks-for-using-main-dash.php:13
544
  msgid "Keep in touch!"
545
  msgstr ""
546
 
547
- #: src/templates/notices/thanks-for-using-main-dash.php:13
548
  msgid "Blog"
549
  msgstr ""
550
 
551
- #: src/templates/notices/thanks-for-using-main-dash.php:13
552
  msgid "Newsletter"
553
  msgstr ""
554
 
555
- #: src/templates/notices/thanks-for-using-main-dash.php:22
556
  msgid "UpdraftPlus - the #1 most-trusted WordPress backup/restore plugin"
557
  msgstr ""
558
 
559
- #: src/templates/notices/thanks-for-using-main-dash.php:22
560
  msgid "The team behind WP-Optimize also create WordPress's most trusted backup/restore plugin"
561
  msgstr ""
562
 
563
- #: src/templates/notices/thanks-for-using-main-dash.php:22
564
- msgid "UpdraftPlus"
565
- msgstr ""
566
-
567
- #: src/templates/notices/thanks-for-using-main-dash.php:26
568
  msgid "Hackers, user error and dodgy updates can all ruin your site."
569
  msgstr ""
570
 
571
- #: src/templates/notices/thanks-for-using-main-dash.php:26
572
  msgid "We recommend that you install %s, which can automatically backup to remote cloud storage like Dropbox so your backup is independent and safe."
573
  msgstr ""
574
 
575
- #: src/templates/notices/thanks-for-using-main-dash.php:26
576
  msgid "You can also restore a site with a couple of clicks."
577
  msgstr ""
578
 
579
- #: src/templates/notices/thanks-for-using-main-dash.php:28
580
  msgid "Many users of %s have switched to UpdraftPlus WordPress Backup."
581
  msgstr ""
582
 
583
- #: src/templates/notices/thanks-for-using-main-dash.php:28
584
  msgid "backup plugin comparison table"
585
  msgstr ""
586
 
587
- #: src/templates/notices/thanks-for-using-main-dash.php:35
588
  msgid "Do you manage multiple WordPress sites?"
589
  msgstr ""
590
 
591
- #: src/templates/notices/thanks-for-using-main-dash.php:35
592
- msgid "If so, take a look at %s, our remote site management solution"
593
  msgstr ""
594
 
595
- #: src/templates/notices/thanks-for-using-main-dash.php:35
596
  msgid "Login securely, backup and update all your sites from one place."
597
  msgstr ""
598
 
599
- #: src/templates/notices/thanks-for-using-main-dash.php:35
600
  msgid "Available as a self-install plugin, or hosted for you from updraftplus.com"
601
  msgstr ""
602
 
603
- #: src/templates/notices/thanks-for-using-main-dash.php:37
604
  msgid "More quality plugins"
605
  msgstr ""
606
 
 
 
 
 
 
 
 
 
607
  #: src/templates/optimizations-table.php:7
608
  msgid "Optimization"
609
  msgstr ""
@@ -612,44 +655,64 @@ msgstr ""
612
  msgid "Notes"
613
  msgstr ""
614
 
615
- #: src/templates/optimizations-table.php:48
616
  msgid "Run optimization"
617
  msgstr ""
618
 
619
- #: src/templates/optimizations-table.php:50
620
  msgid "Go"
621
  msgstr ""
622
 
623
- #: src/templates/optimize-table.php:11
624
- msgid "Optimizations"
 
 
 
 
625
  msgstr ""
626
 
627
- #: src/templates/optimize-table.php:15
628
- msgid "Select safe options"
629
  msgstr ""
630
 
631
- #: src/templates/optimize-table.php:16, src/templates/optimize-table.php:26
632
  msgid "Warning:"
633
  msgstr ""
634
 
635
- #: src/templates/optimize-table.php:16
636
  msgid "It is best practice to always make a backup of your database before any major operation (optimizing, upgrading, etc.)."
637
  msgstr ""
638
 
639
- #: src/templates/optimize-table.php:16
640
  msgid "If you need a backup plugin, then we recommend UpdraftPlus."
641
  msgstr ""
642
 
643
- #: src/templates/optimize-table.php:20
644
- msgid "Run all selected optimizations now"
 
 
 
 
 
 
 
 
645
  msgstr ""
646
 
647
- #: src/templates/optimize-table.php:26
648
- msgid "Items marked in red, whilst still safe, perform more database delete operations."
649
  msgstr ""
650
 
651
- #: src/templates/optimize-table.php:26
652
- msgid "You may wish to run a backup before performing them."
 
 
 
 
 
 
 
 
653
  msgstr ""
654
 
655
  #: src/templates/status-box-contents.php:11
@@ -736,17 +799,17 @@ msgstr ""
736
  msgid "Support is available here."
737
  msgstr ""
738
 
739
- #: src/templates/tables-body.php:63
740
  msgid "Total:"
741
  msgstr ""
742
 
743
- #: src/templates/tables-body.php:64
744
  msgid "%d Table"
745
  msgid_plural "%d Tables"
746
  msgstr[0] ""
747
  msgstr[1] ""
748
 
749
- #: src/templates/tables-body.php:65
750
  msgid "%d Record"
751
  msgid_plural "%d Records"
752
  msgstr[0] ""
@@ -800,78 +863,98 @@ msgstr ""
800
  msgid "Total space saved:"
801
  msgstr ""
802
 
803
- #: src/templates/tables.php:51
804
  msgid "Optimization Possibility:"
805
  msgstr ""
806
 
807
- #: src/templates/tables.php:54
808
  msgid "Total space that can be saved:"
809
  msgstr ""
810
 
811
- #: src/wp-optimize.php:177
 
 
 
 
 
 
 
 
 
 
 
 
812
  msgid "Table information"
813
  msgstr ""
814
 
815
- #: src/wp-optimize.php:178, src/wp-optimize.php:319
816
  msgid "Settings"
817
  msgstr ""
818
 
819
- #: src/wp-optimize.php:179
820
  msgid "Plugin family"
821
  msgstr ""
822
 
823
- #: src/wp-optimize.php:305
 
 
 
 
 
 
 
 
824
  msgid "Optimize"
825
  msgstr ""
826
 
827
- #: src/wp-optimize.php:322
828
  msgid "Optimizer"
829
  msgstr ""
830
 
831
- #: src/wp-optimize.php:445
832
  msgid "Error:"
833
  msgstr ""
834
 
835
- #: src/wp-optimize.php:445
836
  msgid "template not found"
837
  msgstr ""
838
 
839
- #: src/wp-optimize.php:504
840
  msgid "Automatic Operation Completed"
841
  msgstr ""
842
 
843
- #: src/wp-optimize.php:506
844
  msgid "Scheduled optimization was executed at"
845
  msgstr ""
846
 
847
- #: src/wp-optimize.php:507
848
  msgid "Recovered space"
849
  msgstr ""
850
 
851
- #: src/wp-optimize.php:508
852
  msgid "You can safely delete this email."
853
  msgstr ""
854
 
855
- #: src/wp-optimize.php:510
856
  msgid "Regards,"
857
  msgstr ""
858
 
859
- #: src/wp-optimize.php:511
860
  msgid "WP-Optimize Plugin"
861
  msgstr ""
862
 
863
- #: src/wp-optimize.php:539
864
  msgid "GB"
865
  msgstr ""
866
 
867
- #: src/wp-optimize.php:541
868
  msgid "MB"
869
  msgstr ""
870
 
871
- #: src/wp-optimize.php:543
872
  msgid "KB"
873
  msgstr ""
874
 
875
- #: src/wp-optimize.php:545
876
  msgid "bytes"
877
  msgstr ""
1
+ # Copyright (C) 2017 wp-optimize
2
  # This file is distributed under the same license as the wp-optimize package.
3
  msgid ""
4
  msgstr ""
7
  "MIME-Version: 1.0\n"
8
  "Content-Type: text/plain; charset=UTF-8\n"
9
  "Content-Transfer-Encoding: 8bit\n"
10
+ "PO-Revision-Date: 2017-MO-DA HO:MI+ZONE\n"
11
  "Last-Translator: John Doe <mail@example.com>\n"
12
+ "Language-Team: Team Updraft <mail@example.com>\n"
13
  "X-Poedit-Basepath: ..\n"
14
  "X-Poedit-SourceCharset: UTF-8\n"
15
  "X-Poedit-KeywordsList: __;_e;_n:1,2;_x:1,2c;_ex:1,2c;_nx:4c,1,2;esc_attr__;esc_attr_e;esc_attr_x:1,2c;esc_html__;esc_html_e;esc_html_x:1,2c;_n_noop:1,2;_nx_noop:3c,1,2;__ngettext_noop:1,2\n"
17
  "X-Poedit-SearchPathExcluded-0: *.js\n"
18
  "Plural-Forms: nplurals=2; plural=(n != 1);\n"
19
 
20
+ #: src/includes/class-commands.php:86
21
  msgid "No optimization was indicated."
22
  msgstr ""
23
 
24
+ #: src/includes/class-updraft-php-logger.php:22
25
+ msgid "Log events into PHP error log"
26
+ msgstr ""
27
+
28
+ #: src/includes/class-updraft-simple-history-logger.php:22
29
+ msgid "Log events into Simple History plugin"
30
+ msgstr ""
31
+
32
+ #: src/includes/class-wp-optimize-options.php:69
33
+ msgid "Auto backup option updated."
34
+ msgstr ""
35
+
36
+ #: src/includes/class-wp-optimize-options.php:179
37
  msgid "Settings updated."
38
  msgstr ""
39
 
40
+ #: src/includes/class-wp-optimizer.php:110, src/includes/class-wp-optimizer.php:116
41
  msgid "No such optimization"
42
  msgstr ""
43
 
44
+ #: src/includes/class-wp-optimizer.php:383
45
  msgid "Comments have now been disabled on all current and previously published posts."
46
  msgstr ""
47
 
48
+ #: src/includes/class-wp-optimizer.php:386
49
  msgid "Comments have now been enabled on all current and previously published posts."
50
  msgstr ""
51
 
52
+ #: src/includes/class-wp-optimizer.php:393
53
  msgid "Trackbacks have now been disabled on all current and previously published posts."
54
  msgstr ""
55
 
56
+ #: src/includes/class-wp-optimizer.php:397
57
  msgid "Trackbacks have now been enabled on all current and previously published posts."
58
  msgstr ""
59
 
60
+ #: src/includes/wp-optimize-notices.php:31
61
  msgid "Make sure you backup as well as optimize your database"
62
  msgstr ""
63
 
64
+ #: src/includes/wp-optimize-notices.php:32
65
  msgid "UpdraftPlus is the world's most trusted backup plugin from the owners of WP-Optimize"
66
  msgstr ""
67
 
68
+ #: src/includes/wp-optimize-notices.php:42
69
  msgid "Introducing UpdraftCentral - from the team behind WP-Optimize"
70
  msgstr ""
71
 
72
+ #: src/includes/wp-optimize-notices.php:43
73
  msgid "UpdraftCentral is a highly efficient way to manage, update and backup multiple websites from one place."
74
  msgstr ""
75
 
76
+ #: src/includes/wp-optimize-notices.php:53
77
  msgid "Like WP-Optimize and can spare one minute?"
78
  msgstr ""
79
 
80
+ #: src/includes/wp-optimize-notices.php:54
81
  msgid "Please help WP-Optimize by giving a positive review at wordpress.org."
82
  msgstr ""
83
 
87
  msgstr[0] ""
88
  msgstr[1] ""
89
 
90
+ #: src/optimizations/autodraft.php:42
91
  msgid "%d item removed from Trash"
92
  msgid_plural "%d items removed from Trash"
93
  msgstr[0] ""
94
  msgstr[1] ""
95
 
96
+ #: src/optimizations/autodraft.php:59
97
  msgid "%d auto draft post in your database"
98
  msgid_plural "%d auto draft posts in your database"
99
  msgstr[0] ""
100
  msgstr[1] ""
101
 
102
+ #: src/optimizations/autodraft.php:61
103
  msgid "No auto draft posts found"
104
  msgstr ""
105
 
106
+ #: src/optimizations/autodraft.php:75
107
  msgid "%d trashed post in your database"
108
  msgid_plural "%d trashed posts in your database"
109
  msgstr[0] ""
110
  msgstr[1] ""
111
 
112
+ #: src/optimizations/autodraft.php:77
113
  msgid "No trashed posts found"
114
  msgstr ""
115
 
116
+ #: src/optimizations/autodraft.php:86
117
+ msgid "Clean auto draft and trashed posts which are older than %d weeks"
118
  msgstr ""
119
 
120
+ #: src/optimizations/autodraft.php:88
121
+ msgid "Clean all auto-drafts and trashed posts"
122
  msgstr ""
123
 
124
+ #: src/optimizations/autodraft.php:94
125
+ msgid "Remove auto-drafts and trashed posts"
126
  msgstr ""
127
 
128
  #: src/optimizations/commentmeta.php:17
131
  msgstr[0] ""
132
  msgstr[1] ""
133
 
134
+ #: src/optimizations/commentmeta.php:27
135
  msgid "%d unused akismet comment metadata item removed"
136
  msgid_plural "%d unused akismet comment metadata items removed"
137
  msgstr[0] ""
138
  msgstr[1] ""
139
 
140
+ #: src/optimizations/commentmeta.php:40
141
  msgid "%d orphaned comment meta data in your database"
142
  msgid_plural "%d orphaned comment meta data in your database"
143
  msgstr[0] ""
144
  msgstr[1] ""
145
 
146
+ #: src/optimizations/commentmeta.php:42
147
  msgid "No orphaned comment meta data in your database"
148
  msgstr ""
149
 
150
+ #: src/optimizations/commentmeta.php:50, src/optimizations/commentmeta.php:54
151
  msgid "Clean comment meta data"
152
  msgstr ""
153
 
161
  msgid "Remove unused tags"
162
  msgstr ""
163
 
164
+ #: src/optimizations/optimizetables.php:43
165
+ msgid "Optimizing Table:"
 
166
  msgstr ""
167
 
168
+ #: src/optimizations/optimizetables.php:52
169
  msgid "Total gain:"
170
  msgstr ""
171
 
172
+ #: src/optimizations/optimizetables.php:56
173
+ msgid "Tables using the InnoDB engine (%d) will not be optimized. Other tables will be optimized (%d)."
174
+ msgstr ""
175
+
176
+ #: src/optimizations/optimizetables.php:58
177
+ msgid "Tables will be optimized (%d)."
178
  msgstr ""
179
 
180
+ #: src/optimizations/optimizetables.php:64, src/optimizations/optimizetables.php:68
181
  msgid "Optimize database tables"
182
  msgstr ""
183
 
187
  msgstr[0] ""
188
  msgstr[1] ""
189
 
190
+ #: src/optimizations/orphandata.php:29
191
  msgid "%d orphaned relationship data in your database"
192
  msgid_plural "%d orphaned relationship data in your database"
193
  msgstr[0] ""
194
  msgstr[1] ""
195
 
196
+ #: src/optimizations/orphandata.php:31
197
  msgid "No orphaned relationship data in your database"
198
  msgstr ""
199
 
200
+ #: src/optimizations/orphandata.php:38
201
  msgid "Clean orphaned relationship data"
202
  msgstr ""
203
 
207
  msgstr[0] ""
208
  msgstr[1] ""
209
 
210
+ #: src/optimizations/pingbacks.php:28
211
  msgid "%d Pingback found"
212
  msgid_plural "%d Pingbacks found"
213
  msgstr[0] ""
214
  msgstr[1] ""
215
 
216
+ #: src/optimizations/pingbacks.php:30
217
  msgid "No pingbacks found"
218
  msgstr ""
219
 
220
+ #: src/optimizations/pingbacks.php:37
221
  msgid "Remove pingbacks"
222
  msgstr ""
223
 
224
+ #: src/optimizations/postmeta.php:18
225
  msgid "%d orphaned postmeta deleted"
226
  msgid_plural "%d orphaned postmeta deleted"
227
  msgstr[0] ""
228
  msgstr[1] ""
229
 
230
+ #: src/optimizations/postmeta.php:31
231
  msgid "%d orphaned post meta data in your database"
232
  msgid_plural "%d orphaned postmeta in your database"
233
  msgstr[0] ""
234
  msgstr[1] ""
235
 
236
+ #: src/optimizations/postmeta.php:33
237
  msgid "No orphaned post meta data in your database"
238
  msgstr ""
239
 
240
+ #: src/optimizations/postmeta.php:41
241
  msgid "Clean post meta data"
242
  msgstr ""
243
 
244
+ #: src/optimizations/postmeta.php:46
245
  msgid "Remove orphaned post meta"
246
  msgstr ""
247
 
251
  msgstr[0] ""
252
  msgstr[1] ""
253
 
254
+ #: src/optimizations/revisions.php:44
255
  msgid "%d post revision in your database"
256
  msgid_plural "%d post revisions in your database"
257
  msgstr[0] ""
258
  msgstr[1] ""
259
 
260
+ #: src/optimizations/revisions.php:46
261
  msgid "No post revisions found"
262
  msgstr ""
263
 
264
+ #: src/optimizations/revisions.php:55
265
  msgid "Clean post revisions which are older than %d weeks"
266
  msgstr ""
267
 
268
+ #: src/optimizations/revisions.php:57
269
  msgid "Clean all post revisions"
270
  msgstr ""
271
 
272
+ #: src/optimizations/revisions.php:63
273
  msgid "Remove auto revisions"
274
  msgstr ""
275
 
279
  msgstr[0] ""
280
  msgstr[1] ""
281
 
282
+ #: src/optimizations/spam.php:43
283
  msgid "%d comment removed from Trash"
284
  msgid_plural "%d comments removed from Trash"
285
  msgstr[0] ""
286
  msgstr[1] ""
287
 
288
+ #: src/optimizations/spam.php:60
289
  msgid "%d spam comment found"
290
  msgid_plural "%d spam comments found"
291
  msgstr[0] ""
292
  msgstr[1] ""
293
 
294
+ #: src/optimizations/spam.php:60, src/optimizations/spam.php:76, src/optimizations/unapproved.php:45
295
  msgid "Review"
296
  msgstr ""
297
 
298
+ #: src/optimizations/spam.php:62
299
  msgid "No spam comments found"
300
  msgstr ""
301
 
302
+ #: src/optimizations/spam.php:76
303
  msgid "%d trashed comment found"
304
  msgid_plural "%d trashed comments found"
305
  msgstr[0] ""
306
  msgstr[1] ""
307
 
308
+ #: src/optimizations/spam.php:78
309
  msgid "No trashed comments found"
310
  msgstr ""
311
 
312
+ #: src/optimizations/spam.php:88
313
+ msgid "Remove spam and trashed comments which are older than %d weeks"
314
  msgstr ""
315
 
316
+ #: src/optimizations/spam.php:90, src/optimizations/spam.php:95
317
+ msgid "Remove spam and trashed comments"
 
 
 
 
318
  msgstr ""
319
 
320
  #: src/optimizations/trackbacks.php:15
323
  msgstr[0] ""
324
  msgstr[1] ""
325
 
326
+ #: src/optimizations/trackbacks.php:28
327
  msgid "%d Trackback found"
328
  msgid_plural "%d Trackbacks found"
329
  msgstr[0] ""
330
  msgstr[1] ""
331
 
332
+ #: src/optimizations/trackbacks.php:30
333
  msgid "No trackbacks found"
334
  msgstr ""
335
 
336
+ #: src/optimizations/trackbacks.php:37
337
  msgid "Remove trackbacks"
338
  msgstr ""
339
 
349
  msgstr[0] ""
350
  msgstr[1] ""
351
 
352
+ #: src/optimizations/transient.php:117
353
  msgid "%d expired transient in your database"
354
  msgid_plural "%d expired transient in your database"
355
  msgstr[0] ""
356
  msgstr[1] ""
357
 
358
+ #: src/optimizations/transient.php:119
359
  msgid "No transient options found"
360
  msgstr ""
361
 
362
+ #: src/optimizations/transient.php:126, src/optimizations/transient.php:130
363
  msgid "Remove expired transient options"
364
  msgstr ""
365
 
369
  msgstr[0] ""
370
  msgstr[1] ""
371
 
372
+ #: src/optimizations/unapproved.php:45
373
  msgid "%d unapproved comment found"
374
  msgid_plural "%d unapproved comments found"
375
  msgstr[0] ""
376
  msgstr[1] ""
377
 
378
+ #: src/optimizations/unapproved.php:47
379
  msgid "No unapproved comments found"
380
  msgstr ""
381
 
382
+ #: src/optimizations/unapproved.php:55
383
  msgid "Remove unapproved comments which are older than %d weeks"
384
  msgstr ""
385
 
386
+ #: src/optimizations/unapproved.php:57, src/optimizations/unapproved.php:62
387
  msgid "Remove unapproved comments"
388
  msgstr ""
389
 
390
+ #: src/templates/admin-page-header.php:13
391
  msgid "Home"
392
  msgstr ""
393
 
394
+ #: src/templates/admin-page-header.php:15
395
+ msgid "updraftplus.com"
396
+ msgstr ""
397
+
398
+ #: src/templates/admin-page-header.php:17
399
  msgid "News"
400
  msgstr ""
401
 
402
+ #: src/templates/admin-page-header.php:19, src/templates/notices/thanks-for-using-main-dash.php:16
403
  msgid "Twitter"
404
  msgstr ""
405
 
406
+ #: src/templates/admin-page-header.php:21
407
  msgid "Support"
408
  msgstr ""
409
 
410
+ #: src/templates/admin-page-header.php:23
411
  msgid "Newsletter sign-up"
412
  msgstr ""
413
 
414
+ #: src/templates/admin-page-header.php:25
415
  msgid "Lead developer"
416
  msgstr ""
417
 
418
+ #: src/templates/admin-page-header.php:27
419
  msgid "FAQs"
420
  msgstr ""
421
 
422
+ #: src/templates/admin-page-header.php:29
423
  msgid "More plugins"
424
  msgstr ""
425
 
427
  msgid "General settings"
428
  msgstr ""
429
 
430
+ #: src/templates/admin-settings.php:16
431
+ msgid "Whether manually or on a schedule, these settings apply whenever a relevant optimization is run."
432
+ msgstr ""
433
+
434
+ #: src/templates/admin-settings.php:25
435
  msgid "Keep last %s weeks data"
436
  msgstr ""
437
 
438
+ #: src/templates/admin-settings.php:29
439
  msgid "This option will, where relevant, retain data from the chosen period, and remove any garbage data before that period."
440
  msgstr ""
441
 
442
+ #: src/templates/admin-settings.php:29
443
  msgid "If the option is not active, then all garbage data will be removed."
444
  msgstr ""
445
 
446
+ #: src/templates/admin-settings.php:29
447
  msgid "This will also affect Auto Clean-up process"
448
  msgstr ""
449
 
450
+ #: src/templates/admin-settings.php:34
451
  msgid "Enable admin bar link"
452
  msgstr ""
453
 
454
+ #: src/templates/admin-settings.php:37
455
  msgid "This option will put an WP-Optimize link on the top admin bar (default is off). Requires a second page refresh after saving the settings."
456
  msgstr ""
457
 
458
+ #: src/templates/admin-settings.php:42
459
  msgid "Auto clean-up settings"
460
  msgstr ""
461
 
462
+ #: src/templates/admin-settings.php:47
463
  msgid "Enable scheduled clean-up and optimization (Beta feature!)"
464
  msgstr ""
465
 
466
+ #: src/templates/admin-settings.php:55
467
  msgid "Select schedule type (default is Weekly)"
468
  msgstr ""
469
 
470
+ #: src/templates/admin-settings.php:60
471
  msgid "Daily"
472
  msgstr ""
473
 
474
+ #: src/templates/admin-settings.php:61
475
  msgid "Weekly"
476
  msgstr ""
477
 
478
+ #: src/templates/admin-settings.php:62
479
  msgid "Fortnightly"
480
  msgstr ""
481
 
482
+ #: src/templates/admin-settings.php:63
483
  msgid "Monthly (approx. - every 30 days)"
484
  msgstr ""
485
 
486
+ #: src/templates/admin-settings.php:107
487
  msgid "Enable email notification"
488
  msgstr ""
489
 
490
+ #: src/templates/admin-settings.php:112
491
  msgid "Send email to"
492
  msgstr ""
493
 
494
+ #: src/templates/admin-settings.php:119
495
+ msgid "Logging settings"
496
+ msgstr ""
497
+
498
+ #: src/templates/admin-settings.php:150
499
  msgid "Save settings"
500
  msgstr ""
501
 
502
+ #: src/templates/admin-settings.php:164
503
  msgid "Trackback/comments actions"
504
  msgstr ""
505
 
506
+ #: src/templates/admin-settings.php:169
507
  msgid "Trackbacks"
508
  msgstr ""
509
 
510
+ #: src/templates/admin-settings.php:172
511
  msgid "Use these buttons to enable or disable any future trackbacks on all your previously published posts."
512
  msgstr ""
513
 
514
+ #: src/templates/admin-settings.php:175, src/templates/admin-settings.php:187
515
  msgid "Enable"
516
  msgstr ""
517
 
518
+ #: src/templates/admin-settings.php:177, src/templates/admin-settings.php:189
519
  msgid "Disable"
520
  msgstr ""
521
 
522
+ #: src/templates/admin-settings.php:183
523
  msgid "Comments"
524
  msgstr ""
525
 
526
+ #: src/templates/admin-settings.php:185
527
  msgid "Use these buttons to enable or disable any future comments on all your previously published posts."
528
  msgstr ""
529
 
530
+ #: src/templates/may-also-like.php:13
531
+ msgid "UpdraftPlus newsletter"
532
+ msgstr ""
533
+
534
+ #: src/templates/may-also-like.php:15
535
+ msgid "here"
536
+ msgstr ""
537
+
538
+ #: src/templates/may-also-like.php:43, src/templates/notices/thanks-for-using-main-dash.php:26, src/templates/notices/thanks-for-using-main-dash.php:30
539
+ msgid "UpdraftPlus"
540
+ msgstr ""
541
+
542
+ #: src/templates/may-also-like.php:43
543
+ msgid "a lot more"
544
+ msgstr ""
545
+
546
  #: src/templates/notices/horizontal-notice.php:6
547
  msgid "notice image"
548
  msgstr ""
551
  msgid "Dismiss"
552
  msgstr ""
553
 
554
+ #: src/templates/notices/horizontal-notice.php:32
555
  msgid "Get UpdraftCentral"
556
  msgstr ""
557
 
558
+ #: src/templates/notices/horizontal-notice.php:34
559
  msgid "Review WP-Optimize"
560
  msgstr ""
561
 
562
+ #: src/templates/notices/horizontal-notice.php:36
563
  msgid "Get UpdraftPlus"
564
  msgstr ""
565
 
566
+ #: src/templates/notices/horizontal-notice.php:38
567
  msgid "Sign up"
568
  msgstr ""
569
 
570
+ #: src/templates/notices/horizontal-notice.php:40
571
  msgid "Go there"
572
  msgstr ""
573
 
574
+ #: src/templates/notices/thanks-for-using-main-dash.php:5
575
  msgid "Dismiss (for %s months)"
576
  msgstr ""
577
 
579
  msgid "Thank you for using WP-Optimize, the world's most trusted WP optimization plugin!"
580
  msgstr ""
581
 
582
+ #: src/templates/notices/thanks-for-using-main-dash.php:12
583
  msgid "Keep in touch!"
584
  msgstr ""
585
 
586
+ #: src/templates/notices/thanks-for-using-main-dash.php:14
587
  msgid "Blog"
588
  msgstr ""
589
 
590
+ #: src/templates/notices/thanks-for-using-main-dash.php:15
591
  msgid "Newsletter"
592
  msgstr ""
593
 
594
+ #: src/templates/notices/thanks-for-using-main-dash.php:26
595
  msgid "UpdraftPlus - the #1 most-trusted WordPress backup/restore plugin"
596
  msgstr ""
597
 
598
+ #: src/templates/notices/thanks-for-using-main-dash.php:26
599
  msgid "The team behind WP-Optimize also create WordPress's most trusted backup/restore plugin"
600
  msgstr ""
601
 
602
+ #: src/templates/notices/thanks-for-using-main-dash.php:30
 
 
 
 
603
  msgid "Hackers, user error and dodgy updates can all ruin your site."
604
  msgstr ""
605
 
606
+ #: src/templates/notices/thanks-for-using-main-dash.php:30
607
  msgid "We recommend that you install %s, which can automatically backup to remote cloud storage like Dropbox so your backup is independent and safe."
608
  msgstr ""
609
 
610
+ #: src/templates/notices/thanks-for-using-main-dash.php:30
611
  msgid "You can also restore a site with a couple of clicks."
612
  msgstr ""
613
 
614
+ #: src/templates/notices/thanks-for-using-main-dash.php:32
615
  msgid "Many users of %s have switched to UpdraftPlus WordPress Backup."
616
  msgstr ""
617
 
618
+ #: src/templates/notices/thanks-for-using-main-dash.php:32
619
  msgid "backup plugin comparison table"
620
  msgstr ""
621
 
622
+ #: src/templates/notices/thanks-for-using-main-dash.php:39
623
  msgid "Do you manage multiple WordPress sites?"
624
  msgstr ""
625
 
626
+ #: src/templates/notices/thanks-for-using-main-dash.php:39
627
+ msgid "If so, take a look at %s, our remote site management solution. "
628
  msgstr ""
629
 
630
+ #: src/templates/notices/thanks-for-using-main-dash.php:39
631
  msgid "Login securely, backup and update all your sites from one place."
632
  msgstr ""
633
 
634
+ #: src/templates/notices/thanks-for-using-main-dash.php:39
635
  msgid "Available as a self-install plugin, or hosted for you from updraftplus.com"
636
  msgstr ""
637
 
638
+ #: src/templates/notices/thanks-for-using-main-dash.php:44
639
  msgid "More quality plugins"
640
  msgstr ""
641
 
642
+ #: src/templates/notices/thanks-for-using-main-dash.php:46
643
+ msgid "Premium WooCommerce plugins"
644
+ msgstr ""
645
+
646
+ #: src/templates/notices/thanks-for-using-main-dash.php:47
647
+ msgid "Free two-factor security plugin"
648
+ msgstr ""
649
+
650
  #: src/templates/optimizations-table.php:7
651
  msgid "Optimization"
652
  msgstr ""
655
  msgid "Notes"
656
  msgstr ""
657
 
658
+ #: src/templates/optimizations-table.php:62
659
  msgid "Run optimization"
660
  msgstr ""
661
 
662
+ #: src/templates/optimizations-table.php:64
663
  msgid "Go"
664
  msgstr ""
665
 
666
+ #: src/templates/optimize-table.php:12
667
+ msgid "Backup before running optimizations"
668
+ msgstr ""
669
+
670
+ #: src/templates/optimize-table.php:28
671
+ msgid "Warning: This operation is permanent. Continue?"
672
  msgstr ""
673
 
674
+ #: src/templates/optimize-table.php:36
675
+ msgid "Optimizations"
676
  msgstr ""
677
 
678
+ #: src/templates/optimize-table.php:39, src/templates/optimize-table.php:73
679
  msgid "Warning:"
680
  msgstr ""
681
 
682
+ #: src/templates/optimize-table.php:40
683
  msgid "It is best practice to always make a backup of your database before any major operation (optimizing, upgrading, etc.)."
684
  msgstr ""
685
 
686
+ #: src/templates/optimize-table.php:42
687
  msgid "If you need a backup plugin, then we recommend UpdraftPlus."
688
  msgstr ""
689
 
690
+ #: src/templates/optimize-table.php:45
691
+ msgid "Run all selected optimizations"
692
+ msgstr ""
693
+
694
+ #: src/templates/optimize-table.php:49
695
+ msgid "Take a backup with UpdraftPlus before optimizing"
696
+ msgstr ""
697
+
698
+ #: src/templates/optimize-table.php:56
699
+ msgid "Follow this link to install UpdraftPlus, to take a backup before optimization"
700
  msgstr ""
701
 
702
+ #: src/templates/optimize-table.php:60
703
+ msgid "UpdraftPlus needs to be updated to 1.12.33 or higher in order to backup the database before optimization."
704
  msgstr ""
705
 
706
+ #: src/templates/optimize-table.php:60
707
+ msgid "Please update UpdraftPlus to the latest version."
708
+ msgstr ""
709
+
710
+ #: src/templates/optimize-table.php:73
711
+ msgid "Items marked in red perform more intensive database operations. In very rare cases, if your database server happened to crash or be forcibly powered down at the same time as an optimization operation was running, data might be corrupted. "
712
+ msgstr ""
713
+
714
+ #: src/templates/optimize-table.php:73
715
+ msgid "You may wish to run a backup before optimizing."
716
  msgstr ""
717
 
718
  #: src/templates/status-box-contents.php:11
799
  msgid "Support is available here."
800
  msgstr ""
801
 
802
+ #: src/templates/tables-body.php:64
803
  msgid "Total:"
804
  msgstr ""
805
 
806
+ #: src/templates/tables-body.php:65
807
  msgid "%d Table"
808
  msgid_plural "%d Tables"
809
  msgstr[0] ""
810
  msgstr[1] ""
811
 
812
+ #: src/templates/tables-body.php:66
813
  msgid "%d Record"
814
  msgid_plural "%d Records"
815
  msgstr[0] ""
863
  msgid "Total space saved:"
864
  msgstr ""
865
 
866
+ #: src/templates/tables.php:48
867
  msgid "Optimization Possibility:"
868
  msgstr ""
869
 
870
+ #: src/templates/tables.php:51
871
  msgid "Total space that can be saved:"
872
  msgstr ""
873
 
874
+ #: src/templates/tables.php:55
875
+ msgid "Total space:"
876
+ msgstr ""
877
+
878
+ #: src/templates/tables.php:61
879
+ msgid "Total InnoDB tables:"
880
+ msgstr ""
881
+
882
+ #: src/templates/tables.php:64
883
+ msgid "Total non-InnoDB tables:"
884
+ msgstr ""
885
+
886
+ #: src/wp-optimize.php:280
887
  msgid "Table information"
888
  msgstr ""
889
 
890
+ #: src/wp-optimize.php:281, src/wp-optimize.php:427
891
  msgid "Settings"
892
  msgstr ""
893
 
894
+ #: src/wp-optimize.php:282
895
  msgid "Plugin family"
896
  msgstr ""
897
 
898
+ #: src/wp-optimize.php:302
899
+ msgid "An unexpected response was received."
900
+ msgstr ""
901
+
902
+ #: src/wp-optimize.php:303
903
+ msgid "Optimization complete"
904
+ msgstr ""
905
+
906
+ #: src/wp-optimize.php:413
907
  msgid "Optimize"
908
  msgstr ""
909
 
910
+ #: src/wp-optimize.php:430
911
  msgid "Optimizer"
912
  msgstr ""
913
 
914
+ #: src/wp-optimize.php:552
915
  msgid "Error:"
916
  msgstr ""
917
 
918
+ #: src/wp-optimize.php:552
919
  msgid "template not found"
920
  msgstr ""
921
 
922
+ #: src/wp-optimize.php:611
923
  msgid "Automatic Operation Completed"
924
  msgstr ""
925
 
926
+ #: src/wp-optimize.php:613
927
  msgid "Scheduled optimization was executed at"
928
  msgstr ""
929
 
930
+ #: src/wp-optimize.php:614
931
  msgid "Recovered space"
932
  msgstr ""
933
 
934
+ #: src/wp-optimize.php:615
935
  msgid "You can safely delete this email."
936
  msgstr ""
937
 
938
+ #: src/wp-optimize.php:617
939
  msgid "Regards,"
940
  msgstr ""
941
 
942
+ #: src/wp-optimize.php:618
943
  msgid "WP-Optimize Plugin"
944
  msgstr ""
945
 
946
+ #: src/wp-optimize.php:644
947
  msgid "GB"
948
  msgstr ""
949
 
950
+ #: src/wp-optimize.php:646
951
  msgid "MB"
952
  msgstr ""
953
 
954
+ #: src/wp-optimize.php:648
955
  msgid "KB"
956
  msgstr ""
957
 
958
+ #: src/wp-optimize.php:650
959
  msgid "bytes"
960
  msgstr ""
optimizations/autodraft.php CHANGED
@@ -16,7 +16,7 @@ class WP_Optimization_autodraft extends WP_Optimization {
16
  protected $auto_id = 'drafts';
17
 
18
  public function optimize() {
19
-
20
  $clean = "DELETE FROM `".$this->wpdb->posts."` WHERE post_status = 'auto-draft'";
21
 
22
  if ($this->retention_enabled == 'true') {
@@ -29,7 +29,6 @@ class WP_Optimization_autodraft extends WP_Optimization {
29
 
30
  $this->register_output(sprintf(_n('%d auto draft deleted', '%d auto drafts deleted', $autodraft, 'wp-optimize'), number_format_i18n($autodraft)));
31
 
32
- // TODO: query trashed posts and cleanup metadata
33
  $clean = "DELETE FROM `".$this->wpdb->posts."` WHERE post_status = 'trash'";
34
 
35
  if ($this->retention_enabled == 'true') {
@@ -40,7 +39,10 @@ class WP_Optimization_autodraft extends WP_Optimization {
40
 
41
  $posttrash = $this->query($clean);
42
 
43
- $this->register_output(sprintf(_n('%d item removed from Trash', '%d items removed from Trash', $posttrash, 'wp-optimize'), number_format_i18n($posttrash)));
 
 
 
44
  }
45
 
46
  public function get_info() {
@@ -81,15 +83,15 @@ class WP_Optimization_autodraft extends WP_Optimization {
81
  public function settings_label() {
82
 
83
  if ($this->retention_enabled == 'true') {
84
- return sprintf(__('Clean auto draft posts which are older than %d weeks', 'wp-optimize'), $this->retention_period);
85
  } else {
86
- return __('Clean all auto draft posts and posts in trash', 'wp-optimize');
87
  }
88
 
89
  }
90
 
91
  public function get_auto_option_description() {
92
- return __('Remove auto drafts', 'wp-optimize');
93
  }
94
 
95
  }
16
  protected $auto_id = 'drafts';
17
 
18
  public function optimize() {
19
+
20
  $clean = "DELETE FROM `".$this->wpdb->posts."` WHERE post_status = 'auto-draft'";
21
 
22
  if ($this->retention_enabled == 'true') {
29
 
30
  $this->register_output(sprintf(_n('%d auto draft deleted', '%d auto drafts deleted', $autodraft, 'wp-optimize'), number_format_i18n($autodraft)));
31
 
 
32
  $clean = "DELETE FROM `".$this->wpdb->posts."` WHERE post_status = 'trash'";
33
 
34
  if ($this->retention_enabled == 'true') {
39
 
40
  $posttrash = $this->query($clean);
41
 
42
+ $info_message = sprintf(_n('%d item removed from Trash', '%d items removed from Trash', $posttrash, 'wp-optimize'), number_format_i18n($posttrash));
43
+
44
+ $this->logger->info($info_message);
45
+ $this->register_output($info_message);
46
  }
47
 
48
  public function get_info() {
83
  public function settings_label() {
84
 
85
  if ($this->retention_enabled == 'true') {
86
+ return sprintf(__('Clean auto draft and trashed posts which are older than %d weeks', 'wp-optimize'), $this->retention_period);
87
  } else {
88
+ return __('Clean all auto-drafts and trashed posts', 'wp-optimize');
89
  }
90
 
91
  }
92
 
93
  public function get_auto_option_description() {
94
+ return __('Remove auto-drafts and trashed posts', 'wp-optimize');
95
  }
96
 
97
  }
optimizations/commentmeta.php CHANGED
@@ -9,13 +9,14 @@ class WP_Optimization_commentmeta extends WP_Optimization {
9
  // TODO: The first query here (but not the second) used to be run on a cron run. This needs reviewing when we review the whole cron-run set of options.
10
 
11
  public function optimize() {
12
-
13
  $clean = "DELETE FROM `".$this->wpdb->commentmeta."` WHERE comment_id NOT IN (SELECT comment_id FROM `".$this->wpdb->comments."`);";
14
 
15
  $commentstrash_meta = $this->query($clean);
16
 
17
  $message = sprintf(_n('%d unused comment metadata item removed', '%d unused comment metadata items removed', $commentstrash_meta, 'wp-optimize'), number_format_i18n($commentstrash_meta));
18
 
 
19
  $this->register_output($message);
20
 
21
  // TODO: still need to test now cleaning up comments meta tables - removing akismet related settings
@@ -25,7 +26,8 @@ class WP_Optimization_commentmeta extends WP_Optimization {
25
 
26
  $message = sprintf(_n('%d unused akismet comment metadata item removed', '%d unused akismet comment metadata items removed', $commentstrash_meta2, 'wp-optimize'), number_format_i18n($commentstrash_meta2));
27
 
28
- $this->register_output($message);
 
29
  }
30
 
31
  public function get_info() {
9
  // TODO: The first query here (but not the second) used to be run on a cron run. This needs reviewing when we review the whole cron-run set of options.
10
 
11
  public function optimize() {
12
+
13
  $clean = "DELETE FROM `".$this->wpdb->commentmeta."` WHERE comment_id NOT IN (SELECT comment_id FROM `".$this->wpdb->comments."`);";
14
 
15
  $commentstrash_meta = $this->query($clean);
16
 
17
  $message = sprintf(_n('%d unused comment metadata item removed', '%d unused comment metadata items removed', $commentstrash_meta, 'wp-optimize'), number_format_i18n($commentstrash_meta));
18
 
19
+ $this->logger->info($message);
20
  $this->register_output($message);
21
 
22
  // TODO: still need to test now cleaning up comments meta tables - removing akismet related settings
26
 
27
  $message = sprintf(_n('%d unused akismet comment metadata item removed', '%d unused akismet comment metadata items removed', $commentstrash_meta2, 'wp-optimize'), number_format_i18n($commentstrash_meta2));
28
 
29
+ $this->logger->info($message);
30
+ $this->register_output($message);
31
  }
32
 
33
  public function get_info() {
optimizations/optimizetables.php CHANGED
@@ -26,68 +26,38 @@ class WP_Optimization_optimizetables extends WP_Optimization {
26
  }
27
 
28
  private function optimize_tables($optimize) {
29
-
30
- $total_gain = 0;
31
- $row_usage = 0;
32
- $data_usage = 0;
33
- $index_usage = 0;
34
- $overhead_usage = 0;
35
- $wp_optimize = WP_Optimize();
36
- $tablesstatus = $this->optimizer->get_tables();
37
- $how_many_inno_db_tables = 0;
38
-
39
- foreach ($tablesstatus as $table) {
40
- // TODO: $row_usage, $data_usage, $index_usage appear to be unused elsewhere in the plugin. Investigate. Also, on InnoDB, more is saved than the numeric results inform you of.
41
- // This all comes from the checkbox with name=id=optimize-db. So, that's the place to look to untangle.
42
- $row_usage += $table->Rows;
43
- $data_usage += $table->Data_length;
44
- $index_usage += $table->Index_length;
45
- if ('InnoDB' != $table->Engine) {
46
- $overhead_usage += $table->Data_free;
47
- $total_gain += $table->Data_free;
48
- } else {
49
- $how_many_inno_db_tables++;
50
- }
51
- if ($optimize) {
52
- $table_name = $table->Name;
53
- $wp_optimize->log('Optimizing: '.$table_name);
54
- $result_query = $this->query('OPTIMIZE TABLE '.$table_name);
55
- }
56
- }
57
 
58
- if ($optimize) {
59
-
60
- // No apparent reason for this (or the ob_end_flush() that was at the end). TODO: Ask Ruhani. Does something give unwanted debug output?
61
- ob_start();
62
 
 
 
 
 
 
63
  $thedate = gmdate(get_option('date_format') . ' ' . get_option('time_format'), current_time( "timestamp", 0 ));
64
  $this->options->update_option('last-optimized', $thedate);
65
 
66
- $this->optimizer->update_total_cleaned(strval($total_gain));
67
 
68
- // Sending notification email
69
- if ($this->options->get_option('email') !== false) {
70
- //TODO need to fix the problem with variable value not passing through
71
- if ($this->options->get_option('email-address') !== '') {
72
- //$wp_optimize->send_email($thedate, $total_gain);
 
 
 
 
 
73
  }
74
- }
75
- ob_end_flush();
76
 
77
- $wp_optimize->log('Total Gain .... '.strval($total_gain));
78
-
79
- $this->register_output(sprintf(_x('%s database optimized!', '%s is the database name', 'wp-optimize'), "'".htmlspecialchars(DB_NAME)."'"));
80
-
81
- }
82
-
83
- $this->register_output(__('Total gain:', 'wp-optimize').' '.WP_Optimize()->format_size(($total_gain)));
84
-
85
- if ($how_many_inno_db_tables >0 && !$optimize) {
86
-
87
- $this->register_output(sprintf(__('Tables using the InnoDB engine (%d) will not be optimized.', 'wp-optimize'), $how_many_inno_db_tables));
88
-
89
  }
90
-
91
  }
92
 
93
  public function get_auto_option_description() {
26
  }
27
 
28
  private function optimize_tables($optimize) {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
29
 
30
+ //only process the tables if optimization_table isset
31
+ if (isset($this->data['optimization_table']) && $this->data['optimization_table'] != '') {
 
 
32
 
33
+ $table_status = $this->wpdb->get_row($this->wpdb->prepare("SHOW TABLE STATUS WHERE name = %s", $this->data['optimization_table']));
34
+
35
+ $this->logger->info('Optimizing: '.$table_status->Name);
36
+ $result_query = $this->query('OPTIMIZE TABLE '.$table_status->Name);
37
+
38
  $thedate = gmdate(get_option('date_format') . ' ' . get_option('time_format'), current_time( "timestamp", 0 ));
39
  $this->options->update_option('last-optimized', $thedate);
40
 
41
+ $this->optimizer->update_total_cleaned(strval($table_status->Data_free));
42
 
43
+ $this->register_output(__('Optimizing Table:', 'wp-optimize').' '.$table_status->Name);
44
+ } else {
45
+ //This gathers information to be displayed onscreen before optimization
46
+ $tablesstatus = $this->optimizer->get_table_information();
47
+
48
+ //make sure that optimization_table_inno_db is set
49
+ if ($tablesstatus['inno_db_tables'] > 0) {
50
+ if (isset($this->data['optimization_table']) && $this->data['optimization_table'] != '') {
51
+ //This is used for grabbing information before optimizations
52
+ $this->register_output(__('Total gain:', 'wp-optimize').' '.WP_Optimize()->format_size(($tablesstatus['total_gain'])));
53
  }
 
 
54
 
55
+ //Output message for how many InnoDB tables will not be optimized
56
+ $this->register_output(sprintf(__('Tables using the InnoDB engine (%d) will not be optimized. Other tables will be optimized (%d).', 'wp-optimize'), $tablesstatus['inno_db_tables'],$tablesstatus['non_inno_db_tables']));
57
+ } else{
58
+ $this->register_output(sprintf(__('Tables will be optimized (%d).', 'wp-optimize'), $tablesstatus['non_inno_db_tables']));
59
+ }
 
 
 
 
 
 
 
60
  }
 
61
  }
62
 
63
  public function get_auto_option_description() {
optimizations/orphandata.php CHANGED
@@ -7,13 +7,14 @@ class WP_Optimization_orphandata extends WP_Optimization {
7
  public $ui_sort_order = 10000;
8
 
9
  public function optimize() {
10
-
11
  $clean = "DELETE FROM `".$this->wpdb->term_relationships."` WHERE term_taxonomy_id=1 AND object_id NOT IN (SELECT id FROM `".$this->wpdb->posts."`);";
12
 
13
  $orphandata = $this->query($clean);
14
 
15
  $message = sprintf(_n('%d orphaned meta data deleted', '%d orphaned meta data deleted', $orphandata, 'wp-optimize'), number_format_i18n($orphandata));
16
 
 
17
  $this->register_output($message);
18
 
19
  }
7
  public $ui_sort_order = 10000;
8
 
9
  public function optimize() {
10
+
11
  $clean = "DELETE FROM `".$this->wpdb->term_relationships."` WHERE term_taxonomy_id=1 AND object_id NOT IN (SELECT id FROM `".$this->wpdb->posts."`);";
12
 
13
  $orphandata = $this->query($clean);
14
 
15
  $message = sprintf(_n('%d orphaned meta data deleted', '%d orphaned meta data deleted', $orphandata, 'wp-optimize'), number_format_i18n($orphandata));
16
 
17
+ $this->logger->info($message);
18
  $this->register_output($message);
19
 
20
  }
optimizations/pingbacks.php CHANGED
@@ -7,12 +7,15 @@ class WP_Optimization_pingbacks extends WP_Optimization {
7
  public $ui_sort_order = 6000;
8
 
9
  public function optimize() {
10
-
11
  $clean = "DELETE FROM `".$this->wpdb->comments."` WHERE comment_type = 'pingback';";
12
 
13
  $comments = $this->query($clean);
14
 
15
- $this->register_output(sprintf(_n('%d pingback deleted', '%d pingbacks deleted', $comments, 'wp-optimize'), number_format_i18n($comments)));
 
 
 
16
  }
17
 
18
  public function get_info() {
7
  public $ui_sort_order = 6000;
8
 
9
  public function optimize() {
10
+
11
  $clean = "DELETE FROM `".$this->wpdb->comments."` WHERE comment_type = 'pingback';";
12
 
13
  $comments = $this->query($clean);
14
 
15
+ $info_message = sprintf(_n('%d pingback deleted', '%d pingbacks deleted', $comments, 'wp-optimize'), number_format_i18n($comments));
16
+ $this->logger->info($info_message);
17
+ $this->register_output($info_message);
18
+
19
  }
20
 
21
  public function get_info() {
optimizations/postmeta.php CHANGED
@@ -2,8 +2,6 @@
2
 
3
  if (!defined('WPO_VERSION')) die('No direct access allowed');
4
 
5
- // TODO: need to use proper query
6
-
7
  class WP_Optimization_postmeta extends WP_Optimization {
8
 
9
  public $ui_sort_order = 8000;
@@ -12,13 +10,14 @@ class WP_Optimization_postmeta extends WP_Optimization {
12
  public $auto_default = false;
13
 
14
  public function optimize() {
15
-
16
  $clean = "DELETE pm FROM `".$this->wpdb->postmeta."` pm LEFT JOIN `".$this->wpdb->posts."` wp ON wp.ID = pm.post_id WHERE wp.ID IS NULL;";
17
 
18
  $postmeta = $this->query($clean);
19
 
20
  $message = sprintf(_n('%d orphaned postmeta deleted', '%d orphaned postmeta deleted', $postmeta, 'wp-optimize'), number_format_i18n($postmeta));
21
 
 
22
  $this->register_output($message);
23
  }
24
 
2
 
3
  if (!defined('WPO_VERSION')) die('No direct access allowed');
4
 
 
 
5
  class WP_Optimization_postmeta extends WP_Optimization {
6
 
7
  public $ui_sort_order = 8000;
10
  public $auto_default = false;
11
 
12
  public function optimize() {
13
+
14
  $clean = "DELETE pm FROM `".$this->wpdb->postmeta."` pm LEFT JOIN `".$this->wpdb->posts."` wp ON wp.ID = pm.post_id WHERE wp.ID IS NULL;";
15
 
16
  $postmeta = $this->query($clean);
17
 
18
  $message = sprintf(_n('%d orphaned postmeta deleted', '%d orphaned postmeta deleted', $postmeta, 'wp-optimize'), number_format_i18n($postmeta));
19
 
20
+ $this->logger->info($message);
21
  $this->register_output($message);
22
  }
23
 
optimizations/revisions.php CHANGED
@@ -12,7 +12,7 @@ class WP_Optimization_revisions extends WP_Optimization {
12
  public $available_for_saving = true;
13
 
14
  public function optimize() {
15
-
16
  $clean = "DELETE FROM `".$this->wpdb->posts."` WHERE post_type = 'revision'";
17
 
18
  if ($this->retention_enabled == 'true') {
@@ -25,6 +25,7 @@ class WP_Optimization_revisions extends WP_Optimization {
25
 
26
  $message = sprintf(_n('%d post revision deleted', '%d post revisions deleted', $revisions, 'wp-optimize'), number_format_i18n($revisions));
27
 
 
28
  $this->register_output($message);
29
  }
30
 
12
  public $available_for_saving = true;
13
 
14
  public function optimize() {
15
+
16
  $clean = "DELETE FROM `".$this->wpdb->posts."` WHERE post_type = 'revision'";
17
 
18
  if ($this->retention_enabled == 'true') {
25
 
26
  $message = sprintf(_n('%d post revision deleted', '%d post revisions deleted', $revisions, 'wp-optimize'), number_format_i18n($revisions));
27
 
28
+ $this->logger->info($message);
29
  $this->register_output($message);
30
  }
31
 
optimizations/spam.php CHANGED
@@ -15,8 +15,8 @@ class WP_Optimization_spam extends WP_Optimization {
15
  protected $auto_id = 'spams';
16
 
17
  public function optimize() {
18
-
19
- $clean = "DELETE FROM `".$this->wpdb->comments."` WHERE comment_approved = 'spam'";
20
 
21
  if ($this->retention_enabled == 'true') {
22
  $clean .= ' and comment_date < NOW() - INTERVAL ' . $this->retention_period . ' WEEK';
@@ -26,9 +26,12 @@ class WP_Optimization_spam extends WP_Optimization {
26
 
27
  $comments = $this->query($clean);
28
 
29
- $this->register_output(sprintf(_n('%d spam comment deleted', '%d spam comments deleted', $comments, 'wp-optimize'), number_format_i18n($comments)));
30
 
31
- // TODO: query trashed comments and cleanup metadata
 
 
 
32
  $clean = "DELETE FROM `".$this->wpdb->comments."` WHERE comment_approved = 'trash'";
33
 
34
  if ($this->retention_enabled == 'true') {
@@ -37,7 +40,10 @@ class WP_Optimization_spam extends WP_Optimization {
37
  $clean .= ';';
38
  $commentstrash = $this->query($clean);
39
 
40
- $this->register_output(sprintf(_n('%d comment removed from Trash', '%d comments removed from Trash', $commentstrash, 'wp-optimize'), number_format_i18n($commentstrash)));
 
 
 
41
  }
42
 
43
  public function get_info() {
@@ -79,13 +85,13 @@ class WP_Optimization_spam extends WP_Optimization {
79
  public function settings_label() {
80
 
81
  if ($this->retention_enabled == 'true') {
82
- return sprintf(__('Remove spam comments which are older than %d weeks', 'wp-optimize'), $this->retention_period);
83
  } else {
84
- return __('Remove spam comments and comments in trash', 'wp-optimize');
85
  }
86
  }
87
 
88
  public function get_auto_option_description() {
89
- return __('Remove spam comments', 'wp-optimize');
90
  }
91
  }
15
  protected $auto_id = 'spams';
16
 
17
  public function optimize() {
18
+
19
+ $clean = "DELETE FROM `".$this->wpdb->comments."` WHERE comment_approved = 'spam'";
20
 
21
  if ($this->retention_enabled == 'true') {
22
  $clean .= ' and comment_date < NOW() - INTERVAL ' . $this->retention_period . ' WEEK';
26
 
27
  $comments = $this->query($clean);
28
 
29
+ $info_message = sprintf(_n('%d spam comment deleted', '%d spam comments deleted', $comments, 'wp-optimize'), number_format_i18n($comments));
30
 
31
+ $this->logger->info($info_message);
32
+ $this->register_output($info_message);
33
+
34
+ // Possible enhancement: query trashed comments and cleanup metadata
35
  $clean = "DELETE FROM `".$this->wpdb->comments."` WHERE comment_approved = 'trash'";
36
 
37
  if ($this->retention_enabled == 'true') {
40
  $clean .= ';';
41
  $commentstrash = $this->query($clean);
42
 
43
+ $info_message = sprintf(_n('%d comment removed from Trash', '%d comments removed from Trash', $commentstrash, 'wp-optimize'), number_format_i18n($commentstrash));
44
+
45
+ $this->logger->info($info_message);
46
+ $this->register_output($info_message);
47
  }
48
 
49
  public function get_info() {
85
  public function settings_label() {
86
 
87
  if ($this->retention_enabled == 'true') {
88
+ return sprintf(__('Remove spam and trashed comments which are older than %d weeks', 'wp-optimize'), $this->retention_period);
89
  } else {
90
+ return __('Remove spam and trashed comments', 'wp-optimize');
91
  }
92
  }
93
 
94
  public function get_auto_option_description() {
95
+ return __('Remove spam and trashed comments', 'wp-optimize');
96
  }
97
  }
optimizations/trackbacks.php CHANGED
@@ -12,7 +12,10 @@ class WP_Optimization_trackbacks extends WP_Optimization {
12
 
13
  $comments = $this->query($clean);
14
 
15
- $this->register_output(sprintf(_n('%d trackback deleted', '%d trackbacks deleted', $comments, 'wp-optimize'), number_format_i18n($comments)));
 
 
 
16
  }
17
 
18
  public function get_info() {
12
 
13
  $comments = $this->query($clean);
14
 
15
+ $info_message = sprintf(_n('%d trackback deleted', '%d trackbacks deleted', $comments, 'wp-optimize'), number_format_i18n($comments));
16
+
17
+ $this->logger->info($info_message);
18
+ $this->register_output( $info_message );
19
  }
20
 
21
  public function get_info() {
optimizations/transient.php CHANGED
@@ -9,7 +9,7 @@ class WP_Optimization_transient extends WP_Optimization {
9
  public $ui_sort_order = 5000;
10
 
11
  public function optimize() {
12
-
13
  $clean = "
14
  DELETE
15
  a, b
@@ -60,6 +60,7 @@ class WP_Optimization_transient extends WP_Optimization {
60
  $final_message = $message . ', '.sprintf(_n('%d site-wide transient option deleted', '%d site-widetransient options deleted', $sitemeta_table_transients_deleted, 'wp-optimize'), number_format_i18n($sitemeta_table_transients_deleted));
61
  }
62
 
 
63
  $this->register_output($final_message);
64
  }
65
 
@@ -105,7 +106,7 @@ class WP_Optimization_transient extends WP_Optimization {
105
  AND b.meta_value < UNIX_TIMESTAMP()
106
  ";
107
 
108
- $sitemeta_table_transients = $this->wpdb->get_var($options_table_sql);
109
  } else {
110
  $sitemeta_table_transients = 0;
111
  }
9
  public $ui_sort_order = 5000;
10
 
11
  public function optimize() {
12
+
13
  $clean = "
14
  DELETE
15
  a, b
60
  $final_message = $message . ', '.sprintf(_n('%d site-wide transient option deleted', '%d site-widetransient options deleted', $sitemeta_table_transients_deleted, 'wp-optimize'), number_format_i18n($sitemeta_table_transients_deleted));
61
  }
62
 
63
+ $this->logger->info($final_message);
64
  $this->register_output($final_message);
65
  }
66
 
106
  AND b.meta_value < UNIX_TIMESTAMP()
107
  ";
108
 
109
+ $sitemeta_table_transients = $this->wpdb->get_var($sitemeta_table_sql);
110
  } else {
111
  $sitemeta_table_transients = 0;
112
  }
optimizations/unapproved.php CHANGED
@@ -24,7 +24,10 @@ class WP_Optimization_unapproved extends WP_Optimization {
24
 
25
  $comments = $this->query($clean);
26
 
27
- $this->register_output(sprintf(_n('%d unapproved comment deleted', '%d unapproved comments deleted', $comments, 'wp-optimize'), number_format_i18n($comments)));
 
 
 
28
  }
29
 
30
  public function get_info() {
24
 
25
  $comments = $this->query($clean);
26
 
27
+ $info_message = sprintf(_n('%d unapproved comment deleted', '%d unapproved comments deleted', $comments, 'wp-optimize'), number_format_i18n($comments));
28
+
29
+ $this->logger->info($info_message);
30
+ $this->register_output($info_message);
31
  }
32
 
33
  public function get_info() {
readme.txt CHANGED
@@ -3,8 +3,8 @@ Contributors: DavidAnderson, ruhanirabin, DNutbourne, aporter, snightingale
3
  Donate link: https://david.dw-perspective.org.uk/donate
4
  Tags: comments, spam, optimize, database, revisions, users, posts, trash, schedule, automatic, clean, phpmyadmin, meta, postmeta, responsive, mobile
5
  Requires at least: 3.8
6
- Tested up to: 4.7
7
- Stable tag: 2.1.0
8
  License: GPLv2+
9
  License URI: https://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -22,6 +22,7 @@ WP-Optimize is an effective tool for automatically cleaning your WordPress datab
22
  * Carries out automatic weekly (or otherwise) clean-ups
23
  * Retains a set number of weeks' data during clean-ups
24
  * Performs optimizations without the need for running manual queries
 
25
  * Show database statistics and potential savings
26
  * Mobile friendly and easy-to-use
27
  * Translated into several languages
@@ -118,14 +119,22 @@ Please check your database for corrupted tables. That can happen, usually your w
118
 
119
  == Screenshots ==
120
 
121
- 1. Optimizer Screen
122
- 2. Settings Screen
123
  3. Table Report
124
- 4. Mobile View Top (Actual screen from Galaxy Note 3)
125
- 5. Mobile View Bottom (Actual screen from Galaxy Note 3)
126
 
127
  == Changelog ==
128
 
 
 
 
 
 
 
 
 
 
129
  = 2.1.0 - 28/Dec/2016 =
130
 
131
  * FOCUS: This release concentrates upon the user-interface, and in particular upon improving the clarity of each part, and making optimizations, saves and other actions possible without page reloads.
@@ -331,4 +340,4 @@ Please check your database for corrupted tables. That can happen, usually your w
331
  * Fix Interface
332
 
333
  == Upgrade Notice ==
334
- * 2.1.0: Makeover of the plugin's user-interface, providing greater ease of use, and eliminating the need for page reloads
3
  Donate link: https://david.dw-perspective.org.uk/donate
4
  Tags: comments, spam, optimize, database, revisions, users, posts, trash, schedule, automatic, clean, phpmyadmin, meta, postmeta, responsive, mobile
5
  Requires at least: 3.8
6
+ Tested up to: 4.9
7
+ Stable tag: 2.1.1
8
  License: GPLv2+
9
  License URI: https://www.gnu.org/licenses/gpl-2.0.html
10
 
22
  * Carries out automatic weekly (or otherwise) clean-ups
23
  * Retains a set number of weeks' data during clean-ups
24
  * Performs optimizations without the need for running manual queries
25
+ * Automatically trigger a pre-optimize backup via UpdraftPlus (https://updraftplus.com)
26
  * Show database statistics and potential savings
27
  * Mobile friendly and easy-to-use
28
  * Translated into several languages
119
 
120
  == Screenshots ==
121
 
122
+ 1. The main optimizer Screen
123
+ 2. UpdraftPlus running a backup before an optimization proceeds
124
  3. Table Report
125
+ 4. Settings
 
126
 
127
  == Changelog ==
128
 
129
+ = 2.1.1 - 28/Feb/2017 =
130
+
131
+ * FEATURE: Added the ability to take a automatic backup with UpdraftPlus (https://updraftplus.com) before an optimization
132
+ * FEATURE: When optimizing from the dashboard, tables are now optimized one by one, to reduce the scope for timeouts
133
+ * FIX: Removal of sitemeta items from main site on multisite install was not proceeding
134
+ * TWEAK: Adding premium bootstrapping to WP-Optimize for adding premium features in the future
135
+ * TWEAK: A few wording tweaks, plus automatically refresh the page if the 'admin bar menu' option is changed
136
+ * TWEAK: Introduce internal logging API
137
+
138
  = 2.1.0 - 28/Dec/2016 =
139
 
140
  * FOCUS: This release concentrates upon the user-interface, and in particular upon improving the clarity of each part, and making optimizations, saves and other actions possible without page reloads.
340
  * Fix Interface
341
 
342
  == Upgrade Notice ==
343
+ * 2.1.1: Integrate easy pre-optimize backups with UpdraftPlus; reduce scope for optimization timeouts; other small tweaks and fixes
templates/admin-page-header.php CHANGED
@@ -5,37 +5,28 @@
5
 
6
  echo '<h1>WP-Optimize '.WPO_VERSION.'</h1>';
7
 
 
8
  $wp_optimize_notices->do_notice();
9
 
10
- function wp_optimize_header_link($url, $text) {
11
-
12
- if (false !== strpos($url, '//updraftplus.com')) $url = apply_filters('wpoptimize_updraftplus_com_link', $url);
13
-
14
- echo '<a href="'.esc_attr($url).'">'.htmlspecialchars($text).'</a>';
15
-
16
- }
17
-
18
  ?>
19
  <p>
20
- <?php wp_optimize_header_link('https://updraftplus.com/wp-optimize/', __('Home', 'wp-optimize'));?> |
21
 
22
- <?php wp_optimize_header_link('https://updraftplus.com/', 'UpdraftPlus.Com');?> |
23
 
24
- <?php wp_optimize_header_link('https://updraftplus.com/news/', __('News', 'wp-optimize'));?> |
25
 
26
- <?php wp_optimize_header_link('https://twitter.com/updraftplus', __('Twitter', 'wp-optimize'));?> |
27
 
28
- <?php wp_optimize_header_link('https://wordpress.org/support/plugin/wp-optimize/', __('Support', 'wp-optimize'));?> |
29
 
30
- <?php wp_optimize_header_link('https://updraftplus.com/newsletter-signup', __('Newsletter sign-up', 'wp-optimize'));?> |
31
 
32
- <?php wp_optimize_header_link('https://david.dw-perspective.org.uk', __("Lead developer", 'wp-optimize'));?> |
33
-
34
- <?php wp_optimize_header_link('https://source.updraftplus.com/team-updraft/wp-optimize/', 'Gitlab');?> |
35
 
36
- <?php wp_optimize_header_link('https://wordpress.org/plugins/wp-optimize/faq/', __("FAQs", 'wp-optimize'));?> |
37
 
38
- <?php wp_optimize_header_link('https://www.simbahosting.co.uk/s3/shop/', __("More plugins", 'wp-optimize'));?>
39
 
40
  </p>
41
 
5
 
6
  echo '<h1>WP-Optimize '.WPO_VERSION.'</h1>';
7
 
8
+ //This is to display the notices
9
  $wp_optimize_notices->do_notice();
10
 
 
 
 
 
 
 
 
 
11
  ?>
12
  <p>
13
+ <?php $wp_optimize->wp_optimize_url('https://updraftplus.com/wp-optimize/', __('Home', 'wp-optimize'));?> |
14
 
15
+ <?php $wp_optimize->wp_optimize_url('https://updraftplus.com/', __('updraftplus.com', 'wp-optimize'));?> |
16
 
17
+ <?php $wp_optimize->wp_optimize_url('https://updraftplus.com/news/', __('News', 'wp-optimize'));?> |
18
 
19
+ <?php $wp_optimize->wp_optimize_url('https://twitter.com/updraftplus', __('Twitter', 'wp-optimize'));?> |
20
 
21
+ <?php $wp_optimize->wp_optimize_url('https://wordpress.org/support/plugin/wp-optimize/', __('Support', 'wp-optimize'));?> |
22
 
23
+ <?php $wp_optimize->wp_optimize_url('https://updraftplus.com/newsletter-signup', __('Newsletter sign-up', 'wp-optimize'));?> |
24
 
25
+ <?php $wp_optimize->wp_optimize_url('https://david.dw-perspective.org.uk', __("Lead developer", 'wp-optimize'));?> |
 
 
26
 
27
+ <?php $wp_optimize->wp_optimize_url('https://wordpress.org/plugins/wp-optimize/faq/', __("FAQs", 'wp-optimize'));?> |
28
 
29
+ <?php $wp_optimize->wp_optimize_url('https://www.simbahosting.co.uk/s3/shop/', __("More plugins", 'wp-optimize'));?>
30
 
31
  </p>
32
 
templates/admin-settings.php CHANGED
@@ -12,6 +12,9 @@
12
  <div class="postbox">
13
  <div class="inside">
14
  <h3><?php _e('General settings', 'wp-optimize'); ?></h3>
 
 
 
15
  <p>
16
  <input name="enable-retention" id="enable-retention" type="checkbox" value ="true" <?php echo $options->get_option('retention-enabled') == 'true' ? 'checked="checked"':''; ?> />
17
  <?php
@@ -77,7 +80,6 @@
77
  <?php
78
  $wpo_auto_options = $options->get_option('auto');
79
 
80
- // TODO: postmeta ("Remove orphaned post meta") and tags ("Remove unused tags") were present in the HTML previously, but commented out. Should ask Ruhani about that.
81
  $optimizations = $optimizer->sort_optimizations($optimizer->get_optimizations());
82
 
83
  foreach ($optimizations as $id => $optimization) {
@@ -113,8 +115,35 @@
113
  </p> -->
114
 
115
  </div>
116
-
117
- <hr>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
118
 
119
  <div id="wp-optimize-settings-save-results"></div>
120
 
12
  <div class="postbox">
13
  <div class="inside">
14
  <h3><?php _e('General settings', 'wp-optimize'); ?></h3>
15
+ <p>
16
+ <?php _e('Whether manually or on a schedule, these settings apply whenever a relevant optimization is run.', 'wp-optimize');?>
17
+ </p>
18
  <p>
19
  <input name="enable-retention" id="enable-retention" type="checkbox" value ="true" <?php echo $options->get_option('retention-enabled') == 'true' ? 'checked="checked"':''; ?> />
20
  <?php
80
  <?php
81
  $wpo_auto_options = $options->get_option('auto');
82
 
 
83
  $optimizations = $optimizer->sort_optimizations($optimizer->get_optimizations());
84
 
85
  foreach ($optimizations as $id => $optimization) {
115
  </p> -->
116
 
117
  </div>
118
+
119
+ <h3><?php _e('Logging settings', 'wp-optimize'); ?></h3>
120
+
121
+ <p></p>
122
+
123
+ <div id="wp-optimize-logging-options">
124
+ <?php
125
+ $wpo_logging_options = $options->get_option('logging');
126
+
127
+ $loggers = $wp_optimize->get_logger()->get_loggers();
128
+
129
+ foreach ($loggers as $logger) {
130
+
131
+ $logger_id = strtolower(get_class($logger));
132
+
133
+ $logger_dom_id = 'wp-optimize-auto-'.$logger_id;
134
+
135
+ $setting_activated = (empty($wpo_logging_options[$logger_id]) || 'false' == $wpo_logging_options[$logger_id]) ? false : true;
136
+
137
+ ?><p>
138
+ <input name="wp-optimize-logging[<?php echo $logger_id;?>]" id="<?php echo $logger_dom_id;?>" type="checkbox" value="true" <?php if ($setting_activated) echo 'checked="checked"'; ?>> <label for="<?php echo $logger_dom_id;?>"><?php echo $logger->get_description(); ?></label>
139
+ </p>
140
+ <?php
141
+
142
+ }
143
+ ?>
144
+ </div>
145
+
146
+ <hr>
147
 
148
  <div id="wp-optimize-settings-save-results"></div>
149
 
templates/may-also-like.php CHANGED
@@ -6,20 +6,20 @@
6
  <img class="addons" alt="WP_Optimize" src="<?php echo WPO_PLUGIN_URL.'images/logo/wpo_logo_small.png'; ?>">
7
  <h3>WP-Optimize is now part of the UpdraftPlus family!</h3>
8
 
9
- <p>Since version 2.0, WP-Optimize has been owned, developed, supported by <a href="https://updraftplus.com">UpdraftPlus</a>, the world's most installed WordPress backup/restore plugin.</p>
10
 
11
  <p>Releases 2.0 and 2.1 since then have brought no major changes or features on the outside (apart from a few bug fixes). What they have brought, is a complete re-factorization of the plugin on the inside. The code structure has now been completely renovated to make future development quicker, and to enable a future remote-control facility for users with multiple sites (through <a href="https://updraftcentral.com">UpdraftCentral)</a>. With version 2.1, all dashboard operations now take place without the need for page refreshes, and the user interface has been modified in several ways for better ease of understanding and use.</p>
12
 
13
- <p>We are quite excited to have reached this stage which lays a solid foundation for lots of future improvements. Watch this space and sign up to the <a href="https://updraftplus.com/newsletter-signup">UpdraftPlus newsletter</a> for updates!</p>
14
 
15
- <p>Find out more about the acquisition <a href="https://updraftplus.com/updraftplus-confirms-acquired-wp-optimize">here</a>.</p>
16
  </div>
17
  </div>
18
  </div>
19
  <div class="wpo_col wpo_half_width">
20
  <div class="postbox">
21
  <div class="inside">
22
- <a href="https://updraftplus.com"><img class="addons" name="UpdraftPlus" src="<?php echo WPO_PLUGIN_URL.'images/logo/udp_logo_small.png'; ?>"></a>
23
  <h3>Why do you need a backup plugin?</h3>
24
  <p>Websites crash, get hacked; hosting companies make mistakes or go bust; plugin and theme authors release code with unwanted errors in; site editors make mistakes too. With a backup, you can be back up and running again in minutes. Without - everything is gone.</p>
25
 
@@ -39,7 +39,9 @@
39
  <p>The ability to <strong>restore your website</strong> for you from your backups. Unfortunately, most WordPress backup plugins force you to learn about how to restore by hand!</p>
40
  </li>
41
  </ol>
42
- <p><a href="https://wordpress.org/plugins/updraftplus/">UpdraftPlus</a> is the most trusted and installed backup plugin because it does all of this and more reliably, for free. There is also a premium version which can do <a href="https://updraftplus.com">a lot more</a>.</p>
 
 
43
  </div>
44
  </div>
45
  </div>
6
  <img class="addons" alt="WP_Optimize" src="<?php echo WPO_PLUGIN_URL.'images/logo/wpo_logo_small.png'; ?>">
7
  <h3>WP-Optimize is now part of the UpdraftPlus family!</h3>
8
 
9
+ <p>Since version 2.0, WP-Optimize has been owned, developed, supported by <?php $wp_optimize->wp_optimize_url('https://updraftplus.com/', 'UpdraftPlus');?>, the world's most installed WordPress backup/restore plugin.</p>
10
 
11
  <p>Releases 2.0 and 2.1 since then have brought no major changes or features on the outside (apart from a few bug fixes). What they have brought, is a complete re-factorization of the plugin on the inside. The code structure has now been completely renovated to make future development quicker, and to enable a future remote-control facility for users with multiple sites (through <a href="https://updraftcentral.com">UpdraftCentral)</a>. With version 2.1, all dashboard operations now take place without the need for page refreshes, and the user interface has been modified in several ways for better ease of understanding and use.</p>
12
 
13
+ <p>We are quite excited to have reached this stage which lays a solid foundation for lots of future improvements. Watch this space and sign up to the <?php $wp_optimize->wp_optimize_url('https://updraftplus.com/newsletter-signup', __('UpdraftPlus newsletter', 'wp-optimize'));?> for updates!</p>
14
 
15
+ <p>Find out more about the acquisition <?php $wp_optimize->wp_optimize_url('https://updraftplus.com/updraftplus-confirms-acquired-wp-optimize', __('here', 'wp-optimize'));?>.</p>
16
  </div>
17
  </div>
18
  </div>
19
  <div class="wpo_col wpo_half_width">
20
  <div class="postbox">
21
  <div class="inside">
22
+ <?php $wp_optimize->wp_optimize_url('https://updraftplus.com/', null, '<img class="addons" name="UpdraftPlus" src="'. WPO_PLUGIN_URL.'images/logo/udp_logo_small.png' .'">');?>
23
  <h3>Why do you need a backup plugin?</h3>
24
  <p>Websites crash, get hacked; hosting companies make mistakes or go bust; plugin and theme authors release code with unwanted errors in; site editors make mistakes too. With a backup, you can be back up and running again in minutes. Without - everything is gone.</p>
25
 
39
  <p>The ability to <strong>restore your website</strong> for you from your backups. Unfortunately, most WordPress backup plugins force you to learn about how to restore by hand!</p>
40
  </li>
41
  </ol>
42
+ <p>
43
+ <?php $wp_optimize->wp_optimize_url('https://wordpress.org/plugins/updraftplus/', __('UpdraftPlus', 'wp-optimize'));?> is the most trusted and installed backup plugin because it does all of this and more reliably, for free. There is also a premium version which can do <?php $wp_optimize->wp_optimize_url('https://updraftplus.com/', __('a lot more', 'wp-optimize'));?>.
44
+ </p>
45
  </div>
46
  </div>
47
  </div>
templates/notices/horizontal-notice.php CHANGED
@@ -25,26 +25,23 @@
25
 
26
  if (isset($discount_code)) echo ' <b>' . $discount_code . '</b>';
27
 
28
- // if (isset($text2)) {
29
- // echo '</p><p>' . $text2 . '</p><p>';
30
- // }
31
-
32
  if (!empty($button_link) && !empty($button_meta)) {
33
- ?>
34
- <a class="updraft_notice_link" href="<?php esc_attr_e($button_link);?>"><?php
35
  if ($button_meta == 'updraftcentral') {
36
- _e('Get UpdraftCentral', 'wp-optimize');
37
  } elseif ($button_meta == 'review') {
38
- _e('Review WP-Optimize', 'wp-optimize');
39
  } elseif ($button_meta == 'updraftplus') {
40
- _e('Get UpdraftPlus', 'wp-optimize');
41
  } elseif ($button_meta == 'signup') {
42
- _e('Sign up', 'wp-optimize');
43
  } elseif ($button_meta == 'go_there') {
44
- _e('Go there', 'wp-optimize');
45
  }
46
- ?></a>
47
- <?php } ?>
 
48
  </p>
49
  </div>
50
  </div>
25
 
26
  if (isset($discount_code)) echo ' <b>' . $discount_code . '</b>';
27
 
 
 
 
 
28
  if (!empty($button_link) && !empty($button_meta)) {
29
+
30
+ //Check which Message is going to be used
31
  if ($button_meta == 'updraftcentral') {
32
+ $button_text = __('Get UpdraftCentral', 'wp-optimize');
33
  } elseif ($button_meta == 'review') {
34
+ $button_text = __('Review WP-Optimize', 'wp-optimize');
35
  } elseif ($button_meta == 'updraftplus') {
36
+ $button_text = __('Get UpdraftPlus', 'wp-optimize');
37
  } elseif ($button_meta == 'signup') {
38
+ $button_text = __('Sign up', 'wp-optimize');
39
  } elseif ($button_meta == 'go_there') {
40
+ $button_text = __('Go there', 'wp-optimize');
41
  }
42
+ $wp_optimize->wp_optimize_url($button_link, $button_text, null, 'class="updraft_notice_link"');
43
+ }
44
+ ?>
45
  </p>
46
  </div>
47
  </div>
templates/notices/thanks-for-using-main-dash.php CHANGED
@@ -8,37 +8,44 @@
8
 
9
  <a href="https://updraftplus.com/"><img style="border: 0px; float: right; height: 150px; width: 150px;" alt="WP-Optimize" src="<?php echo WPO_PLUGIN_URL.'/images/notices/wp_optimize_logo.png' ?>"></a>
10
 
 
 
 
 
 
 
 
 
11
  <?php
12
-
13
- echo '<p><strong>'.__('Keep in touch!', 'wp-optimize').'</strong> <br><a href="https://updraftplus.com/news/">'.__('Blog', 'wp-optimize').'</a> | <a href="https://updraftplus.com/newsletter-signup">'.__('Newsletter', 'wp-optimize').'</a> | <a href="https://twitter.com/updraftplus">'.__('Twitter', 'wp-optimize').'</a></p>';
14
-
15
  /*
16
  Here we see if they have any backup plugins installed and display one of the following lines
17
  */
18
-
19
  $backup_plugin_installed = $wp_optimize_notices->is_backup_plugin_installed();
20
 
21
  if (!$backup_plugin_installed || 'UpdraftPlus' != $backup_plugin_installed) {
22
- echo '<p><strong>'.__('UpdraftPlus - the #1 most-trusted WordPress backup/restore plugin', 'wp-optimize').'</strong><br>'.__("The team behind WP-Optimize also create WordPress's most trusted backup/restore plugin", 'wp-optimize').': <a href="https://updraftplus.com">'.__('UpdraftPlus', 'wp-optimize').'</a>. ';
23
 
24
 
25
  if (!$backup_plugin_installed) {
26
- echo __('Hackers, user error and dodgy updates can all ruin your site.', 'wp-optimize').' '.sprintf(__('We recommend that you install %s, which can automatically backup to remote cloud storage like Dropbox so your backup is independent and safe.', 'wp-optimize'), '<a href="https://updraftplus.com">UpdraftPlus</a>').' '.__('You can also restore a site with a couple of clicks.', 'wp-optimize').'</p>';
27
  } else {
28
- echo sprintf(__('Many users of %s have switched to UpdraftPlus WordPress Backup.', 'wp-optimize'), $backup_plugin_installed).' '.__('If you want to see the benefits of doing so too, then take a look at this:').' <a href="https://updraftplus.com/wordpress-backup-plugin-comparison/">'.__('backup plugin comparison table', 'wp-optimize').'.</a>';
29
  }
30
 
31
  echo '</p>';
32
 
33
  }
34
 
35
- echo '<p><strong>'.__('Do you manage multiple WordPress sites?', 'wp-optimize').'</strong> <br>'.sprintf(__('If so, take a look at %s, our remote site management solution','wp-optimize'), '<a href="https://updraftcentral.com">UpdraftCentral</a>').' '.__('Login securely, backup and update all your sites from one place.','wp-optimize').' '.__('Available as a self-install plugin, or hosted for you from updraftplus.com', 'wp-optimize').'</p>';
36
-
37
- echo '<p><strong>'.__('More quality plugins', 'wp-optimize').'</strong> <br><a href="https://www.simbahosting.co.uk/s3/shop/">'.__('Premium WooCommerce plugins', 'updraftplus').'</a> | <a href="https://wordpress.org/plugins/two-factor-authentication/">'.__('Free two-factor security plugin', 'updraftplus').'</a></p>';
38
 
39
  ?>
40
 
41
- <div style="float:right;"><a href="#" onclick="jQuery('#wp-optimize-dashnotice').slideUp(); jQuery.post(ajaxurl, {action: 'wp_optimize_ajax', subaction: 'dismiss_dash_notice_until', nonce: '<?php echo wp_create_nonce('wp-optimize-ajax-nonce');?>' });"><?php printf(__('Dismiss (for %s months)', 'wp-optimize'), 12); ?></a></div>
 
 
 
 
 
42
 
43
  <p>&nbsp;</p>
44
 
8
 
9
  <a href="https://updraftplus.com/"><img style="border: 0px; float: right; height: 150px; width: 150px;" alt="WP-Optimize" src="<?php echo WPO_PLUGIN_URL.'/images/notices/wp_optimize_logo.png' ?>"></a>
10
 
11
+ <p>
12
+ <strong><?php _e('Keep in touch!', 'wp-optimize')?></strong>
13
+ <br>
14
+ <?php $wp_optimize->wp_optimize_url('https://updraftplus.com/news/', __('Blog', 'wp-optimize')); ?> |
15
+ <?php $wp_optimize->wp_optimize_url('https://updraftplus.com/newsletter-signup', __('Newsletter', 'wp-optimize')); ?> |
16
+ <?php $wp_optimize->wp_optimize_url('https://twitter.com/updraftplus', __('Twitter', 'wp-optimize')); ?>
17
+ </p>
18
+
19
  <?php
 
 
 
20
  /*
21
  Here we see if they have any backup plugins installed and display one of the following lines
22
  */
 
23
  $backup_plugin_installed = $wp_optimize_notices->is_backup_plugin_installed();
24
 
25
  if (!$backup_plugin_installed || 'UpdraftPlus' != $backup_plugin_installed) {
26
+ echo '<p><strong>'.__('UpdraftPlus - the #1 most-trusted WordPress backup/restore plugin', 'wp-optimize').'</strong><br>'.__("The team behind WP-Optimize also create WordPress's most trusted backup/restore plugin", 'wp-optimize').': '.$wp_optimize->wp_optimize_url('https://updraftplus.com', __('UpdraftPlus', 'wp-optimize'));
27
 
28
 
29
  if (!$backup_plugin_installed) {
30
+ echo __('Hackers, user error and dodgy updates can all ruin your site.', 'wp-optimize').' '.sprintf(__('We recommend that you install %s, which can automatically backup to remote cloud storage like Dropbox so your backup is independent and safe.', 'wp-optimize'), $wp_optimize->wp_optimize_url('https://updraftplus.com', __('UpdraftPlus', 'wp-optimize'))).' '.__('You can also restore a site with a couple of clicks.', 'wp-optimize').'</p>';
31
  } else {
32
+ echo sprintf(__('Many users of %s have switched to UpdraftPlus WordPress Backup.', 'wp-optimize'), $backup_plugin_installed).' '.__('If you want to see the benefits of doing so too, then take a look at this:'). $wp_optimize->wp_optimize_url('https://updraftplus.com/wordpress-backup-plugin-comparison/', __('backup plugin comparison table', 'wp-optimize'));
33
  }
34
 
35
  echo '</p>';
36
 
37
  }
38
 
39
+ echo '<p><strong>'.__('Do you manage multiple WordPress sites?', 'wp-optimize').'</strong> <br>'.sprintf(__('If so, take a look at %s, our remote site management solution. ','wp-optimize'), '<a href="https://updraftcentral.com">UpdraftCentral</a>').' '.__('Login securely, backup and update all your sites from one place.','wp-optimize').' '.__('Available as a self-install plugin, or hosted for you from updraftplus.com', 'wp-optimize').'</p>';
 
 
40
 
41
  ?>
42
 
43
+ <p>
44
+ <strong><?php _e('More quality plugins', 'wp-optimize'); ?></strong>
45
+ <br>
46
+ <?php $wp_optimize->wp_optimize_url('https://www.simbahosting.co.uk/s3/shop/', __('Premium WooCommerce plugins', 'wp-optimize')); ?> |
47
+ <?php $wp_optimize->wp_optimize_url('https://wordpress.org/plugins/two-factor-authentication/', __('Free two-factor security plugin', 'wp-optimize')); ?>
48
+ </p>
49
 
50
  <p>&nbsp;</p>
51
 
templates/optimizations-table.php CHANGED
@@ -18,14 +18,28 @@
18
 
19
  // This is an array, with attributes dom_id, activated, settings_label, info; all values are strings
20
  $html = $optimization->get_settings_html();
21
-
22
- ?><tr class="wp-optimize-settings wp-optimize-settings-<?php echo $html['dom_id'];?>" data-optimization_id="<?php echo esc_attr($id);?>" data-optimization_run_sort_order="<?php echo $optimization->get_run_sort_order();?>"><?php
 
 
 
 
 
 
 
 
 
 
 
 
 
 
23
 
24
  if (!empty($html['settings_label'])) {
25
  ?>
26
 
27
  <td class="wp-optimize-settings-optimization-checkbox">
28
- <input name="<?php echo $html['dom_id'];?>" id="optimization_checkbox_<?php echo $id;?>" class="optimization_checkbox" type="checkbox" value="true" <?php if ($html['activated']) echo 'checked="checked"';?>>
29
 
30
  <img id="optimization_spinner_<?php echo $id;?>" class="optimization_spinner display-none" src="<?php echo esc_attr(admin_url('images/spinner.gif'));?>" alt="...">
31
  </td>
@@ -45,9 +59,9 @@
45
  ?></td>
46
 
47
  <td class="wp-optimize-settings-optimization-run">
48
- <button id="optimization_button_<?php echo $id;?>_big" class="button button-secondary wp-optimize-settings-optimization-run-button show_on_default_sizes optimization_button_<?php echo $id;?>" type="button"><?php _e('Run optimization', 'wp-optimize');?></button>
49
 
50
- <button id="optimization_button_<?php echo $id;?>_small" class="button button-secondary wp-optimize-settings-optimization-run-button show_on_mobile_sizes optimization_button_<?php echo $id;?>" type="button"><?php _e('Go', 'wp-optimize');?></button>
51
 
52
  </td>
53
 
18
 
19
  // This is an array, with attributes dom_id, activated, settings_label, info; all values are strings
20
  $html = $optimization->get_settings_html();
21
+
22
+ $optimize_table_list_disabled = '';
23
+
24
+ //check if the DOM is optimize-db to generate a list of tables
25
+ if ($html['dom_id'] == 'optimize-db') {
26
+ $table_list = $optimizer->get_table_information();
27
+
28
+ //make sure that optimization_table_inno_db is set
29
+ if ($table_list['inno_db_tables'] > 0 && $table_list['table_list'] == '') {
30
+ $optimize_table_list_disabled .= 'disabled';
31
+ $html['activated'] = '';
32
+ }
33
+
34
+ }
35
+ ?><tr class="wp-optimize-settings wp-optimize-settings-<?php echo $html['dom_id'];?>" id="wp-optimize-settings-<?php echo $html['dom_id'];?>" data-optimization_id="<?php echo esc_attr($id);?>" data-optimization_run_sort_order="<?php echo $optimization->get_run_sort_order();?>" >
36
+ <?php
37
 
38
  if (!empty($html['settings_label'])) {
39
  ?>
40
 
41
  <td class="wp-optimize-settings-optimization-checkbox">
42
+ <input name="<?php echo $html['dom_id'];?>" id="optimization_checkbox_<?php echo $id;?>" class="optimization_checkbox" type="checkbox" value="true" <?php if ($html['activated']) echo 'checked="checked"';?> <?php echo $optimize_table_list_disabled;?> >
43
 
44
  <img id="optimization_spinner_<?php echo $id;?>" class="optimization_spinner display-none" src="<?php echo esc_attr(admin_url('images/spinner.gif'));?>" alt="...">
45
  </td>
59
  ?></td>
60
 
61
  <td class="wp-optimize-settings-optimization-run">
62
+ <button id="optimization_button_<?php echo $id;?>_big" class="button button-secondary wp-optimize-settings-optimization-run-button show_on_default_sizes optimization_button_<?php echo $id;?>" type="button" <?php echo $optimize_table_list_disabled;?> ><?php _e('Run optimization', 'wp-optimize');?></button>
63
 
64
+ <button id="optimization_button_<?php echo $id;?>_small" class="button button-secondary wp-optimize-settings-optimization-run-button show_on_mobile_sizes optimization_button_<?php echo $id;?>" type="button" <?php echo $optimize_table_list_disabled;?> ><?php _e('Go', 'wp-optimize');?></button>
65
 
66
  </td>
67
 
templates/optimize-table.php CHANGED
@@ -1,6 +1,31 @@
1
- <?php if (!defined('WPO_VERSION')) die ('No direct access allowed'); ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2
  <div class="wpo_section wpo_group">
3
- <form onSubmit="return confirm('<?php echo esc_js('WARNING: This operation is permanent. Continue?', 'wp-optimize'); ?>')" action="#" method="post" enctype="multipart/form-data" name="optimize_form" id="optimize_form">
4
 
5
  <?php wp_nonce_field('wpo_optimization'); ?>
6
 
@@ -11,19 +36,41 @@
11
  <h3><?php _e('Optimizations', 'wp-optimize'); ?></h3>
12
 
13
  <p>
14
- <!-- <span style="text-align:center;"><a href="#" onClick="javascript:SetDefaults();">
15
- <?php _e('Select safe options', 'wp-optimize'); ?></a></span> -->
16
- <small><strong><?php _e('Warning:', 'wp-optimize'); ?></strong> <?php echo __('It is best practice to always make a backup of your database before any major operation (optimizing, upgrading, etc.).', 'wp-optimize').' <a href="https://wordpress.org/plugins/updraftplus">'.__('If you need a backup plugin, then we recommend UpdraftPlus.', 'wp-optimize').'</a>'; ?></small>
17
 
18
  </p>
19
  <p>
20
- <input class="wpo_primary_big button-primary" type="submit" id="wp-optimize" name="wp-optimize" value="<?php esc_attr_e('Run all selected optimizations now', 'wp-optimize'); ?>" />
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
21
  </p>
22
 
23
  <?php include('optimizations-table.php'); ?>
24
 
25
  <p>
26
- <?php echo '<span style="color: red;">'.__('Warning:', 'wp-optimize').'</span> '.__('Items marked in red, whilst still safe, perform more database delete operations.', 'wp-optimize').' '.__('You may wish to run a backup before performing them.', 'wp-optimize'); ?>
27
  </p>
28
 
29
  </div>
@@ -33,9 +80,7 @@
33
  <div id="wp_optimize_status_box" class="wpo_col wpo_span_1_of_3">
34
  <div class="postbox">
35
  <div class="inside">
36
-
37
  <?php include('status-box-contents.php'); ?>
38
-
39
  </div>
40
  </div>
41
  </div>
1
+ <?php
2
+
3
+ if (!defined('WPO_VERSION')) die ('No direct access allowed');
4
+
5
+ global $updraftplus_admin, $updraftplus;
6
+
7
+ //check if UpdraftPlus is active
8
+ $updraftplus_status = $this->is_installed('UpdraftPlus - Backup/Restore');
9
+
10
+ //If UpdraftPlus Admin exists along with Method and active, then call the update modal
11
+ if (is_a($updraftplus_admin, 'UpdraftPlus_Admin') && is_callable(array($updraftplus_admin, 'add_backup_scaffolding'))) {
12
+ $updraftplus_admin->add_backup_scaffolding(__('Backup before running optimizations', 'wp-optimize'), array($updraftplus_admin, 'backupnow_modal_contents'));
13
+
14
+ //check version
15
+ if (version_compare($updraftplus->version, '1.12.33', '<')) {
16
+ $disabled_backup = 'disabled';
17
+ $updraftplus_version_check = true;
18
+ } else {
19
+ $disabled_backup = '';
20
+ $updraftplus_version_check = false;
21
+ }
22
+ } else {
23
+ //disabled UpdraftPlus
24
+ $disabled_backup = 'disabled';
25
+ }
26
+ ?>
27
  <div class="wpo_section wpo_group">
28
+ <form onsubmit="return confirm('<?php echo esc_js(__('Warning: This operation is permanent. Continue?', 'wp-optimize')); ?>')" action="#" method="post" enctype="multipart/form-data" name="optimize_form" id="optimize_form">
29
 
30
  <?php wp_nonce_field('wpo_optimization'); ?>
31
 
36
  <h3><?php _e('Optimizations', 'wp-optimize'); ?></h3>
37
 
38
  <p>
39
+ <small><strong><?php _e('Warning:', 'wp-optimize'); ?></strong>
40
+ <?php _e('It is best practice to always make a backup of your database before any major operation (optimizing, upgrading, etc.).', 'wp-optimize'); ?>
41
+ </small>
42
 
43
  </p>
44
  <p>
45
+ <input class="wpo_primary_big button-primary" type="submit" id="wp-optimize" name="wp-optimize" value="<?php esc_attr_e('Run all selected optimizations', 'wp-optimize'); ?>" />
46
+ </p>
47
+ <p>
48
+ <input name="enable-auto-backup" id="enable-auto-backup" type="checkbox" value ="true" <?php echo ($options->get_option('enable-auto-backup', 'false') == 'true') ? 'checked="checked"':''; ?> <?php echo $disabled_backup;?> />
49
+ <label for="enable-auto-backup"> <?php _e('Take a backup with UpdraftPlus before optimizing', 'wp-optimize'); ?> </label>
50
+
51
+ <br>
52
+
53
+ <?php
54
+ //UpdraftPlus is not installed
55
+ if ($disabled_backup == 'disabled' && !$updraftplus_status['installed']) {
56
+ echo '<a href="'.wp_nonce_url(self_admin_url('update.php?action=install-plugin&plugin=updraftplus'), 'install-plugin_updraftplus').'"> '.__('Follow this link to install UpdraftPlus, to take a backup before optimization', 'wp-optimize').' </a>';
57
+ } else {
58
+ //check updraftplus version first
59
+ if (!empty($updraftplus_version_check)) {
60
+ echo '<small>'.__('UpdraftPlus needs to be updated to 1.12.33 or higher in order to backup the database before optimization.', 'wp-optimize').' <a href="'.admin_url('update-core.php').'">'.__('Please update UpdraftPlus to the latest version.', 'wp-optimize').'</a></small>';
61
+ } else {
62
+ if($updraftplus_status['installed'] && !$updraftplus_status['active']){
63
+ echo '<small>'.__('UpdraftPlus is installed but currently not active. Please activate UpdraftPlus to backup the database before optimization.').'</small>';
64
+ }
65
+ }
66
+ }
67
+ ?>
68
  </p>
69
 
70
  <?php include('optimizations-table.php'); ?>
71
 
72
  <p>
73
+ <?php echo '<span style="color: #9B0000;">'.__('Warning:', 'wp-optimize').'</span> '.__('Items marked in red perform more intensive database operations. In very rare cases, if your database server happened to crash or be forcibly powered down at the same time as an optimization operation was running, data might be corrupted. ', 'wp-optimize').' '.__('You may wish to run a backup before optimizing.', 'wp-optimize'); ?>
74
  </p>
75
 
76
  </div>
80
  <div id="wp_optimize_status_box" class="wpo_col wpo_span_1_of_3">
81
  <div class="postbox">
82
  <div class="inside">
 
83
  <?php include('status-box-contents.php'); ?>
 
84
  </div>
85
  </div>
86
  </div>
templates/status-box-contents.php CHANGED
@@ -21,7 +21,7 @@ echo '<p>';
21
  $lastopt = $options->get_option('last-optimized', 'Never');
22
  if ($lastopt !== 'Never') {
23
  echo __('Last automatic optimization was at', 'wp-optimize').': ';
24
- echo '<span style="font-color: green; font-weight:bold;">';
25
  echo htmlspecialchars($lastopt);
26
  echo '</span>';
27
  } else {
@@ -32,7 +32,7 @@ if ($lastopt !== 'Never') {
32
 
33
  <?php
34
  if ($options->get_option('schedule', 'false') == 'true') {
35
- echo '<strong><span style="font-color: green">';
36
  _e('Scheduled cleaning enabled', 'wp-optimize');
37
  echo ', </span></strong>';
38
  if (wp_next_scheduled('wpo_cron_event2')) {
@@ -43,7 +43,7 @@ if ($options->get_option('schedule', 'false') == 'true') {
43
  $date = new DateTime("@$timestamp");
44
  _e('Next schedule:', 'wp-optimize');
45
  echo ' ';
46
- echo '<span style="font-color: green">';
47
  echo gmdate(get_option('date_format') . ' ' . get_option('time_format'), $timestamp );
48
  echo '</span>';
49
  echo ' - <a id="wp_optimize_status_box_refresh" href="'.esc_attr($admin_page_url).'">'.__('Refresh', 'wp-optimize').'</a>';
@@ -57,7 +57,7 @@ if ($options->get_option('schedule', 'false') == 'true') {
57
  echo '<br>';
58
 
59
  if ($retention_enabled == 'true') {
60
- echo '<strong><span style="font-color: blue;">';
61
  printf(__('Keeping last %s weeks data', 'wp-optimize'), $retention_period) ;
62
  echo '</span></strong>';
63
  } else {
@@ -76,11 +76,11 @@ if ($retention_enabled == 'true') {
76
 
77
  if ($optimize_db) {
78
  _e('You have saved:', 'wp-optimize');
79
- echo ' <span style="font-color: blue;">'.$total_gain.'</span>';
80
  } else {
81
  if ($total_gain > 0) {
82
  _e('You can save around:', 'wp-optimize');
83
- echo ' <span style="font-color: red;">'.$total_gain.'</span> ';
84
  }
85
  }
86
  ?>
@@ -93,7 +93,7 @@ if ($retention_enabled == 'true') {
93
 
94
  if ($total_cleaned_num > 0) {
95
  echo '<h5>'.__('Total clean up overall:','wp-optimize').' ';
96
- echo '<span style="font-color: green">';
97
  echo $wp_optimize->format_size($total_cleaned);
98
  echo '</span></h5>';
99
  }
21
  $lastopt = $options->get_option('last-optimized', 'Never');
22
  if ($lastopt !== 'Never') {
23
  echo __('Last automatic optimization was at', 'wp-optimize').': ';
24
+ echo '<span style="font-color: #004600; font-weight:bold;">';
25
  echo htmlspecialchars($lastopt);
26
  echo '</span>';
27
  } else {
32
 
33
  <?php
34
  if ($options->get_option('schedule', 'false') == 'true') {
35
+ echo '<strong><span style="font-color: #004600">';
36
  _e('Scheduled cleaning enabled', 'wp-optimize');
37
  echo ', </span></strong>';
38
  if (wp_next_scheduled('wpo_cron_event2')) {
43
  $date = new DateTime("@$timestamp");
44
  _e('Next schedule:', 'wp-optimize');
45
  echo ' ';
46
+ echo '<span style="font-color: #004600">';
47
  echo gmdate(get_option('date_format') . ' ' . get_option('time_format'), $timestamp );
48
  echo '</span>';
49
  echo ' - <a id="wp_optimize_status_box_refresh" href="'.esc_attr($admin_page_url).'">'.__('Refresh', 'wp-optimize').'</a>';
57
  echo '<br>';
58
 
59
  if ($retention_enabled == 'true') {
60
+ echo '<strong><span style="font-color: #0000FF;">';
61
  printf(__('Keeping last %s weeks data', 'wp-optimize'), $retention_period) ;
62
  echo '</span></strong>';
63
  } else {
76
 
77
  if ($optimize_db) {
78
  _e('You have saved:', 'wp-optimize');
79
+ echo ' <span style="font-color: #0000FF;">'.$total_gain.'</span>';
80
  } else {
81
  if ($total_gain > 0) {
82
  _e('You can save around:', 'wp-optimize');
83
+ echo ' <span style="font-color: #9B0000;">'.$total_gain.'</span> ';
84
  }
85
  }
86
  ?>
93
 
94
  if ($total_cleaned_num > 0) {
95
  echo '<h5>'.__('Total clean up overall:','wp-optimize').' ';
96
+ echo '<span style="font-color: #004600">';
97
  echo $wp_optimize->format_size($total_cleaned);
98
  echo '</span></h5>';
99
  }
templates/tables-body.php CHANGED
@@ -14,6 +14,8 @@
14
  $data_usage = 0;
15
  $index_usage = 0;
16
  $overhead_usage = 0;
 
 
17
 
18
  $tablesstatus = $optimizer->get_tables();
19
 
@@ -28,34 +30,33 @@
28
  echo '<td>'.number_format_i18n($tablestatus->Rows).'</td>'."\n";
29
  echo '<td>'.$wp_optimize->format_size($tablestatus->Data_length).'</td>'."\n";
30
  echo '<td>'.$wp_optimize->format_size($tablestatus->Index_length).'</td>'."\n";;
31
- echo '<td>'.htmlspecialchars($tablestatus->Engine).'</td>'."\n";;
32
- //echo '<td>'.$wp_optimize->format_size($tablestatus->Data_free).'</td>'."\n";
33
 
34
  if ($tablestatus->Engine != 'InnoDB') {
 
35
 
36
  echo '<td>';
37
-
38
- $font_colour = $optimize_db ? (($tablestatus->Data_free>0) ? 'blue' : 'green') : (($tablestatus->Data_free>0) ? 'red' : 'green');
39
-
40
  echo '<span style="color:'.$font_colour.';">';
41
  echo $wp_optimize->format_size($tablestatus->Data_free);
42
  echo '</span>';
43
-
44
  echo '</td>'."\n";
 
 
 
 
45
  } else {
 
46
  echo '<td>';
47
- echo '<span style="color:blue;">-</span>';
48
  echo '</td>'."\n";
 
 
49
  }
50
 
51
  $row_usage += $tablestatus->Rows;
52
  $data_usage += $tablestatus->Data_length;
53
  $index_usage += $tablestatus->Index_length;
54
 
55
- if ($tablestatus->Engine != 'InnoDB') {
56
- $overhead_usage += $tablestatus->Data_free;
57
- $total_gain += $tablestatus->Data_free;
58
- }
59
  echo '</tr>'."\n";
60
  }
61
 
@@ -68,7 +69,7 @@
68
  echo '<th>'.'-'.'</th>'."\n";
69
  echo '<th>';
70
 
71
- $font_colour = $optimize_db ? (($overhead_usage>0) ? 'blue' : 'green') : (($overhead_usage>0) ? 'red' : 'green');
72
 
73
  echo '<span style="color:'.$font_colour.'">'.$wp_optimize->format_size($overhead_usage).'</span>';
74
 
14
  $data_usage = 0;
15
  $index_usage = 0;
16
  $overhead_usage = 0;
17
+ $non_inno_db_tables = 0;
18
+ $inno_db_tables = 0;
19
 
20
  $tablesstatus = $optimizer->get_tables();
21
 
30
  echo '<td>'.number_format_i18n($tablestatus->Rows).'</td>'."\n";
31
  echo '<td>'.$wp_optimize->format_size($tablestatus->Data_length).'</td>'."\n";
32
  echo '<td>'.$wp_optimize->format_size($tablestatus->Index_length).'</td>'."\n";;
 
 
33
 
34
  if ($tablestatus->Engine != 'InnoDB') {
35
+ echo '<td data-optimizable="1">'.htmlspecialchars($tablestatus->Engine).'</td>'."\n";
36
 
37
  echo '<td>';
38
+ $font_colour = $optimize_db ? (($tablestatus->Data_free>0) ? '#0000FF' : '#004600') : (($tablestatus->Data_free>0) ? '#9B0000' : '#004600');
 
 
39
  echo '<span style="color:'.$font_colour.';">';
40
  echo $wp_optimize->format_size($tablestatus->Data_free);
41
  echo '</span>';
 
42
  echo '</td>'."\n";
43
+
44
+ $overhead_usage += $tablestatus->Data_free;
45
+ $total_gain += $tablestatus->Data_free;
46
+ $non_inno_db_tables++;
47
  } else {
48
+ echo '<td data-optimizable="0">'.htmlspecialchars($tablestatus->Engine).'</td>'."\n";
49
  echo '<td>';
50
+ echo '<span style="color:#0000FF;">-</span>';
51
  echo '</td>'."\n";
52
+
53
+ $inno_db_tables++;
54
  }
55
 
56
  $row_usage += $tablestatus->Rows;
57
  $data_usage += $tablestatus->Data_length;
58
  $index_usage += $tablestatus->Index_length;
59
 
 
 
 
 
60
  echo '</tr>'."\n";
61
  }
62
 
69
  echo '<th>'.'-'.'</th>'."\n";
70
  echo '<th>';
71
 
72
+ $font_colour = $optimize_db ? (($overhead_usage>0) ? '#0000FF' : '#004600') : (($overhead_usage>0) ? '#9B0000' : '#004600');
73
 
74
  echo '<span style="color:'.$font_colour.'">'.$wp_optimize->format_size($overhead_usage).'</span>';
75
 
templates/tables.php CHANGED
@@ -35,25 +35,31 @@
35
  ?>
36
 
37
  <h3><?php _e('Optimization results:', 'wp-optimize'); ?></h3>
38
- <p style="color: #0000ff;"><?php
39
 
40
  if ($total_gain > 0) {
41
- echo __('Total space saved:', 'wp-optimize').$wp_optimize->format_size($total_gain);
42
  $optimizer->update_total_cleaned(strval($total_gain));
43
  }
44
-
45
- echo '</p>';
46
-
47
  } else { ?>
48
 
49
  <?php if ($total_gain != 0) { ?>
50
 
51
  <h3><?php if ($total_gain > 0) _e('Optimization Possibility:', 'wp-optimize'); ?></h3>
52
- <p style="color: #ff0000;">
53
  <?php if ($total_gain > 0) {
54
- echo __('Total space that can be saved:', 'wp-optimize').' '.$wp_optimize->format_size($total_gain).' ';
55
  }
56
- echo '</p>';
57
-
 
58
  }
59
  }
 
 
 
 
 
 
 
 
35
  ?>
36
 
37
  <h3><?php _e('Optimization results:', 'wp-optimize'); ?></h3>
38
+ <p style="color: #0000ff;" id="optimization_table_total_gain"><?php
39
 
40
  if ($total_gain > 0) {
41
+ echo __('Total space saved:', 'wp-optimize').' <span>'.$wp_optimize->format_size($total_gain).'</span> ';
42
  $optimizer->update_total_cleaned(strval($total_gain));
43
  }
 
 
 
44
  } else { ?>
45
 
46
  <?php if ($total_gain != 0) { ?>
47
 
48
  <h3><?php if ($total_gain > 0) _e('Optimization Possibility:', 'wp-optimize'); ?></h3>
49
+ <p style="color: #ff0000;" id="optimization_table_total_gain">
50
  <?php if ($total_gain > 0) {
51
+ echo __('Total space that can be saved:', 'wp-optimize').' <span>'.$wp_optimize->format_size($total_gain).'</span> ';
52
  }
53
+ } else {
54
+ ?> <p id="optimization_table_total_gain"> <?php
55
+ echo __('Total space:', 'wp-optimize').' <span>'.$wp_optimize->format_size($total_gain).'</span> ';
56
  }
57
  }
58
+ echo '<br>';
59
+
60
+ ?> <span id="optimization_table_inno_db"><?php
61
+ echo __('Total InnoDB tables:', 'wp-optimize').' <span>'.$inno_db_tables.'</span> ';
62
+ ?> </span><br>
63
+ <span id="optimization_table_non_inno_db"> <?php
64
+ echo __('Total non-InnoDB tables:', 'wp-optimize').' <span>'.$non_inno_db_tables.'</span> ';
65
+ ?> </span></p>
wp-optimize.php CHANGED
@@ -3,7 +3,7 @@
3
  Plugin Name: WP-Optimize
4
  Plugin URI: http://updraftplus.com
5
  Description: WP-Optimize is WordPress's #1 most installed optimization plugin. With it, you can clean up your database easily and safely, without manual queries.
6
- Version: 2.1.0
7
  Author: David Anderson, Ruhani Rabin, Team Updraft
8
  Author URI: https://updraftplus.com
9
  Text Domain: wp-optimize
@@ -13,7 +13,10 @@ License: GPLv2 or later
13
 
14
  if (!defined('ABSPATH')) die('No direct access allowed');
15
 
16
- define('WPO_VERSION', '2.1.0');
 
 
 
17
  define('WPO_PLUGIN_URL', plugin_dir_url( __FILE__ ));
18
  define('WPO_PLUGIN_MAIN_PATH', plugin_dir_path( __FILE__ ));
19
 
@@ -25,23 +28,28 @@ class WP_Optimize {
25
  protected static $_optimizer_instance = null;
26
  protected static $_options_instance = null;
27
  protected static $_notices_instance = null;
 
28
 
29
  public function __construct() {
30
 
 
 
 
31
  register_activation_hook(__FILE__, 'wpo_activation_actions');
32
  register_deactivation_hook(__FILE__, 'wpo_deactivation_actions');
33
 
34
- add_action('plugins_loaded', array($this, 'plugins_loaded'));
35
-
36
- $plugin = plugin_basename(__FILE__);
37
- add_filter("plugin_action_links_$plugin", array($this, 'plugin_settings_link'));
38
  add_action('admin_init', array($this, 'admin_init'));
39
  add_action('admin_menu', array($this, 'admin_menu'));
 
 
40
  add_action('wpo_cron_event2', array($this, 'cron_action'));
41
  add_filter('cron_schedules', array($this, 'cron_schedules'));
42
 
43
  add_action('wp_ajax_wp_optimize_ajax', array($this, 'wp_optimize_ajax_handler'));
44
-
 
 
 
45
  include_once(WPO_PLUGIN_MAIN_PATH.'/includes/updraftcentral.php');
46
 
47
  }
@@ -76,7 +84,106 @@ class WP_Optimize {
76
  }
77
  return self::$_notices_instance;
78
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
79
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
80
  public function admin_init() {
81
 
82
  global $pagenow;
@@ -102,10 +209,6 @@ class WP_Optimize {
102
  public function show_admin_notice_upgradead() {
103
  $this->include_template('notices/thanks-for-using-main-dash.php');
104
  }
105
-
106
- public function plugins_loaded() {
107
- load_plugin_textdomain('wp-optimize', false, dirname( plugin_basename( __FILE__ ) ) . '/languages' );
108
- }
109
 
110
  public function capability_required() {
111
  return apply_filters('wp_optimize_capability_required', 'manage_options');
@@ -122,6 +225,7 @@ class WP_Optimize {
122
 
123
  if (!current_user_can($this->capability_required())) die('Security check');
124
 
 
125
  $optimizer = $this->get_optimizer();
126
  $options = $this->get_options();
127
 
@@ -139,7 +243,6 @@ class WP_Optimize {
139
  } else {
140
 
141
  // Other commands, available for any remote method
142
-
143
  if (!class_exists('WP_Optimize_Commands')) require_once(WPO_PLUGIN_MAIN_PATH.'includes/class-commands.php');
144
 
145
  $commands = new WP_Optimize_Commands();
@@ -195,6 +298,11 @@ class WP_Optimize {
195
 
196
  wp_enqueue_style('wp-optimize-admin-css', WPO_PLUGIN_URL.'css/admin'.$min_or_not.'.css', array(), $enqueue_version);
197
 
 
 
 
 
 
198
  $options = $this->get_options();
199
 
200
  $tabs = $this->get_tabs();
@@ -324,7 +432,6 @@ class WP_Optimize {
324
  return $links;
325
  }
326
 
327
- // TODO: Need to find out why the schedule time is not refreshing
328
  public function cron_activate() {
329
  $gmtoffset = (int) (3600 * ((double) get_option('gmt_offset')));
330
 
@@ -367,7 +474,7 @@ class WP_Optimize {
367
  }
368
 
369
 
370
- // scheduler public functions to update schedulers
371
  public function cron_schedules( $schedules ) {
372
  $schedules['wpo_daily'] = array('interval' => 86400, 'display' => 'Once Daily');
373
  $schedules['wpo_weekly'] = array('interval' => 86400*7, 'display' => 'Once Weekly');
@@ -457,7 +564,7 @@ class WP_Optimize {
457
 
458
  if ($return_instead_of_echo) return ob_get_clean();
459
  }
460
-
461
  private function register_template_directories() {
462
 
463
  $template_directories = array();
@@ -474,13 +581,13 @@ class WP_Optimize {
474
  closedir($dh);
475
  }
476
 
477
- // This is the optimal hook for most extensions to hook into
478
  $this->template_directories = apply_filters('wp_optimize_template_directories', $template_directories);
479
 
480
  }
481
 
482
- // TODO: Not currently used; investigate.
483
- // TODO: The description does not match the actual function
484
  /**
485
  * send_email($sendto, $msg)
486
  * @return success
@@ -490,7 +597,7 @@ class WP_Optimize {
490
  public function send_email($date, $cleanedup){
491
  //
492
  ob_start();
493
- // #TODO this need to work on - currently not using the parameter values
494
  $myTime = current_time( "timestamp", 0 );
495
  $myDate = gmdate(get_option('date_format') . ' ' . get_option('time_format'), $myTime );
496
 
@@ -498,9 +605,9 @@ class WP_Optimize {
498
 
499
  $sendto = $options->get_option('email-address');
500
  if (!$sendto) $sendto = get_bloginfo ( 'admin_email' );
501
-
502
  //$thiscleanup = $wp_optimize->format_size($cleanedup);
503
-
504
  $subject = get_bloginfo ( 'name' ).": ".__("Automatic Operation Completed","wp-optimize")." ".$myDate;
505
 
506
  $msg = __("Scheduled optimization was executed at","wp-optimize")." ".$myDate."\r\n"."\r\n";
@@ -514,7 +621,7 @@ class WP_Optimize {
514
 
515
  ob_end_flush();
516
  }
517
-
518
  /*
519
  * function log()
520
  *
@@ -522,10 +629,8 @@ class WP_Optimize {
522
  *
523
  * @return none
524
  */
525
- public function log($message) {
526
- if (defined('WP_DEBUG') && WP_DEBUG) {
527
- error_log($message);
528
- }
529
  }
530
 
531
  /**
@@ -568,20 +673,106 @@ class WP_Optimize {
568
 
569
  $optimizations = $optimizer->get_optimizations();
570
 
571
- // TODO: The output of the optimizations is not saved/used/logged
572
  $results = $optimizer->do_optimizations($this_options, 'auto');
573
 
574
  }
575
 
576
  }
577
-
578
- }
579
 
580
- function WP_Optimize() {
581
- return WP_Optimize::instance();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
582
  }
583
 
584
- $GLOBALS['wp_optimize'] = WP_Optimize();
585
 
586
  // plugin activation actions
587
  function wpo_activation_actions() {
@@ -598,3 +789,11 @@ function wpo_cron_deactivate() {
598
  WP_Optimize()->log('running wpo_cron_deactivate()');
599
  wp_clear_scheduled_hook('wpo_cron_event2');
600
  }
 
 
 
 
 
 
 
 
3
  Plugin Name: WP-Optimize
4
  Plugin URI: http://updraftplus.com
5
  Description: WP-Optimize is WordPress's #1 most installed optimization plugin. With it, you can clean up your database easily and safely, without manual queries.
6
+ Version: 2.1.1
7
  Author: David Anderson, Ruhani Rabin, Team Updraft
8
  Author URI: https://updraftplus.com
9
  Text Domain: wp-optimize
13
 
14
  if (!defined('ABSPATH')) die('No direct access allowed');
15
 
16
+ // Check to make sure if WP_Optimize is already call and returns
17
+ if (!class_exists('WP_Optimize')):
18
+
19
+ define('WPO_VERSION', '2.1.1');
20
  define('WPO_PLUGIN_URL', plugin_dir_url( __FILE__ ));
21
  define('WPO_PLUGIN_MAIN_PATH', plugin_dir_path( __FILE__ ));
22
 
28
  protected static $_optimizer_instance = null;
29
  protected static $_options_instance = null;
30
  protected static $_notices_instance = null;
31
+ protected static $_logger_instance = null;
32
 
33
  public function __construct() {
34
 
35
+ //Checks if premium is installed along with plugins needed.
36
+ add_action('plugins_loaded', array($this, 'plugins_loaded'), 1);
37
+
38
  register_activation_hook(__FILE__, 'wpo_activation_actions');
39
  register_deactivation_hook(__FILE__, 'wpo_deactivation_actions');
40
 
 
 
 
 
41
  add_action('admin_init', array($this, 'admin_init'));
42
  add_action('admin_menu', array($this, 'admin_menu'));
43
+
44
+ add_filter("plugin_action_links_".plugin_basename(__FILE__), array($this, 'plugin_settings_link'));
45
  add_action('wpo_cron_event2', array($this, 'cron_action'));
46
  add_filter('cron_schedules', array($this, 'cron_schedules'));
47
 
48
  add_action('wp_ajax_wp_optimize_ajax', array($this, 'wp_optimize_ajax_handler'));
49
+
50
+ // initialize loggers
51
+ add_action('plugins_loaded', array($this, 'setup_loggers'));
52
+
53
  include_once(WPO_PLUGIN_MAIN_PATH.'/includes/updraftcentral.php');
54
 
55
  }
84
  }
85
  return self::$_notices_instance;
86
  }
87
+
88
+ /**
89
+ * Return instance of Updraft_Logger
90
+ * @return null|Updraft_Logger
91
+ */
92
+ public static function get_logger() {
93
+ if (empty(self::$_logger_instance)) {
94
+ require_once(WPO_PLUGIN_MAIN_PATH.'/includes/class-updraft-logger.php');
95
+ self::$_logger_instance = new Updraft_Logger();
96
+ }
97
+ return self::$_logger_instance;
98
+ }
99
+
100
+ /**
101
+ * Checks if it is the premium version and loads it. It also ensures if there are any free versions installed
102
+ * to disable them and show an appriprite error if trying to enable
103
+ */
104
+ public function plugins_loaded() {
105
+ // Check if premium file exists
106
+ if (file_exists(WPO_PLUGIN_MAIN_PATH.'/premium.php')) {
107
+ // Check if class already loaded
108
+ if (!class_exists('WP_Optimize_Premium')) {
109
+ // Require WP-Optimize premium file
110
+ require_once(WPO_PLUGIN_MAIN_PATH.'/premium.php');
111
+ }
112
+ }
113
+
114
+ //Check if premium is installed
115
+ $check_premium = $this->is_installed('WP-Optimize Premium');
116
+ // If premium installed, deactivate free version
117
+ if ($check_premium['installed']) {
118
+ //Get activation details on base / free install
119
+ $get_base_install = $this->is_installed('WP-Optimize');
120
+ //Only deactivate if it is active
121
+ if ($get_base_install['active']) {
122
+ //only remove if premium isnt active
123
+ if (!$check_premium['active']) {
124
+ //Removes the admin menu items on the left WP bar
125
+ remove_action('admin_menu', array($this, 'admin_menu'));
126
+ //Removes options displayed on the plugins menu
127
+ remove_filter("plugin_action_links_".plugin_basename($get_base_install['name']), array($this, 'plugin_settings_link'));
128
+ }
129
+ //Deactivates base / free version
130
+ deactivate_plugins(plugin_basename($get_base_install['name']));
131
+ //Returns the notice letting the user know it cannot be active if premium is installed
132
+ return add_action('admin_notices', array($this, 'show_admin_notice_premium'));
133
+ }
134
+ }
135
+ //Loads the langues file
136
+ load_plugin_textdomain('wp-optimize', false, dirname( plugin_basename( __FILE__ ) ) . '/languages' );
137
+ }
138
 
139
+ /**
140
+ * This function will allow a check to be done if a specific
141
+ * plugin is installed.
142
+ * @param String $name Specify "Plugin Name" to retuns details about it
143
+ * @return Array Returns an array of details such as if installed, the name of the plugin and if it is active
144
+ */
145
+ public function is_installed($name) {
146
+ // Includes the WP Plugin file
147
+ require_once( ABSPATH . 'wp-admin/includes/plugin.php' );
148
+
149
+ //Gets all plugins available
150
+ $get_plugins = get_plugins();
151
+
152
+ //Gets all active plugins
153
+ $active_plugins = get_option('active_plugins');
154
+
155
+ $is_installed['installed'] = false;
156
+ $is_installed['active'] = false;
157
+
158
+ //loops around each plugin available
159
+ foreach ($get_plugins as $key => $value) {
160
+ //if the plugin name matches that of the specified name, it will gather details
161
+ if ($value['Name'] == $name) {
162
+ $is_installed['installed'] = true;
163
+ $is_installed['name'] = $key;
164
+ $is_installed['version'] = $value['Version'];
165
+ //Check if the plugin is active
166
+ if (in_array($key, $active_plugins)) {
167
+ $is_installed['active'] = true;
168
+ }
169
+ break;
170
+ }
171
+ }
172
+ return $is_installed;
173
+ }
174
+
175
+ /**
176
+ * This is a notice to show users that premium is installed
177
+ * @return echo error message
178
+ */
179
+ function show_admin_notice_premium() {
180
+ if( true == true ) {
181
+ echo '<div id="my-custom-warning" class="error fade"><p>WP-Optimze cannot be run when WP-Optimize Premium is installed.</p></div>';
182
+ if (isset($_GET['activate']))
183
+ unset($_GET['activate']);
184
+ }
185
+ }
186
+
187
  public function admin_init() {
188
 
189
  global $pagenow;
209
  public function show_admin_notice_upgradead() {
210
  $this->include_template('notices/thanks-for-using-main-dash.php');
211
  }
 
 
 
 
212
 
213
  public function capability_required() {
214
  return apply_filters('wp_optimize_capability_required', 'manage_options');
225
 
226
  if (!current_user_can($this->capability_required())) die('Security check');
227
 
228
+ $wp_optimize = $this;
229
  $optimizer = $this->get_optimizer();
230
  $options = $this->get_options();
231
 
243
  } else {
244
 
245
  // Other commands, available for any remote method
 
246
  if (!class_exists('WP_Optimize_Commands')) require_once(WPO_PLUGIN_MAIN_PATH.'includes/class-commands.php');
247
 
248
  $commands = new WP_Optimize_Commands();
298
 
299
  wp_enqueue_style('wp-optimize-admin-css', WPO_PLUGIN_URL.'css/admin'.$min_or_not.'.css', array(), $enqueue_version);
300
 
301
+ wp_localize_script('wp-optimize-admin-js', 'wpoptimize', array(
302
+ 'error_unexpected_response' => __('An unexpected response was received.', 'wp-optimize'),
303
+ 'optimization_complete' => __('Optimization complete', 'wp-optimize'),
304
+ ));
305
+
306
  $options = $this->get_options();
307
 
308
  $tabs = $this->get_tabs();
432
  return $links;
433
  }
434
 
 
435
  public function cron_activate() {
436
  $gmtoffset = (int) (3600 * ((double) get_option('gmt_offset')));
437
 
474
  }
475
 
476
 
477
+ // Scheduler public functions to update schedulers
478
  public function cron_schedules( $schedules ) {
479
  $schedules['wpo_daily'] = array('interval' => 86400, 'display' => 'Once Daily');
480
  $schedules['wpo_weekly'] = array('interval' => 86400*7, 'display' => 'Once Weekly');
564
 
565
  if ($return_instead_of_echo) return ob_get_clean();
566
  }
567
+
568
  private function register_template_directories() {
569
 
570
  $template_directories = array();
581
  closedir($dh);
582
  }
583
 
584
+ // Optimal hook for most extensions to hook into
585
  $this->template_directories = apply_filters('wp_optimize_template_directories', $template_directories);
586
 
587
  }
588
 
589
+ // Not currently used; needs looking at.
590
+ // N.B. The description does not match the actual function
591
  /**
592
  * send_email($sendto, $msg)
593
  * @return success
597
  public function send_email($date, $cleanedup){
598
  //
599
  ob_start();
600
+ // this need to work on - currently not using the parameter values
601
  $myTime = current_time( "timestamp", 0 );
602
  $myDate = gmdate(get_option('date_format') . ' ' . get_option('time_format'), $myTime );
603
 
605
 
606
  $sendto = $options->get_option('email-address');
607
  if (!$sendto) $sendto = get_bloginfo ( 'admin_email' );
608
+
609
  //$thiscleanup = $wp_optimize->format_size($cleanedup);
610
+
611
  $subject = get_bloginfo ( 'name' ).": ".__("Automatic Operation Completed","wp-optimize")." ".$myDate;
612
 
613
  $msg = __("Scheduled optimization was executed at","wp-optimize")." ".$myDate."\r\n"."\r\n";
621
 
622
  ob_end_flush();
623
  }
624
+
625
  /*
626
  * function log()
627
  *
629
  *
630
  * @return none
631
  */
632
+ public function log($message, $context = array()) {
633
+ $this->get_logger()->debug($message, $context);
 
 
634
  }
635
 
636
  /**
673
 
674
  $optimizations = $optimizer->get_optimizations();
675
 
676
+ // Currently the output of the optimizations is not saved/used/logged
677
  $results = $optimizer->do_optimizations($this_options, 'auto');
678
 
679
  }
680
 
681
  }
 
 
682
 
683
+ /*
684
+ This will customize a URL with a correct Affiliate link
685
+ This function can be update to suit any URL as longs as the URL is passed
686
+ */
687
+ public function wp_optimize_url($url, $text, $html=null, $class=null) {
688
+
689
+ //check if the URL is UpdraftPlus
690
+ if (false !== strpos($url, '//updraftplus.com')){
691
+
692
+ //Set URL with Affiliate ID
693
+ $url = $url.'?afref='.$this->get_notices()->get_affiliate_id();
694
+
695
+ //apply filters
696
+ $url = apply_filters('wpoptimize_updraftplus_com_link', $url);
697
+ }
698
+ //return URL - check if there is HTMl such as Images
699
+ if(!empty($html)){
700
+ echo '<a '.$class.' href="'.esc_attr($url).'">'.$html.'</a>';
701
+ }else{
702
+ echo '<a '.$class.' href="'.esc_attr($url).'">'.htmlspecialchars($text).'</a>';
703
+ }
704
+ }
705
+
706
+ /**
707
+ * Setup WPO logger(s)
708
+ */
709
+ public function setup_loggers() {
710
+
711
+ $logger = $this->get_logger();
712
+ $loggers = $this->wpo_loggers();
713
+
714
+ if (!empty($loggers)) {
715
+ foreach($loggers as $_logger) {
716
+ $logger->add_logger( $_logger );
717
+ }
718
+ }
719
+
720
+ }
721
+
722
+ /**
723
+ * Returns list of WPO loggers instances
724
+ *
725
+ * apply filter wp_optimize_loggers
726
+ *
727
+ * @return array|mixed|void
728
+ */
729
+ public function wpo_loggers() {
730
+
731
+ $loggers = array();
732
+
733
+ $loggers_classes = array(
734
+ 'Updraft_PHP_Logger' => WPO_PLUGIN_MAIN_PATH . 'includes/class-updraft-php-logger.php',
735
+ 'Updraft_Simple_History_Logger' => WPO_PLUGIN_MAIN_PATH . 'includes/class-updraft-simple-history-logger.php'
736
+ );
737
+
738
+ $loggers_classes = apply_filters('wp_optimize_loggers_classes', $loggers_classes);
739
+
740
+ if (!empty($loggers_classes)) {
741
+ foreach ($loggers_classes as $logger_class => $logger_file) {
742
+
743
+ if (!class_exists($logger_class)) {
744
+ if (is_file($logger_file)) {
745
+ require_once($logger_file);
746
+ }
747
+ }
748
+
749
+ if (class_exists($logger_class)) {
750
+ $loggers[] = new $logger_class();
751
+ }
752
+ }
753
+ }
754
+
755
+ $loggers = apply_filters('wp_optimize_loggers', $loggers);
756
+
757
+ if (empty($loggers)) return array();
758
+
759
+ $logger_options = $this->get_options()->get_option('logging');
760
+
761
+ if (empty($logger_options)) $logger_options = array();
762
+
763
+ foreach($loggers as $logger) {
764
+ $logger_class_name = get_class($logger);
765
+ $logger_id = strtolower($logger_class_name);
766
+ if (!array_key_exists($logger_id, $logger_options) || $logger_options[$logger_id] != 'true') {
767
+ $logger->disable();
768
+ }
769
+ }
770
+
771
+ return $loggers;
772
+ }
773
+
774
  }
775
 
 
776
 
777
  // plugin activation actions
778
  function wpo_activation_actions() {
789
  WP_Optimize()->log('running wpo_cron_deactivate()');
790
  wp_clear_scheduled_hook('wpo_cron_event2');
791
  }
792
+
793
+ function WP_Optimize() {
794
+ return WP_Optimize::instance();
795
+ }
796
+
797
+ endif;
798
+
799
+ $GLOBALS['wp_optimize'] = WP_Optimize();