WordPress File Upload - Version 3.8.3

Version Description

  • fixed bug of subdirectory selector that was not initializing correctly after upload
  • fixed slight widget incompatibility with customiser
  • fixed bug of drag-n-drop feature that was not working when singlebutton operation was activated
Download this release

Release Info

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

Code changes from version 3.8.2 to 3.8.3

js/wordpress_file_upload_functions.js CHANGED
@@ -1,3 +1,3 @@
1
  function wfu_Initialize_Consts(e){if("undefined"==typeof GlobalData.consts){GlobalData.consts=new Object;for(var t=e.split(";"),a=0;a<t.length;a++)const_txt=t[a].split(":"),GlobalData.consts[wfu_plugin_decode_string(const_txt[0])]=wfu_plugin_decode_string(const_txt[1])}}function wfu_Load_Code_Connectors(e){"undefined"==typeof wfu_Code_Objects&&(wfu_Code_Objects={}),wfu_Code_Objects[e]=new wfu_Code_Object(e);for(var t=0;t<Code_Initializators.length;t++)wfu_Code_Objects[e].additem(Code_Initializators[t](e))}function wfu_Code_Object(e){this.sid=e,this.items=[],this._calc_prioritized_list=function(e){for(var t,a,s=[],n=[],i=[],l=0;l<this.items.length;l++)t=this.items[l],t[e]&&(a=-1,t.priority&&(a=t.priority),t[e].priority&&(a=t[e].priority),a>=0?(s.push(a),n.push(l)):i.push(l));for(var l=1;l<s.length;l++)for(var r=l;r<s.length;r++)if(s[r]<s[l-1]){var o=s[r];s[r]=s[l-1],s[l-1]=o;var o=n[r];n[r]=n[l-1],n[l-1]=o}return n.concat(i)},this.additem=function(e){this.items.push(e)},this.apply_filters=function(e,t){if("undefined"==typeof t)return null;var a=this._calc_prioritized_list(e);if(0==a.length)return t;for(var s=0;s<a.length;s++){var n=this.items[a[s]],i=null;"function"==typeof n[e]?i=n[e]:"function"==typeof n[e].func&&(i=n[e].func),null!=i&&(t=i.apply(this,Array.prototype.slice.call(arguments,1)),arguments[1]=t)}return t},this.do_action=function(e){var t=this._calc_prioritized_list(e);if(0!=t.length)for(var a=0;a<t.length;a++){var s=this.items[t[a]],n=null;"function"==typeof s[e]?n=s[e]:"function"==typeof s[e].func&&(n=s[e].func),null!=n&&n.apply(this,Array.prototype.slice.call(arguments,1))}}}function wfu_plugin_load_action(e){wfu_install_unload_hook();var t=document.getElementById("selectsubdiredit_"+e);t&&"none"!=t.style.display&&wfu_attach_element_handlers(t,new Function("wfu_selectsubdiredit_change("+e+");"))}function wfu_install_unload_hook(){window.onbeforeunload=wfu_unload_hook}function wfu_unload_hook(){return""!=GlobalData.UploadInProgressString&&""!=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 t=null;try{var t=new FormData}catch(a){}wfu_BrowserCaps.supportsHTML5=null!=t;var a=document.createElement("iframe");wfu_BrowserCaps.supportsIFRAME=null!=a,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,t="animation",a="",s="Webkit Moz O ms Khtml".split(" "),n="",i=document.createElement("DIV");if(i.style.animationName&&(e=!0),e===!1)for(var l=0;l<s.length;l++)if(void 0!==i.style[s[l]+"AnimationName"]){n=s[l],t=n+"Animation",a="-"+n.toLowerCase()+"-",e=!0;break}return e}function wfu_join_strings(e){for(var t=[].slice.call(arguments),a="",s="",n=1;n<t.length;n++)s=""==a||""==t[n]?"":e,a+=s+t[n];return a}function wfu_plugin_decode_string(e){for(var t,a,s=0,n="";s<e.length;)t=parseInt(e.substr(s,2),16),a=128>t?t:224>t?((31&t)<<6)+(63&parseInt(e.substr(s+=2,2),16)):((15&t)<<12)+((63&parseInt(e.substr(s+=2,2),16))<<6)+(63&parseInt(e.substr(s+=2,2),16)),n+=String.fromCharCode(a),s+=2;return n}function wfu_plugin_encode_string(e){var t=0,a="",s="";for(t=0;t<e.length;t++)num=e.charCodeAt(t),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),a+=s;return a}function wfu_randomString(e){for(var t="0123456789ABCDEFGHIJKLMNOPQRSTUVWXTZabcdefghiklmnopqrstuvwxyz",a=e,s="",n=0;a>n;n++){var i=Math.floor(Math.random()*t.length);s+=t.substring(i,i+1)}return s}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_element_handlers(e,t){for(var a=["DOMAttrModified","textInput","input","change","keypress","paste","focus","propertychange"],s=0;s<a.length;s++)wfu_addEventHandler(e,a[s],t)}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_filedetails_showhide(e,t,a){var s=(document.getElementById("wfu_messageblock_arrow_"+e+"_"+t),document.getElementById("wfu_messageblock_arrow_"+e+"_up_"+t)),n=document.getElementById("wfu_messageblock_arrow_"+e+"_down_"+t),i=document.getElementById("wfu_messageblock_subheader_"+e+"_"+t),l=document.getElementById("wfu_messageblock_header_"+e+"_state_"+t);a?(s.style.display="",n.style.display="none",i.style.display="",l.value=""):(s.style.display="none",n.style.display="",i.style.display="none",l.value="none")}function wfu_get_file_ids(e){for(var t=(document.getElementById("wfu_messageblock_"+e),document.getElementById("wfu_messageblock_subheader_"+e).nextSibling),a="wfu_messageblock_"+e+"_",s=[];null!=t;)1===t.nodeType&&t.id.substr(0,a.length)==a&&s.push(t.id.substr(t.id.lastIndexOf("_")+1)),t=t.nextSibling;return s}function wfu_get_filelist(e,t){t="undefined"!=typeof t?t:!0;var a=document.getElementById("upfile_"+e),s=a.files;return s||(s=a.value?[{name:a.value}]:[]),t&&"undefined"!=typeof a.filearray&&(s=a.filearray),s}function wfu_add_files(e,t){var a=document.getElementById("upfile_"+e);"undefined"==typeof a.filearray&&(a.filearray=Array(),a.filearrayprops=Array()),document.getElementById("uploadform_"+e).reset(),a.filearray.length=a.filearrayprops.length=0;for(var s=0;s<t.length;s++)a.filearray.push(t[s].file),a.filearrayprops.push(t[s].props)}function wfu_filedetails_toggle(e,t){var a=(document.getElementById("wfu_messageblock_arrow_"+e+"_"+t),document.getElementById("wfu_messageblock_arrow_"+e+"_up_"+t));wfu_filedetails_showhide(e,t,"none"==a.style.display)}function wfu_headerdetails_showhide(e,t){var a=(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),i=document.getElementById("wfu_messageblock_subheader_"+e+"_message"),l=document.getElementById("wfu_messageblock_subheader_"+e+"_adminmessage"),r=document.getElementById("wfu_messageblock_header_"+e+"_state"),o=wfu_get_file_ids(e);if(t){a.style.display="",s.style.display="none",("none"!=i.style.display||"none"!=l.style.display)&&(n.style.display=""),r.value="";for(var _=0;_<o.length;_++)document.getElementById("wfu_messageblock_"+e+"_"+o[_]).style.display="",document.getElementById("wfu_messageblock_subheader_"+e+"_"+o[_]).style.display=document.getElementById("wfu_messageblock_header_"+e+"_state_"+o[_]).value}else{a.style.display="none",s.style.display="",n.style.display="none",r.value="none";for(var _=0;_<o.length;_++)document.getElementById("wfu_messageblock_"+e+"_"+o[_]).style.display="none",document.getElementById("wfu_messageblock_subheader_"+e+"_"+o[_]).style.display="none"}}function wfu_headerdetails_toggle(e){var t=(document.getElementById("wfu_messageblock_arrow_"+e),document.getElementById("wfu_messageblock_arrow_"+e+"_up"));wfu_headerdetails_showhide(e,"none"==t.style.display)}function wfu_attach_cancel_event(e,t,a,s){var n=document.getElementById("fileName_"+e);n&&(n.onkeyup=function(i){if(27==i.keyCode&&GlobalData[e]&&0!=GlobalData[e].xhrs.length){var l=confirm(GlobalData.consts.cancel_upload_prompt);if(1==l){for(var r=wfu_get_filelist(e),o=[],_=[],d=0;d<r.length;d++)o.push(null),_.push(r[d].name);for(var d=0;d<GlobalData[e].xhrs.length;d++){var u=GlobalData[e].xhrs[d].file_id-1;u>=0&&null==o[u]&&(o[u]=GlobalData[e].xhrs[d])}"true"==s.debugmode&&console.log("upload cancelled!");for(var d=0;d<o.length;d++)if(null==o[d]&&(o[d]=wfu_GetHttpRequestObject(),null!=o[d]&&wfu_initialize_fileupload_xhr(o[d],e,t,a,s,d,_[d])),-1!=o[d]){var c={target:{responseText:"force_cancel_code",shortcode_id:e}};wfu_uploadComplete.call(o[d],c)}n.onkeyup=null}}})}function wfu_dettach_cancel_event(e){var t=document.getElementById("fileName_"+e);t&&(t.onkeyup=null)}function wfu_selectbutton_changed(e,t){wfu_BrowserCaps.supportsAJAX&&wfu_BrowserCaps.supportsHTML5||(t=0);var a=document.getElementById("upfile_"+e),s=wfu_get_filelist(e,!1);if(1==t){"undefined"==typeof a.filearray&&(a.filearray=Array());for(var n=0;n<s.length;n++)a.filearray.push(s[n])}else"undefined"!=typeof a.filearray&&delete a.filearray;wfu_update_filename_text(e)}function wfu_selectbutton_clicked(e){var t=document.getElementById("wordpress_file_upload_message_"+e);t&&(t.style.display="none"),wfu_reset_message(e),document.getElementById("upfile_"+e).value="";var a=document.getElementById("fileName_"+e);a&&(a.value="",a.className="file_input_textbox")}function wfu_update_uploadbutton_status(e){var t=document.getElementById("upload_"+e);if(t){var a=wfu_get_filelist(e),s=a.length>0;s=wfu_Code_Objects[e].apply_filters("uploadbutton_status",s),t.disabled=!s}}function wfu_update_filename_text(e){var t=document.getElementById("fileName_"+e);if(t){for(var a=wfu_get_filelist(e),s="",n=0;n<a.length;n++)""!=s&&(s+=", "),s+=a[n].name.replace(/c:\\fakepath\\/i,"");t.value=s}}function wfu_selectsubdir_check(e){var t=document.getElementById("selectsubdir_"+e);if(!t)return!0;var a=document.getElementById("selectsubdiredit_"+e),s="none"!=a.style.display;return s&&t.selectedIndex>0&&(a.value=t.value.replace(/^\s+/,""),a.className="file_item_clean_match subfolder_autoplus_match",wfu_selectsubdiredit_change(e)),s?document.getElementById("hiddeninput_"+e).value=a.value:document.getElementById("hiddeninput_"+e).value=t.selectedIndex,!s&&0==t.selectedIndex||s&&(""==a.value||"file_item_clean_empty subfolder_autoplus_empty"==a.className)?(s?(t.className="subfolder_autoplus_dropdown_prompt",a.value="",GlobalData.FreeChangeHandler=!0,a.className="file_item_clean_prompt subfolder_autoplus_prompt",GlobalData.FreeChangeHandler=!1):t.className="file_item_clean_prompt subfolder_dropdown_prompt",!1):(s?t.className="subfolder_autoplus_dropdown":t.className="file_item_clean subfolder_dropdown",s&&"file_item_clean_prompt subfolder_autoplus_prompt"==a.className&&(a.className="file_item_clean subfolder_autoplus"),t.options[0].style.display="none",!0)}function wfu_selectsubdiredit_enter(e){var t=document.getElementById("selectsubdir_"+e),a=document.getElementById("selectsubdiredit_"+e);"file_item_clean_empty subfolder_autoplus_empty"==a.className&&(a.value=""),t.className="subfolder_autoplus_dropdown",a.className="file_item_clean subfolder_autoplus"}function wfu_selectsubdiredit_exit(e){var t=document.getElementById("selectsubdiredit_"+e);""==t.value&&(t.value=GlobalData.consts.wfu_subdir_typedir,t.className="file_item_clean_empty subfolder_autoplus_empty")}function wfu_selectsubdiredit_change(e){if(!GlobalData.FreeChangeHandler){var t=document.getElementById("selectsubdir_"+e),a=document.getElementById("selectsubdiredit_"+e);if("none"!=a.style.display){if("file_item_clean_empty subfolder_autoplus_empty"==a.className)return t.selectedIndex=0,void(document.getElementById("hiddeninput_"+e).value="");document.getElementById("hiddeninput_"+e).value=a.value;for(var s,n=!1,i=1;i<t.options.length;i++)s=t.options[i].value.replace(/^\s+/,"").toLowerCase(),a.value.length>=3?s.substr(0,a.value.length)==a.value.toLowerCase()?t.options[i].style.display="block":t.options[i].style.display="none":t.options[i].style.display="block",t.options[i].value.replace(/^\s+/,"")==a.value&&(t.selectedIndex=i,a.className="file_item_clean_match subfolder_autoplus_match",n=!0);n||(t.selectedIndex=0,a.className="file_item_clean subfolder_autoplus")}}}function wfu_selectsubdir_disable_onoff(e,t){var a=document.getElementById("selectsubdir_"+e);if(!a)return!0;var s=document.getElementById("selectsubdiredit_"+e),n="none"!=s.style.display;a.disabled=t,n&&(s.disabled=t)}function wfu_userdata_focused(e){var t=document.getElementById(e.id.replace("_field_","_fieldwrapper_"));if("file_userdata_fieldwrapper_required_empty"==t.className){t.className="file_userdata_fieldwrapper_required";var a=document.getElementById(e.id.replace("_field_","_hint_"));a.style.display="none"}}function wfu_Redirect(e){window.location=e}function wfu_loadStart(e){}function wfu_uploadProgress(e,t,a,s){s&&"undefined"==typeof this.xhr&&(console.log("total="+e.total+", loaded="+e.loaded),console.log(e));var n=GlobalData[t].xhrs[a],i=0,l=0,r=document.getElementById("progressbar_"+t+"_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 o=0;o<GlobalData[t].xhrs.length;o++)GlobalData[t].xhrs[o].file_id==n.file_id&&(GlobalData[t].xhrs[o].totalsize+=l)}if(r){for(var _=0,d=0,u=[],o=0;o<GlobalData[t].xhrs.length;o++)u[GlobalData[t].xhrs[o].file_id]=0;for(var o=0;o<GlobalData[t].xhrs.length;o++)u[GlobalData[t].xhrs[o].file_id]=Math.max(GlobalData[t].xhrs[o].totalsize,u[GlobalData[t].xhrs[o].file_id]);for(var o=0;o<u.length;o++)"undefined"!=typeof u[o]&&(_+=u[o]);for(var o=0;o<GlobalData[t].xhrs.length;o++)d+=GlobalData[t].xhrs[o].sizeloaded;i=Math.round(100*d/_),r.style.width=i.toString()+"%"}}else r&&(r.style.width="0%")}function wfu_notify_WPFilebase(e,t){var a=wfu_GetHttpRequestObject();if(null==a){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="+t,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]=t;for(var i="",s=0;s<params.length;s++)i+=(s>0?"&":"")+params[s][0]+"="+encodeURI(params[s][1]);a.open("POST",n,!0),a.setRequestHeader("Content-type","application/x-www-form-urlencoded"),a.onreadystatechange=function(){},a.send(i)}function wfu_send_email_notification(e,t,a,s,n,i,l,r,o){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]=a,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]=i,params[5]=new Array(2),params[5][0]="attachment_list",params[5][1]=l,params[6]=new Array(2),params[6][0]="uniqueuploadid_"+e,params[6][1]=t;for(var c=0;u>c;c++)params[7+c]=new Array(2),params[7+c][0]="userdata_"+c,params[7+c][1]=wfu_plugin_encode_string(document.getElementById("hiddeninput_"+e+"_userdata_"+c).value);for(var m="",c=0;c<params.length;c++)m+=(c>0?"&":"")+params[c][0]+"="+encodeURI(params[c][1]);wfu_initialize_fileupload_xhr(_,e,s,t,{params_index:a,debugmode:r,is_admin:o,fail_colors:GlobalData.consts.fail_colors,error_header:""},-1,""),_.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(m)}}function wfu_format_debug_data(e,t){return output='<label class="file_messageblock_subheader_debugmessage_label">',output+="Debug Data"+t,output+="</label>",output+='<div class="file_messageblock_subheader_debugmessage_container">',output+=e,output+="</div>",output}function wfu_uploadComplete(e){var t=new Date,a=this.shortcode_id,s=(this.file_id,!1),n="",i="",l="",r="unknown",o="",_="",d="wfu_fileupload_success:";this.loading=!1,this.end_time=t.getTime();var u=e.target.responseText,c=u,m="error";if(-1!=u&&(u.indexOf("force_errorabort_code")>-1&&(m="errorabort",u=u.replace("force_errorabort_code","")),u.indexOf("force_cancel_code")>-1&&(m="errorcancel",u=u.replace("force_cancel_code",""))),-1!=u){var f=u.indexOf(d);if(f>-1&&("true"==this.debugmode&&(_=u.substr(0,f)),c=u.substr(f+d.length),f=c.indexOf(":"),n=c.substr(0,f),c=c.substr(f+1),f=c.indexOf(":"),l=c.substr(0,f),i=c.substr(f+1)),""!=_){var p="";"fileupload"==this.requesttype?p=" - File: "+this.file_id:"email"==this.requesttype&&(p=" - Email Notification"),_=wfu_format_debug_data(_,p)}if(""!=l){var w=l.split(";");if(1==parseInt(w[2])){var b=w[3].split(",");r=wfu_plugin_decode_string(b[0]),o=b[4]}}}if(""==i||""==l){var g=this.fail_colors.split(","),y=wfu_Initialize_Params();y.general.shortcode_id=a,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,"errorcancel"!=m?(y.general.fail_message=GlobalData.consts.message_unknown,y.general.fail_admin_message=wfu_join_strings("<br />",this.error_adminmessage_unknown,this.requesttype+":"+c)):(y.general.fail_message=GlobalData.consts.file_cancelled,y.general.fail_admin_message=""),y.general.files_count>0?(y[0]={},y[0].color=g[0],y[0].bgcolor=g[1],y[0].borcolor=g[2],y[0].message_type=m,r=m,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&&t.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=""==i||""==l?wfu_ProcessUploadComplete(a,this.file_id,y,this.unique_id,this.params_index,this.session_token,"",[this.debugmode,_,this.is_admin],this.requesttype,""):wfu_ProcessUploadComplete(a,this.file_id,i,this.unique_id,this.params_index,this.session_token,l,[this.debugmode,_,this.is_admin],this.requesttype,n),s&&(wfu_dettach_cancel_event(a),wfu_unlock_upload(a),wfu_hide_simple_progressbar(a),wfu_clear(a)),e.target.return_status?r:void 0}function wfu_ProcessUploadComplete(sid,file_id,upload_params,unique_id,params_index,session_token,safe_output,debug_data,request_type,js_script_enc){if(sid&&!(0>sid)&&null!=upload_params&&""!=upload_params&&""!=unique_id&&("no-ajax"==unique_id||GlobalData[sid])){var do_redirect=!1;if("string"==typeof upload_params){upload_params=wfu_plugin_decode_string(upload_params.replace(/^\s+|\s+$/g,""));var Params=null;try{Params=JSON.parse(upload_params)}catch(e){}if(null==Params){var safe_parts=safe_output.split(";");Params=wfu_Initialize_Params(),Params.general.shortcode_id=sid,Params.general.unique_id=unique_id,Params.general.state=safe_parts[0],4==Params.general.state&&Params.general.state++;var default_colors=safe_parts[1].split(","),filedata="",error_jsonparse_filemessage=GlobalData.consts.jsonparse_filemessage,error_jsonparse_message=GlobalData.consts.jsonparse_message,error_jsonparse_adminmessage=GlobalData.consts.jsonparse_adminmessage;Params.general.files_count=parseInt(safe_parts[2]);for(var i=0;i<Params.general.files_count;i++)Params[i]={},Params[i].color=default_colors[0],Params[i].bgcolor=default_colors[1],Params[i].borcolor=default_colors[2],filedata=safe_parts[i+3].split(","),Params[i].message_type=wfu_plugin_decode_string(filedata[0]),Params[i].header=wfu_plugin_decode_string(filedata[1]),"success"==Params[i].message_type&&(Params[i].header+=error_jsonparse_filemessage,Params[i].message_type="warning"),Params[i].message=wfu_join_strings("<br />",error_jsonparse_message,wfu_plugin_decode_string(filedata[2])),Params[i].admin_messages=wfu_join_strings("<br />",error_jsonparse_adminmessage,wfu_plugin_decode_string(filedata[3]))}}else{if("object"!=typeof upload_params)return;var Params=upload_params}for(i=0;Params[i];)Params[i].message_type&&"error"==Params[i].message_type.substr(0,5)&&(Params[i].message_type=Params[i].message_type.substr(0,5)),i++;var message_table=document.getElementById("wfu_messageblock_"+sid),UploadStates_Ok=!0;if(!UploadStates[sid]&&message_table){var upload_states=document.getElementById("wfu_messageblock_header_"+sid+"_states").value;upload_states=wfu_plugin_decode_string(upload_states.replace(/^\s+|\s+$/g,"")),UploadStates[sid]=null;try{UploadStates[sid]=JSON.parse(upload_states)}catch(e){}null==UploadStates[sid]&&(UploadStates_Ok=!1)}GlobalData[sid]||(GlobalData[sid]=Object());var G=GlobalData[sid];if("no-ajax"==unique_id)G.last=!1,G.unique_id="",G.files_count=Params.general.files_count,0==Params.general.state&&(Params.general.files_count=0),G.files_processed=Params.general.files_count,UploadStates_Ok?G.upload_state=Params.general.state:G.upload_state=10,G.message=Params.general.message,G.update_wpfilebase=Params.general.update_wpfilebase,G.redirect_link=Params.general.redirect_link,G.notify_only_filename_list="",G.notify_target_path_list="",G.notify_attachment_list="",G.admin_messages={},G.admin_messages.wpfilebase=Params.general.admin_messages.wpfilebase,G.admin_messages.notify=Params.general.admin_messages.notify,G.admin_messages.redirect=Params.general.admin_messages.redirect,G.admin_messages.debug=debug_data[1],G.admin_messages.other=Params.general.admin_messages.other,G.errors={},G.errors.wpfilebase=Params.general.errors.wpfilebase,G.errors.notify=Params.general.errors.notify,G.errors.redirect=Params.general.errors.redirect,G.current_size=0,G.total_size=0;else{if(""==G.unique_id||G.unique_id!=unique_id||G.unique_id!=Params.general.unique_id)return;if(G.last)return;0==Params.general.files_count&&Params[0]&&"error"==Params[0].message_type&&(Params.general.files_count=1);for(var file_status="",i=0;i<Params.general.files_count;i++)file_status="error"==Params[i].message_type&&0==G.files_processed?"error1":"error"==Params[i].message_type&&G.files_processed>0?"error2":Params[i].message_type,G.upload_state=GlobalData.filestatematch[file_status][G.upload_state];UploadStates_Ok||(G.upload_state=10),G.files_processed+=Params.general.files_count,G.message=wfu_join_strings("<br />",G.message,Params.general.message),""==G.update_wpfilebase&&(G.update_wpfilebase=Params.general.update_wpfilebase),(!request_type||request_type&&"email"!=request_type)&&(G.redirect_link=Params.general.redirect_link),G.notify_only_filename_list=wfu_join_strings(", ",G.notify_only_filename_list,Params.general.notify_only_filename_list),G.notify_target_path_list=wfu_join_strings(", ",G.notify_target_path_list,Params.general.notify_target_path_list),G.notify_attachment_list=wfu_join_strings(",",G.notify_attachment_list,Params.general.notify_attachment_list),G.admin_messages.debug=wfu_join_strings("<br />",G.admin_messages.debug,debug_data[1]),G.admin_messages.other=wfu_join_strings("<br />",G.admin_messages.other,Params.general.admin_messages.other),""==G.admin_messages.wpfilebase&&(G.admin_messages.wpfilebase=Params.general.admin_messages.wpfilebase),""==G.admin_messages.notify&&(G.admin_messages.notify=Params.general.admin_messages.notify),""==G.admin_messages.redirect&&(G.admin_messages.redirect=Params.general.admin_messages.redirect),""==G.errors.wpfilebase&&(G.errors.wpfilebase=Params.general.errors.wpfilebase),""==G.errors.notify&&(G.errors.notify=Params.general.errors.notify),""==G.errors.redirect&&(G.errors.redirect=Params.general.errors.redirect)}G.files_processed==G.files_count&&(G.last=!0,""!=G.update_wpfilebase&&(G.admin_messages.wpfilebase="",wfu_notify_WPFilebase(params_index,session_token)),""!=G.notify_only_filename_list&&(G.admin_messages.notify="",wfu_send_email_notification(sid,unique_id,params_index,session_token,G.notify_only_filename_list,G.notify_target_path_list,G.notify_attachment_list,debug_data[0],debug_data[2]),G.last=!1,G.notify_only_filename_list=""),G.last&&("no-ajax"!=unique_id&&wfu_notify_server_upload_ended(sid,unique_id,params_index,session_token),GlobalData.UploadInProgressString=GlobalData.UploadInProgressString.replace(new RegExp("\\["+unique_id+"\\]","g"),"")),""!=G.errors.redirect&&(G.redirect_link=""),""!=G.redirect_link&&G.last&&""==GlobalData.UploadInProgressString.trim()&&(G.upload_state=11,do_redirect=!0));var nonadmin_message=G.message,admin_message=wfu_join_strings("<br />",G.admin_messages.other,G.admin_messages.wpfilebase,G.admin_messages.notify,G.admin_messages.redirect,G.admin_messages.debug);if(!UploadStates_Ok){var error_jsonparse_headermessage=GlobalData.consts.jsonparse_headermessage,error_jsonparse_headeradminmessage=GlobalData.consts.jsonparse_headeradminmessage;nonadmin_message=wfu_join_strings("<br />",error_jsonparse_headermessage,nonadmin_message),admin_message=wfu_join_strings("<br />",error_jsonparse_headeradminmessage,admin_message)}if(G.last){0==G.files_count&&12!=G.upload_state?G.upload_state=8:G.upload_state<4&&(G.upload_state+=4);var admin_messages_exist=""!=G.admin_messages.wpfilebase||""!=G.admin_messages.notify||""!=G.admin_messages.redirect||""!=G.admin_messages.other;4==G.upload_state&&""!=admin_message?G.upload_state++:5==G.upload_state&&""==!admin_message&&""==nonadmin_message&&G.upload_state--}if(message_table){var subheader_state=document.getElementById("wfu_messageblock_header_"+sid+"_state"),single_file_shown=1==G.files_count&&""==nonadmin_message&&""==admin_message&&G.last&&!do_redirect;if(single_file_shown)document.getElementById("wfu_messageblock_header_"+sid).style.display="none";else{document.getElementById("wfu_messageblock_header_"+sid).style.display="";var header_container=document.getElementById("wfu_messageblock_header_"+sid+"_container");if(UploadStates_Ok){var suffix="";1!=G.files_count||5!=G.upload_state&&7!=G.upload_state||(suffix="_singlefile"),header_container.innerHTML=UploadStates[sid]["State"+G.upload_state+suffix]}else{header_container.innerHTML="";var safe_container=document.getElementById("wfu_messageblock_header_"+sid+"_safecontainer");header_container.innerHTML=safe_container.innerHTML.replace(/_safe/g,"")}var subheader_show=!1;""!=nonadmin_message?(document.getElementById("wfu_messageblock_subheader_"+sid+"_message").style.display="",document.getElementById("wfu_messageblock_subheader_"+sid+"_messagelabel").innerHTML=nonadmin_message,subheader_show=!0):document.getElementById("wfu_messageblock_subheader_"+sid+"_message").style.display="none",""!=admin_message?(document.getElementById("wfu_messageblock_subheader_"+sid+"_adminmessage").style.display="",document.getElementById("wfu_messageblock_subheader_"+sid+"_adminmessagelabel").innerHTML=admin_message,subheader_show=!0):document.getElementById("wfu_messageblock_subheader_"+sid+"_adminmessage").style.display="none",subheader_show?document.getElementById("wfu_messageblock_subheader_"+sid).style.display=subheader_state.value:document.getElementById("wfu_messageblock_subheader_"+sid).style.display="none",subheader_show||G.files_processed>0?(header_container.colSpan=2,document.getElementById("wfu_messageblock_arrow_"+sid).style.display=""):(document.getElementById("wfu_messageblock_arrow_"+sid).style.display="none",header_container.colSpan=3)}for(var next_block=document.getElementById("wfu_messageblock_subheader_"+sid),next_block_id=0,file_block=null,file_template_container=document.getElementById("wfu_messageblock_"+sid+"_filetemplate"),file_contents="",door=document.getElementById("wfu_messageblock_"+sid+"_door"),ii=0,headerspan=1,subheaderspan=2,file_template=wfu_plugin_decode_string(file_template_container.value.replace(/^\s+|\s+$/g,"")),i=0;i<Params.general.files_count;i++){for(ii=i+file_id,file_contents=file_template.replace(/\[file_id\]/g,ii),file_contents=file_contents.replace(/\[filenumber_display\]/g,""),file_contents=file_contents.replace(/\[fileheader_color\]/g,Params[i].color),file_contents=file_contents.replace(/\[fileheader_bgcolor\]/g,Params[i].bgcolor),file_contents=file_contents.replace(/\[fileheader_borcolor\]/g,Params[i].borcolor),file_contents=file_contents.replace(/\[fileheader_message\]/g,Params[i].header),file_contents=file_contents.replace(/\[filesubheadermessage_display\]/g,'style="display:none;"'),file_contents=file_contents.replace(/\[filesubheader_message\]/g,Params[i].message),file_contents=file_contents.replace(/\[filesubheaderadminmessage_display\]/g,'style="display:none;"'),file_contents=file_contents.replace(/\[filesubheader_adminmessage\]/g,Params[i].admin_messages),file_contents="<table><tbody>"+file_contents+"</tbody></table>",door.innerHTML=file_contents,headerspan=1,subheaderspan=2,subheader_show=!1,file_block=document.getElementById("wfu_messageblock_"+sid+"_"+ii),1==G.files_count?(document.getElementById("wfu_messageblock_"+sid+"_filenumber_"+ii).style.display="none",document.getElementById("wfu_messageblock_subheader_"+sid+"_fileempty_"+ii).style.display="none",single_file_shown?file_block.style.display="":file_block.style.display=subheader_state.value,headerspan++,subheaderspan++):file_block.style.display=subheader_state.value,""!=Params[i].message&&(document.getElementById("wfu_messageblock_subheader_"+sid+"_message_"+ii).style.display="",subheader_show=!0),""!=Params[i].admin_messages&&(document.getElementById("wfu_messageblock_subheader_"+sid+"_adminmessage_"+ii).style.display="",subheader_show=!0),subheader_show||(document.getElementById("wfu_messageblock_arrow_"+sid+"_"+ii).style.display="none",headerspan++),document.getElementById("wfu_messageblock_header_"+sid+"_container_"+ii).colSpan=headerspan,document.getElementById("wfu_messageblock_subheader_"+sid+"_container_"+ii).colSpan=subheaderspan;ii>next_block_id&&(next_block=next_block.nextSibling,null!=next_block);)1===next_block.nodeType&&(next_block_id=next_block.id.substr(next_block.id.lastIndexOf("_")+1));message_table.tBodies[0].insertBefore(file_block,next_block),next_block=file_block.nextSibling,file_block=document.getElementById("wfu_messageblock_subheader_"+sid+"_"+ii),message_table.tBodies[0].insertBefore(file_block,next_block),next_block=file_block,next_block_id=ii}single_file_shown&&(document.getElementById("wfu_messageblock_"+sid+"_1").style.display=""),message_table.style.display="",document.getElementById("wordpress_file_upload_message_"+sid).style.display=""}return js_script_enc&&eval(wfu_plugin_decode_string(js_script_enc)),do_redirect&&wfu_Redirect(G.redirect_link),G.last}}function wfu_uploadFailed(e,t){t&&(console.log("failure report following"),console.log(e));var a=e.target,s={target:{responseText:"",shortcode_id:a.shortcode_id}};wfu_uploadComplete.call(a,s)}function wfu_uploadCanceled(e){}function wfu_notify_server_upload_ended(e,t,a,s){var n=wfu_GetHttpRequestObject();if(null!=n){var i=GlobalData.consts.ajax_url;params=new Array(6),params[0]=new Array(2),params[0][0]="action",params[0][1]="wfu_ajax_action",params[1]=new Array(2),params[1][0]="wfu_uploader_nonce",params[1][1]=document.getElementById("wfu_uploader_nonce_"+e).value,params[2]=new Array(2),params[2][0]="uniqueuploadid_"+e,params[2][1]=t,params[3]=new Array(2),params[3][0]="params_index",params[3][1]=a,params[4]=new Array(2),params[4][0]="session_token",params[4][1]=s,params[5]=new Array(2),params[5][0]="upload_finished",params[5][1]=1;for(var l="",r=0;r<params.length;r++)l+=(r>0?"&":"")+params[r][0]+"="+encodeURI(params[r][1]);n.open("POST",i,!0),n.setRequestHeader("Content-type","application/x-www-form-urlencoded"),n.onreadystatechange=function(){4==n.readyState&&200==n.status&&wfu_Code_Objects[e].do_action("after_upload",n.responseText)},n.send(l)}}function wfu_Initialize_Params(){var e={};return e.version="full",e.general={},e.general.shortcode_id=0,e.general.unique_id="",
2
- 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,t,a,s){0!=wfu_filesselected(e)&&wfu_selectsubdir_check(e)&&wfu_check_required_userdata(e,!0)&&wfu_Code_Objects[e].apply_filters("pre_start_check",!0)&&wfu_redirect_to_classic_cont(e,t,a,s)}function wfu_redirect_to_classic_cont(e,t,a,s){var n=function(n){var l="",r="wfu_askserver_success:",o="wfu_askserver_error:",_=n.indexOf(r),d=n.indexOf(o);if(_>-1){l=n.substr(_+r.length),wfu_Code_Objects[e].do_action("askserver_success",l,"no-ajax");var u=wfu_Initialize_Params();if(u.general.shortcode_id=e,u.general.unique_id="",u.general.files_count=wfu_filesselected(e),wfu_ProcessUploadComplete(e,0,u,"no-ajax","",t,"",["false","","false"]),1==a){var c="";document.getElementById("upfile_"+e).name="uploadedfile_"+e+"_redirected"+c}s>0?document.getElementById("adminerrorcodes_"+e).value=s:document.getElementById("adminerrorcodes_"+e).value="",document.getElementById("upfile_"+e).disabled=!1,document.getElementById("uniqueuploadid_"+e).value=i,document.getElementById("uploadform_"+e).submit()}else d>-1&&(l=n.substr(d+o.length),wfu_unlock_upload(e),wfu_Code_Objects[e].do_action("askserver_error",l))},i=wfu_randomString(10);wfu_lock_upload(e),wfu_Code_Objects[e].do_action("pre_start");var l="",r=wfu_Code_Objects[e].apply_filters("askserver_pass_params",{});for(var o in r)r.hasOwnProperty(o)&&(l+="&"+o+"="+r[o]);var _=new Date,d=GlobalData.consts.ajax_url+"?action=wfu_ajax_action_ask_server&wfu_uploader_nonce="+document.getElementById("wfu_uploader_nonce_"+e).value+"&sid="+e+"&unique_id="+i+"&start_time="+_.getTime()+"&session_token="+t+l,u=wfu_GetHttpRequestObject();if(null==u){var c=document.createElement("iframe");return c?(c.style.display="none",c.src=d,document.body.appendChild(c),void(c.onload=function(){n(c.contentDocument.body.innerHTML)})):void wfu_Code_Objects[e].do_action("not_supported")}u.open("GET",d,!0),u.onreadystatechange=function(){4==u.readyState&&(200==u.status?n(u.responseText):(alert(GlobalData.consts.remoteserver_noresult),wfu_Code_Objects[e].do_action("askserver_noresult")))},u.send(null)}function wfu_filesselected(e){var t=document.getElementById("fileName_"+e),a=wfu_get_filelist(e);return 0==a.length&&t&&(t.value=GlobalData.consts.nofilemessage,t.className="file_input_textbox_nofile"),a.length}function wfu_check_required_userdata(e,t){for(var a=wfu_get_userdata_count(e),s=!1,n=0;a>n;n++){var i=document.getElementById("hiddeninput_"+e+"_userdata_"+n),l=document.getElementById("userdata_"+e+"_fieldwrapper_"+n),r=document.getElementById("userdata_"+e+"_field_"+n),o=document.getElementById("userdata_"+e+"_"+n),_=document.getElementById("userdata_"+e+"_hint_"+n);i.value=window["userdata_"+e+"_codes_"+n].value(r);for(var d={hintposition:"none"},u=document.getElementById("userdata_"+e+"_props_"+n).value.split("|"),c=0;c<u.length;c++)"p:"==u[c].substr(0,2)&&(d.hintposition=u[c].substr(2));var m="";if("file_userdata_fieldwrapper_required"==l.className.substr(0,35)&&(m=window["userdata_"+e+"_codes_"+n].empty(i)),""===m&&window["userdata_"+e+"_codes_"+n].validate&&(m=window["userdata_"+e+"_codes_"+n].validate(i)),""!==m){if(t)if("none"==d.hintposition)_.className="file_userdata_hint_none";else{l.className="file_userdata_fieldwrapper_required_empty";var f=o.getBoundingClientRect(),p=l.getBoundingClientRect();"inline"==d.hintposition?(_.className="file_userdata_hint_inline",_.style.left=parseInt(p.left-f.left)+"px",_.style.top=parseInt(p.top-f.top)+"px",_.style.right=parseInt(f.right-p.right)+"px",_.style.bottom=parseInt(f.bottom-p.bottom)+"px"):"top"==d.hintposition?(_.className="file_userdata_hint_top",_.style.left=parseInt(p.left-f.left)+"px",_.style.bottom=parseInt(f.bottom-p.top)+"px"):"right"==d.hintposition?(_.className="file_userdata_hint_right",_.style.left=parseInt(p.right-f.left)+"px",_.style.top=parseInt(p.top-f.top)+"px"):"bottom"==d.hintposition?(_.className="file_userdata_hint_bottom",_.style.left=parseInt(p.left-f.left)+"px",_.style.top=parseInt(p.bottom-f.top)+"px"):"left"==d.hintposition&&(_.className="file_userdata_hint_left",_.style.right=parseInt(f.right-p.left)+"px",_.style.top=parseInt(p.top-f.top)+"px"),_.innerHTML=m,_.style.display="block"}s=!0}}return!s}function wfu_HTML5UploadFile(e,t,a){if(!wfu_BrowserCaps.supportsAJAX)return void wfu_redirect_to_classic(e,a,1,1);if(!wfu_BrowserCaps.supportsHTML5)return void wfu_redirect_to_classic(e,a,1,2);t=wfu_plugin_decode_string(t.replace(/^\s+|\s+$/g,""));var s=null;try{s=JSON.parse(t)}catch(n){}if(null==s)return void wfu_redirect_to_classic(e,a,1,3);var i=wfu_GetHttpRequestObject();if(null!=i){var l=wfu_filesselected(e);if(0!=l){var r=document.getElementById("upload_"+e),o=!r;if(!wfu_selectsubdir_check(e))return void(o&&wfu_clear_files(e));var _=l;if(_+=_,!wfu_check_required_userdata(e,!0))return void(o&&wfu_clear_files(e));if(wfu_Code_Objects[e].apply_filters("pre_start_check",!0)){var d=wfu_randomString(10);if(wfu_lock_upload(e),wfu_Code_Objects[e].do_action("pre_start"),wfu_Code_Objects[e].apply_filters("pre_start_ask_server",!1,s.has_filters)){var u=GlobalData.consts.ajax_url;params=new Array(5),params[0]=new Array(2),params[0][0]="action",params[0][1]="wfu_ajax_action_ask_server",params[1]=new Array(2),params[1][0]="session_token",params[1][1]=a,params[2]=new Array(2),params[2][0]="sid",params[2][1]=e,params[3]=new Array(2),params[3][0]="unique_id",params[3][1]=d,params[4]=new Array(2),params[4][0]="wfu_uploader_nonce",params[4][1]=document.getElementById("wfu_uploader_nonce_"+e).value;var c=wfu_Code_Objects[e].apply_filters("askserver_pass_params",{});for(var m in c)c.hasOwnProperty(m)&&params.push([m,c[m]]);for(var f="",p=0;p<params.length;p++)f+=(p>0?"&":"")+params[p][0]+"="+encodeURI(params[p][1]);i.open("POST",u,!0),i.setRequestHeader("Content-type","application/x-www-form-urlencoded"),i.onreadystatechange=function(){if(4==i.readyState)if(200==i.status){var t=i.responseText,n="",l="wfu_askserver_success:",r="wfu_askserver_error:",o=t.indexOf(l),_=t.indexOf(r);o>-1?(n=t.substr(o+l.length),wfu_Code_Objects[e].do_action("askserver_success",n,"ajax"),wfu_HTML5UploadFile_cont(e,s,a,d)):_>-1&&(n=t.substr(_+r.length),wfu_unlock_upload(e),wfu_Code_Objects[e].do_action("askserver_error",n))}else alert(GlobalData.consts.remoteserver_noresult),wfu_unlock_upload(e),wfu_Code_Objects[e].do_action("askserver_noresult")},i.send(f)}else wfu_HTML5UploadFile_cont(e,s,a,d)}}}}function wfu_HTML5UploadFile_cont(e,t,a,s){function n(l,r,o,u){m=!0;var f=wfu_GetHttpRequestObject(),p=wfu_GetHttpRequestObject();if(null!=f&&null!=p){var w=null,b=null;try{var w=new FormData,b=new FormData}catch(g){}if(null!=w&&null!=b){w.append("action","wfu_ajax_action"),w.append("wfu_uploader_nonce",document.getElementById("wfu_uploader_nonce_"+e).value),o||w.append("uploadedfile_"+e+d,r),w.append("uploadedfile_"+e+"_index",l),w.append("uploadedfile_"+e+"_name",wfu_plugin_encode_string(_[l].name)),w.append("uploadedfile_"+e+"_size",_[l].size),w.append("uniqueuploadid_"+e,s),w.append("params_index",t.params_index),w.append("subdir_sel_index",i),o?w.append("only_check","1"):w.append("only_check","0"),w.append("session_token",a);var y=wfu_Code_Objects[e].apply_filters("upload_pass_params",{},"ajax");for(var h in y)y.hasOwnProperty(h)&&w.append(h,y[h]);for(var v=wfu_get_userdata_count(e),k=0;v>k;k++)w.append("hiddeninput_"+e+"_userdata_"+k,document.getElementById("hiddeninput_"+e+"_userdata_"+k).value);if(wfu_initialize_fileupload_xhr(f,e,a,s,t,l,_[l].name),o||(f.size=r.size,f.totalsize=_[l].size,f.loading=!0),u){b.append("action","wfu_ajax_action"),b.append("wfu_uploader_nonce",document.getElementById("wfu_uploader_nonce_"+e).value),b.append("params_index",t.params_index),b.append("session_token",a),b.append("force_connection_close","1"),p.open("POST",GlobalData.consts.ajax_url,!1);try{p.send(b)}catch(I){}m="success"==p.responseText}if(m)o?(f.addEventListener("load",function(t){t={target:{responseText:t.target.responseText,shortcode_id:e,return_status:!0}};var a=wfu_uploadComplete.call(f,t);m="success"==a||"warning"==a,m&&n(l,r,!1,!1)},!1),f.addEventListener("error",function(e){},!1),f.open("POST",GlobalData.consts.ajax_url,!0),f.send(w)):(f.upload.xhr=f,f.upload.dummy=1,f.upload.addEventListener("loadstart",wfu_loadStart,!1),f.upload.addEventListener("progress",new Function("evt","wfu_uploadProgress(evt, "+e+", "+f.xhrid+", "+t.debugmode+");"),!1),f.addEventListener("load",wfu_uploadComplete,!1),f.addEventListener("error",new Function("evt","wfu_uploadFailed(evt, "+t.debugmode+");"),!1),f.addEventListener("abort",wfu_uploadCanceled,!1),f.open("POST",GlobalData.consts.ajax_url,!0),f.send(w));else{var B={target:{responseText:"",shortcode_id:e}};wfu_uploadComplete.call(f,B)}return c++,m}}}var i=-1,l=document.getElementById("selectsubdir_"+e);if(l){var r=document.getElementById("selectsubdiredit_"+e),o="none"!=r.style.display;i=o?r.value:l.selectedIndex}var _=wfu_get_filelist(e),d="";GlobalData.UploadInProgressString+="["+s+"]",GlobalData[e]={},GlobalData[e].unique_id=s,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(t.shortcode_id,"progressive"),wfu_attach_cancel_event(e,a,s,t);var u=wfu_Initialize_Params();u.general.shortcode_id=e,u.general.unique_id=s,wfu_ProcessUploadComplete(e,0,u,s,t.params_index,a,"",["false","","false"]);var c=0,m=!0,f=0;n(f,_[f],!0,!1)}function wfu_initialize_fileupload_xhr(e,t,a,s,n,i,l){var r=i>=0?GlobalData[t].xhrs.push(e)-1:-1,o=new Date;e.xhrid=r,e.shortcode_id=t,e.requesttype=i>=0?"fileupload":"email",e.file_id=i+1,e.size=0,e.totalsize=0,e.loading=!1,e.deltasize=0,e.sizeloaded=0,e.aborted=!1,e.unique_id=s,e.params_index=n.params_index,e.session_token=a,e.debugmode=n.debugmode,e.is_admin=n.is_admin,e.start_time=o.getTime(),e.end_time=e.start_time,e.finish_time=e.start_time+1e3*parseInt(GlobalData.consts.max_time_limit),e.fail_colors=n.fail_colors,e.error_message_header=n.error_header.replace(/%username%/g,"no data"),e.error_message_header=e.error_message_header.replace(/%useremail%/g,"no data"),e.error_message_header=e.error_message_header.replace(/%filename%/g,l),e.error_message_header=e.error_message_header.replace(/%filepath%/g,l),e.error_message_failed=GlobalData.consts.message_failed,e.error_message_cancelled=GlobalData.consts.message_cancelled,e.error_adminmessage_unknown=GlobalData.consts.adminmessage_unknown.replace(/%username%/g,"no data"),e.error_adminmessage_unknown=e.error_adminmessage_unknown.replace(/%useremail%/g,"no data"),e.error_adminmessage_unknown=e.error_adminmessage_unknown.replace(/%filename%/g,l),e.error_adminmessage_unknown=e.error_adminmessage_unknown.replace(/%filepath%/g,l)}function wfu_get_userdata_count(e){for(var t=0;document.getElementById("userdata_"+e+"_"+t);)t++;return t}function wfu_lock_upload(e){document.getElementById("fileName_"+e);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 a=wfu_get_userdata_count(e),s=0;a>s;s++)window["userdata_"+e+"_codes_"+s].lock(document.getElementById("userdata_"+e+"_field_"+s));wfu_Code_Objects[e].do_action("lock_upload")}function wfu_unlock_upload(e){document.getElementById("fileName_"+e);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 a=wfu_get_userdata_count(e),s=0;a>s;s++)window["userdata_"+e+"_codes_"+s].unlock(document.getElementById("userdata_"+e+"_field_"+s));wfu_Code_Objects[e].do_action("unlock_upload")}function wfu_clear_files(e){document.getElementById("uploadform_"+e).reset();var t=document.getElementById("upfile_"+e);"undefined"!=typeof t.filearray&&(t.filearray.length=0,t.filearrayprops.length=0);var a=document.getElementById("fileName_"+e);a&&(a.value="",a.className="file_input_textbox")}function wfu_clear(e){wfu_clear_files(e);var t=document.getElementById("selectsubdir_"+e);if(t){var a=document.getElementById("selectsubdiredit_"+e),s="none"!=a.style.display;s?(t.selectedIndex=-1,a.value=""):t.selectedIndex=parseInt(document.getElementById("selectsubdirdefault_"+e).value)}for(var n=wfu_get_userdata_count(e),i=0;n>i;i++)window["userdata_"+e+"_codes_"+i].reset(document.getElementById("userdata_"+e+"_field_"+i),document.getElementById("hiddeninput_"+e+"_userdata_"+i));wfu_Code_Objects[e].do_action("clear_upload")}function wfu_reset_message(e){var t=document.getElementById("wfu_messageblock_"+e);if(t){document.getElementById("wfu_messageblock_header_"+e).style.display="";var a=document.getElementById("wfu_messageblock_header_"+e+"_container");UploadStates[e]&&(a.innerHTML=UploadStates[e].State0),document.getElementById("wfu_messageblock_header_"+e+"_state").value="none",document.getElementById("wfu_messageblock_arrow_"+e).style.display="none",a.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++)t.tBodies[0].removeChild(document.getElementById("wfu_messageblock_"+e+"_"+n)),t.tBodies[0].removeChild(document.getElementById("wfu_messageblock_subheader_"+e+"_"+n))}}function wfu_show_simple_progressbar(e,t){var a=document.getElementById("progressbar_"+e+"_animation"),s=document.getElementById("progressbar_"+e+"_imagesafe");a&&("progressive"==t?(a.style.width="0%",a.className="file_progress_progressive",s.style.display="none",a.style.display="block"):wfu_BrowserCaps.supportsAnimation?(a.style.width="25%",a.className="file_progress_shuffle",s.style.display="none",a.style.display="block"):(a.style.width="0%",a.className="file_progress_noanimation",a.style.display="none",s.style.display="block"),document.getElementById("wordpress_file_upload_progressbar_"+e).style.display="block")}function wfu_hide_simple_progressbar(e){var t=document.getElementById("progressbar_"+e+"_animation"),a=document.getElementById("progressbar_"+e+"_imagesafe");t&&(document.getElementById("wordpress_file_upload_progressbar_"+e).style.display="none",t.style.width="0%",t.className="file_progress_noanimation",a.style.display="none",t.style.display="block")}function wfu_invoke_shortcode_editor(e,t,a,s){for(var n=document.getElementsByTagName("BUTTON"),i=0,l=null,r=0;r<n.length;r++)n[r].parentNode&&n[r].parentNode.id==s+"_editor_"+e&&(l=n[r],i++);if(0!=i){if(i>1)return void alert(GlobalData.consts.same_pluginid);var o=wfu_GetHttpRequestObject();if(null!=o){l.parentNode.style.display="none",document.getElementById(s+"_overlay_"+e).style.display="block";var _=GlobalData.consts.ajax_url;params=new Array(6),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]=t,params[3]=new Array(2),params[3][0]="post_hash",params[3][1]=a,params[4]=new Array(2),params[4][0]="shortcode_tag",params[4][1]=s,params[5]=new Array(2),params[5][0]="widget_id",params[5][1]=document.getElementById(s+"_"+e+"_widgetid")?document.getElementById(s+"_"+e+"_widgetid").value:"";for(var d="",r=0;r<params.length;r++)d+=(r>0?"&":"")+params[r][0]+"="+encodeURI(params[r][1]);o.open("POST",_,!0),o.setRequestHeader("Content-type","application/x-www-form-urlencoded"),o.onreadystatechange=function(){if(4==o.readyState&&200==o.status){document.getElementById(s+"_overlay_"+e).style.display="none",l.parentNode.removeAttribute("style");var t="wfu_edit_shortcode:",a=o.responseText.indexOf(t);-1==a&&(a=o.responseText.length);var n=(o.responseText.substr(0,a),o.responseText.substr(a+t.length,o.responseText.length-a-t.length));a=n.indexOf(":");var i=n.substr(0,a);if(txt_value=n.substr(a+1,n.length-a-1),"success"==i){var r=window.open(wfu_plugin_decode_string(txt_value),"_blank");r?r.plugin_window=window:alert(GlobalData.consts.enable_popups)}else"check_page_obsolete"==i&&alert(txt_value)}},o.send(d)}}}GlobalData={},UploadStates={},Code_Initializators=[],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="",GlobalData.FreeChangeHandler=!1,wfu_Check_Browser_Capabilities(),Code_Initializators[Code_Initializators.length]=function(sid){var CBUV_Code_Objects={};return CBUV_Code_Objects.pre_start_ask_server=function(e,t){if(e)return e;this.sid;return"true"==t},CBUV_Code_Objects.askserver_pass_params=function(e){for(var t=this.sid,a=wfu_get_filelist(t),s="",n="",i=0;i<a.length;i++)i>0&&(s+=";",n+=";"),s+=wfu_plugin_encode_string(a[i].name),n+=a[i].size;return e.filenames=s,e.filesizes=n,e},CBUV_Code_Objects.askserver_success=function(response,mode){var sid=this.sid,upload_status="success",txt_match=response.match(/CBUVJS\[(.*?)\]/),txt_header=txt_match&&"undefined"!=typeof txt_match[1]?txt_match[1]:"";""!=txt_header&&eval(txt_header)},CBUV_Code_Objects.askserver_error=function(response,mode){var sid=this.sid,upload_status="error",txt_match=response.match(/CBUVJS\[(.*?)\]/),txt_header=txt_match&&"undefined"!=typeof txt_match[1]?txt_match[1]:"";if(""!=txt_header&&eval(txt_header),txt_match=response.match(/CBUV\[(.*?)\]/),txt_header=txt_match&&"undefined"!=typeof txt_match[1]?txt_match[1]:"",""!=txt_header){var Params=wfu_Initialize_Params();Params.general.shortcode_id=sid,Params.general.message=txt_header,Params.general.state=12,wfu_ProcessUploadComplete(sid,0,Params,"no-ajax","","","",["false","","false"]),wfu_clear(sid)}},CBUV_Code_Objects.after_upload=function(response){var sid=this.sid,txt_match=response.match(/CBUVJS\[(.*?)\]/),txt_header=txt_match&&"undefined"!=typeof txt_match[1]?txt_match[1]:"";""!=txt_header&&eval(txt_header)},CBUV_Code_Objects},wfu_initialize_webcam=function(e,t,a,s,n,i,l,r,o){"undefined"==typeof wfu_parse_video_width&&(wfu_parse_video_width=function(e){var t=parseInt(e);t>0&&(this.empty=!1,this.video.width=t)}),"undefined"==typeof wfu_parse_video_height&&(wfu_parse_video_height=function(e){var t=parseInt(e);t>0&&(this.empty=!1,this.video.height=t)}),"undefined"==typeof wfu_parse_video_aspectratio&&(wfu_parse_video_aspectratio=function(e){var t=parseFloat(e);t>0&&(this.empty=!1,this.video.aspectRatio=t)}),"undefined"==typeof wfu_parse_video_framerate&&(wfu_parse_video_framerate=function(e){var t=parseFloat(e);t>0&&(this.empty=!1,this.video.frameRate=t)}),"undefined"==typeof wfu_parse_video_facingmode&&(wfu_parse_video_facingmode=function(e){var t="front"==e?"user":"back"==e?"environment":"";""!=t&&(this.empty=!1,this.video.facingMode=t)});var _={empty:!0,video:{}};wfu_parse_video_width.call(_,s),wfu_parse_video_height.call(_,n),wfu_parse_video_aspectratio.call(_,i),wfu_parse_video_framerate.call(_,l),wfu_parse_video_facingmode.call(_,r);var d={mode:t,audio:"true"==a,video:_.empty?!0:_.video,maxrecordtime:o};window["wfu_webcam_props_"+e]=d,wfu_reinitialize_webcam(e)},wfu_reinitialize_webcam=function(e){window["wfu_webcam_props_"+e].active=!0,window["wfu_webcam_props_"+e].width=0,window["wfu_webcam_props_"+e].width=0,window["wfu_webcam_props_"+e].timeStart=0,window["wfu_webcam_props_"+e].duration=0,window["wfu_webcam_props_"+e].counting=!1,window["wfu_webcam_props_"+e].stream=null,window["wfu_webcam_props_"+e].media=null,window["wfu_webcam_props_"+e].blobs=null,window["wfu_webcam_props_"+e].playing=!1;var t=window["wfu_webcam_props_"+e],a=document.getElementById("webcam_"+e+"_box"),s=document.getElementById("webcam_"+e+"_webcamoff");s.style.display="none",a.style.display="block";var n={audio:t.audio,video:t.video};"undefined"==typeof Promise&&(Promise=function(e){this.mainCallback=e,this.then=function(e){return this.successCallback=e,this},this["catch"]=function(t){e(this.successCallback,t)}},PromiseRejected=function(e){this.then=function(e){return this},this["catch"]=function(t){t(e)}},Promise.reject=function(e){return new PromiseRejected(e)});var i=function(e,t,a){var s=navigator.getUserMedia||navigator.webkitGetUserMedia||navigator.mozGetUserMedia||navigator.msGetUserMedia;return s&&"undefined"!=typeof MediaRecorder?new Promise(function(t,a){s.call(navigator,e,t,a)}):Promise.reject(new Error("getUserMedia is not implemented in this browser"))};void 0===navigator.mediaDevices&&(navigator.mediaDevices={}),void 0===navigator.mediaDevices.getUserMedia&&(navigator.mediaDevices.getUserMedia=i),navigator.mediaDevices.getUserMedia(n).then(function(s){window["wfu_webcam_props_"+e].stream=s,a.autoplay=!0,a.ontimeupdate=null,a.onerror=null,a.onloadeddata=function(t){wfu_webcam_init_callback(e)},a.src=window.URL.createObjectURL(s),wfu_initialize_webcam_nav(e,t.mode)})["catch"](function(t){console.log("Video not supported!",t),document.getElementById("webcam_"+e+"_inner").className="wfu_file_webcam_inner wfu_webcam_notsupported"})},wfu_webcam_init_callback=function(e){var t=document.getElementById("webcam_"+e+"_inner"),a=document.getElementById("webcam_"+e+"_box");window["wfu_webcam_props_"+e].width=a.videoWidth,window["wfu_webcam_props_"+e].height=a.videoHeight;var s='<svg xmlns="http://www.w3.org/2000/svg" width="'+a.videoWidth+'" height="'+a.videoHeight+'"></svg>',n=new Blob([s],{type:"image/svg+xml;charset=utf-8"}),i=document.getElementById("webcam_"+e+"_webcamoff_img");i.src=window.URL.createObjectURL(n),i.style.width=t.clientWidth+"px",i.style.height=t.clientHeight+"px"},wfu_initialize_webcam_nav=function(e,t){"undefined"==typeof SVGInjector&&!function(e,t){"use strict";function a(e){e=e.split(" ");for(var t={},a=e.length,s=[];a--;)t.hasOwnProperty(e[a])||(t[e[a]]=1,s.unshift(e[a]));return s.join(" ")}var s="file:"===e.location.protocol,n=t.implementation.hasFeature("http://www.w3.org/TR/SVG11/feature#BasicStructure","1.1"),i=Array.prototype.forEach||function(e,t){if(void 0===this||null===this||"function"!=typeof e)throw new TypeError;var a,s=this.length>>>0;for(a=0;s>a;++a)a in this&&e.call(t,this[a],a,this)},l={},r=0,o=[],_=[],d={},u=function(e){return e.cloneNode(!0)},c=function(e,t){_[e]=_[e]||[],_[e].push(t)},m=function(e){for(var t=0,a=_[e].length;a>t;t++)!function(t){setTimeout(function(){_[e][t](u(l[e]))},0)}(t)},f=function(t,a){if(void 0!==l[t])l[t]instanceof SVGSVGElement?a(u(l[t])):c(t,a);else{if(!e.XMLHttpRequest)return a("Browser does not support XMLHttpRequest"),!1;l[t]={},c(t,a);var n=new XMLHttpRequest;n.onreadystatechange=function(){if(4===n.readyState){if(404===n.status||null===n.responseXML)return a("Unable to load SVG file: "+t),s&&a("Note: SVG injection ajax calls do not work locally without adjusting security setting in your browser. Or consider using a local webserver."),a(),!1;if(!(200===n.status||s&&0===n.status))return a("There was a problem injecting the SVG: "+n.status+" "+n.statusText),!1;if(n.responseXML instanceof Document)l[t]=n.responseXML.documentElement;else if(DOMParser&&DOMParser instanceof Function){var e;try{var i=new DOMParser;e=i.parseFromString(n.responseText,"text/xml")}catch(r){e=void 0}if(!e||e.getElementsByTagName("parsererror").length)return a("Unable to parse SVG file: "+t),!1;l[t]=e.documentElement}m(t)}},n.open("GET",t),n.overrideMimeType&&n.overrideMimeType("text/xml"),n.send()}},p=function(t,s,l,_){var u=t.getAttribute("data-src")||t.getAttribute("src");if(!/\.svg/i.test(u))return void _("Attempted to inject a file with a non-svg extension: "+u);if(!n){var c=t.getAttribute("data-fallback")||t.getAttribute("data-png");return void(c?(t.setAttribute("src",c),_(null)):l?(t.setAttribute("src",l+"/"+u.split("/").pop().replace(".svg",".png")),_(null)):_("This browser does not support SVG and no PNG fallback was defined."))}-1===o.indexOf(t)&&(o.push(t),t.setAttribute("src",""),f(u,function(n){if("undefined"==typeof n||"string"==typeof n)return _(n),!1;var l=t.getAttribute("id");l&&n.setAttribute("id",l);var c=t.getAttribute("title");c&&n.setAttribute("title",c);var m=[].concat(n.getAttribute("class")||[],"injected-svg",t.getAttribute("class")||[]).join(" ");n.setAttribute("class",a(m));var f=t.getAttribute("style");f&&n.setAttribute("style",f);var p=[].filter.call(t.attributes,function(e){return/^data-\w[\w\-]*$/.test(e.name)});i.call(p,function(e){e.name&&e.value&&n.setAttribute(e.name,e.value)});var w,b,g,y,h,v={clipPath:["clip-path"],"color-profile":["color-profile"],cursor:["cursor"],filter:["filter"],linearGradient:["fill","stroke"],marker:["marker","marker-start","marker-mid","marker-end"],mask:["mask"],pattern:["fill","stroke"],radialGradient:["fill","stroke"]};Object.keys(v).forEach(function(e){w=e,g=v[e],b=n.querySelectorAll("defs "+w+"[id]");for(var t=0,a=b.length;a>t;t++){y=b[t].id,h=y+"-"+r;var s;i.call(g,function(e){s=n.querySelectorAll("["+e+'*="'+y+'"]');for(var t=0,a=s.length;a>t;t++)s[t].setAttribute(e,"url(#"+h+")")}),b[t].id=h}}),n.removeAttribute("xmlns:a");for(var k,I,B=n.querySelectorAll("script"),x=[],G=0,E=B.length;E>G;G++)I=B[G].getAttribute("type"),I&&"application/ecmascript"!==I&&"application/javascript"!==I||(k=B[G].innerText||B[G].textContent,x.push(k),n.removeChild(B[G]));if(x.length>0&&("always"===s||"once"===s&&!d[u])){for(var j=0,D=x.length;D>j;j++)new Function(x[j])(e);d[u]=!0}var P=n.querySelectorAll("style");i.call(P,function(e){e.textContent+=""}),t.parentNode.replaceChild(n,t),delete o[o.indexOf(t)],t=null,r++,_(n)}))},w=function(e,t,a){t=t||{};var s=t.evalScripts||"always",n=t.pngFallback||!1,l=t.each;if(void 0!==e.length){var r=0;i.call(e,function(t){p(t,s,n,function(t){l&&"function"==typeof l&&l(t),a&&e.length===++r&&a(r)})})}else e?p(e,s,n,function(t){l&&"function"==typeof l&&l(t),a&&a(1),e=null}):a&&a(0)};"object"==typeof module&&"object"==typeof module.exports?module.exports=exports=w:"function"==typeof define&&define.amd?define(function(){return w}):"object"==typeof e&&(e.SVGInjector=w)}(window,document),"1"!=document.getElementById("webcam_"+e+"_btns_converted").value&&(SVGInjector(document.getElementById("webcam_"+e+"_btns")),document.getElementById("webcam_"+e+"_btns_converted").value="1"),"capture video"==t?wfu_webcam_set_nav_status(e,"idle_only_video"):"take photos"==t?wfu_webcam_set_nav_status(e,"idle_only_pictures"):"both"==t?wfu_webcam_set_nav_status(e,"idle_video_and_pictures"):wfu_webcam_set_nav_status(e,"idle_only_video")},wfu_webcam_set_nav_status=function(e,t){var a=document.getElementById("webcam_"+e+"_btn_onoff"),s=document.getElementById("webcam_"+e+"_nav"),n=document.getElementById("webcam_"+e+"_btn_video"),i=document.getElementById("webcam_"+e+"_btn_record"),l=document.getElementById("webcam_"+e+"_btn_play"),r=document.getElementById("webcam_"+e+"_btn_stop"),o=document.getElementById("webcam_"+e+"_btn_pause"),_=document.getElementById("webcam_"+e+"_btn_pos"),d=document.getElementById("webcam_"+e+"_btn_back"),u=document.getElementById("webcam_"+e+"_btn_fwd"),c=document.getElementById("webcam_"+e+"_btn_time"),m=document.getElementById("webcam_"+e+"_btn_picture"),f=document.getElementById("webcam_"+e+"_screenshot");a.style.display="block","hidden"==t?s.style.display="none":"recording"==t?(s.removeAttribute("style"),s.className="wfu_file_webcam_nav wfu_recording",n.style.display="none",i.style.display="block",i.style.visibility="visible",i.setAttribute("class","wfu_file_webcam_btn wfu_file_webcam_btn_record wfu_recording"),r.style.display="block",r.style.visibility="visible",l.style.display="block",l.style.visibility="hidden",o.style.display="block",o.style.visibility="hidden",_.style.display="block",_.style.visibility="hidden",d.style.display="block",d.style.visibility="hidden",u.style.display="block",u.style.visibility="hidden",c.style.display="block",c.style.visibility="visible",m.style.display="none",f.style.display="none"):"after_recording"==t?(s.removeAttribute("style"),s.className="wfu_file_webcam_nav wfu_stream_ready",n.style.display="block",n.setAttribute("class","wfu_file_webcam_btn wfu_file_webcam_btn_video"),i.style.display="none",r.style.display="block",r.style.visibility="hidden",l.style.display="block",l.style.visibility="hidden",o.style.display="block",o.style.visibility="hidden",_.style.display="block",_.style.visibility="hidden",d.style.display="block",d.style.visibility="hidden",u.style.display="block",u.style.visibility="hidden",c.style.display="block",c.style.visibility="hidden",m.style.display="none",f.style.display="block"):"ready_playback"==t?(s.removeAttribute("style"),s.className="wfu_file_webcam_nav wfu_stream_ready",n.style.display="block",n.setAttribute("class","wfu_file_webcam_btn wfu_file_webcam_btn_video"),i.style.display="none",r.style.display="block",r.style.visibility="hidden",l.style.display="block",l.style.visibility="visible",l.setAttribute("class","wfu_file_webcam_btn wfu_file_webcam_btn_play"),o.style.display="block",o.style.visibility="visible",o.setAttribute("class","wfu_file_webcam_btn_disabled wfu_file_webcam_btn_pause_disabled"),_.style.display="block",_.style.visibility="visible",d.style.display="block",d.style.visibility="visible",u.style.display="block",u.style.visibility="visible",c.style.display="block",c.style.visibility="visible",m.style.display="none",f.style.display="none"):"after_screenshot"==t?(s.removeAttribute("style"),s.className="wfu_file_webcam_nav wfu_stream_ready",n.style.display="block",n.setAttribute("class","wfu_file_webcam_btn wfu_file_webcam_btn_video"),i.style.display="none",r.style.display="block",r.style.visibility="hidden",l.style.display="block",l.style.visibility="hidden",o.style.display="block",o.style.visibility="hidden",_.style.display="block",_.style.visibility="hidden",d.style.display="block",d.style.visibility="hidden",u.style.display="block",u.style.visibility="hidden",c.style.display="block",c.style.visibility="hidden",m.style.display="none",f.style.display="block"):"playing"==t?(s.removeAttribute("style"),s.className="wfu_file_webcam_nav wfu_stream_ready",n.style.display="block",n.setAttribute("class","wfu_file_webcam_btn_disabled wfu_file_webcam_btn_video_disabled"),i.style.display="none",r.style.display="block",r.style.visibility="hidden",l.style.display="block",l.style.visibility="visible",l.setAttribute("class","wfu_file_webcam_btn_disabled wfu_file_webcam_btn_play_disabled"),o.style.display="block",o.style.visibility="visible",o.setAttribute("class","wfu_file_webcam_btn wfu_file_webcam_btn_pause"),
3
- _.style.display="block",_.style.visibility="visible",d.style.display="block",d.style.visibility="visible",u.style.display="block",u.style.visibility="visible",c.style.display="block",c.style.visibility="visible",m.style.display="none",f.style.display="none"):(s.removeAttribute("style"),s.className="wfu_file_webcam_nav wfu_rec_ready",n.style.display="none",i.style.display="none",r.style.display="none",l.style.display="none",o.style.display="none",_.style.display="none",d.style.display="none",u.style.display="none",c.style.display="none",m.style.display="none",f.style.display="none",("idle_only_video"==t||"idle_video_and_pictures"==t)&&(i.style.display="block",i.setAttribute("class","wfu_file_webcam_btn wfu_file_webcam_btn_record")),("idle_only_pictures"==t||"idle_video_and_pictures"==t)&&(m.style.display="block"))},wfu_webcam_counter_status=function(e,t){if("start"==t){var a=new Date;window["wfu_webcam_props_"+e].duration=0,window["wfu_webcam_props_"+e].timeStart=a.getTime()/1e3,window["wfu_webcam_props_"+e].counting=!0,wfu_webcam_update_counter(e)}else{var a=new Date;window["wfu_webcam_props_"+e].duration=a.getTime()/1e3-window["wfu_webcam_props_"+e].timeStart,window["wfu_webcam_props_"+e].counting=!1}},wfu_webcam_update_counter=function(e){if(window["wfu_webcam_props_"+e].counting){var t=new Date,a=t.getTime()/1e3-window["wfu_webcam_props_"+e].timeStart;wfu_webcam_update_timer(e,a),setTimeout(function(){wfu_webcam_update_counter(e)},100)}},wfu_webcam_update_timer=function(e,t){var a=Math.floor(t/3600);t-=3600*a;var s=Math.floor(t/60);t-=60*s;var n=Math.floor(t);1e3*(t-Math.floor(t));document.getElementById("webcam_"+e+"_btn_time_label").innerHTML=(a>0?a+":":"")+(10>s?"0":"")+s+":"+(10>n?"0":"")+n},wfu_webcam_onoff=function(e){if(window["wfu_webcam_props_"+e].active){var t=document.getElementById("webcam_"+e+"_inner"),a=document.getElementById("webcam_"+e+"_box"),s=document.getElementById("webcam_"+e+"_webcamoff"),n=document.getElementById("webcam_"+e+"_webcamoff_img");n.style.width=t.clientWidth+"px",n.style.height=t.clientHeight+"px",a.pause(),a.src="",a.load(),window["wfu_webcam_props_"+e].stream&&window["wfu_webcam_props_"+e].stream.stop&&window["wfu_webcam_props_"+e].stream.stop(),window["wfu_webcam_props_"+e].stream=null,window["wfu_webcam_props_"+e].media=null,window["wfu_webcam_props_"+e].blobs=null,wfu_webcam_set_nav_status(e,"hidden"),a.style.display="none",document.getElementById("webcam_"+e+"_screenshot").src="",s.style.display="block",window["wfu_webcam_props_"+e].active=!1}else wfu_reinitialize_webcam(e);wfu_selectbutton_clicked(e)},wfu_webcam_golive=function(e){window["wfu_webcam_props_"+e].playing||(wfu_reinitialize_webcam(e),wfu_add_files(e,[],!1),wfu_selectbutton_clicked(e),wfu_update_uploadbutton_status(e))},wfu_webcam_start_rec=function(e){if(!window["wfu_webcam_props_"+e].media||!window["wfu_webcam_props_"+e].media.state||"recording"!=window["wfu_webcam_props_"+e].media.state){try{window["wfu_webcam_props_"+e].media=new MediaRecorder(window["wfu_webcam_props_"+e].stream)}catch(t){return void alert(document.getElementById("webcam_"+e+"_video_notsupported").value)}window["wfu_webcam_props_"+e].blobs=[],window["wfu_webcam_props_"+e].media.ondataavailable=function(t){var a=new Date,s=a.getTime()/1e3-window["wfu_webcam_props_"+e].timeStart;-1==window["wfu_webcam_props_"+e].maxrecordtime||window["wfu_webcam_props_"+e].maxrecordtime>0&&s<=window["wfu_webcam_props_"+e].maxrecordtime?t.data&&t.data.size>0&&window["wfu_webcam_props_"+e].blobs.push(t.data):wfu_webcam_stop_rec(e)},wfu_webcam_set_nav_status(e,"recording"),wfu_webcam_counter_status(e,"start"),window["wfu_webcam_props_"+e].media.onstop=function(t){wfu_webcam_counter_status(e,"stop"),wfu_webcam_set_nav_status(e,"after_recording"),wfu_webcam_onstop(t,e)},window["wfu_webcam_props_"+e].media.start(10)}},wfu_webcam_stop_rec=function(e){window["wfu_webcam_props_"+e].media.stop()},wfu_webcam_onstop=function(e,t){if(0==window["wfu_webcam_props_"+t].blobs.length)alert(document.getElementById("webcam_"+t+"_video_nothingrecorded").value),wfu_webcam_golive(t);else{var a=document.getElementById("webcam_"+t+"_box"),s=document.getElementById("webcam_"+t+"_canvas"),n=document.getElementById("webcam_"+t+"_screenshot");if(window["wfu_webcam_props_"+t].stream){s.width=a.clientWidth,s.height=a.clientHeight;var i=s.getContext("2d");i.drawImage(a,0,0,a.clientWidth,a.clientHeight),n.src=s.toDataURL("image/webp")}var l=new Blob(window["wfu_webcam_props_"+t].blobs,{type:"video/mp4"});a.autoplay=!1,a.ontimeupdate=function(e){wfu_webcam_update_pos(t)},a.onended=function(e){wfu_webcam_ended(t)},a.onloadeddata=function(e){a.readyState>=2&&wfu_webcam_set_nav_status(t,"ready_playback")},a.onerror=function(e){a.onloadeddata=null,a.src=window.URL.createObjectURL(window["wfu_webcam_props_"+t].stream)},a.src=window.URL.createObjectURL(l),l.name="video.mp4",wfu_add_files(t,[{file:l,props:{}}],!1),wfu_update_uploadbutton_status(t)}},wfu_webcam_play=function(e){if(!window["wfu_webcam_props_"+e].playing){var t=document.getElementById("webcam_"+e+"_box");wfu_webcam_set_nav_status(e,"playing"),window["wfu_webcam_props_"+e].playing=!0,t.play()}},wfu_webcam_ended=function(e){var t=document.getElementById("webcam_"+e+"_box");t.src=t.src,wfu_webcam_set_nav_status(e,"ready_playback"),window["wfu_webcam_props_"+e].playing=!1},wfu_webcam_pause=function(e){var t=document.getElementById("webcam_"+e+"_box");t.pause(),wfu_webcam_set_nav_status(e,"ready_playback"),window["wfu_webcam_props_"+e].playing=!1},wfu_webcam_back=function(e){var t=document.getElementById("webcam_"+e+"_box");t.src=t.src,t.currentTime=0},wfu_webcam_fwd=function(e){var t=document.getElementById("webcam_"+e+"_box");t.currentTime=isFinite(t.duration)?t.duration:2*window["wfu_webcam_props_"+e].duration},wfu_webcam_take_picture=function(e){var t=document.getElementById("webcam_"+e+"_box"),a=document.getElementById("webcam_"+e+"_canvas"),s=document.getElementById("webcam_"+e+"_screenshot");if(window["wfu_webcam_props_"+e].stream){a.width=t.clientWidth,a.height=t.clientHeight;var n=a.getContext("2d");n.drawImage(t,0,0,t.clientWidth,t.clientHeight),s.src=a.toDataURL("image/webp"),wfu_webcam_set_nav_status(e,"after_screenshot"),window.wfu_toBlob_function_initialized||(!function(e){"use strict";var t=e.HTMLCanvasElement&&e.HTMLCanvasElement.prototype,a=e.Blob&&function(){try{return Boolean(new Blob)}catch(e){return!1}}(),s=a&&e.Uint8Array&&function(){try{return 100===new Blob([new Uint8Array(100)]).size}catch(e){return!1}}(),n=e.BlobBuilder||e.WebKitBlobBuilder||e.MozBlobBuilder||e.MSBlobBuilder,i=/^data:((.*?)(;charset=.*?)?)(;base64)?,/,l=(a||n)&&e.atob&&e.ArrayBuffer&&e.Uint8Array&&function(e){var t,l,r,o,_,d,u,c,m;if(t=e.match(i),!t)throw new Error("invalid data URI");for(l=t[2]?t[1]:"text/plain"+(t[3]||";charset=US-ASCII"),r=!!t[4],o=e.slice(t[0].length),_=r?atob(o):decodeURIComponent(o),d=new ArrayBuffer(_.length),u=new Uint8Array(d),c=0;c<_.length;c+=1)u[c]=_.charCodeAt(c);return a?new Blob([s?u:d],{type:l}):(m=new n,m.append(d),m.getBlob(l))};e.HTMLCanvasElement&&!t.toBlob&&(t.mozGetAsFile?t.toBlob=function(e,a,s){e(s&&t.toDataURL&&l?l(this.toDataURL(a,s)):this.mozGetAsFile("blob",a))}:t.toDataURL&&l&&(t.toBlob=function(e,t,a){e(l(this.toDataURL(t,a)))})),"function"==typeof define&&define.amd?define(function(){return l}):"object"==typeof module&&module.exports?module.exports=l:e.dataURLtoBlob=l}(window),window.wfu_toBlob_function_initialized=!0),a.toBlob&&a.toBlob(function(t){t.name="image.png",wfu_add_files(e,[{file:t,props:{}}],!1),wfu_update_uploadbutton_status(e)},"image/png")}},wfu_webcam_update_pos=function(e){var t=document.getElementById("webcam_"+e+"_box"),a=document.getElementById("webcam_"+e+"_btn_pointer"),s=isFinite(t.duration)?t.duration:window["wfu_webcam_props_"+e].duration,n=Math.round(t.currentTime/s*100);a.style.left=n+"%",wfu_webcam_update_timer(e,t.currentTime)};
1
  function wfu_Initialize_Consts(e){if("undefined"==typeof GlobalData.consts){GlobalData.consts=new Object;for(var t=e.split(";"),a=0;a<t.length;a++)const_txt=t[a].split(":"),GlobalData.consts[wfu_plugin_decode_string(const_txt[0])]=wfu_plugin_decode_string(const_txt[1])}}function wfu_Load_Code_Connectors(e){"undefined"==typeof wfu_Code_Objects&&(wfu_Code_Objects={}),wfu_Code_Objects[e]=new wfu_Code_Object(e);for(var t=0;t<Code_Initializators.length;t++)wfu_Code_Objects[e].additem(Code_Initializators[t](e))}function wfu_Code_Object(e){this.sid=e,this.items=[],this._calc_prioritized_list=function(e){for(var t,a,s=[],n=[],i=[],l=0;l<this.items.length;l++)t=this.items[l],t[e]&&(a=-1,t.priority&&(a=t.priority),t[e].priority&&(a=t[e].priority),a>=0?(s.push(a),n.push(l)):i.push(l));for(var l=1;l<s.length;l++)for(var r=l;r<s.length;r++)if(s[r]<s[l-1]){var o=s[r];s[r]=s[l-1],s[l-1]=o;var o=n[r];n[r]=n[l-1],n[l-1]=o}return n.concat(i)},this.additem=function(e){this.items.push(e)},this.apply_filters=function(e,t){if("undefined"==typeof t)return null;var a=this._calc_prioritized_list(e);if(0==a.length)return t;for(var s=0;s<a.length;s++){var n=this.items[a[s]],i=null;"function"==typeof n[e]?i=n[e]:"function"==typeof n[e].func&&(i=n[e].func),null!=i&&(t=i.apply(this,Array.prototype.slice.call(arguments,1)),arguments[1]=t)}return t},this.do_action=function(e){var t=this._calc_prioritized_list(e);if(0!=t.length)for(var a=0;a<t.length;a++){var s=this.items[t[a]],n=null;"function"==typeof s[e]?n=s[e]:"function"==typeof s[e].func&&(n=s[e].func),null!=n&&n.apply(this,Array.prototype.slice.call(arguments,1))}}}function wfu_plugin_load_action(e){wfu_install_unload_hook();var t=document.getElementById("selectsubdiredit_"+e);t&&"none"!=t.style.display&&wfu_attach_element_handlers(t,new Function("wfu_selectsubdiredit_change("+e+");"))}function wfu_install_unload_hook(){window.onbeforeunload=wfu_unload_hook}function wfu_unload_hook(){return""!=GlobalData.UploadInProgressString&&""!=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 t=null;try{var t=new FormData}catch(a){}wfu_BrowserCaps.supportsHTML5=null!=t;var a=document.createElement("iframe");wfu_BrowserCaps.supportsIFRAME=null!=a,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,t="animation",a="",s="Webkit Moz O ms Khtml".split(" "),n="",i=document.createElement("DIV");if(i.style.animationName&&(e=!0),e===!1)for(var l=0;l<s.length;l++)if(void 0!==i.style[s[l]+"AnimationName"]){n=s[l],t=n+"Animation",a="-"+n.toLowerCase()+"-",e=!0;break}return e}function wfu_join_strings(e){for(var t=[].slice.call(arguments),a="",s="",n=1;n<t.length;n++)s=""==a||""==t[n]?"":e,a+=s+t[n];return a}function wfu_plugin_decode_string(e){for(var t,a,s=0,n="";s<e.length;)t=parseInt(e.substr(s,2),16),a=128>t?t:224>t?((31&t)<<6)+(63&parseInt(e.substr(s+=2,2),16)):((15&t)<<12)+((63&parseInt(e.substr(s+=2,2),16))<<6)+(63&parseInt(e.substr(s+=2,2),16)),n+=String.fromCharCode(a),s+=2;return n}function wfu_plugin_encode_string(e){var t=0,a="",s="";for(t=0;t<e.length;t++)num=e.charCodeAt(t),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),a+=s;return a}function wfu_randomString(e){for(var t="0123456789ABCDEFGHIJKLMNOPQRSTUVWXTZabcdefghiklmnopqrstuvwxyz",a=e,s="",n=0;a>n;n++){var i=Math.floor(Math.random()*t.length);s+=t.substring(i,i+1)}return s}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_element_handlers(e,t){for(var a=["DOMAttrModified","textInput","input","change","keypress","paste","focus","propertychange"],s=0;s<a.length;s++)wfu_addEventHandler(e,a[s],t)}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_filedetails_showhide(e,t,a){var s=(document.getElementById("wfu_messageblock_arrow_"+e+"_"+t),document.getElementById("wfu_messageblock_arrow_"+e+"_up_"+t)),n=document.getElementById("wfu_messageblock_arrow_"+e+"_down_"+t),i=document.getElementById("wfu_messageblock_subheader_"+e+"_"+t),l=document.getElementById("wfu_messageblock_header_"+e+"_state_"+t);a?(s.style.display="",n.style.display="none",i.style.display="",l.value=""):(s.style.display="none",n.style.display="",i.style.display="none",l.value="none")}function wfu_get_file_ids(e){for(var t=(document.getElementById("wfu_messageblock_"+e),document.getElementById("wfu_messageblock_subheader_"+e).nextSibling),a="wfu_messageblock_"+e+"_",s=[];null!=t;)1===t.nodeType&&t.id.substr(0,a.length)==a&&s.push(t.id.substr(t.id.lastIndexOf("_")+1)),t=t.nextSibling;return s}function wfu_get_filelist(e,t){t="undefined"!=typeof t?t:!0;var a=document.getElementById("upfile_"+e),s=a.files;return s||(s=a.value?[{name:a.value}]:[]),t&&"undefined"!=typeof a.filearray&&(s=a.filearray),s}function wfu_add_files(e,t){var a=document.getElementById("upfile_"+e);"undefined"==typeof a.filearray&&(a.filearray=Array(),a.filearrayprops=Array()),document.getElementById("uploadform_"+e).reset(),a.filearray.length=a.filearrayprops.length=0;for(var s=0;s<t.length;s++)a.filearray.push(t[s].file),a.filearrayprops.push(t[s].props)}function wfu_filedetails_toggle(e,t){var a=(document.getElementById("wfu_messageblock_arrow_"+e+"_"+t),document.getElementById("wfu_messageblock_arrow_"+e+"_up_"+t));wfu_filedetails_showhide(e,t,"none"==a.style.display)}function wfu_headerdetails_showhide(e,t){var a=(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),i=document.getElementById("wfu_messageblock_subheader_"+e+"_message"),l=document.getElementById("wfu_messageblock_subheader_"+e+"_adminmessage"),r=document.getElementById("wfu_messageblock_header_"+e+"_state"),o=wfu_get_file_ids(e);if(t){a.style.display="",s.style.display="none",("none"!=i.style.display||"none"!=l.style.display)&&(n.style.display=""),r.value="";for(var _=0;_<o.length;_++)document.getElementById("wfu_messageblock_"+e+"_"+o[_]).style.display="",document.getElementById("wfu_messageblock_subheader_"+e+"_"+o[_]).style.display=document.getElementById("wfu_messageblock_header_"+e+"_state_"+o[_]).value}else{a.style.display="none",s.style.display="",n.style.display="none",r.value="none";for(var _=0;_<o.length;_++)document.getElementById("wfu_messageblock_"+e+"_"+o[_]).style.display="none",document.getElementById("wfu_messageblock_subheader_"+e+"_"+o[_]).style.display="none"}}function wfu_headerdetails_toggle(e){var t=(document.getElementById("wfu_messageblock_arrow_"+e),document.getElementById("wfu_messageblock_arrow_"+e+"_up"));wfu_headerdetails_showhide(e,"none"==t.style.display)}function wfu_attach_cancel_event(e,t,a,s){var n=document.getElementById("fileName_"+e);n&&(n.onkeyup=function(i){if(27==i.keyCode&&GlobalData[e]&&0!=GlobalData[e].xhrs.length){var l=confirm(GlobalData.consts.cancel_upload_prompt);if(1==l){for(var r=wfu_get_filelist(e),o=[],_=[],d=0;d<r.length;d++)o.push(null),_.push(r[d].name);for(var d=0;d<GlobalData[e].xhrs.length;d++){var u=GlobalData[e].xhrs[d].file_id-1;u>=0&&null==o[u]&&(o[u]=GlobalData[e].xhrs[d])}"true"==s.debugmode&&console.log("upload cancelled!");for(var d=0;d<o.length;d++)if(null==o[d]&&(o[d]=wfu_GetHttpRequestObject(),null!=o[d]&&wfu_initialize_fileupload_xhr(o[d],e,t,a,s,d,_[d])),-1!=o[d]){var c={target:{responseText:"force_cancel_code",shortcode_id:e}};wfu_uploadComplete.call(o[d],c)}n.onkeyup=null}}})}function wfu_dettach_cancel_event(e){var t=document.getElementById("fileName_"+e);t&&(t.onkeyup=null)}function wfu_selectbutton_changed(e,t){wfu_BrowserCaps.supportsAJAX&&wfu_BrowserCaps.supportsHTML5||(t=0);var a=document.getElementById("upfile_"+e),s=wfu_get_filelist(e,!1);if(1==t){"undefined"==typeof a.filearray&&(a.filearray=Array());for(var n=0;n<s.length;n++)a.filearray.push(s[n])}else"undefined"!=typeof a.filearray&&delete a.filearray;wfu_update_filename_text(e)}function wfu_selectbutton_clicked(e){var t=document.getElementById("wordpress_file_upload_message_"+e);t&&(t.style.display="none"),wfu_reset_message(e),document.getElementById("upfile_"+e).value="";var a=document.getElementById("fileName_"+e);a&&(a.value="",a.className="file_input_textbox")}function wfu_update_uploadbutton_status(e){var t=document.getElementById("upload_"+e);if(t){var a=wfu_get_filelist(e),s=a.length>0;s=wfu_Code_Objects[e].apply_filters("uploadbutton_status",s),t.disabled=!s}}function wfu_update_filename_text(e){var t=document.getElementById("fileName_"+e);if(t){for(var a=wfu_get_filelist(e),s="",n=0;n<a.length;n++)""!=s&&(s+=", "),s+=a[n].name.replace(/c:\\fakepath\\/i,"");t.value=s}}function wfu_selectsubdir_check(e){var t=document.getElementById("selectsubdir_"+e);if(!t)return!0;var a=document.getElementById("selectsubdiredit_"+e),s="none"!=a.style.display;return s&&t.selectedIndex>0&&(a.value=t.value.replace(/^\s+/,""),a.className="file_item_clean_match subfolder_autoplus_match",wfu_selectsubdiredit_change(e)),s?document.getElementById("hiddeninput_"+e).value=a.value:document.getElementById("hiddeninput_"+e).value=t.selectedIndex,!s&&0==t.selectedIndex||s&&(""==a.value||"file_item_clean_empty subfolder_autoplus_empty"==a.className)?(s?(t.className="subfolder_autoplus_dropdown_prompt",a.value="",GlobalData.FreeChangeHandler=!0,a.className="file_item_clean_prompt subfolder_autoplus_prompt",GlobalData.FreeChangeHandler=!1):t.className="file_item_clean_prompt subfolder_dropdown_prompt",!1):(s?t.className="subfolder_autoplus_dropdown":t.className="file_item_clean subfolder_dropdown",s&&"file_item_clean_prompt subfolder_autoplus_prompt"==a.className&&(a.className="file_item_clean subfolder_autoplus"),t.options[0].style.display="none",!0)}function wfu_selectsubdiredit_enter(e){var t=document.getElementById("selectsubdir_"+e),a=document.getElementById("selectsubdiredit_"+e);"file_item_clean_empty subfolder_autoplus_empty"==a.className&&(a.value=""),t.className="subfolder_autoplus_dropdown",a.className="file_item_clean subfolder_autoplus"}function wfu_selectsubdiredit_exit(e){var t=document.getElementById("selectsubdiredit_"+e);""==t.value&&(t.value=GlobalData.consts.wfu_subdir_typedir,t.className="file_item_clean_empty subfolder_autoplus_empty")}function wfu_selectsubdiredit_change(e){if(!GlobalData.FreeChangeHandler){var t=document.getElementById("selectsubdir_"+e),a=document.getElementById("selectsubdiredit_"+e);if("none"!=a.style.display){if("file_item_clean_empty subfolder_autoplus_empty"==a.className)return t.selectedIndex=0,void(document.getElementById("hiddeninput_"+e).value="");document.getElementById("hiddeninput_"+e).value=a.value;for(var s,n=!1,i=1;i<t.options.length;i++)s=t.options[i].value.replace(/^\s+/,"").toLowerCase(),a.value.length>=3?s.substr(0,a.value.length)==a.value.toLowerCase()?t.options[i].style.display="block":t.options[i].style.display="none":t.options[i].style.display="block",t.options[i].value.replace(/^\s+/,"")==a.value&&(t.selectedIndex=i,a.className="file_item_clean_match subfolder_autoplus_match",n=!0);n||(t.selectedIndex=0,a.className="file_item_clean subfolder_autoplus")}}}function wfu_selectsubdir_disable_onoff(e,t){var a=document.getElementById("selectsubdir_"+e);if(!a)return!0;var s=document.getElementById("selectsubdiredit_"+e),n="none"!=s.style.display;a.disabled=t,n&&(s.disabled=t)}function wfu_userdata_focused(e){var t=document.getElementById(e.id.replace("_field_","_fieldwrapper_"));if("file_userdata_fieldwrapper_required_empty"==t.className){t.className="file_userdata_fieldwrapper_required";var a=document.getElementById(e.id.replace("_field_","_hint_"));a.style.display="none"}}function wfu_Redirect(e){window.location=e}function wfu_loadStart(e){}function wfu_uploadProgress(e,t,a,s){s&&"undefined"==typeof this.xhr&&(console.log("total="+e.total+", loaded="+e.loaded),console.log(e));var n=GlobalData[t].xhrs[a],i=0,l=0,r=document.getElementById("progressbar_"+t+"_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 o=0;o<GlobalData[t].xhrs.length;o++)GlobalData[t].xhrs[o].file_id==n.file_id&&(GlobalData[t].xhrs[o].totalsize+=l)}if(r){for(var _=0,d=0,u=[],o=0;o<GlobalData[t].xhrs.length;o++)u[GlobalData[t].xhrs[o].file_id]=0;for(var o=0;o<GlobalData[t].xhrs.length;o++)u[GlobalData[t].xhrs[o].file_id]=Math.max(GlobalData[t].xhrs[o].totalsize,u[GlobalData[t].xhrs[o].file_id]);for(var o=0;o<u.length;o++)"undefined"!=typeof u[o]&&(_+=u[o]);for(var o=0;o<GlobalData[t].xhrs.length;o++)d+=GlobalData[t].xhrs[o].sizeloaded;i=Math.round(100*d/_),r.style.width=i.toString()+"%"}}else r&&(r.style.width="0%")}function wfu_notify_WPFilebase(e,t){var a=wfu_GetHttpRequestObject();if(null==a){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="+t,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]=t;for(var i="",s=0;s<params.length;s++)i+=(s>0?"&":"")+params[s][0]+"="+encodeURI(params[s][1]);a.open("POST",n,!0),a.setRequestHeader("Content-type","application/x-www-form-urlencoded"),a.onreadystatechange=function(){},a.send(i)}function wfu_send_email_notification(e,t,a,s,n,i,l,r,o){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]=a,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]=i,params[5]=new Array(2),params[5][0]="attachment_list",params[5][1]=l,params[6]=new Array(2),params[6][0]="uniqueuploadid_"+e,params[6][1]=t;for(var c=0;u>c;c++)params[7+c]=new Array(2),params[7+c][0]="userdata_"+c,params[7+c][1]=wfu_plugin_encode_string(document.getElementById("hiddeninput_"+e+"_userdata_"+c).value);for(var m="",c=0;c<params.length;c++)m+=(c>0?"&":"")+params[c][0]+"="+encodeURI(params[c][1]);wfu_initialize_fileupload_xhr(_,e,s,t,{params_index:a,debugmode:r,is_admin:o,fail_colors:GlobalData.consts.fail_colors,error_header:""},-1,""),_.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(m)}}function wfu_format_debug_data(e,t){return output='<label class="file_messageblock_subheader_debugmessage_label">',output+="Debug Data"+t,output+="</label>",output+='<div class="file_messageblock_subheader_debugmessage_container">',output+=e,output+="</div>",output}function wfu_uploadComplete(e){var t=new Date,a=this.shortcode_id,s=(this.file_id,!1),n="",i="",l="",r="unknown",o="",_="",d="wfu_fileupload_success:";this.loading=!1,this.end_time=t.getTime();var u=e.target.responseText,c=u,m="error";if(-1!=u&&(u.indexOf("force_errorabort_code")>-1&&(m="errorabort",u=u.replace("force_errorabort_code","")),u.indexOf("force_cancel_code")>-1&&(m="errorcancel",u=u.replace("force_cancel_code",""))),-1!=u){var f=u.indexOf(d);if(f>-1&&("true"==this.debugmode&&(_=u.substr(0,f)),c=u.substr(f+d.length),f=c.indexOf(":"),n=c.substr(0,f),c=c.substr(f+1),f=c.indexOf(":"),l=c.substr(0,f),i=c.substr(f+1)),""!=_){var p="";"fileupload"==this.requesttype?p=" - File: "+this.file_id:"email"==this.requesttype&&(p=" - Email Notification"),_=wfu_format_debug_data(_,p)}if(""!=l){var w=l.split(";");if(1==parseInt(w[2])){var b=w[3].split(",");r=wfu_plugin_decode_string(b[0]),o=b[4]}}}if(""==i||""==l){var g=this.fail_colors.split(","),y=wfu_Initialize_Params();y.general.shortcode_id=a,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,"errorcancel"!=m?(y.general.fail_message=GlobalData.consts.message_unknown,y.general.fail_admin_message=wfu_join_strings("<br />",this.error_adminmessage_unknown,this.requesttype+":"+c)):(y.general.fail_message=GlobalData.consts.file_cancelled,y.general.fail_admin_message=""),y.general.files_count>0?(y[0]={},y[0].color=g[0],y[0].bgcolor=g[1],y[0].borcolor=g[2],y[0].message_type=m,r=m,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&&t.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=""==i||""==l?wfu_ProcessUploadComplete(a,this.file_id,y,this.unique_id,this.params_index,this.session_token,"",[this.debugmode,_,this.is_admin],this.requesttype,""):wfu_ProcessUploadComplete(a,this.file_id,i,this.unique_id,this.params_index,this.session_token,l,[this.debugmode,_,this.is_admin],this.requesttype,n),s&&(wfu_dettach_cancel_event(a),wfu_unlock_upload(a),wfu_hide_simple_progressbar(a),wfu_clear(a)),e.target.return_status?r:void 0}function wfu_ProcessUploadComplete(sid,file_id,upload_params,unique_id,params_index,session_token,safe_output,debug_data,request_type,js_script_enc){if(sid&&!(0>sid)&&null!=upload_params&&""!=upload_params&&""!=unique_id&&("no-ajax"==unique_id||GlobalData[sid])){var do_redirect=!1;if("string"==typeof upload_params){upload_params=wfu_plugin_decode_string(upload_params.replace(/^\s+|\s+$/g,""));var Params=null;try{Params=JSON.parse(upload_params)}catch(e){}if(null==Params){var safe_parts=safe_output.split(";");Params=wfu_Initialize_Params(),Params.general.shortcode_id=sid,Params.general.unique_id=unique_id,Params.general.state=safe_parts[0],4==Params.general.state&&Params.general.state++;var default_colors=safe_parts[1].split(","),filedata="",error_jsonparse_filemessage=GlobalData.consts.jsonparse_filemessage,error_jsonparse_message=GlobalData.consts.jsonparse_message,error_jsonparse_adminmessage=GlobalData.consts.jsonparse_adminmessage;Params.general.files_count=parseInt(safe_parts[2]);for(var i=0;i<Params.general.files_count;i++)Params[i]={},Params[i].color=default_colors[0],Params[i].bgcolor=default_colors[1],Params[i].borcolor=default_colors[2],filedata=safe_parts[i+3].split(","),Params[i].message_type=wfu_plugin_decode_string(filedata[0]),Params[i].header=wfu_plugin_decode_string(filedata[1]),"success"==Params[i].message_type&&(Params[i].header+=error_jsonparse_filemessage,Params[i].message_type="warning"),Params[i].message=wfu_join_strings("<br />",error_jsonparse_message,wfu_plugin_decode_string(filedata[2])),Params[i].admin_messages=wfu_join_strings("<br />",error_jsonparse_adminmessage,wfu_plugin_decode_string(filedata[3]))}}else{if("object"!=typeof upload_params)return;var Params=upload_params}for(i=0;Params[i];)Params[i].message_type&&"error"==Params[i].message_type.substr(0,5)&&(Params[i].message_type=Params[i].message_type.substr(0,5)),i++;var message_table=document.getElementById("wfu_messageblock_"+sid),UploadStates_Ok=!0;if(!UploadStates[sid]&&message_table){var upload_states=document.getElementById("wfu_messageblock_header_"+sid+"_states").value;upload_states=wfu_plugin_decode_string(upload_states.replace(/^\s+|\s+$/g,"")),UploadStates[sid]=null;try{UploadStates[sid]=JSON.parse(upload_states)}catch(e){}null==UploadStates[sid]&&(UploadStates_Ok=!1)}GlobalData[sid]||(GlobalData[sid]=Object());var G=GlobalData[sid];if("no-ajax"==unique_id)G.last=!1,G.unique_id="",G.files_count=Params.general.files_count,0==Params.general.state&&(Params.general.files_count=0),G.files_processed=Params.general.files_count,UploadStates_Ok?G.upload_state=Params.general.state:G.upload_state=10,G.message=Params.general.message,G.update_wpfilebase=Params.general.update_wpfilebase,G.redirect_link=Params.general.redirect_link,G.notify_only_filename_list="",G.notify_target_path_list="",G.notify_attachment_list="",G.admin_messages={},G.admin_messages.wpfilebase=Params.general.admin_messages.wpfilebase,G.admin_messages.notify=Params.general.admin_messages.notify,G.admin_messages.redirect=Params.general.admin_messages.redirect,G.admin_messages.debug=debug_data[1],G.admin_messages.other=Params.general.admin_messages.other,G.errors={},G.errors.wpfilebase=Params.general.errors.wpfilebase,G.errors.notify=Params.general.errors.notify,G.errors.redirect=Params.general.errors.redirect,G.current_size=0,G.total_size=0;else{if(""==G.unique_id||G.unique_id!=unique_id||G.unique_id!=Params.general.unique_id)return;if(G.last)return;0==Params.general.files_count&&Params[0]&&"error"==Params[0].message_type&&(Params.general.files_count=1);for(var file_status="",i=0;i<Params.general.files_count;i++)file_status="error"==Params[i].message_type&&0==G.files_processed?"error1":"error"==Params[i].message_type&&G.files_processed>0?"error2":Params[i].message_type,G.upload_state=GlobalData.filestatematch[file_status][G.upload_state];UploadStates_Ok||(G.upload_state=10),G.files_processed+=Params.general.files_count,G.message=wfu_join_strings("<br />",G.message,Params.general.message),""==G.update_wpfilebase&&(G.update_wpfilebase=Params.general.update_wpfilebase),(!request_type||request_type&&"email"!=request_type)&&(G.redirect_link=Params.general.redirect_link),G.notify_only_filename_list=wfu_join_strings(", ",G.notify_only_filename_list,Params.general.notify_only_filename_list),G.notify_target_path_list=wfu_join_strings(", ",G.notify_target_path_list,Params.general.notify_target_path_list),G.notify_attachment_list=wfu_join_strings(",",G.notify_attachment_list,Params.general.notify_attachment_list),G.admin_messages.debug=wfu_join_strings("<br />",G.admin_messages.debug,debug_data[1]),G.admin_messages.other=wfu_join_strings("<br />",G.admin_messages.other,Params.general.admin_messages.other),""==G.admin_messages.wpfilebase&&(G.admin_messages.wpfilebase=Params.general.admin_messages.wpfilebase),""==G.admin_messages.notify&&(G.admin_messages.notify=Params.general.admin_messages.notify),""==G.admin_messages.redirect&&(G.admin_messages.redirect=Params.general.admin_messages.redirect),""==G.errors.wpfilebase&&(G.errors.wpfilebase=Params.general.errors.wpfilebase),""==G.errors.notify&&(G.errors.notify=Params.general.errors.notify),""==G.errors.redirect&&(G.errors.redirect=Params.general.errors.redirect)}G.files_processed==G.files_count&&(G.last=!0,""!=G.update_wpfilebase&&(G.admin_messages.wpfilebase="",wfu_notify_WPFilebase(params_index,session_token)),""!=G.notify_only_filename_list&&(G.admin_messages.notify="",wfu_send_email_notification(sid,unique_id,params_index,session_token,G.notify_only_filename_list,G.notify_target_path_list,G.notify_attachment_list,debug_data[0],debug_data[2]),G.last=!1,G.notify_only_filename_list=""),G.last&&("no-ajax"!=unique_id&&wfu_notify_server_upload_ended(sid,unique_id,params_index,session_token),GlobalData.UploadInProgressString=GlobalData.UploadInProgressString.replace(new RegExp("\\["+unique_id+"\\]","g"),"")),""!=G.errors.redirect&&(G.redirect_link=""),""!=G.redirect_link&&G.last&&""==GlobalData.UploadInProgressString.trim()&&(G.upload_state=11,do_redirect=!0));var nonadmin_message=G.message,admin_message=wfu_join_strings("<br />",G.admin_messages.other,G.admin_messages.wpfilebase,G.admin_messages.notify,G.admin_messages.redirect,G.admin_messages.debug);if(!UploadStates_Ok){var error_jsonparse_headermessage=GlobalData.consts.jsonparse_headermessage,error_jsonparse_headeradminmessage=GlobalData.consts.jsonparse_headeradminmessage;nonadmin_message=wfu_join_strings("<br />",error_jsonparse_headermessage,nonadmin_message),admin_message=wfu_join_strings("<br />",error_jsonparse_headeradminmessage,admin_message)}if(G.last){0==G.files_count&&12!=G.upload_state?G.upload_state=8:G.upload_state<4&&(G.upload_state+=4);var admin_messages_exist=""!=G.admin_messages.wpfilebase||""!=G.admin_messages.notify||""!=G.admin_messages.redirect||""!=G.admin_messages.other;4==G.upload_state&&""!=admin_message?G.upload_state++:5==G.upload_state&&""==!admin_message&&""==nonadmin_message&&G.upload_state--}if(message_table){var subheader_state=document.getElementById("wfu_messageblock_header_"+sid+"_state"),single_file_shown=1==G.files_count&&""==nonadmin_message&&""==admin_message&&G.last&&!do_redirect;if(single_file_shown)document.getElementById("wfu_messageblock_header_"+sid).style.display="none";else{document.getElementById("wfu_messageblock_header_"+sid).style.display="";var header_container=document.getElementById("wfu_messageblock_header_"+sid+"_container");if(UploadStates_Ok){var suffix="";1!=G.files_count||5!=G.upload_state&&7!=G.upload_state||(suffix="_singlefile"),header_container.innerHTML=UploadStates[sid]["State"+G.upload_state+suffix]}else{header_container.innerHTML="";var safe_container=document.getElementById("wfu_messageblock_header_"+sid+"_safecontainer");header_container.innerHTML=safe_container.innerHTML.replace(/_safe/g,"")}var subheader_show=!1;""!=nonadmin_message?(document.getElementById("wfu_messageblock_subheader_"+sid+"_message").style.display="",document.getElementById("wfu_messageblock_subheader_"+sid+"_messagelabel").innerHTML=nonadmin_message,subheader_show=!0):document.getElementById("wfu_messageblock_subheader_"+sid+"_message").style.display="none",""!=admin_message?(document.getElementById("wfu_messageblock_subheader_"+sid+"_adminmessage").style.display="",document.getElementById("wfu_messageblock_subheader_"+sid+"_adminmessagelabel").innerHTML=admin_message,subheader_show=!0):document.getElementById("wfu_messageblock_subheader_"+sid+"_adminmessage").style.display="none",subheader_show?document.getElementById("wfu_messageblock_subheader_"+sid).style.display=subheader_state.value:document.getElementById("wfu_messageblock_subheader_"+sid).style.display="none",subheader_show||G.files_processed>0?(header_container.colSpan=2,document.getElementById("wfu_messageblock_arrow_"+sid).style.display=""):(document.getElementById("wfu_messageblock_arrow_"+sid).style.display="none",header_container.colSpan=3)}for(var next_block=document.getElementById("wfu_messageblock_subheader_"+sid),next_block_id=0,file_block=null,file_template_container=document.getElementById("wfu_messageblock_"+sid+"_filetemplate"),file_contents="",door=document.getElementById("wfu_messageblock_"+sid+"_door"),ii=0,headerspan=1,subheaderspan=2,file_template=wfu_plugin_decode_string(file_template_container.value.replace(/^\s+|\s+$/g,"")),i=0;i<Params.general.files_count;i++){for(ii=i+file_id,file_contents=file_template.replace(/\[file_id\]/g,ii),file_contents=file_contents.replace(/\[filenumber_display\]/g,""),file_contents=file_contents.replace(/\[fileheader_color\]/g,Params[i].color),file_contents=file_contents.replace(/\[fileheader_bgcolor\]/g,Params[i].bgcolor),file_contents=file_contents.replace(/\[fileheader_borcolor\]/g,Params[i].borcolor),file_contents=file_contents.replace(/\[fileheader_message\]/g,Params[i].header),file_contents=file_contents.replace(/\[filesubheadermessage_display\]/g,'style="display:none;"'),file_contents=file_contents.replace(/\[filesubheader_message\]/g,Params[i].message),file_contents=file_contents.replace(/\[filesubheaderadminmessage_display\]/g,'style="display:none;"'),file_contents=file_contents.replace(/\[filesubheader_adminmessage\]/g,Params[i].admin_messages),file_contents="<table><tbody>"+file_contents+"</tbody></table>",door.innerHTML=file_contents,headerspan=1,subheaderspan=2,subheader_show=!1,file_block=document.getElementById("wfu_messageblock_"+sid+"_"+ii),1==G.files_count?(document.getElementById("wfu_messageblock_"+sid+"_filenumber_"+ii).style.display="none",document.getElementById("wfu_messageblock_subheader_"+sid+"_fileempty_"+ii).style.display="none",single_file_shown?file_block.style.display="":file_block.style.display=subheader_state.value,headerspan++,subheaderspan++):file_block.style.display=subheader_state.value,""!=Params[i].message&&(document.getElementById("wfu_messageblock_subheader_"+sid+"_message_"+ii).style.display="",subheader_show=!0),""!=Params[i].admin_messages&&(document.getElementById("wfu_messageblock_subheader_"+sid+"_adminmessage_"+ii).style.display="",subheader_show=!0),subheader_show||(document.getElementById("wfu_messageblock_arrow_"+sid+"_"+ii).style.display="none",headerspan++),document.getElementById("wfu_messageblock_header_"+sid+"_container_"+ii).colSpan=headerspan,document.getElementById("wfu_messageblock_subheader_"+sid+"_container_"+ii).colSpan=subheaderspan;ii>next_block_id&&(next_block=next_block.nextSibling,null!=next_block);)1===next_block.nodeType&&(next_block_id=next_block.id.substr(next_block.id.lastIndexOf("_")+1));message_table.tBodies[0].insertBefore(file_block,next_block),next_block=file_block.nextSibling,file_block=document.getElementById("wfu_messageblock_subheader_"+sid+"_"+ii),message_table.tBodies[0].insertBefore(file_block,next_block),next_block=file_block,next_block_id=ii}single_file_shown&&(document.getElementById("wfu_messageblock_"+sid+"_1").style.display=""),message_table.style.display="",document.getElementById("wordpress_file_upload_message_"+sid).style.display=""}return js_script_enc&&eval(wfu_plugin_decode_string(js_script_enc)),do_redirect&&wfu_Redirect(G.redirect_link),G.last}}function wfu_uploadFailed(e,t){t&&(console.log("failure report following"),console.log(e));var a=e.target,s={target:{responseText:"",shortcode_id:a.shortcode_id}};wfu_uploadComplete.call(a,s)}function wfu_uploadCanceled(e){}function wfu_notify_server_upload_ended(e,t,a,s){var n=wfu_GetHttpRequestObject();if(null!=n){var i=GlobalData.consts.ajax_url;params=new Array(6),params[0]=new Array(2),params[0][0]="action",params[0][1]="wfu_ajax_action",params[1]=new Array(2),params[1][0]="wfu_uploader_nonce",params[1][1]=document.getElementById("wfu_uploader_nonce_"+e).value,params[2]=new Array(2),params[2][0]="uniqueuploadid_"+e,params[2][1]=t,params[3]=new Array(2),params[3][0]="params_index",params[3][1]=a,params[4]=new Array(2),params[4][0]="session_token",params[4][1]=s,params[5]=new Array(2),params[5][0]="upload_finished",params[5][1]=1;for(var l="",r=0;r<params.length;r++)l+=(r>0?"&":"")+params[r][0]+"="+encodeURI(params[r][1]);n.open("POST",i,!0),n.setRequestHeader("Content-type","application/x-www-form-urlencoded"),n.onreadystatechange=function(){4==n.readyState&&200==n.status&&wfu_Code_Objects[e].do_action("after_upload",n.responseText)},n.send(l)}}function wfu_Initialize_Params(){var e={};return e.version="full",e.general={},e.general.shortcode_id=0,e.general.unique_id="",
2
+ 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,t,a,s){0!=wfu_filesselected(e)&&wfu_selectsubdir_check(e)&&wfu_check_required_userdata(e,!0)&&wfu_Code_Objects[e].apply_filters("pre_start_check",!0)&&wfu_redirect_to_classic_cont(e,t,a,s)}function wfu_redirect_to_classic_cont(e,t,a,s){var n=function(n){var l="",r="wfu_askserver_success:",o="wfu_askserver_error:",_=n.indexOf(r),d=n.indexOf(o);if(_>-1){l=n.substr(_+r.length),wfu_Code_Objects[e].do_action("askserver_success",l,"no-ajax");var u=wfu_Initialize_Params();if(u.general.shortcode_id=e,u.general.unique_id="",u.general.files_count=wfu_filesselected(e),wfu_ProcessUploadComplete(e,0,u,"no-ajax","",t,"",["false","","false"]),1==a){var c="";document.getElementById("upfile_"+e).name="uploadedfile_"+e+"_redirected"+c}s>0?document.getElementById("adminerrorcodes_"+e).value=s:document.getElementById("adminerrorcodes_"+e).value="",document.getElementById("upfile_"+e).disabled=!1,document.getElementById("uniqueuploadid_"+e).value=i,document.getElementById("uploadform_"+e).submit()}else d>-1&&(l=n.substr(d+o.length),wfu_unlock_upload(e),wfu_Code_Objects[e].do_action("askserver_error",l))},i=wfu_randomString(10);wfu_lock_upload(e),wfu_Code_Objects[e].do_action("pre_start");var l="",r=wfu_Code_Objects[e].apply_filters("askserver_pass_params",{});for(var o in r)r.hasOwnProperty(o)&&(l+="&"+o+"="+r[o]);var _=new Date,d=GlobalData.consts.ajax_url+"?action=wfu_ajax_action_ask_server&wfu_uploader_nonce="+document.getElementById("wfu_uploader_nonce_"+e).value+"&sid="+e+"&unique_id="+i+"&start_time="+_.getTime()+"&session_token="+t+l,u=wfu_GetHttpRequestObject();if(null==u){var c=document.createElement("iframe");return c?(c.style.display="none",c.src=d,document.body.appendChild(c),void(c.onload=function(){n(c.contentDocument.body.innerHTML)})):void wfu_Code_Objects[e].do_action("not_supported")}u.open("GET",d,!0),u.onreadystatechange=function(){4==u.readyState&&(200==u.status?n(u.responseText):(alert(GlobalData.consts.remoteserver_noresult),wfu_Code_Objects[e].do_action("askserver_noresult")))},u.send(null)}function wfu_filesselected(e){var t=document.getElementById("fileName_"+e),a=wfu_get_filelist(e);return 0==a.length&&t&&(t.value=GlobalData.consts.nofilemessage,t.className="file_input_textbox_nofile"),a.length}function wfu_check_required_userdata(e,t){for(var a=wfu_get_userdata_count(e),s=!1,n=0;a>n;n++){var i=document.getElementById("hiddeninput_"+e+"_userdata_"+n),l=document.getElementById("userdata_"+e+"_fieldwrapper_"+n),r=document.getElementById("userdata_"+e+"_field_"+n),o=document.getElementById("userdata_"+e+"_"+n),_=document.getElementById("userdata_"+e+"_hint_"+n);i.value=window["userdata_"+e+"_codes_"+n].value(r);for(var d={hintposition:"none"},u=document.getElementById("userdata_"+e+"_props_"+n).value.split("|"),c=0;c<u.length;c++)"p:"==u[c].substr(0,2)&&(d.hintposition=u[c].substr(2));var m="";if("file_userdata_fieldwrapper_required"==l.className.substr(0,35)&&(m=window["userdata_"+e+"_codes_"+n].empty(i)),""===m&&window["userdata_"+e+"_codes_"+n].validate&&(m=window["userdata_"+e+"_codes_"+n].validate(i)),""!==m){if(t)if("none"==d.hintposition)_.className="file_userdata_hint_none";else{l.className="file_userdata_fieldwrapper_required_empty";var f=o.getBoundingClientRect(),p=l.getBoundingClientRect();"inline"==d.hintposition?(_.className="file_userdata_hint_inline",_.style.left=parseInt(p.left-f.left)+"px",_.style.top=parseInt(p.top-f.top)+"px",_.style.right=parseInt(f.right-p.right)+"px",_.style.bottom=parseInt(f.bottom-p.bottom)+"px"):"top"==d.hintposition?(_.className="file_userdata_hint_top",_.style.left=parseInt(p.left-f.left)+"px",_.style.bottom=parseInt(f.bottom-p.top)+"px"):"right"==d.hintposition?(_.className="file_userdata_hint_right",_.style.left=parseInt(p.right-f.left)+"px",_.style.top=parseInt(p.top-f.top)+"px"):"bottom"==d.hintposition?(_.className="file_userdata_hint_bottom",_.style.left=parseInt(p.left-f.left)+"px",_.style.top=parseInt(p.bottom-f.top)+"px"):"left"==d.hintposition&&(_.className="file_userdata_hint_left",_.style.right=parseInt(f.right-p.left)+"px",_.style.top=parseInt(p.top-f.top)+"px"),_.innerHTML=m,_.style.display="block"}s=!0}}return!s}function wfu_HTML5UploadFile(e,t,a){if(!wfu_BrowserCaps.supportsAJAX)return void wfu_redirect_to_classic(e,a,1,1);if(!wfu_BrowserCaps.supportsHTML5)return void wfu_redirect_to_classic(e,a,1,2);t=wfu_plugin_decode_string(t.replace(/^\s+|\s+$/g,""));var s=null;try{s=JSON.parse(t)}catch(n){}if(null==s)return void wfu_redirect_to_classic(e,a,1,3);var i=wfu_GetHttpRequestObject();if(null!=i){var l=wfu_filesselected(e);if(0!=l){var r=document.getElementById("upload_"+e),o=!r;if(!wfu_selectsubdir_check(e))return void(o&&wfu_clear_files(e));var _=l;if(_+=_,!wfu_check_required_userdata(e,!0))return void(o&&wfu_clear_files(e));if(wfu_Code_Objects[e].apply_filters("pre_start_check",!0)){var d=wfu_randomString(10);if(wfu_lock_upload(e),wfu_Code_Objects[e].do_action("pre_start"),wfu_Code_Objects[e].apply_filters("pre_start_ask_server",!1,s.has_filters)){var u=GlobalData.consts.ajax_url;params=new Array(5),params[0]=new Array(2),params[0][0]="action",params[0][1]="wfu_ajax_action_ask_server",params[1]=new Array(2),params[1][0]="session_token",params[1][1]=a,params[2]=new Array(2),params[2][0]="sid",params[2][1]=e,params[3]=new Array(2),params[3][0]="unique_id",params[3][1]=d,params[4]=new Array(2),params[4][0]="wfu_uploader_nonce",params[4][1]=document.getElementById("wfu_uploader_nonce_"+e).value;var c=wfu_Code_Objects[e].apply_filters("askserver_pass_params",{});for(var m in c)c.hasOwnProperty(m)&&params.push([m,c[m]]);for(var f="",p=0;p<params.length;p++)f+=(p>0?"&":"")+params[p][0]+"="+encodeURI(params[p][1]);i.open("POST",u,!0),i.setRequestHeader("Content-type","application/x-www-form-urlencoded"),i.onreadystatechange=function(){if(4==i.readyState)if(200==i.status){var t=i.responseText,n="",l="wfu_askserver_success:",r="wfu_askserver_error:",o=t.indexOf(l),_=t.indexOf(r);o>-1?(n=t.substr(o+l.length),wfu_Code_Objects[e].do_action("askserver_success",n,"ajax"),wfu_HTML5UploadFile_cont(e,s,a,d)):_>-1&&(n=t.substr(_+r.length),wfu_unlock_upload(e),wfu_Code_Objects[e].do_action("askserver_error",n))}else alert(GlobalData.consts.remoteserver_noresult),wfu_unlock_upload(e),wfu_Code_Objects[e].do_action("askserver_noresult")},i.send(f)}else wfu_HTML5UploadFile_cont(e,s,a,d)}}}}function wfu_HTML5UploadFile_cont(e,t,a,s){function n(l,r,o,u){m=!0;var f=wfu_GetHttpRequestObject(),p=wfu_GetHttpRequestObject();if(null!=f&&null!=p){var w=null,b=null;try{var w=new FormData,b=new FormData}catch(g){}if(null!=w&&null!=b){w.append("action","wfu_ajax_action"),w.append("wfu_uploader_nonce",document.getElementById("wfu_uploader_nonce_"+e).value),o||w.append("uploadedfile_"+e+d,r),w.append("uploadedfile_"+e+"_index",l),w.append("uploadedfile_"+e+"_name",wfu_plugin_encode_string(_[l].name)),w.append("uploadedfile_"+e+"_size",_[l].size),w.append("uniqueuploadid_"+e,s),w.append("params_index",t.params_index),w.append("subdir_sel_index",i),o?w.append("only_check","1"):w.append("only_check","0"),w.append("session_token",a);var y=wfu_Code_Objects[e].apply_filters("upload_pass_params",{},"ajax");for(var h in y)y.hasOwnProperty(h)&&w.append(h,y[h]);for(var v=wfu_get_userdata_count(e),k=0;v>k;k++)w.append("hiddeninput_"+e+"_userdata_"+k,document.getElementById("hiddeninput_"+e+"_userdata_"+k).value);if(wfu_initialize_fileupload_xhr(f,e,a,s,t,l,_[l].name),o||(f.size=r.size,f.totalsize=_[l].size,f.loading=!0),u){b.append("action","wfu_ajax_action"),b.append("wfu_uploader_nonce",document.getElementById("wfu_uploader_nonce_"+e).value),b.append("params_index",t.params_index),b.append("session_token",a),b.append("force_connection_close","1"),p.open("POST",GlobalData.consts.ajax_url,!1);try{p.send(b)}catch(I){}m="success"==p.responseText}if(m)o?(f.addEventListener("load",function(t){t={target:{responseText:t.target.responseText,shortcode_id:e,return_status:!0}};var a=wfu_uploadComplete.call(f,t);m="success"==a||"warning"==a,m&&n(l,r,!1,!1)},!1),f.addEventListener("error",function(e){},!1),f.open("POST",GlobalData.consts.ajax_url,!0),f.send(w)):(f.upload.xhr=f,f.upload.dummy=1,f.upload.addEventListener("loadstart",wfu_loadStart,!1),f.upload.addEventListener("progress",new Function("evt","wfu_uploadProgress(evt, "+e+", "+f.xhrid+", "+t.debugmode+");"),!1),f.addEventListener("load",wfu_uploadComplete,!1),f.addEventListener("error",new Function("evt","wfu_uploadFailed(evt, "+t.debugmode+");"),!1),f.addEventListener("abort",wfu_uploadCanceled,!1),f.open("POST",GlobalData.consts.ajax_url,!0),f.send(w));else{var B={target:{responseText:"",shortcode_id:e}};wfu_uploadComplete.call(f,B)}return c++,m}}}var i=-1,l=document.getElementById("selectsubdir_"+e);if(l){var r=document.getElementById("selectsubdiredit_"+e),o="none"!=r.style.display;i=o?r.value:l.selectedIndex}var _=wfu_get_filelist(e),d="";GlobalData.UploadInProgressString+="["+s+"]",GlobalData[e]={},GlobalData[e].unique_id=s,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(t.shortcode_id,"progressive"),wfu_attach_cancel_event(e,a,s,t);var u=wfu_Initialize_Params();u.general.shortcode_id=e,u.general.unique_id=s,wfu_ProcessUploadComplete(e,0,u,s,t.params_index,a,"",["false","","false"]);var c=0,m=!0,f=0;n(f,_[f],!0,!1)}function wfu_initialize_fileupload_xhr(e,t,a,s,n,i,l){var r=i>=0?GlobalData[t].xhrs.push(e)-1:-1,o=new Date;e.xhrid=r,e.shortcode_id=t,e.requesttype=i>=0?"fileupload":"email",e.file_id=i+1,e.size=0,e.totalsize=0,e.loading=!1,e.deltasize=0,e.sizeloaded=0,e.aborted=!1,e.unique_id=s,e.params_index=n.params_index,e.session_token=a,e.debugmode=n.debugmode,e.is_admin=n.is_admin,e.start_time=o.getTime(),e.end_time=e.start_time,e.finish_time=e.start_time+1e3*parseInt(GlobalData.consts.max_time_limit),e.fail_colors=n.fail_colors,e.error_message_header=n.error_header.replace(/%username%/g,"no data"),e.error_message_header=e.error_message_header.replace(/%useremail%/g,"no data"),e.error_message_header=e.error_message_header.replace(/%filename%/g,l),e.error_message_header=e.error_message_header.replace(/%filepath%/g,l),e.error_message_failed=GlobalData.consts.message_failed,e.error_message_cancelled=GlobalData.consts.message_cancelled,e.error_adminmessage_unknown=GlobalData.consts.adminmessage_unknown.replace(/%username%/g,"no data"),e.error_adminmessage_unknown=e.error_adminmessage_unknown.replace(/%useremail%/g,"no data"),e.error_adminmessage_unknown=e.error_adminmessage_unknown.replace(/%filename%/g,l),e.error_adminmessage_unknown=e.error_adminmessage_unknown.replace(/%filepath%/g,l)}function wfu_get_userdata_count(e){for(var t=0;document.getElementById("userdata_"+e+"_"+t);)t++;return t}function wfu_lock_upload(e){document.getElementById("fileName_"+e);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 a=wfu_get_userdata_count(e),s=0;a>s;s++)window["userdata_"+e+"_codes_"+s].lock(document.getElementById("userdata_"+e+"_field_"+s));wfu_Code_Objects[e].do_action("lock_upload")}function wfu_unlock_upload(e){document.getElementById("fileName_"+e);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 a=wfu_get_userdata_count(e),s=0;a>s;s++)window["userdata_"+e+"_codes_"+s].unlock(document.getElementById("userdata_"+e+"_field_"+s));wfu_Code_Objects[e].do_action("unlock_upload")}function wfu_clear_files(e){document.getElementById("uploadform_"+e).reset();var t=document.getElementById("upfile_"+e);"undefined"!=typeof t.filearray&&(t.filearray.length=0,t.filearrayprops.length=0);var a=document.getElementById("fileName_"+e);a&&(a.value="",a.className="file_input_textbox")}function wfu_clear(e){wfu_clear_files(e);var t=document.getElementById("selectsubdir_"+e);if(t){var a=document.getElementById("selectsubdiredit_"+e),s="none"!=a.style.display;s?(t.selectedIndex=-1,a.value=""):(t.options[0].style.display="block",t.selectedIndex=parseInt(document.getElementById("selectsubdirdefault_"+e).value),t.selectedIndex<0&&(t.selectedIndex=0))}for(var n=wfu_get_userdata_count(e),i=0;n>i;i++)window["userdata_"+e+"_codes_"+i].reset(document.getElementById("userdata_"+e+"_field_"+i),document.getElementById("hiddeninput_"+e+"_userdata_"+i));wfu_Code_Objects[e].do_action("clear_upload")}function wfu_reset_message(e){var t=document.getElementById("wfu_messageblock_"+e);if(t){document.getElementById("wfu_messageblock_header_"+e).style.display="";var a=document.getElementById("wfu_messageblock_header_"+e+"_container");UploadStates[e]&&(a.innerHTML=UploadStates[e].State0),document.getElementById("wfu_messageblock_header_"+e+"_state").value="none",document.getElementById("wfu_messageblock_arrow_"+e).style.display="none",a.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++)t.tBodies[0].removeChild(document.getElementById("wfu_messageblock_"+e+"_"+n)),t.tBodies[0].removeChild(document.getElementById("wfu_messageblock_subheader_"+e+"_"+n))}}function wfu_show_simple_progressbar(e,t){var a=document.getElementById("progressbar_"+e+"_animation"),s=document.getElementById("progressbar_"+e+"_imagesafe");a&&("progressive"==t?(a.style.width="0%",a.className="file_progress_progressive",s.style.display="none",a.style.display="block"):wfu_BrowserCaps.supportsAnimation?(a.style.width="25%",a.className="file_progress_shuffle",s.style.display="none",a.style.display="block"):(a.style.width="0%",a.className="file_progress_noanimation",a.style.display="none",s.style.display="block"),document.getElementById("wordpress_file_upload_progressbar_"+e).style.display="block")}function wfu_hide_simple_progressbar(e){var t=document.getElementById("progressbar_"+e+"_animation"),a=document.getElementById("progressbar_"+e+"_imagesafe");t&&(document.getElementById("wordpress_file_upload_progressbar_"+e).style.display="none",t.style.width="0%",t.className="file_progress_noanimation",a.style.display="none",t.style.display="block")}function wfu_invoke_shortcode_editor(e,t,a,s){for(var n=document.getElementsByTagName("BUTTON"),i=0,l=null,r=0;r<n.length;r++)n[r].parentNode&&n[r].parentNode.id==s+"_editor_"+e&&(l=n[r],i++);if(0!=i){if(i>1)return void alert(GlobalData.consts.same_pluginid);var o=wfu_GetHttpRequestObject();if(null!=o){l.parentNode.style.display="none",document.getElementById(s+"_overlay_"+e).style.display="block";var _=GlobalData.consts.ajax_url;params=new Array(6),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]=t,params[3]=new Array(2),params[3][0]="post_hash",params[3][1]=a,params[4]=new Array(2),params[4][0]="shortcode_tag",params[4][1]=s,params[5]=new Array(2),params[5][0]="widget_id",params[5][1]=document.getElementById(s+"_"+e+"_widgetid")?document.getElementById(s+"_"+e+"_widgetid").value:"";for(var d="",r=0;r<params.length;r++)d+=(r>0?"&":"")+params[r][0]+"="+encodeURI(params[r][1]);o.open("POST",_,!0),o.setRequestHeader("Content-type","application/x-www-form-urlencoded"),o.onreadystatechange=function(){if(4==o.readyState&&200==o.status){document.getElementById(s+"_overlay_"+e).style.display="none",l.parentNode.removeAttribute("style");var t="wfu_edit_shortcode:",a=o.responseText.indexOf(t);-1==a&&(a=o.responseText.length);var n=(o.responseText.substr(0,a),o.responseText.substr(a+t.length,o.responseText.length-a-t.length));a=n.indexOf(":");var i=n.substr(0,a);if(txt_value=n.substr(a+1,n.length-a-1),"success"==i){var r=window.open(wfu_plugin_decode_string(txt_value),"_blank");r?r.plugin_window=window:alert(GlobalData.consts.enable_popups)}else"check_page_obsolete"==i&&alert(txt_value)}},o.send(d)}}}GlobalData={},UploadStates={},Code_Initializators=[],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="",GlobalData.FreeChangeHandler=!1,wfu_Check_Browser_Capabilities(),Code_Initializators[Code_Initializators.length]=function(sid){var CBUV_Code_Objects={};return CBUV_Code_Objects.pre_start_ask_server=function(e,t){if(e)return e;this.sid;return"true"==t},CBUV_Code_Objects.askserver_pass_params=function(e){for(var t=this.sid,a=wfu_get_filelist(t),s="",n="",i=0;i<a.length;i++)i>0&&(s+=";",n+=";"),s+=wfu_plugin_encode_string(a[i].name),n+=a[i].size;return e.filenames=s,e.filesizes=n,e},CBUV_Code_Objects.askserver_success=function(response,mode){var sid=this.sid,upload_status="success",txt_match=response.match(/CBUVJS\[(.*?)\]/),txt_header=txt_match&&"undefined"!=typeof txt_match[1]?txt_match[1]:"";""!=txt_header&&eval(txt_header)},CBUV_Code_Objects.askserver_error=function(response,mode){var sid=this.sid,upload_status="error",txt_match=response.match(/CBUVJS\[(.*?)\]/),txt_header=txt_match&&"undefined"!=typeof txt_match[1]?txt_match[1]:"";if(""!=txt_header&&eval(txt_header),txt_match=response.match(/CBUV\[(.*?)\]/),txt_header=txt_match&&"undefined"!=typeof txt_match[1]?txt_match[1]:"",""!=txt_header){var Params=wfu_Initialize_Params();Params.general.shortcode_id=sid,Params.general.message=txt_header,Params.general.state=12,wfu_ProcessUploadComplete(sid,0,Params,"no-ajax","","","",["false","","false"]),wfu_clear(sid)}},CBUV_Code_Objects.after_upload=function(response){var sid=this.sid,txt_match=response.match(/CBUVJS\[(.*?)\]/),txt_header=txt_match&&"undefined"!=typeof txt_match[1]?txt_match[1]:"";""!=txt_header&&eval(txt_header)},CBUV_Code_Objects},wfu_initialize_webcam=function(e,t,a,s,n,i,l,r,o){"undefined"==typeof wfu_parse_video_width&&(wfu_parse_video_width=function(e){var t=parseInt(e);t>0&&(this.empty=!1,this.video.width=t)}),"undefined"==typeof wfu_parse_video_height&&(wfu_parse_video_height=function(e){var t=parseInt(e);t>0&&(this.empty=!1,this.video.height=t)}),"undefined"==typeof wfu_parse_video_aspectratio&&(wfu_parse_video_aspectratio=function(e){var t=parseFloat(e);t>0&&(this.empty=!1,this.video.aspectRatio=t)}),"undefined"==typeof wfu_parse_video_framerate&&(wfu_parse_video_framerate=function(e){var t=parseFloat(e);t>0&&(this.empty=!1,this.video.frameRate=t)}),"undefined"==typeof wfu_parse_video_facingmode&&(wfu_parse_video_facingmode=function(e){var t="front"==e?"user":"back"==e?"environment":"";""!=t&&(this.empty=!1,this.video.facingMode=t)});var _={empty:!0,video:{}};wfu_parse_video_width.call(_,s),wfu_parse_video_height.call(_,n),wfu_parse_video_aspectratio.call(_,i),wfu_parse_video_framerate.call(_,l),wfu_parse_video_facingmode.call(_,r);var d={mode:t,audio:"true"==a,video:_.empty?!0:_.video,maxrecordtime:o};window["wfu_webcam_props_"+e]=d,wfu_reinitialize_webcam(e)},wfu_reinitialize_webcam=function(e){window["wfu_webcam_props_"+e].active=!0,window["wfu_webcam_props_"+e].width=0,window["wfu_webcam_props_"+e].width=0,window["wfu_webcam_props_"+e].timeStart=0,window["wfu_webcam_props_"+e].duration=0,window["wfu_webcam_props_"+e].counting=!1,window["wfu_webcam_props_"+e].stream=null,window["wfu_webcam_props_"+e].media=null,window["wfu_webcam_props_"+e].blobs=null,window["wfu_webcam_props_"+e].playing=!1;var t=window["wfu_webcam_props_"+e],a=document.getElementById("webcam_"+e+"_box"),s=document.getElementById("webcam_"+e+"_webcamoff");s.style.display="none",a.style.display="block";var n={audio:t.audio,video:t.video};"undefined"==typeof Promise&&(Promise=function(e){this.mainCallback=e,this.then=function(e){return this.successCallback=e,this},this["catch"]=function(t){e(this.successCallback,t)}},PromiseRejected=function(e){this.then=function(e){return this},this["catch"]=function(t){t(e)}},Promise.reject=function(e){return new PromiseRejected(e)});var i=function(e,t,a){var s=navigator.getUserMedia||navigator.webkitGetUserMedia||navigator.mozGetUserMedia||navigator.msGetUserMedia;return s&&"undefined"!=typeof MediaRecorder?new Promise(function(t,a){s.call(navigator,e,t,a)}):Promise.reject(new Error("getUserMedia is not implemented in this browser"))};void 0===navigator.mediaDevices&&(navigator.mediaDevices={}),void 0===navigator.mediaDevices.getUserMedia&&(navigator.mediaDevices.getUserMedia=i),navigator.mediaDevices.getUserMedia(n).then(function(s){window["wfu_webcam_props_"+e].stream=s,a.autoplay=!0,a.ontimeupdate=null,a.onerror=null,a.onloadeddata=function(t){wfu_webcam_init_callback(e)},a.src=window.URL.createObjectURL(s),wfu_initialize_webcam_nav(e,t.mode)})["catch"](function(t){console.log("Video not supported!",t),document.getElementById("webcam_"+e+"_inner").className="wfu_file_webcam_inner wfu_webcam_notsupported"})},wfu_webcam_init_callback=function(e){var t=document.getElementById("webcam_"+e+"_inner"),a=document.getElementById("webcam_"+e+"_box");window["wfu_webcam_props_"+e].width=a.videoWidth,window["wfu_webcam_props_"+e].height=a.videoHeight;var s='<svg xmlns="http://www.w3.org/2000/svg" width="'+a.videoWidth+'" height="'+a.videoHeight+'"></svg>',n=new Blob([s],{type:"image/svg+xml;charset=utf-8"}),i=document.getElementById("webcam_"+e+"_webcamoff_img");i.src=window.URL.createObjectURL(n),i.style.width=t.clientWidth+"px",i.style.height=t.clientHeight+"px"},wfu_initialize_webcam_nav=function(e,t){"undefined"==typeof SVGInjector&&!function(e,t){"use strict";function a(e){e=e.split(" ");for(var t={},a=e.length,s=[];a--;)t.hasOwnProperty(e[a])||(t[e[a]]=1,s.unshift(e[a]));return s.join(" ")}var s="file:"===e.location.protocol,n=t.implementation.hasFeature("http://www.w3.org/TR/SVG11/feature#BasicStructure","1.1"),i=Array.prototype.forEach||function(e,t){if(void 0===this||null===this||"function"!=typeof e)throw new TypeError;var a,s=this.length>>>0;for(a=0;s>a;++a)a in this&&e.call(t,this[a],a,this)},l={},r=0,o=[],_=[],d={},u=function(e){return e.cloneNode(!0)},c=function(e,t){_[e]=_[e]||[],_[e].push(t)},m=function(e){for(var t=0,a=_[e].length;a>t;t++)!function(t){setTimeout(function(){_[e][t](u(l[e]))},0)}(t)},f=function(t,a){if(void 0!==l[t])l[t]instanceof SVGSVGElement?a(u(l[t])):c(t,a);else{if(!e.XMLHttpRequest)return a("Browser does not support XMLHttpRequest"),!1;l[t]={},c(t,a);var n=new XMLHttpRequest;n.onreadystatechange=function(){if(4===n.readyState){if(404===n.status||null===n.responseXML)return a("Unable to load SVG file: "+t),s&&a("Note: SVG injection ajax calls do not work locally without adjusting security setting in your browser. Or consider using a local webserver."),a(),!1;if(!(200===n.status||s&&0===n.status))return a("There was a problem injecting the SVG: "+n.status+" "+n.statusText),!1;if(n.responseXML instanceof Document)l[t]=n.responseXML.documentElement;else if(DOMParser&&DOMParser instanceof Function){var e;try{var i=new DOMParser;e=i.parseFromString(n.responseText,"text/xml")}catch(r){e=void 0}if(!e||e.getElementsByTagName("parsererror").length)return a("Unable to parse SVG file: "+t),!1;l[t]=e.documentElement}m(t)}},n.open("GET",t),n.overrideMimeType&&n.overrideMimeType("text/xml"),n.send()}},p=function(t,s,l,_){var u=t.getAttribute("data-src")||t.getAttribute("src");if(!/\.svg/i.test(u))return void _("Attempted to inject a file with a non-svg extension: "+u);if(!n){var c=t.getAttribute("data-fallback")||t.getAttribute("data-png");return void(c?(t.setAttribute("src",c),_(null)):l?(t.setAttribute("src",l+"/"+u.split("/").pop().replace(".svg",".png")),_(null)):_("This browser does not support SVG and no PNG fallback was defined."))}-1===o.indexOf(t)&&(o.push(t),t.setAttribute("src",""),f(u,function(n){if("undefined"==typeof n||"string"==typeof n)return _(n),!1;var l=t.getAttribute("id");l&&n.setAttribute("id",l);var c=t.getAttribute("title");c&&n.setAttribute("title",c);var m=[].concat(n.getAttribute("class")||[],"injected-svg",t.getAttribute("class")||[]).join(" ");n.setAttribute("class",a(m));var f=t.getAttribute("style");f&&n.setAttribute("style",f);var p=[].filter.call(t.attributes,function(e){return/^data-\w[\w\-]*$/.test(e.name)});i.call(p,function(e){e.name&&e.value&&n.setAttribute(e.name,e.value)});var w,b,g,y,h,v={clipPath:["clip-path"],"color-profile":["color-profile"],cursor:["cursor"],filter:["filter"],linearGradient:["fill","stroke"],marker:["marker","marker-start","marker-mid","marker-end"],mask:["mask"],pattern:["fill","stroke"],radialGradient:["fill","stroke"]};Object.keys(v).forEach(function(e){w=e,g=v[e],b=n.querySelectorAll("defs "+w+"[id]");for(var t=0,a=b.length;a>t;t++){y=b[t].id,h=y+"-"+r;var s;i.call(g,function(e){s=n.querySelectorAll("["+e+'*="'+y+'"]');for(var t=0,a=s.length;a>t;t++)s[t].setAttribute(e,"url(#"+h+")")}),b[t].id=h}}),n.removeAttribute("xmlns:a");for(var k,I,B=n.querySelectorAll("script"),x=[],G=0,E=B.length;E>G;G++)I=B[G].getAttribute("type"),I&&"application/ecmascript"!==I&&"application/javascript"!==I||(k=B[G].innerText||B[G].textContent,x.push(k),n.removeChild(B[G]));if(x.length>0&&("always"===s||"once"===s&&!d[u])){for(var j=0,D=x.length;D>j;j++)new Function(x[j])(e);d[u]=!0}var P=n.querySelectorAll("style");i.call(P,function(e){e.textContent+=""}),t.parentNode.replaceChild(n,t),delete o[o.indexOf(t)],t=null,r++,_(n)}))},w=function(e,t,a){t=t||{};var s=t.evalScripts||"always",n=t.pngFallback||!1,l=t.each;if(void 0!==e.length){var r=0;i.call(e,function(t){p(t,s,n,function(t){l&&"function"==typeof l&&l(t),a&&e.length===++r&&a(r)})})}else e?p(e,s,n,function(t){l&&"function"==typeof l&&l(t),a&&a(1),e=null}):a&&a(0)};"object"==typeof module&&"object"==typeof module.exports?module.exports=exports=w:"function"==typeof define&&define.amd?define(function(){return w}):"object"==typeof e&&(e.SVGInjector=w)}(window,document),"1"!=document.getElementById("webcam_"+e+"_btns_converted").value&&(SVGInjector(document.getElementById("webcam_"+e+"_btns")),document.getElementById("webcam_"+e+"_btns_converted").value="1"),"capture video"==t?wfu_webcam_set_nav_status(e,"idle_only_video"):"take photos"==t?wfu_webcam_set_nav_status(e,"idle_only_pictures"):"both"==t?wfu_webcam_set_nav_status(e,"idle_video_and_pictures"):wfu_webcam_set_nav_status(e,"idle_only_video")},wfu_webcam_set_nav_status=function(e,t){var a=document.getElementById("webcam_"+e+"_btn_onoff"),s=document.getElementById("webcam_"+e+"_nav"),n=document.getElementById("webcam_"+e+"_btn_video"),i=document.getElementById("webcam_"+e+"_btn_record"),l=document.getElementById("webcam_"+e+"_btn_play"),r=document.getElementById("webcam_"+e+"_btn_stop"),o=document.getElementById("webcam_"+e+"_btn_pause"),_=document.getElementById("webcam_"+e+"_btn_pos"),d=document.getElementById("webcam_"+e+"_btn_back"),u=document.getElementById("webcam_"+e+"_btn_fwd"),c=document.getElementById("webcam_"+e+"_btn_time"),m=document.getElementById("webcam_"+e+"_btn_picture"),f=document.getElementById("webcam_"+e+"_screenshot");a.style.display="block","hidden"==t?s.style.display="none":"recording"==t?(s.removeAttribute("style"),s.className="wfu_file_webcam_nav wfu_recording",n.style.display="none",i.style.display="block",i.style.visibility="visible",i.setAttribute("class","wfu_file_webcam_btn wfu_file_webcam_btn_record wfu_recording"),r.style.display="block",r.style.visibility="visible",l.style.display="block",l.style.visibility="hidden",o.style.display="block",o.style.visibility="hidden",_.style.display="block",_.style.visibility="hidden",d.style.display="block",d.style.visibility="hidden",u.style.display="block",u.style.visibility="hidden",c.style.display="block",c.style.visibility="visible",m.style.display="none",f.style.display="none"):"after_recording"==t?(s.removeAttribute("style"),s.className="wfu_file_webcam_nav wfu_stream_ready",n.style.display="block",n.setAttribute("class","wfu_file_webcam_btn wfu_file_webcam_btn_video"),i.style.display="none",r.style.display="block",r.style.visibility="hidden",l.style.display="block",l.style.visibility="hidden",o.style.display="block",o.style.visibility="hidden",_.style.display="block",_.style.visibility="hidden",d.style.display="block",d.style.visibility="hidden",u.style.display="block",u.style.visibility="hidden",c.style.display="block",c.style.visibility="hidden",m.style.display="none",f.style.display="block"):"ready_playback"==t?(s.removeAttribute("style"),s.className="wfu_file_webcam_nav wfu_stream_ready",n.style.display="block",n.setAttribute("class","wfu_file_webcam_btn wfu_file_webcam_btn_video"),i.style.display="none",r.style.display="block",r.style.visibility="hidden",l.style.display="block",l.style.visibility="visible",l.setAttribute("class","wfu_file_webcam_btn wfu_file_webcam_btn_play"),o.style.display="block",o.style.visibility="visible",o.setAttribute("class","wfu_file_webcam_btn_disabled wfu_file_webcam_btn_pause_disabled"),_.style.display="block",_.style.visibility="visible",d.style.display="block",d.style.visibility="visible",u.style.display="block",u.style.visibility="visible",c.style.display="block",c.style.visibility="visible",m.style.display="none",f.style.display="none"):"after_screenshot"==t?(s.removeAttribute("style"),s.className="wfu_file_webcam_nav wfu_stream_ready",n.style.display="block",n.setAttribute("class","wfu_file_webcam_btn wfu_file_webcam_btn_video"),i.style.display="none",r.style.display="block",r.style.visibility="hidden",l.style.display="block",l.style.visibility="hidden",o.style.display="block",o.style.visibility="hidden",_.style.display="block",_.style.visibility="hidden",d.style.display="block",d.style.visibility="hidden",u.style.display="block",u.style.visibility="hidden",c.style.display="block",c.style.visibility="hidden",m.style.display="none",f.style.display="block"):"playing"==t?(s.removeAttribute("style"),s.className="wfu_file_webcam_nav wfu_stream_ready",n.style.display="block",n.setAttribute("class","wfu_file_webcam_btn_disabled wfu_file_webcam_btn_video_disabled"),i.style.display="none",r.style.display="block",r.style.visibility="hidden",l.style.display="block",l.style.visibility="visible",l.setAttribute("class","wfu_file_webcam_btn_disabled wfu_file_webcam_btn_play_disabled"),o.style.display="block",
3
+ o.style.visibility="visible",o.setAttribute("class","wfu_file_webcam_btn wfu_file_webcam_btn_pause"),_.style.display="block",_.style.visibility="visible",d.style.display="block",d.style.visibility="visible",u.style.display="block",u.style.visibility="visible",c.style.display="block",c.style.visibility="visible",m.style.display="none",f.style.display="none"):(s.removeAttribute("style"),s.className="wfu_file_webcam_nav wfu_rec_ready",n.style.display="none",i.style.display="none",r.style.display="none",l.style.display="none",o.style.display="none",_.style.display="none",d.style.display="none",u.style.display="none",c.style.display="none",m.style.display="none",f.style.display="none",("idle_only_video"==t||"idle_video_and_pictures"==t)&&(i.style.display="block",i.setAttribute("class","wfu_file_webcam_btn wfu_file_webcam_btn_record")),("idle_only_pictures"==t||"idle_video_and_pictures"==t)&&(m.style.display="block"))},wfu_webcam_counter_status=function(e,t){if("start"==t){var a=new Date;window["wfu_webcam_props_"+e].duration=0,window["wfu_webcam_props_"+e].timeStart=a.getTime()/1e3,window["wfu_webcam_props_"+e].counting=!0,wfu_webcam_update_counter(e)}else{var a=new Date;window["wfu_webcam_props_"+e].duration=a.getTime()/1e3-window["wfu_webcam_props_"+e].timeStart,window["wfu_webcam_props_"+e].counting=!1}},wfu_webcam_update_counter=function(e){if(window["wfu_webcam_props_"+e].counting){var t=new Date,a=t.getTime()/1e3-window["wfu_webcam_props_"+e].timeStart;wfu_webcam_update_timer(e,a),setTimeout(function(){wfu_webcam_update_counter(e)},100)}},wfu_webcam_update_timer=function(e,t){var a=Math.floor(t/3600);t-=3600*a;var s=Math.floor(t/60);t-=60*s;var n=Math.floor(t);1e3*(t-Math.floor(t));document.getElementById("webcam_"+e+"_btn_time_label").innerHTML=(a>0?a+":":"")+(10>s?"0":"")+s+":"+(10>n?"0":"")+n},wfu_webcam_onoff=function(e){if(window["wfu_webcam_props_"+e].active){var t=document.getElementById("webcam_"+e+"_inner"),a=document.getElementById("webcam_"+e+"_box"),s=document.getElementById("webcam_"+e+"_webcamoff"),n=document.getElementById("webcam_"+e+"_webcamoff_img");n.style.width=t.clientWidth+"px",n.style.height=t.clientHeight+"px",a.pause(),a.src="",a.load(),window["wfu_webcam_props_"+e].stream&&window["wfu_webcam_props_"+e].stream.stop&&window["wfu_webcam_props_"+e].stream.stop(),window["wfu_webcam_props_"+e].stream=null,window["wfu_webcam_props_"+e].media=null,window["wfu_webcam_props_"+e].blobs=null,wfu_webcam_set_nav_status(e,"hidden"),a.style.display="none",document.getElementById("webcam_"+e+"_screenshot").src="",s.style.display="block",window["wfu_webcam_props_"+e].active=!1}else wfu_reinitialize_webcam(e);wfu_selectbutton_clicked(e)},wfu_webcam_golive=function(e){window["wfu_webcam_props_"+e].playing||(wfu_reinitialize_webcam(e),wfu_add_files(e,[],!1),wfu_selectbutton_clicked(e),wfu_update_uploadbutton_status(e))},wfu_webcam_start_rec=function(e){if(!window["wfu_webcam_props_"+e].media||!window["wfu_webcam_props_"+e].media.state||"recording"!=window["wfu_webcam_props_"+e].media.state){try{window["wfu_webcam_props_"+e].media=new MediaRecorder(window["wfu_webcam_props_"+e].stream)}catch(t){return void alert(document.getElementById("webcam_"+e+"_video_notsupported").value)}window["wfu_webcam_props_"+e].blobs=[],window["wfu_webcam_props_"+e].media.ondataavailable=function(t){var a=new Date,s=a.getTime()/1e3-window["wfu_webcam_props_"+e].timeStart;-1==window["wfu_webcam_props_"+e].maxrecordtime||window["wfu_webcam_props_"+e].maxrecordtime>0&&s<=window["wfu_webcam_props_"+e].maxrecordtime?t.data&&t.data.size>0&&window["wfu_webcam_props_"+e].blobs.push(t.data):wfu_webcam_stop_rec(e)},wfu_webcam_set_nav_status(e,"recording"),wfu_webcam_counter_status(e,"start"),window["wfu_webcam_props_"+e].media.onstop=function(t){wfu_webcam_counter_status(e,"stop"),wfu_webcam_set_nav_status(e,"after_recording"),wfu_webcam_onstop(t,e)},window["wfu_webcam_props_"+e].media.start(10)}},wfu_webcam_stop_rec=function(e){window["wfu_webcam_props_"+e].media.stop()},wfu_webcam_onstop=function(e,t){if(0==window["wfu_webcam_props_"+t].blobs.length)alert(document.getElementById("webcam_"+t+"_video_nothingrecorded").value),wfu_webcam_golive(t);else{var a=document.getElementById("webcam_"+t+"_box"),s=document.getElementById("webcam_"+t+"_canvas"),n=document.getElementById("webcam_"+t+"_screenshot");if(window["wfu_webcam_props_"+t].stream){s.width=a.clientWidth,s.height=a.clientHeight;var i=s.getContext("2d");i.drawImage(a,0,0,a.clientWidth,a.clientHeight),n.src=s.toDataURL("image/webp")}var l=new Blob(window["wfu_webcam_props_"+t].blobs,{type:"video/mp4"});a.autoplay=!1,a.ontimeupdate=function(e){wfu_webcam_update_pos(t)},a.onended=function(e){wfu_webcam_ended(t)},a.onloadeddata=function(e){a.readyState>=2&&wfu_webcam_set_nav_status(t,"ready_playback")},a.onerror=function(e){a.onloadeddata=null,a.src=window.URL.createObjectURL(window["wfu_webcam_props_"+t].stream)},a.src=window.URL.createObjectURL(l),l.name="video.mp4",wfu_add_files(t,[{file:l,props:{}}],!1),wfu_update_uploadbutton_status(t)}},wfu_webcam_play=function(e){if(!window["wfu_webcam_props_"+e].playing){var t=document.getElementById("webcam_"+e+"_box");wfu_webcam_set_nav_status(e,"playing"),window["wfu_webcam_props_"+e].playing=!0,t.play()}},wfu_webcam_ended=function(e){var t=document.getElementById("webcam_"+e+"_box");t.src=t.src,wfu_webcam_set_nav_status(e,"ready_playback"),window["wfu_webcam_props_"+e].playing=!1},wfu_webcam_pause=function(e){var t=document.getElementById("webcam_"+e+"_box");t.pause(),wfu_webcam_set_nav_status(e,"ready_playback"),window["wfu_webcam_props_"+e].playing=!1},wfu_webcam_back=function(e){var t=document.getElementById("webcam_"+e+"_box");t.src=t.src,t.currentTime=0},wfu_webcam_fwd=function(e){var t=document.getElementById("webcam_"+e+"_box");t.currentTime=isFinite(t.duration)?t.duration:2*window["wfu_webcam_props_"+e].duration},wfu_webcam_take_picture=function(e){var t=document.getElementById("webcam_"+e+"_box"),a=document.getElementById("webcam_"+e+"_canvas"),s=document.getElementById("webcam_"+e+"_screenshot");if(window["wfu_webcam_props_"+e].stream){a.width=t.clientWidth,a.height=t.clientHeight;var n=a.getContext("2d");n.drawImage(t,0,0,t.clientWidth,t.clientHeight),s.src=a.toDataURL("image/webp"),wfu_webcam_set_nav_status(e,"after_screenshot"),window.wfu_toBlob_function_initialized||(!function(e){"use strict";var t=e.HTMLCanvasElement&&e.HTMLCanvasElement.prototype,a=e.Blob&&function(){try{return Boolean(new Blob)}catch(e){return!1}}(),s=a&&e.Uint8Array&&function(){try{return 100===new Blob([new Uint8Array(100)]).size}catch(e){return!1}}(),n=e.BlobBuilder||e.WebKitBlobBuilder||e.MozBlobBuilder||e.MSBlobBuilder,i=/^data:((.*?)(;charset=.*?)?)(;base64)?,/,l=(a||n)&&e.atob&&e.ArrayBuffer&&e.Uint8Array&&function(e){var t,l,r,o,_,d,u,c,m;if(t=e.match(i),!t)throw new Error("invalid data URI");for(l=t[2]?t[1]:"text/plain"+(t[3]||";charset=US-ASCII"),r=!!t[4],o=e.slice(t[0].length),_=r?atob(o):decodeURIComponent(o),d=new ArrayBuffer(_.length),u=new Uint8Array(d),c=0;c<_.length;c+=1)u[c]=_.charCodeAt(c);return a?new Blob([s?u:d],{type:l}):(m=new n,m.append(d),m.getBlob(l))};e.HTMLCanvasElement&&!t.toBlob&&(t.mozGetAsFile?t.toBlob=function(e,a,s){e(s&&t.toDataURL&&l?l(this.toDataURL(a,s)):this.mozGetAsFile("blob",a))}:t.toDataURL&&l&&(t.toBlob=function(e,t,a){e(l(this.toDataURL(t,a)))})),"function"==typeof define&&define.amd?define(function(){return l}):"object"==typeof module&&module.exports?module.exports=l:e.dataURLtoBlob=l}(window),window.wfu_toBlob_function_initialized=!0),a.toBlob&&a.toBlob(function(t){t.name="image.png",wfu_add_files(e,[{file:t,props:{}}],!1),wfu_update_uploadbutton_status(e)},"image/png")}},wfu_webcam_update_pos=function(e){var t=document.getElementById("webcam_"+e+"_box"),a=document.getElementById("webcam_"+e+"_btn_pointer"),s=isFinite(t.duration)?t.duration:window["wfu_webcam_props_"+e].duration,n=Math.round(t.currentTime/s*100);a.style.left=n+"%",wfu_webcam_update_timer(e,t.currentTime)};
lib/wfu_widget.php CHANGED
@@ -23,7 +23,11 @@ class WFU_Widget extends WP_Widget {
23
  if ( ! empty( $instance['title'] ) ) {
24
  echo $args['before_title'] . apply_filters( 'widget_title', $instance['title'] ). $args['after_title'];
25
  }
26
- echo do_shortcode('[wordpress_file_upload uploadid="'.$instance['shortcode_id'].'" widgetid="'.$this->id.'" placements="filename+selectbutton/uploadbutton+progressbar/message" fitmode="responsive" '.$instance['shortcode_attrs'].']');
 
 
 
 
27
  echo $args['after_widget'];
28
  }
29
 
@@ -92,17 +96,19 @@ class WFU_Widget extends WP_Widget {
92
  *
93
  * @param string $shortcode_attrs the new shortcode attributes.
94
  */
95
- public function update_external($shortcode_attrs) {
96
  $all_instances = $this->get_settings();
97
  $instance = $all_instances[$this->number];
98
  $_POST['widget-'.$this->id_base][$this->number]['title'] = ! empty( $instance['title'] ) ? $instance['title'] : WFU_WIDGET_SIDEBAR_DEFAULTTITLE;
99
  $_POST['widget-'.$this->id_base][$this->number]['shortcode_attrs'] = $shortcode_attrs;
100
- $_POST['widget-'.$this->id_base][$this->number]['shortcode_id'] = ! empty( $instance['shortcode_id'] ) ? $instance['shortcode_id'] : '';
101
- if ( $_POST['widget-'.$this->id_base][$this->number]['shortcode_id'] == '' ) {
102
  mt_srand((double)microtime()*1000000);
103
- $_POST['widget-'.$this->id_base][$this->number]['shortcode_id'] = (string)mt_rand(1000, 9999);
104
  }
 
105
  $this->update_callback();
 
106
  }
107
 
108
  }
23
  if ( ! empty( $instance['title'] ) ) {
24
  echo $args['before_title'] . apply_filters( 'widget_title', $instance['title'] ). $args['after_title'];
25
  }
26
+
27
+ $shortcode_attrs = ! empty( $instance['shortcode_attrs'] ) ? $instance['shortcode_attrs'] : '';
28
+ $shortcode_id = ! empty( $instance['shortcode_id'] ) ? $instance['shortcode_id'] : $this->update_external();
29
+
30
+ echo do_shortcode('[wordpress_file_upload uploadid="'.$shortcode_id.'" widgetid="'.$this->id.'" placements="filename+selectbutton/uploadbutton+progressbar/message" fitmode="responsive" '.$shortcode_attrs.']');
31
  echo $args['after_widget'];
32
  }
33
 
96
  *
97
  * @param string $shortcode_attrs the new shortcode attributes.
98
  */
99
+ public function update_external($shortcode_attrs = '') {
100
  $all_instances = $this->get_settings();
101
  $instance = $all_instances[$this->number];
102
  $_POST['widget-'.$this->id_base][$this->number]['title'] = ! empty( $instance['title'] ) ? $instance['title'] : WFU_WIDGET_SIDEBAR_DEFAULTTITLE;
103
  $_POST['widget-'.$this->id_base][$this->number]['shortcode_attrs'] = $shortcode_attrs;
104
+ $shortcode_id = ! empty( $instance['shortcode_id'] ) ? $instance['shortcode_id'] : '';
105
+ if ( $shortcode_id == '' ) {
106
  mt_srand((double)microtime()*1000000);
107
+ $shortcode_id = (string)mt_rand(1000, 9999);
108
  }
109
+ $_POST['widget-'.$this->id_base][$this->number]['shortcode_id'] = $shortcode_id;
110
  $this->update_callback();
111
+ return $shortcode_id;
112
  }
113
 
114
  }
readme.txt CHANGED
@@ -3,7 +3,7 @@ Contributors: nickboss
3
  Donate link: http://www.iptanus.com/support/wordpress-file-upload
4
  Tags: ajax, captcha, filter, form, html5, notification, page, plugin, post, redirect, responsive, shortcode, sidebar, upload, widget
5
  Requires at least: 2.9.2
6
- Tested up to: 4.4.2
7
  Stable tag: "trunk"
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
@@ -137,6 +137,11 @@ There is an option in plugin's settings in Dashboard to relax the CSS rules, so
137
 
138
  == Changelog ==
139
 
 
 
 
 
 
140
  = 3.8.2 =
141
  * fixed bug in wfu_after_file_loaded filter that was not working and was overriden by obsolete wfu_after_file_completed filter
142
  * added option in plugin's Settings in Dashboard to include additional files in plugin's database
@@ -581,6 +586,12 @@ Initial version.
581
 
582
  == Upgrade Notice ==
583
 
 
 
 
 
 
 
584
  = 3.8.1 =
585
  Minor upgrade to fix some bugs.
586
 
3
  Donate link: http://www.iptanus.com/support/wordpress-file-upload
4
  Tags: ajax, captcha, filter, form, html5, notification, page, plugin, post, redirect, responsive, shortcode, sidebar, upload, widget
5
  Requires at least: 2.9.2
6
+ Tested up to: 4.5.1
7
  Stable tag: "trunk"
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
137
 
138
  == Changelog ==
139
 
140
+ = 3.8.3 =
141
+ * fixed bug of subdirectory selector that was not initializing correctly after upload
142
+ * fixed slight widget incompatibility with customiser
143
+ * fixed bug of drag-n-drop feature that was not working when singlebutton operation was activated
144
+
145
  = 3.8.2 =
146
  * fixed bug in wfu_after_file_loaded filter that was not working and was overriden by obsolete wfu_after_file_completed filter
147
  * added option in plugin's Settings in Dashboard to include additional files in plugin's database
586
 
587
  == Upgrade Notice ==
588
 
589
+ = 3.8.3 =
590
+ Minor upgrade to fix some bugs.
591
+
592
+ = 3.8.2 =
593
+ Minor upgrade to fix some bugs and introduce some new features.
594
+
595
  = 3.8.1 =
596
  Minor upgrade to fix some bugs.
597
 
release_notes.txt CHANGED
@@ -1,3 +1,3 @@
1
- <span><strong>Latest release notes: </strong>This release is a minor update and introduces a new feature for admins, the ability to </span><span style="text-decoration: underline;">include additional files</span><span> in the plugin's database through the Dashboard <strong>File Browser</strong>. An option has been added in the plugin's Settings in Dashboard to enable this feature. This releases corrects also a bug in <strong>wfu_after_file_loaded</strong> filter that was not working and was overriden by obsolete <em>wfu_after_file_completed</em> filter.</span><br /><br /><span>
2
 
3
  For more details about this version's changes please visit the Release Notes of the plugin's </span><a href="http://www.iptanus.com/wordpress-plugins/wordpress-file-upload/">support page</a><span>.</span>
1
+ <span><strong>Latest release notes: </strong>This release is a minor update and it only fixes some bugs. The most important of the them was that <strong>drag-n-drop</strong> feature was not working properly when the plugin was configured for <strong>single-button</strong> operation.</span><br /><br /><span>
2
 
3
  For more details about this version's changes please visit the Release Notes of the plugin's </span><a href="http://www.iptanus.com/wordpress-plugins/wordpress-file-upload/">support page</a><span>.</span>
wordpress_file_upload.php CHANGED
@@ -4,7 +4,7 @@ if( !session_id() ) { 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: 3.8.2
8
  Author: Nickolas Bossinas
9
  Author URI: http://www.iptanus.com
10
  */
4
  /*
5
  Plugin URI: http://www.iptanus.com/support/wordpress-file-upload
6
  Description: Simple interface to upload files from a page.
7
+ Version: 3.8.3
8
  Author: Nickolas Bossinas
9
  Author URI: http://www.iptanus.com
10
  */