| @@ -9,10 +9,11 @@ | ||
| 9 | 9 | */ |
| 10 | 10 | |
| 11 | 11 | namespace TUTOR; |
| 12 | 12 | |
| 13 | -defined( 'ABSPATH' ) || exit; | |
| 14 | - | |
| 13 | +if ( ! defined( 'ABSPATH' ) ) { | |
| 14 | + exit; | |
| 15 | +} | |
| 15 | 16 | /** |
| 16 | 17 | * Addons Class |
| 17 | 18 | * |
| 18 | 19 | * @since 1.0.0 |
| @@ -23,9 +24,8 @@ | ||
| 23 | 24 | /** |
| 24 | 25 | * Constructor |
| 25 | 26 | * |
| 26 | 27 | * @since 1.0.0 |
| 27 | - * | |
| 28 | 28 | * @return void |
| 29 | 29 | */ |
| 30 | 30 | public function __construct() { |
| 31 | 31 | add_filter( 'tutor_pro_addons_lists_for_display', array( $this, 'addons_lists_to_show' ) ); |
| @@ -51,9 +51,8 @@ | ||
| 51 | 51 | * @since 3.0.0 |
| 52 | 52 | * |
| 53 | 53 | * @param string $basename basename of addon. |
| 54 | 54 | * @param bool $status status 0,1. |
| 55 | - * | |
| 56 | 55 | * @return void |
| 57 | 56 | */ |
| 58 | 57 | public static function update_addon_status( $basename, $status ) { |
| 59 | 58 | $config = self::get_addons_config(); |
| @@ -66,9 +65,8 @@ | ||
| 66 | 65 | /** |
| 67 | 66 | * Get all addons data. |
| 68 | 67 | * |
| 69 | 68 | * @since 1.0.0 |
| 70 | - * | |
| 71 | 69 | * @return void |
| 72 | 70 | */ |
| 73 | 71 | public function get_all_addons() { |
| 74 | 72 | |
| @@ -74,9 +72,9 @@ | ||
| 74 | 72 | |
| 75 | 73 | // Check and verify the request. |
| 76 | 74 | tutor_utils()->checking_nonce(); |
| 77 | 75 | |
| 78 | - if ( ! User::can() ) { | |
| 76 | + if ( ! User::is_admin() ) { | |
| 79 | 77 | wp_send_json_error( tutor_utils()->error_message() ); |
| 80 | 78 | } |
| 81 | 79 | |
| 82 | 80 | // All good, let's proceed. |
| @@ -180,10 +178,10 @@ | ||
| 180 | 178 | public function addon_enable_disable() { |
| 181 | 179 | |
| 182 | 180 | tutor_utils()->checking_nonce(); |
| 183 | 181 | |
| 184 | - if ( ! User::can() ) { | |
| 185 | - wp_send_json_error( tutor_utils()->error_message() ); | |
| 182 | + if ( ! current_user_can( 'manage_options' ) ) { | |
| 183 | + wp_send_json_error( array( 'message' => __( 'Access Denied', 'tutor' ) ) ); | |
| 186 | 184 | } |
| 187 | 185 | |
| 188 | 186 | $form_data = json_decode( Input::post( 'addonFieldNames' ) ); |
| 189 | 187 | $before_config = self::get_addons_config(); |
| @@ -228,9 +226,8 @@ | ||
| 228 | 226 | /** |
| 229 | 227 | * Get tutor addons list |
| 230 | 228 | * |
| 231 | 229 | * @since 1.0.0 |
| 232 | - * | |
| 233 | 230 | * @return array |
| 234 | 231 | */ |
| 235 | 232 | public function addons_lists_to_show() { |
| 236 | 233 | $addons = array( |
| @@ -241,13 +238,8 @@ | ||
| 241 | 238 | 'subscription' => array( |
| 242 | 239 | 'name' => __( 'Subscription', 'tutor' ), |
| 243 | 240 | 'description' => __( 'Manage subscription', 'tutor' ), |
| 244 | 241 | ), |
| 245 | - 'content-bank' => array( | |
| 246 | - 'name' => __( 'Content Bank', 'tutor' ), | |
| 247 | - 'description' => __( 'Create content once and use it across multiple courses.', 'tutor' ), | |
| 248 | - 'is_new' => true, | |
| 249 | - ), | |
| 250 | 242 | 'social-login' => array( |
| 251 | 243 | 'name' => __( 'Social Login', 'tutor' ), |
| 252 | 244 | 'description' => __( 'Let users register & login through social networks.', 'tutor' ), |
| 253 | 245 | ), |
| @@ -345,8 +337,9 @@ | ||
| 345 | 337 | ), |
| 346 | 338 | 'h5p' => array( |
| 347 | 339 | 'name' => __( 'H5P', 'tutor' ), |
| 348 | 340 | 'description' => __( 'Integrate H5P to add interactivity and engagement to your courses.', 'tutor' ), |
| 341 | + 'is_new' => true, | |
| 349 | 342 | ), |
| 350 | 343 | ); |
| 351 | 344 | |
| 352 | 345 | return $addons; |