features
2 years ago
plugin-capabilities
2 years ago
roles
2 years ago
admin-load.php
2 years ago
admin.php
2 years ago
backup-handler.php
2 years ago
backup.php
2 years ago
cap-helper.php
4 years ago
dashboard.php
2 years ago
extractor-capabilities.php
2 years ago
filters-admin.php
4 years ago
filters-woocommerce.php
4 years ago
filters-wp_rest_workarounds.php
4 years ago
filters.php
2 years ago
functions-admin.php
2 years ago
functions.php
2 years ago
handler.php
2 years ago
inflect-cme.php
4 years ago
manager.php
2 years ago
network.php
4 years ago
plugin-capabilities.php
2 years ago
pp-handler.php
4 years ago
pp-ui.php
2 years ago
publishpress-roles.php
4 years ago
settings-handler.php
3 years ago
settings-ui.php
2 years ago
settings.php
2 years ago
test-user-ui.php
2 years ago
test-user.php
2 years ago
plugin-capabilities.php
413 lines
| 1 | <?php |
| 2 | |
| 3 | namespace PublishPress\Capabilities; |
| 4 | |
| 5 | class Plugin_Capabilities |
| 6 | { |
| 7 | private static $instance = null; |
| 8 | |
| 9 | public static function instance() |
| 10 | { |
| 11 | if (is_null(self::$instance)) { |
| 12 | self::$instance = new Plugin_Capabilities(); |
| 13 | } |
| 14 | |
| 15 | return self::$instance; |
| 16 | } |
| 17 | |
| 18 | public function __construct() |
| 19 | { |
| 20 | //PublishPress Capabilities |
| 21 | add_filter('cme_plugin_capabilities', [$this, 'cme_publishpress_capabilities_capabilities']); |
| 22 | //PublishPress Authors |
| 23 | add_filter('cme_plugin_capabilities', [$this, 'cme_multiple_authors_capabilities']); |
| 24 | //PublishPress Permissions |
| 25 | add_filter('cme_plugin_capabilities', [$this, 'cme_presspermit_capabilities']); |
| 26 | //Gravity Forms |
| 27 | add_filter('cme_plugin_capabilities', [$this, 'cme_gravityforms_capabilities']); |
| 28 | //WPML |
| 29 | add_filter('cme_plugin_capabilities', [$this, 'cme_wpml_capabilities']); |
| 30 | //WS Form |
| 31 | add_filter('cme_plugin_capabilities', [$this, 'cme_wsform_capabilities']); |
| 32 | //TaxoPress |
| 33 | add_filter('cme_plugin_capabilities', [$this, 'cme_taxopress_capabilities']); |
| 34 | //WooCommerce` |
| 35 | add_filter('cme_plugin_capabilities', [$this, 'cme_woocommerce_capabilities']); |
| 36 | //Echo Knowledge Base |
| 37 | add_filter('cme_plugin_capabilities', [$this, 'cme_echo_knowledge_base_capabilities']); |
| 38 | // Yoast SEO |
| 39 | add_filter('cme_plugin_capabilities', [$this, 'cme_yoast_seo_capabilities']); |
| 40 | } |
| 41 | |
| 42 | /** |
| 43 | * PublishPress Capabilities |
| 44 | * |
| 45 | * @param array $plugin_caps |
| 46 | * |
| 47 | * @return array |
| 48 | */ |
| 49 | public function cme_publishpress_capabilities_capabilities($plugin_caps) |
| 50 | { |
| 51 | |
| 52 | $plugin_caps['PublishPress Capabilities'] = apply_filters('cme_publishpress_capabilities_capabilities', []); |
| 53 | |
| 54 | return $plugin_caps; |
| 55 | } |
| 56 | |
| 57 | /** |
| 58 | * PublishPress Authors |
| 59 | * |
| 60 | * @param array $plugin_caps |
| 61 | * |
| 62 | * @return array |
| 63 | */ |
| 64 | public function cme_multiple_authors_capabilities($plugin_caps) |
| 65 | { |
| 66 | |
| 67 | if (defined('PUBLISHPRESS_MULTIPLE_AUTHORS_VERSION')) { |
| 68 | if ($_caps = apply_filters('cme_multiple_authors_capabilities', [])) { |
| 69 | $plugin_caps['PublishPress Authors'] = $_caps; |
| 70 | } |
| 71 | } |
| 72 | |
| 73 | return $plugin_caps; |
| 74 | } |
| 75 | |
| 76 | /** |
| 77 | * PublishPress Permissions |
| 78 | * |
| 79 | * @param array $plugin_caps |
| 80 | * |
| 81 | * @return array |
| 82 | */ |
| 83 | public function cme_presspermit_capabilities($plugin_caps) |
| 84 | { |
| 85 | |
| 86 | if (defined('PRESSPERMIT_VERSION')) { |
| 87 | $plugin_caps['PublishPress Permissions'] = apply_filters( |
| 88 | 'cme_presspermit_capabilities', |
| 89 | [ |
| 90 | 'edit_own_attachments', |
| 91 | 'list_others_unattached_files', |
| 92 | 'pp_administer_content', |
| 93 | 'pp_assign_roles', |
| 94 | 'pp_associate_any_page', |
| 95 | 'pp_create_groups', |
| 96 | 'pp_create_network_groups', |
| 97 | 'pp_define_moderation', |
| 98 | 'pp_define_post_status', |
| 99 | 'pp_define_privacy', |
| 100 | 'pp_delete_groups', |
| 101 | 'pp_edit_groups', |
| 102 | 'pp_exempt_edit_circle', |
| 103 | 'pp_exempt_read_circle', |
| 104 | 'pp_force_quick_edit', |
| 105 | 'pp_list_all_files', |
| 106 | 'pp_manage_capabilities', |
| 107 | 'pp_manage_members', |
| 108 | 'pp_manage_network_members', |
| 109 | 'pp_manage_settings', |
| 110 | 'pp_moderate_any', |
| 111 | 'pp_set_associate_exceptions', |
| 112 | 'pp_set_edit_exceptions', |
| 113 | 'pp_set_read_exceptions', |
| 114 | 'pp_set_revise_exceptions', |
| 115 | 'pp_set_term_assign_exceptions', |
| 116 | 'pp_set_term_associate_exceptions', |
| 117 | 'pp_set_term_manage_exceptions', |
| 118 | 'pp_unfiltered', |
| 119 | 'set_posts_status', |
| 120 | ] |
| 121 | ); |
| 122 | } |
| 123 | |
| 124 | return $plugin_caps; |
| 125 | } |
| 126 | |
| 127 | /** |
| 128 | * Gravity Forms |
| 129 | * |
| 130 | * @param array $plugin_caps |
| 131 | * |
| 132 | * @return array |
| 133 | */ |
| 134 | public function cme_gravityforms_capabilities($plugin_caps) |
| 135 | { |
| 136 | if (defined('GF_PLUGIN_DIR_PATH')) { |
| 137 | $plugin_caps['Gravity Forms'] = apply_filters( |
| 138 | 'cme_gravityforms_capabilities', |
| 139 | [ |
| 140 | 'gravityforms_create_form', |
| 141 | 'gravityforms_delete_forms', |
| 142 | 'gravityforms_edit_forms', |
| 143 | 'gravityforms_preview_forms', |
| 144 | 'gravityforms_view_entries', |
| 145 | 'gravityforms_edit_entries', |
| 146 | 'gravityforms_delete_entries', |
| 147 | 'gravityforms_view_entry_notes', |
| 148 | 'gravityforms_edit_entry_notes', |
| 149 | 'gravityforms_export_entries', |
| 150 | 'gravityforms_view_settings', |
| 151 | 'gravityforms_edit_settings', |
| 152 | 'gravityforms_view_updates', |
| 153 | 'gravityforms_view_addons', |
| 154 | 'gravityforms_system_status', |
| 155 | 'gravityforms_uninstall', |
| 156 | 'gravityforms_logging', |
| 157 | 'gravityforms_api_settings', |
| 158 | ] |
| 159 | ); |
| 160 | } |
| 161 | |
| 162 | return $plugin_caps; |
| 163 | } |
| 164 | |
| 165 | /** |
| 166 | * WPML |
| 167 | * |
| 168 | * @param array $plugin_caps |
| 169 | * |
| 170 | * @return array |
| 171 | */ |
| 172 | public function cme_wpml_capabilities($plugin_caps) |
| 173 | { |
| 174 | |
| 175 | if (defined('WPML_PLUGIN_FILE')) { |
| 176 | $plugin_caps['WPML'] = apply_filters( |
| 177 | 'cme_wpml_capabilities', |
| 178 | [ |
| 179 | 'wpml_manage_translation_management', |
| 180 | 'wpml_manage_languages', |
| 181 | 'wpml_manage_translation_options', |
| 182 | 'wpml_manage_troubleshooting', |
| 183 | 'wpml_manage_taxonomy_translation', |
| 184 | 'wpml_manage_wp_menus_sync', |
| 185 | 'wpml_manage_translation_analytics', |
| 186 | 'wpml_manage_string_translation', |
| 187 | 'wpml_manage_sticky_links', |
| 188 | 'wpml_manage_navigation', |
| 189 | 'wpml_manage_theme_and_plugin_localization', |
| 190 | 'wpml_manage_media_translation', |
| 191 | 'wpml_manage_support', |
| 192 | 'wpml_manage_woocommerce_multilingual', |
| 193 | 'wpml_operate_woocommerce_multilingual', |
| 194 | ] |
| 195 | ); |
| 196 | } |
| 197 | |
| 198 | return $plugin_caps; |
| 199 | } |
| 200 | |
| 201 | /** |
| 202 | * WS Form |
| 203 | * |
| 204 | * @param array $plugin_caps |
| 205 | * |
| 206 | * @return array |
| 207 | */ |
| 208 | public function cme_wsform_capabilities($plugin_caps) |
| 209 | { |
| 210 | |
| 211 | if (defined('WS_FORM_VERSION')) { |
| 212 | $plugin_caps['WS Form'] = apply_filters( |
| 213 | 'cme_wsform_capabilities', |
| 214 | [ |
| 215 | 'create_form', |
| 216 | 'delete_form', |
| 217 | 'edit_form', |
| 218 | 'export_form', |
| 219 | 'import_form', |
| 220 | 'publish_form', |
| 221 | 'read_form', |
| 222 | 'delete_submission', |
| 223 | 'edit_submission', |
| 224 | 'export_submission', |
| 225 | 'read_submission', |
| 226 | 'manage_options_wsform', |
| 227 | ] |
| 228 | ); |
| 229 | } |
| 230 | |
| 231 | return $plugin_caps; |
| 232 | } |
| 233 | |
| 234 | /** |
| 235 | * TaxoPress |
| 236 | * |
| 237 | * @param array $plugin_caps |
| 238 | * |
| 239 | * @return array |
| 240 | */ |
| 241 | public function cme_taxopress_capabilities($plugin_caps) |
| 242 | { |
| 243 | |
| 244 | if (defined('STAGS_VERSION')) { |
| 245 | $plugin_caps['TaxoPress'] = apply_filters( |
| 246 | 'cme_taxopress_capabilities', |
| 247 | [ |
| 248 | 'simple_tags', |
| 249 | 'admin_simple_tags' |
| 250 | ] |
| 251 | ); |
| 252 | } |
| 253 | |
| 254 | return $plugin_caps; |
| 255 | } |
| 256 | |
| 257 | /** |
| 258 | * Echo Knowledge Base |
| 259 | * |
| 260 | * @param array $plugin_caps |
| 261 | * |
| 262 | * @return array |
| 263 | */ |
| 264 | public function cme_echo_knowledge_base_capabilities($plugin_caps) |
| 265 | { |
| 266 | |
| 267 | if (defined('EPKB_PLUGIN_NAME')) { |
| 268 | $plugin_caps['Echo Knowledge Base'] = apply_filters( |
| 269 | 'cme_echo_knowledge_base_capabilities', |
| 270 | [ |
| 271 | 'admin_eckb_access_manager_page', |
| 272 | 'admin_eckb_access_crud_users', |
| 273 | 'admin_eckb_access_frontend_editor_write', |
| 274 | 'admin_eckb_access_search_analytics_read', |
| 275 | 'admin_eckb_access_order_articles_write', |
| 276 | 'admin_eckb_access_need_help_read', |
| 277 | 'admin_eckb_access_addons_news_read' |
| 278 | ] |
| 279 | ); |
| 280 | } |
| 281 | |
| 282 | return $plugin_caps; |
| 283 | } |
| 284 | |
| 285 | /** |
| 286 | * Yoast SEO |
| 287 | * |
| 288 | * @param array $plugin_caps |
| 289 | * |
| 290 | * @return array |
| 291 | */ |
| 292 | public function cme_yoast_seo_capabilities($plugin_caps) { |
| 293 | if (defined('WPSEO_FILE')) { |
| 294 | $plugin_caps['Yoast SEO'] = apply_filters('cme_yoast_seo_capabilities', |
| 295 | [ |
| 296 | 'view_site_health_checks', |
| 297 | 'wpseo_bulk_edit', |
| 298 | 'wpseo_edit_advanced_metadata', |
| 299 | 'wpseo_manage_options' |
| 300 | |
| 301 | ] |
| 302 | ); |
| 303 | } |
| 304 | |
| 305 | return $plugin_caps; |
| 306 | } |
| 307 | |
| 308 | /** |
| 309 | * WooCommerce |
| 310 | * |
| 311 | * @param array $plugin_caps |
| 312 | * |
| 313 | * @return array |
| 314 | */ |
| 315 | public function cme_woocommerce_capabilities($plugin_caps) |
| 316 | { |
| 317 | |
| 318 | if (defined('WC_PLUGIN_FILE')) { |
| 319 | $plugin_caps['WooCommerce'] = apply_filters( |
| 320 | 'cme_woocommerce_capabilities', |
| 321 | [ |
| 322 | 'assign_product_terms', |
| 323 | 'assign_shop_coupon_terms', |
| 324 | 'assign_shop_discount_terms', |
| 325 | 'assign_shop_order_terms', |
| 326 | 'assign_shop_payment_terms', |
| 327 | 'create_shop_orders', |
| 328 | 'delete_others_products', |
| 329 | 'delete_others_shop_coupons', |
| 330 | 'delete_others_shop_discounts', |
| 331 | 'delete_others_shop_orders', |
| 332 | 'delete_others_shop_payments', |
| 333 | 'delete_private_products', |
| 334 | 'delete_private_shop_coupons', |
| 335 | 'delete_private_shop_orders', |
| 336 | 'delete_private_shop_discounts', |
| 337 | 'delete_private_shop_payments', |
| 338 | 'delete_product_terms', |
| 339 | 'delete_products', |
| 340 | 'delete_published_products', |
| 341 | 'delete_published_shop_coupons', |
| 342 | 'delete_published_shop_discounts', |
| 343 | 'delete_published_shop_orders', |
| 344 | 'delete_published_shop_payments', |
| 345 | 'delete_shop_coupons', |
| 346 | 'delete_shop_coupon_terms', |
| 347 | 'delete_shop_discount_terms', |
| 348 | 'delete_shop_discounts', |
| 349 | 'delete_shop_order_terms', |
| 350 | 'delete_shop_orders', |
| 351 | 'delete_shop_payments', |
| 352 | 'delete_shop_payment_terms', |
| 353 | 'edit_others_products', |
| 354 | 'edit_others_shop_coupons', |
| 355 | 'edit_others_shop_discounts', |
| 356 | 'edit_others_shop_orders', |
| 357 | 'edit_others_shop_payments', |
| 358 | 'edit_private_products', |
| 359 | 'edit_private_shop_coupons', |
| 360 | 'edit_private_shop_discounts', |
| 361 | 'edit_private_shop_orders', |
| 362 | 'edit_private_shop_payments', |
| 363 | 'edit_product_terms', |
| 364 | 'edit_products', |
| 365 | 'edit_published_products', |
| 366 | 'edit_published_shop_coupons', |
| 367 | 'edit_published_shop_discounts', |
| 368 | 'edit_published_shop_orders', |
| 369 | 'edit_published_shop_payments', |
| 370 | 'edit_shop_coupon_terms', |
| 371 | 'edit_shop_coupons', |
| 372 | 'edit_shop_discounts', |
| 373 | 'edit_shop_discount_terms', |
| 374 | 'edit_shop_order_terms', |
| 375 | 'edit_shop_orders', |
| 376 | 'edit_shop_payments', |
| 377 | 'edit_shop_payment_terms', |
| 378 | 'export_shop_payments', |
| 379 | 'export_shop_reports', |
| 380 | 'import_shop_discounts', |
| 381 | 'import_shop_payments', |
| 382 | 'manage_product_terms', |
| 383 | 'manage_shop_coupon_terms', |
| 384 | 'manage_shop_discounts', |
| 385 | 'manage_shop_discount_terms', |
| 386 | 'manage_shop_payment_terms', |
| 387 | 'manage_shop_order_terms', |
| 388 | 'manage_shop_settings', |
| 389 | 'manage_woocommerce', |
| 390 | 'publish_products', |
| 391 | 'publish_shop_coupons', |
| 392 | 'publish_shop_discounts', |
| 393 | 'publish_shop_orders', |
| 394 | 'publish_shop_payments', |
| 395 | 'read_private_products', |
| 396 | 'read_private_shop_coupons', |
| 397 | 'read_private_shop_discounts', |
| 398 | 'read_private_shop_payments', |
| 399 | 'read_private_shop_orders', |
| 400 | 'view_admin_dashboard', |
| 401 | 'view_shop_discount_stats', |
| 402 | 'view_shop_payment_stats', |
| 403 | 'view_shop_reports', |
| 404 | 'view_shop_sensitive_data', |
| 405 | 'view_woocommerce_reports', |
| 406 | ] |
| 407 | ); |
| 408 | } |
| 409 | |
| 410 | return $plugin_caps; |
| 411 | } |
| 412 | } |
| 413 |