Media Cleaner - Version 5.6.4

Version Description

  • Fix: Support for GeoDirectory.
  • Fix: Support for Modula Gallery.
  • Add: Better support for Fusion Builder (Avada).
  • Fix: Could not detect in the HTML absolute URLs starting with 'wp-content' directly.
  • Fix: Divi was not using the common file types.
Download this release

Release Info

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

Code changes from version 5.6.3 to 5.6.4

admin.php CHANGED
@@ -381,7 +381,7 @@ class Meow_WPMC_Admin extends MeowApps_Admin {
381
  $html = '<input ' . disabled( $this->is_registered(), false, false ) .
382
  ' type="checkbox" id="wpmc_content" name="wpmc_live_content" value="1" ' .
383
  checked( 1, $value, false ) . '/>';
384
- $html .= '<label>' . __( 'Check', 'media-cleaner' ) . '</label><br /><small>' . __( 'The live version of the website will be also analyzed (as if a visitor was loading it). <i>This will increase the accuracy of the results.</i>', 'media-cleaner' ) . '</small>';
385
  echo $html;
386
  }
387
 
381
  $html = '<input ' . disabled( $this->is_registered(), false, false ) .
382
  ' type="checkbox" id="wpmc_content" name="wpmc_live_content" value="1" ' .
383
  checked( 1, $value, false ) . '/>';
384
+ $html .= '<label>' . __( 'Check', 'media-cleaner' ) . '</label><br /><small>' . __( 'The live version of the website will be also analyzed (as if a visitor was loading it). <i>This will increase the accuracy of the results but slow down the analysis dramatically.</i>', 'media-cleaner' ) . '</small>';
385
  echo $html;
386
  }
387
 
common/img/kinsta.png CHANGED
Binary file
common/img/stackpath.png CHANGED
Binary file
core.php CHANGED
@@ -6,7 +6,7 @@ class Meow_WPMC_Core {
6
  public $engine = null;
7
  public $catch_timeout = true; // This will halt the plugin before reaching the PHP timeout.
8
  private $regex_file = '/[A-Za-z0-9-_,.\(\)\s]+[.]{1}(MIMETYPES)/';
9
- private $types = "jpg|jpeg|jpe|gif|png|tiff|bmp|csv|pdf|xls|xlsx|doc|docx|odt|wpd|rtf|tiff|mp3|mp4|wav|lua";
10
  public $current_method = 'media';
11
  private $refcache = array();
12
  public $servername = null;
@@ -394,6 +394,27 @@ class Meow_WPMC_Core {
394
  return trailingslashit( $this->upload_folder['basedir'] ) . 'wpmc-trash';
395
  }
396
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
397
  /**
398
  *
399
  * DELETE / SCANNING / RESET
@@ -744,9 +765,13 @@ class Meow_WPMC_Core {
744
  // error_log( print_r( $url, 1 ) );
745
  // }
746
  $dirIndex = strpos( $url, $this->contentDir );
747
- if ( empty( $url ) || $dirIndex == false )
748
- return null;
749
- return urldecode( substr( $url, 1 + strlen( $this->contentDir ) + $dirIndex ) );
 
 
 
 
750
  }
751
 
752
  // From a fullpath to the shortened and cleaned path (for example '2013/02/file.png')
@@ -838,8 +863,8 @@ class Meow_WPMC_Core {
838
  global $wpdb;
839
  $table_name = $wpdb->prefix . "mclean_scan";
840
  $issue = $wpdb->get_row( $wpdb->prepare( "SELECT * FROM $table_name WHERE postId = %d", $attachmentId ), OBJECT );
841
- error_log( $attachmentId );
842
- error_log( print_r( $issue, 1 ) );
843
  if ( $issue && $issue->ignored )
844
  return true;
845
  return false;
6
  public $engine = null;
7
  public $catch_timeout = true; // This will halt the plugin before reaching the PHP timeout.
8
  private $regex_file = '/[A-Za-z0-9-_,.\(\)\s]+[.]{1}(MIMETYPES)/';
9
+ public $types = "jpg|jpeg|jpe|gif|png|tiff|bmp|csv|pdf|xls|xlsx|doc|docx|odt|wpd|rtf|tiff|mp3|mp4|mov|wav|lua";
10
  public $current_method = 'media';
11
  private $refcache = array();
12
  public $servername = null;
394
  return trailingslashit( $this->upload_folder['basedir'] ) . 'wpmc-trash';
395
  }
396
 
397
+ /**
398
+ *
399
+ * I18N RELATED HELPERS
400
+ *
401
+ */
402
+
403
+ function is_multilingual() {
404
+ return function_exists('icl_object_id');
405
+ }
406
+
407
+ function get_languages() {
408
+ $results = array();
409
+ if ( $this->is_multilingual() ) {
410
+ $languages = icl_get_languages();
411
+ foreach ( $languages as $language ) {
412
+ array_push( $results, $language['code'] );
413
+ }
414
+ }
415
+ return $results;
416
+ }
417
+
418
  /**
419
  *
420
  * DELETE / SCANNING / RESET
765
  // error_log( print_r( $url, 1 ) );
766
  // }
767
  $dirIndex = strpos( $url, $this->contentDir );
768
+ if ( empty( $url ) || $dirIndex === false ) {
769
+ $finalUrl = null;
770
+ }
771
+ else {
772
+ $finalUrl = urldecode( substr( $url, 1 + strlen( $this->contentDir ) + $dirIndex ) );
773
+ }
774
+ return $finalUrl;
775
  }
776
 
777
  // From a fullpath to the shortened and cleaned path (for example '2013/02/file.png')
863
  global $wpdb;
864
  $table_name = $wpdb->prefix . "mclean_scan";
865
  $issue = $wpdb->get_row( $wpdb->prepare( "SELECT * FROM $table_name WHERE postId = %d", $attachmentId ), OBJECT );
866
+ //error_log( $attachmentId );
867
+ //error_log( print_r( $issue, 1 ) );
868
  if ( $issue && $issue->ignored )
869
  return true;
870
  return false;
engine.php CHANGED
@@ -159,7 +159,7 @@ SQL;
159
  if ( $finished )
160
  $this->core->log();
161
  $elapsed = $this->core->timeout_get_elapsed();
162
- $message = sprintf( __( "Extracted references from %d $medias in %s.", 'media-cleaner' ), count( $medias ), $elapsed );
163
  return $finished;
164
  }
165
 
159
  if ( $finished )
160
  $this->core->log();
161
  $elapsed = $this->core->timeout_get_elapsed();
162
+ $message = sprintf( __( "Extracted references from %d medias in %s.", 'media-cleaner' ), count( $medias ), $elapsed );
163
  return $finished;
164
  }
165
 
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.6.3
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.6.3';
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.4
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.4';
29
 
30
  require __DIR__ . '/admin.php';
31
  require __DIR__ . '/core.php';
parsers/common.php CHANGED
@@ -34,6 +34,10 @@ class MeowApps_WPMC_Parser {
34
 
35
  function get_images_from_widget( $widget, &$ids, &$urls ) {
36
  global $wpmc;
 
 
 
 
37
  $widget_class = $widget['callback'][0]->option_name;
38
  $instance_id = $widget['params'][0]['number'];
39
  $widget_data = get_option( $widget_class );
34
 
35
  function get_images_from_widget( $widget, &$ids, &$urls ) {
36
  global $wpmc;
37
+ // TODO: We should test with widgets
38
+ if ( !isset( $widget['callback'] ) || !isset( $widget['callback'][0] ) ) {
39
+ return;
40
+ }
41
  $widget_class = $widget['callback'][0]->option_name;
42
  $instance_id = $widget['params'][0]['number'];
43
  $widget_data = get_option( $widget_class );
parsers/maxmegamenu.php CHANGED
@@ -30,7 +30,7 @@ function wpmc_scan_widgets_maxmegamenu() {
30
  }
31
 
32
  if ( !empty( $urls ) ) {
33
- $wpmc->add_reference_url( $urls, 'MAX MEGA MENU (URL)' );
34
  }
35
  }
36
 
30
  }
31
 
32
  if ( !empty( $urls ) ) {
33
+ $wpmc->add_reference_url( $urls, 'MENU (URL)' );
34
  }
35
  }
36
 
parsers/metaslider.php CHANGED
@@ -17,7 +17,7 @@ function wpmc_scan_widgets_metaslider() {
17
  die( $wpdb->last_error );
18
  }
19
  if ( count( $imageIds) > 0 ) {
20
- $wpmc->add_reference_id( $imageIds, 'METASLIDER (ID)' );
21
  }
22
  }
23
  ?>
17
  die( $wpdb->last_error );
18
  }
19
  if ( count( $imageIds) > 0 ) {
20
+ $wpmc->add_reference_id( $imageIds, 'SLIDER (ID)' );
21
  }
22
  }
23
  ?>
parsers/my-calendar.php CHANGED
@@ -46,7 +46,7 @@ function wpmc_scan_widgets_mycalendar() {
46
  }
47
 
48
  if ( !empty( $eventurls ) ) {
49
- $wpmc->add_reference_url( $eventurls, 'MY CALENDAR (URL)' );
50
  }
51
  }
52
 
46
  }
47
 
48
  if ( !empty( $eventurls ) ) {
49
+ $wpmc->add_reference_url( $eventurls, 'CALENDAR (URL)' );
50
  }
51
  }
52
 
readme.txt CHANGED
@@ -3,9 +3,9 @@ Contributors: TigrouMeow
3
  Tags: clean, delete, file, files, images, image, media, library, upload, acf, gutenberg
4
  Donate link: https://commerce.coinbase.com/checkout/d047546a-77a8-41c8-9ea9-4a950f61832f
5
  Requires at least: 4.8
6
- Tested up to: 5.3
7
  Requires PHP: 7.0
8
- Stable tag: 5.6.3
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
 
@@ -56,10 +56,13 @@ Last but not least, [Media Cleaner Pro](https://meowapps.com/plugin/media-cleane
56
 
57
  Better to be safe than sorry. This plugin deletes files! Therefore, backup is not only important, it is **necessary**. Don't use this plugin if you are not ready. I can't help you if you damaged your install.
58
 
 
 
59
  === SPECIAL THANKS ===
60
 
61
  - Mike Meinz, an amazing developer from the US who made a thorough debugging of the whole process, load lot of corrections and optimizations, and added support for more plugins.
62
  - Satoshi Soma, an excellent Japanese developer who helped me when I needed it the most.
 
63
 
64
  == Installation ==
65
 
@@ -74,6 +77,13 @@ Better to be safe than sorry. This plugin deletes files! Therefore, backup is no
74
 
75
  == Changelog ==
76
 
 
 
 
 
 
 
 
77
  = 5.6.3 =
78
  * Fix: There was an issue with the "Ignore" feature which was not working in some cases.
79
  * Add: Filter to allow developers to override the decisions of the plugin.
3
  Tags: clean, delete, file, files, images, image, media, library, upload, acf, gutenberg
4
  Donate link: https://commerce.coinbase.com/checkout/d047546a-77a8-41c8-9ea9-4a950f61832f
5
  Requires at least: 4.8
6
+ Tested up to: 5.4
7
  Requires PHP: 7.0
8
+ Stable tag: 5.6.4
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
 
56
 
57
  Better to be safe than sorry. This plugin deletes files! Therefore, backup is not only important, it is **necessary**. Don't use this plugin if you are not ready. I can't help you if you damaged your install.
58
 
59
+ [](http://coderisk.com/wp/plugin/media-cleaner/RIPS-7_lTxPpGFo)
60
+
61
  === SPECIAL THANKS ===
62
 
63
  - Mike Meinz, an amazing developer from the US who made a thorough debugging of the whole process, load lot of corrections and optimizations, and added support for more plugins.
64
  - Satoshi Soma, an excellent Japanese developer who helped me when I needed it the most.
65
+ - To all the users who helped me with reproducing issues and testing new plugins and pagebuilders.
66
 
67
  == Installation ==
68
 
77
 
78
  == Changelog ==
79
 
80
+ = 5.6.4 =
81
+ * Fix: Support for GeoDirectory.
82
+ * Fix: Support for Modula Gallery.
83
+ * Add: Better support for Fusion Builder (Avada).
84
+ * Fix: Could not detect in the HTML absolute URLs starting with 'wp-content' directly.
85
+ * Fix: Divi was not using the common file types.
86
+
87
  = 5.6.3 =
88
  * Fix: There was an issue with the "Ignore" feature which was not working in some cases.
89
  * Add: Filter to allow developers to override the decisions of the plugin.
ui.php CHANGED
@@ -9,10 +9,14 @@ class Meow_WPMC_UI {
9
  "CONTENT (ID)" => "Found in content (as an ID).",
10
  "CONTENT (URL)" => "Found in content (as an URL).",
11
  "THEME" => "Found in theme.",
 
 
12
  "PAGE BUILDER" => "Found in Page Builder.",
13
  "PAGE BUILDER (ID)" => "Found in Page Builder (as an ID).",
14
  "PAGE BUILDER (URL)" => "Found in Page Builder (as an URL).",
15
  "GALLERY" => "Found in gallery.",
 
 
16
  "META" => "Found in meta.",
17
  "META (ID)" => "Found in meta (as an ID).",
18
  "META (URL)" => "Found in meta (as an URL).",
@@ -22,11 +26,11 @@ class Meow_WPMC_UI {
22
  "ACF WIDGET (ID)" => "Found in ACF Widget (as an ID).",
23
  "ACF WIDGET (URL)" => "Found in ACF Widget (as an URL).",
24
  "ATTACHMENT (ID)" => "Found in Attachment (as an ID).",
25
- "METASLIDER (ID)" => "Found in MetaSlider (as an ID).",
26
- "MY CALENDAR (URL)" => "Found in My Calendar (as an URL).",
27
- "UBERMENU (URL)" => "Found in UberMenu (as an URL).",
28
- "MAX MEGA MENU (URL)" => "Found in Max Mega Menu (as an URL).",
29
- "SITE ICON" => "Found in Site Icon."
30
  );
31
 
32
  function __construct( $core, $admin ) {
@@ -128,13 +132,29 @@ class Meow_WPMC_UI {
128
  }
129
 
130
  function display_metabox( $post ) {
 
 
131
  $originType = $this->core->reference_exists( null, $post->ID );
 
 
 
 
 
 
 
 
 
 
 
 
 
132
  if ( $originType ) {
133
  if ( array_key_exists( $originType, $this->foundTypes ) )
134
  echo $this->foundTypes[ $originType ];
135
  else
136
  echo "It seems to be used as: " . $originType;
137
  }
 
138
  else {
139
  echo "Doesn't seem to be used.";
140
  }
9
  "CONTENT (ID)" => "Found in content (as an ID).",
10
  "CONTENT (URL)" => "Found in content (as an URL).",
11
  "THEME" => "Found in theme.",
12
+ "THEME (ID)" => "Found in theme (as an ID).",
13
+ "THEME (URL)" => "Found in theme (as an URL).",
14
  "PAGE BUILDER" => "Found in Page Builder.",
15
  "PAGE BUILDER (ID)" => "Found in Page Builder (as an ID).",
16
  "PAGE BUILDER (URL)" => "Found in Page Builder (as an URL).",
17
  "GALLERY" => "Found in gallery.",
18
+ "PORTFOLIO (ID)" => "Found in a portfolio (as an ID).",
19
+ "PORTFOLIO (URL)" => "Found in a portfolio (as an URL).",
20
  "META" => "Found in meta.",
21
  "META (ID)" => "Found in meta (as an ID).",
22
  "META (URL)" => "Found in meta (as an URL).",
26
  "ACF WIDGET (ID)" => "Found in ACF Widget (as an ID).",
27
  "ACF WIDGET (URL)" => "Found in ACF Widget (as an URL).",
28
  "ATTACHMENT (ID)" => "Found in Attachment (as an ID).",
29
+ "SLIDER (ID)" => "Found in slider (as an ID).",
30
+ "SLIDER (URL)" => "Found in slider (as an URL).",
31
+ "CALENDAR (URL)" => "Found in calendar (as an URL).",
32
+ "MENU (URL)" => "Found in menu (as an URL).",
33
+ "SITE ICON" => "Found as a Site Icon."
34
  );
35
 
36
  function __construct( $core, $admin ) {
132
  }
133
 
134
  function display_metabox( $post ) {
135
+
136
+ // Search the references to the ID
137
  $originType = $this->core->reference_exists( null, $post->ID );
138
+
139
+ // Search the references to the files
140
+ if ( !$originType ) {
141
+ $paths = $this->core->get_paths_from_attachment( $post->ID );
142
+ foreach ( $paths as $path ) {
143
+ $originType = $this->core->reference_exists( $path, null );
144
+ if ( $originType ) {
145
+ break;
146
+ }
147
+ }
148
+ }
149
+
150
+ // Resolve the readable name for this issue (if exists)
151
  if ( $originType ) {
152
  if ( array_key_exists( $originType, $this->foundTypes ) )
153
  echo $this->foundTypes[ $originType ];
154
  else
155
  echo "It seems to be used as: " . $originType;
156
  }
157
+ // Otherwise just display the un-readable name
158
  else {
159
  echo "Doesn't seem to be used.";
160
  }
views/menu-screen.php CHANGED
@@ -255,6 +255,14 @@
255
  array_push( $unsupported, 'YooTheme Builder' );
256
  }
257
 
 
 
 
 
 
 
 
 
258
  if ( !empty( $unsupported ) ) {
259
  echo "<div class='notice notice-error'><p>";
260
  _e( "<b>Important note about the following plugin(s): </b>", 'media-cleaner' );
255
  array_push( $unsupported, 'YooTheme Builder' );
256
  }
257
 
258
+ if ( class_exists( 'geodirectory' ) ) {
259
+ array_push( $unsupported, 'GeoDirectory' );
260
+ }
261
+
262
+ if ( class_exists( 'Modula' ) ) {
263
+ array_push( $unsupported, 'Modula Gallery' );
264
+ }
265
+
266
  if ( !empty( $unsupported ) ) {
267
  echo "<div class='notice notice-error'><p>";
268
  _e( "<b>Important note about the following plugin(s): </b>", 'media-cleaner' );