PluginProbe
Depicter — Popup & Slider Builder / 1.5.2
Depicter — Popup & Slider Builder v1.5.2
4.8.1 trunk 1.0.0 1.1.0 1.1.2 1.1.4 1.1.6 1.1.7 1.1.8 1.1.9 1.2.0 1.3.0 1.3.1 1.3.2 1.3.3 1.3.5 1.3.8 1.5.0 1.5.1 1.5.2 1.5.5 1.6.0 1.6.1 1.6.2 1.7.0 All 76 releases
depicter / app / src / Services / AuthorizationService.php

AuthorizationService.php in Depicter — Popup & Slider Builder 1.5.2, at app/src/Services/AuthorizationService.php

38 lines 706 B
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 namespace Depicter\Services;
4
5 class AuthorizationService {
6
7 /**
8 * Whether the current user has specified capabilities or not.
9 *
10 * @param string|array $capabilities
11 *
12 * @return bool
13 */
14 public function currentUserCan( $capabilities ){
15 if( empty( $capabilities ) ){
16 return false;
17 }
18
19 $capabilities = (array) $capabilities;
20 foreach( $capabilities as $capability ){
21 if( current_user_can( $capability ) ){
22 return true;
23 }
24 }
25
26 return false;
27 }
28
29 /**
30 * Whether current user is allowed to publish document or not
31 *
32 * @return bool
33 */
34 public function currentUserCanPublishDocument(){
35 return $this->currentUserCan( [ 'manage_options', 'publish_depicter' ] );
36 }
37 }
38