PluginProbe
Tutor LMS – eLearning and online course solution / 2.4.0
Tutor LMS – eLearning and online course solution v2.4.0
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 +34 -243 trunk2.4.0 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,288 +18,82 @@
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 41 'course-bundle' => array(
238 42 'name' => __( 'Course Bundle', 'tutor' ),
239 43 'description' => __( 'Group multiple courses to sell together.', 'tutor' ),
240 44 ),
241 - 'subscription' => array(
242 - 'name' => __( 'Subscription', 'tutor' ),
243 - 'description' => __( 'Manage subscription', 'tutor' ),
244 - ),
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 45 'social-login' => array(
251 46 'name' => __( 'Social Login', 'tutor' ),
252 - 'description' => __( 'Let users register & login through social networks.', 'tutor' ),
47 + 'description' => __( 'Let users register & login through social network like Facebook, Google, etc.', 'tutor' ),
253 48 ),
254 49 'content-drip' => array(
255 50 'name' => __( 'Content Drip', 'tutor' ),
256 - 'description' => __( 'Unlock lessons by schedule or when students meet a specific condition.', 'tutor' ),
51 + 'description' => 'Unlock lessons by schedule or when the student meets specific condition.',
257 52 ),
258 53 'tutor-multi-instructors' => array(
259 54 'name' => __( 'Tutor Multi Instructors', 'tutor' ),
260 - 'description' => __( 'Collaborate and add multiple instructors to a course.', 'tutor' ),
55 + 'description' => 'Start a course with multiple instructors by Tutor Multi Instructors',
261 56 ),
262 57 'tutor-assignments' => array(
263 58 'name' => __( 'Tutor Assignments', 'tutor' ),
264 - 'description' => __( 'Assess student learning with assignments.', 'tutor' ),
59 + 'description' => 'Tutor assignments is a great way to assign tasks to students.',
265 60 ),
266 61 'tutor-course-preview' => array(
267 62 'name' => __( 'Tutor Course Preview', 'tutor' ),
268 - 'description' => __( 'Offer free previews of specific lessons before enrollment.', 'tutor' ),
63 + 'description' => 'Unlock some lessons for students before enrollment.',
269 64 ),
270 65 'tutor-course-attachments' => array(
271 66 'name' => __( 'Tutor Course Attachments', 'tutor' ),
272 - 'description' => __( 'Add unlimited attachments/ private files to any Tutor course', 'tutor' ),
67 + 'description' => 'Add unlimited attachments/ private files to any Tutor course',
273 68 ),
274 69 'google-meet' => array(
275 70 'name' => __( 'Tutor Google Meet Integration', 'tutor' ),
276 - 'description' => __( 'Host live classes with Google Meet, directly from your lesson page.', 'tutor' ),
71 + 'description' => __( 'Connect Tutor LMS with Google Meet to host live online classes. Students can attend live classes right from the lesson page.', 'tutor' ),
277 72 ),
278 73 'tutor-report' => array(
279 74 'name' => __( 'Tutor Report', 'tutor' ),
280 - 'description' => __( 'Check your course performance through Tutor Report stats.', 'tutor' ),
75 + 'description' => 'Check your course performance through Tutor Report stats.',
281 76 ),
282 77 'tutor-email' => array(
283 - 'name' => __( 'Email', 'tutor' ),
284 - 'description' => __( 'Send automated and customized emails for various Tutor events.', 'tutor' ),
78 + 'name' => __( 'Tutor E-Mail', 'tutor' ),
79 + 'description' => 'Send email on various tutor events',
285 80 ),
286 - 'calendar' => array(
287 - 'name' => __( 'Calendar', 'tutor' ),
288 - 'description' => __( 'Enable to let students view all your course events in one place.', 'tutor' ),
81 + 'calendar' => array(
82 + 'name' => 'Calendar',
83 + 'description' => 'Allow students to see everything in a calendar view in the front dashboard.',
289 84 ),
290 85 'tutor-notifications' => array(
291 - 'name' => __( 'Notifications', 'tutor' ),
292 - 'description' => __( 'Keep students and instructors notified of course events on their dashboard.', 'tutor' ),
86 + 'name' => 'Notifications',
87 + 'description' => 'Get On Site and Push Notifications on specified tutor events.',
293 88 ),
294 89 'google-classroom' => array(
295 90 'name' => __( 'Google Classroom Integration', 'tutor' ),
296 - 'description' => __( 'Enable to integrate Tutor LMS with Google Classroom.', 'tutor' ),
91 + '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' ),
297 92 ),
298 93 'tutor-zoom' => array(
299 94 'name' => __( 'Tutor Zoom Integration', 'tutor' ),
300 - 'description' => __( 'Connect Tutor LMS with Zoom to host live online classes.', 'tutor' ),
95 + 'description' => __( 'Connect Tutor LMS with Zoom to host live online classes. Students can attend live classes right from the lesson page.', 'tutor' ),
301 96 ),
302 97 'quiz-import-export' => array(
303 98 'name' => __( 'Quiz Export/Import', 'tutor' ),
304 99 'description' => __( 'Save time by exporting/importing quiz data with easy options.', 'tutor' ),
@@ -304,49 +99,45 @@
304 99 'description' => __( 'Save time by exporting/importing quiz data with easy options.', 'tutor' ),
305 100 ),
306 101 'enrollments' => array(
307 102 'name' => __( 'Enrollment', 'tutor' ),
308 - 'description' => __( 'Enable to manually enroll students in your courses.', 'tutor' ),
103 + 'description' => 'Take advanced control on enrollment. Enroll the student manually.',
309 104 ),
310 105 'tutor-certificate' => array(
311 106 'name' => __( 'Tutor Certificate', 'tutor' ),
312 - 'description' => __( 'Enable to award certificates upon course completion.', 'tutor' ),
107 + 'description' => 'Students will be able to download a certificate after course completion.',
313 108 ),
314 109 'gradebook' => array(
315 110 'name' => __( 'Gradebook', 'tutor' ),
316 - 'description' => __( 'Track student progress with a centralized gradebook.', 'tutor' ),
111 + 'description' => 'Shows student progress from assignment and quiz',
317 112 ),
318 113 'tutor-prerequisites' => array(
319 114 'name' => __( 'Tutor Prerequisites', 'tutor' ),
320 - 'description' => __( 'Set course prerequisites to guide learning paths effectively.', 'tutor' ),
115 + 'description' => 'Specific course you must complete before you can enroll new course by Tutor Prerequisites',
321 116 ),
322 117 'buddypress' => array(
323 118 'name' => __( 'BuddyPress', 'tutor' ),
324 - 'description' => __( 'Boost engagement with social features through BuddyPress for Tutor LMS.', 'tutor' ),
119 + 'description' => 'Discuss about course and share your knowledge with your friends through BuddyPress',
325 120 ),
326 121 'wc-subscriptions' => array(
327 122 'name' => __( 'WooCommerce Subscriptions', 'tutor' ),
328 - 'description' => __( 'Capture Residual Revenue with Recurring Payments.', 'tutor' ),
123 + 'description' => 'Capture Residual Revenue with Recurring Payments.',
329 124 ),
330 125 'pmpro' => array(
331 126 'name' => __( 'Paid Memberships Pro', 'tutor' ),
332 - 'description' => __( 'Boost revenue by selling course memberships.', 'tutor' ),
127 + 'description' => 'Maximize revenue by selling membership access to all of your courses.',
333 128 ),
334 129 'restrict-content-pro' => array(
335 130 'name' => __( 'Restrict Content Pro', 'tutor' ),
336 - 'description' => __( 'Enable to manage content access through Restrict Content Pro. ', 'tutor' ),
131 + 'description' => 'Unlock Course depending on Restrict Content Pro Plugin Permission.',
337 132 ),
338 133 'tutor-weglot' => array(
339 - 'name' => __( 'Weglot', 'tutor' ),
340 - 'description' => __( 'Translate & manage multilingual courses for global reach.', 'tutor' ),
134 + 'name' => 'Weglot',
135 + 'description' => __( 'Translate & manage multilingual courses for global reach with full edit control.', 'tutor' ),
341 136 ),
342 137 'tutor-wpml' => array(
343 - 'name' => __( 'WPML', 'tutor' ),
344 - 'description' => __( 'Create multilingual courses, lessons, dashboard and more.', 'tutor' ),
345 - ),
346 - 'h5p' => array(
347 - 'name' => __( 'H5P', 'tutor' ),
348 - 'description' => __( 'Integrate H5P to add interactivity and engagement to your courses.', 'tutor' ),
138 + 'name' => __( 'WPML Multilingual CMS', 'tutor' ),
139 + 'description' => __( 'Create multilingual courses, lessons, dashboard and more for a global audience.', 'tutor' ),
349 140 ),
350 141 );
351 142
352 143 return $addons;