OwlCyberSecurity - MANAGER
Edit File: plugininstall.min.js
window.OMAPI_Plugins=window.OMAPI_Plugins||{},function(t,n,e,a,o){"use strict";a.handleSubmission=function(n){if(n.preventDefault(),!a.pluginData.status)throw new Error("Missing Plugin Data");var o=e(".button-install"),i=e(".button-activate"),s=o.html(),r=i.html();o.html(o.data("actiontext")),i.html(i.data("actiontext")),e("#om-plugin-alerts").hide(),e.ajax({type:"POST",beforeSend:function(t){t.setRequestHeader("X-WP-Nonce",a.restNonce)},url:a.restUrl+"omapp/v1/plugins/",data:{id:a.pluginData.id,actionNonce:a.actionNonce},success:function(n){t.location.reload()},error:function(t,n,l){o.html(s),i.html(r);var u="Something went wrong!";if(t.responseJSON&&t.responseJSON.message&&(u+="<br>Error found: "+t.responseJSON.message),t.responseJSON&&t.responseJSON.data)try{u+="<br>(data: ".concat(JSON.stringify(t.responseJSON.data),")")}catch(t){}var c=a.pluginData.installed?"activate":"install";console.error("Could not ".concat(c," the ").concat(a.pluginData.name," plugin"),{jqXHR:t,textStatus:n,errorThrown:l}),e("#om-plugin-alerts").show().html(e("<p/>").html(u))}})},a.init=function(){e("body").on("submit",".install-plugin-form",a.handleSubmission)},e(a.init)}(window,document,jQuery,window.OMAPI_Plugins);