woocommerce-multilingual
/
addons
/
wpml-dependencies
/
vendor
/
wpml
/
wp
/
classes
Last commit date
Attachment.php
1 month ago
Cache.php
1 month ago
Gutenberg.php
1 month ago
Hooks.php
1 month ago
Http.php
1 month ago
Nonce.php
1 month ago
Option.php
1 month ago
Post.php
1 month ago
PostType.php
1 month ago
Resources.php
1 month ago
Roles.php
4 years ago
Transient.php
1 month ago
Url.php
1 month ago
User.php
1 month ago
WP.php
1 month ago
WPDB.php
1 month ago
Roles.php
20 lines
| 1 | <?php |
| 2 | |
| 3 | namespace WPML\LIB\WP; |
| 4 | |
| 5 | use WPML\FP\Obj; |
| 6 | use function WPML\FP\curryN; |
| 7 | |
| 8 | class Roles { |
| 9 | |
| 10 | public static function hasCap( $cap = null, $role = null ) { |
| 11 | $hasCap = function ( $cap, $role ) { |
| 12 | global $wp_roles; |
| 13 | |
| 14 | return Obj::pathOr( false, [ $role, 'capabilities', $cap ], $wp_roles->roles ); |
| 15 | }; |
| 16 | |
| 17 | return call_user_func_array( curryN( 2, $hasCap ), func_get_args() ); |
| 18 | } |
| 19 | } |
| 20 |