Make WordPress Core


Ignore:
Timestamp:
02/12/2006 07:53:23 AM (19 years ago)
Author:
ryan
Message:

Death to trailing tabs. Props Mark J. fixes #2405

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-includes/capabilities.php

    r3513 r3517  
    3535        return $this->role_objects[$role];
    3636    }
    37    
     37
    3838    function remove_role($role) {
    3939        if ( ! isset($this->role_objects[$role]) )
    4040            return;
    41        
     41
    4242        unset($this->role_objects[$role]);
    4343        unset($this->role_names[$role]);
    4444        unset($this->roles[$role]);
    45        
     45
    4646        update_option($this->role_key, $this->roles);
    4747    }
     
    7171    {
    7272        return isset($this->role_names[$role]);
    73     }   
     73    }
    7474}
    7575
     
    151151        $this->get_role_caps();
    152152    }
    153    
     153
    154154    function get_role_caps() {
    155155        global $wp_roles;
    156        
     156
    157157        if ( ! isset($wp_roles) )
    158158            $wp_roles = new WP_Roles();
     
    170170        $this->allcaps = array_merge($this->allcaps, $this->caps);
    171171    }
    172    
     172
    173173    function add_role($role) {
    174174        $this->caps[$role] = true;
     
    177177        $this->update_user_level_from_caps();
    178178    }
    179    
     179
    180180    function remove_role($role) {
    181181        if ( empty($this->roles[$role]) || (count($this->roles) <= 1) )
     
    185185        $this->get_role_caps();
    186186    }
    187    
     187
    188188    function set_role($role) {
    189189        foreach($this->roles as $oldrole)
     
    204204        }
    205205    }
    206    
     206
    207207    function update_user_level_from_caps() {
    208208        global $table_prefix;
     
    210210        update_usermeta($this->id, $table_prefix.'user_level', $this->user_level);
    211211    }
    212    
     212
    213213    function add_cap($cap, $grant = true) {
    214214        $this->caps[$cap] = $grant;
     
    221221        update_usermeta($this->id, $this->cap_key, $this->caps);
    222222    }
    223    
     223
    224224    //has_cap(capability_or_role_name) or
    225225    //has_cap('edit_post', post_id)
     
    227227        if ( is_numeric($cap) )
    228228            $cap = $this->translate_level_to_cap($cap);
    229        
     229
    230230        $args = array_slice(func_get_args(), 1);
    231231        $args = array_merge(array($cap, $this->id), $args);
     
    346346    case 'read_post':
    347347        $post = get_post($args[0]);
    348        
     348
    349349        if ( 'private' != $post->post_status ) {
    350350            $caps[] = 'read';
    351             break; 
    352         }
    353            
     351            break;
     352        }
     353
    354354        $author_data = get_userdata($user_id);
    355355        $post_author_data = get_userdata($post->post_author);
Note: See TracChangeset for help on using the changeset viewer.