From 2cf4347eeee79e4d49f009a6a26b19f9e3c5d2ac Mon Sep 17 00:00:00 2001 From: JoryHogeveen Date: Thu, 30 Mar 2017 23:50:05 +0200 Subject: [PATCH 01/57] Role Manager: Rename roles feature #47 --- assets/js/view-admin-as.js | 17 +++++- assets/js/view-admin-as.min.js | 4 +- modules/class-role-manager.php | 99 +++++++++++++++++++++++++++++++++- view-admin-as.php | 6 +-- 4 files changed, 119 insertions(+), 7 deletions(-) diff --git a/assets/js/view-admin-as.js b/assets/js/view-admin-as.js index 7e7504e6..bf845094 100644 --- a/assets/js/view-admin-as.js +++ b/assets/js/view-admin-as.js @@ -6,7 +6,7 @@ * @author Jory Hogeveen * @package View_Admin_As * @since 0.1 - * @version 1.7 + * @version 1.7.1 * @preserve */ /* eslint-enable no-extra-semi */ @@ -1142,6 +1142,21 @@ if ( 'undefined' === typeof VAA_View_Admin_As ) { return false; } ); + // @since 1.7.1 Rename role. + $document.on( 'click touchend', root_prefix + '-rename-apply button#' + prefix + '-rename-apply', function( e ) { + if ( true === VAA_View_Admin_As._touchmove ) { + return; + } + e.preventDefault(); + var role = $( root_prefix + '-rename-select select#' + prefix + '-rename-select' ).val(); + var new_name = $( root_prefix + '-rename-input input#' + prefix + '-rename-input' ).val(); + if ( role && '' !== role && new_name && '' !== new_name ) { + var view_data = { role_manager : { rename_role : { role : role, new_name : new_name } } }; + VAA_View_Admin_As.ajax( view_data, true ); + } + return false; + } ); + // @since 1.7 Clone role. $document.on( 'click touchend', root_prefix + '-clone-apply button#' + prefix + '-clone-apply', function( e ) { if ( true === VAA_View_Admin_As._touchmove ) { diff --git a/assets/js/view-admin-as.min.js b/assets/js/view-admin-as.min.js index 9e6ddf0b..9ec9f0a9 100644 --- a/assets/js/view-admin-as.min.js +++ b/assets/js/view-admin-as.min.js @@ -5,7 +5,7 @@ * @author Jory Hogeveen * @package View_Admin_As * @since 0.1 - * @version 1.7 + * @version 1.7.1 * @preserve */ -if("undefined"===typeof VAA_View_Admin_As){var VAA_View_Admin_As={}}(function($){var $document=$(document),$window=$(window),$body=$("body");VAA_View_Admin_As.prefix="#wpadminbar #wp-admin-bar-vaa ";VAA_View_Admin_As.root="#wp-admin-bar-vaa";VAA_View_Admin_As.maxHeightListenerElements=$(VAA_View_Admin_As.prefix+".vaa-auto-max-height");VAA_View_Admin_As._mobile=false;if(!VAA_View_Admin_As.hasOwnProperty("_debug")){VAA_View_Admin_As._debug=false}VAA_View_Admin_As._debug=Boolean(parseInt(VAA_View_Admin_As._debug,10));if(!VAA_View_Admin_As.hasOwnProperty("ajaxurl")&&"undefined"!==typeof ajaxurl){VAA_View_Admin_As.ajaxurl=ajaxurl}VAA_View_Admin_As._touchmove=false;$document.on("touchmove",function(){VAA_View_Admin_As._touchmove=true});$document.on("touchstart",function(){VAA_View_Admin_As._touchmove=false});VAA_View_Admin_As.json_decode=function(val){if(0===val.indexOf("{")){try{val=JSON.parse(val)}catch(err){}}return val};VAA_View_Admin_As.init=function(){VAA_View_Admin_As.init_caps();VAA_View_Admin_As.init_users();VAA_View_Admin_As.init_settings();VAA_View_Admin_As.init_module_role_defaults();VAA_View_Admin_As.init_module_role_manager();$window.on("load",function(){$(VAA_View_Admin_As.prefix+".ab-vaa-toggle").each(function(){var toggleContent=$(this).parent().children().not(".ab-vaa-toggle");if(!$(this).hasClass("active")){toggleContent.hide()}$(this).on("click touchend",function(e){e.preventDefault();e.stopPropagation();if(true===VAA_View_Admin_As._touchmove){return}if($(this).hasClass("active")){toggleContent.slideUp("fast");$(this).removeClass("active")}else{toggleContent.slideDown("fast");$(this).addClass("active")}VAA_View_Admin_As.autoMaxHeight()});$(this).on("keyup",function(e){e.preventDefault();var key=parseInt(e.which,10);if($(this).hasClass("active")&&(13===key||32===key||38===key)){toggleContent.slideUp("fast");$(this).removeClass("active")}else if(13===key||32===key||40===key){toggleContent.slideDown("fast");$(this).addClass("active")}VAA_View_Admin_As.autoMaxHeight()})});$(VAA_View_Admin_As.prefix+".ab-vaa-showhide[data-showhide]").each(function(){$($(this).attr("data-showhide")).hide();$(this).on("mouseenter",function(){$($(this).attr("data-showhide")).slideDown("fast")}).on("mouseleave",function(){$($(this).attr("data-showhide")).slideUp("fast")})});$(VAA_View_Admin_As.prefix+".ab-vaa-conditional[data-condition-target]").each(function(){var $this=$(this),$target=$($this.attr("data-condition-target")),compare=$this.attr("data-condition"),checkbox=$target.is(":checkbox");$this.hide();$target.on("change",function(){if(checkbox&&$target.is(":checked")){$this.slideDown("fast")}else if(!checkbox&&compare===$target.val()){$this.slideDown("fast")}else{$this.slideUp("fast")}VAA_View_Admin_As.autoMaxHeight()})});if($body.hasClass("mobile")||783>$body.innerWidth()){$body.addClass("vaa-mobile");VAA_View_Admin_As._mobile=true;VAA_View_Admin_As.mobile()}});$document.on("click touchend",VAA_View_Admin_As.prefix+".vaa-reset-item > .ab-item",function(e){e.preventDefault();if(true===VAA_View_Admin_As._touchmove){return}if("vaa_reload"===$("button",this).attr("name")){window.location.reload()}else{VAA_View_Admin_As.ajax({reset:true},true);return false}});$.each(VAA_View_Admin_As.view_types,function(index,type){$document.on("click touchend",VAA_View_Admin_As.prefix+".vaa-"+type+"-item > a.ab-item",function(e){if(true===VAA_View_Admin_As._touchmove){return}e.preventDefault();var $this=$(this);if(VAA_View_Admin_As._mobile&&$this.parent().hasClass("menupop")&&!$this.next().is(":visible")){$this.next().show().parent().addClass("active");return}if(!$this.parent().hasClass("not-a-view")){var view_data={},val=$this.attr("rel");if(!val){val=$this.find(".vaa-view-data").attr("data-view-value")}view_data[type]=VAA_View_Admin_As.json_decode(val);view_data="object"===typeof view_data[type]?view_data[type]:view_data;VAA_View_Admin_As.ajax(view_data,true);return false}})});$document.on("click touchend",VAA_View_Admin_As.prefix+".remove",function(e){e.preventDefault();if(true===VAA_View_Admin_As._touchmove){return}$(this).parent().slideUp("fast",function(){$(this).remove()})})};VAA_View_Admin_As.mobile=function(){var prefix=".vaa-mobile "+VAA_View_Admin_As.prefix;$document.on("click touchend",prefix+" > .ab-sub-wrapper .ab-item",function(e){if(true===VAA_View_Admin_As._touchmove){return}e.preventDefault();e.stopPropagation();var $sub=$(this).parent(".menupop").children(".ab-sub-wrapper");if($sub.length){if($sub.hasClass("active")){$sub.slideUp("fast");$sub.removeClass("active")}else{$sub.slideDown("fast");$sub.addClass("active")}}});$document.on("click touchend",prefix+"input, "+prefix+"textarea, "+prefix+"select",function(e){if(true===VAA_View_Admin_As._touchmove){return}e.stopPropagation();var $this=$(this);if($this.is('[type="checkbox"]')){e.preventDefault();if($this.is(":checked")){$this.prop("checked",false)}else{$this.prop("checked",true)}$this.trigger("change");return false}else if($this.is('[type="radio"]')){e.preventDefault();$('input[name="'+$this.attr["name"]+'"]').removeAttr("checked");$this.prop("checked",true);$this.trigger("change");return false}return true});$document.on("click touchend",prefix+"label",function(e){if(true===VAA_View_Admin_As._touchmove){return}e.preventDefault();e.stopPropagation();$("#"+$(this).attr("for")).trigger(e.type);return false})};VAA_View_Admin_As.overlay=function(html){var $overlay=$("#vaa-overlay");if(!$overlay.length){html='
'+html+"
";$body.append(html);$overlay=$("body #vaa-overlay")}else if(html.length){$overlay.html(html)}$overlay.fadeIn("fast")};VAA_View_Admin_As.ajax=function(data,refresh){$(".vaa-notice","#wpadminbar").remove();var loader_icon=VAA_View_Admin_As.siteurl+"/wp-includes/images/spinner-2x.gif";VAA_View_Admin_As.overlay('');var post_data={action:"view_admin_as",_vaa_nonce:VAA_View_Admin_As._vaa_nonce,view_admin_as:JSON.stringify(data)};var isView=false;$.each(VAA_View_Admin_As.view_types,function(index,type){if("undefined"!==typeof data[type]){isView=true;return true}});if($(VAA_View_Admin_As.prefix+"#vaa-settings-view-mode-single").is(":checked")&&isView){$body.append('');var form=$("#vaa_single_mode_form");form.append('');form.append('');form.append('');form.find("#data").val(post_data.view_admin_as);form.submit()}else{$.post(VAA_View_Admin_As.ajaxurl,post_data,function(response){var success=response.hasOwnProperty("success")&&true===response.success,data={},display=false;if(true===VAA_View_Admin_As._debug){console.log(response)}if(response.hasOwnProperty("data")){if("object"===typeof response.data){data=response.data;if(data.hasOwnProperty("display")){display=data.display}}}if(success){if(refresh){VAA_View_Admin_As.refresh(data);return}else{if(!data.hasOwnProperty("text")){data.text=VAA_View_Admin_As.__success}}}if(!data.hasOwnProperty("type")){if(success){data.type="success"}else{data.type="error"}}if("popup"===display){VAA_View_Admin_As.popup(data,data.type)}else{if(!data.hasOwnProperty("text")){data.text=response.data}VAA_View_Admin_As.notice(String(data.text),data.type,5e3);$("body #vaa-overlay").addClass(data.type).fadeOut("fast",function(){$(this).remove()})}})}};VAA_View_Admin_As.refresh=function(data){if(data.hasOwnProperty("redirect")){window.location.replace(String(data.redirect))}else{window.location.hash="";window.location.reload()}};VAA_View_Admin_As.notice=function(notice,type,timeout){var root="#wpadminbar .vaa-notice",html=notice+'';type="undefined"===typeof type?"notice":type;timeout="undefined"===typeof timeout?5e3:timeout;if(VAA_View_Admin_As._mobile){html='";$(VAA_View_Admin_As.prefix+"> .ab-sub-wrapper").prepend(html).children(".vaa-notice").slideDown("fast");$("html, body").animate({scrollTop:"0"});if(timeout){setTimeout(function(){$(root).slideUp("fast",function(){$(this).remove()})},timeout)}}else{html='
  • '+html+"
  • ";$("#wp-admin-bar-top-secondary").append(html);$(root+" .remove").click(function(){$(this).parent().remove()});if(timeout){setTimeout(function(){$(root).fadeOut("fast",function(){$(this).remove()})},timeout)}}};VAA_View_Admin_As.item_notice=function(parent,notice,type,timeout){var root=".vaa-notice",html=notice+'',$element=$(parent);type="undefined"===typeof type?"notice":type;timeout="undefined"===typeof timeout?5e3:timeout;html='";$element.append(html).children(".vaa-notice").slideDown("fast");if(timeout){setTimeout(function(){$(root,$element).slideUp("fast",function(){$(this).remove()})},timeout)}};VAA_View_Admin_As.item_confirm=function(parent,text){$(parent).find(".vaa-notice").slideUp("fast",function(){$(this).remove()});text='";VAA_View_Admin_As.item_notice(parent,text,"warning",0);return $(parent).find(".vaa-confirm")};VAA_View_Admin_As.popup=function(data,type){type="undefined"===typeof type?"notice":type;var html="";html+='
    ';html+='';html+='
    ';if("object"!==typeof data){data={text:data}}if(data.hasOwnProperty("text")){html+="

    "+String(data.text)+"

    "}if(data.hasOwnProperty("list")){html+="
      ";data.list.forEach(function(item){html+="
    • "+String(item)+"
    • "});html+="
    "}if(data.hasOwnProperty("textarea")){html+='"}html+="
    ";VAA_View_Admin_As.overlay(html);var root="body #vaa-overlay",$overlay=$(root),$overlayContainer=$(root+" .vaa-overlay-container"),$popupResponse=$(root+" .vaa-response-data");$(root+" .vaa-overlay-container .remove").click(function(){$overlay.fadeOut("fast",function(){$(this).remove()})});$document.on("mouseup",function(e){$(root+" .vaa-overlay-container").each(function(){if(!$(this).is(e.target)&&0===$(this).has(e.target).length){$overlay.fadeOut("fast",function(){$(this).remove()})}})});var textarea=$("textarea",$popupResponse);if(textarea.length){textarea.on("click",function(){$(this).select()})}var popupMaxHeight=function(){if(textarea.length){textarea.each(function(){$(this).css({height:"auto","overflow-y":"hidden"}).height(this.scrollHeight)})}var maxHeight=$overlay.height()*.8-24;$overlayContainer.css("max-height",maxHeight);$popupResponse.css("max-height",maxHeight)};popupMaxHeight();$window.on("resize",function(){popupMaxHeight()})};VAA_View_Admin_As.init_settings=function(){var root=VAA_View_Admin_As.root+"-settings",prefix="vaa-settings",root_prefix=VAA_View_Admin_As.prefix+root;$document.on("change",root_prefix+"-admin-menu-location select#"+prefix+"-admin-menu-location",function(e){e.preventDefault();var val=$(this).val();if(val&&""!==val){var view_data={user_setting:{admin_menu_location:val}};VAA_View_Admin_As.ajax(view_data,true)}});$document.on("change",root_prefix+"-view-mode input.radio."+prefix+"-view-mode",function(e){e.preventDefault();var val=$(this).val();if(val&&""!==val){var view_data={user_setting:{view_mode:val}};VAA_View_Admin_As.ajax(view_data,false)}});$document.on("change",root_prefix+"-force-group-users input#"+prefix+"-force-group-users",function(e){e.preventDefault();var view_data={user_setting:{force_group_users:"no"}};if(this.checked){view_data={user_setting:{force_group_users:"yes"}}}VAA_View_Admin_As.ajax(view_data,true)});$document.on("change",root_prefix+"-hide-front input#"+prefix+"-hide-front",function(e){e.preventDefault();var view_data={user_setting:{hide_front:"no"}};if(this.checked){view_data={user_setting:{hide_front:"yes"}}}VAA_View_Admin_As.ajax(view_data,false)});$document.on("change",root_prefix+"-freeze-locale input#"+prefix+"-freeze-locale",function(e){e.preventDefault();var view_data={user_setting:{freeze_locale:"no"}};if(this.checked){view_data={user_setting:{freeze_locale:"yes"}}}var reload=false;if("object"===typeof VAA_View_Admin_As.view&&"undefined"!==typeof VAA_View_Admin_As.view.user){reload=true}VAA_View_Admin_As.ajax(view_data,reload)})};VAA_View_Admin_As.init_users=function(){var root=VAA_View_Admin_As.root+"-users",root_prefix=VAA_View_Admin_As.prefix+root;$document.on("keyup",root_prefix+" .ab-vaa-search.search-users input",function(){$(VAA_View_Admin_As.prefix+" .ab-vaa-search .ab-vaa-results").empty();if(1<=$(this).val().length){var inputText=$(this).val();$(VAA_View_Admin_As.prefix+".vaa-user-item").each(function(){var name=$(".ab-item",this).text();if(-1('+role+")")}}});if(""===$.trim($(VAA_View_Admin_As.prefix+".ab-vaa-search .ab-vaa-results").html())){$(VAA_View_Admin_As.prefix+".ab-vaa-search .ab-vaa-results").append('
    '+VAA_View_Admin_As.__no_users_found+"
    ")}}})};VAA_View_Admin_As.init_caps=function(){var root=VAA_View_Admin_As.root+"-caps",root_prefix=VAA_View_Admin_As.prefix+root;VAA_View_Admin_As.caps_filter_settings={selectedRole:"default",selectedRoleCaps:{},selectedRoleReverse:false,filterString:""};VAA_View_Admin_As.filter_capabilities=function(){var reverse=true===VAA_View_Admin_As.caps_filter_settings.selectedRoleReverse,isDefault="default"===VAA_View_Admin_As.caps_filter_settings.selectedRole,filterString=VAA_View_Admin_As.caps_filter_settings.filterString;$(root_prefix+"-select-options .vaa-cap-item").each(function(){var $this=$(this),exists=$("input",this).attr("value")in VAA_View_Admin_As.caps_filter_settings.selectedRoleCaps,name;$this.hide();if(reverse||exists||isDefault){if(1<=filterString.length){name=$this.text();if(-1 .ab-sub-wrapper").addClass("fullPopup");VAA_View_Admin_As.autoMaxHeight()});$document.on("click",root_prefix+" #close-caps-popup",function(){$(VAA_View_Admin_As.prefix).removeClass("fullPopupActive");$(root_prefix+"-manager > .ab-sub-wrapper").removeClass("fullPopup");VAA_View_Admin_As.autoMaxHeight()});$document.on("change",root_prefix+" .ab-vaa-select.select-role-caps select",function(){VAA_View_Admin_As.caps_filter_settings.selectedRole=$(this).val();if("default"===VAA_View_Admin_As.caps_filter_settings.selectedRole){VAA_View_Admin_As.caps_filter_settings.selectedRoleCaps={};VAA_View_Admin_As.caps_filter_settings.selectedRoleReverse=false}else{var selectedRoleElement=$(root_prefix+'-selectrolecaps #vaa-caps-selectrolecaps option[value="'+VAA_View_Admin_As.caps_filter_settings.selectedRole+'"]');VAA_View_Admin_As.caps_filter_settings.selectedRoleCaps=JSON.parse(selectedRoleElement.attr("data-caps"));VAA_View_Admin_As.caps_filter_settings.selectedRoleReverse=1===parseInt(selectedRoleElement.attr("data-reverse"),10)}VAA_View_Admin_As.filter_capabilities()});$document.on("keyup",root_prefix+" .ab-vaa-filter input",function(){VAA_View_Admin_As.caps_filter_settings.filterString=$(this).val();VAA_View_Admin_As.filter_capabilities()});$document.on("click touchend",root_prefix+" button#select-all-caps",function(e){if(true===VAA_View_Admin_As._touchmove){return}e.preventDefault();$(root_prefix+"-select-options .vaa-cap-item").each(function(){if($(this).is(":visible")){$("input",this).prop("checked",true)}});return false});$document.on("click touchend",root_prefix+" button#deselect-all-caps",function(e){if(true===VAA_View_Admin_As._touchmove){return}e.preventDefault();$(root_prefix+"-select-options .vaa-cap-item").each(function(){if($(this).is(":visible")){$("input",this).prop("checked",false)}});return false});$document.on("click touchend",root_prefix+" button#apply-caps-view",function(e){if(true===VAA_View_Admin_As._touchmove){return}e.preventDefault();var newCaps=VAA_View_Admin_As.get_selected_capabilities();VAA_View_Admin_As.ajax({caps:newCaps},true);return false})};VAA_View_Admin_As.init_module_role_defaults=function(){var root=VAA_View_Admin_As.root+"-settings",prefix="vaa-settings",root_prefix=VAA_View_Admin_As.prefix+root;$document.on("change",root_prefix+"-role-defaults-enable input#"+prefix+"-role-defaults-enable",function(e){e.preventDefault();var view_data={role_defaults:{enable:0}};if(this.checked){view_data={role_defaults:{enable:true}}}VAA_View_Admin_As.ajax(view_data,true)});root=VAA_View_Admin_As.root+"-role-defaults";prefix="vaa-role-defaults";root_prefix=VAA_View_Admin_As.prefix+root;$document.on("change",root_prefix+"-setting-register-enable input#"+prefix+"-setting-register-enable",function(e){e.preventDefault();var view_data={role_defaults:{apply_defaults_on_register:0}};if(this.checked){view_data={role_defaults:{apply_defaults_on_register:true}}}VAA_View_Admin_As.ajax(view_data,false)});$document.on("change",root_prefix+"-setting-disable-user-screen-options input#"+prefix+"-setting-disable-user-screen-options",function(e){e.preventDefault();var view_data={role_defaults:{disable_user_screen_options:0}};if(this.checked){view_data={role_defaults:{disable_user_screen_options:true}}}VAA_View_Admin_As.ajax(view_data,false)});$document.on("change",root_prefix+"-setting-lock-meta-boxes input#"+prefix+"-setting-lock-meta-boxes",function(e){e.preventDefault();var view_data={role_defaults:{lock_meta_boxes:0}};if(this.checked){view_data={role_defaults:{lock_meta_boxes:true}}}VAA_View_Admin_As.ajax(view_data,false)});$document.on("click touchend",root_prefix+"-meta-add button#"+prefix+"-meta-add",function(e){if(true===VAA_View_Admin_As._touchmove){return}e.preventDefault();var val=$(root_prefix+"-meta-add input#"+prefix+"-meta-new").val();var item=$(root_prefix+"-meta-add #"+prefix+"-meta-template").html().toString();val=val.replace(/ /g,"_");item=item.replace(/vaa_new_item/g,val);if($(root_prefix+'-meta-select input[value="'+val+'"]').length){VAA_View_Admin_As.item_notice($(this).parent(),VAA_View_Admin_As.__key_already_exists,"error",2e3)}else{$(root_prefix+"-meta-select > .ab-item").prepend(item)}});$document.on("click touchend",root_prefix+"-meta-apply button#"+prefix+"-meta-apply",function(e){if(true===VAA_View_Admin_As._touchmove){return}e.preventDefault();var val={};$(root_prefix+"-meta-select .ab-item.vaa-item input").each(function(){val[$(this).val()]=$(this).is(":checked")});if(val){var view_data={role_defaults:{update_meta:val}};VAA_View_Admin_As.ajax(view_data,false)}return false});$document.on("keyup",root_prefix+"-bulk-users-filter input#"+prefix+"-bulk-users-filter",function(e){e.preventDefault();if(1<=$(this).val().length){var inputText=$(this).val();$(root_prefix+"-bulk-users-select .ab-item.vaa-item").each(function(){var name=$(".user-name",this).text();if(-1"+err+"","error")}}return false});$document.on("click touchend",root_prefix+"-clear-roles-apply button#"+prefix+"-clear-roles-apply",function(e){if(true===VAA_View_Admin_As._touchmove){return}e.preventDefault();var val=$(root_prefix+"-clear-roles-select select#"+prefix+"-clear-roles-select").val();if(val&&""!==val){var view_data={role_defaults:{clear_role_defaults:val}},confirm=VAA_View_Admin_As.item_confirm($(this).parent(),VAA_View_Admin_As.__confirm);$(confirm).on("click",function(){VAA_View_Admin_As.ajax(view_data,false)})}return false})};VAA_View_Admin_As.init_module_role_manager=function(){var root=VAA_View_Admin_As.root+"-settings",prefix="vaa-settings",root_prefix=VAA_View_Admin_As.prefix+root;$document.on("change",root_prefix+"-role-manager-enable input#"+prefix+"-role-manager-enable",function(e){e.preventDefault();var view_data={role_manager:{enable:0}};if(this.checked){view_data={role_manager:{enable:true}}}VAA_View_Admin_As.ajax(view_data,true)});root=VAA_View_Admin_As.root+"-role-manager";prefix="vaa-role-manager";root_prefix=VAA_View_Admin_As.prefix+root;$document.on("click touchend",root_prefix+"-apply-view-apply button#"+prefix+"-apply-view-apply",function(e){if(true===VAA_View_Admin_As._touchmove){return}e.preventDefault();var role=$(root_prefix+"-apply-view-select select#"+prefix+"-apply-view-select").val();var capabilities=JSON.parse($(this).attr("data-view-caps"));if(role&&""!==role&&capabilities){var view_data={role_manager:{apply_view_to_role:{role:role,capabilities:capabilities}}};VAA_View_Admin_As.ajax(view_data,true)}return false});$document.on("click touchend",root_prefix+"-clone-apply button#"+prefix+"-clone-apply",function(e){if(true===VAA_View_Admin_As._touchmove){return}e.preventDefault();var role=$(root_prefix+"-clone-select select#"+prefix+"-clone-select").val();var new_role=$(root_prefix+"-clone-input input#"+prefix+"-clone-input").val();if(role&&""!==role&&new_role&&""!==new_role){var view_data={role_manager:{clone_role:{role:role,new_role:new_role}}};VAA_View_Admin_As.ajax(view_data,true)}return false});$document.on("click touchend",root_prefix+"-delete-apply button#"+prefix+"-delete-apply",function(e){if(true===VAA_View_Admin_As._touchmove){return}e.preventDefault();var val=$(root_prefix+"-delete-select select#"+prefix+"-delete-select").val();if(val&&""!==val){var view_data={role_manager:{delete_role:val}},confirm=VAA_View_Admin_As.item_confirm($(this).parent(),VAA_View_Admin_As.__confirm);$(confirm).on("click",function(){VAA_View_Admin_As.ajax(view_data,true)})}return false});var caps_root=VAA_View_Admin_As.root+"-caps-manager-role-manager",caps_prefix="vaa-caps-manager-role-manager",caps_root_prefix=VAA_View_Admin_As.prefix+caps_root;$document.on("change",caps_root_prefix+" select#"+caps_prefix+"-edit-role",function(){var $this=$(this),role=$this.val(),caps={},selectedRoleElement=$(caps_root_prefix+" select#"+caps_prefix+'-edit-role option[value="'+role+'"]');if(selectedRoleElement.attr("data-caps")){caps=JSON.parse(selectedRoleElement.attr("data-caps"))}VAA_View_Admin_As.caps_filter_settings.selectedRole="default";VAA_View_Admin_As.caps_filter_settings.selectedRoleCaps={};VAA_View_Admin_As.caps_filter_settings.selectedRoleReverse=false;VAA_View_Admin_As.filter_capabilities();VAA_View_Admin_As.set_selected_capabilities(caps)});$document.on("click touchend",caps_root_prefix+" button#"+caps_prefix+"-save-role",function(e){if(true===VAA_View_Admin_As._touchmove){return}e.preventDefault();var role=$(caps_root_prefix+" select#"+caps_prefix+"-edit-role").val(),refresh=false;if(!role){return false}if("__new__"===role){role=$(caps_root_prefix+" input#"+caps_prefix+"-new-role").val();refresh=true}var data={role:role,capabilities:VAA_View_Admin_As.get_selected_capabilities()};VAA_View_Admin_As.ajax({role_manager:{save_role:data}},refresh);return false});$document.on("click touchend",caps_root_prefix+"-new-cap button#"+caps_prefix+"-add-cap",function(e){if(true===VAA_View_Admin_As._touchmove){return}e.preventDefault();var existing=VAA_View_Admin_As.get_selected_capabilities();var val=$(caps_root_prefix+"-new-cap input#"+caps_prefix+"-new-cap").val();var item=$(caps_root_prefix+"-new-cap #"+caps_prefix+"-cap-template").html().toString();val=val.replace(/ /g,"_");item=item.replace(/vaa_new_item/g,val);if("undefined"!==typeof existing[val]){VAA_View_Admin_As.item_notice($(this).parent(),VAA_View_Admin_As.__key_already_exists,"error",2e3)}else{$(VAA_View_Admin_As.root+"-caps-select-options > .ab-item").prepend(item)}})};VAA_View_Admin_As.autoMaxHeight=function(){setTimeout(function(){VAA_View_Admin_As.maxHeightListenerElements.each(function(){var element=$(this),count=0,wait=setInterval(function(){var offset=element.offset(),scrollTop="undefined"!==typeof window.pageYOffset?window.pageYOffset:(document.documentElement||document.body.parentNode||document.body).scrollTop,offsetTop=offset.top-scrollTop;if(element.is(":visible")&&0$body.innerWidth()){$body.addClass("vaa-mobile");VAA_View_Admin_As._mobile=true;VAA_View_Admin_As.mobile()}});$document.on("click touchend",VAA_View_Admin_As.prefix+".vaa-reset-item > .ab-item",function(e){e.preventDefault();if(true===VAA_View_Admin_As._touchmove){return}if("vaa_reload"===$("button",this).attr("name")){window.location.reload()}else{VAA_View_Admin_As.ajax({reset:true},true);return false}});$.each(VAA_View_Admin_As.view_types,function(index,type){$document.on("click touchend",VAA_View_Admin_As.prefix+".vaa-"+type+"-item > a.ab-item",function(e){if(true===VAA_View_Admin_As._touchmove){return}e.preventDefault();var $this=$(this);if(VAA_View_Admin_As._mobile&&$this.parent().hasClass("menupop")&&!$this.next().is(":visible")){$this.next().show().parent().addClass("active");return}if(!$this.parent().hasClass("not-a-view")){var view_data={},val=$this.attr("rel");if(!val){val=$this.find(".vaa-view-data").attr("data-view-value")}view_data[type]=VAA_View_Admin_As.json_decode(val);view_data="object"===typeof view_data[type]?view_data[type]:view_data;VAA_View_Admin_As.ajax(view_data,true);return false}})});$document.on("click touchend",VAA_View_Admin_As.prefix+".remove",function(e){e.preventDefault();if(true===VAA_View_Admin_As._touchmove){return}$(this).parent().slideUp("fast",function(){$(this).remove()})})};VAA_View_Admin_As.mobile=function(){var prefix=".vaa-mobile "+VAA_View_Admin_As.prefix;$document.on("click touchend",prefix+" > .ab-sub-wrapper .ab-item",function(e){if(true===VAA_View_Admin_As._touchmove){return}e.preventDefault();e.stopPropagation();var $sub=$(this).parent(".menupop").children(".ab-sub-wrapper");if($sub.length){if($sub.hasClass("active")){$sub.slideUp("fast");$sub.removeClass("active")}else{$sub.slideDown("fast");$sub.addClass("active")}}});$document.on("click touchend",prefix+"input, "+prefix+"textarea, "+prefix+"select",function(e){if(true===VAA_View_Admin_As._touchmove){return}e.stopPropagation();var $this=$(this);if($this.is('[type="checkbox"]')){e.preventDefault();if($this.is(":checked")){$this.prop("checked",false)}else{$this.prop("checked",true)}$this.trigger("change");return false}else if($this.is('[type="radio"]')){e.preventDefault();$('input[name="'+$this.attr["name"]+'"]').removeAttr("checked");$this.prop("checked",true);$this.trigger("change");return false}return true});$document.on("click touchend",prefix+"label",function(e){if(true===VAA_View_Admin_As._touchmove){return}e.preventDefault();e.stopPropagation();$("#"+$(this).attr("for")).trigger(e.type);return false})};VAA_View_Admin_As.overlay=function(html){var $overlay=$("#vaa-overlay");if(!$overlay.length){html='
    '+html+"
    ";$body.append(html);$overlay=$("body #vaa-overlay")}else if(html.length){$overlay.html(html)}$overlay.fadeIn("fast")};VAA_View_Admin_As.ajax=function(data,refresh){$(".vaa-notice","#wpadminbar").remove();var loader_icon=VAA_View_Admin_As.siteurl+"/wp-includes/images/spinner-2x.gif";VAA_View_Admin_As.overlay('');var post_data={action:"view_admin_as",_vaa_nonce:VAA_View_Admin_As._vaa_nonce,view_admin_as:JSON.stringify(data)};var isView=false;$.each(VAA_View_Admin_As.view_types,function(index,type){if("undefined"!==typeof data[type]){isView=true;return true}});if($(VAA_View_Admin_As.prefix+"#vaa-settings-view-mode-single").is(":checked")&&isView){$body.append('');var form=$("#vaa_single_mode_form");form.append('');form.append('');form.append('');form.find("#data").val(post_data.view_admin_as);form.submit()}else{$.post(VAA_View_Admin_As.ajaxurl,post_data,function(response){var success=response.hasOwnProperty("success")&&true===response.success,data={},display=false;if(true===VAA_View_Admin_As._debug){console.log(response)}if(response.hasOwnProperty("data")){if("object"===typeof response.data){data=response.data;if(data.hasOwnProperty("display")){display=data.display}}}if(success){if(refresh){VAA_View_Admin_As.refresh(data);return}else{if(!data.hasOwnProperty("text")){data.text=VAA_View_Admin_As.__success}}}if(!data.hasOwnProperty("type")){if(success){data.type="success"}else{data.type="error"}}if("popup"===display){VAA_View_Admin_As.popup(data,data.type)}else{if(!data.hasOwnProperty("text")){data.text=response.data}VAA_View_Admin_As.notice(String(data.text),data.type,5e3);$("body #vaa-overlay").addClass(data.type).fadeOut("fast",function(){$(this).remove()})}})}};VAA_View_Admin_As.refresh=function(data){if(data.hasOwnProperty("redirect")){window.location.replace(String(data.redirect))}else{window.location.hash="";window.location.reload()}};VAA_View_Admin_As.notice=function(notice,type,timeout){var root="#wpadminbar .vaa-notice",html=notice+'';type="undefined"===typeof type?"notice":type;timeout="undefined"===typeof timeout?5e3:timeout;if(VAA_View_Admin_As._mobile){html='";$(VAA_View_Admin_As.prefix+"> .ab-sub-wrapper").prepend(html).children(".vaa-notice").slideDown("fast");$("html, body").animate({scrollTop:"0"});if(timeout){setTimeout(function(){$(root).slideUp("fast",function(){$(this).remove()})},timeout)}}else{html='
  • '+html+"
  • ";$("#wp-admin-bar-top-secondary").append(html);$(root+" .remove").click(function(){$(this).parent().remove()});if(timeout){setTimeout(function(){$(root).fadeOut("fast",function(){$(this).remove()})},timeout)}}};VAA_View_Admin_As.item_notice=function(parent,notice,type,timeout){var root=".vaa-notice",html=notice+'',$element=$(parent);type="undefined"===typeof type?"notice":type;timeout="undefined"===typeof timeout?5e3:timeout;html='";$element.append(html).children(".vaa-notice").slideDown("fast");if(timeout){setTimeout(function(){$(root,$element).slideUp("fast",function(){$(this).remove()})},timeout)}};VAA_View_Admin_As.item_confirm=function(parent,text){$(parent).find(".vaa-notice").slideUp("fast",function(){$(this).remove()});text='";VAA_View_Admin_As.item_notice(parent,text,"warning",0);return $(parent).find(".vaa-confirm")};VAA_View_Admin_As.popup=function(data,type){type="undefined"===typeof type?"notice":type;var html="";html+='
    ';html+='';html+='
    ';if("object"!==typeof data){data={text:data}}if(data.hasOwnProperty("text")){html+="

    "+String(data.text)+"

    "}if(data.hasOwnProperty("list")){html+="
      ";data.list.forEach(function(item){html+="
    • "+String(item)+"
    • "});html+="
    "}if(data.hasOwnProperty("textarea")){html+='"}html+="
    ";VAA_View_Admin_As.overlay(html);var root="body #vaa-overlay",$overlay=$(root),$overlayContainer=$(root+" .vaa-overlay-container"),$popupResponse=$(root+" .vaa-response-data");$(root+" .vaa-overlay-container .remove").click(function(){$overlay.fadeOut("fast",function(){$(this).remove()})});$document.on("mouseup",function(e){$(root+" .vaa-overlay-container").each(function(){if(!$(this).is(e.target)&&0===$(this).has(e.target).length){$overlay.fadeOut("fast",function(){$(this).remove()})}})});var textarea=$("textarea",$popupResponse);if(textarea.length){textarea.on("click",function(){$(this).select()})}var popupMaxHeight=function(){if(textarea.length){textarea.each(function(){$(this).css({height:"auto","overflow-y":"hidden"}).height(this.scrollHeight)})}var maxHeight=$overlay.height()*.8-24;$overlayContainer.css("max-height",maxHeight);$popupResponse.css("max-height",maxHeight)};popupMaxHeight();$window.on("resize",function(){popupMaxHeight()})};VAA_View_Admin_As.init_settings=function(){var root=VAA_View_Admin_As.root+"-settings",prefix="vaa-settings",root_prefix=VAA_View_Admin_As.prefix+root;$document.on("change",root_prefix+"-admin-menu-location select#"+prefix+"-admin-menu-location",function(e){e.preventDefault();var val=$(this).val();if(val&&""!==val){var view_data={user_setting:{admin_menu_location:val}};VAA_View_Admin_As.ajax(view_data,true)}});$document.on("change",root_prefix+"-view-mode input.radio."+prefix+"-view-mode",function(e){e.preventDefault();var val=$(this).val();if(val&&""!==val){var view_data={user_setting:{view_mode:val}};VAA_View_Admin_As.ajax(view_data,false)}});$document.on("change",root_prefix+"-force-group-users input#"+prefix+"-force-group-users",function(e){e.preventDefault();var view_data={user_setting:{force_group_users:"no"}};if(this.checked){view_data={user_setting:{force_group_users:"yes"}}}VAA_View_Admin_As.ajax(view_data,true)});$document.on("change",root_prefix+"-hide-front input#"+prefix+"-hide-front",function(e){e.preventDefault();var view_data={user_setting:{hide_front:"no"}};if(this.checked){view_data={user_setting:{hide_front:"yes"}}}VAA_View_Admin_As.ajax(view_data,false)});$document.on("change",root_prefix+"-freeze-locale input#"+prefix+"-freeze-locale",function(e){e.preventDefault();var view_data={user_setting:{freeze_locale:"no"}};if(this.checked){view_data={user_setting:{freeze_locale:"yes"}}}var reload=false;if("object"===typeof VAA_View_Admin_As.view&&"undefined"!==typeof VAA_View_Admin_As.view.user){reload=true}VAA_View_Admin_As.ajax(view_data,reload)})};VAA_View_Admin_As.init_users=function(){var root=VAA_View_Admin_As.root+"-users",root_prefix=VAA_View_Admin_As.prefix+root;$document.on("keyup",root_prefix+" .ab-vaa-search.search-users input",function(){$(VAA_View_Admin_As.prefix+" .ab-vaa-search .ab-vaa-results").empty();if(1<=$(this).val().length){var inputText=$(this).val();$(VAA_View_Admin_As.prefix+".vaa-user-item").each(function(){var name=$(".ab-item",this).text();if(-1('+role+")")}}});if(""===$.trim($(VAA_View_Admin_As.prefix+".ab-vaa-search .ab-vaa-results").html())){$(VAA_View_Admin_As.prefix+".ab-vaa-search .ab-vaa-results").append('
    '+VAA_View_Admin_As.__no_users_found+"
    ")}}})};VAA_View_Admin_As.init_caps=function(){var root=VAA_View_Admin_As.root+"-caps",root_prefix=VAA_View_Admin_As.prefix+root;VAA_View_Admin_As.caps_filter_settings={selectedRole:"default",selectedRoleCaps:{},selectedRoleReverse:false,filterString:""};VAA_View_Admin_As.filter_capabilities=function(){var reverse=true===VAA_View_Admin_As.caps_filter_settings.selectedRoleReverse,isDefault="default"===VAA_View_Admin_As.caps_filter_settings.selectedRole,filterString=VAA_View_Admin_As.caps_filter_settings.filterString;$(root_prefix+"-select-options .vaa-cap-item").each(function(){var $this=$(this),exists=$("input",this).attr("value")in VAA_View_Admin_As.caps_filter_settings.selectedRoleCaps,name;$this.hide();if(reverse||exists||isDefault){if(1<=filterString.length){name=$this.text();if(-1 .ab-sub-wrapper").addClass("fullPopup");VAA_View_Admin_As.autoMaxHeight()});$document.on("click",root_prefix+" #close-caps-popup",function(){$(VAA_View_Admin_As.prefix).removeClass("fullPopupActive");$(root_prefix+"-manager > .ab-sub-wrapper").removeClass("fullPopup");VAA_View_Admin_As.autoMaxHeight()});$document.on("change",root_prefix+" .ab-vaa-select.select-role-caps select",function(){VAA_View_Admin_As.caps_filter_settings.selectedRole=$(this).val();if("default"===VAA_View_Admin_As.caps_filter_settings.selectedRole){VAA_View_Admin_As.caps_filter_settings.selectedRoleCaps={};VAA_View_Admin_As.caps_filter_settings.selectedRoleReverse=false}else{var selectedRoleElement=$(root_prefix+'-selectrolecaps #vaa-caps-selectrolecaps option[value="'+VAA_View_Admin_As.caps_filter_settings.selectedRole+'"]');VAA_View_Admin_As.caps_filter_settings.selectedRoleCaps=JSON.parse(selectedRoleElement.attr("data-caps"));VAA_View_Admin_As.caps_filter_settings.selectedRoleReverse=1===parseInt(selectedRoleElement.attr("data-reverse"),10)}VAA_View_Admin_As.filter_capabilities()});$document.on("keyup",root_prefix+" .ab-vaa-filter input",function(){VAA_View_Admin_As.caps_filter_settings.filterString=$(this).val();VAA_View_Admin_As.filter_capabilities()});$document.on("click touchend",root_prefix+" button#select-all-caps",function(e){if(true===VAA_View_Admin_As._touchmove){return}e.preventDefault();$(root_prefix+"-select-options .vaa-cap-item").each(function(){if($(this).is(":visible")){$("input",this).prop("checked",true)}});return false});$document.on("click touchend",root_prefix+" button#deselect-all-caps",function(e){if(true===VAA_View_Admin_As._touchmove){return}e.preventDefault();$(root_prefix+"-select-options .vaa-cap-item").each(function(){if($(this).is(":visible")){$("input",this).prop("checked",false)}});return false});$document.on("click touchend",root_prefix+" button#apply-caps-view",function(e){if(true===VAA_View_Admin_As._touchmove){return}e.preventDefault();var newCaps=VAA_View_Admin_As.get_selected_capabilities();VAA_View_Admin_As.ajax({caps:newCaps},true);return false})};VAA_View_Admin_As.init_module_role_defaults=function(){var root=VAA_View_Admin_As.root+"-settings",prefix="vaa-settings",root_prefix=VAA_View_Admin_As.prefix+root;$document.on("change",root_prefix+"-role-defaults-enable input#"+prefix+"-role-defaults-enable",function(e){e.preventDefault();var view_data={role_defaults:{enable:0}};if(this.checked){view_data={role_defaults:{enable:true}}}VAA_View_Admin_As.ajax(view_data,true)});root=VAA_View_Admin_As.root+"-role-defaults";prefix="vaa-role-defaults";root_prefix=VAA_View_Admin_As.prefix+root;$document.on("change",root_prefix+"-setting-register-enable input#"+prefix+"-setting-register-enable",function(e){e.preventDefault();var view_data={role_defaults:{apply_defaults_on_register:0}};if(this.checked){view_data={role_defaults:{apply_defaults_on_register:true}}}VAA_View_Admin_As.ajax(view_data,false)});$document.on("change",root_prefix+"-setting-disable-user-screen-options input#"+prefix+"-setting-disable-user-screen-options",function(e){e.preventDefault();var view_data={role_defaults:{disable_user_screen_options:0}};if(this.checked){view_data={role_defaults:{disable_user_screen_options:true}}}VAA_View_Admin_As.ajax(view_data,false)});$document.on("change",root_prefix+"-setting-lock-meta-boxes input#"+prefix+"-setting-lock-meta-boxes",function(e){e.preventDefault();var view_data={role_defaults:{lock_meta_boxes:0}};if(this.checked){view_data={role_defaults:{lock_meta_boxes:true}}}VAA_View_Admin_As.ajax(view_data,false)});$document.on("click touchend",root_prefix+"-meta-add button#"+prefix+"-meta-add",function(e){if(true===VAA_View_Admin_As._touchmove){return}e.preventDefault();var val=$(root_prefix+"-meta-add input#"+prefix+"-meta-new").val();var item=$(root_prefix+"-meta-add #"+prefix+"-meta-template").html().toString();val=val.replace(/ /g,"_");item=item.replace(/vaa_new_item/g,val);if($(root_prefix+'-meta-select input[value="'+val+'"]').length){VAA_View_Admin_As.item_notice($(this).parent(),VAA_View_Admin_As.__key_already_exists,"error",2e3)}else{$(root_prefix+"-meta-select > .ab-item").prepend(item)}});$document.on("click touchend",root_prefix+"-meta-apply button#"+prefix+"-meta-apply",function(e){if(true===VAA_View_Admin_As._touchmove){return}e.preventDefault();var val={};$(root_prefix+"-meta-select .ab-item.vaa-item input").each(function(){val[$(this).val()]=$(this).is(":checked")});if(val){var view_data={role_defaults:{update_meta:val}};VAA_View_Admin_As.ajax(view_data,false)}return false});$document.on("keyup",root_prefix+"-bulk-users-filter input#"+prefix+"-bulk-users-filter",function(e){e.preventDefault();if(1<=$(this).val().length){var inputText=$(this).val();$(root_prefix+"-bulk-users-select .ab-item.vaa-item").each(function(){var name=$(".user-name",this).text();if(-1"+err+"","error")}}return false});$document.on("click touchend",root_prefix+"-clear-roles-apply button#"+prefix+"-clear-roles-apply",function(e){if(true===VAA_View_Admin_As._touchmove){return}e.preventDefault();var val=$(root_prefix+"-clear-roles-select select#"+prefix+"-clear-roles-select").val();if(val&&""!==val){var view_data={role_defaults:{clear_role_defaults:val}},confirm=VAA_View_Admin_As.item_confirm($(this).parent(),VAA_View_Admin_As.__confirm);$(confirm).on("click",function(){VAA_View_Admin_As.ajax(view_data,false)})}return false})};VAA_View_Admin_As.init_module_role_manager=function(){var root=VAA_View_Admin_As.root+"-settings",prefix="vaa-settings",root_prefix=VAA_View_Admin_As.prefix+root;$document.on("change",root_prefix+"-role-manager-enable input#"+prefix+"-role-manager-enable",function(e){e.preventDefault();var view_data={role_manager:{enable:0}};if(this.checked){view_data={role_manager:{enable:true}}}VAA_View_Admin_As.ajax(view_data,true)});root=VAA_View_Admin_As.root+"-role-manager";prefix="vaa-role-manager";root_prefix=VAA_View_Admin_As.prefix+root;$document.on("click touchend",root_prefix+"-apply-view-apply button#"+prefix+"-apply-view-apply",function(e){if(true===VAA_View_Admin_As._touchmove){return}e.preventDefault();var role=$(root_prefix+"-apply-view-select select#"+prefix+"-apply-view-select").val();var capabilities=JSON.parse($(this).attr("data-view-caps"));if(role&&""!==role&&capabilities){var view_data={role_manager:{apply_view_to_role:{role:role,capabilities:capabilities}}};VAA_View_Admin_As.ajax(view_data,true)}return false});$document.on("click touchend",root_prefix+"-rename-apply button#"+prefix+"-rename-apply",function(e){if(true===VAA_View_Admin_As._touchmove){return}e.preventDefault();var role=$(root_prefix+"-rename-select select#"+prefix+"-rename-select").val();var new_name=$(root_prefix+"-rename-input input#"+prefix+"-rename-input").val();if(role&&""!==role&&new_name&&""!==new_name){var view_data={role_manager:{rename_role:{role:role,new_name:new_name}}};VAA_View_Admin_As.ajax(view_data,true)}return false});$document.on("click touchend",root_prefix+"-clone-apply button#"+prefix+"-clone-apply",function(e){if(true===VAA_View_Admin_As._touchmove){return}e.preventDefault();var role=$(root_prefix+"-clone-select select#"+prefix+"-clone-select").val();var new_role=$(root_prefix+"-clone-input input#"+prefix+"-clone-input").val();if(role&&""!==role&&new_role&&""!==new_role){var view_data={role_manager:{clone_role:{role:role,new_role:new_role}}};VAA_View_Admin_As.ajax(view_data,true)}return false});$document.on("click touchend",root_prefix+"-delete-apply button#"+prefix+"-delete-apply",function(e){if(true===VAA_View_Admin_As._touchmove){return}e.preventDefault();var val=$(root_prefix+"-delete-select select#"+prefix+"-delete-select").val();if(val&&""!==val){var view_data={role_manager:{delete_role:val}},confirm=VAA_View_Admin_As.item_confirm($(this).parent(),VAA_View_Admin_As.__confirm);$(confirm).on("click",function(){VAA_View_Admin_As.ajax(view_data,true)})}return false});var caps_root=VAA_View_Admin_As.root+"-caps-manager-role-manager",caps_prefix="vaa-caps-manager-role-manager",caps_root_prefix=VAA_View_Admin_As.prefix+caps_root;$document.on("change",caps_root_prefix+" select#"+caps_prefix+"-edit-role",function(){var $this=$(this),role=$this.val(),caps={},selectedRoleElement=$(caps_root_prefix+" select#"+caps_prefix+'-edit-role option[value="'+role+'"]');if(selectedRoleElement.attr("data-caps")){caps=JSON.parse(selectedRoleElement.attr("data-caps"))}VAA_View_Admin_As.caps_filter_settings.selectedRole="default";VAA_View_Admin_As.caps_filter_settings.selectedRoleCaps={};VAA_View_Admin_As.caps_filter_settings.selectedRoleReverse=false;VAA_View_Admin_As.filter_capabilities();VAA_View_Admin_As.set_selected_capabilities(caps)});$document.on("click touchend",caps_root_prefix+" button#"+caps_prefix+"-save-role",function(e){if(true===VAA_View_Admin_As._touchmove){return}e.preventDefault();var role=$(caps_root_prefix+" select#"+caps_prefix+"-edit-role").val(),refresh=false;if(!role){return false}if("__new__"===role){role=$(caps_root_prefix+" input#"+caps_prefix+"-new-role").val();refresh=true}var data={role:role,capabilities:VAA_View_Admin_As.get_selected_capabilities()};VAA_View_Admin_As.ajax({role_manager:{save_role:data}},refresh);return false});$document.on("click touchend",caps_root_prefix+"-new-cap button#"+caps_prefix+"-add-cap",function(e){if(true===VAA_View_Admin_As._touchmove){return}e.preventDefault();var existing=VAA_View_Admin_As.get_selected_capabilities();var val=$(caps_root_prefix+"-new-cap input#"+caps_prefix+"-new-cap").val();var item=$(caps_root_prefix+"-new-cap #"+caps_prefix+"-cap-template").html().toString();val=val.replace(/ /g,"_");item=item.replace(/vaa_new_item/g,val);if("undefined"!==typeof existing[val]){VAA_View_Admin_As.item_notice($(this).parent(),VAA_View_Admin_As.__key_already_exists,"error",2e3)}else{$(VAA_View_Admin_As.root+"-caps-select-options > .ab-item").prepend(item)}})};VAA_View_Admin_As.autoMaxHeight=function(){setTimeout(function(){VAA_View_Admin_As.maxHeightListenerElements.each(function(){var element=$(this),count=0,wait=setInterval(function(){var offset=element.offset(),scrollTop="undefined"!==typeof window.pageYOffset?window.pageYOffset:(document.documentElement||document.body.parentNode||document.body).scrollTop,offsetTop=offset.top-scrollTop;if(element.is(":visible")&&0 array( 'role' => '', 'capabilities' => '' ), 'callback' => 'save_role', ), + 'rename_role' => array( + 'validation' => 'is_array', + 'values' => array( 'role' => '', 'new_name' => '' ), + 'callback' => 'rename_role', + ), 'clone_role' => array( 'validation' => 'is_array', 'values' => array( 'role' => '', 'new_role' => '' ), @@ -346,13 +351,41 @@ public function clone_role( $role, $new_role ) { return __( 'Role not found', VIEW_ADMIN_AS_DOMAIN ); } + /** + * Rename a role. + * + * @since 1.7 + * @access public + * @param string $role The source role slug/ID. + * @param string $new_name The new role label. + * @return bool|string + */ + public function rename_role( $role, $new_name ) { + $slug = $role; + // Do not use WP's get_role() because one can only clone a role it's allowed to see. + $role = $this->store->get_roles( $role ); + if ( $role ) { + // @todo Check https://core.trac.wordpress.org/ticket/40320. + $new_name = ucfirst( strip_tags( $new_name ) ); + + $this->wp_roles->role_objects[ $slug ]->name = $new_name; + $this->wp_roles->role_names[ $slug ] = $new_name; + $this->wp_roles->roles[ $slug ]['name'] = $new_name; + + update_option( $this->wp_roles->role_key, $this->wp_roles->roles ); + + return true; + } + return __( 'Role not found', VIEW_ADMIN_AS_DOMAIN ); + } + /** * Delete a role from the database. * * @since 1.7 * @access public * @param string $role The role name. - * @return mixed + * @return bool|string */ public function delete_role( $role ) { if ( $this->store->get_roles( $role ) ) { @@ -540,6 +573,70 @@ private function admin_bar_menu_bulk_actions( $admin_bar, $root ) { ) ); } // End if(). + /* + * Rename role. + */ + $admin_bar->add_group( array( + 'id' => $root . '-rename', + 'parent' => $root, + 'meta' => array( + 'class' => 'ab-sub-secondary', + ), + ) ); + $admin_bar->add_node( array( + 'id' => $root . '-rename-title', + 'parent' => $root . '-rename', + 'title' => VAA_View_Admin_As_Admin_Bar::do_icon( 'dashicons-edit' ) . __( 'Rename role', VIEW_ADMIN_AS_DOMAIN ), + 'href' => false, + 'meta' => array( + 'class' => 'ab-bold vaa-has-icon ab-vaa-toggle', + 'tabindex' => '0', + ), + ) ); + $admin_bar->add_node( array( + 'id' => $root . '-rename-select', + 'parent' => $root . '-rename', + 'title' => VAA_View_Admin_As_Admin_Bar::do_select( + array( + 'name' => $root . '-rename-select', + 'values' => $role_select_options, + ) + ), + 'href' => false, + 'meta' => array( + 'class' => 'ab-vaa-select select-role', + 'tabindex' => '0', + ), + ) ); + $admin_bar->add_node( array( + 'id' => $root . '-rename-input', + 'parent' => $root . '-rename', + 'title' => VAA_View_Admin_As_Admin_Bar::do_input( + array( + 'name' => $root . '-rename-input', + 'placeholder' => __( 'New role name', VIEW_ADMIN_AS_DOMAIN ), + ) + ), + 'href' => false, + 'meta' => array( + 'class' => 'ab-vaa-input rename-role', + 'tabindex' => '0', + ), + ) ); + $admin_bar->add_node( array( + 'id' => $root . '-rename-apply', + 'parent' => $root . '-rename', + 'title' => VAA_View_Admin_As_Admin_Bar::do_button( array( + 'name' => $root . '-rename-apply', + 'label' => __( 'Apply', VIEW_ADMIN_AS_DOMAIN ), + 'class' => 'button-primary', + ) ), + 'href' => false, + 'meta' => array( + 'class' => 'vaa-button-container', + ), + ) ); + /* * Clone role. */ diff --git a/view-admin-as.php b/view-admin-as.php index d366526f..da8e7461 100644 --- a/view-admin-as.php +++ b/view-admin-as.php @@ -3,7 +3,7 @@ * @author Jory Hogeveen * @package View_Admin_As * @since 0.1 - * @version 1.7 + * @version 1.7.1-dev * @licence GPL-2.0+ * @link https://github.com/JoryHogeveen/view-admin-as * @@ -11,7 +11,7 @@ * Plugin Name: View Admin As * Plugin URI: https://wordpress.org/plugins/view-admin-as/ * Description: View the WordPress admin as a different role or visitor, switch between users, temporarily change your capabilities, set default screen settings for roles. - * Version: 1.7 + * Version: 1.7.1-dev * Author: Jory Hogeveen * Author URI: https://www.keraweb.nl * Text Domain: view-admin-as @@ -46,7 +46,7 @@ if ( ! class_exists( 'VAA_View_Admin_As' ) ) { - define( 'VIEW_ADMIN_AS_VERSION', '1.7' ); + define( 'VIEW_ADMIN_AS_VERSION', '1.7.1-dev' ); define( 'VIEW_ADMIN_AS_DB_VERSION', '1.7' ); define( 'VIEW_ADMIN_AS_FILE', __FILE__ ); define( 'VIEW_ADMIN_AS_BASENAME', plugin_basename( VIEW_ADMIN_AS_FILE ) ); From 1427b942f548a0eed72b1c41158377885134d3cf Mon Sep 17 00:00:00 2001 From: JoryHogeveen Date: Thu, 30 Mar 2017 23:50:26 +0200 Subject: [PATCH 02/57] File version --- modules/class-role-manager.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/class-role-manager.php b/modules/class-role-manager.php index 9aaaf05c..e4cecf75 100644 --- a/modules/class-role-manager.php +++ b/modules/class-role-manager.php @@ -16,7 +16,7 @@ * @author Jory Hogeveen * @package View_Admin_As * @since 1.7 - * @version 1.7 + * @version 1.7.1 * @uses VAA_View_Admin_As_Module Extends class */ final class VAA_View_Admin_As_Role_Manager extends VAA_View_Admin_As_Module From 9d7e552692d6375ddd3e900fcdf4f327cb6416c9 Mon Sep 17 00:00:00 2001 From: JoryHogeveen Date: Fri, 31 Mar 2017 01:04:45 +0200 Subject: [PATCH 03/57] Role manager: change icon for "Apply current view" to be similar as the vaa icon --- modules/class-role-manager.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/modules/class-role-manager.php b/modules/class-role-manager.php index e4cecf75..b60586e8 100644 --- a/modules/class-role-manager.php +++ b/modules/class-role-manager.php @@ -514,6 +514,10 @@ private function admin_bar_menu_bulk_actions( $admin_bar, $root ) { /* * Apply current view capabilities to role. */ + $icon = 'dashicons-hidden'; + if ( $this->store->get_view() ) { + $icon = 'dashicons-visibility'; + } $admin_bar->add_group( array( 'id' => $root . '-apply-view', 'parent' => $root, @@ -524,7 +528,7 @@ private function admin_bar_menu_bulk_actions( $admin_bar, $root ) { $admin_bar->add_node( array( 'id' => $root . '-apply-view-title', 'parent' => $root . '-apply-view', - 'title' => VAA_View_Admin_As_Admin_Bar::do_icon( 'dashicons-welcome-view-site' ) . __( 'Apply current view capabilities to role', VIEW_ADMIN_AS_DOMAIN ), + 'title' => VAA_View_Admin_As_Admin_Bar::do_icon( $icon ) . __( 'Apply current view capabilities to role', VIEW_ADMIN_AS_DOMAIN ), 'href' => false, 'meta' => array( 'class' => 'ab-bold vaa-has-icon ab-vaa-toggle', From bd3c969ddee546e47452827171721ebe9ed723c6 Mon Sep 17 00:00:00 2001 From: JoryHogeveen Date: Fri, 31 Mar 2017 01:07:01 +0200 Subject: [PATCH 04/57] tabindex only needed for links --- modules/class-role-manager.php | 3 --- 1 file changed, 3 deletions(-) diff --git a/modules/class-role-manager.php b/modules/class-role-manager.php index b60586e8..a4360af1 100644 --- a/modules/class-role-manager.php +++ b/modules/class-role-manager.php @@ -472,9 +472,6 @@ public function admin_bar_menu( $admin_bar, $root ) { // Translators: %s stands for "Capabilities". 'title' => sprintf( __( 'You can add/edit roles under "%s"', VIEW_ADMIN_AS_DOMAIN ), __( 'Capabilities', VIEW_ADMIN_AS_DOMAIN ) ), 'href' => false, - 'meta' => array( - 'tabindex' => '0', - ), ) ); $this->admin_bar_menu_bulk_actions( $admin_bar, $root ); From 2c3aaf578d10f5f0c5174a0e0582f867eba07062 Mon Sep 17 00:00:00 2001 From: JoryHogeveen Date: Fri, 31 Mar 2017 02:41:24 +0200 Subject: [PATCH 05/57] Fix element overqualification --- assets/css/view-admin-as.css | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/assets/css/view-admin-as.css b/assets/css/view-admin-as.css index 0a28122f..e485025c 100644 --- a/assets/css/view-admin-as.css +++ b/assets/css/view-admin-as.css @@ -147,11 +147,6 @@ /** * Node columns */ -#wpadminbar #wp-admin-bar-vaa ul li.vaa-column-one-half {width: 50%; display: block; float: left; clear: none;} -#wpadminbar #wp-admin-bar-vaa ul li.vaa-column-one-half .ab-item {min-width: 0;} -#wpadminbar #wp-admin-bar-vaa ul li.vaa-column-one-half.vaa-column-first .ab-item {padding-right: 1px;} -#wpadminbar #wp-admin-bar-vaa ul li.vaa-column-one-half.vaa-column-last .ab-item {padding-left: 1px;} -#wpadminbar #wp-admin-bar-vaa ul li.vaa-clear-float {clear: both;} /** * Buttons @@ -161,7 +156,11 @@ #wpadminbar #wp-admin-bar-vaa .vaa-icon {padding: 0 2px 1px;} #wpadminbar #wp-admin-bar-vaa .vaa-icon .ab-icon {margin: 0;} #wpadminbar #wp-admin-bar-vaa button.vaa-icon .ab-icon {padding: 0;} -#wpadminbar #wp-admin-bar-vaa button#reset-view {margin: 0 0 5px;} +#wpadminbar #wp-admin-bar-vaa .vaa-column-one-half {width: 50%; display: block; float: left; clear: none;} +#wpadminbar #wp-admin-bar-vaa .vaa-column-one-half .ab-item {min-width: 0;} +#wpadminbar #wp-admin-bar-vaa .vaa-column-one-half.vaa-column-first .ab-item {padding-right: 1px;} +#wpadminbar #wp-admin-bar-vaa .vaa-column-one-half.vaa-column-last .ab-item {padding-left: 1px;} +#wpadminbar #wp-admin-bar-vaa .vaa-clear-float {clear: both;} /** * Toggle From 884ade81cbf98aea3daf34de4adf865be81f9e4e Mon Sep 17 00:00:00 2001 From: JoryHogeveen Date: Fri, 31 Mar 2017 02:41:45 +0200 Subject: [PATCH 06/57] Improve CSS order and add comments --- assets/css/view-admin-as.css | 59 ++++++++++++++++++++++-------------- 1 file changed, 36 insertions(+), 23 deletions(-) diff --git a/assets/css/view-admin-as.css b/assets/css/view-admin-as.css index e485025c..e9af885e 100644 --- a/assets/css/view-admin-as.css +++ b/assets/css/view-admin-as.css @@ -5,7 +5,7 @@ * @author Jory Hogeveen * @package View_Admin_As * @since 1.1 - * @version 1.7 + * @version 1.7.1 * @preserve */ @@ -49,16 +49,6 @@ #wpadminbar #wp-admin-bar-vaa ul li, #wpadminbar #wp-admin-bar-vaa .ab-item {clear: both;} -#wpadminbar #wp-admin-bar-vaa > .ab-item > .ab-label {float: left;} /* IE fix */ -#wpadminbar #wp-admin-bar-vaa > .ab-item > .ab-icon {float: right; margin-right: 0; margin-left: 6px; top: 2px;} -#wpadminbar #wp-admin-bar-vaa .vaa-has-icon > .ab-item > .ab-icon {float: none; font-size: 16px; line-height: 16px; vertical-align: text-bottom; font-weight: normal; padding: 0;} -#wpadminbar #wp-admin-bar-vaa .vaa-has-icon > .ab-item::before {display: none;} -#wpadminbar #wp-admin-bar-vaa .vaa-has-icon.menupop > .ab-item {padding-left: 10px; padding-right: 10px;} -#wpadminbar #wp-admin-bar-vaa .vaa-has-icon.ab-vaa-title > .ab-item > .ab-icon {font-size: 18px; line-height: 20px; margin: 0 5px 0 -1px;} - -#wpadminbar #wp-admin-bar-vaa button > .ab-icon {margin: 0 5px 0 -5px; padding: 0; top: 0;} -#wpadminbar #wp-admin-bar-vaa .ab-item > label + button {margin: 0 0 0 12px; vertical-align: baseline;} - #wpadminbar #wp-admin-bar-vaa .ab-sub-wrapper .ab-item > span {line-height: 26px;} #wpadminbar #wp-admin-bar-vaa .ab-item > span.remove {font-size: 16px; line-height: 16px; top: 1px;} @@ -73,11 +63,10 @@ #wpadminbar #wp-admin-bar-vaa .ab-vaa-results {margin: 6px 0; padding: 0;} #wpadminbar #wp-admin-bar-vaa .ab-vaa-results:empty {display: none;} -#wpadminbar #wp-admin-bar-vaa.menupop ul.ab-sub-secondary {position: static;} -#wpadminbar #wp-admin-bar-vaa.menupop .menupop > .ab-item:before {top: 1px;} - +/* Auto add spacing to first level sub groups */ #wpadminbar #wp-admin-bar-vaa .ab-vaa-spacing-top, #wpadminbar #wp-admin-bar-vaa > div > ul.ab-sub-secondary + ul.ab-sub-secondary {margin-top: 3px;} +/* Auto remove spacing from second level sub groups */ #wpadminbar #wp-admin-bar-vaa .ab-sub-wrapper .ab-sub-wrapper ul.ab-sub-secondary + ul.ab-sub-secondary {padding-top: 0;} #wpadminbar #wp-admin-bar-vaa .auto-height > .ab-item {height: auto;} @@ -85,7 +74,10 @@ #wpadminbar #wp-admin-bar-vaa .ab-item .description {height: auto; line-height: 1.2; font-size: 0.8em; font-style: italic; margin-bottom: 7px; white-space: normal;} #wpadminbar #wp-admin-bar-vaa .ab-item .description:first-child {margin-bottom: 0;} +/* First level group titles */ #wpadminbar #wp-admin-bar-vaa.menupop .ab-vaa-title .ab-item {font-weight: bold; line-height: 26px; font-size: 1.1em; text-transform: uppercase;} + +/* Current view items */ #wpadminbar #wp-admin-bar-vaa .current > .ab-item, #wpadminbar #wp-admin-bar-vaa .current > .ab-item .vaa-view-data, #wpadminbar #wp-admin-bar-vaa .current > input:checked + label, @@ -95,9 +87,39 @@ #wpadminbar #wp-admin-bar-vaa .current > .ab-item::after, #wpadminbar #wp-admin-bar-vaa .current > label::after {content: '\f177'; font-family: 'dashicons'; margin: 0 5px; font-size: 17px; vertical-align: middle; font-weight: normal;} +/** + * Icon fixes + */ +#wpadminbar #wp-admin-bar-vaa > .ab-item > .ab-label {float: left;} /* IE fix */ +#wpadminbar #wp-admin-bar-vaa > .ab-item > .ab-icon {float: right; margin-right: 0; margin-left: 6px; top: 2px;} +#wpadminbar #wp-admin-bar-vaa .vaa-has-icon > .ab-item > .ab-icon {float: none; font-size: 16px; line-height: 16px; vertical-align: text-bottom; font-weight: normal; padding: 0;} +#wpadminbar #wp-admin-bar-vaa .vaa-has-icon > .ab-item::before {display: none;} +#wpadminbar #wp-admin-bar-vaa .vaa-has-icon.menupop > .ab-item {padding-left: 10px; padding-right: 10px;} +#wpadminbar #wp-admin-bar-vaa .vaa-has-icon.ab-vaa-title > .ab-item > .ab-icon {font-size: 18px; line-height: 20px; margin: 0 5px 0 -1px;} + +/* Subgroups with icons */ #wpadminbar .ab-top-secondary .menupop .vaa-menupop > .ab-item {padding-left: 2em; padding-right: 1em;} #wpadminbar .ab-top-secondary .menupop .vaa-menupop > .ab-item .ab-icon {margin-left: -20px; margin-right: 4px;} +#wpadminbar #wp-admin-bar-vaa.menupop ul.ab-sub-secondary {position: static;} +#wpadminbar #wp-admin-bar-vaa.menupop .menupop > .ab-item:before {top: 1px;} + +/** + * Buttons + */ +#wpadminbar #wp-admin-bar-vaa button > .ab-icon {margin: 0 5px 0 -5px; padding: 0; top: 0;} +#wpadminbar #wp-admin-bar-vaa .ab-item > label + button {margin: 0 0 0 12px; vertical-align: baseline;} + +#wpadminbar #wp-admin-bar-vaa .vaa-button-container > .ab-item {overflow: hidden; height: auto;} +#wpadminbar #wp-admin-bar-vaa button {float: none; text-decoration: none; font-size: 13px; line-height: 20px; height: 20px; margin: 3px 0; padding: 0 10px 1px; vertical-align: middle; cursor: pointer;} + +/** + * Button icon fixes + */ +#wpadminbar #wp-admin-bar-vaa .vaa-icon {padding: 0 2px 1px;} +#wpadminbar #wp-admin-bar-vaa .vaa-icon .ab-icon {margin: 0;} +#wpadminbar #wp-admin-bar-vaa button.vaa-icon .ab-icon {padding: 0;} + /** * Form elements */ @@ -147,15 +169,6 @@ /** * Node columns */ - -/** - * Buttons - */ -#wpadminbar #wp-admin-bar-vaa .vaa-button-container > .ab-item {overflow: hidden; height: auto;} -#wpadminbar #wp-admin-bar-vaa button {float: none; text-decoration: none; font-size: 13px; line-height: 20px; height: 20px; margin: 3px 0; padding: 0 10px 1px; vertical-align: middle; cursor: pointer;} -#wpadminbar #wp-admin-bar-vaa .vaa-icon {padding: 0 2px 1px;} -#wpadminbar #wp-admin-bar-vaa .vaa-icon .ab-icon {margin: 0;} -#wpadminbar #wp-admin-bar-vaa button.vaa-icon .ab-icon {padding: 0;} #wpadminbar #wp-admin-bar-vaa .vaa-column-one-half {width: 50%; display: block; float: left; clear: none;} #wpadminbar #wp-admin-bar-vaa .vaa-column-one-half .ab-item {min-width: 0;} #wpadminbar #wp-admin-bar-vaa .vaa-column-one-half.vaa-column-first .ab-item {padding-right: 1px;} From 56110f3310fe61a9b813e4f5b546418ed4a7389b Mon Sep 17 00:00:00 2001 From: JoryHogeveen Date: Fri, 31 Mar 2017 19:13:54 +0200 Subject: [PATCH 07/57] sanitize_role_slug() helper method --- modules/class-role-manager.php | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/modules/class-role-manager.php b/modules/class-role-manager.php index a4360af1..a69ad8d7 100644 --- a/modules/class-role-manager.php +++ b/modules/class-role-manager.php @@ -277,8 +277,8 @@ public function save_role( $role, $capabilities ) { $capabilities = array_map( 'boolval', $capabilities ); if ( ! $existing_role ) { - // Sanitize role key. - $role = str_replace( array( ' ', '-' ), '_', sanitize_title_with_dashes( $role ) ); + // Sanitize role slug/key. + $role = self::sanitize_role_slug( $role ); // Recheck for an existing role. $existing_role = get_role( $role ); } @@ -398,6 +398,22 @@ public function delete_role( $role ) { return __( 'Role not found', VIEW_ADMIN_AS_DOMAIN ); } + /** + * Convert role name/label into a role slug. + * Similar to sanitize_key but it converts spaces and dashed to underscores. + * + * @since 1.7.1 + * @access public + * @param string $role_name The role name/label. + * @return string + */ + public static function sanitize_role_slug( $role_name ) { + $role_name = sanitize_title_with_dashes( $role_name ); + $role_name = str_replace( array( ' ', '-' ), '_', $role_name ); + //$role_name = sanitize_key( $role_name ); + return $role_name; + } + /** * Add admin bar setting items. * From 47c2e8471a776708320405ad390e1d94c2265458 Mon Sep 17 00:00:00 2001 From: JoryHogeveen Date: Fri, 31 Mar 2017 19:14:40 +0200 Subject: [PATCH 08/57] Add the default role names/keys for reference. --- modules/class-role-manager.php | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/modules/class-role-manager.php b/modules/class-role-manager.php index a69ad8d7..03fe320f 100644 --- a/modules/class-role-manager.php +++ b/modules/class-role-manager.php @@ -518,6 +518,18 @@ private function admin_bar_menu_bulk_actions( $admin_bar, $root ) { ), ); foreach ( $this->store->get_rolenames() as $role_key => $role_name ) { + // Add the default role names/keys for reference. + $desc = array(); + $org_name = $this->store->get_rolenames( $role_key, false ); + if ( $org_name !== $role_name ) { + $desc[] = $org_name; + } + if ( self::sanitize_role_slug( $org_name ) !== $role_key ) { + $desc[] = $role_key; + } + if ( $desc ) { + $role_name .= '   (' . implode( ', ', $desc ) . ')'; + } $role_select_options[ $role_key ] = array( 'value' => esc_attr( $role_key ), 'label' => esc_html( $role_name ), From a148029e6167c4dbc9fcbae94d43c452d7abdb33 Mon Sep 17 00:00:00 2001 From: JoryHogeveen Date: Fri, 31 Mar 2017 19:15:12 +0200 Subject: [PATCH 09/57] Do not use tabindex when the node contains form elements. --- modules/class-role-manager.php | 7 ------- 1 file changed, 7 deletions(-) diff --git a/modules/class-role-manager.php b/modules/class-role-manager.php index 03fe320f..ebfabcdf 100644 --- a/modules/class-role-manager.php +++ b/modules/class-role-manager.php @@ -574,7 +574,6 @@ private function admin_bar_menu_bulk_actions( $admin_bar, $root ) { 'href' => false, 'meta' => array( 'class' => 'ab-vaa-select select-role', - 'tabindex' => '0', ), ) ); $admin_bar->add_node( array( @@ -634,7 +633,6 @@ private function admin_bar_menu_bulk_actions( $admin_bar, $root ) { 'href' => false, 'meta' => array( 'class' => 'ab-vaa-select select-role', - 'tabindex' => '0', ), ) ); $admin_bar->add_node( array( @@ -649,7 +647,6 @@ private function admin_bar_menu_bulk_actions( $admin_bar, $root ) { 'href' => false, 'meta' => array( 'class' => 'ab-vaa-input rename-role', - 'tabindex' => '0', ), ) ); $admin_bar->add_node( array( @@ -698,7 +695,6 @@ private function admin_bar_menu_bulk_actions( $admin_bar, $root ) { 'href' => false, 'meta' => array( 'class' => 'ab-vaa-select select-role', - 'tabindex' => '0', ), ) ); $admin_bar->add_node( array( @@ -713,7 +709,6 @@ private function admin_bar_menu_bulk_actions( $admin_bar, $root ) { 'href' => false, 'meta' => array( 'class' => 'ab-vaa-input clone-role', - 'tabindex' => '0', ), ) ); $admin_bar->add_node( array( @@ -763,7 +758,6 @@ private function admin_bar_menu_bulk_actions( $admin_bar, $root ) { 'href' => false, 'meta' => array( 'class' => 'ab-vaa-select select-role', - 'tabindex' => '0', ), ) ); $admin_bar->add_node( array( @@ -866,7 +860,6 @@ public function admin_bar_menu_caps( $admin_bar, $root ) { 'href' => false, 'meta' => array( 'class' => 'ab-vaa-select', - 'tabindex' => '0', ), ) ); From 786babc4cc810df19d150ad8824af55930bcf5aa Mon Sep 17 00:00:00 2001 From: JoryHogeveen Date: Fri, 31 Mar 2017 19:55:02 +0200 Subject: [PATCH 10/57] Force icon font weight. Some were overwritten by .ab-bold --- assets/css/view-admin-as.css | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/assets/css/view-admin-as.css b/assets/css/view-admin-as.css index e9af885e..a96110e4 100644 --- a/assets/css/view-admin-as.css +++ b/assets/css/view-admin-as.css @@ -92,7 +92,7 @@ */ #wpadminbar #wp-admin-bar-vaa > .ab-item > .ab-label {float: left;} /* IE fix */ #wpadminbar #wp-admin-bar-vaa > .ab-item > .ab-icon {float: right; margin-right: 0; margin-left: 6px; top: 2px;} -#wpadminbar #wp-admin-bar-vaa .vaa-has-icon > .ab-item > .ab-icon {float: none; font-size: 16px; line-height: 16px; vertical-align: text-bottom; font-weight: normal; padding: 0;} +#wpadminbar #wp-admin-bar-vaa .vaa-has-icon > .ab-item > .ab-icon {float: none; font-size: 16px; line-height: 16px; vertical-align: text-bottom; font-weight: normal !important; padding: 0;} #wpadminbar #wp-admin-bar-vaa .vaa-has-icon > .ab-item::before {display: none;} #wpadminbar #wp-admin-bar-vaa .vaa-has-icon.menupop > .ab-item {padding-left: 10px; padding-right: 10px;} #wpadminbar #wp-admin-bar-vaa .vaa-has-icon.ab-vaa-title > .ab-item > .ab-icon {font-size: 18px; line-height: 20px; margin: 0 5px 0 -1px;} From e08090f6ad01cc477529843e1ca1be03be1716a0 Mon Sep 17 00:00:00 2001 From: JoryHogeveen Date: Wed, 5 Apr 2017 15:13:12 +0200 Subject: [PATCH 11/57] New icon for capabilities --- ui/class-admin-bar.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ui/class-admin-bar.php b/ui/class-admin-bar.php index ac7e5fc3..97c92d67 100644 --- a/ui/class-admin-bar.php +++ b/ui/class-admin-bar.php @@ -546,7 +546,7 @@ public function admin_bar_menu_caps( $admin_bar ) { $admin_bar->add_node( array( 'id' => $root . '-title', 'parent' => $root, - 'title' => self::do_icon( 'dashicons-admin-generic' ) . __( 'Capabilities', VIEW_ADMIN_AS_DOMAIN ), + 'title' => self::do_icon( 'dashicons-forms' ) . __( 'Capabilities', VIEW_ADMIN_AS_DOMAIN ), 'href' => false, 'meta' => array( 'class' => 'vaa-has-icon ab-vaa-title ab-vaa-toggle active', From 465985f2ef5a98d6aa7913167481f1f2a956c363 Mon Sep 17 00:00:00 2001 From: JoryHogeveen Date: Wed, 5 Apr 2017 15:13:25 +0200 Subject: [PATCH 12/57] Combine if statements --- includes/class-store.php | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/includes/class-store.php b/includes/class-store.php index 358db90f..c0044c46 100644 --- a/includes/class-store.php +++ b/includes/class-store.php @@ -342,17 +342,16 @@ public function store_users() { * * @since 1.6.3 */ - if ( is_multisite() && ! $is_superior_admin ) { - if ( is_array( $super_admins ) && ! empty( $super_admins[0] ) ) { - - // Escape usernames just to be sure. - $super_admins = array_filter( $super_admins, 'validate_username' ); - // Pre WP 4.4 - Remove empty usernames since these return true before WP 4.4. - $super_admins = array_filter( $super_admins ); - - $exclude_siblings = "'" . implode( "','", $super_admins ) . "'"; - $user_query['where'] .= " AND users.user_login NOT IN ({$exclude_siblings})"; - } + if ( is_multisite() && ! $is_superior_admin && + is_array( $super_admins ) && ! empty( $super_admins[0] ) + ) { + // Escape usernames just to be sure. + $super_admins = array_filter( $super_admins, 'validate_username' ); + // Pre WP 4.4 - Remove empty usernames since these return true before WP 4.4. + $super_admins = array_filter( $super_admins ); + + $exclude_siblings = "'" . implode( "','", $super_admins ) . "'"; + $user_query['where'] .= " AND users.user_login NOT IN ({$exclude_siblings})"; } // Run query (OBJECT_K to set the user ID as key). From 97299d73f0fe1e73d6e9e80ce161e98c37a4d728 Mon Sep 17 00:00:00 2001 From: JoryHogeveen Date: Wed, 5 Apr 2017 15:14:10 +0200 Subject: [PATCH 13/57] JSdoc and remove extra lines --- assets/js/view-admin-as.js | 54 ++++++++++++++++++-------------------- 1 file changed, 25 insertions(+), 29 deletions(-) diff --git a/assets/js/view-admin-as.js b/assets/js/view-admin-as.js index bf845094..da6ab3d1 100644 --- a/assets/js/view-admin-as.js +++ b/assets/js/view-admin-as.js @@ -83,8 +83,8 @@ if ( 'undefined' === typeof VAA_View_Admin_As ) { /** * BASE INIT. * @since 1.5.1 - * @return {null} nothing - **/ + * @return {null} Nothing. + */ VAA_View_Admin_As.init = function() { VAA_View_Admin_As.init_caps(); @@ -195,7 +195,7 @@ if ( 'undefined' === typeof VAA_View_Admin_As ) { // @since 1.6.2 Process basic views. $.each( VAA_View_Admin_As.view_types, function( index, type ) { - $document.on( 'click touchend', VAA_View_Admin_As.prefix + '.vaa-'+type+'-item > a.ab-item', function( e ) { + $document.on( 'click touchend', VAA_View_Admin_As.prefix + '.vaa-' + type + '-item > a.ab-item', function( e ) { if ( true === VAA_View_Admin_As._touchmove ) { return; } @@ -233,8 +233,8 @@ if ( 'undefined' === typeof VAA_View_Admin_As ) { /** * MOBILE INIT. * @since 1.7 - * @return {null} nothing - **/ + * @return {null} Nothing. + */ VAA_View_Admin_As.mobile = function() { var prefix = '.vaa-mobile ' + VAA_View_Admin_As.prefix; @@ -257,10 +257,10 @@ if ( 'undefined' === typeof VAA_View_Admin_As ) { } } ); - /* + /** * @since 1.7 Mimic default form handling because this gets overwritten by WP core. - **/ - // Form elements + */ + // Form elements. $document.on( 'click touchend', prefix + 'input, ' + prefix + 'textarea, ' + prefix + 'select', function( e ) { if ( true === VAA_View_Admin_As._touchmove ) { return; @@ -268,7 +268,7 @@ if ( 'undefined' === typeof VAA_View_Admin_As ) { e.stopPropagation(); var $this = $(this); if ( $this.is('[type="checkbox"]') ) { - // Checkboxes + // Checkboxes. e.preventDefault(); if ( $this.is(':checked') ) { $this.prop( 'checked', false ); @@ -278,7 +278,7 @@ if ( 'undefined' === typeof VAA_View_Admin_As ) { $this.trigger('change'); return false; } else if ( $this.is('[type="radio"]') ) { - // Radio + // Radio. e.preventDefault(); $('input[name="' + $this.attr['name'] + '"]').removeAttr('checked'); $this.prop( 'checked', true ); @@ -287,7 +287,7 @@ if ( 'undefined' === typeof VAA_View_Admin_As ) { } return true; } ); - // Labels + // Labels. $document.on( 'click touchend', prefix + 'label', function( e ) { if ( true === VAA_View_Admin_As._touchmove ) { return; @@ -302,7 +302,7 @@ if ( 'undefined' === typeof VAA_View_Admin_As ) { /** * Add an overlay. * - * @param {string} html The content to show in the overlay + * @param {string} html The content to show in the overlay. * @return {null} Nothing. */ VAA_View_Admin_As.overlay = function( html ) { @@ -415,11 +415,11 @@ if ( 'undefined' === typeof VAA_View_Admin_As ) { }; /** - * Reload the page or optionally redirect the user + * Reload the page or optionally redirect the user. * @since 1.7 * @see VAA_View_Admin_As.ajax * @param {object} data Info for the redirect: { redirect: URL } - * @return {null} Nothing + * @return {null} Nothing. */ VAA_View_Admin_As.refresh = function( data ) { if ( data.hasOwnProperty( 'redirect' ) ) { @@ -460,7 +460,7 @@ if ( 'undefined' === typeof VAA_View_Admin_As ) { html = ''; $( VAA_View_Admin_As.prefix + '> .ab-sub-wrapper').prepend( html ).children('.vaa-notice').slideDown( 'fast' ); $( 'html, body' ).animate( { scrollTop: '0' } ); - // Remove it after # seconds + // Remove it after # seconds. if ( timeout ) { setTimeout( function () { $( root ).slideUp( 'fast', function () { $( this ).remove(); } ); }, timeout ); } @@ -469,7 +469,7 @@ if ( 'undefined' === typeof VAA_View_Admin_As ) { html = '
  • ' + html + '
  • '; $('#wp-admin-bar-top-secondary').append( html ); $( root + ' .remove' ).click( function() { $(this).parent().remove(); } ); - // Remove it after # seconds + // Remove it after # seconds. if ( timeout ) { setTimeout( function () { $( root ).fadeOut( 'fast', function () { $( this ).remove(); } ); }, timeout ); } @@ -497,7 +497,7 @@ if ( 'undefined' === typeof VAA_View_Admin_As ) { html = ''; $element.append( html ).children('.vaa-notice').slideDown( 'fast' ); - // Remove it after # seconds + // Remove it after # seconds. if ( timeout ) { setTimeout( function(){ $( root, $element ).slideUp( 'fast', function() { $(this).remove(); } ); }, timeout ); } @@ -518,7 +518,6 @@ if ( 'undefined' === typeof VAA_View_Admin_As ) { return $( parent ).find( '.vaa-confirm' ); }; - /** * Show popup with return content. * @since 1.5 @@ -531,7 +530,7 @@ if ( 'undefined' === typeof VAA_View_Admin_As ) { type = ( 'undefined' === typeof type ) ? 'notice' : type; /* - * Build overlay HTML + * Build overlay HTML. */ var html = ''; @@ -544,11 +543,11 @@ if ( 'undefined' === typeof VAA_View_Admin_As ) { data = { text: data }; } - // Simple text + // Simple text. if ( data.hasOwnProperty( 'text' ) ) { html += '

    ' + String( data.text ) + '

    '; } - // List items + // List items. if ( data.hasOwnProperty( 'list' ) ) { html += '
      '; data.list.forEach( function( item ) { @@ -556,7 +555,7 @@ if ( 'undefined' === typeof VAA_View_Admin_As ) { } ); html += '
    '; } - // Textarea + // Textarea. if ( data.hasOwnProperty( 'textarea' ) ) { html += ''; } @@ -564,18 +563,18 @@ if ( 'undefined' === typeof VAA_View_Admin_As ) { // End: .vaa-response-data & .vaa-overlay-container html += ''; - // Trigger the overlay + // Trigger the overlay. VAA_View_Admin_As.overlay( html ); /* - * Overlay handlers + * Overlay handlers. */ var root = 'body #vaa-overlay', $overlay = $( root ), $overlayContainer = $( root + ' .vaa-overlay-container' ), $popupResponse = $( root + ' .vaa-response-data' ); - // Remove overlay + // Remove overlay. $( root + ' .vaa-overlay-container .remove' ).click( function() { $overlay.fadeOut( 'fast', function() { $(this).remove(); } ); } ); @@ -612,7 +611,6 @@ if ( 'undefined' === typeof VAA_View_Admin_As ) { }); }; - /** * SETTINGS. * @since 1.5 @@ -679,7 +677,6 @@ if ( 'undefined' === typeof VAA_View_Admin_As ) { } ); }; - /** * USERS. * Extra functions for user views. @@ -724,7 +721,6 @@ if ( 'undefined' === typeof VAA_View_Admin_As ) { } ); }; - /** * CAPABILITIES. * @since 1.3 @@ -839,7 +835,6 @@ if ( 'undefined' === typeof VAA_View_Admin_As ) { VAA_View_Admin_As.filter_capabilities(); } ); - // Select all capabilities. $document.on( 'click touchend', root_prefix + ' button#select-all-caps', function( e ) { if ( true === VAA_View_Admin_As._touchmove ) { @@ -853,6 +848,7 @@ if ( 'undefined' === typeof VAA_View_Admin_As ) { } ); return false; } ); + // Deselect all capabilities. $document.on( 'click touchend', root_prefix + ' button#deselect-all-caps', function( e ) { if ( true === VAA_View_Admin_As._touchmove ) { From 9e003b6fd2d015a882dfd571b20368f966d03887 Mon Sep 17 00:00:00 2001 From: JoryHogeveen Date: Wed, 5 Apr 2017 15:15:05 +0200 Subject: [PATCH 14/57] Make a new group for modules instead of nesting them under the global settings --- assets/js/view-admin-as.js | 8 +++--- assets/js/view-admin-as.min.js | 2 +- modules/class-role-defaults.php | 22 +++++---------- modules/class-role-manager.php | 22 +++++---------- ui/class-admin-bar.php | 47 +++++++++++++++++++++++++++++++++ 5 files changed, 66 insertions(+), 35 deletions(-) diff --git a/assets/js/view-admin-as.js b/assets/js/view-admin-as.js index da6ab3d1..d7ce296d 100644 --- a/assets/js/view-admin-as.js +++ b/assets/js/view-admin-as.js @@ -882,8 +882,8 @@ if ( 'undefined' === typeof VAA_View_Admin_As ) { */ VAA_View_Admin_As.init_module_role_defaults = function() { - var root = VAA_View_Admin_As.root + '-settings', - prefix = 'vaa-settings', + var root = VAA_View_Admin_As.root + '-modules', + prefix = 'vaa-modules', root_prefix = VAA_View_Admin_As.prefix + root; // Enable module. @@ -1105,8 +1105,8 @@ if ( 'undefined' === typeof VAA_View_Admin_As ) { */ VAA_View_Admin_As.init_module_role_manager = function() { - var root = VAA_View_Admin_As.root + '-settings', - prefix = 'vaa-settings', + var root = VAA_View_Admin_As.root + '-modules', + prefix = 'vaa-modules', root_prefix = VAA_View_Admin_As.prefix + root; // Enable module. diff --git a/assets/js/view-admin-as.min.js b/assets/js/view-admin-as.min.js index 9ec9f0a9..0bc77632 100644 --- a/assets/js/view-admin-as.min.js +++ b/assets/js/view-admin-as.min.js @@ -8,4 +8,4 @@ * @version 1.7.1 * @preserve */ -if("undefined"===typeof VAA_View_Admin_As){var VAA_View_Admin_As={}}(function($){var $document=$(document),$window=$(window),$body=$("body");VAA_View_Admin_As.prefix="#wpadminbar #wp-admin-bar-vaa ";VAA_View_Admin_As.root="#wp-admin-bar-vaa";VAA_View_Admin_As.maxHeightListenerElements=$(VAA_View_Admin_As.prefix+".vaa-auto-max-height");VAA_View_Admin_As._mobile=false;if(!VAA_View_Admin_As.hasOwnProperty("_debug")){VAA_View_Admin_As._debug=false}VAA_View_Admin_As._debug=Boolean(parseInt(VAA_View_Admin_As._debug,10));if(!VAA_View_Admin_As.hasOwnProperty("ajaxurl")&&"undefined"!==typeof ajaxurl){VAA_View_Admin_As.ajaxurl=ajaxurl}VAA_View_Admin_As._touchmove=false;$document.on("touchmove",function(){VAA_View_Admin_As._touchmove=true});$document.on("touchstart",function(){VAA_View_Admin_As._touchmove=false});VAA_View_Admin_As.json_decode=function(val){if(0===val.indexOf("{")){try{val=JSON.parse(val)}catch(err){}}return val};VAA_View_Admin_As.init=function(){VAA_View_Admin_As.init_caps();VAA_View_Admin_As.init_users();VAA_View_Admin_As.init_settings();VAA_View_Admin_As.init_module_role_defaults();VAA_View_Admin_As.init_module_role_manager();$window.on("load",function(){$(VAA_View_Admin_As.prefix+".ab-vaa-toggle").each(function(){var toggleContent=$(this).parent().children().not(".ab-vaa-toggle");if(!$(this).hasClass("active")){toggleContent.hide()}$(this).on("click touchend",function(e){e.preventDefault();e.stopPropagation();if(true===VAA_View_Admin_As._touchmove){return}if($(this).hasClass("active")){toggleContent.slideUp("fast");$(this).removeClass("active")}else{toggleContent.slideDown("fast");$(this).addClass("active")}VAA_View_Admin_As.autoMaxHeight()});$(this).on("keyup",function(e){e.preventDefault();var key=parseInt(e.which,10);if($(this).hasClass("active")&&(13===key||32===key||38===key)){toggleContent.slideUp("fast");$(this).removeClass("active")}else if(13===key||32===key||40===key){toggleContent.slideDown("fast");$(this).addClass("active")}VAA_View_Admin_As.autoMaxHeight()})});$(VAA_View_Admin_As.prefix+".ab-vaa-showhide[data-showhide]").each(function(){$($(this).attr("data-showhide")).hide();$(this).on("mouseenter",function(){$($(this).attr("data-showhide")).slideDown("fast")}).on("mouseleave",function(){$($(this).attr("data-showhide")).slideUp("fast")})});$(VAA_View_Admin_As.prefix+".ab-vaa-conditional[data-condition-target]").each(function(){var $this=$(this),$target=$($this.attr("data-condition-target")),compare=$this.attr("data-condition"),checkbox=$target.is(":checkbox");$this.hide();$target.on("change",function(){if(checkbox&&$target.is(":checked")){$this.slideDown("fast")}else if(!checkbox&&compare===$target.val()){$this.slideDown("fast")}else{$this.slideUp("fast")}VAA_View_Admin_As.autoMaxHeight()})});if($body.hasClass("mobile")||783>$body.innerWidth()){$body.addClass("vaa-mobile");VAA_View_Admin_As._mobile=true;VAA_View_Admin_As.mobile()}});$document.on("click touchend",VAA_View_Admin_As.prefix+".vaa-reset-item > .ab-item",function(e){e.preventDefault();if(true===VAA_View_Admin_As._touchmove){return}if("vaa_reload"===$("button",this).attr("name")){window.location.reload()}else{VAA_View_Admin_As.ajax({reset:true},true);return false}});$.each(VAA_View_Admin_As.view_types,function(index,type){$document.on("click touchend",VAA_View_Admin_As.prefix+".vaa-"+type+"-item > a.ab-item",function(e){if(true===VAA_View_Admin_As._touchmove){return}e.preventDefault();var $this=$(this);if(VAA_View_Admin_As._mobile&&$this.parent().hasClass("menupop")&&!$this.next().is(":visible")){$this.next().show().parent().addClass("active");return}if(!$this.parent().hasClass("not-a-view")){var view_data={},val=$this.attr("rel");if(!val){val=$this.find(".vaa-view-data").attr("data-view-value")}view_data[type]=VAA_View_Admin_As.json_decode(val);view_data="object"===typeof view_data[type]?view_data[type]:view_data;VAA_View_Admin_As.ajax(view_data,true);return false}})});$document.on("click touchend",VAA_View_Admin_As.prefix+".remove",function(e){e.preventDefault();if(true===VAA_View_Admin_As._touchmove){return}$(this).parent().slideUp("fast",function(){$(this).remove()})})};VAA_View_Admin_As.mobile=function(){var prefix=".vaa-mobile "+VAA_View_Admin_As.prefix;$document.on("click touchend",prefix+" > .ab-sub-wrapper .ab-item",function(e){if(true===VAA_View_Admin_As._touchmove){return}e.preventDefault();e.stopPropagation();var $sub=$(this).parent(".menupop").children(".ab-sub-wrapper");if($sub.length){if($sub.hasClass("active")){$sub.slideUp("fast");$sub.removeClass("active")}else{$sub.slideDown("fast");$sub.addClass("active")}}});$document.on("click touchend",prefix+"input, "+prefix+"textarea, "+prefix+"select",function(e){if(true===VAA_View_Admin_As._touchmove){return}e.stopPropagation();var $this=$(this);if($this.is('[type="checkbox"]')){e.preventDefault();if($this.is(":checked")){$this.prop("checked",false)}else{$this.prop("checked",true)}$this.trigger("change");return false}else if($this.is('[type="radio"]')){e.preventDefault();$('input[name="'+$this.attr["name"]+'"]').removeAttr("checked");$this.prop("checked",true);$this.trigger("change");return false}return true});$document.on("click touchend",prefix+"label",function(e){if(true===VAA_View_Admin_As._touchmove){return}e.preventDefault();e.stopPropagation();$("#"+$(this).attr("for")).trigger(e.type);return false})};VAA_View_Admin_As.overlay=function(html){var $overlay=$("#vaa-overlay");if(!$overlay.length){html='
    '+html+"
    ";$body.append(html);$overlay=$("body #vaa-overlay")}else if(html.length){$overlay.html(html)}$overlay.fadeIn("fast")};VAA_View_Admin_As.ajax=function(data,refresh){$(".vaa-notice","#wpadminbar").remove();var loader_icon=VAA_View_Admin_As.siteurl+"/wp-includes/images/spinner-2x.gif";VAA_View_Admin_As.overlay('');var post_data={action:"view_admin_as",_vaa_nonce:VAA_View_Admin_As._vaa_nonce,view_admin_as:JSON.stringify(data)};var isView=false;$.each(VAA_View_Admin_As.view_types,function(index,type){if("undefined"!==typeof data[type]){isView=true;return true}});if($(VAA_View_Admin_As.prefix+"#vaa-settings-view-mode-single").is(":checked")&&isView){$body.append('');var form=$("#vaa_single_mode_form");form.append('');form.append('');form.append('');form.find("#data").val(post_data.view_admin_as);form.submit()}else{$.post(VAA_View_Admin_As.ajaxurl,post_data,function(response){var success=response.hasOwnProperty("success")&&true===response.success,data={},display=false;if(true===VAA_View_Admin_As._debug){console.log(response)}if(response.hasOwnProperty("data")){if("object"===typeof response.data){data=response.data;if(data.hasOwnProperty("display")){display=data.display}}}if(success){if(refresh){VAA_View_Admin_As.refresh(data);return}else{if(!data.hasOwnProperty("text")){data.text=VAA_View_Admin_As.__success}}}if(!data.hasOwnProperty("type")){if(success){data.type="success"}else{data.type="error"}}if("popup"===display){VAA_View_Admin_As.popup(data,data.type)}else{if(!data.hasOwnProperty("text")){data.text=response.data}VAA_View_Admin_As.notice(String(data.text),data.type,5e3);$("body #vaa-overlay").addClass(data.type).fadeOut("fast",function(){$(this).remove()})}})}};VAA_View_Admin_As.refresh=function(data){if(data.hasOwnProperty("redirect")){window.location.replace(String(data.redirect))}else{window.location.hash="";window.location.reload()}};VAA_View_Admin_As.notice=function(notice,type,timeout){var root="#wpadminbar .vaa-notice",html=notice+'';type="undefined"===typeof type?"notice":type;timeout="undefined"===typeof timeout?5e3:timeout;if(VAA_View_Admin_As._mobile){html='";$(VAA_View_Admin_As.prefix+"> .ab-sub-wrapper").prepend(html).children(".vaa-notice").slideDown("fast");$("html, body").animate({scrollTop:"0"});if(timeout){setTimeout(function(){$(root).slideUp("fast",function(){$(this).remove()})},timeout)}}else{html='
  • '+html+"
  • ";$("#wp-admin-bar-top-secondary").append(html);$(root+" .remove").click(function(){$(this).parent().remove()});if(timeout){setTimeout(function(){$(root).fadeOut("fast",function(){$(this).remove()})},timeout)}}};VAA_View_Admin_As.item_notice=function(parent,notice,type,timeout){var root=".vaa-notice",html=notice+'',$element=$(parent);type="undefined"===typeof type?"notice":type;timeout="undefined"===typeof timeout?5e3:timeout;html='";$element.append(html).children(".vaa-notice").slideDown("fast");if(timeout){setTimeout(function(){$(root,$element).slideUp("fast",function(){$(this).remove()})},timeout)}};VAA_View_Admin_As.item_confirm=function(parent,text){$(parent).find(".vaa-notice").slideUp("fast",function(){$(this).remove()});text='";VAA_View_Admin_As.item_notice(parent,text,"warning",0);return $(parent).find(".vaa-confirm")};VAA_View_Admin_As.popup=function(data,type){type="undefined"===typeof type?"notice":type;var html="";html+='
    ';html+='';html+='
    ';if("object"!==typeof data){data={text:data}}if(data.hasOwnProperty("text")){html+="

    "+String(data.text)+"

    "}if(data.hasOwnProperty("list")){html+="
      ";data.list.forEach(function(item){html+="
    • "+String(item)+"
    • "});html+="
    "}if(data.hasOwnProperty("textarea")){html+='"}html+="
    ";VAA_View_Admin_As.overlay(html);var root="body #vaa-overlay",$overlay=$(root),$overlayContainer=$(root+" .vaa-overlay-container"),$popupResponse=$(root+" .vaa-response-data");$(root+" .vaa-overlay-container .remove").click(function(){$overlay.fadeOut("fast",function(){$(this).remove()})});$document.on("mouseup",function(e){$(root+" .vaa-overlay-container").each(function(){if(!$(this).is(e.target)&&0===$(this).has(e.target).length){$overlay.fadeOut("fast",function(){$(this).remove()})}})});var textarea=$("textarea",$popupResponse);if(textarea.length){textarea.on("click",function(){$(this).select()})}var popupMaxHeight=function(){if(textarea.length){textarea.each(function(){$(this).css({height:"auto","overflow-y":"hidden"}).height(this.scrollHeight)})}var maxHeight=$overlay.height()*.8-24;$overlayContainer.css("max-height",maxHeight);$popupResponse.css("max-height",maxHeight)};popupMaxHeight();$window.on("resize",function(){popupMaxHeight()})};VAA_View_Admin_As.init_settings=function(){var root=VAA_View_Admin_As.root+"-settings",prefix="vaa-settings",root_prefix=VAA_View_Admin_As.prefix+root;$document.on("change",root_prefix+"-admin-menu-location select#"+prefix+"-admin-menu-location",function(e){e.preventDefault();var val=$(this).val();if(val&&""!==val){var view_data={user_setting:{admin_menu_location:val}};VAA_View_Admin_As.ajax(view_data,true)}});$document.on("change",root_prefix+"-view-mode input.radio."+prefix+"-view-mode",function(e){e.preventDefault();var val=$(this).val();if(val&&""!==val){var view_data={user_setting:{view_mode:val}};VAA_View_Admin_As.ajax(view_data,false)}});$document.on("change",root_prefix+"-force-group-users input#"+prefix+"-force-group-users",function(e){e.preventDefault();var view_data={user_setting:{force_group_users:"no"}};if(this.checked){view_data={user_setting:{force_group_users:"yes"}}}VAA_View_Admin_As.ajax(view_data,true)});$document.on("change",root_prefix+"-hide-front input#"+prefix+"-hide-front",function(e){e.preventDefault();var view_data={user_setting:{hide_front:"no"}};if(this.checked){view_data={user_setting:{hide_front:"yes"}}}VAA_View_Admin_As.ajax(view_data,false)});$document.on("change",root_prefix+"-freeze-locale input#"+prefix+"-freeze-locale",function(e){e.preventDefault();var view_data={user_setting:{freeze_locale:"no"}};if(this.checked){view_data={user_setting:{freeze_locale:"yes"}}}var reload=false;if("object"===typeof VAA_View_Admin_As.view&&"undefined"!==typeof VAA_View_Admin_As.view.user){reload=true}VAA_View_Admin_As.ajax(view_data,reload)})};VAA_View_Admin_As.init_users=function(){var root=VAA_View_Admin_As.root+"-users",root_prefix=VAA_View_Admin_As.prefix+root;$document.on("keyup",root_prefix+" .ab-vaa-search.search-users input",function(){$(VAA_View_Admin_As.prefix+" .ab-vaa-search .ab-vaa-results").empty();if(1<=$(this).val().length){var inputText=$(this).val();$(VAA_View_Admin_As.prefix+".vaa-user-item").each(function(){var name=$(".ab-item",this).text();if(-1('+role+")")}}});if(""===$.trim($(VAA_View_Admin_As.prefix+".ab-vaa-search .ab-vaa-results").html())){$(VAA_View_Admin_As.prefix+".ab-vaa-search .ab-vaa-results").append('
    '+VAA_View_Admin_As.__no_users_found+"
    ")}}})};VAA_View_Admin_As.init_caps=function(){var root=VAA_View_Admin_As.root+"-caps",root_prefix=VAA_View_Admin_As.prefix+root;VAA_View_Admin_As.caps_filter_settings={selectedRole:"default",selectedRoleCaps:{},selectedRoleReverse:false,filterString:""};VAA_View_Admin_As.filter_capabilities=function(){var reverse=true===VAA_View_Admin_As.caps_filter_settings.selectedRoleReverse,isDefault="default"===VAA_View_Admin_As.caps_filter_settings.selectedRole,filterString=VAA_View_Admin_As.caps_filter_settings.filterString;$(root_prefix+"-select-options .vaa-cap-item").each(function(){var $this=$(this),exists=$("input",this).attr("value")in VAA_View_Admin_As.caps_filter_settings.selectedRoleCaps,name;$this.hide();if(reverse||exists||isDefault){if(1<=filterString.length){name=$this.text();if(-1 .ab-sub-wrapper").addClass("fullPopup");VAA_View_Admin_As.autoMaxHeight()});$document.on("click",root_prefix+" #close-caps-popup",function(){$(VAA_View_Admin_As.prefix).removeClass("fullPopupActive");$(root_prefix+"-manager > .ab-sub-wrapper").removeClass("fullPopup");VAA_View_Admin_As.autoMaxHeight()});$document.on("change",root_prefix+" .ab-vaa-select.select-role-caps select",function(){VAA_View_Admin_As.caps_filter_settings.selectedRole=$(this).val();if("default"===VAA_View_Admin_As.caps_filter_settings.selectedRole){VAA_View_Admin_As.caps_filter_settings.selectedRoleCaps={};VAA_View_Admin_As.caps_filter_settings.selectedRoleReverse=false}else{var selectedRoleElement=$(root_prefix+'-selectrolecaps #vaa-caps-selectrolecaps option[value="'+VAA_View_Admin_As.caps_filter_settings.selectedRole+'"]');VAA_View_Admin_As.caps_filter_settings.selectedRoleCaps=JSON.parse(selectedRoleElement.attr("data-caps"));VAA_View_Admin_As.caps_filter_settings.selectedRoleReverse=1===parseInt(selectedRoleElement.attr("data-reverse"),10)}VAA_View_Admin_As.filter_capabilities()});$document.on("keyup",root_prefix+" .ab-vaa-filter input",function(){VAA_View_Admin_As.caps_filter_settings.filterString=$(this).val();VAA_View_Admin_As.filter_capabilities()});$document.on("click touchend",root_prefix+" button#select-all-caps",function(e){if(true===VAA_View_Admin_As._touchmove){return}e.preventDefault();$(root_prefix+"-select-options .vaa-cap-item").each(function(){if($(this).is(":visible")){$("input",this).prop("checked",true)}});return false});$document.on("click touchend",root_prefix+" button#deselect-all-caps",function(e){if(true===VAA_View_Admin_As._touchmove){return}e.preventDefault();$(root_prefix+"-select-options .vaa-cap-item").each(function(){if($(this).is(":visible")){$("input",this).prop("checked",false)}});return false});$document.on("click touchend",root_prefix+" button#apply-caps-view",function(e){if(true===VAA_View_Admin_As._touchmove){return}e.preventDefault();var newCaps=VAA_View_Admin_As.get_selected_capabilities();VAA_View_Admin_As.ajax({caps:newCaps},true);return false})};VAA_View_Admin_As.init_module_role_defaults=function(){var root=VAA_View_Admin_As.root+"-settings",prefix="vaa-settings",root_prefix=VAA_View_Admin_As.prefix+root;$document.on("change",root_prefix+"-role-defaults-enable input#"+prefix+"-role-defaults-enable",function(e){e.preventDefault();var view_data={role_defaults:{enable:0}};if(this.checked){view_data={role_defaults:{enable:true}}}VAA_View_Admin_As.ajax(view_data,true)});root=VAA_View_Admin_As.root+"-role-defaults";prefix="vaa-role-defaults";root_prefix=VAA_View_Admin_As.prefix+root;$document.on("change",root_prefix+"-setting-register-enable input#"+prefix+"-setting-register-enable",function(e){e.preventDefault();var view_data={role_defaults:{apply_defaults_on_register:0}};if(this.checked){view_data={role_defaults:{apply_defaults_on_register:true}}}VAA_View_Admin_As.ajax(view_data,false)});$document.on("change",root_prefix+"-setting-disable-user-screen-options input#"+prefix+"-setting-disable-user-screen-options",function(e){e.preventDefault();var view_data={role_defaults:{disable_user_screen_options:0}};if(this.checked){view_data={role_defaults:{disable_user_screen_options:true}}}VAA_View_Admin_As.ajax(view_data,false)});$document.on("change",root_prefix+"-setting-lock-meta-boxes input#"+prefix+"-setting-lock-meta-boxes",function(e){e.preventDefault();var view_data={role_defaults:{lock_meta_boxes:0}};if(this.checked){view_data={role_defaults:{lock_meta_boxes:true}}}VAA_View_Admin_As.ajax(view_data,false)});$document.on("click touchend",root_prefix+"-meta-add button#"+prefix+"-meta-add",function(e){if(true===VAA_View_Admin_As._touchmove){return}e.preventDefault();var val=$(root_prefix+"-meta-add input#"+prefix+"-meta-new").val();var item=$(root_prefix+"-meta-add #"+prefix+"-meta-template").html().toString();val=val.replace(/ /g,"_");item=item.replace(/vaa_new_item/g,val);if($(root_prefix+'-meta-select input[value="'+val+'"]').length){VAA_View_Admin_As.item_notice($(this).parent(),VAA_View_Admin_As.__key_already_exists,"error",2e3)}else{$(root_prefix+"-meta-select > .ab-item").prepend(item)}});$document.on("click touchend",root_prefix+"-meta-apply button#"+prefix+"-meta-apply",function(e){if(true===VAA_View_Admin_As._touchmove){return}e.preventDefault();var val={};$(root_prefix+"-meta-select .ab-item.vaa-item input").each(function(){val[$(this).val()]=$(this).is(":checked")});if(val){var view_data={role_defaults:{update_meta:val}};VAA_View_Admin_As.ajax(view_data,false)}return false});$document.on("keyup",root_prefix+"-bulk-users-filter input#"+prefix+"-bulk-users-filter",function(e){e.preventDefault();if(1<=$(this).val().length){var inputText=$(this).val();$(root_prefix+"-bulk-users-select .ab-item.vaa-item").each(function(){var name=$(".user-name",this).text();if(-1"+err+"","error")}}return false});$document.on("click touchend",root_prefix+"-clear-roles-apply button#"+prefix+"-clear-roles-apply",function(e){if(true===VAA_View_Admin_As._touchmove){return}e.preventDefault();var val=$(root_prefix+"-clear-roles-select select#"+prefix+"-clear-roles-select").val();if(val&&""!==val){var view_data={role_defaults:{clear_role_defaults:val}},confirm=VAA_View_Admin_As.item_confirm($(this).parent(),VAA_View_Admin_As.__confirm);$(confirm).on("click",function(){VAA_View_Admin_As.ajax(view_data,false)})}return false})};VAA_View_Admin_As.init_module_role_manager=function(){var root=VAA_View_Admin_As.root+"-settings",prefix="vaa-settings",root_prefix=VAA_View_Admin_As.prefix+root;$document.on("change",root_prefix+"-role-manager-enable input#"+prefix+"-role-manager-enable",function(e){e.preventDefault();var view_data={role_manager:{enable:0}};if(this.checked){view_data={role_manager:{enable:true}}}VAA_View_Admin_As.ajax(view_data,true)});root=VAA_View_Admin_As.root+"-role-manager";prefix="vaa-role-manager";root_prefix=VAA_View_Admin_As.prefix+root;$document.on("click touchend",root_prefix+"-apply-view-apply button#"+prefix+"-apply-view-apply",function(e){if(true===VAA_View_Admin_As._touchmove){return}e.preventDefault();var role=$(root_prefix+"-apply-view-select select#"+prefix+"-apply-view-select").val();var capabilities=JSON.parse($(this).attr("data-view-caps"));if(role&&""!==role&&capabilities){var view_data={role_manager:{apply_view_to_role:{role:role,capabilities:capabilities}}};VAA_View_Admin_As.ajax(view_data,true)}return false});$document.on("click touchend",root_prefix+"-rename-apply button#"+prefix+"-rename-apply",function(e){if(true===VAA_View_Admin_As._touchmove){return}e.preventDefault();var role=$(root_prefix+"-rename-select select#"+prefix+"-rename-select").val();var new_name=$(root_prefix+"-rename-input input#"+prefix+"-rename-input").val();if(role&&""!==role&&new_name&&""!==new_name){var view_data={role_manager:{rename_role:{role:role,new_name:new_name}}};VAA_View_Admin_As.ajax(view_data,true)}return false});$document.on("click touchend",root_prefix+"-clone-apply button#"+prefix+"-clone-apply",function(e){if(true===VAA_View_Admin_As._touchmove){return}e.preventDefault();var role=$(root_prefix+"-clone-select select#"+prefix+"-clone-select").val();var new_role=$(root_prefix+"-clone-input input#"+prefix+"-clone-input").val();if(role&&""!==role&&new_role&&""!==new_role){var view_data={role_manager:{clone_role:{role:role,new_role:new_role}}};VAA_View_Admin_As.ajax(view_data,true)}return false});$document.on("click touchend",root_prefix+"-delete-apply button#"+prefix+"-delete-apply",function(e){if(true===VAA_View_Admin_As._touchmove){return}e.preventDefault();var val=$(root_prefix+"-delete-select select#"+prefix+"-delete-select").val();if(val&&""!==val){var view_data={role_manager:{delete_role:val}},confirm=VAA_View_Admin_As.item_confirm($(this).parent(),VAA_View_Admin_As.__confirm);$(confirm).on("click",function(){VAA_View_Admin_As.ajax(view_data,true)})}return false});var caps_root=VAA_View_Admin_As.root+"-caps-manager-role-manager",caps_prefix="vaa-caps-manager-role-manager",caps_root_prefix=VAA_View_Admin_As.prefix+caps_root;$document.on("change",caps_root_prefix+" select#"+caps_prefix+"-edit-role",function(){var $this=$(this),role=$this.val(),caps={},selectedRoleElement=$(caps_root_prefix+" select#"+caps_prefix+'-edit-role option[value="'+role+'"]');if(selectedRoleElement.attr("data-caps")){caps=JSON.parse(selectedRoleElement.attr("data-caps"))}VAA_View_Admin_As.caps_filter_settings.selectedRole="default";VAA_View_Admin_As.caps_filter_settings.selectedRoleCaps={};VAA_View_Admin_As.caps_filter_settings.selectedRoleReverse=false;VAA_View_Admin_As.filter_capabilities();VAA_View_Admin_As.set_selected_capabilities(caps)});$document.on("click touchend",caps_root_prefix+" button#"+caps_prefix+"-save-role",function(e){if(true===VAA_View_Admin_As._touchmove){return}e.preventDefault();var role=$(caps_root_prefix+" select#"+caps_prefix+"-edit-role").val(),refresh=false;if(!role){return false}if("__new__"===role){role=$(caps_root_prefix+" input#"+caps_prefix+"-new-role").val();refresh=true}var data={role:role,capabilities:VAA_View_Admin_As.get_selected_capabilities()};VAA_View_Admin_As.ajax({role_manager:{save_role:data}},refresh);return false});$document.on("click touchend",caps_root_prefix+"-new-cap button#"+caps_prefix+"-add-cap",function(e){if(true===VAA_View_Admin_As._touchmove){return}e.preventDefault();var existing=VAA_View_Admin_As.get_selected_capabilities();var val=$(caps_root_prefix+"-new-cap input#"+caps_prefix+"-new-cap").val();var item=$(caps_root_prefix+"-new-cap #"+caps_prefix+"-cap-template").html().toString();val=val.replace(/ /g,"_");item=item.replace(/vaa_new_item/g,val);if("undefined"!==typeof existing[val]){VAA_View_Admin_As.item_notice($(this).parent(),VAA_View_Admin_As.__key_already_exists,"error",2e3)}else{$(VAA_View_Admin_As.root+"-caps-select-options > .ab-item").prepend(item)}})};VAA_View_Admin_As.autoMaxHeight=function(){setTimeout(function(){VAA_View_Admin_As.maxHeightListenerElements.each(function(){var element=$(this),count=0,wait=setInterval(function(){var offset=element.offset(),scrollTop="undefined"!==typeof window.pageYOffset?window.pageYOffset:(document.documentElement||document.body.parentNode||document.body).scrollTop,offsetTop=offset.top-scrollTop;if(element.is(":visible")&&0$body.innerWidth()){$body.addClass("vaa-mobile");VAA_View_Admin_As._mobile=true;VAA_View_Admin_As.mobile()}});$document.on("click touchend",VAA_View_Admin_As.prefix+".vaa-reset-item > .ab-item",function(e){e.preventDefault();if(true===VAA_View_Admin_As._touchmove){return}if("vaa_reload"===$("button",this).attr("name")){window.location.reload()}else{VAA_View_Admin_As.ajax({reset:true},true);return false}});$.each(VAA_View_Admin_As.view_types,function(index,type){$document.on("click touchend",VAA_View_Admin_As.prefix+".vaa-"+type+"-item > a.ab-item",function(e){if(true===VAA_View_Admin_As._touchmove){return}e.preventDefault();var $this=$(this);if(VAA_View_Admin_As._mobile&&$this.parent().hasClass("menupop")&&!$this.next().is(":visible")){$this.next().show().parent().addClass("active");return}if(!$this.parent().hasClass("not-a-view")){var view_data={},val=$this.attr("rel");if(!val){val=$this.find(".vaa-view-data").attr("data-view-value")}view_data[type]=VAA_View_Admin_As.json_decode(val);view_data="object"===typeof view_data[type]?view_data[type]:view_data;VAA_View_Admin_As.ajax(view_data,true);return false}})});$document.on("click touchend",VAA_View_Admin_As.prefix+".remove",function(e){e.preventDefault();if(true===VAA_View_Admin_As._touchmove){return}$(this).parent().slideUp("fast",function(){$(this).remove()})})};VAA_View_Admin_As.mobile=function(){var prefix=".vaa-mobile "+VAA_View_Admin_As.prefix;$document.on("click touchend",prefix+" > .ab-sub-wrapper .ab-item",function(e){if(true===VAA_View_Admin_As._touchmove){return}e.preventDefault();e.stopPropagation();var $sub=$(this).parent(".menupop").children(".ab-sub-wrapper");if($sub.length){if($sub.hasClass("active")){$sub.slideUp("fast");$sub.removeClass("active")}else{$sub.slideDown("fast");$sub.addClass("active")}}});$document.on("click touchend",prefix+"input, "+prefix+"textarea, "+prefix+"select",function(e){if(true===VAA_View_Admin_As._touchmove){return}e.stopPropagation();var $this=$(this);if($this.is('[type="checkbox"]')){e.preventDefault();if($this.is(":checked")){$this.prop("checked",false)}else{$this.prop("checked",true)}$this.trigger("change");return false}else if($this.is('[type="radio"]')){e.preventDefault();$('input[name="'+$this.attr["name"]+'"]').removeAttr("checked");$this.prop("checked",true);$this.trigger("change");return false}return true});$document.on("click touchend",prefix+"label",function(e){if(true===VAA_View_Admin_As._touchmove){return}e.preventDefault();e.stopPropagation();$("#"+$(this).attr("for")).trigger(e.type);return false})};VAA_View_Admin_As.overlay=function(html){var $overlay=$("#vaa-overlay");if(!$overlay.length){html='
    '+html+"
    ";$body.append(html);$overlay=$("body #vaa-overlay")}else if(html.length){$overlay.html(html)}$overlay.fadeIn("fast")};VAA_View_Admin_As.ajax=function(data,refresh){$(".vaa-notice","#wpadminbar").remove();var loader_icon=VAA_View_Admin_As.siteurl+"/wp-includes/images/spinner-2x.gif";VAA_View_Admin_As.overlay('');var post_data={action:"view_admin_as",_vaa_nonce:VAA_View_Admin_As._vaa_nonce,view_admin_as:JSON.stringify(data)};var isView=false;$.each(VAA_View_Admin_As.view_types,function(index,type){if("undefined"!==typeof data[type]){isView=true;return true}});if($(VAA_View_Admin_As.prefix+"#vaa-settings-view-mode-single").is(":checked")&&isView){$body.append('');var form=$("#vaa_single_mode_form");form.append('');form.append('');form.append('');form.find("#data").val(post_data.view_admin_as);form.submit()}else{$.post(VAA_View_Admin_As.ajaxurl,post_data,function(response){var success=response.hasOwnProperty("success")&&true===response.success,data={},display=false;if(true===VAA_View_Admin_As._debug){console.log(response)}if(response.hasOwnProperty("data")){if("object"===typeof response.data){data=response.data;if(data.hasOwnProperty("display")){display=data.display}}}if(success){if(refresh){VAA_View_Admin_As.refresh(data);return}else{if(!data.hasOwnProperty("text")){data.text=VAA_View_Admin_As.__success}}}if(!data.hasOwnProperty("type")){if(success){data.type="success"}else{data.type="error"}}if("popup"===display){VAA_View_Admin_As.popup(data,data.type)}else{if(!data.hasOwnProperty("text")){data.text=response.data}VAA_View_Admin_As.notice(String(data.text),data.type,5e3);$("body #vaa-overlay").addClass(data.type).fadeOut("fast",function(){$(this).remove()})}})}};VAA_View_Admin_As.refresh=function(data){if(data.hasOwnProperty("redirect")){window.location.replace(String(data.redirect))}else{window.location.hash="";window.location.reload()}};VAA_View_Admin_As.notice=function(notice,type,timeout){var root="#wpadminbar .vaa-notice",html=notice+'';type="undefined"===typeof type?"notice":type;timeout="undefined"===typeof timeout?5e3:timeout;if(VAA_View_Admin_As._mobile){html='";$(VAA_View_Admin_As.prefix+"> .ab-sub-wrapper").prepend(html).children(".vaa-notice").slideDown("fast");$("html, body").animate({scrollTop:"0"});if(timeout){setTimeout(function(){$(root).slideUp("fast",function(){$(this).remove()})},timeout)}}else{html='
  • '+html+"
  • ";$("#wp-admin-bar-top-secondary").append(html);$(root+" .remove").click(function(){$(this).parent().remove()});if(timeout){setTimeout(function(){$(root).fadeOut("fast",function(){$(this).remove()})},timeout)}}};VAA_View_Admin_As.item_notice=function(parent,notice,type,timeout){var root=".vaa-notice",html=notice+'',$element=$(parent);type="undefined"===typeof type?"notice":type;timeout="undefined"===typeof timeout?5e3:timeout;html='";$element.append(html).children(".vaa-notice").slideDown("fast");if(timeout){setTimeout(function(){$(root,$element).slideUp("fast",function(){$(this).remove()})},timeout)}};VAA_View_Admin_As.item_confirm=function(parent,text){$(parent).find(".vaa-notice").slideUp("fast",function(){$(this).remove()});text='";VAA_View_Admin_As.item_notice(parent,text,"warning",0);return $(parent).find(".vaa-confirm")};VAA_View_Admin_As.popup=function(data,type){type="undefined"===typeof type?"notice":type;var html="";html+='
    ';html+='';html+='
    ';if("object"!==typeof data){data={text:data}}if(data.hasOwnProperty("text")){html+="

    "+String(data.text)+"

    "}if(data.hasOwnProperty("list")){html+="
      ";data.list.forEach(function(item){html+="
    • "+String(item)+"
    • "});html+="
    "}if(data.hasOwnProperty("textarea")){html+='"}html+="
    ";VAA_View_Admin_As.overlay(html);var root="body #vaa-overlay",$overlay=$(root),$overlayContainer=$(root+" .vaa-overlay-container"),$popupResponse=$(root+" .vaa-response-data");$(root+" .vaa-overlay-container .remove").click(function(){$overlay.fadeOut("fast",function(){$(this).remove()})});$document.on("mouseup",function(e){$(root+" .vaa-overlay-container").each(function(){if(!$(this).is(e.target)&&0===$(this).has(e.target).length){$overlay.fadeOut("fast",function(){$(this).remove()})}})});var textarea=$("textarea",$popupResponse);if(textarea.length){textarea.on("click",function(){$(this).select()})}var popupMaxHeight=function(){if(textarea.length){textarea.each(function(){$(this).css({height:"auto","overflow-y":"hidden"}).height(this.scrollHeight)})}var maxHeight=$overlay.height()*.8-24;$overlayContainer.css("max-height",maxHeight);$popupResponse.css("max-height",maxHeight)};popupMaxHeight();$window.on("resize",function(){popupMaxHeight()})};VAA_View_Admin_As.init_settings=function(){var root=VAA_View_Admin_As.root+"-settings",prefix="vaa-settings",root_prefix=VAA_View_Admin_As.prefix+root;$document.on("change",root_prefix+"-admin-menu-location select#"+prefix+"-admin-menu-location",function(e){e.preventDefault();var val=$(this).val();if(val&&""!==val){var view_data={user_setting:{admin_menu_location:val}};VAA_View_Admin_As.ajax(view_data,true)}});$document.on("change",root_prefix+"-view-mode input.radio."+prefix+"-view-mode",function(e){e.preventDefault();var val=$(this).val();if(val&&""!==val){var view_data={user_setting:{view_mode:val}};VAA_View_Admin_As.ajax(view_data,false)}});$document.on("change",root_prefix+"-force-group-users input#"+prefix+"-force-group-users",function(e){e.preventDefault();var view_data={user_setting:{force_group_users:"no"}};if(this.checked){view_data={user_setting:{force_group_users:"yes"}}}VAA_View_Admin_As.ajax(view_data,true)});$document.on("change",root_prefix+"-hide-front input#"+prefix+"-hide-front",function(e){e.preventDefault();var view_data={user_setting:{hide_front:"no"}};if(this.checked){view_data={user_setting:{hide_front:"yes"}}}VAA_View_Admin_As.ajax(view_data,false)});$document.on("change",root_prefix+"-freeze-locale input#"+prefix+"-freeze-locale",function(e){e.preventDefault();var view_data={user_setting:{freeze_locale:"no"}};if(this.checked){view_data={user_setting:{freeze_locale:"yes"}}}var reload=false;if("object"===typeof VAA_View_Admin_As.view&&"undefined"!==typeof VAA_View_Admin_As.view.user){reload=true}VAA_View_Admin_As.ajax(view_data,reload)})};VAA_View_Admin_As.init_users=function(){var root=VAA_View_Admin_As.root+"-users",root_prefix=VAA_View_Admin_As.prefix+root;$document.on("keyup",root_prefix+" .ab-vaa-search.search-users input",function(){$(VAA_View_Admin_As.prefix+" .ab-vaa-search .ab-vaa-results").empty();if(1<=$(this).val().length){var inputText=$(this).val();$(VAA_View_Admin_As.prefix+".vaa-user-item").each(function(){var name=$(".ab-item",this).text();if(-1('+role+")")}}});if(""===$.trim($(VAA_View_Admin_As.prefix+".ab-vaa-search .ab-vaa-results").html())){$(VAA_View_Admin_As.prefix+".ab-vaa-search .ab-vaa-results").append('
    '+VAA_View_Admin_As.__no_users_found+"
    ")}}})};VAA_View_Admin_As.init_caps=function(){var root=VAA_View_Admin_As.root+"-caps",root_prefix=VAA_View_Admin_As.prefix+root;VAA_View_Admin_As.caps_filter_settings={selectedRole:"default",selectedRoleCaps:{},selectedRoleReverse:false,filterString:""};VAA_View_Admin_As.filter_capabilities=function(){var reverse=true===VAA_View_Admin_As.caps_filter_settings.selectedRoleReverse,isDefault="default"===VAA_View_Admin_As.caps_filter_settings.selectedRole,filterString=VAA_View_Admin_As.caps_filter_settings.filterString;$(root_prefix+"-select-options .vaa-cap-item").each(function(){var $this=$(this),exists=$("input",this).attr("value")in VAA_View_Admin_As.caps_filter_settings.selectedRoleCaps,name;$this.hide();if(reverse||exists||isDefault){if(1<=filterString.length){name=$this.text();if(-1 .ab-sub-wrapper").addClass("fullPopup");VAA_View_Admin_As.autoMaxHeight()});$document.on("click",root_prefix+" #close-caps-popup",function(){$(VAA_View_Admin_As.prefix).removeClass("fullPopupActive");$(root_prefix+"-manager > .ab-sub-wrapper").removeClass("fullPopup");VAA_View_Admin_As.autoMaxHeight()});$document.on("change",root_prefix+" .ab-vaa-select.select-role-caps select",function(){VAA_View_Admin_As.caps_filter_settings.selectedRole=$(this).val();if("default"===VAA_View_Admin_As.caps_filter_settings.selectedRole){VAA_View_Admin_As.caps_filter_settings.selectedRoleCaps={};VAA_View_Admin_As.caps_filter_settings.selectedRoleReverse=false}else{var selectedRoleElement=$(root_prefix+'-selectrolecaps #vaa-caps-selectrolecaps option[value="'+VAA_View_Admin_As.caps_filter_settings.selectedRole+'"]');VAA_View_Admin_As.caps_filter_settings.selectedRoleCaps=JSON.parse(selectedRoleElement.attr("data-caps"));VAA_View_Admin_As.caps_filter_settings.selectedRoleReverse=1===parseInt(selectedRoleElement.attr("data-reverse"),10)}VAA_View_Admin_As.filter_capabilities()});$document.on("keyup",root_prefix+" .ab-vaa-filter input",function(){VAA_View_Admin_As.caps_filter_settings.filterString=$(this).val();VAA_View_Admin_As.filter_capabilities()});$document.on("click touchend",root_prefix+" button#select-all-caps",function(e){if(true===VAA_View_Admin_As._touchmove){return}e.preventDefault();$(root_prefix+"-select-options .vaa-cap-item").each(function(){if($(this).is(":visible")){$("input",this).prop("checked",true)}});return false});$document.on("click touchend",root_prefix+" button#deselect-all-caps",function(e){if(true===VAA_View_Admin_As._touchmove){return}e.preventDefault();$(root_prefix+"-select-options .vaa-cap-item").each(function(){if($(this).is(":visible")){$("input",this).prop("checked",false)}});return false});$document.on("click touchend",root_prefix+" button#apply-caps-view",function(e){if(true===VAA_View_Admin_As._touchmove){return}e.preventDefault();var newCaps=VAA_View_Admin_As.get_selected_capabilities();VAA_View_Admin_As.ajax({caps:newCaps},true);return false})};VAA_View_Admin_As.init_module_role_defaults=function(){var root=VAA_View_Admin_As.root+"-modules",prefix="vaa-modules",root_prefix=VAA_View_Admin_As.prefix+root;$document.on("change",root_prefix+"-role-defaults-enable input#"+prefix+"-role-defaults-enable",function(e){e.preventDefault();var view_data={role_defaults:{enable:0}};if(this.checked){view_data={role_defaults:{enable:true}}}VAA_View_Admin_As.ajax(view_data,true)});root=VAA_View_Admin_As.root+"-role-defaults";prefix="vaa-role-defaults";root_prefix=VAA_View_Admin_As.prefix+root;$document.on("change",root_prefix+"-setting-register-enable input#"+prefix+"-setting-register-enable",function(e){e.preventDefault();var view_data={role_defaults:{apply_defaults_on_register:0}};if(this.checked){view_data={role_defaults:{apply_defaults_on_register:true}}}VAA_View_Admin_As.ajax(view_data,false)});$document.on("change",root_prefix+"-setting-disable-user-screen-options input#"+prefix+"-setting-disable-user-screen-options",function(e){e.preventDefault();var view_data={role_defaults:{disable_user_screen_options:0}};if(this.checked){view_data={role_defaults:{disable_user_screen_options:true}}}VAA_View_Admin_As.ajax(view_data,false)});$document.on("change",root_prefix+"-setting-lock-meta-boxes input#"+prefix+"-setting-lock-meta-boxes",function(e){e.preventDefault();var view_data={role_defaults:{lock_meta_boxes:0}};if(this.checked){view_data={role_defaults:{lock_meta_boxes:true}}}VAA_View_Admin_As.ajax(view_data,false)});$document.on("click touchend",root_prefix+"-meta-add button#"+prefix+"-meta-add",function(e){if(true===VAA_View_Admin_As._touchmove){return}e.preventDefault();var val=$(root_prefix+"-meta-add input#"+prefix+"-meta-new").val();var item=$(root_prefix+"-meta-add #"+prefix+"-meta-template").html().toString();val=val.replace(/ /g,"_");item=item.replace(/vaa_new_item/g,val);if($(root_prefix+'-meta-select input[value="'+val+'"]').length){VAA_View_Admin_As.item_notice($(this).parent(),VAA_View_Admin_As.__key_already_exists,"error",2e3)}else{$(root_prefix+"-meta-select > .ab-item").prepend(item)}});$document.on("click touchend",root_prefix+"-meta-apply button#"+prefix+"-meta-apply",function(e){if(true===VAA_View_Admin_As._touchmove){return}e.preventDefault();var val={};$(root_prefix+"-meta-select .ab-item.vaa-item input").each(function(){val[$(this).val()]=$(this).is(":checked")});if(val){var view_data={role_defaults:{update_meta:val}};VAA_View_Admin_As.ajax(view_data,false)}return false});$document.on("keyup",root_prefix+"-bulk-users-filter input#"+prefix+"-bulk-users-filter",function(e){e.preventDefault();if(1<=$(this).val().length){var inputText=$(this).val();$(root_prefix+"-bulk-users-select .ab-item.vaa-item").each(function(){var name=$(".user-name",this).text();if(-1"+err+"","error")}}return false});$document.on("click touchend",root_prefix+"-clear-roles-apply button#"+prefix+"-clear-roles-apply",function(e){if(true===VAA_View_Admin_As._touchmove){return}e.preventDefault();var val=$(root_prefix+"-clear-roles-select select#"+prefix+"-clear-roles-select").val();if(val&&""!==val){var view_data={role_defaults:{clear_role_defaults:val}},confirm=VAA_View_Admin_As.item_confirm($(this).parent(),VAA_View_Admin_As.__confirm);$(confirm).on("click",function(){VAA_View_Admin_As.ajax(view_data,false)})}return false})};VAA_View_Admin_As.init_module_role_manager=function(){var root=VAA_View_Admin_As.root+"-modules",prefix="vaa-modules",root_prefix=VAA_View_Admin_As.prefix+root;$document.on("change",root_prefix+"-role-manager-enable input#"+prefix+"-role-manager-enable",function(e){e.preventDefault();var view_data={role_manager:{enable:0}};if(this.checked){view_data={role_manager:{enable:true}}}VAA_View_Admin_As.ajax(view_data,true)});root=VAA_View_Admin_As.root+"-role-manager";prefix="vaa-role-manager";root_prefix=VAA_View_Admin_As.prefix+root;$document.on("click touchend",root_prefix+"-apply-view-apply button#"+prefix+"-apply-view-apply",function(e){if(true===VAA_View_Admin_As._touchmove){return}e.preventDefault();var role=$(root_prefix+"-apply-view-select select#"+prefix+"-apply-view-select").val();var capabilities=JSON.parse($(this).attr("data-view-caps"));if(role&&""!==role&&capabilities){var view_data={role_manager:{apply_view_to_role:{role:role,capabilities:capabilities}}};VAA_View_Admin_As.ajax(view_data,true)}return false});$document.on("click touchend",root_prefix+"-rename-apply button#"+prefix+"-rename-apply",function(e){if(true===VAA_View_Admin_As._touchmove){return}e.preventDefault();var role=$(root_prefix+"-rename-select select#"+prefix+"-rename-select").val();var new_name=$(root_prefix+"-rename-input input#"+prefix+"-rename-input").val();if(role&&""!==role&&new_name&&""!==new_name){var view_data={role_manager:{rename_role:{role:role,new_name:new_name}}};VAA_View_Admin_As.ajax(view_data,true)}return false});$document.on("click touchend",root_prefix+"-clone-apply button#"+prefix+"-clone-apply",function(e){if(true===VAA_View_Admin_As._touchmove){return}e.preventDefault();var role=$(root_prefix+"-clone-select select#"+prefix+"-clone-select").val();var new_role=$(root_prefix+"-clone-input input#"+prefix+"-clone-input").val();if(role&&""!==role&&new_role&&""!==new_role){var view_data={role_manager:{clone_role:{role:role,new_role:new_role}}};VAA_View_Admin_As.ajax(view_data,true)}return false});$document.on("click touchend",root_prefix+"-delete-apply button#"+prefix+"-delete-apply",function(e){if(true===VAA_View_Admin_As._touchmove){return}e.preventDefault();var val=$(root_prefix+"-delete-select select#"+prefix+"-delete-select").val();if(val&&""!==val){var view_data={role_manager:{delete_role:val}},confirm=VAA_View_Admin_As.item_confirm($(this).parent(),VAA_View_Admin_As.__confirm);$(confirm).on("click",function(){VAA_View_Admin_As.ajax(view_data,true)})}return false});var caps_root=VAA_View_Admin_As.root+"-caps-manager-role-manager",caps_prefix="vaa-caps-manager-role-manager",caps_root_prefix=VAA_View_Admin_As.prefix+caps_root;$document.on("change",caps_root_prefix+" select#"+caps_prefix+"-edit-role",function(){var $this=$(this),role=$this.val(),caps={},selectedRoleElement=$(caps_root_prefix+" select#"+caps_prefix+'-edit-role option[value="'+role+'"]');if(selectedRoleElement.attr("data-caps")){caps=JSON.parse(selectedRoleElement.attr("data-caps"))}VAA_View_Admin_As.caps_filter_settings.selectedRole="default";VAA_View_Admin_As.caps_filter_settings.selectedRoleCaps={};VAA_View_Admin_As.caps_filter_settings.selectedRoleReverse=false;VAA_View_Admin_As.filter_capabilities();VAA_View_Admin_As.set_selected_capabilities(caps)});$document.on("click touchend",caps_root_prefix+" button#"+caps_prefix+"-save-role",function(e){if(true===VAA_View_Admin_As._touchmove){return}e.preventDefault();var role=$(caps_root_prefix+" select#"+caps_prefix+"-edit-role").val(),refresh=false;if(!role){return false}if("__new__"===role){role=$(caps_root_prefix+" input#"+caps_prefix+"-new-role").val();refresh=true}var data={role:role,capabilities:VAA_View_Admin_As.get_selected_capabilities()};VAA_View_Admin_As.ajax({role_manager:{save_role:data}},refresh);return false});$document.on("click touchend",caps_root_prefix+"-new-cap button#"+caps_prefix+"-add-cap",function(e){if(true===VAA_View_Admin_As._touchmove){return}e.preventDefault();var existing=VAA_View_Admin_As.get_selected_capabilities();var val=$(caps_root_prefix+"-new-cap input#"+caps_prefix+"-new-cap").val();var item=$(caps_root_prefix+"-new-cap #"+caps_prefix+"-cap-template").html().toString();val=val.replace(/ /g,"_");item=item.replace(/vaa_new_item/g,val);if("undefined"!==typeof existing[val]){VAA_View_Admin_As.item_notice($(this).parent(),VAA_View_Admin_As.__key_already_exists,"error",2e3)}else{$(VAA_View_Admin_As.root+"-caps-select-options > .ab-item").prepend(item)}})};VAA_View_Admin_As.autoMaxHeight=function(){setTimeout(function(){VAA_View_Admin_As.maxHeightListenerElements.each(function(){var element=$(this),count=0,wait=setInterval(function(){var offset=element.offset(),scrollTop="undefined"!==typeof window.pageYOffset?window.pageYOffset:(document.documentElement||document.body.parentNode||document.body).scrollTop,offsetTop=offset.top-scrollTop;if(element.is(":visible")&&0add_group( array( - 'id' => $root . '-role-defaults', - 'parent' => $root, - 'meta' => array( - 'class' => 'ab-sub-secondary', - ), - ) ); - - $root = $root . '-role-defaults'; + $root_prefix = $root . '-role-defaults'; $admin_bar->add_node( array( - 'id' => $root . '-enable', + 'id' => $root_prefix . '-enable', 'parent' => $root, 'title' => VAA_View_Admin_As_Admin_Bar::do_checkbox( array( - 'name' => $root . '-enable', + 'name' => $root_prefix . '-enable', 'value' => $this->get_optionData( 'enable' ), 'compare' => true, 'label' => __( 'Enable role defaults', VIEW_ADMIN_AS_DOMAIN ), diff --git a/modules/class-role-manager.php b/modules/class-role-manager.php index ebfabcdf..a6200982 100644 --- a/modules/class-role-manager.php +++ b/modules/class-role-manager.php @@ -149,7 +149,7 @@ public function vaa_init() { if ( VAA_API::is_super_admin() ) { // Add adminbar menu items in settings section. - add_action( 'vaa_admin_bar_settings_after', array( $this, 'admin_bar_menu_settings' ), 10, 2 ); + add_action( 'vaa_admin_bar_modules', array( $this, 'admin_bar_menu_modules' ), 10, 2 ); } // Add adminbar menu items in role section. @@ -415,33 +415,25 @@ public static function sanitize_role_slug( $role_name ) { } /** - * Add admin bar setting items. + * Add admin bar module setting items. * * @since 1.7 * @access public - * @see 'vaa_admin_bar_settings_after' action + * @see 'vaa_admin_bar_modules' action * * @param WP_Admin_Bar $admin_bar The toolbar object. * @param string $root The root item (vaa-settings). * @return void */ - public function admin_bar_menu_settings( $admin_bar, $root ) { + public function admin_bar_menu_modules( $admin_bar, $root ) { - $admin_bar->add_group( array( - 'id' => $root . '-role-manager', - 'parent' => $root, - 'meta' => array( - 'class' => 'ab-sub-secondary', - ), - ) ); - - $root = $root . '-role-manager'; + $root_prefix = $root . '-role-manager'; $admin_bar->add_node( array( - 'id' => $root . '-enable', + 'id' => $root_prefix . '-enable', 'parent' => $root, 'title' => VAA_View_Admin_As_Admin_Bar::do_checkbox( array( - 'name' => $root . '-enable', + 'name' => $root_prefix . '-enable', 'value' => $this->get_optionData( 'enable' ), 'compare' => true, 'label' => __( 'Enable role manager', VIEW_ADMIN_AS_DOMAIN ), diff --git a/ui/class-admin-bar.php b/ui/class-admin-bar.php index 97c92d67..a37824d5 100644 --- a/ui/class-admin-bar.php +++ b/ui/class-admin-bar.php @@ -100,6 +100,7 @@ public function vaa_init() { // Add the global nodes to the admin bar. add_action( 'vaa_admin_bar_menu', array( $this, 'admin_bar_menu_info' ), 1 ); add_action( 'vaa_admin_bar_menu', array( $this, 'admin_bar_menu_settings' ), 2 ); + add_action( 'vaa_admin_bar_settings_after', array( $this, 'admin_bar_menu_modules' ), 1, 2 ); // Add the caps nodes to the admin bar. add_action( 'vaa_admin_bar_menu', array( $this, 'admin_bar_menu_caps' ), 10 ); @@ -507,6 +508,52 @@ public function admin_bar_menu_settings( $admin_bar ) { do_action( 'vaa_admin_bar_settings_after', $admin_bar, $root, self::$root ); } + /** + * Add admin bar menu modules items. + * + * @since 1.7.1 + * @access public + * @see 'vaa_admin_bar_menu' action + * @param WP_Admin_Bar $admin_bar The toolbar object. + * @param string $root The current root item. + * @return void + */ + public function admin_bar_menu_modules( $admin_bar, $root ) { + + $admin_bar->add_group( array( + 'id' => self::$root . '-modules', + 'parent' => $root, + 'meta' => array( + 'class' => 'ab-sub-secondary', + ), + ) ); + + $root = self::$root . '-modules'; + + $admin_bar->add_node( array( + 'id' => $root . '-title', + 'parent' => $root, + 'title' => self::do_icon( 'dashicons-admin-plugins' ) . __( 'Modules', VIEW_ADMIN_AS_DOMAIN ), + 'href' => false, + 'meta' => array( + 'class' => 'vaa-has-icon ab-vaa-title', // ab-vaa-toggle active. + 'tabindex' => '0', + ), + ) ); + + /** + * Add items to the modules group. + * + * @since 1.7.1 + * @see 'admin_bar_menu' action + * @link https://codex.wordpress.org/Class_Reference/WP_Admin_Bar + * @param WP_Admin_Bar $admin_bar The toolbar object. + * @param string $root The current root item. + * @param string self::$root The main root item. + */ + do_action( 'vaa_admin_bar_modules', $admin_bar, $root, self::$root ); + } + /** * Add admin bar menu caps items. * From 3462b179c674fbfb3d59ba01f08c0f0068a0dace Mon Sep 17 00:00:00 2001 From: JoryHogeveen Date: Thu, 13 Apr 2017 02:10:48 +0200 Subject: [PATCH 15/57] Add Gravity Forms capabilities --- includes/class-compat.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/includes/class-compat.php b/includes/class-compat.php index f5c6a969..c0d4c1dc 100644 --- a/includes/class-compat.php +++ b/includes/class-compat.php @@ -113,6 +113,11 @@ public function init_after() { public function get_capabilities( $caps ) { // To support Members filters + + // @since 1.7.1 Gravity Forms. + if ( is_callable( array( 'GFCommon', 'all_caps' ) ) ) { + $caps = array_merge( GFCommon::all_caps(), $caps ); + } $caps = apply_filters( 'members_get_capabilities', $caps ); // To support Pods filters $caps = apply_filters( 'pods_roles_get_capabilities', $caps ); From b981565c7cc820308f692796e5f94b0c5dd6e565 Mon Sep 17 00:00:00 2001 From: JoryHogeveen Date: Thu, 13 Apr 2017 02:11:03 +0200 Subject: [PATCH 16/57] Add User Role Editor capabilities --- includes/class-compat.php | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/includes/class-compat.php b/includes/class-compat.php index c0d4c1dc..f6af5eb9 100644 --- a/includes/class-compat.php +++ b/includes/class-compat.php @@ -118,6 +118,12 @@ public function get_capabilities( $caps ) { if ( is_callable( array( 'GFCommon', 'all_caps' ) ) ) { $caps = array_merge( GFCommon::all_caps(), $caps ); } + + // @since 1.7.1 User Role Editor. + if ( is_callable( array( 'URE_Own_Capabilities', 'get_caps' ) ) ) { + $caps = array_merge( URE_Own_Capabilities::get_caps(), $caps ); + } + $caps = apply_filters( 'ure_full_capabilites', $caps ); $caps = apply_filters( 'members_get_capabilities', $caps ); // To support Pods filters $caps = apply_filters( 'pods_roles_get_capabilities', $caps ); From 605344b62c69c22eb2d53e57550d25df654660fb Mon Sep 17 00:00:00 2001 From: JoryHogeveen Date: Thu, 13 Apr 2017 02:11:19 +0200 Subject: [PATCH 17/57] Add bbPress capabilities --- includes/class-compat.php | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/includes/class-compat.php b/includes/class-compat.php index f6af5eb9..412e8f0b 100644 --- a/includes/class-compat.php +++ b/includes/class-compat.php @@ -124,6 +124,16 @@ public function get_capabilities( $caps ) { $caps = array_merge( URE_Own_Capabilities::get_caps(), $caps ); } $caps = apply_filters( 'ure_full_capabilites', $caps ); + + // @since 1.7.1 bbPress. + if ( function_exists( 'bbp_get_caps_for_role' ) ) { + if ( function_exists( 'bbp_get_keymaster_role' ) ) { + $bbp_keymaster_role = bbp_get_keymaster_role(); + } else { + $bbp_keymaster_role = apply_filters( 'bbp_get_keymaster_role', 'bbp_keymaster' ); + } + $caps = bbp_get_caps_for_role( $bbp_keymaster_role ); + } $caps = apply_filters( 'members_get_capabilities', $caps ); // To support Pods filters $caps = apply_filters( 'pods_roles_get_capabilities', $caps ); From 9e106deae8307016cd7bd3a25e87186d2b2fc1e2 Mon Sep 17 00:00:00 2001 From: JoryHogeveen Date: Thu, 13 Apr 2017 02:11:33 +0200 Subject: [PATCH 18/57] Add Members capabilities --- includes/class-compat.php | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/includes/class-compat.php b/includes/class-compat.php index 412e8f0b..e984f96d 100644 --- a/includes/class-compat.php +++ b/includes/class-compat.php @@ -134,8 +134,14 @@ public function get_capabilities( $caps ) { } $caps = bbp_get_caps_for_role( $bbp_keymaster_role ); } + + // Members. + if ( function_exists( 'members_get_plugin_capabilities' ) ) { + $caps = array_merge( members_get_plugin_capabilities(), $caps ); + } $caps = apply_filters( 'members_get_capabilities', $caps ); - // To support Pods filters + + // Pods. $caps = apply_filters( 'pods_roles_get_capabilities', $caps ); return $caps; From 7a59b832121f8963d339d58ae16a8592d69d3494 Mon Sep 17 00:00:00 2001 From: JoryHogeveen Date: Thu, 13 Apr 2017 02:12:02 +0200 Subject: [PATCH 19/57] Move network capabilities to vaa compat --- includes/class-compat.php | 17 +++++++++++++++++ includes/class-store.php | 18 ------------------ 2 files changed, 17 insertions(+), 18 deletions(-) diff --git a/includes/class-compat.php b/includes/class-compat.php index e984f96d..f15910be 100644 --- a/includes/class-compat.php +++ b/includes/class-compat.php @@ -114,6 +114,23 @@ public function get_capabilities( $caps ) { // To support Members filters + /** + * Network capabilities. + * @since 1.5.3 + * @see https://codex.wordpress.org/Roles_and_Capabilities + */ + if ( is_multisite() ) { + $network_caps = array( + 'manage_network', + 'manage_sites', + 'manage_network_users', + 'manage_network_plugins', + 'manage_network_themes', + 'manage_network_options', + ); + $caps = array_merge( $network_caps, $caps ); + } + // @since 1.7.1 Gravity Forms. if ( is_callable( array( 'GFCommon', 'all_caps' ) ) ) { $caps = array_merge( GFCommon::all_caps(), $caps ); diff --git a/includes/class-store.php b/includes/class-store.php index c0044c46..d6c34d9e 100644 --- a/includes/class-store.php +++ b/includes/class-store.php @@ -562,24 +562,6 @@ public function store_caps() { } $caps = array_merge( $add_caps, $caps ); - /** - * Add network capabilities. - * - * @since 1.5.3 - * @see https://codex.wordpress.org/Roles_and_Capabilities - * @todo Move this to VAA_View_Admin_As_Compat? - */ - if ( is_multisite() ) { - $network_caps = array( - 'manage_network' => 0, - 'manage_sites' => 0, - 'manage_network_users' => 0, - 'manage_network_plugins' => 0, - 'manage_network_themes' => 0, - 'manage_network_options' => 0, - ); - $caps = array_merge( $network_caps, $caps ); - } } // End if(). // Remove role names. From 8339c650246f6f06cae9657ad6c99b9b409001b9 Mon Sep 17 00:00:00 2001 From: JoryHogeveen Date: Thu, 13 Apr 2017 02:12:59 +0200 Subject: [PATCH 20/57] Add custom post type and taxonomy capabilities --- includes/class-compat.php | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/includes/class-compat.php b/includes/class-compat.php index f15910be..38865152 100644 --- a/includes/class-compat.php +++ b/includes/class-compat.php @@ -112,7 +112,17 @@ public function init_after() { */ public function get_capabilities( $caps ) { - // To support Members filters + // @since 1.7.1 Add post type and taxonomy caps. + $wp_objects = array_merge( + (array) get_post_types( array(), 'objects' ), + (array) get_taxonomies( array(), 'objects' ) + ); + foreach ( $wp_objects as $obj ) { + if ( isset( $obj->cap ) ) { + // WP stores the object caps as general_cap_name => actual_cap. + $caps = array_merge( array_combine( (array) $obj->cap, (array) $obj->cap ), $caps ); + } + } /** * Network capabilities. From 7ba87f0f45576adaf05dd9fa44bf915d4dde7a3d Mon Sep 17 00:00:00 2001 From: JoryHogeveen Date: Thu, 13 Apr 2017 02:13:18 +0200 Subject: [PATCH 21/57] Do not filter on unique capability value keys --- includes/class-store.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/includes/class-store.php b/includes/class-store.php index d6c34d9e..c8b9b8c1 100644 --- a/includes/class-store.php +++ b/includes/class-store.php @@ -548,8 +548,6 @@ public function store_caps() { */ $all_caps = apply_filters( 'view_admin_as_get_capabilities', $all_caps ); - $all_caps = array_unique( $all_caps ); - $add_caps = array(); // Add new capabilities to the capability array as disabled. foreach ( $all_caps as $cap_key => $cap_val ) { @@ -560,6 +558,7 @@ public function store_caps() { $add_caps[ (string) $cap_key ] = 0; } } + $caps = array_merge( $add_caps, $caps ); } // End if(). From 72e5be6de5175da02ae1760988379f9cc52f006f Mon Sep 17 00:00:00 2001 From: JoryHogeveen Date: Thu, 13 Apr 2017 02:15:26 +0200 Subject: [PATCH 22/57] Default get_capabilities() parameter --- includes/class-compat.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/includes/class-compat.php b/includes/class-compat.php index 38865152..3962f595 100644 --- a/includes/class-compat.php +++ b/includes/class-compat.php @@ -68,7 +68,7 @@ public function init() { add_action( 'members_register_cap_groups', array( $this, 'action_members_register_cap_group' ) ); /** - * Add our caps to the User Role Editor plugin (URE) + * Add our caps to the User Role Editor plugin (URE). * @since 1.6.4 */ add_filter( 'ure_capabilities_groups_tree', array( $this, 'filter_ure_capabilities_groups_tree' ) ); @@ -110,7 +110,7 @@ public function init_after() { * @param array $caps The capabilities. * @return array */ - public function get_capabilities( $caps ) { + public function get_capabilities( $caps = array() ) { // @since 1.7.1 Add post type and taxonomy caps. $wp_objects = array_merge( @@ -186,7 +186,7 @@ public function get_capabilities( $caps ) { */ public function add_capabilities( $caps = array() ) { - // Allow VAA modules to add their capabilities + // Allow VAA modules to add their capabilities. $vaa_caps = apply_filters( 'view_admin_as_add_capabilities', array( 'view_admin_as' ) ); foreach ( $vaa_caps as $cap ) { $caps[ $cap ] = $cap; From eefbdca463c4de48bb2f85060ac0c4c66bd159ae Mon Sep 17 00:00:00 2001 From: JoryHogeveen Date: Thu, 13 Apr 2017 02:46:01 +0200 Subject: [PATCH 23/57] Move getting WP caps in it's own method --- includes/class-compat.php | 71 ++++++++++++++++++++++++--------------- 1 file changed, 43 insertions(+), 28 deletions(-) diff --git a/includes/class-compat.php b/includes/class-compat.php index 3962f595..3cfa9427 100644 --- a/includes/class-compat.php +++ b/includes/class-compat.php @@ -112,34 +112,7 @@ public function init_after() { */ public function get_capabilities( $caps = array() ) { - // @since 1.7.1 Add post type and taxonomy caps. - $wp_objects = array_merge( - (array) get_post_types( array(), 'objects' ), - (array) get_taxonomies( array(), 'objects' ) - ); - foreach ( $wp_objects as $obj ) { - if ( isset( $obj->cap ) ) { - // WP stores the object caps as general_cap_name => actual_cap. - $caps = array_merge( array_combine( (array) $obj->cap, (array) $obj->cap ), $caps ); - } - } - - /** - * Network capabilities. - * @since 1.5.3 - * @see https://codex.wordpress.org/Roles_and_Capabilities - */ - if ( is_multisite() ) { - $network_caps = array( - 'manage_network', - 'manage_sites', - 'manage_network_users', - 'manage_network_plugins', - 'manage_network_themes', - 'manage_network_options', - ); - $caps = array_merge( $network_caps, $caps ); - } + $caps = array_merge( $this->get_wordpress_capabilities(), $caps ); // @since 1.7.1 Gravity Forms. if ( is_callable( array( 'GFCommon', 'all_caps' ) ) ) { @@ -174,6 +147,48 @@ public function get_capabilities( $caps = array() ) { return $caps; } + /** + * Get all capabilities from WP core or WP objects. + * + * @since 1.7.1 + * @return array + */ + public function get_wordpress_capabilities() { + + $caps = array(); + + // @since 1.7.1 Add post type and taxonomy caps. + $wp_objects = array_merge( + (array) get_post_types( array(), 'objects' ), + (array) get_taxonomies( array(), 'objects' ) + ); + foreach ( $wp_objects as $obj ) { + if ( isset( $obj->cap ) ) { + // WP stores the object caps as general_cap_name => actual_cap. + $caps = array_merge( array_combine( (array) $obj->cap, (array) $obj->cap ), $caps ); + } + } + + /** + * Network capabilities. + * @since 1.5.3 + * @see https://codex.wordpress.org/Roles_and_Capabilities + */ + if ( is_multisite() ) { + $network_caps = array( + 'manage_network', + 'manage_sites', + 'manage_network_users', + 'manage_network_plugins', + 'manage_network_themes', + 'manage_network_options', + ); + $caps = array_merge( $network_caps, $caps ); + } + + return $caps; + } + /** * Add our capabilities to an existing list of capabilities. * From bf51a7ac50233895779dd6abede4f7308662e6c9 Mon Sep 17 00:00:00 2001 From: JoryHogeveen Date: Thu, 13 Apr 2017 02:46:16 +0200 Subject: [PATCH 24/57] Move getting WP role caps to compat --- includes/class-compat.php | 9 +++++++++ includes/class-store.php | 20 +++----------------- 2 files changed, 12 insertions(+), 17 deletions(-) diff --git a/includes/class-compat.php b/includes/class-compat.php index 3cfa9427..6ee7fc6c 100644 --- a/includes/class-compat.php +++ b/includes/class-compat.php @@ -157,6 +157,15 @@ public function get_wordpress_capabilities() { $caps = array(); + // @since 1.7.1 Store available capabilities existing in roles. + foreach ( $this->store->get_roles() as $key => $role ) { + if ( is_array( $role->capabilities ) ) { + foreach ( $role->capabilities as $cap => $grant ) { + $caps[ $cap ] = $cap; + } + } + } + // @since 1.7.1 Add post type and taxonomy caps. $wp_objects = array_merge( (array) get_post_types( array(), 'objects' ), diff --git a/includes/class-store.php b/includes/class-store.php index c8b9b8c1..390dc971 100644 --- a/includes/class-store.php +++ b/includes/class-store.php @@ -510,14 +510,10 @@ public function filter_sort_users_by_role( $users ) { * @since 1.4.1 * @since 1.6 Moved to this class from main class. * @access public - * @global WP_Roles $wp_roles * @return void */ public function store_caps() { - // Get all available roles and capabilities. - global $wp_roles; - // Get current user capabilities. $caps = self::get_originalUserData( 'allcaps' ); if ( empty( $caps ) ) { @@ -528,25 +524,15 @@ public function store_caps() { // Only allow to add capabilities for an admin (or super admin). if ( self::is_super_admin() ) { - // Store available capabilities. - $all_caps = array(); - foreach ( $wp_roles->role_objects as $key => $role ) { - if ( is_array( $role->capabilities ) ) { - foreach ( $role->capabilities as $cap => $grant ) { - $all_caps[ $cap ] = $cap; - } - } - } - /** * Add compatibility for other cap managers. * * @since 1.5 * @see VAA_View_Admin_As_Compat->init() - * @param array $all_caps All capabilities found in the existing roles. + * @param array $caps An empty array, waiting to be filled with capabilities. * @return array */ - $all_caps = apply_filters( 'view_admin_as_get_capabilities', $all_caps ); + $all_caps = apply_filters( 'view_admin_as_get_capabilities', array() ); $add_caps = array(); // Add new capabilities to the capability array as disabled. @@ -564,7 +550,7 @@ public function store_caps() { } // End if(). // Remove role names. - $caps = array_diff_key( $caps, $wp_roles->roles ); + $caps = array_diff_key( $caps, $this->get_roles() ); // And sort alphabetical. ksort( $caps ); From d7db6745c38a6bc0ca0ef4dccab9c76b56bfd27a Mon Sep 17 00:00:00 2001 From: JoryHogeveen Date: Thu, 13 Apr 2017 02:46:29 +0200 Subject: [PATCH 25/57] Plugin caps: User Roles and Capabilities --- includes/class-compat.php | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/includes/class-compat.php b/includes/class-compat.php index 6ee7fc6c..3cfc4c2f 100644 --- a/includes/class-compat.php +++ b/includes/class-compat.php @@ -70,6 +70,7 @@ public function init() { /** * Add our caps to the User Role Editor plugin (URE). * @since 1.6.4 + * @todo Filter `ure_full_capabilites`? */ add_filter( 'ure_capabilities_groups_tree', array( $this, 'filter_ure_capabilities_groups_tree' ) ); add_filter( 'ure_custom_capability_groups', array( $this, 'filter_ure_custom_capability_groups' ), 10, 2 ); @@ -125,6 +126,11 @@ public function get_capabilities( $caps = array() ) { } $caps = apply_filters( 'ure_full_capabilites', $caps ); + // @since 1.7.1 User Roles and Capabilities. + if ( is_callable( array( 'Solvease_Roles_Capabilities_User_Caps', 'solvease_roles_capabilities_caps' ) ) ) { + $caps = array_merge( Solvease_Roles_Capabilities_User_Caps::solvease_roles_capabilities_caps(), $caps ); + } + // @since 1.7.1 bbPress. if ( function_exists( 'bbp_get_caps_for_role' ) ) { if ( function_exists( 'bbp_get_keymaster_role' ) ) { From a59b15481c1abf5620528a05086d14bd69f63b55 Mon Sep 17 00:00:00 2001 From: JoryHogeveen Date: Thu, 13 Apr 2017 03:07:33 +0200 Subject: [PATCH 26/57] User ID as array key --- includes/class-controller.php | 2 +- includes/class-store.php | 9 ++++++--- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/includes/class-controller.php b/includes/class-controller.php index c0b014ba..2d5aef0d 100644 --- a/includes/class-controller.php +++ b/includes/class-controller.php @@ -705,7 +705,7 @@ public function validate_view_data_role( $null, $data ) { */ public function validate_view_data_user( $null, $data ) { // User data must be a number and exists in the loaded array of user id's. - if ( is_numeric( $data ) && array_key_exists( (int) $data, $this->store->get_userids() ) ) { + if ( is_numeric( $data ) && array_key_exists( $data, $this->store->get_users() ) ) { return $data; } return $null; diff --git a/includes/class-store.php b/includes/class-store.php index 390dc971..5a91cdb7 100644 --- a/includes/class-store.php +++ b/includes/class-store.php @@ -478,6 +478,7 @@ public function _filter_get_user_capabilities( $null, $user_id, $meta_key ) { * * @since 1.1 * @since 1.6 Moved to this class from main class. + * @since 1.7.1 User ID as array key. * @access public * * @see store_users() @@ -496,7 +497,7 @@ public function filter_sort_users_by_role( $users ) { // Only one key is needed to add the user to the list of available users. reset( $user->roles ); if ( current( $user->roles ) === $role ) { - $tmp_users[] = $user; + $tmp_users[ $user->ID ] = $user; } } } @@ -685,7 +686,6 @@ public function get_rolenames( $key = null, $translate = true ) { /** * Get available users. - * @todo Key as user ID. * @param string $key User key. * @return mixed Array of user objects or a single user object. */ @@ -695,6 +695,8 @@ public function get_users( $key = null ) { /** * Get available users. + * @todo Remove in future. + * @deprecated * @param string $key User key. * @return mixed Array of user display names or a single user display name. */ @@ -825,7 +827,6 @@ public function set_rolenames( $val, $key = null, $append = false ) { /** * Set the available users. - * @todo Key as user ID. * @param mixed $val Value. * @param string $key (optional) User key. * @param bool $append (optional) Append if it doesn't exist? @@ -837,6 +838,8 @@ public function set_users( $val, $key = null, $append = false ) { /** * Set the available user display names. + * @todo Remove in future. + * @deprecated * @param array $val Array of available user ID's (key) and display names (value). * @return void */ From 557bc9e42be0a9f430b4021531baf030820f72b2 Mon Sep 17 00:00:00 2001 From: JoryHogeveen Date: Tue, 18 Apr 2017 00:21:51 +0200 Subject: [PATCH 27/57] get_userids() deprecated --- ui/class-ui.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ui/class-ui.php b/ui/class-ui.php index be6fd3f3..c729aa31 100644 --- a/ui/class-ui.php +++ b/ui/class-ui.php @@ -99,7 +99,7 @@ public function filter_user_row_actions( $actions, $user ) { $link = false; } } - elseif ( $this->store->get_userids( $user->ID ) ) { + elseif ( $this->store->get_users( $user->ID ) ) { $link = VAA_API::get_vaa_action_link( array( 'user' => $user->ID ), $this->store->get_nonce( true ), $link ); } else { $link = false; From 3e762e5ed3192750b4d2824a3ed625c5befe5d2c Mon Sep 17 00:00:00 2001 From: JoryHogeveen Date: Tue, 18 Apr 2017 00:22:57 +0200 Subject: [PATCH 28/57] Improve code + WooCommerce comment --- includes/class-compat.php | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/includes/class-compat.php b/includes/class-compat.php index 3cfc4c2f..c24e72cb 100644 --- a/includes/class-compat.php +++ b/includes/class-compat.php @@ -58,8 +58,9 @@ public function init() { /** * Add our caps to the members plugin. * Hook `members_get_capabilities` also used by: - * - User Role Editor (URE) + * - User Role Editor (URE) >> Own filter: `ure_full_capabilites` * - WPFront User Role Editor + * - Capability Manager Enhanced >> Own filter: `capsman_get_capabilities` * - Pods * * @since 1.6 @@ -70,7 +71,6 @@ public function init() { /** * Add our caps to the User Role Editor plugin (URE). * @since 1.6.4 - * @todo Filter `ure_full_capabilites`? */ add_filter( 'ure_capabilities_groups_tree', array( $this, 'filter_ure_capabilities_groups_tree' ) ); add_filter( 'ure_custom_capability_groups', array( $this, 'filter_ure_custom_capability_groups' ), 10, 2 ); @@ -115,20 +115,23 @@ public function get_capabilities( $caps = array() ) { $caps = array_merge( $this->get_wordpress_capabilities(), $caps ); + // WooCommerce caps are not accessible but are assigned to roles on install. + // get_wordpress_capabilities() will find them. + // @since 1.7.1 Gravity Forms. if ( is_callable( array( 'GFCommon', 'all_caps' ) ) ) { - $caps = array_merge( GFCommon::all_caps(), $caps ); + $caps = array_merge( (array) GFCommon::all_caps(), $caps ); } // @since 1.7.1 User Role Editor. if ( is_callable( array( 'URE_Own_Capabilities', 'get_caps' ) ) ) { - $caps = array_merge( URE_Own_Capabilities::get_caps(), $caps ); + $caps = array_merge( (array) URE_Own_Capabilities::get_caps(), $caps ); } $caps = apply_filters( 'ure_full_capabilites', $caps ); // @since 1.7.1 User Roles and Capabilities. if ( is_callable( array( 'Solvease_Roles_Capabilities_User_Caps', 'solvease_roles_capabilities_caps' ) ) ) { - $caps = array_merge( Solvease_Roles_Capabilities_User_Caps::solvease_roles_capabilities_caps(), $caps ); + $caps = array_merge( (array) Solvease_Roles_Capabilities_User_Caps::solvease_roles_capabilities_caps(), $caps ); } // @since 1.7.1 bbPress. @@ -138,12 +141,12 @@ public function get_capabilities( $caps = array() ) { } else { $bbp_keymaster_role = apply_filters( 'bbp_get_keymaster_role', 'bbp_keymaster' ); } - $caps = bbp_get_caps_for_role( $bbp_keymaster_role ); + $caps = array_merge( (array) bbp_get_caps_for_role( $bbp_keymaster_role ), $caps ); } // Members. if ( function_exists( 'members_get_plugin_capabilities' ) ) { - $caps = array_merge( members_get_plugin_capabilities(), $caps ); + $caps = array_merge( (array) members_get_plugin_capabilities(), $caps ); } $caps = apply_filters( 'members_get_capabilities', $caps ); From b726d0e440827df123fc3cd1abc3e38fd2191d81 Mon Sep 17 00:00:00 2001 From: JoryHogeveen Date: Tue, 18 Apr 2017 00:23:14 +0200 Subject: [PATCH 29/57] Plugin caps: WPFront User Role Editor --- includes/class-compat.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/includes/class-compat.php b/includes/class-compat.php index c24e72cb..bb6532b7 100644 --- a/includes/class-compat.php +++ b/includes/class-compat.php @@ -129,6 +129,11 @@ public function get_capabilities( $caps = array() ) { } $caps = apply_filters( 'ure_full_capabilites', $caps ); + // @since 1.7.1 WPFront User Role Editor. + if ( class_exists( 'WPFront_User_Role_Editor' ) && isset( WPFront_User_Role_Editor::$ROLE_CAPS ) ) { + $caps = array_merge( (array) WPFront_User_Role_Editor::$ROLE_CAPS, $caps ); + } + // @since 1.7.1 User Roles and Capabilities. if ( is_callable( array( 'Solvease_Roles_Capabilities_User_Caps', 'solvease_roles_capabilities_caps' ) ) ) { $caps = array_merge( (array) Solvease_Roles_Capabilities_User_Caps::solvease_roles_capabilities_caps(), $caps ); From efe1d908a384b2f4ab94aca1f47e2d89f28de21a Mon Sep 17 00:00:00 2001 From: JoryHogeveen Date: Tue, 18 Apr 2017 01:13:26 +0200 Subject: [PATCH 30/57] $caps parameter get_wordpress_capabilities() --- includes/class-compat.php | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/includes/class-compat.php b/includes/class-compat.php index bb6532b7..a0b8a76b 100644 --- a/includes/class-compat.php +++ b/includes/class-compat.php @@ -165,11 +165,10 @@ public function get_capabilities( $caps = array() ) { * Get all capabilities from WP core or WP objects. * * @since 1.7.1 + * @param array $caps The capabilities. * @return array */ - public function get_wordpress_capabilities() { - - $caps = array(); + public function get_wordpress_capabilities( $caps = array() ) { // @since 1.7.1 Store available capabilities existing in roles. foreach ( $this->store->get_roles() as $key => $role ) { From 1e7ad27e2b1ad99a901fa2e465e229a255f60f88 Mon Sep 17 00:00:00 2001 From: JoryHogeveen Date: Tue, 18 Apr 2017 01:14:58 +0200 Subject: [PATCH 31/57] Add $all parameter to get_capabilities + add get_plugin_capabilities() for other plugins --- includes/class-compat.php | 152 +++++++++++++++++++++++++++----------- 1 file changed, 110 insertions(+), 42 deletions(-) diff --git a/includes/class-compat.php b/includes/class-compat.php index a0b8a76b..d5518dc6 100644 --- a/includes/class-compat.php +++ b/includes/class-compat.php @@ -79,7 +79,7 @@ public function init() { * Get caps from other plugins. * @since 1.5 */ - add_filter( 'view_admin_as_get_capabilities', array( $this, 'get_capabilities' ) ); + add_filter( 'view_admin_as_get_capabilities', array( $this, 'get_capabilities' ), 10, 2 ); } @@ -109,54 +109,20 @@ public function init_after() { * @see init() * * @param array $caps The capabilities. + * @param bool $all Get all or only VAA related capabilities? * @return array */ - public function get_capabilities( $caps = array() ) { + public function get_capabilities( $caps = array(), $all = true ) { - $caps = array_merge( $this->get_wordpress_capabilities(), $caps ); - - // WooCommerce caps are not accessible but are assigned to roles on install. - // get_wordpress_capabilities() will find them. - - // @since 1.7.1 Gravity Forms. - if ( is_callable( array( 'GFCommon', 'all_caps' ) ) ) { - $caps = array_merge( (array) GFCommon::all_caps(), $caps ); - } - - // @since 1.7.1 User Role Editor. - if ( is_callable( array( 'URE_Own_Capabilities', 'get_caps' ) ) ) { - $caps = array_merge( (array) URE_Own_Capabilities::get_caps(), $caps ); - } - $caps = apply_filters( 'ure_full_capabilites', $caps ); - - // @since 1.7.1 WPFront User Role Editor. - if ( class_exists( 'WPFront_User_Role_Editor' ) && isset( WPFront_User_Role_Editor::$ROLE_CAPS ) ) { - $caps = array_merge( (array) WPFront_User_Role_Editor::$ROLE_CAPS, $caps ); - } - - // @since 1.7.1 User Roles and Capabilities. - if ( is_callable( array( 'Solvease_Roles_Capabilities_User_Caps', 'solvease_roles_capabilities_caps' ) ) ) { - $caps = array_merge( (array) Solvease_Roles_Capabilities_User_Caps::solvease_roles_capabilities_caps(), $caps ); - } + $caps = $this->add_capabilities( $caps ); - // @since 1.7.1 bbPress. - if ( function_exists( 'bbp_get_caps_for_role' ) ) { - if ( function_exists( 'bbp_get_keymaster_role' ) ) { - $bbp_keymaster_role = bbp_get_keymaster_role(); - } else { - $bbp_keymaster_role = apply_filters( 'bbp_get_keymaster_role', 'bbp_keymaster' ); - } - $caps = array_merge( (array) bbp_get_caps_for_role( $bbp_keymaster_role ), $caps ); + if ( ! $all ) { + return $caps; } - // Members. - if ( function_exists( 'members_get_plugin_capabilities' ) ) { - $caps = array_merge( (array) members_get_plugin_capabilities(), $caps ); - } - $caps = apply_filters( 'members_get_capabilities', $caps ); + $caps = array_merge( $this->get_wordpress_capabilities(), $caps ); - // Pods. - $caps = apply_filters( 'pods_roles_get_capabilities', $caps ); + $caps = array_merge( $this->get_plugin_capabilities(), $caps ); return $caps; } @@ -211,6 +177,108 @@ public function get_wordpress_capabilities( $caps = array() ) { return $caps; } + /** + * Get all capabilities from other plugins. + * + * Disable some PHPMD checks for this method. + * @SuppressWarnings(PHPMD.CyclomaticComplexity) + * @SuppressWarnings(PHPMD.NPathComplexity) + * @todo Refactor to enable above checks? + * + * @since 1.7.1 + * @param array $caps The capabilities. + * @return array + */ + public function get_plugin_capabilities( $caps = array() ) { + + // WooCommerce caps are not accessible but are assigned to roles on install. + // get_wordpress_capabilities() will find them. + + // @since 1.7.1 Gravity Forms. + if ( is_callable( array( 'GFCommon', 'all_caps' ) ) ) { + $caps = array_merge( (array) GFCommon::all_caps(), $caps ); + } + + // @since 1.7.1 User Role Editor. + if ( is_callable( array( 'URE_Own_Capabilities', 'get_caps' ) ) ) { + $caps = array_merge( (array) URE_Own_Capabilities::get_caps(), $caps ); + } + $caps = apply_filters( 'ure_full_capabilites', $caps ); + + // @since 1.7.1 WPFront User Role Editor. + if ( class_exists( 'WPFront_User_Role_Editor' ) && isset( WPFront_User_Role_Editor::$ROLE_CAPS ) ) { + $caps = array_merge( (array) WPFront_User_Role_Editor::$ROLE_CAPS, $caps ); + } + + // @since 1.7.1 User Roles and Capabilities. + if ( is_callable( array( 'Solvease_Roles_Capabilities_User_Caps', 'solvease_roles_capabilities_caps' ) ) ) { + $caps = array_merge( (array) Solvease_Roles_Capabilities_User_Caps::solvease_roles_capabilities_caps(), $caps ); + } + + // @since 1.7.1 bbPress. + if ( function_exists( 'bbp_get_caps_for_role' ) ) { + if ( function_exists( 'bbp_get_keymaster_role' ) ) { + $bbp_keymaster_role = bbp_get_keymaster_role(); + } else { + $bbp_keymaster_role = apply_filters( 'bbp_get_keymaster_role', 'bbp_keymaster' ); + } + $caps = array_merge( (array) bbp_get_caps_for_role( $bbp_keymaster_role ), $caps ); + } + + // @since 1.7.1 BuddyPress. + if ( class_exists( 'BuddyPress' ) ) { + $caps = array_merge( + array( + 'bp_moderate', + 'bp_xprofile_change_field_visibility', + // @todo Check usage of capabilities below. + /* + 'throttle', + 'keep_gate', + 'moderate_comments', + 'edit_cover_image', + 'edit_avatar', + 'edit_favorites', + 'edit_favorites_of', + 'add_tag_to', + 'edit_tag_by_on', + 'change_user_password', + 'moderate', + 'browse_deleted', + 'view_by_ip', + 'write_posts', + 'write_topic', + 'write_topics', + 'move_topic', + 'stick_topic', + 'close_topic', + 'edit_topic', + 'delete_topic', + 'delete_forum', + 'manage_forums', + 'manage_tags', + */ + ), + // @see bp-core-caps.php >> bp_get_community_caps(). + apply_filters( 'bp_get_community_caps', array() ), + $caps + ); + } // End if(). + + // Members. + if ( function_exists( 'members_get_plugin_capabilities' ) ) { + $caps = array_merge( (array) members_get_plugin_capabilities(), $caps ); + } + // Get caps from multiple plugins through the Members filter. + $caps = apply_filters( 'members_get_capabilities', $caps ); + + // Pods. + $caps = apply_filters( 'pods_roles_get_capabilities', $caps ); + + return $caps; + + } + /** * Add our capabilities to an existing list of capabilities. * From ccd70fcadc01d2e8ac49ee6d1f2aeef2dddc31a3 Mon Sep 17 00:00:00 2001 From: JoryHogeveen Date: Tue, 18 Apr 2017 01:15:08 +0200 Subject: [PATCH 32/57] Simplify code --- includes/class-compat.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/includes/class-compat.php b/includes/class-compat.php index d5518dc6..61c9ef09 100644 --- a/includes/class-compat.php +++ b/includes/class-compat.php @@ -292,8 +292,7 @@ public function get_plugin_capabilities( $caps = array() ) { public function add_capabilities( $caps = array() ) { // Allow VAA modules to add their capabilities. - $vaa_caps = apply_filters( 'view_admin_as_add_capabilities', array( 'view_admin_as' ) ); - foreach ( $vaa_caps as $cap ) { + foreach ( (array) apply_filters( 'view_admin_as_add_capabilities', array( 'view_admin_as' ) ) as $cap ) { $caps[ $cap ] = $cap; } From d1b116dbf98cc4be081ab9c056daf0dd9d6eba2a Mon Sep 17 00:00:00 2001 From: JoryHogeveen Date: Mon, 24 Apr 2017 16:52:07 +0200 Subject: [PATCH 33/57] Update version validation --- includes/class-vaa.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/includes/class-vaa.php b/includes/class-vaa.php index c58f740e..fcac0ded 100644 --- a/includes/class-vaa.php +++ b/includes/class-vaa.php @@ -581,12 +581,12 @@ private function validate_versions() { // Start positive! $valid = true; - // Validate WP - if ( version_compare( $wp_version, '3.5', '<' ) ) { + // Validate WP. + if ( version_compare( $wp_version, '4.1', '<' ) ) { $this->add_notice( 'wp-version', array( 'type' => 'notice-error', 'message' => __( 'View Admin As', VIEW_ADMIN_AS_DOMAIN ) . ': ' - // Translators: %1$s stands for "WordPress", %2$s stands for version 3.5. + // Translators: %1$s stands for "WordPress", %2$s stands for the version. . sprintf( __( 'Plugin deactivated, %1$s version %2$s or higher is required', VIEW_ADMIN_AS_DOMAIN ), 'WordPress', '3.5' ), ) ); $valid = false; From b8f31d7f3264c89ded5f9eeaec384237cf25ab4d Mon Sep 17 00:00:00 2001 From: JoryHogeveen Date: Mon, 24 Apr 2017 16:53:43 +0200 Subject: [PATCH 34/57] Refactor file inclusions. --- includes/class-vaa.php | 68 +++++++++++++++++++++++++++++++----------- 1 file changed, 51 insertions(+), 17 deletions(-) diff --git a/includes/class-vaa.php b/includes/class-vaa.php index fcac0ded..de18d3a0 100644 --- a/includes/class-vaa.php +++ b/includes/class-vaa.php @@ -275,12 +275,51 @@ public function validate_user() { return $this->enable; } + /** + * Include a file. Optionally checks if the class already exists. + * + * @since 1.7.1 + * @access public + * + * @param string $file The file name. + * @param string $class (optional) The class name. + * @return bool + */ + public function include_file( $file, $class = '' ) { + static $loaded = array(); + + if ( in_array( $file, $loaded, true ) ) { + return true; + } + + if ( ! file_exists( $file ) ) { + return false; + } + + // Load file. + if ( empty( $class ) || ! class_exists( $class ) ) { + include_once( $file ); + } else { + $this->add_notice( 'class-error-' . $class, array( + 'type' => 'notice-error', + 'message' => '' . __( 'View Admin As', VIEW_ADMIN_AS_DOMAIN ) . ': ' + . __( 'Plugin not fully loaded because of a conflict with an other plugin or theme', VIEW_ADMIN_AS_DOMAIN ) + // Translators: %s stands for the class name. + . ' (' . sprintf( __( 'Class %s already exists', VIEW_ADMIN_AS_DOMAIN ), $class ) . ')', + ) ); + return false; + } + + $loaded[] = $file; + return true; + } + /** * Helper function to include files. Checks class existence and throws an error if needed. * Also adds the class to a supplied group if available. * * @since 1.7 - * @access private + * @access public * @param array $includes { * An array of files to include. * @type string $file The file to include. Directory starts from the plugin folder. @@ -289,28 +328,23 @@ public function validate_user() { * @param array $group A reference array. * @return array $group */ - private function include_files( $includes, &$group = null ) { + public function load_files( $includes, &$group = null ) { $group = (array) $group; foreach ( $includes as $key => $inc ) { - // Load file. - if ( empty( $inc['class'] ) || ! class_exists( $inc['class'] ) ) { - include_once( VIEW_ADMIN_AS_DIR . $inc['file'] ); - } else { - $this->add_notice( 'class-error-' . $key, array( - 'type' => 'notice-error', - 'message' => '' . __( 'View Admin As', VIEW_ADMIN_AS_DOMAIN ) . ': ' - . __( 'Plugin not fully loaded because of a conflict with an other plugin or theme', VIEW_ADMIN_AS_DOMAIN ) - // Translators: %s stands for the class name. - . ' (' . sprintf( __( 'Class %s already exists', VIEW_ADMIN_AS_DOMAIN ), $inc['class'] ) . ')', - ) ); + if ( empty( $inc['file'] ) ) { + continue; } + $class = ( ! empty( $inc['class'] ) ) ? $inc['class'] : ''; + + $this->include_file( VIEW_ADMIN_AS_DIR . $inc['file'], $class ); + // If it's a class file, add the class instance to the group. - if ( ! empty( $inc['class'] ) && is_callable( array( $inc['class'], 'get_instance' ) ) ) { - $group[ $key ] = call_user_func( array( $inc['class'], 'get_instance' ), $this ); + if ( ! empty( $class ) && is_callable( array( $class, 'get_instance' ) ) ) { + $group[ $key ] = call_user_func( array( $class, 'get_instance' ), $this ); } } return $group; @@ -343,7 +377,7 @@ private function load_ui() { ); // Include UI files and add them to the `ui` property. - $this->include_files( $includes, $this->ui ); + $this->load_files( $includes, $this->ui ); } /** @@ -374,7 +408,7 @@ private function load_modules() { } // Run include code but do not register modules yet (leave that to the modules). - $this->include_files( $includes ); + $this->load_files( $includes ); /** * Modules loaded. Hook is used for other modules related to View Admin As. From 178505789046ab023977286dfb854267bae32459 Mon Sep 17 00:00:00 2001 From: JoryHogeveen Date: Mon, 24 Apr 2017 16:54:44 +0200 Subject: [PATCH 35/57] Enhance plugin initialization. Do not load classes if the user isn't logged in. + make use of the include_file() method --- includes/class-vaa.php | 124 +++++++++++++++++++++-------------------- 1 file changed, 65 insertions(+), 59 deletions(-) diff --git a/includes/class-vaa.php b/includes/class-vaa.php index de18d3a0..f158c610 100644 --- a/includes/class-vaa.php +++ b/includes/class-vaa.php @@ -113,26 +113,37 @@ private function __construct() { return; } - if ( (boolean) $this->load() ) { - - // Lets start! - add_action( 'plugins_loaded', array( $this, 'init' ), 0 ); + // Lets start! + add_action( 'plugins_loaded', array( $this, 'init' ), 0 ); + } - } else { + /** + * Instantiate function that checks if the plugin is already loaded. + * + * @since 1.6 + * @access public + * @param bool $redo (optional) Force re-init? + */ + public function init( $redo = false ) { + static $done = false; + if ( $done && ! $redo ) return; - $this->add_notice( 'class-error-core', array( - 'type' => 'notice-error', - 'message' => '' . __( 'View Admin As', VIEW_ADMIN_AS_DOMAIN ) . ': ' - . __( 'Plugin not loaded because of a conflict with an other plugin or theme', VIEW_ADMIN_AS_DOMAIN ) - // Translators: %s stands for the class name. - . ' (' . sprintf( __( 'Class %s already exists', VIEW_ADMIN_AS_DOMAIN ), 'VAA_View_Admin_As_Class_Base' ) . ')', - ) ); + // We can't do this check before `plugins_loaded` hook. + if ( ! is_user_logged_in() ) { + return; + } + if ( ! $done ) { + $this->load(); } + + $this->run(); + + $done = true; } /** - * Load required classes and files. + * Verify that our classes don't exist yet. * Returns false on conflict. * * @since 1.6 @@ -140,53 +151,54 @@ private function __construct() { */ private function load() { - $classes = array( - 'VAA_API', - 'VAA_View_Admin_As_Class_Base', - 'VAA_View_Admin_As_Settings', - 'VAA_View_Admin_As_Store', - 'VAA_View_Admin_As_Controller', - 'VAA_View_Admin_As_View', - 'VAA_View_Admin_As_Update', - 'VAA_View_Admin_As_Compat', - 'VAA_View_Admin_As_Module', + $includes = array( + array( + 'file' => 'includes/class-api.php', + 'class' => 'VAA_API', + ), + array( + 'file' => 'includes/class-base.php', + 'class' => 'VAA_View_Admin_As_Class_Base', + ), + array( + 'file' => 'includes/class-settings.php', + 'class' => 'VAA_View_Admin_As_Settings', + ), + array( + 'file' => 'includes/class-store.php', + 'class' => 'VAA_View_Admin_As_Store', + ), + array( + 'file' => 'includes/class-controller.php', + 'class' => 'VAA_View_Admin_As_Controller', + ), + array( + 'file' => 'includes/class-view.php', + 'class' => 'VAA_View_Admin_As_View', + ), + array( + 'file' => 'includes/class-update.php', + 'class' => 'VAA_View_Admin_As_Update', + ), + array( + 'file' => 'includes/class-compat.php', + 'class' => 'VAA_View_Admin_As_Compat', + ), + array( + 'file' => 'includes/class-module.php', + 'class' => 'VAA_View_Admin_As_Module', + ), ); - foreach ( $classes as $class ) { - if ( class_exists( $class ) ) { + foreach ( $includes as $inc ) { + if ( ! $this->include_file( VIEW_ADMIN_AS_DIR . $inc['file'], $inc['class'] ) ) { return false; } } - require( VIEW_ADMIN_AS_DIR . 'includes/class-api.php' ); - require( VIEW_ADMIN_AS_DIR . 'includes/class-base.php' ); - require( VIEW_ADMIN_AS_DIR . 'includes/class-settings.php' ); - require( VIEW_ADMIN_AS_DIR . 'includes/class-store.php' ); - require( VIEW_ADMIN_AS_DIR . 'includes/class-controller.php' ); - require( VIEW_ADMIN_AS_DIR . 'includes/class-view.php' ); - require( VIEW_ADMIN_AS_DIR . 'includes/class-update.php' ); - require( VIEW_ADMIN_AS_DIR . 'includes/class-compat.php' ); - require( VIEW_ADMIN_AS_DIR . 'includes/class-module.php' ); - return true; } - /** - * Instantiate function that checks if the plugin is already loaded. - * - * @since 1.6 - * @access public - * @param bool $redo (optional) Force re-init? - */ - public function init( $redo = false ) { - static $done = false; - if ( $done && ! $redo ) return; - - $this->run(); - - $done = true; - } - /** * Run the plugin! * Check current user, load necessary data and register all used hooks. @@ -197,11 +209,6 @@ public function init( $redo = false ) { */ private function run() { - // We can't do this check before `plugins_loaded` hook. - if ( ! is_user_logged_in() ) { - return; - } - $this->store = VAA_View_Admin_As_Store::get_instance( $this ); $this->controller = VAA_View_Admin_As_Controller::get_instance( $this ); $this->view = VAA_View_Admin_As_View::get_instance( $this ); @@ -435,7 +442,6 @@ public function load_textdomain() { * Keep the third parameter pointing to the languages folder within this plugin * to enable support for custom .mo files. * - * @todo look into 4.6 changes Maybe the same can be done in an other way * @see https://make.wordpress.org/core/2016/07/06/i18n-improvements-in-4-6/ */ load_plugin_textdomain( 'view-admin-as', false, VIEW_ADMIN_AS_DIR . 'languages/' ); @@ -546,9 +552,9 @@ public function register_module( $data ) { * Add a welcome notice for new users * * @since 1.7 - * @access private + * @access public */ - private function welcome_notice() { + public function welcome_notice() { $this->add_notice( 'vaa-welcome', array( 'type' => 'notice-success', 'message' => '' . __( 'Thank you for installing View Admin As!', VIEW_ADMIN_AS_DOMAIN ) . ' ' From 0350b55e2e3fc20b2940ebdc8e8aa66145131618 Mon Sep 17 00:00:00 2001 From: JoryHogeveen Date: Mon, 24 Apr 2017 16:55:11 +0200 Subject: [PATCH 36/57] `get_capabilities()` args to get only certain capabilities --- includes/class-compat.php | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/includes/class-compat.php b/includes/class-compat.php index 61c9ef09..d4fc0497 100644 --- a/includes/class-compat.php +++ b/includes/class-compat.php @@ -109,20 +109,28 @@ public function init_after() { * @see init() * * @param array $caps The capabilities. - * @param bool $all Get all or only VAA related capabilities? + * @param array $args Pass arguments to get only certain capabilities. * @return array */ - public function get_capabilities( $caps = array(), $all = true ) { + public function get_capabilities( $caps = array(), $args = array() ) { - $caps = $this->add_capabilities( $caps ); + $args = wp_parse_args( $args, array( + 'vaa' => true, // Get VAA related capabilities? + 'wp' => true, // Get WP core related capabilities? + 'plugins' => true, // Get capabilities from plugin hooks and filters? + ) ); - if ( ! $all ) { - return $caps; + if ( $args['vaa'] ) { + $caps = $this->add_capabilities( $caps ); } - $caps = array_merge( $this->get_wordpress_capabilities(), $caps ); + if ( $args['wp'] ) { + $caps = array_merge( $this->get_wordpress_capabilities(), $caps ); + } - $caps = array_merge( $this->get_plugin_capabilities(), $caps ); + if ( $args['plugins'] ) { + $caps = array_merge( $this->get_plugin_capabilities(), $caps ); + } return $caps; } From 8885f3d6dc153eaac66e921bc58f7ea5f85b4d89 Mon Sep 17 00:00:00 2001 From: JoryHogeveen Date: Mon, 24 Apr 2017 16:55:28 +0200 Subject: [PATCH 37/57] `is_current_view()` API function --- includes/class-api.php | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/includes/class-api.php b/includes/class-api.php index 0d3a9bde..0cbf1003 100644 --- a/includes/class-api.php +++ b/includes/class-api.php @@ -89,6 +89,17 @@ public static function get_superior_admins() { return $superior_admins; } + /** + * Check if the provided data is the same as the current view. + * + * @since 1.7.1 + * @param array $data + * @return bool + */ + public static function is_current_view( $data ) { + return view_admin_as()->controller()->is_current_view( $data ); + } + /** * Is any toolbar showing? * Do not use this before the `init` hook. @@ -149,6 +160,7 @@ public static function get_vaa_action_link( $data, $nonce, $url = null ) { ); // @todo fix WP referrer/nonce checks and allow switching on any page without ajax. + // @see https://codex.wordpress.org/Function_Reference/check_admin_referer if ( empty( $url ) ) { if ( is_network_admin() ) { $url = network_admin_url(); From edbe3be81da8aa1ecf362fb6a696f5ad83264b6f Mon Sep 17 00:00:00 2001 From: JoryHogeveen Date: Mon, 24 Apr 2017 17:08:27 +0200 Subject: [PATCH 38/57] Do not run plugin if load failed. --- includes/class-vaa.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/includes/class-vaa.php b/includes/class-vaa.php index f158c610..5d363e5b 100644 --- a/includes/class-vaa.php +++ b/includes/class-vaa.php @@ -133,8 +133,8 @@ public function init( $redo = false ) { return; } - if ( ! $done ) { - $this->load(); + if ( ! $done && ! $this->load() ) { + return; } $this->run(); From aacb54cb44ab16b2924c832c2e54bba380907fcd Mon Sep 17 00:00:00 2001 From: JoryHogeveen Date: Mon, 24 Apr 2017 17:14:28 +0200 Subject: [PATCH 39/57] Only show notices if the plugin functionalities are enabled. --- includes/class-vaa.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/includes/class-vaa.php b/includes/class-vaa.php index 5d363e5b..322d343b 100644 --- a/includes/class-vaa.php +++ b/includes/class-vaa.php @@ -599,6 +599,10 @@ public function add_notice( $id, $notice ) { * @return void */ public function do_admin_notices() { + // Only show notices if the plugin functionalities are enabled. + if ( ! $this->is_enabled() ) { + return; + } foreach ( $this->notices as $notice ) { if ( isset( $notice['type'] ) && ! empty( $notice['message'] ) ) { echo '

    ' . $notice['message'] . '

    '; From d74f989281ed182fd3ee4b1aaa4ac42965da3eb5 Mon Sep 17 00:00:00 2001 From: JoryHogeveen Date: Mon, 24 Apr 2017 17:19:46 +0200 Subject: [PATCH 40/57] Preload API class for unit tests --- tests/test-api.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tests/test-api.php b/tests/test-api.php index 4609e375..bcfb764a 100644 --- a/tests/test-api.php +++ b/tests/test-api.php @@ -6,6 +6,8 @@ * @package View_Admin_As */ +view_admin_as()->include_file( VIEW_ADMIN_AS_DIR . 'includes/class-api.php', 'VAA_API' ); + class VAA_API_UnitTest extends WP_UnitTestCase { /** From 887b6df43327a0761bd35d77e9e2393716299346 Mon Sep 17 00:00:00 2001 From: JoryHogeveen Date: Mon, 24 Apr 2017 17:34:36 +0200 Subject: [PATCH 41/57] Version tag + minify CSS + Readme updates --- README.md | 1 + assets/css/view-admin-as.min.css | 4 ++-- includes/class-api.php | 2 +- includes/class-compat.php | 2 +- includes/class-controller.php | 2 +- includes/class-store.php | 2 +- includes/class-vaa.php | 2 +- modules/class-restrict-user-access.php | 2 +- modules/class-role-defaults.php | 2 +- readme.txt | 12 ++++++++++++ ui/class-admin-bar.php | 2 +- ui/class-ui.php | 2 +- 12 files changed, 24 insertions(+), 11 deletions(-) diff --git a/README.md b/README.md index 97f61bb3..9e082af6 100644 --- a/README.md +++ b/README.md @@ -39,6 +39,7 @@ It also features a "Role manager" module to add, edit or remove roles and grant ### Module: Role manager (role editor) * Add, edit or delete roles * Grant and/or add capabilities to roles +* Rename roles * Clone roles * Update role capabilities from current view diff --git a/assets/css/view-admin-as.min.css b/assets/css/view-admin-as.min.css index 1eebcd11..2ab218bc 100644 --- a/assets/css/view-admin-as.min.css +++ b/assets/css/view-admin-as.min.css @@ -5,7 +5,7 @@ * @author Jory Hogeveen * @package View_Admin_As * @since 1.1 - * @version 1.7 + * @version 1.7.1 * @preserve */ -.vaa-loader-icon{width:40px;height:40px;background:transparent url('../../../../../wp-includes/images/spinner-2x.gif') center center no-repeat;background-size:contain}#vaa-overlay{position:fixed;top:0;left:0;height:100%;width:100%;background:rgba(255,255,255,0.85);display:none;z-index:999999999}#vaa-overlay .vaa-loader-icon{position:fixed;top:50%;left:50%;margin:-20px 0 0 -20px;display:block}#vaa-overlay .vaa-overlay-container{max-width:75%;min-width:50%;max-height:50%;min-height:20px;margin:0 25%;top:10%;background:#fff;box-shadow:0 0 5px #aaa;padding:10px;border-radius:3px;position:relative}#vaa-overlay .vaa-overlay-container>.remove{position:absolute;right:-10px;top:-10px;background:#FFF;width:20px;height:20px;cursor:pointer}#vaa-overlay .vaa-overlay-container .vaa-response-data{overflow:hidden;overflow-y:auto}#vaa-overlay .vaa-overlay-container .vaa-response-data ul li{margin-left:20px;list-style:disc outside}#vaa-overlay .vaa-overlay-container.vaa-message{border:2px solid #0075b3}#vaa-overlay .vaa-overlay-container.vaa-warning{border:2px solid #c8730c}#vaa-overlay .vaa-overlay-container.vaa-error{border:2px solid #dc3232}#vaa-overlay .vaa-overlay-container.vaa-success{border:2px solid #46b450}#wpadminbar .vaa-notice{display:inline-block;padding:0 5px 0 10px;background:#fff}#wpadminbar .vaa-notice.vaa-message,#wpadminbar .vaa-notice.vaa-message .ab-icon:before{color:#0075b3 !important}#wpadminbar .vaa-notice.vaa-warning,#wpadminbar .vaa-notice.vaa-warning .ab-icon:before{color:#c8730c !important}#wpadminbar .vaa-notice.vaa-error,#wpadminbar .vaa-notice.vaa-error .ab-icon:before{color:#dc3232 !important}#wpadminbar .vaa-notice.vaa-success,#wpadminbar .vaa-notice.vaa-success .ab-icon:before{color:#46b450 !important}#wpadminbar #wp-admin-bar-vaa .vaa-notice{display:block;clear:both;margin-bottom:3px}#wpadminbar #wp-admin-bar-vaa .vaa-notice button{vertical-align:baseline;margin:0 0 0 -5px;padding:1px 10px}#wpadminbar .vaa-notice .remove,#wpadminbar #wp-admin-bar-vaa .remove{cursor:pointer;top:2px;float:right;margin-right:0;margin-left:6px}#wpadminbar #wp-admin-bar-vaa ul li,#wpadminbar #wp-admin-bar-vaa .ab-item{clear:both}#wpadminbar #wp-admin-bar-vaa>.ab-item>.ab-label{float:left}#wpadminbar #wp-admin-bar-vaa>.ab-item>.ab-icon{float:right;margin-right:0;margin-left:6px;top:2px}#wpadminbar #wp-admin-bar-vaa .vaa-has-icon>.ab-item>.ab-icon{float:none;font-size:16px;line-height:16px;vertical-align:text-bottom;font-weight:normal;padding:0}#wpadminbar #wp-admin-bar-vaa .vaa-has-icon>.ab-item::before{display:none}#wpadminbar #wp-admin-bar-vaa .vaa-has-icon.menupop>.ab-item{padding-left:10px;padding-right:10px}#wpadminbar #wp-admin-bar-vaa .vaa-has-icon.ab-vaa-title>.ab-item>.ab-icon{font-size:18px;line-height:20px;margin:0 5px 0 -1px}#wpadminbar #wp-admin-bar-vaa button>.ab-icon{margin:0 5px 0 -5px;padding:0;top:0}#wpadminbar #wp-admin-bar-vaa .ab-item>label+button{margin:0 0 0 12px;vertical-align:baseline}#wpadminbar #wp-admin-bar-vaa .ab-sub-wrapper .ab-item>span{line-height:26px}#wpadminbar #wp-admin-bar-vaa .ab-item>span.remove{font-size:16px;line-height:16px;top:1px}#wpadminbar #wp-admin-bar-vaa .ab-bold>.ab-item,#wpadminbar #wp-admin-bar-vaa .ab-bold>.ab-item *{font-weight:bold !important}#wpadminbar #wp-admin-bar-vaa .ab-italic>.ab-item,#wpadminbar #wp-admin-bar-vaa .ab-italic>.ab-item *{font-style:italic !important}#wpadminbar #wp-admin-bar-vaa .vaa-sub-transparent>*{opacity:.5;transition:opacity .2s}#wpadminbar #wp-admin-bar-vaa .vaa-sub-transparent:hover>*{opacity:1}#wpadminbar #wp-admin-bar-vaa .ab-vaa-results{margin:6px 0;padding:0}#wpadminbar #wp-admin-bar-vaa .ab-vaa-results:empty{display:none}#wpadminbar #wp-admin-bar-vaa.menupop ul.ab-sub-secondary{position:static}#wpadminbar #wp-admin-bar-vaa.menupop .menupop>.ab-item:before{top:1px}#wpadminbar #wp-admin-bar-vaa .ab-vaa-spacing-top,#wpadminbar #wp-admin-bar-vaa>div>ul.ab-sub-secondary+ul.ab-sub-secondary{margin-top:3px}#wpadminbar #wp-admin-bar-vaa .ab-sub-wrapper .ab-sub-wrapper ul.ab-sub-secondary+ul.ab-sub-secondary{padding-top:0}#wpadminbar #wp-admin-bar-vaa .auto-height>.ab-item{height:auto}#wpadminbar #wp-admin-bar-vaa .ab-item .description{height:auto;line-height:1.2;font-size:.8em;font-style:italic;margin-bottom:7px;white-space:normal}#wpadminbar #wp-admin-bar-vaa .ab-item .description:first-child{margin-bottom:0}#wpadminbar #wp-admin-bar-vaa.menupop .ab-vaa-title .ab-item{font-weight:bold;line-height:26px;font-size:1.1em;text-transform:uppercase}#wpadminbar #wp-admin-bar-vaa .current>.ab-item,#wpadminbar #wp-admin-bar-vaa .current>.ab-item .vaa-view-data,#wpadminbar #wp-admin-bar-vaa .current>input:checked+label,#wpadminbar #wp-admin-bar-vaa .current-parent>.ab-item,#wpadminbar #wp-admin-bar-vaa .current-parent>.ab-item .vaa-view-data,#wpadminbar #wp-admin-bar-vaa .current-parent>label{font-weight:bold}#wpadminbar #wp-admin-bar-vaa .current>.ab-item::after,#wpadminbar #wp-admin-bar-vaa .current>label::after{content:'\f177';font-family:'dashicons';margin:0 5px;font-size:17px;vertical-align:middle;font-weight:normal}#wpadminbar .ab-top-secondary .menupop .vaa-menupop>.ab-item{padding-left:2em;padding-right:1em}#wpadminbar .ab-top-secondary .menupop .vaa-menupop>.ab-item .ab-icon{margin-left:-20px;margin-right:4px}#wpadminbar #wp-admin-bar-vaa .ab-vaa-multipleselect .ab-item,#wpadminbar #wp-admin-bar-vaa .ab-vaa-input .ab-item,#wpadminbar #wp-admin-bar-vaa .ab-vaa-search .ab-item,#wpadminbar #wp-admin-bar-vaa .ab-vaa-filter .ab-item,#wpadminbar #wp-admin-bar-vaa .ab-vaa-select .ab-item{height:auto;clear:both}#wpadminbar #wp-admin-bar-vaa .ab-vaa-input .ab-item input,#wpadminbar #wp-admin-bar-vaa .ab-vaa-search .ab-item input,#wpadminbar #wp-admin-bar-vaa .ab-vaa-filter .ab-item input,#wpadminbar #wp-admin-bar-vaa .ab-vaa-select .ab-item select{display:inline-block;background:#fff;color:#555;margin:5px 0;padding:3px;border:0;line-height:normal;height:auto;width:100%;box-sizing:border-box}#wpadminbar #wp-admin-bar-vaa .ab-vaa-select .ab-item select{padding:2px 3px}#wpadminbar #wp-admin-bar-vaa .ab-vaa-select .ab-item label+input,#wpadminbar #wp-admin-bar-vaa .ab-vaa-select .ab-item label+select{margin-top:0}#wpadminbar #wp-admin-bar-vaa .ab-vaa-textarea .ab-item{height:auto;line-height:normal}#wpadminbar #wp-admin-bar-vaa .ab-vaa-textarea .ab-item textarea{width:100%;padding:5px;margin-top:5px;box-sizing:border-box;line-height:normal}#wpadminbar #wp-admin-bar-vaa .ab-item select+button.input-overlay,#wpadminbar #wp-admin-bar-vaa .ab-item input+button.input-overlay{position:absolute;right:10px;margin:5px 0}#wpadminbar #wp-admin-bar-vaa input.checkbox,#wpadminbar #wp-admin-bar-vaa input.radio{display:inline-block;height:16px;width:16px;vertical-align:text-bottom;box-sizing:border-box;cursor:pointer}#wpadminbar #wp-admin-bar-vaa .ab-item input.checkbox,#wpadminbar #wp-admin-bar-vaa .ab-item input.radio{margin:0 5px 0 0}#wpadminbar #wp-admin-bar-vaa .ab-item input.checkbox+label,#wpadminbar #wp-admin-bar-vaa .ab-item input.checkbox+label *,#wpadminbar #wp-admin-bar-vaa .ab-item input.radio+label,#wpadminbar #wp-admin-bar-vaa .ab-item input.radio+label *{line-height:18px;vertical-align:text-top;display:inline}#wpadminbar #wp-admin-bar-vaa .ab-item input.checkbox+label:hover,#wpadminbar #wp-admin-bar-vaa .ab-item input.radio+label:hover{cursor:pointer}#wpadminbar #wp-admin-bar-vaa .ab-item input.checkbox:first-child,#wpadminbar #wp-admin-bar-vaa .ab-item input.radio:first-child{margin:0 6px 0 0}#wpadminbar #wp-admin-bar-vaa .ab-item input.radio{border-radius:100%}#wpadminbar #wp-admin-bar-vaa .ab-item input.radio+label+br{line-height:0}#wpadminbar #wp-admin-bar-vaa input.checkbox.vaa-right,#wpadminbar #wp-admin-bar-vaa input.radio.vaa-right{position:absolute;top:5px;right:1em;z-index:99}#wpadminbar #wp-admin-bar-vaa .ab-vaa-multipleselect{max-height:400px;min-width:250px;overflow:hidden;overflow-y:auto;margin:6px 0;padding:0;border:solid transparent;border-width:0 10px;transition:max-height .3s}#wpadminbar #wp-admin-bar-vaa .ab-vaa-multipleselect .ab-empty-item{height:auto;overflow:hidden;margin:0;padding:5px 10px;background-color:#fff}#wpadminbar #wp-admin-bar-vaa .ab-vaa-multipleselect .ab-empty-item .ab-item{color:#333}#wpadminbar #wp-admin-bar-vaa .ab-vaa-multipleselect.vaa-small{max-height:100px}#wpadminbar #wp-admin-bar-vaa .ab-vaa-multipleselect .remove:before{color:#333}#wpadminbar #wp-admin-bar-vaa ul li.vaa-column-one-half{width:50%;display:block;float:left;clear:none}#wpadminbar #wp-admin-bar-vaa ul li.vaa-column-one-half .ab-item{min-width:0}#wpadminbar #wp-admin-bar-vaa ul li.vaa-column-one-half.vaa-column-first .ab-item{padding-right:1px}#wpadminbar #wp-admin-bar-vaa ul li.vaa-column-one-half.vaa-column-last .ab-item{padding-left:1px}#wpadminbar #wp-admin-bar-vaa ul li.vaa-clear-float{clear:both}#wpadminbar #wp-admin-bar-vaa .vaa-button-container>.ab-item{overflow:hidden;height:auto}#wpadminbar #wp-admin-bar-vaa button{float:none;text-decoration:none;font-size:13px;line-height:20px;height:20px;margin:3px 0;padding:0 10px 1px;vertical-align:middle;cursor:pointer}#wpadminbar #wp-admin-bar-vaa .vaa-icon{padding:0 2px 1px}#wpadminbar #wp-admin-bar-vaa .vaa-icon .ab-icon{margin:0}#wpadminbar #wp-admin-bar-vaa button.vaa-icon .ab-icon{padding:0}#wpadminbar #wp-admin-bar-vaa button#reset-view{margin:0 0 5px}#wpadminbar #wp-admin-bar-vaa .ab-vaa-toggle .ab-item{padding-right:34px}#wpadminbar #wp-admin-bar-vaa .ab-vaa-toggle .ab-item:hover{cursor:pointer}#wpadminbar #wp-admin-bar-vaa .ab-vaa-toggle .ab-item::after{content:"\f140";font-family:'dashicons';position:absolute;right:10px;margin:0;font-size:20px;font-weight:normal}#wpadminbar #wp-admin-bar-vaa .ab-vaa-toggle.active .ab-item::after{content:"\f142"}#wpadminbar #wp-admin-bar-vaa.fullPopupActive .ab-sub-wrapper,#wpadminbar #wp-admin-bar-vaa.fullPopupActive .ab-sub-wrapper .ab-item{display:none}#wpadminbar #wp-admin-bar-vaa.fullPopupActive>.ab-sub-wrapper{display:block}#wpadminbar #wp-admin-bar-vaa.fullPopupActive>.ab-sub-wrapper>.ab-submenu{padding:0}#wpadminbar #wp-admin-bar-vaa.fullPopupActive .ab-sub-wrapper.fullPopup{position:fixed;display:block;visibility:visible;overflow:hidden;z-index:999;max-height:90%;width:90%;margin:5%;top:0;left:0;box-shadow:0 0 50px rgba(0,0,0,0.3)}#wpadminbar #wp-admin-bar-vaa.fullPopupActive .ab-sub-wrapper.fullPopup .ab-item{display:block}#wpadminbar #wp-admin-bar-vaa #wp-admin-bar-vaa-caps #apply-caps-view{float:left;margin-right:5px}#wpadminbar #wp-admin-bar-vaa #wp-admin-bar-vaa-caps #reset-caps-view,#wpadminbar #wp-admin-bar-vaa #wp-admin-bar-vaa-caps #open-caps-popup,#wpadminbar #wp-admin-bar-vaa #wp-admin-bar-vaa-caps #close-caps-popup{float:right;margin-left:5px;height:auto}#wpadminbar #wp-admin-bar-vaa #wp-admin-bar-vaa-caps #close-caps-popup{display:none}#wpadminbar #wp-admin-bar-vaa.fullPopupActive #wp-admin-bar-vaa-caps .ab-sub-wrapper.fullPopup #close-caps-popup{display:block}#wpadminbar #wp-admin-bar-vaa.fullPopupActive #wp-admin-bar-vaa-caps .ab-sub-wrapper.fullPopup #open-caps-popup{display:none}#wpadminbar #wp-admin-bar-vaa.fullPopupActive #wp-admin-bar-vaa-caps .ab-sub-wrapper.fullPopup #wp-admin-bar-vaa-caps-select-options .vaa-cap-item{width:250px;float:left;clear:none}#wpadminbar #wp-admin-bar-vaa #wp-admin-bar-vaa-caps-popup:hover{cursor:pointer}#wpadminbar #wp-admin-bar-my-account #wp-admin-bar-vaa>.ab-item>.ab-label{line-height:26px}#wpadminbar #wp-admin-bar-my-account #wp-admin-bar-vaa>.ab-item>.ab-icon{top:0}#vaa_toolbar #wpadminbar{position:fixed !important;width:auto;min-width:0;right:0;left:auto;border-radius:0 0 0 5px}#vaa_toolbar #wpadminbar #wp-admin-bar-vaa>.ab-item .ab-icon{margin-left:0}#vaa_toolbar #wpadminbar #wp-admin-bar-vaa>.ab-item .ab-label{display:none}#vaa_toolbar #wpadminbar #wp-admin-bar-vaa:hover>.ab-item .ab-icon{margin-left:6px}#vaa_toolbar #wpadminbar #wp-admin-bar-vaa:hover>.ab-item .ab-label{display:inline-block}@media screen and (max-width:782px){#wpadminbar #wp-admin-bar-vaa{display:block;position:static}#wpadminbar #wp-admin-bar-vaa>.ab-item>.ab-icon{margin-left:0}#wpadminbar #wp-admin-bar-vaa .ab-sub-wrapper{width:100%}#wpadminbar #wp-admin-bar-vaa .ab-sub-wrapper .ab-sub-wrapper{position:static;top:auto;margin:0;-webkit-box-shadow:none;-moz-box-shadow:none;box-shadow:none}#wpadminbar #wp-admin-bar-vaa.menupop .menupop>.ab-item:before{content:''}#wpadminbar #wp-admin-bar-vaa .ab-item .vaa-hide-responsive{display:none}#wpadminbar #wp-admin-bar-vaa .vaa-notice{line-height:42px;font-size:16px}#wpadminbar #wp-admin-bar-vaa .vaa-notice .ab-icon{height:auto}#wpadminbar #wp-admin-bar-vaa>div>ul,#wpadminbar #wp-admin-bar-vaa .menupop>.ab-sub-wrapper .ab-submenu{padding:5px 0}#wpadminbar #wp-admin-bar-vaa .menupop>.ab-sub-wrapper .ab-item{padding:8px 44px;white-space:normal;height:auto}#wpadminbar #wp-admin-bar-vaa .menupop>.ab-sub-wrapper .ab-item>.ab-item{padding:8px 0}#wpadminbar #wp-admin-bar-vaa .menupop>.ab-sub-wrapper:last-child .ab-item.description{margin-bottom:0}#wpadminbar #wp-admin-bar-vaa .ab-item>span.remove,#wpadminbar #wp-admin-bar-vaa .vaa-has-icon .ab-item .ab-icon{width:auto;height:auto;font-size:22px !important;margin-right:10px;vertical-align:text-top}#wpadminbar #wp-admin-bar-vaa .ab-vaa-title.vaa-has-icon>.ab-item>.ab-icon{font-size:30px !important;margin-left:-6px;margin-top:-1px;vertical-align:top}#wpadminbar #wp-admin-bar-vaa .vaa-has-icon.menupop>.ab-item{padding-left:12px;padding-right:12px}#wpadminbar #wp-admin-bar-vaa .vaa-menupop div li{margin-left:12px}#wpadminbar #wp-admin-bar-vaa .ab-sub-wrapper .vaa-role-item.menupop>.ab-item{padding-left:15px}#wpadminbar #wp-admin-bar-vaa .ab-vaa-toggle .ab-item::after,#wpadminbar #wp-admin-bar-vaa .ab-sub-wrapper .vaa-menupop.menupop>.ab-item:after{content:"\f140";font-family:'dashicons';position:absolute;right:10px;top:8px;margin:0;font-size:30px;font-weight:normal}#wpadminbar #wp-admin-bar-vaa .ab-vaa-toggle.active .ab-item::after,#wpadminbar #wp-admin-bar-vaa .ab-sub-wrapper .vaa-menupop.menupop.active>.ab-item:after{content:"\f142"}#wpadminbar #wp-admin-bar-vaa button{font-size:16px;padding:5px 15px}#wpadminbar #wp-admin-bar-vaa .ab-vaa-input .ab-item input,#wpadminbar #wp-admin-bar-vaa .ab-vaa-search .ab-item input,#wpadminbar #wp-admin-bar-vaa .ab-vaa-filter .ab-item input{padding:8px 12px}#wpadminbar #wp-admin-bar-vaa .ab-vaa-select .ab-item select{padding:7px 12px}#wpadminbar #wp-admin-bar-vaa .ab-item select+button.input-overlay,#wpadminbar #wp-admin-bar-vaa .ab-item input+button.input-overlay{right:44px;padding:6px 10px 7px;font-size:14px}#wpadminbar #wp-admin-bar-vaa .ab-vaa-multipleselect{border-width:0 44px;max-height:300px !important}#wpadminbar #wp-admin-bar-vaa .menupop>.ab-sub-wrapper .ab-vaa-multipleselect>.ab-item{padding:8px 16px}#wpadminbar #wp-admin-bar-vaa input.checkbox,#wpadminbar #wp-admin-bar-vaa input.radio{width:24px;height:24px}#wpadminbar #wp-admin-bar-vaa input.checkbox.vaa-right,#wpadminbar #wp-admin-bar-vaa input.radio.vaa-right{top:9px;right:11px}} \ No newline at end of file +.vaa-loader-icon{width:40px;height:40px;background:transparent url('../../../../../wp-includes/images/spinner-2x.gif') center center no-repeat;background-size:contain}#vaa-overlay{position:fixed;top:0;left:0;height:100%;width:100%;background:rgba(255,255,255,0.85);display:none;z-index:999999999}#vaa-overlay .vaa-loader-icon{position:fixed;top:50%;left:50%;margin:-20px 0 0 -20px;display:block}#vaa-overlay .vaa-overlay-container{max-width:75%;min-width:50%;max-height:50%;min-height:20px;margin:0 25%;top:10%;background:#fff;box-shadow:0 0 5px #aaa;padding:10px;border-radius:3px;position:relative}#vaa-overlay .vaa-overlay-container>.remove{position:absolute;right:-10px;top:-10px;background:#FFF;width:20px;height:20px;cursor:pointer}#vaa-overlay .vaa-overlay-container .vaa-response-data{overflow:hidden;overflow-y:auto}#vaa-overlay .vaa-overlay-container .vaa-response-data ul li{margin-left:20px;list-style:disc outside}#vaa-overlay .vaa-overlay-container.vaa-message{border:2px solid #0075b3}#vaa-overlay .vaa-overlay-container.vaa-warning{border:2px solid #c8730c}#vaa-overlay .vaa-overlay-container.vaa-error{border:2px solid #dc3232}#vaa-overlay .vaa-overlay-container.vaa-success{border:2px solid #46b450}#wpadminbar .vaa-notice{display:inline-block;padding:0 5px 0 10px;background:#fff}#wpadminbar .vaa-notice.vaa-message,#wpadminbar .vaa-notice.vaa-message .ab-icon:before{color:#0075b3 !important}#wpadminbar .vaa-notice.vaa-warning,#wpadminbar .vaa-notice.vaa-warning .ab-icon:before{color:#c8730c !important}#wpadminbar .vaa-notice.vaa-error,#wpadminbar .vaa-notice.vaa-error .ab-icon:before{color:#dc3232 !important}#wpadminbar .vaa-notice.vaa-success,#wpadminbar .vaa-notice.vaa-success .ab-icon:before{color:#46b450 !important}#wpadminbar #wp-admin-bar-vaa .vaa-notice{display:block;clear:both;margin-bottom:3px}#wpadminbar #wp-admin-bar-vaa .vaa-notice button{vertical-align:baseline;margin:0 0 0 -5px;padding:1px 10px}#wpadminbar .vaa-notice .remove,#wpadminbar #wp-admin-bar-vaa .remove{cursor:pointer;top:2px;float:right;margin-right:0;margin-left:6px}#wpadminbar #wp-admin-bar-vaa ul li,#wpadminbar #wp-admin-bar-vaa .ab-item{clear:both}#wpadminbar #wp-admin-bar-vaa .ab-sub-wrapper .ab-item>span{line-height:26px}#wpadminbar #wp-admin-bar-vaa .ab-item>span.remove{font-size:16px;line-height:16px;top:1px}#wpadminbar #wp-admin-bar-vaa .ab-bold>.ab-item,#wpadminbar #wp-admin-bar-vaa .ab-bold>.ab-item *{font-weight:bold !important}#wpadminbar #wp-admin-bar-vaa .ab-italic>.ab-item,#wpadminbar #wp-admin-bar-vaa .ab-italic>.ab-item *{font-style:italic !important}#wpadminbar #wp-admin-bar-vaa .vaa-sub-transparent>*{opacity:.5;transition:opacity .2s}#wpadminbar #wp-admin-bar-vaa .vaa-sub-transparent:hover>*{opacity:1}#wpadminbar #wp-admin-bar-vaa .ab-vaa-results{margin:6px 0;padding:0}#wpadminbar #wp-admin-bar-vaa .ab-vaa-results:empty{display:none}#wpadminbar #wp-admin-bar-vaa .ab-vaa-spacing-top,#wpadminbar #wp-admin-bar-vaa>div>ul.ab-sub-secondary+ul.ab-sub-secondary{margin-top:3px}#wpadminbar #wp-admin-bar-vaa .ab-sub-wrapper .ab-sub-wrapper ul.ab-sub-secondary+ul.ab-sub-secondary{padding-top:0}#wpadminbar #wp-admin-bar-vaa .auto-height>.ab-item{height:auto}#wpadminbar #wp-admin-bar-vaa .ab-item .description{height:auto;line-height:1.2;font-size:.8em;font-style:italic;margin-bottom:7px;white-space:normal}#wpadminbar #wp-admin-bar-vaa .ab-item .description:first-child{margin-bottom:0}#wpadminbar #wp-admin-bar-vaa.menupop .ab-vaa-title .ab-item{font-weight:bold;line-height:26px;font-size:1.1em;text-transform:uppercase}#wpadminbar #wp-admin-bar-vaa .current>.ab-item,#wpadminbar #wp-admin-bar-vaa .current>.ab-item .vaa-view-data,#wpadminbar #wp-admin-bar-vaa .current>input:checked+label,#wpadminbar #wp-admin-bar-vaa .current-parent>.ab-item,#wpadminbar #wp-admin-bar-vaa .current-parent>.ab-item .vaa-view-data,#wpadminbar #wp-admin-bar-vaa .current-parent>label{font-weight:bold}#wpadminbar #wp-admin-bar-vaa .current>.ab-item::after,#wpadminbar #wp-admin-bar-vaa .current>label::after{content:'\f177';font-family:'dashicons';margin:0 5px;font-size:17px;vertical-align:middle;font-weight:normal}#wpadminbar #wp-admin-bar-vaa>.ab-item>.ab-label{float:left}#wpadminbar #wp-admin-bar-vaa>.ab-item>.ab-icon{float:right;margin-right:0;margin-left:6px;top:2px}#wpadminbar #wp-admin-bar-vaa .vaa-has-icon>.ab-item>.ab-icon{float:none;font-size:16px;line-height:16px;vertical-align:text-bottom;font-weight:normal !important;padding:0}#wpadminbar #wp-admin-bar-vaa .vaa-has-icon>.ab-item::before{display:none}#wpadminbar #wp-admin-bar-vaa .vaa-has-icon.menupop>.ab-item{padding-left:10px;padding-right:10px}#wpadminbar #wp-admin-bar-vaa .vaa-has-icon.ab-vaa-title>.ab-item>.ab-icon{font-size:18px;line-height:20px;margin:0 5px 0 -1px}#wpadminbar .ab-top-secondary .menupop .vaa-menupop>.ab-item{padding-left:2em;padding-right:1em}#wpadminbar .ab-top-secondary .menupop .vaa-menupop>.ab-item .ab-icon{margin-left:-20px;margin-right:4px}#wpadminbar #wp-admin-bar-vaa.menupop ul.ab-sub-secondary{position:static}#wpadminbar #wp-admin-bar-vaa.menupop .menupop>.ab-item:before{top:1px}#wpadminbar #wp-admin-bar-vaa button>.ab-icon{margin:0 5px 0 -5px;padding:0;top:0}#wpadminbar #wp-admin-bar-vaa .ab-item>label+button{margin:0 0 0 12px;vertical-align:baseline}#wpadminbar #wp-admin-bar-vaa .vaa-button-container>.ab-item{overflow:hidden;height:auto}#wpadminbar #wp-admin-bar-vaa button{float:none;text-decoration:none;font-size:13px;line-height:20px;height:20px;margin:3px 0;padding:0 10px 1px;vertical-align:middle;cursor:pointer}#wpadminbar #wp-admin-bar-vaa .vaa-icon{padding:0 2px 1px}#wpadminbar #wp-admin-bar-vaa .vaa-icon .ab-icon{margin:0}#wpadminbar #wp-admin-bar-vaa button.vaa-icon .ab-icon{padding:0}#wpadminbar #wp-admin-bar-vaa .ab-vaa-multipleselect .ab-item,#wpadminbar #wp-admin-bar-vaa .ab-vaa-input .ab-item,#wpadminbar #wp-admin-bar-vaa .ab-vaa-search .ab-item,#wpadminbar #wp-admin-bar-vaa .ab-vaa-filter .ab-item,#wpadminbar #wp-admin-bar-vaa .ab-vaa-select .ab-item{height:auto;clear:both}#wpadminbar #wp-admin-bar-vaa .ab-vaa-input .ab-item input,#wpadminbar #wp-admin-bar-vaa .ab-vaa-search .ab-item input,#wpadminbar #wp-admin-bar-vaa .ab-vaa-filter .ab-item input,#wpadminbar #wp-admin-bar-vaa .ab-vaa-select .ab-item select{display:inline-block;background:#fff;color:#555;margin:5px 0;padding:3px;border:0;line-height:normal;height:auto;width:100%;box-sizing:border-box}#wpadminbar #wp-admin-bar-vaa .ab-vaa-select .ab-item select{padding:2px 3px}#wpadminbar #wp-admin-bar-vaa .ab-vaa-select .ab-item label+input,#wpadminbar #wp-admin-bar-vaa .ab-vaa-select .ab-item label+select{margin-top:0}#wpadminbar #wp-admin-bar-vaa .ab-vaa-textarea .ab-item{height:auto;line-height:normal}#wpadminbar #wp-admin-bar-vaa .ab-vaa-textarea .ab-item textarea{width:100%;padding:5px;margin-top:5px;box-sizing:border-box;line-height:normal}#wpadminbar #wp-admin-bar-vaa .ab-item select+button.input-overlay,#wpadminbar #wp-admin-bar-vaa .ab-item input+button.input-overlay{position:absolute;right:10px;margin:5px 0}#wpadminbar #wp-admin-bar-vaa input.checkbox,#wpadminbar #wp-admin-bar-vaa input.radio{display:inline-block;height:16px;width:16px;vertical-align:text-bottom;box-sizing:border-box;cursor:pointer}#wpadminbar #wp-admin-bar-vaa .ab-item input.checkbox,#wpadminbar #wp-admin-bar-vaa .ab-item input.radio{margin:0 5px 0 0}#wpadminbar #wp-admin-bar-vaa .ab-item input.checkbox+label,#wpadminbar #wp-admin-bar-vaa .ab-item input.checkbox+label *,#wpadminbar #wp-admin-bar-vaa .ab-item input.radio+label,#wpadminbar #wp-admin-bar-vaa .ab-item input.radio+label *{line-height:18px;vertical-align:text-top;display:inline}#wpadminbar #wp-admin-bar-vaa .ab-item input.checkbox+label:hover,#wpadminbar #wp-admin-bar-vaa .ab-item input.radio+label:hover{cursor:pointer}#wpadminbar #wp-admin-bar-vaa .ab-item input.checkbox:first-child,#wpadminbar #wp-admin-bar-vaa .ab-item input.radio:first-child{margin:0 6px 0 0}#wpadminbar #wp-admin-bar-vaa .ab-item input.radio{border-radius:100%}#wpadminbar #wp-admin-bar-vaa .ab-item input.radio+label+br{line-height:0}#wpadminbar #wp-admin-bar-vaa input.checkbox.vaa-right,#wpadminbar #wp-admin-bar-vaa input.radio.vaa-right{position:absolute;top:5px;right:1em;z-index:99}#wpadminbar #wp-admin-bar-vaa .ab-vaa-multipleselect{max-height:400px;min-width:250px;overflow:hidden;overflow-y:auto;margin:6px 0;padding:0;border:solid transparent;border-width:0 10px;transition:max-height .3s}#wpadminbar #wp-admin-bar-vaa .ab-vaa-multipleselect .ab-empty-item{height:auto;overflow:hidden;margin:0;padding:5px 10px;background-color:#fff}#wpadminbar #wp-admin-bar-vaa .ab-vaa-multipleselect .ab-empty-item .ab-item{color:#333}#wpadminbar #wp-admin-bar-vaa .ab-vaa-multipleselect.vaa-small{max-height:100px}#wpadminbar #wp-admin-bar-vaa .ab-vaa-multipleselect .remove:before{color:#333}#wpadminbar #wp-admin-bar-vaa .vaa-column-one-half{width:50%;display:block;float:left;clear:none}#wpadminbar #wp-admin-bar-vaa .vaa-column-one-half .ab-item{min-width:0}#wpadminbar #wp-admin-bar-vaa .vaa-column-one-half.vaa-column-first .ab-item{padding-right:1px}#wpadminbar #wp-admin-bar-vaa .vaa-column-one-half.vaa-column-last .ab-item{padding-left:1px}#wpadminbar #wp-admin-bar-vaa .vaa-clear-float{clear:both}#wpadminbar #wp-admin-bar-vaa .ab-vaa-toggle .ab-item{padding-right:34px}#wpadminbar #wp-admin-bar-vaa .ab-vaa-toggle .ab-item:hover{cursor:pointer}#wpadminbar #wp-admin-bar-vaa .ab-vaa-toggle .ab-item::after{content:"\f140";font-family:'dashicons';position:absolute;right:10px;margin:0;font-size:20px;font-weight:normal}#wpadminbar #wp-admin-bar-vaa .ab-vaa-toggle.active .ab-item::after{content:"\f142"}#wpadminbar #wp-admin-bar-vaa.fullPopupActive .ab-sub-wrapper,#wpadminbar #wp-admin-bar-vaa.fullPopupActive .ab-sub-wrapper .ab-item{display:none}#wpadminbar #wp-admin-bar-vaa.fullPopupActive>.ab-sub-wrapper{display:block}#wpadminbar #wp-admin-bar-vaa.fullPopupActive>.ab-sub-wrapper>.ab-submenu{padding:0}#wpadminbar #wp-admin-bar-vaa.fullPopupActive .ab-sub-wrapper.fullPopup{position:fixed;display:block;visibility:visible;overflow:hidden;z-index:999;max-height:90%;width:90%;margin:5%;top:0;left:0;box-shadow:0 0 50px rgba(0,0,0,0.3)}#wpadminbar #wp-admin-bar-vaa.fullPopupActive .ab-sub-wrapper.fullPopup .ab-item{display:block}#wpadminbar #wp-admin-bar-vaa #wp-admin-bar-vaa-caps #apply-caps-view{float:left;margin-right:5px}#wpadminbar #wp-admin-bar-vaa #wp-admin-bar-vaa-caps #reset-caps-view,#wpadminbar #wp-admin-bar-vaa #wp-admin-bar-vaa-caps #open-caps-popup,#wpadminbar #wp-admin-bar-vaa #wp-admin-bar-vaa-caps #close-caps-popup{float:right;margin-left:5px;height:auto}#wpadminbar #wp-admin-bar-vaa #wp-admin-bar-vaa-caps #close-caps-popup{display:none}#wpadminbar #wp-admin-bar-vaa.fullPopupActive #wp-admin-bar-vaa-caps .ab-sub-wrapper.fullPopup #close-caps-popup{display:block}#wpadminbar #wp-admin-bar-vaa.fullPopupActive #wp-admin-bar-vaa-caps .ab-sub-wrapper.fullPopup #open-caps-popup{display:none}#wpadminbar #wp-admin-bar-vaa.fullPopupActive #wp-admin-bar-vaa-caps .ab-sub-wrapper.fullPopup #wp-admin-bar-vaa-caps-select-options .vaa-cap-item{width:250px;float:left;clear:none}#wpadminbar #wp-admin-bar-vaa #wp-admin-bar-vaa-caps-popup:hover{cursor:pointer}#wpadminbar #wp-admin-bar-my-account #wp-admin-bar-vaa>.ab-item>.ab-label{line-height:26px}#wpadminbar #wp-admin-bar-my-account #wp-admin-bar-vaa>.ab-item>.ab-icon{top:0}#vaa_toolbar #wpadminbar{position:fixed !important;width:auto;min-width:0;right:0;left:auto;border-radius:0 0 0 5px}#vaa_toolbar #wpadminbar #wp-admin-bar-vaa>.ab-item .ab-icon{margin-left:0}#vaa_toolbar #wpadminbar #wp-admin-bar-vaa>.ab-item .ab-label{display:none}#vaa_toolbar #wpadminbar #wp-admin-bar-vaa:hover>.ab-item .ab-icon{margin-left:6px}#vaa_toolbar #wpadminbar #wp-admin-bar-vaa:hover>.ab-item .ab-label{display:inline-block}@media screen and (max-width:782px){#wpadminbar #wp-admin-bar-vaa{display:block;position:static}#wpadminbar #wp-admin-bar-vaa>.ab-item>.ab-icon{margin-left:0}#wpadminbar #wp-admin-bar-vaa .ab-sub-wrapper{width:100%}#wpadminbar #wp-admin-bar-vaa .ab-sub-wrapper .ab-sub-wrapper{position:static;top:auto;margin:0;-webkit-box-shadow:none;-moz-box-shadow:none;box-shadow:none}#wpadminbar #wp-admin-bar-vaa.menupop .menupop>.ab-item:before{content:''}#wpadminbar #wp-admin-bar-vaa .ab-item .vaa-hide-responsive{display:none}#wpadminbar #wp-admin-bar-vaa .vaa-notice{line-height:42px;font-size:16px}#wpadminbar #wp-admin-bar-vaa .vaa-notice .ab-icon{height:auto}#wpadminbar #wp-admin-bar-vaa>div>ul,#wpadminbar #wp-admin-bar-vaa .menupop>.ab-sub-wrapper .ab-submenu{padding:5px 0}#wpadminbar #wp-admin-bar-vaa .menupop>.ab-sub-wrapper .ab-item{padding:8px 44px;white-space:normal;height:auto}#wpadminbar #wp-admin-bar-vaa .menupop>.ab-sub-wrapper .ab-item>.ab-item{padding:8px 0}#wpadminbar #wp-admin-bar-vaa .menupop>.ab-sub-wrapper:last-child .ab-item.description{margin-bottom:0}#wpadminbar #wp-admin-bar-vaa .ab-item>span.remove,#wpadminbar #wp-admin-bar-vaa .vaa-has-icon .ab-item .ab-icon{width:auto;height:auto;font-size:22px !important;margin-right:10px;vertical-align:text-top}#wpadminbar #wp-admin-bar-vaa .ab-vaa-title.vaa-has-icon>.ab-item>.ab-icon{font-size:30px !important;margin-left:-6px;margin-top:-1px;vertical-align:top}#wpadminbar #wp-admin-bar-vaa .vaa-has-icon.menupop>.ab-item{padding-left:12px;padding-right:12px}#wpadminbar #wp-admin-bar-vaa .vaa-menupop div li{margin-left:12px}#wpadminbar #wp-admin-bar-vaa .ab-sub-wrapper .vaa-role-item.menupop>.ab-item{padding-left:15px}#wpadminbar #wp-admin-bar-vaa .ab-vaa-toggle .ab-item::after,#wpadminbar #wp-admin-bar-vaa .ab-sub-wrapper .vaa-menupop.menupop>.ab-item:after{content:"\f140";font-family:'dashicons';position:absolute;right:10px;top:8px;margin:0;font-size:30px;font-weight:normal}#wpadminbar #wp-admin-bar-vaa .ab-vaa-toggle.active .ab-item::after,#wpadminbar #wp-admin-bar-vaa .ab-sub-wrapper .vaa-menupop.menupop.active>.ab-item:after{content:"\f142"}#wpadminbar #wp-admin-bar-vaa button{font-size:16px;padding:5px 15px}#wpadminbar #wp-admin-bar-vaa .ab-vaa-input .ab-item input,#wpadminbar #wp-admin-bar-vaa .ab-vaa-search .ab-item input,#wpadminbar #wp-admin-bar-vaa .ab-vaa-filter .ab-item input{padding:8px 12px}#wpadminbar #wp-admin-bar-vaa .ab-vaa-select .ab-item select{padding:7px 12px}#wpadminbar #wp-admin-bar-vaa .ab-item select+button.input-overlay,#wpadminbar #wp-admin-bar-vaa .ab-item input+button.input-overlay{right:44px;padding:6px 10px 7px;font-size:14px}#wpadminbar #wp-admin-bar-vaa .ab-vaa-multipleselect{border-width:0 44px;max-height:300px !important}#wpadminbar #wp-admin-bar-vaa .menupop>.ab-sub-wrapper .ab-vaa-multipleselect>.ab-item{padding:8px 16px}#wpadminbar #wp-admin-bar-vaa input.checkbox,#wpadminbar #wp-admin-bar-vaa input.radio{width:24px;height:24px}#wpadminbar #wp-admin-bar-vaa input.checkbox.vaa-right,#wpadminbar #wp-admin-bar-vaa input.radio.vaa-right{top:9px;right:11px}} \ No newline at end of file diff --git a/includes/class-api.php b/includes/class-api.php index 0cbf1003..ff37194b 100644 --- a/includes/class-api.php +++ b/includes/class-api.php @@ -16,7 +16,7 @@ * @author Jory Hogeveen * @package View_Admin_As * @since 1.6 - * @version 1.7 + * @version 1.7.1 */ final class VAA_API { diff --git a/includes/class-compat.php b/includes/class-compat.php index d4fc0497..835202a3 100644 --- a/includes/class-compat.php +++ b/includes/class-compat.php @@ -16,7 +16,7 @@ * @author Jory Hogeveen * @package View_Admin_As * @since 1.6 - * @version 1.7 + * @version 1.7.1 * @uses VAA_View_Admin_As_Class_Base Extends class */ final class VAA_View_Admin_As_Compat extends VAA_View_Admin_As_Class_Base diff --git a/includes/class-controller.php b/includes/class-controller.php index 2d5aef0d..e898dc2f 100644 --- a/includes/class-controller.php +++ b/includes/class-controller.php @@ -16,7 +16,7 @@ * @author Jory Hogeveen * @package View_Admin_As * @since 1.7 - * @version 1.7 + * @version 1.7.1 * @uses VAA_View_Admin_As_Class_Base Extends class */ final class VAA_View_Admin_As_Controller extends VAA_View_Admin_As_Class_Base diff --git a/includes/class-store.php b/includes/class-store.php index 5a91cdb7..a8be14d0 100644 --- a/includes/class-store.php +++ b/includes/class-store.php @@ -16,7 +16,7 @@ * @author Jory Hogeveen * @package View_Admin_As * @since 1.6 - * @version 1.7 + * @version 1.7.1 * @uses VAA_View_Admin_As_Settings Extends class */ final class VAA_View_Admin_As_Store extends VAA_View_Admin_As_Settings diff --git a/includes/class-vaa.php b/includes/class-vaa.php index 322d343b..9d41ae49 100644 --- a/includes/class-vaa.php +++ b/includes/class-vaa.php @@ -16,7 +16,7 @@ * @author Jory Hogeveen * @package View_Admin_As * @since 0.1 - * @version 1.7 + * @version 1.7.1 */ final class VAA_View_Admin_As { diff --git a/modules/class-restrict-user-access.php b/modules/class-restrict-user-access.php index 10e2e63c..a3314e74 100644 --- a/modules/class-restrict-user-access.php +++ b/modules/class-restrict-user-access.php @@ -20,7 +20,7 @@ * @author Jory Hogeveen * @package View_Admin_As * @since 1.6.4 - * @version 1.7 + * @version 1.7.1 * @uses VAA_View_Admin_As_Class_Base Extends class */ final class VAA_View_Admin_As_RUA extends VAA_View_Admin_As_Class_Base diff --git a/modules/class-role-defaults.php b/modules/class-role-defaults.php index f1602d97..28479ce4 100644 --- a/modules/class-role-defaults.php +++ b/modules/class-role-defaults.php @@ -21,7 +21,7 @@ * @author Jory Hogeveen * @package View_Admin_As * @since 1.4 - * @version 1.7 + * @version 1.7.1 * @uses VAA_View_Admin_As_Module Extends class */ final class VAA_View_Admin_As_Role_Defaults extends VAA_View_Admin_As_Module diff --git a/readme.txt b/readme.txt index 00bc63fd..193377b6 100644 --- a/readme.txt +++ b/readme.txt @@ -41,9 +41,12 @@ It also features a "Role manager" module to add, edit or remove roles and grant * Add, edit or delete roles * Grant and/or add capabilities to roles +* Rename roles * Clone roles * Update role capabilities from current view +*Note: Changes made with the Role Manager are permanent!* + = Compatibility & Integrations = This plugin will work with most other plugins but these are tested: @@ -170,6 +173,15 @@ Note: if your admin users aren't safe, this plugin is the last one to worry abou == Changelog == += 1.7.1 = + +* Feature: Module Role Manager: Rename roles [#47](https://github.com/JoryHogeveen/view-admin-as/issues/47) +* Enhancement/Compatibility: Improve fetching available capabilities for super admin. It now alse checks for custom post type and taxonomy capabilities and more other plugins. +* UI: Module Role Manager: Show original role name for reference +* Accessibility: Fix tabindex for some nodes that have form elements + +Detailed info: [PR on GitHub](https://github.com/JoryHogeveen/view-admin-as/pull/48) + = 1.7 = * Feature: New module Role manager. Add, edit and/or remove roles and grant or deny them capabilities. [#43](https://github.com/JoryHogeveen/view-admin-as/issues/43) diff --git a/ui/class-admin-bar.php b/ui/class-admin-bar.php index a37824d5..c75a5bd6 100644 --- a/ui/class-admin-bar.php +++ b/ui/class-admin-bar.php @@ -23,7 +23,7 @@ * @author Jory Hogeveen * @package View_Admin_As * @since 1.5 - * @version 1.7 + * @version 1.7.1 * @uses VAA_View_Admin_As_Class_Base Extends class */ final class VAA_View_Admin_As_Admin_Bar extends VAA_View_Admin_As_Class_Base diff --git a/ui/class-ui.php b/ui/class-ui.php index c729aa31..dc6a729a 100644 --- a/ui/class-ui.php +++ b/ui/class-ui.php @@ -17,7 +17,7 @@ * @package View_Admin_As * @since 1.6 * @since 1.7 Renamed to VAA_View_Admin_As_UI (previously VAA_View_Admin_As_Admin) - * @version 1.7 + * @version 1.7.1 * @uses VAA_View_Admin_As_Class_Base Extends class */ final class VAA_View_Admin_As_UI extends VAA_View_Admin_As_Class_Base From 90492baeec3b676cbb3622c1e620b8e265fbc882 Mon Sep 17 00:00:00 2001 From: JoryHogeveen Date: Mon, 24 Apr 2017 18:26:06 +0200 Subject: [PATCH 42/57] Add submenu scrollbar when there are too much users under a role See #49 --- assets/css/view-admin-as.css | 7 ++++++- assets/css/view-admin-as.min.css | 2 +- assets/js/view-admin-as.js | 11 +++++++---- assets/js/view-admin-as.min.js | 2 +- readme.txt | 1 + ui/templates/adminbar-user-items.php | 11 ++++++++++- 6 files changed, 26 insertions(+), 8 deletions(-) diff --git a/assets/css/view-admin-as.css b/assets/css/view-admin-as.css index a96110e4..fdeb28a0 100644 --- a/assets/css/view-admin-as.css +++ b/assets/css/view-admin-as.css @@ -120,6 +120,11 @@ #wpadminbar #wp-admin-bar-vaa .vaa-icon .ab-icon {margin: 0;} #wpadminbar #wp-admin-bar-vaa button.vaa-icon .ab-icon {padding: 0;} +/** + * Auto max height + */ +#wpadminbar #wp-admin-bar-vaa .vaa-auto-max-height {overflow-y: auto; transition: max-height .3s;} + /** * Form elements */ @@ -160,7 +165,7 @@ #wpadminbar #wp-admin-bar-vaa input.radio.vaa-right {position: absolute; top: 5px; right: 1em; z-index: 99;} /* Multipleselect */ -#wpadminbar #wp-admin-bar-vaa .ab-vaa-multipleselect {max-height: 400px; min-width: 250px; overflow: hidden; overflow-y: auto; margin: 6px 0; padding: 0; border: solid transparent; border-width: 0 10px; transition: max-height .3s;} +#wpadminbar #wp-admin-bar-vaa .ab-vaa-multipleselect {max-height: 400px; min-width: 250px; overflow: hidden; overflow-y: auto; margin: 6px 0; padding: 0; border: solid transparent; border-width: 0 10px;} #wpadminbar #wp-admin-bar-vaa .ab-vaa-multipleselect .ab-empty-item {height: auto; overflow: hidden; margin: 0; padding: 5px 10px; background-color: #fff;} #wpadminbar #wp-admin-bar-vaa .ab-vaa-multipleselect .ab-empty-item .ab-item {color: #333;} #wpadminbar #wp-admin-bar-vaa .ab-vaa-multipleselect.vaa-small {max-height: 100px;} diff --git a/assets/css/view-admin-as.min.css b/assets/css/view-admin-as.min.css index 2ab218bc..f47f41cc 100644 --- a/assets/css/view-admin-as.min.css +++ b/assets/css/view-admin-as.min.css @@ -8,4 +8,4 @@ * @version 1.7.1 * @preserve */ -.vaa-loader-icon{width:40px;height:40px;background:transparent url('../../../../../wp-includes/images/spinner-2x.gif') center center no-repeat;background-size:contain}#vaa-overlay{position:fixed;top:0;left:0;height:100%;width:100%;background:rgba(255,255,255,0.85);display:none;z-index:999999999}#vaa-overlay .vaa-loader-icon{position:fixed;top:50%;left:50%;margin:-20px 0 0 -20px;display:block}#vaa-overlay .vaa-overlay-container{max-width:75%;min-width:50%;max-height:50%;min-height:20px;margin:0 25%;top:10%;background:#fff;box-shadow:0 0 5px #aaa;padding:10px;border-radius:3px;position:relative}#vaa-overlay .vaa-overlay-container>.remove{position:absolute;right:-10px;top:-10px;background:#FFF;width:20px;height:20px;cursor:pointer}#vaa-overlay .vaa-overlay-container .vaa-response-data{overflow:hidden;overflow-y:auto}#vaa-overlay .vaa-overlay-container .vaa-response-data ul li{margin-left:20px;list-style:disc outside}#vaa-overlay .vaa-overlay-container.vaa-message{border:2px solid #0075b3}#vaa-overlay .vaa-overlay-container.vaa-warning{border:2px solid #c8730c}#vaa-overlay .vaa-overlay-container.vaa-error{border:2px solid #dc3232}#vaa-overlay .vaa-overlay-container.vaa-success{border:2px solid #46b450}#wpadminbar .vaa-notice{display:inline-block;padding:0 5px 0 10px;background:#fff}#wpadminbar .vaa-notice.vaa-message,#wpadminbar .vaa-notice.vaa-message .ab-icon:before{color:#0075b3 !important}#wpadminbar .vaa-notice.vaa-warning,#wpadminbar .vaa-notice.vaa-warning .ab-icon:before{color:#c8730c !important}#wpadminbar .vaa-notice.vaa-error,#wpadminbar .vaa-notice.vaa-error .ab-icon:before{color:#dc3232 !important}#wpadminbar .vaa-notice.vaa-success,#wpadminbar .vaa-notice.vaa-success .ab-icon:before{color:#46b450 !important}#wpadminbar #wp-admin-bar-vaa .vaa-notice{display:block;clear:both;margin-bottom:3px}#wpadminbar #wp-admin-bar-vaa .vaa-notice button{vertical-align:baseline;margin:0 0 0 -5px;padding:1px 10px}#wpadminbar .vaa-notice .remove,#wpadminbar #wp-admin-bar-vaa .remove{cursor:pointer;top:2px;float:right;margin-right:0;margin-left:6px}#wpadminbar #wp-admin-bar-vaa ul li,#wpadminbar #wp-admin-bar-vaa .ab-item{clear:both}#wpadminbar #wp-admin-bar-vaa .ab-sub-wrapper .ab-item>span{line-height:26px}#wpadminbar #wp-admin-bar-vaa .ab-item>span.remove{font-size:16px;line-height:16px;top:1px}#wpadminbar #wp-admin-bar-vaa .ab-bold>.ab-item,#wpadminbar #wp-admin-bar-vaa .ab-bold>.ab-item *{font-weight:bold !important}#wpadminbar #wp-admin-bar-vaa .ab-italic>.ab-item,#wpadminbar #wp-admin-bar-vaa .ab-italic>.ab-item *{font-style:italic !important}#wpadminbar #wp-admin-bar-vaa .vaa-sub-transparent>*{opacity:.5;transition:opacity .2s}#wpadminbar #wp-admin-bar-vaa .vaa-sub-transparent:hover>*{opacity:1}#wpadminbar #wp-admin-bar-vaa .ab-vaa-results{margin:6px 0;padding:0}#wpadminbar #wp-admin-bar-vaa .ab-vaa-results:empty{display:none}#wpadminbar #wp-admin-bar-vaa .ab-vaa-spacing-top,#wpadminbar #wp-admin-bar-vaa>div>ul.ab-sub-secondary+ul.ab-sub-secondary{margin-top:3px}#wpadminbar #wp-admin-bar-vaa .ab-sub-wrapper .ab-sub-wrapper ul.ab-sub-secondary+ul.ab-sub-secondary{padding-top:0}#wpadminbar #wp-admin-bar-vaa .auto-height>.ab-item{height:auto}#wpadminbar #wp-admin-bar-vaa .ab-item .description{height:auto;line-height:1.2;font-size:.8em;font-style:italic;margin-bottom:7px;white-space:normal}#wpadminbar #wp-admin-bar-vaa .ab-item .description:first-child{margin-bottom:0}#wpadminbar #wp-admin-bar-vaa.menupop .ab-vaa-title .ab-item{font-weight:bold;line-height:26px;font-size:1.1em;text-transform:uppercase}#wpadminbar #wp-admin-bar-vaa .current>.ab-item,#wpadminbar #wp-admin-bar-vaa .current>.ab-item .vaa-view-data,#wpadminbar #wp-admin-bar-vaa .current>input:checked+label,#wpadminbar #wp-admin-bar-vaa .current-parent>.ab-item,#wpadminbar #wp-admin-bar-vaa .current-parent>.ab-item .vaa-view-data,#wpadminbar #wp-admin-bar-vaa .current-parent>label{font-weight:bold}#wpadminbar #wp-admin-bar-vaa .current>.ab-item::after,#wpadminbar #wp-admin-bar-vaa .current>label::after{content:'\f177';font-family:'dashicons';margin:0 5px;font-size:17px;vertical-align:middle;font-weight:normal}#wpadminbar #wp-admin-bar-vaa>.ab-item>.ab-label{float:left}#wpadminbar #wp-admin-bar-vaa>.ab-item>.ab-icon{float:right;margin-right:0;margin-left:6px;top:2px}#wpadminbar #wp-admin-bar-vaa .vaa-has-icon>.ab-item>.ab-icon{float:none;font-size:16px;line-height:16px;vertical-align:text-bottom;font-weight:normal !important;padding:0}#wpadminbar #wp-admin-bar-vaa .vaa-has-icon>.ab-item::before{display:none}#wpadminbar #wp-admin-bar-vaa .vaa-has-icon.menupop>.ab-item{padding-left:10px;padding-right:10px}#wpadminbar #wp-admin-bar-vaa .vaa-has-icon.ab-vaa-title>.ab-item>.ab-icon{font-size:18px;line-height:20px;margin:0 5px 0 -1px}#wpadminbar .ab-top-secondary .menupop .vaa-menupop>.ab-item{padding-left:2em;padding-right:1em}#wpadminbar .ab-top-secondary .menupop .vaa-menupop>.ab-item .ab-icon{margin-left:-20px;margin-right:4px}#wpadminbar #wp-admin-bar-vaa.menupop ul.ab-sub-secondary{position:static}#wpadminbar #wp-admin-bar-vaa.menupop .menupop>.ab-item:before{top:1px}#wpadminbar #wp-admin-bar-vaa button>.ab-icon{margin:0 5px 0 -5px;padding:0;top:0}#wpadminbar #wp-admin-bar-vaa .ab-item>label+button{margin:0 0 0 12px;vertical-align:baseline}#wpadminbar #wp-admin-bar-vaa .vaa-button-container>.ab-item{overflow:hidden;height:auto}#wpadminbar #wp-admin-bar-vaa button{float:none;text-decoration:none;font-size:13px;line-height:20px;height:20px;margin:3px 0;padding:0 10px 1px;vertical-align:middle;cursor:pointer}#wpadminbar #wp-admin-bar-vaa .vaa-icon{padding:0 2px 1px}#wpadminbar #wp-admin-bar-vaa .vaa-icon .ab-icon{margin:0}#wpadminbar #wp-admin-bar-vaa button.vaa-icon .ab-icon{padding:0}#wpadminbar #wp-admin-bar-vaa .ab-vaa-multipleselect .ab-item,#wpadminbar #wp-admin-bar-vaa .ab-vaa-input .ab-item,#wpadminbar #wp-admin-bar-vaa .ab-vaa-search .ab-item,#wpadminbar #wp-admin-bar-vaa .ab-vaa-filter .ab-item,#wpadminbar #wp-admin-bar-vaa .ab-vaa-select .ab-item{height:auto;clear:both}#wpadminbar #wp-admin-bar-vaa .ab-vaa-input .ab-item input,#wpadminbar #wp-admin-bar-vaa .ab-vaa-search .ab-item input,#wpadminbar #wp-admin-bar-vaa .ab-vaa-filter .ab-item input,#wpadminbar #wp-admin-bar-vaa .ab-vaa-select .ab-item select{display:inline-block;background:#fff;color:#555;margin:5px 0;padding:3px;border:0;line-height:normal;height:auto;width:100%;box-sizing:border-box}#wpadminbar #wp-admin-bar-vaa .ab-vaa-select .ab-item select{padding:2px 3px}#wpadminbar #wp-admin-bar-vaa .ab-vaa-select .ab-item label+input,#wpadminbar #wp-admin-bar-vaa .ab-vaa-select .ab-item label+select{margin-top:0}#wpadminbar #wp-admin-bar-vaa .ab-vaa-textarea .ab-item{height:auto;line-height:normal}#wpadminbar #wp-admin-bar-vaa .ab-vaa-textarea .ab-item textarea{width:100%;padding:5px;margin-top:5px;box-sizing:border-box;line-height:normal}#wpadminbar #wp-admin-bar-vaa .ab-item select+button.input-overlay,#wpadminbar #wp-admin-bar-vaa .ab-item input+button.input-overlay{position:absolute;right:10px;margin:5px 0}#wpadminbar #wp-admin-bar-vaa input.checkbox,#wpadminbar #wp-admin-bar-vaa input.radio{display:inline-block;height:16px;width:16px;vertical-align:text-bottom;box-sizing:border-box;cursor:pointer}#wpadminbar #wp-admin-bar-vaa .ab-item input.checkbox,#wpadminbar #wp-admin-bar-vaa .ab-item input.radio{margin:0 5px 0 0}#wpadminbar #wp-admin-bar-vaa .ab-item input.checkbox+label,#wpadminbar #wp-admin-bar-vaa .ab-item input.checkbox+label *,#wpadminbar #wp-admin-bar-vaa .ab-item input.radio+label,#wpadminbar #wp-admin-bar-vaa .ab-item input.radio+label *{line-height:18px;vertical-align:text-top;display:inline}#wpadminbar #wp-admin-bar-vaa .ab-item input.checkbox+label:hover,#wpadminbar #wp-admin-bar-vaa .ab-item input.radio+label:hover{cursor:pointer}#wpadminbar #wp-admin-bar-vaa .ab-item input.checkbox:first-child,#wpadminbar #wp-admin-bar-vaa .ab-item input.radio:first-child{margin:0 6px 0 0}#wpadminbar #wp-admin-bar-vaa .ab-item input.radio{border-radius:100%}#wpadminbar #wp-admin-bar-vaa .ab-item input.radio+label+br{line-height:0}#wpadminbar #wp-admin-bar-vaa input.checkbox.vaa-right,#wpadminbar #wp-admin-bar-vaa input.radio.vaa-right{position:absolute;top:5px;right:1em;z-index:99}#wpadminbar #wp-admin-bar-vaa .ab-vaa-multipleselect{max-height:400px;min-width:250px;overflow:hidden;overflow-y:auto;margin:6px 0;padding:0;border:solid transparent;border-width:0 10px;transition:max-height .3s}#wpadminbar #wp-admin-bar-vaa .ab-vaa-multipleselect .ab-empty-item{height:auto;overflow:hidden;margin:0;padding:5px 10px;background-color:#fff}#wpadminbar #wp-admin-bar-vaa .ab-vaa-multipleselect .ab-empty-item .ab-item{color:#333}#wpadminbar #wp-admin-bar-vaa .ab-vaa-multipleselect.vaa-small{max-height:100px}#wpadminbar #wp-admin-bar-vaa .ab-vaa-multipleselect .remove:before{color:#333}#wpadminbar #wp-admin-bar-vaa .vaa-column-one-half{width:50%;display:block;float:left;clear:none}#wpadminbar #wp-admin-bar-vaa .vaa-column-one-half .ab-item{min-width:0}#wpadminbar #wp-admin-bar-vaa .vaa-column-one-half.vaa-column-first .ab-item{padding-right:1px}#wpadminbar #wp-admin-bar-vaa .vaa-column-one-half.vaa-column-last .ab-item{padding-left:1px}#wpadminbar #wp-admin-bar-vaa .vaa-clear-float{clear:both}#wpadminbar #wp-admin-bar-vaa .ab-vaa-toggle .ab-item{padding-right:34px}#wpadminbar #wp-admin-bar-vaa .ab-vaa-toggle .ab-item:hover{cursor:pointer}#wpadminbar #wp-admin-bar-vaa .ab-vaa-toggle .ab-item::after{content:"\f140";font-family:'dashicons';position:absolute;right:10px;margin:0;font-size:20px;font-weight:normal}#wpadminbar #wp-admin-bar-vaa .ab-vaa-toggle.active .ab-item::after{content:"\f142"}#wpadminbar #wp-admin-bar-vaa.fullPopupActive .ab-sub-wrapper,#wpadminbar #wp-admin-bar-vaa.fullPopupActive .ab-sub-wrapper .ab-item{display:none}#wpadminbar #wp-admin-bar-vaa.fullPopupActive>.ab-sub-wrapper{display:block}#wpadminbar #wp-admin-bar-vaa.fullPopupActive>.ab-sub-wrapper>.ab-submenu{padding:0}#wpadminbar #wp-admin-bar-vaa.fullPopupActive .ab-sub-wrapper.fullPopup{position:fixed;display:block;visibility:visible;overflow:hidden;z-index:999;max-height:90%;width:90%;margin:5%;top:0;left:0;box-shadow:0 0 50px rgba(0,0,0,0.3)}#wpadminbar #wp-admin-bar-vaa.fullPopupActive .ab-sub-wrapper.fullPopup .ab-item{display:block}#wpadminbar #wp-admin-bar-vaa #wp-admin-bar-vaa-caps #apply-caps-view{float:left;margin-right:5px}#wpadminbar #wp-admin-bar-vaa #wp-admin-bar-vaa-caps #reset-caps-view,#wpadminbar #wp-admin-bar-vaa #wp-admin-bar-vaa-caps #open-caps-popup,#wpadminbar #wp-admin-bar-vaa #wp-admin-bar-vaa-caps #close-caps-popup{float:right;margin-left:5px;height:auto}#wpadminbar #wp-admin-bar-vaa #wp-admin-bar-vaa-caps #close-caps-popup{display:none}#wpadminbar #wp-admin-bar-vaa.fullPopupActive #wp-admin-bar-vaa-caps .ab-sub-wrapper.fullPopup #close-caps-popup{display:block}#wpadminbar #wp-admin-bar-vaa.fullPopupActive #wp-admin-bar-vaa-caps .ab-sub-wrapper.fullPopup #open-caps-popup{display:none}#wpadminbar #wp-admin-bar-vaa.fullPopupActive #wp-admin-bar-vaa-caps .ab-sub-wrapper.fullPopup #wp-admin-bar-vaa-caps-select-options .vaa-cap-item{width:250px;float:left;clear:none}#wpadminbar #wp-admin-bar-vaa #wp-admin-bar-vaa-caps-popup:hover{cursor:pointer}#wpadminbar #wp-admin-bar-my-account #wp-admin-bar-vaa>.ab-item>.ab-label{line-height:26px}#wpadminbar #wp-admin-bar-my-account #wp-admin-bar-vaa>.ab-item>.ab-icon{top:0}#vaa_toolbar #wpadminbar{position:fixed !important;width:auto;min-width:0;right:0;left:auto;border-radius:0 0 0 5px}#vaa_toolbar #wpadminbar #wp-admin-bar-vaa>.ab-item .ab-icon{margin-left:0}#vaa_toolbar #wpadminbar #wp-admin-bar-vaa>.ab-item .ab-label{display:none}#vaa_toolbar #wpadminbar #wp-admin-bar-vaa:hover>.ab-item .ab-icon{margin-left:6px}#vaa_toolbar #wpadminbar #wp-admin-bar-vaa:hover>.ab-item .ab-label{display:inline-block}@media screen and (max-width:782px){#wpadminbar #wp-admin-bar-vaa{display:block;position:static}#wpadminbar #wp-admin-bar-vaa>.ab-item>.ab-icon{margin-left:0}#wpadminbar #wp-admin-bar-vaa .ab-sub-wrapper{width:100%}#wpadminbar #wp-admin-bar-vaa .ab-sub-wrapper .ab-sub-wrapper{position:static;top:auto;margin:0;-webkit-box-shadow:none;-moz-box-shadow:none;box-shadow:none}#wpadminbar #wp-admin-bar-vaa.menupop .menupop>.ab-item:before{content:''}#wpadminbar #wp-admin-bar-vaa .ab-item .vaa-hide-responsive{display:none}#wpadminbar #wp-admin-bar-vaa .vaa-notice{line-height:42px;font-size:16px}#wpadminbar #wp-admin-bar-vaa .vaa-notice .ab-icon{height:auto}#wpadminbar #wp-admin-bar-vaa>div>ul,#wpadminbar #wp-admin-bar-vaa .menupop>.ab-sub-wrapper .ab-submenu{padding:5px 0}#wpadminbar #wp-admin-bar-vaa .menupop>.ab-sub-wrapper .ab-item{padding:8px 44px;white-space:normal;height:auto}#wpadminbar #wp-admin-bar-vaa .menupop>.ab-sub-wrapper .ab-item>.ab-item{padding:8px 0}#wpadminbar #wp-admin-bar-vaa .menupop>.ab-sub-wrapper:last-child .ab-item.description{margin-bottom:0}#wpadminbar #wp-admin-bar-vaa .ab-item>span.remove,#wpadminbar #wp-admin-bar-vaa .vaa-has-icon .ab-item .ab-icon{width:auto;height:auto;font-size:22px !important;margin-right:10px;vertical-align:text-top}#wpadminbar #wp-admin-bar-vaa .ab-vaa-title.vaa-has-icon>.ab-item>.ab-icon{font-size:30px !important;margin-left:-6px;margin-top:-1px;vertical-align:top}#wpadminbar #wp-admin-bar-vaa .vaa-has-icon.menupop>.ab-item{padding-left:12px;padding-right:12px}#wpadminbar #wp-admin-bar-vaa .vaa-menupop div li{margin-left:12px}#wpadminbar #wp-admin-bar-vaa .ab-sub-wrapper .vaa-role-item.menupop>.ab-item{padding-left:15px}#wpadminbar #wp-admin-bar-vaa .ab-vaa-toggle .ab-item::after,#wpadminbar #wp-admin-bar-vaa .ab-sub-wrapper .vaa-menupop.menupop>.ab-item:after{content:"\f140";font-family:'dashicons';position:absolute;right:10px;top:8px;margin:0;font-size:30px;font-weight:normal}#wpadminbar #wp-admin-bar-vaa .ab-vaa-toggle.active .ab-item::after,#wpadminbar #wp-admin-bar-vaa .ab-sub-wrapper .vaa-menupop.menupop.active>.ab-item:after{content:"\f142"}#wpadminbar #wp-admin-bar-vaa button{font-size:16px;padding:5px 15px}#wpadminbar #wp-admin-bar-vaa .ab-vaa-input .ab-item input,#wpadminbar #wp-admin-bar-vaa .ab-vaa-search .ab-item input,#wpadminbar #wp-admin-bar-vaa .ab-vaa-filter .ab-item input{padding:8px 12px}#wpadminbar #wp-admin-bar-vaa .ab-vaa-select .ab-item select{padding:7px 12px}#wpadminbar #wp-admin-bar-vaa .ab-item select+button.input-overlay,#wpadminbar #wp-admin-bar-vaa .ab-item input+button.input-overlay{right:44px;padding:6px 10px 7px;font-size:14px}#wpadminbar #wp-admin-bar-vaa .ab-vaa-multipleselect{border-width:0 44px;max-height:300px !important}#wpadminbar #wp-admin-bar-vaa .menupop>.ab-sub-wrapper .ab-vaa-multipleselect>.ab-item{padding:8px 16px}#wpadminbar #wp-admin-bar-vaa input.checkbox,#wpadminbar #wp-admin-bar-vaa input.radio{width:24px;height:24px}#wpadminbar #wp-admin-bar-vaa input.checkbox.vaa-right,#wpadminbar #wp-admin-bar-vaa input.radio.vaa-right{top:9px;right:11px}} \ No newline at end of file +.vaa-loader-icon{width:40px;height:40px;background:transparent url('../../../../../wp-includes/images/spinner-2x.gif') center center no-repeat;background-size:contain}#vaa-overlay{position:fixed;top:0;left:0;height:100%;width:100%;background:rgba(255,255,255,0.85);display:none;z-index:999999999}#vaa-overlay .vaa-loader-icon{position:fixed;top:50%;left:50%;margin:-20px 0 0 -20px;display:block}#vaa-overlay .vaa-overlay-container{max-width:75%;min-width:50%;max-height:50%;min-height:20px;margin:0 25%;top:10%;background:#fff;box-shadow:0 0 5px #aaa;padding:10px;border-radius:3px;position:relative}#vaa-overlay .vaa-overlay-container>.remove{position:absolute;right:-10px;top:-10px;background:#FFF;width:20px;height:20px;cursor:pointer}#vaa-overlay .vaa-overlay-container .vaa-response-data{overflow:hidden;overflow-y:auto}#vaa-overlay .vaa-overlay-container .vaa-response-data ul li{margin-left:20px;list-style:disc outside}#vaa-overlay .vaa-overlay-container.vaa-message{border:2px solid #0075b3}#vaa-overlay .vaa-overlay-container.vaa-warning{border:2px solid #c8730c}#vaa-overlay .vaa-overlay-container.vaa-error{border:2px solid #dc3232}#vaa-overlay .vaa-overlay-container.vaa-success{border:2px solid #46b450}#wpadminbar .vaa-notice{display:inline-block;padding:0 5px 0 10px;background:#fff}#wpadminbar .vaa-notice.vaa-message,#wpadminbar .vaa-notice.vaa-message .ab-icon:before{color:#0075b3 !important}#wpadminbar .vaa-notice.vaa-warning,#wpadminbar .vaa-notice.vaa-warning .ab-icon:before{color:#c8730c !important}#wpadminbar .vaa-notice.vaa-error,#wpadminbar .vaa-notice.vaa-error .ab-icon:before{color:#dc3232 !important}#wpadminbar .vaa-notice.vaa-success,#wpadminbar .vaa-notice.vaa-success .ab-icon:before{color:#46b450 !important}#wpadminbar #wp-admin-bar-vaa .vaa-notice{display:block;clear:both;margin-bottom:3px}#wpadminbar #wp-admin-bar-vaa .vaa-notice button{vertical-align:baseline;margin:0 0 0 -5px;padding:1px 10px}#wpadminbar .vaa-notice .remove,#wpadminbar #wp-admin-bar-vaa .remove{cursor:pointer;top:2px;float:right;margin-right:0;margin-left:6px}#wpadminbar #wp-admin-bar-vaa ul li,#wpadminbar #wp-admin-bar-vaa .ab-item{clear:both}#wpadminbar #wp-admin-bar-vaa .ab-sub-wrapper .ab-item>span{line-height:26px}#wpadminbar #wp-admin-bar-vaa .ab-item>span.remove{font-size:16px;line-height:16px;top:1px}#wpadminbar #wp-admin-bar-vaa .ab-bold>.ab-item,#wpadminbar #wp-admin-bar-vaa .ab-bold>.ab-item *{font-weight:bold !important}#wpadminbar #wp-admin-bar-vaa .ab-italic>.ab-item,#wpadminbar #wp-admin-bar-vaa .ab-italic>.ab-item *{font-style:italic !important}#wpadminbar #wp-admin-bar-vaa .vaa-sub-transparent>*{opacity:.5;transition:opacity .2s}#wpadminbar #wp-admin-bar-vaa .vaa-sub-transparent:hover>*{opacity:1}#wpadminbar #wp-admin-bar-vaa .ab-vaa-results{margin:6px 0;padding:0}#wpadminbar #wp-admin-bar-vaa .ab-vaa-results:empty{display:none}#wpadminbar #wp-admin-bar-vaa .ab-vaa-spacing-top,#wpadminbar #wp-admin-bar-vaa>div>ul.ab-sub-secondary+ul.ab-sub-secondary{margin-top:3px}#wpadminbar #wp-admin-bar-vaa .ab-sub-wrapper .ab-sub-wrapper ul.ab-sub-secondary+ul.ab-sub-secondary{padding-top:0}#wpadminbar #wp-admin-bar-vaa .auto-height>.ab-item{height:auto}#wpadminbar #wp-admin-bar-vaa .ab-item .description{height:auto;line-height:1.2;font-size:.8em;font-style:italic;margin-bottom:7px;white-space:normal}#wpadminbar #wp-admin-bar-vaa .ab-item .description:first-child{margin-bottom:0}#wpadminbar #wp-admin-bar-vaa.menupop .ab-vaa-title .ab-item{font-weight:bold;line-height:26px;font-size:1.1em;text-transform:uppercase}#wpadminbar #wp-admin-bar-vaa .current>.ab-item,#wpadminbar #wp-admin-bar-vaa .current>.ab-item .vaa-view-data,#wpadminbar #wp-admin-bar-vaa .current>input:checked+label,#wpadminbar #wp-admin-bar-vaa .current-parent>.ab-item,#wpadminbar #wp-admin-bar-vaa .current-parent>.ab-item .vaa-view-data,#wpadminbar #wp-admin-bar-vaa .current-parent>label{font-weight:bold}#wpadminbar #wp-admin-bar-vaa .current>.ab-item::after,#wpadminbar #wp-admin-bar-vaa .current>label::after{content:'\f177';font-family:'dashicons';margin:0 5px;font-size:17px;vertical-align:middle;font-weight:normal}#wpadminbar #wp-admin-bar-vaa>.ab-item>.ab-label{float:left}#wpadminbar #wp-admin-bar-vaa>.ab-item>.ab-icon{float:right;margin-right:0;margin-left:6px;top:2px}#wpadminbar #wp-admin-bar-vaa .vaa-has-icon>.ab-item>.ab-icon{float:none;font-size:16px;line-height:16px;vertical-align:text-bottom;font-weight:normal !important;padding:0}#wpadminbar #wp-admin-bar-vaa .vaa-has-icon>.ab-item::before{display:none}#wpadminbar #wp-admin-bar-vaa .vaa-has-icon.menupop>.ab-item{padding-left:10px;padding-right:10px}#wpadminbar #wp-admin-bar-vaa .vaa-has-icon.ab-vaa-title>.ab-item>.ab-icon{font-size:18px;line-height:20px;margin:0 5px 0 -1px}#wpadminbar .ab-top-secondary .menupop .vaa-menupop>.ab-item{padding-left:2em;padding-right:1em}#wpadminbar .ab-top-secondary .menupop .vaa-menupop>.ab-item .ab-icon{margin-left:-20px;margin-right:4px}#wpadminbar #wp-admin-bar-vaa.menupop ul.ab-sub-secondary{position:static}#wpadminbar #wp-admin-bar-vaa.menupop .menupop>.ab-item:before{top:1px}#wpadminbar #wp-admin-bar-vaa button>.ab-icon{margin:0 5px 0 -5px;padding:0;top:0}#wpadminbar #wp-admin-bar-vaa .ab-item>label+button{margin:0 0 0 12px;vertical-align:baseline}#wpadminbar #wp-admin-bar-vaa .vaa-button-container>.ab-item{overflow:hidden;height:auto}#wpadminbar #wp-admin-bar-vaa button{float:none;text-decoration:none;font-size:13px;line-height:20px;height:20px;margin:3px 0;padding:0 10px 1px;vertical-align:middle;cursor:pointer}#wpadminbar #wp-admin-bar-vaa .vaa-icon{padding:0 2px 1px}#wpadminbar #wp-admin-bar-vaa .vaa-icon .ab-icon{margin:0}#wpadminbar #wp-admin-bar-vaa button.vaa-icon .ab-icon{padding:0}#wpadminbar #wp-admin-bar-vaa .vaa-auto-max-height{overflow-y:auto;transition:max-height .3s}#wpadminbar #wp-admin-bar-vaa .ab-vaa-multipleselect .ab-item,#wpadminbar #wp-admin-bar-vaa .ab-vaa-input .ab-item,#wpadminbar #wp-admin-bar-vaa .ab-vaa-search .ab-item,#wpadminbar #wp-admin-bar-vaa .ab-vaa-filter .ab-item,#wpadminbar #wp-admin-bar-vaa .ab-vaa-select .ab-item{height:auto;clear:both}#wpadminbar #wp-admin-bar-vaa .ab-vaa-input .ab-item input,#wpadminbar #wp-admin-bar-vaa .ab-vaa-search .ab-item input,#wpadminbar #wp-admin-bar-vaa .ab-vaa-filter .ab-item input,#wpadminbar #wp-admin-bar-vaa .ab-vaa-select .ab-item select{display:inline-block;background:#fff;color:#555;margin:5px 0;padding:3px;border:0;line-height:normal;height:auto;width:100%;box-sizing:border-box}#wpadminbar #wp-admin-bar-vaa .ab-vaa-select .ab-item select{padding:2px 3px}#wpadminbar #wp-admin-bar-vaa .ab-vaa-select .ab-item label+input,#wpadminbar #wp-admin-bar-vaa .ab-vaa-select .ab-item label+select{margin-top:0}#wpadminbar #wp-admin-bar-vaa .ab-vaa-textarea .ab-item{height:auto;line-height:normal}#wpadminbar #wp-admin-bar-vaa .ab-vaa-textarea .ab-item textarea{width:100%;padding:5px;margin-top:5px;box-sizing:border-box;line-height:normal}#wpadminbar #wp-admin-bar-vaa .ab-item select+button.input-overlay,#wpadminbar #wp-admin-bar-vaa .ab-item input+button.input-overlay{position:absolute;right:10px;margin:5px 0}#wpadminbar #wp-admin-bar-vaa input.checkbox,#wpadminbar #wp-admin-bar-vaa input.radio{display:inline-block;height:16px;width:16px;vertical-align:text-bottom;box-sizing:border-box;cursor:pointer}#wpadminbar #wp-admin-bar-vaa .ab-item input.checkbox,#wpadminbar #wp-admin-bar-vaa .ab-item input.radio{margin:0 5px 0 0}#wpadminbar #wp-admin-bar-vaa .ab-item input.checkbox+label,#wpadminbar #wp-admin-bar-vaa .ab-item input.checkbox+label *,#wpadminbar #wp-admin-bar-vaa .ab-item input.radio+label,#wpadminbar #wp-admin-bar-vaa .ab-item input.radio+label *{line-height:18px;vertical-align:text-top;display:inline}#wpadminbar #wp-admin-bar-vaa .ab-item input.checkbox+label:hover,#wpadminbar #wp-admin-bar-vaa .ab-item input.radio+label:hover{cursor:pointer}#wpadminbar #wp-admin-bar-vaa .ab-item input.checkbox:first-child,#wpadminbar #wp-admin-bar-vaa .ab-item input.radio:first-child{margin:0 6px 0 0}#wpadminbar #wp-admin-bar-vaa .ab-item input.radio{border-radius:100%}#wpadminbar #wp-admin-bar-vaa .ab-item input.radio+label+br{line-height:0}#wpadminbar #wp-admin-bar-vaa input.checkbox.vaa-right,#wpadminbar #wp-admin-bar-vaa input.radio.vaa-right{position:absolute;top:5px;right:1em;z-index:99}#wpadminbar #wp-admin-bar-vaa .ab-vaa-multipleselect{max-height:400px;min-width:250px;overflow:hidden;overflow-y:auto;margin:6px 0;padding:0;border:solid transparent;border-width:0 10px}#wpadminbar #wp-admin-bar-vaa .ab-vaa-multipleselect .ab-empty-item{height:auto;overflow:hidden;margin:0;padding:5px 10px;background-color:#fff}#wpadminbar #wp-admin-bar-vaa .ab-vaa-multipleselect .ab-empty-item .ab-item{color:#333}#wpadminbar #wp-admin-bar-vaa .ab-vaa-multipleselect.vaa-small{max-height:100px}#wpadminbar #wp-admin-bar-vaa .ab-vaa-multipleselect .remove:before{color:#333}#wpadminbar #wp-admin-bar-vaa .vaa-column-one-half{width:50%;display:block;float:left;clear:none}#wpadminbar #wp-admin-bar-vaa .vaa-column-one-half .ab-item{min-width:0}#wpadminbar #wp-admin-bar-vaa .vaa-column-one-half.vaa-column-first .ab-item{padding-right:1px}#wpadminbar #wp-admin-bar-vaa .vaa-column-one-half.vaa-column-last .ab-item{padding-left:1px}#wpadminbar #wp-admin-bar-vaa .vaa-clear-float{clear:both}#wpadminbar #wp-admin-bar-vaa .ab-vaa-toggle .ab-item{padding-right:34px}#wpadminbar #wp-admin-bar-vaa .ab-vaa-toggle .ab-item:hover{cursor:pointer}#wpadminbar #wp-admin-bar-vaa .ab-vaa-toggle .ab-item::after{content:"\f140";font-family:'dashicons';position:absolute;right:10px;margin:0;font-size:20px;font-weight:normal}#wpadminbar #wp-admin-bar-vaa .ab-vaa-toggle.active .ab-item::after{content:"\f142"}#wpadminbar #wp-admin-bar-vaa.fullPopupActive .ab-sub-wrapper,#wpadminbar #wp-admin-bar-vaa.fullPopupActive .ab-sub-wrapper .ab-item{display:none}#wpadminbar #wp-admin-bar-vaa.fullPopupActive>.ab-sub-wrapper{display:block}#wpadminbar #wp-admin-bar-vaa.fullPopupActive>.ab-sub-wrapper>.ab-submenu{padding:0}#wpadminbar #wp-admin-bar-vaa.fullPopupActive .ab-sub-wrapper.fullPopup{position:fixed;display:block;visibility:visible;overflow:hidden;z-index:999;max-height:90%;width:90%;margin:5%;top:0;left:0;box-shadow:0 0 50px rgba(0,0,0,0.3)}#wpadminbar #wp-admin-bar-vaa.fullPopupActive .ab-sub-wrapper.fullPopup .ab-item{display:block}#wpadminbar #wp-admin-bar-vaa #wp-admin-bar-vaa-caps #apply-caps-view{float:left;margin-right:5px}#wpadminbar #wp-admin-bar-vaa #wp-admin-bar-vaa-caps #reset-caps-view,#wpadminbar #wp-admin-bar-vaa #wp-admin-bar-vaa-caps #open-caps-popup,#wpadminbar #wp-admin-bar-vaa #wp-admin-bar-vaa-caps #close-caps-popup{float:right;margin-left:5px;height:auto}#wpadminbar #wp-admin-bar-vaa #wp-admin-bar-vaa-caps #close-caps-popup{display:none}#wpadminbar #wp-admin-bar-vaa.fullPopupActive #wp-admin-bar-vaa-caps .ab-sub-wrapper.fullPopup #close-caps-popup{display:block}#wpadminbar #wp-admin-bar-vaa.fullPopupActive #wp-admin-bar-vaa-caps .ab-sub-wrapper.fullPopup #open-caps-popup{display:none}#wpadminbar #wp-admin-bar-vaa.fullPopupActive #wp-admin-bar-vaa-caps .ab-sub-wrapper.fullPopup #wp-admin-bar-vaa-caps-select-options .vaa-cap-item{width:250px;float:left;clear:none}#wpadminbar #wp-admin-bar-vaa #wp-admin-bar-vaa-caps-popup:hover{cursor:pointer}#wpadminbar #wp-admin-bar-my-account #wp-admin-bar-vaa>.ab-item>.ab-label{line-height:26px}#wpadminbar #wp-admin-bar-my-account #wp-admin-bar-vaa>.ab-item>.ab-icon{top:0}#vaa_toolbar #wpadminbar{position:fixed !important;width:auto;min-width:0;right:0;left:auto;border-radius:0 0 0 5px}#vaa_toolbar #wpadminbar #wp-admin-bar-vaa>.ab-item .ab-icon{margin-left:0}#vaa_toolbar #wpadminbar #wp-admin-bar-vaa>.ab-item .ab-label{display:none}#vaa_toolbar #wpadminbar #wp-admin-bar-vaa:hover>.ab-item .ab-icon{margin-left:6px}#vaa_toolbar #wpadminbar #wp-admin-bar-vaa:hover>.ab-item .ab-label{display:inline-block}@media screen and (max-width:782px){#wpadminbar #wp-admin-bar-vaa{display:block;position:static}#wpadminbar #wp-admin-bar-vaa>.ab-item>.ab-icon{margin-left:0}#wpadminbar #wp-admin-bar-vaa .ab-sub-wrapper{width:100%}#wpadminbar #wp-admin-bar-vaa .ab-sub-wrapper .ab-sub-wrapper{position:static;top:auto;margin:0;-webkit-box-shadow:none;-moz-box-shadow:none;box-shadow:none}#wpadminbar #wp-admin-bar-vaa.menupop .menupop>.ab-item:before{content:''}#wpadminbar #wp-admin-bar-vaa .ab-item .vaa-hide-responsive{display:none}#wpadminbar #wp-admin-bar-vaa .vaa-notice{line-height:42px;font-size:16px}#wpadminbar #wp-admin-bar-vaa .vaa-notice .ab-icon{height:auto}#wpadminbar #wp-admin-bar-vaa>div>ul,#wpadminbar #wp-admin-bar-vaa .menupop>.ab-sub-wrapper .ab-submenu{padding:5px 0}#wpadminbar #wp-admin-bar-vaa .menupop>.ab-sub-wrapper .ab-item{padding:8px 44px;white-space:normal;height:auto}#wpadminbar #wp-admin-bar-vaa .menupop>.ab-sub-wrapper .ab-item>.ab-item{padding:8px 0}#wpadminbar #wp-admin-bar-vaa .menupop>.ab-sub-wrapper:last-child .ab-item.description{margin-bottom:0}#wpadminbar #wp-admin-bar-vaa .ab-item>span.remove,#wpadminbar #wp-admin-bar-vaa .vaa-has-icon .ab-item .ab-icon{width:auto;height:auto;font-size:22px !important;margin-right:10px;vertical-align:text-top}#wpadminbar #wp-admin-bar-vaa .ab-vaa-title.vaa-has-icon>.ab-item>.ab-icon{font-size:30px !important;margin-left:-6px;margin-top:-1px;vertical-align:top}#wpadminbar #wp-admin-bar-vaa .vaa-has-icon.menupop>.ab-item{padding-left:12px;padding-right:12px}#wpadminbar #wp-admin-bar-vaa .vaa-menupop div li{margin-left:12px}#wpadminbar #wp-admin-bar-vaa .ab-sub-wrapper .vaa-role-item.menupop>.ab-item{padding-left:15px}#wpadminbar #wp-admin-bar-vaa .ab-vaa-toggle .ab-item::after,#wpadminbar #wp-admin-bar-vaa .ab-sub-wrapper .vaa-menupop.menupop>.ab-item:after{content:"\f140";font-family:'dashicons';position:absolute;right:10px;top:8px;margin:0;font-size:30px;font-weight:normal}#wpadminbar #wp-admin-bar-vaa .ab-vaa-toggle.active .ab-item::after,#wpadminbar #wp-admin-bar-vaa .ab-sub-wrapper .vaa-menupop.menupop.active>.ab-item:after{content:"\f142"}#wpadminbar #wp-admin-bar-vaa button{font-size:16px;padding:5px 15px}#wpadminbar #wp-admin-bar-vaa .ab-vaa-input .ab-item input,#wpadminbar #wp-admin-bar-vaa .ab-vaa-search .ab-item input,#wpadminbar #wp-admin-bar-vaa .ab-vaa-filter .ab-item input{padding:8px 12px}#wpadminbar #wp-admin-bar-vaa .ab-vaa-select .ab-item select{padding:7px 12px}#wpadminbar #wp-admin-bar-vaa .ab-item select+button.input-overlay,#wpadminbar #wp-admin-bar-vaa .ab-item input+button.input-overlay{right:44px;padding:6px 10px 7px;font-size:14px}#wpadminbar #wp-admin-bar-vaa .ab-vaa-multipleselect{border-width:0 44px;max-height:300px !important}#wpadminbar #wp-admin-bar-vaa .menupop>.ab-sub-wrapper .ab-vaa-multipleselect>.ab-item{padding:8px 16px}#wpadminbar #wp-admin-bar-vaa input.checkbox,#wpadminbar #wp-admin-bar-vaa input.radio{width:24px;height:24px}#wpadminbar #wp-admin-bar-vaa input.checkbox.vaa-right,#wpadminbar #wp-admin-bar-vaa input.radio.vaa-right{top:9px;right:11px}} \ No newline at end of file diff --git a/assets/js/view-admin-as.js b/assets/js/view-admin-as.js index d7ce296d..1c729a06 100644 --- a/assets/js/view-admin-as.js +++ b/assets/js/view-admin-as.js @@ -177,6 +177,13 @@ if ( 'undefined' === typeof VAA_View_Admin_As ) { VAA_View_Admin_As.mobile(); } + // @since 1.7.1 Auto max height trigger. + VAA_View_Admin_As.maxHeightListenerElements.each( function() { + $(this).parents('.menupop').on( 'mouseenter', function() { + VAA_View_Admin_As.autoMaxHeight(); + } ); + } ); + } ); // End window.load. // Process reset. @@ -797,10 +804,6 @@ if ( 'undefined' === typeof VAA_View_Admin_As ) { } ); }; - // Set max height of the caps submenu. - $document.on( 'mouseenter', root_prefix + '-manager', function() { - VAA_View_Admin_As.autoMaxHeight(); - } ); // Enlarge caps. $document.on( 'click', root_prefix + ' #open-caps-popup', function() { $( VAA_View_Admin_As.prefix ).addClass('fullPopupActive'); diff --git a/assets/js/view-admin-as.min.js b/assets/js/view-admin-as.min.js index 0bc77632..66c702a2 100644 --- a/assets/js/view-admin-as.min.js +++ b/assets/js/view-admin-as.min.js @@ -8,4 +8,4 @@ * @version 1.7.1 * @preserve */ -if("undefined"===typeof VAA_View_Admin_As){var VAA_View_Admin_As={}}(function($){var $document=$(document),$window=$(window),$body=$("body");VAA_View_Admin_As.prefix="#wpadminbar #wp-admin-bar-vaa ";VAA_View_Admin_As.root="#wp-admin-bar-vaa";VAA_View_Admin_As.maxHeightListenerElements=$(VAA_View_Admin_As.prefix+".vaa-auto-max-height");VAA_View_Admin_As._mobile=false;if(!VAA_View_Admin_As.hasOwnProperty("_debug")){VAA_View_Admin_As._debug=false}VAA_View_Admin_As._debug=Boolean(parseInt(VAA_View_Admin_As._debug,10));if(!VAA_View_Admin_As.hasOwnProperty("ajaxurl")&&"undefined"!==typeof ajaxurl){VAA_View_Admin_As.ajaxurl=ajaxurl}VAA_View_Admin_As._touchmove=false;$document.on("touchmove",function(){VAA_View_Admin_As._touchmove=true});$document.on("touchstart",function(){VAA_View_Admin_As._touchmove=false});VAA_View_Admin_As.json_decode=function(val){if(0===val.indexOf("{")){try{val=JSON.parse(val)}catch(err){}}return val};VAA_View_Admin_As.init=function(){VAA_View_Admin_As.init_caps();VAA_View_Admin_As.init_users();VAA_View_Admin_As.init_settings();VAA_View_Admin_As.init_module_role_defaults();VAA_View_Admin_As.init_module_role_manager();$window.on("load",function(){$(VAA_View_Admin_As.prefix+".ab-vaa-toggle").each(function(){var toggleContent=$(this).parent().children().not(".ab-vaa-toggle");if(!$(this).hasClass("active")){toggleContent.hide()}$(this).on("click touchend",function(e){e.preventDefault();e.stopPropagation();if(true===VAA_View_Admin_As._touchmove){return}if($(this).hasClass("active")){toggleContent.slideUp("fast");$(this).removeClass("active")}else{toggleContent.slideDown("fast");$(this).addClass("active")}VAA_View_Admin_As.autoMaxHeight()});$(this).on("keyup",function(e){e.preventDefault();var key=parseInt(e.which,10);if($(this).hasClass("active")&&(13===key||32===key||38===key)){toggleContent.slideUp("fast");$(this).removeClass("active")}else if(13===key||32===key||40===key){toggleContent.slideDown("fast");$(this).addClass("active")}VAA_View_Admin_As.autoMaxHeight()})});$(VAA_View_Admin_As.prefix+".ab-vaa-showhide[data-showhide]").each(function(){$($(this).attr("data-showhide")).hide();$(this).on("mouseenter",function(){$($(this).attr("data-showhide")).slideDown("fast")}).on("mouseleave",function(){$($(this).attr("data-showhide")).slideUp("fast")})});$(VAA_View_Admin_As.prefix+".ab-vaa-conditional[data-condition-target]").each(function(){var $this=$(this),$target=$($this.attr("data-condition-target")),compare=$this.attr("data-condition"),checkbox=$target.is(":checkbox");$this.hide();$target.on("change",function(){if(checkbox&&$target.is(":checked")){$this.slideDown("fast")}else if(!checkbox&&compare===$target.val()){$this.slideDown("fast")}else{$this.slideUp("fast")}VAA_View_Admin_As.autoMaxHeight()})});if($body.hasClass("mobile")||783>$body.innerWidth()){$body.addClass("vaa-mobile");VAA_View_Admin_As._mobile=true;VAA_View_Admin_As.mobile()}});$document.on("click touchend",VAA_View_Admin_As.prefix+".vaa-reset-item > .ab-item",function(e){e.preventDefault();if(true===VAA_View_Admin_As._touchmove){return}if("vaa_reload"===$("button",this).attr("name")){window.location.reload()}else{VAA_View_Admin_As.ajax({reset:true},true);return false}});$.each(VAA_View_Admin_As.view_types,function(index,type){$document.on("click touchend",VAA_View_Admin_As.prefix+".vaa-"+type+"-item > a.ab-item",function(e){if(true===VAA_View_Admin_As._touchmove){return}e.preventDefault();var $this=$(this);if(VAA_View_Admin_As._mobile&&$this.parent().hasClass("menupop")&&!$this.next().is(":visible")){$this.next().show().parent().addClass("active");return}if(!$this.parent().hasClass("not-a-view")){var view_data={},val=$this.attr("rel");if(!val){val=$this.find(".vaa-view-data").attr("data-view-value")}view_data[type]=VAA_View_Admin_As.json_decode(val);view_data="object"===typeof view_data[type]?view_data[type]:view_data;VAA_View_Admin_As.ajax(view_data,true);return false}})});$document.on("click touchend",VAA_View_Admin_As.prefix+".remove",function(e){e.preventDefault();if(true===VAA_View_Admin_As._touchmove){return}$(this).parent().slideUp("fast",function(){$(this).remove()})})};VAA_View_Admin_As.mobile=function(){var prefix=".vaa-mobile "+VAA_View_Admin_As.prefix;$document.on("click touchend",prefix+" > .ab-sub-wrapper .ab-item",function(e){if(true===VAA_View_Admin_As._touchmove){return}e.preventDefault();e.stopPropagation();var $sub=$(this).parent(".menupop").children(".ab-sub-wrapper");if($sub.length){if($sub.hasClass("active")){$sub.slideUp("fast");$sub.removeClass("active")}else{$sub.slideDown("fast");$sub.addClass("active")}}});$document.on("click touchend",prefix+"input, "+prefix+"textarea, "+prefix+"select",function(e){if(true===VAA_View_Admin_As._touchmove){return}e.stopPropagation();var $this=$(this);if($this.is('[type="checkbox"]')){e.preventDefault();if($this.is(":checked")){$this.prop("checked",false)}else{$this.prop("checked",true)}$this.trigger("change");return false}else if($this.is('[type="radio"]')){e.preventDefault();$('input[name="'+$this.attr["name"]+'"]').removeAttr("checked");$this.prop("checked",true);$this.trigger("change");return false}return true});$document.on("click touchend",prefix+"label",function(e){if(true===VAA_View_Admin_As._touchmove){return}e.preventDefault();e.stopPropagation();$("#"+$(this).attr("for")).trigger(e.type);return false})};VAA_View_Admin_As.overlay=function(html){var $overlay=$("#vaa-overlay");if(!$overlay.length){html='
    '+html+"
    ";$body.append(html);$overlay=$("body #vaa-overlay")}else if(html.length){$overlay.html(html)}$overlay.fadeIn("fast")};VAA_View_Admin_As.ajax=function(data,refresh){$(".vaa-notice","#wpadminbar").remove();var loader_icon=VAA_View_Admin_As.siteurl+"/wp-includes/images/spinner-2x.gif";VAA_View_Admin_As.overlay('');var post_data={action:"view_admin_as",_vaa_nonce:VAA_View_Admin_As._vaa_nonce,view_admin_as:JSON.stringify(data)};var isView=false;$.each(VAA_View_Admin_As.view_types,function(index,type){if("undefined"!==typeof data[type]){isView=true;return true}});if($(VAA_View_Admin_As.prefix+"#vaa-settings-view-mode-single").is(":checked")&&isView){$body.append('');var form=$("#vaa_single_mode_form");form.append('');form.append('');form.append('');form.find("#data").val(post_data.view_admin_as);form.submit()}else{$.post(VAA_View_Admin_As.ajaxurl,post_data,function(response){var success=response.hasOwnProperty("success")&&true===response.success,data={},display=false;if(true===VAA_View_Admin_As._debug){console.log(response)}if(response.hasOwnProperty("data")){if("object"===typeof response.data){data=response.data;if(data.hasOwnProperty("display")){display=data.display}}}if(success){if(refresh){VAA_View_Admin_As.refresh(data);return}else{if(!data.hasOwnProperty("text")){data.text=VAA_View_Admin_As.__success}}}if(!data.hasOwnProperty("type")){if(success){data.type="success"}else{data.type="error"}}if("popup"===display){VAA_View_Admin_As.popup(data,data.type)}else{if(!data.hasOwnProperty("text")){data.text=response.data}VAA_View_Admin_As.notice(String(data.text),data.type,5e3);$("body #vaa-overlay").addClass(data.type).fadeOut("fast",function(){$(this).remove()})}})}};VAA_View_Admin_As.refresh=function(data){if(data.hasOwnProperty("redirect")){window.location.replace(String(data.redirect))}else{window.location.hash="";window.location.reload()}};VAA_View_Admin_As.notice=function(notice,type,timeout){var root="#wpadminbar .vaa-notice",html=notice+'';type="undefined"===typeof type?"notice":type;timeout="undefined"===typeof timeout?5e3:timeout;if(VAA_View_Admin_As._mobile){html='";$(VAA_View_Admin_As.prefix+"> .ab-sub-wrapper").prepend(html).children(".vaa-notice").slideDown("fast");$("html, body").animate({scrollTop:"0"});if(timeout){setTimeout(function(){$(root).slideUp("fast",function(){$(this).remove()})},timeout)}}else{html='
  • '+html+"
  • ";$("#wp-admin-bar-top-secondary").append(html);$(root+" .remove").click(function(){$(this).parent().remove()});if(timeout){setTimeout(function(){$(root).fadeOut("fast",function(){$(this).remove()})},timeout)}}};VAA_View_Admin_As.item_notice=function(parent,notice,type,timeout){var root=".vaa-notice",html=notice+'',$element=$(parent);type="undefined"===typeof type?"notice":type;timeout="undefined"===typeof timeout?5e3:timeout;html='";$element.append(html).children(".vaa-notice").slideDown("fast");if(timeout){setTimeout(function(){$(root,$element).slideUp("fast",function(){$(this).remove()})},timeout)}};VAA_View_Admin_As.item_confirm=function(parent,text){$(parent).find(".vaa-notice").slideUp("fast",function(){$(this).remove()});text='";VAA_View_Admin_As.item_notice(parent,text,"warning",0);return $(parent).find(".vaa-confirm")};VAA_View_Admin_As.popup=function(data,type){type="undefined"===typeof type?"notice":type;var html="";html+='
    ';html+='';html+='
    ';if("object"!==typeof data){data={text:data}}if(data.hasOwnProperty("text")){html+="

    "+String(data.text)+"

    "}if(data.hasOwnProperty("list")){html+="
      ";data.list.forEach(function(item){html+="
    • "+String(item)+"
    • "});html+="
    "}if(data.hasOwnProperty("textarea")){html+='"}html+="
    ";VAA_View_Admin_As.overlay(html);var root="body #vaa-overlay",$overlay=$(root),$overlayContainer=$(root+" .vaa-overlay-container"),$popupResponse=$(root+" .vaa-response-data");$(root+" .vaa-overlay-container .remove").click(function(){$overlay.fadeOut("fast",function(){$(this).remove()})});$document.on("mouseup",function(e){$(root+" .vaa-overlay-container").each(function(){if(!$(this).is(e.target)&&0===$(this).has(e.target).length){$overlay.fadeOut("fast",function(){$(this).remove()})}})});var textarea=$("textarea",$popupResponse);if(textarea.length){textarea.on("click",function(){$(this).select()})}var popupMaxHeight=function(){if(textarea.length){textarea.each(function(){$(this).css({height:"auto","overflow-y":"hidden"}).height(this.scrollHeight)})}var maxHeight=$overlay.height()*.8-24;$overlayContainer.css("max-height",maxHeight);$popupResponse.css("max-height",maxHeight)};popupMaxHeight();$window.on("resize",function(){popupMaxHeight()})};VAA_View_Admin_As.init_settings=function(){var root=VAA_View_Admin_As.root+"-settings",prefix="vaa-settings",root_prefix=VAA_View_Admin_As.prefix+root;$document.on("change",root_prefix+"-admin-menu-location select#"+prefix+"-admin-menu-location",function(e){e.preventDefault();var val=$(this).val();if(val&&""!==val){var view_data={user_setting:{admin_menu_location:val}};VAA_View_Admin_As.ajax(view_data,true)}});$document.on("change",root_prefix+"-view-mode input.radio."+prefix+"-view-mode",function(e){e.preventDefault();var val=$(this).val();if(val&&""!==val){var view_data={user_setting:{view_mode:val}};VAA_View_Admin_As.ajax(view_data,false)}});$document.on("change",root_prefix+"-force-group-users input#"+prefix+"-force-group-users",function(e){e.preventDefault();var view_data={user_setting:{force_group_users:"no"}};if(this.checked){view_data={user_setting:{force_group_users:"yes"}}}VAA_View_Admin_As.ajax(view_data,true)});$document.on("change",root_prefix+"-hide-front input#"+prefix+"-hide-front",function(e){e.preventDefault();var view_data={user_setting:{hide_front:"no"}};if(this.checked){view_data={user_setting:{hide_front:"yes"}}}VAA_View_Admin_As.ajax(view_data,false)});$document.on("change",root_prefix+"-freeze-locale input#"+prefix+"-freeze-locale",function(e){e.preventDefault();var view_data={user_setting:{freeze_locale:"no"}};if(this.checked){view_data={user_setting:{freeze_locale:"yes"}}}var reload=false;if("object"===typeof VAA_View_Admin_As.view&&"undefined"!==typeof VAA_View_Admin_As.view.user){reload=true}VAA_View_Admin_As.ajax(view_data,reload)})};VAA_View_Admin_As.init_users=function(){var root=VAA_View_Admin_As.root+"-users",root_prefix=VAA_View_Admin_As.prefix+root;$document.on("keyup",root_prefix+" .ab-vaa-search.search-users input",function(){$(VAA_View_Admin_As.prefix+" .ab-vaa-search .ab-vaa-results").empty();if(1<=$(this).val().length){var inputText=$(this).val();$(VAA_View_Admin_As.prefix+".vaa-user-item").each(function(){var name=$(".ab-item",this).text();if(-1('+role+")")}}});if(""===$.trim($(VAA_View_Admin_As.prefix+".ab-vaa-search .ab-vaa-results").html())){$(VAA_View_Admin_As.prefix+".ab-vaa-search .ab-vaa-results").append('
    '+VAA_View_Admin_As.__no_users_found+"
    ")}}})};VAA_View_Admin_As.init_caps=function(){var root=VAA_View_Admin_As.root+"-caps",root_prefix=VAA_View_Admin_As.prefix+root;VAA_View_Admin_As.caps_filter_settings={selectedRole:"default",selectedRoleCaps:{},selectedRoleReverse:false,filterString:""};VAA_View_Admin_As.filter_capabilities=function(){var reverse=true===VAA_View_Admin_As.caps_filter_settings.selectedRoleReverse,isDefault="default"===VAA_View_Admin_As.caps_filter_settings.selectedRole,filterString=VAA_View_Admin_As.caps_filter_settings.filterString;$(root_prefix+"-select-options .vaa-cap-item").each(function(){var $this=$(this),exists=$("input",this).attr("value")in VAA_View_Admin_As.caps_filter_settings.selectedRoleCaps,name;$this.hide();if(reverse||exists||isDefault){if(1<=filterString.length){name=$this.text();if(-1 .ab-sub-wrapper").addClass("fullPopup");VAA_View_Admin_As.autoMaxHeight()});$document.on("click",root_prefix+" #close-caps-popup",function(){$(VAA_View_Admin_As.prefix).removeClass("fullPopupActive");$(root_prefix+"-manager > .ab-sub-wrapper").removeClass("fullPopup");VAA_View_Admin_As.autoMaxHeight()});$document.on("change",root_prefix+" .ab-vaa-select.select-role-caps select",function(){VAA_View_Admin_As.caps_filter_settings.selectedRole=$(this).val();if("default"===VAA_View_Admin_As.caps_filter_settings.selectedRole){VAA_View_Admin_As.caps_filter_settings.selectedRoleCaps={};VAA_View_Admin_As.caps_filter_settings.selectedRoleReverse=false}else{var selectedRoleElement=$(root_prefix+'-selectrolecaps #vaa-caps-selectrolecaps option[value="'+VAA_View_Admin_As.caps_filter_settings.selectedRole+'"]');VAA_View_Admin_As.caps_filter_settings.selectedRoleCaps=JSON.parse(selectedRoleElement.attr("data-caps"));VAA_View_Admin_As.caps_filter_settings.selectedRoleReverse=1===parseInt(selectedRoleElement.attr("data-reverse"),10)}VAA_View_Admin_As.filter_capabilities()});$document.on("keyup",root_prefix+" .ab-vaa-filter input",function(){VAA_View_Admin_As.caps_filter_settings.filterString=$(this).val();VAA_View_Admin_As.filter_capabilities()});$document.on("click touchend",root_prefix+" button#select-all-caps",function(e){if(true===VAA_View_Admin_As._touchmove){return}e.preventDefault();$(root_prefix+"-select-options .vaa-cap-item").each(function(){if($(this).is(":visible")){$("input",this).prop("checked",true)}});return false});$document.on("click touchend",root_prefix+" button#deselect-all-caps",function(e){if(true===VAA_View_Admin_As._touchmove){return}e.preventDefault();$(root_prefix+"-select-options .vaa-cap-item").each(function(){if($(this).is(":visible")){$("input",this).prop("checked",false)}});return false});$document.on("click touchend",root_prefix+" button#apply-caps-view",function(e){if(true===VAA_View_Admin_As._touchmove){return}e.preventDefault();var newCaps=VAA_View_Admin_As.get_selected_capabilities();VAA_View_Admin_As.ajax({caps:newCaps},true);return false})};VAA_View_Admin_As.init_module_role_defaults=function(){var root=VAA_View_Admin_As.root+"-modules",prefix="vaa-modules",root_prefix=VAA_View_Admin_As.prefix+root;$document.on("change",root_prefix+"-role-defaults-enable input#"+prefix+"-role-defaults-enable",function(e){e.preventDefault();var view_data={role_defaults:{enable:0}};if(this.checked){view_data={role_defaults:{enable:true}}}VAA_View_Admin_As.ajax(view_data,true)});root=VAA_View_Admin_As.root+"-role-defaults";prefix="vaa-role-defaults";root_prefix=VAA_View_Admin_As.prefix+root;$document.on("change",root_prefix+"-setting-register-enable input#"+prefix+"-setting-register-enable",function(e){e.preventDefault();var view_data={role_defaults:{apply_defaults_on_register:0}};if(this.checked){view_data={role_defaults:{apply_defaults_on_register:true}}}VAA_View_Admin_As.ajax(view_data,false)});$document.on("change",root_prefix+"-setting-disable-user-screen-options input#"+prefix+"-setting-disable-user-screen-options",function(e){e.preventDefault();var view_data={role_defaults:{disable_user_screen_options:0}};if(this.checked){view_data={role_defaults:{disable_user_screen_options:true}}}VAA_View_Admin_As.ajax(view_data,false)});$document.on("change",root_prefix+"-setting-lock-meta-boxes input#"+prefix+"-setting-lock-meta-boxes",function(e){e.preventDefault();var view_data={role_defaults:{lock_meta_boxes:0}};if(this.checked){view_data={role_defaults:{lock_meta_boxes:true}}}VAA_View_Admin_As.ajax(view_data,false)});$document.on("click touchend",root_prefix+"-meta-add button#"+prefix+"-meta-add",function(e){if(true===VAA_View_Admin_As._touchmove){return}e.preventDefault();var val=$(root_prefix+"-meta-add input#"+prefix+"-meta-new").val();var item=$(root_prefix+"-meta-add #"+prefix+"-meta-template").html().toString();val=val.replace(/ /g,"_");item=item.replace(/vaa_new_item/g,val);if($(root_prefix+'-meta-select input[value="'+val+'"]').length){VAA_View_Admin_As.item_notice($(this).parent(),VAA_View_Admin_As.__key_already_exists,"error",2e3)}else{$(root_prefix+"-meta-select > .ab-item").prepend(item)}});$document.on("click touchend",root_prefix+"-meta-apply button#"+prefix+"-meta-apply",function(e){if(true===VAA_View_Admin_As._touchmove){return}e.preventDefault();var val={};$(root_prefix+"-meta-select .ab-item.vaa-item input").each(function(){val[$(this).val()]=$(this).is(":checked")});if(val){var view_data={role_defaults:{update_meta:val}};VAA_View_Admin_As.ajax(view_data,false)}return false});$document.on("keyup",root_prefix+"-bulk-users-filter input#"+prefix+"-bulk-users-filter",function(e){e.preventDefault();if(1<=$(this).val().length){var inputText=$(this).val();$(root_prefix+"-bulk-users-select .ab-item.vaa-item").each(function(){var name=$(".user-name",this).text();if(-1"+err+"","error")}}return false});$document.on("click touchend",root_prefix+"-clear-roles-apply button#"+prefix+"-clear-roles-apply",function(e){if(true===VAA_View_Admin_As._touchmove){return}e.preventDefault();var val=$(root_prefix+"-clear-roles-select select#"+prefix+"-clear-roles-select").val();if(val&&""!==val){var view_data={role_defaults:{clear_role_defaults:val}},confirm=VAA_View_Admin_As.item_confirm($(this).parent(),VAA_View_Admin_As.__confirm);$(confirm).on("click",function(){VAA_View_Admin_As.ajax(view_data,false)})}return false})};VAA_View_Admin_As.init_module_role_manager=function(){var root=VAA_View_Admin_As.root+"-modules",prefix="vaa-modules",root_prefix=VAA_View_Admin_As.prefix+root;$document.on("change",root_prefix+"-role-manager-enable input#"+prefix+"-role-manager-enable",function(e){e.preventDefault();var view_data={role_manager:{enable:0}};if(this.checked){view_data={role_manager:{enable:true}}}VAA_View_Admin_As.ajax(view_data,true)});root=VAA_View_Admin_As.root+"-role-manager";prefix="vaa-role-manager";root_prefix=VAA_View_Admin_As.prefix+root;$document.on("click touchend",root_prefix+"-apply-view-apply button#"+prefix+"-apply-view-apply",function(e){if(true===VAA_View_Admin_As._touchmove){return}e.preventDefault();var role=$(root_prefix+"-apply-view-select select#"+prefix+"-apply-view-select").val();var capabilities=JSON.parse($(this).attr("data-view-caps"));if(role&&""!==role&&capabilities){var view_data={role_manager:{apply_view_to_role:{role:role,capabilities:capabilities}}};VAA_View_Admin_As.ajax(view_data,true)}return false});$document.on("click touchend",root_prefix+"-rename-apply button#"+prefix+"-rename-apply",function(e){if(true===VAA_View_Admin_As._touchmove){return}e.preventDefault();var role=$(root_prefix+"-rename-select select#"+prefix+"-rename-select").val();var new_name=$(root_prefix+"-rename-input input#"+prefix+"-rename-input").val();if(role&&""!==role&&new_name&&""!==new_name){var view_data={role_manager:{rename_role:{role:role,new_name:new_name}}};VAA_View_Admin_As.ajax(view_data,true)}return false});$document.on("click touchend",root_prefix+"-clone-apply button#"+prefix+"-clone-apply",function(e){if(true===VAA_View_Admin_As._touchmove){return}e.preventDefault();var role=$(root_prefix+"-clone-select select#"+prefix+"-clone-select").val();var new_role=$(root_prefix+"-clone-input input#"+prefix+"-clone-input").val();if(role&&""!==role&&new_role&&""!==new_role){var view_data={role_manager:{clone_role:{role:role,new_role:new_role}}};VAA_View_Admin_As.ajax(view_data,true)}return false});$document.on("click touchend",root_prefix+"-delete-apply button#"+prefix+"-delete-apply",function(e){if(true===VAA_View_Admin_As._touchmove){return}e.preventDefault();var val=$(root_prefix+"-delete-select select#"+prefix+"-delete-select").val();if(val&&""!==val){var view_data={role_manager:{delete_role:val}},confirm=VAA_View_Admin_As.item_confirm($(this).parent(),VAA_View_Admin_As.__confirm);$(confirm).on("click",function(){VAA_View_Admin_As.ajax(view_data,true)})}return false});var caps_root=VAA_View_Admin_As.root+"-caps-manager-role-manager",caps_prefix="vaa-caps-manager-role-manager",caps_root_prefix=VAA_View_Admin_As.prefix+caps_root;$document.on("change",caps_root_prefix+" select#"+caps_prefix+"-edit-role",function(){var $this=$(this),role=$this.val(),caps={},selectedRoleElement=$(caps_root_prefix+" select#"+caps_prefix+'-edit-role option[value="'+role+'"]');if(selectedRoleElement.attr("data-caps")){caps=JSON.parse(selectedRoleElement.attr("data-caps"))}VAA_View_Admin_As.caps_filter_settings.selectedRole="default";VAA_View_Admin_As.caps_filter_settings.selectedRoleCaps={};VAA_View_Admin_As.caps_filter_settings.selectedRoleReverse=false;VAA_View_Admin_As.filter_capabilities();VAA_View_Admin_As.set_selected_capabilities(caps)});$document.on("click touchend",caps_root_prefix+" button#"+caps_prefix+"-save-role",function(e){if(true===VAA_View_Admin_As._touchmove){return}e.preventDefault();var role=$(caps_root_prefix+" select#"+caps_prefix+"-edit-role").val(),refresh=false;if(!role){return false}if("__new__"===role){role=$(caps_root_prefix+" input#"+caps_prefix+"-new-role").val();refresh=true}var data={role:role,capabilities:VAA_View_Admin_As.get_selected_capabilities()};VAA_View_Admin_As.ajax({role_manager:{save_role:data}},refresh);return false});$document.on("click touchend",caps_root_prefix+"-new-cap button#"+caps_prefix+"-add-cap",function(e){if(true===VAA_View_Admin_As._touchmove){return}e.preventDefault();var existing=VAA_View_Admin_As.get_selected_capabilities();var val=$(caps_root_prefix+"-new-cap input#"+caps_prefix+"-new-cap").val();var item=$(caps_root_prefix+"-new-cap #"+caps_prefix+"-cap-template").html().toString();val=val.replace(/ /g,"_");item=item.replace(/vaa_new_item/g,val);if("undefined"!==typeof existing[val]){VAA_View_Admin_As.item_notice($(this).parent(),VAA_View_Admin_As.__key_already_exists,"error",2e3)}else{$(VAA_View_Admin_As.root+"-caps-select-options > .ab-item").prepend(item)}})};VAA_View_Admin_As.autoMaxHeight=function(){setTimeout(function(){VAA_View_Admin_As.maxHeightListenerElements.each(function(){var element=$(this),count=0,wait=setInterval(function(){var offset=element.offset(),scrollTop="undefined"!==typeof window.pageYOffset?window.pageYOffset:(document.documentElement||document.body.parentNode||document.body).scrollTop,offsetTop=offset.top-scrollTop;if(element.is(":visible")&&0$body.innerWidth()){$body.addClass("vaa-mobile");VAA_View_Admin_As._mobile=true;VAA_View_Admin_As.mobile()}VAA_View_Admin_As.maxHeightListenerElements.each(function(){$(this).parents(".menupop").on("mouseenter",function(){VAA_View_Admin_As.autoMaxHeight()})})});$document.on("click touchend",VAA_View_Admin_As.prefix+".vaa-reset-item > .ab-item",function(e){e.preventDefault();if(true===VAA_View_Admin_As._touchmove){return}if("vaa_reload"===$("button",this).attr("name")){window.location.reload()}else{VAA_View_Admin_As.ajax({reset:true},true);return false}});$.each(VAA_View_Admin_As.view_types,function(index,type){$document.on("click touchend",VAA_View_Admin_As.prefix+".vaa-"+type+"-item > a.ab-item",function(e){if(true===VAA_View_Admin_As._touchmove){return}e.preventDefault();var $this=$(this);if(VAA_View_Admin_As._mobile&&$this.parent().hasClass("menupop")&&!$this.next().is(":visible")){$this.next().show().parent().addClass("active");return}if(!$this.parent().hasClass("not-a-view")){var view_data={},val=$this.attr("rel");if(!val){val=$this.find(".vaa-view-data").attr("data-view-value")}view_data[type]=VAA_View_Admin_As.json_decode(val);view_data="object"===typeof view_data[type]?view_data[type]:view_data;VAA_View_Admin_As.ajax(view_data,true);return false}})});$document.on("click touchend",VAA_View_Admin_As.prefix+".remove",function(e){e.preventDefault();if(true===VAA_View_Admin_As._touchmove){return}$(this).parent().slideUp("fast",function(){$(this).remove()})})};VAA_View_Admin_As.mobile=function(){var prefix=".vaa-mobile "+VAA_View_Admin_As.prefix;$document.on("click touchend",prefix+" > .ab-sub-wrapper .ab-item",function(e){if(true===VAA_View_Admin_As._touchmove){return}e.preventDefault();e.stopPropagation();var $sub=$(this).parent(".menupop").children(".ab-sub-wrapper");if($sub.length){if($sub.hasClass("active")){$sub.slideUp("fast");$sub.removeClass("active")}else{$sub.slideDown("fast");$sub.addClass("active")}}});$document.on("click touchend",prefix+"input, "+prefix+"textarea, "+prefix+"select",function(e){if(true===VAA_View_Admin_As._touchmove){return}e.stopPropagation();var $this=$(this);if($this.is('[type="checkbox"]')){e.preventDefault();if($this.is(":checked")){$this.prop("checked",false)}else{$this.prop("checked",true)}$this.trigger("change");return false}else if($this.is('[type="radio"]')){e.preventDefault();$('input[name="'+$this.attr["name"]+'"]').removeAttr("checked");$this.prop("checked",true);$this.trigger("change");return false}return true});$document.on("click touchend",prefix+"label",function(e){if(true===VAA_View_Admin_As._touchmove){return}e.preventDefault();e.stopPropagation();$("#"+$(this).attr("for")).trigger(e.type);return false})};VAA_View_Admin_As.overlay=function(html){var $overlay=$("#vaa-overlay");if(!$overlay.length){html='
    '+html+"
    ";$body.append(html);$overlay=$("body #vaa-overlay")}else if(html.length){$overlay.html(html)}$overlay.fadeIn("fast")};VAA_View_Admin_As.ajax=function(data,refresh){$(".vaa-notice","#wpadminbar").remove();var loader_icon=VAA_View_Admin_As.siteurl+"/wp-includes/images/spinner-2x.gif";VAA_View_Admin_As.overlay('');var post_data={action:"view_admin_as",_vaa_nonce:VAA_View_Admin_As._vaa_nonce,view_admin_as:JSON.stringify(data)};var isView=false;$.each(VAA_View_Admin_As.view_types,function(index,type){if("undefined"!==typeof data[type]){isView=true;return true}});if($(VAA_View_Admin_As.prefix+"#vaa-settings-view-mode-single").is(":checked")&&isView){$body.append('');var form=$("#vaa_single_mode_form");form.append('');form.append('');form.append('');form.find("#data").val(post_data.view_admin_as);form.submit()}else{$.post(VAA_View_Admin_As.ajaxurl,post_data,function(response){var success=response.hasOwnProperty("success")&&true===response.success,data={},display=false;if(true===VAA_View_Admin_As._debug){console.log(response)}if(response.hasOwnProperty("data")){if("object"===typeof response.data){data=response.data;if(data.hasOwnProperty("display")){display=data.display}}}if(success){if(refresh){VAA_View_Admin_As.refresh(data);return}else{if(!data.hasOwnProperty("text")){data.text=VAA_View_Admin_As.__success}}}if(!data.hasOwnProperty("type")){if(success){data.type="success"}else{data.type="error"}}if("popup"===display){VAA_View_Admin_As.popup(data,data.type)}else{if(!data.hasOwnProperty("text")){data.text=response.data}VAA_View_Admin_As.notice(String(data.text),data.type,5e3);$("body #vaa-overlay").addClass(data.type).fadeOut("fast",function(){$(this).remove()})}})}};VAA_View_Admin_As.refresh=function(data){if(data.hasOwnProperty("redirect")){window.location.replace(String(data.redirect))}else{window.location.hash="";window.location.reload()}};VAA_View_Admin_As.notice=function(notice,type,timeout){var root="#wpadminbar .vaa-notice",html=notice+'';type="undefined"===typeof type?"notice":type;timeout="undefined"===typeof timeout?5e3:timeout;if(VAA_View_Admin_As._mobile){html='";$(VAA_View_Admin_As.prefix+"> .ab-sub-wrapper").prepend(html).children(".vaa-notice").slideDown("fast");$("html, body").animate({scrollTop:"0"});if(timeout){setTimeout(function(){$(root).slideUp("fast",function(){$(this).remove()})},timeout)}}else{html='
  • '+html+"
  • ";$("#wp-admin-bar-top-secondary").append(html);$(root+" .remove").click(function(){$(this).parent().remove()});if(timeout){setTimeout(function(){$(root).fadeOut("fast",function(){$(this).remove()})},timeout)}}};VAA_View_Admin_As.item_notice=function(parent,notice,type,timeout){var root=".vaa-notice",html=notice+'',$element=$(parent);type="undefined"===typeof type?"notice":type;timeout="undefined"===typeof timeout?5e3:timeout;html='";$element.append(html).children(".vaa-notice").slideDown("fast");if(timeout){setTimeout(function(){$(root,$element).slideUp("fast",function(){$(this).remove()})},timeout)}};VAA_View_Admin_As.item_confirm=function(parent,text){$(parent).find(".vaa-notice").slideUp("fast",function(){$(this).remove()});text='";VAA_View_Admin_As.item_notice(parent,text,"warning",0);return $(parent).find(".vaa-confirm")};VAA_View_Admin_As.popup=function(data,type){type="undefined"===typeof type?"notice":type;var html="";html+='
    ';html+='';html+='
    ';if("object"!==typeof data){data={text:data}}if(data.hasOwnProperty("text")){html+="

    "+String(data.text)+"

    "}if(data.hasOwnProperty("list")){html+="
      ";data.list.forEach(function(item){html+="
    • "+String(item)+"
    • "});html+="
    "}if(data.hasOwnProperty("textarea")){html+='"}html+="
    ";VAA_View_Admin_As.overlay(html);var root="body #vaa-overlay",$overlay=$(root),$overlayContainer=$(root+" .vaa-overlay-container"),$popupResponse=$(root+" .vaa-response-data");$(root+" .vaa-overlay-container .remove").click(function(){$overlay.fadeOut("fast",function(){$(this).remove()})});$document.on("mouseup",function(e){$(root+" .vaa-overlay-container").each(function(){if(!$(this).is(e.target)&&0===$(this).has(e.target).length){$overlay.fadeOut("fast",function(){$(this).remove()})}})});var textarea=$("textarea",$popupResponse);if(textarea.length){textarea.on("click",function(){$(this).select()})}var popupMaxHeight=function(){if(textarea.length){textarea.each(function(){$(this).css({height:"auto","overflow-y":"hidden"}).height(this.scrollHeight)})}var maxHeight=$overlay.height()*.8-24;$overlayContainer.css("max-height",maxHeight);$popupResponse.css("max-height",maxHeight)};popupMaxHeight();$window.on("resize",function(){popupMaxHeight()})};VAA_View_Admin_As.init_settings=function(){var root=VAA_View_Admin_As.root+"-settings",prefix="vaa-settings",root_prefix=VAA_View_Admin_As.prefix+root;$document.on("change",root_prefix+"-admin-menu-location select#"+prefix+"-admin-menu-location",function(e){e.preventDefault();var val=$(this).val();if(val&&""!==val){var view_data={user_setting:{admin_menu_location:val}};VAA_View_Admin_As.ajax(view_data,true)}});$document.on("change",root_prefix+"-view-mode input.radio."+prefix+"-view-mode",function(e){e.preventDefault();var val=$(this).val();if(val&&""!==val){var view_data={user_setting:{view_mode:val}};VAA_View_Admin_As.ajax(view_data,false)}});$document.on("change",root_prefix+"-force-group-users input#"+prefix+"-force-group-users",function(e){e.preventDefault();var view_data={user_setting:{force_group_users:"no"}};if(this.checked){view_data={user_setting:{force_group_users:"yes"}}}VAA_View_Admin_As.ajax(view_data,true)});$document.on("change",root_prefix+"-hide-front input#"+prefix+"-hide-front",function(e){e.preventDefault();var view_data={user_setting:{hide_front:"no"}};if(this.checked){view_data={user_setting:{hide_front:"yes"}}}VAA_View_Admin_As.ajax(view_data,false)});$document.on("change",root_prefix+"-freeze-locale input#"+prefix+"-freeze-locale",function(e){e.preventDefault();var view_data={user_setting:{freeze_locale:"no"}};if(this.checked){view_data={user_setting:{freeze_locale:"yes"}}}var reload=false;if("object"===typeof VAA_View_Admin_As.view&&"undefined"!==typeof VAA_View_Admin_As.view.user){reload=true}VAA_View_Admin_As.ajax(view_data,reload)})};VAA_View_Admin_As.init_users=function(){var root=VAA_View_Admin_As.root+"-users",root_prefix=VAA_View_Admin_As.prefix+root;$document.on("keyup",root_prefix+" .ab-vaa-search.search-users input",function(){$(VAA_View_Admin_As.prefix+" .ab-vaa-search .ab-vaa-results").empty();if(1<=$(this).val().length){var inputText=$(this).val();$(VAA_View_Admin_As.prefix+".vaa-user-item").each(function(){var name=$(".ab-item",this).text();if(-1('+role+")")}}});if(""===$.trim($(VAA_View_Admin_As.prefix+".ab-vaa-search .ab-vaa-results").html())){$(VAA_View_Admin_As.prefix+".ab-vaa-search .ab-vaa-results").append('
    '+VAA_View_Admin_As.__no_users_found+"
    ")}}})};VAA_View_Admin_As.init_caps=function(){var root=VAA_View_Admin_As.root+"-caps",root_prefix=VAA_View_Admin_As.prefix+root;VAA_View_Admin_As.caps_filter_settings={selectedRole:"default",selectedRoleCaps:{},selectedRoleReverse:false,filterString:""};VAA_View_Admin_As.filter_capabilities=function(){var reverse=true===VAA_View_Admin_As.caps_filter_settings.selectedRoleReverse,isDefault="default"===VAA_View_Admin_As.caps_filter_settings.selectedRole,filterString=VAA_View_Admin_As.caps_filter_settings.filterString;$(root_prefix+"-select-options .vaa-cap-item").each(function(){var $this=$(this),exists=$("input",this).attr("value")in VAA_View_Admin_As.caps_filter_settings.selectedRoleCaps,name;$this.hide();if(reverse||exists||isDefault){if(1<=filterString.length){name=$this.text();if(-1 .ab-sub-wrapper").addClass("fullPopup");VAA_View_Admin_As.autoMaxHeight()});$document.on("click",root_prefix+" #close-caps-popup",function(){$(VAA_View_Admin_As.prefix).removeClass("fullPopupActive");$(root_prefix+"-manager > .ab-sub-wrapper").removeClass("fullPopup");VAA_View_Admin_As.autoMaxHeight()});$document.on("change",root_prefix+" .ab-vaa-select.select-role-caps select",function(){VAA_View_Admin_As.caps_filter_settings.selectedRole=$(this).val();if("default"===VAA_View_Admin_As.caps_filter_settings.selectedRole){VAA_View_Admin_As.caps_filter_settings.selectedRoleCaps={};VAA_View_Admin_As.caps_filter_settings.selectedRoleReverse=false}else{var selectedRoleElement=$(root_prefix+'-selectrolecaps #vaa-caps-selectrolecaps option[value="'+VAA_View_Admin_As.caps_filter_settings.selectedRole+'"]');VAA_View_Admin_As.caps_filter_settings.selectedRoleCaps=JSON.parse(selectedRoleElement.attr("data-caps"));VAA_View_Admin_As.caps_filter_settings.selectedRoleReverse=1===parseInt(selectedRoleElement.attr("data-reverse"),10)}VAA_View_Admin_As.filter_capabilities()});$document.on("keyup",root_prefix+" .ab-vaa-filter input",function(){VAA_View_Admin_As.caps_filter_settings.filterString=$(this).val();VAA_View_Admin_As.filter_capabilities()});$document.on("click touchend",root_prefix+" button#select-all-caps",function(e){if(true===VAA_View_Admin_As._touchmove){return}e.preventDefault();$(root_prefix+"-select-options .vaa-cap-item").each(function(){if($(this).is(":visible")){$("input",this).prop("checked",true)}});return false});$document.on("click touchend",root_prefix+" button#deselect-all-caps",function(e){if(true===VAA_View_Admin_As._touchmove){return}e.preventDefault();$(root_prefix+"-select-options .vaa-cap-item").each(function(){if($(this).is(":visible")){$("input",this).prop("checked",false)}});return false});$document.on("click touchend",root_prefix+" button#apply-caps-view",function(e){if(true===VAA_View_Admin_As._touchmove){return}e.preventDefault();var newCaps=VAA_View_Admin_As.get_selected_capabilities();VAA_View_Admin_As.ajax({caps:newCaps},true);return false})};VAA_View_Admin_As.init_module_role_defaults=function(){var root=VAA_View_Admin_As.root+"-modules",prefix="vaa-modules",root_prefix=VAA_View_Admin_As.prefix+root;$document.on("change",root_prefix+"-role-defaults-enable input#"+prefix+"-role-defaults-enable",function(e){e.preventDefault();var view_data={role_defaults:{enable:0}};if(this.checked){view_data={role_defaults:{enable:true}}}VAA_View_Admin_As.ajax(view_data,true)});root=VAA_View_Admin_As.root+"-role-defaults";prefix="vaa-role-defaults";root_prefix=VAA_View_Admin_As.prefix+root;$document.on("change",root_prefix+"-setting-register-enable input#"+prefix+"-setting-register-enable",function(e){e.preventDefault();var view_data={role_defaults:{apply_defaults_on_register:0}};if(this.checked){view_data={role_defaults:{apply_defaults_on_register:true}}}VAA_View_Admin_As.ajax(view_data,false)});$document.on("change",root_prefix+"-setting-disable-user-screen-options input#"+prefix+"-setting-disable-user-screen-options",function(e){e.preventDefault();var view_data={role_defaults:{disable_user_screen_options:0}};if(this.checked){view_data={role_defaults:{disable_user_screen_options:true}}}VAA_View_Admin_As.ajax(view_data,false)});$document.on("change",root_prefix+"-setting-lock-meta-boxes input#"+prefix+"-setting-lock-meta-boxes",function(e){e.preventDefault();var view_data={role_defaults:{lock_meta_boxes:0}};if(this.checked){view_data={role_defaults:{lock_meta_boxes:true}}}VAA_View_Admin_As.ajax(view_data,false)});$document.on("click touchend",root_prefix+"-meta-add button#"+prefix+"-meta-add",function(e){if(true===VAA_View_Admin_As._touchmove){return}e.preventDefault();var val=$(root_prefix+"-meta-add input#"+prefix+"-meta-new").val();var item=$(root_prefix+"-meta-add #"+prefix+"-meta-template").html().toString();val=val.replace(/ /g,"_");item=item.replace(/vaa_new_item/g,val);if($(root_prefix+'-meta-select input[value="'+val+'"]').length){VAA_View_Admin_As.item_notice($(this).parent(),VAA_View_Admin_As.__key_already_exists,"error",2e3)}else{$(root_prefix+"-meta-select > .ab-item").prepend(item)}});$document.on("click touchend",root_prefix+"-meta-apply button#"+prefix+"-meta-apply",function(e){if(true===VAA_View_Admin_As._touchmove){return}e.preventDefault();var val={};$(root_prefix+"-meta-select .ab-item.vaa-item input").each(function(){val[$(this).val()]=$(this).is(":checked")});if(val){var view_data={role_defaults:{update_meta:val}};VAA_View_Admin_As.ajax(view_data,false)}return false});$document.on("keyup",root_prefix+"-bulk-users-filter input#"+prefix+"-bulk-users-filter",function(e){e.preventDefault();if(1<=$(this).val().length){var inputText=$(this).val();$(root_prefix+"-bulk-users-select .ab-item.vaa-item").each(function(){var name=$(".user-name",this).text();if(-1"+err+"","error")}}return false});$document.on("click touchend",root_prefix+"-clear-roles-apply button#"+prefix+"-clear-roles-apply",function(e){if(true===VAA_View_Admin_As._touchmove){return}e.preventDefault();var val=$(root_prefix+"-clear-roles-select select#"+prefix+"-clear-roles-select").val();if(val&&""!==val){var view_data={role_defaults:{clear_role_defaults:val}},confirm=VAA_View_Admin_As.item_confirm($(this).parent(),VAA_View_Admin_As.__confirm);$(confirm).on("click",function(){VAA_View_Admin_As.ajax(view_data,false)})}return false})};VAA_View_Admin_As.init_module_role_manager=function(){var root=VAA_View_Admin_As.root+"-modules",prefix="vaa-modules",root_prefix=VAA_View_Admin_As.prefix+root;$document.on("change",root_prefix+"-role-manager-enable input#"+prefix+"-role-manager-enable",function(e){e.preventDefault();var view_data={role_manager:{enable:0}};if(this.checked){view_data={role_manager:{enable:true}}}VAA_View_Admin_As.ajax(view_data,true)});root=VAA_View_Admin_As.root+"-role-manager";prefix="vaa-role-manager";root_prefix=VAA_View_Admin_As.prefix+root;$document.on("click touchend",root_prefix+"-apply-view-apply button#"+prefix+"-apply-view-apply",function(e){if(true===VAA_View_Admin_As._touchmove){return}e.preventDefault();var role=$(root_prefix+"-apply-view-select select#"+prefix+"-apply-view-select").val();var capabilities=JSON.parse($(this).attr("data-view-caps"));if(role&&""!==role&&capabilities){var view_data={role_manager:{apply_view_to_role:{role:role,capabilities:capabilities}}};VAA_View_Admin_As.ajax(view_data,true)}return false});$document.on("click touchend",root_prefix+"-rename-apply button#"+prefix+"-rename-apply",function(e){if(true===VAA_View_Admin_As._touchmove){return}e.preventDefault();var role=$(root_prefix+"-rename-select select#"+prefix+"-rename-select").val();var new_name=$(root_prefix+"-rename-input input#"+prefix+"-rename-input").val();if(role&&""!==role&&new_name&&""!==new_name){var view_data={role_manager:{rename_role:{role:role,new_name:new_name}}};VAA_View_Admin_As.ajax(view_data,true)}return false});$document.on("click touchend",root_prefix+"-clone-apply button#"+prefix+"-clone-apply",function(e){if(true===VAA_View_Admin_As._touchmove){return}e.preventDefault();var role=$(root_prefix+"-clone-select select#"+prefix+"-clone-select").val();var new_role=$(root_prefix+"-clone-input input#"+prefix+"-clone-input").val();if(role&&""!==role&&new_role&&""!==new_role){var view_data={role_manager:{clone_role:{role:role,new_role:new_role}}};VAA_View_Admin_As.ajax(view_data,true)}return false});$document.on("click touchend",root_prefix+"-delete-apply button#"+prefix+"-delete-apply",function(e){if(true===VAA_View_Admin_As._touchmove){return}e.preventDefault();var val=$(root_prefix+"-delete-select select#"+prefix+"-delete-select").val();if(val&&""!==val){var view_data={role_manager:{delete_role:val}},confirm=VAA_View_Admin_As.item_confirm($(this).parent(),VAA_View_Admin_As.__confirm);$(confirm).on("click",function(){VAA_View_Admin_As.ajax(view_data,true)})}return false});var caps_root=VAA_View_Admin_As.root+"-caps-manager-role-manager",caps_prefix="vaa-caps-manager-role-manager",caps_root_prefix=VAA_View_Admin_As.prefix+caps_root;$document.on("change",caps_root_prefix+" select#"+caps_prefix+"-edit-role",function(){var $this=$(this),role=$this.val(),caps={},selectedRoleElement=$(caps_root_prefix+" select#"+caps_prefix+'-edit-role option[value="'+role+'"]');if(selectedRoleElement.attr("data-caps")){caps=JSON.parse(selectedRoleElement.attr("data-caps"))}VAA_View_Admin_As.caps_filter_settings.selectedRole="default";VAA_View_Admin_As.caps_filter_settings.selectedRoleCaps={};VAA_View_Admin_As.caps_filter_settings.selectedRoleReverse=false;VAA_View_Admin_As.filter_capabilities();VAA_View_Admin_As.set_selected_capabilities(caps)});$document.on("click touchend",caps_root_prefix+" button#"+caps_prefix+"-save-role",function(e){if(true===VAA_View_Admin_As._touchmove){return}e.preventDefault();var role=$(caps_root_prefix+" select#"+caps_prefix+"-edit-role").val(),refresh=false;if(!role){return false}if("__new__"===role){role=$(caps_root_prefix+" input#"+caps_prefix+"-new-role").val();refresh=true}var data={role:role,capabilities:VAA_View_Admin_As.get_selected_capabilities()};VAA_View_Admin_As.ajax({role_manager:{save_role:data}},refresh);return false});$document.on("click touchend",caps_root_prefix+"-new-cap button#"+caps_prefix+"-add-cap",function(e){if(true===VAA_View_Admin_As._touchmove){return}e.preventDefault();var existing=VAA_View_Admin_As.get_selected_capabilities();var val=$(caps_root_prefix+"-new-cap input#"+caps_prefix+"-new-cap").val();var item=$(caps_root_prefix+"-new-cap #"+caps_prefix+"-cap-template").html().toString();val=val.replace(/ /g,"_");item=item.replace(/vaa_new_item/g,val);if("undefined"!==typeof existing[val]){VAA_View_Admin_As.item_notice($(this).parent(),VAA_View_Admin_As.__key_already_exists,"error",2e3)}else{$(VAA_View_Admin_As.root+"-caps-select-options > .ab-item").prepend(item)}})};VAA_View_Admin_As.autoMaxHeight=function(){setTimeout(function(){VAA_View_Admin_As.maxHeightListenerElements.each(function(){var element=$(this),count=0,wait=setInterval(function(){var offset=element.offset(),scrollTop="undefined"!==typeof window.pageYOffset?window.pageYOffset:(document.documentElement||document.body.parentNode||document.body).scrollTop,offsetTop=offset.top-scrollTop;if(element.is(":visible")&&0groupUserRoles ) { // Users grouped under roles. foreach ( $user->roles as $role ) { + if ( ! $admin_bar->get_node( $main_root . '-roles-role-' . $role . '-users' ) ) { + $admin_bar->add_group( array( + 'id' => $main_root . '-roles-role-' . $role . '-users', + 'parent' => $main_root . '-roles-role-' . $role, + 'meta' => array( + 'class' => 'ab-sub-secondary vaa-auto-max-height', + ), + ) ); + } $user_node['id'] .= '-' . $role; - $user_node['parent'] = $main_root . '-roles-role-' . $role; + $user_node['parent'] = $main_root . '-roles-role-' . $role . '-users'; $admin_bar->add_node( $user_node ); } } else { From 9658f0d3bbdc75237fcd0fea35f75c7752aefbab Mon Sep 17 00:00:00 2001 From: JoryHogeveen Date: Mon, 24 Apr 2017 18:38:08 +0200 Subject: [PATCH 43/57] Set minimal group height to the height of a single node --- assets/css/view-admin-as.css | 3 ++- assets/css/view-admin-as.min.css | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/assets/css/view-admin-as.css b/assets/css/view-admin-as.css index fdeb28a0..6e5bc6be 100644 --- a/assets/css/view-admin-as.css +++ b/assets/css/view-admin-as.css @@ -122,8 +122,9 @@ /** * Auto max height + * Min height = height of a single node */ -#wpadminbar #wp-admin-bar-vaa .vaa-auto-max-height {overflow-y: auto; transition: max-height .3s;} +#wpadminbar #wp-admin-bar-vaa .vaa-auto-max-height {min-height: 26px; overflow-y: auto; transition: max-height .3s;} /** * Form elements diff --git a/assets/css/view-admin-as.min.css b/assets/css/view-admin-as.min.css index f47f41cc..a59dbee9 100644 --- a/assets/css/view-admin-as.min.css +++ b/assets/css/view-admin-as.min.css @@ -8,4 +8,4 @@ * @version 1.7.1 * @preserve */ -.vaa-loader-icon{width:40px;height:40px;background:transparent url('../../../../../wp-includes/images/spinner-2x.gif') center center no-repeat;background-size:contain}#vaa-overlay{position:fixed;top:0;left:0;height:100%;width:100%;background:rgba(255,255,255,0.85);display:none;z-index:999999999}#vaa-overlay .vaa-loader-icon{position:fixed;top:50%;left:50%;margin:-20px 0 0 -20px;display:block}#vaa-overlay .vaa-overlay-container{max-width:75%;min-width:50%;max-height:50%;min-height:20px;margin:0 25%;top:10%;background:#fff;box-shadow:0 0 5px #aaa;padding:10px;border-radius:3px;position:relative}#vaa-overlay .vaa-overlay-container>.remove{position:absolute;right:-10px;top:-10px;background:#FFF;width:20px;height:20px;cursor:pointer}#vaa-overlay .vaa-overlay-container .vaa-response-data{overflow:hidden;overflow-y:auto}#vaa-overlay .vaa-overlay-container .vaa-response-data ul li{margin-left:20px;list-style:disc outside}#vaa-overlay .vaa-overlay-container.vaa-message{border:2px solid #0075b3}#vaa-overlay .vaa-overlay-container.vaa-warning{border:2px solid #c8730c}#vaa-overlay .vaa-overlay-container.vaa-error{border:2px solid #dc3232}#vaa-overlay .vaa-overlay-container.vaa-success{border:2px solid #46b450}#wpadminbar .vaa-notice{display:inline-block;padding:0 5px 0 10px;background:#fff}#wpadminbar .vaa-notice.vaa-message,#wpadminbar .vaa-notice.vaa-message .ab-icon:before{color:#0075b3 !important}#wpadminbar .vaa-notice.vaa-warning,#wpadminbar .vaa-notice.vaa-warning .ab-icon:before{color:#c8730c !important}#wpadminbar .vaa-notice.vaa-error,#wpadminbar .vaa-notice.vaa-error .ab-icon:before{color:#dc3232 !important}#wpadminbar .vaa-notice.vaa-success,#wpadminbar .vaa-notice.vaa-success .ab-icon:before{color:#46b450 !important}#wpadminbar #wp-admin-bar-vaa .vaa-notice{display:block;clear:both;margin-bottom:3px}#wpadminbar #wp-admin-bar-vaa .vaa-notice button{vertical-align:baseline;margin:0 0 0 -5px;padding:1px 10px}#wpadminbar .vaa-notice .remove,#wpadminbar #wp-admin-bar-vaa .remove{cursor:pointer;top:2px;float:right;margin-right:0;margin-left:6px}#wpadminbar #wp-admin-bar-vaa ul li,#wpadminbar #wp-admin-bar-vaa .ab-item{clear:both}#wpadminbar #wp-admin-bar-vaa .ab-sub-wrapper .ab-item>span{line-height:26px}#wpadminbar #wp-admin-bar-vaa .ab-item>span.remove{font-size:16px;line-height:16px;top:1px}#wpadminbar #wp-admin-bar-vaa .ab-bold>.ab-item,#wpadminbar #wp-admin-bar-vaa .ab-bold>.ab-item *{font-weight:bold !important}#wpadminbar #wp-admin-bar-vaa .ab-italic>.ab-item,#wpadminbar #wp-admin-bar-vaa .ab-italic>.ab-item *{font-style:italic !important}#wpadminbar #wp-admin-bar-vaa .vaa-sub-transparent>*{opacity:.5;transition:opacity .2s}#wpadminbar #wp-admin-bar-vaa .vaa-sub-transparent:hover>*{opacity:1}#wpadminbar #wp-admin-bar-vaa .ab-vaa-results{margin:6px 0;padding:0}#wpadminbar #wp-admin-bar-vaa .ab-vaa-results:empty{display:none}#wpadminbar #wp-admin-bar-vaa .ab-vaa-spacing-top,#wpadminbar #wp-admin-bar-vaa>div>ul.ab-sub-secondary+ul.ab-sub-secondary{margin-top:3px}#wpadminbar #wp-admin-bar-vaa .ab-sub-wrapper .ab-sub-wrapper ul.ab-sub-secondary+ul.ab-sub-secondary{padding-top:0}#wpadminbar #wp-admin-bar-vaa .auto-height>.ab-item{height:auto}#wpadminbar #wp-admin-bar-vaa .ab-item .description{height:auto;line-height:1.2;font-size:.8em;font-style:italic;margin-bottom:7px;white-space:normal}#wpadminbar #wp-admin-bar-vaa .ab-item .description:first-child{margin-bottom:0}#wpadminbar #wp-admin-bar-vaa.menupop .ab-vaa-title .ab-item{font-weight:bold;line-height:26px;font-size:1.1em;text-transform:uppercase}#wpadminbar #wp-admin-bar-vaa .current>.ab-item,#wpadminbar #wp-admin-bar-vaa .current>.ab-item .vaa-view-data,#wpadminbar #wp-admin-bar-vaa .current>input:checked+label,#wpadminbar #wp-admin-bar-vaa .current-parent>.ab-item,#wpadminbar #wp-admin-bar-vaa .current-parent>.ab-item .vaa-view-data,#wpadminbar #wp-admin-bar-vaa .current-parent>label{font-weight:bold}#wpadminbar #wp-admin-bar-vaa .current>.ab-item::after,#wpadminbar #wp-admin-bar-vaa .current>label::after{content:'\f177';font-family:'dashicons';margin:0 5px;font-size:17px;vertical-align:middle;font-weight:normal}#wpadminbar #wp-admin-bar-vaa>.ab-item>.ab-label{float:left}#wpadminbar #wp-admin-bar-vaa>.ab-item>.ab-icon{float:right;margin-right:0;margin-left:6px;top:2px}#wpadminbar #wp-admin-bar-vaa .vaa-has-icon>.ab-item>.ab-icon{float:none;font-size:16px;line-height:16px;vertical-align:text-bottom;font-weight:normal !important;padding:0}#wpadminbar #wp-admin-bar-vaa .vaa-has-icon>.ab-item::before{display:none}#wpadminbar #wp-admin-bar-vaa .vaa-has-icon.menupop>.ab-item{padding-left:10px;padding-right:10px}#wpadminbar #wp-admin-bar-vaa .vaa-has-icon.ab-vaa-title>.ab-item>.ab-icon{font-size:18px;line-height:20px;margin:0 5px 0 -1px}#wpadminbar .ab-top-secondary .menupop .vaa-menupop>.ab-item{padding-left:2em;padding-right:1em}#wpadminbar .ab-top-secondary .menupop .vaa-menupop>.ab-item .ab-icon{margin-left:-20px;margin-right:4px}#wpadminbar #wp-admin-bar-vaa.menupop ul.ab-sub-secondary{position:static}#wpadminbar #wp-admin-bar-vaa.menupop .menupop>.ab-item:before{top:1px}#wpadminbar #wp-admin-bar-vaa button>.ab-icon{margin:0 5px 0 -5px;padding:0;top:0}#wpadminbar #wp-admin-bar-vaa .ab-item>label+button{margin:0 0 0 12px;vertical-align:baseline}#wpadminbar #wp-admin-bar-vaa .vaa-button-container>.ab-item{overflow:hidden;height:auto}#wpadminbar #wp-admin-bar-vaa button{float:none;text-decoration:none;font-size:13px;line-height:20px;height:20px;margin:3px 0;padding:0 10px 1px;vertical-align:middle;cursor:pointer}#wpadminbar #wp-admin-bar-vaa .vaa-icon{padding:0 2px 1px}#wpadminbar #wp-admin-bar-vaa .vaa-icon .ab-icon{margin:0}#wpadminbar #wp-admin-bar-vaa button.vaa-icon .ab-icon{padding:0}#wpadminbar #wp-admin-bar-vaa .vaa-auto-max-height{overflow-y:auto;transition:max-height .3s}#wpadminbar #wp-admin-bar-vaa .ab-vaa-multipleselect .ab-item,#wpadminbar #wp-admin-bar-vaa .ab-vaa-input .ab-item,#wpadminbar #wp-admin-bar-vaa .ab-vaa-search .ab-item,#wpadminbar #wp-admin-bar-vaa .ab-vaa-filter .ab-item,#wpadminbar #wp-admin-bar-vaa .ab-vaa-select .ab-item{height:auto;clear:both}#wpadminbar #wp-admin-bar-vaa .ab-vaa-input .ab-item input,#wpadminbar #wp-admin-bar-vaa .ab-vaa-search .ab-item input,#wpadminbar #wp-admin-bar-vaa .ab-vaa-filter .ab-item input,#wpadminbar #wp-admin-bar-vaa .ab-vaa-select .ab-item select{display:inline-block;background:#fff;color:#555;margin:5px 0;padding:3px;border:0;line-height:normal;height:auto;width:100%;box-sizing:border-box}#wpadminbar #wp-admin-bar-vaa .ab-vaa-select .ab-item select{padding:2px 3px}#wpadminbar #wp-admin-bar-vaa .ab-vaa-select .ab-item label+input,#wpadminbar #wp-admin-bar-vaa .ab-vaa-select .ab-item label+select{margin-top:0}#wpadminbar #wp-admin-bar-vaa .ab-vaa-textarea .ab-item{height:auto;line-height:normal}#wpadminbar #wp-admin-bar-vaa .ab-vaa-textarea .ab-item textarea{width:100%;padding:5px;margin-top:5px;box-sizing:border-box;line-height:normal}#wpadminbar #wp-admin-bar-vaa .ab-item select+button.input-overlay,#wpadminbar #wp-admin-bar-vaa .ab-item input+button.input-overlay{position:absolute;right:10px;margin:5px 0}#wpadminbar #wp-admin-bar-vaa input.checkbox,#wpadminbar #wp-admin-bar-vaa input.radio{display:inline-block;height:16px;width:16px;vertical-align:text-bottom;box-sizing:border-box;cursor:pointer}#wpadminbar #wp-admin-bar-vaa .ab-item input.checkbox,#wpadminbar #wp-admin-bar-vaa .ab-item input.radio{margin:0 5px 0 0}#wpadminbar #wp-admin-bar-vaa .ab-item input.checkbox+label,#wpadminbar #wp-admin-bar-vaa .ab-item input.checkbox+label *,#wpadminbar #wp-admin-bar-vaa .ab-item input.radio+label,#wpadminbar #wp-admin-bar-vaa .ab-item input.radio+label *{line-height:18px;vertical-align:text-top;display:inline}#wpadminbar #wp-admin-bar-vaa .ab-item input.checkbox+label:hover,#wpadminbar #wp-admin-bar-vaa .ab-item input.radio+label:hover{cursor:pointer}#wpadminbar #wp-admin-bar-vaa .ab-item input.checkbox:first-child,#wpadminbar #wp-admin-bar-vaa .ab-item input.radio:first-child{margin:0 6px 0 0}#wpadminbar #wp-admin-bar-vaa .ab-item input.radio{border-radius:100%}#wpadminbar #wp-admin-bar-vaa .ab-item input.radio+label+br{line-height:0}#wpadminbar #wp-admin-bar-vaa input.checkbox.vaa-right,#wpadminbar #wp-admin-bar-vaa input.radio.vaa-right{position:absolute;top:5px;right:1em;z-index:99}#wpadminbar #wp-admin-bar-vaa .ab-vaa-multipleselect{max-height:400px;min-width:250px;overflow:hidden;overflow-y:auto;margin:6px 0;padding:0;border:solid transparent;border-width:0 10px}#wpadminbar #wp-admin-bar-vaa .ab-vaa-multipleselect .ab-empty-item{height:auto;overflow:hidden;margin:0;padding:5px 10px;background-color:#fff}#wpadminbar #wp-admin-bar-vaa .ab-vaa-multipleselect .ab-empty-item .ab-item{color:#333}#wpadminbar #wp-admin-bar-vaa .ab-vaa-multipleselect.vaa-small{max-height:100px}#wpadminbar #wp-admin-bar-vaa .ab-vaa-multipleselect .remove:before{color:#333}#wpadminbar #wp-admin-bar-vaa .vaa-column-one-half{width:50%;display:block;float:left;clear:none}#wpadminbar #wp-admin-bar-vaa .vaa-column-one-half .ab-item{min-width:0}#wpadminbar #wp-admin-bar-vaa .vaa-column-one-half.vaa-column-first .ab-item{padding-right:1px}#wpadminbar #wp-admin-bar-vaa .vaa-column-one-half.vaa-column-last .ab-item{padding-left:1px}#wpadminbar #wp-admin-bar-vaa .vaa-clear-float{clear:both}#wpadminbar #wp-admin-bar-vaa .ab-vaa-toggle .ab-item{padding-right:34px}#wpadminbar #wp-admin-bar-vaa .ab-vaa-toggle .ab-item:hover{cursor:pointer}#wpadminbar #wp-admin-bar-vaa .ab-vaa-toggle .ab-item::after{content:"\f140";font-family:'dashicons';position:absolute;right:10px;margin:0;font-size:20px;font-weight:normal}#wpadminbar #wp-admin-bar-vaa .ab-vaa-toggle.active .ab-item::after{content:"\f142"}#wpadminbar #wp-admin-bar-vaa.fullPopupActive .ab-sub-wrapper,#wpadminbar #wp-admin-bar-vaa.fullPopupActive .ab-sub-wrapper .ab-item{display:none}#wpadminbar #wp-admin-bar-vaa.fullPopupActive>.ab-sub-wrapper{display:block}#wpadminbar #wp-admin-bar-vaa.fullPopupActive>.ab-sub-wrapper>.ab-submenu{padding:0}#wpadminbar #wp-admin-bar-vaa.fullPopupActive .ab-sub-wrapper.fullPopup{position:fixed;display:block;visibility:visible;overflow:hidden;z-index:999;max-height:90%;width:90%;margin:5%;top:0;left:0;box-shadow:0 0 50px rgba(0,0,0,0.3)}#wpadminbar #wp-admin-bar-vaa.fullPopupActive .ab-sub-wrapper.fullPopup .ab-item{display:block}#wpadminbar #wp-admin-bar-vaa #wp-admin-bar-vaa-caps #apply-caps-view{float:left;margin-right:5px}#wpadminbar #wp-admin-bar-vaa #wp-admin-bar-vaa-caps #reset-caps-view,#wpadminbar #wp-admin-bar-vaa #wp-admin-bar-vaa-caps #open-caps-popup,#wpadminbar #wp-admin-bar-vaa #wp-admin-bar-vaa-caps #close-caps-popup{float:right;margin-left:5px;height:auto}#wpadminbar #wp-admin-bar-vaa #wp-admin-bar-vaa-caps #close-caps-popup{display:none}#wpadminbar #wp-admin-bar-vaa.fullPopupActive #wp-admin-bar-vaa-caps .ab-sub-wrapper.fullPopup #close-caps-popup{display:block}#wpadminbar #wp-admin-bar-vaa.fullPopupActive #wp-admin-bar-vaa-caps .ab-sub-wrapper.fullPopup #open-caps-popup{display:none}#wpadminbar #wp-admin-bar-vaa.fullPopupActive #wp-admin-bar-vaa-caps .ab-sub-wrapper.fullPopup #wp-admin-bar-vaa-caps-select-options .vaa-cap-item{width:250px;float:left;clear:none}#wpadminbar #wp-admin-bar-vaa #wp-admin-bar-vaa-caps-popup:hover{cursor:pointer}#wpadminbar #wp-admin-bar-my-account #wp-admin-bar-vaa>.ab-item>.ab-label{line-height:26px}#wpadminbar #wp-admin-bar-my-account #wp-admin-bar-vaa>.ab-item>.ab-icon{top:0}#vaa_toolbar #wpadminbar{position:fixed !important;width:auto;min-width:0;right:0;left:auto;border-radius:0 0 0 5px}#vaa_toolbar #wpadminbar #wp-admin-bar-vaa>.ab-item .ab-icon{margin-left:0}#vaa_toolbar #wpadminbar #wp-admin-bar-vaa>.ab-item .ab-label{display:none}#vaa_toolbar #wpadminbar #wp-admin-bar-vaa:hover>.ab-item .ab-icon{margin-left:6px}#vaa_toolbar #wpadminbar #wp-admin-bar-vaa:hover>.ab-item .ab-label{display:inline-block}@media screen and (max-width:782px){#wpadminbar #wp-admin-bar-vaa{display:block;position:static}#wpadminbar #wp-admin-bar-vaa>.ab-item>.ab-icon{margin-left:0}#wpadminbar #wp-admin-bar-vaa .ab-sub-wrapper{width:100%}#wpadminbar #wp-admin-bar-vaa .ab-sub-wrapper .ab-sub-wrapper{position:static;top:auto;margin:0;-webkit-box-shadow:none;-moz-box-shadow:none;box-shadow:none}#wpadminbar #wp-admin-bar-vaa.menupop .menupop>.ab-item:before{content:''}#wpadminbar #wp-admin-bar-vaa .ab-item .vaa-hide-responsive{display:none}#wpadminbar #wp-admin-bar-vaa .vaa-notice{line-height:42px;font-size:16px}#wpadminbar #wp-admin-bar-vaa .vaa-notice .ab-icon{height:auto}#wpadminbar #wp-admin-bar-vaa>div>ul,#wpadminbar #wp-admin-bar-vaa .menupop>.ab-sub-wrapper .ab-submenu{padding:5px 0}#wpadminbar #wp-admin-bar-vaa .menupop>.ab-sub-wrapper .ab-item{padding:8px 44px;white-space:normal;height:auto}#wpadminbar #wp-admin-bar-vaa .menupop>.ab-sub-wrapper .ab-item>.ab-item{padding:8px 0}#wpadminbar #wp-admin-bar-vaa .menupop>.ab-sub-wrapper:last-child .ab-item.description{margin-bottom:0}#wpadminbar #wp-admin-bar-vaa .ab-item>span.remove,#wpadminbar #wp-admin-bar-vaa .vaa-has-icon .ab-item .ab-icon{width:auto;height:auto;font-size:22px !important;margin-right:10px;vertical-align:text-top}#wpadminbar #wp-admin-bar-vaa .ab-vaa-title.vaa-has-icon>.ab-item>.ab-icon{font-size:30px !important;margin-left:-6px;margin-top:-1px;vertical-align:top}#wpadminbar #wp-admin-bar-vaa .vaa-has-icon.menupop>.ab-item{padding-left:12px;padding-right:12px}#wpadminbar #wp-admin-bar-vaa .vaa-menupop div li{margin-left:12px}#wpadminbar #wp-admin-bar-vaa .ab-sub-wrapper .vaa-role-item.menupop>.ab-item{padding-left:15px}#wpadminbar #wp-admin-bar-vaa .ab-vaa-toggle .ab-item::after,#wpadminbar #wp-admin-bar-vaa .ab-sub-wrapper .vaa-menupop.menupop>.ab-item:after{content:"\f140";font-family:'dashicons';position:absolute;right:10px;top:8px;margin:0;font-size:30px;font-weight:normal}#wpadminbar #wp-admin-bar-vaa .ab-vaa-toggle.active .ab-item::after,#wpadminbar #wp-admin-bar-vaa .ab-sub-wrapper .vaa-menupop.menupop.active>.ab-item:after{content:"\f142"}#wpadminbar #wp-admin-bar-vaa button{font-size:16px;padding:5px 15px}#wpadminbar #wp-admin-bar-vaa .ab-vaa-input .ab-item input,#wpadminbar #wp-admin-bar-vaa .ab-vaa-search .ab-item input,#wpadminbar #wp-admin-bar-vaa .ab-vaa-filter .ab-item input{padding:8px 12px}#wpadminbar #wp-admin-bar-vaa .ab-vaa-select .ab-item select{padding:7px 12px}#wpadminbar #wp-admin-bar-vaa .ab-item select+button.input-overlay,#wpadminbar #wp-admin-bar-vaa .ab-item input+button.input-overlay{right:44px;padding:6px 10px 7px;font-size:14px}#wpadminbar #wp-admin-bar-vaa .ab-vaa-multipleselect{border-width:0 44px;max-height:300px !important}#wpadminbar #wp-admin-bar-vaa .menupop>.ab-sub-wrapper .ab-vaa-multipleselect>.ab-item{padding:8px 16px}#wpadminbar #wp-admin-bar-vaa input.checkbox,#wpadminbar #wp-admin-bar-vaa input.radio{width:24px;height:24px}#wpadminbar #wp-admin-bar-vaa input.checkbox.vaa-right,#wpadminbar #wp-admin-bar-vaa input.radio.vaa-right{top:9px;right:11px}} \ No newline at end of file +.vaa-loader-icon{width:40px;height:40px;background:transparent url('../../../../../wp-includes/images/spinner-2x.gif') center center no-repeat;background-size:contain}#vaa-overlay{position:fixed;top:0;left:0;height:100%;width:100%;background:rgba(255,255,255,0.85);display:none;z-index:999999999}#vaa-overlay .vaa-loader-icon{position:fixed;top:50%;left:50%;margin:-20px 0 0 -20px;display:block}#vaa-overlay .vaa-overlay-container{max-width:75%;min-width:50%;max-height:50%;min-height:20px;margin:0 25%;top:10%;background:#fff;box-shadow:0 0 5px #aaa;padding:10px;border-radius:3px;position:relative}#vaa-overlay .vaa-overlay-container>.remove{position:absolute;right:-10px;top:-10px;background:#FFF;width:20px;height:20px;cursor:pointer}#vaa-overlay .vaa-overlay-container .vaa-response-data{overflow:hidden;overflow-y:auto}#vaa-overlay .vaa-overlay-container .vaa-response-data ul li{margin-left:20px;list-style:disc outside}#vaa-overlay .vaa-overlay-container.vaa-message{border:2px solid #0075b3}#vaa-overlay .vaa-overlay-container.vaa-warning{border:2px solid #c8730c}#vaa-overlay .vaa-overlay-container.vaa-error{border:2px solid #dc3232}#vaa-overlay .vaa-overlay-container.vaa-success{border:2px solid #46b450}#wpadminbar .vaa-notice{display:inline-block;padding:0 5px 0 10px;background:#fff}#wpadminbar .vaa-notice.vaa-message,#wpadminbar .vaa-notice.vaa-message .ab-icon:before{color:#0075b3 !important}#wpadminbar .vaa-notice.vaa-warning,#wpadminbar .vaa-notice.vaa-warning .ab-icon:before{color:#c8730c !important}#wpadminbar .vaa-notice.vaa-error,#wpadminbar .vaa-notice.vaa-error .ab-icon:before{color:#dc3232 !important}#wpadminbar .vaa-notice.vaa-success,#wpadminbar .vaa-notice.vaa-success .ab-icon:before{color:#46b450 !important}#wpadminbar #wp-admin-bar-vaa .vaa-notice{display:block;clear:both;margin-bottom:3px}#wpadminbar #wp-admin-bar-vaa .vaa-notice button{vertical-align:baseline;margin:0 0 0 -5px;padding:1px 10px}#wpadminbar .vaa-notice .remove,#wpadminbar #wp-admin-bar-vaa .remove{cursor:pointer;top:2px;float:right;margin-right:0;margin-left:6px}#wpadminbar #wp-admin-bar-vaa ul li,#wpadminbar #wp-admin-bar-vaa .ab-item{clear:both}#wpadminbar #wp-admin-bar-vaa .ab-sub-wrapper .ab-item>span{line-height:26px}#wpadminbar #wp-admin-bar-vaa .ab-item>span.remove{font-size:16px;line-height:16px;top:1px}#wpadminbar #wp-admin-bar-vaa .ab-bold>.ab-item,#wpadminbar #wp-admin-bar-vaa .ab-bold>.ab-item *{font-weight:bold !important}#wpadminbar #wp-admin-bar-vaa .ab-italic>.ab-item,#wpadminbar #wp-admin-bar-vaa .ab-italic>.ab-item *{font-style:italic !important}#wpadminbar #wp-admin-bar-vaa .vaa-sub-transparent>*{opacity:.5;transition:opacity .2s}#wpadminbar #wp-admin-bar-vaa .vaa-sub-transparent:hover>*{opacity:1}#wpadminbar #wp-admin-bar-vaa .ab-vaa-results{margin:6px 0;padding:0}#wpadminbar #wp-admin-bar-vaa .ab-vaa-results:empty{display:none}#wpadminbar #wp-admin-bar-vaa .ab-vaa-spacing-top,#wpadminbar #wp-admin-bar-vaa>div>ul.ab-sub-secondary+ul.ab-sub-secondary{margin-top:3px}#wpadminbar #wp-admin-bar-vaa .ab-sub-wrapper .ab-sub-wrapper ul.ab-sub-secondary+ul.ab-sub-secondary{padding-top:0}#wpadminbar #wp-admin-bar-vaa .auto-height>.ab-item{height:auto}#wpadminbar #wp-admin-bar-vaa .ab-item .description{height:auto;line-height:1.2;font-size:.8em;font-style:italic;margin-bottom:7px;white-space:normal}#wpadminbar #wp-admin-bar-vaa .ab-item .description:first-child{margin-bottom:0}#wpadminbar #wp-admin-bar-vaa.menupop .ab-vaa-title .ab-item{font-weight:bold;line-height:26px;font-size:1.1em;text-transform:uppercase}#wpadminbar #wp-admin-bar-vaa .current>.ab-item,#wpadminbar #wp-admin-bar-vaa .current>.ab-item .vaa-view-data,#wpadminbar #wp-admin-bar-vaa .current>input:checked+label,#wpadminbar #wp-admin-bar-vaa .current-parent>.ab-item,#wpadminbar #wp-admin-bar-vaa .current-parent>.ab-item .vaa-view-data,#wpadminbar #wp-admin-bar-vaa .current-parent>label{font-weight:bold}#wpadminbar #wp-admin-bar-vaa .current>.ab-item::after,#wpadminbar #wp-admin-bar-vaa .current>label::after{content:'\f177';font-family:'dashicons';margin:0 5px;font-size:17px;vertical-align:middle;font-weight:normal}#wpadminbar #wp-admin-bar-vaa>.ab-item>.ab-label{float:left}#wpadminbar #wp-admin-bar-vaa>.ab-item>.ab-icon{float:right;margin-right:0;margin-left:6px;top:2px}#wpadminbar #wp-admin-bar-vaa .vaa-has-icon>.ab-item>.ab-icon{float:none;font-size:16px;line-height:16px;vertical-align:text-bottom;font-weight:normal !important;padding:0}#wpadminbar #wp-admin-bar-vaa .vaa-has-icon>.ab-item::before{display:none}#wpadminbar #wp-admin-bar-vaa .vaa-has-icon.menupop>.ab-item{padding-left:10px;padding-right:10px}#wpadminbar #wp-admin-bar-vaa .vaa-has-icon.ab-vaa-title>.ab-item>.ab-icon{font-size:18px;line-height:20px;margin:0 5px 0 -1px}#wpadminbar .ab-top-secondary .menupop .vaa-menupop>.ab-item{padding-left:2em;padding-right:1em}#wpadminbar .ab-top-secondary .menupop .vaa-menupop>.ab-item .ab-icon{margin-left:-20px;margin-right:4px}#wpadminbar #wp-admin-bar-vaa.menupop ul.ab-sub-secondary{position:static}#wpadminbar #wp-admin-bar-vaa.menupop .menupop>.ab-item:before{top:1px}#wpadminbar #wp-admin-bar-vaa button>.ab-icon{margin:0 5px 0 -5px;padding:0;top:0}#wpadminbar #wp-admin-bar-vaa .ab-item>label+button{margin:0 0 0 12px;vertical-align:baseline}#wpadminbar #wp-admin-bar-vaa .vaa-button-container>.ab-item{overflow:hidden;height:auto}#wpadminbar #wp-admin-bar-vaa button{float:none;text-decoration:none;font-size:13px;line-height:20px;height:20px;margin:3px 0;padding:0 10px 1px;vertical-align:middle;cursor:pointer}#wpadminbar #wp-admin-bar-vaa .vaa-icon{padding:0 2px 1px}#wpadminbar #wp-admin-bar-vaa .vaa-icon .ab-icon{margin:0}#wpadminbar #wp-admin-bar-vaa button.vaa-icon .ab-icon{padding:0}#wpadminbar #wp-admin-bar-vaa .vaa-auto-max-height{min-height:26px;overflow-y:auto;transition:max-height .3s}#wpadminbar #wp-admin-bar-vaa .ab-vaa-multipleselect .ab-item,#wpadminbar #wp-admin-bar-vaa .ab-vaa-input .ab-item,#wpadminbar #wp-admin-bar-vaa .ab-vaa-search .ab-item,#wpadminbar #wp-admin-bar-vaa .ab-vaa-filter .ab-item,#wpadminbar #wp-admin-bar-vaa .ab-vaa-select .ab-item{height:auto;clear:both}#wpadminbar #wp-admin-bar-vaa .ab-vaa-input .ab-item input,#wpadminbar #wp-admin-bar-vaa .ab-vaa-search .ab-item input,#wpadminbar #wp-admin-bar-vaa .ab-vaa-filter .ab-item input,#wpadminbar #wp-admin-bar-vaa .ab-vaa-select .ab-item select{display:inline-block;background:#fff;color:#555;margin:5px 0;padding:3px;border:0;line-height:normal;height:auto;width:100%;box-sizing:border-box}#wpadminbar #wp-admin-bar-vaa .ab-vaa-select .ab-item select{padding:2px 3px}#wpadminbar #wp-admin-bar-vaa .ab-vaa-select .ab-item label+input,#wpadminbar #wp-admin-bar-vaa .ab-vaa-select .ab-item label+select{margin-top:0}#wpadminbar #wp-admin-bar-vaa .ab-vaa-textarea .ab-item{height:auto;line-height:normal}#wpadminbar #wp-admin-bar-vaa .ab-vaa-textarea .ab-item textarea{width:100%;padding:5px;margin-top:5px;box-sizing:border-box;line-height:normal}#wpadminbar #wp-admin-bar-vaa .ab-item select+button.input-overlay,#wpadminbar #wp-admin-bar-vaa .ab-item input+button.input-overlay{position:absolute;right:10px;margin:5px 0}#wpadminbar #wp-admin-bar-vaa input.checkbox,#wpadminbar #wp-admin-bar-vaa input.radio{display:inline-block;height:16px;width:16px;vertical-align:text-bottom;box-sizing:border-box;cursor:pointer}#wpadminbar #wp-admin-bar-vaa .ab-item input.checkbox,#wpadminbar #wp-admin-bar-vaa .ab-item input.radio{margin:0 5px 0 0}#wpadminbar #wp-admin-bar-vaa .ab-item input.checkbox+label,#wpadminbar #wp-admin-bar-vaa .ab-item input.checkbox+label *,#wpadminbar #wp-admin-bar-vaa .ab-item input.radio+label,#wpadminbar #wp-admin-bar-vaa .ab-item input.radio+label *{line-height:18px;vertical-align:text-top;display:inline}#wpadminbar #wp-admin-bar-vaa .ab-item input.checkbox+label:hover,#wpadminbar #wp-admin-bar-vaa .ab-item input.radio+label:hover{cursor:pointer}#wpadminbar #wp-admin-bar-vaa .ab-item input.checkbox:first-child,#wpadminbar #wp-admin-bar-vaa .ab-item input.radio:first-child{margin:0 6px 0 0}#wpadminbar #wp-admin-bar-vaa .ab-item input.radio{border-radius:100%}#wpadminbar #wp-admin-bar-vaa .ab-item input.radio+label+br{line-height:0}#wpadminbar #wp-admin-bar-vaa input.checkbox.vaa-right,#wpadminbar #wp-admin-bar-vaa input.radio.vaa-right{position:absolute;top:5px;right:1em;z-index:99}#wpadminbar #wp-admin-bar-vaa .ab-vaa-multipleselect{max-height:400px;min-width:250px;overflow:hidden;overflow-y:auto;margin:6px 0;padding:0;border:solid transparent;border-width:0 10px}#wpadminbar #wp-admin-bar-vaa .ab-vaa-multipleselect .ab-empty-item{height:auto;overflow:hidden;margin:0;padding:5px 10px;background-color:#fff}#wpadminbar #wp-admin-bar-vaa .ab-vaa-multipleselect .ab-empty-item .ab-item{color:#333}#wpadminbar #wp-admin-bar-vaa .ab-vaa-multipleselect.vaa-small{max-height:100px}#wpadminbar #wp-admin-bar-vaa .ab-vaa-multipleselect .remove:before{color:#333}#wpadminbar #wp-admin-bar-vaa .vaa-column-one-half{width:50%;display:block;float:left;clear:none}#wpadminbar #wp-admin-bar-vaa .vaa-column-one-half .ab-item{min-width:0}#wpadminbar #wp-admin-bar-vaa .vaa-column-one-half.vaa-column-first .ab-item{padding-right:1px}#wpadminbar #wp-admin-bar-vaa .vaa-column-one-half.vaa-column-last .ab-item{padding-left:1px}#wpadminbar #wp-admin-bar-vaa .vaa-clear-float{clear:both}#wpadminbar #wp-admin-bar-vaa .ab-vaa-toggle .ab-item{padding-right:34px}#wpadminbar #wp-admin-bar-vaa .ab-vaa-toggle .ab-item:hover{cursor:pointer}#wpadminbar #wp-admin-bar-vaa .ab-vaa-toggle .ab-item::after{content:"\f140";font-family:'dashicons';position:absolute;right:10px;margin:0;font-size:20px;font-weight:normal}#wpadminbar #wp-admin-bar-vaa .ab-vaa-toggle.active .ab-item::after{content:"\f142"}#wpadminbar #wp-admin-bar-vaa.fullPopupActive .ab-sub-wrapper,#wpadminbar #wp-admin-bar-vaa.fullPopupActive .ab-sub-wrapper .ab-item{display:none}#wpadminbar #wp-admin-bar-vaa.fullPopupActive>.ab-sub-wrapper{display:block}#wpadminbar #wp-admin-bar-vaa.fullPopupActive>.ab-sub-wrapper>.ab-submenu{padding:0}#wpadminbar #wp-admin-bar-vaa.fullPopupActive .ab-sub-wrapper.fullPopup{position:fixed;display:block;visibility:visible;overflow:hidden;z-index:999;max-height:90%;width:90%;margin:5%;top:0;left:0;box-shadow:0 0 50px rgba(0,0,0,0.3)}#wpadminbar #wp-admin-bar-vaa.fullPopupActive .ab-sub-wrapper.fullPopup .ab-item{display:block}#wpadminbar #wp-admin-bar-vaa #wp-admin-bar-vaa-caps #apply-caps-view{float:left;margin-right:5px}#wpadminbar #wp-admin-bar-vaa #wp-admin-bar-vaa-caps #reset-caps-view,#wpadminbar #wp-admin-bar-vaa #wp-admin-bar-vaa-caps #open-caps-popup,#wpadminbar #wp-admin-bar-vaa #wp-admin-bar-vaa-caps #close-caps-popup{float:right;margin-left:5px;height:auto}#wpadminbar #wp-admin-bar-vaa #wp-admin-bar-vaa-caps #close-caps-popup{display:none}#wpadminbar #wp-admin-bar-vaa.fullPopupActive #wp-admin-bar-vaa-caps .ab-sub-wrapper.fullPopup #close-caps-popup{display:block}#wpadminbar #wp-admin-bar-vaa.fullPopupActive #wp-admin-bar-vaa-caps .ab-sub-wrapper.fullPopup #open-caps-popup{display:none}#wpadminbar #wp-admin-bar-vaa.fullPopupActive #wp-admin-bar-vaa-caps .ab-sub-wrapper.fullPopup #wp-admin-bar-vaa-caps-select-options .vaa-cap-item{width:250px;float:left;clear:none}#wpadminbar #wp-admin-bar-vaa #wp-admin-bar-vaa-caps-popup:hover{cursor:pointer}#wpadminbar #wp-admin-bar-my-account #wp-admin-bar-vaa>.ab-item>.ab-label{line-height:26px}#wpadminbar #wp-admin-bar-my-account #wp-admin-bar-vaa>.ab-item>.ab-icon{top:0}#vaa_toolbar #wpadminbar{position:fixed !important;width:auto;min-width:0;right:0;left:auto;border-radius:0 0 0 5px}#vaa_toolbar #wpadminbar #wp-admin-bar-vaa>.ab-item .ab-icon{margin-left:0}#vaa_toolbar #wpadminbar #wp-admin-bar-vaa>.ab-item .ab-label{display:none}#vaa_toolbar #wpadminbar #wp-admin-bar-vaa:hover>.ab-item .ab-icon{margin-left:6px}#vaa_toolbar #wpadminbar #wp-admin-bar-vaa:hover>.ab-item .ab-label{display:inline-block}@media screen and (max-width:782px){#wpadminbar #wp-admin-bar-vaa{display:block;position:static}#wpadminbar #wp-admin-bar-vaa>.ab-item>.ab-icon{margin-left:0}#wpadminbar #wp-admin-bar-vaa .ab-sub-wrapper{width:100%}#wpadminbar #wp-admin-bar-vaa .ab-sub-wrapper .ab-sub-wrapper{position:static;top:auto;margin:0;-webkit-box-shadow:none;-moz-box-shadow:none;box-shadow:none}#wpadminbar #wp-admin-bar-vaa.menupop .menupop>.ab-item:before{content:''}#wpadminbar #wp-admin-bar-vaa .ab-item .vaa-hide-responsive{display:none}#wpadminbar #wp-admin-bar-vaa .vaa-notice{line-height:42px;font-size:16px}#wpadminbar #wp-admin-bar-vaa .vaa-notice .ab-icon{height:auto}#wpadminbar #wp-admin-bar-vaa>div>ul,#wpadminbar #wp-admin-bar-vaa .menupop>.ab-sub-wrapper .ab-submenu{padding:5px 0}#wpadminbar #wp-admin-bar-vaa .menupop>.ab-sub-wrapper .ab-item{padding:8px 44px;white-space:normal;height:auto}#wpadminbar #wp-admin-bar-vaa .menupop>.ab-sub-wrapper .ab-item>.ab-item{padding:8px 0}#wpadminbar #wp-admin-bar-vaa .menupop>.ab-sub-wrapper:last-child .ab-item.description{margin-bottom:0}#wpadminbar #wp-admin-bar-vaa .ab-item>span.remove,#wpadminbar #wp-admin-bar-vaa .vaa-has-icon .ab-item .ab-icon{width:auto;height:auto;font-size:22px !important;margin-right:10px;vertical-align:text-top}#wpadminbar #wp-admin-bar-vaa .ab-vaa-title.vaa-has-icon>.ab-item>.ab-icon{font-size:30px !important;margin-left:-6px;margin-top:-1px;vertical-align:top}#wpadminbar #wp-admin-bar-vaa .vaa-has-icon.menupop>.ab-item{padding-left:12px;padding-right:12px}#wpadminbar #wp-admin-bar-vaa .vaa-menupop div li{margin-left:12px}#wpadminbar #wp-admin-bar-vaa .ab-sub-wrapper .vaa-role-item.menupop>.ab-item{padding-left:15px}#wpadminbar #wp-admin-bar-vaa .ab-vaa-toggle .ab-item::after,#wpadminbar #wp-admin-bar-vaa .ab-sub-wrapper .vaa-menupop.menupop>.ab-item:after{content:"\f140";font-family:'dashicons';position:absolute;right:10px;top:8px;margin:0;font-size:30px;font-weight:normal}#wpadminbar #wp-admin-bar-vaa .ab-vaa-toggle.active .ab-item::after,#wpadminbar #wp-admin-bar-vaa .ab-sub-wrapper .vaa-menupop.menupop.active>.ab-item:after{content:"\f142"}#wpadminbar #wp-admin-bar-vaa button{font-size:16px;padding:5px 15px}#wpadminbar #wp-admin-bar-vaa .ab-vaa-input .ab-item input,#wpadminbar #wp-admin-bar-vaa .ab-vaa-search .ab-item input,#wpadminbar #wp-admin-bar-vaa .ab-vaa-filter .ab-item input{padding:8px 12px}#wpadminbar #wp-admin-bar-vaa .ab-vaa-select .ab-item select{padding:7px 12px}#wpadminbar #wp-admin-bar-vaa .ab-item select+button.input-overlay,#wpadminbar #wp-admin-bar-vaa .ab-item input+button.input-overlay{right:44px;padding:6px 10px 7px;font-size:14px}#wpadminbar #wp-admin-bar-vaa .ab-vaa-multipleselect{border-width:0 44px;max-height:300px !important}#wpadminbar #wp-admin-bar-vaa .menupop>.ab-sub-wrapper .ab-vaa-multipleselect>.ab-item{padding:8px 16px}#wpadminbar #wp-admin-bar-vaa input.checkbox,#wpadminbar #wp-admin-bar-vaa input.radio{width:24px;height:24px}#wpadminbar #wp-admin-bar-vaa input.checkbox.vaa-right,#wpadminbar #wp-admin-bar-vaa input.radio.vaa-right{top:9px;right:11px}} \ No newline at end of file From b4c720ee64c16e63e1bac4f1745d3355ca4320ae Mon Sep 17 00:00:00 2001 From: JoryHogeveen Date: Mon, 24 Apr 2017 18:42:36 +0200 Subject: [PATCH 44/57] Enhance code readability --- ui/templates/adminbar-user-items.php | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/ui/templates/adminbar-user-items.php b/ui/templates/adminbar-user-items.php index 271ddf03..bb759b0c 100644 --- a/ui/templates/adminbar-user-items.php +++ b/ui/templates/adminbar-user-items.php @@ -46,17 +46,19 @@ if ( true === $this->groupUserRoles ) { // Users grouped under roles. foreach ( $user->roles as $role ) { - if ( ! $admin_bar->get_node( $main_root . '-roles-role-' . $role . '-users' ) ) { + $parent = $main_root . '-roles-role-' . $role; + $group = $parent . '-users'; + if ( ! $admin_bar->get_node( $group ) ) { $admin_bar->add_group( array( - 'id' => $main_root . '-roles-role-' . $role . '-users', - 'parent' => $main_root . '-roles-role-' . $role, + 'id' => $group, + 'parent' => $parent, 'meta' => array( 'class' => 'ab-sub-secondary vaa-auto-max-height', ), ) ); } $user_node['id'] .= '-' . $role; - $user_node['parent'] = $main_root . '-roles-role-' . $role . '-users'; + $user_node['parent'] = $group; $admin_bar->add_node( $user_node ); } } else { From 6f1f0e9dcd21c57b373f87bffe650e3084fd5e52 Mon Sep 17 00:00:00 2001 From: JoryHogeveen Date: Mon, 24 Apr 2017 19:21:09 +0200 Subject: [PATCH 45/57] 1.7.1-rc1 + Readme update --- README.md | 4 ++++ readme.txt | 13 ++++++++----- ui/templates/adminbar-user-items.php | 3 ++- view-admin-as.php | 12 +++++------- 4 files changed, 19 insertions(+), 13 deletions(-) diff --git a/README.md b/README.md index 9e082af6..e4b030ee 100644 --- a/README.md +++ b/README.md @@ -43,6 +43,8 @@ It also features a "Role manager" module to add, edit or remove roles and grant * Clone roles * Update role capabilities from current view +*Note: Changes made with the Role Manager are permanent!* + ## Compatibility This plugin will work with most other plugins but these are tested: @@ -51,9 +53,11 @@ This plugin will work with most other plugins but these are tested: * **bbPress** * **BuddyPress** * **Genesis Framework** *(and probably other theme frameworks)* +* **Gravity Forms** * **Pods Framework 2.0+** * **Members** * **Restrict User Access 0.13+** *(Custom integration: adds a view type for access levels)* +* **User Roles and Capabilities** * **User Role Editor** *(Pro version not verified)* * **User Switching** *(Not sure why you'd want this but yes, switch-ception is possible!)* * **WPFront User Role Editor** diff --git a/readme.txt b/readme.txt index 35d88e59..49d29fb8 100644 --- a/readme.txt +++ b/readme.txt @@ -4,7 +4,7 @@ Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=YGPLM Tags: admin, view, roles, users, switch, user switching, role switching, capabilities, caps, screen settings, defaults, visitor Requires at least: 4.1 Tested up to: 4.8 -Stable tag: 1.7 +Stable tag: 1.7.1 View the WordPress admin as a different role or visitor, switch between users, temporarily change your capabilities, set screen settings for roles. @@ -55,9 +55,11 @@ This plugin will work with most other plugins but these are tested: * **bbPress** * **BuddyPress** * **Genesis Framework** *(and probably other theme frameworks)* +* **Gravity Forms** * **Pods Framework 2.0+** * **Members** * **Restrict User Access 0.13+** *(Custom integration: adds a view type for access levels)* +* **User Roles and Capabilities** * **User Role Editor** *(Pro version not verified)* * **User Switching** *(Not sure why you'd want this but yes, switch-ception is possible!)* * **WPFront User Role Editor** @@ -175,11 +177,12 @@ Note: if your admin users aren't safe, this plugin is the last one to worry abou = 1.7.1 = -* Feature: Module Role Manager: Rename roles [#47](https://github.com/JoryHogeveen/view-admin-as/issues/47) +* Feature: Module Role Manager: Rename roles. [#47](https://github.com/JoryHogeveen/view-admin-as/issues/47) * Enhancement/Compatibility: Improve fetching available capabilities for super admin. It now alse checks for custom post type and taxonomy capabilities and more other plugins. -* UI: Add submenu scrollbar when there are too much users under a role [#49](https://github.com/JoryHogeveen/view-admin-as/issues/49) -* UI: Module Role Manager: Show original role name for reference -* Accessibility: Fix tabindex for some nodes that have form elements +* UI: Add submenu scrollbar when there are too much users under a role. [#49](https://github.com/JoryHogeveen/view-admin-as/issues/49) +* UI: Module Role Manager: Show original role name for reference. +* Accessibility: Fix tabindex for some nodes that have form elements. +* Other minor core improvements. Detailed info: [PR on GitHub](https://github.com/JoryHogeveen/view-admin-as/pull/48) diff --git a/ui/templates/adminbar-user-items.php b/ui/templates/adminbar-user-items.php index bb759b0c..fc022beb 100644 --- a/ui/templates/adminbar-user-items.php +++ b/ui/templates/adminbar-user-items.php @@ -2,7 +2,8 @@ /** * Add user items. * - * @since 1.7 + * @since 1.7 + * @version 1.7.1 * * @var WP_Admin_Bar $admin_bar The toolbar object. * @var string $root The current root item. diff --git a/view-admin-as.php b/view-admin-as.php index da8e7461..bb88e582 100644 --- a/view-admin-as.php +++ b/view-admin-as.php @@ -3,7 +3,7 @@ * @author Jory Hogeveen * @package View_Admin_As * @since 0.1 - * @version 1.7.1-dev + * @version 1.7.1-rc1 * @licence GPL-2.0+ * @link https://github.com/JoryHogeveen/view-admin-as * @@ -11,7 +11,7 @@ * Plugin Name: View Admin As * Plugin URI: https://wordpress.org/plugins/view-admin-as/ * Description: View the WordPress admin as a different role or visitor, switch between users, temporarily change your capabilities, set default screen settings for roles. - * Version: 1.7.1-dev + * Version: 1.7.1-rc1 * Author: Jory Hogeveen * Author URI: https://www.keraweb.nl * Text Domain: view-admin-as @@ -19,10 +19,8 @@ * License: GPL-2.0+ * License URI: http://www.gnu.org/licenses/gpl-2.0.txt * GitHub Plugin URI: https://github.com/JoryHogeveen/view-admin-as - */ - -/* - * Copyright 2015-2017 Jory Hogeveen + * + * @copyright 2015-2017 Jory Hogeveen * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -46,7 +44,7 @@ if ( ! class_exists( 'VAA_View_Admin_As' ) ) { - define( 'VIEW_ADMIN_AS_VERSION', '1.7.1-dev' ); + define( 'VIEW_ADMIN_AS_VERSION', '1.7.1-rc1' ); define( 'VIEW_ADMIN_AS_DB_VERSION', '1.7' ); define( 'VIEW_ADMIN_AS_FILE', __FILE__ ); define( 'VIEW_ADMIN_AS_BASENAME', plugin_basename( VIEW_ADMIN_AS_FILE ) ); From fad64d9b0ba099cf5b8f05d8fc2d03f463bbb764 Mon Sep 17 00:00:00 2001 From: JoryHogeveen Date: Fri, 28 Apr 2017 14:03:42 +0200 Subject: [PATCH 46/57] Do not render the modules group if there are no modules to show. --- ui/class-admin-bar.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/ui/class-admin-bar.php b/ui/class-admin-bar.php index c75a5bd6..695df128 100644 --- a/ui/class-admin-bar.php +++ b/ui/class-admin-bar.php @@ -520,6 +520,11 @@ public function admin_bar_menu_settings( $admin_bar ) { */ public function admin_bar_menu_modules( $admin_bar, $root ) { + // Do not render the modules group if there are no modules to show. + if ( ! has_action( 'vaa_admin_bar_modules' ) ) { + return; + } + $admin_bar->add_group( array( 'id' => self::$root . '-modules', 'parent' => $root, From e4d1c087ac9f9d4a7b0dcee622bb34db0508efb2 Mon Sep 17 00:00:00 2001 From: JoryHogeveen Date: Fri, 28 Apr 2017 14:04:11 +0200 Subject: [PATCH 47/57] is_current_view() - $type parameter. Only compare a single view type --- includes/class-api.php | 10 ++++++++-- includes/class-controller.php | 14 +++++++++++++- 2 files changed, 21 insertions(+), 3 deletions(-) diff --git a/includes/class-api.php b/includes/class-api.php index ff37194b..154cc8be 100644 --- a/includes/class-api.php +++ b/includes/class-api.php @@ -94,10 +94,16 @@ public static function get_superior_admins() { * * @since 1.7.1 * @param array $data + * @param bool $type Only compare a single view type instead of all view data? + * If set, the data value should be the single view type data. * @return bool */ - public static function is_current_view( $data ) { - return view_admin_as()->controller()->is_current_view( $data ); + public static function is_current_view( $data, $type = null ) { + $controller = view_admin_as()->controller(); + if ( $controller ) { + return $controller->is_current_view( $data, $type ); + } + return false; } /** diff --git a/includes/class-controller.php b/includes/class-controller.php index e898dc2f..89aa0839 100644 --- a/includes/class-controller.php +++ b/includes/class-controller.php @@ -341,9 +341,21 @@ public function filter_update_view_caps( $null, $data, $type ) { * * @since 1.7 * @param array $data + * @param bool $type Only compare a single view type instead of all view data? + * If set, the data value should be the single view type data. * @return bool */ - public function is_current_view( $data ) { + public function is_current_view( $data, $type = null ) { + if ( ! empty( $type ) ) { + $current = $this->store->get_view( $type ); + if ( ! $current ) { + return false; + } + if ( is_array( $data ) ) { + return VAA_API::array_equal( $data, $current ); + } + return ( (string) $data === (string) $current ); + } return VAA_API::array_equal( $data, $this->store->get_view() ); } From 283bdc11d333a0c264ac847ee28f4d05d24cdd8e Mon Sep 17 00:00:00 2001 From: JoryHogeveen Date: Fri, 28 Apr 2017 14:04:34 +0200 Subject: [PATCH 48/57] Use is_current_view in node rendering --- modules/class-restrict-user-access.php | 2 +- ui/templates/adminbar-role-items.php | 5 +++-- ui/templates/adminbar-user-items.php | 2 +- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/modules/class-restrict-user-access.php b/modules/class-restrict-user-access.php index a3314e74..c019b479 100644 --- a/modules/class-restrict-user-access.php +++ b/modules/class-restrict-user-access.php @@ -378,7 +378,7 @@ public function admin_bar_menu( $admin_bar, $root, $role = null, $role_obj = nul $title = VAA_View_Admin_As_Admin_Bar::do_view_title( $level->post_title, $this->viewKey, ( $role ) ? wp_json_encode( $view_data ) : $level->ID ); // Check if this level is the current view. if ( $this->store->get_view( $this->viewKey ) ) { - if ( (int) $this->store->get_view( $this->viewKey ) === (int) $level->ID ) { + if ( VAA_API::is_current_view( $level->ID, $this->viewKey ) ) { // @todo Use is_current_view() from vaa controller? if ( 1 === count( $this->store->get_view() ) && empty( $role ) ) { $class .= ' current'; diff --git a/ui/templates/adminbar-role-items.php b/ui/templates/adminbar-role-items.php index 893340d2..082572e3 100644 --- a/ui/templates/adminbar-role-items.php +++ b/ui/templates/adminbar-role-items.php @@ -2,7 +2,8 @@ /** * Add role items. * - * @since 1.7 + * @since 1.7 + * @version 1.7.1 * * @var WP_Admin_Bar $admin_bar The toolbar object. * @var string $root The current root item. @@ -46,7 +47,7 @@ } } // Check if this role is the current view. - if ( $this->store->get_view( 'role' ) === $role_key ) { + if ( VAA_API::is_current_view( $role_key, 'role' ) ) { $class .= ' current'; if ( 1 === count( $this->store->get_view() ) ) { $href = false; diff --git a/ui/templates/adminbar-user-items.php b/ui/templates/adminbar-user-items.php index fc022beb..a2523e80 100644 --- a/ui/templates/adminbar-user-items.php +++ b/ui/templates/adminbar-user-items.php @@ -26,7 +26,7 @@ $class = 'vaa-user-item'; $title = VAA_View_Admin_As_Admin_Bar::do_view_title( $user->display_name, 'user', $user->ID ); // Check if this user is the current view. - if ( $this->store->get_view( 'user' ) && (int) $this->store->get_view( 'user' ) === (int) $user->ID ) { + if ( VAA_API::is_current_view( $user->ID, 'user' ) ) { $class .= ' current'; if ( 1 === count( $this->store->get_view() ) ) { $href = false; From 28bd5428b147ae36b11cd25aa68d0ce9136141b7 Mon Sep 17 00:00:00 2001 From: JoryHogeveen Date: Fri, 28 Apr 2017 14:04:48 +0200 Subject: [PATCH 49/57] Improve use group rendering. --- ui/templates/adminbar-user-items.php | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/ui/templates/adminbar-user-items.php b/ui/templates/adminbar-user-items.php index a2523e80..c7edfa81 100644 --- a/ui/templates/adminbar-user-items.php +++ b/ui/templates/adminbar-user-items.php @@ -47,6 +47,7 @@ if ( true === $this->groupUserRoles ) { // Users grouped under roles. foreach ( $user->roles as $role ) { + $user_role_node = $user_node; $parent = $main_root . '-roles-role-' . $role; $group = $parent . '-users'; if ( ! $admin_bar->get_node( $group ) ) { @@ -58,9 +59,9 @@ ), ) ); } - $user_node['id'] .= '-' . $role; - $user_node['parent'] = $group; - $admin_bar->add_node( $user_node ); + $user_role_node['id'] .= '-' . $role; + $user_role_node['parent'] = $group; + $admin_bar->add_node( $user_role_node ); } } else { // Users displayed as normal. From 80cb3231fed17424d83d51c003078820142e9b9d Mon Sep 17 00:00:00 2001 From: JoryHogeveen Date: Fri, 28 Apr 2017 14:05:13 +0200 Subject: [PATCH 50/57] enhance autoMaxHeight() --- assets/js/view-admin-as.js | 37 +++++++++++++++++++------------------ 1 file changed, 19 insertions(+), 18 deletions(-) diff --git a/assets/js/view-admin-as.js b/assets/js/view-admin-as.js index 1c729a06..b257dcc2 100644 --- a/assets/js/view-admin-as.js +++ b/assets/js/view-admin-as.js @@ -1263,25 +1263,26 @@ if ( 'undefined' === typeof VAA_View_Admin_As ) { */ VAA_View_Admin_As.autoMaxHeight = function() { setTimeout( function() { + // @link http://stackoverflow.com/questions/11193453/find-the-vertical-position-of-scrollbar-without-jquery + var scrollTop = ( 'undefined' !== typeof window.pageYOffset ) ? window.pageYOffset : ( document.documentElement || document.body.parentNode || document.body ).scrollTop; + VAA_View_Admin_As.maxHeightListenerElements.each( function() { - var element = $( this ), - count = 0, - wait = setInterval( function() { - var offset = element.offset(), - // @link http://stackoverflow.com/questions/11193453/find-the-vertical-position-of-scrollbar-without-jquery - scrollTop = ( 'undefined' !== typeof window.pageYOffset ) ? window.pageYOffset : ( document.documentElement || document.body.parentNode || document.body ).scrollTop, - offsetTop = ( offset.top - scrollTop ); - if ( element.is(':visible') && 0 < offsetTop ) { - clearInterval( wait ); - var maxHeight = $window.height() - offsetTop - 100; - maxHeight = ( 100 < maxHeight ) ? maxHeight : 100; - element.css( { 'max-height': maxHeight + 'px' } ); - } - count++; - if ( 5 < count ) { - clearInterval( wait ); - } - }, 100 ); + var $element = $(this), + count = 0, + wait = setInterval( function() { + var offset = $element.offset(), + offsetTop = ( offset.top - scrollTop ); + if ( $element.is(':visible') && 0 < offsetTop ) { + clearInterval( wait ); + var maxHeight = $window.height() - offsetTop - 100; + maxHeight = ( 100 < maxHeight ) ? maxHeight : 100; + $element.css( { 'max-height': maxHeight + 'px' } ); + } + count++; + if ( 5 < count ) { + clearInterval( wait ); + } + }, 100 ); } ); }, 100 ); }; From 2438aafaf30c25eab757e2208a934b433b7fa80c Mon Sep 17 00:00:00 2001 From: JoryHogeveen Date: Fri, 28 Apr 2017 14:05:30 +0200 Subject: [PATCH 51/57] Codestandards and cleanup --- assets/js/view-admin-as.js | 10 +++++----- assets/js/view-admin-as.min.js | 2 +- includes/class-vaa.php | 1 + modules/class-role-manager.php | 1 - 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/assets/js/view-admin-as.js b/assets/js/view-admin-as.js index b257dcc2..bf848b0d 100644 --- a/assets/js/view-admin-as.js +++ b/assets/js/view-admin-as.js @@ -94,7 +94,7 @@ if ( 'undefined' === typeof VAA_View_Admin_As ) { VAA_View_Admin_As.init_module_role_manager(); // Functionality that require the document to be fully loaded. - $window.on( "load", function() { + $window.on( 'load', function() { // Toggle content with title. $( VAA_View_Admin_As.prefix + '.ab-vaa-toggle' ).each( function() { @@ -701,7 +701,7 @@ if ( 'undefined' === typeof VAA_View_Admin_As ) { if ( 1 <= $(this).val().length ) { var inputText = $(this).val(); $( VAA_View_Admin_As.prefix + '.vaa-user-item' ).each( function() { - var name = $('.ab-item', this).text(); + var name = $( '.ab-item', this ).text(); if ( -1 < name.toLowerCase().indexOf( inputText.toLowerCase() ) ) { var exists = false; $( VAA_View_Admin_As.prefix + '.ab-vaa-search .ab-vaa-results .vaa-user-item .ab-item' ).each(function() { @@ -722,7 +722,7 @@ if ( 'undefined' === typeof VAA_View_Admin_As ) { } ); if ( '' === $.trim( $( VAA_View_Admin_As.prefix + '.ab-vaa-search .ab-vaa-results' ).html() ) ) { $( VAA_View_Admin_As.prefix + '.ab-vaa-search .ab-vaa-results' ) - .append('
    '+VAA_View_Admin_As.__no_users_found+'
    '); + .append('
    ' + VAA_View_Admin_As.__no_users_found + '
    '); } } } ); @@ -846,7 +846,7 @@ if ( 'undefined' === typeof VAA_View_Admin_As ) { e.preventDefault(); $( root_prefix + '-select-options .vaa-cap-item' ).each( function() { if ( $(this).is(':visible') ) { - $('input', this).prop( "checked", true ); + $( 'input', this ).prop( "checked", true ); } } ); return false; @@ -860,7 +860,7 @@ if ( 'undefined' === typeof VAA_View_Admin_As ) { e.preventDefault(); $( root_prefix + '-select-options .vaa-cap-item' ).each( function() { if ( $(this).is(':visible') ) { - $('input', this).prop( "checked", false ); + $( 'input', this ).prop( "checked", false ); } } ); return false; diff --git a/assets/js/view-admin-as.min.js b/assets/js/view-admin-as.min.js index 66c702a2..1d7fba23 100644 --- a/assets/js/view-admin-as.min.js +++ b/assets/js/view-admin-as.min.js @@ -8,4 +8,4 @@ * @version 1.7.1 * @preserve */ -if("undefined"===typeof VAA_View_Admin_As){var VAA_View_Admin_As={}}(function($){var $document=$(document),$window=$(window),$body=$("body");VAA_View_Admin_As.prefix="#wpadminbar #wp-admin-bar-vaa ";VAA_View_Admin_As.root="#wp-admin-bar-vaa";VAA_View_Admin_As.maxHeightListenerElements=$(VAA_View_Admin_As.prefix+".vaa-auto-max-height");VAA_View_Admin_As._mobile=false;if(!VAA_View_Admin_As.hasOwnProperty("_debug")){VAA_View_Admin_As._debug=false}VAA_View_Admin_As._debug=Boolean(parseInt(VAA_View_Admin_As._debug,10));if(!VAA_View_Admin_As.hasOwnProperty("ajaxurl")&&"undefined"!==typeof ajaxurl){VAA_View_Admin_As.ajaxurl=ajaxurl}VAA_View_Admin_As._touchmove=false;$document.on("touchmove",function(){VAA_View_Admin_As._touchmove=true});$document.on("touchstart",function(){VAA_View_Admin_As._touchmove=false});VAA_View_Admin_As.json_decode=function(val){if(0===val.indexOf("{")){try{val=JSON.parse(val)}catch(err){}}return val};VAA_View_Admin_As.init=function(){VAA_View_Admin_As.init_caps();VAA_View_Admin_As.init_users();VAA_View_Admin_As.init_settings();VAA_View_Admin_As.init_module_role_defaults();VAA_View_Admin_As.init_module_role_manager();$window.on("load",function(){$(VAA_View_Admin_As.prefix+".ab-vaa-toggle").each(function(){var toggleContent=$(this).parent().children().not(".ab-vaa-toggle");if(!$(this).hasClass("active")){toggleContent.hide()}$(this).on("click touchend",function(e){e.preventDefault();e.stopPropagation();if(true===VAA_View_Admin_As._touchmove){return}if($(this).hasClass("active")){toggleContent.slideUp("fast");$(this).removeClass("active")}else{toggleContent.slideDown("fast");$(this).addClass("active")}VAA_View_Admin_As.autoMaxHeight()});$(this).on("keyup",function(e){e.preventDefault();var key=parseInt(e.which,10);if($(this).hasClass("active")&&(13===key||32===key||38===key)){toggleContent.slideUp("fast");$(this).removeClass("active")}else if(13===key||32===key||40===key){toggleContent.slideDown("fast");$(this).addClass("active")}VAA_View_Admin_As.autoMaxHeight()})});$(VAA_View_Admin_As.prefix+".ab-vaa-showhide[data-showhide]").each(function(){$($(this).attr("data-showhide")).hide();$(this).on("mouseenter",function(){$($(this).attr("data-showhide")).slideDown("fast")}).on("mouseleave",function(){$($(this).attr("data-showhide")).slideUp("fast")})});$(VAA_View_Admin_As.prefix+".ab-vaa-conditional[data-condition-target]").each(function(){var $this=$(this),$target=$($this.attr("data-condition-target")),compare=$this.attr("data-condition"),checkbox=$target.is(":checkbox");$this.hide();$target.on("change",function(){if(checkbox&&$target.is(":checked")){$this.slideDown("fast")}else if(!checkbox&&compare===$target.val()){$this.slideDown("fast")}else{$this.slideUp("fast")}VAA_View_Admin_As.autoMaxHeight()})});if($body.hasClass("mobile")||783>$body.innerWidth()){$body.addClass("vaa-mobile");VAA_View_Admin_As._mobile=true;VAA_View_Admin_As.mobile()}VAA_View_Admin_As.maxHeightListenerElements.each(function(){$(this).parents(".menupop").on("mouseenter",function(){VAA_View_Admin_As.autoMaxHeight()})})});$document.on("click touchend",VAA_View_Admin_As.prefix+".vaa-reset-item > .ab-item",function(e){e.preventDefault();if(true===VAA_View_Admin_As._touchmove){return}if("vaa_reload"===$("button",this).attr("name")){window.location.reload()}else{VAA_View_Admin_As.ajax({reset:true},true);return false}});$.each(VAA_View_Admin_As.view_types,function(index,type){$document.on("click touchend",VAA_View_Admin_As.prefix+".vaa-"+type+"-item > a.ab-item",function(e){if(true===VAA_View_Admin_As._touchmove){return}e.preventDefault();var $this=$(this);if(VAA_View_Admin_As._mobile&&$this.parent().hasClass("menupop")&&!$this.next().is(":visible")){$this.next().show().parent().addClass("active");return}if(!$this.parent().hasClass("not-a-view")){var view_data={},val=$this.attr("rel");if(!val){val=$this.find(".vaa-view-data").attr("data-view-value")}view_data[type]=VAA_View_Admin_As.json_decode(val);view_data="object"===typeof view_data[type]?view_data[type]:view_data;VAA_View_Admin_As.ajax(view_data,true);return false}})});$document.on("click touchend",VAA_View_Admin_As.prefix+".remove",function(e){e.preventDefault();if(true===VAA_View_Admin_As._touchmove){return}$(this).parent().slideUp("fast",function(){$(this).remove()})})};VAA_View_Admin_As.mobile=function(){var prefix=".vaa-mobile "+VAA_View_Admin_As.prefix;$document.on("click touchend",prefix+" > .ab-sub-wrapper .ab-item",function(e){if(true===VAA_View_Admin_As._touchmove){return}e.preventDefault();e.stopPropagation();var $sub=$(this).parent(".menupop").children(".ab-sub-wrapper");if($sub.length){if($sub.hasClass("active")){$sub.slideUp("fast");$sub.removeClass("active")}else{$sub.slideDown("fast");$sub.addClass("active")}}});$document.on("click touchend",prefix+"input, "+prefix+"textarea, "+prefix+"select",function(e){if(true===VAA_View_Admin_As._touchmove){return}e.stopPropagation();var $this=$(this);if($this.is('[type="checkbox"]')){e.preventDefault();if($this.is(":checked")){$this.prop("checked",false)}else{$this.prop("checked",true)}$this.trigger("change");return false}else if($this.is('[type="radio"]')){e.preventDefault();$('input[name="'+$this.attr["name"]+'"]').removeAttr("checked");$this.prop("checked",true);$this.trigger("change");return false}return true});$document.on("click touchend",prefix+"label",function(e){if(true===VAA_View_Admin_As._touchmove){return}e.preventDefault();e.stopPropagation();$("#"+$(this).attr("for")).trigger(e.type);return false})};VAA_View_Admin_As.overlay=function(html){var $overlay=$("#vaa-overlay");if(!$overlay.length){html='
    '+html+"
    ";$body.append(html);$overlay=$("body #vaa-overlay")}else if(html.length){$overlay.html(html)}$overlay.fadeIn("fast")};VAA_View_Admin_As.ajax=function(data,refresh){$(".vaa-notice","#wpadminbar").remove();var loader_icon=VAA_View_Admin_As.siteurl+"/wp-includes/images/spinner-2x.gif";VAA_View_Admin_As.overlay('');var post_data={action:"view_admin_as",_vaa_nonce:VAA_View_Admin_As._vaa_nonce,view_admin_as:JSON.stringify(data)};var isView=false;$.each(VAA_View_Admin_As.view_types,function(index,type){if("undefined"!==typeof data[type]){isView=true;return true}});if($(VAA_View_Admin_As.prefix+"#vaa-settings-view-mode-single").is(":checked")&&isView){$body.append('');var form=$("#vaa_single_mode_form");form.append('');form.append('');form.append('');form.find("#data").val(post_data.view_admin_as);form.submit()}else{$.post(VAA_View_Admin_As.ajaxurl,post_data,function(response){var success=response.hasOwnProperty("success")&&true===response.success,data={},display=false;if(true===VAA_View_Admin_As._debug){console.log(response)}if(response.hasOwnProperty("data")){if("object"===typeof response.data){data=response.data;if(data.hasOwnProperty("display")){display=data.display}}}if(success){if(refresh){VAA_View_Admin_As.refresh(data);return}else{if(!data.hasOwnProperty("text")){data.text=VAA_View_Admin_As.__success}}}if(!data.hasOwnProperty("type")){if(success){data.type="success"}else{data.type="error"}}if("popup"===display){VAA_View_Admin_As.popup(data,data.type)}else{if(!data.hasOwnProperty("text")){data.text=response.data}VAA_View_Admin_As.notice(String(data.text),data.type,5e3);$("body #vaa-overlay").addClass(data.type).fadeOut("fast",function(){$(this).remove()})}})}};VAA_View_Admin_As.refresh=function(data){if(data.hasOwnProperty("redirect")){window.location.replace(String(data.redirect))}else{window.location.hash="";window.location.reload()}};VAA_View_Admin_As.notice=function(notice,type,timeout){var root="#wpadminbar .vaa-notice",html=notice+'';type="undefined"===typeof type?"notice":type;timeout="undefined"===typeof timeout?5e3:timeout;if(VAA_View_Admin_As._mobile){html='";$(VAA_View_Admin_As.prefix+"> .ab-sub-wrapper").prepend(html).children(".vaa-notice").slideDown("fast");$("html, body").animate({scrollTop:"0"});if(timeout){setTimeout(function(){$(root).slideUp("fast",function(){$(this).remove()})},timeout)}}else{html='
  • '+html+"
  • ";$("#wp-admin-bar-top-secondary").append(html);$(root+" .remove").click(function(){$(this).parent().remove()});if(timeout){setTimeout(function(){$(root).fadeOut("fast",function(){$(this).remove()})},timeout)}}};VAA_View_Admin_As.item_notice=function(parent,notice,type,timeout){var root=".vaa-notice",html=notice+'',$element=$(parent);type="undefined"===typeof type?"notice":type;timeout="undefined"===typeof timeout?5e3:timeout;html='";$element.append(html).children(".vaa-notice").slideDown("fast");if(timeout){setTimeout(function(){$(root,$element).slideUp("fast",function(){$(this).remove()})},timeout)}};VAA_View_Admin_As.item_confirm=function(parent,text){$(parent).find(".vaa-notice").slideUp("fast",function(){$(this).remove()});text='";VAA_View_Admin_As.item_notice(parent,text,"warning",0);return $(parent).find(".vaa-confirm")};VAA_View_Admin_As.popup=function(data,type){type="undefined"===typeof type?"notice":type;var html="";html+='
    ';html+='';html+='
    ';if("object"!==typeof data){data={text:data}}if(data.hasOwnProperty("text")){html+="

    "+String(data.text)+"

    "}if(data.hasOwnProperty("list")){html+="
      ";data.list.forEach(function(item){html+="
    • "+String(item)+"
    • "});html+="
    "}if(data.hasOwnProperty("textarea")){html+='"}html+="
    ";VAA_View_Admin_As.overlay(html);var root="body #vaa-overlay",$overlay=$(root),$overlayContainer=$(root+" .vaa-overlay-container"),$popupResponse=$(root+" .vaa-response-data");$(root+" .vaa-overlay-container .remove").click(function(){$overlay.fadeOut("fast",function(){$(this).remove()})});$document.on("mouseup",function(e){$(root+" .vaa-overlay-container").each(function(){if(!$(this).is(e.target)&&0===$(this).has(e.target).length){$overlay.fadeOut("fast",function(){$(this).remove()})}})});var textarea=$("textarea",$popupResponse);if(textarea.length){textarea.on("click",function(){$(this).select()})}var popupMaxHeight=function(){if(textarea.length){textarea.each(function(){$(this).css({height:"auto","overflow-y":"hidden"}).height(this.scrollHeight)})}var maxHeight=$overlay.height()*.8-24;$overlayContainer.css("max-height",maxHeight);$popupResponse.css("max-height",maxHeight)};popupMaxHeight();$window.on("resize",function(){popupMaxHeight()})};VAA_View_Admin_As.init_settings=function(){var root=VAA_View_Admin_As.root+"-settings",prefix="vaa-settings",root_prefix=VAA_View_Admin_As.prefix+root;$document.on("change",root_prefix+"-admin-menu-location select#"+prefix+"-admin-menu-location",function(e){e.preventDefault();var val=$(this).val();if(val&&""!==val){var view_data={user_setting:{admin_menu_location:val}};VAA_View_Admin_As.ajax(view_data,true)}});$document.on("change",root_prefix+"-view-mode input.radio."+prefix+"-view-mode",function(e){e.preventDefault();var val=$(this).val();if(val&&""!==val){var view_data={user_setting:{view_mode:val}};VAA_View_Admin_As.ajax(view_data,false)}});$document.on("change",root_prefix+"-force-group-users input#"+prefix+"-force-group-users",function(e){e.preventDefault();var view_data={user_setting:{force_group_users:"no"}};if(this.checked){view_data={user_setting:{force_group_users:"yes"}}}VAA_View_Admin_As.ajax(view_data,true)});$document.on("change",root_prefix+"-hide-front input#"+prefix+"-hide-front",function(e){e.preventDefault();var view_data={user_setting:{hide_front:"no"}};if(this.checked){view_data={user_setting:{hide_front:"yes"}}}VAA_View_Admin_As.ajax(view_data,false)});$document.on("change",root_prefix+"-freeze-locale input#"+prefix+"-freeze-locale",function(e){e.preventDefault();var view_data={user_setting:{freeze_locale:"no"}};if(this.checked){view_data={user_setting:{freeze_locale:"yes"}}}var reload=false;if("object"===typeof VAA_View_Admin_As.view&&"undefined"!==typeof VAA_View_Admin_As.view.user){reload=true}VAA_View_Admin_As.ajax(view_data,reload)})};VAA_View_Admin_As.init_users=function(){var root=VAA_View_Admin_As.root+"-users",root_prefix=VAA_View_Admin_As.prefix+root;$document.on("keyup",root_prefix+" .ab-vaa-search.search-users input",function(){$(VAA_View_Admin_As.prefix+" .ab-vaa-search .ab-vaa-results").empty();if(1<=$(this).val().length){var inputText=$(this).val();$(VAA_View_Admin_As.prefix+".vaa-user-item").each(function(){var name=$(".ab-item",this).text();if(-1('+role+")")}}});if(""===$.trim($(VAA_View_Admin_As.prefix+".ab-vaa-search .ab-vaa-results").html())){$(VAA_View_Admin_As.prefix+".ab-vaa-search .ab-vaa-results").append('
    '+VAA_View_Admin_As.__no_users_found+"
    ")}}})};VAA_View_Admin_As.init_caps=function(){var root=VAA_View_Admin_As.root+"-caps",root_prefix=VAA_View_Admin_As.prefix+root;VAA_View_Admin_As.caps_filter_settings={selectedRole:"default",selectedRoleCaps:{},selectedRoleReverse:false,filterString:""};VAA_View_Admin_As.filter_capabilities=function(){var reverse=true===VAA_View_Admin_As.caps_filter_settings.selectedRoleReverse,isDefault="default"===VAA_View_Admin_As.caps_filter_settings.selectedRole,filterString=VAA_View_Admin_As.caps_filter_settings.filterString;$(root_prefix+"-select-options .vaa-cap-item").each(function(){var $this=$(this),exists=$("input",this).attr("value")in VAA_View_Admin_As.caps_filter_settings.selectedRoleCaps,name;$this.hide();if(reverse||exists||isDefault){if(1<=filterString.length){name=$this.text();if(-1 .ab-sub-wrapper").addClass("fullPopup");VAA_View_Admin_As.autoMaxHeight()});$document.on("click",root_prefix+" #close-caps-popup",function(){$(VAA_View_Admin_As.prefix).removeClass("fullPopupActive");$(root_prefix+"-manager > .ab-sub-wrapper").removeClass("fullPopup");VAA_View_Admin_As.autoMaxHeight()});$document.on("change",root_prefix+" .ab-vaa-select.select-role-caps select",function(){VAA_View_Admin_As.caps_filter_settings.selectedRole=$(this).val();if("default"===VAA_View_Admin_As.caps_filter_settings.selectedRole){VAA_View_Admin_As.caps_filter_settings.selectedRoleCaps={};VAA_View_Admin_As.caps_filter_settings.selectedRoleReverse=false}else{var selectedRoleElement=$(root_prefix+'-selectrolecaps #vaa-caps-selectrolecaps option[value="'+VAA_View_Admin_As.caps_filter_settings.selectedRole+'"]');VAA_View_Admin_As.caps_filter_settings.selectedRoleCaps=JSON.parse(selectedRoleElement.attr("data-caps"));VAA_View_Admin_As.caps_filter_settings.selectedRoleReverse=1===parseInt(selectedRoleElement.attr("data-reverse"),10)}VAA_View_Admin_As.filter_capabilities()});$document.on("keyup",root_prefix+" .ab-vaa-filter input",function(){VAA_View_Admin_As.caps_filter_settings.filterString=$(this).val();VAA_View_Admin_As.filter_capabilities()});$document.on("click touchend",root_prefix+" button#select-all-caps",function(e){if(true===VAA_View_Admin_As._touchmove){return}e.preventDefault();$(root_prefix+"-select-options .vaa-cap-item").each(function(){if($(this).is(":visible")){$("input",this).prop("checked",true)}});return false});$document.on("click touchend",root_prefix+" button#deselect-all-caps",function(e){if(true===VAA_View_Admin_As._touchmove){return}e.preventDefault();$(root_prefix+"-select-options .vaa-cap-item").each(function(){if($(this).is(":visible")){$("input",this).prop("checked",false)}});return false});$document.on("click touchend",root_prefix+" button#apply-caps-view",function(e){if(true===VAA_View_Admin_As._touchmove){return}e.preventDefault();var newCaps=VAA_View_Admin_As.get_selected_capabilities();VAA_View_Admin_As.ajax({caps:newCaps},true);return false})};VAA_View_Admin_As.init_module_role_defaults=function(){var root=VAA_View_Admin_As.root+"-modules",prefix="vaa-modules",root_prefix=VAA_View_Admin_As.prefix+root;$document.on("change",root_prefix+"-role-defaults-enable input#"+prefix+"-role-defaults-enable",function(e){e.preventDefault();var view_data={role_defaults:{enable:0}};if(this.checked){view_data={role_defaults:{enable:true}}}VAA_View_Admin_As.ajax(view_data,true)});root=VAA_View_Admin_As.root+"-role-defaults";prefix="vaa-role-defaults";root_prefix=VAA_View_Admin_As.prefix+root;$document.on("change",root_prefix+"-setting-register-enable input#"+prefix+"-setting-register-enable",function(e){e.preventDefault();var view_data={role_defaults:{apply_defaults_on_register:0}};if(this.checked){view_data={role_defaults:{apply_defaults_on_register:true}}}VAA_View_Admin_As.ajax(view_data,false)});$document.on("change",root_prefix+"-setting-disable-user-screen-options input#"+prefix+"-setting-disable-user-screen-options",function(e){e.preventDefault();var view_data={role_defaults:{disable_user_screen_options:0}};if(this.checked){view_data={role_defaults:{disable_user_screen_options:true}}}VAA_View_Admin_As.ajax(view_data,false)});$document.on("change",root_prefix+"-setting-lock-meta-boxes input#"+prefix+"-setting-lock-meta-boxes",function(e){e.preventDefault();var view_data={role_defaults:{lock_meta_boxes:0}};if(this.checked){view_data={role_defaults:{lock_meta_boxes:true}}}VAA_View_Admin_As.ajax(view_data,false)});$document.on("click touchend",root_prefix+"-meta-add button#"+prefix+"-meta-add",function(e){if(true===VAA_View_Admin_As._touchmove){return}e.preventDefault();var val=$(root_prefix+"-meta-add input#"+prefix+"-meta-new").val();var item=$(root_prefix+"-meta-add #"+prefix+"-meta-template").html().toString();val=val.replace(/ /g,"_");item=item.replace(/vaa_new_item/g,val);if($(root_prefix+'-meta-select input[value="'+val+'"]').length){VAA_View_Admin_As.item_notice($(this).parent(),VAA_View_Admin_As.__key_already_exists,"error",2e3)}else{$(root_prefix+"-meta-select > .ab-item").prepend(item)}});$document.on("click touchend",root_prefix+"-meta-apply button#"+prefix+"-meta-apply",function(e){if(true===VAA_View_Admin_As._touchmove){return}e.preventDefault();var val={};$(root_prefix+"-meta-select .ab-item.vaa-item input").each(function(){val[$(this).val()]=$(this).is(":checked")});if(val){var view_data={role_defaults:{update_meta:val}};VAA_View_Admin_As.ajax(view_data,false)}return false});$document.on("keyup",root_prefix+"-bulk-users-filter input#"+prefix+"-bulk-users-filter",function(e){e.preventDefault();if(1<=$(this).val().length){var inputText=$(this).val();$(root_prefix+"-bulk-users-select .ab-item.vaa-item").each(function(){var name=$(".user-name",this).text();if(-1"+err+"","error")}}return false});$document.on("click touchend",root_prefix+"-clear-roles-apply button#"+prefix+"-clear-roles-apply",function(e){if(true===VAA_View_Admin_As._touchmove){return}e.preventDefault();var val=$(root_prefix+"-clear-roles-select select#"+prefix+"-clear-roles-select").val();if(val&&""!==val){var view_data={role_defaults:{clear_role_defaults:val}},confirm=VAA_View_Admin_As.item_confirm($(this).parent(),VAA_View_Admin_As.__confirm);$(confirm).on("click",function(){VAA_View_Admin_As.ajax(view_data,false)})}return false})};VAA_View_Admin_As.init_module_role_manager=function(){var root=VAA_View_Admin_As.root+"-modules",prefix="vaa-modules",root_prefix=VAA_View_Admin_As.prefix+root;$document.on("change",root_prefix+"-role-manager-enable input#"+prefix+"-role-manager-enable",function(e){e.preventDefault();var view_data={role_manager:{enable:0}};if(this.checked){view_data={role_manager:{enable:true}}}VAA_View_Admin_As.ajax(view_data,true)});root=VAA_View_Admin_As.root+"-role-manager";prefix="vaa-role-manager";root_prefix=VAA_View_Admin_As.prefix+root;$document.on("click touchend",root_prefix+"-apply-view-apply button#"+prefix+"-apply-view-apply",function(e){if(true===VAA_View_Admin_As._touchmove){return}e.preventDefault();var role=$(root_prefix+"-apply-view-select select#"+prefix+"-apply-view-select").val();var capabilities=JSON.parse($(this).attr("data-view-caps"));if(role&&""!==role&&capabilities){var view_data={role_manager:{apply_view_to_role:{role:role,capabilities:capabilities}}};VAA_View_Admin_As.ajax(view_data,true)}return false});$document.on("click touchend",root_prefix+"-rename-apply button#"+prefix+"-rename-apply",function(e){if(true===VAA_View_Admin_As._touchmove){return}e.preventDefault();var role=$(root_prefix+"-rename-select select#"+prefix+"-rename-select").val();var new_name=$(root_prefix+"-rename-input input#"+prefix+"-rename-input").val();if(role&&""!==role&&new_name&&""!==new_name){var view_data={role_manager:{rename_role:{role:role,new_name:new_name}}};VAA_View_Admin_As.ajax(view_data,true)}return false});$document.on("click touchend",root_prefix+"-clone-apply button#"+prefix+"-clone-apply",function(e){if(true===VAA_View_Admin_As._touchmove){return}e.preventDefault();var role=$(root_prefix+"-clone-select select#"+prefix+"-clone-select").val();var new_role=$(root_prefix+"-clone-input input#"+prefix+"-clone-input").val();if(role&&""!==role&&new_role&&""!==new_role){var view_data={role_manager:{clone_role:{role:role,new_role:new_role}}};VAA_View_Admin_As.ajax(view_data,true)}return false});$document.on("click touchend",root_prefix+"-delete-apply button#"+prefix+"-delete-apply",function(e){if(true===VAA_View_Admin_As._touchmove){return}e.preventDefault();var val=$(root_prefix+"-delete-select select#"+prefix+"-delete-select").val();if(val&&""!==val){var view_data={role_manager:{delete_role:val}},confirm=VAA_View_Admin_As.item_confirm($(this).parent(),VAA_View_Admin_As.__confirm);$(confirm).on("click",function(){VAA_View_Admin_As.ajax(view_data,true)})}return false});var caps_root=VAA_View_Admin_As.root+"-caps-manager-role-manager",caps_prefix="vaa-caps-manager-role-manager",caps_root_prefix=VAA_View_Admin_As.prefix+caps_root;$document.on("change",caps_root_prefix+" select#"+caps_prefix+"-edit-role",function(){var $this=$(this),role=$this.val(),caps={},selectedRoleElement=$(caps_root_prefix+" select#"+caps_prefix+'-edit-role option[value="'+role+'"]');if(selectedRoleElement.attr("data-caps")){caps=JSON.parse(selectedRoleElement.attr("data-caps"))}VAA_View_Admin_As.caps_filter_settings.selectedRole="default";VAA_View_Admin_As.caps_filter_settings.selectedRoleCaps={};VAA_View_Admin_As.caps_filter_settings.selectedRoleReverse=false;VAA_View_Admin_As.filter_capabilities();VAA_View_Admin_As.set_selected_capabilities(caps)});$document.on("click touchend",caps_root_prefix+" button#"+caps_prefix+"-save-role",function(e){if(true===VAA_View_Admin_As._touchmove){return}e.preventDefault();var role=$(caps_root_prefix+" select#"+caps_prefix+"-edit-role").val(),refresh=false;if(!role){return false}if("__new__"===role){role=$(caps_root_prefix+" input#"+caps_prefix+"-new-role").val();refresh=true}var data={role:role,capabilities:VAA_View_Admin_As.get_selected_capabilities()};VAA_View_Admin_As.ajax({role_manager:{save_role:data}},refresh);return false});$document.on("click touchend",caps_root_prefix+"-new-cap button#"+caps_prefix+"-add-cap",function(e){if(true===VAA_View_Admin_As._touchmove){return}e.preventDefault();var existing=VAA_View_Admin_As.get_selected_capabilities();var val=$(caps_root_prefix+"-new-cap input#"+caps_prefix+"-new-cap").val();var item=$(caps_root_prefix+"-new-cap #"+caps_prefix+"-cap-template").html().toString();val=val.replace(/ /g,"_");item=item.replace(/vaa_new_item/g,val);if("undefined"!==typeof existing[val]){VAA_View_Admin_As.item_notice($(this).parent(),VAA_View_Admin_As.__key_already_exists,"error",2e3)}else{$(VAA_View_Admin_As.root+"-caps-select-options > .ab-item").prepend(item)}})};VAA_View_Admin_As.autoMaxHeight=function(){setTimeout(function(){VAA_View_Admin_As.maxHeightListenerElements.each(function(){var element=$(this),count=0,wait=setInterval(function(){var offset=element.offset(),scrollTop="undefined"!==typeof window.pageYOffset?window.pageYOffset:(document.documentElement||document.body.parentNode||document.body).scrollTop,offsetTop=offset.top-scrollTop;if(element.is(":visible")&&0$body.innerWidth()){$body.addClass("vaa-mobile");VAA_View_Admin_As._mobile=true;VAA_View_Admin_As.mobile()}VAA_View_Admin_As.maxHeightListenerElements.each(function(){$(this).parents(".menupop").on("mouseenter",function(){VAA_View_Admin_As.autoMaxHeight()})})});$document.on("click touchend",VAA_View_Admin_As.prefix+".vaa-reset-item > .ab-item",function(e){e.preventDefault();if(true===VAA_View_Admin_As._touchmove){return}if("vaa_reload"===$("button",this).attr("name")){window.location.reload()}else{VAA_View_Admin_As.ajax({reset:true},true);return false}});$.each(VAA_View_Admin_As.view_types,function(index,type){$document.on("click touchend",VAA_View_Admin_As.prefix+".vaa-"+type+"-item > a.ab-item",function(e){if(true===VAA_View_Admin_As._touchmove){return}e.preventDefault();var $this=$(this);if(VAA_View_Admin_As._mobile&&$this.parent().hasClass("menupop")&&!$this.next().is(":visible")){$this.next().show().parent().addClass("active");return}if(!$this.parent().hasClass("not-a-view")){var view_data={},val=$this.attr("rel");if(!val){val=$this.find(".vaa-view-data").attr("data-view-value")}view_data[type]=VAA_View_Admin_As.json_decode(val);view_data="object"===typeof view_data[type]?view_data[type]:view_data;VAA_View_Admin_As.ajax(view_data,true);return false}})});$document.on("click touchend",VAA_View_Admin_As.prefix+".remove",function(e){e.preventDefault();if(true===VAA_View_Admin_As._touchmove){return}$(this).parent().slideUp("fast",function(){$(this).remove()})})};VAA_View_Admin_As.mobile=function(){var prefix=".vaa-mobile "+VAA_View_Admin_As.prefix;$document.on("click touchend",prefix+" > .ab-sub-wrapper .ab-item",function(e){if(true===VAA_View_Admin_As._touchmove){return}e.preventDefault();e.stopPropagation();var $sub=$(this).parent(".menupop").children(".ab-sub-wrapper");if($sub.length){if($sub.hasClass("active")){$sub.slideUp("fast");$sub.removeClass("active")}else{$sub.slideDown("fast");$sub.addClass("active")}}});$document.on("click touchend",prefix+"input, "+prefix+"textarea, "+prefix+"select",function(e){if(true===VAA_View_Admin_As._touchmove){return}e.stopPropagation();var $this=$(this);if($this.is('[type="checkbox"]')){e.preventDefault();if($this.is(":checked")){$this.prop("checked",false)}else{$this.prop("checked",true)}$this.trigger("change");return false}else if($this.is('[type="radio"]')){e.preventDefault();$('input[name="'+$this.attr["name"]+'"]').removeAttr("checked");$this.prop("checked",true);$this.trigger("change");return false}return true});$document.on("click touchend",prefix+"label",function(e){if(true===VAA_View_Admin_As._touchmove){return}e.preventDefault();e.stopPropagation();$("#"+$(this).attr("for")).trigger(e.type);return false})};VAA_View_Admin_As.overlay=function(html){var $overlay=$("#vaa-overlay");if(!$overlay.length){html='
    '+html+"
    ";$body.append(html);$overlay=$("body #vaa-overlay")}else if(html.length){$overlay.html(html)}$overlay.fadeIn("fast")};VAA_View_Admin_As.ajax=function(data,refresh){$(".vaa-notice","#wpadminbar").remove();var loader_icon=VAA_View_Admin_As.siteurl+"/wp-includes/images/spinner-2x.gif";VAA_View_Admin_As.overlay('');var post_data={action:"view_admin_as",_vaa_nonce:VAA_View_Admin_As._vaa_nonce,view_admin_as:JSON.stringify(data)};var isView=false;$.each(VAA_View_Admin_As.view_types,function(index,type){if("undefined"!==typeof data[type]){isView=true;return true}});if($(VAA_View_Admin_As.prefix+"#vaa-settings-view-mode-single").is(":checked")&&isView){$body.append('');var form=$("#vaa_single_mode_form");form.append('');form.append('');form.append('');form.find("#data").val(post_data.view_admin_as);form.submit()}else{$.post(VAA_View_Admin_As.ajaxurl,post_data,function(response){var success=response.hasOwnProperty("success")&&true===response.success,data={},display=false;if(true===VAA_View_Admin_As._debug){console.log(response)}if(response.hasOwnProperty("data")){if("object"===typeof response.data){data=response.data;if(data.hasOwnProperty("display")){display=data.display}}}if(success){if(refresh){VAA_View_Admin_As.refresh(data);return}else{if(!data.hasOwnProperty("text")){data.text=VAA_View_Admin_As.__success}}}if(!data.hasOwnProperty("type")){if(success){data.type="success"}else{data.type="error"}}if("popup"===display){VAA_View_Admin_As.popup(data,data.type)}else{if(!data.hasOwnProperty("text")){data.text=response.data}VAA_View_Admin_As.notice(String(data.text),data.type,5e3);$("body #vaa-overlay").addClass(data.type).fadeOut("fast",function(){$(this).remove()})}})}};VAA_View_Admin_As.refresh=function(data){if(data.hasOwnProperty("redirect")){window.location.replace(String(data.redirect))}else{window.location.hash="";window.location.reload()}};VAA_View_Admin_As.notice=function(notice,type,timeout){var root="#wpadminbar .vaa-notice",html=notice+'';type="undefined"===typeof type?"notice":type;timeout="undefined"===typeof timeout?5e3:timeout;if(VAA_View_Admin_As._mobile){html='";$(VAA_View_Admin_As.prefix+"> .ab-sub-wrapper").prepend(html).children(".vaa-notice").slideDown("fast");$("html, body").animate({scrollTop:"0"});if(timeout){setTimeout(function(){$(root).slideUp("fast",function(){$(this).remove()})},timeout)}}else{html='
  • '+html+"
  • ";$("#wp-admin-bar-top-secondary").append(html);$(root+" .remove").click(function(){$(this).parent().remove()});if(timeout){setTimeout(function(){$(root).fadeOut("fast",function(){$(this).remove()})},timeout)}}};VAA_View_Admin_As.item_notice=function(parent,notice,type,timeout){var root=".vaa-notice",html=notice+'',$element=$(parent);type="undefined"===typeof type?"notice":type;timeout="undefined"===typeof timeout?5e3:timeout;html='";$element.append(html).children(".vaa-notice").slideDown("fast");if(timeout){setTimeout(function(){$(root,$element).slideUp("fast",function(){$(this).remove()})},timeout)}};VAA_View_Admin_As.item_confirm=function(parent,text){$(parent).find(".vaa-notice").slideUp("fast",function(){$(this).remove()});text='";VAA_View_Admin_As.item_notice(parent,text,"warning",0);return $(parent).find(".vaa-confirm")};VAA_View_Admin_As.popup=function(data,type){type="undefined"===typeof type?"notice":type;var html="";html+='
    ';html+='';html+='
    ';if("object"!==typeof data){data={text:data}}if(data.hasOwnProperty("text")){html+="

    "+String(data.text)+"

    "}if(data.hasOwnProperty("list")){html+="
      ";data.list.forEach(function(item){html+="
    • "+String(item)+"
    • "});html+="
    "}if(data.hasOwnProperty("textarea")){html+='"}html+="
    ";VAA_View_Admin_As.overlay(html);var root="body #vaa-overlay",$overlay=$(root),$overlayContainer=$(root+" .vaa-overlay-container"),$popupResponse=$(root+" .vaa-response-data");$(root+" .vaa-overlay-container .remove").click(function(){$overlay.fadeOut("fast",function(){$(this).remove()})});$document.on("mouseup",function(e){$(root+" .vaa-overlay-container").each(function(){if(!$(this).is(e.target)&&0===$(this).has(e.target).length){$overlay.fadeOut("fast",function(){$(this).remove()})}})});var textarea=$("textarea",$popupResponse);if(textarea.length){textarea.on("click",function(){$(this).select()})}var popupMaxHeight=function(){if(textarea.length){textarea.each(function(){$(this).css({height:"auto","overflow-y":"hidden"}).height(this.scrollHeight)})}var maxHeight=$overlay.height()*.8-24;$overlayContainer.css("max-height",maxHeight);$popupResponse.css("max-height",maxHeight)};popupMaxHeight();$window.on("resize",function(){popupMaxHeight()})};VAA_View_Admin_As.init_settings=function(){var root=VAA_View_Admin_As.root+"-settings",prefix="vaa-settings",root_prefix=VAA_View_Admin_As.prefix+root;$document.on("change",root_prefix+"-admin-menu-location select#"+prefix+"-admin-menu-location",function(e){e.preventDefault();var val=$(this).val();if(val&&""!==val){var view_data={user_setting:{admin_menu_location:val}};VAA_View_Admin_As.ajax(view_data,true)}});$document.on("change",root_prefix+"-view-mode input.radio."+prefix+"-view-mode",function(e){e.preventDefault();var val=$(this).val();if(val&&""!==val){var view_data={user_setting:{view_mode:val}};VAA_View_Admin_As.ajax(view_data,false)}});$document.on("change",root_prefix+"-force-group-users input#"+prefix+"-force-group-users",function(e){e.preventDefault();var view_data={user_setting:{force_group_users:"no"}};if(this.checked){view_data={user_setting:{force_group_users:"yes"}}}VAA_View_Admin_As.ajax(view_data,true)});$document.on("change",root_prefix+"-hide-front input#"+prefix+"-hide-front",function(e){e.preventDefault();var view_data={user_setting:{hide_front:"no"}};if(this.checked){view_data={user_setting:{hide_front:"yes"}}}VAA_View_Admin_As.ajax(view_data,false)});$document.on("change",root_prefix+"-freeze-locale input#"+prefix+"-freeze-locale",function(e){e.preventDefault();var view_data={user_setting:{freeze_locale:"no"}};if(this.checked){view_data={user_setting:{freeze_locale:"yes"}}}var reload=false;if("object"===typeof VAA_View_Admin_As.view&&"undefined"!==typeof VAA_View_Admin_As.view.user){reload=true}VAA_View_Admin_As.ajax(view_data,reload)})};VAA_View_Admin_As.init_users=function(){var root=VAA_View_Admin_As.root+"-users",root_prefix=VAA_View_Admin_As.prefix+root;$document.on("keyup",root_prefix+" .ab-vaa-search.search-users input",function(){$(VAA_View_Admin_As.prefix+" .ab-vaa-search .ab-vaa-results").empty();if(1<=$(this).val().length){var inputText=$(this).val();$(VAA_View_Admin_As.prefix+".vaa-user-item").each(function(){var name=$(".ab-item",this).text();if(-1('+role+")")}}});if(""===$.trim($(VAA_View_Admin_As.prefix+".ab-vaa-search .ab-vaa-results").html())){$(VAA_View_Admin_As.prefix+".ab-vaa-search .ab-vaa-results").append('
    '+VAA_View_Admin_As.__no_users_found+"
    ")}}})};VAA_View_Admin_As.init_caps=function(){var root=VAA_View_Admin_As.root+"-caps",root_prefix=VAA_View_Admin_As.prefix+root;VAA_View_Admin_As.caps_filter_settings={selectedRole:"default",selectedRoleCaps:{},selectedRoleReverse:false,filterString:""};VAA_View_Admin_As.filter_capabilities=function(){var reverse=true===VAA_View_Admin_As.caps_filter_settings.selectedRoleReverse,isDefault="default"===VAA_View_Admin_As.caps_filter_settings.selectedRole,filterString=VAA_View_Admin_As.caps_filter_settings.filterString;$(root_prefix+"-select-options .vaa-cap-item").each(function(){var $this=$(this),exists=$("input",this).attr("value")in VAA_View_Admin_As.caps_filter_settings.selectedRoleCaps,name;$this.hide();if(reverse||exists||isDefault){if(1<=filterString.length){name=$this.text();if(-1 .ab-sub-wrapper").addClass("fullPopup");VAA_View_Admin_As.autoMaxHeight()});$document.on("click",root_prefix+" #close-caps-popup",function(){$(VAA_View_Admin_As.prefix).removeClass("fullPopupActive");$(root_prefix+"-manager > .ab-sub-wrapper").removeClass("fullPopup");VAA_View_Admin_As.autoMaxHeight()});$document.on("change",root_prefix+" .ab-vaa-select.select-role-caps select",function(){VAA_View_Admin_As.caps_filter_settings.selectedRole=$(this).val();if("default"===VAA_View_Admin_As.caps_filter_settings.selectedRole){VAA_View_Admin_As.caps_filter_settings.selectedRoleCaps={};VAA_View_Admin_As.caps_filter_settings.selectedRoleReverse=false}else{var selectedRoleElement=$(root_prefix+'-selectrolecaps #vaa-caps-selectrolecaps option[value="'+VAA_View_Admin_As.caps_filter_settings.selectedRole+'"]');VAA_View_Admin_As.caps_filter_settings.selectedRoleCaps=JSON.parse(selectedRoleElement.attr("data-caps"));VAA_View_Admin_As.caps_filter_settings.selectedRoleReverse=1===parseInt(selectedRoleElement.attr("data-reverse"),10)}VAA_View_Admin_As.filter_capabilities()});$document.on("keyup",root_prefix+" .ab-vaa-filter input",function(){VAA_View_Admin_As.caps_filter_settings.filterString=$(this).val();VAA_View_Admin_As.filter_capabilities()});$document.on("click touchend",root_prefix+" button#select-all-caps",function(e){if(true===VAA_View_Admin_As._touchmove){return}e.preventDefault();$(root_prefix+"-select-options .vaa-cap-item").each(function(){if($(this).is(":visible")){$("input",this).prop("checked",true)}});return false});$document.on("click touchend",root_prefix+" button#deselect-all-caps",function(e){if(true===VAA_View_Admin_As._touchmove){return}e.preventDefault();$(root_prefix+"-select-options .vaa-cap-item").each(function(){if($(this).is(":visible")){$("input",this).prop("checked",false)}});return false});$document.on("click touchend",root_prefix+" button#apply-caps-view",function(e){if(true===VAA_View_Admin_As._touchmove){return}e.preventDefault();var newCaps=VAA_View_Admin_As.get_selected_capabilities();VAA_View_Admin_As.ajax({caps:newCaps},true);return false})};VAA_View_Admin_As.init_module_role_defaults=function(){var root=VAA_View_Admin_As.root+"-modules",prefix="vaa-modules",root_prefix=VAA_View_Admin_As.prefix+root;$document.on("change",root_prefix+"-role-defaults-enable input#"+prefix+"-role-defaults-enable",function(e){e.preventDefault();var view_data={role_defaults:{enable:0}};if(this.checked){view_data={role_defaults:{enable:true}}}VAA_View_Admin_As.ajax(view_data,true)});root=VAA_View_Admin_As.root+"-role-defaults";prefix="vaa-role-defaults";root_prefix=VAA_View_Admin_As.prefix+root;$document.on("change",root_prefix+"-setting-register-enable input#"+prefix+"-setting-register-enable",function(e){e.preventDefault();var view_data={role_defaults:{apply_defaults_on_register:0}};if(this.checked){view_data={role_defaults:{apply_defaults_on_register:true}}}VAA_View_Admin_As.ajax(view_data,false)});$document.on("change",root_prefix+"-setting-disable-user-screen-options input#"+prefix+"-setting-disable-user-screen-options",function(e){e.preventDefault();var view_data={role_defaults:{disable_user_screen_options:0}};if(this.checked){view_data={role_defaults:{disable_user_screen_options:true}}}VAA_View_Admin_As.ajax(view_data,false)});$document.on("change",root_prefix+"-setting-lock-meta-boxes input#"+prefix+"-setting-lock-meta-boxes",function(e){e.preventDefault();var view_data={role_defaults:{lock_meta_boxes:0}};if(this.checked){view_data={role_defaults:{lock_meta_boxes:true}}}VAA_View_Admin_As.ajax(view_data,false)});$document.on("click touchend",root_prefix+"-meta-add button#"+prefix+"-meta-add",function(e){if(true===VAA_View_Admin_As._touchmove){return}e.preventDefault();var val=$(root_prefix+"-meta-add input#"+prefix+"-meta-new").val();var item=$(root_prefix+"-meta-add #"+prefix+"-meta-template").html().toString();val=val.replace(/ /g,"_");item=item.replace(/vaa_new_item/g,val);if($(root_prefix+'-meta-select input[value="'+val+'"]').length){VAA_View_Admin_As.item_notice($(this).parent(),VAA_View_Admin_As.__key_already_exists,"error",2e3)}else{$(root_prefix+"-meta-select > .ab-item").prepend(item)}});$document.on("click touchend",root_prefix+"-meta-apply button#"+prefix+"-meta-apply",function(e){if(true===VAA_View_Admin_As._touchmove){return}e.preventDefault();var val={};$(root_prefix+"-meta-select .ab-item.vaa-item input").each(function(){val[$(this).val()]=$(this).is(":checked")});if(val){var view_data={role_defaults:{update_meta:val}};VAA_View_Admin_As.ajax(view_data,false)}return false});$document.on("keyup",root_prefix+"-bulk-users-filter input#"+prefix+"-bulk-users-filter",function(e){e.preventDefault();if(1<=$(this).val().length){var inputText=$(this).val();$(root_prefix+"-bulk-users-select .ab-item.vaa-item").each(function(){var name=$(".user-name",this).text();if(-1"+err+"","error")}}return false});$document.on("click touchend",root_prefix+"-clear-roles-apply button#"+prefix+"-clear-roles-apply",function(e){if(true===VAA_View_Admin_As._touchmove){return}e.preventDefault();var val=$(root_prefix+"-clear-roles-select select#"+prefix+"-clear-roles-select").val();if(val&&""!==val){var view_data={role_defaults:{clear_role_defaults:val}},confirm=VAA_View_Admin_As.item_confirm($(this).parent(),VAA_View_Admin_As.__confirm);$(confirm).on("click",function(){VAA_View_Admin_As.ajax(view_data,false)})}return false})};VAA_View_Admin_As.init_module_role_manager=function(){var root=VAA_View_Admin_As.root+"-modules",prefix="vaa-modules",root_prefix=VAA_View_Admin_As.prefix+root;$document.on("change",root_prefix+"-role-manager-enable input#"+prefix+"-role-manager-enable",function(e){e.preventDefault();var view_data={role_manager:{enable:0}};if(this.checked){view_data={role_manager:{enable:true}}}VAA_View_Admin_As.ajax(view_data,true)});root=VAA_View_Admin_As.root+"-role-manager";prefix="vaa-role-manager";root_prefix=VAA_View_Admin_As.prefix+root;$document.on("click touchend",root_prefix+"-apply-view-apply button#"+prefix+"-apply-view-apply",function(e){if(true===VAA_View_Admin_As._touchmove){return}e.preventDefault();var role=$(root_prefix+"-apply-view-select select#"+prefix+"-apply-view-select").val();var capabilities=JSON.parse($(this).attr("data-view-caps"));if(role&&""!==role&&capabilities){var view_data={role_manager:{apply_view_to_role:{role:role,capabilities:capabilities}}};VAA_View_Admin_As.ajax(view_data,true)}return false});$document.on("click touchend",root_prefix+"-rename-apply button#"+prefix+"-rename-apply",function(e){if(true===VAA_View_Admin_As._touchmove){return}e.preventDefault();var role=$(root_prefix+"-rename-select select#"+prefix+"-rename-select").val();var new_name=$(root_prefix+"-rename-input input#"+prefix+"-rename-input").val();if(role&&""!==role&&new_name&&""!==new_name){var view_data={role_manager:{rename_role:{role:role,new_name:new_name}}};VAA_View_Admin_As.ajax(view_data,true)}return false});$document.on("click touchend",root_prefix+"-clone-apply button#"+prefix+"-clone-apply",function(e){if(true===VAA_View_Admin_As._touchmove){return}e.preventDefault();var role=$(root_prefix+"-clone-select select#"+prefix+"-clone-select").val();var new_role=$(root_prefix+"-clone-input input#"+prefix+"-clone-input").val();if(role&&""!==role&&new_role&&""!==new_role){var view_data={role_manager:{clone_role:{role:role,new_role:new_role}}};VAA_View_Admin_As.ajax(view_data,true)}return false});$document.on("click touchend",root_prefix+"-delete-apply button#"+prefix+"-delete-apply",function(e){if(true===VAA_View_Admin_As._touchmove){return}e.preventDefault();var val=$(root_prefix+"-delete-select select#"+prefix+"-delete-select").val();if(val&&""!==val){var view_data={role_manager:{delete_role:val}},confirm=VAA_View_Admin_As.item_confirm($(this).parent(),VAA_View_Admin_As.__confirm);$(confirm).on("click",function(){VAA_View_Admin_As.ajax(view_data,true)})}return false});var caps_root=VAA_View_Admin_As.root+"-caps-manager-role-manager",caps_prefix="vaa-caps-manager-role-manager",caps_root_prefix=VAA_View_Admin_As.prefix+caps_root;$document.on("change",caps_root_prefix+" select#"+caps_prefix+"-edit-role",function(){var $this=$(this),role=$this.val(),caps={},selectedRoleElement=$(caps_root_prefix+" select#"+caps_prefix+'-edit-role option[value="'+role+'"]');if(selectedRoleElement.attr("data-caps")){caps=JSON.parse(selectedRoleElement.attr("data-caps"))}VAA_View_Admin_As.caps_filter_settings.selectedRole="default";VAA_View_Admin_As.caps_filter_settings.selectedRoleCaps={};VAA_View_Admin_As.caps_filter_settings.selectedRoleReverse=false;VAA_View_Admin_As.filter_capabilities();VAA_View_Admin_As.set_selected_capabilities(caps)});$document.on("click touchend",caps_root_prefix+" button#"+caps_prefix+"-save-role",function(e){if(true===VAA_View_Admin_As._touchmove){return}e.preventDefault();var role=$(caps_root_prefix+" select#"+caps_prefix+"-edit-role").val(),refresh=false;if(!role){return false}if("__new__"===role){role=$(caps_root_prefix+" input#"+caps_prefix+"-new-role").val();refresh=true}var data={role:role,capabilities:VAA_View_Admin_As.get_selected_capabilities()};VAA_View_Admin_As.ajax({role_manager:{save_role:data}},refresh);return false});$document.on("click touchend",caps_root_prefix+"-new-cap button#"+caps_prefix+"-add-cap",function(e){if(true===VAA_View_Admin_As._touchmove){return}e.preventDefault();var existing=VAA_View_Admin_As.get_selected_capabilities();var val=$(caps_root_prefix+"-new-cap input#"+caps_prefix+"-new-cap").val();var item=$(caps_root_prefix+"-new-cap #"+caps_prefix+"-cap-template").html().toString();val=val.replace(/ /g,"_");item=item.replace(/vaa_new_item/g,val);if("undefined"!==typeof existing[val]){VAA_View_Admin_As.item_notice($(this).parent(),VAA_View_Admin_As.__key_already_exists,"error",2e3)}else{$(VAA_View_Admin_As.root+"-caps-select-options > .ab-item").prepend(item)}})};VAA_View_Admin_As.autoMaxHeight=function(){setTimeout(function(){var scrollTop="undefined"!==typeof window.pageYOffset?window.pageYOffset:(document.documentElement||document.body.parentNode||document.body).scrollTop;VAA_View_Admin_As.maxHeightListenerElements.each(function(){var $element=$(this),count=0,wait=setInterval(function(){var offset=$element.offset(),offsetTop=offset.top-scrollTop;if($element.is(":visible")&&0 Date: Fri, 28 Apr 2017 15:39:59 +0200 Subject: [PATCH 52/57] Make use of the `user_has_cap` filter --- includes/class-view.php | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/includes/class-view.php b/includes/class-view.php index 1ce3e0ca..42dfd833 100644 --- a/includes/class-view.php +++ b/includes/class-view.php @@ -164,14 +164,18 @@ public function init_user_modifications() { add_filter( 'get_user_metadata' , array( $this, 'filter_overrule_get_user_metadata' ), 999999999, 3 ); /** - * Change the capabilities (map_meta_cap is better for compatibility with network admins). + * Map the capabilities (map_meta_cap is used for compatibility with network admins). * * @since 0.1 */ add_filter( 'map_meta_cap', array( $this, 'filter_map_meta_cap' ), 999999999, 3 ); //4 - // @todo maybe also use the user_has_cap filter? - //add_filter( 'user_has_cap', array( $this, 'filter_user_has_cap' ), 999999999, 4 ); + /** + * Change the capabilities. + * + * @since 1.7.1 + */ + add_filter( 'user_has_cap', array( $this, 'filter_user_has_cap' ), 999999999, 4 ); $done = true; } From 1db321fa16a271b86e3cdc677418dabd7213eac5 Mon Sep 17 00:00:00 2001 From: JoryHogeveen Date: Fri, 28 Apr 2017 15:57:57 +0200 Subject: [PATCH 53/57] filter_user_has_cap(): Cast to array to prevent other type return --- includes/class-view.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/includes/class-view.php b/includes/class-view.php index 42dfd833..5dafa303 100644 --- a/includes/class-view.php +++ b/includes/class-view.php @@ -400,10 +400,10 @@ public function filter_map_meta_cap( $caps, $cap, $user_id ) { */ public function filter_user_has_cap( $allcaps, $caps, $args, $user = null ) { $user_id = ( $user ) ? $user->ID : $args[1]; - if ( ! is_numeric( $user_id ) || (int) $user_id !== (int) $this->store->get_selectedUser()->ID ) { - return $allcaps; + if ( is_numeric( $user_id ) && (int) $user_id === (int) $this->store->get_selectedUser()->ID ) { + return (array) $this->store->get_selectedCaps(); } - return $this->store->get_selectedCaps(); + return $allcaps; } /** From 4e289fadd828c34ccf74f809028fc13944a6f15c Mon Sep 17 00:00:00 2001 From: JoryHogeveen Date: Fri, 28 Apr 2017 20:36:05 +0200 Subject: [PATCH 54/57] Update licence URL --- view-admin-as.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/view-admin-as.php b/view-admin-as.php index bb88e582..9f7fc500 100644 --- a/view-admin-as.php +++ b/view-admin-as.php @@ -17,7 +17,7 @@ * Text Domain: view-admin-as * Domain Path: /languages/ * License: GPL-2.0+ - * License URI: http://www.gnu.org/licenses/gpl-2.0.txt + * License URI: http://www.gnu.org/licenses/gpl-2.0.html * GitHub Plugin URI: https://github.com/JoryHogeveen/view-admin-as * * @copyright 2015-2017 Jory Hogeveen From cd59a7572c74f1a8842c99a63f21635a66a9b38e Mon Sep 17 00:00:00 2001 From: JoryHogeveen Date: Fri, 28 Apr 2017 22:43:43 +0200 Subject: [PATCH 55/57] 1.7.1-rc2 --- includes/class-controller.php | 38 +++++++++++++++++------------------ includes/class-store.php | 6 +++--- includes/class-vaa.php | 2 +- includes/class-view.php | 18 ++++++++--------- readme.txt | 1 + view-admin-as.php | 6 +++--- 6 files changed, 35 insertions(+), 36 deletions(-) diff --git a/includes/class-controller.php b/includes/class-controller.php index 89aa0839..c3d0add9 100644 --- a/includes/class-controller.php +++ b/includes/class-controller.php @@ -256,12 +256,12 @@ private function ajax_handler( $data ) { } /** - * Update regular view types + * Update regular view types. * * @since 1.7 - * @param null $null Null. - * @param mixed $data The view data. - * @param string $type The view type. + * @param null $null Null. + * @param mixed $data The view data. + * @param string $type The view type. * @return mixed */ public function filter_update_view( $null, $data, $type ) { @@ -282,13 +282,13 @@ public function filter_update_view( $null, $data, $type ) { } /** - * Handles the caps view since it's a bit more complex + * Handles the caps view since it's a bit more complex. * * @since 1.7 * @access public - * @param null $null Null. - * @param mixed $data The view data. - * @param string $type The view type. + * @param null $null Null. + * @param mixed $data The view data. + * @param string $type The view type. * @return bool */ public function filter_update_view_caps( $null, $data, $type ) { @@ -371,7 +371,7 @@ public function is_view_type( $type ) { } /** - * Get the available view types + * Get the available view types. * * @since 1.7 * @access public @@ -421,7 +421,7 @@ private function get_view() { if ( $request && 'browse' === $view_mode ) { $this->store->set_view( $this->validate_view_data( $request ) ); $this->update_view(); - // Trigger page refresh + // Trigger page refresh. // @todo fix WP referrer/nonce checks and allow switching on any page without ajax. See VAA_API. if ( is_network_admin() ) { wp_redirect( network_admin_url() ); @@ -662,12 +662,12 @@ public function validate_view_data( $data ) { } /** - * Validate data for role view type + * Validate data for role view type. * * @since 1.7 * @access public - * @param null $null Default return (invalid) - * @param mixed $data The view data + * @param null $null Default return (invalid). + * @param mixed $data The view data. * @return mixed */ public function validate_view_data_caps( $null, $data ) { @@ -690,12 +690,12 @@ public function validate_view_data_caps( $null, $data ) { } /** - * Validate data for role view type + * Validate data for role view type. * * @since 1.7 * @access public - * @param null $null Default return (invalid) - * @param mixed $data The view data + * @param null $null Default return (invalid). + * @param mixed $data The view data. * @return mixed */ public function validate_view_data_role( $null, $data ) { @@ -707,12 +707,12 @@ public function validate_view_data_role( $null, $data ) { } /** - * Validate data for user view type + * Validate data for user view type. * * @since 1.7 * @access public - * @param null $null Default return (invalid) - * @param mixed $data The view data + * @param null $null Default return (invalid). + * @param mixed $data The view data. * @return mixed */ public function validate_view_data_user( $null, $data ) { diff --git a/includes/class-store.php b/includes/class-store.php index a8be14d0..2f4d6240 100644 --- a/includes/class-store.php +++ b/includes/class-store.php @@ -219,7 +219,7 @@ public function store_roles() { } } - // @since 1.6.4 Set role names + // @since 1.6.4 Set role names. $role_names = array(); foreach ( $roles as $role_key => $role ) { if ( isset( $wp_roles->role_names[ $role_key ] ) ) { @@ -411,8 +411,8 @@ public function store_users() { * Reduces the amount of queries while the end result is the same. * * @since 1.5.2 - * @See wp-includes/capabilities.php >> get_super_admins() - * @See wp-includes/capabilities.php >> is_super_admin() + * @see get_super_admins() >> wp-includes/capabilities.php + * @see is_super_admin() >> wp-includes/capabilities.php * @link https://developer.wordpress.org/reference/functions/is_super_admin/ */ if ( is_multisite() && in_array( $user->user_login, (array) $super_admins, true ) ) { diff --git a/includes/class-vaa.php b/includes/class-vaa.php index 44b0629c..b93be929 100644 --- a/includes/class-vaa.php +++ b/includes/class-vaa.php @@ -214,7 +214,7 @@ private function run() { $this->controller = VAA_View_Admin_As_Controller::get_instance( $this ); $this->view = VAA_View_Admin_As_View::get_instance( $this ); - $this->store->init(); + $this->store->init( true ); // Sets enabled. $this->validate_user(); diff --git a/includes/class-view.php b/includes/class-view.php index 5dafa303..082d692b 100644 --- a/includes/class-view.php +++ b/includes/class-view.php @@ -16,8 +16,8 @@ * @author Jory Hogeveen * @package View_Admin_As * @since 1.6 - * @since 1.7 Class got split up: data handling/updating is now in VAA_View_Admin_As_Controller - * @version 1.7 + * @since 1.7 Class got split up: data handling/updating is now in VAA_View_Admin_As_Controller. + * @version 1.7.1 * @uses VAA_View_Admin_As_Class_Base Extends class */ final class VAA_View_Admin_As_View extends VAA_View_Admin_As_Class_Base @@ -117,7 +117,6 @@ private function do_view() { /** * Force own locale on view. - * * @since 1.6.1 */ if ( 'yes' === $this->store->get_userSettings( 'freeze_locale' ) @@ -143,36 +142,31 @@ public function init_user_modifications() { /** * Make sure the $current_user view data isn't overwritten again by switch_blog functions. - * - * @see This filter is documented in wp-includes/ms-blogs.php + * @see This filter is documented in wp-includes/ms-blogs.php * @since 1.6.3 */ add_action( 'switch_blog', array( $this, 'modify_user' ) ); /** * Prevent some meta updates for the current user while in modification to the current user are active. - * * @since 1.6.3 */ add_filter( 'update_user_metadata' , array( $this, 'filter_prevent_update_user_metadata' ), 999999999, 3 ); /** * Get capabilities and user level from current user view object instead of database. - * * @since 1.6.4 */ add_filter( 'get_user_metadata' , array( $this, 'filter_overrule_get_user_metadata' ), 999999999, 3 ); /** * Map the capabilities (map_meta_cap is used for compatibility with network admins). - * * @since 0.1 */ add_filter( 'map_meta_cap', array( $this, 'filter_map_meta_cap' ), 999999999, 3 ); //4 /** * Change the capabilities. - * * @since 1.7.1 */ add_filter( 'user_has_cap', array( $this, 'filter_user_has_cap' ), 999999999, 4 ); @@ -340,7 +334,7 @@ public function filter_overrule_get_user_metadata( $null, $object_id, $meta_key } if ( $meta_key === $wpdb->get_blog_prefix() . 'user_level' ) { if ( ! isset( $user->user_level ) ) { - // Make sure the key exists. Result will be filtered in `filter_prevent_update_user_metadata()` + // Make sure the key exists. Result will be filtered in `filter_prevent_update_user_metadata()`. $user->update_user_level_from_caps(); } return array( $user->user_level ); @@ -390,6 +384,8 @@ public function filter_map_meta_cap( $caps, $cap, $user_id ) { * Overwrite the user's capabilities. * * @since 1.6.3 + * @access public + * * @param array $allcaps All the capabilities of the user. * @param array $caps Actual capabilities for meta capability. * @param array $args [0] Requested capability. @@ -410,6 +406,8 @@ public function filter_user_has_cap( $allcaps, $caps, $args, $user = null ) { * Similar function to current_user_can(). * * @since 1.6.2 + * @access public + * * @param string $cap The capability. * @param array $caps (optional) Capabilities to compare to. * Defaults to the selected caps for the current view. diff --git a/readme.txt b/readme.txt index 49d29fb8..b9ae8416 100644 --- a/readme.txt +++ b/readme.txt @@ -179,6 +179,7 @@ Note: if your admin users aren't safe, this plugin is the last one to worry abou * Feature: Module Role Manager: Rename roles. [#47](https://github.com/JoryHogeveen/view-admin-as/issues/47) * Enhancement/Compatibility: Improve fetching available capabilities for super admin. It now alse checks for custom post type and taxonomy capabilities and more other plugins. +* Compatibility: Also use the `user_has_cap` filter besides `map_meta_cap` to further improve compatibility. * UI: Add submenu scrollbar when there are too much users under a role. [#49](https://github.com/JoryHogeveen/view-admin-as/issues/49) * UI: Module Role Manager: Show original role name for reference. * Accessibility: Fix tabindex for some nodes that have form elements. diff --git a/view-admin-as.php b/view-admin-as.php index 9f7fc500..fa8b7259 100644 --- a/view-admin-as.php +++ b/view-admin-as.php @@ -3,7 +3,7 @@ * @author Jory Hogeveen * @package View_Admin_As * @since 0.1 - * @version 1.7.1-rc1 + * @version 1.7.1-rc2 * @licence GPL-2.0+ * @link https://github.com/JoryHogeveen/view-admin-as * @@ -11,7 +11,7 @@ * Plugin Name: View Admin As * Plugin URI: https://wordpress.org/plugins/view-admin-as/ * Description: View the WordPress admin as a different role or visitor, switch between users, temporarily change your capabilities, set default screen settings for roles. - * Version: 1.7.1-rc1 + * Version: 1.7.1-rc2 * Author: Jory Hogeveen * Author URI: https://www.keraweb.nl * Text Domain: view-admin-as @@ -44,7 +44,7 @@ if ( ! class_exists( 'VAA_View_Admin_As' ) ) { - define( 'VIEW_ADMIN_AS_VERSION', '1.7.1-rc1' ); + define( 'VIEW_ADMIN_AS_VERSION', '1.7.1-rc2' ); define( 'VIEW_ADMIN_AS_DB_VERSION', '1.7' ); define( 'VIEW_ADMIN_AS_FILE', __FILE__ ); define( 'VIEW_ADMIN_AS_BASENAME', plugin_basename( VIEW_ADMIN_AS_FILE ) ); From a76977331c31c8a5bd0edba1e594840f6659fbed Mon Sep 17 00:00:00 2001 From: JoryHogeveen Date: Sat, 29 Apr 2017 18:12:54 +0200 Subject: [PATCH 56/57] Readme and changelog improvements --- README.md | 5 +-- readme.txt | 100 ++++++++++++++++++++++++++--------------------------- 2 files changed, 53 insertions(+), 52 deletions(-) diff --git a/README.md b/README.md index e4b030ee..1a9f1f85 100644 --- a/README.md +++ b/README.md @@ -37,14 +37,15 @@ It also features a "Role manager" module to add, edit or remove roles and grant * Disable the "screen settings" option and/or lock the meta boxes for all users that don't have access to this plugin ### Module: Role manager (role editor) + +*Note: Changes made with the Role Manager are permanent!* + * Add, edit or delete roles * Grant and/or add capabilities to roles * Rename roles * Clone roles * Update role capabilities from current view -*Note: Changes made with the Role Manager are permanent!* - ## Compatibility This plugin will work with most other plugins but these are tested: diff --git a/readme.txt b/readme.txt index b9ae8416..f2256572 100644 --- a/readme.txt +++ b/readme.txt @@ -39,14 +39,14 @@ It also features a "Role manager" module to add, edit or remove roles and grant = Module: Role manager (role editor) = +*Note: Changes made with the Role Manager are permanent!* + * Add, edit or delete roles * Grant and/or add capabilities to roles * Rename roles * Clone roles * Update role capabilities from current view -*Note: Changes made with the Role Manager are permanent!* - = Compatibility & Integrations = This plugin will work with most other plugins but these are tested: @@ -94,7 +94,7 @@ This plugin is also useful to support your clients and/or users. For example; ma Installation of this plugin works like any other plugin out there. Either: -1. Upload the zip file to the '/wp-content/plugins/' directory +1. Upload and unpack the zip file to the '/wp-content/plugins/' directory 2. Activate the plugin through the 'Plugins' menu in WordPress Or search for "View Admin As" via your plugins menu. @@ -177,87 +177,87 @@ Note: if your admin users aren't safe, this plugin is the last one to worry abou = 1.7.1 = -* Feature: Module Role Manager: Rename roles. [#47](https://github.com/JoryHogeveen/view-admin-as/issues/47) -* Enhancement/Compatibility: Improve fetching available capabilities for super admin. It now alse checks for custom post type and taxonomy capabilities and more other plugins. -* Compatibility: Also use the `user_has_cap` filter besides `map_meta_cap` to further improve compatibility. -* UI: Add submenu scrollbar when there are too much users under a role. [#49](https://github.com/JoryHogeveen/view-admin-as/issues/49) -* UI: Module Role Manager: Show original role name for reference. -* Accessibility: Fix tabindex for some nodes that have form elements. -* Other minor core improvements. +* **Feature:** Module Role Manager: Rename roles. [#47](https://github.com/JoryHogeveen/view-admin-as/issues/47) +* **Enhancement:** Improve fetching available capabilities for super admin. It now alse checks for custom post type and taxonomy capabilities and more other plugins. +* **Compatibility:** Also use the `user_has_cap` filter besides `map_meta_cap` to further improve compatibility. +* **UI:** Add submenu scrollbar when there are too much users under a role. [#49](https://github.com/JoryHogeveen/view-admin-as/issues/49) +* **UI:** Module Role Manager: Show original role name for reference. +* **Accessibility:** Fix tabindex for some nodes that have form elements. +* **Updated:** Screenshots. Detailed info: [PR on GitHub](https://github.com/JoryHogeveen/view-admin-as/pull/48) = 1.7 = -* Feature: New module Role manager. Add, edit and/or remove roles and grant or deny them capabilities. [#43](https://github.com/JoryHogeveen/view-admin-as/issues/43) -* Feature: Module Role Defaults: Added the option to copy defaults from one role to another (or multiple). [#44](https://github.com/JoryHogeveen/view-admin-as/issues/44) -* Enhancement/UI: Enable and Improve responsive styles/a11y. [#16](https://github.com/JoryHogeveen/view-admin-as/issues/16) -* Enhancement/UI: Improved the autoHeight calculation (submenu and popup). -* Enhancement: View combinations now working in code (No UI). [#18](https://github.com/JoryHogeveen/view-admin-as/issues/18) -* Enhancement: Major code refactoring for better standards en easier development. -* Maintenance: Validated compatibility with "Restrict User Access" (RUA) plugin v0.14. [#31](https://github.com/JoryHogeveen/view-admin-as/issues/31) -* Compatibility: Tested with WordPress 4.8 (alpha) and requires WordPress 4.1 or higher (was 3.5). -* Fix: Fixed all major [CodeClimate](https://codeclimate.com/github/JoryHogeveen/view-admin-as) issues. All green now! -* [Wiki (documentation) updated](https://github.com/JoryHogeveen/view-admin-as/wiki). -* Screenshots & Banners updated. +* **Feature:** New module Role manager. Add, edit and/or remove roles and grant or deny them capabilities. [#43](https://github.com/JoryHogeveen/view-admin-as/issues/43) +* **Feature:** Module Role Defaults: Added the option to copy defaults from one role to another (or multiple). [#44](https://github.com/JoryHogeveen/view-admin-as/issues/44) +* **Enhancement/UI:** Enable and Improve responsive styles/a11y. [#16](https://github.com/JoryHogeveen/view-admin-as/issues/16) +* **Enhancement/UI:** Improved the autoHeight calculation (submenu and popup). +* **Enhancement:** View combinations now working in code (No UI). [#18](https://github.com/JoryHogeveen/view-admin-as/issues/18) +* **Enhancement:** Major code refactoring for better standards en easier development. +* **Maintenance:** Validated compatibility with "Restrict User Access" (RUA) plugin v0.14. [#31](https://github.com/JoryHogeveen/view-admin-as/issues/31) +* **Compatibility:** Tested with WordPress 4.8 (alpha) and requires WordPress 4.1 or higher (was 3.5). +* **Fix:** Fixed all major [CodeClimate](https://codeclimate.com/github/JoryHogeveen/view-admin-as) issues. All green now! +* **Updated:** [Wiki (documentation)](https://github.com/JoryHogeveen/view-admin-as/wiki). +* **Updated/Added:** Screenshots & Banners. Detailed info: [PR on GitHub](https://github.com/JoryHogeveen/view-admin-as/pull/42) = 1.6.4 = -* Feature: Integration with the "Restrict User Access" (RUA) plugin. Introduces a new view type "access levels" when this plugin is activated. [#31](https://github.com/JoryHogeveen/view-admin-as/issues/31) -* Enhancement: Improve compatibility with plugins that use the current user object. Related: [#32](https://github.com/JoryHogeveen/view-admin-as/issues/32) -* Enhancement: Improve compatibility with plugins that use the role objects. -* Enhancement: Redirect to homepage when selecting the visitor view. -* Enhancement: Integrate with the capability groups in plugin "User Role Editor". -* Fix: Started to use CodeClimate for style checks + applied fixes. [#37](https://github.com/JoryHogeveen/view-admin-as/issues/37) +* **Feature:** Integration with the "Restrict User Access" (RUA) plugin. Introduces a new view type "access levels" when this plugin is activated. [#31](https://github.com/JoryHogeveen/view-admin-as/issues/31) +* **Enhancement:** Improve compatibility with plugins that use the current user object. Related: [#32](https://github.com/JoryHogeveen/view-admin-as/issues/32) +* **Enhancement:** Improve compatibility with plugins that use the role objects. +* **Enhancement:** Redirect to homepage when selecting the visitor view. +* **Enhancement:** Integrate with the capability groups in plugin "User Role Editor". +* **Fix:** Started to use CodeClimate for style checks + applied fixes. [#37](https://github.com/JoryHogeveen/view-admin-as/issues/37) Detailed info: [PR on GitHub](https://github.com/JoryHogeveen/view-admin-as/pull/36) & [RUA integration PR on GitHub](https://github.com/JoryHogeveen/view-admin-as/pull/34) = 1.6.3 = -* Feature: Meta sync manager UI for the role defaults module [#28](https://github.com/JoryHogeveen/view-admin-as/issues/28) -* Feature: Multiple import methods for the role defaults module [#27](https://github.com/JoryHogeveen/view-admin-as/issues/27) -* Enhancement: Also update the current user object's capabilities and roles to improve support for other plugins [#32](https://github.com/JoryHogeveen/view-admin-as/issues/32) +* **Feature:** Meta sync manager UI for the role defaults module [#28](https://github.com/JoryHogeveen/view-admin-as/issues/28) +* **Feature:** Multiple import methods for the role defaults module [#27](https://github.com/JoryHogeveen/view-admin-as/issues/27) +* **Enhancement:** Also update the current user object's capabilities and roles to improve support for other plugins [#32](https://github.com/JoryHogeveen/view-admin-as/issues/32) * Other minor improvements Detailed info: [PR on GitHub](https://github.com/JoryHogeveen/view-admin-as/pull/29) = 1.6.2 = -* Feature: A new view! You can now see your site as an unregistered visitor (no need to switch browsers) [#14](https://github.com/JoryHogeveen/view-admin-as/issues/14) -* Enhancement: Reduced queries for getting the available users to **1**! *Performance improvement to the native WP function `get_users()` (with fallback if needed)* [#24](https://github.com/JoryHogeveen/view-admin-as/issues/24) -* Enhancement: Add all existing roles that have defaults to the clear list even if they have been removed from WP [#22](https://github.com/JoryHogeveen/view-admin-as/issues/22) -* Enhancement: Enable the current view as a capability filter -* Enhancement: Highlight the view capabilities in the capability menu -* Enhancement: Pass view data as JSON *(enhances compatibility with weird capability identifiers since WP doesn't escape these so it could contain special characters)* -* Enhancement/Fix: Compatibility with the `editable_roles` filter for non super admins -* Fix: Hide our toolbar in the customizer preview. Switching in the WP Customizer not possible (yet) -* Fix: Improve capability view handling +* **Feature:** A new view! You can now see your site as an unregistered visitor (no need to switch browsers) [#14](https://github.com/JoryHogeveen/view-admin-as/issues/14) +* **Enhancement:** Reduced queries for getting the available users to **1**! *Performance improvement to the native WP function `get_users()` (with fallback if needed)* [#24](https://github.com/JoryHogeveen/view-admin-as/issues/24) +* **Enhancement:** Add all existing roles that have defaults to the clear list even if they have been removed from WP [#22](https://github.com/JoryHogeveen/view-admin-as/issues/22) +* **Enhancement:** Enable the current view as a capability filter +* **Enhancement:** Highlight the view capabilities in the capability menu +* **Enhancement:** Pass view data as JSON *(enhances compatibility with weird capability identifiers since WP doesn't escape these so it could contain special characters)* +* **Enhancement/Fix:** Compatibility with the `editable_roles` filter for non super admins +* **Fix:** Hide our toolbar in the customizer preview. Switching in the WP Customizer not possible (yet) +* **Fix:** Improve capability view handling * Other minor improvements Detailed info: [PR on GitHub](https://github.com/JoryHogeveen/view-admin-as/pull/23) = 1.6.1 = -* Feature: Freeze locale, force your own locale setting over that of a selected view. (Requires WP 4.7) [#21](https://github.com/JoryHogeveen/view-admin-as/issues/21) -* Enhancement: Added a11y keyboard tab indexes -* Fix: Reloading when anchor tags are set in the url [#17](https://github.com/JoryHogeveen/view-admin-as/issues/17) +* **Feature:** Freeze locale, force your own locale setting over that of a selected view. (Requires WP 4.7) [#21](https://github.com/JoryHogeveen/view-admin-as/issues/21) +* **Enhancement:** Added a11y keyboard tab indexes +* **Fix:** Reloading when anchor tags are set in the url [#17](https://github.com/JoryHogeveen/view-admin-as/issues/17) * Other minor fixes Detailed info: [PR on GitHub](https://github.com/JoryHogeveen/view-admin-as/pull/20) = 1.6 = -* Feature: Lock meta boxes [#9](https://github.com/JoryHogeveen/view-admin-as/issues/9) -* Feature: View as links in user management page [#12](https://github.com/JoryHogeveen/view-admin-as/issues/12) -* Enhancement: Better admin bar handling when set to hidden by user [#4](https://github.com/JoryHogeveen/view-admin-as/issues/4) +* **Feature:** Lock meta boxes [#9](https://github.com/JoryHogeveen/view-admin-as/issues/9) +* **Feature:** View as links in user management page [#12](https://github.com/JoryHogeveen/view-admin-as/issues/12) +* **Enhancement:** Better admin bar handling when set to hidden by user [#4](https://github.com/JoryHogeveen/view-admin-as/issues/4) * Also adds an option to hide/show our toolbar when no view is selected and the admin bar is not shown. -* Enhancement: Better handling for permission errors [#10](https://github.com/JoryHogeveen/view-admin-as/issues/10) -* Compatibility: Show our custom capabilities on role manage plugins like "Members" -* Compatibility: PHP 5.2 (WP minimum) -* Fix: occasional issues with enabling the Role Defaults module -* Refactor whole backend into multiple classes for more flexibility in future development +* **Enhancement:** Better handling for permission errors [#10](https://github.com/JoryHogeveen/view-admin-as/issues/10) +* **Compatibility:** Show our custom capabilities on role manage plugins like "Members" +* **Compatibility:** PHP 5.2 (WP minimum) +* **Fix:** occasional issues with enabling the Role Defaults module +* **Refactor:** Multiple classes for more flexibility in future development Detailed info: [PR on GitHub](https://github.com/JoryHogeveen/view-admin-as/pull/8) From b0c32f28d3278644f96f388a9ba459168618579e Mon Sep 17 00:00:00 2001 From: JoryHogeveen Date: Tue, 2 May 2017 01:52:08 +0200 Subject: [PATCH 57/57] v1.7.1 --- readme.txt | 6 +++--- view-admin-as.php | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/readme.txt b/readme.txt index f2256572..b5241e92 100644 --- a/readme.txt +++ b/readme.txt @@ -178,8 +178,8 @@ Note: if your admin users aren't safe, this plugin is the last one to worry abou = 1.7.1 = * **Feature:** Module Role Manager: Rename roles. [#47](https://github.com/JoryHogeveen/view-admin-as/issues/47) -* **Enhancement:** Improve fetching available capabilities for super admin. It now alse checks for custom post type and taxonomy capabilities and more other plugins. -* **Compatibility:** Also use the `user_has_cap` filter besides `map_meta_cap` to further improve compatibility. +* **Enhancement:** Improve fetching available capabilities for a super admin. It now also checks for registered custom post type and taxonomy capabilities and more other plugins. +* **Compatibility:** Also use the `user_has_cap` filter besides `map_meta_cap` to further improve capability and role view compatibility. * **UI:** Add submenu scrollbar when there are too much users under a role. [#49](https://github.com/JoryHogeveen/view-admin-as/issues/49) * **UI:** Module Role Manager: Show original role name for reference. * **Accessibility:** Fix tabindex for some nodes that have form elements. @@ -267,7 +267,7 @@ Detailed info: [PR on GitHub](https://github.com/JoryHogeveen/view-admin-as/pull == Other Notes == -You can find me here: += You can find me here: = * [Keraweb](http://www.keraweb.nl/) * [GitHub](https://github.com/JoryHogeveen/view-admin-as/) diff --git a/view-admin-as.php b/view-admin-as.php index fa8b7259..a65473e8 100644 --- a/view-admin-as.php +++ b/view-admin-as.php @@ -3,7 +3,7 @@ * @author Jory Hogeveen * @package View_Admin_As * @since 0.1 - * @version 1.7.1-rc2 + * @version 1.7.1 * @licence GPL-2.0+ * @link https://github.com/JoryHogeveen/view-admin-as * @@ -11,7 +11,7 @@ * Plugin Name: View Admin As * Plugin URI: https://wordpress.org/plugins/view-admin-as/ * Description: View the WordPress admin as a different role or visitor, switch between users, temporarily change your capabilities, set default screen settings for roles. - * Version: 1.7.1-rc2 + * Version: 1.7.1 * Author: Jory Hogeveen * Author URI: https://www.keraweb.nl * Text Domain: view-admin-as @@ -44,7 +44,7 @@ if ( ! class_exists( 'VAA_View_Admin_As' ) ) { - define( 'VIEW_ADMIN_AS_VERSION', '1.7.1-rc2' ); + define( 'VIEW_ADMIN_AS_VERSION', '1.7.1' ); define( 'VIEW_ADMIN_AS_DB_VERSION', '1.7' ); define( 'VIEW_ADMIN_AS_FILE', __FILE__ ); define( 'VIEW_ADMIN_AS_BASENAME', plugin_basename( VIEW_ADMIN_AS_FILE ) );