Media Cleaner - Version 5.6.1

Version Description

  • Add: You can now sort the results by size and path. Little present for the week-end ;)
  • Info: This plugin is a lot of work. Please help me by giving it a nice review, here.
Download this release

Release Info

Developer TigrouMeow
Plugin Icon 128x128 Media Cleaner
Version 5.6.1
Comparing to
See all releases

Code changes from version 5.5.8 to 5.6.1

common/admin.php CHANGED
@@ -7,7 +7,7 @@ if ( !class_exists( 'MeowApps_Admin' ) ) {
7
  public static $logo = 'data:image/svg+xml;base64,PHN2ZyB2ZXJzaW9uPSIxIiB2aWV3Qm94PSIwIDAgMTY1IDE2NSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KICA8c3R5bGU+CiAgICAuc3Qye2ZpbGw6IzgwNDYyNX0uc3Qze2ZpbGw6I2ZkYTk2MH0KICA8L3N0eWxlPgogIDxwYXRoIGQ9Ik03MiA3YTc2IDc2IDAgMCAxIDg0IDkxQTc1IDc1IDAgMSAxIDcyIDd6IiBmaWxsPSIjNGE2YjhjIi8+CiAgPHBhdGggZD0iTTQ4IDQ4YzIgNSAyIDEwIDUgMTQgNSA4IDEzIDE3IDIyIDIwbDEtMTBjMS0yIDMtMyA1LTNoMTNjMiAwIDQgMSA1IDNsMyA5IDQtMTBjMi0zIDYtMiA5LTJoMTFjMyAyIDMgNSAzIDhsMiAzN2MwIDMtMSA3LTQgOGgtMTJjLTIgMC0zLTItNS00LTEgMS0yIDMtNCAzLTUgMS05IDEtMTMtMS0zIDItNSAyLTkgMnMtOSAxLTEwLTNjLTItNC0xLTggMC0xMi04LTMtMTUtNy0yMi0xMi03LTctMTUtMTQtMjAtMjMtMy00LTUtOC01LTEzIDEtNCAzLTEwIDYtMTMgNC0zIDEyLTIgMTUgMnoiIGZpbGw9IiMxMDEwMTAiLz4KICA8cGF0aCBjbGFzcz0ic3QyIiBkPSJNNDMgNTFsNCAxMS02IDVoLTZjLTMtNS0zLTExIDAtMTYgMi0yIDYtMyA4IDB6Ii8+CiAgPHBhdGggY2xhc3M9InN0MyIgZD0iTTQ3IDYybDMgNmMwIDMgMCA0LTIgNnMtNCAyLTcgMmwtNi05aDZsNi01eiIvPgogIDxwYXRoIGNsYXNzPSJzdDIiIGQ9Ik01MCA2OGw4IDljLTMgMy01IDYtOSA4bC04LTljMyAwIDUgMCA3LTJzMy0zIDItNnoiLz4KICA8cGF0aCBkPSJNODIgNzRoMTJsNSAxOCAzIDExIDgtMjloMTNsMiA0MmgtOGwtMS0yLTEtMzEtMTAgMzItNyAxLTktMzMtMSAyOS0xIDRoLThsMy00MnoiIGZpbGw9IiNmZmYiLz4KICA8cGF0aCBjbGFzcz0ic3QzIiBkPSJNNTggNzdsNSA1Yy0xIDQtMiA4LTcgOGwtNy01YzQtMiA2LTUgOS04eiIvPgogIDxwYXRoIGNsYXNzPSJzdDIiIGQ9Ik02MyA4Mmw5IDUtNiA5LTEwLTZjNSAwIDYtNCA3LTh6Ii8+CiAgPHBhdGggY2xhc3M9InN0MyIgZD0iTTcyIDg3bDMgMS0xIDExLTgtMyA2LTEweiIvPgo8L3N2Zz4K';
8
 
9
  public static $loaded = false;
10
- public static $admin_version = "2.4";
11
 
12
  public $prefix; // prefix used for actions, filters (mfrh)
13
  public $mainfile; // plugin main file (media-file-renamer.php)
@@ -389,27 +389,26 @@ if ( !class_exists( 'MeowApps_Admin' ) ) {
389
  ?>
390
  </p>
391
 
392
- <h2 style="margin-bottom: 0px; margin-top: 25px;"><?php _e( 'Featured Plugins', $this->domain ); ?></h2>
393
  <div class="meow-row meow-featured-plugins">
394
  <div class="meow-box meow-col meow-span_1_of_2">
395
  <ul class="">
396
  <li><img src='<?= $this->common_url( 'img/media-cleaner.jpg' ) ?>' />
397
  <a href='https://meowapps.com/plugin/media-cleaner/'><b>Media Cleaner</b></a>
398
  <?php echo $this->check_install( 'media-cleaner' ) ?><br />
399
- <?php _e( 'Detect the files which are not in use.', $this->domain ); ?></li>
400
  <li><img src='<?= $this->common_url( 'img/media-file-renamer.jpg' ) ?>' />
401
  <a href='https://meowapps.com/plugin/media-file-renamer/'><b>Media File Renamer</b></a>
402
  <?php echo $this->check_install( 'media-file-renamer' ) ?><br />
403
- <?php _e( 'For nicer filenames and a better SEO.', $this->domain ); ?></li>
404
  <li><img src='<?= $this->common_url( 'img/default.png' ) ?>' />
405
  <a href='https://meowapps.com/plugin/contact-form-block/'><b>Contact Form Block</b></a>
406
  <?php echo $this->check_install( 'contact-form-block' ) ?><br />
407
- <?php _e( 'A simpler, nicer, prettier contact form.', $this->domain ); ?></li>
408
- <!--li><img src='<?= $this->common_url( 'img/wp-retina-2x.jpg' ) ?>' />
409
- <a href='https://meowapps.com/plugin/wp-retina-2x/'><b>WP Retina 2x</b></a>
410
- <?php echo $this->check_install( 'wp-retina-2x' ) ?><br />
411
- <?php _e( 'The famous plugin that adds Retina support.', $this->domain ); ?></li-->
412
-
413
  </ul>
414
  </div>
415
  <div class="meow-box meow-col meow-span_1_of_2 ">
@@ -421,37 +420,59 @@ if ( !class_exists( 'MeowApps_Admin' ) ) {
421
  <li><img src='<?= $this->common_url( 'img/meow-lightbox.jpg' ) ?>' />
422
  <a href='https://meowapps.com/plugin/meow-lightbox/'><b>Meow Lightbox</b></a>
423
  <?php echo $this->check_install( 'meow-lightbox' ) ?><br />
424
- <?php _e( 'Pretty and ultra-optimized Lightbox which can also display your EXIF data. You will love it.', $this->domain ); ?></li>
425
  <li><img src='<?= $this->common_url( 'img/wplr-sync.jpg' ) ?>' />
426
  <a href='https://meowapps.com/plugin/wplr-sync/'><b>WP/LR Sync</b></a>
427
  <?php echo $this->check_install( 'wplr-sync' ) ?><br />
428
- <?php _e( 'Synchronize your Lightroom to your WordPress. This plugin is loved by all the photographers using Lightroom and WordPress.', $this->domain ); ?></li>
 
 
 
 
429
  </ul>
430
  </div>
431
  </div>
432
 
433
- <h2><?php _e( 'WordPress Performance & Recommendations', $this->domain ); ?></h2>
434
  <div style="background: white; padding: 5px 15px 5px 15px; box-shadow: 2px 2px 1px rgba(0,0,0,.02); margin-bottom: 15px;">
435
  <p><?php _e( 'The <b>Empty Request Time</b> helps you analyzing the raw performance of your install by giving you the average time it takes to run an empty request to your server. You can try to disable some plugins (or change their options) then and click on Reset to see how it influences the results. With <b>File Operation Time</b>, you will find out if your server is slow with files. An excellent install would have an Empty Request Time of less than 500 ms. Keep it absolutely under 2,000 ms. File Operation Time should take only a few milliseconds more than the Empty Request Time. For more information about this, <a href="https://meowapps.com/clean-optimize-wordpress/#Optimize_your_Empty_Request_Time" target="_blank">click here</a>.', $this->domain ); ?></p>
436
  </div>
437
 
438
- <div style="float: left; margin-right: 10px; text-align: center; padding: 10px; background: white; width: 200px; border: 1px solid #e2e2e2;">
439
- <div style='font-size: 14px; line-height: 14px; margin-bottom: 20px;'><?php _e( 'Empty Request Time', $this->domain ); ?></div>
440
- <div style='font-size: 32px; line-height: 32px; margin-bottom: 10px;' id='meow-perf-load-average'><?php _e( 'N/A', $this->domain ); ?></div>
441
- <div style='font-size: 12px; line-height: 12px; margin-bottom: 20px;'><?php _e( 'Based on', $this->domain ); ?>
442
- <span id='meow-perf-load-count'>0</span> <?php _e( 'request(s)', $this->domain ); ?>
 
 
 
 
443
  </div>
444
- <input type='submit' style='text-align: center; width: 100%;' id="meow-perf-reset" value="Reset" class="button button-primary">
445
- </div>
446
 
447
- <div style="float: left; margin-right: 10px; text-align: center; padding: 10px; background: white; width: 200px; border: 1px solid #e2e2e2;">
448
- <div style='font-size: 14px; line-height: 14px; margin-bottom: 20px;'><?php _e( 'File Operation Time', $this->domain ); ?></div>
449
- <div style='font-size: 32px; line-height: 32px; margin-bottom: 10px;' id='meow-file-check-time'><?php _e( 'N/A', $this->domain ); ?></div>
450
- <div style='font-size: 12px; line-height: 12px; margin-bottom: 20px;'><?php _e( 'Create temporary file and delete it.', $this->domain ); ?></div>
451
- <input type='submit' style='text-align: center; width: 100%;' id="meow-file-check-start" value="<?php _e( 'Check', $this->domain ); ?>" class="button button-primary">
452
- </div>
453
 
454
- <div style="clear: both;"></div>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
455
 
456
  <script>
457
  (function ($) {
@@ -512,6 +533,7 @@ if ( !class_exists( 'MeowApps_Admin' ) ) {
512
  })(jQuery);
513
  </script>
514
 
 
515
  <div style="background: white; padding: 5px 15px 5px 15px; box-shadow: 2px 2px 1px rgba(0,0,0,.02); margin-top: 15px;">
516
  <p>
517
  <?php _e( 'Too many WordPress installs are blown-up with useless and/or huge plugins, and bad practices. But that is because most users are overwhelmed by the diversity and immensity of the WordPress jungle. One rule of thumb is to keep your install the simplest as possible, with the least number of plugins (avoiding heavy ones too) and a good hosting service (avoid VPS except if you know exactly what you are doing). Articles are kept being updated on the Meow Apps website, with all the latest recommendations: ', $this->domain )?>
7
  public static $logo = 'data:image/svg+xml;base64,PHN2ZyB2ZXJzaW9uPSIxIiB2aWV3Qm94PSIwIDAgMTY1IDE2NSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KICA8c3R5bGU+CiAgICAuc3Qye2ZpbGw6IzgwNDYyNX0uc3Qze2ZpbGw6I2ZkYTk2MH0KICA8L3N0eWxlPgogIDxwYXRoIGQ9Ik03MiA3YTc2IDc2IDAgMCAxIDg0IDkxQTc1IDc1IDAgMSAxIDcyIDd6IiBmaWxsPSIjNGE2YjhjIi8+CiAgPHBhdGggZD0iTTQ4IDQ4YzIgNSAyIDEwIDUgMTQgNSA4IDEzIDE3IDIyIDIwbDEtMTBjMS0yIDMtMyA1LTNoMTNjMiAwIDQgMSA1IDNsMyA5IDQtMTBjMi0zIDYtMiA5LTJoMTFjMyAyIDMgNSAzIDhsMiAzN2MwIDMtMSA3LTQgOGgtMTJjLTIgMC0zLTItNS00LTEgMS0yIDMtNCAzLTUgMS05IDEtMTMtMS0zIDItNSAyLTkgMnMtOSAxLTEwLTNjLTItNC0xLTggMC0xMi04LTMtMTUtNy0yMi0xMi03LTctMTUtMTQtMjAtMjMtMy00LTUtOC01LTEzIDEtNCAzLTEwIDYtMTMgNC0zIDEyLTIgMTUgMnoiIGZpbGw9IiMxMDEwMTAiLz4KICA8cGF0aCBjbGFzcz0ic3QyIiBkPSJNNDMgNTFsNCAxMS02IDVoLTZjLTMtNS0zLTExIDAtMTYgMi0yIDYtMyA4IDB6Ii8+CiAgPHBhdGggY2xhc3M9InN0MyIgZD0iTTQ3IDYybDMgNmMwIDMgMCA0LTIgNnMtNCAyLTcgMmwtNi05aDZsNi01eiIvPgogIDxwYXRoIGNsYXNzPSJzdDIiIGQ9Ik01MCA2OGw4IDljLTMgMy01IDYtOSA4bC04LTljMyAwIDUgMCA3LTJzMy0zIDItNnoiLz4KICA8cGF0aCBkPSJNODIgNzRoMTJsNSAxOCAzIDExIDgtMjloMTNsMiA0MmgtOGwtMS0yLTEtMzEtMTAgMzItNyAxLTktMzMtMSAyOS0xIDRoLThsMy00MnoiIGZpbGw9IiNmZmYiLz4KICA8cGF0aCBjbGFzcz0ic3QzIiBkPSJNNTggNzdsNSA1Yy0xIDQtMiA4LTcgOGwtNy01YzQtMiA2LTUgOS04eiIvPgogIDxwYXRoIGNsYXNzPSJzdDIiIGQ9Ik02MyA4Mmw5IDUtNiA5LTEwLTZjNSAwIDYtNCA3LTh6Ii8+CiAgPHBhdGggY2xhc3M9InN0MyIgZD0iTTcyIDg3bDMgMS0xIDExLTgtMyA2LTEweiIvPgo8L3N2Zz4K';
8
 
9
  public static $loaded = false;
10
+ public static $admin_version = "2.6";
11
 
12
  public $prefix; // prefix used for actions, filters (mfrh)
13
  public $mainfile; // plugin main file (media-file-renamer.php)
389
  ?>
390
  </p>
391
 
392
+ <h2 style="margin-bottom: 0px; margin-top: 25px;"><?php _e( 'Recommended Meow Apps Plugins', $this->domain ); ?></h2>
393
  <div class="meow-row meow-featured-plugins">
394
  <div class="meow-box meow-col meow-span_1_of_2">
395
  <ul class="">
396
  <li><img src='<?= $this->common_url( 'img/media-cleaner.jpg' ) ?>' />
397
  <a href='https://meowapps.com/plugin/media-cleaner/'><b>Media Cleaner</b></a>
398
  <?php echo $this->check_install( 'media-cleaner' ) ?><br />
399
+ <?php _e( 'Very complex plugin which analyzes your WordPress deeply to find out which files are in use, or not. Then you can trash them, before deleting them permanently.', $this->domain ); ?></li>
400
  <li><img src='<?= $this->common_url( 'img/media-file-renamer.jpg' ) ?>' />
401
  <a href='https://meowapps.com/plugin/media-file-renamer/'><b>Media File Renamer</b></a>
402
  <?php echo $this->check_install( 'media-file-renamer' ) ?><br />
403
+ <?php _e( 'The Renamer will help you in getting nicer filenames, a better SEO and well-organized files. Extremely popular.', $this->domain ); ?></li>
404
  <li><img src='<?= $this->common_url( 'img/default.png' ) ?>' />
405
  <a href='https://meowapps.com/plugin/contact-form-block/'><b>Contact Form Block</b></a>
406
  <?php echo $this->check_install( 'contact-form-block' ) ?><br />
407
+ <?php _e( 'A simpler, nicer, prettier contact form. If you simply want your visitors to get in touch with you, this very light plugin will make your life easier.', $this->domain ); ?></li>
408
+ <li><img src='<?= $this->common_url( 'img/default.png' ) ?>' />
409
+ <a href='https://meowapps.com/plugin/meow-analytics/'><b>Meow Analytics</b></a>
410
+ <?php echo $this->check_install( 'meow-analytics' ) ?><br />
411
+ <?php _e( 'Tired of those fat plugins which are messing-up with your install? Switch to Meow Analytics, it\'s extremely light and features a cute dashboard.', $this->domain ); ?></li>
 
412
  </ul>
413
  </div>
414
  <div class="meow-box meow-col meow-span_1_of_2 ">
420
  <li><img src='<?= $this->common_url( 'img/meow-lightbox.jpg' ) ?>' />
421
  <a href='https://meowapps.com/plugin/meow-lightbox/'><b>Meow Lightbox</b></a>
422
  <?php echo $this->check_install( 'meow-lightbox' ) ?><br />
423
+ <?php _e( 'A very smooth and fast Lightbox which will also display your EXIF data (camera, lens, etc). Try it, you will love it.', $this->domain ); ?></li>
424
  <li><img src='<?= $this->common_url( 'img/wplr-sync.jpg' ) ?>' />
425
  <a href='https://meowapps.com/plugin/wplr-sync/'><b>WP/LR Sync</b></a>
426
  <?php echo $this->check_install( 'wplr-sync' ) ?><br />
427
+ <?php _e( 'Synchronize your Lightroom to your WordPress. This plugin is loved by a huge community of photographers.', $this->domain ); ?></li>
428
+ <li><img src='<?= $this->common_url( 'img/wp-retina-2x.jpg' ) ?>' />
429
+ <a href='https://meowapps.com/plugin/wp-retina-2x/'><b>WP Retina 2x</b></a>
430
+ <?php echo $this->check_install( 'wp-retina-2x' ) ?><br />
431
+ <?php _e( 'Here is the very famous plugin that adds Retina support to any website.', $this->domain ); ?></li>
432
  </ul>
433
  </div>
434
  </div>
435
 
436
+ <h2><?php _e( 'WordPress Performance', $this->domain ); ?></h2>
437
  <div style="background: white; padding: 5px 15px 5px 15px; box-shadow: 2px 2px 1px rgba(0,0,0,.02); margin-bottom: 15px;">
438
  <p><?php _e( 'The <b>Empty Request Time</b> helps you analyzing the raw performance of your install by giving you the average time it takes to run an empty request to your server. You can try to disable some plugins (or change their options) then and click on Reset to see how it influences the results. With <b>File Operation Time</b>, you will find out if your server is slow with files. An excellent install would have an Empty Request Time of less than 500 ms. Keep it absolutely under 2,000 ms. File Operation Time should take only a few milliseconds more than the Empty Request Time. For more information about this, <a href="https://meowapps.com/clean-optimize-wordpress/#Optimize_your_Empty_Request_Time" target="_blank">click here</a>.', $this->domain ); ?></p>
439
  </div>
440
 
441
+ <div>
442
+
443
+ <div style="float: left; margin-right: 10px; text-align: center; padding: 10px; background: white; width: 200px; border: 1px solid #e2e2e2;">
444
+ <div style='font-size: 14px; line-height: 14px; margin-bottom: 20px;'><?php _e( 'Empty Request Time', $this->domain ); ?></div>
445
+ <div style='font-size: 32px; line-height: 32px; margin-bottom: 10px;' id='meow-perf-load-average'><?php _e( 'N/A', $this->domain ); ?></div>
446
+ <div style='font-size: 12px; line-height: 12px; margin-bottom: 20px;'><?php _e( 'Based on', $this->domain ); ?>
447
+ <span id='meow-perf-load-count'>0</span> <?php _e( 'request(s)', $this->domain ); ?>
448
+ </div>
449
+ <input type='submit' style='text-align: center; width: 100%;' id="meow-perf-reset" value="Reset" class="button button-primary">
450
  </div>
 
 
451
 
452
+ <div style="float: left; margin-right: 10px; text-align: center; padding: 10px; background: white; width: 200px; border: 1px solid #e2e2e2;">
453
+ <div style='font-size: 14px; line-height: 14px; margin-bottom: 20px;'><?php _e( 'File Operation Time', $this->domain ); ?></div>
454
+ <div style='font-size: 32px; line-height: 32px; margin-bottom: 10px;' id='meow-file-check-time'><?php _e( 'N/A', $this->domain ); ?></div>
455
+ <div style='font-size: 12px; line-height: 12px; margin-bottom: 20px;'><?php _e( 'Create temporary file and delete it.', $this->domain ); ?></div>
456
+ <input type='submit' style='text-align: center; width: 100%;' id="meow-file-check-start" value="<?php _e( 'Check', $this->domain ); ?>" class="button button-primary">
457
+ </div>
458
 
459
+ <div style="float: left; margin-right: 10px; text-align: center; padding: 10px; background: white; width: 200px; border: 1px solid #e2e2e2;">
460
+ <a target='_blank' href='https://kinsta.com/?kaid=MFROFDOOINML'>
461
+ <img style='height: 116px;' src='<?= $this->common_url( 'img/kinsta.png' ) ?>'>
462
+ <div>Meow's 2020 Favorite Hosting</div>
463
+ </a>
464
+ </div>
465
+
466
+ <div style="float: left; margin-right: 10px; text-align: center; padding: 10px; background: white; width: 200px; border: 1px solid #e2e2e2;">
467
+ <a target='_blank' href='https://tracking.maxcdn.com/rPK13'>
468
+ <img style='height: 116px;' src='<?= $this->common_url( 'img/stackpath.png' ) ?>'>
469
+ <div>Meow's 2020 Favorite CDN</div>
470
+ </a>
471
+ </div>
472
+
473
+ <div style="clear: both;"></div>
474
+
475
+ </div>
476
 
477
  <script>
478
  (function ($) {
533
  })(jQuery);
534
  </script>
535
 
536
+ <h2><?php _e( 'WordPress Recommendations', $this->domain ); ?></h2>
537
  <div style="background: white; padding: 5px 15px 5px 15px; box-shadow: 2px 2px 1px rgba(0,0,0,.02); margin-top: 15px;">
538
  <p>
539
  <?php _e( 'Too many WordPress installs are blown-up with useless and/or huge plugins, and bad practices. But that is because most users are overwhelmed by the diversity and immensity of the WordPress jungle. One rule of thumb is to keep your install the simplest as possible, with the least number of plugins (avoiding heavy ones too) and a good hosting service (avoid VPS except if you know exactly what you are doing). Articles are kept being updated on the Meow Apps website, with all the latest recommendations: ', $this->domain )?>
common/img/default.png CHANGED
Binary file
common/img/kinsta.png ADDED
Binary file
common/img/media-cleaner.jpg CHANGED
Binary file
common/img/media-file-renamer.jpg CHANGED
Binary file
common/img/meow-gallery.jpg CHANGED
Binary file
common/img/meow-lightbox.jpg CHANGED
Binary file
common/img/meowapps.png CHANGED
Binary file
common/img/stackpath.png ADDED
Binary file
common/img/wp-retina-2x.jpg CHANGED
Binary file
common/img/wplr-sync.jpg CHANGED
Binary file
media-cleaner.php CHANGED
@@ -3,7 +3,7 @@
3
  Plugin Name: Media Cleaner
4
  Plugin URI: https://meowapps.com
5
  Description: Clean your Media Library, many options, trash system.
6
- Version: 5.5.8
7
  Author: Jordy Meow
8
  Author URI: https://meowapps.com
9
  Text Domain: media-cleaner
@@ -25,7 +25,7 @@ if ( is_admin() ) {
25
 
26
  global $wpmc_version;
27
  global $wpmc;
28
- $wpmc_version = '5.5.8';
29
 
30
  require __DIR__ . '/admin.php';
31
  require __DIR__ . '/core.php';
3
  Plugin Name: Media Cleaner
4
  Plugin URI: https://meowapps.com
5
  Description: Clean your Media Library, many options, trash system.
6
+ Version: 5.6.1
7
  Author: Jordy Meow
8
  Author URI: https://meowapps.com
9
  Text Domain: media-cleaner
25
 
26
  global $wpmc_version;
27
  global $wpmc;
28
+ $wpmc_version = '5.6.1';
29
 
30
  require __DIR__ . '/admin.php';
31
  require __DIR__ . '/core.php';
readme.txt CHANGED
@@ -5,7 +5,7 @@ Donate link: https://commerce.coinbase.com/checkout/d047546a-77a8-41c8-9ea9-4a95
5
  Requires at least: 4.8
6
  Tested up to: 5.3
7
  Requires PHP: 7.0
8
- Stable tag: 5.5.8
9
 
10
  Clean your WordPress from unused or broken media and files. It has its own trash system and recovery features. Please read the description.
11
 
@@ -74,6 +74,10 @@ Better to be safe than sorry. This plugin deletes files! Therefore, backup is no
74
 
75
  == Changelog ==
76
 
 
 
 
 
77
  = 5.5.8 =
78
  * Add: Support for Image Map Pro.
79
  * Add: Support for Directories.
5
  Requires at least: 4.8
6
  Tested up to: 5.3
7
  Requires PHP: 7.0
8
+ Stable tag: 5.6.1
9
 
10
  Clean your WordPress from unused or broken media and files. It has its own trash system and recovery features. Please read the description.
11
 
74
 
75
  == Changelog ==
76
 
77
+ = 5.6.1 =
78
+ * Add: You can now sort the results by size and path. Little present for the week-end ;)
79
+ * Info: This plugin is a lot of work. Please help me by giving it a nice review, [here](https://wordpress.org/support/plugin/media-cleaner/reviews/?rate=5#new-post).
80
+
81
  = 5.5.8 =
82
  * Add: Support for Image Map Pro.
83
  * Add: Support for Directories.
views/menu-screen.php CHANGED
@@ -7,6 +7,8 @@
7
  $paged = isset ( $_GET[ 'paged' ] ) ? sanitize_text_field( $_GET[ 'paged' ] ) : 1;
8
  $s = isset ( $_GET[ 's' ] ) ? sanitize_text_field( $_GET[ 's' ] ) : null;
9
  $f = isset ( $_GET[ 'f' ] ) ? sanitize_text_field( $_GET[ 'f' ] ) : null;
 
 
10
  $table_scan = $wpdb->prefix . "mclean_scan";
11
  $table_refs = $wpdb->prefix . "mclean_refs";
12
  $filterByTypeSQL = '';
@@ -51,28 +53,40 @@
51
  $ignored_count = $wpdb->get_var( "SELECT COUNT(*) FROM $table_scan WHERE ignored = 1" . $filterByTypeSQL );
52
  $deleted_count = $wpdb->get_var( "SELECT COUNT(*) FROM $table_scan WHERE deleted = 1" . $filterByTypeSQL );
53
 
 
 
 
 
 
 
 
 
 
 
 
 
54
  if ( $view == 'deleted' ) {
55
  $items_count = $deleted_count;
56
  $items = $wpdb->get_results( $wpdb->prepare( "SELECT id, type, postId, path, size, ignored, deleted, issue
57
  FROM $table_scan WHERE ignored = 0 AND deleted = 1 AND path LIKE %s $filterByTypeSQL
58
- ORDER BY path, time
59
- DESC LIMIT %d, %d", '%' . $s . '%', ( $paged - 1 ) * $posts_per_page, $posts_per_page ), OBJECT );
60
  }
61
  else if ( $view == 'ignored' ) {
62
  $items_count = $ignored_count;
63
  $items = $wpdb->get_results( $wpdb->prepare( "SELECT id, type, postId, path, size, ignored, deleted, issue
64
  FROM $table_scan
65
  WHERE ignored = 1 AND deleted = 0 AND path LIKE %s $filterByTypeSQL
66
- ORDER BY path, time
67
- DESC LIMIT %d, %d", '%' . $s . '%', ( $paged - 1 ) * $posts_per_page, $posts_per_page ), OBJECT );
68
  }
69
  else {
70
  $items_count = $issues_count;
71
  $items = $wpdb->get_results( $wpdb->prepare( "SELECT id, type, postId, path, size, ignored, deleted, issue
72
  FROM $table_scan
73
  WHERE ignored = 0 AND deleted = 0 AND path LIKE %s $filterByTypeSQL
74
- ORDER BY path, time
75
- DESC LIMIT %d, %d", '%' . $s . '%', ( $paged - 1 ) * $posts_per_page, $posts_per_page ), OBJECT );
76
  }
77
  ?>
78
 
@@ -307,8 +321,14 @@
307
 
308
  <div id='wpmc-paging'>
309
  <?php
 
 
 
 
 
 
310
  echo paginate_links(array(
311
- 'base' => '?page=media-cleaner&s=' . urlencode($s) . '&f=' . urlencode($f) . '&view=' . $view . '%_%',
312
  'current' => $paged,
313
  'format' => '&paged=%#%',
314
  'total' => ceil( $items_count / $posts_per_page ),
@@ -340,9 +360,19 @@
340
  <th style='width: 70px;'><?php _e( 'LR ID', 'media-cleaner' ) ?></th>
341
  <?php endif; ?>
342
 
343
- <th><?php _e( 'Path', 'media-cleaner' ) ?></th>
 
 
 
 
 
344
  <th style='width: 220px;'><?php _e( 'Issue', 'media-cleaner' ) ?></th>
345
- <th style='width: 80px; text-align: right;'><?php _e( 'Size', 'media-cleaner' ) ?></th>
 
 
 
 
 
346
  </tr>
347
  </thead>
348
 
7
  $paged = isset ( $_GET[ 'paged' ] ) ? sanitize_text_field( $_GET[ 'paged' ] ) : 1;
8
  $s = isset ( $_GET[ 's' ] ) ? sanitize_text_field( $_GET[ 's' ] ) : null;
9
  $f = isset ( $_GET[ 'f' ] ) ? sanitize_text_field( $_GET[ 'f' ] ) : null;
10
+ $orderby = isset ( $_GET[ 'orderby' ] ) ? sanitize_text_field( $_GET[ 'orderby' ] ) : '';
11
+ $order = isset ( $_GET[ 'order' ] ) ? sanitize_text_field( $_GET[ 'order' ] ) : 'asc';
12
  $table_scan = $wpdb->prefix . "mclean_scan";
13
  $table_refs = $wpdb->prefix . "mclean_refs";
14
  $filterByTypeSQL = '';
53
  $ignored_count = $wpdb->get_var( "SELECT COUNT(*) FROM $table_scan WHERE ignored = 1" . $filterByTypeSQL );
54
  $deleted_count = $wpdb->get_var( "SELECT COUNT(*) FROM $table_scan WHERE deleted = 1" . $filterByTypeSQL );
55
 
56
+ // Create the Order By
57
+ $sqlOrderBy = "path, time";
58
+ if ( $orderby === 'size' ) {
59
+ $sqlOrderBy = "size " . ( $order === 'asc' ? 'ASC' : 'DESC' );
60
+ }
61
+ else if ( $orderby === 'path' ) {
62
+ $sqlOrderBy = "path " . ( $order === 'asc' ? 'ASC' : 'DESC' );
63
+ }
64
+ else if ( $orderby === 'id' ) {
65
+ $sqlOrderBy = "postId " . ( $order === 'asc' ? 'ASC' : 'DESC' );
66
+ }
67
+
68
  if ( $view == 'deleted' ) {
69
  $items_count = $deleted_count;
70
  $items = $wpdb->get_results( $wpdb->prepare( "SELECT id, type, postId, path, size, ignored, deleted, issue
71
  FROM $table_scan WHERE ignored = 0 AND deleted = 1 AND path LIKE %s $filterByTypeSQL
72
+ ORDER BY $sqlOrderBy
73
+ LIMIT %d, %d", '%' . $s . '%', ( $paged - 1 ) * $posts_per_page, $posts_per_page ), OBJECT );
74
  }
75
  else if ( $view == 'ignored' ) {
76
  $items_count = $ignored_count;
77
  $items = $wpdb->get_results( $wpdb->prepare( "SELECT id, type, postId, path, size, ignored, deleted, issue
78
  FROM $table_scan
79
  WHERE ignored = 1 AND deleted = 0 AND path LIKE %s $filterByTypeSQL
80
+ ORDER BY $sqlOrderBy
81
+ LIMIT %d, %d", '%' . $s . '%', ( $paged - 1 ) * $posts_per_page, $posts_per_page ), OBJECT );
82
  }
83
  else {
84
  $items_count = $issues_count;
85
  $items = $wpdb->get_results( $wpdb->prepare( "SELECT id, type, postId, path, size, ignored, deleted, issue
86
  FROM $table_scan
87
  WHERE ignored = 0 AND deleted = 0 AND path LIKE %s $filterByTypeSQL
88
+ ORDER BY $sqlOrderBy
89
+ LIMIT %d, %d", '%' . $s . '%', ( $paged - 1 ) * $posts_per_page, $posts_per_page ), OBJECT );
90
  }
91
  ?>
92
 
321
 
322
  <div id='wpmc-paging'>
323
  <?php
324
+
325
+ function create_link( $s, $f, $orderby, $order, $view ) {
326
+ return '?page=media-cleaner&s=' . urlencode( $s ) . '&f=' . urlencode( $f ) .
327
+ '&orderby=' . urlencode( $orderby ) . '&order=' . urlencode( $order ) . '&view=' . $view;
328
+ }
329
+
330
  echo paginate_links(array(
331
+ 'base' => create_link( $s, $f, $orderby, $order, $view ) . '%_%',
332
  'current' => $paged,
333
  'format' => '&paged=%#%',
334
  'total' => ceil( $items_count / $posts_per_page ),
360
  <th style='width: 70px;'><?php _e( 'LR ID', 'media-cleaner' ) ?></th>
361
  <?php endif; ?>
362
 
363
+ <th class='manage-column sortable <?= $order === "asc" ? "desc" : "asc" ?>'>
364
+ <a href='<?= create_link( $s, $f, 'path', ( $order === "asc" ? "desc" : "asc" ), $view ) ?>'>
365
+ <span><?php _e( 'Path', 'media-cleaner' ) ?></span>
366
+ <span class="sorting-indicator"></span>
367
+ </a>
368
+ </th>
369
  <th style='width: 220px;'><?php _e( 'Issue', 'media-cleaner' ) ?></th>
370
+ <th class='manage-column sortable <?= $order === "asc" ? "desc" : "asc" ?>' style='width: 120px; text-align: right;'>
371
+ <a href='<?= create_link( $s, $f, 'size', ( $order === "asc" ? "desc" : "asc" ), $view ) ?>'>
372
+ <span><?php _e( 'Size', 'media-cleaner' ) ?></span>
373
+ <span class="sorting-indicator"></span>
374
+ </a>
375
+ </th>
376
  </tr>
377
  </thead>
378