PluginProbe
Tutor LMS – eLearning and online course solution / 1.3.5
Tutor LMS – eLearning and online course solution v1.3.5
4.0.7 4.0.6 4.0.5 4.0.4 4.0.3 4.0.2 4.0.1 4.0.0 3.9.15 3.9.14 3.9.13 3.9.12 3.9.11 trunk 1.0.0 1.0.0-alpha 1.0.1 1.0.2 1.0.3 1.0.4 1.0.5 1.0.6 1.0.7 1.0.8 1.0.9 All 191 releases
tutor / classes / Addons.php

Addons.php in Tutor LMS – eLearning and online course solution 1.3.5, at classes/Addons.php

105 lines 3.0 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * Addons class
4 *
5 * @author: themeum
6 * @author_uri: https://themeum.com
7 * @package Tutor
8 * @since v.1.0.0
9 */
10
11
12 namespace TUTOR;
13
14
15 if ( ! defined( 'ABSPATH' ) )
16 exit;
17
18 class Addons {
19
20 public function __construct() {
21 add_filter('tutor_pro_addons_lists_for_display', array($this, 'tutor_addons_lists_to_show'));
22 }
23
24 public function tutor_addons_lists_to_show(){
25
26 $addons = array(
27 'tutor-certificate' => array(
28 'name' => __('Tutor Certificate', 'tutor-certificate'),
29 'description' => 'Student will able to download certificate of completed course',
30 ),
31 'tutor-course-attachments' => array(
32 'name' => __('Tutor Course Attachments', 'tutor-certificate'),
33 'description' => 'Add unlimited attachments/ private files to any Tutor course',
34 ),
35 'tutor-course-preview' => array(
36 'name' => __('Tutor Course Preview', 'tutor-certificate'),
37 'description' => 'Open some lesson to check course overview for guest',
38 ),
39 'tutor-email' => array(
40 'name' => __('Tutor E-Mail', 'tutor-certificate'),
41 'description' => 'Send email on various tutor events',
42 ),
43 'tutor-multi-instructors' => array(
44 'name' => __('Tutor Multi Instructors', 'tutor-certificate'),
45 'description' => 'Start a course with multiple instructors by Tutor Multi Instructors',
46 ),
47 'tutor-prerequisites' => array(
48 'name' => __('Tutor Prerequisites', 'tutor-certificate'),
49 'description' => 'Specific course you must complete before you can enroll new course by Tutor Prerequisites',
50 ),
51 'tutor-report' => array(
52 'name' => __('Tutor Report', 'tutor-certificate'),
53 'description' => 'Check your tutor assets performance through tutor report',
54 ),
55 );
56
57
58 return $addons;
59 }
60
61
62 /**
63 * @deprecated from alpha version
64 */
65
66 public function addons_page(){
67
68 if ( false === ( $addons_themes_data = get_transient( 'tutor_addons_themes_data' ) ) ) {
69 //Request New
70 $api_endpoint = 'https://www.themeum.com/wp-json/addon-serve/v2/get-products';
71 $response = wp_remote_post( $api_endpoint, array(
72 'method' => 'POST',
73 'timeout' => 45,
74 'user-agent' => 'Tutor/'.TUTOR_VERSION.'; '.home_url( '/' ),
75 'headers' => array(
76 'wp_blog' => home_url( '/' )
77 ),
78 'body' => array('plugin_slug' => 'tutor', 'wp_blog' => home_url( '/' )),
79 )
80 );
81
82 if ( is_wp_error( $response ) ) {
83 $error_message = $response->get_error_message();
84 echo "Something went wrong: $error_message";
85 } else {
86 if (tutor_utils()->avalue_dot('body', $response) && tutor_utils()->avalue_dot('response.code', $response) == 200 ){
87 $api_data = tutor_utils()->avalue_dot('body', $response);
88
89 $addons_themes_data = array(
90 'last_checked_time' => time(),
91 'data' => $api_data,
92 );
93 }
94 }
95
96 //Save the Final api call result on the database
97 set_transient( 'tutor_addons_themes_data', $addons_themes_data, 6 * HOUR_IN_SECONDS );
98 }
99
100
101 //Finally Show the View Page
102 include tutor()->path.'views/pages/addons.php';
103 }
104
105 }