PluginProbe ʕ •ᴥ•ʔ
Slider Ultimate / 2.0.8
Slider Ultimate v2.0.8
trunk 1.0.0 1.0.1 1.0.10 1.0.11 1.0.12 1.0.13 1.0.14 1.0.15 1.0.16 1.0.17 1.0.18 1.0.19 1.0.2 1.0.3 1.0.4 1.0.5 1.0.6 1.0.7 1.0.8 1.0.9 1.1.0 1.1.1 1.1.2 1.1.3 1.1.4 1.1.5 1.1.6 1.1.7 1.1.8 1.1.9 2.0.0 2.0.1 2.0.2 2.0.3 2.0.4 2.0.5 2.0.6 2.0.7 2.0.8 2.0.9 2.1.0 2.1.1 2.2.0 2.2.1 2.2.2 2.2.3 2.2.4 2.2.5 2.2.6 2.2.7 2.2.8 2.2.9
ultimate-slider / includes / Permissions.class.php
ultimate-slider / includes Last commit date
BackwardsCompatibility.class.php 4 years ago Blocks.class.php 4 years ago CustomPostTypes.class.php 4 years ago Dashboard.class.php 4 years ago DeactivationSurvey.class.php 4 years ago InstallationWalkthrough.class.php 4 years ago Permissions.class.php 4 years ago ReviewAsk.class.php 4 years ago Settings.class.php 4 years ago Widgets.class.php 4 years ago WooCommerceIntegration.class.php 4 years ago template-functions.php 4 years ago
Permissions.class.php
65 lines
1 <?php
2 if ( !defined( 'ABSPATH' ) ) exit;
3
4 if ( !class_exists( 'ewdusPermissions' ) ) {
5 /**
6 * Class to handle plugin permissions for Ultimate Slider
7 *
8 * @since 2.0.0
9 */
10 class ewdusPermissions {
11
12 private $plugin_permissions;
13 private $permission_level;
14
15 public function __construct() {
16
17 $this->plugin_permissions = array(
18 'styling' => 2,
19 'woocommerce' => 2,
20 'youtube' => 2,
21 'premium' => 2,
22 'controls' => 2
23 );
24 }
25
26 public function set_permissions() {
27 global $ewd_us_controller;
28
29 if ( is_array( get_option( 'ewd-us-permission-level' ) ) ) { return; }
30
31 if ( ! empty( get_option( 'ewd-us-permission-level' ) ) ) {
32
33 update_option( 'ewd-us-permission-level', array( get_option( 'ewd-us-permission-level' ) ) );
34
35 return;
36 }
37
38 $this->permission_level = get_option( 'EWD_US_Full_Version' ) == 'Yes' ? 2 : 1;
39
40 update_option( 'ewd-us-permission-level', array( $this->permission_level ) );
41 }
42
43 public function get_permission_level() {
44
45 if ( ! is_array( get_option( 'ewd-us-permission-level' ) ) ) { $this->set_permissions(); }
46
47 $permissions_array = get_option( 'ewd-us-permission-level' );
48
49 $this->permission_level = is_array( $permissions_array ) ? reset( $permissions_array ) : $permissions_array;
50 }
51
52 public function check_permission( $permission_type = '' ) {
53
54 if ( ! $this->permission_level ) { $this->get_permission_level(); }
55
56 return ( array_key_exists( $permission_type, $this->plugin_permissions ) ? ( $this->permission_level >= $this->plugin_permissions[$permission_type] ? true : false ) : false );
57 }
58
59 public function update_permissions() {
60
61 $this->permission_level = get_option( 'ewd-us-permission-level' );
62 }
63 }
64
65 }