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.1 3.6.2 3.6.3 3.6.4 3.7.0 3.7.1 3.7.2 3.7.3 3.7.4 3.8.0 3.8.1 3.8.2 3.8.3 3.9.0 3.9.1 3.9.10 3.9.2 3.9.3 3.9.4 3.9.5 3.9.6 3.9.7 3.9.8 3.9.9
tutor / classes / Options.php
tutor / classes Last commit date
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_Settings_Tabs.php 6 years ago Course_Widget.php 6 years ago Dashboard.php 6 years ago Email.php 6 years ago FormHandler.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_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
Options.php
565 lines
1 <?php
2 namespace Tutor;
3
4 if ( ! defined( 'ABSPATH' ) )
5 exit;
6
7 class Options {
8
9 public $option;
10 public $options_attr;
11
12 public function __construct() {
13 $this->option = (array) maybe_unserialize(get_option('tutor_option'));
14 $this->options_attr = $this->options_attr();
15
16 //Saving option
17 add_action('wp_ajax_tutor_option_save', array($this, 'tutor_option_save'));
18 }
19
20 private function get($key = null, $default = false){
21 $option = $this->option;
22 if (empty($option) || ! is_array($option)){
23 return $default;
24 }
25 if ( ! $key){
26 return $option;
27 }
28 if (array_key_exists($key, $option)){
29 return apply_filters($key, $option[$key]);
30 }
31 //Access array value via dot notation, such as option->get('value.subvalue')
32 if (strpos($key, '.')){
33 $option_key_array = explode('.', $key);
34 $new_option = $option;
35 foreach ($option_key_array as $dotKey){
36 if (isset($new_option[$dotKey])){
37 $new_option = $new_option[$dotKey];
38 }else{
39 return $default;
40 }
41 }
42 return apply_filters($key, $new_option);
43 }
44
45 return $default;
46 }
47
48 public function tutor_option_save(){
49 if ( ! isset($_POST['_wpnonce']) || ! wp_verify_nonce( $_POST['_wpnonce'], 'tutor_option_save' ) ){
50 exit();
51 }
52
53 do_action('tutor_option_save_before');
54
55 $option = (array) isset($_POST['tutor_option']) ? $_POST['tutor_option'] : array();
56 $option = apply_filters('tutor_option_input', $option);
57 update_option('tutor_option', $option);
58
59 do_action('tutor_option_save_after');
60 //re-sync settings
61 //init::tutor_activate();
62
63 wp_send_json_success( array('msg' => __('Option Updated', 'tutor') ) );
64 }
65
66 public function options_attr(){
67 $pages = tutor_utils()->get_pages();
68
69 //$course_base = tutor_utils()->course_archive_page_url();
70 $lesson_url = site_url().'/course/'.'sample-course/<code>lessons</code>/sample-lesson/';
71 $student_url = tutor_utils()->profile_url();
72 $attempts_allowed = array();
73 $attempts_allowed['unlimited'] = __('Unlimited' , 'tutor');
74 $attempts_allowed = array_merge($attempts_allowed, array_combine(range(1,20), range(1,20)));
75
76 $attr = array(
77 'general' => array(
78 'label' => __('General', 'tutor'),
79 'sections' => array(
80 'general' => array(
81 'label' => __('General', 'tutor'),
82 'desc' => __('General Settings', 'tutor'),
83 'fields' => array(
84 'tutor_dashboard_page_id' => array(
85 'type' => 'select',
86 'label' => __('Dashboard Page', 'tutor'),
87 'default' => '0',
88 'options' => $pages,
89 'desc' => __('This page will be used for student and instructor dashboard', 'tutor'),
90 ),
91 'enable_public_profile' => array(
92 'type' => 'checkbox',
93 'label' => __('Public Profile', 'tutor'),
94 'label_title' => __('Enable', 'tutor'),
95 'default' => '0',
96 'desc' => __('Enable this to make a profile publicly visible', 'tutor')."<br />" .$student_url,
97 ),
98 'load_tutor_css' => array(
99 'type' => 'checkbox',
100 'label' => __('Load Tutor CSS', 'tutor'),
101 'label_title' => __('Enable', 'tutor'),
102 'default' => '1',
103 'desc' => __('If your theme has its own styling, then you can turn it off to load CSS from the plugin directory', 'tutor'),
104 ),
105 'load_tutor_js' => array(
106 'type' => 'checkbox',
107 'label' => __('Load Tutor JavaScript', 'tutor'),
108 'label_title' => __('Enable', 'tutor'),
109 'default' => '1',
110 'desc' => __('If you have put required script in your theme javascript file, then you can turn it off to load JavaScript from the plugin directory', 'tutor'),
111 ),
112 'student_must_login_to_view_course' => array(
113 'type' => 'checkbox',
114 'label' => __('Course Visibility', 'tutor'),
115 'label_title' => __('Logged in only', 'tutor'),
116 'desc' => __('Students must be logged in to view course', 'tutor'),
117 ),
118 'delete_on_uninstall' => array(
119 'type' => 'checkbox',
120 'label' => __('Erase upon uninstallation', 'tutor'),
121 'label_title' => __('Enable', 'tutor'),
122 'desc' => __('Delete all data during uninstallation', 'tutor'),
123 ),
124
125 'enable_spotlight_mode' => array(
126 'type' => 'checkbox',
127 'label' => __('Spotlight mode', 'tutor'),
128 'label_title' => __('Enable', 'tutor'),
129 'default' => '0',
130 'desc' => __('This will hide the header and the footer and enable spotlight (full screen) mode when students view lessons.', 'tutor'),
131 ),
132 'disable_default_player_youtube' => array(
133 'type' => 'checkbox',
134 'label' => __('YouTube Player', 'tutor'),
135 'label_title' => __('Enable', 'tutor'),
136 'default' => '0',
137 'desc' => __('Disable this option to use Tutor LMS video player.', 'tutor'),
138 ),
139 'disable_default_player_vimeo' => array(
140 'type' => 'checkbox',
141 'label' => __('Vimeo Player', 'tutor'),
142 'label_title' => __('Enable', 'tutor'),
143 'default' => '0',
144 'desc' => __('Disable this option to use Tutor LMS video player.', 'tutor'),
145 ),
146 'pagination_per_page' => array(
147 'type' => 'number',
148 'label' => __('Pagination', 'tutor'),
149 'default' => '20',
150 'desc' => __('Number of items you would like displayed "per page" in the pagination', 'tutor'),
151 ),
152 )
153 )
154 ),
155 ),
156 'course' => array(
157 'label' => __('Course', 'tutor'),
158 'sections' => array(
159 'general' => array(
160 'label' => __('General', 'tutor'),
161 'desc' => __('Course Settings', 'tutor'),
162 'fields' => array(
163 'enable_gutenberg_course_edit' => array(
164 'type' => 'checkbox',
165 'label' => __('Gutenberg Editor', 'tutor'),
166 'label_title' => __('Enable', 'tutor'),
167 'desc' => __('Use Gutenberg editor on course description area.', 'tutor'),
168 ),
169 'display_course_instructors' => array(
170 'type' => 'checkbox',
171 'label' => __('Display Instructor Info', 'tutor'),
172 'label_title' => __('Enable', 'tutor'),
173 'desc' => __('Show instructor bio on each page', 'tutor'),
174 ),
175 'enable_q_and_a_on_course' => array(
176 'type' => 'checkbox',
177 'label' => __('Question and Answer', 'tutor'),
178 'label_title' => __('Enable','tutor'),
179 'default' => '0',
180 'desc' => __('Enabling this feature will add a Q&amp;A section on every course.', 'tutor'),
181 ),
182 ),
183 ),
184 'archive' => array(
185 'label' => __('Archive', 'tutor'),
186 'desc' => __('Course Archive Settings', 'tutor'),
187 'fields' => array(
188 'course_archive_page' => array(
189 'type' => 'select',
190 'label' => __('Course Archive Page', 'tutor'),
191 'default' => '0',
192 'options' => $pages,
193 'desc' => __('This page will be used to list all the published courses.', 'tutor'),
194 ),
195 'courses_col_per_row' => array(
196 'type' => 'slider',
197 'label' => __('Column per row', 'tutor'),
198 'default' => '4',
199 'options' => array('min'=> 1, 'max' => 6),
200 'desc' => __('Define how many column you want to use to display courses.', 'tutor'),
201 ),
202 'courses_per_page' => array(
203 'type' => 'slider',
204 'label' => __('Courses Per Page', 'tutor'),
205 'default' => '12',
206 'options' => array('min'=> 1, 'max' => 20),
207 'desc' => __('Define how many courses you want to show per page', 'tutor'),
208 ),
209 ),
210 ),
211 ),
212 ),
213 'lesson' => array(
214 'label' => __('Lessons', 'tutor'),
215 'sections' => array(
216 'lesson_settings' => array(
217 'label' => __('Lesson Settings', 'tutor'),
218 'desc' => __('Lesson settings will be here', 'tutor'),
219 'fields' => array(
220 'enable_lesson_classic_editor' => array(
221 'type' => 'checkbox',
222 'label' => __('Classic Editor', 'tutor'),
223 'label_title' => __('Enable', 'tutor'),
224 'desc' => __('Enable classic editor to get full support of any editor/page builder.', 'tutor'),
225 ),
226 'lesson_permalink_base' => array(
227 'type' => 'text',
228 'label' => __('Lesson Permalink Base', 'tutor'),
229 'default' => 'lessons',
230 'desc' => $lesson_url,
231 ),
232 ),
233 ),
234
235 ),
236 ),
237 'quiz' => array(
238 'label' => __('Quiz', 'tutor'),
239 'sections' => array(
240 'general' => array(
241 'label' => __('Quiz', 'tutor'),
242 'desc' => __('The values you set here define the default values that are used in the settings form when you create a new quiz.', 'tutor'),
243 'fields' => array(
244 'quiz_time_limit' => array(
245 'type' => 'group_fields',
246 'label' => __('Time Limit', 'tutor'),
247 'desc' => __('0 means unlimited time.', 'tutor'),
248 'group_fields' => array(
249 'value' => array(
250 'type' => 'text',
251 'default' => '0',
252 ),
253 'time' => array(
254 'type' => 'select',
255 'default' => 'minutes',
256 'select_options' => false,
257 'options' => array(
258 'weeks' => __('Weeks', 'tutor'),
259 'days' => __('Days', 'tutor'),
260 'hours' => __('Hours', 'tutor'),
261 'minutes' => __('Minutes', 'tutor'),
262 'seconds' => __('Seconds', 'tutor'),
263 ),
264 ),
265 ),
266 ),
267 'quiz_when_time_expires' => array(
268 'type' => 'radio',
269 'label' => __('When time expires', 'tutor'),
270 'default' => 'minutes',
271 'select_options' => false,
272 'options' => array(
273 'autosubmit' => __('The current quiz answers are submitted automatically.', 'tutor'),
274 'graceperiod' => __('The current quiz answers are submitted by students.', 'tutor'),
275 'autoabandon' => __('Attempts must be submitted before time expires, otherwise they will not be counted', 'tutor'),
276 ),
277 'desc' => __('Choose which action to follow when the quiz time expires.', 'tutor'),
278 ),
279 'quiz_attempts_allowed' => array(
280 'type' => 'number',
281 'label' => __('Attempts allowed', 'tutor'),
282 'default' => '10',
283 'desc' => __('The highest number of attempts students are allowed to take for a quiz. 0 means unlimited attempts.', 'tutor'),
284 ),
285 'quiz_grade_method' => array(
286 'type' => 'select',
287 'label' => __('Final grade calculation', 'tutor'),
288 'default' => 'minutes',
289 'select_options' => false,
290 'options' => array(
291 'highest_grade' => __('Highest Grade', 'tutor'),
292 'average_grade' => __('Average Grade', 'tutor'),
293 'first_attempt' => __('First Attempt', 'tutor'),
294 'last_attempt' => __('Last Attempt', 'tutor'),
295 ),
296 'desc' => __('When multiple attempts are allowed, which method should be used to calculate a student\'s final grade for the quiz.', 'tutor'),
297 ),
298 )
299 )
300 ),
301 ),
302 'instructors' => array(
303 'label' => __('Instructors', 'tutor'),
304 'sections' => array(
305 'general' => array(
306 'label' => __('Instructor Profile Settings', 'tutor'),
307 'desc' => __('Enable Disable Option to on/off notification on various event', 'tutor'),
308 'fields' => array(
309 'enable_course_marketplace' => array(
310 'type' => 'checkbox',
311 'label' => __('Course Marketplace', 'tutor'),
312 'label_title' => __('Enable', 'tutor'),
313 'default' => '0',
314 'desc' => __('Allow multiple instructors to upload their courses.', 'tutor'),
315 ),
316 'instructor_register_page' => array(
317 'type' => 'select',
318 'label' => __('Instructor Registration Page', 'tutor'),
319 'default' => '0',
320 'options' => $pages,
321 'desc' => __('This page will be used to sign up new instructors.', 'tutor'),
322 ),
323 'instructor_can_publish_course' => array(
324 'type' => 'checkbox',
325 'label' => __('Allow publishing course', 'tutor'),
326 'label_title' => __('Enable', 'tutor'),
327 'default' => '0',
328 'desc' => __('Enable instructors to publish course directly. <strong>Do not select</strong> if admins want to review courses before publishing.', 'tutor'),
329 ),
330 'enable_become_instructor_btn' => array(
331 'type' => 'checkbox',
332 'label' => __('Become Instructor Button', 'tutor'),
333 'label_title' => __('Enable', 'tutor'),
334 'default' => '0',
335 'desc' => __('Uncheck this option to hide the button from student dashboard.', 'tutor'),
336 ),
337 ),
338 ),
339 ),
340 ),
341 'students' => array(
342 'label' => __('Students', 'tutor'),
343 'sections' => array(
344 'general' => array(
345 'label' => __('Student Profile settings', 'tutor'),
346 'desc' => __('Enable Disable Option to on/off notification on various event', 'tutor'),
347 'fields' => array(
348 'student_register_page' => array(
349 'type' => 'select',
350 'label' => __('Student Registration Page', 'tutor'),
351 'default' => '0',
352 'options' => $pages,
353 'desc' => __('Choose the page for student registration page', 'tutor'),
354 ),
355 'students_own_review_show_at_profile' => array(
356 'type' => 'checkbox',
357 'label' => __('Show reviews on profile', 'tutor'),
358 'label_title' => __('Enable', 'tutor'),
359 'default' => '0',
360 'desc' => __('Enabling this will show the reviews written by each student on their profile', 'tutor')."<br />" .$student_url,
361 ),
362 'show_courses_completed_by_student' => array(
363 'type' => 'checkbox',
364 'label' => __('Show completed courses', 'tutor'),
365 'label_title' => __('Enable', 'tutor'),
366 'default' => '0',
367 'desc' => __('Completed courses will be shown on student profiles. <br/> For example, you can see this link-', 'tutor').$student_url,
368 ),
369 ),
370 ),
371 ),
372 ),
373 'tutor_earning' => array(
374 'label' => __('Earning', 'tutor'),
375 'sections' => array(
376 'general' => array(
377 'label' => __('Earning and commission allocation', 'tutor'),
378 'desc' => __('Enable Disable Option to on/off notification on various event', 'tutor'),
379 'fields' => array(
380 'enable_tutor_earning' => array(
381 'type' => 'checkbox',
382 'label' => __('Earning', 'tutor'),
383 'label_title' => __('Enable', 'tutor'),
384 'default' => '0',
385 'desc' => __('If disabled, the Admin will receive 100% of the earning', 'tutor'),
386 ),
387 'earning_admin_commission' => array(
388 'type' => 'number',
389 'label' => __('Admin Commission Percentage', 'tutor'),
390 'default' => '20',
391 'desc' => __('Define the commission of the Admin from each sale.(after deducting fees)', 'tutor'),
392 ),
393 'earning_instructor_commission' => array(
394 'type' => 'number',
395 'label' => __('Instructor Commission Percentage', 'tutor'),
396 'default' => '80',
397 'desc' => __('Define the commission for instructors from each sale.(after deducting fees)', 'tutor'),
398 ),
399 'tutor_earning_fees' => array(
400 'type' => 'group_fields',
401 'label' => __('Fee Deduction', 'tutor'),
402 'desc' => __('Fees are charged from the entire sales amount. The remaining amount will be divided among admin and instructors.', 'tutor'),
403 'group_fields' => array(
404
405 'enable_fees_deducting' => array(
406 'type' => 'checkbox',
407 'label' => __('Enable', 'tutor'),
408 'default' => '0',
409 ),
410 'fees_name' => array(
411 'type' => 'text',
412 'label' => __('Fee Name', 'tutor'),
413 'default' => '',
414 ),
415 'fees_amount' => array(
416 'type' => 'number',
417 'label' => __('Fee Amount', 'tutor'),
418 'default' => '',
419 ),
420 'fees_type' => array(
421 'type' => 'select',
422 'default' => 'minutes',
423 'select_options' => false,
424 'options' => array(
425 '' => __('Select Fees Type', 'tutor'),
426 'percent' => __('Percent', 'tutor'),
427 'fixed' => __('Fixed', 'tutor'),
428 ),
429 ),
430
431 ),
432 ),
433 'statement_show_per_page' => array(
434 'type' => 'number',
435 'label' => __('Show Statement Per Page', 'tutor'),
436 'default' => '20',
437 'desc' => __('Define the number of statements to show.', 'tutor'),
438 ),
439 ),
440 ),
441 ),
442 ),
443 'tutor_withdraw' => array(
444 'label' => __('Withdraw', 'tutor'),
445 'sections' => array(
446 'general' => array(
447 'label' => __('Withdrawal Settings', 'tutor'),
448 'fields' => array(
449 'min_withdraw_amount' => array(
450 'type' => 'number',
451 'label' => __('Minimum Withdraw Amount', 'tutor'),
452 'default' => '80',
453 'desc' => __('Instructors should earn equal or above this amount to make a withdraw request.', 'tutor'),
454 ),
455 ),
456 ),
457
458 'withdraw_methods' => array(
459 'label' => __('Withdraw Methods', 'tutor'),
460 'desc' => __('Set withdraw settings', 'tutor'),
461 ),
462 ),
463 ),
464
465 'tutor_style' => array(
466 'label' => __('Style', 'tutor'),
467 'sections' => array(
468 'general' => array(
469 'label' => __('Color Style', 'tutor'),
470 'fields' => array(
471 'tutor_primary_color' => array(
472 'type' => 'color',
473 'label' => __('Primary Color', 'tutor'),
474 'default' => '',
475 ),
476 'tutor_primary_hover_color' => array(
477 'type' => 'color',
478 'label' => __('Primary Hover Color', 'tutor'),
479 'default' => '',
480 ),
481 'tutor_text_color' => array(
482 'type' => 'color',
483 'label' => __('Text color', 'tutor'),
484 'default' => '',
485 ),
486 'tutor_light_color' => array(
487 'type' => 'color',
488 'label' => __('Light color', 'tutor'),
489 'default' => '',
490 ),
491 ),
492 ),
493
494 ),
495 ),
496
497 'monetization' => array(
498 'label' => __('Monetization', 'tutor'),
499 'sections' => array(
500 'general' => array(
501 'label' => __('Monetization', 'tutor'),
502 'desc' => __('You can monetize your LMS website by selling courses in a various way.', 'tutor'),
503 'fields' => array(
504
505 'monetize_by' => array(
506 'type' => 'radio',
507 'label' => __('Monetize Option', 'tutor'),
508 'default' => 'free',
509 'select_options' => false,
510 'options' => apply_filters('tutor_monetization_options', array(
511 'free' => __('Disable Monetization', 'tutor'),
512 )),
513 'desc' => __('Select a monetization option to generate revenue by selling courses. Supports: WooCommerce, Easy Digital Downloads, Paid Memberships Pro', 'tutor'),
514 ),
515
516 )
517 )
518 ),
519 ),
520
521 );
522
523 $attrs = apply_filters('tutor/options/attr', $attr);
524 $extends = apply_filters('tutor/options/extend/attr', array());
525
526 if (tutils()->count($extends)){
527 foreach ($extends as $extend_key => $extend_option){
528 if (isset($attrs[$extend_key])&& tutils()->count($extend_option['sections']) ){
529 $sections = $attrs[$extend_key]['sections'];
530 $sections = array_merge($sections, $extend_option['sections']);
531 $attrs[$extend_key]['sections'] = $sections;
532 }
533 }
534 }
535
536 return $attrs;
537
538 }
539
540 /**
541 * @param array $field
542 *
543 * @return string
544 *
545 * Generate Option Field
546 */
547 public function generate_field($field = array()){
548 ob_start();
549 include tutor()->path.'views/options/option_field.php';
550 return ob_get_clean();
551 }
552
553 public function field_type($field = array()){
554 ob_start();
555 include tutor()->path."views/options/field-types/{$field['type']}.php";
556 return ob_get_clean();
557 }
558
559 public function generate(){
560 ob_start();
561 include tutor()->path.'views/options/options_generator.php';
562 return ob_get_clean();
563 }
564
565 }