PHP 클래스 WPDKUserRoles

부터: 1.6.0
저자: =undo= ([email protected])
상속: extends WP_Roles
파일 보기 프로젝트 열기: wpxtreme/wpdk 1 사용 예제들

공개 프로퍼티들

프로퍼티 타입 설명
$activeRoles array An array with all active roles
$all_roles array Array with the list of all roles.
$arrayCapabilitiesByRole array An key value pairs array with key = role and value = list of capabilities.
$arrayCountUsersByRole array List with count role group by user
$count integer Number of roles
$inactiveRoles array An array with all inactive roles
$wordPressRoles array Default WordPress roles

공개 메소드들

메소드 설명
__construct ( ) : WPDKUserRoles Create an instance of WPDKUserRoles class
activeRoles ( ) : array
add_role ( string $role, string $display_name, array $capabilities = [], string $description = '', string $owner = '' ) : null | WP_Role Updates the list of roles, if the role doesn't already exist.
arrayCapabilitiesByRole ( ) : array Create An key value pairs array with key = role and value = list of capabilities.
countUsersByRole ( ) : array Set the arrayCountUsersByRole property with the list of user count by role.
getInstance ( ) : WPDKUserRoles Create a singleton instance of WPDKUserRoles class
get_instance ( ) : WPDKUserRoles Create a singleton instance of WPDKUserRoles class
inactiveRoles ( ) : array
init ( ) : WPDKUserRoles Create a singleton instance of WPDKUserRoles class
invalidate ( ) : WPDKUserRoles Used to invalidate static (internal singleton) and refresh all roles list
remove_role ( string $role ) Remove a role
roleExists ( string $role ) : boolean Return TRUE if the role exists
rolesWithCaps ( WPDKCapability | string | array $caps ) : array Return the roles id list with one or more caps
statusRoles ( ) Set the activeRoles and inactiveRoles properties array.
wordPressRoles ( ) : mixed | void Return a key value pairs array with name of role and extends info.

메소드 상세

__construct() 공개 메소드

Create an instance of WPDKUserRoles class
public __construct ( ) : WPDKUserRoles
리턴 WPDKUserRoles

activeRoles() 공개 메소드

사용 중단: since 1.6.0 - Use statusRoles() instead
public activeRoles ( ) : array
리턴 array

add_role() 공개 메소드

The capabilities are defined in the following format array( 'read' => true ); To explicitly deny a role a capability you set the value for that capability to false. In this overide method you can extends the capapilities array with format array( 'read' => true, 'description' => 'Thsi capability allow access to...' );
public add_role ( string $role, string $display_name, array $capabilities = [], string $description = '', string $owner = '' ) : null | WP_Role
$role string Role name.
$display_name string Role display name.
$capabilities array Optional. List of role capabilities in the above format.
$description string Optional. An extend description for this role.
$owner string Optional. Owner of this role
리턴 null | WP_Role

arrayCapabilitiesByRole() 공개 메소드

Create An key value pairs array with key = role and value = list of capabilities.
public arrayCapabilitiesByRole ( ) : array
리턴 array

countUsersByRole() 공개 메소드

Counts the number of users for all roles on the site and returns this as an array.
public countUsersByRole ( ) : array
리턴 array

getInstance() 공개 정적인 메소드

Create a singleton instance of WPDKUserRoles class
public static getInstance ( ) : WPDKUserRoles
리턴 WPDKUserRoles

get_instance() 공개 정적인 메소드

Create a singleton instance of WPDKUserRoles class
public static get_instance ( ) : WPDKUserRoles
리턴 WPDKUserRoles

inactiveRoles() 공개 메소드

사용 중단: since 1.6.0 - Use statusRoles() instead
public inactiveRoles ( ) : array
리턴 array

init() 공개 정적인 메소드

Create a singleton instance of WPDKUserRoles class
public static init ( ) : WPDKUserRoles
리턴 WPDKUserRoles

invalidate() 공개 정적인 메소드

Used to invalidate static (internal singleton) and refresh all roles list
public static invalidate ( ) : WPDKUserRoles
리턴 WPDKUserRoles

remove_role() 공개 메소드

Remove a role
public remove_role ( string $role )
$role string

roleExists() 공개 메소드

Return TRUE if the role exists
public roleExists ( string $role ) : boolean
$role string Role key name
리턴 boolean

rolesWithCaps() 공개 메소드

Return the roles id list with one or more caps
부터: 1.5.4
public rolesWithCaps ( WPDKCapability | string | array $caps ) : array
$caps WPDKCapability | string | array Any instance of WPDKCapability class, capability name or array of capability name/instance of WPDKCapability class
리턴 array

statusRoles() 공개 메소드

Set the activeRoles and inactiveRoles properties array.
부터: 1.6.0
public statusRoles ( )

wordPressRoles() 공개 메소드

Return a key value pairs array with name of role and extends info.
public wordPressRoles ( ) : mixed | void
리턴 mixed | void

프로퍼티 상세

$activeRoles 공개적으로 프로퍼티

An array with all active roles
public array $activeRoles
리턴 array

$all_roles 공개적으로 프로퍼티

Array with the list of all roles.
public array $all_roles
리턴 array

$arrayCapabilitiesByRole 공개적으로 프로퍼티

An key value pairs array with key = role and value = list of capabilities.
public array $arrayCapabilitiesByRole
리턴 array

$arrayCountUsersByRole 공개적으로 프로퍼티

List with count role group by user
public array $arrayCountUsersByRole
리턴 array

$count 공개적으로 프로퍼티

Number of roles
public int $count
리턴 integer

$inactiveRoles 공개적으로 프로퍼티

An array with all inactive roles
public array $inactiveRoles
리턴 array

$wordPressRoles 공개적으로 프로퍼티

Default WordPress roles
public array $wordPressRoles
리턴 array