Capability Manager Enhanced - Version 1.9.2

Version Description

  • 16 Mar 2020 =
    • Feature : Auto-backup role and capabilities on each update (and on update to this version)
    • Fixed : First-time installation: Capabilities menu item not displayed until after Plugins or Users menu clicked
    • Change : Third Party Plugin Capabilities - always display checkboxes even if capabilities not present in Administrator role
    • Fixed : Plugin capability sections - pp_set_notification_channel and pp_manage_roles were included in both PublishPress and PublishPress Permissions sections
    • Fixed : Capability Negation (Denial) bulk unselect link was ambiguous due to missing strikethrough
Download this release

Release Info

Developer kevinB
Plugin Icon 128x128 Capability Manager Enhanced
Version 1.9.2
Comparing to
See all releases

Code changes from version 1.9 to 1.9.2

Files changed (111) hide show
  1. admin.css +222 -223
  2. admin.dev.js +7 -0
  3. admin.js +1 -1
  4. capsman-enhanced.php +14 -9
  5. composer.json +20 -0
  6. includes/CoreAdmin.php +47 -0
  7. includes/admin.php +1208 -1205
  8. includes/backup-handler.php +10 -4
  9. includes/backup.php +43 -19
  10. includes/functions-admin.php +19 -1
  11. includes/functions.php +19 -0
  12. includes/handler.php +6 -4
  13. includes/manager.php +16 -1
  14. lang/capsman.mo +0 -0
  15. lang/capsman.po +133 -124
  16. readme.txt +12 -2
  17. vendor/autoload.php +7 -0
  18. vendor/composer/ClassLoader.php +445 -0
  19. vendor/composer/LICENSE +21 -0
  20. vendor/composer/autoload_classmap.php +9 -0
  21. vendor/composer/autoload_namespaces.php +10 -0
  22. vendor/composer/autoload_psr4.php +11 -0
  23. vendor/composer/autoload_real.php +55 -0
  24. vendor/composer/autoload_static.php +47 -0
  25. vendor/composer/installed.json +149 -0
  26. vendor/pimple/pimple/.gitignore +3 -0
  27. vendor/pimple/pimple/.php_cs.dist +20 -0
  28. vendor/pimple/pimple/.travis.yml +17 -0
  29. vendor/pimple/pimple/CHANGELOG +64 -0
  30. vendor/pimple/pimple/LICENSE +19 -0
  31. vendor/pimple/pimple/README.rst +326 -0
  32. vendor/pimple/pimple/composer.json +29 -0
  33. vendor/pimple/pimple/phpunit.xml.dist +18 -0
  34. vendor/pimple/pimple/src/Pimple/Container.php +298 -0
  35. vendor/pimple/pimple/src/Pimple/Exception/ExpectedInvokableException.php +38 -0
  36. vendor/pimple/pimple/src/Pimple/Exception/FrozenServiceException.php +45 -0
  37. vendor/pimple/pimple/src/Pimple/Exception/InvalidServiceIdentifierException.php +45 -0
  38. vendor/pimple/pimple/src/Pimple/Exception/UnknownIdentifierException.php +45 -0
  39. vendor/pimple/pimple/src/Pimple/Psr11/Container.php +55 -0
  40. vendor/pimple/pimple/src/Pimple/Psr11/ServiceLocator.php +75 -0
  41. vendor/pimple/pimple/src/Pimple/ServiceIterator.php +69 -0
  42. vendor/pimple/pimple/src/Pimple/ServiceProviderInterface.php +46 -0
  43. vendor/pimple/pimple/src/Pimple/Tests/Fixtures/Invokable.php +38 -0
  44. vendor/pimple/pimple/src/Pimple/Tests/Fixtures/NonInvokable.php +34 -0
  45. vendor/pimple/pimple/src/Pimple/Tests/Fixtures/PimpleServiceProvider.php +54 -0
  46. vendor/pimple/pimple/src/Pimple/Tests/Fixtures/Service.php +35 -0
  47. vendor/pimple/pimple/src/Pimple/Tests/PimpleServiceProviderInterfaceTest.php +77 -0
  48. vendor/pimple/pimple/src/Pimple/Tests/PimpleTest.php +610 -0
  49. vendor/pimple/pimple/src/Pimple/Tests/Psr11/ContainerTest.php +76 -0
  50. vendor/pimple/pimple/src/Pimple/Tests/Psr11/ServiceLocatorTest.php +131 -0
  51. vendor/pimple/pimple/src/Pimple/Tests/ServiceIteratorTest.php +52 -0
  52. vendor/psr/container/.gitignore +3 -0
  53. vendor/psr/container/LICENSE +21 -0
  54. vendor/psr/container/README.md +5 -0
  55. vendor/psr/container/composer.json +27 -0
  56. vendor/psr/container/src/ContainerExceptionInterface.php +13 -0
  57. vendor/psr/container/src/ContainerInterface.php +37 -0
  58. vendor/psr/container/src/NotFoundExceptionInterface.php +13 -0
  59. vendor/publishpress/wordpress-version-notices/.env.testing.dist +17 -0
  60. vendor/publishpress/wordpress-version-notices/.gitignore +31 -0
  61. vendor/publishpress/wordpress-version-notices/README.md +75 -0
  62. vendor/publishpress/wordpress-version-notices/assets/css/top-notice-bold-purple.css +65 -0
  63. vendor/publishpress/wordpress-version-notices/bin/acceptance.sh +7 -0
  64. vendor/publishpress/wordpress-version-notices/bin/test.sh +7 -0
  65. vendor/publishpress/wordpress-version-notices/bin/update-code-for-tests.sh +13 -0
  66. vendor/publishpress/wordpress-version-notices/bin/wpunit.sh +7 -0
  67. vendor/publishpress/wordpress-version-notices/codeception.dist.yml +20 -0
  68. vendor/publishpress/wordpress-version-notices/codeception.yml +20 -0
  69. vendor/publishpress/wordpress-version-notices/composer.json +30 -0
  70. vendor/publishpress/wordpress-version-notices/composer.lock +7340 -0
  71. vendor/publishpress/wordpress-version-notices/includes.php +55 -0
  72. vendor/publishpress/wordpress-version-notices/license.txt +377 -0
  73. vendor/publishpress/wordpress-version-notices/src/Module/AdInterface.php +37 -0
  74. vendor/publishpress/wordpress-version-notices/src/Module/Footer/Module.php +55 -0
  75. vendor/publishpress/wordpress-version-notices/src/Module/TopNotice/Module.php +136 -0
  76. vendor/publishpress/wordpress-version-notices/src/ServicesProvider.php +49 -0
  77. vendor/publishpress/wordpress-version-notices/src/Template/TemplateInvalidArgumentsException.php +33 -0
  78. vendor/publishpress/wordpress-version-notices/src/Template/TemplateLoader.php +108 -0
  79. vendor/publishpress/wordpress-version-notices/src/Template/TemplateLoaderInterface.php +53 -0
  80. vendor/publishpress/wordpress-version-notices/src/Template/TemplateNotFoundException.php +33 -0
  81. vendor/publishpress/wordpress-version-notices/templates/top-notice/notice.php +6 -0
  82. vendor/publishpress/wordpress-version-notices/tests/_data/.gitkeep +0 -0
  83. vendor/publishpress/wordpress-version-notices/tests/_data/dumb-plugin-one/dumb-plugin-one.php +37 -0
  84. vendor/publishpress/wordpress-version-notices/tests/_data/dumb-plugin-one/vendor/publishpress/wordpress-version-notices/.gitkeep +0 -0
  85. vendor/publishpress/wordpress-version-notices/tests/_data/dumb-plugin-one/version-notice.php +46 -0
  86. vendor/publishpress/wordpress-version-notices/tests/_data/dumb-plugin-two/dumb-plugin-two.php +37 -0
  87. vendor/publishpress/wordpress-version-notices/tests/_data/dumb-plugin-two/vendor/publishpress/wordpress-version-notices/.gitkeep +0 -0
  88. vendor/publishpress/wordpress-version-notices/tests/_data/dumb-plugin-two/version-notice.php +46 -0
  89. vendor/publishpress/wordpress-version-notices/tests/_data/dumb-templates/Dumb/test1.php +1 -0
  90. vendor/publishpress/wordpress-version-notices/tests/_data/dumb-templates/Dumb/test2.php +1 -0
  91. vendor/publishpress/wordpress-version-notices/tests/_data/dump.sql +524 -0
  92. vendor/publishpress/wordpress-version-notices/tests/_output/.gitignore +2 -0
  93. vendor/publishpress/wordpress-version-notices/tests/_support/AcceptanceTester.php +26 -0
  94. vendor/publishpress/wordpress-version-notices/tests/_support/FunctionalTester.php +26 -0
  95. vendor/publishpress/wordpress-version-notices/tests/_support/Helper/Acceptance.php +10 -0
  96. vendor/publishpress/wordpress-version-notices/tests/_support/Helper/Functional.php +10 -0
  97. vendor/publishpress/wordpress-version-notices/tests/_support/Helper/Unit.php +10 -0
  98. vendor/publishpress/wordpress-version-notices/tests/_support/Helper/Wpunit.php +10 -0
  99. vendor/publishpress/wordpress-version-notices/tests/_support/UnitTester.php +26 -0
  100. vendor/publishpress/wordpress-version-notices/tests/_support/WpunitTester.php +26 -0
  101. vendor/publishpress/wordpress-version-notices/tests/_support/_generated/.gitignore +2 -0
  102. vendor/publishpress/wordpress-version-notices/tests/acceptance.suite.yml +36 -0
  103. vendor/publishpress/wordpress-version-notices/tests/acceptance/ActivatePluginsCest.php +17 -0
  104. vendor/publishpress/wordpress-version-notices/tests/acceptance/TopNoticeCest.php +38 -0
  105. vendor/publishpress/wordpress-version-notices/tests/functional.suite.yml +40 -0
  106. vendor/publishpress/wordpress-version-notices/tests/unit.suite.yml +10 -0
  107. vendor/publishpress/wordpress-version-notices/tests/wpunit.suite.yml +25 -0
  108. vendor/publishpress/wordpress-version-notices/tests/wpunit/IncludesTest.php +31 -0
  109. vendor/publishpress/wordpress-version-notices/tests/wpunit/Module/TopNotice/ModuleTest.php +174 -0
  110. vendor/publishpress/wordpress-version-notices/tests/wpunit/ServicesProviderTest.php +55 -0
  111. vendor/publishpress/wordpress-version-notices/tests/wpunit/Template/TemplateLoaderTest.php +99 -0
admin.css CHANGED
@@ -1,223 +1,222 @@
1
- /**
2
- * Settings for admin dashboard.
3
- * Based on the styles for Maintenance Mode plugin by Michael Wöhrer
4
- *
5
- * @version $Rev: 198515 $
6
- * @author Jordi Canals
7
- * @copyright Copyright (C) 2009, 2010 Jordi Canals
8
- * @license GNU General Public License version 2
9
- * @link http://alkivia.org
10
- * @package Alkivia
11
- * @subpackage CapsMan
12
- *
13
-
14
- Copyright 2009, 2010 Jordi Canals <devel@jcanals.cat>
15
-
16
- This program is free software; you can redistribute it and/or
17
- modify it under the terms of the GNU General Public License
18
- version 2 as published by the Free Software Foundation.
19
-
20
- This program is distributed in the hope that it will be useful,
21
- but WITHOUT ANY WARRANTY; without even the implied warranty of
22
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
23
- GNU General Public License for more details.
24
-
25
- You should have received a copy of the GNU General Public License
26
- along with this program. If not, see <http://www.gnu.org/licenses/>.
27
- */
28
-
29
-
30
- /* ====================================================== SIDEBAR ICONS */
31
-
32
- a.cap_type {
33
- text-decoration: none;
34
- }
35
-
36
- a.cap_type:hover {
37
- text-decoration: underline;
38
- }
39
-
40
- ul.cme-listhoriz li {
41
- text-align: center;
42
- padding-right: 1em;
43
- }
44
-
45
- ul.cme-listhoriz li table{
46
- text-align: center;
47
- }
48
-
49
-
50
- ul.cme-listhoriz {
51
- width: 100%;
52
- clear: both;
53
- float: left;
54
- margin: 0;
55
- padding: 0;
56
- }
57
-
58
- ul.cme-listhoriz li {
59
- list-style: none;
60
- float: left;
61
- margin: 0;
62
- }
63
-
64
-
65
- div.cme-listhoriz h3 {
66
- margin: 0.2em;
67
- }
68
-
69
- div.cme-cap-type-tables {
70
- border: 1px solid black;
71
- }
72
-
73
- table .cme-typecaps td {
74
- text-align: center;
75
- height: 2em;
76
- }
77
-
78
- table .cme-typecaps th {
79
- padding-left: 0.3em;
80
- padding-right: 0.3em;
81
- }
82
-
83
- table.cme-typecaps span.cap-x {
84
- display: none;
85
- }
86
-
87
- h3.cme-cap-section {
88
- margin-top:0;
89
- }
90
-
91
- a.neg-cap, a.cap-on, a.type-on, a.neg-type-caps, a.cme-neg-all {
92
- text-decoration: none;
93
- }
94
-
95
- span.cap-x, a.cme-neg-all {
96
- color: red;
97
- font-size: 1.5em;
98
- padding-left: 1px;
99
- padding-right: 1px;
100
- vertical-align: middle;
101
- }
102
-
103
- a.cme-switch-all {
104
- color: black;
105
- font-size: 1.5em;
106
- padding-right: 1px;
107
- padding-right: 1px;
108
- vertical-align: middle;
109
- text-decoration: line-through;
110
- }
111
-
112
- td.cap-yes span {
113
- color:green;font-weight:bold;
114
- }
115
-
116
- td.cap-no {
117
- color:#777;
118
- }
119
-
120
- td.cap-neg label span {
121
- color: red;
122
- }
123
-
124
- td.cap-neg input {
125
- display:none;
126
- }
127
-
128
- td.cap-no span.cap-x, td.cap-yes span.cap-x {
129
- display:none;
130
- }
131
-
132
- td.cap-neg span.cap-x {
133
- display:inline;
134
- }
135
-
136
- td.cap-neg a.neg-cap {
137
- display:none;
138
- }
139
-
140
- td.cap-metagroup label span {
141
- color: #080 !important;
142
- }
143
-
144
- td.cap-locked a.neg-cap {
145
- display: none !important;
146
- }
147
-
148
- a.type-off, a.neg-cap, a.cme-neg-all, a.neg-type-caps {
149
- color: #800;
150
- }
151
-
152
- a.type-on, a.cap-on, a.cme-switch-all {
153
- color: black;
154
- }
155
-
156
- input.cme-check-all, a.cme-neg-all {
157
- margin-right: 10px;
158
- padding-right: 10px;
159
- }
160
-
161
- #akmin input.button {
162
- margin-top: 5px;
163
- }
164
-
165
- #akmin input.button-primary {
166
- margin: 5px;
167
- }
168
-
169
- #akmin td.sidebar {
170
- width: 300px;
171
- }
172
-
173
- #akmin .cme-backup-tool a {
174
- padding-left:0;
175
- }
176
-
177
- #akmin input.regular-text {
178
- width: 200px;
179
- }
180
-
181
- #akmin input.tight-text {
182
- width: 125px;
183
- }
184
-
185
- .cme-subtext {
186
- color: #686868;
187
- font-style: italic;
188
- margin-top:5px;
189
- }
190
-
191
- td.cm-has-via-pp {
192
- background-color: #84fb84;
193
- }
194
-
195
- div.pressshack-admin-wrapper footer {
196
- padding-right: 270px;
197
- }
198
-
199
- body.capabilities_page_capsman-tool div.pressshack-admin-wrapper footer {
200
- padding-right: 5px;
201
- }
202
-
203
- #akmin div.publishpress-headline {line-height:25px}
204
- #akmin span.publishpress-thanks{margin-left:5px;color:#655997;white-space:nowrap}
205
- #akmin span.publishpress-thanks,#akmin span.publishpress-thanks a,#akmin span.publishpress-thanks a:visited {color:#655997;font-weight:bold;}
206
-
207
- table#akmin td.sidebar li.publishpress-contact{text-align:center}
208
- table#akmin td.sidebar li.publishpress-contact a{padding:5px 0 5px 0;}
209
-
210
- #pp_features {display:none;border:1px solid #eee;padding:5px;text-align:center;min-width:600px}
211
- #pp_features div.pp-logo { text-align: center }
212
- #pp_features div.features-wrap { margin-left: auto; margin-right: auto; text-align: center; width: 600px; }
213
- #pp_features ul.pp-features { list-style: none; padding-top:10px; text-align:left; margin-left: auto }
214
- #pp_features ul.pp-features li:before { content: "\2713\0020"; }
215
- #pp_features ul.pp-features li { padding-bottom: 5px }
216
- #pp_features img.cme-play { margin-bottom: -3px; margin-left: 5px;}
217
-
218
- div.publishpress-caps-manage span.manage-members {margin-left:5px; font-weight:normal; color: #777}
219
- div.publishpress-caps-manage span.manage-members a {color: #777}
220
- div.publishpress-caps-manage span.manage-members a:hover {text-decoration: underline; color:#655997 }
221
-
222
- div.publishpress-headline .cme-subtext a {font-weight: bold}
223
- div.publishpress-headline .cme-subtext a:hover {text-decoration: underline}
1
+ /**
2
+ * Settings for admin dashboard.
3
+ * Based on the styles for Maintenance Mode plugin by Michael Wöhrer
4
+ *
5
+ * @version $Rev: 198515 $
6
+ * @author Jordi Canals
7
+ * @copyright Copyright (C) 2009, 2010 Jordi Canals
8
+ * @license GNU General Public License version 2
9
+ * @link http://alkivia.org
10
+ * @package Alkivia
11
+ * @subpackage CapsMan
12
+ *
13
+
14
+ Copyright 2009, 2010 Jordi Canals <devel@jcanals.cat>
15
+
16
+ This program is free software; you can redistribute it and/or
17
+ modify it under the terms of the GNU General Public License
18
+ version 2 as published by the Free Software Foundation.
19
+
20
+ This program is distributed in the hope that it will be useful,
21
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
22
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
23
+ GNU General Public License for more details.
24
+
25
+ You should have received a copy of the GNU General Public License
26
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
27
+ */
28
+
29
+
30
+ /* ====================================================== SIDEBAR ICONS */
31
+
32
+ a.cap_type {
33
+ text-decoration: none;
34
+ }
35
+
36
+ a.cap_type:hover {
37
+ text-decoration: underline;
38
+ }
39
+
40
+ ul.cme-listhoriz li {
41
+ text-align: center;
42
+ padding-right: 1em;
43
+ }
44
+
45
+ ul.cme-listhoriz li table{
46
+ text-align: center;
47
+ }
48
+
49
+
50
+ ul.cme-listhoriz {
51
+ width: 100%;
52
+ clear: both;
53
+ float: left;
54
+ margin: 0;
55
+ padding: 0;
56
+ }
57
+
58
+ ul.cme-listhoriz li {
59
+ list-style: none;
60
+ float: left;
61
+ margin: 0;
62
+ }
63
+
64
+
65
+ div.cme-listhoriz h3 {
66
+ margin: 0.2em;
67
+ }
68
+
69
+ div.cme-cap-type-tables {
70
+ border: 1px solid black;
71
+ }
72
+
73
+ table .cme-typecaps td {
74
+ text-align: center;
75
+ height: 2em;
76
+ }
77
+
78
+ table .cme-typecaps th {
79
+ padding-left: 0.3em;
80
+ padding-right: 0.3em;
81
+ }
82
+
83
+ table.cme-typecaps span.cap-x {
84
+ display: none;
85
+ }
86
+
87
+ h3.cme-cap-section {
88
+ margin-top:0;
89
+ }
90
+
91
+ a.neg-cap, a.cap-on, a.type-on, a.neg-type-caps, a.cme-neg-all {
92
+ text-decoration: none;
93
+ }
94
+
95
+ span.cap-x, a.cme-neg-all {
96
+ color: red;
97
+ font-size: 1.5em;
98
+ padding-left: 1px;
99
+ padding-right: 1px;
100
+ vertical-align: middle;
101
+ }
102
+
103
+ a.cme-switch-all {
104
+ color: black;
105
+ font-size: 1.5em;
106
+ padding-right: 1px;
107
+ padding-right: 1px;
108
+ vertical-align: middle;
109
+ text-decoration: line-through !important;
110
+ }
111
+
112
+ td.cap-yes span {
113
+ color:green;font-weight:bold;
114
+ }
115
+
116
+ td.cap-no {
117
+ color:#777;
118
+ }
119
+
120
+ td.cap-neg label span {
121
+ color: red;
122
+ }
123
+
124
+ td.cap-neg input {
125
+ display:none;
126
+ }
127
+
128
+ td.cap-no span.cap-x, td.cap-yes span.cap-x {
129
+ display:none;
130
+ }
131
+
132
+ td.cap-neg span.cap-x {
133
+ display:inline;
134
+ }
135
+
136
+ td.cap-neg a.neg-cap {
137
+ display:none;
138
+ }
139
+
140
+ td.cap-metagroup label span {
141
+ color: #080 !important;
142
+ }
143
+
144
+ td.cap-locked a.neg-cap {
145
+ display: none !important;
146
+ }
147
+
148
+ a.type-off, a.neg-cap, a.cme-neg-all, a.neg-type-caps {
149
+ color: #800;
150
+ }
151
+
152
+ a.type-on, a.cap-on, a.cme-switch-all {
153
+ color: black;
154
+ }
155
+
156
+ input.cme-check-all, a.cme-neg-all {
157
+ margin-right: 10px;
158
+ padding-right: 10px;
159
+ }
160
+
161
+ #akmin input.button {
162
+ margin-top: 5px;
163
+ }
164
+
165
+ #akmin input.button-primary {
166
+ margin: 5px;
167
+ }
168
+
169
+ #akmin td.sidebar {
170
+ width: 300px;
171
+ }
172
+
173
+ #akmin .cme-backup-tool a {
174
+ padding-left:0;
175
+ }
176
+
177
+ #akmin input.regular-text {
178
+ width: 200px;
179
+ }
180
+
181
+ #akmin input.tight-text {
182
+ width: 125px;
183
+ }
184
+
185
+ .cme-subtext {
186
+ color: #686868;
187
+ font-style: italic;
188
+ margin-top:5px;
189
+ }
190
+
191
+ td.cm-has-via-pp {
192
+ background-color: #84fb84;
193
+ }
194
+
195
+ div.pressshack-admin-wrapper footer {
196
+ padding-right: 270px;
197
+ }
198
+
199
+ body.capabilities_page_capsman-tool div.pressshack-admin-wrapper footer {
200
+ padding-right: 5px;
201
+ }
202
+
203
+ #akmin div.publishpress-headline {line-height:25px}
204
+ #akmin span.publishpress-thanks{margin-left:5px;color:#655997;white-space:nowrap}
205
+ #akmin span.publishpress-thanks,#akmin span.publishpress-thanks a,#akmin span.publishpress-thanks a:visited {color:#655997;font-weight:bold;}
206
+
207
+ table#akmin td.sidebar li.publishpress-contact{text-align:center}
208
+ table#akmin td.sidebar li.publishpress-contact a{padding:5px 0 5px 0;}
209
+
210
+ #pp_features {display:none;border:1px solid #eee;padding:5px;text-align:center;min-width:600px}
211
+ #pp_features div.pp-logo { text-align: center }
212
+ #pp_features div.features-wrap { margin-left: auto; margin-right: auto; text-align: center; width: 600px; }
213
+ #pp_features ul.pp-features { list-style: none; padding-top:10px; text-align:left; margin-left: auto }
214
+ #pp_features ul.pp-features li:before { content: "\2713\0020"; }
215
+ #pp_features ul.pp-features li { padding-bottom: 5px }
216
+ #pp_features img.cme-play { margin-bottom: -3px; margin-left: 5px;}
217
+ div.publishpress-caps-manage span.manage-members {margin-left:5px; font-weight:normal; color: #777}
218
+ div.publishpress-caps-manage span.manage-members a {color: #777}
219
+ div.publishpress-caps-manage span.manage-members a:hover {text-decoration: underline; color:#655997 }
220
+
221
+ div.publishpress-headline .cme-subtext a {font-weight: bold}
222
+ div.publishpress-headline .cme-subtext a:hover {text-decoration: underline}
admin.dev.js CHANGED
@@ -24,6 +24,13 @@ jQuery(document).ready( function($) {
24
return false;
25
});
26
27
$('input.cme-check-all').click( function(e) {
28
$(this).closest('table').find('input[type="checkbox"][disabled!="disabled"]:visible').prop('checked', $(this).is(":checked") );
29
});
24
return false;
25
});
26
27
+ $("#publishpress_caps_form").bind("keypress", function(e) {
28
+ if (e.keyCode == 13) {
29
+ $(document.activeElement).parent().find('input[type="submit"]').first().click();
30
+ return false;
31
+ }
32
+ });
33
+
34
$('input.cme-check-all').click( function(e) {
35
$(this).closest('table').find('input[type="checkbox"][disabled!="disabled"]:visible').prop('checked', $(this).is(":checked") );
36
});
admin.js CHANGED
@@ -1,3 +1,3 @@
1
- jQuery(document).ready(function($){$('a.neg-cap').attr('title',cmeAdmin.negationCaption);$('a.neg-type-caps').attr('title',cmeAdmin.typeCapsNegationCaption);$('td.cap-unreg').attr('title',cmeAdmin.typeCapUnregistered);$('a.normal-cap').attr('title',cmeAdmin.switchableCaption);$('span.cap-x').attr('title',cmeAdmin.capNegated);$('table.cme-checklist input[class!="cme-check-all"]').not(':disabled').attr('title',cmeAdmin.chkCaption);$('table.cme-checklist a.neg-cap').click(function(e){$(this).closest('td').removeClass('cap-yes').removeClass('cap-no').addClass('cap-neg');var cap_name_attr=$(this).parent().find('input[type="checkbox"]').attr('name');$(this).after('<input type="hidden" class="cme-negation-input" name="'+cap_name_attr+'" value="" />');return false;});$(document).on('click','table.cme-typecaps span.cap-x,table.cme-checklist span.cap-x,table.cme-checklist td.cap-neg span',function(e){$(this).closest('td').removeClass('cap-neg').removeClass('cap-yes').addClass('cap-no');$(this).parent().find('input[type="checkbox"]').prop('checked',false);$(this).parent().find('input.cme-negation-input').remove();return false;});$('input.cme-check-all').click(function(e){$(this).closest('table').find('input[type="checkbox"][disabled!="disabled"]:visible').prop('checked',$(this).is(":checked"));});$('a.cme-neg-all').click(function(e){$(this).closest('table').find('a.neg-cap:visible').click();return false;});$('a.cme-switch-all').click(function(e){$(this).closest('table').find('td.cap-neg span').click();return false;});$('table.cme-typecaps a.neg-type-caps').click(function(e){$(this).closest('tr').find('td[class!="cap-neg"]').filter('td[class!="cap-unreg"]').each(function(){$(this).addClass('cap-neg');var cap_name_attr=$(this).find('input[type="checkbox"]').attr('name');$(this).append('<input type="hidden" class="cme-negation-input" name="'+cap_name_attr+'" value="" />');});return false;});$('table.cme-typecaps th').click(function(){var columnNo=$(this).index();var check_val=!$(this).prop('checked_all');if($(this).hasClass('term-cap'))
2
var class_sel='[class*="term-cap"]';else
3
var class_sel='[class*="post-cap"]';$(this).closest("table").find("tr td"+class_sel+":nth-child("+(columnNo+1)+') input[type="checkbox"]:visible').prop("checked",check_val);$(this).prop('checked_all',check_val);});$('a.cme-fix-read-cap').click(function(){$('input[name="caps[read]"]').prop('checked',true);$('input[name="SaveRole"]').trigger('click');return false;});});
1
+ jQuery(document).ready(function($){$('a.neg-cap').attr('title',cmeAdmin.negationCaption);$('a.neg-type-caps').attr('title',cmeAdmin.typeCapsNegationCaption);$('td.cap-unreg').attr('title',cmeAdmin.typeCapUnregistered);$('a.normal-cap').attr('title',cmeAdmin.switchableCaption);$('span.cap-x').attr('title',cmeAdmin.capNegated);$('table.cme-checklist input[class!="cme-check-all"]').not(':disabled').attr('title',cmeAdmin.chkCaption);$('table.cme-checklist a.neg-cap').click(function(e){$(this).closest('td').removeClass('cap-yes').removeClass('cap-no').addClass('cap-neg');var cap_name_attr=$(this).parent().find('input[type="checkbox"]').attr('name');$(this).after('<input type="hidden" class="cme-negation-input" name="'+cap_name_attr+'" value="" />');return false;});$(document).on('click','table.cme-typecaps span.cap-x,table.cme-checklist span.cap-x,table.cme-checklist td.cap-neg span',function(e){$(this).closest('td').removeClass('cap-neg').removeClass('cap-yes').addClass('cap-no');$(this).parent().find('input[type="checkbox"]').prop('checked',false);$(this).parent().find('input.cme-negation-input').remove();return false;});$("#publishpress_caps_form").bind("keypress",function(e){if(e.keyCode==13){$(document.activeElement).parent().find('input[type="submit"]').first().click();return false;}});$('input.cme-check-all').click(function(e){$(this).closest('table').find('input[type="checkbox"][disabled!="disabled"]:visible').prop('checked',$(this).is(":checked"));});$('a.cme-neg-all').click(function(e){$(this).closest('table').find('a.neg-cap:visible').click();return false;});$('a.cme-switch-all').click(function(e){$(this).closest('table').find('td.cap-neg span').click();return false;});$('table.cme-typecaps a.neg-type-caps').click(function(e){$(this).closest('tr').find('td[class!="cap-neg"]').filter('td[class!="cap-unreg"]').each(function(){$(this).addClass('cap-neg');var cap_name_attr=$(this).find('input[type="checkbox"]').attr('name');$(this).append('<input type="hidden" class="cme-negation-input" name="'+cap_name_attr+'" value="" />');});return false;});$('table.cme-typecaps th').click(function(){var columnNo=$(this).index();var check_val=!$(this).prop('checked_all');if($(this).hasClass('term-cap'))
2
var class_sel='[class*="term-cap"]';else
3
var class_sel='[class*="post-cap"]';$(this).closest("table").find("tr td"+class_sel+":nth-child("+(columnNo+1)+') input[type="checkbox"]:visible').prop("checked",check_val);$(this).prop('checked_all',check_val);});$('a.cme-fix-read-cap').click(function(){$('input[name="caps[read]"]').prop('checked',true);$('input[name="SaveRole"]').trigger('click');return false;});});
capsman-enhanced.php CHANGED
@@ -3,7 +3,7 @@
3
* Plugin Name: PublishPress Capabilities
4
* Plugin URI: https://publishpress.com/capability-manager/
5
* Description: Manage WordPress role definitions, per-site or network-wide. Organizes post capabilities by post type and operation.
6
- * Version: 1.9
7
* Author: PublishPress
8
* Author URI: https://publishpress.com/
9
* Text Domain: capsman-enhanced
@@ -25,13 +25,13 @@
25
* @copyright Copyright (C) 2009, 2010 Jordi Canals; modifications Copyright (C) 2020 PublishPress
26
* @license GNU General Public License version 3
27
* @link https://publishpress.com/
28
- * @version 1.9
29
*/
30
31
if (!defined('CAPSMAN_VERSION')) {
32
- define('CAPSMAN_VERSION', '1.9');
33
- define('CAPSMAN_ENH_VERSION', '1.9');
34
- define('PUBLISHPRESS_CAPS_VERSION', '1.9');
35
}
36
37
foreach (get_option('active_plugins') as $plugin_file) {
@@ -47,7 +47,7 @@ foreach (get_option('active_plugins') as $plugin_file) {
47
$pro_active = false;
48
49
foreach ((array)get_option('active_plugins') as $plugin_file) {
50
- if (false !== strpos($plugin_file, 'capabilities-pro-by-publishpress.php')) {
51
$pro_active = true;
52
break;
53
}
@@ -55,7 +55,7 @@ foreach ((array)get_option('active_plugins') as $plugin_file) {
55
56
if (!$pro_active && is_multisite()) {
57
foreach (array_keys((array)get_site_option('active_sitewide_plugins')) as $plugin_file) {
58
- if (false !== strpos($plugin_file, 'capabilities-pro-by-publishpress.php')) {
59
$pro_active = true;
60
break;
61
}
@@ -115,7 +115,7 @@ if ( version_compare(PHP_VERSION, '5.4.0', '<') ) {
115
|| in_array( $pagenow, array( 'users.php', 'user-edit.php', 'profile.php', 'user-new.php' ) )
116
) ) {
117
global $capsman;
118
-
119
// Run the plugin
120
require_once ( dirname(__FILE__) . '/framework/lib/formating.php' );
121
require_once ( dirname(__FILE__) . '/framework/lib/users.php' );
@@ -126,6 +126,11 @@ if ( version_compare(PHP_VERSION, '5.4.0', '<') ) {
126
load_plugin_textdomain('capsman-enhanced', false, basename(dirname(__FILE__)) .'/lang');
127
add_action( 'admin_menu', 'cme_submenus', 20 );
128
}
129
}
130
131
add_action( 'init', '_cme_init' );
@@ -136,4 +141,4 @@ add_action( 'init', '_cme_cap_helper', 49 ); // Press Permit Cap Helper, regist
136
// @todo: do this in PP Core also
137
138
if ( is_multisite() )
139
- require_once ( dirname(__FILE__) . '/includes/network.php' );
3
* Plugin Name: PublishPress Capabilities
4
* Plugin URI: https://publishpress.com/capability-manager/
5
* Description: Manage WordPress role definitions, per-site or network-wide. Organizes post capabilities by post type and operation.
6
+ * Version: 1.9.2
7
* Author: PublishPress
8
* Author URI: https://publishpress.com/
9
* Text Domain: capsman-enhanced
25
* @copyright Copyright (C) 2009, 2010 Jordi Canals; modifications Copyright (C) 2020 PublishPress
26
* @license GNU General Public License version 3
27
* @link https://publishpress.com/
28
+ * @version 1.9.2
29
*/
30
31
if (!defined('CAPSMAN_VERSION')) {
32
+ define('CAPSMAN_VERSION', '1.9.2');
33
+ define('CAPSMAN_ENH_VERSION', '1.9.2');
34
+ define('PUBLISHPRESS_CAPS_VERSION', '1.9.2');
35
}
36
37
foreach (get_option('active_plugins') as $plugin_file) {
47
$pro_active = false;
48
49
foreach ((array)get_option('active_plugins') as $plugin_file) {
50
+ if (false !== strpos($plugin_file, 'capabilities-pro.php')) {
51
$pro_active = true;
52
break;
53
}
55
56
if (!$pro_active && is_multisite()) {
57
foreach (array_keys((array)get_site_option('active_sitewide_plugins')) as $plugin_file) {
58
+ if (false !== strpos($plugin_file, 'capabilities-pro.php')) {
59
$pro_active = true;
60
break;
61
}
115
|| in_array( $pagenow, array( 'users.php', 'user-edit.php', 'profile.php', 'user-new.php' ) )
116
) ) {
117
global $capsman;
118
+
119
// Run the plugin
120
require_once ( dirname(__FILE__) . '/framework/lib/formating.php' );
121
require_once ( dirname(__FILE__) . '/framework/lib/users.php' );
126
load_plugin_textdomain('capsman-enhanced', false, basename(dirname(__FILE__)) .'/lang');
127
add_action( 'admin_menu', 'cme_submenus', 20 );
128
}
129
+
130
+ if (is_admin() && !defined('PUBLISHPRESS_CAPS_PRO_VERSION')) {
131
+ require_once(__DIR__ . '/includes/CoreAdmin.php');
132
+ new \PublishPress\Capabilities\CoreAdmin();
133
+ }
134
}
135
136
add_action( 'init', '_cme_init' );
141
// @todo: do this in PP Core also
142
143
if ( is_multisite() )
144
+ require_once ( dirname(__FILE__) . '/includes/network.php' );
composer.json ADDED
@@ -0,0 +1,20 @@
1
+ {
2
+ "name": "publishpress/publishpress-capabilities",
3
+ "type": "wordpress-plugin",
4
+ "description": "",
5
+ "license": "GPL-2",
6
+ "authors": [
7
+ {
8
+ "name": "PublishPress",
9
+ "email": "help@publishpress.com"
10
+ }
11
+ ],
12
+ "config": {
13
+ "preferred-install": "dist"
14
+ },
15
+ "minimum-stability": "stable",
16
+ "require": {
17
+ "php": ">=5.6.20",
18
+ "publishpress/wordpress-version-notices": "dev-master"
19
+ }
20
+ }
includes/CoreAdmin.php ADDED
@@ -0,0 +1,47 @@
1
+ <?php
2
+ namespace PublishPress\Capabilities;
3
+
4
+ class CoreAdmin {
5
+ function __construct() {
6
+ add_action('admin_print_scripts', [$this, 'setUpgradeMenuLink'], 50);
7
+
8
+ if (is_admin()) {
9
+ $autoloadPath = PUBLISHPRESS_CAPS_ABSPATH . DIRECTORY_SEPARATOR . 'vendor' . DIRECTORY_SEPARATOR . 'autoload.php';
10
+ if (file_exists($autoloadPath)) {
11
+ require_once $autoloadPath;
12
+ }
13
+
14
+ require_once PUBLISHPRESS_CAPS_ABSPATH . DIRECTORY_SEPARATOR . 'vendor' . DIRECTORY_SEPARATOR . 'publishpress' . DIRECTORY_SEPARATOR
15
+ . 'wordpress-version-notices' . DIRECTORY_SEPARATOR . 'includes.php';
16
+
17
+ add_filter(\PPVersionNotices\Module\TopNotice\Module::SETTINGS_FILTER, function ($settings) {
18
+ $settings['capabilities'] = [
19
+ 'message' => 'You\'re using PublishPress Capabilities Free. The Pro version has more features and support. %sUpgrade to Pro%s',
20
+ 'link' => 'https://publishpress.com/links/capabilities-banner',
21
+ 'screens' => [
22
+ ['base' => 'toplevel_page_capsman'],
23
+ ['base' => 'capabilities_page_capsman-tool'],
24
+ ['base' => 'capabilities_page_capability-settings'],
25
+ ]
26
+ ];
27
+
28
+ return $settings;
29
+ });
30
+ }
31
+ }
32
+
33
+ function setUpgradeMenuLink() {
34
+ $url = 'https://publishpress.com/links/capabilities-menu';
35
+ ?>
36
+ <style type="text/css">
37
+ #toplevel_page_capsman ul li:last-of-type a {font-weight: bold !important; color: #FEB123 !important;}
38
+ </style>
39
+
40
+ <script type="text/javascript">
41
+ jQuery(document).ready(function($) {
42
+ $('#toplevel_page_capsman ul li:last a').attr('href', '<?php echo $url;?>').attr('target', '_blank').css('font-weight', 'bold').css('color', '#FEB123');
43
+ });
44
+ </script>
45
+ <?php
46
+ }
47
+ }
includes/admin.php CHANGED
@@ -1,1205 +1,1208 @@
1
- <?php
2
- /**
3
- * General Admin for Role Capabilities.
4
- * Provides admin pages to create and manage roles and capabilities.
5
- *
6
- * @author Jordi Canals, Kevin Behrens
7
- * @copyright Copyright (C) 2009, 2010 Jordi Canals, (C) 2020 PublishPress
8
- * @license GNU General Public License version 2
9
- * @link https://publishpress.com
10
- *
11
- *
12
- * Copyright 2009, 2010 Jordi Canals <devel@jcanals.cat>
13
- * Modifications Copyright 2020, PublishPress <help@publishpress.com>
14
- *
15
- * This program is free software; you can redistribute it and/or
16
- * modify it under the terms of the GNU General Public License
17
- * version 2 as published by the Free Software Foundation.
18
- *
19
- * This program is distributed in the hope that it will be useful,
20
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
21
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22
- * GNU General Public License for more details.
23
- *
24
- * You should have received a copy of the GNU General Public License
25
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
26
- **/
27
-
28
- global $capsman, $cme_cap_helper, $current_user;
29
-
30
- do_action('publishpress-caps_manager-load');
31
-
32
- $roles = $this->roles;
33
- $default = $this->current;
34
-
35
- if ( $block_read_removal = _cme_is_read_removal_blocked( $this->current ) ) {
36
- if ( $current = get_role($default) ) {
37
- if ( empty( $current->capabilities['read'] ) ) {
38
- ak_admin_error( sprintf( __( 'Warning: This role cannot access the dashboard without the read capability. %1$sClick here to fix this now%2$s.', 'capsman-enhanced' ), '<a href="javascript:void(0)" class="cme-fix-read-cap">', '</a>' ) );
39
- }
40
- }
41
- }
42
-
43
- require_once( dirname(__FILE__).'/pp-ui.php' );
44
- $pp_ui = new Capsman_PP_UI();
45
-
46
- if( defined('PRESSPERMIT_ACTIVE') ) {
47
- $pp_metagroup_caps = $pp_ui->get_metagroup_caps( $default );
48
- } else {
49
- $pp_metagroup_caps = array();
50
- }
51
- ?>
52
- <div class="wrap publishpress-caps-manage pressshack-admin-wrapper">
53
- <?php if( defined('PRESSPERMIT_ACTIVE') ) :
54
- pp_icon();
55
- $style = 'style="height:60px;"';
56
- ?>
57
- <?php else:
58
- $style = '';
59
- ?>
60
- <div id="icon-capsman-admin" class="icon32"></div>
61
- <?php endif; ?>
62
-
63
- <h1 <?php echo $style;?>><?php _e('Role Capabilities', 'capsman-enhanced') ?></h1>
64
-
65
- <form id="publishpress_caps_form" method="post" action="admin.php?page=<?php echo $this->ID ?>">
66
- <?php wp_nonce_field('capsman-general-manager'); ?>
67
- <fieldset>
68
- <table id="akmin">
69
- <tr>
70
- <td class="content">
71
- <dl>
72
- <dt>
73
- <?php
74
- $role_caption = (defined('PUBLISHPRESS_VERSION'))
75
- ? '<a href="' . admin_url("admin.php?page=pp-manage-roles&action=edit-role&role-id={$this->current}") . '">' . translate_user_role($roles[$default]) . '</a>'
76
- : translate_user_role($roles[$default]);
77
-
78
- printf(__('Capabilities for %s', 'capsman-enhanced'), $role_caption);
79
- ?>
80
- </dt>
81
-
82
- <dd>
83
- <div style="float:right">
84
- <input type="submit" name="SaveRole" value="<?php _e('Save Changes', 'capsman-enhanced') ?>" class="button-primary" /> &nbsp;
85
- </div>
86
-
87
- <?php
88
- global $capsman;
89
- $img_url = $capsman->mod_url . '/images/';
90
- ?>
91
- <div class="publishpress-headline">
92
- <span class="cme-subtext">
93
- <?php
94
- $msg = __( '<strong>Note:</strong> Capability changes <strong>remain in the database</strong> after plugin deactivation.', 'capsman-enhanced' );
95
-
96
- if (defined('PRESSPERMIT_ACTIVE') && function_exists('presspermit')) {
97
- if ($group = presspermit()->groups()->getMetagroup('wp_role', $this->current)) {
98
- $msg = sprintf(
99
- __('<strong>Note:</strong> Capability changes <strong>remain in the database</strong> after plugin deactivation. You can also configure this role as a %sPermission Group%s.', 'capsman-enhanced'),
100
- '<a href="' . admin_url("admin.php?page=presspermit-edit-permissions&action=edit&agent_id={$group->ID}") . '">',
101
- '</a>'
102
- );
103
- }
104
- }
105
- echo $msg;
106
- ?>
107
- </span>
108
- </div>
109
-
110
- <?php
111
- if ( defined( 'PRESSPERMIT_ACTIVE' ) ) {
112
- $pp_ui->show_capability_hints( $default );
113
- }
114
- ?>
115
-
116
- <script type="text/javascript">
117
- /* <![CDATA[ */
118
- jQuery(document).ready( function($) {
119
- $('a[href="#pp-more"]').click( function() {
120
- $('#pp_features').show();
121
- return false;
122
- });
123
- $('a[href="#pp-hide"]').click( function() {
124
- $('#pp_features').hide();
125
- return false;
126
- });
127
- });
128
- /* ]]> */
129
- </script>
130
-
131
- <?php /* play.png icon by Pavel: http://kde-look.org/usermanager/search.php?username=InFeRnODeMoN */ ?>
132
-
133
- <br /><div id="pp_features" style="display:none"><div class="pp-logo"><a href="https://publishpress.com/presspermit/"><img src="<?php echo $img_url;?>pp-logo.png" alt="<?php _e('PublishPress Permissions', 'capsman-enhanced');?>" /></a></div><div class="features-wrap"><ul class="pp-features">
134
- <li>
135
- <?php _e( "Automatically define type-specific capabilities for your custom post types and taxonomies", 'capsman-enhanced' );?>
136
- <a href="https://presspermit.com/tutorial/regulate-post-type-access" target="_blank"><img class="cme-play" alt="*" src="<?php echo $img_url;?>play.png" /></a></li>
137
-
138
- <li>
139
- <?php _e( "Assign standard WP roles supplementally for a specific post type", 'capsman-enhanced' );?>
140
- <a href="https://presspermit.com/tutorial/regulate-post-type-access" target="_blank"><img class="cme-play" alt="*" src="<?php echo $img_url;?>play.png" /></a></li>
141
-
142
- <li>
143
- <?php _e( "Assign custom WP roles supplementally for a specific post type <em>(Pro)</em>", 'capsman-enhanced' );?>
144
- </li>
145
-
146
- <li>
147
- <?php _e( "Customize reading permissions per-category or per-post", 'capsman-enhanced' );?>
148
- <a href="https://presspermit.com/tutorial/category-exceptions" target="_blank"><img class="cme-play" alt="*" src="<?php echo $img_url;?>play.png" /></a></li>
149
-
150
- <li>
151
- <?php _e( "Customize editing permissions per-category or per-post <em>(Pro)</em>", 'capsman-enhanced' );?>
152
- <a href="https://presspermit.com/tutorial/page-editing-exceptions" target="_blank"><img class="cme-play" alt="*" src="<?php echo $img_url;?>play.png" /></a></li>
153
-
154
- <li>
155
- <?php _e( "Custom Post Visibility statuses, fully implemented throughout wp-admin <em>(Pro)</em>", 'capsman-enhanced' );?>
156
- <a href="https://presspermit.com/tutorial/custom-post-visibility" target="_blank"><img class="cme-play" alt="*" src="<?php echo $img_url;?>play.png" /></a></li>
157
-
158
- <li>
159
- <?php _e( "Custom Moderation statuses for access-controlled, multi-step publishing workflow <em>(Pro)</em>", 'capsman-enhanced' );?>
160
- <a href="https://presspermit.com/tutorial/multi-step-moderation" target="_blank"><img class="cme-play" alt="*" src="<?php echo $img_url;?>play.png" /></a></li>
161
-
162
- <li>
163
- <?php _e( "Regulate permissions for Edit Flow post statuses <em>(Pro)</em>", 'capsman-enhanced' );?>
164
- <a href="https://presspermit.com/tutorial/edit-flow-integration" target="_blank"><img class="cme-play" alt="*" src="<?php echo $img_url;?>play.png" /></a></li>
165
-
166
- <li>
167
- <?php _e( "Customize the moderated editing of published content with Revisionary or Post Forking <em>(Pro)</em>", 'capsman-enhanced' );?>
168
- <a href="https://presspermit.com/tutorial/published-content-revision" target="_blank"><img class="cme-play" alt="*" src="<?php echo $img_url;?>play.png" /></a></li>
169
-
170
- <li>
171
- <?php _e( "Grant Spectator, Participant or Moderator access to specific bbPress forums <em>(Pro)</em>", 'capsman-enhanced' );?>
172
- </li>
173
-
174
- <li>
175
- <?php _e( "Grant supplemental content permissions to a BuddyPress group <em>(Pro)</em>", 'capsman-enhanced' );?>
176
- <a href="https://presspermit.com/tutorial/buddypress-content-permissions" target="_blank"><img class="cme-play" alt="*" src="<?php echo $img_url;?>play.png" /></a></li>
177
-
178
- <li>
179
- <?php _e( "WPML integration to mirror permissions to translations <em>(Pro)</em>", 'capsman-enhanced' );?>
180
- </li>
181
-
182
- <li>
183
- <?php _e( "Member support forum", 'capsman-enhanced' );?>
184
- </li>
185
-
186
- </ul></div>
187
-
188
- <?php
189
- echo '<div>';
190
- printf( __('%1$sgrab%2$s %3$s', 'capsman-enhanced'), '<strong>', '</strong>', '<span class="plugins update-message"><a href="' . cme_plugin_info_url('press-permit-core') . '" class="thickbox" title="' . sprintf( __('%s (free install)', 'capsman-enhanced'), 'Permissions Pro' ) . '">Permissions Pro</a></span>' );
191
- echo '&nbsp;&nbsp;&bull;&nbsp;&nbsp;';
192
- printf( __('%1$sbuy%2$s %3$s', 'capsman-enhanced'), '<strong>', '</strong>', '<a href="https://publishpress.com/presspermit/" target="_blank" title="' . sprintf( __('%s info/purchase', 'capsman-enhanced'), 'Permissions Pro' ) . '">Permissions&nbsp;Pro</a>' );
193
- echo '&nbsp;&nbsp;&bull;&nbsp;&nbsp;';
194
- echo '<a href="#pp-hide">hide</a>';
195
- echo '</div></div>';
196
-
197
- if ( MULTISITE ) {
198
- global $wp_roles;
199
- global $wpdb;
200
-
201
- if ( ! empty($_REQUEST['cme_net_sync_role'] ) ) {
202
- switch_to_blog(1);
203
- wp_cache_delete( $wpdb->prefix . 'user_roles', 'options' );
204
- }
205
-
206
- ( method_exists( $wp_roles, 'for_site' ) ) ? $wp_roles->for_site() : $wp_roles->reinit();
207
- }
208
-
209
- $capsman->reinstate_db_roles();
210
-
211
- $current = get_role($default);
212
-
213
- $rcaps = $current->capabilities;
214
-
215
- $is_administrator = current_user_can( 'administrator' ) || (is_multisite() && is_super_admin());
216
-
217
- $custom_types = get_post_types( array( '_builtin' => false ), 'names' );
218
- $custom_tax = get_taxonomies( array( '_builtin' => false ), 'names' );
219
-
220
- $defined = array();
221
- $defined['type'] = get_post_types( array( 'public' => true, 'show_ui' => true ), 'object', 'or' );
222
- $defined['taxonomy'] = get_taxonomies( array( 'public' => true ), 'object' );
223
-
224
- $unfiltered['type'] = apply_filters( 'pp_unfiltered_post_types', array( 'forum','topic','reply','wp_block' ) ); // bbPress' dynamic role def requires additional code to enforce stored caps
225
- $unfiltered['taxonomy'] = apply_filters( 'pp_unfiltered_taxonomies', array( 'post_status', 'topic-tag' ) ); // avoid confusion with Edit Flow administrative taxonomy
226
-
227
- $enabled_taxonomies = cme_get_assisted_taxonomies();
228
-
229
- /*
230
- if ( ( count($custom_types) || count($custom_tax) ) && ( $is_administrator || current_user_can( 'manage_pp_settings' ) ) ) {
231
- $cap_properties[''] = array();
232
- $force_distinct_ui = true;
233
- }
234
- */
235
-
236
- $cap_properties['edit']['type'] = array( 'edit_posts' );
237
-
238
- foreach( $defined['type'] as $type_obj ) {
239
- if ( 'attachment' != $type_obj->name ) {
240
- if ( isset( $type_obj->cap->create_posts ) && ( $type_obj->cap->create_posts != $type_obj->cap->edit_posts ) ) {
241
- $cap_properties['edit']['type'][]= 'create_posts';
242
- break;
243
- }
244
- }
245
- }
246
-
247
- $cap_properties['edit']['type'][]= 'edit_others_posts';
248
- $cap_properties['edit']['type'] = array_merge( $cap_properties['edit']['type'], array( 'publish_posts', 'edit_published_posts', 'edit_private_posts' ) );
249
-
250
- $cap_properties['edit']['taxonomy'] = array( 'manage_terms' );
251
-
252
- if ( ! defined( 'OLD_PRESSPERMIT_ACTIVE' ) )
253
- $cap_properties['edit']['taxonomy'] = array_merge( $cap_properties['edit']['taxonomy'], array( 'edit_terms', 'assign_terms' ) );
254
-
255
- $cap_properties['delete']['type'] = array( 'delete_posts', 'delete_others_posts' );
256
- $cap_properties['delete']['type'] = array_merge( $cap_properties['delete']['type'], array( 'delete_published_posts', 'delete_private_posts' ) );
257
-
258
- if ( ! defined( 'OLD_PRESSPERMIT_ACTIVE' ) )
259
- $cap_properties['delete']['taxonomy'] = array( 'delete_terms' );
260
- else
261
- $cap_properties['delete']['taxonomy'] = array();
262
-
263
- $cap_properties['read']['type'] = array( 'read_private_posts' );
264
- $cap_properties['read']['taxonomy'] = array();
265
-
266
- $stati = get_post_stati( array( 'internal' => false ) );
267
-
268
- $cap_type_names = array(
269
- '' => __( '&nbsp;', 'capsman-enhanced' ),
270
- 'read' => __( 'Reading', 'capsman-enhanced' ),
271
- 'edit' => __( 'Editing Capabilities', 'capsman-enhanced' ),
272
- 'delete' => __( 'Deletion Capabilities', 'capsman-enhanced' )
273
- );
274
-
275
- $cap_tips = array(
276
- 'read_private' => __( 'can read posts which are currently published with private visibility', 'capsman-enhanced' ),
277
- 'edit' => __( 'has basic editing capability (but may need other capabilities based on post status and ownership)', 'capsman-enhanced' ),
278
- 'edit_others' => __( 'can edit posts which were created by other users', 'capsman-enhanced' ),
279
- 'edit_published' => __( 'can edit posts which are currently published', 'capsman-enhanced' ),
280
- 'edit_private' => __( 'can edit posts which are currently published with private visibility', 'capsman-enhanced' ),
281
- 'publish' => __( 'can make a post publicly visible', 'capsman-enhanced' ),
282
- 'delete' => __( 'has basic deletion capability (but may need other capabilities based on post status and ownership)', 'capsman-enhanced' ),
283
- 'delete_others' => __( 'can delete posts which were created by other users', 'capsman-enhanced' ),
284
- 'delete_published' => __( 'can delete posts which are currently published', 'capsman-enhanced' ),
285
- 'delete_private' => __( 'can delete posts which are currently published with private visibility', 'capsman-enhanced' ),
286
- );
287
-
288
- $default_caps = array( 'read_private_posts', 'edit_posts', 'edit_others_posts', 'edit_published_posts', 'edit_private_posts', 'publish_posts', 'delete_posts', 'delete_others_posts', 'delete_published_posts', 'delete_private_posts',
289
- 'read_private_pages', 'edit_pages', 'edit_others_pages', 'edit_published_pages', 'edit_private_pages', 'publish_pages', 'delete_pages', 'delete_others_pages', 'delete_published_pages', 'delete_private_pages',
290
- 'manage_categories'
291
- );
292
- $type_caps = array();
293
- $type_metacaps = array();
294
-
295
- // Role Scoper and PP1 adjust attachment access based only on user's capabilities for the parent post
296
- if ( defined('OLD_PRESSPERMIT_ACTIVE') ) {
297
- unset( $defined['type']['attachment'] );
298
- }
299
-
300
- echo '<ul class="cme-listhoriz">';
301
-
302
- // cap_types: read, edit, deletion
303
- foreach( array_keys($cap_properties) as $cap_type ) {
304
- echo '<li>';
305
- echo '<h3>' . $cap_type_names[$cap_type] . '</h3>';
306
-
307
- echo "<div class='cme-cap-type-tables cme-cap-type-tables-$cap_type'>";
308
-
309
- foreach( array_keys($defined) as $item_type ) {
310
- if ( ( 'delete' == $cap_type ) && ( 'taxonomy' == $item_type ) ) {
311
- if ( defined('OLD_PRESSPERMIT_ACTIVE') ) {
312
- continue;
313
- }
314
-
315
- $any_term_deletion_caps = false;
316
- foreach( array_keys($defined['taxonomy']) as $_tax ) {
317
- if ( isset( $defined['taxonomy'][$_tax]->cap->delete_terms ) && ( 'manage_categories' != $defined['taxonomy'][$_tax]->cap->delete_terms ) && ! in_array( $_tax, $unfiltered['taxonomy'] ) ) {
318
- $any_term_deletion_caps = true;
319
- break;
320
- }
321
- }
322
-
323
- if ( ! $any_term_deletion_caps )
324
- continue;
325
- }
326
-
327
- if ( ! count( $cap_properties[$cap_type][$item_type] ) )
328
- continue;
329
-
330
- echo "<table class='cme-typecaps cme-typecaps-$cap_type'>";
331
-
332
- echo '<tr><th></th>';
333
-
334
- // label cap properties
335
- foreach( $cap_properties[$cap_type][$item_type] as $prop ) {
336
- $prop = str_replace( '_posts', '', $prop );
337
- $prop = str_replace( '_pages', '', $prop );
338
- $prop = str_replace( '_terms', '', $prop );
339
- $tip = ( isset( $cap_tips[$prop] ) ) ? "title='{$cap_tips[$prop]}'" : '';
340
- $prop = str_replace( '_', '<br />', $prop );
341
- $th_class = ( 'taxonomy' == $item_type ) ? ' class="term-cap"' : ' class="post-cap"';
342
- echo "<th $tip{$th_class}>";
343
-
344
- if ( ( 'delete' != $prop ) || ( 'taxonomy' != $item_type ) || cme_get_detailed_taxonomies() ) {
345
- echo ucwords($prop);
346
- }
347
-
348
- echo '</th>';
349
- }
350
-
351
- echo '</tr>';
352
-
353
- foreach( $defined[$item_type] as $key => $type_obj ) {
354
- if ( in_array( $key, $unfiltered[$item_type] ) )
355
- continue;
356
-
357
- $row = "<tr class='cme_type_{$key}'>";
358
-
359
- if ( $cap_type ) {
360
- if ( empty($force_distinct_ui) && empty( $cap_properties[$cap_type][$item_type] ) )
361
- continue;
362
-
363
- $row .= "<td><a class='cap_type' href='#toggle_type_caps'>" . $type_obj->labels->name . '</a>';
364
- $row .= '<a href="#" class="neg-type-caps">&nbsp;x&nbsp;</a>';
365
- $row .= '</td>';
366
-
367
- $display_row = ! empty($force_distinct_ui);
368
-
369
- foreach( $cap_properties[$cap_type][$item_type] as $prop ) {
370
- $td_classes = array();
371
- $checkbox = '';
372
- $title = '';
373
-
374
- if ( ! empty($type_obj->cap->$prop) && ( in_array( $type_obj->name, array( 'post', 'page' ) )
375
- || ! in_array( $type_obj->cap->$prop, $default_caps )
376
- || ( ( 'manage_categories' == $type_obj->cap->$prop ) && ( 'manage_terms' == $prop ) && ( 'category' == $type_obj->name ) ) ) ) {
377
-
378
- // if edit_published or edit_private cap is same as edit_posts cap, don't display a checkbox for it
379
- if ( ( ! in_array( $prop, array( 'edit_published_posts', 'edit_private_posts', 'create_posts' ) ) || ( $type_obj->cap->$prop != $type_obj->cap->edit_posts ) )
380
- && ( ! in_array( $prop, array( 'delete_published_posts', 'delete_private_posts' ) ) || ( $type_obj->cap->$prop != $type_obj->cap->delete_posts ) )
381
- && ( ! in_array( $prop, array( 'edit_terms', 'delete_terms' ) ) || ( $type_obj->cap->$prop != $type_obj->cap->manage_terms ) )
382
-
383
- && ( ! in_array( $prop, array( 'manage_terms', 'edit_terms', 'delete_terms', 'assign_terms' ) )
384
- || empty($cme_cap_helper->all_taxonomy_caps[$type_obj->cap->$prop])
385
- || ( $cme_cap_helper->all_taxonomy_caps[ $type_obj->cap->$prop ] <= 1 )
386
- || $type_obj->cap->$prop == str_replace( '_terms', "_{$type_obj->name}s", $prop )
387
- || $type_obj->cap->$prop == str_replace( '_terms', "_" . _cme_get_plural($type_obj->name, $type_obj), $prop )
388
- )
389
-
390
- && ( in_array( $prop, array( 'manage_terms', 'edit_terms', 'delete_terms', 'assign_terms' ) )
391
- || empty($cme_cap_helper->all_type_caps[$type_obj->cap->$prop])
392
- || ( $cme_cap_helper->all_type_caps[ $type_obj->cap->$prop ] <= 1 )
393
- || $type_obj->cap->$prop == 'upload_files' && 'create_posts' == $prop && 'attachment' == $type_obj->name
394
- || $type_obj->cap->$prop == str_replace( '_posts', "_{$type_obj->name}s", $prop )
395
- || $type_obj->cap->$prop == str_replace( '_pages', "_{$type_obj->name}s", $prop )
396
- || $type_obj->cap->$prop == str_replace( '_posts', "_" . _cme_get_plural($type_obj->name, $type_obj), $prop )
397
- || $type_obj->cap->$prop == str_replace( '_pages', "_" . _cme_get_plural($type_obj->name, $type_obj), $prop )
398
- )
399
- ) {
400
- // only present these term caps up top if we are ensuring that they get enforced separately from manage_terms
401
- if ( in_array( $prop, array( 'edit_terms', 'delete_terms', 'assign_terms' ) ) && ( ! in_array( $type_obj->name, cme_get_detailed_taxonomies() ) || defined( 'OLD_PRESSPERMIT_ACTIVE' ) ) ) {
402
- continue;
403
- }
404
-
405
- $cap_name = $type_obj->cap->$prop;
406
-
407
- if ( 'taxonomy' == $item_type )
408
- $td_classes []= "term-cap";
409
- else
410
- $td_classes []= "post-cap";
411
-
412
- if ( ! empty($pp_metagroup_caps[$cap_name]) )
413
- $td_classes []='cm-has-via-pp';
414
-
415
- if ( $is_administrator || current_user_can($cap_name) ) {
416
- if ( ! empty($pp_metagroup_caps[$cap_name]) ) {
417
- $title = ' title="' . sprintf( __( '%s: assigned by Permission Group', 'capsman-enhanced' ), $cap_name ) . '"';
418
- } else {
419
- $title = ' title="' . $cap_name . '"';
420
- }
421
-
422
- $disabled = '';
423
- $checked = checked(1, ! empty($rcaps[$cap_name]), false );
424
-
425
- $checkbox = '<input type="checkbox"' . $title . ' name="caps[' . $cap_name . ']" value="1" ' . $checked . $disabled . ' />';
426
-
427
- $type_caps [$cap_name] = true;
428
- $display_row = true;
429
- }
430
- } else {
431
- //$td_classes []= "cap-unreg";
432
- $title = 'title="' . sprintf( __( 'shared capability: %s', 'capsman-enhanced' ), esc_attr( $type_obj->cap->$prop ) ) . '"';
433
- }
434
-
435
- if ( isset($rcaps[$cap_name]) && empty($rcaps[$cap_name]) ) {
436
- $td_classes []= "cap-neg";
437
- }
438
- } else {
439
- $td_classes []= "cap-unreg";
440
- }
441
-
442
- $td_class = ( $td_classes ) ? 'class="' . implode(' ', $td_classes) . '"' : '';
443
-
444
- $row .= "<td $td_class $title><span class='cap-x'>X</span>$checkbox";
445
-
446
- if ( false !== strpos( $td_class, 'cap-neg' ) )
447
- $row .= '<input type="hidden" class="cme-negation-input" name="caps[' . $cap_name . ']" value="" />';
448
-
449
- $row .= "</td>";
450
- }
451
-
452
- if ('type' == $item_type) {
453
- $type_metacaps[$type_obj->cap->read_post] = true;
454
- $type_metacaps[$type_obj->cap->edit_post] = isset($type_obj->cap->edit_posts) && ($type_obj->cap->edit_post != $type_obj->cap->edit_posts);
455
- $type_metacaps[$type_obj->cap->delete_post] = isset($type_obj->cap->delete_posts) && ($type_obj->cap->delete_post != $type_obj->cap->delete_posts);
456
-
457
- } elseif ('taxonomy' == $item_type && !empty($type_obj->cap->edit_term) && !empty($type_obj->cap->delete_term)) {
458
- $type_metacaps[$type_obj->cap->edit_term] = true;
459
- $type_metacaps[$type_obj->cap->delete_term] = true;
460
- }
461
- }
462
-
463
- if ( $display_row ) {
464
- $row .= '</tr>';
465
- echo $row;
466
- }
467
- }
468
-
469
- echo '</table>';
470
-
471
- } // end foreach item type
472
-
473
- echo '</div>';
474
-
475
- echo '</li>';
476
- }
477
-
478
-
479
- do_action('publishpress-caps_manager_postcaps_section', compact('current', 'rcaps', 'pp_metagroup_caps', 'is_administrator', 'default_caps', 'custom_types', 'defined', 'unfiltered', 'pp_metagroup_caps'));
480
-
481
- $type_caps = apply_filters('publishpress_caps_manager_typecaps', $type_caps);
482
-
483
- echo '</ul>';
484
-
485
- // clicking on post type name toggles corresponding checkbox selections
486
- ?>
487
- <script type="text/javascript">
488
- /* <![CDATA[ */
489
- jQuery(document).ready( function($) {
490
- $('a[href="#toggle_type_caps"]').click( function() {
491
- var chks = $(this).closest('tr').find('input');
492
- $(chks).prop( 'checked', ! $(chks).first().is(':checked') );
493
- return false;
494
- });
495
- });
496
- /* ]]> */
497
- </script>
498
- <?php
499
-
500
- echo '<p>&nbsp;</p><h3>' . __( 'Other WordPress Core Capabilities', 'capsman-enhanced' ) . '</h3>';
501
- echo '<table class="form-table cme-checklist"><tr>';
502
-
503
- $checks_per_row = get_option( 'cme_form-rows', 5 );
504
- $i = 0; $first_row = true;
505
-
506
- $core_caps = _cme_core_caps();
507
- foreach( array_keys($core_caps) as $cap_name ) {
508
- if ( ! $is_administrator && ! current_user_can($cap_name) )
509
- continue;
510
-
511
- if ( $i == $checks_per_row ) {
512
- echo '</tr><tr>';
513
- $i = 0;
514
- }
515
-
516
- if ( ! isset( $rcaps[$cap_name] ) )
517
- $class = 'cap-no';
518
- else
519
- $class = ( $rcaps[$cap_name] ) ? 'cap-yes' : 'cap-neg';
520
-
521
- if ( ! empty($pp_metagroup_caps[$cap_name]) ) {
522
- $class .= ' cap-metagroup';
523
- $title_text = sprintf( __( '%s: assigned by Permission Group', 'capsman-enhanced' ), $cap_name );
524
- } else {
525
- $title_text = $cap_name;
526
- }
527
-
528
- $disabled = '';
529
- $checked = checked(1, ! empty($rcaps[$cap_name]), false );
530
- $lock_capability = false;
531
- $title = $title_text;
532
-
533
- if ( 'read' == $cap_name ) {
534
- if ( ! empty( $block_read_removal ) ) {
535
- // prevent the read capability from being removed from a core role, but don't force it to be added
536
- if ( $checked || apply_filters( 'pp_caps_force_capability_storage', false, 'read', $default ) ) {
537
- if ( apply_filters( 'pp_caps_lock_capability', true, 'read', $default ) ) {
538
- $lock_capability = true;
539
- $class .= ' cap-locked';
540
- $disabled = 'disabled="disabled"';
541
- if ( 'administrator' != $this->current ) {
542
- $title = esc_attr( __('Lockout Prevention: To remove read capability, first remove WordPress admin / editing capabilities, or add "dashboard_lockout_ok" capability', 'capsman-enhanced' ) );
543
- }
544
- }
545
- }
546
- }
547
- }
548
-
549
- ?>
550
- <td class="<?php echo $class; ?>"><span class="cap-x">X</span><label title="<?php echo $title;?>"><input type="checkbox" name="caps[<?php echo $cap_name; ?>]" value="1" <?php echo $checked . $disabled;?> />
551
- <span>
552
- <?php
553
- echo str_replace( '_', ' ', $cap_name );
554
- ?>
555
- </span></label><a href="#" class="neg-cap">&nbsp;x&nbsp;</a>
556
- <?php if ( false !== strpos( $class, 'cap-neg' ) ) :?>
557
- <input type="hidden" class="cme-negation-input" name="caps[<?php echo $cap_name; ?>]" value="" />
558
- <?php endif; ?>
559
- </td>
560
-
561
- <?php
562
-
563
- if ( $lock_capability ) {
564
- echo '<input type="hidden" name="caps[' . $cap_name . ']" value="1" />';
565
- }
566
-
567
- ++$i;
568
- }
569
-
570
- if ( $i == $checks_per_row ) {
571
- echo '</tr>';
572
- $i = 0;
573
- } elseif ( ! $first_row ) {
574
- // Now close a wellformed table
575
- for ( $i; $i < $checks_per_row; $i++ ){
576
- echo '<td>&nbsp;</td>';
577
- }
578
- echo '</tr>';
579
- }
580
- ?>
581
-
582
- <tr class="cme-bulk-select">
583
- <td colspan="<?php echo $checks_per_row;?>">
584
- <span style="float:right">
585
- <input type="checkbox" class="cme-check-all" title="<?php _e('check/uncheck all', 'capsman-enhanced');?>">&nbsp;&nbsp;<a class="cme-neg-all" href="#" title="<?php _e('negate all (storing as disabled capabilities)', 'capsman-enhanced');?>">X</a> <a class="cme-switch-all" href="#" title="<?php _e('negate none (add/remove all capabilities normally)', 'capsman-enhanced');?>">X</a>
586
- </span>
587
- </td></tr>
588
-
589
- </table>
590
- <?php
591
- $all_capabilities = apply_filters( 'capsman_get_capabilities', array_keys( $this->capabilities ), $this->ID );
592
- $all_capabilities = apply_filters( 'members_get_capabilities', $all_capabilities );
593
-
594
- /*
595
- $publishpress_status_change_caps = array();
596
- foreach( $all_capabilities as $cap_name ) {
597
- if (0 === strpos($cap_name, 'status_change_')) {
598
- $publishpress_status_change_caps []= $cap_name;
599
- }
600
- }
601
- */
602
-
603
- $plugin_caps = apply_filters('cme_plugin_capabilities',
604
- [
605
- 'PublishPress' => apply_filters('cme_publishpress_capabilities',
606
- array(
607
- 'edit_metadata',
608
- 'edit_post_subscriptions',
609
- 'ppma_edit_orphan_post',
610
- 'pp_manage_roles',
611
- 'pp_set_notification_channel',
612
- 'pp_view_calendar',
613
- 'pp_view_content_overview',
614
- 'status_change',
615
- )
616
- ),
617
-
618
- 'PublishPress Permissions' => apply_filters('cme_presspermit_capabilities',
619
- array(
620
- 'edit_own_attachments',
621
- 'list_others_unattached_files',
622
- 'pp_administer_content',
623
- 'pp_assign_roles',
624
- 'pp_associate_any_page',
625
- 'pp_create_groups',
626
- 'pp_create_network_groups',
627
- 'pp_define_moderation',
628
- 'pp_define_post_status',
629
- 'pp_define_privacy',
630
- 'pp_delete_groups',
631
- 'pp_edit_groups',
632
- 'pp_exempt_edit_circle',
633
- 'pp_exempt_read_circle',
634
- 'pp_force_quick_edit',
635
- 'pp_list_all_files',
636
- 'pp_manage_capabilities',
637
- 'pp_manage_members',
638
- 'pp_manage_network_members',
639
- 'pp_manage_roles',
640
- 'pp_manage_settings',
641
- 'pp_moderate_any',
642
- 'pp_set_associate_exceptions',
643
- 'pp_set_edit_exceptions',
644
- 'pp_set_notification_channel',
645
- 'pp_set_read_exceptions',
646
- 'pp_set_revise_exceptions',
647
- 'pp_set_term_assign_exceptions',
648
- 'pp_set_term_associate_exceptions',
649
- 'pp_set_term_manage_exceptions',
650
- 'pp_unfiltered',
651
- 'set_posts_status',
652
- )
653
- ),
654
-
655
- 'WooCommerce' => apply_filters('cme_woocommerce_capabilities',
656
- array(
657
- 'assign_product_terms',
658
- 'assign_shop_coupon_terms',
659
- 'assign_shop_discount_terms',
660
- 'assign_shop_order_terms',
661
- 'assign_shop_payment_terms',
662
- 'create_shop_orders',
663
- 'delete_others_products',
664
- 'delete_others_shop_coupons',
665
- 'delete_others_shop_discounts',
666
- 'delete_others_shop_orders',
667
- 'delete_others_shop_payments',
668
- 'delete_private_products',
669
- 'delete_private_shop_coupons',
670
- 'delete_private_shop_orders',
671
- 'delete_private_shop_discounts',
672
- 'delete_private_shop_payments',
673
- 'delete_product_terms',
674
- 'delete_products',
675
- 'delete_published_products',
676
- 'delete_published_shop_coupons',
677
- 'delete_published_shop_discounts',
678
- 'delete_published_shop_orders',
679
- 'delete_published_shop_payments',
680
- 'delete_shop_coupons',
681
- 'delete_shop_coupon_terms',
682
- 'delete_shop_discount_terms',
683
- 'delete_shop_discounts',
684
- 'delete_shop_order_terms',
685
- 'delete_shop_orders',
686
- 'delete_shop_payments',
687
- 'delete_shop_payment_terms',
688
- 'edit_others_products',
689
- 'edit_others_shop_coupons',
690
- 'edit_others_shop_discounts',
691
- 'edit_others_shop_orders',
692
- 'edit_others_shop_payments',
693
- 'edit_private_products',
694
- 'edit_private_shop_coupons',
695
- 'edit_private_shop_discounts',
696
- 'edit_private_shop_orders',
697
- 'edit_private_shop_payments',
698
- 'edit_product_terms',
699
- 'edit_products',
700
- 'edit_published_products',
701
- 'edit_published_shop_coupons',
702
- 'edit_published_shop_discounts',
703
- 'edit_published_shop_orders',
704
- 'edit_published_shop_payments',
705
- 'edit_shop_coupon_terms',
706
- 'edit_shop_coupons',
707
- 'edit_shop_discounts',
708
- 'edit_shop_discount_terms',
709
- 'edit_shop_order_terms',
710
- 'edit_shop_orders',
711
- 'edit_shop_payments',
712
- 'edit_shop_payment_terms',
713
- 'export_shop_payments',
714
- 'export_shop_reports',
715
- 'import_shop_discounts',
716
- 'import_shop_payments',
717
- 'manage_product_terms',
718
- 'manage_shop_coupon_terms',
719
- 'manage_shop_discounts',
720
- 'manage_shop_discount_terms',
721
- 'manage_shop_payment_terms',
722
- 'manage_shop_order_terms',
723
- 'manage_shop_settings',
724
- 'manage_woocommerce',
725
- 'publish_products',
726
- 'publish_shop_coupons',
727
- 'publish_shop_discounts',
728
- 'publish_shop_orders',
729
- 'publish_shop_payments',
730
- 'read_private_products',
731
- 'read_private_shop_coupons',
732
- 'read_private_shop_discounts',
733
- 'read_private_shop_payments',
734
- 'read_private_shop_orders',
735
- 'view_admin_dashboard',
736
- 'view_shop_discount_stats',
737
- 'view_shop_payment_stats',
738
- 'view_shop_reports',
739
- 'view_shop_sensitive_data',
740
- 'view_woocommerce_reports',
741
- )
742
- ),
743
- ]
744
- );
745
-
746
- foreach($plugin_caps as $plugin => $__plugin_caps) {
747
- if (!is_multisite() || !is_super_admin()) {
748
- if (!$_plugin_caps = array_fill_keys( array_intersect($__plugin_caps, $all_capabilities), true )) {
749
- continue;
750
- }
751
- } else {
752
- $_plugin_caps = array_fill_keys($__plugin_caps, true);
753
- }
754
-
755
- echo '<h3 class="cme-cap-section">' . sprintf(__( '%s Capabilities', 'capsman-enhanced' ), str_replace('_', ' ', $plugin )) . '</h3>';
756
- echo '<table class="form-table cme-checklist"><tr>';
757
-
758
- $checks_per_row = get_option( 'cme_form-rows', 5 );
759
- $i = 0; $first_row = true;
760
-
761
- foreach( array_keys($_plugin_caps) as $cap_name ) {
762
- if ( isset( $type_caps[$cap_name] ) || isset($core_caps[$cap_name]) || isset($type_metacaps[$cap_name]) ) {
763
- continue;
764
- }
765
-
766
- if ( ! $is_administrator && ! current_user_can($cap_name) )
767
- continue;
768
-
769
- if ( $i == $checks_per_row ) {
770
- echo '</tr><tr>';
771
- $i = 0;
772
- }
773
-
774
- if ( ! isset( $rcaps[$cap_name] ) )
775
- $class = 'cap-no';
776
- else
777
- $class = ( $rcaps[$cap_name] ) ? 'cap-yes' : 'cap-neg';
778
-
779
- if ( ! empty($pp_metagroup_caps[$cap_name]) ) {
780
- $class .= ' cap-metagroup';
781
- $title_text = sprintf( __( '%s: assigned by Permission Group', 'capsman-enhanced' ), $cap_name );
782
- } else {
783
- $title_text = $cap_name;
784
- }
785
-
786
- $disabled = '';
787
- $checked = checked(1, ! empty($rcaps[$cap_name]), false );
788
- $title = $title_text;
789
- ?>
790
- <td class="<?php echo $class; ?>"><span class="cap-x">X</span><label title="<?php echo $title;?>"><input type="checkbox" name="caps[<?php echo $cap_name; ?>]" value="1" <?php echo $checked . $disabled;?> />
791
- <span>
792
- <?php
793
- echo str_replace( '_', ' ', $cap_name );
794
- ?>
795
- </span></label><a href="#" class="neg-cap">&nbsp;x&nbsp;</a>
796
- <?php if ( false !== strpos( $class, 'cap-neg' ) ) :?>
797
- <input type="hidden" class="cme-negation-input" name="caps[<?php echo $cap_name; ?>]" value="" />
798
- <?php endif; ?>
799
- </td>
800
-
801
- <?php
802
- ++$i;
803
- }
804
-
805
- if ( $i == $checks_per_row ) {
806
- echo '</tr>';
807
- $i = 0;
808
- } elseif ( ! $first_row ) {
809
- // Now close a wellformed table
810
- for ( $i; $i < $checks_per_row; $i++ ){
811
- echo '<td>&nbsp;</td>';
812
- }
813
- echo '</tr>';
814
- }
815
- ?>
816
-
817
- <tr class="cme-bulk-select">
818
- <td colspan="<?php echo $checks_per_row;?>">
819
- <span style="float:right">
820
- <input type="checkbox" class="cme-check-all" title="<?php _e('check/uncheck all', 'capsman-enhanced');?>">&nbsp;&nbsp;<a class="cme-neg-all" href="#" title="<?php _e('negate all (storing as disabled capabilities)', 'capsman-enhanced');?>">X</a> <a class="cme-switch-all" href="#" title="<?php _e('negate none (add/remove all capabilities normally)', 'capsman-enhanced');?>">X</a>
821
- </span>
822
- </td></tr>
823
-
824
- </table>
825
- <?php
826
- }
827
-
828
- echo '<p>&nbsp;</p><h3 class="cme-cap-section">' . __( 'Additional Capabilities', 'capsman-enhanced' ) . '</h3>';
829
-
830
- ?>
831
- <table class="form-table cme-checklist">
832
- <tr>
833
- <?php
834
- $i = 0; $first_row = true;
835
-
836
- foreach( $all_capabilities as $cap_name ) {
837
- if ( ! isset($this->capabilities[$cap_name]) )
838
- $this->capabilities[$cap_name] = str_replace( '_', ' ', $cap_name );
839
- }
840
-
841
- uasort( $this->capabilities, 'strnatcasecmp' ); // sort by array values, but maintain keys );
842
-
843
- $additional_caps = apply_filters('publishpress_caps_manage_additional_caps', $this->capabilities);
844
-
845
- foreach ($additional_caps as $cap_name => $cap) :
846
- if ( isset( $type_caps[$cap_name] ) || isset($core_caps[$cap_name]) || isset($type_metacaps[$cap_name]) )
847
- continue;
848
-
849
- foreach(array_keys($plugin_caps) as $plugin) {
850
- if ( in_array( $cap_name, $plugin_caps[$plugin]) ) {
851
- continue 2;
852
- }
853
- }
854
-
855
- if ( ! $is_administrator && empty( $current_user->allcaps[$cap_name] ) ) {
856
- continue;
857
- }
858
-
859
- // Levels are not shown.
860
- if ( preg_match( '/^level_(10|[0-9])#x2F;i', $cap_name ) ) {
861
- continue;
862
- }
863
-
864
- if ( $i == $checks_per_row ) {
865
- echo '</tr><tr>';
866
- $i = 0; $first_row = false;
867
- }
868
-
869
- if ( ! isset( $rcaps[$cap_name] ) )
870
- $class = 'cap-no';
871
- else
872
- $class = ( $rcaps[$cap_name] ) ? 'cap-yes' : 'cap-neg';
873
-
874
- if ( ! empty($pp_metagroup_caps[$cap_name]) ) {
875
- $class .= ' cap-metagroup';
876
- $title_text = sprintf( __( '%s: assigned by Permission Group', 'capsman-enhanced' ), $cap_name );
877
- } else {
878
- $title_text = $cap_name;
879
- }
880
-
881
- $disabled = '';
882
- $checked = checked(1, ! empty($rcaps[$cap_name]), false );
883
-
884
- if ( 'manage_capabilities' == $cap_name ) {
885
- if ( ! current_user_can('administrator') ) {
886
- continue;
887
- } elseif ( 'administrator' == $default ) {
888
- $class .= ' cap-locked';
889
- $lock_manage_caps_capability = true;
890
- $disabled = 'disabled="disabled"';
891
- }
892
- }
893
- ?>
894
- <td class="<?php echo $class; ?>"><span class="cap-x">X</span><label title="<?php echo $title_text;?>"><input type="checkbox" name="caps[<?php echo $cap_name; ?>]" value="1" <?php echo $checked . $disabled;?> />
895
- <span>
896
- <?php
897
- echo str_replace( '_', ' ', $cap );
898
- ?>
899
- </span></label><a href="#" class="neg-cap">&nbsp;x&nbsp;</a>
900
- <?php if ( false !== strpos( $class, 'cap-neg' ) ) :?>
901
- <input type="hidden" class="cme-negation-input" name="caps[<?php echo $cap_name; ?>]" value="" />
902
- <?php endif; ?>
903
- </td>
904
- <?php
905
- $i++;
906
- endforeach;
907
-
908
- if ( ! empty($lock_manage_caps_capability) ) {
909
- echo '<input type="hidden" name="caps[manage_capabilities]" value="1" />';
910
- }
911
-
912
- if ( $i == $checks_per_row ) {
913
- echo '</tr><tr>';
914
- $i = 0;
915
- } else {
916
- if ( ! $first_row ) {
917
- // Now close a wellformed table
918
- for ( $i; $i < $checks_per_row; $i++ ){
919
- echo '<td>&nbsp;</td>';
920
- }
921
- echo '</tr>';
922
- }
923
- }
924
- ?>
925
-
926
- <tr class="cme-bulk-select">
927
- <td colspan="<?php echo $checks_per_row;?>">
928
- <span style="float:right">
929
- <input type="checkbox" class="cme-check-all" title="<?php _e('check/uncheck all', 'capsman-enhanced');?>">&nbsp;&nbsp;<a class="cme-neg-all" href="#" title="<?php _e('negate all (storing as disabled capabilities)', 'capsman-enhanced');?>">X</a> <a class="cme-switch-all" href="#" title="<?php _e('negate none (add/remove all capabilities normally)', 'capsman-enhanced');?>">X</a>
930
- </span>
931
- </td></tr>
932
-
933
- </table>
934
-
935
- <?php
936
- if (array_intersect(array_keys(array_filter($type_metacaps)), $all_capabilities)) {
937
-
938
- $_title = esc_attr(__('Meta capabilities are used in code as placeholders for other capabilities. Assiging to a role has no effect.'));
939
- echo '<p>&nbsp;</p><h3 class="cme-cap-section" title="' . $_title . '">' . __( 'Invalid Capabilities', 'capsman-enhanced' ) . '</h3>';
940
- ?>
941
- <table class="form-table cme-checklist">
942
- <tr>
943
- <?php
944
- $i = 0; $first_row = true;
945
-
946
- foreach( $all_capabilities as $cap_name ) {
947
- if ( ! isset($this->capabilities[$cap_name]) )
948
- $this->capabilities[$cap_name] = str_replace( '_', ' ', $cap_name );
949
- }
950
-
951
- uasort( $this->capabilities, 'strnatcasecmp' ); // sort by array values, but maintain keys );
952
-
953
- foreach ( $this->capabilities as $cap_name => $cap ) :
954
- if ( ! isset( $type_metacaps[$cap_name] ) )
955
- continue;
956
-
957
- if ( ! $is_administrator && empty( $current_user->allcaps[$cap_name] ) ) {
958
- continue;
959
- }
960
-
961
- if ( $i == $checks_per_row ) {
962
- echo '</tr><tr>';
963
- $i = 0; $first_row = false;
964
- }
965
-
966
- if ( ! isset( $rcaps[$cap_name] ) )
967
- $class = 'cap-no';
968
- else
969
- $class = ( $rcaps[$cap_name] ) ? 'cap-yes' : 'cap-neg';
970
-
971
- if ( ! empty($pp_metagroup_caps[$cap_name]) ) {
972
- $class .= ' cap-metagroup';
973
- $title_text = sprintf( __( '%s: assigned by Permission Group', 'capsman-enhanced' ), $cap_name );
974
- } else {
975
- $title_text = $cap_name;
976
- }
977
-
978
- $disabled = '';
979
- $checked = checked(1, ! empty($rcaps[$cap_name]), false );
980
- ?>
981
- <td class="<?php echo $class; ?>"><span class="cap-x">X</span><label title="<?php echo $title_text;?>"><input type="checkbox" name="caps[<?php echo $cap_name; ?>]" value="1" <?php echo $checked . $disabled;?> />
982
- <span>
983
- <?php
984
- echo str_replace( '_', ' ', $cap );
985
- ?>
986
- </span></label><a href="#" class="neg-cap">&nbsp;x&nbsp;</a>
987
- <?php if ( false !== strpos( $class, 'cap-neg' ) ) :?>
988
- <input type="hidden" class="cme-negation-input" name="caps[<?php echo $cap_name; ?>]" value="" />
989
- <?php endif; ?>
990
- </td>
991
- <?php
992
- $i++;
993
- endforeach;
994
-
995
- if ( ! empty($lock_manage_caps_capability) ) {
996
- echo '<input type="hidden" name="caps[manage_capabilities]" value="1" />';
997
- }
998
-
999
- if ( $i == $checks_per_row ) {
1000
- echo '</tr><tr>';
1001
- $i = 0;
1002
- } else {
1003
- if ( ! $first_row ) {
1004
- // Now close a wellformed table
1005
- for ( $i; $i < $checks_per_row; $i++ ){
1006
- echo '<td>&nbsp;</td>';
1007
- }
1008
- echo '</tr>';
1009
- }
1010
- }
1011
- ?>
1012
-
1013
- <tr class="cme-bulk-select">
1014
- <td colspan="<?php echo $checks_per_row;?>">
1015
- <span style="float:right">
1016
- <input type="checkbox" class="cme-check-all" title="<?php _e('check/uncheck all', 'capsman-enhanced');?>">&nbsp;&nbsp;<a class="cme-neg-all" href="#" title="<?php _e('negate all (storing as disabled capabilities)', 'capsman-enhanced');?>">X</a> <a class="cme-switch-all" href="#" title="<?php _e('negate none (add/remove all capabilities normally)', 'capsman-enhanced');?>">X</a>
1017
- </span>
1018
- </td></tr>
1019
-
1020
- </table>
1021
- <?php
1022
- } // endif any invalid caps
1023
- ?>
1024
-
1025
- <div>
1026
- <?php
1027
- $level = ak_caps2level($rcaps);
1028
- ?>
1029
- <span title="<?php _e('Role level is mostly deprecated. However, it still determines eligibility for Post Author assignment and limits the application of user editing capabilities.', 'capsman-enhanced');?>">
1030
- <?php _e('Role Level:', 'capsman-enhanced');?> <select name="level">
1031
- <?php for ( $l = $this->max_level; $l >= 0; $l-- ) {?>
1032
- <option value="<?php echo $l; ?>" style="text-align:right;"<?php selected($level, $l); ?>>&nbsp;<?php echo $l; ?>&nbsp;</option>
1033
- <?php }
1034
- ?>
1035
- </select>
1036
- </span>
1037
-
1038
- </div>
1039
- </dd>
1040
- </dl>
1041
-
1042
- <?php
1043
- $support_pp_only_roles = ( defined('PRESSPERMIT_ACTIVE') ) ? $pp_ui->pp_only_roles_ui( $default ) : false;
1044
- cme_network_role_ui( $default );
1045
- ?>
1046
-
1047
- <p class="submit">
1048
- <input type="hidden" name="action" value="update" />
1049
- <input type="hidden" name="current" value="<?php echo $default; ?>" />
1050
- <input type="submit" name="SaveRole" value="<?php _e('Save Changes', 'capsman-enhanced') ?>" class="button-primary" /> &nbsp;
1051
-
1052
- <?php if ( current_user_can('administrator') && 'administrator' != $default ) : ?>
1053
- <a class="ak-delete" title="<?php echo esc_attr(__('Delete this role', 'capsman-enhanced')) ?>" href="<?php echo wp_nonce_url("admin.php?page={$this->ID}&amp;action=delete&amp;role={$default}", 'delete-role_' . $default); ?>" onclick="if ( confirm('<?php echo esc_js(sprintf(__("You are about to delete the %s role.\n\n 'Cancel' to stop, 'OK' to delete.", 'capsman-enhanced'), $roles[$default])); ?>') ) { return true;}return false;"><?php _e('Delete Role', 'capsman-enhanced')?></a>
1054
- <?php endif; ?>
1055
- </p>
1056
-
1057
- </td>
1058
- <td class="sidebar">
1059
- <dl>
1060
- <dt><?php if ( defined('WPLANG') && WPLANG ) _e('Select New Role', 'capsman-enhanced'); else echo('Select Role to View / Edit'); ?></dt>
1061
- <dd style="text-align:center;">
1062
- <p><select name="role">
1063
- <?php
1064
- foreach ( $roles as $role => $name ) {
1065
- $name = translate_user_role($name);
1066
- echo '<option value="' . $role .'"'; selected($default, $role); echo '> ' . $name . ' &nbsp;</option>';
1067
- }
1068
- ?>
1069
- </select><span style="margin-left:20px"><input type="submit" name="LoadRole" value="<?php if ( defined('WPLANG') && WPLANG ) _e('Change', 'capsman-enhanced'); else echo('Load'); ?>" class="button" /></span></p>
1070
- </dd>
1071
- </dl>
1072
-
1073
- <script type="text/javascript">
1074
- /* <![CDATA[ */
1075
- jQuery(document).ready( function($) {
1076
- $('select[name="role"]').val('<?php echo $default;?>');
1077
-
1078
- $('input.button[name="LoadRole"]').click(function(){
1079
- $('#publishpress_caps_form').attr('action', 'admin.php?page=capsman&role=' + $('select[name="role"]').val());
1080
- });
1081
- });
1082
- /* ]]> */
1083
- </script>
1084
-
1085
- <?php do_action('publishpress-caps_sidebar_top');?>
1086
-
1087
- <dl>
1088
- <dt><?php _e('Create New Role', 'capsman-enhanced'); ?></dt>
1089
- <dd style="text-align:center;">
1090
- <?php $class = ( $support_pp_only_roles ) ? 'tight-text' : 'regular-text'; ?>
1091
- <p><input type="text" name="create-name" class="<?php echo $class;?>" placeholder="<?php _e('Role Name', 'capsman-enhanced') ?>" />
1092
-
1093
- <?php if( $support_pp_only_roles ) : ?>
1094
- <label for="new_role_pp_only" title="<?php _e('Make role available for supplemental assignment to Permission Groups only', 'capsman-enhanced');?>"> <input type="checkbox" name="new_role_pp_only" id="new_role_pp_only" value="1"> <?php _e('hidden', 'capsman-enhanced'); ?> </label>
1095
- <?php endif; ?>
1096
-
1097
- <br />
1098
- <input type="submit" name="CreateRole" value="<?php _e('Create', 'capsman-enhanced') ?>" class="button" />
1099
- </p>
1100
- </dd>
1101
- </dl>
1102
-
1103
- <dl>
1104
- <dt><?php defined('WPLANG') && WPLANG ? _e('Copy this role to', 'capsman-enhanced') : printf('Copy %s Role', translate_user_role($roles[$default])); ?></dt>
1105
- <dd style="text-align:center;">
1106
- <?php $class = ( $support_pp_only_roles ) ? 'tight-text' : 'regular-text'; ?>
1107
- <p><input type="text" name="copy-name" class="<?php echo $class;?>" placeholder="<?php _e('Role Name', 'capsman-enhanced') ?>" />
1108
-
1109
- <?php if( $support_pp_only_roles ) : ?>
1110
- <label for="copy_role_pp_only" title="<?php _e('Make role available for supplemental assignment to Permission Groups only', 'capsman-enhanced');?>"> <input type="checkbox" name="copy_role_pp_only" id="copy_role_pp_only" value="1"> <?php _e('hidden', 'capsman-enhanced'); ?> </label>
1111
- <?php endif; ?>
1112
-
1113
- <br />
1114
- <input type="submit" name="CopyRole" value="<?php _e('Copy', 'capsman-enhanced') ?>" class="button" />
1115
- </p>
1116
- </dd>
1117
- </dl>
1118
-
1119
- <dl>
1120
- <dt><?php _e('Add Capability', 'capsman-enhanced'); ?></dt>
1121
- <dd style="text-align:center;">
1122
- <p><input type="text" name="capability-name" class="regular-text" placeholder="<?php echo 'capability_name';?>" /><br />
1123
- <input type="submit" name="AddCap" value="<?php _e('Add to role', 'capsman-enhanced') ?>" class="button" /></p>
1124
- </dd>
1125
- </dl>
1126
-
1127
- <!-- <dl class="cme-backup-tool">
1128
- <dt><?php _e('Backup Tool', 'capsman-enhanced'); ?></dt>
1129
- <dd style="text-align:center;">
1130
- <p><a href="admin.php?page=capsman-tool"><?php _e('Backup / Restore Roles', 'capsman-enhanced');?></a></p>
1131
- </dd>
1132
- </dl> -->
1133
-
1134
- <dl>
1135
- <dt><?php _e('Related Permissions Plugins', 'capsman-enhanced'); ?></dt>
1136
- <dd>
1137
- <ul>
1138
- <li><a href="https://publishpress.com/ma/" target="_blank"><?php _e('Multiple Authors', 'capsman-enhanced');?></a></li>
1139
- </li>
1140
-
1141
- <li><a href="#pp-more"><?php _e('PublishPress Permissions', 'capsman-enhanced');?></a>
1142
- </li>
1143
-
1144
- <?php $_url = "plugin-install.php?tab=plugin-information&plugin=publishpress&TB_iframe=true&width=640&height=678";
1145
- $url = ( is_multisite() ) ? network_admin_url($_url) : admin_url($_url);
1146
- ?>
1147
- <li><a class="thickbox" href="<?php echo $url;?>"><?php _e('PublishPress', 'capsman-enhanced');?></a></li>
1148
-
1149
- <?php $_url = "plugin-install.php?tab=plugin-information&plugin=revisionary&TB_iframe=true&width=640&height=678";
1150
- $url = ( is_multisite() ) ? network_admin_url($_url) : admin_url($_url);
1151
- ?>
1152
- <li><a class="thickbox" href="<?php echo $url;?>"><?php _e('PublishPress Revisions', 'capsman-enhanced');?></a></li>
1153
-
1154
- <li class="publishpress-contact"><a href="https://publishpress.com/contact" target="_blank"><?php _e('Help / Contact Form', 'capsman-enhanced');?></a></li>
1155
-
1156
- </ul>
1157
- </dd>
1158
- </dl>
1159
-
1160
- <?php
1161
- $pp_ui->pp_types_ui( $defined['type'] );
1162
- $pp_ui->pp_taxonomies_ui( $defined['taxonomy'] );
1163
-
1164
- do_action('publishpress-caps_sidebar_bottom');
1165
- ?>
1166
- </td>
1167
- </tr>
1168
- </table>
1169
- </fieldset>
1170
- </form>
1171
-
1172
- <?php if (!defined('PUBLISHPRESS_CAPS_PRO_VERSION') || get_option('cme_display_branding')) {
1173
- cme_publishpressFooter();
1174
- }
1175
- ?>
1176
- </div>
1177
-
1178
- <?php
1179
- function cme_network_role_ui( $default ) {
1180
- if ( ! is_multisite() || ! is_super_admin() || ( 1 != get_current_blog_id() ) )
1181
- return false;
1182
- ?>
1183
-
1184
- <div style="float:right;margin-left:10px;margin-right:10px">
1185
- <?php
1186
- if ( ! $autocreate_roles = get_site_option( 'cme_autocreate_roles' ) )
1187
- $autocreate_roles = array();
1188
-
1189
- $checked = ( in_array( $default, $autocreate_roles ) ) ? 'checked="checked"': '';
1190
- ?>
1191
- <div style="margin-bottom: 5px">
1192
- <label for="cme_autocreate_role" title="<?php _e('Create this role definition in new (future) sites', 'capsman-enhanced');?>"><input type="checkbox" name="cme_autocreate_role" id="cme_autocreate_role" value="1" <?php echo $checked;?>> <?php _e('include in new sites', 'capsman-enhanced'); ?> </label>
1193
- </div>
1194
- <div>
1195
- <label for="cme_net_sync_role" title="<?php echo esc_attr(__('Copy / update this role definition to all sites now', 'capsman-enhanced'));?>"><input type="checkbox" name="cme_net_sync_role" id="cme_net_sync_role" value="1"> <?php _e('sync role to all sites now', 'capsman-enhanced'); ?> </label>
1196
- </div>
1197
- </div>
1198
- <?php
1199
- return true;
1200
- }
1201
-
1202
- function cme_plugin_info_url( $plugin_slug ) {
1203
- $_url = "plugin-install.php?tab=plugin-information&plugin=$plugin_slug&TB_iframe=true&width=640&height=678";
1204
- return ( is_multisite() ) ? network_admin_url($_url) : admin_url($_url);
1205
- }
1
+ <?php
2
+ /**
3
+ * General Admin for Role Capabilities.
4
+ * Provides admin pages to create and manage roles and capabilities.
5
+ *
6
+ * @author Jordi Canals, Kevin Behrens
7
+ * @copyright Copyright (C) 2009, 2010 Jordi Canals, (C) 2020 PublishPress
8
+ * @license GNU General Public License version 2
9
+ * @link https://publishpress.com
10
+ *
11
+ *
12
+ * Copyright 2009, 2010 Jordi Canals <devel@jcanals.cat>
13
+ * Modifications Copyright 2020, PublishPress <help@publishpress.com>
14
+ *
15
+ * This program is free software; you can redistribute it and/or
16
+ * modify it under the terms of the GNU General Public License
17
+ * version 2 as published by the Free Software Foundation.
18
+ *
19
+ * This program is distributed in the hope that it will be useful,
20
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
21
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22
+ * GNU General Public License for more details.
23
+ *
24
+ * You should have received a copy of the GNU General Public License
25
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
26
+ **/
27
+
28
+ global $capsman, $cme_cap_helper, $current_user;
29
+
30
+ do_action('publishpress-caps_manager-load');
31
+
32
+ $roles = $this->roles;
33
+ $default = $this->current;
34
+
35
+ if ( $block_read_removal = _cme_is_read_removal_blocked( $this->current ) ) {
36
+ if ( $current = get_role($default) ) {
37
+ if ( empty( $current->capabilities['read'] ) ) {
38
+ ak_admin_error( sprintf( __( 'Warning: This role cannot access the dashboard without the read capability. %1$sClick here to fix this now%2$s.', 'capsman-enhanced' ), '<a href="javascript:void(0)" class="cme-fix-read-cap">', '</a>' ) );
39
+ }
40
+ }
41
+ }
42
+
43
+ require_once( dirname(__FILE__).'/pp-ui.php' );
44
+ $pp_ui = new Capsman_PP_UI();
45
+
46
+ if( defined('PRESSPERMIT_ACTIVE') ) {
47
+ $pp_metagroup_caps = $pp_ui->get_metagroup_caps( $default );
48
+ } else {
49
+ $pp_metagroup_caps = array();
50
+ }
51
+ ?>
52
+ <div class="wrap publishpress-caps-manage pressshack-admin-wrapper">
53
+ <?php if( defined('PRESSPERMIT_ACTIVE') ) :
54
+ pp_icon();
55
+ $style = 'style="height:60px;"';
56
+ ?>
57
+ <?php else:
58
+ $style = '';
59
+ ?>
60
+ <div id="icon-capsman-admin" class="icon32"></div>
61
+ <?php endif; ?>
62
+
63
+ <h1 <?php echo $style;?>><?php _e('Role Capabilities', 'capsman-enhanced') ?></h1>
64
+
65
+ <form id="publishpress_caps_form" method="post" action="admin.php?page=<?php echo $this->ID ?>">
66
+ <?php wp_nonce_field('capsman-general-manager'); ?>
67
+ <fieldset>
68
+ <table id="akmin">
69
+ <tr>
70
+ <td class="content">
71
+ <dl>
72
+ <dt>
73
+ <?php
74
+ $role_caption = (defined('PUBLISHPRESS_VERSION'))
75
+ ? '<a href="' . admin_url("admin.php?page=pp-manage-roles&action=edit-role&role-id={$this->current}") . '">' . translate_user_role($roles[$default]) . '</a>'
76
+ : translate_user_role($roles[$default]);
77
+
78
+ printf(__('Capabilities for %s', 'capsman-enhanced'), $role_caption);
79
+ ?>
80
+ </dt>
81
+
82
+ <dd>
83
+ <div style="float:right">
84
+ <input type="submit" name="SaveRole" value="<?php _e('Save Changes', 'capsman-enhanced') ?>" class="button-primary" /> &nbsp;
85
+ </div>
86
+
87
+ <?php
88
+ global $capsman;
89
+ $img_url = $capsman->mod_url . '/images/';
90
+ ?>
91
+ <div class="publishpress-headline">
92
+ <span class="cme-subtext">
93
+ <?php
94
+ $msg = __( '<strong>Note:</strong> Capability changes <strong>remain in the database</strong> after plugin deactivation.', 'capsman-enhanced' );
95
+
96
+ if (defined('PRESSPERMIT_ACTIVE') && function_exists('presspermit')) {
97
+ if ($group = presspermit()->groups()->getMetagroup('wp_role', $this->current)) {
98
+ $msg = sprintf(
99
+ __('<strong>Note:</strong> Capability changes <strong>remain in the database</strong> after plugin deactivation. You can also configure this role as a %sPermission Group%s.', 'capsman-enhanced'),
100
+ '<a href="' . admin_url("admin.php?page=presspermit-edit-permissions&action=edit&agent_id={$group->ID}") . '">',
101
+ '</a>'
102
+ );
103
+ }
104
+ }
105
+ echo $msg;
106
+ ?>
107
+ </span>
108
+ </div>
109
+
110
+ <?php
111
+ if ( defined( 'PRESSPERMIT_ACTIVE' ) ) {
112
+ $pp_ui->show_capability_hints( $default );
113
+ }
114
+ ?>
115
+
116
+ <script type="text/javascript">
117
+ /* <![CDATA[ */
118
+ jQuery(document).ready( function($) {
119
+ $('a[href="#pp-more"]').click( function() {
120
+ $('#pp_features').show();
121
+ return false;
122
+ });
123
+ $('a[href="#pp-hide"]').click( function() {
124
+ $('#pp_features').hide();
125
+ return false;
126
+ });
127
+ });
128
+ /* ]]> */
129
+ </script>
130
+
131
+ <?php /* play.png icon by Pavel: http://kde-look.org/usermanager/search.php?username=InFeRnODeMoN */ ?>
132
+
133
+ <br /><div id="pp_features" style="display:none"><div class="pp-logo"><a href="https://publishpress.com/presspermit/"><img src="<?php echo $img_url;?>pp-logo.png" alt="<?php _e('PublishPress Permissions', 'capsman-enhanced');?>" /></a></div><div class="features-wrap"><ul class="pp-features">
134
+ <li>
135
+ <?php _e( "Automatically define type-specific capabilities for your custom post types and taxonomies", 'capsman-enhanced' );?>
136
+ <a href="https://presspermit.com/tutorial/regulate-post-type-access" target="_blank"><img class="cme-play" alt="*" src="<?php echo $img_url;?>play.png" /></a></li>
137
+
138
+ <li>
139
+ <?php _e( "Assign standard WP roles supplementally for a specific post type", 'capsman-enhanced' );?>
140
+ <a href="https://presspermit.com/tutorial/regulate-post-type-access" target="_blank"><img class="cme-play" alt="*" src="<?php echo $img_url;?>play.png" /></a></li>
141
+
142
+ <li>
143
+ <?php _e( "Assign custom WP roles supplementally for a specific post type <em>(Pro)</em>", 'capsman-enhanced' );?>
144
+ </li>
145
+
146
+ <li>
147
+ <?php _e( "Customize reading permissions per-category or per-post", 'capsman-enhanced' );?>
148
+ <a href="https://presspermit.com/tutorial/category-exceptions" target="_blank"><img class="cme-play" alt="*" src="<?php echo $img_url;?>play.png" /></a></li>
149
+
150
+ <li>
151
+ <?php _e( "Customize editing permissions per-category or per-post <em>(Pro)</em>", 'capsman-enhanced' );?>
152
+ <a href="https://presspermit.com/tutorial/page-editing-exceptions" target="_blank"><img class="cme-play" alt="*" src="<?php echo $img_url;?>play.png" /></a></li>
153
+
154
+ <li>
155
+ <?php _e( "Custom Post Visibility statuses, fully implemented throughout wp-admin <em>(Pro)</em>", 'capsman-enhanced' );?>
156
+ <a href="https://presspermit.com/tutorial/custom-post-visibility" target="_blank"><img class="cme-play" alt="*" src="<?php echo $img_url;?>play.png" /></a></li>
157
+
158
+ <li>
159
+ <?php _e( "Custom Moderation statuses for access-controlled, multi-step publishing workflow <em>(Pro)</em>", 'capsman-enhanced' );?>
160
+ <a href="https://presspermit.com/tutorial/multi-step-moderation" target="_blank"><img class="cme-play" alt="*" src="<?php echo $img_url;?>play.png" /></a></li>
161
+
162
+ <li>
163
+ <?php _e( "Regulate permissions for Edit Flow post statuses <em>(Pro)</em>", 'capsman-enhanced' );?>
164
+ <a href="https://presspermit.com/tutorial/edit-flow-integration" target="_blank"><img class="cme-play" alt="*" src="<?php echo $img_url;?>play.png" /></a></li>
165
+
166
+ <li>
167
+ <?php _e( "Customize the moderated editing of published content with Revisionary or Post Forking <em>(Pro)</em>", 'capsman-enhanced' );?>
168
+ <a href="https://presspermit.com/tutorial/published-content-revision" target="_blank"><img class="cme-play" alt="*" src="<?php echo $img_url;?>play.png" /></a></li>
169
+
170
+ <li>
171
+ <?php _e( "Grant Spectator, Participant or Moderator access to specific bbPress forums <em>(Pro)</em>", 'capsman-enhanced' );?>
172
+ </li>
173
+
174
+ <li>
175
+ <?php _e( "Grant supplemental content permissions to a BuddyPress group <em>(Pro)</em>", 'capsman-enhanced' );?>
176
+ <a href="https://presspermit.com/tutorial/buddypress-content-permissions" target="_blank"><img class="cme-play" alt="*" src="<?php echo $img_url;?>play.png" /></a></li>
177
+
178
+ <li>
179
+ <?php _e( "WPML integration to mirror permissions to translations <em>(Pro)</em>", 'capsman-enhanced' );?>
180
+ </li>
181
+
182
+ <li>
183
+ <?php _e( "Member support forum", 'capsman-enhanced' );?>
184
+ </li>
185
+
186
+ </ul></div>
187
+
188
+ <?php
189
+ echo '<div>';
190
+ printf( __('%1$sgrab%2$s %3$s', 'capsman-enhanced'), '<strong>', '</strong>', '<span class="plugins update-message"><a href="' . cme_plugin_info_url('press-permit-core') . '" class="thickbox" title="' . sprintf( __('%s (free install)', 'capsman-enhanced'), 'Permissions Pro' ) . '">Permissions Pro</a></span>' );
191
+ echo '&nbsp;&nbsp;&bull;&nbsp;&nbsp;';
192
+ printf( __('%1$sbuy%2$s %3$s', 'capsman-enhanced'), '<strong>', '</strong>', '<a href="https://publishpress.com/presspermit/" target="_blank" title="' . sprintf( __('%s info/purchase', 'capsman-enhanced'), 'Permissions Pro' ) . '">Permissions&nbsp;Pro</a>' );
193
+ echo '&nbsp;&nbsp;&bull;&nbsp;&nbsp;';
194
+ echo '<a href="#pp-hide">hide</a>';
195
+ echo '</div></div>';
196
+
197
+ if ( MULTISITE ) {
198
+ global $wp_roles;
199
+ global $wpdb;
200
+
201
+ if ( ! empty($_REQUEST['cme_net_sync_role'] ) ) {
202
+ switch_to_blog(1);
203
+ wp_cache_delete( $wpdb->prefix . 'user_roles', 'options' );
204
+ }
205
+
206
+ ( method_exists( $wp_roles, 'for_site' ) ) ? $wp_roles->for_site() : $wp_roles->reinit();
207
+ }
208
+ $capsman->reinstate_db_roles();
209
+
210
+ $current = get_role($default);
211
+
212
+ $rcaps = $current->capabilities;
213
+
214
+ $is_administrator = current_user_can( 'administrator' ) || (is_multisite() && is_super_admin());
215
+
216
+ $custom_types = get_post_types( array( '_builtin' => false ), 'names' );
217
+ $custom_tax = get_taxonomies( array( '_builtin' => false ), 'names' );
218
+
219
+ $defined = array();
220
+ $defined['type'] = get_post_types( array( 'public' => true, 'show_ui' => true ), 'object', 'or' );
221
+ $defined['taxonomy'] = get_taxonomies( array( 'public' => true ), 'object' );
222
+
223
+ $unfiltered['type'] = apply_filters( 'pp_unfiltered_post_types', array( 'forum','topic','reply','wp_block' ) ); // bbPress' dynamic role def requires additional code to enforce stored caps
224
+ $unfiltered['taxonomy'] = apply_filters( 'pp_unfiltered_taxonomies', array( 'post_status', 'topic-tag' ) ); // avoid confusion with Edit Flow administrative taxonomy
225
+
226
+ $enabled_taxonomies = cme_get_assisted_taxonomies();
227
+
228
+ /*
229
+ if ( ( count($custom_types) || count($custom_tax) ) && ( $is_administrator || current_user_can( 'manage_pp_settings' ) ) ) {
230
+ $cap_properties[''] = array();
231
+ $force_distinct_ui = true;
232
+ }
233
+ */
234
+
235
+ $cap_properties['edit']['type'] = array( 'edit_posts' );
236
+
237
+ foreach( $defined['type'] as $type_obj ) {
238
+ if ( 'attachment' != $type_obj->name ) {
239
+ if ( isset( $type_obj->cap->create_posts ) && ( $type_obj->cap->create_posts != $type_obj->cap->edit_posts ) ) {
240
+ $cap_properties['edit']['type'][]= 'create_posts';
241
+ break;
242
+ }
243
+ }
244
+ }
245
+
246
+ $cap_properties['edit']['type'][]= 'edit_others_posts';
247
+ $cap_properties['edit']['type'] = array_merge( $cap_properties['edit']['type'], array( 'publish_posts', 'edit_published_posts', 'edit_private_posts' ) );
248
+
249
+ $cap_properties['edit']['taxonomy'] = array( 'manage_terms' );
250
+
251
+ if ( ! defined( 'OLD_PRESSPERMIT_ACTIVE' ) )
252
+ $cap_properties['edit']['taxonomy'] = array_merge( $cap_properties['edit']['taxonomy'], array( 'edit_terms', 'assign_terms' ) );
253
+
254
+ $cap_properties['delete']['type'] = array( 'delete_posts', 'delete_others_posts' );
255
+ $cap_properties['delete']['type'] = array_merge( $cap_properties['delete']['type'], array( 'delete_published_posts', 'delete_private_posts' ) );
256
+
257
+ if ( ! defined( 'OLD_PRESSPERMIT_ACTIVE' ) )
258
+ $cap_properties['delete']['taxonomy'] = array( 'delete_terms' );
259
+ else
260
+ $cap_properties['delete']['taxonomy'] = array();
261
+
262
+ $cap_properties['read']['type'] = array( 'read_private_posts' );
263
+ $cap_properties['read']['taxonomy'] = array();
264
+
265
+ $stati = get_post_stati( array( 'internal' => false ) );
266
+
267
+ $cap_type_names = array(
268
+ '' => __( '&nbsp;', 'capsman-enhanced' ),
269
+ 'read' => __( 'Reading', 'capsman-enhanced' ),
270
+ 'edit' => __( 'Editing Capabilities', 'capsman-enhanced' ),
271
+ 'delete' => __( 'Deletion Capabilities', 'capsman-enhanced' )
272
+ );
273
+
274
+ $cap_tips = array(
275
+ 'read_private' => __( 'can read posts which are currently published with private visibility', 'capsman-enhanced' ),
276
+ 'edit' => __( 'has basic editing capability (but may need other capabilities based on post status and ownership)', 'capsman-enhanced' ),
277
+ 'edit_others' => __( 'can edit posts which were created by other users', 'capsman-enhanced' ),
278
+ 'edit_published' => __( 'can edit posts which are currently published', 'capsman-enhanced' ),
279
+ 'edit_private' => __( 'can edit posts which are currently published with private visibility', 'capsman-enhanced' ),
280
+ 'publish' => __( 'can make a post publicly visible', 'capsman-enhanced' ),
281
+ 'delete' => __( 'has basic deletion capability (but may need other capabilities based on post status and ownership)', 'capsman-enhanced' ),
282
+ 'delete_others' => __( 'can delete posts which were created by other users', 'capsman-enhanced' ),
283
+ 'delete_published' => __( 'can delete posts which are currently published', 'capsman-enhanced' ),
284
+ 'delete_private' => __( 'can delete posts which are currently published with private visibility', 'capsman-enhanced' ),
285
+ );
286
+
287
+ $default_caps = array( 'read_private_posts', 'edit_posts', 'edit_others_posts', 'edit_published_posts', 'edit_private_posts', 'publish_posts', 'delete_posts', 'delete_others_posts', 'delete_published_posts', 'delete_private_posts',
288
+ 'read_private_pages', 'edit_pages', 'edit_others_pages', 'edit_published_pages', 'edit_private_pages', 'publish_pages', 'delete_pages', 'delete_others_pages', 'delete_published_pages', 'delete_private_pages',
289
+ 'manage_categories'
290
+ );
291
+ $type_caps = array();
292
+ $type_metacaps = array();
293
+
294
+ // Role Scoper and PP1 adjust attachment access based only on user's capabilities for the parent post
295
+ if ( defined('OLD_PRESSPERMIT_ACTIVE') ) {
296
+ unset( $defined['type']['attachment'] );
297
+ }
298
+
299
+ echo '<ul class="cme-listhoriz">';
300
+
301
+ // cap_types: read, edit, deletion
302
+ foreach( array_keys($cap_properties) as $cap_type ) {
303
+ echo '<li>';
304
+ echo '<h3>' . $cap_type_names[$cap_type] . '</h3>';
305
+
306
+ echo "<div class='cme-cap-type-tables cme-cap-type-tables-$cap_type'>";
307
+
308
+ foreach( array_keys($defined) as $item_type ) {
309
+ if ( ( 'delete' == $cap_type ) && ( 'taxonomy' == $item_type ) ) {
310
+ if ( defined('OLD_PRESSPERMIT_ACTIVE') ) {
311
+ continue;
312
+ }
313
+
314
+ $any_term_deletion_caps = false;
315
+ foreach( array_keys($defined['taxonomy']) as $_tax ) {
316
+ if ( isset( $defined['taxonomy'][$_tax]->cap->delete_terms ) && ( 'manage_categories' != $defined['taxonomy'][$_tax]->cap->delete_terms ) && ! in_array( $_tax, $unfiltered['taxonomy'] ) ) {
317
+ $any_term_deletion_caps = true;
318
+ break;
319
+ }
320
+ }
321
+
322
+ if ( ! $any_term_deletion_caps )
323
+ continue;
324
+ }
325
+
326
+ if ( ! count( $cap_properties[$cap_type][$item_type] ) )
327
+ continue;
328
+
329
+ echo "<table class='cme-typecaps cme-typecaps-$cap_type'>";
330
+
331
+ echo '<tr><th></th>';
332
+
333
+ // label cap properties
334
+ foreach( $cap_properties[$cap_type][$item_type] as $prop ) {
335
+ $prop = str_replace( '_posts', '', $prop );
336
+ $prop = str_replace( '_pages', '', $prop );
337
+ $prop = str_replace( '_terms', '', $prop );
338
+ $tip = ( isset( $cap_tips[$prop] ) ) ? "title='{$cap_tips[$prop]}'" : '';
339
+ $prop = str_replace( '_', '<br />', $prop );
340
+ $th_class = ( 'taxonomy' == $item_type ) ? ' class="term-cap"' : ' class="post-cap"';
341
+ echo "<th $tip{$th_class}>";
342
+
343
+ if ( ( 'delete' != $prop ) || ( 'taxonomy' != $item_type ) || cme_get_detailed_taxonomies() ) {
344
+ echo ucwords($prop);
345
+ }
346
+
347
+ echo '</th>';
348
+ }
349
+
350
+ echo '</tr>';
351
+
352
+ foreach( $defined[$item_type] as $key => $type_obj ) {
353
+ if ( in_array( $key, $unfiltered[$item_type] ) )
354
+ continue;
355
+
356
+ $row = "<tr class='cme_type_{$key}'>";
357
+
358
+ if ( $cap_type ) {
359
+ if ( empty($force_distinct_ui) && empty( $cap_properties[$cap_type][$item_type] ) )
360
+ continue;
361
+
362
+ $row .= "<td><a class='cap_type' href='#toggle_type_caps'>" . $type_obj->labels->name . '</a>';
363
+ $row .= '<a href="#" class="neg-type-caps">&nbsp;x&nbsp;</a>';
364
+ $row .= '</td>';
365
+
366
+ $display_row = ! empty($force_distinct_ui);
367
+
368
+ foreach( $cap_properties[$cap_type][$item_type] as $prop ) {
369
+ $td_classes = array();
370
+ $checkbox = '';
371
+ $title = '';
372
+
373
+ if ( ! empty($type_obj->cap->$prop) && ( in_array( $type_obj->name, array( 'post', 'page' ) )
374
+ || ! in_array( $type_obj->cap->$prop, $default_caps )
375
+ || ( ( 'manage_categories' == $type_obj->cap->$prop ) && ( 'manage_terms' == $prop ) && ( 'category' == $type_obj->name ) ) ) ) {
376
+
377
+ // if edit_published or edit_private cap is same as edit_posts cap, don't display a checkbox for it
378
+ if ( ( ! in_array( $prop, array( 'edit_published_posts', 'edit_private_posts', 'create_posts' ) ) || ( $type_obj->cap->$prop != $type_obj->cap->edit_posts ) )
379
+ && ( ! in_array( $prop, array( 'delete_published_posts', 'delete_private_posts' ) ) || ( $type_obj->cap->$prop != $type_obj->cap->delete_posts ) )
380
+ && ( ! in_array( $prop, array( 'edit_terms', 'delete_terms' ) ) || ( $type_obj->cap->$prop != $type_obj->cap->manage_terms ) )
381
+
382
+ && ( ! in_array( $prop, array( 'manage_terms', 'edit_terms', 'delete_terms', 'assign_terms' ) )
383
+ || empty($cme_cap_helper->all_taxonomy_caps[$type_obj->cap->$prop])
384
+ || ( $cme_cap_helper->all_taxonomy_caps[ $type_obj->cap->$prop ] <= 1 )
385
+ || $type_obj->cap->$prop == str_replace( '_terms', "_{$type_obj->name}s", $prop )
386
+ || $type_obj->cap->$prop == str_replace( '_terms', "_" . _cme_get_plural($type_obj->name, $type_obj), $prop )
387
+ )
388
+
389
+ && ( in_array( $prop, array( 'manage_terms', 'edit_terms', 'delete_terms', 'assign_terms' ) )
390
+ || empty($cme_cap_helper->all_type_caps[$type_obj->cap->$prop])
391
+ || ( $cme_cap_helper->all_type_caps[ $type_obj->cap->$prop ] <= 1 )
392
+ || $type_obj->cap->$prop == 'upload_files' && 'create_posts' == $prop && 'attachment' == $type_obj->name
393
+ || $type_obj->cap->$prop == str_replace( '_posts', "_{$type_obj->name}s", $prop )
394
+ || $type_obj->cap->$prop == str_replace( '_pages', "_{$type_obj->name}s", $prop )
395
+ || $type_obj->cap->$prop == str_replace( '_posts', "_" . _cme_get_plural($type_obj->name, $type_obj), $prop )
396
+ || $type_obj->cap->$prop == str_replace( '_pages', "_" . _cme_get_plural($type_obj->name, $type_obj), $prop )
397
+ )
398
+ ) {
399
+ // only present these term caps up top if we are ensuring that they get enforced separately from manage_terms
400
+ if ( in_array( $prop, array( 'edit_terms', 'delete_terms', 'assign_terms' ) ) && ( ! in_array( $type_obj->name, cme_get_detailed_taxonomies() ) || defined( 'OLD_PRESSPERMIT_ACTIVE' ) ) ) {
401
+ continue;
402
+ }
403
+
404
+ $cap_name = $type_obj->cap->$prop;
405
+
406
+ if ( 'taxonomy' == $item_type )
407
+ $td_classes []= "term-cap";
408
+ else
409
+ $td_classes []= "post-cap";
410
+
411
+ if ( ! empty($pp_metagroup_caps[$cap_name]) )
412
+ $td_classes []='cm-has-via-pp';
413
+
414
+ if ( $is_administrator || current_user_can($cap_name) ) {
415
+ if ( ! empty($pp_metagroup_caps[$cap_name]) ) {
416
+ $title = ' title="' . sprintf( __( '%s: assigned by Permission Group', 'capsman-enhanced' ), $cap_name ) . '"';
417
+ } else {
418
+ $title = ' title="' . $cap_name . '"';
419
+ }
420
+
421
+ $disabled = '';
422
+ $checked = checked(1, ! empty($rcaps[$cap_name]), false );
423
+
424
+ $checkbox = '<input type="checkbox"' . $title . ' name="caps[' . $cap_name . ']" value="1" ' . $checked . $disabled . ' />';
425
+
426
+ $type_caps [$cap_name] = true;
427
+ $display_row = true;
428
+ }
429
+ } else {
430
+ //$td_classes []= "cap-unreg";
431
+ $title = 'title="' . sprintf( __( 'shared capability: %s', 'capsman-enhanced' ), esc_attr( $type_obj->cap->$prop ) ) . '"';
432
+ }
433
+
434
+ if ( isset($rcaps[$cap_name]) && empty($rcaps[$cap_name]) ) {
435
+ $td_classes []= "cap-neg";
436
+ }
437
+ } else {
438
+ $td_classes []= "cap-unreg";
439
+ }
440
+
441
+ $td_class = ( $td_classes ) ? 'class="' . implode(' ', $td_classes) . '"' : '';
442
+
443
+ $row .= "<td $td_class $title><span class='cap-x'>X</span>$checkbox";
444
+
445
+ if ( false !== strpos( $td_class, 'cap-neg' ) )
446
+ $row .= '<input type="hidden" class="cme-negation-input" name="caps[' . $cap_name . ']" value="" />';
447
+
448
+ $row .= "</td>";
449
+ }
450
+
451
+ if ('type' == $item_type) {
452
+ $type_metacaps[$type_obj->cap->read_post] = true;
453
+ $type_metacaps[$type_obj->cap->edit_post] = isset($type_obj->cap->edit_posts) && ($type_obj->cap->edit_post != $type_obj->cap->edit_posts);
454
+ $type_metacaps[$type_obj->cap->delete_post] = isset($type_obj->cap->delete_posts) && ($type_obj->cap->delete_post != $type_obj->cap->delete_posts);
455
+
456
+ } elseif ('taxonomy' == $item_type && !empty($type_obj->cap->edit_term) && !empty($type_obj->cap->delete_term)) {
457
+ $type_metacaps[$type_obj->cap->edit_term] = true;
458
+ $type_metacaps[$type_obj->cap->delete_term] = true;
459
+ }
460
+ }
461
+
462
+ if ( $display_row ) {
463
+ $row .= '</tr>';
464
+ echo $row;
465
+ }
466
+ }
467
+
468
+ echo '</table>';
469
+
470
+ } // end foreach item type
471
+
472
+ echo '</div>';
473
+
474
+ echo '</li>';
475
+ }
476
+
477
+
478
+ do_action('publishpress-caps_manager_postcaps_section', compact('current', 'rcaps', 'pp_metagroup_caps', 'is_administrator', 'default_caps', 'custom_types', 'defined', 'unfiltered', 'pp_metagroup_caps'));
479
+
480
+ $type_caps = apply_filters('publishpress_caps_manager_typecaps', $type_caps);
481
+
482
+ echo '</ul>';
483
+
484
+ // clicking on post type name toggles corresponding checkbox selections
485
+ ?>
486
+ <script type="text/javascript">
487
+ /* <![CDATA[ */
488
+ jQuery(document).ready( function($) {
489
+ $('a[href="#toggle_type_caps"]').click( function() {
490
+ var chks = $(this).closest('tr').find('input');
491
+ $(chks).prop( 'checked', ! $(chks).first().is(':checked') );
492
+ return false;
493
+ });
494
+ });
495
+ /* ]]> */
496
+ </script>
497
+ <?php
498
+
499
+ echo '<p>&nbsp;</p><h3>' . __( 'Other WordPress Core Capabilities', 'capsman-enhanced' ) . '</h3>';
500
+ echo '<table class="form-table cme-checklist"><tr>';
501
+
502
+ $checks_per_row = get_option( 'cme_form-rows', 5 );
503
+ $i = 0; $first_row = true;
504
+
505
+ $core_caps = _cme_core_caps();
506
+ foreach( array_keys($core_caps) as $cap_name ) {
507
+ if ( ! $is_administrator && ! current_user_can($cap_name) )
508
+ continue;
509
+
510
+ if ( $i == $checks_per_row ) {
511
+ echo '</tr><tr>';
512
+ $i = 0;
513
+ }
514
+
515
+ if ( ! isset( $rcaps[$cap_name] ) )
516
+ $class = 'cap-no';
517
+ else
518
+ $class = ( $rcaps[$cap_name] ) ? 'cap-yes' : 'cap-neg';
519
+
520
+ if ( ! empty($pp_metagroup_caps[$cap_name]) ) {
521
+ $class .= ' cap-metagroup';
522
+ $title_text = sprintf( __( '%s: assigned by Permission Group', 'capsman-enhanced' ), $cap_name );
523
+ } else {
524
+ $title_text = $cap_name;
525
+ }
526
+
527
+ $disabled = '';
528
+ $checked = checked(1, ! empty($rcaps[$cap_name]), false );
529
+ $lock_capability = false;
530
+ $title = $title_text;
531
+
532
+ if ( 'read' == $cap_name ) {
533
+ if ( ! empty( $block_read_removal ) ) {
534
+ // prevent the read capability from being removed from a core role, but don't force it to be added
535
+ if ( $checked || apply_filters( 'pp_caps_force_capability_storage', false, 'read', $default ) ) {
536
+ if ( apply_filters( 'pp_caps_lock_capability', true, 'read', $default ) ) {
537
+ $lock_capability = true;
538
+ $class .= ' cap-locked';
539
+ $disabled = 'disabled="disabled"';
540
+ if ( 'administrator' != $this->current ) {
541
+ $title = esc_attr( __('Lockout Prevention: To remove read capability, first remove WordPress admin / editing capabilities, or add "dashboard_lockout_ok" capability', 'capsman-enhanced' ) );
542
+ }
543
+ }
544
+ }
545
+ }
546
+ }
547
+
548
+ ?>
549
+ <td class="<?php echo $class; ?>"><span class="cap-x">X</span><label title="<?php echo $title;?>"><input type="checkbox" name="caps[<?php echo $cap_name; ?>]" value="1" <?php echo $checked . $disabled;?> />
550
+ <span>
551
+ <?php
552
+ echo str_replace( '_', ' ', $cap_name );
553
+ ?>
554
+ </span></label><a href="#" class="neg-cap">&nbsp;x&nbsp;</a>
555
+ <?php if ( false !== strpos( $class, 'cap-neg' ) ) :?>
556
+ <input type="hidden" class="cme-negation-input" name="caps[<?php echo $cap_name; ?>]" value="" />
557
+ <?php endif; ?>
558
+ </td>
559
+
560
+ <?php
561
+
562
+ if ( $lock_capability ) {
563
+ echo '<input type="hidden" name="caps[' . $cap_name . ']" value="1" />';
564
+ }
565
+
566
+ ++$i;
567
+ }
568
+
569
+ if ( $i == $checks_per_row ) {
570
+ echo '</tr>';
571
+ $i = 0;
572
+ } elseif ( ! $first_row ) {
573
+ // Now close a wellformed table
574
+ for ( $i; $i < $checks_per_row; $i++ ){
575
+ echo '<td>&nbsp;</td>';
576
+ }
577
+ echo '</tr>';
578
+ }
579
+ ?>
580
+
581
+ <tr class="cme-bulk-select">
582
+ <td colspan="<?php echo $checks_per_row;?>">
583
+ <span style="float:right">
584
+ <input type="checkbox" class="cme-check-all" title="<?php _e('check/uncheck all', 'capsman-enhanced');?>">&nbsp;&nbsp;<a class="cme-neg-all" href="#" title="<?php _e('negate all (storing as disabled capabilities)', 'capsman-enhanced');?>">X</a> <a class="cme-switch-all" href="#" title="<?php _e('negate none (add/remove all capabilities normally)', 'capsman-enhanced');?>">X</a>
585
+ </span>
586
+ </td></tr>
587
+
588
+ </table>
589
+ <?php
590
+ $all_capabilities = apply_filters( 'capsman_get_capabilities', array_keys( $this->capabilities ), $this->ID );
591
+ $all_capabilities = apply_filters( 'members_get_capabilities', $all_capabilities );
592
+
593
+ /*
594
+ $publishpress_status_change_caps = array();
595
+ foreach( $all_capabilities as $cap_name ) {
596
+ if (0 === strpos($cap_name, 'status_change_')) {
597
+ $publishpress_status_change_caps []= $cap_name;
598
+ }
599
+ }
600
+ */
601
+
602
+ $plugin_caps = [];
603
+
604
+ if (defined('PUBLISHPRESS_VERSION')) {
605
+ $plugin_caps['PublishPress'] = apply_filters('cme_publishpress_capabilities',
606
+ array(
607
+ 'edit_metadata',
608
+ 'edit_post_subscriptions',
609
+ 'ppma_edit_orphan_post',
610
+ 'pp_manage_roles',
611
+ 'pp_set_notification_channel',
612
+ 'pp_view_calendar',
613
+ 'pp_view_content_overview',
614
+ 'status_change',
615
+ )
616
+ );
617
+ }
618
+
619
+ if (defined('PUBLISHPRESS_MULTIPLE_AUTHORS_VERSION')) {
620
+ if ($_caps = apply_filters('cme_multiple_authors_capabilities', array())) {
621
+ $plugin_caps['PublishPress Authors'] = $_caps;
622
+ }
623
+ }
624
+
625
+ if (defined('PRESSPERMIT_VERSION')) {
626
+ $plugin_caps['PublishPress Permissions'] = apply_filters('cme_presspermit_capabilities',
627
+ array(
628
+ 'edit_own_attachments',
629
+ 'list_others_unattached_files',
630
+ 'pp_administer_content',
631
+ 'pp_assign_roles',
632
+ 'pp_associate_any_page',
633
+ 'pp_create_groups',
634
+ 'pp_create_network_groups',
635
+ 'pp_define_moderation',
636
+ 'pp_define_post_status',
637
+ 'pp_define_privacy',
638
+ 'pp_delete_groups',
639
+ 'pp_edit_groups',
640
+ 'pp_exempt_edit_circle',
641
+ 'pp_exempt_read_circle',
642
+ 'pp_force_quick_edit',
643
+ 'pp_list_all_files',
644
+ 'pp_manage_capabilities',
645
+ 'pp_manage_members',
646
+ 'pp_manage_network_members',
647
+ 'pp_manage_settings',
648
+ 'pp_moderate_any',
649
+ 'pp_set_associate_exceptions',
650
+ 'pp_set_edit_exceptions',
651
+ 'pp_set_read_exceptions',
652
+ 'pp_set_revise_exceptions',
653
+ 'pp_set_term_assign_exceptions',
654
+ 'pp_set_term_associate_exceptions',
655
+ 'pp_set_term_manage_exceptions',
656
+ 'pp_unfiltered',
657
+ 'set_posts_status',
658
+ )
659
+ );
660
+ }
661
+
662
+ if (defined('WC_PLUGIN_FILE')) {
663
+ $plugin_caps['WooCommerce'] = apply_filters('cme_woocommerce_capabilities',
664
+ array(
665
+ 'assign_product_terms',
666
+ 'assign_shop_coupon_terms',
667
+ 'assign_shop_discount_terms',
668
+ 'assign_shop_order_terms',
669
+ 'assign_shop_payment_terms',
670
+ 'create_shop_orders',
671
+ 'delete_others_products',
672
+ 'delete_others_shop_coupons',
673
+ 'delete_others_shop_discounts',
674
+ 'delete_others_shop_orders',
675
+ 'delete_others_shop_payments',
676
+ 'delete_private_products',
677
+ 'delete_private_shop_coupons',
678
+ 'delete_private_shop_orders',
679
+ 'delete_private_shop_discounts',
680
+ 'delete_private_shop_payments',
681
+ 'delete_product_terms',
682
+ 'delete_products',
683
+ 'delete_published_products',
684
+ 'delete_published_shop_coupons',
685
+ 'delete_published_shop_discounts',
686
+ 'delete_published_shop_orders',
687
+ 'delete_published_shop_payments',
688
+ 'delete_shop_coupons',
689
+ 'delete_shop_coupon_terms',
690
+ 'delete_shop_discount_terms',
691
+ 'delete_shop_discounts',
692
+ 'delete_shop_order_terms',
693
+ 'delete_shop_orders',
694
+ 'delete_shop_payments',
695
+ 'delete_shop_payment_terms',
696
+ 'edit_others_products',
697
+ 'edit_others_shop_coupons',
698
+ 'edit_others_shop_discounts',
699
+ 'edit_others_shop_orders',
700
+ 'edit_others_shop_payments',
701
+ 'edit_private_products',
702
+ 'edit_private_shop_coupons',
703
+ 'edit_private_shop_discounts',
704
+ 'edit_private_shop_orders',
705
+ 'edit_private_shop_payments',
706
+ 'edit_product_terms',
707
+ 'edit_products',
708
+ 'edit_published_products',
709
+ 'edit_published_shop_coupons',
710
+ 'edit_published_shop_discounts',
711
+ 'edit_published_shop_orders',
712
+ 'edit_published_shop_payments',
713
+ 'edit_shop_coupon_terms',
714
+ 'edit_shop_coupons',
715
+ 'edit_shop_discounts',
716
+ 'edit_shop_discount_terms',
717
+ 'edit_shop_order_terms',
718
+ 'edit_shop_orders',
719
+ 'edit_shop_payments',
720
+ 'edit_shop_payment_terms',
721
+ 'export_shop_payments',
722
+ 'export_shop_reports',
723
+ 'import_shop_discounts',
724
+ 'import_shop_payments',
725
+ 'manage_product_terms',
726
+ 'manage_shop_coupon_terms',
727
+ 'manage_shop_discounts',
728
+ 'manage_shop_discount_terms',
729
+ 'manage_shop_payment_terms',
730
+ 'manage_shop_order_terms',
731
+ 'manage_shop_settings',
732
+ 'manage_woocommerce',
733
+ 'publish_products',
734
+ 'publish_shop_coupons',
735
+ 'publish_shop_discounts',
736
+ 'publish_shop_orders',
737
+ 'publish_shop_payments',
738
+ 'read_private_products',
739
+ 'read_private_shop_coupons',
740
+ 'read_private_shop_discounts',
741
+ 'read_private_shop_payments',
742
+ 'read_private_shop_orders',
743
+ 'view_admin_dashboard',
744
+ 'view_shop_discount_stats',
745
+ 'view_shop_payment_stats',
746
+ 'view_shop_reports',
747
+ 'view_shop_sensitive_data',
748
+ 'view_woocommerce_reports',
749
+ )
750
+ );
751
+ }
752
+
753
+ $plugin_caps = apply_filters('cme_plugin_capabilities', $plugin_caps);
754
+
755
+ foreach($plugin_caps as $plugin => $__plugin_caps) {
756
+ $_plugin_caps = array_fill_keys($__plugin_caps, true);
757
+
758
+ echo '<h3 class="cme-cap-section">' . sprintf(__( '%s Capabilities', 'capsman-enhanced' ), str_replace('_', ' ', $plugin )) . '</h3>';
759
+ echo '<table class="form-table cme-checklist"><tr>';
760
+