Version Description
- Added - Add settings link in the plugin page
- Fixed - Long text/heading is hidden on the container
- Fixed - Min file validation
- Bug - Removed "accept" data attributes in mobile devices
Download this release
Release Info
Developer | glenwpcoder |
Plugin | Drag and Drop Multiple File Upload – Contact Form 7 |
Version | 1.3.6.2 |
Comparing to | |
See all releases |
Code changes from version 1.3.6.1 to 1.3.6.2
- assets/css/dnd-upload-cf7.css +2 -1
- assets/js/codedropz-uploader-min.js +3 -4
- drag-n-drop-upload-cf7.php +2 -2
- inc/dnd-upload-cf7.php +69 -11
- readme.txt +8 -2
assets/css/dnd-upload-cf7.css
CHANGED
@@ -109,7 +109,7 @@
|
|
109 |
.codedropz-upload-inner {
|
110 |
overflow:hidden;
|
111 |
width:100%;
|
112 |
-
white-space: nowrap
|
113 |
text-align:center;
|
114 |
text-overflow: ellipsis;
|
115 |
font-weight:inherit;
|
@@ -122,6 +122,7 @@
|
|
122 |
margin:5px 0;
|
123 |
font-size:30px;
|
124 |
line-height:32px;
|
|
|
125 |
}
|
126 |
|
127 |
/* Add border on dragenter, drag etc */
|
109 |
.codedropz-upload-inner {
|
110 |
overflow:hidden;
|
111 |
width:100%;
|
112 |
+
/*white-space: nowrap;*/
|
113 |
text-align:center;
|
114 |
text-overflow: ellipsis;
|
115 |
font-weight:inherit;
|
122 |
margin:5px 0;
|
123 |
font-size:30px;
|
124 |
line-height:32px;
|
125 |
+
word-break:break-word;
|
126 |
}
|
127 |
|
128 |
/* Add border on dragenter, drag etc */
|
assets/js/codedropz-uploader-min.js
CHANGED
@@ -1,11 +1,10 @@
|
|
1 |
/**
|
2 |
-
* CodeDropz Uploader v1.3.6.
|
3 |
* Copyright 2018 Glen Mongaya
|
4 |
* CodeDrop Drag&Drop Uploader
|
5 |
-
* @version 1.3.6.
|
6 |
* @author CodeDropz, Glen Don L. Mongaya
|
7 |
* @license The MIT License (MIT)
|
8 |
*/
|
9 |
|
10 |
-
|
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"><'+dnd_cf7_uploader.drag_n_drop_upload.tag+">"+r.text+"</"+dnd_cf7_uploader.drag_n_drop_upload.tag+"><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> '+dnd_cf7_uploader.dnd_text_counter+" "+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("size_limit",r.max_upload_size),p.append("action","dnd_codedropz_upload"),p.append("type",s),p.append("security",dnd_cf7_uploader.ajax_nonce),p.append("form_id",d.data("id")),p.append("upload_name",d.data("name")),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)}},!1),e},complete:function(){i.setProgressBar(l,100)},success:function(a){a.success?(i.setProgressBar(l,100),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),e("#"+l).removeClass("in-progress"))},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),e("#"+l).removeClass("in-progress")}})}})}},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="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("#"+a).addClass("in-progress"),100==d?e("span",r).width("100%").text(d+"% "):e("span",r).animate({width:progress_width},10).text(d+"% "),100==d&&e("#"+a).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(o.hasClass("in-progress"))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))}),e("span.has-error-msg").remove()})}}(jQuery);
|
1 |
/**
|
2 |
+
* CodeDropz Uploader v1.3.6.2
|
3 |
* Copyright 2018 Glen Mongaya
|
4 |
* CodeDrop Drag&Drop Uploader
|
5 |
+
* @version 1.3.6.2
|
6 |
* @author CodeDropz, Glen Don L. Mongaya
|
7 |
* @license The MIT License (MIT)
|
8 |
*/
|
9 |
|
10 |
+
!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"><'+dnd_cf7_uploader.drag_n_drop_upload.tag+">"+r.text+"</"+dnd_cf7_uploader.drag_n_drop_upload.tag+"><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> '+dnd_cf7_uploader.dnd_text_counter+" "+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")}),/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)&&d.removeAttr("accept");var l=function(a,s){if(!(!a.length>1)){var p=new FormData;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),p.append("form_id",d.data("id")),p.append("upload_name",d.data("name")),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)}},!1),e},complete:function(){i.setProgressBar(l,100)},success:function(a){a.success?(i.setProgressBar(l,100),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),e("#"+l).removeClass("in-progress"))},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),e("#"+l).removeClass("in-progress")}})}})}},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="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("#"+a).addClass("in-progress"),100==d?e("span",r).width("100%").text(d+"% "):e("span",r).animate({width:progress_width},10).text(d+"% "),100==d&&e("#"+a).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(o.hasClass("in-progress"))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))}),e("span.has-error-msg").remove()})}}(jQuery);
|
|
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: drag-and-drop-multiple-file-upload-contact-form-7
|
8 |
* Domain Path: /languages
|
9 |
-
* Version: 1.3.6.
|
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.6.
|
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: drag-and-drop-multiple-file-upload-contact-form-7
|
8 |
* Domain Path: /languages
|
9 |
+
* Version: 1.3.6.2
|
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.6.2' );
|
25 |
|
26 |
/** Define constant Plugin Directories */
|
27 |
define( 'dnd_upload_cf7_directory', untrailingslashit( dirname( __FILE__ ) ) );
|
inc/dnd-upload-cf7.php
CHANGED
@@ -42,6 +42,9 @@
|
|
42 |
// Add custom mime-type
|
43 |
add_filter('upload_mimes', 'dnd_extra_mime_types', 1, 1);
|
44 |
|
|
|
|
|
|
|
45 |
// Add Submenu - Settings
|
46 |
add_action('admin_menu', 'dnd_admin_settings');
|
47 |
|
@@ -51,6 +54,13 @@
|
|
51 |
// Flamingo Hooks
|
52 |
add_action('before_delete_post', 'dnd_remove_uploaded_files');
|
53 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
54 |
// Load plugin text-domain
|
55 |
function dnd_cf7_upload_plugins_loaded() {
|
56 |
|
@@ -148,7 +158,7 @@
|
|
148 |
'invalid_type' => __('Uploaded file is not allowed for file type','drag-and-drop-multiple-file-upload-contact-form-7'),
|
149 |
'max_file_limit' => __('Note : Some of the files are not uploaded ( Only %count% files allowed )','drag-and-drop-multiple-file-upload-contact-form-7'),
|
150 |
'required' => __('This field is required.', 'drag-and-drop-multiple-file-upload-contact-form-7' ),
|
151 |
-
'min_file' => __('
|
152 |
);
|
153 |
|
154 |
// return error message based on $error_key request
|
@@ -494,12 +504,17 @@
|
|
494 |
$atts['data-name'] = $tag->name;
|
495 |
$atts['data-type'] = $tag->get_option( 'filetypes','', true);
|
496 |
$atts['data-limit'] = $tag->get_option( 'limit','', true);
|
|
|
497 |
$atts['data-max'] = $tag->get_option( 'max-file','', true);
|
498 |
$atts['data-id'] = ( $form->id() ? $form->id() : 0 );
|
|
|
499 |
|
500 |
-
|
501 |
$types = explode('|', $atts['data-type'] );
|
502 |
-
|
|
|
|
|
|
|
503 |
|
504 |
// Combine and format attrbiutes
|
505 |
$atts = wpcf7_format_atts( $atts );
|
@@ -565,6 +580,13 @@
|
|
565 |
$multiple_files = ( ( isset( $_POST[ $name ] ) && is_countable( $_POST[ $name ] ) && count( $_POST[ $name ] ) > 0 ) ? $_POST[ $name ] : null );
|
566 |
$min_file = $tag->get_option( 'min-file','', true);
|
567 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
568 |
// Cf7 Conditional Field
|
569 |
if( in_array('cf7-conditional-fields/contact-form-7-conditional-fields.php', get_option('active_plugins') ) ){
|
570 |
|
@@ -590,13 +612,6 @@
|
|
590 |
return $result;
|
591 |
}
|
592 |
|
593 |
-
// Check minimum upload
|
594 |
-
if( $multiple_files && count( $multiple_files ) < (int) $min_file ) {
|
595 |
-
$min_file_error = ( get_option('drag_n_drop_error_min_file') ? get_option('drag_n_drop_error_min_file') : dnd_cf7_error_msg('min_file') );
|
596 |
-
$result->invalidate( $tag, $min_file_error .' '. (int)$min_file );
|
597 |
-
return $result;
|
598 |
-
}
|
599 |
-
|
600 |
return $result;
|
601 |
}
|
602 |
|
@@ -934,6 +949,17 @@
|
|
934 |
do_settings_sections( 'drag-n-drop-upload-file-cf7' );
|
935 |
?>
|
936 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
937 |
<table class="form-table">
|
938 |
<tr valign="top">
|
939 |
<th scope="row"><?php _e('Send Attachment as links?','drag-and-drop-multiple-file-upload-contact-form-7'); ?></th>
|
@@ -1101,4 +1127,36 @@
|
|
1101 |
register_setting( 'drag-n-drop-upload-file-cf7', 'drag_n_drop_disable_btn','sanitize_text_field' );
|
1102 |
register_setting( 'drag-n-drop-upload-file-cf7', 'drag_n_drop_disable_auto_delete','sanitize_text_field' );
|
1103 |
register_setting( 'drag-n-drop-upload-file-cf7', 'drag_n_drop_fix_spam','sanitize_text_field' );
|
1104 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
42 |
// Add custom mime-type
|
43 |
add_filter('upload_mimes', 'dnd_extra_mime_types', 1, 1);
|
44 |
|
45 |
+
// Plugin settings
|
46 |
+
add_filter( 'plugin_action_links_' . plugin_basename( dnd_upload_cf7_directory ) .'/drag-n-drop-upload-cf7.php', 'dnd_cf7_upload_links' );
|
47 |
+
|
48 |
// Add Submenu - Settings
|
49 |
add_action('admin_menu', 'dnd_admin_settings');
|
50 |
|
54 |
// Flamingo Hooks
|
55 |
add_action('before_delete_post', 'dnd_remove_uploaded_files');
|
56 |
|
57 |
+
// Add links to settings
|
58 |
+
function dnd_cf7_upload_links( $actions ) {
|
59 |
+
$upload_links = array('<a href="' . admin_url( 'admin.php?page=drag-n-drop-upload' ) . '">Settings</a>',);
|
60 |
+
$actions = array_merge( $upload_links, $actions );
|
61 |
+
return $actions;
|
62 |
+
}
|
63 |
+
|
64 |
// Load plugin text-domain
|
65 |
function dnd_cf7_upload_plugins_loaded() {
|
66 |
|
158 |
'invalid_type' => __('Uploaded file is not allowed for file type','drag-and-drop-multiple-file-upload-contact-form-7'),
|
159 |
'max_file_limit' => __('Note : Some of the files are not uploaded ( Only %count% files allowed )','drag-and-drop-multiple-file-upload-contact-form-7'),
|
160 |
'required' => __('This field is required.', 'drag-and-drop-multiple-file-upload-contact-form-7' ),
|
161 |
+
'min_file' => __('The minimum file upload is','drag-and-drop-multiple-file-upload-contact-form-7'),
|
162 |
);
|
163 |
|
164 |
// return error message based on $error_key request
|
504 |
$atts['data-name'] = $tag->name;
|
505 |
$atts['data-type'] = $tag->get_option( 'filetypes','', true);
|
506 |
$atts['data-limit'] = $tag->get_option( 'limit','', true);
|
507 |
+
$atts['data-min'] = $tag->get_option( 'min-file', '', true );
|
508 |
$atts['data-max'] = $tag->get_option( 'max-file','', true);
|
509 |
$atts['data-id'] = ( $form->id() ? $form->id() : 0 );
|
510 |
+
$atts['data-version'] = 'free version '. dnd_upload_cf7_version;
|
511 |
|
512 |
+
// Accept data attributes
|
513 |
$types = explode('|', $atts['data-type'] );
|
514 |
+
|
515 |
+
if( $types && ! wp_is_mobile() ) {
|
516 |
+
$atts['accept'] = '.' . implode(', .', array_map( 'trim', $types ) );
|
517 |
+
}
|
518 |
|
519 |
// Combine and format attrbiutes
|
520 |
$atts = wpcf7_format_atts( $atts );
|
580 |
$multiple_files = ( ( isset( $_POST[ $name ] ) && is_countable( $_POST[ $name ] ) && count( $_POST[ $name ] ) > 0 ) ? $_POST[ $name ] : null );
|
581 |
$min_file = $tag->get_option( 'min-file','', true);
|
582 |
|
583 |
+
// Check minimum upload
|
584 |
+
if( $multiple_files && count( $multiple_files ) < (int) $min_file ) {
|
585 |
+
$min_file_error = ( get_option('drag_n_drop_error_min_file') ? get_option('drag_n_drop_error_min_file') : dnd_cf7_error_msg('min_file') );
|
586 |
+
$result->invalidate( $tag, $min_file_error .' '. (int)$min_file );
|
587 |
+
return $result;
|
588 |
+
}
|
589 |
+
|
590 |
// Cf7 Conditional Field
|
591 |
if( in_array('cf7-conditional-fields/contact-form-7-conditional-fields.php', get_option('active_plugins') ) ){
|
592 |
|
612 |
return $result;
|
613 |
}
|
614 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
615 |
return $result;
|
616 |
}
|
617 |
|
949 |
do_settings_sections( 'drag-n-drop-upload-file-cf7' );
|
950 |
?>
|
951 |
|
952 |
+
<table class="form-table" style="display:none;">
|
953 |
+
<tr valign="top">
|
954 |
+
<th scope="row"><?php _e('Translate To','drag-and-drop-multiple-file-upload-contact-form-7'); ?></th>
|
955 |
+
<td><?php wp_dropdown_languages( array('name' => 'drag_n_drop_lang', 'id' => 'drag_n_drop_lang') ); ?>
|
956 |
+
<div style="margin-top:20px;">
|
957 |
+
<strong>Translated: </strong><a href="">abc</a>
|
958 |
+
</div>
|
959 |
+
</td>
|
960 |
+
</tr>
|
961 |
+
</table>
|
962 |
+
|
963 |
<table class="form-table">
|
964 |
<tr valign="top">
|
965 |
<th scope="row"><?php _e('Send Attachment as links?','drag-and-drop-multiple-file-upload-contact-form-7'); ?></th>
|
1127 |
register_setting( 'drag-n-drop-upload-file-cf7', 'drag_n_drop_disable_btn','sanitize_text_field' );
|
1128 |
register_setting( 'drag-n-drop-upload-file-cf7', 'drag_n_drop_disable_auto_delete','sanitize_text_field' );
|
1129 |
register_setting( 'drag-n-drop-upload-file-cf7', 'drag_n_drop_fix_spam','sanitize_text_field' );
|
1130 |
+
}
|
1131 |
+
|
1132 |
+
function dnd_upload_cf7_lang() {
|
1133 |
+
$lang = null;
|
1134 |
+
|
1135 |
+
// Polylang & WPML compatiblity
|
1136 |
+
if( function_exists('pll_current_language') ) {
|
1137 |
+
$lang = pll_current_language();
|
1138 |
+
}elseif( class_exists('SitePress') ) {
|
1139 |
+
$lang = ICL_LANGUAGE_CODE;
|
1140 |
+
}
|
1141 |
+
|
1142 |
+
// If english / default lang leave empty.
|
1143 |
+
if( $lang ) {
|
1144 |
+
$lang = ( $lang == 'en' ? '' : '-'.$lang );
|
1145 |
+
}
|
1146 |
+
|
1147 |
+
return apply_filters('dndmfu_wc_lang', $lang );
|
1148 |
+
}
|
1149 |
+
|
1150 |
+
/*add_action('admin_footer', function(){
|
1151 |
+
if( isset( $_GET['page'] ) && $_GET['page'] == 'drag-n-drop-upload' ) {
|
1152 |
+
?>
|
1153 |
+
<script type="text/javascript">
|
1154 |
+
jQuery('document').ready(function($){
|
1155 |
+
$('#drag_n_drop_lang').change(function(){
|
1156 |
+
window.location.href = "<?php echo admin_url('admin.php?page=drag-n-drop-upload&lang-code='); ?>" + $(this).val();
|
1157 |
+
});
|
1158 |
+
});
|
1159 |
+
</script>
|
1160 |
+
<?php
|
1161 |
+
}
|
1162 |
+
});*/
|
readme.txt
CHANGED
@@ -3,8 +3,8 @@ Contributors: glenwpcoder, yordansoares
|
|
3 |
Donate link : http://codedropz.com/donation
|
4 |
Tags: drag and drop, contact form 7, ajax uploader, multiple file, upload, contact form 7 uploader
|
5 |
Requires at least: 3.0.1
|
6 |
-
Tested up to: 5.8
|
7 |
-
Stable tag: 1.3.6.
|
8 |
Requires PHP: 5.2.4
|
9 |
License: GPLv2 or later
|
10 |
License URI: https://www.gnu.org/licenses/gpl-2.0.html
|
@@ -153,6 +153,12 @@ To install this plugin see below:
|
|
153 |
|
154 |
== Changelog ==
|
155 |
|
|
|
|
|
|
|
|
|
|
|
|
|
156 |
= 1.3.6.1 =
|
157 |
- Fixed - Unable to delete if errors will show
|
158 |
- Added “span” & “div” on heading tag option
|
3 |
Donate link : http://codedropz.com/donation
|
4 |
Tags: drag and drop, contact form 7, ajax uploader, multiple file, upload, contact form 7 uploader
|
5 |
Requires at least: 3.0.1
|
6 |
+
Tested up to: 5.8.1
|
7 |
+
Stable tag: 1.3.6.2
|
8 |
Requires PHP: 5.2.4
|
9 |
License: GPLv2 or later
|
10 |
License URI: https://www.gnu.org/licenses/gpl-2.0.html
|
153 |
|
154 |
== Changelog ==
|
155 |
|
156 |
+
= 1.3.6.2 =
|
157 |
+
- Added - Add settings link in the plugin page
|
158 |
+
- Fixed - Long text/heading is hidden on the container
|
159 |
+
- Fixed - Min file validation
|
160 |
+
- Bug - Removed "accept" data attributes in mobile devices
|
161 |
+
|
162 |
= 1.3.6.1 =
|
163 |
- Fixed - Unable to delete if errors will show
|
164 |
- Added “span” & “div” on heading tag option
|