WordPress File Upload - Version 2.7.1

Version Description

  • fixed bug with faulty plugin instances appearring when Woocommerce plugin is also installed
  • Upload of javascript (.js) files is not allowed for avoiding security issues
  • fixed bug with medialink and postlink attributes that were not working correctly
  • when medialink or postlink is activated, the files will be uploaded to the upload folder of WP website
  • when medialink or postlink is activated, subfolders will be deactivated
  • added option in subfolders to enable the list to populate automatically
  • added option in subfolders the user to be able to type the subfolder
  • wfu_before_file_check filter can modify the target path (not only the file name)
Download this release

Release Info

Developer nickboss
Plugin Icon 128x128 WordPress File Upload
Version 2.7.1
Comparing to
See all releases

Code changes from version 2.7.0 to 2.7.1

css/wordpress_file_upload_style.css CHANGED
@@ -1 +1 @@
1
- input[type=text].file_input_textbox{position:relative;width:150px;height:25px;margin:0;padding:0;border:1px solid;border-color:#BBB;background-color:#fff;color:#000}input[type=text].file_input_textbox:disabled{position:relative;width:150px;height:25px;margin:0;padding:0;border:1px solid;border-color:#BBB;background-color:#fff;color:silver}input[type=text].file_input_textbox_nofile{position:relative;width:150px;height:25px;margin:0;padding:0;border:1px solid;border-color:#BBB;background-color:red;color:#000}form.file_input_uploadform{position:relative;width:100px;height:27px;overflow:hidden;margin:0;padding:0}input[type=button].file_input_button{width:100px;height:27px;position:absolute;top:0;margin:0;padding:0;background-color:#EEE;color:#555;background-image:url(../images/white-grad-active.png);background-position:left top;background-repeat:repeat-x;border-style:solid;border-width:1px;border-color:#BBB;-webkit-border-radius:2px;-moz-border-radius:2px;-khtml-border-radius:2px;border-radius:2px}input[type=button].file_input_button_hover{width:100px;height:27px;position:absolute;top:0;margin:0;padding:0;background-color:#EEE;color:#111;background-image:url(../images/white-grad-active.png);background-position:left top;background-repeat:repeat-x;border-style:solid;border-width:1px;border-color:#333;-webkit-border-radius:2px;-moz-border-radius:2px;-khtml-border-radius:2px;border-radius:2px}input[type=button].file_input_button:disabled,input[type=button].file_input_button_hover:disabled{width:100px;height:27px;position:absolute;top:0;margin:0;padding:0;background-color:#EEE;color:silver;background-image:url(../images/white-grad-active.png);background-position:left top;background-repeat:repeat-x;border-style:solid;border-width:1px;border-color:#BBB;-webkit-border-radius:2px;-moz-border-radius:2px;-khtml-border-radius:2px;border-radius:2px}input[type=button].file_input_submit{width:100px;height:27px;position:relative;margin:0;padding:0;background-color:#EEE;color:#555;background-image:url(../images/white-grad-active.png);background-position:left top;background-repeat:repeat-x;border-style:solid;border-width:1px;border-color:#BBB;-webkit-border-radius:2px;-moz-border-radius:2px;-khtml-border-radius:2px;border-radius:2px}input[type=button].file_input_submit:focus,input[type=button].file_input_submit:hover{width:100px;height:27px;position:relative;margin:0;padding:0;background-color:#EEE;color:#111;background-image:url(../images/white-grad-active.png);background-position:left top;background-repeat:repeat-x;border-style:solid;border-width:1px;border-color:#333;-webkit-border-radius:2px;-moz-border-radius:2px;-khtml-border-radius:2px;border-radius:2px}input[type=button].file_input_submit:disabled{width:100px;height:27px;position:relative;margin:0;padding:0;background-color:#EEE;color:silver;background-image:url(../images/white-grad-active.png);background-position:left top;background-repeat:repeat-x;border-style:solid;border-width:1px;border-color:#BBB;-webkit-border-radius:2px;-moz-border-radius:2px;-khtml-border-radius:2px;border-radius:2px}input[type=file].file_input_hidden{font-size:45px;position:absolute;right:0;top:0;margin:0;padding:0;-ms-filter:"progid:DXImageTransform.Microsoft.Alpha(Opacity=0)";filter:alpha(opacity=0);-moz-opacity:0;-khtml-opacity:0;opacity:0}div.file_progress_bar{display:block;position:relative;width:auto;border:1px solid #333;margin:0;padding:4px}div.file_progress_inner{display:block;width:100%;height:6px;margin:0;padding:0;border:1px solid silver;background-color:#fff}img.file_progress_imagesafe{width:100%;height:6px}span.file_progress_noanimation{display:block;width:0;height:6px;margin:0;padding:0;border-style:none;background-color:#2bc253;position:relative;overflow:hidden}span.file_progress_progressive{display:block;width:auto;height:6px;margin:0;padding:0;border-style:none;background-color:#2bc253;position:relative;overflow:hidden}span.file_progress_shuffle{display:block;width:25%;height:6px;margin:0;padding:0;border-style:none;background-color:#2bc253;position:relative;-webkit-animation:shuffle 1s linear infinite alternate;-moz-animation:shuffle 1s linear infinite alternate;-o-animation:shuffle 1s linear infinite alternate;animation:shuffle 1s linear infinite alternate;overflow:hidden}span.file_progress_progressive:after{content:"";position:absolute;top:0;left:0;bottom:0;right:0;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));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);z-index:1;-webkit-background-size:30px 30px;-moz-background-size:30px 30px;background-size:30px 30px;-webkit-animation:lengthen 2s linear infinite;-moz-animation:lengthen 2s linear infinite;-o-animation:lengthen 2s linear infinite;animation:lengthen 2s linear infinite;overflow:hidden}@-webkit-keyframes shuffle{from{left:0}to{left:75%}}@-moz-keyframes shuffle{from{left:0}to{left:75%}}@-o-keyframes shuffle{from{left:0}to{left:75%}}@keyframes shuffle{from{left:0}to{left:75%}}@-webkit-keyframes lengthen{from{background-position:0 0}to{background-position:30px 30px}}@-moz-keyframes lengthen{from{background-position:0 0}to{background-position:30px 30px}}@-o-keyframes lengthen{from{background-position:0 0}to{background-position:30px 30px}}@keyframes lengthen{from{background-position:0 0}to{background-position:30px 30px}}span.file_messagebox_inner{display:block;width:340px;margin:0;font-size:small;padding:10px;border-style:solid;border-width:1px;border-color:#D3D3D3;background-color:#F5F5F5;color:#000;line-height:1.2}div.file_div_clean{display:table;position:relative;margin:0;padding:0;border-style:none;background:0 0;color:#000;line-height:1}div.file_space_clean{display:block;margin:0 0 2px;padding:0;border-style:none;background:0 0;color:#000}table.file_table_clean{margin:0;padding:0;border:none;border-spacing:0;background:0 0;color:#000;width:auto}td.file_td_clean{margin:0;padding:0;border:none;border-spacing:0;background:0 0;color:#000;vertical-align:middle}span.file_item_clean{margin:0;padding:0;border-style:none;background:0 0;color:#000}select.file_item_clean{margin:0;padding:0;height:25px;border-style:none;background:0 0;color:#000}select.file_item_clean:disabled{margin:0;padding:0;height:25px;border-style:none;background:0 0;color:silver}select.file_item_clean option{background:#fff;color:#000}span.file_title_clean{margin:0;padding:0;border-style:none;background:0 0;color:#000}div.file_userdata_container{margin:0;padding:0;white-space:nowrap}label.file_userdata_label{margin:0;width:40%}input[type=text].file_userdata_message,input[type=text].file_userdata_message_required{width:60%;height:25px;margin:0;padding:0;border:1px solid;border-color:#BBB;background:0 0;color:#000}input[type=text].file_userdata_message:disabled,input[type=text].file_userdata_message_required:disabled{width:60%;height:25px;margin:0;padding:0;border:1px solid;border-color:#BBB;background:0 0;color:silver}input[type=text].file_userdata_message_required_empty{width:60%;height:25px;margin:0;padding:0;border:1px solid;border-color:#BBB;background-color:red;color:#000}table.file_messageblock_table{margin:0;padding:0;border:none}td.file_messageblock_header_td{border:1px solid #ddd;margin:0;padding:0}div.file_messageblock_header{margin:0;padding:2px}label.file_messageblock_header_label{font-weight:700;font-size:12px;line-height:1}td.file_messageblock_arrow_td{border:1px solid #ddd;margin:0;padding:0;width:20px;vertical-align:middle}div.file_messageblock_header_arrow_up{width:0;height:0;border-left:5px solid transparent;border-right:5px solid transparent;border-bottom:5px solid #555;margin:5px 1px 1px 5px;font-size:0;line-height:0}div.file_messageblock_header_arrow_down{width:0;height:0;border-left:5px solid transparent;border-right:5px solid transparent;border-top:5px solid #555;margin:5px 1px 1px 5px;font-size:0;line-height:0}td.file_messageblock_subheader_td{margin:0;padding:0;border:1px solid #ddd}div.file_messageblock_subheader_message{margin:0;padding:2px;background:0 0}label.file_messageblock_subheader_messagelabel{font-weight:400;font-size:12px;line-height:1}div.file_messageblock_subheader_adminmessage{margin:0;padding:2px;background-color:#F7F7F7;overflow:scroll}label.file_messageblock_subheader_debugmessage_label{margin:0;padding:0;background:0 0;border:none;font-weight:700}div.file_messageblock_subheader_debugmessage_container{margin:0 0 0 20px;padding:0;background:0 0;border:none;font-size:10px}label.file_messageblock_subheader_adminmessagelabel{font-weight:400;font-size:12px;font-style:italic;line-height:1}td.file_messageblock_filenumber_td{width:30px;margin:0;padding:2px;text-align:center;vertical-align:middle;font-weight:700;font-size:11px;line-height:1;border:1px solid #ddd}td.file_messageblock_fileheader_td{margin:0;padding:0;border:1px solid #ddd}div.file_messageblock_fileheader{margin:0;padding:2px}label.file_messageblock_fileheader_label{font-weight:700;font-size:11px;line-height:1}td.file_messageblock_filearrow_td{margin:0;padding:0;width:20px;border:1px solid #ddd;vertical-align:middle}div.file_messageblock_file_arrow_up{width:0;height:0;border-left:4px solid transparent;border-right:4px solid transparent;border-bottom:4px solid #555;margin:5px 1px 1px 6px;font-size:0;line-height:0}div.file_messageblock_file_arrow_down{width:0;height:0;border-left:4px solid transparent;border-right:4px solid transparent;border-top:4px solid #555;margin:5px 1px 1px 6px;font-size:0;line-height:0}td.file_messageblock_filesubheaderempty_td{width:30px;margin:0;padding:0;border:1px solid #ddd}td.file_messageblock_filesubheader_td{margin:0;padding:0;border:1px solid #ddd}div.file_messageblock_filesubheader_message{margin:0;padding:2px;background:0 0}label.file_messageblock_filesubheader_messagelabel{font-weight:400;font-size:11px;line-height:1}div.file_messageblock_filesubheader_adminmessage{margin:0;padding:2px;background-color:#F7F7F7}label.file_messageblock_filesubheader_adminmessagelabel{font-weight:400;font-size:11px;font-style:italic;line-height:1}div.wfu_overlay_editor{width:18px;height:18px;padding:2px;box-shadow:1px 1px 2px #aaa;position:absolute;z-index:2;display:none;background-color:#fff}.wfu_container:hover div.wfu_overlay_editor{display:block}div.wfu_overlay_editor:hover{background-color:#ff0}button.wfu_overlay_editor_button,button.wfu_overlay_editor_button:focus{background:0 0;border:none;margin:0;padding:0;width:100;height:100%;outline:0}div.wfu_overlay_container{position:absolute;width:100%;height:100%;top:0;left:0;margin:0;padding:0;background-color:rgba(255,255,255,.7);z-index:2;display:none}table.wfu_overlay_table,table.wfu_overlay_table td,table.wfu_overlay_table tr{border:none;margin:0;padding:0;background:0 0;width:100%;height:100%}table.wfu_overlay_table td{text-align:center;vertical-align:middle}div.wfu_overlay_container_inner{position:absolute;width:100%;height:100%;top:0;left:0;margin:0;padding:0;background:0 0}div.wfu_overlay_container label{margin-left:4px}
1
+ input[type=text].file_input_textbox{position:relative;width:150px;height:25px;margin:0;padding:0;border:1px solid;border-color:#BBB;background-color:#fff;color:#000}input[type=text].file_input_textbox:disabled{position:relative;width:150px;height:25px;margin:0;padding:0;border:1px solid;border-color:#BBB;background-color:#fff;color:silver}input[type=text].file_input_textbox_nofile{position:relative;width:150px;height:25px;margin:0;padding:0;border:1px solid;border-color:#BBB;background-color:red;color:#000}form.file_input_uploadform{position:relative;width:100px;height:27px;overflow:hidden;margin:0;padding:0}input[type=button].file_input_button{width:100px;height:27px;position:absolute;top:0;margin:0;padding:0;background-color:#EEE;color:#555;background-image:url(../images/white-grad-active.png);background-position:left top;background-repeat:repeat-x;border-style:solid;border-width:1px;border-color:#BBB;-webkit-border-radius:2px;-moz-border-radius:2px;-khtml-border-radius:2px;border-radius:2px}input[type=button].file_input_button_hover{width:100px;height:27px;position:absolute;top:0;margin:0;padding:0;background-color:#EEE;color:#111;background-image:url(../images/white-grad-active.png);background-position:left top;background-repeat:repeat-x;border-style:solid;border-width:1px;border-color:#333;-webkit-border-radius:2px;-moz-border-radius:2px;-khtml-border-radius:2px;border-radius:2px}input[type=button].file_input_button:disabled,input[type=button].file_input_button_hover:disabled{width:100px;height:27px;position:absolute;top:0;margin:0;padding:0;background-color:#EEE;color:silver;background-image:url(../images/white-grad-active.png);background-position:left top;background-repeat:repeat-x;border-style:solid;border-width:1px;border-color:#BBB;-webkit-border-radius:2px;-moz-border-radius:2px;-khtml-border-radius:2px;border-radius:2px}input[type=button].file_input_submit{width:100px;height:27px;position:relative;margin:0;padding:0;background-color:#EEE;color:#555;background-image:url(../images/white-grad-active.png);background-position:left top;background-repeat:repeat-x;border-style:solid;border-width:1px;border-color:#BBB;-webkit-border-radius:2px;-moz-border-radius:2px;-khtml-border-radius:2px;border-radius:2px}input[type=button].file_input_submit:focus,input[type=button].file_input_submit:hover{width:100px;height:27px;position:relative;margin:0;padding:0;background-color:#EEE;color:#111;background-image:url(../images/white-grad-active.png);background-position:left top;background-repeat:repeat-x;border-style:solid;border-width:1px;border-color:#333;-webkit-border-radius:2px;-moz-border-radius:2px;-khtml-border-radius:2px;border-radius:2px}input[type=button].file_input_submit:disabled{width:100px;height:27px;position:relative;margin:0;padding:0;background-color:#EEE;color:silver;background-image:url(../images/white-grad-active.png);background-position:left top;background-repeat:repeat-x;border-style:solid;border-width:1px;border-color:#BBB;-webkit-border-radius:2px;-moz-border-radius:2px;-khtml-border-radius:2px;border-radius:2px}input[type=file].file_input_hidden{font-size:45px;position:absolute;right:0;top:0;margin:0;padding:0;-ms-filter:"progid:DXImageTransform.Microsoft.Alpha(Opacity=0)";filter:alpha(opacity=0);-moz-opacity:0;-khtml-opacity:0;opacity:0}div.file_progress_bar{display:block;position:relative;width:auto;border:1px solid #333;margin:0;padding:4px}div.file_progress_inner{display:block;width:100%;height:6px;margin:0;padding:0;border:1px solid silver;background-color:#fff}img.file_progress_imagesafe{width:100%;height:6px}span.file_progress_noanimation{display:block;width:0;height:6px;margin:0;padding:0;border-style:none;background-color:#2bc253;position:relative;overflow:hidden}span.file_progress_progressive{display:block;width:auto;height:6px;margin:0;padding:0;border-style:none;background-color:#2bc253;position:relative;overflow:hidden}span.file_progress_shuffle{display:block;width:25%;height:6px;margin:0;padding:0;border-style:none;background-color:#2bc253;position:relative;-webkit-animation:shuffle 1s linear infinite alternate;-moz-animation:shuffle 1s linear infinite alternate;-o-animation:shuffle 1s linear infinite alternate;animation:shuffle 1s linear infinite alternate;overflow:hidden}span.file_progress_progressive:after{content:"";position:absolute;top:0;left:0;bottom:0;right:0;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));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);z-index:1;-webkit-background-size:30px 30px;-moz-background-size:30px 30px;background-size:30px 30px;-webkit-animation:lengthen 2s linear infinite;-moz-animation:lengthen 2s linear infinite;-o-animation:lengthen 2s linear infinite;animation:lengthen 2s linear infinite;overflow:hidden}@-webkit-keyframes shuffle{from{left:0}to{left:75%}}@-moz-keyframes shuffle{from{left:0}to{left:75%}}@-o-keyframes shuffle{from{left:0}to{left:75%}}@keyframes shuffle{from{left:0}to{left:75%}}@-webkit-keyframes lengthen{from{background-position:0 0}to{background-position:30px 30px}}@-moz-keyframes lengthen{from{background-position:0 0}to{background-position:30px 30px}}@-o-keyframes lengthen{from{background-position:0 0}to{background-position:30px 30px}}@keyframes lengthen{from{background-position:0 0}to{background-position:30px 30px}}span.file_messagebox_inner{display:block;width:340px;margin:0;font-size:small;padding:10px;border-style:solid;border-width:1px;border-color:#D3D3D3;background-color:#F5F5F5;color:#000;line-height:1.2}div.file_div_clean{display:table;position:relative;margin:0;padding:0;border-style:none;background:0 0;color:#000;line-height:1}div.file_space_clean{display:block;margin:0 0 2px;padding:0;border-style:none;background:0 0;color:#000}table.file_table_clean{margin:0;padding:0;border:none;border-spacing:0;background:0 0;color:#000;width:auto}td.file_td_clean{margin:0;padding:0;border:none;border-spacing:0;background:0 0;color:#000;vertical-align:middle}span.file_item_clean{margin:0;padding:0;border-style:none;background:0 0;color:#000}div.file_item_clean{margin:0;padding:0;height:25px;border-style:none;background:0 0;color:#000;position:relative;display:inline-block}div.file_item_clean_inner{margin:0;padding:0;border-style:none;background:0 0;position:absolute;top:3px;left:4px;bottom:3px;right:18px}input[type=text].file_item_clean{border:none;box-shadow:none;padding:0;width:100%;height:100%}input[type=text].file_item_clean:disabled{border:none;box-shadow:none;padding:0;width:100%;height:100%;color:silver}input[type=text].file_item_clean_match{border:none;box-shadow:none;padding:0;width:100%;height:100%;font-weight:700;font-style:italic}input[type=text].file_item_clean_match:disabled{border:none;box-shadow:none;padding:0;width:100%;height:100%;font-weight:700;font-style:italic;color:silver}input[type=text].file_item_clean_empty{border:none;box-shadow:none;padding:0;width:100%;height:100%;color:silver;font-style:italic}input[type=text].file_item_clean_prompt{border:none;box-shadow:none;padding:0;width:100%;height:100%;background:red}select.file_item_clean{margin:0;padding:0;height:25px;border-style:none;background:0 0;color:#000}select.file_item_clean_prompt{margin:0;padding:0;height:25px;border-style:none;background:red;color:#000}select.file_item_clean:disabled{margin:0;padding:0;height:25px;border-style:none;background:0 0;color:silver}select.file_item_clean option,select.file_item_clean_prompt option{background:#fff;color:#000}span.file_title_clean{margin:0;padding:0;border-style:none;background:0 0;color:#000}div.file_userdata_container{margin:0;padding:0;white-space:nowrap}label.file_userdata_label{margin:0;width:40%}input[type=text].file_userdata_message,input[type=text].file_userdata_message_required{width:60%;height:25px;margin:0;padding:0;border:1px solid;border-color:#BBB;background:0 0;color:#000}input[type=text].file_userdata_message:disabled,input[type=text].file_userdata_message_required:disabled{width:60%;height:25px;margin:0;padding:0;border:1px solid;border-color:#BBB;background:0 0;color:silver}input[type=text].file_userdata_message_required_empty{width:60%;height:25px;margin:0;padding:0;border:1px solid;border-color:#BBB;background-color:red;color:#000}table.file_messageblock_table{margin:0;padding:0;border:none}td.file_messageblock_header_td{border:1px solid #ddd;margin:0;padding:0}div.file_messageblock_header{margin:0;padding:2px}label.file_messageblock_header_label{font-weight:700;font-size:12px;line-height:1}td.file_messageblock_arrow_td{border:1px solid #ddd;margin:0;padding:0;width:20px;vertical-align:middle}div.file_messageblock_header_arrow_up{width:0;height:0;border-left:5px solid transparent;border-right:5px solid transparent;border-bottom:5px solid #555;margin:5px 1px 1px 5px;font-size:0;line-height:0}div.file_messageblock_header_arrow_down{width:0;height:0;border-left:5px solid transparent;border-right:5px solid transparent;border-top:5px solid #555;margin:5px 1px 1px 5px;font-size:0;line-height:0}td.file_messageblock_subheader_td{margin:0;padding:0;border:1px solid #ddd}div.file_messageblock_subheader_message{margin:0;padding:2px;background:0 0}label.file_messageblock_subheader_messagelabel{font-weight:400;font-size:12px;line-height:1}div.file_messageblock_subheader_adminmessage{margin:0;padding:2px;background-color:#F7F7F7;overflow:scroll}label.file_messageblock_subheader_debugmessage_label{margin:0;padding:0;background:0 0;border:none;font-weight:700}div.file_messageblock_subheader_debugmessage_container{margin:0 0 0 20px;padding:0;background:0 0;border:none;font-size:10px}label.file_messageblock_subheader_adminmessagelabel{font-weight:400;font-size:12px;font-style:italic;line-height:1}td.file_messageblock_filenumber_td{width:30px;margin:0;padding:2px;text-align:center;vertical-align:middle;font-weight:700;font-size:11px;line-height:1;border:1px solid #ddd}td.file_messageblock_fileheader_td{margin:0;padding:0;border:1px solid #ddd}div.file_messageblock_fileheader{margin:0;padding:2px}label.file_messageblock_fileheader_label{font-weight:700;font-size:11px;line-height:1}td.file_messageblock_filearrow_td{margin:0;padding:0;width:20px;border:1px solid #ddd;vertical-align:middle}div.file_messageblock_file_arrow_up{width:0;height:0;border-left:4px solid transparent;border-right:4px solid transparent;border-bottom:4px solid #555;margin:5px 1px 1px 6px;font-size:0;line-height:0}div.file_messageblock_file_arrow_down{width:0;height:0;border-left:4px solid transparent;border-right:4px solid transparent;border-top:4px solid #555;margin:5px 1px 1px 6px;font-size:0;line-height:0}td.file_messageblock_filesubheaderempty_td{width:30px;margin:0;padding:0;border:1px solid #ddd}td.file_messageblock_filesubheader_td{margin:0;padding:0;border:1px solid #ddd}div.file_messageblock_filesubheader_message{margin:0;padding:2px;background:0 0}label.file_messageblock_filesubheader_messagelabel{font-weight:400;font-size:11px;line-height:1}div.file_messageblock_filesubheader_adminmessage{margin:0;padding:2px;background-color:#F7F7F7}label.file_messageblock_filesubheader_adminmessagelabel{font-weight:400;font-size:11px;font-style:italic;line-height:1}div.wfu_overlay_editor{width:18px;height:18px;padding:2px;box-shadow:1px 1px 2px #aaa;position:absolute;z-index:2;display:none;background-color:#fff}.wfu_container:hover div.wfu_overlay_editor{display:block}div.wfu_overlay_editor:hover{background-color:#ff0}button.wfu_overlay_editor_button,button.wfu_overlay_editor_button:focus{background:0 0;border:none;margin:0;padding:0;width:100;height:100%;outline:0}div.wfu_overlay_container{position:absolute;width:100%;height:100%;top:0;left:0;margin:0;padding:0;background-color:rgba(255,255,255,.7);z-index:2;display:none}table.wfu_overlay_table,table.wfu_overlay_table td,table.wfu_overlay_table tr{border:none;margin:0;padding:0;background:0 0;width:100%;height:100%}table.wfu_overlay_table td{text-align:center;vertical-align:middle}div.wfu_overlay_container_inner{position:absolute;width:100%;height:100%;top:0;left:0;margin:0;padding:0;background:0 0}div.wfu_overlay_container label{margin-left:4px}
js/wordpress_file_upload_adminfunctions.js CHANGED
@@ -1,2 +1,2 @@
1
- function wfu_admin_activate_tab(e){for(var t,a,l=document.getElementById("wfu_tab_container"),n=0;n<l.childNodes.length;n++)t=l.childNodes[n],1===t.nodeType&&(a=t.id.substr(8),t.className.indexOf("nav-tab-active")>-1&&(t.className="nav-tab",document.getElementById("wfu_container_"+a).style.display="none"));document.getElementById("wfu_tab_"+e).className="nav-tab nav-tab-active",document.getElementById("wfu_container_"+e).style.display="block"}function wfu_admin_onoff_clicked(e){var t=document.getElementById("wfu_attribute_"+e),a=document.getElementById("wfu_wrapper"),l=document.getElementsByClassName("wfu_shadow_"+e,"div",a),n=document.getElementsByClassName("wfu_shadow_"+e+"_inv","div",a),d="on"==t.className.substr(t.className.length-2);if(d=!d){document.getElementById("wfu_attribute_value_"+e).value="true",t.className="wfu_onoff_container_on";for(var u=0;u<l.length;u++)l[u].style.display="none";for(var u=0;u<n.length;u++)n[u].style.display="block"}else{document.getElementById("wfu_attribute_value_"+e).value="false",t.className="wfu_onoff_container_off";for(var u=0;u<l.length;u++)l[u].style.display="block";for(var u=0;u<n.length;u++)n[u].style.display="none"}wfu_generate_shortcode(),"userdata"==e&&wfu_update_userfield_variables()}function wfu_admin_radio_clicked(e){var t=document.getElementsByName("wfu_radioattribute_"+e),a=document.getElementById("wfu_wrapper"),l=document.getElementsByClassName("wfu_shadow_"+e,"div",a),n=document.getElementsByClassName("wfu_shadow_"+e+"_inv","div",a),d="";for(r=0;r<t.length;r++)t[r].checked&&(d=t[r].value);var u="*"==d.substr(0,1);if(u){d=d.substr(1);for(var r=0;r<l.length;r++)l[r].style.display="none";for(var r=0;r<n.length;r++)n[r].style.display="block"}else{for(var r=0;r<l.length;r++)l[r].style.display="block";for(var r=0;r<n.length;r++)n[r].style.display="none"}document.getElementById("wfu_attribute_value_"+e).value=d,wfu_generate_shortcode()}function wfu_addEventHandler(e,t,a){e.addEventListener?e.addEventListener(t,a,!1):e.attachEvent?e.attachEvent("on"+t,a):e["on"+t]=a}function wfu_attach_separator_dragdrop_events(){for(var e,t=document.getElementById("wfu_placements_container"),a=0;a<t.childNodes.length;a++)e=t.childNodes[a],("wfu_component_separator_hor"==e.className||"wfu_component_separator_ver"==e.className)&&(wfu_addEventHandler(e,"dragenter",wfu_separator_dragenter),wfu_addEventHandler(e,"dragover",wfu_default_dragover),wfu_addEventHandler(e,"dragleave",wfu_separator_dragleave),wfu_addEventHandler(e,"drop",wfu_separator_drop))}function wfu_Attach_Admin_DragDrop_Events(){if(window.FileReader){for(var e,t=document.getElementById("wfu_placements_container"),a=document.getElementById("wfu_componentlist_container"),l=0;l<t.childNodes.length;l++)e=t.childNodes[l],"wfu_component_box"==e.className&&(wfu_addEventHandler(e,"dragstart",wfu_component_dragstart),wfu_addEventHandler(e,"dragend",wfu_component_dragend));for(var l=0;l<a.childNodes.length;l++)if(e=a.childNodes[l],"wfu_component_box_container"==e.className)for(var n=0;n<e.childNodes.length;n++)"wfu_component_box wfu_inbase"==e.childNodes[n].className&&(wfu_addEventHandler(e.childNodes[n],"dragstart",wfu_component_dragstart),wfu_addEventHandler(e.childNodes[n],"dragend",wfu_component_dragend));e=document.getElementById("wfu_componentlist_dragdrop"),wfu_addEventHandler(e,"dragenter",wfu_componentlist_dragenter),wfu_addEventHandler(e,"dragover",wfu_default_dragover),wfu_addEventHandler(e,"dragleave",wfu_componentlist_dragleave),wfu_addEventHandler(e,"drop",wfu_componentlist_drop),wfu_attach_separator_dragdrop_events()}}function wfu_componentlist_dragenter(e){if(e=e||window.event,e.preventDefault&&e.preventDefault(),!DraggedItem)return!1;var t=document.getElementById("wfu_componentlist_dragdrop");return-1==t.className.indexOf("wfu_componentlist_dragdrop_dragover")&&(t.className+=" wfu_componentlist_dragdrop_dragover"),!1}function wfu_componentlist_dragleave(e){if(e=e||window.event,e.preventDefault&&e.preventDefault(),!DraggedItem)return!1;var t=document.getElementById("wfu_componentlist_dragdrop");return t.className=t.className.replace(" wfu_componentlist_dragdrop_dragover",""),!1}function wfu_componentlist_drop(e){e=e||window.event,e.preventDefault&&e.preventDefault();var t=e.dataTransfer.getData("Component");if(!t)return!1;var a=document.getElementById("wfu_component_box_"+t);a.className="wfu_component_box wfu_inbase",a.style.display="block",document.getElementById("wfu_component_box_container_"+t).appendChild(a);var l=wfu_admin_recreate_placements_text(null,"");return wfu_admin_recreate_placements_panel(l),document.getElementById("wfu_attribute_value_placements").value=l,wfu_generate_shortcode(),!1}function wfu_separator_dragenter(e){if(e=e||window.event,e.preventDefault&&e.preventDefault(),!DraggedItem)return!1;if("wfu_component_separator_hor"==e.target.className){var t=document.getElementById("wfu_component_bar_hor");t.style.top=e.target.offsetTop+"px",t.style.display="block"}else if("wfu_component_separator_ver"==e.target.className){var t=document.getElementById("wfu_component_bar_ver");t.style.top=e.target.offsetTop+"px",t.style.left=e.target.offsetLeft+"px",t.style.display="block"}return!1}function wfu_default_dragover(e){return e=e||window.event,e.preventDefault&&e.preventDefault(),!1}function wfu_separator_dragleave(e){if(e=e||window.event,e.preventDefault&&e.preventDefault(),!DraggedItem)return!1;if("wfu_component_separator_hor"==e.target.className){var t=document.getElementById("wfu_component_bar_hor");t.style.display="none"}else if("wfu_component_separator_ver"==e.target.className){var t=document.getElementById("wfu_component_bar_ver");t.style.display="none"}return!1}function wfu_separator_drop(e){e=e||window.event,e.preventDefault&&e.preventDefault();var t=e.dataTransfer.getData("Component");if(!t)return!1;var a=document.getElementById("wfu_component_box_"+t);a.style.display="none",a.className="wfu_component_box wfu_inbase",document.getElementById("wfu_component_box_container_"+t).appendChild(a);var l=wfu_admin_recreate_placements_text(e.target,t);return wfu_admin_recreate_placements_panel(l),document.getElementById("wfu_attribute_value_placements").value=l,wfu_generate_shortcode(),!1}function wfu_component_dragstart(e){e=e||window.event,e.dataTransfer.setData("Component",e.target.id.replace("wfu_component_box_","")),-1==e.target.className.indexOf("wfu_component_box_dragged")&&(e.target.className+=" wfu_component_box_dragged",DraggedItem=e.target),e.target.style.zIndex=3;var t=document.getElementById("wfu_componentlist_dragdrop");return t.className="wfu_componentlist_dragdrop wfu_componentlist_dragdrop_dragover",t.style.display="block",!1}function wfu_component_dragend(e){e=e||window.event,DraggedItem=null,e.target.style.zIndex=1;var t=document.getElementById("wfu_componentlist_dragdrop");return t.style.display="none",t.className="wfu_componentlist_dragdrop",e.target.className=e.target.className.replace(" wfu_component_box_dragged",""),document.getElementById("wfu_component_bar_ver").style.display="none",document.getElementById("wfu_component_bar_hor").style.display="none",!1}function wfu_admin_recreate_placements_text(e,t){function a(e){""!=d&&(d+=n),d+=e,n=""}for(var l=document.getElementById("wfu_placements_container"),n="",d="",u=0;u<l.childNodes.length;u++)item=l.childNodes[u],"wfu_component_separator_ver"==item.className?(""==n&&(n="+"),item==e&&(a(t),n="+")):"wfu_component_separator_hor"==item.className?(n="/",item==e&&(a(t),n="/")):"wfu_component_box"==item.className&&a(item.id.replace("wfu_component_box_",""));return d}function wfu_admin_recreate_placements_panel(e){for(var t,a,l,n=document.getElementById("wfu_placements_container"),d="",u=0;u<n.childNodes.length;u++)t=n.childNodes[u],"wfu_component_box"==t.className&&(d=t.id.replace("wfu_component_box_",""),t.style.display="inline-block",t.className="wfu_component_box wfu_inbase",document.getElementById("wfu_component_box_container_"+d).appendChild(t));n.innerHTML="",a=e.split("/");for(var u=0;u<a.length;u++){t=document.createElement("DIV"),t.className="wfu_component_separator_hor",t.setAttribute("draggable",!0),n.appendChild(t),t=document.createElement("DIV"),t.className="wfu_component_separator_ver",t.setAttribute("draggable",!0),n.appendChild(t),l=a[u].split("+");for(var r=0;r<l.length;r++)t=document.getElementById("wfu_component_box_"+l[r]),t&&(n.appendChild(t),t.className="wfu_component_box",t.style.display="inline-block",t=document.createElement("DIV"),t.className="wfu_component_separator_ver",t.setAttribute("draggable",!0),n.appendChild(t))}t=document.createElement("DIV"),t.className="wfu_component_separator_hor",t.setAttribute("draggable",!0),n.appendChild(t),t=document.createElement("DIV"),t.id="wfu_component_bar_hor",t.className="wfu_component_bar_hor",n.appendChild(t),t=document.createElement("DIV"),t.id="wfu_component_bar_ver",t.className="wfu_component_bar_ver",n.appendChild(t),wfu_attach_separator_dragdrop_events()}function wfu_subfolders_input_changed(e){e=e||window.event;var t=e.target,a=t.id.replace("wfu_subfolders_path_","");a=a.replace("wfu_subfolders_label_","");var l=document.getElementById("wfu_attribute_"+a);if(!(l.selectedIndex<0)){var n,d,u=document.getElementById("wfu_subfolders_path_"+a),r=document.getElementById("wfu_subfolders_label_"+a),o=document.getElementById("wfu_subfolders_ok_"+a),_="1"==document.getElementById("wfu_subfolders_isnewitem_"+a).value;if(_)n="",d="";else{var s=l.data;t=s[l.selectedIndex],n=t.path,d=t.label}if(u.value==n&&r.value==d)o.disabled=!0,_||wfu_subfolders_update_nav(a);else{o.disabled=!1;for(var f=document.getElementsByName("wfu_subfolder_nav_"+a),i=0;i<f.length;i++)f[i].disabled=!0}}}function wfu_subfolders_up_clicked(e){var t=document.getElementById("wfu_attribute_"+e);if(!(t.selectedIndex<0)){var a=t.data;item=a[t.selectedIndex];var l=item.index-1;if(!(0>l)){for(var n=-1,d=t.selectedIndex-1;d>=0;){if(a[d].level==item.level&&a[d].index==l){n=d;break}d--}if(-1!=n){var u=0;for(d=t.selectedIndex+1;d<a.length&&a[d].level>item.level;)u++,d++;a[n].index=item.index,item.index=l,t.data=a.slice(0,n).concat(a.slice(t.selectedIndex,t.selectedIndex+1+u)).concat(a.slice(n,t.selectedIndex)).concat(a.slice(t.selectedIndex+1+u));var r=wfu_update_subfolder_list(e);t.selectedIndex=n,wfu_subfolders_update_toolnav(e),item=t,r!==item.oldVal&&(item.oldVal=r,document.getElementById("wfu_attribute_value_"+e).value=r,wfu_generate_shortcode())}}}}function wfu_subfolders_down_clicked(e){var t=document.getElementById("wfu_attribute_"+e);if(!(t.selectedIndex<0)){var a=t.data;item=a[t.selectedIndex];var l=item.index+1,n=-1;for(curind=t.selectedIndex+1;curind<a.length;){if(a[curind].level==item.level){n=curind;break}if(a[curind].level<item.level)break;curind++}if(-1!=n){var d=0;for(curind=n+1;curind<a.length&&a[curind].level>item.level;)d++,curind++;a[n].index=item.index,item.index=l,t.data=a.slice(0,t.selectedIndex).concat(a.slice(n,n+1+d)).concat(a.slice(t.selectedIndex,n)).concat(a.slice(n+1+d));var u=wfu_update_subfolder_list(e);t.selectedIndex=t.selectedIndex+d+1,wfu_subfolders_update_toolnav(e),item=t,u!==item.oldVal&&(item.oldVal=u,document.getElementById("wfu_attribute_value_"+e).value=u,wfu_generate_shortcode())}}}function wfu_subfolders_left_clicked(e){var t=document.getElementById("wfu_attribute_"+e);if(!(t.selectedIndex<0)){var a=t.data;for(item=a[t.selectedIndex],curind=t.selectedIndex+1;curind<a.length&&a[curind].level>item.level;)a[curind].level--,curind++;item.level--;var l=wfu_update_subfolder_list(e);t.data=wfu_decode_subfolder_list(e),wfu_subfolders_update_toolnav(e),item=t,l!==item.oldVal&&(item.oldVal=l,document.getElementById("wfu_attribute_value_"+e).value=l,wfu_generate_shortcode())}}function wfu_subfolders_right_clicked(e){var t=document.getElementById("wfu_attribute_"+e);if(!(t.selectedIndex<0)){var a=t.data;for(item=a[t.selectedIndex],curind=t.selectedIndex+1;curind<a.length&&a[curind].level>item.level;)a[curind].level++,curind++;item.level++;var l=wfu_update_subfolder_list(e);t.data=wfu_decode_subfolder_list(e),wfu_subfolders_update_toolnav(e),item=t,l!==item.oldVal&&(item.oldVal=l,document.getElementById("wfu_attribute_value_"+e).value=l,wfu_generate_shortcode())}}function wfu_subfolders_def_clicked(e){var t=document.getElementById("wfu_attribute_"+e);if(!(t.selectedIndex<0)){var a=t.data;if(item=a[t.selectedIndex],item.default)item.default=!1;else{for(var l=0;l<a.length;l++)a[l].default=!1;item.default=!0}var n=wfu_update_subfolder_list(e);wfu_subfolders_update_toolnav(e),item=t,n!==item.oldVal&&(item.oldVal=n,document.getElementById("wfu_attribute_value_"+e).value=n,wfu_generate_shortcode())}}function wfu_subfolders_ok_clicked(e){var t=document.getElementById("wfu_attribute_"+e);if(!(t.selectedIndex<0)){var a=document.getElementById("wfu_subfolders_path_"+e),l=document.getElementById("wfu_subfolders_label_"+e);if(""==a.value||""==l.value)return void alert("Path or label cannot be empty!");var n=t.data,d="1"==document.getElementById("wfu_subfolders_isnewitem_"+e).value;if(d){var u=parseInt(document.getElementById("wfu_subfolders_newitemlevel_"+e).value),r={label:l.value,path:a.value,level:u,"default":!1},o=parseInt(document.getElementById("wfu_subfolders_newitemindex_"+e).value);o>=n.length?n.push(r):n.splice(o,0,r)}else item=n[t.selectedIndex],item.path=a.value,item.label=l.value;var _=wfu_update_subfolder_list(e);t.data=wfu_decode_subfolder_list(e),wfu_subfolders_update_toolnav(e),item=t,_!==item.oldVal&&(item.oldVal=_,document.getElementById("wfu_attribute_value_"+e).value=_,wfu_generate_shortcode())}}function wfu_subfolders_del_clicked(e){var t=document.getElementById("wfu_attribute_"+e);if(!(t.selectedIndex<0)){var a=t.data;item=a[t.selectedIndex];var l=0;for(curind=t.selectedIndex+1;curind<a.length&&a[curind].level>item.level;)l++,curind++;if(!(l>0)||confirm("Children items will be deleted as well. Proceed?")){a.splice(t.selectedIndex,1+l);var n=wfu_update_subfolder_list(e);t.data=wfu_decode_subfolder_list(e),wfu_subfolders_update_toolnav(e),item=t,n!==item.oldVal&&(item.oldVal=n,document.getElementById("wfu_attribute_value_"+e).value=n,wfu_generate_shortcode())}}}function wfu_subfolders_add_clicked(e){var t=document.getElementById("wfu_attribute_"+e);if(!(t.selectedIndex<0)){var a=t.data,l=t.selectedIndex;item=a[l];var n=t.options,d=document.createElement("option");d.value="",d.innerHTML="",n.add(d,l),t.selectedIndex=l;var u=document.getElementById("wfu_subfolder_tools_"+e),r=document.getElementById("wfu_subfolders_path_"+e),o=document.getElementById("wfu_subfolders_label_"+e),_=document.getElementById("wfu_subfolders_ok_"+e),s=document.getElementById("wfu_subfolders_browse_"+e);u.className="wfu_subfolder_tools_container",o.disabled=!1,_.disabled=!0,document.getElementById("wfu_subfolders_isnewitem_"+e).value="1",document.getElementById("wfu_subfolders_newitemindex_"+e).value=l,document.getElementById("wfu_subfolders_newitemlevel_"+e).value=item.level,document.getElementById("wfu_subfolders_newitemlevel2_"+e).value="",r.disabled=0==item.level,s.disabled=0==item.level,0==item.level?(r.value="{root}",o.value="{upload folder}"):(r.value="",o.value="");for(var f=document.getElementsByName("wfu_subfolder_nav_"+e),i=0;i<f.length;i++)f[i].disabled=!0}}function wfu_subfolders_browse_clicked(e){var t=wfu_GetHttpRequestObject();if(null!=t){var a=null;try{var a=new FormData}catch(l){}if(null!=a){for(var n=document.getElementById("wfu_global_dialog_container"),d=document.getElementById("wfu_subfolders_browser_"+e),u=document.getElementById("wfu_subfolders_browse_"+e),r=document.getElementById("wfu_subfolders_inner_shadow_"+e),o=document.getElementById("wfu_subfolders_browser_msgcont_"+e),_=document.getElementById("wfu_subfolders_browser_msg_"+e),s=document.getElementById("wfu_subfolders_browser_img_"+e),f=document.getElementById("wfu_subfolders_browser_ok_"+e),i=document.getElementById("wfu_subfolders_browser_list_"+e);i.options.length>0;)i.options.remove(0);f.disabled=!0,f.onclick=function(){wfu_folder_browser_cancel_clicked(e)},_.innerHTML="loading folder contents...",s.style.display="inline",o.style.display="block",n.style.display="block",d.style.display="block",d.style.left=u.offsetLeft+u.offsetWidth-d.offsetWidth+"px",d.style.top=u.offsetTop+u.offsetHeight-d.offsetHeight+"px",r.style.display="block",n.onclick=function(){wfu_folder_browser_cancel_clicked(e)};var c=document.getElementById("wfu_attribute_uploadpath").value;"/"==c.substr(c.length-1)&&(c=c.substr(0,c.length-1));var m=wfu_get_relative_path(e).split(","),w=c+m[0];"/"!=w.substr(0)&&(w="/"+w);var g="";2==m.length&&(g=m[1]),a.append("action","wfu_ajax_action_read_subfolders"),a.append("folder1",wfu_plugin_encode_string(w)),a.append("folder2",wfu_plugin_encode_string(g)),t.key=e,t.addEventListener("load",wfu_readfolderComplete,!1),t.addEventListener("error",wfu_readfolderFailed,!1),t.addEventListener("abort",wfu_readfolderCanceled,!1),t.open("POST",AdminParams.wfu_ajax_url),t.send(a)}}}function wfu_readfolderComplete(e){var t=e.target.key,a=document.getElementById("wfu_subfolders_browser_msgcont_"+t),l=document.getElementById("wfu_subfolders_browser_msg_"+t),n=document.getElementById("wfu_subfolders_browser_img_"+t),d=document.getElementById("wfu_subfolders_browser_list_"+t),u=document.getElementById("wfu_subfolders_browser_ok_"+t),r=document.getElementById("wfu_subfolders_path_"+t),o=document.getElementById("wfu_subfolders_label_"+t),_=e.target.responseText;if(-1!=_){var s="wfu_read_subfolders:",f=e.target.responseText.indexOf(s);-1==f&&(f=e.target.responseText.length);var i=(e.target.responseText.substr(0,f),e.target.responseText.substr(f+s.length,e.target.responseText.length-f-s.length));f=i.indexOf(":");var c=i.substr(0,f);if(txt_value=i.substr(f+1,i.length-f-1),"success"==c){for(var m,w=wfu_plugin_decode_string(txt_value),g=w.split(","),p=0,v=0;v<g.length;v++)""!=g[v]&&(m=document.createElement("option"),m.value=g[v],m.innerHTML=g[v].replace("*","&nbsp;&nbsp;&nbsp;"),d.add(m),p++);0==p&&(m=document.createElement("option"),m.value="",m.innerHTML="{empty}",m.disabled=!0,d.add(m)),d.selectedIndex=-1,u.onclick=function(){var e=d.options[d.selectedIndex].value,a=parseInt(document.getElementById("wfu_subfolders_newitemlevel_"+t).value);("*"==e.substr(0,1)||0==a)&&(document.getElementById("wfu_subfolders_newitemlevel_"+t).value=a+1,a>0&&(e=e.substr(1))),r.value=e,o.value=e,wfu_folder_browser_cancel_clicked(t),wfu_subfolders_ok_clicked(t)},a.style.display="none"}else"error"==c?(l.innerHTML=txt_value,n.style.display="none",u.disabled=!1):(l.innerHTML="Unknown error",n.style.display="none",u.disabled=!1)}}function wfu_readfolderFailed(e){var t=e.target.key,a=document.getElementById("wfu_subfolders_browser_msg_"+t),l=document.getElementById("wfu_subfolders_browser_img_"+t),n=document.getElementById("wfu_subfolders_browser_ok_"+t);a.innerHTML="Unknown error",l.style.display="none",n.disabled=!1}function wfu_readfolderCanceled(e){var t=e.target.key,a=document.getElementById("wfu_subfolders_browser_msg_"+t),l=document.getElementById("wfu_subfolders_browser_img_"+t),n=document.getElementById("wfu_subfolders_browser_ok_"+t);a.innerHTML="Unknown error",l.style.display="none",n.disabled=!1}function wfu_subfolders_browser_list_changed(e){var t=document.getElementById("wfu_subfolders_browser_list_"+e),a=document.getElementById("wfu_subfolders_browser_ok_"+e);a.disabled=t.selectedIndex<0}function wfu_folder_browser_cancel_clicked(e){var t=document.getElementById("wfu_global_dialog_container"),a=document.getElementById("wfu_subfolders_browser_"+e),l=(document.getElementById("wfu_subfolders_browse_"+e),document.getElementById("wfu_subfolders_inner_shadow_"+e));t.onclick=null,l.style.display="none",a.style.display="none",t.style.display="none"}function wfu_get_relative_path(e){var t=document.getElementById("wfu_attribute_"+e);if(!(t.selectedIndex<0)){var a,l=t.data,n="1"==document.getElementById("wfu_subfolders_isnewitem_"+e).value;a=n?parseInt(document.getElementById("wfu_subfolders_newitemlevel_"+e).value):l[t.selectedIndex].level;for(var d="/",u=t.selectedIndex-1,r=a;u>=0&&r>1;)l[u].level<r&&(d="/"+l[u].path+d,r=l[u].level),u--;return n&&"1"==document.getElementById("wfu_subfolders_newitemlevel2_"+e).value&&a>0&&t.selectedIndex>0&&(d+=","+l[t.selectedIndex-1].path),d}}function wfu_subfolders_changed(e){wfu_update_subfolder_list(e),wfu_subfolders_update_toolnav(e)}function wfu_subfolders_update_toolnav(e){var t,a,l=document.getElementById("wfu_attribute_"+e),n=document.getElementById("wfu_subfolder_tools_"+e),d=document.getElementById("wfu_subfolders_path_"+e),u=document.getElementById("wfu_subfolders_label_"+e),r=document.getElementById("wfu_subfolders_ok_"+e),o=document.getElementById("wfu_subfolders_browse_"+e);if(document.getElementById("wfu_subfolders_isnewitem_"+e).value="",document.getElementById("wfu_subfolders_newitemindex_"+e).value="",document.getElementById("wfu_subfolders_newitemlevel_"+e).value="",document.getElementById("wfu_subfolders_newitemlevel2_"+e).value="",null==l.data?(t=wfu_decode_subfolder_list(e),l.data=t):t=l.data,0===l.data.length?(l.className="wfu_select_folders wfu_select_folders_empty",l.options[0].innerHTML="press here"):l.className="wfu_select_folders",l.selectedIndex<0)n.className="wfu_subfolder_tools_container wfu_subfolder_tools_disabled",d.disabled=!0,u.disabled=!0,r.disabled=!0,o.disabled=!0,u.value="",d.value="";else if(l.selectedIndex>=l.options.length-1){n.className="wfu_subfolder_tools_container",u.disabled=!1,r.disabled=!0,document.getElementById("wfu_subfolders_isnewitem_"+e).value="1",document.getElementById("wfu_subfolders_newitemindex_"+e).value=t.length;var _;_=0==t.length?0:0==t[t.length-1].level?1:t[t.length-1].level,document.getElementById("wfu_subfolders_newitemlevel_"+e).value=_,document.getElementById("wfu_subfolders_newitemlevel2_"+e).value="1",d.disabled=0==_,o.disabled=!1,0==_?(d.value="{root}",u.value="{upload folder}"):(d.value="",u.value="")}else n.className="wfu_subfolder_tools_container",u.disabled=!1,r.disabled=!0,a=t[l.selectedIndex],d.disabled=0==a.level,o.disabled=0==a.level,u.value=a.label,d.value=a.path;var s=document.getElementsByName("wfu_subfolder_nav_"+e);if(l.selectedIndex<0||l.selectedIndex>=l.options.length-1)for(var f=0;f<s.length;f++)s[f].disabled=!0;else wfu_subfolders_update_nav(e)}function wfu_subfolders_update_nav(e){var t=document.getElementById("wfu_attribute_"+e),a=document.getElementById("wfu_subfolders_up_"+e),l=document.getElementById("wfu_subfolders_down_"+e),n=document.getElementById("wfu_subfolders_left_"+e),d=document.getElementById("wfu_subfolders_right_"+e),u=document.getElementById("wfu_subfolders_add_"+e),r=document.getElementById("wfu_subfolders_def_"+e),o=document.getElementById("wfu_subfolders_del_"+e),_=t.data,s=_[t.selectedIndex];for(a.disabled=s.index<=0,ind=t.selectedIndex+1,nextind=0;ind<_.length;){if(_[ind].level==s.level){nextind=_[ind].index;break}if(_[ind].level<s.level)break;ind++}l.disabled=0==s.level||0==nextind,n.disabled=0==t.selectedIndex&&s.level<1||t.selectedIndex>0&&s.level<=1,prevlevel=t.selectedIndex>=1?_[t.selectedIndex-1].level:0,d.disabled=s.level-prevlevel>0,u.disabled=0==s.level,r.disabled=!1,r.className="button"+(s.default?" wfu_subfolder_nav_pressed":""),o.disabled=!1}function wfu_decode_subfolder(e){var t={label:"",path:"",level:0,"default":!1};e=e.trim();for(var a=0,l=!1;a<e.length&&"*"==e.substr(a,1);)a++;e=e.substr(a,e.length-a),"&"==e.substr(0,1)&&(e=e.substr(1),l=!0),t.level=a,t.default=l;var n=e.split("/");return 1==n.length?(t.path=n[0],t.label=n[0]):n.length>1&&(t.path=n[0],t.label=n[1]),0==a&&(t.path="{root}",""==t.label&&(t.label="{upload folder}")),t}function wfu_decode_subfolder_list(e){for(var t,a=document.getElementById("wfu_attribute_"+e).options,l=Array(),n=["root"],d=[0],u=-1,r=0;r<a.length-1;r++){for(l.push(wfu_decode_subfolder(wfu_plugin_decode_string(a[r].value))),n.length>l[r].level?n[l[r].level]=l[r].path:n.push(l[r].path),t="",j=1;j<=l[r].level;j++)t+=n[j]+"/";l[r].fullpath=t,d.length<=l[r].level&&d.push(0),l[r].index=l[r].level>u?0:d[l[r].level]+1,d[l[r].level]=l[r].index,u=l[r].level}return l}function wfu_update_subfolder_list(e){var t=document.getElementById("wfu_attribute_"+e).options,a=document.getElementById("wfu_attribute_"+e),l=a.data;if(null!=l){var n,d,u="";t.length=l.length+1;for(var r=0;r<l.length;r++){for(n="",d="",j=0;j<l[r].level;j++)n+="*",d+="&nbsp;&nbsp;&nbsp;";l[r].default?(n+="&",t[r].className="wfu_select_folders_option_default"):t[r].className="",n+=l[r].path+"/"+l[r].label,d+=l[r].label,t[r].value=wfu_plugin_encode_string(n),t[r].innerHTML=d,""!=u&&(u+=","),u+=n}return t[l.length].value="",t[l.length].innerHTML="",u}}function wfu_userdata_edit_field(e,t,a){for(var l,n=0;n<e.childNodes.length;n++)l=e.childNodes[n],"INPUT"==l.tagName?"text"==l.type?(l.value=t,wfu_attach_element_handlers(l,wfu_update_userfield_value)):"checkbox"==l.type&&(l.checked=a):"DIV"==l.tagName&&(l.className="wfu_userdata_action")}function wfu_userdata_add_field(e){var t=e.parentNode,a=t.cloneNode(!0);wfu_userdata_edit_field(a,"",!1),t.parentNode.insertBefore(a,t.nextSibling)}function wfu_userdata_remove_field(e){for(var t=e.parentNode,a=t.parentNode,l=null,n=0;n<a.childNodes.length;n++)if(1===a.childNodes[n].nodeType){l=a.childNodes[n];break}if(t!=l){t.parentNode.removeChild(t);for(var n=0;n<l.childNodes.length;n++)if(1===l.childNodes[n].nodeType){wfu_update_userfield_value({target:l.childNodes[n]});break}}}function wfu_generate_shortcode(){for(var e,t=document.getElementById("wfu_attribute_defaults"),a=(document.getElementById("wfu_attribute_values"),""),l="",n="[wordpress_file_upload",d="",u=0;u<t.childNodes.length;u++)e=t.childNodes[u],1===e.nodeType&&(a=e.id.replace("wfu_attribute_default_",""),l=document.getElementById("wfu_attribute_value_"+a).value,e.value!=l&&(d+=" "+a+'="'+l+'"'));n+=d+"]",document.getElementById("wfu_shortcode").value=n,ShortcodeString=d.substr(1),document.getElementById("wfu_update_shortcode")&&(document.getElementById("wfu_update_shortcode").disabled=wfu_plugin_encode_string(n)==document.getElementById("wfu_shortcode_original_enc").value),Autosave&&wfu_schedule_save_shortcode()}function wfu_update_text_value(e){e=e||window.event;var t=e.target,a=t.id.replace("wfu_attribute_",""),l=t.value;l=l.replace(/(\r\n|\n|\r)/gm,"%n%"),l=l.replace(/\"/gm,"%dq%"),l=l.replace(/\[/gm,"%brl%"),l=l.replace(/\]/gm,"%brr%"),l!==t.oldVal&&(t.oldVal=l,document.getElementById("wfu_attribute_value_"+a).value=l,wfu_generate_shortcode())}function wfu_update_triplecolor_value(e){e=e||window.event;var t=e.target,a=t.id.replace("wfu_attribute_","");a=a.replace("_color",""),a=a.replace("_bgcolor",""),a=a.replace("_borcolor",""),t=document.getElementById("wfu_attribute_"+a+"_color");var l=t.value+","+document.getElementById("wfu_attribute_"+a+"_bgcolor").value+","+document.getElementById("wfu_attribute_"+a+"_borcolor").value;l!==t.oldVal&&(t.oldVal=l,document.getElementById("wfu_attribute_value_"+a).value=l,wfu_generate_shortcode())}function wfu_update_dimension_value(e){e=e||window.event;var t=e.target,a=t.name.replace("wfu_dimension_elements_",""),l=document.getElementsByName(t.name);t=l[0];for(var n="",d="",u=0;u<l.length;u++)d=l[u].id.replace("wfu_attribute_"+a+"_",""),""!=n&&""!=l[u].value&&(n+=", "),""!=l[u].value&&(n+=d+":"+l[u].value);n!==t.oldVal&&(t.oldVal=n,document.getElementById("wfu_attribute_value_"+a).value=n,wfu_generate_shortcode())}function wfu_update_ptext_value(e){e=e||window.event;var t=e.target,a=t.id.replace("wfu_attribute_","");a=a.substr(2);var l=document.getElementById("wfu_attribute_s_"+a).value,n=document.getElementById("wfu_attribute_p_"+a).value,d=l+"/"+n;d!==t.oldVal&&(t.oldVal=d,document.getElementById("wfu_attribute_value_"+a).value=d),wfu_generate_shortcode()}function wfu_update_mchecklist_value(e){var t="",a=(document.getElementById("wfu_attribute_"+e),document.getElementById("wfu_attribute_"+e+"_all"));a.checked?(jQuery("#wfu_attribute_"+e+" input").prop("disabled",!0),jQuery("#wfu_attribute_"+e+" input").prop("checked",!0),t="all"):(jQuery("#wfu_attribute_"+e+" input").prop("disabled",!1),jQuery("#wfu_attribute_"+e+" input").each(function(){jQuery(this).prop("checked")&&(t+=","+jQuery(this).next().html())}),t=t.substr(1)),document.getElementById("wfu_attribute_value_"+e).value=t,wfu_generate_shortcode()}function wfu_update_rolelist_value(e){var t="",a=document.getElementById("wfu_attribute_"+e),l=document.getElementById("wfu_attribute_"+e+"_all");if(l.checked)a.disabled=!0,t="all";else{a.disabled=!1;for(var n=a.options,d=0;d<n.length;d++)n[d].selected&&(""!=t&&(t+=","),t+=n[d].value)}document.getElementById("wfu_attribute_value_"+e).value=t,wfu_generate_shortcode()}function wfu_update_userfield_value(e){e=e||window.event;for(var t=e.target,a=t.parentNode,l=a.parentNode,n="",d=!1,u="",r=0;r<l.childNodes.length;r++)if(a=l.childNodes[r],"DIV"===a.tagName){for(var o=0;o<a.childNodes.length;o++)"INPUT"==a.childNodes[o].tagName&&("text"==a.childNodes[o].type?(n=a.childNodes[o].value,0==r&&(t=a.childNodes[o])):"checkbox"==a.childNodes[o].type&&(d=a.childNodes[o].checked));""!=u&&""!=n&&(u+="/"),""!=n&&d&&(u+="*"),""!=n&&(u+=n)}u!==t.oldVal&&(t.oldVal=u,document.getElementById("wfu_attribute_value_userdatalabel").value=u,wfu_generate_shortcode(),wfu_update_userfield_variables())}function wfu_update_userfield_variables(){for(var e=document.getElementById("wfu_attribute_value_userdatalabel").value,t=document.getElementById("wfu_wrapper"),a=document.getElementsByClassName("wfu_shadow_userdata","div",t),l=document.getElementsByName("wfu_userfield_select"),n=0;n<l.length;n++)l[n].style.display="none";if(0!=a.length&&"block"!=a[0].style.display){for(var d='<option style="display:none;">%userdataXXX%</option>',u=e.split("/"),r="",n=1;n<=u.length;n++)r=u[n-1],"*"==r[0]&&(r=r.substr(1)),d+='<option value="%userdata'+n+'%">'+n+": "+r+"</option>";for(var n=0;n<l.length;n++)l[n].innerHTML=d,l[n].style.display="inline-block"}}function wfu_attach_element_handlers(e,t){for(var a=["DOMAttrModified","textInput","input","change","keypress","paste","focus","propertychange"],l=0;l<a.length;l++)wfu_addEventHandler(e,a[l],t)}function wfu_Attach_Admin_Events(e){Autosave=e,wfu_generate_shortcode(),wfu_update_userfield_variables(),wfu_Attach_Admin_DragDrop_Events();for(var t=document.getElementsByName("wfu_text_elements"),a=0;a<t.length;a++)wfu_attach_element_handlers(t[a],wfu_update_text_value);for(var l=document.getElementsByName("wfu_ptext_elements"),a=0;a<l.length;a++)wfu_attach_element_handlers(l[a],wfu_update_ptext_value);for(var n=document.getElementsByName("wfu_triplecolor_elements"),a=0;a<n.length;a++)wfu_attach_element_handlers(n[a],wfu_update_triplecolor_value);for(var d=document.getElementsByName("wfu_dimension_elements_widths"),a=0;a<d.length;a++)wfu_attach_element_handlers(d[a],wfu_update_dimension_value);d=document.getElementsByName("wfu_dimension_elements_heights");for(var a=0;a<d.length;a++)wfu_attach_element_handlers(d[a],wfu_update_dimension_value);for(var u=document.getElementsByName("wfu_userfield_elements"),a=0;a<u.length;a++)wfu_attach_element_handlers(u[a],wfu_update_userfield_value);for(var r=document.getElementsByName("wfu_subfolder_tools_input"),a=0;a<r.length;a++)wfu_attach_element_handlers(r[a],wfu_subfolders_input_changed);""!=document.getElementById("wfu_shortcode_postid").value&&setTimeout(function(){wfu_check_page_obsolescence()},CheckObsolescenceTimeOut)}function wfu_insert_variable(e){var t=e.className.replace("wfu_variable wfu_variable_",""),a=document.getElementById("wfu_attribute_"+t),l=a.selectionStart,n=a.value;a.value=n.substr(0,l)+e.innerHTML+n.substr(l),wfu_update_text_value({target:a})}function wfu_insert_userfield_variable(e){var t=e.className.replace("wfu_variable wfu_variable_",""),a=document.getElementById("wfu_attribute_"+t),l=a.selectionStart,n=a.value;a.value=n.substr(0,l)+e.value+n.substr(l),e.value="%userdataXXX%",wfu_update_text_value({target:a})
2
- }function wfu_GetHttpRequestObject(){var e=null;try{e=new XMLHttpRequest}catch(t){try{e=new ActiveXObject("Msxml2.XMLHTTP")}catch(a){try{e=new ActiveXObject("Microsoft.XMLHTTP")}catch(t){}}}if(null==e&&window.createRequest)try{xmlhttp=window.createRequest()}catch(t){}return e}function wfu_plugin_encode_string(e){var t,a=0,l="",n="";for(a=0;a<e.length;a++)t=e.charCodeAt(a),t>=2048?t=((16773120&t|917504)<<4)+((4032&t|8192)<<2)+(63&t|128):t>=128&&(t=((65472&t|12288)<<2)+(63&t|128)),n=t.toString(16),(1==n.length||3==n.length||5==n.length)&&(n="0"+n),l+=n;return l}function wfu_plugin_decode_string(e){for(var t,a,l=0,n="";l<e.length;)t=parseInt(e.substr(l,2),16),a=128>t?t:224>t?((31&t)<<6)+(63&parseInt(e.substr(l+=2,2),16)):((15&t)<<12)+((63&parseInt(e.substr(l+=2,2),16))<<6)+(63&parseInt(e.substr(l+=2,2),16)),n+=String.fromCharCode(a),l+=2;return n}function wfu_schedule_save_shortcode(){var e=new Date,t=ShortcodeNextSave-e.getTime();null!=ShortcodeTimeOut&&(clearTimeout(ShortcodeTimeOut),ShortcodeTimeOut=null),0>=t?wfu_save_shortcode():ShortcodeTimeOut=setTimeout(function(){wfu_save_shortcode()},t)}function wfu_check_page_obsolescence(){PageObsolete||PageUpdating||""==document.getElementById("wfu_shortcode_postid").value}function wfu_save_shortcode(){if(!PageObsolete){var e=wfu_GetHttpRequestObject();if(null!=e){PageUpdating=!0,document.getElementById("wfu_update_failed_message").style.display="none";var t=AdminParams.wfu_ajax_url;params=new Array(6),params[0]=new Array(2),params[0][0]="action",params[0][1]="wfu_ajax_action_save_shortcode",params[1]=new Array(2),params[1][0]="shortcode",params[1][1]=wfu_plugin_encode_string(ShortcodeString),params[2]=new Array(2),params[2][0]="shortcode_original",params[2][1]=document.getElementById("wfu_shortcode_original_enc").value,params[3]=new Array(2),params[3][0]="post_id",params[3][1]=document.getElementById("wfu_shortcode_postid").value,params[4]=new Array(2),params[4][0]="post_hash",params[4][1]=document.getElementById("wfu_shortcode_posthash").value,params[5]=new Array(2),params[5][0]="shortcode_position",params[5][1]=document.getElementById("wfu_shortcode_position").value;for(var a="",l=0;l<params.length;l++)a+=(l>0?"&":"")+params[l][0]+"="+encodeURI(params[l][1]);var n=new Date;Autosave?ShortcodeNextSave=n.getTime()+5e3:document.getElementById("wfu_update_shortcode")&&(document.getElementById("wfu_update_shortcode_wait").style.display="inline"),e.open("POST",t,!0),e.setRequestHeader("Content-type","application/x-www-form-urlencoded"),e.onreadystatechange=function(){if(4==e.readyState&&200==e.status){PageUpdating=!1;var t="wfu_save_shortcode:",a=e.responseText.indexOf(t);-1==a&&(a=e.responseText.length);var l=(e.responseText.substr(0,a),e.responseText.substr(a+t.length,e.responseText.length-a-t.length));a=l.indexOf(":");var d=l.substr(0,a);txt_value=l.substr(a+1,l.length-a-1),"success"==d?(Autosave?(document.getElementById("wfu_save_label").innerHTML="saved",document.getElementById("wfu_save_label").className="wfu_save_label",document.getElementById("wfu_save_label").style.opacity=1,wfu_fadeout_element(300),ShortcodeNextSave=n.getTime()+1e3,null!=ShortcodeTimeOut&&wfu_schedule_save_shortcode()):document.getElementById("wfu_update_shortcode")&&(document.getElementById("wfu_update_shortcode_wait").style.display="none",document.getElementById("wfu_update_shortcode").disabled=!0,window.plugin_window&&window.plugin_window.location.reload(!0)),""!=document.getElementById("wfu_shortcode_postid").value&&(document.getElementById("wfu_shortcode_original_enc").value=wfu_plugin_encode_string("[wordpress_file_upload "+ShortcodeString+"]"),document.getElementById("wfu_shortcode_posthash").value=txt_value,setTimeout(function(){wfu_check_page_obsolescence()},CheckObsolescenceTimeOut))):(Autosave&&(document.getElementById("wfu_save_label").innerHTML="not saved",document.getElementById("wfu_save_label").className="wfu_save_label_fail",document.getElementById("wfu_save_label").style.opacity=1,wfu_fadeout_element(300)),"fail"==d&&("post_modified"==txt_value?(PageObsolete=!0,document.getElementById("wfu_update_shortcode")&&(document.getElementById("wfu_update_shortcode").disabled=!0),document.getElementById("wfu_update_rejected_message").style.display="block"):document.getElementById("wfu_update_failed_message").style.display="block"))}},e.send(a)}}}function wfu_adjust_opacity(e){document.getElementById("wfu_save_label").style.opacity=e}function wfu_fadeout_element(e){for(var t=20,a=0,l=0;t>l;l++)a=1-l/t,setTimeout('wfu_adjust_opacity("'+a.toString()+'")',l*e/t);setTimeout('wfu_adjust_opacity("0.0")',l*e/t)}function wfu_apply_value(e,t,a){if("onoff"==t)document.getElementById("wfu_attribute_"+e).className="wfu_onoff_container_"+("true"!=a?"on":"off"),wfu_admin_onoff_clicked(e);else if("text"==t||"ltext"==t||"integer"==t||"float"==t||"mtext"==t||"color"==t){var l=document.getElementById("wfu_attribute_"+e);if(a=a.replace(/\%n\%/gm,"\n"),a=a.replace(/\%dq\%/gm,'"'),a=a.replace(/\%brl\%/gm,"["),a=a.replace(/\%brr\%/gm,"]"),"color"==t){var n=colourNameToHex(a);n||(n=a),jQuery("#wfu_attribute_"+e).wpColorPicker("color",n)}l.value=a,wfu_update_text_value({target:l})}else if("placements"==t)wfu_admin_recreate_placements_panel(a),document.getElementById("wfu_attribute_value_placements").value=a,wfu_generate_shortcode();else if("radio"==t){for(var d=document.getElementsByName("wfu_radioattribute_"+e),u=0;u<d.length;u++)d[u].checked=d[u].value==a||"*"+d[u].value==a;wfu_admin_radio_clicked(e)}else if("ptext"==t){a=a.replace(/\%n\%/gm,"\n"),a=a.replace(/\%dq\%/gm,'"'),a=a.replace(/\%brl\%/gm,"["),a=a.replace(/\%brr\%/gm,"]");var r=a.split("/"),o=r.length<1?"":r[0],_=r.length<2?o:r[1],s=document.getElementById("wfu_attribute_s_"+e);s.value=o;var f=document.getElementById("wfu_attribute_p_"+e);f.value=_,wfu_update_ptext_value({target:s}),wfu_update_ptext_value({target:f})}else if("mchecklist"==t){if(a=a.toLowerCase(),"all"==a)document.getElementById("wfu_attribute_"+e+"_all").checked=!0;else{document.getElementById("wfu_attribute_"+e+"_all").checked=!1;for(var i=a.split(","),u=0;u<i.length;u++)i[u]=i[u].trim();jQuery("#wfu_attribute_"+e+" input").each(function(){jQuery(this).prop("checked",i.indexOf(jQuery(this).next().html())>-1)})}wfu_update_mchecklist_value(e)}else if("rolelist"==t){if(a=a.toLowerCase(),"all"==a)document.getElementById("wfu_attribute_"+e+"_all").checked=!0;else{document.getElementById("wfu_attribute_"+e+"_all").checked=!1;for(var c=a.split(","),u=0;u<c.length;u++)c[u]=c[u].trim();for(var l=document.getElementById("wfu_attribute_"+e),u=0;u<l.options.length;u++)l.options[u].selected=c.indexOf(l.options[u].value)>-1}wfu_update_rolelist_value(e)}else if("dimensions"==t){for(var m,w,g,l,p=a.split(","),v=document.getElementsByName("wfu_dimension_elements_"+e),u=0;u<v.length;u++)v[u].value="";for(var u=0;u<p.length;u++)m=p[u].split(":",2),w=m.length<1?"":m[0],g=m.length<2?w:m[1],l=document.getElementById("wfu_attribute_"+e+"_"+w.trim()),l&&(l.value=g.trim());l=v[0],wfu_update_dimension_value({target:l})}else if("userfields"==t){for(var b,h=a.split("/"),y=Array(),u=0;u<h.length;u++)b="*"==h[u].substr(0,1),b&&(h[u]=h[u].substr(1)),""!=h[u]&&y.push({name:h[u],required:b});for(var I=document.getElementById("wfu_attribute_"+e),E=null,B=Array(),u=0;u<I.childNodes.length;u++)1===I.childNodes[u].nodeType&&(null==E?E=I.childNodes[u]:B.push(I.childNodes[u]));for(var u=0;u<B.length;u++)I.removeChild(B[u]);wfu_userdata_edit_field(E,"",!1);for(var x,N=E,u=0;u<y.length;u++)0==u?wfu_userdata_edit_field(E,y[u].name,y[u].required):(x=N.cloneNode(!0),wfu_userdata_edit_field(x,y[u].name,y[u].required),I.insertBefore(x,N.nextSibling),N=x);for(var l,u=0;u<E.childNodes.length&&(l=E.childNodes[u],"INPUT"!=l.tagName);u++);wfu_update_userfield_value({target:l})}else if("color-triplet"==t){for(var k=a.split(","),u=0;u<k.length;u++)k[u]=k[u].trim();2==k.length?k=[k[0],k[1],"#000000"]:1==k.length?k=[k[0],"#FFFFFF","#000000"]:k.length<3&&(k=["#000000","#FFFFFF","#000000"]);var n=colourNameToHex(k[0]);n||(n=k[0]),jQuery("#wfu_attribute_"+e+"_color").wpColorPicker("color",n);var l=document.getElementById("wfu_attribute_"+e+"_color");l.value=k[0],n=colourNameToHex(k[1]),n||(n=k[1]),jQuery("#wfu_attribute_"+e+"_bgcolor").wpColorPicker("color",n),document.getElementById("wfu_attribute_"+e+"_bgcolor").value=k[1],n=colourNameToHex(k[2]),n||(n=k[2]),jQuery("#wfu_attribute_"+e+"_borcolor").wpColorPicker("color",n),document.getElementById("wfu_attribute_"+e+"_borcolor").value=k[2],wfu_update_triplecolor_value({target:l})}else if("folderlist"==t){for(var i=wfu_parse_folderlist_js(a),T=document.getElementById("wfu_attribute_"+e).options;T.length>0;)T.remove(0);for(var H,A,j,C,O,D,u=0;u<i.path.length;u++){A=i.path[u],"/"==A.substr(A.length,1)&&(A=A.substr(0,A.length-1)),j=A.split("/"),A=j[j.length-1],O=parseInt(i.level[u]),C="",D="";for(var S=0;O>S;S++)C+="&nbsp;&nbsp;&nbsp;",D+="*";C+=i.label[u],i.default[u]&&(D+="&"),D+=""==A?"{root}/"+i.label[u]:A+i.label[u],H=document.createElement("option"),H.className=i.default[u]?"wfu_select_folders_option_default":"",H.value=wfu_plugin_encode_string(D),H.innerHTML=C,T.add(H)}H=document.createElement("option"),H.value="",H.innerHTML="",T.add(H);var L=document.getElementById("wfu_attribute_"+e);L.data=wfu_decode_subfolder_list(e),wfu_subfolders_update_toolnav(e),l=L,a!==l.oldVal&&(l.oldVal=a,document.getElementById("wfu_attribute_value_"+e).value=a,wfu_generate_shortcode())}}function wfu_parse_folderlist_js(e){var t=Object();t.path=Array(),t.label=Array(),t.level=Array(),t.default=Array();var a=e.split(",");if(0==a.length)return t;if(1==a.length&&""==a[0].trim())return t;for(var l,n,d,u,r,o,_,s=["root"],f=0,i=0,c=-1,m=0;m<a.length;m++){for(l=a[m].trim(),n=0,d="",u=!1;n<l.length&&"*"==l.substr(n,1);)n++,d+="&nbsp;&nbsp;&nbsp;";if(1>=n-f&&(n>0||0==i)&&(l=l.substr(n,l.length-n),"&"==l.substr(0,1)&&(l=l.substr(1),u=!0),subfolder_items=l.split("/"),subfolder_items.length<2&&subfolder_items.push(""),""!=subfolder_items[1]?(r=subfolder_items[0],o=subfolder_items[1]):(r=l,o=l),""!=r)){u&&-1==c?c=t.path.length:u=!1,0==n&&(i=1),s.length>n?s[n]=r:s.push(r),_="";for(var w=1;n>=w;w++)_+=s[w]+"/";t.path.push(_),t.label.push(o),t.level.push(n),t.default.push(u),f=n}}return t}function colourNameToHex(e){var t={aliceblue:"#f0f8ff",antiquewhite:"#faebd7",aqua:"#00ffff",aquamarine:"#7fffd4",azure:"#f0ffff",beige:"#f5f5dc",bisque:"#ffe4c4",black:"#000000",blanchedalmond:"#ffebcd",blue:"#0000ff",blueviolet:"#8a2be2",brown:"#a52a2a",burlywood:"#deb887",cadetblue:"#5f9ea0",chartreuse:"#7fff00",chocolate:"#d2691e",coral:"#ff7f50",cornflowerblue:"#6495ed",cornsilk:"#fff8dc",crimson:"#dc143c",cyan:"#00ffff",darkblue:"#00008b",darkcyan:"#008b8b",darkgoldenrod:"#b8860b",darkgray:"#a9a9a9",darkgreen:"#006400",darkkhaki:"#bdb76b",darkmagenta:"#8b008b",darkolivegreen:"#556b2f",darkorange:"#ff8c00",darkorchid:"#9932cc",darkred:"#8b0000",darksalmon:"#e9967a",darkseagreen:"#8fbc8f",darkslateblue:"#483d8b",darkslategray:"#2f4f4f",darkturquoise:"#00ced1",darkviolet:"#9400d3",deeppink:"#ff1493",deepskyblue:"#00bfff",dimgray:"#696969",dodgerblue:"#1e90ff",firebrick:"#b22222",floralwhite:"#fffaf0",forestgreen:"#228b22",fuchsia:"#ff00ff",gainsboro:"#dcdcdc",ghostwhite:"#f8f8ff",gold:"#ffd700",goldenrod:"#daa520",gray:"#808080",green:"#008000",greenyellow:"#adff2f",honeydew:"#f0fff0",hotpink:"#ff69b4","indianred ":"#cd5c5c","indigo ":"#4b0082",ivory:"#fffff0",khaki:"#f0e68c",lavender:"#e6e6fa",lavenderblush:"#fff0f5",lawngreen:"#7cfc00",lemonchiffon:"#fffacd",lightblue:"#add8e6",lightcoral:"#f08080",lightcyan:"#e0ffff",lightgoldenrodyellow:"#fafad2",lightgrey:"#d3d3d3",lightgreen:"#90ee90",lightpink:"#ffb6c1",lightsalmon:"#ffa07a",lightseagreen:"#20b2aa",lightskyblue:"#87cefa",lightslategray:"#778899",lightsteelblue:"#b0c4de",lightyellow:"#ffffe0",lime:"#00ff00",limegreen:"#32cd32",linen:"#faf0e6",magenta:"#ff00ff",maroon:"#800000",mediumaquamarine:"#66cdaa",mediumblue:"#0000cd",mediumorchid:"#ba55d3",mediumpurple:"#9370d8",mediumseagreen:"#3cb371",mediumslateblue:"#7b68ee",mediumspringgreen:"#00fa9a",mediumturquoise:"#48d1cc",mediumvioletred:"#c71585",midnightblue:"#191970",mintcream:"#f5fffa",mistyrose:"#ffe4e1",moccasin:"#ffe4b5",navajowhite:"#ffdead",navy:"#000080",oldlace:"#fdf5e6",olive:"#808000",olivedrab:"#6b8e23",orange:"#ffa500",orangered:"#ff4500",orchid:"#da70d6",palegoldenrod:"#eee8aa",palegreen:"#98fb98",paleturquoise:"#afeeee",palevioletred:"#d87093",papayawhip:"#ffefd5",peachpuff:"#ffdab9",peru:"#cd853f",pink:"#ffc0cb",plum:"#dda0dd",powderblue:"#b0e0e6",purple:"#800080",red:"#ff0000",rosybrown:"#bc8f8f",royalblue:"#4169e1",saddlebrown:"#8b4513",salmon:"#fa8072",sandybrown:"#f4a460",seagreen:"#2e8b57",seashell:"#fff5ee",sienna:"#a0522d",silver:"#c0c0c0",skyblue:"#87ceeb",slateblue:"#6a5acd",slategray:"#708090",snow:"#fffafa",springgreen:"#00ff7f",steelblue:"#4682b4",tan:"#d2b48c",teal:"#008080",thistle:"#d8bfd8",tomato:"#ff6347",turquoise:"#40e0d0",violet:"#ee82ee",wheat:"#f5deb3",white:"#ffffff",whitesmoke:"#f5f5f5",yellow:"#ffff00",yellowgreen:"#9acd32"};return"undefined"!=typeof t[e.toLowerCase()]?t[e.toLowerCase()]:!1}function wfu_download_file(e,t,a){var l=wfu_GetHttpRequestObject();if(null!=l){var n=AdminParams.wfu_ajax_url;params=new Array(3),params[0]=new Array(2),params[0][0]="action",params[0][1]="wfu_ajax_action_download_file_invoker",params[1]=new Array(2),params[1][0]="file",params[1][1]=e,params[2]=new Array(2),params[2][0]="nonce",params[2][1]=a;for(var d="",u=0;u<params.length;u++)d+=(u>0?"&":"")+params[u][0]+"="+encodeURI(params[u][1]);l.open("POST",n,!0),l.setRequestHeader("Content-type","application/x-www-form-urlencoded"),l.onreadystatechange=function(){if(4==l.readyState&&200==l.status){var a="wfu_ajax_action_download_file_invoker:",n=l.responseText.indexOf(a);-1==n&&(n=l.responseText.length);var d=(l.responseText.substr(0,n),l.responseText.substr(n+a.length,l.responseText.length-n-a.length));n=d.indexOf(":");var u=d.substr(0,n);if(txt_value=d.substr(n+1,d.length-n-1),"wfu_download_id;"==u.substr(0,16)){var r=u.substr(16),o=document.getElementById("wfu_file_download_container_"+t);o.innerHTML=txt_value,setTimeout("wfu_download_file_monitor('"+e+"', "+t+", '"+r+"')",100)}}},l.send(d)}}function wfu_download_file_monitor(e,t,a){var l=wfu_GetHttpRequestObject();if(null!=l){var n=AdminParams.wfu_ajax_url;params=new Array(3),params[0]=new Array(2),params[0][0]="action",params[0][1]="wfu_ajax_action_download_file_monitor",params[1]=new Array(2),params[1][0]="file",params[1][1]=e,params[2]=new Array(2),params[2][0]="id",params[2][1]=a;for(var d="",u=0;u<params.length;u++)d+=(u>0?"&":"")+params[u][0]+"="+encodeURI(params[u][1]);l.open("POST",n,!0),l.setRequestHeader("Content-type","application/x-www-form-urlencoded"),l.onreadystatechange=function(){if(4==l.readyState&&200==l.status){var a="wfu_ajax_action_download_file_monitor:",n=l.responseText.indexOf(a);-1==n&&(n=l.responseText.length);var d=(l.responseText.substr(0,n),l.responseText.substr(n+a.length,l.responseText.length-n-a.length));n=d.indexOf(":");var u=d.substr(0,n);if(txt_value=d.substr(n+1,d.length-n-1),"repeat"!=u){var r=document.getElementById("wfu_file_download_container_"+t);r.innerHTML=""}else"repeat"==u&&setTimeout("wfu_download_file_monitor('"+e+"', "+t+", '"+txt_value+"')",100)}},l.send(d)}}function wfu_filedetails_userdata_changed(){for(var e,t,a=document.getElementsByName("wfu_filedetails_userdata"),l=!1,n=0;n<a.length;n++)if(e=document.getElementById(a[n].id.replace("wfu_filedetails_userdata_value_","wfu_filedetails_userdata_default_")),t=document.getElementById(a[n].id.replace("wfu_filedetails_userdata_value_","wfu_filedetails_userdata_")),t.value=a[n].value,a[n].value!=e.value){l=!0;break}document.getElementById("dp_filedetails_submit_fields").disabled=!l}function wfu_Attach_FileDetails_Admin_Events(){for(var e=document.getElementsByName("wfu_filedetails_userdata"),t=0;t<e.length;t++)wfu_attach_element_handlers(e[t],wfu_filedetails_userdata_changed)}var DraggedItem=null,ShortcodeNextSave=0,ShortcodeTimeOut=null,ShortcodeString="",Autosave=!1,PageObsolete=!1,PageUpdating=!1,CheckObsolescenceTimeOut=5e3;jQuery(document).ready(function(e){e(".wfu_color_field").wpColorPicker({change:function(e,t){e.target.value=t.color.toString(),"wfu_text_elements"==e.target.name?wfu_update_text_value(e):"wfu_triplecolor_elements"==e.target.name&&wfu_update_triplecolor_value(e)}})});
1
+ function wfu_admin_activate_tab(e){for(var t,a,l=document.getElementById("wfu_tab_container"),n=0;n<l.childNodes.length;n++)t=l.childNodes[n],1===t.nodeType&&(a=t.id.substr(8),t.className.indexOf("nav-tab-active")>-1&&(t.className="nav-tab",document.getElementById("wfu_container_"+a).style.display="none"));document.getElementById("wfu_tab_"+e).className="nav-tab nav-tab-active",document.getElementById("wfu_container_"+e).style.display="block"}function wfu_admin_onoff_clicked(e){var t=document.getElementById("wfu_attribute_"+e),a=document.getElementById("wfu_wrapper"),l=document.getElementsByClassName("wfu_shadow_"+e,"div",a),n=document.getElementsByClassName("wfu_shadow_"+e+"_inv","div",a),d="on"==t.className.substr(t.className.length-2);if(d=!d){document.getElementById("wfu_attribute_value_"+e).value="true",t.className="wfu_onoff_container_on";for(var u=0;u<l.length;u++)l[u].style.display="none";for(var u=0;u<n.length;u++)n[u].style.display="block"}else{document.getElementById("wfu_attribute_value_"+e).value="false",t.className="wfu_onoff_container_off";for(var u=0;u<l.length;u++)l[u].style.display="block";for(var u=0;u<n.length;u++)n[u].style.display="none"}wfu_generate_shortcode(),"userdata"==e&&wfu_update_userfield_variables()}function wfu_admin_radio_clicked(e){var t=document.getElementsByName("wfu_radioattribute_"+e),a=document.getElementById("wfu_wrapper"),l=document.getElementsByClassName("wfu_shadow_"+e,"div",a),n=document.getElementsByClassName("wfu_shadow_"+e+"_inv","div",a),d="";for(r=0;r<t.length;r++)t[r].checked&&(d=t[r].value);var u="*"==d.substr(0,1);if(u){d=d.substr(1);for(var r=0;r<l.length;r++)l[r].style.display="none";for(var r=0;r<n.length;r++)n[r].style.display="block"}else{for(var r=0;r<l.length;r++)l[r].style.display="block";for(var r=0;r<n.length;r++)n[r].style.display="none"}document.getElementById("wfu_attribute_value_"+e).value=d,wfu_generate_shortcode()}function wfu_addEventHandler(e,t,a){e.addEventListener?e.addEventListener(t,a,!1):e.attachEvent?e.attachEvent("on"+t,a):e["on"+t]=a}function wfu_attach_separator_dragdrop_events(){for(var e,t=document.getElementById("wfu_placements_container"),a=0;a<t.childNodes.length;a++)e=t.childNodes[a],("wfu_component_separator_hor"==e.className||"wfu_component_separator_ver"==e.className)&&(wfu_addEventHandler(e,"dragenter",wfu_separator_dragenter),wfu_addEventHandler(e,"dragover",wfu_default_dragover),wfu_addEventHandler(e,"dragleave",wfu_separator_dragleave),wfu_addEventHandler(e,"drop",wfu_separator_drop))}function wfu_Attach_Admin_DragDrop_Events(){if(window.FileReader){for(var e,t=document.getElementById("wfu_placements_container"),a=document.getElementById("wfu_componentlist_container"),l=0;l<t.childNodes.length;l++)e=t.childNodes[l],"wfu_component_box"==e.className&&(wfu_addEventHandler(e,"dragstart",wfu_component_dragstart),wfu_addEventHandler(e,"dragend",wfu_component_dragend));for(var l=0;l<a.childNodes.length;l++)if(e=a.childNodes[l],"wfu_component_box_container"==e.className)for(var n=0;n<e.childNodes.length;n++)"wfu_component_box wfu_inbase"==e.childNodes[n].className&&(wfu_addEventHandler(e.childNodes[n],"dragstart",wfu_component_dragstart),wfu_addEventHandler(e.childNodes[n],"dragend",wfu_component_dragend));e=document.getElementById("wfu_componentlist_dragdrop"),wfu_addEventHandler(e,"dragenter",wfu_componentlist_dragenter),wfu_addEventHandler(e,"dragover",wfu_default_dragover),wfu_addEventHandler(e,"dragleave",wfu_componentlist_dragleave),wfu_addEventHandler(e,"drop",wfu_componentlist_drop),wfu_attach_separator_dragdrop_events()}}function wfu_componentlist_dragenter(e){if(e=e||window.event,e.preventDefault&&e.preventDefault(),!DraggedItem)return!1;var t=document.getElementById("wfu_componentlist_dragdrop");return-1==t.className.indexOf("wfu_componentlist_dragdrop_dragover")&&(t.className+=" wfu_componentlist_dragdrop_dragover"),!1}function wfu_componentlist_dragleave(e){if(e=e||window.event,e.preventDefault&&e.preventDefault(),!DraggedItem)return!1;var t=document.getElementById("wfu_componentlist_dragdrop");return t.className=t.className.replace(" wfu_componentlist_dragdrop_dragover",""),!1}function wfu_componentlist_drop(e){e=e||window.event,e.preventDefault&&e.preventDefault();var t=e.dataTransfer.getData("Component");if(!t)return!1;var a=document.getElementById("wfu_component_box_"+t);a.className="wfu_component_box wfu_inbase",a.style.display="block",document.getElementById("wfu_component_box_container_"+t).appendChild(a);var l=wfu_admin_recreate_placements_text(null,"");return wfu_admin_recreate_placements_panel(l),document.getElementById("wfu_attribute_value_placements").value=l,wfu_generate_shortcode(),!1}function wfu_separator_dragenter(e){if(e=e||window.event,e.preventDefault&&e.preventDefault(),!DraggedItem)return!1;if("wfu_component_separator_hor"==e.target.className){var t=document.getElementById("wfu_component_bar_hor");t.style.top=e.target.offsetTop+"px",t.style.display="block"}else if("wfu_component_separator_ver"==e.target.className){var t=document.getElementById("wfu_component_bar_ver");t.style.top=e.target.offsetTop+"px",t.style.left=e.target.offsetLeft+"px",t.style.display="block"}return!1}function wfu_default_dragover(e){return e=e||window.event,e.preventDefault&&e.preventDefault(),!1}function wfu_separator_dragleave(e){if(e=e||window.event,e.preventDefault&&e.preventDefault(),!DraggedItem)return!1;if("wfu_component_separator_hor"==e.target.className){var t=document.getElementById("wfu_component_bar_hor");t.style.display="none"}else if("wfu_component_separator_ver"==e.target.className){var t=document.getElementById("wfu_component_bar_ver");t.style.display="none"}return!1}function wfu_separator_drop(e){e=e||window.event,e.preventDefault&&e.preventDefault();var t=e.dataTransfer.getData("Component");if(!t)return!1;var a=document.getElementById("wfu_component_box_"+t);a.style.display="none",a.className="wfu_component_box wfu_inbase",document.getElementById("wfu_component_box_container_"+t).appendChild(a);var l=wfu_admin_recreate_placements_text(e.target,t);return wfu_admin_recreate_placements_panel(l),document.getElementById("wfu_attribute_value_placements").value=l,wfu_generate_shortcode(),!1}function wfu_component_dragstart(e){e=e||window.event,e.dataTransfer.setData("Component",e.target.id.replace("wfu_component_box_","")),-1==e.target.className.indexOf("wfu_component_box_dragged")&&(e.target.className+=" wfu_component_box_dragged",DraggedItem=e.target),e.target.style.zIndex=3;var t=document.getElementById("wfu_componentlist_dragdrop");return t.className="wfu_componentlist_dragdrop wfu_componentlist_dragdrop_dragover",t.style.display="block",!1}function wfu_component_dragend(e){e=e||window.event,DraggedItem=null,e.target.style.zIndex=1;var t=document.getElementById("wfu_componentlist_dragdrop");return t.style.display="none",t.className="wfu_componentlist_dragdrop",e.target.className=e.target.className.replace(" wfu_component_box_dragged",""),document.getElementById("wfu_component_bar_ver").style.display="none",document.getElementById("wfu_component_bar_hor").style.display="none",!1}function wfu_admin_recreate_placements_text(e,t){function a(e){""!=d&&(d+=n),d+=e,n=""}for(var l=document.getElementById("wfu_placements_container"),n="",d="",u=0;u<l.childNodes.length;u++)item=l.childNodes[u],"wfu_component_separator_ver"==item.className?(""==n&&(n="+"),item==e&&(a(t),n="+")):"wfu_component_separator_hor"==item.className?(n="/",item==e&&(a(t),n="/")):"wfu_component_box"==item.className&&a(item.id.replace("wfu_component_box_",""));return d}function wfu_admin_recreate_placements_panel(e){for(var t,a,l,n=document.getElementById("wfu_placements_container"),d="",u=0;u<n.childNodes.length;u++)t=n.childNodes[u],"wfu_component_box"==t.className&&(d=t.id.replace("wfu_component_box_",""),t.style.display="inline-block",t.className="wfu_component_box wfu_inbase",document.getElementById("wfu_component_box_container_"+d).appendChild(t));n.innerHTML="",a=e.split("/");for(var u=0;u<a.length;u++){t=document.createElement("DIV"),t.className="wfu_component_separator_hor",t.setAttribute("draggable",!0),n.appendChild(t),t=document.createElement("DIV"),t.className="wfu_component_separator_ver",t.setAttribute("draggable",!0),n.appendChild(t),l=a[u].split("+");for(var r=0;r<l.length;r++)t=document.getElementById("wfu_component_box_"+l[r]),t&&(n.appendChild(t),t.className="wfu_component_box",t.style.display="inline-block",t=document.createElement("DIV"),t.className="wfu_component_separator_ver",t.setAttribute("draggable",!0),n.appendChild(t))}t=document.createElement("DIV"),t.className="wfu_component_separator_hor",t.setAttribute("draggable",!0),n.appendChild(t),t=document.createElement("DIV"),t.id="wfu_component_bar_hor",t.className="wfu_component_bar_hor",n.appendChild(t),t=document.createElement("DIV"),t.id="wfu_component_bar_ver",t.className="wfu_component_bar_ver",n.appendChild(t),wfu_attach_separator_dragdrop_events()}function wfu_subfolders_input_changed(e){e=e||window.event;var t=e.target,a=t.id.replace("wfu_subfolders_path_","");a=a.replace("wfu_subfolders_label_","");var l=document.getElementById("wfu_attribute_"+a);if(!(l.selectedIndex<0)){var n,d,u=document.getElementById("wfu_subfolders_path_"+a),r=document.getElementById("wfu_subfolders_label_"+a),o=document.getElementById("wfu_subfolders_ok_"+a),_="1"==document.getElementById("wfu_subfolders_isnewitem_"+a).value;if(_)n="",d="";else{var s=l.data;t=s[l.selectedIndex],n=t.path,d=t.label}if(u.value==n&&r.value==d)o.disabled=!0,_||wfu_subfolders_update_nav(a);else{o.disabled=!1;for(var f=document.getElementsByName("wfu_subfolder_nav_"+a),i=0;i<f.length;i++)f[i].disabled=!0}}}function wfu_subfolders_auto_changed(e){var t=document.getElementById("wfu_attribute_"+e),a=document.getElementById("wfu_subfolders_auto_"+e),l=document.getElementById("wfu_subfolders_editable_"+e),n=document.getElementById("wfu_subfolders_manualtext_"+e);if(a.checked){var d=document.getElementById("wfu_attribute_value_"+e).value;"auto"!=d.substr(0,4)&&(n.value=d),l.parentNode.style.display="inline",wfu_apply_value(e,"folderlist","auto"+(l.checked?"+":"")),t.disabled=!0}else t.disabled=!1,l.parentNode.style.display="none",wfu_apply_value(e,"folderlist",n.value)}function wfu_subfolders_up_clicked(e){var t=document.getElementById("wfu_attribute_"+e);if(!(t.selectedIndex<0)){var a=t.data;item=a[t.selectedIndex];var l=item.index-1;if(!(0>l)){for(var n=-1,d=t.selectedIndex-1;d>=0;){if(a[d].level==item.level&&a[d].index==l){n=d;break}d--}if(-1!=n){var u=0;for(d=t.selectedIndex+1;d<a.length&&a[d].level>item.level;)u++,d++;a[n].index=item.index,item.index=l,t.data=a.slice(0,n).concat(a.slice(t.selectedIndex,t.selectedIndex+1+u)).concat(a.slice(n,t.selectedIndex)).concat(a.slice(t.selectedIndex+1+u));var r=wfu_update_subfolder_list(e);t.selectedIndex=n,wfu_subfolders_update_toolnav(e),item=t,r!==item.oldVal&&(item.oldVal=r,document.getElementById("wfu_attribute_value_"+e).value=r,wfu_generate_shortcode())}}}}function wfu_subfolders_down_clicked(e){var t=document.getElementById("wfu_attribute_"+e);if(!(t.selectedIndex<0)){var a=t.data;item=a[t.selectedIndex];var l=item.index+1,n=-1;for(curind=t.selectedIndex+1;curind<a.length;){if(a[curind].level==item.level){n=curind;break}if(a[curind].level<item.level)break;curind++}if(-1!=n){var d=0;for(curind=n+1;curind<a.length&&a[curind].level>item.level;)d++,curind++;a[n].index=item.index,item.index=l,t.data=a.slice(0,t.selectedIndex).concat(a.slice(n,n+1+d)).concat(a.slice(t.selectedIndex,n)).concat(a.slice(n+1+d));var u=wfu_update_subfolder_list(e);t.selectedIndex=t.selectedIndex+d+1,wfu_subfolders_update_toolnav(e),item=t,u!==item.oldVal&&(item.oldVal=u,document.getElementById("wfu_attribute_value_"+e).value=u,wfu_generate_shortcode())}}}function wfu_subfolders_left_clicked(e){var t=document.getElementById("wfu_attribute_"+e);if(!(t.selectedIndex<0)){var a=t.data;for(item=a[t.selectedIndex],curind=t.selectedIndex+1;curind<a.length&&a[curind].level>item.level;)a[curind].level--,curind++;item.level--;var l=wfu_update_subfolder_list(e);t.data=wfu_decode_subfolder_list(e),wfu_subfolders_update_toolnav(e),item=t,l!==item.oldVal&&(item.oldVal=l,document.getElementById("wfu_attribute_value_"+e).value=l,wfu_generate_shortcode())}}function wfu_subfolders_right_clicked(e){var t=document.getElementById("wfu_attribute_"+e);if(!(t.selectedIndex<0)){var a=t.data;for(item=a[t.selectedIndex],curind=t.selectedIndex+1;curind<a.length&&a[curind].level>item.level;)a[curind].level++,curind++;item.level++;var l=wfu_update_subfolder_list(e);t.data=wfu_decode_subfolder_list(e),wfu_subfolders_update_toolnav(e),item=t,l!==item.oldVal&&(item.oldVal=l,document.getElementById("wfu_attribute_value_"+e).value=l,wfu_generate_shortcode())}}function wfu_subfolders_def_clicked(e){var t=document.getElementById("wfu_attribute_"+e);if(!(t.selectedIndex<0)){var a=t.data;if(item=a[t.selectedIndex],item.default)item.default=!1;else{for(var l=0;l<a.length;l++)a[l].default=!1;item.default=!0}var n=wfu_update_subfolder_list(e);wfu_subfolders_update_toolnav(e),item=t,n!==item.oldVal&&(item.oldVal=n,document.getElementById("wfu_attribute_value_"+e).value=n,wfu_generate_shortcode())}}function wfu_subfolders_ok_clicked(e){var t=document.getElementById("wfu_attribute_"+e);if(!(t.selectedIndex<0)){var a=document.getElementById("wfu_subfolders_path_"+e),l=document.getElementById("wfu_subfolders_label_"+e);if(""==a.value||""==l.value)return void alert("Path or label cannot be empty!");var n=t.data,d="1"==document.getElementById("wfu_subfolders_isnewitem_"+e).value;if(d){var u=parseInt(document.getElementById("wfu_subfolders_newitemlevel_"+e).value),r={label:l.value,path:a.value,level:u,"default":!1},o=parseInt(document.getElementById("wfu_subfolders_newitemindex_"+e).value);o>=n.length?n.push(r):n.splice(o,0,r)}else item=n[t.selectedIndex],item.path=a.value,item.label=l.value;var _=wfu_update_subfolder_list(e);t.data=wfu_decode_subfolder_list(e),wfu_subfolders_update_toolnav(e),item=t,_!==item.oldVal&&(item.oldVal=_,document.getElementById("wfu_attribute_value_"+e).value=_,wfu_generate_shortcode())}}function wfu_subfolders_del_clicked(e){var t=document.getElementById("wfu_attribute_"+e);if(!(t.selectedIndex<0)){var a=t.data;item=a[t.selectedIndex];var l=0;for(curind=t.selectedIndex+1;curind<a.length&&a[curind].level>item.level;)l++,curind++;if(!(l>0)||confirm("Children items will be deleted as well. Proceed?")){a.splice(t.selectedIndex,1+l);var n=wfu_update_subfolder_list(e);t.data=wfu_decode_subfolder_list(e),wfu_subfolders_update_toolnav(e),item=t,n!==item.oldVal&&(item.oldVal=n,document.getElementById("wfu_attribute_value_"+e).value=n,wfu_generate_shortcode())}}}function wfu_subfolders_add_clicked(e){var t=document.getElementById("wfu_attribute_"+e);if(!(t.selectedIndex<0)){var a=t.data,l=t.selectedIndex;item=a[l];var n=t.options,d=document.createElement("option");d.value="",d.innerHTML="",n.add(d,l),t.selectedIndex=l;var u=document.getElementById("wfu_subfolder_tools_"+e),r=document.getElementById("wfu_subfolders_path_"+e),o=document.getElementById("wfu_subfolders_label_"+e),_=document.getElementById("wfu_subfolders_ok_"+e),s=document.getElementById("wfu_subfolders_browse_"+e);u.className="wfu_subfolder_tools_container",o.disabled=!1,_.disabled=!0,document.getElementById("wfu_subfolders_isnewitem_"+e).value="1",document.getElementById("wfu_subfolders_newitemindex_"+e).value=l,document.getElementById("wfu_subfolders_newitemlevel_"+e).value=item.level,document.getElementById("wfu_subfolders_newitemlevel2_"+e).value="",r.disabled=0==item.level,s.disabled=0==item.level,0==item.level?(r.value="{root}",o.value="{upload folder}"):(r.value="",o.value="");for(var f=document.getElementsByName("wfu_subfolder_nav_"+e),i=0;i<f.length;i++)f[i].disabled=!0}}function wfu_subfolders_browse_clicked(e){var t=wfu_GetHttpRequestObject();if(null!=t){var a=null;try{var a=new FormData}catch(l){}if(null!=a){for(var n=document.getElementById("wfu_global_dialog_container"),d=document.getElementById("wfu_subfolders_browser_"+e),u=document.getElementById("wfu_subfolders_browse_"+e),r=document.getElementById("wfu_subfolders_inner_shadow_"+e),o=document.getElementById("wfu_subfolders_browser_msgcont_"+e),_=document.getElementById("wfu_subfolders_browser_msg_"+e),s=document.getElementById("wfu_subfolders_browser_img_"+e),f=document.getElementById("wfu_subfolders_browser_ok_"+e),i=document.getElementById("wfu_subfolders_browser_list_"+e);i.options.length>0;)i.options.remove(0);f.disabled=!0,f.onclick=function(){wfu_folder_browser_cancel_clicked(e)},_.innerHTML="loading folder contents...",s.style.display="inline",o.style.display="block",n.style.display="block",d.style.display="block",d.style.left=u.offsetLeft+u.offsetWidth-d.offsetWidth+"px",d.style.top=u.offsetTop+u.offsetHeight-d.offsetHeight+"px",r.style.display="block",n.onclick=function(){wfu_folder_browser_cancel_clicked(e)};var c=document.getElementById("wfu_attribute_uploadpath").value;"/"==c.substr(c.length-1)&&(c=c.substr(0,c.length-1));var m=wfu_get_relative_path(e).split(","),w=c+m[0];"/"!=w.substr(0)&&(w="/"+w);var g="";2==m.length&&(g=m[1]),a.append("action","wfu_ajax_action_read_subfolders"),a.append("folder1",wfu_plugin_encode_string(w)),a.append("folder2",wfu_plugin_encode_string(g)),t.key=e,t.addEventListener("load",wfu_readfolderComplete,!1),t.addEventListener("error",wfu_readfolderFailed,!1),t.addEventListener("abort",wfu_readfolderCanceled,!1),t.open("POST",AdminParams.wfu_ajax_url),t.send(a)}}}function wfu_readfolderComplete(e){var t=e.target.key,a=document.getElementById("wfu_subfolders_browser_msgcont_"+t),l=document.getElementById("wfu_subfolders_browser_msg_"+t),n=document.getElementById("wfu_subfolders_browser_img_"+t),d=document.getElementById("wfu_subfolders_browser_list_"+t),u=document.getElementById("wfu_subfolders_browser_ok_"+t),r=document.getElementById("wfu_subfolders_path_"+t),o=document.getElementById("wfu_subfolders_label_"+t),_=e.target.responseText;if(-1!=_){var s="wfu_read_subfolders:",f=e.target.responseText.indexOf(s);-1==f&&(f=e.target.responseText.length);var i=(e.target.responseText.substr(0,f),e.target.responseText.substr(f+s.length,e.target.responseText.length-f-s.length));f=i.indexOf(":");var c=i.substr(0,f);if(txt_value=i.substr(f+1,i.length-f-1),"success"==c){for(var m,w=wfu_plugin_decode_string(txt_value),g=w.split(","),p=0,v=0;v<g.length;v++)""!=g[v]&&(m=document.createElement("option"),m.value=g[v],m.innerHTML=g[v].replace("*","&nbsp;&nbsp;&nbsp;"),d.add(m),p++);0==p&&(m=document.createElement("option"),m.value="",m.innerHTML="{empty}",m.disabled=!0,d.add(m)),d.selectedIndex=-1,u.onclick=function(){var e=d.options[d.selectedIndex].value,a=parseInt(document.getElementById("wfu_subfolders_newitemlevel_"+t).value);("*"==e.substr(0,1)||0==a)&&(document.getElementById("wfu_subfolders_newitemlevel_"+t).value=a+1,a>0&&(e=e.substr(1))),r.value=e,o.value=e,wfu_folder_browser_cancel_clicked(t),wfu_subfolders_ok_clicked(t)},a.style.display="none"}else"error"==c?(l.innerHTML=txt_value,n.style.display="none",u.disabled=!1):(l.innerHTML="Unknown error",n.style.display="none",u.disabled=!1)}}function wfu_readfolderFailed(e){var t=e.target.key,a=document.getElementById("wfu_subfolders_browser_msg_"+t),l=document.getElementById("wfu_subfolders_browser_img_"+t),n=document.getElementById("wfu_subfolders_browser_ok_"+t);a.innerHTML="Unknown error",l.style.display="none",n.disabled=!1}function wfu_readfolderCanceled(e){var t=e.target.key,a=document.getElementById("wfu_subfolders_browser_msg_"+t),l=document.getElementById("wfu_subfolders_browser_img_"+t),n=document.getElementById("wfu_subfolders_browser_ok_"+t);a.innerHTML="Unknown error",l.style.display="none",n.disabled=!1}function wfu_subfolders_browser_list_changed(e){var t=document.getElementById("wfu_subfolders_browser_list_"+e),a=document.getElementById("wfu_subfolders_browser_ok_"+e);a.disabled=t.selectedIndex<0}function wfu_folder_browser_cancel_clicked(e){var t=document.getElementById("wfu_global_dialog_container"),a=document.getElementById("wfu_subfolders_browser_"+e),l=(document.getElementById("wfu_subfolders_browse_"+e),document.getElementById("wfu_subfolders_inner_shadow_"+e));t.onclick=null,l.style.display="none",a.style.display="none",t.style.display="none"}function wfu_get_relative_path(e){var t=document.getElementById("wfu_attribute_"+e);if(!(t.selectedIndex<0)){var a,l=t.data,n="1"==document.getElementById("wfu_subfolders_isnewitem_"+e).value;a=n?parseInt(document.getElementById("wfu_subfolders_newitemlevel_"+e).value):l[t.selectedIndex].level;for(var d="/",u=t.selectedIndex-1,r=a;u>=0&&r>1;)l[u].level<r&&(d="/"+l[u].path+d,r=l[u].level),u--;return n&&"1"==document.getElementById("wfu_subfolders_newitemlevel2_"+e).value&&a>0&&t.selectedIndex>0&&(d+=","+l[t.selectedIndex-1].path),d}}function wfu_subfolders_changed(e){wfu_update_subfolder_list(e),wfu_subfolders_update_toolnav(e)}function wfu_subfolders_update_toolnav(e){var t,a,l=document.getElementById("wfu_attribute_"+e),n=document.getElementById("wfu_subfolder_tools_"+e),d=document.getElementById("wfu_subfolders_path_"+e),u=document.getElementById("wfu_subfolders_label_"+e),r=document.getElementById("wfu_subfolders_ok_"+e),o=document.getElementById("wfu_subfolders_browse_"+e),_=document.getElementById("wfu_subfolders_auto_"+e);if(document.getElementById("wfu_subfolders_isnewitem_"+e).value="",document.getElementById("wfu_subfolders_newitemindex_"+e).value="",document.getElementById("wfu_subfolders_newitemlevel_"+e).value="",document.getElementById("wfu_subfolders_newitemlevel2_"+e).value="",null==l.data?(t=wfu_decode_subfolder_list(e),l.data=t):t=l.data,0===l.data.length?(l.className="wfu_select_folders wfu_select_folders_empty",l.options[0].innerHTML=_.checked?"":"press here"):l.className="wfu_select_folders",l.selectedIndex<0)n.className="wfu_subfolder_tools_container wfu_subfolder_tools_disabled",d.disabled=!0,u.disabled=!0,r.disabled=!0,o.disabled=!0,u.value="",d.value="";else if(l.selectedIndex>=l.options.length-1){n.className="wfu_subfolder_tools_container",u.disabled=!1,r.disabled=!0,document.getElementById("wfu_subfolders_isnewitem_"+e).value="1",document.getElementById("wfu_subfolders_newitemindex_"+e).value=t.length;var s;s=0==t.length?0:0==t[t.length-1].level?1:t[t.length-1].level,document.getElementById("wfu_subfolders_newitemlevel_"+e).value=s,document.getElementById("wfu_subfolders_newitemlevel2_"+e).value="1",d.disabled=0==s,o.disabled=!1,0==s?(d.value="{root}",u.value="{upload folder}"):(d.value="",u.value="")}else n.className="wfu_subfolder_tools_container",u.disabled=!1,r.disabled=!0,a=t[l.selectedIndex],d.disabled=0==a.level,o.disabled=0==a.level,u.value=a.label,d.value=a.path;var f=document.getElementsByName("wfu_subfolder_nav_"+e);if(l.selectedIndex<0||l.selectedIndex>=l.options.length-1)for(var i=0;i<f.length;i++)f[i].disabled=!0;else wfu_subfolders_update_nav(e)}function wfu_subfolders_update_nav(e){var t=document.getElementById("wfu_attribute_"+e),a=document.getElementById("wfu_subfolders_up_"+e),l=document.getElementById("wfu_subfolders_down_"+e),n=document.getElementById("wfu_subfolders_left_"+e),d=document.getElementById("wfu_subfolders_right_"+e),u=document.getElementById("wfu_subfolders_add_"+e),r=document.getElementById("wfu_subfolders_def_"+e),o=document.getElementById("wfu_subfolders_del_"+e),_=t.data,s=_[t.selectedIndex];for(a.disabled=s.index<=0,ind=t.selectedIndex+1,nextind=0;ind<_.length;){if(_[ind].level==s.level){nextind=_[ind].index;break}if(_[ind].level<s.level)break;ind++}l.disabled=0==s.level||0==nextind,n.disabled=0==t.selectedIndex&&s.level<1||t.selectedIndex>0&&s.level<=1,prevlevel=t.selectedIndex>=1?_[t.selectedIndex-1].level:0,d.disabled=s.level-prevlevel>0,u.disabled=0==s.level,r.disabled=!1,r.className="button"+(s.default?" wfu_subfolder_nav_pressed":""),o.disabled=!1}function wfu_decode_subfolder(e){var t={label:"",path:"",level:0,"default":!1};e=e.trim();for(var a=0,l=!1;a<e.length&&"*"==e.substr(a,1);)a++;e=e.substr(a,e.length-a),"&"==e.substr(0,1)&&(e=e.substr(1),l=!0),t.level=a,t.default=l;var n=e.split("/");return 1==n.length?(t.path=n[0],t.label=n[0]):n.length>1&&(t.path=n[0],t.label=n[1]),0==a&&(t.path="{root}",""==t.label&&(t.label="{upload folder}")),t}function wfu_decode_subfolder_list(e){for(var t,a=document.getElementById("wfu_attribute_"+e).options,l=Array(),n=["root"],d=[0],u=-1,r=0;r<a.length-1;r++){for(l.push(wfu_decode_subfolder(wfu_plugin_decode_string(a[r].value))),n.length>l[r].level?n[l[r].level]=l[r].path:n.push(l[r].path),t="",j=1;j<=l[r].level;j++)t+=n[j]+"/";l[r].fullpath=t,d.length<=l[r].level&&d.push(0),l[r].index=l[r].level>u?0:d[l[r].level]+1,d[l[r].level]=l[r].index,u=l[r].level}return l}function wfu_update_subfolder_list(e){var t=document.getElementById("wfu_attribute_"+e).options,a=document.getElementById("wfu_attribute_"+e),l=a.data;if(null!=l){var n,d,u="";t.length=l.length+1;for(var r=0;r<l.length;r++){for(n="",d="",j=0;j<l[r].level;j++)n+="*",d+="&nbsp;&nbsp;&nbsp;";l[r].default?(n+="&",t[r].className="wfu_select_folders_option_default"):t[r].className="",n+=l[r].path+"/"+l[r].label,d+=l[r].label,t[r].value=wfu_plugin_encode_string(n),t[r].innerHTML=d,""!=u&&(u+=","),u+=n}return t[l.length].value="",t[l.length].innerHTML="",u}}function wfu_userdata_edit_field(e,t,a){for(var l,n=0;n<e.childNodes.length;n++)l=e.childNodes[n],"INPUT"==l.tagName?"text"==l.type?(l.value=t,wfu_attach_element_handlers(l,wfu_update_userfield_value)):"checkbox"==l.type&&(l.checked=a):"DIV"==l.tagName&&(l.className="wfu_userdata_action")}function wfu_userdata_add_field(e){var t=e.parentNode,a=t.cloneNode(!0);wfu_userdata_edit_field(a,"",!1),t.parentNode.insertBefore(a,t.nextSibling)}function wfu_userdata_remove_field(e){for(var t=e.parentNode,a=t.parentNode,l=null,n=0;n<a.childNodes.length;n++)if(1===a.childNodes[n].nodeType){l=a.childNodes[n];break}if(t!=l){t.parentNode.removeChild(t);for(var n=0;n<l.childNodes.length;n++)if(1===l.childNodes[n].nodeType){wfu_update_userfield_value({target:l.childNodes[n]});break}}}function wfu_generate_shortcode(){for(var e,t=document.getElementById("wfu_attribute_defaults"),a=(document.getElementById("wfu_attribute_values"),""),l="",n="[wordpress_file_upload",d="",u=0;u<t.childNodes.length;u++)e=t.childNodes[u],1===e.nodeType&&(a=e.id.replace("wfu_attribute_default_",""),l=document.getElementById("wfu_attribute_value_"+a).value,e.value!=l&&(d+=" "+a+'="'+l+'"'));n+=d+"]",document.getElementById("wfu_shortcode").value=n,ShortcodeString=d.substr(1),document.getElementById("wfu_update_shortcode")&&(document.getElementById("wfu_update_shortcode").disabled=wfu_plugin_encode_string(n)==document.getElementById("wfu_shortcode_original_enc").value),Autosave&&wfu_schedule_save_shortcode()}function wfu_update_text_value(e){e=e||window.event;var t=e.target,a=t.id.replace("wfu_attribute_",""),l=t.value;l=l.replace(/(\r\n|\n|\r)/gm,"%n%"),l=l.replace(/\"/gm,"%dq%"),l=l.replace(/\[/gm,"%brl%"),l=l.replace(/\]/gm,"%brr%"),l!==t.oldVal&&(t.oldVal=l,document.getElementById("wfu_attribute_value_"+a).value=l,wfu_generate_shortcode())}function wfu_update_triplecolor_value(e){e=e||window.event;var t=e.target,a=t.id.replace("wfu_attribute_","");a=a.replace("_color",""),a=a.replace("_bgcolor",""),a=a.replace("_borcolor",""),t=document.getElementById("wfu_attribute_"+a+"_color");var l=t.value+","+document.getElementById("wfu_attribute_"+a+"_bgcolor").value+","+document.getElementById("wfu_attribute_"+a+"_borcolor").value;l!==t.oldVal&&(t.oldVal=l,document.getElementById("wfu_attribute_value_"+a).value=l,wfu_generate_shortcode())}function wfu_update_dimension_value(e){e=e||window.event;var t=e.target,a=t.name.replace("wfu_dimension_elements_",""),l=document.getElementsByName(t.name);t=l[0];for(var n="",d="",u=0;u<l.length;u++)d=l[u].id.replace("wfu_attribute_"+a+"_",""),""!=n&&""!=l[u].value&&(n+=", "),""!=l[u].value&&(n+=d+":"+l[u].value);n!==t.oldVal&&(t.oldVal=n,document.getElementById("wfu_attribute_value_"+a).value=n,wfu_generate_shortcode())}function wfu_update_ptext_value(e){e=e||window.event;var t=e.target,a=t.id.replace("wfu_attribute_","");a=a.substr(2);var l=document.getElementById("wfu_attribute_s_"+a).value,n=document.getElementById("wfu_attribute_p_"+a).value,d=l+"/"+n;d!==t.oldVal&&(t.oldVal=d,document.getElementById("wfu_attribute_value_"+a).value=d),wfu_generate_shortcode()}function wfu_update_mchecklist_value(e){var t="",a=(document.getElementById("wfu_attribute_"+e),document.getElementById("wfu_attribute_"+e+"_all"));a.checked?(jQuery("#wfu_attribute_"+e+" input").prop("disabled",!0),jQuery("#wfu_attribute_"+e+" input").prop("checked",!0),t="all"):(jQuery("#wfu_attribute_"+e+" input").prop("disabled",!1),jQuery("#wfu_attribute_"+e+" input").each(function(){jQuery(this).prop("checked")&&(t+=","+jQuery(this).next().html())}),t=t.substr(1)),document.getElementById("wfu_attribute_value_"+e).value=t,wfu_generate_shortcode()}function wfu_update_rolelist_value(e){var t="",a=document.getElementById("wfu_attribute_"+e),l=document.getElementById("wfu_attribute_"+e+"_all");if(l.checked)a.disabled=!0,t="all";else{a.disabled=!1;for(var n=a.options,d=0;d<n.length;d++)n[d].selected&&(""!=t&&(t+=","),t+=n[d].value)}document.getElementById("wfu_attribute_value_"+e).value=t,wfu_generate_shortcode()}function wfu_update_userfield_value(e){e=e||window.event;for(var t=e.target,a=t.parentNode,l=a.parentNode,n="",d=!1,u="",r=0;r<l.childNodes.length;r++)if(a=l.childNodes[r],"DIV"===a.tagName){for(var o=0;o<a.childNodes.length;o++)"INPUT"==a.childNodes[o].tagName&&("text"==a.childNodes[o].type?(n=a.childNodes[o].value,0==r&&(t=a.childNodes[o])):"checkbox"==a.childNodes[o].type&&(d=a.childNodes[o].checked));""!=u&&""!=n&&(u+="/"),""!=n&&d&&(u+="*"),""!=n&&(u+=n)}u!==t.oldVal&&(t.oldVal=u,document.getElementById("wfu_attribute_value_userdatalabel").value=u,wfu_generate_shortcode(),wfu_update_userfield_variables())}function wfu_update_userfield_variables(){for(var e=document.getElementById("wfu_attribute_value_userdatalabel").value,t=document.getElementById("wfu_wrapper"),a=document.getElementsByClassName("wfu_shadow_userdata","div",t),l=document.getElementsByName("wfu_userfield_select"),n=0;n<l.length;n++)l[n].style.display="none";if(0!=a.length&&"block"!=a[0].style.display){for(var d='<option style="display:none;">%userdataXXX%</option>',u=e.split("/"),r="",n=1;n<=u.length;n++)r=u[n-1],"*"==r[0]&&(r=r.substr(1)),d+='<option value="%userdata'+n+'%">'+n+": "+r+"</option>";for(var n=0;n<l.length;n++)l[n].innerHTML=d,l[n].style.display="inline-block"}}function wfu_attach_element_handlers(e,t){for(var a=["DOMAttrModified","textInput","input","change","keypress","paste","focus","propertychange"],l=0;l<a.length;l++)wfu_addEventHandler(e,a[l],t)}function wfu_Attach_Admin_Events(e){Autosave=e,wfu_generate_shortcode(),wfu_update_userfield_variables(),wfu_Attach_Admin_DragDrop_Events();for(var t=document.getElementsByName("wfu_text_elements"),a=0;a<t.length;a++)wfu_attach_element_handlers(t[a],wfu_update_text_value);for(var l=document.getElementsByName("wfu_ptext_elements"),a=0;a<l.length;a++)wfu_attach_element_handlers(l[a],wfu_update_ptext_value);for(var n=document.getElementsByName("wfu_triplecolor_elements"),a=0;a<n.length;a++)wfu_attach_element_handlers(n[a],wfu_update_triplecolor_value);for(var d=document.getElementsByName("wfu_dimension_elements_widths"),a=0;a<d.length;a++)wfu_attach_element_handlers(d[a],wfu_update_dimension_value);d=document.getElementsByName("wfu_dimension_elements_heights");for(var a=0;a<d.length;a++)wfu_attach_element_handlers(d[a],wfu_update_dimension_value);for(var u=document.getElementsByName("wfu_userfield_elements"),a=0;a<u.length;a++)wfu_attach_element_handlers(u[a],wfu_update_userfield_value);for(var r=document.getElementsByName("wfu_subfolder_tools_input"),a=0;a<r.length;a++)wfu_attach_element_handlers(r[a],wfu_subfolders_input_changed);
2
+ ""!=document.getElementById("wfu_shortcode_postid").value&&setTimeout(function(){wfu_check_page_obsolescence()},CheckObsolescenceTimeOut)}function wfu_insert_variable(e){var t=e.className.replace("wfu_variable wfu_variable_",""),a=document.getElementById("wfu_attribute_"+t),l=a.selectionStart,n=a.value;a.value=n.substr(0,l)+e.innerHTML+n.substr(l),wfu_update_text_value({target:a})}function wfu_insert_userfield_variable(e){var t=e.className.replace("wfu_variable wfu_variable_",""),a=document.getElementById("wfu_attribute_"+t),l=a.selectionStart,n=a.value;a.value=n.substr(0,l)+e.value+n.substr(l),e.value="%userdataXXX%",wfu_update_text_value({target:a})}function wfu_GetHttpRequestObject(){var e=null;try{e=new XMLHttpRequest}catch(t){try{e=new ActiveXObject("Msxml2.XMLHTTP")}catch(a){try{e=new ActiveXObject("Microsoft.XMLHTTP")}catch(t){}}}if(null==e&&window.createRequest)try{xmlhttp=window.createRequest()}catch(t){}return e}function wfu_plugin_encode_string(e){var t,a=0,l="",n="";for(a=0;a<e.length;a++)t=e.charCodeAt(a),t>=2048?t=((16773120&t|917504)<<4)+((4032&t|8192)<<2)+(63&t|128):t>=128&&(t=((65472&t|12288)<<2)+(63&t|128)),n=t.toString(16),(1==n.length||3==n.length||5==n.length)&&(n="0"+n),l+=n;return l}function wfu_plugin_decode_string(e){for(var t,a,l=0,n="";l<e.length;)t=parseInt(e.substr(l,2),16),a=128>t?t:224>t?((31&t)<<6)+(63&parseInt(e.substr(l+=2,2),16)):((15&t)<<12)+((63&parseInt(e.substr(l+=2,2),16))<<6)+(63&parseInt(e.substr(l+=2,2),16)),n+=String.fromCharCode(a),l+=2;return n}function wfu_schedule_save_shortcode(){var e=new Date,t=ShortcodeNextSave-e.getTime();null!=ShortcodeTimeOut&&(clearTimeout(ShortcodeTimeOut),ShortcodeTimeOut=null),0>=t?wfu_save_shortcode():ShortcodeTimeOut=setTimeout(function(){wfu_save_shortcode()},t)}function wfu_check_page_obsolescence(){PageObsolete||PageUpdating||""==document.getElementById("wfu_shortcode_postid").value}function wfu_save_shortcode(){if(!PageObsolete){var e=wfu_GetHttpRequestObject();if(null!=e){PageUpdating=!0,document.getElementById("wfu_update_failed_message").style.display="none";var t=AdminParams.wfu_ajax_url;params=new Array(6),params[0]=new Array(2),params[0][0]="action",params[0][1]="wfu_ajax_action_save_shortcode",params[1]=new Array(2),params[1][0]="shortcode",params[1][1]=wfu_plugin_encode_string(ShortcodeString),params[2]=new Array(2),params[2][0]="shortcode_original",params[2][1]=document.getElementById("wfu_shortcode_original_enc").value,params[3]=new Array(2),params[3][0]="post_id",params[3][1]=document.getElementById("wfu_shortcode_postid").value,params[4]=new Array(2),params[4][0]="post_hash",params[4][1]=document.getElementById("wfu_shortcode_posthash").value,params[5]=new Array(2),params[5][0]="shortcode_position",params[5][1]=document.getElementById("wfu_shortcode_position").value;for(var a="",l=0;l<params.length;l++)a+=(l>0?"&":"")+params[l][0]+"="+encodeURI(params[l][1]);var n=new Date;Autosave?ShortcodeNextSave=n.getTime()+5e3:document.getElementById("wfu_update_shortcode")&&(document.getElementById("wfu_update_shortcode_wait").style.display="inline"),e.open("POST",t,!0),e.setRequestHeader("Content-type","application/x-www-form-urlencoded"),e.onreadystatechange=function(){if(4==e.readyState&&200==e.status){PageUpdating=!1;var t="wfu_save_shortcode:",a=e.responseText.indexOf(t);-1==a&&(a=e.responseText.length);var l=(e.responseText.substr(0,a),e.responseText.substr(a+t.length,e.responseText.length-a-t.length));a=l.indexOf(":");var d=l.substr(0,a);txt_value=l.substr(a+1,l.length-a-1),"success"==d?(Autosave?(document.getElementById("wfu_save_label").innerHTML="saved",document.getElementById("wfu_save_label").className="wfu_save_label",document.getElementById("wfu_save_label").style.opacity=1,wfu_fadeout_element(300),ShortcodeNextSave=n.getTime()+1e3,null!=ShortcodeTimeOut&&wfu_schedule_save_shortcode()):document.getElementById("wfu_update_shortcode")&&(document.getElementById("wfu_update_shortcode_wait").style.display="none",document.getElementById("wfu_update_shortcode").disabled=!0,window.plugin_window&&window.plugin_window.location.reload(!0)),""!=document.getElementById("wfu_shortcode_postid").value&&(document.getElementById("wfu_shortcode_original_enc").value=wfu_plugin_encode_string("[wordpress_file_upload "+ShortcodeString+"]"),document.getElementById("wfu_shortcode_posthash").value=txt_value,setTimeout(function(){wfu_check_page_obsolescence()},CheckObsolescenceTimeOut))):(Autosave&&(document.getElementById("wfu_save_label").innerHTML="not saved",document.getElementById("wfu_save_label").className="wfu_save_label_fail",document.getElementById("wfu_save_label").style.opacity=1,wfu_fadeout_element(300)),"fail"==d&&("post_modified"==txt_value?(PageObsolete=!0,document.getElementById("wfu_update_shortcode")&&(document.getElementById("wfu_update_shortcode").disabled=!0),document.getElementById("wfu_update_rejected_message").style.display="block"):document.getElementById("wfu_update_failed_message").style.display="block"))}},e.send(a)}}}function wfu_adjust_opacity(e){document.getElementById("wfu_save_label").style.opacity=e}function wfu_fadeout_element(e){for(var t=20,a=0,l=0;t>l;l++)a=1-l/t,setTimeout('wfu_adjust_opacity("'+a.toString()+'")',l*e/t);setTimeout('wfu_adjust_opacity("0.0")',l*e/t)}function wfu_apply_value(e,t,a){if("onoff"==t)document.getElementById("wfu_attribute_"+e).className="wfu_onoff_container_"+("true"!=a?"on":"off"),wfu_admin_onoff_clicked(e);else if("text"==t||"ltext"==t||"integer"==t||"float"==t||"mtext"==t||"color"==t){var l=document.getElementById("wfu_attribute_"+e);if(a=a.replace(/\%n\%/gm,"\n"),a=a.replace(/\%dq\%/gm,'"'),a=a.replace(/\%brl\%/gm,"["),a=a.replace(/\%brr\%/gm,"]"),"color"==t){var n=colourNameToHex(a);n||(n=a),jQuery("#wfu_attribute_"+e).wpColorPicker("color",n)}l.value=a,wfu_update_text_value({target:l})}else if("placements"==t)wfu_admin_recreate_placements_panel(a),document.getElementById("wfu_attribute_value_placements").value=a,wfu_generate_shortcode();else if("radio"==t){for(var d=document.getElementsByName("wfu_radioattribute_"+e),u=0;u<d.length;u++)d[u].checked=d[u].value==a||"*"+d[u].value==a;wfu_admin_radio_clicked(e)}else if("ptext"==t){a=a.replace(/\%n\%/gm,"\n"),a=a.replace(/\%dq\%/gm,'"'),a=a.replace(/\%brl\%/gm,"["),a=a.replace(/\%brr\%/gm,"]");var r=a.split("/"),o=r.length<1?"":r[0],_=r.length<2?o:r[1],s=document.getElementById("wfu_attribute_s_"+e);s.value=o;var f=document.getElementById("wfu_attribute_p_"+e);f.value=_,wfu_update_ptext_value({target:s}),wfu_update_ptext_value({target:f})}else if("mchecklist"==t){if(a=a.toLowerCase(),"all"==a)document.getElementById("wfu_attribute_"+e+"_all").checked=!0;else{document.getElementById("wfu_attribute_"+e+"_all").checked=!1;for(var i=a.split(","),u=0;u<i.length;u++)i[u]=i[u].trim();jQuery("#wfu_attribute_"+e+" input").each(function(){jQuery(this).prop("checked",i.indexOf(jQuery(this).next().html())>-1)})}wfu_update_mchecklist_value(e)}else if("rolelist"==t){if(a=a.toLowerCase(),"all"==a)document.getElementById("wfu_attribute_"+e+"_all").checked=!0;else{document.getElementById("wfu_attribute_"+e+"_all").checked=!1;for(var c=a.split(","),u=0;u<c.length;u++)c[u]=c[u].trim();for(var l=document.getElementById("wfu_attribute_"+e),u=0;u<l.options.length;u++)l.options[u].selected=c.indexOf(l.options[u].value)>-1}wfu_update_rolelist_value(e)}else if("dimensions"==t){for(var m,w,g,l,p=a.split(","),v=document.getElementsByName("wfu_dimension_elements_"+e),u=0;u<v.length;u++)v[u].value="";for(var u=0;u<p.length;u++)m=p[u].split(":",2),w=m.length<1?"":m[0],g=m.length<2?w:m[1],l=document.getElementById("wfu_attribute_"+e+"_"+w.trim()),l&&(l.value=g.trim());l=v[0],wfu_update_dimension_value({target:l})}else if("userfields"==t){for(var b,h=a.split("/"),y=Array(),u=0;u<h.length;u++)b="*"==h[u].substr(0,1),b&&(h[u]=h[u].substr(1)),""!=h[u]&&y.push({name:h[u],required:b});for(var I=document.getElementById("wfu_attribute_"+e),E=null,B=Array(),u=0;u<I.childNodes.length;u++)1===I.childNodes[u].nodeType&&(null==E?E=I.childNodes[u]:B.push(I.childNodes[u]));for(var u=0;u<B.length;u++)I.removeChild(B[u]);wfu_userdata_edit_field(E,"",!1);for(var x,N=E,u=0;u<y.length;u++)0==u?wfu_userdata_edit_field(E,y[u].name,y[u].required):(x=N.cloneNode(!0),wfu_userdata_edit_field(x,y[u].name,y[u].required),I.insertBefore(x,N.nextSibling),N=x);for(var l,u=0;u<E.childNodes.length&&(l=E.childNodes[u],"INPUT"!=l.tagName);u++);wfu_update_userfield_value({target:l})}else if("color-triplet"==t){for(var k=a.split(","),u=0;u<k.length;u++)k[u]=k[u].trim();2==k.length?k=[k[0],k[1],"#000000"]:1==k.length?k=[k[0],"#FFFFFF","#000000"]:k.length<3&&(k=["#000000","#FFFFFF","#000000"]);var n=colourNameToHex(k[0]);n||(n=k[0]),jQuery("#wfu_attribute_"+e+"_color").wpColorPicker("color",n);var l=document.getElementById("wfu_attribute_"+e+"_color");l.value=k[0],n=colourNameToHex(k[1]),n||(n=k[1]),jQuery("#wfu_attribute_"+e+"_bgcolor").wpColorPicker("color",n),document.getElementById("wfu_attribute_"+e+"_bgcolor").value=k[1],n=colourNameToHex(k[2]),n||(n=k[2]),jQuery("#wfu_attribute_"+e+"_borcolor").wpColorPicker("color",n),document.getElementById("wfu_attribute_"+e+"_borcolor").value=k[2],wfu_update_triplecolor_value({target:l})}else if("folderlist"==t){for(var i=wfu_parse_folderlist_js(a),T=document.getElementById("wfu_attribute_"+e).options;T.length>0;)T.remove(0);for(var H,A,j,C,O,D,u=0;u<i.path.length;u++){A=i.path[u],"/"==A.substr(A.length,1)&&(A=A.substr(0,A.length-1)),j=A.split("/"),A=j[j.length-1],O=parseInt(i.level[u]),C="",D="";for(var S=0;O>S;S++)C+="&nbsp;&nbsp;&nbsp;",D+="*";C+=i.label[u],i.default[u]&&(D+="&"),D+=""==A?"{root}/"+i.label[u]:A+i.label[u],H=document.createElement("option"),H.className=i.default[u]?"wfu_select_folders_option_default":"",H.value=wfu_plugin_encode_string(D),H.innerHTML=C,T.add(H)}H=document.createElement("option"),H.value="",H.innerHTML="",T.add(H);var L=document.getElementById("wfu_attribute_"+e);L.data=wfu_decode_subfolder_list(e),wfu_subfolders_update_toolnav(e),l=L,a!==l.oldVal&&(l.oldVal=a,document.getElementById("wfu_attribute_value_"+e).value=a,wfu_generate_shortcode())}}function wfu_parse_folderlist_js(e){var t=Object();if(t.path=Array(),t.label=Array(),t.level=Array(),t.default=Array(),"auto"==e.substr(0,4))return t;var a=e.split(",");if(0==a.length)return t;if(1==a.length&&""==a[0].trim())return t;for(var l,n,d,u,r,o,_,s=["root"],f=0,i=0,c=-1,m=0;m<a.length;m++){for(l=a[m].trim(),n=0,d="",u=!1;n<l.length&&"*"==l.substr(n,1);)n++,d+="&nbsp;&nbsp;&nbsp;";if(1>=n-f&&(n>0||0==i)&&(l=l.substr(n,l.length-n),"&"==l.substr(0,1)&&(l=l.substr(1),u=!0),subfolder_items=l.split("/"),subfolder_items.length<2&&subfolder_items.push(""),""!=subfolder_items[1]?(r=subfolder_items[0],o=subfolder_items[1]):(r=l,o=l),""!=r)){u&&-1==c?c=t.path.length:u=!1,0==n&&(i=1),s.length>n?s[n]=r:s.push(r),_="";for(var w=1;n>=w;w++)_+=s[w]+"/";t.path.push(_),t.label.push(o),t.level.push(n),t.default.push(u),f=n}}return t}function colourNameToHex(e){var t={aliceblue:"#f0f8ff",antiquewhite:"#faebd7",aqua:"#00ffff",aquamarine:"#7fffd4",azure:"#f0ffff",beige:"#f5f5dc",bisque:"#ffe4c4",black:"#000000",blanchedalmond:"#ffebcd",blue:"#0000ff",blueviolet:"#8a2be2",brown:"#a52a2a",burlywood:"#deb887",cadetblue:"#5f9ea0",chartreuse:"#7fff00",chocolate:"#d2691e",coral:"#ff7f50",cornflowerblue:"#6495ed",cornsilk:"#fff8dc",crimson:"#dc143c",cyan:"#00ffff",darkblue:"#00008b",darkcyan:"#008b8b",darkgoldenrod:"#b8860b",darkgray:"#a9a9a9",darkgreen:"#006400",darkkhaki:"#bdb76b",darkmagenta:"#8b008b",darkolivegreen:"#556b2f",darkorange:"#ff8c00",darkorchid:"#9932cc",darkred:"#8b0000",darksalmon:"#e9967a",darkseagreen:"#8fbc8f",darkslateblue:"#483d8b",darkslategray:"#2f4f4f",darkturquoise:"#00ced1",darkviolet:"#9400d3",deeppink:"#ff1493",deepskyblue:"#00bfff",dimgray:"#696969",dodgerblue:"#1e90ff",firebrick:"#b22222",floralwhite:"#fffaf0",forestgreen:"#228b22",fuchsia:"#ff00ff",gainsboro:"#dcdcdc",ghostwhite:"#f8f8ff",gold:"#ffd700",goldenrod:"#daa520",gray:"#808080",green:"#008000",greenyellow:"#adff2f",honeydew:"#f0fff0",hotpink:"#ff69b4","indianred ":"#cd5c5c","indigo ":"#4b0082",ivory:"#fffff0",khaki:"#f0e68c",lavender:"#e6e6fa",lavenderblush:"#fff0f5",lawngreen:"#7cfc00",lemonchiffon:"#fffacd",lightblue:"#add8e6",lightcoral:"#f08080",lightcyan:"#e0ffff",lightgoldenrodyellow:"#fafad2",lightgrey:"#d3d3d3",lightgreen:"#90ee90",lightpink:"#ffb6c1",lightsalmon:"#ffa07a",lightseagreen:"#20b2aa",lightskyblue:"#87cefa",lightslategray:"#778899",lightsteelblue:"#b0c4de",lightyellow:"#ffffe0",lime:"#00ff00",limegreen:"#32cd32",linen:"#faf0e6",magenta:"#ff00ff",maroon:"#800000",mediumaquamarine:"#66cdaa",mediumblue:"#0000cd",mediumorchid:"#ba55d3",mediumpurple:"#9370d8",mediumseagreen:"#3cb371",mediumslateblue:"#7b68ee",mediumspringgreen:"#00fa9a",mediumturquoise:"#48d1cc",mediumvioletred:"#c71585",midnightblue:"#191970",mintcream:"#f5fffa",mistyrose:"#ffe4e1",moccasin:"#ffe4b5",navajowhite:"#ffdead",navy:"#000080",oldlace:"#fdf5e6",olive:"#808000",olivedrab:"#6b8e23",orange:"#ffa500",orangered:"#ff4500",orchid:"#da70d6",palegoldenrod:"#eee8aa",palegreen:"#98fb98",paleturquoise:"#afeeee",palevioletred:"#d87093",papayawhip:"#ffefd5",peachpuff:"#ffdab9",peru:"#cd853f",pink:"#ffc0cb",plum:"#dda0dd",powderblue:"#b0e0e6",purple:"#800080",red:"#ff0000",rosybrown:"#bc8f8f",royalblue:"#4169e1",saddlebrown:"#8b4513",salmon:"#fa8072",sandybrown:"#f4a460",seagreen:"#2e8b57",seashell:"#fff5ee",sienna:"#a0522d",silver:"#c0c0c0",skyblue:"#87ceeb",slateblue:"#6a5acd",slategray:"#708090",snow:"#fffafa",springgreen:"#00ff7f",steelblue:"#4682b4",tan:"#d2b48c",teal:"#008080",thistle:"#d8bfd8",tomato:"#ff6347",turquoise:"#40e0d0",violet:"#ee82ee",wheat:"#f5deb3",white:"#ffffff",whitesmoke:"#f5f5f5",yellow:"#ffff00",yellowgreen:"#9acd32"};return"undefined"!=typeof t[e.toLowerCase()]?t[e.toLowerCase()]:!1}function wfu_download_file(e,t,a){var l=wfu_GetHttpRequestObject();if(null!=l){var n=AdminParams.wfu_ajax_url;params=new Array(3),params[0]=new Array(2),params[0][0]="action",params[0][1]="wfu_ajax_action_download_file_invoker",params[1]=new Array(2),params[1][0]="file",params[1][1]=e,params[2]=new Array(2),params[2][0]="nonce",params[2][1]=a;for(var d="",u=0;u<params.length;u++)d+=(u>0?"&":"")+params[u][0]+"="+encodeURI(params[u][1]);l.open("POST",n,!0),l.setRequestHeader("Content-type","application/x-www-form-urlencoded"),l.onreadystatechange=function(){if(4==l.readyState&&200==l.status){var a="wfu_ajax_action_download_file_invoker:",n=l.responseText.indexOf(a);-1==n&&(n=l.responseText.length);var d=(l.responseText.substr(0,n),l.responseText.substr(n+a.length,l.responseText.length-n-a.length));n=d.indexOf(":");var u=d.substr(0,n);if(txt_value=d.substr(n+1,d.length-n-1),"wfu_download_id;"==u.substr(0,16)){var r=u.substr(16),o=document.getElementById("wfu_file_download_container_"+t);o.innerHTML=txt_value,setTimeout("wfu_download_file_monitor('"+e+"', "+t+", '"+r+"')",100)}}},l.send(d)}}function wfu_download_file_monitor(e,t,a){var l=wfu_GetHttpRequestObject();if(null!=l){var n=AdminParams.wfu_ajax_url;params=new Array(3),params[0]=new Array(2),params[0][0]="action",params[0][1]="wfu_ajax_action_download_file_monitor",params[1]=new Array(2),params[1][0]="file",params[1][1]=e,params[2]=new Array(2),params[2][0]="id",params[2][1]=a;for(var d="",u=0;u<params.length;u++)d+=(u>0?"&":"")+params[u][0]+"="+encodeURI(params[u][1]);l.open("POST",n,!0),l.setRequestHeader("Content-type","application/x-www-form-urlencoded"),l.onreadystatechange=function(){if(4==l.readyState&&200==l.status){var a="wfu_ajax_action_download_file_monitor:",n=l.responseText.indexOf(a);-1==n&&(n=l.responseText.length);var d=(l.responseText.substr(0,n),l.responseText.substr(n+a.length,l.responseText.length-n-a.length));n=d.indexOf(":");var u=d.substr(0,n);if(txt_value=d.substr(n+1,d.length-n-1),"repeat"!=u){var r=document.getElementById("wfu_file_download_container_"+t);r.innerHTML=""}else"repeat"==u&&setTimeout("wfu_download_file_monitor('"+e+"', "+t+", '"+txt_value+"')",100)}},l.send(d)}}function wfu_filedetails_userdata_changed(){for(var e,t,a=document.getElementsByName("wfu_filedetails_userdata"),l=!1,n=0;n<a.length;n++)if(e=document.getElementById(a[n].id.replace("wfu_filedetails_userdata_value_","wfu_filedetails_userdata_default_")),t=document.getElementById(a[n].id.replace("wfu_filedetails_userdata_value_","wfu_filedetails_userdata_")),t.value=a[n].value,a[n].value!=e.value){l=!0;break}document.getElementById("dp_filedetails_submit_fields").disabled=!l}function wfu_Attach_FileDetails_Admin_Events(){for(var e=document.getElementsByName("wfu_filedetails_userdata"),t=0;t<e.length;t++)wfu_attach_element_handlers(e[t],wfu_filedetails_userdata_changed)}var DraggedItem=null,ShortcodeNextSave=0,ShortcodeTimeOut=null,ShortcodeString="",Autosave=!1,PageObsolete=!1,PageUpdating=!1,CheckObsolescenceTimeOut=5e3;jQuery(document).ready(function(e){e(".wfu_color_field").wpColorPicker({change:function(e,t){e.target.value=t.color.toString(),"wfu_text_elements"==e.target.name?wfu_update_text_value(e):"wfu_triplecolor_elements"==e.target.name&&wfu_update_triplecolor_value(e)}})});
js/wordpress_file_upload_functions.js CHANGED
@@ -1,2 +1,2 @@
1
- function wfu_Initialize_Consts(e){if("undefined"==typeof GlobalData.consts){GlobalData.consts=new Object;for(var a=e.split(";"),t=0;t<a.length;t++)const_txt=a[t].split(":"),GlobalData.consts[wfu_plugin_decode_string(const_txt[0])]=wfu_plugin_decode_string(const_txt[1])}}function wfu_install_unload_hook(){window.onbeforeunload=wfu_unload_hook}function wfu_unload_hook(){return""!=GlobalData.UploadInProgressString.trim()?GlobalData.consts.wfu_pageexit_prompt:void 0}function wfu_Check_Browser_Capabilities(){if("undefined"==typeof wfu_BrowserCaps){wfu_BrowserCaps=new Object;var e=wfu_GetHttpRequestObject();wfu_BrowserCaps.supportsAJAX=null!=e,wfu_BrowserCaps.supportsUploadProgress=!!(e&&"upload"in e&&"onprogress"in e.upload);var a=null;try{var a=new FormData}catch(t){}wfu_BrowserCaps.supportsHTML5=null!=a;var t=document.createElement("iframe");wfu_BrowserCaps.supportsIFRAME=null!=t,wfu_BrowserCaps.supportsDRAGDROP=window.FileReader?!0:!1,wfu_BrowserCaps.supportsAnimation=wfu_check_animation(),wfu_BrowserCaps.isSafari=Object.prototype.toString.call(window.HTMLElement).indexOf("Constructor")>0}}function wfu_check_animation(){var e=!1,a="animation",t="",s="Webkit Moz O ms Khtml".split(" "),n="",r=document.createElement("DIV");if(r.style.animationName&&(e=!0),e===!1)for(var l=0;l<s.length;l++)if(void 0!==r.style[s[l]+"AnimationName"]){n=s[l],a=n+"Animation",t="-"+n.toLowerCase()+"-",e=!0;break}return e}function wfu_join_strings(e){for(var a=[].slice.call(arguments),t="",s="",n=1;n<a.length;n++)s=""==t||""==a[n]?"":e,t+=s+a[n];return t}function wfu_plugin_decode_string(e){for(var a,t,s=0,n="";s<e.length;)a=parseInt(e.substr(s,2),16),t=128>a?a:224>a?((31&a)<<6)+(63&parseInt(e.substr(s+=2,2),16)):((15&a)<<12)+((63&parseInt(e.substr(s+=2,2),16))<<6)+(63&parseInt(e.substr(s+=2,2),16)),n+=String.fromCharCode(t),s+=2;return n}function wfu_plugin_encode_string(e){var a=0,t="",s="";for(a=0;a<e.length;a++)num=e.charCodeAt(a),num>=2048?num=((16773120&num|917504)<<4)+((4032&num|8192)<<2)+(63&num|128):num>=128&&(num=((65472&num|12288)<<2)+(63&num|128)),s=num.toString(16),(1==s.length||3==s.length||5==s.length)&&(s="0"+s),t+=s;return t}function wfu_randomString(e){for(var a="0123456789ABCDEFGHIJKLMNOPQRSTUVWXTZabcdefghiklmnopqrstuvwxyz",t=e,s="",n=0;t>n;n++){var r=Math.floor(Math.random()*a.length);s+=a.substring(r,r+1)}return s}function wfu_addEventHandler(e,a,t){e.addEventListener?e.addEventListener(a,t,!1):e.attachEvent?e.attachEvent("on"+a,t):e["on"+a]=t}function wfu_GetHttpRequestObject(){var e=null;try{e=new XMLHttpRequest}catch(a){try{e=new ActiveXObject("Msxml2.XMLHTTP")}catch(t){try{e=new ActiveXObject("Microsoft.XMLHTTP")}catch(a){}}}if(null==e&&window.createRequest)try{xmlhttp=window.createRequest()}catch(a){}return e}function wfu_filedetails_showhide(e,a,t){var s=(document.getElementById("wfu_messageblock_arrow_"+e+"_"+a),document.getElementById("wfu_messageblock_arrow_"+e+"_up_"+a)),n=document.getElementById("wfu_messageblock_arrow_"+e+"_down_"+a),r=document.getElementById("wfu_messageblock_subheader_"+e+"_"+a),l=document.getElementById("wfu_messageblock_header_"+e+"_state_"+a);t?(s.style.display="",n.style.display="none",r.style.display="",l.value=""):(s.style.display="none",n.style.display="",r.style.display="none",l.value="none")}function wfu_get_file_ids(e){for(var a=(document.getElementById("wfu_messageblock_"+e),document.getElementById("wfu_messageblock_subheader_"+e).nextSibling),t="wfu_messageblock_"+e+"_",s=[];null!=a;)1===a.nodeType&&a.id.substr(0,t.length)==t&&s.push(a.id.substr(a.id.lastIndexOf("_")+1)),a=a.nextSibling;return s}function wfu_get_filelist(e,a){a="undefined"!=typeof a?a:!0;var t=document.getElementById("upfile_"+e),s=t.files;return s||(s=t.value?[{name:t.value}]:[]),a&&"undefined"!=typeof t.filearray&&(s=t.filearray),s}function wfu_filedetails_toggle(e,a){var t=(document.getElementById("wfu_messageblock_arrow_"+e+"_"+a),document.getElementById("wfu_messageblock_arrow_"+e+"_up_"+a));wfu_filedetails_showhide(e,a,"none"==t.style.display)}function wfu_headerdetails_showhide(e,a){var t=(document.getElementById("wfu_messageblock_arrow_"+e),document.getElementById("wfu_messageblock_arrow_"+e+"_up")),s=document.getElementById("wfu_messageblock_arrow_"+e+"_down"),n=document.getElementById("wfu_messageblock_subheader_"+e),r=document.getElementById("wfu_messageblock_subheader_"+e+"_message"),l=document.getElementById("wfu_messageblock_subheader_"+e+"_adminmessage"),o=document.getElementById("wfu_messageblock_header_"+e+"_state"),i=wfu_get_file_ids(e);if(a){t.style.display="",s.style.display="none",("none"!=r.style.display||"none"!=l.style.display)&&(n.style.display=""),o.value="";for(var _=0;_<i.length;_++)document.getElementById("wfu_messageblock_"+e+"_"+i[_]).style.display="",document.getElementById("wfu_messageblock_subheader_"+e+"_"+i[_]).style.display=document.getElementById("wfu_messageblock_header_"+e+"_state_"+i[_]).value}else{t.style.display="none",s.style.display="",n.style.display="none",o.value="none";for(var _=0;_<i.length;_++)document.getElementById("wfu_messageblock_"+e+"_"+i[_]).style.display="none",document.getElementById("wfu_messageblock_subheader_"+e+"_"+i[_]).style.display="none"}}function wfu_headerdetails_toggle(e){var a=(document.getElementById("wfu_messageblock_arrow_"+e),document.getElementById("wfu_messageblock_arrow_"+e+"_up"));wfu_headerdetails_showhide(e,"none"==a.style.display)}function wfu_selectbutton_changed(e,a){wfu_BrowserCaps.supportsAJAX&&wfu_BrowserCaps.supportsHTML5||(a=0);var t=document.getElementById("upfile_"+e),s=wfu_get_filelist(e,!1);if(1==a){"undefined"==typeof t.filearray&&(t.filearray=Array());for(var n=0;n<s.length;n++)t.filearray.push(s[n])}wfu_update_filename_text(e)}function wfu_selectbutton_clicked(e){var a=document.getElementById("wordpress_file_upload_message_"+e);a&&(a.style.display="none"),wfu_reset_message(e),document.getElementById("upfile_"+e).value="";var t=document.getElementById("fileName_"+e);t&&(t.value="",t.className="file_input_textbox")}function wfu_update_uploadbutton_status(e){var a=document.getElementById("upload_"+e);if(a){var t=wfu_get_filelist(e),s=t.length>0;a.disabled=!s}}function wfu_update_filename_text(e){var a=document.getElementById("fileName_"+e);if(a){for(var t=wfu_get_filelist(e),s="",n=0;n<t.length;n++)""!=s&&(s+=", "),s+=t[n].name.replace(/c:\\fakepath\\/i,"");a.value=s}}function wfu_selectsubdir_check(e){var a=document.getElementById("selectsubdir_"+e);return a?(document.getElementById("hiddeninput_"+e).value=a.selectedIndex,0==a.selectedIndex?(a.style.backgroundColor="red",!1):(a.style.backgroundColor="transparent",a.options[0].style.display="none",!0)):!0}function wfu_Redirect(e){window.location=e}function wfu_loadStart(){}function wfu_uploadProgress(e,a,t,s){s&&"undefined"==typeof this.xhr&&(console.log("total="+e.total+", loaded="+e.loaded),console.log(e));var n=GlobalData[a].xhrs[t],r=0,l=0,o=document.getElementById("progressbar_"+a+"_animation");if(e.lengthComputable){if(n.sizeloaded=e.loaded,n.size<e.total&&e.total>0){l=e.total-n.size,n.deltasize+=l,n.size+=l;for(var i=0;i<GlobalData[a].xhrs.length;i++)GlobalData[a].xhrs[i].file_id==n.file_id&&(GlobalData[a].xhrs[i].totalsize+=l)}if(o){for(var _=0,d=0,u=[],i=0;i<GlobalData[a].xhrs.length;i++)u[GlobalData[a].xhrs[i].file_id]=0;for(var i=0;i<GlobalData[a].xhrs.length;i++)u[GlobalData[a].xhrs[i].file_id]=Math.max(GlobalData[a].xhrs[i].totalsize,u[GlobalData[a].xhrs[i].file_id]);for(var i=0;i<u.length;i++)"undefined"!=typeof u[i]&&(_+=u[i]);for(var i=0;i<GlobalData[a].xhrs.length;i++)d+=GlobalData[a].xhrs[i].sizeloaded;r=Math.round(100*d/_),o.style.width=r.toString()+"%"}}else o&&(o.style.width="0%")}function wfu_notify_WPFilebase(e,a){var t=wfu_GetHttpRequestObject();if(null==t){var s=document.createElement("iframe");return s.style.display="none",s.src=GlobalData.consts.ajax_url+"?action=wfu_ajax_action_notify_wpfilebase&params_index="+e+"&session_token="+a,void document.body.appendChild(s)}var n=GlobalData.consts.ajax_url;params=new Array(3),params[0]=new Array(2),params[0][0]="action",params[0][1]="wfu_ajax_action_notify_wpfilebase",params[1]=new Array(2),params[1][0]="params_index",params[1][1]=e,params[2]=new Array(2),params[2][0]="session_token",params[2][1]=a;for(var r="",s=0;s<params.length;s++)r+=(s>0?"&":"")+params[s][0]+"="+encodeURI(params[s][1]);t.open("POST",n,!0),t.setRequestHeader("Content-type","application/x-www-form-urlencoded"),t.onreadystatechange=function(){},t.send(r)}function wfu_send_email_notification(e,a,t,s,n,r,l,o,i){var _=wfu_GetHttpRequestObject();if(null!=_){var d=GlobalData.consts.ajax_url,u=wfu_get_userdata_count(e);params=new Array(7+u),params[0]=new Array(2),params[0][0]="action",params[0][1]="wfu_ajax_action_send_email_notification",params[1]=new Array(2),params[1][0]="params_index",params[1][1]=t,params[2]=new Array(2),params[2][0]="session_token",params[2][1]=s,params[3]=new Array(2),params[3][0]="only_filename_list",params[3][1]=n,params[4]=new Array(2),params[4][0]="target_path_list",params[4][1]=r,params[5]=new Array(2),params[5][0]="attachment_list",params[5][1]=l,params[6]=new Array(2),params[6][0]="unique_id",params[6][1]=a;for(var m=0;u>m;m++)params[7+m]=new Array(2),params[7+m][0]="userdata_"+m,params[7+m][1]=wfu_plugin_encode_string(document.getElementById("hiddeninput_"+e+"_userdata_"+m).value);for(var c="",m=0;m<params.length;m++)c+=(m>0?"&":"")+params[m][0]+"="+encodeURI(params[m][1]);var f=new Date;_.xhrid=-1,_.shortcode_id=e,_.requesttype="email",_.file_id=0,_.loading=!1,_.aborted=!1,_.unique_id=a,_.debugmode=o,_.is_admin=i,_.params_index=t,_.session_token=s,_.start_time=f.getTime(),_.end_time=_.start_time,_.finish_time=_.start_time+1e3*parseInt(GlobalData.consts.max_time_limit),_.fail_colors=GlobalData.consts.fail_colors,_.error_message_header="",_.error_message_failed=GlobalData.consts.message_failed,_.error_message_cancelled=GlobalData.consts.message_cancelled,_.error_adminmessage_unknown="",_.open("POST",d,!0),_.setRequestHeader("Content-type","application/x-www-form-urlencoded"),_.addEventListener("load",wfu_uploadComplete,!1),_.addEventListener("error",wfu_uploadFailed,!1),_.addEventListener("abort",wfu_uploadCanceled,!1),_.send(c)}}function wfu_format_debug_data(e,a){return output='<label class="file_messageblock_subheader_debugmessage_label">',output+="Debug Data"+a,output+="</label>",output+='<div class="file_messageblock_subheader_debugmessage_container">',output+=e,output+="</div>"}function wfu_uploadComplete(e){var a=new Date,t=this.shortcode_id,s=(this.file_id,!1),n="",r="",l="unknown",o="",i="wfu_fileupload_success:";this.loading=!1,this.end_time=a.getTime();var _=e.target.responseText,d=_,u="error";if(-1!=_&&_.indexOf("force_errorabort_code")>-1&&(u="errorabort",_=_.replace("force_errorabort_code","")),-1!=_){var m=_.indexOf(i);if(m>-1&&("true"==this.debugmode&&(o=_.substr(0,m)),d=_.substr(m+i.length),m=d.indexOf(":"),r=d.substr(0,m),n=d.substr(m+1)),""!=o){var c="";"fileupload"==this.requesttype?c=" - File: "+this.file_id:"email"==this.requesttype&&(c=" - Email Notification"),o=wfu_format_debug_data(o,c)}if(""!=r){var f=r.split(";");if(1==parseInt(f[2])){var g=f[3].split(",");l=wfu_plugin_decode_string(g[0])}}}if(""==n||""==r){var p=this.fail_colors.split(","),y=wfu_Initialize_Params();y.general.shortcode_id=t,y.general.unique_id=this.unique_id,y.general.state=7,y.general.files_count="fileupload"==this.requesttype?1:0,y.general.upload_finish_time=this.finish_time,y.general.fail_message=GlobalData.consts.message_unknown,y.general.fail_admin_message=wfu_join_strings("<br />",this.error_adminmessage_unknown,this.requesttype+":"+d),y.general.files_count>0?(y[0]={},y[0].color=p[0],y[0].bgcolor=p[1],y[0].borcolor=p[2],y[0].message_type=u,l=u,y[0].header=this.error_message_header,y[0].message=GlobalData.consts.message_timelimit,y[0].admin_messages="true"==this.is_admin?GlobalData.consts.message_admin_timelimit:""):y.general.admin_messages.other="true"==this.is_admin?GlobalData.consts.message_admin_timelimit:"",y.general.upload_finish_time>0&&a.getTime()<y.general.upload_finish_time&&(y.general.files_count>0?(y[0].message=y.general.fail_message,y[0].admin_messages="true"==this.is_admin?y.general.fail_admin_message:""):y.general.admin_messages.other="true"==this.is_admin?y.general.fail_admin_message:"")}return s=""==n||""==r?wfu_ProcessUploadComplete(t,this.file_id,y,this.unique_id,this.params_index,this.session_token,"",[this.debugmode,o,this.is_admin],this.requesttype):wfu_ProcessUploadComplete(t,this.file_id,n,this.unique_id,this.params_index,this.session_token,r,[this.debugmode,o,this.is_admin],this.requesttype),s&&(wfu_unlock_upload(e.target.shortcode_id),wfu_hide_simple_progressbar(t),wfu_clear(e.target.shortcode_id)),e.target.return_status?l:void 0}function wfu_ProcessUploadComplete(e,a,t,s,n,r,l,o,i){if(e&&!(0>e)&&null!=t&&""!=t&&""!=s&&("no-ajax"==s||GlobalData[e])){var _=!1;if("string"==typeof t){t=wfu_plugin_decode_string(t.replace(/^\s+|\s+$/g,""));var d=null;try{d=JSON.parse(t)}catch(u){}if(null==d){var m=l.split(";");d=wfu_Initialize_Params(),d.general.shortcode_id=e,d.general.unique_id=s,d.general.state=m[0],4==d.general.state&&d.general.state++;var c=m[1].split(","),f="",g=GlobalData.consts.jsonparse_filemessage,p=GlobalData.consts.jsonparse_message,y=GlobalData.consts.jsonparse_adminmessage;d.general.files_count=parseInt(m[2]);for(var w=0;w<d.general.files_count;w++)d[w]={},d[w].color=c[0],d[w].bgcolor=c[1],d[w].borcolor=c[2],f=m[w+3].split(","),d[w].message_type=wfu_plugin_decode_string(f[0]),d[w].header=wfu_plugin_decode_string(f[1]),"success"==d[w].message_type&&(d[w].header+=g,d[w].message_type="warning"),d[w].message=wfu_join_strings("<br />",p,wfu_plugin_decode_string(f[2])),d[w].admin_messages=wfu_join_strings("<br />",y,wfu_plugin_decode_string(f[3]))}}else{if("object"!=typeof t)return;var d=t}for(w=0;d[w];)d[w].message_type&&"error"==d[w].message_type.substr(0,5)&&(d[w].message_type=d[w].message_type.substr(0,5)),w++;var b=document.getElementById("wfu_messageblock_"+e),h=!0;if(!UploadStates[e]&&b){var v=document.getElementById("wfu_messageblock_header_"+e+"_states").value;v=wfu_plugin_decode_string(v.replace(/^\s+|\s+$/g,"")),UploadStates[e]=null;try{UploadStates[e]=JSON.parse(v)}catch(u){}null==UploadStates[e]&&(h=!1)}GlobalData[e]||(GlobalData[e]=Object());var I=GlobalData[e];if("no-ajax"==s)I.last=!1,I.unique_id="",I.files_count=d.general.files_count,0==d.general.state&&(d.general.files_count=0),I.files_processed=d.general.files_count,I.upload_state=h?d.general.state:10,I.message=d.general.message,I.update_wpfilebase=d.general.update_wpfilebase,I.redirect_link=d.general.redirect_link,I.notify_only_filename_list="",I.notify_target_path_list="",I.notify_attachment_list="",I.admin_messages={},I.admin_messages.wpfilebase=d.general.admin_messages.wpfilebase,I.admin_messages.notify=d.general.admin_messages.notify,I.admin_messages.redirect=d.general.admin_messages.redirect,I.admin_messages.debug=o[1],I.admin_messages.other=d.general.admin_messages.other,I.errors={},I.errors.wpfilebase=d.general.errors.wpfilebase,I.errors.notify=d.general.errors.notify,I.errors.redirect=d.general.errors.redirect,I.current_size=0,I.total_size=0;else{if(""==I.unique_id||I.unique_id!=s||I.unique_id!=d.general.unique_id)return;if(I.last)return;0==d.general.files_count&&d[0]&&"error"==d[0].message_type&&(d.general.files_count=1);for(var E="",w=0;w<d.general.files_count;w++)E="error"==d[w].message_type&&0==I.files_processed?"error1":"error"==d[w].message_type&&I.files_processed>0?"error2":d[w].message_type,I.upload_state=GlobalData.filestatematch[E][I.upload_state];h||(I.upload_state=10),I.files_processed+=d.general.files_count,I.message=wfu_join_strings("<br />",I.message,d.general.message),""==I.update_wpfilebase&&(I.update_wpfilebase=d.general.update_wpfilebase),(!i||i&&"email"!=i)&&(I.redirect_link=d.general.redirect_link),I.notify_only_filename_list=wfu_join_strings(", ",I.notify_only_filename_list,d.general.notify_only_filename_list),I.notify_target_path_list=wfu_join_strings(", ",I.notify_target_path_list,d.general.notify_target_path_list),I.notify_attachment_list=wfu_join_strings(",",I.notify_attachment_list,d.general.notify_attachment_list),I.admin_messages.debug=wfu_join_strings("<br />",I.admin_messages.debug,o[1]),I.admin_messages.other=wfu_join_strings("<br />",I.admin_messages.other,d.general.admin_messages.other),""==I.admin_messages.wpfilebase&&(I.admin_messages.wpfilebase=d.general.admin_messages.wpfilebase),""==I.admin_messages.notify&&(I.admin_messages.notify=d.general.admin_messages.notify),""==I.admin_messages.redirect&&(I.admin_messages.redirect=d.general.admin_messages.redirect),""==I.errors.wpfilebase&&(I.errors.wpfilebase=d.general.errors.wpfilebase),""==I.errors.notify&&(I.errors.notify=d.general.errors.notify),""==I.errors.redirect&&(I.errors.redirect=d.general.errors.redirect)}I.files_processed==I.files_count&&(I.last=!0,""!=I.update_wpfilebase&&(I.admin_messages.wpfilebase="",wfu_notify_WPFilebase(n,r)),""!=I.notify_only_filename_list&&(I.admin_messages.notify="",wfu_send_email_notification(e,s,n,r,I.notify_only_filename_list,I.notify_target_path_list,I.notify_attachment_list,o[0],o[2]),I.last=!1,I.notify_only_filename_list=""),I.last&&(wfu_notify_server_upload_ended(s,n,r),GlobalData.UploadInProgressString=GlobalData.UploadInProgressString.replace(new RegExp("\\["+s+"\\]","g"),"")),""!=I.errors.redirect&&(I.redirect_link=""),""!=I.redirect_link&&I.last&&""==GlobalData.UploadInProgressString.trim()&&(I.upload_state=11,_=!0));var B=I.message,k=wfu_join_strings("<br />",I.admin_messages.other,I.admin_messages.wpfilebase,I.admin_messages.notify,I.admin_messages.redirect,I.admin_messages.debug);if(!h){var x=GlobalData.consts.jsonparse_headermessage,D=GlobalData.consts.jsonparse_headeradminmessage;B=wfu_join_strings("<br />",x,B),k=wfu_join_strings("<br />",D,k)}if(I.last){0==I.files_count?I.upload_state=8:I.upload_state<4&&(I.upload_state+=4);{""!=I.admin_messages.wpfilebase||""!=I.admin_messages.notify||""!=I.admin_messages.redirect||""!=I.admin_messages.other}4==I.upload_state&&""!=k?I.upload_state++:5==I.upload_state&&""==!k&&""==B&&I.upload_state--}if(b){var G=document.getElementById("wfu_messageblock_header_"+e+"_state"),T=1==I.files_count&&""==B&&""==k&&I.last&&!_;if(T)document.getElementById("wfu_messageblock_header_"+e).style.display="none";else{document.getElementById("wfu_messageblock_header_"+e).style.display="";var j=document.getElementById("wfu_messageblock_header_"+e+"_container");if(h){var q="";1!=I.files_count||5!=I.upload_state&&7!=I.upload_state||(q="_singlefile"),j.innerHTML=UploadStates[e]["State"+I.upload_state+q]}else{j.innerHTML="";var C=document.getElementById("wfu_messageblock_header_"+e+"_safecontainer");j.innerHTML=C.innerHTML.replace(/_safe/g,"")}var S=!1;""!=B?(document.getElementById("wfu_messageblock_subheader_"+e+"_message").style.display="",document.getElementById("wfu_messageblock_subheader_"+e+"_messagelabel").innerHTML=B,S=!0):document.getElementById("wfu_messageblock_subheader_"+e+"_message").style.display="none",""!=k?(document.getElementById("wfu_messageblock_subheader_"+e+"_adminmessage").style.display="",document.getElementById("wfu_messageblock_subheader_"+e+"_adminmessagelabel").innerHTML=k,S=!0):document.getElementById("wfu_messageblock_subheader_"+e+"_adminmessage").style.display="none",document.getElementById("wfu_messageblock_subheader_"+e).style.display=S?G.value:"none",S||I.files_processed>0?(j.colSpan=2,document.getElementById("wfu_messageblock_arrow_"+e).style.display=""):(document.getElementById("wfu_messageblock_arrow_"+e).style.display="none",j.colSpan=3)}for(var A=document.getElementById("wfu_messageblock_subheader_"+e),O=0,H=null,L=document.getElementById("wfu_messageblock_"+e+"_filetemplate"),P="",M=document.getElementById("wfu_messageblock_"+e+"_door"),R=0,U=1,z=2,N=wfu_plugin_decode_string(L.value.replace(/^\s+|\s+$/g,"")),w=0;w<d.general.files_count;w++){for(R=w+a,P=N.replace(/\[file_id\]/g,R),P=P.replace(/\[filenumber_display\]/g,""),P=P.replace(/\[fileheader_color\]/g,d[w].color),P=P.replace(/\[fileheader_bgcolor\]/g,d[w].bgcolor),P=P.replace(/\[fileheader_borcolor\]/g,d[w].borcolor),P=P.replace(/\[fileheader_message\]/g,d[w].header),P=P.replace(/\[filesubheadermessage_display\]/g,'style="display:none;"'),P=P.replace(/\[filesubheader_message\]/g,d[w].message),P=P.replace(/\[filesubheaderadminmessage_display\]/g,'style="display:none;"'),P=P.replace(/\[filesubheader_adminmessage\]/g,d[w].admin_messages),P="<table><tbody>"+P+"</tbody></table>",M.innerHTML=P,U=1,z=2,S=!1,H=document.getElementById("wfu_messageblock_"+e+"_"+R),1==I.files_count?(document.getElementById("wfu_messageblock_"+e+"_filenumber_"+R).style.display="none",document.getElementById("wfu_messageblock_subheader_"+e+"_fileempty_"+R).style.display="none",H.style.display=T?"":G.value,U++,z++):H.style.display=G.value,""!=d[w].message&&(document.getElementById("wfu_messageblock_subheader_"+e+"_message_"+R).style.display="",S=!0),""!=d[w].admin_messages&&(document.getElementById("wfu_messageblock_subheader_"+e+"_adminmessage_"+R).style.display="",S=!0),S||(document.getElementById("wfu_messageblock_arrow_"+e+"_"+R).style.display="none",U++),document.getElementById("wfu_messageblock_header_"+e+"_container_"+R).colSpan=U,document.getElementById("wfu_messageblock_subheader_"+e+"_container_"+R).colSpan=z;R>O&&(A=A.nextSibling,null!=A);)1===A.nodeType&&(O=A.id.substr(A.id.lastIndexOf("_")+1));b.tBodies[0].insertBefore(H,A),A=H.nextSibling,H=document.getElementById("wfu_messageblock_subheader_"+e+"_"+R),b.tBodies[0].insertBefore(H,A),A=H,O=R}T&&(document.getElementById("wfu_messageblock_"+e+"_1").style.display=""),b.style.display="",document.getElementById("wordpress_file_upload_message_"+e).style.display=""}return _&&wfu_Redirect(I.redirect_link),I.last}}function wfu_uploadFailed(e,a){a&&(console.log("failure report following"),console.log(e));var t=e.target,s={target:{responseText:"",shortcode_id:t.shortcode_id}};wfu_uploadComplete.call(t,s)}function wfu_uploadCanceled(){}function wfu_notify_server_upload_ended(e,a,t){var s=wfu_GetHttpRequestObject();if(null!=s){var n=GlobalData.consts.ajax_url;params=new Array(5),params[0]=new Array(2),params[0][0]="action",params[0][1]="wfu_ajax_action",params[1]=new Array(2),params[1][0]="unique_id",params[1][1]=e,params[2]=new Array(2),params[2][0]="params_index",params[2][1]=a,params[3]=new Array(2),params[3][0]="session_token",params[3][1]=t,params[4]=new Array(2),params[4][0]="upload_finished",params[4][1]=1;for(var r="",l=0;l<params.length;l++)r+=(l>0?"&":"")+params[l][0]+"="+encodeURI(params[l][1]);s.open("POST",n,!0),s.setRequestHeader("Content-type","application/x-www-form-urlencoded"),s.onreadystatechange=function(){4==s.readyState&&200==s.status},s.send(r)}}function wfu_Initialize_Params(){var e={};return e.version="full",e.general={},e.general.shortcode_id=0,e.general.unique_id="",e.general.state=0,e.general.files_count=0,e.general.update_wpfilebase="",e.general.redirect_link="",e.general.upload_finish_time=0,e.general.message="",e.general.message_type="",e.general.admin_messages={},e.general.admin_messages.wpfilebase="",e.general.admin_messages.notify="",e.general.admin_messages.redirect="",e.general.admin_messages.other="",e.general.errors={},e.general.errors.wpfilebase="",e.general.errors.notify="",e.general.errors.redirect="",e.general.color="",e.general.bgcolor="",e.general.borcolor="",e.general.notify_only_filename_list="",e.general.notify_target_path_list="",e.general.notify_attachment_list="",e.general.fail_message="",e.general.fail_admin_message="",e}function wfu_redirect_to_classic(e,a,t,s){0!=wfu_filesselected(e)&&wfu_selectsubdir_check(e)&&wfu_check_required_userdata(e)&&wfu_redirect_to_classic_cont(e,a,t,s,[""])}function wfu_redirect_to_classic_cont(e,a,t,s){var n=function(n){if(n.indexOf("wfu_response_success:")>-1){var r=wfu_Initialize_Params();if(r.general.shortcode_id=e,r.general.unique_id="",r.general.files_count=wfu_filesselected(e),wfu_ProcessUploadComplete(e,0,r,"no-ajax","",a,"",["false","","false"]),1==t){var l="";document.getElementById("upfile_"+e).name="uploadedfile_"+e+"_redirected"+l}document.getElementById("adminerrorcodes_"+e).value=s>0?s:"",document.getElementById("upfile_"+e).disabled=!1,document.getElementById("uniqueuploadid_"+e).value=wfu_randomString(20),document.getElementById("uploadform_"+e).submit()}},r="",l=new Date,o=GlobalData.consts.response_url+"?shortcode_id="+e+"&start_time="+l.getTime()+"&session_token="+a+r;wfu_lock_upload(e);var i=wfu_GetHttpRequestObject();if(null==i){var _=document.createElement("iframe");return _?(_.style.display="none",_.src=o,document.body.appendChild(_),void(_.onload=function(){n(_.contentDocument.body.innerHTML)})):void 0}i.open("GET",o,!0),i.onreadystatechange=function(){4==i.readyState&&200==i.status&&n(i.responseText)},i.send(null)}function wfu_filesselected(e){var a=document.getElementById("fileName_"+e),t=wfu_get_filelist(e);return 0==t.length&&a&&(a.value=GlobalData.consts.nofilemessage,a.className="file_input_textbox_nofile"),t.length}function wfu_check_required_userdata(e){for(var a=wfu_get_userdata_count(e),t=!1,s=0;a>s;s++){var n=document.getElementById("hiddeninput_"+e+"_userdata_"+s),r=document.getElementById("userdata_"+e+"_message_"+s),l="file_userdata_message_required";r.className.substr(0,l.length)==l&&""==n.value&&(r.className=l+"_empty",r.value=GlobalData.consts.userdata_empty,t=!0)}return!t}function wfu_HTML5UploadFile(e,a,t){if(!wfu_BrowserCaps.supportsAJAX)return void wfu_redirect_to_classic(e,t,1,1);if(!wfu_BrowserCaps.supportsHTML5)return void wfu_redirect_to_classic(e,t,1,2);a=wfu_plugin_decode_string(a.replace(/^\s+|\s+$/g,""));var s=null;try{s=JSON.parse(a)}catch(n){}if(null==s)return void wfu_redirect_to_classic(e,t,1,3);var r=wfu_GetHttpRequestObject();if(null!=r){var l=wfu_filesselected(e);if(0!=l&&wfu_selectsubdir_check(e)){var o=l;o+=o,wfu_check_required_userdata(e)&&wfu_HTML5UploadFile_cont(e,s,t,[""])}}}function wfu_HTML5UploadFile_cont(e,a,t){function s(_,m,c,f){u=!0;var g=wfu_GetHttpRequestObject(),p=wfu_GetHttpRequestObject();if(null!=g&&null!=p){var y=null,w=null;try{var y=new FormData,w=new FormData}catch(b){}if(null!=y&&null!=w){c||y.append("uploadedfile_"+e+l,m),y.append("uploadedfile_"+e+"_index",_),y.append("uploadedfile_"+e+"_name",wfu_plugin_encode_string(r[_].name)),y.append("uploadedfile_"+e+"_size",r[_].size),y.append("action","wfu_ajax_action"),y.append("uniqueuploadid_"+e,i),y.append("params_index",a.params_index),y.append("subdir_sel_index",n),c?y.append("only_check","1"):y.append("only_check","0"),y.append("session_token",t),y.append("unique_id",o);for(var h=wfu_get_userdata_count(e),v=0;h>v;v++)y.append("hiddeninput_"+e+"_userdata_"+v,document.getElementById("hiddeninput_"+e+"_userdata_"+v).value);var I=GlobalData[e].xhrs.push(g)-1,E=new Date;if(g.xhrid=I,g.shortcode_id=e,g.requesttype="fileupload",g.file_id=_+1,c?(g.size=0,g.totalsize=0,g.loading=!1):(g.size=m.size,g.totalsize=r[_].size,g.loading=!0),g.deltasize=0,g.sizeloaded=0,g.aborted=!1,g.unique_id=o,g.params_index=a.params_index,g.session_token=t,g.debugmode=a.debugmode,g.is_admin=a.is_admin,g.start_time=E.getTime(),g.end_time=g.start_time,g.finish_time=g.start_time+1e3*parseInt(GlobalData.consts.max_time_limit),g.fail_colors=a.fail_colors,g.error_message_header=a.error_header.replace(/%username%/g,"no data"),g.error_message_header=g.error_message_header.replace(/%useremail%/g,"no data"),g.error_message_header=g.error_message_header.replace(/%filename%/g,r[_].name),g.error_message_header=g.error_message_header.replace(/%filepath%/g,r[_].name),g.error_message_failed=GlobalData.consts.message_failed,g.error_message_cancelled=GlobalData.consts.message_cancelled,g.error_adminmessage_unknown=GlobalData.consts.adminmessage_unknown.replace(/%username%/g,"no data"),g.error_adminmessage_unknown=g.error_adminmessage_unknown.replace(/%useremail%/g,"no data"),g.error_adminmessage_unknown=g.error_adminmessage_unknown.replace(/%filename%/g,r[_].name),g.error_adminmessage_unknown=g.error_adminmessage_unknown.replace(/%filepath%/g,r[_].name),f){w.append("action","wfu_ajax_action"),w.append("params_index",a.params_index),w.append("session_token",t),w.append("force_connection_close","1"),p.open("POST",GlobalData.consts.ajax_url,!1);try{p.send(w)}catch(B){}u="success"==p.responseText}if(u)c?(g.addEventListener("load",function(a){a={target:{responseText:a.target.responseText,shortcode_id:e,return_status:!0}};var t=wfu_uploadComplete.call(g,a);u="success"==t||"warning"==t,u&&s(_,m,!1,!1)},!1),g.addEventListener("error",function(){},!1),g.open("POST",GlobalData.consts.ajax_url,!0),g.send(y)):(g.upload.xhr=g,g.upload.dummy=1,g.upload.addEventListener("loadstart",wfu_loadStart,!1),g.upload.addEventListener("progress",new Function("evt","wfu_uploadProgress(evt, "+e+", "+I+", "+a.debugmode+");"),!1),g.addEventListener("load",wfu_uploadComplete,!1),g.addEventListener("error",new Function("evt","wfu_uploadFailed(evt, "+a.debugmode+");"),!1),g.addEventListener("abort",wfu_uploadCanceled,!1),g.open("POST",GlobalData.consts.ajax_url,!0),g.send(y));else{var k={target:{responseText:"",shortcode_id:e}};wfu_uploadComplete.call(g,k)}return d++,u}}}var n=-1;null!=document.getElementById("selectsubdir_"+e)&&(n=document.getElementById("selectsubdir_"+e).selectedIndex);var r=wfu_get_filelist(e),l="",o=wfu_randomString(10),i=o;GlobalData.UploadInProgressString+="["+o+"]",GlobalData[e]={},GlobalData[e].unique_id=o,GlobalData[e].last=!1,GlobalData[e].files_count=1,GlobalData[e].files_processed=0,GlobalData[e].upload_state=0,GlobalData[e].message="",GlobalData[e].update_wpfilebase="",GlobalData[e].redirect_link="",GlobalData[e].notify_only_filename_list="",GlobalData[e].notify_target_path_list="",GlobalData[e].notify_attachment_list="",GlobalData[e].admin_messages={},GlobalData[e].admin_messages.wpfilebase="",GlobalData[e].admin_messages.notify="",GlobalData[e].admin_messages.redirect="",GlobalData[e].admin_messages.debug="",GlobalData[e].admin_messages.other="",GlobalData[e].errors={},GlobalData[e].errors.wpfilebase="",GlobalData[e].errors.notify="",GlobalData[e].errors.redirect="",GlobalData[e].xhrs=Array(),wfu_show_simple_progressbar(a.shortcode_id,"progressive");var _=wfu_Initialize_Params();_.general.shortcode_id=e,_.general.unique_id=o,wfu_ProcessUploadComplete(e,0,_,o,a.params_index,t,"",["false","","false"]);var d=0,u=!0,m=0;s(m,r[m],!0,!1)}function wfu_get_userdata_count(e){for(var a=0;document.getElementById("userdata_"+e+"_"+a);)a++;return a}function wfu_lock_upload(e){var a=document.getElementById("fileName_"+e);a&&(a.disabled=!0),document.getElementById("input_"+e).disabled=!0,document.getElementById("upfile_"+e).disabled=!0;var t=document.getElementById("selectsubdir_"+e);t&&(t.disabled=!0);var s=document.getElementById("upload_"+e);s&&(s.disabled=!0);for(var n=wfu_get_userdata_count(e),r=0;n>r;r++)document.getElementById("userdata_"+e+"_message_"+r).disabled=!0}function wfu_unlock_upload(e){var a=document.getElementById("fileName_"+e);a&&(a.disabled=!1),document.getElementById("input_"+e).disabled=!1,document.getElementById("upfile_"+e).disabled=!1;var t=document.getElementById("selectsubdir_"+e);t&&(t.disabled=!1);var s=document.getElementById("upload_"+e);s&&(s.disabled=!1);for(var n=wfu_get_userdata_count(e),r=0;n>r;r++)document.getElementById("userdata_"+e+"_message_"+r).disabled=!1}function wfu_clear(e){document.getElementById("uploadform_"+e).reset();var a=document.getElementById("fileName_"+e);a&&(a.value="",a.className="file_input_textbox");var t=document.getElementById("selectsubdir_"+e);t&&(t.selectedIndex=parseInt(document.getElementById("selectsubdirdefault_"+e).value));for(var s=wfu_get_userdata_count(e),n=0;s>n;n++)document.getElementById("userdata_"+e+"_message_"+n).value="",document.getElementById("hiddeninput_"+e+"_userdata_"+n).value=""
2
- }function wfu_reset_message(e){var a=document.getElementById("wfu_messageblock_"+e);if(a){document.getElementById("wfu_messageblock_header_"+e).style.display="";var t=document.getElementById("wfu_messageblock_header_"+e+"_container");UploadStates[e]&&(t.innerHTML=UploadStates[e].State0),document.getElementById("wfu_messageblock_header_"+e+"_state").value="none",document.getElementById("wfu_messageblock_arrow_"+e).style.display="none",t.colSpan=3,document.getElementById("wfu_messageblock_subheader_"+e+"_messagelabel").innerHTML="",document.getElementById("wfu_messageblock_subheader_"+e+"_adminmessagelabel").innerHTML="",document.getElementById("wfu_messageblock_subheader_"+e).style.display="none",document.getElementById("wfu_messageblock_subheader_"+e+"_message").style.display="none",document.getElementById("wfu_messageblock_subheader_"+e+"_adminmessage").style.display="none";for(var s=wfu_get_file_ids(e),n=1;n<=s.length;n++)a.tBodies[0].removeChild(document.getElementById("wfu_messageblock_"+e+"_"+n)),a.tBodies[0].removeChild(document.getElementById("wfu_messageblock_subheader_"+e+"_"+n))}}function wfu_show_simple_progressbar(e,a){var t=document.getElementById("progressbar_"+e+"_animation"),s=document.getElementById("progressbar_"+e+"_imagesafe");t&&("progressive"==a?(t.style.width="0%",t.className="file_progress_progressive",s.style.display="none",t.style.display="block"):wfu_BrowserCaps.supportsAnimation?(t.style.width="25%",t.className="file_progress_shuffle",s.style.display="none",t.style.display="block"):(t.style.width="0%",t.className="file_progress_noanimation",t.style.display="none",s.style.display="block"),document.getElementById("wordpress_file_upload_progressbar_"+e).style.display="block")}function wfu_hide_simple_progressbar(e){var a=document.getElementById("progressbar_"+e+"_animation"),t=document.getElementById("progressbar_"+e+"_imagesafe");a&&(document.getElementById("wordpress_file_upload_progressbar_"+e).style.display="none",a.style.width="0%",a.className="file_progress_noanimation",t.style.display="none",a.style.display="block")}function wfu_invoke_shortcode_editor(e,a,t){for(var s=document.getElementsByTagName("BUTTON"),n=0,r=null,l=0;l<s.length;l++)s[l].parentNode&&s[l].parentNode.id=="wordpress_file_upload_editor_"+e&&(r=s[l],n++);if(0!=n){if(n>1)return void alert(GlobalData.consts.same_pluginid);var o=wfu_GetHttpRequestObject();if(null!=o){r.parentNode.style.display="none",document.getElementById("wordpress_file_upload_overlay_"+e).style.display="block";var i=GlobalData.consts.ajax_url;params=new Array(4),params[0]=new Array(2),params[0][0]="action",params[0][1]="wfu_ajax_action_edit_shortcode",params[1]=new Array(2),params[1][0]="upload_id",params[1][1]=e,params[2]=new Array(2),params[2][0]="post_id",params[2][1]=a,params[3]=new Array(2),params[3][0]="post_hash",params[3][1]=t;for(var _="",l=0;l<params.length;l++)_+=(l>0?"&":"")+params[l][0]+"="+encodeURI(params[l][1]);o.open("POST",i,!0),o.setRequestHeader("Content-type","application/x-www-form-urlencoded"),o.onreadystatechange=function(){if(4==o.readyState&&200==o.status){document.getElementById("wordpress_file_upload_overlay_"+e).style.display="none",r.parentNode.removeAttribute("style");var a="wfu_edit_shortcode:",t=o.responseText.indexOf(a);-1==t&&(t=o.responseText.length);var s=(o.responseText.substr(0,t),o.responseText.substr(t+a.length,o.responseText.length-t-a.length));t=s.indexOf(":");var n=s.substr(0,t);if(txt_value=s.substr(t+1,s.length-t-1),"success"==n){var l=window.open(wfu_plugin_decode_string(txt_value),"_blank");l.plugin_window=window}else"check_page_obsolete"==n&&alert(txt_value)}},o.send(_)}}}GlobalData={},UploadStates={},GlobalData.filestatematch={},GlobalData.filestatematch.success=[0,1,2,2],GlobalData.filestatematch.warning=[1,1,2,2],GlobalData.filestatematch.error1=[3,3,2,3],GlobalData.filestatematch.error2=[2,2,2,3],GlobalData.UploadInProgressString="",wfu_Check_Browser_Capabilities();
1
+ function wfu_Initialize_Consts(e){if("undefined"==typeof GlobalData.consts){GlobalData.consts=new Object;for(var a=e.split(";"),t=0;t<a.length;t++)const_txt=a[t].split(":"),GlobalData.consts[wfu_plugin_decode_string(const_txt[0])]=wfu_plugin_decode_string(const_txt[1])}}function wfu_plugin_load_action(e){wfu_install_unload_hook();var a=document.getElementById("selectsubdiredit_"+e);a&&"none"!=a.style.display&&wfu_attach_element_handlers(a,new Function("wfu_selectsubdiredit_change("+e+");"))}function wfu_install_unload_hook(){window.onbeforeunload=wfu_unload_hook}function wfu_unload_hook(){return""!=GlobalData.UploadInProgressString.trim()?GlobalData.consts.wfu_pageexit_prompt:void 0}function wfu_Check_Browser_Capabilities(){if("undefined"==typeof wfu_BrowserCaps){wfu_BrowserCaps=new Object;var e=wfu_GetHttpRequestObject();wfu_BrowserCaps.supportsAJAX=null!=e,wfu_BrowserCaps.supportsUploadProgress=!!(e&&"upload"in e&&"onprogress"in e.upload);var a=null;try{var a=new FormData}catch(t){}wfu_BrowserCaps.supportsHTML5=null!=a;var t=document.createElement("iframe");wfu_BrowserCaps.supportsIFRAME=null!=t,wfu_BrowserCaps.supportsDRAGDROP=window.FileReader?!0:!1,wfu_BrowserCaps.supportsAnimation=wfu_check_animation(),wfu_BrowserCaps.isSafari=Object.prototype.toString.call(window.HTMLElement).indexOf("Constructor")>0}}function wfu_check_animation(){var e=!1,a="animation",t="",s="Webkit Moz O ms Khtml".split(" "),n="",l=document.createElement("DIV");if(l.style.animationName&&(e=!0),e===!1)for(var r=0;r<s.length;r++)if(void 0!==l.style[s[r]+"AnimationName"]){n=s[r],a=n+"Animation",t="-"+n.toLowerCase()+"-",e=!0;break}return e}function wfu_join_strings(e){for(var a=[].slice.call(arguments),t="",s="",n=1;n<a.length;n++)s=""==t||""==a[n]?"":e,t+=s+a[n];return t}function wfu_plugin_decode_string(e){for(var a,t,s=0,n="";s<e.length;)a=parseInt(e.substr(s,2),16),t=128>a?a:224>a?((31&a)<<6)+(63&parseInt(e.substr(s+=2,2),16)):((15&a)<<12)+((63&parseInt(e.substr(s+=2,2),16))<<6)+(63&parseInt(e.substr(s+=2,2),16)),n+=String.fromCharCode(t),s+=2;return n}function wfu_plugin_encode_string(e){var a=0,t="",s="";for(a=0;a<e.length;a++)num=e.charCodeAt(a),num>=2048?num=((16773120&num|917504)<<4)+((4032&num|8192)<<2)+(63&num|128):num>=128&&(num=((65472&num|12288)<<2)+(63&num|128)),s=num.toString(16),(1==s.length||3==s.length||5==s.length)&&(s="0"+s),t+=s;return t}function wfu_randomString(e){for(var a="0123456789ABCDEFGHIJKLMNOPQRSTUVWXTZabcdefghiklmnopqrstuvwxyz",t=e,s="",n=0;t>n;n++){var l=Math.floor(Math.random()*a.length);s+=a.substring(l,l+1)}return s}function wfu_addEventHandler(e,a,t){e.addEventListener?e.addEventListener(a,t,!1):e.attachEvent?e.attachEvent("on"+a,t):e["on"+a]=t}function wfu_attach_element_handlers(e,a){for(var t=["DOMAttrModified","textInput","input","change","keypress","paste","focus","propertychange"],s=0;s<t.length;s++)wfu_addEventHandler(e,t[s],a)}function wfu_GetHttpRequestObject(){var e=null;try{e=new XMLHttpRequest}catch(a){try{e=new ActiveXObject("Msxml2.XMLHTTP")}catch(t){try{e=new ActiveXObject("Microsoft.XMLHTTP")}catch(a){}}}if(null==e&&window.createRequest)try{xmlhttp=window.createRequest()}catch(a){}return e}function wfu_filedetails_showhide(e,a,t){var s=(document.getElementById("wfu_messageblock_arrow_"+e+"_"+a),document.getElementById("wfu_messageblock_arrow_"+e+"_up_"+a)),n=document.getElementById("wfu_messageblock_arrow_"+e+"_down_"+a),l=document.getElementById("wfu_messageblock_subheader_"+e+"_"+a),r=document.getElementById("wfu_messageblock_header_"+e+"_state_"+a);t?(s.style.display="",n.style.display="none",l.style.display="",r.value=""):(s.style.display="none",n.style.display="",l.style.display="none",r.value="none")}function wfu_get_file_ids(e){for(var a=(document.getElementById("wfu_messageblock_"+e),document.getElementById("wfu_messageblock_subheader_"+e).nextSibling),t="wfu_messageblock_"+e+"_",s=[];null!=a;)1===a.nodeType&&a.id.substr(0,t.length)==t&&s.push(a.id.substr(a.id.lastIndexOf("_")+1)),a=a.nextSibling;return s}function wfu_get_filelist(e,a){a="undefined"!=typeof a?a:!0;var t=document.getElementById("upfile_"+e),s=t.files;return s||(s=t.value?[{name:t.value}]:[]),a&&"undefined"!=typeof t.filearray&&(s=t.filearray),s}function wfu_filedetails_toggle(e,a){var t=(document.getElementById("wfu_messageblock_arrow_"+e+"_"+a),document.getElementById("wfu_messageblock_arrow_"+e+"_up_"+a));wfu_filedetails_showhide(e,a,"none"==t.style.display)}function wfu_headerdetails_showhide(e,a){var t=(document.getElementById("wfu_messageblock_arrow_"+e),document.getElementById("wfu_messageblock_arrow_"+e+"_up")),s=document.getElementById("wfu_messageblock_arrow_"+e+"_down"),n=document.getElementById("wfu_messageblock_subheader_"+e),l=document.getElementById("wfu_messageblock_subheader_"+e+"_message"),r=document.getElementById("wfu_messageblock_subheader_"+e+"_adminmessage"),o=document.getElementById("wfu_messageblock_header_"+e+"_state"),i=wfu_get_file_ids(e);if(a){t.style.display="",s.style.display="none",("none"!=l.style.display||"none"!=r.style.display)&&(n.style.display=""),o.value="";for(var _=0;_<i.length;_++)document.getElementById("wfu_messageblock_"+e+"_"+i[_]).style.display="",document.getElementById("wfu_messageblock_subheader_"+e+"_"+i[_]).style.display=document.getElementById("wfu_messageblock_header_"+e+"_state_"+i[_]).value}else{t.style.display="none",s.style.display="",n.style.display="none",o.value="none";for(var _=0;_<i.length;_++)document.getElementById("wfu_messageblock_"+e+"_"+i[_]).style.display="none",document.getElementById("wfu_messageblock_subheader_"+e+"_"+i[_]).style.display="none"}}function wfu_headerdetails_toggle(e){var a=(document.getElementById("wfu_messageblock_arrow_"+e),document.getElementById("wfu_messageblock_arrow_"+e+"_up"));wfu_headerdetails_showhide(e,"none"==a.style.display)}function wfu_selectbutton_changed(e,a){wfu_BrowserCaps.supportsAJAX&&wfu_BrowserCaps.supportsHTML5||(a=0);var t=document.getElementById("upfile_"+e),s=wfu_get_filelist(e,!1);if(1==a){"undefined"==typeof t.filearray&&(t.filearray=Array());for(var n=0;n<s.length;n++)t.filearray.push(s[n])}wfu_update_filename_text(e)}function wfu_selectbutton_clicked(e){var a=document.getElementById("wordpress_file_upload_message_"+e);a&&(a.style.display="none"),wfu_reset_message(e),document.getElementById("upfile_"+e).value="";var t=document.getElementById("fileName_"+e);t&&(t.value="",t.className="file_input_textbox")}function wfu_update_uploadbutton_status(e){var a=document.getElementById("upload_"+e);if(a){var t=wfu_get_filelist(e),s=t.length>0;a.disabled=!s}}function wfu_update_filename_text(e){var a=document.getElementById("fileName_"+e);if(a){for(var t=wfu_get_filelist(e),s="",n=0;n<t.length;n++)""!=s&&(s+=", "),s+=t[n].name.replace(/c:\\fakepath\\/i,"");a.value=s}}function wfu_selectsubdir_check(e){var a=document.getElementById("selectsubdir_"+e);if(!a)return!0;var t=document.getElementById("selectsubdiredit_"+e),s="none"!=t.style.display;return s&&a.selectedIndex>0&&(t.value=a.value.replace(/^\s+/,""),t.className="file_item_clean_match",wfu_selectsubdiredit_change(e)),document.getElementById("hiddeninput_"+e).value=s?t.value:a.selectedIndex,!s&&0==a.selectedIndex||s&&(""==t.value||"file_item_clean_empty"==t.className)?(a.className="file_item_clean_prompt",s&&(t.className="file_item_clean_prompt",t.value=""),!1):(a.className="file_item_clean",s&&"file_item_clean_prompt"==t.className&&(t.className="file_item_clean"),a.options[0].style.display="none",!0)}function wfu_selectsubdiredit_enter(e){var a=document.getElementById("selectsubdir_"+e),t=document.getElementById("selectsubdiredit_"+e);"file_item_clean_empty"==t.className&&(t.value=""),a.className="file_item_clean",t.className="file_item_clean"}function wfu_selectsubdiredit_exit(e){var a=document.getElementById("selectsubdiredit_"+e);""==a.value&&(a.value=GlobalData.consts.wfu_subdir_typedir,a.className="file_item_clean_empty")}function wfu_selectsubdiredit_change(e){var a=document.getElementById("selectsubdir_"+e),t=document.getElementById("selectsubdiredit_"+e);if("none"!=t.style.display){if("file_item_clean_empty"==t.className)return a.selectedIndex=0,void(document.getElementById("hiddeninput_"+e).value="");document.getElementById("hiddeninput_"+e).value=t.value;for(var s,n=!1,l=1;l<a.options.length;l++)s=a.options[l].value.replace(/^\s+/,"").toLowerCase(),a.options[l].style.display=t.value.length>=3?s.substr(0,t.value.length)==t.value.toLowerCase()?"block":"none":"block",a.options[l].value.replace(/^\s+/,"")==t.value&&(a.selectedIndex=l,t.className="file_item_clean_match",n=!0);n||(a.selectedIndex=0,t.className="file_item_clean")}}function wfu_selectsubdir_disable_onoff(e,a){var t=document.getElementById("selectsubdir_"+e);if(!t)return!0;var s=document.getElementById("selectsubdiredit_"+e),n="none"!=s.style.display;t.disabled=a,n&&(s.disabled=a)}function wfu_Redirect(e){window.location=e}function wfu_loadStart(){}function wfu_uploadProgress(e,a,t,s){s&&"undefined"==typeof this.xhr&&(console.log("total="+e.total+", loaded="+e.loaded),console.log(e));var n=GlobalData[a].xhrs[t],l=0,r=0,o=document.getElementById("progressbar_"+a+"_animation");if(e.lengthComputable){if(n.sizeloaded=e.loaded,n.size<e.total&&e.total>0){r=e.total-n.size,n.deltasize+=r,n.size+=r;for(var i=0;i<GlobalData[a].xhrs.length;i++)GlobalData[a].xhrs[i].file_id==n.file_id&&(GlobalData[a].xhrs[i].totalsize+=r)}if(o){for(var _=0,d=0,u=[],i=0;i<GlobalData[a].xhrs.length;i++)u[GlobalData[a].xhrs[i].file_id]=0;for(var i=0;i<GlobalData[a].xhrs.length;i++)u[GlobalData[a].xhrs[i].file_id]=Math.max(GlobalData[a].xhrs[i].totalsize,u[GlobalData[a].xhrs[i].file_id]);for(var i=0;i<u.length;i++)"undefined"!=typeof u[i]&&(_+=u[i]);for(var i=0;i<GlobalData[a].xhrs.length;i++)d+=GlobalData[a].xhrs[i].sizeloaded;l=Math.round(100*d/_),o.style.width=l.toString()+"%"}}else o&&(o.style.width="0%")}function wfu_notify_WPFilebase(e,a){var t=wfu_GetHttpRequestObject();if(null==t){var s=document.createElement("iframe");return s.style.display="none",s.src=GlobalData.consts.ajax_url+"?action=wfu_ajax_action_notify_wpfilebase&params_index="+e+"&session_token="+a,void document.body.appendChild(s)}var n=GlobalData.consts.ajax_url;params=new Array(3),params[0]=new Array(2),params[0][0]="action",params[0][1]="wfu_ajax_action_notify_wpfilebase",params[1]=new Array(2),params[1][0]="params_index",params[1][1]=e,params[2]=new Array(2),params[2][0]="session_token",params[2][1]=a;for(var l="",s=0;s<params.length;s++)l+=(s>0?"&":"")+params[s][0]+"="+encodeURI(params[s][1]);t.open("POST",n,!0),t.setRequestHeader("Content-type","application/x-www-form-urlencoded"),t.onreadystatechange=function(){},t.send(l)}function wfu_send_email_notification(e,a,t,s,n,l,r,o,i){var _=wfu_GetHttpRequestObject();if(null!=_){var d=GlobalData.consts.ajax_url,u=wfu_get_userdata_count(e);params=new Array(7+u),params[0]=new Array(2),params[0][0]="action",params[0][1]="wfu_ajax_action_send_email_notification",params[1]=new Array(2),params[1][0]="params_index",params[1][1]=t,params[2]=new Array(2),params[2][0]="session_token",params[2][1]=s,params[3]=new Array(2),params[3][0]="only_filename_list",params[3][1]=n,params[4]=new Array(2),params[4][0]="target_path_list",params[4][1]=l,params[5]=new Array(2),params[5][0]="attachment_list",params[5][1]=r,params[6]=new Array(2),params[6][0]="unique_id",params[6][1]=a;for(var m=0;u>m;m++)params[7+m]=new Array(2),params[7+m][0]="userdata_"+m,params[7+m][1]=wfu_plugin_encode_string(document.getElementById("hiddeninput_"+e+"_userdata_"+m).value);for(var c="",m=0;m<params.length;m++)c+=(m>0?"&":"")+params[m][0]+"="+encodeURI(params[m][1]);var f=new Date;_.xhrid=-1,_.shortcode_id=e,_.requesttype="email",_.file_id=0,_.loading=!1,_.aborted=!1,_.unique_id=a,_.debugmode=o,_.is_admin=i,_.params_index=t,_.session_token=s,_.start_time=f.getTime(),_.end_time=_.start_time,_.finish_time=_.start_time+1e3*parseInt(GlobalData.consts.max_time_limit),_.fail_colors=GlobalData.consts.fail_colors,_.error_message_header="",_.error_message_failed=GlobalData.consts.message_failed,_.error_message_cancelled=GlobalData.consts.message_cancelled,_.error_adminmessage_unknown="",_.open("POST",d,!0),_.setRequestHeader("Content-type","application/x-www-form-urlencoded"),_.addEventListener("load",wfu_uploadComplete,!1),_.addEventListener("error",wfu_uploadFailed,!1),_.addEventListener("abort",wfu_uploadCanceled,!1),_.send(c)}}function wfu_format_debug_data(e,a){return output='<label class="file_messageblock_subheader_debugmessage_label">',output+="Debug Data"+a,output+="</label>",output+='<div class="file_messageblock_subheader_debugmessage_container">',output+=e,output+="</div>"}function wfu_uploadComplete(e){var a=new Date,t=this.shortcode_id,s=(this.file_id,!1),n="",l="",r="unknown",o="",i="wfu_fileupload_success:";this.loading=!1,this.end_time=a.getTime();var _=e.target.responseText,d=_,u="error";if(-1!=_&&_.indexOf("force_errorabort_code")>-1&&(u="errorabort",_=_.replace("force_errorabort_code","")),-1!=_){var m=_.indexOf(i);if(m>-1&&("true"==this.debugmode&&(o=_.substr(0,m)),d=_.substr(m+i.length),m=d.indexOf(":"),l=d.substr(0,m),n=d.substr(m+1)),""!=o){var c="";"fileupload"==this.requesttype?c=" - File: "+this.file_id:"email"==this.requesttype&&(c=" - Email Notification"),o=wfu_format_debug_data(o,c)}if(""!=l){var f=l.split(";");if(1==parseInt(f[2])){var g=f[3].split(",");r=wfu_plugin_decode_string(g[0])}}}if(""==n||""==l){var p=this.fail_colors.split(","),y=wfu_Initialize_Params();y.general.shortcode_id=t,y.general.unique_id=this.unique_id,y.general.state=7,y.general.files_count="fileupload"==this.requesttype?1:0,y.general.upload_finish_time=this.finish_time,y.general.fail_message=GlobalData.consts.message_unknown,y.general.fail_admin_message=wfu_join_strings("<br />",this.error_adminmessage_unknown,this.requesttype+":"+d),y.general.files_count>0?(y[0]={},y[0].color=p[0],y[0].bgcolor=p[1],y[0].borcolor=p[2],y[0].message_type=u,r=u,y[0].header=this.error_message_header,y[0].message=GlobalData.consts.message_timelimit,y[0].admin_messages="true"==this.is_admin?GlobalData.consts.message_admin_timelimit:""):y.general.admin_messages.other="true"==this.is_admin?GlobalData.consts.message_admin_timelimit:"",y.general.upload_finish_time>0&&a.getTime()<y.general.upload_finish_time&&(y.general.files_count>0?(y[0].message=y.general.fail_message,y[0].admin_messages="true"==this.is_admin?y.general.fail_admin_message:""):y.general.admin_messages.other="true"==this.is_admin?y.general.fail_admin_message:"")}return s=""==n||""==l?wfu_ProcessUploadComplete(t,this.file_id,y,this.unique_id,this.params_index,this.session_token,"",[this.debugmode,o,this.is_admin],this.requesttype):wfu_ProcessUploadComplete(t,this.file_id,n,this.unique_id,this.params_index,this.session_token,l,[this.debugmode,o,this.is_admin],this.requesttype),s&&(wfu_unlock_upload(e.target.shortcode_id),wfu_hide_simple_progressbar(t),wfu_clear(e.target.shortcode_id)),e.target.return_status?r:void 0}function wfu_ProcessUploadComplete(e,a,t,s,n,l,r,o,i){if(e&&!(0>e)&&null!=t&&""!=t&&""!=s&&("no-ajax"==s||GlobalData[e])){var _=!1;if("string"==typeof t){t=wfu_plugin_decode_string(t.replace(/^\s+|\s+$/g,""));var d=null;try{d=JSON.parse(t)}catch(u){}if(null==d){var m=r.split(";");d=wfu_Initialize_Params(),d.general.shortcode_id=e,d.general.unique_id=s,d.general.state=m[0],4==d.general.state&&d.general.state++;var c=m[1].split(","),f="",g=GlobalData.consts.jsonparse_filemessage,p=GlobalData.consts.jsonparse_message,y=GlobalData.consts.jsonparse_adminmessage;d.general.files_count=parseInt(m[2]);for(var w=0;w<d.general.files_count;w++)d[w]={},d[w].color=c[0],d[w].bgcolor=c[1],d[w].borcolor=c[2],f=m[w+3].split(","),d[w].message_type=wfu_plugin_decode_string(f[0]),d[w].header=wfu_plugin_decode_string(f[1]),"success"==d[w].message_type&&(d[w].header+=g,d[w].message_type="warning"),d[w].message=wfu_join_strings("<br />",p,wfu_plugin_decode_string(f[2])),d[w].admin_messages=wfu_join_strings("<br />",y,wfu_plugin_decode_string(f[3]))}}else{if("object"!=typeof t)return;var d=t}for(w=0;d[w];)d[w].message_type&&"error"==d[w].message_type.substr(0,5)&&(d[w].message_type=d[w].message_type.substr(0,5)),w++;var b=document.getElementById("wfu_messageblock_"+e),h=!0;if(!UploadStates[e]&&b){var v=document.getElementById("wfu_messageblock_header_"+e+"_states").value;v=wfu_plugin_decode_string(v.replace(/^\s+|\s+$/g,"")),UploadStates[e]=null;try{UploadStates[e]=JSON.parse(v)}catch(u){}null==UploadStates[e]&&(h=!1)}GlobalData[e]||(GlobalData[e]=Object());var I=GlobalData[e];if("no-ajax"==s)I.last=!1,I.unique_id="",I.files_count=d.general.files_count,0==d.general.state&&(d.general.files_count=0),I.files_processed=d.general.files_count,I.upload_state=h?d.general.state:10,I.message=d.general.message,I.update_wpfilebase=d.general.update_wpfilebase,I.redirect_link=d.general.redirect_link,I.notify_only_filename_list="",I.notify_target_path_list="",I.notify_attachment_list="",I.admin_messages={},I.admin_messages.wpfilebase=d.general.admin_messages.wpfilebase,I.admin_messages.notify=d.general.admin_messages.notify,I.admin_messages.redirect=d.general.admin_messages.redirect,I.admin_messages.debug=o[1],I.admin_messages.other=d.general.admin_messages.other,I.errors={},I.errors.wpfilebase=d.general.errors.wpfilebase,I.errors.notify=d.general.errors.notify,I.errors.redirect=d.general.errors.redirect,I.current_size=0,I.total_size=0;else{if(""==I.unique_id||I.unique_id!=s||I.unique_id!=d.general.unique_id)return;if(I.last)return;0==d.general.files_count&&d[0]&&"error"==d[0].message_type&&(d.general.files_count=1);for(var E="",w=0;w<d.general.files_count;w++)E="error"==d[w].message_type&&0==I.files_processed?"error1":"error"==d[w].message_type&&I.files_processed>0?"error2":d[w].message_type,I.upload_state=GlobalData.filestatematch[E][I.upload_state];h||(I.upload_state=10),I.files_processed+=d.general.files_count,I.message=wfu_join_strings("<br />",I.message,d.general.message),""==I.update_wpfilebase&&(I.update_wpfilebase=d.general.update_wpfilebase),(!i||i&&"email"!=i)&&(I.redirect_link=d.general.redirect_link),I.notify_only_filename_list=wfu_join_strings(", ",I.notify_only_filename_list,d.general.notify_only_filename_list),I.notify_target_path_list=wfu_join_strings(", ",I.notify_target_path_list,d.general.notify_target_path_list),I.notify_attachment_list=wfu_join_strings(",",I.notify_attachment_list,d.general.notify_attachment_list),I.admin_messages.debug=wfu_join_strings("<br />",I.admin_messages.debug,o[1]),I.admin_messages.other=wfu_join_strings("<br />",I.admin_messages.other,d.general.admin_messages.other),""==I.admin_messages.wpfilebase&&(I.admin_messages.wpfilebase=d.general.admin_messages.wpfilebase),""==I.admin_messages.notify&&(I.admin_messages.notify=d.general.admin_messages.notify),""==I.admin_messages.redirect&&(I.admin_messages.redirect=d.general.admin_messages.redirect),""==I.errors.wpfilebase&&(I.errors.wpfilebase=d.general.errors.wpfilebase),""==I.errors.notify&&(I.errors.notify=d.general.errors.notify),""==I.errors.redirect&&(I.errors.redirect=d.general.errors.redirect)}I.files_processed==I.files_count&&(I.last=!0,""!=I.update_wpfilebase&&(I.admin_messages.wpfilebase="",wfu_notify_WPFilebase(n,l)),""!=I.notify_only_filename_list&&(I.admin_messages.notify="",wfu_send_email_notification(e,s,n,l,I.notify_only_filename_list,I.notify_target_path_list,I.notify_attachment_list,o[0],o[2]),I.last=!1,I.notify_only_filename_list=""),I.last&&(wfu_notify_server_upload_ended(s,n,l),GlobalData.UploadInProgressString=GlobalData.UploadInProgressString.replace(new RegExp("\\["+s+"\\]","g"),"")),""!=I.errors.redirect&&(I.redirect_link=""),""!=I.redirect_link&&I.last&&""==GlobalData.UploadInProgressString.trim()&&(I.upload_state=11,_=!0));var B=I.message,k=wfu_join_strings("<br />",I.admin_messages.other,I.admin_messages.wpfilebase,I.admin_messages.notify,I.admin_messages.redirect,I.admin_messages.debug);if(!h){var x=GlobalData.consts.jsonparse_headermessage,D=GlobalData.consts.jsonparse_headeradminmessage;B=wfu_join_strings("<br />",x,B),k=wfu_join_strings("<br />",D,k)}if(I.last){0==I.files_count?I.upload_state=8:I.upload_state<4&&(I.upload_state+=4);{""!=I.admin_messages.wpfilebase||""!=I.admin_messages.notify||""!=I.admin_messages.redirect||""!=I.admin_messages.other}4==I.upload_state&&""!=k?I.upload_state++:5==I.upload_state&&""==!k&&""==B&&I.upload_state--}if(b){var G=document.getElementById("wfu_messageblock_header_"+e+"_state"),T=1==I.files_count&&""==B&&""==k&&I.last&&!_;if(T)document.getElementById("wfu_messageblock_header_"+e).style.display="none";else{document.getElementById("wfu_messageblock_header_"+e).style.display="";var j=document.getElementById("wfu_messageblock_header_"+e+"_container");if(h){var q="";1!=I.files_count||5!=I.upload_state&&7!=I.upload_state||(q="_singlefile"),j.innerHTML=UploadStates[e]["State"+I.upload_state+q]}else{j.innerHTML="";var C=document.getElementById("wfu_messageblock_header_"+e+"_safecontainer");j.innerHTML=C.innerHTML.replace(/_safe/g,"")}var S=!1;""!=B?(document.getElementById("wfu_messageblock_subheader_"+e+"_message").style.display="",document.getElementById("wfu_messageblock_subheader_"+e+"_messagelabel").innerHTML=B,S=!0):document.getElementById("wfu_messageblock_subheader_"+e+"_message").style.display="none",""!=k?(document.getElementById("wfu_messageblock_subheader_"+e+"_adminmessage").style.display="",document.getElementById("wfu_messageblock_subheader_"+e+"_adminmessagelabel").innerHTML=k,S=!0):document.getElementById("wfu_messageblock_subheader_"+e+"_adminmessage").style.display="none",document.getElementById("wfu_messageblock_subheader_"+e).style.display=S?G.value:"none",S||I.files_processed>0?(j.colSpan=2,document.getElementById("wfu_messageblock_arrow_"+e).style.display=""):(document.getElementById("wfu_messageblock_arrow_"+e).style.display="none",j.colSpan=3)}for(var A=document.getElementById("wfu_messageblock_subheader_"+e),N=0,O=null,H=document.getElementById("wfu_messageblock_"+e+"_filetemplate"),L="",M=document.getElementById("wfu_messageblock_"+e+"_door"),P=0,R=1,U=2,z=wfu_plugin_decode_string(H.value.replace(/^\s+|\s+$/g,"")),w=0;w<d.general.files_count;w++){for(P=w+a,L=z.replace(/\[file_id\]/g,P),L=L.replace(/\[filenumber_display\]/g,""),L=L.replace(/\[fileheader_color\]/g,d[w].color),L=L.replace(/\[fileheader_bgcolor\]/g,d[w].bgcolor),L=L.replace(/\[fileheader_borcolor\]/g,d[w].borcolor),L=L.replace(/\[fileheader_message\]/g,d[w].header),L=L.replace(/\[filesubheadermessage_display\]/g,'style="display:none;"'),L=L.replace(/\[filesubheader_message\]/g,d[w].message),L=L.replace(/\[filesubheaderadminmessage_display\]/g,'style="display:none;"'),L=L.replace(/\[filesubheader_adminmessage\]/g,d[w].admin_messages),L="<table><tbody>"+L+"</tbody></table>",M.innerHTML=L,R=1,U=2,S=!1,O=document.getElementById("wfu_messageblock_"+e+"_"+P),1==I.files_count?(document.getElementById("wfu_messageblock_"+e+"_filenumber_"+P).style.display="none",document.getElementById("wfu_messageblock_subheader_"+e+"_fileempty_"+P).style.display="none",O.style.display=T?"":G.value,R++,U++):O.style.display=G.value,""!=d[w].message&&(document.getElementById("wfu_messageblock_subheader_"+e+"_message_"+P).style.display="",S=!0),""!=d[w].admin_messages&&(document.getElementById("wfu_messageblock_subheader_"+e+"_adminmessage_"+P).style.display="",S=!0),S||(document.getElementById("wfu_messageblock_arrow_"+e+"_"+P).style.display="none",R++),document.getElementById("wfu_messageblock_header_"+e+"_container_"+P).colSpan=R,document.getElementById("wfu_messageblock_subheader_"+e+"_container_"+P).colSpan=U;P>N&&(A=A.nextSibling,null!=A);)1===A.nodeType&&(N=A.id.substr(A.id.lastIndexOf("_")+1));b.tBodies[0].insertBefore(O,A),A=O.nextSibling,O=document.getElementById("wfu_messageblock_subheader_"+e+"_"+P),b.tBodies[0].insertBefore(O,A),A=O,N=P}T&&(document.getElementById("wfu_messageblock_"+e+"_1").style.display=""),b.style.display="",document.getElementById("wordpress_file_upload_message_"+e).style.display=""}return _&&wfu_Redirect(I.redirect_link),I.last}}function wfu_uploadFailed(e,a){a&&(console.log("failure report following"),console.log(e));var t=e.target,s={target:{responseText:"",shortcode_id:t.shortcode_id}};wfu_uploadComplete.call(t,s)}function wfu_uploadCanceled(){}function wfu_notify_server_upload_ended(e,a,t){var s=wfu_GetHttpRequestObject();if(null!=s){var n=GlobalData.consts.ajax_url;params=new Array(5),params[0]=new Array(2),params[0][0]="action",params[0][1]="wfu_ajax_action",params[1]=new Array(2),params[1][0]="unique_id",params[1][1]=e,params[2]=new Array(2),params[2][0]="params_index",params[2][1]=a,params[3]=new Array(2),params[3][0]="session_token",params[3][1]=t,params[4]=new Array(2),params[4][0]="upload_finished",params[4][1]=1;for(var l="",r=0;r<params.length;r++)l+=(r>0?"&":"")+params[r][0]+"="+encodeURI(params[r][1]);s.open("POST",n,!0),s.setRequestHeader("Content-type","application/x-www-form-urlencoded"),s.onreadystatechange=function(){4==s.readyState&&200==s.status},s.send(l)}}function wfu_Initialize_Params(){var e={};return e.version="full",e.general={},e.general.shortcode_id=0,e.general.unique_id="",e.general.state=0,e.general.files_count=0,e.general.update_wpfilebase="",e.general.redirect_link="",e.general.upload_finish_time=0,e.general.message="",e.general.message_type="",e.general.admin_messages={},e.general.admin_messages.wpfilebase="",e.general.admin_messages.notify="",e.general.admin_messages.redirect="",e.general.admin_messages.other="",e.general.errors={},e.general.errors.wpfilebase="",e.general.errors.notify="",e.general.errors.redirect="",e.general.color="",e.general.bgcolor="",e.general.borcolor="",e.general.notify_only_filename_list="",e.general.notify_target_path_list="",e.general.notify_attachment_list="",e.general.fail_message="",e.general.fail_admin_message="",e}function wfu_redirect_to_classic(e,a,t,s){0!=wfu_filesselected(e)&&wfu_selectsubdir_check(e)&&wfu_check_required_userdata(e)&&wfu_redirect_to_classic_cont(e,a,t,s,[""])}function wfu_redirect_to_classic_cont(e,a,t,s){var n=function(n){if(n.indexOf("wfu_response_success:")>-1){var l=wfu_Initialize_Params();if(l.general.shortcode_id=e,l.general.unique_id="",l.general.files_count=wfu_filesselected(e),wfu_ProcessUploadComplete(e,0,l,"no-ajax","",a,"",["false","","false"]),1==t){var r="";document.getElementById("upfile_"+e).name="uploadedfile_"+e+"_redirected"+r}document.getElementById("adminerrorcodes_"+e).value=s>0?s:"",document.getElementById("upfile_"+e).disabled=!1,document.getElementById("uniqueuploadid_"+e).value=wfu_randomString(20),document.getElementById("uploadform_"+e).submit()}},l="",r=new Date,o=GlobalData.consts.response_url+"?shortcode_id="+e+"&start_time="+r.getTime()+"&session_token="+a+l;wfu_lock_upload(e);var i=wfu_GetHttpRequestObject();if(null==i){var _=document.createElement("iframe");return _?(_.style.display="none",_.src=o,document.body.appendChild(_),void(_.onload=function(){n(_.contentDocument.body.innerHTML)})):void 0}i.open("GET",o,!0),i.onreadystatechange=function(){4==i.readyState&&200==i.status&&n(i.responseText)},i.send(null)}function wfu_filesselected(e){var a=document.getElementById("fileName_"+e),t=wfu_get_filelist(e);return 0==t.length&&a&&(a.value=GlobalData.consts.nofilemessage,a.className="file_input_textbox_nofile"),t.length}function wfu_check_required_userdata(e){for(var a=wfu_get_userdata_count(e),t=!1,s=0;a>s;s++){var n=document.getElementById("hiddeninput_"+e+"_userdata_"+s),l=document.getElementById("userdata_"+e+"_message_"+s),r="file_userdata_message_required";l.className.substr(0,r.length)==r&&""==n.value&&(l.className=r+"_empty",l.value=GlobalData.consts.userdata_empty,t=!0)}return!t}function wfu_HTML5UploadFile(e,a,t){if(!wfu_BrowserCaps.supportsAJAX)return void wfu_redirect_to_classic(e,t,1,1);if(!wfu_BrowserCaps.supportsHTML5)return void wfu_redirect_to_classic(e,t,1,2);a=wfu_plugin_decode_string(a.replace(/^\s+|\s+$/g,""));var s=null;try{s=JSON.parse(a)}catch(n){}if(null==s)return void wfu_redirect_to_classic(e,t,1,3);var l=wfu_GetHttpRequestObject();if(null!=l){var r=wfu_filesselected(e);if(0!=r&&wfu_selectsubdir_check(e)){var o=r;o+=o,wfu_check_required_userdata(e)&&wfu_HTML5UploadFile_cont(e,s,t,[""])}}}function wfu_HTML5UploadFile_cont(e,a,t){function s(l,r,o,m){f=!0;var g=wfu_GetHttpRequestObject(),p=wfu_GetHttpRequestObject();if(null!=g&&null!=p){var y=null,w=null;try{var y=new FormData,w=new FormData}catch(b){}if(null!=y&&null!=w){o||y.append("uploadedfile_"+e+_,r),y.append("uploadedfile_"+e+"_index",l),y.append("uploadedfile_"+e+"_name",wfu_plugin_encode_string(i[l].name)),y.append("uploadedfile_"+e+"_size",i[l].size),y.append("action","wfu_ajax_action"),y.append("uniqueuploadid_"+e,u),y.append("params_index",a.params_index),y.append("subdir_sel_index",n),o?y.append("only_check","1"):y.append("only_check","0"),y.append("session_token",t),y.append("unique_id",d);for(var h=wfu_get_userdata_count(e),v=0;h>v;v++)y.append("hiddeninput_"+e+"_userdata_"+v,document.getElementById("hiddeninput_"+e+"_userdata_"+v).value);var I=GlobalData[e].xhrs.push(g)-1,E=new Date;if(g.xhrid=I,g.shortcode_id=e,g.requesttype="fileupload",g.file_id=l+1,o?(g.size=0,g.totalsize=0,g.loading=!1):(g.size=r.size,g.totalsize=i[l].size,g.loading=!0),g.deltasize=0,g.sizeloaded=0,g.aborted=!1,g.unique_id=d,g.params_index=a.params_index,g.session_token=t,g.debugmode=a.debugmode,g.is_admin=a.is_admin,g.start_time=E.getTime(),g.end_time=g.start_time,g.finish_time=g.start_time+1e3*parseInt(GlobalData.consts.max_time_limit),g.fail_colors=a.fail_colors,g.error_message_header=a.error_header.replace(/%username%/g,"no data"),g.error_message_header=g.error_message_header.replace(/%useremail%/g,"no data"),g.error_message_header=g.error_message_header.replace(/%filename%/g,i[l].name),g.error_message_header=g.error_message_header.replace(/%filepath%/g,i[l].name),g.error_message_failed=GlobalData.consts.message_failed,g.error_message_cancelled=GlobalData.consts.message_cancelled,g.error_adminmessage_unknown=GlobalData.consts.adminmessage_unknown.replace(/%username%/g,"no data"),g.error_adminmessage_unknown=g.error_adminmessage_unknown.replace(/%useremail%/g,"no data"),g.error_adminmessage_unknown=g.error_adminmessage_unknown.replace(/%filename%/g,i[l].name),g.error_adminmessage_unknown=g.error_adminmessage_unknown.replace(/%filepath%/g,i[l].name),m){w.append("action","wfu_ajax_action"),w.append("params_index",a.params_index),w.append("session_token",t),w.append("force_connection_close","1"),p.open("POST",GlobalData.consts.ajax_url,!1);try{p.send(w)}catch(B){}f="success"==p.responseText}if(f)o?(g.addEventListener("load",function(a){a={target:{responseText:a.target.responseText,shortcode_id:e,return_status:!0}};var t=wfu_uploadComplete.call(g,a);f="success"==t||"warning"==t,f&&s(l,r,!1,!1)},!1),g.addEventListener("error",function(){},!1),g.open("POST",GlobalData.consts.ajax_url,!0),g.send(y)):(g.upload.xhr=g,g.upload.dummy=1,g.upload.addEventListener("loadstart",wfu_loadStart,!1),g.upload.addEventListener("progress",new Function("evt","wfu_uploadProgress(evt, "+e+", "+I+", "+a.debugmode+");"),!1),g.addEventListener("load",wfu_uploadComplete,!1),g.addEventListener("error",new Function("evt","wfu_uploadFailed(evt, "+a.debugmode+");"),!1),g.addEventListener("abort",wfu_uploadCanceled,!1),g.open("POST",GlobalData.consts.ajax_url,!0),g.send(y));else{var k={target:{responseText:"",shortcode_id:e}};wfu_uploadComplete.call(g,k)}return c++,f}}}var n=-1,l=document.getElementById("selectsubdir_"+e);if(l){var r=document.getElementById("selectsubdiredit_"+e),o="none"!=r.style.display;n=o?r.value:l.selectedIndex}var i=wfu_get_filelist(e),_="",d=wfu_randomString(10),u=d;GlobalData.UploadInProgressString+="["+d+"]",GlobalData[e]={},GlobalData[e].unique_id=d,GlobalData[e].last=!1,GlobalData[e].files_count=1,GlobalData[e].files_processed=0,GlobalData[e].upload_state=0,GlobalData[e].message="",GlobalData[e].update_wpfilebase="",GlobalData[e].redirect_link="",GlobalData[e].notify_only_filename_list="",GlobalData[e].notify_target_path_list="",GlobalData[e].notify_attachment_list="",GlobalData[e].admin_messages={},GlobalData[e].admin_messages.wpfilebase="",GlobalData[e].admin_messages.notify="",GlobalData[e].admin_messages.redirect="",GlobalData[e].admin_messages.debug="",GlobalData[e].admin_messages.other="",GlobalData[e].errors={},GlobalData[e].errors.wpfilebase="",GlobalData[e].errors.notify="",GlobalData[e].errors.redirect="",GlobalData[e].xhrs=Array(),wfu_show_simple_progressbar(a.shortcode_id,"progressive");
2
+ var m=wfu_Initialize_Params();m.general.shortcode_id=e,m.general.unique_id=d,wfu_ProcessUploadComplete(e,0,m,d,a.params_index,t,"",["false","","false"]);var c=0,f=!0,g=0;s(g,i[g],!0,!1)}function wfu_get_userdata_count(e){for(var a=0;document.getElementById("userdata_"+e+"_"+a);)a++;return a}function wfu_lock_upload(e){var a=document.getElementById("fileName_"+e);a&&(a.disabled=!0),document.getElementById("input_"+e).disabled=!0,document.getElementById("upfile_"+e).disabled=!0,wfu_selectsubdir_disable_onoff(e,!0);var t=document.getElementById("upload_"+e);t&&(t.disabled=!0);for(var s=wfu_get_userdata_count(e),n=0;s>n;n++)document.getElementById("userdata_"+e+"_message_"+n).disabled=!0}function wfu_unlock_upload(e){var a=document.getElementById("fileName_"+e);a&&(a.disabled=!1),document.getElementById("input_"+e).disabled=!1,document.getElementById("upfile_"+e).disabled=!1,wfu_selectsubdir_disable_onoff(e,!1);var t=document.getElementById("upload_"+e);t&&(t.disabled=!1);for(var s=wfu_get_userdata_count(e),n=0;s>n;n++)document.getElementById("userdata_"+e+"_message_"+n).disabled=!1}function wfu_clear(e){document.getElementById("uploadform_"+e).reset();var a=document.getElementById("fileName_"+e);a&&(a.value="",a.className="file_input_textbox");var t=document.getElementById("selectsubdir_"+e);if(t){var s=document.getElementById("selectsubdiredit_"+e),n="none"!=s.style.display;n?(t.selectedIndex=-1,s.value=""):t.selectedIndex=parseInt(document.getElementById("selectsubdirdefault_"+e).value)}for(var l=wfu_get_userdata_count(e),r=0;l>r;r++)document.getElementById("userdata_"+e+"_message_"+r).value="",document.getElementById("hiddeninput_"+e+"_userdata_"+r).value=""}function wfu_reset_message(e){var a=document.getElementById("wfu_messageblock_"+e);if(a){document.getElementById("wfu_messageblock_header_"+e).style.display="";var t=document.getElementById("wfu_messageblock_header_"+e+"_container");UploadStates[e]&&(t.innerHTML=UploadStates[e].State0),document.getElementById("wfu_messageblock_header_"+e+"_state").value="none",document.getElementById("wfu_messageblock_arrow_"+e).style.display="none",t.colSpan=3,document.getElementById("wfu_messageblock_subheader_"+e+"_messagelabel").innerHTML="",document.getElementById("wfu_messageblock_subheader_"+e+"_adminmessagelabel").innerHTML="",document.getElementById("wfu_messageblock_subheader_"+e).style.display="none",document.getElementById("wfu_messageblock_subheader_"+e+"_message").style.display="none",document.getElementById("wfu_messageblock_subheader_"+e+"_adminmessage").style.display="none";for(var s=wfu_get_file_ids(e),n=1;n<=s.length;n++)a.tBodies[0].removeChild(document.getElementById("wfu_messageblock_"+e+"_"+n)),a.tBodies[0].removeChild(document.getElementById("wfu_messageblock_subheader_"+e+"_"+n))}}function wfu_show_simple_progressbar(e,a){var t=document.getElementById("progressbar_"+e+"_animation"),s=document.getElementById("progressbar_"+e+"_imagesafe");t&&("progressive"==a?(t.style.width="0%",t.className="file_progress_progressive",s.style.display="none",t.style.display="block"):wfu_BrowserCaps.supportsAnimation?(t.style.width="25%",t.className="file_progress_shuffle",s.style.display="none",t.style.display="block"):(t.style.width="0%",t.className="file_progress_noanimation",t.style.display="none",s.style.display="block"),document.getElementById("wordpress_file_upload_progressbar_"+e).style.display="block")}function wfu_hide_simple_progressbar(e){var a=document.getElementById("progressbar_"+e+"_animation"),t=document.getElementById("progressbar_"+e+"_imagesafe");a&&(document.getElementById("wordpress_file_upload_progressbar_"+e).style.display="none",a.style.width="0%",a.className="file_progress_noanimation",t.style.display="none",a.style.display="block")}function wfu_invoke_shortcode_editor(e,a,t){for(var s=document.getElementsByTagName("BUTTON"),n=0,l=null,r=0;r<s.length;r++)s[r].parentNode&&s[r].parentNode.id=="wordpress_file_upload_editor_"+e&&(l=s[r],n++);if(0!=n){if(n>1)return void alert(GlobalData.consts.same_pluginid);var o=wfu_GetHttpRequestObject();if(null!=o){l.parentNode.style.display="none",document.getElementById("wordpress_file_upload_overlay_"+e).style.display="block";var i=GlobalData.consts.ajax_url;params=new Array(4),params[0]=new Array(2),params[0][0]="action",params[0][1]="wfu_ajax_action_edit_shortcode",params[1]=new Array(2),params[1][0]="upload_id",params[1][1]=e,params[2]=new Array(2),params[2][0]="post_id",params[2][1]=a,params[3]=new Array(2),params[3][0]="post_hash",params[3][1]=t;for(var _="",r=0;r<params.length;r++)_+=(r>0?"&":"")+params[r][0]+"="+encodeURI(params[r][1]);o.open("POST",i,!0),o.setRequestHeader("Content-type","application/x-www-form-urlencoded"),o.onreadystatechange=function(){if(4==o.readyState&&200==o.status){document.getElementById("wordpress_file_upload_overlay_"+e).style.display="none",l.parentNode.removeAttribute("style");var a="wfu_edit_shortcode:",t=o.responseText.indexOf(a);-1==t&&(t=o.responseText.length);var s=(o.responseText.substr(0,t),o.responseText.substr(t+a.length,o.responseText.length-t-a.length));t=s.indexOf(":");var n=s.substr(0,t);if(txt_value=s.substr(t+1,s.length-t-1),"success"==n){var r=window.open(wfu_plugin_decode_string(txt_value),"_blank");r.plugin_window=window}else"check_page_obsolete"==n&&alert(txt_value)}},o.send(_)}}}GlobalData={},UploadStates={},GlobalData.filestatematch={},GlobalData.filestatematch.success=[0,1,2,2],GlobalData.filestatematch.warning=[1,1,2,2],GlobalData.filestatematch.error1=[3,3,2,3],GlobalData.filestatematch.error2=[2,2,2,3],GlobalData.UploadInProgressString="",wfu_Check_Browser_Capabilities();
languages/wordpress-file-upload-fr_FR.mo CHANGED
Binary file
languages/wordpress-file-upload-fr_FR.po CHANGED
@@ -2,8 +2,8 @@ msgid ""
2
  msgstr ""
3
  "Project-Id-Version: Wordpress File Upload\n"
4
  "Report-Msgid-Bugs-To: \n"
5
- "POT-Creation-Date: 2015-05-01 17:06+0200\n"
6
- "PO-Revision-Date: 2015-05-01 17:06+0200\n"
7
  "Last-Translator: nickboss <nickboss@iptanus.com>\n"
8
  "Language-Team: \n"
9
  "Language: fr_FR\n"
@@ -360,90 +360,94 @@ msgid "select dir..."
360
  msgstr ""
361
 
362
  #: lib/wfu_constants.php:114
 
 
 
 
363
  msgid "Upload path: %filepath%"
364
  msgstr "Chemin d'Upload : %filepath%"
365
 
366
- #: lib/wfu_constants.php:115
367
  msgid "Failed upload path: %filepath%"
368
  msgstr "Mauvais répertoir d'envoi: %filepath%"
369
 
370
- #: lib/wfu_constants.php:116
371
  msgid " (required)"
372
  msgstr ""
373
 
374
- #: lib/wfu_constants.php:117
375
  msgid "Files are being uploaded. Are you sure you want to exit the page?"
376
  msgstr ""
377
 
378
- #: lib/wfu_constants.php:120
379
  msgid "This is a test message"
380
  msgstr "Ceci est un message de test"
381
 
382
- #: lib/wfu_constants.php:121
383
  msgid "This is a test administrator message"
384
  msgstr "Ceci est un message administrateur de test"
385
 
386
- #: lib/wfu_constants.php:122
387
  msgid "File testfile 1 under test"
388
  msgstr "File testfile 1 under test"
389
 
390
- #: lib/wfu_constants.php:123
391
  msgid "File testfile 1 message"
392
  msgstr "File testfile 1 message"
393
 
394
- #: lib/wfu_constants.php:124
395
  msgid "File testfile 1 administrator message"
396
  msgstr "Message administrateur File testfile"
397
 
398
- #: lib/wfu_constants.php:125
399
  msgid "File testfile 2 under test"
400
  msgstr "En test File testfile"
401
 
402
- #: lib/wfu_constants.php:126
403
  msgid "File testfile 2 message"
404
  msgstr "Message File testfile 2"
405
 
406
- #: lib/wfu_constants.php:127
407
  msgid "File testfile 2 administrator message"
408
  msgstr "Message administrateur File testfile 2"
409
 
410
- #: lib/wfu_constants.php:130
411
  msgid ""
412
  "Failed to edit the shortcode because the contents of the page changed. Try "
413
  "again to edit the shortcode."
414
  msgstr ""
415
 
416
- #: lib/wfu_constants.php:131
417
  msgid ""
418
  "Failed to delete the shortcode because the contents of the page changed. Try "
419
  "again to delete it."
420
  msgstr ""
421
 
422
- #: lib/wfu_constants.php:132
423
  msgid ""
424
  "The page containing the shortcode has been modified and it is no longer "
425
  "valid. Please go back to reload the shortcode."
426
  msgstr ""
427
 
428
- #: lib/wfu_constants.php:133
429
  msgid ""
430
  "Failed to update the shortcode because the contents of the page changed. Go "
431
  "back to reload the shortcode."
432
  msgstr ""
433
 
434
- #: lib/wfu_constants.php:134
435
  msgid ""
436
  "Failed to update the shortcode. Please try again. If the problem persists, "
437
  "go back and reload the shortcode."
438
  msgstr ""
439
 
440
- #: lib/wfu_constants.php:137
441
  msgid ""
442
  "Insert variable %userid% inside text. It will be replaced by the id of the "
443
  "current user."
444
  msgstr ""
445
 
446
- #: lib/wfu_constants.php:138
447
  msgid ""
448
  "Insert variable %username% inside text. It will be replaced by the username "
449
  "of the current user."
@@ -451,7 +455,7 @@ msgstr ""
451
  "Insérez la variable %username% dans le texte. Il sera remplacé par le "
452
  "username de l'utilisateur courant."
453
 
454
- #: lib/wfu_constants.php:139
455
  msgid ""
456
  "Insert variable %useremail% inside text. It will be replaced by the email of "
457
  "the current user."
@@ -459,7 +463,7 @@ msgstr ""
459
  "Insérez la variable %useremail% dans le texte. Il sera remplacé par l'email "
460
  "de l'utilisateur courant."
461
 
462
- #: lib/wfu_constants.php:140
463
  msgid ""
464
  "Insert variable %filename% inside text. It will be replaced by the filename "
465
  "of the uploaded file."
@@ -467,7 +471,7 @@ msgstr ""
467
  "Insérez la variable %filename% dans le texte. Il sera remplacé par le nom du "
468
  "fichier à envoyer."
469
 
470
- #: lib/wfu_constants.php:141
471
  msgid ""
472
  "Insert variable %filepath% inside text. It will be replaced by the full "
473
  "filepath of the uploaded file."
@@ -475,7 +479,7 @@ msgstr ""
475
  "Insérez la variable %filepath% dans le texte. Il sera remplacé par le chemin "
476
  "complet du fichier envoyé."
477
 
478
- #: lib/wfu_constants.php:142
479
  msgid ""
480
  "Insert variable %blogid% inside text. It will be replaced by the blog id of "
481
  "the website."
@@ -483,19 +487,19 @@ msgstr ""
483
  "Insérez la variable %blogid% dans le texte. Il sera remplacé par l'id du "
484
  "blog du site web."
485
 
486
- #: lib/wfu_constants.php:143
487
  msgid ""
488
  "Insert variable %pageid% inside text. It will be replaced by the id of the "
489
  "current page."
490
  msgstr ""
491
 
492
- #: lib/wfu_constants.php:144
493
  msgid ""
494
  "Insert variable %pagetitle% inside text. It will be replaced by the title of "
495
  "the current page."
496
  msgstr ""
497
 
498
- #: lib/wfu_constants.php:145
499
  msgid ""
500
  "Insert variable %userdataXXX% inside text. Select the user field from the "
501
  "drop-down list. It will be replaced by the value that the user entered in "
@@ -505,74 +509,74 @@ msgstr ""
505
  "l'utilisateur dans la liste déroulante. Il sera remplacé par la valeur que "
506
  "l'utilisateur aura entré dans ce champs."
507
 
508
- #: lib/wfu_constants.php:146
509
  msgid "Insert variable %n% inside text to denote a line change."
510
  msgstr ""
511
  "Insérez la variable %n% à l'intérieur du texte pour indiquer un changement "
512
  "de ligne."
513
 
514
- #: lib/wfu_constants.php:149
515
  msgid "Upload in progress"
516
  msgstr "Envoi en cours"
517
 
518
- #: lib/wfu_constants.php:150
519
  msgid "Upload in progress with warnings!"
520
  msgstr "Envoi en cours mais avec des avertissements!"
521
 
522
- #: lib/wfu_constants.php:151
523
  msgid "Upload in progress but some files already failed!"
524
  msgstr "Envoi en cours mais certains fichiers ont échoués!"
525
 
526
- #: lib/wfu_constants.php:152
527
  msgid "Upload in progress but no files uploaded so far!"
528
  msgstr "Envoi en cours mais aucun fichiers n'a été envoyé pour le moment!"
529
 
530
- #: lib/wfu_constants.php:153
531
  msgid "All files uploaded successfully"
532
  msgstr "Tous les fichiers ont été envoyés avec succès"
533
 
534
- #: lib/wfu_constants.php:154
535
  msgid "All files uploaded successfully but there are warnings!"
536
  msgstr ""
537
  "Tous les fichiers ont été envoyer avec succès mais avec des avertissements!"
538
 
539
- #: lib/wfu_constants.php:155
540
  msgid "File uploaded successfully but there are warnings!"
541
  msgstr "Fichiers envoyés avec succès mais certain avec un avertissement."
542
 
543
- #: lib/wfu_constants.php:156
544
  msgid "Some files failed to upload!"
545
  msgstr "Certains fichiers n'ont pas été envoyé"
546
 
547
- #: lib/wfu_constants.php:157
548
  msgid "All files failed to upload"
549
  msgstr "Impossible d'envoyer les fichiers"
550
 
551
- #: lib/wfu_constants.php:158
552
  msgid "File failed to upload"
553
  msgstr "Impossible d'envoyer le fichier"
554
 
555
- #: lib/wfu_constants.php:159
556
  msgid "There are no files to upload!"
557
  msgstr "Il n'y a pas de fichiers à envoyer"
558
 
559
- #: lib/wfu_constants.php:160
560
  msgid "Test upload message"
561
  msgstr "Message de test d'upload"
562
 
563
- #: lib/wfu_constants.php:161
564
  msgid "JSON parse warning!"
565
  msgstr "Avertisements d'analyse JSON."
566
 
567
- #: lib/wfu_constants.php:162
568
  msgid "please wait while redirecting..."
569
  msgstr "merci de patienter pendans la redirection..."
570
 
571
- #: lib/wfu_constants.php:163
572
  msgid "Open visual shortcode editor in new window"
573
  msgstr ""
574
 
575
- #: lib/wfu_constants.php:164
576
  msgid "loading visual editor"
577
  msgstr ""
578
 
2
  msgstr ""
3
  "Project-Id-Version: Wordpress File Upload\n"
4
  "Report-Msgid-Bugs-To: \n"
5
+ "POT-Creation-Date: 2015-05-09 22:52+0200\n"
6
+ "PO-Revision-Date: 2015-05-09 22:52+0200\n"
7
  "Last-Translator: nickboss <nickboss@iptanus.com>\n"
8
  "Language-Team: \n"
9
  "Language: fr_FR\n"
360
  msgstr ""
361
 
362
  #: lib/wfu_constants.php:114
363
+ msgid "type dir"
364
+ msgstr ""
365
+
366
+ #: lib/wfu_constants.php:115
367
  msgid "Upload path: %filepath%"
368
  msgstr "Chemin d'Upload : %filepath%"
369
 
370
+ #: lib/wfu_constants.php:116
371
  msgid "Failed upload path: %filepath%"
372
  msgstr "Mauvais répertoir d'envoi: %filepath%"
373
 
374
+ #: lib/wfu_constants.php:117
375
  msgid " (required)"
376
  msgstr ""
377
 
378
+ #: lib/wfu_constants.php:118
379
  msgid "Files are being uploaded. Are you sure you want to exit the page?"
380
  msgstr ""
381
 
382
+ #: lib/wfu_constants.php:121
383
  msgid "This is a test message"
384
  msgstr "Ceci est un message de test"
385
 
386
+ #: lib/wfu_constants.php:122
387
  msgid "This is a test administrator message"
388
  msgstr "Ceci est un message administrateur de test"
389
 
390
+ #: lib/wfu_constants.php:123
391
  msgid "File testfile 1 under test"
392
  msgstr "File testfile 1 under test"
393
 
394
+ #: lib/wfu_constants.php:124
395
  msgid "File testfile 1 message"
396
  msgstr "File testfile 1 message"
397
 
398
+ #: lib/wfu_constants.php:125
399
  msgid "File testfile 1 administrator message"
400
  msgstr "Message administrateur File testfile"
401
 
402
+ #: lib/wfu_constants.php:126
403
  msgid "File testfile 2 under test"
404
  msgstr "En test File testfile"
405
 
406
+ #: lib/wfu_constants.php:127
407
  msgid "File testfile 2 message"
408
  msgstr "Message File testfile 2"
409
 
410
+ #: lib/wfu_constants.php:128
411
  msgid "File testfile 2 administrator message"
412
  msgstr "Message administrateur File testfile 2"
413
 
414
+ #: lib/wfu_constants.php:131
415
  msgid ""
416
  "Failed to edit the shortcode because the contents of the page changed. Try "
417
  "again to edit the shortcode."
418
  msgstr ""
419
 
420
+ #: lib/wfu_constants.php:132
421
  msgid ""
422
  "Failed to delete the shortcode because the contents of the page changed. Try "
423
  "again to delete it."
424
  msgstr ""
425
 
426
+ #: lib/wfu_constants.php:133
427
  msgid ""
428
  "The page containing the shortcode has been modified and it is no longer "
429
  "valid. Please go back to reload the shortcode."
430
  msgstr ""
431
 
432
+ #: lib/wfu_constants.php:134
433
  msgid ""
434
  "Failed to update the shortcode because the contents of the page changed. Go "
435
  "back to reload the shortcode."
436
  msgstr ""
437
 
438
+ #: lib/wfu_constants.php:135
439
  msgid ""
440
  "Failed to update the shortcode. Please try again. If the problem persists, "
441
  "go back and reload the shortcode."
442
  msgstr ""
443
 
444
+ #: lib/wfu_constants.php:138
445
  msgid ""
446
  "Insert variable %userid% inside text. It will be replaced by the id of the "
447
  "current user."
448
  msgstr ""
449
 
450
+ #: lib/wfu_constants.php:139
451
  msgid ""
452
  "Insert variable %username% inside text. It will be replaced by the username "
453
  "of the current user."
455
  "Insérez la variable %username% dans le texte. Il sera remplacé par le "
456
  "username de l'utilisateur courant."
457
 
458
+ #: lib/wfu_constants.php:140
459
  msgid ""
460
  "Insert variable %useremail% inside text. It will be replaced by the email of "
461
  "the current user."
463
  "Insérez la variable %useremail% dans le texte. Il sera remplacé par l'email "
464
  "de l'utilisateur courant."
465
 
466
+ #: lib/wfu_constants.php:141
467
  msgid ""
468
  "Insert variable %filename% inside text. It will be replaced by the filename "
469
  "of the uploaded file."
471
  "Insérez la variable %filename% dans le texte. Il sera remplacé par le nom du "
472
  "fichier à envoyer."
473
 
474
+ #: lib/wfu_constants.php:142
475
  msgid ""
476
  "Insert variable %filepath% inside text. It will be replaced by the full "
477
  "filepath of the uploaded file."
479
  "Insérez la variable %filepath% dans le texte. Il sera remplacé par le chemin "
480
  "complet du fichier envoyé."
481
 
482
+ #: lib/wfu_constants.php:143
483
  msgid ""
484
  "Insert variable %blogid% inside text. It will be replaced by the blog id of "
485
  "the website."
487
  "Insérez la variable %blogid% dans le texte. Il sera remplacé par l'id du "
488
  "blog du site web."
489
 
490
+ #: lib/wfu_constants.php:144
491
  msgid ""
492
  "Insert variable %pageid% inside text. It will be replaced by the id of the "
493
  "current page."
494
  msgstr ""
495
 
496
+ #: lib/wfu_constants.php:145
497
  msgid ""
498
  "Insert variable %pagetitle% inside text. It will be replaced by the title of "
499
  "the current page."
500
  msgstr ""
501
 
502
+ #: lib/wfu_constants.php:146
503
  msgid ""
504
  "Insert variable %userdataXXX% inside text. Select the user field from the "
505
  "drop-down list. It will be replaced by the value that the user entered in "
509
  "l'utilisateur dans la liste déroulante. Il sera remplacé par la valeur que "
510
  "l'utilisateur aura entré dans ce champs."
511
 
512
+ #: lib/wfu_constants.php:147
513
  msgid "Insert variable %n% inside text to denote a line change."
514
  msgstr ""
515
  "Insérez la variable %n% à l'intérieur du texte pour indiquer un changement "
516
  "de ligne."
517
 
518
+ #: lib/wfu_constants.php:150
519
  msgid "Upload in progress"
520
  msgstr "Envoi en cours"
521
 
522
+ #: lib/wfu_constants.php:151
523
  msgid "Upload in progress with warnings!"
524
  msgstr "Envoi en cours mais avec des avertissements!"
525
 
526
+ #: lib/wfu_constants.php:152
527
  msgid "Upload in progress but some files already failed!"
528
  msgstr "Envoi en cours mais certains fichiers ont échoués!"
529
 
530
+ #: lib/wfu_constants.php:153
531
  msgid "Upload in progress but no files uploaded so far!"
532
  msgstr "Envoi en cours mais aucun fichiers n'a été envoyé pour le moment!"
533
 
534
+ #: lib/wfu_constants.php:154
535
  msgid "All files uploaded successfully"
536
  msgstr "Tous les fichiers ont été envoyés avec succès"
537
 
538
+ #: lib/wfu_constants.php:155
539
  msgid "All files uploaded successfully but there are warnings!"
540
  msgstr ""
541
  "Tous les fichiers ont été envoyer avec succès mais avec des avertissements!"
542
 
543
+ #: lib/wfu_constants.php:156
544
  msgid "File uploaded successfully but there are warnings!"
545
  msgstr "Fichiers envoyés avec succès mais certain avec un avertissement."
546
 
547
+ #: lib/wfu_constants.php:157
548
  msgid "Some files failed to upload!"
549
  msgstr "Certains fichiers n'ont pas été envoyé"
550
 
551
+ #: lib/wfu_constants.php:158
552
  msgid "All files failed to upload"
553
  msgstr "Impossible d'envoyer les fichiers"
554
 
555
+ #: lib/wfu_constants.php:159
556
  msgid "File failed to upload"
557
  msgstr "Impossible d'envoyer le fichier"
558
 
559
+ #: lib/wfu_constants.php:160
560
  msgid "There are no files to upload!"
561
  msgstr "Il n'y a pas de fichiers à envoyer"
562
 
563
+ #: lib/wfu_constants.php:161
564
  msgid "Test upload message"
565
  msgstr "Message de test d'upload"
566
 
567
+ #: lib/wfu_constants.php:162
568
  msgid "JSON parse warning!"
569
  msgstr "Avertisements d'analyse JSON."
570
 
571
+ #: lib/wfu_constants.php:163
572
  msgid "please wait while redirecting..."
573
  msgstr "merci de patienter pendans la redirection..."
574
 
575
+ #: lib/wfu_constants.php:164
576
  msgid "Open visual shortcode editor in new window"
577
  msgstr ""
578
 
579
+ #: lib/wfu_constants.php:165
580
  msgid "loading visual editor"
581
  msgstr ""
582
 
languages/wordpress-file-upload.pot CHANGED
@@ -2,8 +2,8 @@ msgid ""
2
  msgstr ""
3
  "Project-Id-Version: Wordpress File Upload\n"
4
  "Report-Msgid-Bugs-To: \n"
5
- "POT-Creation-Date: 2015-05-01 17:06+0200\n"
6
- "PO-Revision-Date: 2015-05-01 17:06+0200\n"
7
  "Last-Translator: nickboss <info@iptanus.com>\n"
8
  "Language-Team: Iptanus Team <info@iptanus.com>\n"
9
  "Language: en\n"
@@ -304,202 +304,206 @@ msgid "select dir..."
304
  msgstr ""
305
 
306
  #: lib/wfu_constants.php:114
307
- msgid "Upload path: %filepath%"
308
  msgstr ""
309
 
310
  #: lib/wfu_constants.php:115
311
- msgid "Failed upload path: %filepath%"
312
  msgstr ""
313
 
314
  #: lib/wfu_constants.php:116
315
- msgid " (required)"
316
  msgstr ""
317
 
318
  #: lib/wfu_constants.php:117
 
 
 
 
319
  msgid "Files are being uploaded. Are you sure you want to exit the page?"
320
  msgstr ""
321
 
322
- #: lib/wfu_constants.php:120
323
  msgid "This is a test message"
324
  msgstr ""
325
 
326
- #: lib/wfu_constants.php:121
327
  msgid "This is a test administrator message"
328
  msgstr ""
329
 
330
- #: lib/wfu_constants.php:122
331
  msgid "File testfile 1 under test"
332
  msgstr ""
333
 
334
- #: lib/wfu_constants.php:123
335
  msgid "File testfile 1 message"
336
  msgstr ""
337
 
338
- #: lib/wfu_constants.php:124
339
  msgid "File testfile 1 administrator message"
340
  msgstr ""
341
 
342
- #: lib/wfu_constants.php:125
343
  msgid "File testfile 2 under test"
344
  msgstr ""
345
 
346
- #: lib/wfu_constants.php:126
347
  msgid "File testfile 2 message"
348
  msgstr ""
349
 
350
- #: lib/wfu_constants.php:127
351
  msgid "File testfile 2 administrator message"
352
  msgstr ""
353
 
354
- #: lib/wfu_constants.php:130
355
  msgid ""
356
  "Failed to edit the shortcode because the contents of the page changed. Try "
357
  "again to edit the shortcode."
358
  msgstr ""
359
 
360
- #: lib/wfu_constants.php:131
361
  msgid ""
362
  "Failed to delete the shortcode because the contents of the page changed. Try "
363
  "again to delete it."
364
  msgstr ""
365
 
366
- #: lib/wfu_constants.php:132
367
  msgid ""
368
  "The page containing the shortcode has been modified and it is no longer "
369
  "valid. Please go back to reload the shortcode."
370
  msgstr ""
371
 
372
- #: lib/wfu_constants.php:133
373
  msgid ""
374
  "Failed to update the shortcode because the contents of the page changed. Go "
375
  "back to reload the shortcode."
376
  msgstr ""
377
 
378
- #: lib/wfu_constants.php:134
379
  msgid ""
380
  "Failed to update the shortcode. Please try again. If the problem persists, "
381
  "go back and reload the shortcode."
382
  msgstr ""
383
 
384
- #: lib/wfu_constants.php:137
385
  msgid ""
386
  "Insert variable %userid% inside text. It will be replaced by the id of the "
387
  "current user."
388
  msgstr ""
389
 
390
- #: lib/wfu_constants.php:138
391
  msgid ""
392
  "Insert variable %username% inside text. It will be replaced by the username "
393
  "of the current user."
394
  msgstr ""
395
 
396
- #: lib/wfu_constants.php:139
397
  msgid ""
398
  "Insert variable %useremail% inside text. It will be replaced by the email of "
399
  "the current user."
400
  msgstr ""
401
 
402
- #: lib/wfu_constants.php:140
403
  msgid ""
404
  "Insert variable %filename% inside text. It will be replaced by the filename "
405
  "of the uploaded file."
406
  msgstr ""
407
 
408
- #: lib/wfu_constants.php:141
409
  msgid ""
410
  "Insert variable %filepath% inside text. It will be replaced by the full "
411
  "filepath of the uploaded file."
412
  msgstr ""
413
 
414
- #: lib/wfu_constants.php:142
415
  msgid ""
416
  "Insert variable %blogid% inside text. It will be replaced by the blog id of "
417
  "the website."
418
  msgstr ""
419
 
420
- #: lib/wfu_constants.php:143
421
  msgid ""
422
  "Insert variable %pageid% inside text. It will be replaced by the id of the "
423
  "current page."
424
  msgstr ""
425
 
426
- #: lib/wfu_constants.php:144
427
  msgid ""
428
  "Insert variable %pagetitle% inside text. It will be replaced by the title of "
429
  "the current page."
430
  msgstr ""
431
 
432
- #: lib/wfu_constants.php:145
433
  msgid ""
434
  "Insert variable %userdataXXX% inside text. Select the user field from the "
435
  "drop-down list. It will be replaced by the value that the user entered in "
436
  "this field."
437
  msgstr ""
438
 
439
- #: lib/wfu_constants.php:146
440
  msgid "Insert variable %n% inside text to denote a line change."
441
  msgstr ""
442
 
443
- #: lib/wfu_constants.php:149
444
  msgid "Upload in progress"
445
  msgstr ""
446
 
447
- #: lib/wfu_constants.php:150
448
  msgid "Upload in progress with warnings!"
449
  msgstr ""
450
 
451
- #: lib/wfu_constants.php:151
452
  msgid "Upload in progress but some files already failed!"
453
  msgstr ""
454
 
455
- #: lib/wfu_constants.php:152
456
  msgid "Upload in progress but no files uploaded so far!"
457
  msgstr ""
458
 
459
- #: lib/wfu_constants.php:153
460
  msgid "All files uploaded successfully"
461
  msgstr ""
462
 
463
- #: lib/wfu_constants.php:154
464
  msgid "All files uploaded successfully but there are warnings!"
465
  msgstr ""
466
 
467
- #: lib/wfu_constants.php:155
468
  msgid "File uploaded successfully but there are warnings!"
469
  msgstr ""
470
 
471
- #: lib/wfu_constants.php:156
472
  msgid "Some files failed to upload!"
473
  msgstr ""
474
 
475
- #: lib/wfu_constants.php:157
476
  msgid "All files failed to upload"
477
  msgstr ""
478
 
479
- #: lib/wfu_constants.php:158
480
  msgid "File failed to upload"
481
  msgstr ""
482
 
483
- #: lib/wfu_constants.php:159
484
  msgid "There are no files to upload!"
485
  msgstr ""
486
 
487
- #: lib/wfu_constants.php:160
488
  msgid "Test upload message"
489
  msgstr ""
490
 
491
- #: lib/wfu_constants.php:161
492
  msgid "JSON parse warning!"
493
  msgstr ""
494
 
495
- #: lib/wfu_constants.php:162
496
  msgid "please wait while redirecting..."
497
  msgstr ""
498
 
499
- #: lib/wfu_constants.php:163
500
  msgid "Open visual shortcode editor in new window"
501
  msgstr ""
502
 
503
- #: lib/wfu_constants.php:164
504
  msgid "loading visual editor"
505
  msgstr ""
2
  msgstr ""
3
  "Project-Id-Version: Wordpress File Upload\n"
4
  "Report-Msgid-Bugs-To: \n"
5
+ "POT-Creation-Date: 2015-05-09 22:52+0200\n"
6
+ "PO-Revision-Date: 2015-05-09 22:52+0200\n"
7
  "Last-Translator: nickboss <info@iptanus.com>\n"
8
  "Language-Team: Iptanus Team <info@iptanus.com>\n"
9
  "Language: en\n"
304
  msgstr ""
305
 
306
  #: lib/wfu_constants.php:114
307
+ msgid "type dir"
308
  msgstr ""
309
 
310
  #: lib/wfu_constants.php:115
311
+ msgid "Upload path: %filepath%"
312
  msgstr ""
313
 
314
  #: lib/wfu_constants.php:116
315
+ msgid "Failed upload path: %filepath%"
316
  msgstr ""
317
 
318
  #: lib/wfu_constants.php:117
319
+ msgid " (required)"
320
+ msgstr ""
321
+
322
+ #: lib/wfu_constants.php:118
323
  msgid "Files are being uploaded. Are you sure you want to exit the page?"
324
  msgstr ""
325
 
326
+ #: lib/wfu_constants.php:121
327
  msgid "This is a test message"
328
  msgstr ""
329
 
330
+ #: lib/wfu_constants.php:122
331
  msgid "This is a test administrator message"
332
  msgstr ""
333
 
334
+ #: lib/wfu_constants.php:123
335
  msgid "File testfile 1 under test"
336
  msgstr ""
337
 
338
+ #: lib/wfu_constants.php:124
339
  msgid "File testfile 1 message"
340
  msgstr ""
341
 
342
+ #: lib/wfu_constants.php:125
343
  msgid "File testfile 1 administrator message"
344
  msgstr ""
345
 
346
+ #: lib/wfu_constants.php:126
347
  msgid "File testfile 2 under test"
348
  msgstr ""
349
 
350
+ #: lib/wfu_constants.php:127
351
  msgid "File testfile 2 message"
352
  msgstr ""
353
 
354
+ #: lib/wfu_constants.php:128
355
  msgid "File testfile 2 administrator message"
356
  msgstr ""
357
 
358
+ #: lib/wfu_constants.php:131
359
  msgid ""
360
  "Failed to edit the shortcode because the contents of the page changed. Try "
361
  "again to edit the shortcode."
362
  msgstr ""
363
 
364
+ #: lib/wfu_constants.php:132
365
  msgid ""
366
  "Failed to delete the shortcode because the contents of the page changed. Try "
367
  "again to delete it."
368
  msgstr ""
369
 
370
+ #: lib/wfu_constants.php:133
371
  msgid ""
372
  "The page containing the shortcode has been modified and it is no longer "
373
  "valid. Please go back to reload the shortcode."
374
  msgstr ""
375
 
376
+ #: lib/wfu_constants.php:134
377
  msgid ""
378
  "Failed to update the shortcode because the contents of the page changed. Go "
379
  "back to reload the shortcode."
380
  msgstr ""
381
 
382
+ #: lib/wfu_constants.php:135
383
  msgid ""
384
  "Failed to update the shortcode. Please try again. If the problem persists, "
385
  "go back and reload the shortcode."
386
  msgstr ""
387
 
388
+ #: lib/wfu_constants.php:138
389
  msgid ""
390
  "Insert variable %userid% inside text. It will be replaced by the id of the "
391
  "current user."
392
  msgstr ""
393
 
394
+ #: lib/wfu_constants.php:139
395
  msgid ""
396
  "Insert variable %username% inside text. It will be replaced by the username "
397
  "of the current user."
398
  msgstr ""
399
 
400
+ #: lib/wfu_constants.php:140
401
  msgid ""
402
  "Insert variable %useremail% inside text. It will be replaced by the email of "
403
  "the current user."
404
  msgstr ""
405
 
406
+ #: lib/wfu_constants.php:141
407
  msgid ""
408
  "Insert variable %filename% inside text. It will be replaced by the filename "
409
  "of the uploaded file."
410
  msgstr ""
411
 
412
+ #: lib/wfu_constants.php:142
413
  msgid ""
414
  "Insert variable %filepath% inside text. It will be replaced by the full "
415
  "filepath of the uploaded file."
416
  msgstr ""
417
 
418
+ #: lib/wfu_constants.php:143
419
  msgid ""
420
  "Insert variable %blogid% inside text. It will be replaced by the blog id of "
421
  "the website."
422
  msgstr ""
423
 
424
+ #: lib/wfu_constants.php:144
425
  msgid ""
426
  "Insert variable %pageid% inside text. It will be replaced by the id of the "
427
  "current page."
428
  msgstr ""
429
 
430
+ #: lib/wfu_constants.php:145
431
  msgid ""
432
  "Insert variable %pagetitle% inside text. It will be replaced by the title of "
433
  "the current page."
434
  msgstr ""
435
 
436
+ #: lib/wfu_constants.php:146
437
  msgid ""
438
  "Insert variable %userdataXXX% inside text. Select the user field from the "
439
  "drop-down list. It will be replaced by the value that the user entered in "
440
  "this field."
441
  msgstr ""
442
 
443
+ #: lib/wfu_constants.php:147
444
  msgid "Insert variable %n% inside text to denote a line change."
445
  msgstr ""
446
 
447
+ #: lib/wfu_constants.php:150
448
  msgid "Upload in progress"
449
  msgstr ""
450
 
451
+ #: lib/wfu_constants.php:151
452
  msgid "Upload in progress with warnings!"
453
  msgstr ""
454
 
455
+ #: lib/wfu_constants.php:152
456
  msgid "Upload in progress but some files already failed!"
457
  msgstr ""
458
 
459
+ #: lib/wfu_constants.php:153
460
  msgid "Upload in progress but no files uploaded so far!"
461
  msgstr ""
462
 
463
+ #: lib/wfu_constants.php:154
464
  msgid "All files uploaded successfully"
465
  msgstr ""
466
 
467
+ #: lib/wfu_constants.php:155
468
  msgid "All files uploaded successfully but there are warnings!"
469
  msgstr ""
470
 
471
+ #: lib/wfu_constants.php:156
472
  msgid "File uploaded successfully but there are warnings!"
473
  msgstr ""
474
 
475
+ #: lib/wfu_constants.php:157
476
  msgid "Some files failed to upload!"
477
  msgstr ""
478
 
479
+ #: lib/wfu_constants.php:158
480
  msgid "All files failed to upload"
481
  msgstr ""
482
 
483
+ #: lib/wfu_constants.php:159
484
  msgid "File failed to upload"
485
  msgstr ""
486
 
487
+ #: lib/wfu_constants.php:160
488
  msgid "There are no files to upload!"
489
  msgstr ""
490
 
491
+ #: lib/wfu_constants.php:161
492
  msgid "Test upload message"
493
  msgstr ""
494
 
495
+ #: lib/wfu_constants.php:162
496
  msgid "JSON parse warning!"
497
  msgstr ""
498
 
499
+ #: lib/wfu_constants.php:163
500
  msgid "please wait while redirecting..."
501
  msgstr ""
502
 
503
+ #: lib/wfu_constants.php:164
504
  msgid "Open visual shortcode editor in new window"
505
  msgstr ""
506
 
507
+ #: lib/wfu_constants.php:165
508
  msgid "loading visual editor"
509
  msgstr ""
lib/wfu_admin.php CHANGED
@@ -186,8 +186,8 @@ function wordpress_file_upload_manage_dashboard() {
186
  function wfu_manage_mainmenu($message = '') {
187
  if ( !current_user_can( 'manage_options' ) ) return;
188
 
189
- // $str = str_replace(array("\r\n", "\r", "\n"), "<br/>", (print_r($alldata, true)));
190
- // echo str_replace(array("\t", " "), "&nbsp;", $str);
191
 
192
  $siteurl = site_url();
193
  $plugin_options = wfu_decode_plugin_options(get_option( "wordpress_file_upload_options" ));
@@ -267,6 +267,17 @@ function wfu_manage_mainmenu($message = '') {
267
  $echo_str .= "\n\t\t\t\t".'</tr>';
268
  $echo_str .= "\n\t\t\t\t".'<tr class="form-field">';
269
  $echo_str .= "\n\t\t\t\t\t".'<th scope="row">';
 
 
 
 
 
 
 
 
 
 
 
270
  $echo_str .= "\n\t\t\t\t\t\t".'<label style="cursor:default;">Release Notes</label>';
271
  $echo_str .= "\n\t\t\t\t\t".'</th>';
272
  $echo_str .= "\n\t\t\t\t\t".'<td colspan="2" style="width:100px;">';
@@ -371,11 +382,12 @@ function wfu_get_content_shortcodes($post, $tag) {
371
  $data['post_hash'] = $hash;
372
  $data['shortcode'] = $shortcode[0][0];
373
  $data['position'] = $shortcode[0][1];
 
374
  }
375
- array_push($ret, $data);
376
  }
377
- return $ret;
378
  }
 
 
379
  }
380
 
381
  function wfu_check_edit_shortcode($data) {
186
  function wfu_manage_mainmenu($message = '') {
187
  if ( !current_user_can( 'manage_options' ) ) return;
188
 
189
+ //get php version
190
+ $php_version = preg_replace("/-.*/", "", phpversion());
191
 
192
  $siteurl = site_url();
193
  $plugin_options = wfu_decode_plugin_options(get_option( "wordpress_file_upload_options" ));
267
  $echo_str .= "\n\t\t\t\t".'</tr>';
268
  $echo_str .= "\n\t\t\t\t".'<tr class="form-field">';
269
  $echo_str .= "\n\t\t\t\t\t".'<th scope="row">';
270
+ $echo_str .= "\n\t\t\t\t\t\t".'<label style="cursor:default;">PHP Version</label>';
271
+ $echo_str .= "\n\t\t\t\t\t".'</th>';
272
+ $echo_str .= "\n\t\t\t\t\t".'<td style="width:100px;">';
273
+ $cur_version = wfu_get_plugin_version();
274
+ $echo_str .= "\n\t\t\t\t\t\t".'<label style="font-weight:bold; cursor:default;">'.$php_version.'</label>';
275
+ $echo_str .= "\n\t\t\t\t\t".'</td>';
276
+ $echo_str .= "\n\t\t\t\t\t".'<td>';
277
+ $echo_str .= "\n\t\t\t\t\t".'</td>';
278
+ $echo_str .= "\n\t\t\t\t".'</tr>';
279
+ $echo_str .= "\n\t\t\t\t".'<tr class="form-field">';
280
+ $echo_str .= "\n\t\t\t\t\t".'<th scope="row">';
281
  $echo_str .= "\n\t\t\t\t\t\t".'<label style="cursor:default;">Release Notes</label>';
282
  $echo_str .= "\n\t\t\t\t\t".'</th>';
283
  $echo_str .= "\n\t\t\t\t\t".'<td colspan="2" style="width:100px;">';
382
  $data['post_hash'] = $hash;
383
  $data['shortcode'] = $shortcode[0][0];
384
  $data['position'] = $shortcode[0][1];
385
+ array_push($ret, $data);
386
  }
 
387
  }
 
388
  }
389
+ if ( count($ret) == 0 ) return false;
390
+ return $ret;
391
  }
392
 
393
  function wfu_check_edit_shortcode($data) {
lib/wfu_admin_composer.php CHANGED
@@ -265,7 +265,12 @@ function wfu_shortcode_composer($data = '') {
265
  elseif ( $def['type'] == "folderlist" ) {
266
  $echo_str .= $dlp."\t\t".'<div id="wfu_subfolders_inner_shadow_'.$attr.'" class="wfu_subfolders_inner_shadow" style="display:none;"></div>';
267
  $subfolders = wfu_parse_folderlist($def['value']);
268
- $echo_str .= $dlp."\t\t".'<select id="wfu_attribute_'.$attr.'" class="wfu_select_folders'.( count($subfolders['path']) == 0 ? ' wfu_select_folders_empty' : '' ).'" size="7" onchange="wfu_subfolders_changed(\''.$attr.'\');">';
 
 
 
 
 
269
  foreach ($subfolders['path'] as $ind => $subfolder) {
270
  if ( substr($subfolder, -1) == '/' ) $subfolder = substr($subfolder, 0, -1);
271
  $subfolder_raw = explode('/', $subfolder);
@@ -274,7 +279,7 @@ function wfu_shortcode_composer($data = '') {
274
  $subvalue = str_repeat("*", intval($subfolders['level'][$ind])).( $subfolders['default'][$ind] ? '&' : '' ).( $subfolder == "" ? '{root}' : $subfolder ).'/'.$subfolders['label'][$ind];
275
  $echo_str .= $dlp."\t\t\t".'<option class="'.( $subfolders['default'][$ind] ? 'wfu_select_folders_option_default' : '' ).'" value="'.wfu_plugin_encode_string($subvalue).'">'.$text.'</option>';
276
  }
277
- $echo_str .= $dlp."\t\t\t".'<option value="">'.( count($subfolders['path']) == 0 ? 'press here' : '' ).'</option>';
278
  $echo_str .= $dlp."\t\t".'</select>';
279
  $echo_str .= $dlp."\t\t".'<div id="wfu_subfolder_nav_'.$attr.'" class="wfu_subfolder_nav_container">';
280
  $echo_str .= $dlp."\t\t\t".'<table class="wfu_subfolder_nav"><tbody>';
265
  elseif ( $def['type'] == "folderlist" ) {
266
  $echo_str .= $dlp."\t\t".'<div id="wfu_subfolders_inner_shadow_'.$attr.'" class="wfu_subfolders_inner_shadow" style="display:none;"></div>';
267
  $subfolders = wfu_parse_folderlist($def['value']);
268
+ $poptitle = "Populate list automatically with the first-level subfolders of the path defined in uploadpath";
269
+ $edittitle = "Allow the user to type the subfolder and filter the list during typing";
270
+ $echo_str .= $dlp."\t\t".'<input type="checkbox" id="wfu_subfolders_auto_'.$attr.'"'.( substr($def['value'], 0, 4) == "auto" ? ' checked="checked"' : '' ).' onchange="wfu_subfolders_auto_changed(\''.$attr.'\');" title="'.$poptitle.'" /><label for="wfu_subfolders_auto_'.$attr.'" title="'.$poptitle.'"> Auto-populate list</label>';
271
+ $echo_str .= $dlp."\t\t".'<div style="display:'.( substr($def['value'], 0, 4) == "auto" ? 'inline' : 'none' ).'; padding:0; margin:0 0 0 30px; background:none; border:none;"><input type="checkbox" id="wfu_subfolders_editable_'.$attr.'"'.( substr($def['value'], 0, 5) == "auto+" ? ' checked="checked"' : '' ).' onchange="wfu_subfolders_auto_changed(\''.$attr.'\');" title="'.$edittitle.'" /><label for="wfu_subfolders_editable_'.$attr.'" title="'.$edittitle.'"> List is editable</label></div><br />';
272
+ $echo_str .= $dlp."\t\t".'<input type="hidden" id="wfu_subfolders_manualtext_'.$attr.'" value="'.( substr($def['value'], 0, 4) == "auto" ? "" : $def['value'] ).'" />';
273
+ $echo_str .= $dlp."\t\t".'<select id="wfu_attribute_'.$attr.'" class="wfu_select_folders'.( count($subfolders['path']) == 0 ? ' wfu_select_folders_empty' : '' ).'" size="7"'.( substr($def['value'], 0, 4) == "auto" ? ' disabled="disabled"' : '' ).' onchange="wfu_subfolders_changed(\''.$attr.'\');">';
274
  foreach ($subfolders['path'] as $ind => $subfolder) {
275
  if ( substr($subfolder, -1) == '/' ) $subfolder = substr($subfolder, 0, -1);
276
  $subfolder_raw = explode('/', $subfolder);
279
  $subvalue = str_repeat("*", intval($subfolders['level'][$ind])).( $subfolders['default'][$ind] ? '&' : '' ).( $subfolder == "" ? '{root}' : $subfolder ).'/'.$subfolders['label'][$ind];
280
  $echo_str .= $dlp."\t\t\t".'<option class="'.( $subfolders['default'][$ind] ? 'wfu_select_folders_option_default' : '' ).'" value="'.wfu_plugin_encode_string($subvalue).'">'.$text.'</option>';
281
  }
282
+ $echo_str .= $dlp."\t\t\t".'<option value="">'.( substr($def['value'], 0, 4) != "auto" && count($subfolders['path']) == 0 ? 'press here' : '' ).'</option>';
283
  $echo_str .= $dlp."\t\t".'</select>';
284
  $echo_str .= $dlp."\t\t".'<div id="wfu_subfolder_nav_'.$attr.'" class="wfu_subfolder_nav_container">';
285
  $echo_str .= $dlp."\t\t\t".'<table class="wfu_subfolder_nav"><tbody>';
lib/wfu_attributes.php CHANGED
@@ -306,7 +306,7 @@ function wfu_attribute_definitions() {
306
  "parent" => "askforsubfolders",
307
  "dependencies" => null,
308
  "variables" => null,
309
- "help" => "The list of folders a user can select. Please see documentation on how to create the list of folders."
310
  ),
311
  array(
312
  "name" => "File Duplicates Policy",
306
  "parent" => "askforsubfolders",
307
  "dependencies" => null,
308
  "variables" => null,
309
+ "help" => "The list of folders a user can select. Please see documentation on how to create the list of folders. If 'Auto-populate list' is selected, then the list will be filled automatically with the first-level subfolders inside the directory defined by uploadpath. If 'List is editable' is selected, then the user will have the capability to type the subfolder and filter the subfolder list and/or define a new subfolder."
310
  ),
311
  array(
312
  "name" => "File Duplicates Policy",
lib/wfu_blocks.php CHANGED
@@ -4,6 +4,7 @@
4
  function wfu_prepare_subfolders_block($params, $widths, $heights) {
5
  $sid = $params["uploadid"];
6
  $selectsubdir = 'selectsubdir_'.$sid;
 
7
  $defaultvalue = 'selectsubdirdefault_'.$sid;
8
  $hiddeninput = 'hiddeninput_'.$sid;
9
  $subfolders_item = null;
@@ -16,9 +17,11 @@ function wfu_prepare_subfolders_block($params, $widths, $heights) {
16
  if ( $heights["subfolders_label"] != "" ) $styles2 .= 'height: '.$heights["subfolders_label"].'; ';
17
  if ( $styles2 != "" ) $styles2 = ' style="'.$styles2.'"';
18
  $styles3 = "border: 1px solid; border-color: #BBBBBB;";
19
- if ( $widths["subfolders_select"] != "" ) $styles3 .= 'width: '.$widths["subfolders_select"].'; ';
20
- if ( $heights["subfolders_select"] != "" ) $styles3 .= 'height: '.$heights["subfolders_select"].'; ';
21
- $styles3 = ' style="'.$styles3.'"';
 
 
22
  $subfolder_paths = array ( );
23
  $linebr = "";
24
  if ( $params["showtargetfolder"] == "true" || $params["askforsubfolders"] == "true" ) {
@@ -33,14 +36,24 @@ function wfu_prepare_subfolders_block($params, $widths, $heights) {
33
  }
34
  if ( $params["askforsubfolders"] == "true" ) {
35
  $subfolders_item["line".$i++] = '<span class="file_item_clean"'.$styles2.'>'.$params["subfolderlabel"].' </span>';
 
 
 
 
36
  $subfolders_item["line".$i++] = '<select class="file_item_clean"'.$styles3.' id="'.$selectsubdir.'" onchange="wfu_selectsubdir_check('.$sid.');">';
37
  if ( $params["testmode"] == "true" ) {
38
  $subfolders_item["line".$i++] = "\t".'<option>'.WFU_NOTIFY_TESTMODE.'</option>';
39
  }
40
  else {
41
  $zeroind = $i;
42
- $subfolders_item["line".$i++] = "\t".'<option>'.WFU_SUBDIR_SELECTDIR.'</option>';
43
  array_push($subfolder_paths, "");
 
 
 
 
 
 
44
  $subfolders = wfu_parse_folderlist($params["subfoldertree"]);
45
  if ( count($subfolders['path']) == 0 ) {
46
  array_push($subfolders['path'], "");
@@ -57,6 +70,7 @@ function wfu_prepare_subfolders_block($params, $widths, $heights) {
57
  if ( $default != -1 ) $subfolders_item["line".$zeroind] = "\t".'<option style="display:none;">'.WFU_SUBDIR_SELECTDIR.'</option>';
58
  }
59
  $subfolders_item["line".$i++] = '</select>';
 
60
  $subfolders_item["line".$i++] = '<input id="'.$defaultvalue.'" type="hidden" value="'.$default.'" />';
61
  }
62
 
4
  function wfu_prepare_subfolders_block($params, $widths, $heights) {
5
  $sid = $params["uploadid"];
6
  $selectsubdir = 'selectsubdir_'.$sid;
7
+ $editbox = 'selectsubdiredit_'.$sid;
8
  $defaultvalue = 'selectsubdirdefault_'.$sid;
9
  $hiddeninput = 'hiddeninput_'.$sid;
10
  $subfolders_item = null;
17
  if ( $heights["subfolders_label"] != "" ) $styles2 .= 'height: '.$heights["subfolders_label"].'; ';
18
  if ( $styles2 != "" ) $styles2 = ' style="'.$styles2.'"';
19
  $styles3 = "border: 1px solid; border-color: #BBBBBB;";
20
+ $styles4 = "";
21
+ if ( $widths["subfolders_select"] != "" ) $styles4 .= 'width: '.$widths["subfolders_select"].'; ';
22
+ if ( $heights["subfolders_select"] != "" ) $styles4 .= 'height: '.$heights["subfolders_select"].'; ';
23
+ $styles3 = ' style="'.$styles3.$styles4.'"';
24
+ if ( $styles4 != "" ) $styles4 = ' style="'.$styles4.'"';
25
  $subfolder_paths = array ( );
26
  $linebr = "";
27
  if ( $params["showtargetfolder"] == "true" || $params["askforsubfolders"] == "true" ) {
36
  }
37
  if ( $params["askforsubfolders"] == "true" ) {
38
  $subfolders_item["line".$i++] = '<span class="file_item_clean"'.$styles2.'>'.$params["subfolderlabel"].' </span>';
39
+ $subfolders_item["line".$i++] = '<div class="file_item_clean"'.$styles4.'>';
40
+ $subfolders_item["line".$i++] = '<div class="file_item_clean_inner"'.( substr($params["subfoldertree"], 0, 5) == "auto+" ? '' : ' style="display:none;"' ).'>';
41
+ $subfolders_item["line".$i++] = '<input type="text" id="'.$editbox.'" class="file_item_clean_empty" value="'.WFU_SUBDIR_TYPEDIR.'"'.( substr($params["subfoldertree"], 0, 5) == "auto+" ? '' : ' style="display:none;"' ).' onchange="wfu_selectsubdiredit_change('.$sid.');" onfocus="wfu_selectsubdiredit_enter('.$sid.');" onblur="wfu_selectsubdiredit_exit('.$sid.');" />';
42
+ $subfolders_item["line".$i++] = '</div>';
43
  $subfolders_item["line".$i++] = '<select class="file_item_clean"'.$styles3.' id="'.$selectsubdir.'" onchange="wfu_selectsubdir_check('.$sid.');">';
44
  if ( $params["testmode"] == "true" ) {
45
  $subfolders_item["line".$i++] = "\t".'<option>'.WFU_NOTIFY_TESTMODE.'</option>';
46
  }
47
  else {
48
  $zeroind = $i;
49
+ $subfolders_item["line".$i++] = "\t".'<option'.( substr($params["subfoldertree"], 0, 5) == "auto+" ? ' style="display:none;"' : '' ).'>'.WFU_SUBDIR_SELECTDIR.'</option>';
50
  array_push($subfolder_paths, "");
51
+ if ( substr($params["subfoldertree"], 0, 4) == "auto" ) {
52
+ $upload_directory = wfu_upload_plugin_full_path($params);
53
+ $dirtree = wfu_getTree($upload_directory);
54
+ foreach ( $dirtree as &$dir ) $dir = '*'.$dir;
55
+ $params["subfoldertree"] = implode(',', $dirtree);
56
+ }
57
  $subfolders = wfu_parse_folderlist($params["subfoldertree"]);
58
  if ( count($subfolders['path']) == 0 ) {
59
  array_push($subfolders['path'], "");
70
  if ( $default != -1 ) $subfolders_item["line".$zeroind] = "\t".'<option style="display:none;">'.WFU_SUBDIR_SELECTDIR.'</option>';
71
  }
72
  $subfolders_item["line".$i++] = '</select>';
73
+ $subfolders_item["line".$i++] = '</div>';
74
  $subfolders_item["line".$i++] = '<input id="'.$defaultvalue.'" type="hidden" value="'.$default.'" />';
75
  }
76
 
lib/wfu_constants.php CHANGED
@@ -111,6 +111,7 @@ DEFINE("WFU_WARNING_REDIRECT_NOTEXECUTED_FILESFAILED", __("Redirection not execu
111
  //define plugin messages
112
  DEFINE("WFU_NOTIFY_TESTMODE", __("Test Mode", "wordpress-file-upload"));
113
  DEFINE("WFU_SUBDIR_SELECTDIR", __("select dir...", "wordpress-file-upload"));
 
114
  DEFINE("WFU_SUCCESSMESSAGE_DETAILS", __('Upload path: %filepath%', 'wordpress-file-upload'));
115
  DEFINE("WFU_FAILMESSAGE_DETAILS", __('Failed upload path: %filepath%', 'wordpress-file-upload'));
116
  DEFINE("WFU_USERDATA_REQUIREDLABEL", __(' (required)', 'wordpress-file-upload'));
@@ -221,7 +222,8 @@ function wfu_set_javascript_constants() {
221
  "max_time_limit" => WFU_MAX_TIME_LIMIT,
222
  "response_url" => WFU_RESPONSE_URL,
223
  "ajax_url" => WFU_AJAX_URL,
224
- "wfu_pageexit_prompt" => WFU_PAGEEXIT_PROMPT
 
225
  );
226
  $consts_txt = "";
227
  foreach ( $consts as $key => $val )
111
  //define plugin messages
112
  DEFINE("WFU_NOTIFY_TESTMODE", __("Test Mode", "wordpress-file-upload"));
113
  DEFINE("WFU_SUBDIR_SELECTDIR", __("select dir...", "wordpress-file-upload"));
114
+ DEFINE("WFU_SUBDIR_TYPEDIR", __("type dir", "wordpress-file-upload"));
115
  DEFINE("WFU_SUCCESSMESSAGE_DETAILS", __('Upload path: %filepath%', 'wordpress-file-upload'));
116
  DEFINE("WFU_FAILMESSAGE_DETAILS", __('Failed upload path: %filepath%', 'wordpress-file-upload'));
117
  DEFINE("WFU_USERDATA_REQUIREDLABEL", __(' (required)', 'wordpress-file-upload'));
222
  "max_time_limit" => WFU_MAX_TIME_LIMIT,
223
  "response_url" => WFU_RESPONSE_URL,
224
  "ajax_url" => WFU_AJAX_URL,
225
+ "wfu_pageexit_prompt" => WFU_PAGEEXIT_PROMPT,
226
+ "wfu_subdir_typedir" => WFU_SUBDIR_TYPEDIR
227
  );
228
  $consts_txt = "";
229
  foreach ( $consts as $key => $val )
lib/wfu_functions.php CHANGED
@@ -76,6 +76,11 @@ function wfu_create_string($size) {
76
  return $str;
77
  }
78
 
 
 
 
 
 
79
  //********************* Array Functions ****************************************************************************************************
80
 
81
  function wfu_encode_array_to_string($arr) {
@@ -320,6 +325,11 @@ function wfu_basename($path) {
320
  return preg_replace('/.*(\\\\|\\/)/', '', $path);
321
  }
322
 
 
 
 
 
 
323
  function wfu_upload_plugin_full_path( $params ) {
324
  $path = $params["uploadpath"];
325
  if ( $params["accessmethod"]=='ftp' && $params["ftpinfo"] != '' && $params["useftpdomain"] == "true" ) {
@@ -386,12 +396,22 @@ function wfu_delTree($dir) {
386
  return rmdir($dir);
387
  }
388
 
 
 
 
 
 
 
 
 
 
389
  function wfu_parse_folderlist($subfoldertree) {
390
  $ret['path'] = array();
391
  $ret['label'] = array();
392
  $ret['level'] = array();
393
  $ret['default'] = array();
394
 
 
395
  $subfolders = explode(",", $subfoldertree);
396
  if ( count($subfolders) == 0 ) return $ret;
397
  if ( count($subfolders) == 1 && trim($subfolders[0]) == "" ) return $ret;
@@ -1109,11 +1129,13 @@ function wfu_send_notification_email($user, $only_filename_list, $target_path_li
1109
 
1110
  //********************* Media Functions ****************************************************************************************************
1111
 
1112
- // function wfu_process_media_insert contribution from Aaron Olin
1113
- function wfu_process_media_insert($file_path, $page_id){
 
1114
  $filetype = wp_check_filetype( wfu_basename( $file_path ), null );
1115
 
1116
  $attachment = array(
 
1117
  'post_mime_type' => $filetype['type'],
1118
  'post_title' => preg_replace( '/\.[^.]+$/', '', wfu_basename( $file_path ) ),
1119
  'post_content' => '',
76
  return $str;
77
  }
78
 
79
+ function wfu_html_output($output) {
80
+ $output = str_replace(array("\r\n", "\r", "\n"), "<br/>", $output);
81
+ return str_replace(array("\t", " "), "&nbsp;", $output);
82
+ }
83
+
84
  //********************* Array Functions ****************************************************************************************************
85
 
86
  function wfu_encode_array_to_string($arr) {
325
  return preg_replace('/.*(\\\\|\\/)/', '', $path);
326
  }
327
 
328
+ function wfu_basedir($path) {
329
+ if ( !$path || $path == "" ) return "";
330
+ return substr($path, 0, strlen($path) - strlen(wfu_basename($path)));
331
+ }
332
+
333
  function wfu_upload_plugin_full_path( $params ) {
334
  $path = $params["uploadpath"];
335
  if ( $params["accessmethod"]=='ftp' && $params["ftpinfo"] != '' && $params["useftpdomain"] == "true" ) {
396
  return rmdir($dir);
397
  }
398
 
399
+ function wfu_getTree($dir) {
400
+ $tree = array();
401
+ $files = array_diff(scandir($dir), array('.','..'));
402
+ foreach ($files as $file) {
403
+ if ( is_dir("$dir/$file") ) array_push($tree, $file);
404
+ }
405
+ return $tree;
406
+ }
407
+
408
  function wfu_parse_folderlist($subfoldertree) {
409
  $ret['path'] = array();
410
  $ret['label'] = array();
411
  $ret['level'] = array();
412
  $ret['default'] = array();
413
 
414
+ if ( substr($subfoldertree, 0, 4) == "auto" ) return $ret;
415
  $subfolders = explode(",", $subfoldertree);
416
  if ( count($subfolders) == 0 ) return $ret;
417
  if ( count($subfolders) == 1 && trim($subfolders[0]) == "" ) return $ret;
1129
 
1130
  //********************* Media Functions ****************************************************************************************************
1131
 
1132
+ // function wfu_process_media_insert contribution from Aaron Olin with some corrections regarding the upload path
1133
+ function wfu_process_media_insert($file_path, $page_id){
1134
+ $wp_upload_dir = wp_upload_dir();
1135
  $filetype = wp_check_filetype( wfu_basename( $file_path ), null );
1136
 
1137
  $attachment = array(
1138
+ 'guid' => $wp_upload_dir['url'] . '/' . wfu_basename( $file_path ),
1139
  'post_mime_type' => $filetype['type'],
1140
  'post_title' => preg_replace( '/\.[^.]+$/', '', wfu_basename( $file_path ) ),
1141
  'post_content' => '',
lib/wfu_processfiles.php CHANGED
@@ -106,9 +106,15 @@ function wfu_process_files($params, $method) {
106
  $params["uploadpath"] = preg_replace($search, $replace, $params["uploadpath"]);
107
 
108
  /* append subfolder name to upload path */
109
- if ( $params["askforsubfolders"] == "true" && $params['subdir_selection_index'] >= 1 ) {
110
- if ( substr($params["uploadpath"], -1, 1) == "/" ) $params["uploadpath"] .= $params['subfoldersarray'][$params['subdir_selection_index']];
111
- else $params["uploadpath"] .= '/'.$params['subfoldersarray'][$params['subdir_selection_index']];
 
 
 
 
 
 
112
  }
113
 
114
  if ( $files_count == 1 ) {
@@ -143,15 +149,16 @@ function wfu_process_files($params, $method) {
143
  if ( $only_check ) $upload_file_size = $fileprops['size'];
144
  else $upload_file_size = filesize($fileprops['tmp_name']);
145
  $upload_file_size_MB = $upload_file_size / 1024 / 1024;
 
 
 
146
 
147
  if ( $upload_file_size > 0 ) {
148
-
149
  /* Section to perform filter action wfu_before_file_check before file is checked in order to perform
150
  any filename or userdata modifications or reject the upload of the file by setting error_message item
151
  of $ret_data array to a non-empty value */
152
  $filter_error_message = '';
153
  if ( $file_unique_id != '' && !$filedata_previously_defined ) {
154
- $target_path = wfu_upload_plugin_full_path($params).$fileprops['name'];
155
  $changable_data['file_path'] = $target_path;
156
  $changable_data['user_data'] = $userdata_fields;
157
  $changable_data['error_message'] = $filter_error_message;
@@ -162,21 +169,23 @@ function wfu_process_files($params, $method) {
162
  $additional_data['user_id'] = $user->ID;
163
  $additional_data['page_id'] = $params["pageid"];
164
  $ret_data = apply_filters('wfu_before_file_check', $changable_data, $additional_data);
165
- $fileprops['name'] = str_replace(wfu_upload_plugin_full_path($params), '', $ret_data['file_path']);
 
166
  $userdata_fields = $ret_data['user_data'];
167
  $filter_error_message = $ret_data['error_message'];
168
  // if this is a file check, which means that a second pass of the file will follow, then we do not want to
169
  // apply the filters again, so we store the changable data to session variables for this specific file
170
  if ( $only_check ) {
171
  $_SESSION[$file_map]['file_unique_id'] = $file_unique_id;
172
- $_SESSION[$file_map]['filename'] = $fileprops['name'];
173
  $_SESSION[$file_map]['userdata'] = $userdata_fields;
174
  }
175
  }
176
  // if this is a second pass of the file, because a first pass with file checking was done before, then retrieve
177
  // file data that may have previously changed because of application of filters
178
  if ( $filedata_previously_defined ) {
179
- $fileprops['name'] = $_SESSION[$file_map]['filename'];
 
180
  $userdata_fields = $_SESSION[$file_map]['userdata'];
181
  }
182
  if ( $filter_error_message != '' ) {
@@ -186,23 +195,28 @@ function wfu_process_files($params, $method) {
186
  }
187
  else {
188
 
 
 
 
 
 
189
  /* Check if upload path exist */
190
- if ( is_dir( wfu_upload_plugin_full_path($params) ) ) {
191
  $upload_path_ok = true;
192
  }
193
  /* Attempt to create path if user has selected to do so */
194
  else if ( $params["createpath"] == "true" ) {
195
- $wfu_create_directory_ret = wfu_create_directory(wfu_upload_plugin_full_path($params), $params["accessmethod"], $params["ftpinfo"]);
196
  if ( $wfu_create_directory_ret != "" ) {
197
  $file_output['admin_messages'] = wfu_join_strings("<br />", $file_output['admin_messages'], $wfu_create_directory_ret);
198
  }
199
- if ( is_dir( wfu_upload_plugin_full_path($params) ) ) {
200
  $upload_path_ok = true;
201
  }
202
  }
203
 
204
- /* File name control, reject files with .php extension for security reasons */
205
- if ( strtolower(substr($fileprops['name'], -4)) != ".php" )
206
  foreach ($allowed_patterns as $allowed_pattern) {
207
  if ( wfu_upload_plugin_wildcard_match( $allowed_pattern, $fileprops['name']) ) {
208
  $allowed_file_ok = true;
@@ -263,16 +277,11 @@ function wfu_process_files($params, $method) {
263
 
264
  if ( is_uploaded_file($fileprops['tmp_name']) || $only_check ) {
265
  $source_path = $fileprops['tmp_name'];
266
- $target_path = wfu_upload_plugin_full_path($params).$only_filename;
267
 
268
  if ( $only_check || $ignore_server_actions ) $file_copied = true;
269
  else {
270
  $file_copied = false;
271
 
272
- $search = array ('/%filename%/', '/%filepath%/');
273
- $replace = array ($only_filename, $target_path);
274
- $success_message = preg_replace($search, $replace, $params["successmessage"]);
275
-
276
  if ($source_path) {
277
  $file_exists = file_exists($target_path);
278
  if ( !$file_exists || $params["dublicatespolicy"] == "" || $params["dublicatespolicy"] == "overwrite" ) {
@@ -310,7 +319,7 @@ function wfu_process_files($params, $method) {
310
  }
311
  }
312
  else if ( $file_exists && $params["dublicatespolicy"] == "maintain both" ) {
313
- $full_path = wfu_upload_plugin_full_path($params);
314
  $name_part = $only_filename;
315
  $ext_part = "";
316
  $dot_pos = strrpos($name_part, ".");
@@ -473,10 +482,6 @@ function wfu_process_files($params, $method) {
473
  $file_output['color'] = $color_array[0];
474
  $file_output['bgcolor'] = $color_array[1];
475
  $file_output['borcolor'] = $color_array[2];
476
- /* define variables that were not defined before due to error */
477
- if ( $params['forcefilename'] != "true" ) $only_filename = wfu_upload_plugin_clean( $fileprops['name'] );
478
- else $only_filename = $fileprops['name'];
479
- $target_path = wfu_upload_plugin_full_path($params).$only_filename;
480
  $replace = array ($user_login, ( $user_email == "" ? "no email" : $user_email ), $only_filename, $target_path);
481
  $file_output['header'] = preg_replace($search, $replace, $params['errormessage']);
482
  /* prepare and prepend details of failed file upload, visible only to administrator */
106
  $params["uploadpath"] = preg_replace($search, $replace, $params["uploadpath"]);
107
 
108
  /* append subfolder name to upload path */
109
+ if ( $params["askforsubfolders"] == "true" ) {
110
+ if ( $params["subfoldertree"] == "auto+" && $params['subdir_selection_index'] != '' ) {
111
+ if ( substr($params["uploadpath"], -1, 1) == "/" ) $params["uploadpath"] .= $params['subdir_selection_index'];
112
+ else $params["uploadpath"] .= '/'.$params['subdir_selection_index'];
113
+ }
114
+ elseif ( $params["subfoldertree"] != "auto+" && $params['subdir_selection_index'] >= 1 ) {
115
+ if ( substr($params["uploadpath"], -1, 1) == "/" ) $params["uploadpath"] .= $params['subfoldersarray'][$params['subdir_selection_index']];
116
+ else $params["uploadpath"] .= '/'.$params['subfoldersarray'][$params['subdir_selection_index']];
117
+ }
118
  }
119
 
120
  if ( $files_count == 1 ) {
149
  if ( $only_check ) $upload_file_size = $fileprops['size'];
150
  else $upload_file_size = filesize($fileprops['tmp_name']);
151
  $upload_file_size_MB = $upload_file_size / 1024 / 1024;
152
+
153
+ $only_filename = $fileprops['name'];
154
+ $target_path = wfu_upload_plugin_full_path($params).$only_filename;
155
 
156
  if ( $upload_file_size > 0 ) {
 
157
  /* Section to perform filter action wfu_before_file_check before file is checked in order to perform
158
  any filename or userdata modifications or reject the upload of the file by setting error_message item
159
  of $ret_data array to a non-empty value */
160
  $filter_error_message = '';
161
  if ( $file_unique_id != '' && !$filedata_previously_defined ) {
 
162
  $changable_data['file_path'] = $target_path;
163
  $changable_data['user_data'] = $userdata_fields;
164
  $changable_data['error_message'] = $filter_error_message;
169
  $additional_data['user_id'] = $user->ID;
170
  $additional_data['page_id'] = $params["pageid"];
171
  $ret_data = apply_filters('wfu_before_file_check', $changable_data, $additional_data);
172
+ $target_path = $ret_data['file_path'];
173
+ $fileprops['name'] = wfu_basename($target_path);
174
  $userdata_fields = $ret_data['user_data'];
175
  $filter_error_message = $ret_data['error_message'];
176
  // if this is a file check, which means that a second pass of the file will follow, then we do not want to
177
  // apply the filters again, so we store the changable data to session variables for this specific file
178
  if ( $only_check ) {
179
  $_SESSION[$file_map]['file_unique_id'] = $file_unique_id;
180
+ $_SESSION[$file_map]['filepath'] = $target_path;
181
  $_SESSION[$file_map]['userdata'] = $userdata_fields;
182
  }
183
  }
184
  // if this is a second pass of the file, because a first pass with file checking was done before, then retrieve
185
  // file data that may have previously changed because of application of filters
186
  if ( $filedata_previously_defined ) {
187
+ $target_path = $_SESSION[$file_map]['filepath'];
188
+ $fileprops['name'] = wfu_basename($target_path);
189
  $userdata_fields = $_SESSION[$file_map]['userdata'];
190
  }
191
  if ( $filter_error_message != '' ) {
195
  }
196
  else {
197
 
198
+ /* if medialink or postlink is activated then the target path becomes the current wordpress upload folder */
199
+ if ( $params["medialink"] == "true" || $params["postlink"] == "true" ) {
200
+ $mediapath = wp_upload_dir();
201
+ $target_path = $mediapath['path'].'/'.$fileprops['name'];
202
+ }
203
  /* Check if upload path exist */
204
+ if ( is_dir( wfu_basedir($target_path) ) ) {
205
  $upload_path_ok = true;
206
  }
207
  /* Attempt to create path if user has selected to do so */
208
  else if ( $params["createpath"] == "true" ) {
209
+ $wfu_create_directory_ret = wfu_create_directory(wfu_basedir($target_path), $params["accessmethod"], $params["ftpinfo"]);
210
  if ( $wfu_create_directory_ret != "" ) {
211
  $file_output['admin_messages'] = wfu_join_strings("<br />", $file_output['admin_messages'], $wfu_create_directory_ret);
212
  }
213
+ if ( is_dir( wfu_basedir($target_path) ) ) {
214
  $upload_path_ok = true;
215
  }
216
  }
217
 
218
+ /* File name control, reject files with .php and .js extension for security reasons */
219
+ if ( strtolower(substr($fileprops['name'], -4)) != ".php" && strtolower(substr($fileprops['name'], -3)) != ".js" )
220
  foreach ($allowed_patterns as $allowed_pattern) {
221
  if ( wfu_upload_plugin_wildcard_match( $allowed_pattern, $fileprops['name']) ) {
222
  $allowed_file_ok = true;
277
 
278
  if ( is_uploaded_file($fileprops['tmp_name']) || $only_check ) {
279
  $source_path = $fileprops['tmp_name'];
 
280
 
281
  if ( $only_check || $ignore_server_actions ) $file_copied = true;
282
  else {
283
  $file_copied = false;
284
 
 
 
 
 
285
  if ($source_path) {
286
  $file_exists = file_exists($target_path);
287
  if ( !$file_exists || $params["dublicatespolicy"] == "" || $params["dublicatespolicy"] == "overwrite" ) {
319
  }
320
  }
321
  else if ( $file_exists && $params["dublicatespolicy"] == "maintain both" ) {
322
+ $full_path = wfu_basedir($target_path);
323
  $name_part = $only_filename;
324
  $ext_part = "";
325
  $dot_pos = strrpos($name_part, ".");
482
  $file_output['color'] = $color_array[0];
483
  $file_output['bgcolor'] = $color_array[1];
484
  $file_output['borcolor'] = $color_array[2];
 
 
 
 
485
  $replace = array ($user_login, ( $user_email == "" ? "no email" : $user_email ), $only_filename, $target_path);
486
  $file_output['header'] = preg_replace($search, $replace, $params['errormessage']);
487
  /* prepare and prepend details of failed file upload, visible only to administrator */
readme.txt CHANGED
@@ -33,6 +33,7 @@ The characteristics of the plugin are:
33
  * It is highly customizable with many (more than 50) options.
34
  * It produces notification messages and e-mails.
35
  * You can create additional fields that the user must fill in along with the uploaded file.
 
36
  * It supports redirection to another url after successful upload.
37
  * It supports filters and actions before and after file upload, so that programmers can extend the plugin and make it cooperate with other plugins.
38
  * It contains a visual editor for customizing the plugin easily and without any knowledge of shortcodes or programming
@@ -116,6 +117,16 @@ In the free version the upload will fail. However in the Pro version the upload
116
 
117
  == Changelog ==
118
 
 
 
 
 
 
 
 
 
 
 
119
  = 2.7.0 =
120
  * corrected bug when deleting plugin instance from the Dashboard
121
  * corrected bug not finding "loading_icon.gif"
@@ -386,6 +397,9 @@ Initial version.
386
 
387
  == Upgrade Notice ==
388
 
 
 
 
389
  = 2.7.0 =
390
  Upgrade to address some minor bugs.
391
 
@@ -566,7 +580,7 @@ A detailed list of attributes, together with instructions is shown below:
566
  * **ftpfilepermissions:** Force the uploaded files to have specific permissions. This is a 4-digit octal number, e.g. 0777. If left empty, then the ftp server will define the permissions.. Default value is "".
567
  * **showtargetfolder:** This attribute defines if a message with the upload directory will be shown. Default value is "false".
568
  * **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.
569
- * **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".
570
  * **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".
571
  * **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".
572
 
33
  * It is highly customizable with many (more than 50) options.
34
  * It produces notification messages and e-mails.
35
  * You can create additional fields that the user must fill in along with the uploaded file.
36
+ * You can select from a list of subfolders.
37
  * It supports redirection to another url after successful upload.
38
  * It supports filters and actions before and after file upload, so that programmers can extend the plugin and make it cooperate with other plugins.
39
  * It contains a visual editor for customizing the plugin easily and without any knowledge of shortcodes or programming
117
 
118
  == Changelog ==
119
 
120
+ = 2.7.1 =
121
+ * fixed bug with faulty plugin instances appearring when Woocommerce plugin is also installed
122
+ * Upload of javascript (.js) files is not allowed for avoiding security issues
123
+ * fixed bug with medialink and postlink attributes that were not working correctly
124
+ * when medialink or postlink is activated, the files will be uploaded to the upload folder of WP website
125
+ * when medialink or postlink is activated, subfolders will be deactivated
126
+ * added option in subfolders to enable the list to populate automatically
127
+ * added option in subfolders the user to be able to type the subfolder
128
+ * wfu_before_file_check filter can modify the target path (not only the file name)
129
+
130
  = 2.7.0 =
131
  * corrected bug when deleting plugin instance from the Dashboard
132
  * corrected bug not finding "loading_icon.gif"
397
 
398
  == Upgrade Notice ==
399
 
400
+ = 2.7.1 =
401
+ Upgrade to add some new features and address some bugs.
402
+
403
  = 2.7.0 =
404
  Upgrade to address some minor bugs.
405
 
580
  * **ftpfilepermissions:** Force the uploaded files to have specific permissions. This is a 4-digit octal number, e.g. 0777. If left empty, then the ftp server will define the permissions.. Default value is "".
581
  * **showtargetfolder:** This attribute defines if a message with the upload directory will be shown. Default value is "false".
582
  * **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.
583
+ * **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". For defining a default value that will be preselected use the (&) symbol before the item name (but after the stars, e.g. \*\*&nested3.
584
  * **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".
585
  * **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".
586
 
release_notes.txt CHANGED
@@ -1 +1,3 @@
1
- <span>Professional version 2.6.0 of the plugin has introduced <strong>Google Recaptcha version 2</strong>. This is an easier and safer captcha, than the previously one used (Google Recaptcha version 1). Google Recaptcha version 2 is the default captcha selected, however you need to define </span><span style="text-decoration:underline;">site and secret keys</span><span> for your domain in the plugin's settings from </span><a href="https://www.google.com/recaptcha/admin">Google Recaptcha website</a><span>. To do this, you need to have a Google account. If you do not have a Google account, then you can use the alternative Google Recaptcha version 2 captcha, which does not require any keys or accounts, by setting </span><span style="background-color:rgb(220,255,220); font-style:italic; font-weight:bold;">captchatype="RecaptchaV2 (no account)"</span><span> in your shortcode. Please note that this feature may not work in all cases. For backward compatibility you can still use Google Recaptcha version 1 captcha, by setting <em>captchatype="RecaptchaV1"</em> in your shortcode.</span>
 
 
1
+ <span><strong>Latest release notes: </strong>PHP version info added in settings. In addition, subfolders feature has become more flexible and wfu_before_file_check filter can now modify the whole upload path (not only the filename).</span>
2
+ <!--
3
+ -->
wordpress_file_upload.php CHANGED
@@ -4,7 +4,7 @@ session_start();
4
  /*
5
  Plugin URI: http://www.iptanus.com/support/wordpress-file-upload
6
  Description: Simple interface to upload files from a page.
7
- Version: 2.7.0
8
  Author: Nickolas Bossinas
9
  Author URI: http://www.iptanus.com
10
  */
@@ -162,6 +162,9 @@ function wordpress_file_upload_function($incomingfromhandler) {
162
 
163
  }
164
  $params["userdata_fields"] = $userdata_fields;
 
 
 
165
 
166
  /* Prepare information about directory or selection of target subdirectory */
167
  $subfolders = wfu_prepare_subfolders_block($params, $widths, $heights);
@@ -265,9 +268,9 @@ function wordpress_file_upload_function($incomingfromhandler) {
265
  $wordpress_file_upload_output .= call_user_func_array("wfu_add_div", $section_array);
266
  }
267
 
268
- /* Pass constants to javascript and set page unload hook */
269
  $consts = wfu_set_javascript_constants();
270
- $handler = 'function() { wfu_Initialize_Consts("'.$consts.'"); wfu_install_unload_hook(); }';
271
  $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>';
272
  $wordpress_file_upload_output .= '</div>';
273
  // $wordpress_file_upload_output .= '<div>';
4
  /*
5
  Plugin URI: http://www.iptanus.com/support/wordpress-file-upload
6
  Description: Simple interface to upload files from a page.
7
+ Version: 2.7.1
8
  Author: Nickolas Bossinas
9
  Author URI: http://www.iptanus.com
10
  */
162
 
163
  }
164
  $params["userdata_fields"] = $userdata_fields;
165
+
166
+ /* If medialink or postlink is activated, then subfolders are deactivated */
167
+ if ( $params["medialink"] == "true" || $params["postlink"] == "true" ) $params["askforsubfolders"] = "false";
168
 
169
  /* Prepare information about directory or selection of target subdirectory */
170
  $subfolders = wfu_prepare_subfolders_block($params, $widths, $heights);
268
  $wordpress_file_upload_output .= call_user_func_array("wfu_add_div", $section_array);
269
  }
270
 
271
+ /* Pass constants to javascript and run plugin post-load actions */
272
  $consts = wfu_set_javascript_constants();
273
+ $handler = 'function() { wfu_Initialize_Consts("'.$consts.'"); wfu_plugin_load_action('.$sid.'); }';
274
  $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>';
275
  $wordpress_file_upload_output .= '</div>';
276
  // $wordpress_file_upload_output .= '<div>';