WordPress File Upload - Version 2.7.0

Version Description

  • corrected bug when deleting plugin instance from the Dashboard
  • corrected bug not finding "loading_icon.gif"
Download this release

Release Info

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

Code changes from version 2.6.0 to 2.7.0

images/loading_icon.gif ADDED
Binary file
js/wordpress_file_upload_adminfunctions.js CHANGED
@@ -1,2 +1,2 @@
1
- function wfu_admin_activate_tab(e){for(var t,a,l=document.getElementById("wfu_tab_container"),n=0;n<l.childNodes.length;n++)t=l.childNodes[n],1===t.nodeType&&(a=t.id.substr(8),t.className.indexOf("nav-tab-active")>-1&&(t.className="nav-tab",document.getElementById("wfu_container_"+a).style.display="none"));document.getElementById("wfu_tab_"+e).className="nav-tab nav-tab-active",document.getElementById("wfu_container_"+e).style.display="block"}function wfu_admin_onoff_clicked(e){var t=document.getElementById("wfu_attribute_"+e),a=document.getElementById("wfu_wrapper"),l=document.getElementsByClassName("wfu_shadow_"+e,"div",a),n=document.getElementsByClassName("wfu_shadow_"+e+"_inv","div",a),d="on"==t.className.substr(t.className.length-2);if(d=!d){document.getElementById("wfu_attribute_value_"+e).value="true",t.className="wfu_onoff_container_on";for(var r=0;r<l.length;r++)l[r].style.display="none";for(var r=0;r<n.length;r++)n[r].style.display="block"}else{document.getElementById("wfu_attribute_value_"+e).value="false",t.className="wfu_onoff_container_off";for(var r=0;r<l.length;r++)l[r].style.display="block";for(var r=0;r<n.length;r++)n[r].style.display="none"}wfu_generate_shortcode(),"userdata"==e&&wfu_update_userfield_variables()}function wfu_admin_radio_clicked(e){var t=document.getElementsByName("wfu_radioattribute_"+e),a=document.getElementById("wfu_wrapper"),l=document.getElementsByClassName("wfu_shadow_"+e,"div",a),n=document.getElementsByClassName("wfu_shadow_"+e+"_inv","div",a),d="";for(o=0;o<t.length;o++)t[o].checked&&(d=t[o].value);var r="*"==d.substr(0,1);if(r){d=d.substr(1);for(var o=0;o<l.length;o++)l[o].style.display="none";for(var o=0;o<n.length;o++)n[o].style.display="block"}else{for(var o=0;o<l.length;o++)l[o].style.display="block";for(var o=0;o<n.length;o++)n[o].style.display="none"}document.getElementById("wfu_attribute_value_"+e).value=d,wfu_generate_shortcode()}function wfu_addEventHandler(e,t,a){e.addEventListener?e.addEventListener(t,a,!1):e.attachEvent?e.attachEvent("on"+t,a):e["on"+t]=a}function wfu_attach_separator_dragdrop_events(){for(var e,t=document.getElementById("wfu_placements_container"),a=0;a<t.childNodes.length;a++)e=t.childNodes[a],("wfu_component_separator_hor"==e.className||"wfu_component_separator_ver"==e.className)&&(wfu_addEventHandler(e,"dragenter",wfu_separator_dragenter),wfu_addEventHandler(e,"dragover",wfu_default_dragover),wfu_addEventHandler(e,"dragleave",wfu_separator_dragleave),wfu_addEventHandler(e,"drop",wfu_separator_drop))}function wfu_Attach_Admin_DragDrop_Events(){if(window.FileReader){for(var e,t=document.getElementById("wfu_placements_container"),a=document.getElementById("wfu_componentlist_container"),l=0;l<t.childNodes.length;l++)e=t.childNodes[l],"wfu_component_box"==e.className&&(wfu_addEventHandler(e,"dragstart",wfu_component_dragstart),wfu_addEventHandler(e,"dragend",wfu_component_dragend));for(var l=0;l<a.childNodes.length;l++)if(e=a.childNodes[l],"wfu_component_box_container"==e.className)for(var n=0;n<e.childNodes.length;n++)"wfu_component_box wfu_inbase"==e.childNodes[n].className&&(wfu_addEventHandler(e.childNodes[n],"dragstart",wfu_component_dragstart),wfu_addEventHandler(e.childNodes[n],"dragend",wfu_component_dragend));e=document.getElementById("wfu_componentlist_dragdrop"),wfu_addEventHandler(e,"dragenter",wfu_componentlist_dragenter),wfu_addEventHandler(e,"dragover",wfu_default_dragover),wfu_addEventHandler(e,"dragleave",wfu_componentlist_dragleave),wfu_addEventHandler(e,"drop",wfu_componentlist_drop),wfu_attach_separator_dragdrop_events()}}function wfu_componentlist_dragenter(e){if(e=e||window.event,e.preventDefault&&e.preventDefault(),!DraggedItem)return!1;var t=document.getElementById("wfu_componentlist_dragdrop");return-1==t.className.indexOf("wfu_componentlist_dragdrop_dragover")&&(t.className+=" wfu_componentlist_dragdrop_dragover"),!1}function wfu_componentlist_dragleave(e){if(e=e||window.event,e.preventDefault&&e.preventDefault(),!DraggedItem)return!1;var t=document.getElementById("wfu_componentlist_dragdrop");return t.className=t.className.replace(" wfu_componentlist_dragdrop_dragover",""),!1}function wfu_componentlist_drop(e){e=e||window.event,e.preventDefault&&e.preventDefault();var t=e.dataTransfer.getData("Component");if(!t)return!1;var a=document.getElementById("wfu_component_box_"+t);a.className="wfu_component_box wfu_inbase",a.style.display="block",document.getElementById("wfu_component_box_container_"+t).appendChild(a);var l=wfu_admin_recreate_placements_text(null,"");return wfu_admin_recreate_placements_panel(l),document.getElementById("wfu_attribute_value_placements").value=l,wfu_generate_shortcode(),!1}function wfu_separator_dragenter(e){if(e=e||window.event,e.preventDefault&&e.preventDefault(),!DraggedItem)return!1;if("wfu_component_separator_hor"==e.target.className){var t=document.getElementById("wfu_component_bar_hor");t.style.top=e.target.offsetTop+"px",t.style.display="block"}else if("wfu_component_separator_ver"==e.target.className){var t=document.getElementById("wfu_component_bar_ver");t.style.top=e.target.offsetTop+"px",t.style.left=e.target.offsetLeft+"px",t.style.display="block"}return!1}function wfu_default_dragover(e){return e=e||window.event,e.preventDefault&&e.preventDefault(),!1}function wfu_separator_dragleave(e){if(e=e||window.event,e.preventDefault&&e.preventDefault(),!DraggedItem)return!1;if("wfu_component_separator_hor"==e.target.className){var t=document.getElementById("wfu_component_bar_hor");t.style.display="none"}else if("wfu_component_separator_ver"==e.target.className){var t=document.getElementById("wfu_component_bar_ver");t.style.display="none"}return!1}function wfu_separator_drop(e){e=e||window.event,e.preventDefault&&e.preventDefault();var t=e.dataTransfer.getData("Component");if(!t)return!1;var a=document.getElementById("wfu_component_box_"+t);a.style.display="none",a.className="wfu_component_box wfu_inbase",document.getElementById("wfu_component_box_container_"+t).appendChild(a);var l=wfu_admin_recreate_placements_text(e.target,t);return wfu_admin_recreate_placements_panel(l),document.getElementById("wfu_attribute_value_placements").value=l,wfu_generate_shortcode(),!1}function wfu_component_dragstart(e){e=e||window.event,e.dataTransfer.setData("Component",e.target.id.replace("wfu_component_box_","")),-1==e.target.className.indexOf("wfu_component_box_dragged")&&(e.target.className+=" wfu_component_box_dragged",DraggedItem=e.target),e.target.style.zIndex=3;var t=document.getElementById("wfu_componentlist_dragdrop");return t.className="wfu_componentlist_dragdrop wfu_componentlist_dragdrop_dragover",t.style.display="block",!1}function wfu_component_dragend(e){e=e||window.event,DraggedItem=null,e.target.style.zIndex=1;var t=document.getElementById("wfu_componentlist_dragdrop");return t.style.display="none",t.className="wfu_componentlist_dragdrop",e.target.className=e.target.className.replace(" wfu_component_box_dragged",""),document.getElementById("wfu_component_bar_ver").style.display="none",document.getElementById("wfu_component_bar_hor").style.display="none",!1}function wfu_admin_recreate_placements_text(e,t){function a(e){""!=d&&(d+=n),d+=e,n=""}for(var l=document.getElementById("wfu_placements_container"),n="",d="",r=0;r<l.childNodes.length;r++)item=l.childNodes[r],"wfu_component_separator_ver"==item.className?(""==n&&(n="+"),item==e&&(a(t),n="+")):"wfu_component_separator_hor"==item.className?(n="/",item==e&&(a(t),n="/")):"wfu_component_box"==item.className&&a(item.id.replace("wfu_component_box_",""));return d}function wfu_admin_recreate_placements_panel(e){for(var t,a,l,n=document.getElementById("wfu_placements_container"),d="",r=0;r<n.childNodes.length;r++)t=n.childNodes[r],"wfu_component_box"==t.className&&(d=t.id.replace("wfu_component_box_",""),t.style.display="inline-block",t.className="wfu_component_box wfu_inbase",document.getElementById("wfu_component_box_container_"+d).appendChild(t));n.innerHTML="",a=e.split("/");for(var r=0;r<a.length;r++){t=document.createElement("DIV"),t.className="wfu_component_separator_hor",t.setAttribute("draggable",!0),n.appendChild(t),t=document.createElement("DIV"),t.className="wfu_component_separator_ver",t.setAttribute("draggable",!0),n.appendChild(t),l=a[r].split("+");for(var o=0;o<l.length;o++)t=document.getElementById("wfu_component_box_"+l[o]),t&&(n.appendChild(t),t.className="wfu_component_box",t.style.display="inline-block",t=document.createElement("DIV"),t.className="wfu_component_separator_ver",t.setAttribute("draggable",!0),n.appendChild(t))}t=document.createElement("DIV"),t.className="wfu_component_separator_hor",t.setAttribute("draggable",!0),n.appendChild(t),t=document.createElement("DIV"),t.id="wfu_component_bar_hor",t.className="wfu_component_bar_hor",n.appendChild(t),t=document.createElement("DIV"),t.id="wfu_component_bar_ver",t.className="wfu_component_bar_ver",n.appendChild(t),wfu_attach_separator_dragdrop_events()}function wfu_subfolders_input_changed(e){e=e||window.event;var t=e.target,a=t.id.replace("wfu_subfolders_path_","");a=a.replace("wfu_subfolders_label_","");var l=document.getElementById("wfu_attribute_"+a);if(!(l.selectedIndex<0)){var n,d,r=document.getElementById("wfu_subfolders_path_"+a),o=document.getElementById("wfu_subfolders_label_"+a),u=document.getElementById("wfu_subfolders_ok_"+a),_="1"==document.getElementById("wfu_subfolders_isnewitem_"+a).value;if(_)n="",d="";else{var s=l.data;t=s[l.selectedIndex],n=t.path,d=t.label}if(r.value==n&&o.value==d)u.disabled=!0,_||wfu_subfolders_update_nav(a);else{u.disabled=!1;for(var f=document.getElementsByName("wfu_subfolder_nav_"+a),i=0;i<f.length;i++)f[i].disabled=!0}}}function wfu_subfolders_up_clicked(e){var t=document.getElementById("wfu_attribute_"+e);if(!(t.selectedIndex<0)){var a=t.data;item=a[t.selectedIndex];var l=item.index-1;if(!(0>l)){for(var n=-1,d=t.selectedIndex-1;d>=0;){if(a[d].level==item.level&&a[d].index==l){n=d;break}d--}if(-1!=n){var r=0;for(d=t.selectedIndex+1;d<a.length&&a[d].level>item.level;)r++,d++;a[n].index=item.index,item.index=l,t.data=a.slice(0,n).concat(a.slice(t.selectedIndex,t.selectedIndex+1+r)).concat(a.slice(n,t.selectedIndex)).concat(a.slice(t.selectedIndex+1+r));var o=wfu_update_subfolder_list(e);t.selectedIndex=n,wfu_subfolders_update_toolnav(e),item=t,o!==item.oldVal&&(item.oldVal=o,document.getElementById("wfu_attribute_value_"+e).value=o,wfu_generate_shortcode())}}}}function wfu_subfolders_down_clicked(e){var t=document.getElementById("wfu_attribute_"+e);if(!(t.selectedIndex<0)){var a=t.data;item=a[t.selectedIndex];var l=item.index+1,n=-1;for(curind=t.selectedIndex+1;curind<a.length;){if(a[curind].level==item.level){n=curind;break}if(a[curind].level<item.level)break;curind++}if(-1!=n){var d=0;for(curind=n+1;curind<a.length&&a[curind].level>item.level;)d++,curind++;a[n].index=item.index,item.index=l,t.data=a.slice(0,t.selectedIndex).concat(a.slice(n,n+1+d)).concat(a.slice(t.selectedIndex,n)).concat(a.slice(n+1+d));var r=wfu_update_subfolder_list(e);t.selectedIndex=t.selectedIndex+d+1,wfu_subfolders_update_toolnav(e),item=t,r!==item.oldVal&&(item.oldVal=r,document.getElementById("wfu_attribute_value_"+e).value=r,wfu_generate_shortcode())}}}function wfu_subfolders_left_clicked(e){var t=document.getElementById("wfu_attribute_"+e);if(!(t.selectedIndex<0)){var a=t.data;for(item=a[t.selectedIndex],curind=t.selectedIndex+1;curind<a.length&&a[curind].level>item.level;)a[curind].level--,curind++;item.level--;var l=wfu_update_subfolder_list(e);t.data=wfu_decode_subfolder_list(e),wfu_subfolders_update_toolnav(e),item=t,l!==item.oldVal&&(item.oldVal=l,document.getElementById("wfu_attribute_value_"+e).value=l,wfu_generate_shortcode())}}function wfu_subfolders_right_clicked(e){var t=document.getElementById("wfu_attribute_"+e);if(!(t.selectedIndex<0)){var a=t.data;for(item=a[t.selectedIndex],curind=t.selectedIndex+1;curind<a.length&&a[curind].level>item.level;)a[curind].level++,curind++;item.level++;var l=wfu_update_subfolder_list(e);t.data=wfu_decode_subfolder_list(e),wfu_subfolders_update_toolnav(e),item=t,l!==item.oldVal&&(item.oldVal=l,document.getElementById("wfu_attribute_value_"+e).value=l,wfu_generate_shortcode())}}function wfu_subfolders_def_clicked(e){var t=document.getElementById("wfu_attribute_"+e);if(!(t.selectedIndex<0)){var a=t.data;if(item=a[t.selectedIndex],item.default)item.default=!1;else{for(var l=0;l<a.length;l++)a[l].default=!1;item.default=!0}var n=wfu_update_subfolder_list(e);wfu_subfolders_update_toolnav(e),item=t,n!==item.oldVal&&(item.oldVal=n,document.getElementById("wfu_attribute_value_"+e).value=n,wfu_generate_shortcode())}}function wfu_subfolders_ok_clicked(e){var t=document.getElementById("wfu_attribute_"+e);if(!(t.selectedIndex<0)){var a=document.getElementById("wfu_subfolders_path_"+e),l=document.getElementById("wfu_subfolders_label_"+e);if(""==a.value||""==l.value)return void alert("Path or label cannot be empty!");var n=t.data,d="1"==document.getElementById("wfu_subfolders_isnewitem_"+e).value;if(d){var r=parseInt(document.getElementById("wfu_subfolders_newitemlevel_"+e).value),o={label:l.value,path:a.value,level:r,"default":!1},u=parseInt(document.getElementById("wfu_subfolders_newitemindex_"+e).value);u>=n.length?n.push(o):n.splice(u,0,o)}else item=n[t.selectedIndex],item.path=a.value,item.label=l.value;var _=wfu_update_subfolder_list(e);t.data=wfu_decode_subfolder_list(e),wfu_subfolders_update_toolnav(e),item=t,_!==item.oldVal&&(item.oldVal=_,document.getElementById("wfu_attribute_value_"+e).value=_,wfu_generate_shortcode())}}function wfu_subfolders_del_clicked(e){var t=document.getElementById("wfu_attribute_"+e);if(!(t.selectedIndex<0)){var a=t.data;item=a[t.selectedIndex];var l=0;for(curind=t.selectedIndex+1;curind<a.length&&a[curind].level>item.level;)l++,curind++;if(!(l>0)||confirm("Children items will be deleted as well. Proceed?")){a.splice(t.selectedIndex,1+l);var n=wfu_update_subfolder_list(e);t.data=wfu_decode_subfolder_list(e),wfu_subfolders_update_toolnav(e),item=t,n!==item.oldVal&&(item.oldVal=n,document.getElementById("wfu_attribute_value_"+e).value=n,wfu_generate_shortcode())}}}function wfu_subfolders_add_clicked(e){var t=document.getElementById("wfu_attribute_"+e);if(!(t.selectedIndex<0)){var a=t.data,l=t.selectedIndex;item=a[l];var n=t.options,d=document.createElement("option");d.value="",d.innerHTML="",n.add(d,l),t.selectedIndex=l;var r=document.getElementById("wfu_subfolder_tools_"+e),o=document.getElementById("wfu_subfolders_path_"+e),u=document.getElementById("wfu_subfolders_label_"+e),_=document.getElementById("wfu_subfolders_ok_"+e),s=document.getElementById("wfu_subfolders_browse_"+e);r.className="wfu_subfolder_tools_container",u.disabled=!1,_.disabled=!0,document.getElementById("wfu_subfolders_isnewitem_"+e).value="1",document.getElementById("wfu_subfolders_newitemindex_"+e).value=l,document.getElementById("wfu_subfolders_newitemlevel_"+e).value=item.level,document.getElementById("wfu_subfolders_newitemlevel2_"+e).value="",o.disabled=0==item.level,s.disabled=0==item.level,0==item.level?(o.value="{root}",u.value="{upload folder}"):(o.value="",u.value="");for(var f=document.getElementsByName("wfu_subfolder_nav_"+e),i=0;i<f.length;i++)f[i].disabled=!0}}function wfu_subfolders_browse_clicked(e){var t=wfu_GetHttpRequestObject();if(null!=t){var a=null;try{var a=new FormData}catch(l){}if(null!=a){for(var n=document.getElementById("wfu_global_dialog_container"),d=document.getElementById("wfu_subfolders_browser_"+e),r=document.getElementById("wfu_subfolders_browse_"+e),o=document.getElementById("wfu_subfolders_inner_shadow_"+e),u=document.getElementById("wfu_subfolders_browser_msgcont_"+e),_=document.getElementById("wfu_subfolders_browser_msg_"+e),s=document.getElementById("wfu_subfolders_browser_img_"+e),f=document.getElementById("wfu_subfolders_browser_ok_"+e),i=document.getElementById("wfu_subfolders_browser_list_"+e);i.options.length>0;)i.options.remove(0);f.disabled=!0,f.onclick=function(){wfu_folder_browser_cancel_clicked(e)},_.innerHTML="loading folder contents...",s.style.display="inline",u.style.display="block",n.style.display="block",d.style.display="block",d.style.left=r.offsetLeft+r.offsetWidth-d.offsetWidth+"px",d.style.top=r.offsetTop+r.offsetHeight-d.offsetHeight+"px",o.style.display="block",n.onclick=function(){wfu_folder_browser_cancel_clicked(e)};var c=document.getElementById("wfu_attribute_uploadpath").value;"/"==c.substr(c.length-1)&&(c=c.substr(0,c.length-1));var m=wfu_get_relative_path(e).split(","),w=c+m[0];"/"!=w.substr(0)&&(w="/"+w);var p="";2==m.length&&(p=m[1]),a.append("action","wfu_ajax_action_read_subfolders"),a.append("folder1",wfu_plugin_encode_string(w)),a.append("folder2",wfu_plugin_encode_string(p)),t.key=e,t.addEventListener("load",wfu_readfolderComplete,!1),t.addEventListener("error",wfu_readfolderFailed,!1),t.addEventListener("abort",wfu_readfolderCanceled,!1),t.open("POST",AdminParams.wfu_ajax_url),t.send(a)}}}function wfu_readfolderComplete(e){var t=e.target.key,a=document.getElementById("wfu_subfolders_browser_msgcont_"+t),l=document.getElementById("wfu_subfolders_browser_msg_"+t),n=document.getElementById("wfu_subfolders_browser_img_"+t),d=document.getElementById("wfu_subfolders_browser_list_"+t),r=document.getElementById("wfu_subfolders_browser_ok_"+t),o=document.getElementById("wfu_subfolders_path_"+t),u=document.getElementById("wfu_subfolders_label_"+t),_=e.target.responseText;if(-1!=_){var s="wfu_read_subfolders:",f=e.target.responseText.indexOf(s);-1==f&&(f=e.target.responseText.length);var i=(e.target.responseText.substr(0,f),e.target.responseText.substr(f+s.length,e.target.responseText.length-f-s.length));f=i.indexOf(":");var c=i.substr(0,f);if(txt_value=i.substr(f+1,i.length-f-1),"success"==c){for(var m,w=wfu_plugin_decode_string(txt_value),p=w.split(","),g=0,v=0;v<p.length;v++)""!=p[v]&&(m=document.createElement("option"),m.value=p[v],m.innerHTML=p[v].replace("*","&nbsp;&nbsp;&nbsp;"),d.add(m),g++);0==g&&(m=document.createElement("option"),m.value="",m.innerHTML="{empty}",m.disabled=!0,d.add(m)),d.selectedIndex=-1,r.onclick=function(){var e=d.options[d.selectedIndex].value,a=parseInt(document.getElementById("wfu_subfolders_newitemlevel_"+t).value);("*"==e.substr(0,1)||0==a)&&(document.getElementById("wfu_subfolders_newitemlevel_"+t).value=a+1,a>0&&(e=e.substr(1))),o.value=e,u.value=e,wfu_folder_browser_cancel_clicked(t),wfu_subfolders_ok_clicked(t)},a.style.display="none"}else"error"==c?(l.innerHTML=txt_value,n.style.display="none",r.disabled=!1):(l.innerHTML="Unknown error",n.style.display="none",r.disabled=!1)}}function wfu_readfolderFailed(e){var t=e.target.key,a=document.getElementById("wfu_subfolders_browser_msg_"+t),l=document.getElementById("wfu_subfolders_browser_img_"+t),n=document.getElementById("wfu_subfolders_browser_ok_"+t);a.innerHTML="Unknown error",l.style.display="none",n.disabled=!1}function wfu_readfolderCanceled(e){var t=e.target.key,a=document.getElementById("wfu_subfolders_browser_msg_"+t),l=document.getElementById("wfu_subfolders_browser_img_"+t),n=document.getElementById("wfu_subfolders_browser_ok_"+t);a.innerHTML="Unknown error",l.style.display="none",n.disabled=!1}function wfu_subfolders_browser_list_changed(e){var t=document.getElementById("wfu_subfolders_browser_list_"+e),a=document.getElementById("wfu_subfolders_browser_ok_"+e);a.disabled=t.selectedIndex<0}function wfu_folder_browser_cancel_clicked(e){var t=document.getElementById("wfu_global_dialog_container"),a=document.getElementById("wfu_subfolders_browser_"+e),l=(document.getElementById("wfu_subfolders_browse_"+e),document.getElementById("wfu_subfolders_inner_shadow_"+e));t.onclick=null,l.style.display="none",a.style.display="none",t.style.display="none"}function wfu_get_relative_path(e){var t=document.getElementById("wfu_attribute_"+e);if(!(t.selectedIndex<0)){var a,l=t.data,n="1"==document.getElementById("wfu_subfolders_isnewitem_"+e).value;a=n?parseInt(document.getElementById("wfu_subfolders_newitemlevel_"+e).value):l[t.selectedIndex].level;for(var d="/",r=t.selectedIndex-1,o=a;r>=0&&o>1;)l[r].level<o&&(d="/"+l[r].path+d,o=l[r].level),r--;return n&&"1"==document.getElementById("wfu_subfolders_newitemlevel2_"+e).value&&a>0&&t.selectedIndex>0&&(d+=","+l[t.selectedIndex-1].path),d}}function wfu_subfolders_changed(e){wfu_update_subfolder_list(e),wfu_subfolders_update_toolnav(e)}function wfu_subfolders_update_toolnav(e){var t,a,l=document.getElementById("wfu_attribute_"+e),n=document.getElementById("wfu_subfolder_tools_"+e),d=document.getElementById("wfu_subfolders_path_"+e),r=document.getElementById("wfu_subfolders_label_"+e),o=document.getElementById("wfu_subfolders_ok_"+e),u=document.getElementById("wfu_subfolders_browse_"+e);if(document.getElementById("wfu_subfolders_isnewitem_"+e).value="",document.getElementById("wfu_subfolders_newitemindex_"+e).value="",document.getElementById("wfu_subfolders_newitemlevel_"+e).value="",document.getElementById("wfu_subfolders_newitemlevel2_"+e).value="",null==l.data?(t=wfu_decode_subfolder_list(e),l.data=t):t=l.data,0===l.data.length?(l.className="wfu_select_folders wfu_select_folders_empty",l.options[0].innerHTML="press here"):l.className="wfu_select_folders",l.selectedIndex<0)n.className="wfu_subfolder_tools_container wfu_subfolder_tools_disabled",d.disabled=!0,r.disabled=!0,o.disabled=!0,u.disabled=!0,r.value="",d.value="";else if(l.selectedIndex>=l.options.length-1){n.className="wfu_subfolder_tools_container",r.disabled=!1,o.disabled=!0,document.getElementById("wfu_subfolders_isnewitem_"+e).value="1",document.getElementById("wfu_subfolders_newitemindex_"+e).value=t.length;var _;_=0==t.length?0:0==t[t.length-1].level?1:t[t.length-1].level,document.getElementById("wfu_subfolders_newitemlevel_"+e).value=_,document.getElementById("wfu_subfolders_newitemlevel2_"+e).value="1",d.disabled=0==_,u.disabled=!1,0==_?(d.value="{root}",r.value="{upload folder}"):(d.value="",r.value="")}else n.className="wfu_subfolder_tools_container",r.disabled=!1,o.disabled=!0,a=t[l.selectedIndex],d.disabled=0==a.level,u.disabled=0==a.level,r.value=a.label,d.value=a.path;var s=document.getElementsByName("wfu_subfolder_nav_"+e);if(l.selectedIndex<0||l.selectedIndex>=l.options.length-1)for(var f=0;f<s.length;f++)s[f].disabled=!0;else wfu_subfolders_update_nav(e)}function wfu_subfolders_update_nav(e){var t=document.getElementById("wfu_attribute_"+e),a=document.getElementById("wfu_subfolders_up_"+e),l=document.getElementById("wfu_subfolders_down_"+e),n=document.getElementById("wfu_subfolders_left_"+e),d=document.getElementById("wfu_subfolders_right_"+e),r=document.getElementById("wfu_subfolders_add_"+e),o=document.getElementById("wfu_subfolders_def_"+e),u=document.getElementById("wfu_subfolders_del_"+e),_=t.data,s=_[t.selectedIndex];for(a.disabled=s.index<=0,ind=t.selectedIndex+1,nextind=0;ind<_.length;){if(_[ind].level==s.level){nextind=_[ind].index;break}if(_[ind].level<s.level)break;ind++}l.disabled=0==s.level||0==nextind,n.disabled=0==t.selectedIndex&&s.level<1||t.selectedIndex>0&&s.level<=1,prevlevel=t.selectedIndex>=1?_[t.selectedIndex-1].level:0,d.disabled=s.level-prevlevel>0,r.disabled=0==s.level,o.disabled=!1,o.className="button"+(s.default?" wfu_subfolder_nav_pressed":""),u.disabled=!1}function wfu_decode_subfolder(e){var t={label:"",path:"",level:0,"default":!1};e=e.trim();for(var a=0,l=!1;a<e.length&&"*"==e.substr(a,1);)a++;e=e.substr(a,e.length-a),"&"==e.substr(0,1)&&(e=e.substr(1),l=!0),t.level=a,t.default=l;var n=e.split("/");return 1==n.length?(t.path=n[0],t.label=n[0]):n.length>1&&(t.path=n[0],t.label=n[1]),0==a&&(t.path="{root}",""==t.label&&(t.label="{upload folder}")),t}function wfu_decode_subfolder_list(e){for(var t,a=document.getElementById("wfu_attribute_"+e).options,l=Array(),n=["root"],d=[0],r=-1,o=0;o<a.length-1;o++){for(l.push(wfu_decode_subfolder(wfu_plugin_decode_string(a[o].value))),n.length>l[o].level?n[l[o].level]=l[o].path:n.push(l[o].path),t="",j=1;j<=l[o].level;j++)t+=n[j]+"/";l[o].fullpath=t,d.length<=l[o].level&&d.push(0),l[o].index=l[o].level>r?0:d[l[o].level]+1,d[l[o].level]=l[o].index,r=l[o].level}return l}function wfu_update_subfolder_list(e){var t=document.getElementById("wfu_attribute_"+e).options,a=document.getElementById("wfu_attribute_"+e),l=a.data;if(null!=l){var n,d,r="";t.length=l.length+1;for(var o=0;o<l.length;o++){for(n="",d="",j=0;j<l[o].level;j++)n+="*",d+="&nbsp;&nbsp;&nbsp;";l[o].default?(n+="&",t[o].className="wfu_select_folders_option_default"):t[o].className="",n+=l[o].path+"/"+l[o].label,d+=l[o].label,t[o].value=wfu_plugin_encode_string(n),t[o].innerHTML=d,""!=r&&(r+=","),r+=n}return t[l.length].value="",t[l.length].innerHTML="",r}}function wfu_userdata_edit_field(e,t,a){for(var l,n=0;n<e.childNodes.length;n++)l=e.childNodes[n],"INPUT"==l.tagName?"text"==l.type?(l.value=t,wfu_attach_element_handlers(l,wfu_update_userfield_value)):"checkbox"==l.type&&(l.checked=a):"DIV"==l.tagName&&(l.className="wfu_userdata_action")}function wfu_userdata_add_field(e){var t=e.parentNode,a=t.cloneNode(!0);wfu_userdata_edit_field(a,"",!1),t.parentNode.insertBefore(a,t.nextSibling)}function wfu_userdata_remove_field(e){for(var t=e.parentNode,a=t.parentNode,l=null,n=0;n<a.childNodes.length;n++)if(1===a.childNodes[n].nodeType){l=a.childNodes[n];break}if(t!=l){t.parentNode.removeChild(t);for(var n=0;n<l.childNodes.length;n++)if(1===l.childNodes[n].nodeType){wfu_update_userfield_value({target:l.childNodes[n]});break}}}function wfu_generate_shortcode(){for(var e,t=document.getElementById("wfu_attribute_defaults"),a=(document.getElementById("wfu_attribute_values"),""),l="",n="[wordpress_file_upload",d="",r=0;r<t.childNodes.length;r++)e=t.childNodes[r],1===e.nodeType&&(a=e.id.replace("wfu_attribute_default_",""),l=document.getElementById("wfu_attribute_value_"+a).value,e.value!=l&&(d+=" "+a+'="'+l+'"'));n+=d+"]",document.getElementById("wfu_shortcode").value=n,ShortcodeString=d.substr(1),document.getElementById("wfu_update_shortcode")&&(document.getElementById("wfu_update_shortcode").disabled=wfu_plugin_encode_string(n)==document.getElementById("wfu_shortcode_original_enc").value),Autosave&&wfu_schedule_save_shortcode()}function wfu_update_text_value(e){e=e||window.event;var t=e.target,a=t.id.replace("wfu_attribute_",""),l=t.value;l=l.replace(/(\r\n|\n|\r)/gm,"%n%"),l=l.replace(/\"/gm,"%dq%"),l=l.replace(/\[/gm,"%brl%"),l=l.replace(/\]/gm,"%brr%"),l!==t.oldVal&&(t.oldVal=l,document.getElementById("wfu_attribute_value_"+a).value=l,wfu_generate_shortcode())}function wfu_update_triplecolor_value(e){e=e||window.event;var t=e.target,a=t.id.replace("wfu_attribute_","");a=a.replace("_color",""),a=a.replace("_bgcolor",""),a=a.replace("_borcolor",""),t=document.getElementById("wfu_attribute_"+a+"_color");var l=t.value+","+document.getElementById("wfu_attribute_"+a+"_bgcolor").value+","+document.getElementById("wfu_attribute_"+a+"_borcolor").value;l!==t.oldVal&&(t.oldVal=l,document.getElementById("wfu_attribute_value_"+a).value=l,wfu_generate_shortcode())}function wfu_update_dimension_value(e){e=e||window.event;var t=e.target,a=t.name.replace("wfu_dimension_elements_",""),l=document.getElementsByName(t.name);t=l[0];for(var n="",d="",r=0;r<l.length;r++)d=l[r].id.replace("wfu_attribute_"+a+"_",""),""!=n&&""!=l[r].value&&(n+=", "),""!=l[r].value&&(n+=d+":"+l[r].value);n!==t.oldVal&&(t.oldVal=n,document.getElementById("wfu_attribute_value_"+a).value=n,wfu_generate_shortcode())}function wfu_update_ptext_value(e){e=e||window.event;var t=e.target,a=t.id.replace("wfu_attribute_","");a=a.substr(2);var l=document.getElementById("wfu_attribute_s_"+a).value,n=document.getElementById("wfu_attribute_p_"+a).value,d=l+"/"+n;d!==t.oldVal&&(t.oldVal=d,document.getElementById("wfu_attribute_value_"+a).value=d),wfu_generate_shortcode()}function wfu_update_mchecklist_value(e){var t="",a=(document.getElementById("wfu_attribute_"+e),document.getElementById("wfu_attribute_"+e+"_all"));a.checked?(jQuery("#wfu_attribute_"+e+" input").prop("disabled",!0),jQuery("#wfu_attribute_"+e+" input").prop("checked",!0),t="all"):(jQuery("#wfu_attribute_"+e+" input").prop("disabled",!1),jQuery("#wfu_attribute_"+e+" input").each(function(){jQuery(this).prop("checked")&&(t+=","+jQuery(this).next().html())}),t=t.substr(1)),document.getElementById("wfu_attribute_value_"+e).value=t,wfu_generate_shortcode()}function wfu_update_rolelist_value(e){var t="",a=document.getElementById("wfu_attribute_"+e),l=document.getElementById("wfu_attribute_"+e+"_all");if(l.checked)a.disabled=!0,t="all";else{a.disabled=!1;for(var n=a.options,d=0;d<n.length;d++)n[d].selected&&(""!=t&&(t+=","),t+=n[d].value)}document.getElementById("wfu_attribute_value_"+e).value=t,wfu_generate_shortcode()}function wfu_update_userfield_value(e){e=e||window.event;for(var t=e.target,a=t.parentNode,l=a.parentNode,n="",d=!1,r="",o=0;o<l.childNodes.length;o++)if(a=l.childNodes[o],"DIV"===a.tagName){for(var u=0;u<a.childNodes.length;u++)"INPUT"==a.childNodes[u].tagName&&("text"==a.childNodes[u].type?(n=a.childNodes[u].value,0==o&&(t=a.childNodes[u])):"checkbox"==a.childNodes[u].type&&(d=a.childNodes[u].checked));""!=r&&""!=n&&(r+="/"),""!=n&&d&&(r+="*"),""!=n&&(r+=n)}r!==t.oldVal&&(t.oldVal=r,document.getElementById("wfu_attribute_value_userdatalabel").value=r,wfu_generate_shortcode(),wfu_update_userfield_variables())}function wfu_update_userfield_variables(){for(var e=document.getElementById("wfu_attribute_value_userdatalabel").value,t=document.getElementById("wfu_wrapper"),a=document.getElementsByClassName("wfu_shadow_userdata","div",t),l=document.getElementsByName("wfu_userfield_select"),n=0;n<l.length;n++)l[n].style.display="none";if(0!=a.length&&"block"!=a[0].style.display){for(var d='<option style="display:none;">%userdataXXX%</option>',r=e.split("/"),o="",n=1;n<=r.length;n++)o=r[n-1],"*"==o[0]&&(o=o.substr(1)),d+='<option value="%userdata'+n+'%">'+n+": "+o+"</option>";for(var n=0;n<l.length;n++)l[n].innerHTML=d,l[n].style.display="inline-block"}}function wfu_attach_element_handlers(e,t){for(var a=["DOMAttrModified","textInput","input","change","keypress","paste","focus","propertychange"],l=0;l<a.length;l++)wfu_addEventHandler(e,a[l],t)}function wfu_Attach_Admin_Events(e){Autosave=e,wfu_generate_shortcode(),wfu_update_userfield_variables(),wfu_Attach_Admin_DragDrop_Events();for(var t=document.getElementsByName("wfu_text_elements"),a=0;a<t.length;a++)wfu_attach_element_handlers(t[a],wfu_update_text_value);for(var l=document.getElementsByName("wfu_ptext_elements"),a=0;a<l.length;a++)wfu_attach_element_handlers(l[a],wfu_update_ptext_value);for(var n=document.getElementsByName("wfu_triplecolor_elements"),a=0;a<n.length;a++)wfu_attach_element_handlers(n[a],wfu_update_triplecolor_value);for(var d=document.getElementsByName("wfu_dimension_elements_widths"),a=0;a<d.length;a++)wfu_attach_element_handlers(d[a],wfu_update_dimension_value);d=document.getElementsByName("wfu_dimension_elements_heights");for(var a=0;a<d.length;a++)wfu_attach_element_handlers(d[a],wfu_update_dimension_value);for(var r=document.getElementsByName("wfu_userfield_elements"),a=0;a<r.length;a++)wfu_attach_element_handlers(r[a],wfu_update_userfield_value);for(var o=document.getElementsByName("wfu_subfolder_tools_input"),a=0;a<o.length;a++)wfu_attach_element_handlers(o[a],wfu_subfolders_input_changed);""!=document.getElementById("wfu_shortcode_postid").value&&setTimeout(function(){wfu_check_page_obsolescence()},CheckObsolescenceTimeOut)}function wfu_insert_variable(e){var t=e.className.replace("wfu_variable wfu_variable_",""),a=document.getElementById("wfu_attribute_"+t),l=a.selectionStart,n=a.value;a.value=n.substr(0,l)+e.innerHTML+n.substr(l),wfu_update_text_value({target:a})}function wfu_insert_userfield_variable(e){var t=e.className.replace("wfu_variable wfu_variable_",""),a=document.getElementById("wfu_attribute_"+t),l=a.selectionStart,n=a.value;a.value=n.substr(0,l)+e.value+n.substr(l),e.value="%userdataXXX%",wfu_update_text_value({target:a})
2
- }function wfu_GetHttpRequestObject(){var e=null;try{e=new XMLHttpRequest}catch(t){try{e=new ActiveXObject("Msxml2.XMLHTTP")}catch(a){try{e=new ActiveXObject("Microsoft.XMLHTTP")}catch(t){}}}if(null==e&&window.createRequest)try{xmlhttp=window.createRequest()}catch(t){}return e}function wfu_plugin_encode_string(e){var t,a=0,l="",n="";for(a=0;a<e.length;a++)t=e.charCodeAt(a),t>=2048?t=((16773120&t|917504)<<4)+((4032&t|8192)<<2)+(63&t|128):t>=128&&(t=((65472&t|12288)<<2)+(63&t|128)),n=t.toString(16),(1==n.length||3==n.length||5==n.length)&&(n="0"+n),l+=n;return l}function wfu_plugin_decode_string(e){for(var t,a,l=0,n="";l<e.length;)t=parseInt(e.substr(l,2),16),a=128>t?t:224>t?((31&t)<<6)+(63&parseInt(e.substr(l+=2,2),16)):((15&t)<<12)+((63&parseInt(e.substr(l+=2,2),16))<<6)+(63&parseInt(e.substr(l+=2,2),16)),n+=String.fromCharCode(a),l+=2;return n}function wfu_schedule_save_shortcode(){var e=new Date,t=ShortcodeNextSave-e.getTime();null!=ShortcodeTimeOut&&(clearTimeout(ShortcodeTimeOut),ShortcodeTimeOut=null),0>=t?wfu_save_shortcode():ShortcodeTimeOut=setTimeout(function(){wfu_save_shortcode()},t)}function wfu_check_page_obsolescence(){PageObsolete||PageUpdating||""==document.getElementById("wfu_shortcode_postid").value}function wfu_save_shortcode(){if(!PageObsolete){var e=wfu_GetHttpRequestObject();if(null!=e){PageUpdating=!0,document.getElementById("wfu_update_failed_message").style.display="none";var t=AdminParams.wfu_ajax_url;params=new Array(6),params[0]=new Array(2),params[0][0]="action",params[0][1]="wfu_ajax_action_save_shortcode",params[1]=new Array(2),params[1][0]="shortcode",params[1][1]=wfu_plugin_encode_string(ShortcodeString),params[2]=new Array(2),params[2][0]="shortcode_original",params[2][1]=document.getElementById("wfu_shortcode_original_enc").value,params[3]=new Array(2),params[3][0]="post_id",params[3][1]=document.getElementById("wfu_shortcode_postid").value,params[4]=new Array(2),params[4][0]="post_hash",params[4][1]=document.getElementById("wfu_shortcode_posthash").value,params[5]=new Array(2),params[5][0]="shortcode_position",params[5][1]=document.getElementById("wfu_shortcode_position").value;for(var a="",l=0;l<params.length;l++)a+=(l>0?"&":"")+params[l][0]+"="+encodeURI(params[l][1]);var n=new Date;Autosave?ShortcodeNextSave=n.getTime()+5e3:document.getElementById("wfu_update_shortcode")&&(document.getElementById("wfu_update_shortcode_wait").style.display="inline"),e.open("POST",t,!0),e.setRequestHeader("Content-type","application/x-www-form-urlencoded"),e.onreadystatechange=function(){if(4==e.readyState&&200==e.status){PageUpdating=!1;var t="wfu_save_shortcode:",a=e.responseText.indexOf(t);-1==a&&(a=e.responseText.length);var l=(e.responseText.substr(0,a),e.responseText.substr(a+t.length,e.responseText.length-a-t.length));a=l.indexOf(":");var d=l.substr(0,a);txt_value=l.substr(a+1,l.length-a-1),"success"==d?(Autosave?(document.getElementById("wfu_save_label").innerHTML="saved",document.getElementById("wfu_save_label").className="wfu_save_label",document.getElementById("wfu_save_label").style.opacity=1,wfu_fadeout_element(300),ShortcodeNextSave=n.getTime()+1e3,null!=ShortcodeTimeOut&&wfu_schedule_save_shortcode()):document.getElementById("wfu_update_shortcode")&&(document.getElementById("wfu_update_shortcode_wait").style.display="none",document.getElementById("wfu_update_shortcode").disabled=!0,window.plugin_window&&window.plugin_window.location.reload(!0)),""!=document.getElementById("wfu_shortcode_postid").value&&(document.getElementById("wfu_shortcode_original_enc").value=wfu_plugin_encode_string("[wordpress_file_upload "+ShortcodeString+"]"),document.getElementById("wfu_shortcode_posthash").value=txt_value,setTimeout(function(){wfu_check_page_obsolescence()},CheckObsolescenceTimeOut))):(Autosave&&(document.getElementById("wfu_save_label").innerHTML="not saved",document.getElementById("wfu_save_label").className="wfu_save_label_fail",document.getElementById("wfu_save_label").style.opacity=1,wfu_fadeout_element(300)),"fail"==d&&("post_modified"==txt_value?(PageObsolete=!0,document.getElementById("wfu_update_shortcode")&&(document.getElementById("wfu_update_shortcode").disabled=!0),document.getElementById("wfu_update_rejected_message").style.display="block"):document.getElementById("wfu_update_failed_message").style.display="block"))}},e.send(a)}}}function wfu_adjust_opacity(e){document.getElementById("wfu_save_label").style.opacity=e}function wfu_fadeout_element(e){for(var t=20,a=0,l=0;t>l;l++)a=1-l/t,setTimeout('wfu_adjust_opacity("'+a.toString()+'")',l*e/t);setTimeout('wfu_adjust_opacity("0.0")',l*e/t)}function wfu_apply_value(e,t,a){if("onoff"==t)document.getElementById("wfu_attribute_"+e).className="wfu_onoff_container_"+("true"!=a?"on":"off"),wfu_admin_onoff_clicked(e);else if("text"==t||"ltext"==t||"integer"==t||"float"==t||"mtext"==t||"color"==t){var l=document.getElementById("wfu_attribute_"+e);if(a=a.replace(/\%n\%/gm,"\n"),a=a.replace(/\%dq\%/gm,'"'),a=a.replace(/\%brl\%/gm,"["),a=a.replace(/\%brr\%/gm,"]"),"color"==t){var n=colourNameToHex(a);n||(n=a),jQuery("#wfu_attribute_"+e).wpColorPicker("color",n)}l.value=a,wfu_update_text_value({target:l})}else if("placements"==t)wfu_admin_recreate_placements_panel(a),document.getElementById("wfu_attribute_value_placements").value=a,wfu_generate_shortcode();else if("radio"==t){for(var d=document.getElementsByName("wfu_radioattribute_"+e),r=0;r<d.length;r++)d[r].checked=d[r].value==a||"*"+d[r].value==a;wfu_admin_radio_clicked(e)}else if("ptext"==t){a=a.replace(/\%n\%/gm,"\n"),a=a.replace(/\%dq\%/gm,'"'),a=a.replace(/\%brl\%/gm,"["),a=a.replace(/\%brr\%/gm,"]");var o=a.split("/"),u=o.length<1?"":o[0],_=o.length<2?u:o[1],s=document.getElementById("wfu_attribute_s_"+e);s.value=u;var f=document.getElementById("wfu_attribute_p_"+e);f.value=_,wfu_update_ptext_value({target:s}),wfu_update_ptext_value({target:f})}else if("mchecklist"==t){if(a=a.toLowerCase(),"all"==a)document.getElementById("wfu_attribute_"+e+"_all").checked=!0;else{document.getElementById("wfu_attribute_"+e+"_all").checked=!1;for(var i=a.split(","),r=0;r<i.length;r++)i[r]=i[r].trim();jQuery("#wfu_attribute_"+e+" input").each(function(){jQuery(this).prop("checked",i.indexOf(jQuery(this).next().html())>-1)})}wfu_update_mchecklist_value(e)}else if("rolelist"==t){if(a=a.toLowerCase(),"all"==a)document.getElementById("wfu_attribute_"+e+"_all").checked=!0;else{document.getElementById("wfu_attribute_"+e+"_all").checked=!1;for(var c=a.split(","),r=0;r<c.length;r++)c[r]=c[r].trim();for(var l=document.getElementById("wfu_attribute_"+e),r=0;r<l.options.length;r++)l.options[r].selected=c.indexOf(l.options[r].value)>-1}wfu_update_rolelist_value(e)}else if("dimensions"==t){for(var m,w,p,l,g=a.split(","),v=document.getElementsByName("wfu_dimension_elements_"+e),r=0;r<v.length;r++)v[r].value="";for(var r=0;r<g.length;r++)m=g[r].split(":",2),w=m.length<1?"":m[0],p=m.length<2?w:m[1],l=document.getElementById("wfu_attribute_"+e+"_"+w.trim()),l&&(l.value=p.trim());l=v[0],wfu_update_dimension_value({target:l})}else if("userfields"==t){for(var b,h=a.split("/"),y=Array(),r=0;r<h.length;r++)b="*"==h[r].substr(0,1),b&&(h[r]=h[r].substr(1)),""!=h[r]&&y.push({name:h[r],required:b});for(var I=document.getElementById("wfu_attribute_"+e),E=null,B=Array(),r=0;r<I.childNodes.length;r++)1===I.childNodes[r].nodeType&&(null==E?E=I.childNodes[r]:B.push(I.childNodes[r]));for(var r=0;r<B.length;r++)I.removeChild(B[r]);wfu_userdata_edit_field(E,"",!1);for(var x,N=E,r=0;r<y.length;r++)0==r?wfu_userdata_edit_field(E,y[r].name,y[r].required):(x=N.cloneNode(!0),wfu_userdata_edit_field(x,y[r].name,y[r].required),I.insertBefore(x,N.nextSibling),N=x);for(var l,r=0;r<E.childNodes.length&&(l=E.childNodes[r],"INPUT"!=l.tagName);r++);wfu_update_userfield_value({target:l})}else if("color-triplet"==t){for(var k=a.split(","),r=0;r<k.length;r++)k[r]=k[r].trim();2==k.length?k=[k[0],k[1],"#000000"]:1==k.length?k=[k[0],"#FFFFFF","#000000"]:k.length<3&&(k=["#000000","#FFFFFF","#000000"]);var n=colourNameToHex(k[0]);n||(n=k[0]),jQuery("#wfu_attribute_"+e+"_color").wpColorPicker("color",n);var l=document.getElementById("wfu_attribute_"+e+"_color");l.value=k[0],n=colourNameToHex(k[1]),n||(n=k[1]),jQuery("#wfu_attribute_"+e+"_bgcolor").wpColorPicker("color",n),document.getElementById("wfu_attribute_"+e+"_bgcolor").value=k[1],n=colourNameToHex(k[2]),n||(n=k[2]),jQuery("#wfu_attribute_"+e+"_borcolor").wpColorPicker("color",n),document.getElementById("wfu_attribute_"+e+"_borcolor").value=k[2],wfu_update_triplecolor_value({target:l})}else if("folderlist"==t){for(var i=wfu_parse_folderlist_js(a),T=document.getElementById("wfu_attribute_"+e).options;T.length>0;)T.remove(0);for(var H,A,j,O,C,D,r=0;r<i.path.length;r++){A=i.path[r],"/"==A.substr(A.length,1)&&(A=A.substr(0,A.length-1)),j=A.split("/"),A=j[j.length-1],C=parseInt(i.level[r]),O="",D="";for(var S=0;C>S;S++)O+="&nbsp;&nbsp;&nbsp;",D+="*";O+=i.label[r],i.default[r]&&(D+="&"),D+=""==A?"{root}/"+i.label[r]:A+i.label[r],H=document.createElement("option"),H.className=i.default[r]?"wfu_select_folders_option_default":"",H.value=wfu_plugin_encode_string(D),H.innerHTML=O,T.add(H)}H=document.createElement("option"),H.value="",H.innerHTML="",T.add(H);var L=document.getElementById("wfu_attribute_"+e);L.data=wfu_decode_subfolder_list(e),wfu_subfolders_update_toolnav(e),l=L,a!==l.oldVal&&(l.oldVal=a,document.getElementById("wfu_attribute_value_"+e).value=a,wfu_generate_shortcode())}}function wfu_parse_folderlist_js(e){var t=Object();t.path=Array(),t.label=Array(),t.level=Array(),t.default=Array();var a=e.split(",");if(0==a.length)return t;if(1==a.length&&""==a[0].trim())return t;for(var l,n,d,r,o,u,_,s=["root"],f=0,i=0,c=-1,m=0;m<a.length;m++){for(l=a[m].trim(),n=0,d="",r=!1;n<l.length&&"*"==l.substr(n,1);)n++,d+="&nbsp;&nbsp;&nbsp;";if(1>=n-f&&(n>0||0==i)&&(l=l.substr(n,l.length-n),"&"==l.substr(0,1)&&(l=l.substr(1),r=!0),subfolder_items=l.split("/"),subfolder_items.length<2&&subfolder_items.push(""),""!=subfolder_items[1]?(o=subfolder_items[0],u=subfolder_items[1]):(o=l,u=l),""!=o)){r&&-1==c?c=t.path.length:r=!1,0==n&&(i=1),s.length>n?s[n]=o:s.push(o),_="";for(var w=1;n>=w;w++)_+=s[w]+"/";t.path.push(_),t.label.push(u),t.level.push(n),t.default.push(r),f=n}}return t}function colourNameToHex(e){var t={aliceblue:"#f0f8ff",antiquewhite:"#faebd7",aqua:"#00ffff",aquamarine:"#7fffd4",azure:"#f0ffff",beige:"#f5f5dc",bisque:"#ffe4c4",black:"#000000",blanchedalmond:"#ffebcd",blue:"#0000ff",blueviolet:"#8a2be2",brown:"#a52a2a",burlywood:"#deb887",cadetblue:"#5f9ea0",chartreuse:"#7fff00",chocolate:"#d2691e",coral:"#ff7f50",cornflowerblue:"#6495ed",cornsilk:"#fff8dc",crimson:"#dc143c",cyan:"#00ffff",darkblue:"#00008b",darkcyan:"#008b8b",darkgoldenrod:"#b8860b",darkgray:"#a9a9a9",darkgreen:"#006400",darkkhaki:"#bdb76b",darkmagenta:"#8b008b",darkolivegreen:"#556b2f",darkorange:"#ff8c00",darkorchid:"#9932cc",darkred:"#8b0000",darksalmon:"#e9967a",darkseagreen:"#8fbc8f",darkslateblue:"#483d8b",darkslategray:"#2f4f4f",darkturquoise:"#00ced1",darkviolet:"#9400d3",deeppink:"#ff1493",deepskyblue:"#00bfff",dimgray:"#696969",dodgerblue:"#1e90ff",firebrick:"#b22222",floralwhite:"#fffaf0",forestgreen:"#228b22",fuchsia:"#ff00ff",gainsboro:"#dcdcdc",ghostwhite:"#f8f8ff",gold:"#ffd700",goldenrod:"#daa520",gray:"#808080",green:"#008000",greenyellow:"#adff2f",honeydew:"#f0fff0",hotpink:"#ff69b4","indianred ":"#cd5c5c","indigo ":"#4b0082",ivory:"#fffff0",khaki:"#f0e68c",lavender:"#e6e6fa",lavenderblush:"#fff0f5",lawngreen:"#7cfc00",lemonchiffon:"#fffacd",lightblue:"#add8e6",lightcoral:"#f08080",lightcyan:"#e0ffff",lightgoldenrodyellow:"#fafad2",lightgrey:"#d3d3d3",lightgreen:"#90ee90",lightpink:"#ffb6c1",lightsalmon:"#ffa07a",lightseagreen:"#20b2aa",lightskyblue:"#87cefa",lightslategray:"#778899",lightsteelblue:"#b0c4de",lightyellow:"#ffffe0",lime:"#00ff00",limegreen:"#32cd32",linen:"#faf0e6",magenta:"#ff00ff",maroon:"#800000",mediumaquamarine:"#66cdaa",mediumblue:"#0000cd",mediumorchid:"#ba55d3",mediumpurple:"#9370d8",mediumseagreen:"#3cb371",mediumslateblue:"#7b68ee",mediumspringgreen:"#00fa9a",mediumturquoise:"#48d1cc",mediumvioletred:"#c71585",midnightblue:"#191970",mintcream:"#f5fffa",mistyrose:"#ffe4e1",moccasin:"#ffe4b5",navajowhite:"#ffdead",navy:"#000080",oldlace:"#fdf5e6",olive:"#808000",olivedrab:"#6b8e23",orange:"#ffa500",orangered:"#ff4500",orchid:"#da70d6",palegoldenrod:"#eee8aa",palegreen:"#98fb98",paleturquoise:"#afeeee",palevioletred:"#d87093",papayawhip:"#ffefd5",peachpuff:"#ffdab9",peru:"#cd853f",pink:"#ffc0cb",plum:"#dda0dd",powderblue:"#b0e0e6",purple:"#800080",red:"#ff0000",rosybrown:"#bc8f8f",royalblue:"#4169e1",saddlebrown:"#8b4513",salmon:"#fa8072",sandybrown:"#f4a460",seagreen:"#2e8b57",seashell:"#fff5ee",sienna:"#a0522d",silver:"#c0c0c0",skyblue:"#87ceeb",slateblue:"#6a5acd",slategray:"#708090",snow:"#fffafa",springgreen:"#00ff7f",steelblue:"#4682b4",tan:"#d2b48c",teal:"#008080",thistle:"#d8bfd8",tomato:"#ff6347",turquoise:"#40e0d0",violet:"#ee82ee",wheat:"#f5deb3",white:"#ffffff",whitesmoke:"#f5f5f5",yellow:"#ffff00",yellowgreen:"#9acd32"};return"undefined"!=typeof t[e.toLowerCase()]?t[e.toLowerCase()]:!1}function wfu_download_file(e,t,a){var l=wfu_GetHttpRequestObject();if(null!=l){var n=AdminParams.wfu_ajax_url;params=new Array(3),params[0]=new Array(2),params[0][0]="action",params[0][1]="wfu_ajax_action_download_file_invoker",params[1]=new Array(2),params[1][0]="file",params[1][1]=e,params[2]=new Array(2),params[2][0]="nonce",params[2][1]=a;for(var d="",r=0;r<params.length;r++)d+=(r>0?"&":"")+params[r][0]+"="+encodeURI(params[r][1]);l.open("POST",n,!0),l.setRequestHeader("Content-type","application/x-www-form-urlencoded"),l.onreadystatechange=function(){if(4==l.readyState&&200==l.status){var a="wfu_ajax_action_download_file_invoker:",n=l.responseText.indexOf(a);-1==n&&(n=l.responseText.length);var d=(l.responseText.substr(0,n),l.responseText.substr(n+a.length,l.responseText.length-n-a.length));n=d.indexOf(":");var r=d.substr(0,n);if(txt_value=d.substr(n+1,d.length-n-1),"wfu_download_id;"==r.substr(0,16)){var o=r.substr(16),u=document.getElementById("wfu_file_download_container_"+t);u.innerHTML=txt_value,setTimeout("wfu_download_file_monitor('"+e+"', "+t+", '"+o+"')",100)}}},l.send(d)}}function wfu_download_file_monitor(e,t,a){var l=wfu_GetHttpRequestObject();if(null!=l){var n=AdminParams.wfu_ajax_url;params=new Array(3),params[0]=new Array(2),params[0][0]="action",params[0][1]="wfu_ajax_action_download_file_monitor",params[1]=new Array(2),params[1][0]="file",params[1][1]=e,params[2]=new Array(2),params[2][0]="id",params[2][1]=a;for(var d="",r=0;r<params.length;r++)d+=(r>0?"&":"")+params[r][0]+"="+encodeURI(params[r][1]);l.open("POST",n,!0),l.setRequestHeader("Content-type","application/x-www-form-urlencoded"),l.onreadystatechange=function(){if(4==l.readyState&&200==l.status){var a="wfu_ajax_action_download_file_monitor:",n=l.responseText.indexOf(a);-1==n&&(n=l.responseText.length);var d=(l.responseText.substr(0,n),l.responseText.substr(n+a.length,l.responseText.length-n-a.length));n=d.indexOf(":");var r=d.substr(0,n);if(txt_value=d.substr(n+1,d.length-n-1),"repeat"!=r){var o=document.getElementById("wfu_file_download_container_"+t);o.innerHTML=""}else"repeat"==r&&setTimeout("wfu_download_file_monitor('"+e+"', "+t+", '"+txt_value+"')",100)}},l.send(d)}}function wfu_file_downloaded_monitor(e,t,a,l){var n=wfu_GetHttpRequestObject();if(null!=n){var d=AdminParams.wfu_ajax_url;params=new Array(4),params[0]=new Array(2),params[0][0]="action",params[0][1]="wfu_ajax_action_download_file_invoker",params[1]=new Array(2),params[1][0]="file",params[1][1]=e,params[2]=new Array(2),params[2][0]="dataid",params[2][1]=t,params[3]=new Array(2),params[3][0]="nonce",params[3][1]=l;for(var r="",o=0;o<params.length;o++)r+=(o>0?"&":"")+params[o][0]+"="+encodeURI(params[o][1]);n.open("POST",d,!0),n.setRequestHeader("Content-type","application/x-www-form-urlencoded"),n.onreadystatechange=function(){if(4==n.readyState&&200==n.status){var e="wfu_ajax_action_download_file_invoker:",t=n.responseText.indexOf(e);-1==t&&(t=n.responseText.length);var l=(n.responseText.substr(0,t),n.responseText.substr(t+e.length,n.responseText.length-t-e.length)),d=document.getElementById("wfu_file_download_container_"+a),r=function(){console.log(d.children[0].contentWindow.document),d.children[0].contentWindow&&console.log(),setTimeout(r,100)};d.innerHTML=l,r()}},n.send(r)}}function wfu_filedetails_userdata_changed(){for(var e,t,a=document.getElementsByName("wfu_filedetails_userdata"),l=!1,n=0;n<a.length;n++)if(e=document.getElementById(a[n].id.replace("wfu_filedetails_userdata_value_","wfu_filedetails_userdata_default_")),t=document.getElementById(a[n].id.replace("wfu_filedetails_userdata_value_","wfu_filedetails_userdata_")),t.value=a[n].value,a[n].value!=e.value){l=!0;break}document.getElementById("dp_filedetails_submit_fields").disabled=!l}function wfu_Attach_FileDetails_Admin_Events(){for(var e=document.getElementsByName("wfu_filedetails_userdata"),t=0;t<e.length;t++)wfu_attach_element_handlers(e[t],wfu_filedetails_userdata_changed)}var DraggedItem=null,ShortcodeNextSave=0,ShortcodeTimeOut=null,ShortcodeString="",Autosave=!1,PageObsolete=!1,PageUpdating=!1,CheckObsolescenceTimeOut=5e3;jQuery(document).ready(function(e){e(".wfu_color_field").wpColorPicker({change:function(e,t){e.target.value=t.color.toString(),"wfu_text_elements"==e.target.name?wfu_update_text_value(e):"wfu_triplecolor_elements"==e.target.name&&wfu_update_triplecolor_value(e)}})});
1
+ function wfu_admin_activate_tab(e){for(var t,a,l=document.getElementById("wfu_tab_container"),n=0;n<l.childNodes.length;n++)t=l.childNodes[n],1===t.nodeType&&(a=t.id.substr(8),t.className.indexOf("nav-tab-active")>-1&&(t.className="nav-tab",document.getElementById("wfu_container_"+a).style.display="none"));document.getElementById("wfu_tab_"+e).className="nav-tab nav-tab-active",document.getElementById("wfu_container_"+e).style.display="block"}function wfu_admin_onoff_clicked(e){var t=document.getElementById("wfu_attribute_"+e),a=document.getElementById("wfu_wrapper"),l=document.getElementsByClassName("wfu_shadow_"+e,"div",a),n=document.getElementsByClassName("wfu_shadow_"+e+"_inv","div",a),d="on"==t.className.substr(t.className.length-2);if(d=!d){document.getElementById("wfu_attribute_value_"+e).value="true",t.className="wfu_onoff_container_on";for(var u=0;u<l.length;u++)l[u].style.display="none";for(var u=0;u<n.length;u++)n[u].style.display="block"}else{document.getElementById("wfu_attribute_value_"+e).value="false",t.className="wfu_onoff_container_off";for(var u=0;u<l.length;u++)l[u].style.display="block";for(var u=0;u<n.length;u++)n[u].style.display="none"}wfu_generate_shortcode(),"userdata"==e&&wfu_update_userfield_variables()}function wfu_admin_radio_clicked(e){var t=document.getElementsByName("wfu_radioattribute_"+e),a=document.getElementById("wfu_wrapper"),l=document.getElementsByClassName("wfu_shadow_"+e,"div",a),n=document.getElementsByClassName("wfu_shadow_"+e+"_inv","div",a),d="";for(r=0;r<t.length;r++)t[r].checked&&(d=t[r].value);var u="*"==d.substr(0,1);if(u){d=d.substr(1);for(var r=0;r<l.length;r++)l[r].style.display="none";for(var r=0;r<n.length;r++)n[r].style.display="block"}else{for(var r=0;r<l.length;r++)l[r].style.display="block";for(var r=0;r<n.length;r++)n[r].style.display="none"}document.getElementById("wfu_attribute_value_"+e).value=d,wfu_generate_shortcode()}function wfu_addEventHandler(e,t,a){e.addEventListener?e.addEventListener(t,a,!1):e.attachEvent?e.attachEvent("on"+t,a):e["on"+t]=a}function wfu_attach_separator_dragdrop_events(){for(var e,t=document.getElementById("wfu_placements_container"),a=0;a<t.childNodes.length;a++)e=t.childNodes[a],("wfu_component_separator_hor"==e.className||"wfu_component_separator_ver"==e.className)&&(wfu_addEventHandler(e,"dragenter",wfu_separator_dragenter),wfu_addEventHandler(e,"dragover",wfu_default_dragover),wfu_addEventHandler(e,"dragleave",wfu_separator_dragleave),wfu_addEventHandler(e,"drop",wfu_separator_drop))}function wfu_Attach_Admin_DragDrop_Events(){if(window.FileReader){for(var e,t=document.getElementById("wfu_placements_container"),a=document.getElementById("wfu_componentlist_container"),l=0;l<t.childNodes.length;l++)e=t.childNodes[l],"wfu_component_box"==e.className&&(wfu_addEventHandler(e,"dragstart",wfu_component_dragstart),wfu_addEventHandler(e,"dragend",wfu_component_dragend));for(var l=0;l<a.childNodes.length;l++)if(e=a.childNodes[l],"wfu_component_box_container"==e.className)for(var n=0;n<e.childNodes.length;n++)"wfu_component_box wfu_inbase"==e.childNodes[n].className&&(wfu_addEventHandler(e.childNodes[n],"dragstart",wfu_component_dragstart),wfu_addEventHandler(e.childNodes[n],"dragend",wfu_component_dragend));e=document.getElementById("wfu_componentlist_dragdrop"),wfu_addEventHandler(e,"dragenter",wfu_componentlist_dragenter),wfu_addEventHandler(e,"dragover",wfu_default_dragover),wfu_addEventHandler(e,"dragleave",wfu_componentlist_dragleave),wfu_addEventHandler(e,"drop",wfu_componentlist_drop),wfu_attach_separator_dragdrop_events()}}function wfu_componentlist_dragenter(e){if(e=e||window.event,e.preventDefault&&e.preventDefault(),!DraggedItem)return!1;var t=document.getElementById("wfu_componentlist_dragdrop");return-1==t.className.indexOf("wfu_componentlist_dragdrop_dragover")&&(t.className+=" wfu_componentlist_dragdrop_dragover"),!1}function wfu_componentlist_dragleave(e){if(e=e||window.event,e.preventDefault&&e.preventDefault(),!DraggedItem)return!1;var t=document.getElementById("wfu_componentlist_dragdrop");return t.className=t.className.replace(" wfu_componentlist_dragdrop_dragover",""),!1}function wfu_componentlist_drop(e){e=e||window.event,e.preventDefault&&e.preventDefault();var t=e.dataTransfer.getData("Component");if(!t)return!1;var a=document.getElementById("wfu_component_box_"+t);a.className="wfu_component_box wfu_inbase",a.style.display="block",document.getElementById("wfu_component_box_container_"+t).appendChild(a);var l=wfu_admin_recreate_placements_text(null,"");return wfu_admin_recreate_placements_panel(l),document.getElementById("wfu_attribute_value_placements").value=l,wfu_generate_shortcode(),!1}function wfu_separator_dragenter(e){if(e=e||window.event,e.preventDefault&&e.preventDefault(),!DraggedItem)return!1;if("wfu_component_separator_hor"==e.target.className){var t=document.getElementById("wfu_component_bar_hor");t.style.top=e.target.offsetTop+"px",t.style.display="block"}else if("wfu_component_separator_ver"==e.target.className){var t=document.getElementById("wfu_component_bar_ver");t.style.top=e.target.offsetTop+"px",t.style.left=e.target.offsetLeft+"px",t.style.display="block"}return!1}function wfu_default_dragover(e){return e=e||window.event,e.preventDefault&&e.preventDefault(),!1}function wfu_separator_dragleave(e){if(e=e||window.event,e.preventDefault&&e.preventDefault(),!DraggedItem)return!1;if("wfu_component_separator_hor"==e.target.className){var t=document.getElementById("wfu_component_bar_hor");t.style.display="none"}else if("wfu_component_separator_ver"==e.target.className){var t=document.getElementById("wfu_component_bar_ver");t.style.display="none"}return!1}function wfu_separator_drop(e){e=e||window.event,e.preventDefault&&e.preventDefault();var t=e.dataTransfer.getData("Component");if(!t)return!1;var a=document.getElementById("wfu_component_box_"+t);a.style.display="none",a.className="wfu_component_box wfu_inbase",document.getElementById("wfu_component_box_container_"+t).appendChild(a);var l=wfu_admin_recreate_placements_text(e.target,t);return wfu_admin_recreate_placements_panel(l),document.getElementById("wfu_attribute_value_placements").value=l,wfu_generate_shortcode(),!1}function wfu_component_dragstart(e){e=e||window.event,e.dataTransfer.setData("Component",e.target.id.replace("wfu_component_box_","")),-1==e.target.className.indexOf("wfu_component_box_dragged")&&(e.target.className+=" wfu_component_box_dragged",DraggedItem=e.target),e.target.style.zIndex=3;var t=document.getElementById("wfu_componentlist_dragdrop");return t.className="wfu_componentlist_dragdrop wfu_componentlist_dragdrop_dragover",t.style.display="block",!1}function wfu_component_dragend(e){e=e||window.event,DraggedItem=null,e.target.style.zIndex=1;var t=document.getElementById("wfu_componentlist_dragdrop");return t.style.display="none",t.className="wfu_componentlist_dragdrop",e.target.className=e.target.className.replace(" wfu_component_box_dragged",""),document.getElementById("wfu_component_bar_ver").style.display="none",document.getElementById("wfu_component_bar_hor").style.display="none",!1}function wfu_admin_recreate_placements_text(e,t){function a(e){""!=d&&(d+=n),d+=e,n=""}for(var l=document.getElementById("wfu_placements_container"),n="",d="",u=0;u<l.childNodes.length;u++)item=l.childNodes[u],"wfu_component_separator_ver"==item.className?(""==n&&(n="+"),item==e&&(a(t),n="+")):"wfu_component_separator_hor"==item.className?(n="/",item==e&&(a(t),n="/")):"wfu_component_box"==item.className&&a(item.id.replace("wfu_component_box_",""));return d}function wfu_admin_recreate_placements_panel(e){for(var t,a,l,n=document.getElementById("wfu_placements_container"),d="",u=0;u<n.childNodes.length;u++)t=n.childNodes[u],"wfu_component_box"==t.className&&(d=t.id.replace("wfu_component_box_",""),t.style.display="inline-block",t.className="wfu_component_box wfu_inbase",document.getElementById("wfu_component_box_container_"+d).appendChild(t));n.innerHTML="",a=e.split("/");for(var u=0;u<a.length;u++){t=document.createElement("DIV"),t.className="wfu_component_separator_hor",t.setAttribute("draggable",!0),n.appendChild(t),t=document.createElement("DIV"),t.className="wfu_component_separator_ver",t.setAttribute("draggable",!0),n.appendChild(t),l=a[u].split("+");for(var r=0;r<l.length;r++)t=document.getElementById("wfu_component_box_"+l[r]),t&&(n.appendChild(t),t.className="wfu_component_box",t.style.display="inline-block",t=document.createElement("DIV"),t.className="wfu_component_separator_ver",t.setAttribute("draggable",!0),n.appendChild(t))}t=document.createElement("DIV"),t.className="wfu_component_separator_hor",t.setAttribute("draggable",!0),n.appendChild(t),t=document.createElement("DIV"),t.id="wfu_component_bar_hor",t.className="wfu_component_bar_hor",n.appendChild(t),t=document.createElement("DIV"),t.id="wfu_component_bar_ver",t.className="wfu_component_bar_ver",n.appendChild(t),wfu_attach_separator_dragdrop_events()}function wfu_subfolders_input_changed(e){e=e||window.event;var t=e.target,a=t.id.replace("wfu_subfolders_path_","");a=a.replace("wfu_subfolders_label_","");var l=document.getElementById("wfu_attribute_"+a);if(!(l.selectedIndex<0)){var n,d,u=document.getElementById("wfu_subfolders_path_"+a),r=document.getElementById("wfu_subfolders_label_"+a),o=document.getElementById("wfu_subfolders_ok_"+a),_="1"==document.getElementById("wfu_subfolders_isnewitem_"+a).value;if(_)n="",d="";else{var s=l.data;t=s[l.selectedIndex],n=t.path,d=t.label}if(u.value==n&&r.value==d)o.disabled=!0,_||wfu_subfolders_update_nav(a);else{o.disabled=!1;for(var f=document.getElementsByName("wfu_subfolder_nav_"+a),i=0;i<f.length;i++)f[i].disabled=!0}}}function wfu_subfolders_up_clicked(e){var t=document.getElementById("wfu_attribute_"+e);if(!(t.selectedIndex<0)){var a=t.data;item=a[t.selectedIndex];var l=item.index-1;if(!(0>l)){for(var n=-1,d=t.selectedIndex-1;d>=0;){if(a[d].level==item.level&&a[d].index==l){n=d;break}d--}if(-1!=n){var u=0;for(d=t.selectedIndex+1;d<a.length&&a[d].level>item.level;)u++,d++;a[n].index=item.index,item.index=l,t.data=a.slice(0,n).concat(a.slice(t.selectedIndex,t.selectedIndex+1+u)).concat(a.slice(n,t.selectedIndex)).concat(a.slice(t.selectedIndex+1+u));var r=wfu_update_subfolder_list(e);t.selectedIndex=n,wfu_subfolders_update_toolnav(e),item=t,r!==item.oldVal&&(item.oldVal=r,document.getElementById("wfu_attribute_value_"+e).value=r,wfu_generate_shortcode())}}}}function wfu_subfolders_down_clicked(e){var t=document.getElementById("wfu_attribute_"+e);if(!(t.selectedIndex<0)){var a=t.data;item=a[t.selectedIndex];var l=item.index+1,n=-1;for(curind=t.selectedIndex+1;curind<a.length;){if(a[curind].level==item.level){n=curind;break}if(a[curind].level<item.level)break;curind++}if(-1!=n){var d=0;for(curind=n+1;curind<a.length&&a[curind].level>item.level;)d++,curind++;a[n].index=item.index,item.index=l,t.data=a.slice(0,t.selectedIndex).concat(a.slice(n,n+1+d)).concat(a.slice(t.selectedIndex,n)).concat(a.slice(n+1+d));var u=wfu_update_subfolder_list(e);t.selectedIndex=t.selectedIndex+d+1,wfu_subfolders_update_toolnav(e),item=t,u!==item.oldVal&&(item.oldVal=u,document.getElementById("wfu_attribute_value_"+e).value=u,wfu_generate_shortcode())}}}function wfu_subfolders_left_clicked(e){var t=document.getElementById("wfu_attribute_"+e);if(!(t.selectedIndex<0)){var a=t.data;for(item=a[t.selectedIndex],curind=t.selectedIndex+1;curind<a.length&&a[curind].level>item.level;)a[curind].level--,curind++;item.level--;var l=wfu_update_subfolder_list(e);t.data=wfu_decode_subfolder_list(e),wfu_subfolders_update_toolnav(e),item=t,l!==item.oldVal&&(item.oldVal=l,document.getElementById("wfu_attribute_value_"+e).value=l,wfu_generate_shortcode())}}function wfu_subfolders_right_clicked(e){var t=document.getElementById("wfu_attribute_"+e);if(!(t.selectedIndex<0)){var a=t.data;for(item=a[t.selectedIndex],curind=t.selectedIndex+1;curind<a.length&&a[curind].level>item.level;)a[curind].level++,curind++;item.level++;var l=wfu_update_subfolder_list(e);t.data=wfu_decode_subfolder_list(e),wfu_subfolders_update_toolnav(e),item=t,l!==item.oldVal&&(item.oldVal=l,document.getElementById("wfu_attribute_value_"+e).value=l,wfu_generate_shortcode())}}function wfu_subfolders_def_clicked(e){var t=document.getElementById("wfu_attribute_"+e);if(!(t.selectedIndex<0)){var a=t.data;if(item=a[t.selectedIndex],item.default)item.default=!1;else{for(var l=0;l<a.length;l++)a[l].default=!1;item.default=!0}var n=wfu_update_subfolder_list(e);wfu_subfolders_update_toolnav(e),item=t,n!==item.oldVal&&(item.oldVal=n,document.getElementById("wfu_attribute_value_"+e).value=n,wfu_generate_shortcode())}}function wfu_subfolders_ok_clicked(e){var t=document.getElementById("wfu_attribute_"+e);if(!(t.selectedIndex<0)){var a=document.getElementById("wfu_subfolders_path_"+e),l=document.getElementById("wfu_subfolders_label_"+e);if(""==a.value||""==l.value)return void alert("Path or label cannot be empty!");var n=t.data,d="1"==document.getElementById("wfu_subfolders_isnewitem_"+e).value;if(d){var u=parseInt(document.getElementById("wfu_subfolders_newitemlevel_"+e).value),r={label:l.value,path:a.value,level:u,"default":!1},o=parseInt(document.getElementById("wfu_subfolders_newitemindex_"+e).value);o>=n.length?n.push(r):n.splice(o,0,r)}else item=n[t.selectedIndex],item.path=a.value,item.label=l.value;var _=wfu_update_subfolder_list(e);t.data=wfu_decode_subfolder_list(e),wfu_subfolders_update_toolnav(e),item=t,_!==item.oldVal&&(item.oldVal=_,document.getElementById("wfu_attribute_value_"+e).value=_,wfu_generate_shortcode())}}function wfu_subfolders_del_clicked(e){var t=document.getElementById("wfu_attribute_"+e);if(!(t.selectedIndex<0)){var a=t.data;item=a[t.selectedIndex];var l=0;for(curind=t.selectedIndex+1;curind<a.length&&a[curind].level>item.level;)l++,curind++;if(!(l>0)||confirm("Children items will be deleted as well. Proceed?")){a.splice(t.selectedIndex,1+l);var n=wfu_update_subfolder_list(e);t.data=wfu_decode_subfolder_list(e),wfu_subfolders_update_toolnav(e),item=t,n!==item.oldVal&&(item.oldVal=n,document.getElementById("wfu_attribute_value_"+e).value=n,wfu_generate_shortcode())}}}function wfu_subfolders_add_clicked(e){var t=document.getElementById("wfu_attribute_"+e);if(!(t.selectedIndex<0)){var a=t.data,l=t.selectedIndex;item=a[l];var n=t.options,d=document.createElement("option");d.value="",d.innerHTML="",n.add(d,l),t.selectedIndex=l;var u=document.getElementById("wfu_subfolder_tools_"+e),r=document.getElementById("wfu_subfolders_path_"+e),o=document.getElementById("wfu_subfolders_label_"+e),_=document.getElementById("wfu_subfolders_ok_"+e),s=document.getElementById("wfu_subfolders_browse_"+e);u.className="wfu_subfolder_tools_container",o.disabled=!1,_.disabled=!0,document.getElementById("wfu_subfolders_isnewitem_"+e).value="1",document.getElementById("wfu_subfolders_newitemindex_"+e).value=l,document.getElementById("wfu_subfolders_newitemlevel_"+e).value=item.level,document.getElementById("wfu_subfolders_newitemlevel2_"+e).value="",r.disabled=0==item.level,s.disabled=0==item.level,0==item.level?(r.value="{root}",o.value="{upload folder}"):(r.value="",o.value="");for(var f=document.getElementsByName("wfu_subfolder_nav_"+e),i=0;i<f.length;i++)f[i].disabled=!0}}function wfu_subfolders_browse_clicked(e){var t=wfu_GetHttpRequestObject();if(null!=t){var a=null;try{var a=new FormData}catch(l){}if(null!=a){for(var n=document.getElementById("wfu_global_dialog_container"),d=document.getElementById("wfu_subfolders_browser_"+e),u=document.getElementById("wfu_subfolders_browse_"+e),r=document.getElementById("wfu_subfolders_inner_shadow_"+e),o=document.getElementById("wfu_subfolders_browser_msgcont_"+e),_=document.getElementById("wfu_subfolders_browser_msg_"+e),s=document.getElementById("wfu_subfolders_browser_img_"+e),f=document.getElementById("wfu_subfolders_browser_ok_"+e),i=document.getElementById("wfu_subfolders_browser_list_"+e);i.options.length>0;)i.options.remove(0);f.disabled=!0,f.onclick=function(){wfu_folder_browser_cancel_clicked(e)},_.innerHTML="loading folder contents...",s.style.display="inline",o.style.display="block",n.style.display="block",d.style.display="block",d.style.left=u.offsetLeft+u.offsetWidth-d.offsetWidth+"px",d.style.top=u.offsetTop+u.offsetHeight-d.offsetHeight+"px",r.style.display="block",n.onclick=function(){wfu_folder_browser_cancel_clicked(e)};var c=document.getElementById("wfu_attribute_uploadpath").value;"/"==c.substr(c.length-1)&&(c=c.substr(0,c.length-1));var m=wfu_get_relative_path(e).split(","),w=c+m[0];"/"!=w.substr(0)&&(w="/"+w);var g="";2==m.length&&(g=m[1]),a.append("action","wfu_ajax_action_read_subfolders"),a.append("folder1",wfu_plugin_encode_string(w)),a.append("folder2",wfu_plugin_encode_string(g)),t.key=e,t.addEventListener("load",wfu_readfolderComplete,!1),t.addEventListener("error",wfu_readfolderFailed,!1),t.addEventListener("abort",wfu_readfolderCanceled,!1),t.open("POST",AdminParams.wfu_ajax_url),t.send(a)}}}function wfu_readfolderComplete(e){var t=e.target.key,a=document.getElementById("wfu_subfolders_browser_msgcont_"+t),l=document.getElementById("wfu_subfolders_browser_msg_"+t),n=document.getElementById("wfu_subfolders_browser_img_"+t),d=document.getElementById("wfu_subfolders_browser_list_"+t),u=document.getElementById("wfu_subfolders_browser_ok_"+t),r=document.getElementById("wfu_subfolders_path_"+t),o=document.getElementById("wfu_subfolders_label_"+t),_=e.target.responseText;if(-1!=_){var s="wfu_read_subfolders:",f=e.target.responseText.indexOf(s);-1==f&&(f=e.target.responseText.length);var i=(e.target.responseText.substr(0,f),e.target.responseText.substr(f+s.length,e.target.responseText.length-f-s.length));f=i.indexOf(":");var c=i.substr(0,f);if(txt_value=i.substr(f+1,i.length-f-1),"success"==c){for(var m,w=wfu_plugin_decode_string(txt_value),g=w.split(","),p=0,v=0;v<g.length;v++)""!=g[v]&&(m=document.createElement("option"),m.value=g[v],m.innerHTML=g[v].replace("*","&nbsp;&nbsp;&nbsp;"),d.add(m),p++);0==p&&(m=document.createElement("option"),m.value="",m.innerHTML="{empty}",m.disabled=!0,d.add(m)),d.selectedIndex=-1,u.onclick=function(){var e=d.options[d.selectedIndex].value,a=parseInt(document.getElementById("wfu_subfolders_newitemlevel_"+t).value);("*"==e.substr(0,1)||0==a)&&(document.getElementById("wfu_subfolders_newitemlevel_"+t).value=a+1,a>0&&(e=e.substr(1))),r.value=e,o.value=e,wfu_folder_browser_cancel_clicked(t),wfu_subfolders_ok_clicked(t)},a.style.display="none"}else"error"==c?(l.innerHTML=txt_value,n.style.display="none",u.disabled=!1):(l.innerHTML="Unknown error",n.style.display="none",u.disabled=!1)}}function wfu_readfolderFailed(e){var t=e.target.key,a=document.getElementById("wfu_subfolders_browser_msg_"+t),l=document.getElementById("wfu_subfolders_browser_img_"+t),n=document.getElementById("wfu_subfolders_browser_ok_"+t);a.innerHTML="Unknown error",l.style.display="none",n.disabled=!1}function wfu_readfolderCanceled(e){var t=e.target.key,a=document.getElementById("wfu_subfolders_browser_msg_"+t),l=document.getElementById("wfu_subfolders_browser_img_"+t),n=document.getElementById("wfu_subfolders_browser_ok_"+t);a.innerHTML="Unknown error",l.style.display="none",n.disabled=!1}function wfu_subfolders_browser_list_changed(e){var t=document.getElementById("wfu_subfolders_browser_list_"+e),a=document.getElementById("wfu_subfolders_browser_ok_"+e);a.disabled=t.selectedIndex<0}function wfu_folder_browser_cancel_clicked(e){var t=document.getElementById("wfu_global_dialog_container"),a=document.getElementById("wfu_subfolders_browser_"+e),l=(document.getElementById("wfu_subfolders_browse_"+e),document.getElementById("wfu_subfolders_inner_shadow_"+e));t.onclick=null,l.style.display="none",a.style.display="none",t.style.display="none"}function wfu_get_relative_path(e){var t=document.getElementById("wfu_attribute_"+e);if(!(t.selectedIndex<0)){var a,l=t.data,n="1"==document.getElementById("wfu_subfolders_isnewitem_"+e).value;a=n?parseInt(document.getElementById("wfu_subfolders_newitemlevel_"+e).value):l[t.selectedIndex].level;for(var d="/",u=t.selectedIndex-1,r=a;u>=0&&r>1;)l[u].level<r&&(d="/"+l[u].path+d,r=l[u].level),u--;return n&&"1"==document.getElementById("wfu_subfolders_newitemlevel2_"+e).value&&a>0&&t.selectedIndex>0&&(d+=","+l[t.selectedIndex-1].path),d}}function wfu_subfolders_changed(e){wfu_update_subfolder_list(e),wfu_subfolders_update_toolnav(e)}function wfu_subfolders_update_toolnav(e){var t,a,l=document.getElementById("wfu_attribute_"+e),n=document.getElementById("wfu_subfolder_tools_"+e),d=document.getElementById("wfu_subfolders_path_"+e),u=document.getElementById("wfu_subfolders_label_"+e),r=document.getElementById("wfu_subfolders_ok_"+e),o=document.getElementById("wfu_subfolders_browse_"+e);if(document.getElementById("wfu_subfolders_isnewitem_"+e).value="",document.getElementById("wfu_subfolders_newitemindex_"+e).value="",document.getElementById("wfu_subfolders_newitemlevel_"+e).value="",document.getElementById("wfu_subfolders_newitemlevel2_"+e).value="",null==l.data?(t=wfu_decode_subfolder_list(e),l.data=t):t=l.data,0===l.data.length?(l.className="wfu_select_folders wfu_select_folders_empty",l.options[0].innerHTML="press here"):l.className="wfu_select_folders",l.selectedIndex<0)n.className="wfu_subfolder_tools_container wfu_subfolder_tools_disabled",d.disabled=!0,u.disabled=!0,r.disabled=!0,o.disabled=!0,u.value="",d.value="";else if(l.selectedIndex>=l.options.length-1){n.className="wfu_subfolder_tools_container",u.disabled=!1,r.disabled=!0,document.getElementById("wfu_subfolders_isnewitem_"+e).value="1",document.getElementById("wfu_subfolders_newitemindex_"+e).value=t.length;var _;_=0==t.length?0:0==t[t.length-1].level?1:t[t.length-1].level,document.getElementById("wfu_subfolders_newitemlevel_"+e).value=_,document.getElementById("wfu_subfolders_newitemlevel2_"+e).value="1",d.disabled=0==_,o.disabled=!1,0==_?(d.value="{root}",u.value="{upload folder}"):(d.value="",u.value="")}else n.className="wfu_subfolder_tools_container",u.disabled=!1,r.disabled=!0,a=t[l.selectedIndex],d.disabled=0==a.level,o.disabled=0==a.level,u.value=a.label,d.value=a.path;var s=document.getElementsByName("wfu_subfolder_nav_"+e);if(l.selectedIndex<0||l.selectedIndex>=l.options.length-1)for(var f=0;f<s.length;f++)s[f].disabled=!0;else wfu_subfolders_update_nav(e)}function wfu_subfolders_update_nav(e){var t=document.getElementById("wfu_attribute_"+e),a=document.getElementById("wfu_subfolders_up_"+e),l=document.getElementById("wfu_subfolders_down_"+e),n=document.getElementById("wfu_subfolders_left_"+e),d=document.getElementById("wfu_subfolders_right_"+e),u=document.getElementById("wfu_subfolders_add_"+e),r=document.getElementById("wfu_subfolders_def_"+e),o=document.getElementById("wfu_subfolders_del_"+e),_=t.data,s=_[t.selectedIndex];for(a.disabled=s.index<=0,ind=t.selectedIndex+1,nextind=0;ind<_.length;){if(_[ind].level==s.level){nextind=_[ind].index;break}if(_[ind].level<s.level)break;ind++}l.disabled=0==s.level||0==nextind,n.disabled=0==t.selectedIndex&&s.level<1||t.selectedIndex>0&&s.level<=1,prevlevel=t.selectedIndex>=1?_[t.selectedIndex-1].level:0,d.disabled=s.level-prevlevel>0,u.disabled=0==s.level,r.disabled=!1,r.className="button"+(s.default?" wfu_subfolder_nav_pressed":""),o.disabled=!1}function wfu_decode_subfolder(e){var t={label:"",path:"",level:0,"default":!1};e=e.trim();for(var a=0,l=!1;a<e.length&&"*"==e.substr(a,1);)a++;e=e.substr(a,e.length-a),"&"==e.substr(0,1)&&(e=e.substr(1),l=!0),t.level=a,t.default=l;var n=e.split("/");return 1==n.length?(t.path=n[0],t.label=n[0]):n.length>1&&(t.path=n[0],t.label=n[1]),0==a&&(t.path="{root}",""==t.label&&(t.label="{upload folder}")),t}function wfu_decode_subfolder_list(e){for(var t,a=document.getElementById("wfu_attribute_"+e).options,l=Array(),n=["root"],d=[0],u=-1,r=0;r<a.length-1;r++){for(l.push(wfu_decode_subfolder(wfu_plugin_decode_string(a[r].value))),n.length>l[r].level?n[l[r].level]=l[r].path:n.push(l[r].path),t="",j=1;j<=l[r].level;j++)t+=n[j]+"/";l[r].fullpath=t,d.length<=l[r].level&&d.push(0),l[r].index=l[r].level>u?0:d[l[r].level]+1,d[l[r].level]=l[r].index,u=l[r].level}return l}function wfu_update_subfolder_list(e){var t=document.getElementById("wfu_attribute_"+e).options,a=document.getElementById("wfu_attribute_"+e),l=a.data;if(null!=l){var n,d,u="";t.length=l.length+1;for(var r=0;r<l.length;r++){for(n="",d="",j=0;j<l[r].level;j++)n+="*",d+="&nbsp;&nbsp;&nbsp;";l[r].default?(n+="&",t[r].className="wfu_select_folders_option_default"):t[r].className="",n+=l[r].path+"/"+l[r].label,d+=l[r].label,t[r].value=wfu_plugin_encode_string(n),t[r].innerHTML=d,""!=u&&(u+=","),u+=n}return t[l.length].value="",t[l.length].innerHTML="",u}}function wfu_userdata_edit_field(e,t,a){for(var l,n=0;n<e.childNodes.length;n++)l=e.childNodes[n],"INPUT"==l.tagName?"text"==l.type?(l.value=t,wfu_attach_element_handlers(l,wfu_update_userfield_value)):"checkbox"==l.type&&(l.checked=a):"DIV"==l.tagName&&(l.className="wfu_userdata_action")}function wfu_userdata_add_field(e){var t=e.parentNode,a=t.cloneNode(!0);wfu_userdata_edit_field(a,"",!1),t.parentNode.insertBefore(a,t.nextSibling)}function wfu_userdata_remove_field(e){for(var t=e.parentNode,a=t.parentNode,l=null,n=0;n<a.childNodes.length;n++)if(1===a.childNodes[n].nodeType){l=a.childNodes[n];break}if(t!=l){t.parentNode.removeChild(t);for(var n=0;n<l.childNodes.length;n++)if(1===l.childNodes[n].nodeType){wfu_update_userfield_value({target:l.childNodes[n]});break}}}function wfu_generate_shortcode(){for(var e,t=document.getElementById("wfu_attribute_defaults"),a=(document.getElementById("wfu_attribute_values"),""),l="",n="[wordpress_file_upload",d="",u=0;u<t.childNodes.length;u++)e=t.childNodes[u],1===e.nodeType&&(a=e.id.replace("wfu_attribute_default_",""),l=document.getElementById("wfu_attribute_value_"+a).value,e.value!=l&&(d+=" "+a+'="'+l+'"'));n+=d+"]",document.getElementById("wfu_shortcode").value=n,ShortcodeString=d.substr(1),document.getElementById("wfu_update_shortcode")&&(document.getElementById("wfu_update_shortcode").disabled=wfu_plugin_encode_string(n)==document.getElementById("wfu_shortcode_original_enc").value),Autosave&&wfu_schedule_save_shortcode()}function wfu_update_text_value(e){e=e||window.event;var t=e.target,a=t.id.replace("wfu_attribute_",""),l=t.value;l=l.replace(/(\r\n|\n|\r)/gm,"%n%"),l=l.replace(/\"/gm,"%dq%"),l=l.replace(/\[/gm,"%brl%"),l=l.replace(/\]/gm,"%brr%"),l!==t.oldVal&&(t.oldVal=l,document.getElementById("wfu_attribute_value_"+a).value=l,wfu_generate_shortcode())}function wfu_update_triplecolor_value(e){e=e||window.event;var t=e.target,a=t.id.replace("wfu_attribute_","");a=a.replace("_color",""),a=a.replace("_bgcolor",""),a=a.replace("_borcolor",""),t=document.getElementById("wfu_attribute_"+a+"_color");var l=t.value+","+document.getElementById("wfu_attribute_"+a+"_bgcolor").value+","+document.getElementById("wfu_attribute_"+a+"_borcolor").value;l!==t.oldVal&&(t.oldVal=l,document.getElementById("wfu_attribute_value_"+a).value=l,wfu_generate_shortcode())}function wfu_update_dimension_value(e){e=e||window.event;var t=e.target,a=t.name.replace("wfu_dimension_elements_",""),l=document.getElementsByName(t.name);t=l[0];for(var n="",d="",u=0;u<l.length;u++)d=l[u].id.replace("wfu_attribute_"+a+"_",""),""!=n&&""!=l[u].value&&(n+=", "),""!=l[u].value&&(n+=d+":"+l[u].value);n!==t.oldVal&&(t.oldVal=n,document.getElementById("wfu_attribute_value_"+a).value=n,wfu_generate_shortcode())}function wfu_update_ptext_value(e){e=e||window.event;var t=e.target,a=t.id.replace("wfu_attribute_","");a=a.substr(2);var l=document.getElementById("wfu_attribute_s_"+a).value,n=document.getElementById("wfu_attribute_p_"+a).value,d=l+"/"+n;d!==t.oldVal&&(t.oldVal=d,document.getElementById("wfu_attribute_value_"+a).value=d),wfu_generate_shortcode()}function wfu_update_mchecklist_value(e){var t="",a=(document.getElementById("wfu_attribute_"+e),document.getElementById("wfu_attribute_"+e+"_all"));a.checked?(jQuery("#wfu_attribute_"+e+" input").prop("disabled",!0),jQuery("#wfu_attribute_"+e+" input").prop("checked",!0),t="all"):(jQuery("#wfu_attribute_"+e+" input").prop("disabled",!1),jQuery("#wfu_attribute_"+e+" input").each(function(){jQuery(this).prop("checked")&&(t+=","+jQuery(this).next().html())}),t=t.substr(1)),document.getElementById("wfu_attribute_value_"+e).value=t,wfu_generate_shortcode()}function wfu_update_rolelist_value(e){var t="",a=document.getElementById("wfu_attribute_"+e),l=document.getElementById("wfu_attribute_"+e+"_all");if(l.checked)a.disabled=!0,t="all";else{a.disabled=!1;for(var n=a.options,d=0;d<n.length;d++)n[d].selected&&(""!=t&&(t+=","),t+=n[d].value)}document.getElementById("wfu_attribute_value_"+e).value=t,wfu_generate_shortcode()}function wfu_update_userfield_value(e){e=e||window.event;for(var t=e.target,a=t.parentNode,l=a.parentNode,n="",d=!1,u="",r=0;r<l.childNodes.length;r++)if(a=l.childNodes[r],"DIV"===a.tagName){for(var o=0;o<a.childNodes.length;o++)"INPUT"==a.childNodes[o].tagName&&("text"==a.childNodes[o].type?(n=a.childNodes[o].value,0==r&&(t=a.childNodes[o])):"checkbox"==a.childNodes[o].type&&(d=a.childNodes[o].checked));""!=u&&""!=n&&(u+="/"),""!=n&&d&&(u+="*"),""!=n&&(u+=n)}u!==t.oldVal&&(t.oldVal=u,document.getElementById("wfu_attribute_value_userdatalabel").value=u,wfu_generate_shortcode(),wfu_update_userfield_variables())}function wfu_update_userfield_variables(){for(var e=document.getElementById("wfu_attribute_value_userdatalabel").value,t=document.getElementById("wfu_wrapper"),a=document.getElementsByClassName("wfu_shadow_userdata","div",t),l=document.getElementsByName("wfu_userfield_select"),n=0;n<l.length;n++)l[n].style.display="none";if(0!=a.length&&"block"!=a[0].style.display){for(var d='<option style="display:none;">%userdataXXX%</option>',u=e.split("/"),r="",n=1;n<=u.length;n++)r=u[n-1],"*"==r[0]&&(r=r.substr(1)),d+='<option value="%userdata'+n+'%">'+n+": "+r+"</option>";for(var n=0;n<l.length;n++)l[n].innerHTML=d,l[n].style.display="inline-block"}}function wfu_attach_element_handlers(e,t){for(var a=["DOMAttrModified","textInput","input","change","keypress","paste","focus","propertychange"],l=0;l<a.length;l++)wfu_addEventHandler(e,a[l],t)}function wfu_Attach_Admin_Events(e){Autosave=e,wfu_generate_shortcode(),wfu_update_userfield_variables(),wfu_Attach_Admin_DragDrop_Events();for(var t=document.getElementsByName("wfu_text_elements"),a=0;a<t.length;a++)wfu_attach_element_handlers(t[a],wfu_update_text_value);for(var l=document.getElementsByName("wfu_ptext_elements"),a=0;a<l.length;a++)wfu_attach_element_handlers(l[a],wfu_update_ptext_value);for(var n=document.getElementsByName("wfu_triplecolor_elements"),a=0;a<n.length;a++)wfu_attach_element_handlers(n[a],wfu_update_triplecolor_value);for(var d=document.getElementsByName("wfu_dimension_elements_widths"),a=0;a<d.length;a++)wfu_attach_element_handlers(d[a],wfu_update_dimension_value);d=document.getElementsByName("wfu_dimension_elements_heights");for(var a=0;a<d.length;a++)wfu_attach_element_handlers(d[a],wfu_update_dimension_value);for(var u=document.getElementsByName("wfu_userfield_elements"),a=0;a<u.length;a++)wfu_attach_element_handlers(u[a],wfu_update_userfield_value);for(var r=document.getElementsByName("wfu_subfolder_tools_input"),a=0;a<r.length;a++)wfu_attach_element_handlers(r[a],wfu_subfolders_input_changed);""!=document.getElementById("wfu_shortcode_postid").value&&setTimeout(function(){wfu_check_page_obsolescence()},CheckObsolescenceTimeOut)}function wfu_insert_variable(e){var t=e.className.replace("wfu_variable wfu_variable_",""),a=document.getElementById("wfu_attribute_"+t),l=a.selectionStart,n=a.value;a.value=n.substr(0,l)+e.innerHTML+n.substr(l),wfu_update_text_value({target:a})}function wfu_insert_userfield_variable(e){var t=e.className.replace("wfu_variable wfu_variable_",""),a=document.getElementById("wfu_attribute_"+t),l=a.selectionStart,n=a.value;a.value=n.substr(0,l)+e.value+n.substr(l),e.value="%userdataXXX%",wfu_update_text_value({target:a})
2
+ }function wfu_GetHttpRequestObject(){var e=null;try{e=new XMLHttpRequest}catch(t){try{e=new ActiveXObject("Msxml2.XMLHTTP")}catch(a){try{e=new ActiveXObject("Microsoft.XMLHTTP")}catch(t){}}}if(null==e&&window.createRequest)try{xmlhttp=window.createRequest()}catch(t){}return e}function wfu_plugin_encode_string(e){var t,a=0,l="",n="";for(a=0;a<e.length;a++)t=e.charCodeAt(a),t>=2048?t=((16773120&t|917504)<<4)+((4032&t|8192)<<2)+(63&t|128):t>=128&&(t=((65472&t|12288)<<2)+(63&t|128)),n=t.toString(16),(1==n.length||3==n.length||5==n.length)&&(n="0"+n),l+=n;return l}function wfu_plugin_decode_string(e){for(var t,a,l=0,n="";l<e.length;)t=parseInt(e.substr(l,2),16),a=128>t?t:224>t?((31&t)<<6)+(63&parseInt(e.substr(l+=2,2),16)):((15&t)<<12)+((63&parseInt(e.substr(l+=2,2),16))<<6)+(63&parseInt(e.substr(l+=2,2),16)),n+=String.fromCharCode(a),l+=2;return n}function wfu_schedule_save_shortcode(){var e=new Date,t=ShortcodeNextSave-e.getTime();null!=ShortcodeTimeOut&&(clearTimeout(ShortcodeTimeOut),ShortcodeTimeOut=null),0>=t?wfu_save_shortcode():ShortcodeTimeOut=setTimeout(function(){wfu_save_shortcode()},t)}function wfu_check_page_obsolescence(){PageObsolete||PageUpdating||""==document.getElementById("wfu_shortcode_postid").value}function wfu_save_shortcode(){if(!PageObsolete){var e=wfu_GetHttpRequestObject();if(null!=e){PageUpdating=!0,document.getElementById("wfu_update_failed_message").style.display="none";var t=AdminParams.wfu_ajax_url;params=new Array(6),params[0]=new Array(2),params[0][0]="action",params[0][1]="wfu_ajax_action_save_shortcode",params[1]=new Array(2),params[1][0]="shortcode",params[1][1]=wfu_plugin_encode_string(ShortcodeString),params[2]=new Array(2),params[2][0]="shortcode_original",params[2][1]=document.getElementById("wfu_shortcode_original_enc").value,params[3]=new Array(2),params[3][0]="post_id",params[3][1]=document.getElementById("wfu_shortcode_postid").value,params[4]=new Array(2),params[4][0]="post_hash",params[4][1]=document.getElementById("wfu_shortcode_posthash").value,params[5]=new Array(2),params[5][0]="shortcode_position",params[5][1]=document.getElementById("wfu_shortcode_position").value;for(var a="",l=0;l<params.length;l++)a+=(l>0?"&":"")+params[l][0]+"="+encodeURI(params[l][1]);var n=new Date;Autosave?ShortcodeNextSave=n.getTime()+5e3:document.getElementById("wfu_update_shortcode")&&(document.getElementById("wfu_update_shortcode_wait").style.display="inline"),e.open("POST",t,!0),e.setRequestHeader("Content-type","application/x-www-form-urlencoded"),e.onreadystatechange=function(){if(4==e.readyState&&200==e.status){PageUpdating=!1;var t="wfu_save_shortcode:",a=e.responseText.indexOf(t);-1==a&&(a=e.responseText.length);var l=(e.responseText.substr(0,a),e.responseText.substr(a+t.length,e.responseText.length-a-t.length));a=l.indexOf(":");var d=l.substr(0,a);txt_value=l.substr(a+1,l.length-a-1),"success"==d?(Autosave?(document.getElementById("wfu_save_label").innerHTML="saved",document.getElementById("wfu_save_label").className="wfu_save_label",document.getElementById("wfu_save_label").style.opacity=1,wfu_fadeout_element(300),ShortcodeNextSave=n.getTime()+1e3,null!=ShortcodeTimeOut&&wfu_schedule_save_shortcode()):document.getElementById("wfu_update_shortcode")&&(document.getElementById("wfu_update_shortcode_wait").style.display="none",document.getElementById("wfu_update_shortcode").disabled=!0,window.plugin_window&&window.plugin_window.location.reload(!0)),""!=document.getElementById("wfu_shortcode_postid").value&&(document.getElementById("wfu_shortcode_original_enc").value=wfu_plugin_encode_string("[wordpress_file_upload "+ShortcodeString+"]"),document.getElementById("wfu_shortcode_posthash").value=txt_value,setTimeout(function(){wfu_check_page_obsolescence()},CheckObsolescenceTimeOut))):(Autosave&&(document.getElementById("wfu_save_label").innerHTML="not saved",document.getElementById("wfu_save_label").className="wfu_save_label_fail",document.getElementById("wfu_save_label").style.opacity=1,wfu_fadeout_element(300)),"fail"==d&&("post_modified"==txt_value?(PageObsolete=!0,document.getElementById("wfu_update_shortcode")&&(document.getElementById("wfu_update_shortcode").disabled=!0),document.getElementById("wfu_update_rejected_message").style.display="block"):document.getElementById("wfu_update_failed_message").style.display="block"))}},e.send(a)}}}function wfu_adjust_opacity(e){document.getElementById("wfu_save_label").style.opacity=e}function wfu_fadeout_element(e){for(var t=20,a=0,l=0;t>l;l++)a=1-l/t,setTimeout('wfu_adjust_opacity("'+a.toString()+'")',l*e/t);setTimeout('wfu_adjust_opacity("0.0")',l*e/t)}function wfu_apply_value(e,t,a){if("onoff"==t)document.getElementById("wfu_attribute_"+e).className="wfu_onoff_container_"+("true"!=a?"on":"off"),wfu_admin_onoff_clicked(e);else if("text"==t||"ltext"==t||"integer"==t||"float"==t||"mtext"==t||"color"==t){var l=document.getElementById("wfu_attribute_"+e);if(a=a.replace(/\%n\%/gm,"\n"),a=a.replace(/\%dq\%/gm,'"'),a=a.replace(/\%brl\%/gm,"["),a=a.replace(/\%brr\%/gm,"]"),"color"==t){var n=colourNameToHex(a);n||(n=a),jQuery("#wfu_attribute_"+e).wpColorPicker("color",n)}l.value=a,wfu_update_text_value({target:l})}else if("placements"==t)wfu_admin_recreate_placements_panel(a),document.getElementById("wfu_attribute_value_placements").value=a,wfu_generate_shortcode();else if("radio"==t){for(var d=document.getElementsByName("wfu_radioattribute_"+e),u=0;u<d.length;u++)d[u].checked=d[u].value==a||"*"+d[u].value==a;wfu_admin_radio_clicked(e)}else if("ptext"==t){a=a.replace(/\%n\%/gm,"\n"),a=a.replace(/\%dq\%/gm,'"'),a=a.replace(/\%brl\%/gm,"["),a=a.replace(/\%brr\%/gm,"]");var r=a.split("/"),o=r.length<1?"":r[0],_=r.length<2?o:r[1],s=document.getElementById("wfu_attribute_s_"+e);s.value=o;var f=document.getElementById("wfu_attribute_p_"+e);f.value=_,wfu_update_ptext_value({target:s}),wfu_update_ptext_value({target:f})}else if("mchecklist"==t){if(a=a.toLowerCase(),"all"==a)document.getElementById("wfu_attribute_"+e+"_all").checked=!0;else{document.getElementById("wfu_attribute_"+e+"_all").checked=!1;for(var i=a.split(","),u=0;u<i.length;u++)i[u]=i[u].trim();jQuery("#wfu_attribute_"+e+" input").each(function(){jQuery(this).prop("checked",i.indexOf(jQuery(this).next().html())>-1)})}wfu_update_mchecklist_value(e)}else if("rolelist"==t){if(a=a.toLowerCase(),"all"==a)document.getElementById("wfu_attribute_"+e+"_all").checked=!0;else{document.getElementById("wfu_attribute_"+e+"_all").checked=!1;for(var c=a.split(","),u=0;u<c.length;u++)c[u]=c[u].trim();for(var l=document.getElementById("wfu_attribute_"+e),u=0;u<l.options.length;u++)l.options[u].selected=c.indexOf(l.options[u].value)>-1}wfu_update_rolelist_value(e)}else if("dimensions"==t){for(var m,w,g,l,p=a.split(","),v=document.getElementsByName("wfu_dimension_elements_"+e),u=0;u<v.length;u++)v[u].value="";for(var u=0;u<p.length;u++)m=p[u].split(":",2),w=m.length<1?"":m[0],g=m.length<2?w:m[1],l=document.getElementById("wfu_attribute_"+e+"_"+w.trim()),l&&(l.value=g.trim());l=v[0],wfu_update_dimension_value({target:l})}else if("userfields"==t){for(var b,h=a.split("/"),y=Array(),u=0;u<h.length;u++)b="*"==h[u].substr(0,1),b&&(h[u]=h[u].substr(1)),""!=h[u]&&y.push({name:h[u],required:b});for(var I=document.getElementById("wfu_attribute_"+e),E=null,B=Array(),u=0;u<I.childNodes.length;u++)1===I.childNodes[u].nodeType&&(null==E?E=I.childNodes[u]:B.push(I.childNodes[u]));for(var u=0;u<B.length;u++)I.removeChild(B[u]);wfu_userdata_edit_field(E,"",!1);for(var x,N=E,u=0;u<y.length;u++)0==u?wfu_userdata_edit_field(E,y[u].name,y[u].required):(x=N.cloneNode(!0),wfu_userdata_edit_field(x,y[u].name,y[u].required),I.insertBefore(x,N.nextSibling),N=x);for(var l,u=0;u<E.childNodes.length&&(l=E.childNodes[u],"INPUT"!=l.tagName);u++);wfu_update_userfield_value({target:l})}else if("color-triplet"==t){for(var k=a.split(","),u=0;u<k.length;u++)k[u]=k[u].trim();2==k.length?k=[k[0],k[1],"#000000"]:1==k.length?k=[k[0],"#FFFFFF","#000000"]:k.length<3&&(k=["#000000","#FFFFFF","#000000"]);var n=colourNameToHex(k[0]);n||(n=k[0]),jQuery("#wfu_attribute_"+e+"_color").wpColorPicker("color",n);var l=document.getElementById("wfu_attribute_"+e+"_color");l.value=k[0],n=colourNameToHex(k[1]),n||(n=k[1]),jQuery("#wfu_attribute_"+e+"_bgcolor").wpColorPicker("color",n),document.getElementById("wfu_attribute_"+e+"_bgcolor").value=k[1],n=colourNameToHex(k[2]),n||(n=k[2]),jQuery("#wfu_attribute_"+e+"_borcolor").wpColorPicker("color",n),document.getElementById("wfu_attribute_"+e+"_borcolor").value=k[2],wfu_update_triplecolor_value({target:l})}else if("folderlist"==t){for(var i=wfu_parse_folderlist_js(a),T=document.getElementById("wfu_attribute_"+e).options;T.length>0;)T.remove(0);for(var H,A,j,C,O,D,u=0;u<i.path.length;u++){A=i.path[u],"/"==A.substr(A.length,1)&&(A=A.substr(0,A.length-1)),j=A.split("/"),A=j[j.length-1],O=parseInt(i.level[u]),C="",D="";for(var S=0;O>S;S++)C+="&nbsp;&nbsp;&nbsp;",D+="*";C+=i.label[u],i.default[u]&&(D+="&"),D+=""==A?"{root}/"+i.label[u]:A+i.label[u],H=document.createElement("option"),H.className=i.default[u]?"wfu_select_folders_option_default":"",H.value=wfu_plugin_encode_string(D),H.innerHTML=C,T.add(H)}H=document.createElement("option"),H.value="",H.innerHTML="",T.add(H);var L=document.getElementById("wfu_attribute_"+e);L.data=wfu_decode_subfolder_list(e),wfu_subfolders_update_toolnav(e),l=L,a!==l.oldVal&&(l.oldVal=a,document.getElementById("wfu_attribute_value_"+e).value=a,wfu_generate_shortcode())}}function wfu_parse_folderlist_js(e){var t=Object();t.path=Array(),t.label=Array(),t.level=Array(),t.default=Array();var a=e.split(",");if(0==a.length)return t;if(1==a.length&&""==a[0].trim())return t;for(var l,n,d,u,r,o,_,s=["root"],f=0,i=0,c=-1,m=0;m<a.length;m++){for(l=a[m].trim(),n=0,d="",u=!1;n<l.length&&"*"==l.substr(n,1);)n++,d+="&nbsp;&nbsp;&nbsp;";if(1>=n-f&&(n>0||0==i)&&(l=l.substr(n,l.length-n),"&"==l.substr(0,1)&&(l=l.substr(1),u=!0),subfolder_items=l.split("/"),subfolder_items.length<2&&subfolder_items.push(""),""!=subfolder_items[1]?(r=subfolder_items[0],o=subfolder_items[1]):(r=l,o=l),""!=r)){u&&-1==c?c=t.path.length:u=!1,0==n&&(i=1),s.length>n?s[n]=r:s.push(r),_="";for(var w=1;n>=w;w++)_+=s[w]+"/";t.path.push(_),t.label.push(o),t.level.push(n),t.default.push(u),f=n}}return t}function colourNameToHex(e){var t={aliceblue:"#f0f8ff",antiquewhite:"#faebd7",aqua:"#00ffff",aquamarine:"#7fffd4",azure:"#f0ffff",beige:"#f5f5dc",bisque:"#ffe4c4",black:"#000000",blanchedalmond:"#ffebcd",blue:"#0000ff",blueviolet:"#8a2be2",brown:"#a52a2a",burlywood:"#deb887",cadetblue:"#5f9ea0",chartreuse:"#7fff00",chocolate:"#d2691e",coral:"#ff7f50",cornflowerblue:"#6495ed",cornsilk:"#fff8dc",crimson:"#dc143c",cyan:"#00ffff",darkblue:"#00008b",darkcyan:"#008b8b",darkgoldenrod:"#b8860b",darkgray:"#a9a9a9",darkgreen:"#006400",darkkhaki:"#bdb76b",darkmagenta:"#8b008b",darkolivegreen:"#556b2f",darkorange:"#ff8c00",darkorchid:"#9932cc",darkred:"#8b0000",darksalmon:"#e9967a",darkseagreen:"#8fbc8f",darkslateblue:"#483d8b",darkslategray:"#2f4f4f",darkturquoise:"#00ced1",darkviolet:"#9400d3",deeppink:"#ff1493",deepskyblue:"#00bfff",dimgray:"#696969",dodgerblue:"#1e90ff",firebrick:"#b22222",floralwhite:"#fffaf0",forestgreen:"#228b22",fuchsia:"#ff00ff",gainsboro:"#dcdcdc",ghostwhite:"#f8f8ff",gold:"#ffd700",goldenrod:"#daa520",gray:"#808080",green:"#008000",greenyellow:"#adff2f",honeydew:"#f0fff0",hotpink:"#ff69b4","indianred ":"#cd5c5c","indigo ":"#4b0082",ivory:"#fffff0",khaki:"#f0e68c",lavender:"#e6e6fa",lavenderblush:"#fff0f5",lawngreen:"#7cfc00",lemonchiffon:"#fffacd",lightblue:"#add8e6",lightcoral:"#f08080",lightcyan:"#e0ffff",lightgoldenrodyellow:"#fafad2",lightgrey:"#d3d3d3",lightgreen:"#90ee90",lightpink:"#ffb6c1",lightsalmon:"#ffa07a",lightseagreen:"#20b2aa",lightskyblue:"#87cefa",lightslategray:"#778899",lightsteelblue:"#b0c4de",lightyellow:"#ffffe0",lime:"#00ff00",limegreen:"#32cd32",linen:"#faf0e6",magenta:"#ff00ff",maroon:"#800000",mediumaquamarine:"#66cdaa",mediumblue:"#0000cd",mediumorchid:"#ba55d3",mediumpurple:"#9370d8",mediumseagreen:"#3cb371",mediumslateblue:"#7b68ee",mediumspringgreen:"#00fa9a",mediumturquoise:"#48d1cc",mediumvioletred:"#c71585",midnightblue:"#191970",mintcream:"#f5fffa",mistyrose:"#ffe4e1",moccasin:"#ffe4b5",navajowhite:"#ffdead",navy:"#000080",oldlace:"#fdf5e6",olive:"#808000",olivedrab:"#6b8e23",orange:"#ffa500",orangered:"#ff4500",orchid:"#da70d6",palegoldenrod:"#eee8aa",palegreen:"#98fb98",paleturquoise:"#afeeee",palevioletred:"#d87093",papayawhip:"#ffefd5",peachpuff:"#ffdab9",peru:"#cd853f",pink:"#ffc0cb",plum:"#dda0dd",powderblue:"#b0e0e6",purple:"#800080",red:"#ff0000",rosybrown:"#bc8f8f",royalblue:"#4169e1",saddlebrown:"#8b4513",salmon:"#fa8072",sandybrown:"#f4a460",seagreen:"#2e8b57",seashell:"#fff5ee",sienna:"#a0522d",silver:"#c0c0c0",skyblue:"#87ceeb",slateblue:"#6a5acd",slategray:"#708090",snow:"#fffafa",springgreen:"#00ff7f",steelblue:"#4682b4",tan:"#d2b48c",teal:"#008080",thistle:"#d8bfd8",tomato:"#ff6347",turquoise:"#40e0d0",violet:"#ee82ee",wheat:"#f5deb3",white:"#ffffff",whitesmoke:"#f5f5f5",yellow:"#ffff00",yellowgreen:"#9acd32"};return"undefined"!=typeof t[e.toLowerCase()]?t[e.toLowerCase()]:!1}function wfu_download_file(e,t,a){var l=wfu_GetHttpRequestObject();if(null!=l){var n=AdminParams.wfu_ajax_url;params=new Array(3),params[0]=new Array(2),params[0][0]="action",params[0][1]="wfu_ajax_action_download_file_invoker",params[1]=new Array(2),params[1][0]="file",params[1][1]=e,params[2]=new Array(2),params[2][0]="nonce",params[2][1]=a;for(var d="",u=0;u<params.length;u++)d+=(u>0?"&":"")+params[u][0]+"="+encodeURI(params[u][1]);l.open("POST",n,!0),l.setRequestHeader("Content-type","application/x-www-form-urlencoded"),l.onreadystatechange=function(){if(4==l.readyState&&200==l.status){var a="wfu_ajax_action_download_file_invoker:",n=l.responseText.indexOf(a);-1==n&&(n=l.responseText.length);var d=(l.responseText.substr(0,n),l.responseText.substr(n+a.length,l.responseText.length-n-a.length));n=d.indexOf(":");var u=d.substr(0,n);if(txt_value=d.substr(n+1,d.length-n-1),"wfu_download_id;"==u.substr(0,16)){var r=u.substr(16),o=document.getElementById("wfu_file_download_container_"+t);o.innerHTML=txt_value,setTimeout("wfu_download_file_monitor('"+e+"', "+t+", '"+r+"')",100)}}},l.send(d)}}function wfu_download_file_monitor(e,t,a){var l=wfu_GetHttpRequestObject();if(null!=l){var n=AdminParams.wfu_ajax_url;params=new Array(3),params[0]=new Array(2),params[0][0]="action",params[0][1]="wfu_ajax_action_download_file_monitor",params[1]=new Array(2),params[1][0]="file",params[1][1]=e,params[2]=new Array(2),params[2][0]="id",params[2][1]=a;for(var d="",u=0;u<params.length;u++)d+=(u>0?"&":"")+params[u][0]+"="+encodeURI(params[u][1]);l.open("POST",n,!0),l.setRequestHeader("Content-type","application/x-www-form-urlencoded"),l.onreadystatechange=function(){if(4==l.readyState&&200==l.status){var a="wfu_ajax_action_download_file_monitor:",n=l.responseText.indexOf(a);-1==n&&(n=l.responseText.length);var d=(l.responseText.substr(0,n),l.responseText.substr(n+a.length,l.responseText.length-n-a.length));n=d.indexOf(":");var u=d.substr(0,n);if(txt_value=d.substr(n+1,d.length-n-1),"repeat"!=u){var r=document.getElementById("wfu_file_download_container_"+t);r.innerHTML=""}else"repeat"==u&&setTimeout("wfu_download_file_monitor('"+e+"', "+t+", '"+txt_value+"')",100)}},l.send(d)}}function wfu_filedetails_userdata_changed(){for(var e,t,a=document.getElementsByName("wfu_filedetails_userdata"),l=!1,n=0;n<a.length;n++)if(e=document.getElementById(a[n].id.replace("wfu_filedetails_userdata_value_","wfu_filedetails_userdata_default_")),t=document.getElementById(a[n].id.replace("wfu_filedetails_userdata_value_","wfu_filedetails_userdata_")),t.value=a[n].value,a[n].value!=e.value){l=!0;break}document.getElementById("dp_filedetails_submit_fields").disabled=!l}function wfu_Attach_FileDetails_Admin_Events(){for(var e=document.getElementsByName("wfu_filedetails_userdata"),t=0;t<e.length;t++)wfu_attach_element_handlers(e[t],wfu_filedetails_userdata_changed)}var DraggedItem=null,ShortcodeNextSave=0,ShortcodeTimeOut=null,ShortcodeString="",Autosave=!1,PageObsolete=!1,PageUpdating=!1,CheckObsolescenceTimeOut=5e3;jQuery(document).ready(function(e){e(".wfu_color_field").wpColorPicker({change:function(e,t){e.target.value=t.color.toString(),"wfu_text_elements"==e.target.name?wfu_update_text_value(e):"wfu_triplecolor_elements"==e.target.name&&wfu_update_triplecolor_value(e)}})});
js/wordpress_file_upload_functions.js CHANGED
@@ -1,2 +1,2 @@
1
- function wfu_Initialize_Consts(e){if("undefined"==typeof GlobalData.consts){GlobalData.consts=new Object;for(var a=e.split(";"),t=0;t<a.length;t++)const_txt=a[t].split(":"),GlobalData.consts[wfu_plugin_decode_string(const_txt[0])]=wfu_plugin_decode_string(const_txt[1])}}function wfu_install_unload_hook(){window.onbeforeunload=wfu_unload_hook}function wfu_unload_hook(){return""!=GlobalData.UploadInProgressString.trim()?GlobalData.consts.wfu_pageexit_prompt:void 0}function wfu_Check_Browser_Capabilities(){if("undefined"==typeof wfu_BrowserCaps){wfu_BrowserCaps=new Object;var e=wfu_GetHttpRequestObject();wfu_BrowserCaps.supportsAJAX=null!=e,wfu_BrowserCaps.supportsUploadProgress=!!(e&&"upload"in e&&"onprogress"in e.upload);var a=null;try{var a=new FormData}catch(t){}wfu_BrowserCaps.supportsHTML5=null!=a;var t=document.createElement("iframe");wfu_BrowserCaps.supportsIFRAME=null!=t,wfu_BrowserCaps.supportsDRAGDROP=window.FileReader?!0:!1,wfu_BrowserCaps.supportsAnimation=wfu_check_animation(),wfu_BrowserCaps.isSafari=Object.prototype.toString.call(window.HTMLElement).indexOf("Constructor")>0}}function wfu_check_animation(){var e=!1,a="animation",t="",s="Webkit Moz O ms Khtml".split(" "),n="",r=document.createElement("DIV");if(r.style.animationName&&(e=!0),e===!1)for(var l=0;l<s.length;l++)if(void 0!==r.style[s[l]+"AnimationName"]){n=s[l],a=n+"Animation",t="-"+n.toLowerCase()+"-",e=!0;break}return e}function wfu_join_strings(e){for(var a=[].slice.call(arguments),t="",s="",n=1;n<a.length;n++)s=""==t||""==a[n]?"":e,t+=s+a[n];return t}function wfu_plugin_decode_string(e){for(var a,t,s=0,n="";s<e.length;)a=parseInt(e.substr(s,2),16),t=128>a?a:224>a?((31&a)<<6)+(63&parseInt(e.substr(s+=2,2),16)):((15&a)<<12)+((63&parseInt(e.substr(s+=2,2),16))<<6)+(63&parseInt(e.substr(s+=2,2),16)),n+=String.fromCharCode(t),s+=2;return n}function wfu_plugin_encode_string(e){var a=0,t="",s="";for(a=0;a<e.length;a++)num=e.charCodeAt(a),num>=2048?num=((16773120&num|917504)<<4)+((4032&num|8192)<<2)+(63&num|128):num>=128&&(num=((65472&num|12288)<<2)+(63&num|128)),s=num.toString(16),(1==s.length||3==s.length||5==s.length)&&(s="0"+s),t+=s;return t}function wfu_randomString(e){for(var a="0123456789ABCDEFGHIJKLMNOPQRSTUVWXTZabcdefghiklmnopqrstuvwxyz",t=e,s="",n=0;t>n;n++){var r=Math.floor(Math.random()*a.length);s+=a.substring(r,r+1)}return s}function wfu_addEventHandler(e,a,t){e.addEventListener?e.addEventListener(a,t,!1):e.attachEvent?e.attachEvent("on"+a,t):e["on"+a]=t}function wfu_GetHttpRequestObject(){var e=null;try{e=new XMLHttpRequest}catch(a){try{e=new ActiveXObject("Msxml2.XMLHTTP")}catch(t){try{e=new ActiveXObject("Microsoft.XMLHTTP")}catch(a){}}}if(null==e&&window.createRequest)try{xmlhttp=window.createRequest()}catch(a){}return e}function wfu_filedetails_showhide(e,a,t){var s=(document.getElementById("wfu_messageblock_arrow_"+e+"_"+a),document.getElementById("wfu_messageblock_arrow_"+e+"_up_"+a)),n=document.getElementById("wfu_messageblock_arrow_"+e+"_down_"+a),r=document.getElementById("wfu_messageblock_subheader_"+e+"_"+a),l=document.getElementById("wfu_messageblock_header_"+e+"_state_"+a);t?(s.style.display="",n.style.display="none",r.style.display="",l.value=""):(s.style.display="none",n.style.display="",r.style.display="none",l.value="none")}function wfu_get_file_ids(e){for(var a=(document.getElementById("wfu_messageblock_"+e),document.getElementById("wfu_messageblock_subheader_"+e).nextSibling),t="wfu_messageblock_"+e+"_",s=[];null!=a;)1===a.nodeType&&a.id.substr(0,t.length)==t&&s.push(a.id.substr(a.id.lastIndexOf("_")+1)),a=a.nextSibling;return s}function wfu_filedetails_toggle(e,a){var t=(document.getElementById("wfu_messageblock_arrow_"+e+"_"+a),document.getElementById("wfu_messageblock_arrow_"+e+"_up_"+a));wfu_filedetails_showhide(e,a,"none"==t.style.display)}function wfu_headerdetails_showhide(e,a){var t=(document.getElementById("wfu_messageblock_arrow_"+e),document.getElementById("wfu_messageblock_arrow_"+e+"_up")),s=document.getElementById("wfu_messageblock_arrow_"+e+"_down"),n=document.getElementById("wfu_messageblock_subheader_"+e),r=document.getElementById("wfu_messageblock_subheader_"+e+"_message"),l=document.getElementById("wfu_messageblock_subheader_"+e+"_adminmessage"),o=document.getElementById("wfu_messageblock_header_"+e+"_state"),i=wfu_get_file_ids(e);if(a){t.style.display="",s.style.display="none",("none"!=r.style.display||"none"!=l.style.display)&&(n.style.display=""),o.value="";for(var _=0;_<i.length;_++)document.getElementById("wfu_messageblock_"+e+"_"+i[_]).style.display="",document.getElementById("wfu_messageblock_subheader_"+e+"_"+i[_]).style.display=document.getElementById("wfu_messageblock_header_"+e+"_state_"+i[_]).value}else{t.style.display="none",s.style.display="",n.style.display="none",o.value="none";for(var _=0;_<i.length;_++)document.getElementById("wfu_messageblock_"+e+"_"+i[_]).style.display="none",document.getElementById("wfu_messageblock_subheader_"+e+"_"+i[_]).style.display="none"}}function wfu_headerdetails_toggle(e){var a=(document.getElementById("wfu_messageblock_arrow_"+e),document.getElementById("wfu_messageblock_arrow_"+e+"_up"));wfu_headerdetails_showhide(e,"none"==a.style.display)}function wfu_selectbutton_changed(e,a){wfu_BrowserCaps.supportsAJAX&&wfu_BrowserCaps.supportsHTML5||(a=0);var t=document.getElementById("upfile_"+e),s=t.files;s||(s=t.value?[{name:t.value}]:[]);var n=document.getElementById("fileName_"+e);if(n&&(n.value=t.value.replace(/c:\\fakepath\\/i,"")),1==a){"undefined"==typeof t.filearray&&(t.filearray=Array());for(var r=0;r<s.length;r++)t.filearray.push(s[r])}}function wfu_selectbutton_clicked(e){var a=document.getElementById("wordpress_file_upload_message_"+e);a&&(a.style.display="none"),wfu_reset_message(e),document.getElementById("upfile_"+e).value="";var t=document.getElementById("fileName_"+e);t&&(t.value="",t.className="file_input_textbox")}function wfu_selectsubdir_check(e){var a=document.getElementById("selectsubdir_"+e);return a?(document.getElementById("hiddeninput_"+e).value=a.selectedIndex,0==a.selectedIndex?(a.style.backgroundColor="red",!1):(a.style.backgroundColor="transparent",a.options[0].style.display="none",!0)):!0}function wfu_Redirect(e){window.location=e}function wfu_loadStart(){}function wfu_uploadProgress(e,a,t,s){s&&"undefined"==typeof this.xhr&&(console.log("total="+e.total+", loaded="+e.loaded),console.log(e));var n=GlobalData[a].xhrs[t],r=0,l=0,o=document.getElementById("progressbar_"+a+"_animation");if(e.lengthComputable){if(n.sizeloaded=e.loaded,n.size<e.total&&e.total>0){l=e.total-n.size,n.deltasize+=l,n.size+=l;for(var i=0;i<GlobalData[a].xhrs.length;i++)GlobalData[a].xhrs[i].file_id==n.file_id&&(GlobalData[a].xhrs[i].totalsize+=l)}if(o){for(var _=0,d=0,u=[],i=0;i<GlobalData[a].xhrs.length;i++)u[GlobalData[a].xhrs[i].file_id]=0;for(var i=0;i<GlobalData[a].xhrs.length;i++)u[GlobalData[a].xhrs[i].file_id]=Math.max(GlobalData[a].xhrs[i].totalsize,u[GlobalData[a].xhrs[i].file_id]);for(var i=0;i<u.length;i++)"undefined"!=typeof u[i]&&(_+=u[i]);for(var i=0;i<GlobalData[a].xhrs.length;i++)d+=GlobalData[a].xhrs[i].sizeloaded;r=Math.round(100*d/_),o.style.width=r.toString()+"%"}}else o&&(o.style.width="0%")}function wfu_notify_WPFilebase(e,a){var t=wfu_GetHttpRequestObject();if(null==t){var s=document.createElement("iframe");return s.style.display="none",s.src=GlobalData.consts.ajax_url+"?action=wfu_ajax_action_notify_wpfilebase&params_index="+e+"&session_token="+a,void document.body.appendChild(s)}var n=GlobalData.consts.ajax_url;params=new Array(3),params[0]=new Array(2),params[0][0]="action",params[0][1]="wfu_ajax_action_notify_wpfilebase",params[1]=new Array(2),params[1][0]="params_index",params[1][1]=e,params[2]=new Array(2),params[2][0]="session_token",params[2][1]=a;for(var r="",s=0;s<params.length;s++)r+=(s>0?"&":"")+params[s][0]+"="+encodeURI(params[s][1]);t.open("POST",n,!0),t.setRequestHeader("Content-type","application/x-www-form-urlencoded"),t.onreadystatechange=function(){},t.send(r)}function wfu_send_email_notification(e,a,t,s,n,r,l,o,i){var _=wfu_GetHttpRequestObject();if(null!=_){var d=GlobalData.consts.ajax_url,u=wfu_get_userdata_count(e);params=new Array(7+u),params[0]=new Array(2),params[0][0]="action",params[0][1]="wfu_ajax_action_send_email_notification",params[1]=new Array(2),params[1][0]="params_index",params[1][1]=t,params[2]=new Array(2),params[2][0]="session_token",params[2][1]=s,params[3]=new Array(2),params[3][0]="only_filename_list",params[3][1]=n,params[4]=new Array(2),params[4][0]="target_path_list",params[4][1]=r,params[5]=new Array(2),params[5][0]="attachment_list",params[5][1]=l,params[6]=new Array(2),params[6][0]="unique_id",params[6][1]=a;for(var m=0;u>m;m++)params[7+m]=new Array(2),params[7+m][0]="userdata_"+m,params[7+m][1]=wfu_plugin_encode_string(document.getElementById("hiddeninput_"+e+"_userdata_"+m).value);for(var c="",m=0;m<params.length;m++)c+=(m>0?"&":"")+params[m][0]+"="+encodeURI(params[m][1]);var g=new Date;_.xhrid=-1,_.shortcode_id=e,_.requesttype="email",_.file_id=0,_.loading=!1,_.aborted=!1,_.unique_id=a,_.debugmode=o,_.is_admin=i,_.params_index=t,_.session_token=s,_.start_time=g.getTime(),_.end_time=_.start_time,_.finish_time=_.start_time+1e3*parseInt(GlobalData.consts.max_time_limit),_.fail_colors=GlobalData.consts.fail_colors,_.error_message_header="",_.error_message_failed=GlobalData.consts.message_failed,_.error_message_cancelled=GlobalData.consts.message_cancelled,_.error_adminmessage_unknown="",_.open("POST",d,!0),_.setRequestHeader("Content-type","application/x-www-form-urlencoded"),_.addEventListener("load",wfu_uploadComplete,!1),_.addEventListener("error",wfu_uploadFailed,!1),_.addEventListener("abort",wfu_uploadCanceled,!1),_.send(c)}}function wfu_format_debug_data(e,a){return output='<label class="file_messageblock_subheader_debugmessage_label">',output+="Debug Data"+a,output+="</label>",output+='<div class="file_messageblock_subheader_debugmessage_container">',output+=e,output+="</div>"}function wfu_uploadComplete(e){var a=new Date,t=this.shortcode_id,s=(this.file_id,!1),n="",r="",l="unknown",o="",i="wfu_fileupload_success:";this.loading=!1,this.end_time=a.getTime();var _=e.target.responseText,d=_,u="error";if(-1!=_&&_.indexOf("force_errorabort_code")>-1&&(u="errorabort",_=_.replace("force_errorabort_code","")),-1!=_){var m=_.indexOf(i);if(m>-1&&("true"==this.debugmode&&(o=_.substr(0,m)),d=_.substr(m+i.length),m=d.indexOf(":"),r=d.substr(0,m),n=d.substr(m+1)),""!=o){var c="";"fileupload"==this.requesttype?c=" - File: "+this.file_id:"email"==this.requesttype&&(c=" - Email Notification"),o=wfu_format_debug_data(o,c)}if(""!=r){var g=r.split(";");if(1==parseInt(g[2])){var f=g[3].split(",");l=wfu_plugin_decode_string(f[0])}}}if(""==n||""==r){var p=this.fail_colors.split(","),y=wfu_Initialize_Params();y.general.shortcode_id=t,y.general.unique_id=this.unique_id,y.general.state=7,y.general.files_count="fileupload"==this.requesttype?1:0,y.general.upload_finish_time=this.finish_time,y.general.fail_message=GlobalData.consts.message_unknown,y.general.fail_admin_message=wfu_join_strings("<br />",this.error_adminmessage_unknown,this.requesttype+":"+d),y.general.files_count>0?(y[0]={},y[0].color=p[0],y[0].bgcolor=p[1],y[0].borcolor=p[2],y[0].message_type=u,l=u,y[0].header=this.error_message_header,y[0].message=GlobalData.consts.message_timelimit,y[0].admin_messages="true"==this.is_admin?GlobalData.consts.message_admin_timelimit:""):y.general.admin_messages.other="true"==this.is_admin?GlobalData.consts.message_admin_timelimit:"",y.general.upload_finish_time>0&&a.getTime()<y.general.upload_finish_time&&(y.general.files_count>0?(y[0].message=y.general.fail_message,y[0].admin_messages="true"==this.is_admin?y.general.fail_admin_message:""):y.general.admin_messages.other="true"==this.is_admin?y.general.fail_admin_message:"")}return s=""==n||""==r?wfu_ProcessUploadComplete(t,this.file_id,y,this.unique_id,this.params_index,this.session_token,"",[this.debugmode,o,this.is_admin],this.requesttype):wfu_ProcessUploadComplete(t,this.file_id,n,this.unique_id,this.params_index,this.session_token,r,[this.debugmode,o,this.is_admin],this.requesttype),s&&(wfu_unlock_upload(e.target.shortcode_id),wfu_hide_simple_progressbar(t),wfu_clear(e.target.shortcode_id)),e.target.return_status?l:void 0}function wfu_ProcessUploadComplete(e,a,t,s,n,r,l,o,i){if(e&&!(0>e)&&null!=t&&""!=t&&""!=s&&("no-ajax"==s||GlobalData[e])){var _=!1;if("string"==typeof t){t=wfu_plugin_decode_string(t.replace(/^\s+|\s+$/g,""));var d=null;try{d=JSON.parse(t)}catch(u){}if(null==d){var m=l.split(";");d=wfu_Initialize_Params(),d.general.shortcode_id=e,d.general.unique_id=s,d.general.state=m[0],4==d.general.state&&d.general.state++;var c=m[1].split(","),g="",f=GlobalData.consts.jsonparse_filemessage,p=GlobalData.consts.jsonparse_message,y=GlobalData.consts.jsonparse_adminmessage;d.general.files_count=parseInt(m[2]);for(var w=0;w<d.general.files_count;w++)d[w]={},d[w].color=c[0],d[w].bgcolor=c[1],d[w].borcolor=c[2],g=m[w+3].split(","),d[w].message_type=wfu_plugin_decode_string(g[0]),d[w].header=wfu_plugin_decode_string(g[1]),"success"==d[w].message_type&&(d[w].header+=f,d[w].message_type="warning"),d[w].message=wfu_join_strings("<br />",p,wfu_plugin_decode_string(g[2])),d[w].admin_messages=wfu_join_strings("<br />",y,wfu_plugin_decode_string(g[3]))}}else{if("object"!=typeof t)return;var d=t}for(w=0;d[w];)d[w].message_type&&"error"==d[w].message_type.substr(0,5)&&(d[w].message_type=d[w].message_type.substr(0,5)),w++;var b=document.getElementById("wfu_messageblock_"+e),h=!0;if(!UploadStates[e]&&b){var v=document.getElementById("wfu_messageblock_header_"+e+"_states").value;v=wfu_plugin_decode_string(v.replace(/^\s+|\s+$/g,"")),UploadStates[e]=null;try{UploadStates[e]=JSON.parse(v)}catch(u){}null==UploadStates[e]&&(h=!1)}GlobalData[e]||(GlobalData[e]=Object());var I=GlobalData[e];if("no-ajax"==s)I.last=!1,I.unique_id="",I.files_count=d.general.files_count,0==d.general.state&&(d.general.files_count=0),I.files_processed=d.general.files_count,I.upload_state=h?d.general.state:10,I.message=d.general.message,I.update_wpfilebase=d.general.update_wpfilebase,I.redirect_link=d.general.redirect_link,I.notify_only_filename_list="",I.notify_target_path_list="",I.notify_attachment_list="",I.admin_messages={},I.admin_messages.wpfilebase=d.general.admin_messages.wpfilebase,I.admin_messages.notify=d.general.admin_messages.notify,I.admin_messages.redirect=d.general.admin_messages.redirect,I.admin_messages.debug=o[1],I.admin_messages.other=d.general.admin_messages.other,I.errors={},I.errors.wpfilebase=d.general.errors.wpfilebase,I.errors.notify=d.general.errors.notify,I.errors.redirect=d.general.errors.redirect,I.current_size=0,I.total_size=0;else{if(""==I.unique_id||I.unique_id!=s||I.unique_id!=d.general.unique_id)return;if(I.last)return;0==d.general.files_count&&d[0]&&"error"==d[0].message_type&&(d.general.files_count=1);for(var E="",w=0;w<d.general.files_count;w++)E="error"==d[w].message_type&&0==I.files_processed?"error1":"error"==d[w].message_type&&I.files_processed>0?"error2":d[w].message_type,I.upload_state=GlobalData.filestatematch[E][I.upload_state];h||(I.upload_state=10),I.files_processed+=d.general.files_count,I.message=wfu_join_strings("<br />",I.message,d.general.message),""==I.update_wpfilebase&&(I.update_wpfilebase=d.general.update_wpfilebase),(!i||i&&"email"!=i)&&(I.redirect_link=d.general.redirect_link),I.notify_only_filename_list=wfu_join_strings(", ",I.notify_only_filename_list,d.general.notify_only_filename_list),I.notify_target_path_list=wfu_join_strings(", ",I.notify_target_path_list,d.general.notify_target_path_list),I.notify_attachment_list=wfu_join_strings(",",I.notify_attachment_list,d.general.notify_attachment_list),I.admin_messages.debug=wfu_join_strings("<br />",I.admin_messages.debug,o[1]),I.admin_messages.other=wfu_join_strings("<br />",I.admin_messages.other,d.general.admin_messages.other),""==I.admin_messages.wpfilebase&&(I.admin_messages.wpfilebase=d.general.admin_messages.wpfilebase),""==I.admin_messages.notify&&(I.admin_messages.notify=d.general.admin_messages.notify),""==I.admin_messages.redirect&&(I.admin_messages.redirect=d.general.admin_messages.redirect),""==I.errors.wpfilebase&&(I.errors.wpfilebase=d.general.errors.wpfilebase),""==I.errors.notify&&(I.errors.notify=d.general.errors.notify),""==I.errors.redirect&&(I.errors.redirect=d.general.errors.redirect)}I.files_processed==I.files_count&&(I.last=!0,""!=I.update_wpfilebase&&(I.admin_messages.wpfilebase="",wfu_notify_WPFilebase(n,r)),""!=I.notify_only_filename_list&&(I.admin_messages.notify="",wfu_send_email_notification(e,s,n,r,I.notify_only_filename_list,I.notify_target_path_list,I.notify_attachment_list,o[0],o[2]),I.last=!1,I.notify_only_filename_list=""),I.last&&(wfu_notify_server_upload_ended(s,n,r),GlobalData.UploadInProgressString=GlobalData.UploadInProgressString.replace(new RegExp("\\["+s+"\\]","g"),"")),""!=I.errors.redirect&&(I.redirect_link=""),""!=I.redirect_link&&I.last&&""==GlobalData.UploadInProgressString.trim()&&(I.upload_state=11,_=!0));var B=I.message,k=wfu_join_strings("<br />",I.admin_messages.other,I.admin_messages.wpfilebase,I.admin_messages.notify,I.admin_messages.redirect,I.admin_messages.debug);if(!h){var x=GlobalData.consts.jsonparse_headermessage,D=GlobalData.consts.jsonparse_headeradminmessage;B=wfu_join_strings("<br />",x,B),k=wfu_join_strings("<br />",D,k)}if(I.last){0==I.files_count?I.upload_state=8:I.upload_state<4&&(I.upload_state+=4);{""!=I.admin_messages.wpfilebase||""!=I.admin_messages.notify||""!=I.admin_messages.redirect||""!=I.admin_messages.other}4==I.upload_state&&""!=k?I.upload_state++:5==I.upload_state&&""==!k&&""==B&&I.upload_state--}if(b){var G=document.getElementById("wfu_messageblock_header_"+e+"_state"),T=1==I.files_count&&""==B&&""==k&&I.last&&!_;if(T)document.getElementById("wfu_messageblock_header_"+e).style.display="none";else{document.getElementById("wfu_messageblock_header_"+e).style.display="";var j=document.getElementById("wfu_messageblock_header_"+e+"_container");if(h){var q="";1!=I.files_count||5!=I.upload_state&&7!=I.upload_state||(q="_singlefile"),j.innerHTML=UploadStates[e]["State"+I.upload_state+q]}else{j.innerHTML="";var C=document.getElementById("wfu_messageblock_header_"+e+"_safecontainer");j.innerHTML=C.innerHTML.replace(/_safe/g,"")}var S=!1;""!=B?(document.getElementById("wfu_messageblock_subheader_"+e+"_message").style.display="",document.getElementById("wfu_messageblock_subheader_"+e+"_messagelabel").innerHTML=B,S=!0):document.getElementById("wfu_messageblock_subheader_"+e+"_message").style.display="none",""!=k?(document.getElementById("wfu_messageblock_subheader_"+e+"_adminmessage").style.display="",document.getElementById("wfu_messageblock_subheader_"+e+"_adminmessagelabel").innerHTML=k,S=!0):document.getElementById("wfu_messageblock_subheader_"+e+"_adminmessage").style.display="none",document.getElementById("wfu_messageblock_subheader_"+e).style.display=S?G.value:"none",S||I.files_processed>0?(j.colSpan=2,document.getElementById("wfu_messageblock_arrow_"+e).style.display=""):(document.getElementById("wfu_messageblock_arrow_"+e).style.display="none",j.colSpan=3)}for(var A=document.getElementById("wfu_messageblock_subheader_"+e),O=0,H=null,L=document.getElementById("wfu_messageblock_"+e+"_filetemplate"),P="",M=document.getElementById("wfu_messageblock_"+e+"_door"),U=0,R=1,z=2,N=wfu_plugin_decode_string(L.value.replace(/^\s+|\s+$/g,"")),w=0;w<d.general.files_count;w++){for(U=w+a,P=N.replace(/\[file_id\]/g,U),P=P.replace(/\[filenumber_display\]/g,""),P=P.replace(/\[fileheader_color\]/g,d[w].color),P=P.replace(/\[fileheader_bgcolor\]/g,d[w].bgcolor),P=P.replace(/\[fileheader_borcolor\]/g,d[w].borcolor),P=P.replace(/\[fileheader_message\]/g,d[w].header),P=P.replace(/\[filesubheadermessage_display\]/g,'style="display:none;"'),P=P.replace(/\[filesubheader_message\]/g,d[w].message),P=P.replace(/\[filesubheaderadminmessage_display\]/g,'style="display:none;"'),P=P.replace(/\[filesubheader_adminmessage\]/g,d[w].admin_messages),P="<table><tbody>"+P+"</tbody></table>",M.innerHTML=P,R=1,z=2,S=!1,H=document.getElementById("wfu_messageblock_"+e+"_"+U),1==I.files_count?(document.getElementById("wfu_messageblock_"+e+"_filenumber_"+U).style.display="none",document.getElementById("wfu_messageblock_subheader_"+e+"_fileempty_"+U).style.display="none",H.style.display=T?"":G.value,R++,z++):H.style.display=G.value,""!=d[w].message&&(document.getElementById("wfu_messageblock_subheader_"+e+"_message_"+U).style.display="",S=!0),""!=d[w].admin_messages&&(document.getElementById("wfu_messageblock_subheader_"+e+"_adminmessage_"+U).style.display="",S=!0),S||(document.getElementById("wfu_messageblock_arrow_"+e+"_"+U).style.display="none",R++),document.getElementById("wfu_messageblock_header_"+e+"_container_"+U).colSpan=R,document.getElementById("wfu_messageblock_subheader_"+e+"_container_"+U).colSpan=z;U>O&&(A=A.nextSibling,null!=A);)1===A.nodeType&&(O=A.id.substr(A.id.lastIndexOf("_")+1));b.tBodies[0].insertBefore(H,A),A=H.nextSibling,H=document.getElementById("wfu_messageblock_subheader_"+e+"_"+U),b.tBodies[0].insertBefore(H,A),A=H,O=U}T&&(document.getElementById("wfu_messageblock_"+e+"_1").style.display=""),b.style.display="",document.getElementById("wordpress_file_upload_message_"+e).style.display=""}return _&&wfu_Redirect(I.redirect_link),I.last}}function wfu_uploadFailed(e,a){a&&(console.log("failure report following"),console.log(e));var t=e.target,s={target:{responseText:"",shortcode_id:t.shortcode_id}};wfu_uploadComplete.call(t,s)}function wfu_uploadCanceled(){}function wfu_notify_server_upload_ended(e,a,t){var s=wfu_GetHttpRequestObject();if(null!=s){var n=GlobalData.consts.ajax_url;params=new Array(5),params[0]=new Array(2),params[0][0]="action",params[0][1]="wfu_ajax_action",params[1]=new Array(2),params[1][0]="unique_id",params[1][1]=e,params[2]=new Array(2),params[2][0]="params_index",params[2][1]=a,params[3]=new Array(2),params[3][0]="session_token",params[3][1]=t,params[4]=new Array(2),params[4][0]="upload_finished",params[4][1]=1;for(var r="",l=0;l<params.length;l++)r+=(l>0?"&":"")+params[l][0]+"="+encodeURI(params[l][1]);s.open("POST",n,!0),s.setRequestHeader("Content-type","application/x-www-form-urlencoded"),s.onreadystatechange=function(){4==s.readyState&&200==s.status},s.send(r)}}function wfu_Initialize_Params(){var e={};return e.version="full",e.general={},e.general.shortcode_id=0,e.general.unique_id="",e.general.state=0,e.general.files_count=0,e.general.update_wpfilebase="",e.general.redirect_link="",e.general.upload_finish_time=0,e.general.message="",e.general.message_type="",e.general.admin_messages={},e.general.admin_messages.wpfilebase="",e.general.admin_messages.notify="",e.general.admin_messages.redirect="",e.general.admin_messages.other="",e.general.errors={},e.general.errors.wpfilebase="",e.general.errors.notify="",e.general.errors.redirect="",e.general.color="",e.general.bgcolor="",e.general.borcolor="",e.general.notify_only_filename_list="",e.general.notify_target_path_list="",e.general.notify_attachment_list="",e.general.fail_message="",e.general.fail_admin_message="",e}function wfu_redirect_to_classic(e,a,t,s){0!=wfu_filesselected(e)&&wfu_selectsubdir_check(e)&&wfu_check_required_userdata(e)&&wfu_redirect_to_classic_cont(e,a,t,s,[""])}function wfu_redirect_to_classic_cont(e,a,t,s){var n=function(n){if(n.indexOf("wfu_response_success:")>-1){var r=wfu_Initialize_Params();if(r.general.shortcode_id=e,r.general.unique_id="",r.general.files_count=wfu_filesselected(e),wfu_ProcessUploadComplete(e,0,r,"no-ajax","",a,"",["false","","false"]),1==t){var l="";document.getElementById("upfile_"+e).name="uploadedfile_"+e+"_redirected"+l}document.getElementById("adminerrorcodes_"+e).value=s>0?s:"",document.getElementById("upfile_"+e).disabled=!1,document.getElementById("uniqueuploadid_"+e).value=wfu_randomString(20),GlobalData.UploadInProgressString+="["+document.getElementById("uniqueuploadid_"+e).value+"]",document.getElementById("uploadform_"+e).submit()}},r="",l=new Date,o=GlobalData.consts.response_url+"?shortcode_id="+e+"&start_time="+l.getTime()+"&session_token="+a+r;wfu_lock_upload(e);var i=wfu_GetHttpRequestObject();if(null==i){var _=document.createElement("iframe");return _?(_.style.display="none",_.src=o,document.body.appendChild(_),void(_.onload=function(){n(_.contentDocument.body.innerHTML)})):void 0}i.open("GET",o,!0),i.onreadystatechange=function(){4==i.readyState&&200==i.status&&n(i.responseText)},i.send(null)}function wfu_filesselected(e){var a=document.getElementById("upfile_"+e),t=document.getElementById("fileName_"+e),s=a.files;return s||(s=a.value?[{name:a.value}]:[]),"undefined"!=typeof a.filearray&&(s=a.filearray),0==s.length&&t&&(t.value=GlobalData.consts.nofilemessage,t.className="file_input_textbox_nofile"),s.length}function wfu_check_required_userdata(e){for(var a=wfu_get_userdata_count(e),t=!1,s=0;a>s;s++){var n=document.getElementById("hiddeninput_"+e+"_userdata_"+s),r=document.getElementById("userdata_"+e+"_message_"+s),l="file_userdata_message_required";r.className.substr(0,l.length)==l&&""==n.value&&(r.className=l+"_empty",r.value=GlobalData.consts.userdata_empty,t=!0)}return!t}function wfu_HTML5UploadFile(e,a,t){if(!wfu_BrowserCaps.supportsAJAX)return void wfu_redirect_to_classic(e,t,1,1);if(!wfu_BrowserCaps.supportsHTML5)return void wfu_redirect_to_classic(e,t,1,2);a=wfu_plugin_decode_string(a.replace(/^\s+|\s+$/g,""));var s=null;try{s=JSON.parse(a)}catch(n){}if(null==s)return void wfu_redirect_to_classic(e,t,1,3);var r=wfu_GetHttpRequestObject();if(null!=r){var l=wfu_filesselected(e);if(0!=l&&wfu_selectsubdir_check(e)){var o=l;o+=o,wfu_check_required_userdata(e)&&wfu_HTML5UploadFile_cont(e,s,t,[""])}}}function wfu_HTML5UploadFile_cont(e,a,t){function s(r,d,c,g){m=!0;var f=wfu_GetHttpRequestObject(),p=wfu_GetHttpRequestObject();if(null!=f&&null!=p){var y=null,w=null;try{var y=new FormData,w=new FormData}catch(b){}if(null!=y&&null!=w){c||y.append("uploadedfile_"+e+o,d),y.append("uploadedfile_"+e+"_index",r),y.append("uploadedfile_"+e+"_name",wfu_plugin_encode_string(l[r].name)),y.append("uploadedfile_"+e+"_size",l[r].size),y.append("action","wfu_ajax_action"),y.append("uniqueuploadid_"+e,_),y.append("params_index",a.params_index),y.append("subdir_sel_index",n),c?y.append("only_check","1"):y.append("only_check","0"),y.append("session_token",t),y.append("unique_id",i);for(var h=wfu_get_userdata_count(e),v=0;h>v;v++)y.append("hiddeninput_"+e+"_userdata_"+v,document.getElementById("hiddeninput_"+e+"_userdata_"+v).value);var I=GlobalData[e].xhrs.push(f)-1,E=new Date;if(f.xhrid=I,f.shortcode_id=e,f.requesttype="fileupload",f.file_id=r+1,c?(f.size=0,f.totalsize=0,f.loading=!1):(f.size=d.size,f.totalsize=l[r].size,f.loading=!0),f.deltasize=0,f.sizeloaded=0,f.aborted=!1,f.unique_id=i,f.params_index=a.params_index,f.session_token=t,f.debugmode=a.debugmode,f.is_admin=a.is_admin,f.start_time=E.getTime(),f.end_time=f.start_time,f.finish_time=f.start_time+1e3*parseInt(GlobalData.consts.max_time_limit),f.fail_colors=a.fail_colors,f.error_message_header=a.error_header.replace(/%username%/g,"no data"),f.error_message_header=f.error_message_header.replace(/%useremail%/g,"no data"),f.error_message_header=f.error_message_header.replace(/%filename%/g,l[r].name),f.error_message_header=f.error_message_header.replace(/%filepath%/g,l[r].name),f.error_message_failed=GlobalData.consts.message_failed,f.error_message_cancelled=GlobalData.consts.message_cancelled,f.error_adminmessage_unknown=GlobalData.consts.adminmessage_unknown.replace(/%username%/g,"no data"),f.error_adminmessage_unknown=f.error_adminmessage_unknown.replace(/%useremail%/g,"no data"),f.error_adminmessage_unknown=f.error_adminmessage_unknown.replace(/%filename%/g,l[r].name),f.error_adminmessage_unknown=f.error_adminmessage_unknown.replace(/%filepath%/g,l[r].name),g){w.append("action","wfu_ajax_action"),w.append("params_index",a.params_index),w.append("session_token",t),w.append("force_connection_close","1"),p.open("POST",GlobalData.consts.ajax_url,!1);try{p.send(w)}catch(B){}m="success"==p.responseText}if(m)c?(f.addEventListener("load",function(a){a={target:{responseText:a.target.responseText,shortcode_id:e,return_status:!0}};var t=wfu_uploadComplete.call(f,a);m="success"==t||"warning"==t,m&&s(r,d,!1,!1)},!1),f.addEventListener("error",function(){},!1),f.open("POST",GlobalData.consts.ajax_url,!0),f.send(y)):(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+", "+I+", "+a.debugmode+");"),!1),f.addEventListener("load",wfu_uploadComplete,!1),f.addEventListener("error",new Function("evt","wfu_uploadFailed(evt, "+a.debugmode+");"),!1),f.addEventListener("abort",wfu_uploadCanceled,!1),f.open("POST",GlobalData.consts.ajax_url,!0),f.send(y));else{var k={target:{responseText:"",shortcode_id:e}};wfu_uploadComplete.call(f,k)}return u++,m}}}var n=-1;null!=document.getElementById("selectsubdir_"+e)&&(n=document.getElementById("selectsubdir_"+e).selectedIndex);var r=document.getElementById("upfile_"+e),l=r.files;l||(l=r.value?[{name:r.value}]:[]),"undefined"!=typeof r.filearray&&(l=r.filearray);var o="",i=wfu_randomString(10),_=i;GlobalData.UploadInProgressString+="["+i+"]",GlobalData[e]={},GlobalData[e].unique_id=i,GlobalData[e].last=!1,GlobalData[e].files_count=1,GlobalData[e].files_processed=0,GlobalData[e].upload_state=0,GlobalData[e].message="",GlobalData[e].update_wpfilebase="",GlobalData[e].redirect_link="",GlobalData[e].notify_only_filename_list="",GlobalData[e].notify_target_path_list="",GlobalData[e].notify_attachment_list="",GlobalData[e].admin_messages={},GlobalData[e].admin_messages.wpfilebase="",GlobalData[e].admin_messages.notify="",GlobalData[e].admin_messages.redirect="",GlobalData[e].admin_messages.debug="",GlobalData[e].admin_messages.other="",GlobalData[e].errors={},GlobalData[e].errors.wpfilebase="",GlobalData[e].errors.notify="",GlobalData[e].errors.redirect="",GlobalData[e].xhrs=Array(),wfu_show_simple_progressbar(a.shortcode_id,"progressive");var d=wfu_Initialize_Params();d.general.shortcode_id=e,d.general.unique_id=i,wfu_ProcessUploadComplete(e,0,d,i,a.params_index,t,"",["false","","false"]);var u=0,m=!0,c=0;s(c,l[c],!0,!1)}function wfu_get_userdata_count(e){for(var a=0;document.getElementById("userdata_"+e+"_"+a);)a++;return a}function wfu_lock_upload(e){var a=document.getElementById("fileName_"+e);a&&(a.disabled=!0),document.getElementById("input_"+e).disabled=!0,document.getElementById("upfile_"+e).disabled=!0;var t=document.getElementById("selectsubdir_"+e);t&&(t.disabled=!0);var s=document.getElementById("upload_"+e);s&&(s.disabled=!0);for(var n=wfu_get_userdata_count(e),r=0;n>r;r++)document.getElementById("userdata_"+e+"_message_"+r).disabled=!0}function wfu_unlock_upload(e){var a=document.getElementById("fileName_"+e);a&&(a.disabled=!1),document.getElementById("input_"+e).disabled=!1,document.getElementById("upfile_"+e).disabled=!1;var t=document.getElementById("selectsubdir_"+e);t&&(t.disabled=!1);var s=document.getElementById("upload_"+e);s&&(s.disabled=!1);for(var n=wfu_get_userdata_count(e),r=0;n>r;r++)document.getElementById("userdata_"+e+"_message_"+r).disabled=!1}function wfu_clear(e){document.getElementById("uploadform_"+e).reset();var a=document.getElementById("fileName_"+e);a&&(a.value="",a.className="file_input_textbox");var t=document.getElementById("selectsubdir_"+e);t&&(t.selectedIndex=parseInt(document.getElementById("selectsubdirdefault_"+e).value));for(var s=wfu_get_userdata_count(e),n=0;s>n;n++)document.getElementById("userdata_"+e+"_message_"+n).value="",document.getElementById("hiddeninput_"+e+"_userdata_"+n).value=""}function wfu_reset_message(e){var a=document.getElementById("wfu_messageblock_"+e);if(a){document.getElementById("wfu_messageblock_header_"+e).style.display="";
2
- var t=document.getElementById("wfu_messageblock_header_"+e+"_container");UploadStates[e]&&(t.innerHTML=UploadStates[e].State0),document.getElementById("wfu_messageblock_header_"+e+"_state").value="none",document.getElementById("wfu_messageblock_arrow_"+e).style.display="none",t.colSpan=3,document.getElementById("wfu_messageblock_subheader_"+e+"_messagelabel").innerHTML="",document.getElementById("wfu_messageblock_subheader_"+e+"_adminmessagelabel").innerHTML="",document.getElementById("wfu_messageblock_subheader_"+e).style.display="none",document.getElementById("wfu_messageblock_subheader_"+e+"_message").style.display="none",document.getElementById("wfu_messageblock_subheader_"+e+"_adminmessage").style.display="none";for(var s=wfu_get_file_ids(e),n=1;n<=s.length;n++)a.tBodies[0].removeChild(document.getElementById("wfu_messageblock_"+e+"_"+n)),a.tBodies[0].removeChild(document.getElementById("wfu_messageblock_subheader_"+e+"_"+n))}}function wfu_show_simple_progressbar(e,a){var t=document.getElementById("progressbar_"+e+"_animation"),s=document.getElementById("progressbar_"+e+"_imagesafe");t&&("progressive"==a?(t.style.width="0%",t.className="file_progress_progressive",s.style.display="none",t.style.display="block"):wfu_BrowserCaps.supportsAnimation?(t.style.width="25%",t.className="file_progress_shuffle",s.style.display="none",t.style.display="block"):(t.style.width="0%",t.className="file_progress_noanimation",t.style.display="none",s.style.display="block"),document.getElementById("wordpress_file_upload_progressbar_"+e).style.display="block")}function wfu_hide_simple_progressbar(e){var a=document.getElementById("progressbar_"+e+"_animation"),t=document.getElementById("progressbar_"+e+"_imagesafe");a&&(document.getElementById("wordpress_file_upload_progressbar_"+e).style.display="none",a.style.width="0%",a.className="file_progress_noanimation",t.style.display="none",a.style.display="block")}function wfu_invoke_shortcode_editor(e,a,t){for(var s=document.getElementsByTagName("BUTTON"),n=0,r=null,l=0;l<s.length;l++)s[l].parentNode&&s[l].parentNode.id=="wordpress_file_upload_editor_"+e&&(r=s[l],n++);if(0!=n){if(n>1)return void alert(GlobalData.consts.same_pluginid);var o=wfu_GetHttpRequestObject();if(null!=o){r.parentNode.style.display="none",document.getElementById("wordpress_file_upload_overlay_"+e).style.display="block";var i=GlobalData.consts.ajax_url;params=new Array(4),params[0]=new Array(2),params[0][0]="action",params[0][1]="wfu_ajax_action_edit_shortcode",params[1]=new Array(2),params[1][0]="upload_id",params[1][1]=e,params[2]=new Array(2),params[2][0]="post_id",params[2][1]=a,params[3]=new Array(2),params[3][0]="post_hash",params[3][1]=t;for(var _="",l=0;l<params.length;l++)_+=(l>0?"&":"")+params[l][0]+"="+encodeURI(params[l][1]);o.open("POST",i,!0),o.setRequestHeader("Content-type","application/x-www-form-urlencoded"),o.onreadystatechange=function(){if(4==o.readyState&&200==o.status){document.getElementById("wordpress_file_upload_overlay_"+e).style.display="none",r.parentNode.removeAttribute("style");var a="wfu_edit_shortcode:",t=o.responseText.indexOf(a);-1==t&&(t=o.responseText.length);var s=(o.responseText.substr(0,t),o.responseText.substr(t+a.length,o.responseText.length-t-a.length));t=s.indexOf(":");var n=s.substr(0,t);if(txt_value=s.substr(t+1,s.length-t-1),"success"==n){var l=window.open(wfu_plugin_decode_string(txt_value),"_blank");l.plugin_window=window}else"check_page_obsolete"==n&&alert(txt_value)}},o.send(_)}}}GlobalData={},UploadStates={},GlobalData.filestatematch={},GlobalData.filestatematch.success=[0,1,2,2],GlobalData.filestatematch.warning=[1,1,2,2],GlobalData.filestatematch.error1=[3,3,2,3],GlobalData.filestatematch.error2=[2,2,2,3],GlobalData.UploadInProgressString="",wfu_Check_Browser_Capabilities();
1
+ function wfu_Initialize_Consts(e){if("undefined"==typeof GlobalData.consts){GlobalData.consts=new Object;for(var a=e.split(";"),t=0;t<a.length;t++)const_txt=a[t].split(":"),GlobalData.consts[wfu_plugin_decode_string(const_txt[0])]=wfu_plugin_decode_string(const_txt[1])}}function wfu_install_unload_hook(){window.onbeforeunload=wfu_unload_hook}function wfu_unload_hook(){return""!=GlobalData.UploadInProgressString.trim()?GlobalData.consts.wfu_pageexit_prompt:void 0}function wfu_Check_Browser_Capabilities(){if("undefined"==typeof wfu_BrowserCaps){wfu_BrowserCaps=new Object;var e=wfu_GetHttpRequestObject();wfu_BrowserCaps.supportsAJAX=null!=e,wfu_BrowserCaps.supportsUploadProgress=!!(e&&"upload"in e&&"onprogress"in e.upload);var a=null;try{var a=new FormData}catch(t){}wfu_BrowserCaps.supportsHTML5=null!=a;var t=document.createElement("iframe");wfu_BrowserCaps.supportsIFRAME=null!=t,wfu_BrowserCaps.supportsDRAGDROP=window.FileReader?!0:!1,wfu_BrowserCaps.supportsAnimation=wfu_check_animation(),wfu_BrowserCaps.isSafari=Object.prototype.toString.call(window.HTMLElement).indexOf("Constructor")>0}}function wfu_check_animation(){var e=!1,a="animation",t="",s="Webkit Moz O ms Khtml".split(" "),n="",r=document.createElement("DIV");if(r.style.animationName&&(e=!0),e===!1)for(var l=0;l<s.length;l++)if(void 0!==r.style[s[l]+"AnimationName"]){n=s[l],a=n+"Animation",t="-"+n.toLowerCase()+"-",e=!0;break}return e}function wfu_join_strings(e){for(var a=[].slice.call(arguments),t="",s="",n=1;n<a.length;n++)s=""==t||""==a[n]?"":e,t+=s+a[n];return t}function wfu_plugin_decode_string(e){for(var a,t,s=0,n="";s<e.length;)a=parseInt(e.substr(s,2),16),t=128>a?a:224>a?((31&a)<<6)+(63&parseInt(e.substr(s+=2,2),16)):((15&a)<<12)+((63&parseInt(e.substr(s+=2,2),16))<<6)+(63&parseInt(e.substr(s+=2,2),16)),n+=String.fromCharCode(t),s+=2;return n}function wfu_plugin_encode_string(e){var a=0,t="",s="";for(a=0;a<e.length;a++)num=e.charCodeAt(a),num>=2048?num=((16773120&num|917504)<<4)+((4032&num|8192)<<2)+(63&num|128):num>=128&&(num=((65472&num|12288)<<2)+(63&num|128)),s=num.toString(16),(1==s.length||3==s.length||5==s.length)&&(s="0"+s),t+=s;return t}function wfu_randomString(e){for(var a="0123456789ABCDEFGHIJKLMNOPQRSTUVWXTZabcdefghiklmnopqrstuvwxyz",t=e,s="",n=0;t>n;n++){var r=Math.floor(Math.random()*a.length);s+=a.substring(r,r+1)}return s}function wfu_addEventHandler(e,a,t){e.addEventListener?e.addEventListener(a,t,!1):e.attachEvent?e.attachEvent("on"+a,t):e["on"+a]=t}function wfu_GetHttpRequestObject(){var e=null;try{e=new XMLHttpRequest}catch(a){try{e=new ActiveXObject("Msxml2.XMLHTTP")}catch(t){try{e=new ActiveXObject("Microsoft.XMLHTTP")}catch(a){}}}if(null==e&&window.createRequest)try{xmlhttp=window.createRequest()}catch(a){}return e}function wfu_filedetails_showhide(e,a,t){var s=(document.getElementById("wfu_messageblock_arrow_"+e+"_"+a),document.getElementById("wfu_messageblock_arrow_"+e+"_up_"+a)),n=document.getElementById("wfu_messageblock_arrow_"+e+"_down_"+a),r=document.getElementById("wfu_messageblock_subheader_"+e+"_"+a),l=document.getElementById("wfu_messageblock_header_"+e+"_state_"+a);t?(s.style.display="",n.style.display="none",r.style.display="",l.value=""):(s.style.display="none",n.style.display="",r.style.display="none",l.value="none")}function wfu_get_file_ids(e){for(var a=(document.getElementById("wfu_messageblock_"+e),document.getElementById("wfu_messageblock_subheader_"+e).nextSibling),t="wfu_messageblock_"+e+"_",s=[];null!=a;)1===a.nodeType&&a.id.substr(0,t.length)==t&&s.push(a.id.substr(a.id.lastIndexOf("_")+1)),a=a.nextSibling;return s}function wfu_get_filelist(e,a){a="undefined"!=typeof a?a:!0;var t=document.getElementById("upfile_"+e),s=t.files;return s||(s=t.value?[{name:t.value}]:[]),a&&"undefined"!=typeof t.filearray&&(s=t.filearray),s}function wfu_filedetails_toggle(e,a){var t=(document.getElementById("wfu_messageblock_arrow_"+e+"_"+a),document.getElementById("wfu_messageblock_arrow_"+e+"_up_"+a));wfu_filedetails_showhide(e,a,"none"==t.style.display)}function wfu_headerdetails_showhide(e,a){var t=(document.getElementById("wfu_messageblock_arrow_"+e),document.getElementById("wfu_messageblock_arrow_"+e+"_up")),s=document.getElementById("wfu_messageblock_arrow_"+e+"_down"),n=document.getElementById("wfu_messageblock_subheader_"+e),r=document.getElementById("wfu_messageblock_subheader_"+e+"_message"),l=document.getElementById("wfu_messageblock_subheader_"+e+"_adminmessage"),o=document.getElementById("wfu_messageblock_header_"+e+"_state"),i=wfu_get_file_ids(e);if(a){t.style.display="",s.style.display="none",("none"!=r.style.display||"none"!=l.style.display)&&(n.style.display=""),o.value="";for(var _=0;_<i.length;_++)document.getElementById("wfu_messageblock_"+e+"_"+i[_]).style.display="",document.getElementById("wfu_messageblock_subheader_"+e+"_"+i[_]).style.display=document.getElementById("wfu_messageblock_header_"+e+"_state_"+i[_]).value}else{t.style.display="none",s.style.display="",n.style.display="none",o.value="none";for(var _=0;_<i.length;_++)document.getElementById("wfu_messageblock_"+e+"_"+i[_]).style.display="none",document.getElementById("wfu_messageblock_subheader_"+e+"_"+i[_]).style.display="none"}}function wfu_headerdetails_toggle(e){var a=(document.getElementById("wfu_messageblock_arrow_"+e),document.getElementById("wfu_messageblock_arrow_"+e+"_up"));wfu_headerdetails_showhide(e,"none"==a.style.display)}function wfu_selectbutton_changed(e,a){wfu_BrowserCaps.supportsAJAX&&wfu_BrowserCaps.supportsHTML5||(a=0);var t=document.getElementById("upfile_"+e),s=wfu_get_filelist(e,!1);if(1==a){"undefined"==typeof t.filearray&&(t.filearray=Array());for(var n=0;n<s.length;n++)t.filearray.push(s[n])}wfu_update_filename_text(e)}function wfu_selectbutton_clicked(e){var a=document.getElementById("wordpress_file_upload_message_"+e);a&&(a.style.display="none"),wfu_reset_message(e),document.getElementById("upfile_"+e).value="";var t=document.getElementById("fileName_"+e);t&&(t.value="",t.className="file_input_textbox")}function wfu_update_uploadbutton_status(e){var a=document.getElementById("upload_"+e);if(a){var t=wfu_get_filelist(e),s=t.length>0;a.disabled=!s}}function wfu_update_filename_text(e){var a=document.getElementById("fileName_"+e);if(a){for(var t=wfu_get_filelist(e),s="",n=0;n<t.length;n++)""!=s&&(s+=", "),s+=t[n].name.replace(/c:\\fakepath\\/i,"");a.value=s}}function wfu_selectsubdir_check(e){var a=document.getElementById("selectsubdir_"+e);return a?(document.getElementById("hiddeninput_"+e).value=a.selectedIndex,0==a.selectedIndex?(a.style.backgroundColor="red",!1):(a.style.backgroundColor="transparent",a.options[0].style.display="none",!0)):!0}function wfu_Redirect(e){window.location=e}function wfu_loadStart(){}function wfu_uploadProgress(e,a,t,s){s&&"undefined"==typeof this.xhr&&(console.log("total="+e.total+", loaded="+e.loaded),console.log(e));var n=GlobalData[a].xhrs[t],r=0,l=0,o=document.getElementById("progressbar_"+a+"_animation");if(e.lengthComputable){if(n.sizeloaded=e.loaded,n.size<e.total&&e.total>0){l=e.total-n.size,n.deltasize+=l,n.size+=l;for(var i=0;i<GlobalData[a].xhrs.length;i++)GlobalData[a].xhrs[i].file_id==n.file_id&&(GlobalData[a].xhrs[i].totalsize+=l)}if(o){for(var _=0,d=0,u=[],i=0;i<GlobalData[a].xhrs.length;i++)u[GlobalData[a].xhrs[i].file_id]=0;for(var i=0;i<GlobalData[a].xhrs.length;i++)u[GlobalData[a].xhrs[i].file_id]=Math.max(GlobalData[a].xhrs[i].totalsize,u[GlobalData[a].xhrs[i].file_id]);for(var i=0;i<u.length;i++)"undefined"!=typeof u[i]&&(_+=u[i]);for(var i=0;i<GlobalData[a].xhrs.length;i++)d+=GlobalData[a].xhrs[i].sizeloaded;r=Math.round(100*d/_),o.style.width=r.toString()+"%"}}else o&&(o.style.width="0%")}function wfu_notify_WPFilebase(e,a){var t=wfu_GetHttpRequestObject();if(null==t){var s=document.createElement("iframe");return s.style.display="none",s.src=GlobalData.consts.ajax_url+"?action=wfu_ajax_action_notify_wpfilebase&params_index="+e+"&session_token="+a,void document.body.appendChild(s)}var n=GlobalData.consts.ajax_url;params=new Array(3),params[0]=new Array(2),params[0][0]="action",params[0][1]="wfu_ajax_action_notify_wpfilebase",params[1]=new Array(2),params[1][0]="params_index",params[1][1]=e,params[2]=new Array(2),params[2][0]="session_token",params[2][1]=a;for(var r="",s=0;s<params.length;s++)r+=(s>0?"&":"")+params[s][0]+"="+encodeURI(params[s][1]);t.open("POST",n,!0),t.setRequestHeader("Content-type","application/x-www-form-urlencoded"),t.onreadystatechange=function(){},t.send(r)}function wfu_send_email_notification(e,a,t,s,n,r,l,o,i){var _=wfu_GetHttpRequestObject();if(null!=_){var d=GlobalData.consts.ajax_url,u=wfu_get_userdata_count(e);params=new Array(7+u),params[0]=new Array(2),params[0][0]="action",params[0][1]="wfu_ajax_action_send_email_notification",params[1]=new Array(2),params[1][0]="params_index",params[1][1]=t,params[2]=new Array(2),params[2][0]="session_token",params[2][1]=s,params[3]=new Array(2),params[3][0]="only_filename_list",params[3][1]=n,params[4]=new Array(2),params[4][0]="target_path_list",params[4][1]=r,params[5]=new Array(2),params[5][0]="attachment_list",params[5][1]=l,params[6]=new Array(2),params[6][0]="unique_id",params[6][1]=a;for(var m=0;u>m;m++)params[7+m]=new Array(2),params[7+m][0]="userdata_"+m,params[7+m][1]=wfu_plugin_encode_string(document.getElementById("hiddeninput_"+e+"_userdata_"+m).value);for(var c="",m=0;m<params.length;m++)c+=(m>0?"&":"")+params[m][0]+"="+encodeURI(params[m][1]);var f=new Date;_.xhrid=-1,_.shortcode_id=e,_.requesttype="email",_.file_id=0,_.loading=!1,_.aborted=!1,_.unique_id=a,_.debugmode=o,_.is_admin=i,_.params_index=t,_.session_token=s,_.start_time=f.getTime(),_.end_time=_.start_time,_.finish_time=_.start_time+1e3*parseInt(GlobalData.consts.max_time_limit),_.fail_colors=GlobalData.consts.fail_colors,_.error_message_header="",_.error_message_failed=GlobalData.consts.message_failed,_.error_message_cancelled=GlobalData.consts.message_cancelled,_.error_adminmessage_unknown="",_.open("POST",d,!0),_.setRequestHeader("Content-type","application/x-www-form-urlencoded"),_.addEventListener("load",wfu_uploadComplete,!1),_.addEventListener("error",wfu_uploadFailed,!1),_.addEventListener("abort",wfu_uploadCanceled,!1),_.send(c)}}function wfu_format_debug_data(e,a){return output='<label class="file_messageblock_subheader_debugmessage_label">',output+="Debug Data"+a,output+="</label>",output+='<div class="file_messageblock_subheader_debugmessage_container">',output+=e,output+="</div>"}function wfu_uploadComplete(e){var a=new Date,t=this.shortcode_id,s=(this.file_id,!1),n="",r="",l="unknown",o="",i="wfu_fileupload_success:";this.loading=!1,this.end_time=a.getTime();var _=e.target.responseText,d=_,u="error";if(-1!=_&&_.indexOf("force_errorabort_code")>-1&&(u="errorabort",_=_.replace("force_errorabort_code","")),-1!=_){var m=_.indexOf(i);if(m>-1&&("true"==this.debugmode&&(o=_.substr(0,m)),d=_.substr(m+i.length),m=d.indexOf(":"),r=d.substr(0,m),n=d.substr(m+1)),""!=o){var c="";"fileupload"==this.requesttype?c=" - File: "+this.file_id:"email"==this.requesttype&&(c=" - Email Notification"),o=wfu_format_debug_data(o,c)}if(""!=r){var f=r.split(";");if(1==parseInt(f[2])){var g=f[3].split(",");l=wfu_plugin_decode_string(g[0])}}}if(""==n||""==r){var p=this.fail_colors.split(","),y=wfu_Initialize_Params();y.general.shortcode_id=t,y.general.unique_id=this.unique_id,y.general.state=7,y.general.files_count="fileupload"==this.requesttype?1:0,y.general.upload_finish_time=this.finish_time,y.general.fail_message=GlobalData.consts.message_unknown,y.general.fail_admin_message=wfu_join_strings("<br />",this.error_adminmessage_unknown,this.requesttype+":"+d),y.general.files_count>0?(y[0]={},y[0].color=p[0],y[0].bgcolor=p[1],y[0].borcolor=p[2],y[0].message_type=u,l=u,y[0].header=this.error_message_header,y[0].message=GlobalData.consts.message_timelimit,y[0].admin_messages="true"==this.is_admin?GlobalData.consts.message_admin_timelimit:""):y.general.admin_messages.other="true"==this.is_admin?GlobalData.consts.message_admin_timelimit:"",y.general.upload_finish_time>0&&a.getTime()<y.general.upload_finish_time&&(y.general.files_count>0?(y[0].message=y.general.fail_message,y[0].admin_messages="true"==this.is_admin?y.general.fail_admin_message:""):y.general.admin_messages.other="true"==this.is_admin?y.general.fail_admin_message:"")}return s=""==n||""==r?wfu_ProcessUploadComplete(t,this.file_id,y,this.unique_id,this.params_index,this.session_token,"",[this.debugmode,o,this.is_admin],this.requesttype):wfu_ProcessUploadComplete(t,this.file_id,n,this.unique_id,this.params_index,this.session_token,r,[this.debugmode,o,this.is_admin],this.requesttype),s&&(wfu_unlock_upload(e.target.shortcode_id),wfu_hide_simple_progressbar(t),wfu_clear(e.target.shortcode_id)),e.target.return_status?l:void 0}function wfu_ProcessUploadComplete(e,a,t,s,n,r,l,o,i){if(e&&!(0>e)&&null!=t&&""!=t&&""!=s&&("no-ajax"==s||GlobalData[e])){var _=!1;if("string"==typeof t){t=wfu_plugin_decode_string(t.replace(/^\s+|\s+$/g,""));var d=null;try{d=JSON.parse(t)}catch(u){}if(null==d){var m=l.split(";");d=wfu_Initialize_Params(),d.general.shortcode_id=e,d.general.unique_id=s,d.general.state=m[0],4==d.general.state&&d.general.state++;var c=m[1].split(","),f="",g=GlobalData.consts.jsonparse_filemessage,p=GlobalData.consts.jsonparse_message,y=GlobalData.consts.jsonparse_adminmessage;d.general.files_count=parseInt(m[2]);for(var w=0;w<d.general.files_count;w++)d[w]={},d[w].color=c[0],d[w].bgcolor=c[1],d[w].borcolor=c[2],f=m[w+3].split(","),d[w].message_type=wfu_plugin_decode_string(f[0]),d[w].header=wfu_plugin_decode_string(f[1]),"success"==d[w].message_type&&(d[w].header+=g,d[w].message_type="warning"),d[w].message=wfu_join_strings("<br />",p,wfu_plugin_decode_string(f[2])),d[w].admin_messages=wfu_join_strings("<br />",y,wfu_plugin_decode_string(f[3]))}}else{if("object"!=typeof t)return;var d=t}for(w=0;d[w];)d[w].message_type&&"error"==d[w].message_type.substr(0,5)&&(d[w].message_type=d[w].message_type.substr(0,5)),w++;var b=document.getElementById("wfu_messageblock_"+e),h=!0;if(!UploadStates[e]&&b){var v=document.getElementById("wfu_messageblock_header_"+e+"_states").value;v=wfu_plugin_decode_string(v.replace(/^\s+|\s+$/g,"")),UploadStates[e]=null;try{UploadStates[e]=JSON.parse(v)}catch(u){}null==UploadStates[e]&&(h=!1)}GlobalData[e]||(GlobalData[e]=Object());var I=GlobalData[e];if("no-ajax"==s)I.last=!1,I.unique_id="",I.files_count=d.general.files_count,0==d.general.state&&(d.general.files_count=0),I.files_processed=d.general.files_count,I.upload_state=h?d.general.state:10,I.message=d.general.message,I.update_wpfilebase=d.general.update_wpfilebase,I.redirect_link=d.general.redirect_link,I.notify_only_filename_list="",I.notify_target_path_list="",I.notify_attachment_list="",I.admin_messages={},I.admin_messages.wpfilebase=d.general.admin_messages.wpfilebase,I.admin_messages.notify=d.general.admin_messages.notify,I.admin_messages.redirect=d.general.admin_messages.redirect,I.admin_messages.debug=o[1],I.admin_messages.other=d.general.admin_messages.other,I.errors={},I.errors.wpfilebase=d.general.errors.wpfilebase,I.errors.notify=d.general.errors.notify,I.errors.redirect=d.general.errors.redirect,I.current_size=0,I.total_size=0;else{if(""==I.unique_id||I.unique_id!=s||I.unique_id!=d.general.unique_id)return;if(I.last)return;0==d.general.files_count&&d[0]&&"error"==d[0].message_type&&(d.general.files_count=1);for(var E="",w=0;w<d.general.files_count;w++)E="error"==d[w].message_type&&0==I.files_processed?"error1":"error"==d[w].message_type&&I.files_processed>0?"error2":d[w].message_type,I.upload_state=GlobalData.filestatematch[E][I.upload_state];h||(I.upload_state=10),I.files_processed+=d.general.files_count,I.message=wfu_join_strings("<br />",I.message,d.general.message),""==I.update_wpfilebase&&(I.update_wpfilebase=d.general.update_wpfilebase),(!i||i&&"email"!=i)&&(I.redirect_link=d.general.redirect_link),I.notify_only_filename_list=wfu_join_strings(", ",I.notify_only_filename_list,d.general.notify_only_filename_list),I.notify_target_path_list=wfu_join_strings(", ",I.notify_target_path_list,d.general.notify_target_path_list),I.notify_attachment_list=wfu_join_strings(",",I.notify_attachment_list,d.general.notify_attachment_list),I.admin_messages.debug=wfu_join_strings("<br />",I.admin_messages.debug,o[1]),I.admin_messages.other=wfu_join_strings("<br />",I.admin_messages.other,d.general.admin_messages.other),""==I.admin_messages.wpfilebase&&(I.admin_messages.wpfilebase=d.general.admin_messages.wpfilebase),""==I.admin_messages.notify&&(I.admin_messages.notify=d.general.admin_messages.notify),""==I.admin_messages.redirect&&(I.admin_messages.redirect=d.general.admin_messages.redirect),""==I.errors.wpfilebase&&(I.errors.wpfilebase=d.general.errors.wpfilebase),""==I.errors.notify&&(I.errors.notify=d.general.errors.notify),""==I.errors.redirect&&(I.errors.redirect=d.general.errors.redirect)}I.files_processed==I.files_count&&(I.last=!0,""!=I.update_wpfilebase&&(I.admin_messages.wpfilebase="",wfu_notify_WPFilebase(n,r)),""!=I.notify_only_filename_list&&(I.admin_messages.notify="",wfu_send_email_notification(e,s,n,r,I.notify_only_filename_list,I.notify_target_path_list,I.notify_attachment_list,o[0],o[2]),I.last=!1,I.notify_only_filename_list=""),I.last&&(wfu_notify_server_upload_ended(s,n,r),GlobalData.UploadInProgressString=GlobalData.UploadInProgressString.replace(new RegExp("\\["+s+"\\]","g"),"")),""!=I.errors.redirect&&(I.redirect_link=""),""!=I.redirect_link&&I.last&&""==GlobalData.UploadInProgressString.trim()&&(I.upload_state=11,_=!0));var B=I.message,k=wfu_join_strings("<br />",I.admin_messages.other,I.admin_messages.wpfilebase,I.admin_messages.notify,I.admin_messages.redirect,I.admin_messages.debug);if(!h){var x=GlobalData.consts.jsonparse_headermessage,D=GlobalData.consts.jsonparse_headeradminmessage;B=wfu_join_strings("<br />",x,B),k=wfu_join_strings("<br />",D,k)}if(I.last){0==I.files_count?I.upload_state=8:I.upload_state<4&&(I.upload_state+=4);{""!=I.admin_messages.wpfilebase||""!=I.admin_messages.notify||""!=I.admin_messages.redirect||""!=I.admin_messages.other}4==I.upload_state&&""!=k?I.upload_state++:5==I.upload_state&&""==!k&&""==B&&I.upload_state--}if(b){var G=document.getElementById("wfu_messageblock_header_"+e+"_state"),T=1==I.files_count&&""==B&&""==k&&I.last&&!_;if(T)document.getElementById("wfu_messageblock_header_"+e).style.display="none";else{document.getElementById("wfu_messageblock_header_"+e).style.display="";var j=document.getElementById("wfu_messageblock_header_"+e+"_container");if(h){var q="";1!=I.files_count||5!=I.upload_state&&7!=I.upload_state||(q="_singlefile"),j.innerHTML=UploadStates[e]["State"+I.upload_state+q]}else{j.innerHTML="";var C=document.getElementById("wfu_messageblock_header_"+e+"_safecontainer");j.innerHTML=C.innerHTML.replace(/_safe/g,"")}var S=!1;""!=B?(document.getElementById("wfu_messageblock_subheader_"+e+"_message").style.display="",document.getElementById("wfu_messageblock_subheader_"+e+"_messagelabel").innerHTML=B,S=!0):document.getElementById("wfu_messageblock_subheader_"+e+"_message").style.display="none",""!=k?(document.getElementById("wfu_messageblock_subheader_"+e+"_adminmessage").style.display="",document.getElementById("wfu_messageblock_subheader_"+e+"_adminmessagelabel").innerHTML=k,S=!0):document.getElementById("wfu_messageblock_subheader_"+e+"_adminmessage").style.display="none",document.getElementById("wfu_messageblock_subheader_"+e).style.display=S?G.value:"none",S||I.files_processed>0?(j.colSpan=2,document.getElementById("wfu_messageblock_arrow_"+e).style.display=""):(document.getElementById("wfu_messageblock_arrow_"+e).style.display="none",j.colSpan=3)}for(var A=document.getElementById("wfu_messageblock_subheader_"+e),O=0,H=null,L=document.getElementById("wfu_messageblock_"+e+"_filetemplate"),P="",M=document.getElementById("wfu_messageblock_"+e+"_door"),R=0,U=1,z=2,N=wfu_plugin_decode_string(L.value.replace(/^\s+|\s+$/g,"")),w=0;w<d.general.files_count;w++){for(R=w+a,P=N.replace(/\[file_id\]/g,R),P=P.replace(/\[filenumber_display\]/g,""),P=P.replace(/\[fileheader_color\]/g,d[w].color),P=P.replace(/\[fileheader_bgcolor\]/g,d[w].bgcolor),P=P.replace(/\[fileheader_borcolor\]/g,d[w].borcolor),P=P.replace(/\[fileheader_message\]/g,d[w].header),P=P.replace(/\[filesubheadermessage_display\]/g,'style="display:none;"'),P=P.replace(/\[filesubheader_message\]/g,d[w].message),P=P.replace(/\[filesubheaderadminmessage_display\]/g,'style="display:none;"'),P=P.replace(/\[filesubheader_adminmessage\]/g,d[w].admin_messages),P="<table><tbody>"+P+"</tbody></table>",M.innerHTML=P,U=1,z=2,S=!1,H=document.getElementById("wfu_messageblock_"+e+"_"+R),1==I.files_count?(document.getElementById("wfu_messageblock_"+e+"_filenumber_"+R).style.display="none",document.getElementById("wfu_messageblock_subheader_"+e+"_fileempty_"+R).style.display="none",H.style.display=T?"":G.value,U++,z++):H.style.display=G.value,""!=d[w].message&&(document.getElementById("wfu_messageblock_subheader_"+e+"_message_"+R).style.display="",S=!0),""!=d[w].admin_messages&&(document.getElementById("wfu_messageblock_subheader_"+e+"_adminmessage_"+R).style.display="",S=!0),S||(document.getElementById("wfu_messageblock_arrow_"+e+"_"+R).style.display="none",U++),document.getElementById("wfu_messageblock_header_"+e+"_container_"+R).colSpan=U,document.getElementById("wfu_messageblock_subheader_"+e+"_container_"+R).colSpan=z;R>O&&(A=A.nextSibling,null!=A);)1===A.nodeType&&(O=A.id.substr(A.id.lastIndexOf("_")+1));b.tBodies[0].insertBefore(H,A),A=H.nextSibling,H=document.getElementById("wfu_messageblock_subheader_"+e+"_"+R),b.tBodies[0].insertBefore(H,A),A=H,O=R}T&&(document.getElementById("wfu_messageblock_"+e+"_1").style.display=""),b.style.display="",document.getElementById("wordpress_file_upload_message_"+e).style.display=""}return _&&wfu_Redirect(I.redirect_link),I.last}}function wfu_uploadFailed(e,a){a&&(console.log("failure report following"),console.log(e));var t=e.target,s={target:{responseText:"",shortcode_id:t.shortcode_id}};wfu_uploadComplete.call(t,s)}function wfu_uploadCanceled(){}function wfu_notify_server_upload_ended(e,a,t){var s=wfu_GetHttpRequestObject();if(null!=s){var n=GlobalData.consts.ajax_url;params=new Array(5),params[0]=new Array(2),params[0][0]="action",params[0][1]="wfu_ajax_action",params[1]=new Array(2),params[1][0]="unique_id",params[1][1]=e,params[2]=new Array(2),params[2][0]="params_index",params[2][1]=a,params[3]=new Array(2),params[3][0]="session_token",params[3][1]=t,params[4]=new Array(2),params[4][0]="upload_finished",params[4][1]=1;for(var r="",l=0;l<params.length;l++)r+=(l>0?"&":"")+params[l][0]+"="+encodeURI(params[l][1]);s.open("POST",n,!0),s.setRequestHeader("Content-type","application/x-www-form-urlencoded"),s.onreadystatechange=function(){4==s.readyState&&200==s.status},s.send(r)}}function wfu_Initialize_Params(){var e={};return e.version="full",e.general={},e.general.shortcode_id=0,e.general.unique_id="",e.general.state=0,e.general.files_count=0,e.general.update_wpfilebase="",e.general.redirect_link="",e.general.upload_finish_time=0,e.general.message="",e.general.message_type="",e.general.admin_messages={},e.general.admin_messages.wpfilebase="",e.general.admin_messages.notify="",e.general.admin_messages.redirect="",e.general.admin_messages.other="",e.general.errors={},e.general.errors.wpfilebase="",e.general.errors.notify="",e.general.errors.redirect="",e.general.color="",e.general.bgcolor="",e.general.borcolor="",e.general.notify_only_filename_list="",e.general.notify_target_path_list="",e.general.notify_attachment_list="",e.general.fail_message="",e.general.fail_admin_message="",e}function wfu_redirect_to_classic(e,a,t,s){0!=wfu_filesselected(e)&&wfu_selectsubdir_check(e)&&wfu_check_required_userdata(e)&&wfu_redirect_to_classic_cont(e,a,t,s,[""])}function wfu_redirect_to_classic_cont(e,a,t,s){var n=function(n){if(n.indexOf("wfu_response_success:")>-1){var r=wfu_Initialize_Params();if(r.general.shortcode_id=e,r.general.unique_id="",r.general.files_count=wfu_filesselected(e),wfu_ProcessUploadComplete(e,0,r,"no-ajax","",a,"",["false","","false"]),1==t){var l="";document.getElementById("upfile_"+e).name="uploadedfile_"+e+"_redirected"+l}document.getElementById("adminerrorcodes_"+e).value=s>0?s:"",document.getElementById("upfile_"+e).disabled=!1,document.getElementById("uniqueuploadid_"+e).value=wfu_randomString(20),document.getElementById("uploadform_"+e).submit()}},r="",l=new Date,o=GlobalData.consts.response_url+"?shortcode_id="+e+"&start_time="+l.getTime()+"&session_token="+a+r;wfu_lock_upload(e);var i=wfu_GetHttpRequestObject();if(null==i){var _=document.createElement("iframe");return _?(_.style.display="none",_.src=o,document.body.appendChild(_),void(_.onload=function(){n(_.contentDocument.body.innerHTML)})):void 0}i.open("GET",o,!0),i.onreadystatechange=function(){4==i.readyState&&200==i.status&&n(i.responseText)},i.send(null)}function wfu_filesselected(e){var a=document.getElementById("fileName_"+e),t=wfu_get_filelist(e);return 0==t.length&&a&&(a.value=GlobalData.consts.nofilemessage,a.className="file_input_textbox_nofile"),t.length}function wfu_check_required_userdata(e){for(var a=wfu_get_userdata_count(e),t=!1,s=0;a>s;s++){var n=document.getElementById("hiddeninput_"+e+"_userdata_"+s),r=document.getElementById("userdata_"+e+"_message_"+s),l="file_userdata_message_required";r.className.substr(0,l.length)==l&&""==n.value&&(r.className=l+"_empty",r.value=GlobalData.consts.userdata_empty,t=!0)}return!t}function wfu_HTML5UploadFile(e,a,t){if(!wfu_BrowserCaps.supportsAJAX)return void wfu_redirect_to_classic(e,t,1,1);if(!wfu_BrowserCaps.supportsHTML5)return void wfu_redirect_to_classic(e,t,1,2);a=wfu_plugin_decode_string(a.replace(/^\s+|\s+$/g,""));var s=null;try{s=JSON.parse(a)}catch(n){}if(null==s)return void wfu_redirect_to_classic(e,t,1,3);var r=wfu_GetHttpRequestObject();if(null!=r){var l=wfu_filesselected(e);if(0!=l&&wfu_selectsubdir_check(e)){var o=l;o+=o,wfu_check_required_userdata(e)&&wfu_HTML5UploadFile_cont(e,s,t,[""])}}}function wfu_HTML5UploadFile_cont(e,a,t){function s(_,m,c,f){u=!0;var g=wfu_GetHttpRequestObject(),p=wfu_GetHttpRequestObject();if(null!=g&&null!=p){var y=null,w=null;try{var y=new FormData,w=new FormData}catch(b){}if(null!=y&&null!=w){c||y.append("uploadedfile_"+e+l,m),y.append("uploadedfile_"+e+"_index",_),y.append("uploadedfile_"+e+"_name",wfu_plugin_encode_string(r[_].name)),y.append("uploadedfile_"+e+"_size",r[_].size),y.append("action","wfu_ajax_action"),y.append("uniqueuploadid_"+e,i),y.append("params_index",a.params_index),y.append("subdir_sel_index",n),c?y.append("only_check","1"):y.append("only_check","0"),y.append("session_token",t),y.append("unique_id",o);for(var h=wfu_get_userdata_count(e),v=0;h>v;v++)y.append("hiddeninput_"+e+"_userdata_"+v,document.getElementById("hiddeninput_"+e+"_userdata_"+v).value);var I=GlobalData[e].xhrs.push(g)-1,E=new Date;if(g.xhrid=I,g.shortcode_id=e,g.requesttype="fileupload",g.file_id=_+1,c?(g.size=0,g.totalsize=0,g.loading=!1):(g.size=m.size,g.totalsize=r[_].size,g.loading=!0),g.deltasize=0,g.sizeloaded=0,g.aborted=!1,g.unique_id=o,g.params_index=a.params_index,g.session_token=t,g.debugmode=a.debugmode,g.is_admin=a.is_admin,g.start_time=E.getTime(),g.end_time=g.start_time,g.finish_time=g.start_time+1e3*parseInt(GlobalData.consts.max_time_limit),g.fail_colors=a.fail_colors,g.error_message_header=a.error_header.replace(/%username%/g,"no data"),g.error_message_header=g.error_message_header.replace(/%useremail%/g,"no data"),g.error_message_header=g.error_message_header.replace(/%filename%/g,r[_].name),g.error_message_header=g.error_message_header.replace(/%filepath%/g,r[_].name),g.error_message_failed=GlobalData.consts.message_failed,g.error_message_cancelled=GlobalData.consts.message_cancelled,g.error_adminmessage_unknown=GlobalData.consts.adminmessage_unknown.replace(/%username%/g,"no data"),g.error_adminmessage_unknown=g.error_adminmessage_unknown.replace(/%useremail%/g,"no data"),g.error_adminmessage_unknown=g.error_adminmessage_unknown.replace(/%filename%/g,r[_].name),g.error_adminmessage_unknown=g.error_adminmessage_unknown.replace(/%filepath%/g,r[_].name),f){w.append("action","wfu_ajax_action"),w.append("params_index",a.params_index),w.append("session_token",t),w.append("force_connection_close","1"),p.open("POST",GlobalData.consts.ajax_url,!1);try{p.send(w)}catch(B){}u="success"==p.responseText}if(u)c?(g.addEventListener("load",function(a){a={target:{responseText:a.target.responseText,shortcode_id:e,return_status:!0}};var t=wfu_uploadComplete.call(g,a);u="success"==t||"warning"==t,u&&s(_,m,!1,!1)},!1),g.addEventListener("error",function(){},!1),g.open("POST",GlobalData.consts.ajax_url,!0),g.send(y)):(g.upload.xhr=g,g.upload.dummy=1,g.upload.addEventListener("loadstart",wfu_loadStart,!1),g.upload.addEventListener("progress",new Function("evt","wfu_uploadProgress(evt, "+e+", "+I+", "+a.debugmode+");"),!1),g.addEventListener("load",wfu_uploadComplete,!1),g.addEventListener("error",new Function("evt","wfu_uploadFailed(evt, "+a.debugmode+");"),!1),g.addEventListener("abort",wfu_uploadCanceled,!1),g.open("POST",GlobalData.consts.ajax_url,!0),g.send(y));else{var k={target:{responseText:"",shortcode_id:e}};wfu_uploadComplete.call(g,k)}return d++,u}}}var n=-1;null!=document.getElementById("selectsubdir_"+e)&&(n=document.getElementById("selectsubdir_"+e).selectedIndex);var r=wfu_get_filelist(e),l="",o=wfu_randomString(10),i=o;GlobalData.UploadInProgressString+="["+o+"]",GlobalData[e]={},GlobalData[e].unique_id=o,GlobalData[e].last=!1,GlobalData[e].files_count=1,GlobalData[e].files_processed=0,GlobalData[e].upload_state=0,GlobalData[e].message="",GlobalData[e].update_wpfilebase="",GlobalData[e].redirect_link="",GlobalData[e].notify_only_filename_list="",GlobalData[e].notify_target_path_list="",GlobalData[e].notify_attachment_list="",GlobalData[e].admin_messages={},GlobalData[e].admin_messages.wpfilebase="",GlobalData[e].admin_messages.notify="",GlobalData[e].admin_messages.redirect="",GlobalData[e].admin_messages.debug="",GlobalData[e].admin_messages.other="",GlobalData[e].errors={},GlobalData[e].errors.wpfilebase="",GlobalData[e].errors.notify="",GlobalData[e].errors.redirect="",GlobalData[e].xhrs=Array(),wfu_show_simple_progressbar(a.shortcode_id,"progressive");var _=wfu_Initialize_Params();_.general.shortcode_id=e,_.general.unique_id=o,wfu_ProcessUploadComplete(e,0,_,o,a.params_index,t,"",["false","","false"]);var d=0,u=!0,m=0;s(m,r[m],!0,!1)}function wfu_get_userdata_count(e){for(var a=0;document.getElementById("userdata_"+e+"_"+a);)a++;return a}function wfu_lock_upload(e){var a=document.getElementById("fileName_"+e);a&&(a.disabled=!0),document.getElementById("input_"+e).disabled=!0,document.getElementById("upfile_"+e).disabled=!0;var t=document.getElementById("selectsubdir_"+e);t&&(t.disabled=!0);var s=document.getElementById("upload_"+e);s&&(s.disabled=!0);for(var n=wfu_get_userdata_count(e),r=0;n>r;r++)document.getElementById("userdata_"+e+"_message_"+r).disabled=!0}function wfu_unlock_upload(e){var a=document.getElementById("fileName_"+e);a&&(a.disabled=!1),document.getElementById("input_"+e).disabled=!1,document.getElementById("upfile_"+e).disabled=!1;var t=document.getElementById("selectsubdir_"+e);t&&(t.disabled=!1);var s=document.getElementById("upload_"+e);s&&(s.disabled=!1);for(var n=wfu_get_userdata_count(e),r=0;n>r;r++)document.getElementById("userdata_"+e+"_message_"+r).disabled=!1}function wfu_clear(e){document.getElementById("uploadform_"+e).reset();var a=document.getElementById("fileName_"+e);a&&(a.value="",a.className="file_input_textbox");var t=document.getElementById("selectsubdir_"+e);t&&(t.selectedIndex=parseInt(document.getElementById("selectsubdirdefault_"+e).value));for(var s=wfu_get_userdata_count(e),n=0;s>n;n++)document.getElementById("userdata_"+e+"_message_"+n).value="",document.getElementById("hiddeninput_"+e+"_userdata_"+n).value=""
2
+ }function wfu_reset_message(e){var a=document.getElementById("wfu_messageblock_"+e);if(a){document.getElementById("wfu_messageblock_header_"+e).style.display="";var t=document.getElementById("wfu_messageblock_header_"+e+"_container");UploadStates[e]&&(t.innerHTML=UploadStates[e].State0),document.getElementById("wfu_messageblock_header_"+e+"_state").value="none",document.getElementById("wfu_messageblock_arrow_"+e).style.display="none",t.colSpan=3,document.getElementById("wfu_messageblock_subheader_"+e+"_messagelabel").innerHTML="",document.getElementById("wfu_messageblock_subheader_"+e+"_adminmessagelabel").innerHTML="",document.getElementById("wfu_messageblock_subheader_"+e).style.display="none",document.getElementById("wfu_messageblock_subheader_"+e+"_message").style.display="none",document.getElementById("wfu_messageblock_subheader_"+e+"_adminmessage").style.display="none";for(var s=wfu_get_file_ids(e),n=1;n<=s.length;n++)a.tBodies[0].removeChild(document.getElementById("wfu_messageblock_"+e+"_"+n)),a.tBodies[0].removeChild(document.getElementById("wfu_messageblock_subheader_"+e+"_"+n))}}function wfu_show_simple_progressbar(e,a){var t=document.getElementById("progressbar_"+e+"_animation"),s=document.getElementById("progressbar_"+e+"_imagesafe");t&&("progressive"==a?(t.style.width="0%",t.className="file_progress_progressive",s.style.display="none",t.style.display="block"):wfu_BrowserCaps.supportsAnimation?(t.style.width="25%",t.className="file_progress_shuffle",s.style.display="none",t.style.display="block"):(t.style.width="0%",t.className="file_progress_noanimation",t.style.display="none",s.style.display="block"),document.getElementById("wordpress_file_upload_progressbar_"+e).style.display="block")}function wfu_hide_simple_progressbar(e){var a=document.getElementById("progressbar_"+e+"_animation"),t=document.getElementById("progressbar_"+e+"_imagesafe");a&&(document.getElementById("wordpress_file_upload_progressbar_"+e).style.display="none",a.style.width="0%",a.className="file_progress_noanimation",t.style.display="none",a.style.display="block")}function wfu_invoke_shortcode_editor(e,a,t){for(var s=document.getElementsByTagName("BUTTON"),n=0,r=null,l=0;l<s.length;l++)s[l].parentNode&&s[l].parentNode.id=="wordpress_file_upload_editor_"+e&&(r=s[l],n++);if(0!=n){if(n>1)return void alert(GlobalData.consts.same_pluginid);var o=wfu_GetHttpRequestObject();if(null!=o){r.parentNode.style.display="none",document.getElementById("wordpress_file_upload_overlay_"+e).style.display="block";var i=GlobalData.consts.ajax_url;params=new Array(4),params[0]=new Array(2),params[0][0]="action",params[0][1]="wfu_ajax_action_edit_shortcode",params[1]=new Array(2),params[1][0]="upload_id",params[1][1]=e,params[2]=new Array(2),params[2][0]="post_id",params[2][1]=a,params[3]=new Array(2),params[3][0]="post_hash",params[3][1]=t;for(var _="",l=0;l<params.length;l++)_+=(l>0?"&":"")+params[l][0]+"="+encodeURI(params[l][1]);o.open("POST",i,!0),o.setRequestHeader("Content-type","application/x-www-form-urlencoded"),o.onreadystatechange=function(){if(4==o.readyState&&200==o.status){document.getElementById("wordpress_file_upload_overlay_"+e).style.display="none",r.parentNode.removeAttribute("style");var a="wfu_edit_shortcode:",t=o.responseText.indexOf(a);-1==t&&(t=o.responseText.length);var s=(o.responseText.substr(0,t),o.responseText.substr(t+a.length,o.responseText.length-t-a.length));t=s.indexOf(":");var n=s.substr(0,t);if(txt_value=s.substr(t+1,s.length-t-1),"success"==n){var l=window.open(wfu_plugin_decode_string(txt_value),"_blank");l.plugin_window=window}else"check_page_obsolete"==n&&alert(txt_value)}},o.send(_)}}}GlobalData={},UploadStates={},GlobalData.filestatematch={},GlobalData.filestatematch.success=[0,1,2,2],GlobalData.filestatematch.warning=[1,1,2,2],GlobalData.filestatematch.error1=[3,3,2,3],GlobalData.filestatematch.error2=[2,2,2,3],GlobalData.UploadInProgressString="",wfu_Check_Browser_Capabilities();
languages/wordpress-file-upload-fr_FR.mo CHANGED
Binary file
languages/wordpress-file-upload-fr_FR.po CHANGED
@@ -2,8 +2,8 @@ msgid ""
2
  msgstr ""
3
  "Project-Id-Version: Wordpress File Upload\n"
4
  "Report-Msgid-Bugs-To: \n"
5
- "POT-Creation-Date: 2015-04-14 14:00+0200\n"
6
- "PO-Revision-Date: 2015-04-14 14:00+0200\n"
7
  "Last-Translator: nickboss <nickboss@iptanus.com>\n"
8
  "Language-Team: \n"
9
  "Language: fr_FR\n"
@@ -415,29 +415,35 @@ msgstr ""
415
 
416
  #: lib/wfu_constants.php:131
417
  msgid ""
 
 
 
 
 
 
418
  "The page containing the shortcode has been modified and it is no longer "
419
  "valid. Please go back to reload the shortcode."
420
  msgstr ""
421
 
422
- #: lib/wfu_constants.php:132
423
  msgid ""
424
  "Failed to update the shortcode because the contents of the page changed. Go "
425
  "back to reload the shortcode."
426
  msgstr ""
427
 
428
- #: lib/wfu_constants.php:133
429
  msgid ""
430
  "Failed to update the shortcode. Please try again. If the problem persists, "
431
  "go back and reload the shortcode."
432
  msgstr ""
433
 
434
- #: lib/wfu_constants.php:136
435
  msgid ""
436
  "Insert variable %userid% inside text. It will be replaced by the id of the "
437
  "current user."
438
  msgstr ""
439
 
440
- #: lib/wfu_constants.php:137
441
  msgid ""
442
  "Insert variable %username% inside text. It will be replaced by the username "
443
  "of the current user."
@@ -445,7 +451,7 @@ msgstr ""
445
  "Insérez la variable %username% dans le texte. Il sera remplacé par le "
446
  "username de l'utilisateur courant."
447
 
448
- #: lib/wfu_constants.php:138
449
  msgid ""
450
  "Insert variable %useremail% inside text. It will be replaced by the email of "
451
  "the current user."
@@ -453,7 +459,7 @@ msgstr ""
453
  "Insérez la variable %useremail% dans le texte. Il sera remplacé par l'email "
454
  "de l'utilisateur courant."
455
 
456
- #: lib/wfu_constants.php:139
457
  msgid ""
458
  "Insert variable %filename% inside text. It will be replaced by the filename "
459
  "of the uploaded file."
@@ -461,7 +467,7 @@ msgstr ""
461
  "Insérez la variable %filename% dans le texte. Il sera remplacé par le nom du "
462
  "fichier à envoyer."
463
 
464
- #: lib/wfu_constants.php:140
465
  msgid ""
466
  "Insert variable %filepath% inside text. It will be replaced by the full "
467
  "filepath of the uploaded file."
@@ -469,7 +475,7 @@ msgstr ""
469
  "Insérez la variable %filepath% dans le texte. Il sera remplacé par le chemin "
470
  "complet du fichier envoyé."
471
 
472
- #: lib/wfu_constants.php:141
473
  msgid ""
474
  "Insert variable %blogid% inside text. It will be replaced by the blog id of "
475
  "the website."
@@ -477,19 +483,19 @@ msgstr ""
477
  "Insérez la variable %blogid% dans le texte. Il sera remplacé par l'id du "
478
  "blog du site web."
479
 
480
- #: lib/wfu_constants.php:142
481
  msgid ""
482
  "Insert variable %pageid% inside text. It will be replaced by the id of the "
483
  "current page."
484
  msgstr ""
485
 
486
- #: lib/wfu_constants.php:143
487
  msgid ""
488
  "Insert variable %pagetitle% inside text. It will be replaced by the title of "
489
  "the current page."
490
  msgstr ""
491
 
492
- #: lib/wfu_constants.php:144
493
  msgid ""
494
  "Insert variable %userdataXXX% inside text. Select the user field from the "
495
  "drop-down list. It will be replaced by the value that the user entered in "
@@ -499,74 +505,74 @@ msgstr ""
499
  "l'utilisateur dans la liste déroulante. Il sera remplacé par la valeur que "
500
  "l'utilisateur aura entré dans ce champs."
501
 
502
- #: lib/wfu_constants.php:145
503
  msgid "Insert variable %n% inside text to denote a line change."
504
  msgstr ""
505
  "Insérez la variable %n% à l'intérieur du texte pour indiquer un changement "
506
  "de ligne."
507
 
508
- #: lib/wfu_constants.php:148
509
  msgid "Upload in progress"
510
  msgstr "Envoi en cours"
511
 
512
- #: lib/wfu_constants.php:149
513
  msgid "Upload in progress with warnings!"
514
  msgstr "Envoi en cours mais avec des avertissements!"
515
 
516
- #: lib/wfu_constants.php:150
517
  msgid "Upload in progress but some files already failed!"
518
  msgstr "Envoi en cours mais certains fichiers ont échoués!"
519
 
520
- #: lib/wfu_constants.php:151
521
  msgid "Upload in progress but no files uploaded so far!"
522
  msgstr "Envoi en cours mais aucun fichiers n'a été envoyé pour le moment!"
523
 
524
- #: lib/wfu_constants.php:152
525
  msgid "All files uploaded successfully"
526
  msgstr "Tous les fichiers ont été envoyés avec succès"
527
 
528
- #: lib/wfu_constants.php:153
529
  msgid "All files uploaded successfully but there are warnings!"
530
  msgstr ""
531
  "Tous les fichiers ont été envoyer avec succès mais avec des avertissements!"
532
 
533
- #: lib/wfu_constants.php:154
534
  msgid "File uploaded successfully but there are warnings!"
535
  msgstr "Fichiers envoyés avec succès mais certain avec un avertissement."
536
 
537
- #: lib/wfu_constants.php:155
538
  msgid "Some files failed to upload!"
539
  msgstr "Certains fichiers n'ont pas été envoyé"
540
 
541
- #: lib/wfu_constants.php:156
542
  msgid "All files failed to upload"
543
  msgstr "Impossible d'envoyer les fichiers"
544
 
545
- #: lib/wfu_constants.php:157
546
  msgid "File failed to upload"
547
  msgstr "Impossible d'envoyer le fichier"
548
 
549
- #: lib/wfu_constants.php:158
550
  msgid "There are no files to upload!"
551
  msgstr "Il n'y a pas de fichiers à envoyer"
552
 
553
- #: lib/wfu_constants.php:159
554
  msgid "Test upload message"
555
  msgstr "Message de test d'upload"
556
 
557
- #: lib/wfu_constants.php:160
558
  msgid "JSON parse warning!"
559
  msgstr "Avertisements d'analyse JSON."
560
 
561
- #: lib/wfu_constants.php:161
562
  msgid "please wait while redirecting..."
563
  msgstr "merci de patienter pendans la redirection..."
564
 
565
- #: lib/wfu_constants.php:162
566
  msgid "Open visual shortcode editor in new window"
567
  msgstr ""
568
 
569
- #: lib/wfu_constants.php:163
570
  msgid "loading visual editor"
571
  msgstr ""
572
 
2
  msgstr ""
3
  "Project-Id-Version: Wordpress File Upload\n"
4
  "Report-Msgid-Bugs-To: \n"
5
+ "POT-Creation-Date: 2015-05-01 17:06+0200\n"
6
+ "PO-Revision-Date: 2015-05-01 17:06+0200\n"
7
  "Last-Translator: nickboss <nickboss@iptanus.com>\n"
8
  "Language-Team: \n"
9
  "Language: fr_FR\n"
415
 
416
  #: lib/wfu_constants.php:131
417
  msgid ""
418
+ "Failed to delete the shortcode because the contents of the page changed. Try "
419
+ "again to delete it."
420
+ msgstr ""
421
+
422
+ #: lib/wfu_constants.php:132
423
+ msgid ""
424
  "The page containing the shortcode has been modified and it is no longer "
425
  "valid. Please go back to reload the shortcode."
426
  msgstr ""
427
 
428
+ #: lib/wfu_constants.php:133
429
  msgid ""
430
  "Failed to update the shortcode because the contents of the page changed. Go "
431
  "back to reload the shortcode."
432
  msgstr ""
433
 
434
+ #: lib/wfu_constants.php:134
435
  msgid ""
436
  "Failed to update the shortcode. Please try again. If the problem persists, "
437
  "go back and reload the shortcode."
438
  msgstr ""
439
 
440
+ #: lib/wfu_constants.php:137
441
  msgid ""
442
  "Insert variable %userid% inside text. It will be replaced by the id of the "
443
  "current user."
444
  msgstr ""
445
 
446
+ #: lib/wfu_constants.php:138
447
  msgid ""
448
  "Insert variable %username% inside text. It will be replaced by the username "
449
  "of the current user."
451
  "Insérez la variable %username% dans le texte. Il sera remplacé par le "
452
  "username de l'utilisateur courant."
453
 
454
+ #: lib/wfu_constants.php:139
455
  msgid ""
456
  "Insert variable %useremail% inside text. It will be replaced by the email of "
457
  "the current user."
459
  "Insérez la variable %useremail% dans le texte. Il sera remplacé par l'email "
460
  "de l'utilisateur courant."
461
 
462
+ #: lib/wfu_constants.php:140
463
  msgid ""
464
  "Insert variable %filename% inside text. It will be replaced by the filename "
465
  "of the uploaded file."
467
  "Insérez la variable %filename% dans le texte. Il sera remplacé par le nom du "
468
  "fichier à envoyer."
469
 
470
+ #: lib/wfu_constants.php:141
471
  msgid ""
472
  "Insert variable %filepath% inside text. It will be replaced by the full "
473
  "filepath of the uploaded file."
475
  "Insérez la variable %filepath% dans le texte. Il sera remplacé par le chemin "
476
  "complet du fichier envoyé."
477
 
478
+ #: lib/wfu_constants.php:142
479
  msgid ""
480
  "Insert variable %blogid% inside text. It will be replaced by the blog id of "
481
  "the website."
483
  "Insérez la variable %blogid% dans le texte. Il sera remplacé par l'id du "
484
  "blog du site web."
485
 
486
+ #: lib/wfu_constants.php:143
487
  msgid ""
488
  "Insert variable %pageid% inside text. It will be replaced by the id of the "
489
  "current page."
490
  msgstr ""
491
 
492
+ #: lib/wfu_constants.php:144
493
  msgid ""
494
  "Insert variable %pagetitle% inside text. It will be replaced by the title of "
495
  "the current page."
496
  msgstr ""
497
 
498
+ #: lib/wfu_constants.php:145
499
  msgid ""
500
  "Insert variable %userdataXXX% inside text. Select the user field from the "
501
  "drop-down list. It will be replaced by the value that the user entered in "
505
  "l'utilisateur dans la liste déroulante. Il sera remplacé par la valeur que "
506
  "l'utilisateur aura entré dans ce champs."
507
 
508
+ #: lib/wfu_constants.php:146
509
  msgid "Insert variable %n% inside text to denote a line change."
510
  msgstr ""
511
  "Insérez la variable %n% à l'intérieur du texte pour indiquer un changement "
512
  "de ligne."
513
 
514
+ #: lib/wfu_constants.php:149
515
  msgid "Upload in progress"
516
  msgstr "Envoi en cours"
517
 
518
+ #: lib/wfu_constants.php:150
519
  msgid "Upload in progress with warnings!"
520
  msgstr "Envoi en cours mais avec des avertissements!"
521
 
522
+ #: lib/wfu_constants.php:151
523
  msgid "Upload in progress but some files already failed!"
524
  msgstr "Envoi en cours mais certains fichiers ont échoués!"
525
 
526
+ #: lib/wfu_constants.php:152
527
  msgid "Upload in progress but no files uploaded so far!"
528
  msgstr "Envoi en cours mais aucun fichiers n'a été envoyé pour le moment!"
529
 
530
+ #: lib/wfu_constants.php:153
531
  msgid "All files uploaded successfully"
532
  msgstr "Tous les fichiers ont été envoyés avec succès"
533
 
534
+ #: lib/wfu_constants.php:154
535
  msgid "All files uploaded successfully but there are warnings!"
536
  msgstr ""
537
  "Tous les fichiers ont été envoyer avec succès mais avec des avertissements!"
538
 
539
+ #: lib/wfu_constants.php:155
540
  msgid "File uploaded successfully but there are warnings!"
541
  msgstr "Fichiers envoyés avec succès mais certain avec un avertissement."
542
 
543
+ #: lib/wfu_constants.php:156
544
  msgid "Some files failed to upload!"
545
  msgstr "Certains fichiers n'ont pas été envoyé"
546
 
547
+ #: lib/wfu_constants.php:157
548
  msgid "All files failed to upload"
549
  msgstr "Impossible d'envoyer les fichiers"
550
 
551
+ #: lib/wfu_constants.php:158
552
  msgid "File failed to upload"
553
  msgstr "Impossible d'envoyer le fichier"
554
 
555
+ #: lib/wfu_constants.php:159
556
  msgid "There are no files to upload!"
557
  msgstr "Il n'y a pas de fichiers à envoyer"
558
 
559
+ #: lib/wfu_constants.php:160
560
  msgid "Test upload message"
561
  msgstr "Message de test d'upload"
562
 
563
+ #: lib/wfu_constants.php:161
564
  msgid "JSON parse warning!"
565
  msgstr "Avertisements d'analyse JSON."
566
 
567
+ #: lib/wfu_constants.php:162
568
  msgid "please wait while redirecting..."
569
  msgstr "merci de patienter pendans la redirection..."
570
 
571
+ #: lib/wfu_constants.php:163
572
  msgid "Open visual shortcode editor in new window"
573
  msgstr ""
574
 
575
+ #: lib/wfu_constants.php:164
576
  msgid "loading visual editor"
577
  msgstr ""
578
 
languages/wordpress-file-upload.pot CHANGED
@@ -2,8 +2,8 @@ msgid ""
2
  msgstr ""
3
  "Project-Id-Version: Wordpress File Upload\n"
4
  "Report-Msgid-Bugs-To: \n"
5
- "POT-Creation-Date: 2015-04-14 14:00+0200\n"
6
- "PO-Revision-Date: 2015-04-14 14:00+0200\n"
7
  "Last-Translator: nickboss <info@iptanus.com>\n"
8
  "Language-Team: Iptanus Team <info@iptanus.com>\n"
9
  "Language: en\n"
@@ -359,141 +359,147 @@ msgstr ""
359
 
360
  #: lib/wfu_constants.php:131
361
  msgid ""
 
 
 
 
 
 
362
  "The page containing the shortcode has been modified and it is no longer "
363
  "valid. Please go back to reload the shortcode."
364
  msgstr ""
365
 
366
- #: lib/wfu_constants.php:132
367
  msgid ""
368
  "Failed to update the shortcode because the contents of the page changed. Go "
369
  "back to reload the shortcode."
370
  msgstr ""
371
 
372
- #: lib/wfu_constants.php:133
373
  msgid ""
374
  "Failed to update the shortcode. Please try again. If the problem persists, "
375
  "go back and reload the shortcode."
376
  msgstr ""
377
 
378
- #: lib/wfu_constants.php:136
379
  msgid ""
380
  "Insert variable %userid% inside text. It will be replaced by the id of the "
381
  "current user."
382
  msgstr ""
383
 
384
- #: lib/wfu_constants.php:137
385
  msgid ""
386
  "Insert variable %username% inside text. It will be replaced by the username "
387
  "of the current user."
388
  msgstr ""
389
 
390
- #: lib/wfu_constants.php:138
391
  msgid ""
392
  "Insert variable %useremail% inside text. It will be replaced by the email of "
393
  "the current user."
394
  msgstr ""
395
 
396
- #: lib/wfu_constants.php:139
397
  msgid ""
398
  "Insert variable %filename% inside text. It will be replaced by the filename "
399
  "of the uploaded file."
400
  msgstr ""
401
 
402
- #: lib/wfu_constants.php:140
403
  msgid ""
404
  "Insert variable %filepath% inside text. It will be replaced by the full "
405
  "filepath of the uploaded file."
406
  msgstr ""
407
 
408
- #: lib/wfu_constants.php:141
409
  msgid ""
410
  "Insert variable %blogid% inside text. It will be replaced by the blog id of "
411
  "the website."
412
  msgstr ""
413
 
414
- #: lib/wfu_constants.php:142
415
  msgid ""
416
  "Insert variable %pageid% inside text. It will be replaced by the id of the "
417
  "current page."
418
  msgstr ""
419
 
420
- #: lib/wfu_constants.php:143
421
  msgid ""
422
  "Insert variable %pagetitle% inside text. It will be replaced by the title of "
423
  "the current page."
424
  msgstr ""
425
 
426
- #: lib/wfu_constants.php:144
427
  msgid ""
428
  "Insert variable %userdataXXX% inside text. Select the user field from the "
429
  "drop-down list. It will be replaced by the value that the user entered in "
430
  "this field."
431
  msgstr ""
432
 
433
- #: lib/wfu_constants.php:145
434
  msgid "Insert variable %n% inside text to denote a line change."
435
  msgstr ""
436
 
437
- #: lib/wfu_constants.php:148
438
  msgid "Upload in progress"
439
  msgstr ""
440
 
441
- #: lib/wfu_constants.php:149
442
  msgid "Upload in progress with warnings!"
443
  msgstr ""
444
 
445
- #: lib/wfu_constants.php:150
446
  msgid "Upload in progress but some files already failed!"
447
  msgstr ""
448
 
449
- #: lib/wfu_constants.php:151
450
  msgid "Upload in progress but no files uploaded so far!"
451
  msgstr ""
452
 
453
- #: lib/wfu_constants.php:152
454
  msgid "All files uploaded successfully"
455
  msgstr ""
456
 
457
- #: lib/wfu_constants.php:153
458
  msgid "All files uploaded successfully but there are warnings!"
459
  msgstr ""
460
 
461
- #: lib/wfu_constants.php:154
462
  msgid "File uploaded successfully but there are warnings!"
463
  msgstr ""
464
 
465
- #: lib/wfu_constants.php:155
466
  msgid "Some files failed to upload!"
467
  msgstr ""
468
 
469
- #: lib/wfu_constants.php:156
470
  msgid "All files failed to upload"
471
  msgstr ""
472
 
473
- #: lib/wfu_constants.php:157
474
  msgid "File failed to upload"
475
  msgstr ""
476
 
477
- #: lib/wfu_constants.php:158
478
  msgid "There are no files to upload!"
479
  msgstr ""
480
 
481
- #: lib/wfu_constants.php:159
482
  msgid "Test upload message"
483
  msgstr ""
484
 
485
- #: lib/wfu_constants.php:160
486
  msgid "JSON parse warning!"
487
  msgstr ""
488
 
489
- #: lib/wfu_constants.php:161
490
  msgid "please wait while redirecting..."
491
  msgstr ""
492
 
493
- #: lib/wfu_constants.php:162
494
  msgid "Open visual shortcode editor in new window"
495
  msgstr ""
496
 
497
- #: lib/wfu_constants.php:163
498
  msgid "loading visual editor"
499
  msgstr ""
2
  msgstr ""
3
  "Project-Id-Version: Wordpress File Upload\n"
4
  "Report-Msgid-Bugs-To: \n"
5
+ "POT-Creation-Date: 2015-05-01 17:06+0200\n"
6
+ "PO-Revision-Date: 2015-05-01 17:06+0200\n"
7
  "Last-Translator: nickboss <info@iptanus.com>\n"
8
  "Language-Team: Iptanus Team <info@iptanus.com>\n"
9
  "Language: en\n"
359
 
360
  #: lib/wfu_constants.php:131
361
  msgid ""
362
+ "Failed to delete the shortcode because the contents of the page changed. Try "
363
+ "again to delete it."
364
+ msgstr ""
365
+
366
+ #: lib/wfu_constants.php:132
367
+ msgid ""
368
  "The page containing the shortcode has been modified and it is no longer "
369
  "valid. Please go back to reload the shortcode."
370
  msgstr ""
371
 
372
+ #: lib/wfu_constants.php:133
373
  msgid ""
374
  "Failed to update the shortcode because the contents of the page changed. Go "
375
  "back to reload the shortcode."
376
  msgstr ""
377
 
378
+ #: lib/wfu_constants.php:134
379
  msgid ""
380
  "Failed to update the shortcode. Please try again. If the problem persists, "
381
  "go back and reload the shortcode."
382
  msgstr ""
383
 
384
+ #: lib/wfu_constants.php:137
385
  msgid ""
386
  "Insert variable %userid% inside text. It will be replaced by the id of the "
387
  "current user."
388
  msgstr ""
389
 
390
+ #: lib/wfu_constants.php:138
391
  msgid ""
392
  "Insert variable %username% inside text. It will be replaced by the username "
393
  "of the current user."
394
  msgstr ""
395
 
396
+ #: lib/wfu_constants.php:139
397
  msgid ""
398
  "Insert variable %useremail% inside text. It will be replaced by the email of "
399
  "the current user."
400
  msgstr ""
401
 
402
+ #: lib/wfu_constants.php:140
403
  msgid ""
404
  "Insert variable %filename% inside text. It will be replaced by the filename "
405
  "of the uploaded file."
406
  msgstr ""
407
 
408
+ #: lib/wfu_constants.php:141
409
  msgid ""
410
  "Insert variable %filepath% inside text. It will be replaced by the full "
411
  "filepath of the uploaded file."
412
  msgstr ""
413
 
414
+ #: lib/wfu_constants.php:142
415
  msgid ""
416
  "Insert variable %blogid% inside text. It will be replaced by the blog id of "
417
  "the website."
418
  msgstr ""
419
 
420
+ #: lib/wfu_constants.php:143
421
  msgid ""
422
  "Insert variable %pageid% inside text. It will be replaced by the id of the "
423
  "current page."
424
  msgstr ""
425
 
426
+ #: lib/wfu_constants.php:144
427
  msgid ""
428
  "Insert variable %pagetitle% inside text. It will be replaced by the title of "
429
  "the current page."
430
  msgstr ""
431
 
432
+ #: lib/wfu_constants.php:145
433
  msgid ""
434
  "Insert variable %userdataXXX% inside text. Select the user field from the "
435
  "drop-down list. It will be replaced by the value that the user entered in "
436
  "this field."
437
  msgstr ""
438
 
439
+ #: lib/wfu_constants.php:146
440
  msgid "Insert variable %n% inside text to denote a line change."
441
  msgstr ""
442
 
443
+ #: lib/wfu_constants.php:149
444
  msgid "Upload in progress"
445
  msgstr ""
446
 
447
+ #: lib/wfu_constants.php:150
448
  msgid "Upload in progress with warnings!"
449
  msgstr ""
450
 
451
+ #: lib/wfu_constants.php:151
452
  msgid "Upload in progress but some files already failed!"
453
  msgstr ""
454
 
455
+ #: lib/wfu_constants.php:152
456
  msgid "Upload in progress but no files uploaded so far!"
457
  msgstr ""
458
 
459
+ #: lib/wfu_constants.php:153
460
  msgid "All files uploaded successfully"
461
  msgstr ""
462
 
463
+ #: lib/wfu_constants.php:154
464
  msgid "All files uploaded successfully but there are warnings!"
465
  msgstr ""
466
 
467
+ #: lib/wfu_constants.php:155
468
  msgid "File uploaded successfully but there are warnings!"
469
  msgstr ""
470
 
471
+ #: lib/wfu_constants.php:156
472
  msgid "Some files failed to upload!"
473
  msgstr ""
474
 
475
+ #: lib/wfu_constants.php:157
476
  msgid "All files failed to upload"
477
  msgstr ""
478
 
479
+ #: lib/wfu_constants.php:158
480
  msgid "File failed to upload"
481
  msgstr ""
482
 
483
+ #: lib/wfu_constants.php:159
484
  msgid "There are no files to upload!"
485
  msgstr ""
486
 
487
+ #: lib/wfu_constants.php:160
488
  msgid "Test upload message"
489
  msgstr ""
490
 
491
+ #: lib/wfu_constants.php:161
492
  msgid "JSON parse warning!"
493
  msgstr ""
494
 
495
+ #: lib/wfu_constants.php:162
496
  msgid "please wait while redirecting..."
497
  msgstr ""
498
 
499
+ #: lib/wfu_constants.php:163
500
  msgid "Open visual shortcode editor in new window"
501
  msgstr ""
502
 
503
+ #: lib/wfu_constants.php:164
504
  msgid "loading visual editor"
505
  msgstr ""
lib/wfu_admin.php CHANGED
@@ -163,6 +163,19 @@ function wordpress_file_upload_manage_dashboard() {
163
  if ( wfu_check_edit_shortcode($data) ) wfu_shortcode_composer($data);
164
  else $echo_str = wfu_manage_mainmenu(WFU_DASHBOARD_EDIT_SHORTCODE_REJECTED);
165
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
166
  else {
167
  $echo_str = wfu_manage_mainmenu();
168
  }
@@ -200,7 +213,7 @@ function wfu_manage_mainmenu($message = '') {
200
  $echo_str .= "\n\t\t\t\t\t".'<th scope="row">';
201
  $echo_str .= "\n\t\t\t\t\t\t".'<label style="cursor:default;">Edition</label>';
202
  $echo_str .= "\n\t\t\t\t\t".'</th>';
203
- $echo_str .= "\n\t\t\t\t\t".'<td style="width:100px; vertical-align:top;">';
204
  $echo_str .= "\n\t\t\t\t\t\t".'<label style="font-weight:bold; cursor:default;">Free</label>';
205
  $echo_str .= "\n\t\t\t\t\t".'</td>';
206
  $echo_str .= "\n\t\t\t\t\t".'<td>';
@@ -219,11 +232,11 @@ function wfu_manage_mainmenu($message = '') {
219
  $echo_str .= "\n\t\t\t\t\t".'<th scope="row">';
220
  $echo_str .= "\n\t\t\t\t\t\t".'<label style="cursor:default;">Version</label>';
221
  $echo_str .= "\n\t\t\t\t\t".'</th>';
222
- $echo_str .= "\n\t\t\t\t\t".'<td style="width:100px; vertical-align:top;">';
223
  $cur_version = wfu_get_plugin_version();
224
  $echo_str .= "\n\t\t\t\t\t\t".'<label style="font-weight:bold; cursor:default;">'.$cur_version.'</label>';
225
  $echo_str .= "\n\t\t\t\t\t".'</td>';
226
- $echo_str .= "\n\t\t\t\t\t".'<td style="vertical-align:top;">';
227
  $lat_version = wfu_get_latest_version();
228
  $ret = wfu_compare_versions($cur_version, $lat_version);
229
  if ( $ret['status'] && $ret['result'] == 'lower' ) {
@@ -246,10 +259,21 @@ function wfu_manage_mainmenu($message = '') {
246
  $echo_str .= "\n\t\t\t\t\t".'<th scope="row">';
247
  $echo_str .= "\n\t\t\t\t\t\t".'<label style="cursor:default;">Server Environment</label>';
248
  $echo_str .= "\n\t\t\t\t\t".'</th>';
249
- $echo_str .= "\n\t\t\t\t\t".'<td style="width:100px; vertical-align:top;">';
250
- if ( $php_env == '64bit' ) $echo_str .= "\n\t\t\t\t\t\t".'<label style="font-weight:bold; cursor:default;">64bit</label></td><td style="vertical-align:top;"><label style="font-weight:normal; font-style:italic; cursor:default;">(Your server supports files up to 1 Exabyte, practically unlimited)</label>';
251
- if ( $php_env == '32bit' ) $echo_str .= "\n\t\t\t\t\t\t".'<label style="font-weight:bold; cursor:default;">32bit</label></td><td style="vertical-align:top;"><label style="font-weight:normal; font-style:italic; cursor:default;">(Your server does not support files larger than 2GB)</label>';
252
- if ( $php_env == '' ) $echo_str .= "\n\t\t\t\t\t\t".'<label style="font-weight:bold; cursor:default;">Unknown</label></td><td style="vertical-align:top;"><label style="font-weight:normal; font-style:italic; cursor:default;">(The maximum file size supported by the server cannot be determined)</label>';
 
 
 
 
 
 
 
 
 
 
 
253
  $echo_str .= "\n\t\t\t\t\t".'</td>';
254
  $echo_str .= "\n\t\t\t\t".'</tr>';
255
  $echo_str .= "\n\t\t\t".'</tbody>';
@@ -369,11 +393,42 @@ function wfu_replace_shortcode($data, $new_shortcode) {
369
  return ( wp_update_post( $new_post ) === 0 ? false : true );
370
  }
371
 
372
- function wfu_edit_shortcode($data, $message = '') {
373
- $echo_str = '';
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
374
  return $echo_str;
375
  }
376
 
 
 
 
 
 
 
 
 
 
 
 
 
 
377
  function wfu_manage_settings($message = '') {
378
  if ( !current_user_can( 'manage_options' ) ) return wfu_shortcode_composer();
379
 
@@ -411,6 +466,24 @@ function wfu_manage_settings($message = '') {
411
  $echo_str .= "\n\t\t\t\t\t\t\t".'<p style="cursor: text; font-size:9px; padding: 0px; margin: 0px; width: 95%; color: #AAAAAA;">Current value: <strong>'.$plugin_options['basedir'].'</strong></p>';
412
  $echo_str .= "\n\t\t\t\t\t\t".'</td>';
413
  $echo_str .= "\n\t\t\t\t\t".'</tr>';
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
414
  $echo_str .= "\n\t\t\t\t".'</tbody>';
415
  $echo_str .= "\n\t\t\t".'</table>';
416
  $echo_str .= "\n\t\t\t".'<p class="submit">';
@@ -431,12 +504,14 @@ function wfu_update_settings() {
431
 
432
  // $enabled = ( isset($_POST['wfu_enabled']) ? ( $_POST['wfu_enabled'] == "on" ? 1 : 0 ) : 0 );
433
  $hashfiles = ( isset($_POST['wfu_hashfiles']) ? ( $_POST['wfu_hashfiles'] == "on" ? 1 : 0 ) : 0 );
434
- if ( isset($_POST['wfu_basedir']) && isset($_POST['submit']) ) {
435
  if ( $_POST['submit'] == "Update" ) {
436
  $new_plugin_options['version'] = '1.0';
437
  $new_plugin_options['shortcode'] = $plugin_options['shortcode'];
438
  $new_plugin_options['hashfiles'] = $hashfiles;
439
  $new_plugin_options['basedir'] = $_POST['wfu_basedir'];
 
 
440
  $encoded_options = wfu_encode_plugin_options($new_plugin_options);
441
  update_option( "wordpress_file_upload_options", $encoded_options );
442
  if ( $new_plugin_options['hashfiles'] == '1' && $plugin_options['hashfiles'] != '1' )
163
  if ( wfu_check_edit_shortcode($data) ) wfu_shortcode_composer($data);
164
  else $echo_str = wfu_manage_mainmenu(WFU_DASHBOARD_EDIT_SHORTCODE_REJECTED);
165
  }
166
+ elseif ( $action == 'delete_shortcode' && $data_enc != "" ) {
167
+ $data = wfu_decode_array_from_string($data_enc);
168
+ if ( wfu_check_edit_shortcode($data) ) $echo_str = wfu_delete_shortcode_prompt($data);
169
+ else $echo_str = wfu_manage_mainmenu(WFU_DASHBOARD_DELETE_SHORTCODE_REJECTED);
170
+ }
171
+ elseif ( $action == 'deleteshortcode' && $data_enc != "" ) {
172
+ $data = wfu_decode_array_from_string($data_enc);
173
+ if ( wfu_check_edit_shortcode($data) ) {
174
+ wfu_delete_shortcode($data);
175
+ $echo_str = wfu_manage_mainmenu();
176
+ }
177
+ else $echo_str = wfu_manage_mainmenu(WFU_DASHBOARD_DELETE_SHORTCODE_REJECTED);
178
+ }
179
  else {
180
  $echo_str = wfu_manage_mainmenu();
181
  }
213
  $echo_str .= "\n\t\t\t\t\t".'<th scope="row">';
214
  $echo_str .= "\n\t\t\t\t\t\t".'<label style="cursor:default;">Edition</label>';
215
  $echo_str .= "\n\t\t\t\t\t".'</th>';
216
+ $echo_str .= "\n\t\t\t\t\t".'<td style="width:100px;">';
217
  $echo_str .= "\n\t\t\t\t\t\t".'<label style="font-weight:bold; cursor:default;">Free</label>';
218
  $echo_str .= "\n\t\t\t\t\t".'</td>';
219
  $echo_str .= "\n\t\t\t\t\t".'<td>';
232
  $echo_str .= "\n\t\t\t\t\t".'<th scope="row">';
233
  $echo_str .= "\n\t\t\t\t\t\t".'<label style="cursor:default;">Version</label>';
234
  $echo_str .= "\n\t\t\t\t\t".'</th>';
235
+ $echo_str .= "\n\t\t\t\t\t".'<td style="width:100px;">';
236
  $cur_version = wfu_get_plugin_version();
237
  $echo_str .= "\n\t\t\t\t\t\t".'<label style="font-weight:bold; cursor:default;">'.$cur_version.'</label>';
238
  $echo_str .= "\n\t\t\t\t\t".'</td>';
239
+ $echo_str .= "\n\t\t\t\t\t".'<td>';
240
  $lat_version = wfu_get_latest_version();
241
  $ret = wfu_compare_versions($cur_version, $lat_version);
242
  if ( $ret['status'] && $ret['result'] == 'lower' ) {
259
  $echo_str .= "\n\t\t\t\t\t".'<th scope="row">';
260
  $echo_str .= "\n\t\t\t\t\t\t".'<label style="cursor:default;">Server Environment</label>';
261
  $echo_str .= "\n\t\t\t\t\t".'</th>';
262
+ $echo_str .= "\n\t\t\t\t\t".'<td style="width:100px;">';
263
+ if ( $php_env == '64bit' ) $echo_str .= "\n\t\t\t\t\t\t".'<label style="font-weight:bold; cursor:default;">64bit</label></td><td><label style="font-weight:normal; font-style:italic; cursor:default;">(Your server supports files up to 1 Exabyte, practically unlimited)</label>';
264
+ if ( $php_env == '32bit' ) $echo_str .= "\n\t\t\t\t\t\t".'<label style="font-weight:bold; cursor:default;">32bit</label></td><td><label style="font-weight:normal; font-style:italic; cursor:default;">(Your server does not support files larger than 2GB)</label>';
265
+ if ( $php_env == '' ) $echo_str .= "\n\t\t\t\t\t\t".'<label style="font-weight:bold; cursor:default;">Unknown</label></td><td><label style="font-weight:normal; font-style:italic; cursor:default;">(The maximum file size supported by the server cannot be determined)</label>';
266
+ $echo_str .= "\n\t\t\t\t\t".'</td>';
267
+ $echo_str .= "\n\t\t\t\t".'</tr>';
268
+ $echo_str .= "\n\t\t\t\t".'<tr class="form-field">';
269
+ $echo_str .= "\n\t\t\t\t\t".'<th scope="row">';
270
+ $echo_str .= "\n\t\t\t\t\t\t".'<label style="cursor:default;">Release Notes</label>';
271
+ $echo_str .= "\n\t\t\t\t\t".'</th>';
272
+ $echo_str .= "\n\t\t\t\t\t".'<td colspan="2" style="width:100px;">';
273
+ $rel_path = ABSWPFILEUPLOAD_DIR.'release_notes.txt';
274
+ $rel_notes = '';
275
+ if ( file_exists($rel_path) ) $rel_notes = file_get_contents($rel_path);
276
+ $echo_str .= "\n\t\t\t\t\t\t".'<div style="text-align:justify;">'.$rel_notes.'</div>';
277
  $echo_str .= "\n\t\t\t\t\t".'</td>';
278
  $echo_str .= "\n\t\t\t\t".'</tr>';
279
  $echo_str .= "\n\t\t\t".'</tbody>';
393
  return ( wp_update_post( $new_post ) === 0 ? false : true );
394
  }
395
 
396
+ function wfu_delete_shortcode_prompt($data) {
397
+ $siteurl = site_url();
398
+ $postid = $data['post_id'];
399
+ $data_enc = wfu_encode_array_to_string($data);
400
+ $echo_str = "\n".'<div class="wrap">';
401
+ $echo_str .= "\n\t".'<h2>Wordpress File Upload Control Panel</h2>';
402
+ $echo_str .= "\n\t".'<div style="margin-top:20px;">';
403
+ $echo_str .= "\n\t\t".'<a href="'.$siteurl.'/wp-admin/options-general.php?page=wordpress_file_upload&amp;action=manage_mainmenu" class="button" title="go back">Go to Main Menu</a>';
404
+ $echo_str .= "\n\t".'</div>';
405
+ $echo_str .= "\n\t".'<h2 style="margin-bottom: 10px; margin-top: 20px;">Delete Shortcode</h2>';
406
+ $echo_str .= "\n\t".'<form enctype="multipart/form-data" name="deletefile" id="deleteshortcode" method="post" action="'.$siteurl.'/wp-admin/options-general.php?page=wordpress_file_upload" class="validate">';
407
+ $echo_str .= "\n\t\t".'<input type="hidden" name="action" value="deleteshortcode">';
408
+ $echo_str .= "\n\t\t".'<input type="hidden" name="data" value="'.$data_enc.'">';
409
+ $echo_str .= "\n\t\t".'<label>Are you sure that you want to delete shortcode for <strong>'.get_post_type($postid).' "'.get_the_title($postid).'" ('.$postid.') Position '.$data['position'].'</strong> ?</label><br/>';
410
+ $echo_str .= "\n\t\t".'<p class="submit">';
411
+ $echo_str .= "\n\t\t\t".'<input type="submit" class="button-primary" name="submit" value="Delete">';
412
+ $echo_str .= "\n\t\t\t".'<input type="submit" class="button-primary" name="submit" value="Cancel">';
413
+ $echo_str .= "\n\t\t".'</p>';
414
+ $echo_str .= "\n\t".'</form>';
415
+ $echo_str .= "\n".'</div>';
416
  return $echo_str;
417
  }
418
 
419
+ function wfu_delete_shortcode($data) {
420
+ //check if user is allowed to perform this action
421
+ if ( !current_user_can( 'manage_options' ) ) return false;
422
+
423
+ $res = true;
424
+ if ( isset($_POST['submit']) ) {
425
+ if ( $_POST['submit'] == "Delete" ) {
426
+ $res = wfu_replace_shortcode($data, '');
427
+ }
428
+ }
429
+ return $res;
430
+ }
431
+
432
  function wfu_manage_settings($message = '') {
433
  if ( !current_user_can( 'manage_options' ) ) return wfu_shortcode_composer();
434
 
466
  $echo_str .= "\n\t\t\t\t\t\t\t".'<p style="cursor: text; font-size:9px; padding: 0px; margin: 0px; width: 95%; color: #AAAAAA;">Current value: <strong>'.$plugin_options['basedir'].'</strong></p>';
467
  $echo_str .= "\n\t\t\t\t\t\t".'</td>';
468
  $echo_str .= "\n\t\t\t\t\t".'</tr>';
469
+ $echo_str .= "\n\t\t\t\t\t".'<tr class="form-field">';
470
+ $echo_str .= "\n\t\t\t\t\t\t".'<th scope="row">';
471
+ $echo_str .= "\n\t\t\t\t\t\t\t".'<label for="wfu_captcha_sitekey">Google ReCaptcha Site Key</label>';
472
+ $echo_str .= "\n\t\t\t\t\t\t".'</th>';
473
+ $echo_str .= "\n\t\t\t\t\t\t".'<td>';
474
+ $echo_str .= "\n\t\t\t\t\t\t\t".'<input name="wfu_captcha_sitekey" id="wfu_captcha_sitekey" type="text" value="'.$plugin_options['captcha_sitekey'].'" />';
475
+ $echo_str .= "\n\t\t\t\t\t\t\t".'<p style="cursor: text; font-size:9px; padding: 0px; margin: 0px; width: 95%; color: #AAAAAA;">Current value: <strong>'.$plugin_options['captcha_sitekey'].'</strong></p>';
476
+ $echo_str .= "\n\t\t\t\t\t\t".'</td>';
477
+ $echo_str .= "\n\t\t\t\t\t".'</tr>';
478
+ $echo_str .= "\n\t\t\t\t\t".'<tr class="form-field">';
479
+ $echo_str .= "\n\t\t\t\t\t\t".'<th scope="row">';
480
+ $echo_str .= "\n\t\t\t\t\t\t\t".'<label for="wfu_captcha_secretkey">Google ReCaptcha Secret Key</label>';
481
+ $echo_str .= "\n\t\t\t\t\t\t".'</th>';
482
+ $echo_str .= "\n\t\t\t\t\t\t".'<td>';
483
+ $echo_str .= "\n\t\t\t\t\t\t\t".'<input name="wfu_captcha_secretkey" id="wfu_captcha_secretkey" type="text" value="'.$plugin_options['captcha_secretkey'].'" />';
484
+ $echo_str .= "\n\t\t\t\t\t\t\t".'<p style="cursor: text; font-size:9px; padding: 0px; margin: 0px; width: 95%; color: #AAAAAA;">Current value: <strong>'.$plugin_options['captcha_secretkey'].'</strong></p>';
485
+ $echo_str .= "\n\t\t\t\t\t\t".'</td>';
486
+ $echo_str .= "\n\t\t\t\t\t".'</tr>';
487
  $echo_str .= "\n\t\t\t\t".'</tbody>';
488
  $echo_str .= "\n\t\t\t".'</table>';
489
  $echo_str .= "\n\t\t\t".'<p class="submit">';
504
 
505
  // $enabled = ( isset($_POST['wfu_enabled']) ? ( $_POST['wfu_enabled'] == "on" ? 1 : 0 ) : 0 );
506
  $hashfiles = ( isset($_POST['wfu_hashfiles']) ? ( $_POST['wfu_hashfiles'] == "on" ? 1 : 0 ) : 0 );
507
+ if ( isset($_POST['wfu_basedir']) && isset($_POST['wfu_captcha_sitekey']) && isset($_POST['wfu_captcha_secretkey']) && isset($_POST['submit']) ) {
508
  if ( $_POST['submit'] == "Update" ) {
509
  $new_plugin_options['version'] = '1.0';
510
  $new_plugin_options['shortcode'] = $plugin_options['shortcode'];
511
  $new_plugin_options['hashfiles'] = $hashfiles;
512
  $new_plugin_options['basedir'] = $_POST['wfu_basedir'];
513
+ $new_plugin_options['captcha_sitekey'] = $_POST['wfu_captcha_sitekey'];
514
+ $new_plugin_options['captcha_secretkey'] = $_POST['wfu_captcha_secretkey'];
515
  $encoded_options = wfu_encode_plugin_options($new_plugin_options);
516
  update_option( "wordpress_file_upload_options", $encoded_options );
517
  if ( $new_plugin_options['hashfiles'] == '1' && $plugin_options['hashfiles'] != '1' )
lib/wfu_admin_composer.php CHANGED
@@ -32,11 +32,13 @@ function wfu_shortcode_composer($data = '') {
32
  }
33
 
34
  $shortcode_attrs = wfu_shortcode_string_to_array($shortcode);
 
35
  foreach ( $defs as $key => $def ) {
36
  $defs[$key]['default'] = $def['value'];
37
  if ( array_key_exists($def['attribute'], $shortcode_attrs) ) {
38
  $defs[$key]['value'] = $shortcode_attrs[$def['attribute']];
39
  }
 
40
  }
41
 
42
  // index $components
@@ -59,7 +61,7 @@ function wfu_shortcode_composer($data = '') {
59
  $echo_str .= "\n\t".'<div style="margin-top:20px;">';
60
  if ( current_user_can( 'manage_options' ) ) $echo_str .= "\n\t".'<a href="'.$siteurl.'/wp-admin/options-general.php?page=wordpress_file_upload&amp;action=manage_mainmenu" class="button" title="go back">Go to Main Menu</a>';
61
  $echo_str .= "\n\t".'</div>';
62
- $echo_str .= "\n\t".'<h2 style="margin-bottom: 10px; margin-top: 20px;">Shortcode Composer for '.( $data == "" ? 'Test' : $posttype.' "'.$postname.'" ('.$postid.') Position '.$data['position'] ).'</h2>';
63
  $echo_str .= "\n\t".'<div style="margin-top:10px; display:inline-block;">';
64
  if ( $data != "") $echo_str .= "\n\t\t".'<input id="wfu_update_shortcode" type="button" value="Update" class="button-primary" disabled="disabled" onclick="wfu_save_shortcode()" /><span id="wfu_update_shortcode_wait" class="spinner" style="float:right; display:none;"></span>';
65
  $echo_str .= "\n\t\t".'<input id="wfu_shortcode_original_enc" type="hidden" value="'.wfu_plugin_encode_string($shortcode_full).'" />';
32
  }
33
 
34
  $shortcode_attrs = wfu_shortcode_string_to_array($shortcode);
35
+ $shortcode_id = '';
36
  foreach ( $defs as $key => $def ) {
37
  $defs[$key]['default'] = $def['value'];
38
  if ( array_key_exists($def['attribute'], $shortcode_attrs) ) {
39
  $defs[$key]['value'] = $shortcode_attrs[$def['attribute']];
40
  }
41
+ if ( $def['attribute'] == 'uploadid' ) $shortcode_id = $defs[$key]['value'];
42
  }
43
 
44
  // index $components
61
  $echo_str .= "\n\t".'<div style="margin-top:20px;">';
62
  if ( current_user_can( 'manage_options' ) ) $echo_str .= "\n\t".'<a href="'.$siteurl.'/wp-admin/options-general.php?page=wordpress_file_upload&amp;action=manage_mainmenu" class="button" title="go back">Go to Main Menu</a>';
63
  $echo_str .= "\n\t".'</div>';
64
+ $echo_str .= "\n\t".'<h2 style="margin-bottom: 10px; margin-top: 20px;">Shortcode Composer for '.( $data == "" ? 'Test' : $posttype.' "'.$postname.'" ('.$postid.') Position '.$data['position'] ).' with ID '.$shortcode_id.'</h2>';
65
  $echo_str .= "\n\t".'<div style="margin-top:10px; display:inline-block;">';
66
  if ( $data != "") $echo_str .= "\n\t\t".'<input id="wfu_update_shortcode" type="button" value="Update" class="button-primary" disabled="disabled" onclick="wfu_save_shortcode()" /><span id="wfu_update_shortcode_wait" class="spinner" style="float:right; display:none;"></span>';
67
  $echo_str .= "\n\t\t".'<input id="wfu_shortcode_original_enc" type="hidden" value="'.wfu_plugin_encode_string($shortcode_full).'" />';
lib/wfu_attributes.php CHANGED
@@ -206,7 +206,7 @@ function wfu_attribute_definitions() {
206
  "category" => "general",
207
  "subcategory" => "Upload Path and Files",
208
  "parent" => "",
209
- "dependencies" => array("ftpinfo", "userftpdomain"),
210
  "variables" => null,
211
  "help" => "Some times files cannot be uploaded to the upload folder because of read/write permissions. A workaround is to use ftp to transfer the files, however ftp credentials must be declared, so use carefully and only if necessary."
212
  ),
206
  "category" => "general",
207
  "subcategory" => "Upload Path and Files",
208
  "parent" => "",
209
+ "dependencies" => array("ftpinfo", "userftpdomain", "ftppassivemode", "ftpfilepermissions"),
210
  "variables" => null,
211
  "help" => "Some times files cannot be uploaded to the upload folder because of read/write permissions. A workaround is to use ftp to transfer the files, however ftp credentials must be declared, so use carefully and only if necessary."
212
  ),
lib/wfu_blocks.php CHANGED
@@ -124,9 +124,9 @@ function wfu_prepare_uploadform_block($params, $widths, $heights, $clickaction,
124
  if ( $params["testmode"] == "true" ) $uploadform_item["line".$i++] = "\t".'<input align="center" type="button" id="'.$input.'" value="'.$label.'" class="file_input_button"'.$styles.' onmouseout="javascript: document.getElementById(\''.$input.'\').className = \'file_input_button\'" onmouseover="javascript: document.getElementById(\''.$input.'\').className = \'file_input_button_hover\'" onclick="alert(\''.WFU_NOTIFY_TESTMODE.'\');" />';
125
  else $uploadform_item["line".$i++] = "\t".'<input align="center" type="button" id="'.$input.'" value="'.$label.'" class="file_input_button"'.$styles.'/>';
126
  if ( $params["singlebutton"] == "true" )
127
- $uploadform_item["line".$i++] = "\t".'<input type="file" class="file_input_hidden" name="'.$uploadedfile.'" id="'.$upfile.'" tabindex="1" onchange="wfu_selectbutton_changed('.$sid.', '.$usefilearray.'); if (this.value != \'\') {'.$clickaction.'}" onmouseout="javascript: document.getElementById(\''.$input.'\').className = \'file_input_button\'" onmouseover="javascript: document.getElementById(\''.$input.'\').className = \'file_input_button_hover\'" onclick="wfu_selectbutton_clicked('.$sid.');"'.' />';
128
  else
129
- $uploadform_item["line".$i++] = "\t".'<input type="file" class="file_input_hidden" name="'.$uploadedfile.'" id="'.$upfile.'" tabindex="1" onchange="wfu_selectbutton_changed('.$sid.', '.$usefilearray.');" onmouseout="javascript: document.getElementById(\''.$input.'\').className = \'file_input_button\'" onmouseover="javascript: document.getElementById(\''.$input.'\').className = \'file_input_button_hover\'" onclick="wfu_selectbutton_clicked('.$sid.');"'.' />';
130
  $uploadform_item["line".$i++] = "\t".'<input type="hidden" id="hiddeninput_'.$sid.'" name="hiddeninput_'.$sid.'" value="" />';
131
  $uploadform_item["line".$i++] = "\t".'<input type="hidden" id="uniqueuploadid_'.$sid.'" name="uniqueuploadid_'.$sid.'" value="" />';
132
  $uploadform_item["line".$i++] = "\t".'<input type="hidden" id="adminerrorcodes_'.$sid.'" name="adminerrorcodes_'.$sid.'" value="" />';
@@ -151,7 +151,7 @@ function wfu_prepare_submit_block($params, $widths, $heights, $clickaction) {
151
  if ( $heights["uploadbutton"] != "" ) $styles .= 'height: '.$heights["uploadbutton"].'; ';
152
  if ( $styles != "" ) $styles = ' style="'.$styles.'"';
153
  if ( $params["testmode"] == "true" ) $submit_item["line1"] = '<input align="center" type="button" id="'.$upload.'" name="'.$upload.'" value="'.$default.'" class="file_input_submit" onclick="alert(\''.WFU_NOTIFY_TESTMODE.'\');"'.$styles.' />';
154
- else $submit_item["line1"] = '<input align="center" type="button" id="'.$upload.'" name="'.$upload.'" value="'.$default.'" class="file_input_submit" onclick="'.$clickaction.'"'.$styles.' />';
155
  $submit_item["line2"] = '<input type="hidden" id="'.$upload.'_default" value="'.$default.'" />';
156
 
157
  return $submit_item;
124
  if ( $params["testmode"] == "true" ) $uploadform_item["line".$i++] = "\t".'<input align="center" type="button" id="'.$input.'" value="'.$label.'" class="file_input_button"'.$styles.' onmouseout="javascript: document.getElementById(\''.$input.'\').className = \'file_input_button\'" onmouseover="javascript: document.getElementById(\''.$input.'\').className = \'file_input_button_hover\'" onclick="alert(\''.WFU_NOTIFY_TESTMODE.'\');" />';
125
  else $uploadform_item["line".$i++] = "\t".'<input align="center" type="button" id="'.$input.'" value="'.$label.'" class="file_input_button"'.$styles.'/>';
126
  if ( $params["singlebutton"] == "true" )
127
+ $uploadform_item["line".$i++] = "\t".'<input type="file" class="file_input_hidden" name="'.$uploadedfile.'" id="'.$upfile.'" tabindex="1" onchange="wfu_selectbutton_changed('.$sid.', '.$usefilearray.'); wfu_update_uploadbutton_status('.$sid.'); if (this.value != \'\') {'.$clickaction.'}" onmouseout="javascript: document.getElementById(\''.$input.'\').className = \'file_input_button\'" onmouseover="javascript: document.getElementById(\''.$input.'\').className = \'file_input_button_hover\'" onclick="wfu_selectbutton_clicked('.$sid.');"'.' />';
128
  else
129
+ $uploadform_item["line".$i++] = "\t".'<input type="file" class="file_input_hidden" name="'.$uploadedfile.'" id="'.$upfile.'" tabindex="1" onchange="wfu_selectbutton_changed('.$sid.', '.$usefilearray.'); wfu_update_uploadbutton_status('.$sid.');" onmouseout="javascript: document.getElementById(\''.$input.'\').className = \'file_input_button\'" onmouseover="javascript: document.getElementById(\''.$input.'\').className = \'file_input_button_hover\'" onclick="wfu_selectbutton_clicked('.$sid.');"'.' />';
130
  $uploadform_item["line".$i++] = "\t".'<input type="hidden" id="hiddeninput_'.$sid.'" name="hiddeninput_'.$sid.'" value="" />';
131
  $uploadform_item["line".$i++] = "\t".'<input type="hidden" id="uniqueuploadid_'.$sid.'" name="uniqueuploadid_'.$sid.'" value="" />';
132
  $uploadform_item["line".$i++] = "\t".'<input type="hidden" id="adminerrorcodes_'.$sid.'" name="adminerrorcodes_'.$sid.'" value="" />';
151
  if ( $heights["uploadbutton"] != "" ) $styles .= 'height: '.$heights["uploadbutton"].'; ';
152
  if ( $styles != "" ) $styles = ' style="'.$styles.'"';
153
  if ( $params["testmode"] == "true" ) $submit_item["line1"] = '<input align="center" type="button" id="'.$upload.'" name="'.$upload.'" value="'.$default.'" class="file_input_submit" onclick="alert(\''.WFU_NOTIFY_TESTMODE.'\');"'.$styles.' />';
154
+ else $submit_item["line1"] = '<input align="center" type="button" id="'.$upload.'" name="'.$upload.'" value="'.$default.'" class="file_input_submit" onclick="'.$clickaction.'"'.$styles.' disabled="disabled" />';
155
  $submit_item["line2"] = '<input type="hidden" id="'.$upload.'_default" value="'.$default.'" />';
156
 
157
  return $submit_item;
lib/wfu_constants.php CHANGED
@@ -128,6 +128,7 @@ DEFINE("WFU_TESTMESSAGE_FILE2_ADMINMESSAGE", __('File testfile 2 administrator m
128
 
129
  //define admin area messages
130
  DEFINE("WFU_DASHBOARD_EDIT_SHORTCODE_REJECTED", __("Failed to edit the shortcode because the contents of the page changed. Try again to edit the shortcode.", "wordpress-file-upload"));
 
131
  DEFINE("WFU_DASHBOARD_PAGE_OBSOLETE", __("The page containing the shortcode has been modified and it is no longer valid. Please go back to reload the shortcode.", "wordpress-file-upload"));
132
  DEFINE("WFU_DASHBOARD_UPDATE_SHORTCODE_REJECTED", __("Failed to update the shortcode because the contents of the page changed. Go back to reload the shortcode.", "wordpress-file-upload"));
133
  DEFINE("WFU_DASHBOARD_UPDATE_SHORTCODE_FAILED", __("Failed to update the shortcode. Please try again. If the problem persists, go back and reload the shortcode.", "wordpress-file-upload"));
128
 
129
  //define admin area messages
130
  DEFINE("WFU_DASHBOARD_EDIT_SHORTCODE_REJECTED", __("Failed to edit the shortcode because the contents of the page changed. Try again to edit the shortcode.", "wordpress-file-upload"));
131
+ DEFINE("WFU_DASHBOARD_DELETE_SHORTCODE_REJECTED", __("Failed to delete the shortcode because the contents of the page changed. Try again to delete it.", "wordpress-file-upload"));
132
  DEFINE("WFU_DASHBOARD_PAGE_OBSOLETE", __("The page containing the shortcode has been modified and it is no longer valid. Please go back to reload the shortcode.", "wordpress-file-upload"));
133
  DEFINE("WFU_DASHBOARD_UPDATE_SHORTCODE_REJECTED", __("Failed to update the shortcode because the contents of the page changed. Go back to reload the shortcode.", "wordpress-file-upload"));
134
  DEFINE("WFU_DASHBOARD_UPDATE_SHORTCODE_FAILED", __("Failed to update the shortcode. Please try again. If the problem persists, go back and reload the shortcode.", "wordpress-file-upload"));
lib/wfu_functions.php CHANGED
@@ -122,39 +122,39 @@ function wfu_sanitize($var) {
122
  return $typ;
123
  }
124
 
125
- function wfu_shortcode_string_to_array($shortcode) {
126
- function _wfu_preg_replace_callback_alt($contents, $token) {
127
- $in_block = false;
128
- $prev_pos = 0;
129
- $new_contents = '';
130
- $ret['items'] = array();
131
- $ret['tokens'] = array();
132
- $ii = 0;
133
- while ( ($pos = strpos($contents, '"', $prev_pos)) !== false ) {
134
- if ( !$in_block ) {
135
- $new_contents .= substr($contents, $prev_pos, $pos - $prev_pos + 1);
136
- $in_block = true;
137
- }
138
- else {
139
- $ret['items'][$ii] = substr($contents, $prev_pos, $pos - $prev_pos);
140
- $ret['tokens'][$ii] = $token.sprintf('%03d', $ii);
141
- $new_contents .= $token.sprintf('%03d', $ii).'"';
142
- $ii ++;
143
- $in_block = false;
144
- }
145
- $prev_pos = $pos + 1;
146
  }
147
- if ( $in_block ) {
148
- $ret['items'][$ii] = substr($contents, $prev_pos);
149
  $ret['tokens'][$ii] = $token.sprintf('%03d', $ii);
150
  $new_contents .= $token.sprintf('%03d', $ii).'"';
 
 
151
  }
152
- else
153
- $new_contents .= substr($contents, $prev_pos);
154
- $ret['contents'] = $new_contents;
155
- return $ret;
 
 
156
  }
 
 
 
 
 
157
 
 
158
  $i = 0;
159
  $m1 = array();
160
  $m2 = array();
@@ -234,7 +234,9 @@ function wfu_encode_plugin_options($plugin_options) {
234
  $encoded_options = 'version='.$plugin_options['version'].';';
235
  $encoded_options .= 'shortcode='.wfu_plugin_encode_string($plugin_options['shortcode']).';';
236
  $encoded_options .= 'hashfiles='.$plugin_options['hashfiles'].';';
237
- $encoded_options .= 'basedir='.wfu_plugin_encode_string($plugin_options['basedir']);
 
 
238
  return $encoded_options;
239
  }
240
 
@@ -244,7 +246,7 @@ function wfu_decode_plugin_options($encoded_options) {
244
  foreach ($decoded_array as $decoded_item) {
245
  if ( trim($decoded_item) != "" ) {
246
  list($item_key, $item_value) = explode("=", $decoded_item, 2);
247
- if ( $item_key == 'shortcode' || $item_key == 'basedir' )
248
  $plugin_options[$item_key] = wfu_plugin_decode_string($item_value);
249
  else
250
  $plugin_options[$item_key] = $item_value;
@@ -1130,14 +1132,18 @@ function wfu_process_media_insert($file_path, $page_id){
1130
 
1131
  //********************* POST/GET Requests Functions ****************************************************************************************************
1132
 
1133
- function wfu_post_request($url, $params) {
1134
- $context_params = array(
1135
- 'http' => array(
1136
- 'method' => 'POST',
1137
- 'header' => 'Content-type: application/x-www-form-urlencoded',
1138
- 'content' => http_build_query($params)
1139
- )
1140
  );
 
 
 
 
 
1141
  $context = stream_context_create($context_params);
1142
  return file_get_contents($url, false, $context);
1143
  }
122
  return $typ;
123
  }
124
 
125
+ function _wfu_preg_replace_callback_alt($contents, $token) {
126
+ $in_block = false;
127
+ $prev_pos = 0;
128
+ $new_contents = '';
129
+ $ret['items'] = array();
130
+ $ret['tokens'] = array();
131
+ $ii = 0;
132
+ while ( ($pos = strpos($contents, '"', $prev_pos)) !== false ) {
133
+ if ( !$in_block ) {
134
+ $new_contents .= substr($contents, $prev_pos, $pos - $prev_pos + 1);
135
+ $in_block = true;
 
 
 
 
 
 
 
 
 
 
136
  }
137
+ else {
138
+ $ret['items'][$ii] = substr($contents, $prev_pos, $pos - $prev_pos);
139
  $ret['tokens'][$ii] = $token.sprintf('%03d', $ii);
140
  $new_contents .= $token.sprintf('%03d', $ii).'"';
141
+ $ii ++;
142
+ $in_block = false;
143
  }
144
+ $prev_pos = $pos + 1;
145
+ }
146
+ if ( $in_block ) {
147
+ $ret['items'][$ii] = substr($contents, $prev_pos);
148
+ $ret['tokens'][$ii] = $token.sprintf('%03d', $ii);
149
+ $new_contents .= $token.sprintf('%03d', $ii).'"';
150
  }
151
+ else
152
+ $new_contents .= substr($contents, $prev_pos);
153
+ $ret['contents'] = $new_contents;
154
+ return $ret;
155
+ }
156
 
157
+ function wfu_shortcode_string_to_array($shortcode) {
158
  $i = 0;
159
  $m1 = array();
160
  $m2 = array();
234
  $encoded_options = 'version='.$plugin_options['version'].';';
235
  $encoded_options .= 'shortcode='.wfu_plugin_encode_string($plugin_options['shortcode']).';';
236
  $encoded_options .= 'hashfiles='.$plugin_options['hashfiles'].';';
237
+ $encoded_options .= 'basedir='.wfu_plugin_encode_string($plugin_options['basedir']).';';
238
+ $encoded_options .= 'captcha_sitekey='.wfu_plugin_encode_string($plugin_options['captcha_sitekey']).';';
239
+ $encoded_options .= 'captcha_secretkey='.wfu_plugin_encode_string($plugin_options['captcha_secretkey']);
240
  return $encoded_options;
241
  }
242
 
246
  foreach ($decoded_array as $decoded_item) {
247
  if ( trim($decoded_item) != "" ) {
248
  list($item_key, $item_value) = explode("=", $decoded_item, 2);
249
+ if ( $item_key == 'shortcode' || $item_key == 'basedir' || $item_key == 'captcha_sitekey' || $item_key == 'captcha_secretkey' )
250
  $plugin_options[$item_key] = wfu_plugin_decode_string($item_value);
251
  else
252
  $plugin_options[$item_key] = $item_value;
1132
 
1133
  //********************* POST/GET Requests Functions ****************************************************************************************************
1134
 
1135
+ function wfu_post_request($url, $params, $verifypeer = false) {
1136
+ $peer_key = version_compare(PHP_VERSION, '5.6.0', '<') ? 'CN_name' : 'peer_name';
1137
+ $http_array = array(
1138
+ 'method' => 'POST',
1139
+ 'header' => "Content-type: application/x-www-form-urlencoded\r\n",
1140
+ 'content' => http_build_query($params)
 
1141
  );
1142
+ if ( $verifypeer ) {
1143
+ $http_array['verify_peer'] = true;
1144
+ $http_array[$peer_key] = 'www.google.com';
1145
+ }
1146
+ $context_params = array( 'http' => $http_array );
1147
  $context = stream_context_create($context_params);
1148
  return file_get_contents($url, false, $context);
1149
  }
readme.txt CHANGED
@@ -3,7 +3,7 @@ Contributors: nickboss
3
  Donate link: http://www.iptanus.com/support/wordpress-file-upload
4
  Tags: upload, upload file, upload files, multiple, multiple upload, multiple uploads, captcha, progress bar, form, ajax, directory, HTML5, filelist, gallery, image gallery, browser, file browser, gallery, image gallery, shortcode, logging, file logging
5
  Requires at least: 2.9.2
6
- Tested up to: 4.1.1
7
  Stable tag: "trunk"
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
@@ -116,6 +116,10 @@ In the free version the upload will fail. However in the Pro version the upload
116
 
117
  == Changelog ==
118
 
 
 
 
 
119
  = 2.6.0 =
120
  * full redesign of the upload algorithm to become more robust
121
  * added improved server-side handling of large files
@@ -382,6 +386,9 @@ Initial version.
382
 
383
  == Upgrade Notice ==
384
 
 
 
 
385
  = 2.6.0 =
386
  Important upgrade to add new features and address some bugs.
387
 
3
  Donate link: http://www.iptanus.com/support/wordpress-file-upload
4
  Tags: upload, upload file, upload files, multiple, multiple upload, multiple uploads, captcha, progress bar, form, ajax, directory, HTML5, filelist, gallery, image gallery, browser, file browser, gallery, image gallery, shortcode, logging, file logging
5
  Requires at least: 2.9.2
6
+ Tested up to: 4.2.1
7
  Stable tag: "trunk"
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
116
 
117
  == Changelog ==
118
 
119
+ = 2.7.0 =
120
+ * corrected bug when deleting plugin instance from the Dashboard
121
+ * corrected bug not finding "loading_icon.gif"
122
+
123
  = 2.6.0 =
124
  * full redesign of the upload algorithm to become more robust
125
  * added improved server-side handling of large files
386
 
387
  == Upgrade Notice ==
388
 
389
+ = 2.7.0 =
390
+ Upgrade to address some minor bugs.
391
+
392
  = 2.6.0 =
393
  Important upgrade to add new features and address some bugs.
394
 
release_notes.txt ADDED
@@ -0,0 +1 @@
 
1
+ <span>Professional version 2.6.0 of the plugin has introduced <strong>Google Recaptcha version 2</strong>. This is an easier and safer captcha, than the previously one used (Google Recaptcha version 1). Google Recaptcha version 2 is the default captcha selected, however you need to define </span><span style="text-decoration:underline;">site and secret keys</span><span> for your domain in the plugin's settings from </span><a href="https://www.google.com/recaptcha/admin">Google Recaptcha website</a><span>. To do this, you need to have a Google account. If you do not have a Google account, then you can use the alternative Google Recaptcha version 2 captcha, which does not require any keys or accounts, by setting </span><span style="background-color:rgb(220,255,220); font-style:italic; font-weight:bold;">captchatype="RecaptchaV2 (no account)"</span><span> in your shortcode. Please note that this feature may not work in all cases. For backward compatibility you can still use Google Recaptcha version 1 captcha, by setting <em>captchatype="RecaptchaV1"</em> in your shortcode.</span>
wfu_response.php CHANGED
@@ -6,8 +6,11 @@ it should process the file upload data (stored in $_FILES variable) when the pag
6
  session_start();
7
 
8
  if ( isset($_GET['shortcode_id']) && isset($_GET['session_token']) ) {
 
 
 
9
  //check referer using server sessions to avoid CSRF attacks
10
- if ( $_SESSION["wfu_token_".$_GET['shortcode_id']] != $_GET['session_token'] ) die();
11
  if ( isset($_GET['start_time']) ) {
12
  $_SESSION['wfu_check_refresh_'.$_GET['shortcode_id']] = 'form button pressed';
13
  $_SESSION['wfu_start_time_'.$_GET['shortcode_id']] = $_GET['start_time'];
6
  session_start();
7
 
8
  if ( isset($_GET['shortcode_id']) && isset($_GET['session_token']) ) {
9
+ //sanitize variables
10
+ $sid = filter_var($_GET['shortcode_id'], FILTER_SANITIZE_STRING);
11
+ $session_token = filter_var($_GET['session_token'], FILTER_SANITIZE_STRING);
12
  //check referer using server sessions to avoid CSRF attacks
13
+ if ( $_SESSION["wfu_token_".$sid] != $session_token ) die();
14
  if ( isset($_GET['start_time']) ) {
15
  $_SESSION['wfu_check_refresh_'.$_GET['shortcode_id']] = 'form button pressed';
16
  $_SESSION['wfu_start_time_'.$_GET['shortcode_id']] = $_GET['start_time'];
wordpress_file_upload.php CHANGED
@@ -4,7 +4,7 @@ session_start();
4
  /*
5
  Plugin URI: http://www.iptanus.com/support/wordpress-file-upload
6
  Description: Simple interface to upload files from a page.
7
- Version: 2.6.0
8
  Author: Nickolas Bossinas
9
  Author URI: http://www.iptanus.com
10
  */
@@ -38,6 +38,7 @@ if ( strpos($uri, 'wp-login.php') !== false ) return;
38
 
39
  DEFINE("WPFILEUPLOAD_PLUGINFILE", __FILE__);
40
  DEFINE("WPFILEUPLOAD_DIR", '/'.PLUGINDIR .'/'.dirname(plugin_basename (__FILE__)).'/');
 
41
  add_shortcode("wordpress_file_upload", "wordpress_file_upload_handler");
42
  load_plugin_textdomain('wordpress-file-upload', false, dirname(plugin_basename (__FILE__)).'/languages');
43
  /* load styles and scripts for front pages */
4
  /*
5
  Plugin URI: http://www.iptanus.com/support/wordpress-file-upload
6
  Description: Simple interface to upload files from a page.
7
+ Version: 2.7.0
8
  Author: Nickolas Bossinas
9
  Author URI: http://www.iptanus.com
10
  */
38
 
39
  DEFINE("WPFILEUPLOAD_PLUGINFILE", __FILE__);
40
  DEFINE("WPFILEUPLOAD_DIR", '/'.PLUGINDIR .'/'.dirname(plugin_basename (__FILE__)).'/');
41
+ DEFINE("ABSWPFILEUPLOAD_DIR", ABSPATH.WPFILEUPLOAD_DIR);
42
  add_shortcode("wordpress_file_upload", "wordpress_file_upload_handler");
43
  load_plugin_textdomain('wordpress-file-upload', false, dirname(plugin_basename (__FILE__)).'/languages');
44
  /* load styles and scripts for front pages */