-
Notifications
You must be signed in to change notification settings - Fork 1
/
tutor-lms-bunnynet-integration.php
116 lines (105 loc) · 3 KB
/
tutor-lms-bunnynet-integration.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
<?php
/**
* Plugin Name: Tutor LMS BunnyNet Integration
* Plugin URI: https://www.themeum.com/product/tutor-lms/
* Description: Tutor LMS BunnyNet integration allows you to host your lesson videos on Tutor LMS using BunnNets’ very own Bunny Stream. Use this integration to load up and play your meticulously crafted course videos to enhance the experience for students.
* Author: Themeum
* Version: 1.0.0
* Author URI: https://themeum.com
* Requires at least: 5.3
* Tested up to: 6.1
* License: GPLv3
* Text Domain: tutor-lms-bunnynet-integration
* Domain Path: /languages
*
* @package TutorLMSBunnyNetIntegration
*/
use Tutor\BunnyNetIntegration\AdminNotice\AdminNotice;
use Tutor\BunnyNetIntegration\Integration\BunnyNet;
if ( ! class_exists( 'TutorLMSBunnyNetIntegration' ) ) {
/**
* PluginStarter main class that trigger the plugin
*/
final class TutorLMSBunnyNetIntegration {
/**
* Plugin meta data
*
* @since v1.0.0
*
* @var $plugin_data
*/
private static $meta_data = array();
/**
* Plugin instance
*
* @since v1.0.0
*
* @var $instance
*/
public static $instance = null;
/**
* Register hooks and load dependent files
*
* @since v1.0.0
*
* @return void
*/
public function __construct() {
if ( file_exists( __DIR__ . '/vendor/autoload.php' ) ) {
include_once __DIR__ . '/vendor/autoload.php';
}
add_action( 'plugins_loaded', array( $this, 'load_packages' ) );
add_action( 'init', array( __CLASS__, 'load_textdomain' ) );
}
/**
* Plugin meta data
*
* @since v1.0.0
*
* @return array contains plugin meta data
*/
public static function meta_data(): array {
self::$meta_data['tutor_req_ver'] = '2.1.2';
self::$meta_data['url'] = plugin_dir_url( __FILE__ );
self::$meta_data['path'] = plugin_dir_path( __FILE__ );
self::$meta_data['basename'] = plugin_basename( __FILE__ );
self::$meta_data['templates'] = trailingslashit( plugin_dir_path( __FILE__ ) . 'templates' );
self::$meta_data['views'] = trailingslashit( plugin_dir_path( __FILE__ ) . 'views' );
self::$meta_data['assets'] = trailingslashit( plugin_dir_url( __FILE__ ) . 'assets' );
return self::$meta_data;
}
/**
* Create and return instance of this plugin
*
* @return self instance of plugin
*/
public static function instance() {
if ( null === self::$instance ) {
self::$instance = new self();
}
return self::$instance;
}
/**
* Load packages
*
* @return void
*/
public function load_packages() {
// If tutor is not active then load notice only.
new AdminNotice();
if ( function_exists( 'tutor' ) && AdminNotice::is_tutor_core_has_req_version() ) {
new BunnyNet();
}
}
/**
* Load plugin text domain
*
* @return void
*/
public static function load_textdomain() {
load_plugin_textdomain( 'easy-poll', false, plugin_dir_path( __FILE__ ) . 'languages/' );
}
}
// trigger.
TutorLMSBunnyNetIntegration::instance();
}