| 1 |
<?php |
| 2 |
|
| 3 |
|
| 4 |
namespace JP\CC; |
| 5 |
|
| 6 |
if ( ! defined( 'ABSPATH' ) ) { |
| 7 |
exit; |
| 8 |
} |
| 9 |
|
| 10 |
|
| 11 |
class Roles { |
| 12 |
/** |
| 13 |
* Returns a list of valid user roles. |
| 14 |
* |
| 15 |
* @return array|mixed|void |
| 16 |
*/ |
| 17 |
public static function allowed_user_roles() { |
| 18 |
global $wp_roles; |
| 19 |
|
| 20 |
static $roles; |
| 21 |
|
| 22 |
if ( ! isset( $roles ) ) { |
| 23 |
$roles = apply_filters( 'jp_cc_user_roles', $wp_roles->role_names ); |
| 24 |
|
| 25 |
if ( ! is_array( $roles ) || empty( $roles ) ) { |
| 26 |
$roles = array(); |
| 27 |
} |
| 28 |
} |
| 29 |
|
| 30 |
return $roles; |
| 31 |
} |
| 32 |
|
| 33 |
} |
| 34 |
|