PluginProbe
Tutor LMS – eLearning and online course solution / 2.2.1
Tutor LMS – eLearning and online course solution v2.2.1
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
← All changes | classes/Addons.php +72 -281 4.0.22.2.1 View file →
@@ -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
@@ -17,336 +18,126 @@
17 18 *
18 19 * @since 1.0.0
19 20 */
20 21 class Addons {
21 - const OPTION_KEY = 'tutor_addons_config';
22 22
23 23 /**
24 24 * Constructor
25 25 *
26 26 * @since 1.0.0
27 - *
28 27 * @return void
29 28 */
30 29 public function __construct() {
31 - add_filter( 'tutor_pro_addons_lists_for_display', array( $this, 'addons_lists_to_show' ) );
32 - add_action( 'wp_ajax_tutor_get_all_addons', array( $this, 'get_all_addons' ) );
33 - add_action( 'wp_ajax_addon_enable_disable', array( $this, 'addon_enable_disable' ) );
30 + add_filter( 'tutor_pro_addons_lists_for_display', array( $this, 'tutor_addons_lists_to_show' ) );
34 31 }
35 32
36 33 /**
37 - * Obtain addons config list.
38 - *
39 - * @since 3.0.0
40 - *
41 - * @return array
42 - */
43 - public static function get_addons_config() {
44 - $list = get_option( self::OPTION_KEY, array() );
45 - return $list;
46 - }
47 -
48 - /**
49 - * Status update of tutor addon.
50 - *
51 - * @since 3.0.0
52 - *
53 - * @param string $basename basename of addon.
54 - * @param bool $status status 0,1.
55 - *
56 - * @return void
57 - */
58 - public static function update_addon_status( $basename, $status ) {
59 - $config = self::get_addons_config();
60 - if ( isset( $config[ $basename ] ) ) {
61 - $config[ $basename ]['is_enable'] = $status;
62 - update_option( self::OPTION_KEY, $config );
63 - }
64 - }
65 -
66 - /**
67 - * Get all addons data.
68 - *
69 - * @since 1.0.0
70 - *
71 - * @return void
72 - */
73 - public function get_all_addons() {
74 -
75 - // Check and verify the request.
76 - tutor_utils()->checking_nonce();
77 -
78 - if ( ! User::can() ) {
79 - wp_send_json_error( tutor_utils()->error_message() );
80 - }
81 -
82 - // All good, let's proceed.
83 - $all_addons = $this->prepare_addons_data();
84 -
85 - wp_send_json_success(
86 - array(
87 - 'addons' => $all_addons,
88 - )
89 - );
90 - }
91 -
92 - /**
93 - * Prepare addons data.
94 - *
95 - * @since 1.0.0
96 - * @return array
97 - */
98 - public function prepare_addons_data() {
99 - $addons = apply_filters( 'tutor_addons_lists_config', array() );
100 - $plugins_data = $addons;
101 -
102 - if ( is_array( $addons ) && count( $addons ) ) {
103 - foreach ( $addons as $base_name => $addon ) {
104 - $addon_config = tutor_utils()->get_addon_config( $base_name );
105 - $is_enabled = (bool) tutor_utils()->avalue_dot( 'is_enable', $addon_config );
106 -
107 - $plugins_data[ $base_name ]['is_enabled'] = $is_enabled;
108 -
109 - $thumbnail_url = tutor()->url . 'assets/images/tutor-plugin.png';
110 - if ( file_exists( $addon['path'] . 'assets/images/thumbnail.png' ) ) {
111 - $thumbnail_url = $addon['url'] . 'assets/images/thumbnail.png';
112 - } elseif ( file_exists( $addon['path'] . 'assets/images/thumbnail.jpg' ) ) {
113 - $thumbnail_url = $addon['url'] . 'assets/images/thumbnail.jpg';
114 - } elseif ( file_exists( $addon['path'] . 'assets/images/thumbnail.svg' ) ) {
115 - $thumbnail_url = $addon['url'] . 'assets/images/thumbnail.svg';
116 - }
117 -
118 - $plugins_data[ $base_name ]['thumb_url'] = $thumbnail_url;
119 -
120 - /**
121 - * Checking if there any dependant plugin exists
122 - */
123 - $depends = tutor_utils()->array_get( 'depend_plugins', $addon );
124 - $plugins_required = array();
125 - if ( tutor_utils()->count( $depends ) ) {
126 - foreach ( $depends as $plugin_base => $plugin_name ) {
127 - if ( ! is_plugin_active( $plugin_base ) ) {
128 - $plugins_required[ $plugin_base ] = $plugin_name;
129 - }
130 - }
131 - }
132 -
133 - $depended_plugins = array();
134 - foreach ( $plugins_required as $required_plugin ) {
135 - array_push( $depended_plugins, $required_plugin );
136 - }
137 -
138 - $plugins_data[ $base_name ]['plugins_required'] = $depended_plugins;
139 -
140 - // Check if it's notifications.
141 - if ( function_exists( 'tutor_notifications' ) && tutor_notifications()->basename === $base_name ) {
142 -
143 - $required = array();
144 - version_compare( PHP_VERSION, '7.2.5', '>=' ) ? 0 : $required[] = __( 'PHP 7.2.5 or greater is required', 'tutor' );
145 - ! is_ssl() ? $required[] = __( 'SSL certificate', 'tutor' ) : 0;
146 -
147 - foreach ( array( 'curl', 'gmp', 'mbstring', 'openssl' ) as $ext ) {
148 - ! extension_loaded( $ext ) ? $required[] = 'PHP extension <strong>' . $ext . '</strong>' : 0;
149 - }
150 -
151 - $plugins_data[ $base_name ]['ext_required'] = $required;
152 - }
153 - }
154 - }
155 -
156 - /**
157 - * Keep same sorting order.
158 - *
159 - * @since 2.2.4
160 - */
161 - $free_addon_list = apply_filters( 'tutor_pro_addons_lists_for_display', array() );
162 - $prepared_addons = array();
163 -
164 - foreach ( $free_addon_list as $addon_name => $addon ) {
165 - $key = "tutor-pro/addons/{$addon_name}/{$addon_name}.php";
166 - if ( isset( $plugins_data[ $key ] ) ) {
167 - $prepared_addons[] = $plugins_data[ $key ];
168 - }
169 - }
170 -
171 - return $prepared_addons;
172 - }
173 -
174 - /**
175 - * Method for enable / disable addons
176 - *
177 - * @since 1.0.0
178 - * @return void
179 - */
180 - public function addon_enable_disable() {
181 -
182 - tutor_utils()->checking_nonce();
183 -
184 - if ( ! User::can() ) {
185 - wp_send_json_error( tutor_utils()->error_message() );
186 - }
187 -
188 - $form_data = json_decode( Input::post( 'addonFieldNames' ) );
189 - $before_config = self::get_addons_config();
190 - $addons_config = array();
191 -
192 - foreach ( $form_data as $addon_field_name => $is_enable ) {
193 -
194 - $before_status = ! isset( $before_config[ $addon_field_name ] ) ? 0 : $before_config[ $addon_field_name ]['is_enable'];
195 - $after_status = $is_enable ? 1 : 0;
196 -
197 - if ( $before_status !== $after_status ) {
198 - do_action( 'tutor_addon_before_enable_disable' );
199 - if ( $is_enable ) {
200 - do_action( "tutor_addon_before_enable_{$addon_field_name}" );
201 - do_action( 'tutor_addon_before_enable', $addon_field_name );
202 -
203 - $addons_config[ $addon_field_name ]['is_enable'] = 1;
204 - update_option( self::OPTION_KEY, $addons_config );
205 -
206 - do_action( 'tutor_addon_after_enable', $addon_field_name );
207 - do_action( "tutor_addon_after_enable_{$addon_field_name}" );
208 - } else {
209 - do_action( "tutor_addon_before_disable_{$addon_field_name}" );
210 - do_action( 'tutor_addon_before_disable', $addon_field_name );
211 -
212 - $addons_config[ $addon_field_name ]['is_enable'] = 0;
213 - update_option( self::OPTION_KEY, $addons_config );
214 -
215 - do_action( 'tutor_addon_after_disable', $addon_field_name );
216 - do_action( "tutor_addon_after_disable_{$addon_field_name}" );
217 - }
218 - do_action( 'tutor_addon_after_enable_disable' );
219 - } else {
220 - $addons_config[ $addon_field_name ]['is_enable'] = $after_status;
221 - update_option( self::OPTION_KEY, $addons_config );
222 - }
223 - }
224 -
225 - wp_send_json_success();
226 - }
227 -
228 - /**
229 34 * Get tutor addons list
230 35 *
231 36 * @since 1.0.0
232 - *
233 37 * @return array
234 38 */
235 - public function addons_lists_to_show() {
39 + public function tutor_addons_lists_to_show() {
236 40 $addons = array(
237 - 'course-bundle' => array(
238 - 'name' => __( 'Course Bundle', 'tutor' ),
239 - 'description' => __( 'Group multiple courses to sell together.', 'tutor' ),
41 + 'buddypress' => array(
42 + 'name' => __( 'BuddyPress', 'tutor' ),
43 + 'description' => 'Discuss about course and share your knowledge with your friends through BuddyPress',
240 44 ),
241 - 'subscription' => array(
242 - 'name' => __( 'Subscription', 'tutor' ),
243 - 'description' => __( 'Manage subscription', 'tutor' ),
45 + 'gradebook' => array(
46 + 'name' => __( 'Gradebook', 'tutor' ),
47 + 'description' => 'Shows student progress from assignment and quiz',
244 48 ),
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,
49 + 'content-drip' => array(
50 + 'name' => __( 'Content Drip', 'tutor' ),
51 + 'description' => 'Unlock lessons by schedule or when the student meets specific condition.',
249 52 ),
250 - 'social-login' => array(
251 - 'name' => __( 'Social Login', 'tutor' ),
252 - 'description' => __( 'Let users register & login through social networks.', 'tutor' ),
53 + 'enrollments' => array(
54 + 'name' => __( 'Enrollment', 'tutor' ),
55 + 'description' => 'Take advanced control on enrollment. Enroll the student manually.',
253 56 ),
254 - 'content-drip' => array(
255 - 'name' => __( 'Content Drip', 'tutor' ),
256 - 'description' => __( 'Unlock lessons by schedule or when students meet a specific condition.', 'tutor' ),
57 + 'wc-subscriptions' => array(
58 + 'name' => __( 'WooCommerce Subscriptions', 'tutor' ),
59 + 'description' => 'Capture Residual Revenue with Recurring Payments.',
257 60 ),
258 - 'tutor-multi-instructors' => array(
259 - 'name' => __( 'Tutor Multi Instructors', 'tutor' ),
260 - 'description' => __( 'Collaborate and add multiple instructors to a course.', 'tutor' ),
61 + 'pmpro' => array(
62 + 'name' => __( 'Paid Memberships Pro', 'tutor' ),
63 + 'description' => 'Maximize revenue by selling membership access to all of your courses.',
261 64 ),
65 + 'restrict-content-pro' => array(
66 + 'name' => __( 'Restrict Content Pro', 'tutor' ),
67 + 'description' => 'Unlock Course depending on Restrict Content Pro Plugin Permission.',
68 + ),
262 69 'tutor-assignments' => array(
263 70 'name' => __( 'Tutor Assignments', 'tutor' ),
264 - 'description' => __( 'Assess student learning with assignments.', 'tutor' ),
71 + 'description' => 'Tutor assignments is a great way to assign tasks to students.',
265 72 ),
266 - 'tutor-course-preview' => array(
267 - 'name' => __( 'Tutor Course Preview', 'tutor' ),
268 - 'description' => __( 'Offer free previews of specific lessons before enrollment.', 'tutor' ),
73 + 'tutor-certificate' => array(
74 + 'name' => __( 'Tutor Certificate', 'tutor' ),
75 + 'description' => 'Students will be able to download a certificate after course completion.',
269 76 ),
270 77 'tutor-course-attachments' => array(
271 78 'name' => __( 'Tutor Course Attachments', 'tutor' ),
272 - 'description' => __( 'Add unlimited attachments/ private files to any Tutor course', 'tutor' ),
79 + 'description' => 'Add unlimited attachments/ private files to any Tutor course',
273 80 ),
274 - 'google-meet' => array(
275 - 'name' => __( 'Tutor Google Meet Integration', 'tutor' ),
276 - 'description' => __( 'Host live classes with Google Meet, directly from your lesson page.', 'tutor' ),
81 + 'tutor-course-preview' => array(
82 + 'name' => __( 'Tutor Course Preview', 'tutor' ),
83 + 'description' => 'Unlock some lessons for students before enrollment.',
277 84 ),
278 - 'tutor-report' => array(
279 - 'name' => __( 'Tutor Report', 'tutor' ),
280 - 'description' => __( 'Check your course performance through Tutor Report stats.', 'tutor' ),
281 - ),
282 85 'tutor-email' => array(
283 - 'name' => __( 'Email', 'tutor' ),
284 - 'description' => __( 'Send automated and customized emails for various Tutor events.', 'tutor' ),
86 + 'name' => __( 'Tutor E-Mail', 'tutor' ),
87 + 'description' => 'Send email on various tutor events',
285 88 ),
286 - 'calendar' => array(
287 - 'name' => __( 'Calendar', 'tutor' ),
288 - 'description' => __( 'Enable to let students view all your course events in one place.', 'tutor' ),
89 + 'tutor-multi-instructors' => array(
90 + 'name' => __( 'Tutor Multi Instructors', 'tutor' ),
91 + 'description' => 'Start a course with multiple instructors by Tutor Multi Instructors',
289 92 ),
290 - 'tutor-notifications' => array(
291 - 'name' => __( 'Notifications', 'tutor' ),
292 - 'description' => __( 'Keep students and instructors notified of course events on their dashboard.', 'tutor' ),
93 + 'tutor-prerequisites' => array(
94 + 'name' => __( 'Tutor Prerequisites', 'tutor' ),
95 + 'description' => 'Specific course you must complete before you can enroll new course by Tutor Prerequisites',
293 96 ),
294 - 'google-classroom' => array(
295 - 'name' => __( 'Google Classroom Integration', 'tutor' ),
296 - 'description' => __( 'Enable to integrate Tutor LMS with Google Classroom.', 'tutor' ),
97 + 'tutor-report' => array(
98 + 'name' => __( 'Tutor Report', 'tutor' ),
99 + 'description' => 'Check your course performance through Tutor Report stats.',
297 100 ),
298 - 'tutor-zoom' => array(
299 - 'name' => __( 'Tutor Zoom Integration', 'tutor' ),
300 - 'description' => __( 'Connect Tutor LMS with Zoom to host live online classes.', 'tutor' ),
301 - ),
302 101 'quiz-import-export' => array(
303 102 'name' => __( 'Quiz Export/Import', 'tutor' ),
304 103 'description' => __( 'Save time by exporting/importing quiz data with easy options.', 'tutor' ),
305 104 ),
306 - 'enrollments' => array(
307 - 'name' => __( 'Enrollment', 'tutor' ),
308 - 'description' => __( 'Enable to manually enroll students in your courses.', 'tutor' ),
105 + 'tutor-zoom' => array(
106 + 'name' => __( 'Tutor Zoom Integration', 'tutor' ),
107 + 'description' => __( 'Connect Tutor LMS with Zoom to host live online classes. Students can attend live classes right from the lesson page.', 'tutor' ),
309 108 ),
310 - 'tutor-certificate' => array(
311 - 'name' => __( 'Tutor Certificate', 'tutor' ),
312 - 'description' => __( 'Enable to award certificates upon course completion.', 'tutor' ),
109 + 'google-meet' => array(
110 + 'name' => __( 'Tutor Google Meet Integration', 'tutor' ),
111 + 'description' => __( 'Connect Tutor LMS with Google Meet to host live online classes. Students can attend live classes right from the lesson page.', 'tutor' ),
313 112 ),
314 - 'gradebook' => array(
315 - 'name' => __( 'Gradebook', 'tutor' ),
316 - 'description' => __( 'Track student progress with a centralized gradebook.', 'tutor' ),
113 + 'google-classroom' => array(
114 + 'name' => __( 'Google Classroom Integration', 'tutor' ),
115 + 'description' => __( 'Helps connect Google Classrooms with Tutor LMS courses, allowing you to use features like Classroom streams and files directly from the Tutor LMS course.', 'tutor' ),
317 116 ),
318 - 'tutor-prerequisites' => array(
319 - 'name' => __( 'Tutor Prerequisites', 'tutor' ),
320 - 'description' => __( 'Set course prerequisites to guide learning paths effectively.', 'tutor' ),
117 + 'tutor-calendar' => array(
118 + 'name' => 'Calendar',
119 + 'description' => 'Allow students to see everything in a calendar view in the front dashboard.',
321 120 ),
322 - 'buddypress' => array(
323 - 'name' => __( 'BuddyPress', 'tutor' ),
324 - 'description' => __( 'Boost engagement with social features through BuddyPress for Tutor LMS.', 'tutor' ),
121 + 'tutor-notifications' => array(
122 + 'name' => 'Notifications',
123 + 'description' => 'Get On Site and Push Notifications on specified tutor events.',
325 124 ),
326 - 'wc-subscriptions' => array(
327 - 'name' => __( 'WooCommerce Subscriptions', 'tutor' ),
328 - 'description' => __( 'Capture Residual Revenue with Recurring Payments.', 'tutor' ),
329 - ),
330 - 'pmpro' => array(
331 - 'name' => __( 'Paid Memberships Pro', 'tutor' ),
332 - 'description' => __( 'Boost revenue by selling course memberships.', 'tutor' ),
333 - ),
334 - 'restrict-content-pro' => array(
335 - 'name' => __( 'Restrict Content Pro', 'tutor' ),
336 - 'description' => __( 'Enable to manage content access through Restrict Content Pro. ', 'tutor' ),
337 - ),
338 125 'tutor-weglot' => array(
339 - 'name' => __( 'Weglot', 'tutor' ),
340 - 'description' => __( 'Translate & manage multilingual courses for global reach.', 'tutor' ),
126 + 'name' => 'Weglot',
127 + 'description' => __( 'Translate & manage multilingual courses for global reach with full edit control.', 'tutor' ),
341 128 ),
342 129 'tutor-wpml' => array(
343 - 'name' => __( 'WPML', 'tutor' ),
344 - 'description' => __( 'Create multilingual courses, lessons, dashboard and more.', 'tutor' ),
130 + 'name' => __( 'WPML Multilingual CMS', 'tutor' ),
131 + 'description' => __( 'Create multilingual courses, lessons, dashboard and more for a global audience.', 'tutor' ),
345 132 ),
346 - 'h5p' => array(
347 - 'name' => __( 'H5P', 'tutor' ),
348 - 'description' => __( 'Integrate H5P to add interactivity and engagement to your courses.', 'tutor' ),
133 + 'social-login' => array(
134 + 'name' => __( 'Social Login', 'tutor' ),
135 + 'description' => __( 'Let users register & login through social network like Facebook, Google, etc.', 'tutor' ),
136 + ),
137 + 'course-bundle' => array(
138 + 'name' => __( 'Course Bundle', 'tutor' ),
139 + 'description' => __( 'Group multiple courses to sell together.', 'tutor' ),
349 140 ),
350 141 );
351 142
352 143 return $addons;