Enable Media Replace - Version 3.2.3

Version Description

  • disable ShortPixel recommendation on secondary sites of a multisite install when it was network activated.
Download this release

Release Info

Developer ShortPixel
Plugin Icon 128x128 Enable Media Replace
Version 3.2.3
Comparing to
See all releases

Code changes from version 3.2.2 to 3.2.3

Files changed (2) hide show
  1. enable-media-replace.php +13 -2
  2. readme.txt +13 -5
enable-media-replace.php CHANGED
@@ -3,7 +3,7 @@
3
  Plugin Name: Enable Media Replace
4
  Plugin URI: http://www.mansjonasson.se/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.2.2
7
  Author: ShortPixel
8
  Author URI: https://shortpixel.com
9
 
@@ -28,6 +28,7 @@ add_filter('attachment_fields_to_edit', 'enable_media_replace', 10, 2);
28
  add_filter('media_row_actions', 'add_media_action', 10, 2);
29
 
30
  add_action('admin_notices', 'emr_display_notices');
 
31
  add_action('wp_ajax_emr_dismiss_notices', 'emr_dismiss_notices');
32
  add_action('wp_ajax_emr_install_plugin', 'emr_install_plugin');
33
  add_action( 'admin_enqueue_scripts', 'emr_add_js' );
@@ -174,12 +175,22 @@ function emr_display_notices() {
174
  $current_screen = get_current_screen();
175
 
176
  $crtScreen = function_exists("get_current_screen") ? get_current_screen() : (object)array("base" => false);
 
177
  if(current_user_can( 'activate_plugins' ) && !get_option( 'emr_news') && !is_plugin_active('shortpixel-image-optimiser/wp-shortpixel.php')
178
- && $crtScreen->base != "media_page_enable-media-replace/enable-media-replace") {
 
 
 
179
  require_once( str_replace("enable-media-replace.php", "notice.php", __FILE__) );
180
  }
181
  }
182
 
 
 
 
 
 
 
183
  function emr_dismiss_notices() {
184
  update_option( 'emr_news', true);
185
  exit(json_encode(array("Status" => 0)));
3
  Plugin Name: Enable Media Replace
4
  Plugin URI: http://www.mansjonasson.se/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.2.3
7
  Author: ShortPixel
8
  Author URI: https://shortpixel.com
9
 
28
  add_filter('media_row_actions', 'add_media_action', 10, 2);
29
 
30
  add_action('admin_notices', 'emr_display_notices');
31
+ add_action('network_admin_notices', 'emr_display_network_notices');
32
  add_action('wp_ajax_emr_dismiss_notices', 'emr_dismiss_notices');
33
  add_action('wp_ajax_emr_install_plugin', 'emr_install_plugin');
34
  add_action( 'admin_enqueue_scripts', 'emr_add_js' );
175
  $current_screen = get_current_screen();
176
 
177
  $crtScreen = function_exists("get_current_screen") ? get_current_screen() : (object)array("base" => false);
178
+
179
  if(current_user_can( 'activate_plugins' ) && !get_option( 'emr_news') && !is_plugin_active('shortpixel-image-optimiser/wp-shortpixel.php')
180
+ && $crtScreen->base != "media_page_enable-media-replace/enable-media-replace"
181
+ //for network installed plugins, don't display the message on subsites.
182
+ && !(function_exists('is_multisite') && is_multisite() && is_plugin_active_for_network('enable-media-replace/enable-media-replace.php') && !is_main_site()))
183
+ {
184
  require_once( str_replace("enable-media-replace.php", "notice.php", __FILE__) );
185
  }
186
  }
187
 
188
+ function emr_display_network_notices() {
189
+ if(current_user_can( 'activate_plugins' ) && !get_option( 'emr_news') && !is_plugin_active_for_network('shortpixel-image-optimiser/wp-shortpixel.php')) {
190
+ require_once( str_replace("enable-media-replace.php", "notice.php", __FILE__) );
191
+ }
192
+ }
193
+
194
  function emr_dismiss_notices() {
195
  update_option( 'emr_news', true);
196
  exit(json_encode(array("Status" => 0)));
readme.txt CHANGED
@@ -1,15 +1,17 @@
1
  === Enable Media Replace ===
2
  Contributors: ShortPixel
3
- Tags: admin, attachment, media, files
 
4
  Requires at least: 4.0
5
  Tested up to: 4.9.4
6
  Stable tag: trunk
7
 
8
- Enables replacing attachment files by simply uploading a new file in the media library edit view.
9
 
10
  == Description ==
11
 
12
- This plugin allows you to replace a file in your media library by uploading a new file in its place. No more deleting, renaming and re-uploading files!
 
13
 
14
  #### A real timesaver
15
 
@@ -26,6 +28,9 @@ Now you'll be able to replace any uploaded file from the media "edit" view, wher
26
 
27
  This plugin is very powerful and a must-have for any larger sites built with WordPress.
28
 
 
 
 
29
  #### Display file modification time
30
 
31
  There is a shortcode available which picks up the file modification date and displays it in a post or a page. The code is:
@@ -37,7 +42,11 @@ If you want more control over the format used to display the time, you can use t
37
 
38
  == Changelog ==
39
 
 
 
 
40
  = 3.2.2 =
 
41
  * Added ShortPixel links and images, fixed the problem of ShortPixel recommendation not dismissing.
42
 
43
  = 3.2.1 =
@@ -230,5 +239,4 @@ Second, if the file really looks unchanged, make sure WordPress has write permis
230
 
231
  == Wishlist / Coming attractons ==
232
 
233
- Do you have suggestions? Feel free to contact me at mans@mansjonasson.se
234
-
1
  === Enable Media Replace ===
2
  Contributors: ShortPixel
3
+ Donate link: https://www.paypal.me/resizeImage
4
+ Tags: admin, replace, attachment, media, files, replace image, replace jpg, change media, replace media
5
  Requires at least: 4.0
6
  Tested up to: 4.9.4
7
  Stable tag: trunk
8
 
9
+ Easily replace any attached image/file by simply uploading a new file in the Media Library edit view.
10
 
11
  == Description ==
12
 
13
+ **A free, lightweight and easy to use plugin that allows you to seamlessly replace an image or file in your Media Library by uploading a new file in its place. No more deleting, renaming and re-uploading files!
14
+ Supported by the friendly team that created <a href="https://wordpress.org/plugins/shortpixel-image-optimiser/" target="_blank">ShortPixel</a> :)**
15
 
16
  #### A real timesaver
17
 
28
 
29
  This plugin is very powerful and a must-have for any larger sites built with WordPress.
30
 
31
+ Enable Media Replace is fully compatible with the <a href="https://wordpress.org/plugins/shortpixel-image-optimiser/" target="_blank">ShortPixel Image Optimizer plugin</a>, which, once enabled, will optimize the images you replace automatically.
32
+ It's also compatible with the <a href="https://wordpress.org/plugins/resize-image-after-upload/" target="_blank">Resize Image After Upload plugin</a> which can do a sanity check on the size in pixels of the images uploaded.
33
+
34
  #### Display file modification time
35
 
36
  There is a shortcode available which picks up the file modification date and displays it in a post or a page. The code is:
42
 
43
  == Changelog ==
44
 
45
+ = 3.2.3 =
46
+ * disable ShortPixel recommendation on secondary sites of a multisite install when it was network activated.
47
+
48
  = 3.2.2 =
49
+ * Fixed compatibility with ShortPixel and Resize Image After Upload
50
  * Added ShortPixel links and images, fixed the problem of ShortPixel recommendation not dismissing.
51
 
52
  = 3.2.1 =
239
 
240
  == Wishlist / Coming attractons ==
241
 
242
+ Do you have suggestions? Feel free to contact contact ShortPixel <a href="https://shortpixel.com/contact" target="_blank">here</a>