Drag and Drop Multiple File Upload – Contact Form 7 - Version 1.3.5.8

Version Description

  • Fixed German translation (https://wordpress.org/support/topic/german-translation-wrong/)
  • Fixes - Bug on file deletion (Reported here - https://wordpress.org/support/topic/deleting-files-not-yet-uploaded-is-breaking/)
  • Change delete icon instead of using an iconmoon.
  • Minor fixes & Improvement
Download this release

Release Info

Developer glenwpcoder
Plugin Icon 128x128 Drag and Drop Multiple File Upload – Contact Form 7
Version 1.3.5.8
Comparing to
See all releases

Code changes from version 1.3.5.7 to 1.3.5.8

assets/css/dnd-upload-cf7.css CHANGED
@@ -1,183 +1,156 @@
1
- @font-face {
2
- font-family: 'dnd-custom-font';
3
- src: url('../fonts/icomoon.eot?14xd7m');
4
- src: url('../fonts/icomoon.eot?14xd7m#iefix') format('embedded-opentype'),
5
- url('../fonts/icomoon.ttf?14xd7m') format('truetype'),
6
- url('../fonts/icomoon.woff?14xd7m') format('woff'),
7
- url('../fonts/icomoon.svg?14xd7m#icomoon') format('svg');
8
- font-weight: normal;
9
- font-style: normal;
10
- }
11
-
12
- [class^="dnd-icon-"], [class*=" dnd-icon-"] {
13
- font-family: 'dnd-custom-font' !important;
14
- speak: none;
15
- font-style: normal;
16
- font-weight: normal;
17
- font-variant: normal;
18
- text-transform: none;
19
- line-height: 1;
20
-
21
- /* Better Font Rendering =========== */
22
- -webkit-font-smoothing: antialiased;
23
- -moz-osx-font-smoothing: grayscale;
24
- }
25
-
26
- .dnd-icon-blank-file:before { content: "\e900";}
27
- .dnd-icon-remove:before { content: "\e901";}
28
- .icon-upload:before { content: "\e902";}
29
-
30
- /* Delete Status */
31
- .dnd-icon-remove.deleting { outline:none; font-family : inherit !important; font-size:12px; color:#000; font-weight:500; }
32
- .dnd-icon-remove.deleting:before {content : '';}
33
-
34
- .wpcf7-drag-n-drop-file.d-none {
35
- display:none;
36
- opacity:0;
37
- visibility:hidden;
38
- position:absolute;
39
- top:0;
40
- }
41
-
42
- /* Upload Status */
43
- .dnd-upload-status {
44
- display:flex;
45
- padding:4px 0;
46
- align-items:center;
47
- position:relative;
48
- }
49
-
50
- /* Progress bar - Image */
51
- .dnd-upload-status .dnd-upload-image {
52
- width:40px;
53
- height:40px;
54
- border:1px solid #a5a5a5;
55
- text-align:center;
56
- border-radius:100%;
57
- position:relative;
58
- }
59
- .dnd-upload-status .dnd-upload-image.has-bg {
60
- background-position:center center;
61
- background-size:cover;
62
- background-repeat:no-repeat;
63
- border:0;
64
- transition: transform 0.3s ease;
65
- max-width:40px;
66
- width:100%;
67
- }
68
- .dnd-upload-status .dnd-upload-image.has-bg:hover {
69
- transform: scale(1.5);
70
- }
71
- .dnd-upload-status .dnd-upload-image span {
72
- font-size:20px;
73
- color:#222;
74
- position: absolute;
75
- top: 50%;
76
- transform: translate(-50%,-50%);
77
- -moz-transform: translate(-50%,-50%);
78
- -webkit-transform: translate(-50%,-50%);
79
- left: 50%;
80
- }
81
- .dnd-upload-status .dnd-upload-image.has-bg span { opacity:0; z-index:-200; }
82
-
83
- /* Progress bar - Image Details ( Name and Size ) */
84
- .dnd-upload-status .dnd-upload-details {
85
- padding-left:10px;
86
- width: calc(100% - 40px);
87
- }
88
- .dnd-upload-status .dnd-upload-details .name {color:#016d98; padding:4px 0; padding-right:25px; display:flex; }
89
- .dnd-upload-status .dnd-upload-details .name span { text-overflow: ellipsis; white-space: nowrap; overflow: hidden; position: relative; padding-right:10px; }
90
- .dnd-upload-status .dnd-upload-details .name em {color:#444242; font-weight:700; }
91
-
92
- /* Remove Upload File */
93
- .dnd-upload-status .dnd-upload-details .remove-file {
94
- position:absolute;
95
- right:0;
96
- top:6px;
97
- text-decoration:none;
98
- box-shadow:none;
99
- outline:none;
100
- }
101
-
102
- .dnd-upload-status .dnd-upload-details span.has-error { color:#f50505; }
103
-
104
- /* Progress Loading */
105
- .dnd-upload-status .dnd-upload-details .dnd-progress-bar {
106
- display: block;
107
- border-radius: 5px;
108
- overflow: hidden;
109
- background: #565555;
110
- height: 14px;
111
- }
112
- .dnd-upload-status .dnd-upload-details .dnd-progress-bar span {
113
- background: #4CAF50;
114
- display: block;
115
- font-size: 11px;
116
- text-align: right;
117
- color: #fff;
118
- height: 100%;
119
- width:0;
120
- line-height:14px;
121
- }
122
- .dnd-upload-status .dnd-upload-details .dnd-progress-bar span.complete { width:100%!important; padding-right:5px; }
123
- .dnd-upload-counter { position:absolute; right:5px; bottom:3px; font-size:12px; }
124
-
125
- /* CodeDropz Upload Plugin */
126
- .codedropz-upload-handler {
127
- border:2px dashed #c5c5c5;
128
- border-radius:5px;
129
- margin-bottom:10px;
130
- position:relative;
131
- }
132
- .codedropz-upload-container {
133
- padding:15px 20px;
134
- }
135
-
136
- .codedropz-upload-inner {
137
- overflow:hidden;
138
- width:100%;
139
- white-space: nowrap;
140
- text-align:center;
141
- text-overflow: ellipsis;
142
- font-weight:inherit;
143
- }
144
- .codedropz-upload-inner .codedropz-btn-wrap a.cd-upload-btn {
145
- text-decoration:none;
146
- box-shadow:none;
147
- }
148
- .codedropz-upload-inner h3 {
149
- margin:5px 0;
150
- font-size:30px;
151
- line-height:32px;
152
- }
153
-
154
- /* Add border on dragenter, drag etc */
155
- .codedropz-dragover {
156
- border-color:#6b6a6a;
157
- }
158
-
159
- .codedropz-upload-wrapper span.has-error-msg {
160
- display:inline-block;
161
- color:#ff0000;
162
- padding:5px 0;
163
- font-style:italic;
164
- }
165
-
166
- /* Jquery Validation For Contact Form 7 */
167
- .wpcf7-form label.error-new {
168
- color: #900;
169
- font-size: 11px;
170
- float: none;
171
- padding-left: 5px;
172
- }
173
- .wpcf7-form .codedropz-upload-wrapper.invalid .codedropz-upload-handler{
174
- border-bottom-color: #900;
175
- border-bottom-style: solid;
176
- }
177
- /* END : Jquery Validation CF7 */
178
-
179
- @media screen and (max-width: 767px) {
180
- .dnd-upload-status .dnd-upload-details .name em { font-weight:normal; }
181
- .dnd-upload-status .dnd-upload-details .name { padding-right:60px; }
182
- .codedropz-upload-inner h3 { font-size:22px; }
183
  }
1
+ /* Delete Status */
2
+ .dnd-icon-remove.deleting { font-size:12px; color:#000; font-weight: 500; position: relative; top:-3px; }
3
+ .dnd-icon-remove.deleting:after { display:none!important; }
4
+
5
+ .wpcf7-drag-n-drop-file.d-none {
6
+ display:none;
7
+ opacity:0;
8
+ visibility:hidden;
9
+ position:absolute;
10
+ top:0;
11
+ }
12
+
13
+ /* Upload Status */
14
+ .dnd-upload-status {
15
+ display:flex;
16
+ padding:4px 0;
17
+ align-items:center;
18
+ position:relative;
19
+ }
20
+
21
+ /* Progress bar - Image */
22
+ .dnd-upload-status .dnd-upload-image {
23
+ width:40px;
24
+ height:40px;
25
+ border:1px solid #a5a5a5;
26
+ text-align:center;
27
+ border-radius:100%;
28
+ position:relative;
29
+ }
30
+ .dnd-upload-status .dnd-upload-image span.file {
31
+ background-image: url("data:image/svg+xml,%0A%3Csvg width='18' height='23' viewBox='0 0 18 23' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M12.569 0.659576H0.5V23H18V6.09053L12.569 0.659576ZM12.7872 1.93075L16.7288 5.87234H12.7872V1.93075ZM1.24468 22.2553V1.40426H12.0426V6.61702H17.2553V22.2553H1.24468Z' fill='%235C5B5B'/%3E%3C/svg%3E%0A");
32
+ background-repeat: no-repeat;
33
+ background-size: 100%;
34
+ height: 21px;
35
+ width: 16px;
36
+ display: block;
37
+ position: absolute;
38
+ left: 50%;
39
+ top: 50%;
40
+ transform: translate(-50%, -50%);
41
+ -moz-transform : translate(-50%, -50%);
42
+ -webkit-transform: translate(-50%, -50%);
43
+ }
44
+
45
+ /* Progress bar - Image Details ( Name and Size ) */
46
+ .dnd-upload-status .dnd-upload-details {
47
+ padding-left:10px;
48
+ width: calc(100% - 40px);
49
+ }
50
+ .dnd-upload-status .dnd-upload-details .name {color:#016d98; padding:4px 0; padding-right:60px; display:flex; }
51
+ .dnd-upload-status .dnd-upload-details .name span { text-overflow: ellipsis; white-space: nowrap; overflow: hidden; position: relative; padding-right:10px; }
52
+ .dnd-upload-status .dnd-upload-details .name em {color:#444242; font-weight:700; }
53
+
54
+ /* Remove Upload File */
55
+ .dnd-upload-status .dnd-upload-details .remove-file {
56
+ position:absolute;
57
+ right:0;
58
+ top:10px;
59
+ text-decoration:none;
60
+ box-shadow:none;
61
+ outline:none;
62
+ opacity:1;
63
+ }
64
+ .dnd-upload-status .dnd-upload-details .remove-file span:after {
65
+ content: '';
66
+ width:15px;
67
+ height:15px;
68
+ display: block;
69
+ background-repeat:no-repeat;
70
+ background-size:100%;
71
+ background-image: url("data:image/svg+xml,%3Csvg width='35' height='35' viewBox='0 0 35 35' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M17.5 0C7.83499 0 0 7.83499 0 17.5C0 27.165 7.83499 35 17.5 35C27.165 35 35 27.165 35 17.5C34.9888 7.83965 27.1604 0.0112198 17.5 0ZM17.5 33.871C8.45857 33.871 1.12903 26.5414 1.12903 17.5C1.12903 8.45857 8.45857 1.12903 17.5 1.12903C26.5414 1.12903 33.871 8.45857 33.871 17.5C33.861 26.5373 26.5373 33.861 17.5 33.871Z' fill='black'/%3E%3Cpath d='M25.4834 9.51661C25.2629 9.29624 24.9056 9.29624 24.6852 9.51661L17.5 16.7018L10.3148 9.51661C10.0983 9.29236 9.74087 9.28615 9.51661 9.50271C9.29236 9.71927 9.28615 10.0767 9.50271 10.3009C9.50723 10.3057 9.51188 10.3103 9.51661 10.3148L16.7018 17.5L9.51661 24.6852C9.29236 24.9018 9.28615 25.2591 9.50278 25.4834C9.71941 25.7076 10.0768 25.7139 10.301 25.4972C10.3057 25.4927 10.3103 25.488 10.3148 25.4834L17.5 18.2982L24.6852 25.4834C24.9094 25.7 25.2668 25.6938 25.4834 25.4696C25.6947 25.2508 25.6947 24.9039 25.4834 24.6852L18.2982 17.5L25.4834 10.3148C25.7038 10.0944 25.7038 9.73705 25.4834 9.51661Z' fill='black'/%3E%3C/svg%3E%0A");
72
+ }
73
+ .dnd-upload-status.in-progress .remove-file { opacity:0.2;}
74
+
75
+ .dnd-upload-status .dnd-upload-details span.has-error { color:#f50505; }
76
+
77
+ /* Progress Loading */
78
+ .dnd-upload-status .dnd-upload-details .dnd-progress-bar {
79
+ display: block;
80
+ border-radius: 5px;
81
+ overflow: hidden;
82
+ background: #565555;
83
+ height: 14px;
84
+ }
85
+ .dnd-upload-status .dnd-upload-details .dnd-progress-bar span {
86
+ background: #4CAF50;
87
+ display: block;
88
+ font-size: 11px;
89
+ text-align: right;
90
+ color: #fff;
91
+ height: 100%;
92
+ width:0;
93
+ line-height:14px;
94
+ }
95
+ .dnd-upload-status .dnd-upload-details .dnd-progress-bar span.complete { width:100%!important; padding-right:5px; }
96
+ .dnd-upload-counter { position:absolute; right:5px; bottom:3px; font-size:12px; }
97
+
98
+ /* CodeDropz Upload Plugin */
99
+ .codedropz-upload-handler {
100
+ border:2px dashed #c5c5c5;
101
+ border-radius:5px;
102
+ margin-bottom:10px;
103
+ position:relative;
104
+ }
105
+ .codedropz-upload-container {
106
+ padding:15px 20px;
107
+ }
108
+
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;
116
+ }
117
+ .codedropz-upload-inner .codedropz-btn-wrap a.cd-upload-btn {
118
+ text-decoration:none;
119
+ box-shadow:none;
120
+ }
121
+ .codedropz-upload-inner h3 {
122
+ margin:5px 0;
123
+ font-size:30px;
124
+ line-height:32px;
125
+ }
126
+
127
+ /* Add border on dragenter, drag etc */
128
+ .codedropz-dragover {
129
+ border-color:#6b6a6a;
130
+ }
131
+
132
+ .codedropz-upload-wrapper span.has-error-msg {
133
+ display:inline-block;
134
+ color:#ff0000;
135
+ padding:5px 0;
136
+ font-style:italic;
137
+ }
138
+
139
+ /* Jquery Validation For Contact Form 7 */
140
+ .wpcf7-form label.error-new {
141
+ color: #900;
142
+ font-size: 11px;
143
+ float: none;
144
+ padding-left: 5px;
145
+ }
146
+ .wpcf7-form .codedropz-upload-wrapper.invalid .codedropz-upload-handler{
147
+ border-bottom-color: #900;
148
+ border-bottom-style: solid;
149
+ }
150
+ /* END : Jquery Validation CF7 */
151
+
152
+ @media screen and (max-width: 767px) {
153
+ .dnd-upload-status .dnd-upload-details .name em { font-weight:normal; }
154
+ .dnd-upload-status .dnd-upload-details .name { padding-right:60px; }
155
+ .codedropz-upload-inner h3 { font-size:22px; }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
156
  }
assets/fonts/icomoon.eot DELETED
Binary file
assets/fonts/icomoon.svg DELETED
@@ -1,13 +0,0 @@
1
- <?xml version="1.0" standalone="no"?>
2
- <!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd" >
3
- <svg xmlns="http://www.w3.org/2000/svg">
4
- <metadata>Generated by IcoMoon</metadata>
5
- <defs>
6
- <font id="icomoon" horiz-adv-x="1024">
7
- <font-face units-per-em="1024" ascent="960" descent="-64" />
8
- <missing-glyph horiz-adv-x="1024" />
9
- <glyph unicode="&#x20;" horiz-adv-x="512" d="" />
10
- <glyph unicode="&#xe900;" glyph-name="blank-file" d="M640 960h-512v-1024h768v768l-256 256zM576 640h256v-640h-640v896h384v-256zM640 704v192l192-192h-192z" />
11
- <glyph unicode="&#xe901;" glyph-name="remove" d="M510 962c-282.773 0-512-229.227-512-512s229.227-512 512-512 512 229.227 512 512c-0.336 282.633-229.367 511.664-512 512zM510 2c-247.422 0-448 200.578-448 448s200.578 448 448 448 448-200.578 448-448c-0.266-247.313-200.688-447.734-448-448zM758.898 698.898c-12.5 12.492-32.758 12.492-45.25 0l-203.648-203.648-203.648 203.648c-12.281 12.711-32.539 13.063-45.25 0.781-12.711-12.273-13.063-32.531-0.781-45.242 0.258-0.266 0.516-0.531 0.781-0.789l203.648-203.648-203.648-203.648c-12.711-12.273-13.063-32.531-0.781-45.25 12.273-12.711 32.531-13.063 45.242-0.781 0.266 0.258 0.531 0.516 0.789 0.781l203.648 203.648 203.648-203.648c12.711-12.273 32.969-11.922 45.242 0.789 11.977 12.398 11.977 32.063 0 44.461l-203.641 203.648 203.648 203.648c12.492 12.492 12.492 32.75 0 45.25z" />
12
- <glyph unicode="&#xe902;" glyph-name="upload" d="M338.082 751.396c4.443 0 8.886 1.701 12.271 5.085l144.282 144.282v-617.639c0-9.598 7.758-17.356 17.356-17.356s17.356 7.758 17.356 17.356v617.639l143.571-143.571c6.786-6.786 17.755-6.786 24.542 0s6.786 17.755 0 24.542l-173.18 173.18c-1.597 1.614-3.523 2.881-5.675 3.766-4.235 1.753-9.008 1.753-13.26 0-2.135-0.885-4.061-2.17-5.658-3.766l-173.875-173.892c-6.786-6.786-6.786-17.755 0-24.542 3.384-3.402 7.828-5.085 12.271-5.085zM633.485 682.318c-9.598 0-17.356-7.758-17.356-17.356s7.758-17.356 17.356-17.356h225.631v-676.893h-694.249v676.893h225.631c9.598 0 17.356 7.758 17.356 17.356s-7.758 17.356-17.356 17.356h-260.343v-746.318h763.674v746.318h-260.343z" />
13
- </font></defs></svg>
 
 
 
 
 
 
 
 
 
 
 
 
 
assets/fonts/icomoon.ttf DELETED
Binary file
assets/fonts/icomoon.woff DELETED
Binary file
assets/js/codedropz-uploader-min.js CHANGED
@@ -1,11 +1,11 @@
1
  /**
2
- * CodeDropz Uploader v1.3.5.7
3
  * Copyright 2018 Glen Mongaya
4
  * CodeDrop Drag&Drop Uploader
5
- * @version 1.3.5.7
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 n='<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"),s=r.handler.parents(".codedropz-upload-wrapper"),p=e('input[type="submit"]',t);r.handler.after(n),e(".codedropz-upload-handler",s).on("drag dragstart dragend dragover dragenter dragleave drop",function(e){e.preventDefault(),e.stopPropagation()}),e(".codedropz-upload-handler",s).on("dragover dragenter",function(a){e(this).addClass("codedropz-dragover")}),e(".codedropz-upload-handler",s).on("dragleave dragend drop",function(a){e(this).removeClass("codedropz-dragover")}),e("a.cd-upload-btn",s).on("click",function(e){e.preventDefault(),r.handler.val(null),r.handler.click()}),e(".codedropz-upload-handler",s).on("drop",function(e){l(e.originalEvent.dataTransfer.files,"drop")}),r.handler.on("change",function(e){l(this.files,"click")});var l=function(a,n){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",n),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,n){if(void 0!==p.delete&&p.delete("upload-file"),localStorage.getItem(o)>r.max_file)return!e("span.has-error-msg",s).length>0&&(err_msg=dnd_cf7_uploader.drag_n_drop_upload.max_file_limit,s.append('<span class="has-error-msg">'+err_msg.replace("%count%",r.max_file)+"</span>")),!1;var l=i.createProgressBar(n),c=!1;if(n.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(n.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",n);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",s),r="dnd-file-"+Math.random().toString(36).substr(2,9),n='<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">'+n+"</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"),n=r.parents(".codedropz-upload-wrapper"),t=r.parent("a").attr("data-storage"),s=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,s-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,s-1),e(".dnd-upload-status",n).length<=1&&e("span.has-error-msg",n).remove(),e(".dnd-upload-counter span",n).text(Number(localStorage.getItem(t))-1))}),e("span.has-error-msg").remove()})}}(jQuery);
1
  /**
2
+ * CodeDropz Uploader v1.3.5.8
3
  * Copyright 2018 Glen Mongaya
4
  * CodeDrop Drag&Drop Uploader
5
+ * @version 1.3.5.8
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"><'+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))},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="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);
assets/js/dnd-upload-cf7.js CHANGED
@@ -1,69 +1,69 @@
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
-
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 ) {
12
- $.each( inputFile, function(){
13
- // Reset file counts
14
- localStorage.setItem( $(this).attr('data-name') + '_count_files', 1 );
15
- });
16
- }else {
17
- // Reset file counts
18
- localStorage.setItem( inputFile.attr('data-name') + '_count_files', 1 );
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
-
28
- window.initDragDrop = function () {
29
-
30
- // Get text object options/settings from localize script
31
- var TextOJB = dnd_cf7_uploader.drag_n_drop_upload;
32
-
33
- // Support Multiple Fileds
34
- $('.wpcf7-drag-n-drop-file').CodeDropz_Uploader({
35
- 'color' : '#fff',
36
- 'ajax_url' : dnd_cf7_uploader.ajax_url,
37
- 'text' : TextOJB.text,
38
- 'separator' : TextOJB.or_separator,
39
- 'button_text' : TextOJB.browse,
40
- 'server_max_error' : TextOJB.server_max_error,
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 || $form.hasClass('wpcf7-acceptance-as-validation') ) {
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
-
65
- }
66
-
67
- window.initDragDrop();
68
-
69
  });
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
+
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 ) {
12
+ $.each( inputFile, function(){
13
+ // Reset file counts
14
+ localStorage.setItem( $(this).attr('data-name') + '_count_files', 1 );
15
+ });
16
+ }else {
17
+ // Reset file counts
18
+ localStorage.setItem( inputFile.attr('data-name') + '_count_files', 1 );
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
+
28
+ window.initDragDrop = function () {
29
+
30
+ // Get text object options/settings from localize script
31
+ var TextOJB = dnd_cf7_uploader.drag_n_drop_upload;
32
+
33
+ // Support Multiple Fileds
34
+ $('.wpcf7-drag-n-drop-file').CodeDropz_Uploader({
35
+ 'color' : '#fff',
36
+ 'ajax_url' : dnd_cf7_uploader.ajax_url,
37
+ 'text' : TextOJB.text,
38
+ 'separator' : TextOJB.or_separator,
39
+ 'button_text' : TextOJB.browse,
40
+ 'server_max_error' : TextOJB.server_max_error,
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 || $form.hasClass('wpcf7-acceptance-as-validation') ) {
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
+
65
+ }
66
+
67
+ window.initDragDrop();
68
+
69
  });
drag-n-drop-upload-cf7.php CHANGED
@@ -1,35 +1,35 @@
1
- <?php
2
-
3
- /**
4
- * Plugin Name: Drag and Drop Multiple File Upload - Contact Form 7
5
- * Plugin URI: https://profiles.wordpress.org/glenwpcoder
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.5.7
10
- * Author: Glen Don L. Mongaya
11
- * Author URI: http://codedropz.com
12
- * License: GPL2
13
- **/
14
-
15
- /** This protect the plugin file from direct access */
16
- if ( ! defined( 'WPINC' ) ) {
17
- die;
18
- }
19
-
20
- /** Set plugin constant to true **/
21
- define( 'dnd_upload_cf7', true );
22
-
23
- /** Define plugin Version */
24
- define( 'dnd_upload_cf7_version', '1.3.5.7' );
25
-
26
- /** Define constant Plugin Directories */
27
- define( 'dnd_upload_cf7_directory', untrailingslashit( dirname( __FILE__ ) ) );
28
-
29
- /* Define Custom Upload Directory */
30
- if( ! defined('wpcf7_dnd_dir') ) {
31
- define('wpcf7_dnd_dir', 'wp_dndcf7_uploads');
32
- }
33
-
34
- // require plugin core file
35
  require_once( dnd_upload_cf7_directory .'/inc/dnd-upload-cf7.php' );
1
+ <?php
2
+
3
+ /**
4
+ * Plugin Name: Drag and Drop Multiple File Upload - Contact Form 7
5
+ * Plugin URI: https://profiles.wordpress.org/glenwpcoder
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.5.8
10
+ * Author: Glen Don L. Mongaya
11
+ * Author URI: http://codedropz.com
12
+ * License: GPL2
13
+ **/
14
+
15
+ /** This protect the plugin file from direct access */
16
+ if ( ! defined( 'WPINC' ) ) {
17
+ die;
18
+ }
19
+
20
+ /** Set plugin constant to true **/
21
+ define( 'dnd_upload_cf7', true );
22
+
23
+ /** Define plugin Version */
24
+ define( 'dnd_upload_cf7_version', '1.3.5.8' );
25
+
26
+ /** Define constant Plugin Directories */
27
+ define( 'dnd_upload_cf7_directory', untrailingslashit( dirname( __FILE__ ) ) );
28
+
29
+ /* Define Custom Upload Directory */
30
+ if( ! defined('wpcf7_dnd_dir') ) {
31
+ define('wpcf7_dnd_dir', 'wp_dndcf7_uploads');
32
+ }
33
+
34
+ // require plugin core file
35
  require_once( dnd_upload_cf7_directory .'/inc/dnd-upload-cf7.php' );
inc/dnd-upload-cf7.php CHANGED
@@ -1,1063 +1,1066 @@
1
- <?php
2
-
3
- /**
4
- * @Description : Plugin main core
5
- * @Package : Drag & Drop Multiple File Upload - Contact Form 7
6
- * @Author : Glen Don L. Mongaya
7
- */
8
-
9
- if ( ! defined( 'ABSPATH' ) || ! defined('dnd_upload_cf7') ) {
10
- exit;
11
- }
12
-
13
- /**
14
- * Begin : begin plugin hooks
15
- */
16
-
17
- add_action( 'wpcf7_init', 'dnd_cf7_upload_add_form_tag_file' );
18
- add_action( 'wpcf7_enqueue_scripts', 'dnd_cf7_scripts' );
19
-
20
- // Hook on plugins loaded
21
- add_action('plugins_loaded','dnd_cf7_upload_plugins_loaded');
22
-
23
- // Ajax Upload
24
- add_action( 'wp_ajax_dnd_codedropz_upload', 'dnd_upload_cf7_upload' );
25
- add_action( 'wp_ajax_nopriv_dnd_codedropz_upload', 'dnd_upload_cf7_upload' );
26
-
27
- // Hook - Ajax Delete
28
- add_action('wp_ajax_nopriv_dnd_codedropz_upload_delete', 'dnd_codedropz_upload_delete');
29
- add_action('wp_ajax_dnd_codedropz_upload_delete','dnd_codedropz_upload_delete');
30
-
31
- // Hook mail cf7
32
- add_filter('wpcf7_posted_data', 'dnd_wpcf7_posted_data', 10, 1);
33
- add_action('wpcf7_before_send_mail','dnd_cf7_before_send_mail', 30, 1);
34
- add_action('wpcf7_mail_components','dnd_cf7_mail_components', 50, 2);
35
-
36
- // Auto clean up dir/files
37
- add_action('template_redirect', 'dnd_cf7_auto_clean_dir', 20, 0 );
38
-
39
- // Add row meta links
40
- add_filter( 'plugin_row_meta', 'dnd_custom_plugin_row_meta', 10, 2 );
41
-
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
-
48
- // Add custom script in footer
49
- add_action('wp_footer','dnd_custom_scripts');
50
-
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
-
57
- // Load language domain
58
- load_plugin_textdomain( 'drag-and-drop-multiple-file-upload-contact-form-7', false, dirname( dirname( plugin_basename( __FILE__ ) ) ) . '/languages' );
59
-
60
- // Create dir
61
- $dir = dnd_get_upload_dir();
62
- if( isset( $dir['upload_dir'] ) && is_dir( $dir['upload_dir'] ) ) {
63
- // Generate .htaccess file`
64
- $htaccess_file = path_join( dirname( $dir['upload_dir'] ), '.htaccess' );
65
- if ( ! file_exists( $htaccess_file ) ) {
66
- if ( $handle = fopen( $htaccess_file, 'w' ) ) {
67
- fwrite( $handle, "Options -Indexes \n <Files *.php> \n deny from all \n </Files>" );
68
- fclose( $handle );
69
- }
70
- }
71
- }
72
- }
73
-
74
- // Remove uploaded files when item is deleted permanently.
75
- function dnd_remove_uploaded_files( $post_id ) {
76
- $post_type = get_post_type( $post_id );
77
- $page = get_post( $post_id );
78
- if( $post_type == 'flamingo_inbound' ) {
79
- preg_match_all( '/(.*?)(\/'.wpcf7_dnd_dir.'\/wpcf7-files\/.*$)/m', $page->post_content, $matches );
80
- if( $matches[0] && count( $matches[0] ) > 0 ) {
81
- foreach( $matches[0] as $files ) {
82
- $new_file = str_replace( site_url().'/', wp_normalize_path( ABSPATH ), $files );
83
- if( file_exists( $new_file ) ) {
84
- wp_delete_file( $new_file );
85
- }
86
- }
87
- }
88
- }
89
- }
90
-
91
- // Modify contact form posted_data
92
- function dnd_wpcf7_posted_data( $posted_data ){
93
-
94
- // Subbmisson instance from CF7
95
- $submission = WPCF7_Submission::get_instance();
96
-
97
- // Make sure we have the data
98
- if ( ! $posted_data ) {
99
- $posted_data = $submission->get_posted_data();
100
- }
101
-
102
- // Scan and get all form tags from cf7 generator
103
- $forms_tags = $submission->get_contact_form();
104
- $uploads_dir = dnd_get_upload_dir();
105
-
106
- if( $forms = $forms_tags->scan_form_tags() ) {
107
- foreach( $forms as $field ) {
108
- $field_name = $field->name;
109
- if( $field->basetype == 'mfile' && isset( $posted_data[$field_name] ) && ! empty( $posted_data[$field_name] ) ) {
110
- foreach( $posted_data[$field_name] as $key => $file ) {
111
- $posted_data[$field_name][$key] = trailingslashit( $uploads_dir['upload_url'] ) . wp_basename( $file );
112
- }
113
- }
114
- }
115
- }
116
-
117
- return $posted_data;
118
- }
119
-
120
- // Hooks for admin settings
121
- function dnd_admin_settings() {
122
- add_submenu_page( 'wpcf7', 'Drag & Drop Uploader - Settings', 'Drag & Drop Upload', 'manage_options', 'drag-n-drop-upload','dnd_upload_admin_settings');
123
- add_action('admin_init','dnd_upload_register_settings');
124
- }
125
-
126
- // Add custom mime-types
127
- function dnd_extra_mime_types( $mime_types ){
128
- $mime_types['xls'] = 'application/excel, application/vnd.ms-excel, application/x-excel, application/x-msexcel';
129
- $mime_types['xlsx'] = 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet';
130
- return $mime_types;
131
- }
132
-
133
- // Default Error Message
134
- function dnd_cf7_error_msg( $error_key ) {
135
-
136
- // Array of default error message
137
- $errors = array(
138
- 'server_limit' => __('The uploaded file exceeds the maximum upload size of your server.','drag-and-drop-multiple-file-upload-contact-form-7'),
139
- 'failed_upload' => __('Uploading a file fails for any reason','drag-and-drop-multiple-file-upload-contact-form-7'),
140
- 'large_file' => __('Uploaded file is too large','drag-and-drop-multiple-file-upload-contact-form-7'),
141
- 'invalid_type' => __('Uploaded file is not allowed for file type','drag-and-drop-multiple-file-upload-contact-form-7'),
142
- 'max_file_limit' => __('Note : Some of the files are not uploaded ( Only %count% files allowed )','drag-and-drop-multiple-file-upload-contact-form-7'),
143
- 'required' => __('This field is required.', 'drag-and-drop-multiple-file-upload-contact-form-7' ),
144
- 'min_file' => __('Minimum file upload at least','drag-and-drop-multiple-file-upload-contact-form-7'),
145
- );
146
-
147
- // return error message based on $error_key request
148
- if( isset( $errors[ $error_key ] ) ) {
149
- return $errors[ $error_key ];
150
- }
151
-
152
- return false;
153
- }
154
-
155
- // Get folder path
156
- function dnd_get_upload_dir() {
157
- $upload = wp_upload_dir();
158
- $uploads_dir = wpcf7_dnd_dir . '/wpcf7-files';
159
-
160
- // If save as attachment ( also : Check if upload use year and month folders )
161
- if( get_option('drag_n_drop_mail_attachment') == 'yes' ) {
162
- $uploads_dir = ( get_option('uploads_use_yearmonth_folders') ? wpcf7_dnd_dir . $upload['subdir'] : wpcf7_dnd_dir );
163
- }
164
-
165
- // Create directory
166
- if ( ! is_dir( trailingslashit( $upload['basedir'] ) . $uploads_dir ) ) {
167
- wp_mkdir_p( trailingslashit( $upload['basedir'] ) . $uploads_dir );
168
- }
169
-
170
- // Make sure directory exist before returning
171
- if( file_exists( trailingslashit( $upload['basedir'] ) . $uploads_dir ) ) {
172
- return array(
173
- 'upload_dir' => trailingslashit( $upload['basedir'] ) . $uploads_dir,
174
- 'upload_url' => trailingslashit( $upload['baseurl'] ) . $uploads_dir
175
- );
176
- }
177
-
178
- return trailingslashit( $upload['basedir'] ) . $uploads_dir;
179
- }
180
-
181
- // Clean up directory - From Contact Form 7
182
- function dnd_cf7_auto_clean_dir( $seconds = 3600, $max = 60 ) {
183
- if ( is_admin() || 'GET' != $_SERVER['REQUEST_METHOD'] || is_robots() || is_feed() || is_trackback() ) {
184
- return;
185
- }
186
-
187
- // Setup dirctory path
188
- $upload = wp_upload_dir();
189
- $dir = trailingslashit( $upload['basedir'] ) . wpcf7_dnd_dir . '/wpcf7-files/';
190
-
191
- // Make sure dir is readable or writable
192
- if ( ! is_dir( $dir ) || ! is_readable( $dir ) || ! wp_is_writable( $dir ) ) {
193
- return;
194
- }
195
-
196
- $seconds = apply_filters( 'dnd_cf7_auto_delete_files', $seconds );
197
- $max = absint( $max );
198
- $count = 0;
199
-
200
- if ( $handle = @opendir( $dir ) ) {
201
- while ( false !== ( $file = readdir( $handle ) ) ) {
202
- if ( $file == "." || $file == ".." ) {
203
- continue;
204
- }
205
-
206
- // Get file time of files OLD files.
207
- $mtime = @filemtime( $dir . $file );
208
-
209
- if ( $mtime && time() < $mtime + absint( $seconds ) ) { // less than $seconds old
210
- continue;
211
- }
212
-
213
- // Delete files from dir
214
- if( $file != '.htaccess' ) {
215
- wp_delete_file( $dir . $file );
216
- }
217
-
218
- $count += 1;
219
-
220
- if ( $max <= $count ) {
221
- break;
222
- }
223
- }
224
- @closedir( $handle );
225
- }
226
- @rmdir( $dir );
227
- }
228
-
229
- // Hooks before sending the email - ( append links to body email )
230
- function dnd_cf7_before_send_mail( $wpcf7 ){
231
- global $_mail;
232
-
233
- // Get upload path / dir
234
- $upload_path = dnd_get_upload_dir();
235
-
236
- // Mail Counter
237
- $_mail = 0;
238
-
239
- // Check If send attachment as link
240
- if( ! get_option('drag_n_drop_mail_attachment') ) {
241
- return $wpcf7;
242
- }
243
-
244
- // cf7 instance
245
- $submission = WPCF7_Submission::get_instance();
246
-
247
- // Check for submission
248
- if( $submission ) {
249
-
250
- // Get posted data
251
- $submitted['posted_data'] = $submission->get_posted_data();
252
-
253
- // Parse fields
254
- $fields = $wpcf7->scan_form_tags();
255
-
256
- // Links
257
- $links = array();
258
-
259
- // Prop email
260
- $mail = $wpcf7->prop('mail');
261
- $mail_2 = $wpcf7->prop('mail_2');
262
-
263
- // Default upload path
264
- $simple_path = dirname( $upload_path['upload_url'] ); // dirname - remove duplicate form dir (/wpcf-dnd-uploads/wpcf7-dnd-uploads/example.jpg)
265
-
266
- // Loop fields and replace mfile code
267
- foreach( $fields as $field ) {
268
- if( $field->basetype == 'mfile') {
269
- if( isset( $submitted['posted_data'][$field->name] ) && ! empty( $submitted['posted_data'][$field->name] ) ) {
270
-
271
- // Get posted_data files
272
- $files = $submitted['posted_data'][$field->name];
273
-
274
- // Links - 1
275
- $mail_links = dnd_cf7_links( $files, $mail['use_html'] );
276
- $mail['body'] = str_replace( "[$field->name]", "\n" . implode( "\n", $mail_links ), $mail['body'] );
277
-
278
- // Links - 2
279
- if( $mail_2['active'] ) {
280
- $mail_links_2 = dnd_cf7_links( $files, $mail_2['use_html'] );
281
- $mail_2['body'] = str_replace( "[$field->name]", "\n" . implode( "\n", $mail_links_2 ), $mail_2['body'] );
282
- }
283
- }
284
- }
285
- }
286
-
287
- // Save the email body
288
- $wpcf7->set_properties( array("mail" => $mail) );
289
-
290
- // if mail 2
291
- if( $mail_2['active'] ) {
292
- $wpcf7->set_properties( array("mail_2" => $mail_2) );
293
- }
294
- }
295
-
296
- return $wpcf7;
297
- }
298
-
299
- // Get file links.
300
- function dnd_cf7_links( $files, $use_html = false) {
301
-
302
- // check and make sure we have files
303
- if( ! $files ) {
304
- return;
305
- }
306
-
307
- // Setup html links
308
- $links = array();
309
- foreach( $files as $file ) {
310
- $links[] = ( $use_html ? '<a href="'. esc_url( $file ) .'">'. wp_basename( $file ) .'</a>' : $file );
311
- }
312
-
313
- // Allow other themes/plugin to modify data.
314
- return apply_filters('dndcf7_before_send_files', $links, $files );
315
- }
316
-
317
- // Log message...
318
- function dnd_logs( $message, $email = false ) {
319
- $uploads_dir = dnd_get_upload_dir();
320
- $file = fopen( $uploads_dir['upload_dir']."/logs.txt", "a") or die("Unable to open file!");
321
- fwrite( $file, "\n". ( is_array( $message ) ? print_r( $message, true ) : $message ) );
322
- fclose( $file );
323
- }
324
-
325
- // hooks - Custom cf7 Mail components ( Attached File on Email )
326
- function dnd_cf7_mail_components( $components, $form ) {
327
- global $_mail;
328
-
329
- if( ! $form ) {
330
- return;
331
- }
332
-
333
- // Get upload directory
334
- $uploads_dir = dnd_get_upload_dir();
335
-
336
- // cf7 - Submission Object
337
- $submission = WPCF7_Submission::get_instance();
338
-
339
- // get all form fields
340
- $fields = $form->scan_form_tags();
341
-
342
- // Send email link as an attachment.
343
- if( get_option('drag_n_drop_mail_attachment') == 'yes' ) {
344
- return $components;
345
- }
346
-
347
- // Get mail,mail_2 attachment [tags]
348
- $mail = array('mail','mail_2');
349
- $props_mail = array();
350
-
351
- foreach( $mail as $single_mail ) {
352
- $props_mail[] = $form->prop( $single_mail );
353
- }
354
-
355
- // Get email attachments (mail, mail_2)
356
- $mail = $props_mail[ $_mail ];
357
- if( $mail['active'] && $mail['attachments'] ) {
358
-
359
- // Loop fields get mfile only.
360
- foreach( $fields as $field ) {
361
-
362
- // If field type equal to mfile which our default field.
363
- if( $field->basetype == 'mfile') {
364
-
365
- // Make sure we have files to attach
366
- if( isset( $_POST[ $field->name ] ) && count( $_POST[ $field->name ] ) > 0 ) {
367
-
368
- // Check and make sure [upload-file-xxx] exists in attachments - fields
369
- if ( false !== strpos( $mail['attachments'], "[{$field->name}]" ) ) {
370
-
371
- // Loop all the files and attach to cf7 components
372
- foreach( $_POST[ $field->name ] as $_file ) {
373
-
374
- // Join dir and a new file name ( get from <input type="hidden" name="upload-file-333"> )
375
- $new_file_name = trailingslashit( $uploads_dir['upload_dir'] ) . wp_basename( $_file );
376
-
377
- // Check if submitted and file exists then file is ready.
378
- if ( $submission && file_exists( $new_file_name ) ) {
379
- $components['attachments'][] = $new_file_name;
380
- }
381
- }
382
-
383
- }
384
- }
385
- }
386
- }
387
-
388
- }
389
-
390
- // Increment mail counter
391
- $_mail = $_mail + 1;
392
-
393
- // Return setup components
394
- return $components;
395
- }
396
-
397
- // Load js and css
398
- function dnd_cf7_scripts() {
399
-
400
- // Get plugin version
401
- $version = dnd_upload_cf7_version;
402
-
403
- // enque script
404
- wp_enqueue_script( 'codedropz-uploader', plugins_url ('/assets/js/codedropz-uploader-min.js', dirname(__FILE__) ), array('jquery'), $version, true );
405
- wp_enqueue_script( 'dnd-upload-cf7', plugins_url ('/assets/js/dnd-upload-cf7.js', dirname(__FILE__) ), array('jquery','codedropz-uploader','contact-form-7'), $version, true );
406
-
407
- // registered script with data for a JavaScript variable.
408
- wp_localize_script( 'dnd-upload-cf7', 'dnd_cf7_uploader',
409
- array(
410
- 'ajax_url' => admin_url( 'admin-ajax.php' ),
411
- 'ajax_nonce' => wp_create_nonce( "dnd-cf7-security-nonce" ),
412
- 'drag_n_drop_upload' => array(
413
- 'tag' => ( get_option('drag_n_drop_heading_tag') ? get_option('drag_n_drop_heading_tag') : 'h3' ),
414
- 'text' => ( get_option('drag_n_drop_text') ? get_option('drag_n_drop_text') : __('Drag & Drop Files Here','drag-and-drop-multiple-file-upload-contact-form-7') ),
415
- 'or_separator' => ( get_option('drag_n_drop_separator') ? get_option('drag_n_drop_separator') : __('or','drag-and-drop-multiple-file-upload-contact-form-7') ),
416
- 'browse' => ( get_option('drag_n_drop_browse_text') ? get_option('drag_n_drop_browse_text') : __('Browse Files','drag-and-drop-multiple-file-upload-contact-form-7') ),
417
- 'server_max_error' => ( get_option('drag_n_drop_error_server_limit') ? get_option('drag_n_drop_error_server_limit') : dnd_cf7_error_msg('server_limit') ),
418
- 'large_file' => ( get_option('drag_n_drop_error_files_too_large') ? get_option('drag_n_drop_error_files_too_large') : dnd_cf7_error_msg('large_file') ),
419
- 'inavalid_type' => ( get_option('drag_n_drop_error_invalid_file') ? get_option('drag_n_drop_error_invalid_file') : dnd_cf7_error_msg('invalid_type') ),
420
- 'max_file_limit' => ( get_option('drag_n_drop_error_max_file') ? get_option('drag_n_drop_error_max_file') : dnd_cf7_error_msg('max_file_limit') ),
421
- 'required' => dnd_cf7_error_msg('required'),
422
- 'delete' => array(
423
- 'text' => __('deleting','drag-and-drop-multiple-file-upload-contact-form-7'),
424
- 'title' => __('Remove','drag-and-drop-multiple-file-upload-contact-form-7')
425
- )
426
- ),
427
- 'dnd_text_counter' => __('of','drag-and-drop-multiple-file-upload-contact-form-7'),
428
- 'disable_btn' => ( get_option('drag_n_drop_disable_btn') == 'yes' ? true : false )
429
- )
430
- );
431
-
432
- // enque style
433
- wp_enqueue_style( 'dnd-upload-cf7', plugins_url ('/assets/css/dnd-upload-cf7.css', dirname(__FILE__) ), '', $version );
434
- }
435
-
436
- // Generate tag
437
- function dnd_cf7_upload_add_form_tag_file() {
438
- wpcf7_add_form_tag( array( 'mfile ', 'mfile*'), 'dnd_cf7_upload_form_tag_handler', array( 'name-attr' => true ) );
439
- }
440
-
441
- // Form tag handler from the tag - callback
442
- function dnd_cf7_upload_form_tag_handler( $tag ) {
443
-
444
- // check and make sure tag name is not empty
445
- if ( empty( $tag->name ) ) {
446
- return '';
447
- }
448
-
449
- // Validate our fields
450
- $validation_error = wpcf7_get_validation_error( $tag->name );
451
-
452
- // Generate class
453
- $class = wpcf7_form_controls_class( 'drag-n-drop-file d-none' );
454
-
455
- // Add not-valid class if there's an error.
456
- if ( $validation_error ) {
457
- $class .= ' wpcf7-not-valid';
458
- }
459
-
460
- // Get current form Object
461
- $form = WPCF7_ContactForm::get_current();
462
-
463
- // Setup element attributes
464
- $atts = array();
465
-
466
- $atts['size'] = $tag->get_size_option( '40' );
467
- $atts['class'] = $tag->get_class_option( $class );
468
- $atts['id'] = $tag->get_id_option();
469
- $atts['tabindex'] = $tag->get_option( 'tabindex', 'signed_int', true );
470
-
471
- // If file is required
472
- if ( $tag->is_required() ) {
473
- $atts['aria-required'] = 'true';
474
- }
475
-
476
- // Set invalid attributes if there's validation error
477
- $atts['aria-invalid'] = $validation_error ? 'true' : 'false';
478
-
479
- // Set input type and name
480
- $atts['type'] = 'file';
481
- $atts['multiple'] = 'multiple';
482
- $atts['data-name'] = $tag->name;
483
- $atts['data-type'] = $tag->get_option( 'filetypes','', true);
484
- $atts['data-limit'] = $tag->get_option( 'limit','', true);
485
- $atts['data-max'] = $tag->get_option( 'max-file','', true);
486
- $atts['data-id'] = ( $form->id() ? $form->id() : 0 );
487
-
488
- // Combine and format attrbiutes
489
- $atts = wpcf7_format_atts( $atts );
490
-
491
- // Return our element and attributes
492
- return sprintf('<span class="wpcf7-form-control-wrap %1$s"><input %2$s />%3$s</span>', sanitize_html_class( $tag->name ), $atts, $validation_error );
493
- }
494
-
495
- // Encode type filter to support multipart since this is input type file
496
- add_filter( 'wpcf7_form_enctype', 'dnd_upload_cf7_form_enctype_filter' );
497
-
498
- function dnd_upload_cf7_form_enctype_filter( $enctype ) {
499
- $multipart = (bool) wpcf7_scan_form_tags( array( 'type' => array( 'drag_drop_file', 'drag_drop_file*' ) ) );
500
-
501
- if ( $multipart ) {
502
- $enctype = 'multipart/form-data';
503
- }
504
-
505
- return $enctype;
506
- }
507
-
508
- // 3rd party compatability...
509
- function dnd_cf7_conditional_fields( $form_id ) {
510
-
511
- if( ! $form_id ) {
512
- return false;
513
- }
514
-
515
- // Get visible groups
516
- $groups = array();
517
-
518
- // Get current form object
519
- $cf7_post = get_post( $form_id );
520
-
521
- // Extract group shortcode
522
- $regex = get_shortcode_regex( array('group') );
523
-
524
- // Match pattern
525
- preg_match_all( '/'. $regex .'/s', $cf7_post->post_content, $matches );
526
-
527
- if( array_key_exists( 3, $matches )) {
528
- foreach( $matches[3] as $index => $group_name ) {
529
- $name = array_filter( explode(" ", $group_name ) );
530
- preg_match('/\[mfile[*|\s].*?\]/', $matches[0][$index], $file_matches );
531
- if( $file_matches ) {
532
- $field_name = shortcode_parse_atts( $file_matches[0] );
533
- $field_name = preg_replace( '/[^a-zA-Z0-9-_]/','', $field_name[1] );
534
- $groups[ $field_name ] = $name[1];
535
- }
536
- }
537
- }
538
-
539
- return $groups;
540
- }
541
-
542
- // Validation + upload handling filter
543
- add_filter( 'wpcf7_validate_mfile', 'dnd_upload_cf7_validation_filter', 10, 2 );
544
- add_filter( 'wpcf7_validate_mfile*', 'dnd_upload_cf7_validation_filter', 10, 2 );
545
-
546
- function dnd_upload_cf7_validation_filter( $result, $tag ) {
547
- $name = $tag->name;
548
- $id = $tag->get_id_option();
549
- $multiple_files = ( ( isset( $_POST[ $name ] ) && count( $_POST[ $name ] ) > 0 ) ? $_POST[ $name ] : null );
550
- $min_file = $tag->get_option( 'min-file','', true);
551
-
552
- // Cf7 Conditional Field
553
- if( in_array('cf7-conditional-fields/contact-form-7-conditional-fields.php', get_option('active_plugins') ) ){
554
-
555
- $hidden_groups = json_decode( stripslashes( $_POST['_wpcf7cf_hidden_groups'] ) );
556
- $form_id = WPCF7_ContactForm::get_current()->id();
557
- $group_fields = dnd_cf7_conditional_fields( $form_id );
558
-
559
- if( is_null( $multiple_files ) && $tag->is_required() ) {
560
- if( isset( $group_fields[ $name ] ) && ! in_array( $group_fields[ $name ], $hidden_groups ) ) {
561
- $result->invalidate( $tag, wpcf7_get_message( 'invalid_required' ) );
562
- }elseif( ! array_key_exists( $name, $group_fields ) ) {
563
- $result->invalidate( $tag, wpcf7_get_message( 'invalid_required' ) );
564
- }
565
- return $result;
566
- }
567
-
568
- return $result;
569
- }
570
-
571
- // Check if we have files or if it's empty
572
- if( is_null( $multiple_files ) && $tag->is_required() ) {
573
- $result->invalidate( $tag, wpcf7_get_message( 'invalid_required' ) );
574
- return $result;
575
- }
576
-
577
- // Check minimum upload
578
- if( $multiple_files && count( $multiple_files ) < (int) $min_file ) {
579
- $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') );
580
- $result->invalidate( $tag, $min_file_error .' '. (int)$min_file );
581
- return $result;
582
- }
583
-
584
- return $result;
585
- }
586
-
587
- // Generate Admin From Tag
588
- add_action( 'wpcf7_admin_init', 'dnd_upload_cf7_add_tag_generator', 50 );
589
-
590
- function dnd_upload_cf7_add_tag_generator() {
591
- $tag_generator = WPCF7_TagGenerator::get_instance();
592
- $tag_generator->add( 'upload-file', __( 'multiple file upload', 'drag-and-drop-multiple-file-upload-contact-form-7' ),'dnd_upload_cf7_tag_generator_file' );
593
- }
594
-
595
- // Display form in admin
596
- function dnd_upload_cf7_tag_generator_file( $contact_form, $args = '' ) {
597
-
598
- // Parse data and get our options
599
- $args = wp_parse_args( $args, array() );
600
-
601
- // Our multiple upload field
602
- $type = 'mfile';
603
-
604
- $description = __( "Generate a form-tag for a file uploading field. For more details, see %s.", 'contact-form-7' );
605
- $desc_link = wpcf7_link( __( 'https://contactform7.com/file-uploading-and-attachment/', 'contact-form-7' ), __( 'File Uploading and Attachment', 'contact-form-7' ) );
606
-
607
- ?>
608
-
609
- <div class="control-box">
610
- <fieldset>
611
- <legend><?php echo sprintf( esc_html( $description ), $desc_link ); ?></legend>
612
- <table class="form-table">
613
- <tbody>
614
- <tr>
615
- <th scope="row"><?php echo esc_html( __( 'Field type', 'contact-form-7' ) ); ?></th>
616
- <td>
617
- <fieldset>
618
- <legend class="screen-reader-text"><?php echo esc_html( __( 'Field type', 'contact-form-7' ) ); ?></legend>
619
- <label><input type="checkbox" name="required" /> <?php echo esc_html( __( 'Required field', 'contact-form-7' ) ); ?></label>
620
- </fieldset>
621
- </td>
622
- </tr>
623
- <tr>
624
- <th scope="row"><label for="<?php echo esc_attr( $args['content'] . '-name' ); ?>"><?php echo esc_html( __( 'Name', 'contact-form-7' ) ); ?></label></th>
625
- <td><input type="text" name="name" class="tg-name oneline" id="<?php echo esc_attr( $args['content'] . '-name' ); ?>" /></td>
626
- </tr>
627
- <tr>
628
- <th scope="row"><label for="<?php echo esc_attr( $args['content'] . '-limit' ); ?>"><?php echo esc_html( __( "File size limit (bytes)", 'contact-form-7' ) ); ?></label></th>
629
- <td><input type="text" name="limit" class="filesize oneline option" id="<?php echo esc_attr( $args['content'] . '-limit' ); ?>" /></td>
630
- </tr>
631
- <tr>
632
- <th scope="row"><label for="<?php echo esc_attr( $args['content'] . '-filetypes' ); ?>"><?php echo esc_html( __( 'Acceptable file types', 'contact-form-7' ) ); ?></label></th>
633
- <td><input type="text" name="filetypes" class="filetype oneline option" placeholder="jpeg|png|jpg|gif" id="<?php echo esc_attr( $args['content'] . '-filetypes' ); ?>" /></td>
634
- </tr>
635
- <tr>
636
- <th scope="row"><label for="<?php echo esc_attr( $args['content'] . '-min-file' ); ?>"><?php echo esc_html( __( 'Minimum file upload', 'contact-form-7' ) ); ?></label></th>
637
- <td><input type="text" name="min-file" class="filetype oneline option" placeholder="5" id="<?php echo esc_attr( $args['content'] . '-min-file' ); ?>" /></td>
638
- </tr>
639
- <tr>
640
- <th scope="row"><label for="<?php echo esc_attr( $args['content'] . '-max-file' ); ?>"><?php echo esc_html( __( 'Max file upload', 'contact-form-7' ) ); ?></label></th>
641
- <td><input type="text" name="max-file" class="filetype oneline option" placeholder="10" id="<?php echo esc_attr( $args['content'] . '-max-file' ); ?>" /></td>
642
- </tr>
643
- <tr>
644
- <th scope="row"><label for="<?php echo esc_attr( $args['content'] . '-id' ); ?>"><?php echo esc_html( __( 'Id attribute', 'contact-form-7' ) ); ?></label></th>
645
- <td><input type="text" name="id" class="idvalue oneline option" id="<?php echo esc_attr( $args['content'] . '-id' ); ?>" /></td>
646
- </tr>
647
- <tr>
648
- <th scope="row"><label for="<?php echo esc_attr( $args['content'] . '-class' ); ?>"><?php echo esc_html( __( 'Class attribute', 'contact-form-7' ) ); ?></label></th>
649
- <td><input type="text" name="class" class="classvalue oneline option" id="<?php echo esc_attr( $args['content'] . '-class' ); ?>" /></td>
650
- </tr>
651
- </tbody>
652
- </table>
653
- </fieldset>
654
- </div>
655
-
656
- <div class="insert-box">
657
- <input type="text" name="<?php echo $type; ?>" class="tag code" readonly="readonly" onfocus="this.select()" />
658
- <div class="submitbox">
659
- <input type="button" class="button button-primary insert-tag" value="<?php echo esc_attr( __( 'Insert Tag', 'contact-form-7' ) ); ?>" />
660
- </div>
661
- <br class="clear" />
662
- <p class="description mail-tag">
663
- <label for="<?php echo esc_attr( $args['content'] . '-mailtag' ); ?>"><?php echo sprintf( esc_html( __( "To attach the file uploaded through this field to mail, you need to insert the corresponding mail-tag (%s) into the File Attachments field on the Mail tab.", 'contact-form-7' ) ), '<strong><span class="mail-tag"></span></strong>' ); ?><input type="text" class="mail-tag code hidden" readonly="readonly" id="<?php echo esc_attr( $args['content'] . '-mailtag' ); ?>" /></label>
664
- </p>
665
- </div>
666
-
667
- <?php
668
- }
669
-
670
- // Get allowed types
671
- function dnd_cf7_get_allowed_types( $form_id ) {
672
-
673
- // Initialize contact form instance
674
- $form = WPCF7_ContactForm::get_instance( $form_id );
675
-
676
- // Check if not valid object and null
677
- if( ! $form && ! is_object( $form ) ) {
678
- return false;
679
- }
680
-
681
- // Get specific tag (mfile is for dnd file upload)
682
- $tags = $form->scan_form_tags( array( 'type' => array('mfile', 'mfile*') ) );
683
- $supported_types = array();
684
-
685
- // Loop all upload tags
686
- if( $tags && is_array( $tags ) ) {
687
- foreach( $tags as $tag ) {
688
-
689
- // Get file types option & remove not allowed character..
690
- $types = preg_replace( '/[^a-zA-Z0-9|\']/', '', $tag->get_option('filetypes','', true ) );
691
-
692
- // Assign if filetypes is present otherwise use the default ext list.
693
- $supported_types[ $tag->name ] = ( $types ? $types : dnd_upload_default_ext() );
694
- }
695
- }
696
-
697
- return $supported_types;
698
- }
699
-
700
- // Begin process upload
701
- function dnd_upload_cf7_upload() {
702
-
703
- // cf7 form id & upload name
704
- $cf7_id = sanitize_text_field( (int)$_POST['form_id']);
705
-
706
- // Get the name of upload field.
707
- $cf7_upload_name = sanitize_text_field( $_POST['upload_name'] );
708
-
709
- // Get allowed ext list @expected : png|jpeg|jpg
710
- $allowed_types = dnd_cf7_get_allowed_types( $cf7_id );
711
-
712
- // check and verify ajax request
713
- if( is_user_logged_in() ) {
714
- check_ajax_referer( 'dnd-cf7-security-nonce', 'security' );
715
- }
716
-
717
- // Get upload dir
718
- $path = dnd_get_upload_dir();
719
-
720
- // input type file 'name'
721
- $name = 'upload-file';
722
-
723
- // Get File ( name, type, tmp_name, size, error )
724
- $file = isset( $_FILES[$name] ) ? $_FILES[$name] : null;
725
-
726
- // Tells whether the file was uploaded via HTTP POST
727
- if ( ! is_uploaded_file( $file['tmp_name'] ) ) {
728
- $failed_error = get_option('drag_n_drop_error_failed_to_upload');
729
- wp_send_json_error( '('. $file['error'] .') ' . ( $failed_error ? $failed_error : dnd_cf7_error_msg('failed_upload') ) );
730
- }
731
-
732
- /* Get allowed extension */
733
- $supported_type = ( isset( $allowed_types["$cf7_upload_name"] ) ? $allowed_types["$cf7_upload_name"] : dnd_upload_default_ext() );
734
-
735
- // Create type pattern for anti script
736
- $file_type_pattern = dnd_upload_cf7_filetypes( $supported_type );
737
-
738
- // Get file extension
739
- $extension = strtolower( pathinfo( $file['name'], PATHINFO_EXTENSION ) );
740
-
741
- // validate file type
742
- if ( ! preg_match( $file_type_pattern, $file['name'] ) || ! dnd_cf7_validate_type( $extension, $supported_type ) ) {
743
- wp_send_json_error( get_option('drag_n_drop_error_invalid_file') ? get_option('drag_n_drop_error_invalid_file') : dnd_cf7_error_msg('invalid_type') );
744
- }
745
-
746
- // validate file size limit
747
- if( $file['size'] > (int)$_POST['size_limit'] ) {
748
- wp_send_json_error( get_option('drag_n_drop_error_files_too_large') ? get_option('drag_n_drop_error_files_too_large') : dnd_cf7_error_msg('large_file') );
749
- }
750
-
751
- // Create file name
752
- $filename = wp_basename( $file['name'] );
753
- $filename = wpcf7_canonicalize( $filename, 'as-is' );
754
-
755
- // Check if string is ascii then proceed with antiscript function ( remove or clean filename )
756
- if( dnd_cf7_check_ascii( $filename ) ){
757
- $filename = wpcf7_antiscript_file_name( $filename );
758
- }
759
-
760
- // Add filter on upload file name
761
- $filename = apply_filters( 'wpcf7_upload_file_name', $filename, $file['name'] );
762
-
763
- // Generate new filename
764
- $filename = wp_unique_filename( $path['upload_dir'], $filename );
765
- $new_file = path_join( $path['upload_dir'], $filename );
766
-
767
- // Upload File
768
- if ( false === move_uploaded_file( $file['tmp_name'], $new_file ) ) {
769
- $failed_error = get_option('drag_n_drop_error_failed_to_upload');
770
- wp_send_json_error( '('. $file['error'] .') ' . ( $failed_error ? $failed_error : dnd_cf7_error_msg('failed_upload') ) );
771
- }else{
772
-
773
- $files = array(
774
- 'path' => basename( $path['upload_dir'] ),
775
- 'file' => str_replace('/','-', $filename)
776
- );
777
-
778
- // Change file permission to 0400
779
- chmod( $new_file, 0644 );
780
-
781
- wp_send_json_success( $files );
782
- }
783
-
784
- die;
785
- }
786
-
787
- // Check if a string is ASCII.
788
- function dnd_cf7_check_ascii( $string ) {
789
- if ( function_exists( 'mb_check_encoding' ) ) {
790
- if ( mb_check_encoding( $string, 'ASCII' ) ) {
791
- return true;
792
- }
793
- } elseif ( ! preg_match( '/[^\x00-\x7F]/', $string ) ) {
794
- return true;
795
- }
796
-
797
- return false;
798
- }
799
-
800
- // Delete file
801
- function dnd_codedropz_upload_delete() {
802
-
803
- // Get folder directory
804
- $dir = dnd_get_upload_dir();
805
-
806
- // check and verify ajax request
807
- if( is_user_logged_in() ) {
808
- check_ajax_referer( 'dnd-cf7-security-nonce', 'security' );
809
- }
810
-
811
- // Sanitize Path
812
- $get_path = ( isset( $_POST['path'] ) ? sanitize_text_field( $_POST['path'] ) : null );
813
-
814
- //limit the user input to a file name and to ignore injected path names
815
- $path = basename( $get_path );
816
-
817
- // Make sure path is set
818
- if( ! is_null( $path ) ) {
819
-
820
- // Check valid filename & extensions
821
- if( preg_match_all('/wp-|(\.php|\.exe|\.js|\.phtml|\.cgi|\.aspx|\.asp|\.bat)/', $path ) ) {
822
- die('File not safe');
823
- }
824
-
825
- // Concatenate path and upload directory
826
- $file_path = realpath( trailingslashit( $dir['upload_dir'] ) . trim( $path ) );
827
-
828
- // Check if is in the correct upload_dir
829
- if( ! preg_match("/". wpcf7_dnd_dir ."/i", $file_path ) ) {
830
- die('It\'s not a valid upload directory');
831
- }
832
-
833
- // Check if file exists
834
- if( file_exists( $file_path ) ){
835
- wp_delete_file( $file_path );
836
- if( ! file_exists( $file_path ) ) {
837
- wp_send_json_success('File Deleted!');
838
- }
839
- }
840
- }
841
-
842
- die;
843
- }
844
-
845
- // Setup file type pattern for validation
846
- function dnd_upload_cf7_filetypes( $types ) {
847
- $file_type_pattern = '';
848
-
849
- // If contact form 7 5.0 and up
850
- if( function_exists('wpcf7_acceptable_filetypes') ) {
851
- $file_type_pattern = wpcf7_acceptable_filetypes( $types, 'regex' );
852
- $file_type_pattern = '/\.(' . $file_type_pattern . ')$/i';
853
- }else{
854
- $allowed_file_types = array();
855
- $file_types = explode( '|', $types );
856
-
857
- foreach ( $file_types as $file_type ) {
858
- $file_type = trim( $file_type, '.' );
859
- $file_type = str_replace( array( '.', '+', '*', '?' ), array( '\.', '\+', '\*', '\?' ), $file_type );
860
- $allowed_file_types[] = $file_type;
861
- }
862
-
863
- $allowed_file_types = array_unique( $allowed_file_types );
864
- $file_type_pattern = implode( '|', $allowed_file_types );
865
-
866
- $file_type_pattern = trim( $file_type_pattern, '|' );
867
- $file_type_pattern = '(' . $file_type_pattern . ')';
868
- $file_type_pattern = '/\.' . $file_type_pattern . '$/i';
869
- }
870
-
871
- return $file_type_pattern;
872
- }
873
-
874
- // Add more validation for file extension
875
- function dnd_cf7_validate_type( $extension, $supported_types ) {
876
- $valid = true;
877
- $extension = preg_replace( '/[^A-Za-z0-9,|]/', '', $extension );
878
-
879
- // not allowed file types
880
- $not_allowed = array( 'php', 'php3','php4','phtml','exe','script', 'app', 'asp', 'bas', 'bat', 'cer', 'cgi', 'chm', 'cmd', 'com', 'cpl', 'crt', 'csh', 'csr', 'dll', 'drv', 'fxp', 'flv', 'hlp', 'hta', 'htaccess', 'htm', 'htpasswd', 'inf', 'ins', 'isp', 'jar', 'js', 'jse', 'jsp', 'ksh', 'lnk', 'mdb', 'mde', 'mdt', 'mdw', 'msc', 'msi', 'msp', 'mst', 'ops', 'pcd', 'pif', 'pl', 'prg', 'ps1', 'ps2', 'py', 'rb', 'reg', 'scr', 'sct', 'sh', 'shb', 'shs', 'sys', 'swf', 'tmp', 'torrent', 'url', 'vb', 'vbe', 'vbs', 'vbscript', 'wsc', 'wsf', 'wsf', 'wsh' );
881
-
882
- // Search in $not_allowed extension and match
883
- foreach( $not_allowed as $single_ext ) {
884
- if ( strpos( $single_ext, $extension ) !== false ) {
885
- $valid = false;
886
- break;
887
- }
888
- }
889
-
890
- // If pass on first validation - check extension if exists in allowed types
891
- if( $valid === true ) {
892
- $extensions = explode('|', strtolower( $supported_types ) );
893
- if( ! in_array( $extension, $extensions ) ) {
894
- $valid = false;
895
- }
896
- }
897
-
898
- return $valid;
899
- }
900
-
901
- // Admin Settings
902
- function dnd_upload_admin_settings( ) {
903
- echo '<div class="wrap">';
904
- echo '<h1>Drag & Drop Uploader - Settings</h1>';
905
-
906
- echo '<div class="update-nag notice" style="width: 98%;padding: 0px 10px;margin-bottom: 5px;">';
907
- echo '<p>Checkout more features on <a href="https://codedropz.com/purchase-plugin/" target="_blank">Pro Version</a></p>';
908
- echo '</div>';
909
-
910
- // Error settings
911
- settings_errors();
912
-
913
- echo '<form method="post" action="options.php"> ';
914
- settings_fields( 'drag-n-drop-upload-file-cf7' );
915
- do_settings_sections( 'drag-n-drop-upload-file-cf7' );
916
- ?>
917
-
918
- <table class="form-table">
919
- <tr valign="top">
920
- <th scope="row"><?php _e('Send Attachment as links?','drag-and-drop-multiple-file-upload-contact-form-7'); ?></th>
921
- <td><input name="drag_n_drop_mail_attachment" type="checkbox" value="yes" <?php checked('yes', get_option('drag_n_drop_mail_attachment')); ?>></td>
922
- </tr>
923
- </table>
924
-
925
- <h2><?php _e('Uploader Info','drag-and-drop-multiple-file-upload-contact-form-7'); ?></h2>
926
-
927
- <table class="form-table">
928
- <tr valign="top">
929
- <th scope="row"><?php _e('Heading Tag','drag-and-drop-multiple-file-upload-contact-form-7'); ?></th>
930
- <td>
931
- <select name="drag_n_drop_heading_tag">
932
- <option value="h1" <?php selected( get_option('drag_n_drop_heading_tag'), 'h1'); ?>>H1</option>
933
- <option value="h2" <?php selected( get_option('drag_n_drop_heading_tag'), 'h2'); ?>>H2</option>
934
- <option value="h3" <?php selected( get_option('drag_n_drop_heading_tag','h3'), 'h3'); ?>>H3</option>
935
- <option value="h4" <?php selected( get_option('drag_n_drop_heading_tag'), 'h4'); ?>>H4</option>
936
- <option value="h5" <?php selected( get_option('drag_n_drop_heading_tag'), 'h5'); ?>>H5</option>
937
- <option value="h6" <?php selected( get_option('drag_n_drop_heading_tag'), 'h6'); ?>>H6</option>
938
- </select>
939
- </td>
940
- </tr>
941
- <tr valign="top">
942
- <th scope="row"><?php _e('Drag & Drop Text','drag-and-drop-multiple-file-upload-contact-form-7'); ?></th>
943
- <td><input type="text" name="drag_n_drop_text" class="regular-text" value="<?php echo esc_attr( get_option('drag_n_drop_text') ); ?>" placeholder="Drag & Drop Files Here" /></td>
944
- </tr>
945
- <tr valign="top">
946
- <th scope="row"></th>
947
- <td><input type="text" name="drag_n_drop_separator" value="<?php echo esc_attr( get_option('drag_n_drop_separator') ); ?>" placeholder="or" /></td>
948
- </tr>
949
- <tr valign="top">
950
- <th scope="row"><?php _e('Browse Text','drag-and-drop-multiple-file-upload-contact-form-7'); ?></th>
951
- <td><input type="text" name="drag_n_drop_browse_text" class="regular-text" value="<?php echo esc_attr( get_option('drag_n_drop_browse_text') ); ?>" placeholder="Browse Files" /></td>
952
- </tr>
953
- </table>
954
-
955
- <h2><?php _e('Error Message','drag-and-drop-multiple-file-upload-contact-form-7'); ?></h2>
956
-
957
- <table class="form-table">
958
- <tr valign="top">
959
- <th scope="row"><?php _e('File exceeds server limit','drag-and-drop-multiple-file-upload-contact-form-7'); ?></th>
960
- <td><input type="text" name="drag_n_drop_error_server_limit" class="regular-text" value="<?php echo esc_attr( get_option('drag_n_drop_error_server_limit') ); ?>" placeholder="<?php echo dnd_cf7_error_msg('server_limit'); ?>" /></td>
961
- </tr>
962
- <tr valign="top">
963
- <th scope="row"><?php _e('Failed to Upload','drag-and-drop-multiple-file-upload-contact-form-7'); ?></th>
964
- <td><input type="text" name="drag_n_drop_error_failed_to_upload" class="regular-text" value="<?php echo esc_attr( get_option('drag_n_drop_error_failed_to_upload') ); ?>" placeholder="<?php echo dnd_cf7_error_msg('failed_upload'); ?>" /></td>
965
- </tr>
966
- <tr valign="top">
967
- <th scope="row"><?php _e('Files too large','drag-and-drop-multiple-file-upload-contact-form-7'); ?></th>
968
- <td><input type="text" name="drag_n_drop_error_files_too_large" class="regular-text" value="<?php echo esc_attr( get_option('drag_n_drop_error_files_too_large') ); ?>" placeholder="<?php echo dnd_cf7_error_msg('large_file'); ?>" /></td>
969
- </tr>
970
- <tr valign="top">
971
- <th scope="row"><?php _e('Invalid file Type','drag-and-drop-multiple-file-upload-contact-form-7'); ?></th>
972
- <td><input type="text" name="drag_n_drop_error_invalid_file" class="regular-text" value="<?php echo esc_attr( get_option('drag_n_drop_error_invalid_file') ); ?>" placeholder="<?php echo dnd_cf7_error_msg('invalid_type'); ?>" /></td>
973
- </tr>
974
- <tr valign="top">
975
- <th scope="row"><?php _e('Max File Limit','drag-and-drop-multiple-file-upload-contact-form-7'); ?></th>
976
- <td><input type="text" name="drag_n_drop_error_max_file" class="regular-text" value="<?php echo esc_attr( get_option('drag_n_drop_error_max_file') ); ?>" placeholder="" /><p class="description">Example: `Note : Some of the files are not uploaded ( Only %count% files allowed )`</p></td>
977
- </tr>
978
- <tr valign="top">
979
- <th scope="row"><?php _e('Minimum File','drag-and-drop-multiple-file-upload-contact-form-7'); ?></th>
980
- <td><input type="text" name="drag_n_drop_error_min_file" placeholder="" class="regular-text" value="<?php echo esc_attr( get_option('drag_n_drop_error_min_file') ); ?>" placeholder="" /></td>
981
- </tr>
982
- </table>
983
-
984
- <h2 style="display:none;"><?php _e('Disable Button','drag-and-drop-multiple-file-upload-contact-form-7'); ?></h2>
985
-
986
- <table style="display:none;" class="form-table">
987
- <tr valign="top">
988
- <th scope="row"><?php _e('Disable Submit button','drag-and-drop-multiple-file-upload-contact-form-7'); ?></th>
989
- <td><input type="checkbox" name="drag_n_drop_disable_btn" value="yes" <?php checked('yes', get_option('drag_n_drop_disable_btn')); ?>> Yes <p class="description">Disable submit button if there's an error.</p></td>
990
- </tr>
991
- </table>
992
-
993
- <?php submit_button(); ?>
994
-
995
- <?php
996
- echo '</form>';
997
- echo '</div>';
998
- }
999
-
1000
- // Add script in footer
1001
- function dnd_custom_scripts() {
1002
- if( ! in_array('jquery-validation-for-contact-form-7/jquery-validation-for-contact-form-7.php', get_option('active_plugins') ) ){
1003
- return;
1004
- }
1005
- ?>
1006
- <script type="text/javascript">
1007
- // Contact form 7 - Jquery validation
1008
- jQuery(document).ready(function($){
1009
- jQuery('.wpcf7-form-control.wpcf7-submit').click(function(e){
1010
- var uploadFields = $(this).parents('form').find('.wpcf7-drag-n-drop-file');
1011
- var valid = true;
1012
- if( uploadFields.length > 0 ) {
1013
- jQuery.each(uploadFields, function(i,field){
1014
- if( $(field).attr('aria-required') == 'true' ) {
1015
- parentsWrap = $(field).parents('.codedropz-upload-wrapper');
1016
- parentsWrap.removeClass('invalid');
1017
- parentsWrap.find('label').remove();
1018
- if( $('[type="hidden"][name="'+$(field).attr('data-name')+'[]"]').length == 0 ) {
1019
- parentsWrap.append('<label class="error-new">'+ dnd_cf7_uploader.drag_n_drop_upload.required +'</label>').addClass('invalid');
1020
- valid = false;
1021
- }
1022
- }
1023
- });
1024
- if( ! valid ) {
1025
- return false;
1026
- }
1027
- }
1028
- return true;
1029
- });
1030
- });
1031
- </script>
1032
- <?php
1033
- }
1034
-
1035
- // Define custom (safe) file extension.
1036
- function dnd_upload_default_ext() {
1037
- return apply_filters('dnd_cf7_default_ext', 'jpg|jpeg|JPG|png|gif|pdf|doc|docx|ppt|svg|pptx|odt|avi|ogg|m4a|mov|mp3|mp4|mpg|wav|wmv|xls' );
1038
- }
1039
-
1040
- // Add custom links
1041
- function dnd_custom_plugin_row_meta( $links, $file ) {
1042
- if ( strpos( $file, 'drag-n-drop-upload-cf7.php' ) !== false ) {
1043
- $new_links = array('pro-version' => '<a href="https://codedropz.com/purchase-plugin/" target="_blank" style="font-weight:bold; color:#f4a647;">Pro Version</a>');
1044
- $links = array_merge( $links, $new_links );
1045
- }
1046
- return $links;
1047
- }
1048
-
1049
- // Save admin settings
1050
- function dnd_upload_register_settings() {
1051
- register_setting( 'drag-n-drop-upload-file-cf7', 'drag_n_drop_heading_tag','sanitize_text_field' );
1052
- register_setting( 'drag-n-drop-upload-file-cf7', 'drag_n_drop_mail_attachment','sanitize_text_field' );
1053
- register_setting( 'drag-n-drop-upload-file-cf7', 'drag_n_drop_text','sanitize_text_field' );
1054
- register_setting( 'drag-n-drop-upload-file-cf7', 'drag_n_drop_separator','sanitize_text_field' );
1055
- register_setting( 'drag-n-drop-upload-file-cf7', 'drag_n_drop_browse_text','sanitize_text_field' );
1056
- register_setting( 'drag-n-drop-upload-file-cf7', 'drag_n_drop_error_server_limit','sanitize_text_field' );
1057
- register_setting( 'drag-n-drop-upload-file-cf7', 'drag_n_drop_error_failed_to_upload','sanitize_text_field' );
1058
- register_setting( 'drag-n-drop-upload-file-cf7', 'drag_n_drop_error_files_too_large','sanitize_text_field' );
1059
- register_setting( 'drag-n-drop-upload-file-cf7', 'drag_n_drop_error_invalid_file','sanitize_text_field' );
1060
- register_setting( 'drag-n-drop-upload-file-cf7', 'drag_n_drop_error_max_file','sanitize_text_field' );
1061
- register_setting( 'drag-n-drop-upload-file-cf7', 'drag_n_drop_error_min_file','sanitize_text_field' );
1062
- register_setting( 'drag-n-drop-upload-file-cf7', 'drag_n_drop_disable_btn','sanitize_text_field' );
 
 
 
1063
  }
1
+ <?php
2
+
3
+ /**
4
+ * @Description : Plugin main core
5
+ * @Package : Drag & Drop Multiple File Upload - Contact Form 7
6
+ * @Author : Glen Don L. Mongaya
7
+ */
8
+
9
+ if ( ! defined( 'ABSPATH' ) || ! defined('dnd_upload_cf7') ) {
10
+ exit;
11
+ }
12
+
13
+ /**
14
+ * Begin : begin plugin hooks
15
+ */
16
+
17
+ add_action( 'wpcf7_init', 'dnd_cf7_upload_add_form_tag_file' );
18
+ add_action( 'wpcf7_enqueue_scripts', 'dnd_cf7_scripts' );
19
+
20
+ // Hook on plugins loaded
21
+ add_action('plugins_loaded','dnd_cf7_upload_plugins_loaded');
22
+
23
+ // Ajax Upload
24
+ add_action( 'wp_ajax_dnd_codedropz_upload', 'dnd_upload_cf7_upload' );
25
+ add_action( 'wp_ajax_nopriv_dnd_codedropz_upload', 'dnd_upload_cf7_upload' );
26
+
27
+ // Hook - Ajax Delete
28
+ add_action('wp_ajax_nopriv_dnd_codedropz_upload_delete', 'dnd_codedropz_upload_delete');
29
+ add_action('wp_ajax_dnd_codedropz_upload_delete','dnd_codedropz_upload_delete');
30
+
31
+ // Hook mail cf7
32
+ add_filter('wpcf7_posted_data', 'dnd_wpcf7_posted_data', 10, 1);
33
+ add_action('wpcf7_before_send_mail','dnd_cf7_before_send_mail', 30, 1);
34
+ add_action('wpcf7_mail_components','dnd_cf7_mail_components', 50, 2);
35
+
36
+ // Auto clean up dir/files
37
+ add_action('template_redirect', 'dnd_cf7_auto_clean_dir', 20, 0 );
38
+
39
+ // Add row meta links
40
+ add_filter( 'plugin_row_meta', 'dnd_custom_plugin_row_meta', 10, 2 );
41
+
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
+
48
+ // Add custom script in footer
49
+ add_action('wp_footer','dnd_custom_scripts');
50
+
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
+
57
+ // Load language domain
58
+ load_plugin_textdomain( 'drag-and-drop-multiple-file-upload-contact-form-7', false, dirname( dirname( plugin_basename( __FILE__ ) ) ) . '/languages' );
59
+
60
+ // Create dir
61
+ $dir = dnd_get_upload_dir();
62
+ if( isset( $dir['upload_dir'] ) && is_dir( $dir['upload_dir'] ) ) {
63
+ // Generate .htaccess file`
64
+ $htaccess_file = path_join( dirname( $dir['upload_dir'] ), '.htaccess' );
65
+ if ( ! file_exists( $htaccess_file ) ) {
66
+ if ( $handle = fopen( $htaccess_file, 'w' ) ) {
67
+ fwrite( $handle, "Options -Indexes \n <Files *.php> \n deny from all \n </Files>" );
68
+ fclose( $handle );
69
+ }
70
+ }
71
+ }
72
+ }
73
+
74
+ // Remove uploaded files when item is deleted permanently.
75
+ function dnd_remove_uploaded_files( $post_id ) {
76
+ $post_type = get_post_type( $post_id );
77
+ $page = get_post( $post_id );
78
+ if( $post_type == 'flamingo_inbound' ) {
79
+ preg_match_all( '/(.*?)(\/'.wpcf7_dnd_dir.'\/wpcf7-files\/.*$)/m', $page->post_content, $matches );
80
+ if( $matches[0] && count( $matches[0] ) > 0 ) {
81
+ foreach( $matches[0] as $files ) {
82
+ $new_file = str_replace( site_url().'/', wp_normalize_path( ABSPATH ), $files );
83
+ if( file_exists( $new_file ) ) {
84
+ wp_delete_file( $new_file );
85
+ }
86
+ }
87
+ }
88
+ }
89
+ }
90
+
91
+ // Modify contact form posted_data
92
+ function dnd_wpcf7_posted_data( $posted_data ){
93
+
94
+ // Subbmisson instance from CF7
95
+ $submission = WPCF7_Submission::get_instance();
96
+
97
+ // Make sure we have the data
98
+ if ( ! $posted_data ) {
99
+ $posted_data = $submission->get_posted_data();
100
+ }
101
+
102
+ // Scan and get all form tags from cf7 generator
103
+ $forms_tags = $submission->get_contact_form();
104
+ $uploads_dir = dnd_get_upload_dir();
105
+
106
+ if( $forms = $forms_tags->scan_form_tags() ) {
107
+ foreach( $forms as $field ) {
108
+ $field_name = $field->name;
109
+ if( $field->basetype == 'mfile' && isset( $posted_data[$field_name] ) && ! empty( $posted_data[$field_name] ) ) {
110
+ foreach( $posted_data[$field_name] as $key => $file ) {
111
+ $posted_data[$field_name][$key] = trailingslashit( $uploads_dir['upload_url'] ) . wp_basename( $file );
112
+ }
113
+ }
114
+ }
115
+ }
116
+
117
+ return $posted_data;
118
+ }
119
+
120
+ // Hooks for admin settings
121
+ function dnd_admin_settings() {
122
+ add_submenu_page( 'wpcf7', 'Drag & Drop Uploader - Settings', 'Drag & Drop Upload', 'manage_options', 'drag-n-drop-upload','dnd_upload_admin_settings');
123
+ add_action('admin_init','dnd_upload_register_settings');
124
+ }
125
+
126
+ // Add custom mime-types
127
+ function dnd_extra_mime_types( $mime_types ){
128
+ $mime_types['xls'] = 'application/excel, application/vnd.ms-excel, application/x-excel, application/x-msexcel';
129
+ $mime_types['xlsx'] = 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet';
130
+ return $mime_types;
131
+ }
132
+
133
+ // Default Error Message
134
+ function dnd_cf7_error_msg( $error_key ) {
135
+
136
+ // Array of default error message
137
+ $errors = array(
138
+ 'server_limit' => __('The uploaded file exceeds the maximum upload size of your server.','drag-and-drop-multiple-file-upload-contact-form-7'),
139
+ 'failed_upload' => __('Uploading a file fails for any reason','drag-and-drop-multiple-file-upload-contact-form-7'),
140
+ 'large_file' => __('Uploaded file is too large','drag-and-drop-multiple-file-upload-contact-form-7'),
141
+ 'invalid_type' => __('Uploaded file is not allowed for file type','drag-and-drop-multiple-file-upload-contact-form-7'),
142
+ 'max_file_limit' => __('Note : Some of the files are not uploaded ( Only %count% files allowed )','drag-and-drop-multiple-file-upload-contact-form-7'),
143
+ 'required' => __('This field is required.', 'drag-and-drop-multiple-file-upload-contact-form-7' ),
144
+ 'min_file' => __('Minimum file upload at least','drag-and-drop-multiple-file-upload-contact-form-7'),
145
+ );
146
+
147
+ // return error message based on $error_key request
148
+ if( isset( $errors[ $error_key ] ) ) {
149
+ return $errors[ $error_key ];
150
+ }
151
+
152
+ return false;
153
+ }
154
+
155
+ // Get folder path
156
+ function dnd_get_upload_dir() {
157
+ $upload = wp_upload_dir();
158
+ $uploads_dir = wpcf7_dnd_dir . '/wpcf7-files';
159
+
160
+ // If save as attachment ( also : Check if upload use year and month folders )
161
+ if( get_option('drag_n_drop_mail_attachment') == 'yes' ) {
162
+ $uploads_dir = ( get_option('uploads_use_yearmonth_folders') ? wpcf7_dnd_dir . $upload['subdir'] : wpcf7_dnd_dir );
163
+ }
164
+
165
+ // Create directory
166
+ if ( ! is_dir( trailingslashit( $upload['basedir'] ) . $uploads_dir ) ) {
167
+ wp_mkdir_p( trailingslashit( $upload['basedir'] ) . $uploads_dir );
168
+ }
169
+
170
+ // Make sure directory exist before returning
171
+ if( file_exists( trailingslashit( $upload['basedir'] ) . $uploads_dir ) ) {
172
+ return array(
173
+ 'upload_dir' => trailingslashit( $upload['basedir'] ) . $uploads_dir,
174
+ 'upload_url' => trailingslashit( $upload['baseurl'] ) . $uploads_dir
175
+ );
176
+ }
177
+
178
+ return trailingslashit( $upload['basedir'] ) . $uploads_dir;
179
+ }
180
+
181
+ // Clean up directory - From Contact Form 7
182
+ function dnd_cf7_auto_clean_dir( $seconds = 3600, $max = 60 ) {
183
+ if ( is_admin() || 'GET' != $_SERVER['REQUEST_METHOD'] || is_robots() || is_feed() || is_trackback() ) {
184
+ return;
185
+ }
186
+
187
+ // Setup dirctory path
188
+ $upload = wp_upload_dir();
189
+ $dir = trailingslashit( $upload['basedir'] ) . wpcf7_dnd_dir . '/wpcf7-files/';
190
+
191
+ // Make sure dir is readable or writable
192
+ if ( ! is_dir( $dir ) || ! is_readable( $dir ) || ! wp_is_writable( $dir ) ) {
193
+ return;
194
+ }
195
+
196
+ $seconds = apply_filters( 'dnd_cf7_auto_delete_files', $seconds );
197
+ $max = absint( $max );
198
+ $count = 0;
199
+
200
+ if ( $handle = @opendir( $dir ) ) {
201
+ while ( false !== ( $file = readdir( $handle ) ) ) {
202
+ if ( $file == "." || $file == ".." ) {
203
+ continue;
204
+ }
205
+
206
+ // Get file time of files OLD files.
207
+ $mtime = @filemtime( $dir . $file );
208
+
209
+ if ( $mtime && time() < $mtime + absint( $seconds ) ) { // less than $seconds old
210
+ continue;
211
+ }
212
+
213
+ // Delete files from dir
214
+ if( $file != '.htaccess' ) {
215
+ wp_delete_file( $dir . $file );
216
+ }
217
+
218
+ $count += 1;
219
+
220
+ if ( $max <= $count ) {
221
+ break;
222
+ }
223
+ }
224
+ @closedir( $handle );
225
+ }
226
+ @rmdir( $dir );
227
+ }
228
+
229
+ // Hooks before sending the email - ( append links to body email )
230
+ function dnd_cf7_before_send_mail( $wpcf7 ){
231
+ global $_mail;
232
+
233
+ // Get upload path / dir
234
+ $upload_path = dnd_get_upload_dir();
235
+
236
+ // Mail Counter
237
+ $_mail = 0;
238
+
239
+ // Check If send attachment as link
240
+ if( ! get_option('drag_n_drop_mail_attachment') ) {
241
+ return $wpcf7;
242
+ }
243
+
244
+ // cf7 instance
245
+ $submission = WPCF7_Submission::get_instance();
246
+
247
+ // Check for submission
248
+ if( $submission ) {
249
+
250
+ // Get posted data
251
+ $submitted['posted_data'] = $submission->get_posted_data();
252
+
253
+ // Parse fields
254
+ $fields = $wpcf7->scan_form_tags();
255
+
256
+ // Links
257
+ $links = array();
258
+
259
+ // Prop email
260
+ $mail = $wpcf7->prop('mail');
261
+ $mail_2 = $wpcf7->prop('mail_2');
262
+
263
+ // Default upload path
264
+ $simple_path = dirname( $upload_path['upload_url'] ); // dirname - remove duplicate form dir (/wpcf-dnd-uploads/wpcf7-dnd-uploads/example.jpg)
265
+
266
+ // Loop fields and replace mfile code
267
+ foreach( $fields as $field ) {
268
+ if( $field->basetype == 'mfile') {
269
+ if( isset( $submitted['posted_data'][$field->name] ) && ! empty( $submitted['posted_data'][$field->name] ) ) {
270
+
271
+ // Get posted_data files
272
+ $files = $submitted['posted_data'][$field->name];
273
+
274
+ // Links - 1
275
+ $mail_links = dnd_cf7_links( $files, $mail['use_html'] );
276
+ $mail['body'] = str_replace( "[$field->name]", "\n" . implode( "\n", $mail_links ), $mail['body'] );
277
+
278
+ // Links - 2
279
+ if( $mail_2['active'] ) {
280
+ $mail_links_2 = dnd_cf7_links( $files, $mail_2['use_html'] );
281
+ $mail_2['body'] = str_replace( "[$field->name]", "\n" . implode( "\n", $mail_links_2 ), $mail_2['body'] );
282
+ }
283
+ }
284
+ }
285
+ }
286
+
287
+ // Save the email body
288
+ $wpcf7->set_properties( array("mail" => $mail) );
289
+
290
+ // if mail 2
291
+ if( $mail_2['active'] ) {
292
+ $wpcf7->set_properties( array("mail_2" => $mail_2) );
293
+ }
294
+ }
295
+
296
+ return $wpcf7;
297
+ }
298
+
299
+ // Get file links.
300
+ function dnd_cf7_links( $files, $use_html = false) {
301
+
302
+ // check and make sure we have files
303
+ if( ! $files ) {
304
+ return;
305
+ }
306
+
307
+ // Setup html links
308
+ $links = array();
309
+ foreach( $files as $file ) {
310
+ $links[] = ( $use_html ? '<a href="'. esc_url( $file ) .'">'. wp_basename( $file ) .'</a>' : $file );
311
+ }
312
+
313
+ // Allow other themes/plugin to modify data.
314
+ return apply_filters('dndcf7_before_send_files', $links, $files );
315
+ }
316
+
317
+ // Log message...
318
+ function dnd_logs( $message, $email = false ) {
319
+ $uploads_dir = dnd_get_upload_dir();
320
+ $file = fopen( $uploads_dir['upload_dir']."/logs.txt", "a") or die("Unable to open file!");
321
+ fwrite( $file, "\n". ( is_array( $message ) ? print_r( $message, true ) : $message ) );
322
+ fclose( $file );
323
+ }
324
+
325
+ // hooks - Custom cf7 Mail components ( Attached File on Email )
326
+ function dnd_cf7_mail_components( $components, $form ) {
327
+ global $_mail;
328
+
329
+ if( ! $form ) {
330
+ return;
331
+ }
332
+
333
+ // Get upload directory
334
+ $uploads_dir = dnd_get_upload_dir();
335
+
336
+ // cf7 - Submission Object
337
+ $submission = WPCF7_Submission::get_instance();
338
+
339
+ // get all form fields
340
+ $fields = $form->scan_form_tags();
341
+
342
+ // Send email link as an attachment.
343
+ if( get_option('drag_n_drop_mail_attachment') == 'yes' ) {
344
+ return $components;
345
+ }
346
+
347
+ // Get mail,mail_2 attachment [tags]
348
+ $mail = array('mail','mail_2');
349
+ $props_mail = array();
350
+
351
+ foreach( $mail as $single_mail ) {
352
+ $props_mail[] = $form->prop( $single_mail );
353
+ }
354
+
355
+ // Get email attachments (mail, mail_2)
356
+ $mail = $props_mail[ $_mail ];
357
+ if( $mail['active'] && $mail['attachments'] ) {
358
+
359
+ // Loop fields get mfile only.
360
+ foreach( $fields as $field ) {
361
+
362
+ // If field type equal to mfile which our default field.
363
+ if( $field->basetype == 'mfile') {
364
+
365
+ // Make sure we have files to attach
366
+ if( isset( $_POST[ $field->name ] ) && count( $_POST[ $field->name ] ) > 0 ) {
367
+
368
+ // Check and make sure [upload-file-xxx] exists in attachments - fields
369
+ if ( false !== strpos( $mail['attachments'], "[{$field->name}]" ) ) {
370
+
371
+ // Loop all the files and attach to cf7 components
372
+ foreach( $_POST[ $field->name ] as $_file ) {
373
+
374
+ // Join dir and a new file name ( get from <input type="hidden" name="upload-file-333"> )
375
+ $new_file_name = trailingslashit( $uploads_dir['upload_dir'] ) . wp_basename( $_file );
376
+
377
+ // Check if submitted and file exists then file is ready.
378
+ if ( $submission && file_exists( $new_file_name ) ) {
379
+ $components['attachments'][] = $new_file_name;
380
+ }
381
+ }
382
+
383
+ }
384
+ }
385
+ }
386
+ }
387
+
388
+ }
389
+
390
+ // Increment mail counter
391
+ $_mail = $_mail + 1;
392
+
393
+ // Return setup components
394
+ return $components;
395
+ }
396
+
397
+ // Load js and css
398
+ function dnd_cf7_scripts() {
399
+
400
+ // Get plugin version
401
+ $version = dnd_upload_cf7_version;
402
+
403
+ // enque script
404
+ wp_enqueue_script( 'codedropz-uploader', plugins_url ('/assets/js/codedropz-uploader-min.js', dirname(__FILE__) ), array('jquery'), $version, true );
405
+ wp_enqueue_script( 'dnd-upload-cf7', plugins_url ('/assets/js/dnd-upload-cf7.js', dirname(__FILE__) ), array('jquery','codedropz-uploader','contact-form-7'), $version, true );
406
+
407
+ // registered script with data for a JavaScript variable.
408
+ wp_localize_script( 'dnd-upload-cf7', 'dnd_cf7_uploader',
409
+ array(
410
+ 'ajax_url' => admin_url( 'admin-ajax.php' ),
411
+ 'ajax_nonce' => wp_create_nonce( "dnd-cf7-security-nonce" ),
412
+ 'drag_n_drop_upload' => array(
413
+ 'tag' => ( get_option('drag_n_drop_heading_tag') ? get_option('drag_n_drop_heading_tag') : 'h3' ),
414
+ 'text' => ( get_option('drag_n_drop_text') ? get_option('drag_n_drop_text') : __('Drag & Drop Files Here','drag-and-drop-multiple-file-upload-contact-form-7') ),
415
+ 'or_separator' => ( get_option('drag_n_drop_separator') ? get_option('drag_n_drop_separator') : __('or','drag-and-drop-multiple-file-upload-contact-form-7') ),
416
+ 'browse' => ( get_option('drag_n_drop_browse_text') ? get_option('drag_n_drop_browse_text') : __('Browse Files','drag-and-drop-multiple-file-upload-contact-form-7') ),
417
+ 'server_max_error' => ( get_option('drag_n_drop_error_server_limit') ? get_option('drag_n_drop_error_server_limit') : dnd_cf7_error_msg('server_limit') ),
418
+ 'large_file' => ( get_option('drag_n_drop_error_files_too_large') ? get_option('drag_n_drop_error_files_too_large') : dnd_cf7_error_msg('large_file') ),
419
+ 'inavalid_type' => ( get_option('drag_n_drop_error_invalid_file') ? get_option('drag_n_drop_error_invalid_file') : dnd_cf7_error_msg('invalid_type') ),
420
+ 'max_file_limit' => ( get_option('drag_n_drop_error_max_file') ? get_option('drag_n_drop_error_max_file') : dnd_cf7_error_msg('max_file_limit') ),
421
+ 'required' => dnd_cf7_error_msg('required'),
422
+ 'delete' => array(
423
+ 'text' => __('deleting','drag-and-drop-multiple-file-upload-contact-form-7'),
424
+ 'title' => __('Remove','drag-and-drop-multiple-file-upload-contact-form-7')
425
+ )
426
+ ),
427
+ 'dnd_text_counter' => __('of','drag-and-drop-multiple-file-upload-contact-form-7'),
428
+ 'disable_btn' => ( get_option('drag_n_drop_disable_btn') == 'yes' ? true : false )
429
+ )
430
+ );
431
+
432
+ // enque style
433
+ wp_enqueue_style( 'dnd-upload-cf7', plugins_url ('/assets/css/dnd-upload-cf7.css', dirname(__FILE__) ), '', $version );
434
+ }
435
+
436
+ // Generate tag
437
+ function dnd_cf7_upload_add_form_tag_file() {
438
+ wpcf7_add_form_tag( array( 'mfile ', 'mfile*'), 'dnd_cf7_upload_form_tag_handler', array( 'name-attr' => true ) );
439
+ }
440
+
441
+ // Form tag handler from the tag - callback
442
+ function dnd_cf7_upload_form_tag_handler( $tag ) {
443
+
444
+ // check and make sure tag name is not empty
445
+ if ( empty( $tag->name ) ) {
446
+ return '';
447
+ }
448
+
449
+ // Validate our fields
450
+ $validation_error = wpcf7_get_validation_error( $tag->name );
451
+
452
+ // Generate class
453
+ $class = wpcf7_form_controls_class( 'drag-n-drop-file d-none' );
454
+
455
+ // Add not-valid class if there's an error.
456
+ if ( $validation_error ) {
457
+ $class .= ' wpcf7-not-valid';
458
+ }
459
+
460
+ // Get current form Object
461
+ $form = WPCF7_ContactForm::get_current();
462
+
463
+ // Setup element attributes
464
+ $atts = array();
465
+
466
+ $atts['size'] = $tag->get_size_option( '40' );
467
+ $atts['class'] = $tag->get_class_option( $class );
468
+ $atts['id'] = $tag->get_id_option();
469
+ $atts['tabindex'] = $tag->get_option( 'tabindex', 'signed_int', true );
470
+
471
+ // If file is required
472
+ if ( $tag->is_required() ) {
473
+ $atts['aria-required'] = 'true';
474
+ }
475
+
476
+ // Set invalid attributes if there's validation error
477
+ $atts['aria-invalid'] = $validation_error ? 'true' : 'false';
478
+
479
+ // Set input type and name
480
+ $atts['type'] = 'file';
481
+ $atts['multiple'] = 'multiple';
482
+ $atts['data-name'] = $tag->name;
483
+ $atts['data-type'] = $tag->get_option( 'filetypes','', true);
484
+ $atts['data-limit'] = $tag->get_option( 'limit','', true);
485
+ $atts['data-max'] = $tag->get_option( 'max-file','', true);
486
+ $atts['data-id'] = ( $form->id() ? $form->id() : 0 );
487
+
488
+ // Combine and format attrbiutes
489
+ $atts = wpcf7_format_atts( $atts );
490
+
491
+ // Return our element and attributes
492
+ return sprintf('<span class="wpcf7-form-control-wrap %1$s"><input %2$s />%3$s</span>', sanitize_html_class( $tag->name ), $atts, $validation_error );
493
+ }
494
+
495
+ // Encode type filter to support multipart since this is input type file
496
+ add_filter( 'wpcf7_form_enctype', 'dnd_upload_cf7_form_enctype_filter' );
497
+
498
+ function dnd_upload_cf7_form_enctype_filter( $enctype ) {
499
+ $multipart = (bool) wpcf7_scan_form_tags( array( 'type' => array( 'drag_drop_file', 'drag_drop_file*' ) ) );
500
+
501
+ if ( $multipart ) {
502
+ $enctype = 'multipart/form-data';
503
+ }
504
+
505
+ return $enctype;
506
+ }
507
+
508
+ // 3rd party compatability...
509
+ function dnd_cf7_conditional_fields( $form_id ) {
510
+
511
+ if( ! $form_id ) {
512
+ return false;
513
+ }
514
+
515
+ // Get visible groups
516
+ $groups = array();
517
+
518
+ // Get current form object
519
+ $cf7_post = get_post( $form_id );
520
+
521
+ // Extract group shortcode
522
+ $regex = get_shortcode_regex( array('group') );
523
+
524
+ // Match pattern
525
+ preg_match_all( '/'. $regex .'/s', $cf7_post->post_content, $matches );
526
+
527
+ if( array_key_exists( 3, $matches )) {
528
+ foreach( $matches[3] as $index => $group_name ) {
529
+ $name = array_filter( explode(" ", $group_name ) );
530
+ preg_match('/\[mfile[*|\s].*?\]/', $matches[0][$index], $file_matches );
531
+ if( $file_matches ) {
532
+ $field_name = shortcode_parse_atts( $file_matches[0] );
533
+ $field_name = preg_replace( '/[^a-zA-Z0-9-_]/','', $field_name[1] );
534
+ $groups[ $field_name ] = $name[1];
535
+ }
536
+ }
537
+ }
538
+
539
+ return $groups;
540
+ }
541
+
542
+ // Validation + upload handling filter
543
+ add_filter( 'wpcf7_validate_mfile', 'dnd_upload_cf7_validation_filter', 10, 2 );
544
+ add_filter( 'wpcf7_validate_mfile*', 'dnd_upload_cf7_validation_filter', 10, 2 );
545
+
546
+ function dnd_upload_cf7_validation_filter( $result, $tag ) {
547
+ $name = $tag->name;
548
+ $id = $tag->get_id_option();
549
+ $multiple_files = ( ( isset( $_POST[ $name ] ) && count( $_POST[ $name ] ) > 0 ) ? $_POST[ $name ] : null );
550
+ $min_file = $tag->get_option( 'min-file','', true);
551
+
552
+ // Cf7 Conditional Field
553
+ if( in_array('cf7-conditional-fields/contact-form-7-conditional-fields.php', get_option('active_plugins') ) ){
554
+
555
+ $hidden_groups = json_decode( stripslashes( $_POST['_wpcf7cf_hidden_groups'] ) );
556
+ $form_id = WPCF7_ContactForm::get_current()->id();
557
+ $group_fields = dnd_cf7_conditional_fields( $form_id );
558
+
559
+ if( is_null( $multiple_files ) && $tag->is_required() ) {
560
+ if( isset( $group_fields[ $name ] ) && ! in_array( $group_fields[ $name ], $hidden_groups ) ) {
561
+ $result->invalidate( $tag, wpcf7_get_message( 'invalid_required' ) );
562
+ }elseif( ! array_key_exists( $name, $group_fields ) ) {
563
+ $result->invalidate( $tag, wpcf7_get_message( 'invalid_required' ) );
564
+ }
565
+ return $result;
566
+ }
567
+
568
+ return $result;
569
+ }
570
+
571
+ // Check if we have files or if it's empty
572
+ if( is_null( $multiple_files ) && $tag->is_required() ) {
573
+ $result->invalidate( $tag, wpcf7_get_message( 'invalid_required' ) );
574
+ return $result;
575
+ }
576
+
577
+ // Check minimum upload
578
+ if( $multiple_files && count( $multiple_files ) < (int) $min_file ) {
579
+ $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') );
580
+ $result->invalidate( $tag, $min_file_error .' '. (int)$min_file );
581
+ return $result;
582
+ }
583
+
584
+ return $result;
585
+ }
586
+
587
+ // Generate Admin From Tag
588
+ add_action( 'wpcf7_admin_init', 'dnd_upload_cf7_add_tag_generator', 50 );
589
+
590
+ function dnd_upload_cf7_add_tag_generator() {
591
+ $tag_generator = WPCF7_TagGenerator::get_instance();
592
+ $tag_generator->add( 'upload-file', __( 'multiple file upload', 'drag-and-drop-multiple-file-upload-contact-form-7' ),'dnd_upload_cf7_tag_generator_file' );
593
+ }
594
+
595
+ // Display form in admin
596
+ function dnd_upload_cf7_tag_generator_file( $contact_form, $args = '' ) {
597
+
598
+ // Parse data and get our options
599
+ $args = wp_parse_args( $args, array() );
600
+
601
+ // Our multiple upload field
602
+ $type = 'mfile';
603
+
604
+ $description = __( "Generate a form-tag for a file uploading field. For more details, see %s.", 'contact-form-7' );
605
+ $desc_link = wpcf7_link( __( 'https://contactform7.com/file-uploading-and-attachment/', 'contact-form-7' ), __( 'File Uploading and Attachment', 'contact-form-7' ) );
606
+
607
+ ?>
608
+
609
+ <div class="control-box">
610
+ <fieldset>
611
+ <legend><?php echo sprintf( esc_html( $description ), $desc_link ); ?></legend>
612
+ <table class="form-table">
613
+ <tbody>
614
+ <tr>
615
+ <th scope="row"><?php echo esc_html( __( 'Field type', 'contact-form-7' ) ); ?></th>
616
+ <td>
617
+ <fieldset>
618
+ <legend class="screen-reader-text"><?php echo esc_html( __( 'Field type', 'contact-form-7' ) ); ?></legend>
619
+ <label><input type="checkbox" name="required" /> <?php echo esc_html( __( 'Required field', 'contact-form-7' ) ); ?></label>
620
+ </fieldset>
621
+ </td>
622
+ </tr>
623
+ <tr>
624
+ <th scope="row"><label for="<?php echo esc_attr( $args['content'] . '-name' ); ?>"><?php echo esc_html( __( 'Name', 'contact-form-7' ) ); ?></label></th>
625
+ <td><input type="text" name="name" class="tg-name oneline" id="<?php echo esc_attr( $args['content'] . '-name' ); ?>" /></td>
626
+ </tr>
627
+ <tr>
628
+ <th scope="row"><label for="<?php echo esc_attr( $args['content'] . '-limit' ); ?>"><?php echo esc_html( __( "File size limit (bytes)", 'contact-form-7' ) ); ?></label></th>
629
+ <td><input type="text" name="limit" class="filesize oneline option" id="<?php echo esc_attr( $args['content'] . '-limit' ); ?>" /></td>
630
+ </tr>
631
+ <tr>
632
+ <th scope="row"><label for="<?php echo esc_attr( $args['content'] . '-filetypes' ); ?>"><?php echo esc_html( __( 'Acceptable file types', 'contact-form-7' ) ); ?></label></th>
633
+ <td><input type="text" name="filetypes" class="filetype oneline option" placeholder="jpeg|png|jpg|gif" id="<?php echo esc_attr( $args['content'] . '-filetypes' ); ?>" /></td>
634
+ </tr>
635
+ <tr>
636
+ <th scope="row"><label for="<?php echo esc_attr( $args['content'] . '-min-file' ); ?>"><?php echo esc_html( __( 'Minimum file upload', 'contact-form-7' ) ); ?></label></th>
637
+ <td><input type="text" name="min-file" class="filetype oneline option" placeholder="5" id="<?php echo esc_attr( $args['content'] . '-min-file' ); ?>" /></td>
638
+ </tr>
639
+ <tr>
640
+ <th scope="row"><label for="<?php echo esc_attr( $args['content'] . '-max-file' ); ?>"><?php echo esc_html( __( 'Max file upload', 'contact-form-7' ) ); ?></label></th>
641
+ <td><input type="text" name="max-file" class="filetype oneline option" placeholder="10" id="<?php echo esc_attr( $args['content'] . '-max-file' ); ?>" /></td>
642
+ </tr>
643
+ <tr>
644
+ <th scope="row"><label for="<?php echo esc_attr( $args['content'] . '-id' ); ?>"><?php echo esc_html( __( 'Id attribute', 'contact-form-7' ) ); ?></label></th>
645
+ <td><input type="text" name="id" class="idvalue oneline option" id="<?php echo esc_attr( $args['content'] . '-id' ); ?>" /></td>
646
+ </tr>
647
+ <tr>
648
+ <th scope="row"><label for="<?php echo esc_attr( $args['content'] . '-class' ); ?>"><?php echo esc_html( __( 'Class attribute', 'contact-form-7' ) ); ?></label></th>
649
+ <td><input type="text" name="class" class="classvalue oneline option" id="<?php echo esc_attr( $args['content'] . '-class' ); ?>" /></td>
650
+ </tr>
651
+ </tbody>
652
+ </table>
653
+ </fieldset>
654
+ </div>
655
+
656
+ <div class="insert-box">
657
+ <input type="text" name="<?php echo $type; ?>" class="tag code" readonly="readonly" onfocus="this.select()" />
658
+ <div class="submitbox">
659
+ <input type="button" class="button button-primary insert-tag" value="<?php echo esc_attr( __( 'Insert Tag', 'contact-form-7' ) ); ?>" />
660
+ </div>
661
+ <br class="clear" />
662
+ <p class="description mail-tag">
663
+ <label for="<?php echo esc_attr( $args['content'] . '-mailtag' ); ?>"><?php echo sprintf( esc_html( __( "To attach the file uploaded through this field to mail, you need to insert the corresponding mail-tag (%s) into the File Attachments field on the Mail tab.", 'contact-form-7' ) ), '<strong><span class="mail-tag"></span></strong>' ); ?><input type="text" class="mail-tag code hidden" readonly="readonly" id="<?php echo esc_attr( $args['content'] . '-mailtag' ); ?>" /></label>
664
+ </p>
665
+ </div>
666
+
667
+ <?php
668
+ }
669
+
670
+ // Get allowed types
671
+ function dnd_cf7_get_allowed_types( $form_id ) {
672
+
673
+ // Initialize contact form instance
674
+ $form = WPCF7_ContactForm::get_instance( $form_id );
675
+
676
+ // Check if not valid object and null
677
+ if( ! $form && ! is_object( $form ) ) {
678
+ return false;
679
+ }
680
+
681
+ // Get specific tag (mfile is for dnd file upload)
682
+ $tags = $form->scan_form_tags( array( 'type' => array('mfile', 'mfile*') ) );
683
+ $supported_types = array();
684
+
685
+ // Loop all upload tags
686
+ if( $tags && is_array( $tags ) ) {
687
+ foreach( $tags as $tag ) {
688
+
689
+ // Get file types option & remove not allowed character..
690
+ $types = preg_replace( '/[^a-zA-Z0-9|\']/', '', $tag->get_option('filetypes','', true ) );
691
+
692
+ // Assign if filetypes is present otherwise use the default ext list.
693
+ $supported_types[ $tag->name ] = ( $types ? $types : dnd_upload_default_ext() );
694
+ }
695
+ }
696
+
697
+ return $supported_types;
698
+ }
699
+
700
+ // Begin process upload
701
+ function dnd_upload_cf7_upload() {
702
+
703
+ // cf7 form id & upload name
704
+ $cf7_id = sanitize_text_field( (int)$_POST['form_id']);
705
+
706
+ // Get the name of upload field.
707
+ $cf7_upload_name = sanitize_text_field( $_POST['upload_name'] );
708
+
709
+ // Get allowed ext list @expected : png|jpeg|jpg
710
+ $allowed_types = dnd_cf7_get_allowed_types( $cf7_id );
711
+
712
+ // check and verify ajax request
713
+ if( is_user_logged_in() ) {
714
+ check_ajax_referer( 'dnd-cf7-security-nonce', 'security' );
715
+ }
716
+
717
+ // Get upload dir
718
+ $path = dnd_get_upload_dir();
719
+
720
+ // input type file 'name'
721
+ $name = 'upload-file';
722
+
723
+ // Get File ( name, type, tmp_name, size, error )
724
+ $file = isset( $_FILES[$name] ) ? $_FILES[$name] : null;
725
+
726
+ // Tells whether the file was uploaded via HTTP POST
727
+ if ( ! is_uploaded_file( $file['tmp_name'] ) ) {
728
+ $failed_error = get_option('drag_n_drop_error_failed_to_upload');
729
+ wp_send_json_error( '('. $file['error'] .') ' . ( $failed_error ? $failed_error : dnd_cf7_error_msg('failed_upload') ) );
730
+ }
731
+
732
+ /* Get allowed extension */
733
+ $supported_type = ( isset( $allowed_types["$cf7_upload_name"] ) ? $allowed_types["$cf7_upload_name"] : dnd_upload_default_ext() );
734
+
735
+ // Create type pattern for anti script
736
+ $file_type_pattern = dnd_upload_cf7_filetypes( $supported_type );
737
+
738
+ // Get file extension
739
+ $extension = strtolower( pathinfo( $file['name'], PATHINFO_EXTENSION ) );
740
+
741
+ // validate file type
742
+ if ( ! preg_match( $file_type_pattern, $file['name'] ) || ! dnd_cf7_validate_type( $extension, $supported_type ) ) {
743
+ wp_send_json_error( get_option('drag_n_drop_error_invalid_file') ? get_option('drag_n_drop_error_invalid_file') : dnd_cf7_error_msg('invalid_type') );
744
+ }
745
+
746
+ // validate file size limit
747
+ if( $file['size'] > (int)$_POST['size_limit'] ) {
748
+ wp_send_json_error( get_option('drag_n_drop_error_files_too_large') ? get_option('drag_n_drop_error_files_too_large') : dnd_cf7_error_msg('large_file') );
749
+ }
750
+
751
+ // Create file name
752
+ $filename = wp_basename( $file['name'] );
753
+ $filename = wpcf7_canonicalize( $filename, 'as-is' );
754
+
755
+ // Check if string is ascii then proceed with antiscript function ( remove or clean filename )
756
+ if( dnd_cf7_check_ascii( $filename ) ){
757
+ $filename = wpcf7_antiscript_file_name( $filename );
758
+ }
759
+
760
+ // Add filter on upload file name
761
+ $filename = apply_filters( 'wpcf7_upload_file_name', $filename, $file['name'] );
762
+
763
+ // Generate new filename
764
+ $filename = wp_unique_filename( $path['upload_dir'], $filename );
765
+ $new_file = path_join( $path['upload_dir'], $filename );
766
+
767
+ // Upload File
768
+ if ( false === move_uploaded_file( $file['tmp_name'], $new_file ) ) {
769
+ $failed_error = get_option('drag_n_drop_error_failed_to_upload');
770
+ wp_send_json_error( '('. $file['error'] .') ' . ( $failed_error ? $failed_error : dnd_cf7_error_msg('failed_upload') ) );
771
+ }else{
772
+
773
+ $files = array(
774
+ 'path' => basename( $path['upload_dir'] ),
775
+ 'file' => str_replace('/','-', $filename)
776
+ );
777
+
778
+ // Change file permission to 0400
779
+ chmod( $new_file, 0644 );
780
+
781
+ wp_send_json_success( $files );
782
+ }
783
+
784
+ die;
785
+ }
786
+
787
+ // Check if a string is ASCII.
788
+ function dnd_cf7_check_ascii( $string ) {
789
+ if ( function_exists( 'mb_check_encoding' ) ) {
790
+ if ( mb_check_encoding( $string, 'ASCII' ) ) {
791
+ return true;
792
+ }
793
+ } elseif ( ! preg_match( '/[^\x00-\x7F]/', $string ) ) {
794
+ return true;
795
+ }
796
+
797
+ return false;
798
+ }
799
+
800
+ // Delete file
801
+ function dnd_codedropz_upload_delete() {
802
+
803
+ // Get folder directory
804
+ $dir = dnd_get_upload_dir();
805
+
806
+ // check and verify ajax request
807
+ if( is_user_logged_in() ) {
808
+ check_ajax_referer( 'dnd-cf7-security-nonce', 'security' );
809
+ }
810
+
811
+ // Sanitize Path
812
+ $get_path = ( isset( $_POST['path'] ) ? sanitize_text_field( $_POST['path'] ) : null );
813
+
814
+ //limit the user input to a file name and to ignore injected path names
815
+ $path = basename( $get_path );
816
+
817
+ // Make sure path is set
818
+ if( ! is_null( $path ) ) {
819
+
820
+ // Check valid filename & extensions
821
+ if( preg_match_all('/wp-|(\.php|\.exe|\.js|\.phtml|\.cgi|\.aspx|\.asp|\.bat)/', $path ) ) {
822
+ die('File not safe');
823
+ }
824
+
825
+ // Concatenate path and upload directory
826
+ $file_path = realpath( trailingslashit( $dir['upload_dir'] ) . trim( $path ) );
827
+
828
+ // Check if is in the correct upload_dir
829
+ if( ! preg_match("/". wpcf7_dnd_dir ."/i", $file_path ) ) {
830
+ die('It\'s not a valid upload directory');
831
+ }
832
+
833
+ // Check if file exists
834
+ if( file_exists( $file_path ) ){
835
+ wp_delete_file( $file_path );
836
+ if( ! file_exists( $file_path ) ) {
837
+ wp_send_json_success('File Deleted!');
838
+ }
839
+ }
840
+ }
841
+
842
+ die;
843
+ }
844
+
845
+ // Setup file type pattern for validation
846
+ function dnd_upload_cf7_filetypes( $types ) {
847
+ $file_type_pattern = '';
848
+
849
+ // If contact form 7 5.0 and up
850
+ if( function_exists('wpcf7_acceptable_filetypes') ) {
851
+ $file_type_pattern = wpcf7_acceptable_filetypes( $types, 'regex' );
852
+ $file_type_pattern = '/\.(' . $file_type_pattern . ')$/i';
853
+ }else{
854
+ $allowed_file_types = array();
855
+ $file_types = explode( '|', $types );
856
+
857
+ foreach ( $file_types as $file_type ) {
858
+ $file_type = trim( $file_type, '.' );
859
+ $file_type = str_replace( array( '.', '+', '*', '?' ), array( '\.', '\+', '\*', '\?' ), $file_type );
860
+ $allowed_file_types[] = $file_type;
861
+ }
862
+
863
+ $allowed_file_types = array_unique( $allowed_file_types );
864
+ $file_type_pattern = implode( '|', $allowed_file_types );
865
+
866
+ $file_type_pattern = trim( $file_type_pattern, '|' );
867
+ $file_type_pattern = '(' . $file_type_pattern . ')';
868
+ $file_type_pattern = '/\.' . $file_type_pattern . '$/i';
869
+ }
870
+
871
+ return $file_type_pattern;
872
+ }
873
+
874
+ // Add more validation for file extension
875
+ function dnd_cf7_validate_type( $extension, $supported_types ) {
876
+ $valid = true;
877
+ $extension = preg_replace( '/[^A-Za-z0-9,|]/', '', $extension );
878
+
879
+ // not allowed file types
880
+ $not_allowed = array( 'php', 'php3','php4','phtml','exe','script', 'app', 'asp', 'bas', 'bat', 'cer', 'cgi', 'chm', 'cmd', 'com', 'cpl', 'crt', 'csh', 'csr', 'dll', 'drv', 'fxp', 'flv', 'hlp', 'hta', 'htaccess', 'htm', 'htpasswd', 'inf', 'ins', 'isp', 'jar', 'js', 'jse', 'jsp', 'ksh', 'lnk', 'mdb', 'mde', 'mdt', 'mdw', 'msc', 'msi', 'msp', 'mst', 'ops', 'pcd', 'pif', 'pl', 'prg', 'ps1', 'ps2', 'py', 'rb', 'reg', 'scr', 'sct', 'sh', 'shb', 'shs', 'sys', 'swf', 'tmp', 'torrent', 'url', 'vb', 'vbe', 'vbs', 'vbscript', 'wsc', 'wsf', 'wsf', 'wsh' );
881
+
882
+ // allowed ext.
883
+ $allowed_ext = array('ipt');
884
+
885
+ // Search in $not_allowed extension and match
886
+ foreach( $not_allowed as $single_ext ) {
887
+ if ( strpos( $single_ext, $extension, 0 ) !== false && ! in_array( $extension, $allowed_ext )) {
888
+ $valid = false;
889
+ break;
890
+ }
891
+ }
892
+
893
+ // If pass on first validation - check extension if exists in allowed types
894
+ if( $valid === true ) {
895
+ $extensions = explode('|', strtolower( $supported_types ) );
896
+ if( ! in_array( $extension, $extensions ) ) {
897
+ $valid = false;
898
+ }
899
+ }
900
+
901
+ return $valid;
902
+ }
903
+
904
+ // Admin Settings
905
+ function dnd_upload_admin_settings( ) {
906
+ echo '<div class="wrap">';
907
+ echo '<h1>Drag & Drop Uploader - Settings</h1>';
908
+
909
+ echo '<div class="update-nag notice" style="width: 98%;padding: 0px 10px;margin-bottom: 5px;">';
910
+ echo '<p>Checkout more features on <a href="https://codedropz.com/purchase-plugin/" target="_blank">Pro Version</a></p>';
911
+ echo '</div>';
912
+
913
+ // Error settings
914
+ settings_errors();
915
+
916
+ echo '<form method="post" action="options.php"> ';
917
+ settings_fields( 'drag-n-drop-upload-file-cf7' );
918
+ do_settings_sections( 'drag-n-drop-upload-file-cf7' );
919
+ ?>
920
+
921
+ <table class="form-table">
922
+ <tr valign="top">
923
+ <th scope="row"><?php _e('Send Attachment as links?','drag-and-drop-multiple-file-upload-contact-form-7'); ?></th>
924
+ <td><input name="drag_n_drop_mail_attachment" type="checkbox" value="yes" <?php checked('yes', get_option('drag_n_drop_mail_attachment')); ?>></td>
925
+ </tr>
926
+ </table>
927
+
928
+ <h2><?php _e('Uploader Info','drag-and-drop-multiple-file-upload-contact-form-7'); ?></h2>
929
+
930
+ <table class="form-table">
931
+ <tr valign="top">
932
+ <th scope="row"><?php _e('Heading Tag','drag-and-drop-multiple-file-upload-contact-form-7'); ?></th>
933
+ <td>
934
+ <select name="drag_n_drop_heading_tag">
935
+ <option value="h1" <?php selected( get_option('drag_n_drop_heading_tag'), 'h1'); ?>>H1</option>
936
+ <option value="h2" <?php selected( get_option('drag_n_drop_heading_tag'), 'h2'); ?>>H2</option>
937
+ <option value="h3" <?php selected( get_option('drag_n_drop_heading_tag','h3'), 'h3'); ?>>H3</option>
938
+ <option value="h4" <?php selected( get_option('drag_n_drop_heading_tag'), 'h4'); ?>>H4</option>
939
+ <option value="h5" <?php selected( get_option('drag_n_drop_heading_tag'), 'h5'); ?>>H5</option>
940
+ <option value="h6" <?php selected( get_option('drag_n_drop_heading_tag'), 'h6'); ?>>H6</option>
941
+ </select>
942
+ </td>
943
+ </tr>
944
+ <tr valign="top">
945
+ <th scope="row"><?php _e('Drag & Drop Text','drag-and-drop-multiple-file-upload-contact-form-7'); ?></th>
946
+ <td><input type="text" name="drag_n_drop_text" class="regular-text" value="<?php echo esc_attr( get_option('drag_n_drop_text') ); ?>" placeholder="Drag & Drop Files Here" /></td>
947
+ </tr>
948
+ <tr valign="top">
949
+ <th scope="row"></th>
950
+ <td><input type="text" name="drag_n_drop_separator" value="<?php echo esc_attr( get_option('drag_n_drop_separator') ); ?>" placeholder="or" /></td>
951
+ </tr>
952
+ <tr valign="top">
953
+ <th scope="row"><?php _e('Browse Text','drag-and-drop-multiple-file-upload-contact-form-7'); ?></th>
954
+ <td><input type="text" name="drag_n_drop_browse_text" class="regular-text" value="<?php echo esc_attr( get_option('drag_n_drop_browse_text') ); ?>" placeholder="Browse Files" /></td>
955
+ </tr>
956
+ </table>
957
+
958
+ <h2><?php _e('Error Message','drag-and-drop-multiple-file-upload-contact-form-7'); ?></h2>
959
+
960
+ <table class="form-table">
961
+ <tr valign="top">
962
+ <th scope="row"><?php _e('File exceeds server limit','drag-and-drop-multiple-file-upload-contact-form-7'); ?></th>
963
+ <td><input type="text" name="drag_n_drop_error_server_limit" class="regular-text" value="<?php echo esc_attr( get_option('drag_n_drop_error_server_limit') ); ?>" placeholder="<?php echo dnd_cf7_error_msg('server_limit'); ?>" /></td>
964
+ </tr>
965
+ <tr valign="top">
966
+ <th scope="row"><?php _e('Failed to Upload','drag-and-drop-multiple-file-upload-contact-form-7'); ?></th>
967
+ <td><input type="text" name="drag_n_drop_error_failed_to_upload" class="regular-text" value="<?php echo esc_attr( get_option('drag_n_drop_error_failed_to_upload') ); ?>" placeholder="<?php echo dnd_cf7_error_msg('failed_upload'); ?>" /></td>
968
+ </tr>
969
+ <tr valign="top">
970
+ <th scope="row"><?php _e('Files too large','drag-and-drop-multiple-file-upload-contact-form-7'); ?></th>
971
+ <td><input type="text" name="drag_n_drop_error_files_too_large" class="regular-text" value="<?php echo esc_attr( get_option('drag_n_drop_error_files_too_large') ); ?>" placeholder="<?php echo dnd_cf7_error_msg('large_file'); ?>" /></td>
972
+ </tr>
973
+ <tr valign="top">
974
+ <th scope="row"><?php _e('Invalid file Type','drag-and-drop-multiple-file-upload-contact-form-7'); ?></th>
975
+ <td><input type="text" name="drag_n_drop_error_invalid_file" class="regular-text" value="<?php echo esc_attr( get_option('drag_n_drop_error_invalid_file') ); ?>" placeholder="<?php echo dnd_cf7_error_msg('invalid_type'); ?>" /></td>
976
+ </tr>
977
+ <tr valign="top">
978
+ <th scope="row"><?php _e('Max File Limit','drag-and-drop-multiple-file-upload-contact-form-7'); ?></th>
979
+ <td><input type="text" name="drag_n_drop_error_max_file" class="regular-text" value="<?php echo esc_attr( get_option('drag_n_drop_error_max_file') ); ?>" placeholder="" /><p class="description">Example: `Note : Some of the files are not uploaded ( Only %count% files allowed )`</p></td>
980
+ </tr>
981
+ <tr valign="top">
982
+ <th scope="row"><?php _e('Minimum File','drag-and-drop-multiple-file-upload-contact-form-7'); ?></th>
983
+ <td><input type="text" name="drag_n_drop_error_min_file" placeholder="" class="regular-text" value="<?php echo esc_attr( get_option('drag_n_drop_error_min_file') ); ?>" placeholder="" /></td>
984
+ </tr>
985
+ </table>
986
+
987
+ <h2 style="display:none;"><?php _e('Disable Button','drag-and-drop-multiple-file-upload-contact-form-7'); ?></h2>
988
+
989
+ <table style="display:none;" class="form-table">
990
+ <tr valign="top">
991
+ <th scope="row"><?php _e('Disable Submit button','drag-and-drop-multiple-file-upload-contact-form-7'); ?></th>
992
+ <td><input type="checkbox" name="drag_n_drop_disable_btn" value="yes" <?php checked('yes', get_option('drag_n_drop_disable_btn')); ?>> Yes <p class="description">Disable submit button if there's an error.</p></td>
993
+ </tr>
994
+ </table>
995
+
996
+ <?php submit_button(); ?>
997
+
998
+ <?php
999
+ echo '</form>';
1000
+ echo '</div>';
1001
+ }
1002
+
1003
+ // Add script in footer
1004
+ function dnd_custom_scripts() {
1005
+ if( ! in_array('jquery-validation-for-contact-form-7/jquery-validation-for-contact-form-7.php', get_option('active_plugins') ) ){
1006
+ return;
1007
+ }
1008
+ ?>
1009
+ <script type="text/javascript">
1010
+ // Contact form 7 - Jquery validation
1011
+ jQuery(document).ready(function($){
1012
+ jQuery('.wpcf7-form-control.wpcf7-submit').click(function(e){
1013
+ var uploadFields = $(this).parents('form').find('.wpcf7-drag-n-drop-file');
1014
+ var valid = true;
1015
+ if( uploadFields.length > 0 ) {
1016
+ jQuery.each(uploadFields, function(i,field){
1017
+ if( $(field).attr('aria-required') == 'true' ) {
1018
+ parentsWrap = $(field).parents('.codedropz-upload-wrapper');
1019
+ parentsWrap.removeClass('invalid');
1020
+ parentsWrap.find('label').remove();
1021
+ if( $('[type="hidden"][name="'+$(field).attr('data-name')+'[]"]').length == 0 ) {
1022
+ parentsWrap.append('<label class="error-new">'+ dnd_cf7_uploader.drag_n_drop_upload.required +'</label>').addClass('invalid');
1023
+ valid = false;
1024
+ }
1025
+ }
1026
+ });
1027
+ if( ! valid ) {
1028
+ return false;
1029
+ }
1030
+ }
1031
+ return true;
1032
+ });
1033
+ });
1034
+ </script>
1035
+ <?php
1036
+ }
1037
+
1038
+ // Define custom (safe) file extension.
1039
+ function dnd_upload_default_ext() {
1040
+ return apply_filters('dnd_cf7_default_ext', 'jpg|jpeg|JPG|png|gif|pdf|doc|docx|ppt|svg|pptx|odt|avi|ogg|m4a|mov|mp3|mp4|mpg|wav|wmv|xls' );
1041
+ }
1042
+
1043
+ // Add custom links
1044
+ function dnd_custom_plugin_row_meta( $links, $file ) {
1045
+ if ( strpos( $file, 'drag-n-drop-upload-cf7.php' ) !== false ) {
1046
+ $new_links = array('pro-version' => '<a href="https://codedropz.com/purchase-plugin/" target="_blank" style="font-weight:bold; color:#f4a647;">Pro Version</a>');
1047
+ $links = array_merge( $links, $new_links );
1048
+ }
1049
+ return $links;
1050
+ }
1051
+
1052
+ // Save admin settings
1053
+ function dnd_upload_register_settings() {
1054
+ register_setting( 'drag-n-drop-upload-file-cf7', 'drag_n_drop_heading_tag','sanitize_text_field' );
1055
+ register_setting( 'drag-n-drop-upload-file-cf7', 'drag_n_drop_mail_attachment','sanitize_text_field' );
1056
+ register_setting( 'drag-n-drop-upload-file-cf7', 'drag_n_drop_text','sanitize_text_field' );
1057
+ register_setting( 'drag-n-drop-upload-file-cf7', 'drag_n_drop_separator','sanitize_text_field' );
1058
+ register_setting( 'drag-n-drop-upload-file-cf7', 'drag_n_drop_browse_text','sanitize_text_field' );
1059
+ register_setting( 'drag-n-drop-upload-file-cf7', 'drag_n_drop_error_server_limit','sanitize_text_field' );
1060
+ register_setting( 'drag-n-drop-upload-file-cf7', 'drag_n_drop_error_failed_to_upload','sanitize_text_field' );
1061
+ register_setting( 'drag-n-drop-upload-file-cf7', 'drag_n_drop_error_files_too_large','sanitize_text_field' );
1062
+ register_setting( 'drag-n-drop-upload-file-cf7', 'drag_n_drop_error_invalid_file','sanitize_text_field' );
1063
+ register_setting( 'drag-n-drop-upload-file-cf7', 'drag_n_drop_error_max_file','sanitize_text_field' );
1064
+ register_setting( 'drag-n-drop-upload-file-cf7', 'drag_n_drop_error_min_file','sanitize_text_field' );
1065
+ register_setting( 'drag-n-drop-upload-file-cf7', 'drag_n_drop_disable_btn','sanitize_text_field' );
1066
  }
languages/drag-and-drop-multiple-file-upload-contact-form-7-de_DE.mo ADDED
Binary file
languages/drag-and-drop-multiple-file-upload-contact-form-7-de_DE.po CHANGED
@@ -1,112 +1,112 @@
1
- msgid ""
2
- 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: 2020-07-31 08:22+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."
19
- msgstr ""
20
- "Die hochgeladene Datei überschreitet die maximale Upload-Größe Ihres Servers."
21
-
22
- #: inc/dnd-upload-cf7.php:51
23
- msgid "Uploading a file fails for any reason"
24
- msgstr "Das Hochladen einer Datei schlägt aus irgendeinem Grund fehl."
25
-
26
- #: inc/dnd-upload-cf7.php:52
27
- msgid "Uploaded file is too large"
28
- msgstr "Die Datei überscheitet das Upload Limit!"
29
-
30
- #: inc/dnd-upload-cf7.php:53
31
- msgid "Uploaded file is not allowed for file type"
32
- 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 "Ziehen & fallenlassen Hier"
37
-
38
- #: inc/dnd-upload-cf7.php:193
39
- msgid "or"
40
- msgstr "oder"
41
-
42
- #: inc/dnd-upload-cf7.php:194
43
- msgid "Browse Files"
44
- msgstr "Dateien auswählen"
45
-
46
- #: inc/dnd-upload-cf7.php:309
47
- msgid "multiple file upload"
48
- msgstr "Upload mehrerer Dateien"
49
-
50
- #: inc/dnd-upload-cf7.php:502
51
- msgid "Send Attachment as links?"
52
- msgstr "Anhang als Link versenden?"
53
-
54
- #: inc/dnd-upload-cf7.php:507
55
- msgid "Uploader Info"
56
- msgstr "Informationen zum Hochladen"
57
-
58
- #: inc/dnd-upload-cf7.php:511
59
- msgid "Drag & Drop Text"
60
- msgstr "Drag & Drop Text"
61
-
62
- #: inc/dnd-upload-cf7.php:519
63
- msgid "Browse Text"
64
- msgstr "Dateien auswählen"
65
-
66
- #: inc/dnd-upload-cf7.php:524
67
- msgid "Error Message"
68
- msgstr "Fehlermeldung"
69
-
70
- #: inc/dnd-upload-cf7.php:528
71
- msgid "File exceeds server limit"
72
- msgstr "Datei überschreitet das Serverlimit"
73
-
74
- #: inc/dnd-upload-cf7.php:532
75
- msgid "Failed to Upload"
76
- msgstr "Fehler beim Upload"
77
-
78
- #: inc/dnd-upload-cf7.php:536
79
- msgid "Files too large"
80
- msgstr "Dateien zu gross"
81
-
82
- #: inc/dnd-upload-cf7.php:540
83
- msgid "Invalid file Type"
84
- msgstr "Ungültiger Dateityp"
85
-
86
- #: inc/dnd-upload-cf7.php:425
87
- msgid "of"
88
- msgstr "von"
89
-
90
- #. Name of the plugin
91
- msgid "Drag and Drop Multiple File Upload - Contact Form 7"
92
- msgstr "Mehrere Dateien per Drag & Drop hochladen - Kontaktformular 7"
93
-
94
- #. Description of the plugin
95
- msgid ""
96
- "This simple plugin create Drag & Drop or choose Multiple File upload in your "
97
- "Confact Form 7 Forms."
98
- msgstr ""
99
- "Mit diesen Plugin einfach mit Drag & Drop oder per Datei auswahl Confact "
100
- "Form 7 einfügen."
101
-
102
- #. URI of the plugin
103
- msgid "https://profiles.wordpress.org/glenwpcoder"
104
- msgstr "https://profiles.wordpress.org/glenwpcoder"
105
-
106
- #. Author of the plugin
107
- msgid "Glen Don L. Mongaya"
108
- msgstr "Glen Don L. Mongaya"
109
-
110
- #. Author URI of the plugin
111
- msgid "http://codedropz.com"
112
- msgstr "http://codedropz.com"
1
+ msgid ""
2
+ 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: 2021-01-05 21:17+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.4.2\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."
19
+ msgstr ""
20
+ "Die hochgeladene Datei überschreitet die maximale Upload-Größe Ihres Servers."
21
+
22
+ #: inc/dnd-upload-cf7.php:51
23
+ msgid "Uploading a file fails for any reason"
24
+ msgstr "Das Hochladen einer Datei schlägt aus irgendeinem Grund fehl."
25
+
26
+ #: inc/dnd-upload-cf7.php:52
27
+ msgid "Uploaded file is too large"
28
+ msgstr "Die Datei überscheitet das Upload Limit!"
29
+
30
+ #: inc/dnd-upload-cf7.php:53
31
+ msgid "Uploaded file is not allowed for file type"
32
+ 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 "Hierher ziehen & fallen lassen"
37
+
38
+ #: inc/dnd-upload-cf7.php:193
39
+ msgid "or"
40
+ msgstr "oder"
41
+
42
+ #: inc/dnd-upload-cf7.php:194
43
+ msgid "Browse Files"
44
+ msgstr "Dateien auswählen"
45
+
46
+ #: inc/dnd-upload-cf7.php:309
47
+ msgid "multiple file upload"
48
+ msgstr "Upload mehrerer Dateien"
49
+
50
+ #: inc/dnd-upload-cf7.php:502
51
+ msgid "Send Attachment as links?"
52
+ msgstr "Anhang als Link versenden?"
53
+
54
+ #: inc/dnd-upload-cf7.php:507
55
+ msgid "Uploader Info"
56
+ msgstr "Informationen zum Hochladen"
57
+
58
+ #: inc/dnd-upload-cf7.php:511
59
+ msgid "Drag & Drop Text"
60
+ msgstr "Drag & Drop Text"
61
+
62
+ #: inc/dnd-upload-cf7.php:519
63
+ msgid "Browse Text"
64
+ msgstr "Dateien auswählen"
65
+
66
+ #: inc/dnd-upload-cf7.php:524
67
+ msgid "Error Message"
68
+ msgstr "Fehlermeldung"
69
+
70
+ #: inc/dnd-upload-cf7.php:528
71
+ msgid "File exceeds server limit"
72
+ msgstr "Datei überschreitet das Serverlimit"
73
+
74
+ #: inc/dnd-upload-cf7.php:532
75
+ msgid "Failed to Upload"
76
+ msgstr "Fehler beim Upload"
77
+
78
+ #: inc/dnd-upload-cf7.php:536
79
+ msgid "Files too large"
80
+ msgstr "Dateien zu gross"
81
+
82
+ #: inc/dnd-upload-cf7.php:540
83
+ msgid "Invalid file Type"
84
+ msgstr "Ungültiger Dateityp"
85
+
86
+ #: inc/dnd-upload-cf7.php:425
87
+ msgid "of"
88
+ msgstr "von"
89
+
90
+ #. Name of the plugin
91
+ msgid "Drag and Drop Multiple File Upload - Contact Form 7"
92
+ msgstr "Mehrere Dateien per Drag & Drop hochladen - Kontaktformular 7"
93
+
94
+ #. Description of the plugin
95
+ msgid ""
96
+ "This simple plugin create Drag & Drop or choose Multiple File upload in your "
97
+ "Confact Form 7 Forms."
98
+ msgstr ""
99
+ "Mit diesen Plugin einfach mit Drag & Drop oder per Datei auswahl Confact "
100
+ "Form 7 einfügen."
101
+
102
+ #. URI of the plugin
103
+ msgid "https://profiles.wordpress.org/glenwpcoder"
104
+ msgstr "https://profiles.wordpress.org/glenwpcoder"
105
+
106
+ #. Author of the plugin
107
+ msgid "Glen Don L. Mongaya"
108
+ msgstr "Glen Don L. Mongaya"
109
+
110
+ #. Author URI of the plugin
111
+ msgid "http://codedropz.com"
112
+ msgstr "http://codedropz.com"
languages/drag-and-drop-multiple-file-upload-contact-form-7-fr_FR.po CHANGED
@@ -1,110 +1,110 @@
1
- msgid ""
2
- msgstr ""
3
- "Project-Id-Version: \n"
4
- "POT-Creation-Date: 2019-03-18 18:47+0800\n"
5
- "PO-Revision-Date: 2020-07-31 08:26+0800\n"
6
- "Last-Translator: \n"
7
- "Language-Team: \n"
8
- "Language: fr\n"
9
- "MIME-Version: 1.0\n"
10
- "Content-Type: text/plain; charset=UTF-8\n"
11
- "Content-Transfer-Encoding: 8bit\n"
12
- "X-Generator: Poedit 2.3.1\n"
13
- "X-Poedit-Basepath: ..\n"
14
- "Plural-Forms: nplurals=2; plural=(n > 1);\n"
15
- "X-Poedit-KeywordsList: __;__e;esc_html__\n"
16
- "X-Poedit-SearchPath-0: .\n"
17
-
18
- #: inc/dnd-upload-cf7.php:50
19
- msgid "The uploaded file exceeds the maximum upload size of your server."
20
- msgstr ""
21
-
22
- #: inc/dnd-upload-cf7.php:51
23
- msgid "Uploading a file fails for any reason"
24
- msgstr ""
25
-
26
- #: inc/dnd-upload-cf7.php:52
27
- msgid "Uploaded file is too large"
28
- msgstr ""
29
-
30
- #: inc/dnd-upload-cf7.php:53
31
- msgid "Uploaded file is not allowed for file type"
32
- msgstr ""
33
-
34
- #: inc/dnd-upload-cf7.php:192
35
- msgid "Drag & Drop Files Here"
36
- msgstr "Faites glisser et déposez les fichiers ici"
37
-
38
- #: inc/dnd-upload-cf7.php:193
39
- msgid "or"
40
- msgstr "ou"
41
-
42
- #: inc/dnd-upload-cf7.php:194
43
- msgid "Browse Files"
44
- msgstr "Parcourir les fichiers"
45
-
46
- #: inc/dnd-upload-cf7.php:309
47
- msgid "multiple file upload"
48
- msgstr ""
49
-
50
- #: inc/dnd-upload-cf7.php:321
51
- #, php-format
52
- msgid ""
53
- "Generate a form-tag for a file uploading field. For more details, see %s."
54
- msgstr ""
55
-
56
- #: inc/dnd-upload-cf7.php:322
57
- msgid "https://contactform7.com/file-uploading-and-attachment/"
58
- msgstr ""
59
-
60
- #: inc/dnd-upload-cf7.php:322
61
- msgid "File Uploading and Attachment"
62
- msgstr ""
63
-
64
- #: inc/dnd-upload-cf7.php:332 inc/dnd-upload-cf7.php:335
65
- msgid "Field type"
66
- msgstr ""
67
-
68
- #: inc/dnd-upload-cf7.php:336
69
- msgid "Required field"
70
- msgstr ""
71
-
72
- #: inc/dnd-upload-cf7.php:341
73
- msgid "Name"
74
- msgstr ""
75
-
76
- #: inc/dnd-upload-cf7.php:425
77
- msgid "of"
78
- msgstr "de"
79
-
80
- #: inc/dnd-upload-cf7.php:345
81
- msgid "File size limit (bytes)"
82
- msgstr ""
83
-
84
- #: inc/dnd-upload-cf7.php:349
85
- msgid "Acceptable file types"
86
- msgstr ""
87
-
88
- #: inc/dnd-upload-cf7.php:353
89
- msgid "Max file upload"
90
- msgstr ""
91
-
92
- #: inc/dnd-upload-cf7.php:357
93
- msgid "Id attribute"
94
- msgstr ""
95
-
96
- #: inc/dnd-upload-cf7.php:361
97
- msgid "Class attribute"
98
- msgstr ""
99
-
100
- #: inc/dnd-upload-cf7.php:372
101
- msgid "Insert Tag"
102
- msgstr ""
103
-
104
- #: inc/dnd-upload-cf7.php:376
105
- #, php-format
106
- msgid ""
107
- "To attach the file uploaded through this field to mail, you need to insert "
108
- "the corresponding mail-tag (%s) into the File Attachments field on the Mail "
109
- "tab."
110
- msgstr ""
1
+ msgid ""
2
+ msgstr ""
3
+ "Project-Id-Version: \n"
4
+ "POT-Creation-Date: 2019-03-18 18:47+0800\n"
5
+ "PO-Revision-Date: 2020-07-31 08:26+0800\n"
6
+ "Last-Translator: \n"
7
+ "Language-Team: \n"
8
+ "Language: fr\n"
9
+ "MIME-Version: 1.0\n"
10
+ "Content-Type: text/plain; charset=UTF-8\n"
11
+ "Content-Transfer-Encoding: 8bit\n"
12
+ "X-Generator: Poedit 2.3.1\n"
13
+ "X-Poedit-Basepath: ..\n"
14
+ "Plural-Forms: nplurals=2; plural=(n > 1);\n"
15
+ "X-Poedit-KeywordsList: __;__e;esc_html__\n"
16
+ "X-Poedit-SearchPath-0: .\n"
17
+
18
+ #: inc/dnd-upload-cf7.php:50
19
+ msgid "The uploaded file exceeds the maximum upload size of your server."
20
+ msgstr ""
21
+
22
+ #: inc/dnd-upload-cf7.php:51
23
+ msgid "Uploading a file fails for any reason"
24
+ msgstr ""
25
+
26
+ #: inc/dnd-upload-cf7.php:52
27
+ msgid "Uploaded file is too large"
28
+ msgstr ""
29
+
30
+ #: inc/dnd-upload-cf7.php:53
31
+ msgid "Uploaded file is not allowed for file type"
32
+ msgstr ""
33
+
34
+ #: inc/dnd-upload-cf7.php:192
35
+ msgid "Drag & Drop Files Here"
36
+ msgstr "Faites glisser et déposez les fichiers ici"
37
+
38
+ #: inc/dnd-upload-cf7.php:193
39
+ msgid "or"
40
+ msgstr "ou"
41
+
42
+ #: inc/dnd-upload-cf7.php:194
43
+ msgid "Browse Files"
44
+ msgstr "Parcourir les fichiers"
45
+
46
+ #: inc/dnd-upload-cf7.php:309
47
+ msgid "multiple file upload"
48
+ msgstr ""
49
+
50
+ #: inc/dnd-upload-cf7.php:321
51
+ #, php-format
52
+ msgid ""
53
+ "Generate a form-tag for a file uploading field. For more details, see %s."
54
+ msgstr ""
55
+
56
+ #: inc/dnd-upload-cf7.php:322
57
+ msgid "https://contactform7.com/file-uploading-and-attachment/"
58
+ msgstr ""
59
+
60
+ #: inc/dnd-upload-cf7.php:322
61
+ msgid "File Uploading and Attachment"
62
+ msgstr ""
63
+
64
+ #: inc/dnd-upload-cf7.php:332 inc/dnd-upload-cf7.php:335
65
+ msgid "Field type"
66
+ msgstr ""
67
+
68
+ #: inc/dnd-upload-cf7.php:336
69
+ msgid "Required field"
70
+ msgstr ""
71
+
72
+ #: inc/dnd-upload-cf7.php:341
73
+ msgid "Name"
74
+ msgstr ""
75
+
76
+ #: inc/dnd-upload-cf7.php:425
77
+ msgid "of"
78
+ msgstr "de"
79
+
80
+ #: inc/dnd-upload-cf7.php:345
81
+ msgid "File size limit (bytes)"
82
+ msgstr ""
83
+
84
+ #: inc/dnd-upload-cf7.php:349
85
+ msgid "Acceptable file types"
86
+ msgstr ""
87
+
88
+ #: inc/dnd-upload-cf7.php:353
89
+ msgid "Max file upload"
90
+ msgstr ""
91
+
92
+ #: inc/dnd-upload-cf7.php:357
93
+ msgid "Id attribute"
94
+ msgstr ""
95
+
96
+ #: inc/dnd-upload-cf7.php:361
97
+ msgid "Class attribute"
98
+ msgstr ""
99
+
100
+ #: inc/dnd-upload-cf7.php:372
101
+ msgid "Insert Tag"
102
+ msgstr ""
103
+
104
+ #: inc/dnd-upload-cf7.php:376
105
+ #, php-format
106
+ msgid ""
107
+ "To attach the file uploaded through this field to mail, you need to insert "
108
+ "the corresponding mail-tag (%s) into the File Attachments field on the Mail "
109
+ "tab."
110
+ msgstr ""
languages/drag-and-drop-multiple-file-upload-contact-form-7-nl_NL.po CHANGED
@@ -1,109 +1,109 @@
1
- msgid ""
2
- 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:39+0000\n"
6
- "PO-Revision-Date: 2020-07-31 08:31+0800\n"
7
- "Last-Translator: admin <info@aachen-webdesigner.de>\n"
8
- "Language-Team: Dutch\n"
9
- "Language: nl_NL\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:194
18
- msgid "Browse Files"
19
- msgstr "Blader door de bestanden"
20
-
21
- #: inc/dnd-upload-cf7.php:519
22
- msgid "Browse Text"
23
- msgstr ""
24
-
25
- #: inc/dnd-upload-cf7.php:192
26
- msgid "Drag & Drop Files Here"
27
- msgstr ""
28
-
29
- #: inc/dnd-upload-cf7.php:511
30
- msgid "Drag & Drop Text"
31
- msgstr ""
32
-
33
- #. Name of the plugin
34
- msgid "Drag and Drop Multiple File Upload - Contact Form 7"
35
- msgstr ""
36
-
37
- #: inc/dnd-upload-cf7.php:524
38
- msgid "Error Message"
39
- msgstr ""
40
-
41
- #: inc/dnd-upload-cf7.php:532
42
- msgid "Failed to Upload"
43
- msgstr ""
44
-
45
- #: inc/dnd-upload-cf7.php:528
46
- msgid "File exceeds server limit"
47
- msgstr ""
48
-
49
- #: inc/dnd-upload-cf7.php:536
50
- msgid "Files too large"
51
- msgstr ""
52
-
53
- #. Author of the plugin
54
- msgid "Glen Don L. Mongaya"
55
- msgstr ""
56
-
57
- #. Author URI of the plugin
58
- msgid "http://codedropz.com"
59
- msgstr ""
60
-
61
- #. URI of the plugin
62
- msgid "https://profiles.wordpress.org/glenwpcoder"
63
- msgstr ""
64
-
65
- #: inc/dnd-upload-cf7.php:540
66
- msgid "Invalid file Type"
67
- msgstr ""
68
-
69
- #: inc/dnd-upload-cf7.php:309
70
- msgid "multiple file upload"
71
- msgstr ""
72
-
73
- #: inc/dnd-upload-cf7.php:193
74
- msgid "or"
75
- msgstr "ofwel"
76
-
77
- #: inc/dnd-upload-cf7.php:502
78
- msgid "Send Attachment as links?"
79
- msgstr ""
80
-
81
- #: inc/dnd-upload-cf7.php:50
82
- msgid "The uploaded file exceeds the maximum upload size of your server."
83
- msgstr ""
84
-
85
- #. Description of the plugin
86
- msgid ""
87
- "This simple plugin create Drag & Drop or choose Multiple File upload in your "
88
- "Confact Form 7 Forms."
89
- msgstr ""
90
-
91
- #: inc/dnd-upload-cf7.php:53
92
- msgid "Uploaded file is not allowed for file type"
93
- msgstr ""
94
-
95
- #: inc/dnd-upload-cf7.php:52
96
- msgid "Uploaded file is too large"
97
- msgstr ""
98
-
99
- #: inc/dnd-upload-cf7.php:507
100
- msgid "Uploader Info"
101
- msgstr ""
102
-
103
- #: inc/dnd-upload-cf7.php:51
104
- msgid "Uploading a file fails for any reason"
105
- msgstr ""
106
-
107
- #: inc/dnd-upload-cf7.php:425
108
- msgid "of"
109
- msgstr "van"
1
+ msgid ""
2
+ 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:39+0000\n"
6
+ "PO-Revision-Date: 2020-07-31 08:31+0800\n"
7
+ "Last-Translator: admin <info@aachen-webdesigner.de>\n"
8
+ "Language-Team: Dutch\n"
9
+ "Language: nl_NL\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:194
18
+ msgid "Browse Files"
19
+ msgstr "Blader door de bestanden"
20
+
21
+ #: inc/dnd-upload-cf7.php:519
22
+ msgid "Browse Text"
23
+ msgstr ""
24
+
25
+ #: inc/dnd-upload-cf7.php:192
26
+ msgid "Drag & Drop Files Here"
27
+ msgstr ""
28
+
29
+ #: inc/dnd-upload-cf7.php:511
30
+ msgid "Drag & Drop Text"
31
+ msgstr ""
32
+
33
+ #. Name of the plugin
34
+ msgid "Drag and Drop Multiple File Upload - Contact Form 7"
35
+ msgstr ""
36
+
37
+ #: inc/dnd-upload-cf7.php:524
38
+ msgid "Error Message"
39
+ msgstr ""
40
+
41
+ #: inc/dnd-upload-cf7.php:532
42
+ msgid "Failed to Upload"
43
+ msgstr ""
44
+
45
+ #: inc/dnd-upload-cf7.php:528
46
+ msgid "File exceeds server limit"
47
+ msgstr ""
48
+
49
+ #: inc/dnd-upload-cf7.php:536
50
+ msgid "Files too large"
51
+ msgstr ""
52
+
53
+ #. Author of the plugin
54
+ msgid "Glen Don L. Mongaya"
55
+ msgstr ""
56
+
57
+ #. Author URI of the plugin
58
+ msgid "http://codedropz.com"
59
+ msgstr ""
60
+
61
+ #. URI of the plugin
62
+ msgid "https://profiles.wordpress.org/glenwpcoder"
63
+ msgstr ""
64
+
65
+ #: inc/dnd-upload-cf7.php:540
66
+ msgid "Invalid file Type"
67
+ msgstr ""
68
+
69
+ #: inc/dnd-upload-cf7.php:309
70
+ msgid "multiple file upload"
71
+ msgstr ""
72
+
73
+ #: inc/dnd-upload-cf7.php:193
74
+ msgid "or"
75
+ msgstr "ofwel"
76
+
77
+ #: inc/dnd-upload-cf7.php:502
78
+ msgid "Send Attachment as links?"
79
+ msgstr ""
80
+
81
+ #: inc/dnd-upload-cf7.php:50
82
+ msgid "The uploaded file exceeds the maximum upload size of your server."
83
+ msgstr ""
84
+
85
+ #. Description of the plugin
86
+ msgid ""
87
+ "This simple plugin create Drag & Drop or choose Multiple File upload in your "
88
+ "Confact Form 7 Forms."
89
+ msgstr ""
90
+
91
+ #: inc/dnd-upload-cf7.php:53
92
+ msgid "Uploaded file is not allowed for file type"
93
+ msgstr ""
94
+
95
+ #: inc/dnd-upload-cf7.php:52
96
+ msgid "Uploaded file is too large"
97
+ msgstr ""
98
+
99
+ #: inc/dnd-upload-cf7.php:507
100
+ msgid "Uploader Info"
101
+ msgstr ""
102
+
103
+ #: inc/dnd-upload-cf7.php:51
104
+ msgid "Uploading a file fails for any reason"
105
+ msgstr ""
106
+
107
+ #: inc/dnd-upload-cf7.php:425
108
+ msgid "of"
109
+ msgstr "van"
languages/drag-and-drop-multiple-file-upload-contact-form-7-ru_RU.po CHANGED
@@ -1,142 +1,142 @@
1
- msgid ""
2
- 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: 2020-07-19 22:19+0000\n"
6
- "PO-Revision-Date: 2020-07-31 09:13+0800\n"
7
- "Last-Translator: \n"
8
- "Language-Team: Русский\n"
9
- "Language: ru_RU\n"
10
- "Plural-Forms: nplurals=3; plural=(n%10==1 && n%100!=11 ? 0 : n%10 >= 2 && n"
11
- "%10<=4 &&(n%100<10||n%100 >= 20)? 1 : 2);\n"
12
- "MIME-Version: 1.0\n"
13
- "Content-Type: text/plain; charset=UTF-8\n"
14
- "Content-Transfer-Encoding: 8bit\n"
15
- "X-Generator: Poedit 2.3.1\n"
16
- "X-Loco-Version: 2.4.0; wp-5.4.2\n"
17
-
18
- #: inc/dnd-upload-cf7.php:415
19
- msgid "Browse Files"
20
- msgstr "Выбрать файл"
21
-
22
- #: inc/dnd-upload-cf7.php:846
23
- msgid "Browse Text"
24
- msgstr "Текст кнопки Файл"
25
-
26
- #: inc/dnd-upload-cf7.php:422
27
- msgid "deleting"
28
- msgstr "удаление"
29
-
30
- #: inc/dnd-upload-cf7.php:413
31
- msgid "Drag & Drop Files Here"
32
- msgstr "Текст для поля Файл"
33
-
34
- #: inc/dnd-upload-cf7.php:838
35
- msgid "Drag & Drop Text"
36
- msgstr "Текст поля Загрузка файлов"
37
-
38
- #. Name of the plugin
39
- msgid "Drag and Drop Multiple File Upload - Contact Form 7"
40
- msgstr "Форма загрузки файлов для плагина Contact Form 7"
41
-
42
- #: inc/dnd-upload-cf7.php:851
43
- msgid "Error Message"
44
- msgstr "Ошибка"
45
-
46
- #: inc/dnd-upload-cf7.php:859
47
- msgid "Failed to Upload"
48
- msgstr "Загрузка не удалась"
49
-
50
- #: inc/dnd-upload-cf7.php:855
51
- msgid "File exceeds server limit"
52
- msgstr "Превышен лимит размера файлов на сервере"
53
-
54
- #: inc/dnd-upload-cf7.php:863
55
- msgid "Files too large"
56
- msgstr "Файлы слишком большие"
57
-
58
- #. Author of the plugin
59
- msgid "Glen Don L. Mongaya"
60
- msgstr "Glen Don L. Mongaya"
61
-
62
- #. Author URI of the plugin
63
- msgid "http://codedropz.com"
64
- msgstr "http://codedropz.com"
65
-
66
- #. URI of the plugin
67
- msgid "https://profiles.wordpress.org/glenwpcoder"
68
- msgstr "https://profiles.wordpress.org/glenwpcoder"
69
-
70
- #: inc/dnd-upload-cf7.php:867
71
- msgid "Invalid file Type"
72
- msgstr "Неверный тип файла"
73
-
74
- #: inc/dnd-upload-cf7.php:871
75
- msgid "Max File Limit"
76
- msgstr "Максимальный размер файла"
77
-
78
- #: inc/dnd-upload-cf7.php:144
79
- msgid "Minimum file upload at least"
80
- msgstr "Размер файла от"
81
-
82
- #: inc/dnd-upload-cf7.php:875
83
- msgid "Mininimum File"
84
- msgstr "Минимум файлов"
85
-
86
- #: inc/dnd-upload-cf7.php:542
87
- msgid "multiple file upload"
88
- msgstr "форма загрузки нескольких файлов"
89
-
90
- #: inc/dnd-upload-cf7.php:142
91
- #, php-format
92
- msgid ""
93
- "Note : Some of the files are not uploaded ( Only %count% files allowed )"
94
- msgstr ""
95
- "Внимание: некоторые файлы не были загружены ( загружено %count% файлов )"
96
-
97
- #: inc/dnd-upload-cf7.php:414
98
- msgid "or"
99
- msgstr "или"
100
-
101
- #: inc/dnd-upload-cf7.php:423
102
- msgid "Remove"
103
- msgstr "Удалить"
104
-
105
- #: inc/dnd-upload-cf7.php:829
106
- msgid "Send Attachment as links?"
107
- msgstr "Отправить ссылки на скачивание"
108
-
109
- #: inc/dnd-upload-cf7.php:138
110
- msgid "The uploaded file exceeds the maximum upload size of your server."
111
- msgstr "Загруженный файл превышает разрешённый размер."
112
-
113
- #: inc/dnd-upload-cf7.php:143
114
- msgid "This field is required."
115
- msgstr "Поле обязательное"
116
-
117
- #. Description of the plugin
118
- msgid ""
119
- "This simple plugin create Drag & Drop or choose Multiple File upload in your "
120
- "Confact Form 7 Forms."
121
- msgstr ""
122
- "Плагин позволяет создать поле для загрузки файлов в плагине Contact Form 7"
123
-
124
- #: inc/dnd-upload-cf7.php:141
125
- msgid "Uploaded file is not allowed for file type"
126
- msgstr "Данный тип файлов не разрешён"
127
-
128
- #: inc/dnd-upload-cf7.php:140
129
- msgid "Uploaded file is too large"
130
- msgstr "Загруженный файл слишком велик"
131
-
132
- #: inc/dnd-upload-cf7.php:834
133
- msgid "Uploader Info"
134
- msgstr "Информация о загрузчике"
135
-
136
- #: inc/dnd-upload-cf7.php:139
137
- msgid "Uploading a file fails for any reason"
138
- msgstr "Иная ошибка загрузки файла"
139
-
140
- #: inc/dnd-upload-cf7.php:425
141
- msgid "of"
142
- msgstr "из"
1
+ msgid ""
2
+ 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: 2020-07-19 22:19+0000\n"
6
+ "PO-Revision-Date: 2020-07-31 09:13+0800\n"
7
+ "Last-Translator: \n"
8
+ "Language-Team: Русский\n"
9
+ "Language: ru_RU\n"
10
+ "Plural-Forms: nplurals=3; plural=(n%10==1 && n%100!=11 ? 0 : n%10 >= 2 && n"
11
+ "%10<=4 &&(n%100<10||n%100 >= 20)? 1 : 2);\n"
12
+ "MIME-Version: 1.0\n"
13
+ "Content-Type: text/plain; charset=UTF-8\n"
14
+ "Content-Transfer-Encoding: 8bit\n"
15
+ "X-Generator: Poedit 2.3.1\n"
16
+ "X-Loco-Version: 2.4.0; wp-5.4.2\n"
17
+
18
+ #: inc/dnd-upload-cf7.php:415
19
+ msgid "Browse Files"
20
+ msgstr "Выбрать файл"
21
+
22
+ #: inc/dnd-upload-cf7.php:846
23
+ msgid "Browse Text"
24
+ msgstr "Текст кнопки Файл"
25
+
26
+ #: inc/dnd-upload-cf7.php:422
27
+ msgid "deleting"
28
+ msgstr "удаление"
29
+
30
+ #: inc/dnd-upload-cf7.php:413
31
+ msgid "Drag & Drop Files Here"
32
+ msgstr "Текст для поля Файл"
33
+
34
+ #: inc/dnd-upload-cf7.php:838
35
+ msgid "Drag & Drop Text"
36
+ msgstr "Текст поля Загрузка файлов"
37
+
38
+ #. Name of the plugin
39
+ msgid "Drag and Drop Multiple File Upload - Contact Form 7"
40
+ msgstr "Форма загрузки файлов для плагина Contact Form 7"
41
+
42
+ #: inc/dnd-upload-cf7.php:851
43
+ msgid "Error Message"
44
+ msgstr "Ошибка"
45
+
46
+ #: inc/dnd-upload-cf7.php:859
47
+ msgid "Failed to Upload"
48
+ msgstr "Загрузка не удалась"
49
+
50
+ #: inc/dnd-upload-cf7.php:855
51
+ msgid "File exceeds server limit"
52
+ msgstr "Превышен лимит размера файлов на сервере"
53
+
54
+ #: inc/dnd-upload-cf7.php:863
55
+ msgid "Files too large"
56
+ msgstr "Файлы слишком большие"
57
+
58
+ #. Author of the plugin
59
+ msgid "Glen Don L. Mongaya"
60
+ msgstr "Glen Don L. Mongaya"
61
+
62
+ #. Author URI of the plugin
63
+ msgid "http://codedropz.com"
64
+ msgstr "http://codedropz.com"
65
+
66
+ #. URI of the plugin
67
+ msgid "https://profiles.wordpress.org/glenwpcoder"
68
+ msgstr "https://profiles.wordpress.org/glenwpcoder"
69
+
70
+ #: inc/dnd-upload-cf7.php:867
71
+ msgid "Invalid file Type"
72
+ msgstr "Неверный тип файла"
73
+
74
+ #: inc/dnd-upload-cf7.php:871
75
+ msgid "Max File Limit"
76
+ msgstr "Максимальный размер файла"
77
+
78
+ #: inc/dnd-upload-cf7.php:144
79
+ msgid "Minimum file upload at least"
80
+ msgstr "Размер файла от"
81
+
82
+ #: inc/dnd-upload-cf7.php:875
83
+ msgid "Mininimum File"
84
+ msgstr "Минимум файлов"
85
+
86
+ #: inc/dnd-upload-cf7.php:542
87
+ msgid "multiple file upload"
88
+ msgstr "форма загрузки нескольких файлов"
89
+
90
+ #: inc/dnd-upload-cf7.php:142
91
+ #, php-format
92
+ msgid ""
93
+ "Note : Some of the files are not uploaded ( Only %count% files allowed )"
94
+ msgstr ""
95
+ "Внимание: некоторые файлы не были загружены ( загружено %count% файлов )"
96
+
97
+ #: inc/dnd-upload-cf7.php:414
98
+ msgid "or"
99
+ msgstr "или"
100
+
101
+ #: inc/dnd-upload-cf7.php:423
102
+ msgid "Remove"
103
+ msgstr "Удалить"
104
+
105
+ #: inc/dnd-upload-cf7.php:829
106
+ msgid "Send Attachment as links?"
107
+ msgstr "Отправить ссылки на скачивание"
108
+
109
+ #: inc/dnd-upload-cf7.php:138
110
+ msgid "The uploaded file exceeds the maximum upload size of your server."
111
+ msgstr "Загруженный файл превышает разрешённый размер."
112
+
113
+ #: inc/dnd-upload-cf7.php:143
114
+ msgid "This field is required."
115
+ msgstr "Поле обязательное"
116
+
117
+ #. Description of the plugin
118
+ msgid ""
119
+ "This simple plugin create Drag & Drop or choose Multiple File upload in your "
120
+ "Confact Form 7 Forms."
121
+ msgstr ""
122
+ "Плагин позволяет создать поле для загрузки файлов в плагине Contact Form 7"
123
+
124
+ #: inc/dnd-upload-cf7.php:141
125
+ msgid "Uploaded file is not allowed for file type"
126
+ msgstr "Данный тип файлов не разрешён"
127
+
128
+ #: inc/dnd-upload-cf7.php:140
129
+ msgid "Uploaded file is too large"
130
+ msgstr "Загруженный файл слишком велик"
131
+
132
+ #: inc/dnd-upload-cf7.php:834
133
+ msgid "Uploader Info"
134
+ msgstr "Информация о загрузчике"
135
+
136
+ #: inc/dnd-upload-cf7.php:139
137
+ msgid "Uploading a file fails for any reason"
138
+ msgstr "Иная ошибка загрузки файла"
139
+
140
+ #: inc/dnd-upload-cf7.php:425
141
+ msgid "of"
142
+ msgstr "из"
readme.txt CHANGED
@@ -1,312 +1,325 @@
1
- === Drag and Drop Multiple File Upload - Contact Form 7 ===
2
- 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.6
7
- Stable tag: 1.3.5.7
8
- Requires PHP: 5.2.4
9
- License: GPLv2 or later
10
- License URI: https://www.gnu.org/licenses/gpl-2.0.html
11
-
12
- == Description ==
13
-
14
- **Drag and Drop Multiple File Uploader** is a simple, straightforward WordPress plugin extension for Contact Form7, which allows the user to upload multiple files using the **drag-and-drop** feature or the common browse-file of your webform.
15
-
16
- Here's a little [DEMO](http://codedropz.com/contact).
17
-
18
- ### Features
19
-
20
- * File Type Validation
21
- * File Size Validation
22
- * Ajax Uploader
23
- * Limit number of files Upload.
24
- * Limit files size for each field
25
- * Can specify custom file types or extension
26
- * Manage Text and Error message in admin settings
27
- * Drag & Drop or Browse File - Multiple Upload
28
- * Support Multiple Drag and Drop in One Form.
29
- * Able to delete uploaded file before being sent
30
- * Send files as email attachment or as a links.
31
- * Support multiple languages
32
- * Mobile Responsive
33
- * Cool Progress Bar
34
- * Compatible with any browser
35
-
36
- ### ⭐ Premium Features
37
-
38
- Checkout available features on **PRO version**.
39
-
40
- * Image Preview - Show Thumbnail for images
41
- * Auto Delete Files - After Form Submission
42
- - *(1 hour, 4 hours, 8 hours , days, months etc)*
43
- * Zip Files ( Compressed File )
44
- * Save Files to Wordpress Media Library
45
- * Change Upload Folder
46
- - Contact Form 7 - Fields
47
- - Generated Name - Timestamp
48
- - Random Folder
49
- - By User
50
- - Custom Folder
51
- - **Dynamic Folder**
52
- * Change Wordpress Upload Directory
53
- * Send to email as individual attachment, ZIP archive or as a links
54
- * Chunks Upload *( Break large files into smaller Chunks )*
55
- * Max Total Size *( of all Uploaded Files )*
56
- * Parallel/Sequential Upload *( Number of files to simultaneously upload )*
57
- * Change Filename Pattern ({filename}, {cf7-field-name}, {ip_address}, {random}, {post_id}, {post_slug}, etc.)
58
- * Automatically Optimize Images
59
- * **New** - Color Options (Filesize, ProgressBar, Filename etc)
60
- * **New** - Disable Button to Prevent Duplicate Submission
61
- * Resize Image (ie: 800x800)
62
- * Improved Security
63
- * Optimized Code and Performance
64
- * 1 Month Premium Support
65
-
66
- You can get [PRO Version here](https://www.codedropz.com/purchase-plugin/)!
67
-
68
- ### Other Plugin You May Like
69
-
70
- * [Drag & Drop Multiple File Upload - WPForms](https://www.codedropz.com/drag-drop-file-uploader-wpforms/)
71
- An extension for **WPForms** - Transform your simple file upload into beautiful **"Drag & Drop Multiple File Upload"**.
72
-
73
- * [Drag & Drop Multiple File Upload - WooCommerce](https://wordpress.org/plugins/drag-and-drop-multiple-file-upload-for-woocommerce/)
74
- An extension for **WooCommerce** - Transform your simple file upload into beautiful **"Drag & Drop Multiple File Upload"**.
75
-
76
- **PLUGIN GUIDE - FREE VERSION**
77
-
78
- [youtube https://www.youtube.com/watch?v=DvuvmzIImYo]
79
-
80
- == Frequently Asked Questions ==
81
-
82
- = How can I send feedback or get help with a bug? =
83
-
84
- For any bug reports go to <a href="https://wordpress.org/support/plugin/drag-and-drop-multiple-file-upload-contact-form-7">Support</a> page.
85
-
86
- = How can I limit file size? =
87
-
88
- To limit file size in `multiple file upload` field generator under Contact Form 7, there's a field `File size limit (bytes)`.
89
-
90
- Please take note it should be `Bytes` you may use any converter just Google (MB to Bytes converter) default of this plugin is 5MB(5242880 Bytes).
91
-
92
- = How can I limit the number of files in my Upload? =
93
-
94
- You can limit the number of files in your file upload by adding this parameter `max-file:3` to your shortcode :
95
-
96
- Example: *[mfile upload-file-344 max-file:3]* - this option will limit the user to upload only 3 files.
97
-
98
- = How can I Add or Limit file types =
99
-
100
- You can add or change file types in cf7 Form-tag Generator Options by adding `jpeg|png|jpg|gif` in `Acceptable file types field`.
101
-
102
- Example : *[mfile upload-file-433 filetypes:jpeg|png|jpg|gif]*
103
-
104
- = How can I change text in Drag and Drop Uploading area? =
105
-
106
- You can change text `Drag & Drop Files Here or Browse Files` text in Wordpress Admin menu under `Contact` > `Drag & Drop Upload`.
107
-
108
- = How can I change email attachment as links? =
109
-
110
- Go to WP Admin `Contact -> Drag & Drop Upload` settings then check "Send Attachment as links?" option.
111
-
112
- To manage mail template, go to Contact Forms edit specific form and Select `Mail` tab. In Message Body add generated code from mfile. ( Example Below )
113
-
114
- Message Body : [your-message]
115
-
116
- File Links 1 : [upload-file-754]
117
-
118
- File Links2 : [upload-file-755]
119
-
120
- Note : No need to add in `File Attachments` field.
121
-
122
- == Installation ==
123
-
124
- To install this plugin see below:
125
-
126
- 1. Upload the plugin files to the `/wp-content/plugins/drag-and-drop-multiple-file-upload-contact-form-7.zip` directory, or install the plugin through the WordPress plugins screen directly.
127
- 2. Activate the plugin through the 'Plugins' screen in WordPress
128
-
129
- == Screenshots ==
130
-
131
- 1. Generate Upload Field - Admin
132
- 2. Form Field Settings - Admin
133
- 3. Uploader Settings - Admin
134
- 4. Email Attachment- Gmail
135
- 5. Email Attachment As links - Gmail
136
- 6. Multiple Drag and Drop Fields - Front
137
-
138
- == Changelog ==
139
-
140
- = 1.3.5.7 =
141
- - Bug - Fixed validation issue when "CF7 Conditional Fields" plugin is active.
142
-
143
- = 1.3.5.6 =
144
- - New - option to change upload heading tag from h1-h6
145
- - Change text-domain to actual plugin slug for plugin internationalization.
146
- - Fixed validation error message for multiple groups. (compatible with CF7 - Conditional Fields)
147
-
148
- = 1.3.5.5.1 =
149
- * Bug - Fixed Contact Form 7 error notice
150
- - PHP Deprecated: id property of a WPCF7_ContactForm object is no longer accessible.
151
- - Reported here - https://wordpress.org/support/topic/bug-notice-id-not-accessible
152
-
153
- = 1.3.5.5 =
154
- * Fixed - Vulnerability (Thanks to @Sysdream Labs team )
155
- - Removed "supported type" in POST request so other users cannot override through remote access.
156
- - The issue was, user able to bypass and upload ".phar & .phpt" file extension by modifying "suported type"
157
- - Those extensions are enabled by default on a fresh PHP/Apache2 installation.
158
- * Improved - Security (file types condition are based on specified in the admin)
159
-
160
- = 1.3.5.4 =
161
- * Added - Russian translation (Thanks to "Dan Uchvatoff ")
162
- * Fixed - File counter "of" not translatable.
163
-
164
- = 1.3.5.3 =
165
- * Fixed - PHP Fatal error on server not supporting mb_check_encoding.
166
- * Fixed - Fatal error: Uncaught Error: Call to a member function scan_form_tags()
167
- - When "Accept PayPal Payments using Contact Form 7" installed.
168
-
169
- = 1.3.5.2 =
170
- * Added - Improved sercurity ( Limit the user input to a file name and ignore injected path names )
171
- * Modified - Email links ( display only the filename )
172
-
173
- = 1.3.5.1 =
174
- * Bug - Quick Fix ( Unable to submit form when acceptance field is set )
175
- - Issue if "additional settings" section added this line: acceptance_as_validation: on
176
-
177
- = 1.3.5 =
178
- * Fixed - nonce issues when using Cache plugins.
179
- * Fixed - German Translation for ( Drag & Drop File Upload ) text.
180
- * Fixed - Submit button ( enable/disable ) when acceptance checkbox is added.
181
- * Modified - File Upload error message ( display error code )
182
-
183
- = 1.3.4 =
184
- * Fixed - Removed uploaded files when item Inbound Messages "Permanently Deleted".
185
- * Added - Counter of how many files are uploaded ( ie: 4 of 10 )
186
- * New - Features allow to set Minimum File Upload.
187
- - ie : minimum upload:2, max upload:10 = [mfile* upload-file-669 min-file:2 max-file:10]
188
- * New - Added .htaccess file inside "wp_dndcf7_uploads" upload directory. ( prevent from direct access )
189
- - Options: -Indexes \n <Files *.php> \n deny from all \n </Files>
190
- * Fixed - File Attachments bug ( Issues on additional mail when (file attachment) is removed still send the file )
191
-
192
- = 1.3.3.3.2 =
193
- * Bugs - Fixed unable to submit form ( 500 Internal Server Error in response )
194
-
195
- = 1.3.3.3.1 =
196
- * Fixes - Minor updates (packed the wrong file)
197
-
198
- = 1.3.3.3 =
199
- * Fixed - Security Issues ( Unrestricted File Upload to Remote Code Execution - Thanks to @Austin )
200
- - Able bypass and upload file (remotely) by renaming to ie: shell.php% and modified supported_type to `jpg|png|php%`
201
- - Solution : Added more security, check/validate file type and created new function 'dnd_cf7_validate_type' to determine if file name extension is valid or not.
202
- * New - Make 'deleting...' and 'remove' text translatable ( compatible using WPML String Translation ).
203
-
204
- = 1.3.3.2 =
205
- * Fixed - PHP warning reported [here](https://wordpress.org/support/topic/php-warning-count-parameter-must-be-an-array-2/)
206
-
207
- = 1.3.3.1 =
208
- * Improved Security - ( Check valid filename & extensions, sanitations, Secured File deletions )
209
- * New - Allowed non ASCII file name
210
- * Improved styling on Progress Bar
211
- * Fixed - Conflict with WooCommerce Geo Location
212
-
213
- = 1.3.3 =
214
- * SECURITY UPDATES ( issues reported by : Robert L Mathews )
215
- - The issues inside `dnd_codedropz_upload_delete` function, that will execute any POST remotely.
216
- * Fixed - To accept russian, hebrew Filename
217
- * Modify Javascript `dnd-upload-cf7.js` attach the function to window so it can be available to call.
218
- * Added - Responsive style for `Drag & Drop` text on mobile devices.
219
- * Minimum Features - Coming Soon
220
-
221
- = 1.3.2 =
222
- * Fixed - Sanitized Admin Option Fields - For Security Reason
223
- * Added - Filter for `wpcf7_posted_data` from CF7 to get the full link of the file.
224
-
225
- = 1.3.1 =
226
- * Fixed - Browser Compatibility ( Error Uploading files in Edge, Safari and Internet Explorer )
227
- * Improved - Removed error text if there are muliple error ( File upload validation )
228
-
229
- = 1.3.0 =
230
- * Fixed - Multiple Drag & Drop fields in one form ( Validation Issues - Max File not working correctly )
231
- * Added - Added "deleted..." status when removing file.
232
- - So that the user know that file deletion is in progress...
233
- * Fixed - Responsive issues on Mobile < 767px screen.
234
- * Added - Added '/wpcf7-files' directory inside '/wp_dndcf7_uploads' to temporary store files instead of relying contact form 7.
235
- * Added - Auto delete files inside '/wpcf7-files' dir 1 hour(3200 seconds) after submission.
236
- - It was a problem with contact form 7 before that files only last 60 seconds and it will automatically deleted.
237
- * Improved - Optimized and Improved Php Code & Javascript structure and functionalities. ( removed redundant code, removed spaces, etc )
238
- * Added - Links going to Pro Version.
239
-
240
- = 1.2.6.0 =
241
- * Fixed - Allow to upload file with the same filename.
242
- * Fixed - Can't upload image after delecting (https://wordpress.org/support/topic/cant-upload-image-after-deleting-it/)
243
- * Fixed - Max-file issue (https://wordpress.org/support/topic/max-file-issue/)
244
- * Added - a note message when file reached the max-file Limit ( "To inform user that some of the files are not uploaded" ).
245
- * Added - Better Ajax deletion ( Remove files from the server - Only if `Send As Attachment` is checked )
246
- * Optimized - Form send loading time has been optimized ( Improved loading time for large attachment )
247
- * Fixed - Bug reported by @palychwp " `remove file still send sends with the form` (https://wordpress.org/support/topic/file-uploading-is-working-incorrect/)
248
- * Added - Validate File/Attachment first before the upload start ("some says it's frustating :)")
249
- - (PHP or Server side validation still there for security and better validation)
250
- * Improved file counting via `LocalStorage` instead of Global variable.
251
-
252
- = 1.2.5.0 =
253
- * Fixed - Please Update to 1.2.5.0 to fixed disable button issue.
254
-
255
- = 1.2.5 =
256
- * Fixed - Improved ( Disable button while upload is on progress )
257
- * Fixes - Validate file size limit before uploading the file ( https://wordpress.org/support/topic/file-uploading-is-working-incorrect/ )
258
-
259
- = 1.2.4 =
260
- * Added - Support WPML using .po and .mo files
261
- * Added - Added to support multilingual ( using Poedit )
262
- * Fixed - Prevent attachment from sending to Mail(2) if field attachment is not set. (https://wordpress.org/support/topic/problem-with-2th-mail-attachment-2/)
263
- * Added - Disable 'submit' button while upload is on progress...
264
-
265
- = 1.2.3 =
266
- * Added - Multiple Drag and Drop fields in a form
267
- * Added - Options in admin for error message
268
- * Added - Option that allow user to send attachment as links
269
- * Added - Added new folder name `wp_dndcf7_uploads` to separate files from wpcf7_uploads ( When option 'Send Attachment as links?' is check ).
270
-
271
- = 1.2.2 =
272
- * Add - Create admin settings where you can manage or change text in your uploading area. It's under 'contacts' > 'Drag and Drop'.
273
- * New - Empty or Clear attachment file when Contact Form successfully send.
274
- * Fixes - Fixed remove item bugs when file is greater than file limit.
275
- * Fixes - Changed 'icon-moon' fonts to avoid conflict with the other themes.
276
- * New - Added text domain for language translations.
277
-
278
- = 1.2.2 =
279
- * Issue - fixed bug when file is not required(*).
280
- * Issue - fixed error on 'wpcf7_mail_components' components hooks when there's no file.
281
-
282
- = 1.2.1 =
283
- * Issue - fixed bug when file is not required(*).
284
- * Issue - fixed error on 'wpcf7_mail_components' components hooks when there's no file.
285
-
286
- = 1.2 =
287
- - Add admin option to limit the number of files. (Maximum File Upload Limit)
288
-
289
- = 1.1 =
290
- - This version fixes on user drop validation.
291
- - Optimized Javascript File
292
-
293
- = 1.0 =
294
- * Initial Release
295
-
296
- == Upgrade Notice ==
297
-
298
- = 1.2.3 =
299
- This version fixed minor issues/bugs and add multiple drag and drop fields in a form.
300
-
301
- = 1.2.1 =
302
- This version fixed minor issues and bugs.
303
-
304
- = 1.2.2 =
305
- Added some useful features.
306
-
307
- = 1.2.4 =
308
- Added new features and fixes.
309
-
310
- == Donations ==
311
-
 
 
 
 
 
 
 
 
 
 
 
 
 
312
  Would you like to support the advancement of this plugin? [Donate](http://codedropz.com/donation)
1
+ === Drag and Drop Multiple File Upload - Contact Form 7 ===
2
+ 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.6
7
+ Stable tag: 1.3.5.8
8
+ Requires PHP: 5.2.4
9
+ License: GPLv2 or later
10
+ License URI: https://www.gnu.org/licenses/gpl-2.0.html
11
+
12
+ == Description ==
13
+
14
+ **Drag and Drop Multiple File Uploader** is a simple, straightforward WordPress plugin extension for Contact Form7, which allows the user to upload multiple files using the **drag-and-drop** feature or the common browse-file of your webform.
15
+
16
+ Here's a little [DEMO](http://codedropz.com/contact).
17
+
18
+ ### Features
19
+
20
+ * File Type Validation
21
+ * File Size Validation
22
+ * Ajax Uploader
23
+ * Limit number of files Upload.
24
+ * Limit files size for each field
25
+ * Can specify custom file types or extension
26
+ * Manage Text and Error message in admin settings
27
+ * Drag & Drop or Browse File - Multiple Upload
28
+ * Support Multiple Drag and Drop in One Form.
29
+ * Able to delete uploaded file before being sent
30
+ * Send files as email attachment or as a links.
31
+ * Support multiple languages
32
+ * Mobile Responsive
33
+ * Cool Progress Bar
34
+ * Compatible with any browser
35
+
36
+ ### ⭐ Premium Features
37
+
38
+ Checkout available features on **PRO version**.
39
+
40
+ * Image Preview - Show Thumbnail for images
41
+ * Auto Delete Files - After Form Submission
42
+ - *(1 hour, 4 hours, 8 hours , days, months etc)*
43
+ * Zip Files ( Compressed File )
44
+ * Save Files to Wordpress Media Library
45
+ * Change Upload Folder
46
+ - Contact Form 7 - Fields
47
+ - Generated Name - Timestamp
48
+ - Random Folder
49
+ - By User
50
+ - Custom Folder
51
+ - **Dynamic Folder**
52
+ * Change Wordpress Upload Directory
53
+ * Send to email as individual attachment, ZIP archive or as a links
54
+ * Chunks Upload *( Break large files into smaller Chunks )*
55
+ * Max Total Size *( of all Uploaded Files )*
56
+ * Parallel/Sequential Upload *( Number of files to simultaneously upload )*
57
+ * Change Filename Pattern ({filename}, {cf7-field-name}, {ip_address}, {random}, {post_id}, {post_slug}, etc.)
58
+ * Automatically Optimize Images
59
+ * **New** - Color Options (Filesize, ProgressBar, Filename etc)
60
+ * **New** - Disable Button to Prevent Duplicate Submission
61
+ * **New** - Image preview on email
62
+ * Resize Image (ie: 800x800)
63
+ * Improved Security
64
+ * Optimized Code and Performance
65
+ * 1 Month Premium Support
66
+
67
+ Pro version is also compatible with:
68
+
69
+ * Contact Form 7 Add-on – Arshid
70
+ * Database for Contact Form 7- Ninja
71
+ * Advanced Contact form 7 DB Vsourz Digital
72
+
73
+ You can get [PRO Version here](https://www.codedropz.com/purchase-plugin/)!
74
+
75
+ ### Other Plugin You May Like
76
+
77
+ * [Drag & Drop Multiple File Upload - WPForms](https://www.codedropz.com/drag-drop-file-uploader-wpforms/)
78
+ An extension for **WPForms** - Transform your simple file upload into beautiful **"Drag & Drop Multiple File Upload"**.
79
+
80
+ * [Drag & Drop Multiple File Upload - WooCommerce](https://wordpress.org/plugins/drag-and-drop-multiple-file-upload-for-woocommerce/)
81
+ An extension for **WooCommerce** - Transform your simple file upload into beautiful **"Drag & Drop Multiple File Upload"**.
82
+
83
+ **PLUGIN GUIDE - FREE VERSION**
84
+
85
+ [youtube https://www.youtube.com/watch?v=DvuvmzIImYo]
86
+
87
+ == Frequently Asked Questions ==
88
+
89
+ = How can I send feedback or get help with a bug? =
90
+
91
+ For any bug reports go to <a href="https://wordpress.org/support/plugin/drag-and-drop-multiple-file-upload-contact-form-7">Support</a> page.
92
+
93
+ = How can I limit file size? =
94
+
95
+ To limit file size in `multiple file upload` field generator under Contact Form 7, there's a field `File size limit (bytes)`.
96
+
97
+ Please take note it should be `Bytes` you may use any converter just Google (MB to Bytes converter) default of this plugin is 5MB(5242880 Bytes).
98
+
99
+ = How can I limit the number of files in my Upload? =
100
+
101
+ You can limit the number of files in your file upload by adding this parameter `max-file:3` to your shortcode :
102
+
103
+ Example: *[mfile upload-file-344 max-file:3]* - this option will limit the user to upload only 3 files.
104
+
105
+ = How can I Add or Limit file types =
106
+
107
+ You can add or change file types in cf7 Form-tag Generator Options by adding `jpeg|png|jpg|gif` in `Acceptable file types field`.
108
+
109
+ Example : *[mfile upload-file-433 filetypes:jpeg|png|jpg|gif]*
110
+
111
+ = How can I change text in Drag and Drop Uploading area? =
112
+
113
+ You can change text `Drag & Drop Files Here or Browse Files` text in Wordpress Admin menu under `Contact` > `Drag & Drop Upload`.
114
+
115
+ = How can I change email attachment as links? =
116
+
117
+ Go to WP Admin `Contact -> Drag & Drop Upload` settings then check "Send Attachment as links?" option.
118
+
119
+ To manage mail template, go to Contact Forms edit specific form and Select `Mail` tab. In Message Body add generated code from mfile. ( Example Below )
120
+
121
+ Message Body : [your-message]
122
+
123
+ File Links 1 : [upload-file-754]
124
+
125
+ File Links2 : [upload-file-755]
126
+
127
+ Note : No need to add in `File Attachments` field.
128
+
129
+ == Installation ==
130
+
131
+ To install this plugin see below:
132
+
133
+ 1. Upload the plugin files to the `/wp-content/plugins/drag-and-drop-multiple-file-upload-contact-form-7.zip` directory, or install the plugin through the WordPress plugins screen directly.
134
+ 2. Activate the plugin through the 'Plugins' screen in WordPress
135
+
136
+ == Screenshots ==
137
+
138
+ 1. Generate Upload Field - Admin
139
+ 2. Form Field Settings - Admin
140
+ 3. Uploader Settings - Admin
141
+ 4. Email Attachment- Gmail
142
+ 5. Email Attachment As links - Gmail
143
+ 6. Multiple Drag and Drop Fields - Front
144
+
145
+ == Changelog ==
146
+
147
+ = 1.3.5.8 =
148
+ - Fixed German translation (https://wordpress.org/support/topic/german-translation-wrong/)
149
+ - Fixes - Bug on file deletion (Reported here - https://wordpress.org/support/topic/deleting-files-not-yet-uploaded-is-breaking/)
150
+ - Change delete icon instead of using an iconmoon.
151
+ - Minor fixes & Improvement
152
+
153
+ = 1.3.5.7 =
154
+ - Bug - Fixed validation issue when "CF7 Conditional Fields" plugin is active.
155
+
156
+ = 1.3.5.6 =
157
+ - New - option to change upload heading tag from h1-h6
158
+ - Change text-domain to actual plugin slug for plugin internationalization.
159
+ - Fixed validation error message for multiple groups. (compatible with CF7 - Conditional Fields)
160
+
161
+ = 1.3.5.5.1 =
162
+ * Bug - Fixed Contact Form 7 error notice
163
+ - PHP Deprecated: id property of a WPCF7_ContactForm object is no longer accessible.
164
+ - Reported here - https://wordpress.org/support/topic/bug-notice-id-not-accessible
165
+
166
+ = 1.3.5.5 =
167
+ * Fixed - Vulnerability (Thanks to @Sysdream Labs team )
168
+ - Removed "supported type" in POST request so other users cannot override through remote access.
169
+ - The issue was, user able to bypass and upload ".phar & .phpt" file extension by modifying "suported type"
170
+ - Those extensions are enabled by default on a fresh PHP/Apache2 installation.
171
+ * Improved - Security (file types condition are based on specified in the admin)
172
+
173
+ = 1.3.5.4 =
174
+ * Added - Russian translation (Thanks to "Dan Uchvatoff ")
175
+ * Fixed - File counter "of" not translatable.
176
+
177
+ = 1.3.5.3 =
178
+ * Fixed - PHP Fatal error on server not supporting mb_check_encoding.
179
+ * Fixed - Fatal error: Uncaught Error: Call to a member function scan_form_tags()
180
+ - When "Accept PayPal Payments using Contact Form 7" installed.
181
+
182
+ = 1.3.5.2 =
183
+ * Added - Improved sercurity ( Limit the user input to a file name and ignore injected path names )
184
+ * Modified - Email links ( display only the filename )
185
+
186
+ = 1.3.5.1 =
187
+ * Bug - Quick Fix ( Unable to submit form when acceptance field is set )
188
+ - Issue if "additional settings" section added this line: acceptance_as_validation: on
189
+
190
+ = 1.3.5 =
191
+ * Fixed - nonce issues when using Cache plugins.
192
+ * Fixed - German Translation for ( Drag & Drop File Upload ) text.
193
+ * Fixed - Submit button ( enable/disable ) when acceptance checkbox is added.
194
+ * Modified - File Upload error message ( display error code )
195
+
196
+ = 1.3.4 =
197
+ * Fixed - Removed uploaded files when item Inbound Messages "Permanently Deleted".
198
+ * Added - Counter of how many files are uploaded ( ie: 4 of 10 )
199
+ * New - Features allow to set Minimum File Upload.
200
+ - ie : minimum upload:2, max upload:10 = [mfile* upload-file-669 min-file:2 max-file:10]
201
+ * New - Added .htaccess file inside "wp_dndcf7_uploads" upload directory. ( prevent from direct access )
202
+ - Options: -Indexes \n <Files *.php> \n deny from all \n </Files>
203
+ * Fixed - File Attachments bug ( Issues on additional mail when (file attachment) is removed still send the file )
204
+
205
+ = 1.3.3.3.2 =
206
+ * Bugs - Fixed unable to submit form ( 500 Internal Server Error in response )
207
+
208
+ = 1.3.3.3.1 =
209
+ * Fixes - Minor updates (packed the wrong file)
210
+
211
+ = 1.3.3.3 =
212
+ * Fixed - Security Issues ( Unrestricted File Upload to Remote Code Execution - Thanks to @Austin )
213
+ - Able bypass and upload file (remotely) by renaming to ie: shell.php% and modified supported_type to `jpg|png|php%`
214
+ - Solution : Added more security, check/validate file type and created new function 'dnd_cf7_validate_type' to determine if file name extension is valid or not.
215
+ * New - Make 'deleting...' and 'remove' text translatable ( compatible using WPML String Translation ).
216
+
217
+ = 1.3.3.2 =
218
+ * Fixed - PHP warning reported [here](https://wordpress.org/support/topic/php-warning-count-parameter-must-be-an-array-2/)
219
+
220
+ = 1.3.3.1 =
221
+ * Improved Security - ( Check valid filename & extensions, sanitations, Secured File deletions )
222
+ * New - Allowed non ASCII file name
223
+ * Improved styling on Progress Bar
224
+ * Fixed - Conflict with WooCommerce Geo Location
225
+
226
+ = 1.3.3 =
227
+ * SECURITY UPDATES ( issues reported by : Robert L Mathews )
228
+ - The issues inside `dnd_codedropz_upload_delete` function, that will execute any POST remotely.
229
+ * Fixed - To accept russian, hebrew Filename
230
+ * Modify Javascript `dnd-upload-cf7.js` attach the function to window so it can be available to call.
231
+ * Added - Responsive style for `Drag & Drop` text on mobile devices.
232
+ * Minimum Features - Coming Soon
233
+
234
+ = 1.3.2 =
235
+ * Fixed - Sanitized Admin Option Fields - For Security Reason
236
+ * Added - Filter for `wpcf7_posted_data` from CF7 to get the full link of the file.
237
+
238
+ = 1.3.1 =
239
+ * Fixed - Browser Compatibility ( Error Uploading files in Edge, Safari and Internet Explorer )
240
+ * Improved - Removed error text if there are muliple error ( File upload validation )
241
+
242
+ = 1.3.0 =
243
+ * Fixed - Multiple Drag & Drop fields in one form ( Validation Issues - Max File not working correctly )
244
+ * Added - Added "deleted..." status when removing file.
245
+ - So that the user know that file deletion is in progress...
246
+ * Fixed - Responsive issues on Mobile < 767px screen.
247
+ * Added - Added '/wpcf7-files' directory inside '/wp_dndcf7_uploads' to temporary store files instead of relying contact form 7.
248
+ * Added - Auto delete files inside '/wpcf7-files' dir 1 hour(3200 seconds) after submission.
249
+ - It was a problem with contact form 7 before that files only last 60 seconds and it will automatically deleted.
250
+ * Improved - Optimized and Improved Php Code & Javascript structure and functionalities. ( removed redundant code, removed spaces, etc )
251
+ * Added - Links going to Pro Version.
252
+
253
+ = 1.2.6.0 =
254
+ * Fixed - Allow to upload file with the same filename.
255
+ * Fixed - Can't upload image after delecting (https://wordpress.org/support/topic/cant-upload-image-after-deleting-it/)
256
+ * Fixed - Max-file issue (https://wordpress.org/support/topic/max-file-issue/)
257
+ * Added - a note message when file reached the max-file Limit ( "To inform user that some of the files are not uploaded" ).
258
+ * Added - Better Ajax deletion ( Remove files from the server - Only if `Send As Attachment` is checked )
259
+ * Optimized - Form send loading time has been optimized ( Improved loading time for large attachment )
260
+ * Fixed - Bug reported by @palychwp " `remove file still send sends with the form` (https://wordpress.org/support/topic/file-uploading-is-working-incorrect/)
261
+ * Added - Validate File/Attachment first before the upload start ("some says it's frustating :)")
262
+ - (PHP or Server side validation still there for security and better validation)
263
+ * Improved file counting via `LocalStorage` instead of Global variable.
264
+
265
+ = 1.2.5.0 =
266
+ * Fixed - Please Update to 1.2.5.0 to fixed disable button issue.
267
+
268
+ = 1.2.5 =
269
+ * Fixed - Improved ( Disable button while upload is on progress )
270
+ * Fixes - Validate file size limit before uploading the file ( https://wordpress.org/support/topic/file-uploading-is-working-incorrect/ )
271
+
272
+ = 1.2.4 =
273
+ * Added - Support WPML using .po and .mo files
274
+ * Added - Added to support multilingual ( using Poedit )
275
+ * Fixed - Prevent attachment from sending to Mail(2) if field attachment is not set. (https://wordpress.org/support/topic/problem-with-2th-mail-attachment-2/)
276
+ * Added - Disable 'submit' button while upload is on progress...
277
+
278
+ = 1.2.3 =
279
+ * Added - Multiple Drag and Drop fields in a form
280
+ * Added - Options in admin for error message
281
+ * Added - Option that allow user to send attachment as links
282
+ * Added - Added new folder name `wp_dndcf7_uploads` to separate files from wpcf7_uploads ( When option 'Send Attachment as links?' is check ).
283
+
284
+ = 1.2.2 =
285
+ * Add - Create admin settings where you can manage or change text in your uploading area. It's under 'contacts' > 'Drag and Drop'.
286
+ * New - Empty or Clear attachment file when Contact Form successfully send.
287
+ * Fixes - Fixed remove item bugs when file is greater than file limit.
288
+ * Fixes - Changed 'icon-moon' fonts to avoid conflict with the other themes.
289
+ * New - Added text domain for language translations.
290
+
291
+ = 1.2.2 =
292
+ * Issue - fixed bug when file is not required(*).
293
+ * Issue - fixed error on 'wpcf7_mail_components' components hooks when there's no file.
294
+
295
+ = 1.2.1 =
296
+ * Issue - fixed bug when file is not required(*).
297
+ * Issue - fixed error on 'wpcf7_mail_components' components hooks when there's no file.
298
+
299
+ = 1.2 =
300
+ - Add admin option to limit the number of files. (Maximum File Upload Limit)
301
+
302
+ = 1.1 =
303
+ - This version fixes on user drop validation.
304
+ - Optimized Javascript File
305
+
306
+ = 1.0 =
307
+ * Initial Release
308
+
309
+ == Upgrade Notice ==
310
+
311
+ = 1.2.3 =
312
+ This version fixed minor issues/bugs and add multiple drag and drop fields in a form.
313
+
314
+ = 1.2.1 =
315
+ This version fixed minor issues and bugs.
316
+
317
+ = 1.2.2 =
318
+ Added some useful features.
319
+
320
+ = 1.2.4 =
321
+ Added new features and fixes.
322
+
323
+ == Donations ==
324
+
325
  Would you like to support the advancement of this plugin? [Donate](http://codedropz.com/donation)
uninstall.php CHANGED
@@ -1,14 +1,14 @@
1
- <?php
2
-
3
- // if uninstall.php is not called by WordPress, die
4
- if (!defined('WP_UNINSTALL_PLUGIN')) {
5
- die;
6
- }
7
-
8
- // Lists of all options
9
- $options = array('drag_n_drop_heading_tag','drag_n_drop_mail_attachment','drag_n_drop_text','drag_n_drop_separator','drag_n_drop_browse_text','drag_n_drop_error_server_limit','drag_n_drop_error_failed_to_upload','drag_n_drop_error_files_too_large','drag_n_drop_error_invalid_file','drag_n_drop_error_max_file','drag_n_drop_error_min_file','drag_n_drop_disable_btn');
10
-
11
- // Loop and delete options
12
- foreach( $options as $option ) {
13
- delete_option( $option );
14
  }
1
+ <?php
2
+
3
+ // if uninstall.php is not called by WordPress, die
4
+ if (!defined('WP_UNINSTALL_PLUGIN')) {
5
+ die;
6
+ }
7
+
8
+ // Lists of all options
9
+ $options = array('drag_n_drop_heading_tag','drag_n_drop_mail_attachment','drag_n_drop_text','drag_n_drop_separator','drag_n_drop_browse_text','drag_n_drop_error_server_limit','drag_n_drop_error_failed_to_upload','drag_n_drop_error_files_too_large','drag_n_drop_error_invalid_file','drag_n_drop_error_max_file','drag_n_drop_error_min_file','drag_n_drop_disable_btn');
10
+
11
+ // Loop and delete options
12
+ foreach( $options as $option ) {
13
+ delete_option( $option );
14
  }