Make WordPress Core


Ignore:
Timestamp:
11/30/2017 11:09:33 PM (8 years ago)
Author:
pento
Message:

Code is Poetry.
WordPress' code just... wasn't.
This is now dealt with.

Props jrf, pento, netweb, GaryJ, jdgrimes, westonruter, Greg Sherwood from PHPCS, and everyone who's ever contributed to WPCS and PHPCS.
Fixes #41057.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/class-wp-role.php

    r41162 r42343  
    4242     */
    4343    public function __construct( $role, $capabilities ) {
    44         $this->name = $role;
     44        $this->name         = $role;
    4545        $this->capabilities = $capabilities;
    4646    }
     
    5555     */
    5656    public function add_cap( $cap, $grant = true ) {
    57         $this->capabilities[$cap] = $grant;
     57        $this->capabilities[ $cap ] = $grant;
    5858        wp_roles()->add_cap( $this->name, $cap, $grant );
    5959    }
     
    7272     */
    7373    public function remove_cap( $cap ) {
    74         unset( $this->capabilities[$cap] );
     74        unset( $this->capabilities[ $cap ] );
    7575        wp_roles()->remove_cap( $this->name, $cap );
    7676    }
     
    101101        $capabilities = apply_filters( 'role_has_cap', $this->capabilities, $cap, $this->name );
    102102
    103         if ( !empty( $capabilities[$cap] ) )
    104             return $capabilities[$cap];
    105         else
     103        if ( ! empty( $capabilities[ $cap ] ) ) {
     104            return $capabilities[ $cap ];
     105        } else {
    106106            return false;
     107        }
    107108    }
    108109
Note: See TracChangeset for help on using the changeset viewer.