Addons.php
6 years ago
Admin.php
6 years ago
Ajax.php
6 years ago
Assets.php
6 years ago
Course.php
6 years ago
Course_Widget.php
6 years ago
Gutenberg.php
6 years ago
Instructor.php
6 years ago
Instructors_List.php
6 years ago
Lesson.php
6 years ago
Options.php
6 years ago
Post_types.php
6 years ago
Q_and_A.php
6 years ago
Question.php
6 years ago
Question_Answers_List.php
6 years ago
Quiz.php
6 years ago
Quiz_Attempts_List.php
6 years ago
Rewrite_Rules.php
6 years ago
Shortcode.php
6 years ago
Student.php
6 years ago
Students_List.php
6 years ago
Taxonomies.php
6 years ago
Template.php
6 years ago
Theme_Compatibility.php
6 years ago
Tools.php
6 years ago
Tutor.php
6 years ago
TutorEDD.php
6 years ago
Tutor_Base.php
6 years ago
Tutor_List_Table.php
6 years ago
Upgrader.php
6 years ago
User.php
6 years ago
Utils.php
6 years ago
Video_Stream.php
6 years ago
Withdraw.php
6 years ago
Withdraw_Requests_List.php
6 years ago
WooCommerce.php
6 years ago
Addons.php
105 lines
| 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 | } |