Version Description
- SECURITY UPDATES ( issues reported by : Robert L Mathews )
- The issues inside
dnd_codedropz_upload_delete
function, that will execute any POST remotely. - Fixed - To accept russian, hebrew Filename
- Modify Javascript
dnd-upload-cf7.js
attach the function to window so it can be available to call. - Added - Responsive style for
Drag & Drop
text on mobile devices. - Minimum Features - Coming Soon
Download this release
Release Info
Developer | glenwpcoder |
Plugin | Drag and Drop Multiple File Upload – Contact Form 7 |
Version | 1.3.3 |
Comparing to | |
See all releases |
Code changes from version 1.3.2 to 1.3.3
- assets/css/dnd-upload-cf7.css +1 -0
- assets/js/codedropz-uploader-min.js +3 -3
- assets/js/dnd-upload-cf7.js +34 -28
- drag-n-drop-upload-cf7.php +2 -2
- inc/dnd-upload-cf7.php +18 -2
- readme.txt +10 -1
assets/css/dnd-upload-cf7.css
CHANGED
@@ -148,4 +148,5 @@
|
|
148 |
@media screen and (max-width: 767px) {
|
149 |
.dnd-upload-status .dnd-upload-details .name em { font-weight:normal; }
|
150 |
.dnd-upload-status .dnd-upload-details .name { padding-right:60px; }
|
|
|
151 |
}
|
148 |
@media screen and (max-width: 767px) {
|
149 |
.dnd-upload-status .dnd-upload-details .name em { font-weight:normal; }
|
150 |
.dnd-upload-status .dnd-upload-details .name { padding-right:60px; }
|
151 |
+
.codedropz-upload-inner h3 { font-size:20px; }
|
152 |
}
|
assets/js/codedropz-uploader-min.js
CHANGED
@@ -1,11 +1,11 @@
|
|
1 |
/**
|
2 |
-
* CodeDropz Uploader v1.
|
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 r=e(this),d=e.extend({handler:r,color:"#000",background:"",server_max_error:"Uploaded file exceeds the maximum upload size of your server.",max_file:r.data("max")?r.data("max"):10,max_upload_size:r.data("limit")?r.data("limit"):"5242880",supported_type:r.data("type")?r.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=r.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>'+d.text+"</h3><span>"+d.separator+'</span><div class="codedropz-btn-wrap"><a class="cd-upload-btn" href="javascript:void(0)">'+d.button_text+"</a></div></div></div></div>";d.handler.wrapAll('<div class="codedropz-upload-wrapper"></div>');var t=d.handler.parents("form"),n=d.handler.parents(".codedropz-upload-wrapper"),p=e('input[type="submit"]',t);d.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(),d.handler.val(null),d.handler.click()}),e(".codedropz-upload-handler",n).on("drop",function(e){l(e.originalEvent.dataTransfer.files,"drop")}),d.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",d.supported_type),p.append("size_limit",d.max_upload_size),p.append("action","dnd_codedropz_upload"),p.append("type",s),e("span.has-error",d.handler).remove(),e.each(a,function(a,s){if(void 0!==p.delete&&p.delete("upload-file"),localStorage.getItem(o)>d.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%",d.max_file)+"</span>")),!1;var l=i.createProgressBar(s),c=!1;if(s.size>d.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("(.*?).("+d.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:d.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,r=parseInt(100*a);i.setProgressBar(l,r)}},!1),e},complete:function(){i.setProgressBar(l,100)},success:function(a){a.success?e.isFunction(d.on_success)&&d.on_success.call(this,r,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,r,o){e(".dnd-progress-bar",e("#"+l)).remove(),e(".dnd-upload-details",e("#"+l)).append('<span class="has-error">'+d.server_max_error+"</span>"),e('input[type="submit"]',t).removeClass("disabled").prop("disabled",!1)}})}})}},i={createProgressBar:function(a){var r=e(".codedropz-upload-handler",n),d="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">'+a.name+" <em>("+i.bytesToSize(a.size)+')</em></span><a href="javascript:void(0)" title="Remove" class="remove-file" data-storage="'+o+'"><span class="dnd-icon-remove"></span></a><span class="dnd-progress-bar"><span></span></span></div>';return r.after('<div id="'+d+'" class="dnd-upload-status">'+s+"</div>"),d},setProgressBar:function(a,r){var d=e(".dnd-progress-bar",e("#"+a));return d.length>0&&(i.disableBtn(p),progress_width=r*d.width()/100,e("span",d).addClass("in-progress").animate({width:progress_width},10).text(r+"% "),100==r&&e("span",d).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(r){var d=e(this),o=d.parents(".dnd-upload-status"),s=d.parents(".codedropz-upload-wrapper"),t=d.parent("a").attr("data-storage");return!(e("span.in-progress",o).length>0)&&(e(".has-error",o).length>0?(o.remove(),localStorage.setItem(t,Number(localStorage.getItem(t))-1),!1):(d.addClass("deleting").text("deleting..."),void e.post(a.ajax_url,{path:o.find('input[type="hidden"]').val(),action:"dnd_codedropz_upload_delete"},function(a){a.success&&(o.remove(),localStorage.setItem(t,Number(localStorage.getItem(t))-1),e(".dnd-upload-status",s).length<=1&&e("span.has-error-msg",s).remove())})))})}}(jQuery);
|
1 |
/**
|
2 |
+
* CodeDropz Uploader v1.3.3
|
3 |
* Copyright 2018 Glen Mongaya
|
4 |
* CodeDrop Drag&Drop Uploader
|
5 |
+
* @version 1.2
|
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 r=e(this),d=e.extend({handler:r,color:"#000",background:"",server_max_error:"Uploaded file exceeds the maximum upload size of your server.",max_file:r.data("max")?r.data("max"):10,max_upload_size:r.data("limit")?r.data("limit"):"5242880",supported_type:r.data("type")?r.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=r.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>'+d.text+"</h3><span>"+d.separator+'</span><div class="codedropz-btn-wrap"><a class="cd-upload-btn" href="javascript:void(0)">'+d.button_text+"</a></div></div></div></div>";d.handler.wrapAll('<div class="codedropz-upload-wrapper"></div>');var t=d.handler.parents("form"),n=d.handler.parents(".codedropz-upload-wrapper"),p=e('input[type="submit"]',t);d.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(),d.handler.val(null),d.handler.click()}),e(".codedropz-upload-handler",n).on("drop",function(e){l(e.originalEvent.dataTransfer.files,"drop")}),d.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",d.supported_type),p.append("size_limit",d.max_upload_size),p.append("action","dnd_codedropz_upload"),p.append("type",s),e("span.has-error",d.handler).remove(),e.each(a,function(a,s){if(void 0!==p.delete&&p.delete("upload-file"),localStorage.getItem(o)>d.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%",d.max_file)+"</span>")),!1;var l=i.createProgressBar(s),c=!1;if(s.size>d.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("(.*?).("+d.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:d.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,r=parseInt(100*a);i.setProgressBar(l,r)}},!1),e},complete:function(){i.setProgressBar(l,100)},success:function(a){a.success?e.isFunction(d.on_success)&&d.on_success.call(this,r,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,r,o){e(".dnd-progress-bar",e("#"+l)).remove(),e(".dnd-upload-details",e("#"+l)).append('<span class="has-error">'+d.server_max_error+"</span>"),e('input[type="submit"]',t).removeClass("disabled").prop("disabled",!1)}})}})}},i={createProgressBar:function(a){var r=e(".codedropz-upload-handler",n),d="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">'+a.name+" <em>("+i.bytesToSize(a.size)+')</em></span><a href="javascript:void(0)" title="Remove" class="remove-file" data-storage="'+o+'"><span class="dnd-icon-remove"></span></a><span class="dnd-progress-bar"><span></span></span></div>';return r.after('<div id="'+d+'" class="dnd-upload-status">'+s+"</div>"),d},setProgressBar:function(a,r){var d=e(".dnd-progress-bar",e("#"+a));return d.length>0&&(i.disableBtn(p),progress_width=r*d.width()/100,e("span",d).addClass("in-progress").animate({width:progress_width},10).text(r+"% "),100==r&&e("span",d).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(r){var d=e(this),o=d.parents(".dnd-upload-status"),s=d.parents(".codedropz-upload-wrapper"),t=d.parent("a").attr("data-storage");return!(e("span.in-progress",o).length>0)&&(e(".has-error",o).length>0?(o.remove(),localStorage.setItem(t,Number(localStorage.getItem(t))-1),!1):(d.addClass("deleting").text("deleting..."),void e.post(a.ajax_url,{path:o.find('input[type="hidden"]').val(),action:"dnd_codedropz_upload_delete",security:dnd_cf7_uploader.ajax_nonce},function(a){a.success&&(o.remove(),localStorage.setItem(t,Number(localStorage.getItem(t))-1),e(".dnd-upload-status",s).length<=1&&e("span.has-error-msg",s).remove())})))})}}(jQuery);
|
assets/js/dnd-upload-cf7.js
CHANGED
@@ -1,33 +1,5 @@
|
|
1 |
jQuery(document).ready(function($){
|
2 |
|
3 |
-
// Get text object options/settings from localize script
|
4 |
-
var TextOJB = dnd_cf7_uploader.drag_n_drop_upload;
|
5 |
-
|
6 |
-
// Support Multiple Fileds
|
7 |
-
$('.wpcf7-drag-n-drop-file').CodeDropz_Uploader({
|
8 |
-
'color' : '#fff',
|
9 |
-
'ajax_url' : dnd_cf7_uploader.ajax_url,
|
10 |
-
'text' : TextOJB.text,
|
11 |
-
'separator' : TextOJB.or_separator,
|
12 |
-
'button_text' : TextOJB.browse,
|
13 |
-
'server_max_error' : TextOJB.server_max_error,
|
14 |
-
'on_success' : function( input, progressBar, response ){
|
15 |
-
|
16 |
-
// Progressbar Object
|
17 |
-
var progressDetails = $('#' + progressBar, input.parents('.codedropz-upload-wrapper') );
|
18 |
-
|
19 |
-
// If it's complete remove disabled attribute in button
|
20 |
-
if( $('.in-progress', input.parents('form') ).length === 0 ) {
|
21 |
-
setTimeout(function(){ $('input[type="submit"]', input.parents('form')).removeAttr('disabled'); }, 1);
|
22 |
-
}
|
23 |
-
|
24 |
-
// Append hidden input field
|
25 |
-
progressDetails
|
26 |
-
.find('.dnd-upload-details')
|
27 |
-
.append('<span><input type="hidden" name="'+ input.attr('data-name') +'[]" value="'+ response.data.path +'/'+ response.data.file +'"></span>');
|
28 |
-
}
|
29 |
-
});
|
30 |
-
|
31 |
// Fires when an Ajax form submission has completed successfully, and mail has been sent.
|
32 |
document.addEventListener( 'wpcf7mailsent', function( event ) {
|
33 |
|
@@ -51,4 +23,38 @@ jQuery(document).ready(function($){
|
|
51 |
|
52 |
}, false );
|
53 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
54 |
});
|
1 |
jQuery(document).ready(function($){
|
2 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3 |
// Fires when an Ajax form submission has completed successfully, and mail has been sent.
|
4 |
document.addEventListener( 'wpcf7mailsent', function( event ) {
|
5 |
|
23 |
|
24 |
}, false );
|
25 |
|
26 |
+
window.initDragDrop = function () {
|
27 |
+
|
28 |
+
// Get text object options/settings from localize script
|
29 |
+
var TextOJB = dnd_cf7_uploader.drag_n_drop_upload;
|
30 |
+
|
31 |
+
// Support Multiple Fileds
|
32 |
+
$('.wpcf7-drag-n-drop-file').CodeDropz_Uploader({
|
33 |
+
'color' : '#fff',
|
34 |
+
'ajax_url' : dnd_cf7_uploader.ajax_url,
|
35 |
+
'text' : TextOJB.text,
|
36 |
+
'separator' : TextOJB.or_separator,
|
37 |
+
'button_text' : TextOJB.browse,
|
38 |
+
'server_max_error' : TextOJB.server_max_error,
|
39 |
+
'on_success' : function( input, progressBar, response ){
|
40 |
+
|
41 |
+
// Progressbar Object
|
42 |
+
var progressDetails = $('#' + progressBar, input.parents('.codedropz-upload-wrapper') );
|
43 |
+
|
44 |
+
// If it's complete remove disabled attribute in button
|
45 |
+
if( $('.in-progress', input.parents('form') ).length === 0 ) {
|
46 |
+
setTimeout(function(){ $('input[type="submit"]', input.parents('form')).removeAttr('disabled'); }, 1);
|
47 |
+
}
|
48 |
+
|
49 |
+
// Append hidden input field
|
50 |
+
progressDetails
|
51 |
+
.find('.dnd-upload-details')
|
52 |
+
.append('<span><input type="hidden" name="'+ input.attr('data-name') +'[]" value="'+ response.data.path +'/'+ response.data.file +'"></span>');
|
53 |
+
}
|
54 |
+
});
|
55 |
+
|
56 |
+
}
|
57 |
+
|
58 |
+
window.initDragDrop();
|
59 |
+
|
60 |
});
|
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.3
|
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.3' );
|
25 |
|
26 |
/** Define constant Plugin Directories */
|
27 |
define( 'dnd_upload_cf7_directory', untrailingslashit( dirname( __FILE__ ) ) );
|
inc/dnd-upload-cf7.php
CHANGED
@@ -47,6 +47,7 @@
|
|
47 |
|
48 |
// Load plugin text-domain
|
49 |
function dnd_load_plugin_textdomain() {
|
|
|
50 |
load_plugin_textdomain( 'dnd-upload-cf7', false, dirname( dirname( plugin_basename( __FILE__ ) ) ) . '/languages' );
|
51 |
}
|
52 |
|
@@ -311,7 +312,8 @@
|
|
311 |
// registered script with data for a JavaScript variable.
|
312 |
wp_localize_script( 'dnd-upload-cf7', 'dnd_cf7_uploader',
|
313 |
array(
|
314 |
-
'ajax_url' =>
|
|
|
315 |
'drag_n_drop_upload' => array(
|
316 |
'text' => ( get_option('drag_n_drop_text') ? get_option('drag_n_drop_text') : __('Drag & Drop Files Here','dnd-upload-cf7') ),
|
317 |
'or_separator' => ( get_option('drag_n_drop_separator') ? get_option('drag_n_drop_separator') : __('or','dnd-upload-cf7') ),
|
@@ -557,12 +559,26 @@
|
|
557 |
// Delete file
|
558 |
function dnd_codedropz_upload_delete() {
|
559 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
560 |
// Get upload dir
|
561 |
$upload_dir = dnd_get_upload_dir();
|
|
|
|
|
|
|
|
|
|
|
|
|
562 |
|
563 |
// Make sure path is set
|
564 |
if( isset( $_POST['path'] ) && ! empty( $_POST['path'] ) ) {
|
565 |
-
$file_path =
|
566 |
if( file_exists( $file_path ) ){
|
567 |
wp_delete_file( $file_path );
|
568 |
wp_send_json_success( 'true' );
|
47 |
|
48 |
// Load plugin text-domain
|
49 |
function dnd_load_plugin_textdomain() {
|
50 |
+
setlocale( LC_CTYPE, get_locale() . '.utf8' );
|
51 |
load_plugin_textdomain( 'dnd-upload-cf7', false, dirname( dirname( plugin_basename( __FILE__ ) ) ) . '/languages' );
|
52 |
}
|
53 |
|
312 |
// registered script with data for a JavaScript variable.
|
313 |
wp_localize_script( 'dnd-upload-cf7', 'dnd_cf7_uploader',
|
314 |
array(
|
315 |
+
'ajax_url' => admin_url( 'admin-ajax.php' ),
|
316 |
+
'ajax_nonce' => wp_create_nonce( "dnd-cf7-security-nonce" ),
|
317 |
'drag_n_drop_upload' => array(
|
318 |
'text' => ( get_option('drag_n_drop_text') ? get_option('drag_n_drop_text') : __('Drag & Drop Files Here','dnd-upload-cf7') ),
|
319 |
'or_separator' => ( get_option('drag_n_drop_separator') ? get_option('drag_n_drop_separator') : __('or','dnd-upload-cf7') ),
|
559 |
// Delete file
|
560 |
function dnd_codedropz_upload_delete() {
|
561 |
|
562 |
+
// check and verify ajax request
|
563 |
+
check_ajax_referer( 'dnd-cf7-security-nonce', 'security' );
|
564 |
+
|
565 |
+
// Check valid filename & extensions
|
566 |
+
if( preg_match_all('/wp-|(\.php|\.exe|\.js|\.asp)/', $_POST['path'] ) ) {
|
567 |
+
die('file not safe');
|
568 |
+
}
|
569 |
+
|
570 |
// Get upload dir
|
571 |
$upload_dir = dnd_get_upload_dir();
|
572 |
+
$path = preg_replace( '/\..\/|\/..\//', '', $_POST['path'] ); // remove extra character
|
573 |
+
$directory = dirname( $upload_dir['upload_dir'] );
|
574 |
+
|
575 |
+
// Clean or convert to realpath if there's /../../ in $path;
|
576 |
+
$path = realpath( trailingslashit( $directory ) . $path );
|
577 |
+
$folder_name = basename( dirname( $path ) );
|
578 |
|
579 |
// Make sure path is set
|
580 |
if( isset( $_POST['path'] ) && ! empty( $_POST['path'] ) ) {
|
581 |
+
$file_path = path_join( trailingslashit( $directory ) . $folder_name, basename( $path ) );
|
582 |
if( file_exists( $file_path ) ){
|
583 |
wp_delete_file( $file_path );
|
584 |
wp_send_json_success( 'true' );
|
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.3.2
|
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
|
@@ -53,6 +53,7 @@ Checkout available features on **PRO version**.
|
|
53 |
* Chunks Upload *( Break large files into smaller Chunks )* - **Coming Soon**
|
54 |
* Max Total Size *( All Uploaded Files )* - **Coming Soon**
|
55 |
* Parallel/Sequential Upload *( Number of files to simultaneously upload )* - **Coming Soon**
|
|
|
56 |
|
57 |
|
58 |
You can get [PRO Version here](https://www.codedropz.com/purchase-plugin/)!
|
@@ -120,6 +121,14 @@ To install this plugin see below:
|
|
120 |
|
121 |
== Changelog ==
|
122 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
123 |
= 1.3.2 =
|
124 |
* Fixed - Sanitized Admin Option Fields - For Security Reason
|
125 |
* Added - Filter for `wpcf7_posted_data` from CF7 to get the full link of the file.
|
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.3.2
|
6 |
+
Stable tag: 1.3.3
|
7 |
Requires PHP: 5.2.4
|
8 |
License: GPLv2 or later
|
9 |
License URI: https://www.gnu.org/licenses/gpl-2.0.html
|
53 |
* Chunks Upload *( Break large files into smaller Chunks )* - **Coming Soon**
|
54 |
* Max Total Size *( All Uploaded Files )* - **Coming Soon**
|
55 |
* Parallel/Sequential Upload *( Number of files to simultaneously upload )* - **Coming Soon**
|
56 |
+
* Change Filename Pattern ({filename}, {ip_address}, {random}, {post_id}, {post_slug}, etc.) **Coming Soon**
|
57 |
|
58 |
|
59 |
You can get [PRO Version here](https://www.codedropz.com/purchase-plugin/)!
|
121 |
|
122 |
== Changelog ==
|
123 |
|
124 |
+
= 1.3.3 =
|
125 |
+
* SECURITY UPDATES ( issues reported by : Robert L Mathews )
|
126 |
+
- The issues inside `dnd_codedropz_upload_delete` function, that will execute any POST remotely.
|
127 |
+
* Fixed - To accept russian, hebrew Filename
|
128 |
+
* Modify Javascript `dnd-upload-cf7.js` attach the function to window so it can be available to call.
|
129 |
+
* Added - Responsive style for `Drag & Drop` text on mobile devices.
|
130 |
+
* Minimum Features - Coming Soon
|
131 |
+
|
132 |
= 1.3.2 =
|
133 |
* Fixed - Sanitized Admin Option Fields - For Security Reason
|
134 |
* Added - Filter for `wpcf7_posted_data` from CF7 to get the full link of the file.
|