HEX
Server: nginx/1.27.1
System: Linux in-4 5.15.0-131-generic #141-Ubuntu SMP Fri Jan 10 21:18:28 UTC 2025 x86_64
User: ilikadirect (1186)
PHP: 7.4.33
Disabled: exec,passthru,shell_exec,system,proc_open,popen,parse_ini_file,show_source
Upload Files
File: /storage/v6964/gopalak/public_html/wp-content/plugins/restrict-user-access/assets/js/edit.min.js
/*!
 * @package Restrict User Access
 * @author Joachim Jensen <joachim@dev.institute>
 * @license GPLv3
 * @copyright 2024 by Joachim Jensen
 */
(($,RUA,WPCA,e)=>{var r={current_section:0,sections:[],alert:null,init:function(){this.alert=new e.Views.Alert({model:new e.Models.Alert}),this.suggestUsers(),this.suggestPages(),this.tabController(),this.capController(),this.automationController(),this.extensionController(),this.handleCopyToClipboard()},extensionController:function(){var n=$("#extend_member"),a=$(".js-rua-extend-date"),t=$(".js-rua-extend-type");$(".wp-list-table.members").on("click",".js-rua-member-extend",function(e){e.preventDefault();var e=$(this),t=e.data("expiration");(t.length?(a.val(t),$(".js-rua-extend-type-1")):(a.val(a.prop("min")),$(".js-rua-extend-type-0"))).prop("checked",!0),n.data("userid",e.data("userid"))}),n.on("click",function(e){e.preventDefault(),$.ajax({url:ajaxurl,data:{user_id:$(this).data("userid"),post_id:$("#post_ID").val(),action:"rua/membership/extend",nonce:RUA.nonce,extend_date:a.val(),extend_type:t.filter(":checked").first().val()},dataType:"JSON",type:"POST",success:function(e){window.location.reload()},error:function(e,t,n){r.alert.failure(e.responseJSON.data)}})})},automationController:function(){var r=$(".js-rua-member-automations"),s=r.children().length;r.on("click",".js-rua-member-trigger-remove",function(e){e.preventDefault(),$(this).closest(".rua-member-trigger").remove()}),$(".js-rua-add-member-automator").on("change",function(e){e.preventDefault();var t,a,n=e.target.options[e.target.selectedIndex];""!==n.value&&(t=$('<div data-no="'+s+'" class="rua-member-trigger"><span class="rua-member-trigger-icon dashicons '+n.getAttribute("data-icon")+'"></span> '+n.getAttribute("data-sentence")+' <input type="hidden" name="member_automations['+s+'][name]" value="'+n.value+'" /></div>'),"0"===n.getAttribute("data-search")?(t.append('<input type="hidden" name="member_automations['+s+'][value]" value="1" /><span class="js-rua-member-trigger-remove wpca-condition-remove wpca-pull-right dashicons dashicons-trash"></span>'),r.append(t)):(a=$("<select><option></option></select>"),t.append(a),r.append(t),a.select2({cachedResults:{},quietMillis:400,searchTimer:null,type:n.value,theme:"wpca",dir:WPCA.text_direction,minimumInputLength:0,closeOnSelect:!0,width:"250px",placeholder:"-- Select --",language:{noResults:function(){return WPCA.noResults},searching:function(){return WPCA.searching+"..."},loadingMore:function(){return WPCA.loadingMore+"..."}},data:[],dataAdapter:$.fn.select2.amd.require("select2/rua/automatorData"),ajax:{}}).on("select2:select",function(e){e.preventDefault();var t=e.target.options[e.target.selectedIndex],n=$(e.target).parent();""!==t.value&&(n.append('<input type="hidden" name="member_automations['+n.data("no")+'][value]" value="'+t.value+'" /><span class="rua-member-trigger-value">'+t.text+'</span><span class="js-rua-member-trigger-remove wpca-condition-remove wpca-pull-right dashicons dashicons-trash"></span>'),a.select2("destroy"),e.target.remove())})),s++,e.target.value="")})},suggestPages:function(){var e=$(".js-rua-page"),t=e.data("rua-url");e.select2({theme:"wpca",dir:WPCA.text_direction,minimumInputLength:0,closeOnSelect:!0,allowClear:!1,width:"250px",ajax:{delay:400,url:ajaxurl,data:function(e){return{search:e.term||"",action:"rua/page/suggest",paged:e.page||1,nonce:RUA.nonce}},dataType:"JSON",type:"POST",processResults:function(e,t){return{results:e,pagination:{more:!(e.length<20)}}}},createTag:function(e){e=$.trim(e.term.replace(t,""));return""===e?null:(-1===(e="/"!==e[0]?"/"+e:e).indexOf(".")&&"/"!==e[e.length-1]&&(e+="/"),{id:e,text:e,new:!0})},templateResult:function(e){return e.new?$("<i>"+t+"</i><b>"+e.text+"</b>"):e.text},language:{noResults:function(){return t},inputTooShort:function(){return"Search for pages or enter custom link"}}})},suggestUsers:function(){var t=$("#post_ID").val();$(".js-rua-user-suggest").select2({theme:"wpca",dir:WPCA.text_direction,cachedResults:{},quietMillis:400,searchTimer:null,post_id:t,placeholder:"Add Members",minimumInputLength:1,closeOnSelect:!1,allowClear:!1,width:"250px",ajax:{delay:400,url:ajaxurl,data:function(e){return{q:e.term||"",action:"rua/user/suggest",post_id:t,nonce:RUA.nonce}},dataType:"JSON",type:"POST",processResults:function(e){for(var t=[],n=e.length-1;0<=n;n--)t.push({id:e[n].ID,text:e[n].user_login+" ("+e[n].user_email+")"});return{results:t}}},nextSearchTerm:function(e,t){return t},language:{noResults:function(){return WPCA.noResults},searching:function(){return WPCA.searching+"..."},inputTooShort:function(){return"Search users by name or email"}}})},initTabSections:function(){$(".js-rua-tabs").find(".nav-tab").each(function(){var e=this.href.lastIndexOf("#");0<=e&&(e=this.href.substr(e),r.sections.push(e),$(e).hide())})},tabController:function(){this.initTabSections();var e=$("#_rua_section").val();this.setCurrentSection(e||window.location.hash),$("#poststuff").on("click",".js-nav-link",function(e){r.setCurrentSection(this.href)})},findSectionByURL:function(e){e=this.sections.indexOf(e.substring(e.lastIndexOf("#")));return 0<=e?e:null},setCurrentSection:function(e){var e=this.findSectionByURL(e)||0,t=$(".js-rua-tabs").find(".nav-tab");t.eq(e).is(":visible")&&($(this.sections[this.current_section]).hide(),t.eq(this.current_section).removeClass("nav-tab-active"),this.current_section=e,$(this.sections[this.current_section]).show(),t.eq(this.current_section).addClass("nav-tab-active"),$("#_rua_section").val("#top"+this.sections[this.current_section]))},capController:function(){function r(e){e.sum.text(e.checkboxes.not(".js-rua-cb-all").filter(":checked").length)}var e,s=[{value:0,sum:$(".sum-0").first(),checkboxes:$(".column-deny").find("input.rua-cb")},{value:1,sum:$(".sum-1").first(),checkboxes:$(".column-permit").find("input.rua-cb")},{value:-1,sum:$(".sum--1").first(),checkboxes:$(".column-unset").find("input.rua-cb")}],t=$("input.js-rua-cb-all");for(e in s)r(s[e]);$("input.js-rua-cb-all").on("change",function(){var e,t=$(this),n=t.prop("checked"),a=t.val();for(e in s)s[e].checkboxes.prop("checked",s[e].value==a?n:!n),r(s[e])}),$("td input.rua-cb").on("change",function(){for(var e in s)r(s[e]);t.prop("checked",!1)})},handleCopyToClipboard:function(){$(".js-rua-copy").each(function(e,t){t.setAttribute("title",RUA.copy),t.style.cursor="pointer"}),$("body").on("click",".js-rua-copy",function(e){try{var t=e.target.dataset.copy;(t=void 0===t?e.target.textContent:t).length&&(navigator.clipboard.writeText(t),r.alert.success(RUA.copy+": "+t))}catch(e){}})}};$.fn.select2.amd.define("select2/rua/automatorData",["select2/data/array","select2/utils"],function(e,t){function n(e,t){n.__super__.constructor.call(this,e,t)}return t.Extend(n,e),n.prototype.query=function(n,a){n.term=n.term||"";var r=this.options.options,s=r.cachedResults[n.term],i=n.page||1;if(s&&s.page>=i){if(!(1<i))return void a({results:s.items,pagination:{more:s.more}});i=s.page}clearTimeout(r.searchTimer),r.searchTimer=setTimeout(function(){$.ajax({url:ajaxurl,data:{search:n.term,paged:i,limit:20,action:"rua/automator/"+r.type,nonce:RUA.nonce},dataType:"JSON",type:"POST",success:function(e){var t=20<=e.length;r.cachedResults[n.term]={page:i,more:t,items:s?r.cachedResults[n.term].items.concat(e):e},a({results:e,pagination:{more:t}})}})},r.quietMillis)},n}),$(document).ready(function(){r.init()})})(jQuery,RUA,WPCA,CAE);