Enable Media Replace - Version 2.9.4

Version Description

  • Bug fix for timezone changes in WordPress
  • Minor UI change to inform the user about what actually happens when replacing an image and using a new file name
Download this release

Release Info

Developer MungoBBQ
Plugin Icon 128x128 Enable Media Replace
Version 2.9.4
Comparing to
See all releases

Code changes from version 2.9.3 to 2.9.4

Files changed (4) hide show
  1. enable-media-replace.php +2 -9
  2. popup.php +1 -0
  3. readme.txt +5 -1
  4. upload.php +3 -0
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: 2.9.3
7
  Author: Måns Jonasson
8
  Author URI: http://www.mansjonasson.se
9
 
@@ -143,15 +143,8 @@ function emr_get_modified_date($atts) {
143
  // Get file modification time
144
  $filetime = filemtime($current_file);
145
 
146
- // Do timezone magic to get around UTC
147
- $timezone = date_default_timezone_get();
148
- date_default_timezone_set(get_option('timezone_string'));
149
-
150
  // do date conversion
151
- $content = date($format, $filetime);
152
-
153
- // Set timezone back to default
154
- date_default_timezone_set($timezone);
155
 
156
  return $content;
157
 
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: 2.9.4
7
  Author: Måns Jonasson
8
  Author URI: http://www.mansjonasson.se
9
 
143
  // Get file modification time
144
  $filetime = filemtime($current_file);
145
 
 
 
 
 
146
  // do date conversion
147
+ $content = date($format, current_time($filetime));
 
 
 
148
 
149
  return $content;
150
 
popup.php CHANGED
@@ -56,6 +56,7 @@ $current_filename = substr($current_filename, (strrpos($current_filename, "/") +
56
 
57
  <label for="replace_type_2"><input id="replace_type_2" type="radio" name="replace_type" value="replace_and_search"> <?php echo __("Replace the file, use new file name and update all links", "enable-media-replace"); ?></label>
58
  <p class="howto"><?php echo __("Note: 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 (", "enable-media-replace"); ?><?php echo $current_filename; ?><?php echo __(") will be updated to point to the new file name.", "enable-media-replace"); ?></p>
 
59
 
60
  <input type="submit" class="button" value="<?php echo __("Upload", "enable-media-replace"); ?>" /> <a href="#" onclick="history.back();"><?php echo __("Cancel", "enable-media-replace"); ?></a>
61
 
56
 
57
  <label for="replace_type_2"><input id="replace_type_2" type="radio" name="replace_type" value="replace_and_search"> <?php echo __("Replace the file, use new file name and update all links", "enable-media-replace"); ?></label>
58
  <p class="howto"><?php echo __("Note: 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 (", "enable-media-replace"); ?><?php echo $current_filename; ?><?php echo __(") will be updated to point to the new file name.", "enable-media-replace"); ?></p>
59
+ <p class="howto"><?php echo __("Please note that if you upload a new image, only embeds/links of the original size image will be replaced in your posts."); ?></p>
60
 
61
  <input type="submit" class="button" value="<?php echo __("Upload", "enable-media-replace"); ?>" /> <a href="#" onclick="history.back();"><?php echo __("Cancel", "enable-media-replace"); ?></a>
62
 
readme.txt CHANGED
@@ -2,7 +2,7 @@
2
  Contributors: mungobbq
3
  Tags: admin, attachment, media, files
4
  Requires at least: 2.8
5
- Tested up to: 3.6
6
  Stable tag: trunk
7
 
8
  Enables replacing attachment files by simply uploading a new file in the media library edit view.
@@ -37,6 +37,10 @@ If you want more control over the format used to display the time, you can use t
37
 
38
  == Changelog ==
39
 
 
 
 
 
40
  = 2.9.3 =
41
  * Added call to update_attached_file() which should purge changed files for various CDN and cache plugs. Thanks Dylan Barlett for the suggestion! (http://wordpress.org/support/topic/compatibility-with-w3-total-cache)
42
  * Suppressed possible error in new hook added in 2.9.2
2
  Contributors: mungobbq
3
  Tags: admin, attachment, media, files
4
  Requires at least: 2.8
5
+ Tested up to: 3.8.1
6
  Stable tag: trunk
7
 
8
  Enables replacing attachment files by simply uploading a new file in the media library edit view.
37
 
38
  == Changelog ==
39
 
40
+ = 2.9.4 =
41
+ * Bug fix for timezone changes in WordPress
42
+ * Minor UI change to inform the user about what actually happens when replacing an image and using a new file name
43
+
44
  = 2.9.3 =
45
  * Added call to update_attached_file() which should purge changed files for various CDN and cache plugs. Thanks Dylan Barlett for the suggestion! (http://wordpress.org/support/topic/compatibility-with-w3-total-cache)
46
  * Suppressed possible error in new hook added in 2.9.2
upload.php CHANGED
@@ -40,6 +40,9 @@ function emr_delete_current_files($current_file) {
40
  foreach($metadata["sizes"] AS $thissize) {
41
  // Get all filenames and do an unlink() on each one;
42
  $thisfile = $thissize["file"];
 
 
 
43
  if (strlen($thisfile)) {
44
  $thisfile = $current_path . "/" . $thissize["file"];
45
  if (file_exists($thisfile)) {
40
  foreach($metadata["sizes"] AS $thissize) {
41
  // Get all filenames and do an unlink() on each one;
42
  $thisfile = $thissize["file"];
43
+ // Create array with all old sizes for replacing in posts later
44
+ $oldfilesAr[] = $thisfile;
45
+ // Look for files and delete them
46
  if (strlen($thisfile)) {
47
  $thisfile = $current_path . "/" . $thissize["file"];
48
  if (file_exists($thisfile)) {