Version Description
- Fixed - nonce issues when using Cache plugins.
- Fixed - German Translation for ( Drag & Drop File Upload ) text.
- Fixed - Submit button ( enable/disable ) when acceptance checkbox is added.
- Modified - File Upload error message ( display error code )
Download this release
Release Info
Developer | glenwpcoder |
Plugin | Drag and Drop Multiple File Upload – Contact Form 7 |
Version | 1.3.5 |
Comparing to | |
See all releases |
Code changes from version 1.3.4 to 1.3.5
- assets/js/codedropz-uploader-min.js +3 -3
- assets/js/dnd-upload-cf7.js +13 -9
- drag-n-drop-upload-cf7.php +2 -2
- inc/dnd-upload-cf7.php +10 -4
- languages/dnd-upload-cf7-de_DE.mo +0 -0
- languages/dnd-upload-cf7-de_DE.po +5 -5
- readme.txt +9 -3
assets/js/codedropz-uploader-min.js
CHANGED
@@ -1,11 +1,11 @@
|
|
1 |
/**
|
2 |
-
* CodeDropz Uploader v1.3.
|
3 |
* Copyright 2018 Glen Mongaya
|
4 |
* CodeDrop Drag&Drop Uploader
|
5 |
-
* @version 1.
|
6 |
* @author CodeDropz, Glen Don L. Mongaya
|
7 |
* @license The MIT License (MIT)
|
8 |
*/
|
9 |
|
10 |
// CodeDropz Drag and Drop Plugin
|
11 |
-
!function(e){e.fn.CodeDropz_Uploader=function(a){this.each(function(){var d=e(this),r=e.extend({handler:d,color:"#000",background:"",server_max_error:"Uploaded file exceeds the maximum upload size of your server.",max_file:d.data("max")?d.data("max"):10,max_upload_size:d.data("limit")?d.data("limit"):"
|
1 |
/**
|
2 |
+
* CodeDropz Uploader v1.3.5
|
3 |
* Copyright 2018 Glen Mongaya
|
4 |
* CodeDrop Drag&Drop Uploader
|
5 |
+
* @version 1.3.5
|
6 |
* @author CodeDropz, Glen Don L. Mongaya
|
7 |
* @license The MIT License (MIT)
|
8 |
*/
|
9 |
|
10 |
// CodeDropz Drag and Drop Plugin
|
11 |
+
!function(e){e.fn.CodeDropz_Uploader=function(a){this.each(function(){var d=e(this),r=e.extend({handler:d,color:"#000",background:"",server_max_error:"Uploaded file exceeds the maximum upload size of your server.",max_file:d.data("max")?d.data("max"):10,max_upload_size:d.data("limit")?d.data("limit"):"10485760",supported_type:d.data("type")?d.data("type"):"jpg|jpeg|JPG|png|gif|pdf|doc|docx|ppt|pptx|odt|avi|ogg|m4a|mov|mp3|mp4|mpg|wav|wmv|xls",text:"Drag & Drop Files Here",separator:"or",button_text:"Browse Files",on_success:""},a),o=d.data("name")+"_count_files";localStorage.setItem(o,1);var s='<div class="codedropz-upload-handler"><div class="codedropz-upload-container"><div class="codedropz-upload-inner"><h3>'+r.text+"</h3><span>"+r.separator+'</span><div class="codedropz-btn-wrap"><a class="cd-upload-btn" href="javascript:void(0)">'+r.button_text+'</a></div></div></div><span class="dnd-upload-counter"><span>0</span> of '+parseInt(r.max_file)+"</span></div>";r.handler.wrapAll('<div class="codedropz-upload-wrapper"></div>'),r.supported_type=r.supported_type.replace(/[^a-zA-Z0-9| ]/g,"");var t=r.handler.parents("form"),n=r.handler.parents(".codedropz-upload-wrapper"),p=e('input[type="submit"]',t);r.handler.after(s),e(".codedropz-upload-handler",n).on("drag dragstart dragend dragover dragenter dragleave drop",function(e){e.preventDefault(),e.stopPropagation()}),e(".codedropz-upload-handler",n).on("dragover dragenter",function(a){e(this).addClass("codedropz-dragover")}),e(".codedropz-upload-handler",n).on("dragleave dragend drop",function(a){e(this).removeClass("codedropz-dragover")}),e("a.cd-upload-btn",n).on("click",function(e){e.preventDefault(),r.handler.val(null),r.handler.click()}),e(".codedropz-upload-handler",n).on("drop",function(e){l(e.originalEvent.dataTransfer.files,"drop")}),r.handler.on("change",function(e){l(this.files,"click")});var l=function(a,s){if(!(!a.length>1)){var p=new FormData;p.append("supported_type",r.supported_type),p.append("size_limit",r.max_upload_size),p.append("action","dnd_codedropz_upload"),p.append("type",s),p.append("security",dnd_cf7_uploader.ajax_nonce),e("span.has-error",r.handler).remove(),e.each(a,function(a,s){if(void 0!==p.delete&&p.delete("upload-file"),localStorage.getItem(o)>r.max_file)return!e("span.has-error-msg",n).length>0&&(err_msg=dnd_cf7_uploader.drag_n_drop_upload.max_file_limit,n.append('<span class="has-error-msg">'+err_msg.replace("%count%",r.max_file)+"</span>")),!1;var l=i.createProgressBar(s),c=!1;if(s.size>r.max_upload_size&&(e(".dnd-upload-details",e("#"+l)).append('<span class="has-error">'+dnd_cf7_uploader.drag_n_drop_upload.large_file+"</span>"),c=!0),regex_type=new RegExp("(.*?).("+r.supported_type+")$"),!1!==c||regex_type.test(s.name.toLowerCase())||(e(".dnd-upload-details",e("#"+l)).append('<span class="has-error">'+dnd_cf7_uploader.drag_n_drop_upload.inavalid_type+"</span>"),c=!0),localStorage.setItem(o,Number(localStorage.getItem(o))+1),!1===c){p.append("upload-file",s);e.ajax({url:r.ajax_url,type:t.attr("method"),data:p,dataType:"json",cache:!1,contentType:!1,processData:!1,xhr:function(){var e=new window.XMLHttpRequest;return e.upload.addEventListener("progress",function(e){if(e.lengthComputable){var a=e.loaded/e.total,d=parseInt(100*a);i.setProgressBar(l,d)}},!1),e},complete:function(){i.setProgressBar(l,100)},success:function(a){a.success?e.isFunction(r.on_success)&&r.on_success.call(this,d,l,a):(e(".dnd-progress-bar",e("#"+l)).remove(),e(".dnd-upload-details",e("#"+l)).append('<span class="has-error">'+a.data+"</span>"),e('input[type="submit"]',t).removeClass("disabled").prop("disabled",!1))},error:function(a,d,o){e(".dnd-progress-bar",e("#"+l)).remove(),e(".dnd-upload-details",e("#"+l)).append('<span class="has-error">'+r.server_max_error+"</span>"),e('input[type="submit"]',t).removeClass("disabled").prop("disabled",!1)}})}})}},i={createProgressBar:function(a){var d=e(".codedropz-upload-handler",n),r="dnd-file-"+Math.random().toString(36).substr(2,9),s='<div class="dnd-upload-image"><span class="dnd-icon-blank-file"></span></div><div class="dnd-upload-details"><span class="name"><span>'+a.name+"</span><em>("+i.bytesToSize(a.size)+')</em></span><a href="javascript:void(0)" title="'+dnd_cf7_uploader.drag_n_drop_upload.delete.title+'" class="remove-file" data-storage="'+o+'"><span class="dnd-icon-remove"></span></a><span class="dnd-progress-bar"><span></span></span></div>';return d.after('<div id="'+r+'" class="dnd-upload-status">'+s+"</div>"),r},setProgressBar:function(a,d){var r=e(".dnd-progress-bar",e("#"+a));return r.length>0&&(i.disableBtn(p),progress_width=d*r.width()/100,e("span",r).addClass("in-progress").animate({width:progress_width},10).text(d+"% "),100==d&&e("span",r).addClass("complete").removeClass("in-progress")),!1},bytesToSize:function(e){return 0===e?"0":(kBytes=e/1024,fileSize=kBytes>=1024?(kBytes/1024).toFixed(2)+"MB":kBytes.toFixed(2)+"KB",fileSize)},disableBtn:function(e){e.length>0&&e.addClass("disable").prop("disabled",!0)}}}),e(document).on("click",".dnd-icon-remove",function(d){var r=e(this),o=r.parents(".dnd-upload-status"),s=r.parents(".codedropz-upload-wrapper"),t=r.parent("a").attr("data-storage"),n=Number(localStorage.getItem(t));if(e("span.in-progress",o).length>0)return!1;if(e(".has-error",o).length>0)return o.remove(),localStorage.setItem(t,n-1),!1;r.addClass("deleting").text(dnd_cf7_uploader.drag_n_drop_upload.delete.text+"...");var p={path:o.find('input[type="hidden"]').val(),action:"dnd_codedropz_upload_delete",security:dnd_cf7_uploader.ajax_nonce};e.post(a.ajax_url,p,function(a){a.success&&(o.remove(),localStorage.setItem(t,n-1),e(".dnd-upload-status",s).length<=1&&e("span.has-error-msg",s).remove(),e(".dnd-upload-counter span",s).text(Number(localStorage.getItem(t))-1))})})}}(jQuery);
|
assets/js/dnd-upload-cf7.js
CHANGED
@@ -5,6 +5,7 @@ jQuery(document).ready(function($){
|
|
5 |
|
6 |
// Get input type file element
|
7 |
var inputFile = $('.wpcf7-drag-n-drop-file');
|
|
|
8 |
|
9 |
// Reset upload list for multiple fields
|
10 |
if( inputFile.length > 0 ) {
|
@@ -18,9 +19,9 @@ jQuery(document).ready(function($){
|
|
18 |
}
|
19 |
|
20 |
// Remove status / progress bar
|
21 |
-
$('.dnd-upload-status',
|
22 |
-
$('.dnd-upload-counter span',
|
23 |
-
$('span.has-error-msg').remove();
|
24 |
|
25 |
}, false );
|
26 |
|
@@ -40,21 +41,24 @@ jQuery(document).ready(function($){
|
|
40 |
'on_success' : function( input, progressBar, response ){
|
41 |
|
42 |
// Progressbar Object
|
43 |
-
var progressDetails = $('#' + progressBar, input.parents('.codedropz-upload-wrapper') );
|
|
|
|
|
|
|
44 |
|
45 |
// If it's complete remove disabled attribute in button
|
46 |
-
if( $('
|
47 |
-
setTimeout(function(){ $('input
|
48 |
}
|
49 |
|
50 |
// Append hidden input field
|
51 |
-
progressDetails
|
52 |
.find('.dnd-upload-details')
|
53 |
.append('<span><input type="hidden" name="'+ input.attr('data-name') +'[]" value="'+ response.data.path +'/'+ response.data.file +'"></span>');
|
54 |
|
55 |
// Update counter
|
56 |
-
files_counter = ( Number( localStorage.getItem( input.data('name') + '_count_files' ) ) - 1 );
|
57 |
-
$('.dnd-upload-counter span', input.parents('.codedropz-upload-wrapper')).text( files_counter );
|
58 |
}
|
59 |
});
|
60 |
|
5 |
|
6 |
// Get input type file element
|
7 |
var inputFile = $('.wpcf7-drag-n-drop-file');
|
8 |
+
var $form = inputFile.parents('form');
|
9 |
|
10 |
// Reset upload list for multiple fields
|
11 |
if( inputFile.length > 0 ) {
|
19 |
}
|
20 |
|
21 |
// Remove status / progress bar
|
22 |
+
$('.dnd-upload-status', $form ).remove();
|
23 |
+
$('.dnd-upload-counter span', $form ).text('0');
|
24 |
+
$('span.has-error-msg', $form ).remove();
|
25 |
|
26 |
}, false );
|
27 |
|
41 |
'on_success' : function( input, progressBar, response ){
|
42 |
|
43 |
// Progressbar Object
|
44 |
+
var $progressDetails = $('#' + progressBar, input.parents('.codedropz-upload-wrapper') );
|
45 |
+
var $form = input.parents('form');
|
46 |
+
var $span = $('.wpcf7-acceptance', $form );
|
47 |
+
var $input = $('input:checkbox', $span);
|
48 |
|
49 |
// If it's complete remove disabled attribute in button
|
50 |
+
if( $span.hasClass( 'optional' ) || $input.is( ':checked' ) || $span.length == 0 ) {
|
51 |
+
setTimeout(function(){ $('input:submit', $form ).removeAttr('disabled'); }, 1);
|
52 |
}
|
53 |
|
54 |
// Append hidden input field
|
55 |
+
$progressDetails
|
56 |
.find('.dnd-upload-details')
|
57 |
.append('<span><input type="hidden" name="'+ input.attr('data-name') +'[]" value="'+ response.data.path +'/'+ response.data.file +'"></span>');
|
58 |
|
59 |
// Update counter
|
60 |
+
var $files_counter = ( Number( localStorage.getItem( input.data('name') + '_count_files' ) ) - 1 );
|
61 |
+
$('.dnd-upload-counter span', input.parents('.codedropz-upload-wrapper')).text( $files_counter );
|
62 |
}
|
63 |
});
|
64 |
|
drag-n-drop-upload-cf7.php
CHANGED
@@ -6,7 +6,7 @@
|
|
6 |
* Description: This simple plugin create Drag & Drop or choose Multiple File upload in your Confact Form 7 Forms.
|
7 |
* Text Domain: dnd-upload-cf7
|
8 |
* Domain Path: /languages
|
9 |
-
* Version: 1.3.
|
10 |
* Author: Glen Don L. Mongaya
|
11 |
* Author URI: http://codedropz.com
|
12 |
* License: GPL2
|
@@ -21,7 +21,7 @@
|
|
21 |
define( 'dnd_upload_cf7', true );
|
22 |
|
23 |
/** Define plugin Version */
|
24 |
-
define( 'dnd_upload_cf7_version', '1.3.
|
25 |
|
26 |
/** Define constant Plugin Directories */
|
27 |
define( 'dnd_upload_cf7_directory', untrailingslashit( dirname( __FILE__ ) ) );
|
6 |
* Description: This simple plugin create Drag & Drop or choose Multiple File upload in your Confact Form 7 Forms.
|
7 |
* Text Domain: dnd-upload-cf7
|
8 |
* Domain Path: /languages
|
9 |
+
* Version: 1.3.5
|
10 |
* Author: Glen Don L. Mongaya
|
11 |
* Author URI: http://codedropz.com
|
12 |
* License: GPL2
|
21 |
define( 'dnd_upload_cf7', true );
|
22 |
|
23 |
/** Define plugin Version */
|
24 |
+
define( 'dnd_upload_cf7_version', '1.3.5' );
|
25 |
|
26 |
/** Define constant Plugin Directories */
|
27 |
define( 'dnd_upload_cf7_directory', untrailingslashit( dirname( __FILE__ ) ) );
|
inc/dnd-upload-cf7.php
CHANGED
@@ -578,7 +578,9 @@
|
|
578 |
function dnd_upload_cf7_upload() {
|
579 |
|
580 |
// check and verify ajax request
|
581 |
-
|
|
|
|
|
582 |
|
583 |
// Get upload dir
|
584 |
$path = dnd_get_upload_dir();
|
@@ -591,7 +593,8 @@
|
|
591 |
|
592 |
// Tells whether the file was uploaded via HTTP POST
|
593 |
if ( ! is_uploaded_file( $file['tmp_name'] ) ) {
|
594 |
-
|
|
|
595 |
}
|
596 |
|
597 |
/* File type validation */
|
@@ -628,7 +631,8 @@
|
|
628 |
|
629 |
// Upload File
|
630 |
if ( false === move_uploaded_file( $file['tmp_name'], $new_file ) ) {
|
631 |
-
|
|
|
632 |
}else{
|
633 |
|
634 |
$files = array(
|
@@ -649,7 +653,9 @@
|
|
649 |
function dnd_codedropz_upload_delete() {
|
650 |
|
651 |
// check and verify ajax request
|
652 |
-
|
|
|
|
|
653 |
|
654 |
// Sanitize Path
|
655 |
$path = ( isset( $_POST['path'] ) ? sanitize_text_field( $_POST['path'] ) : null );
|
578 |
function dnd_upload_cf7_upload() {
|
579 |
|
580 |
// check and verify ajax request
|
581 |
+
if( is_user_logged_in() ) {
|
582 |
+
check_ajax_referer( 'dnd-cf7-security-nonce', 'security' );
|
583 |
+
}
|
584 |
|
585 |
// Get upload dir
|
586 |
$path = dnd_get_upload_dir();
|
593 |
|
594 |
// Tells whether the file was uploaded via HTTP POST
|
595 |
if ( ! is_uploaded_file( $file['tmp_name'] ) ) {
|
596 |
+
$failed_error = get_option('drag_n_drop_error_failed_to_upload');
|
597 |
+
wp_send_json_error( '('. $file['error'] .') ' . ( $failed_error ? $failed_error : dnd_cf7_error_msg('failed_upload') ) );
|
598 |
}
|
599 |
|
600 |
/* File type validation */
|
631 |
|
632 |
// Upload File
|
633 |
if ( false === move_uploaded_file( $file['tmp_name'], $new_file ) ) {
|
634 |
+
$failed_error = get_option('drag_n_drop_error_failed_to_upload');
|
635 |
+
wp_send_json_error( '('. $file['error'] .') ' . ( $failed_error ? $failed_error : dnd_cf7_error_msg('failed_upload') ) );
|
636 |
}else{
|
637 |
|
638 |
$files = array(
|
653 |
function dnd_codedropz_upload_delete() {
|
654 |
|
655 |
// check and verify ajax request
|
656 |
+
if( is_user_logged_in() ) {
|
657 |
+
check_ajax_referer( 'dnd-cf7-security-nonce', 'security' );
|
658 |
+
}
|
659 |
|
660 |
// Sanitize Path
|
661 |
$path = ( isset( $_POST['path'] ) ? sanitize_text_field( $_POST['path'] ) : null );
|
languages/dnd-upload-cf7-de_DE.mo
CHANGED
Binary file
|
languages/dnd-upload-cf7-de_DE.po
CHANGED
@@ -3,16 +3,16 @@ msgstr ""
|
|
3 |
"Project-Id-Version: Drag and Drop Multiple File Upload - Contact Form 7\n"
|
4 |
"Report-Msgid-Bugs-To: \n"
|
5 |
"POT-Creation-Date: 2019-03-18 14:28+0000\n"
|
6 |
-
"PO-Revision-Date:
|
7 |
"Last-Translator: admin <info@aachen-webdesigner.de>\n"
|
8 |
"Language-Team: Deutsch\n"
|
9 |
-
"Language:
|
10 |
"Plural-Forms: nplurals=2; plural=n != 1;\n"
|
11 |
"MIME-Version: 1.0\n"
|
12 |
"Content-Type: text/plain; charset=UTF-8\n"
|
13 |
"Content-Transfer-Encoding: 8bit\n"
|
14 |
-
"X-Generator:
|
15 |
-
"X-Loco-Version: 2.2.1; wp-5.1.1"
|
16 |
|
17 |
#: inc/dnd-upload-cf7.php:50
|
18 |
msgid "The uploaded file exceeds the maximum upload size of your server."
|
@@ -33,7 +33,7 @@ msgstr "Die Hochgeladene Datei ist für diesen Dateityp nicht erlaubt."
|
|
33 |
|
34 |
#: inc/dnd-upload-cf7.php:192
|
35 |
msgid "Drag & Drop Files Here"
|
36 |
-
msgstr "
|
37 |
|
38 |
#: inc/dnd-upload-cf7.php:193
|
39 |
msgid "or"
|
3 |
"Project-Id-Version: Drag and Drop Multiple File Upload - Contact Form 7\n"
|
4 |
"Report-Msgid-Bugs-To: \n"
|
5 |
"POT-Creation-Date: 2019-03-18 14:28+0000\n"
|
6 |
+
"PO-Revision-Date: 2020-06-07 12:46+0800\n"
|
7 |
"Last-Translator: admin <info@aachen-webdesigner.de>\n"
|
8 |
"Language-Team: Deutsch\n"
|
9 |
+
"Language: de_DE\n"
|
10 |
"Plural-Forms: nplurals=2; plural=n != 1;\n"
|
11 |
"MIME-Version: 1.0\n"
|
12 |
"Content-Type: text/plain; charset=UTF-8\n"
|
13 |
"Content-Transfer-Encoding: 8bit\n"
|
14 |
+
"X-Generator: Poedit 2.3.1\n"
|
15 |
+
"X-Loco-Version: 2.2.1; wp-5.1.1\n"
|
16 |
|
17 |
#: inc/dnd-upload-cf7.php:50
|
18 |
msgid "The uploaded file exceeds the maximum upload size of your server."
|
33 |
|
34 |
#: inc/dnd-upload-cf7.php:192
|
35 |
msgid "Drag & Drop Files Here"
|
36 |
+
msgstr "Ziehen & fallenlassen Hier"
|
37 |
|
38 |
#: inc/dnd-upload-cf7.php:193
|
39 |
msgid "or"
|
readme.txt
CHANGED
@@ -3,7 +3,7 @@ Donate link : http://codedropz.com/donation
|
|
3 |
Tags: drag and drop, contact form 7, ajax uploader, multiple file, upload, contact form 7 uploader
|
4 |
Requires at least: 3.0.1
|
5 |
Tested up to: 5.4.1
|
6 |
-
Stable tag: 1.3.
|
7 |
Requires PHP: 5.2.4
|
8 |
License: GPLv2 or later
|
9 |
License URI: https://www.gnu.org/licenses/gpl-2.0.html
|
@@ -50,7 +50,7 @@ Checkout available features on **PRO version**.
|
|
50 |
* Chunks Upload *( Break large files into smaller Chunks )*
|
51 |
* Max Total Size *( of all Uploaded Files )*
|
52 |
* Parallel/Sequential Upload *( Number of files to simultaneously upload )*
|
53 |
-
* Change Filename Pattern ({filename}, {ip_address}, {random}, {post_id}, {post_slug}
|
54 |
* Automatically Optimize Images
|
55 |
* Able to Resize/Crop image (ie: 800x800)
|
56 |
* Improved Security
|
@@ -124,8 +124,14 @@ To install this plugin see below:
|
|
124 |
|
125 |
== Changelog ==
|
126 |
|
|
|
|
|
|
|
|
|
|
|
|
|
127 |
= 1.3.4 =
|
128 |
-
* Fixed -
|
129 |
* Added - Counter of how many files are uploaded ( ie: 4 of 10 )
|
130 |
* New - Features allow to set Minimum File Upload.
|
131 |
- ie : minimum upload:2, max upload:10 = [mfile* upload-file-669 min-file:2 max-file:10]
|
3 |
Tags: drag and drop, contact form 7, ajax uploader, multiple file, upload, contact form 7 uploader
|
4 |
Requires at least: 3.0.1
|
5 |
Tested up to: 5.4.1
|
6 |
+
Stable tag: 1.3.5
|
7 |
Requires PHP: 5.2.4
|
8 |
License: GPLv2 or later
|
9 |
License URI: https://www.gnu.org/licenses/gpl-2.0.html
|
50 |
* Chunks Upload *( Break large files into smaller Chunks )*
|
51 |
* Max Total Size *( of all Uploaded Files )*
|
52 |
* Parallel/Sequential Upload *( Number of files to simultaneously upload )*
|
53 |
+
* Change Filename Pattern ({filename}, {ip_address}, {random}, {post_id}, {post_slug}, etc.)
|
54 |
* Automatically Optimize Images
|
55 |
* Able to Resize/Crop image (ie: 800x800)
|
56 |
* Improved Security
|
124 |
|
125 |
== Changelog ==
|
126 |
|
127 |
+
= 1.3.5 =
|
128 |
+
* Fixed - nonce issues when using Cache plugins.
|
129 |
+
* Fixed - German Translation for ( Drag & Drop File Upload ) text.
|
130 |
+
* Fixed - Submit button ( enable/disable ) when acceptance checkbox is added.
|
131 |
+
* Modified - File Upload error message ( display error code )
|
132 |
+
|
133 |
= 1.3.4 =
|
134 |
+
* Fixed - Removed uploaded files when item Inbound Messages "Permanently Deleted".
|
135 |
* Added - Counter of how many files are uploaded ( ie: 4 of 10 )
|
136 |
* New - Features allow to set Minimum File Upload.
|
137 |
- ie : minimum upload:2, max upload:10 = [mfile* upload-file-669 min-file:2 max-file:10]
|