• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

Yoast / wordpress-seo / 49cdf70e861509c37a279de77f1105ee59c0f57f

20 Feb 2024 09:17AM UTC coverage: 53.172%. First build
49cdf70e861509c37a279de77f1105ee59c0f57f

push

github

YoastBot
Bump version to 22.1 on free

7564 of 13903 branches covered (54.41%)

Branch coverage included in aggregate %.

29067 of 54988 relevant lines covered (52.86%)

40245.15 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

0.0
/admin/capabilities/class-capability-manager-wp.php
1
<?php
2
/**
3
 * WPSEO plugin file.
4
 *
5
 * @package WPSEO\Admin\Capabilities
6
 */
7

8
/**
9
 * Default WordPress capability manager implementation.
10
 */
11
final class WPSEO_Capability_Manager_WP extends WPSEO_Abstract_Capability_Manager {
12

13
        /**
14
         * Adds the capabilities to the roles.
15
         *
16
         * @return void
17
         */
18
        public function add() {
×
19
                foreach ( $this->capabilities as $capability => $roles ) {
×
20
                        $filtered_roles = $this->filter_roles( $capability, $roles );
×
21

22
                        $wp_roles = $this->get_wp_roles( $filtered_roles );
×
23
                        foreach ( $wp_roles as $wp_role ) {
×
24
                                $wp_role->add_cap( $capability );
×
25
                        }
26
                }
27
        }
28

29
        /**
30
         * Unregisters the capabilities from the system.
31
         *
32
         * @return void
33
         */
34
        public function remove() {
×
35
                // Remove from any roles it has been added to.
36
                $roles = wp_roles()->get_names();
×
37
                $roles = array_keys( $roles );
×
38

39
                foreach ( $this->capabilities as $capability => $_roles ) {
×
40
                        $registered_roles = array_unique( array_merge( $roles, $this->capabilities[ $capability ] ) );
×
41

42
                        // Allow filtering of roles.
43
                        $filtered_roles = $this->filter_roles( $capability, $registered_roles );
×
44

45
                        $wp_roles = $this->get_wp_roles( $filtered_roles );
×
46
                        foreach ( $wp_roles as $wp_role ) {
×
47
                                $wp_role->remove_cap( $capability );
×
48
                        }
49
                }
50
        }
51
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc