Version Description
This is the initial release of Wordpress File Upload. Since this plugin is the successor of Inline Upload, the whole changelog since the creation of the later is included.
- Name of the plugin changed to Wordpress File Upload.
- Plugin has been completely restructured to allow additional features.
- A new more advanced message box has been included showing information in a more structured way.
- Error detection and reporting has been improved.
- An administration page has been created in the Dashboard Settings, containing a Shortcode Composer.
- Some more options related to configuration of message showing upload results have been added.
- Several bug fixes.
Download this release
Release Info
Developer | nickboss |
Plugin | WordPress File Upload |
Version | 2.0.1 |
Comparing to | |
See all releases |
Version 2.0.1
- css/wordpress_file_upload_adminstyle.css +477 -0
- css/wordpress_file_upload_reset.css +47 -0
- css/wordpress_file_upload_style.css +703 -0
- css/wordpress_file_upload_style_safe.css +229 -0
- images/add_12.png +0 -0
- images/add_16.png +0 -0
- images/draw-delete.png +0 -0
- images/help_16.png +0 -0
- images/progbar.gif +0 -0
- images/refresh_16.gif +0 -0
- images/remove_12.png +0 -0
- images/remove_16.png +0 -0
- images/white-grad-active.png +0 -0
- js/getElementsByClassName-1.0.1.js +78 -0
- js/json2.js +480 -0
- js/wordpress_file_upload_adminfunctions.js +522 -0
- js/wordpress_file_upload_functions.js +1194 -0
- languages/wordpress-file-upload-upload.pot +374 -0
- lib/wfu_admin.php +369 -0
- lib/wfu_ajaxactions.php +84 -0
- lib/wfu_attributes.php +724 -0
- lib/wfu_blocks.php +241 -0
- lib/wfu_constants.php +181 -0
- lib/wfu_functions.php +288 -0
- lib/wfu_io.php +106 -0
- lib/wfu_message.php +211 -0
- lib/wfu_processfiles.php +462 -0
- readme.txt +459 -0
- screenshot-1.jpg +0 -0
- screenshot-2.jpg +0 -0
- screenshot-3.jpg +0 -0
- screenshot-4.jpg +0 -0
- screenshot-5.jpg +0 -0
- wfu_response.php +20 -0
- wordpress_file_upload.php +279 -0
css/wordpress_file_upload_adminstyle.css
ADDED
@@ -0,0 +1,477 @@
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
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Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
1 |
+
div.wfu_shortcode_container
|
2 |
+
{
|
3 |
+
display: inline-block;
|
4 |
+
position: relative;
|
5 |
+
width: 50%;
|
6 |
+
padding: 0;
|
7 |
+
margin: 0;
|
8 |
+
background: none;
|
9 |
+
border: none;
|
10 |
+
}
|
11 |
+
|
12 |
+
textarea.wfu_shortcode
|
13 |
+
{
|
14 |
+
width: 100%;
|
15 |
+
}
|
16 |
+
|
17 |
+
div.wfu_container
|
18 |
+
{
|
19 |
+
margin-top: 10px;
|
20 |
+
}
|
21 |
+
|
22 |
+
div.wfu_help_container
|
23 |
+
{
|
24 |
+
display: inline-block;
|
25 |
+
position: relative;
|
26 |
+
top: 4px;
|
27 |
+
padding: 0;
|
28 |
+
margin: 0;
|
29 |
+
background: none;
|
30 |
+
border: none;
|
31 |
+
}
|
32 |
+
|
33 |
+
div.wfu_td_div
|
34 |
+
{
|
35 |
+
display: block;
|
36 |
+
position: relative;
|
37 |
+
width: 100%;
|
38 |
+
height: 100%;
|
39 |
+
padding: 0;
|
40 |
+
margin: 0;
|
41 |
+
background: none;
|
42 |
+
border: none;
|
43 |
+
}
|
44 |
+
|
45 |
+
div.wfu_container input.wfu_long_text { width: 100%; }
|
46 |
+
div.wfu_container input.wfu_short_text { width: 60px; }
|
47 |
+
div.wfu_container input { width: 200px; }
|
48 |
+
div.wfu_container input[type="checkbox"] { width: auto; }
|
49 |
+
|
50 |
+
table.wfu_main_table { table-layout: fixed; }
|
51 |
+
|
52 |
+
table.wfu_inner_table { }
|
53 |
+
|
54 |
+
table.wfu_main_table tr:nth-child(odd) { background-color: #f4f4f4; }
|
55 |
+
|
56 |
+
table.wfu_main_table tr:nth-child(even) { background-color: transparent; }
|
57 |
+
|
58 |
+
table.wfu_main_table table.wfu_inner_table tr { background-color: transparent; }
|
59 |
+
|
60 |
+
table.wfu_main_table th { width: 17%; }
|
61 |
+
|
62 |
+
table.wfu_main_table td:nth-child(2) { width: 33%; }
|
63 |
+
|
64 |
+
table.wfu_main_table td:nth-child(3) { width: 50%; }
|
65 |
+
|
66 |
+
table.wfu_main_table table.wfu_inner_table th { width: 34%; }
|
67 |
+
|
68 |
+
table.wfu_main_table table.wfu_inner_table td:nth-child(2) { width: 66%; }
|
69 |
+
|
70 |
+
table.wfu_main_table tr.wfu_subcategory { background-color: #ddd; }
|
71 |
+
|
72 |
+
table.wfu_main_table tr.wfu_subcategory > th { padding-top: 0; padding-bottom: 0; }
|
73 |
+
|
74 |
+
span.wfu_variable
|
75 |
+
{
|
76 |
+
font-size: smaller;
|
77 |
+
background-color: #ddd;
|
78 |
+
border: 1px solid #ccc;
|
79 |
+
-webkit-border-radius: 5px;
|
80 |
+
-moz-border-radius: 5px;
|
81 |
+
-khtml-border-radius: 5px;
|
82 |
+
border-radius: 5px;
|
83 |
+
-webkit-touch-callout: none;
|
84 |
+
-webkit-user-select: none;
|
85 |
+
-khtml-user-select: none;
|
86 |
+
-moz-user-select: none;
|
87 |
+
-ms-user-select: none;
|
88 |
+
user-select: none;
|
89 |
+
cursor: default;
|
90 |
+
}
|
91 |
+
|
92 |
+
span.wfu_ptext_span
|
93 |
+
{
|
94 |
+
display: inline-block;
|
95 |
+
width: 60px;
|
96 |
+
}
|
97 |
+
|
98 |
+
div.wfu_shadow
|
99 |
+
{
|
100 |
+
position: absolute;
|
101 |
+
width: 100%;
|
102 |
+
height: 100%;
|
103 |
+
left: 0;
|
104 |
+
top: 0;
|
105 |
+
margin: 0;
|
106 |
+
padding: 0;
|
107 |
+
background-color: white;
|
108 |
+
z-index: 10;
|
109 |
+
-ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=60)";
|
110 |
+
filter: alpha(opacity=60);
|
111 |
+
-moz-opacity: 0.6;
|
112 |
+
-khtml-opacity: 0.6;
|
113 |
+
opacity: 0.6;
|
114 |
+
}
|
115 |
+
|
116 |
+
table.wfu_main_table tr:nth-child(odd) div.wfu_shadow { background-color: #f4f4f4; }
|
117 |
+
|
118 |
+
div.wfu_onoff_container_on, div.wfu_onoff_container_off
|
119 |
+
{
|
120 |
+
display: inline-block;
|
121 |
+
position: relative;
|
122 |
+
padding: 2px;
|
123 |
+
border: 1px solid #aaa;
|
124 |
+
-webkit-border-radius: 3px;
|
125 |
+
-moz-border-radius: 3px;
|
126 |
+
-khtml-border-radius: 3px;
|
127 |
+
border-radius: 3px;
|
128 |
+
background: rgb(6,109,171);
|
129 |
+
background: -moz-linear-gradient(top, rgba(6,109,171,1) 0%, rgba(197,222,234,1) 100%);
|
130 |
+
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,rgba(6,109,171,1)), color-stop(100%,rgba(197,222,234,1)));
|
131 |
+
background: -webkit-linear-gradient(top, rgba(6,109,171,1) 0%,rgba(197,222,234,1) 100%);
|
132 |
+
background: -o-linear-gradient(top, rgba(6,109,171,1) 0%,rgba(197,222,234,1) 100%);
|
133 |
+
background: -ms-linear-gradient(top, rgba(6,109,171,1) 0%,rgba(197,222,234,1) 100%);
|
134 |
+
background: linear-gradient(to bottom, rgba(6,109,171,1) 0%,rgba(197,222,234,1) 100%);
|
135 |
+
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#066dab', endColorstr='#c5deea',GradientType=0 );
|
136 |
+
}
|
137 |
+
|
138 |
+
span.wfu_onoff_text
|
139 |
+
{
|
140 |
+
width: 30px;
|
141 |
+
display: inline-block;
|
142 |
+
text-align: center;
|
143 |
+
color: #FFF;
|
144 |
+
}
|
145 |
+
|
146 |
+
div.wfu_onoff_slider
|
147 |
+
{
|
148 |
+
position: absolute;
|
149 |
+
margin: 0;
|
150 |
+
width: 31px;
|
151 |
+
top: 0px;
|
152 |
+
bottom: 0px;
|
153 |
+
border: 1px solid #fff;
|
154 |
+
-webkit-border-radius: 2px;
|
155 |
+
-moz-border-radius: 2px;
|
156 |
+
-khtml-border-radius: 2px;
|
157 |
+
border-radius: 2px;
|
158 |
+
-moz-box-shadow: 0px 0px 2px;
|
159 |
+
-webkit-box-shadow: 0px 0px 2px;
|
160 |
+
box-shadow: 0px 0px 2px;
|
161 |
+
background: rgb(204,204,204);
|
162 |
+
background: -moz-linear-gradient(top, rgba(204,204,204,1) 0%, rgba(255,255,255,1) 100%);
|
163 |
+
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,rgba(204,204,204,1)), color-stop(100%,rgba(255,255,255,1)));
|
164 |
+
background: -webkit-linear-gradient(top, rgba(204,204,204,1) 0%,rgba(255,255,255,1) 100%);
|
165 |
+
background: -o-linear-gradient(top, rgba(204,204,204,1) 0%,rgba(255,255,255,1) 100%);
|
166 |
+
background: -ms-linear-gradient(top, rgba(204,204,204,1) 0%,rgba(255,255,255,1) 100%);
|
167 |
+
background: linear-gradient(to bottom, rgba(204,204,204,1) 0%,rgba(255,255,255,1) 100%);
|
168 |
+
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#cccccc', endColorstr='#ffffff',GradientType=0 );
|
169 |
+
}
|
170 |
+
|
171 |
+
div.wfu_onoff_container_on div.wfu_onoff_slider
|
172 |
+
{
|
173 |
+
left: 50%;
|
174 |
+
/* -webkit-animation: set_on 0.1s linear;
|
175 |
+
-moz-animation: set_on 0.1s linear;
|
176 |
+
-o-animation: set_on 0.1s linear;
|
177 |
+
animation: set_on 0.1s linear; */
|
178 |
+
}
|
179 |
+
|
180 |
+
div.wfu_onoff_container_off div.wfu_onoff_slider
|
181 |
+
{
|
182 |
+
left: 0%;
|
183 |
+
/* -webkit-animation: set_on 0.1s linear reverse;
|
184 |
+
-moz-animation: set_on 0.1s linear reverse;
|
185 |
+
-o-animation: set_on 0.1s linear reverse;
|
186 |
+
animation: set_on 0.1s linear reverse; */
|
187 |
+
}
|
188 |
+
|
189 |
+
@-webkit-keyframes set_on { from { left: 0%; } to { left: 50%; } }
|
190 |
+
@-moz-keyframes set_on { from { left: 0%; } to { left: 50%; } }
|
191 |
+
@-o-keyframes set_on { from { left: 0%; } to { left: 50%; } }
|
192 |
+
@keyframes set_on { from { left: 0%; } to { left: 50%; } }
|
193 |
+
|
194 |
+
div.wfu_placements_wrapper
|
195 |
+
{
|
196 |
+
display: block;
|
197 |
+
position: relative;
|
198 |
+
margin: 0;
|
199 |
+
padding: 0;
|
200 |
+
background: none;
|
201 |
+
border: none;
|
202 |
+
}
|
203 |
+
|
204 |
+
div.wfu_placements_container
|
205 |
+
{
|
206 |
+
display: inline-block;
|
207 |
+
position: relative;
|
208 |
+
width: 100%;
|
209 |
+
height: 300px;
|
210 |
+
background-color: white;
|
211 |
+
border: 1px solid #ccc;
|
212 |
+
-webkit-border-radius: 3px;
|
213 |
+
-moz-border-radius: 3px;
|
214 |
+
-khtml-border-radius: 3px;
|
215 |
+
border-radius: 3px;
|
216 |
+
padding: 0;
|
217 |
+
overflow: scroll;
|
218 |
+
font-size: 0;
|
219 |
+
line-height: 0;
|
220 |
+
white-space: nowrap;
|
221 |
+
}
|
222 |
+
|
223 |
+
div.wfu_componentlist_container
|
224 |
+
{
|
225 |
+
display: inline-block;
|
226 |
+
position: absolute;
|
227 |
+
width: auto;
|
228 |
+
height: auto;
|
229 |
+
top: 0;
|
230 |
+
left: 100%;
|
231 |
+
background: none;
|
232 |
+
border: none;
|
233 |
+
margin: 0 0 0 20px;
|
234 |
+
padding: 0;
|
235 |
+
z-index: 1;
|
236 |
+
white-space: nowrap;
|
237 |
+
}
|
238 |
+
|
239 |
+
div.wfu_component_box_container
|
240 |
+
{
|
241 |
+
display: inline-block;
|
242 |
+
position: relative;
|
243 |
+
width: 80px;
|
244 |
+
height: 30px;
|
245 |
+
background-color: transparent;
|
246 |
+
border: 1px solid transparent;
|
247 |
+
padding: 4px;
|
248 |
+
margin: 0;
|
249 |
+
cursor: default;
|
250 |
+
}
|
251 |
+
|
252 |
+
div.wfu_component_box_base
|
253 |
+
{
|
254 |
+
display: block;
|
255 |
+
position: absolute;
|
256 |
+
width: 80px;
|
257 |
+
height: 30px;
|
258 |
+
left: -1px;
|
259 |
+
top: -1px;
|
260 |
+
background-color: #ddd;
|
261 |
+
border: 1px solid #bbb;
|
262 |
+
-webkit-border-radius: 3px;
|
263 |
+
-moz-border-radius: 3px;
|
264 |
+
-khtml-border-radius: 3px;
|
265 |
+
border-radius: 3px;
|
266 |
+
padding: 4px;
|
267 |
+
cursor: default;
|
268 |
+
font-size: 12px;
|
269 |
+
line-height: 1;
|
270 |
+
-ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=40)";
|
271 |
+
filter: alpha(opacity=40);
|
272 |
+
-moz-opacity: 0.4;
|
273 |
+
-khtml-opacity: 0.4;
|
274 |
+
opacity: 0.4;
|
275 |
+
white-space: normal;
|
276 |
+
}
|
277 |
+
|
278 |
+
div.wfu_component_box
|
279 |
+
{
|
280 |
+
display: inline-block;
|
281 |
+
position: relative;
|
282 |
+
width: 80px;
|
283 |
+
height: 30px;
|
284 |
+
background-color: #ddd;
|
285 |
+
border: 1px solid #bbb;
|
286 |
+
-webkit-border-radius: 3px;
|
287 |
+
-moz-border-radius: 3px;
|
288 |
+
-khtml-border-radius: 3px;
|
289 |
+
border-radius: 3px;
|
290 |
+
padding: 4px;
|
291 |
+
cursor: default;
|
292 |
+
font-size: 12px;
|
293 |
+
line-height: 1;
|
294 |
+
z-index: 1;
|
295 |
+
white-space: normal;
|
296 |
+
}
|
297 |
+
|
298 |
+
div.wfu_inbase
|
299 |
+
{
|
300 |
+
display: block;
|
301 |
+
position: absolute;
|
302 |
+
left: -1px;
|
303 |
+
top: -1px;
|
304 |
+
}
|
305 |
+
|
306 |
+
div.wfu_component_box:hover
|
307 |
+
{
|
308 |
+
background-color: #eee;
|
309 |
+
border: 1px solid #bbb;
|
310 |
+
}
|
311 |
+
|
312 |
+
div.wfu_component_box_selected
|
313 |
+
{
|
314 |
+
background-color: #aaa;
|
315 |
+
border: 1px solid #bbb;
|
316 |
+
}
|
317 |
+
|
318 |
+
div.wfu_component_box_dragged
|
319 |
+
{
|
320 |
+
-ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=40)";
|
321 |
+
filter: alpha(opacity=40);
|
322 |
+
-moz-opacity: 0.4;
|
323 |
+
-khtml-opacity: 0.4;
|
324 |
+
opacity: 0.4;
|
325 |
+
}
|
326 |
+
|
327 |
+
div.wfu_component_separator_ver
|
328 |
+
{
|
329 |
+
display: inline-block;
|
330 |
+
position: relative;
|
331 |
+
width: 8px;
|
332 |
+
height: 26px;
|
333 |
+
background-color: transparent;
|
334 |
+
border: 1px solid transparent;
|
335 |
+
margin: 6px -8px;
|
336 |
+
padding: 0 8px;
|
337 |
+
cursor: default;
|
338 |
+
z-index: 1;
|
339 |
+
}
|
340 |
+
|
341 |
+
div.wfu_component_separator_hor
|
342 |
+
{
|
343 |
+
display: block;
|
344 |
+
position: relative;
|
345 |
+
width: 100%;
|
346 |
+
height: 8px;
|
347 |
+
background-color: transparent;
|
348 |
+
border: 1px solid transparent;
|
349 |
+
margin: -8px 0;
|
350 |
+
padding: 8px 0;
|
351 |
+
cursor: default;
|
352 |
+
z-index: 1;
|
353 |
+
}
|
354 |
+
|
355 |
+
div.wfu_component_bar_hor
|
356 |
+
{
|
357 |
+
position: absolute;
|
358 |
+
width: auto;
|
359 |
+
height: 4px;
|
360 |
+
left: 10px;
|
361 |
+
right: 0;
|
362 |
+
background-color: silver;
|
363 |
+
border: none;
|
364 |
+
margin: 11px 0 0 0;
|
365 |
+
padding: 0;
|
366 |
+
display: none;
|
367 |
+
}
|
368 |
+
|
369 |
+
div.wfu_component_bar_ver
|
370 |
+
{
|
371 |
+
position: absolute;
|
372 |
+
width: 4px;
|
373 |
+
height: 40px;
|
374 |
+
background-color: silver;
|
375 |
+
border: none;
|
376 |
+
margin: -6px 0 0 11px;
|
377 |
+
padding: 0;
|
378 |
+
display: none;
|
379 |
+
}
|
380 |
+
|
381 |
+
div.wfu_componentlist_dragdrop
|
382 |
+
{
|
383 |
+
position: absolute;
|
384 |
+
width: 100%;
|
385 |
+
height: 100%;
|
386 |
+
left: 0;
|
387 |
+
top: 0;
|
388 |
+
background-color: #f8f8f8;
|
389 |
+
border: 4px dashed #aaa;
|
390 |
+
-webkit-box-sizing: border-box;
|
391 |
+
-moz-box-sizing: border-box;
|
392 |
+
box-sizing: border-box;
|
393 |
+
margin: 0;
|
394 |
+
padding: 0;
|
395 |
+
z-index: 2;
|
396 |
+
-ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=70)";
|
397 |
+
filter: alpha(opacity=70);
|
398 |
+
-moz-opacity: 0.7;
|
399 |
+
-khtml-opacity: 0.7;
|
400 |
+
opacity: 0.7;
|
401 |
+
}
|
402 |
+
|
403 |
+
div.wfu_componentlist_dragdrop_dragover
|
404 |
+
{
|
405 |
+
border: 4px dashed #555;
|
406 |
+
}
|
407 |
+
|
408 |
+
div.wfu_userdata_container
|
409 |
+
{
|
410 |
+
display: block;
|
411 |
+
position: relative;
|
412 |
+
width: 100%;
|
413 |
+
height: 100%;
|
414 |
+
padding: 0;
|
415 |
+
margin: 0;
|
416 |
+
background: none;
|
417 |
+
border: none;
|
418 |
+
}
|
419 |
+
|
420 |
+
div.wfu_userdata_action
|
421 |
+
{
|
422 |
+
display: inline-block;
|
423 |
+
position: relative;
|
424 |
+
top: 2px;
|
425 |
+
width: 16px;
|
426 |
+
height: 16px;
|
427 |
+
padding: 0;
|
428 |
+
margin: 0;
|
429 |
+
background: none;
|
430 |
+
text-align: center;
|
431 |
+
border: 1px solid transparent;
|
432 |
+
-webkit-border-radius: 3px;
|
433 |
+
-moz-border-radius: 3px;
|
434 |
+
-khtml-border-radius: 3px;
|
435 |
+
border-radius: 3px;
|
436 |
+
}
|
437 |
+
|
438 |
+
div.wfu_userdata_action:hover { border: 1px solid #aaa; }
|
439 |
+
|
440 |
+
div.wfu_userdata_action.wfu_userdata_action_disabled:hover { border: 1px solid transparent; }
|
441 |
+
|
442 |
+
div.wfu_userdata_action > img { width: 12px; height: 12px; }
|
443 |
+
|
444 |
+
div.wfu_userdata_action_disabled > img
|
445 |
+
{
|
446 |
+
-ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=40)";
|
447 |
+
filter: alpha(opacity=40);
|
448 |
+
-moz-opacity: 0.4;
|
449 |
+
-khtml-opacity: 0.4;
|
450 |
+
opacity: 0.4;
|
451 |
+
}
|
452 |
+
|
453 |
+
div.wfu_userdata_line
|
454 |
+
{
|
455 |
+
display: block;
|
456 |
+
position: relative;
|
457 |
+
padding: 0;
|
458 |
+
margin: 0;
|
459 |
+
background: none;
|
460 |
+
border: none;
|
461 |
+
white-space: nowrap;
|
462 |
+
}
|
463 |
+
|
464 |
+
/* ColorPicker Styles */
|
465 |
+
div.wfu_color_container
|
466 |
+
{
|
467 |
+
display: block;
|
468 |
+
position: relative;
|
469 |
+
padding: 0;
|
470 |
+
margin: 0;
|
471 |
+
background: none;
|
472 |
+
border: none;
|
473 |
+
white-space: nowrap;
|
474 |
+
z-index: 1;
|
475 |
+
}
|
476 |
+
input[type="text"].wp-color-picker { width: 75px; }
|
477 |
+
input[type="button"].wp-picker-clear { width: 62px; }
|
css/wordpress_file_upload_reset.css
ADDED
@@ -0,0 +1,47 @@
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
1 |
+
/**
|
2 |
+
* Eric Meyer's Reset CSS v2.0 (http://meyerweb.com/eric/tools/css/reset/)
|
3 |
+
* http://cssreset.com
|
4 |
+
*/
|
5 |
+
html, body, div, span, applet, object, iframe,
|
6 |
+
h1, h2, h3, h4, h5, h6, p, blockquote, pre,
|
7 |
+
a, abbr, acronym, address, big, cite, code,
|
8 |
+
del, dfn, em, img, ins, kbd, q, s, samp,
|
9 |
+
small, strike, strong, sub, sup, tt, var,
|
10 |
+
b, u, i, center,
|
11 |
+
dl, dt, dd, ol, ul, li,
|
12 |
+
fieldset, form, label, legend,
|
13 |
+
table, caption, tbody, tfoot, thead, tr, th, td,
|
14 |
+
article, aside, canvas, details, embed,
|
15 |
+
figure, figcaption, footer, header, hgroup,
|
16 |
+
menu, nav, output, ruby, section, summary,
|
17 |
+
time, mark, audio, video {
|
18 |
+
margin: 0;
|
19 |
+
padding: 0;
|
20 |
+
border: 0;
|
21 |
+
font-size: 100%;
|
22 |
+
font: inherit;
|
23 |
+
vertical-align: baseline;
|
24 |
+
}
|
25 |
+
/* HTML5 display-role reset for older browsers */
|
26 |
+
article, aside, details, figcaption, figure,
|
27 |
+
footer, header, hgroup, menu, nav, section {
|
28 |
+
display: block;
|
29 |
+
}
|
30 |
+
body {
|
31 |
+
line-height: 1;
|
32 |
+
}
|
33 |
+
ol, ul {
|
34 |
+
list-style: none;
|
35 |
+
}
|
36 |
+
blockquote, q {
|
37 |
+
quotes: none;
|
38 |
+
}
|
39 |
+
blockquote:before, blockquote:after,
|
40 |
+
q:before, q:after {
|
41 |
+
content: '';
|
42 |
+
content: none;
|
43 |
+
}
|
44 |
+
table {
|
45 |
+
border-collapse: collapse;
|
46 |
+
border-spacing: 0;
|
47 |
+
}
|
css/wordpress_file_upload_style.css
ADDED
@@ -0,0 +1,703 @@
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â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|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
1 |
+
/* File Textbox Styles */
|
2 |
+
input[type="text"].file_input_textbox
|
3 |
+
{
|
4 |
+
position: relative;
|
5 |
+
width: 150px;
|
6 |
+
height: 25px;
|
7 |
+
margin: 0px;
|
8 |
+
padding: 0px;
|
9 |
+
border: 1px solid;
|
10 |
+
border-color: #BBBBBB;
|
11 |
+
background-color: white;
|
12 |
+
color: black;
|
13 |
+
}
|
14 |
+
|
15 |
+
input[type="text"].file_input_textbox:disabled
|
16 |
+
{
|
17 |
+
position: relative;
|
18 |
+
width: 150px;
|
19 |
+
height: 25px;
|
20 |
+
margin: 0px;
|
21 |
+
padding: 0px;
|
22 |
+
border: 1px solid;
|
23 |
+
border-color: #BBBBBB;
|
24 |
+
background-color: white;
|
25 |
+
color: silver;
|
26 |
+
}
|
27 |
+
|
28 |
+
input[type="text"].file_input_textbox_nofile
|
29 |
+
{
|
30 |
+
position: relative;
|
31 |
+
width: 150px;
|
32 |
+
height: 25px;
|
33 |
+
margin: 0px;
|
34 |
+
padding: 0px;
|
35 |
+
border: 1px solid;
|
36 |
+
border-color: #BBBBBB;
|
37 |
+
background-color: red;
|
38 |
+
color: black;
|
39 |
+
}
|
40 |
+
|
41 |
+
/* Upload Form and Button Styles */
|
42 |
+
form.file_input_uploadform
|
43 |
+
{
|
44 |
+
position: relative;
|
45 |
+
width: 100px;
|
46 |
+
height: 27px;
|
47 |
+
overflow: hidden;
|
48 |
+
margin: 0px;
|
49 |
+
padding: 0px;
|
50 |
+
}
|
51 |
+
|
52 |
+
input[type="button"].file_input_button
|
53 |
+
{
|
54 |
+
width: 100px;
|
55 |
+
height: 27px;
|
56 |
+
position: absolute;
|
57 |
+
top: 0px;
|
58 |
+
margin: 0px;
|
59 |
+
padding: 0px;
|
60 |
+
background-color: #EEEEEE;
|
61 |
+
color: #555555;
|
62 |
+
/* background-attachment: scroll; */
|
63 |
+
background-image: url("../images/white-grad-active.png");
|
64 |
+
background-position: left top;
|
65 |
+
background-repeat: repeat-x;
|
66 |
+
border-style: solid;
|
67 |
+
border-width: 1px;
|
68 |
+
border-color: #BBBBBB;
|
69 |
+
-webkit-border-radius: 2px;
|
70 |
+
-moz-border-radius: 2px;
|
71 |
+
-khtml-border-radius: 2px;
|
72 |
+
border-radius: 2px;
|
73 |
+
}
|
74 |
+
|
75 |
+
input[type="button"].file_input_button_hover
|
76 |
+
{
|
77 |
+
width: 100px;
|
78 |
+
height: 27px;
|
79 |
+
position: absolute;
|
80 |
+
top: 0px;
|
81 |
+
margin: 0px;
|
82 |
+
padding: 0px;
|
83 |
+
background-color: #EEEEEE;
|
84 |
+
color: #111111;
|
85 |
+
/* background-attachment: scroll; */
|
86 |
+
background-image: url("../images/white-grad-active.png");
|
87 |
+
background-position: left top;
|
88 |
+
background-repeat: repeat-x;
|
89 |
+
border-style: solid;
|
90 |
+
border-width: 1px;
|
91 |
+
border-color: #333333;
|
92 |
+
-webkit-border-radius: 2px;
|
93 |
+
-moz-border-radius: 2px;
|
94 |
+
-khtml-border-radius: 2px;
|
95 |
+
border-radius: 2px;
|
96 |
+
}
|
97 |
+
|
98 |
+
input[type="button"].file_input_button:disabled, input[type="button"].file_input_button_hover:disabled
|
99 |
+
{
|
100 |
+
width: 100px;
|
101 |
+
height: 27px;
|
102 |
+
position: absolute;
|
103 |
+
top: 0px;
|
104 |
+
margin: 0px;
|
105 |
+
padding: 0px;
|
106 |
+
background-color: #EEEEEE;
|
107 |
+
color: silver;
|
108 |
+
/* background-attachment: scroll; */
|
109 |
+
background-image: url("../images/white-grad-active.png");
|
110 |
+
background-position: left top;
|
111 |
+
background-repeat: repeat-x;
|
112 |
+
border-style: solid;
|
113 |
+
border-width: 1px;
|
114 |
+
border-color: #BBBBBB;
|
115 |
+
-webkit-border-radius: 2px;
|
116 |
+
-moz-border-radius: 2px;
|
117 |
+
-khtml-border-radius: 2px;
|
118 |
+
border-radius: 2px;
|
119 |
+
}
|
120 |
+
|
121 |
+
input[type="button"].file_input_submit
|
122 |
+
{
|
123 |
+
width: 100px;
|
124 |
+
height: 27px;
|
125 |
+
position: relative;
|
126 |
+
margin: 0px;
|
127 |
+
padding: 0px;
|
128 |
+
background-color: #EEEEEE;
|
129 |
+
color: #555555;
|
130 |
+
/* background-attachment: scroll; */
|
131 |
+
background-image: url("../images/white-grad-active.png");
|
132 |
+
background-position: left top;
|
133 |
+
background-repeat: repeat-x;
|
134 |
+
border-style: solid;
|
135 |
+
border-width: 1px;
|
136 |
+
border-color: #BBBBBB;
|
137 |
+
-webkit-border-radius: 2px;
|
138 |
+
-moz-border-radius: 2px;
|
139 |
+
-khtml-border-radius: 2px;
|
140 |
+
border-radius: 2px;
|
141 |
+
}
|
142 |
+
|
143 |
+
input[type="button"].file_input_submit:hover, input[type="button"].file_input_submit:focus
|
144 |
+
{
|
145 |
+
width: 100px;
|
146 |
+
height: 27px;
|
147 |
+
position: relative;
|
148 |
+
margin: 0px;
|
149 |
+
padding: 0px;
|
150 |
+
background-color: #EEEEEE;
|
151 |
+
color: #111111;
|
152 |
+
/* background-attachment: scroll; */
|
153 |
+
background-image: url("../images/white-grad-active.png");
|
154 |
+
background-position: left top;
|
155 |
+
background-repeat: repeat-x;
|
156 |
+
border-style: solid;
|
157 |
+
border-width: 1px;
|
158 |
+
border-color: #333333;
|
159 |
+
-webkit-border-radius: 2px;
|
160 |
+
-moz-border-radius: 2px;
|
161 |
+
-khtml-border-radius: 2px;
|
162 |
+
border-radius: 2px;
|
163 |
+
}
|
164 |
+
|
165 |
+
input[type="button"].file_input_submit:disabled
|
166 |
+
{
|
167 |
+
width: 100px;
|
168 |
+
height: 27px;
|
169 |
+
position: relative;
|
170 |
+
margin: 0px;
|
171 |
+
padding: 0px;
|
172 |
+
background-color: #EEEEEE;
|
173 |
+
color: silver;
|
174 |
+
/* background-attachment: scroll; */
|
175 |
+
background-image: url("../images/white-grad-active.png");
|
176 |
+
background-position: left top;
|
177 |
+
background-repeat: repeat-x;
|
178 |
+
border-style: solid;
|
179 |
+
border-width: 1px;
|
180 |
+
border-color: #BBBBBB;
|
181 |
+
-webkit-border-radius: 2px;
|
182 |
+
-moz-border-radius: 2px;
|
183 |
+
-khtml-border-radius: 2px;
|
184 |
+
border-radius: 2px;
|
185 |
+
}
|
186 |
+
|
187 |
+
input[type="file"].file_input_hidden
|
188 |
+
{
|
189 |
+
font-size: 45px;
|
190 |
+
position: absolute;
|
191 |
+
right: 0px;
|
192 |
+
top: 0px;
|
193 |
+
margin: 0px;
|
194 |
+
padding: 0px;
|
195 |
+
-ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=0)";
|
196 |
+
filter: alpha(opacity=0);
|
197 |
+
-moz-opacity: 0;
|
198 |
+
-khtml-opacity: 0;
|
199 |
+
opacity: 0;
|
200 |
+
}
|
201 |
+
|
202 |
+
/* Simple Progressbar Styles */
|
203 |
+
div.file_progress_bar
|
204 |
+
{
|
205 |
+
display: block;
|
206 |
+
position: relative;
|
207 |
+
width: auto;
|
208 |
+
border: 1px solid #333333;
|
209 |
+
margin: 0;
|
210 |
+
padding: 4px;
|
211 |
+
}
|
212 |
+
|
213 |
+
div.file_progress_inner
|
214 |
+
{
|
215 |
+
display: block;
|
216 |
+
width: 100%;
|
217 |
+
height: 6px;
|
218 |
+
margin: 0;
|
219 |
+
padding: 0;
|
220 |
+
border: 1px solid silver;
|
221 |
+
background-color: white;
|
222 |
+
}
|
223 |
+
|
224 |
+
img.file_progress_imagesafe
|
225 |
+
{
|
226 |
+
width: 100%;
|
227 |
+
height: 6px;
|
228 |
+
}
|
229 |
+
|
230 |
+
span.file_progress_noanimation
|
231 |
+
{
|
232 |
+
display: block;
|
233 |
+
width: 0%;
|
234 |
+
height: 6px;
|
235 |
+
margin: 0;
|
236 |
+
padding: 0;
|
237 |
+
border-style: none;
|
238 |
+
background-color: rgb(43,194,83);
|
239 |
+
position: relative;
|
240 |
+
overflow: hidden;
|
241 |
+
}
|
242 |
+
|
243 |
+
span.file_progress_progressive
|
244 |
+
{
|
245 |
+
display: block;
|
246 |
+
width: auto;
|
247 |
+
height: 6px;
|
248 |
+
margin: 0;
|
249 |
+
padding: 0;
|
250 |
+
border-style: none;
|
251 |
+
background-color: rgb(43,194,83);
|
252 |
+
position: relative;
|
253 |
+
overflow: hidden;
|
254 |
+
}
|
255 |
+
|
256 |
+
span.file_progress_shuffle
|
257 |
+
{
|
258 |
+
display: block;
|
259 |
+
width: 25%;
|
260 |
+
height: 6px;
|
261 |
+
margin: 0;
|
262 |
+
padding: 0;
|
263 |
+
border-style: none;
|
264 |
+
background-color: rgb(43,194,83);
|
265 |
+
position: relative;
|
266 |
+
-webkit-animation: shuffle 1s linear infinite alternate;
|
267 |
+
-moz-animation: shuffle 1s linear infinite alternate;
|
268 |
+
-o-animation: shuffle 1s linear infinite alternate;
|
269 |
+
animation: shuffle 1s linear infinite alternate;
|
270 |
+
overflow: hidden;
|
271 |
+
}
|
272 |
+
|
273 |
+
span.file_progress_progressive:after
|
274 |
+
{
|
275 |
+
content: "";
|
276 |
+
position: absolute;
|
277 |
+
top: 0;
|
278 |
+
left: 0;
|
279 |
+
bottom: 0;
|
280 |
+
right: 0;
|
281 |
+
background-image: -webkit-gradient(linear, 0 0, 100% 100%, color-stop(.25, rgba(255, 255, 255, .2)), color-stop(.25, transparent), color-stop(.5, transparent), color-stop(.5, rgba(255, 255, 255, .2)), color-stop(.75, rgba(255, 255, 255, .2)), color-stop(.75, transparent), to(transparent) );
|
282 |
+
background-image: -moz-linear-gradient( -45deg, rgba(255, 255, 255, .2) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, .2) 50%, rgba(255, 255, 255, .2) 75%, transparent 75%, transparent );
|
283 |
+
z-index: 1;
|
284 |
+
-webkit-background-size: 30px 30px;
|
285 |
+
-moz-background-size: 30px 30px;
|
286 |
+
background-size: 30px 30px;
|
287 |
+
-webkit-animation: lengthen 2s linear infinite;
|
288 |
+
-moz-animation: lengthen 2s linear infinite;
|
289 |
+
-o-animation: lengthen 2s linear infinite;
|
290 |
+
animation: lengthen 2s linear infinite;
|
291 |
+
overflow: hidden;
|
292 |
+
}
|
293 |
+
|
294 |
+
@-webkit-keyframes shuffle { from { left: 0%; } to { left: 75%; } }
|
295 |
+
|
296 |
+
@-moz-keyframes shuffle { from { left: 0%; } to { left: 75%; } }
|
297 |
+
|
298 |
+
@-o-keyframes shuffle { from { left: 0%; } to { left: 75%; } }
|
299 |
+
|
300 |
+
@keyframes shuffle { from { left: 0%; } to { left: 75%; } }
|
301 |
+
|
302 |
+
@-webkit-keyframes lengthen { from { background-position: 0 0; } to { background-position: 30px 30px; } }
|
303 |
+
|
304 |
+
@-moz-keyframes lengthen { from { background-position: 0 0; } to { background-position: 30px 30px; } }
|
305 |
+
|
306 |
+
@-o-keyframes lengthen { from { background-position: 0 0; } to { background-position: 30px 30px; } }
|
307 |
+
|
308 |
+
@keyframes lengthen { from { background-position: 0 0; } to { background-position: 30px 30px; } }
|
309 |
+
|
310 |
+
/* SImple Message Styles */
|
311 |
+
span.file_messagebox_inner
|
312 |
+
{
|
313 |
+
display: block;
|
314 |
+
width: 340px;
|
315 |
+
margin: 0px;
|
316 |
+
font-size: small;
|
317 |
+
padding: 10px;
|
318 |
+
border-style: solid;
|
319 |
+
border-width: 1px;
|
320 |
+
border-color: #D3D3D3;
|
321 |
+
background-color: #F5F5F5;
|
322 |
+
color: black;
|
323 |
+
line-height: 1.2;
|
324 |
+
}
|
325 |
+
|
326 |
+
/* General Styles */
|
327 |
+
div.file_div_clean
|
328 |
+
{
|
329 |
+
display: table;
|
330 |
+
position: relative;
|
331 |
+
margin: 0px;
|
332 |
+
padding: 0px;
|
333 |
+
border-style: none;
|
334 |
+
background: none;
|
335 |
+
color: black;
|
336 |
+
line-height: 1;
|
337 |
+
}
|
338 |
+
|
339 |
+
div.file_space_clean
|
340 |
+
{
|
341 |
+
display: block;
|
342 |
+
margin: 0 0 2px 0;
|
343 |
+
padding: 0px;
|
344 |
+
border-style: none;
|
345 |
+
background: none;
|
346 |
+
color: black;
|
347 |
+
}
|
348 |
+
|
349 |
+
table.file_table_clean
|
350 |
+
{
|
351 |
+
margin: 0px;
|
352 |
+
padding: 0px;
|
353 |
+
border: none;
|
354 |
+
border-spacing: 0px;
|
355 |
+
background: none;
|
356 |
+
color: black;
|
357 |
+
width: auto;
|
358 |
+
}
|
359 |
+
|
360 |
+
td.file_td_clean
|
361 |
+
{
|
362 |
+
margin: 0px;
|
363 |
+
padding: 0px;
|
364 |
+
border: none;
|
365 |
+
border-spacing: 0px;
|
366 |
+
background: none;
|
367 |
+
color: black;
|
368 |
+
vertical-align: middle;
|
369 |
+
}
|
370 |
+
|
371 |
+
span.file_item_clean
|
372 |
+
{
|
373 |
+
margin: 0px;
|
374 |
+
padding: 0px;
|
375 |
+
border-style: none;
|
376 |
+
background: none;
|
377 |
+
color: black;
|
378 |
+
}
|
379 |
+
|
380 |
+
select.file_item_clean
|
381 |
+
{
|
382 |
+
margin: 0px;
|
383 |
+
padding: 0px;
|
384 |
+
height: 25px;
|
385 |
+
border-style: none;
|
386 |
+
background: none;
|
387 |
+
color: black;
|
388 |
+
}
|
389 |
+
|
390 |
+
select.file_item_clean:disabled
|
391 |
+
{
|
392 |
+
margin: 0px;
|
393 |
+
padding: 0px;
|
394 |
+
height: 25px;
|
395 |
+
border-style: none;
|
396 |
+
background: none;
|
397 |
+
color: silver;
|
398 |
+
}
|
399 |
+
|
400 |
+
span.file_title_clean
|
401 |
+
{
|
402 |
+
margin: 0px;
|
403 |
+
padding: 0px;
|
404 |
+
border-style: none;
|
405 |
+
background: none;
|
406 |
+
color: black;
|
407 |
+
}
|
408 |
+
|
409 |
+
/* Userdata styles */
|
410 |
+
div.file_userdata_container
|
411 |
+
{
|
412 |
+
margin: 0;
|
413 |
+
padding: 0;
|
414 |
+
white-space: nowrap;
|
415 |
+
}
|
416 |
+
|
417 |
+
label.file_userdata_label
|
418 |
+
{
|
419 |
+
margin: 0;
|
420 |
+
width: 40%;
|
421 |
+
}
|
422 |
+
|
423 |
+
input[type="text"].file_userdata_message, input[type="text"].file_userdata_message_required
|
424 |
+
{
|
425 |
+
width: 60% !important;
|
426 |
+
height: 25px;
|
427 |
+
margin: 0px;
|
428 |
+
padding: 0px;
|
429 |
+
border: 1px solid;
|
430 |
+
border-color: #BBBBBB;
|
431 |
+
background: none;
|
432 |
+
color: black;
|
433 |
+
}
|
434 |
+
|
435 |
+
input[type="text"].file_userdata_message:disabled, input[type="text"].file_userdata_message_required:disabled
|
436 |
+
{
|
437 |
+
width: 60% !important;
|
438 |
+
height: 25px;
|
439 |
+
margin: 0px;
|
440 |
+
padding: 0px;
|
441 |
+
border: 1px solid;
|
442 |
+
border-color: #BBBBBB;
|
443 |
+
background: none;
|
444 |
+
color: silver;
|
445 |
+
}
|
446 |
+
|
447 |
+
input[type="text"].file_userdata_message_required_empty
|
448 |
+
{
|
449 |
+
width: 60% !important;
|
450 |
+
height: 25px;
|
451 |
+
margin: 0px;
|
452 |
+
padding: 0px;
|
453 |
+
border: 1px solid;
|
454 |
+
border-color: #BBBBBB;
|
455 |
+
background-color: red;
|
456 |
+
color: black;
|
457 |
+
}
|
458 |
+
|
459 |
+
/* Message Block Styles */
|
460 |
+
table.file_messageblock_table
|
461 |
+
{
|
462 |
+
margin: 0;
|
463 |
+
padding: 0;
|
464 |
+
border: none;
|
465 |
+
}
|
466 |
+
|
467 |
+
tr.file_messageblock_header_tr
|
468 |
+
{
|
469 |
+
}
|
470 |
+
|
471 |
+
td.file_messageblock_header_td
|
472 |
+
{
|
473 |
+
border: 1px solid #dddddd;
|
474 |
+
margin: 0;
|
475 |
+
padding: 0;
|
476 |
+
}
|
477 |
+
|
478 |
+
div.file_messageblock_header
|
479 |
+
{
|
480 |
+
margin: 0;
|
481 |
+
padding: 2px;
|
482 |
+
}
|
483 |
+
|
484 |
+
label.file_messageblock_header_label
|
485 |
+
{
|
486 |
+
font-weight: bold;
|
487 |
+
font-size: 12px;
|
488 |
+
line-height: 1;
|
489 |
+
}
|
490 |
+
|
491 |
+
td.file_messageblock_arrow_td
|
492 |
+
{
|
493 |
+
border: 1px solid #dddddd;
|
494 |
+
margin: 0;
|
495 |
+
padding: 0;
|
496 |
+
width: 20px;
|
497 |
+
vertical-align: middle;
|
498 |
+
}
|
499 |
+
|
500 |
+
div.file_messageblock_header_arrow_up
|
501 |
+
{
|
502 |
+
width: 0;
|
503 |
+
height: 0;
|
504 |
+
border-left: 5px solid transparent;
|
505 |
+
border-right: 5px solid transparent;
|
506 |
+
border-bottom: 5px solid #555555;
|
507 |
+
margin: 5px 1px 1px 5px;
|
508 |
+
/* ie6 height fix */
|
509 |
+
font-size: 0;
|
510 |
+
line-height: 0;
|
511 |
+
/* ie6 transparent fix */
|
512 |
+
_border-right-color: pink;
|
513 |
+
_border-left-color: pink;
|
514 |
+
_filter: chroma(color=pink);
|
515 |
+
}
|
516 |
+
|
517 |
+
div.file_messageblock_header_arrow_down
|
518 |
+
{
|
519 |
+
width: 0;
|
520 |
+
height: 0;
|
521 |
+
border-left: 5px solid transparent;
|
522 |
+
border-right: 5px solid transparent;
|
523 |
+
border-top: 5px solid #555555;
|
524 |
+
margin: 5px 1px 1px 5px;
|
525 |
+
/* ie6 height fix */
|
526 |
+
font-size: 0;
|
527 |
+
line-height: 0;
|
528 |
+
/* ie6 transparent fix */
|
529 |
+
_border-right-color: pink;
|
530 |
+
_border-left-color: pink;
|
531 |
+
_filter: chroma(color=pink);
|
532 |
+
}
|
533 |
+
|
534 |
+
tr.file_messageblock_subheader_tr
|
535 |
+
{
|
536 |
+
}
|
537 |
+
|
538 |
+
td.file_messageblock_subheader_td
|
539 |
+
{
|
540 |
+
margin: 0;
|
541 |
+
padding: 0;
|
542 |
+
border: 1px solid #dddddd;
|
543 |
+
}
|
544 |
+
|
545 |
+
div.file_messageblock_subheader_message
|
546 |
+
{
|
547 |
+
margin: 0;
|
548 |
+
padding: 2px;
|
549 |
+
background: none;
|
550 |
+
}
|
551 |
+
|
552 |
+
label.file_messageblock_subheader_messagelabel
|
553 |
+
{
|
554 |
+
font-weight: normal;
|
555 |
+
font-size: 12px;
|
556 |
+
line-height: 1;
|
557 |
+
}
|
558 |
+
|
559 |
+
div.file_messageblock_subheader_adminmessage
|
560 |
+
{
|
561 |
+
margin: 0;
|
562 |
+
padding: 2px;
|
563 |
+
background-color: #F7F7F7;
|
564 |
+
}
|
565 |
+
|
566 |
+
label.file_messageblock_subheader_adminmessagelabel
|
567 |
+
{
|
568 |
+
font-weight: normal;
|
569 |
+
font-size: 12px;
|
570 |
+
font-style: italic;
|
571 |
+
line-height: 1;
|
572 |
+
}
|
573 |
+
|
574 |
+
tr.file_messageblock_fileheader_tr
|
575 |
+
{
|
576 |
+
}
|
577 |
+
|
578 |
+
td.file_messageblock_filenumber_td
|
579 |
+
{
|
580 |
+
width: 30px;
|
581 |
+
margin: 0;
|
582 |
+
padding: 2px;
|
583 |
+
text-align: center;
|
584 |
+
vertical-align: middle;
|
585 |
+
font-weight: bold;
|
586 |
+
font-size: 11px;
|
587 |
+
line-height: 1;
|
588 |
+
border: 1px solid #dddddd;
|
589 |
+
}
|
590 |
+
|
591 |
+
td.file_messageblock_fileheader_td
|
592 |
+
{
|
593 |
+
margin: 0;
|
594 |
+
padding: 0;
|
595 |
+
border: 1px solid #dddddd;
|
596 |
+
}
|
597 |
+
|
598 |
+
div.file_messageblock_fileheader
|
599 |
+
{
|
600 |
+
margin: 0;
|
601 |
+
padding: 2px;
|
602 |
+
}
|
603 |
+
|
604 |
+
label.file_messageblock_fileheader_label
|
605 |
+
{
|
606 |
+
font-weight: bold;
|
607 |
+
font-size: 11px;
|
608 |
+
line-height: 1;
|
609 |
+
}
|
610 |
+
|
611 |
+
td.file_messageblock_filearrow_td
|
612 |
+
{
|
613 |
+
border: 1px solid #dddddd;
|
614 |
+
margin: 0;
|
615 |
+
padding: 0;
|
616 |
+
width: 20px;
|
617 |
+
border: 1px solid #dddddd;
|
618 |
+
vertical-align: middle;
|
619 |
+
}
|
620 |
+
|
621 |
+
div.file_messageblock_file_arrow_up
|
622 |
+
{
|
623 |
+
width: 0;
|
624 |
+
height: 0;
|
625 |
+
border-left: 4px solid transparent;
|
626 |
+
border-right: 4px solid transparent;
|
627 |
+
border-bottom: 4px solid #555555;
|
628 |
+
margin: 5px 1px 1px 6px;
|
629 |
+
/* ie6 height fix */
|
630 |
+
font-size: 0;
|
631 |
+
line-height: 0;
|
632 |
+
/* ie6 transparent fix */
|
633 |
+
_border-right-color: pink;
|
634 |
+
_border-left-color: pink;
|
635 |
+
_filter: chroma(color=pink);
|
636 |
+
}
|
637 |
+
|
638 |
+
div.file_messageblock_file_arrow_down
|
639 |
+
{
|
640 |
+
width: 0;
|
641 |
+
height: 0;
|
642 |
+
border-left: 4px solid transparent;
|
643 |
+
border-right: 4px solid transparent;
|
644 |
+
border-top: 4px solid #555555;
|
645 |
+
margin: 5px 1px 1px 6px;
|
646 |
+
/* ie6 height fix */
|
647 |
+
font-size: 0;
|
648 |
+
line-height: 0;
|
649 |
+
/* ie6 transparent fix */
|
650 |
+
_border-right-color: pink;
|
651 |
+
_border-left-color: pink;
|
652 |
+
_filter: chroma(color=pink);
|
653 |
+
}
|
654 |
+
|
655 |
+
tr.file_messageblock_filesubheader_tr
|
656 |
+
{
|
657 |
+
}
|
658 |
+
|
659 |
+
td.file_messageblock_filesubheaderempty_td
|
660 |
+
{
|
661 |
+
width: 30px;
|
662 |
+
margin: 0;
|
663 |
+
padding: 0;
|
664 |
+
border: 1px solid #dddddd;
|
665 |
+
}
|
666 |
+
|
667 |
+
td.file_messageblock_filesubheader_td
|
668 |
+
{
|
669 |
+
margin: 0;
|
670 |
+
padding: 0;
|
671 |
+
border: 1px solid #dddddd;
|
672 |
+
}
|
673 |
+
|
674 |
+
div.file_messageblock_filesubheader_message
|
675 |
+
{
|
676 |
+
margin: 0;
|
677 |
+
padding: 2px;
|
678 |
+
background: none;
|
679 |
+
}
|
680 |
+
|
681 |
+
label.file_messageblock_filesubheader_messagelabel
|
682 |
+
{
|
683 |
+
font-weight: normal;
|
684 |
+
font-size: 11px;
|
685 |
+
line-height: 1;
|
686 |
+
}
|
687 |
+
|
688 |
+
div.file_messageblock_filesubheader_adminmessage
|
689 |
+
{
|
690 |
+
margin: 0;
|
691 |
+
padding: 2px;
|
692 |
+
background-color: #F7F7F7;
|
693 |
+
}
|
694 |
+
|
695 |
+
label.file_messageblock_filesubheader_adminmessagelabel
|
696 |
+
{
|
697 |
+
font-weight: normal;
|
698 |
+
font-size: 11px;
|
699 |
+
font-style: italic;
|
700 |
+
line-height: 1;
|
701 |
+
}
|
702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
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
1 |
+
/* File Textbox Styles */
|
2 |
+
input.file_input_textbox
|
3 |
+
{
|
4 |
+
position: relative;
|
5 |
+
width: 150px;
|
6 |
+
height: 25px;
|
7 |
+
margin: 0px;
|
8 |
+
padding: 0px;
|
9 |
+
border: 1px solid;
|
10 |
+
border-color: #BBBBBB;
|
11 |
+
background-color: white;
|
12 |
+
color: black;
|
13 |
+
}
|
14 |
+
|
15 |
+
input.file_input_textbox:disabled
|
16 |
+
{
|
17 |
+
position: relative;
|
18 |
+
width: 150px;
|
19 |
+
height: 25px;
|
20 |
+
margin: 0px;
|
21 |
+
padding: 0px;
|
22 |
+
border: 1px solid;
|
23 |
+
border-color: #BBBBBB;
|
24 |
+
background-color: white;
|
25 |
+
color: silver;
|
26 |
+
}
|
27 |
+
|
28 |
+
input.file_input_textbox_nofile
|
29 |
+
{
|
30 |
+
position: relative;
|
31 |
+
width: 150px;
|
32 |
+
height: 25px;
|
33 |
+
margin: 0px;
|
34 |
+
padding: 0px;
|
35 |
+
border: 1px solid;
|
36 |
+
border-color: #BBBBBB;
|
37 |
+
background-color: red;
|
38 |
+
color: black;
|
39 |
+
}
|
40 |
+
|
41 |
+
/* Upload Form and Button Styles */
|
42 |
+
input.file_input_button
|
43 |
+
{
|
44 |
+
width: 100px;
|
45 |
+
height: 27px;
|
46 |
+
position: absolute;
|
47 |
+
top: 0px;
|
48 |
+
margin: 0px;
|
49 |
+
padding: 0px;
|
50 |
+
background-color: #EEEEEE;
|
51 |
+
color: #555555;
|
52 |
+
/* background-attachment: scroll; */
|
53 |
+
background-image: url("../images/white-grad-active.png");
|
54 |
+
background-position: left top;
|
55 |
+
background-repeat: repeat-x;
|
56 |
+
border-style: solid;
|
57 |
+
border-width: 1px;
|
58 |
+
border-color: #BBBBBB;
|
59 |
+
-webkit-border-radius: 2px;
|
60 |
+
-moz-border-radius: 2px;
|
61 |
+
-khtml-border-radius: 2px;
|
62 |
+
border-radius: 2px;
|
63 |
+
}
|
64 |
+
|
65 |
+
input.file_input_button_hover
|
66 |
+
{
|
67 |
+
width: 100px;
|
68 |
+
height: 27px;
|
69 |
+
position: absolute;
|
70 |
+
top: 0px;
|
71 |
+
margin: 0px;
|
72 |
+
padding: 0px;
|
73 |
+
background-color: #EEEEEE;
|
74 |
+
color: #111111;
|
75 |
+
/* background-attachment: scroll; */
|
76 |
+
background-image: url("../images/white-grad-active.png");
|
77 |
+
background-position: left top;
|
78 |
+
background-repeat: repeat-x;
|
79 |
+
border-style: solid;
|
80 |
+
border-width: 1px;
|
81 |
+
border-color: #333333;
|
82 |
+
-webkit-border-radius: 2px;
|
83 |
+
-moz-border-radius: 2px;
|
84 |
+
-khtml-border-radius: 2px;
|
85 |
+
border-radius: 2px;
|
86 |
+
}
|
87 |
+
|
88 |
+
input.file_input_button:disabled, input.file_input_button_hover:disabled
|
89 |
+
{
|
90 |
+
width: 100px;
|
91 |
+
height: 27px;
|
92 |
+
position: absolute;
|
93 |
+
top: 0px;
|
94 |
+
margin: 0px;
|
95 |
+
padding: 0px;
|
96 |
+
background-color: #EEEEEE;
|
97 |
+
color: silver;
|
98 |
+
/* background-attachment: scroll; */
|
99 |
+
background-image: url("../images/white-grad-active.png");
|
100 |
+
background-position: left top;
|
101 |
+
background-repeat: repeat-x;
|
102 |
+
border-style: solid;
|
103 |
+
border-width: 1px;
|
104 |
+
border-color: #BBBBBB;
|
105 |
+
-webkit-border-radius: 2px;
|
106 |
+
-moz-border-radius: 2px;
|
107 |
+
-khtml-border-radius: 2px;
|
108 |
+
border-radius: 2px;
|
109 |
+
}
|
110 |
+
|
111 |
+
input.file_input_submit
|
112 |
+
{
|
113 |
+
width: 100px;
|
114 |
+
height: 27px;
|
115 |
+
position: relative;
|
116 |
+
margin: 0px;
|
117 |
+
padding: 0px;
|
118 |
+
background-color: #EEEEEE;
|
119 |
+
color: #555555;
|
120 |
+
/* background-attachment: scroll; */
|
121 |
+
background-image: url("../images/white-grad-active.png");
|
122 |
+
background-position: left top;
|
123 |
+
background-repeat: repeat-x;
|
124 |
+
border-style: solid;
|
125 |
+
border-width: 1px;
|
126 |
+
border-color: #BBBBBB;
|
127 |
+
-webkit-border-radius: 2px;
|
128 |
+
-moz-border-radius: 2px;
|
129 |
+
-khtml-border-radius: 2px;
|
130 |
+
border-radius: 2px;
|
131 |
+
}
|
132 |
+
|
133 |
+
input.file_input_submit:hover, input.file_input_submit:focus
|
134 |
+
{
|
135 |
+
width: 100px;
|
136 |
+
height: 27px;
|
137 |
+
position: relative;
|
138 |
+
margin: 0px;
|
139 |
+
padding: 0px;
|
140 |
+
background-color: #EEEEEE;
|
141 |
+
color: #111111;
|
142 |
+
/* background-attachment: scroll; */
|
143 |
+
background-image: url("../images/white-grad-active.png");
|
144 |
+
background-position: left top;
|
145 |
+
background-repeat: repeat-x;
|
146 |
+
border-style: solid;
|
147 |
+
border-width: 1px;
|
148 |
+
border-color: #333333;
|
149 |
+
-webkit-border-radius: 2px;
|
150 |
+
-moz-border-radius: 2px;
|
151 |
+
-khtml-border-radius: 2px;
|
152 |
+
border-radius: 2px;
|
153 |
+
}
|
154 |
+
|
155 |
+
input.file_input_submit:disabled
|
156 |
+
{
|
157 |
+
width: 100px;
|
158 |
+
height: 27px;
|
159 |
+
position: relative;
|
160 |
+
margin: 0px;
|
161 |
+
padding: 0px;
|
162 |
+
background-color: #EEEEEE;
|
163 |
+
color: silver;
|
164 |
+
/* background-attachment: scroll; */
|
165 |
+
background-image: url("../images/white-grad-active.png");
|
166 |
+
background-position: left top;
|
167 |
+
background-repeat: repeat-x;
|
168 |
+
border-style: solid;
|
169 |
+
border-width: 1px;
|
170 |
+
border-color: #BBBBBB;
|
171 |
+
-webkit-border-radius: 2px;
|
172 |
+
-moz-border-radius: 2px;
|
173 |
+
-khtml-border-radius: 2px;
|
174 |
+
border-radius: 2px;
|
175 |
+
}
|
176 |
+
|
177 |
+
input.file_input_hidden
|
178 |
+
{
|
179 |
+
font-size: 45px;
|
180 |
+
position: absolute;
|
181 |
+
right: 0px;
|
182 |
+
top: 0px;
|
183 |
+
margin: 0px;
|
184 |
+
padding: 0px;
|
185 |
+
-ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=0)";
|
186 |
+
filter: alpha(opacity=0);
|
187 |
+
-moz-opacity: 0;
|
188 |
+
-khtml-opacity: 0;
|
189 |
+
opacity: 0;
|
190 |
+
}
|
191 |
+
|
192 |
+
/* Userdata styles */
|
193 |
+
input.file_userdata_message, input.file_userdata_message_required
|
194 |
+
{
|
195 |
+
width: 60% !important;
|
196 |
+
height: 25px;
|
197 |
+
margin: 0px;
|
198 |
+
padding: 0px;
|
199 |
+
border: 1px solid;
|
200 |
+
border-color: #BBBBBB;
|
201 |
+
background: none;
|
202 |
+
color: black;
|
203 |
+
}
|
204 |
+
|
205 |
+
input.file_userdata_message:disabled, input.file_userdata_message_required:disabled
|
206 |
+
{
|
207 |
+
width: 60% !important;
|
208 |
+
height: 25px;
|
209 |
+
margin: 0px;
|
210 |
+
padding: 0px;
|
211 |
+
border: 1px solid;
|
212 |
+
border-color: #BBBBBB;
|
213 |
+
background: none;
|
214 |
+
color: silver;
|
215 |
+
}
|
216 |
+
|
217 |
+
input.file_userdata_message_required_empty
|
218 |
+
{
|
219 |
+
width: 60% !important;
|
220 |
+
height: 25px;
|
221 |
+
margin: 0px;
|
222 |
+
padding: 0px;
|
223 |
+
border: 1px solid;
|
224 |
+
border-color: #BBBBBB;
|
225 |
+
background-color: red;
|
226 |
+
color: black;
|
227 |
+
}
|
228 |
+
|
229 |
+
|
images/add_12.png
ADDED
Binary file
|
images/add_16.png
ADDED
Binary file
|
images/draw-delete.png
ADDED
Binary file
|
images/help_16.png
ADDED
Binary file
|
images/progbar.gif
ADDED
Binary file
|
images/refresh_16.gif
ADDED
Binary file
|
images/remove_12.png
ADDED
Binary file
|
images/remove_16.png
ADDED
Binary file
|
images/white-grad-active.png
ADDED
Binary file
|
js/getElementsByClassName-1.0.1.js
ADDED
@@ -0,0 +1,78 @@
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
1 |
+
/*
|
2 |
+
Developed by Robert Nyman, http://www.robertnyman.com
|
3 |
+
Code/licensing: http://code.google.com/p/getelementsbyclassname/
|
4 |
+
*/
|
5 |
+
var getElementsByClassName = function (className, tag, elm){
|
6 |
+
if (document.getElementsByClassName) {
|
7 |
+
getElementsByClassName = function (className, tag, elm) {
|
8 |
+
elm = elm || document;
|
9 |
+
var elements = elm.getElementsByClassName(className),
|
10 |
+
nodeName = (tag)? new RegExp("\\b" + tag + "\\b", "i") : null,
|
11 |
+
returnElements = [],
|
12 |
+
current;
|
13 |
+
for(var i=0, il=elements.length; i<il; i+=1){
|
14 |
+
current = elements[i];
|
15 |
+
if(!nodeName || nodeName.test(current.nodeName)) {
|
16 |
+
returnElements.push(current);
|
17 |
+
}
|
18 |
+
}
|
19 |
+
return returnElements;
|
20 |
+
};
|
21 |
+
}
|
22 |
+
else if (document.evaluate) {
|
23 |
+
getElementsByClassName = function (className, tag, elm) {
|
24 |
+
tag = tag || "*";
|
25 |
+
elm = elm || document;
|
26 |
+
var classes = className.split(" "),
|
27 |
+
classesToCheck = "",
|
28 |
+
xhtmlNamespace = "http://www.w3.org/1999/xhtml",
|
29 |
+
namespaceResolver = (document.documentElement.namespaceURI === xhtmlNamespace)? xhtmlNamespace : null,
|
30 |
+
returnElements = [],
|
31 |
+
elements,
|
32 |
+
node;
|
33 |
+
for(var j=0, jl=classes.length; j<jl; j+=1){
|
34 |
+
classesToCheck += "[contains(concat(' ', @class, ' '), ' " + classes[j] + " ')]";
|
35 |
+
}
|
36 |
+
try {
|
37 |
+
elements = document.evaluate(".//" + tag + classesToCheck, elm, namespaceResolver, 0, null);
|
38 |
+
}
|
39 |
+
catch (e) {
|
40 |
+
elements = document.evaluate(".//" + tag + classesToCheck, elm, null, 0, null);
|
41 |
+
}
|
42 |
+
while ((node = elements.iterateNext())) {
|
43 |
+
returnElements.push(node);
|
44 |
+
}
|
45 |
+
return returnElements;
|
46 |
+
};
|
47 |
+
}
|
48 |
+
else {
|
49 |
+
getElementsByClassName = function (className, tag, elm) {
|
50 |
+
tag = tag || "*";
|
51 |
+
elm = elm || document;
|
52 |
+
var classes = className.split(" "),
|
53 |
+
classesToCheck = [],
|
54 |
+
elements = (tag === "*" && elm.all)? elm.all : elm.getElementsByTagName(tag),
|
55 |
+
current,
|
56 |
+
returnElements = [],
|
57 |
+
match;
|
58 |
+
for(var k=0, kl=classes.length; k<kl; k+=1){
|
59 |
+
classesToCheck.push(new RegExp("(^|\\s)" + classes[k] + "(\\s|$)"));
|
60 |
+
}
|
61 |
+
for(var l=0, ll=elements.length; l<ll; l+=1){
|
62 |
+
current = elements[l];
|
63 |
+
match = false;
|
64 |
+
for(var m=0, ml=classesToCheck.length; m<ml; m+=1){
|
65 |
+
match = classesToCheck[m].test(current.className);
|
66 |
+
if (!match) {
|
67 |
+
break;
|
68 |
+
}
|
69 |
+
}
|
70 |
+
if (match) {
|
71 |
+
returnElements.push(current);
|
72 |
+
}
|
73 |
+
}
|
74 |
+
return returnElements;
|
75 |
+
};
|
76 |
+
}
|
77 |
+
return getElementsByClassName(className, tag, elm);
|
78 |
+
};
|
js/json2.js
ADDED
@@ -0,0 +1,480 @@
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
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
|
Â
|
1 |
+
/*
|
2 |
+
http://www.JSON.org/json2.js
|
3 |
+
2011-02-23
|
4 |
+
|
5 |
+
Public Domain.
|
6 |
+
|
7 |
+
NO WARRANTY EXPRESSED OR IMPLIED. USE AT YOUR OWN RISK.
|
8 |
+
|
9 |
+
See http://www.JSON.org/js.html
|
10 |
+
|
11 |
+
|
12 |
+
This code should be minified before deployment.
|
13 |
+
See http://javascript.crockford.com/jsmin.html
|
14 |
+
|
15 |
+
USE YOUR OWN COPY. IT IS EXTREMELY UNWISE TO LOAD CODE FROM SERVERS YOU DO
|
16 |
+
NOT CONTROL.
|
17 |
+
|
18 |
+
|
19 |
+
This file creates a global JSON object containing two methods: stringify
|
20 |
+
and parse.
|
21 |
+
|
22 |
+
JSON.stringify(value, replacer, space)
|
23 |
+
value any JavaScript value, usually an object or array.
|
24 |
+
|
25 |
+
replacer an optional parameter that determines how object
|
26 |
+
values are stringified for objects. It can be a
|
27 |
+
function or an array of strings.
|
28 |
+
|
29 |
+
space an optional parameter that specifies the indentation
|
30 |
+
of nested structures. If it is omitted, the text will
|
31 |
+
be packed without extra whitespace. If it is a number,
|
32 |
+
it will specify the number of spaces to indent at each
|
33 |
+
level. If it is a string (such as '\t' or ' '),
|
34 |
+
it contains the characters used to indent at each level.
|
35 |
+
|
36 |
+
This method produces a JSON text from a JavaScript value.
|
37 |
+
|
38 |
+
When an object value is found, if the object contains a toJSON
|
39 |
+
method, its toJSON method will be called and the result will be
|
40 |
+
stringified. A toJSON method does not serialize: it returns the
|
41 |
+
value represented by the name/value pair that should be serialized,
|
42 |
+
or undefined if nothing should be serialized. The toJSON method
|
43 |
+
will be passed the key associated with the value, and this will be
|
44 |
+
bound to the value
|
45 |
+
|
46 |
+
For example, this would serialize Dates as ISO strings.
|
47 |
+
|
48 |
+
Date.prototype.toJSON = function (key) {
|
49 |
+
function f(n) {
|
50 |
+
// Format integers to have at least two digits.
|
51 |
+
return n < 10 ? '0' + n : n;
|
52 |
+
}
|
53 |
+
|
54 |
+
return this.getUTCFullYear() + '-' +
|
55 |
+
f(this.getUTCMonth() + 1) + '-' +
|
56 |
+
f(this.getUTCDate()) + 'T' +
|
57 |
+
f(this.getUTCHours()) + ':' +
|
58 |
+
f(this.getUTCMinutes()) + ':' +
|
59 |
+
f(this.getUTCSeconds()) + 'Z';
|
60 |
+
};
|
61 |
+
|
62 |
+
You can provide an optional replacer method. It will be passed the
|
63 |
+
key and value of each member, with this bound to the containing
|
64 |
+
object. The value that is returned from your method will be
|
65 |
+
serialized. If your method returns undefined, then the member will
|
66 |
+
be excluded from the serialization.
|
67 |
+
|
68 |
+
If the replacer parameter is an array of strings, then it will be
|
69 |
+
used to select the members to be serialized. It filters the results
|
70 |
+
such that only members with keys listed in the replacer array are
|
71 |
+
stringified.
|
72 |
+
|
73 |
+
Values that do not have JSON representations, such as undefined or
|
74 |
+
functions, will not be serialized. Such values in objects will be
|
75 |
+
dropped; in arrays they will be replaced with null. You can use
|
76 |
+
a replacer function to replace those with JSON values.
|
77 |
+
JSON.stringify(undefined) returns undefined.
|
78 |
+
|
79 |
+
The optional space parameter produces a stringification of the
|
80 |
+
value that is filled with line breaks and indentation to make it
|
81 |
+
easier to read.
|
82 |
+
|
83 |
+
If the space parameter is a non-empty string, then that string will
|
84 |
+
be used for indentation. If the space parameter is a number, then
|
85 |
+
the indentation will be that many spaces.
|
86 |
+
|
87 |
+
Example:
|
88 |
+
|
89 |
+
text = JSON.stringify(['e', {pluribus: 'unum'}]);
|
90 |
+
// text is '["e",{"pluribus":"unum"}]'
|
91 |
+
|
92 |
+
|
93 |
+
text = JSON.stringify(['e', {pluribus: 'unum'}], null, '\t');
|
94 |
+
// text is '[\n\t"e",\n\t{\n\t\t"pluribus": "unum"\n\t}\n]'
|
95 |
+
|
96 |
+
text = JSON.stringify([new Date()], function (key, value) {
|
97 |
+
return this[key] instanceof Date ?
|
98 |
+
'Date(' + this[key] + ')' : value;
|
99 |
+
});
|
100 |
+
// text is '["Date(---current time---)"]'
|
101 |
+
|
102 |
+
|
103 |
+
JSON.parse(text, reviver)
|
104 |
+
This method parses a JSON text to produce an object or array.
|
105 |
+
It can throw a SyntaxError exception.
|
106 |
+
|
107 |
+
The optional reviver parameter is a function that can filter and
|
108 |
+
transform the results. It receives each of the keys and values,
|
109 |
+
and its return value is used instead of the original value.
|
110 |
+
If it returns what it received, then the structure is not modified.
|
111 |
+
If it returns undefined then the member is deleted.
|
112 |
+
|
113 |
+
Example:
|
114 |
+
|
115 |
+
// Parse the text. Values that look like ISO date strings will
|
116 |
+
// be converted to Date objects.
|
117 |
+
|
118 |
+
myData = JSON.parse(text, function (key, value) {
|
119 |
+
var a;
|
120 |
+
if (typeof value === 'string') {
|
121 |
+
a =
|
122 |
+
/^(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2}):(\d{2}(?:\.\d*)?)Z$/.exec(value);
|
123 |
+
if (a) {
|
124 |
+
return new Date(Date.UTC(+a[1], +a[2] - 1, +a[3], +a[4],
|
125 |
+
+a[5], +a[6]));
|
126 |
+
}
|
127 |
+
}
|
128 |
+
return value;
|
129 |
+
});
|
130 |
+
|
131 |
+
myData = JSON.parse('["Date(09/09/2001)"]', function (key, value) {
|
132 |
+
var d;
|
133 |
+
if (typeof value === 'string' &&
|
134 |
+
value.slice(0, 5) === 'Date(' &&
|
135 |
+
value.slice(-1) === ')') {
|
136 |
+
d = new Date(value.slice(5, -1));
|
137 |
+
if (d) {
|
138 |
+
return d;
|
139 |
+
}
|
140 |
+
}
|
141 |
+
return value;
|
142 |
+
});
|
143 |
+
|
144 |
+
|
145 |
+
This is a reference implementation. You are free to copy, modify, or
|
146 |
+
redistribute.
|
147 |
+
*/
|
148 |
+
|
149 |
+
/*jslint evil: true, strict: false, regexp: false */
|
150 |
+
|
151 |
+
/*members "", "\b", "\t", "\n", "\f", "\r", "\"", JSON, "\\", apply,
|
152 |
+
call, charCodeAt, getUTCDate, getUTCFullYear, getUTCHours,
|
153 |
+
getUTCMinutes, getUTCMonth, getUTCSeconds, hasOwnProperty, join,
|
154 |
+
lastIndex, length, parse, prototype, push, replace, slice, stringify,
|
155 |
+
test, toJSON, toString, valueOf
|
156 |
+
*/
|
157 |
+
|
158 |
+
|
159 |
+
// Create a JSON object only if one does not already exist. We create the
|
160 |
+
// methods in a closure to avoid creating global variables.
|
161 |
+
|
162 |
+
var JSON;
|
163 |
+
if (!JSON) {
|
164 |
+
JSON = {};
|
165 |
+
}
|
166 |
+
|
167 |
+
(function () {
|
168 |
+
"use strict";
|
169 |
+
|
170 |
+
function f(n) {
|
171 |
+
// Format integers to have at least two digits.
|
172 |
+
return n < 10 ? '0' + n : n;
|
173 |
+
}
|
174 |
+
|
175 |
+
if (typeof Date.prototype.toJSON !== 'function') {
|
176 |
+
|
177 |
+
Date.prototype.toJSON = function (key) {
|
178 |
+
|
179 |
+
return isFinite(this.valueOf()) ?
|
180 |
+
this.getUTCFullYear() + '-' +
|
181 |
+
f(this.getUTCMonth() + 1) + '-' +
|
182 |
+
f(this.getUTCDate()) + 'T' +
|
183 |
+
f(this.getUTCHours()) + ':' +
|
184 |
+
f(this.getUTCMinutes()) + ':' +
|
185 |
+
f(this.getUTCSeconds()) + 'Z' : null;
|
186 |
+
};
|
187 |
+
|
188 |
+
String.prototype.toJSON =
|
189 |
+
Number.prototype.toJSON =
|
190 |
+
Boolean.prototype.toJSON = function (key) {
|
191 |
+
return this.valueOf();
|
192 |
+
};
|
193 |
+
}
|
194 |
+
|
195 |
+
var cx = /[\u0000\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,
|
196 |
+
escapable = /[\\\"\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,
|
197 |
+
gap,
|
198 |
+
indent,
|
199 |
+
meta = { // table of character substitutions
|
200 |
+
'\b': '\\b',
|
201 |
+
'\t': '\\t',
|
202 |
+
'\n': '\\n',
|
203 |
+
'\f': '\\f',
|
204 |
+
'\r': '\\r',
|
205 |
+
'"' : '\\"',
|
206 |
+
'\\': '\\\\'
|
207 |
+
},
|
208 |
+
rep;
|
209 |
+
|
210 |
+
|
211 |
+
function quote(string) {
|
212 |
+
|
213 |
+
// If the string contains no control characters, no quote characters, and no
|
214 |
+
// backslash characters, then we can safely slap some quotes around it.
|
215 |
+
// Otherwise we must also replace the offending characters with safe escape
|
216 |
+
// sequences.
|
217 |
+
|
218 |
+
escapable.lastIndex = 0;
|
219 |
+
return escapable.test(string) ? '"' + string.replace(escapable, function (a) {
|
220 |
+
var c = meta[a];
|
221 |
+
return typeof c === 'string' ? c :
|
222 |
+
'\\u' + ('0000' + a.charCodeAt(0).toString(16)).slice(-4);
|
223 |
+
}) + '"' : '"' + string + '"';
|
224 |
+
}
|
225 |
+
|
226 |
+
|
227 |
+
function str(key, holder) {
|
228 |
+
|
229 |
+
// Produce a string from holder[key].
|
230 |
+
|
231 |
+
var i, // The loop counter.
|
232 |
+
k, // The member key.
|
233 |
+
v, // The member value.
|
234 |
+
length,
|
235 |
+
mind = gap,
|
236 |
+
partial,
|
237 |
+
value = holder[key];
|
238 |
+
|
239 |
+
// If the value has a toJSON method, call it to obtain a replacement value.
|
240 |
+
|
241 |
+
if (value && typeof value === 'object' &&
|
242 |
+
typeof value.toJSON === 'function') {
|
243 |
+
value = value.toJSON(key);
|
244 |
+
}
|
245 |
+
|
246 |
+
// If we were called with a replacer function, then call the replacer to
|
247 |
+
// obtain a replacement value.
|
248 |
+
|
249 |
+
if (typeof rep === 'function') {
|
250 |
+
value = rep.call(holder, key, value);
|
251 |
+
}
|
252 |
+
|
253 |
+
// What happens next depends on the value's type.
|
254 |
+
|
255 |
+
switch (typeof value) {
|
256 |
+
case 'string':
|
257 |
+
return quote(value);
|
258 |
+
|
259 |
+
case 'number':
|
260 |
+
|
261 |
+
// JSON numbers must be finite. Encode non-finite numbers as null.
|
262 |
+
|
263 |
+
return isFinite(value) ? String(value) : 'null';
|
264 |
+
|
265 |
+
case 'boolean':
|
266 |
+
case 'null':
|
267 |
+
|
268 |
+
// If the value is a boolean or null, convert it to a string. Note:
|
269 |
+
// typeof null does not produce 'null'. The case is included here in
|
270 |
+
// the remote chance that this gets fixed someday.
|
271 |
+
|
272 |
+
return String(value);
|
273 |
+
|
274 |
+
// If the type is 'object', we might be dealing with an object or an array or
|
275 |
+
// null.
|
276 |
+
|
277 |
+
case 'object':
|
278 |
+
|
279 |
+
// Due to a specification blunder in ECMAScript, typeof null is 'object',
|
280 |
+
// so watch out for that case.
|
281 |
+
|
282 |
+
if (!value) {
|
283 |
+
return 'null';
|
284 |
+
}
|
285 |
+
|
286 |
+
// Make an array to hold the partial results of stringifying this object value.
|
287 |
+
|
288 |
+
gap += indent;
|
289 |
+
partial = [];
|
290 |
+
|
291 |
+
// Is the value an array?
|
292 |
+
|
293 |
+
if (Object.prototype.toString.apply(value) === '[object Array]') {
|
294 |
+
|
295 |
+
// The value is an array. Stringify every element. Use null as a placeholder
|
296 |
+
// for non-JSON values.
|
297 |
+
|
298 |
+
length = value.length;
|
299 |
+
for (i = 0; i < length; i += 1) {
|
300 |
+
partial[i] = str(i, value) || 'null';
|
301 |
+
}
|
302 |
+
|
303 |
+
// Join all of the elements together, separated with commas, and wrap them in
|
304 |
+
// brackets.
|
305 |
+
|
306 |
+
v = partial.length === 0 ? '[]' : gap ?
|
307 |
+
'[\n' + gap + partial.join(',\n' + gap) + '\n' + mind + ']' :
|
308 |
+
'[' + partial.join(',') + ']';
|
309 |
+
gap = mind;
|
310 |
+
return v;
|
311 |
+
}
|
312 |
+
|
313 |
+
// If the replacer is an array, use it to select the members to be stringified.
|
314 |
+
|
315 |
+
if (rep && typeof rep === 'object') {
|
316 |
+
length = rep.length;
|
317 |
+
for (i = 0; i < length; i += 1) {
|
318 |
+
if (typeof rep[i] === 'string') {
|
319 |
+
k = rep[i];
|
320 |
+
v = str(k, value);
|
321 |
+
if (v) {
|
322 |
+
partial.push(quote(k) + (gap ? ': ' : ':') + v);
|
323 |
+
}
|
324 |
+
}
|
325 |
+
}
|
326 |
+
} else {
|
327 |
+
|
328 |
+
// Otherwise, iterate through all of the keys in the object.
|
329 |
+
|
330 |
+
for (k in value) {
|
331 |
+
if (Object.prototype.hasOwnProperty.call(value, k)) {
|
332 |
+
v = str(k, value);
|
333 |
+
if (v) {
|
334 |
+
partial.push(quote(k) + (gap ? ': ' : ':') + v);
|
335 |
+
}
|
336 |
+
}
|
337 |
+
}
|
338 |
+
}
|
339 |
+
|
340 |
+
// Join all of the member texts together, separated with commas,
|
341 |
+
// and wrap them in braces.
|
342 |
+
|
343 |
+
v = partial.length === 0 ? '{}' : gap ?
|
344 |
+
'{\n' + gap + partial.join(',\n' + gap) + '\n' + mind + '}' :
|
345 |
+
'{' + partial.join(',') + '}';
|
346 |
+
gap = mind;
|
347 |
+
return v;
|
348 |
+
}
|
349 |
+
}
|
350 |
+
|
351 |
+
// If the JSON object does not yet have a stringify method, give it one.
|
352 |
+
|
353 |
+
if (typeof JSON.stringify !== 'function') {
|
354 |
+
JSON.stringify = function (value, replacer, space) {
|
355 |
+
|
356 |
+
// The stringify method takes a value and an optional replacer, and an optional
|
357 |
+
// space parameter, and returns a JSON text. The replacer can be a function
|
358 |
+
// that can replace values, or an array of strings that will select the keys.
|
359 |
+
// A default replacer method can be provided. Use of the space parameter can
|
360 |
+
// produce text that is more easily readable.
|
361 |
+
|
362 |
+
var i;
|
363 |
+
gap = '';
|
364 |
+
indent = '';
|
365 |
+
|
366 |
+
// If the space parameter is a number, make an indent string containing that
|
367 |
+
// many spaces.
|
368 |
+
|
369 |
+
if (typeof space === 'number') {
|
370 |
+
for (i = 0; i < space; i += 1) {
|
371 |
+
indent += ' ';
|
372 |
+
}
|
373 |
+
|
374 |
+
// If the space parameter is a string, it will be used as the indent string.
|
375 |
+
|
376 |
+
} else if (typeof space === 'string') {
|
377 |
+
indent = space;
|
378 |
+
}
|
379 |
+
|
380 |
+
// If there is a replacer, it must be a function or an array.
|
381 |
+
// Otherwise, throw an error.
|
382 |
+
|
383 |
+
rep = replacer;
|
384 |
+
if (replacer && typeof replacer !== 'function' &&
|
385 |
+
(typeof replacer !== 'object' ||
|
386 |
+
typeof replacer.length !== 'number')) {
|
387 |
+
throw new Error('JSON.stringify');
|
388 |
+
}
|
389 |
+
|
390 |
+
// Make a fake root object containing our value under the key of ''.
|
391 |
+
// Return the result of stringifying the value.
|
392 |
+
|
393 |
+
return str('', {'': value});
|
394 |
+
};
|
395 |
+
}
|
396 |
+
|
397 |
+
|
398 |
+
// If the JSON object does not yet have a parse method, give it one.
|
399 |
+
|
400 |
+
if (typeof JSON.parse !== 'function') {
|
401 |
+
JSON.parse = function (text, reviver) {
|
402 |
+
|
403 |
+
// The parse method takes a text and an optional reviver function, and returns
|
404 |
+
// a JavaScript value if the text is a valid JSON text.
|
405 |
+
|
406 |
+
var j;
|
407 |
+
|
408 |
+
function walk(holder, key) {
|
409 |
+
|
410 |
+
// The walk method is used to recursively walk the resulting structure so
|
411 |
+
// that modifications can be made.
|
412 |
+
|
413 |
+
var k, v, value = holder[key];
|
414 |
+
if (value && typeof value === 'object') {
|
415 |
+
for (k in value) {
|
416 |
+
if (Object.prototype.hasOwnProperty.call(value, k)) {
|
417 |
+
v = walk(value, k);
|
418 |
+
if (v !== undefined) {
|
419 |
+
value[k] = v;
|
420 |
+
} else {
|
421 |
+
delete value[k];
|
422 |
+
}
|
423 |
+
}
|
424 |
+
}
|
425 |
+
}
|
426 |
+
return reviver.call(holder, key, value);
|
427 |
+
}
|
428 |
+
|
429 |
+
|
430 |
+
// Parsing happens in four stages. In the first stage, we replace certain
|
431 |
+
// Unicode characters with escape sequences. JavaScript handles many characters
|
432 |
+
// incorrectly, either silently deleting them, or treating them as line endings.
|
433 |
+
|
434 |
+
text = String(text);
|
435 |
+
cx.lastIndex = 0;
|
436 |
+
if (cx.test(text)) {
|
437 |
+
text = text.replace(cx, function (a) {
|
438 |
+
return '\\u' +
|
439 |
+
('0000' + a.charCodeAt(0).toString(16)).slice(-4);
|
440 |
+
});
|
441 |
+
}
|
442 |
+
|
443 |
+
// In the second stage, we run the text against regular expressions that look
|
444 |
+
// for non-JSON patterns. We are especially concerned with '()' and 'new'
|
445 |
+
// because they can cause invocation, and '=' because it can cause mutation.
|
446 |
+
// But just to be safe, we want to reject all unexpected forms.
|
447 |
+
|
448 |
+
// We split the second stage into 4 regexp operations in order to work around
|
449 |
+
// crippling inefficiencies in IE's and Safari's regexp engines. First we
|
450 |
+
// replace the JSON backslash pairs with '@' (a non-JSON character). Second, we
|
451 |
+
// replace all simple value tokens with ']' characters. Third, we delete all
|
452 |
+
// open brackets that follow a colon or comma or that begin the text. Finally,
|
453 |
+
// we look to see that the remaining characters are only whitespace or ']' or
|
454 |
+
// ',' or ':' or '{' or '}'. If that is so, then the text is safe for eval.
|
455 |
+
|
456 |
+
if (/^[\],:{}\s]*$/
|
457 |
+
.test(text.replace(/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g, '@')
|
458 |
+
.replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g, ']')
|
459 |
+
.replace(/(?:^|:|,)(?:\s*\[)+/g, ''))) {
|
460 |
+
|
461 |
+
// In the third stage we use the eval function to compile the text into a
|
462 |
+
// JavaScript structure. The '{' operator is subject to a syntactic ambiguity
|
463 |
+
// in JavaScript: it can begin a block or an object literal. We wrap the text
|
464 |
+
// in parens to eliminate the ambiguity.
|
465 |
+
|
466 |
+
j = eval('(' + text + ')');
|
467 |
+
|
468 |
+
// In the optional fourth stage, we recursively walk the new structure, passing
|
469 |
+
// each name/value pair to a reviver function for possible transformation.
|
470 |
+
|
471 |
+
return typeof reviver === 'function' ?
|
472 |
+
walk({'': j}, '') : j;
|
473 |
+
}
|
474 |
+
|
475 |
+
// If the text is not JSON parseable, then a SyntaxError is thrown.
|
476 |
+
|
477 |
+
throw new S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
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
1 |
+
var DraggedItem = null;
|
2 |
+
|
3 |
+
jQuery(document).ready(function($){
|
4 |
+
$('.wfu_color_field').wpColorPicker({
|
5 |
+
change: function(event, ui) {
|
6 |
+
event.target.value = ui.color.toString();
|
7 |
+
if (event.target.name == "wfu_text_elements") wfu_update_text_value(event);
|
8 |
+
else if (event.target.name == "wfu_triplecolor_elements") wfu_update_triplecolor_value(event);
|
9 |
+
}
|
10 |
+
});
|
11 |
+
});
|
12 |
+
|
13 |
+
function wfu_admin_activate_tab(key) {
|
14 |
+
var tabs = document.getElementById("wfu_tab_container");
|
15 |
+
var tab, tabkey;
|
16 |
+
for (var i = 0; i < tabs.childNodes.length; i++) {
|
17 |
+
tab = tabs.childNodes[i];
|
18 |
+
if (tab.nodeType === 1) {
|
19 |
+
tabkey = tab.id.substr(8);
|
20 |
+
if (tab.className.indexOf("nav-tab-active") > -1) {
|
21 |
+
tab.className = "nav-tab";
|
22 |
+
document.getElementById("wfu_container_" + tabkey).style.display = "none";
|
23 |
+
}
|
24 |
+
}
|
25 |
+
}
|
26 |
+
document.getElementById("wfu_tab_" + key).className = "nav-tab nav-tab-active";
|
27 |
+
document.getElementById("wfu_container_" + key).style.display = "block";
|
28 |
+
}
|
29 |
+
|
30 |
+
function wfu_admin_onoff_clicked(key) {
|
31 |
+
var onoff = document.getElementById("wfu_attribute_" + key);
|
32 |
+
var container = document.getElementById("wfu_wrapper");
|
33 |
+
var shadows = document.getElementsByClassName("wfu_shadow_" + key, "div", container);
|
34 |
+
var shadows_inv = document.getElementsByClassName("wfu_shadow_" + key + "_inv", "div", container);
|
35 |
+
var status = (onoff.className.substr(onoff.className.length - 2) == "on");
|
36 |
+
status = !status;
|
37 |
+
if (status) {
|
38 |
+
document.getElementById("wfu_attribute_value_" + key).value = "true";
|
39 |
+
onoff.className = "wfu_onoff_container_on";
|
40 |
+
for (var i = 0; i < shadows.length; i++) shadows[i].style.display = "none";
|
41 |
+
for (var i = 0; i < shadows_inv.length; i++) shadows_inv[i].style.display = "block";
|
42 |
+
}
|
43 |
+
else {
|
44 |
+
document.getElementById("wfu_attribute_value_" + key).value = "false";
|
45 |
+
onoff.className = "wfu_onoff_container_off";
|
46 |
+
for (var i = 0; i < shadows.length; i++) shadows[i].style.display = "block";
|
47 |
+
for (var i = 0; i < shadows_inv.length; i++) shadows_inv[i].style.display = "none";
|
48 |
+
}
|
49 |
+
wfu_generate_shortcode();
|
50 |
+
}
|
51 |
+
|
52 |
+
function wfu_admin_radio_clicked(key) {
|
53 |
+
var radios = document.getElementsByName("wfu_radioattribute_" + key);
|
54 |
+
var shadows = document.getElementsByName("wfu_shadow_" + key);
|
55 |
+
var shadows_inv = document.getElementsByName("wfu_shadow_" + key + "_inv");
|
56 |
+
var val = "";
|
57 |
+
for (i = 0; i < radios.length; i++)
|
58 |
+
if (radios[i].checked) val = radios[i].value;
|
59 |
+
var status = (val.substr(0, 1) == "*");
|
60 |
+
if (status) {
|
61 |
+
val = val.substr(1);
|
62 |
+
for (var i = 0; i < shadows.length; i++) shadows[i].style.display = "none";
|
63 |
+
for (var i = 0; i < shadows_inv.length; i++) shadows_inv[i].style.display = "block";
|
64 |
+
}
|
65 |
+
else {
|
66 |
+
for (var i = 0; i < shadows.length; i++) shadows[i].style.display = "block";
|
67 |
+
for (var i = 0; i < shadows_inv.length; i++) shadows_inv[i].style.display = "none";
|
68 |
+
}
|
69 |
+
document.getElementById("wfu_attribute_value_" + key).value = val;
|
70 |
+
wfu_generate_shortcode();
|
71 |
+
}
|
72 |
+
|
73 |
+
function wfu_addEventHandler(obj, evt, handler) {
|
74 |
+
if(obj.addEventListener) {
|
75 |
+
// W3C method
|
76 |
+
obj.addEventListener(evt, handler, false);
|
77 |
+
}
|
78 |
+
else if(obj.attachEvent) {
|
79 |
+
// IE method.
|
80 |
+
obj.attachEvent('on'+evt, handler);
|
81 |
+
}
|
82 |
+
else {
|
83 |
+
// Old school method.
|
84 |
+
obj['on'+evt] = handler;
|
85 |
+
}
|
86 |
+
}
|
87 |
+
|
88 |
+
function wfu_attach_separator_dragdrop_events() {
|
89 |
+
var container = document.getElementById('wfu_placements_container');
|
90 |
+
var item;
|
91 |
+
for (var i = 0; i < container.childNodes.length; i++) {
|
92 |
+
item = container.childNodes[i];
|
93 |
+
if (item.className == "wfu_component_separator_hor" || item.className == "wfu_component_separator_ver") {
|
94 |
+
wfu_addEventHandler(item, 'dragenter', wfu_separator_dragenter);
|
95 |
+
wfu_addEventHandler(item, 'dragover', wfu_default_dragover);
|
96 |
+
wfu_addEventHandler(item, 'dragleave', wfu_separator_dragleave);
|
97 |
+
wfu_addEventHandler(item, 'drop', wfu_separator_drop);
|
98 |
+
}
|
99 |
+
}
|
100 |
+
}
|
101 |
+
|
102 |
+
function wfu_Attach_Admin_DragDrop_Events() {
|
103 |
+
if (window.FileReader) {
|
104 |
+
var container = document.getElementById('wfu_placements_container');
|
105 |
+
var available_container = document.getElementById('wfu_componentlist_container');
|
106 |
+
var item;
|
107 |
+
for (var i = 0; i < container.childNodes.length; i++) {
|
108 |
+
item = container.childNodes[i];
|
109 |
+
if (item.className == "wfu_component_box") {
|
110 |
+
wfu_addEventHandler(item, 'dragstart', wfu_component_dragstart);
|
111 |
+
wfu_addEventHandler(item, 'dragend', wfu_component_dragend);
|
112 |
+
}
|
113 |
+
}
|
114 |
+
for (var i = 0; i < available_container.childNodes.length; i++) {
|
115 |
+
item = available_container.childNodes[i];
|
116 |
+
if (item.className == "wfu_component_box_container") {
|
117 |
+
for (var ii = 0; ii < item.childNodes.length; ii++) {
|
118 |
+
if (item.childNodes[ii].className == "wfu_component_box wfu_inbase") {
|
119 |
+
wfu_addEventHandler(item.childNodes[ii], 'dragstart', wfu_component_dragstart);
|
120 |
+
wfu_addEventHandler(item.childNodes[ii], 'dragend', wfu_component_dragend);
|
121 |
+
}
|
122 |
+
}
|
123 |
+
}
|
124 |
+
}
|
125 |
+
item = document.getElementById('wfu_componentlist_dragdrop');
|
126 |
+
wfu_addEventHandler(item, 'dragenter', wfu_componentlist_dragenter);
|
127 |
+
wfu_addEventHandler(item, 'dragover', wfu_default_dragover);
|
128 |
+
wfu_addEventHandler(item, 'dragleave', wfu_componentlist_dragleave);
|
129 |
+
wfu_addEventHandler(item, 'drop', wfu_componentlist_drop);
|
130 |
+
wfu_attach_separator_dragdrop_events();
|
131 |
+
}
|
132 |
+
}
|
133 |
+
|
134 |
+
function wfu_componentlist_dragenter(e) {
|
135 |
+
e = e || window.event;
|
136 |
+
if (e.preventDefault) { e.preventDefault(); }
|
137 |
+
if (!DraggedItem) return false;
|
138 |
+
var item = document.getElementById('wfu_componentlist_dragdrop');
|
139 |
+
if (item.className.indexOf("wfu_componentlist_dragdrop_dragover") == -1)
|
140 |
+
item.className += " wfu_componentlist_dragdrop_dragover";
|
141 |
+
return false;
|
142 |
+
}
|
143 |
+
|
144 |
+
function wfu_componentlist_dragleave(e) {
|
145 |
+
e = e || window.event;
|
146 |
+
if (e.preventDefault) { e.preventDefault(); }
|
147 |
+
if (!DraggedItem) return false;
|
148 |
+
var item = document.getElementById('wfu_componentlist_dragdrop');
|
149 |
+
item.className = item.className.replace(" wfu_componentlist_dragdrop_dragover", "");
|
150 |
+
return false;
|
151 |
+
}
|
152 |
+
|
153 |
+
function wfu_componentlist_drop(e) {
|
154 |
+
e = e || window.event;
|
155 |
+
if (e.preventDefault) { e.preventDefault(); }
|
156 |
+
var component = e.dataTransfer.getData("Component");
|
157 |
+
if (!component) return false;
|
158 |
+
//move dragged component to base
|
159 |
+
var item = document.getElementById('wfu_component_box_' + component);
|
160 |
+
item.className = "wfu_component_box wfu_inbase";
|
161 |
+
item.style.display = "block";
|
162 |
+
document.getElementById('wfu_component_box_container_' + component).appendChild(item);
|
163 |
+
//recreate placements panel
|
164 |
+
var placements = wfu_admin_recreate_placements_text(null, "");
|
165 |
+
wfu_admin_recreate_placements_panel(placements);
|
166 |
+
document.getElementById("wfu_attribute_value_placements").value = placements;
|
167 |
+
wfu_generate_shortcode();
|
168 |
+
return false;
|
169 |
+
}
|
170 |
+
|
171 |
+
function wfu_separator_dragenter(e) {
|
172 |
+
e = e || window.event;
|
173 |
+
if (e.preventDefault) { e.preventDefault(); }
|
174 |
+
if (!DraggedItem) return false;
|
175 |
+
if (e.target.className == "wfu_component_separator_hor") {
|
176 |
+
var bar = document.getElementById('wfu_component_bar_hor');
|
177 |
+
bar.style.top = e.target.offsetTop + "px";
|
178 |
+
bar.style.display = "block";
|
179 |
+
}
|
180 |
+
else if (e.target.className == "wfu_component_separator_ver") {
|
181 |
+
var bar = document.getElementById('wfu_component_bar_ver');
|
182 |
+
bar.style.top = e.target.offsetTop + "px";
|
183 |
+
bar.style.left = e.target.offsetLeft + "px";
|
184 |
+
bar.style.display = "block";
|
185 |
+
}
|
186 |
+
return false;
|
187 |
+
}
|
188 |
+
|
189 |
+
function wfu_default_dragover(e) {
|
190 |
+
e = e || window.event;
|
191 |
+
if (e.preventDefault) { e.preventDefault(); }
|
192 |
+
return false;
|
193 |
+
}
|
194 |
+
|
195 |
+
function wfu_separator_dragleave(e) {
|
196 |
+
e = e || window.event;
|
197 |
+
if (e.preventDefault) { e.preventDefault(); }
|
198 |
+
if (!DraggedItem) return false;
|
199 |
+
if (e.target.className == "wfu_component_separator_hor") {
|
200 |
+
var bar = document.getElementById('wfu_component_bar_hor');
|
201 |
+
bar.style.display = "none";
|
202 |
+
}
|
203 |
+
else if (e.target.className == "wfu_component_separator_ver") {
|
204 |
+
var bar = document.getElementById('wfu_component_bar_ver');
|
205 |
+
bar.style.display = "none";
|
206 |
+
}
|
207 |
+
return false;
|
208 |
+
}
|
209 |
+
|
210 |
+
function wfu_separator_drop(e) {
|
211 |
+
e = e || window.event;
|
212 |
+
if (e.preventDefault) { e.preventDefault(); }
|
213 |
+
var component = e.dataTransfer.getData("Component");
|
214 |
+
if (!component) return false;
|
215 |
+
//first move dragged component to base otherwise we may lose it during recreation of placements panel
|
216 |
+
var item = document.getElementById('wfu_component_box_' + component);
|
217 |
+
item.style.display = "none";
|
218 |
+
item.className = "wfu_component_box wfu_inbase";
|
219 |
+
document.getElementById('wfu_component_box_container_' + component).appendChild(item);
|
220 |
+
//recreate placements panel
|
221 |
+
var placements = wfu_admin_recreate_placements_text(e.target, component);
|
222 |
+
wfu_admin_recreate_placements_panel(placements);
|
223 |
+
document.getElementById("wfu_attribute_value_placements").value = placements;
|
224 |
+
wfu_generate_shortcode();
|
225 |
+
return false;
|
226 |
+
}
|
227 |
+
|
228 |
+
function wfu_component_dragstart(e) {
|
229 |
+
e = e || window.event;
|
230 |
+
e.dataTransfer.setData("Component", e.target.id.replace("wfu_component_box_", ""));
|
231 |
+
if (e.target.className.indexOf("wfu_component_box_dragged") == -1) {
|
232 |
+
e.target.className += " wfu_component_box_dragged";
|
233 |
+
DraggedItem = e.target;
|
234 |
+
}
|
235 |
+
e.target.style.zIndex = 3;
|
236 |
+
var item = document.getElementById('wfu_componentlist_dragdrop');
|
237 |
+
item.className = "wfu_componentlist_dragdrop wfu_componentlist_dragdrop_dragover";
|
238 |
+
item.style.display = "block";
|
239 |
+
return false;
|
240 |
+
}
|
241 |
+
|
242 |
+
function wfu_component_dragend(e) {
|
243 |
+
e = e || window.event;
|
244 |
+
DraggedItem = null;
|
245 |
+
e.target.style.zIndex = 1;
|
246 |
+
var item = document.getElementById('wfu_componentlist_dragdrop');
|
247 |
+
item.style.display = "none";
|
248 |
+
item.className = "wfu_componentlist_dragdrop";
|
249 |
+
e.target.className = e.target.className.replace(" wfu_component_box_dragged", "");
|
250 |
+
document.getElementById('wfu_component_bar_ver').style.display = "none";
|
251 |
+
document.getElementById('wfu_component_bar_hor').style.display = "none";
|
252 |
+
return false;
|
253 |
+
}
|
254 |
+
|
255 |
+
function wfu_admin_recreate_placements_text(place, new_component) {
|
256 |
+
function add_item(component) {
|
257 |
+
if (placements != "") placements += delim;
|
258 |
+
placements += component;
|
259 |
+
delim = "";
|
260 |
+
}
|
261 |
+
|
262 |
+
var container = document.getElementById('wfu_placements_container');
|
263 |
+
var delim = "";
|
264 |
+
var placements = "";
|
265 |
+
var component = "";
|
266 |
+
for (var i = 0; i < container.childNodes.length; i++) {
|
267 |
+
item = container.childNodes[i];
|
268 |
+
if (item.className == "wfu_component_separator_ver") {
|
269 |
+
if (delim == "" ) delim = "+";
|
270 |
+
if (item == place) { add_item(new_component); delim = "+"; }
|
271 |
+
}
|
272 |
+
else if (item.className == "wfu_component_separator_hor") {
|
273 |
+
delim = "/";
|
274 |
+
if (item == place) { add_item(new_component); delim = "/"; }
|
275 |
+
}
|
276 |
+
else if (item.className == "wfu_component_box") add_item(item.id.replace("wfu_component_box_", ""));
|
277 |
+
}
|
278 |
+
return placements;
|
279 |
+
}
|
280 |
+
|
281 |
+
function wfu_admin_recreate_placements_panel(placements_text) {
|
282 |
+
var container = document.getElementById('wfu_placements_container');
|
283 |
+
var item, placements, sections;
|
284 |
+
var itemname = "";
|
285 |
+
for (var i = 0; i < container.childNodes.length; i++) {
|
286 |
+
item = container.childNodes[i];
|
287 |
+
if (item.className == "wfu_component_box") {
|
288 |
+
itemname = item.id.replace("wfu_component_box_", "");
|
289 |
+
item.style.display = "none";
|
290 |
+
item.className = "wfu_component_box wfu_inbase";
|
291 |
+
document.getElementById('wfu_component_box_container_' + itemname).appendChild(item);
|
292 |
+
}
|
293 |
+
}
|
294 |
+
container.innerHTML = "";
|
295 |
+
placements = placements_text.split("/");
|
296 |
+
for (var i = 0; i < placements.length; i++) {
|
297 |
+
item = document.createElement("DIV");
|
298 |
+
item.className = "wfu_component_separator_hor";
|
299 |
+
item.setAttribute("draggable", true);
|
300 |
+
container.appendChild(item);
|
301 |
+
item = document.createElement("DIV");
|
302 |
+
item.className = "wfu_component_separator_ver";
|
303 |
+
item.setAttribute("draggable", true);
|
304 |
+
container.appendChild(item);
|
305 |
+
sections = placements[i].split("+");
|
306 |
+
for (var ii = 0; ii < sections.length; ii++) {
|
307 |
+
item = document.getElementById('wfu_component_box_' + sections[ii]);
|
308 |
+
if (item) {
|
309 |
+
container.appendChild(item);
|
310 |
+
item.className = "wfu_component_box";
|
311 |
+
item.style.display = "inline-block";
|
312 |
+
item = document.createElement("DIV");
|
313 |
+
item.className = "wfu_component_separator_ver";
|
314 |
+
item.setAttribute("draggable", true);
|
315 |
+
container.appendChild(item);
|
316 |
+
}
|
317 |
+
}
|
318 |
+
}
|
319 |
+
item = document.createElement("DIV");
|
320 |
+
item.className = "wfu_component_separator_hor";
|
321 |
+
item.setAttribute("draggable", true);
|
322 |
+
container.appendChild(item);
|
323 |
+
item = document.createElement("DIV");
|
324 |
+
item.id = "wfu_component_bar_hor";
|
325 |
+
item.className = "wfu_component_bar_hor";
|
326 |
+
container.appendChild(item);
|
327 |
+
item = document.createElement("DIV");
|
328 |
+
item.id = "wfu_component_bar_ver";
|
329 |
+
item.className = "wfu_component_bar_ver";
|
330 |
+
container.appendChild(item);
|
331 |
+
wfu_attach_separator_dragdrop_events();
|
332 |
+
}
|
333 |
+
|
334 |
+
function wfu_userdata_add_field(obj) {
|
335 |
+
var line = obj.parentNode;
|
336 |
+
var newline = line.cloneNode(true);
|
337 |
+
var item;
|
338 |
+
for (var i = 0; i < newline.childNodes.length; i ++) {
|
339 |
+
item = newline.childNodes[i];
|
340 |
+
if (item.tagName == "INPUT") {
|
341 |
+
if (item.type == "text") {
|
342 |
+
item.value = "";
|
343 |
+
wfu_attach_element_handlers(item, wfu_update_userfield_value);
|
344 |
+
}
|
345 |
+
else if (item.type == "checkbox") {
|
346 |
+
item.checked = false;
|
347 |
+
}
|
348 |
+
}
|
349 |
+
else if (item.tagName == "DIV") item.className = "wfu_userdata_action";
|
350 |
+
}
|
351 |
+
line.parentNode.insertBefore(newline, line.nextSibling);
|
352 |
+
}
|
353 |
+
|
354 |
+
function wfu_userdata_remove_field(obj) {
|
355 |
+
var line = obj.parentNode;
|
356 |
+
var container = line.parentNode;
|
357 |
+
var first = null;
|
358 |
+
for (var i = 0; i < container.childNodes.length; i++)
|
359 |
+
if (container.childNodes[i].nodeType === 1) {
|
360 |
+
first = container.childNodes[i];
|
361 |
+
break;
|
362 |
+
}
|
363 |
+
if (line != first) {
|
364 |
+
line.parentNode.removeChild(line);
|
365 |
+
for (var i = 0; i < first.childNodes.length; i++)
|
366 |
+
if (first.childNodes[i].nodeType === 1) {
|
367 |
+
wfu_update_userfield_value({target:first.childNodes[i]});
|
368 |
+
break;
|
369 |
+
}
|
370 |
+
}
|
371 |
+
}
|
372 |
+
|
373 |
+
function wfu_generate_shortcode() {
|
374 |
+
var defaults = document.getElementById("wfu_attribute_defaults");
|
375 |
+
var values = document.getElementById("wfu_attribute_values");
|
376 |
+
var item;
|
377 |
+
var attribute = "";
|
378 |
+
var value = "";
|
379 |
+
var shortcode = "[wordpress_file_upload";
|
380 |
+
for (var i = 0; i < defaults.childNodes.length; i++) {
|
381 |
+
item = defaults.childNodes[i];
|
382 |
+
if (item.nodeType === 1) {
|
383 |
+
attribute = item.id.replace("wfu_attribute_default_", "");
|
384 |
+
value = document.getElementById("wfu_attribute_value_" + attribute).value;
|
385 |
+
if (item.value != value)
|
386 |
+
shortcode += " " + attribute + "=\"" + value + "\"";
|
387 |
+
}
|
388 |
+
}
|
389 |
+
shortcode += "]";
|
390 |
+
|
391 |
+
document.getElementById("wfu_shortcode").value = shortcode;
|
392 |
+
}
|
393 |
+
|
394 |
+
function wfu_update_text_value(e) {
|
395 |
+
e = e || window.event;
|
396 |
+
var item = e.target;
|
397 |
+
var attribute = item.id.replace("wfu_attribute_", "");
|
398 |
+
var val = item.value;
|
399 |
+
if (val !== item.oldVal) {
|
400 |
+
item.oldVal = val;
|
401 |
+
document.getElementById("wfu_attribute_value_" + attribute).value = val;
|
402 |
+
wfu_generate_shortcode();
|
403 |
+
}
|
404 |
+
}
|
405 |
+
|
406 |
+
function wfu_update_triplecolor_value(e) {
|
407 |
+
e = e || window.event;
|
408 |
+
var item = e.target;
|
409 |
+
var attribute = item.id.replace("wfu_attribute_", "");
|
410 |
+
attribute = attribute.replace("_color", "");
|
411 |
+
attribute = attribute.replace("_bgcolor", "");
|
412 |
+
attribute = attribute.replace("_borcolor", "");
|
413 |
+
item = document.getElementById("wfu_attribute_" + attribute + "_color");
|
414 |
+
var val = item.value + "," +
|
415 |
+
document.getElementById("wfu_attribute_" + attribute + "_bgcolor").value + "," +
|
416 |
+
document.getElementById("wfu_attribute_" + attribute + "_borcolor").value;
|
417 |
+
if (val !== item.oldVal) {
|
418 |
+
item.oldVal = val;
|
419 |
+
document.getElementById("wfu_attribute_value_" + attribute).value = val;
|
420 |
+
wfu_generate_shortcode();
|
421 |
+
}
|
422 |
+
}
|
423 |
+
|
424 |
+
function wfu_update_dimension_value(e) {
|
425 |
+
e = e || window.event;
|
426 |
+
var item = e.target;
|
427 |
+
var attribute = item.name.replace("wfu_dimension_elements_", "");
|
428 |
+
var group = document.getElementsByName(item.name);
|
429 |
+
item = group[0];
|
430 |
+
var val = "";
|
431 |
+
var dimname = "";
|
432 |
+
for (var i = 0; i < group.length; i++) {
|
433 |
+
dimname = group[i].id.replace("wfu_attribute_" + attribute + "_", "");
|
434 |
+
if (val != "" && group[i].value != "") val += ", ";
|
435 |
+
if (group[i].value != "") val += dimname + ":" + group[i].value;
|
436 |
+
}
|
437 |
+
if (val !== item.oldVal) {
|
438 |
+
item.oldVal = val;
|
439 |
+
document.getElementById("wfu_attribute_value_" + attribute).value = val;
|
440 |
+
wfu_generate_shortcode();
|
441 |
+
}
|
442 |
+
}
|
443 |
+
|
444 |
+
function wfu_update_ptext_value(attribute) {
|
445 |
+
var singular = document.getElementById("wfu_attribute_s_" + attribute).value;
|
446 |
+
var plural = document.getElementById("wfu_attribute_p_" + attribute).value;
|
447 |
+
document.getElementById("wfu_attribute_value_" + attribute).value = singular + "/" + plural;
|
448 |
+
wfu_generate_shortcode();
|
449 |
+
}
|
450 |
+
|
451 |
+
function wfu_update_rolelist_value(attribute) {
|
452 |
+
var options = document.getElementById("wfu_attribute_" + attribute).options;
|
453 |
+
var value = "";
|
454 |
+
for (var i = 0; i < options.length; i++)
|
455 |
+
if (options[i].selected) {
|
456 |
+
if (value != "") value += ",";
|
457 |
+
value += options[i].value;
|
458 |
+
}
|
459 |
+
document.getElementById("wfu_attribute_value_" + attribute).value = value;
|
460 |
+
wfu_generate_shortcode();
|
461 |
+
}
|
462 |
+
|
463 |
+
function wfu_update_userfield_value(e) {
|
464 |
+
e = e || window.event;
|
465 |
+
var item = e.target;
|
466 |
+
var line = item.parentNode;
|
467 |
+
var container = line.parentNode;
|
468 |
+
var fieldval = "";
|
469 |
+
var fieldreq = false;
|
470 |
+
var val = "";
|
471 |
+
for (var i = 0; i < container.childNodes.length; i++) {
|
472 |
+
line = container.childNodes[i];
|
473 |
+
if (line.tagName === "DIV") {
|
474 |
+
for (var j = 0; j < line.childNodes.length; j++)
|
475 |
+
if (line.childNodes[j].tagName == "INPUT") {
|
476 |
+
if (line.childNodes[j].type == "text") {
|
477 |
+
fieldval = line.childNodes[j].value;
|
478 |
+
if (i == 0) item = line.childNodes[j];
|
479 |
+
}
|
480 |
+
else if (line.childNodes[j].type == "checkbox")
|
481 |
+
fieldreq = line.childNodes[j].checked;
|
482 |
+
}
|
483 |
+
if (val != "" && fieldval != "") val += "/";
|
484 |
+
if (fieldval != "" && fieldreq) val += "*";
|
485 |
+
if (fieldval != "") val += fieldval;
|
486 |
+
}
|
487 |
+
}
|
488 |
+
if (val !== item.oldVal) {
|
489 |
+
item.oldVal = val;
|
490 |
+
document.getElementById("wfu_attribute_value_userdatalabel").value = val;
|
491 |
+
wfu_generate_shortcode();
|
492 |
+
}
|
493 |
+
}
|
494 |
+
|
495 |
+
function wfu_attach_element_handlers(item, handler) {
|
496 |
+
var elem_events = ['DOMAttrModified', 'textInput', 'input', 'change', 'keypress', 'paste', 'focus', 'propertychange'];
|
497 |
+
for (var i = 0; i < elem_events.length; i++)
|
498 |
+
wfu_addEventHandler(item, elem_events[i], handler);
|
499 |
+
}
|
500 |
+
|
501 |
+
function wfu_Attach_Admin_Events() {
|
502 |
+
wfu_Attach_Admin_DragDrop_Events();
|
503 |
+
var text_elements = document.getElementsByName("wfu_text_elements");
|
504 |
+
for (var i = 0; i < text_elements.length; i++) wfu_attach_element_handlers(text_elements[i], wfu_update_text_value);
|
505 |
+
var triplecolor_elements = document.getElementsByName("wfu_triplecolor_elements");
|
506 |
+
for (var i = 0; i < triplecolor_elements.length; i++) wfu_attach_element_handlers(triplecolor_elements[i], wfu_update_triplecolor_value);
|
507 |
+
var dimension_elements = document.getElementsByName("wfu_dimension_elements_widths");
|
508 |
+
for (var i = 0; i < dimension_elements.length; i++) wfu_attach_element_handlers(dimension_elements[i], wfu_update_dimension_value);
|
509 |
+
dimension_elements = document.getElementsByName("wfu_dimension_elements_heights");
|
510 |
+
for (var i = 0; i < dimension_elements.length; i++) wfu_attach_element_handlers(dimension_elements[i], wfu_update_dimension_value);
|
511 |
+
var userfield_elements = document.getElementsByName("wfu_userfield_elements");
|
512 |
+
for (var i = 0; i < userfield_elements.length; i++) wfu_attach_element_handlers(userfield_elements[i], wfu_update_userfield_value);
|
513 |
+
}
|
514 |
+
|
515 |
+
function wfu_insert_variable(obj) {
|
516 |
+
var attr = obj.className.replace("wfu_variable wfu_variable_", "");
|
517 |
+
var inp = document.getElementById("wfu_attribute_" + attr);
|
518 |
+
var pos = inp.selectionStart;
|
519 |
+
var prevval = inp.value;
|
520 |
+
inp.value = prevval.substr(0, pos) + obj.innerHTML + prevval.substr(pos);
|
521 |
+
wfu_update_text_value({target:inp});
|
522 |
+
}
|
js/wordpress_file_upload_functions.js
ADDED
@@ -0,0 +1,1194 @@
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
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Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
1 |
+
GlobalData = {};
|
2 |
+
UploadStates = {};
|
3 |
+
GlobalData.filestatematch = {};
|
4 |
+
GlobalData.filestatematch.success = [0, 1, 2, 2];
|
5 |
+
GlobalData.filestatematch.warning = [1, 1, 2, 2];
|
6 |
+
GlobalData.filestatematch.error1 = [3, 3, 2, 3];
|
7 |
+
GlobalData.filestatematch.error2 = [2, 2, 2, 3];
|
8 |
+
wfu_Check_Browser_Capabilities();
|
9 |
+
//console.log(wfu_BrowserCaps);
|
10 |
+
|
11 |
+
//wfu_Initialize_Consts: function to initialize constants passed from plugin to javascript
|
12 |
+
function wfu_Initialize_Consts(consts) {
|
13 |
+
if (typeof GlobalData.consts != "undefined") return;
|
14 |
+
GlobalData.consts = new Object();
|
15 |
+
var consts_arr = consts.split(";");
|
16 |
+
var const_arr;
|
17 |
+
for (var i = 0; i < consts_arr.length; i++) {
|
18 |
+
const_txt = wfu_plugin_decode_string(consts_arr[i]);
|
19 |
+
const_arr = const_txt.split(":");
|
20 |
+
GlobalData.consts[const_arr[0]] = const_arr[1];
|
21 |
+
}
|
22 |
+
}
|
23 |
+
|
24 |
+
//wfu_Check_Browser_Capabilities: function that checks if browser supports HTML5, iframes and AJAX
|
25 |
+
function wfu_Check_Browser_Capabilities() {
|
26 |
+
if (typeof wfu_BrowserCaps != "undefined") return;
|
27 |
+
wfu_BrowserCaps = new Object();
|
28 |
+
//check AJAX
|
29 |
+
var xmlhttp = wfu_GetHttpRequestObject();
|
30 |
+
wfu_BrowserCaps.supportsAJAX = ( xmlhttp != null );
|
31 |
+
//check Upload Progress
|
32 |
+
wfu_BrowserCaps.supportsUploadProgress = !! (xmlhttp && ('upload' in xmlhttp) && ('onprogress' in xmlhttp.upload));
|
33 |
+
//check HTML5
|
34 |
+
var fd = null;
|
35 |
+
try {
|
36 |
+
var fd = new FormData();
|
37 |
+
}
|
38 |
+
catch(e) {}
|
39 |
+
wfu_BrowserCaps.supportsHTML5 = ( fd != null );
|
40 |
+
//check IFRAME
|
41 |
+
var e = document.createElement("iframe");
|
42 |
+
wfu_BrowserCaps.supportsIFRAME = ( e != null );
|
43 |
+
//check Drag and Drop
|
44 |
+
wfu_BrowserCaps.supportsDRAGDROP = (window.FileReader);
|
45 |
+
//check animation
|
46 |
+
wfu_BrowserCaps.supportsAnimation = wfu_check_animation();
|
47 |
+
}
|
48 |
+
|
49 |
+
//wfu_check_animation: function that checks if CSS3 animation is supported
|
50 |
+
function wfu_check_animation() {
|
51 |
+
var animation = false,
|
52 |
+
animationstring = 'animation',
|
53 |
+
keyframeprefix = '',
|
54 |
+
domPrefixes = 'Webkit Moz O ms Khtml'.split(' '),
|
55 |
+
pfx = '';
|
56 |
+
|
57 |
+
var elm = document.createElement('DIV');
|
58 |
+
|
59 |
+
if( elm.style.animationName ) { animation = true; }
|
60 |
+
|
61 |
+
if( animation === false ) {
|
62 |
+
for( var i = 0; i < domPrefixes.length; i++ ) {
|
63 |
+
if( elm.style[ domPrefixes[i] + 'AnimationName' ] !== undefined ) {
|
64 |
+
pfx = domPrefixes[ i ];
|
65 |
+
animationstring = pfx + 'Animation';
|
66 |
+
keyframeprefix = '-' + pfx.toLowerCase() + '-';
|
67 |
+
animation = true;
|
68 |
+
break;
|
69 |
+
}
|
70 |
+
}
|
71 |
+
}
|
72 |
+
return animation;
|
73 |
+
}
|
74 |
+
|
75 |
+
/* function to join two or more strings using a delimeter */
|
76 |
+
function wfu_join_strings(delimeter) {
|
77 |
+
var args = [].slice.call(arguments);
|
78 |
+
var str = "";
|
79 |
+
var delim = "";
|
80 |
+
for (var i = 1; i < args.length; i++) {
|
81 |
+
if (str == "" || args[i] == "" ) delim = "";
|
82 |
+
else delim = delimeter;
|
83 |
+
str += delim + args[i];
|
84 |
+
}
|
85 |
+
return str;
|
86 |
+
}
|
87 |
+
|
88 |
+
//wfu_plugin_decode_string: function that decodes an encoded string
|
89 |
+
function wfu_plugin_decode_string(str) {
|
90 |
+
var i = 0;
|
91 |
+
var newstr = "";
|
92 |
+
var hex = "";
|
93 |
+
for (i = 0; i < str.length; i += 2) {
|
94 |
+
hex = str.substr(i, 2); //IE6 fix using substr instead of str[i]+str[i+1]
|
95 |
+
newstr += String.fromCharCode(parseInt(hex, 16));
|
96 |
+
}
|
97 |
+
return newstr;
|
98 |
+
}
|
99 |
+
|
100 |
+
//wfu_plugin_encode_string: function that encodes a decoded string
|
101 |
+
function wfu_plugin_encode_string(str) {
|
102 |
+
var i = 0;
|
103 |
+
var newstr = "";
|
104 |
+
var hex = "";
|
105 |
+
for (i = 0; i < str.length; i++) {
|
106 |
+
hex = str.charCodeAt(i).toString(16);
|
107 |
+
if (hex.length == 1) hex = "0" + hex;
|
108 |
+
newstr += hex;
|
109 |
+
}
|
110 |
+
return newstr;
|
111 |
+
}
|
112 |
+
|
113 |
+
//wfu_randomString: generate a random string with a length of len characters
|
114 |
+
function wfu_randomString(len) {
|
115 |
+
var chars = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXTZabcdefghiklmnopqrstuvwxyz";
|
116 |
+
var string_length = len;
|
117 |
+
var randomstring = '';
|
118 |
+
for (var i = 0; i < string_length; i++) {
|
119 |
+
var rnum = Math.floor(Math.random() * chars.length);
|
120 |
+
randomstring += chars.substring(rnum, rnum + 1);
|
121 |
+
}
|
122 |
+
return randomstring;
|
123 |
+
}
|
124 |
+
|
125 |
+
//wfu_addEventHandler: attach event handler to element (cross-browser compatible)
|
126 |
+
function wfu_addEventHandler(obj, evt, handler) {
|
127 |
+
if(obj.addEventListener) {
|
128 |
+
// W3C method
|
129 |
+
obj.addEventListener(evt, handler, false);
|
130 |
+
}
|
131 |
+
else if(obj.attachEvent) {
|
132 |
+
// IE method.
|
133 |
+
obj.attachEvent('on'+evt, handler);
|
134 |
+
}
|
135 |
+
else {
|
136 |
+
// Old school method.
|
137 |
+
obj['on'+evt] = handler;
|
138 |
+
}
|
139 |
+
}
|
140 |
+
|
141 |
+
//wfu_GetHttpRequestObject: function that returns XMLHttpRequest object for various browsers
|
142 |
+
function wfu_GetHttpRequestObject() {
|
143 |
+
var xhr = null;
|
144 |
+
try {
|
145 |
+
xhr = new XMLHttpRequest();
|
146 |
+
}
|
147 |
+
catch(e) {
|
148 |
+
try {
|
149 |
+
xhr = new ActiveXObject("Msxml2.XMLHTTP");
|
150 |
+
}
|
151 |
+
catch (e2) {
|
152 |
+
try {
|
153 |
+
xhr = new ActiveXObject("Microsoft.XMLHTTP");
|
154 |
+
}
|
155 |
+
catch (e) {}
|
156 |
+
}
|
157 |
+
}
|
158 |
+
if (xhr == null && window.createRequest) {
|
159 |
+
try {
|
160 |
+
xmlhttp = window.createRequest();
|
161 |
+
}
|
162 |
+
catch (e) {}
|
163 |
+
}
|
164 |
+
return xhr;
|
165 |
+
}
|
166 |
+
|
167 |
+
//wfu_filedetails_showhide: function to show or hide file messages
|
168 |
+
function wfu_filedetails_showhide(sid, fileid, show) {
|
169 |
+
var item1 = document.getElementById('wfu_messageblock_arrow_' + sid + '_' + fileid);
|
170 |
+
var item2 = document.getElementById('wfu_messageblock_arrow_' + sid + '_up_' + fileid);
|
171 |
+
var item3 = document.getElementById('wfu_messageblock_arrow_' + sid + '_down_' + fileid);
|
172 |
+
var item4 = document.getElementById('wfu_messageblock_subheader_' + sid + '_' + fileid);
|
173 |
+
var item5 = document.getElementById('wfu_messageblock_header_' + sid + '_state_' + fileid);
|
174 |
+
if (show) {
|
175 |
+
item2.style.display = "";
|
176 |
+
item3.style.display = "none";
|
177 |
+
item4.style.display = "";
|
178 |
+
item5.value = "";
|
179 |
+
}
|
180 |
+
else {
|
181 |
+
item2.style.display = "none";
|
182 |
+
item3.style.display = "";
|
183 |
+
item4.style.display = "none";
|
184 |
+
item5.value = "none";
|
185 |
+
}
|
186 |
+
}
|
187 |
+
|
188 |
+
//wfu_get_file_ids: function to get an array with ids of files already uploaded
|
189 |
+
function wfu_get_file_ids(sid) {
|
190 |
+
var message_table = document.getElementById('wfu_messageblock_' + sid);
|
191 |
+
var next_block = document.getElementById('wfu_messageblock_subheader_' + sid).nextSibling;
|
192 |
+
var prefix = 'wfu_messageblock_' + sid + '_';
|
193 |
+
var file_ids = [];
|
194 |
+
while (next_block != null) {
|
195 |
+
if (next_block.nodeType === 1 && next_block.id.substr(0, prefix.length) == prefix)
|
196 |
+
file_ids.push(next_block.id.substr(next_block.id.lastIndexOf("_") + 1));
|
197 |
+
next_block = next_block.nextSibling;
|
198 |
+
}
|
199 |
+
return file_ids;
|
200 |
+
}
|
201 |
+
|
202 |
+
//wfu_filedetails_toggle: function to toggle file messages visibility
|
203 |
+
function wfu_filedetails_toggle(sid, fileid) {
|
204 |
+
var item1 = document.getElementById('wfu_messageblock_arrow_' + sid + '_' + fileid);
|
205 |
+
var item2 = document.getElementById('wfu_messageblock_arrow_' + sid + '_up_' + fileid);
|
206 |
+
wfu_filedetails_showhide(sid, fileid, item2.style.display == "none");
|
207 |
+
}
|
208 |
+
|
209 |
+
//wfu_headerdetails_showhide: function to show or hide header messages and upload results for each uploaded file
|
210 |
+
function wfu_headerdetails_showhide(sid, show) {
|
211 |
+
var item1 = document.getElementById('wfu_messageblock_arrow_' + sid);
|
212 |
+
var item2 = document.getElementById('wfu_messageblock_arrow_' + sid + '_up');
|
213 |
+
var item3 = document.getElementById('wfu_messageblock_arrow_' + sid + '_down');
|
214 |
+
var item4 = document.getElementById('wfu_messageblock_subheader_' + sid);
|
215 |
+
var item5 = document.getElementById('wfu_messageblock_subheader_' + sid + '_message');
|
216 |
+
var item6 = document.getElementById('wfu_messageblock_subheader_' + sid + '_adminmessage');
|
217 |
+
var item7 = document.getElementById('wfu_messageblock_header_' + sid + '_state');
|
218 |
+
var file_ids = wfu_get_file_ids(sid);
|
219 |
+
if (show) {
|
220 |
+
item2.style.display = "";
|
221 |
+
item3.style.display = "none";
|
222 |
+
if ( item5.style.display != "none" || item6.style.display != "none" ) item4.style.display = "";
|
223 |
+
item7.value = "";
|
224 |
+
for (var i = 0; i < file_ids.length; i++) {
|
225 |
+
document.getElementById('wfu_messageblock_' + sid + '_' + file_ids[i]).style.display = "";
|
226 |
+
document.getElementById('wfu_messageblock_subheader_' + sid + '_' + file_ids[i]).style.display = document.getElementById('wfu_messageblock_header_' + sid + '_state_' + file_ids[i]).value;
|
227 |
+
}
|
228 |
+
}
|
229 |
+
else {
|
230 |
+
item2.style.display = "none";
|
231 |
+
item3.style.display = "";
|
232 |
+
item4.style.display = "none";
|
233 |
+
item7.value = "none";
|
234 |
+
for (var i = 0; i < file_ids.length; i++) {
|
235 |
+
document.getElementById('wfu_messageblock_' + sid + '_' + file_ids[i]).style.display = "none";
|
236 |
+
document.getElementById('wfu_messageblock_subheader_' + sid + '_' + file_ids[i]).style.display = "none";
|
237 |
+
}
|
238 |
+
}
|
239 |
+
}
|
240 |
+
|
241 |
+
//wfu_headerdetails_toggle: function to toggle header messages and file results visibility
|
242 |
+
function wfu_headerdetails_toggle(sid) {
|
243 |
+
var item1 = document.getElementById('wfu_messageblock_arrow_' + sid);
|
244 |
+
var item2 = document.getElementById('wfu_messageblock_arrow_' + sid + '_up');
|
245 |
+
wfu_headerdetails_showhide(sid, item2.style.display == "none");
|
246 |
+
}
|
247 |
+
|
248 |
+
|
249 |
+
//wfu_selectbutton_changed: function that executes when files have been selected
|
250 |
+
function wfu_selectbutton_changed(sid, usefilearray) {
|
251 |
+
//if browser cannot handle HTML5 AJAX requests then deactivate use of array to store uploaded files
|
252 |
+
if (!wfu_BrowserCaps.supportsAJAX || !wfu_BrowserCaps.supportsHTML5) usefilearray = 0;
|
253 |
+
|
254 |
+
var inputfile = document.getElementById("upfile_" + sid);
|
255 |
+
var farr = inputfile.files;
|
256 |
+
//fix in case files attribute is not supported
|
257 |
+
if (!farr) { if (inputfile.value) farr = [{name:inputfile.value}]; else farr = []; }
|
258 |
+
//update textbox with filename of the file to be uploaded
|
259 |
+
var ftext = document.getElementById("fileName_" + sid);
|
260 |
+
if (ftext) ftext.value = inputfile.value.replace(/c:\\fakepath\\/i, "");
|
261 |
+
//if use of array is possible to store filelist, then create it and append selected files
|
262 |
+
if (usefilearray == 1) {
|
263 |
+
if (typeof inputfile.filearray == "undefined") {
|
264 |
+
inputfile.filearray = Array();
|
265 |
+
}
|
266 |
+
for (var i = 0; i < farr.length; i++) {
|
267 |
+
inputfile.filearray.push(farr[i]);
|
268 |
+
}
|
269 |
+
}
|
270 |
+
}
|
271 |
+
|
272 |
+
//wfu_selectbutton_clicked: function that executes when select button is clicked
|
273 |
+
function wfu_selectbutton_clicked(sid) {
|
274 |
+
var message_container = document.getElementById("wordpress_file_upload_message_" + sid);
|
275 |
+
if (message_container) message_container.style.display = "none";
|
276 |
+
wfu_reset_message(sid);
|
277 |
+
document.getElementById("upfile_" + sid).value = "";
|
278 |
+
var ftext = document.getElementById("fileName_" + sid);
|
279 |
+
if (ftext) {
|
280 |
+
ftext.value = "";
|
281 |
+
ftext.className = "file_input_textbox";
|
282 |
+
}
|
283 |
+
}
|
284 |
+
|
285 |
+
//wfu_RunWPFileBaseHttpRequest: function to update WP-FileBase plugin
|
286 |
+
function wfu_RunWPFileBaseHttpRequest(filebaseurl) {
|
287 |
+
var xmlhttp = wfu_GetHttpRequestObject();
|
288 |
+
if (xmlhttp == null) {
|
289 |
+
//alternative way of sending GET request using IFRAME, in case AJAX is disabled
|
290 |
+
var i = document.createElement("iframe");
|
291 |
+
i.style.display = "none";
|
292 |
+
i.src = filebaseurl;
|
293 |
+
document.body.appendChild(i);
|
294 |
+
return;
|
295 |
+
}
|
296 |
+
|
297 |
+
xmlhttp.open("GET", filebaseurl, true);
|
298 |
+
xmlhttp.onreadystatechange=function() {
|
299 |
+
if (xmlhttp.readyState==4) {
|
300 |
+
}
|
301 |
+
}
|
302 |
+
xmlhttp.send(null);
|
303 |
+
}
|
304 |
+
|
305 |
+
//wfu_Redirect: function to redirect to another url
|
306 |
+
function wfu_Redirect(link) {
|
307 |
+
window.location = link;
|
308 |
+
}
|
309 |
+
|
310 |
+
//wfu_loadStrat: function to start upload of file
|
311 |
+
function wfu_loadStart(evt) {
|
312 |
+
}
|
313 |
+
|
314 |
+
//wfu_uploadProgress: function to update progress bar
|
315 |
+
function wfu_uploadProgress(evt) {
|
316 |
+
var sid = this.xhr.shortcode_id;
|
317 |
+
var percentComplete = 0;
|
318 |
+
var simplebar = document.getElementById('progressbar_' + sid + '_animation');
|
319 |
+
if (evt.lengthComputable) {
|
320 |
+
if (this.xhr.size == 0) this.xhr.size = evt.total;
|
321 |
+
if (simplebar) {
|
322 |
+
var total = 0;
|
323 |
+
var totalloaded = 0;
|
324 |
+
for (var i = 0; i < GlobalData[sid].xhrs.length; i++) {
|
325 |
+
total += GlobalData[sid].xhrs[i].size;
|
326 |
+
totalloaded += GlobalData[sid].xhrs[i].sizeloaded;
|
327 |
+
}
|
328 |
+
percentComplete = Math.round((totalloaded + evt.loaded - this.xhr.sizeloaded) * 100 / total);
|
329 |
+
simplebar.style.width = percentComplete.toString() + '%';
|
330 |
+
}
|
331 |
+
this.xhr.sizeloaded = evt.loaded;
|
332 |
+
}
|
333 |
+
else {
|
334 |
+
if (simplebar) simplebar.style.width = '0%';
|
335 |
+
}
|
336 |
+
}
|
337 |
+
|
338 |
+
/* wfu_notify_WPFilebase: function to notify WPFilebase plugin about file changes */
|
339 |
+
function wfu_notify_WPFilebase(url) {
|
340 |
+
wfu_RunWPFileBaseHttpRequest(url + "/wp-admin/tools.php?page=wpfilebase&action=sync&hash_sync=1");
|
341 |
+
//addition to support newer versions of WP-Filebase
|
342 |
+
wfu_RunWPFileBaseHttpRequest(url + "/wp-admin/admin.php?page=wpfilebase_manage&action=sync&hash_sync=1");
|
343 |
+
}
|
344 |
+
|
345 |
+
/* wfu_send_email_notification: function to send notification message as ajax request */
|
346 |
+
function wfu_send_email_notification(sid, unique_id, params_index, session_token, notify_only_filename_list, notify_target_path_list, notify_attachment_list) {
|
347 |
+
var xhr = wfu_GetHttpRequestObject();
|
348 |
+
if (xhr == null) {
|
349 |
+
// error sending email
|
350 |
+
return;
|
351 |
+
}
|
352 |
+
|
353 |
+
var url = '/wp-admin/admin-ajax.php';
|
354 |
+
var userdata_count = wfu_get_userdata_count(sid);
|
355 |
+
params = new Array(7 + userdata_count);
|
356 |
+
params[0] = new Array(2);
|
357 |
+
params[0][0] = 'action';
|
358 |
+
params[0][1] = 'wfu_ajax_action_send_email_notification';
|
359 |
+
params[1] = new Array(2);
|
360 |
+
params[1][0] = 'params_index';
|
361 |
+
params[1][1] = params_index;
|
362 |
+
params[2] = new Array(2);
|
363 |
+
params[2][0] = 'session_token';
|
364 |
+
params[2][1] = session_token;
|
365 |
+
params[3] = new Array(2);
|
366 |
+
params[3][0] = 'only_filename_list';
|
367 |
+
params[3][1] = notify_only_filename_list;
|
368 |
+
params[4] = new Array(2);
|
369 |
+
params[4][0] = 'target_path_list';
|
370 |
+
params[4][1] = notify_target_path_list;
|
371 |
+
params[5] = new Array(2);
|
372 |
+
params[5][0] = 'attachment_list';
|
373 |
+
params[5][1] = notify_attachment_list;
|
374 |
+
params[6] = new Array(2);
|
375 |
+
params[6][0] = 'unique_id';
|
376 |
+
params[6][1] = unique_id;
|
377 |
+
for (var i = 0; i < userdata_count; i++) {
|
378 |
+
params[7 + i] = new Array(2);
|
379 |
+
params[7 + i][0] = 'userdata_' + i;
|
380 |
+
params[7 + i][1] = document.getElementById('hiddeninput_' + sid + '_userdata_' + i).value;
|
381 |
+
}
|
382 |
+
|
383 |
+
var parameters = '';
|
384 |
+
for (var i = 0; i < params.length; i++) {
|
385 |
+
parameters += (i > 0 ? "&" : "") + params[i][0] + "=" + encodeURI(params[i][1]);
|
386 |
+
}
|
387 |
+
|
388 |
+
xhr.shortcode_id = sid;
|
389 |
+
xhr.file_id = 0;
|
390 |
+
xhr.unique_id = unique_id;
|
391 |
+
xhr.params_index = params_index;
|
392 |
+
xhr.session_token = session_token;
|
393 |
+
xhr.open("POST", url, true);
|
394 |
+
xhr.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
|
395 |
+
xhr.setRequestHeader("Content-length", parameters.length);
|
396 |
+
xhr.setRequestHeader("Connection", "close");
|
397 |
+
xhr.addEventListener("load", wfu_uploadComplete, false);
|
398 |
+
xhr.addEventListener("error", wfu_uploadFailed, false);
|
399 |
+
xhr.addEventListener("abort", wfu_uploadCanceled, false);
|
400 |
+
|
401 |
+
xhr.send(parameters);
|
402 |
+
}
|
403 |
+
|
404 |
+
//wfu_uploadComplete: function that is called after successfull file upload
|
405 |
+
function wfu_uploadComplete(evt) {
|
406 |
+
var sid = this.shortcode_id;
|
407 |
+
var i = this.file_id;
|
408 |
+
var last = false;
|
409 |
+
var upload_params = "";
|
410 |
+
var safe_params = "";
|
411 |
+
if (evt.target.responseText != -1) {
|
412 |
+
var txt = evt.target.responseText;
|
413 |
+
var pos = txt.indexOf(":");
|
414 |
+
var txt_header = txt.substr(0, pos);
|
415 |
+
var txt_value = txt.substr(pos + 1, txt.length - pos - 1);
|
416 |
+
if (txt_header == "success") {
|
417 |
+
pos = txt_value.indexOf(":");
|
418 |
+
safe_params = txt_value.substr(0, pos);
|
419 |
+
upload_params = txt_value.substr(pos + 1, txt_value.length - pos - 1);
|
420 |
+
}
|
421 |
+
}
|
422 |
+
|
423 |
+
if (upload_params == "" || safe_params == "") {
|
424 |
+
var error_colors = this.fail_colors.split(",");
|
425 |
+
var Params = wfu_Initialize_Params();
|
426 |
+
Params.general.shortcode_id = sid;
|
427 |
+
Params.general.unique_id = this.unique_id;
|
428 |
+
Params.general.state = 7;
|
429 |
+
Params.general.files_count = 1;
|
430 |
+
Params.general.upload_finish_time = this.finish_time;
|
431 |
+
Params.general.fail_message = this.error_message_unknown;
|
432 |
+
Params.general.fail_admin_message = this.error_adminmessage_unknown;
|
433 |
+
Params[0] = {};
|
434 |
+
Params[0]['color'] = error_colors[0];
|
435 |
+
Params[0]['bgcolor'] = error_colors[1];
|
436 |
+
Params[0]['borcolor'] = error_colors[2];
|
437 |
+
Params[0]['message_type'] = "error";
|
438 |
+
Params[0]['header'] = this.error_message_header;
|
439 |
+
Params[0]['message'] = this.error_message_timelimit;
|
440 |
+
Params[0]['admin_messages'] = this.error_message_admin_timelimit;
|
441 |
+
// if upload_finish_time is non-zero, then we have a failed upload, probably due to exceeded upload time limit
|
442 |
+
if (Params.general.upload_finish_time > 0) {
|
443 |
+
var d = new Date();
|
444 |
+
if (d.getTime() < Params.general.upload_finish_time) {
|
445 |
+
Params[0]['message'] = Params.general.fail_message;
|
446 |
+
Params[0]['admin_messages'] = Params.general.fail_admin_message;
|
447 |
+
}
|
448 |
+
}
|
449 |
+
// note that upload_params is passed as object, so no need to pass a safe_output string
|
450 |
+
last = wfu_ProcessUploadComplete(sid, this.file_id, Params, this.unique_id, this.params_index, this.session_token, "");
|
451 |
+
}
|
452 |
+
else {
|
453 |
+
last = wfu_ProcessUploadComplete(sid, this.file_id, upload_params, this.unique_id, this.params_index, this.session_token, safe_params);
|
454 |
+
}
|
455 |
+
if (last) {
|
456 |
+
wfu_unlock_upload(evt.target.shortcode_id);
|
457 |
+
wfu_hide_simple_progressbar(sid);
|
458 |
+
wfu_clear(evt.target.shortcode_id);
|
459 |
+
}
|
460 |
+
}
|
461 |
+
|
462 |
+
//wfu_ProcessUploadComplete: function to perform actions after successfull upload
|
463 |
+
function wfu_ProcessUploadComplete(sid, file_id, upload_params, unique_id, params_index, session_token, safe_output) {
|
464 |
+
//initial checks to process or not the data
|
465 |
+
if (!sid || sid < 0) return;
|
466 |
+
if (upload_params == null || upload_params == "") return;
|
467 |
+
if (unique_id == "") return;
|
468 |
+
if (unique_id != "no-ajax" && !GlobalData[sid]) return;
|
469 |
+
|
470 |
+
var do_redirect = false;
|
471 |
+
|
472 |
+
if (typeof upload_params === "string") {
|
473 |
+
upload_params = wfu_plugin_decode_string(upload_params.replace(/^\s+|\s+$/g,""));
|
474 |
+
var Params = null;
|
475 |
+
try { Params = JSON.parse(upload_params); }
|
476 |
+
catch(e) {}
|
477 |
+
if (Params == null) {
|
478 |
+
// JSON parse error that does not allow to read the parameters of the upload. The safe output string will be used in place.
|
479 |
+
var safe_parts = safe_output.split(";");
|
480 |
+
Params = wfu_Initialize_Params();
|
481 |
+
Params.general.shortcode_id = sid;
|
482 |
+
Params.general.unique_id = unique_id;
|
483 |
+
Params.general.state = safe_parts[0];
|
484 |
+
// upload state cannot be 4, because we have json warnings
|
485 |
+
if (Params.general.state == 4) Params.general.state++;
|
486 |
+
var default_colors = safe_parts[1].split(",");
|
487 |
+
var filedata = "";
|
488 |
+
var error_jsonparse_filemessage = GlobalData.consts.jsonparse_filemessage;
|
489 |
+
var error_jsonparse_message = GlobalData.consts.jsonparse_message;
|
490 |
+
var error_jsonparse_adminmessage = GlobalData.consts.jsonparse_adminmessage;
|
491 |
+
Params.general.files_count = parseInt(safe_parts[2]);
|
492 |
+
for (var i = 0; i < Params.general.files_count; i++) {
|
493 |
+
Params[i] = {};
|
494 |
+
Params[i]['color'] = default_colors[0];
|
495 |
+
Params[i]['bgcolor'] = default_colors[1];
|
496 |
+
Params[i]['borcolor'] = default_colors[2];
|
497 |
+
filedata = safe_parts[i + 3].split(",");
|
498 |
+
Params[i]['message_type'] = wfu_plugin_decode_string(filedata[0]);
|
499 |
+
Params[i]['header'] = wfu_plugin_decode_string(filedata[1]);
|
500 |
+
if (Params[i]['message_type'] == "success") {
|
501 |
+
Params[i]['header'] += error_jsonparse_filemessage;
|
502 |
+
Params[i]['message_type'] = "warning";
|
503 |
+
}
|
504 |
+
Params[i]['message'] = wfu_join_strings("<br />", error_jsonparse_message, wfu_plugin_decode_string(filedata[2]));
|
505 |
+
Params[i]['admin_messages'] = wfu_join_strings("<br />", error_jsonparse_adminmessage, wfu_plugin_decode_string(filedata[3]));
|
506 |
+
}
|
507 |
+
}
|
508 |
+
}
|
509 |
+
// include case for results returned straight as object in case of error or wait state
|
510 |
+
else if (typeof upload_params === "object") var Params = upload_params;
|
511 |
+
else return;
|
512 |
+
|
513 |
+
var message_table = document.getElementById('wfu_messageblock_' + sid);
|
514 |
+
|
515 |
+
// initialize UploadStates object, if not already initialized and if message box is activated
|
516 |
+
var UploadStates_Ok = true;
|
517 |
+
if (!UploadStates[sid] && message_table) {
|
518 |
+
var upload_states = document.getElementById('wfu_messageblock_header_' + sid + '_states').value;
|
519 |
+
upload_states = wfu_plugin_decode_string(upload_states.replace(/^\s+|\s+$/g,""));
|
520 |
+
UploadStates[sid] = null;
|
521 |
+
try { UploadStates[sid] = JSON.parse(upload_states); }
|
522 |
+
catch(e) {}
|
523 |
+
if (UploadStates[sid] == null) {
|
524 |
+
// JSON parse error that does not allow to show and style accordingly the header message. A generic JSON parse error message will be shown
|
525 |
+
UploadStates_Ok = false;
|
526 |
+
}
|
527 |
+
}
|
528 |
+
|
529 |
+
// pass upload parameters to GlobalData object, which is used to configure the message contents
|
530 |
+
if (!GlobalData[sid]) GlobalData[sid] = Object();
|
531 |
+
var G = GlobalData[sid];
|
532 |
+
// in case of no-ajax method, simply pass upload parameters to GlobalData object
|
533 |
+
if (unique_id == "no-ajax") {
|
534 |
+
G.last = false;
|
535 |
+
G.unique_id = "";
|
536 |
+
G.files_count = Params.general.files_count;
|
537 |
+
if (Params.general.state == 0) Params.general.files_count = 0;
|
538 |
+
G.files_processed = Params.general.files_count;
|
539 |
+
if (UploadStates_Ok) G.upload_state = Params.general.state;
|
540 |
+
// if UploadStates could not be parsed, then set header state to JSON error (state 10)
|
541 |
+
else G.upload_state = 10;
|
542 |
+
G.message = Params.general.message;
|
543 |
+
G.update_wpfilebase = Params.general.update_wpfilebase;
|
544 |
+
G.redirect_link = Params.general.redirect_link;
|
545 |
+
G.notify_only_filename_list = ""; //in the case of no-ajax method, email notification has already been executed by php, so it is suppressed here
|
546 |
+
G.notify_target_path_list = "";
|
547 |
+
G.notify_attachment_list = "";
|
548 |
+
G.admin_messages = {};
|
549 |
+
G.admin_messages.wpfilebase = Params.general.admin_messages.wpfilebase;
|
550 |
+
G.admin_messages.notify = Params.general.admin_messages.notify;
|
551 |
+
G.admin_messages.redirect = Params.general.admin_messages.redirect;
|
552 |
+
G.admin_messages.other = Params.general.admin_messages.other;
|
553 |
+
G.errors = {};
|
554 |
+
G.errors.wpfilebase = Params.general.errors.wpfilebase;
|
555 |
+
G.errors.notify = Params.general.errors.notify;
|
556 |
+
G.errors.redirect = Params.general.errors.redirect;
|
557 |
+
G.current_size = 0;
|
558 |
+
G.total_size = 0;
|
559 |
+
}
|
560 |
+
else {
|
561 |
+
if (G.unique_id == "" || G.unique_id != unique_id || G.unique_id != Params.general.unique_id) return;
|
562 |
+
if (G.last) return;
|
563 |
+
var file_status = "";
|
564 |
+
for (var i = 0; i < Params.general.files_count; i++) {
|
565 |
+
// define new upload state based on the status of current file
|
566 |
+
if (Params[i].message_type == "error" && G.files_processed == 0) file_status = "error1";
|
567 |
+
else if (Params[i].message_type == "error" && G.files_processed > 0) file_status = "error2";
|
568 |
+
else file_status = Params[i].message_type;
|
569 |
+
G.upload_state = GlobalData.filestatematch[file_status][G.upload_state];
|
570 |
+
}
|
571 |
+
// if UploadStates could not be parsed, then set header state to JSON error (state 10)
|
572 |
+
if (!UploadStates_Ok) G.upload_state = 10;
|
573 |
+
G.files_processed += Params.general.files_count;
|
574 |
+
G.message = wfu_join_strings("<br />", G.message, Params.general.message);
|
575 |
+
if (G.update_wpfilebase == "") G.update_wpfilebase = Params.general.update_wpfilebase;
|
576 |
+
if (G.redirect_link == "") G.redirect_link = Params.general.redirect_link;
|
577 |
+
G.notify_only_filename_list = wfu_join_strings(", ", G.notify_only_filename_list, Params.general.notify_only_filename_list);
|
578 |
+
G.notify_target_path_list = wfu_join_strings(", ", G.notify_target_path_list, Params.general.notify_target_path_list);
|
579 |
+
G.notify_attachment_list = wfu_join_strings(",", G.notify_attachment_list, Params.general.notify_attachment_list);
|
580 |
+
G.admin_messages.other = wfu_join_strings("<br />", G.admin_messages.other, Params.general.admin_messages.other);
|
581 |
+
if (G.admin_messages.wpfilebase == "") G.admin_messages.wpfilebase = Params.general.admin_messages.wpfilebase;
|
582 |
+
if (G.admin_messages.notify == "") G.admin_messages.notify = Params.general.admin_messages.notify;
|
583 |
+
if (G.admin_messages.redirect == "") G.admin_messages.redirect = Params.general.admin_messages.redirect;
|
584 |
+
if (G.errors.wpfilebase == "") G.errors.wpfilebase = Params.general.errors.wpfilebase;
|
585 |
+
if (G.errors.notify == "") G.errors.notify = Params.general.errors.notify;
|
586 |
+
if (G.errors.redirect == "") G.errors.redirect = Params.general.errors.redirect;
|
587 |
+
}
|
588 |
+
// adjust upload parameters if this is the last combined call to this function
|
589 |
+
if (G.files_processed == G.files_count) {
|
590 |
+
G.last = true;
|
591 |
+
|
592 |
+
// prepare and execute actions related to WPFilebase, email notifications and redirection if this is the last call
|
593 |
+
if (G.update_wpfilebase != "") {
|
594 |
+
G.admin_messages.wpfilebase = "";
|
595 |
+
wfu_notify_WPFilebase(G.update_wpfilebase);
|
596 |
+
}
|
597 |
+
if (G.notify_only_filename_list != "") {
|
598 |
+
G.admin_messages.notify = "";
|
599 |
+
wfu_send_email_notification(sid, unique_id, params_index, session_token, G.notify_only_filename_list, G.notify_target_path_list, G.notify_attachment_list);
|
600 |
+
// in email notification we declare that this is not the last call, because we wait for a last answer from email sending result
|
601 |
+
G.last = false;
|
602 |
+
G.notify_only_filename_list = ""; //reset this variable so that repetitive email messages are not sent
|
603 |
+
}
|
604 |
+
if (G.errors.redirect != "") G.redirect_link = "";
|
605 |
+
if (G.redirect_link != "") {
|
606 |
+
// if redirection is executed, then set upload state to redirecting...
|
607 |
+
G.upload_state = 11;
|
608 |
+
do_redirect = true;
|
609 |
+
// wfu_Redirect(G.redirect_link);
|
610 |
+
}
|
611 |
+
}
|
612 |
+
|
613 |
+
// last adjustment of header messages due to json parse error of UploadState
|
614 |
+
var nonadmin_message = G.message;
|
615 |
+
var admin_message = wfu_join_strings("<br />",
|
616 |
+
Params.general.admin_messages.other,
|
617 |
+
Params.general.admin_messages.wpfilebase,
|
618 |
+
Params.general.admin_messages.notify,
|
619 |
+
Params.general.admin_messages.redirect);
|
620 |
+
if (!UploadStates_Ok) {
|
621 |
+
var error_jsonparse_headermessage = GlobalData.consts.jsonparse_headermessage;
|
622 |
+
var error_jsonparse_headeradminmessage = GlobalData.consts.jsonparse_headeradminmessage;
|
623 |
+
nonadmin_message = wfu_join_strings("<br />", error_jsonparse_headermessage, nonadmin_message);
|
624 |
+
admin_message = wfu_join_strings("<br />", error_jsonparse_headeradminmessage, admin_message);
|
625 |
+
}
|
626 |
+
|
627 |
+
if (G.last) {
|
628 |
+
// update upload state
|
629 |
+
if (G.files_count == 0) G.upload_state = 8;
|
630 |
+
else if (G.upload_state < 4) G.upload_state += 4;
|
631 |
+
// final adjust of upload state because admin messages may have been modified
|
632 |
+
var admin_messages_exist = (G.admin_messages.wpfilebase != "" || G.admin_messages.notify != "" || G.admin_messages.redirect != "" || G.admin_messages.other != "");
|
633 |
+
if (G.upload_state == 4 && admin_message != "") G.upload_state ++;
|
634 |
+
else if (G.upload_state == 5 && !admin_message == "" && nonadmin_message == "") G.upload_state --;
|
635 |
+
}
|
636 |
+
|
637 |
+
// if (typeof console != "undefined") {
|
638 |
+
// console.log(Params);
|
639 |
+
// var GG = G;
|
640 |
+
// console.log(GG);
|
641 |
+
// }
|
642 |
+
|
643 |
+
// section to update message box, executed only if message box is activated
|
644 |
+
if (message_table) {
|
645 |
+
var subheader_state = document.getElementById('wfu_messageblock_header_' + sid + '_state');
|
646 |
+
var single_file_shown = (G.files_count == 1 && nonadmin_message == "" && admin_message == "" && G.last && !do_redirect);
|
647 |
+
// adjust header if must be shown
|
648 |
+
if (single_file_shown) {
|
649 |
+
document.getElementById('wfu_messageblock_header_' + sid).style.display = "none";
|
650 |
+
}
|
651 |
+
else {
|
652 |
+
document.getElementById('wfu_messageblock_header_' + sid).style.display = "";
|
653 |
+
var header_container = document.getElementById('wfu_messageblock_header_' + sid + '_container');
|
654 |
+
if (UploadStates_Ok) {
|
655 |
+
var suffix = "";
|
656 |
+
if (G.files_count == 1 && (G.upload_state == 5 || G.upload_state == 7)) suffix = "_singlefile";
|
657 |
+
header_container.innerHTML = UploadStates[sid]["State" + G.upload_state + suffix];
|
658 |
+
}
|
659 |
+
else {
|
660 |
+
header_container.innerHTML = "";
|
661 |
+
var safe_container = document.getElementById('wfu_messageblock_header_' + sid + '_safecontainer');
|
662 |
+
header_container.innerHTML = safe_container.innerHTML.replace(/_safe/g, "");
|
663 |
+
}
|
664 |
+
|
665 |
+
// adjust subheader message
|
666 |
+
var subheader_show = false;
|
667 |
+
if (nonadmin_message != "") {
|
668 |
+
document.getElementById('wfu_messageblock_subheader_' + sid + '_message').style.display = "";
|
669 |
+
document.getElementById('wfu_messageblock_subheader_' + sid + '_messagelabel').innerHTML = nonadmin_message;
|
670 |
+
subheader_show = true;
|
671 |
+
}
|
672 |
+
else
|
673 |
+
document.getElementById('wfu_messageblock_subheader_' + sid + '_message').style.display = "none";
|
674 |
+
|
675 |
+
// adjust subheader admin message
|
676 |
+
if (admin_message != "") {
|
677 |
+
document.getElementById('wfu_messageblock_subheader_' + sid + '_adminmessage').style.display = "";
|
678 |
+
document.getElementById('wfu_messageblock_subheader_' + sid + '_adminmessagelabel').innerHTML = admin_message;
|
679 |
+
subheader_show = true;
|
680 |
+
}
|
681 |
+
else
|
682 |
+
document.getElementById('wfu_messageblock_subheader_' + sid + '_adminmessage').style.display = "none";
|
683 |
+
|
684 |
+
// adjust subheader
|
685 |
+
if (subheader_show)
|
686 |
+
document.getElementById('wfu_messageblock_subheader_' + sid).style.display = subheader_state.value;
|
687 |
+
else
|
688 |
+
document.getElementById('wfu_messageblock_subheader_' + sid).style.display = "none";
|
689 |
+
|
690 |
+
// adjust header arrow
|
691 |
+
if (subheader_show || G.files_processed > 0) {
|
692 |
+
header_container.colSpan = 2;
|
693 |
+
document.getElementById('wfu_messageblock_arrow_' + sid).style.display = "";
|
694 |
+
}
|
695 |
+
else {
|
696 |
+
document.getElementById('wfu_messageblock_arrow_' + sid).style.display = "none";
|
697 |
+
header_container.colSpan = 3;
|
698 |
+
}
|
699 |
+
}
|
700 |
+
var next_block = document.getElementById('wfu_messageblock_subheader_' + sid);
|
701 |
+
var next_block_id = 0;
|
702 |
+
|
703 |
+
// insert file blocks
|
704 |
+
var file_block = null;
|
705 |
+
var file_template_container = document.getElementById('wfu_messageblock_' + sid + '_filetemplate');
|
706 |
+
var file_contents = "";
|
707 |
+
var door = document.getElementById('wfu_messageblock_' + sid + '_door');
|
708 |
+
var ii = 0;
|
709 |
+
var headerspan = 1;
|
710 |
+
var subheaderspan = 2;
|
711 |
+
var file_template = wfu_plugin_decode_string(file_template_container.value.replace(/^\s+|\s+$/g,""));
|
712 |
+
for (var i = 0; i < Params.general.files_count; i++) {
|
713 |
+
ii = i + file_id;
|
714 |
+
// replace template variables with file data
|
715 |
+
file_contents = file_template.replace(/\[file_id\]/g, ii);
|
716 |
+
file_contents = file_contents.replace(/\[filenumber_display\]/g, "");
|
717 |
+
file_contents = file_contents.replace(/\[fileheader_color\]/g, Params[i].color);
|
718 |
+
file_contents = file_contents.replace(/\[fileheader_bgcolor\]/g, Params[i].bgcolor);
|
719 |
+
file_contents = file_contents.replace(/\[fileheader_borcolor\]/g, Params[i].borcolor);
|
720 |
+
file_contents = file_contents.replace(/\[fileheader_message\]/g, Params[i].header);
|
721 |
+
file_contents = file_contents.replace(/\[filesubheadermessage_display\]/g, "style=\"display:none;\"");
|
722 |
+
file_contents = file_contents.replace(/\[filesubheader_message\]/g, Params[i].message);
|
723 |
+
file_contents = file_contents.replace(/\[filesubheaderadminmessage_display\]/g, "style=\"display:none;\"");
|
724 |
+
file_contents = file_contents.replace(/\[filesubheader_adminmessage\]/g, Params[i].admin_messages);
|
725 |
+
// put file contents to temp div element to convert them to HTML elements
|
726 |
+
file_contents = "<table><tbody>" + file_contents + "</tbody></table>"; //IE6 fix: door is a div element so that innerHTML is writable
|
727 |
+
door.innerHTML = file_contents;
|
728 |
+
// post process created file block to adjust visibility of its contents
|
729 |
+
headerspan = 1;
|
730 |
+
subheaderspan = 2;
|
731 |
+
subheader_show = false;
|
732 |
+
file_block = document.getElementById('wfu_messageblock_' + sid + '_' + ii);
|
733 |
+
if (G.files_count == 1) {
|
734 |
+
document.getElementById('wfu_messageblock_' + sid + '_filenumber_' + ii).style.display = "none";
|
735 |
+
document.getElementById('wfu_messageblock_subheader_' + sid + '_fileempty_' + ii).style.display = "none";
|
736 |
+
if (single_file_shown) file_block.style.display = "";
|
737 |
+
else file_block.style.display = subheader_state.value;
|
738 |
+
headerspan ++;
|
739 |
+
subheaderspan ++;
|
740 |
+
}
|
741 |
+
else file_block.style.display = subheader_state.value;
|
742 |
+
if (Params[i].message != "") {
|
743 |
+
document.getElementById('wfu_messageblock_subheader_' + sid + '_message_' + ii).style.display = "";
|
744 |
+
subheader_show = true;
|
745 |
+
}
|
746 |
+
if (Params[i].admin_messages != "") {
|
747 |
+
document.getElementById('wfu_messageblock_subheader_' + sid + '_adminmessage_' + ii).style.display = "";
|
748 |
+
subheader_show = true;
|
749 |
+
}
|
750 |
+
if (!subheader_show) {
|
751 |
+
document.getElementById('wfu_messageblock_arrow_' + sid + '_' + ii).style.display = "none";
|
752 |
+
headerspan ++;
|
753 |
+
}
|
754 |
+
document.getElementById('wfu_messageblock_header_' + sid + '_container_' + ii).colSpan = headerspan;
|
755 |
+
document.getElementById('wfu_messageblock_subheader_' + sid + '_container_' + ii).colSpan = subheaderspan;
|
756 |
+
// move file block inside message block
|
757 |
+
while (next_block_id < ii) {
|
758 |
+
next_block = next_block.nextSibling;
|
759 |
+
if (next_block == null) break;
|
760 |
+
if (next_block.nodeType === 1) next_block_id = next_block.id.substr(next_block.id.lastIndexOf("_") + 1);
|
761 |
+
}
|
762 |
+
message_table.tBodies[0].insertBefore(file_block, next_block);
|
763 |
+
next_block = file_block.nextSibling;
|
764 |
+
file_block = document.getElementById('wfu_messageblock_subheader_' + sid + '_' + ii);
|
765 |
+
message_table.tBodies[0].insertBefore(file_block, next_block);
|
766 |
+
next_block = file_block;
|
767 |
+
next_block_id = ii;
|
768 |
+
}
|
769 |
+
if (single_file_shown) document.getElementById('wfu_messageblock_' + sid + '_1').style.display = "";
|
770 |
+
message_table.style.display = "";
|
771 |
+
document.getElementById('wordpress_file_upload_message_' + sid).style.display = "";
|
772 |
+
}
|
773 |
+
if (do_redirect) wfu_Redirect(G.redirect_link);
|
774 |
+
|
775 |
+
return G.last;
|
776 |
+
}
|
777 |
+
|
778 |
+
//wfu_uploadFailed: function that is called if uploading fails
|
779 |
+
function wfu_uploadFailed(evt) {
|
780 |
+
// alert(this.error_message_failed);
|
781 |
+
}
|
782 |
+
|
783 |
+
//wfu_uploadCanceled: function that is called if uploading is cancelled
|
784 |
+
function wfu_uploadCanceled(evt) {
|
785 |
+
// alert(this.error_message_cancelled);
|
786 |
+
}
|
787 |
+
|
788 |
+
//wfu_Initialize_Params: function that creates an object with default parameters used for generation of message box
|
789 |
+
function wfu_Initialize_Params() {
|
790 |
+
var params = {};
|
791 |
+
params.version = "full";
|
792 |
+
params.general = {};
|
793 |
+
params.general.shortcode_id = 0;
|
794 |
+
params.general.unique_id = "";
|
795 |
+
params.general.state = 0;
|
796 |
+
params.general.files_count = 0;
|
797 |
+
params.general.update_wpfilebase = "";
|
798 |
+
params.general.redirect_link = "";
|
799 |
+
params.general.upload_finish_time = 0;
|
800 |
+
params.general.message = "";
|
801 |
+
params.general.message_type = "";
|
802 |
+
params.general.admin_messages = {};
|
803 |
+
params.general.admin_messages.wpfilebase = "";
|
804 |
+
params.general.admin_messages.notify = "";
|
805 |
+
params.general.admin_messages.redirect = "";
|
806 |
+
params.general.admin_messages.other = "";
|
807 |
+
params.general.errors = {};
|
808 |
+
params.general.errors.wpfilebase = "";
|
809 |
+
params.general.errors.notify = "";
|
810 |
+
params.general.errors.redirect = "";
|
811 |
+
params.general.color = "";
|
812 |
+
params.general.bgcolor = "";
|
813 |
+
params.general.borcolor = "";
|
814 |
+
params.general.notify_only_filename_list = "";
|
815 |
+
params.general.notify_target_path_list = "";
|
816 |
+
params.general.notify_attachment_list = "";
|
817 |
+
params.general.fail_message = "";
|
818 |
+
params.general.fail_admin_message = "";
|
819 |
+
|
820 |
+
return params;
|
821 |
+
}
|
822 |
+
|
823 |
+
//wfu_redirect_to_classic: function that switches to classic functionality (HTML upload form) if HTML5 is not supported
|
824 |
+
function wfu_redirect_to_classic(sid, session_token, flag, adminerrorcode) {
|
825 |
+
|
826 |
+
//check if file has been selected or not
|
827 |
+
if (wfu_filesselected(sid) == 0) return;
|
828 |
+
|
829 |
+
// check if there are empty user data fields that are required
|
830 |
+
if (!wfu_check_required_userdata(sid)) return;
|
831 |
+
|
832 |
+
wfu_redirect_to_classic_cont(sid, session_token, flag, adminerrorcode, []);
|
833 |
+
}
|
834 |
+
|
835 |
+
//wfu_redirect_to_classic_cont: function thatinforms the page to process the file after reloading, informs the page if this is a redirection from HTML5 to classic functionality and submits the file
|
836 |
+
function wfu_redirect_to_classic_cont(sid, session_token, flag, adminerrorcode, other_params) {
|
837 |
+
var process_function = function(responseText) {
|
838 |
+
var pos = responseText.indexOf(":");
|
839 |
+
var txt_header = responseText.substr(0, pos);
|
840 |
+
var txt_value = responseText.substr(pos + 1, responseText.length - pos - 1);
|
841 |
+
if (txt_header == "success") {
|
842 |
+
// show message in wait for upload state
|
843 |
+
var Params = wfu_Initialize_Params();
|
844 |
+
Params.general.shortcode_id = sid;
|
845 |
+
Params.general.unique_id = "";
|
846 |
+
Params.general.files_count = wfu_filesselected(sid);
|
847 |
+
wfu_ProcessUploadComplete(sid, 0, Params, "no-ajax", "", session_token, "");
|
848 |
+
|
849 |
+
if (flag == 1) {
|
850 |
+
var suffice = "";
|
851 |
+
document.getElementById('upfile_' + sid).name = 'uploadedfile_' + sid + '_redirected' + suffice;
|
852 |
+
}
|
853 |
+
if (adminerrorcode > 0) document.getElementById('adminerrorcodes_' + sid).value = adminerrorcode;
|
854 |
+
else document.getElementById('adminerrorcodes_' + sid).value = "";
|
855 |
+
document.getElementById('upfile_' + sid).disabled = false;
|
856 |
+
document.getElementById('uploadform_' + sid).submit();
|
857 |
+
}
|
858 |
+
}
|
859 |
+
|
860 |
+
var pass_params = "";
|
861 |
+
var d = new Date();
|
862 |
+
var url = GlobalData.consts.response_url + "?shortcode_id=" + sid + "&start_time=" + d.getTime() + "&session_token=" + session_token + pass_params;
|
863 |
+
|
864 |
+
// disable controls
|
865 |
+
wfu_lock_upload(sid);
|
866 |
+
|
867 |
+
//dispatch of GET request using AJAX asynchronous call
|
868 |
+
var xmlhttp = wfu_GetHttpRequestObject();
|
869 |
+
if (xmlhttp == null) {
|
870 |
+
//alternative way of sending GET request using IFRAME, in case AJAX is disabled
|
871 |
+
var i = document.createElement("iframe");
|
872 |
+
if (i) {
|
873 |
+
i.style.display = "none";
|
874 |
+
i.src = url;
|
875 |
+
document.body.appendChild(i);
|
876 |
+
i.onload = function() {
|
877 |
+
process_function(i.contentDocument.body.innerHTML);
|
878 |
+
}
|
879 |
+
return;
|
880 |
+
}
|
881 |
+
else {
|
882 |
+
return;
|
883 |
+
}
|
884 |
+
}
|
885 |
+
|
886 |
+
xmlhttp.open("GET", url, true);
|
887 |
+
xmlhttp.onreadystatechange=function() {
|
888 |
+
if (xmlhttp.readyState==4) {
|
889 |
+
if ( xmlhttp.status == 200 ) {
|
890 |
+
process_function(xmlhttp.responseText);
|
891 |
+
}
|
892 |
+
}
|
893 |
+
}
|
894 |
+
xmlhttp.send(null);
|
895 |
+
}
|
896 |
+
|
897 |
+
|
898 |
+
function wfu_filesselected(sid) {
|
899 |
+
var inputfile = document.getElementById("upfile_" + sid);
|
900 |
+
var ftext = document.getElementById("fileName_" + sid);
|
901 |
+
var farr = inputfile.files;
|
902 |
+
//fix in case files attribute is not supported
|
903 |
+
if (!farr) { if (inputfile.value) farr = [{name:inputfile.value}]; else farr = []; }
|
904 |
+
if (typeof inputfile.filearray != "undefined") farr = inputfile.filearray;
|
905 |
+
|
906 |
+
if (farr.length == 0) {
|
907 |
+
if (ftext) {
|
908 |
+
ftext.value = GlobalData.consts.nofilemessage;
|
909 |
+
ftext.className = "file_input_textbox_nofile";
|
910 |
+
}
|
911 |
+
}
|
912 |
+
return farr.length;
|
913 |
+
}
|
914 |
+
|
915 |
+
//wfu_check_required_userdata: check if there are required user fields that are empty
|
916 |
+
function wfu_check_required_userdata(sid) {
|
917 |
+
var userdata_count = wfu_get_userdata_count(sid);
|
918 |
+
var req_empty = false;
|
919 |
+
for (var i = 0; i < userdata_count; i++) {
|
920 |
+
var msg_hid = document.getElementById('hiddeninput_' + sid + '_userdata_' + i);
|
921 |
+
var msg = document.getElementById('userdata_' + sid + '_message_' + i);
|
922 |
+
var req_class = "file_userdata_message_required";
|
923 |
+
if (msg.className.substr(0, req_class.length) == req_class && msg_hid.value == "") {
|
924 |
+
msg.className = req_class + "_empty";
|
925 |
+
msg.value = GlobalData.consts.userdata_empty;
|
926 |
+
req_empty = true;
|
927 |
+
}
|
928 |
+
}
|
929 |
+
return !req_empty;
|
930 |
+
}
|
931 |
+
|
932 |
+
//wfu_HTML5UploadFile: function that is called if the plugin is not using classic functionality
|
933 |
+
function wfu_HTML5UploadFile(sid, JSONtext, session_token) {
|
934 |
+
//redirect to classic if AJAX is not supported
|
935 |
+
if (!wfu_BrowserCaps.supportsAJAX) {
|
936 |
+
wfu_redirect_to_classic(sid, session_token, 1, 1);
|
937 |
+
return;
|
938 |
+
}
|
939 |
+
//redirect to classic if HTML5 is not supported
|
940 |
+
if (!wfu_BrowserCaps.supportsHTML5) {
|
941 |
+
wfu_redirect_to_classic(sid, session_token, 1, 2);
|
942 |
+
return;
|
943 |
+
}
|
944 |
+
//get plugin params and redirect to classic if JSON decoding fails
|
945 |
+
JSONtext = wfu_plugin_decode_string(JSONtext.replace(/^\s+|\s+$/g,""));
|
946 |
+
var JSONobj = null;
|
947 |
+
try {
|
948 |
+
JSONobj = JSON.parse(JSONtext);
|
949 |
+
}
|
950 |
+
catch(e) {}
|
951 |
+
if (JSONobj == null) {
|
952 |
+
wfu_redirect_to_classic(sid, session_token, 1, 3);
|
953 |
+
return;
|
954 |
+
}
|
955 |
+
var xhr = wfu_GetHttpRequestObject();
|
956 |
+
if (xhr == null) return;
|
957 |
+
|
958 |
+
//check if file has been selected or not
|
959 |
+
var numfiles = wfu_filesselected(sid);
|
960 |
+
if (numfiles == 0) return;
|
961 |
+
|
962 |
+
// check if there are empty user data fields that are required
|
963 |
+
if (!wfu_check_required_userdata(sid)) return;
|
964 |
+
|
965 |
+
wfu_HTML5UploadFile_cont(sid, JSONobj, session_token, []);
|
966 |
+
}
|
967 |
+
|
968 |
+
function wfu_HTML5UploadFile_cont(sid, JSONobj, session_token, other_params) {
|
969 |
+
// get index of subdirectory if subdirectory dropdown list is activated
|
970 |
+
var subdir_sel_index = -1;
|
971 |
+
if (document.getElementById('selectsubdir_' + sid) != null)
|
972 |
+
subdir_sel_index = document.getElementById('selectsubdir_' + sid).selectedIndex;
|
973 |
+
|
974 |
+
// get file list
|
975 |
+
var inputfile = document.getElementById("upfile_" + sid);
|
976 |
+
var farr = inputfile.files;
|
977 |
+
//fix in case files attribute is not supported
|
978 |
+
if (!farr) { if (inputfile.value) farr = [{name:inputfile.value}]; else farr = []; }
|
979 |
+
if (typeof inputfile.filearray != "undefined") farr = inputfile.filearray;
|
980 |
+
var suffice = "";
|
981 |
+
/* initialize global object to hold dynamic upload status during upload */
|
982 |
+
var rand_str = wfu_randomString(10);
|
983 |
+
GlobalData[sid] = {};
|
984 |
+
GlobalData[sid].unique_id = rand_str;
|
985 |
+
GlobalData[sid].last = false;
|
986 |
+
GlobalData[sid].files_count = farr.length;
|
987 |
+
GlobalData[sid].files_processed = 0;
|
988 |
+
GlobalData[sid].upload_state = 0;
|
989 |
+
GlobalData[sid].message = "";
|
990 |
+
GlobalData[sid].update_wpfilebase = "";
|
991 |
+
GlobalData[sid].redirect_link = "";
|
992 |
+
GlobalData[sid].notify_only_filename_list = "";
|
993 |
+
GlobalData[sid].notify_target_path_list = "";
|
994 |
+
GlobalData[sid].notify_attachment_list = "";
|
995 |
+
GlobalData[sid].admin_messages = {};
|
996 |
+
GlobalData[sid].admin_messages.wpfilebase = "";
|
997 |
+
GlobalData[sid].admin_messages.notify = "";
|
998 |
+
GlobalData[sid].admin_messages.redirect = "";
|
999 |
+
GlobalData[sid].admin_messages.other = "";
|
1000 |
+
GlobalData[sid].errors = {};
|
1001 |
+
GlobalData[sid].errors.wpfilebase = "";
|
1002 |
+
GlobalData[sid].errors.notify = "";
|
1003 |
+
GlobalData[sid].errors.redirect = "";
|
1004 |
+
GlobalData[sid].xhrs = Array();
|
1005 |
+
|
1006 |
+
wfu_show_simple_progressbar(JSONobj.shortcode_id, "progressive");
|
1007 |
+
|
1008 |
+
// show message in wait for upload state
|
1009 |
+
var Params = wfu_Initialize_Params();
|
1010 |
+
Params.general.shortcode_id = sid;
|
1011 |
+
Params.general.unique_id = rand_str;
|
1012 |
+
wfu_ProcessUploadComplete(sid, 0, Params, rand_str, JSONobj.params_index, session_token, "");
|
1013 |
+
|
1014 |
+
for (var i = 0; i < farr.length; i++) {
|
1015 |
+
// initialise AJAX and FormData objects
|
1016 |
+
var xhr = wfu_GetHttpRequestObject();
|
1017 |
+
if (xhr == null) return;
|
1018 |
+
var fd = null;
|
1019 |
+
try {
|
1020 |
+
var fd = new FormData();
|
1021 |
+
}
|
1022 |
+
catch(e) {}
|
1023 |
+
if (fd == null) return;
|
1024 |
+
|
1025 |
+
// define POST parameters
|
1026 |
+
fd.append("uploadedfile_" + sid + suffice, farr[i]);
|
1027 |
+
fd.append("action", "wfu_ajax_action");
|
1028 |
+
fd.append("params_index", JSONobj.params_index);
|
1029 |
+
fd.append("subdir_sel_index", subdir_sel_index);
|
1030 |
+
fd.append("session_token", session_token);
|
1031 |
+
fd.append("unique_id", rand_str);
|
1032 |
+
var userdata_count = wfu_get_userdata_count(sid);
|
1033 |
+
for (var ii = 0; ii < userdata_count; ii++)
|
1034 |
+
fd.append("hiddeninput_" + sid + "_userdata_" + ii, document.getElementById('hiddeninput_' + sid + '_userdata_' + ii).value);
|
1035 |
+
|
1036 |
+
// define variables
|
1037 |
+
GlobalData[sid].xhrs.push(xhr);
|
1038 |
+
var d = new Date();
|
1039 |
+
xhr.shortcode_id = sid;
|
1040 |
+
xhr.file_id = i + 1;
|
1041 |
+
xhr.size = 0;
|
1042 |
+
xhr.sizeloaded = 0;
|
1043 |
+
xhr.unique_id = rand_str;
|
1044 |
+
xhr.params_index = JSONobj.params_index;
|
1045 |
+
xhr.session_token = session_token;
|
1046 |
+
xhr.finish_time = d.getTime() + JSONobj.max_time_limit * 1000;
|
1047 |
+
xhr.fail_colors = JSONobj.fail_colors;
|
1048 |
+
xhr.default_colors = JSONobj.default_colors;
|
1049 |
+
xhr.error_message_header = JSONobj.error_message_header.replace(/%username%/g, "no data");
|
1050 |
+
xhr.error_message_header = xhr.error_message_header.replace(/%useremail%/g, "no data");
|
1051 |
+
xhr.error_message_header = xhr.error_message_header.replace(/%filename%/g, farr[i].name);
|
1052 |
+
xhr.error_message_header = xhr.error_message_header.replace(/%filepath%/g, farr[i].name);
|
1053 |
+
xhr.error_message_failed = JSONobj.error_message_failed;
|
1054 |
+
xhr.error_message_cancelled = JSONobj.error_message_cancelled;
|
1055 |
+
xhr.error_message_unknown = JSONobj.error_message_unknown;
|
1056 |
+
xhr.error_adminmessage_unknown = JSONobj.error_adminmessage_unknown.replace(/%username%/g, "no data");
|
1057 |
+
xhr.error_adminmessage_unknown = xhr.error_adminmessage_unknown.replace(/%useremail%/g, "no data");
|
1058 |
+
xhr.error_adminmessage_unknown = xhr.error_adminmessage_unknown.replace(/%filename%/g, farr[i].name);
|
1059 |
+
xhr.error_adminmessage_unknown = xhr.error_adminmessage_unknown.replace(/%filepath%/g, farr[i].name);
|
1060 |
+
xhr.error_jsonparse_headermessage = JSONobj.error_jsonparse_headermessage;
|
1061 |
+
xhr.error_jsonparse_headeradminmessage = JSONobj.error_jsonparse_headeradminmessage;
|
1062 |
+
|
1063 |
+
xhr.error_message_timelimit = JSONobj.error_message_timelimit;
|
1064 |
+
xhr.error_message_admin_timelimit = JSONobj.error_message_admin_timelimit;
|
1065 |
+
xhr.upload.xhr = xhr;
|
1066 |
+
|
1067 |
+
// event listeners
|
1068 |
+
xhr.upload.addEventListener("loadstart", wfu_loadStart, false);
|
1069 |
+
xhr.upload.addEventListener("progress", wfu_uploadProgress, false);
|
1070 |
+
xhr.addEventListener("load", wfu_uploadComplete, false);
|
1071 |
+
xhr.addEventListener("error", wfu_uploadFailed, false);
|
1072 |
+
xhr.addEventListener("abort", wfu_uploadCanceled, false);
|
1073 |
+
|
1074 |
+
// xhr.open("POST", "/wp-admin/admin-ajax.php");
|
1075 |
+
xhr.open("POST", JSONobj.open_url);
|
1076 |
+
xhr.send(fd);
|
1077 |
+
}
|
1078 |
+
}
|
1079 |
+
|
1080 |
+
//wfu_get_userdata_count: get number of userdata fields
|
1081 |
+
function wfu_get_userdata_count(sid) {
|
1082 |
+
var fields_count = 0;
|
1083 |
+
while (document.getElementById('userdata_' + sid + '_' + fields_count)) fields_count ++;
|
1084 |
+
return fields_count;
|
1085 |
+
}
|
1086 |
+
|
1087 |
+
function wfu_lock_upload(sid) {
|
1088 |
+
var textbox = document.getElementById('fileName_' + sid);
|
1089 |
+
if (textbox) textbox.disabled = true;
|
1090 |
+
document.getElementById('input_' + sid).disabled = true;
|
1091 |
+
document.getElementById('upfile_' + sid).disabled = true;
|
1092 |
+
var subdir = document.getElementById('selectsubdir_' + sid);
|
1093 |
+
if (subdir) subdir.disabled = true;
|
1094 |
+
var upload = document.getElementById('upload_' + sid);
|
1095 |
+
if (upload) upload.disabled = true;
|
1096 |
+
var userdata_count = wfu_get_userdata_count(sid);
|
1097 |
+
for (var i = 0; i < userdata_count; i++)
|
1098 |
+
document.getElementById('userdata_' + sid + '_message_' + i).disabled = true;
|
1099 |
+
}
|
1100 |
+
|
1101 |
+
function wfu_unlock_upload(sid) {
|
1102 |
+
var textbox = document.getElementById('fileName_' + sid);
|
1103 |
+
if (textbox) textbox.disabled = false;
|
1104 |
+
document.getElementById('input_' + sid).disabled = false;
|
1105 |
+
document.getElementById('upfile_' + sid).disabled = false;
|
1106 |
+
var subdir = document.getElementById('selectsubdir_' + sid);
|
1107 |
+
if (subdir) subdir.disabled = false;
|
1108 |
+
var upload = document.getElementById('upload_' + sid);
|
1109 |
+
if (upload) upload.disabled = false;
|
1110 |
+
var userdata_count = wfu_get_userdata_count(sid);
|
1111 |
+
for (var i = 0; i < userdata_count; i++)
|
1112 |
+
document.getElementById('userdata_' + sid + '_message_' + i).disabled = false;
|
1113 |
+
}
|
1114 |
+
|
1115 |
+
function wfu_clear(sid) {
|
1116 |
+
var textbox = document.getElementById('fileName_' + sid);
|
1117 |
+
if (textbox) {
|
1118 |
+
textbox.value = '';
|
1119 |
+
textbox.className = 'file_input_textbox';
|
1120 |
+
}
|
1121 |
+
var subdir = document.getElementById('selectsubdir_' + sid);
|
1122 |
+
if (subdir) subdir.selectedIndex = 0;
|
1123 |
+
var userdata_count = wfu_get_userdata_count(sid);
|
1124 |
+
for (var i = 0; i < userdata_count; i++) {
|
1125 |
+
document.getElementById('userdata_' + sid + '_message_' + i).value = "";
|
1126 |
+
document.getElementById('hiddeninput_' + sid + '_userdata_' + i).value = "";
|
1127 |
+
}
|
1128 |
+
}
|
1129 |
+
|
1130 |
+
function wfu_reset_message(sid) {
|
1131 |
+
var message_table = document.getElementById('wfu_messageblock_' + sid);
|
1132 |
+
if (message_table) {
|
1133 |
+
// reset header
|
1134 |
+
document.getElementById('wfu_messageblock_header_' + sid).style.display = "";
|
1135 |
+
var header_container = document.getElementById('wfu_messageblock_header_' + sid + '_container');
|
1136 |
+
if (UploadStates[sid]) header_container.innerHTML = UploadStates[sid]["State0"];
|
1137 |
+
document.getElementById('wfu_messageblock_header_' + sid + '_state').value = "none";
|
1138 |
+
document.getElementById('wfu_messageblock_arrow_' + sid).style.display = "none";
|
1139 |
+
header_container.colSpan = 3;
|
1140 |
+
// reset subheader
|
1141 |
+
document.getElementById('wfu_messageblock_subheader_' + sid + '_messagelabel').innerHTML = "";
|
1142 |
+
document.getElementById('wfu_messageblock_subheader_' + sid + '_adminmessagelabel').innerHTML = "";
|
1143 |
+
document.getElementById('wfu_messageblock_subheader_' + sid).style.display = "none";
|
1144 |
+
document.getElementById('wfu_messageblock_subheader_' + sid + '_message').style.display = "none";
|
1145 |
+
document.getElementById('wfu_messageblock_subheader_' + sid + '_adminmessage').style.display = "none";
|
1146 |
+
// reset files
|
1147 |
+
var file_array = wfu_get_file_ids(sid);
|
1148 |
+
for (var i = 1; i <= file_array.length; i++) {
|
1149 |
+
message_table.tBodies[0].removeChild(document.getElementById('wfu_messageblock_' + sid + '_' + i));
|
1150 |
+
message_table.tBodies[0].removeChild(document.getElementById('wfu_messageblock_subheader_' + sid + '_' + i));
|
1151 |
+
}
|
1152 |
+
}
|
1153 |
+
}
|
1154 |
+
|
1155 |
+
|
1156 |
+
function wfu_show_simple_progressbar(sid, effect) {
|
1157 |
+
var bar = document.getElementById('progressbar_' + sid + '_animation');
|
1158 |
+
var barsafe = document.getElementById('progressbar_' + sid + '_imagesafe');
|
1159 |
+
if (bar) {
|
1160 |
+
if (effect == "progressive") {
|
1161 |
+
bar.style.width = "0%";
|
1162 |
+
bar.className = "file_progress_progressive";
|
1163 |
+
barsafe.style.display = "none";
|
1164 |
+
bar.style.display = "block";
|
1165 |
+
}
|
1166 |
+
else if (wfu_BrowserCaps.supportsAnimation) {
|
1167 |
+
bar.style.width = "25%";
|
1168 |
+
bar.className = "file_progress_shuffle";
|
1169 |
+
barsafe.style.display = "none";
|
1170 |
+
bar.style.display = "block";
|
1171 |
+
}
|
1172 |
+
else {
|
1173 |
+
bar.style.width = "0%";
|
1174 |
+
bar.className = "file_progress_noanimation";
|
1175 |
+
bar.style.display = "none";
|
1176 |
+
barsafe.style.display = "block";
|
1177 |
+
}
|
1178 |
+
document.getElementById('wordpress_file_upload_progressbar_' + sid).style.display = "block";
|
1179 |
+
}
|
1180 |
+
}
|
1181 |
+
|
1182 |
+
function wfu_hide_simple_progressbar(sid) {
|
1183 |
+
var bar = document.getElementById('progressbar_' + sid + '_animation');
|
1184 |
+
var barsafe = document.getElementById('progressbar_' + sid + '_imagesafe');
|
1185 |
+
if (bar) {
|
1186 |
+
document.getElementById('wordpress_file_upload_progressbar_' + sid).style.display = "none";
|
1187 |
+
bar.style.width = "0%";
|
1188 |
+
bar.className = "file_progress_noanimation";
|
1189 |
+
barsafe.style.display = "none";
|
1190 |
+
bar.style.display = "block";
|
1191 |
+
}
|
1192 |
+
}
|
1193 |
+
|
1194 |
+
|
languages/wordpress-file-upload-upload.pot
ADDED
@@ -0,0 +1,374 @@
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â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
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
1 |
+
msgid ""
|
2 |
+
msgstr ""
|
3 |
+
"Project-Id-Version: Wordpress File Upload\n"
|
4 |
+
"Report-Msgid-Bugs-To: \n"
|
5 |
+
"POT-Creation-Date: 2013-12-08 02:57+0200\n"
|
6 |
+
"PO-Revision-Date: 2013-12-08 02:57+0200\n"
|
7 |
+
"Last-Translator: nickboss <info@iptanus.com>\n"
|
8 |
+
"Language-Team: Iptanus <info@iptanus.com>\n"
|
9 |
+
"Language: \n"
|
10 |
+
"MIME-Version: 1.0\n"
|
11 |
+
"Content-Type: text/plain; charset=UTF-8\n"
|
12 |
+
"Content-Transfer-Encoding: 8bit\n"
|
13 |
+
"X-Poedit-KeywordsList: __\n"
|
14 |
+
"X-Poedit-Basepath: ../\n"
|
15 |
+
"X-Poedit-SearchPath-0: .\n"
|
16 |
+
|
17 |
+
#: lib/wfu_constants.php:5
|
18 |
+
msgid "Upload files"
|
19 |
+
msgstr ""
|
20 |
+
|
21 |
+
#: lib/wfu_constants.php:6
|
22 |
+
msgid "Select File"
|
23 |
+
msgstr ""
|
24 |
+
|
25 |
+
#: lib/wfu_constants.php:7
|
26 |
+
msgid "Upload File"
|
27 |
+
msgstr ""
|
28 |
+
|
29 |
+
#: lib/wfu_constants.php:22
|
30 |
+
msgid "File Upload Notification"
|
31 |
+
msgstr ""
|
32 |
+
|
33 |
+
#: lib/wfu_constants.php:23
|
34 |
+
msgid ""
|
35 |
+
"Dear Recipient,\n"
|
36 |
+
"\n"
|
37 |
+
" This is an automatic delivery message to notify you that a new file has been uploaded.\n"
|
38 |
+
"\n"
|
39 |
+
"Best Regards"
|
40 |
+
msgstr ""
|
41 |
+
|
42 |
+
#: lib/wfu_constants.php:29
|
43 |
+
#, php-format
|
44 |
+
msgid "File %filename% uploaded successfully"
|
45 |
+
msgstr ""
|
46 |
+
|
47 |
+
#: lib/wfu_constants.php:30
|
48 |
+
#, php-format
|
49 |
+
msgid "File %filename% uploaded successfully but with warnings"
|
50 |
+
msgstr ""
|
51 |
+
|
52 |
+
#: lib/wfu_constants.php:31
|
53 |
+
msgid "File %filename% not uploaded"
|
54 |
+
msgstr ""
|
55 |
+
|
56 |
+
#: lib/wfu_constants.php:32
|
57 |
+
msgid "File %filename% is being uploaded"
|
58 |
+
msgstr ""
|
59 |
+
|
60 |
+
#: lib/wfu_constants.php:48
|
61 |
+
msgid "Your message"
|
62 |
+
msgstr ""
|
63 |
+
|
64 |
+
#: lib/wfu_constants.php:51
|
65 |
+
msgid "Error. Could not resolve ftp target filedir. Check the domain in 'ftpinfo' attribute."
|
66 |
+
msgstr ""
|
67 |
+
|
68 |
+
#: lib/wfu_constants.php:52
|
69 |
+
msgid "Error. Invalid ftp information. Check 'ftpinfo' attribute."
|
70 |
+
msgstr ""
|
71 |
+
|
72 |
+
#: lib/wfu_constants.php:53
|
73 |
+
msgid "Error. Could not extract ftp information from 'ftpinfo' attribute. Check its syntax."
|
74 |
+
msgstr ""
|
75 |
+
|
76 |
+
#: lib/wfu_constants.php:54
|
77 |
+
msgid "Error. Could not resolve ftp target filename. Check the domain in 'ftpinfo' attribute."
|
78 |
+
msgstr ""
|
79 |
+
|
80 |
+
#: lib/wfu_constants.php:55
|
81 |
+
msgid ""
|
82 |
+
"Error. The upload size limit of PHP directive upload_max_filesize is preventing the upload of big files.\n"
|
83 |
+
"PHP directive upload_max_filesize limit is: "
|
84 |
+
msgstr ""
|
85 |
+
|
86 |
+
#: lib/wfu_constants.php:56
|
87 |
+
msgid ""
|
88 |
+
"The upload time limit of PHP directive max_input_time is preventing the upload of big files.\n"
|
89 |
+
"PHP directive max_input_time limit is: "
|
90 |
+
msgstr ""
|
91 |
+
|
92 |
+
#: lib/wfu_constants.php:57
|
93 |
+
msgid ""
|
94 |
+
"Error. Permission denied to write to target folder.\n"
|
95 |
+
"Check and correct read/write permissions of target folder."
|
96 |
+
msgstr ""
|
97 |
+
|
98 |
+
#: lib/wfu_constants.php:58
|
99 |
+
msgid "Targer folder doesn't exist."
|
100 |
+
msgstr ""
|
101 |
+
|
102 |
+
#: lib/wfu_constants.php:59
|
103 |
+
msgid "Upload failed! Missing a temporary folder."
|
104 |
+
msgstr ""
|
105 |
+
|
106 |
+
#: lib/wfu_constants.php:60
|
107 |
+
msgid "Upload failed! Permission denied to write to target folder."
|
108 |
+
msgstr ""
|
109 |
+
|
110 |
+
#: lib/wfu_constants.php:61
|
111 |
+
msgid "File not allowed."
|
112 |
+
msgstr ""
|
113 |
+
|
114 |
+
#: lib/wfu_constants.php:62
|
115 |
+
msgid "The uploaded file exceeds the file size limit."
|
116 |
+
msgstr ""
|
117 |
+
|
118 |
+
#: lib/wfu_constants.php:63
|
119 |
+
msgid "Upload failed! The uploaded file exceeds the file size limit of the server. Please contact the administrator."
|
120 |
+
msgstr ""
|
121 |
+
|
122 |
+
#: lib/wfu_constants.php:64
|
123 |
+
msgid "Upload failed! The duration of the upload exceeded the time limit of the server. Please contact the administrator."
|
124 |
+
msgstr ""
|
125 |
+
|
126 |
+
#: lib/wfu_constants.php:65
|
127 |
+
msgid "Upload failed! The uploaded file exceeds the MAX_FILE_SIZE directive that was specified in the HTML form."
|
128 |
+
msgstr ""
|
129 |
+
|
130 |
+
#: lib/wfu_constants.php:66
|
131 |
+
msgid "Upload failed! The uploaded file was only partially uploaded."
|
132 |
+
msgstr ""
|
133 |
+
|
134 |
+
#: lib/wfu_constants.php:67
|
135 |
+
msgid "Upload failed! No file was uploaded."
|
136 |
+
msgstr ""
|
137 |
+
|
138 |
+
#: lib/wfu_constants.php:68
|
139 |
+
msgid "Upload failed! Failed to write file to disk."
|
140 |
+
msgstr ""
|
141 |
+
|
142 |
+
#: lib/wfu_constants.php:69
|
143 |
+
msgid "Upload failed! Error occured while moving temporary file. Please contact administrator."
|
144 |
+
msgstr ""
|
145 |
+
|
146 |
+
#: lib/wfu_constants.php:70
|
147 |
+
msgid "Upload failed! A PHP extension stopped the file upload. PHP does not provide a way to ascertain which extension caused the file upload to stop; examining the list of loaded extensions with phpinfo() may help."
|
148 |
+
msgstr ""
|
149 |
+
|
150 |
+
#: lib/wfu_constants.php:71
|
151 |
+
msgid "Upload failed! Error occured while attemting to upload the file."
|
152 |
+
msgstr ""
|
153 |
+
|
154 |
+
#: lib/wfu_constants.php:72
|
155 |
+
msgid "Upload failed!"
|
156 |
+
msgstr ""
|
157 |
+
|
158 |
+
#: lib/wfu_constants.php:73
|
159 |
+
msgid "No file!"
|
160 |
+
msgstr ""
|
161 |
+
|
162 |
+
#: lib/wfu_constants.php:74
|
163 |
+
msgid "Upload failed! The upload has been canceled by the user or the browser dropped the connection."
|
164 |
+
msgstr ""
|
165 |
+
|
166 |
+
#: lib/wfu_constants.php:75
|
167 |
+
msgid "Upload failed! Unknown error."
|
168 |
+
msgstr ""
|
169 |
+
|
170 |
+
#: lib/wfu_constants.php:76
|
171 |
+
msgid "Please contact the administrator."
|
172 |
+
msgstr ""
|
173 |
+
|
174 |
+
#: lib/wfu_constants.php:77
|
175 |
+
msgid "No result from remote server!"
|
176 |
+
msgstr ""
|
177 |
+
|
178 |
+
#: lib/wfu_constants.php:78
|
179 |
+
msgid " but with warnings"
|
180 |
+
msgstr ""
|
181 |
+
|
182 |
+
#: lib/wfu_constants.php:79
|
183 |
+
#: lib/wfu_constants.php:81
|
184 |
+
msgid "Warning: JSON parse error."
|
185 |
+
msgstr ""
|
186 |
+
|
187 |
+
#: lib/wfu_constants.php:80
|
188 |
+
msgid "Upload parameters of this file, passed as JSON string to the handler, could not be parsed."
|
189 |
+
msgstr ""
|
190 |
+
|
191 |
+
#: lib/wfu_constants.php:82
|
192 |
+
msgid "UploadStates, passed as JSON string to the handler, could not be parsed."
|
193 |
+
msgstr ""
|
194 |
+
|
195 |
+
#: lib/wfu_constants.php:83
|
196 |
+
msgid "Redirection to classic form functionality occurred due to unknown error."
|
197 |
+
msgstr ""
|
198 |
+
|
199 |
+
#: lib/wfu_constants.php:84
|
200 |
+
msgid "Redirection to classic form functionality occurred because AJAX is not supported."
|
201 |
+
msgstr ""
|
202 |
+
|
203 |
+
#: lib/wfu_constants.php:85
|
204 |
+
msgid "Redirection to classic form functionality occurred because HTML5 is not supported."
|
205 |
+
msgstr ""
|
206 |
+
|
207 |
+
#: lib/wfu_constants.php:86
|
208 |
+
msgid "Redirection to classic form functionality occurred due to JSON parse error."
|
209 |
+
msgstr ""
|
210 |
+
|
211 |
+
#: lib/wfu_constants.php:87
|
212 |
+
msgid "cannot be empty!"
|
213 |
+
msgstr ""
|
214 |
+
|
215 |
+
#: lib/wfu_constants.php:90
|
216 |
+
msgid "Upload skipped! File already exists."
|
217 |
+
msgstr ""
|
218 |
+
|
219 |
+
#: lib/wfu_constants.php:91
|
220 |
+
msgid "No files have been selected!"
|
221 |
+
msgstr ""
|
222 |
+
|
223 |
+
#: lib/wfu_constants.php:92
|
224 |
+
msgid "WPFilebase Plugin not updated because there were no files uploaded."
|
225 |
+
msgstr ""
|
226 |
+
|
227 |
+
#: lib/wfu_constants.php:93
|
228 |
+
msgid "Notification email was not sent because there were no files uploaded."
|
229 |
+
msgstr ""
|
230 |
+
|
231 |
+
#: lib/wfu_constants.php:94
|
232 |
+
msgid "Notification email was not sent because no recipients were defined. Please check notifyrecipients attribute in the shortcode."
|
233 |
+
msgstr ""
|
234 |
+
|
235 |
+
#: lib/wfu_constants.php:95
|
236 |
+
msgid "Notification email was not sent due to an error. Please check notifyrecipients, notifysubject and notifymessage attributes for errors."
|
237 |
+
msgstr ""
|
238 |
+
|
239 |
+
#: lib/wfu_constants.php:96
|
240 |
+
msgid "Redirection not executed because redirection link is empty. Please check redirectlink attribute."
|
241 |
+
msgstr ""
|
242 |
+
|
243 |
+
#: lib/wfu_constants.php:97
|
244 |
+
msgid "Redirection not executed because not all files were successfully uploaded."
|
245 |
+
msgstr ""
|
246 |
+
|
247 |
+
#: lib/wfu_constants.php:100
|
248 |
+
msgid "Test Mode"
|
249 |
+
msgstr ""
|
250 |
+
|
251 |
+
#: lib/wfu_constants.php:101
|
252 |
+
msgid "Upload path: %filepath%"
|
253 |
+
msgstr ""
|
254 |
+
|
255 |
+
#: lib/wfu_constants.php:102
|
256 |
+
msgid "Failed upload path: %filepath%"
|
257 |
+
msgstr ""
|
258 |
+
|
259 |
+
#: lib/wfu_constants.php:105
|
260 |
+
msgid "This is a test message"
|
261 |
+
msgstr ""
|
262 |
+
|
263 |
+
#: lib/wfu_constants.php:106
|
264 |
+
msgid "This is a test administrator message"
|
265 |
+
msgstr ""
|
266 |
+
|
267 |
+
#: lib/wfu_constants.php:107
|
268 |
+
msgid "File testfile 1 under test"
|
269 |
+
msgstr ""
|
270 |
+
|
271 |
+
#: lib/wfu_constants.php:108
|
272 |
+
msgid "File testfile 1 message"
|
273 |
+
msgstr ""
|
274 |
+
|
275 |
+
#: lib/wfu_constants.php:109
|
276 |
+
msgid "File testfile 1 administrator message"
|
277 |
+
msgstr ""
|
278 |
+
|
279 |
+
#: lib/wfu_constants.php:110
|
280 |
+
msgid "File testfile 2 under test"
|
281 |
+
msgstr ""
|
282 |
+
|
283 |
+
#: lib/wfu_constants.php:111
|
284 |
+
msgid "File testfile 2 message"
|
285 |
+
msgstr ""
|
286 |
+
|
287 |
+
#: lib/wfu_constants.php:112
|
288 |
+
msgid "File testfile 2 administrator message"
|
289 |
+
msgstr ""
|
290 |
+
|
291 |
+
#: lib/wfu_constants.php:115
|
292 |
+
msgid "Insert variable %username% inside text. It will be replaced by the username of the current user."
|
293 |
+
msgstr ""
|
294 |
+
|
295 |
+
#: lib/wfu_constants.php:116
|
296 |
+
msgid "Insert variable %useremail% inside text. It will be replaced by the email of the current user."
|
297 |
+
msgstr ""
|
298 |
+
|
299 |
+
#: lib/wfu_constants.php:117
|
300 |
+
msgid "Insert variable %filename% inside text. It will be replaced by the filename of the uploaded file."
|
301 |
+
msgstr ""
|
302 |
+
|
303 |
+
#: lib/wfu_constants.php:118
|
304 |
+
msgid "Insert variable %filepath% inside text. It will be replaced by the full filepath of the uploaded file."
|
305 |
+
msgstr ""
|
306 |
+
|
307 |
+
#: lib/wfu_constants.php:119
|
308 |
+
msgid "Insert variable %blogid% inside text. It will be replaced by the blog id of the website."
|
309 |
+
msgstr ""
|
310 |
+
|
311 |
+
#: lib/wfu_constants.php:120
|
312 |
+
msgid "Insert variable %userdataXXX% inside text. Replace XXX with the number of the user field (1, 2, etc...). It will be replaced by the value that the user entered in this field."
|
313 |
+
msgstr ""
|
314 |
+
|
315 |
+
#: lib/wfu_constants.php:121
|
316 |
+
msgid "Insert variable %n% inside text to denote a line change."
|
317 |
+
msgstr ""
|
318 |
+
|
319 |
+
#: lib/wfu_constants.php:124
|
320 |
+
msgid "Upload in progress"
|
321 |
+
msgstr ""
|
322 |
+
|
323 |
+
#: lib/wfu_constants.php:125
|
324 |
+
msgid "Upload in progress with warnings!"
|
325 |
+
msgstr ""
|
326 |
+
|
327 |
+
#: lib/wfu_constants.php:126
|
328 |
+
msgid "Upload in progress but some files already failed!"
|
329 |
+
msgstr ""
|
330 |
+
|
331 |
+
#: lib/wfu_constants.php:127
|
332 |
+
msgid "Upload in progress but no files uploaded so far!"
|
333 |
+
msgstr ""
|
334 |
+
|
335 |
+
#: lib/wfu_constants.php:128
|
336 |
+
msgid "All files uploaded successfully"
|
337 |
+
msgstr ""
|
338 |
+
|
339 |
+
#: lib/wfu_constants.php:129
|
340 |
+
msgid "All files uploaded successfully but there are warnings!"
|
341 |
+
msgstr ""
|
342 |
+
|
343 |
+
#: lib/wfu_constants.php:130
|
344 |
+
msgid "File uploaded successfully but there are warnings!"
|
345 |
+
msgstr ""
|
346 |
+
|
347 |
+
#: lib/wfu_constants.php:131
|
348 |
+
msgid "Some files failed to upload!"
|
349 |
+
msgstr ""
|
350 |
+
|
351 |
+
#: lib/wfu_constants.php:132
|
352 |
+
msgid "All files failed to upload"
|
353 |
+
msgstr ""
|
354 |
+
|
355 |
+
#: lib/wfu_constants.php:133
|
356 |
+
msgid "File failed to upload"
|
357 |
+
msgstr ""
|
358 |
+
|
359 |
+
#: lib/wfu_constants.php:134
|
360 |
+
msgid "There are no files to upload!"
|
361 |
+
msgstr ""
|
362 |
+
|
363 |
+
#: lib/wfu_constants.php:135
|
364 |
+
msgid "Test upload message"
|
365 |
+
msgstr ""
|
366 |
+
|
367 |
+
#: lib/wfu_constants.php:136
|
368 |
+
msgid "JSON parse warning!"
|
369 |
+
msgstr ""
|
370 |
+
|
371 |
+
#: lib/wfu_constants.php:137
|
372 |
+
msgid "please wait while redirecting..."
|
373 |
+
msgstr ""
|
374 |
+
|
lib/wfu_admin.php
ADDED
@@ -0,0 +1,369 @@
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|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|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
1 |
+
<?php
|
2 |
+
|
3 |
+
function wordpress_file_upload_add_admin_pages() {
|
4 |
+
add_options_page('Wordpress File Upload', 'Wordpress File Upload', 10, 'wordpress_file_upload', 'wordpress_file_upload_manage_dashboard');
|
5 |
+
}
|
6 |
+
|
7 |
+
// This is the callback function that generates dashboard page content
|
8 |
+
function wordpress_file_upload_manage_dashboard() {
|
9 |
+
global $wpdb;
|
10 |
+
$_POST = stripslashes_deep($_POST);
|
11 |
+
$_GET = stripslashes_deep($_GET);
|
12 |
+
$action = (!empty($_POST['action']) ? $_POST['action'] : (!empty($_GET['action']) ? $_GET['action'] : ''));
|
13 |
+
|
14 |
+
if ( $action == 'edit_settings' ) {
|
15 |
+
wfu_update_settings();
|
16 |
+
$echo_str = wfu_manage_settings();
|
17 |
+
}
|
18 |
+
elseif ( $action == 'shortcode_composer' ) {
|
19 |
+
$echo_str = wfu_shortcode_composer();
|
20 |
+
}
|
21 |
+
else {
|
22 |
+
$echo_str = wfu_manage_settings();
|
23 |
+
}
|
24 |
+
|
25 |
+
echo $echo_str;
|
26 |
+
}
|
27 |
+
|
28 |
+
function wfu_manage_settings() {
|
29 |
+
return wfu_shortcode_composer();
|
30 |
+
|
31 |
+
global $wpdb;
|
32 |
+
// $plugin_options = wfu_decode_plugin_options(get_option( "wordpress_file_upload_options" ));
|
33 |
+
|
34 |
+
$echo_str = '<div class="wfu_wrap">';
|
35 |
+
$echo_str .= "\n\t".'<h2>Wordpress File Upload Control Panel</h2>';
|
36 |
+
$echo_str .= "\n\t".'<div style="margin-top:10px;">';
|
37 |
+
$echo_str .= "\n\t\t".'<a href="/wp-admin/options-general.php?page=wordpress_file_upload&action=shortcode_composer" class="button" title="Shortcode composer">Shortcode Composer</a>';
|
38 |
+
$echo_str .= "\n\t\t".'<h3 style="margin-bottom: 10px; margin-top: 40px;">Settings</h3>';
|
39 |
+
$echo_str .= "\n\t\t".'<form enctype="multipart/form-data" name="editsettings" id="editsettings" method="post" action="/wp-admin/options-general.php?page=event_register&action=edit_settings" class="validate">';
|
40 |
+
$echo_str .= "\n\t\t\t".'<input type="hidden" name="action" value="edit_settings">';
|
41 |
+
$echo_str .= "\n\t\t\t".'<table class="form-table">';
|
42 |
+
$echo_str .= "\n\t\t\t\t".'<tbody>';
|
43 |
+
$echo_str .= "\n\t\t\t\t\t".'<tr class="form-field">';
|
44 |
+
$echo_str .= "\n\t\t\t\t\t\t".'<th scope="row">';
|
45 |
+
$echo_str .= "\n\t\t\t\t\t\t\t".'<label for="wfu_testprop">Test Property</label>';
|
46 |
+
$echo_str .= "\n\t\t\t\t\t\t".'</th>';
|
47 |
+
$echo_str .= "\n\t\t\t\t\t\t".'<td>';
|
48 |
+
$echo_str .= "\n\t\t\t\t\t\t\t".'<input name="wfu_testprop" id="wfu_testprop" type="text" value="Test Property" />';
|
49 |
+
$echo_str .= "\n\t\t\t\t\t\t\t".'<p style="cursor: text; font-size:9px; padding: 0px; margin: 0px; width: 95%; color: #AAAAAA;">Current value: <strong>Test Property</strong></p>';
|
50 |
+
$echo_str .= "\n\t\t\t\t\t\t".'</td>';
|
51 |
+
$echo_str .= "\n\t\t\t\t\t".'</tr>';
|
52 |
+
$echo_str .= "\n\t\t\t\t".'</tbody>';
|
53 |
+
$echo_str .= "\n\t\t\t".'</table>';
|
54 |
+
$echo_str .= "\n\t\t\t".'<p class="submit">';
|
55 |
+
$echo_str .= "\n\t\t\t\t".'<input type="submit" class="button-primary" name="submit" value="Update" disabled="disabled" />';
|
56 |
+
$echo_str .= "\n\t\t\t".'</p>';
|
57 |
+
$echo_str .= "\n\t\t".'</form>';
|
58 |
+
$echo_str .= "\n\t".'</div>';
|
59 |
+
$echo_str .= "\n".'</div>';
|
60 |
+
|
61 |
+
echo $echo_str;
|
62 |
+
}
|
63 |
+
|
64 |
+
function wfu_shortcode_composer() {
|
65 |
+
global $wpdb;
|
66 |
+
global $wp_roles;
|
67 |
+
|
68 |
+
// $plugin_options = wfu_decode_plugin_options(get_option( "wordpress_file_upload_options" ));
|
69 |
+
$components = wfu_component_definitions();
|
70 |
+
|
71 |
+
$cats = wfu_category_definitions();
|
72 |
+
$defs = wfu_attribute_definitions();
|
73 |
+
foreach ( $defs as $key => $def ) $defs[$key]['default'] = $def['value'];
|
74 |
+
|
75 |
+
// index $components
|
76 |
+
$components_indexed = array();
|
77 |
+
foreach ( $components as $component ) $components_indexed[$component['id']] = $component;
|
78 |
+
// index dependiencies
|
79 |
+
$governors = array();
|
80 |
+
|
81 |
+
$echo_str = '<div id="wfu_wrapper" class="wfu_wrap">';
|
82 |
+
$echo_str .= "\n\t".'<h2>Wordpress File Upload Shortcode Composer</h2>';
|
83 |
+
// $echo_str .= "\n\t\t".'<a href="/wp-admin/options-general.php?page=wordpress_file_upload&action=manage_settings" class="button" title="Go back">Go Back</a>';
|
84 |
+
$echo_str .= "\n\t".'<div style="margin-top:10px;">';
|
85 |
+
$echo_str .= "\n\t\t".'<div class="wfu_shortcode_container">';
|
86 |
+
$echo_str .= "\n\t\t\t".'<span><strong>Generated Shortcode</strong></span>';
|
87 |
+
$echo_str .= "\n\t\t\t".'<textarea id="wfu_shortcode" class="wfu_shortcode" rows="5">[wordpress_file_upload]</textarea>';
|
88 |
+
$echo_str .= "\n\t\t\t".'<div id="wfu_attribute_defaults" style="display:none;">';
|
89 |
+
foreach ( $defs as $def )
|
90 |
+
$echo_str .= "\n\t\t\t\t".'<input id="wfu_attribute_default_'.$def['attribute'].'" type="hidden" value="'.$def['default'].'" />';
|
91 |
+
$echo_str .= "\n\t\t\t".'</div>';
|
92 |
+
$echo_str .= "\n\t\t\t".'<div id="wfu_attribute_values" style="display:none;">';
|
93 |
+
foreach ( $defs as $def )
|
94 |
+
$echo_str .= "\n\t\t\t\t".'<input id="wfu_attribute_value_'.$def['attribute'].'" type="hidden" value="'.$def['value'].'" />';
|
95 |
+
$echo_str .= "\n\t\t\t".'</div>';
|
96 |
+
$echo_str .= "\n\t\t".'</div>';
|
97 |
+
$echo_str .= "\n\t".'</div>';
|
98 |
+
$echo_str .= "\n\t".'<h3 id="wfu_tab_container" class="nav-tab-wrapper">';
|
99 |
+
$is_first = true;
|
100 |
+
foreach ( $cats as $key => $cat ) {
|
101 |
+
$echo_str .= "\n\t\t".'<a id="wfu_tab_'.$key.'" class="nav-tab'.( $is_first ? ' nav-tab-active' : '' ).'" href="javascript: wfu_admin_activate_tab(\''.$key.'\');">'.$cat.'</a>';
|
102 |
+
$is_first = false;
|
103 |
+
}
|
104 |
+
$echo_str .= "\n\t".'</h3>';
|
105 |
+
|
106 |
+
$prevcat = "";
|
107 |
+
$prevsubcat = "";
|
108 |
+
$is_first = true;
|
109 |
+
$block_open = false;
|
110 |
+
$subblock_open = false;
|
111 |
+
foreach ( $defs as $def ) {
|
112 |
+
$attr = $def['attribute'];
|
113 |
+
$subblock_active = false;
|
114 |
+
//detect if the dependencies of this attribute will be disabled or not
|
115 |
+
if ( ( $def['type'] == "onoff" && $def['value'] == "true" ) ||
|
116 |
+
( $def['type'] == "radio" && in_array("*".$def['value'], $def['listitems']) ) )
|
117 |
+
$subblock_active = true;
|
118 |
+
// assign dependencies if exist
|
119 |
+
if ( $def['dependencies'] != null )
|
120 |
+
foreach ( $def['dependencies'] as $dependency ) {
|
121 |
+
if ( substr($dependency, 0, 1) == "!" ) //invert state for this dependency if an exclamation mark is defined
|
122 |
+
$governors[substr($dependency, 1)] = array( 'attribute' => $attr, 'active' => !$subblock_active, 'inv' => '_inv' );
|
123 |
+
else
|
124 |
+
$governors[$dependency] = array( 'attribute' => $attr, 'active' => $subblock_active, 'inv' => '' );
|
125 |
+
}
|
126 |
+
//check if this attribute depends on other
|
127 |
+
if ( $governors[$attr] != "" ) $governor = $governors[$attr];
|
128 |
+
else $governor = array( 'attribute' => "independent", 'active' => true, 'inv' => '' );
|
129 |
+
|
130 |
+
//close previous blocks
|
131 |
+
if ( $def['parent'] == "" ) {
|
132 |
+
if ( $subblock_open ) {
|
133 |
+
$echo_str .= "\n\t\t\t\t\t\t\t".'</tbody>';
|
134 |
+
$echo_str .= "\n\t\t\t\t\t\t".'</table>';
|
135 |
+
$subblock_open = false;
|
136 |
+
}
|
137 |
+
if ( $block_open ) {
|
138 |
+
$echo_str .= "\n\t\t\t\t\t".'</div></td>';
|
139 |
+
$echo_str .= "\n\t\t\t\t".'</tr>';
|
140 |
+
$block_open = false;
|
141 |
+
}
|
142 |
+
}
|
143 |
+
//check if new category must be generated
|
144 |
+
if ( $def['category'] != $prevcat ) {
|
145 |
+
if ( $prevcat != "" ) {
|
146 |
+
$echo_str .= "\n\t\t\t".'</tbody>';
|
147 |
+
$echo_str .= "\n\t\t".'</table>';
|
148 |
+
$echo_str .= "\n\t".'</div>';
|
149 |
+
}
|
150 |
+
$prevcat = $def['category'];
|
151 |
+
$prevsubcat = "";
|
152 |
+
$echo_str .= "\n\t".'<div id="wfu_container_'.$prevcat.'" class="wfu_container"'.( $is_first ? '' : ' style="display:none;"' ).'">';
|
153 |
+
$echo_str .= "\n\t\t".'<table class="form-table wfu_main_table">';
|
154 |
+
$echo_str .= "\n\t\t\t".'<thead><tr><th></th><td></td><td></td></tr></thead>';
|
155 |
+
$echo_str .= "\n\t\t\t".'<tbody>';
|
156 |
+
$is_first = false;
|
157 |
+
}
|
158 |
+
//check if new sub-category must be generated
|
159 |
+
if ( $def['subcategory'] != $prevsubcat ) {
|
160 |
+
$prevsubcat = $def['subcategory'];
|
161 |
+
$echo_str .= "\n\t\t\t\t".'<tr class="form-field wfu_subcategory">';
|
162 |
+
$echo_str .= "\n\t\t\t\t\t".'<th scope="row" colspan="3">';
|
163 |
+
$echo_str .= "\n\t\t\t\t\t\t".'<h3 style="margin-bottom: 10px; margin-top: 10px;">'.$prevsubcat.'</h3>';
|
164 |
+
$echo_str .= "\n\t\t\t\t\t".'</th>';
|
165 |
+
$echo_str .= "\n\t\t\t\t".'</tr>';
|
166 |
+
}
|
167 |
+
//draw attribute element
|
168 |
+
if ( $def['parent'] == "" ) {
|
169 |
+
$dlp = "\n\t\t\t\t";
|
170 |
+
}
|
171 |
+
else {
|
172 |
+
if ( !$subblock_open ) {
|
173 |
+
$echo_str .= "\n\t\t\t\t\t\t".'<div class="wfu_shadow wfu_shadow_'.$def['parent'].$governor['inv'].'" style="display:'.( $governor['active'] ? 'none' : 'block' ).';"></div>';
|
174 |
+
$echo_str .= "\n\t\t\t\t\t\t".'<table class="form-table wfu_inner_table" style="margin:0;">';
|
175 |
+
$echo_str .= "\n\t\t\t\t\t\t\t".'<tbody>';
|
176 |
+
}
|
177 |
+
$dlp = "\n\t\t\t\t\t\t\t\t";
|
178 |
+
}
|
179 |
+
$echo_str .= $dlp.'<tr class="form-field">';
|
180 |
+
$echo_str .= $dlp."\t".'<th scope="row"><div class="wfu_td_div">';
|
181 |
+
if ( $def['parent'] == "" ) $echo_str .= $dlp."\t\t".'<div class="wfu_shadow wfu_shadow_'.$governor['attribute'].$governor['inv'].'" style="display:'.( $governor['active'] ? 'none' : 'block' ).';"></div>';
|
182 |
+
$echo_str .= $dlp."\t\t".'<label for="wfu_attribute_'.$attr.'">'.$def['name'].'</label>';
|
183 |
+
$echo_str .= $dlp."\t\t".'<div class="wfu_help_container" title="'.$def['help'].'"><img src="'.WFU_IMAGE_ADMIN_HELP.'" ></div>';
|
184 |
+
$echo_str .= $dlp."\t".'</div></th>';
|
185 |
+
$echo_str .= $dlp."\t".'<td style="vertical-align:top;"><div class="wfu_td_div">';
|
186 |
+
if ( $def['parent'] == "" ) $echo_str .= $dlp."\t\t".'<div class="wfu_shadow wfu_shadow_'.$governor['attribute'].$governor['inv'].'" style="display:'.( $governor['active'] ? 'none' : 'block' ).';"></div>';
|
187 |
+
if ( $def['type'] == "onoff" ) {
|
188 |
+
$echo_str .= $dlp."\t\t".'<div id="wfu_attribute_'.$attr.'" class="wfu_onoff_container_'.( $def['value'] == "true" ? "on" : "off" ).'" onclick="wfu_admin_onoff_clicked(\''.$attr.'\');">';
|
189 |
+
$echo_str .= $dlp."\t\t\t".'<div class="wfu_onoff_slider"></div>';
|
190 |
+
$echo_str .= $dlp."\t\t\t".'<span class="wfu_onoff_text">ON</span>';
|
191 |
+
$echo_str .= $dlp."\t\t\t".'<span class="wfu_onoff_text">OFF</span>';
|
192 |
+
$echo_str .= $dlp."\t\t".'</div>';
|
193 |
+
}
|
194 |
+
elseif ( $def['type'] == "text" ) {
|
195 |
+
$echo_str .= $dlp."\t\t".'<input id="wfu_attribute_'.$attr.'" type="text" name="wfu_text_elements" value="'.$def['value'].'" />';
|
196 |
+
if ( $def['variables'] != null ) foreach ( $def['variables'] as $variable )
|
197 |
+
$echo_str .= $dlp."\t\t".'<span class="wfu_variable wfu_variable_'.$attr.'" title="'.constant("WFU_VARIABLE_TITLE_".strtoupper(str_replace("%", "", $variable))).'" ondblclick="wfu_insert_variable(this);">'.$variable.'</span>';
|
198 |
+
}
|
199 |
+
elseif ( $def['type'] == "placements" ) {
|
200 |
+
$components_used = array();
|
201 |
+
foreach ( $components as $component ) $components_used[$component['id']] = false;
|
202 |
+
$centered_content = '<div style="display:table; width:100%; height:100%;"><div style="display:table-cell; text-align:center; vertical-align:middle;">XXX</div></div>';
|
203 |
+
$echo_str .= $dlp."\t\t".'<div class="wfu_placements_wrapper">';
|
204 |
+
$echo_str .= $dlp."\t\t\t".'<div id="wfu_placements_container" class="wfu_placements_container">';
|
205 |
+
$itemplaces = explode("/", $def['value']);
|
206 |
+
foreach ( $itemplaces as $section ) {
|
207 |
+
$echo_str .= $dlp."\t\t\t\t".'<div class="wfu_component_separator_hor"></div>';
|
208 |
+
$echo_str .= $dlp."\t\t\t\t".'<div class="wfu_component_separator_ver"></div>';
|
209 |
+
$items_in_section = explode("+", trim($section));
|
210 |
+
$section_array = array( );
|
211 |
+
foreach ( $items_in_section as $item_in_section ) {
|
212 |
+
if ( key_exists($item_in_section, $components_indexed) ) {
|
213 |
+
$components_used[$item_in_section] = true;
|
214 |
+
$echo_str .= $dlp."\t\t\t\t".'<div id="wfu_component_box_'.$item_in_section.'" class="wfu_component_box" draggable="true">'.str_replace("XXX", $components_indexed[$item_in_section]['name'], $centered_content).'</div>';
|
215 |
+
$echo_str .= $dlp."\t\t\t\t".'<div class="wfu_component_separator_ver"></div>';
|
216 |
+
}
|
217 |
+
}
|
218 |
+
}
|
219 |
+
$echo_str .= $dlp."\t\t\t\t".'<div class="wfu_component_separator_hor"></div>';
|
220 |
+
$echo_str .= $dlp."\t\t\t\t".'<div id="wfu_component_bar_hor" class="wfu_component_bar_hor"></div>';
|
221 |
+
$echo_str .= $dlp."\t\t\t\t".'<div id="wfu_component_bar_ver" class="wfu_component_bar_ver"></div>';
|
222 |
+
$echo_str .= $dlp."\t\t\t".'</div>';
|
223 |
+
$echo_str .= $dlp."\t\t\t".'<div id="wfu_componentlist_container" class="wfu_componentlist_container">';
|
224 |
+
$echo_str .= $dlp."\t\t\t\t".'<div id="wfu_componentlist_dragdrop" class="wfu_componentlist_dragdrop" style="display:none;"></div>';
|
225 |
+
$ii = 1;
|
226 |
+
foreach ( $components as $component ) {
|
227 |
+
$echo_str .= $dlp."\t\t\t\t".'<div id="wfu_component_box_container_'.$component['id'].'" class="wfu_component_box_container">';
|
228 |
+
$echo_str .= $dlp."\t\t\t\t\t".'<div class="wfu_component_box_base">'.str_replace("XXX", $component['name'], $centered_content).'</div>';
|
229 |
+
if ( !$components_used[$component['id']] )
|
230 |
+
$echo_str .= $dlp."\t\t\t\t\t".'<div id="wfu_component_box_'.$component['id'].'" class="wfu_component_box wfu_inbase" draggable="true">'.str_replace("XXX", $component['name'], $centered_content).'</div>';
|
231 |
+
$echo_str .= $dlp."\t\t\t\t".'</div>'.( ($ii++) % 3 == 0 ? '<br />' : '' );
|
232 |
+
}
|
233 |
+
$echo_str .= $dlp."\t\t\t".'</div>';
|
234 |
+
$echo_str .= $dlp."\t\t".'</div>';
|
235 |
+
}
|
236 |
+
elseif ( $def['type'] == "ltext" ) {
|
237 |
+
$echo_str .= $dlp."\t\t".'<input id="wfu_attribute_'.$attr.'" type="text" name="wfu_text_elements" class="wfu_long_text" value="'.$def['value'].'" />';
|
238 |
+
if ( $def['variables'] != null ) foreach ( $def['variables'] as $variable )
|
239 |
+
$echo_str .= $dlp."\t\t".'<span class="wfu_variable wfu_variable_'.$attr.'" title="'.constant("WFU_VARIABLE_TITLE_".strtoupper(str_replace("%", "", $variable))).'" ondblclick="wfu_insert_variable(this);">'.$variable.'</span>';
|
240 |
+
}
|
241 |
+
elseif ( $def['type'] == "integer" ) {
|
242 |
+
$echo_str .= $dlp."\t\t".'<input id="wfu_attribute_'.$attr.'" type="number" name="wfu_text_elements" class="wfu_short_text" min="1" value="'.$def['value'].'" />';
|
243 |
+
}
|
244 |
+
elseif ( $def['type'] == "float" ) {
|
245 |
+
$echo_str .= $dlp."\t\t".'<input id="wfu_attribute_'.$attr.'" type="number" name="wfu_text_elements" class="wfu_short_text" step="any" min="0" value="'.$def['value'].'" />';
|
246 |
+
}
|
247 |
+
elseif ( $def['type'] == "radio" ) {
|
248 |
+
$echo_str .= $dlp."\t\t";
|
249 |
+
$ii = 0;
|
250 |
+
foreach ( $def['listitems'] as $item )
|
251 |
+
$echo_str .= '<input name="wfu_radioattribute_'.$attr.'" type="radio" value="'.$item.'" '.( $item == $def['value'] || $item == "*".$def['value'] ? 'checked="checked" ' : '' ).'style="width:auto; margin:0px 2px 0px '.( ($ii++) == 0 ? '0px' : '8px' ).';" onchange="wfu_admin_radio_clicked(\''.$attr.'\');" />'.( $item[0] == "*" ? substr($item, 1) : $item );
|
252 |
+
// $echo_str .= '<input type="button" class="button" value="empty" style="width:auto; margin:-2px 0px 0px 8px;" />';
|
253 |
+
}
|
254 |
+
elseif ( $def['type'] == "ptext" ) {
|
255 |
+
$parts = explode("/", $def['value']);
|
256 |
+
$singular = $parts[0];
|
257 |
+
if ( count($parts) < 2 ) $plural = $singular;
|
258 |
+
else $plural = $parts[1];
|
259 |
+
$echo_str .= $dlp."\t\t".'<span class="wfu_ptext_span">Singular</span><input id="wfu_attribute_s_'.$attr.'" type="text" name="wfu_ptext_elements" value="'.$singular.'" />';
|
260 |
+
if ( $def['variables'] != null ) if ( count($def['variables']) > 0 ) $echo_str .= $dlp."\t\t".'<br /><span class="wfu_ptext_span"> </span>';
|
261 |
+
if ( $def['variables'] != null ) foreach ( $def['variables'] as $variable )
|
262 |
+
$echo_str .= $dlp."\t\t".'<span class="wfu_variable wfu_variable_s_'.$attr.'" title="'.constant("WFU_VARIABLE_TITLE_".strtoupper(str_replace("%", "", $variable))).'" ondblclick="wfu_insert_variable(this);">'.$variable.'</span>';
|
263 |
+
$echo_str .= $dlp."\t\t".'<br /><span class="wfu_ptext_span">Plural</span><input id="wfu_attribute_p_'.$attr.'" type="text" name="wfu_ptext_elements" value="'.$plural.'" />';
|
264 |
+
if ( $def['variables'] != null ) if ( count($def['variables']) > 0 ) $echo_str .= $dlp."\t\t".'<br /><span class="wfu_ptext_span"> </span>';
|
265 |
+
if ( $def['variables'] != null ) foreach ( $def['variables'] as $variable )
|
266 |
+
$echo_str .= $dlp."\t\t".'<span class="wfu_variable wfu_variable_p_'.$attr.'" title'.constant("WFU_VARIABLE_TITLE_".strtoupper(str_replace("%", "", $variable))).'" ondblclick="wfu_insert_variable(this);">'.$variable.'</span>';
|
267 |
+
}
|
268 |
+
elseif ( $def['type'] == "mtext" ) {
|
269 |
+
$echo_str .= $dlp."\t\t".'<textarea id="wfu_attribute_'.$attr.'" name="wfu_text_elements" rows="5">'.$def['value'].'</textarea>';
|
270 |
+
if ( $def['variables'] != null ) foreach ( $def['variables'] as $variable )
|
271 |
+
$echo_str .= $dlp."\t\t".'<span class="wfu_variable wfu_variable_'.$attr.'" title="'.constant("WFU_VARIABLE_TITLE_".strtoupper(str_replace("%", "", $variable))).'" ondblclick="wfu_insert_variable(this);">'.$variable.'</span>';
|
272 |
+
}
|
273 |
+
elseif ( $def['type'] == "rolelist" ) {
|
274 |
+
$roles = $wp_roles->get_names();
|
275 |
+
$selected = explode(",", $def['value']);
|
276 |
+
foreach ( $selected as $key => $item ) $selected[$key] = trim($item);
|
277 |
+
$echo_str .= $dlp."\t\t".'<select id="wfu_attribute_'.$attr.'" multiple="multiple" size="'.count($roles).'" onchange="wfu_update_rolelist_value(\''.$attr.'\');">';
|
278 |
+
foreach ( $roles as $roleid => $rolename )
|
279 |
+
$echo_str .= $dlp."\t\t\t".'<option value="'.$roleid.'"'.( in_array($roleid, $selected) ? ' selected="selected"' : '' ).'>'.$rolename.'</option>';
|
280 |
+
$echo_str .= $dlp."\t\t".'</select>';
|
281 |
+
}
|
282 |
+
elseif ( $def['type'] == "dimensions" ) {
|
283 |
+
$vals_arr = explode(",", $def['value']);
|
284 |
+
$vals = array();
|
285 |
+
foreach ( $vals_arr as $val_raw ) {
|
286 |
+
list($val_id, $val) = explode(":", $val_raw);
|
287 |
+
$vals[trim($val_id)] = trim($val);
|
288 |
+
}
|
289 |
+
$dims = array();
|
290 |
+
foreach ( $components as $comp ) {
|
291 |
+
if ( $comp['dimensions'] == null ) $dims[$comp['id']] = $comp['name'];
|
292 |
+
else foreach ( $comp['dimensions'] as $dimraw ) {
|
293 |
+
list($dim_id, $dim_name) = explode("/", $dimraw);
|
294 |
+
$dims[$dim_id] = $dim_name;
|
295 |
+
}
|
296 |
+
}
|
297 |
+
foreach ( $dims as $dim_id => $dim_name ) {
|
298 |
+
$echo_str .= $dlp."\t\t".'<span style="display:inline-block; width:130px;">'.$dim_name.'</span><input id="wfu_attribute_'.$attr.'_'.$dim_id.'" type="text" name="wfu_dimension_elements_'.$attr.'" class="wfu_short_text" value="'.$vals[$dim_id].'" /><br />';
|
299 |
+
}
|
300 |
+
}
|
301 |
+
elseif ( $def['type'] == "userfields" ) {
|
302 |
+
$fields_arr = explode("/", $def['value']);
|
303 |
+
$fields = array();
|
304 |
+
foreach ( $fields_arr as $field_raw ) {
|
305 |
+
$is_req = ( substr($field_raw, 0, 1) == "*" );
|
306 |
+
if ( $is_req ) $field_raw = substr($field_raw, 1);
|
307 |
+
if ( $field_raw != "" ) array_push($fields, array( "name" => $field_raw, "required" => $is_req ));
|
308 |
+
}
|
309 |
+
if ( count($fields) == 0 ) array_push($fields, array( "name" => "", "required" => false ));
|
310 |
+
$echo_str .= $dlp."\t\t".'<div class="wfu_userdata_container">';
|
311 |
+
foreach ( $fields as $field ) {
|
312 |
+
$echo_str .= $dlp."\t\t\t".'<div class="wfu_userdata_line">';
|
313 |
+
$echo_str .= $dlp."\t\t\t\t".'<input type="text" name="wfu_userfield_elements" value="'.$field['name'].'" />';
|
314 |
+
$echo_str .= $dlp."\t\t\t\t".'<div class="wfu_userdata_action" onclick="wfu_userdata_add_field(this);"><img src="'.WFU_IMAGE_ADMIN_USERDATA_ADD.'" ></div>';
|
315 |
+
$echo_str .= $dlp."\t\t\t\t".'<div class="wfu_userdata_action wfu_userdata_action_disabled" onclick="wfu_userdata_remove_field(this);"><img src="'.WFU_IMAGE_ADMIN_USERDATA_REMOVE.'" ></div>';
|
316 |
+
$echo_str .= $dlp."\t\t\t\t".'<input type="checkbox"'.( $field['required'] ? 'checked="checked"' : '' ).' onchange="wfu_update_userfield_value({target:this});" />';
|
317 |
+
$echo_str .= $dlp."\t\t\t\t".'<span>Required</span>';
|
318 |
+
$echo_str .= $dlp."\t\t\t".'</div>';
|
319 |
+
}
|
320 |
+
$echo_str .= $dlp."\t\t".'</div>';
|
321 |
+
}
|
322 |
+
elseif ( $def['type'] == "color" ) {
|
323 |
+
$echo_str .= $dlp."\t\t".'<input id="wfu_attribute_'.$attr.'" type="text" name="wfu_text_elements" class="wfu_color_field" value="'.$def['value'].'" />';
|
324 |
+
}
|
325 |
+
elseif ( $def['type'] == "color-triplet" ) {
|
326 |
+
$triplet = explode(",", $def['value']);
|
327 |
+
foreach ( $triplet as $key => $item ) $triplet[$key] = trim($item);
|
328 |
+
$echo_str .= $dlp."\t\t".'<div class="wfu_color_container"><label style="display:inline-block; width:120px; margin-top:-16px;">Text Color</label><input id="wfu_attribute_'.$attr.'_color" type="text" class="wfu_color_field" name="wfu_triplecolor_elements" value="'.$triplet[0].'" /></div>';
|
329 |
+
$echo_str .= $dlp."\t\t".'<div class="wfu_color_container"><label style="display:inline-block; width:120px; margin-top:-16px;">Background Color</label><input id="wfu_attribute_'.$attr.'_bgcolor" type="text" class="wfu_color_field" name="wfu_triplecolor_elements" value="'.$triplet[1].'" /></div>';
|
330 |
+
$echo_str .= $dlp."\t\t".'<div class="wfu_color_container"><label style="display:inline-block; width:120px; margin-top:-16px;">Border Color</label><input id="wfu_attribute_'.$attr.'_borcolor" type="text" class="wfu_color_field" name="wfu_triplecolor_elements" value="'.$triplet[2].'" /></div>';
|
331 |
+
}
|
332 |
+
else {
|
333 |
+
$echo_str .= $dlp."\t\t".'<input id="wfu_attribute_'.$attr.'" type="text" name="wfu_text_elements" value="'.$def['value'].'" />';
|
334 |
+
if ( $def['variables'] != null ) foreach ( $def['variables'] as $variable )
|
335 |
+
$echo_str .= $dlp."\t\t".'<span class="wfu_variable wfu_variable_'.$attr.'" title="'.constant("WFU_VARIABLE_TITLE_".strtoupper(str_replace("%", "", $variable))).'" ondblclick="wfu_insert_variable(this);">'.$variable.'</span>';
|
336 |
+
}
|
337 |
+
$echo_str .= $dlp."\t".'</div></td>';
|
338 |
+
if ( $def['parent'] == "" ) {
|
339 |
+
$echo_str .= $dlp."\t".'<td style="position:relative; vertical-align:top; padding:0;"><div class="wfu_td_div">';
|
340 |
+
$block_open = false;
|
341 |
+
}
|
342 |
+
else {
|
343 |
+
$echo_str .= $dlp.'</tr>';
|
344 |
+
$subblock_open = true;
|
345 |
+
}
|
346 |
+
}
|
347 |
+
if ( $subblock_open ) {
|
348 |
+
$echo_str .= "\n\t\t\t\t\t\t".'</div>';
|
349 |
+
}
|
350 |
+
if ( $block_open ) {
|
351 |
+
$echo_str .= "\n\t\t\t\t\t".'</div></td>';
|
352 |
+
$echo_str .= "\n\t\t\t\t".'</tr>';
|
353 |
+
}
|
354 |
+
$echo_str .= "\n\t\t\t".'</tbody>';
|
355 |
+
$echo_str .= "\n\t\t".'</table>';
|
356 |
+
$handler = 'function() { wfu_Attach_Admin_Events(); }';
|
357 |
+
$echo_str .= "\n\t".'<script type="text/javascript">if(window.addEventListener) { window.addEventListener("load", '.$handler.', false); } else if(window.attachEvent) { window.attachEvent("onload", '.$handler.'); } else { window["onload"] = '.$handler.'; }</script>';
|
358 |
+
$echo_str .= "\n".'</div>';
|
359 |
+
// $echo_str .= "\n\t".'<div style="margin-top:10px;">';
|
360 |
+
// $echo_str .= "\n\t\t".'<label>Final shortcode text</label>';
|
361 |
+
// $echo_str .= "\n\t".'</div>';
|
362 |
+
|
363 |
+
echo $echo_str;
|
364 |
+
}
|
365 |
+
|
366 |
+
function wfu_update_settings() {
|
367 |
+
}
|
368 |
+
|
369 |
+
?>
|
lib/wfu_ajaxactions.php
ADDED
@@ -0,0 +1,84 @@
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
1 |
+
<?php
|
2 |
+
|
3 |
+
|
4 |
+
function wfu_ajax_action_send_email_notification() {
|
5 |
+
$user = wp_get_current_user();
|
6 |
+
if ( 0 == $user->ID ) $is_admin = false;
|
7 |
+
else $is_admin = current_user_can('manage_options');
|
8 |
+
|
9 |
+
$arr = wfu_get_params_fields_from_index($_POST['params_index']);
|
10 |
+
//check referer using server sessions to avoid CSRF attacks
|
11 |
+
if ( $_SESSION["wfu_token_".$arr['shortcode_id']] != $_POST['session_token'] ) die();
|
12 |
+
if ( $user->user_login != $arr['user_login'] ) die();
|
13 |
+
|
14 |
+
$params_str = get_option('wfu_params_'.$arr['unique_id']);
|
15 |
+
$params = wfu_decode_array_from_string($params_str);
|
16 |
+
|
17 |
+
/* initialize return array */
|
18 |
+
$params_output_array["version"] = "full";
|
19 |
+
$params_output_array["general"]['shortcode_id'] = $params["uploadid"];
|
20 |
+
$params_output_array["general"]['unique_id'] = ( isset($_POST['unique_id']) ? $_POST['unique_id'] : "" );
|
21 |
+
$params_output_array["general"]['state'] = 0;
|
22 |
+
$params_output_array["general"]['files_count'] = 0;
|
23 |
+
$params_output_array["general"]['update_wpfilebase'] = "";
|
24 |
+
$params_output_array["general"]['redirect_link'] = "";
|
25 |
+
$params_output_array["general"]['upload_finish_time'] = "";
|
26 |
+
$params_output_array["general"]['message'] = "";
|
27 |
+
$params_output_array["general"]['message_type'] = "";
|
28 |
+
$params_output_array["general"]['admin_messages']['wpfilebase'] = "";
|
29 |
+
$params_output_array["general"]['admin_messages']['notify'] = "";
|
30 |
+
$params_output_array["general"]['admin_messages']['redirect'] = "";
|
31 |
+
$params_output_array["general"]['admin_messages']['other'] = "";
|
32 |
+
$params_output_array["general"]['errors']['wpfilebase'] = "";
|
33 |
+
$params_output_array["general"]['errors']['notify'] = "";
|
34 |
+
$params_output_array["general"]['errors']['redirect'] = "";
|
35 |
+
$params_output_array["general"]['color'] = "black";
|
36 |
+
$params_output_array["general"]['bgcolor'] = "#F5F5F5";
|
37 |
+
$params_output_array["general"]['borcolor'] = "#D3D3D3";
|
38 |
+
$params_output_array["general"]['notify_only_filename_list'] = "";
|
39 |
+
$params_output_array["general"]['notify_target_path_list'] = "";
|
40 |
+
$params_output_array["general"]['notify_attachment_list'] = "";
|
41 |
+
$params_output_array["general"]['fail_message'] = WFU_ERROR_UNKNOWN;
|
42 |
+
|
43 |
+
// prepare user data
|
44 |
+
$userdata_fields = $params["userdata_fields"];
|
45 |
+
foreach ( $userdata_fields as $userdata_key => $userdata_field )
|
46 |
+
$userdata_fields[$userdata_key]["value"] = ( isset($_POST['userdata_'.$userdata_key]) ? $_POST['userdata_'.$userdata_key] : "" );
|
47 |
+
|
48 |
+
$send_error = wfu_send_notification_email($user, $_POST['only_filename_list'], $_POST['target_path_list'], $_POST['attachment_list'], $userdata_fields, $params);
|
49 |
+
|
50 |
+
/* suppress any errors if user is not admin */
|
51 |
+
if ( !$is_admin ) $send_error = "";
|
52 |
+
|
53 |
+
if ( $send_error != "" ) {
|
54 |
+
$params_output_array["general"]['admin_messages']['notify'] = $send_error;
|
55 |
+
$params_output_array["general"]['errors']['notify'] = "error";
|
56 |
+
}
|
57 |
+
|
58 |
+
/* construct safe output */
|
59 |
+
$sout = "0;".WFU_DEFAULTMESSAGECOLORS.";0";
|
60 |
+
|
61 |
+
die("success:".$sout.":".wfu_encode_array_to_string($params_output_array));
|
62 |
+
}
|
63 |
+
|
64 |
+
function wfu_ajax_action_callback() {
|
65 |
+
$user = wp_get_current_user();
|
66 |
+
$arr = wfu_get_params_fields_from_index($_POST['params_index']);
|
67 |
+
//check referer using server sessions to avoid CSRF attacks
|
68 |
+
if ( $_SESSION["wfu_token_".$arr['shortcode_id']] != $_POST['session_token'] ) die();
|
69 |
+
if ( $user->user_login != $arr['user_login'] ) die();
|
70 |
+
|
71 |
+
$params_str = get_option('wfu_params_'.$arr['unique_id']);
|
72 |
+
$params = wfu_decode_array_from_string($params_str);
|
73 |
+
|
74 |
+
$params['subdir_selection_index'] = $_POST['subdir_sel_index'];
|
75 |
+
$_SESSION['wfu_check_refresh_'.$params["uploadid"]] = 'do not process';
|
76 |
+
|
77 |
+
$wfu_process_file_array = wfu_process_files($params, 'ajax');
|
78 |
+
// extract safe_output from wfu_process_file_array and pass it as separate part of the response text
|
79 |
+
$safe_output = $wfu_process_file_array["general"]['safe_output'];
|
80 |
+
unset($wfu_process_file_array["general"]['safe_output']);
|
81 |
+
die("success:".$safe_output.":".wfu_encode_array_to_string($wfu_process_file_array));
|
82 |
+
}
|
83 |
+
|
84 |
+
?>
|
lib/wfu_attributes.php
ADDED
@@ -0,0 +1,724 @@
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â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|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
1 |
+
<?php
|
2 |
+
|
3 |
+
function wfu_component_definitions() {
|
4 |
+
$components = array(
|
5 |
+
array(
|
6 |
+
"id" => "title",
|
7 |
+
"name" => "Title",
|
8 |
+
"mode" => "free",
|
9 |
+
"dimensions" => null,
|
10 |
+
"help" => "A title text for the plugin"
|
11 |
+
),
|
12 |
+
array(
|
13 |
+
"id" => "filename",
|
14 |
+
"name" => "Filename",
|
15 |
+
"mode" => "free",
|
16 |
+
"dimensions" => null,
|
17 |
+
"help" => "It shows the name of the selected file (useful only for single file uploads)."
|
18 |
+
),
|
19 |
+
array(
|
20 |
+
"id" => "selectbutton",
|
21 |
+
"name" => "Select Button",
|
22 |
+
"mode" => "free",
|
23 |
+
"dimensions" => null,
|
24 |
+
"help" => "Represents the button to select the files for upload."
|
25 |
+
),
|
26 |
+
array(
|
27 |
+
"id" => "uploadbutton",
|
28 |
+
"name" => "Upload Button",
|
29 |
+
"mode" => "free",
|
30 |
+
"dimensions" => null,
|
31 |
+
"help" => "Represents the button to execute the upload after some files have been selected."
|
32 |
+
),
|
33 |
+
array(
|
34 |
+
"id" => "subfolders",
|
35 |
+
"name" => "Subfolders",
|
36 |
+
"mode" => "free",
|
37 |
+
"dimensions" => array("subfolders_label/Subfolders Label", "subfolders_select/Subfolders List"),
|
38 |
+
"help" => "Allows the user to select the upload folder from a dropdown list."
|
39 |
+
),
|
40 |
+
array(
|
41 |
+
"id" => "progressbar",
|
42 |
+
"name" => "Progressbar",
|
43 |
+
"mode" => "free",
|
44 |
+
"dimensions" => null,
|
45 |
+
"help" => "Displays a simple progress bar, showing total progress of upload."
|
46 |
+
),
|
47 |
+
array(
|
48 |
+
"id" => "userdata",
|
49 |
+
"name" => "User Fields",
|
50 |
+
"mode" => "free",
|
51 |
+
"dimensions" => null,
|
52 |
+
"help" => "Displays additional fields that the user must fill-in together with the uploaded files."
|
53 |
+
),
|
54 |
+
array(
|
55 |
+
"id" => "message",
|
56 |
+
"name" => "Message",
|
57 |
+
"mode" => "free",
|
58 |
+
"dimensions" => null,
|
59 |
+
"help" => "Displays a message block with information about the upload, together with any warnings or errors."
|
60 |
+
)
|
61 |
+
);
|
62 |
+
|
63 |
+
wfu_array_remove_nulls($components);
|
64 |
+
|
65 |
+
return $components;
|
66 |
+
}
|
67 |
+
|
68 |
+
function wfu_category_definitions() {
|
69 |
+
$cats = array(
|
70 |
+
"general" => "General",
|
71 |
+
"placements" => "Placements",
|
72 |
+
"general" => "General",
|
73 |
+
"labels" => "Labels",
|
74 |
+
"notifications" => "Notifications",
|
75 |
+
"colors" => "Colors",
|
76 |
+
"dimensions" => "Dimensions",
|
77 |
+
"general" => "General",
|
78 |
+
"userdata" => "Additional Fields",
|
79 |
+
"interoperability" => "Interoperability"
|
80 |
+
);
|
81 |
+
|
82 |
+
return $cats;
|
83 |
+
}
|
84 |
+
|
85 |
+
function wfu_attribute_definitions() {
|
86 |
+
$defs = array(
|
87 |
+
array(
|
88 |
+
"name" => "Plugin ID",
|
89 |
+
"attribute" => "uploadid",
|
90 |
+
"type" => "integer",
|
91 |
+
"listitems" => null,
|
92 |
+
"value" => WFU_UPLOADID,
|
93 |
+
"mode" => "free",
|
94 |
+
"category" => "general",
|
95 |
+
"subcategory" => "Basic Functionalities",
|
96 |
+
"parent" => "",
|
97 |
+
"dependencies" => null,
|
98 |
+
"variables" => null,
|
99 |
+
"help" => "The unique id of each shortcode. When you have many shortcodes of this plugin in the same page, then you must use different id for each one."
|
100 |
+
),
|
101 |
+
array(
|
102 |
+
"name" => "Single Button Operation",
|
103 |
+
"attribute" => "singlebutton",
|
104 |
+
"type" => "onoff",
|
105 |
+
"listitems" => null,
|
106 |
+
"value" => WFU_SINGLEBUTTON,
|
107 |
+
"mode" => "free",
|
108 |
+
"category" => "general",
|
109 |
+
"subcategory" => "Basic Functionalities",
|
110 |
+
"parent" => "",
|
111 |
+
"dependencies" => array("!uploadbutton"),
|
112 |
+
"variables" => null,
|
113 |
+
"help" => "When it is activated, no Upload button will be shown, but upload will start automatically as soon as files are selected."
|
114 |
+
),
|
115 |
+
array(
|
116 |
+
"name" => "Upload Path",
|
117 |
+
"attribute" => "uploadpath",
|
118 |
+
"type" => "ltext",
|
119 |
+
"listitems" => null,
|
120 |
+
"value" => WFU_UPLOADPATH,
|
121 |
+
"mode" => "free",
|
122 |
+
"category" => "general",
|
123 |
+
"subcategory" => "Basic Functionalities",
|
124 |
+
"parent" => "",
|
125 |
+
"dependencies" => null,
|
126 |
+
"variables" => array("%username%", "%blogid%"),
|
127 |
+
"help" => "This is the folder where the files will be uploaded. The path is relative to wp-contents folder of your Wordpress website. The path can be dynamic by including variables such as %username% or %blogid%. Please check Documentation on how to use variables inside uploadpath."
|
128 |
+
),
|
129 |
+
array(
|
130 |
+
"name" => "Upload Roles",
|
131 |
+
"attribute" => "uploadrole",
|
132 |
+
"type" => "rolelist",
|
133 |
+
"listitems" => null,
|
134 |
+
"value" => WFU_UPLOADROLE,
|
135 |
+
"mode" => "free",
|
136 |
+
"category" => "general",
|
137 |
+
"subcategory" => "Filters",
|
138 |
+
"parent" => "",
|
139 |
+
"dependencies" => null,
|
140 |
+
"variables" => null,
|
141 |
+
"help" => "Defines the categories (roles) of users allowed to upload files. Multiple selections can be made. If 'all' is selected, then all users, even guests (non logged users) can upload files. Please use carefully."
|
142 |
+
),
|
143 |
+
array(
|
144 |
+
"name" => "Allowed File Extensions",
|
145 |
+
"attribute" => "uploadpatterns",
|
146 |
+
"type" => "text",
|
147 |
+
"listitems" => null,
|
148 |
+
"value" => WFU_UPLOADPATTERNS,
|
149 |
+
"mode" => "free",
|
150 |
+
"category" => "general",
|
151 |
+
"subcategory" => "Filters",
|
152 |
+
"parent" => "",
|
153 |
+
"dependencies" => null,
|
154 |
+
"variables" => null,
|
155 |
+
"help" => "Defines the allowed file extensions. Multiple extentions can be defined, separated with comma (,)."
|
156 |
+
),
|
157 |
+
array(
|
158 |
+
"name" => "Allowed File Size",
|
159 |
+
"attribute" => "maxsize",
|
160 |
+
"type" => "float",
|
161 |
+
"listitems" => null,
|
162 |
+
"value" => WFU_MAXSIZE,
|
163 |
+
"mode" => "free",
|
164 |
+
"category" => "general",
|
165 |
+
"subcategory" => "Filters",
|
166 |
+
"parent" => "",
|
167 |
+
"dependencies" => null,
|
168 |
+
"variables" => null,
|
169 |
+
"help" => "Defines the allowed file size in MBytes. Files larger than maxsize will not be uploaded. Floating point numbers can be used (e.g. '2.5')."
|
170 |
+
),
|
171 |
+
array(
|
172 |
+
"name" => "Create Upload Path",
|
173 |
+
"attribute" => "createpath",
|
174 |
+
"type" => "onoff",
|
175 |
+
"listitems" => null,
|
176 |
+
"value" => WFU_CREATEPATH,
|
177 |
+
"mode" => "free",
|
178 |
+
"category" => "general",
|
179 |
+
"subcategory" => "Upload Path and Files",
|
180 |
+
"parent" => "",
|
181 |
+
"dependencies" => null,
|
182 |
+
"variables" => null,
|
183 |
+
"help" => "If activated then the plugin will attempt to create the upload path, if it does not exist."
|
184 |
+
),
|
185 |
+
array(
|
186 |
+
"name" => "Folder Access Method",
|
187 |
+
"attribute" => "accessmethod",
|
188 |
+
"type" => "radio",
|
189 |
+
"listitems" => array("normal", "*ftp"),
|
190 |
+
"value" => WFU_ACCESSMETHOD,
|
191 |
+
"mode" => "free",
|
192 |
+
"category" => "general",
|
193 |
+
"subcategory" => "Upload Path and Files",
|
194 |
+
"parent" => "",
|
195 |
+
"dependencies" => array("ftpinfo", "userftpdomain"),
|
196 |
+
"variables" => null,
|
197 |
+
"help" => "Some times files cannot be uploaded to the upload folder because of read/write permissions. A workaround is to use ftp to transfer the files, however ftp credentials must be declared, so use carefully and only if necessary."
|
198 |
+
),
|
199 |
+
array(
|
200 |
+
"name" => "FTP Access Credentials",
|
201 |
+
"attribute" => "ftpinfo",
|
202 |
+
"type" => "ltext",
|
203 |
+
"listitems" => null,
|
204 |
+
"value" => WFU_FTPINFO,
|
205 |
+
"mode" => "free",
|
206 |
+
"category" => "general",
|
207 |
+
"subcategory" => "Upload Path and Files",
|
208 |
+
"parent" => "accessmethod",
|
209 |
+
"dependencies" => null,
|
210 |
+
"variables" => null,
|
211 |
+
"help" => "If FTP access method is selected, then FTP credentials must be declared here, in the form username:password@ftpdomain."
|
212 |
+
),
|
213 |
+
array(
|
214 |
+
"name" => "Use FTP Domain",
|
215 |
+
"attribute" => "useftpdomain",
|
216 |
+
"type" => "onoff",
|
217 |
+
"listitems" => null,
|
218 |
+
"value" => WFU_USEFTPDOMAIN,
|
219 |
+
"mode" => "free",
|
220 |
+
"category" => "general",
|
221 |
+
"subcategory" => "Upload Path and Files",
|
222 |
+
"parent" => "accessmethod",
|
223 |
+
"dependencies" => null,
|
224 |
+
"variables" => null,
|
225 |
+
"help" => "If FTP access method is selected, then sometimes the FTP domain is different than the domain of your Wordpress installation. In this case, enable this attribute if upload of files is not successful."
|
226 |
+
),
|
227 |
+
array(
|
228 |
+
"name" => "Show Upload Folder Path",
|
229 |
+
"attribute" => "showtargetfolder",
|
230 |
+
"type" => "onoff",
|
231 |
+
"listitems" => null,
|
232 |
+
"value" => WFU_SHOWTARGETFOLDER,
|
233 |
+
"mode" => "free",
|
234 |
+
"category" => "general",
|
235 |
+
"subcategory" => "Upload Path and Files",
|
236 |
+
"parent" => "",
|
237 |
+
"dependencies" => array("targetfolderlabel"),
|
238 |
+
"variables" => null,
|
239 |
+
"help" => "It defines if a label with the upload directory will be shown."
|
240 |
+
),
|
241 |
+
array(
|
242 |
+
"name" => "Select Subfolder",
|
243 |
+
"attribute" => "askforsubfolders",
|
244 |
+
"type" => "onoff",
|
245 |
+
"listitems" => null,
|
246 |
+
"value" => WFU_ASKFORSUBFOLDERS,
|
247 |
+
"mode" => "free",
|
248 |
+
"category" => "general",
|
249 |
+
"subcategory" => "Upload Path and Files",
|
250 |
+
"parent" => "",
|
251 |
+
"dependencies" => array("subfoldertree"),
|
252 |
+
"variables" => null,
|
253 |
+
"help" => "If enabled then user can select the upload folder from a drop down list. The list is defined in subfoldertree attribute. The folder paths are relative to the path defined in uploadpath."
|
254 |
+
),
|
255 |
+
array(
|
256 |
+
"name" => "List of Subfolders",
|
257 |
+
"attribute" => "subfoldertree",
|
258 |
+
"type" => "mtext",
|
259 |
+
"listitems" => null,
|
260 |
+
"value" => WFU_SUBFOLDERTREE,
|
261 |
+
"mode" => "free",
|
262 |
+
"category" => "general",
|
263 |
+
"subcategory" => "Upload Path and Files",
|
264 |
+
"parent" => "askforsubfolders",
|
265 |
+
"dependencies" => null,
|
266 |
+
"variables" => null,
|
267 |
+
"help" => "The list of folders a user can select. Please see documentation on how to create the list of folders."
|
268 |
+
),
|
269 |
+
array(
|
270 |
+
"name" => "File Dublicates Policy",
|
271 |
+
"attribute" => "dublicatespolicy",
|
272 |
+
"type" => "radio",
|
273 |
+
"listitems" => array("overwrite", "reject", "*maintain both"),
|
274 |
+
"value" => WFU_DUBLICATESPOLICY,
|
275 |
+
"mode" => "free",
|
276 |
+
"category" => "general",
|
277 |
+
"subcategory" => "Upload Path and Files",
|
278 |
+
"parent" => "",
|
279 |
+
"dependencies" => array("uniquepattern"),
|
280 |
+
"variables" => null,
|
281 |
+
"help" => "It determines what happens when an uploaded file has the same name with an existing file. The uploaded file can overwrite the existing one, be rejected or both can be kept by renaming the uploaded file according to a rule defined in uniquepattern attribute."
|
282 |
+
),
|
283 |
+
array(
|
284 |
+
"name" => "File Rename Rule",
|
285 |
+
"attribute" => "uniquepattern",
|
286 |
+
"type" => "radio",
|
287 |
+
"listitems" => array("index", "datetimestamp"),
|
288 |
+
"value" => WFU_UNIQUEPATTERN,
|
289 |
+
"mode" => "free",
|
290 |
+
"category" => "general",
|
291 |
+
"subcategory" => "Upload Path and Files",
|
292 |
+
"parent" => "dublicatespolicy",
|
293 |
+
"dependencies" => null,
|
294 |
+
"variables" => null,
|
295 |
+
"help" => "If dublicatespolicy is set to 'maintain both', then this rule defines how the uploaded file will be renamed, in order not to match an existing file. An incremental index number or a datetime stamp can be included in the uploaded file name to make it unique."
|
296 |
+
),
|
297 |
+
array(
|
298 |
+
"name" => "Redirect after Upload",
|
299 |
+
"attribute" => "redirect",
|
300 |
+
"type" => "onoff",
|
301 |
+
"listitems" => null,
|
302 |
+
"value" => WFU_REDIRECT,
|
303 |
+
"mode" => "free",
|
304 |
+
"category" => "general",
|
305 |
+
"subcategory" => "Redirection",
|
306 |
+
"parent" => "",
|
307 |
+
"dependencies" => array("redirectlink"),
|
308 |
+
"variables" => null,
|
309 |
+
"help" => "If enabled, the user will be redirected to a url defined in redirectlink attribute upon successful upload of all the files."
|
310 |
+
),
|
311 |
+
array(
|
312 |
+
"name" => "Redirection URL",
|
313 |
+
"attribute" => "redirectlink",
|
314 |
+
"type" => "ltext",
|
315 |
+
"listitems" => null,
|
316 |
+
"value" => WFU_REDIRECTLINK,
|
317 |
+
"mode" => "free",
|
318 |
+
"category" => "general",
|
319 |
+
"subcategory" => "Redirection",
|
320 |
+
"parent" => "redirect",
|
321 |
+
"dependencies" => null,
|
322 |
+
"variables" => array("%filename%"),
|
323 |
+
"help" => "This is the redirect URL. The URL can be dynamic by using variables. Please see Documentation on how to use variables inside attributes."
|
324 |
+
),
|
325 |
+
array(
|
326 |
+
"name" => "Show Detailed Admin Messages",
|
327 |
+
"attribute" => "adminmessages",
|
328 |
+
"type" => "onoff",
|
329 |
+
"listitems" => null,
|
330 |
+
"value" => WFU_ADMINMESSAGES,
|
331 |
+
"mode" => "free",
|
332 |
+
"category" => "general",
|
333 |
+
"subcategory" => "Other Administrator Options",
|
334 |
+
"parent" => "",
|
335 |
+
"dependencies" => null,
|
336 |
+
"variables" => null,
|
337 |
+
"help" => "If enabled then more detailed messages about upload operations will be shown to administrators for debugging or error detection."
|
338 |
+
),
|
339 |
+
array(
|
340 |
+
"name" => "Disable AJAX",
|
341 |
+
"attribute" => "forceclassic",
|
342 |
+
"type" => "onoff",
|
343 |
+
"listitems" => null,
|
344 |
+
"value" => WFU_FORCECLASSIC,
|
345 |
+
"mode" => "free",
|
346 |
+
"category" => "general",
|
347 |
+
"subcategory" => "Other Administrator Options",
|
348 |
+
"parent" => "",
|
349 |
+
"dependencies" => null,
|
350 |
+
"variables" => null,
|
351 |
+
"help" => "If AJAX is disabled, then upload of files will be performed using HTML forms, meaning that page will refresh to complete the upload. Use it in case that AJAX is causing problems with your page (although the plugin has an auto-detection feature for checking if user's browser supports AJAX or not)."
|
352 |
+
),
|
353 |
+
array(
|
354 |
+
"name" => "Test Mode",
|
355 |
+
"attribute" => "testmode",
|
356 |
+
"type" => "onoff",
|
357 |
+
"listitems" => null,
|
358 |
+
"value" => WFU_TESTMODE,
|
359 |
+
"mode" => "free",
|
360 |
+
"category" => "general",
|
361 |
+
"subcategory" => "Other Administrator Options",
|
362 |
+
"parent" => "",
|
363 |
+
"dependencies" => null,
|
364 |
+
"variables" => null,
|
365 |
+
"help" => "If enabled then the plugin will be shown in test mode, meaning that all selected features will be shown but no upload will be possible. Use it to review how the plugin looks like and style it according to your needs."
|
366 |
+
),
|
367 |
+
array(
|
368 |
+
"name" => "Plugin Component Positions",
|
369 |
+
"attribute" => "placements",
|
370 |
+
"type" => "placements",
|
371 |
+
"listitems" => null,
|
372 |
+
"value" => WFU_PLACEMENTS,
|
373 |
+
"mode" => "free",
|
374 |
+
"category" => "placements",
|
375 |
+
"subcategory" => "Plugin Component Positions",
|
376 |
+
"parent" => "",
|
377 |
+
"dependencies" => null,
|
378 |
+
"variables" => null,
|
379 |
+
"help" => "It defines the positions of the selected plugin components. Drag the components from the right pane and drop them to the left one to define your own component positions."
|
380 |
+
),
|
381 |
+
array(
|
382 |
+
"name" => "Plugin Title",
|
383 |
+
"attribute" => "uploadtitle",
|
384 |
+
"type" => "text",
|
385 |
+
"listitems" => null,
|
386 |
+
"value" => WFU_UPLOADTITLE,
|
387 |
+
"mode" => "free",
|
388 |
+
"category" => "labels",
|
389 |
+
"subcategory" => "Title",
|
390 |
+
"parent" => "",
|
391 |
+
"dependencies" => null,
|
392 |
+
"variables" => null,
|
393 |
+
"help" => "A text representing the title of the plugin."
|
394 |
+
),
|
395 |
+
array(
|
396 |
+
"name" => "Select Button Caption",
|
397 |
+
"attribute" => "selectbutton",
|
398 |
+
"type" => "text",
|
399 |
+
"listitems" => null,
|
400 |
+
"value" => WFU_SELECTBUTTON,
|
401 |
+
"mode" => "free",
|
402 |
+
"category" => "labels",
|
403 |
+
"subcategory" => "Buttons",
|
404 |
+
"parent" => "",
|
405 |
+
"dependencies" => null,
|
406 |
+
"variables" => null,
|
407 |
+
"help" => "The caption of the button that selects the files for upload."
|
408 |
+
),
|
409 |
+
array(
|
410 |
+
"name" => "Upload Button Caption",
|
411 |
+
"attribute" => "uploadbutton",
|
412 |
+
"type" => "text",
|
413 |
+
"listitems" => null,
|
414 |
+
"value" => WFU_UPLOADBUTTON,
|
415 |
+
"mode" => "free",
|
416 |
+
"category" => "labels",
|
417 |
+
"subcategory" => "Buttons",
|
418 |
+
"parent" => "",
|
419 |
+
"dependencies" => null,
|
420 |
+
"variables" => null,
|
421 |
+
"help" => "The caption of the button that starts the upload."
|
422 |
+
),
|
423 |
+
array(
|
424 |
+
"name" => "Upload Folder Label",
|
425 |
+
"attribute" => "targetfolderlabel",
|
426 |
+
"type" => "text",
|
427 |
+
"listitems" => null,
|
428 |
+
"value" => WFU_TARGETFOLDERLABEL,
|
429 |
+
"mode" => "free",
|
430 |
+
"category" => "labels",
|
431 |
+
"subcategory" => "Upload Folder",
|
432 |
+
"parent" => "",
|
433 |
+
"dependencies" => null,
|
434 |
+
"variables" => null,
|
435 |
+
"help" => "This is the label before the upload folder path, if the path is selected to be shown using the showtargetfolder attribute."
|
436 |
+
),
|
437 |
+
array(
|
438 |
+
"name" => "Success Upload Message",
|
439 |
+
"attribute" => "successmessage",
|
440 |
+
"type" => "ltext",
|
441 |
+
"listitems" => null,
|
442 |
+
"value" => WFU_SUCCESSMESSAGE,
|
443 |
+
"mode" => "free",
|
444 |
+
"category" => "labels",
|
445 |
+
"subcategory" => "Upload Messages",
|
446 |
+
"parent" => "",
|
447 |
+
"dependencies" => null,
|
448 |
+
"variables" => array("%filename%", "%filepath%"),
|
449 |
+
"help" => "This is the message that will be shown for every file that has been uploaded successfully."
|
450 |
+
),
|
451 |
+
array(
|
452 |
+
"name" => "Warning Upload Message",
|
453 |
+
"attribute" => "warningmessage",
|
454 |
+
"type" => "ltext",
|
455 |
+
"listitems" => null,
|
456 |
+
"value" => WFU_WARNINGMESSAGE,
|
457 |
+
"mode" => "free",
|
458 |
+
"category" => "labels",
|
459 |
+
"subcategory" => "Upload Messages",
|
460 |
+
"parent" => "",
|
461 |
+
"dependencies" => null,
|
462 |
+
"variables" => array("%filename%", "%filepath%"),
|
463 |
+
"help" => "This is the message that will be shown for every file that has been uploaded with warnings."
|
464 |
+
),
|
465 |
+
array(
|
466 |
+
"name" => "Error Upload Message",
|
467 |
+
"attribute" => "errormessage",
|
468 |
+
"type" => "ltext",
|
469 |
+
"listitems" => null,
|
470 |
+
"value" => WFU_ERRORMESSAGE,
|
471 |
+
"mode" => "free",
|
472 |
+
"category" => "labels",
|
473 |
+
"subcategory" => "Upload Messages",
|
474 |
+
"parent" => "",
|
475 |
+
"dependencies" => null,
|
476 |
+
"variables" => array("%filename%", "%filepath%"),
|
477 |
+
"help" => "This is the message that will be shown for every file that has failed to upload."
|
478 |
+
),
|
479 |
+
array(
|
480 |
+
"name" => "Wait Upload Message",
|
481 |
+
"attribute" => "waitmessage",
|
482 |
+
"type" => "ltext",
|
483 |
+
"listitems" => null,
|
484 |
+
"value" => WFU_WAITMESSAGE,
|
485 |
+
"mode" => "free",
|
486 |
+
"category" => "labels",
|
487 |
+
"subcategory" => "Upload Messages",
|
488 |
+
"parent" => "",
|
489 |
+
"dependencies" => null,
|
490 |
+
"variables" => array("%filename%", "%filepath%"),
|
491 |
+
"help" => "This is the message that will be shown while file is uploading."
|
492 |
+
),
|
493 |
+
array(
|
494 |
+
"name" => "Notify by Email",
|
495 |
+
"attribute" => "notify",
|
496 |
+
"type" => "onoff",
|
497 |
+
"listitems" => null,
|
498 |
+
"value" => WFU_NOTIFY,
|
499 |
+
"mode" => "free",
|
500 |
+
"category" => "notifications",
|
501 |
+
"subcategory" => "Email Notifications",
|
502 |
+
"parent" => "",
|
503 |
+
"dependencies" => array("notifyrecipients", "notifysubject", "notifymessage", "notifyheaders", "attachfile"),
|
504 |
+
"variables" => null,
|
505 |
+
"help" => "If activated then email will be sent to inform about successful file uploads."
|
506 |
+
),
|
507 |
+
array(
|
508 |
+
"name" => "Email Recipients",
|
509 |
+
"attribute" => "notifyrecipients",
|
510 |
+
"type" => "mtext",
|
511 |
+
"listitems" => null,
|
512 |
+
"value" => WFU_NOTIFYRECIPIENTS,
|
513 |
+
"mode" => "free",
|
514 |
+
"category" => "notifications",
|
515 |
+
"subcategory" => "Email Notifications",
|
516 |
+
"parent" => "notify",
|
517 |
+
"dependencies" => null,
|
518 |
+
"variables" => array("%useremail%"),
|
519 |
+
"help" => "Defines the recipients of the email notification. Can be dynamic by using variables. Please check Documentation on how to use variables in atributes."
|
520 |
+
),
|
521 |
+
array(
|
522 |
+
"name" => "Email Headers",
|
523 |
+
"attribute" => "notifyheaders",
|
524 |
+
"type" => "mtext",
|
525 |
+
"listitems" => null,
|
526 |
+
"value" => WFU_NOTIFYHEADERS,
|
527 |
+
"mode" => "free",
|
528 |
+
"category" => "notifications",
|
529 |
+
"subcategory" => "Email Notifications",
|
530 |
+
"parent" => "notify",
|
531 |
+
"dependencies" => null,
|
532 |
+
"variables" => null,
|
533 |
+
"help" => "Defines additional email headers, in case you want to sent an HTML message, or use Bcc list, or use a different From address and name or other more advanced email options."
|
534 |
+
),
|
535 |
+
array(
|
536 |
+
"name" => "Email Subject",
|
537 |
+
"attribute" => "notifysubject",
|
538 |
+
"type" => "text",
|
539 |
+
"listitems" => null,
|
540 |
+
"value" => WFU_NOTIFYSUBJECT,
|
541 |
+
"mode" => "free",
|
542 |
+
"category" => "notifications",
|
543 |
+
"subcategory" => "Email Notifications",
|
544 |
+
"parent" => "notify",
|
545 |
+
"dependencies" => null,
|
546 |
+
"variables" => array("%username%", "%useremail%", "%filename%", "%filepath%", "%userdataXXX%"),
|
547 |
+
"help" => "Defines the email subject. Can be dynamic by using variables. Please check Documentation on how to use variables in atributes."
|
548 |
+
),
|
549 |
+
array(
|
550 |
+
"name" => "Email Body",
|
551 |
+
"attribute" => "notifymessage",
|
552 |
+
"type" => "mtext",
|
553 |
+
"listitems" => null,
|
554 |
+
"value" => WFU_NOTIFYMESSAGE,
|
555 |
+
"mode" => "free",
|
556 |
+
"category" => "notifications",
|
557 |
+
"subcategory" => "Email Notifications",
|
558 |
+
"parent" => "notify",
|
559 |
+
"dependencies" => null,
|
560 |
+
"variables" => array("%username%", "%useremail%", "%filename%", "%filepath%", "%userdataXXX%", "%n%"),
|
561 |
+
"help" => "Defines the email body. Can be dynamic by using variables. Please check Documentation on how to use variables in atributes."
|
562 |
+
),
|
563 |
+
array(
|
564 |
+
"name" => "Attach Uploaded Files",
|
565 |
+
"attribute" => "attachfile",
|
566 |
+
"type" => "onoff",
|
567 |
+
"listitems" => null,
|
568 |
+
"value" => WFU_ATTACHFILE,
|
569 |
+
"mode" => "free",
|
570 |
+
"category" => "notifications",
|
571 |
+
"subcategory" => "Email Notifications",
|
572 |
+
"parent" => "notify",
|
573 |
+
"dependencies" => null,
|
574 |
+
"variables" => null,
|
575 |
+
"help" => "If activated, then uploaded files will be included in the notification email as attachments. Please use carefully."
|
576 |
+
),
|
577 |
+
array(
|
578 |
+
"name" => "Success Upload Message Color",
|
579 |
+
"attribute" => "successmessagecolor",
|
580 |
+
"type" => "color",
|
581 |
+
"listitems" => null,
|
582 |
+
"value" => WFU_SUCCESSMESSAGECOLOR,
|
583 |
+
"mode" => "free",
|
584 |
+
"category" => "colors",
|
585 |
+
"subcategory" => "Upload Message Colors",
|
586 |
+
"parent" => "",
|
587 |
+
"dependencies" => null,
|
588 |
+
"variables" => null,
|
589 |
+
"help" => "It defines the color of the success message. This attribute has been replaced by successmessagecolors, however it is kept here for backward compatibility."
|
590 |
+
),
|
591 |
+
array(
|
592 |
+
"name" => "Success Message Colors",
|
593 |
+
"attribute" => "successmessagecolors",
|
594 |
+
"type" => "color-triplet",
|
595 |
+
"listitems" => null,
|
596 |
+
"value" => WFU_SUCCESSMESSAGECOLORS,
|
597 |
+
"mode" => "free",
|
598 |
+
"category" => "colors",
|
599 |
+
"subcategory" => "Upload Message Colors",
|
600 |
+
"parent" => "",
|
601 |
+
"dependencies" => null,
|
602 |
+
"variables" => null,
|
603 |
+
"help" => "It defines the text, background and border color of the success message."
|
604 |
+
),
|
605 |
+
array(
|
606 |
+
"name" => "Warning Message Colors",
|
607 |
+
"attribute" => "warningmessagecolors",
|
608 |
+
"type" => "color-triplet",
|
609 |
+
"listitems" => null,
|
610 |
+
"value" => WFU_WARNINGMESSAGECOLORS,
|
611 |
+
"mode" => "free",
|
612 |
+
"category" => "colors",
|
613 |
+
"subcategory" => "Upload Message Colors",
|
614 |
+
"parent" => "",
|
615 |
+
"dependencies" => null,
|
616 |
+
"variables" => null,
|
617 |
+
"help" => "It defines the text, background and border color of the warning message."
|
618 |
+
),
|
619 |
+
array(
|
620 |
+
"name" => "Fail Message Colors",
|
621 |
+
"attribute" => "failmessagecolors",
|
622 |
+
"type" => "color-triplet",
|
623 |
+
"listitems" => null,
|
624 |
+
"value" => WFU_FAILMESSAGECOLORS,
|
625 |
+
"mode" => "free",
|
626 |
+
"category" => "colors",
|
627 |
+
"subcategory" => "Upload Message Colors",
|
628 |
+
"parent" => "",
|
629 |
+
"dependencies" => null,
|
630 |
+
"variables" => null,
|
631 |
+
"help" => "It defines the text, background and border color of the fail (error) message."
|
632 |
+
),
|
633 |
+
array(
|
634 |
+
"name" => "Wait Message Colors",
|
635 |
+
"attribute" => "waitmessagecolors",
|
636 |
+
"type" => "color-triplet",
|
637 |
+
"listitems" => null,
|
638 |
+
"value" => WFU_WAITMESSAGECOLORS,
|
639 |
+
"mode" => "free",
|
640 |
+
"category" => "colors",
|
641 |
+
"subcategory" => "Upload Message Colors",
|
642 |
+
"parent" => "",
|
643 |
+
"dependencies" => null,
|
644 |
+
"variables" => null,
|
645 |
+
"help" => "It defines the text, background and border color of the wait message."
|
646 |
+
),
|
647 |
+
array(
|
648 |
+
"name" => "Plugin Component Widths",
|
649 |
+
"attribute" => "widths",
|
650 |
+
"type" => "dimensions",
|
651 |
+
"listitems" => null,
|
652 |
+
"value" => WFU_WIDTHS,
|
653 |
+
"mode" => "free",
|
654 |
+
"category" => "dimensions",
|
655 |
+
"subcategory" => "Plugin Component Widths",
|
656 |
+
"parent" => "",
|
657 |
+
"dependencies" => null,
|
658 |
+
"variables" => null,
|
659 |
+
"help" => "It defines the widths of the selected plugin components."
|
660 |
+
),
|
661 |
+
array(
|
662 |
+
"name" => "Plugin Component Heights",
|
663 |
+
"attribute" => "heights",
|
664 |
+
"type" => "dimensions",
|
665 |
+
"listitems" => null,
|
666 |
+
"value" => WFU_HEIGHTS,
|
667 |
+
"mode" => "free",
|
668 |
+
"category" => "dimensions",
|
669 |
+
"subcategory" => "Plugin Component Heights",
|
670 |
+
"parent" => "",
|
671 |
+
"dependencies" => null,
|
672 |
+
"variables" => null,
|
673 |
+
"help" => "It defines the heights of the selected plugin components."
|
674 |
+
),
|
675 |
+
array(
|
676 |
+
"name" => "Include Additional Data Fields",
|
677 |
+
"attribute" => "userdata",
|
678 |
+
"type" => "onoff",
|
679 |
+
"listitems" => null,
|
680 |
+
"value" => WFU_USERDATA,
|
681 |
+
"mode" => "free",
|
682 |
+
"category" => "userdata",
|
683 |
+
"subcategory" => "Additional Data Fields",
|
684 |
+
"parent" => "",
|
685 |
+
"dependencies" => array("userdatalabel"),
|
686 |
+
"variables" => null,
|
687 |
+
"help" => "If enabled, then user can send additional information together with uploaded files (e.g. name, email etc), defined in userdatalabel attribute."
|
688 |
+
),
|
689 |
+
array(
|
690 |
+
"name" => "Additional Data Fields",
|
691 |
+
"attribute" => "userdatalabel",
|
692 |
+
"type" => "userfields",
|
693 |
+
"listitems" => null,
|
694 |
+
"value" => WFU_USERDATALABEL,
|
695 |
+
"mode" => "free",
|
696 |
+
"category" => "userdata",
|
697 |
+
"subcategory" => "Additional Data Fields",
|
698 |
+
"parent" => "userdata",
|
699 |
+
"dependencies" => null,
|
700 |
+
"variables" => null,
|
701 |
+
"help" => "It defines the labels of the additional data fields and whether they are required or not."
|
702 |
+
),
|
703 |
+
array(
|
704 |
+
"name" => "WP Filebase Plugin Connection",
|
705 |
+
"attribute" => "filebaselink",
|
706 |
+
"type" => "onoff",
|
707 |
+
"listitems" => null,
|
708 |
+
"value" => WFU_FILEBASELINK,
|
709 |
+
"mode" => "free",
|
710 |
+
"category" => "interoperability",
|
711 |
+
"subcategory" => "Connection With Other Plugins",
|
712 |
+
"parent" => "",
|
713 |
+
"dependencies" => null,
|
714 |
+
"variables" => null,
|
715 |
+
"help" => "If enabled then the WP Filebase Plugin will be informed about new file uploads."
|
716 |
+
)
|
717 |
+
);
|
718 |
+
|
719 |
+
wfu_array_remove_nulls($defs);
|
720 |
+
|
721 |
+
return $defs;
|
722 |
+
}
|
723 |
+
|
724 |
+
?>
|
lib/wfu_blocks.php
ADDED
@@ -0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â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/* Prepare information about directory or selection of target subdirectory */
|
4 |
+
function wfu_prepare_subfolders_block($params, $widths, $heights) {
|
5 |
+
$sid = $params["uploadid"];
|
6 |
+
$selectsubdir = 'selectsubdir_'.$sid;
|
7 |
+
$hiddeninput = 'hiddeninput_'.$sid;
|
8 |
+
$subfolders_item = null;
|
9 |
+
$styles1 = "";
|
10 |
+
if ( $widths["subfolders_label"] != "" ) $styles1 .= 'width: '.$widths["subfolders_label"].'; ';
|
11 |
+
if ( $heights["subfolders_label"] != "" ) $styles1 .= 'height: '.$heights["subfolders_label"].'; ';
|
12 |
+
if ( $styles1 != "" ) $styles1 = ' style="'.$styles1.'"';
|
13 |
+
$styles2 = "border: 1px solid; border-color: #BBBBBB;";
|
14 |
+
if ( $widths["subfolders_select"] != "" ) $styles2 .= 'width: '.$widths["subfolders_select"].'; ';
|
15 |
+
if ( $heights["subfolders_select"] != "" ) $styles2 .= 'height: '.$heights["subfolders_select"].'; ';
|
16 |
+
$styles2 = ' style="'.$styles2.'"';
|
17 |
+
if ( $params["testmode"] == "true" ) {
|
18 |
+
$subfolders_item["title"] = 'wordpress_file_upload_subfolders_'.$sid;
|
19 |
+
$subfolders_item["hidden"] = false;
|
20 |
+
$subfolders_item["line1"] = '<span class="file_item_clean"'.$styles1.'>'.$params["targetfolderlabel"].' </span>';
|
21 |
+
$subfolders_item["line2"] = '<select class="file_item_clean"'.$styles2.' id="'.$selectsubdir.'" onchange="javascript: document.getElementById(\''.$hiddeninput.'\').value = document.getElementById(\''.$selectsubdir.'\').selectedIndex;">';
|
22 |
+
|
23 |
+
$subfolders_item["line3"] = "\t".'<option>'.WFU_NOTIFY_TESTMODE.'</option>';
|
24 |
+
$subfolders_lastline = 4;
|
25 |
+
$subfolders_item["line".$subfolders_lastline] = '</select>';
|
26 |
+
}
|
27 |
+
elseif ( $params["askforsubfolders"] == "true" ) {
|
28 |
+
$subfolders = explode(",", $params["subfoldertree"]);
|
29 |
+
if ( count($subfolders) == 0 ) { $subfolders = array ( wfu_upload_plugin_directory($params["uploadpath"]) ); }
|
30 |
+
if ( count($subfolders) == 1 && trim($subfolders[0]) == "" ) { $subfolders = array ( wfu_upload_plugin_directory($params["uploadpath"]) ); }
|
31 |
+
$subfolders_item["title"] = 'wordpress_file_upload_subfolders_'.$sid;
|
32 |
+
$subfolders_item["hidden"] = false;
|
33 |
+
$subfolders_item["line1"] = '<span class="file_item_clean"'.$styles1.'>'.$params["targetfolderlabel"].' </span>';
|
34 |
+
$subfolders_item["line2"] = '<select class="file_item_clean"'.$styles2.' id="'.$selectsubdir.'" onchange="javascript: document.getElementById(\''.$hiddeninput.'\').value = document.getElementById(\''.$selectsubdir.'\').selectedIndex;">';
|
35 |
+
$subfolders_lastline = 3;
|
36 |
+
$dir_levels = array ( wfu_upload_plugin_directory($params["uploadpath"]) );
|
37 |
+
$subfolder_paths = array ( );
|
38 |
+
$prev_level = 0;
|
39 |
+
foreach ($subfolders as $subfolder) {
|
40 |
+
$subfolder = trim($subfolder);
|
41 |
+
$star_count = 0;
|
42 |
+
$start_spaces = "";
|
43 |
+
while ( $star_count < strlen($subfolder) ) {
|
44 |
+
if ( substr($subfolder, $star_count, 1) == "*" ) {
|
45 |
+
$star_count ++;
|
46 |
+
$start_spaces .= " ";
|
47 |
+
}
|
48 |
+
else break;
|
49 |
+
}
|
50 |
+
if ( $star_count - $prev_level <= 1 ) {
|
51 |
+
$subfolder = substr($subfolder, $star_count, strlen($subfolder) - $star_count);
|
52 |
+
$subfolder_items = explode('/', $subfolder);
|
53 |
+
if ( $subfolder_items[1] != "" ) {
|
54 |
+
$subfolder_dir = $subfolder_items[0];
|
55 |
+
$subfolder_label = $subfolder_items[1];
|
56 |
+
}
|
57 |
+
else {
|
58 |
+
$subfolder_dir = $subfolder;
|
59 |
+
$subfolder_label = $subfolder;
|
60 |
+
}
|
61 |
+
if ( count($dir_levels) > $star_count ) $dir_levels[$star_count] = $subfolder_dir;
|
62 |
+
else array_push($dir_levels, $subfolder_dir);
|
63 |
+
$subfolder_path = "";
|
64 |
+
for ( $i_count = 1; $i_count <= $star_count; $i_count++) {
|
65 |
+
$subfolder_path .= $dir_levels[$i_count].'/';
|
66 |
+
}
|
67 |
+
array_push($subfolder_paths, $subfolder_path);
|
68 |
+
$subfolders_item["line".$subfolders_lastline] = "\t".'<option>'.$start_spaces.$subfolder_label.'</option>';
|
69 |
+
$subfolders_lastline ++;
|
70 |
+
$prev_level = $star_count;
|
71 |
+
}
|
72 |
+
}
|
73 |
+
$subfolders_item["line".$subfolders_lastline] = '</select>';
|
74 |
+
}
|
75 |
+
else if ( $params["showtargetfolder"] == "true" ) {
|
76 |
+
$upload_directory = wfu_upload_plugin_directory($params["uploadpath"]);
|
77 |
+
$subfolders_item["title"] = 'wordpress_file_upload_subfolders_'.$sid;
|
78 |
+
$subfolders_item["hidden"] = false;
|
79 |
+
$subfolders_item["line1"] = '<span'.$styles1.'>'.$params["targetfolderlabel"].': <strong>'.$upload_directory.'</strong></span>';
|
80 |
+
}
|
81 |
+
|
82 |
+
$subfolders['item'] = $subfolders_item;
|
83 |
+
$subfolders['paths'] = $subfolder_paths;
|
84 |
+
|
85 |
+
return $subfolders;
|
86 |
+
}
|
87 |
+
|
88 |
+
/* Prepare the title */
|
89 |
+
function wfu_prepare_title_block($params, $widths, $heights) {
|
90 |
+
$sid = $params["uploadid"];
|
91 |
+
$title_item = null;
|
92 |
+
if ( $params["uploadtitle"] ) {
|
93 |
+
$title_item["title"] = 'wordpress_file_upload_title_'.$sid;
|
94 |
+
$title_item["hidden"] = false;
|
95 |
+
$styles = "";
|
96 |
+
if ( $widths["title"] != "" ) $styles .= 'width: '.$widths["title"].'; ';
|
97 |
+
if ( $heights["title"] != "" ) $styles .= 'height: '.$heights["title"].'; ';
|
98 |
+
if ( $styles != "" ) $styles = ' style="'.$styles.'"';
|
99 |
+
$title_item["line1"] = '<span class="file_title_clean"'.$styles.'>'.$params["uploadtitle"].'</span>';
|
100 |
+
}
|
101 |
+
|
102 |
+
return $title_item;
|
103 |
+
}
|
104 |
+
|
105 |
+
/* Prepare the text box showing filename */
|
106 |
+
function wfu_prepare_textbox_block($params, $widths, $heights) {
|
107 |
+
$sid = $params["uploadid"];
|
108 |
+
$textfile = 'fileName_'.$sid;
|
109 |
+
$textbox_item["title"] = 'wordpress_file_upload_textbox_'.$sid;
|
110 |
+
$textbox_item["hidden"] = false;
|
111 |
+
$styles = "";
|
112 |
+
if ( $widths["filename"] != "" ) $styles .= 'width: '.$widths["filename"].'; ';
|
113 |
+
if ( $heights["filename"] != "" ) $styles .= 'height: '.$heights["filename"].'; ';
|
114 |
+
if ( $styles != "" ) $styles = ' style="'.$styles.'"';
|
115 |
+
$textbox_item["line1"] = '<input type="text" id="'.$textfile.'" class="file_input_textbox"'.$styles.' readonly="readonly"/>';
|
116 |
+
|
117 |
+
return $textbox_item;
|
118 |
+
}
|
119 |
+
|
120 |
+
/* Prepare the upload form (required) */
|
121 |
+
function wfu_prepare_uploadform_block($params, $widths, $heights, $clickaction, $additional_params) {
|
122 |
+
$sid = $params["uploadid"];
|
123 |
+
$uploadform = 'uploadform_'.$sid;
|
124 |
+
$uploadedfile = 'uploadedfile_'.$sid;
|
125 |
+
$upfile = 'upfile_'.$sid;
|
126 |
+
$input = 'input_'.$sid;
|
127 |
+
$label = $params["selectbutton"];
|
128 |
+
$usefilearray = 0;
|
129 |
+
|
130 |
+
$uploadform_item["title"] = 'wordpress_file_upload_form_'.$sid;
|
131 |
+
// selectbutton block is mandatory because it contains the upload form element, so in case it is not included in the placements
|
132 |
+
// attribute then we set its visibility to hidden
|
133 |
+
$uploadform_item["hidden"] = ( strpos($params["placements"], "selectbutton") === false );
|
134 |
+
$styles_form = "";
|
135 |
+
$styles = "";
|
136 |
+
if ( $widths["selectbutton"] != "" ) $styles .= 'width: '.$widths["selectbutton"].'; ';
|
137 |
+
if ( $heights["selectbutton"] != "" ) $styles .= 'height: '.$heights["selectbutton"].'; ';
|
138 |
+
if ( $styles != "" ) $styles_form = ' style="'.$styles.'"';
|
139 |
+
$i = 1;
|
140 |
+
$uploadform_item["line".$i++] = '<form class="file_input_uploadform" id="'.$uploadform.'" name="'.$uploadform.'" method="post" enctype="multipart/form-data"'.$styles_form.'>';
|
141 |
+
if ( $params["testmode"] == "true" ) $styles .= 'z-index: 500;';
|
142 |
+
if ( $styles != "" ) $styles = ' style="'.$styles.'"';
|
143 |
+
if ( $params["testmode"] == "true" ) $uploadform_item["line".$i++] = "\t".'<input align="center" type="button" id="'.$input.'" value="'.$label.'" class="file_input_button"'.$styles.' onmouseout="javascript: document.getElementById(\''.$input.'\').className = \'file_input_button\'" onmouseover="javascript: document.getElementById(\''.$input.'\').className = \'file_input_button_hover\'" onclick="alert(\''.WFU_NOTIFY_TESTMODE.'\');" />';
|
144 |
+
else $uploadform_item["line".$i++] = "\t".'<input align="center" type="button" id="'.$input.'" value="'.$label.'" class="file_input_button"'.$styles.'/>';
|
145 |
+
if ( $params["singlebutton"] == "true" )
|
146 |
+
$uploadform_item["line".$i++] = "\t".'<input type="file" class="file_input_hidden" name="'.$uploadedfile.'" id="'.$upfile.'" tabindex="1" onchange="wfu_selectbutton_changed('.$sid.', '.$usefilearray.'); if (this.value != \'\') {'.$clickaction.'}" onmouseout="javascript: document.getElementById(\''.$input.'\').className = \'file_input_button\'" onmouseover="javascript: document.getElementById(\''.$input.'\').className = \'file_input_button_hover\'" onclick="wfu_selectbutton_clicked('.$sid.');"'.' />';
|
147 |
+
else
|
148 |
+
$uploadform_item["line".$i++] = "\t".'<input type="file" class="file_input_hidden" name="'.$uploadedfile.'" id="'.$upfile.'" tabindex="1" onchange="wfu_selectbutton_changed('.$sid.', '.$usefilearray.');" onmouseout="javascript: document.getElementById(\''.$input.'\').className = \'file_input_button\'" onmouseover="javascript: document.getElementById(\''.$input.'\').className = \'file_input_button_hover\'" onclick="wfu_selectbutton_clicked('.$sid.');"'.' />';
|
149 |
+
$uploadform_item["line".$i++] = "\t".'<input type="hidden" id="hiddeninput_'.$sid.'" name="hiddeninput_'.$sid.'" value="" />';
|
150 |
+
$uploadform_item["line".$i++] = "\t".'<input type="hidden" id="adminerrorcodes_'.$sid.'" name="adminerrorcodes_'.$sid.'" value="" />';
|
151 |
+
foreach ($params["userdata_fields"] as $userdata_key => $userdata_field)
|
152 |
+
$uploadform_item["line".$i++] = "\t".'<input type="hidden" id="hiddeninput_'.$sid.'_userdata_'.$userdata_key.'" name="hiddeninput_'.$sid.'_userdata_'.$userdata_key.'" value="" />';
|
153 |
+
$uploadform_item["line".$i++] = '</form>';
|
154 |
+
|
155 |
+
return $uploadform_item;
|
156 |
+
}
|
157 |
+
|
158 |
+
/* Prepare the submit button */
|
159 |
+
function wfu_prepare_submit_block($params, $widths, $heights, $clickaction) {
|
160 |
+
$sid = $params["uploadid"];
|
161 |
+
$upload = 'upload_'.$sid;
|
162 |
+
$default = $params["uploadbutton"];
|
163 |
+
|
164 |
+
$submit_item["title"] = 'wordpress_file_upload_submit_'.$sid;
|
165 |
+
$submit_item["hidden"] = false;
|
166 |
+
$styles = "";
|
167 |
+
if ( $widths["uploadbutton"] != "" ) $styles .= 'width: '.$widths["uploadbutton"].'; ';
|
168 |
+
if ( $heights["uploadbutton"] != "" ) $styles .= 'height: '.$heights["uploadbutton"].'; ';
|
169 |
+
if ( $styles != "" ) $styles = ' style="'.$styles.'"';
|
170 |
+
if ( $params["testmode"] == "true" ) $submit_item["line1"] = '<input align="center" type="button" id="'.$upload.'" name="'.$upload.'" value="'.$default.'" class="file_input_submit" onclick="alert(\''.WFU_NOTIFY_TESTMODE.'\');"'.$styles.' />';
|
171 |
+
else $submit_item["line1"] = '<input align="center" type="button" id="'.$upload.'" name="'.$upload.'" value="'.$default.'" class="file_input_submit" onclick="'.$clickaction.'"'.$styles.' />';
|
172 |
+
$submit_item["line2"] = '<input type="hidden" id="'.$upload.'_default" value="'.$default.'" />';
|
173 |
+
|
174 |
+
return $submit_item;
|
175 |
+
}
|
176 |
+
|
177 |
+
|
178 |
+
/* Prepare the progress bar */
|
179 |
+
function wfu_prepare_progressbar_block($params, $widths, $heights) {
|
180 |
+
$sid = $params["uploadid"];
|
181 |
+
$progress_bar = 'progressbar_'.$sid;
|
182 |
+
|
183 |
+
$progressbar_item["title"] = 'wordpress_file_upload_progressbar_'.$sid;
|
184 |
+
$progressbar_item["hidden"] = ( $params["testmode"] != "true" );
|
185 |
+
$styles = "";
|
186 |
+
if ( $widths["progressbar"] != "" ) $styles .= 'width: '.$widths["progressbar"].'; ';
|
187 |
+
if ( $heights["progressbar"] != "" ) $styles .= 'height: '.$heights["progressbar"].'; ';
|
188 |
+
if ( $styles != "" ) $styles = ' style="'.$styles.'"';
|
189 |
+
$progressbar_item["line1"] = '<div id="'.$progress_bar.'" class="file_progress_bar"'.$styles.'>';
|
190 |
+
$progressbar_item["line2"] = "\t".'<div id="'.$progress_bar.'_inner" class="file_progress_inner">';
|
191 |
+
$progressbar_item["line4"] = "\t\t".'<span id="'.$progress_bar.'_animation" class="file_progress_noanimation"> </span>';
|
192 |
+
$progressbar_item["line5"] = "\t\t".'<img id="'.$progress_bar.'_imagesafe" class="file_progress_imagesafe" src="'.WFU_IMAGE_SIMPLE_PROGBAR.'" style="display:none;" />';
|
193 |
+
$progressbar_item["line6"] = "\t".'</div>';
|
194 |
+
$progressbar_item["line7"] = '</div>';
|
195 |
+
|
196 |
+
return $progressbar_item;
|
197 |
+
}
|
198 |
+
|
199 |
+
/* Prepare the message block */
|
200 |
+
function wfu_prepare_message_block($params, $widths, $heights) {
|
201 |
+
$sid = $params["uploadid"];
|
202 |
+
$styles = "";
|
203 |
+
if ( $widths["message"] != "" ) $styles .= 'width: '.$widths["message"].'; ';
|
204 |
+
if ( $heights["message"] != "" ) $styles .= 'height: '.$heights["message"].'; ';
|
205 |
+
if ( $styles != "" ) $styles = ' style="'.$styles.'"';
|
206 |
+
$message_block = wfu_prepare_message_block_skeleton($sid, $styles, ( $params["testmode"] == "true" ));
|
207 |
+
$message_item = $message_block["msgblock"];
|
208 |
+
$message_item["title"] = 'wordpress_file_upload_message_'.$sid;
|
209 |
+
$message_item["hidden"] = ( $params["testmode"] != "true" );
|
210 |
+
|
211 |
+
return $message_item;
|
212 |
+
}
|
213 |
+
|
214 |
+
/* Prepare the user data block */
|
215 |
+
function wfu_prepare_userdata_block($params, $widths, $heights) {
|
216 |
+
$sid = $params["uploadid"];
|
217 |
+
$userdata = 'userdata_'.$sid;
|
218 |
+
$hiddeninput = 'hiddeninput_'.$sid;
|
219 |
+
|
220 |
+
$userdata_item["title"] = 'wordpress_file_upload_userdata_'.$sid;
|
221 |
+
$userdata_item["hidden"] = false;
|
222 |
+
$styles = "";
|
223 |
+
if ( $widths["userdata"] != "" ) $styles .= 'width: '.$widths["userdata"].'; ';
|
224 |
+
if ( $heights["userdata"] != "" ) $styles .= 'height: '.$heights["userdata"].'; ';
|
225 |
+
if ( $styles != "" ) $styles = ' style="'.$styles.'"';
|
226 |
+
$i = 1;
|
227 |
+
foreach ($params["userdata_fields"] as $userdata_key => $userdata_field) {
|
228 |
+
$userdata_item["line".$i++] = '<div id="'.$userdata.'_'.$userdata_key.'" class="file_userdata_container"'.$styles.'>';
|
229 |
+
$userdata_item["line".$i++] = "\t".'<label id="'.$userdata.'_label_'.$userdata_key.'" for="'.$userdata.'_message_'.$userdata_key.'" class="file_userdata_label">'.$userdata_field["label"].'</label>';
|
230 |
+
$userdata_item_class = ( $userdata_field["required"] == "true" ? "file_userdata_message_required" : "file_userdata_message" );
|
231 |
+
if ( $params["testmode"] == "true" )
|
232 |
+
$userdata_item["line".$i++] = "\t".'<input type="text" id="'.$userdata.'_message_'.$userdata_key.'" class="'.$userdata_item_class.'" value="Test message" readonly="readonly" />';
|
233 |
+
else
|
234 |
+
$userdata_item["line".$i++] = "\t".'<input type="text" id="'.$userdata.'_message_'.$userdata_key.'" class="'.$userdata_item_class.'" value="" onchange="javascript: document.getElementById(\''.$hiddeninput.'_userdata_'.$userdata_key.'\').value = this.value;" onfocus="javascript: if (this.className == \'file_userdata_message_required_empty\') {this.value = \'\'; this.className = \'file_userdata_message_required\';}" />';
|
235 |
+
$userdata_item["line".$i++] = '</div>';
|
236 |
+
}
|
237 |
+
|
238 |
+
return $userdata_item;
|
239 |
+
}
|
240 |
+
|
241 |
+
?>
|
lib/wfu_constants.php
ADDED
@@ -0,0 +1,181 @@
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
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|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
1 |
+
<?php
|
2 |
+
|
3 |
+
//define plugin defaults
|
4 |
+
DEFINE("WFU_UPLOADID", "1");
|
5 |
+
DEFINE("WFU_UPLOADTITLE", __('Upload files', 'wordpress-file-upload'));
|
6 |
+
DEFINE("WFU_SELECTBUTTON", __('Select File', 'wordpress-file-upload'));
|
7 |
+
DEFINE("WFU_UPLOADBUTTON", __('Upload File', 'wordpress-file-upload'));
|
8 |
+
DEFINE("WFU_SINGLEBUTTON", "false");
|
9 |
+
DEFINE("WFU_UPLOADROLE", "administrator");
|
10 |
+
DEFINE("WFU_UPLOADPATH", 'uploads');
|
11 |
+
DEFINE("WFU_CREATEPATH", "false");
|
12 |
+
DEFINE("WFU_UPLOADPATTERNS", "*.*");
|
13 |
+
DEFINE("WFU_MAXSIZE", "50");
|
14 |
+
DEFINE("WFU_ACCESSMETHOD", "normal");
|
15 |
+
DEFINE("WFU_FTPINFO", "");
|
16 |
+
DEFINE("WFU_USEFTPDOMAIN", "false");
|
17 |
+
DEFINE("WFU_DUBLICATESPOLICY", "overwrite");
|
18 |
+
DEFINE("WFU_UNIQUEPATTERN", "index");
|
19 |
+
DEFINE("WFU_FILEBASELINK", "false");
|
20 |
+
DEFINE("WFU_NOTIFY", "false");
|
21 |
+
DEFINE("WFU_NOTIFYRECIPIENTS", "");
|
22 |
+
DEFINE("WFU_NOTIFYSUBJECT", __('File Upload Notification', 'wordpress-file-upload'));
|
23 |
+
DEFINE("WFU_NOTIFYMESSAGE", __("Dear Recipient,\n\n This is an automatic delivery message to notify you that a new file has been uploaded.\n\nBest Regards", 'wordpress-file-upload'));
|
24 |
+
DEFINE("WFU_NOTIFYHEADERS", "");
|
25 |
+
DEFINE("WFU_ATTACHFILE", "false");
|
26 |
+
DEFINE("WFU_REDIRECT", "false");
|
27 |
+
DEFINE("WFU_REDIRECTLINK", "");
|
28 |
+
DEFINE("WFU_ADMINMESSAGES", "false");
|
29 |
+
DEFINE("WFU_SUCCESSMESSAGE", __('File %filename% uploaded successfully', 'wordpress-file-upload'));
|
30 |
+
DEFINE("WFU_WARNINGMESSAGE", __('File %filename% uploaded successfully but with warnings', 'wordpress-file-upload'));
|
31 |
+
DEFINE("WFU_ERRORMESSAGE", __('File %filename% not uploaded', 'wordpress-file-upload'));
|
32 |
+
DEFINE("WFU_WAITMESSAGE", __('File %filename% is being uploaded', 'wordpress-file-upload'));
|
33 |
+
DEFINE("WFU_SUCCESSMESSAGECOLOR", "green");
|
34 |
+
DEFINE("WFU_SUCCESSMESSAGECOLORS", "#006600,#EEFFEE,#006666");
|
35 |
+
DEFINE("WFU_WARNINGMESSAGECOLORS", "#F88017,#FEF2E7,#633309");
|
36 |
+
DEFINE("WFU_FAILMESSAGECOLORS", "#660000,#FFEEEE,#666600");
|
37 |
+
DEFINE("WFU_WAITMESSAGECOLORS", "#666666,#EEEEEE,#333333");
|
38 |
+
DEFINE("WFU_SHOWTARGETFOLDER", "false");
|
39 |
+
DEFINE("WFU_TARGETFOLDERLABEL", "Upload Directory");
|
40 |
+
DEFINE("WFU_ASKFORSUBFOLDERS", "false");
|
41 |
+
DEFINE("WFU_SUBFOLDERTREE", "");
|
42 |
+
DEFINE("WFU_FORCECLASSIC", "false");
|
43 |
+
DEFINE("WFU_TESTMODE", "false");
|
44 |
+
DEFINE("WFU_WIDTHS", "");
|
45 |
+
DEFINE("WFU_HEIGHTS", "");
|
46 |
+
DEFINE("WFU_PLACEMENTS", "title/filename+selectbutton+uploadbutton/subfolders"."/userdata"."/message");
|
47 |
+
DEFINE("WFU_USERDATA", "false");
|
48 |
+
DEFINE("WFU_USERDATALABEL", __('Your message', 'wordpress-file-upload'));
|
49 |
+
|
50 |
+
//define plugin errors
|
51 |
+
DEFINE("WFU_ERROR_ADMIN_FTPDIR_RESOLVE", __("Error. Could not resolve ftp target filedir. Check the domain in 'ftpinfo' attribute.", "wordpress-file-upload"));
|
52 |
+
DEFINE("WFU_ERROR_ADMIN_FTPINFO_INVALID", __("Error. Invalid ftp information. Check 'ftpinfo' attribute.", "wordpress-file-upload"));
|
53 |
+
DEFINE("WFU_ERROR_ADMIN_FTPINFO_EXTRACT", __("Error. Could not extract ftp information from 'ftpinfo' attribute. Check its syntax.", "wordpress-file-upload"));
|
54 |
+
DEFINE("WFU_ERROR_ADMIN_FTPFILE_RESOLVE", __("Error. Could not resolve ftp target filename. Check the domain in 'ftpinfo' attribute.", "wordpress-file-upload"));
|
55 |
+
DEFINE("WFU_ERROR_ADMIN_FILE_PHP_SIZE", __("Error. The upload size limit of PHP directive upload_max_filesize is preventing the upload of big files.\nPHP directive upload_max_filesize limit is: ".ini_get("upload_max_filesize").".\nTo increase the limit change the value of the directive from php.ini.\nIf you don't have access to php.ini, then try adding the following line to your .htaccess file:\n\nphp_value upload_max_filesize 10M\n\n(adjust the size according to your needs)\n\nThe file .htaccess is found in your website root directory (where index.php is found).\nIf your don't have this file, then create it.\nIf this does not work either, then contact your domain provider.", "wordpress-file-upload"));
|
56 |
+
DEFINE("WFU_ERROR_ADMIN_FILE_PHP_TIME", __("The upload time limit of PHP directive max_input_time is preventing the upload of big files.\nPHP directive max_input_time limit is: ".ini_get("max_input_time")." seconds.\nTo increase the limit change the value of the directive from php.ini.\nIf you don't have access to php.ini, then add the following line to your .htaccess file:\n\nphp_value max_input_time 500\n\n(adjust the time according to your needs)\n\nThe file .htaccess is found in your website root directory (where index.php is found).\nIf your don't have this file, then create it.\nIf this does not work either, then contact your domain provider.", "wordpress-file-upload"));
|
57 |
+
DEFINE("WFU_ERROR_ADMIN_DIR_PERMISSION", __("Error. Permission denied to write to target folder.\nCheck and correct read/write permissions of target folder.", "wordpress-file-upload"));
|
58 |
+
DEFINE("WFU_ERROR_DIR_EXIST", __("Targer folder doesn't exist.", "wordpress-file-upload"));
|
59 |
+
DEFINE("WFU_ERROR_DIR_NOTEMP", __("Upload failed! Missing a temporary folder.", "wordpress-file-upload"));
|
60 |
+
DEFINE("WFU_ERROR_DIR_PERMISSION", __("Upload failed! Permission denied to write to target folder.", "wordpress-file-upload"));
|
61 |
+
DEFINE("WFU_ERROR_FILE_ALLOW", __("File not allowed.", "wordpress-file-upload"));
|
62 |
+
DEFINE("WFU_ERROR_FILE_PLUGIN_SIZE", __("The uploaded file exceeds the file size limit.", "wordpress-file-upload"));
|
63 |
+
DEFINE("WFU_ERROR_FILE_PHP_SIZE", __("Upload failed! The uploaded file exceeds the file size limit of the server. Please contact the administrator.", "wordpress-file-upload"));
|
64 |
+
DEFINE("WFU_ERROR_FILE_PHP_TIME", __("Upload failed! The duration of the upload exceeded the time limit of the server. Please contact the administrator.", "wordpress-file-upload"));
|
65 |
+
DEFINE("WFU_ERROR_FILE_HTML_SIZE", __("Upload failed! The uploaded file exceeds the MAX_FILE_SIZE directive that was specified in the HTML form.", "wordpress-file-upload"));
|
66 |
+
DEFINE("WFU_ERROR_FILE_PARTIAL", __("Upload failed! The uploaded file was only partially uploaded.", "wordpress-file-upload"));
|
67 |
+
DEFINE("WFU_ERROR_FILE_NOTHING", __("Upload failed! No file was uploaded.", "wordpress-file-upload"));
|
68 |
+
DEFINE("WFU_ERROR_FILE_WRITE", __("Upload failed! Failed to write file to disk.", "wordpress-file-upload"));
|
69 |
+
DEFINE("WFU_ERROR_FILE_MOVE", __("Upload failed! Error occured while moving temporary file. Please contact administrator.", "wordpress-file-upload"));
|
70 |
+
DEFINE("WFU_ERROR_UPLOAD_STOPPED", __("Upload failed! A PHP extension stopped the file upload. PHP does not provide a way to ascertain which extension caused the file upload to stop; examining the list of loaded extensions with phpinfo() may help.", "wordpress-file-upload"));
|
71 |
+
DEFINE("WFU_ERROR_UPLOAD_FAILED_WHILE", __("Upload failed! Error occured while attemting to upload the file.", "wordpress-file-upload"));
|
72 |
+
DEFINE("WFU_ERROR_UPLOAD_FAILED", __("Upload failed!", "wordpress-file-upload"));
|
73 |
+
DEFINE("WFU_ERROR_UPLOAD_NOFILESELECTED", __("No file!", "wordpress-file-upload"));
|
74 |
+
DEFINE("WFU_ERROR_UPLOAD_CANCELLED", __("Upload failed! The upload has been canceled by the user or the browser dropped the connection.", "wordpress-file-upload"));
|
75 |
+
DEFINE("WFU_ERROR_UNKNOWN", __("Upload failed! Unknown error.", "wordpress-file-upload"));
|
76 |
+
DEFINE("WFU_ERROR_CONTACT_ADMIN", __("Please contact the administrator.", "wordpress-file-upload"));
|
77 |
+
DEFINE("WFU_ERROR_REMOTESERVER_NORESULT", __("No result from remote server!", "wordpress-file-upload"));
|
78 |
+
DEFINE("WFU_ERROR_JSONPARSE_FILEMESSAGE", __(" but with warnings", "wordpress-file-upload"));
|
79 |
+
DEFINE("WFU_ERROR_JSONPARSE_MESSAGE", __("Warning: JSON parse error.", "wordpress-file-upload"));
|
80 |
+
DEFINE("WFU_ERROR_JSONPARSE_ADMINMESSAGE", __("Upload parameters of this file, passed as JSON string to the handler, could not be parsed.", "wordpress-file-upload"));
|
81 |
+
DEFINE("WFU_ERROR_JSONPARSE_HEADERMESSAGE", __("Warning: JSON parse error.", "wordpress-file-upload"));
|
82 |
+
DEFINE("WFU_ERROR_JSONPARSE_HEADERADMINMESSAGE", __("UploadStates, passed as JSON string to the handler, could not be parsed.", "wordpress-file-upload"));
|
83 |
+
DEFINE("WFU_ERROR_REDIRECTION_ERRORCODE0", __("Redirection to classic form functionality occurred due to unknown error.", "wordpress-file-upload"));
|
84 |
+
DEFINE("WFU_ERROR_REDIRECTION_ERRORCODE1", __("Redirection to classic form functionality occurred because AJAX is not supported.", "wordpress-file-upload"));
|
85 |
+
DEFINE("WFU_ERROR_REDIRECTION_ERRORCODE2", __("Redirection to classic form functionality occurred because HTML5 is not supported.", "wordpress-file-upload"));
|
86 |
+
DEFINE("WFU_ERROR_REDIRECTION_ERRORCODE3", __("Redirection to classic form functionality occurred due to JSON parse error.", "wordpress-file-upload"));
|
87 |
+
DEFINE("WFU_ERROR_USERDATA_EMPTY", __("cannot be empty!", "wordpress-file-upload"));
|
88 |
+
|
89 |
+
//define plugin warnings
|
90 |
+
DEFINE("WFU_WARNING_FILE_EXISTS", __("Upload skipped! File already exists.", "wordpress-file-upload"));
|
91 |
+
DEFINE("WFU_WARNING_NOFILES_SELECTED", __("No files have been selected!", "wordpress-file-upload"));
|
92 |
+
DEFINE("WFU_WARNING_WPFILEBASE_NOTUPDATED_NOFILES", __("WPFilebase Plugin not updated because there were no files uploaded.", "wordpress-file-upload"));
|
93 |
+
DEFINE("WFU_WARNING_NOTIFY_NOTSENT_NOFILES", __("Notification email was not sent because there were no files uploaded.", "wordpress-file-upload"));
|
94 |
+
DEFINE("WFU_WARNING_NOTIFY_NOTSENT_NORECIPIENTS", __("Notification email was not sent because no recipients were defined. Please check notifyrecipients attribute in the shortcode.", "wordpress-file-upload"));
|
95 |
+
DEFINE("WFU_WARNING_NOTIFY_NOTSENT_UNKNOWNERROR", __("Notification email was not sent due to an error. Please check notifyrecipients, notifysubject and notifymessage attributes for errors.", "wordpress-file-upload"));
|
96 |
+
DEFINE("WFU_WARNING_REDIRECT_NOTEXECUTED_EMPTY", __("Redirection not executed because redirection link is empty. Please check redirectlink attribute.", "wordpress-file-upload"));
|
97 |
+
DEFINE("WFU_WARNING_REDIRECT_NOTEXECUTED_FILESFAILED", __("Redirection not executed because not all files were successfully uploaded.", "wordpress-file-upload"));
|
98 |
+
|
99 |
+
//define plugin messages
|
100 |
+
DEFINE("WFU_NOTIFY_TESTMODE", __("Test Mode", "wordpress-file-upload"));
|
101 |
+
DEFINE("WFU_SUCCESSMESSAGE_DETAILS", __('Upload path: %filepath%', 'wordpress-file-upload'));
|
102 |
+
DEFINE("WFU_FAILMESSAGE_DETAILS", __('Failed upload path: %filepath%', 'wordpress-file-upload'));
|
103 |
+
|
104 |
+
//define plugin test messages
|
105 |
+
DEFINE("WFU_TESTMESSAGE_MESSAGE", __('This is a test message', 'wordpress-file-upload'));
|
106 |
+
DEFINE("WFU_TESTMESSAGE_ADMINMESSAGE", __('This is a test administrator message', 'wordpress-file-upload'));
|
107 |
+
DEFINE("WFU_TESTMESSAGE_FILE1_HEADER", __('File testfile 1 under test', 'wordpress-file-upload'));
|
108 |
+
DEFINE("WFU_TESTMESSAGE_FILE1_MESSAGE", __('File testfile 1 message', 'wordpress-file-upload'));
|
109 |
+
DEFINE("WFU_TESTMESSAGE_FILE1_ADMINMESSAGE", __('File testfile 1 administrator message', 'wordpress-file-upload'));
|
110 |
+
DEFINE("WFU_TESTMESSAGE_FILE2_HEADER", __('File testfile 2 under test', 'wordpress-file-upload'));
|
111 |
+
DEFINE("WFU_TESTMESSAGE_FILE2_MESSAGE", __('File testfile 2 message', 'wordpress-file-upload'));
|
112 |
+
DEFINE("WFU_TESTMESSAGE_FILE2_ADMINMESSAGE", __('File testfile 2 administrator message', 'wordpress-file-upload'));
|
113 |
+
|
114 |
+
//define tool tip constants
|
115 |
+
DEFINE("WFU_VARIABLE_TITLE_USERNAME", __("Insert variable %username% inside text. It will be replaced by the username of the current user.", "wordpress-file-upload"));
|
116 |
+
DEFINE("WFU_VARIABLE_TITLE_USEREMAIL", __("Insert variable %useremail% inside text. It will be replaced by the email of the current user.", "wordpress-file-upload"));
|
117 |
+
DEFINE("WFU_VARIABLE_TITLE_FILENAME", __("Insert variable %filename% inside text. It will be replaced by the filename of the uploaded file.", "wordpress-file-upload"));
|
118 |
+
DEFINE("WFU_VARIABLE_TITLE_FILEPATH", __("Insert variable %filepath% inside text. It will be replaced by the full filepath of the uploaded file.", "wordpress-file-upload"));
|
119 |
+
DEFINE("WFU_VARIABLE_TITLE_BLOGID", __("Insert variable %blogid% inside text. It will be replaced by the blog id of the website.", "wordpress-file-upload"));
|
120 |
+
DEFINE("WFU_VARIABLE_TITLE_USERDATAXXX", __("Insert variable %userdataXXX% inside text. Replace XXX with the number of the user field (1, 2, etc...). It will be replaced by the value that the user entered in this field.", "wordpress-file-upload"));
|
121 |
+
DEFINE("WFU_VARIABLE_TITLE_N", __("Insert variable %n% inside text to denote a line change.", "wordpress-file-upload"));
|
122 |
+
|
123 |
+
//define plugin other constants
|
124 |
+
DEFINE("WFU_UPLOAD_STATE0", __("Upload in progress", "wordpress-file-upload"));
|
125 |
+
DEFINE("WFU_UPLOAD_STATE1", __("Upload in progress with warnings!", "wordpress-file-upload"));
|
126 |
+
DEFINE("WFU_UPLOAD_STATE2", __("Upload in progress but some files already failed!", "wordpress-file-upload"));
|
127 |
+
DEFINE("WFU_UPLOAD_STATE3", __("Upload in progress but no files uploaded so far!", "wordpress-file-upload"));
|
128 |
+
DEFINE("WFU_UPLOAD_STATE4", __("All files uploaded successfully", "wordpress-file-upload"));
|
129 |
+
DEFINE("WFU_UPLOAD_STATE5", __("All files uploaded successfully but there are warnings!", "wordpress-file-upload"));
|
130 |
+
DEFINE("WFU_UPLOAD_STATE5_SINGLEFILE", __("File uploaded successfully but there are warnings!", "wordpress-file-upload"));
|
131 |
+
DEFINE("WFU_UPLOAD_STATE6", __("Some files failed to upload!", "wordpress-file-upload"));
|
132 |
+
DEFINE("WFU_UPLOAD_STATE7", __("All files failed to upload", "wordpress-file-upload"));
|
133 |
+
DEFINE("WFU_UPLOAD_STATE7_SINGLEFILE", __("File failed to upload", "wordpress-file-upload"));
|
134 |
+
DEFINE("WFU_UPLOAD_STATE8", __("There are no files to upload!", "wordpress-file-upload"));
|
135 |
+
DEFINE("WFU_UPLOAD_STATE9", __("Test upload message", "wordpress-file-upload"));
|
136 |
+
DEFINE("WFU_UPLOAD_STATE10", __("JSON parse warning!", "wordpress-file-upload"));
|
137 |
+
DEFINE("WFU_UPLOAD_STATE11", __("please wait while redirecting...", "wordpress-file-upload"));
|
138 |
+
DEFINE("WFU_RESPONSE_URL", WPFILEUPLOAD_DIR."wfu_response.php");
|
139 |
+
|
140 |
+
//define colors
|
141 |
+
DEFINE("WFU_TESTMESSAGECOLORS", "#666666,#EEEEEE,#333333");
|
142 |
+
DEFINE("WFU_DEFAULTMESSAGECOLORS", "#666666,#EEEEEE,#333333");
|
143 |
+
DEFINE("WFU_HEADERMESSAGECOLORS_STATE0", "#666666,#EEEEEE,#333333");
|
144 |
+
DEFINE("WFU_HEADERMESSAGECOLORS_STATE1", "#F88017,#FEF2E7,#633309");
|
145 |
+
DEFINE("WFU_HEADERMESSAGECOLORS_STATE2", "#660000,#FFEEEE,#666600");
|
146 |
+
DEFINE("WFU_HEADERMESSAGECOLORS_STATE3", "#660000,#FFEEEE,#666600");
|
147 |
+
DEFINE("WFU_HEADERMESSAGECOLORS_STATE4", "#006600,#EEFFEE,#006666");
|
148 |
+
DEFINE("WFU_HEADERMESSAGECOLORS_STATE5", "#F88017,#FEF2E7,#633309");
|
149 |
+
DEFINE("WFU_HEADERMESSAGECOLORS_STATE6", "#660000,#FFEEEE,#666600");
|
150 |
+
DEFINE("WFU_HEADERMESSAGECOLORS_STATE7", "#660000,#FFEEEE,#666600");
|
151 |
+
DEFINE("WFU_HEADERMESSAGECOLORS_STATE8", "#660000,#FFEEEE,#666600");
|
152 |
+
DEFINE("WFU_HEADERMESSAGECOLORS_STATE9", "#666666,#EEEEEE,#333333");
|
153 |
+
DEFINE("WFU_HEADERMESSAGECOLORS_STATE10", "#F88017,#FEF2E7,#633309");
|
154 |
+
DEFINE("WFU_HEADERMESSAGECOLORS_STATE11", "#666666,#EEEEEE,#333333");
|
155 |
+
|
156 |
+
//define images
|
157 |
+
DEFINE("WFU_IMAGE_ADMIN_HELP", WPFILEUPLOAD_DIR.'images/help_16.png');
|
158 |
+
DEFINE("WFU_IMAGE_ADMIN_USERDATA_ADD", WPFILEUPLOAD_DIR.'images/add_12.png');
|
159 |
+
DEFINE("WFU_IMAGE_ADMIN_USERDATA_REMOVE", WPFILEUPLOAD_DIR.'images/remove_12.png');
|
160 |
+
DEFINE("WFU_IMAGE_SIMPLE_PROGBAR", WPFILEUPLOAD_DIR.'images/progbar.gif');
|
161 |
+
|
162 |
+
function wfu_set_javascript_constants() {
|
163 |
+
$consts = array(
|
164 |
+
"nofilemessage" => WFU_ERROR_UPLOAD_NOFILESELECTED,
|
165 |
+
"userdata_empty" => WFU_ERROR_USERDATA_EMPTY,
|
166 |
+
"remoteserver_noresult" => WFU_ERROR_REMOTESERVER_NORESULT,
|
167 |
+
"jsonparse_filemessage" => WFU_ERROR_JSONPARSE_FILEMESSAGE,
|
168 |
+
"jsonparse_message" => WFU_ERROR_JSONPARSE_MESSAGE,
|
169 |
+
"jsonparse_adminmessage" => WFU_ERROR_JSONPARSE_ADMINMESSAGE,
|
170 |
+
"jsonparse_headermessage" => WFU_ERROR_JSONPARSE_HEADERMESSAGE,
|
171 |
+
"jsonparse_headeradminmessage" => WFU_ERROR_JSONPARSE_HEADERADMINMESSAGE,
|
172 |
+
"response_url" => WFU_RESPONSE_URL
|
173 |
+
);
|
174 |
+
$consts_txt = "";
|
175 |
+
foreach ( $consts as $key => $val )
|
176 |
+
$consts_txt .= ( $consts_txt == "" ? "" : ";" ).wfu_plugin_encode_string($key.":".$val);
|
177 |
+
|
178 |
+
return $consts_txt;
|
179 |
+
}
|
180 |
+
|
181 |
+
?>
|
lib/wfu_functions.php
ADDED
@@ -0,0 +1,288 @@
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
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|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
1 |
+
<?php
|
2 |
+
|
3 |
+
//********************* String Functions *******************************************************************************************************
|
4 |
+
|
5 |
+
function wfu_upload_plugin_clean($label) {
|
6 |
+
/**
|
7 |
+
* Regular expressions to change some characters.
|
8 |
+
*/
|
9 |
+
|
10 |
+
$search = array ('@[eeeeEE]@i','@[aaaAA]@i','@[iiII]@i','@[uuuUU]@i','@[ooOO]@i',
|
11 |
+
'@[c]@i','@[^a-zA-Z0-9._]@');
|
12 |
+
$replace = array ('e','a','i','u','o','c','-');
|
13 |
+
$label = preg_replace($search, $replace, $label);
|
14 |
+
$label = strtolower($label); // Convert in lower case
|
15 |
+
return $label;
|
16 |
+
}
|
17 |
+
|
18 |
+
function wfu_upload_plugin_wildcard_to_preg($pattern) {
|
19 |
+
return '/^' . str_replace(array('\*', '\?', '\[', '\]'), array('.*', '.', '[', ']+'), preg_quote($pattern)) . '$/is';
|
20 |
+
}
|
21 |
+
|
22 |
+
function wfu_upload_plugin_wildcard_match($pattern, $str) {
|
23 |
+
$pattern = wfu_upload_plugin_wildcard_to_preg($pattern);
|
24 |
+
return preg_match($pattern, $str);
|
25 |
+
}
|
26 |
+
|
27 |
+
function wfu_plugin_encode_string($string) {
|
28 |
+
$array = unpack('C*', $string);
|
29 |
+
$new_string = "";
|
30 |
+
for ($i = 1; $i <= count($array); $i ++) {
|
31 |
+
$new_string .= sprintf("%02X", $array[$i]);
|
32 |
+
}
|
33 |
+
return $new_string;
|
34 |
+
}
|
35 |
+
|
36 |
+
function wfu_plugin_decode_string($string) {
|
37 |
+
$new_string = "";
|
38 |
+
for ($i = 0; $i < strlen($string); $i += 2 ) {
|
39 |
+
$new_string .= sprintf("%c", hexdec(substr($string, $i ,2)));
|
40 |
+
}
|
41 |
+
return $new_string;
|
42 |
+
}
|
43 |
+
|
44 |
+
function wfu_create_random_string($len) {
|
45 |
+
$base = 'ABCDEFGHKLMNOPQRSTWXYZabcdefghjkmnpqrstwxyz123456789';
|
46 |
+
$max = strlen($base) - 1;
|
47 |
+
$activatecode = '';
|
48 |
+
mt_srand((double)microtime()*1000000);
|
49 |
+
while (strlen($activatecode) < $len)
|
50 |
+
$activatecode .= $base{mt_rand(0, $max)};
|
51 |
+
return $activatecode;
|
52 |
+
}
|
53 |
+
|
54 |
+
function wfu_join_strings($delimeter) {
|
55 |
+
$arr = func_get_args();
|
56 |
+
unset($arr[0]);
|
57 |
+
foreach ($arr as $key => $item)
|
58 |
+
if ( $item == "" ) unset($arr[$key]);
|
59 |
+
return join($delimeter, $arr);
|
60 |
+
}
|
61 |
+
|
62 |
+
//********************* Array Functions *****************************************************************************************************
|
63 |
+
|
64 |
+
function wfu_encode_array_to_string($arr) {
|
65 |
+
$arr_str = json_encode($arr);
|
66 |
+
$arr_str = wfu_plugin_encode_string($arr_str);
|
67 |
+
return $arr_str;
|
68 |
+
}
|
69 |
+
|
70 |
+
function wfu_decode_array_from_string($arr_str) {
|
71 |
+
$arr_str = wfu_plugin_decode_string($arr_str);
|
72 |
+
$arr = json_decode($arr_str, true);
|
73 |
+
return $arr;
|
74 |
+
}
|
75 |
+
|
76 |
+
function wfu_plugin_parse_array($source) {
|
77 |
+
$keys = array_keys($source);
|
78 |
+
$new_arr = array();
|
79 |
+
for ($i = 0; $i < count($keys); $i ++)
|
80 |
+
$new_arr[$keys[$i]] = wp_specialchars_decode($source[$keys[$i]]);
|
81 |
+
return $new_arr;
|
82 |
+
}
|
83 |
+
|
84 |
+
function wfu_array_remove_nulls(&$arr) {
|
85 |
+
foreach ( $arr as $key => $arri )
|
86 |
+
if ( $arri == null )
|
87 |
+
array_splice($arr, $key, 1);
|
88 |
+
}
|
89 |
+
|
90 |
+
//********************* Directory Functions ************************************************************************************************
|
91 |
+
|
92 |
+
function wfu_upload_plugin_full_path( $params ) {
|
93 |
+
$path = $params["uploadpath"];
|
94 |
+
if ( $params["accessmethod"]=='ftp' && $params["ftpinfo"] != '' && $params["useftpdomain"] == "true" ) {
|
95 |
+
$ftpdata_flat = str_replace(array('\:', '\@'), array('\_', '\_'), $params["ftpinfo"]);
|
96 |
+
$pos1 = strpos($ftpdata_flat, ":");
|
97 |
+
$pos2 = strpos($ftpdata_flat, "@");
|
98 |
+
if ( $pos1 && $pos2 && $pos2 > $pos1 ) {
|
99 |
+
$ftp_username = substr($params["ftpinfo"], 0, $pos1);
|
100 |
+
$ftp_password = substr($params["ftpinfo"], $pos1 + 1, $pos2 - $pos1 - 1);
|
101 |
+
$ftp_host = substr($params["ftpinfo"], $pos2 + 1);
|
102 |
+
$ftp_username = str_replace('@', '%40', $ftp_username); //if username contains @ character then convert it to %40
|
103 |
+
$ftp_password = str_replace('@', '%40', $ftp_password); //if password contains @ character then convert it to %40
|
104 |
+
$start_folder = 'ftp://'.$ftp_username.':'.$ftp_password."@".$ftp_host.'/';
|
105 |
+
}
|
106 |
+
else $start_folder = 'ftp://'.$params["ftpinfo"].'/';
|
107 |
+
}
|
108 |
+
else $start_folder = WP_CONTENT_DIR.'/';
|
109 |
+
if ($path) {
|
110 |
+
if ( $path == ".." || substr($path, 0, 3) == "../" ) {
|
111 |
+
$start_folder = ABSPATH;
|
112 |
+
$path = substr($path, 2, strlen($path) - 2);
|
113 |
+
}
|
114 |
+
if ( substr($path, 0, 1) == "/" ) $path = substr($path, 1, strlen($path) - 1);
|
115 |
+
if ( substr($path, -1, 1) == "/" ) $path = substr($path, 0, strlen($path) - 1);
|
116 |
+
$full_upload_path = $start_folder;
|
117 |
+
if ( $path != "" ) $full_upload_path .= $path.'/';
|
118 |
+
}
|
119 |
+
else {
|
120 |
+
$full_upload_path = $start_folder;
|
121 |
+
}
|
122 |
+
return $full_upload_path;
|
123 |
+
}
|
124 |
+
|
125 |
+
function wfu_upload_plugin_directory( $path ) {
|
126 |
+
$dirparts = explode("/", $path);
|
127 |
+
return $dirparts[count($dirparts) - 1];
|
128 |
+
}
|
129 |
+
|
130 |
+
//********************* User Functions *********************************************************************************************************
|
131 |
+
|
132 |
+
function wfu_get_user_role($user, $param_roles) {
|
133 |
+
if ( !empty( $user->roles ) && is_array( $user->roles ) ) {
|
134 |
+
/* Go through the array of the roles of the current user */
|
135 |
+
foreach ( $user->roles as $user_role ) {
|
136 |
+
$user_role = strtolower($user_role);
|
137 |
+
/* If one role of the current user matches to the roles allowed to upload */
|
138 |
+
if ( in_array($user_role, $param_roles) || $user_role == 'administrator' ) {
|
139 |
+
/* We affect this role to current user */
|
140 |
+
$result_role = $user_role;
|
141 |
+
break;
|
142 |
+
}
|
143 |
+
else {
|
144 |
+
/* We affect the 'visitor' role to current user */
|
145 |
+
$result_role = 'visitor';
|
146 |
+
}
|
147 |
+
}
|
148 |
+
}
|
149 |
+
else {
|
150 |
+
$result_role = 'visitor';
|
151 |
+
}
|
152 |
+
return $result_role;
|
153 |
+
}
|
154 |
+
|
155 |
+
//********************* Shortcode Options Functions ************************************************************************************************
|
156 |
+
|
157 |
+
function wfu_generate_current_params_index($shortcode_id, $user_login) {
|
158 |
+
global $post;
|
159 |
+
$cur_index_str = '||'.$post->ID.'||'.$shortcode_id.'||'.$user_login;
|
160 |
+
$cur_index_str_search = '\|\|'.$post->ID.'\|\|'.$shortcode_id.'\|\|'.$user_login;
|
161 |
+
$index_str = get_option('wfu_params_index');
|
162 |
+
$index = explode("&&", $index_str);
|
163 |
+
foreach ($index as $key => $value) if ($value == "") unset($index[$key]);
|
164 |
+
$index_match = preg_grep("/".$cur_index_str_search."$/", $index);
|
165 |
+
if ( count($index_match) == 1 && $index_match[0] == "" ) unset($index_match[0]);
|
166 |
+
if ( count($index_match) <= 0 ) {
|
167 |
+
$cur_index_rand = wfu_create_random_string(16);
|
168 |
+
array_push($index, $cur_index_rand.$cur_index_str);
|
169 |
+
}
|
170 |
+
else {
|
171 |
+
$cur_index_rand = substr(current($index_match), 0, 16);
|
172 |
+
if ( count($index_match) > 1 ) {
|
173 |
+
$index_match_keys = array_keys($index_match);
|
174 |
+
for ($i = 1; $i < count($index_match); $i++) {
|
175 |
+
$ii = $index_match_keys[$i];
|
176 |
+
unset($index[array_search($index_match[$ii], $index, true)]);
|
177 |
+
}
|
178 |
+
}
|
179 |
+
}
|
180 |
+
if ( count($index_match) != 1 ) {
|
181 |
+
$index_str = implode("&&", $index);
|
182 |
+
update_option('wfu_params_index', $index_str);
|
183 |
+
}
|
184 |
+
return $cur_index_rand;
|
185 |
+
}
|
186 |
+
|
187 |
+
function wfu_get_params_fields_from_index($params_index) {
|
188 |
+
$fields = array();
|
189 |
+
$index_str = get_option('wfu_params_index');
|
190 |
+
$index = explode("&&", $index_str);
|
191 |
+
$index_match = preg_grep("/^".$params_index."/", $index);
|
192 |
+
if ( count($index_match) == 1 && $index_match[0] == "" ) unset($index_match[0]);
|
193 |
+
if ( count($index_match) > 0 )
|
194 |
+
list($fields['unique_id'], $fields['page_id'], $fields['shortcode_id'], $fields['user_login']) = explode("||", current($index_match));
|
195 |
+
return $fields;
|
196 |
+
}
|
197 |
+
|
198 |
+
function wfu_decode_dimensions($dimensions_str) {
|
199 |
+
$components = wfu_component_definitions();
|
200 |
+
$dimensions = array();
|
201 |
+
foreach ( $components as $comp ) {
|
202 |
+
if ( $comp['dimensions'] == null ) $dimensions[$comp['id']] = "";
|
203 |
+
else foreach ( $comp['dimensions'] as $dimraw ) {
|
204 |
+
list($dim_id, $dim_name) = explode("/", $dimraw);
|
205 |
+
$dimensions[$dim_id] = "";
|
206 |
+
}
|
207 |
+
}
|
208 |
+
$dimensions_raw = explode(",", $dimensions_str);
|
209 |
+
foreach ( $dimensions_raw as $dimension_str ) {
|
210 |
+
$dimension_raw = explode(":", $dimension_str);
|
211 |
+
$item = strtolower(trim($dimension_raw[0]));
|
212 |
+
foreach ( array_keys($dimensions) as $key ) {
|
213 |
+
if ( $item == $key ) $dimensions[$key] = trim($dimension_raw[1]);
|
214 |
+
}
|
215 |
+
}
|
216 |
+
return $dimensions;
|
217 |
+
}
|
218 |
+
|
219 |
+
//********************* Plugin Design Functions *********************************************************************************************************
|
220 |
+
|
221 |
+
function wfu_add_div() {
|
222 |
+
$items_count = func_num_args();
|
223 |
+
if ( $items_count == 0 ) return "";
|
224 |
+
$items_raw = func_get_args();
|
225 |
+
$items = array( );
|
226 |
+
foreach ( $items_raw as $item_raw ) {
|
227 |
+
if ( is_array($item_raw) ) array_push($items, $item_raw);
|
228 |
+
}
|
229 |
+
$items_count = count($items);
|
230 |
+
if ( $items_count == 0 ) return "";
|
231 |
+
$div = "";
|
232 |
+
$div .= "\n\t".'<div class="file_div_clean">';
|
233 |
+
$div .= "\n\t\t".'<table class="file_table_clean">';
|
234 |
+
$div .= "\n\t\t\t".'<tbody>';
|
235 |
+
$div .= "\n\t\t\t\t".'<tr>';
|
236 |
+
for ( $i = 0; $i < $items_count; $i++ ) {
|
237 |
+
$div .= "\n\t\t\t\t\t".'<td class="file_td_clean"';
|
238 |
+
if ( $i < $items_count - 1 ) $div .= ' style="padding: 0 4px 0 0"';
|
239 |
+
$div .= '>';
|
240 |
+
$div .= "\n\t\t\t\t\t\t".'<div id="'.$items[$i]["title"].'" class="file_div_clean"';
|
241 |
+
if ( $items[$i]["hidden"] ) $div .= ' style="display: none"';
|
242 |
+
$div .= '>';
|
243 |
+
$item_lines_count = count($items[$i]) - 2;
|
244 |
+
for ( $k = 1; $k <= $item_lines_count; $k++ ) {
|
245 |
+
if ( $items[$i]["line".$k] != "" ) $div .= "\n\t\t\t\t\t\t\t".$items[$i]["line".$k];
|
246 |
+
}
|
247 |
+
$div .= "\n\t\t\t\t\t\t\t".'<div class="file_space_clean" />';
|
248 |
+
$div .= "\n\t\t\t\t\t\t".'</div>';
|
249 |
+
$div .= "\n\t\t\t\t\t".'</td>';
|
250 |
+
}
|
251 |
+
$div .= "\n\t\t\t\t".'</tr>';
|
252 |
+
$div .= "\n\t\t\t".'</tbody>';
|
253 |
+
$div .= "\n\t\t".'</table>';
|
254 |
+
$div .= "\n\t".'</div>';
|
255 |
+
return $div;
|
256 |
+
}
|
257 |
+
|
258 |
+
//********************* Email Functions **************************************************************************************************************
|
259 |
+
|
260 |
+
function wfu_send_notification_email($user, $only_filename_list, $target_path_list, $attachment_list, $userdata_fields, $params) {
|
261 |
+
if ( 0 == $user->ID ) {
|
262 |
+
$user_login = "guest";
|
263 |
+
$user_email = "";
|
264 |
+
}
|
265 |
+
else {
|
266 |
+
$user_login = $user->user_login;
|
267 |
+
$user_email = $user->user_email;
|
268 |
+
}
|
269 |
+
$notifyrecipients = trim(preg_replace('/%useremail%/', $user_email, $params["notifyrecipients"]));
|
270 |
+
$search = array ('/%username%/', '/%useremail%/', '/%filename%/', '/%filepath%/', '/%n%/');
|
271 |
+
$replace = array ($user_login, ( $user_email == "" ? "no email" : $user_email ), $only_filename_list, $target_path_list, "\n");
|
272 |
+
foreach ( $userdata_fields as $userdata_key => $userdata_field ) {
|
273 |
+
array_push($search, '/%userdata'.$userdata_key.'%/');
|
274 |
+
array_push($replace, $userdata_field["value"]);
|
275 |
+
}
|
276 |
+
$notifysubject = preg_replace($search, $replace, $params["notifysubject"]);
|
277 |
+
$notifymessage = preg_replace($search, $replace, $params["notifymessage"]);
|
278 |
+
if ( $params["attachfile"] == "true" ) {
|
279 |
+
$attachments = explode(",", $attachment_list);
|
280 |
+
$notify_sent = wp_mail($notifyrecipients, $notifysubject, $notifymessage, $params["notifyheaders"], $attachments);
|
281 |
+
}
|
282 |
+
else {
|
283 |
+
$notify_sent = wp_mail($notifyrecipients, $notifysubject, $notifymessage, $params["notifyheaders"]);
|
284 |
+
}
|
285 |
+
return ( $notify_sent ? "" : WFU_WARNING_NOTIFY_NOTSENT_UNKNOWNERROR );
|
286 |
+
}
|
287 |
+
|
288 |
+
?>
|
lib/wfu_io.php
ADDED
@@ -0,0 +1,106 @@
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
1 |
+
<?php
|
2 |
+
|
3 |
+
function wfu_create_directory($path, $method, $ftpdata) {
|
4 |
+
$ret_message = "";
|
5 |
+
if ( $method == "" || $method == "normal" ) {
|
6 |
+
mkdir($path, 0777, true);
|
7 |
+
}
|
8 |
+
else if ( $method == "ftp" && $ftpdata != "" ) {
|
9 |
+
$ftpdata_flat = str_replace(array('\:', '\@'), array('\_', '\_'), $ftpdata);
|
10 |
+
$pos1 = strpos($ftpdata_flat, ":");
|
11 |
+
$pos2 = strpos($ftpdata_flat, "@");
|
12 |
+
if ( $pos1 && $pos2 && $pos2 > $pos1 ) {
|
13 |
+
$ftp_username = substr($ftpdata, 0, $pos1);
|
14 |
+
$ftp_password = substr($ftpdata, $pos1 + 1, $pos2 - $pos1 - 1);
|
15 |
+
$ftp_host = substr($ftpdata, $pos2 + 1);
|
16 |
+
$conn_id = ftp_connect($ftp_host);
|
17 |
+
$login_result = ftp_login($conn_id, $ftp_username, $ftp_password);
|
18 |
+
if ( $conn_id && $login_result ) {
|
19 |
+
$flat_host = preg_replace("/^(.*\.)?([^.]*\..*)$/", "$2", $ftp_host);
|
20 |
+
$pos1 = strpos($path, $flat_host);
|
21 |
+
if ( $pos1 ) {
|
22 |
+
$path = substr($path, $pos1 + strlen($flat_host));
|
23 |
+
ftp_mkdir($conn_id, $path);
|
24 |
+
ftp_chmod($conn_id, 511, $path);
|
25 |
+
}
|
26 |
+
else {
|
27 |
+
$ret_message = WFU_ERROR_ADMIN_FTPDIR_RESOLVE;
|
28 |
+
}
|
29 |
+
}
|
30 |
+
else {
|
31 |
+
$ret_message = WFU_ERROR_ADMIN_FTPINFO_INVALID;
|
32 |
+
}
|
33 |
+
ftp_quit($conn_id);
|
34 |
+
}
|
35 |
+
else {
|
36 |
+
$ret_message = WFU_ERROR_ADMIN_FTPINFO_EXTRACT;
|
37 |
+
}
|
38 |
+
}
|
39 |
+
else {
|
40 |
+
$ret_message = WFU_ERROR_ADMIN_FTPINFO_INVALID;
|
41 |
+
}
|
42 |
+
return $ret_message;
|
43 |
+
}
|
44 |
+
|
45 |
+
|
46 |
+
function wfu_upload_file($source, $target, $method, $ftpdata) {
|
47 |
+
$ret_array = "";
|
48 |
+
$ret_array["uploaded"] = false;
|
49 |
+
$ret_array["admin_message"] = "";
|
50 |
+
$ret_message = "";
|
51 |
+
$target_perms = substr(sprintf('%o', fileperms(dirname($target))), -4);
|
52 |
+
if ( $method == "" || $method == "normal" ) {
|
53 |
+
$ret_array["uploaded"] = move_uploaded_file($source, $target);
|
54 |
+
if ( !$ret_array["uploaded"] && !is_writable(dirname($target)) ) {
|
55 |
+
$ret_message = WFU_ERROR_ADMIN_DIR_PERMISSION;
|
56 |
+
}
|
57 |
+
}
|
58 |
+
else if ( $method == "ftp" && $ftpdata != "" ) {
|
59 |
+
$result = false;
|
60 |
+
$ftpdata_flat = str_replace(array('\:', '\@'), array('\_', '\_'), $ftpdata);
|
61 |
+
$pos1 = strpos($ftpdata_flat, ":");
|
62 |
+
$pos2 = strpos($ftpdata_flat, "@");
|
63 |
+
if ( $pos1 && $pos2 && $pos2 > $pos1 ) {
|
64 |
+
$ftp_username = substr($ftpdata, 0, $pos1);
|
65 |
+
$ftp_password = substr($ftpdata, $pos1 + 1, $pos2 - $pos1 - 1);
|
66 |
+
$ftp_host = substr($ftpdata, $pos2 + 1);
|
67 |
+
$conn_id = ftp_connect($ftp_host);
|
68 |
+
$login_result = ftp_login($conn_id, $ftp_username, $ftp_password);
|
69 |
+
if ( $conn_id && $login_result ) {
|
70 |
+
$flat_host = preg_replace("/^(.*\.)?([^.]*\..*)$/", "$2", $ftp_host);
|
71 |
+
$pos1 = strpos($target, $flat_host);
|
72 |
+
if ( $pos1 ) {
|
73 |
+
// $temp_fname = tempnam(dirname($target), "tmp");
|
74 |
+
// move_uploaded_file($source, $temp_fname);
|
75 |
+
$target = substr($target, $pos1 + strlen($flat_host));
|
76 |
+
ftp_chmod($conn_id, 0755, dirname($target));
|
77 |
+
$ret_array["uploaded"] = ftp_put($conn_id, $target, $source, FTP_BINARY);
|
78 |
+
ftp_chmod($conn_id, 0755, $target);
|
79 |
+
ftp_chmod($conn_id, $target_perms, dirname($target));
|
80 |
+
unlink($source);
|
81 |
+
if ( !$ret_array["uploaded"] ) {
|
82 |
+
$ret_message = WFU_ERROR_ADMIN_DIR_PERMISSION;
|
83 |
+
}
|
84 |
+
}
|
85 |
+
else {
|
86 |
+
$ret_message = WFU_ERROR_ADMIN_FTPFILE_RESOLVE;
|
87 |
+
}
|
88 |
+
}
|
89 |
+
else {
|
90 |
+
$ret_message = WFU_ERROR_ADMIN_FTPINFO_INVALID;
|
91 |
+
}
|
92 |
+
ftp_quit($conn_id);
|
93 |
+
}
|
94 |
+
else {
|
95 |
+
$ret_message = WFU_ERROR_ADMIN_FTPINFO_EXTRACT.$ftpdata_flat;
|
96 |
+
}
|
97 |
+
}
|
98 |
+
else {
|
99 |
+
$ret_message = WFU_ERROR_ADMIN_FTPINFO_INVALID;
|
100 |
+
}
|
101 |
+
|
102 |
+
$ret_array["admin_message"] = $ret_message;
|
103 |
+
return $ret_array;
|
104 |
+
}
|
105 |
+
|
106 |
+
?>
|
lib/wfu_message.php
ADDED
@@ -0,0 +1,211 @@
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|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
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
1 |
+
<?php
|
2 |
+
|
3 |
+
function wfu_prepare_message_block_skeleton($sid, $styles, $test) {
|
4 |
+
/* Prepare header styles for all upload states */
|
5 |
+
$header_styles["State0"] = wfu_prepare_message_colors(WFU_HEADERMESSAGECOLORS_STATE0);
|
6 |
+
$header_styles["State0"]['message'] = WFU_UPLOAD_STATE0;
|
7 |
+
$header_styles["State1"] = wfu_prepare_message_colors(WFU_HEADERMESSAGECOLORS_STATE1);
|
8 |
+
$header_styles["State1"]['message'] = WFU_UPLOAD_STATE1;
|
9 |
+
$header_styles["State2"] = wfu_prepare_message_colors(WFU_HEADERMESSAGECOLORS_STATE2);
|
10 |
+
$header_styles["State2"]['message'] = WFU_UPLOAD_STATE2;
|
11 |
+
$header_styles["State3"] = wfu_prepare_message_colors(WFU_HEADERMESSAGECOLORS_STATE3);
|
12 |
+
$header_styles["State3"]['message'] = WFU_UPLOAD_STATE3;
|
13 |
+
$header_styles["State4"] = wfu_prepare_message_colors(WFU_HEADERMESSAGECOLORS_STATE4);
|
14 |
+
$header_styles["State4"]['message'] = WFU_UPLOAD_STATE4;
|
15 |
+
$header_styles["State5"] = wfu_prepare_message_colors(WFU_HEADERMESSAGECOLORS_STATE5);
|
16 |
+
$header_styles["State5"]['message'] = WFU_UPLOAD_STATE5;
|
17 |
+
$header_styles["State5_singlefile"] = wfu_prepare_message_colors(WFU_HEADERMESSAGECOLORS_STATE5);
|
18 |
+
$header_styles["State5_singlefile"]['message'] = WFU_UPLOAD_STATE5_SINGLEFILE;
|
19 |
+
$header_styles["State6"] = wfu_prepare_message_colors(WFU_HEADERMESSAGECOLORS_STATE6);
|
20 |
+
$header_styles["State6"]['message'] = WFU_UPLOAD_STATE6;
|
21 |
+
$header_styles["State7"] = wfu_prepare_message_colors(WFU_HEADERMESSAGECOLORS_STATE7);
|
22 |
+
$header_styles["State7"]['message'] = WFU_UPLOAD_STATE7;
|
23 |
+
$header_styles["State7_singlefile"] = wfu_prepare_message_colors(WFU_HEADERMESSAGECOLORS_STATE7);
|
24 |
+
$header_styles["State7_singlefile"]['message'] = WFU_UPLOAD_STATE7_SINGLEFILE;
|
25 |
+
$header_styles["State8"] = wfu_prepare_message_colors(WFU_HEADERMESSAGECOLORS_STATE8);
|
26 |
+
$header_styles["State8"]['message'] = WFU_UPLOAD_STATE8;
|
27 |
+
$header_styles["State9"] = wfu_prepare_message_colors(WFU_HEADERMESSAGECOLORS_STATE9);
|
28 |
+
$header_styles["State9"]['message'] = WFU_UPLOAD_STATE9;
|
29 |
+
$header_styles["State10"] = wfu_prepare_message_colors(WFU_HEADERMESSAGECOLORS_STATE10);
|
30 |
+
$header_styles["State10"]['message'] = WFU_UPLOAD_STATE10;
|
31 |
+
$header_styles["State11"] = wfu_prepare_message_colors(WFU_HEADERMESSAGECOLORS_STATE11);
|
32 |
+
$header_styles["State11"]['message'] = WFU_UPLOAD_STATE11;
|
33 |
+
$ExposedStateIndex = array("0", "1", "2", "3", "4", "5", "5_singlefile", "6", "7", "7_singlefile", "8", "11");
|
34 |
+
|
35 |
+
/* set general variables */
|
36 |
+
$messageblock_main = 'wfu_messageblock_'.$sid;
|
37 |
+
$messageblock_header = 'wfu_messageblock_header_'.$sid;
|
38 |
+
$messageblock_arrow = 'wfu_messageblock_arrow_'.$sid;
|
39 |
+
$messageblock_subheader = 'wfu_messageblock_subheader_'.$sid;
|
40 |
+
$dlp .= "\n\t\t\t\t\t\t\t";
|
41 |
+
|
42 |
+
/* Prepare header HTML template
|
43 |
+
Variables:
|
44 |
+
[header_safe]: suffix having the value "_safe" in case of State10 upload state, or empty otherwise,
|
45 |
+
[header_color]: text color of header,
|
46 |
+
[header_bgcolor]: background color of header,
|
47 |
+
[header_borcolor]: border color of header,
|
48 |
+
[header_message]: text shown in header */
|
49 |
+
$i = 1;
|
50 |
+
$messageblock_headers[$i++] = "\t\t\t".'<div id="'.$messageblock_header.'[header_safe]" class="file_messageblock_header" style="color:[header_color]; background-color:[header_bgcolor]; border:1px solid [header_borcolor];">';
|
51 |
+
$messageblock_headers[$i++] = "\t\t\t\t".'<label id="'.$messageblock_header.'_label[header_safe]" class="file_messageblock_header_label">[header_message]</label>';
|
52 |
+
$messageblock_headers[$i++] = "\t\t\t".'</div>';
|
53 |
+
|
54 |
+
/* Prepare the file block HTML template
|
55 |
+
Variables:
|
56 |
+
[file_id]: replaced by the id of the file (1, 2, ...),
|
57 |
+
[filenumber_display]: display:none if single file upload, otherwise empty,
|
58 |
+
[fileheader_color], [fileheader_bgcolor], [fileheader_borcolor], [fileheader_message]: replaced by the returned values,
|
59 |
+
[filesubheadermessage_display]: display:none if there is no message, otherwise empty,
|
60 |
+
[filesubheader_message]: replaced by the returned value,
|
61 |
+
[filesubheaderadminmessage_display]: display:none if there is no admin message, otherwise empty,
|
62 |
+
[filesubheader_adminmessage]: replaced by the returned value */
|
63 |
+
/* Prepare the files header block HTML template */
|
64 |
+
$i = 1;
|
65 |
+
$file_count = ( $test ? 2 : 1);
|
66 |
+
for ($ii = 1; $ii <= $file_count; $ii++) {
|
67 |
+
if ( $test ) {
|
68 |
+
$file_props = wfu_prepare_message_colors(WFU_TESTMESSAGECOLORS);
|
69 |
+
$file_id = $ii;
|
70 |
+
$filenumber_display = "";
|
71 |
+
$fileheader_color = $file_props['color'];
|
72 |
+
$fileheader_bgcolor = $file_props['bgcolor'];
|
73 |
+
$fileheader_borcolor = $file_props['borcolor'];
|
74 |
+
$fileheader_message = constant('WFU_TESTMESSAGE_FILE'.$ii.'_HEADER');
|
75 |
+
$filesubheadermessage_display = "";
|
76 |
+
$filesubheader_message = constant('WFU_TESTMESSAGE_FILE'.$ii.'_MESSAGE');
|
77 |
+
$filesubheaderadminmessage_display = "";
|
78 |
+
$filesubheader_adminmessage = constant('WFU_TESTMESSAGE_FILE'.$ii.'_ADMINMESSAGE');
|
79 |
+
}
|
80 |
+
else {
|
81 |
+
$file_id = '[file_id]';
|
82 |
+
$filenumber_display = '[filenumber_display]';
|
83 |
+
$fileheader_color = '[fileheader_color]';
|
84 |
+
$fileheader_bgcolor = '[fileheader_bgcolor]';
|
85 |
+
$fileheader_borcolor = '[fileheader_borcolor]';
|
86 |
+
$fileheader_message = '[fileheader_message]';
|
87 |
+
$filesubheadermessage_display = '[filesubheadermessage_display]';
|
88 |
+
$filesubheader_message = '[filesubheader_message]';
|
89 |
+
$filesubheaderadminmessage_display = '[filesubheaderadminmessage_display]';
|
90 |
+
$filesubheader_adminmessage = '[filesubheader_adminmessage]';
|
91 |
+
}
|
92 |
+
$messageblock_file[$i++] = "\t".'<tr id="'.$messageblock_main.'_'.$file_id.'" class="file_messageblock_fileheader_tr" style="display:none;">';
|
93 |
+
$messageblock_file[$i++] = "\t\t".'<td id="'.$messageblock_main.'_filenumber_'.$file_id.'" class="file_messageblock_filenumber_td"'.$filenumber_display.'>'.$file_id.'</td>';
|
94 |
+
$messageblock_file[$i++] = "\t\t".'<td id="'.$messageblock_header.'_container_'.$file_id.'" class="file_messageblock_fileheader_td">';
|
95 |
+
$messageblock_file[$i++] = "\t\t\t".'<div id="'.$messageblock_header.'_'.$file_id.'" class="file_messageblock_fileheader" style="color:'.$fileheader_color.'; background-color:'.$fileheader_bgcolor.'; border:1px solid '.$fileheader_borcolor.';">';
|
96 |
+
$messageblock_file[$i++] = "\t\t\t\t".'<label id="'.$messageblock_header.'_label_'.$file_id.'" class="file_messageblock_fileheader_label">'.$fileheader_message.'</label>';
|
97 |
+
/* The following hidden input holds state of arrow (open or close) */
|
98 |
+
$messageblock_file[$i++] = "\t\t\t\t".'<input id="'.$messageblock_header.'_state_'.$file_id.'" type="hidden" value="none" />';
|
99 |
+
$messageblock_file[$i++] = "\t\t\t".'</div>';
|
100 |
+
$messageblock_file[$i++] = "\t\t".'</td>';
|
101 |
+
/* Add a drop down arrow to the file header (file has always details to be shown) */
|
102 |
+
$messageblock_file[$i++] = "\t\t".'<td id="'.$messageblock_arrow.'_'.$file_id.'" class="file_messageblock_filearrow_td" onclick="wfu_filedetails_toggle('.$sid.', '.$file_id.');">';
|
103 |
+
$messageblock_file[$i++] = "\t\t\t".'<div id="'.$messageblock_arrow.'_up_'.$file_id.'" class="file_messageblock_file_arrow_up" style="display:none;"></div>';
|
104 |
+
$messageblock_file[$i++] = "\t\t\t".'<div id="'.$messageblock_arrow.'_down_'.$file_id.'" class="file_messageblock_file_arrow_down"></div>';
|
105 |
+
$messageblock_file[$i++] = "\t\t".'</td>';
|
106 |
+
$messageblock_file[$i++] = "\t".'</tr>';
|
107 |
+
/* Prepare the files subheader block HTML template */
|
108 |
+
$messageblock_file[$i++] = "\t".'<tr id="'.$messageblock_subheader.'_'.$file_id.'" class="file_messageblock_filesubheader_tr" style="display:none;">';
|
109 |
+
$messageblock_file[$i++] = "\t\t".'<td id="'.$messageblock_subheader.'_fileempty_'.$file_id.'" class="file_messageblock_filesubheaderempty_td"'.$filenumber_display.'></td>';
|
110 |
+
$messageblock_file[$i++] = "\t\t".'<td colspan="2" id="'.$messageblock_subheader.'_container_'.$file_id.'" class="file_messageblock_filesubheader_td">';
|
111 |
+
$messageblock_file[$i++] = "\t\t\t".'<div id="'.$messageblock_subheader.'_message_'.$file_id.'" class="file_messageblock_filesubheader_message"'.$filesubheadermessage_display.'>';
|
112 |
+
$messageblock_file[$i++] = "\t\t\t\t".'<label id="'.$messageblock_subheader.'_messagelabel_'.$file_id.'" class="file_messageblock_filesubheader_messagelabel">'.$filesubheader_message.'</label>';
|
113 |
+
$messageblock_file[$i++] = "\t\t\t".'</div>';
|
114 |
+
$messageblock_file[$i++] = "\t\t\t".'<div id="'.$messageblock_subheader.'_adminmessage_'.$file_id.'" class="file_messageblock_filesubheader_adminmessage"'.$filesubheaderadminmessage_display.'>';
|
115 |
+
$messageblock_file[$i++] = "\t\t\t\t".'<label id="'.$messageblock_subheader.'_adminmessagelabel_'.$file_id.'" class="file_messageblock_filesubheader_adminmessagelabel">'.$filesubheader_adminmessage.'</label>';
|
116 |
+
$messageblock_file[$i++] = "\t\t\t".'</div>';
|
117 |
+
$messageblock_file[$i++] = "\t\t".'</td>';
|
118 |
+
$messageblock_file[$i++] = "\t".'</tr>';
|
119 |
+
}
|
120 |
+
|
121 |
+
/* Construct the main header block HTML text
|
122 |
+
/* Construct the header block HTML text */
|
123 |
+
$i = 1;
|
124 |
+
$messageblock["msgblock"]["line".$i++] = '<table id="'.$messageblock_main.'" class="file_messageblock_table"'.$styles.'><tbody>';
|
125 |
+
$messageblock["msgblock"]["line".$i++] = "\t".'<tr id="'.$messageblock_header.'" class="file_messageblock_header_tr"'.( $test ? '' : 'style="display:none;"' ).'>';
|
126 |
+
$messageblock["msgblock"]["line".$i++] = "\t\t".'<td colspan="2" id="'.$messageblock_header.'_container" class="file_messageblock_header_td">';
|
127 |
+
/* Inside this td element the appropriate upload state HTML block is going to be inserted using Javascript
|
128 |
+
If the plugin is in test mode, then State9 HTML block is inserted now */
|
129 |
+
if ( $test ) {
|
130 |
+
foreach ( $messageblock_headers as $messageblock_header_part )
|
131 |
+
$messageblock["msgblock"]["line".$i++] = strtr($messageblock_header_part, array(
|
132 |
+
"[header_safe]" => "",
|
133 |
+
"[header_color]" => $header_styles["State9"]["color"],
|
134 |
+
"[header_bgcolor]" => $header_styles["State9"]["bgcolor"],
|
135 |
+
"[header_borcolor]" => $header_styles["State9"]["borcolor"],
|
136 |
+
"[header_message]" => $header_styles["State9"]["message"]
|
137 |
+
));
|
138 |
+
}
|
139 |
+
$messageblock["msgblock"]["line".$i++] = "\t\t".'</td>';
|
140 |
+
/* Add a drop down arrow to the header */
|
141 |
+
$messageblock["msgblock"]["line".$i++] = "\t\t".'<td id="'.$messageblock_arrow.'" class="file_messageblock_arrow_td"'.( $test ? '' : 'style="display:none;"' ).' onclick="wfu_headerdetails_toggle('.$sid.');">';
|
142 |
+
$messageblock["msgblock"]["line".$i++] = "\t\t\t".'<input id="'.$messageblock_header.'_state" type="hidden" value="none" />';
|
143 |
+
$messageblock["msgblock"]["line".$i++] = "\t\t\t".'<div id="'.$messageblock_arrow.'_up" class="file_messageblock_header_arrow_up" style="display:none;"></div>';
|
144 |
+
$messageblock["msgblock"]["line".$i++] = "\t\t\t".'<div id="'.$messageblock_arrow.'_down" class="file_messageblock_header_arrow_down"></div>';
|
145 |
+
$messageblock["msgblock"]["line".$i++] = "\t\t".'</td>';
|
146 |
+
$messageblock["msgblock"]["line".$i++] = "\t".'</tr>';
|
147 |
+
/* Construct the subheader block HTML text if exists */
|
148 |
+
$messageblock["msgblock"]["line".$i++] = "\t".'<tr id="'.$messageblock_subheader.'" class="file_messageblock_subheader_tr" style="display:none;">';
|
149 |
+
$messageblock["msgblock"]["line".$i++] = "\t\t".'<td colspan="3" id="'.$messageblock_subheader.'_td" class="file_messageblock_subheader_td">';
|
150 |
+
$messageblock["msgblock"]["line".$i++] = "\t\t\t".'<div id="'.$messageblock_subheader.'_message" class="file_messageblock_subheader_message"'.( $test ? '' : 'style="display:none;"' ).'>';
|
151 |
+
$messageblock["msgblock"]["line".$i++] = "\t\t\t\t".'<label id="'.$messageblock_subheader.'_messagelabel" class="file_messageblock_subheader_messagelabel">'.( $test ? WFU_TESTMESSAGE_MESSAGE : '' ).'</label>';
|
152 |
+
$messageblock["msgblock"]["line".$i++] = "\t\t\t".'</div>';
|
153 |
+
$messageblock["msgblock"]["line".$i++] = "\t\t\t".'<div id="'.$messageblock_subheader.'_adminmessage" class="file_messageblock_subheader_adminmessage"'.( $test ? '' : 'style="display:none;"' ).'>';
|
154 |
+
$messageblock["msgblock"]["line".$i++] = "\t\t\t\t".'<label id="'.$messageblock_subheader.'_adminmessagelabel" class="file_messageblock_subheader_adminmessagelabel">'.( $test ? WFU_TESTMESSAGE_ADMINMESSAGE : '' ).'</label>';
|
155 |
+
$messageblock["msgblock"]["line".$i++] = "\t\t\t".'</div>';
|
156 |
+
$messageblock["msgblock"]["line".$i++] = "\t\t".'</td>';
|
157 |
+
$messageblock["msgblock"]["line".$i++] = "\t".'</tr>';
|
158 |
+
/* After the above tr the file blocks are appended by Javascript dynamically as additional tr elements
|
159 |
+
If the plugin is in test mode, then two test file blocks are appended now */
|
160 |
+
if ( $test ) {
|
161 |
+
foreach ( $messageblock_file as $messageblock_file_part )
|
162 |
+
$messageblock["msgblock"]["line".$i++] = $messageblock_file_part;
|
163 |
+
}
|
164 |
+
$messageblock["msgblock"]["line".$i++] = '</tbody></table>';
|
165 |
+
/* Construct a div element that will hold the State10 header and use it in case JSON parse fails and upload results cannot be decoded */
|
166 |
+
$messageblock["msgblock"]["line".$i++] = '<div id="'.$messageblock_header.'_safecontainer" style="display:none;">';
|
167 |
+
foreach ( $messageblock_headers as $messageblock_header_part )
|
168 |
+
$messageblock["msgblock"]["line".$i++] = strtr($messageblock_header_part, array(
|
169 |
+
"[header_safe]" => "_safe",
|
170 |
+
"[header_color]" => $header_styles["State10"]["color"],
|
171 |
+
"[header_bgcolor]" => $header_styles["State10"]["bgcolor"],
|
172 |
+
"[header_borcolor]" => $header_styles["State10"]["borcolor"],
|
173 |
+
"[header_message]" => $header_styles["State10"]["message"]
|
174 |
+
));
|
175 |
+
$messageblock["msgblock"]["line".$i++] = '</div>';
|
176 |
+
|
177 |
+
/* Construct header HTML text for all upload states and save it to hidden input, to be used later on by Javascript to adjust the upload state dynamically */
|
178 |
+
$messageblock_header_template = "";
|
179 |
+
foreach ( $messageblock_headers as $messageblock_header_part )
|
180 |
+
$messageblock_header_template .= $dlp.$messageblock_header_part;
|
181 |
+
foreach ($ExposedStateIndex as $ii)
|
182 |
+
$messageblock["header"]["State".$ii] = strtr($messageblock_header_template, array(
|
183 |
+
"[header_safe]" => "",
|
184 |
+
"[header_color]" => $header_styles["State".$ii]["color"],
|
185 |
+
"[header_bgcolor]" => $header_styles["State".$ii]["bgcolor"],
|
186 |
+
"[header_borcolor]" => $header_styles["State".$ii]["borcolor"],
|
187 |
+
"[header_message]" => $header_styles["State".$ii]["message"]
|
188 |
+
));
|
189 |
+
$messageblock_header_str = wfu_encode_array_to_string($messageblock["header"]);
|
190 |
+
$messageblock["msgblock"]["line".$i++] = '<input id="'.$messageblock_header.'_states" type="hidden" value="'.$messageblock_header_str.'" />';
|
191 |
+
|
192 |
+
/* Construct file HTML block template and save it to hidden div to be used later on by Javascript to add file results to the upload message dynamically */
|
193 |
+
$messageblock_file_str = "";
|
194 |
+
foreach ( $messageblock_file as $messageblock_file_part )
|
195 |
+
$messageblock_file_str .= $dlp.$messageblock_file_part;
|
196 |
+
$messageblock_file_str = wfu_plugin_encode_string($messageblock_file_str);
|
197 |
+
$messageblock["msgblock"]["line".$i++] = '<input id="'.$messageblock_main.'_filetemplate" type="hidden" value="'.$messageblock_file_str.'" />';
|
198 |
+
$messageblock["msgblock"]["line".$i++] = '<div id="'.$messageblock_main.'_door" style="display:none;"></div>';
|
199 |
+
|
200 |
+
return $messageblock;
|
201 |
+
}
|
202 |
+
|
203 |
+
function wfu_prepare_message_colors($template) {
|
204 |
+
$color_array = explode(",", $template);
|
205 |
+
$colors['color'] = $color_array[0];
|
206 |
+
$colors['bgcolor'] = $color_array[1];
|
207 |
+
$colors['borcolor'] = $color_array[2];
|
208 |
+
return $colors;
|
209 |
+
}
|
210 |
+
|
211 |
+
?>
|
lib/wfu_processfiles.php
ADDED
@@ -0,0 +1,462 @@
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|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ID ) {
|
7 |
+
$user_login = "guest";
|
8 |
+
$user_email = "";
|
9 |
+
$is_admin = false;
|
10 |
+
}
|
11 |
+
else {
|
12 |
+
$user_login = $user->user_login;
|
13 |
+
$user_email = $user->user_email;
|
14 |
+
$is_admin = current_user_can('manage_options');
|
15 |
+
}
|
16 |
+
|
17 |
+
$suppress_admin_messages = ( $params["adminmessages"] != "true" || !$is_admin );
|
18 |
+
$success_count = 0;
|
19 |
+
$warning_count = 0;
|
20 |
+
$error_count = 0;
|
21 |
+
$default_colors = wfu_prepare_message_colors(WFU_DEFAULTMESSAGECOLORS);
|
22 |
+
$notify_only_filename_list = "";
|
23 |
+
$notify_target_path_list = "";
|
24 |
+
$notify_attachment_list = "";
|
25 |
+
$uploadedfile = 'uploadedfile_'.$sid;
|
26 |
+
$hiddeninput = 'hiddeninput_'.$sid;
|
27 |
+
$allowed_patterns = explode(",",$params["uploadpatterns"]);
|
28 |
+
$userdata_fields = $params["userdata_fields"];
|
29 |
+
foreach ( $userdata_fields as $userdata_key => $userdata_field )
|
30 |
+
$userdata_fields[$userdata_key]["value"] = ( isset($_POST[$hiddeninput.'_userdata_'.$userdata_key]) ? $_POST[$hiddeninput.'_userdata_'.$userdata_key] : "" );
|
31 |
+
$params_output_array["version"] = "full";
|
32 |
+
$params_output_array["general"]['shortcode_id'] = $sid;
|
33 |
+
$params_output_array["general"]['unique_id'] = ( isset($_POST['unique_id']) ? $_POST['unique_id'] : "" );
|
34 |
+
$params_output_array["general"]['state'] = 0;
|
35 |
+
$params_output_array["general"]['files_count'] = 0;
|
36 |
+
$params_output_array["general"]['update_wpfilebase'] = "";
|
37 |
+
$params_output_array["general"]['redirect_link'] = "";
|
38 |
+
$params_output_array["general"]['upload_finish_time'] = 0;
|
39 |
+
$params_output_array["general"]['message'] = "";
|
40 |
+
$params_output_array["general"]['message_type'] = "";
|
41 |
+
$params_output_array["general"]['admin_messages']['wpfilebase'] = "";
|
42 |
+
$params_output_array["general"]['admin_messages']['notify'] = "";
|
43 |
+
$params_output_array["general"]['admin_messages']['redirect'] = "";
|
44 |
+
$params_output_array["general"]['admin_messages']['other'] = "";
|
45 |
+
$params_output_array["general"]['errors']['wpfilebase'] = "";
|
46 |
+
$params_output_array["general"]['errors']['notify'] = "";
|
47 |
+
$params_output_array["general"]['errors']['redirect'] = "";
|
48 |
+
$params_output_array["general"]['color'] = $default_colors['color'];
|
49 |
+
$params_output_array["general"]['bgcolor'] = $default_colors['bgcolor'];
|
50 |
+
$params_output_array["general"]['borcolor'] = $default_colors['borcolor'];
|
51 |
+
$params_output_array["general"]['notify_only_filename_list'] = "";
|
52 |
+
$params_output_array["general"]['notify_target_path_list'] = "";
|
53 |
+
$params_output_array["general"]['notify_attachment_list'] = "";
|
54 |
+
$params_output_array["general"]['fail_message'] = "";
|
55 |
+
$params_output_array["general"]['fail_admin_message'] = "";
|
56 |
+
/* safe_output is a minimized version of params_output_array, that is passed as text, in case JSON parse fails
|
57 |
+
its data are separated by semicolon (;) and are the following:
|
58 |
+
upload state: the upload state number
|
59 |
+
default colors: the default color, bgcolor and borcolor values, separated by comma(,)
|
60 |
+
file_count: the number of files processed
|
61 |
+
filedata: message type, header, message and admin message of each file, encoded and separated by comma (,) */
|
62 |
+
$params_output_array["general"]['safe_output'] = "";
|
63 |
+
|
64 |
+
/* adjust $uploadedfile variable (holding file data) if this is a redirection caused because the browser of the user could not handle AJAX upload */
|
65 |
+
if ( isset($_FILES[$uploadedfile.'_redirected']) ) $uploadedfile .= '_redirected';
|
66 |
+
/* notify admin if this is a redirection caused because the browser of the user could not handle AJAX upload */
|
67 |
+
$params_output_array["general"]['admin_messages']['other'] = $params['adminerrors'];
|
68 |
+
|
69 |
+
if ( isset($_FILES[$uploadedfile]['error']) ) {
|
70 |
+
$files_count = 1;
|
71 |
+
}
|
72 |
+
else $files_count = 0;
|
73 |
+
$params_output_array["general"]['files_count'] = $files_count;
|
74 |
+
|
75 |
+
/* append subfolder name to upload path */
|
76 |
+
if ( $params["askforsubfolders"] == "true" && $params['subdir_selection_index'] >= 0 ) {
|
77 |
+
if ( substr($params["uploadpath"], -1, 1) == "/" ) $params["uploadpath"] .= $params['subfoldersarray'][$params['subdir_selection_index']];
|
78 |
+
else $params["uploadpath"] .= '/'.$params['subfoldersarray'][$params['subdir_selection_index']];
|
79 |
+
}
|
80 |
+
|
81 |
+
if ( $files_count == 1 ) {
|
82 |
+
|
83 |
+
foreach ( $_FILES[$uploadedfile] as $key => $prop )
|
84 |
+
$fileprops[$key] = $prop;
|
85 |
+
|
86 |
+
$upload_path_ok = false;
|
87 |
+
$allowed_file_ok = false;
|
88 |
+
$size_file_ok = false;
|
89 |
+
$file_output['color'] = $default_colors['color'];
|
90 |
+
$file_output['bgcolor'] = $default_colors['bgcolor'];
|
91 |
+
$file_output['borcolor'] = $default_colors['borcolor'];
|
92 |
+
$file_output['header'] = "";
|
93 |
+
$file_output['message'] = "";
|
94 |
+
$file_output['message_type'] = "";
|
95 |
+
$file_output['admin_messages'] = "";
|
96 |
+
|
97 |
+
/* Get uploaded file size in Mbytes */
|
98 |
+
$upload_file_size = filesize($fileprops['tmp_name']) / 1024 / 1024;
|
99 |
+
|
100 |
+
if ( $upload_file_size > 0 ) {
|
101 |
+
|
102 |
+
/* Check if upload path exist */
|
103 |
+
if ( is_dir( wfu_upload_plugin_full_path($params) ) ) {
|
104 |
+
$upload_path_ok = true;
|
105 |
+
}
|
106 |
+
/* Attempt to create path if user has selected to do so */
|
107 |
+
else if ( $params["createpath"] == "true" ) {
|
108 |
+
$wfu_create_directory_ret = wfu_create_directory(wfu_upload_plugin_full_path($params), $params["accessmethod"], $params["ftpinfo"]);
|
109 |
+
if ( $wfu_create_directory_ret != "" ) {
|
110 |
+
$file_output['admin_messages'] = wfu_join_strings("<br />", $file_output['admin_messages'], $wfu_create_directory_ret);
|
111 |
+
}
|
112 |
+
if ( is_dir( wfu_upload_plugin_full_path($params) ) ) {
|
113 |
+
$upload_path_ok = true;
|
114 |
+
}
|
115 |
+
}
|
116 |
+
|
117 |
+
/* File name control */
|
118 |
+
foreach ($allowed_patterns as $allowed_pattern) {
|
119 |
+
if ( wfu_upload_plugin_wildcard_match( $allowed_pattern, $fileprops['name']) ) {
|
120 |
+
$allowed_file_ok = true;
|
121 |
+
break ;
|
122 |
+
}
|
123 |
+
}
|
124 |
+
|
125 |
+
/* File size control */
|
126 |
+
if ( $upload_file_size <= $params["maxsize"] ) {
|
127 |
+
$size_file_ok = true;
|
128 |
+
}
|
129 |
+
|
130 |
+
if ( !$upload_path_ok or !$allowed_file_ok or !$size_file_ok ) {
|
131 |
+
$file_output['message_type'] = "error";
|
132 |
+
$file_output['message'] = wfu_join_strings("<br />", $file_output['message'], WFU_ERROR_UPLOAD_FAILED);
|
133 |
+
|
134 |
+
if ( !$upload_path_ok ) $file_output['message'] = wfu_join_strings("<br />", $file_output['message'], WFU_ERROR_DIR_EXIST);
|
135 |
+
if ( !$allowed_file_ok ) $file_output['message'] = wfu_join_strings("<br />", $file_output['message'], WFU_ERROR_FILE_ALLOW);
|
136 |
+
if ( !$size_file_ok ) $file_output['message'] = wfu_join_strings("<br />", $file_output['message'], WFU_ERROR_FILE_PLUGIN_SIZE);
|
137 |
+
}
|
138 |
+
}
|
139 |
+
else {
|
140 |
+
// This block is executed when there is an error
|
141 |
+
$upload_error = $fileprops['error'];
|
142 |
+
if ( $upload_error == 1 ) {
|
143 |
+
$message_text = WFU_ERROR_FILE_PHP_SIZE;
|
144 |
+
$file_output['admin_messages'] = wfu_join_strings("<br />", $file_output['admin_messages'], WFU_ERROR_ADMIN_FILE_PHP_SIZE);
|
145 |
+
}
|
146 |
+
elseif ( $upload_error == 2 ) $message_text = WFU_ERROR_FILE_HTML_SIZE;
|
147 |
+
elseif ( $upload_error == 3 ) $message_text = WFU_ERROR_FILE_PARTIAL;
|
148 |
+
elseif ( $upload_error == 4 ) $message_text = WFU_ERROR_FILE_NOTHING;
|
149 |
+
elseif ( $upload_error == 6 ) $message_text = WFU_ERROR_DIR_NOTEMP;
|
150 |
+
elseif ( $upload_error == 7 ) $message_text = WFU_ERROR_FILE_WRITE;
|
151 |
+
elseif ( $upload_error == 8 ) $message_text = WFU_ERROR_UPLOAD_STOPPED;
|
152 |
+
else {
|
153 |
+
$upload_time_limit = ini_get("max_input_time");
|
154 |
+
$params_output_array["general"]['upload_finish_time'] = $params["upload_start_time"] + $upload_time_limit * 1000;
|
155 |
+
$message_text = WFU_ERROR_FILE_PHP_TIME;
|
156 |
+
$file_output['admin_messages'] = wfu_join_strings("<br />", $file_output['admin_messages'], WFU_ERROR_ADMIN_FILE_PHP_TIME);
|
157 |
+
}
|
158 |
+
$file_output['message_type'] = "error";
|
159 |
+
$file_output['message'] = wfu_join_strings("<br />", $file_output['message'], $message_text);
|
160 |
+
}
|
161 |
+
|
162 |
+
if ( $upload_path_ok and $allowed_file_ok and $size_file_ok ) {
|
163 |
+
|
164 |
+
if ( is_uploaded_file($fileprops['tmp_name']) ) {
|
165 |
+
$file_copied = false;
|
166 |
+
$message_processed = false;
|
167 |
+
$source_path = $fileprops['tmp_name'];
|
168 |
+
$only_filename = wfu_upload_plugin_clean( $fileprops['name'] );
|
169 |
+
$target_path = wfu_upload_plugin_full_path($params).$only_filename;
|
170 |
+
|
171 |
+
$search = array ('/%filename%/', '/%filepath%/');
|
172 |
+
$replace = array ($only_filename, $target_path);
|
173 |
+
$success_message = preg_replace($search, $replace, $params["successmessage"]);
|
174 |
+
|
175 |
+
if ($source_path) {
|
176 |
+
$file_exists = file_exists($target_path);
|
177 |
+
if ( !$file_exists || $params["dublicatespolicy"] == "" || $params["dublicatespolicy"] == "overwrite" ) {
|
178 |
+
//redirect echo in internal buffer to receive and process any unwanted warning messages from wfu_upload_file
|
179 |
+
ob_start();
|
180 |
+
ob_clean();
|
181 |
+
$wfu_upload_file_ret = wfu_upload_file($source_path, $target_path, $params["accessmethod"], $params["ftpinfo"]);
|
182 |
+
$file_copied = $wfu_upload_file_ret["uploaded"];
|
183 |
+
//process warning messages from wfu_upload_file
|
184 |
+
$echo_message = ob_get_contents();
|
185 |
+
//finish redirecting of echo to internal buffer
|
186 |
+
ob_end_clean();
|
187 |
+
if ( $echo_message != "" && !$file_copied ) {
|
188 |
+
$file_output['message_type'] = "error";
|
189 |
+
if ( stristr($echo_message, "warning") && stristr($echo_message, "permission denied") && stristr($echo_message, "unable to move") ) {
|
190 |
+
$file_output['message'] = wfu_join_strings("<br />", $file_output['message'], WFU_ERROR_DIR_PERMISSION);
|
191 |
+
$file_output['admin_messages'] = wfu_join_strings("<br />", $file_output['admin_messages'], WFU_ERROR_ADMIN_DIR_PERMISSION);
|
192 |
+
}
|
193 |
+
else {
|
194 |
+
$file_output['message'] = wfu_join_strings("<br />", $file_output['message'], WFU_ERROR_FILE_MOVE);
|
195 |
+
$file_output['admin_messages'] = wfu_join_strings("<br />", $file_output['admin_messages'], strip_tags($echo_message));
|
196 |
+
}
|
197 |
+
$message_processed = true;
|
198 |
+
}
|
199 |
+
if ( $wfu_upload_file_ret["admin_message"] != "" ) {
|
200 |
+
$file_output['admin_messages'] = wfu_join_strings("<br />", $file_output['admin_messages'], $wfu_upload_file_ret["admin_message"]);
|
201 |
+
}
|
202 |
+
}
|
203 |
+
else if ( $file_exists && $params["dublicatespolicy"] == "maintain both" ) {
|
204 |
+
$full_path = wfu_upload_plugin_full_path($params);
|
205 |
+
$name_part = $only_filename;
|
206 |
+
$ext_part = "";
|
207 |
+
$dot_pos = strrpos($name_part, ".");
|
208 |
+
if ( $dot_pos ) {
|
209 |
+
$ext_part = substr($name_part, $dot_pos);
|
210 |
+
$name_part = substr($name_part, 0, $dot_pos);
|
211 |
+
}
|
212 |
+
if ( $params["uniquepattern"] != "datetimestamp" ) {
|
213 |
+
$unique_id = 1;
|
214 |
+
do {
|
215 |
+
$unique_id += 1;
|
216 |
+
$only_filename = $name_part . "(" . $unique_id . ")" . $ext_part;
|
217 |
+
$target_path = $full_path . $only_filename;
|
218 |
+
}
|
219 |
+
while ( file_exists($target_path) );
|
220 |
+
}
|
221 |
+
else {
|
222 |
+
$current_datetime = gmdate("U") - 1;
|
223 |
+
do {
|
224 |
+
$current_datetime += 1;
|
225 |
+
$only_filename = $name_part . "-" . gmdate("YmdHis", $current_datetime) . $ext_part;
|
226 |
+
$target_path = $full_path . $only_filename;
|
227 |
+
}
|
228 |
+
while ( file_exists($target_path) );
|
229 |
+
}
|
230 |
+
//redirect echo in internal buffer to receive and process any unwanted warning messages from move_uploaded_file
|
231 |
+
ob_start();
|
232 |
+
ob_clean();
|
233 |
+
$wfu_upload_file_ret = wfu_upload_file($source_path, $target_path, $params["accessmethod"], $params["ftpinfo"]);
|
234 |
+
$file_copied = $wfu_upload_file_ret["uploaded"];
|
235 |
+
//process warning messages from move_uploaded_file
|
236 |
+
$echo_message = ob_get_contents();
|
237 |
+
if ( $echo_message != "" && !$file_copied ) {
|
238 |
+
$file_output['message_type'] = "error";
|
239 |
+
if ( stristr($echo_message, "warning") && stristr($echo_message, "permission denied") && stristr($echo_message, "unable to move") ) {
|
240 |
+
$file_output['message'] = wfu_join_strings("<br />", $file_output['message'], WFU_ERROR_DIR_PERMISSION);
|
241 |
+
$file_output['admin_messages'] = wfu_join_strings("<br />", $file_output['admin_messages'], WFU_ERROR_ADMIN_DIR_PERMISSION);
|
242 |
+
}
|
243 |
+
else {
|
244 |
+
$file_output['message'] = wfu_join_strings("<br />", $file_output['message'], WFU_ERROR_FILE_MOVE);
|
245 |
+
$file_output['admin_messages'] = wfu_join_strings("<br />n", $file_output['admin_messages'], strip_tags($echo_message));
|
246 |
+
}
|
247 |
+
$message_processed = true;
|
248 |
+
}
|
249 |
+
//finish redirecting of echo to internal buffer
|
250 |
+
ob_end_clean();
|
251 |
+
if ( $wfu_upload_file_ret["admin_message"] != "" ) {
|
252 |
+
$file_output['admin_messages'] = wfu_join_strings("<br />", $file_output['admin_messages'], $wfu_upload_file_ret["admin_message"]);
|
253 |
+
}
|
254 |
+
if ( $file_copied ) {
|
255 |
+
$file_output['message_type'] = "success";
|
256 |
+
$message_processed = true;
|
257 |
+
}
|
258 |
+
}
|
259 |
+
else {
|
260 |
+
$file_output['message_type'] = "error";
|
261 |
+
$file_output['message'] = wfu_join_strings("<br />", $file_output['message'], WFU_WARNING_FILE_EXISTS);
|
262 |
+
$message_processed = true;
|
263 |
+
$file_copied = false;
|
264 |
+
}
|
265 |
+
}
|
266 |
+
|
267 |
+
if ( $file_copied ) {
|
268 |
+
/* prepare email notification parameters if email notification is enabled */
|
269 |
+
if ( $params["notify"] == "true" ) {
|
270 |
+
$notify_only_filename_list .= ( $notify_only_filename_list == "" ? "" : ", " ).$only_filename;
|
271 |
+
$notify_target_path_list .= ( $notify_target_path_list == "" ? "" : ", " ).$target_path;
|
272 |
+
if ( $params["attachfile"] == "true" )
|
273 |
+
$notify_attachment_list .= ( $notify_attachment_list == "" ? "" : "," ).$target_path;
|
274 |
+
}
|
275 |
+
|
276 |
+
/* prepare redirect link if redirection is enabled */
|
277 |
+
if ( $params["redirect"] == "true" ) {
|
278 |
+
/* Define dynamic redirect link from variables */
|
279 |
+
$search = array ('/%filename%/');
|
280 |
+
$replace = array ($only_filename);
|
281 |
+
$params_output_array["general"]['redirect_link'] = trim(preg_replace($search, $replace, $params["redirectlink"]));
|
282 |
+
}
|
283 |
+
|
284 |
+
if ( !$message_processed ) {
|
285 |
+
$file_output['message_type'] = "success";
|
286 |
+
}
|
287 |
+
}
|
288 |
+
else if ( !$message_processed ) {
|
289 |
+
$file_output['message_type'] = "error";
|
290 |
+
$file_output['message'] = wfu_join_strings("<br />", $file_output['message'], WFU_ERROR_UNKNOWN);
|
291 |
+
}
|
292 |
+
|
293 |
+
/* Delete temporary file (in tmp directory) */
|
294 |
+
// unlink($source_path);
|
295 |
+
}
|
296 |
+
else {
|
297 |
+
$file_output['message_type'] = "error";
|
298 |
+
$file_output['message'] = wfu_join_strings("<br />", $file_output['message'], WFU_ERROR_UNKNOWN);
|
299 |
+
}
|
300 |
+
}
|
301 |
+
|
302 |
+
/* last check of output file status */
|
303 |
+
if ( $file_output['message_type'] == "" ) {
|
304 |
+
if ( $file_copied ) $file_output['message_type'] = "success";
|
305 |
+
else {
|
306 |
+
$file_output['message_type'] = "error";
|
307 |
+
$file_output['message'] = wfu_join_strings("<br />", $file_output['message'], WFU_ERROR_UNKNOWN);
|
308 |
+
}
|
309 |
+
}
|
310 |
+
|
311 |
+
/* suppress any admin messages if user is not administrator or adminmessages is not activated */
|
312 |
+
if ( $suppress_admin_messages ) $file_output['admin_messages'] = "";
|
313 |
+
|
314 |
+
/* set file status to "warning" if the file has been uploaded but there are messages */
|
315 |
+
if ( $file_output['message_type'] == "success" ) {
|
316 |
+
if ( $file_output['message'] != "" || $file_output['admin_messages'] != "" )
|
317 |
+
$file_output['message_type'] = "warning";
|
318 |
+
}
|
319 |
+
|
320 |
+
/* adjust message details and colors according to file result */
|
321 |
+
/* FileResult: A */
|
322 |
+
$search = array ('/%username%/', '/%useremail%/', '/%filename%/', '/%filepath%/');
|
323 |
+
$replace = array ($user_login, ( $user_email == "" ? "no email" : $user_email ), $only_filename, $target_path);
|
324 |
+
if ( $file_output['message_type'] == "success" ) {
|
325 |
+
$success_count ++;
|
326 |
+
$color_array = explode(",", $params['successmessagecolors']);
|
327 |
+
$file_output['color'] = $color_array[0];
|
328 |
+
$file_output['bgcolor'] = $color_array[1];
|
329 |
+
$file_output['borcolor'] = $color_array[2];
|
330 |
+
$file_output['header'] = preg_replace($search, $replace, WFU_SUCCESSMESSAGE);
|
331 |
+
/* prepare details of successful file upload, visible only to administrator */
|
332 |
+
$file_output['admin_messages'] = wfu_join_strings("<br />", preg_replace($search, $replace, WFU_SUCCESSMESSAGE_DETAILS), $file_output['admin_messages']);
|
333 |
+
}
|
334 |
+
/* FileResult: B */
|
335 |
+
elseif ( $file_output['message_type'] == "warning" ) {
|
336 |
+
$warning_count ++;
|
337 |
+
$color_array = explode(",", $params['warningmessagecolors']);
|
338 |
+
$file_output['color'] = $color_array[0];
|
339 |
+
$file_output['bgcolor'] = $color_array[1];
|
340 |
+
$file_output['borcolor'] = $color_array[2];
|
341 |
+
$file_output['header'] = preg_replace($search, $replace, WFU_WARNINGMESSAGE);
|
342 |
+
/* prepare and prepend details of successful file upload, visible only to administrator */
|
343 |
+
$file_output['admin_messages'] = wfu_join_strings("<br />", preg_replace($search, $replace, WFU_SUCCESSMESSAGE_DETAILS), $file_output['admin_messages']);
|
344 |
+
}
|
345 |
+
/* FileResult: C */
|
346 |
+
elseif ( $file_output['message_type'] == "error" ) {
|
347 |
+
$error_count ++;
|
348 |
+
$color_array = explode(",", $params['failmessagecolors']);
|
349 |
+
$file_output['color'] = $color_array[0];
|
350 |
+
$file_output['bgcolor'] = $color_array[1];
|
351 |
+
$file_output['borcolor'] = $color_array[2];
|
352 |
+
/* define variables that were not defined before due to error */
|
353 |
+
$only_filename = wfu_upload_plugin_clean( $fileprops['name'] );
|
354 |
+
$target_path = wfu_upload_plugin_full_path($params).$only_filename;
|
355 |
+
$replace = array ($user_login, ( $user_email == "" ? "no email" : $user_email ), $only_filename, $target_path);
|
356 |
+
$file_output['header'] = preg_replace($search, $replace, WFU_ERRORMESSAGE);
|
357 |
+
/* prepare and prepend details of failed file upload, visible only to administrator */
|
358 |
+
$file_output['admin_messages'] = wfu_join_strings("<br />", preg_replace($search, $replace, WFU_FAILMESSAGE_DETAILS), $file_output['admin_messages']);
|
359 |
+
}
|
360 |
+
|
361 |
+
/* suppress again any admin messages if user is not administrator or adminmessages is not activated */
|
362 |
+
if ( $suppress_admin_messages ) $file_output['admin_messages'] = "";
|
363 |
+
|
364 |
+
$params_output_array[0] = $file_output;
|
365 |
+
}
|
366 |
+
|
367 |
+
$somefiles_Ok = ( ( $warning_count + $success_count ) > 0 );
|
368 |
+
$allfiles_Ok = ( $somefiles_Ok && ( $error_count == 0 ) );
|
369 |
+
|
370 |
+
/* Prepare WPFileBase Plugin update url, if this option has been selected and only if at least one file has been successfully uploaded.
|
371 |
+
Execution will happen only if accumulated $params_output_array["general"]['update_wpfilebase'] is not empty */
|
372 |
+
if ( $params["filebaselink"] == "true" ) {
|
373 |
+
if ( $somefiles_Ok ) {
|
374 |
+
$filebaseurl = WP_SITEURL;
|
375 |
+
if ( substr($filebaseurl, -1, 1) == "/" ) $filebaseurl = substr($filebaseurl, 0, strlen($filebaseurl) - 1);
|
376 |
+
/* if the following variable is not empty, then WPFileBase Plugin update must be executed
|
377 |
+
and any admin messages must be suppressed */
|
378 |
+
$params_output_array["general"]['update_wpfilebase'] = $filebaseurl;
|
379 |
+
}
|
380 |
+
else {
|
381 |
+
$params_output_array["general"]['admin_messages']['wpfilebase'] = WFU_WARNING_WPFILEBASE_NOTUPDATED_NOFILES;
|
382 |
+
$params_output_array["general"]['errors']['wpfilebase'] = "error";
|
383 |
+
}
|
384 |
+
}
|
385 |
+
|
386 |
+
/* Prepare email notification parameters if email notification is enabled and only if at least one file has been successfully uploaded
|
387 |
+
if $method = "no-ajax" then send the email to the recipients
|
388 |
+
if $method = "ajax" then return the notification parameters to the handler for further processing
|
389 |
+
In case of ajax, execution will happen only if accumulated notify_only_filename_list is not empty */
|
390 |
+
if ( $params["notify"] == "true" ) {
|
391 |
+
/* verify that there are recipients */
|
392 |
+
$notifyrecipients = trim(preg_replace('/%useremail%/', $user_email, $params["notifyrecipients"]));
|
393 |
+
if ( $notifyrecipients != "" ) {
|
394 |
+
if ( $somefiles_Ok ) {
|
395 |
+
if ( $method == 'no_ajax' ) {
|
396 |
+
$send_error = wfu_send_notification_email($user, $notify_only_filename_list, $notify_target_path_list, $notify_attachment_list, $userdata_fields, $params);
|
397 |
+
if ( $send_error != "" ) {
|
398 |
+
$params_output_array["general"]['admin_messages']['notify'] = $send_error;
|
399 |
+
$params_output_array["general"]['errors']['notify'] = "error";
|
400 |
+
}
|
401 |
+
}
|
402 |
+
else {
|
403 |
+
/* if the following variable is not empty, then email notification must be sent
|
404 |
+
and any admin messages must be suppressed */
|
405 |
+
$params_output_array["general"]['notify_only_filename_list'] = $notify_only_filename_list;
|
406 |
+
$params_output_array["general"]['notify_target_path_list'] = $notify_target_path_list;
|
407 |
+
$params_output_array["general"]['notify_attachment_list'] = $notify_attachment_list;
|
408 |
+
}
|
409 |
+
}
|
410 |
+
else {
|
411 |
+
$params_output_array["general"]['admin_messages']['notify'] = WFU_WARNING_NOTIFY_NOTSENT_NOFILES;
|
412 |
+
$params_output_array["general"]['errors']['notify'] = "error";
|
413 |
+
}
|
414 |
+
}
|
415 |
+
else {
|
416 |
+
$params_output_array["general"]['admin_messages']['notify'] = WFU_WARNING_NOTIFY_NOTSENT_NORECIPIENTS;
|
417 |
+
$params_output_array["general"]['errors']['notify'] = "error";
|
418 |
+
}
|
419 |
+
}
|
420 |
+
|
421 |
+
/* Prepare redirect link if redirection is enabled and only if all files have been successfully uploaded
|
422 |
+
Execution will happen only if accumulated redirect_link is not empty and accumulated redirect errors are empty */
|
423 |
+
if ( $params["redirect"] == "true" ) {
|
424 |
+
if ( $params_output_array["general"]['redirect_link'] == "" ) {
|
425 |
+
$params_output_array["general"]['admin_messages']['redirect'] = WFU_WARNING_REDIRECT_NOTEXECUTED_EMPTY;
|
426 |
+
$params_output_array["general"]['errors']['redirect'] = "error";
|
427 |
+
}
|
428 |
+
elseif ( !$allfiles_Ok ) {
|
429 |
+
$params_output_array["general"]['admin_messages']['redirect'] = WFU_WARNING_REDIRECT_NOTEXECUTED_FILESFAILED;
|
430 |
+
$params_output_array["general"]['errors']['redirect'] = "error";
|
431 |
+
}
|
432 |
+
}
|
433 |
+
|
434 |
+
/* suppress any admin messages if user is not administrator or adminmessages is not activated */
|
435 |
+
if ( $suppress_admin_messages ) {
|
436 |
+
$params_output_array["general"]['admin_messages']['wpfilebase'] = "";
|
437 |
+
$params_output_array["general"]['admin_messages']['notify'] = "";
|
438 |
+
$params_output_array["general"]['admin_messages']['redirect'] = "";
|
439 |
+
$params_output_array["general"]['admin_messages']['other'] = "";
|
440 |
+
}
|
441 |
+
|
442 |
+
/* Calculate upload state from file results */
|
443 |
+
if ( $allfiles_Ok && ( $warning_count == 0 ) ) $params_output_array["general"]['state'] = 4;
|
444 |
+
else if ( $allfiles_Ok ) $params_output_array["general"]['state'] = 5;
|
445 |
+
else if ( $somefiles_Ok ) $params_output_array["general"]['state'] = 6; //only valid in no-ajax method
|
446 |
+
else if ( !$somefiles_Ok && $error_count > 0 ) $params_output_array["general"]['state'] = 7;
|
447 |
+
else $params_output_array["general"]['state'] = 8;
|
448 |
+
|
449 |
+
/* construct safe output */
|
450 |
+
$sout = $params_output_array["general"]['state'].";".WFU_DEFAULTMESSAGECOLORS.";".$files_count;
|
451 |
+
for ($i = 0; $i < $files_count; $i++) {
|
452 |
+
$sout .= ";".wfu_plugin_encode_string($file_output['message_type']);
|
453 |
+
$sout .= ",".wfu_plugin_encode_string($file_output['header']);
|
454 |
+
$sout .= ",".wfu_plugin_encode_string($file_output['message']);
|
455 |
+
$sout .= ",".wfu_plugin_encode_string($file_output['admin_messages']);
|
456 |
+
}
|
457 |
+
$params_output_array["general"]['safe_output'] = $sout;
|
458 |
+
|
459 |
+
return $params_output_array;
|
460 |
+
}
|
461 |
+
|
462 |
+
?>
|
readme.txt
ADDED
@@ -0,0 +1,459 @@
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â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
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
1 |
+
=== Wordpress File Upload ===
|
2 |
+
Contributors: nickboss
|
3 |
+
Donate link: http://www.iptanus.com/support/wordpress-file-upload
|
4 |
+
Tags: upload, upload file, upload files, multiple, multiple upload, multiple uploads, captcha, progress bar, form, ajax, directory, HTML5, filelist
|
5 |
+
Requires at least: 2.9.2
|
6 |
+
Tested up to: 3.7.1
|
7 |
+
Stable tag: "trunk"
|
8 |
+
License: GPLv2 or later
|
9 |
+
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
+
|
11 |
+
Simple yet powerful plugin to allow users to upload files to your website from any page
|
12 |
+
|
13 |
+
== Description ==
|
14 |
+
|
15 |
+
With this plugin you or other users can upload files to your site from any page by using shortcodes.
|
16 |
+
|
17 |
+
Simply put the shortcode [wordpress_file_upload] to the contents of any WordPress page and you will be able to upload files to any directory inside wp-contents of your WordPress site.
|
18 |
+
|
19 |
+
Please note that this plugin is the successor of **Inline Upload** plugin.
|
20 |
+
|
21 |
+
The characteristics of the plugin are:
|
22 |
+
|
23 |
+
* It does not use flash and handles uploads using various technologies (HTML5, AJAX, classic HTML forms) depending on browser's capabilities, which detects automatically. As a result it can work in any browser, including mobiles phones (even old ones).
|
24 |
+
* You can have more than one instances of the shortcode in the same page.
|
25 |
+
* It includes an overall upload progress bar.
|
26 |
+
* It supports localization.
|
27 |
+
* It integrates with WP-Filebase.
|
28 |
+
* It is highly customizable with many options.
|
29 |
+
* It produces notification messages and e-mails.
|
30 |
+
* You can create additional fields that the user must fill in along with the uploaded file.
|
31 |
+
* It supports redirection to another url after successful upload.
|
32 |
+
* You can create you shortcode very easily by using the included Shortcode Composer in the plugin's settings inside Dashboard.
|
33 |
+
|
34 |
+
Please note that old desktop browsers or mobile browsers may not support all of the above functionalities. In order to get full functionality use the latest versions browsers, supporting HTML5, AJAX and CSS3.
|
35 |
+
|
36 |
+
For additional features, such as multiple file upload, drag and drop of files, captcha and detailed upload progress bars please consider [Wordpress File Upload Professional](http://www.iptanus.com/support/wordpress-file-upload/ "Wordpress File Upload support page").
|
37 |
+
|
38 |
+
Please visit the **Other Notes** section for customization options of this plugin.
|
39 |
+
|
40 |
+
== Installation ==
|
41 |
+
|
42 |
+
1. First copy wordpress_file_upload directory inside wp-contents/plugins directory of your wordpress site.
|
43 |
+
1. Activate the plugin from Plugins menu of your Dashboard.
|
44 |
+
1. In order to use the plugin simply put the shortcode [wordpress_file_upload] in the contents of any page.
|
45 |
+
1. If you want more options, go to plugin Settings inside Dashboard, open Shortcode Composer and select the options you want. The composer generates the shortcode automatically. Copy and paste it to the page of your choice.
|
46 |
+
|
47 |
+
== Frequently Asked Questions ==
|
48 |
+
|
49 |
+
= Will the plugin work in a mobile browser? =
|
50 |
+
|
51 |
+
Yes, the plugins will work in most mobile phones (has been tested in iOS, Android and Symbian browsers as well as Opera Mobile)
|
52 |
+
|
53 |
+
= Do I need to have Flash to use then plugin? =
|
54 |
+
|
55 |
+
No, you do not need Flash to use the plugin.
|
56 |
+
|
57 |
+
= I get a SAFE MODE restriction error when I try to upload a file. Is there an alternative? =
|
58 |
+
|
59 |
+
Your domain has probably turned SAFE MODE ON and you have restrictions uploading and accessing files. Wordpress File Upload includes an alternative way to upload files, using FTP access. Simply add the attribute **accessmethod="ftp"** inside the shortcode, together with FTP access information in **ftpinfo** attribute.
|
60 |
+
|
61 |
+
= Can I see the progress of the upload? =
|
62 |
+
|
63 |
+
Yes, you can see the progress of the upload. During uploading a progress bar will appear showing progress info, however this functionality functions only in browsers supporting HTML5 upload progress bar.
|
64 |
+
|
65 |
+
= Can I upload many files at the same time? =
|
66 |
+
|
67 |
+
Yes, but not in the free version. If you want to allow multiple file uploads, please consider the [Professional](http://www.iptanus.com/support/wordpress-file-upload/ "Wordpress File Upload support page") version.
|
68 |
+
|
69 |
+
= Where do files go after upload? =
|
70 |
+
|
71 |
+
Files by default are uploaded inside wp-content directory of your Wordpress website. To change it use attribute uploadpath.
|
72 |
+
|
73 |
+
= Are there filters to restrict uploaded content? =
|
74 |
+
|
75 |
+
Yes, you can control allowed file size and file extensions by using the appropriate attribute (see Other Notes section).
|
76 |
+
|
77 |
+
= Who can upload files? =
|
78 |
+
|
79 |
+
By default only administrators can upload files. However you can define which user roles are allowed to upload files, beyond administrators. Even guests can be allowed to upload files, however use this option with care.
|
80 |
+
|
81 |
+
= What security is used for uploading files? =
|
82 |
+
|
83 |
+
The plugin is designed not to expose website information by using sessions. Parameters passing from server to client side are encoded. For higher protection, like use of captcha, please consider the [Professional](http://www.iptanus.com/support/wordpress-file-upload/ "Wordpress File Upload support page") version of the plugin.
|
84 |
+
|
85 |
+
== Screenshots ==
|
86 |
+
|
87 |
+
1. A screenshot of the plugin in its most simple form.
|
88 |
+
2. A screenshot of the plugin showing the progress bar.
|
89 |
+
3. A screenshot of the plugin showing the successful upload message.
|
90 |
+
4. A screenshot of the plugin with different placement.
|
91 |
+
5. A screenshot of the plugin with user fields.
|
92 |
+
|
93 |
+
== Changelog ==
|
94 |
+
|
95 |
+
= 2.0.1 =
|
96 |
+
This is the initial release of Wordpress File Upload. Since this plugin is the successor of Inline Upload, the whole changelog since the creation of the later is included.
|
97 |
+
|
98 |
+
* Name of the plugin changed to Wordpress File Upload.
|
99 |
+
* Plugin has been completely restructured to allow additional features.
|
100 |
+
* A new more advanced message box has been included showing information in a more structured way.
|
101 |
+
* Error detection and reporting has been improved.
|
102 |
+
* An administration page has been created in the Dashboard Settings, containing a Shortcode Composer.
|
103 |
+
* Some more options related to configuration of message showing upload results have been added.
|
104 |
+
* Several bug fixes.
|
105 |
+
|
106 |
+
= 1.7.14 =
|
107 |
+
* Userdata attribute changed to allow the creation of more fields and required ones.
|
108 |
+
* Spanish translation added thanks to Maria Ramos of WebHostingHub.
|
109 |
+
|
110 |
+
= 1.7.13 =
|
111 |
+
* Added notifyheaders attribute, in order to allow better control of notification email sent (e.g. allow to send HTML email).
|
112 |
+
|
113 |
+
= 1.7.12 =
|
114 |
+
* Added userdata attribute, in order to allow users to send additional text data along with the uploaded file.
|
115 |
+
|
116 |
+
= 1.7.11 =
|
117 |
+
* Added single button operation (file will be automatically uploaded when selected without pressing Upload Button).
|
118 |
+
|
119 |
+
= 1.7.10 =
|
120 |
+
* Fixed bug with functionality of attribute filebaselink for new versions of WP-Filebase plugin.
|
121 |
+
|
122 |
+
= 1.7.9 =
|
123 |
+
* Fixed problem with functionality of attribute filebaselink for new versions of WP-Filebase plugin.
|
124 |
+
|
125 |
+
= 1.7.8 =
|
126 |
+
* More than one roles can now be defined in attribute uploadrole, separated by comma (,).
|
127 |
+
|
128 |
+
= 1.7.7 =
|
129 |
+
* Variable %filename% now works also in redirectlink.
|
130 |
+
|
131 |
+
= 1.7.6 =
|
132 |
+
* Changes in ftp functionality, added useftpdomain attribute so that it can work with external ftp domains as well.
|
133 |
+
* Improvement of classic upload (used in IE or when setting forceclassic to true) messaging functionality.
|
134 |
+
* Minor bug fixes.
|
135 |
+
|
136 |
+
= 1.7.5 =
|
137 |
+
* Source modified so that it can work with Wordpress sites that are not installed in root.
|
138 |
+
* Added variable %blogid% for use with multi-site installations.
|
139 |
+
* Bug fixes related to showing of messages.
|
140 |
+
|
141 |
+
= 1.7.4 =
|
142 |
+
* Replacement of json2.js with another version.
|
143 |
+
|
144 |
+
= 1.7.3 =
|
145 |
+
* CSS style changes to resolve conflicts with various theme CSS styles.
|
146 |
+
|
147 |
+
= 1.7.2 =
|
148 |
+
* Added variable %useremail% used in notifyrecipients, notifysubject and notifymessage attributes.
|
149 |
+
|
150 |
+
= 1.7.1 =
|
151 |
+
* Added capability to upload files outside wp-content folder.
|
152 |
+
* Improved error reporting.
|
153 |
+
|
154 |
+
= 1.7 =
|
155 |
+
* Complete restructuring of plugin HTML code, in order to make it more configurable and customizable.
|
156 |
+
* Appearance of messages has been improved.
|
157 |
+
* Added option to put the plugin in testmode.
|
158 |
+
* Added option to configure the colors of success and fail messages.
|
159 |
+
* Added option to modify the dimensions of the individual objects of the plugin.
|
160 |
+
* Added option to change the placement of the individual objects of the plugin.
|
161 |
+
* Improved error reporting.
|
162 |
+
* Added localization for error messages.
|
163 |
+
* Minor bug fixes.
|
164 |
+
|
165 |
+
= 1.6.3 =
|
166 |
+
* Bug fixes to correct incompatibilities of the new ajax functionality when uploadrole is set to "all".
|
167 |
+
|
168 |
+
= 1.6.2 =
|
169 |
+
* Bug fixes to correct incompatibilities of the new ajax functionality with redirectlink, filebaselink and adminmessages.
|
170 |
+
|
171 |
+
= 1.6.1 =
|
172 |
+
* Correction of serious bug that prevented the normal operation of the plugin when the browser of the user supports HTML5 functionality.
|
173 |
+
* Tags added to the plugin Wordpress page.
|
174 |
+
|
175 |
+
= 1.6 =
|
176 |
+
* Major lifting of the whole code.
|
177 |
+
* Added ajax functionality so that file is uploaded without page reload (works in browsers supporting HTML5).
|
178 |
+
* Added upload progress bar (works in browsers supporting HTML5).
|
179 |
+
* Added option to allow user to select if wants to use the old form upload functionality.
|
180 |
+
* File will not be saved again if user presses the Refresh button (or F5) of the page.
|
181 |
+
* Translation strings updated.
|
182 |
+
* Bug fixes for problems when there are more than one instances of the plugin in a single page.
|
183 |
+
|
184 |
+
= 1.5 =
|
185 |
+
* Added option to notify user about upload directory.
|
186 |
+
* Added option to allow user to select a subfolder to upload the file.
|
187 |
+
|
188 |
+
= 1.4.1 =
|
189 |
+
* css corrections for bug fixes.
|
190 |
+
|
191 |
+
= 1.4 =
|
192 |
+
* Added option to attach uploaded file to notification email.
|
193 |
+
* Added option to customize message on successfull upload (variables %filename% and %filepath% can be used).
|
194 |
+
* Added option to customize color of message on successfull upload.
|
195 |
+
* "C:\fakepath\" problem resolved.
|
196 |
+
* warning message about function create_directory() resolved.
|
197 |
+
* css enhancements for compatibility with more themes.
|
198 |
+
|
199 |
+
= 1.3 =
|
200 |
+
* Additional variables added (%filename% and %filepath%).
|
201 |
+
* All variables can be used inside message subject and message text.
|
202 |
+
* Added option to determine how to treat dublicates (overwrite existing file, leave existing file, leave both).
|
203 |
+
* Added option to determine how to rename the uploaded file, when another file already exists in the target directory.
|
204 |
+
* Added option to create directories and upload files using ftp access, in order to overcome file owner and SAFE MODE restrictions.
|
205 |
+
* Added the capability to redirect to another web page when a file is uploaded successfully.
|
206 |
+
* Added the option to show to administrators additional messages about upload errors.
|
207 |
+
* Bug fixes related to interoperability with WP_Filebase
|
208 |
+
|
209 |
+
= 1.2 =
|
210 |
+
* Added notification by email when a file is uploaded.
|
211 |
+
* Added the ability to upload to a variable folder, based on the name of the user currently logged in.
|
212 |
+
|
213 |
+
= 1.1 =
|
214 |
+
Added the option to allow anyone to upload files, by setting the attribute uploadrole to "all".
|
215 |
+
|
216 |
+
= 1.0 =
|
217 |
+
Initial version.
|
218 |
+
|
219 |
+
== Upgrade Notice ==
|
220 |
+
|
221 |
+
= 2.0.1 =
|
222 |
+
Optional upgrade to add new features.
|
223 |
+
|
224 |
+
= 1.7.14 =
|
225 |
+
Optional upgrade to add new features.
|
226 |
+
|
227 |
+
= 1.7.13 =
|
228 |
+
Optional upgrade to add new features.
|
229 |
+
|
230 |
+
= 1.7.12 =
|
231 |
+
Optional upgrade to add new features.
|
232 |
+
|
233 |
+
= 1.7.11 =
|
234 |
+
Optional upgrade to add new features.
|
235 |
+
|
236 |
+
= 1.7.10 =
|
237 |
+
Important upgrade to correct bug with filebaselink attribute functionality.
|
238 |
+
|
239 |
+
= 1.7.9 =
|
240 |
+
Important upgrade to resolve issue with filebaselink attribute functionality.
|
241 |
+
|
242 |
+
= 1.7.8 =
|
243 |
+
Optional upgrade to add new features.
|
244 |
+
|
245 |
+
= 1.7.7 =
|
246 |
+
Optional upgrade to add new features.
|
247 |
+
|
248 |
+
= 1.7.6 =
|
249 |
+
Optional upgrade to add new features and make minor bug fixes.
|
250 |
+
|
251 |
+
= 1.7.5 =
|
252 |
+
Important upgrade to resolve issues with Wordpress sites not installed in root.
|
253 |
+
|
254 |
+
= 1.7.4 =
|
255 |
+
Important upgrade to resolve issues with json2 functionality.
|
256 |
+
|
257 |
+
= 1.7.3 =
|
258 |
+
Important upgrade to resolve issues with style incompatibilities.
|
259 |
+
|
260 |
+
= 1.7.2 =
|
261 |
+
Optional upgrade to add new features, related to variables.
|
262 |
+
|
263 |
+
= 1.7.1 =
|
264 |
+
Optional upgrade to add new features, related to uploadpath and error reporting.
|
265 |
+
|
266 |
+
= 1.7 =
|
267 |
+
Optional upgrade to add new features, related to appearance of the plugin and error reporting.
|
268 |
+
|
269 |
+
= 1.6.3 =
|
270 |
+
Important upgrade to correct bugs that prevented normal operation of the plugins in some cases.
|
271 |
+
|
272 |
+
= 1.6.2 =
|
273 |
+
Important upgrade to correct bugs that prevented normal operation of the plugins in some cases.
|
274 |
+
|
275 |
+
= 1.6.1 =
|
276 |
+
Important upgrade to correct bug that prevented normal operation of the plugins in some cases.
|
277 |
+
|
278 |
+
= 1.6 =
|
279 |
+
Optional upgrade to add new features, related to ajax functionality and minor bug fixes.
|
280 |
+
|
281 |
+
= 1.5 =
|
282 |
+
Optional upgrade to add new features, related to subfolders.
|
283 |
+
|
284 |
+
= 1.4.1 =
|
285 |
+
Important upgrade to correct a css problem with Firefox.
|
286 |
+
|
287 |
+
= 1.4 =
|
288 |
+
Important upgrade that introduces some bug fixes and some new capabilities.
|
289 |
+
|
290 |
+
= 1.3 =
|
291 |
+
Important upgrade that introduces some bug fixes and a lot of new capabilities.
|
292 |
+
|
293 |
+
= 1.2 =
|
294 |
+
Optional upgrade in order to set additional capabilities.
|
295 |
+
|
296 |
+
= 1.1 =
|
297 |
+
Optional upgrade in order to set additional capabilities.
|
298 |
+
|
299 |
+
= 1.0 =
|
300 |
+
Initial version.
|
301 |
+
|
302 |
+
== Attributes ==
|
303 |
+
|
304 |
+
The easiest way to use the plugin is to put the shortcode [wordpress_file_upload] in the page. In this case, the plugin will use the default functionality.
|
305 |
+
|
306 |
+
If you want to customize the plugin (define the upload path, use file filter, change title and button text etc.) then you can use attributes. Go to Dashboard / Settings / Wordpress File Upload and then press Shortcode Composer. By selecting the attributes of your choice, the shortcode will be automatically generated. Then you can copy and paste it in any page.
|
307 |
+
|
308 |
+
A detailed list of attributes, together with instructions is shown below:
|
309 |
+
|
310 |
+
**General Options**
|
311 |
+
|
312 |
+
*Basic Functionalities*
|
313 |
+
|
314 |
+
* **uploadid:** This is the ID of every instance of the plugin inside the same page. Valid values are 1,2,3... Please use a different value for every instance.
|
315 |
+
* **singlebutton:** If this attribute is set to "true", only Upload Button will be shown and file will be automatically uploaded when selected. Default value is "false".
|
316 |
+
* **uploadpath:** This is the path of the upload directory. The path must be relative to wp-content folder of your Wordpress website. For instance, if your upload directory is "wp-content/uploads/myuploaddir", then uploadpath must have the value "uploads/myuploaddir". The default value is "uploads", meaning that the files will be uploaded to wp-content/uploads dir. If you put the variable "%username%" inside the uploadpath string, then this variable will be replaced by the username of the user currently logged in. If you want to upload files outside wp-content folder, then put a double dot (..) at the beginning of your uploadpath value.
|
317 |
+
|
318 |
+
*Filters*
|
319 |
+
|
320 |
+
* **uploadrole:** This is the roles that are allowed to upload files. Default role is "administrator". If you use other roles, like "editor", then only users of this role and also of role "administrator" will be able to upload files. You can set multiple roles, separated by comma, e.g. "editor, author". If you set uploadrole to "all" then all users, even guests, will be able to upload files.
|
321 |
+
* **uploadpatterns:** This is the filter of the uploaded files. Default value is "*.*", meaning that all files can be uploaded. Use this attribute to restrict the types of files that can be uploaded. For instance, in order to upload only pdf files put "\*.pdf". You can use more that one filters, separated by comma, for instance "\*.pdf,\*.doc".
|
322 |
+
* **maxsize:** This is the maximum size in MBytes of the uploaded files. Use this attribute to restrict the upload of files larger that this value. Default value is "10", meaning that you cannot upload files larger than 10MBytes.
|
323 |
+
|
324 |
+
*Upload Path and Files*
|
325 |
+
|
326 |
+
* **createpath:** If this attribute is set to "true", the upload directory, defined by uploadpath, will be created in case it does not exist. Default value is "false".
|
327 |
+
* **accessmethod:** This attributes defines the method to create directories and upload files. Default value is "normal". If it is set to "ftp", then the plugin will attempt to create directories and upload files using ftp access. In order to do this, the attribute *ftpinfo* must also be filled with valid ftp access information. Use this attribute when you cannot upload files, access uploaded files or cannot copy or delete uploaded files because of SAFE MODE restrictions, or because the owner of the file is the domain administrator.
|
328 |
+
* **ftpinfo:** This attribute defines the ftp access information. It has the syntax *username:password@domain*. If username, password or domain contains the characters (:) or (@), then replace them with (\\:) and (\\@) in order to avoid misreading of the attribute.
|
329 |
+
* **useftpdomain:** This attribute is used when the ftp domain used to upload files is in different domain than Wordpress installation. If it is set to "true" (and also uploadmethod is "ftp"), then the domain that will be used to upload files will be the one defined in ftpinfo attribute. Default value is "false".
|
330 |
+
* **showtargetfolder:** This attribute defines if a message with the upload directory will be shown. Default value is "false".
|
331 |
+
* **askforsubfolders:** This attribute defines if the user can select a subfolder to upload the file. Default value is "false". If set to "true", then the user is able to select a subfolder of the path, defined by the attribute *uploadpath*, to upload a file through a drop down list. This attributed is used together with attribute *subfoldertree*, which defines the subfolders.
|
332 |
+
* **subfoldertree:** This attribute defines the structure of the subfolders that the user can select to upload a file. Default value is "". The format of this attribute is as follows: the subfolders are separated by commas (,), e.g. "subfolder1, subfolder2". It is possible to use nested subfolders (a folder inside another folder). To do this place stars (*) before the name of the subfolder. The number of stars determines nesting level, e.g. "subfolder1, *nested1, *nested2, **nested3". Please note that the first subfolder must be the name of the folder defined by attribute *uploadpath* (only the last part) without any stars, while all the next subfolders must have at least one star. The user has also the capability to use a different name (from the actual subfolder name) to be shown in the drop down list for every subfolder, by separating the actual and shown name using the slash (/) symbol, e.g. "subfolder1, *subfolder2/shownname2, *subfolder3/shownname3".
|
333 |
+
* **dublicatespolicy:** This attribute defines what to do when the upload file has the same name with another file inside target directory. If it is set to "overwrite" then the upload file will replace the existing file. If it is set to "reject" then the upload operation will be cancelled. If it is set to "maintain both" then the upload file will be saved inside the target directory with another name, in order to keep both files. Default value is "overwrite".
|
334 |
+
* **uniquepattern:** This attribute defines how to save the upload file when a file with the same name already exists inside the target directory. If it is set to "index" then the upload file will be saved with a numeric suffix, like (1), (2) etc. in order to keep the name of the uploaded file unique. If it is set to "datetimestamp", then the suffix will be an encoded datetime of the upload operation. The plugin ensures that the name of the uploaded file will be unique, in order to avoid accidental replacement of existing files. Default value is "index".
|
335 |
+
|
336 |
+
*Redirection*
|
337 |
+
|
338 |
+
* **redirect:** This attribute defines if the user will be redirected to another web page when the file is uploaded successfully. Default value is "false".
|
339 |
+
* **redirectlink:** This attribute defines the url of the redirection page. Please use the prefix "http://" if the redirection page is in another domain, otherwise the server will assume that the url is relative to the server path.
|
340 |
+
|
341 |
+
*Other Administrator Options*
|
342 |
+
* **adminmessages:** This attribute offers the option to administrator users to receive additional information about upload errors. These messages will be visible only to administrators. Default value is "false".
|
343 |
+
* **forceclassic:** This attribute defines if the plugin will use the old classic functionality to upload files (using forms) or ajax functionality (supported in HTML5). Default value is "false". Please note that if your browser does not support HTML ajax functionality, then the plugin will automatically switch to classic one.
|
344 |
+
* **testmode:** This attribute defines if the plugin will be shown in test mode. Default value is "false". If it is set to "true", then the plugin will obtain a "dummy" functionality (it will not be able to upload files) and it will appear showing all of its objects (the selection of subfolders, progress bar, a test message), while the buttons will show a "Test Mode" message when pressed. This option can be used to configure the dimensions of the individual objects of the plugin more easily.
|
345 |
+
|
346 |
+
**Placements**
|
347 |
+
|
348 |
+
*Plugin Component Positions*
|
349 |
+
|
350 |
+
* **placements:** This attribute can be used to change the placement of the objects of the plugin. Default value is "title/filename+selectbutton+uploadbutton/subfolders/userdata/progressbar/message". Every line is separated by a slash (/). To put more than one objects to the same line, separate them with a plus (+). The name of every object is shown below.
|
351 |
+
|
352 |
+
**Labels**
|
353 |
+
|
354 |
+
*Title*
|
355 |
+
|
356 |
+
* **uploadtitle:** The title of the plugin. Default value is "Upload a file".
|
357 |
+
|
358 |
+
*Buttons*
|
359 |
+
|
360 |
+
* **selectbutton:** The title of the select button. Default value is "Select File".
|
361 |
+
* **uploadbutton:** The title of the upload button. Default value is "Upload File".
|
362 |
+
|
363 |
+
*Upload Folder*
|
364 |
+
|
365 |
+
* **targetfolderlabel:** This attribute defines the text for the message for the upload directory. Default value is "Upload Directory".
|
366 |
+
|
367 |
+
*Upload Messages*
|
368 |
+
|
369 |
+
* **successmessage:** This attribute defines the message to be shown upon successful upload. Default value is "File %filename% uploaded successfully". You can use the variables %filename% and %filepath% inside the message, as explained below.
|
370 |
+
* **warningmessage:** This attribute defines the message to be shown upon successful upload but with warnings. Default value is "File %filename% uploaded successfully but with warnings". You can use the variables %filename% and %filepath% inside the message, as explained below.
|
371 |
+
* **errormessage:** This attribute defines the message to be shown upon upload failure. Default value is "File %filename% not uploaded". You can use the variables %filename% and %filepath% inside the message, as explained below.
|
372 |
+
* **waitmessage:** This attribute defines the message to be shown while uploading. Default value is "File %filename% is being uploaded". You can use the variables %filename% and %filepath% inside the message, as explained below.
|
373 |
+
|
374 |
+
**Notifications**
|
375 |
+
|
376 |
+
*Email Notifications*
|
377 |
+
|
378 |
+
* **notify:** If this attribute is set to "true", then an email will be sent to the addresses defined by the attribute *notifyrecipients* to inform them that a new file has been uploaded.
|
379 |
+
* **notifyrecipients:** This attribute defines the list of email addresses to receive the notification message that a new file has been uploaded. More that one address can be defined, separated by comma (,). You can use variables inside this attribute, as explained below.
|
380 |
+
* **notifyheaders:** This attribute defines additional headers to be included in the notification email (e.g. set "From", "Cc" and "Bcc" parameters or use HTML code instead of text). Default value is "". For example, in order to send HTML email please set this attribute to "Content-type: text/html".
|
381 |
+
* **notifysubject:** This attribute defines the subject for the notification message. Default value is "File Upload Notification". You can use variables inside this attribute, as explained below.
|
382 |
+
* **notifymessage:** This attribute defines the body text for the notification message. Default value is "Dear Recipient, this is an automatic delivery message to notify you that a new file has been uploaded. Best Regards". You can use variables inside this attribute, as explained below.
|
383 |
+
* **attachfile:** This attribute defines if the uploaded file will be attached to the notification email. Default value is "false".
|
384 |
+
|
385 |
+
**Colors**
|
386 |
+
|
387 |
+
*Upload Message Colors*
|
388 |
+
|
389 |
+
* **successmessagecolor:** This attribute defines the color of the message shown upon successful upload. Default value is "green". This attribute is no longer used but is maintained for backward compatibility. Please use successmessagecolors instead.
|
390 |
+
* **successmessagecolors:** This attribute defines the colors of the message shown upon successful upload. Default value is "#006600,#EEFFEE,#006666". The first value is the text color, the second the background color and the third the border color.
|
391 |
+
* **warningmessagecolors:** This attribute defines the colors of the message shown upon successful upload but with warnings. Default value is "#F88017,#FEF2E7,#633309". The first value is the text color, the second the background color and the third the border color.
|
392 |
+
* **failmessagecolors:** This attribute defines the colors of the message shown upon upload failure. Default value is "#660000,#FFEEEE,#666600". The first value is the text color, the second the background color and the third the border color.
|
393 |
+
* **waitmessagecolors:** This attribute defines the colors of the message shown while file uploading. Default value is "#666666,#EEEEEE,#333333". The first value is the text color, the second the background color and the third the border color.
|
394 |
+
|
395 |
+
**Dimensions**
|
396 |
+
|
397 |
+
*Plugin Component Widths*
|
398 |
+
|
399 |
+
* **widths:** This attribute can be used to define the width of every individual object of the plugin. Default value is "". To define the width of an individual object, simply put the name of the object and the width, separated by the (:) character (e.g. "title:100px"). To define more than one objects separate them with comma (,).
|
400 |
+
|
401 |
+
*Plugin Component Heights*
|
402 |
+
|
403 |
+
* **heights:** This attribute can be used to define the height of every individual object of the plugin. Default value is "". To define the height of an individual object, simply put the name of the object and the height, separated by the (:) character (e.g. "title:20px"). To define more than one objects separate them with comma (,).
|
404 |
+
|
405 |
+
**Additional Fields**
|
406 |
+
|
407 |
+
*Additional Data Fields*
|
408 |
+
|
409 |
+
* **userdata:** This attribute defines if additional text information will be requested by the user. If set to "true", then an additional textbox will appear, prompting the user to put text data. These data will be sent to email recipients, if email notification has been activated and %userdata% variable exists inside notifymessage attribute. Default value is "false".
|
410 |
+
* **userdatalabel:** This attribute defines the labels of the userdata fields. Separate each field with slash "/". If you want a field to be required, then preceed an asterisk (*) before the label. Example to create 2 fields, an optional Name and a required Email field: userdatalabel="Name/*Email (required)". Default value is "Your message".
|
411 |
+
|
412 |
+
**Interoperability**
|
413 |
+
|
414 |
+
*Connection With Other Plugins*
|
415 |
+
|
416 |
+
* **filebaselink:** This attribute defines if this plugin will be linked to wp-filebase plugin. Wp-filebase is another plugin with which you can upload files and then show them in your pages in a customizable way. If you set this attribute to "true", then you can upload files inside wp-filebase directories using wordpress_file_upload and then update the databases of wp-filebase, so that it is informed about the new uploads. The default value is "false". Please note that this attribute does not check to see if wp-filebase is installed and active, so be sure to have wp-filebase active if you want to use it.
|
417 |
+
|
418 |
+
You can use any of these attributes to customize the plugin. The way to use these attributes is the following:
|
419 |
+
|
420 |
+
`
|
421 |
+
[wordpress_file_upload attribute1=value1 attribute2=value2]
|
422 |
+
`
|
423 |
+
|
424 |
+
Here are some examples:
|
425 |
+
|
426 |
+
`
|
427 |
+
[wordpress_file_upload uploadtitle="Upload files to the Upload dir"]
|
428 |
+
[wordpress_file_upload uploadtitle="Upload files to the Upload dir" uploadpath="uploads/myuploaddir"]
|
429 |
+
[wordpress_file_upload uploadid="1" uploadpath="../myuploaddir"]
|
430 |
+
[wordpress_file_upload uploadpath="uploads/users/%username%" createpath="true"]
|
431 |
+
[wordpress_file_upload uploadpath="uploads/myuploaddir" notify="true" notifyrecipients="name1@address1.com, name2@address2.com"]
|
432 |
+
[wordpress_file_upload uploadpath="/uploads/myuploaddir" askforsubfolders="true" subfoldertree="myuploaddir/My Upload Directory,*subfolder1/Subfolder1 Inside myuploaddir,**inner/2nd Level Nested Dir, *reports/Reports"]
|
433 |
+
[wordpress_file_upload uploadrole="all" uploadpath="/uploads/filebase/%username%" createpath="false" notify="true" notifyrecipients="myname@domain.com" notifysubject="A new file has been uploaded!" attachfile="true" askforsubfolders="true" subfoldertree="admin/Administrator,*root/Root Folder,**inner, *reports/Reports" filebaselink="true" widths="filename:150px, selectbutton:80px, uploadbutton:80px, progressbar:220px, message:368px, subfolders_label:100px, subfolders_select:125px" placements="title/filename+subfolders/selectbutton+uploadbutton+progressbar/message"]
|
434 |
+
[wordpress_file_upload uploadpath="uploads/myuploaddir" notify="true" notifyrecipients="name1@address1.com, name2@address2.com" notifymessage="File %filename% has been received, together with fields Name:%userdata0%, Email:%userdata1%" userdata="true" userdatalabel="Name/*Email (required)"]
|
435 |
+
[wordpress_file_upload uploadpath="uploads/myuploaddir" notify="true" notifyrecipients="name1@address1.com, name2@address2.com" notifymessage="This is a test HTML message body.<br/><br/>This word is <em>italic</em> and this is <strong>bold</strong>." notifyheaders="Content-type: text/html"]
|
436 |
+
`
|
437 |
+
|
438 |
+
== Variables ==
|
439 |
+
|
440 |
+
From version 1.2 variables are supported inside attributes.
|
441 |
+
|
442 |
+
A variable is a string surrounded by percent characters, in the form *%variable_name%*. This variable is replaced by another string whenever the plugin is executed.
|
443 |
+
|
444 |
+
For instance, if the variable %username% is used inside *uploadpath* attribute, then it will be replaced by the username of the user who is currently logged in every time a file is uploaded. By this way, every user can upload files to a separate folder, without any additional programming.
|
445 |
+
|
446 |
+
For the time being, the following variables are supported:
|
447 |
+
|
448 |
+
* **%username%:** Is replaced by the username of the current user. Can be used inside attributes *uploadpath*, *notifysubject* and *notifymessage*.
|
449 |
+
* **%useremail%:** Is replaced by the email of the current user. Can be used inside attributes *notifyrecipients*, *notifysubject* and *notifymessage*.
|
450 |
+
* **%filename%:** Is replaced by the filename (not including path information) of the uploaded file. Can be used inside attributes *notifysubject*, *notifymessage*, *successmessage* and *redirectlink*.
|
451 |
+
* **%filepath%:** Is replaced by the filepath (full path and filename) of the uploaded file. Can be used inside attributes *notifysubject*, *notifymessage* and *successmessage*.
|
452 |
+
* **%blogid%:** Is replaced by the blog_id of the current site. Can be used inside attribute *uploadpath*.
|
453 |
+
* **%userdataXXX%:** Is replaced by the additional message that the user has sent together with the file upload. XXX is the number of the field (starting from 0). The shortcode attribute userdata must have been set to "true". Can be used inside attributes *notifysubject*, *notifymessage*.
|
454 |
+
* **%n%:** Denotes change of line (equivalent of \n). Can be used inside attribute *notifymessage*. It exists because of problems of using \n inside the classic page editor of Wordpress.
|
455 |
+
|
456 |
+
== Requirements ==
|
457 |
+
|
458 |
+
The plugin requires to have Javascript enabled in your browser. For Internet Explorer you also need to have Active-X enabled.
|
459 |
+
Please note that old desktop browsers or mobile browsers may not support all of the plugin's features. In order to get full functionality use the latest versions of browsers, supporting HTML5, AJAX and CSS3.
|
screenshot-1.jpg
ADDED
Binary file
|
screenshot-2.jpg
ADDED
Binary file
|
screenshot-3.jpg
ADDED
Binary file
|
screenshot-4.jpg
ADDED
Binary file
|
screenshot-5.jpg
ADDED
Binary file
|
wfu_response.php
ADDED
@@ -0,0 +1,20 @@
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
1 |
+
<?php
|
2 |
+
/*
|
3 |
+
This script runs every time the user presses the upload button in order to inform the page that
|
4 |
+
it should process the file upload data (stored in $_FILES variable) when the page reloads
|
5 |
+
*/
|
6 |
+
session_start();
|
7 |
+
|
8 |
+
if ( isset($_GET['shortcode_id']) && isset($_GET['session_token']) ) {
|
9 |
+
//check referer using server sessions to avoid CSRF attacks
|
10 |
+
if ( $_SESSION["wfu_token_".$_GET['shortcode_id']] != $_GET['session_token'] ) die();
|
11 |
+
|
12 |
+
if ( isset($_GET['start_time']) ) {
|
13 |
+
$_SESSION['wfu_check_refresh_'.$_GET['shortcode_id']] = 'form button pressed';
|
14 |
+
$_SESSION['wfu_start_time_'.$_GET['shortcode_id']] = $_GET['start_time'];
|
15 |
+
|
16 |
+
die("success:");
|
17 |
+
}
|
18 |
+
}
|
19 |
+
die();
|
20 |
+
?>
|
wordpress_file_upload.php
ADDED
@@ -0,0 +1,279 @@
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
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
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
1 |
+
<?php
|
2 |
+
session_start();
|
3 |
+
/*
|
4 |
+
Plugin Name: Wordpress File Upload
|
5 |
+
Plugin URI: http://www.iptanus.com/support/wordpress-file-upload
|
6 |
+
Description: Simple interface to upload files from a page.
|
7 |
+
Version: 2.0.1
|
8 |
+
Author: Nickolas Bossinas
|
9 |
+
Author URI: http://www.iptanus.com
|
10 |
+
*/
|
11 |
+
|
12 |
+
/*
|
13 |
+
Wordpress File Upload (Wordpress Plugin)
|
14 |
+
Copyright (C) 2010, 2011, 2012, 2013 Nickolas Bossinas
|
15 |
+
Contact me at http://www.iptanus.com
|
16 |
+
|
17 |
+
This program is free software: you can redistribute it and/or modify
|
18 |
+
it under the terms of the GNU General Public License as published by
|
19 |
+
the Free Software Foundation, either version 3 of the License, or
|
20 |
+
(at your option) any later version.
|
21 |
+
|
22 |
+
This program is distributed in the hope that it will be useful,
|
23 |
+
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
24 |
+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
25 |
+
GNU General Public License for more details.
|
26 |
+
|
27 |
+
You should have received a copy of the GNU General Public License
|
28 |
+
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
29 |
+
*/
|
30 |
+
|
31 |
+
/* do not load plugin if this is the login page */
|
32 |
+
global $pagenow;
|
33 |
+
if ( 'wp-login.php' == $pagenow ) return;
|
34 |
+
|
35 |
+
DEFINE("WPFILEUPLOAD_DIR", '/'.PLUGINDIR .'/'.dirname(plugin_basename (__FILE__)).'/');
|
36 |
+
add_shortcode("wordpress_file_upload", "wordpress_file_upload_handler");
|
37 |
+
load_plugin_textdomain('wordpress-file-upload', false, dirname(plugin_basename (__FILE__)).'/languages');
|
38 |
+
/* do not load styles and scripts in admin pages */
|
39 |
+
if ( is_admin() ) {
|
40 |
+
if ( $pagenow == "options-general.php" ) {
|
41 |
+
wp_enqueue_style('wordpress-file-upload-admin-style', WPFILEUPLOAD_DIR.'css/wordpress_file_upload_adminstyle.css',false,'1.0','all');
|
42 |
+
wp_enqueue_style( 'wp-color-picker' );
|
43 |
+
wp_enqueue_script('wordpress_file_upload_admin_script', WPFILEUPLOAD_DIR.'js/wordpress_file_upload_adminfunctions.js', array( 'wp-color-picker' ), false, true);
|
44 |
+
wp_enqueue_script('wordpress_file_upload_admin_script', WPFILEUPLOAD_DIR.'js/getElementsByClassName-1.0.1.js');
|
45 |
+
}
|
46 |
+
}
|
47 |
+
else {
|
48 |
+
wp_enqueue_style('wordpress-file-upload-reset', WPFILEUPLOAD_DIR.'css/wordpress_file_upload_reset.css',false,'1.0','all');
|
49 |
+
wp_enqueue_style('wordpress-file-upload-style', WPFILEUPLOAD_DIR.'css/wordpress_file_upload_style.css',false,'1.0','all');
|
50 |
+
wp_enqueue_style('wordpress-file-upload-style-safe', WPFILEUPLOAD_DIR.'css/wordpress_file_upload_style_safe.css',false,'1.0','all');
|
51 |
+
wp_enqueue_script('json_class', WPFILEUPLOAD_DIR.'js/json2.js');
|
52 |
+
wp_enqueue_script('wordpress_file_upload_script', WPFILEUPLOAD_DIR.'js/wordpress_file_upload_functions.js');
|
53 |
+
}
|
54 |
+
add_action('admin_menu', 'wordpress_file_upload_add_admin_pages');
|
55 |
+
add_action('wp_ajax_wfu_ajax_action', 'wfu_ajax_action_callback');
|
56 |
+
add_action('wp_ajax_nopriv_wfu_ajax_action', 'wfu_ajax_action_callback');
|
57 |
+
add_action('wp_ajax_wfu_ajax_action_send_email_notification', 'wfu_ajax_action_send_email_notification');
|
58 |
+
add_action('wp_ajax_nopriv_wfu_ajax_action_send_email_notification', 'wfu_ajax_action_send_email_notification');
|
59 |
+
foreach ( glob( plugin_dir_path( __FILE__ )."lib/*.php" ) as $file )
|
60 |
+
include_once $file;
|
61 |
+
|
62 |
+
/* exit if we are in admin pages (in case of ajax call) */
|
63 |
+
if ( is_admin() ) return;
|
64 |
+
|
65 |
+
function wordpress_file_upload_handler($incomingfrompost) {
|
66 |
+
//process incoming attributes assigning defaults if required
|
67 |
+
$defs = wfu_attribute_definitions();
|
68 |
+
$defs_indexed = array();
|
69 |
+
foreach ( $defs as $def ) $defs_indexed[$def["attribute"]] = $def["value"];
|
70 |
+
$incomingfrompost = shortcode_atts($defs_indexed, $incomingfrompost);
|
71 |
+
//run function that actually does the work of the plugin
|
72 |
+
$wordpress_file_upload_output = wordpress_file_upload_function($incomingfrompost);
|
73 |
+
//send back text to replace shortcode in post
|
74 |
+
return $wordpress_file_upload_output;
|
75 |
+
}
|
76 |
+
|
77 |
+
function wordpress_file_upload_function($incomingfromhandler) {
|
78 |
+
global $post;
|
79 |
+
$params = wfu_plugin_parse_array($incomingfromhandler);
|
80 |
+
$sid = $params["uploadid"];
|
81 |
+
|
82 |
+
$_SESSION['wfu_token_'.$sid] = uniqid(mt_rand(), TRUE);
|
83 |
+
|
84 |
+
$user = wp_get_current_user();
|
85 |
+
$widths = wfu_decode_dimensions($params["widths"]);
|
86 |
+
$heights = wfu_decode_dimensions($params["heights"]);
|
87 |
+
|
88 |
+
$uploadedfile = 'uploadedfile_'.$sid;
|
89 |
+
$hiddeninput = 'hiddeninput_'.$sid;
|
90 |
+
$adminerrorcodes = 'adminerrorcodes_'.$sid;
|
91 |
+
$upload_clickaction = 'wfu_redirect_to_classic('.$sid.', \''.$_SESSION['wfu_token_'.$sid].'\' , 0, 0);';
|
92 |
+
|
93 |
+
//check if user is allowed to view plugin, otherwise do not generate it
|
94 |
+
$uploadroles = explode(",", $params["uploadrole"]);
|
95 |
+
foreach ( $uploadroles as &$uploadrole ) {
|
96 |
+
$uploadrole = strtolower(trim($uploadrole));
|
97 |
+
}
|
98 |
+
$plugin_upload_user_role = wfu_get_user_role($user, $uploadroles);
|
99 |
+
if ( !in_array($plugin_upload_user_role, $uploadroles) && $plugin_upload_user_role != 'administrator' && $params["uploadrole"] != 'all' ) return;
|
100 |
+
|
101 |
+
$params["adminmessages"] = ( $params["adminmessages"] == "true" && $plugin_upload_user_role == 'administrator' );
|
102 |
+
// define variable to hold any additional admin errors coming before processing of files (e.g. due to redirection)
|
103 |
+
$params["adminerrors"] = "";
|
104 |
+
|
105 |
+
/* Define dynamic upload path from variables */
|
106 |
+
$search = array ('/%username%/', '/%blogid%/');
|
107 |
+
if ( is_user_logged_in() ) $replace = array ($user->user_login, $blog_id);
|
108 |
+
else $replace = array ("guests", $blog_id);
|
109 |
+
$params["uploadpath"] = preg_replace($search, $replace, $params["uploadpath"]);
|
110 |
+
|
111 |
+
/* Determine if userdata fields have been defined */
|
112 |
+
$userdata_fields = array();
|
113 |
+
if ( $params["userdata"] == "true" && $params["userdatalabel"] != "" ) {
|
114 |
+
$userdata_rawfields = explode("/", $params["userdatalabel"]);
|
115 |
+
foreach ($userdata_rawfields as $userdata_rawitem) {
|
116 |
+
if ( $userdata_rawitem != "" ) {
|
117 |
+
$is_required = ( $userdata_rawitem[0] == "*" ? "true" : "false" );
|
118 |
+
if ( $is_required == "true" ) $userdata_rawitem = substr($userdata_rawitem, 1);
|
119 |
+
if ( $userdata_rawitem != "" ) {
|
120 |
+
array_push($userdata_fields, array( "label" => $userdata_rawitem, "required" => $is_required ));
|
121 |
+
}
|
122 |
+
}
|
123 |
+
}
|
124 |
+
|
125 |
+
}
|
126 |
+
$params["userdata_fields"] = $userdata_fields;
|
127 |
+
|
128 |
+
/* Prepare information about directory or selection of target subdirectory */
|
129 |
+
$subfolders = wfu_prepare_subfolders_block($params, $widths, $heights);
|
130 |
+
$subfolders_item = $subfolders['item'];
|
131 |
+
$params['subfoldersarray'] = $subfolders['paths'];
|
132 |
+
|
133 |
+
//____________________________________________________________________________________________________________________________________________________________________________________
|
134 |
+
|
135 |
+
if ( $params['forceclassic'] != "true" ) {
|
136 |
+
//**************section to put additional options inside params array**************
|
137 |
+
$params['subdir_selection_index'] = "-1";
|
138 |
+
//**************end of section of additional options inside params array**************
|
139 |
+
|
140 |
+
|
141 |
+
// below this line no other changes to params array are allowed
|
142 |
+
|
143 |
+
|
144 |
+
//**************section to save params as Wordpress options**************
|
145 |
+
// every params array is indexed (uniquely identified) by three fields:
|
146 |
+
// - the page that contains the shortcode
|
147 |
+
// - the id of the shortcode instance (because there may be more than one instances of the shortcode inside a page)
|
148 |
+
// - the user that views the plugin (because some items of the params array are affected by the user name)
|
149 |
+
// the wordpress option "wfu_params_index" holds an array of combinations of these three fields, together with a randomly generated string that corresponds to these fields.
|
150 |
+
// the wordpress option "wfu_params_xxx", where xxx is the randomly generated string, holds the params array (encoded to string) that corresponds to this string.
|
151 |
+
// the structure of the "wfu_params_index" option is as follows: "a1||b1||c1||d1&&a2||b2||c2||d2&&...", where
|
152 |
+
// - a is the randomly generated string (16 characters)
|
153 |
+
// - b is the page id
|
154 |
+
// - c is the shortcode id
|
155 |
+
// - d is the user name
|
156 |
+
$params_index = wfu_generate_current_params_index($sid, $user->user_login);
|
157 |
+
$params_str = wfu_encode_array_to_string($params);
|
158 |
+
update_option('wfu_params_'.$params_index, $params_str);
|
159 |
+
$ajax_params['shortcode_id'] = $sid;
|
160 |
+
$ajax_params['params_index'] = $params_index;
|
161 |
+
$ajax_params['max_time_limit'] = ini_get("max_input_time");
|
162 |
+
$ajax_params["fail_colors"] = $params["failmessagecolors"];
|
163 |
+
$ajax_params["default_colors"] = WFU_DEFAULTMESSAGECOLORS;
|
164 |
+
$ajax_params["error_message_header"] = WFU_ERRORMESSAGE;
|
165 |
+
$ajax_params["error_message_failed"] = WFU_ERROR_UPLOAD_FAILED_WHILE;
|
166 |
+
$ajax_params["error_message_cancelled"] = WFU_ERROR_UPLOAD_CANCELLED;
|
167 |
+
$ajax_params["error_message_unknown"] = WFU_ERROR_UNKNOWN;
|
168 |
+
$ajax_params["error_adminmessage_unknown"] = WFU_FAILMESSAGE_DETAILS;
|
169 |
+
$ajax_params["error_message_timelimit"] = WFU_ERROR_FILE_PHP_TIME;
|
170 |
+
$ajax_params["error_message_admin_timelimit"] = WFU_ERROR_ADMIN_FILE_PHP_TIME;
|
171 |
+
$ajax_params["error_jsonparse_headermessage"] = WFU_ERROR_JSONPARSE_HEADERMESSAGE;
|
172 |
+
$ajax_params["error_jsonparse_headeradminmessage"] = WFU_ERROR_JSONPARSE_HEADERADMINMESSAGE;
|
173 |
+
$ajax_params["open_url"] = site_url().'/wp-admin/admin-ajax.php';
|
174 |
+
|
175 |
+
$ajax_params_str = wfu_encode_array_to_string($ajax_params);
|
176 |
+
$upload_clickaction = 'wfu_HTML5UploadFile('.$sid.', \''.$ajax_params_str.'\', \''.$_SESSION['wfu_token_'.$sid].'\')';
|
177 |
+
}
|
178 |
+
$upload_onclick = ' onclick="'.$upload_clickaction.'"';
|
179 |
+
|
180 |
+
/* Prepare the title */
|
181 |
+
$title_item = wfu_prepare_title_block($params, $widths, $heights);
|
182 |
+
/* Prepare the text box showing filename */
|
183 |
+
$textbox_item = wfu_prepare_textbox_block($params, $widths, $heights);
|
184 |
+
/* Prepare the upload form */
|
185 |
+
$additional_params = array( );
|
186 |
+
$uploadform_item = wfu_prepare_uploadform_block($params, $widths, $heights, $upload_clickaction, $additional_params);
|
187 |
+
/* Prepare the submit button */
|
188 |
+
$submit_item = wfu_prepare_submit_block($params, $widths, $heights, $upload_clickaction);
|
189 |
+
/* Prepare the progress bar */
|
190 |
+
$progressbar_item = wfu_prepare_progressbar_block($params, $widths, $heights);
|
191 |
+
/* Prepare the message */
|
192 |
+
$message_item = wfu_prepare_message_block($params, $widths, $heights);
|
193 |
+
/* Prepare user data */
|
194 |
+
$userdata_item = wfu_prepare_userdata_block($params, $widths, $heights);
|
195 |
+
|
196 |
+
/* Compose the html code for the plugin */
|
197 |
+
$wordpress_file_upload_output = "";
|
198 |
+
$wordpress_file_upload_output .= '<div id="wordpress_file_upload_block_'.$sid.'" class="file_div_clean">';
|
199 |
+
$itemplaces = explode("/", $params["placements"]);
|
200 |
+
foreach ( $itemplaces as $section ) {
|
201 |
+
$items_in_section = explode("+", trim($section));
|
202 |
+
$section_array = array( );
|
203 |
+
foreach ( $items_in_section as $item_in_section ) {
|
204 |
+
$item_in_section = strtolower(trim($item_in_section));
|
205 |
+
if ( $item_in_section == "title" ) array_push($section_array, $title_item);
|
206 |
+
elseif ( $item_in_section == "filename" ) array_push($section_array, $textbox_item);
|
207 |
+
elseif ( $item_in_section == "selectbutton" ) array_push($section_array, $uploadform_item);
|
208 |
+
elseif ( $item_in_section == "uploadbutton" && $params["singlebutton"] != "true" ) array_push($section_array, $submit_item);
|
209 |
+
elseif ( $item_in_section == "subfolders" ) array_push($section_array, $subfolders_item);
|
210 |
+
elseif ( $item_in_section == "progressbar" ) array_push($section_array, $progressbar_item);
|
211 |
+
elseif ( $item_in_section == "message" ) array_push($section_array, $message_item);
|
212 |
+
elseif ( $item_in_section == "userdata" && $params["userdata"] == "true" ) array_push($section_array, $userdata_item);
|
213 |
+
}
|
214 |
+
$wordpress_file_upload_output .= call_user_func_array("wfu_add_div", $section_array);
|
215 |
+
}
|
216 |
+
/* Append mandatory blocks, if have not been included in placements attribute */
|
217 |
+
if ( $params["userdata"] == "true" && strpos($params["placements"], "userdata") === false ) {
|
218 |
+
$section_array = array( );
|
219 |
+
array_push($section_array, $userdata_item);
|
220 |
+
$wordpress_file_upload_output .= call_user_func_array("wfu_add_div", $section_array);
|
221 |
+
}
|
222 |
+
if ( strpos($params["placements"], "selectbutton") === false ) {
|
223 |
+
$section_array = array( );
|
224 |
+
array_push($section_array, $uploadform_item);
|
225 |
+
$wordpress_file_upload_output .= call_user_func_array("wfu_add_div", $section_array);
|
226 |
+
}
|
227 |
+
/* Pass constants to javascript */
|
228 |
+
$consts = wfu_set_javascript_constants();
|
229 |
+
$handler = 'function() { wfu_Initialize_Consts("'.$consts.'") }';
|
230 |
+
$wordpress_file_upload_output .= "\n\t".'<script type="text/javascript">if(window.addEventListener) { window.addEventListener("load", '.$handler.', false); } else if(window.attachEvent) { window.attachEvent("onload", '.$handler.'); } else { window["onload"] = '.$handler.'; }</script>';
|
231 |
+
$wordpress_file_upload_output .= '</div>';
|
232 |
+
// $wordpress_file_upload_output .= '<div>';
|
233 |
+
// $wordpress_file_upload_output .= wfu_test_admin();
|
234 |
+
// $wordpress_file_upload_output .= '</div>';
|
235 |
+
|
236 |
+
// The plugin uses sessions in order to detect if the page was loaded due to file upload or
|
237 |
+
// because the user pressed the Refresh button (or F5) of the page.
|
238 |
+
// In the second case we do not want to perform any file upload, so we abort the rest of the script.
|
239 |
+
if ( $_SESSION['wfu_check_refresh_'.$sid] != "form button pressed" ) {
|
240 |
+
$_SESSION['wfu_check_refresh_'.$sid] = 'do not process';
|
241 |
+
return $wordpress_file_upload_output."\n";
|
242 |
+
}
|
243 |
+
$_SESSION['wfu_check_refresh_'.$sid] = 'do not process';
|
244 |
+
$params["upload_start_time"] = $_SESSION['wfu_start_time_'.$sid];
|
245 |
+
|
246 |
+
// The plugin uses two ways to upload the file:
|
247 |
+
// - The first one uses classic functionality of an HTML form (highest compatibility with browsers but few capabilities).
|
248 |
+
// - The second uses ajax (HTML5) functionality (medium compatibility with browsers but many capabilities, like no page refresh and progress bar).
|
249 |
+
// The plugin loads using ajax functionality by default, however if it detects that ajax functionality is not supported, it will automatically switch to classic functionality.
|
250 |
+
// The next line checks to see if the form was submitted using ajax or classic functionality.
|
251 |
+
// If the uploaded file variable stored in $_FILES ends with "_redirected", then it means that ajax functionality is not supported and the plugin must switch to classic functionality.
|
252 |
+
if ( isset($_FILES[$uploadedfile.'_redirected']) ) $params['forceclassic'] = "true";
|
253 |
+
|
254 |
+
if ( $params['forceclassic'] != "true" ) return $wordpress_file_upload_output."\n";
|
255 |
+
|
256 |
+
// The section below is executed when using classic upload methods
|
257 |
+
if ( isset( $_POST[$adminerrorcodes] ) ) {
|
258 |
+
$code = $_POST[$adminerrorcodes];
|
259 |
+
if ( $code == "" ) $params['adminerrors'] = "";
|
260 |
+
elseif ( $code == "1" || $code == "2" || $code == "3" ) $params['adminerrors'] = constant('WFU_ERROR_REDIRECTION_ERRORCODE'.$code);
|
261 |
+
else $params['adminerrors'] = WFU_ERROR_REDIRECTION_ERRORCODE0;
|
262 |
+
}
|
263 |
+
|
264 |
+
$params['subdir_selection_index'] = -1;
|
265 |
+
if ( isset( $_POST[$hiddeninput] ) ) $params['subdir_selection_index'] = $_POST[$hiddeninput];
|
266 |
+
|
267 |
+
$wfu_process_file_array = wfu_process_files($params, 'no_ajax');
|
268 |
+
$safe_output = $wfu_process_file_array["general"]['safe_output'];
|
269 |
+
unset($wfu_process_file_array["general"]['safe_output']);
|
270 |
+
|
271 |
+
$wfu_process_file_array_str = wfu_encode_array_to_string($wfu_process_file_array);
|
272 |
+
$ProcessUploadComplete_functiondef = 'function(){wfu_ProcessUploadComplete('.$sid.', 1, "'.$wfu_process_file_array_str.'", "no-ajax", "", "", "'.$safe_output.'");}';
|
273 |
+
$wordpress_file_upload_output .= '<script type="text/javascript">window.onload='.$ProcessUploadComplete_functiondef.'</script>';
|
274 |
+
|
275 |
+
|
276 |
+
return $wordpress_file_upload_output."\n";
|
277 |
+
}
|
278 |
+
|
279 |
+
?>
|