From e8fb727d90e982ba649a733caf08506169d1c5af Mon Sep 17 00:00:00 2001 From: Simon Date: Sun, 23 Feb 2020 20:26:21 +0200 Subject: [PATCH 1/7] typo correction --- readme.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/readme.txt b/readme.txt index d1d7cd6..52c72a9 100644 --- a/readme.txt +++ b/readme.txt @@ -51,11 +51,11 @@ If you want more control over the format used to display the time, you can use t Release date: 23rd February 2020 * Fix issue with JSON encoded strings -* Language – 0 new strings added, 2 updated, 0 fuzzied, and 0 obsoleted +* Language – 0 new strings added, 0 updated, 0 fuzzied, and 0 obsoleted Release date: 19th February 2020 * Fix issue with search/replacing non-image attachments and query -* Language – 0 new strings added, 2 updated, 0 fuzzied, and 0 obsoleted +* Language – 0 new strings added, 0 updated, 0 fuzzied, and 0 obsoleted = 3.3.8 = From 2f65176ce9e4aa79bc5d27ffaaf18280a16d9568 Mon Sep 17 00:00:00 2001 From: Pedro Dobrescu Date: Tue, 10 Mar 2020 09:56:08 -0300 Subject: [PATCH 2/7] Update versions for updates branch --- enable-media-replace.php | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/enable-media-replace.php b/enable-media-replace.php index 48fa912..93a89b2 100644 --- a/enable-media-replace.php +++ b/enable-media-replace.php @@ -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-DEV01 Author: ShortPixel Author URI: https://shortpixel.com Text Domain: enable-media-replace @@ -25,8 +25,7 @@ */ namespace EnableMediaReplace; - -define('EMR_VERSION', '3.3.11'); +define('EMR_VERSION', '3.3.11-DEV01'); if ( ! defined( 'ABSPATH' ) ) { exit; // Exit if accessed directly. From 47d3669b43f982dac5a83b6d59de3cdcc3552280 Mon Sep 17 00:00:00 2001 From: Pedro Dobrescu Date: Tue, 10 Mar 2020 09:58:59 -0300 Subject: [PATCH 3/7] Update versions for updates branch --- enable-media-replace.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/enable-media-replace.php b/enable-media-replace.php index 93a89b2..4bbbf9a 100644 --- a/enable-media-replace.php +++ b/enable-media-replace.php @@ -25,7 +25,7 @@ */ namespace EnableMediaReplace; -define('EMR_VERSION', '3.3.11-DEV01'); +define('EMR_VERSION', '3.3.12-DEV01'); if ( ! defined( 'ABSPATH' ) ) { exit; // Exit if accessed directly. From ba406304b2c13ce14ac439a4ebbb53b04169a7cc Mon Sep 17 00:00:00 2001 From: Bas Schuiling Date: Tue, 21 Apr 2020 12:09:12 +0000 Subject: [PATCH 4/7] - New Advert. - Fixes - Now gives only 1 error when upload too large image --- classes/emr-plugin.php | 8 +++++++- css/admin.css | 33 +++++++++++++++++++++++++++++++-- js/emr_admin.js | 13 +++++++++---- readme.txt | 5 +++++ scss/admin.scss | 36 +++++++++++++++++++++++++++++++++++- views/popup.php | 11 ++++++++++- 6 files changed, 97 insertions(+), 9 deletions(-) diff --git a/classes/emr-plugin.php b/classes/emr-plugin.php index 8b382c6..b3c9f80 100644 --- a/classes/emr-plugin.php +++ b/classes/emr-plugin.php @@ -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')); } /** @@ -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. diff --git a/css/admin.css b/css/admin.css index 86593bc..e7196b7 100644 --- a/css/admin.css +++ b/css/admin.css @@ -894,7 +894,36 @@ min-height: 270px; border: 1px solid #ccc; padding: 15px; - margin: 0 0 10px; - float: right; } + margin: 0 0 10px 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; } diff --git a/js/emr_admin.js b/js/emr_admin.js index d80cbc2..a7254c1 100644 --- a/js/emr_admin.js +++ b/js/emr_admin.js @@ -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); @@ -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) { @@ -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(); @@ -193,7 +198,7 @@ { $('.form-error').fadeOut(); $('.form-warning').fadeOut(); - } + }, this.checkUpload = function(fileItem) { var maxsize = emr_options.maxfilesize; diff --git a/readme.txt b/readme.txt index 2501e8e..de9bf24 100644 --- a/readme.txt +++ b/readme.txt @@ -47,6 +47,11 @@ If you want more control over the format used to display the time, you can use t == Changelog == += 3.3.12 = + + +* Fixed - When trying to upload over-limit file would show too many error messages + = 3.3.11 = Release date: 10th March 2020 diff --git a/scss/admin.scss b/scss/admin.scss index b0ebe4a..3984a68 100644 --- a/scss/admin.scss +++ b/scss/admin.scss @@ -223,10 +223,44 @@ min-height: 270px; border: 1px solid #ccc; padding: 15px; - margin: 0 0 10px; + margin: 0 0 10px 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; } + + } } } // emr_upload_form diff --git a/views/popup.php b/views/popup.php index 169b29b..bc07fa2 100644 --- a/views/popup.php +++ b/views/popup.php @@ -50,6 +50,8 @@ $uiHelper->setPreviewSizes(); $uiHelper->setSourceSizes($attachment_id); +$emr = EnableMediaReplacePlugin::get(); + //Log::addDebug('Popup view Data', array('id' => $attachment_id, 'source_mime' => $source_mime, 'filepath' => $filepath)); ?> @@ -106,12 +108,19 @@
+
+

ShortPixel

+

', '
','
', '',''); ?>

+ ','
','
'); ?>

+

+
+

%s','enable-media-replace'), size_format(wp_max_upload_size() ) ) ?>

From 8509218524bdb2b49b4820a334c55e313c7b1243 Mon Sep 17 00:00:00 2001 From: Bas Schuiling Date: Wed, 22 Apr 2020 12:49:50 +0000 Subject: [PATCH 5/7] Upsell fixes --- css/admin.css | 22 ++++++++-- scss/admin.scss | 41 +++++++++++++++++-- views/popup.php | 105 +++++++++++++++++++++--------------------------- 3 files changed, 102 insertions(+), 66 deletions(-) diff --git a/css/admin.css b/css/admin.css index e7196b7..b721162 100644 --- a/css/admin.css +++ b/css/admin.css @@ -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 { @@ -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; } @@ -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 { @@ -894,7 +900,7 @@ min-height: 270px; border: 1px solid #ccc; padding: 15px; - margin: 0 0 10px 25px; + margin-bottom: 25px; float: right; clear: both; } .emr_upload_form .shortpixel-notice h3 { @@ -927,3 +933,13 @@ 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; } } diff --git a/scss/admin.scss b/scss/admin.scss index 3984a68..8fd9c1f 100644 --- a/scss/admin.scss +++ b/scss/admin.scss @@ -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; @@ -18,6 +28,8 @@ } } + + .image_chooser.wrapper { min-height: 350px; @@ -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; @@ -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 @@ -223,7 +240,8 @@ min-height: 270px; border: 1px solid #ccc; padding: 15px; - margin: 0 0 10px 25px; + //margin: 0 0 10px 25px; + margin-bottom:25px; float: right; clear: both; h3 { @@ -263,4 +281,21 @@ } } + + @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 diff --git a/views/popup.php b/views/popup.php index bc07fa2..1f8dd85 100644 --- a/views/popup.php +++ b/views/popup.php @@ -26,11 +26,6 @@ $table_name = $wpdb->prefix . "posts"; -Log::addDebug('Load Popup Form View'); - -//$sql = "SELECT guid, post_mime_type FROM $table_name WHERE ID = " . (int) $_GET["attachment_id"]; -//list($current_filename, $current_filetype) = $wpdb->get_row($sql, ARRAY_N); - $attachment_id = intval($_GET['attachment_id']); $attachment = get_post($attachment_id); $replacer = new Replacer($attachment_id); @@ -41,31 +36,14 @@ $filetype = $file->getFileExtension(); $source_mime = get_post_mime_type($attachment_id); -/*$filepath = get_attached_file($attachment_id); // fullpath -$filetype = $attachment->post_mime_type; -$filename = basename($filepath); - */ - $uiHelper = new UIHelper(); $uiHelper->setPreviewSizes(); $uiHelper->setSourceSizes($attachment_id); $emr = EnableMediaReplacePlugin::get(); -//Log::addDebug('Popup view Data', array('id' => $attachment_id, 'source_mime' => $source_mime, 'filepath' => $filepath)); - ?> - +

@@ -79,49 +57,14 @@ ?>
+ +
-

- -
-

- - - -

-
- - - -
-
- -
-
- - - -
-
-
- -
-

ShortPixel

-

', '
','
', '',''); ?>

- ','
','
'); ?>

-

-
- -

%s','enable-media-replace'), size_format(wp_max_upload_size() ) ) ?>

', ''); ?>

@@ -154,6 +97,7 @@
+
@@ -223,6 +167,47 @@ class='emr_datepicker' />
" /> +
+
+ + + + +
+ +
+

+ + + +

+
+ + + +
+
+ +
+
+ + + +
+
+
+ +
+

ShortPixel

+

', '
','
', '',''); ?>

+ ','
','
'); ?>

+

+
From d229e18e05ed85accadebda35707e7a0b1d35b9e Mon Sep 17 00:00:00 2001 From: Pedro Dobrescu Date: Mon, 27 Apr 2020 13:41:07 -0300 Subject: [PATCH 6/7] Update the text for WSO ad. --- views/popup.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/views/popup.php b/views/popup.php index 1f8dd85..9264bc6 100644 --- a/views/popup.php +++ b/views/popup.php @@ -205,7 +205,7 @@ class='emr_datepicker' />

ShortPixel

', '
','
', '',''); ?>

- ','
','
'); ?>

+ ','
','
'); ?>

From 47aa341ceb27ff8b488521c9f90f6b71c94bec81 Mon Sep 17 00:00:00 2001 From: Pedro Dobrescu Date: Mon, 27 Apr 2020 13:58:53 -0300 Subject: [PATCH 7/7] Update version numbers --- enable-media-replace.php | 4 ++-- readme.txt | 11 ++++++----- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/enable-media-replace.php b/enable-media-replace.php index 4bbbf9a..0f4769a 100644 --- a/enable-media-replace.php +++ b/enable-media-replace.php @@ -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.12-DEV01 +Version: 3.3.12 Author: ShortPixel Author URI: https://shortpixel.com Text Domain: enable-media-replace @@ -25,7 +25,7 @@ */ namespace EnableMediaReplace; -define('EMR_VERSION', '3.3.12-DEV01'); +define('EMR_VERSION', '3.3.12'); if ( ! defined( 'ABSPATH' ) ) { exit; // Exit if accessed directly. diff --git a/readme.txt b/readme.txt index de9bf24..6fb1848 100644 --- a/readme.txt +++ b/readme.txt @@ -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! @@ -49,8 +49,9 @@ If you want more control over the format used to display the time, you can use t = 3.3.12 = - -* Fixed - When trying to upload over-limit file would show too many error messages +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 = @@ -66,11 +67,11 @@ Release date: 23rd February 2020 Release date: 23rd February 2020 * Fix issue with JSON encoded strings -* Language – 0 new strings added, 0 updated, 0 fuzzied, and 0 obsoleted +* Language – 0 new strings added, 2 updated, 0 fuzzied, and 0 obsoleted Release date: 19th February 2020 * Fix issue with search/replacing non-image attachments and query -* Language – 0 new strings added, 0 updated, 0 fuzzied, and 0 obsoleted +* Language – 0 new strings added, 2 updated, 0 fuzzied, and 0 obsoleted = 3.3.8 =