~canonical-sysadmins/wordpress/4.6.1

« back to all changes in this revision

Viewing changes to wp-includes/class-wp-role.php

  • Committer: Nick Moffitt
  • Date: 2016-04-14 10:44:19 UTC
  • mfrom: (1.1.14 upstream)
  • Revision ID: nick.moffitt@canonical.com-20160414104419-w6lxcr3ru4enc2w5
Merge WP4.5 from upstream

Show diffs side-by-side

added added

removed removed

Lines of Context:
81
81
        }
82
82
 
83
83
        /**
84
 
         * Whether role has capability.
 
84
         * Determines whether the role has the given capability.
85
85
         *
86
 
         * The capabilities is passed through the 'role_has_cap' filter. The first
87
 
         * parameter for the hook is the list of capabilities the class has
88
 
         * assigned. The second parameter is the capability name to look for. The
89
 
         * third and final parameter for the hook is the role name.
 
86
         * The capabilities is passed through the {@see 'role_has_cap'} filter.
 
87
         * The first parameter for the hook is the list of capabilities the class
 
88
         * has assigned. The second parameter is the capability name to look for.
 
89
         * The third and final parameter for the hook is the role name.
90
90
         *
91
91
         * @since 2.0.0
92
92
         * @access public
93
93
         *
94
94
         * @param string $cap Capability name.
95
 
         * @return bool True, if user has capability. False, if doesn't have capability.
 
95
         * @return bool True if the role has the given capability. False otherwise.
96
96
         */
97
97
        public function has_cap( $cap ) {
98
98
                /**
105
105
                 * @param string $name         Role name.
106
106
                 */
107
107
                $capabilities = apply_filters( 'role_has_cap', $this->capabilities, $cap, $this->name );
 
108
 
108
109
                if ( !empty( $capabilities[$cap] ) )
109
110
                        return $capabilities[$cap];
110
111
                else