1 | <?php |
||
26 | final class EE_Capabilities extends EE_Base { |
||
27 | |||
28 | |||
29 | /** |
||
30 | * instance of EE_Capabilities object |
||
31 | * |
||
32 | * @var EE_Capabilities |
||
33 | */ |
||
34 | private static $_instance = null; |
||
35 | |||
36 | |||
37 | /** |
||
38 | * This is a map of caps that correspond to a default WP_Role. |
||
39 | * Array is indexed by Role and values are ee capabilities. |
||
40 | * |
||
41 | * @since 4.5.0 |
||
42 | * |
||
43 | * @var array |
||
44 | */ |
||
45 | private $_caps_map = array(); |
||
46 | |||
47 | |||
48 | |||
49 | /** |
||
50 | * This used to hold an array of EE_Meta_Capability_Map objects that define the granular capabilities mapped to for a user depending on context. |
||
51 | * |
||
52 | * @var EE_Meta_Capability_Map[] |
||
53 | */ |
||
54 | private $_meta_caps = array(); |
||
55 | |||
56 | /** |
||
57 | * the name of the wp option used to store caps previously initialized |
||
58 | */ |
||
59 | const option_name = 'ee_caps_initialized'; |
||
60 | |||
61 | |||
62 | |||
63 | |||
64 | |||
65 | /** |
||
66 | * singleton method used to instantiate class object |
||
67 | * |
||
68 | * @since 4.5.0 |
||
69 | * |
||
70 | * @return EE_Capabilities |
||
71 | */ |
||
72 | public static function instance() { |
||
79 | |||
80 | |||
81 | |||
82 | /** |
||
83 | * private constructor |
||
84 | * |
||
85 | * @since 4.5.0 |
||
86 | * |
||
87 | * @return \EE_Capabilities |
||
|
|||
88 | */ |
||
89 | private function __construct() { |
||
91 | |||
92 | |||
93 | |||
94 | /** |
||
95 | * This delays the initialization of the capabilities class until EE_System core is loaded and ready. |
||
96 | * |
||
97 | * @param bool $reset allows for resetting the default capabilities saved on roles. Note that this doesn't actually REMOVE any capabilities from existing roles, it just resaves defaults roles and ensures that they are up to date. |
||
98 | * |
||
99 | * |
||
100 | * @since 4.5.0 |
||
101 | * @return void |
||
102 | */ |
||
103 | public function init_caps( $reset = false ) { |
||
110 | |||
111 | |||
112 | |||
113 | |||
114 | /** |
||
115 | * This sets the meta caps property. |
||
116 | |||
117 | * @since 4.5.0 |
||
118 | * |
||
119 | * @return void |
||
120 | */ |
||
121 | private function _set_meta_caps() { |
||
132 | |||
133 | |||
134 | /** |
||
135 | * This builds and returns the default meta_caps array only once. |
||
136 | * |
||
137 | * @since 4.8.28.rc.012 |
||
138 | * @return array |
||
139 | */ |
||
140 | private function _get_default_meta_caps_array() { |
||
177 | |||
178 | |||
179 | |||
180 | /** |
||
181 | * This is the callback for the wp map_meta_caps() function which allows for ensuring certain caps that act as a |
||
182 | * "meta" for other caps ( i.e. ee_edit_event is a meta for ee_edit_others_events ) work as expected. |
||
183 | * |
||
184 | * The actual logic is carried out by implementer classes in their definition of _map_meta_caps. |
||
185 | * |
||
186 | * @since 4.5.0 |
||
187 | * @see wp-includes/capabilities.php |
||
188 | * |
||
189 | * @param array $caps actual users capabilities |
||
190 | * @param string $cap initial capability name that is being checked (the "map" key) |
||
191 | * @param int $user_id The user id |
||
192 | * @param array $args Adds context to the cap. Typically the object ID. |
||
193 | * |
||
194 | * @return array actual users capabilities |
||
195 | */ |
||
196 | public function map_meta_caps( $caps, $cap, $user_id, $args ) { |
||
208 | |||
209 | |||
210 | |||
211 | |||
212 | /** |
||
213 | * This sets up and returns the initial capabilities map for Event Espresso |
||
214 | * |
||
215 | * @since 4.5.0 |
||
216 | * |
||
217 | * @return array |
||
218 | */ |
||
219 | private function _init_caps_map() { |
||
220 | $caps = array( |
||
221 | 'administrator' => array( |
||
222 | //basic access |
||
223 | 'ee_read_ee', |
||
224 | //gateways |
||
225 | /** |
||
226 | * note that with payment method capabilities, although we've implemented |
||
227 | * capability mapping which will be used for accessing payment methods owned by |
||
228 | * other users. This is not fully implemented yet in the payment method ui. |
||
229 | * Currently only the "plural" caps are in active use. (Specific payment method caps are in use as well). |
||
230 | **/ |
||
231 | 'ee_manage_gateways', |
||
232 | 'ee_read_payment_method', |
||
233 | 'ee_read_payment_methods', |
||
234 | 'ee_read_others_payment_methods', |
||
235 | 'ee_edit_payment_method', |
||
236 | 'ee_edit_payment_methods', |
||
237 | 'ee_edit_others_payment_methods', |
||
238 | 'ee_delete_payment_method', |
||
239 | 'ee_delete_payment_methods', |
||
240 | //events |
||
241 | 'ee_publish_events', |
||
242 | 'ee_read_private_events', |
||
243 | 'ee_read_others_events', |
||
244 | 'ee_read_event', |
||
245 | 'ee_read_events', |
||
246 | 'ee_edit_event', |
||
247 | 'ee_edit_events', |
||
248 | 'ee_edit_published_events', |
||
249 | 'ee_edit_others_events', |
||
250 | 'ee_edit_private_events', |
||
251 | 'ee_delete_published_events', |
||
252 | 'ee_delete_private_events', |
||
253 | 'ee_delete_event', |
||
254 | 'ee_delete_events', |
||
255 | 'ee_delete_others_events', |
||
256 | //event categories |
||
257 | 'ee_manage_event_categories', |
||
258 | 'ee_edit_event_category', |
||
259 | 'ee_delete_event_category', |
||
260 | 'ee_assign_event_category', |
||
261 | //venues |
||
262 | 'ee_publish_venues', |
||
263 | 'ee_read_venue', |
||
264 | 'ee_read_venues', |
||
265 | 'ee_read_others_venues', |
||
266 | 'ee_read_private_venues', |
||
267 | 'ee_edit_venue', |
||
268 | 'ee_edit_venues', |
||
269 | 'ee_edit_others_venues', |
||
270 | 'ee_edit_published_venues', |
||
271 | 'ee_edit_private_venues', |
||
272 | 'ee_delete_venue', |
||
273 | 'ee_delete_venues', |
||
274 | 'ee_delete_others_venues', |
||
275 | 'ee_delete_private_venues', |
||
276 | 'ee_delete_published_venues', |
||
277 | //venue categories |
||
278 | 'ee_manage_venue_categories', |
||
279 | 'ee_edit_venue_category', |
||
280 | 'ee_delete_venue_category', |
||
281 | 'ee_assign_venue_category', |
||
282 | //contacts |
||
283 | 'ee_read_contact', |
||
284 | 'ee_read_contacts', |
||
285 | 'ee_edit_contact', |
||
286 | 'ee_edit_contacts', |
||
287 | 'ee_delete_contact', |
||
288 | 'ee_delete_contacts', |
||
289 | //registrations |
||
290 | 'ee_read_registration', |
||
291 | 'ee_read_registrations', |
||
292 | 'ee_read_others_registrations', |
||
293 | 'ee_edit_registration', |
||
294 | 'ee_edit_registrations', |
||
295 | 'ee_edit_others_registrations', |
||
296 | 'ee_delete_registration', |
||
297 | 'ee_delete_registrations', |
||
298 | //checkins |
||
299 | 'ee_read_checkin', |
||
300 | 'ee_read_others_checkins', |
||
301 | 'ee_read_checkins', |
||
302 | 'ee_edit_checkin', |
||
303 | 'ee_edit_checkins', |
||
304 | 'ee_edit_others_checkins', |
||
305 | 'ee_delete_checkin', |
||
306 | 'ee_delete_checkins', |
||
307 | 'ee_delete_others_checkins', |
||
308 | //transactions && payments |
||
309 | 'ee_read_transaction', |
||
310 | 'ee_read_transactions', |
||
311 | 'ee_edit_payments', |
||
312 | 'ee_delete_payments', |
||
313 | //messages |
||
314 | 'ee_read_message', |
||
315 | 'ee_read_messages', |
||
316 | 'ee_read_others_messages', |
||
317 | 'ee_read_global_messages', |
||
318 | 'ee_edit_global_messages', |
||
319 | 'ee_edit_message', |
||
320 | 'ee_edit_messages', |
||
321 | 'ee_edit_others_messages', |
||
322 | 'ee_delete_message', |
||
323 | 'ee_delete_messages', |
||
324 | 'ee_delete_others_messages', |
||
325 | 'ee_delete_global_messages', |
||
326 | 'ee_send_message', |
||
327 | //tickets |
||
328 | 'ee_read_default_ticket', |
||
329 | 'ee_read_default_tickets', |
||
330 | 'ee_read_others_default_tickets', |
||
331 | 'ee_edit_default_ticket', |
||
332 | 'ee_edit_default_tickets', |
||
333 | 'ee_edit_others_default_tickets', |
||
334 | 'ee_delete_default_ticket', |
||
335 | 'ee_delete_default_tickets', |
||
336 | 'ee_delete_others_default_tickets', |
||
337 | //prices |
||
338 | 'ee_edit_default_price', |
||
339 | 'ee_edit_default_prices', |
||
340 | 'ee_delete_default_price', |
||
341 | 'ee_delete_default_prices', |
||
342 | 'ee_edit_default_price_type', |
||
343 | 'ee_edit_default_price_types', |
||
344 | 'ee_delete_default_price_type', |
||
345 | 'ee_delete_default_price_types', |
||
346 | 'ee_read_default_prices', |
||
347 | 'ee_read_default_price_types', |
||
348 | //registration form |
||
349 | 'ee_edit_question', |
||
350 | 'ee_edit_questions', |
||
351 | 'ee_edit_system_questions', |
||
352 | 'ee_read_questions', |
||
353 | 'ee_delete_question', |
||
354 | 'ee_delete_questions', |
||
355 | 'ee_edit_question_group', |
||
356 | 'ee_edit_question_groups', |
||
357 | 'ee_read_question_groups', |
||
358 | 'ee_edit_system_question_groups', |
||
359 | 'ee_delete_question_group', |
||
360 | 'ee_delete_question_groups', |
||
361 | //event_type taxonomy |
||
362 | 'ee_assign_event_type', |
||
363 | 'ee_manage_event_types', |
||
364 | 'ee_edit_event_type', |
||
365 | 'ee_delete_event_type', |
||
366 | ), |
||
367 | 'ee_events_administrator' => array( |
||
368 | //core wp caps |
||
369 | 'read', |
||
370 | 'read_private_pages', |
||
371 | 'read_private_posts', |
||
372 | 'edit_users', |
||
373 | 'edit_posts', |
||
374 | 'edit_pages', |
||
375 | 'edit_published_posts', |
||
376 | 'edit_published_pages', |
||
377 | 'edit_private_pages', |
||
378 | 'edit_private_posts', |
||
379 | 'edit_others_posts', |
||
380 | 'edit_others_pages', |
||
381 | 'publish_posts', |
||
382 | 'publish_pages', |
||
383 | 'delete_posts', |
||
384 | 'delete_pages', |
||
385 | 'delete_private_pages', |
||
386 | 'delete_private_posts', |
||
387 | 'delete_published_pages', |
||
388 | 'delete_published_posts', |
||
389 | 'delete_others_posts', |
||
390 | 'delete_others_pages', |
||
391 | 'manage_categories', |
||
392 | 'manage_links', |
||
393 | 'moderate_comments', |
||
394 | 'unfiltered_html', |
||
395 | 'upload_files', |
||
396 | 'export', |
||
397 | 'import', |
||
398 | 'list_users', |
||
399 | 'level_1', //required if user with this role shows up in author dropdowns |
||
400 | //basic ee access |
||
401 | 'ee_read_ee', |
||
402 | //events |
||
403 | 'ee_publish_events', |
||
404 | 'ee_read_private_events', |
||
405 | 'ee_read_others_events', |
||
406 | 'ee_read_event', |
||
407 | 'ee_read_events', |
||
408 | 'ee_edit_event', |
||
409 | 'ee_edit_events', |
||
410 | 'ee_edit_published_events', |
||
411 | 'ee_edit_others_events', |
||
412 | 'ee_edit_private_events', |
||
413 | 'ee_delete_published_events', |
||
414 | 'ee_delete_private_events', |
||
415 | 'ee_delete_event', |
||
416 | 'ee_delete_events', |
||
417 | 'ee_delete_others_events', |
||
418 | //event categories |
||
419 | 'ee_manage_event_categories', |
||
420 | 'ee_edit_event_category', |
||
421 | 'ee_delete_event_category', |
||
422 | 'ee_assign_event_category', |
||
423 | //venues |
||
424 | 'ee_publish_venues', |
||
425 | 'ee_read_venue', |
||
426 | 'ee_read_venues', |
||
427 | 'ee_read_others_venues', |
||
428 | 'ee_read_private_venues', |
||
429 | 'ee_edit_venue', |
||
430 | 'ee_edit_venues', |
||
431 | 'ee_edit_others_venues', |
||
432 | 'ee_edit_published_venues', |
||
433 | 'ee_edit_private_venues', |
||
434 | 'ee_delete_venue', |
||
435 | 'ee_delete_venues', |
||
436 | 'ee_delete_others_venues', |
||
437 | 'ee_delete_private_venues', |
||
438 | 'ee_delete_published_venues', |
||
439 | //venue categories |
||
440 | 'ee_manage_venue_categories', |
||
441 | 'ee_edit_venue_category', |
||
442 | 'ee_delete_venue_category', |
||
443 | 'ee_assign_venue_category', |
||
444 | //contacts |
||
445 | 'ee_read_contact', |
||
446 | 'ee_read_contacts', |
||
447 | 'ee_edit_contact', |
||
448 | 'ee_edit_contacts', |
||
449 | 'ee_delete_contact', |
||
450 | 'ee_delete_contacts', |
||
451 | //registrations |
||
452 | 'ee_read_registration', |
||
453 | 'ee_read_registrations', |
||
454 | 'ee_read_others_registrations', |
||
455 | 'ee_edit_registration', |
||
456 | 'ee_edit_registrations', |
||
457 | 'ee_edit_others_registrations', |
||
458 | 'ee_delete_registration', |
||
459 | 'ee_delete_registrations', |
||
460 | //checkins |
||
461 | 'ee_read_checkin', |
||
462 | 'ee_read_others_checkins', |
||
463 | 'ee_read_checkins', |
||
464 | 'ee_edit_checkin', |
||
465 | 'ee_edit_checkins', |
||
466 | 'ee_edit_others_checkins', |
||
467 | 'ee_delete_checkin', |
||
468 | 'ee_delete_checkins', |
||
469 | 'ee_delete_others_checkins', |
||
470 | //transactions && payments |
||
471 | 'ee_read_transaction', |
||
472 | 'ee_read_transactions', |
||
473 | 'ee_edit_payments', |
||
474 | 'ee_delete_payments', |
||
475 | //messages |
||
476 | 'ee_read_message', |
||
477 | 'ee_read_messages', |
||
478 | 'ee_read_others_messages', |
||
479 | 'ee_read_global_messages', |
||
480 | 'ee_edit_global_messages', |
||
481 | 'ee_edit_message', |
||
482 | 'ee_edit_messages', |
||
483 | 'ee_edit_others_messages', |
||
484 | 'ee_delete_message', |
||
485 | 'ee_delete_messages', |
||
486 | 'ee_delete_others_messages', |
||
487 | 'ee_delete_global_messages', |
||
488 | 'ee_send_message', |
||
489 | //tickets |
||
490 | 'ee_read_default_ticket', |
||
491 | 'ee_read_default_tickets', |
||
492 | 'ee_read_others_default_tickets', |
||
493 | 'ee_edit_default_ticket', |
||
494 | 'ee_edit_default_tickets', |
||
495 | 'ee_edit_others_default_tickets', |
||
496 | 'ee_delete_default_ticket', |
||
497 | 'ee_delete_default_tickets', |
||
498 | 'ee_delete_others_default_tickets', |
||
499 | //prices |
||
500 | 'ee_edit_default_price', |
||
501 | 'ee_edit_default_prices', |
||
502 | 'ee_delete_default_price', |
||
503 | 'ee_delete_default_prices', |
||
504 | 'ee_edit_default_price_type', |
||
505 | 'ee_edit_default_price_types', |
||
506 | 'ee_delete_default_price_type', |
||
507 | 'ee_delete_default_price_types', |
||
508 | 'ee_read_default_prices', |
||
509 | 'ee_read_default_price_types', |
||
510 | //registration form |
||
511 | 'ee_edit_question', |
||
512 | 'ee_edit_questions', |
||
513 | 'ee_edit_system_questions', |
||
514 | 'ee_read_questions', |
||
515 | 'ee_delete_question', |
||
516 | 'ee_delete_questions', |
||
517 | 'ee_edit_question_group', |
||
518 | 'ee_edit_question_groups', |
||
519 | 'ee_read_question_groups', |
||
520 | 'ee_edit_system_question_groups', |
||
521 | 'ee_delete_question_group', |
||
522 | 'ee_delete_question_groups', |
||
523 | //event_type taxonomy |
||
524 | 'ee_assign_event_type', |
||
525 | 'ee_manage_event_types', |
||
526 | 'ee_edit_event_type', |
||
527 | 'ee_delete_event_type', |
||
528 | ) |
||
529 | ); |
||
530 | |||
531 | $caps = apply_filters( 'FHEE__EE_Capabilities__init_caps_map__caps', $caps ); |
||
532 | return $caps; |
||
533 | } |
||
534 | |||
535 | |||
536 | |||
537 | |||
538 | /** |
||
539 | * This adds all the default caps to roles as registered in the _caps_map property. |
||
540 | * |
||
541 | * @since 4.5.0 |
||
542 | * |
||
543 | * @param bool $reset allows for resetting the default capabilities saved on roles. Note that this doesn't actually REMOVE any capabilities from existing roles, it just resaves defaults roles and ensures that they are up to date. |
||
544 | * @param array $custom_map Optional. Can be used to send a custom map of roles and capabilities for setting them up. Note that this should ONLY be called on activation hook or some other one-time task otherwise the caps will be added on every request. |
||
545 | * |
||
546 | * @return void |
||
547 | */ |
||
548 | public function init_role_caps( $reset = false, $custom_map = array() ) { |
||
549 | |||
550 | $caps_map = empty( $custom_map ) ? $this->_caps_map : $custom_map; |
||
551 | |||
552 | //first let's determine if these caps have already been set. |
||
553 | $caps_set_before = get_option( self::option_name, array() ); |
||
554 | //if not reset, see what caps are new for each role. if they're new, add them. |
||
555 | foreach ( $caps_map as $role => $caps_for_role ) { |
||
556 | foreach ( $caps_for_role as $cap ) { |
||
557 | //first check we haven't already added this cap before, or it's a reset |
||
558 | if ( $reset || ! isset( $caps_set_before[ $role ] ) || ! in_array( $cap, $caps_set_before[ $role ] ) ) { |
||
559 | if ( $this->add_cap_to_role( $role, $cap ) ) { |
||
560 | $caps_set_before[ $role ][] = $cap; |
||
561 | } |
||
562 | } |
||
563 | } |
||
564 | } |
||
565 | |||
566 | //now let's just save the cap that has been set. |
||
567 | update_option( self::option_name, $caps_set_before ); |
||
568 | do_action( 'AHEE__EE_Capabilities__init_role_caps__complete', $caps_set_before ); |
||
569 | } |
||
570 | |||
571 | |||
572 | |||
573 | |||
574 | /** |
||
575 | * This method sets a capability on a role. Note this should only be done on activation, or if you have something specific to prevent the cap from being added on every page load (adding caps are persistent to the db). |
||
576 | * Note. this is a wrapper for $wp_role->add_cap() |
||
577 | * |
||
578 | * @see wp-includes/capabilities.php |
||
579 | * |
||
580 | * @since 4.5.0 |
||
581 | * |
||
582 | * @param string $role A WordPress role the capability is being added to |
||
583 | * @param string $cap The capability being added to the role |
||
584 | * @param bool $grant Whether to grant access to this cap on this role. |
||
585 | * @return bool |
||
586 | */ |
||
587 | public function add_cap_to_role( $role, $cap, $grant = true ) { |
||
588 | $role_object = get_role( $role ); |
||
589 | //if the role isn't available then we create it. |
||
590 | if ( ! $role_object instanceof WP_Role ) { |
||
591 | //if a plugin wants to create a specific role name then they should create the role before |
||
592 | //EE_Capabilities does. Otherwise this function will create the role name from the slug: |
||
593 | // - removes any `ee_` namespacing from the start of the slug. |
||
594 | // - replaces `_` with ` ` (empty space). |
||
595 | // - sentence case on the resulting string. |
||
596 | $role_label = ucwords( str_replace( '_', ' ', str_replace( 'ee_', '', $role ) ) ); |
||
597 | $role_object = add_role( $role, $role_label ); |
||
598 | } |
||
599 | if ( $role_object instanceof WP_Role ) { |
||
600 | $role_object->add_cap( $cap, $grant ); |
||
601 | return true; |
||
602 | } |
||
603 | return false; |
||
604 | } |
||
605 | |||
606 | |||
607 | |||
608 | |||
609 | |||
610 | /** |
||
611 | * Functions similarly to add_cap_to_role except removes cap from given role. |
||
612 | * Wrapper for $wp_role->remove_cap() |
||
613 | * |
||
614 | * @see wp-includes/capabilities.php |
||
615 | * @since 4.5.0 |
||
616 | * |
||
617 | * @param string $role A WordPress role the capability is being removed from. |
||
618 | * @param string $cap The capability being removed |
||
619 | * |
||
620 | * @return void |
||
621 | */ |
||
622 | public function remove_cap_from_role( $role, $cap ) { |
||
628 | |||
629 | |||
630 | |||
631 | |||
632 | /** |
||
633 | * Wrapper for the native WP current_user_can() method. |
||
634 | * This is provided as a handy method for a couple things: |
||
635 | * 1. Using the context string it allows for targeted filtering by addons for a specific check (without having to write those filters wherever current_user_can is called). |
||
636 | * 2. Explicit passing of $id from a given context ( useful in the cases of map_meta_cap filters ) |
||
637 | * |
||
638 | * @since 4.5.0 |
||
639 | * |
||
640 | * @param string $cap The cap being checked. |
||
641 | * @param string $context The context where the current_user_can is being called from. |
||
642 | * @param int $id Optional. Id for item where current_user_can is being called from (used in map_meta_cap() filters. |
||
643 | * |
||
644 | * @return bool Whether user can or not. |
||
645 | */ |
||
646 | public function current_user_can( $cap, $context, $id = 0 ) { |
||
652 | |||
653 | |||
654 | |||
655 | |||
656 | |||
657 | /** |
||
658 | * This is a wrapper for the WP user_can() function and follows the same style as the other wrappers in this class. |
||
659 | * |
||
660 | * @param int|WP_User $user Either the user_id or a WP_User object |
||
661 | * @param string $cap The capability string being checked |
||
662 | * @param string $context The context where the user_can is being called from (used in filters). |
||
663 | * @param int $id Optional. Id for item where user_can is being called from ( used in map_meta_cap() filters) |
||
664 | * |
||
665 | * @return bool Whether user can or not. |
||
666 | */ |
||
667 | public function user_can( $user, $cap, $context, $id = 0 ) { |
||
673 | |||
674 | |||
675 | |||
676 | /** |
||
677 | * Wrapper for the native WP current_user_can_for_blog() method. |
||
678 | * This is provided as a handy method for a couple things: |
||
679 | * 1. Using the context string it allows for targeted filtering by addons for a specific check (without having to write those filters wherever current_user_can is called). |
||
680 | * 2. Explicit passing of $id from a given context ( useful in the cases of map_meta_cap filters ) |
||
681 | * |
||
682 | * @since 4.5.0 |
||
683 | * |
||
684 | * @param int $blog_id The blog id that is being checked for. |
||
685 | * @param string $cap The cap being checked. |
||
686 | * @param string $context The context where the current_user_can is being called from. |
||
687 | * @param int $id Optional. Id for item where current_user_can is being called from (used in map_meta_cap() filters. |
||
688 | * |
||
689 | * @return bool Whether user can or not. |
||
690 | */ |
||
691 | public function current_user_can_for_blog( $blog_id, $cap, $context, $id = 0 ) { |
||
699 | |||
700 | |||
701 | |||
702 | /** |
||
703 | * This helper method just returns an array of registered EE capabilities. |
||
704 | * Note this array is filtered. It is assumed that all available EE capabilities are assigned to the administrator role. |
||
705 | * |
||
706 | * @since 4.5.0 |
||
707 | * |
||
708 | * @param string $role If empty then the entire role/capability map is returned. Otherwise just the capabilities for the given role are returned. |
||
709 | * |
||
710 | * @return array |
||
711 | */ |
||
712 | public function get_ee_capabilities( $role = 'administrator' ) { |
||
719 | } |
||
720 | |||
721 | |||
722 | |||
1169 |
Adding a
@return
annotation to a constructor is not recommended, since a constructor does not have a meaningful return value.Please refer to the PHP core documentation on constructors.