Enable Media Replace - Version 3.6.1

Version Description

Release date: October 27th, 2021 * Fix: there was a broken image in one of the plugin notices; * Fix: added a check for the function mime_content_type, which doesn't seem to always be available on various hosts; * Fix: the plugin checks if the current user has rights to install/activate plugins and only then displays the 1-click installers and also a filter is available now;

Download this release

Release Info

Developer petredobrescu
Plugin Icon 128x128 Enable Media Replace
Version 3.6.1
Comparing to
See all releases

Code changes from version 3.6.0 to 3.6.1

classes/file.php CHANGED
@@ -40,10 +40,11 @@ class emrFile
40
  // Note: this function will work on non-existing file, but not on existing files containing wrong mime in file.
41
  $this->fileMime = (isset($filedata['type']) && strlen($filedata['type'] > 0)) ? $filedata['type'] : false;
42
 
43
-
44
- if ($this->fileMime == false && strlen($this->file) > 0) // If it's not a registered mimetype
 
45
  $this->fileMime = mime_content_type($this->file);
46
-
47
 
48
  }
49
 
40
  // Note: this function will work on non-existing file, but not on existing files containing wrong mime in file.
41
  $this->fileMime = (isset($filedata['type']) && strlen($filedata['type'] > 0)) ? $filedata['type'] : false;
42
 
43
+ if ($this->fileMime == false && strlen($this->file) > 0 && function_exists('mime_content_type') && $this->exists)
44
+ {
45
+ // If it's not a registered mimetype
46
  $this->fileMime = mime_content_type($this->file);
47
+ }
48
 
49
  }
50
 
enable-media-replace.php CHANGED
@@ -3,7 +3,7 @@
3
  * Plugin Name: Enable Media Replace
4
  * Plugin URI: https://wordpress.org/plugins/enable-media-replace/
5
  * Description: Enable replacing media files by uploading a new file in the "Edit Media" section of the WordPress Media Library.
6
- * Version: 3.6.0
7
  * Author: ShortPixel
8
  * Author URI: https://shortpixel.com
9
  * GitHub Plugin URI: https://github.com/short-pixel-optimizer/enable-media-replace
@@ -27,7 +27,7 @@
27
 
28
  namespace EnableMediaReplace;
29
 
30
- define('EMR_VERSION', '3.6.0');
31
 
32
  if ( ! defined( 'ABSPATH' ) ) {
33
  exit; // Exit if accessed directly.
@@ -84,4 +84,5 @@ register_uninstall_hook(__FILE__, '\EnableMediaReplace\emr_uninstall');
84
  function emr_uninstall()
85
  {
86
  delete_option('enable_media_replace');
 
87
  }
3
  * Plugin Name: Enable Media Replace
4
  * Plugin URI: https://wordpress.org/plugins/enable-media-replace/
5
  * Description: Enable replacing media files by uploading a new file in the "Edit Media" section of the WordPress Media Library.
6
+ * Version: 3.6.1
7
  * Author: ShortPixel
8
  * Author URI: https://shortpixel.com
9
  * GitHub Plugin URI: https://github.com/short-pixel-optimizer/enable-media-replace
27
 
28
  namespace EnableMediaReplace;
29
 
30
+ define('EMR_VERSION', '3.6.1');
31
 
32
  if ( ! defined( 'ABSPATH' ) ) {
33
  exit; // Exit if accessed directly.
84
  function emr_uninstall()
85
  {
86
  delete_option('enable_media_replace');
87
+ delete_option('emr_news');
88
  }
readme.txt CHANGED
@@ -5,7 +5,7 @@ Tags: replace, attachment, media, files, replace image, replace jpg, change medi
5
  Requires at least: 4.9.7
6
  Tested up to: 5.8.1
7
  Requires PHP: 5.6
8
- Stable tag: 3.6.0
9
 
10
  Easily replace any attached image/file by simply uploading a new file in the Media Library edit view - a real time saver!
11
 
@@ -47,6 +47,12 @@ If you want more control over the format used to display the time, you can use t
47
 
48
  == Changelog ==
49
 
 
 
 
 
 
 
50
  = 3.6.0 =
51
 
52
  Release date: October 11th, 2021
5
  Requires at least: 4.9.7
6
  Tested up to: 5.8.1
7
  Requires PHP: 5.6
8
+ Stable tag: 3.6.1
9
 
10
  Easily replace any attached image/file by simply uploading a new file in the Media Library edit view - a real time saver!
11
 
47
 
48
  == Changelog ==
49
 
50
+ = 3.6.1 =
51
+ Release date: October 27th, 2021
52
+ * Fix: there was a broken image in one of the plugin notices;
53
+ * Fix: added a check for the function `mime_content_type`, which doesn't seem to always be available on various hosts;
54
+ * Fix: the plugin checks if the current user has rights to install/activate plugins and only then displays the 1-click installers and also a filter is available now;
55
+
56
  = 3.6.0 =
57
 
58
  Release date: October 11th, 2021
views/notice.php CHANGED
@@ -1,7 +1,7 @@
1
  <div class='notice' id='emr-news' style="padding-top: 7px">
2
  <div style="float:<?php echo (is_rtl()) ? 'left' : 'right' ?>;"><a href="javascript:emrDismissNews()" class="button" style="margin-top:10px;"><?php _e('Dismiss', 'enable-media-replace');?></a></div>
3
  <a href="https://shortpixel.com/wp/af/VKG6LYN28044" target="_blank" style="float: <?php echo (is_rtl()) ? 'right' : 'left' ?>;margin-<?php echo (is_rtl()) ? 'left' : 'right' ?>: 10px;">
4
- <img src="<?php echo $this->plugin_url . 'img/sp.png' ?>" class="emr-sp"/>
5
  </a>
6
  <h3 style="margin:10px;"><?php echo esc_html__('Enable Media Replace is now compatible with ShortPixel!','enable-media-replace');?></h3>
7
  <p style="margin-bottom:0px;">
1
  <div class='notice' id='emr-news' style="padding-top: 7px">
2
  <div style="float:<?php echo (is_rtl()) ? 'left' : 'right' ?>;"><a href="javascript:emrDismissNews()" class="button" style="margin-top:10px;"><?php _e('Dismiss', 'enable-media-replace');?></a></div>
3
  <a href="https://shortpixel.com/wp/af/VKG6LYN28044" target="_blank" style="float: <?php echo (is_rtl()) ? 'right' : 'left' ?>;margin-<?php echo (is_rtl()) ? 'left' : 'right' ?>: 10px;">
4
+ <img width="30" height="30" src="<?php echo $this->plugin_url . 'img/sp-logo-regular.svg' ?>" class="emr-sp"/>
5
  </a>
6
  <h3 style="margin:10px;"><?php echo esc_html__('Enable Media Replace is now compatible with ShortPixel!','enable-media-replace');?></h3>
7
  <p style="margin-bottom:0px;">
views/upsell.php CHANGED
@@ -5,6 +5,11 @@ namespace EnableMediaReplace;
5
  use EnableMediaReplace\ShortPixelLogger\ShortPixelLogger as Log;
6
  use EnableMediaReplace\Notices\NoticeController as Notices;
7
 
 
 
 
 
 
8
  #wp_nonce_field('enable-media-replace');
9
  $plugins = get_plugins();
10
 
5
  use EnableMediaReplace\ShortPixelLogger\ShortPixelLogger as Log;
6
  use EnableMediaReplace\Notices\NoticeController as Notices;
7
 
8
+ if (! apply_filters('emr/upsell', current_user_can('install_plugins')))
9
+ {
10
+ return;
11
+ }
12
+
13
  #wp_nonce_field('enable-media-replace');
14
  $plugins = get_plugins();
15