diff --git a/.builder-rsync-filters b/.builder-rsync-filters index 402c6c1e..05579623 100644 --- a/.builder-rsync-filters +++ b/.builder-rsync-filters @@ -52,5 +52,12 @@ - vendor/publishpress/wordpress-version-notices/codeception.dist.yml - vendor/publishpress/wordpress-version-notices/codeception.yml - vendor/publishpress/wordpress-version-notices/tests +- vendor/pimple/pimple/CHANGELOG +- vendor/pimple/pimple/README.rst +- vendor/pimple/pimple/composer.json +- vendor/pimple/pimple/ext +- vendor/pimple/pimple/phpunit.xml.dist +- vendor/pimple/pimple/src/Pimple/Tests +- vendor/psr/container/composer.json - webpack.config.js - webpack.mix.js diff --git a/capsman-enhanced.php b/capsman-enhanced.php index d819a569..aec4357b 100644 --- a/capsman-enhanced.php +++ b/capsman-enhanced.php @@ -3,7 +3,7 @@ * Plugin Name: PublishPress Capabilities * Plugin URI: https://publishpress.com/capability-manager/ * Description: Manage WordPress role definitions, per-site or network-wide. Organizes post capabilities by post type and operation. - * Version: 2.6.1 + * Version: 2.7.0 * Author: PublishPress * Author URI: https://publishpress.com/ * Text Domain: capsman-enhanced @@ -44,7 +44,7 @@ } if (!defined('CAPSMAN_VERSION')) { - define('CAPSMAN_VERSION', '2.6.1'); + define('CAPSMAN_VERSION', '2.7.0'); define('CAPSMAN_ENH_VERSION', CAPSMAN_VERSION); define('PUBLISHPRESS_CAPS_VERSION', CAPSMAN_VERSION); } diff --git a/common/css/admin.css b/common/css/admin.css index b94b9d15..5fda8487 100644 --- a/common/css/admin.css +++ b/common/css/admin.css @@ -539,6 +539,7 @@ table#akmin .pp-capability-menus-select .restrict-column { .pp-capability-menus .check-all-menu-link, .pp-capability-menus .check-all-menu-link:active { color: #555; + margin-left: -48px; } .pp-capability-menus .menu-item-link.restricted, @@ -563,6 +564,14 @@ table#akmin .pp-capability-menus-select .restrict-column { display: inline-block; } +.pp-capability-menus thead td.restrict-column + td .menu-item-link:hover, +.pp-capability-menus thead td.restrict-column + td .menu-item-link:focus, +.pp-capability-menus tfoot td.restrict-column + td .menu-item-link:hover, +.pp-capability-menus tfoot td.restrict-column + td .menu-item-link:focus { + border-color: transparent; + background: transparent; +} + .pp-capability-menus-wrapper .tooltip { position: relative; display: inline-block; @@ -591,6 +600,15 @@ table#akmin .pp-capability-menus-select .restrict-column { margin-bottom: 10px !important; } + +.capabilities_page_pp-capabilities-admin-menus input.ppc-admin-menu-submit, .capabilities_page_pp-capabilities-nav-menus input.ppc-nav-menu-submit { + margin-bottom: 10px !important; +} + +body.capabilities_page_pp-capabilities-nav-menus .pp-capability-menus-select .restrict-column { + width: 70px !important; +} + .pp-capability-menus-wrapper .features-section-header { padding-left: 10px !important; } @@ -747,14 +765,18 @@ div.ppc-editor-features-classic-toggle { .pp-column-right.capabilities-sidebar .pp-sidebar-box ul, .pp-capability-menus-wrapper.editor-features .pp-column-right .pp-sidebar-box:first-of-type ul, -.pp-capability-menus-wrapper.admin-features .pp-column-right .pp-sidebar-box:first-of-type ul { +.pp-capability-menus-wrapper.admin-features .pp-column-right .pp-sidebar-box:first-of-type ul, +.pp-capability-menus-wrapper.profile-features .pp-column-right .pp-sidebar-box:first-of-type ul, +.pp-capability-menus-wrapper.nav-menus .pp-column-right .pp-sidebar-box:first-of-type ul { padding: 0 !important; margin: 0 !important; } .pp-column-right.capabilities-sidebar .pp-sidebar-box:first-of-type ul input:disabled, .pp-capability-menus-wrapper.editor-features .pp-column-right .pp-sidebar-box:first-of-type ul input:disabled, -.pp-capability-menus-wrapper.admin-features .pp-column-right .pp-sidebar-box:first-of-type ul input:disabled { +.pp-capability-menus-wrapper.admin-features .pp-column-right .pp-sidebar-box:first-of-type ul input:disabled, +.pp-capability-menus-wrapper.profile-features .pp-column-right .pp-sidebar-box:first-of-type ul input:disabled, +.pp-capability-menus-wrapper.nav-menus .pp-column-right .pp-sidebar-box:first-of-type ul input:disabled { opacity: 1 !important; background: #fff !important; color: #50575e !important; @@ -763,7 +785,9 @@ div.ppc-editor-features-classic-toggle { } .pp-capability-menus-wrapper.editor-features .pp-column-right .pp-sidebar-box:first-of-type ul input[type=checkbox]:checked::before, -.pp-capability-menus-wrapper.admin-features .pp-column-right .pp-sidebar-box:first-of-type ul input[type=checkbox]:checked::before { +.pp-capability-menus-wrapper.admin-features .pp-column-right .pp-sidebar-box:first-of-type ul input[type=checkbox]:checked::before, +.pp-capability-menus-wrapper.profile-features .pp-column-right .pp-sidebar-box:nth-of-type(2) ul input[type=checkbox]:checked::before, +.pp-capability-menus-wrapper.nav-menus .pp-column-right .pp-sidebar-box:first-of-type ul input[type=checkbox]:checked::before { content: url(data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHhtbG5zOnhsaW5rPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5L3hsaW5rIiB3aWR0aD0iMjAiIGhlaWdodD0iMjAiIHByZXNlcnZlQXNwZWN0UmF0aW89InhNaWRZTWlkIG1lZXQiIHZpZXdCb3g9IjAgMCAyMCAyMCIgc3R5bGU9Ii1tcy10cmFuc2Zvcm06IHJvdGF0ZSgzNjBkZWcpOyAtd2Via2l0LXRyYW5zZm9ybTogcm90YXRlKDM2MGRlZyk7IHRyYW5zZm9ybTogcm90YXRlKDM2MGRlZyk7Ij48cGF0aCBkPSJNMTQuOTUgNi40NkwxMS40MSAxMGwzLjU0IDMuNTRsLTEuNDEgMS40MUwxMCAxMS40MmwtMy41MyAzLjUzbC0xLjQyLTEuNDJMOC41OCAxMEw1LjA1IDYuNDdsMS40Mi0xLjQyTDEwIDguNThsMy41NC0zLjUzeiIgZmlsbD0iI2RjMTQzYyIvPjxyZWN0IHg9IjAiIHk9IjAiIHdpZHRoPSIyMCIgaGVpZ2h0PSIyMCIgZmlsbD0icmdiYSgwLCAwLCAwLCAwKSIgLz48L3N2Zz4=) !important; } @@ -778,23 +802,65 @@ div.ppc-editor-features-classic-toggle { } .pp-capability-menus-wrapper.editor-features .pp-column-right .pp-sidebar-box:first-of-type ul, -.pp-capability-menus-wrapper.admin-features .pp-column-right .pp-sidebar-box:first-of-type ul { +.pp-capability-menus-wrapper.admin-features .pp-column-right .pp-sidebar-box:first-of-type ul, +.pp-capability-menus-wrapper.profile-features .pp-column-right .pp-sidebar-box:nth-of-type(1) ul, +.pp-capability-menus-wrapper.profile-features .pp-column-right .pp-sidebar-box:nth-of-type(2) ul, +.pp-capability-menus-wrapper.nav-menus .pp-column-right .pp-sidebar-box:first-of-type ul { list-style: none !important; } +.pp-capability-menus-wrapper.profile-features.empty-elements .ppc-profile-features-submit, +.pp-capability-menus-wrapper.profile-features.empty-elements .refresh-column { + display: none; +} + +.pp-capability-menus-wrapper.profile-features tr.empty-features-element td { + margin-left: 40px; +} + +.pp-capability-menus-wrapper.profile-features table#akmin .pp-capability-menus-select .restrict-column { + width: 0; + min-width: 70px; +} + .publishpress-caps-settings .description { vertical-align: text-bottom; } +.pp-capability-menus-wrapper.profile-features table.pp-capability-menus-select tbody tr { + cursor: move; +} + +/* ====================================================== Nav Menu Restriction */ + +body.capabilities_page_pp-capabilities-nav-menus .pp-capability-menus-select .restrict-column { + width: 70px !important; +} + +.capabilities_page_pp-capabilities-nav-menus input.ppc-nav-menu-submit { + margin-bottom: 10px !important; +} + +.capabilities_page_pp-capabilities-nav-menus input.ppc-nav-menu-submit { + margin-bottom: 10px !important; +} + + @media (min-width: 1200px) { .pp-column-right.capabilities-sidebar { padding-top: 50px; } .pp-capability-menus-wrapper.editor-features div.pp-column-right { - padding-top: 135px; + padding-top: 110px; } .pp-capability-menus-wrapper.admin-features div.pp-column-right { - padding-top: 107px; + padding-top: 80px; + } + .pp-capability-menus-wrapper.nav-menus div.pp-column-right { + padding-top: 62px; + } + .pp-capability-menus-wrapper.profile-features div.pp-column-right { + padding-top: 80px; } } diff --git a/common/css/profile.css b/common/css/profile.css index ce18a574..5b714478 100644 --- a/common/css/profile.css +++ b/common/css/profile.css @@ -6,4 +6,118 @@ tr.user-role-wrap #pp_roles_chosen li.search-choice, tr.user-role-wrap .chosen-choice-click .chosen-drop, #createuser .chosen-choice-click .chosen-drop { display: none !important; -} \ No newline at end of file +} + +.ppc-profile-fullpage-loader { + position: fixed; + z-index: 999; + height: 2em; + width: 2em; + overflow: show; + margin: auto; + top: 0; + left: 0; + bottom: 0; + right: 0; + font: 0/0 a; + color: transparent; + text-shadow: none; + background-color: transparent; + border: 0; +} + +.ppc-profile-fullpage-loader:before { + content: ''; + display: block; + position: fixed; + top: 0; + left: 0; + width: 100%; + height: 100%; + background: radial-gradient(rgba(20, 20, 20,.8), rgba(0, 0, 0, .8)); + background: -webkit-radial-gradient(rgba(20, 20, 20,.8), rgba(0, 0, 0,.8)); + } + + .ppc-profile-fullpage-loader:after { + content: ''; + display: block; + font-size: 10px; + width: 1em; + height: 1em; + margin-top: -0.5em; + -webkit-animation: ppc-profile-spinner 150ms infinite linear; + -moz-animation: ppc-profile-spinner 150ms infinite linear; + -ms-animation: ppc-profile-spinner 150ms infinite linear; + -o-animation: ppc-profile-spinner 150ms infinite linear; + animation: ppc-profile-spinner 150ms infinite linear; + border-radius: 0.5em; + -webkit-box-shadow: rgba(255,255,255, 0.75) 1.5em 0 0 0, rgba(255,255,255, 0.75) 1.1em 1.1em 0 0, rgba(255,255,255, 0.75) 0 1.5em 0 0, rgba(255,255,255, 0.75) -1.1em 1.1em 0 0, rgba(255,255,255, 0.75) -1.5em 0 0 0, rgba(255,255,255, 0.75) -1.1em -1.1em 0 0, rgba(255,255,255, 0.75) 0 -1.5em 0 0, rgba(255,255,255, 0.75) 1.1em -1.1em 0 0; + box-shadow: rgba(255,255,255, 0.75) 1.5em 0 0 0, rgba(255,255,255, 0.75) 1.1em 1.1em 0 0, rgba(255,255,255, 0.75) 0 1.5em 0 0, rgba(255,255,255, 0.75) -1.1em 1.1em 0 0, rgba(255,255,255, 0.75) -1.5em 0 0 0, rgba(255,255,255, 0.75) -1.1em -1.1em 0 0, rgba(255,255,255, 0.75) 0 -1.5em 0 0, rgba(255,255,255, 0.75) 1.1em -1.1em 0 0; + } + + /* Animation */ + + @-webkit-keyframes ppc-profile-spinner { + 0% { + -webkit-transform: rotate(0deg); + -moz-transform: rotate(0deg); + -ms-transform: rotate(0deg); + -o-transform: rotate(0deg); + transform: rotate(0deg); + } + 100% { + -webkit-transform: rotate(360deg); + -moz-transform: rotate(360deg); + -ms-transform: rotate(360deg); + -o-transform: rotate(360deg); + transform: rotate(360deg); + } + } + @-moz-keyframes ppc-profile-spinner { + 0% { + -webkit-transform: rotate(0deg); + -moz-transform: rotate(0deg); + -ms-transform: rotate(0deg); + -o-transform: rotate(0deg); + transform: rotate(0deg); + } + 100% { + -webkit-transform: rotate(360deg); + -moz-transform: rotate(360deg); + -ms-transform: rotate(360deg); + -o-transform: rotate(360deg); + transform: rotate(360deg); + } + } + @-o-keyframes ppc-profile-spinner { + 0% { + -webkit-transform: rotate(0deg); + -moz-transform: rotate(0deg); + -ms-transform: rotate(0deg); + -o-transform: rotate(0deg); + transform: rotate(0deg); + } + 100% { + -webkit-transform: rotate(360deg); + -moz-transform: rotate(360deg); + -ms-transform: rotate(360deg); + -o-transform: rotate(360deg); + transform: rotate(360deg); + } + } + @keyframes ppc-profile-spinner { + 0% { + -webkit-transform: rotate(0deg); + -moz-transform: rotate(0deg); + -ms-transform: rotate(0deg); + -o-transform: rotate(0deg); + transform: rotate(0deg); + } + 100% { + -webkit-transform: rotate(360deg); + -moz-transform: rotate(360deg); + -ms-transform: rotate(360deg); + -o-transform: rotate(360deg); + transform: rotate(360deg); + } + } \ No newline at end of file diff --git a/common/js/admin.dev.js b/common/js/admin.dev.js index 0333e438..0580a8e8 100644 --- a/common/js/admin.dev.js +++ b/common/js/admin.dev.js @@ -439,4 +439,24 @@ jQuery(document).ready( function($) { } }); + + if ($('.pp-capability-menus-wrapper.profile-features').length > 0) { + /** + * Make profile features sortable + */ + $(".pp-capability-menus-wrapper.profile-features table.pp-capability-menus-select tbody").sortable({ + axis: "y", + update: function (e, ui) { + var fields_order = []; + $('.pp-capability-menus-wrapper.profile-features table.pp-capability-menus-select tbody tr.ppc-sortable-row').each(function () { + var element_key = $(this).attr('data-element_key'); + if (element_key) { + fields_order.push(element_key); + } + }); + $('.capsman_profile_features_elements_order').val(fields_order.join(",")); + } + }); + } + }); diff --git a/common/js/admin.js b/common/js/admin.js index 9161a60e..45bfef2f 100644 --- a/common/js/admin.js +++ b/common/js/admin.js @@ -1 +1 @@ -jQuery(document).ready(function(e){e("a.neg-cap").attr("title",cmeAdmin.negationCaption),e("a.neg-type-caps").attr("title",cmeAdmin.typeCapsNegationCaption),e("td.cap-unreg").attr("title",cmeAdmin.typeCapUnregistered),e("a.normal-cap").attr("title",cmeAdmin.switchableCaption),e('span.cap-x:not([class*="pp-cap-key"])').attr("title",cmeAdmin.capNegated),e('table.cme-checklist input[class!="cme-check-all"]').not(":disabled").attr("title",cmeAdmin.chkCaption),e(".ppc-checkboxes-documentation-link").length>0&&e(".ppc-checkboxes-documentation-link").attr("target","blank"),e("table.cme-checklist a.neg-cap").click(function(t){e(this).closest("td").removeClass("cap-yes").removeClass("cap-no").addClass("cap-neg");var a=e(this).parent().find('input[type="checkbox"]').attr("name");return e(this).after(''),e('input[name="'+a+'"]').closest("td").removeClass("cap-yes").removeClass("cap-no").addClass("cap-neg"),e(this).closest("tr").hasClass("unfiltered_upload")&&(e('input[name="caps[upload_files]"]').closest("td").addClass("cap-neg"),e('input[name="caps[upload_files]"]').closest("td").append(''),e('input[name="caps[upload_files]"]').parent().next("a.neg-cap:visible").click()),!1}),e(document).on("click","table.cme-typecaps span.cap-x,table.cme-checklist span.cap-x,table.cme-checklist td.cap-neg span",function(t){e(this).closest("td").removeClass("cap-neg").removeClass("cap-yes").addClass("cap-no"),e(this).parent().find('input[type="checkbox"]').prop("checked",!1),e(this).parent().find("input.cme-negation-input").remove();var a=e(this).next('input[type="checkbox"]').attr("name");return a||(a=e(this).next("label").find('input[type="checkbox"]').attr("name")),e('input[name="'+a+'"]').parent().closest("td").removeClass("cap-neg").removeClass("cap-yes").addClass("cap-no"),e('input[name="'+a+'"]').prop("checked",!1).parent().find("input.cme-negation-input").remove(),e(this).closest("td").hasClass("capability-checkbox-rotate")&&(e(this).closest("td").find('input[type="checkbox"]').prop("checked",!0),e(this).closest("td").hasClass("upload_files")&&(e("tr.unfiltered_upload").find("td").removeClass("cap-neg").removeClass("cap-yes").addClass("cap-no"),e("tr.unfiltered_upload").find('input[type="checkbox"]').prop("checked",!1),e("tr.unfiltered_upload").find("input.cme-negation-input").remove(),e('input[name="caps[unfiltered_upload]"]').parent().closest("td").removeClass("cap-neg").removeClass("cap-yes").addClass("cap-no"),e('input[name="caps[unfiltered_upload]"]').prop("checked",!0).parent().find("input.cme-negation-input").remove())),e(this).closest("td").find('input[type="checkbox"]').hasClass("pp-single-action-rotate")&&e(this).closest("td").find('input[type="checkbox"]').prop("checked",!0),e(this).closest("tr").hasClass("unfiltered_upload")&&(e('input[name="caps[upload_files]"]').parent().closest("td").removeClass("cap-neg").removeClass("cap-yes").addClass("cap-no"),e('input[name="caps[upload_files]"]').prop("checked",!0).parent().find("input.cme-negation-input").remove()),!1}),e("#publishpress_caps_form").bind("keypress",function(t){if(13==t.keyCode)return e(document.activeElement).parent().find('input[type="submit"]').first().click(),!1}),e("input.cme-check-all").click(function(t){e(this).closest("table").find('input[type="checkbox"][disabled!="disabled"]:visible').prop("checked",e(this).is(":checked"))}),e("a.cme-neg-all").click(function(t){return e(this).closest("table").find("a.neg-cap:visible").click(),!1}),e("a.cme-switch-all").click(function(t){return e(this).closest("table").find("td.cap-neg span").click(),!1}),e("table.cme-typecaps a.neg-type-caps").click(function(t){return e(this).closest("tr").find('td[class!="cap-neg"]').filter('td[class!="cap-unreg"]').each(function(){e(this).addClass("cap-neg");var t=e(this).find('input[type="checkbox"]').attr("name");e(this).append(''),e('input[name="'+t+'"]').parent().next("a.neg-cap:visible").click()}),!1}),e("table.cme-typecaps th").click(function(){var t=e(this).index(),a=!e(this).prop("checked_all");if(e(this).hasClass("term-cap"))var n='[class*="term-cap"]';else var n='[class*="post-cap"]';var s=e(this).closest("table").find("tr td"+n+":nth-child("+(t+1)+') input[type="checkbox"]:visible');e(s).each(function(t,n){e('input[name="'+e(this).attr("name")+'"]').prop("checked",a)}),e(this).prop("checked_all",a)}),e("a.cme-fix-read-cap").click(function(){return e('input[name="caps[read]"]').prop("checked",!0),e('input[name="SaveRole"]').trigger("click"),!1}),e(".ppc-filter-select").each(function(){var t=e(this),a=[];e(this).parent().siblings("table").find("tbody").find("tr").each(function(){a.push({value:e(this).attr("class"),text:e(this).find(".cap_type").text()})}),a.forEach(function(a,n){t.append(e("'); + $("#pp_roles").prepend(''); - //init chosen.js + //init chosen.js $newField.chosen({ - 'width': '25em' + 'width': '25em' }); - /** - * Make role sortable - */ - $(".user-role-wrap .chosen-choices, #createuser .chosen-choices").sortable(); + /** + * Make role sortable + */ + $(".user-role-wrap .chosen-choices, #createuser .chosen-choices").sortable(); - /** - * Force role option re-order before profile form submission - */ - $('form#your-profile, form#createuser').submit(function () { - var options = $('#pp_roles option'); - $(".user-role-wrap .chosen-choices .search-choice .search-choice-close, #createuser .chosen-choices .search-choice .search-choice-close").each(function () { - var select_position = $(this).attr('data-option-array-index'); - $(options[select_position]).insertBefore(options.eq(0)); + /** + * Force role option re-order before profile form submission + */ + $('form#your-profile, form#createuser').submit(function () { + var options = $('#pp_roles option'); + $(".user-role-wrap .chosen-choices .search-choice .search-choice-close, #createuser .chosen-choices .search-choice .search-choice-close").each(function () { + var select_position = $(this).attr('data-option-array-index'); + $(options[select_position]).insertBefore(options.eq(0)); + }); }); - }); - /** - * Add class to chosen container on choice click - */ - $(document).on( 'mousedown', '.user-role-wrap .chosen-choices .search-choice, #createuser .chosen-choices .search-choice', function() { - $(this).closest('.chosen-container').addClass('chosen-choice-click'); - }); + /** + * Add class to chosen container on choice click + */ + $(document).on('mousedown', '.user-role-wrap .chosen-choices .search-choice, #createuser .chosen-choices .search-choice', function () { + $(this).closest('.chosen-container').addClass('chosen-choice-click'); + }); - /** - * Remove chosen container class on click inside input - */ + /** + * Remove chosen container class on click inside input + */ - $(document).on( 'mousedown', '.user-role-wrap .chosen-choices, #createuser .chosen-choices', function(e) { - if (!e.target.parentElement.classList.contains('search-choice')) { - $(this).closest('.chosen-container').removeClass('chosen-choice-click'); - } - }); + $(document).on('mousedown', '.user-role-wrap .chosen-choices, #createuser .chosen-choices', function (e) { + if (!e.target.parentElement.classList.contains('search-choice')) { + $(this).closest('.chosen-container').removeClass('chosen-choice-click'); + } + }); + } }); diff --git a/framework/lib/formating.php b/framework/lib/formating.php index 914e09cf..d9d2450e 100644 --- a/framework/lib/formating.php +++ b/framework/lib/formating.php @@ -39,7 +39,8 @@ function ak_admin_notify( $message = '' ) if ( empty($message) ) { $message = esc_html__('Settings saved.', 'capsman-enhanced'); } - echo '
' . esc_html($message) . '
' . $message . '
' . esc_html($message) . '
' . $message . '