Skip to content

Commit

Permalink
Merge for Release 3.3.12 (#61) from short-pixel-optimizer/release-3.3.12
Browse files Browse the repository at this point in the history
Release 3.3.12
  • Loading branch information
pdobrescu authored Apr 27, 2020
2 parents 34929c3 + 47aa341 commit 0eaa232
Show file tree
Hide file tree
Showing 7 changed files with 192 additions and 68 deletions.
8 changes: 7 additions & 1 deletion classes/emr-plugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,8 @@ public function plugin_actions()
*/
public function menu()
{
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'));
/* 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')); */
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'));
}

/**
Expand Down Expand Up @@ -136,6 +137,11 @@ public function route()

}

public function getPluginURL($path = '')
{
return plugins_url($path, EMR_ROOT_FILE);
}

/** register styles and scripts
*
* Nothing should ever by -enqueued- here, just registered.
Expand Down
53 changes: 49 additions & 4 deletions css/admin.css
Original file line number Diff line number Diff line change
Expand Up @@ -759,8 +759,11 @@
.ui-corner-br {
border-bottom-right-radius: 3px; }

.emr_upload_form form {
display: flex; }
.emr_upload_form form .upsell-wrapper {
margin-left: 10px; }
.emr_upload_form .wrapper {
margin: 15px 0;
padding: 18px;
border: 1px solid #ccc; }
.emr_upload_form .wrapper .section-header {
Expand All @@ -776,6 +779,7 @@
position: relative;
display: inline-block;
margin-right: 25px;
margin-bottom: 10px;
border: 1px solid #ddd;
vertical-align: top;
max-height: 500px; }
Expand Down Expand Up @@ -816,7 +820,9 @@
margin: 10px 0;
display: none; }
.emr_upload_form .form-error p, .emr_upload_form .form-warning p {
margin: 0; }
margin: 0;
font-size: 12px;
font-weight: 700; }
.emr_upload_form .form-warning {
border-left: 4px solid #ffb900; }
.emr_upload_form .option-flex-wrapper {
Expand Down Expand Up @@ -894,7 +900,46 @@
min-height: 270px;
border: 1px solid #ccc;
padding: 15px;
margin: 0 0 10px;
float: right; }
margin-bottom: 25px;
float: right;
clear: both; }
.emr_upload_form .shortpixel-notice h3 {
line-height: 1.3em; }
.emr_upload_form .shortpixel-notice.site-speed {
background-color: #dcfdff; }
.emr_upload_form .shortpixel-notice.site-speed .img-wrapper {
text-align: center;
margin: 0 0 25px 0; }
.emr_upload_form .shortpixel-notice.site-speed .img-wrapper img {
max-width: 140px;
max-height: 140px;
margin: 0; }
.emr_upload_form .shortpixel-notice.site-speed h3 {
color: #00d0e5;
font-size: 20px;
text-align: center;
margin: 0;
line-height: 1.3em; }
.emr_upload_form .shortpixel-notice.site-speed .button-wrapper {
text-align: center;
margin-top: 35px; }
.emr_upload_form .shortpixel-notice.site-speed .button-wrapper a {
background-color: #ff0000;
color: #fff;
display: inline-block;
padding: 8px;
text-decoration: none;
font-weight: 700;
font-size: 20px; }
.emr_upload_form .shortpixel-notice.site-speed .red {
color: #ff0000; }
@media (max-width: 1200px) {
.emr_upload_form .image_previews {
text-align: center; }
.emr_upload_form .option-flex-wrapper {
flex-direction: column; }
.emr_upload_form .option-flex-wrapper .options.wrapper {
margin-left: 0; } }
@media (max-width: 960px) {
.emr_upload_form .upsell-wrapper {
display: none; } }
5 changes: 2 additions & 3 deletions enable-media-replace.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
Plugin Name: Enable Media Replace
Plugin URI: https://wordpress.org/plugins/enable-media-replace/
Description: Enable replacing media files by uploading a new file in the "Edit Media" section of the WordPress Media Library.
Version: 3.3.11
Version: 3.3.12
Author: ShortPixel
Author URI: https://shortpixel.com
Text Domain: enable-media-replace
Expand All @@ -25,8 +25,7 @@
*/

namespace EnableMediaReplace;

define('EMR_VERSION', '3.3.11');
define('EMR_VERSION', '3.3.12');

if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly.
Expand Down
13 changes: 9 additions & 4 deletions js/emr_admin.js
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@
if ($('input[name="userfile"]').val().length > 0)
this.checkSubmit();
console.log('FileAPI not detected');
return;
return false;
}

var status = this.checkUpload(file);
Expand All @@ -103,12 +103,17 @@

$(preview).find('img').remove();
$(preview).removeClass('is_image not_image is_document');
var is_empty = false;

if (file !== null) /// file is null when empty, or error
{
target_is_image = (file.type.indexOf('image') >= 0) ? true : false;
target_type = file.type.trim();
}
else
{
is_empty = true;
}
// If image, load thumbnail and get dimensions.
if (file && target_is_image)
{
Expand Down Expand Up @@ -148,13 +153,13 @@
this.debug('Not image, media document');
}

if (target_type != source_type)
if (! is_empty && target_type != source_type)
{
this.debug(target_type + ' not ' + source_type);
this.warningFileType();
}

if (emr_options.allowed_mime.indexOf(target_type) == -1)
if (! is_empty && emr_options.allowed_mime.indexOf(target_type) == -1)
{
this.debug(target_type + ' not ' + ' in allowed types ');
this.warningMimeType();
Expand Down Expand Up @@ -193,7 +198,7 @@
{
$('.form-error').fadeOut();
$('.form-warning').fadeOut();
}
},
this.checkUpload = function(fileItem)
{
var maxsize = emr_options.maxfilesize;
Expand Down
8 changes: 7 additions & 1 deletion readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ Tags: replace, attachment, media, files, replace image, replace jpg, change medi
Requires at least: 4.9.7
Tested up to: 5.3.2
Requires PHP: 5.6
Stable tag: 3.3.11
Stable tag: 3.3.12

Easily replace any attached image/file by simply uploading a new file in the Media Library edit view - a real time saver!

Expand Down Expand Up @@ -47,6 +47,12 @@ If you want more control over the format used to display the time, you can use t

== Changelog ==

= 3.3.12 =

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.

= 3.3.11 =

Release date: 10th March 2020
Expand Down
75 changes: 72 additions & 3 deletions scss/admin.scss
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,19 @@

.emr_upload_form
{
form
{
display: flex; //editor and upsell
.upsell-wrapper
{
margin-left: 10px;
}
}


.wrapper
{
margin: 15px 0;
// margin: 15px 0;
padding: 18px;
border: 1px solid #ccc;

Expand All @@ -18,6 +28,8 @@
}
}



.image_chooser.wrapper
{
min-height: 350px;
Expand All @@ -29,6 +41,7 @@
position: relative;
display: inline-block;
margin-right: 25px;
margin-bottom: 10px;
border: 1px solid #ddd;
vertical-align: top;
max-height: 500px;
Expand Down Expand Up @@ -89,7 +102,11 @@
// display: inline-block;
margin: 10px 0;
display: none;
p { margin: 0; }
p {
margin: 0;
font-size: 12px;
font-weight: 700;
}

}
.form-warning
Expand Down Expand Up @@ -223,10 +240,62 @@
min-height: 270px;
border: 1px solid #ccc;
padding: 15px;
margin: 0 0 10px;
//margin: 0 0 10px 25px;
margin-bottom:25px;
float: right;
clear: both;
h3 {
line-height: 1.3em; // match size
}
&.site-speed
{
background-color: #dcfdff;
.img-wrapper
{
text-align: center;
margin: 0 0 25px 0;
img { max-width: 140px; max-height: 140px; margin: 0; }
}
h3 {
color: #00d0e5;
font-size: 20px;
text-align: center;
margin: 0;
line-height: 1.3em;
}
.button-wrapper
{
text-align: center;
margin-top: 35px;
a {
background-color: #ff0000;
color: #fff;
display: inline-block;
padding: 8px;
text-decoration: none;
font-weight: 700;
font-size: 20px;
}
}
.red { color: #ff0000; }

}
}

@media( max-width: 1200px)
{
.image_previews
{
text-align: center;
}
.option-flex-wrapper {
flex-direction: column;
.options.wrapper
{ margin-left: 0;}
}
}
@media (max-width: 960px)
{
.upsell-wrapper { display: none; }
}
} // emr_upload_form
Loading

0 comments on commit 0eaa232

Please sign in to comment.