Version Description
Release date: 27th April 2020 * Fixed - When trying to upload over-limit file would show too many error messages; * Language 2 new strings added, 0 updated, 0 fuzzied, and 0 obsoleted.
Download this release
Release Info
Developer | petredobrescu |
Plugin | Enable Media Replace |
Version | 3.3.12 |
Comparing to | |
See all releases |
Code changes from version 3.3.11 to 3.3.12
- classes/emr-plugin.php +7 -1
- css/admin.css +49 -4
- enable-media-replace.php +2 -3
- js/emr_admin.js +9 -4
- readme.txt +8 -2
- scss/admin.scss +72 -3
- views/popup.php +46 -52
classes/emr-plugin.php
CHANGED
@@ -78,7 +78,8 @@ class EnableMediaReplacePlugin
|
|
78 |
*/
|
79 |
public function menu()
|
80 |
{
|
81 |
-
add_submenu_page(null, esc_html__("Replace media", "enable-media-replace"), esc_html__("Replace media", "enable-media-replace"), 'upload_files', 'enable-media-replace/enable-media-replace', array($this, 'route'));
|
|
|
82 |
}
|
83 |
|
84 |
/**
|
@@ -136,6 +137,11 @@ class EnableMediaReplacePlugin
|
|
136 |
|
137 |
}
|
138 |
|
|
|
|
|
|
|
|
|
|
|
139 |
/** register styles and scripts
|
140 |
*
|
141 |
* Nothing should ever by -enqueued- here, just registered.
|
78 |
*/
|
79 |
public function menu()
|
80 |
{
|
81 |
+
/* add_submenu_page(null, esc_html__("Replace media", "enable-media-replace"), esc_html__("Replace media", "enable-media-replace"), 'upload_files', 'enable-media-replace/enable-media-replace', array($this, 'route')); */
|
82 |
+
add_submenu_page(null, esc_html__("Replace media", "enable-media-replace"), esc_html__("Replace media", "enable-media-replace"), 'upload_files', 'enable-media-replace/enable-media-replace', array($this, 'route'));
|
83 |
}
|
84 |
|
85 |
/**
|
137 |
|
138 |
}
|
139 |
|
140 |
+
public function getPluginURL($path = '')
|
141 |
+
{
|
142 |
+
return plugins_url($path, EMR_ROOT_FILE);
|
143 |
+
}
|
144 |
+
|
145 |
/** register styles and scripts
|
146 |
*
|
147 |
* Nothing should ever by -enqueued- here, just registered.
|
css/admin.css
CHANGED
@@ -759,8 +759,11 @@
|
|
759 |
.ui-corner-br {
|
760 |
border-bottom-right-radius: 3px; }
|
761 |
|
|
|
|
|
|
|
|
|
762 |
.emr_upload_form .wrapper {
|
763 |
-
margin: 15px 0;
|
764 |
padding: 18px;
|
765 |
border: 1px solid #ccc; }
|
766 |
.emr_upload_form .wrapper .section-header {
|
@@ -776,6 +779,7 @@
|
|
776 |
position: relative;
|
777 |
display: inline-block;
|
778 |
margin-right: 25px;
|
|
|
779 |
border: 1px solid #ddd;
|
780 |
vertical-align: top;
|
781 |
max-height: 500px; }
|
@@ -816,7 +820,9 @@
|
|
816 |
margin: 10px 0;
|
817 |
display: none; }
|
818 |
.emr_upload_form .form-error p, .emr_upload_form .form-warning p {
|
819 |
-
margin: 0;
|
|
|
|
|
820 |
.emr_upload_form .form-warning {
|
821 |
border-left: 4px solid #ffb900; }
|
822 |
.emr_upload_form .option-flex-wrapper {
|
@@ -894,7 +900,46 @@
|
|
894 |
min-height: 270px;
|
895 |
border: 1px solid #ccc;
|
896 |
padding: 15px;
|
897 |
-
margin:
|
898 |
-
float: right;
|
|
|
899 |
.emr_upload_form .shortpixel-notice h3 {
|
900 |
line-height: 1.3em; }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
759 |
.ui-corner-br {
|
760 |
border-bottom-right-radius: 3px; }
|
761 |
|
762 |
+
.emr_upload_form form {
|
763 |
+
display: flex; }
|
764 |
+
.emr_upload_form form .upsell-wrapper {
|
765 |
+
margin-left: 10px; }
|
766 |
.emr_upload_form .wrapper {
|
|
|
767 |
padding: 18px;
|
768 |
border: 1px solid #ccc; }
|
769 |
.emr_upload_form .wrapper .section-header {
|
779 |
position: relative;
|
780 |
display: inline-block;
|
781 |
margin-right: 25px;
|
782 |
+
margin-bottom: 10px;
|
783 |
border: 1px solid #ddd;
|
784 |
vertical-align: top;
|
785 |
max-height: 500px; }
|
820 |
margin: 10px 0;
|
821 |
display: none; }
|
822 |
.emr_upload_form .form-error p, .emr_upload_form .form-warning p {
|
823 |
+
margin: 0;
|
824 |
+
font-size: 12px;
|
825 |
+
font-weight: 700; }
|
826 |
.emr_upload_form .form-warning {
|
827 |
border-left: 4px solid #ffb900; }
|
828 |
.emr_upload_form .option-flex-wrapper {
|
900 |
min-height: 270px;
|
901 |
border: 1px solid #ccc;
|
902 |
padding: 15px;
|
903 |
+
margin-bottom: 25px;
|
904 |
+
float: right;
|
905 |
+
clear: both; }
|
906 |
.emr_upload_form .shortpixel-notice h3 {
|
907 |
line-height: 1.3em; }
|
908 |
+
.emr_upload_form .shortpixel-notice.site-speed {
|
909 |
+
background-color: #dcfdff; }
|
910 |
+
.emr_upload_form .shortpixel-notice.site-speed .img-wrapper {
|
911 |
+
text-align: center;
|
912 |
+
margin: 0 0 25px 0; }
|
913 |
+
.emr_upload_form .shortpixel-notice.site-speed .img-wrapper img {
|
914 |
+
max-width: 140px;
|
915 |
+
max-height: 140px;
|
916 |
+
margin: 0; }
|
917 |
+
.emr_upload_form .shortpixel-notice.site-speed h3 {
|
918 |
+
color: #00d0e5;
|
919 |
+
font-size: 20px;
|
920 |
+
text-align: center;
|
921 |
+
margin: 0;
|
922 |
+
line-height: 1.3em; }
|
923 |
+
.emr_upload_form .shortpixel-notice.site-speed .button-wrapper {
|
924 |
+
text-align: center;
|
925 |
+
margin-top: 35px; }
|
926 |
+
.emr_upload_form .shortpixel-notice.site-speed .button-wrapper a {
|
927 |
+
background-color: #ff0000;
|
928 |
+
color: #fff;
|
929 |
+
display: inline-block;
|
930 |
+
padding: 8px;
|
931 |
+
text-decoration: none;
|
932 |
+
font-weight: 700;
|
933 |
+
font-size: 20px; }
|
934 |
+
.emr_upload_form .shortpixel-notice.site-speed .red {
|
935 |
+
color: #ff0000; }
|
936 |
+
@media (max-width: 1200px) {
|
937 |
+
.emr_upload_form .image_previews {
|
938 |
+
text-align: center; }
|
939 |
+
.emr_upload_form .option-flex-wrapper {
|
940 |
+
flex-direction: column; }
|
941 |
+
.emr_upload_form .option-flex-wrapper .options.wrapper {
|
942 |
+
margin-left: 0; } }
|
943 |
+
@media (max-width: 960px) {
|
944 |
+
.emr_upload_form .upsell-wrapper {
|
945 |
+
display: none; } }
|
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.3.
|
7 |
Author: ShortPixel
|
8 |
Author URI: https://shortpixel.com
|
9 |
Text Domain: enable-media-replace
|
@@ -25,8 +25,7 @@ http://www.gnu.org/licenses/gpl.html
|
|
25 |
*/
|
26 |
|
27 |
namespace EnableMediaReplace;
|
28 |
-
|
29 |
-
define('EMR_VERSION', '3.3.11');
|
30 |
|
31 |
if ( ! defined( 'ABSPATH' ) ) {
|
32 |
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.3.12
|
7 |
Author: ShortPixel
|
8 |
Author URI: https://shortpixel.com
|
9 |
Text Domain: enable-media-replace
|
25 |
*/
|
26 |
|
27 |
namespace EnableMediaReplace;
|
28 |
+
define('EMR_VERSION', '3.3.12');
|
|
|
29 |
|
30 |
if ( ! defined( 'ABSPATH' ) ) {
|
31 |
exit; // Exit if accessed directly.
|
js/emr_admin.js
CHANGED
@@ -82,7 +82,7 @@
|
|
82 |
if ($('input[name="userfile"]').val().length > 0)
|
83 |
this.checkSubmit();
|
84 |
console.log('FileAPI not detected');
|
85 |
-
return;
|
86 |
}
|
87 |
|
88 |
var status = this.checkUpload(file);
|
@@ -103,12 +103,17 @@
|
|
103 |
|
104 |
$(preview).find('img').remove();
|
105 |
$(preview).removeClass('is_image not_image is_document');
|
|
|
106 |
|
107 |
if (file !== null) /// file is null when empty, or error
|
108 |
{
|
109 |
target_is_image = (file.type.indexOf('image') >= 0) ? true : false;
|
110 |
target_type = file.type.trim();
|
111 |
}
|
|
|
|
|
|
|
|
|
112 |
// If image, load thumbnail and get dimensions.
|
113 |
if (file && target_is_image)
|
114 |
{
|
@@ -148,13 +153,13 @@
|
|
148 |
this.debug('Not image, media document');
|
149 |
}
|
150 |
|
151 |
-
if (target_type != source_type)
|
152 |
{
|
153 |
this.debug(target_type + ' not ' + source_type);
|
154 |
this.warningFileType();
|
155 |
}
|
156 |
|
157 |
-
if (emr_options.allowed_mime.indexOf(target_type) == -1)
|
158 |
{
|
159 |
this.debug(target_type + ' not ' + ' in allowed types ');
|
160 |
this.warningMimeType();
|
@@ -193,7 +198,7 @@
|
|
193 |
{
|
194 |
$('.form-error').fadeOut();
|
195 |
$('.form-warning').fadeOut();
|
196 |
-
}
|
197 |
this.checkUpload = function(fileItem)
|
198 |
{
|
199 |
var maxsize = emr_options.maxfilesize;
|
82 |
if ($('input[name="userfile"]').val().length > 0)
|
83 |
this.checkSubmit();
|
84 |
console.log('FileAPI not detected');
|
85 |
+
return false;
|
86 |
}
|
87 |
|
88 |
var status = this.checkUpload(file);
|
103 |
|
104 |
$(preview).find('img').remove();
|
105 |
$(preview).removeClass('is_image not_image is_document');
|
106 |
+
var is_empty = false;
|
107 |
|
108 |
if (file !== null) /// file is null when empty, or error
|
109 |
{
|
110 |
target_is_image = (file.type.indexOf('image') >= 0) ? true : false;
|
111 |
target_type = file.type.trim();
|
112 |
}
|
113 |
+
else
|
114 |
+
{
|
115 |
+
is_empty = true;
|
116 |
+
}
|
117 |
// If image, load thumbnail and get dimensions.
|
118 |
if (file && target_is_image)
|
119 |
{
|
153 |
this.debug('Not image, media document');
|
154 |
}
|
155 |
|
156 |
+
if (! is_empty && target_type != source_type)
|
157 |
{
|
158 |
this.debug(target_type + ' not ' + source_type);
|
159 |
this.warningFileType();
|
160 |
}
|
161 |
|
162 |
+
if (! is_empty && emr_options.allowed_mime.indexOf(target_type) == -1)
|
163 |
{
|
164 |
this.debug(target_type + ' not ' + ' in allowed types ');
|
165 |
this.warningMimeType();
|
198 |
{
|
199 |
$('.form-error').fadeOut();
|
200 |
$('.form-warning').fadeOut();
|
201 |
+
},
|
202 |
this.checkUpload = function(fileItem)
|
203 |
{
|
204 |
var maxsize = emr_options.maxfilesize;
|
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.
|
7 |
Requires PHP: 5.6
|
8 |
-
Stable tag: 3.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 |
|
@@ -47,6 +47,12 @@ If you want more control over the format used to display the time, you can use t
|
|
47 |
|
48 |
== Changelog ==
|
49 |
|
|
|
|
|
|
|
|
|
|
|
|
|
50 |
= 3.3.11 =
|
51 |
|
52 |
Release date: 10th March 2020
|
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.4
|
7 |
Requires PHP: 5.6
|
8 |
+
Stable tag: 3.3.12
|
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 |
|
47 |
|
48 |
== Changelog ==
|
49 |
|
50 |
+
= 3.3.12 =
|
51 |
+
|
52 |
+
Release date: 27th April 2020
|
53 |
+
* Fixed - When trying to upload over-limit file would show too many error messages;
|
54 |
+
* Language – 2 new strings added, 0 updated, 0 fuzzied, and 0 obsoleted.
|
55 |
+
|
56 |
= 3.3.11 =
|
57 |
|
58 |
Release date: 10th March 2020
|
scss/admin.scss
CHANGED
@@ -2,9 +2,19 @@
|
|
2 |
|
3 |
.emr_upload_form
|
4 |
{
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
5 |
.wrapper
|
6 |
{
|
7 |
-
margin: 15px 0;
|
8 |
padding: 18px;
|
9 |
border: 1px solid #ccc;
|
10 |
|
@@ -18,6 +28,8 @@
|
|
18 |
}
|
19 |
}
|
20 |
|
|
|
|
|
21 |
.image_chooser.wrapper
|
22 |
{
|
23 |
min-height: 350px;
|
@@ -29,6 +41,7 @@
|
|
29 |
position: relative;
|
30 |
display: inline-block;
|
31 |
margin-right: 25px;
|
|
|
32 |
border: 1px solid #ddd;
|
33 |
vertical-align: top;
|
34 |
max-height: 500px;
|
@@ -89,7 +102,11 @@
|
|
89 |
// display: inline-block;
|
90 |
margin: 10px 0;
|
91 |
display: none;
|
92 |
-
p {
|
|
|
|
|
|
|
|
|
93 |
|
94 |
}
|
95 |
.form-warning
|
@@ -223,10 +240,62 @@
|
|
223 |
min-height: 270px;
|
224 |
border: 1px solid #ccc;
|
225 |
padding: 15px;
|
226 |
-
margin: 0 0 10px;
|
|
|
227 |
float: right;
|
|
|
228 |
h3 {
|
229 |
line-height: 1.3em; // match size
|
230 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
231 |
}
|
232 |
} // emr_upload_form
|
2 |
|
3 |
.emr_upload_form
|
4 |
{
|
5 |
+
form
|
6 |
+
{
|
7 |
+
display: flex; //editor and upsell
|
8 |
+
.upsell-wrapper
|
9 |
+
{
|
10 |
+
margin-left: 10px;
|
11 |
+
}
|
12 |
+
}
|
13 |
+
|
14 |
+
|
15 |
.wrapper
|
16 |
{
|
17 |
+
// margin: 15px 0;
|
18 |
padding: 18px;
|
19 |
border: 1px solid #ccc;
|
20 |
|
28 |
}
|
29 |
}
|
30 |
|
31 |
+
|
32 |
+
|
33 |
.image_chooser.wrapper
|
34 |
{
|
35 |
min-height: 350px;
|
41 |
position: relative;
|
42 |
display: inline-block;
|
43 |
margin-right: 25px;
|
44 |
+
margin-bottom: 10px;
|
45 |
border: 1px solid #ddd;
|
46 |
vertical-align: top;
|
47 |
max-height: 500px;
|
102 |
// display: inline-block;
|
103 |
margin: 10px 0;
|
104 |
display: none;
|
105 |
+
p {
|
106 |
+
margin: 0;
|
107 |
+
font-size: 12px;
|
108 |
+
font-weight: 700;
|
109 |
+
}
|
110 |
|
111 |
}
|
112 |
.form-warning
|
240 |
min-height: 270px;
|
241 |
border: 1px solid #ccc;
|
242 |
padding: 15px;
|
243 |
+
//margin: 0 0 10px 25px;
|
244 |
+
margin-bottom:25px;
|
245 |
float: right;
|
246 |
+
clear: both;
|
247 |
h3 {
|
248 |
line-height: 1.3em; // match size
|
249 |
}
|
250 |
+
&.site-speed
|
251 |
+
{
|
252 |
+
background-color: #dcfdff;
|
253 |
+
.img-wrapper
|
254 |
+
{
|
255 |
+
text-align: center;
|
256 |
+
margin: 0 0 25px 0;
|
257 |
+
img { max-width: 140px; max-height: 140px; margin: 0; }
|
258 |
+
}
|
259 |
+
h3 {
|
260 |
+
color: #00d0e5;
|
261 |
+
font-size: 20px;
|
262 |
+
text-align: center;
|
263 |
+
margin: 0;
|
264 |
+
line-height: 1.3em;
|
265 |
+
}
|
266 |
+
.button-wrapper
|
267 |
+
{
|
268 |
+
text-align: center;
|
269 |
+
margin-top: 35px;
|
270 |
+
a {
|
271 |
+
background-color: #ff0000;
|
272 |
+
color: #fff;
|
273 |
+
display: inline-block;
|
274 |
+
padding: 8px;
|
275 |
+
text-decoration: none;
|
276 |
+
font-weight: 700;
|
277 |
+
font-size: 20px;
|
278 |
+
}
|
279 |
+
}
|
280 |
+
.red { color: #ff0000; }
|
281 |
+
|
282 |
+
}
|
283 |
+
}
|
284 |
+
|
285 |
+
@media( max-width: 1200px)
|
286 |
+
{
|
287 |
+
.image_previews
|
288 |
+
{
|
289 |
+
text-align: center;
|
290 |
+
}
|
291 |
+
.option-flex-wrapper {
|
292 |
+
flex-direction: column;
|
293 |
+
.options.wrapper
|
294 |
+
{ margin-left: 0;}
|
295 |
+
}
|
296 |
+
}
|
297 |
+
@media (max-width: 960px)
|
298 |
+
{
|
299 |
+
.upsell-wrapper { display: none; }
|
300 |
}
|
301 |
} // emr_upload_form
|
views/popup.php
CHANGED
@@ -26,11 +26,6 @@ global $wpdb;
|
|
26 |
|
27 |
$table_name = $wpdb->prefix . "posts";
|
28 |
|
29 |
-
Log::addDebug('Load Popup Form View');
|
30 |
-
|
31 |
-
//$sql = "SELECT guid, post_mime_type FROM $table_name WHERE ID = " . (int) $_GET["attachment_id"];
|
32 |
-
//list($current_filename, $current_filetype) = $wpdb->get_row($sql, ARRAY_N);
|
33 |
-
|
34 |
$attachment_id = intval($_GET['attachment_id']);
|
35 |
$attachment = get_post($attachment_id);
|
36 |
$replacer = new Replacer($attachment_id);
|
@@ -41,29 +36,14 @@ $filename = $file->getFileName();
|
|
41 |
$filetype = $file->getFileExtension();
|
42 |
$source_mime = get_post_mime_type($attachment_id);
|
43 |
|
44 |
-
/*$filepath = get_attached_file($attachment_id); // fullpath
|
45 |
-
$filetype = $attachment->post_mime_type;
|
46 |
-
$filename = basename($filepath);
|
47 |
-
*/
|
48 |
-
|
49 |
$uiHelper = new UIHelper();
|
50 |
$uiHelper->setPreviewSizes();
|
51 |
$uiHelper->setSourceSizes($attachment_id);
|
52 |
|
53 |
-
|
54 |
|
55 |
?>
|
56 |
-
|
57 |
-
.emr-plugin-button.emr-updating:before {
|
58 |
-
font: 400 20px/1 dashicons;
|
59 |
-
display: inline-block;
|
60 |
-
content: "\f463";
|
61 |
-
-webkit-animation: rotation 2s infinite linear;
|
62 |
-
animation: rotation 2s infinite linear;
|
63 |
-
margin: 3px 5px 0 -2px;
|
64 |
-
vertical-align: top
|
65 |
-
}
|
66 |
-
</style>
|
67 |
<div class="wrap emr_upload_form">
|
68 |
<h1><?php echo esc_html__("Replace Media Upload", "enable-media-replace"); ?></h1>
|
69 |
|
@@ -77,42 +57,14 @@ $url = $uiHelper->getFormUrl($attachment_id);
|
|
77 |
?>
|
78 |
|
79 |
<form enctype="multipart/form-data" method="POST" action="<?php echo $formurl; ?>">
|
|
|
|
|
80 |
<section class='image_chooser wrapper'>
|
81 |
<div class='section-header'> <?php _e('Choose Replacement Media', 'enable-replace-media'); ?></div>
|
82 |
|
83 |
-
<?php
|
84 |
-
#wp_nonce_field('enable-media-replace');
|
85 |
-
$plugins = get_plugins();
|
86 |
-
$spInstalled = isset($plugins['shortpixel-image-optimiser/wp-shortpixel.php']);
|
87 |
-
$spActive = is_plugin_active('shortpixel-image-optimiser/wp-shortpixel.php');
|
88 |
-
?>
|
89 |
<input type="hidden" name="ID" value="<?php echo $attachment_id ?>" />
|
90 |
<div id="message" class="updated notice notice-success is-dismissible"><p><?php printf( esc_html__('NOTE: You are about to replace the media file "%s". There is no undo. Think about it!', "enable-media-replace"), $filename ); ?></p></div>
|
91 |
|
92 |
-
<?php if(!$spInstalled) {?>
|
93 |
-
<div class='shortpixel-notice'>
|
94 |
-
<h3 class="" style="margin-top: 0;text-align: center;">
|
95 |
-
<a href="https://shortpixel.com/wp/af/VKG6LYN28044" target="_blank">
|
96 |
-
<?php echo esc_html__("Optimize your images with ShortPixel, get +50% credits!", "enable-media-replace"); ?>
|
97 |
-
</a>
|
98 |
-
</h3>
|
99 |
-
<div class="" style="text-align: center;">
|
100 |
-
<a href="https://shortpixel.com/wp/af/VKG6LYN28044" target="_blank">
|
101 |
-
<img src="https://optimizingmattersblog.files.wordpress.com/2016/10/shortpixel.png">
|
102 |
-
</a>
|
103 |
-
</div>
|
104 |
-
<div class="" style="margin-bottom: 10px;">
|
105 |
-
<?php echo esc_html__("Get more Google love by compressing your site's images! Check out how much ShortPixel can save your site and get +50% credits when signing up as an Enable Media Replace user! Forever!", "enable-media-replace"); ?>
|
106 |
-
</div>
|
107 |
-
<div class=""><div style="text-align: <?php echo (is_rtl()) ? 'left' : 'right' ?>;">
|
108 |
-
<a class="button button-primary" id="shortpixel-image-optimiser-info" href="https://shortpixel.com/wp/af/VKG6LYN28044" target="_blank">
|
109 |
-
<?php echo esc_html__("More info", "enable-media-replace"); ?></p>
|
110 |
-
</a>
|
111 |
-
</div>
|
112 |
-
</div>
|
113 |
-
</div>
|
114 |
-
<?php } ?>
|
115 |
-
|
116 |
<p><?php echo esc_html__("Choose a file to upload from your computer", "enable-media-replace"); ?></p>
|
117 |
<p><?php printf(__('Maximum file size: <strong>%s</strong>','enable-media-replace'), size_format(wp_max_upload_size() ) ) ?></p>
|
118 |
<div class='form-error filesize'><p><?php printf(__('%s f %s exceeds the maximum upload size for this site.', 'enable-media-replace'), '<span class="fn">', '</span>'); ?></p>
|
@@ -145,6 +97,7 @@ $url = $uiHelper->getFormUrl($attachment_id);
|
|
145 |
</div>
|
146 |
|
147 |
</section>
|
|
|
148 |
<div class='option-flex-wrapper'>
|
149 |
<section class='replace_type wrapper'>
|
150 |
<div class='section-header'> <?php _e('Replacement Options', 'enable-replace-media'); ?></div>
|
@@ -214,6 +167,47 @@ $url = $uiHelper->getFormUrl($attachment_id);
|
|
214 |
<section class='form_controls wrapper'>
|
215 |
<input id="submit" type="submit" class="button button-primary" disabled="disabled" value="<?php echo esc_attr__("Upload", "enable-media-replace"); ?>" />
|
216 |
<a href="#" class="button" onclick="history.back();"><?php echo esc_html__("Cancel", "enable-media-replace"); ?></a>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
217 |
</section>
|
218 |
</form>
|
219 |
</div>
|
26 |
|
27 |
$table_name = $wpdb->prefix . "posts";
|
28 |
|
|
|
|
|
|
|
|
|
|
|
29 |
$attachment_id = intval($_GET['attachment_id']);
|
30 |
$attachment = get_post($attachment_id);
|
31 |
$replacer = new Replacer($attachment_id);
|
36 |
$filetype = $file->getFileExtension();
|
37 |
$source_mime = get_post_mime_type($attachment_id);
|
38 |
|
|
|
|
|
|
|
|
|
|
|
39 |
$uiHelper = new UIHelper();
|
40 |
$uiHelper->setPreviewSizes();
|
41 |
$uiHelper->setSourceSizes($attachment_id);
|
42 |
|
43 |
+
$emr = EnableMediaReplacePlugin::get();
|
44 |
|
45 |
?>
|
46 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
47 |
<div class="wrap emr_upload_form">
|
48 |
<h1><?php echo esc_html__("Replace Media Upload", "enable-media-replace"); ?></h1>
|
49 |
|
57 |
?>
|
58 |
|
59 |
<form enctype="multipart/form-data" method="POST" action="<?php echo $formurl; ?>">
|
60 |
+
|
61 |
+
<div class='editor-wrapper'>
|
62 |
<section class='image_chooser wrapper'>
|
63 |
<div class='section-header'> <?php _e('Choose Replacement Media', 'enable-replace-media'); ?></div>
|
64 |
|
|
|
|
|
|
|
|
|
|
|
|
|
65 |
<input type="hidden" name="ID" value="<?php echo $attachment_id ?>" />
|
66 |
<div id="message" class="updated notice notice-success is-dismissible"><p><?php printf( esc_html__('NOTE: You are about to replace the media file "%s". There is no undo. Think about it!', "enable-media-replace"), $filename ); ?></p></div>
|
67 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
68 |
<p><?php echo esc_html__("Choose a file to upload from your computer", "enable-media-replace"); ?></p>
|
69 |
<p><?php printf(__('Maximum file size: <strong>%s</strong>','enable-media-replace'), size_format(wp_max_upload_size() ) ) ?></p>
|
70 |
<div class='form-error filesize'><p><?php printf(__('%s f %s exceeds the maximum upload size for this site.', 'enable-media-replace'), '<span class="fn">', '</span>'); ?></p>
|
97 |
</div>
|
98 |
|
99 |
</section>
|
100 |
+
|
101 |
<div class='option-flex-wrapper'>
|
102 |
<section class='replace_type wrapper'>
|
103 |
<div class='section-header'> <?php _e('Replacement Options', 'enable-replace-media'); ?></div>
|
167 |
<section class='form_controls wrapper'>
|
168 |
<input id="submit" type="submit" class="button button-primary" disabled="disabled" value="<?php echo esc_attr__("Upload", "enable-media-replace"); ?>" />
|
169 |
<a href="#" class="button" onclick="history.back();"><?php echo esc_html__("Cancel", "enable-media-replace"); ?></a>
|
170 |
+
</section>
|
171 |
+
</div>
|
172 |
+
|
173 |
+
|
174 |
+
<?php
|
175 |
+
#wp_nonce_field('enable-media-replace');
|
176 |
+
$plugins = get_plugins();
|
177 |
+
$spInstalled = isset($plugins['shortpixel-image-optimiser/wp-shortpixel.php']);
|
178 |
+
$spActive = is_plugin_active('shortpixel-image-optimiser/wp-shortpixel.php');
|
179 |
+
?>
|
180 |
+
|
181 |
+
<section class='upsell-wrapper'>
|
182 |
+
<?php if(! $spInstalled) {?>
|
183 |
+
<div class='shortpixel-notice'>
|
184 |
+
<h3 class="" style="margin-top: 0;text-align: center;">
|
185 |
+
<a href="https://shortpixel.com/wp/af/VKG6LYN28044" target="_blank">
|
186 |
+
<?php echo esc_html__("Optimize your images with ShortPixel, get +50% credits!", "enable-media-replace"); ?>
|
187 |
+
</a>
|
188 |
+
</h3>
|
189 |
+
<div class="" style="text-align: center;">
|
190 |
+
<a href="https://shortpixel.com/wp/af/VKG6LYN28044" target="_blank">
|
191 |
+
<img src="https://optimizingmattersblog.files.wordpress.com/2016/10/shortpixel.png">
|
192 |
+
</a>
|
193 |
+
</div>
|
194 |
+
<div class="" style="margin-bottom: 10px;">
|
195 |
+
<?php echo esc_html__("Get more Google love by compressing your site's images! Check out how much ShortPixel can save your site and get +50% credits when signing up as an Enable Media Replace user! Forever!", "enable-media-replace"); ?>
|
196 |
+
</div>
|
197 |
+
<div class=""><div style="text-align: <?php echo (is_rtl()) ? 'left' : 'right' ?>;">
|
198 |
+
<a class="button button-primary" id="shortpixel-image-optimiser-info" href="https://shortpixel.com/wp/af/VKG6LYN28044" target="_blank">
|
199 |
+
<?php echo esc_html__("More info", "enable-media-replace"); ?>
|
200 |
+
</a>
|
201 |
+
</div>
|
202 |
+
</div>
|
203 |
+
</div>
|
204 |
+
<?php } ?>
|
205 |
+
<div class='shortpixel-notice site-speed'>
|
206 |
+
<p class='img-wrapper'><img src="<?php echo $emr->getPluginURL('img/shortpixel.png'); ?>" alt='ShortPixel'></p>
|
207 |
+
<h3><?php printf(__('ARE YOU %s CONCERNED WITH %s YOUR %s %s SITE SPEED? %s', 'enable-media-replace'),'<br>', '<br>','<br>', '<span class="red">','</span>'); ?><br><br>
|
208 |
+
<?php printf(__('ALLOW ShortPixel %s SPECIALISTS TO %s FIND THE %s SOLUTION FOR YOU.', 'enable-media-replace'), '<br>','<br>','<br>'); ?></h3>
|
209 |
+
<p class='button-wrapper'><a href='https://shortpixel.com/lp/wso/?utm_source=EMR' target="_blank"><?php _e('FIND OUT MORE', 'enable-media-replace') ?></a></p>
|
210 |
+
</div>
|
211 |
</section>
|
212 |
</form>
|
213 |
</div>
|