Enable Media Replace - Version 3.6.3

Version Description

Release date: November 25th, 2021 * Fix: the shortcode file-modified works again for non-privileged visitors as well; * Compat: if other plugins don't properly use WP Hooks, don't return errors; * Tweak: updated banners list from the EMR screen.

Download this release

Release Info

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

Code changes from version 3.6.2 to 3.6.3

classes/emr-plugin.php CHANGED
@@ -20,6 +20,8 @@ class EnableMediaReplacePlugin
20
 
21
  public function runtime()
22
  {
 
 
23
  if (EMR_CAPABILITY !== false)
24
  {
25
  if (is_array(EMR_CAPABILITY))
@@ -58,6 +60,12 @@ class EnableMediaReplacePlugin
58
  return self::$instance;
59
  }
60
 
 
 
 
 
 
 
61
 
62
  public function plugin_actions()
63
  {
@@ -84,9 +92,6 @@ class EnableMediaReplacePlugin
84
  add_action( 'add_meta_boxes', array($this, 'add_meta_boxes'),10,2 );
85
  add_filter('attachment_fields_to_edit', array($this, 'attachment_editor'), 10, 2);
86
 
87
- // shortcode
88
- add_shortcode('file_modified', array($this, 'get_modified_date'));
89
-
90
  /** Just after an image is replaced, try to browser decache the images */
91
  if (isset($_GET['emr_replaced']) && intval($_GET['emr_replaced'] == 1))
92
  {
@@ -264,6 +269,10 @@ class EnableMediaReplacePlugin
264
 
265
  public function add_meta_boxes($post_type, $post)
266
  {
 
 
 
 
267
  if (! $this->checkImagePermission($post->post_author, $post->ID))
268
  { return; }
269
 
20
 
21
  public function runtime()
22
  {
23
+ $this->nopriv_plugin_actions();
24
+
25
  if (EMR_CAPABILITY !== false)
26
  {
27
  if (is_array(EMR_CAPABILITY))
60
  return self::$instance;
61
  }
62
 
63
+ // Actions for EMR that always need to hook
64
+ protected function nopriv_plugin_actions()
65
+ {
66
+ // shortcode
67
+ add_shortcode('file_modified', array($this, 'get_modified_date'));
68
+ }
69
 
70
  public function plugin_actions()
71
  {
92
  add_action( 'add_meta_boxes', array($this, 'add_meta_boxes'),10,2 );
93
  add_filter('attachment_fields_to_edit', array($this, 'attachment_editor'), 10, 2);
94
 
 
 
 
95
  /** Just after an image is replaced, try to browser decache the images */
96
  if (isset($_GET['emr_replaced']) && intval($_GET['emr_replaced'] == 1))
97
  {
269
 
270
  public function add_meta_boxes($post_type, $post)
271
  {
272
+ // Because some plugins don't like to play by the rules.
273
+ if (is_null($post_type) || is_null($post))
274
+ return false;
275
+
276
  if (! $this->checkImagePermission($post->post_author, $post->ID))
277
  { return; }
278
 
classes/uihelper.php CHANGED
@@ -21,7 +21,6 @@ class UIHelper
21
 
22
  }
23
 
24
-
25
  public function getFormUrl($attach_id)
26
  {
27
  $url = admin_url('upload.php');
21
 
22
  }
23
 
 
24
  public function getFormUrl($attach_id)
25
  {
26
  $url = admin_url('upload.php');
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.2
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.2');
31
 
32
  if ( ! defined( 'ABSPATH' ) ) {
33
  exit; // Exit if accessed directly.
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.3
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.3');
31
 
32
  if ( ! defined( 'ABSPATH' ) ) {
33
  exit; // Exit if accessed directly.
readme.txt CHANGED
@@ -3,9 +3,9 @@ Contributors: ShortPixel
3
  Donate link: https://www.paypal.me/resizeImage
4
  Tags: replace, attachment, media, files, replace image, replace jpg, change media, replace media, image, file
5
  Requires at least: 4.9.7
6
- Tested up to: 5.8
7
  Requires PHP: 5.6
8
- Stable tag: 3.6.2
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
 
@@ -25,9 +25,9 @@ Now you'll be able to replace any uploaded file from the media "edit" view, wher
25
  #### It's simple to replace a file
26
 
27
  1. Just replace the file. This option requires you to upload a file of the same type as the one you are replacing. The name of the attachment will stay the same no matter what the file you upload is called.
28
- 1. Replace the file, use new file name and update all links. If you check this option, the name and type of the file you are about to upload will replace the old file. All links pointing to the current file will be updated to point to the new file name.
29
 
30
- This plugin is very powerful and a must-have for any larger sites built with WordPress. It now also comes with preview of the replaced image!
31
 
32
  #### Display file modification time
33
 
@@ -47,6 +47,13 @@ If you want more control over the format used to display the time, you can use t
47
 
48
  == Changelog ==
49
 
 
 
 
 
 
 
 
50
  = 3.6.2 =
51
 
52
  Release date: November 8th, 2021
3
  Donate link: https://www.paypal.me/resizeImage
4
  Tags: replace, attachment, media, files, replace image, replace jpg, change media, replace media, image, file
5
  Requires at least: 4.9.7
6
+ Tested up to: 6.0
7
  Requires PHP: 5.6
8
+ Stable tag: 3.6.3
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
 
25
  #### It's simple to replace a file
26
 
27
  1. Just replace the file. This option requires you to upload a file of the same type as the one you are replacing. The name of the attachment will stay the same no matter what the file you upload is called.
28
+ 1. Replace the file, use new file name and update all links. If you check this option, the name and type of the file you are about to upload will replace the old file. All links pointing to the current file will be updated to point to the new file name. Additional options for the folder where to place the new file, or the date of the new file are also available on the replace screen.
29
 
30
+ This plugin is very powerful and a must-have for any larger sites built with WordPress. It now also comes with a preview of the replaced image!
31
 
32
  #### Display file modification time
33
 
47
 
48
  == Changelog ==
49
 
50
+ = 3.6.3 =
51
+
52
+ Release date: November 25th, 2021
53
+ * Fix: the shortcode `file-modified` works again for non-privileged visitors as well;
54
+ * Compat: if other plugins don't properly use WP Hooks, don't return errors;
55
+ * Tweak: updated banners list from the EMR screen.
56
+
57
  = 3.6.2 =
58
 
59
  Release date: November 8th, 2021
views/upsell.php CHANGED
@@ -107,7 +107,7 @@ if (! apply_filters('emr/upsell', current_user_can('install_plugins')))
107
  </div>
108
  <!--- // WPSO -->
109
 
110
- <!--- ENVIRA -->
111
  <?php if (! $envira_pro_active): ?>
112
  <div class='envira-shortpixel-install shortpixel-offer'>
113
 
@@ -154,4 +154,6 @@ if (! apply_filters('emr/upsell', current_user_can('install_plugins')))
154
  }
155
  </style>
156
  <?php endif; // envira ?>
 
 
157
  </section>
107
  </div>
108
  <!--- // WPSO -->
109
 
110
+ <!--- ENVIRA temprary deactivated
111
  <?php if (! $envira_pro_active): ?>
112
  <div class='envira-shortpixel-install shortpixel-offer'>
113
 
154
  }
155
  </style>
156
  <?php endif; // envira ?>
157
+ -->
158
+
159
  </section>