Enable Media Replace - Version 1.4

Version Description

  • Removed short tags for better compatibility.
Download this release

Release Info

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

Code changes from version 1.3 to 1.4

Files changed (3) hide show
  1. enable-media-replace.php +3 -7
  2. popup.php +16 -16
  3. readme.txt +14 -7
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: 1.3
7
  Author: Måns Jonasson
8
  Author URI: http://www.mansjonasson.se
9
 
@@ -24,12 +24,8 @@ function enable_media_replace_init() {
24
 
25
  function enable_media_replace( $form_fields, $post ) {
26
  if ($_GET["attachment_id"]) {
27
- $popupurl = get_bloginfo("wpurl") . "/wp-content/plugins/enable-media-replace/popup.php?attachment_id={$_GET["attachment_id"]}";
28
-
29
- if (FORCE_SSL_ADMIN) {
30
- $popupurl = str_replace("http:", "https:", $popupurl);
31
- }
32
-
33
  $link = "href=\"#\" onclick=\"window.open('$popupurl', 'enable_media_replace_popup', 'width=500,height=500');\"";
34
  $form_fields["enable-media-replace"] = array("label" => __("Replace media", "enable-media-replace"), "input" => "html", "html" => "<p><a $link>" . __("Upload a new file", "enable-media-replace") . "</a></p>", "helps" => __("To replace the current file, click the link and upload a replacement.", "enable-media-replace"));
35
  }
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: 1.4
7
  Author: Måns Jonasson
8
  Author URI: http://www.mansjonasson.se
9
 
24
 
25
  function enable_media_replace( $form_fields, $post ) {
26
  if ($_GET["attachment_id"]) {
27
+ $popupurl = plugins_url("popup.php?attachment_id={$_GET["attachment_id"]}", __FILE__);
28
+
 
 
 
 
29
  $link = "href=\"#\" onclick=\"window.open('$popupurl', 'enable_media_replace_popup', 'width=500,height=500');\"";
30
  $form_fields["enable-media-replace"] = array("label" => __("Replace media", "enable-media-replace"), "input" => "html", "html" => "<p><a $link>" . __("Upload a new file", "enable-media-replace") . "</a></p>", "helps" => __("To replace the current file, click the link and upload a replacement.", "enable-media-replace"));
31
  }
popup.php CHANGED
@@ -23,35 +23,35 @@ $current_filename = substr($current_filename, (strrpos($current_filename, "/") +
23
 
24
  ?><html>
25
  <head>
26
- <title><?=__("Replace media upload")?></title>
27
 
28
- <link rel='stylesheet' href='<?=get_bloginfo("wpurl");?>/wp-admin/css/global.css?ver=20081210' type='text/css' media='all' />
29
- <link rel='stylesheet' href='<?=get_bloginfo("wpurl");?>/wp-admin/wp-admin.css?ver=20081210' type='text/css' media='all' />
30
- <link rel='stylesheet' href='<?=get_bloginfo("wpurl");?>/wp-admin/css/colors-fresh.css?ver=20081210' type='text/css' media='all' />
31
- <link rel='stylesheet' href='<?=get_bloginfo("wpurl");?>/wp-admin/css/media.css?ver=20081210' type='text/css' media='all' />
32
  </head>
33
  <body id="media-upload">
34
  <div class="wrap">
35
  <div id="icon-upload" class="icon32"><br /></div>
36
- <h2><?=__("Replace Media Upload", "enable-media-replace")?></h2>
37
 
38
- <form enctype="multipart/form-data" method="post" action="<?=get_bloginfo("wpurl") . "/wp-content/plugins/enable-media-replace/upload.php"?>">
39
- <input type="hidden" name="ID" value="<?=$_GET["attachment_id"]?>" />
40
- <div id="message" class="updated fade"><p><?=__("NOTE: You are about to replace the media file", "enable-media-replace")?> "<?=$current_filename?>". <?=__("There is no undo. Think about it!", "enable-media-replace")?></p></div>
41
 
42
- <p><?=__("Choose a file to upload from your computer", "enable-media-replace")?></p>
43
 
44
  <input type="file" name="userfile" />
45
 
46
- <p><?=__("Select media replacement type:", "enable-media-replace")?></p>
47
 
48
- <label for="replace_type_1"><input CHECKED id="replace_type_1" type="radio" name="replace_type" value="replace"> <?=__("Just replace the file", "enable-media-replace")?></label>
49
- <p class="howto"><?=__("Note: This option requires you to upload a file of the same type (", "enable-media-replace")?><?=$current_filetype?><?=__(") as the one you are replacing. The name of the attachment will stay the same (", "enable-media-replace")?><?=$current_filename?><?=__(") no matter what the file you upload is called.", "enable-media-replace")?></p>
50
 
51
- <label for="replace_type_2"><input id="replace_type_2" type="radio" name="replace_type" value="replace_and_search"> <?=__("Replace the file, use new file name and update all links", "enable-media-replace")?></label>
52
- <p class="howto"><?=__("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")?><?=$current_filename?><?=__(") will be updated to point to the new file name.", "enable-media-replace")?></p>
53
 
54
- <input type="submit" class="button" value="<?=__("Upload", "enable-media-replace")?>" /> <a href="#" onclick="window.close();"><?=__("Cancel", "enable-media-replace")?></a>
55
 
56
  </form>
57
  </div>
23
 
24
  ?><html>
25
  <head>
26
+ <title><?php echo __("Replace media upload"); ?></title>
27
 
28
+ <link rel='stylesheet' href='<?php echo get_bloginfo("wpurl");?>/wp-admin/css/global.css?ver=20081210' type='text/css' media='all' />
29
+ <link rel='stylesheet' href='<?php echo get_bloginfo("wpurl");?>/wp-admin/wp-admin.css?ver=20081210' type='text/css' media='all' />
30
+ <link rel='stylesheet' href='<?php echo get_bloginfo("wpurl");?>/wp-admin/css/colors-fresh.css?ver=20081210' type='text/css' media='all' />
31
+ <link rel='stylesheet' href='<?php echo get_bloginfo("wpurl");?>/wp-admin/css/media.css?ver=20081210' type='text/css' media='all' />
32
  </head>
33
  <body id="media-upload">
34
  <div class="wrap">
35
  <div id="icon-upload" class="icon32"><br /></div>
36
+ <h2><?php echo __("Replace Media Upload", "enable-media-replace"); ?></h2>
37
 
38
+ <form enctype="multipart/form-data" method="post" action="<?php echo get_bloginfo("wpurl") . "/wp-content/plugins/enable-media-replace/upload.php"; ?>">
39
+ <input type="hidden" name="ID" value="<?php echo $_GET["attachment_id"]; ?>" />
40
+ <div id="message" class="updated fade"><p><?php echo __("NOTE: You are about to replace the media file", "enable-media-replace"); ?> "<?php echo $current_filename?>". <?php echo __("There is no undo. Think about it!", "enable-media-replace"); ?></p></div>
41
 
42
+ <p><?php echo __("Choose a file to upload from your computer", "enable-media-replace"); ?></p>
43
 
44
  <input type="file" name="userfile" />
45
 
46
+ <p><?php echo __("Select media replacement type:", "enable-media-replace"); ?></p>
47
 
48
+ <label for="replace_type_1"><input CHECKED id="replace_type_1" type="radio" name="replace_type" value="replace"> <?php echo __("Just replace the file", "enable-media-replace"); ?></label>
49
+ <p class="howto"><?php echo __("Note: This option requires you to upload a file of the same type (", "enable-media-replace"); ?><?php echo $current_filetype; ?><?php echo __(") as the one you are replacing. The name of the attachment will stay the same (", "enable-media-replace"); ?><?php echo $current_filename; ?><?php echo __(") no matter what the file you upload is called.", "enable-media-replace"); ?></p>
50
 
51
+ <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>
52
+ <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>
53
 
54
+ <input type="submit" class="button" value="<?php echo __("Upload", "enable-media-replace"); ?>" /> <a href="#" onclick="window.close();"><?php echo __("Cancel", "enable-media-replace"); ?></a>
55
 
56
  </form>
57
  </div>
readme.txt CHANGED
@@ -1,8 +1,8 @@
1
  === Enable Media Replace ===
2
  Contributors: mungobbq
3
  Tags: admin, attachment, media, files
4
- Requires at least: 2.7
5
- Tested up to: 2.8.6
6
  Stable tag: trunk
7
 
8
  Enables replacing attachment files by simply uploading a new file in the media library edit view.
@@ -20,15 +20,22 @@ Now you'll be able to replace any uploaded file from the media "edit" view, wher
20
 
21
  This plugin is very powerful and a must-have for any larger sites built with WordPress.
22
 
23
- Changes:
24
 
25
- 1.3 Added support for wp_config setting "FORCE_SSL_ADMIN"
 
26
 
27
- 1.2 Added Russian translation, thanks to [Fat Cower](http://www.fatcow.com)
 
28
 
29
- 1.1 Minor bugfix, now working with IE8 too!
 
30
 
31
- 1.0 First stable version of plugin.
 
 
 
 
32
 
33
  == Installation ==
34
 
1
  === Enable Media Replace ===
2
  Contributors: mungobbq
3
  Tags: admin, attachment, media, files
4
+ Requires at least: 2.8
5
+ Tested up to: 2.9.1
6
  Stable tag: trunk
7
 
8
  Enables replacing attachment files by simply uploading a new file in the media library edit view.
20
 
21
  This plugin is very powerful and a must-have for any larger sites built with WordPress.
22
 
23
+ == Changelog ==
24
 
25
+ = 1.4 =
26
+ * Removed short tags for better compatibility.
27
 
28
+ = 1.3 =
29
+ * Added support for wp_config setting "FORCE_SSL_ADMIN"
30
 
31
+ = 1.2 =
32
+ * Added Russian translation, thanks to [Fat Cower](http://www.fatcow.com)
33
 
34
+ = 1.1 =
35
+ * Minor bugfix, now working with IE8 too!
36
+
37
+ = 1.0 =
38
+ * First stable version of plugin.
39
 
40
  == Installation ==
41