Enable Media Replace - Version 2.0.1

Version Description

  • Added support for SSL admin
Download this release

Release Info

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

Code changes from version 2.0 to 2.0.1

Files changed (4) hide show
  1. enable-media-replace.php +4 -1
  2. popup.php +8 -1
  3. readme.txt +3 -0
  4. upload.php +6 -2
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.0
7
Author: Måns Jonasson
8
Author URI: http://www.mansjonasson.se
9
@@ -35,6 +35,9 @@ function enable_media_replace_init() {
35
function enable_media_replace( $form_fields, $post ) {
36
if ($_GET["attachment_id"]) {
37
$editurl = get_bloginfo("wpurl") . "/wp-admin/upload.php?page=enable-media-replace/enable-media-replace.php&attachment_id={$_GET["attachment_id"]}";
38
$link = "href=\"$editurl\"";
39
$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"));
40
}
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.0.1
7
Author: Måns Jonasson
8
Author URI: http://www.mansjonasson.se
9
35
function enable_media_replace( $form_fields, $post ) {
36
if ($_GET["attachment_id"]) {
37
$editurl = get_bloginfo("wpurl") . "/wp-admin/upload.php?page=enable-media-replace/enable-media-replace.php&attachment_id={$_GET["attachment_id"]}";
38
+ if (FORCE_SSL_ADMIN) {
39
+ $editurl = str_replace("http:", "https:", $editurl);
40
+ }
41
$link = "href=\"$editurl\"";
42
$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"));
43
}
popup.php CHANGED
@@ -21,7 +21,14 @@ $current_filename = substr($current_filename, (strrpos($current_filename, "/") +
21
<div id="icon-upload" class="icon32"><br /></div>
22
<h2><?php echo __("Replace Media Upload", "enable-media-replace"); ?></h2>
23
24
- <form enctype="multipart/form-data" method="post" action="<?php echo get_bloginfo("wpurl") . "/wp-content/plugins/enable-media-replace/upload.php"; ?>">
25
<input type="hidden" name="ID" value="<?php echo $_GET["attachment_id"]; ?>" />
26
<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>
27
21
<div id="icon-upload" class="icon32"><br /></div>
22
<h2><?php echo __("Replace Media Upload", "enable-media-replace"); ?></h2>
23
24
+ <?php
25
+ $formurl = get_bloginfo("wpurl") . "/wp-content/plugins/enable-media-replace/upload.php";
26
+ if (FORCE_SSL_ADMIN) {
27
+ $forumurl = str_replace("http:", "https:", $formurl);
28
+ }
29
+ ?>
30
+
31
+ <form enctype="multipart/form-data" method="post" action="<?php echo $formurl; ?>">
32
<input type="hidden" name="ID" value="<?php echo $_GET["attachment_id"]; ?>" />
33
<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>
34
readme.txt CHANGED
@@ -22,6 +22,9 @@ This plugin is very powerful and a must-have for any larger sites built with Wor
22
23
== Changelog ==
24
25
= 2.0 =
26
* Replaced popup with inline navigation when replacing media
27
* Added instructions in admin link under Media
22
23
== Changelog ==
24
25
+ = 2.0.1 =
26
+ * Added support for SSL admin
27
+
28
= 2.0 =
29
* Replaced popup with inline navigation when replacing media
30
* Added instructions in admin link under Media
upload.php CHANGED
@@ -106,7 +106,11 @@ if (is_uploaded_file($_FILES["userfile"]["tmp_name"])) {
106
107
}
108
109
- #header("Location: " . get_bloginfo("wpurl") . "/wp-admin/media.php?attachment_id={$_POST["ID"]}&action=edit");
110
- header("Location: " . get_bloginfo("wpurl") . "/wp-admin/upload.php?posted=3");
111
112
?>
106
107
}
108
109
+ $returnurl = get_bloginfo("wpurl") . "/wp-admin/upload.php?posted=3";
110
+ if (FORCE_SSL_ADMIN) {
111
+ $returnurl = str_replace("http:", "https:", $returnurl);
112
+ }
113
+
114
+ header("Location: " . $returnurl);
115
116
?>