Changeset 28503 for trunk/src/wp-includes/capabilities.php
- Timestamp:
- 05/19/2014 05:19:36 AM (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/capabilities.php
r27390 r28503 35 35 * @var array 36 36 */ 37 var$roles;37 public $roles; 38 38 39 39 /** … … 44 44 * @var array 45 45 */ 46 var$role_objects = array();46 public $role_objects = array(); 47 47 48 48 /** … … 53 53 * @var array 54 54 */ 55 var$role_names = array();55 public $role_names = array(); 56 56 57 57 /** … … 62 62 * @var string 63 63 */ 64 var$role_key;64 public $role_key; 65 65 66 66 /** … … 71 71 * @var bool 72 72 */ 73 var$use_db = true;73 public $use_db = true; 74 74 75 75 /** … … 78 78 * @since 2.0.0 79 79 */ 80 function __construct() {80 public function __construct() { 81 81 $this->_init(); 82 } 83 84 /** 85 * Make private/protected methods readable for backwards compatibility 86 * 87 * @since 4.0.0 88 * @param string $name 89 * @param array $arguments 90 * @return mixed 91 */ 92 public function __call( $name, $arguments ) { 93 return call_user_func_array( array( $this, $name ), $arguments ); 82 94 } 83 95 … … 94 106 * @global array $wp_user_roles Used to set the 'roles' property value. 95 107 */ 96 function _init() {108 protected function _init() { 97 109 global $wpdb, $wp_user_roles; 98 110 $this->role_key = $wpdb->get_blog_prefix() . 'user_roles'; … … 124 136 * @access public 125 137 */ 126 function reinit() {138 public function reinit() { 127 139 // There is no need to reinit if using the wp_user_roles global. 128 140 if ( ! $this->use_db ) … … 161 173 * @return WP_Role|null WP_Role object if role is added, null if already exists. 162 174 */ 163 function add_role( $role, $display_name, $capabilities = array() ) {175 public function add_role( $role, $display_name, $capabilities = array() ) { 164 176 if ( isset( $this->roles[$role] ) ) 165 177 return; … … 184 196 * @param string $role Role name. 185 197 */ 186 function remove_role( $role ) {198 public function remove_role( $role ) { 187 199 if ( ! isset( $this->role_objects[$role] ) ) 188 200 return; … … 209 221 * @param bool $grant Optional, default is true. Whether role is capable of performing capability. 210 222 */ 211 function add_cap( $role, $cap, $grant = true ) {223 public function add_cap( $role, $cap, $grant = true ) { 212 224 if ( ! isset( $this->roles[$role] ) ) 213 225 return; … … 227 239 * @param string $cap Capability name. 228 240 */ 229 function remove_cap( $role, $cap ) {241 public function remove_cap( $role, $cap ) { 230 242 if ( ! isset( $this->roles[$role] ) ) 231 243 return; … … 245 257 * @return WP_Role|null WP_Role object if found, null if the role does not exist. 246 258 */ 247 function get_role( $role ) {259 public function get_role( $role ) { 248 260 if ( isset( $this->role_objects[$role] ) ) 249 261 return $this->role_objects[$role]; … … 260 272 * @return array List of role names. 261 273 */ 262 function get_names() {274 public function get_names() { 263 275 return $this->role_names; 264 276 } … … 273 285 * @return bool 274 286 */ 275 function is_role( $role ) {287 public function is_role( $role ) { 276 288 return isset( $this->role_names[$role] ); 277 289 }
Note: See TracChangeset
for help on using the changeset viewer.