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

Version Description

  • Bug - Fixed validation issue when "CF7 Conditional Fields" plugin is active.
Download this release

Release Info

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

Code changes from version 1.3.5.5.1 to 1.3.5.7

assets/css/dnd-upload-cf7.css CHANGED
@@ -1,183 +1,183 @@
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
+ @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
  }
assets/fonts/icomoon.svg CHANGED
@@ -1,13 +1,13 @@
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>
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/js/codedropz-uploader-min.js CHANGED
@@ -1,11 +1,11 @@
1
- /**
2
- * CodeDropz Uploader v1.3.5.5
3
- * Copyright 2018 Glen Mongaya
4
- * CodeDrop Drag&Drop Uploader
5
- * @version 1.3.5.5
6
- * @author CodeDropz, Glen Don L. Mongaya
7
- * @license The MIT License (MIT)
8
- */
9
-
10
- // CodeDropz Drag and Drop Plugin
11
- !function(e){e.fn.CodeDropz_Uploader=function(a){this.each(function(){var d=e(this),r=e.extend({handler:d,color:"#000",background:"",server_max_error:"Uploaded file exceeds the maximum upload size of your server.",max_file:d.data("max")?d.data("max"):10,max_upload_size:d.data("limit")?d.data("limit"):"10485760",supported_type:d.data("type")?d.data("type"):"jpg|jpeg|JPG|png|gif|pdf|doc|docx|ppt|pptx|odt|avi|ogg|m4a|mov|mp3|mp4|mpg|wav|wmv|xls",text:"Drag & Drop Files Here",separator:"or",button_text:"Browse Files",on_success:""},a),o=d.data("name")+"_count_files";localStorage.setItem(o,1);var s='<div class="codedropz-upload-handler"><div class="codedropz-upload-container"><div class="codedropz-upload-inner"><h3>'+r.text+"</h3><span>"+r.separator+'</span><div class="codedropz-btn-wrap"><a class="cd-upload-btn" href="javascript:void(0)">'+r.button_text+'</a></div></div></div><span class="dnd-upload-counter"><span>0</span> '+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),e},complete:function(){i.setProgressBar(l,100)},success:function(a){a.success?e.isFunction(r.on_success)&&r.on_success.call(this,d,l,a):(e(".dnd-progress-bar",e("#"+l)).remove(),e(".dnd-upload-details",e("#"+l)).append('<span class="has-error">'+a.data+"</span>"),e('input[type="submit"]',t).removeClass("disabled").prop("disabled",!1))},error:function(a,d,o){e(".dnd-progress-bar",e("#"+l)).remove(),e(".dnd-upload-details",e("#"+l)).append('<span class="has-error">'+r.server_max_error+"</span>"),e('input[type="submit"]',t).removeClass("disabled").prop("disabled",!1)}})}})}},i={createProgressBar:function(a){var d=e(".codedropz-upload-handler",n),r="dnd-file-"+Math.random().toString(36).substr(2,9),s='<div class="dnd-upload-image"><span class="dnd-icon-blank-file"></span></div><div class="dnd-upload-details"><span class="name"><span>'+a.name+"</span><em>("+i.bytesToSize(a.size)+')</em></span><a href="javascript:void(0)" title="'+dnd_cf7_uploader.drag_n_drop_upload.delete.title+'" class="remove-file" data-storage="'+o+'"><span class="dnd-icon-remove"></span></a><span class="dnd-progress-bar"><span></span></span></div>';return d.after('<div id="'+r+'" class="dnd-upload-status">'+s+"</div>"),r},setProgressBar:function(a,d){var r=e(".dnd-progress-bar",e("#"+a));return r.length>0&&(i.disableBtn(p),progress_width=d*r.width()/100,e("span",r).addClass("in-progress").animate({width:progress_width},10).text(d+"% "),100==d&&e("span",r).addClass("complete").removeClass("in-progress")),!1},bytesToSize:function(e){return 0===e?"0":(kBytes=e/1024,fileSize=kBytes>=1024?(kBytes/1024).toFixed(2)+"MB":kBytes.toFixed(2)+"KB",fileSize)},disableBtn:function(e){e.length>0&&e.addClass("disable").prop("disabled",!0)}}}),e(document).on("click",".dnd-icon-remove",function(d){var r=e(this),o=r.parents(".dnd-upload-status"),s=r.parents(".codedropz-upload-wrapper"),t=r.parent("a").attr("data-storage"),n=Number(localStorage.getItem(t));if(e("span.in-progress",o).length>0)return!1;if(e(".has-error",o).length>0)return o.remove(),localStorage.setItem(t,n-1),!1;r.addClass("deleting").text(dnd_cf7_uploader.drag_n_drop_upload.delete.text+"...");var p={path:o.find('input[type="hidden"]').val(),action:"dnd_codedropz_upload_delete",security:dnd_cf7_uploader.ajax_nonce};e.post(a.ajax_url,p,function(a){a.success&&(o.remove(),localStorage.setItem(t,n-1),e(".dnd-upload-status",s).length<=1&&e("span.has-error-msg",s).remove(),e(".dnd-upload-counter span",s).text(Number(localStorage.getItem(t))-1))}),e("span.has-error-msg").remove()})}}(jQuery);
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);
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,33 +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: dnd-upload-cf7
8
- * Domain Path: /languages
9
- * Version: 1.3.5.5.1
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.5.1' );
25
-
26
- /** Define constant Plugin Directories */
27
- define( 'dnd_upload_cf7_directory', untrailingslashit( dirname( __FILE__ ) ) );
28
-
29
- /* Define Custom Upload Directory */
30
- define('wpcf7_dnd_dir', 'wp_dndcf7_uploads');
31
-
32
- // require plugin core file
 
 
33
  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.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' );
inc/dnd-upload-cf7.php CHANGED
@@ -1,994 +1,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( 'dnd-upload-cf7', 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.','dnd-upload-cf7'),
139
- 'failed_upload' => __('Uploading a file fails for any reason','dnd-upload-cf7'),
140
- 'large_file' => __('Uploaded file is too large','dnd-upload-cf7'),
141
- 'invalid_type' => __('Uploaded file is not allowed for file type','dnd-upload-cf7'),
142
- 'max_file_limit' => __('Note : Some of the files are not uploaded ( Only %count% files allowed )','dnd-upload-cf7'),
143
- 'required' => __('This field is required.', 'dnd-upload-cf7' ),
144
- 'min_file' => __('Minimum file upload at least','dnd-upload-cf7'),
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
- 'text' => ( get_option('drag_n_drop_text') ? get_option('drag_n_drop_text') : __('Drag & Drop Files Here','dnd-upload-cf7') ),
414
- 'or_separator' => ( get_option('drag_n_drop_separator') ? get_option('drag_n_drop_separator') : __('or','dnd-upload-cf7') ),
415
- 'browse' => ( get_option('drag_n_drop_browse_text') ? get_option('drag_n_drop_browse_text') : __('Browse Files','dnd-upload-cf7') ),
416
- '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') ),
417
- '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') ),
418
- 'inavalid_type' => ( get_option('drag_n_drop_error_invalid_file') ? get_option('drag_n_drop_error_invalid_file') : dnd_cf7_error_msg('invalid_type') ),
419
- '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') ),
420
- 'required' => dnd_cf7_error_msg('required'),
421
- 'delete' => array(
422
- 'text' => __('deleting','dnd-upload-cf7'),
423
- 'title' => __('Remove','dnd-upload-cf7')
424
- )
425
- ),
426
- 'dnd_text_counter' => __('of','dnd-upload-cf7')
427
- )
428
- );
429
-
430
- // enque style
431
- wp_enqueue_style( 'dnd-upload-cf7', plugins_url ('/assets/css/dnd-upload-cf7.css', dirname(__FILE__) ), '', $version );
432
- }
433
-
434
- // Generate tag
435
- function dnd_cf7_upload_add_form_tag_file() {
436
- wpcf7_add_form_tag( array( 'mfile ', 'mfile*'), 'dnd_cf7_upload_form_tag_handler', array( 'name-attr' => true ) );
437
- }
438
-
439
- // Form tag handler from the tag - callback
440
- function dnd_cf7_upload_form_tag_handler( $tag ) {
441
-
442
- // check and make sure tag name is not empty
443
- if ( empty( $tag->name ) ) {
444
- return '';
445
- }
446
-
447
- // Validate our fields
448
- $validation_error = wpcf7_get_validation_error( $tag->name );
449
-
450
- // Generate class
451
- $class = wpcf7_form_controls_class( 'drag-n-drop-file d-none' );
452
-
453
- // Add not-valid class if there's an error.
454
- if ( $validation_error ) {
455
- $class .= ' wpcf7-not-valid';
456
- }
457
-
458
- // Get current form Object
459
- $form = WPCF7_ContactForm::get_current();
460
-
461
- // Setup element attributes
462
- $atts = array();
463
-
464
- $atts['size'] = $tag->get_size_option( '40' );
465
- $atts['class'] = $tag->get_class_option( $class );
466
- $atts['id'] = $tag->get_id_option();
467
- $atts['tabindex'] = $tag->get_option( 'tabindex', 'signed_int', true );
468
-
469
- // If file is required
470
- if ( $tag->is_required() ) {
471
- $atts['aria-required'] = 'true';
472
- }
473
-
474
- // Set invalid attributes if there's validation error
475
- $atts['aria-invalid'] = $validation_error ? 'true' : 'false';
476
-
477
- // Set input type and name
478
- $atts['type'] = 'file';
479
- $atts['multiple'] = 'multiple';
480
- $atts['data-name'] = $tag->name;
481
- $atts['data-type'] = $tag->get_option( 'filetypes','', true);
482
- $atts['data-limit'] = $tag->get_option( 'limit','', true);
483
- $atts['data-max'] = $tag->get_option( 'max-file','', true);
484
- $atts['data-id'] = ( $form->id() ? $form->id() : 0 );
485
-
486
- // Combine and format attrbiutes
487
- $atts = wpcf7_format_atts( $atts );
488
-
489
- // Return our element and attributes
490
- return sprintf('<span class="wpcf7-form-control-wrap %1$s"><input %2$s />%3$s</span>', sanitize_html_class( $tag->name ), $atts, $validation_error );
491
- }
492
-
493
- // Encode type filter to support multipart since this is input type file
494
- add_filter( 'wpcf7_form_enctype', 'dnd_upload_cf7_form_enctype_filter' );
495
-
496
- function dnd_upload_cf7_form_enctype_filter( $enctype ) {
497
- $multipart = (bool) wpcf7_scan_form_tags( array( 'type' => array( 'drag_drop_file', 'drag_drop_file*' ) ) );
498
-
499
- if ( $multipart ) {
500
- $enctype = 'multipart/form-data';
501
- }
502
-
503
- return $enctype;
504
- }
505
-
506
- // Validation + upload handling filter
507
- add_filter( 'wpcf7_validate_mfile', 'dnd_upload_cf7_validation_filter', 10, 2 );
508
- add_filter( 'wpcf7_validate_mfile*', 'dnd_upload_cf7_validation_filter', 10, 2 );
509
-
510
- function dnd_upload_cf7_validation_filter( $result, $tag ) {
511
- $name = $tag->name;
512
- $id = $tag->get_id_option();
513
- $multiple_files = ( ( isset( $_POST[ $name ] ) && count( $_POST[ $name ] ) > 0 ) ? $_POST[ $name ] : null );
514
- $min_file = $tag->get_option( 'min-file','', true);
515
-
516
- // Cf7 Conditional Field
517
- if( in_array('cf7-conditional-fields/contact-form-7-conditional-fields.php', get_option('active_plugins') ) ){
518
- $hidden_groups = json_decode( stripslashes( $_POST['_wpcf7cf_hidden_groups'] ) );
519
- if( $tag->is_required() && ! in_array( $name, $hidden_groups ) && is_null( $multiple_files ) ) {
520
- $result->invalidate( $tag, wpcf7_get_message( 'invalid_required' ) );
521
- return $result;
522
- }
523
- return $result;
524
- }
525
-
526
- // Check if we have files or if it's empty
527
- if( is_null( $multiple_files ) && $tag->is_required() ) {
528
- $result->invalidate( $tag, wpcf7_get_message( 'invalid_required' ) );
529
- return $result;
530
- }
531
-
532
- // Check minimum upload
533
- if( $multiple_files && count( $multiple_files ) < (int) $min_file ) {
534
- $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') );
535
- $result->invalidate( $tag, $min_file_error .' '. (int)$min_file );
536
- return $result;
537
- }
538
-
539
- return $result;
540
- }
541
-
542
- // Generate Admin From Tag
543
- add_action( 'wpcf7_admin_init', 'dnd_upload_cf7_add_tag_generator', 50 );
544
-
545
- function dnd_upload_cf7_add_tag_generator() {
546
- $tag_generator = WPCF7_TagGenerator::get_instance();
547
- $tag_generator->add( 'upload-file', __( 'multiple file upload', 'dnd-upload-cf7' ),'dnd_upload_cf7_tag_generator_file' );
548
- }
549
-
550
- // Display form in admin
551
- function dnd_upload_cf7_tag_generator_file( $contact_form, $args = '' ) {
552
-
553
- // Parse data and get our options
554
- $args = wp_parse_args( $args, array() );
555
-
556
- // Our multiple upload field
557
- $type = 'mfile';
558
-
559
- $description = __( "Generate a form-tag for a file uploading field. For more details, see %s.", 'contact-form-7' );
560
- $desc_link = wpcf7_link( __( 'https://contactform7.com/file-uploading-and-attachment/', 'contact-form-7' ), __( 'File Uploading and Attachment', 'contact-form-7' ) );
561
-
562
- ?>
563
-
564
- <div class="control-box">
565
- <fieldset>
566
- <legend><?php echo sprintf( esc_html( $description ), $desc_link ); ?></legend>
567
- <table class="form-table">
568
- <tbody>
569
- <tr>
570
- <th scope="row"><?php echo esc_html( __( 'Field type', 'contact-form-7' ) ); ?></th>
571
- <td>
572
- <fieldset>
573
- <legend class="screen-reader-text"><?php echo esc_html( __( 'Field type', 'contact-form-7' ) ); ?></legend>
574
- <label><input type="checkbox" name="required" /> <?php echo esc_html( __( 'Required field', 'contact-form-7' ) ); ?></label>
575
- </fieldset>
576
- </td>
577
- </tr>
578
- <tr>
579
- <th scope="row"><label for="<?php echo esc_attr( $args['content'] . '-name' ); ?>"><?php echo esc_html( __( 'Name', 'contact-form-7' ) ); ?></label></th>
580
- <td><input type="text" name="name" class="tg-name oneline" id="<?php echo esc_attr( $args['content'] . '-name' ); ?>" /></td>
581
- </tr>
582
- <tr>
583
- <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>
584
- <td><input type="text" name="limit" class="filesize oneline option" id="<?php echo esc_attr( $args['content'] . '-limit' ); ?>" /></td>
585
- </tr>
586
- <tr>
587
- <th scope="row"><label for="<?php echo esc_attr( $args['content'] . '-filetypes' ); ?>"><?php echo esc_html( __( 'Acceptable file types', 'contact-form-7' ) ); ?></label></th>
588
- <td><input type="text" name="filetypes" class="filetype oneline option" placeholder="jpeg|png|jpg|gif" id="<?php echo esc_attr( $args['content'] . '-filetypes' ); ?>" /></td>
589
- </tr>
590
- <tr>
591
- <th scope="row"><label for="<?php echo esc_attr( $args['content'] . '-min-file' ); ?>"><?php echo esc_html( __( 'Mininum file upload', 'contact-form-7' ) ); ?></label></th>
592
- <td><input type="text" name="min-file" class="filetype oneline option" placeholder="5" id="<?php echo esc_attr( $args['content'] . '-min-file' ); ?>" /></td>
593
- </tr>
594
- <tr>
595
- <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>
596
- <td><input type="text" name="max-file" class="filetype oneline option" placeholder="10" id="<?php echo esc_attr( $args['content'] . '-max-file' ); ?>" /></td>
597
- </tr>
598
- <tr>
599
- <th scope="row"><label for="<?php echo esc_attr( $args['content'] . '-id' ); ?>"><?php echo esc_html( __( 'Id attribute', 'contact-form-7' ) ); ?></label></th>
600
- <td><input type="text" name="id" class="idvalue oneline option" id="<?php echo esc_attr( $args['content'] . '-id' ); ?>" /></td>
601
- </tr>
602
- <tr>
603
- <th scope="row"><label for="<?php echo esc_attr( $args['content'] . '-class' ); ?>"><?php echo esc_html( __( 'Class attribute', 'contact-form-7' ) ); ?></label></th>
604
- <td><input type="text" name="class" class="classvalue oneline option" id="<?php echo esc_attr( $args['content'] . '-class' ); ?>" /></td>
605
- </tr>
606
- </tbody>
607
- </table>
608
- </fieldset>
609
- </div>
610
-
611
- <div class="insert-box">
612
- <input type="text" name="<?php echo $type; ?>" class="tag code" readonly="readonly" onfocus="this.select()" />
613
- <div class="submitbox">
614
- <input type="button" class="button button-primary insert-tag" value="<?php echo esc_attr( __( 'Insert Tag', 'contact-form-7' ) ); ?>" />
615
- </div>
616
- <br class="clear" />
617
- <p class="description mail-tag">
618
- <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>
619
- </p>
620
- </div>
621
-
622
- <?php
623
- }
624
-
625
- // Get allowed types
626
- function dnd_cf7_get_allowed_types( $form_id ) {
627
-
628
- // Initialize contact form instance
629
- $form = WPCF7_ContactForm::get_instance( $form_id );
630
-
631
- // Check if not valid object and null
632
- if( ! $form && ! is_object( $form ) ) {
633
- return false;
634
- }
635
-
636
- // Get specific tag (mfile is for dnd file upload)
637
- $tags = $form->scan_form_tags( array( 'type' => array('mfile', 'mfile*') ) );
638
- $supported_types = array();
639
-
640
- // Loop all upload tags
641
- if( $tags && is_array( $tags ) ) {
642
- foreach( $tags as $tag ) {
643
-
644
- // Get file types option & remove not allowed character..
645
- $types = preg_replace( '/[^a-zA-Z0-9|\']/', '', $tag->get_option('filetypes','', true ) );
646
-
647
- // Assign if filetypes is present otherwise use the default ext list.
648
- $supported_types[ $tag->name ] = ( $types ? $types : dnd_upload_default_ext() );
649
- }
650
- }
651
-
652
- return $supported_types;
653
- }
654
-
655
- // Begin process upload
656
- function dnd_upload_cf7_upload() {
657
-
658
- // cf7 form id & upload name
659
- $cf7_id = sanitize_text_field( (int)$_POST['form_id']);
660
-
661
- // Get the name of upload field.
662
- $cf7_upload_name = sanitize_text_field( $_POST['upload_name'] );
663
-
664
- // Get allowed ext list @expected : png|jpeg|jpg
665
- $allowed_types = dnd_cf7_get_allowed_types( $cf7_id );
666
-
667
- // check and verify ajax request
668
- if( is_user_logged_in() ) {
669
- check_ajax_referer( 'dnd-cf7-security-nonce', 'security' );
670
- }
671
-
672
- // Get upload dir
673
- $path = dnd_get_upload_dir();
674
-
675
- // input type file 'name'
676
- $name = 'upload-file';
677
-
678
- // Get File ( name, type, tmp_name, size, error )
679
- $file = isset( $_FILES[$name] ) ? $_FILES[$name] : null;
680
-
681
- // Tells whether the file was uploaded via HTTP POST
682
- if ( ! is_uploaded_file( $file['tmp_name'] ) ) {
683
- $failed_error = get_option('drag_n_drop_error_failed_to_upload');
684
- wp_send_json_error( '('. $file['error'] .') ' . ( $failed_error ? $failed_error : dnd_cf7_error_msg('failed_upload') ) );
685
- }
686
-
687
- /* Get allowed extension */
688
- $supported_type = ( isset( $allowed_types["$cf7_upload_name"] ) ? $allowed_types["$cf7_upload_name"] : dnd_upload_default_ext() );
689
-
690
- // Create type pattern for anti script
691
- $file_type_pattern = dnd_upload_cf7_filetypes( $supported_type );
692
-
693
- // Get file extension
694
- $extension = strtolower( pathinfo( $file['name'], PATHINFO_EXTENSION ) );
695
-
696
- // validate file type
697
- if ( ! preg_match( $file_type_pattern, $file['name'] ) || ! dnd_cf7_validate_type( $extension, $supported_type ) ) {
698
- 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') );
699
- }
700
-
701
- // validate file size limit
702
- if( $file['size'] > (int)$_POST['size_limit'] ) {
703
- 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') );
704
- }
705
-
706
- // Create file name
707
- $filename = wp_basename( $file['name'] );
708
- $filename = wpcf7_canonicalize( $filename, 'as-is' );
709
-
710
- // Check if string is ascii then proceed with antiscript function ( remove or clean filename )
711
- if( dnd_cf7_check_ascii( $filename ) ){
712
- $filename = wpcf7_antiscript_file_name( $filename );
713
- }
714
-
715
- // Add filter on upload file name
716
- $filename = apply_filters( 'wpcf7_upload_file_name', $filename, $file['name'] );
717
-
718
- // Generate new filename
719
- $filename = wp_unique_filename( $path['upload_dir'], $filename );
720
- $new_file = path_join( $path['upload_dir'], $filename );
721
-
722
- // Upload File
723
- if ( false === move_uploaded_file( $file['tmp_name'], $new_file ) ) {
724
- $failed_error = get_option('drag_n_drop_error_failed_to_upload');
725
- wp_send_json_error( '('. $file['error'] .') ' . ( $failed_error ? $failed_error : dnd_cf7_error_msg('failed_upload') ) );
726
- }else{
727
-
728
- $files = array(
729
- 'path' => basename( $path['upload_dir'] ),
730
- 'file' => str_replace('/','-', $filename)
731
- );
732
-
733
- // Change file permission to 0400
734
- chmod( $new_file, 0644 );
735
-
736
- wp_send_json_success( $files );
737
- }
738
-
739
- die;
740
- }
741
-
742
- // Check if a string is ASCII.
743
- function dnd_cf7_check_ascii( $string ) {
744
- if ( function_exists( 'mb_check_encoding' ) ) {
745
- if ( mb_check_encoding( $string, 'ASCII' ) ) {
746
- return true;
747
- }
748
- } elseif ( ! preg_match( '/[^\x00-\x7F]/', $string ) ) {
749
- return true;
750
- }
751
-
752
- return false;
753
- }
754
-
755
- // Delete file
756
- function dnd_codedropz_upload_delete() {
757
-
758
- // Get folder directory
759
- $dir = dnd_get_upload_dir();
760
-
761
- // check and verify ajax request
762
- if( is_user_logged_in() ) {
763
- check_ajax_referer( 'dnd-cf7-security-nonce', 'security' );
764
- }
765
-
766
- // Sanitize Path
767
- $get_path = ( isset( $_POST['path'] ) ? sanitize_text_field( $_POST['path'] ) : null );
768
-
769
- //limit the user input to a file name and to ignore injected path names
770
- $path = basename( $get_path );
771
-
772
- // Make sure path is set
773
- if( ! is_null( $path ) ) {
774
-
775
- // Check valid filename & extensions
776
- if( preg_match_all('/wp-|(\.php|\.exe|\.js|\.phtml|\.cgi|\.aspx|\.asp|\.bat)/', $path ) ) {
777
- die('File not safe');
778
- }
779
-
780
- // Concatenate path and upload directory
781
- $file_path = realpath( trailingslashit( $dir['upload_dir'] ) . trim( $path ) );
782
-
783
- // Check if is in the correct upload_dir
784
- if( ! preg_match("/". wpcf7_dnd_dir ."/i", $file_path ) ) {
785
- die('It\'s not a valid upload directory');
786
- }
787
-
788
- // Check if file exists
789
- if( file_exists( $file_path ) ){
790
- wp_delete_file( $file_path );
791
- if( ! file_exists( $file_path ) ) {
792
- wp_send_json_success('File Deleted!');
793
- }
794
- }
795
- }
796
-
797
- die;
798
- }
799
-
800
- // Setup file type pattern for validation
801
- function dnd_upload_cf7_filetypes( $types ) {
802
- $file_type_pattern = '';
803
-
804
- // If contact form 7 5.0 and up
805
- if( function_exists('wpcf7_acceptable_filetypes') ) {
806
- $file_type_pattern = wpcf7_acceptable_filetypes( $types, 'regex' );
807
- $file_type_pattern = '/\.(' . $file_type_pattern . ')$/i';
808
- }else{
809
- $allowed_file_types = array();
810
- $file_types = explode( '|', $types );
811
-
812
- foreach ( $file_types as $file_type ) {
813
- $file_type = trim( $file_type, '.' );
814
- $file_type = str_replace( array( '.', '+', '*', '?' ), array( '\.', '\+', '\*', '\?' ), $file_type );
815
- $allowed_file_types[] = $file_type;
816
- }
817
-
818
- $allowed_file_types = array_unique( $allowed_file_types );
819
- $file_type_pattern = implode( '|', $allowed_file_types );
820
-
821
- $file_type_pattern = trim( $file_type_pattern, '|' );
822
- $file_type_pattern = '(' . $file_type_pattern . ')';
823
- $file_type_pattern = '/\.' . $file_type_pattern . '$/i';
824
- }
825
-
826
- return $file_type_pattern;
827
- }
828
-
829
- // Add more validation for file extension
830
- function dnd_cf7_validate_type( $extension, $supported_types ) {
831
- $valid = true;
832
- $extension = preg_replace( '/[^A-Za-z0-9,|]/', '', $extension );
833
-
834
- // not allowed file types
835
- $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' );
836
-
837
- // Search in $not_allowed extension and match
838
- foreach( $not_allowed as $single_ext ) {
839
- if ( strpos( $single_ext, $extension ) !== false ) {
840
- $valid = false;
841
- break;
842
- }
843
- }
844
-
845
- // If pass on first validation - check extension if exists in allowed types
846
- if( $valid === true ) {
847
- $extensions = explode('|', strtolower( $supported_types ) );
848
- if( ! in_array( $extension, $extensions ) ) {
849
- $valid = false;
850
- }
851
- }
852
-
853
- return $valid;
854
- }
855
-
856
- // Admin Settings
857
- function dnd_upload_admin_settings( ) {
858
- echo '<div class="wrap">';
859
- echo '<h1>Drag & Drop Uploader - Settings</h1>';
860
-
861
- echo '<div class="update-nag notice" style="width: 98%;padding: 0px 10px;margin-bottom: 5px;">';
862
- echo '<p>Checkout more features on <a href="https://codedropz.com/purchase-plugin/" target="_blank">Pro Version</a></p>';
863
- echo '</div>';
864
-
865
- // Error settings
866
- settings_errors();
867
-
868
- echo '<form method="post" action="options.php"> ';
869
- settings_fields( 'drag-n-drop-upload-file-cf7' );
870
- do_settings_sections( 'drag-n-drop-upload-file-cf7' );
871
- ?>
872
-
873
- <table class="form-table">
874
- <tr valign="top">
875
- <th scope="row"><?php _e('Send Attachment as links?','dnd-upload-cf7'); ?></th>
876
- <td><input name="drag_n_drop_mail_attachment" type="checkbox" value="yes" <?php checked('yes', get_option('drag_n_drop_mail_attachment')); ?>></td>
877
- </tr>
878
- </table>
879
-
880
- <h2><?php _e('Uploader Info','dnd-upload-cf7'); ?></h2>
881
-
882
- <table class="form-table">
883
- <tr valign="top">
884
- <th scope="row"><?php _e('Drag & Drop Text','dnd-upload-cf7'); ?></th>
885
- <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>
886
- </tr>
887
- <tr valign="top">
888
- <th scope="row"></th>
889
- <td><input type="text" name="drag_n_drop_separator" value="<?php echo esc_attr( get_option('drag_n_drop_separator') ); ?>" placeholder="or" /></td>
890
- </tr>
891
- <tr valign="top">
892
- <th scope="row"><?php _e('Browse Text','dnd-upload-cf7'); ?></th>
893
- <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>
894
- </tr>
895
- </table>
896
-
897
- <h2><?php _e('Error Message','dnd-upload-cf7'); ?></h2>
898
-
899
- <table class="form-table">
900
- <tr valign="top">
901
- <th scope="row"><?php _e('File exceeds server limit','dnd-upload-cf7'); ?></th>
902
- <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>
903
- </tr>
904
- <tr valign="top">
905
- <th scope="row"><?php _e('Failed to Upload','dnd-upload-cf7'); ?></th>
906
- <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>
907
- </tr>
908
- <tr valign="top">
909
- <th scope="row"><?php _e('Files too large','dnd-upload-cf7'); ?></th>
910
- <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>
911
- </tr>
912
- <tr valign="top">
913
- <th scope="row"><?php _e('Invalid file Type','dnd-upload-cf7'); ?></th>
914
- <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>
915
- </tr>
916
- <tr valign="top">
917
- <th scope="row"><?php _e('Max File Limit','dnd-upload-cf7'); ?></th>
918
- <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>
919
- </tr>
920
- <tr valign="top">
921
- <th scope="row"><?php _e('Mininimum File','dnd-upload-cf7'); ?></th>
922
- <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>
923
- </tr>
924
- </table>
925
-
926
- <?php submit_button(); ?>
927
-
928
- <?php
929
- echo '</form>';
930
- echo '</div>';
931
- }
932
-
933
- // Add script in footer
934
- function dnd_custom_scripts() {
935
- if( ! in_array('jquery-validation-for-contact-form-7/jquery-validation-for-contact-form-7.php', get_option('active_plugins') ) ){
936
- return;
937
- }
938
- ?>
939
- <script type="text/javascript">
940
- // Contact form 7 - Jquery validation
941
- jQuery(document).ready(function($){
942
- jQuery('.wpcf7-form-control.wpcf7-submit').click(function(e){
943
- var uploadFields = $(this).parents('form').find('.wpcf7-drag-n-drop-file');
944
- var valid = true;
945
- if( uploadFields.length > 0 ) {
946
- jQuery.each(uploadFields, function(i,field){
947
- if( $(field).attr('aria-required') == 'true' ) {
948
- parentsWrap = $(field).parents('.codedropz-upload-wrapper');
949
- parentsWrap.removeClass('invalid');
950
- parentsWrap.find('label').remove();
951
- if( $('[type="hidden"][name="'+$(field).attr('data-name')+'[]"]').length == 0 ) {
952
- parentsWrap.append('<label class="error-new">'+ dnd_cf7_uploader.drag_n_drop_upload.required +'</label>').addClass('invalid');
953
- valid = false;
954
- }
955
- }
956
- });
957
- if( ! valid ) {
958
- return false;
959
- }
960
- }
961
- return true;
962
- });
963
- });
964
- </script>
965
- <?php
966
- }
967
-
968
- // Define custom (safe) file extension.
969
- function dnd_upload_default_ext() {
970
- 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' );
971
- }
972
-
973
- // Add custom links
974
- function dnd_custom_plugin_row_meta( $links, $file ) {
975
- if ( strpos( $file, 'drag-n-drop-upload-cf7.php' ) !== false ) {
976
- $new_links = array('pro-version' => '<a href="https://codedropz.com/purchase-plugin/" target="_blank" style="font-weight:bold; color:#f4a647;">Pro Version</a>');
977
- $links = array_merge( $links, $new_links );
978
- }
979
- return $links;
980
- }
981
-
982
- // Save admin settings
983
- function dnd_upload_register_settings() {
984
- register_setting( 'drag-n-drop-upload-file-cf7', 'drag_n_drop_mail_attachment','sanitize_text_field' );
985
- register_setting( 'drag-n-drop-upload-file-cf7', 'drag_n_drop_text','sanitize_text_field' );
986
- register_setting( 'drag-n-drop-upload-file-cf7', 'drag_n_drop_separator','sanitize_text_field' );
987
- register_setting( 'drag-n-drop-upload-file-cf7', 'drag_n_drop_browse_text','sanitize_text_field' );
988
- register_setting( 'drag-n-drop-upload-file-cf7', 'drag_n_drop_error_server_limit','sanitize_text_field' );
989
- register_setting( 'drag-n-drop-upload-file-cf7', 'drag_n_drop_error_failed_to_upload','sanitize_text_field' );
990
- register_setting( 'drag-n-drop-upload-file-cf7', 'drag_n_drop_error_files_too_large','sanitize_text_field' );
991
- register_setting( 'drag-n-drop-upload-file-cf7', 'drag_n_drop_error_invalid_file','sanitize_text_field' );
992
- register_setting( 'drag-n-drop-upload-file-cf7', 'drag_n_drop_error_max_file','sanitize_text_field' );
993
- register_setting( 'drag-n-drop-upload-file-cf7', 'drag_n_drop_error_min_file','sanitize_text_field' );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
994
  }
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
  }
languages/dnd-upload-cf7-de_DE.mo DELETED
Binary file
languages/{dnd-upload-cf7-de_DE.po → drag-and-drop-multiple-file-upload-contact-form-7-de_DE.po} RENAMED
@@ -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: 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"
languages/{dnd-upload-cf7-fr_FR.mo → drag-and-drop-multiple-file-upload-contact-form-7-fr_FR.mo} RENAMED
File without changes
languages/{dnd-upload-cf7-fr_FR.po → drag-and-drop-multiple-file-upload-contact-form-7-fr_FR.po} RENAMED
@@ -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/{dnd-upload-cf7-ko_KR.mo → drag-and-drop-multiple-file-upload-contact-form-7-ko_KR.mo} RENAMED
File without changes
languages/{dnd-upload-cf7-ko_KR.po → drag-and-drop-multiple-file-upload-contact-form-7-ko_KR.po} RENAMED
File without changes
languages/{dnd-upload-cf7-nl_NL.mo → drag-and-drop-multiple-file-upload-contact-form-7-nl_NL.mo} RENAMED
File without changes
languages/{dnd-upload-cf7-nl_NL.po → drag-and-drop-multiple-file-upload-contact-form-7-nl_NL.po} RENAMED
@@ -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/{dnd-upload-cf7-ru_RU.mo → drag-and-drop-multiple-file-upload-contact-form-7-ru_RU.mo} RENAMED
File without changes
languages/{dnd-upload-cf7-ru_RU.po → drag-and-drop-multiple-file-upload-contact-form-7-ru_RU.po} RENAMED
@@ -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,300 +1,312 @@
1
- === Drag and Drop Multiple File Upload - Contact Form 7 ===
2
- Donate link : http://codedropz.com/donation
3
- Tags: drag and drop, contact form 7, ajax uploader, multiple file, upload, contact form 7 uploader
4
- Requires at least: 3.0.1
5
- Tested up to: 5.5
6
- Stable tag: 1.3.5.5.1
7
- Requires PHP: 5.2.4
8
- License: GPLv2 or later
9
- License URI: https://www.gnu.org/licenses/gpl-2.0.html
10
-
11
- == Description ==
12
-
13
- **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.
14
-
15
- Here's a little [DEMO](http://codedropz.com/contact).
16
-
17
- ### Features
18
-
19
- * File Type Validation
20
- * File Size Validation
21
- * Ajax Uploader
22
- * Limit number of files Upload.
23
- * Limit files size for each field
24
- * Can specify custom file types or extension
25
- * Manage Text and Error message in admin settings
26
- * Drag & Drop or Browse File - Multiple Upload
27
- * Support Multiple Drag and Drop in One Form.
28
- * Able to delete uploaded file before being sent
29
- * Send files as email attachment or as a links.
30
- * Support multiple languages
31
- * Mobile Responsive
32
- * Cool Progress Bar
33
- * Compatible with any browser
34
-
35
- ### ⭐ Premium Features
36
-
37
- Checkout available features on **PRO version**.
38
-
39
- * Image Preview - Show Thumbnail for images
40
- * Auto Delete Files - After Form Submission
41
- - *(1 hour, 4 hours, 8 hours , days, months etc)*
42
- * Zip Files ( Compressed File )
43
- * Save Files to Wordpress Media Library
44
- * Change Upload Folder
45
- - Contact Form 7 - Fields
46
- - Generated Name - Timestamp
47
- - Random Folder
48
- - By User
49
- - Custom Folder
50
- * Change Wordpress Upload Directory
51
- * Send to email as individual attachment, ZIP archive or as a links
52
- * Chunks Upload *( Break large files into smaller Chunks )*
53
- * Max Total Size *( of all Uploaded Files )*
54
- * Parallel/Sequential Upload *( Number of files to simultaneously upload )*
55
- * Change Filename Pattern ({filename}, {cf7-field-name}, {ip_address}, {random}, {post_id}, {post_slug}, etc.)
56
- * Automatically Optimize Images
57
- * Able to Resize/Crop image (ie: 800x800)
58
- * Improved Security
59
- * Optimized Code and Performance
60
- * 1 Month Premium Support
61
-
62
- You can get [PRO Version here](https://www.codedropz.com/purchase-plugin/)!
63
-
64
- ### Other Plugin You May Like
65
-
66
- * [Drag & Drop Multiple File Upload - WPForms](https://www.codedropz.com/drag-drop-file-uploader-wpforms/)
67
- An extension for **WPForms** - Transform your simple file upload into beautiful **"Drag & Drop Multiple File Upload"**.
68
-
69
- * [Drag & Drop Multiple File Upload - WooCommerce](https://wordpress.org/plugins/drag-and-drop-multiple-file-upload-for-woocommerce/)
70
- An extension for **WooCommerce** - Transform your simple file upload into beautiful **"Drag & Drop Multiple File Upload"**.
71
-
72
- **PLUGIN GUIDE - FREE VERSION**
73
-
74
- [youtube https://www.youtube.com/watch?v=DvuvmzIImYo]
75
-
76
- == Frequently Asked Questions ==
77
-
78
- = How can I send feedback or get help with a bug? =
79
-
80
- 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.
81
-
82
- = How can I limit file size? =
83
-
84
- To limit file size in `multiple file upload` field generator under Contact Form 7, there's a field `File size limit (bytes)`.
85
-
86
- 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).
87
-
88
- = How can I limit the number of files in my Upload? =
89
-
90
- You can limit the number of files in your file upload by adding this parameter `max-file:3` to your shortcode :
91
-
92
- Example: *[mfile upload-file-344 max-file:3]* - this option will limit the user to upload only 3 files.
93
-
94
- = How can I Add or Limit file types =
95
-
96
- You can add or change file types in cf7 Form-tag Generator Options by adding `jpeg|png|jpg|gif` in `Acceptable file types field`.
97
-
98
- Example : *[mfile upload-file-433 filetypes:jpeg|png|jpg|gif]*
99
-
100
- = How can I change text in Drag and Drop Uploading area? =
101
-
102
- You can change text `Drag & Drop Files Here or Browse Files` text in Wordpress Admin menu under `Contact` > `Drag & Drop Upload`.
103
-
104
- = How can I change email attachment as links? =
105
-
106
- Go to WP Admin `Contact -> Drag & Drop Upload` settings then check "Send Attachment as links?" option.
107
-
108
- 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 )
109
-
110
- Message Body : [your-message]
111
-
112
- File Links 1 : [upload-file-754]
113
-
114
- File Links2 : [upload-file-755]
115
-
116
- Note : No need to add in `File Attachments` field.
117
-
118
- == Installation ==
119
-
120
- To install this plugin see below:
121
-
122
- 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.
123
- 2. Activate the plugin through the 'Plugins' screen in WordPress
124
-
125
- == Screenshots ==
126
-
127
- 1. Generate Upload Field - Admin
128
- 2. Form Field Settings - Admin
129
- 3. Uploader Settings - Admin
130
- 4. Email Attachment- Gmail
131
- 5. Email Attachment As links - Gmail
132
- 6. Multiple Drag and Drop Fields - Front
133
-
134
- == Changelog ==
135
-
136
- = 1.3.5.5.1 =
137
- * Bug - Fixed Contact Form 7 error notice
138
- - PHP Deprecated: id property of a WPCF7_ContactForm object is no longer accessible.
139
- - Reported here - https://wordpress.org/support/topic/bug-notice-id-not-accessible
140
-
141
- = 1.3.5.5 =
142
- * Fixed - Vulnerability (Thanks to @Sysdream Labs team )
143
- - Removed "supported type" in POST request so other users cannot override through remote access.
144
- - The issue was, user able to bypass and upload ".phar & .phpt" file extension by modifying "suported type"
145
- - Those extensions are enabled by default on a fresh PHP/Apache2 installation.
146
- * Improved - Security (file types condition are based on specified in the admin)
147
-
148
- = 1.3.5.4 =
149
- * Added - Russian translation (Thanks to "Dan Uchvatoff ")
150
- * Fixed - File counter "of" not translatable.
151
-
152
- = 1.3.5.3 =
153
- * Fixed - PHP Fatal error on server not supporting mb_check_encoding.
154
- * Fixed - Fatal error: Uncaught Error: Call to a member function scan_form_tags()
155
- - When "Accept PayPal Payments using Contact Form 7" installed.
156
-
157
- = 1.3.5.2 =
158
- * Added - Improved sercurity ( Limit the user input to a file name and ignore injected path names )
159
- * Modified - Email links ( display only the filename )
160
-
161
- = 1.3.5.1 =
162
- * Bug - Quick Fix ( Unable to submit form when acceptance field is set )
163
- - Issue if "additional settings" section added this line: acceptance_as_validation: on
164
-
165
- = 1.3.5 =
166
- * Fixed - nonce issues when using Cache plugins.
167
- * Fixed - German Translation for ( Drag & Drop File Upload ) text.
168
- * Fixed - Submit button ( enable/disable ) when acceptance checkbox is added.
169
- * Modified - File Upload error message ( display error code )
170
-
171
- = 1.3.4 =
172
- * Fixed - Removed uploaded files when item Inbound Messages "Permanently Deleted".
173
- * Added - Counter of how many files are uploaded ( ie: 4 of 10 )
174
- * New - Features allow to set Minimum File Upload.
175
- - ie : minimum upload:2, max upload:10 = [mfile* upload-file-669 min-file:2 max-file:10]
176
- * New - Added .htaccess file inside "wp_dndcf7_uploads" upload directory. ( prevent from direct access )
177
- - Options: -Indexes \n <Files *.php> \n deny from all \n </Files>
178
- * Fixed - File Attachments bug ( Issues on additional mail when (file attachment) is removed still send the file )
179
-
180
- = 1.3.3.3.2 =
181
- * Bugs - Fixed unable to submit form ( 500 Internal Server Error in response )
182
-
183
- = 1.3.3.3.1 =
184
- * Fixes - Minor updates (packed the wrong file)
185
-
186
- = 1.3.3.3 =
187
- * Fixed - Security Issues ( Unrestricted File Upload to Remote Code Execution - Thanks to @Austin )
188
- - Able bypass and upload file (remotely) by renaming to ie: shell.php% and modified supported_type to `jpg|png|php%`
189
- - 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.
190
- * New - Make 'deleting...' and 'remove' text translatable ( compatible using WPML String Translation ).
191
-
192
- = 1.3.3.2 =
193
- * Fixed - PHP warning reported [here](https://wordpress.org/support/topic/php-warning-count-parameter-must-be-an-array-2/)
194
-
195
- = 1.3.3.1 =
196
- * Improved Security - ( Check valid filename & extensions, sanitations, Secured File deletions )
197
- * New - Allowed non ASCII file name
198
- * Improved styling on Progress Bar
199
- * Fixed - Conflict with WooCommerce Geo Location
200
-
201
- = 1.3.3 =
202
- * SECURITY UPDATES ( issues reported by : Robert L Mathews )
203
- - The issues inside `dnd_codedropz_upload_delete` function, that will execute any POST remotely.
204
- * Fixed - To accept russian, hebrew Filename
205
- * Modify Javascript `dnd-upload-cf7.js` attach the function to window so it can be available to call.
206
- * Added - Responsive style for `Drag & Drop` text on mobile devices.
207
- * Minimum Features - Coming Soon
208
-
209
- = 1.3.2 =
210
- * Fixed - Sanitized Admin Option Fields - For Security Reason
211
- * Added - Filter for `wpcf7_posted_data` from CF7 to get the full link of the file.
212
-
213
- = 1.3.1 =
214
- * Fixed - Browser Compatibility ( Error Uploading files in Edge, Safari and Internet Explorer )
215
- * Improved - Removed error text if there are muliple error ( File upload validation )
216
-
217
- = 1.3.0 =
218
- * Fixed - Multiple Drag & Drop fields in one form ( Validation Issues - Max File not working correctly )
219
- * Added - Added "deleted..." status when removing file.
220
- - So that the user know that file deletion is in progress...
221
- * Fixed - Responsive issues on Mobile < 767px screen.
222
- * Added - Added '/wpcf7-files' directory inside '/wp_dndcf7_uploads' to temporary store files instead of relying contact form 7.
223
- * Added - Auto delete files inside '/wpcf7-files' dir 1 hour(3200 seconds) after submission.
224
- - It was a problem with contact form 7 before that files only last 60 seconds and it will automatically deleted.
225
- * Improved - Optimized and Improved Php Code & Javascript structure and functionalities. ( removed redundant code, removed spaces, etc )
226
- * Added - Links going to Pro Version.
227
-
228
- = 1.2.6.0 =
229
- * Fixed - Allow to upload file with the same filename.
230
- * Fixed - Can't upload image after delecting (https://wordpress.org/support/topic/cant-upload-image-after-deleting-it/)
231
- * Fixed - Max-file issue (https://wordpress.org/support/topic/max-file-issue/)
232
- * Added - a note message when file reached the max-file Limit ( "To inform user that some of the files are not uploaded" ).
233
- * Added - Better Ajax deletion ( Remove files from the server - Only if `Send As Attachment` is checked )
234
- * Optimized - Form send loading time has been optimized ( Improved loading time for large attachment )
235
- * Fixed - Bug reported by @palychwp " `remove file still send sends with the form` (https://wordpress.org/support/topic/file-uploading-is-working-incorrect/)
236
- * Added - Validate File/Attachment first before the upload start ("some says it's frustating :)")
237
- - (PHP or Server side validation still there for security and better validation)
238
- * Improved file counting via `LocalStorage` instead of Global variable.
239
-
240
- = 1.2.5.0 =
241
- * Fixed - Please Update to 1.2.5.0 to fixed disable button issue.
242
-
243
- = 1.2.5 =
244
- * Fixed - Improved ( Disable button while upload is on progress )
245
- * Fixes - Validate file size limit before uploading the file ( https://wordpress.org/support/topic/file-uploading-is-working-incorrect/ )
246
-
247
- = 1.2.4 =
248
- * Added - Support WPML using .po and .mo files
249
- * Added - Added to support multilingual ( using Poedit )
250
- * 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/)
251
- * Added - Disable 'submit' button while upload is on progress...
252
-
253
- = 1.2.3 =
254
- * Added - Multiple Drag and Drop fields in a form
255
- * Added - Options in admin for error message
256
- * Added - Option that allow user to send attachment as links
257
- * Added - Added new folder name `wp_dndcf7_uploads` to separate files from wpcf7_uploads ( When option 'Send Attachment as links?' is check ).
258
-
259
- = 1.2.2 =
260
- * Add - Create admin settings where you can manage or change text in your uploading area. It's under 'contacts' > 'Drag and Drop'.
261
- * New - Empty or Clear attachment file when Contact Form successfully send.
262
- * Fixes - Fixed remove item bugs when file is greater than file limit.
263
- * Fixes - Changed 'icon-moon' fonts to avoid conflict with the other themes.
264
- * New - Added text domain for language translations.
265
-
266
- = 1.2.2 =
267
- * Issue - fixed bug when file is not required(*).
268
- * Issue - fixed error on 'wpcf7_mail_components' components hooks when there's no file.
269
-
270
- = 1.2.1 =
271
- * Issue - fixed bug when file is not required(*).
272
- * Issue - fixed error on 'wpcf7_mail_components' components hooks when there's no file.
273
-
274
- = 1.2 =
275
- - Add admin option to limit the number of files. (Maximum File Upload Limit)
276
-
277
- = 1.1 =
278
- - This version fixes on user drop validation.
279
- - Optimized Javascript File
280
-
281
- = 1.0 =
282
- * Initial Release
283
-
284
- == Upgrade Notice ==
285
-
286
- = 1.2.3 =
287
- This version fixed minor issues/bugs and add multiple drag and drop fields in a form.
288
-
289
- = 1.2.1 =
290
- This version fixed minor issues and bugs.
291
-
292
- = 1.2.2 =
293
- Added some useful features.
294
-
295
- = 1.2.4 =
296
- Added new features and fixes.
297
-
298
- == Donations ==
299
-
 
 
 
 
 
 
 
 
 
 
 
 
300
  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.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)
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_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');
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
  }